@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
@@ -4,22 +4,19 @@ import { ref } from "vue"
4
4
 
5
5
  import LibPagination from "./LibPagination.vue"
6
6
 
7
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
8
7
  import * as components from "../index.js"
9
8
 
10
-
11
9
  const meta: Meta<typeof LibPagination> = {
12
10
  component: LibPagination,
13
11
  title: "Components/Pagination",
14
12
  args: {
15
- total: 10,
16
- },
13
+ total: 10
14
+ }
17
15
  }
18
16
 
19
17
  export default meta
20
18
  type Story = StoryObj<typeof LibPagination>
21
19
 
22
-
23
20
  export const Primary: Story = {
24
21
  render: args => ({
25
22
  components,
@@ -35,7 +32,7 @@ export const Primary: Story = {
35
32
  return {
36
33
  changePage,
37
34
  args,
38
- num,
35
+ num
39
36
  }
40
37
  },
41
38
  template: `
@@ -47,7 +44,6 @@ export const Primary: Story = {
47
44
  <lib-simple-input :label="'Change Page'" :modelValue="num.toString()" @update:modelValue="num = parseInt($event)" type="number" min="0" :max="args.total">
48
45
 
49
46
  </lib-simple-input>
50
- `,
51
- }),
47
+ `
48
+ })
52
49
  }
53
-
@@ -7,70 +7,78 @@
7
7
  role="navigation"
8
8
  :aria-label="t('pagination.aria')"
9
9
  >
10
- <slot v-if="prevLink.i > 0 && prevLink.i !== currentLink.i"
10
+ <slot
11
+ v-if="prevLink.i > 0 && prevLink.i !== currentLink.i"
11
12
  name="link"
12
13
  :i="prevLink.i"
13
14
  :href="prevLink.href"
14
15
  :text="t('pagination.previous-page')"
15
- :aria-label=" t('pagination.aria.go-to-previous-page',{count:prevLink.i})"
16
+ :aria-label=" t('pagination.aria.go-to-previous-page', { count: prevLink.i })"
16
17
  :class="`pagination--link ${pageClasses}`"
17
18
  >
18
19
  <a
19
20
  :class="`pagination--link ${pageClasses}`"
20
21
  :href="prevLink.href"
21
- :aria-label=" t('pagination.aria.go-to-previous-page', {count:prevLink.i})"
22
+ :aria-label=" t('pagination.aria.go-to-previous-page', { count: prevLink.i })"
22
23
  />
23
24
  </slot>
24
25
  <div class="pagination--spacer flex-1"/>
25
- <slot v-if="firstLink.i !== currentLink.i"
26
+ <slot
27
+ v-if="firstLink.i !== currentLink.i"
26
28
  name="link"
27
29
  :i="0"
28
30
  :href="firstLink.href"
29
31
  :text="firstLink.i"
30
- :aria-label="t('pagination.aria.go-to-page', {count:firstLink.i})"
32
+ :aria-label="t('pagination.aria.go-to-page', { count: firstLink.i })"
31
33
  :class="`pagination--link pagination--first-link ${pageClasses}`"
32
34
  >
33
35
  {{ firstLink.href }}
34
36
  <a
35
37
  :class="`pagination--link pagination--first-link ${pageClasses}`"
36
38
  :href="firstLink.href"
37
- :aria-label="t('pagination.aria.go-to-page', {count:firstLink.i})"
39
+ :aria-label="t('pagination.aria.go-to-page', { count: firstLink.i })"
38
40
  >
39
41
  {{ firstLink.i }}
40
42
  </a>
41
43
  </slot>
42
- <div v-if="prevLink.i - extraPages > firstLink.i" class="pagination--page-fill">
44
+ <div
45
+ v-if="prevLink.i - extraPages > firstLink.i"
46
+ class="pagination--page-fill"
47
+ >
43
48
  ...
44
49
  </div>
45
50
  <template
46
51
  v-for="entry in extraPagesPrev"
47
52
  :key="entry.i"
48
53
  >
49
- <slot name="link"
54
+ <slot
55
+ name="link"
50
56
  :class="`pagination--link ${pageClasses}`"
51
57
  :i="entry.i"
52
58
  :href="entry.href"
53
- :aria-label="t('pagination.aria.go-to-page', {count:entry.i})"
59
+ :aria-label="t('pagination.aria.go-to-page', { count: entry.i })"
54
60
  >
55
61
  <a
56
62
  :class="`pagination--link ${pageClasses}`"
57
63
  :href="entry.href"
58
- :aria-label="t('pagination.aria.go-to-page', {count:entry.i})"
64
+ :aria-label="t('pagination.aria.go-to-page', { count: entry.i })"
59
65
  >
60
66
  {{ entry.i }}
61
67
  </a>
62
68
  </slot>
63
69
  </template>
64
- <slot name="current"
70
+ <slot
71
+ name="current"
65
72
  :class="`pagination--link ${currentPageClasses}`"
66
73
  tabindex="0"
67
74
  :i="currentLink.i"
68
- :aria-label="t('pagination.aria.current-page', {count:currentLink.i})"
75
+ :aria-label="t('pagination.aria.current-page', { count: currentLink.i })"
69
76
  :aria_current="true"
70
77
  >
71
- <div :class="`pagination--current-page a ${currentPageClasses}`"
78
+ <div
79
+ :class="`pagination--current-page a ${currentPageClasses}`"
72
80
  tabindex="0"
73
- :aria-label="t('pagination.aria.current-page', {count:currentLink.i})"
81
+ :aria-label="t('pagination.aria.current-page', { count: currentLink.i })"
74
82
  aria-current="true"
75
83
  @click="$event.preventDefault()"
76
84
  >
@@ -81,36 +89,42 @@
81
89
  v-for="entry in extraPagesNext"
82
90
  :key="entry.i"
83
91
  >
84
- <slot name="link"
92
+ <slot
93
+ name="link"
85
94
  :class="`pagination--link ${pageClasses}`"
86
95
  :i="entry.i"
87
96
  :href="entry.href"
88
- :aria-label="t('pagination.aria.go-to-page', {count:entry.i})"
97
+ :aria-label="t('pagination.aria.go-to-page', { count: entry.i })"
89
98
  >
90
99
  <a
91
100
  :class="`pagination--link ${pageClasses}`"
92
101
  :href="entry.href"
93
- :aria-label="t('pagination.aria.go-to-page', {count:entry.i})"
102
+ :aria-label="t('pagination.aria.go-to-page', { count: entry.i })"
94
103
  >
95
104
  {{ entry.i }}
96
105
  </a>
97
106
  </slot>
98
107
  </template>
99
- <div v-if="nextLink.i + extraPages < total" class="pagination--page-fill" aria-hidden="true">
108
+ <div
109
+ v-if="nextLink.i + extraPages < total"
110
+ class="pagination--page-fill"
111
+ aria-hidden="true"
112
+ >
100
113
  ...
101
114
  </div>
102
- <slot v-if="lastLink.i !== currentLink.i"
115
+ <slot
116
+ v-if="lastLink.i !== currentLink.i"
103
117
  name="link"
104
118
  :class="`pagination--link ${pageClasses}`"
105
119
  :i="lastLink.i"
106
120
  :href="lastLink.href"
107
121
  :text="total"
108
- :aria-label="t('pagination.aria.go-to-page', {count:lastLink.i})"
122
+ :aria-label="t('pagination.aria.go-to-page', { count: lastLink.i })"
109
123
  >
110
124
  <a
111
125
  :class="`pagination--link ${pageClasses}`"
112
126
  :href="lastLink.href"
113
- :aria-label="t('pagination.aria.go-to-page', {count:lastLink.i})"
127
+ :aria-label="t('pagination.aria.go-to-page', { count: lastLink.i })"
114
128
  >
115
129
  {{ total }}
116
130
  </a>
@@ -123,24 +137,25 @@
123
137
  :i="nextLink.i"
124
138
  :href="nextLink.href"
125
139
  :text="t('pagination.next-page')"
126
- :aria-label="t('pagination.aria.go-to-next-page', {count:nextLink.i})"
140
+ :aria-label="t('pagination.aria.go-to-next-page', { count: nextLink.i })"
127
141
  >
128
142
  <a
129
143
  :class="`pagination--link ${pageClasses}`"
130
144
  :href="nextLink.href"
131
- :aria-label="t('pagination.aria.go-to-next-page', {count:nextLink.i})"
145
+ :aria-label="t('pagination.aria.go-to-next-page', { count: nextLink.i })"
132
146
  >
133
147
  Next
134
148
  </a>
135
149
  </slot>
136
150
  </nav>
137
151
  </template>
152
+
138
153
  <script setup lang="ts">
139
- import { computed, type HTMLAttributes,useAttrs,watch } from "vue"
154
+ import { computed, type HTMLAttributes, useAttrs, watch } from "vue"
140
155
 
141
156
  import { useInjectedI18n } from "../../composables/useInjectedI18n.js"
142
157
  import { twMerge } from "../../utils/twMerge.js"
143
- import { type TailwindClassProp } from "../shared/props.js"
158
+ import type { TailwindClassProp } from "../shared/props.js"
144
159
 
145
160
  const t = useInjectedI18n()
146
161
 
@@ -166,8 +181,8 @@ const currentPageClasses = `
166
181
  scale-125
167
182
  `
168
183
  defineOptions({
169
- name: "lib-pagination",
170
- inheritAttrs: false,
184
+ name: "LibPagination",
185
+ inheritAttrs: false
171
186
  })
172
187
 
173
188
  const props = withDefaults(defineProps<Props>(), {
@@ -178,7 +193,7 @@ const props = withDefaults(defineProps<Props>(), {
178
193
  }
179
194
  return { href: route + i.toString(), i }
180
195
  },
181
- extraPages: 3,
196
+ extraPages: 3
182
197
  })
183
198
  const $attrs = useAttrs()
184
199
 
@@ -216,10 +231,9 @@ const extraPagesNext = computed(() => [...Array(props.extraPages + 1)].map((_, i
216
231
  if (num <= firstLink.value.i || num >= lastLink.value.i || num <= currentLink.value.i) return undefined
217
232
  return props.customRoute(props.route, num)
218
233
  }).filter(entry => entry !== undefined).slice(0, props.extraPages) as HrefInfo[])
219
-
220
234
  </script>
221
- <script lang="ts">
222
235
 
236
+ <script lang="ts">
223
237
  /**
224
238
  * Pagination component.
225
239
  *
@@ -231,7 +245,7 @@ const extraPagesNext = computed(() => [...Array(props.extraPages + 1)].map((_, i
231
245
  * ```
232
246
  */
233
247
  export default {
234
- name: "lib-pagination",
248
+ name: "LibPagination"
235
249
  }
236
250
  type RealProps = {
237
251
  /** The total number of pages. */
@@ -254,7 +268,7 @@ type RealProps = {
254
268
  interface Props
255
269
  extends
256
270
  /** @vue-ignore */
257
- Partial<Omit<HTMLAttributes,"class"> & TailwindClassProp>,
271
+ Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
258
272
  RealProps
259
273
  {}
260
274
  </script>
@@ -4,29 +4,25 @@ import type { Meta, StoryObj } from "@storybook/vue3"
4
4
  import LibPalette from "./LibPalette.vue"
5
5
 
6
6
  import { theme } from "../../theme.js"
7
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
8
7
  import * as components from "../index.js"
9
8
 
10
-
11
9
  const meta: Meta<typeof LibPalette> = {
12
10
  component: LibPalette,
13
11
  title: "Components/Palette",
14
12
  args: {
15
13
  // theme,
16
- },
14
+ }
17
15
  }
18
16
 
19
17
  export default meta
20
18
  type Story = StoryObj<typeof LibPalette>
21
19
 
22
-
23
20
  export const Primary: Story = {
24
21
  render: args => ({
25
22
  components: { ...components, LibPalette },
26
23
  setup: () => ({ args: { ...args, theme } }),
27
24
  template: `
28
25
  <LibPalette v-bind="{...args}">{{args.value}}</LibPalette>
29
- `,
30
- }),
26
+ `
27
+ })
31
28
  }
32
-
@@ -2,7 +2,10 @@
2
2
  <div class="theme-palette flex h-full flex-col items-center justify-center ">
3
3
  <div class="theme-palette--container mx-auto ">
4
4
  <div class="grid grid-cols-11 gap-2 gap-y-10 px-10">
5
- <template v-for="color, i in colors" :key="color">
5
+ <template
6
+ v-for="color, i in colors"
7
+ :key="color"
8
+ >
6
9
  <div
7
10
  :style="`background-color: var(${color});`"
8
11
  :class="`theme-palette--item h-10 rounded-sm flex items-center justify-center text-fg dark:text-bg`"
@@ -23,27 +26,25 @@
23
26
  </template>
24
27
 
25
28
  <script lang="ts">
26
- export default { name: "lib-palette" }
29
+ export default { name: "LibPalette" }
27
30
  </script>
28
31
 
29
32
  <script setup lang="ts">
30
33
  import { keys } from "@alanscodelog/utils/keys"
31
- import { type Theme } from "metamorphosis"
32
-
33
- import { type BaseInteractiveProps,type LinkableByIdProps } from "../shared/props.js"
34
+ import type { Theme } from "metamorphosis"
34
35
 
36
+ import type { BaseInteractiveProps, LinkableByIdProps } from "../shared/props.js"
35
37
 
36
38
  const props = withDefaults(defineProps<
37
- & LinkableByIdProps
38
- & BaseInteractiveProps
39
- & {
40
- theme: Theme
41
- }>(), {
39
+ & LinkableByIdProps
40
+ & BaseInteractiveProps
41
+ & {
42
+ theme?: Theme
43
+ }>(), {
42
44
  theme: () => ({} as any),
43
- unstyle: false, disabled: false, readonly: false, border: true,
45
+ unstyle: false, disabled: false, readonly: false, border: true
44
46
  })
45
47
 
46
48
  const exclude = ["--color-bg", "--color-fg"]
47
49
  const colors = keys(props.theme.css).filter(key => key.startsWith("--color") && !exclude.includes(key))
48
-
49
50
  </script>
@@ -5,22 +5,19 @@ import { computed, ref, watch } from "vue"
5
5
  import LibPopup from "./LibPopup.vue"
6
6
 
7
7
  import { vExtractRootEl } from "../../directives/vExtractRootEl.js"
8
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
9
8
  import * as components from "../index.js"
10
9
 
11
-
12
10
  const meta: Meta<typeof LibPopup> = {
13
11
  component: LibPopup,
14
12
  title: "Components/Popup",
15
13
  args: {
16
14
 
17
- },
15
+ }
18
16
  }
19
17
 
20
18
  export default meta
21
19
  type Story = StoryObj<typeof LibPopup>
22
20
 
23
-
24
21
  export const Primary: Story = {
25
22
  render: args => ({
26
23
  components,
@@ -51,13 +48,12 @@ export const Primary: Story = {
51
48
  }
52
49
  })
53
50
 
54
-
55
51
  return {
56
52
  args,
57
53
  buttonPos,
58
54
  autoRotatePos,
59
55
  buttonStyle,
60
- value,
56
+ value
61
57
  }
62
58
  },
63
59
  template: `
@@ -91,22 +87,22 @@ export const Primary: Story = {
91
87
  </template>
92
88
  </lib-popup>
93
89
  </div>
94
- `,
95
- }),
90
+ `
91
+ })
96
92
  }
97
93
  export const PopupNoShift = {
98
94
  ...Primary,
99
95
  args: {
100
- avoidRepositioning: true,
101
-
96
+ avoidRepositioning: true
97
+
102
98
  }
103
99
  }
104
100
  /** When the popup is too wide, it's positioned to the left and overflow scroll is set with an invisible scrollbar. */
105
101
  export const PopupTooBig = {
106
102
  ...Primary,
107
103
  args: {
108
- width: "110vw",
109
- },
104
+ width: "110vw"
105
+ }
110
106
  }
