@witchcraft/ui 0.1.3 → 0.2.1-beta.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.
Files changed (179) hide show
  1. package/README.md +3 -6
  2. package/dist/module.json +3 -3
  3. package/dist/module.mjs +15 -12
  4. package/dist/runtime/build/generateTheme.js +1 -1
  5. package/dist/runtime/components/Aria/Aria.vue +5 -9
  6. package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
  7. package/dist/runtime/components/Icon/Icon.vue +10 -30
  8. package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
  9. package/dist/runtime/components/LibButton/LibButton.vue +51 -72
  10. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
  11. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +43 -74
  12. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
  13. package/dist/runtime/components/LibColorInput/LibColorInput.vue +63 -107
  14. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
  15. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +272 -352
  16. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
  17. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +1 -1
  18. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +1 -1
  19. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +35 -69
  20. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
  21. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +17 -38
  22. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
  23. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +58 -82
  24. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
  25. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +55 -67
  26. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
  27. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +7 -8
  28. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
  29. package/dist/runtime/components/LibDebug/LibDebug.vue +43 -70
  30. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
  31. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +18 -31
  32. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
  33. package/dist/runtime/components/LibFileInput/LibFileInput.vue +116 -156
  34. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
  35. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +211 -241
  36. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
  37. package/dist/runtime/components/LibLabel/LibLabel.vue +25 -46
  38. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +26 -0
  39. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +43 -58
  40. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
  41. package/dist/runtime/components/LibNotifications/LibNotification.vue +34 -48
  42. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
  43. package/dist/runtime/components/LibNotifications/LibNotifications.vue +63 -83
  44. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
  45. package/dist/runtime/components/LibPagination/LibPagination.vue +67 -111
  46. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
  47. package/dist/runtime/components/LibPalette/LibPalette.vue +17 -23
  48. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
  49. package/dist/runtime/components/LibPopup/LibPopup.vue +314 -351
  50. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
  51. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +65 -91
  52. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
  53. package/dist/runtime/components/LibRecorder/LibRecorder.vue +127 -177
  54. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
  55. package/dist/runtime/components/LibRoot/LibRoot.vue +75 -101
  56. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
  57. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +42 -77
  58. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
  59. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +118 -156
  60. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
  61. package/dist/runtime/components/LibTable/LibTable.vue +63 -99
  62. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
  63. package/dist/runtime/components/Template/NAME.vue +15 -36
  64. package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
  65. package/dist/runtime/components/TestControls/TestControls.vue +6 -9
  66. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
  67. package/dist/runtime/components/shared/props.d.ts +0 -29
  68. package/dist/runtime/components/shared/props.js +0 -12
  69. package/dist/runtime/composables/useAccesibilityOutline.js +1 -1
  70. package/dist/runtime/composables/useDivideAttrs.js +1 -1
  71. package/dist/runtime/composables/useSuggestions.js +4 -4
  72. package/dist/runtime/directives/vDetectFlex.js +4 -4
  73. package/dist/runtime/directives/vExtractRootEl.d.ts +1 -1
  74. package/dist/runtime/directives/vResizableCols.d.ts +1 -1
  75. package/dist/runtime/directives/vResizableCols.js +4 -4
  76. package/dist/runtime/helpers/NotificationHandler.js +6 -6
  77. package/dist/runtime/helpers/base64ToImg.js +2 -2
  78. package/dist/runtime/nuxt/plugins/vue-plugin.js +1 -1
  79. package/dist/runtime/tailwind/themeConvertionOpts.d.ts +1 -1
  80. package/dist/runtime/theme.d.ts +1 -1
  81. package/dist/runtime/theme.js +1 -1
  82. package/dist/runtime/utils/notifyIfError.js +1 -1
  83. package/dist/runtime/vue/registerComponents.js +1 -1
  84. package/dist/types.d.mts +2 -6
  85. package/package.json +68 -90
  86. package/src/module.ts +19 -12
  87. package/src/runtime/build/generateTheme.ts +1 -1
  88. package/src/runtime/components/LibButton/LibButton.stories.ts +1 -1
  89. package/src/runtime/components/LibButton/LibButton.vue +3 -3
  90. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +3 -7
  91. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +6 -4
  92. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +1 -1
  93. package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +1 -1
  94. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +8 -15
  95. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +6 -0
  96. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +6 -0
  97. package/src/runtime/components/LibDebug/LibDebug.stories.ts +1 -1
  98. package/src/runtime/components/LibDebug/LibDebug.vue +2 -0
  99. package/src/runtime/components/LibFileInput/LibFileInput.vue +4 -0
  100. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +7 -5
  101. package/src/runtime/components/LibLabel/LibLabel.vue +2 -3
  102. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +5 -3
  103. package/src/runtime/components/LibNotifications/LibNotification.vue +3 -0
  104. package/src/runtime/components/LibNotifications/LibNotifications.vue +1 -1
  105. package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
  106. package/src/runtime/components/LibPopup/LibPopup.vue +2 -2
  107. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +2 -2
  108. package/src/runtime/components/LibRecorder/LibRecorder.vue +3 -3
  109. package/src/runtime/components/LibRoot/LibRoot.vue +3 -2
  110. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +2 -2
  111. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +2 -2
  112. package/src/runtime/components/LibTable/LibTable.vue +1 -1
  113. package/src/runtime/components/Template/NAME.vue +2 -2
  114. package/src/runtime/components/shared/props.ts +8 -12
  115. package/src/runtime/composables/useAccesibilityOutline.ts +1 -1
  116. package/src/runtime/composables/useDivideAttrs.ts +1 -1
  117. package/src/runtime/composables/useSuggestions.ts +4 -4
  118. package/src/runtime/directives/vDetectFlex.ts +4 -4
  119. package/src/runtime/directives/vExtractRootEl.ts +1 -1
  120. package/src/runtime/directives/vResizableCols.ts +5 -5
  121. package/src/runtime/helpers/NotificationHandler.ts +6 -6
  122. package/src/runtime/nuxt/plugins/vue-plugin.ts +1 -1
  123. package/src/runtime/tailwind/themeConvertionOpts.ts +1 -1
  124. package/src/runtime/theme.ts +2 -2
  125. package/src/runtime/utils/notifyIfError.ts +1 -1
  126. package/src/runtime/vue/registerComponents.ts +1 -1
  127. package/dist/module.cjs +0 -5
  128. package/dist/module.d.ts +0 -36
  129. package/dist/runtime/components/Focus.stories.d.ts +0 -11
  130. package/dist/runtime/components/Focus.stories.js +0 -53
  131. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
  132. package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
  133. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
  134. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
  135. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
  136. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
  137. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -9
  138. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -68
  139. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
  140. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
  141. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
  142. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
  143. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
  144. package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
  145. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
  146. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
  147. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +0 -33
  148. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +0 -384
  149. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
  150. package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
  151. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
  152. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -61
  153. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
  154. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
  155. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
  156. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
  157. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
  158. package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
  159. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
  160. package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
  161. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
  162. package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
  163. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
  164. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
  165. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
  166. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
  167. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
  168. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
  169. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
  170. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
  171. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
  172. package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
  173. package/dist/runtime/components/Reset.stories.d.ts +0 -5
  174. package/dist/runtime/components/Reset.stories.js +0 -19
  175. package/dist/runtime/components/Scrolling.stories.d.ts +0 -6
  176. package/dist/runtime/components/Scrolling.stories.js +0 -44
  177. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
  178. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
  179. package/dist/types.d.ts +0 -7
