@witchcraft/ui 0.0.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 (315) hide show
  1. package/README.md +236 -0
  2. package/dist/module.cjs +5 -0
  3. package/dist/module.d.mts +34 -0
  4. package/dist/module.d.ts +34 -0
  5. package/dist/module.json +9 -0
  6. package/dist/module.mjs +124 -0
  7. package/dist/runtime/assets/base.css +1 -0
  8. package/dist/runtime/assets/locales/en.json +33 -0
  9. package/dist/runtime/assets/style.css +1 -0
  10. package/dist/runtime/assets/tailwind.css +1 -0
  11. package/dist/runtime/assets/theme.css +1 -0
  12. package/dist/runtime/build/WitchcraftUiResolver.d.ts +5 -0
  13. package/dist/runtime/build/WitchcraftUiResolver.js +17 -0
  14. package/dist/runtime/build/generateTheme.d.ts +1 -0
  15. package/dist/runtime/build/generateTheme.js +14 -0
  16. package/dist/runtime/build/unpluginIconViteOptions.d.ts +2 -0
  17. package/dist/runtime/build/unpluginIconViteOptions.js +10 -0
  18. package/dist/runtime/components/Aria/Aria.vue +18 -0
  19. package/dist/runtime/components/Focus.stories.d.ts +11 -0
  20. package/dist/runtime/components/Focus.stories.js +53 -0
  21. package/dist/runtime/components/Icon/Icon.vue +39 -0
  22. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +12 -0
  23. package/dist/runtime/components/LibButton/LibButton.stories.js +94 -0
  24. package/dist/runtime/components/LibButton/LibButton.vue +247 -0
  25. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +14 -0
  26. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +29 -0
  27. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +132 -0
  28. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +7 -0
  29. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +58 -0
  30. package/dist/runtime/components/LibColorInput/LibColorInput.vue +125 -0
  31. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +7 -0
  32. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +51 -0
  33. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +448 -0
  34. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +7 -0
  35. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +36 -0
  36. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +95 -0
  37. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +11 -0
  38. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +98 -0
  39. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +67 -0
  40. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +370 -0
  41. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +314 -0
  42. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +27 -0
  43. package/dist/runtime/components/LibDatePicker/helpers.d.ts +25 -0
  44. package/dist/runtime/components/LibDatePicker/helpers.js +28 -0
  45. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +9 -0
  46. package/dist/runtime/components/LibDebug/LibDebug.stories.js +46 -0
  47. package/dist/runtime/components/LibDebug/LibDebug.vue +91 -0
  48. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +53 -0
  49. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +10 -0
  50. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +63 -0
  51. package/dist/runtime/components/LibFileInput/LibFileInput.vue +273 -0
  52. package/dist/runtime/components/LibInput/LibInput.stories.d.ts +33 -0
  53. package/dist/runtime/components/LibInput/LibInput.stories.js +339 -0
  54. package/dist/runtime/components/LibInput/LibInput.vue +372 -0
  55. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +6 -0
  56. package/dist/runtime/components/LibLabel/LibLabel.stories.js +25 -0
  57. package/dist/runtime/components/LibLabel/LibLabel.vue +66 -0
  58. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +23 -0
  59. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +60 -0
  60. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +127 -0
  61. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +15 -0
  62. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +126 -0
  63. package/dist/runtime/components/LibNotifications/LibNotification.vue +121 -0
  64. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +6 -0
  65. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +109 -0
  66. package/dist/runtime/components/LibNotifications/LibNotifications.vue +133 -0
  67. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +6 -0
  68. package/dist/runtime/components/LibPagination/LibPagination.stories.js +40 -0
  69. package/dist/runtime/components/LibPagination/LibPagination.vue +261 -0
  70. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +6 -0
  71. package/dist/runtime/components/LibPalette/LibPalette.stories.js +20 -0
  72. package/dist/runtime/components/LibPalette/LibPalette.vue +49 -0
  73. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +14 -0
  74. package/dist/runtime/components/LibPopup/LibPopup.stories.js +147 -0
  75. package/dist/runtime/components/LibPopup/LibPopup.vue +441 -0
  76. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +10 -0
  77. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +81 -0
  78. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +192 -0
  79. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +19 -0
  80. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +63 -0
  81. package/dist/runtime/components/LibRecorder/LibRecorder.vue +243 -0
  82. package/dist/runtime/components/LibRoot/LibRoot.vue +126 -0
  83. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +26 -0
  84. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +78 -0
  85. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +148 -0
  86. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +27 -0
  87. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +112 -0
  88. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +198 -0
  89. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +16 -0
  90. package/dist/runtime/components/LibTable/LibTable.stories.js +156 -0
  91. package/dist/runtime/components/LibTable/LibTable.vue +177 -0
  92. package/dist/runtime/components/Template/NAME.vue +49 -0
  93. package/dist/runtime/components/Template/TemplateStory.d.ts +7 -0
  94. package/dist/runtime/components/Template/TemplateStory.js +22 -0
  95. package/dist/runtime/components/TestControls/TestControls.vue +19 -0
  96. package/dist/runtime/components/index.d.ts +19 -0
  97. package/dist/runtime/components/index.js +19 -0
  98. package/dist/runtime/components/reset.stories.d.ts +5 -0
  99. package/dist/runtime/components/reset.stories.js +19 -0
  100. package/dist/runtime/components/shared/props.d.ts +135 -0
  101. package/dist/runtime/components/shared/props.js +14 -0
  102. package/dist/runtime/components/shared/storyHelpers/playInput.d.ts +8 -0
  103. package/dist/runtime/components/shared/storyHelpers/playInput.js +26 -0
  104. package/dist/runtime/components/shared/storyHelpers/playSuggestions.d.ts +12 -0
  105. package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +83 -0
  106. package/dist/runtime/composables/index.d.ts +11 -0
  107. package/dist/runtime/composables/index.js +11 -0
  108. package/dist/runtime/composables/useAccesibilityOutline.d.ts +41 -0
  109. package/dist/runtime/composables/useAccesibilityOutline.js +58 -0
  110. package/dist/runtime/composables/useAriaLabel.d.ts +6 -0
  111. package/dist/runtime/composables/useAriaLabel.js +15 -0
  112. package/dist/runtime/composables/useDarkMode.d.ts +38 -0
  113. package/dist/runtime/composables/useDarkMode.js +79 -0
  114. package/dist/runtime/composables/useDivideAttrs.d.ts +27 -0
  115. package/dist/runtime/composables/useDivideAttrs.js +26 -0
  116. package/dist/runtime/composables/useGlobalResizeObserver.d.ts +3 -0
  117. package/dist/runtime/composables/useGlobalResizeObserver.js +28 -0
  118. package/dist/runtime/composables/useInjectedDarkMode.d.ts +2 -0
  119. package/dist/runtime/composables/useInjectedDarkMode.js +13 -0
  120. package/dist/runtime/composables/useInjectedI18n.d.ts +2 -0
  121. package/dist/runtime/composables/useInjectedI18n.js +7 -0
  122. package/dist/runtime/composables/useInjectedLocale.d.ts +2 -0
  123. package/dist/runtime/composables/useInjectedLocale.js +21 -0
  124. package/dist/runtime/composables/useNotificationHandler.d.ts +4 -0
  125. package/dist/runtime/composables/useNotificationHandler.js +21 -0
  126. package/dist/runtime/composables/useScrollNearContainerEdges.d.ts +68 -0
  127. package/dist/runtime/composables/useScrollNearContainerEdges.js +116 -0
  128. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +7 -0
  129. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +85 -0
  130. package/dist/runtime/composables/useSetupDarkMode.d.ts +12 -0
  131. package/dist/runtime/composables/useSetupDarkMode.js +4 -0
  132. package/dist/runtime/composables/useSetupI18n.d.ts +20 -0
  133. package/dist/runtime/composables/useSetupI18n.js +50 -0
  134. package/dist/runtime/composables/useSetupLocale.d.ts +9 -0
  135. package/dist/runtime/composables/useSetupLocale.js +21 -0
  136. package/dist/runtime/composables/useShowDevOnlyKey.d.ts +7 -0
  137. package/dist/runtime/composables/useShowDevOnlyKey.js +20 -0
  138. package/dist/runtime/composables/useSuggestions.d.ts +38 -0
  139. package/dist/runtime/composables/useSuggestions.js +226 -0
  140. package/dist/runtime/directives/index.d.ts +4 -0
  141. package/dist/runtime/directives/index.js +4 -0
  142. package/dist/runtime/directives/vDetectFlex.d.ts +2 -0
  143. package/dist/runtime/directives/vDetectFlex.js +109 -0
  144. package/dist/runtime/directives/vExtractRootEl.d.ts +22 -0
  145. package/dist/runtime/directives/vExtractRootEl.js +13 -0
  146. package/dist/runtime/directives/vResizableCols.d.ts +60 -0
  147. package/dist/runtime/directives/vResizableCols.js +252 -0
  148. package/dist/runtime/directives/vResizeObserver.d.ts +2 -0
  149. package/dist/runtime/directives/vResizeObserver.js +34 -0
  150. package/dist/runtime/globalResizeObserver.d.ts +5 -0
  151. package/dist/runtime/globalResizeObserver.js +5 -0
  152. package/dist/runtime/helpers/NotificationHandler.d.ts +48 -0
  153. package/dist/runtime/helpers/NotificationHandler.js +162 -0
  154. package/dist/runtime/helpers/addValue.d.ts +1 -0
  155. package/dist/runtime/helpers/addValue.js +8 -0
  156. package/dist/runtime/helpers/base64ToImg.d.ts +1 -0
  157. package/dist/runtime/helpers/base64ToImg.js +11 -0
  158. package/dist/runtime/helpers/copy.d.ts +1 -0
  159. package/dist/runtime/helpers/copy.js +10 -0
  160. package/dist/runtime/helpers/createNoonUtcDate.d.ts +7 -0
  161. package/dist/runtime/helpers/createNoonUtcDate.js +14 -0
  162. package/dist/runtime/helpers/defaultTranslationFunction.d.ts +16 -0
  163. package/dist/runtime/helpers/defaultTranslationFunction.js +14 -0
  164. package/dist/runtime/helpers/getTimeZoneList.d.ts +1 -0
  165. package/dist/runtime/helpers/getTimeZoneList.js +3 -0
  166. package/dist/runtime/helpers/hasModifiers.d.ts +1 -0
  167. package/dist/runtime/helpers/hasModifiers.js +1 -0
  168. package/dist/runtime/helpers/index.d.ts +8 -0
  169. package/dist/runtime/helpers/index.js +8 -0
  170. package/dist/runtime/helpers/readFile.d.ts +1 -0
  171. package/dist/runtime/helpers/readFile.js +13 -0
  172. package/dist/runtime/helpers/resizeObserverWrapper.d.ts +8 -0
  173. package/dist/runtime/helpers/resizeObserverWrapper.js +37 -0
  174. package/dist/runtime/helpers/storybook.d.ts +7 -0
  175. package/dist/runtime/helpers/storybook.js +42 -0
  176. package/dist/runtime/main.lib.d.ts +26 -0
  177. package/dist/runtime/main.lib.js +8 -0
  178. package/dist/runtime/nuxt/plugins/vue-plugin.d.ts +2 -0
  179. package/dist/runtime/nuxt/plugins/vue-plugin.js +12 -0
  180. package/dist/runtime/tailwind/index.d.ts +1 -0
  181. package/dist/runtime/tailwind/index.js +1 -0
  182. package/dist/runtime/tailwind/themeConvertionOpts.d.ts +2 -0
  183. package/dist/runtime/tailwind/themeConvertionOpts.js +12 -0
  184. package/dist/runtime/theme.d.ts +2 -0
  185. package/dist/runtime/theme.js +2 -0
  186. package/dist/runtime/types/index.d.ts +119 -0
  187. package/dist/runtime/types/index.js +0 -0
  188. package/dist/runtime/utils/twMerge.d.ts +10 -0
  189. package/dist/runtime/utils/twMerge.js +10 -0
  190. package/dist/runtime/vue/VueComponentsPlugin.d.ts +2 -0
  191. package/dist/runtime/vue/VueComponentsPlugin.js +10 -0
  192. package/dist/runtime/vue/registerComponents.d.ts +19 -0
  193. package/dist/runtime/vue/registerComponents.js +10 -0
  194. package/dist/runtime/vue/registerDirectives.d.ts +3 -0
  195. package/dist/runtime/vue/registerDirectives.js +9 -0
  196. package/dist/types.d.mts +7 -0
  197. package/dist/types.d.ts +7 -0
  198. package/package.json +207 -0
  199. package/src/module.ts +176 -0
  200. package/src/runtime/assets/base.css +67 -0
  201. package/src/runtime/assets/locales/en.json +33 -0
  202. package/src/runtime/assets/style.css +144 -0
  203. package/src/runtime/assets/tailwind.css +5 -0
  204. package/src/runtime/assets/theme.css +65 -0
  205. package/src/runtime/build/WitchcraftUiResolver.ts +27 -0
  206. package/src/runtime/build/generateTheme.ts +16 -0
  207. package/src/runtime/build/unpluginIconViteOptions.ts +11 -0
  208. package/src/runtime/components/Aria/Aria.vue +27 -0
  209. package/src/runtime/components/Focus.stories.ts +67 -0
  210. package/src/runtime/components/Icon/Icon.vue +39 -0
  211. package/src/runtime/components/LibButton/LibButton.stories.ts +107 -0
  212. package/src/runtime/components/LibButton/LibButton.vue +247 -0
  213. package/src/runtime/components/LibCheckbox/LibCheckbox.stories.ts +41 -0
  214. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +132 -0
  215. package/src/runtime/components/LibColorInput/LibColorInput.stories.ts +69 -0
  216. package/src/runtime/components/LibColorInput/LibColorInput.vue +125 -0
  217. package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +60 -0
  218. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +448 -0
  219. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +51 -0
  220. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +95 -0
  221. package/src/runtime/components/LibDatePicker/LibDatePicker.stories.ts +114 -0
  222. package/src/runtime/components/LibDatePicker/LibDatePicker.vue +67 -0
  223. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +370 -0
  224. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +314 -0
  225. package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +27 -0
  226. package/src/runtime/components/LibDatePicker/helpers.ts +55 -0
  227. package/src/runtime/components/LibDebug/LibDebug.stories.ts +58 -0
  228. package/src/runtime/components/LibDebug/LibDebug.vue +91 -0
  229. package/src/runtime/components/LibDevOnly/LibDevOnly.vue +53 -0
  230. package/src/runtime/components/LibFileInput/LibFileInput.stories.ts +79 -0
  231. package/src/runtime/components/LibFileInput/LibFileInput.vue +273 -0
  232. package/src/runtime/components/LibInput/LibInput.stories.ts +367 -0
  233. package/src/runtime/components/LibInput/LibInput.vue +372 -0
  234. package/src/runtime/components/LibLabel/LibLabel.stories.ts +37 -0
  235. package/src/runtime/components/LibLabel/LibLabel.vue +66 -0
  236. package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +83 -0
  237. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +127 -0
  238. package/src/runtime/components/LibNotifications/LibNotification.stories.ts +142 -0
  239. package/src/runtime/components/LibNotifications/LibNotification.vue +121 -0
  240. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +124 -0
  241. package/src/runtime/components/LibNotifications/LibNotifications.vue +133 -0
  242. package/src/runtime/components/LibPagination/LibPagination.stories.ts +53 -0
  243. package/src/runtime/components/LibPagination/LibPagination.vue +261 -0
  244. package/src/runtime/components/LibPalette/LibPalette.stories.ts +32 -0
  245. package/src/runtime/components/LibPalette/LibPalette.vue +49 -0
  246. package/src/runtime/components/LibPopup/LibPopup.stories.ts +157 -0
  247. package/src/runtime/components/LibPopup/LibPopup.vue +441 -0
  248. package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +94 -0
  249. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +192 -0
  250. package/src/runtime/components/LibRecorder/LibRecorder.stories.ts +81 -0
  251. package/src/runtime/components/LibRecorder/LibRecorder.vue +243 -0
  252. package/src/runtime/components/LibRoot/LibRoot.vue +126 -0
  253. package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +98 -0
  254. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +148 -0
  255. package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +137 -0
  256. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +198 -0
  257. package/src/runtime/components/LibTable/LibTable.stories.ts +170 -0
  258. package/src/runtime/components/LibTable/LibTable.vue +177 -0
  259. package/src/runtime/components/Template/NAME.vue +49 -0
  260. package/src/runtime/components/Template/TemplateStory.ts +38 -0
  261. package/src/runtime/components/TestControls/TestControls.vue +19 -0
  262. package/src/runtime/components/index.ts +22 -0
  263. package/src/runtime/components/reset.stories.ts +32 -0
  264. package/src/runtime/components/shared/props.ts +142 -0
  265. package/src/runtime/components/shared/storyHelpers/playInput.ts +35 -0
  266. package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +105 -0
  267. package/src/runtime/composables/index.ts +13 -0
  268. package/src/runtime/composables/useAccesibilityOutline.ts +104 -0
  269. package/src/runtime/composables/useAriaLabel.ts +23 -0
  270. package/src/runtime/composables/useDarkMode.ts +146 -0
  271. package/src/runtime/composables/useDivideAttrs.ts +52 -0
  272. package/src/runtime/composables/useGlobalResizeObserver.ts +33 -0
  273. package/src/runtime/composables/useInjectedDarkMode.ts +15 -0
  274. package/src/runtime/composables/useInjectedI18n.ts +10 -0
  275. package/src/runtime/composables/useInjectedLocale.ts +24 -0
  276. package/src/runtime/composables/useNotificationHandler.ts +32 -0
  277. package/src/runtime/composables/useScrollNearContainerEdges.stories.ts +93 -0
  278. package/src/runtime/composables/useScrollNearContainerEdges.ts +205 -0
  279. package/src/runtime/composables/useSetupDarkMode.ts +14 -0
  280. package/src/runtime/composables/useSetupI18n.ts +77 -0
  281. package/src/runtime/composables/useSetupLocale.ts +32 -0
  282. package/src/runtime/composables/useShowDevOnlyKey.ts +28 -0
  283. package/src/runtime/composables/useSuggestions.ts +297 -0
  284. package/src/runtime/directives/index.ts +6 -0
  285. package/src/runtime/directives/vDetectFlex.ts +159 -0
  286. package/src/runtime/directives/vExtractRootEl.ts +38 -0
  287. package/src/runtime/directives/vResizableCols.ts +378 -0
  288. package/src/runtime/directives/vResizeObserver.ts +45 -0
  289. package/src/runtime/globalResizeObserver.ts +12 -0
  290. package/src/runtime/helpers/NotificationHandler.ts +227 -0
  291. package/src/runtime/helpers/addValue.ts +10 -0
  292. package/src/runtime/helpers/base64ToImg.ts +14 -0
  293. package/src/runtime/helpers/copy.ts +11 -0
  294. package/src/runtime/helpers/createNoonUtcDate.ts +21 -0
  295. package/src/runtime/helpers/defaultTranslationFunction.ts +33 -0
  296. package/src/runtime/helpers/getTimeZoneList.ts +4 -0
  297. package/src/runtime/helpers/hasModifiers.ts +1 -0
  298. package/src/runtime/helpers/index.ts +10 -0
  299. package/src/runtime/helpers/readFile.ts +22 -0
  300. package/src/runtime/helpers/resizeObserverWrapper.ts +45 -0
  301. package/src/runtime/helpers/storybook.ts +52 -0
  302. package/src/runtime/main.lib.ts +31 -0
  303. package/src/runtime/nuxt/plugins/vue-plugin.ts +19 -0
  304. package/src/runtime/tailwind/index.ts +3 -0
  305. package/src/runtime/tailwind/themeConvertionOpts.ts +15 -0
  306. package/src/runtime/theme.ts +5 -0
  307. package/src/runtime/types/index.ts +116 -0
  308. package/src/runtime/utils/twMerge.ts +13 -0
  309. package/src/runtime/vue/VueComponentsPlugin.ts +16 -0
  310. package/src/runtime/vue/registerComponents.ts +31 -0
  311. package/src/runtime/vue/registerDirectives.ts +12 -0
  312. package/types/components.d.ts +27 -0
  313. package/types/global.d.ts +16 -0
  314. package/types/index.d.ts +5 -0
  315. package/types/vite.d.ts +2 -0
