@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.
Files changed (138) hide show
  1. package/dist/module.json +2 -2
  2. package/dist/module.mjs +1 -1
  3. package/dist/runtime/components/Aria/Aria.vue +5 -9
  4. package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
  5. package/dist/runtime/components/Icon/Icon.vue +10 -31
  6. package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
  7. package/dist/runtime/components/LibButton/LibButton.vue +58 -77
  8. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
  9. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +48 -75
  10. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
  11. package/dist/runtime/components/LibColorInput/LibColorInput.vue +63 -108
  12. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
  13. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +271 -352
  14. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
  15. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +32 -57
  16. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
  17. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +17 -38
  18. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
  19. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +53 -82
  20. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
  21. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +50 -67
  22. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
  23. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +7 -8
  24. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
  25. package/dist/runtime/components/LibDebug/LibDebug.vue +42 -70
  26. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
  27. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +18 -31
  28. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
  29. package/dist/runtime/components/LibFileInput/LibFileInput.vue +113 -157
  30. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
  31. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +215 -242
  32. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
  33. package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
  34. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
  35. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +44 -59
  36. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
  37. package/dist/runtime/components/LibNotifications/LibNotification.vue +32 -49
  38. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
  39. package/dist/runtime/components/LibNotifications/LibNotifications.vue +63 -84
  40. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
  41. package/dist/runtime/components/LibPagination/LibPagination.vue +67 -112
  42. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
  43. package/dist/runtime/components/LibPalette/LibPalette.vue +20 -23
  44. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
  45. package/dist/runtime/components/LibPopup/LibPopup.vue +314 -352
  46. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
  47. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +70 -92
  48. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
  49. package/dist/runtime/components/LibRecorder/LibRecorder.vue +133 -178
  50. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
  51. package/dist/runtime/components/LibRoot/LibRoot.vue +73 -100
  52. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
  53. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +49 -78
  54. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
  55. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +123 -157
  56. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
  57. package/dist/runtime/components/LibTable/LibTable.vue +63 -100
  58. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
  59. package/dist/runtime/components/Template/NAME.vue +15 -36
  60. package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
  61. package/dist/runtime/components/TestControls/TestControls.vue +6 -9
  62. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
  63. package/dist/runtime/directives/vResizableCols.js +89 -83
  64. package/dist/types.d.mts +2 -6
  65. package/package.json +11 -11
  66. package/src/runtime/components/Focus.stories.ts +3 -2
  67. package/src/runtime/components/Icon/Icon.vue +0 -1
  68. package/src/runtime/components/LibButton/LibButton.vue +0 -1
  69. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -1
  70. package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -1
  71. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +0 -1
  72. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +0 -1
  73. package/src/runtime/components/LibFileInput/LibFileInput.vue +0 -1
  74. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -1
  75. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -1
  76. package/src/runtime/components/LibNotifications/LibNotification.vue +0 -1
  77. package/src/runtime/components/LibNotifications/LibNotifications.vue +0 -1
  78. package/src/runtime/components/LibPagination/LibPagination.vue +0 -1
  79. package/src/runtime/components/LibPopup/LibPopup.vue +0 -1
  80. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -1
  81. package/src/runtime/components/LibRecorder/LibRecorder.vue +0 -1
  82. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +0 -1
  83. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -1
  84. package/src/runtime/components/LibTable/LibTable.vue +0 -1
  85. package/src/runtime/directives/vResizableCols.ts +79 -73
  86. package/dist/module.cjs +0 -5
  87. package/dist/module.d.ts +0 -36
  88. package/dist/runtime/components/Focus.stories.d.ts +0 -11
  89. package/dist/runtime/components/Focus.stories.js +0 -53
  90. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
  91. package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
  92. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
  93. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
  94. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
  95. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
  96. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -9
  97. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -68
  98. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
  99. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
  100. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
  101. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
  102. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
  103. package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
  104. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
  105. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
  106. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.d.ts +0 -33
  107. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.js +0 -384
  108. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
  109. package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
  110. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
  111. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -61
  112. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
  113. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
  114. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
  115. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
  116. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
  117. package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
  118. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
  119. package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
  120. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
  121. package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
  122. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
  123. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
  124. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
  125. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
  126. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
  127. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
  128. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
  129. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
  130. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
  131. package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
  132. package/dist/runtime/components/Reset.stories.d.ts +0 -5
  133. package/dist/runtime/components/Reset.stories.js +0 -19
  134. package/dist/runtime/components/Scrolling.stories.d.ts +0 -6
  135. package/dist/runtime/components/Scrolling.stories.js +0 -44
  136. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
  137. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
  138. package/dist/types.d.ts +0 -7
