@witchcraft/ui 0.4.0 → 0.4.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 (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,20 +1,20 @@
1
- export { default as aria } from "./Aria/Aria.vue";
2
- export { default as LibButton } from "./LibButton/LibButton.vue";
3
- export { default as LibCheckbox } from "./LibCheckbox/LibCheckbox.vue";
4
- export { default as LibColorInput } from "./LibColorInput/LibColorInput.vue";
5
- export { default as LibColorPicker } from "./LibColorPicker/LibColorPicker.vue";
6
- export { default as LibDarkModeSwitcher } from "./LibDarkModeSwitcher/LibDarkModeSwitcher.vue";
7
- export { default as LibDatePicker } from "./LibDatePicker/LibDatePicker.vue";
8
- export { default as LibDebug } from "./LibDebug/LibDebug.vue";
9
- export { default as LibFileInput } from "./LibFileInput/LibFileInput.vue";
10
- export { default as LibInputDeprecated } from "./LibInputDeprecated/LibInputDeprecated.vue";
11
- export { default as LibLabel } from "./LibLabel/LibLabel.vue";
12
- export { default as LibNotifications } from "./LibNotifications/LibNotifications.vue";
13
- export { default as LibPagination } from "./LibPagination/LibPagination.vue";
14
- export { default as LibPopup } from "./LibPopup/LibPopup.vue";
15
- export { default as LibProgressBar } from "./LibProgressBar/LibProgressBar.vue";
16
- export { default as LibRecorder } from "./LibRecorder/LibRecorder.vue";
17
- export { default as LibRoot } from "./LibRoot/LibRoot.vue";
18
- export { default as LibSimpleInput } from "./LibSimpleInput/LibSimpleInput.vue";
19
- export { default as LibTable } from "./LibTable/LibTable.vue";
20
- export { default as LibTimeZonePicker } from "./LibDatePicker/LibTimeZonePicker.vue";
1
+ export { default as WButton } from "./WButton/WButton.vue";
2
+ export { default as WCheckbox } from "./WCheckbox/WCheckbox.vue";
3
+ export { default as WColorInput } from "./WColorInput/WColorInput.vue";
4
+ export { default as WColorPicker } from "./WColorPicker/WColorPicker.vue";
5
+ export { default as WCombobox } from "./WCombobox/WCombobox.vue";
6
+ export { default as WDarkModeSwitcher } from "./WDarkModeSwitcher/WDarkModeSwitcher.vue";
7
+ export { default as WDatePicker } from "./WDatePicker/WDatePicker.vue";
8
+ export { default as WDebug } from "./WDebug/WDebug.vue";
9
+ export { default as WFileInput } from "./WFileInput/WFileInput.vue";
10
+ export { default as WNotifications } from "./WNotifications/WNotifications.vue";
11
+ export { default as WPagination } from "./WPagination/WPagination.vue";
12
+ export { default as WPopup } from "./WPopup/WPopup.vue";
13
+ export { default as WPopover } from "./WPopover/WPopover.vue";
14
+ export { default as WProgressBar } from "./WProgressBar/WProgressBar.vue";
15
+ export { default as WRecorder } from "./WRecorder/WRecorder.vue";
16
+ export { default as WRoot } from "./WRoot/WRoot.vue";
17
+ export { default as WSimpleInput } from "./WSimpleInput/WSimpleInput.vue";
18
+ export { default as WTable } from "./WTable/WTable.vue";
19
+ export { default as WTimeZonePicker } from "./WDatePicker/WTimeZonePicker.vue";
20
+ export { default as WTooltip } from "./WTooltip/WTooltip.vue";
@@ -1,20 +1,20 @@
1
- export { default as aria } from "./Aria/Aria.vue";
2
- export { default as LibButton } from "./LibButton/LibButton.vue";
3
- export { default as LibCheckbox } from "./LibCheckbox/LibCheckbox.vue";
4
- export { default as LibColorInput } from "./LibColorInput/LibColorInput.vue";
5
- export { default as LibColorPicker } from "./LibColorPicker/LibColorPicker.vue";
6
- export { default as LibDarkModeSwitcher } from "./LibDarkModeSwitcher/LibDarkModeSwitcher.vue";
7
- export { default as LibDatePicker } from "./LibDatePicker/LibDatePicker.vue";
8
- export { default as LibDebug } from "./LibDebug/LibDebug.vue";
9
- export { default as LibFileInput } from "./LibFileInput/LibFileInput.vue";
10
- export { default as LibInputDeprecated } from "./LibInputDeprecated/LibInputDeprecated.vue";
11
- export { default as LibLabel } from "./LibLabel/LibLabel.vue";
12
- export { default as LibNotifications } from "./LibNotifications/LibNotifications.vue";
13
- export { default as LibPagination } from "./LibPagination/LibPagination.vue";
14
- export { default as LibPopup } from "./LibPopup/LibPopup.vue";
15
- export { default as LibProgressBar } from "./LibProgressBar/LibProgressBar.vue";
16
- export { default as LibRecorder } from "./LibRecorder/LibRecorder.vue";
17
- export { default as LibRoot } from "./LibRoot/LibRoot.vue";
18
- export { default as LibSimpleInput } from "./LibSimpleInput/LibSimpleInput.vue";
19
- export { default as LibTable } from "./LibTable/LibTable.vue";
20
- export { default as LibTimeZonePicker } from "./LibDatePicker/LibTimeZonePicker.vue";
1
+ export { default as WButton } from "./WButton/WButton.vue";
2
+ export { default as WCheckbox } from "./WCheckbox/WCheckbox.vue";
3
+ export { default as WColorInput } from "./WColorInput/WColorInput.vue";
4
+ export { default as WColorPicker } from "./WColorPicker/WColorPicker.vue";
5
+ export { default as WCombobox } from "./WCombobox/WCombobox.vue";
6
+ export { default as WDarkModeSwitcher } from "./WDarkModeSwitcher/WDarkModeSwitcher.vue";
7
+ export { default as WDatePicker } from "./WDatePicker/WDatePicker.vue";
8
+ export { default as WDebug } from "./WDebug/WDebug.vue";
9
+ export { default as WFileInput } from "./WFileInput/WFileInput.vue";
10
+ export { default as WNotifications } from "./WNotifications/WNotifications.vue";
11
+ export { default as WPagination } from "./WPagination/WPagination.vue";
12
+ export { default as WPopup } from "./WPopup/WPopup.vue";
13
+ export { default as WPopover } from "./WPopover/WPopover.vue";
14
+ export { default as WProgressBar } from "./WProgressBar/WProgressBar.vue";
15
+ export { default as WRecorder } from "./WRecorder/WRecorder.vue";
16
+ export { default as WRoot } from "./WRoot/WRoot.vue";
17
+ export { default as WSimpleInput } from "./WSimpleInput/WSimpleInput.vue";
18
+ export { default as WTable } from "./WTable/WTable.vue";
19
+ export { default as WTimeZonePicker } from "./WDatePicker/WTimeZonePicker.vue";
20
+ export { default as WTooltip } from "./WTooltip/WTooltip.vue";
@@ -1,17 +1,17 @@
1
1
  export { useAccesibilityOutline } from "./useAccesibilityOutline.js";
2
- export { useAriaLabel } from "./useAriaLabel.js";
3
- export { useDarkMode } from "./useDarkMode.js";
4
- export { useDivideAttrs } from "./useDivideAttrs.js";
2
+ export { useDelayedLoadingIndicator } from "./useDelayedLoadingIndicator.js";
5
3
  export { useDragWithThreshold } from "./useDragWithThreshold.js";
4
+ export { useFallbackId } from "./useFallbackId.js";
6
5
  export { useGlobalResizeObserver } from "./useGlobalResizeObserver.js";
7
6
  export { useInjectedDarkMode } from "./useInjectedDarkMode.js";
8
7
  export { useInjectedI18n } from "./useInjectedI18n.js";
9
8
  export { useInjectedLocale } from "./useInjectedLocale.js";
10
9
  export { useNotificationHandler } from "./useNotificationHandler.js";
10
+ export { usePopupConstrainToStyle } from "./usePopupConstrainToStyle.js";
11
11
  export { usePreHydrationValue } from "./usePreHydrationValue.js";
12
12
  export { useScrollNearContainerEdges } from "./useScrollNearContainerEdges.js";
13
13
  export { useSetupDarkMode } from "./useSetupDarkMode.js";
14
14
  export { useSetupLocale } from "./useSetupLocale.js";
15
15
  export { useShowDevOnlyKey } from "./useShowDevOnlyKey.js";
16
16
  export { useSlotVars } from "./useSlotVars.js";
17
- export { useSuggestions } from "./useSuggestions.js";
17
+ export { useTimeConditionally } from "./useTimeConditionally.js";
@@ -1,17 +1,17 @@
1
1
  export { useAccesibilityOutline } from "./useAccesibilityOutline.js";
2
- export { useAriaLabel } from "./useAriaLabel.js";
3
- export { useDarkMode } from "./useDarkMode.js";
4
- export { useDivideAttrs } from "./useDivideAttrs.js";
2
+ export { useDelayedLoadingIndicator } from "./useDelayedLoadingIndicator.js";
5
3
  export { useDragWithThreshold } from "./useDragWithThreshold.js";
4
+ export { useFallbackId } from "./useFallbackId.js";
6
5
  export { useGlobalResizeObserver } from "./useGlobalResizeObserver.js";
7
6
  export { useInjectedDarkMode } from "./useInjectedDarkMode.js";
8
7
  export { useInjectedI18n } from "./useInjectedI18n.js";
9
8
  export { useInjectedLocale } from "./useInjectedLocale.js";
10
9
  export { useNotificationHandler } from "./useNotificationHandler.js";
10
+ export { usePopupConstrainToStyle } from "./usePopupConstrainToStyle.js";
11
11
  export { usePreHydrationValue } from "./usePreHydrationValue.js";
12
12
  export { useScrollNearContainerEdges } from "./useScrollNearContainerEdges.js";
13
13
  export { useSetupDarkMode } from "./useSetupDarkMode.js";
14
14
  export { useSetupLocale } from "./useSetupLocale.js";
15
15
  export { useShowDevOnlyKey } from "./useShowDevOnlyKey.js";
16
16
  export { useSlotVars } from "./useSlotVars.js";
17
- export { useSuggestions } from "./useSuggestions.js";
17
+ export { useTimeConditionally } from "./useTimeConditionally.js";
@@ -0,0 +1,9 @@
1
+ import type { Ref } from "vue";
2
+ /**
3
+ * For async operations sometimes it actually loads so fast the loading indicator is not visible but we still want it to be briefly visible. This delays the setting of the returned ref to false by the given timeout so it at least flashes onscreen.
4
+ *
5
+ * Setting to true is not delayed.
6
+ *
7
+ * If the indicator is set to true while the timeout is still running, it's canceled.
8
+ */
9
+ export declare function useDelayedLoadingIndicator(loading: Ref<boolean>, timeout?: number): Ref<boolean, boolean>;
@@ -0,0 +1,18 @@
1
+ import { ref, watch } from "vue";
2
+ export function useDelayedLoadingIndicator(loading, timeout = 200) {
3
+ const showLoadingIndicator = ref(false);
4
+ let loadingTimeout;
5
+ watch(loading, (newVal) => {
6
+ clearTimeout(loadingTimeout);
7
+ if (newVal === true) {
8
+ showLoadingIndicator.value = true;
9
+ } else {
10
+ loadingTimeout = setTimeout(() => {
11
+ if (loading.value === false) {
12
+ showLoadingIndicator.value = false;
13
+ }
14
+ }, timeout);
15
+ }
16
+ });
17
+ return showLoadingIndicator;
18
+ }
@@ -0,0 +1,25 @@
1
+ import type { AcceptableValue, ComboboxRootProps } from "reka-ui";
2
+ export type SuggestionsDisplayProps<T extends NonNullable<AcceptableValue>> = {
3
+ displayKey?: string;
4
+ /**
5
+ * Override's reka-ui's displayValue.
6
+ *
7
+ * Prefer displayKey or displayEntry if possible as it's easier to type and requires less code.
8
+ *
9
+ * It's passed a special options object with a `isForEmit` boolean that tells you whether the value will be used for emits or just visually/search. This is useful to v-model an id when suggestions are objects.
10
+ */
11
+ displayValue?: (value: T | T[], options?: {
12
+ isForEmit?: boolean;
13
+ }) => string;
14
+ /**
15
+ * When displayKey is not enough, prefer this over displayValue as it takes care of extracting the entry (from the array/object/value).
16
+ *
17
+ * The component uses this to filter out the suggestions. In some rare cases you might want to display a different label than the one filtered on (e.g. for example, to indicate some suggestion is active), in these cases, the function will be called with the visualOnly option set to true. This applies only to the visual suggestion in the suggestion list.
18
+ */
19
+ displayEntry?: (value: T, options: {
20
+ isForEmit?: boolean;
21
+ }) => string;
22
+ };
23
+ export declare function useDisplayForReka<T extends NonNullable<ComboboxRootProps["modelValue"]>>(props: SuggestionsDisplayProps<T>): (value: T, options?: {
24
+ isForEmit?: boolean;
25
+ }) => string;
@@ -0,0 +1,16 @@
1
+ export function useDisplayForReka(props) {
2
+ const display = props.displayValue ?? function(value, options = {}) {
3
+ if (Array.isArray(value)) {
4
+ return value.map((v) => {
5
+ const val = v[props.displayKey];
6
+ return props.displayEntry?.(val, options) ?? val;
7
+ }).filter((v) => v !== "").join(", ");
8
+ } else if (typeof value === "object") {
9
+ return props.displayEntry?.(value, options) ?? value[props.displayKey];
10
+ } else {
11
+ if (value === "" && !options.isForEmit) return "";
12
+ return props.displayEntry?.(value, options) ?? value;
13
+ }
14
+ };
15
+ return display;
16
+ }
@@ -0,0 +1,3 @@
1
+ export declare function useFallbackId(props: {
2
+ id?: string;
3
+ }): string;
@@ -0,0 +1,5 @@
1
+ import { useId } from "vue";
2
+ export function useFallbackId(props) {
3
+ const fallbackId = props.id ?? useId();
4
+ return fallbackId;
5
+ }
@@ -1,2 +1,2 @@
1
- import type { DarkModeCommands, DarkModeState } from "./useDarkMode.js";
1
+ import type { DarkModeCommands, DarkModeState } from "../types/index.js";
2
2
  export declare function useInjectedDarkMode(): DarkModeState & DarkModeCommands;
@@ -0,0 +1,8 @@
1
+ import type { ComputedRef, StyleValue } from "vue";
2
+ import type { PopupConstrainToProps } from "../types/index.js";
3
+ /**
4
+ * Mostly internal, create the computed style with maxWidth/Height based on the constrain*To props.
5
+ *
6
+ * @internal
7
+ */
8
+ export declare function usePopupConstrainToStyle(rekaName: string, props: PopupConstrainToProps, attrsStyle?: StyleValue[]): ComputedRef<StyleValue[]>;
@@ -0,0 +1,8 @@
1
+ import { computed } from "vue";
2
+ export function usePopupConstrainToStyle(rekaName, props, attrsStyle) {
3
+ const contentStyle = computed(() => [{
4
+ maxWidth: props.constrainWidthTo === "trigger" ? `var(--reka-${rekaName}-trigger-width)` : props.constrainWidthTo === "available" ? `var(--reka-${rekaName}-content-available-width)` : typeof props.constrainWidthTo === "number" ? `${props.constrainWidthTo}px` : props.constrainWidthTo ?? void 0,
5
+ maxHeight: props.constrainHeightTo === "trigger" ? `var(--reka-${rekaName}-trigger-height)` : props.constrainHeightTo === "available" ? `var(--reka-${rekaName}-content-available-height)` : typeof props.constrainHeightTo === "number" ? `${props.constrainHeightTo}px` : props.constrainHeightTo ?? void 0
6
+ }, ...attrsStyle ?? []]);
7
+ return contentStyle;
8
+ }
@@ -1,4 +1,4 @@
1
- import { useDarkMode } from "./useDarkMode.js";
1
+ import type { DarkModeCommands, DarkModeOptions, DarkModeState } from "../types/index.js";
2
2
  /**
3
3
  * A composable for setting up dark mode that automatically takes care of saving the user's preference.
4
4
  *
@@ -7,6 +7,5 @@ import { useDarkMode } from "./useDarkMode.js";
7
7
  * Use it's twin, `useInjectedDarkMode` for accessing the injected state and commands in components
8
8
  *
9
9
  * Note that this should only be called once at the root of the app.
10
- *
11
10
  */
12
- export declare function useSetupDarkMode(...args: Parameters<typeof useDarkMode>): ReturnType<typeof useDarkMode>;
11
+ export declare const useSetupDarkMode: ({ useLocalStorage, darkModeOrder, isClientSide, useViewTransition }?: DarkModeOptions) => DarkModeState & DarkModeCommands;
@@ -1,4 +1,90 @@
1
- import { useDarkMode } from "./useDarkMode.js";
2
- export function useSetupDarkMode(...args) {
3
- return useDarkMode(...args);
4
- }
1
+ import { computed, nextTick, onMounted, provide, ref, watch } from "vue";
2
+ import { darkModeCommandsInjectionKey, darkModeStateInjectionKey } from "../injectionKeys.js";
3
+ import { defaultDarkModeOrder } from "../types/index.js";
4
+ const isDarkModeInjectionKey = Symbol("isDarkMode");
5
+ const manualDarkModeInjectionKey = Symbol("manualDarkMode");
6
+ const defaultLocalStorageKey = "prefersColorSchemeDark";
7
+ export const useSetupDarkMode = ({
8
+ useLocalStorage = true,
9
+ darkModeOrder = defaultDarkModeOrder,
10
+ isClientSide = true,
11
+ useViewTransition = true
12
+ } = {}) => {
13
+ const systemDarkMode = ref(false);
14
+ const manualDarkMode = ref(void 0);
15
+ if (useLocalStorage && isClientSide) {
16
+ watch(manualDarkMode, () => {
17
+ localStorage.setItem(defaultLocalStorageKey, manualDarkMode.value ? "true" : "false");
18
+ });
19
+ }
20
+ const darkMode = computed(() => manualDarkMode.value ?? systemDarkMode.value);
21
+ const darkModeState = computed(
22
+ () => manualDarkMode.value === void 0 ? "system" : manualDarkMode.value ? "dark" : "light"
23
+ );
24
+ function setDarkMode(value) {
25
+ manualDarkMode.value = value === "dark" ? true : value === "light" ? false : void 0;
26
+ }
27
+ function getNextValue() {
28
+ const index = darkModeOrder.indexOf(darkModeState.value);
29
+ return index === 2 ? darkModeOrder[0] : darkModeOrder[index + 1];
30
+ }
31
+ function _cycleDarkMode() {
32
+ setDarkMode(getNextValue());
33
+ }
34
+ function cycleDarkMode() {
35
+ if (!useViewTransition) {
36
+ _cycleDarkMode();
37
+ return;
38
+ }
39
+ const nextValue = getNextValue();
40
+ const index = darkModeOrder.indexOf(darkModeState.value);
41
+ const systemDarkModeName = systemDarkMode.value ? "dark" : "light";
42
+ if (nextValue === "system" && systemDarkModeName === darkModeOrder[index]) {
43
+ _cycleDarkMode();
44
+ return;
45
+ }
46
+ if (!document.startViewTransition) _cycleDarkMode();
47
+ document.startViewTransition(async () => {
48
+ _cycleDarkMode();
49
+ await nextTick();
50
+ });
51
+ }
52
+ onMounted(() => {
53
+ window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", ({ matches }) => {
54
+ if (matches) {
55
+ systemDarkMode.value = true;
56
+ } else {
57
+ systemDarkMode.value = false;
58
+ }
59
+ });
60
+ if (useLocalStorage !== false) {
61
+ const key = typeof useLocalStorage === "string" ? useLocalStorage : defaultLocalStorageKey;
62
+ const value = localStorage.getItem(key);
63
+ if (value === "true") {
64
+ manualDarkMode.value = true;
65
+ } else if (value === "false") {
66
+ manualDarkMode.value = false;
67
+ }
68
+ }
69
+ });
70
+ provide(isDarkModeInjectionKey, darkMode);
71
+ provide(manualDarkModeInjectionKey, manualDarkMode);
72
+ provide(darkModeStateInjectionKey, {
73
+ darkMode,
74
+ darkModeState,
75
+ manualDarkMode,
76
+ systemDarkMode
77
+ });
78
+ provide(darkModeCommandsInjectionKey, {
79
+ setDarkMode,
80
+ cycleDarkMode
81
+ });
82
+ return {
83
+ darkMode,
84
+ darkModeState,
85
+ setDarkMode,
86
+ cycleDarkMode,
87
+ manualDarkMode,
88
+ systemDarkMode
89
+ };
90
+ };
@@ -0,0 +1,16 @@
1
+ import { type Ref } from "vue";
2
+ /**
3
+ * Returns a ref with the current time if the given value ref is true or it's an array with 1 or more items.. It will update the time every 50ms (configurable) if so (within a requestAnimationFrame).
4
+ *
5
+ * When the value is anything else it will clear the interval and set the time to undefined.
6
+ *
7
+ * Useful for use with a progress bar.
8
+ *
9
+ * Updating the time all the time is expensive and not idea. This way we only set the interval if we really need it.
10
+ */
11
+ export declare function useTimeConditionally(val: Ref<any[] | boolean | any>, { refreshInterval }?: {
12
+ refreshInterval?: number;
13
+ }): {
14
+ time: Ref<undefined | number>;
15
+ refresh: () => void;
16
+ };
@@ -0,0 +1,27 @@
1
+ import { ref, watch } from "vue";
2
+ export function useTimeConditionally(val, {
3
+ refreshInterval = 50
4
+ } = {}) {
5
+ const time = ref(void 0);
6
+ let interval;
7
+ function refresh(v = val.value) {
8
+ if (v === true || Array.isArray(v) && v.length > 0) {
9
+ if (interval !== void 0) return;
10
+ time.value = Date.now();
11
+ interval = setInterval(() => {
12
+ requestAnimationFrame(() => {
13
+ time.value = Date.now();
14
+ });
15
+ }, refreshInterval);
16
+ } else {
17
+ if (interval === void 0) return;
18
+ clearInterval(interval);
19
+ interval = void 0;
20
+ }
21
+ }
22
+ watch(val, (val2) => {
23
+ refresh(val2);
24
+ });
25
+ refresh();
26
+ return { time, refresh };
27
+ }
@@ -1,6 +1,5 @@
1
1
  import { castType } from "@alanscodelog/utils/castType";