@@ -1,69 +1,54 @@
1
- <script setup lang="ts">
2
- import { type DateValue, 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
-
6
- import { convertDateWithFallback, getNow,toEmittableDate } from "./helpers.js"
7
-
8
- import { useInjectedLocale } from "../../composables/useInjectedLocale.js"
9
- import type { SingleDate } from "../../types/index.js"
10
- import { twMerge } from "../../utils/twMerge.js"
11
- import Icon from "../Icon/Icon.vue"
12
-
13
- const attrs = useAttrs()
14
-
15
- const props = withDefaults(defineProps<{
16
- useTime?: boolean
17
- id: string
18
- fallbackDate?: Date
19
- timeZone?: string
20
- updateInterval?: number
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 IRadixIconsCalendar from "~icons/radix-icons/calendar";
7
+ import IRadixIconsChevronLeft from "~icons/radix-icons/chevron-left";
8
+ import IRadixIconsChevronRight from "~icons/radix-icons/chevron-right";
9
+ import IRadixIconsDoubleArrowLeft from "~icons/radix-icons/double-arrow-left";
10
+ import IRadixIconsDoubleArrowRight from "~icons/radix-icons/double-arrow-right";
11
+ import { useInjectedLocale } from "../../composables/useInjectedLocale.js";
12
+ import { twMerge } from "../../utils/twMerge.js";
13
+ import Icon from "../Icon/Icon.vue";
14
+ const attrs = useAttrs();
15
+ const props = defineProps({
16
+ useTime: { type: Boolean, required: false, default: false },
17
+ id: { type: String, required: true },
18
+ fallbackDate: { type: Date, required: false, default: (_) => getNow({ withTime: _.useTime ?? false }).toDate(_.timeZone ?? getLocalTimeZone()) },
19
+ timeZone: { type: String, required: false, default: getLocalTimeZone() },
20
+ updateInterval: { type: Number, required: false, default: 1e4 }
21
+ });
22
+ const locale = useInjectedLocale().timeLocale;
23
+ const date = defineModel({ type: null, ...{ required: true } });
24
+ let justSet = false;
25
+ const tempDate = ref();
34
26
  function updateTempDate() {
35
- tempDate.value = convertDateWithFallback(date.value, props)
27
+ tempDate.value = convertDateWithFallback(date.value, props);
36
28
  }
37
-
38
- updateTempDate()
39
-
29
+ updateTempDate();
40
30
  watch(date, () => {
41
- if (!justSet) {
42
- updateTempDate()
43
- } else {
44
- justSet = false
45
- }
46
- })
31
+ if (!justSet) {
32
+ updateTempDate();
33
+ } else {
34
+ justSet = false;
35
+ }
36
+ });
47
37
  watch(tempDate, () => {
48
- justSet = true
49
- date.value = toEmittableDate(toRaw(tempDate.value as any))
50
- })
51
-
38
+ justSet = true;
39
+ date.value = toEmittableDate(toRaw(tempDate.value));
40
+ });
52
41
  watch(() => props.timeZone, () => {
53
- updateTempDate()
54
- })
55
-
42
+ updateTempDate();
43
+ });
56
44
  const interval = setInterval(() => {
57
- if (!date.value) {
58
- // update suggested date if none is set
59
- updateTempDate()
60
- }
61
- }, props.updateInterval)
62
-
45
+ if (!date.value) {
46
+ updateTempDate();
47
+ }
48
+ }, props.updateInterval);
63
49
  onBeforeUnmount(() => {
64
- clearInterval(interval)
65
- })
66
-
50
+ clearInterval(interval);
51
+ });
67
52
  </script>
