@witchcraft/ui 0.4.0 → 0.4.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 (316) hide show
  1. package/README.md +56 -61
  2. package/dist/module.d.mts +1 -1
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +13 -9
  5. package/dist/runtime/assets/animations.css +1 -1
  6. package/dist/runtime/assets/locales/en.json +2 -0
  7. package/dist/runtime/assets/utils.css +1 -1
  8. package/dist/runtime/build/WitchcraftUiResolver.js +1 -2
  9. package/dist/runtime/components/TestControls/TestControls.d.vue.ts +2 -1
  10. package/dist/runtime/components/TestControls/TestControls.vue +3 -3
  11. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +2 -1
  12. package/dist/runtime/components/WButton/WButton.d.vue.ts +34 -0
  13. package/dist/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +26 -38
  14. package/dist/runtime/components/WButton/WButton.vue.d.ts +34 -0
  15. package/dist/runtime/components/WCheckbox/WCheckbox.d.vue.ts +33 -0
  16. package/dist/runtime/components/WCheckbox/WCheckbox.vue +110 -0
  17. package/dist/runtime/components/WCheckbox/WCheckbox.vue.d.ts +33 -0
  18. package/dist/runtime/components/{LibColorInput/LibColorInput.d.vue.ts → WColorInput/WColorInput.d.vue.ts} +18 -36
  19. package/dist/runtime/components/WColorInput/WColorInput.vue +85 -0
  20. package/dist/runtime/components/{LibColorInput/LibColorInput.vue.d.ts → WColorInput/WColorInput.vue.d.ts} +18 -36
  21. package/dist/runtime/components/WColorInput/WColorSwatchButton.d.vue.ts +28 -0
  22. package/dist/runtime/components/WColorInput/WColorSwatchButton.vue +86 -0
  23. package/dist/runtime/components/WColorInput/WColorSwatchButton.vue.d.ts +28 -0
  24. package/dist/runtime/components/{LibColorPicker/LibColorPicker.d.vue.ts → WColorPicker/WColorPicker.d.vue.ts} +12 -9
  25. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +41 -29
  26. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue.d.ts → WColorPicker/WColorPicker.vue.d.ts} +12 -9
  27. package/dist/runtime/components/WCombobox/WCombobox.d.vue.ts +111 -0
  28. package/dist/runtime/components/WCombobox/WCombobox.vue +405 -0
  29. package/dist/runtime/components/WCombobox/WCombobox.vue.d.ts +111 -0
  30. package/dist/runtime/components/WCombobox/storyPlays.d.ts +18 -0
  31. package/dist/runtime/components/WCombobox/storyPlays.js +68 -0
  32. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts → WDarkModeSwitcher/WDarkModeSwitcher.d.vue.ts} +9 -13
  33. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +11 -14
  34. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts → WDarkModeSwitcher/WDarkModeSwitcher.vue.d.ts} +9 -13
  35. package/dist/runtime/components/{LibDatePicker/LibDatePicker.d.vue.ts → WDatePicker/WDatePicker.d.vue.ts} +7 -7
  36. package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  37. package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue.d.ts → WDatePicker/WDatePicker.vue.d.ts} +7 -7
  38. package/dist/runtime/components/WDatePicker/WRangeDatePicker.d.vue.ts +182 -0
  39. package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +29 -25
  40. package/dist/runtime/components/WDatePicker/WRangeDatePicker.vue.d.ts +182 -0
  41. package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.d.vue.ts → WDatePicker/WSingleDatePicker.d.vue.ts} +7 -5
  42. package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +21 -21
  43. package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue.d.ts → WDatePicker/WSingleDatePicker.vue.d.ts} +7 -5
  44. package/dist/runtime/components/WDatePicker/WTimeZonePicker.d.vue.ts +13 -0
  45. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  46. package/dist/runtime/components/WDatePicker/WTimeZonePicker.vue.d.ts +13 -0
  47. package/dist/runtime/components/{LibDebug/LibDebug.d.vue.ts → WDebug/WDebug.d.vue.ts} +3 -2
  48. package/dist/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +10 -12
  49. package/dist/runtime/components/{LibDebug/LibDebug.vue.d.ts → WDebug/WDebug.vue.d.ts} +3 -2
  50. package/dist/runtime/components/{LibDevOnly/LibDevOnly.d.vue.ts → WDevOnly/WDevOnly.d.vue.ts} +3 -5
  51. package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue.d.ts → WDevOnly/WDevOnly.vue.d.ts} +3 -5
  52. package/dist/runtime/components/WFileInput/WFileInput.d.vue.ts +58 -0
  53. package/dist/runtime/components/WFileInput/WFileInput.vue +348 -0
  54. package/dist/runtime/components/WFileInput/WFileInput.vue.d.ts +58 -0
  55. package/dist/runtime/components/WIcon/WIcon.d.vue.ts +18 -0
  56. package/dist/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +1 -1
  57. package/dist/runtime/components/WIcon/WIcon.vue.d.ts +18 -0
  58. package/dist/runtime/components/WMultiValues/WMultiValues.d.vue.ts +28 -0
  59. package/dist/runtime/components/WMultiValues/WMultiValues.vue +150 -0
  60. package/dist/runtime/components/WMultiValues/WMultiValues.vue.d.ts +28 -0
  61. package/dist/runtime/components/WNotifications/WNotification.d.vue.ts +37 -0
  62. package/dist/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +61 -35
  63. package/dist/runtime/components/WNotifications/WNotification.vue.d.ts +37 -0
  64. package/dist/runtime/components/WNotifications/WNotificationTestMessageComponent.d.vue.ts +7 -0
  65. package/dist/runtime/components/WNotifications/WNotificationTestMessageComponent.vue +29 -0
  66. package/dist/runtime/components/WNotifications/WNotificationTestMessageComponent.vue.d.ts +7 -0
  67. package/dist/runtime/components/WNotifications/WNotifications.d.vue.ts +11 -0
  68. package/dist/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +72 -36
  69. package/dist/runtime/components/WNotifications/WNotifications.vue.d.ts +11 -0
  70. package/dist/runtime/components/WNotifications/calculateNotificationProgress.d.ts +2 -0
  71. package/dist/runtime/components/WNotifications/calculateNotificationProgress.js +4 -0
  72. package/dist/runtime/components/WNumberInput/WNumberInput.d.vue.ts +27 -0
  73. package/dist/runtime/components/WNumberInput/WNumberInput.vue +96 -0
  74. package/dist/runtime/components/WNumberInput/WNumberInput.vue.d.ts +27 -0
  75. package/dist/runtime/components/WPagination/WPagination.d.vue.ts +59 -0
  76. package/dist/runtime/components/WPagination/WPagination.vue +182 -0
  77. package/dist/runtime/components/WPagination/WPagination.vue.d.ts +59 -0
  78. package/dist/runtime/components/WPalette/WPalette.d.vue.ts +11 -0
  79. package/dist/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  80. package/dist/runtime/components/WPalette/WPalette.vue.d.ts +11 -0
  81. package/dist/runtime/components/WPopover/WPopover.d.vue.ts +45 -0
  82. package/dist/runtime/components/WPopover/WPopover.vue +144 -0
  83. package/dist/runtime/components/WPopover/WPopover.vue.d.ts +45 -0
  84. package/dist/runtime/components/WPopup/WPopup.d.vue.ts +51 -0
  85. package/dist/runtime/components/WPopup/WPopup.vue +115 -0
  86. package/dist/runtime/components/WPopup/WPopup.vue.d.ts +51 -0
  87. package/dist/runtime/components/{LibProgressBar/LibProgressBar.d.vue.ts → WProgressBar/WProgressBar.d.vue.ts} +13 -16
  88. package/dist/runtime/components/WProgressBar/WProgressBar.vue +150 -0
  89. package/dist/runtime/components/{LibProgressBar/LibProgressBar.vue.d.ts → WProgressBar/WProgressBar.vue.d.ts} +13 -16
  90. package/dist/runtime/components/{LibRecorder/LibRecorder.d.vue.ts → WRecorder/WRecorder.d.vue.ts} +13 -27
  91. package/dist/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +37 -36
  92. package/dist/runtime/components/{LibRecorder/LibRecorder.vue.d.ts → WRecorder/WRecorder.vue.d.ts} +13 -27
  93. package/dist/runtime/components/{LibRoot/LibRoot.d.vue.ts → WRoot/WRoot.d.vue.ts} +11 -9
  94. package/dist/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +17 -15
  95. package/dist/runtime/components/{LibRoot/LibRoot.vue.d.ts → WRoot/WRoot.vue.d.ts} +11 -9
  96. package/dist/runtime/components/WSimpleInput/WSimpleInput.d.vue.ts +34 -0
  97. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +14 -24
  98. package/dist/runtime/components/WSimpleInput/WSimpleInput.vue.d.ts +34 -0
  99. package/dist/runtime/components/WTable/WTable.d.vue.ts +102 -0
  100. package/dist/runtime/components/WTable/WTable.vue +370 -0
  101. package/dist/runtime/components/WTable/WTable.vue.d.ts +102 -0
  102. package/dist/runtime/components/WTooltip/WTooltip.d.vue.ts +40 -0
  103. package/dist/runtime/components/WTooltip/WTooltip.vue +112 -0
  104. package/dist/runtime/components/WTooltip/WTooltip.vue.d.ts +40 -0
  105. package/dist/runtime/components/index.d.ts +20 -20
  106. package/dist/runtime/components/index.js +20 -20
  107. package/dist/runtime/composables/index.d.ts +4 -4
  108. package/dist/runtime/composables/index.js +4 -4
  109. package/dist/runtime/composables/useDelayedLoadingIndicator.d.ts +9 -0
  110. package/dist/runtime/composables/useDelayedLoadingIndicator.js +18 -0
  111. package/dist/runtime/composables/useDisplayForReka.d.ts +25 -0
  112. package/dist/runtime/composables/useDisplayForReka.js +16 -0
  113. package/dist/runtime/composables/useFallbackId.d.ts +3 -0
  114. package/dist/runtime/composables/useFallbackId.js +5 -0
  115. package/dist/runtime/composables/useInjectedDarkMode.d.ts +1 -1
  116. package/dist/runtime/composables/usePopupConstrainToStyle.d.ts +8 -0
  117. package/dist/runtime/composables/usePopupConstrainToStyle.js +8 -0
  118. package/dist/runtime/composables/useSetupDarkMode.d.ts +2 -3
  119. package/dist/runtime/composables/useSetupDarkMode.js +90 -4
  120. package/dist/runtime/composables/useTimeConditionally.d.ts +16 -0
  121. package/dist/runtime/composables/useTimeConditionally.js +27 -0
  122. package/dist/runtime/directives/vResizableCols.js +101 -34
  123. package/dist/runtime/helpers/NotificationHandler.d.ts +28 -3
  124. package/dist/runtime/helpers/NotificationHandler.js +7 -10
  125. package/dist/runtime/injectionKeys.d.ts +1 -5
  126. package/dist/runtime/injectionKeys.js +0 -2
  127. package/dist/runtime/types/index.d.ts +97 -31
  128. package/dist/runtime/types/index.js +1 -0
  129. package/dist/runtime/utils/notifyIfError.d.ts +3 -1
  130. package/dist/runtime/utils/notifyIfError.js +4 -2
  131. package/dist/runtime/utils/twMerge.d.ts +1 -0
  132. package/dist/runtime/utils/twMerge.js +2 -1
  133. package/package.json +59 -56
  134. package/src/module.ts +16 -8
  135. package/src/runtime/assets/animations.css +53 -6
  136. package/src/runtime/assets/locales/en.json +2 -0
  137. package/src/runtime/assets/tailwind.css +1 -1
  138. package/src/runtime/assets/utils.css +52 -4
  139. package/src/runtime/build/WitchcraftUiResolver.ts +1 -2
  140. package/src/runtime/components/TestControls/TestControls.vue +3 -3
  141. package/src/runtime/components/WButton/WButton.stories.ts +112 -0
  142. package/src/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +34 -50
  143. package/src/runtime/components/{LibCheckbox/LibCheckbox.stories.ts → WCheckbox/WCheckbox.stories.ts} +5 -5
  144. package/src/runtime/components/WCheckbox/WCheckbox.vue +125 -0
  145. package/src/runtime/components/{LibColorInput/LibColorInput.stories.ts → WColorInput/WColorInput.stories.ts} +8 -8
  146. package/src/runtime/components/WColorInput/WColorInput.vue +112 -0
  147. package/src/runtime/components/WColorInput/WColorSwatchButton.vue +102 -0
  148. package/src/runtime/components/{LibColorPicker/LibColorPicker.stories.ts → WColorPicker/WColorPicker.stories.ts} +12 -12
  149. package/src/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +44 -31
  150. package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
  151. package/src/runtime/components/WCombobox/WCombobox.vue +450 -0
  152. package/src/runtime/components/WCombobox/storyPlays.ts +92 -0
  153. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts → WDarkModeSwitcher/WDarkModeSwitcher.stories.ts} +6 -6
  154. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +19 -30
  155. package/src/runtime/components/{LibDatePicker/LibDatePicker.stories.ts → WDatePicker/WDatePicker.stories.ts} +42 -34
  156. package/src/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  157. package/src/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +29 -25
  158. package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +21 -21
  159. package/src/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  160. package/src/runtime/components/{LibDebug/LibDebug.stories.ts → WDebug/WDebug.stories.ts} +5 -5
  161. package/src/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +9 -10
  162. package/src/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -4
  163. package/src/runtime/components/{LibFileInput/LibFileInput.stories.ts → WFileInput/WFileInput.stories.ts} +20 -10
  164. package/src/runtime/components/WFileInput/WFileInput.vue +392 -0
  165. package/src/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +5 -8
  166. package/src/runtime/components/{LibMultiValues/LibMultiValues.stories.ts → WMultiValues/WMultiValues.stories.ts} +9 -9
  167. package/src/runtime/components/WMultiValues/WMultiValues.vue +163 -0
  168. package/src/runtime/components/{LibNotifications/LibNotification.stories.ts → WNotifications/WNotification.stories.ts} +42 -6
  169. package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +72 -45
  170. package/src/runtime/components/WNotifications/WNotificationTestMessageComponent.vue +27 -0
  171. package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
  172. package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +87 -47
  173. package/src/runtime/components/WNotifications/calculateNotificationProgress.ts +8 -0
  174. package/src/runtime/components/WNumberInput/WNumberInput.vue +109 -0
  175. package/src/runtime/components/WPagination/WPagination.stories.ts +51 -0
  176. package/src/runtime/components/WPagination/WPagination.vue +207 -0
  177. package/src/runtime/components/{LibPalette/LibPalette.stories.ts → WPalette/WPalette.stories.ts} +6 -6
  178. package/src/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  179. package/src/runtime/components/WPopover/WPopover.stories.ts +218 -0
  180. package/src/runtime/components/WPopover/WPopover.vue +168 -0
  181. package/src/runtime/components/WPopup/WPopup.stories.ts +104 -0
  182. package/src/runtime/components/WPopup/WPopup.vue +134 -0
  183. package/src/runtime/components/WProgressBar/WProgressBar.stories.ts +119 -0
  184. package/src/runtime/components/WProgressBar/WProgressBar.vue +185 -0
  185. package/src/runtime/components/{LibRecorder/LibRecorder.stories.ts → WRecorder/WRecorder.stories.ts} +9 -6
  186. package/src/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +69 -68
  187. package/src/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +18 -15
  188. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.stories.ts → WSimpleInput/WSimpleInput.stories.ts} +11 -12
  189. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +28 -42
  190. package/src/runtime/components/WTable/WTable.stories.ts +334 -0
  191. package/src/runtime/components/WTable/WTable.vue +471 -0
  192. package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
  193. package/src/runtime/components/WTooltip/WTooltip.vue +128 -0
  194. package/src/runtime/components/index.ts +20 -20
  195. package/src/runtime/composables/index.ts +4 -4
  196. package/src/runtime/composables/useDelayedLoadingIndicator.ts +30 -0
  197. package/src/runtime/composables/useDisplayForReka.ts +37 -0
  198. package/src/runtime/composables/useFallbackId.ts +6 -0
  199. package/src/runtime/composables/useInjectedDarkMode.ts +1 -2
  200. package/src/runtime/composables/usePopupConstrainToStyle.ts +29 -0
  201. package/src/runtime/composables/useSetupDarkMode.ts +122 -4
  202. package/src/runtime/composables/useTimeConditionally.ts +51 -0
  203. package/src/runtime/directives/vResizableCols.ts +121 -38
  204. package/src/runtime/helpers/NotificationHandler.ts +30 -11
  205. package/src/runtime/injectionKeys.ts +1 -7
  206. package/src/runtime/types/index.ts +118 -36
  207. package/src/runtime/utils/notifyIfError.ts +6 -2
  208. package/src/runtime/utils/twMerge.ts +2 -1
  209. package/types/components.d.ts +14 -15
  210. package/dist/runtime/components/Aria/Aria.d.vue.ts +0 -5
  211. package/dist/runtime/components/Aria/Aria.vue +0 -16
  212. package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -5
  213. package/dist/runtime/components/Icon/Icon.d.vue.ts +0 -21
  214. package/dist/runtime/components/Icon/Icon.vue.d.ts +0 -21
  215. package/dist/runtime/components/LibButton/LibButton.d.vue.ts +0 -36
  216. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -36
  217. package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +0 -42
  218. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +0 -103
  219. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -42
  220. package/dist/runtime/components/LibColorInput/LibColorInput.vue +0 -162
  221. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.d.vue.ts +0 -34
  222. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +0 -34
  223. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.d.vue.ts +0 -22
  224. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +0 -22
  225. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +0 -43
  226. package/dist/runtime/components/LibFileInput/LibFileInput.vue +0 -274
  227. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -43
  228. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +0 -165
  229. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -387
  230. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -165
  231. package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +0 -26
  232. package/dist/runtime/components/LibLabel/LibLabel.vue +0 -45
  233. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -26
  234. package/dist/runtime/components/LibMultiValues/LibMultiValues.d.vue.ts +0 -29
  235. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +0 -109
  236. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +0 -29
  237. package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +0 -30
  238. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -30
  239. package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +0 -13
  240. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -13
  241. package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +0 -104
  242. package/dist/runtime/components/LibPagination/LibPagination.vue +0 -229
  243. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -104
  244. package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +0 -14
  245. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -14
  246. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +0 -46
  247. package/dist/runtime/components/LibPopup/LibPopup.vue +0 -365
  248. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -46
  249. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +0 -169
  250. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.d.vue.ts +0 -35
  251. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +0 -35
  252. package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +0 -94
  253. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +0 -178
  254. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -94
  255. package/dist/runtime/components/LibTable/LibTable.d.vue.ts +0 -45
  256. package/dist/runtime/components/LibTable/LibTable.vue +0 -155
  257. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -45
  258. package/dist/runtime/components/Template/NAME.d.vue.ts +0 -17
  259. package/dist/runtime/components/Template/NAME.vue +0 -27
  260. package/dist/runtime/components/Template/NAME.vue.d.ts +0 -17
  261. package/dist/runtime/components/Template/TemplateStory.d.ts +0 -7
  262. package/dist/runtime/components/Template/TemplateStory.js +0 -22
  263. package/dist/runtime/components/shared/props.d.ts +0 -171
  264. package/dist/runtime/components/shared/props.js +0 -2
  265. package/dist/runtime/composables/useAriaLabel.d.ts +0 -6
  266. package/dist/runtime/composables/useAriaLabel.js +0 -15
  267. package/dist/runtime/composables/useDarkMode.d.ts +0 -77
  268. package/dist/runtime/composables/useDarkMode.js +0 -89
  269. package/dist/runtime/composables/useDivideAttrs.d.ts +0 -27
  270. package/dist/runtime/composables/useDivideAttrs.js +0 -27
  271. package/dist/runtime/composables/useSuggestions.d.ts +0 -40
  272. package/dist/runtime/composables/useSuggestions.js +0 -263
  273. package/src/runtime/components/Aria/Aria.vue +0 -26
  274. package/src/runtime/components/LibButton/LibButton.stories.ts +0 -106
  275. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -129
  276. package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -203
  277. package/src/runtime/components/LibFileInput/LibFileInput.vue +0 -320
  278. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +0 -405
  279. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -414
  280. package/src/runtime/components/LibLabel/LibLabel.stories.ts +0 -33
  281. package/src/runtime/components/LibLabel/LibLabel.vue +0 -65
  282. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -123
  283. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +0 -120
  284. package/src/runtime/components/LibPagination/LibPagination.stories.ts +0 -49
  285. package/src/runtime/components/LibPagination/LibPagination.vue +0 -274
  286. package/src/runtime/components/LibPopup/LibPopup.stories.ts +0 -153
  287. package/src/runtime/components/LibPopup/LibPopup.vue +0 -396
  288. package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +0 -90
  289. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -197
  290. package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +0 -134
  291. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -212
  292. package/src/runtime/components/LibTable/LibTable.stories.ts +0 -167
  293. package/src/runtime/components/LibTable/LibTable.vue +0 -190
  294. package/src/runtime/components/Template/NAME.vue +0 -49
  295. package/src/runtime/components/Template/TemplateStory.ts +0 -37
  296. package/src/runtime/components/shared/props.ts +0 -199
  297. package/src/runtime/composables/useAriaLabel.ts +0 -23
  298. package/src/runtime/composables/useDarkMode.ts +0 -199
  299. package/src/runtime/composables/useDivideAttrs.ts +0 -53
  300. package/src/runtime/composables/useSuggestions.ts +0 -339
  301. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.d.ts +0 -0
  302. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.js +0 -0
  303. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.d.ts +0 -0
  304. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.js +0 -0
  305. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.d.ts +0 -0
  306. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.js +0 -0
  307. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.d.ts +0 -0
  308. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.js +0 -0
  309. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.d.ts +0 -0
  310. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.js +0 -0
  311. /package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -0
  312. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.ts +0 -0
  313. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.ts +0 -0
  314. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.ts +0 -0
  315. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.ts +0 -0
  316. /package/src/runtime/components/{LibDatePicker → WDatePicker}/helpers.ts +0 -0