2
2
  import { override } from "@alanscodelog/utils/override";
3
- import { throttle } from "@alanscodelog/utils/throttle";
4
3
  import { unreachable } from "@alanscodelog/utils/unreachable";
5
4
  import { globalResizeObserver } from "../globalResizeObserver.js";
6
5
  const observer = globalResizeObserver;
@@ -14,35 +13,31 @@ const callback = (_rect, el) => {
14
13
  setColWidths(el);
15
14
  positionGrips(el);
16
15
  };
17
- const throttledCallback = throttle(callback);
18
16
  export const vResizableCols = {
19
17
  mounted(el, { value: opts = {} }) {
20
18
  const options = override({ ...defaultOpts }, opts);
21
19
  if (options.enabled) {
22
20
  setupColumns(el, options);
23
- observer.observe(el, throttledCallback);
21
+ observer.observe(el, callback);
24
22
  }
25
23
  },
26
24
  updated(el, { value: opts = {} }) {
27
25
  const options = override({ ...defaultOpts }, opts);
28
- const info = el && getElInfo(el);
29
- const hasGrips = el && elMap.get(el).grips;
26
+ const info = el && options.enabled && getElInfo(el, { throwIfMissing: false });
27
+ const hasGrips = el && options.enabled && elMap.get(el)?.grips;
30
28
  const colsNotEqual = info && info.colCount !== options.colCount;
31
- if (hasGrips && !options.enabled || colsNotEqual) {
29
+ if (!options.enabled || colsNotEqual) {
32
30
  teardownColumns(el);
33
- observer.unobserve(el, throttledCallback);
31
+ observer.unobserve(el, callback);
34
32
  }
35
33
  if (!hasGrips && options.enabled || colsNotEqual) {
36
34
  setupColumns(el, options);
37
- observer.observe(el, throttledCallback);
35
+ observer.observe(el, callback);
38
36
  }
39
37
  },
40
38
  unmounted(el) {
41
- const hasGrips = elMap.has(el) && elMap.get(el).grips;
42
- if (hasGrips) {
43
- teardownColumns(el);
44
- globalResizeObserver.unobserve(el, throttledCallback);
45
- }
39
+ teardownColumns(el);
40
+ globalResizeObserver.unobserve(el, callback);
46
41
  },
47
42
  getSSRProps() {
48
43
  return {};
@@ -53,7 +48,11 @@ function setWidth(col, amountInPx, el) {
53
48
  const width = Math.max($el.margin, amountInPx);
54
49
  const index = getColEls(el).findIndex((_) => col === _);
55
50
  if ($el.fitWidth) {
56
- $el.widths.value[index] = `${width / getBox(el).width * 100}%`;
51
+ if (amountInPx <= $el.margin) {
52
+ $el.widths.value[index] = `${$el.margin}px`;
53
+ } else {
54
+ $el.widths.value[index] = `${width / getBox(el).width * 100}%`;
55
+ }
57
56
  } else {
58
57
  $el.widths.value[index] = `${width}px`;
59
58
  }
@@ -85,10 +84,11 @@ function createPointerDownHandler(el) {
85
84
  castType(e.target);
86
85
  $el.target = e.target;
87
86
  $el.isDragging = true;
87
+ el.classList.add("dragging");
88
88
  e.preventDefault();
89
89
  document.addEventListener("pointerup", $el.pointerUpHandler);
90
90
  const { col, colNext } = getCols(el);
91
- if (col === null || colNext === null) {
91
+ if (col === null || colNext === null && $el.fitWidth) {
92
92
  el.classList.add("resizable-cols-error");
93
93
  } else {
94
94
  document.addEventListener("pointermove", $el.pointerMoveHandler);
@@ -105,6 +105,7 @@ function createPointerMoveHandler(el) {
105
105
  const $el = getElInfo(el);
106
106
  if ($el.isDragging) {
107
107
  e.preventDefault();
108
+ $el.fluidWidthsAsPercentOfFluidWidth = void 0;
108
109
  const { col, colNext } = getCols(el);
109
110
  if (col !== null) {
110
111
  const leftBox = getBox(col);
@@ -139,9 +140,11 @@ function createPointerMoveHandler(el) {
139
140
  function createPointerUpHandler(el) {
140
141
  return (e) => {
141
142
  const $el = getElInfo(el);
143
+ $el.pointerMoveHandler(e);
142
144
  if ($el.isDragging) {
143
145
  e.preventDefault();
144
146
  $el.isDragging = false;
147
+ el.classList.remove("dragging");
145
148
  el.classList.remove("resizable-cols-error");
146
149
  $el.offset = 0;
147
150
  delete $el.target;
@@ -173,15 +176,15 @@ function getTestGripSize(el) {
173
176
  el.removeChild(testGrip);
174
177
  return dynamicMinWidth;
175
178
  }
176
- function getElInfo(el) {
179
+ function getElInfo(el, { throwIfMissing = true } = {}) {
177
180
  const $el = elMap.get(el);
178
- if (!$el) unreachable("El went missing.");
181
+ if (!$el && throwIfMissing) unreachable("El went missing.");
179
182
  return $el;
180
183
  }
181
184
  function getColEls(el) {
182
185
  const $el = elMap.get(el);
183
186
  if (!$el) unreachable("El went missing.");
184
- return [...el.querySelectorAll(`:scope ${$el.selector ? $el.selector : "tr > td"}`)];
187
+ return [...el.querySelectorAll(`:scope ${$el.selector ?? "tr > th"}`)];
185
188
  }
186
189
  function setupColumns(el, opts) {
187
190
  const gripWidth = getTestGripSize(el);
@@ -196,11 +199,14 @@ function setupColumns(el, opts) {
196
199
  margin: opts.margin === "dynamic" ? gripWidth : opts.margin,
197
200
  colCount: opts.colCount,
198
201
  widths: opts.widths,
199
- selector: opts.selector
202
+ selector: opts.selector,
203
+ onTeardown: opts.onTeardown
200
204
  };
201
205
  elMap.set(el, $el);
202
- const els = getColEls(el);
203
- const headers = els.slice(0, opts.colCount);
206
+ const headers = getColEls(el);
207
+ if (headers.length !== opts.colCount) {
208
+ throw new Error(`Number of headers matched using selector ${opts.selector ?? "tr > th"} does not match number of columns.`);
209
+ }
204
210
  setColWidths(el, headers);
205
211
  el.style.width = $el.fitWidth ? "" : "min-content";
206
212
  const len = opts.colCount;
@@ -213,15 +219,16 @@ function setupColumns(el, opts) {
213
219
  }
214
220
  positionGrips(el);
215
221
  el.classList.add("resizable-cols-setup");
222
+ opts.onSetup?.(el);
216
223
  }
217
224
  function positionGrips(el) {
218
225
  let xPos = 0;
219
226
  const $el = getElInfo(el);
220
227
  for (const grip of $el.grips.keys()) {
221
228
  const col = $el.grips.get(grip);
222
- const colEls = getColEls(el)[col];
223
- if (!colEls) unreachable();
224
- const colBox = getBox(colEls);
229
+ const colEl = getColEls(el)[col];
230
+ if (!colEl) unreachable();
231
+ const colBox = getBox(colEl);
225
232
  const gripBox = getBox(grip);
226
233
  grip.style.left = `${xPos + colBox.width - gripBox.width / 2}px`;
227
234
  xPos += colBox.width;
@@ -231,14 +238,71 @@ function setColWidths(el, children) {
231
238
  const $el = getElInfo(el);
232
239
  const header = children ?? getColEls(el).slice(0, $el.colCount);
233
240
  const len = $el.colCount;
241
+ const elWidth = getBox(el).width;
242
+ let fluidTotalPx = 0;
243
+ const fluid = {};
244
+ const doCalculateFixed = $el.fixedWidths === void 0;
245
+ const doCalculateFluid = $el.fluidWidthsAsPercentOfFluidWidth === void 0;
246
+ if (doCalculateFixed) {
247
+ $el.fixedWidths = { [-1]: 0 };
248
+ }
249
+ if (doCalculateFluid) {
250
+ $el.fluidWidthsAsPercentOfFluidWidth = {};
251
+ }
252
+ for (let i = 0; i < len; i++) {
253
+ const col = header[i];
254
+ castType(col);
255
+ if (col.classList.contains("no-resize")) {
256
+ if (doCalculateFixed) {
257
+ const w = getBox(col).width;
258
+ $el.fixedWidths[i] = w;
259
+ $el.fixedWidths[-1] += $el.fixedWidths[i];
260
+ }
261
+ } else {
262
+ if (doCalculateFluid) {
263
+ const w = getBox(col).width;
264
+ fluid[i] = w;
265
+ fluidTotalPx += w;
266
+ }
267
+ }
268
+ }
269
+ const totalFluidCount = len - Object.keys($el.fixedWidths).length;
270
+ if (doCalculateFluid) {
271
+ for (let i = 0; i < len; i++) {
272
+ if ($el.fixedWidths[i] !== void 0) continue;
273
+ $el.fluidWidthsAsPercentOfFluidWidth[i] = fluid[i] / fluidTotalPx;
274
+ }
275
+ }
276
+ const fixedTotalPx = $el.fixedWidths[-1];
277
+ const minFlexWidth = totalFluidCount * $el.margin;
278
+ const minTotalWidth = minFlexWidth + fixedTotalPx;
279
+ let leftOverFluidWidth = elWidth - fixedTotalPx;
280
+ if (leftOverFluidWidth < minFlexWidth) {
281
+ leftOverFluidWidth = minFlexWidth;
282
+ }
234
283
  let width = 0;
235
- const minTotalWidth = len * $el.margin;
236
284
  for (let i = 0; i < len; i++) {
237
285
  const col = header[i];
238
286
  castType(col);
239
287
  const colBox = getBox(col);
240
- setWidth(col, colBox.width, el);
241
- width += getBox(col).width;
288
+ if ($el.fixedWidths[i] !== void 0) {
289
+ $el.widths.value[i] = `${$el.fixedWidths[i]}px`;
290
+ width += $el.fixedWidths[i];
291
+ } else {
292
+ if ($el.fitWidth) {
293
+ if (!$el.widths.value[i]) {
294
+ setWidth(col, colBox.width, el);
295
+ width += getBox(col).width;
296
+ continue;
297
+ }
298
+ const newInPx = $el.fluidWidthsAsPercentOfFluidWidth[i] * leftOverFluidWidth;
299
+ setWidth(col, newInPx, el);
300
+ width += getBox(col).width;
301
+ } else {
302
+ setWidth(col, colBox.width, el);
303
+ width += getBox(col).width;
304
+ }
305
+ }
242
306
  }
243
307
  if (width < minTotalWidth) {
244
308
  el.style.minWidth = `${minTotalWidth}px`;
@@ -247,14 +311,17 @@ function setColWidths(el, children) {
247
311
  }
248
312
  }
249
313
  function teardownColumns(el) {
250
- const $el = getElInfo(el);
251
- el.removeEventListener("pointerdown", $el.pointerDownHandler);
252
- document.removeEventListener("pointermove", $el.pointerMoveHandler);
253
- document.removeEventListener("pointerup", $el.pointerUpHandler);
254
- for (const key of Object.keys($el)) {
255
- delete $el[key];
314
+ const $el = getElInfo(el, { throwIfMissing: false });
315
+ if ($el) {
316
+ el.removeEventListener("pointerdown", $el.pointerDownHandler);
317
+ document.removeEventListener("pointermove", $el.pointerMoveHandler);
318
+ document.removeEventListener("pointerup", $el.pointerUpHandler);
319
+ for (const key of Object.keys($el)) {
320
+ delete $el[key];
321
+ }
322
+ $el.onTeardown?.(el);
323
+ elMap.delete(el);
256
324
  }
257
- elMap.delete(el);
258
325
  el.classList.remove("resizable-cols-setup");
259
326
  removeGrips(el);
260
327
  }