111
107
  export const PopupCenterScreen = {
112
108
  ...Primary,
@@ -114,17 +110,17 @@ export const PopupCenterScreen = {
114
110
  width: "500px",
115
111
  height: "500px",
116
112
  preferredHorizontal: ["center-screen"],
117
- preferredVertical: ["center-screen"],
118
- },
113
+ preferredVertical: ["center-screen"]
114
+ }
119
115
  }
120
116
  export const PopupRightBottomMost = {
121
117
  ...Primary,
122
118
  args: {
123
119
  width: "500px",
124
120
  height: "500px",
125
- preferredHorizontal: [ "right-most"],
126
- preferredVertical: [ "bottom-most"],
127
- },
121
+ preferredHorizontal: ["right-most"],
122
+ preferredVertical: ["bottom-most"]
123
+ }
128
124
  }
129
125
  export const PopupLeftTopMost = {
130
126
  ...Primary,
@@ -132,8 +128,8 @@ export const PopupLeftTopMost = {
132
128
  width: "500px",
133
129
  height: "500px",
134
130
  preferredHorizontal: ["left-most"],
135
- preferredVertical: ["top-most"],
136
- },
131
+ preferredVertical: ["top-most"]
132
+ }
137
133
  }
138
134
 
139
135
  export const PopupCenterMost = {
@@ -142,8 +138,8 @@ export const PopupCenterMost = {
142
138
  width: "500px",
143
139
  height: "500px",
144
140
  preferredHorizontal: ["center-most"],
145
- preferredVertical: ["center-most"],
146
- },
141
+ preferredVertical: ["center-most"]
142
+ }
147
143
  }