68
53
 
69
54
  <template>
@@ -71,11 +56,13 @@ onBeforeUnmount(() => {
71
56
  :id="id"
72
57
  :locale="locale"
73
58
  class="date-picker--root"
74
- v-model="tempDate as DateValue"
59
+ v-model="tempDate"
75
60
  >
76
61
  <DatePickerField
77
62
  v-slot="{ segments }"
78
- :class="twMerge(`
63
+ :class="
64
+ twMerge(
65
+ `
79
66
  date-picker--field
80
67
  flex items-center justify-between
81
68
  select-none
@@ -83,8 +70,9 @@ onBeforeUnmount(() => {
83
70
  metadata-input-border
84
71
  rounded-sm
85
72
  `,
86
- (attrs as any).class)
87
- "
73
+ attrs.class
74
+ )
75
+ "
88
76
  >
89
77
  <div :class="twMerge(`
90
78
  date-picker--segment
@@ -93,7 +81,7 @@ onBeforeUnmount(() => {
93
81
  overflow-scroll
94
82
  scrollbar-hidden
95
83
  whitespace-nowrap
96
- `, date === undefined && 'text-neutral-400')"
84
+ `, date === void 0 && 'text-neutral-400')"
97
85
  >
98
86
  <template
99
87
  v-for="item in segments"
@@ -209,7 +197,7 @@ onBeforeUnmount(() => {
209
197
  outlined
210
198
  px-1
211
199
  "
212
- :prev-page="(date: DateValue) => date.subtract({ years: 1 })"
200
+ :prev-page="(date2) => date2.subtract({ years: 1 })"
213
201
  >
214
202
  <Icon class="scale-150">
215
203
  <i-radix-icons-double-arrow-left/>
@@ -263,7 +251,7 @@ onBeforeUnmount(() => {
263
251
  outlined
264
252
  px-1
265
253
  "
266
- :next-page="(date: DateValue) => date.add({ years: 1 })"
254
+ :next-page="(date2) => date2.add({ years: 1 })"
267
255
  >
268
256
  <Icon class="scale-150">
269
257
  <i-radix-icons-double-arrow-right/>
@@ -375,7 +363,7 @@ onBeforeUnmount(() => {
375
363
  </DatePickerGridBody>
376
364
  </DatePickerGrid>
377
365
  </div>
378
- <slot v-bind="{tempValue: tempDate}"/>
366
+ <slot v-bind="{ tempValue: tempDate }"/>
379
367
  </DatePickerCalendar>
380
368
  </DatePickerContent>
381
369
  </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 lang="ts">
2
- import { getLocalTimeZone } from "@internationalized/date"
3
-
4
- import { getTimeZoneList } from "../../helpers/getTimeZoneList.js"
5
- import LibInputDeprecated from "../LibInputDeprecated/LibInputDeprecated.vue"
6
- const timeZone = defineModel<string>({ default: getLocalTimeZone() })
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,57 @@
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 === undefined"><slot/></pre>
28
+ <pre v-if="value === void 0"><slot/></pre>
28
29
  </div>
29
30
  </template>
30
31
 
31
-
32
- <script setup lang="ts">
33
- import { type PropType, useSlots } from "vue"
34
-
35
- import Icon from "../Icon/Icon.vue"
36
- import LibButton from "../LibButton/LibButton.vue"
37
-
38
- const $slots = useSlots()
39
-
40
- const props = withDefaults(defineProps<{
41
- /** The value to debug, can be anything. */
42
- // eslint-disable-next-line vue/no-restricted-props
43
- value?: any
44
- /** Sets the tab size in css. Defaults to 3. */
45
- tab?: number
46
- title?: string
47
- }>(), {
48
- tab: 3,
49
- title: "Debug",
50
- value: undefined,
51
- })
52
-
53
- const getStringValue = (value: any): string => value === undefined
54
- ? "undefined"
55
- : typeof value === "string"
56
- ? value
57
- : JSON.stringify(value, null, "\t")
58
-
59
- const findText = (children: any[]): string => {
60
- let res = ""
61
- for (const child of children) {
62
- if (child.children) {
63
- if (typeof child.children === "string") res += child.children as string
64
- else res += findText(child.children)
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 IFa6RegularCopy from "~icons/fa-regular/copy";
35
+ import Icon from "../Icon/Icon.vue";
36
+ import LibButton from "../LibButton/LibButton.vue";
37
+ const $slots = useSlots();
38
+ const props = defineProps({
39
+ value: { type: null, required: false, default: void 0 },
40
+ tab: { type: Number, required: false, default: 3 },
41
+ title: { type: String, required: false, default: "Debug" }
42
+ });
43
+ const getStringValue = (value) => value === void 0 ? "undefined" : typeof value === "string" ? value : JSON.stringify(value, null, " ");
44
+ const findText = (children) => {
45
+ let res = "";
46
+ for (const child of children) {
47
+ if (child.children) {
48
+ if (typeof child.children === "string") res += child.children;
49
+ else res += findText(child.children);
50
+ } else {
51
+ res += "\n";
52
+ }
53
+ }
54
+ return res;
55
+ };
56
+ const copy = () => {
57
+ if (navigator.clipboard) {
58
+ const text = props.value ? getStringValue(props.value) : $slots.default?.()?.[0]?.children ? findText([...$slots.default()[0].children]) : void 0;
59
+ if (text === void 0) {
60
+ console.warn("Cannot copy text, can't generate string value from `getStringValue` or `the default slot`.");
61
+ return;
62
+ }
63
+ navigator.clipboard.writeText(text).catch(() => {
64
+ });
65
+ }
66
+ };
86
67
  </script>
87
68
 
88
- <script lang="ts">
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
- */
69
+ <script>
97
70
  export default {
98
- name: "lib-debug",
99
- // https://v3.vuejs.org/guide/typescript-support.html#annotating-props
100
- }
71
+ name: "lib-debug"
72
+ // https://v3.vuejs.org/guide/typescript-support.html#annotating-props
73
+ };
101
74
  </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'] !== undefined"/>
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
- ($attrs.class as string)
15
- )"
16
- v-bind="{...$attrs, class: undefined}"
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
- // Not sure why nuxt's types aren't correctly getting detected
45
- // This should be enough to bypass the type lint error.
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
+ };