@@ -0,0 +1,227 @@
1
+ import type { AnyFunction, MakeRequired } from "@alanscodelog/utils"
2
+ import { castType } from "@alanscodelog/utils/castType.js"
3
+ import { crop } from "@alanscodelog/utils/crop.js"
4
+ import { indent } from "@alanscodelog/utils/indent.js"
5
+ import { isBlank } from "@alanscodelog/utils/isBlank.js"
6
+ import { pretty } from "@alanscodelog/utils/pretty.js"
7
+ import { setReadOnly } from "@alanscodelog/utils/setReadOnly.js"
8
+
9
+
10
+ export class NotificationHandler<
11
+ TRawEntry extends RawNotificationEntry<any, any> = RawNotificationEntry<any, any>,
12
+ TEntry extends NotificationEntry<TRawEntry> = NotificationEntry<TRawEntry>,
13
+ > {
14
+ timeout: number = 5000
15
+
16
+ debug: boolean = false
17
+
18
+ private id: number = 0
19
+
20
+ readonly queue: TEntry[] = []
21
+
22
+ readonly history: TEntry[] = []
23
+
24
+ maxHistory: number = 100
25
+
26
+ listeners: NotificationListener<TEntry>[] = []
27
+
28
+ stringifier?: NotificationStringifier<TEntry>
29
+
30
+ constructor({
31
+ timeout,
32
+ stringifier,
33
+ maxHistory,
34
+ }: {
35
+ timeout?: NotificationHandler<TRawEntry>["timeout"]
36
+ stringifier?: NotificationHandler<TRawEntry>["stringifier"]
37
+ maxHistory?: NotificationHandler<TRawEntry>["maxHistory"]
38
+ } = {}) {
39
+ if (timeout) this.timeout = timeout
40
+ if (maxHistory) this.maxHistory = maxHistory
41
+ if (stringifier) this.stringifier = stringifier
42
+ }
43
+
44
+ private _checkEntry(entry: Omit<TEntry, "promise" | "resolve">): void {
45
+ if (entry.cancellable !== undefined && isBlank(entry.cancellable)) {
46
+ throw new Error(
47
+ crop`Cancellable cannot be a blank string:
48
+ ${indent(pretty(entry), 5)}
49
+ `)
50
+ }
51
+ if (!entry.options.includes(entry.default)) {
52
+ throw new Error(
53
+ crop`Entry options does not include default option "${entry.default}":
54
+ ${indent(pretty(entry), 5)}
55
+ `)
56
+ }
57
+ if (entry.cancellable) {
58
+ if (typeof entry.cancellable === "string" && !entry.options.includes(entry.cancellable)) {
59
+ throw new Error(
60
+ crop`Entry options does not include cancellable option "${entry.cancellable}":
61
+ ${indent(pretty(entry), 6)}
62
+ `)
63
+ }
64
+ } else {
65
+ if (entry.options.includes("Cancel")) {
66
+ throw new Error(
67
+ crop`You specified that the entry should not be cancellable, but the options include the "Cancel" option:
68
+ ${indent(pretty(entry), 6)}
69
+ `)
70
+ }
71
+ }
72
+ if (entry.timeout !== undefined && !entry.cancellable) {
73
+ throw new Error(
74
+ crop`Cannot timeout notification that is not cancellable:
75
+ ${indent(pretty(entry), 5)}
76
+ `)
77
+ }
78
+ if (entry.timeout !== undefined && entry.requiresAction) {
79
+ throw new Error(
80
+ crop`Cannot timeout notification that requires action:
81
+ ${indent(pretty(entry), 5)}
82
+ `)
83
+ }
84
+ const missingDangerousOption = entry.dangerous!.find((option: string) => !entry.options.includes(option))
85
+ if (entry.dangerous !== undefined && missingDangerousOption) {
86
+ throw new Error(
87
+ crop`Dangerous options list contains an unknown option "${missingDangerousOption}":
88
+ ${indent(pretty(entry), 5)}
89
+ `)
90
+ }
91
+ }
92
+
93
+ protected _createEntry<TNotifyEntry extends RawNotificationEntry<any, any>>(rawEntry: TNotifyEntry): TEntry {
94
+ const entry: Partial<NotificationEntry<any>> & Omit<NotificationEntry<any>, "promise" | "resolve"> = {
95
+ requiresAction: false,
96
+ options: ["Ok", "Cancel"],
97
+ default: "Ok",
98
+ cancellable: rawEntry.cancellable,
99
+ ...rawEntry,
100
+ dangerous: rawEntry.dangerous ?? [],
101
+ timeout: rawEntry.timeout === true
102
+ ? this.timeout
103
+ : rawEntry.timeout !== undefined && rawEntry.timeout !== false
104
+ ? rawEntry.timeout
105
+ : undefined,
106
+ } as any as TEntry
107
+
108
+
109
+ if (rawEntry.cancellable === true || (rawEntry.cancellable === undefined && entry.options?.includes("Cancel"))) {
110
+ entry.cancellable = "Cancel" as any
111
+ }
112
+
113
+ this._checkEntry(entry)
114
+
115
+ castType<TEntry>(entry)
116
+ this.id++
117
+ entry.id = this.id
118
+ return entry
119
+ }
120
+
121
+ async notify<TNotifyEntry extends RawNotificationEntry<any, any>>(rawEntry: TNotifyEntry):
122
+ NotificationPromise<TNotifyEntry["options"][number] extends string
123
+ ? TNotifyEntry["options"][number]
124
+ : "Ok" | "Cancel"> {
125
+ const entry = this._createEntry(rawEntry)
126
+ entry.promise = new Promise(_resolve => {
127
+ entry.resolve = _resolve
128
+ }) as NotificationPromise
129
+
130
+ if (entry.timeout !== undefined) {
131
+ setTimeout(() => {
132
+ entry.resolve(entry.cancellable)
133
+ }, entry.timeout)
134
+ }
135
+ this.queue.push(entry)
136
+ for (const listener of this.listeners) {
137
+ listener(entry, "added")
138
+ }
139
+
140
+ return entry.promise.then(res => {
141
+ entry.resolution = res
142
+ for (const listener of this.listeners) {
143
+ listener(entry, "resolved")
144
+ }
145
+ this.history.push(entry)
146
+ if (this.history.length > this.maxHistory) {
147
+ this.history.splice(0, 1)
148
+ for (const listener of this.listeners) {
149
+ listener(entry, "deleted")
150
+ }
151
+ }
152
+ this.queue.splice(this.queue.indexOf(entry), 1)
153
+ return res
154
+ }) satisfies NotificationPromise as any
155
+ }
156
+
157
+ static resolveToDefault(notification: NotificationEntry): void {
158
+ notification.resolve(notification.default)
159
+ }
160
+
161
+ static dismiss(notification: NotificationEntry): void {
162
+ if (notification.cancellable) {
163
+ notification.resolve(notification.cancellable)
164
+ }
165
+ }
166
+
167
+ stringify(notification: NotificationEntry): string {
168
+ if (this.stringifier) return this.stringifier(notification as any)
169
+ let str = ""
170
+ if (notification.title) str += `${notification.title}\n`
171
+ str += `${notification.message}\n`
172
+ if (notification.code) str += `code:${notification.code}\n`
173
+ return str
174
+ }
175
+
176
+ clear(): void {
177
+ setReadOnly(this, "history", [])
178
+ }
179
+
180
+ addNotificationListener(cb: NotificationListener<TEntry>): void {
181
+ this.listeners.push(cb)
182
+ }
183
+
184
+ removeNotificationListener(cb: NotificationListener<TEntry>): void {
185
+ const exists = this.listeners.indexOf(cb)
186
+ if (exists > -1) {
187
+ this.listeners.splice(exists, 1)
188
+ } else {
189
+ throw new Error(`Listener does not exist: ${cb.toString()}`)
190
+ }
191
+ }
192
+ }
193
+
194
+ export type NotificationPromise<TOption extends string = string> = Promise<TOption>
195
+
196
+ export type RawNotificationEntry<
197
+ TOptions extends string[] = ["Ok", "Cancel"],
198
+ TCancellable extends boolean | TOptions[number] = "Cancel",
199
+ > = {
200
+ message: string
201
+ title?: string
202
+ code?: string
203
+ options?: TOptions
204
+ requiresAction?: boolean
205
+ cancellable?: TCancellable
206
+ default?: TOptions[number]
207
+ dangerous?: TOptions[number][]
208
+ timeout?: number | boolean
209
+ icon?: string
210
+ }
211
+
212
+ export type NotificationEntry<
213
+ TRawEntry extends RawNotificationEntry<any, any> = RawNotificationEntry<any, any>,
214
+ > = Omit<MakeRequired<TRawEntry, "options" | "requiresAction" | "default" | "dangerous">, "cancellable"> & {
215
+ promise: NotificationPromise
216
+ resolve: AnyFunction
217
+ cancellable?: string
218
+ timeout?: number
219
+ resolution?: string
220
+ id: number
221
+ }
222
+
223
+ export type NotificationListener<TEntry extends NotificationEntry<any>> = (notification: TEntry, type: "added" | "resolved" | "deleted") => void
224
+
225
+
226
+ export type NotificationStringifier<T extends NotificationEntry<any>> = (notification: T) => string
227
+
@@ -0,0 +1,10 @@
1
+ import { pushIfNotIn } from "@alanscodelog/utils/pushIfNotIn.js"
2
+
3
+
4
+ export const addValue = <T>(value: T, values: T[], preventDuplicateValues: boolean): T[] => {
5
+ if (preventDuplicateValues) {
6
+ return pushIfNotIn(values, [value])
7
+ }
8
+ values.push(value)
9
+ return values
10
+ }
@@ -0,0 +1,14 @@
1
+ export const base64ToImg = async (imageSrc: string): Promise<HTMLImageElement> => {
2
+ const img = new Image()
3
+
4
+ const loaded = new Promise((resolve => {
5
+ img.addEventListener("load", () => {
6
+ resolve(img)
7
+ })
8
+ })) as any as Promise<HTMLImageElement>
9
+
10
+ img.src = imageSrc // must be set after
11
+ await loaded
12
+ return img
13
+ }
14
+
@@ -0,0 +1,11 @@
1
+ // todo move to utils
2
+ /* eslint-disable no-console */
3
+ export const copy = (text: string): void => {
4
+ if (navigator.clipboard) {
5
+ navigator.clipboard.writeText(text).catch(err => {
6
+ console.warn(`There was an error copying to the clipboard, please file a bug report.\n${err}`)
7
+ })
8
+ } else {
9
+ console.warn("Could not copy to clipboard, your browser is not supported.")
10
+ }
11
+ }
@@ -0,0 +1,21 @@
1
+ import { type CalendarDate, ZonedDateTime } from "@internationalized/date"
2
+
3
+ /**
4
+ * Takes the given local DATE (ignores the time), and converts it to a UTC (0 offset) date at noon.
5
+ *
6
+ * This should be used to wrap fallback dates for timeless dates, so that the date never changes regardless of the timezone it's converted too.
7
+ */
8
+ export function createNoonUtcDate(date: CalendarDate): ZonedDateTime {
9
+ const noon = [12, 0, 0]
10
+ const timeZoneOffset = 0
11
+ const d = new ZonedDateTime(
12
+ date.year,
13
+ date.month,
14
+ date.day,
15
+ "UTC",
16
+ timeZoneOffset,
17
+ ...noon
18
+ )
19
+ return d
20
+ }
21
+
@@ -0,0 +1,33 @@
1
+ import { inject, type Ref } from "vue"
2
+
3
+ import { translationMessagesInjectionKey } from "../composables/useSetupI18n.js"
4
+
5
+ /**
6
+ * A default translation function to use with `useSetupI18n`. Requires at least one set of translation message sets (or a dummy) be loaded (the useSetupI18n function takes care of setting up a temporary dummy if you set `useBuiltinTranslations: true`).
7
+ *
8
+ * It can take a simple replacement object as the second argument, it's keys in the form `{key}` will be replace with the given value.
9
+ *
10
+ * For example:
11
+ * ```js
12
+ * const messages = {
13
+ * "some-message": "This is a {key}",
14
+ * }
15
+ *
16
+ * t("some-message", { key: "message" })
17
+ * ```
18
+ * Would return "This is a message".
19
+ */
20
+
21
+ export function defaultTranslationFunction(key: string, replacements?: Record<string, any>): string {
22
+ const messages = inject(translationMessagesInjectionKey) as Ref<Record<string, any>> | undefined
23
+ if (messages === undefined) throw new Error("witchcraft/ui: The default translation function requires the useSetupI18n `useBuiltinTranslations` options to be true. Did you set it?")
24
+ let value = (messages.value)["witchcraft-ui"][key]
25
+ if (value === undefined) throw new Error(`No translation for key ${key}.`)
26
+ if (replacements !== undefined) {
27
+ for (const [k, val] of Object.entries(replacements)) {
28
+ value = value.replaceAll(`{${k}}`, val)
29
+ }
30
+ }
31
+ return value
32
+ }
33
+
@@ -0,0 +1,4 @@
1
+ export function getTimeZoneList(): string[] {
2
+ return Intl.supportedValuesOf("timeZone")
3
+ }
4
+
@@ -0,0 +1 @@
1
+ export const hasModifiers = (e: KeyboardEvent): boolean => e.ctrlKey || e.altKey || e.shiftKey || e.metaKey
@@ -0,0 +1,10 @@
1
+ /* Autogenerated Index */
2
+
3
+ export { addValue } from "./addValue.js"
4
+ export { base64ToImg } from "./base64ToImg.js"
5
+ export { copy } from "./copy.js"
6
+ export { createRecorderHandler } from "./storybook.js"
7
+ export { hasModifiers } from "./hasModifiers.js"
8
+ export { NotificationHandler } from "./NotificationHandler.js"
9
+ export { readFile } from "./readFile.js"
10
+ export { ResizeObserverWrapper } from "./resizeObserverWrapper.js"
@@ -0,0 +1,22 @@
1
+ // todo move to utils
2
+ export const readFile = async <TType extends "DataUrl" | "ArrayBuffer" | "BinaryString" | "text" = "DataUrl">(
3
+ file?: File | Blob,
4
+ type: TType = "DataUrl" as TType
5
+ ):
6
+ Promise<
7
+ TType extends "ArrayBuffer"
8
+ ? ArrayBuffer
9
+ : string
10
+ > => new Promise((resolve, reject) => {
11
+ const reader = new FileReader()
12
+ reader.addEventListener("load", () => {
13
+ resolve(reader.result as any)
14
+ }, false)
15
+ reader.addEventListener("error", () => {
16
+ reject(new Error(reader.result as any))
17
+ }, false)
18
+ if (type === "DataUrl") reader.readAsDataURL(file as Blob)
19
+ if (type === "ArrayBuffer") reader.readAsArrayBuffer(file as Blob)
20
+ if (type === "BinaryString") reader.readAsBinaryString(file as Blob)
21
+ if (type === "text") reader.readAsText(file as Blob)
22
+ })
@@ -0,0 +1,45 @@
1
+ import type { ResizeCallback } from "../types/index.js"
2
+
3
+
4
+ export class ResizeObserverWrapper {
5
+ observers: WeakMap<Element, Set<ResizeCallback>> = new WeakMap()
6
+
7
+ observer: ResizeObserver
8
+
9
+ constructor() {
10
+ this.observers = new WeakMap()
11
+ this.observer = new ResizeObserver(elements => {
12
+ for (const element of elements) {
13
+ const { target, contentRect } = element
14
+ const callbacks = this.observers.get(target)
15
+
16
+ if (callbacks) {
17
+ for (const cb of callbacks) {
18
+ cb(contentRect, target)
19
+ }
20
+ }
21
+ }
22
+ })
23
+ }
24
+
25
+ observe(element: Element, callback: ResizeCallback): void {
26
+ const entry = this.observers.get(element)
27
+ if (!entry) {
28
+ this.observers.set(element, new Set())
29
+ }
30
+ this.observer.observe(element)
31
+ const callbacks = this.observers.get(element)!
32
+ callbacks.add(callback)
33
+ }
34
+
35
+ unobserve(element: Element, callback: ResizeCallback): void {
36
+ const entry = this.observers.get(element)
37
+ if (!entry) return
38
+ const callbacks = this.observers.get(element)!
39
+ callbacks.delete(callback)
40
+ if (callbacks.size === 0) {
41
+ this.observer.unobserve(element)
42
+ this.observers.delete(element)
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,52 @@
1
+ import type { Ref } from "vue"
2
+
3
+ import { hasModifiers } from "./hasModifiers.js"
4
+
5
+
6
+ export const createRecorderHandler = (
7
+ recordingValue: Ref<string>,
8
+ recording: Ref<boolean>,
9
+ modelValue: Ref<string>,
10
+ recordingEl: Ref<null | HTMLElement>
11
+ ): { keydown(e: KeyboardEvent): void, mousedown(e: MouseEvent): void, wheel(e: WheelEvent): void } => ({
12
+ keydown(e: KeyboardEvent) {
13
+ e.preventDefault()
14
+ if (!hasModifiers(e) && e.key === "Escape") {
15
+ recordingValue.value = modelValue.value
16
+ recording.value = false
17
+ return
18
+ }
19
+ if (!hasModifiers(e) && e.key === "Enter") {
20
+ recording.value = false
21
+ return
22
+ }
23
+ recordingValue.value += ` ${e.key}`
24
+ },
25
+ mousedown(e: MouseEvent) {
26
+ const target = (e.target as any)
27
+ const el = recordingEl.value
28
+ if (target === el || el?.contains(target)) {
29
+ return
30
+ }
31
+ recordingValue.value += ` ${e.button}`
32
+ e.preventDefault()
33
+ },
34
+ wheel(e: WheelEvent) {
35
+ recordingValue.value += ` ${e.deltaY > 0 ? "↓" : "↑"}`
36
+ e.preventDefault()
37
+ },
38
+ })
39
+
40
+ export const createRecorderWatchEffect = (recordingValue: Ref<string>, recording: Ref<boolean>, modelValue: Ref<string>, values?: Ref<string[]>) => () => {
41
+ if (!recording.value) {
42
+ if (recordingValue.value) {
43
+ if (values?.value) {
44
+ values.value.push(recordingValue.value)
45
+ modelValue.value = ""
46
+ } else {
47
+ modelValue.value = recordingValue.value
48
+ }
49
+ }
50
+ recordingValue.value = ""
51
+ }
52
+ }
@@ -0,0 +1,31 @@
1
+ export * from "./types/index.js"
2
+ export * as components from "./components/index.js"
3
+ export * as helpers from "./helpers/index.js"
4
+ export * as composables from "./composables/index.js"
5
+ export * as directives from "./directives/index.js"
6
+ export { registerDirectives } from "./vue/registerDirectives.js"
7
+ export { registerComponents } from "./vue/registerComponents.js"
8
+ export { VueComponentsPlugin } from "./vue/VueComponentsPlugin.js"
9
+
10
+ import type * as components from "./components/index.js"
11
+
12
+
13
+ type Components = typeof components
14
+
15
+ /**
16
+ * To get global typings, in a global declaration file (e.g. global.d.ts) do:
17
+ *
18
+ * ```ts
19
+ * import { GlobalComponentTypes } from "@witchcraft/ui"
20
+ *
21
+ * declare module "@vue/runtime-core" {
22
+ * export interface GlobalComponents extends GlobalComponentTypes { }
23
+ * }
24
+ * export {}
25
+ * ```
26
+ * To be able to pass extra attributes you will have to have a global declaration file like the one the library has ({@link ./global.d.ts}), see https://github.com/vuejs/language-tools/issues/1077#issuecomment-1145960878
27
+ */
28
+ export type GlobalComponentTypes = {
29
+ [key in keyof Components]: Components[key]
30
+ }
31
+
@@ -0,0 +1,19 @@
1
+ import { isArray } from "@alanscodelog/utils/isArray.js"
2
+
3
+ import { defineNuxtPlugin, useRuntimeConfig } from "#imports"
4
+
5
+ import { registerDirectives } from "../../vue/registerDirectives.js"
6
+
7
+
8
+ export default defineNuxtPlugin({
9
+ name: "components-plugin",
10
+ async setup(nuxtApp): Promise<void> {
11
+ const config = useRuntimeConfig().public.witchcraftUi
12
+ const app = nuxtApp.vueApp
13
+ const directives = (isArray(config?.directives)
14
+ ? (await Promise.all(config.directives.map(async (name: string) => (import(`../../directives/${name}.ts`))))).map((_: any) => Object.values(_)[0])
15
+ // @ts-expect-error ts filetype needed for nuxt
16
+ : await import(`../../directives/index.ts`))
17
+ registerDirectives(app, Object.values(directives))
18
+ },
19
+ })
@@ -0,0 +1,3 @@
1
+ /* Autogenerated Index */
2
+
3
+ export { themeConvertionOpts } from "./themeConvertionOpts.js"
@@ -0,0 +1,15 @@
1
+ import { type themeAsTailwindCss } from "metamorphosis/tailwind.js"
2
+
3
+
4
+ export const themeConvertionOpts: Parameters<typeof themeAsTailwindCss>[1] = {
5
+ topLevel: ["number-spacing"],
6
+ twTypeMap: { color: "colors" },
7
+ // note, not available yet
8
+ defaultsMap: {
9
+ "color-neutral": "50",
10
+ "color-warning": "500",
11
+ "color-ok": "500",
12
+ "color-error": "500",
13
+ "color-accent": "500",
14
+ },
15
+ }
@@ -0,0 +1,5 @@
1
+ import { baseTheme } from "metamorphosis/BaseTheme.js"
2
+ import type { Theme } from "metamorphosis/Theme.js"
3
+
4
+
5
+ export const theme = baseTheme as Theme
@@ -0,0 +1,116 @@
1
+ import type { ErrorW } from "@alanscodelog/utils"
2
+ import { type Ref } from "vue"
3
+
4
+ export type ResizableOptions = {
5
+ /**
6
+ * Defaults to true.
7
+ *
8
+ * ### true
9
+ * The directive will shrink/expand the columns when the table is resized and will use percentage widths on the table cells. This disables resizing of the last column (from the right handle).
10
+ *
11
+ * Additionally because of the way `table-layout:fixed` works, a min-width cannot be set on the elements via css, so instead, if the table shrinks past `opts.margin * col #`, `min-width` is set on the table until it's resized larger.
12
+ *
13
+ * Note that by definition, the columns are not resizable when this happens.
14
+ *
15
+ * ### false
16
+ *
17
+ * The table can be resized past it's normal width and uses pixel widths on the table cells. You might want to set `overscroll-x: scroll` on a parent wrapping element.
18
+ *
19
+ * This will set the table width to `min-content`, else it doesn't work. Note that it does this after the initial reading/setting of sizes so you can, for example, layout the table with `width: 100%`.
20
+ */
21
+ fitWidth: boolean
22
+ /**
23
+ * The minimum width a column can have.
24
+ *
25
+ * Can be a number, or "dynamic". When dynamic, the directive attempts to get the width of `.grip` and multiplies it times 3.
26
+ */
27
+ margin: "dynamic" | number
28
+ /**
29
+ * Whether resizing is enabled.
30
+ *
31
+ * Can be turned off and all listeners, grips, etc, will be removed.
32
+ *
33
+ * Note that element styles set are not removed.
34
+ */
35
+ enabled: boolean
36
+ /** The number of columns. It will be assumed the first colCount elements are the initial widths of the table columns. */
37
+ colCount: number
38
+ /**
39
+ * A ref that gets filled in with the element width string values by the directive.
40
+ *
41
+ * It can then be used as needed by the component.
42
+ */
43
+ widths: Ref<string[]>
44
+ /** The selector to use for the cells. "tr > td" by default. */
45
+ selector: string
46
+ }
47
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
48
+ export type TableColConfig<T = {}> = Record<keyof T, { name?: string, resizable?: boolean }>
49
+
50
+ export type ResizeCallback = (_rect: DOMRectReadOnly, el: Element) => void
51
+
52
+ export type FileInputError = ErrorW<{ file: File, isValidMimeType: boolean, isValidExtension: boolean }>
53
+
54
+ export type HsvaColor = { h: number, s: number, v: number, a?: number }
55
+ export type RgbaColor = { r: number, g: number, b: number, a?: number }
56
+
57
+ export type ScrollNearContainerEdgesOptions = {
58
+ containerEl: Ref< HTMLElement | null>
59
+ /** Margin inside contianer that allows scrolling. 10 by default. */
60
+ scrollMargin?: number
61
+ /** Margin around container that still allows scrolling. 0 by defualt. */
62
+ outerScrollMargin?: number
63
+ /**
64
+ * Controls the scrolling speed.
65
+ *
66
+ * Scroll happens faster the nearer to the outer edge the cursor.
67
+ *
68
+ * This is calculated as a percent (0 near the inner edge, and 1 near the outer edge), which is then multiplied by this multiplier, since moving by less than 1 pixel is quite slow. The default is 4.
69
+ */
70
+ fastPixelMultiplier?: number
71
+ /** @deprecated Use fastPixelMultiplier instead. */
72
+ fastPixelAmount?: number
73
+ useTimer?: boolean
74
+ timerInterval?: number
75
+ }
76
+ // eslint-disable-next-line @typescript-eslint/naming-convention
77
+ export type SimpleDOMRect = Omit<DOMRect, "toJSON">
78
+
79
+ // eslint-disable-next-line @typescript-eslint/naming-convention
80
+ export interface IPopupReference { getBoundingClientRect: () => SimpleDOMRect }
81
+ export type PopupPosition = { x: number, y: number, maxWidth?: number, maxHeight?: number }
82
+ export type PopupSpaceInfo = {
83
+ left: number
84
+ right: number
85
+ leftLeft: number
86
+ rightRight: number
87
+ leftFromCenter: number
88
+ rightFromCenter: number
89
+ topFromCenter: number
90
+ bottomFromCenter: number
91
+ top: number
92
+ bottom: number
93
+ }
94
+ export type PopupPositioner = (
95
+ /** Reference is only undefined, if you did not specify a button element or use the exposed setReference. The function is still called, because there are other ways you might want to still position the popup (e.g. center-screen or some similar variation). */
96
+ reference: SimpleDOMRect | undefined,
97
+ popup: SimpleDOMRect | DOMRect,
98
+ bg: SimpleDOMRect | DOMRect,
99
+ space: PopupSpaceInfo
100
+ ) => number
101
+
102
+ export type PopupPositionModifier = (
103
+ pos: PopupPosition,
104
+ /** This will only be called with the reference element as undefined when one of the preferred positions is center-screen or it's a function. */
105
+ reference: SimpleDOMRect | undefined,
106
+ popup: SimpleDOMRect | DOMRect,
107
+ bg: SimpleDOMRect | DOMRect,
108
+ space: PopupSpaceInfo
109
+ ) => PopupPosition
110
+
111
+ export type SingleDate = Date | undefined
112
+
113
+ export type RangeDate = {
114
+ start?: SingleDate
115
+ end?: SingleDate
116
+ }
@@ -0,0 +1,13 @@
1
+ import { extendTailwindMerge } from "tailwind-merge"
2
+
3
+ const _twMergeExtend = {
4
+ extend: {
5
+ classGroups: {
6
+ "focus-outline": [{ "focus-outline": ["", "no-offset", "none"]}],
7
+ },
8
+ }
9
+ } satisfies Parameters<typeof extendTailwindMerge>[0]
10
+
11
+ export const twMerge = extendTailwindMerge<"focus-outline">(_twMergeExtend)
12
+
13
+ export const twMergeExtend = _twMergeExtend