148
144
  export const LeftMenuShapeExample = {
149
145
  ...Primary,
@@ -152,6 +148,6 @@ export const LeftMenuShapeExample = {
152
148
  height: "500px",
153
149
  preferredHorizontal: ["left-most"],
154
150
  preferredVertical: ["center-most"],
155
- avoidRepositioning: true,
156
- },
151
+ avoidRepositioning: true
152
+ }
157
153
  }
@@ -1,8 +1,9 @@
1
1
  <!-- Popover API WHEN :sob:
2
2
  #awaiting https://developer.mozilla.org/en-US/docs/Web/API/Popover_API#browser_compatibility -->
3
3
  <template>
4
- <slot name="button"
5
- :extract-el="(_:any)=> buttonEl = _"
4
+ <slot
5
+ name="button"
6
+ :extract-el="(_:any) => buttonEl = _"
6
7
  />
7
8
  <!-- <Transition> -->
8
9
  <component
@@ -23,12 +24,13 @@
23
24
  `,
24
25
  $attrs.class as any
25
26
  )"
26
- v-bind="{...$attrs, class:undefined}"
27
+ v-bind="{ ...$attrs, class: undefined }"
27
28
  :is="useDialogForBackdrop ? 'dialog' : 'div'"
28
29
  ref="dialogEl"
29
30
  @mousedown.self="handleMouseup"
30
31
  >
31
- <div v-if="modelValue"
32
+ <div
33
+ v-if="modelValue"
32
34
  :class="`popup z-100 fixed ${props.avoidRepositioning ? 'transition-[top,left]' : ''}`"
33
35
  :style="`
