@witchcraft/ui 0.2.1-beta.3 → 0.2.2

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 (203) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +20 -4
  3. package/dist/runtime/build/WitchcraftUiResolver.d.ts +2 -2
  4. package/dist/runtime/build/generateTheme.js +2 -2
  5. package/dist/runtime/components/Aria/Aria.d.vue.ts +5 -0
  6. package/dist/runtime/components/Aria/Aria.vue +4 -2
  7. package/dist/runtime/components/Aria/Aria.vue.d.ts +1 -1
  8. package/dist/runtime/components/Icon/Icon.d.vue.ts +21 -0
  9. package/dist/runtime/components/Icon/Icon.vue +3 -3
  10. package/dist/runtime/components/Icon/Icon.vue.d.ts +1 -1
  11. package/dist/runtime/components/LibButton/LibButton.d.vue.ts +36 -0
  12. package/dist/runtime/components/LibButton/LibButton.vue +9 -4
  13. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +1 -1
  14. package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +42 -0
  15. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +3 -4
  16. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +1 -1
  17. package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +63 -0
  18. package/dist/runtime/components/LibColorInput/LibColorInput.vue +15 -8
  19. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +1 -1
  20. package/dist/runtime/components/LibColorPicker/LibColorPicker.d.vue.ts +61 -0
  21. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +10 -6
  22. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +1 -1
  23. package/dist/runtime/components/LibColorPicker/utils/truncate.js +1 -1
  24. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts +22 -0
  25. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +5 -2
  26. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +1 -1
  27. package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +40 -0
  28. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +1 -1
  29. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.d.vue.ts +34 -0
  30. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +8 -6
  31. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +1 -1
  32. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.d.vue.ts +34 -0
  33. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +7 -5
  34. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +1 -1
  35. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.d.vue.ts +22 -0
  36. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +1 -1
  37. package/dist/runtime/components/LibDebug/LibDebug.d.vue.ts +32 -0
  38. package/dist/runtime/components/LibDebug/LibDebug.vue +9 -4
  39. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +1 -1
  40. package/dist/runtime/components/LibDevOnly/LibDevOnly.d.vue.ts +25 -0
  41. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +2 -1
  42. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +4 -1
  43. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +43 -0
  44. package/dist/runtime/components/LibFileInput/LibFileInput.vue +29 -13
  45. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +2 -2
  46. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +165 -0
  47. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +42 -12
  48. package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +26 -0
  49. package/dist/runtime/components/LibLabel/LibLabel.vue +2 -2
  50. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +3 -3
  51. package/dist/runtime/components/LibMultiValues/LibMultiValues.d.vue.ts +29 -0
  52. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +1 -2
  53. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +2 -2
  54. package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +17 -0
  55. package/dist/runtime/components/LibNotifications/LibNotification.vue +19 -8
  56. package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +13 -0
  57. package/dist/runtime/components/LibNotifications/LibNotifications.vue +10 -6
  58. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +2 -2
  59. package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +104 -0
  60. package/dist/runtime/components/LibPagination/LibPagination.vue +25 -12
  61. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +2 -2
  62. package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +14 -0
  63. package/dist/runtime/components/LibPalette/LibPalette.vue +6 -5
  64. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +5 -5
  65. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +46 -0
  66. package/dist/runtime/components/LibPopup/LibPopup.vue +6 -4
  67. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +3 -3
  68. package/dist/runtime/components/LibProgressBar/LibProgressBar.d.vue.ts +41 -0
  69. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +5 -3
  70. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +9 -9
  71. package/dist/runtime/components/LibRecorder/LibRecorder.d.vue.ts +77 -0
  72. package/dist/runtime/components/LibRecorder/LibRecorder.vue +1 -1
  73. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +2 -2
  74. package/dist/runtime/components/LibRoot/LibRoot.d.vue.ts +41 -0
  75. package/dist/runtime/components/LibRoot/LibRoot.vue +11 -6
  76. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +1 -1
  77. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.d.vue.ts +35 -0
  78. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +1 -1
  79. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +1 -1
  80. package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +94 -0
  81. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +6 -4
  82. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +1 -1
  83. package/dist/runtime/components/LibTable/LibTable.d.vue.ts +45 -0
  84. package/dist/runtime/components/LibTable/LibTable.vue +23 -8
  85. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +1 -1
  86. package/dist/runtime/components/Template/NAME.d.vue.ts +17 -0
  87. package/dist/runtime/components/Template/NAME.vue +2 -3
  88. package/dist/runtime/components/Template/NAME.vue.d.ts +1 -1
  89. package/dist/runtime/components/TestControls/TestControls.d.vue.ts +5 -0
  90. package/dist/runtime/components/TestControls/TestControls.vue +4 -2
  91. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +1 -1
  92. package/dist/runtime/composables/useDragWithThreshold.d.ts +1 -1
  93. package/dist/runtime/composables/useInjectedI18n.d.ts +1 -1
  94. package/dist/runtime/composables/useScrollNearContainerEdges.d.ts +1 -1
  95. package/dist/runtime/composables/useSetupI18n.d.ts +1 -1
  96. package/dist/runtime/composables/useSuggestions.d.ts +2 -2
  97. package/dist/runtime/helpers/NotificationHandler.d.ts +1 -1
  98. package/dist/runtime/helpers/base64ToImg.js +2 -2
  99. package/dist/runtime/tailwind/themeConvertionOpts.d.ts +1 -1
  100. package/dist/runtime/types/index.d.ts +1 -1
  101. package/dist/runtime/utils/notifyIfError.d.ts +1 -1
  102. package/package.json +9 -10
  103. package/src/module.ts +41 -33
  104. package/src/runtime/build/WitchcraftUiResolver.ts +3 -3
  105. package/src/runtime/build/generateTheme.ts +3 -2
  106. package/src/runtime/build/unpluginIconViteOptions.ts +1 -1
  107. package/src/runtime/components/Aria/Aria.vue +5 -6
  108. package/src/runtime/components/Focus.stories.ts +11 -12
  109. package/src/runtime/components/Icon/Icon.vue +5 -9
  110. package/src/runtime/components/LibButton/LibButton.stories.ts +21 -22
  111. package/src/runtime/components/LibButton/LibButton.vue +23 -21
  112. package/src/runtime/components/LibCheckbox/LibCheckbox.stories.ts +6 -10
  113. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +17 -19
  114. package/src/runtime/components/LibColorInput/LibColorInput.stories.ts +8 -13
  115. package/src/runtime/components/LibColorInput/LibColorInput.vue +49 -45
  116. package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +14 -18
  117. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +50 -52
  118. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +1 -2
  119. package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +1 -2
  120. package/src/runtime/components/LibColorPicker/utils/truncate.ts +1 -2
  121. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +5 -8
  122. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
  123. package/src/runtime/components/LibDatePicker/LibDatePicker.stories.ts +14 -15
  124. package/src/runtime/components/LibDatePicker/LibDatePicker.vue +1 -2
  125. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +13 -13
  126. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +9 -8
  127. package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +2 -1
  128. package/src/runtime/components/LibDatePicker/helpers.ts +0 -2
  129. package/src/runtime/components/LibDebug/LibDebug.stories.ts +11 -15
  130. package/src/runtime/components/LibDebug/LibDebug.vue +14 -11
  131. package/src/runtime/components/LibDevOnly/LibDevOnly.vue +8 -4
  132. package/src/runtime/components/LibFileInput/LibFileInput.stories.ts +12 -15
  133. package/src/runtime/components/LibFileInput/LibFileInput.vue +65 -47
  134. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +77 -84
  135. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +73 -48
  136. package/src/runtime/components/LibLabel/LibLabel.stories.ts +4 -8
  137. package/src/runtime/components/LibLabel/LibLabel.vue +8 -8
  138. package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +10 -15
  139. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +14 -18
  140. package/src/runtime/components/LibNotifications/LibNotification.stories.ts +30 -34
  141. package/src/runtime/components/LibNotifications/LibNotification.vue +27 -17
  142. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +11 -15
  143. package/src/runtime/components/LibNotifications/LibNotifications.vue +21 -16
  144. package/src/runtime/components/LibPagination/LibPagination.stories.ts +5 -9
  145. package/src/runtime/components/LibPagination/LibPagination.vue +46 -32
  146. package/src/runtime/components/LibPalette/LibPalette.stories.ts +3 -7
  147. package/src/runtime/components/LibPalette/LibPalette.vue +13 -12
  148. package/src/runtime/components/LibPopup/LibPopup.stories.ts +19 -23
  149. package/src/runtime/components/LibPopup/LibPopup.vue +31 -35
  150. package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +13 -17
  151. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +36 -33
  152. package/src/runtime/components/LibRecorder/LibRecorder.stories.ts +11 -12
  153. package/src/runtime/components/LibRecorder/LibRecorder.vue +34 -34
  154. package/src/runtime/components/LibRoot/LibRoot.vue +16 -12
  155. package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +20 -24
  156. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +17 -21
  157. package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +16 -19
  158. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +28 -30
  159. package/src/runtime/components/LibTable/LibTable.stories.ts +30 -33
  160. package/src/runtime/components/LibTable/LibTable.vue +38 -24
  161. package/src/runtime/components/Reset.stories.ts +3 -6
  162. package/src/runtime/components/Scrolling.stories.ts +5 -8
  163. package/src/runtime/components/Template/NAME.vue +11 -11
  164. package/src/runtime/components/Template/TemplateStory.ts +9 -10
  165. package/src/runtime/components/TestControls/TestControls.vue +5 -5
  166. package/src/runtime/components/shared/props.ts +4 -6
  167. package/src/runtime/components/shared/storyHelpers/playInput.ts +2 -3
  168. package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +5 -9
  169. package/src/runtime/composables/useAccesibilityOutline.ts +1 -1
  170. package/src/runtime/composables/useAriaLabel.ts +1 -1
  171. package/src/runtime/composables/useDarkMode.ts +15 -19
  172. package/src/runtime/composables/useDragWithThreshold.ts +6 -8
  173. package/src/runtime/composables/useGlobalResizeObserver.ts +0 -1
  174. package/src/runtime/composables/useInjectedDarkMode.ts +2 -2
  175. package/src/runtime/composables/useInjectedI18n.ts +1 -1
  176. package/src/runtime/composables/useInjectedLocale.ts +3 -4
  177. package/src/runtime/composables/useScrollNearContainerEdges.stories.ts +4 -4
  178. package/src/runtime/composables/useScrollNearContainerEdges.ts +12 -13
  179. package/src/runtime/composables/useSetupI18n.ts +4 -7
  180. package/src/runtime/composables/useSetupLocale.ts +3 -5
  181. package/src/runtime/composables/useSuggestions.ts +25 -30
  182. package/src/runtime/directives/vDetectFlex.ts +5 -8
  183. package/src/runtime/directives/vExtractRootEl.ts +1 -1
  184. package/src/runtime/directives/vResizableCols.ts +3 -7
  185. package/src/runtime/directives/vResizeObserver.ts +1 -2
  186. package/src/runtime/globalResizeObserver.ts +0 -1
  187. package/src/runtime/helpers/NotificationHandler.ts +8 -12
  188. package/src/runtime/helpers/base64ToImg.ts +2 -3
  189. package/src/runtime/helpers/createNoonUtcDate.ts +0 -1
  190. package/src/runtime/helpers/defaultTranslationFunction.ts +0 -1
  191. package/src/runtime/helpers/getTimeZoneList.ts +0 -1
  192. package/src/runtime/helpers/readFile.ts +2 -2
  193. package/src/runtime/helpers/resizeObserverWrapper.ts +0 -1
  194. package/src/runtime/helpers/storybook.ts +2 -3
  195. package/src/runtime/main.lib.ts +0 -2
  196. package/src/runtime/nuxt/plugins/vue-plugin.ts +4 -5
  197. package/src/runtime/tailwind/themeConvertionOpts.ts +3 -4
  198. package/src/runtime/theme.ts +0 -1
  199. package/src/runtime/types/index.ts +3 -4
  200. package/src/runtime/utils/notifyIfError.ts +2 -2
  201. package/src/runtime/utils/twMerge.ts +2 -2
  202. package/src/runtime/vue/VueComponentsPlugin.ts +1 -2
  203. package/src/runtime/vue/registerComponents.ts +0 -1