@@ -79,7 +79,6 @@ const $ = useDivideAttrs(["item"] as const)
79
79
  const emits = defineEmits<SuggestionsEmits>()
80
80
 
81
81
  const fallbackId = getFallbackId()
82
- // eslint-disable-next-line no-use-before-define
83
82
  const props = withDefaults(defineProps<Props & SuggestionsProps<TSuggestion>>(), {
84
83
  isValid: true,
85
84
  canOpen: true,
@@ -106,7 +106,6 @@ defineOptions({
106
106
  name: "lib-table",
107
107
  })
108
108
 
109
- // eslint-disable-next-line no-use-before-define
110
109
  const props = withDefaults(defineProps<Props>(), {
111
110
  resizable: () => ({}),
112
111
  values: () => [] as T[],
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-use-before-define */
2
1
  import { castType } from "@alanscodelog/utils/castType.js"
3
2
  import { override } from "@alanscodelog/utils/override.js"
4
3
  import { throttle } from "@alanscodelog/utils/throttle.js"
@@ -137,7 +136,7 @@ export const vResizableCols: Directive = {
137
136
  }
138
137
 
139
138
 
140
- const setWidth = (col: HTMLElement, amountInPx: number, el: ResizableElement): void => {
139
+ function setWidth(col: HTMLElement, amountInPx: number, el: ResizableElement): void {
141
140
  const $el = getElInfo(el)
142
141
  const width = Math.max($el.margin, amountInPx)
143
142
 
@@ -150,13 +149,14 @@ const setWidth = (col: HTMLElement, amountInPx: number, el: ResizableElement): v
150
149
  }
151
150
 
152
151
 
153
- const getBox = (el: Element): { x: number, width: number } => {
152
+ function getBox(el: Element): { x: number, width: number } {
154
153
  const rect = el.getBoundingClientRect()
155
154
  // the numbers need to be rounded or else the columns will start to shift
156
155
  // rounding rect.width is bettwe than just using clientWidth which does not include the scrollbar
157
156
  return { x: Math.round(rect.x), width: Math.round(rect.width) }
158
157
  }
159
- const getCols = (el: ResizableElement): { col: HTMLElement | null, colNext: HTMLElement | null } => {
158
+
159
+ function getCols(el: ResizableElement): { col: HTMLElement | null, colNext: HTMLElement | null } {
160
160
  const $el = getElInfo(el)
161
161
  if (!$el.target) unreachable()
162
162
  let col = getColEls(el)[$el.grips.get($el.target!)!]
@@ -174,89 +174,95 @@ const getCols = (el: ResizableElement): { col: HTMLElement | null, colNext: HTML
174
174
  return { col, colNext }
175
175
  }
176
176
 
177
- const createPointerDownHandler = (el: ResizableElement) => (e: PointerEvent) => {
178
- const $el = getElInfo(el)
179
- if (!$el.isDragging) {
180
- castType<HTMLElement>(e.target)
181
- $el.target = e.target
182
- $el.isDragging = true
183
- e.preventDefault()
184
-
185
- // in case any errors happen, we want the pointer up to still be called
186
- document.addEventListener("pointerup", $el.pointerUpHandler)
187
-
188
- const { col, colNext } = getCols(el)
189
- if (col === null || colNext === null) {
190
- el.classList.add("resizable-cols-error")
191
- } else {
192
- document.addEventListener("pointermove", $el.pointerMoveHandler)
193
- const box = getBox(col!)
194
- if (box) {
195
- $el.offset = e.pageX - (box.x + box.width)
177
+ function createPointerDownHandler(el: ResizableElement) {
178
+ return (e: PointerEvent) => {
179
+ const $el = getElInfo(el)
180
+ if (!$el.isDragging) {
181
+ castType<HTMLElement>(e.target)
182
+ $el.target = e.target
183
+ $el.isDragging = true
184
+ e.preventDefault()
185
+
186
+ // in case any errors happen, we want the pointer up to still be called
187
+ document.addEventListener("pointerup", $el.pointerUpHandler)
188
+
189
+ const { col, colNext } = getCols(el)
190
+ if (col === null || colNext === null) {
191
+ el.classList.add("resizable-cols-error")
192
+ } else {
193
+ document.addEventListener("pointermove", $el.pointerMoveHandler)
194
+ const box = getBox(col!)
195
+ if (box) {
196
+ $el.offset = e.pageX - (box.x + box.width)
197
+ }
196
198
  }
197
199
  }
198
200
  }
199
201
  }
200
- const createPointerMoveHandler = (el: ResizableElement) => (e: PointerEvent) => {
201
- const $el = getElInfo(el)
202
- if ($el.isDragging) {
203
- e.preventDefault()
202
+ function createPointerMoveHandler(el: ResizableElement) {
203
+ return (e: PointerEvent) => {
204
+ const $el = getElInfo(el)
205
+ if ($el.isDragging) {
206
+ e.preventDefault()
204
207
 
205
- const { col, colNext } = getCols(el)
208
+ const { col, colNext } = getCols(el)
206
209
 
207
- if (col !== null) {
208
- const leftBox = getBox(col)
210
+ if (col !== null) {
211
+ const leftBox = getBox(col)
209
212
 
210
- const oldWidth = leftBox.width
211
- const leftBound = leftBox.x
212
- const rightBox = colNext ? getBox(colNext) : getBox(el)
213
+ const oldWidth = leftBox.width
214
+ const leftBound = leftBox.x
215
+ const rightBox = colNext ? getBox(colNext) : getBox(el)
213
216
 
214
- const rightBound = rightBox.x + rightBox.width
215
- const margin = $el.margin
216
- const pos = e.pageX - $el.offset!
217
+ const rightBound = rightBox.x + rightBox.width
218
+ const margin = $el.margin
219
+ const pos = e.pageX - $el.offset!
217
220
 
218
- if ($el.fitWidth) {
219
- if (pos > (leftBound + margin) && pos < (rightBound - margin)) {
220
- const newWidth = pos - leftBound
221
- const diff = oldWidth - newWidth
221
+ if ($el.fitWidth) {
222
+ if (pos > (leftBound + margin) && pos < (rightBound - margin)) {
223
+ const newWidth = pos - leftBound
224
+ const diff = oldWidth - newWidth
222
225
 
223
- if (rightBox.width + diff < margin) {
224
- el.classList.add("resizable-cols-error")
225
- return
226
- }
226
+ if (rightBox.width + diff < margin) {
227
+ el.classList.add("resizable-cols-error")
228
+ return
229
+ }
227
230
 
228
231
 
229
- setWidth(col, newWidth, el)
230
- setWidth(colNext!, rightBox.width + diff, el)
231
- }
232
- } else {
233
- if (pos > leftBound + margin) {
234
- const newWidth = pos - leftBound
235
- setWidth(col, newWidth, el)
232
+ setWidth(col, newWidth, el)
233
+ setWidth(colNext!, rightBox.width + diff, el)
234
+ }
235
+ } else {
236
+ if (pos > leftBound + margin) {
237
+ const newWidth = pos - leftBound
238
+ setWidth(col, newWidth, el)
239
+ }
236
240
  }
237
- }
238
241
 
239
- positionGrips(el)
242
+ positionGrips(el)
243
+ }
240
244
  }
241
245
  }
242
246
  }
243
247
 
244
- const createPointerUpHandler = (el: ResizableElement) => (e: PointerEvent) => {
245
- const $el = getElInfo(el)
246
- if ($el.isDragging) {
247
- e.preventDefault()
248
- $el.isDragging = false
249
- el.classList.remove("resizable-cols-error")
250
- $el.offset = 0
251
- delete $el.target
252
- document.removeEventListener("pointermove", $el.pointerMoveHandler)
253
- document.removeEventListener("pointerup", $el.pointerUpHandler)
254
- // unfortunately does not work with iframes in storybook but otherwise does work
255
- document.removeEventListener("pointerleave", $el.pointerLeaveHandler)
248
+ function createPointerUpHandler(el: ResizableElement) {
249
+ return (e: PointerEvent) => {
250
+ const $el = getElInfo(el)
251
+ if ($el.isDragging) {
252
+ e.preventDefault()
253
+ $el.isDragging = false
254
+ el.classList.remove("resizable-cols-error")
255
+ $el.offset = 0
256
+ delete $el.target
257
+ document.removeEventListener("pointermove", $el.pointerMoveHandler)
258
+ document.removeEventListener("pointerup", $el.pointerUpHandler)
259
+ // unfortunately does not work with iframes in storybook but otherwise does work
260
+ document.removeEventListener("pointerleave", $el.pointerLeaveHandler)
261
+ }
256
262
  }
257
263
  }
258
264
 
259
- const createGrip = (): HTMLElement => {
265
+ function createGrip(): HTMLElement {
260
266
  const grip = document.createElement("div")
261
267
  grip.style.position = "absolute"
262
268
  grip.style.cursor = "col-resize"
@@ -271,7 +277,7 @@ const removeGrips = (el: HTMLElement): void => {
271
277
  el.removeChild(grip)
272
278
  }
273
279
  }
274
- const getTestGripSize = (el: ResizableElement): number => {
280
+ function getTestGripSize(el: ResizableElement): number {
275
281
  const testGrip = createGrip()
276
282
  el.appendChild(testGrip)
277
283
  const dynamicMinWidth = getBox(testGrip).width * 3
@@ -279,18 +285,18 @@ const getTestGripSize = (el: ResizableElement): number => {
279
285
  return dynamicMinWidth
280
286
  }
281
287
 
282
- const getElInfo = (el: ResizableElement): Data => {
288
+ function getElInfo(el: ResizableElement): Data {
283
289
  const $el = elMap.get(el)
284
290
  if (!$el) unreachable("El went missing.")
285
291
  return $el
286
292
  }
287
- const getColEls = (el: ResizableElement): HTMLElement[] => {
293
+ function getColEls(el: ResizableElement): HTMLElement[] {
288
294
  const $el = elMap.get(el)
289
295
  if (!$el) unreachable("El went missing.")
290
296
  return [...el.querySelectorAll(`:scope ${$el.selector ? $el.selector : "tr > td"}`)] as any
291
297
  }
292
298
 
293
- const setupColumns = (el: ResizableElement, opts: ResizableOptions): void => {
299
+ function setupColumns(el: ResizableElement, opts: ResizableOptions): void {
294
300
  const gripWidth = getTestGripSize(el)
295
301
  const $el: Data = {
296
302
  grips: new Map(),
@@ -325,7 +331,7 @@ const setupColumns = (el: ResizableElement, opts: ResizableOptions): void => {
325
331
  el.classList.add("resizable-cols-setup")
326
332
  }
327
333
 
328
- const positionGrips = (el: ResizableElement): void => {
334
+ function positionGrips(el: ResizableElement): void {
329
335
  let xPos = 0
330
336
  const $el = getElInfo(el)
331
337
  for (const grip of $el.grips.keys()) {
@@ -340,7 +346,7 @@ const positionGrips = (el: ResizableElement): void => {
340
346
  }
341
347
  }
342
348
 
343
- const setColWidths = (el: ResizableElement, children?: Element[]): void => {
349
+ function setColWidths(el: ResizableElement, children?: Element[]): void {
344
350
  const $el = getElInfo(el)
345
351
  const header = children ?? getColEls(el).slice(0, $el.colCount)
346
352
  const len = $el.colCount
@@ -365,7 +371,7 @@ const setColWidths = (el: ResizableElement, children?: Element[]): void => {
365
371
  }
366
372
  }
367
373
 
368
- const teardownColumns = (el: ResizableElement): void => {
374
+ function teardownColumns(el: ResizableElement): void {
369
375
  const $el = getElInfo(el)
370
376
 
371
377
  el.removeEventListener("pointerdown", $el.pointerDownHandler)
package/dist/module.cjs DELETED
@@ -1,5 +0,0 @@
1
- module.exports = function(...args) {
2
- return import('./module.mjs').then(m => m.default.call(this, ...args))
3
- }
4
- const _meta = module.exports.meta = require('./module.json')
5
- module.exports.getMeta = () => Promise.resolve(_meta)
package/dist/module.d.ts DELETED
@@ -1,36 +0,0 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
-
3
- declare const knownDirectives: readonly ["vExtractRootEl", "vResizableCols", "vResizeObserver", "vResizableCols"];
4
- declare module "@nuxt/schema" {
5
- interface PublicRuntimeConfig {
6
- witchcraftUi: Pick<ModuleOptions, "directives">;
7
- }
8
- }
9
- interface ModuleOptions {
10
- /**
11
- * Whether to include the vite unplugin-icons plugins (pre-configured with the ui module's defaults.
12
- *
13
- * @default true
14
- */
15
- includeUnpluginIconsPlugins?: boolean;
16
- directives: (typeof knownDirectives[number])[];
17
- /**
18
- * Which components (without a prefix) to register for auto-importing globally.
19
- */
20
- globalComponents: string[];
21
- /**
22
- * @default "W"
23
- */
24
- componentPrefix: string;
25
- debug?: boolean;
26
- /**
27
- * @default "~/assets/css/tailwind.css" if it exists.
28
- */
29
- mainCssFile?: string;
30
- /** @internal */
31
- _playgroundWorkaround?: boolean;
32
- }
33
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
34
-
35
- export { _default as default };
36
- export type { ModuleOptions };
@@ -1,11 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- /**
3
- * For testing the focus styles. The (still WIP) idea is that normally the outlined class is set by whether the user is using the keyboard or not. When true, outlines generated by the focus-outline-* or outlined-* utilities are allowed (they might not always appear since most components have focus-visible styles), when false, they are not allowed, but components can still set custom focus styles that will always appear. Either or is usually not a good idea unless all components set custom focus styles. For something like a web app, focus-visible should be allowed. For an app, this setup allows that to be configurable.
4
- */
5
- declare const meta: Meta;
6
- export default meta;
7
- type Story = StoryObj<typeof NAME>;
8
- export declare const Primary: Story;
9
- export declare const OutlineForcedTrue: Story;
10
- export declare const OutlineFalse: Story;
11
- export declare const AlwaysAllowFocusVisible: Story;
@@ -1,53 +0,0 @@
1
- import { onMounted, ref } from "vue";
2
- import * as components from "./index.js";
3
- const meta = {
4
- title: "Other/Focus",
5
- args: {
6
- outline: true
7
- }
8
- };
9
- const template = `
10
- <div class="focus-outline-no-offset border border-accent-600" tabindex="0">focus-outline-no-offset (outlined i.e. outlined-focus-visible)</div>
11
- <div class="focus-outline border border-accent-600" tabindex="0">focus-outline (outlined i.e. outlined-focus-visible)</div>
12
- <div class="outline-hidden outlined-focus:border-danger-500 border border-accent-600" tabindex="0">outlined-focus</div>
13
- <div class="outline-hidden outlined-within:border-danger-500 border border-accent-600" >
14
- outlined-within<div tabindex="0">Inner</div>
15
- </div>
16
- <div class="outline-hidden focus:border-danger-500 border border-accent-600" tabindex="0">Has Manual Focus Classes</div>
17
- `;
18
- export default meta;
19
- export const Primary = {
20
- render: (args) => ({
21
- components,
22
- setup: () => {
23
- const el = ref(null);
24
- onMounted(() => {
25
- });
26
- return { ...args, el };
27
- },
28
- template
29
- })
30
- };
31
- export const OutlineForcedTrue = {
32
- ...Primary,
33
- args: {
34
- ...Primary.args,
35
- forceOutline: true
36
- }
37
- };
38
- export const OutlineFalse = {
39
- ...Primary,
40
- args: {
41
- ...Primary.args,
42
- outline: false
43
- }
44
- };
45
- export const AlwaysAllowFocusVisible = {
46
- render: (args) => ({
47
- components,
48
- setup: () => args,
49
- template: `
50
- <div class="outlined-visible group">${template}</div>
51
- `
52
- })
53
- };
@@ -1,12 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import * as components from "../index.js.js";
3
- declare const meta: Meta<typeof components.LibButton>;
4
- export default meta;
5
- type Story = StoryObj<typeof components.LibButton>;
6
- export declare const Primary: Story;
7
- export declare const IconAfter: Story;
8
- export declare const OnlyIcon: Story;
9
- export declare const Disabled: Story;
10
- export declare const Borderless: Story;
11
- export declare const BorderlessDisabled: Story;
12
- export declare const WithDivInside: Story;
@@ -1,94 +0,0 @@
1
- import { capitalize } from "@alanscodelog/utils/capitalize.js";
2
- import IconFaSolidBell from "~icons/fa-solid/bell";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: components.LibButton,
6
- title: "Components/Button",
7
- args: {
8
- label: "Label",
9
- // @ts-expect-error - custom prop for story
10
- _iconAfter: true
11
- }
12
- };
13
- export default meta;
14
- export const Primary = {
15
- render: (args) => ({
16
- components: {
17
- ...components,
18
- IconFaSolidBell
19
- },
20
- setup: () => ({ args, capitalize }),
21
- template: `
22
- <div class="flex gap-4 justify-center">
23
- <template v-for="type of [false, 'ok', 'warning', 'danger', 'primary', 'secondary' ]">
24
- <lib-button v-bind="{...args, color: type, label: !args.label ? undefined : args.label + ' ' + capitalize(type || 'false')}">
25
- <template #icon>
26
- <icon class="w-[1em]"><icon-fa-solid-bell /></icon>
27
- </template>
28
- </lib-button>
29
- </template>
30
- </div>
31
- <div class="flex flex-col gap-4 pt-10">
32
- <template v-for="type of [false, 'ok', 'warning', 'danger', 'primary', 'secondary']">
33
- <lib-button v-bind="{...args, color: type , label: !args.label ? undefined : args.label + ' ' + capitalize(type || 'false') }">
34
- ${args._iconAfter ? `
35
- <template #icon-after>
36
- <icon class="w-[1em]"><icon-fa-solid-bell /></icon>
37
- </template>
38
- ` : ``}
39
- </lib-button>
40
- </template>
41
- </div>
42
- `
43
- })
44
- };
45
- export const IconAfter = {
46
- ...Primary,
47
- args: {
48
- ...Primary.args,
49
- // @ts-expect-error - .
50
- _iconAfter: true
51
- }
52
- };
53
- export const OnlyIcon = {
54
- ...Primary,
55
- args: {
56
- ...Primary.args,
57
- label: void 0
58
- }
59
- };
60
- export const Disabled = {
61
- ...Primary,
62
- args: {
63
- ...Primary.args,
64
- disabled: true
65
- }
66
- };
67
- export const Borderless = {
68
- ...Primary,
69
- args: {
70
- ...Primary.args,
71
- border: false
72
- }
73
- };
74
- export const BorderlessDisabled = {
75
- ...Primary,
76
- args: {
77
- ...Primary.args,
78
- border: false,
79
- disabled: true
80
- }
81
- };
82
- export const WithDivInside = {
83
- render: (args) => ({
84
- components,
85
- setup: () => ({ args }),
86
- template: `
87
- <div class="flex gap-4 justify-center">
88
- <lib-button v-bind="{...args}">
89
- <div>Div inside button still has a pointer cursor.</div>
90
- </lib-button>
91
- </div>
92
- `
93
- })
94
- };
@@ -1,14 +0,0 @@
1
- import type { StoryObj } from "@storybook/vue3";
2
- import * as components from "../index.js.js";
3
- declare const meta: {
4
- component: any;
5
- title: string;
6
- args: {
7
- modelValue: boolean;
8
- label: string;
9
- };
10
- };
11
- export default meta;
12
- type Story = StoryObj<typeof components.LibCheckbox>;
13
- export declare const Primary: Story;
14
- export declare const Disabled: any;
@@ -1,29 +0,0 @@
1
- import * as components from "../index.js";
2
- const meta = {
3
- component: components.LibCheckbox,
4
- title: "Components/Checkbox",
5
- args: {
6
- modelValue: true,
7
- label: "Label"
8
- }
9
- };
10
- export default meta;
11
- export const Primary = {
12
- render: (args) => ({
13
- components,
14
- setup: () => ({ args }),
15
- template: `
16
- <lib-checkbox v-bind="args" v-model="args.modelValue"></lib-checkbox>
17
- <br>
18
- Opposite State:
19
- <br>
20
- <lib-checkbox v-bind="args" :modelValue="!args.modelValue" @update:modelValue="args.modelValue = !$event"></lib-checkbox>
21
- `
22
- })
23
- };
24
- export const Disabled = {
25
- ...Primary,
26
- args: {
27
- disabled: true
28
- }
29
- };
@@ -1,7 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibColorInput from "./LibColorInput.vue.js";
3
- declare const meta: Meta<typeof LibColorInput>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibColorInput>;
6
- export declare const Primary: Story;
7
- export declare const DoesNotAllowAlpha: Story;
@@ -1,58 +0,0 @@
1
- import { ref } from "vue";
2
- import LibColorInput from "./LibColorInput.vue";
3
- import * as components from "../index.js";
4
- const meta = {
5
- component: LibColorInput,
6
- title: "Components/ColorInput",
7
- args: {}
8
- };
9
- export default meta;
10
- export const Primary = {
11
- render: (args) => ({
12
- components,
13
- setup: () => {
14
- const color = ref({
15
- r: 0,
16
- g: 0,
17
- b: 0
18
- /* , a: 0.5 */
19
- });
20
- const handleChange = (e) => {
21
- color.value = { ...e };
22
- };
23
- return {
24
- args: {
25
- outline: false,
26
- color,
27
- allowAlpha: true,
28
- ...args
29
- },
30
- handleChange
31
- };
32
- },
33
- template: `
34
- <lib-color-Input
35
- :allowAlpha="args.allowAlpha"
36
- :modelValue="args.color.value"
37
- @update:modelValue="handleChange"
38
- >
39
- </lib-color-Input>
40
- Stretched:
41
- <div class="flex-1 flex">
42
- <lib-color-Input
43
- class="flex-1"
44
- :allowAlpha="args.allowAlpha"
45
- :modelValue="args.color.value"
46
- @update:modelValue="handleChange"
47
- >
48
- </lib-color-Input>
49
- </div>
50
- `
51
- })
52
- };
53
- export const DoesNotAllowAlpha = {
54
- ...Primary,
55
- args: {
56
- allowAlpha: false
57
- }
58
- };
@@ -1,9 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/vue3";
2
- import LibColorPicker from "./LibColorPicker.vue.js";
3
- declare const meta: Meta<typeof LibColorPicker>;
4
- export default meta;
5
- type Story = StoryObj<typeof LibColorPicker>;
6
- export declare const Primary: Story;
7
- export declare const DoesNotAllowAlpha: Story;
8
- export declare const WithExistingValue: Story;
9
- export declare const CustomStringRepresentation: Story;
@@ -1,68 +0,0 @@
1
- import Color from "colorjs.io";
2
- import { ref } from "vue";
3
- import LibColorPicker from "./LibColorPicker.vue";
4
- import * as components from "../index.js";
5
- const meta = {
6
- component: LibColorPicker,
7
- title: "Components/ColorPicker",
8
- args: {}
9
- };
10
- export default meta;
11
- export const Primary = {
12
- render: (args) => ({
13
- components,
14
- setup: () => {
15
- const color = ref({ r: 0, g: 0, b: 0, ...args.modelValue });
16
- delete args.modelValue;
17
- const handleChange = (e) => {
18
- color.value = { ...e };
19
- };
20
- return {
21
- args: {
22
- outline: false,
23
- color,
24
- allowAlpha: true,
25
- ...args
26
- },
27
- handleChange
28
- };
29
- },
30
- template: `
31
- <lib-root :outline="args.outline">
32
- {{args.color}}
33
- <lib-color-picker
34
- :modelValue="args.color.value"
35
- v-bind="args"
36
- @update:modelValue="handleChange"
37
- >
38
- </lib-color-picker>
39
- </lib-root>
40
- `
41
- })
42
- };
43
- export const DoesNotAllowAlpha = {
44
- ...Primary,
45
- args: {
46
- allowAlpha: false
47
- }
48
- };
49
- export const WithExistingValue = {
50
- ...Primary,
51
- args: {
52
- modelValue: { r: 255, g: 0, b: 0 }
53
- }
54
- };
55
- export const CustomStringRepresentation = {
56
- ...Primary,
57
- args: {
58
- allowAlpha: false,
59
- customRepresentation: {
60
- fromHsvaToString: (hsva, includeAlpha) => new Color(
61
- "hsv",
62
- [hsva.h, hsva.s, hsva.v],
63
- includeAlpha ? hsva.a : 1
64
- // this takes care of the correct hex format
65
- ).toString({ format: "hex" })
66
- }
67
- }
68
- };