Skip to content

Commit 5aa1e43

Browse files
add ts
1 parent 5310a37 commit 5aa1e43

17 files changed

+144
-493
lines changed

src/App.vue

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,67 +28,57 @@
2828
</v-app>
2929
</template>
3030

31-
<script setup>
32-
import { computed, provide, ref } from 'vue';
31+
<script setup lang="ts">
3332
import { useDisplay } from 'vuetify';
3433
import AppBar from './documentation/layout/AppBar.vue';
3534
import MenuComponent from './documentation/components/MenuComponent.vue';
3635
import DocsPage from './documentation/DocsPage.vue';
3736
import { useCoreStore } from './stores/index';
38-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
3937
import Prism from 'prismjs';
4038
import 'prismjs/components/prism-typescript.js';
4139
4240
43-
const { smAndUp } = useDisplay();
41+
onMounted(() => {
42+
Prism.highlightAll();
43+
});
44+
4445
45-
const isSmAndUp = computed(() => smAndUp.value);
46+
const { smAndUp } = useDisplay();
47+
const isSmAndUp = computed<boolean>(() => smAndUp.value);
4648
const store = useCoreStore();
47-
const drawer = ref(isSmAndUp.value);
48-
const drawerOptions = ref({
49+
const drawer = ref<boolean>(isSmAndUp.value);
50+
const drawerOptions: Ref<Docs.DrawerOptions> = ref<Docs.DrawerOptions>({
4951
absolute: false,
5052
color: '',
5153
elevation: 10,
5254
});
5355
56+
const codeBlockPlugin: string = 'prismjs';
57+
const codeBlockLightTheme: string = 'tomorrow';
58+
const codeBlockDarkTheme: string = 'tomorrow';
5459
55-
const codeBlockPlugin = 'prismjs';
56-
const codeBlockLightTheme = 'tomorrow';
57-
const codeBlockDarkTheme = 'tomorrow';
58-
59-
const codeBlockSettings = ref({
60+
const codeBlockSettings: Ref<Docs.CodeBlockSettings> = ref<Docs.CodeBlockSettings>({
6061
plugin: codeBlockPlugin,
6162
theme: codeBlockDarkTheme,
6263
});
6364
64-
function updateCodeBlockTheme(val) {
65+
function updateCodeBlockTheme(val: string): void {
6566
codeBlockSettings.value.theme = codeBlockLightTheme;
6667
6768
if (val === 'dark') {
6869
codeBlockSettings.value.theme = codeBlockDarkTheme;
6970
}
7071
}
7172
72-
provide('drawerOptions', drawerOptions);
73-
provide('links', store.links);
73+
provide<Docs.CodeBlockSettings>('codeBlockSettings', codeBlockSettings.value);
74+
provide<Docs.DrawerOptions>('drawerOptions', drawerOptions.value);
75+
provide<Docs.Links>('links', store.links);
7476
75-
function toggleDrawer() {
77+
function toggleDrawer(): void {
7678
drawer.value = !drawer.value;
7779
}
7880
</script>
7981

80-
<style lang="scss" scoped>
81-
:deep(code) {
82-
&.ic {
83-
background-color: rgb(255 255 255 / 10%) !important;
84-
border-radius: 3px;
85-
font-size: 85%;
86-
font-weight: normal;
87-
padding: 0.2em 0.4em;
88-
}
89-
}
90-
</style>
91-
9282
<style lang="scss">
9383
html {
9484
scroll-behavior: smooth;

src/documentation/DocsPage.vue

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@
6969
</v-row>
7070

7171
<!-- Description -->
72-
<Section.Description />
72+
<Section.DescriptionSection />
7373

7474
<!-- Usage -->
75-
<Section.Usage :codeBlockOptions="codeBlockOptions" />
75+
<Section.UsageSection />
7676

7777
<!-- Components -->
7878
<!-- <Section.Components :codeBlockOptions="codeBlockOptions" /> -->
7979

8080
<!-- Props -->
81-
<Section.Props :codeBlockOptions="codeBlockOptions" />
81+
<Section.PropsSection />
8282

8383
<!-- Validation -->
8484
<Section.Validation />
@@ -87,51 +87,42 @@
8787
<Section.Example :codeBlockOptions="codeBlockOptions" />
8888

8989
<!-- Events -->
90-
<Section.Events :codeBlockOptions="codeBlockOptions" />
90+
<Section.EventsSection />
9191

9292
<!-- Slots -->
93-
<Section.Slots :codeBlockOptions="codeBlockOptions" />
93+
<Section.SlotsSection />
9494

9595
<!-- Playground -->
96-
<Section.Playground :codeBlockOptions="codeBlockOptions" />
96+
<Section.PlaygroundSection />
9797

9898
<!-- Dependencies -->
99-
<Section.Dependencies />
99+
<Section.DependenciesSection />
100100

101101
<!-- License -->
102-
<Section.License />
102+
<Section.LicenseSection />
103103

104104
<!-- Legal -->
105-
<Section.Legal />
105+
<Section.LegalSection />
106106
</template>
107107

108-
<script setup>
109-
import { inject, provide, reactive, ref } from 'vue';
108+
<script setup lang="ts">
110109
import packageInfo from '../../package.json';
111110
import * as Section from '@/documentation/sections';
112111
113112
114-
const props = defineProps({
115-
codeBlockOptions: {
116-
required: true,
117-
type: Object,
118-
},
119-
});
120-
121-
const codeBlockSettings = computed(() => props.codeBlockOptions);
122-
const links = inject('links');
113+
const codeBlockSettings = inject<Docs.CodeBlockSettings>('codeBlockSettings')!;
114+
const links = inject<Docs.Links>('links')!;
123115
124-
const classes = reactive({
116+
const classes = reactive<Docs.GlobalClasses>({
125117
appLink: 'app-link text-decoration-none primary--text font-weight-medium d-inline-block font-weight-bold',
126118
h2: 'text-primary v-heading text-h4 text-sm-h4 mb-2',
127119
h3: 'text-blue-darken-2 v-heading text-h5 text-sm-h5 mb-0',
128120
h4: 'text-secondary v-heading text-h6 text-sm-h6 mb-0',
129121
headerA: 'text-decoration-none text-right text-md-left d-none d-sm-flex',
130122
});
131-
const componentVersion = ref(packageInfo.version);
123+
const componentVersion = ref<string | number>(packageInfo.version);
132124
133-
provide('classes', classes);
134-
provide('codeBlockSettings', codeBlockSettings);
125+
provide<Docs.GlobalClasses>('classes', classes);
135126
</script>
136127

137128
<style lang="scss" scoped>

src/documentation/sections/ComponentsSection.vue

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,8 @@
1919
</v-row>
2020
</template>
2121

22-
<script setup>
23-
import { inject } from 'vue';
24-
// import { useCoreStore } from '@/stores/index';
25-
26-
27-
defineProps({
28-
codeBlockOptions: {
29-
required: true,
30-
type: Object,
31-
},
32-
});
33-
34-
const classes = inject('classes');
35-
// const store = useCoreStore();
22+
<script setup lang="ts">
23+
const classes = inject<Docs.GlobalClasses>('classes')!;
3624
</script>
3725

38-
<style lang="scss" scoped>
39-
</style>
26+
<style lang="scss" scoped></style>

src/documentation/sections/DependenciesSection.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@
3838
</v-row>
3939
</template>
4040

41-
<script setup>
42-
import { inject } from 'vue';
41+
<script setup lang="ts">
4342
import { useCoreStore } from '@/stores/index';
4443
4544
46-
const classes = inject('classes');
45+
const classes = inject<Docs.GlobalClasses>('classes')!;
4746
const store = useCoreStore();
4847
</script>

src/documentation/sections/DescriptionSection.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
</v-row>
2121
</template>
2222

23-
<script setup>
24-
import { inject } from 'vue';
25-
26-
27-
const classes = inject('classes');
23+
<script setup lang="ts">
24+
const classes = inject<Docs.GlobalClasses>('classes')!;
2825
</script>

src/documentation/sections/EventsSection.vue

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,9 @@
6868
</template>
6969

7070

71-
<script setup>
72-
import { computed, inject } from 'vue';
73-
74-
75-
const props = defineProps({
76-
codeBlockOptions: {
77-
required: true,
78-
type: Object,
79-
},
80-
});
81-
82-
const codeBlockSettings = computed(() => props.codeBlockOptions);
83-
const classes = inject('classes');
71+
<script setup lang="ts">
72+
const codeBlockSettings = inject<Docs.CodeBlockSettings>('codeBlockSettings')!;
73+
const classes = inject<Docs.GlobalClasses>('classes')!;
8474
8575
const headers = [
8676
{

src/documentation/sections/ExampleSection.vue

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<ExampleContainer
1818
:code="getTemplateCode('SimpleExampleRef')"
19-
:codeBlockOptions="codeBlockOptions"
19+
:codeBlockSettings="codeBlockSettings"
2020
@closePicker="closePicker('SimpleExampleRef');"
2121
>
2222
<Example.SimpleExample
@@ -27,7 +27,7 @@
2727

2828
<ExampleContainer
2929
:code="getTemplateCode('ColumnsExampleRef')"
30-
:codeBlockOptions="codeBlockOptions"
30+
:codeBlockSettings="codeBlockSettings"
3131
@closePicker="closePicker('ColumnsExampleRef');"
3232
>
3333
<Example.ColumnsExample
@@ -38,7 +38,7 @@
3838

3939
<ExampleContainer
4040
:code="getTemplateCode('FieldSlotExampleRef')"
41-
:codeBlockOptions="codeBlockOptions"
41+
:codeBlockSettings="codeBlockSettings"
4242
@closePicker="closePicker('FieldSlotExampleRef');"
4343
>
4444
<Example.FieldSlotExample
@@ -50,7 +50,7 @@
5050
<ExampleContainer
5151
id="validation-example"
5252
:code="getTemplateCode('ValidationExampleRef')"
53-
:codeBlockOptions="codeBlockOptions"
53+
:codeBlockSettings="codeBlockSettings"
5454
@closePicker="closePicker('ValidationExampleRef');"
5555
>
5656
<Example.ValidationExample
@@ -61,7 +61,7 @@
6161

6262
<ExampleContainer
6363
:code="getTemplateCode('ConditionalExampleRef')"
64-
:codeBlockOptions="codeBlockOptions"
64+
:codeBlockSettings="codeBlockSettings"
6565
@closePicker="closePicker('ConditionalExampleRef');"
6666
>
6767
<Example.ConditionalExample
@@ -72,7 +72,7 @@
7272

7373
<ExampleContainer
7474
:code="getTemplateCode('SummaryPageExampleRef')"
75-
:codeBlockOptions="codeBlockOptions"
75+
:codeBlockSettings="codeBlockSettings"
7676
@closePicker="closePicker('SummaryPageExampleRef');"
7777
>
7878
<Example.SummaryPageExample
@@ -83,21 +83,13 @@
8383
</v-row>
8484
</template>
8585

86-
<script setup>
87-
import { inject } from 'vue';
86+
<script setup lang="ts">
8887
import ExampleContainer from '../components/ExampleContainer.vue';
8988
import * as Example from '../components/examples';
9089
9190
92-
defineProps({
93-
codeBlockOptions: {
94-
required: true,
95-
type: Object,
96-
},
97-
});
98-
99-
100-
const classes = inject('classes');
91+
const codeBlockSettings = inject<Docs.CodeBlockSettings>('codeBlockSettings')!;
92+
const classes = inject<Docs.GlobalClasses>('classes')!;
10193
10294
10395
const SimpleExampleRef = ref(null);

0 commit comments

Comments
 (0)