@@ -1,38 +1,37 @@
1
- // @ts-nocheck remove when copying
1
+ // remove when copying
2
+ // @ts-nocheck this is a templatek
3
+ /* eslint-disable */
4
+
2
5
  /* eslint-disable @typescript-eslint/naming-convention */
3
6
  import type { Meta, StoryObj } from "@storybook/vue3"
4
7
 
5
8
  import NAME from "./NAME.vue"
6
9
 
7
10
  // todo, maybe don't do this for perf reasons
8
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
9
11
  import * as components from "../index.js"
10
12
 
11
-
12
13
  const meta: Meta<typeof NAME> = {
13
14
  component: NAME,
14
15
  args: {
15
16
 
16
- },
17
+ }
17
18
  }
18
19
 
19
20
  export default meta
20
21
  type Story = StoryObj<typeof NAME>
21
22
 
22
-
23
23
  export const Primary: Story = {
24
24
  render: args => ({
25
25
  components,
26
26
  setup: () => ({ args }),
27
27
  template: `
28
28
  <NAME v-bind="{...args}">{{args.value}}</NAME>
29
- `,
30
- }),
29
+ `
30
+ })
31
31
  }
32
32
  export const Secondary: Story = {
33
33
  ...Primary,
34
34
  args: {
35
- ...Primary.args,
36
- },
35
+ ...Primary.args
36
+ }
37
37
  }
38
-
@@ -2,7 +2,9 @@
2
2
  <!-- Width 100% + 2xmargin in combination with the margins in LibRoot is a bit of a hack so that it looks like there's padding around the content in test mode (for storybook). We can't just absolutely position these controls or they make the container scroll. -->
3
3
  <div class="test-controls flex gap-2 p-1 pb-10 -ml-10 w-[calc(100%_+_var(--spacing)*20)]">
4
4
  <div class="flex-grow"/>
5
- <div class="outline-indicator">{{ showOutline ? "Outline Enabled" : "Outline Disabled" }}</div>
5
+ <div class="outline-indicator">
6
+ {{ showOutline ? "Outline Enabled" : "Outline Disabled" }}
7
+ </div>
6
8
  <lib-dark-mode-switcher/>
7
9
  </div>
8
10
  </template>
@@ -10,10 +12,8 @@
10
12
  <script setup lang="ts">
11
13
  import LibDarkModeSwitcher from "../LibDarkModeSwitcher/LibDarkModeSwitcher.vue"
12
14
 
13
- defineOptions({ name: "test-controls" })
14
- defineProps< {
15
+ defineOptions({ name: "TestControls" })
16
+ defineProps<{
15
17
  showOutline: boolean
16
18
  }>()
17
-
18
19
  </script>
19
-
@@ -2,7 +2,6 @@ import { useId } from "vue"
2
2
 
3
3
  import type { PopupPositioner, PopupPositionModifier } from "../../types"
4
4
 
5
-
6
5
  export interface LinkableByIdProps {
7
6
  /**
8
7
  * The id for the input. Uses vue's useId if none provided.
@@ -19,7 +18,7 @@ export interface ButtonProps {
19
18
  color?: "warning" | "ok" | "danger" | "primary" | "secondary" | false
20
19
  autoTitleFromAria?: boolean
21
20
  }
22
-
21
+
23
22
  export interface LabelProps {
24
23
  /** For the label. Note the component might or might not support an actual label element. If none is supported, this is used for the `aria-label`. */
25
24
  label?: string
@@ -80,7 +79,7 @@ export type SuggestionsProps<T = any> = {
80
79
  showSelectedValues?: boolean
81
80
  }
82
81
  export type SuggestionsOptions<T> = SuggestionsProps<T>
83
-
82
+
84
83
  export interface SuggestionsEmits<TMultivalue extends boolean = false> {
85
84
  (e: "submit", val: string, suggestion?: any, wasRemoved?: boolean): void
86
85
  (e: "update:isOpen", val: boolean): void
@@ -155,7 +154,6 @@ export interface PopupProps {
155
154
  canClose?: boolean
156
155
  }
157
156
 
158
-
159
157
  export type BaseInteractiveProps = {
160
158
  /** Default is false. */
161
159
  disabled?: boolean
@@ -185,8 +183,8 @@ export type WrapperProps<TPrefix extends string, T, TOverrides extends Record<st
185
183
  [P in keyof T as P extends keyof TOverrides
186
184
  ? never
187
185
  : P extends string
188
- ? `${TPrefix}${Capitalize<P>}`
189
- : never
186
+ ? `${TPrefix}${Capitalize<P>}`
187
+ : never
190
188
  ]: T[P];
191
189
  } & {
192
190
  [P in keyof TOverrides as P extends string
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
2
1
  import { expect, userEvent, within } from "@storybook/test"
3
2
 
4
3
  // eslint-disable-next-line @typescript-eslint/naming-convention
@@ -27,10 +26,10 @@ export const playMultipleValues = async ({ canvasElement, args }: { canvasElemen
27
26
  await expect(canvas.getByTestId("model-value")).toHaveTextContent("D")
28
27
  await userEvent.keyboard("{Enter}")
29
28
  await expect(canvas.getByTestId("values").textContent)
30
- .toBe([ ...initialValues, "D" ].join(", "))
29
+ .toBe([...initialValues, "D"].join(", "))
31
30
  // empty input does nothing
32
31
  await userEvent.clear(input)
33
32
  await userEvent.keyboard("{Enter}")
34
33
  await expect(canvas.getByTestId("values").textContent)
35
- .toBe([ ...initialValues, "D" ].join(", "))
34
+ .toBe([...initialValues, "D"].join(", "))
36
35
  }
@@ -1,7 +1,5 @@
1
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
2
1
  import { expect, userEvent, within } from "@storybook/test"
3
2
 
4
-
5
3
  export const playBasicSelect = async ({ canvasElement, args }: { canvasElement: HTMLElement, args: any }) => {
6
4
  const canvas = within(canvasElement)
7
5
  const input = canvas.getByLabelText(args.label ?? "", { selector: "input" })
@@ -23,7 +21,7 @@ export const playBasicSelect = async ({ canvasElement, args }: { canvasElement:
23
21
  await expect(canvas.queryByRole("listbox")).toBeNull()
24
22
  }
25
23
  await userEvent.keyboard("{Backspace}")
26
- await expect(canvas.queryByRole("option",{ selected: true })).toBeInTheDocument()
24
+ await expect(canvas.queryByRole("option", { selected: true })).toBeInTheDocument()
27
25
  await userEvent.clear(input)
28
26
  await userEvent.type(input, "unmatched")
29
27
  if (!args.suggestionsFilter && !args.values) {
@@ -55,7 +53,7 @@ export const playBasicSelect = async ({ canvasElement, args }: { canvasElement:
55
53
  }
56
54
  }
57
55
 
58
- export const playBasicKeyboardSelect = async ({ canvasElement, args }: { canvasElement: HTMLElement , args: any }) => {
56
+ export const playBasicKeyboardSelect = async ({ canvasElement, args }: { canvasElement: HTMLElement, args: any }) => {
59
57
  const canvas = within(canvasElement)
60
58
  const input = canvas.getByLabelText(args.label ?? "", { selector: "input" })
61
59
  await userEvent.clear(input)
@@ -70,9 +68,8 @@ export const playBasicKeyboardSelect = async ({ canvasElement, args }: { canvasE
70
68
  await userEvent.keyboard("{ArrowUp}")
71
69
  await expect(canvas.queryByRole("option", {
72
70
  name: args.values ? "C" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
73
- selected: true,
71
+ selected: true
74
72
  })).toBeInTheDocument()
75
-
76
73
 
77
74
  // loops back to the first item
78
75
  await userEvent.keyboard("{ArrowDown}")
@@ -82,12 +79,12 @@ export const playBasicKeyboardSelect = async ({ canvasElement, args }: { canvasE
82
79
  await userEvent.keyboard("{PageDown}")
83
80
  await expect(canvas.queryByRole("option", {
84
81
  name: args.values ? "C" : "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
85
- selected: true,
82
+ selected: true
86
83
  })).toBeInTheDocument()
87
84
  // goes to first
88
85
  await userEvent.keyboard("{PageUp}")
89
86
  await expect(canvas.queryByRole("option", { name: "A", selected: true })).toBeInTheDocument()
90
-
87
+
91
88
  const testOpen = async (key: string) => {
92
89
  await userEvent.keyboard("{Escape}")
93
90
  if (!args.values) {
@@ -116,4 +113,3 @@ export const playBasicClickSelect = async ({ canvasElement, args }: { canvasElem
116
113
  // await expect(canvas.getByTestId("values")).toHaveTextContent(/AB$/)
117
114
  // }
118
115
  }
119
-
@@ -43,7 +43,7 @@ import { onBeforeUnmount, onMounted, type Ref, ref, watch } from "vue"
43
43
  // TODO tailwind example/plugin?
44
44
  export function useAccesibilityOutline(
45
45
  target: Ref<HTMLElement | null>,
46
- enable: Ref<boolean> = ref(true),
46
+ enable: Ref<boolean> = ref(true)
47
47
  ): Record<"outline" | "control", Ref<boolean>> {
48
48
  const outline = ref(false)
49
49
  const awaitingFocus = ref(false)
@@ -11,7 +11,7 @@ export const useAriaLabel = (
11
11
 
12
12
  const aria = computed(() => ({
13
13
  "aria-label": labelExists.value ? undefined : props.label,
14
- "aria-labelledby": labelExists.value ? `label-${id.value}` : undefined,
14
+ "aria-labelledby": labelExists.value ? `label-${id.value}` : undefined
15
15
  }))
16
16
 
17
17
  onMounted(() => {
@@ -1,5 +1,4 @@
1
- import { computed, type InjectionKey, onMounted, provide, type Ref,ref, watch } from "vue"
2
-
1
+ import { computed, type InjectionKey, onMounted, provide, type Ref, ref, watch } from "vue"
3
2
 
4
3
  const defaultLocalStorageKey = "prefersColorSchemeDark"
5
4
  const defaultOrder = ["system", "dark", "light"] as const
@@ -29,7 +28,7 @@ export const useDarkMode = ({
29
28
  }: DarkModeOptions = {}): DarkModeState & DarkModeCommands => {
30
29
  const systemDarkMode = ref(false)
31
30
  const manualDarkMode = ref<boolean | undefined>(undefined)
32
-
31
+
33
32
  if (useLocalStorage && isClientSide) {
34
33
  watch(manualDarkMode, () => {
35
34
  localStorage.setItem(defaultLocalStorageKey, manualDarkMode.value ? "true" : "false")
@@ -39,19 +38,19 @@ export const useDarkMode = ({
39
38
  const darkMode = computed(() => manualDarkMode.value ?? systemDarkMode.value)
40
39
  const darkModeState = computed(() =>
41
40
  manualDarkMode.value === undefined
42
- ? "system"
43
- : manualDarkMode.value
44
- ? "dark"
45
- : "light"
41
+ ? "system"
42
+ : manualDarkMode.value
43
+ ? "dark"
44
+ : "light"
46
45
  )
47
46
  // todo move to useinjected
48
47
  function setDarkMode(value: "dark" | "light" | "system"): void {
49
- manualDarkMode.value =
50
- value === "dark"
51
- ? true
52
- : value === "light"
53
- ? false
54
- : undefined
48
+ manualDarkMode.value
49
+ = value === "dark"
50
+ ? true
51
+ : value === "light"
52
+ ? false
53
+ : undefined
55
54
  }
56
55
  function cycleDarkMode(): void {
57
56
  const index = darkModeOrder.indexOf(darkModeState.value)
@@ -90,11 +89,11 @@ export const useDarkMode = ({
90
89
  darkMode,
91
90
  darkModeState,
92
91
  manualDarkMode,
93
- systemDarkMode,
92
+ systemDarkMode
94
93
  })
95
94
  provide(commandsInjectionKey, {
96
95
  setDarkMode,
97
- cycleDarkMode,
96
+ cycleDarkMode
98
97
  })
99
98
 
100
99
  return {
@@ -103,7 +102,7 @@ export const useDarkMode = ({
103
102
  setDarkMode,
104
103
  cycleDarkMode,
105
104
  manualDarkMode,
106
- systemDarkMode,
105
+ systemDarkMode
107
106
  }
108
107
  }
109
108
  export const defaultDarkModeOrder = defaultOrder
@@ -116,7 +115,6 @@ export const darkModeCommandsInjectionKey = commandsInjectionKey
116
115
 
117
116
  export const darkModeStateInjectionKey = stateInjectionKey
118
117
 
119
-
120
118
  export type DarkModeOptions = {
121
119
  /* Whether to save the manual dark mode to local storage. Uses the key "prefersColorSchemeDark" by default. You can pass a key instead of true to use that as the key instead. */
122
120
  useLocalStorage?: boolean | string
@@ -126,13 +124,11 @@ export type DarkModeOptions = {
126
124
  isClientSide?: boolean
127
125
  }
128
126
 
129
-
130
127
  export interface DarkModeCommands {
131
128
  setDarkMode: (value: "dark" | "light" | "system") => void
132
129
  cycleDarkMode: () => void
133
130
  }
134
131
 
135
-
136
132
  export interface DarkModeState {
137
133
  /** Whether the dark mode should be enabled or not */
138
134
  darkMode: Ref<boolean>
@@ -2,7 +2,6 @@ import { type Ref, ref } from "vue"
2
2
 
3
3
  import type { Point } from "../types/index.js"
4
4
 
5
-
6
5
  /**
7
6
  * A composable for dragging items only after a certain threshold of movement has been reached.
8
7
  *
@@ -58,12 +57,12 @@ import type { Point } from "../types/index.js"
58
57
  export const useDragWithThreshold = ({
59
58
  initialOffset = ref({ x: 0, y: 0 }),
60
59
  pointerCoords = ref({ x: 0, y: 0 }),
61
- threshold = ref(10),
60
+ threshold = ref(10)
62
61
  }: {
63
62
  initialOffset?: Ref<Point | undefined>
64
63
  pointerCoords?: Ref<Point | undefined>
65
64
  threshold?: Ref<number>
66
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
65
+
67
66
  } = {}) => {
68
67
  const passedDragThreshold = ref(false)
69
68
  function getDistance(p1: Point, p2: Point): number {
@@ -80,9 +79,9 @@ export const useDragWithThreshold = ({
80
79
  function checkDragThreshold(e: PointerEvent): void {
81
80
  pointerCoords.value = getEventCoords(e)
82
81
  // don't allow it to be reset to false
83
- passedDragThreshold.value ||=
84
- initialOffset.value !== undefined &&
85
- getDistance(initialOffset.value, pointerCoords.value) >= threshold.value
82
+ passedDragThreshold.value
83
+ ||= initialOffset.value !== undefined
84
+ && getDistance(initialOffset.value, pointerCoords.value) >= threshold.value
86
85
  }
87
86
  function startDragThresholdCheck(e: PointerEvent): void {
88
87
  passedDragThreshold.value = false
@@ -102,7 +101,6 @@ export const useDragWithThreshold = ({
102
101
  getEventCoords,
103
102
  checkDragThreshold,
104
103
  startDragThresholdCheck,
105
- endDragThresholdCheck,
104
+ endDragThresholdCheck
106
105
  }
107
106
  }
108
-
@@ -3,7 +3,6 @@ import { onBeforeUnmount, onMounted, type Ref, watch } from "vue"
3
3
 
4
4
  import { globalResizeObserver } from "../globalResizeObserver.js"
5
5
 
6
-
7
6
  export const useGlobalResizeObserver = (el: Ref<HTMLElement | null>, cb: AnyFunction): void => {
8
7
  let wasMounted = false
9
8
  // in case we accidentally use it in an onMounted hook or somewhere where the element already exists
@@ -1,6 +1,6 @@
1
1
  import { inject } from "vue"
2
2
 
3
- import { type DarkModeCommands, darkModeCommandsInjectionKey, type DarkModeState,darkModeStateInjectionKey } from "./useDarkMode.js"
3
+ import { type DarkModeCommands, darkModeCommandsInjectionKey, type DarkModeState, darkModeStateInjectionKey } from "./useDarkMode.js"
4
4
 
5
5
  export function useInjectedDarkMode(): DarkModeState & DarkModeCommands {
6
6
  const darkModeState = inject(darkModeStateInjectionKey)
@@ -10,6 +10,6 @@ export function useInjectedDarkMode(): DarkModeState & DarkModeCommands {
10
10
  }
11
11
  return {
12
12
  ...darkModeState,
13
- ...darkModeCommands,
13
+ ...darkModeCommands
14
14
  }
15
15
  }
@@ -1,7 +1,7 @@
1
1
  import { inject } from "vue"
2
2
 
3
+ import type { TranslationFunction } from "./useSetupI18n.js"
3
4
  import { i18nInjectionKey } from "./useSetupI18n.js"
4
- import { type TranslationFunction } from "./useSetupI18n.js"
5
5
 
6
6
  export function useInjectedI18n(): TranslationFunction {
7
7
  const val = inject(i18nInjectionKey, undefined)
@@ -1,6 +1,6 @@
1
1
  import { inject } from "vue"
2
2
 
3
- import { languageLocaleInjectionKey , timeLocaleInjectionKey , type useSetupLocale } from "./useSetupLocale.js"
3
+ import { languageLocaleInjectionKey, timeLocaleInjectionKey, type useSetupLocale } from "./useSetupLocale.js"
4
4
 
5
5
  export function useInjectedLocale(): ReturnType<typeof useSetupLocale> {
6
6
  const timeLocale = inject(timeLocaleInjectionKey)
@@ -14,11 +14,10 @@ export function useInjectedLocale(): ReturnType<typeof useSetupLocale> {
14
14
  function setTimeLocale(value: string): void {
15
15
  timeLocale!.value = value
16
16
  }
17
- return{
17
+ return {
18
18
  timeLocale,
19
19
  languageLocale,
20
20
  setLanguageLocale,
21
- setTimeLocale,
21
+ setTimeLocale
22
22
  }
23
23
  }
24
-
@@ -6,7 +6,7 @@ import { useScrollNearContainerEdges } from "./useScrollNearContainerEdges.js"
6
6
  import { twMerge } from "../utils/twMerge.js"
7
7
 
8
8
  const meta = {
9
- title: "Composables/ScrollNearContainerEdges",
9
+ title: "Composables/ScrollNearContainerEdges"
10
10
  }
11
11
 
12
12
  export default meta
@@ -25,7 +25,7 @@ export const Primary: Story = {
25
25
  } = useScrollNearContainerEdges({
26
26
  containerEl,
27
27
  scrollMargin: 20,
28
- outerScrollMargin: 20,
28
+ outerScrollMargin: 20
29
29
  })
30
30
  const pos = ref({ x: 0, y: 0 })
31
31
  onMounted(() => {
@@ -88,6 +88,6 @@ export const Primary: Story = {
88
88
  ></div>
89
89
  </div>
90
90
  </div>
91
- `,
92
- }),
91
+ `
92
+ })
93
93
  }
@@ -2,7 +2,6 @@ import { reactive, type Ref, ref } from "vue"
2
2
 
3
3
  import type { ScrollNearContainerEdgesOptions } from "../types/index.js"
4
4
 
5
-
6
5
  /**
7
6
  * Creates a function `scrollContainer` that allows scrolling a container manually when the coordinates are near it's edges.
8
7
  * Supports scrolling faster the closer one is to the edge, and configuing an inner and outer margin.
@@ -55,7 +54,7 @@ import type { ScrollNearContainerEdgesOptions } from "../types/index.js"
55
54
  * </div>
56
55
  * ```