34
36
  top:${pos.y}px;
@@ -49,13 +51,13 @@
49
51
 
50
52
  <script setup lang="ts">
51
53
  // eslint-disable-next-line simple-import-sort/imports
52
- import { onMounted, nextTick, ref, useAttrs, watch , type HTMLAttributes } from "vue"
54
+ import { onMounted, ref, useAttrs, watch, type HTMLAttributes } from "vue"
53
55
  import { getFallbackId, type LinkableByIdProps, type TailwindClassProp, type PopupProps } from "../shared/props.js"
54
56
 
55
57
  import { twMerge } from "../../utils/twMerge.js"
56
58
  import { castType } from "@alanscodelog/utils/castType"
57
59
  import { isArray } from "@alanscodelog/utils/isArray"
58
- import type { IPopupReference, PopupPosition, PopupPositioner, PopupPositionModifier, SimpleDOMRect } from "../../types/index.js"
60
+ import type { IPopupReference, PopupPosition, SimpleDOMRect } from "../../types/index.js"
59
61
 
60
62
  const fallbackId = getFallbackId()
61
63
  const props = withDefaults(defineProps<Props>(), {
@@ -63,13 +65,13 @@ const props = withDefaults(defineProps<Props>(), {
63
65
  useDialogForBackdrop: false,
64
66
  // vue is getting confused when the prop type can also be a function
65
67
  preferredHorizontal: () => ["center-most", "either"] satisfies Props["preferredHorizontal"],
66
- preferredVertical: () => ["top", "bottom", "either"] satisfies Props["preferredVertical"] ,
68
+ preferredVertical: () => ["top", "bottom", "either"] satisfies Props["preferredVertical"],
67
69
  avoidRepositioning: false,
68
- canClose: true,
70
+ canClose: true
69
71
  })
70
72
  const $attrs = useAttrs()
71
73
  defineOptions({
72
- name: "lib-popup",
74
+ name: "LibPopup",
73
75
  inheritAttrs: false
74
76
  })
75
77
 
@@ -77,7 +79,6 @@ const emit = defineEmits<{
77
79
  (e: "close"): void
78
80
  }>()
79
81
 
80
-
81
82
  const dialogEl = ref<HTMLDialogElement | null>(null)
82
83
  const popupEl = ref<IPopupReference | null>(null)
83
84
  const buttonEl = ref<IPopupReference | null>(null)
@@ -87,7 +88,6 @@ const pos = ref<PopupPosition>({} as any)
87
88
  const modelValue = defineModel<boolean>({ default: false })
88
89
  let isOpen = false
89
90
 
90
-
91
91
  /**
92
92
  * We don't have access to the dialog backdrop and without extra styling, it's of 0 width/height, positioned in the center of the screen, with margins taking up all the space.
93
93
  *
@@ -101,19 +101,19 @@ const getDialogBoundingRect = (): SimpleDOMRect => ({
101
101
  top: 0,
102
102
  bottom: 0,
103
103
  left: 0,
104
- right: 0,
104
+ right: 0
105
105
  })
106
106
  let lastButtonElPos: SimpleDOMRect | undefined
107
107
  const recompute = (force: boolean = false): void => {
108
108
  requestAnimationFrame(() => {
109
109
  const horzHasCenterScreen = isArray(props.preferredHorizontal)
110
- && props.preferredHorizontal[0] === "center-screen"
110
+ && props.preferredHorizontal[0] === "center-screen"
111
111
  const vertHasCenterScreen = isArray(props.preferredVertical)
112
- && props.preferredVertical[0] === "center-screen"
113
-
114
- const canBePositionedWithoutButton =
115
- (horzHasCenterScreen || typeof props.preferredHorizontal === "function")
116
- && (vertHasCenterScreen || typeof props.preferredVertical === "function")
112
+ && props.preferredVertical[0] === "center-screen"
113
+
114
+ const canBePositionedWithoutButton
115
+ = (horzHasCenterScreen || typeof props.preferredHorizontal === "function")
116
+ && (vertHasCenterScreen || typeof props.preferredVertical === "function")
117
117
  if (!popupEl.value || !dialogEl.value || (!buttonEl.value && !canBePositionedWithoutButton)) {
118
118
  pos.value = {} as any
119
119
  return
@@ -128,7 +128,6 @@ const recompute = (force: boolean = false): void => {
128
128
 
129
129
  let finalPos: { x: number, y: number, maxWidth?: number, maxHeight?: number } = {} as any
130
130
 
131
-
132
131
  if (!force && modelValue.value && props.avoidRepositioning && buttonEl.value && lastButtonElPos) {
133
132
  const shiftX = buttonEl.value.getBoundingClientRect().x - lastButtonElPos.x
134
133
  const shiftY = buttonEl.value.getBoundingClientRect().y - lastButtonElPos.y
@@ -149,7 +148,7 @@ const recompute = (force: boolean = false): void => {
149
148
  topFromCenter: 0,
150
149
  bottomFromCenter: 0,
151
150
  top: 0,
152
- bottom: 0,
151
+ bottom: 0
153
152
  }
154
153
  if (el) {
155
154
  space.left = (el.x + el.width) - bg.x
@@ -169,7 +168,6 @@ const recompute = (force: boolean = false): void => {
169
168
  if (typeof preferredHorizontal === "function") {
170
169
  finalPos.x = preferredHorizontal(el, popup, bg, space)
171
170
  } else {
172
- /* eslint-disable no-labels */
173
171
  outerloop:
174
172
  for (const type of preferredHorizontal) {
175
173
  switch (type) {
@@ -184,8 +182,8 @@ const recompute = (force: boolean = false): void => {
184
182
  case "center-most":
185
183
  case "center":
186
184
  castType<DOMRect>(el)
187
- if (space.leftFromCenter >= (popup.width / 2) &&
188
- space.rightFromCenter >= (popup.width / 2)) {
185
+ if (space.leftFromCenter >= (popup.width / 2)
186
+ && space.rightFromCenter >= (popup.width / 2)) {
189
187
  finalPos.x = el.x + (el.width / 2) - (popup.width / 2)
190
188
  break outerloop
191
189
  }
@@ -216,7 +214,7 @@ const recompute = (force: boolean = false): void => {
216
214
  } else {
217
215
  finalPos.x = bg.x + bg.width - popup.width; break outerloop
218
216
  }
219
-
217
+
220
218
  case "right":
221
219
  castType<DOMRect>(el)
222
220
  if (space.right >= popup.width) {
@@ -284,8 +282,8 @@ const recompute = (force: boolean = false): void => {
284
282
  case "center-most":
285
283
  case "center":
286
284
  castType<DOMRect>(el)
287
- if (space.topFromCenter >= (popup.height / 2) &&
288
- space.bottomFromCenter >= (popup.height / 2)) {
285
+ if (space.topFromCenter >= (popup.height / 2)
286
+ && space.bottomFromCenter >= (popup.height / 2)) {
289
287
  finalPos.y = el.y + (el.height / 2) - (popup.height / 2)
290
288
  break outerloop
291
289
  }
@@ -313,7 +311,7 @@ const recompute = (force: boolean = false): void => {
313
311
  }
314
312
  finalPos.maxWidth = maxWidth ?? undefined
315
313
  finalPos.maxHeight = maxHeight ?? undefined
316
- /* eslint-enable no-labels */
314
+
317
315
  if (props.modifyPosition) {
318
316
  finalPos = props.modifyPosition(finalPos, el, popup, bg, space)
319
317
  }
@@ -369,7 +367,6 @@ watch([modelValue, popupEl], () => {
369
367
  }
370
368
  })
371
369
 
372
-
373
370
  const handleMouseup = ($event: MouseEvent) => {
374
371
  $event.preventDefault()
375
372
  toggle()
@@ -385,20 +382,19 @@ defineExpose({
385
382
  },
386
383
  setBackground: (el: IPopupReference | null) => {
387
384
  backgroundEl.value = el
388
- },
385
+ }
389
386
 
390
387
  })
391
-
392
388
  </script>
393
- <script lang="ts">
394
389
 
395
- type RealProps =
396
- & LinkableByIdProps
397
- & PopupProps
390
+ <script lang="ts">
391
+ type RealProps
392
+ = & LinkableByIdProps
393
+ & PopupProps
398
394
 
399
395
  interface Props
400
396
  extends
401
397
  /** @vue-ignore */
402
- Partial<Omit<HTMLAttributes,"class"> & TailwindClassProp>,
398
+ Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
403
399
  RealProps { }
404
400
  </script>