@@ -1,49 +0,0 @@
1
- <!-- eslint-disable -->
2
- <template>
3
- <div :class="twMerge(`
4
-
5
- `, ($attrs as any).class)"
6
- v-bind="{...$attrs, class:undefined}"
7
- >
8
- <slot/>
9
- </div>
10
- </template>
11
-
12
- <script setup lang="ts">
13
- // remove when copying
14
- // @ts-nocheck this is a templatek
15
- /* eslint-disable */
16
-
17
- import { type HTMLAttributes, ref } from "vue"
18
-
19
- import { twMerge } from "../../utils/twMerge.js"
20
- import type { TailwindClassProp } from "../shared/props.js"
21
-
22
- defineOptions({
23
- name: "LibName", /* todo */
24
- inheritAttrs: false
25
- })
26
-
27
- // const props = defineProps<{}>({ })
28
-
29
- const el = ref<null | HTMLElement>(null)
30
-
31
- const modelValue = defineModel<string>({ required: true })
32
- </script>
33
-
34
- <script lang="ts">
35
- export default {
36
- name: "LibName"
37
- }
38
-
39
- type RealProps = {
40
- }
41
-
42
- interface Props
43
- extends
44
- /** @vue-ignore */
45
- Partial<Omit<HTMLAttributes, "class">
46
- & TailwindClassProp
47
- & RealProps
48
- > { }
49
- </script>
@@ -1,37 +0,0 @@
1
- // remove when copying
2
- // @ts-nocheck this is a templatek
3
- /* eslint-disable */
4
-
5
- /* eslint-disable @typescript-eslint/naming-convention */
6
- import type { Meta, StoryObj } from "@storybook/vue3"
7
-
8
- import NAME from "./NAME.vue"
9
-
10
- // todo, maybe don't do this for perf reasons
11
- import * as components from "../index.js"
12
-
13
- const meta: Meta<typeof NAME> = {
14
- component: NAME,
15
- args: {
16
-
17
- }
18
- }
19
-
20
- export default meta
21
- type Story = StoryObj<typeof NAME>
22
-
23
- export const Primary: Story = {
24
- render: args => ({
25
- components,
26
- setup: () => ({ args }),
27
- template: `
28
- <NAME v-bind="{...args}">{{args.value}}</NAME>
29
- `
30
- })
31
- }
32
- export const Secondary: Story = {
33
- ...Primary,
34
- args: {
35
- ...Primary.args
36
- }
37
- }
@@ -1,199 +0,0 @@
1
- import { useId } from "vue"
2
-
3
- import type { PopupPositioner, PopupPositionModifier } from "../../types"
4
-
5
- export interface LinkableByIdProps {
6
- /**
7
- * The id for the input. Uses vue's useId if none provided.
8
- *
9
- * For components that are not inputs, the id passed to inputs should be shared with the corresponding label/suggestions/etc component to connect them.
10
- */
11
-
12
- id?: string
13
- }
14
-
15
- export const getFallbackId = (): string => useId()
16
- export interface ButtonProps {
17
- border?: boolean
18
- color?: "warning" | "ok" | "danger" | "primary" | "secondary" | false
19
- autoTitleFromAria?: boolean
20
- }
21
-
22
- export interface LabelProps {
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`. */
24
- label?: string
25
- }
26
-
27
- export type SuggestionsProps<T = any> = {
28
- /**
29
- * A list of autocomplete suggestions. Can be a simple list of strings, or more complicated, like a list of objects. In the case of objects, you'll want to specify `suggestionsLabel`.
30
- *
31
- * Each item is passed to the suggestion slot via the `items` prop. You can access it like:
32
- * ```
33
- * <div #item={item}>
34
- * {{item}}
35
- * </div>
36
- * ```
37
- */
38
- suggestions?: T[]
39
- /** A function that specifies how to extract the label from a suggestion when it's an object, e.g. `(item) => item.label`. By default, if none is passed, it's assumed suggestions is a list of strings. */
40
- suggestionLabel?: (item: T) => string
41
- /**
42
- * Whether to restrict the value to the suggestions list or merely use it to suggest values. Default is false.
43
- *
44
- * This stops v-modeling of what the user is typing when there is a value that does not match any values in the suggestions list. `update:modelValue` will only be emitted when they type/select/click a valid option.
45
- *
46
- * When the input is partially valid (it partially matches an option in the suggestions list), if the user presses enter or focuses away, the last selected suggestion is set as the value.
47
- *
48
- * When the input is completely invalid, the `errored` class is added to the component and the input goes red. If the user focuses away or tries to press enter anyways, the value is reset to the last valid value.
49
- *
50
- * Additionally when the input is invalid, the user can open the dropdown menu (it won't auto open) to view all the suggestions.
51
- */
52
- restrictToSuggestions?: boolean
53
- /**
54
- * Usually when using autosuggest, we only want to update the modelValue when the user submits the input.
55
- * This happens by default if using `restrictToSuggestions`, but not if not restricting them.
56
- *
57
- * This can be worked around by listening a bit differently to events, but this is a common use case so there's now an option that automatically does this.
58
- *
59
- * By default it's false.
60
- */
61
- updateOnlyOnSubmit?: boolean
62
- /** A function to filter the suggestions based on the current input. If none is given, will attempt to filter by the label using a basic case insensitive `includes` search. */
63
- suggestionsFilter?: (input: string | number, items: T[]) => any[]
64
- /** Allows opening the input dropdown when it's empty. Default is true. */
65
- allowOpenEmpty?: boolean
66
- /** Whether the suggestions dropdown can be opened. Default is true. */
67
- canOpen?: boolean
68
- /** Whether the suggestions dropdown can be closed. Default is true. */
69
- canClose?: boolean
70
- /** Whether the input is valid. Default is true. */
71
- isValid?: boolean
72
- /**
73
- * A function to determine which selection to auto select. By default, the start of the string must match and the longest match is used. If the input is 0 length, the first element is selected.
74
- *
75
- * You can implement custom behavior here like fuzzy matching. Note that an exactly matching selection is always picked (the function will not be called).
76
- */
77
- suggestionSelector?: (suggestions: T[], input: string) => number
78
- /** In the case modelValue is an array of values, whether to show the selected values in the suggestions list. Default is true so users can deselect from the list as well. If false, the checkboxes will also not be shown. */
79
- showSelectedValues?: boolean
80
- }
81
- export type SuggestionsOptions<T> = SuggestionsProps<T>
82
-
83
- export interface SuggestionsEmits<TMultivalue extends boolean = false> {
84
- (e: "submit", val: string, suggestion?: any, wasRemoved?: boolean): void
85
- (e: "update:isOpen", val: boolean): void
86
- (e: "update:activeSuggestion", val: TMultivalue extends true ? number[] : number): void
87
- }
88
-
89
- export interface PopupProps {
90
- /**
91
- * Whether to use the dialog element instead of a regular backdrop. While using the dialog element would be ideal, css variables won't be applied to it, tailwind themes will fail, etc, if the css variables are not applied to `::backdrop`.
92
- *
93
- * Using a div ends up easier to setup.
94
- *
95
- * The default is now false.
96
- */
97
- useDialogForBackdrop?: false
98
- /** Wether to use a backdrop (clicking it will close the popup), or not (use is allowed to click elsewhere. */
99
- useBackdrop?: boolean
100
- /**
101
- * The preferred horizontal positioning of the popup. The first position in the array to fit is used.
102
- *
103
- * All elements need to have box-sizing: border-box set. Also note that while the component should work with dynamic popup sizes, in practice there's issues with the positioning being slightly off. Giving the popup element a static size is better. If you need margins around the popup, this can be done with a wrapper element + padding.
104
- *
105
- * The positions `right`/`left`/`top`/`bottom` are relative to the opposite side of the button element so as to try not to cover the triggering button.
106
- *
107
- * So positioning `right` and `left` look like this:
108
- *
109
- * ```
110
- * // right
111
- * [button]
112
- * [----popup----]
113
- *
114
- * // left
115
- * [button]
116
- * [----popup----]
117
- * ```
118
- *
119
- * Positions `*-most` try to position the popup as close to that side of the screen as possible, otherwise limiting the popup to that edge. For example:
120
- *
121
- * ```
122
- * [--------------screen---------------]
123
- * // right-most
124
- * [button]
125
- * [----popup----]
126
- * // near the edge:
127
- * [button]
128
- * [----popup----]
129
- * ```
130
- *
131
- * There is also the `center-screen` position, which centers the popup on the screen.
132
- *
133
- * These last two (`*-most` and `center-screen`) are greedy, they will always find a position that fits. Positions listed after are ignored.
134
- *
135
- * You can also specify a function instead which is given some additional information regarding the space around the button reference element. It should a number for the x position (or y, if preferredVertical).
136
- *
137
- * If you only need to slightly modify the position, you can use the `modifyPosition` option instead.
138
- */
139
- preferredHorizontal?: ("center" | "right" | "left" | "either" | "center-screen" | "right-most" | "left-most" | "center-most")[] | PopupPositioner
140
- /** See `preferredHorizontal`. */
141
- preferredVertical?: ("top" | "bottom" | "center" | "either" | "center-screen" | "top-most" | "bottom-most" | "center-most")[] | PopupPositioner
142
- /**
143
- * When the user scrolls or resizes, normally the entire popup position is recomputed, taking into account the preferred positioning.
144
- *
145
- * This can cause it to shift around.
146
- *
147
- * Set this to true to only shift the popup depending on how much the button element moved and avoid recalculating the best position.
148
- */
149
- avoidRepositioning?: boolean
150
- /**
151
- * Allows modifying the calculated position, to for example, clamp it.
152
- */
153
- modifyPosition?: PopupPositionModifier
154
- canClose?: boolean
155
- }
156
-
157
- export type BaseInteractiveProps = {
158
- /** Default is false. */
159
- disabled?: boolean
160
- /** Default is false. */
161
- readonly?: boolean
162
- /** Default is true. */
163
- border?: boolean
164
- /** Removes styles from the component. Default is false. */
165
- unstyle?: boolean
166
- }
167
-
168
- // see https://github.com/nuxt/module-builder/issues/649
169
- // export const baseInteractivePropsDefaults = {
170
- // disabled: false,
171
- // readonly: false,
172
- // border: true,
173
- // unstyle: false,
174
- // }
175
-
176
- /**
177
- * @internal
178
- * For easily typing attributes created by useDivideAttrs. See readme.
179
- *
180
- * By default overrides the `class` prop to only take a string (to pass to tailwing).
181
- */
182
- export type WrapperProps<TPrefix extends string, T, TOverrides extends Record<string, any> | never = TailwindClassProp> = {
183
- [P in keyof T as P extends keyof TOverrides
184
- ? never
185
- : P extends string
186
- ? `${TPrefix}${Capitalize<P>}`
187
- : never
188
- ]: T[P];
189
- } & {
190
- [P in keyof TOverrides as P extends string
191
- ? `${TPrefix}${Capitalize<P>}`
192
- : never
193
- ]: TOverrides[P];
194
- }
195
-
196
- export type TailwindClassProp = {
197
- /** Tailwind classes. */
198
- class?: string | false
199
- }
@@ -1,23 +0,0 @@
1
- import { computed, type ComputedRef, onMounted, ref } from "vue"
2
-
3
- /** Returns a computed ref that creates aria-label and aria-labelledby with the correct id for labelledby. */
4
- export const useAriaLabel = (
5
- props: { id?: string, label?: string },
6
- fallbackId?: string
7
-
8
- ): ComputedRef<Record<string, string | undefined>> => {
9
- const id = computed(() => props.id ?? fallbackId)
10
- const labelExists = ref(false)
11
-
12
- const aria = computed(() => ({
13
- "aria-label": labelExists.value ? undefined : props.label,
14
- "aria-labelledby": labelExists.value ? `label-${id.value}` : undefined
15
- }))
16
-
17
- onMounted(() => {
18
- if (id.value && document.querySelector(`#label-${id.value}`)) {
19
- labelExists.value = true
20
- }
21
- })
22
- return aria
23
- }
@@ -1,199 +0,0 @@
1
- import { computed, nextTick, onMounted, provide, type Ref, ref, watch } from "vue"
2
-
3
- import { darkModeCommandsInjectionKey, darkModeStateInjectionKey, isDarkModeInjectionKey, manualDarkModeInjectionKey } from "../injectionKeys.js"
4
-
5
- const defaultLocalStorageKey = "prefersColorSchemeDark"
6
- const defaultOrder = ["system", "dark", "light"] as const
7
-
8
- /**
9
- * @deprecated Use `useSetupDarkMode` instead.
10
- *
11
- * A composable for setting up dark mode that automatically takes care of saving the user's preference.
12
- *
13
- * See the returned utilities for more details.
14
- *
15
- * It also provides injection keys with a ref so it can be accessed in deep nested components if needed. Alternatively you can use `useInjectedDarkMode` for ease of use.
16
- *
17
- * Note that this should only be called once at the root of the app.
18
- */
19
- export const useDarkMode = ({
20
- useLocalStorage = true,
21
- darkModeOrder = defaultOrder,
22
-
23
- isClientSide = true,
24
- useViewTransition = true
25
- }: DarkModeOptions = {}): DarkModeState & DarkModeCommands => {
26
- const systemDarkMode = ref(false)
27
- const manualDarkMode = ref<boolean | undefined>(undefined)
28
-
29
- if (useLocalStorage && isClientSide) {
30
- watch(manualDarkMode, () => {
31
- localStorage.setItem(defaultLocalStorageKey, manualDarkMode.value ? "true" : "false")
32
- })
33
- }
34
-
35
- const darkMode = computed(() => manualDarkMode.value ?? systemDarkMode.value)
36
- const darkModeState = computed(() =>
37
- manualDarkMode.value === undefined
38
- ? "system"
39
- : manualDarkMode.value
40
- ? "dark"
41
- : "light"
42
- )
43
- // todo move to useinjected
44
- function setDarkMode(value: "dark" | "light" | "system"): void {
45
- manualDarkMode.value
46
- = value === "dark"
47
- ? true
48
- : value === "light"
49
- ? false
50
- : undefined
51
- }
52
-
53
- function getNextValue(): "dark" | "light" | "system" {
54
- const index = darkModeOrder.indexOf(darkModeState.value)
55
-
56
- return index === 2
57
- ? darkModeOrder[0]!
58
- : darkModeOrder[index + 1]!
59
- }
60
-
61
- function _cycleDarkMode(): void {
62
- setDarkMode(getNextValue())
63
- }
64
-
65
- function cycleDarkMode(): void {
66
- if (!useViewTransition) {
67
- _cycleDarkMode()
68
- return
69
- }
70
- const nextValue = getNextValue()
71
- const index = darkModeOrder.indexOf(darkModeState.value)
72
- const systemDarkModeName = systemDarkMode.value ? "dark" : "light"
73
-
74
- if (nextValue === "system" && systemDarkModeName === darkModeOrder[index]) {
75
- // don't do view transitions if we're not really transitioning
76
- _cycleDarkMode()
77
- return
78
- }
79
- if (!document.startViewTransition) _cycleDarkMode()
80
- document.startViewTransition(async () => {
81
- _cycleDarkMode()
82
- await nextTick()
83
- })
84
- }
85
-
86
- onMounted(() => {
87
- window.matchMedia("(prefers-color-scheme: dark)")
88
- .addEventListener("change", ({ matches }) => {
89
- if (matches) {
90
- systemDarkMode.value = true
91
- } else {
92
- systemDarkMode.value = false
93
- }
94
- })
95
- if (useLocalStorage !== false) {
96
- const key = typeof useLocalStorage === "string" ? useLocalStorage : defaultLocalStorageKey
97
- const value = localStorage.getItem(key)
98
-
99
- if (value === "true") {
100
- manualDarkMode.value = true
101
- } else if (value === "false") {
102
- manualDarkMode.value = false
103
- }
104
- }
105
- })
106
- provide(isDarkModeInjectionKey, darkMode)
107
- provide(manualDarkModeInjectionKey, manualDarkMode)
108
-
109
- provide(darkModeStateInjectionKey, {
110
- darkMode,
111
- darkModeState,
112
- manualDarkMode,
113
- systemDarkMode
114
- })
115
- provide(darkModeCommandsInjectionKey, {
116
- setDarkMode,
117
- cycleDarkMode
118
- })
119
-
120
- return {
121
- darkMode,
122
- darkModeState,
123
- setDarkMode,
124
- cycleDarkMode,
125
- manualDarkMode,
126
- systemDarkMode
127
- }
128
- }
129
- export const defaultDarkModeOrder = defaultOrder
130
-
131
-
132
- export type DarkModeOptions = {
133
- /* 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. */
134
- useLocalStorage?: boolean | string
135
- /* The order of the string dark modes when using `cycleDarkMode`. Defaults to `["system", "dark", "light"]` */
136
- darkModeOrder?: readonly ("system" | "dark" | "light")[]
137
- /** True by default, should be passed import.meta.client if using nuxt, or false when running server side. */
138
- isClientSide?: boolean
139
- /**
140
- * Whether to use the view transition to animate the dark mode switch (you just need to add the css).
141
- *
142
- * Note that the transitition is NOT triggered if visually the mode does not change (e.g. system mode is dark and the user switches from system to dark, visually nothing changes so transitioning is skipped).
143
- *
144
- * There is an example in storybook. But basically:
145
- *
146
- * ```css
147
- *
148
- * #root { // the dark mode switcher works on the WRoot component not the html root
149
- * view-transition-name: wroot;
150
- * height: 100dvh;
151
- * padding: 0;
152
- * }
153
- *
154
- * ::view-transition-new(wroot) {
155
- * animation: grow var(--story-anim-length) ease-in-out;
156
- * animation-fill-mode: both;
157
- * z-index: 2;
158
- * mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><circle cx="20" cy="20" r="20" fill="white"/></svg>') center / 0 no-repeat;
159
- * }
160
- *
161
- * ::view-transition-old(wroot) {
162
- * animation: none;
163
- * animation-fill-mode: both;
164
- * z-index: 1;
165
- * }
166
- *
167
- * @keyframes grow {
168
- * from {
169
- * mask-size: 0dvw;
170
- * }
171
- * to {
172
- * mask-size: 300dvw;
173
- * }
174
- * }
175
- * ```
176
- *
177
- * See https://theme-toggle.rdsx.dev/ for more ideas.
178
- *
179
- * @default true
180
- */
181
- useViewTransition?: boolean
182
- }
183
-
184
- export interface DarkModeCommands {
185
- setDarkMode: (value: "dark" | "light" | "system") => void
186
- cycleDarkMode: () => void
187
- }
188
-
189
- export interface DarkModeState {
190
- /** Whether the dark mode should be enabled or not */
191
- darkMode: Ref<boolean>
192
- /** The current state of the darkMode but as a string (dark, light, system) */
193
- darkModeState: Ref<"dark" | "light" | "system">
194
- /** The value of the manuably controllable dark mode. You can set this to true/false or undefined to allow the systemDarkMode to take priority. Alternatively use setDarkMode instead. */
195
- manualDarkMode: Ref<boolean | undefined>
196
- /** The value of the system dark mode. This is automatically set depending on the user's `prefer-color-scheme` and should not be set directly. */
197
- systemDarkMode: Ref<boolean>
198
-
199
- }
@@ -1,53 +0,0 @@
1
- import { keys } from "@alanscodelog/utils/keys"
2
- import { computed, type Ref, useAttrs } from "vue"
3
-
4
- /**
5
- * Allows users to more easily pass attributes to different parts of a component. Suppose a component has an input and a wrapper and you want most attributes to go to the input, but any that start with `wrapper` to go to the wrapper.
6
- *
7
- * You can do:
8
- *
9
- * ```ts
10
- * const extraAttrs = useDivideAttrs(["wrapper"] as const)
11
- * ```
12
- * This will correctly remove the start of the key. So if the user passes:
13
- * ```vue
14
- * <your-component regular-attr wrapper-attr wrapperAttrs/>
15
- * ```
16
- * You will get a ref like:
17
- *
18
- * ```ts
19
- * extraAttrs.value = {
20
- * attrs: { regular-attr: true },
21
- * wrapperAttrs: { attr: true, Attrs: true },
22
- * }
23
- *
24
- * Additionally attributes are properly reactive, tough this is probably a bit expensive given they weren't meant to be reactive.
25
- *
26
- * Note that if using multi-word prefixes, like `inner-wrapper`, they will appear as the key `inner-wrapperAttrs` internally, but users will be able to correctly pass `inner-wrapper-prop`. Aditionally these can be passed down to deeper components, allowing easy wrapping.
27
- * ```
28
- */
29
- export const useDivideAttrs = <T extends readonly string[]>(divisionKeys: T): Ref<Record<`${T[number]}Attrs` | "attrs", Record<string, any>>> => computed(() => {
30
- const attrs: Record<string, any> = useAttrs()
31
- const res: any = { attrs: {} }
32
- const unseen = keys(attrs)
33
- for (const key of divisionKeys) {
34
- res[`${key}Attrs`] = {}
35
- for (let i = 0; i < unseen.length; i++) {
36
- const attrKey = unseen[i]
37
- if (!attrKey) continue
38
- if (attrKey.startsWith(`${key}-`)) {
39
- res[`${key}Attrs`][attrKey.slice(key.length + 1)] = attrs[attrKey]
40
- unseen.splice(i, 1)
41
- i--
42
- } else if (attrKey.startsWith(key)) {
43
- res[`${key}Attrs`][attrKey.slice(key.length)] = attrs[attrKey]
44
- unseen.splice(i, 1)
45
- i--
46
- }
47
- }
48
- }
49
- for (const attrKey of unseen) {
50
- res.attrs[attrKey] = attrs[attrKey]
51
- }
52
- return res
53
- })