57
56
  */
58
-
57
+
59
58
  export const useScrollNearContainerEdges = ({
60
59
  containerEl,
61
60
  scrollMargin = 10,
@@ -63,16 +62,16 @@ export const useScrollNearContainerEdges = ({
63
62
  fastPixelMultiplier = 4,
64
63
  fastPixelAmount,
65
64
  useTimer = true,
66
- timerInterval = 1,
65
+ timerInterval = 1
67
66
  }: ScrollNearContainerEdgesOptions): {
68
- scrollEdges: (clientX: number, clientY: number, overrideUseTimer?: boolean) => void
69
- /** Reactive. */
70
- scrollIndicator: { left: boolean, right: boolean, down: boolean, up: boolean }
71
- resetScrollIndicator: () => void
72
- clearScrollInterval: () => void
73
- isScrolling: Ref<boolean>
74
- endScroll: () => void
75
- } => {
67
+ scrollEdges: (clientX: number, clientY: number, overrideUseTimer?: boolean) => void
68
+ /** Reactive. */
69
+ scrollIndicator: { left: boolean, right: boolean, down: boolean, up: boolean }
70
+ resetScrollIndicator: () => void
71
+ clearScrollInterval: () => void
72
+ isScrolling: Ref<boolean>
73
+ endScroll: () => void
74
+ } => {
76
75
  fastPixelMultiplier = fastPixelAmount !== undefined ? fastPixelAmount * 2 : fastPixelMultiplier
77
76
  const scrollIndicator = reactive({ left: false, right: false, down: false, up: false })
78
77
  const isScrolling = ref(false)
@@ -104,7 +103,7 @@ export const useScrollNearContainerEdges = ({
104
103
  const el = containerEl.value
105
104
  if (!el) return
106
105
  const box = el.getBoundingClientRect()
107
-
106
+
108
107
  /*
109
108
  rightRightLimit│
110
109
 
@@ -199,7 +198,7 @@ export const useScrollNearContainerEdges = ({
199
198
  resetScrollIndicator,
200
199
  clearScrollInterval,
201
200
  isScrolling,
202
- endScroll,
201
+ endScroll
203
202
  /* resetMove does not need to be returned since the user cannot call the timer interval manually and the scrollContainer function resets it before starting. */
204
203
  }
205
204
  }
@@ -3,12 +3,11 @@ import {
3
3
  provide,
4
4
  type Ref,
5
5
  ref,
6
- watch,
6
+ watch
7
7
  } from "vue"
8
8
 
9
9
  import { defaultTranslationFunction } from "../helpers/defaultTranslationFunction.js"
10
10
 
11
-
12
11
  export type TranslationFunction = (key: string, replacements?: Record<string, any>) => string
13
12
 
14
13
  const _i18nInjectionKey = Symbol("witchcraftUiI18n") as InjectionKey<TranslationFunction>
@@ -19,17 +18,16 @@ const loaded: Record<string, any> = {}
19
18
  const dummyLibraryMessages = new Proxy({}, {
20
19
  get() {
21
20
  return "..."
22
- },
21
+ }
23
22
  })
24
23
  const dummyMessageSet = new Proxy({}, {
25
24
  get(_, key: string) {
26
25
  if (key === "witchcraft-ui") {
27
26
  return dummyLibraryMessages
28
27
  } else return undefined
29
- },
28
+ }
30
29
  })
31
30
 
32
-
33
31
  /**
34
32
  * A composable for providing a translation function + messages for the library. Note the Root component already takes care of setting this up with defaults, disable it via it's `useBuiltinTranslations` option.
35
33
  *
@@ -43,7 +41,7 @@ export async function useSetupI18n({
43
41
  locale,
44
42
  useBuiltinTranslations = false,
45
43
  useDummyMessageSetWhileLoading = true,
46
- translationFunction = defaultTranslationFunction,
44
+ translationFunction = defaultTranslationFunction
47
45
  }: {
48
46
  locale: Ref<string>
49
47
  /** Will asynchronously load the built-in translations for the current locale (watching and updating if needed). If you don't use this, you'll need to provide a custom translation function. */
@@ -80,4 +78,3 @@ export async function useSetupI18n({
80
78
 
81
79
  export const i18nInjectionKey = _i18nInjectionKey
82
80
  export const translationMessagesInjectionKey = _translationMessagesInjectionKey
83
-
@@ -1,5 +1,4 @@
1
- import { type InjectionKey, provide,type Ref,ref } from "vue"
2
-
1
+ import { type InjectionKey, provide, type Ref, ref } from "vue"
3
2
 
4
3
  export const languageLocaleInjectionKey = Symbol("witchcraftUiLanguageLocale") as InjectionKey<Ref<string>>
5
4
  export const timeLocaleInjectionKey = Symbol("witchcraftUiTimeLocale") as InjectionKey<Ref<string>>
@@ -19,14 +18,13 @@ export function useSetupLocale(): {
19
18
  function setTimeLocale(value: string): void {
20
19
  timeLocale.value = value
21
20
  }
22
-
21
+
23
22
  provide(languageLocaleInjectionKey, languageLocale)
24
23
  provide(timeLocaleInjectionKey, timeLocale)
25
24
  return {
26
25
  languageLocale,
27
26
  timeLocale,
28
27
  setLanguageLocale,
29
- setTimeLocale,
28
+ setTimeLocale
30
29
  }
31
30
  }
32
-