@witchcraft/ui 0.1.0 → 0.1.1
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/dist/module.json +2 -2
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Aria/Aria.vue +5 -9
- package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
- package/dist/runtime/components/Icon/Icon.vue +10 -31
- package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
- package/dist/runtime/components/LibButton/LibButton.vue +58 -77
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +48 -75
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +63 -108
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +271 -352
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +32 -57
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +17 -38
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +53 -82
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +50 -67
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +7 -8
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
- package/dist/runtime/components/LibDebug/LibDebug.vue +42 -70
- package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +18 -31
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +113 -157
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +215 -242
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
- package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +44 -59
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
- package/dist/runtime/components/LibNotifications/LibNotification.vue +32 -49
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +63 -84
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
- package/dist/runtime/components/LibPagination/LibPagination.vue +67 -112
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
- package/dist/runtime/components/LibPalette/LibPalette.vue +20 -23
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
- package/dist/runtime/components/LibPopup/LibPopup.vue +314 -352
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +70 -92
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +133 -178
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
- package/dist/runtime/components/LibRoot/LibRoot.vue +73 -100
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +49 -78
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +123 -157
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
- package/dist/runtime/components/LibTable/LibTable.vue +63 -100
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
- package/dist/runtime/components/Template/NAME.vue +15 -36
- package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
- package/dist/runtime/components/TestControls/TestControls.vue +6 -9
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
- package/dist/runtime/directives/vResizableCols.js +89 -83
- package/dist/types.d.mts +2 -6
- package/package.json +11 -11
- package/src/runtime/components/Focus.stories.ts +3 -2
- package/src/runtime/components/Icon/Icon.vue +0 -1
- package/src/runtime/components/LibButton/LibButton.vue +0 -1
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -1
- package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -1
- package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +0 -1
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +0 -1
- package/src/runtime/components/LibFileInput/LibFileInput.vue +0 -1
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -1
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -1
- package/src/runtime/components/LibNotifications/LibNotification.vue +0 -1
- package/src/runtime/components/LibNotifications/LibNotifications.vue +0 -1
- package/src/runtime/components/LibPagination/LibPagination.vue +0 -1
- package/src/runtime/components/LibPopup/LibPopup.vue +0 -1
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -1
- package/src/runtime/components/LibRecorder/LibRecorder.vue +0 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +0 -1
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -1
- package/src/runtime/components/LibTable/LibTable.vue +0 -1
- package/src/runtime/directives/vResizableCols.ts +79 -73
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -36
- package/dist/runtime/components/Focus.stories.d.ts +0 -11
- package/dist/runtime/components/Focus.stories.js +0 -53
- package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
- package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -9
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -68
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
- package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
- package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +0 -33
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +0 -384
- package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
- package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -61
- package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
- package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
- package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
- package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
- package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
- package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
- package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
- package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
- package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
- package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
- package/dist/runtime/components/Reset.stories.d.ts +0 -5
- package/dist/runtime/components/Reset.stories.js +0 -19
- package/dist/runtime/components/Scrolling.stories.d.ts +0 -6
- package/dist/runtime/components/Scrolling.stories.js +0 -44
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
- package/dist/types.d.ts +0 -7
|
@@ -1,69 +1,49 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import {
|
|
3
|
-
import { DatePickerArrow, DatePickerCalendar, DatePickerCell, DatePickerCellTrigger, DatePickerContent, DatePickerField, DatePickerGrid, DatePickerGridBody, DatePickerGridHead, DatePickerGridRow, DatePickerHeadCell, DatePickerHeader, DatePickerHeading, DatePickerInput, DatePickerNext, DatePickerPrev, DatePickerRoot, DatePickerTrigger } from "reka-ui"
|
|
4
|
-
import { onBeforeUnmount, ref, toRaw, useAttrs, watch } from "vue"
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}>(), {
|
|
22
|
-
timeZone: getLocalTimeZone(),
|
|
23
|
-
useTime: false,
|
|
24
|
-
fallbackDate: _ => getNow({ withTime: _.useTime ?? false }).toDate(_.timeZone ?? getLocalTimeZone()),
|
|
25
|
-
updateInterval: 10000
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const locale = useInjectedLocale().timeLocale
|
|
29
|
-
|
|
30
|
-
const date = defineModel<SingleDate>({ required: true })
|
|
31
|
-
|
|
32
|
-
let justSet = false
|
|
33
|
-
const tempDate = ref()
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getLocalTimeZone } from "@internationalized/date";
|
|
3
|
+
import { DatePickerArrow, DatePickerCalendar, DatePickerCell, DatePickerCellTrigger, DatePickerContent, DatePickerField, DatePickerGrid, DatePickerGridBody, DatePickerGridHead, DatePickerGridRow, DatePickerHeadCell, DatePickerHeader, DatePickerHeading, DatePickerInput, DatePickerNext, DatePickerPrev, DatePickerRoot, DatePickerTrigger } from "reka-ui";
|
|
4
|
+
import { onBeforeUnmount, ref, toRaw, useAttrs, watch } from "vue";
|
|
5
|
+
import { convertDateWithFallback, getNow, toEmittableDate } from "./helpers.js";
|
|
6
|
+
import { useInjectedLocale } from "../../composables/useInjectedLocale.js";
|
|
7
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
8
|
+
import Icon from "../Icon/Icon.vue";
|
|
9
|
+
const attrs = useAttrs();
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
useTime: { type: Boolean, required: false, default: false },
|
|
12
|
+
id: { type: String, required: true },
|
|
13
|
+
fallbackDate: { type: Date, required: false, default: (_) => getNow({ withTime: _.useTime ?? false }).toDate(_.timeZone ?? getLocalTimeZone()) },
|
|
14
|
+
timeZone: { type: String, required: false, default: getLocalTimeZone() },
|
|
15
|
+
updateInterval: { type: Number, required: false, default: 1e4 }
|
|
16
|
+
});
|
|
17
|
+
const locale = useInjectedLocale().timeLocale;
|
|
18
|
+
const date = defineModel({ type: null, ...{ required: true } });
|
|
19
|
+
let justSet = false;
|
|
20
|
+
const tempDate = ref();
|
|
34
21
|
function updateTempDate() {
|
|
35
|
-
|
|
22
|
+
tempDate.value = convertDateWithFallback(date.value, props);
|
|
36
23
|
}
|
|
37
|
-
|
|
38
|
-
updateTempDate()
|
|
39
|
-
|
|
24
|
+
updateTempDate();
|
|
40
25
|
watch(date, () => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
26
|
+
if (!justSet) {
|
|
27
|
+
updateTempDate();
|
|
28
|
+
} else {
|
|
29
|
+
justSet = false;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
47
32
|
watch(tempDate, () => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
})
|
|
51
|
-
|
|
33
|
+
justSet = true;
|
|
34
|
+
date.value = toEmittableDate(toRaw(tempDate.value));
|
|
35
|
+
});
|
|
52
36
|
watch(() => props.timeZone, () => {
|
|
53
|
-
|
|
54
|
-
})
|
|
55
|
-
|
|
37
|
+
updateTempDate();
|
|
38
|
+
});
|
|
56
39
|
const interval = setInterval(() => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, props.updateInterval)
|
|
62
|
-
|
|
40
|
+
if (!date.value) {
|
|
41
|
+
updateTempDate();
|
|
42
|
+
}
|
|
43
|
+
}, props.updateInterval);
|
|
63
44
|
onBeforeUnmount(() => {
|
|
64
|
-
|
|
65
|
-
})
|
|
66
|
-
|
|
45
|
+
clearInterval(interval);
|
|
46
|
+
});
|
|
67
47
|
</script>
|
|
68
48
|
|
|
69
49
|
<template>
|
|
@@ -71,11 +51,13 @@ onBeforeUnmount(() => {
|
|
|
71
51
|
:id="id"
|
|
72
52
|
:locale="locale"
|
|
73
53
|
class="date-picker--root"
|
|
74
|
-
v-model="tempDate
|
|
54
|
+
v-model="tempDate"
|
|
75
55
|
>
|
|
76
56
|
<DatePickerField
|
|
77
57
|
v-slot="{ segments }"
|
|
78
|
-
:class="
|
|
58
|
+
:class="
|
|
59
|
+
twMerge(
|
|
60
|
+
`
|
|
79
61
|
date-picker--field
|
|
80
62
|
flex items-center justify-between
|
|
81
63
|
select-none
|
|
@@ -83,8 +65,9 @@ onBeforeUnmount(() => {
|
|
|
83
65
|
metadata-input-border
|
|
84
66
|
rounded-sm
|
|
85
67
|
`,
|
|
86
|
-
|
|
87
|
-
|
|
68
|
+
attrs.class
|
|
69
|
+
)
|
|
70
|
+
"
|
|
88
71
|
>
|
|
89
72
|
<div :class="twMerge(`
|
|
90
73
|
date-picker--segment
|
|
@@ -93,7 +76,7 @@ onBeforeUnmount(() => {
|
|
|
93
76
|
overflow-scroll
|
|
94
77
|
scrollbar-hidden
|
|
95
78
|
whitespace-nowrap
|
|
96
|
-
`, date ===
|
|
79
|
+
`, date === void 0 && 'text-neutral-400')"
|
|
97
80
|
>
|
|
98
81
|
<template
|
|
99
82
|
v-for="item in segments"
|
|
@@ -209,7 +192,7 @@ onBeforeUnmount(() => {
|
|
|
209
192
|
outlined
|
|
210
193
|
px-1
|
|
211
194
|
"
|
|
212
|
-
:prev-page="(
|
|
195
|
+
:prev-page="(date2) => date2.subtract({ years: 1 })"
|
|
213
196
|
>
|
|
214
197
|
<Icon class="scale-150">
|
|
215
198
|
<i-radix-icons-double-arrow-left/>
|
|
@@ -263,7 +246,7 @@ onBeforeUnmount(() => {
|
|
|
263
246
|
outlined
|
|
264
247
|
px-1
|
|
265
248
|
"
|
|
266
|
-
:next-page="(
|
|
249
|
+
:next-page="(date2) => date2.add({ years: 1 })"
|
|
267
250
|
>
|
|
268
251
|
<Icon class="scale-150">
|
|
269
252
|
<i-radix-icons-double-arrow-right/>
|
|
@@ -375,7 +358,7 @@ onBeforeUnmount(() => {
|
|
|
375
358
|
</DatePickerGridBody>
|
|
376
359
|
</DatePickerGrid>
|
|
377
360
|
</div>
|
|
378
|
-
<slot v-bind="{tempValue: tempDate}"/>
|
|
361
|
+
<slot v-bind="{ tempValue: tempDate }"/>
|
|
379
362
|
</DatePickerCalendar>
|
|
380
363
|
</DatePickerContent>
|
|
381
364
|
</DatePickerRoot>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SingleDate } from "../../types/index.js.js";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
useTime?: boolean;
|
|
4
|
+
id: string;
|
|
5
|
+
fallbackDate?: Date;
|
|
6
|
+
timeZone?: string;
|
|
7
|
+
updateInterval?: number;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
10
|
+
modelValue: SingleDate;
|
|
11
|
+
};
|
|
12
|
+
declare var __VLS_157: {
|
|
13
|
+
tempValue: any;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_Slots = {} & {
|
|
16
|
+
default?: (props: typeof __VLS_157) => any;
|
|
17
|
+
};
|
|
18
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
"update:modelValue": (value: SingleDate) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
21
|
+
"onUpdate:modelValue"?: ((value: SingleDate) => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
fallbackDate: Date;
|
|
24
|
+
timeZone: string;
|
|
25
|
+
useTime: boolean;
|
|
26
|
+
updateInterval: number;
|
|
27
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { getLocalTimeZone } from "@internationalized/date"
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const label = defineModel<string>("label", { default: "Time Zone" })
|
|
1
|
+
<script setup>
|
|
2
|
+
import { getLocalTimeZone } from "@internationalized/date";
|
|
3
|
+
import { getTimeZoneList } from "../../helpers/getTimeZoneList.js";
|
|
4
|
+
import LibInputDeprecated from "../LibInputDeprecated/LibInputDeprecated.vue";
|
|
5
|
+
const timeZone = defineModel({ type: String, ...{ default: getLocalTimeZone() } });
|
|
6
|
+
const label = defineModel("label", { type: String, ...{ default: "Time Zone" } });
|
|
8
7
|
</script>
|
|
8
|
+
|
|
9
9
|
<template>
|
|
10
10
|
<LibInputDeprecated
|
|
11
11
|
:restrict-to-suggestions="true"
|
|
@@ -24,4 +24,3 @@ const label = defineModel<string>("label", { default: "Time Zone" })
|
|
|
24
24
|
</template>
|
|
25
25
|
</LibInputDeprecated>
|
|
26
26
|
</template>
|
|
27
|
-
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type __VLS_PublicProps = {
|
|
2
|
+
modelValue?: string;
|
|
3
|
+
"label"?: string;
|
|
4
|
+
};
|
|
5
|
+
declare var __VLS_7: {};
|
|
6
|
+
type __VLS_Slots = {} & {
|
|
7
|
+
default?: (props: typeof __VLS_7) => any;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (value: string) => any;
|
|
11
|
+
"update:label": (value: string) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
13
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
14
|
+
"onUpdate:label"?: ((value: string) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -18,84 +18,56 @@
|
|
|
18
18
|
</LibButton>
|
|
19
19
|
</div>
|
|
20
20
|
<pre v-if="value"
|
|
21
|
-
:class="
|
|
21
|
+
:class="
|
|
22
|
+
`
|
|
22
23
|
debug--value
|
|
23
24
|
[tab-size:${tab}]
|
|
24
25
|
`
|
|
25
|
-
|
|
26
|
+
"
|
|
26
27
|
>{{ getStringValue(value) }}</pre>
|
|
27
|
-
<pre v-if="value ===
|
|
28
|
+
<pre v-if="value === void 0"><slot/></pre>
|
|
28
29
|
</div>
|
|
29
30
|
</template>
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
import
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} else {
|
|
66
|
-
res += "\n"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return res
|
|
70
|
-
}
|
|
71
|
-
const copy = (): void => {
|
|
72
|
-
if (navigator.clipboard) {
|
|
73
|
-
const text = props.value
|
|
74
|
-
? getStringValue(props.value)
|
|
75
|
-
: $slots.default?.()?.[0]?.children
|
|
76
|
-
? findText([...$slots.default()[0]!.children as any[]])
|
|
77
|
-
: undefined
|
|
78
|
-
if (text === undefined) {
|
|
79
|
-
// eslint-disable-next-line no-console
|
|
80
|
-
console.warn("Cannot copy text, can't generate string value from `getStringValue` or `the default slot`.")
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
navigator.clipboard.writeText(text).catch(() => { })
|
|
84
|
-
}
|
|
85
|
-
}
|
|
32
|
+
<script setup>
|
|
33
|
+
import { useSlots } from "vue";
|
|
34
|
+
import Icon from "../Icon/Icon.vue";
|
|
35
|
+
import LibButton from "../LibButton/LibButton.vue";
|
|
36
|
+
const $slots = useSlots();
|
|
37
|
+
const props = defineProps({
|
|
38
|
+
value: { type: null, required: false, default: void 0 },
|
|
39
|
+
tab: { type: Number, required: false, default: 3 },
|
|
40
|
+
title: { type: String, required: false, default: "Debug" }
|
|
41
|
+
});
|
|
42
|
+
const getStringValue = (value) => value === void 0 ? "undefined" : typeof value === "string" ? value : JSON.stringify(value, null, " ");
|
|
43
|
+
const findText = (children) => {
|
|
44
|
+
let res = "";
|
|
45
|
+
for (const child of children) {
|
|
46
|
+
if (child.children) {
|
|
47
|
+
if (typeof child.children === "string") res += child.children;
|
|
48
|
+
else res += findText(child.children);
|
|
49
|
+
} else {
|
|
50
|
+
res += "\n";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return res;
|
|
54
|
+
};
|
|
55
|
+
const copy = () => {
|
|
56
|
+
if (navigator.clipboard) {
|
|
57
|
+
const text = props.value ? getStringValue(props.value) : $slots.default?.()?.[0]?.children ? findText([...$slots.default()[0].children]) : void 0;
|
|
58
|
+
if (text === void 0) {
|
|
59
|
+
console.warn("Cannot copy text, can't generate string value from `getStringValue` or `the default slot`.");
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
navigator.clipboard.writeText(text).catch(() => {
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
86
66
|
</script>
|
|
87
67
|
|
|
88
|
-
<script
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Simple debug component for displaying objects and strings with whitespace.
|
|
92
|
-
*
|
|
93
|
-
* In the case of objects, it JSON.stringifies them with a tab character. The tab width can be controlled with the `tab` prop, which will set the `tab-size` css property on the element.
|
|
94
|
-
*
|
|
95
|
-
* The value can be undefined, it will just display undefined.
|
|
96
|
-
*/
|
|
68
|
+
<script>
|
|
97
69
|
export default {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
70
|
+
name: "lib-debug"
|
|
71
|
+
// https://v3.vuejs.org/guide/typescript-support.html#annotating-props
|
|
72
|
+
};
|
|
101
73
|
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple debug component for displaying objects and strings with whitespace.
|
|
3
|
+
*
|
|
4
|
+
* In the case of objects, it JSON.stringifies them with a tab character. The tab width can be controlled with the `tab` prop, which will set the `tab-size` css property on the element.
|
|
5
|
+
*
|
|
6
|
+
* The value can be undefined, it will just display undefined.
|
|
7
|
+
*/
|
|
8
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
9
|
+
/** The value to debug, can be anything. */
|
|
10
|
+
value?: any;
|
|
11
|
+
/** Sets the tab size in css. Defaults to 3. */
|
|
12
|
+
tab?: number;
|
|
13
|
+
title?: string;
|
|
14
|
+
}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
15
|
+
/** The value to debug, can be anything. */
|
|
16
|
+
value?: any;
|
|
17
|
+
/** Sets the tab size in css. Defaults to 3. */
|
|
18
|
+
tab?: number;
|
|
19
|
+
title?: string;
|
|
20
|
+
}> & Readonly<{}>, {
|
|
21
|
+
value: any;
|
|
22
|
+
title: string;
|
|
23
|
+
tab: number;
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
25
|
+
default?: (props: {}) => any;
|
|
26
|
+
}>;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<DevOnly>
|
|
3
|
-
<slot v-if="doShow && $attrs?.['as-child'] !==
|
|
3
|
+
<slot v-if="doShow && $attrs?.['as-child'] !== void 0"/>
|
|
4
4
|
<div v-else-if="doShow"
|
|
5
|
-
:class="twMerge(
|
|
5
|
+
:class="twMerge(
|
|
6
|
+
`
|
|
6
7
|
dev-only
|
|
7
8
|
border
|
|
8
9
|
border-dashed
|
|
@@ -11,41 +12,27 @@
|
|
|
11
12
|
py-1
|
|
12
13
|
never-packaged
|
|
13
14
|
`,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
v-bind="{...$attrs, class:
|
|
15
|
+
$attrs.class
|
|
16
|
+
)"
|
|
17
|
+
v-bind="{ ...$attrs, class: void 0 }"
|
|
17
18
|
>
|
|
18
19
|
<slot/>
|
|
19
20
|
</div>
|
|
20
21
|
</DevOnly>
|
|
21
22
|
</template>
|
|
22
|
-
<script lang="ts" setup>
|
|
23
|
-
import { computed, inject, ref, useAttrs } from "vue"
|
|
24
|
-
|
|
25
|
-
import { showDevOnlyInjectionKey } from "../../composables/useShowDevOnlyKey.js"
|
|
26
|
-
import { twMerge } from "../../utils/twMerge.js"
|
|
27
|
-
const $attrs = useAttrs()
|
|
28
|
-
|
|
29
|
-
const props = withDefaults(defineProps<{
|
|
30
|
-
show?: boolean
|
|
31
|
-
}>(), {
|
|
32
|
-
show: false
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const injectedShow = inject(showDevOnlyInjectionKey, ref(false))
|
|
36
|
-
const doShow = computed(() => props.show || injectedShow.value)
|
|
37
23
|
|
|
24
|
+
<script setup>
|
|
25
|
+
import { computed, inject, ref, useAttrs } from "vue";
|
|
26
|
+
import { showDevOnlyInjectionKey } from "../../composables/useShowDevOnlyKey.js";
|
|
27
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
28
|
+
const $attrs = useAttrs();
|
|
29
|
+
const props = defineProps({
|
|
30
|
+
show: { type: Boolean, required: false, default: false }
|
|
31
|
+
});
|
|
32
|
+
const injectedShow = inject(showDevOnlyInjectionKey, ref(false));
|
|
33
|
+
const doShow = computed(() => props.show || injectedShow.value);
|
|
38
34
|
</script>
|
|
39
|
-
<script lang="ts">
|
|
40
|
-
interface Props {
|
|
41
|
-
show?: boolean
|
|
42
|
-
}
|
|
43
35
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
declare module "vue" {
|
|
47
|
-
export interface GlobalComponents {
|
|
48
|
-
DevOnly: any
|
|
49
|
-
}
|
|
50
|
-
}
|
|
36
|
+
<script>
|
|
37
|
+
|
|
51
38
|
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare module "vue" {
|
|
2
|
+
interface GlobalComponents {
|
|
3
|
+
DevOnly: any;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
7
|
+
show?: boolean;
|
|
8
|
+
}, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
9
|
+
show?: boolean;
|
|
10
|
+
}> & Readonly<{}>, {
|
|
11
|
+
show: boolean;
|
|
12
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
13
|
+
default?: (props: {}) => any;
|
|
14
|
+
} & {
|
|
15
|
+
default?: (props: {}) => any;
|
|
16
|
+
}>;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|