Skip to content

Commit 891db95

Browse files
package updates and add ts to docs
1 parent 117900f commit 891db95

34 files changed

+700
-658
lines changed

src/App.vue

+77-19
Original file line numberDiff line numberDiff line change
@@ -144,29 +144,27 @@
144144
</v-app>
145145
</template>
146146

147-
<script setup>
148-
import { onMounted, computed, provide, ref } from 'vue';
147+
<script setup lang="ts">
148+
import Prism from 'prismjs';
149149
import { useDisplay } from 'vuetify';
150-
import AppBar from './documentation/layout/AppBar.vue';
151150
import MenuComponent from './documentation/components/MenuComponent.vue';
152151
import DocsPage from './documentation/DocsPage.vue';
152+
import AppBar from './documentation/layout/AppBar.vue';
153153
import { useCoreStore } from './stores/index';
154-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
155-
import Prism from 'prismjs';
156154
import 'prismjs/components/prism-typescript.js';
157155
158156
159157
onMounted(() => {
158+
Prism.highlightAll();
160159
getLocalStorage();
161160
});
162161
163162
const { smAndUp } = useDisplay();
164-
165-
const isSmAndUp = computed(() => smAndUp.value);
163+
const isSmAndUp = computed<boolean>(() => smAndUp.value);
166164
const store = useCoreStore();
167-
const drawer = ref(isSmAndUp.value);
165+
const drawer = ref<boolean>(isSmAndUp.value);
168166
const drawerOffset = ref('256px');
169-
const drawerOptions = ref({
167+
const drawerOptions: Ref<Docs.DrawerOptions> = ref<Docs.DrawerOptions>({
170168
absolute: false,
171169
color: '',
172170
dark: true,
@@ -177,10 +175,10 @@ const drawerOptions = ref({
177175
handleColor: 'primary',
178176
handlePosition: 'center',
179177
location: 'left',
180-
maxHeight: "50%",
181-
maxWidth: "50%",
182-
minHeight: "256",
183-
minWidth: "256",
178+
maxHeight: '50%',
179+
maxWidth: '50%',
180+
minHeight: '256',
181+
minWidth: '256',
184182
rail: false,
185183
railWidth: 56,
186184
resizable: true,
@@ -209,11 +207,11 @@ const gridDrawerOptions = ref({
209207
const gridDrawerWidth = ref('256px');
210208
const computedWidth = ref(gridDrawerWidth.value);
211209
212-
const codeBlockPlugin = 'prismjs';
213-
const codeBlockLightTheme = 'tomorrow';
214-
const codeBlockDarkTheme = 'tomorrow';
210+
const codeBlockPlugin: string = 'prismjs';
211+
const codeBlockLightTheme: string = 'tomorrow';
212+
const codeBlockDarkTheme: string = 'tomorrow';
215213
216-
const codeBlockSettings = ref({
214+
const codeBlockSettings: Ref<Docs.CodeBlockSettings> = ref<Docs.CodeBlockSettings>({
217215
plugin: codeBlockPlugin,
218216
theme: codeBlockDarkTheme,
219217
});
@@ -229,8 +227,9 @@ function updateCodeBlockTheme(val) {
229227
drawerOptions.value.dark = val === 'dark';
230228
}
231229
232-
provide('drawerOptions', drawerOptions);
233-
provide('links', store.links);
230+
provide<Docs.CodeBlockSettings>('codeBlockSettings', codeBlockSettings.value);
231+
provide<Docs.DrawerOptions>('drawerOptions', drawerOptions.value);
232+
provide<Docs.Links>('links', store.links);
234233
235234
function drawerClose(val) {
236235
eventTriggered('drawerClose', val);
@@ -304,11 +303,38 @@ function gridHandleDoubleClick(evt) {
304303
</script>
305304

306305
<style lang="scss">
306+
:root {
307+
--list-item-padding-left: 50px;
308+
--list-item-level-3-padding-left: 26px;
309+
}
310+
307311
html {
308312
scroll-behavior: smooth;
309313
scroll-padding-top: 70px;
310314
}
311315
316+
a {
317+
&:not(.v-list-item, .v-btn, .v-icon, .app-link) {
318+
color: #bb86fc;
319+
320+
&:hover {
321+
color: #b39ddb;
322+
}
323+
}
324+
}
325+
326+
.v-theme--light {
327+
a {
328+
&:not(.v-list-item, .v-btn, .v-icon, .app-link) {
329+
color: #6200ee;
330+
331+
&:hover {
332+
color: #3700b3;
333+
}
334+
}
335+
}
336+
}
337+
312338
.top-app-bar {
313339
z-index: 99 !important;
314340
@@ -330,10 +356,20 @@ html {
330356
margin: 0 -0.7em;
331357
position: absolute;
332358
359+
&:hover {
360+
color: rgb(var(--v-theme-primary));
361+
}
362+
333363
&:not(:hover, :focus) {
334364
opacity: 0;
335365
}
336366
}
367+
368+
&.text-secondary {
369+
> a {
370+
color: rgb(var(--v-theme-secondary));
371+
}
372+
}
337373
}
338374
339375
.name-item:not(:hover, :focus) span {
@@ -344,3 +380,25 @@ html {
344380
margin: 0;
345381
}
346382
</style>
383+
384+
<style lang="scss" scoped>
385+
:deep(pre),
386+
:deep(code) {
387+
&.ic {
388+
background-color: rgb(255 255 255 / 10%) !important;
389+
border-radius: 3px;
390+
font-size: 85%;
391+
font-weight: normal;
392+
padding: 0.2em 0.4em;
393+
}
394+
}
395+
396+
.v-theme--light {
397+
:deep(pre),
398+
:deep(code) {
399+
&.ic {
400+
background-color: rgb(0 0 0 / 10%) !important;
401+
}
402+
}
403+
}
404+
</style>

src/documentation/DocsPage.vue

+25-77
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<h1 class="v-heading text-h3 text-sm-h3 mb-4">
1414
Vuetify 3 Resize Drawer
1515
</h1>
16+
<p class="mb-4 text-grey-darken-1">by WebDevNerdStuff</p>
1617
<v-chip
1718
color="primary"
1819
size="small"
@@ -39,7 +40,7 @@
3940

4041
<v-row>
4142
<v-col cols="12">
42-
<CodeBlock
43+
<VCodeBlock
4344
code="pnpm add @wdns/vuetify-resize-drawer"
4445
:highlightjs="codeBlockSettings.plugin === 'highlightjs'"
4546
lang="plain"
@@ -52,105 +53,80 @@
5253
target="_blank"
5354
>pnpm</a>:
5455
</template>
55-
</CodeBlock>
56+
</VCodeBlock>
5657
</v-col>
5758
<v-col cols="12">
58-
<CodeBlock
59+
<VCodeBlock
5960
code="npm i @wdns/vuetify-resize-drawer"
6061
highlightjs
6162
lang="plain"
6263
>
6364
<template #label>Using npm:</template>
64-
</CodeBlock>
65+
</VCodeBlock>
6566
</v-col>
6667
</v-row>
6768
</v-col>
6869
</v-row>
6970

7071
<!-- Description -->
71-
<DescriptionSection
72-
:classes="classes"
73-
:drawerOptions="drawerOptions"
74-
:links="links"
75-
/>
72+
<Section.DescriptionSection />
7673

7774
<!-- Usage -->
78-
<UsageSection :codeBlockOptions="codeBlockOptions" />
75+
<Section.UsageSection />
7976

8077
<!-- Props -->
81-
<PropsSection @updateOptions="updatedOptions" />
78+
<Section.PropsSection @updateOptions="updatedOptions" />
8279

8380
<!-- Grid -->
84-
<GridSection @toggle-grid-drawer="toggleGridDrawer" />
81+
<Section.GridSection @toggle-grid-drawer="toggleGridDrawer" />
8582

8683
<!-- Events -->
87-
<EventsSection :codeBlockOptions="codeBlockOptions" />
84+
<Section.EventsSection />
8885

8986
<!-- Slots -->
90-
<SlotsSection />
87+
<Section.SlotsSection />
9188

9289
<!-- SASS Variables -->
93-
<SassVariablesSection />
90+
<Section.SassVariablesSection />
9491

9592
<!-- Example -->
96-
<ExampleSection :codeBlockOptions="codeBlockOptions" />
93+
<Section.ExampleSection />
9794

9895
<!-- Playground -->
99-
<PlaygroundSection :codeBlockOptions="codeBlockOptions" />
96+
<Section.PlaygroundSection />
10097

10198
<!-- Dependencies -->
102-
<DependenciesSection />
99+
<Section.DependenciesSection />
103100

104101
<!-- License -->
105-
<LicenseSection />
102+
<Section.LicenseSection />
106103

107104
<!-- Legal -->
108-
<LegalSection />
105+
<Section.LegalSection />
109106
</template>
110107

111-
<script setup>
112-
import { computed, inject, provide, reactive, ref } from 'vue';
108+
<script setup lang="ts">
109+
import * as Section from '@/documentation/sections';
113110
import packageInfo from '../../package.json';
114-
import {
115-
DependenciesSection,
116-
DescriptionSection,
117-
EventsSection,
118-
ExampleSection,
119-
GridSection,
120-
LegalSection,
121-
LicenseSection,
122-
PlaygroundSection,
123-
PropsSection,
124-
SassVariablesSection,
125-
SlotsSection,
126-
UsageSection,
127-
} from '@/documentation/sections';
128111
129112
const emit = defineEmits([
130113
'toggleGridDrawer',
131114
'updateOptions',
132115
]);
133116
134-
const props = defineProps({
135-
codeBlockOptions: {
136-
required: true,
137-
type: Object,
138-
},
139-
});
117+
const codeBlockSettings = inject<Docs.CodeBlockSettings>('codeBlockSettings')!;
118+
const links = inject<Docs.Links>('links')!;
140119
141-
const codeBlockSettings = computed(() => props.codeBlockOptions);
142-
const links = inject('links');
143120
const classes = reactive({
144121
appLink: 'app-link text-decoration-none primary--text font-weight-medium d-inline-block font-weight-bold',
145122
h2: 'text-primary v-heading text-h4 text-sm-h4 mb-2',
146123
h3: 'text-blue-darken-2 v-heading text-h5 text-sm-h5 mb-0',
124+
h4: 'text-secondary v-heading text-h6 text-sm-h6 mb-0',
147125
headerA: 'text-decoration-none text-right text-md-left d-none d-sm-flex',
148126
});
149-
const componentVersion = ref(packageInfo.version);
150-
151-
const drawerOptions = inject('drawerOptions');
152-
provide('classes', classes);
127+
const componentVersion = ref<string | number>(packageInfo.version);
153128
129+
provide<Docs.GlobalClasses>('classes', classes);
154130
155131
function updatedOptions(event) {
156132
emit('updateOptions', event);
@@ -161,32 +137,4 @@ function toggleGridDrawer() {
161137
}
162138
</script>
163139

164-
<style lang="scss">
165-
:deep(code) {
166-
&.ic {
167-
background-color: rgb(255 255 255 / 10%) !important;
168-
border-radius: 3px;
169-
font-size: 85%;
170-
font-weight: normal;
171-
padding: 0.2em 0.4em;
172-
}
173-
}
174-
175-
code {
176-
&.ic {
177-
background-color: rgb(255 255 255 / 10%) !important;
178-
border-radius: 3px;
179-
font-size: 85%;
180-
font-weight: normal;
181-
padding: 0.2em 0.4em;
182-
}
183-
}
184-
185-
.v-theme--light {
186-
code {
187-
&.ic {
188-
background-color: rgb(0 0 0 / 10%) !important;
189-
}
190-
}
191-
}
192-
</style>
140+
<style lang="scss"></style>

0 commit comments

Comments
 (0)