@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,39 @@
1
+ <template>
2
+ <div
3
+ class="icon inline-block"
4
+ v-bind="{...$attrs, class:undefined}"
5
+ >
6
+ <slot/>
7
+ </div>
8
+ </template>
9
+
10
+ <script setup lang="ts">
11
+ import { computed, type HTMLAttributes,useAttrs } from "vue"
12
+
13
+ const $attrs = useAttrs()
14
+
15
+ // eslint-disable-next-line no-use-before-define
16
+ const props = defineProps<Props>()
17
+
18
+
19
+ </script>
20
+
21
+ <script lang="ts">
22
+ /**
23
+ * Just a very simple wrapper for wrapping unplugin-icons in an inline-block div so the icon in the slot take's up a normal line height when it's alone.
24
+ *
25
+ * ```vue
26
+ * <icon><i-...></icon>
27
+ * ``
28
+ */
29
+ export default {
30
+ name: "icon",
31
+ }
32
+
33
+ interface Props
34
+ extends
35
+ /** @vue-ignore */
36
+ Partial<Omit<HTMLAttributes, "class">
37
+ > { }
38
+ </script>
39
+
@@ -0,0 +1,12 @@
1
+ import type { Meta, StoryObj } from "@storybook/vue3";
2
+ import * as components from "../index.js.js";
3
+ declare const meta: Meta<typeof components.LibButton>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof components.LibButton>;
6
+ export declare const Primary: Story;
7
+ export declare const IconAfter: Story;
8
+ export declare const OnlyIcon: Story;
9
+ export declare const Disabled: Story;
10
+ export declare const Borderless: Story;
11
+ export declare const BorderlessDisabled: Story;
12
+ export declare const WithDivInside: Story;
@@ -0,0 +1,94 @@
1
+ import { capitalize } from "@alanscodelog/utils/capitalize.js";
2
+ import IconFaSolidBell from "~icons/fa-solid/bell";
3
+ import * as components from "../index.js";
4
+ const meta = {
5
+ component: components.LibButton,
6
+ title: "Components/Button",
7
+ args: {
8
+ label: "Label",
9
+ // @ts-expect-error - custom prop for story
10
+ _iconAfter: true
11
+ }
12
+ };
13
+ export default meta;
14
+ export const Primary = {
15
+ render: (args) => ({
16
+ components: {
17
+ ...components,
18
+ IconFaSolidBell
19
+ },
20
+ setup: () => ({ args, capitalize }),
21
+ template: `
22
+ <div class="flex gap-4 justify-center">
23
+ <template v-for="type of [false, 'ok', 'warning', 'danger', 'primary', 'secondary' ]">
24
+ <lib-button v-bind="{...args, color: type, label: !args.label ? undefined : args.label + ' ' + capitalize(type || 'false')}">
25
+ <template #icon>
26
+ <icon class="w-[1em]"><icon-fa-solid-bell /></icon>
27
+ </template>
28
+ </lib-button>
29
+ </template>
30
+ </div>
31
+ <div class="flex flex-col gap-4 pt-10">
32
+ <template v-for="type of [false, 'ok', 'warning', 'danger', 'primary', 'secondary']">
33
+ <lib-button v-bind="{...args, color: type , label: !args.label ? undefined : args.label + ' ' + capitalize(type || 'false') }">
34
+ ${args._iconAfter ? `
35
+ <template #icon-after>
36
+ <icon class="w-[1em]"><icon-fa-solid-bell /></icon>
37
+ </template>
38
+ ` : ``}
39
+ </lib-button>
40
+ </template>
41
+ </div>
42
+ `
43
+ })
44
+ };
45
+ export const IconAfter = {
46
+ ...Primary,
47
+ args: {
48
+ ...Primary.args,
49
+ // @ts-expect-error - .
50
+ _iconAfter: true
51
+ }
52
+ };
53
+ export const OnlyIcon = {
54
+ ...Primary,
55
+ args: {
56
+ ...Primary.args,
57
+ label: void 0
58
+ }
59
+ };
60
+ export const Disabled = {
61
+ ...Primary,
62
+ args: {
63
+ ...Primary.args,
64
+ disabled: true
65
+ }
66
+ };
67
+ export const Borderless = {
68
+ ...Primary,
69
+ args: {
70
+ ...Primary.args,
71
+ border: false
72
+ }
73
+ };
74
+ export const BorderlessDisabled = {
75
+ ...Primary,
76
+ args: {
77
+ ...Primary.args,
78
+ border: false,
79
+ disabled: true
80
+ }
81
+ };
82
+ export const WithDivInside = {
83
+ render: (args) => ({
84
+ components,
85
+ setup: () => ({ args }),
86
+ template: `
87
+ <div class="flex gap-4 justify-center">
88
+ <lib-button v-bind="{...args}">
89
+ <div>Div inside button still has a pointer cursor.</div>
90
+ </lib-button>
91
+ </div>
92
+ `
93
+ })
94
+ };
@@ -0,0 +1,247 @@
1
+ <template>
2
+ <button
3
+ :id="id ?? fallbackId"
4
+ :class="!($attrs as any).unstyle && twMerge(`
5
+ button
6
+ flex
7
+ cursor-pointer
8
+ items-center
9
+ justify-center
10
+ rounded-sm
11
+ px-1
12
+ hover:cursor-pointer
13
+ [&:hover_*]:cursor-pointer
14
+ focus-outline
15
+ disabled:shadow-none
16
+ disabled:text-neutral-500
17
+ disabled:cursor-default
18
+ text-fg
19
+ hover:text-accent-700
20
+ dark:text-bg
21
+ dark:hover:text-accent-500
22
+ dark:disabled:text-neutral-500
23
+ dark:disabled:hover:text-neutral-500
24
+ `,
25
+ !color && `active:text-neutral-800` /* todo for colors */,
26
+ border && `
27
+ transition-all
28
+ bg-neutral-100
29
+ dark:bg-neutral-900
30
+ shadow-[0_1px_1px_0]
31
+ shadow-neutral-950/20
32
+ hover:shadow-[0_1px_3px_0]
33
+ hover:shadow-neutral-950/30
34
+ hover:border-neutral-300
35
+
36
+ relative
37
+ after:absolute
38
+ after:rounded-sm
39
+ after:inset-0
40
+ after:content
41
+ after:shadow-[0_1px_0_0_inset]
42
+ after:shadow-bg/20
43
+ hover:after:shadow-bg/60
44
+ dark:after:shadow-bg/10
45
+ dark:hover:after:shadow-bg/50
46
+ after:pointer-events-none
47
+ after:mix-blend-overlay
48
+
49
+ active:shadow-inner
50
+ active:shadow-fg/20
51
+ active:border-transparent
52
+ border
53
+ border-neutral-400
54
+ disabled:border-neutral-200
55
+ disabled:bg-neutral-50
56
+
57
+ dark:hover:shadow-accent-950/30
58
+ dark:active:shadow-fg/40
59
+ dark:active:border-neutral-900
60
+ dark:bg-neutral-800
61
+ dark:border-neutral-900
62
+ dark:disabled:border-neutral-800
63
+ dark:disabled:bg-neutral-900
64
+ `,
65
+ border && ( !color || color === `secondary` ) && `
66
+ after:shadow-bg/90
67
+ hover:after:shadow-bg
68
+ dark:after:shadow-bg/20
69
+ dark:hover:after:shadow-bg/90
70
+ `,
71
+ !border && color === `primary` && `
72
+ font-bold
73
+ hover:text-accent-50
74
+ `,
75
+ !border && color === `ok` && `
76
+ text-ok-600 hover:text-ok-500
77
+ dark:text-ok-600 dark:hover:text-ok-500
78
+ `,
79
+ !border && color === `warning` && `
80
+ text-warning-500 hover:text-warning-300
81
+ dark:text-warning-600 dark:hover:text-warning-400
82
+ `,
83
+ !border && color === `danger` && `
84
+ text-danger-500 hover:text-danger-300
85
+ dark:text-danger-600 dark:hover:text-danger-400
86
+ `,
87
+ !border && color === `secondary` && `
88
+ text-accent-700 hover:text-accent-500
89
+ dark:text-accent-600 dark:hover:text-accent-400
90
+ `,
91
+ !border && color === `primary` && `
92
+ text-accent-700 hover:text-accent-500
93
+ dark:text-accent-600 dark:hover:text-accent-400
94
+ `,
95
+ border && color === `ok` && `
96
+ text-ok-950
97
+ hover:text-ok-800
98
+ bg-ok-400
99
+ border-ok-500
100
+ hover:border-ok-600
101
+ hover:shadow-ok-900/50
102
+
103
+ dark:text-ok-100
104
+ dark:hover:text-ok-200
105
+ dark:bg-ok-700
106
+ dark:border-ok-800
107
+ dark:hover:border-ok-900
108
+ dark:hover:shadow-ok-900/30
109
+ `,
110
+ border && color === `warning` && `
111
+ text-warning-950
112
+ hover:text-warning-900
113
+ bg-warning-300
114
+ border-warning-400
115
+ hover:border-warning-400
116
+ hover:shadow-warning-900/50
117
+
118
+ dark:text-warning-100
119
+ dark:hover:text-warning-200
120
+ dark:bg-warning-700
121
+ dark:border-warning-700
122
+ dark:hover:shadow-warning-900/25
123
+ `,
124
+ border && color === `danger` && `
125
+ text-danger-950
126
+ hover:text-danger-900
127
+ bg-danger-400
128
+ border-danger-500
129
+ hover:border-danger-500
130
+ hover:shadow-danger-900/50
131
+
132
+ dark:text-danger-100
133
+ dark:hover:text-danger-200
134
+ dark:bg-danger-900
135
+ dark:border-danger-950
136
+ dark:hover:shadow-ranger-500/10
137
+ `,
138
+ border && color === `secondary` && `
139
+ text-accent-800
140
+ dark:text-accent-400
141
+ `,
142
+ border && color === `primary` && `
143
+ text-bg
144
+ hover:text-bg
145
+ bg-accent-600
146
+ border-accent-700
147
+ hover:border-accent-800
148
+ hover:shadow-accent-950/30
149
+
150
+ dark:text-bg
151
+ dark:bg-accent-600
152
+ dark:hover:text-accent-200
153
+ dark:border-accent-800
154
+ dark:hover:border-accent-700
155
+ dark:hover:shadow-accent-900/50
156
+ `,
157
+ ($attrs as any)?.class
158
+ )"
159
+ :type="$attrs.type as any ?? 'submit'"
160
+ :tabindex="0"
161
+ :disabled="disabled"
162
+ :data-border="border"
163
+ :data-color="color"
164
+ :aria-disabled="disabled"
165
+ v-bind="{
166
+ ...autoTitle,
167
+ ...$attrs,
168
+ class: undefined,
169
+ ...ariaLabel,
170
+ }"
171
+ >
172
+ <label :id="`label-${id ?? fallbackId}`" class="label pointer-events-none flex flex-1 items-center justify-center gap-1">
173
+ <slot name="icon"/>
174
+ <slot
175
+ v-bind="{ label}"
176
+ >
177
+ <span v-if="label && !isBlank(label!)">
178
+ {{ label }}
179
+ </span>
180
+ </slot>
181
+ <slot name="icon-after"/>
182
+ </label>
183
+ </button>
184
+ </template>
185
+
186
+ <script setup lang="ts">
187
+ import { isBlank } from "@alanscodelog/utils/isBlank.js"
188
+ import { keys } from "@alanscodelog/utils/keys.js"
189
+ import { pick } from "@alanscodelog/utils/pick.js"
190
+ import type { MakeRequired } from "@alanscodelog/utils/types"
191
+ import { type ButtonHTMLAttributes,computed, type HTMLAttributes, type PropType,useAttrs } from "vue"
192
+
193
+ import { useAriaLabel } from "../../composables/useAriaLabel.js"
194
+ import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
195
+ import { twMerge } from "../../utils/twMerge.js"
196
+ import { type BaseInteractiveProps, baseInteractiveProps, baseInteractivePropsDefaults, getFallbackId,type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
197
+
198
+
199
+ const $attrs = useAttrs()
200
+
201
+
202
+ defineOptions({
203
+ name: "lib-button",
204
+ })
205
+
206
+ const fallbackId = getFallbackId()
207
+
208
+ // eslint-disable-next-line no-use-before-define
209
+ const props = withDefaults(defineProps<Props>(), {
210
+ color: false,
211
+ label: "",
212
+ ...baseInteractivePropsDefaults
213
+ })
214
+
215
+
216
+ const ariaLabel = useAriaLabel(props, fallbackId)
217
+ const autoTitle = computed(() => ({
218
+ title: props.autoTitleFromAria
219
+ ? ($attrs["aria-label"] ?? props.label) as string
220
+ : undefined,
221
+ }))
222
+
223
+ </script>
224
+
225
+ <script lang="ts">
226
+ type RealProps =
227
+ & LinkableByIdProps
228
+ & LabelProps
229
+ & BaseInteractiveProps
230
+ & {
231
+ border?: boolean
232
+ color?: "warning" | "ok" | "danger" | "primary" | "secondary" | false
233
+ label?: string
234
+ autoTitleFromAria?: boolean
235
+ }
236
+
237
+ interface Props
238
+ extends
239
+ /** @vue-ignore */
240
+ Partial<Omit<ButtonHTMLAttributes,"class" | "color" | "disabled">
241
+ & TailwindClassProp
242
+ & {
243
+ // why is this not already a part of button?
244
+ "aria-label": string
245
+ }>,
246
+ RealProps {}
247
+ </script>
@@ -0,0 +1,14 @@
1
+ import type { StoryObj } from "@storybook/vue3";
2
+ import * as components from "../index.js.js";
3
+ declare const meta: {
4
+ component: any;
5
+ title: string;
6
+ args: {
7
+ modelValue: boolean;
8
+ label: string;
9
+ };
10
+ };
11
+ export default meta;
12
+ type Story = StoryObj<typeof components.LibCheckbox>;
13
+ export declare const Primary: Story;
14
+ export declare const Disabled: any;
@@ -0,0 +1,29 @@
1
+ import * as components from "../index.js";
2
+ const meta = {
3
+ component: components.LibCheckbox,
4
+ title: "Components/Checkbox",
5
+ args: {
6
+ modelValue: true,
7
+ label: "Label"
8
+ }
9
+ };
10
+ export default meta;
11
+ export const Primary = {
12
+ render: (args) => ({
13
+ components,
14
+ setup: () => ({ args }),
15
+ template: `
16
+ <lib-checkbox v-bind="args" v-model="args.modelValue"></lib-checkbox>
17
+ <br>
18
+ Opposite State:
19
+ <br>
20
+ <lib-checkbox v-bind="args" :modelValue="!args.modelValue" @update:modelValue="args.modelValue = !$event"></lib-checkbox>
21
+ `
22
+ })
23
+ };
24
+ export const Disabled = {
25
+ ...Primary,
26
+ args: {
27
+ disabled: true
28
+ }
29
+ };
@@ -0,0 +1,132 @@
1
+ <template>
2
+ <div
3
+ :class="twMerge(`
4
+ flex
5
+ items-center
6
+ gap-1
7
+ `,
8
+ ($.wrapperAttrs as any)?.class
9
+ )"
10
+ v-bind="{ ...$.wrapperAttrs, class: undefined }"
11
+ ref="el"
12
+ >
13
+ <slot name="left"/>
14
+ <label
15
+ class="flex items-center gap-1"
16
+ :class="twMerge(`
17
+ flex
18
+ items-center
19
+ gap-1
20
+ `,
21
+ ($.labelAttrs as any)?.class
22
+ )"
23
+ v-bind="{ ...$.labelAttrs, class: undefined }"
24
+ :for="id ?? fallbackId"
25
+ >
26
+ <input
27
+ :id="id ?? fallbackId"
28
+ :class="!($attrs as any).unstyle && twMerge(`
29
+ focus-outline-no-offset
30
+ m-0
31
+ p-[0.4em]
32
+ bg-bg
33
+ dark:bg-fg
34
+ appearance-none
35
+ border
36
+ border-accent-600
37
+ rounded-sm
38
+ aspect-square
39
+ relative
40
+ checked:after:content
41
+ checked:after:absolute
42
+ checked:after:w-full
43
+ checked:after:h-full
44
+ checked:after:border-2
45
+ checked:after:border-bg
46
+ dark:checked:after:border-fg
47
+ checked:after:rounded-sm
48
+ checked:after:top-0
49
+ checked:after:left-0
50
+ checked:after:bg-accent-700
51
+ disabled:border-neutral-500
52
+ disabled:checked:after:bg-neutral-700
53
+ `, !disabled && `cursor-pointer`,
54
+ ($.attrs as any).class
55
+ )"
56
+ type="checkbox"
57
+ :disabled="disabled"
58
+ ref="inputEl"
59
+ v-model="$value"
60
+ v-bind="{...$.attrs, class: undefined}"
61
+ >
62
+ <slot/> {{ label }}
63
+ </label>
64
+ </div>
65
+ </template>
66
+ <script setup lang="ts">
67
+ import { keys } from "@alanscodelog/utils/keys.js"
68
+ import { omit } from "@alanscodelog/utils/omit.js"
69
+ import { pick } from "@alanscodelog/utils/pick.js"
70
+ import type { MakeRequired } from "@alanscodelog/utils/types"
71
+ import { computed, type HTMLAttributes, type InputHTMLAttributes,type PropType, ref, useAttrs, useSlots } from "vue"
72
+
73
+ import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
74
+ import { twMerge } from "../../utils/twMerge.js"
75
+ import { type BaseInteractiveProps, baseInteractivePropsDefaults, getFallbackId,type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
76
+
77
+ defineOptions({
78
+ name: "lib-checkbox",
79
+ inheritAttrs: false,
80
+ })
81
+
82
+ const $ = useDivideAttrs(["label", "wrapper"])
83
+ const $slots = useSlots()
84
+ /* todo multi states */
85
+
86
+ const fallbackId = getFallbackId()
87
+ // eslint-disable-next-line no-use-before-define
88
+ const props = withDefaults(defineProps<Props>(), {
89
+ ...baseInteractivePropsDefaults,
90
+ })
91
+
92
+
93
+ const emits = defineEmits<{
94
+ /* User presses enter.*/
95
+ (e: "submit", val: boolean): void
96
+ }>()
97
+
98
+ const el = ref<null | HTMLElement>(null)
99
+ const inputEl = ref<null | HTMLElement>(null)
100
+ const $value = defineModel<boolean>("modelValue", { default: false })
101
+
102
+
103
+ </script>
104
+
105
+ <script lang="ts">
106
+
107
+ type WrapperTypes = Partial<WrapperProps<"label",HTMLAttributes, {
108
+ /** Tailwind classes. */
109
+ class?: string
110
+ }>>
111
+
112
+ type RealProps =
113
+
114
+ & LinkableByIdProps
115
+ & LabelProps
116
+ & BaseInteractiveProps
117
+ & {
118
+ unstyle?: boolean
119
+ }
120
+
121
+ interface Props
122
+ extends
123
+ /** @vue-ignore */
124
+ Partial<Omit<
125
+ InputHTMLAttributes,
126
+ "class" | "readonly" | "disabled" | "onSumbit"
127
+ > & TailwindClassProp>,
128
+ /** @vue-ignore */
129
+ WrapperTypes,
130
+ RealProps
131
+ {}
132
+ </script>
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from "@storybook/vue3";
2
+ import LibColorInput from "./LibColorInput.vue.js";
3
+ declare const meta: Meta<typeof LibColorInput>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof LibColorInput>;
6
+ export declare const Primary: Story;
7
+ export declare const DoesNotAllowAlpha: Story;
@@ -0,0 +1,58 @@
1
+ import { ref } from "vue";
2
+ import LibColorInput from "./LibColorInput.vue";
3
+ import * as components from "../index.js";
4
+ const meta = {
5
+ component: LibColorInput,
6
+ title: "Components/ColorInput",
7
+ args: {}
8
+ };
9
+ export default meta;
10
+ export const Primary = {
11
+ render: (args) => ({
12
+ components,
13
+ setup: () => {
14
+ const color = ref({
15
+ r: 0,
16
+ g: 0,
17
+ b: 0
18
+ /* , a: 0.5 */
19
+ });
20
+ const handleChange = (e) => {
21
+ color.value = { ...e };
22
+ };
23
+ return {
24
+ args: {
25
+ outline: false,
26
+ color,
27
+ allowAlpha: true,
28
+ ...args
29
+ },
30
+ handleChange
31
+ };
32
+ },
33
+ template: `
34
+ <lib-color-Input
35
+ :allowAlpha="args.allowAlpha"
36
+ :modelValue="args.color.value"
37
+ @update:modelValue="handleChange"
38
+ >
39
+ </lib-color-Input>
40
+ Stretched:
41
+ <div class="flex-1 flex">
42
+ <lib-color-Input
43
+ class="flex-1"
44
+ :allowAlpha="args.allowAlpha"
45
+ :modelValue="args.color.value"
46
+ @update:modelValue="handleChange"
47
+ >
48
+ </lib-color-Input>
49
+ </div>
50
+ `
51
+ })
52
+ };
53
+ export const DoesNotAllowAlpha = {
54
+ ...Primary,
55
+ args: {
56
+ allowAlpha: false
57
+ }
58
+ };