@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,10 @@
1
+ import { registerComponents } from "./registerComponents.js";
2
+ import { registerDirectives } from "./registerDirectives.js";
3
+ import * as components from "../components/index.js";
4
+ import * as directives from "../directives/index.js";
5
+ export const VueComponentsPlugin = {
6
+ install(app) {
7
+ registerComponents(app, components);
8
+ registerDirectives(app, directives);
9
+ }
10
+ };
@@ -0,0 +1,19 @@
1
+ import type { App } from "vue";
2
+ /**
3
+ * Register only specific components. Will register components as both snake case and pascal case.
4
+ *
5
+ * ```ts
6
+ * import {SomeComponent} from "@witchcraft/ui/components/SomeComponent"
7
+ * const components = { SomeComponent }
8
+ * createApp(App)
9
+ * .use({
10
+ * install(app: typeof App) {
11
+ * // will register optional-prefix-some-component and optionalPrefixSomeComponent
12
+ * // note it doesn't matter what you call the component in the Object
13
+ * // its name is set internally already
14
+ * registerComponents(app, components, "optional-prefix-")
15
+ * },
16
+ * })
17
+ * ```
18
+ */
19
+ export declare const registerComponents: (app: App, components: Record<string, any>, prefix?: string) => void;
@@ -0,0 +1,10 @@
1
+ import { capitalize } from "@alanscodelog/utils/capitalize.js";
2
+ export const registerComponents = (app, components, prefix = "") => {
3
+ for (const key of Object.keys(components)) {
4
+ const component = components[key];
5
+ const name = prefix + component.name;
6
+ const capitalizedName = name.split("-").map((_) => capitalize(_)).join("");
7
+ app.component(name, component);
8
+ app.component(capitalizedName, component);
9
+ }
10
+ };
@@ -0,0 +1,3 @@
1
+ import type { App } from "vue";
2
+ /** Like registerComponents but for directives. Directives given must have a directiveName property, else they will be ignored. */
3
+ export declare const registerDirectives: (app: App, directives: Record<string, any>, prefix?: string) => void;
@@ -0,0 +1,9 @@
1
+ export const registerDirectives = (app, directives, prefix = "") => {
2
+ for (const key of Object.keys(directives)) {
3
+ const directive = directives[key];
4
+ if (!directive.directiveName) continue;
5
+ const name = prefix + directive.directiveName;
6
+ const kebabCasedName = name.split("-").map((_) => _.toLowerCase()).join("-");
7
+ app.directive(kebabCasedName, directive);
8
+ }
9
+ };
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module.js'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module.js'
@@ -0,0 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
2
+
3
+ import type { default as Module } from './module'
4
+
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
+
7
+ export { default } from './module'
package/package.json ADDED
@@ -0,0 +1,207 @@
1
+ {
2
+ "name": "@witchcraft/ui",
3
+ "version": "0.0.1",
4
+ "description": "Vue component library.",
5
+ "type": "module",
6
+ "main": "./dist/runtime/main.lib.js",
7
+ "types": "./types/index.d.ts",
8
+ "sideEffects": false,
9
+ "exports": {
10
+ ".": {
11
+ "types": "./types/index.d.ts",
12
+ "import": "./dist/runtime/main.lib.js"
13
+ },
14
+ "./*": {
15
+ "import": "./dist/runtime/*",
16
+ "types": "./dist/runtime/*"
17
+ },
18
+ "./components": {
19
+ "types": "./dist/runtime/components/index.d.ts",
20
+ "import": "./dist/runtime/components/index.js"
21
+ },
22
+ "./components/*": {
23
+ "types": "./dist/runtime/components/*/*.vue.d.ts",
24
+ "import": "./dist/runtime/components/*/*.vue"
25
+ },
26
+ "./composables/*": {
27
+ "types": "./dist/runtime/composables/*",
28
+ "import": "./dist/runtime/composables/*"
29
+ },
30
+ "./composables": {
31
+ "types": "./dist/runtime/composables/index.d.ts",
32
+ "import": "./dist/runtime/composables/index.js"
33
+ },
34
+ "./directives": {
35
+ "types": "./dist/runtime/directives/index.d.ts",
36
+ "import": "./dist/runtime/directives/index.js"
37
+ },
38
+ "./directives/*": {
39
+ "types": "./dist/runtime/directives/*",
40
+ "import": "./dist/runtime/directives/*"
41
+ },
42
+ "./helpers": {
43
+ "types": "./dist/runtime/helpers/index.d.ts",
44
+ "import": "./dist/runtime/helpers/index.js"
45
+ },
46
+ "./helpers/*": {
47
+ "types": "./dist/runtime/helpers/*",
48
+ "import": "./dist/runtime/helpers/*"
49
+ },
50
+ "./build/*": {
51
+ "types": "./dist/runtime/build/*.d.ts",
52
+ "import": "./dist/runtime/build/*"
53
+ },
54
+ "./style.css": "./src/runtime/assets/style.css",
55
+ "./base.css": "./src/runtime/assets/base.css",
56
+ "./nuxt": {
57
+ "import": "./dist/module.mjs",
58
+ "require": "./dist/module.cjs"
59
+ },
60
+ "./types": {
61
+ "types": "./dist/runtime/types/index.d.ts",
62
+ "import": "./dist/runtime/types/index.js"
63
+ }
64
+ },
65
+ "unbuild": {
66
+ "failOnWarn": false
67
+ },
68
+ "scripts": {
69
+ "//prepare": "echo Needed so that if we pull the package from git it will get built and installed properly.",
70
+ "prepare": "husky && pnpm gen:theme && pnpm build",
71
+ "build": "nuxt-module-build prepare && nuxt-module-build build && pnpm build:playground",
72
+ "build:playground": "cd playground && pnpm link:module && pnpm generate",
73
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
74
+ "dev": "nuxi dev playground",
75
+ "storybook": "BROWSER=none storybook dev -p 6006",
76
+ "storybook:clear-cache": "BROWSER=none storybook dev -p 6006 --no-manager-cache",
77
+ "storybook:build": "pnpm nuxt prepare && storybook build -o docs/storybook",
78
+ "storybook:test": "pnpm storybook:build && pnpm concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"pnpm http-server docs/storybook --port 6006 --silent\" \"pnpm wait-on tcp:6006 && pnpm test-storybook\"",
79
+ "test": "pnpm storybook:test",
80
+ "test:types": "vue-tsc --noEmit --pretty --project tsconfig.types.json",
81
+ "doc": "pnpm test && pnpm storybook:build",
82
+ "doc:dev": "pnpm storybook",
83
+ "lint:eslint": "eslint \"{src,test,playground/app}/**/*.{js,ts,vue,cjs}\" \"*.{js,ts}\" --max-warnings=0 --report-unused-disable-directives",
84
+ "lint:types": "pnpm test:types",
85
+ "lint:commits": "commitlint --from $(git rev-list --max-parents=0 HEAD) --to HEAD --verbose",
86
+ "lint:imports": "madge --circular --extensions ts ./src",
87
+ "lint": "pnpm lint:types && pnpm lint:eslint",
88
+ "//actions:debug": "echo For debugging github build action locally with nektos/act. Requires act and docker. Note: Cache will never work locally because of https://github.com/nektos/act/issues/285",
89
+ "actions:debug": "act -r -j release",
90
+ "gen:exports": "indexit update --ignore **.d.ts **.stories.ts **.vue -o '${path}.js'",
91
+ "gen:theme": "echo src/runtime/build/generateTheme.ts"
92
+ },
93
+ "peerDependencies": {
94
+ "tailwindcss": "^4.0.17",
95
+ "vue": "^3.2.47"
96
+ },
97
+ "peerDependenciesMeta": {
98
+ "tailwindcss": {
99
+ "optional": true
100
+ },
101
+ "vue": {
102
+ "optional": false
103
+ }
104
+ },
105
+ "dependencies": {
106
+ "@alanscodelog/utils": "^5.0.0",
107
+ "@egoist/vue-to-react": "^1.2.0",
108
+ "@iconify/json": "^2.2.323",
109
+ "@nuxt/kit": "^3.16.2",
110
+ "@nuxt/schema": "^3.16.2",
111
+ "@nuxt/types": "^2.17.3",
112
+ "@tailwindcss/vite": "^4.1.0",
113
+ "@witchcraft/nuxt-utils": "^0.0.1",
114
+ "colord": "^2.9.3",
115
+ "colorjs.io": "0.6.0-alpha.1",
116
+ "defu": "^6.1.4",
117
+ "fast-glob": "^3.3.2",
118
+ "metamorphosis": "^0.4.1",
119
+ "tailwind-merge": "^3.1.0",
120
+ "unplugin-icons": "^22.1.0",
121
+ "unplugin-vue-components": "^28.4.1",
122
+ "vue-component-type-helpers": "^2.0.29"
123
+ },
124
+ "devDependencies": {
125
+ "@alanscodelog/commitlint-config": "^3.0.2",
126
+ "@alanscodelog/eslint-config": "^5.0.0",
127
+ "@alanscodelog/semantic-release-config": "^5.0.1",
128
+ "@alanscodelog/tsconfigs": "^5.0.0",
129
+ "@alanscodelog/vite-config": "^0.0.5",
130
+ "@chromatic-com/storybook": "^3.2.6",
131
+ "@commitlint/cli": "^19.3.0",
132
+ "@internationalized/date": "^3.1.0",
133
+ "@nuxt/eslint-config": "^1.3.0",
134
+ "@nuxt/module-builder": "^0.8.4",
135
+ "@nuxtjs/i18n": "^9.5.3",
136
+ "@rollup/plugin-node-resolve": "^16.0.1",
137
+ "@storybook/addon-a11y": "^8.6.12",
138
+ "@storybook/addon-actions": "^8.6.12",
139
+ "@storybook/addon-essentials": "^8.6.12",
140
+ "@storybook/addon-interactions": "^8.6.12",
141
+ "@storybook/addon-links": "^8.6.12",
142
+ "@storybook/addon-storysource": "^8.6.12",
143
+ "@storybook/blocks": "^8.6.12",
144
+ "@storybook/manager-api": "^8.6.12",
145
+ "@storybook/test": "^8.6.12",
146
+ "@storybook/test-runner": "^0.22.0",
147
+ "@storybook/vue3": "^8.6.12",
148
+ "@storybook/vue3-vite": "^8.6.12",
149
+ "@tailwindcss/postcss": "^4.1.2",
150
+ "@types/node": "^22.14.0",
151
+ "@vitejs/plugin-vue": "^5.0.4",
152
+ "@vue/runtime-core": "^3.4.27",
153
+ "@playwright/test": "=1.50.0",
154
+ "playwright": "=1.50.0",
155
+ "@vue/runtime-dom": "^3.4.27",
156
+ "@vueuse/components": "^13.0.0",
157
+ "@vueuse/core": "^13.0.0",
158
+ "autoprefixer": "^10.4.19",
159
+ "concurrently": "^9.1.2",
160
+ "eslint": "=9.12.0",
161
+ "eslint-plugin-jsdoc": "^48.0.0",
162
+ "http-server": "^14.1.1",
163
+ "husky": "^9.0.11",
164
+ "indexit": "2.1.0-beta.3",
165
+ "madge": "^7.0.0",
166
+ "nuxt": "^3.16.2",
167
+ "radix-vue": "^1.9.11",
168
+ "semantic-release": "^24.1.2",
169
+ "storybook": "^8.6.12",
170
+ "storybook-dark-mode": "^4.0.2",
171
+ "tailwindcss": "^4.1.2",
172
+ "ts-node": "^10.9.2",
173
+ "typescript": "~5.8.2",
174
+ "unbuild": "^3.5.0",
175
+ "vite": "^6.2.5",
176
+ "vite-plugin-externalize-deps": "^0.9.0",
177
+ "vite-tsconfig-paths": "^5.0.1",
178
+ "playwright-core": "=1.50.0",
179
+ "vue": "^3.5.13",
180
+ "vue-tsc": "^2.0.19",
181
+ "wait-on": "^8.0.3"
182
+ },
183
+ "author": "Alan <alanscodelog@gmail.com>",
184
+ "repository": "https://github.com/witchcraftjs/ui",
185
+ "license": "MIT",
186
+ "files": [
187
+ "src",
188
+ "dist",
189
+ "types"
190
+ ],
191
+ "release": {
192
+ "extends": [
193
+ "@alanscodelog/semantic-release-config"
194
+ ]
195
+ },
196
+ "commitlint": {
197
+ "extends": [
198
+ "@alanscodelog"
199
+ ]
200
+ },
201
+ "engines": {
202
+ "node": ">=20.0.0"
203
+ },
204
+ "publishConfig": {
205
+ "access": "public"
206
+ }
207
+ }
package/src/module.ts ADDED
@@ -0,0 +1,176 @@
1
+ import { crop, indent } from "@alanscodelog/utils"
2
+ import {
3
+ addComponent,
4
+ addImports, addTemplate, addTypeTemplate,
5
+ createResolver,
6
+ defineNuxtModule,
7
+ installModule,
8
+ useLogger,
9
+ } from "@nuxt/kit"
10
+ import tailwindcss from "@tailwindcss/vite"
11
+ import { addImportsCustom, globFiles } from "@witchcraft/nuxt-utils/utils"
12
+ import { defu } from "defu"
13
+ import fs from "fs"
14
+ import { themeAsTailwindCss } from "metamorphosis/tailwind"
15
+ import IconsResolver from "unplugin-icons/resolver"
16
+ import Icons from "unplugin-icons/vite"
17
+ import ViteComponents from "unplugin-vue-components/vite"
18
+
19
+ import { unpluginIconViteOptions } from "./runtime/build/unpluginIconViteOptions.js"
20
+ import { themeConvertionOpts } from "./runtime/tailwind/themeConvertionOpts.js"
21
+ import { theme } from "./runtime/theme.js"
22
+ const knownDirectives = ["vExtractRootEl", "vResizableCols", "vResizeObserver", "vResizableCols"] as const
23
+
24
+ const { resolve, resolvePath } = createResolver(import.meta.url)
25
+
26
+ const componentsInfo: { name: string, filepath: string }[] = globFiles([
27
+ `${resolve("./runtime/components")}/**/*.vue*`,
28
+ `!**/Template/**.vue`,
29
+ ],[], (filepath: string, name: string) => ({
30
+ name: name.startsWith("Lib") ? name.replace("Lib", "PREFIX") : `PREFIX${name}`,
31
+ filepath,
32
+ }))
33
+
34
+ declare module "@nuxt/schema" {
35
+ interface PublicRuntimeConfig {
36
+ witchcraftUi: Pick<ModuleOptions, "directives">
37
+ }
38
+ }
39
+
40
+
41
+ export interface ModuleOptions {
42
+ /**
43
+ * Whether to include the vite unplugin-icons plugins (pre-configured with the ui module's defaults.
44
+ *
45
+ * @default true
46
+ */
47
+ includeUnpluginIconsPlugins?: boolean
48
+ directives: (typeof knownDirectives[number])[]
49
+ /**
50
+ * Which components (without a prefix) to register for auto-importing globally.
51
+ */
52
+ globalComponents: string[]
53
+ /**
54
+ * @default "W"
55
+ */
56
+ componentPrefix: string
57
+ debug?: boolean
58
+ /**
59
+ * @default "~/assets/css/tailwind.css"
60
+ */
61
+ mainCssFile?: string
62
+ }
63
+
64
+ export default defineNuxtModule<ModuleOptions>({
65
+ meta: {
66
+ name: "witchcraftUi",
67
+ configKey: "witchcraftUi",
68
+ },
69
+ defaults: {
70
+ includeUnpluginIconsPlugins: true,
71
+ directives: [ ...knownDirectives ],
72
+ globalComponents: [
73
+ ...componentsInfo.map(_ => _.name.slice("PREFIX".length)),
74
+ ],
75
+ componentPrefix: "W",
76
+ debug: true,
77
+ mainCssFile: "~/assets/css/tailwind.css",
78
+ },
79
+ async setup(options, nuxt) {
80
+ const moduleName = "@witchcraft/ui"
81
+ const logger = useLogger(moduleName, { level: options.debug ? 10 : 0 })
82
+
83
+ const filteredComponentsInfo: typeof componentsInfo = []
84
+ for (const component of componentsInfo) {
85
+ const prefixless = component.name.slice("PREFIX".length)
86
+ component.name = options.componentPrefix + prefixless
87
+ if (options.globalComponents.includes(prefixless)) {
88
+ filteredComponentsInfo.push(component)
89
+ }
90
+ }
91
+
92
+
93
+ const unknownDirectives = options.directives.filter(_ => !knownDirectives.includes(_))
94
+ if (unknownDirectives.length > 0) {
95
+ throw new Error(`Witchcraft Components: Directives list contains unknown directives: ${unknownDirectives.join(",")}`)
96
+ }
97
+ nuxt.options.runtimeConfig.public.witchcraftUi = defu(
98
+ nuxt.options.runtimeConfig.public.witchcraftUi,
99
+ {
100
+ directives: options.directives,
101
+ }
102
+ )
103
+
104
+
105
+ const contents = [
106
+ ...componentsInfo.map(_ => _.filepath)
107
+ ]
108
+ addTemplate({
109
+ filename: "witchcraft-ui.css",
110
+ write: true,
111
+ getContents: () => crop`
112
+ ${indent(themeAsTailwindCss(theme, themeConvertionOpts), 4)}
113
+ @import "@witchcraft/ui/style.css";
114
+ @import "@witchcraft/ui/base.css";
115
+ ${indent(contents.map(_ => `@source "${_}";`).join("\n"), 4)}
116
+ `,
117
+ })
118
+
119
+
120
+ await Promise.all(filteredComponentsInfo
121
+ .map(async entry => addComponent({
122
+ filePath: entry.filepath,
123
+ name: entry.name,
124
+ global: options.globalComponents.includes(entry.name.slice(options.componentPrefix.length)),
125
+ }))
126
+ )
127
+
128
+ logger.info(`Added components: ${filteredComponentsInfo.map(_ => _.name).join(", ")}`)
129
+
130
+ const added: string[] = []
131
+ addImportsCustom([
132
+ `${resolve("runtime/composables")}/**/*`,
133
+ `${resolve("runtime/utils")}/**/*`,
134
+ ], [],(filePath: string, name: string) => {
135
+ added.push(name)
136
+ return addImports({
137
+ name,
138
+ from: filePath,
139
+ })
140
+ })
141
+ logger.info(`Added imports: ${added.join(", ")}`)
142
+
143
+ nuxt.hook("vite:extendConfig", async config => {
144
+ if (options.includeUnpluginIconsPlugins) {
145
+ logger.info(`Adding unplugin-icons`)
146
+ config.plugins ??= []
147
+ config.plugins = [
148
+ // we must prepend or the custom style options don't work when the module is used
149
+ ViteComponents({
150
+ resolvers: [
151
+ IconsResolver(),
152
+ // we don't need our resolver since we use nuxt instead
153
+ ],
154
+ }),
155
+ Icons({
156
+ ...unpluginIconViteOptions,
157
+ }),
158
+ tailwindcss() as any,
159
+ ...config.plugins,
160
+ ]
161
+ }
162
+ })
163
+ nuxt.options.css.push(await resolvePath(options.mainCssFile!, nuxt.options.alias))
164
+ // we need to hook in first before it does, otherwise the plugins don't load correctly
165
+ await installModule("unplugin-icons/nuxt")
166
+
167
+ // todo make names more specific
168
+ // addImportsDir(resolve("helpers"))
169
+ nuxt.options.alias["#witchcraft-ui"] = resolve("runtime")
170
+ nuxt.options.alias["#witchcraft-ui-helpers"] = resolve("runtime/helpers")
171
+ addTypeTemplate({
172
+ filename: "types/witchcraft-ui.d.ts",
173
+ getContents: () => fs.readFileSync(resolve("../types/global.d.ts")).toString(),
174
+ })
175
+ },
176
+ })
@@ -0,0 +1,67 @@
1
+ .v-enter-active,
2
+ .v-leave-active {
3
+ transition: opacity 0.5s ease;
4
+ }
5
+
6
+ .v-enter-from,
7
+ .v-leave-to {
8
+ opacity: 0;
9
+ }
10
+
11
+ .list-move,
12
+ /* apply transition to moving elements */
13
+ .list-enter-active,
14
+ .list-leave-active {
15
+ transition: all 0.5s ease;
16
+ }
17
+
18
+ .list-enter-from,
19
+ .list-leave-to {
20
+ opacity: 0;
21
+ transform: translateX(30px);
22
+ }
23
+
24
+ /* ensure leaving items are taken out of layout flow so that moving
25
+ animations can be calculated correctly. */
26
+ .list-leave-active {
27
+ position: absolute;
28
+ }
29
+
30
+ /* prevent accidental selection/clicks on moving/disappearing elements */
31
+ .list-move,
32
+ .list-leave-to {
33
+ pointer-events: none;
34
+ user-select: none;
35
+ }
36
+
37
+ /* Animations */
38
+ @keyframes blink {
39
+ 0% {
40
+ opacity: 0;
41
+ }
42
+
43
+ 25% {
44
+ opacity: 1;
45
+ }
46
+
47
+ 75% {
48
+ opacity: 1;
49
+ }
50
+
51
+ 100% {
52
+ opacity: 0;
53
+ }
54
+ }
55
+
56
+ @keyframes slide {
57
+ 0% {
58
+ background-position:0%;
59
+ }
60
+ 100% {
61
+ background-position: 100%;
62
+ }
63
+ }
64
+
65
+ a {
66
+ @apply link-like;
67
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "witchcraft-ui": {
3
+ "file-input.accepted-formats": "Accepted Formats",
4
+ "file-input.compact-choose-file": "Choose File",
5
+ "file-input.compact-choose-file-plural": "Choose Files",
6
+ "file-input.non-compact-choose-file": "Drag & Drop File",
7
+ "file-input.non-compact-choose-file-plural": "Drag & Drop Files",
8
+ "color-picker.pick-color": "Pick Color",
9
+ "cancel": "Cancel",
10
+ "save": "Save",
11
+ "copy": "Copy",
12
+ "color-picker.aria": "Color Picker",
13
+ "color-picker.aria.saturation": "Saturation",
14
+ "color-picker.aria.hue": "Hue",
15
+ "color-picker.aria.value": "Value",
16
+ "color-picker.aria.hue-slider": "Hue Slider",
17
+ "color-picker.aria.alpha-slider": "Alpha Slider",
18
+ "color-picker.aria.description": "Use the arrow keys to move the handle, or use shift to move in 10 pixel increments.",
19
+ "dark-mode-switcher.title": "Switch dark mode type, current: ",
20
+ "dark-mode-switcher.system": "System",
21
+ "dark-mode-switcher.dark": "Dark",
22
+ "dark-mode-switcher.light": "Light",
23
+ "pagination.aria": "Pagination Navigation",
24
+ "pagination.aria.go-to-previous-page": "Go to previous page. Page {count}",
25
+ "pagination.aria.go-to-next-page": "Go to next page. Page {count}",
26
+ "pagination.aria.go-to-page": "Go to page {count}",
27
+ "pagination.aria.current-page": "Current page {count}",
28
+ "pagination.previous-page": "Prev",
29
+ "pagination.next-page": "Next",
30
+ "recorder.recording": "Recording",
31
+ "":"hate forgetting json can't handle a trailing comma"
32
+ }
33
+ }