@data-fair/lib-vuetify 2.0.5 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/lib-vuetify",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "Components based on the Vuetify 3 UI lib for the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -0,0 +1,56 @@
1
+ <!-- inspired by https://github.com/vuetifyjs/vuetify/blob/8bb752b210d25fbebcea12cd073d2ce4986f5e12/packages/docs/src/layouts/default/FabToTop.vue -->
2
+
3
+ <template>
4
+ <v-fab-transition>
5
+ <v-btn
6
+ v-show="show"
7
+ title="Remonter au début de la page"
8
+ aria-label="Remonter au début de la page"
9
+ color="primary"
10
+ fixed
11
+ style="z-index: 6; position: absolute; right: 24px; bottom: 24px;"
12
+ :icon="mdiChevronUp"
13
+ @click="toTop"
14
+ />
15
+ </v-fab-transition>
16
+ </template>
17
+
18
+ <script lang="ts" setup>
19
+ import { ref, onMounted, onUnmounted } from 'vue'
20
+ import { useRoute, useRouter } from 'vue-router'
21
+ import { mdiChevronUp } from '@mdi/js'
22
+ import { useGoTo } from 'vuetify'
23
+
24
+ const { selector } = defineProps({ selector: { type: String, required: false, default: '.v-main__scroller' } })
25
+
26
+ const route = useRoute()
27
+ const router = useRouter()
28
+ const goTo = useGoTo()
29
+
30
+ let _scrollElement: Element | Window | null
31
+ const show = ref(false)
32
+
33
+ const onScroll: EventListener = (e: any) => {
34
+ const top = selector ? e.target.scrollTop : (window.pageYOffset || document.documentElement.offsetTop || 0)
35
+ show.value = top > 300
36
+ }
37
+
38
+ onMounted(async () => {
39
+ _scrollElement = selector ? document.querySelector(selector) : window
40
+ if (!_scrollElement) console.error(`[scroll-to-top] selector ${selector} not found`)
41
+ else _scrollElement.addEventListener('scroll', onScroll)
42
+ })
43
+
44
+ onUnmounted(() => {
45
+ if (_scrollElement) _scrollElement.removeEventListener('scroll', onScroll)
46
+ })
47
+
48
+ const toTop = () => {
49
+ if (selector) {
50
+ _scrollElement?.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
51
+ } else {
52
+ if (route.hash) router.push({ hash: '' })
53
+ goTo(0)
54
+ }
55
+ }
56
+ </script>
@@ -0,0 +1,16 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ selector: {
3
+ type: StringConstructor;
4
+ required: false;
5
+ default: string;
6
+ };
7
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
8
+ selector: {
9
+ type: StringConstructor;
10
+ required: false;
11
+ default: string;
12
+ };
13
+ }>> & Readonly<{}>, {
14
+ selector: string;
15
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
16
+ export default _default;
@@ -0,0 +1,96 @@
1
+ /// <reference types="../../node_modules/.vue-global-types/vue_3.5_0_0_0.d.ts" />
2
+ import { ref, onMounted, onUnmounted } from 'vue';
3
+ import { useRoute, useRouter } from 'vue-router';
4
+ import { mdiChevronUp } from '@mdi/js';
5
+ import { useGoTo } from 'vuetify';
6
+ const { selector } = defineProps({ selector: { type: String, required: false, default: '.v-main__scroller' } });
7
+ const route = useRoute();
8
+ const router = useRouter();
9
+ const goTo = useGoTo();
10
+ let _scrollElement;
11
+ const show = ref(false);
12
+ const onScroll = (e) => {
13
+ const top = selector ? e.target.scrollTop : (window.pageYOffset || document.documentElement.offsetTop || 0);
14
+ show.value = top > 300;
15
+ };
16
+ onMounted(async () => {
17
+ _scrollElement = selector ? document.querySelector(selector) : window;
18
+ if (!_scrollElement)
19
+ console.error(`[scroll-to-top] selector ${selector} not found`);
20
+ else
21
+ _scrollElement.addEventListener('scroll', onScroll);
22
+ });
23
+ onUnmounted(() => {
24
+ if (_scrollElement)
25
+ _scrollElement.removeEventListener('scroll', onScroll);
26
+ });
27
+ const toTop = () => {
28
+ if (selector) {
29
+ _scrollElement?.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
30
+ }
31
+ else {
32
+ if (route.hash)
33
+ router.push({ hash: '' });
34
+ goTo(0);
35
+ }
36
+ };
37
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
38
+ const __VLS_ctx = {};
39
+ let __VLS_components;
40
+ let __VLS_directives;
41
+ const __VLS_0 = {}.VFabTransition;
42
+ /** @type {[typeof __VLS_components.VFabTransition, typeof __VLS_components.vFabTransition, typeof __VLS_components.VFabTransition, typeof __VLS_components.vFabTransition, ]} */ ;
43
+ // @ts-ignore
44
+ const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({}));
45
+ const __VLS_2 = __VLS_1({}, ...__VLS_functionalComponentArgsRest(__VLS_1));
46
+ var __VLS_4 = {};
47
+ __VLS_3.slots.default;
48
+ const __VLS_5 = {}.VBtn;
49
+ /** @type {[typeof __VLS_components.VBtn, typeof __VLS_components.vBtn, ]} */ ;
50
+ // @ts-ignore
51
+ const __VLS_6 = __VLS_asFunctionalComponent(__VLS_5, new __VLS_5({
52
+ ...{ 'onClick': {} },
53
+ title: "Remonter au début de la page",
54
+ 'aria-label': "Remonter au début de la page",
55
+ color: "primary",
56
+ fixed: true,
57
+ ...{ style: {} },
58
+ icon: (__VLS_ctx.mdiChevronUp),
59
+ }));
60
+ const __VLS_7 = __VLS_6({
61
+ ...{ 'onClick': {} },
62
+ title: "Remonter au début de la page",
63
+ 'aria-label': "Remonter au début de la page",
64
+ color: "primary",
65
+ fixed: true,
66
+ ...{ style: {} },
67
+ icon: (__VLS_ctx.mdiChevronUp),
68
+ }, ...__VLS_functionalComponentArgsRest(__VLS_6));
69
+ let __VLS_9;
70
+ let __VLS_10;
71
+ let __VLS_11;
72
+ const __VLS_12 = {
73
+ onClick: (__VLS_ctx.toTop)
74
+ };
75
+ __VLS_asFunctionalDirective(__VLS_directives.vShow)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.show) }, null, null);
76
+ var __VLS_8;
77
+ var __VLS_3;
78
+ var __VLS_dollars;
79
+ const __VLS_self = (await import('vue')).defineComponent({
80
+ setup() {
81
+ return {
82
+ mdiChevronUp: mdiChevronUp,
83
+ show: show,
84
+ toTop: toTop,
85
+ };
86
+ },
87
+ props: { selector: { type: String, required: false, default: '.v-main__scroller' } },
88
+ });
89
+ export default (await import('vue')).defineComponent({
90
+ setup() {
91
+ return {};
92
+ },
93
+ props: { selector: { type: String, required: false, default: '.v-main__scroller' } },
94
+ });
95
+ ; /* PartiallyEnd: #4569/main.vue */
96
+ //# sourceMappingURL=scroll-to-top.vue.js.map
@@ -0,0 +1,94 @@
1
+ <template>
2
+ <div
3
+ :id="id"
4
+ class="mt-3 mb-10"
5
+ >
6
+ <v-card
7
+ :style="cardStyle"
8
+ color="primary"
9
+ border="0"
10
+ >
11
+ <div
12
+ class="d-flex flex-no-wrap"
13
+ style="height: 112px; width: 100%;"
14
+ >
15
+ <div
16
+ v-if="svg && display.mdAndUp.value"
17
+ :class="`pa-${svgNoMargin ? 0 : 2} flex-grow-0`"
18
+ >
19
+ <df-themed-svg
20
+ :source="svg"
21
+ :color="color"
22
+ />
23
+ </div>
24
+ <div class="pl-4 flex-grow-1" style="min-width: 0;">
25
+ <v-toolbar
26
+ extended
27
+ flat
28
+ style="background-color:transparent"
29
+ >
30
+ <v-toolbar-title class="text-title-large">
31
+ {{ title }}
32
+ </v-toolbar-title>
33
+ <template #extension>
34
+ <slot name="extension">
35
+ <v-tabs
36
+ v-model="tab"
37
+ :optional="false"
38
+ style="margin-bottom: 1px;"
39
+ show-arrows
40
+ :color="color"
41
+ >
42
+ <template
43
+ v-for="(tabInfo, i) in tabs"
44
+ :key="i"
45
+ >
46
+ <v-tab
47
+ v-if="tabInfo"
48
+ :value="tabInfo.key"
49
+ :append-icon="tabInfo.appendIcon"
50
+ :base-color="tabInfo.color"
51
+ :color="tabInfo.color"
52
+ >
53
+ <v-icon
54
+ v-if="tabInfo.icon"
55
+ :icon="tabInfo.icon"
56
+ />&nbsp;&nbsp;{{ tabInfo.title }}
57
+ </v-tab>
58
+ </template>
59
+ </v-tabs>
60
+ </slot>
61
+ </template>
62
+ </v-toolbar>
63
+ </div>
64
+ </div>
65
+ </v-card>
66
+ <slot
67
+ name="content"
68
+ :tab="tab"
69
+ />
70
+ </div>
71
+ </template>
72
+
73
+ <script lang="ts" setup>
74
+ import { computed } from 'vue'
75
+ import { useDisplay, useTheme } from 'vuetify'
76
+ import DfThemedSvg from './themed-svg.vue'
77
+
78
+ type TabInfo = { key: string, title: string, icon?: string, appendIcon?: string, color?: string } | null
79
+
80
+ const { title, tabs, svg, color = 'primary' } = defineProps<{
81
+ id: string,
82
+ title: string,
83
+ tabs?: TabInfo[],
84
+ svg?: string,
85
+ svgNoMargin?: boolean,
86
+ color?: string,
87
+ }>()
88
+ const tab = defineModel({ type: String })
89
+
90
+ const display = useDisplay()
91
+ const theme = useTheme()
92
+
93
+ const cardStyle = computed(() => `background: linear-gradient(90deg, ${theme.current.value.colors.surface} 0%, ${theme.current.value.colors.background} 20%`)
94
+ </script>
@@ -0,0 +1,39 @@
1
+ type TabInfo = {
2
+ key: string;
3
+ title: string;
4
+ icon?: string;
5
+ appendIcon?: string;
6
+ color?: string;
7
+ } | null;
8
+ type __VLS_Props = {
9
+ id: string;
10
+ title: string;
11
+ tabs?: TabInfo[];
12
+ svg?: string;
13
+ svgNoMargin?: boolean;
14
+ color?: string;
15
+ };
16
+ declare const tab: import("vue").ModelRef<string | undefined, string, string | undefined, string | undefined>;
17
+ type __VLS_PublicProps = __VLS_Props & {
18
+ modelValue?: typeof tab['value'];
19
+ };
20
+ declare var __VLS_16: {}, __VLS_30: {
21
+ tab: string | undefined;
22
+ };
23
+ type __VLS_Slots = {} & {
24
+ extension?: (props: typeof __VLS_16) => any;
25
+ } & {
26
+ content?: (props: typeof __VLS_30) => any;
27
+ };
28
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
29
+ "update:modelValue": (value: string | undefined) => any;
30
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
31
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
32
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
34
+ export default _default;
35
+ type __VLS_WithSlots<T, S> = T & {
36
+ new (): {
37
+ $slots: S;
38
+ };
39
+ };
@@ -0,0 +1,176 @@
1
+ /// <reference types="../../node_modules/.vue-global-types/vue_3.5_0_0_0.d.ts" />
2
+ import { computed } from 'vue';
3
+ import { useDisplay, useTheme } from 'vuetify';
4
+ import DfThemedSvg from './themed-svg.vue';
5
+ const { title, tabs, svg, color = 'primary' } = defineProps();
6
+ const tab = defineModel({ type: String });
7
+ const display = useDisplay();
8
+ const theme = useTheme();
9
+ const cardStyle = computed(() => `background: linear-gradient(90deg, ${theme.current.value.colors.surface} 0%, ${theme.current.value.colors.background} 20%`);
10
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
11
+ const __VLS_defaults = {};
12
+ const __VLS_modelEmit = defineEmits();
13
+ const __VLS_ctx = {};
14
+ let __VLS_components;
15
+ let __VLS_directives;
16
+ __VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
17
+ id: (__VLS_ctx.id),
18
+ ...{ class: "mt-3 mb-10" },
19
+ });
20
+ const __VLS_0 = {}.VCard;
21
+ /** @type {[typeof __VLS_components.VCard, typeof __VLS_components.vCard, typeof __VLS_components.VCard, typeof __VLS_components.vCard, ]} */ ;
22
+ // @ts-ignore
23
+ const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({
24
+ ...{ style: (__VLS_ctx.cardStyle) },
25
+ color: "primary",
26
+ border: "0",
27
+ }));
28
+ const __VLS_2 = __VLS_1({
29
+ ...{ style: (__VLS_ctx.cardStyle) },
30
+ color: "primary",
31
+ border: "0",
32
+ }, ...__VLS_functionalComponentArgsRest(__VLS_1));
33
+ __VLS_3.slots.default;
34
+ __VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
35
+ ...{ class: "d-flex flex-no-wrap" },
36
+ ...{ style: {} },
37
+ });
38
+ if (svg && __VLS_ctx.display.mdAndUp.value) {
39
+ __VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
40
+ ...{ class: (`pa-${__VLS_ctx.svgNoMargin ? 0 : 2} flex-grow-0`) },
41
+ });
42
+ /** @type {[typeof DfThemedSvg, ]} */ ;
43
+ // @ts-ignore
44
+ const __VLS_4 = __VLS_asFunctionalComponent(DfThemedSvg, new DfThemedSvg({
45
+ source: (svg),
46
+ color: (color),
47
+ }));
48
+ const __VLS_5 = __VLS_4({
49
+ source: (svg),
50
+ color: (color),
51
+ }, ...__VLS_functionalComponentArgsRest(__VLS_4));
52
+ }
53
+ __VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
54
+ ...{ class: "pl-4 flex-grow-1" },
55
+ ...{ style: {} },
56
+ });
57
+ const __VLS_7 = {}.VToolbar;
58
+ /** @type {[typeof __VLS_components.VToolbar, typeof __VLS_components.vToolbar, typeof __VLS_components.VToolbar, typeof __VLS_components.vToolbar, ]} */ ;
59
+ // @ts-ignore
60
+ const __VLS_8 = __VLS_asFunctionalComponent(__VLS_7, new __VLS_7({
61
+ extended: true,
62
+ flat: true,
63
+ ...{ style: {} },
64
+ }));
65
+ const __VLS_9 = __VLS_8({
66
+ extended: true,
67
+ flat: true,
68
+ ...{ style: {} },
69
+ }, ...__VLS_functionalComponentArgsRest(__VLS_8));
70
+ __VLS_10.slots.default;
71
+ const __VLS_11 = {}.VToolbarTitle;
72
+ /** @type {[typeof __VLS_components.VToolbarTitle, typeof __VLS_components.vToolbarTitle, typeof __VLS_components.VToolbarTitle, typeof __VLS_components.vToolbarTitle, ]} */ ;
73
+ // @ts-ignore
74
+ const __VLS_12 = __VLS_asFunctionalComponent(__VLS_11, new __VLS_11({
75
+ ...{ class: "text-title-large" },
76
+ }));
77
+ const __VLS_13 = __VLS_12({
78
+ ...{ class: "text-title-large" },
79
+ }, ...__VLS_functionalComponentArgsRest(__VLS_12));
80
+ __VLS_14.slots.default;
81
+ (title);
82
+ var __VLS_14;
83
+ {
84
+ const { extension: __VLS_thisSlot } = __VLS_10.slots;
85
+ var __VLS_15 = {};
86
+ const __VLS_17 = {}.VTabs;
87
+ /** @type {[typeof __VLS_components.VTabs, typeof __VLS_components.vTabs, typeof __VLS_components.VTabs, typeof __VLS_components.vTabs, ]} */ ;
88
+ // @ts-ignore
89
+ const __VLS_18 = __VLS_asFunctionalComponent(__VLS_17, new __VLS_17({
90
+ modelValue: (__VLS_ctx.tab),
91
+ optional: (false),
92
+ ...{ style: {} },
93
+ showArrows: true,
94
+ color: (color),
95
+ }));
96
+ const __VLS_19 = __VLS_18({
97
+ modelValue: (__VLS_ctx.tab),
98
+ optional: (false),
99
+ ...{ style: {} },
100
+ showArrows: true,
101
+ color: (color),
102
+ }, ...__VLS_functionalComponentArgsRest(__VLS_18));
103
+ __VLS_20.slots.default;
104
+ for (const [tabInfo, i] of __VLS_getVForSourceType((tabs))) {
105
+ (i);
106
+ if (tabInfo) {
107
+ const __VLS_21 = {}.VTab;
108
+ /** @type {[typeof __VLS_components.VTab, typeof __VLS_components.vTab, typeof __VLS_components.VTab, typeof __VLS_components.vTab, ]} */ ;
109
+ // @ts-ignore
110
+ const __VLS_22 = __VLS_asFunctionalComponent(__VLS_21, new __VLS_21({
111
+ value: (tabInfo.key),
112
+ appendIcon: (tabInfo.appendIcon),
113
+ baseColor: (tabInfo.color),
114
+ color: (tabInfo.color),
115
+ }));
116
+ const __VLS_23 = __VLS_22({
117
+ value: (tabInfo.key),
118
+ appendIcon: (tabInfo.appendIcon),
119
+ baseColor: (tabInfo.color),
120
+ color: (tabInfo.color),
121
+ }, ...__VLS_functionalComponentArgsRest(__VLS_22));
122
+ __VLS_24.slots.default;
123
+ if (tabInfo.icon) {
124
+ const __VLS_25 = {}.VIcon;
125
+ /** @type {[typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, ]} */ ;
126
+ // @ts-ignore
127
+ const __VLS_26 = __VLS_asFunctionalComponent(__VLS_25, new __VLS_25({
128
+ icon: (tabInfo.icon),
129
+ }));
130
+ const __VLS_27 = __VLS_26({
131
+ icon: (tabInfo.icon),
132
+ }, ...__VLS_functionalComponentArgsRest(__VLS_26));
133
+ }
134
+ (tabInfo.title);
135
+ var __VLS_24;
136
+ }
137
+ }
138
+ var __VLS_20;
139
+ }
140
+ var __VLS_10;
141
+ var __VLS_3;
142
+ var __VLS_29 = {
143
+ tab: (__VLS_ctx.tab),
144
+ };
145
+ /** @type {__VLS_StyleScopedClasses['mt-3']} */ ;
146
+ /** @type {__VLS_StyleScopedClasses['mb-10']} */ ;
147
+ /** @type {__VLS_StyleScopedClasses['d-flex']} */ ;
148
+ /** @type {__VLS_StyleScopedClasses['flex-no-wrap']} */ ;
149
+ /** @type {__VLS_StyleScopedClasses['pl-4']} */ ;
150
+ /** @type {__VLS_StyleScopedClasses['flex-grow-1']} */ ;
151
+ /** @type {__VLS_StyleScopedClasses['text-title-large']} */ ;
152
+ // @ts-ignore
153
+ var __VLS_16 = __VLS_15, __VLS_30 = __VLS_29;
154
+ var __VLS_dollars;
155
+ const __VLS_self = (await import('vue')).defineComponent({
156
+ setup() {
157
+ return {
158
+ DfThemedSvg: DfThemedSvg,
159
+ tab: tab,
160
+ display: display,
161
+ cardStyle: cardStyle,
162
+ };
163
+ },
164
+ __typeEmits: {},
165
+ __typeProps: {},
166
+ });
167
+ const __VLS_component = (await import('vue')).defineComponent({
168
+ setup() {
169
+ return {};
170
+ },
171
+ __typeEmits: {},
172
+ __typeProps: {},
173
+ });
174
+ export default {};
175
+ ; /* PartiallyEnd: #4569/main.vue */
176
+ //# sourceMappingURL=section-tabs.vue.js.map
package/themed-svg.vue ADDED
@@ -0,0 +1,34 @@
1
+ <!-- eslint-disable vue/no-v-html -->
2
+ <template>
3
+ <div
4
+ class="df-themed-svg"
5
+ v-html="themedSource"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ import { computed } from 'vue'
11
+ import { useTheme } from 'vuetify'
12
+
13
+ const { source, color = 'primary' } = defineProps<{ source: string, color?: string }>()
14
+ const theme = useTheme()
15
+
16
+ const themedSource = computed(() => {
17
+ return source
18
+ .replace(/#6C63FF/gi, theme.current.value.colors[color] as string) // default undraw color
19
+ .replace(/#68E1FD/gi, theme.current.value.colors[color] as string) // default manypixels color
20
+ .replace(/#FFD200/gi, theme.current.value.colors.secondary as string)
21
+ .replace(/style="isolation: isolate;"/gi, 'class="isolated-svg"')
22
+ })
23
+ </script>
24
+
25
+ <style lang="css">
26
+ div.df-themed-svg {
27
+ height: 100%;
28
+ }
29
+ div.df-themed-svg svg {
30
+ height: inherit;
31
+ width: inherit;
32
+ }
33
+ .isolated-svg { isolation: isolate; }
34
+ </style>
@@ -0,0 +1,6 @@
1
+ type __VLS_Props = {
2
+ source: string;
3
+ color?: string;
4
+ };
5
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ export default _default;
@@ -0,0 +1,40 @@
1
+ /// <reference types="../../node_modules/.vue-global-types/vue_3.5_0_0_0.d.ts" />
2
+ import { computed } from 'vue';
3
+ import { useTheme } from 'vuetify';
4
+ const { source, color = 'primary' } = defineProps();
5
+ const theme = useTheme();
6
+ const themedSource = computed(() => {
7
+ return source
8
+ .replace(/#6C63FF/gi, theme.current.value.colors[color]) // default undraw color
9
+ .replace(/#68E1FD/gi, theme.current.value.colors[color]) // default manypixels color
10
+ .replace(/#FFD200/gi, theme.current.value.colors.secondary)
11
+ .replace(/style="isolation: isolate;"/gi, 'class="isolated-svg"');
12
+ });
13
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
14
+ const __VLS_ctx = {};
15
+ let __VLS_components;
16
+ let __VLS_directives;
17
+ // CSS variable injection
18
+ // CSS variable injection end
19
+ __VLS_asFunctionalElement(__VLS_intrinsicElements.div)({
20
+ ...{ class: "df-themed-svg" },
21
+ });
22
+ __VLS_asFunctionalDirective(__VLS_directives.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.themedSource) }, null, null);
23
+ /** @type {__VLS_StyleScopedClasses['df-themed-svg']} */ ;
24
+ var __VLS_dollars;
25
+ const __VLS_self = (await import('vue')).defineComponent({
26
+ setup() {
27
+ return {
28
+ themedSource: themedSource,
29
+ };
30
+ },
31
+ __typeProps: {},
32
+ });
33
+ export default (await import('vue')).defineComponent({
34
+ setup() {
35
+ return {};
36
+ },
37
+ __typeProps: {},
38
+ });
39
+ ; /* PartiallyEnd: #4569/main.vue */
40
+ //# sourceMappingURL=themed-svg.vue.js.map
package/toc.vue ADDED
@@ -0,0 +1,93 @@
1
+ <template>
2
+ <v-list
3
+ v-if="sections && sections.length"
4
+ density="compact"
5
+ color="primary"
6
+ class="py-0"
7
+ bg-color="background"
8
+ >
9
+ <v-list-subheader>{{ t('content') }}</v-list-subheader>
10
+
11
+ <v-list-item
12
+ v-for="(section, i) in sections"
13
+ :key="i"
14
+ :active="activeIndex === i"
15
+ @click="goTo('#' + section.id, { offset: -20, container: '.v-main__scroller' })"
16
+ >
17
+ <v-list-item-title>
18
+ <slot
19
+ name="title"
20
+ :section="section"
21
+ >
22
+ {{ section.title }}
23
+ </slot>
24
+ </v-list-item-title>
25
+ <slot
26
+ name="bottom"
27
+ :section="section"
28
+ />
29
+ </v-list-item>
30
+ </v-list>
31
+ </template>
32
+
33
+ <i18n lang="yaml">
34
+ fr:
35
+ content: CONTENU
36
+ en:
37
+ content: CONTENT
38
+ </i18n>
39
+
40
+ <script lang="ts" setup>
41
+ import { ref, onMounted, onUnmounted } from 'vue'
42
+ import { useI18n } from 'vue-i18n'
43
+ import { useGoTo } from 'vuetify'
44
+
45
+ const { sections } = defineProps<{ sections: { id: string, title: string }[] }>()
46
+
47
+ const goTo = useGoTo()
48
+ const { t } = useI18n({ useScope: 'local' })
49
+
50
+ let timeout: NodeJS.Timeout | undefined
51
+ let scrollEl: Element | null = null
52
+
53
+ const onScroll = () => {
54
+ clearTimeout(timeout)
55
+ timeout = setTimeout(findActiveIndex, 17)
56
+ }
57
+
58
+ onMounted(() => {
59
+ scrollEl = document.querySelector('.v-main__scroller')
60
+ if (scrollEl) {
61
+ scrollEl.addEventListener('scroll', onScroll, { passive: true })
62
+ onScroll()
63
+ }
64
+ })
65
+
66
+ onUnmounted(() => {
67
+ if (scrollEl) {
68
+ scrollEl.removeEventListener('scroll', onScroll)
69
+ }
70
+ })
71
+
72
+ const activeIndex = ref<number | null>(null)
73
+ const findActiveIndex = () => {
74
+ if (!scrollEl) return
75
+ const currentOffset = scrollEl.scrollTop
76
+ let index = 0
77
+ let ready = false
78
+ for (let i = sections.length - 1; i >= 0; i--) {
79
+ const e = document.getElementById(sections[i].id)
80
+ if (!e?.offsetTop) continue
81
+ ready = true
82
+ if (e.offsetTop - 40 < currentOffset) {
83
+ index = i
84
+ break
85
+ }
86
+ }
87
+
88
+ if (ready && currentOffset + scrollEl.clientHeight >= scrollEl.scrollHeight - 1) {
89
+ index = sections.length - 1
90
+ }
91
+ activeIndex.value = index
92
+ }
93
+ </script>
package/toc.vue.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ type __VLS_Props = {
2
+ sections: {
3
+ id: string;
4
+ title: string;
5
+ }[];
6
+ };
7
+ declare var __VLS_22: {
8
+ section: {
9
+ id: string;
10
+ title: string;
11
+ };
12
+ }, __VLS_24: {
13
+ section: {
14
+ id: string;
15
+ title: string;
16
+ };
17
+ };
18
+ type __VLS_Slots = {} & {
19
+ title?: (props: typeof __VLS_22) => any;
20
+ } & {
21
+ bottom?: (props: typeof __VLS_24) => any;
22
+ };
23
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
25
+ export default _default;
26
+ type __VLS_WithSlots<T, S> = T & {
27
+ new (): {
28
+ $slots: S;
29
+ };
30
+ };
package/toc.vue.js ADDED
@@ -0,0 +1,143 @@
1
+ /// <reference types="../../node_modules/.vue-global-types/vue_3.5_0_0_0.d.ts" />
2
+ import { ref, onMounted, onUnmounted } from 'vue';
3
+ import { useI18n } from 'vue-i18n';
4
+ import { useGoTo } from 'vuetify';
5
+ const { sections } = defineProps();
6
+ const goTo = useGoTo();
7
+ const { t } = useI18n({ useScope: 'local' });
8
+ let timeout;
9
+ let scrollEl = null;
10
+ const onScroll = () => {
11
+ clearTimeout(timeout);
12
+ timeout = setTimeout(findActiveIndex, 17);
13
+ };
14
+ onMounted(() => {
15
+ scrollEl = document.querySelector('.v-main__scroller');
16
+ if (scrollEl) {
17
+ scrollEl.addEventListener('scroll', onScroll, { passive: true });
18
+ onScroll();
19
+ }
20
+ });
21
+ onUnmounted(() => {
22
+ if (scrollEl) {
23
+ scrollEl.removeEventListener('scroll', onScroll);
24
+ }
25
+ });
26
+ const activeIndex = ref(null);
27
+ const findActiveIndex = () => {
28
+ if (!scrollEl)
29
+ return;
30
+ const currentOffset = scrollEl.scrollTop;
31
+ let index = 0;
32
+ let ready = false;
33
+ for (let i = sections.length - 1; i >= 0; i--) {
34
+ const e = document.getElementById(sections[i].id);
35
+ if (!e?.offsetTop)
36
+ continue;
37
+ ready = true;
38
+ if (e.offsetTop - 40 < currentOffset) {
39
+ index = i;
40
+ break;
41
+ }
42
+ }
43
+ if (ready && currentOffset + scrollEl.clientHeight >= scrollEl.scrollHeight - 1) {
44
+ index = sections.length - 1;
45
+ }
46
+ activeIndex.value = index;
47
+ };
48
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
49
+ const __VLS_ctx = {};
50
+ let __VLS_components;
51
+ let __VLS_directives;
52
+ if (sections && sections.length) {
53
+ const __VLS_0 = {}.VList;
54
+ /** @type {[typeof __VLS_components.VList, typeof __VLS_components.vList, typeof __VLS_components.VList, typeof __VLS_components.vList, ]} */ ;
55
+ // @ts-ignore
56
+ const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({
57
+ density: "compact",
58
+ color: "primary",
59
+ ...{ class: "py-0" },
60
+ bgColor: "background",
61
+ }));
62
+ const __VLS_2 = __VLS_1({
63
+ density: "compact",
64
+ color: "primary",
65
+ ...{ class: "py-0" },
66
+ bgColor: "background",
67
+ }, ...__VLS_functionalComponentArgsRest(__VLS_1));
68
+ var __VLS_4 = {};
69
+ __VLS_3.slots.default;
70
+ const __VLS_5 = {}.VListSubheader;
71
+ /** @type {[typeof __VLS_components.VListSubheader, typeof __VLS_components.vListSubheader, typeof __VLS_components.VListSubheader, typeof __VLS_components.vListSubheader, ]} */ ;
72
+ // @ts-ignore
73
+ const __VLS_6 = __VLS_asFunctionalComponent(__VLS_5, new __VLS_5({}));
74
+ const __VLS_7 = __VLS_6({}, ...__VLS_functionalComponentArgsRest(__VLS_6));
75
+ __VLS_8.slots.default;
76
+ (__VLS_ctx.t('content'));
77
+ var __VLS_8;
78
+ for (const [section, i] of __VLS_getVForSourceType((sections))) {
79
+ const __VLS_9 = {}.VListItem;
80
+ /** @type {[typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, typeof __VLS_components.VListItem, typeof __VLS_components.vListItem, ]} */ ;
81
+ // @ts-ignore
82
+ const __VLS_10 = __VLS_asFunctionalComponent(__VLS_9, new __VLS_9({
83
+ ...{ 'onClick': {} },
84
+ key: (i),
85
+ active: (__VLS_ctx.activeIndex === i),
86
+ }));
87
+ const __VLS_11 = __VLS_10({
88
+ ...{ 'onClick': {} },
89
+ key: (i),
90
+ active: (__VLS_ctx.activeIndex === i),
91
+ }, ...__VLS_functionalComponentArgsRest(__VLS_10));
92
+ let __VLS_13;
93
+ let __VLS_14;
94
+ let __VLS_15;
95
+ const __VLS_16 = {
96
+ onClick: (...[$event]) => {
97
+ if (!(sections && sections.length))
98
+ return;
99
+ __VLS_ctx.goTo('#' + section.id, { offset: -20, container: '.v-main__scroller' });
100
+ }
101
+ };
102
+ __VLS_12.slots.default;
103
+ const __VLS_17 = {}.VListItemTitle;
104
+ /** @type {[typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, typeof __VLS_components.VListItemTitle, typeof __VLS_components.vListItemTitle, ]} */ ;
105
+ // @ts-ignore
106
+ const __VLS_18 = __VLS_asFunctionalComponent(__VLS_17, new __VLS_17({}));
107
+ const __VLS_19 = __VLS_18({}, ...__VLS_functionalComponentArgsRest(__VLS_18));
108
+ __VLS_20.slots.default;
109
+ var __VLS_21 = {
110
+ section: (section),
111
+ };
112
+ (section.title);
113
+ var __VLS_20;
114
+ var __VLS_23 = {
115
+ section: (section),
116
+ };
117
+ var __VLS_12;
118
+ }
119
+ var __VLS_3;
120
+ }
121
+ /** @type {__VLS_StyleScopedClasses['py-0']} */ ;
122
+ // @ts-ignore
123
+ var __VLS_22 = __VLS_21, __VLS_24 = __VLS_23;
124
+ var __VLS_dollars;
125
+ const __VLS_self = (await import('vue')).defineComponent({
126
+ setup() {
127
+ return {
128
+ goTo: goTo,
129
+ t: t,
130
+ activeIndex: activeIndex,
131
+ };
132
+ },
133
+ __typeProps: {},
134
+ });
135
+ const __VLS_component = (await import('vue')).defineComponent({
136
+ setup() {
137
+ return {};
138
+ },
139
+ __typeProps: {},
140
+ });
141
+ export default {};
142
+ ; /* PartiallyEnd: #4569/main.vue */
143
+ //# sourceMappingURL=toc.vue.js.map
package/vite.d.ts CHANGED
@@ -1,28 +1,29 @@
1
- export declare const autoImports: (string | {
2
- '@data-fair/lib-vue/session.js': string[];
3
- '@data-fair/lib-vue/reactive-search-params.js': string[];
4
- '@data-fair/lib-vue/locale-dayjs.js': string[];
5
- '@data-fair/lib-vue/concept-filters.js': string[];
6
- '@data-fair/lib-vue/ui-notif.js': string[];
7
- '@data-fair/lib-vue/fetch.js': string[];
8
- '@data-fair/lib-vue/edit-fetch.js': string[];
9
- '@data-fair/lib-vue/ws.js': string[];
10
- '@data-fair/lib-vue/async-action.js': string[];
11
- '@data-fair/lib-vue/leave-guard.js': string[];
12
- '@data-fair/lib-vue/deep-diff.js': string[];
13
- '@data-fair/lib-vue/format/bytes.js': string[];
14
- } | {
15
- '@data-fair/lib-vuetify/date-match-filter.vue': string[][];
16
- '@data-fair/lib-vuetify/date-range-picker.vue': string[][];
17
- '@data-fair/lib-vuetify/lang-switcher.vue': string[][];
18
- '@data-fair/lib-vuetify/navigation-right.vue': string[][];
19
- '@data-fair/lib-vuetify/owner-avatar.vue': string[][];
20
- '@data-fair/lib-vuetify/owner-pick.vue': string[][];
21
- '@data-fair/lib-vuetify/personal-menu.vue': string[][];
22
- '@data-fair/lib-vuetify/theme-switcher.vue': string[][];
23
- '@data-fair/lib-vuetify/tutorial-alert.vue': string[][];
24
- '@data-fair/lib-vuetify/ui-notif-alert.vue': string[][];
25
- '@data-fair/lib-vuetify/ui-notif.vue': string[][];
26
- '@data-fair/lib-vuetify/ui-user-avatar.vue': string[][];
27
- })[];
1
+ /**
2
+ * Re-export of {@link autoImports} from `@data-fair/lib-vue/vite.js`.
3
+ *
4
+ * Composables-only preset for {@link https://github.com/unplugin/unplugin-auto-import unplugin-auto-import}.
5
+ * Does not include components — use {@link componentsResolver} with
6
+ * {@link https://github.com/unplugin/unplugin-vue-components unplugin-vue-components} for that.
7
+ */
8
+ export { autoImports } from '@data-fair/lib-vue/vite.js';
9
+ /**
10
+ * Resolver for {@link https://github.com/unplugin/unplugin-vue-components unplugin-vue-components}.
11
+ *
12
+ * Resolves `Df`-prefixed component names (e.g. `<DfPersonalMenu>` or `<df-personal-menu>`)
13
+ * to their corresponding `@data-fair/lib-vuetify/*.vue` module.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * // vite.config.ts
18
+ * import { componentsResolver } from '@data-fair/lib-vuetify/vite.js'
19
+ * import Components from 'unplugin-vue-components/vite'
20
+ *
21
+ * export default defineConfig({
22
+ * plugins: [
23
+ * Components({ resolvers: [componentsResolver] })
24
+ * ]
25
+ * })
26
+ * ```
27
+ */
28
+ export declare const componentsResolver: (name: string) => string | undefined;
28
29
  export declare const settingsPath: string;
package/vite.js CHANGED
@@ -1,23 +1,57 @@
1
- // made for https://github.com/unplugin/unplugin-auto-import
2
- import { autoImports as vueAutoImports } from '@data-fair/lib-vue/vite.js';
3
- export const autoImports = [
4
- ...vueAutoImports,
5
- {
6
- '@data-fair/lib-vuetify/date-match-filter.vue': [['default', 'dfDateMatchFilter']],
7
- '@data-fair/lib-vuetify/date-range-picker.vue': [['default', 'dfDateRangePicker']],
8
- '@data-fair/lib-vuetify/lang-switcher.vue': [['default', 'dfLangSwitcher']],
9
- '@data-fair/lib-vuetify/navigation-right.vue': [['default', 'dfNavigationRight']],
10
- '@data-fair/lib-vuetify/owner-avatar.vue': [['default', 'dfOwnerAvatar']],
11
- '@data-fair/lib-vuetify/owner-pick.vue': [['default', 'dfOwnerPick']],
12
- '@data-fair/lib-vuetify/personal-menu.vue': [['default', 'dfPersonalMenu']],
13
- // I don't understand why but search-address.vue breaks some typescript checks
14
- // '@data-fair/lib-vuetify/search-address.vue': [['default', 'dfSearchAddress']],
15
- '@data-fair/lib-vuetify/theme-switcher.vue': [['default', 'dfThemeSwitcher']],
16
- '@data-fair/lib-vuetify/tutorial-alert.vue': [['default', 'dfTutorialAlert']],
17
- '@data-fair/lib-vuetify/ui-notif-alert.vue': [['default', 'dfUiNotifAlert']],
18
- '@data-fair/lib-vuetify/ui-notif.vue': [['default', 'dfUiNotif']],
19
- '@data-fair/lib-vuetify/ui-user-avatar.vue': [['default', 'dfUserAvatar']]
20
- }
21
- ];
1
+ /**
2
+ * Re-export of {@link autoImports} from `@data-fair/lib-vue/vite.js`.
3
+ *
4
+ * Composables-only preset for {@link https://github.com/unplugin/unplugin-auto-import unplugin-auto-import}.
5
+ * Does not include components — use {@link componentsResolver} with
6
+ * {@link https://github.com/unplugin/unplugin-vue-components unplugin-vue-components} for that.
7
+ */
8
+ export { autoImports } from '@data-fair/lib-vue/vite.js';
9
+ /**
10
+ * Map of PascalCase component names to their module paths.
11
+ * Used internally by {@link componentsResolver}.
12
+ */
13
+ const components = {
14
+ DfDateMatchFilter: '@data-fair/lib-vuetify/date-match-filter.vue',
15
+ DfDateRangePicker: '@data-fair/lib-vuetify/date-range-picker.vue',
16
+ DfLangSwitcher: '@data-fair/lib-vuetify/lang-switcher.vue',
17
+ DfNavigationRight: '@data-fair/lib-vuetify/navigation-right.vue',
18
+ DfOwnerAvatar: '@data-fair/lib-vuetify/owner-avatar.vue',
19
+ DfOwnerPick: '@data-fair/lib-vuetify/owner-pick.vue',
20
+ DfPersonalMenu: '@data-fair/lib-vuetify/personal-menu.vue',
21
+ DfScrollToTop: '@data-fair/lib-vuetify/scroll-to-top.vue',
22
+ DfSearchAddress: '@data-fair/lib-vuetify/search-address.vue',
23
+ DfSearchField: '@data-fair/lib-vuetify/search-field.vue',
24
+ DfSectionTabs: '@data-fair/lib-vuetify/section-tabs.vue',
25
+ DfThemedSvg: '@data-fair/lib-vuetify/themed-svg.vue',
26
+ DfThemeSwitcher: '@data-fair/lib-vuetify/theme-switcher.vue',
27
+ DfToc: '@data-fair/lib-vuetify/toc.vue',
28
+ DfTutorialAlert: '@data-fair/lib-vuetify/tutorial-alert.vue',
29
+ DfUiNotifAlert: '@data-fair/lib-vuetify/ui-notif-alert.vue',
30
+ DfUiNotif: '@data-fair/lib-vuetify/ui-notif.vue',
31
+ DfUserAvatar: '@data-fair/lib-vuetify/user-avatar.vue'
32
+ };
33
+ /**
34
+ * Resolver for {@link https://github.com/unplugin/unplugin-vue-components unplugin-vue-components}.
35
+ *
36
+ * Resolves `Df`-prefixed component names (e.g. `<DfPersonalMenu>` or `<df-personal-menu>`)
37
+ * to their corresponding `@data-fair/lib-vuetify/*.vue` module.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * // vite.config.ts
42
+ * import { componentsResolver } from '@data-fair/lib-vuetify/vite.js'
43
+ * import Components from 'unplugin-vue-components/vite'
44
+ *
45
+ * export default defineConfig({
46
+ * plugins: [
47
+ * Components({ resolvers: [componentsResolver] })
48
+ * ]
49
+ * })
50
+ * ```
51
+ */
52
+ export const componentsResolver = (name) => {
53
+ if (components[name])
54
+ return components[name];
55
+ };
22
56
  export const settingsPath = new URL(import.meta.resolve('@data-fair/lib-vuetify/style/settings.scss')).pathname;
23
57
  //# sourceMappingURL=vite.js.map