@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
package/README.md ADDED
@@ -0,0 +1,236 @@
1
+ ### 🚧 WORK IN PROGRESS 🚧
2
+ [![Docs](https://github.com/witchcraftjs/ui/workflows/Docs/badge.svg)](https://github.com/witchcraftjs/ui/actions/workflows/docs.yml)
3
+ [![Release](https://github.com/witchcraftjs/ui/actions/workflows/release.yml/badge.svg)](https://github.com/witchcraftjs/ui/actions/workflows/release.yml)
4
+ [![NPM Version (with latest tag)](https://img.shields.io/npm/v/%40witchcraft%2Fui/latest)](https://www.npmjs.com/package/@witchcraft/ui/v/latest)
5
+
6
+ Opinionated, batteries included, vue/nuxt component library + some related utils.
7
+
8
+ - Built with accessibility in mind.
9
+ - Themable via [metamorphosis](https://github.com/alanscodelog/metamorphosis) which allows providing a custom set of tailwind variables for easier application theming (e.g. \*-fg, \*-bg, \*-accent). No regular tailwind colors are used except neutral.
10
+ - Easily tweak parts of a component via props without having to pass complicate objects. For example, the input component can take a `wrapper-class` attribute to style it's wrapper.
11
+ - Simple components have an `unstyle` option to use them minimally styled if needed\*
12
+
13
+ This is unfortunately not true styleless since the tailwind classes are still in the build output.
14
+
15
+ # [Storybook](https://witchcraftjs.github.io/ui/storybook)
16
+
17
+ # Usage with Nuxt
18
+
19
+ Modules, composables, and directives should work out of the box without auto imports.
20
+
21
+ ## Tailwind (V4)
22
+
23
+ The module automatically sets up tailwind v4 and generates a custom `witchcraft-ui.css` file with the proper imports, just add it in your tailwind css file.
24
+
25
+ It does not install "@nuxtjs/tailwindcss" for now since it's not compatible with v4. See [#919](https://github.com/nuxt-modules/tailwindcss/issues/919).
26
+
27
+ ```css[~/assets/css/tailwind.css]
28
+ @import "@tailwindcss";
29
+ @import "../../../.nuxt/witchcraft-ui.css";
30
+ ```
31
+
32
+ ## Icons
33
+
34
+ The module also installs the `unplugin-icons/nuxt` module and configures it with a custom config styles icons a bit better. This can be disabled with the `includeUnpluginIconsPlugins` option.
35
+
36
+ ## Other
37
+
38
+ There are some additional helpers that are not auto imported. These can be imported from `#witchcraft-ui-helpers`.
39
+
40
+ Anything else that might be needed can be imported from `#witchcraft-ui`.
41
+
42
+ # General Usage
43
+
44
+ # Props
45
+
46
+ To make it easier to style parts of components or override behavior, some components can accept additional prefixed attributes, for example, you can pass `wrapper-class` to the input component to style it's wrapper.
47
+
48
+ I think this is nicer in general than having to pass an object with extra attributes. The only weird part, is because of how vue changes the case of props, for attributes like `innerHTML` you will need to pass `{prefix}-inner-h-t-m-l`, but all components have proper types to help this. Similarly events look like `{prefix}-on-click`.
49
+
50
+ # Slots
51
+
52
+ Usually it is possible to do most modifications through props, but slots to replace parts of components are available.
53
+
54
+ Most slots where possible are passed all properties needed to replace them except classes so you can do something like this, to for example replace the simple input component inside the input component.
55
+
56
+ ```vue
57
+ <lib-input>
58
+ <template #input="slotProps">
59
+ <lib-simple-input
60
+ :class="'completely custom styles'"
61
+ v-bind="slotProps"
62
+ ></lib-simple-input>
63
+ </template>
64
+ </lib-input>
65
+
66
+ ```
67
+
68
+ # Other
69
+
70
+ ## Standalone Usage
71
+
72
+ ```ts
73
+ import { defineConfig } from "vite"
74
+
75
+ import { WitchcraftUiResolver } from "@witchcraft/ui/build/WitchcraftUiResolver.js"
76
+ import IconsResolver from "unplugin-icons/resolver"
77
+ import Icons from "unplugin-icons/vite"
78
+ import Components from "unplugin-vue-components/vite"
79
+ import { unpluginIconViteOptions } from "@witchcraft/ui/build/unpluginIconViteOptions.js"
80
+
81
+ export default defineConfig({
82
+ plugins: [
83
+ vue() as any,
84
+ Components({
85
+ resolvers: [
86
+ // required
87
+ IconsResolver(),
88
+ // to enable auto-imports
89
+ // not-required
90
+ WitchcraftUiResolver({
91
+ // optionally change the prefix
92
+ prefix: "W",
93
+ filter: (name) => name !== "...",
94
+ }),
95
+ ],
96
+ dts: "./types/components.d.ts",
97
+ }),
98
+ // style the icons correctly
99
+ Icons(unpluginIconViteOptions)
100
+ ],
101
+ })
102
+ ```
103
+
104
+ See [@witchcraft/editor/vite.config.dev.ts].
105
+
106
+ ### Setting up Tailwind
107
+
108
+ #### Extra Classes
109
+
110
+ ```css
111
+ @import "@witchcraft/ui/style.css"; /* tailwind v4 style utils - required */
112
+ @import "@witchcraft/ui/base.css";
113
+ @source "@witchcraft/ui/src/runtime/components";
114
+ ```
115
+ Base just contains animation keyframes and basic styles for vue animations. They will get imported regardless of whether they are used since otherwise tailwind does not detect they are being used.
116
+
117
+
118
+ #### Tailwind Configuration
119
+
120
+ This module does everything v4 style, so no configuration is needed.
121
+
122
+
123
+ #### tailwind-merge
124
+
125
+ The library provides a customized twMerge instance (`@witchcraft-ui/utils/twMere.js`). You will need to use it or import the options it extends and customize your twMerge instance.
126
+
127
+ ### Icons
128
+
129
+ This library uses unplugin-icons to provide icons. It installs as a dependency to have all icons available `@iconify/json` since it uses various icons.
130
+
131
+
132
+ ### Getting Proper Types
133
+
134
+ While components should be correctly typed, the library internally extends vue's interfaces to allow data-* attributes and also some missing aria attributes (like `aria-description`).
135
+
136
+ You might need to customize these by adding the following in a global d.ts.
137
+
138
+ ```ts
139
+ // to make the component types globally available you can do:
140
+ import { GlobalComponentTypes } from "@witchcraft/ui"
141
+ declare module "@vue/runtime-core" {
142
+ interface GlobalComponents extends GlobalComponentTypes { }
143
+ }
144
+
145
+ // to add more attributes yourself you can do:
146
+ declare module "vue" {
147
+ interface HTMLAttributes {
148
+ // ...
149
+ }
150
+ interface AriaAttributes {
151
+ // ...
152
+ }
153
+ interface ComponentCustomProps {
154
+ // ...
155
+ }
156
+ }
157
+ export {}
158
+ ```
159
+
160
+ Note that using the strictTemplates compiler option can cause weird issues with fallthrough props.
161
+
162
+
163
+ # Development
164
+
165
+ ## Props
166
+
167
+ Due to issues with vue 3 removing $listeners and the fact that we can't inherit from an existing HTML attribute types to specify props for wrapper components (most of them), we have to declare props in a convoluted way to get proper types when we consume the componenets.
168
+
169
+ Here is an example of the needed code for props to work correctly:
170
+ ```vue
171
+ <script lang="ts">
172
+ // this is done in a seperate script so that it actually compiles
173
+ // and we can have interface merging, a setup script cannot interface merge
174
+
175
+ import type { BaseInteractiveProps } from "../shared/props.js"
176
+
177
+ // if using useDivideAttrs, we need to do the below for each prefix
178
+ // a helper type WrapperProps is provided to do this
179
+ type WrapperTypes = (WrapperProps<"wrapper", HTMLAttributes, {
180
+ // overrides
181
+ /** Tailwind classes. */
182
+ class:string;
183
+ }>)
184
+
185
+ // real props vue can understand, they will show up under props.*
186
+ type RealProps =
187
+ // simple types are okay
188
+ & BaseInteractiveProps
189
+ & {
190
+ // any ignored props that we need to use in the component template
191
+ // will need to be re-defined so vue can see them
192
+ // in a way vue can see them if it's one of the problem properties
193
+ id?: InputHTMLAttributes["id"]
194
+ }
195
+
196
+
197
+ interface Props
198
+ extends
199
+ // we need to ignore the complex InputHTMLAttributes type
200
+ // otherwise vue compilation fails
201
+ // if we ignore it, all it's properties are passed as fallback attrs
202
+ // NOT to props as normal
203
+ // we also need to omit properties or events that the component overrides with a different type
204
+ /** @vue-ignore */
205
+ Partial<Omit<InputHTMLAttributes,"class" | "onSubmit"> & {
206
+ // overrides for the components
207
+ // usually, for example, class can only be a string (because of tailwind)
208
+ // this is still part of the ignored type above
209
+ // it will be passed as an attr
210
+ class?:string
211
+ }>,
212
+ /** @vue-ignore */
213
+ Partial<WrapperTypes>,
214
+ RealProps
215
+ { }
216
+ </script>
217
+
218
+ <script lang="ts" setup>
219
+ // eslint-disable-next-line no-duplicate-imports
220
+ import { baseInteractivePropsDefaults } from "../shared/props.js"
221
+
222
+ const props = withDefaults(defineProps<Props>(), {
223
+ id: "",
224
+ ...baseInteractivePropsDefaults
225
+ })
226
+ const $ = useDivideAttrs(["wrapper"] as const)
227
+ </script>
228
+ ```
229
+
230
+ For prop types that don't error, I think we can just define them normally, but then it turns into a mess, some components will have their values in props, some in $attrs, this way. This is consistent and also more in line with what we expect.
231
+
232
+ Related Links:
233
+ - https://github.com/vuejs/rfcs/discussions/397
234
+ - https://github.com/vuejs/core/issues/8522
235
+ - https://github.com/vuejs/rfcs/pull/477
236
+ - https://github.com/vuejs/language-tools/issues/1232#issuecomment-1118176103
@@ -0,0 +1,5 @@
1
+ module.exports = function(...args) {
2
+ return import('./module.mjs').then(m => m.default.call(this, ...args))
3
+ }
4
+ const _meta = module.exports.meta = require('./module.json')
5
+ module.exports.getMeta = () => Promise.resolve(_meta)
@@ -0,0 +1,34 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ declare const knownDirectives: readonly ["vExtractRootEl", "vResizableCols", "vResizeObserver", "vResizableCols"];
4
+ declare module "@nuxt/schema" {
5
+ interface PublicRuntimeConfig {
6
+ witchcraftUi: Pick<ModuleOptions, "directives">;
7
+ }
8
+ }
9
+ interface ModuleOptions {
10
+ /**
11
+ * Whether to include the vite unplugin-icons plugins (pre-configured with the ui module's defaults.
12
+ *
13
+ * @default true
14
+ */
15
+ includeUnpluginIconsPlugins?: boolean;
16
+ directives: (typeof knownDirectives[number])[];
17
+ /**
18
+ * Which components (without a prefix) to register for auto-importing globally.
19
+ */
20
+ globalComponents: string[];
21
+ /**
22
+ * @default "W"
23
+ */
24
+ componentPrefix: string;
25
+ debug?: boolean;
26
+ /**
27
+ * @default "~/assets/css/tailwind.css"
28
+ */
29
+ mainCssFile?: string;
30
+ }
31
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
32
+
33
+ export { _default as default };
34
+ export type { ModuleOptions };
@@ -0,0 +1,34 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+
3
+ declare const knownDirectives: readonly ["vExtractRootEl", "vResizableCols", "vResizeObserver", "vResizableCols"];
4
+ declare module "@nuxt/schema" {
5
+ interface PublicRuntimeConfig {
6
+ witchcraftUi: Pick<ModuleOptions, "directives">;
7
+ }
8
+ }
9
+ interface ModuleOptions {
10
+ /**
11
+ * Whether to include the vite unplugin-icons plugins (pre-configured with the ui module's defaults.
12
+ *
13
+ * @default true
14
+ */
15
+ includeUnpluginIconsPlugins?: boolean;
16
+ directives: (typeof knownDirectives[number])[];
17
+ /**
18
+ * Which components (without a prefix) to register for auto-importing globally.
19
+ */
20
+ globalComponents: string[];
21
+ /**
22
+ * @default "W"
23
+ */
24
+ componentPrefix: string;
25
+ debug?: boolean;
26
+ /**
27
+ * @default "~/assets/css/tailwind.css"
28
+ */
29
+ mainCssFile?: string;
30
+ }
31
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
32
+
33
+ export { _default as default };
34
+ export type { ModuleOptions };
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "witchcraftUi",
3
+ "configKey": "witchcraftUi",
4
+ "version": "0.0.1",
5
+ "builder": {
6
+ "@nuxt/module-builder": "0.8.4",
7
+ "unbuild": "3.5.0"
8
+ }
9
+ }
@@ -0,0 +1,124 @@
1
+ import { crop, indent } from '@alanscodelog/utils';
2
+ import { createResolver, defineNuxtModule, useLogger, addTemplate, addComponent, addImports, installModule, addTypeTemplate } from '@nuxt/kit';
3
+ import tailwindcss from '@tailwindcss/vite';
4
+ import { globFiles, addImportsCustom } from '@witchcraft/nuxt-utils/utils';
5
+ import { defu } from 'defu';
6
+ import fs from 'fs';
7
+ import { themeAsTailwindCss } from 'metamorphosis/tailwind';
8
+ import IconsResolver from 'unplugin-icons/resolver';
9
+ import Icons from 'unplugin-icons/vite';
10
+ import ViteComponents from 'unplugin-vue-components/vite';
11
+ import { unpluginIconViteOptions } from '../dist/runtime/build/unpluginIconViteOptions.js';
12
+ import { themeConvertionOpts } from '../dist/runtime/tailwind/themeConvertionOpts.js';
13
+ import { theme } from '../dist/runtime/theme.js';
14
+
15
+ const knownDirectives = ["vExtractRootEl", "vResizableCols", "vResizeObserver", "vResizableCols"];
16
+ const { resolve, resolvePath } = createResolver(import.meta.url);
17
+ const componentsInfo = globFiles([
18
+ `${resolve("./runtime/components")}/**/*.vue*`,
19
+ `!**/Template/**.vue`
20
+ ], [], (filepath, name) => ({
21
+ name: name.startsWith("Lib") ? name.replace("Lib", "PREFIX") : `PREFIX${name}`,
22
+ filepath
23
+ }));
24
+ const module = defineNuxtModule({
25
+ meta: {
26
+ name: "witchcraftUi",
27
+ configKey: "witchcraftUi"
28
+ },
29
+ defaults: {
30
+ includeUnpluginIconsPlugins: true,
31
+ directives: [...knownDirectives],
32
+ globalComponents: [
33
+ ...componentsInfo.map((_) => _.name.slice("PREFIX".length))
34
+ ],
35
+ componentPrefix: "W",
36
+ debug: true,
37
+ mainCssFile: "~/assets/css/tailwind.css"
38
+ },
39
+ async setup(options, nuxt) {
40
+ const moduleName = "@witchcraft/ui";
41
+ const logger = useLogger(moduleName, { level: options.debug ? 10 : 0 });
42
+ const filteredComponentsInfo = [];
43
+ for (const component of componentsInfo) {
44
+ const prefixless = component.name.slice("PREFIX".length);
45
+ component.name = options.componentPrefix + prefixless;
46
+ if (options.globalComponents.includes(prefixless)) {
47
+ filteredComponentsInfo.push(component);
48
+ }
49
+ }
50
+ const unknownDirectives = options.directives.filter((_) => !knownDirectives.includes(_));
51
+ if (unknownDirectives.length > 0) {
52
+ throw new Error(`Witchcraft Components: Directives list contains unknown directives: ${unknownDirectives.join(",")}`);
53
+ }
54
+ nuxt.options.runtimeConfig.public.witchcraftUi = defu(
55
+ nuxt.options.runtimeConfig.public.witchcraftUi,
56
+ {
57
+ directives: options.directives
58
+ }
59
+ );
60
+ const contents = [
61
+ ...componentsInfo.map((_) => _.filepath)
62
+ ];
63
+ addTemplate({
64
+ filename: "witchcraft-ui.css",
65
+ write: true,
66
+ getContents: () => crop`
67
+ ${indent(themeAsTailwindCss(theme, themeConvertionOpts), 4)}
68
+ @import "@witchcraft/ui/style.css";
69
+ @import "@witchcraft/ui/base.css";
70
+ ${indent(contents.map((_) => `@source "${_}";`).join("\n"), 4)}
71
+ `
72
+ });
73
+ await Promise.all(
74
+ filteredComponentsInfo.map(async (entry) => addComponent({
75
+ filePath: entry.filepath,
76
+ name: entry.name,
77
+ global: options.globalComponents.includes(entry.name.slice(options.componentPrefix.length))
78
+ }))
79
+ );
80
+ logger.info(`Added components: ${filteredComponentsInfo.map((_) => _.name).join(", ")}`);
81
+ const added = [];
82
+ addImportsCustom([
83
+ `${resolve("runtime/composables")}/**/*`,
84
+ `${resolve("runtime/utils")}/**/*`
85
+ ], [], (filePath, name) => {
86
+ added.push(name);
87
+ return addImports({
88
+ name,
89
+ from: filePath
90
+ });
91
+ });
92
+ logger.info(`Added imports: ${added.join(", ")}`);
93
+ nuxt.hook("vite:extendConfig", async (config) => {
94
+ if (options.includeUnpluginIconsPlugins) {
95
+ logger.info(`Adding unplugin-icons`);
96
+ config.plugins ??= [];
97
+ config.plugins = [
98
+ // we must prepend or the custom style options don't work when the module is used
99
+ ViteComponents({
100
+ resolvers: [
101
+ IconsResolver()
102
+ // we don't need our resolver since we use nuxt instead
103
+ ]
104
+ }),
105
+ Icons({
106
+ ...unpluginIconViteOptions
107
+ }),
108
+ tailwindcss(),
109
+ ...config.plugins
110
+ ];
111
+ }
112
+ });
113
+ nuxt.options.css.push(await resolvePath(options.mainCssFile, nuxt.options.alias));
114
+ await installModule("unplugin-icons/nuxt");
115
+ nuxt.options.alias["#witchcraft-ui"] = resolve("runtime");
116
+ nuxt.options.alias["#witchcraft-ui-helpers"] = resolve("runtime/helpers");
117
+ addTypeTemplate({
118
+ filename: "types/witchcraft-ui.d.ts",
119
+ getContents: () => fs.readFileSync(resolve("../types/global.d.ts")).toString()
120
+ });
121
+ }
122
+ });
123
+
124
+ export { module as default };
@@ -0,0 +1 @@
1
+ .v-enter-active,.v-leave-active{transition:opacity .5s ease}.v-enter-from,.v-leave-to{opacity:0}.list-enter-active,.list-leave-active,.list-move{transition:all .5s ease}.list-enter-from,.list-leave-to{opacity:0;transform:translateX(30px)}.list-leave-active{position:absolute}.list-leave-to,.list-move{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}@keyframes blink{0%{opacity:0}25%{opacity:1}75%{opacity:1}to{opacity:0}}@keyframes slide{0%{background-position:0}to{background-position:100%}}a{@apply link-like}
@@ -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
+ }
@@ -0,0 +1 @@
1
+ @custom-variant dark (&:where(.dark, .dark *));@utility focus-outline-within{@apply outlined-within:outline-hidden outlined-within:ring-2 outlined-within:ring-accent-500 outlined-within:ring-offset-2}@utility focus-outline{@apply outlined:outline-hidden outlined:ring-2 outlined:ring-accent-500 outlined:ring-offset-2}@utility focus-outline-no-offset{@apply outlined:outline-hidden outlined:ring-2 outlined:ring-accent-500}@utility focus-outline-hidden{@apply outlined:outline-hidden}@utility bg-squares-gradient{--_square:var(--squareSize,5px);--_double_square:calc(var(--_square)*2);--_light_square:var(--lightSquare,var(--color-white));--_dark_square:var(--darkSquare,var(--color-black));background-color:var(--_light_square);background:repeating-conic-gradient(var(--_dark_square) 0 25%,var(--_light_square) 0 50%) 50% /var(--_double_square) var(--_double_square)}@utility square-light-*{--lightSquare:--value(--color- *)}@utility square-dark-*{--darkSquare:--value(--color- *)}@utility square-size-*{--squareSize:calc(--value(integer) * 1px)}@utility bg-bars-gradient{--_bg_color:var(--bars-bg-color,var(--color-accent-700));--_fg_color:var(--bars-fg-color,var(--color-accent-800));--_angle:var(--bars-angle,45deg);--_fg_width:var(--bars-fg-width,50%);--_bg_width:calc(100% - var(--_fg_width));background-color:var(--_bg_color);--_pos_1:calc(var(--_bg_width)/2);--_pos_2:calc(var(--_bg_width)/2 + var(--_fg_width)/2);--_pos_3:calc(var(--_bg_width) + var(--_fg_width)/2);background-image:repeating-linear-gradient(var(--_angle),var(--_bg_color),var(--_bg_color) var(--_pos_1),var(--_fg_color) var(--_pos_1),var(--_fg_color) var(--_pos_2),var(--_bg_color) var(--_pos_2),var(--_bg_color) var(--_pos_3),var(--_fg_color) var(--_pos_3),var(--_fg_color))}@utility bars-angle-*{--bars-angle:var(--value(integer) * 1deg)}@utility bars-fg-*{--bars-fg-color:--value(--color-*)}@utility bars-bg-*{--bars-bg-color:--value(--color-*)}@utility bars-w-*{--bars-fg-width:calc(--value(integer) * 1%, 50%)}@utility scrollbar-hidden{-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none}}@utility content-vertical-holder{--tw-content:"\200b";content:var(--tw-content)}@utility no-touch-action{touch-action:none}@utility bg-transparency-squares{@apply bg-squares-gradient square-light-white square-dark-neutral-300 square-size-6}@utility link-like{@apply cursor-pointer hover:text-accent-500}
@@ -0,0 +1 @@
1
+ @import "tailwindcss" source("../../");@import "./theme.css";@import "./base.css";@import "./style.css";
@@ -0,0 +1 @@
1
+ @theme{--spacing:0.25rem;--color-neutral-100:oklch(0.9700000000000002 0 0);--color-neutral-200:oklch(0.922 0 0);--color-neutral-300:oklch(0.8700000000000001 0 0);--color-neutral-400:oklch(0.708 0 0);--color-neutral-500:oklch(0.5560000000000002 0 0);--color-neutral-600:oklch(0.4390000000000001 0 0);--color-neutral-700:oklch(0.371 0 0);--color-neutral-800:oklch(0.2690000000000001 0 0);--color-neutral-900:oklch(0.20500000000000004 0 0);--color-neutral-950:oklch(0.14500000000000002 0 0);--color-neutral-50:oklch(0.9850000000000003 0 0);--color-bg:oklch(0.9924098465974739 0 0);--color-fg:oklch(0.09181475833376385 0 0);--color-ok-50:oklch(0.9820000000000003 0.018000000000000457 155.82600000000036);--color-ok-100:oklch(0.9620000000000002 0.0440000000000005 156.7430000000004);--color-ok-200:oklch(0.9250000000000002 0.08400000000000035 155.99500000000012);--color-ok-300:oklch(0.8710000000000001 0.1500000000000003 154.44900000000007);--color-ok-400:oklch(0.7920000000000003 0.20900000000000052 151.71100000000013);--color-ok-600:oklch(0.6270000000000001 0.19400000000000042 149.21400000000006);--color-ok-700:oklch(0.527 0.15400000000000028 150.06900000000007);--color-ok-800:oklch(0.448 0.11900000000000009 151.32800000000003);--color-ok-900:oklch(0.39299999999999996 0.09500000000000014 152.53500000000008);--color-ok-950:oklch(0.26600000000000007 0.06499999999999999 152.93399999999997);--color-ok-500:oklch(0.7230000000000002 0.21900000000000014 149.57900000000006);--color-warning-50:oklch(0.9870000000000002 0.026000000000000044 102.2120000000017);--color-warning-100:oklch(0.9730000000000001 0.07100000000000001 103.19300000000027);--color-warning-200:oklch(0.9450000000000003 0.12900000000000011 101.54000000000019);--color-warning-300:oklch(0.9050000000000001 0.18200000000000002 98.11100000000027);--color-warning-400:oklch(0.8520000000000003 0.19900000000000007 91.93600000000015);--color-warning-600:oklch(0.6810000000000002 0.16200000000000006 75.83400000000023);--color-warning-700:oklch(0.5540000000000002 0.135 66.44200000000001);--color-warning-800:oklch(0.4760000000000001 0.11399999999999987 61.90700000000004);--color-warning-900:oklch(0.4210000000000002 0.0949999999999999 57.70800000000014);--color-warning-950:oklch(0.28600000000000014 0.06599999999999996 53.8130000000001);--color-warning-500:oklch(0.7950000000000003 0.18400000000000002 86.0470000000002);--color-danger-50:oklch(0.9710000000000001 0.012999999999999515 17.380000000000223);--color-danger-100:oklch(0.936 0.03199999999999968 17.717000000000212);--color-danger-200:oklch(0.8850000000000001 0.062000000000000006 18.33400000000006);--color-danger-300:oklch(0.8079999999999999 0.11399999999999981 19.57099999999997);--color-danger-400:oklch(0.7040000000000002 0.19099999999999973 22.216000000000008);--color-danger-500:oklch(0.637 0.2369999999999997 25.331000000000017);--color-danger-600:oklch(0.5770000000000002 0.24499999999999952 27.325000000000045);--color-danger-700:oklch(0.5050000000000001 0.21299999999999994 27.51800000000003);--color-danger-800:oklch(0.444 0.1769999999999998 26.899);--color-danger-900:oklch(0.3960000000000002 0.14099999999999965 25.723000000000127);--color-danger-950:oklch(0.25800000000000006 0.09199999999999989 26.04200000000003);--color-accent-50:oklch(0.9700000000000001 0.01400000000000012 254.60399999999714);--color-accent-100:oklch(0.9320000000000002 0.03200000000000015 255.5850000000001);--color-accent-200:oklch(0.8820000000000002 0.059000000000000094 254.1279999999993);--color-accent-300:oklch(0.8090000000000002 0.10499999999999995 251.81299999999993);--color-accent-400:oklch(0.7070000000000002 0.16500000000000012 254.6239999999998);--color-accent-600:oklch(0.5460000000000002 0.245 262.8809999999998);--color-accent-700:oklch(0.48800000000000004 0.2430000000000002 264.376);--color-accent-800:oklch(0.4240000000000001 0.19900000000000004 265.63799999999986);--color-accent-900:oklch(0.37900000000000006 0.146 265.52199999999993);--color-accent-950:oklch(0.2820000000000001 0.09099999999999996 267.935);--color-accent-500:oklch(0.6230000000000001 0.2140000000000002 259.81499999999994)}
@@ -0,0 +1,5 @@
1
+ import { type ComponentResolver } from "unplugin-vue-components";
2
+ export declare const WitchcraftUiResolver: ({ prefix, filter, }?: {
3
+ prefix?: string;
4
+ filter?: (name: string) => boolean;
5
+ }) => ComponentResolver;
@@ -0,0 +1,17 @@
1
+ const prefixless = ["Icon", "Aria", "TestWrapper"];
2
+ export const WitchcraftUiResolver = ({
3
+ prefix = "W",
4
+ filter = () => true
5
+ } = {}) => (componentName) => {
6
+ if (componentName.startsWith(prefix)) {
7
+ const n = componentName.slice(1);
8
+ const filename = prefixless.includes(n) ? n : `Lib${n}`;
9
+ if (!filter(n)) {
10
+ return void 0;
11
+ }
12
+ return {
13
+ from: `@witchcraft/ui/components/${filename}`
14
+ };
15
+ }
16
+ return void 0;
17
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { themeAsTailwindCss } from "metamorphosis/tailwind.js";
2
+ import fs from "node:fs";
3
+ import { resolve } from "path";
4
+ import { themeConvertionOpts } from "../tailwind/themeConvertionOpts.js";
5
+ import { theme } from "../theme.js";
6
+ const css = themeAsTailwindCss(theme, themeConvertionOpts);
7
+ import url from "url";
8
+ const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
9
+ const filepath = resolve(__dirname, "../assets/theme.css");
10
+ const content = `/* Auto-generated, see gen:theme script. */
11
+ ${css}`;
12
+ fs.writeFile(filepath, content, (err) => {
13
+ if (err) throw err;
14
+ });
@@ -0,0 +1,2 @@
1
+ import type Icons from "unplugin-icons/vite";
2
+ export declare const unpluginIconViteOptions: Parameters<typeof Icons>[0];
@@ -0,0 +1,10 @@
1
+ export const unpluginIconViteOptions = {
2
+ scale: 0,
3
+ // removes the scale
4
+ iconCustomizer: async (_, __, props) => {
5
+ props.width = "unset";
6
+ },
7
+ // note that we can't use tailwind classes
8
+ // i mean we could, but we have to tell it to include them manually (pain)
9
+ defaultStyle: "vertical-align: -0.125em; height: 1em; display: inline-block; width:auto;"
10
+ };
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <div tabindex="0">{{ value }}</div>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import type { PropType } from "vue"
7
+
8
+
9
+ defineOptions({ name: "aria" })
10
+ defineProps<{
11
+ // eslint-disable-next-line vue/no-restricted-props
12
+ value: string
13
+ }>()
14
+ </script>
15
+
16
+ <style scoped>
17
+ div{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);white-space:nowrap}
18
+ </style>
@@ -0,0 +1,11 @@
1
+ import type { Meta, StoryObj } from "@storybook/vue3";
2
+ /**
3
+ * For testing the focus styles. The (still WIP) idea is that normally the outlined class is set by whether the user is using the keyboard or not. When true, outlines generated by the focus-outline-* or outlined-* utilities are allowed (they might not always appear since most components have focus-visible styles), when false, they are not allowed, but components can still set custom focus styles that will always appear. Either or is usually not a good idea unless all components set custom focus styles. For something like a web app, focus-visible should be allowed. For an app, this setup allows that to be configurable.
4
+ */
5
+ declare const meta: Meta;
6
+ export default meta;
7
+ type Story = StoryObj<typeof NAME>;
8
+ export declare const Primary: Story;
9
+ export declare const OutlineForcedTrue: Story;
10
+ export declare const OutlineFalse: Story;
11
+ export declare const AlwaysAllowFocusVisible: Story;
@@ -0,0 +1,53 @@
1
+ import { onMounted, ref } from "vue";
2
+ import * as components from "./index.js";
3
+ const meta = {
4
+ title: "Other/Focus",
5
+ args: {
6
+ outline: true
7
+ }
8
+ };
9
+ const template = `
10
+ <div class="focus-outline-no-offset border border-accent-600" tabindex="0">focus-outline-no-offset (outlined i.e. outlined-focus-visible)</div>
11
+ <div class="focus-outline border border-accent-600" tabindex="0">focus-outline (outlined i.e. outlined-focus-visible)</div>
12
+ <div class="outline-hidden outlined-focus:border-danger-500 border border-accent-600" tabindex="0">outlined-focus</div>
13
+ <div class="outline-hidden outlined-within:border-danger-500 border border-accent-600" >
14
+ outlined-within<div tabindex="0">Inner</div>
15
+ </div>
16
+ <div class="outline-hidden focus:border-danger-500 border border-accent-600" tabindex="0">Has Manual Focus Classes</div>
17
+ `;
18
+ export default meta;
19
+ export const Primary = {
20
+ render: (args) => ({
21
+ components,
22
+ setup: () => {
23
+ const el = ref(null);
24
+ onMounted(() => {
25
+ });
26
+ return { ...args, el };
27
+ },
28
+ template
29
+ })
30
+ };
31
+ export const OutlineForcedTrue = {
32
+ ...Primary,
33
+ args: {
34
+ ...Primary.args,
35
+ forceOutline: true
36
+ }
37
+ };
38
+ export const OutlineFalse = {
39
+ ...Primary,
40
+ args: {
41
+ ...Primary.args,
42
+ outline: false
43
+ }
44
+ };
45
+ export const AlwaysAllowFocusVisible = {
46
+ render: (args) => ({
47
+ components,
48
+ setup: () => args,
49
+ template: `
50
+ <div class="outlined-visible group">${template}</div>
51
+ `
52
+ })
53
+ };