@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,261 @@
1
+ <template>
2
+ <nav
3
+ :class="twMerge(`
4
+ flex flex-wrap items-center justify-center gap-2
5
+ `, ($attrs as any).class)"
6
+ role="navigation"
7
+ :aria-label="t('pagination.aria')"
8
+ >
9
+ <slot v-if="prevLink.i > 0 && prevLink.i !== currentLink.i"
10
+ name="link"
11
+ :i="prevLink.i"
12
+ :href="prevLink.href"
13
+ :text="t('pagination.previous-page')"
14
+ :aria-label=" t('pagination.aria.go-to-previous-page',{count:prevLink.i})"
15
+ :class="pageClasses"
16
+ >
17
+ <a
18
+ :class="pageClasses"
19
+ :href="prevLink.href"
20
+ :aria-label=" t('pagination.aria.go-to-previous-page', {count:prevLink.i})"
21
+ />
22
+ </slot>
23
+ <div class="flex-1"/>
24
+ <slot v-if="firstLink.i !== currentLink.i"
25
+ name="link"
26
+ :i="0"
27
+ :href="firstLink.href"
28
+ :text="firstLink.i"
29
+ :aria-label="t('pagination.aria.go-to-page', {count:firstLink.i})"
30
+ :class="pageClasses"
31
+ >
32
+ {{ firstLink.href }}
33
+ <a
34
+ :class="pageClasses"
35
+ :href="firstLink.href"
36
+ :aria-label="t('pagination.aria.go-to-page', {count:firstLink.i})"
37
+ >
38
+ {{ firstLink.i }}
39
+ </a>
40
+ </slot>
41
+ <div v-if="prevLink.i - extraPages > firstLink.i" class="page-fill">
42
+ ...
43
+ </div>
44
+ <template
45
+ v-for="entry in extraPagesPrev"
46
+ :key="entry.i"
47
+ >
48
+ <slot name="link"
49
+ :class="pageClasses"
50
+ :i="entry.i"
51
+ :href="entry.href"
52
+ :aria-label="t('pagination.aria.go-to-page', {count:entry.i})"
53
+ >
54
+ <a
55
+ :class="pageClasses"
56
+ :href="entry.href"
57
+ :aria-label="t('pagination.aria.go-to-page', {count:entry.i})"
58
+ >
59
+ {{ entry.i }}
60
+ </a>
61
+ </slot>
62
+ </template>
63
+ <slot name="current"
64
+ :class="currentPageClasses"
65
+ tabindex="0"
66
+ :i="currentLink.i"
67
+ :aria-label="t('pagination.aria.current-page', {count:currentLink.i})"
68
+ :aria_current="true"
69
+ >
70
+ <div class="a"
71
+ tabindex="0"
72
+ :class="currentPageClasses"
73
+ :aria-label="t('pagination.aria.current-page', {count:currentLink.i})"
74
+ aria-current="true"
75
+ @click="$event.preventDefault()"
76
+ >
77
+ {{ currentLink.i }}
78
+ </div>
79
+ </slot>
80
+ <template
81
+ v-for="entry in extraPagesNext"
82
+ :key="entry.i"
83
+ >
84
+ <slot name="link"
85
+ :class="pageClasses"
86
+ :i="entry.i"
87
+ :href="entry.href"
88
+ :aria-label="t('pagination.aria.go-to-page', {count:entry.i})"
89
+ >
90
+ <a
91
+ :class="pageClasses"
92
+ :href="entry.href"
93
+ :aria-label="t('pagination.aria.go-to-page', {count:entry.i})"
94
+ >
95
+ {{ entry.i }}
96
+ </a>
97
+ </slot>
98
+ </template>
99
+ <div v-if="nextLink.i + extraPages < total" class="page-fill" aria-hidden="true">
100
+ ...
101
+ </div>
102
+ <slot v-if="lastLink.i !== currentLink.i"
103
+ name="link"
104
+ :class="pageClasses"
105
+ :i="lastLink.i"
106
+ :href="lastLink.href"
107
+ :text="total"
108
+ :aria-label="t('pagination.aria.go-to-page', {count:lastLink.i})"
109
+ >
110
+ <a
111
+ :class="pageClasses"
112
+ :href="lastLink.href"
113
+ :aria-label="t('pagination.aria.go-to-page', {count:lastLink.i})"
114
+ >
115
+ {{ total }}
116
+ </a>
117
+ </slot>
118
+ <div class="flex-1"/>
119
+ <slot
120
+ v-if="nextLink.i <= total && nextLink.i !== currentLink.i"
121
+ :class="pageClasses"
122
+ name="link"
123
+ :i="nextLink.i"
124
+ :href="nextLink.href"
125
+ :text="t('pagination.next-page')"
126
+ :aria-label="t('pagination.aria.go-to-next-page', {count:nextLink.i})"
127
+ >
128
+ <a
129
+ :class="pageClasses"
130
+ :href="nextLink.href"
131
+ :aria-label="t('pagination.aria.go-to-next-page', {count:nextLink.i})"
132
+ >
133
+ Next
134
+ </a>
135
+ </slot>
136
+ </nav>
137
+ </template>
138
+ <script setup lang="ts">
139
+ import { computed, type HTMLAttributes,useAttrs,watch } from "vue"
140
+
141
+ import { useInjectedI18n } from "../../composables/useInjectedI18n.js"
142
+ import { twMerge } from "../../utils/twMerge.js"
143
+ import { type TailwindClassProp } from "../shared/props.js"
144
+
145
+ const t = useInjectedI18n()
146
+
147
+ const commonClasses = `
148
+ block
149
+ focus-outline
150
+ border-b-2
151
+ border-transparent
152
+ transition-all
153
+ outlined:rounded-sm
154
+ `
155
+ const pageClasses = `
156
+ ${commonClasses}
157
+ focus-outline
158
+ hover:text-accent-600
159
+ hover:border-b-accent-500
160
+ hover:scale-125
161
+ `
162
+
163
+ const currentPageClasses = `
164
+ ${commonClasses}
165
+ border-b-accent-500
166
+ scale-125
167
+ `
168
+ defineOptions({
169
+ name: "lib-pagination",
170
+ inheritAttrs: false,
171
+ })
172
+
173
+ // eslint-disable-next-line no-use-before-define
174
+ const props = withDefaults(defineProps<Props>(), {
175
+ customRoute: (route: string, i: number) => {
176
+ if (i === 0 || i === 1) {
177
+ const num = 1
178
+ return { href: route, i: num }
179
+ }
180
+ return { href: route + i.toString(), i }
181
+ },
182
+ extraPages: 3,
183
+ })
184
+ const $attrs = useAttrs()
185
+
186
+ const currentLink = computed(() => props.customRoute(props.route, props.current))
187
+ const currentIsInvalid = computed(() => currentLink.value.i < 0 || currentLink.value.i > props.total)
188
+
189
+ watch(() => currentIsInvalid.value, () => {
190
+ if (currentIsInvalid.value) {
191
+ throw new Error(`Current page is out of range: 0 - ${props.total}`)
192
+ }
193
+ })
194
+
195
+ const prevLink = computed(() => props.customRoute(props.route, props.current - 1))
196
+
197
+ const nextLink = computed(() => {
198
+ const maybeNextLink = props.customRoute(props.route, props.current + 1)
199
+ if (maybeNextLink.i === currentLink.value.i) {
200
+ return props.customRoute(props.route, props.current + 2)
201
+ }
202
+ return maybeNextLink
203
+ })
204
+
205
+ const firstLink = computed(() => props.customRoute(props.route, 0))
206
+ const lastLink = computed(() => props.customRoute(props.route, props.total))
207
+
208
+ type HrefInfo = { href: string, i: number }
209
+ const extraPagesPrev = computed(() => [...Array(props.extraPages)].map((_, _i) => {
210
+ const num = currentLink.value.i - (props.extraPages - _i)
211
+ if (num <= firstLink.value.i || num >= lastLink.value.i || num >= currentLink.value.i) return undefined
212
+ return props.customRoute(props.route, num)
213
+ }).filter(entry => entry !== undefined) as HrefInfo[])
214
+
215
+ const extraPagesNext = computed(() => [...Array(props.extraPages + 1)].map((_, i) => {
216
+ const num = currentLink.value.i + i
217
+ if (num <= firstLink.value.i || num >= lastLink.value.i || num <= currentLink.value.i) return undefined
218
+ return props.customRoute(props.route, num)
219
+ }).filter(entry => entry !== undefined).slice(0, props.extraPages) as HrefInfo[])
220
+
221
+ </script>
222
+ <script lang="ts">
223
+
224
+ /**
225
+ * Pagination component.
226
+ *
227
+ * Can be passed a slot like so to use a custom link element (like NuxtLink):
228
+ * ```vue
229
+ * <template #link="{ href, i, text, ariaLabel, ariaCurrent}">
230
+ * <NuxtLink :to="href" :aria-label="ariaLabel" :aria-current="ariaCurrent ?? false">{{ text ?? i }}</NuxtLink>
231
+ * </template>
232
+ * ```
233
+ */
234
+ export default {
235
+ name: "lib-pagination",
236
+ }
237
+ type RealProps = {
238
+ /** The total number of pages. */
239
+ total: number
240
+ /** The number of the current page. It must be valid, between 0 - total or the component will throw an error. */
241
+ current: number
242
+ /** The base route/link path for the page. Should end with a forward slash `/`. */
243
+ route: string
244
+ /**
245
+ * A function to customize the output href and page link number. By default, page 0 is page 1, page 1 is 1, then everything else is normal.
246
+ *
247
+ * This is because usually we have routes like: `/page/1`, `/page/2`, not `/page/0`.
248
+ *
249
+ * You can use this function to customize things further. For example, make `/page/1` just `/`
250
+ */
251
+ customRoute?: (route: string, i: number) => { i: number, href: string }
252
+ /** How many extra pages to show to each side of the current page. */
253
+ extraPages?: number
254
+ }
255
+ interface Props
256
+ extends
257
+ /** @vue-ignore */
258
+ Partial<Omit<HTMLAttributes,"class"> & TailwindClassProp>,
259
+ RealProps
260
+ {}
261
+ </script>
@@ -0,0 +1,32 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ import type { Meta, StoryObj } from "@storybook/vue3"
3
+
4
+ import LibPalette from "./LibPalette.vue"
5
+
6
+ import { theme } from "../../theme.js"
7
+ // eslint-disable-next-line @typescript-eslint/no-restricted-imports
8
+ import * as components from "../index.js"
9
+
10
+
11
+ const meta: Meta<typeof LibPalette> = {
12
+ component: LibPalette,
13
+ title: "Components/Palette",
14
+ args: {
15
+ // theme,
16
+ },
17
+ }
18
+
19
+ export default meta
20
+ type Story = StoryObj<typeof LibPalette>
21
+
22
+
23
+ export const Primary: Story = {
24
+ render: args => ({
25
+ components: { ...components, LibPalette },
26
+ setup: () => ({ args: { ...args, theme } }),
27
+ template: `
28
+ <LibPalette v-bind="{...args}">{{args.value}}</LibPalette>
29
+ `,
30
+ }),
31
+ }
32
+
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div class="flex h-full flex-col items-center justify-center ">
3
+ <div class="container mx-auto ">
4
+ <div class="grid grid-cols-11 gap-2 gap-y-10 px-10">
5
+ <template v-for="color, i in colors" :key="color">
6
+ <div
7
+ :style="`background-color: var(${color});`"
8
+ :class="`h-10 rounded-sm flex items-center justify-center text-fg dark:text-bg`"
9
+ >
10
+ {{ [5, 16, 27, 38, 49].includes(i) ? 'Text':'' }}
11
+ </div>
12
+ </template>
13
+ </div>
14
+ <!-- <div class="flex flex-col">
15
+ <template v-for="color in ['green', 'yellow', 'red', 'blue', 'neutral']" :key="color">
16
+ <div class="grid grid-cols-11 gap-2 gap-y-10 px-10">
17
+ <div :class="`h-10 bg-${color}-${num} rounded-sm`" v-for="num in ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900', '950']" :key="num"/>
18
+ </div>
19
+ </template>
20
+ </div> -->
21
+ </div>
22
+ </div>
23
+ </template>
24
+
25
+ <script lang="ts">
26
+ export default { name: "lib-palette" }
27
+ </script>
28
+
29
+ <script setup lang="ts">
30
+ import { keys } from "@alanscodelog/utils/keys.js"
31
+ import { type Theme } from "metamorphosis"
32
+
33
+ import { type BaseInteractiveProps, baseInteractivePropsDefaults,type LinkableByIdProps } from "../shared/props.js"
34
+
35
+
36
+ const props = withDefaults(defineProps<
37
+ & LinkableByIdProps
38
+ & BaseInteractiveProps
39
+ & {
40
+ theme: Theme
41
+ }>(), {
42
+ theme: () => ({} as any),
43
+ ...baseInteractivePropsDefaults
44
+ })
45
+
46
+ const exclude = ["--color-bg", "--color-fg"]
47
+ const colors = keys(props.theme.css).filter(key => key.startsWith("--color") && !exclude.includes(key))
48
+
49
+ </script>
@@ -0,0 +1,157 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ import type { Meta, StoryObj } from "@storybook/vue3"
3
+ import { computed, ref, watch } from "vue"
4
+
5
+ import LibPopup from "./LibPopup.vue"
6
+
7
+ import { vExtractRootEl } from "../../directives/vExtractRootEl.js"
8
+ // eslint-disable-next-line @typescript-eslint/no-restricted-imports
9
+ import * as components from "../index.js"
10
+
11
+
12
+ const meta: Meta<typeof LibPopup> = {
13
+ component: LibPopup,
14
+ title: "Components/Popup",
15
+ args: {
16
+
17
+ },
18
+ }
19
+
20
+ export default meta
21
+ type Story = StoryObj<typeof LibPopup>
22
+
23
+
24
+ export const Primary: Story = {
25
+ render: args => ({
26
+ components,
27
+ directives: { extractRootEl: vExtractRootEl },
28
+ setup: () => {
29
+ const value = ref(false)
30
+ const buttonPositions = ["TL", "TC", "TR", "BL", "BC", "BR"] as const
31
+ const buttonPos = ref<typeof buttonPositions[number]>("TL")
32
+ const autoRotatePos = ref(true)
33
+ const buttonStyle = computed(() => {
34
+ switch (buttonPos.value) {
35
+ case "TL": return `align-self: flex-start; justify-self: flex-start;`
36
+ case "TC": return `align-self: flex-start; justify-self: center;`
37
+ case "TR": return `align-self: flex-start; justify-self: flex-end;`
38
+ case "BL": return `align-self: flex-end; justify-self: flex-start;`
39
+ case "BC": return `align-self: flex-end; justify-self: center;`
40
+ case "BR": return `align-self: flex-end; justify-self: flex-end;`
41
+ default: return ""
42
+ }
43
+ })
44
+
45
+ watch(value, () => {
46
+ if (!value.value && autoRotatePos.value) {
47
+ const buttonI = buttonPositions.indexOf(buttonPos.value)
48
+ if (buttonI < 5) { buttonPos.value = buttonPositions[buttonI + 1] } else {
49
+ buttonPos.value = buttonPositions[0]
50
+ }
51
+ }
52
+ })
53
+
54
+
55
+ return {
56
+ args,
57
+ buttonPos,
58
+ autoRotatePos,
59
+ buttonStyle,
60
+ value,
61
+ }
62
+ },
63
+ template: `
64
+ <lib-input
65
+ :suggestions="['TL', 'TR', 'BL', 'BR']"
66
+ :restrict-to-suggestions="true"
67
+ :suggestions-filter="(_, items) => items"
68
+ :label="'Button Position'"
69
+ v-model="buttonPos"
70
+ >
71
+ </lib-input>
72
+ <div>
73
+ <label>Auto Rotate Position</label>
74
+ <input type="checkbox" v-model="autoRotatePos">
75
+ </div>
76
+ <div class="test bg-transparency-squares" style="display:grid;height:80vh;padding:50px;border:1px solid black;">
77
+
78
+ <lib-popup v-model="value" v-bind="{ ...args, width:undefined, }" >
79
+ {{value}}
80
+ <template #button="{extractEl}">
81
+ <lib-button :style="buttonStyle" @click="value = !value" v-extract-root-el="extractEl">Toggle Popup</lib-button>
82
+ </template>
83
+ <template #popup="{position, extractEl}">
84
+ <lib-debug
85
+ v-extract-root-el="extractEl"
86
+ :style="(args.width ? \`width: \${args.width};\` : '') + (args.height ? \`height: \${args.height};\` : '')"
87
+ class="bg-bg dark:bg-fg w-[500px]"
88
+ >
89
+ {{ position }}
90
+ </lib-debug>
91
+ </template>
92
+ </lib-popup>
93
+ </div>
94
+ `,
95
+ }),
96
+ }
97
+ export const PopupNoShift = {
98
+ ...Primary,
99
+ args: {
100
+ avoidRepositioning: true,
101
+
102
+ }
103
+ }
104
+ /** When the popup is too wide, it's positioned to the left and overflow scroll is set with an invisible scrollbar. */
105
+ export const PopupTooBig = {
106
+ ...Primary,
107
+ args: {
108
+ width: "110vw",
109
+ },
110
+ }
111
+ export const PopupCenterScreen = {
112
+ ...Primary,
113
+ args: {
114
+ width: "500px",
115
+ height: "500px",
116
+ preferredHorizontal: ["center-screen"],
117
+ preferredVertical: ["center-screen"],
118
+ },
119
+ }
120
+ export const PopupRightBottomMost = {
121
+ ...Primary,
122
+ args: {
123
+ width: "500px",
124
+ height: "500px",
125
+ preferredHorizontal: [ "right-most"],
126
+ preferredVertical: [ "bottom-most"],
127
+ },
128
+ }
129
+ export const PopupLeftTopMost = {
130
+ ...Primary,
131
+ args: {
132
+ width: "500px",
133
+ height: "500px",
134
+ preferredHorizontal: ["left-most"],
135
+ preferredVertical: ["top-most"],
136
+ },
137
+ }
138
+
139
+ export const PopupCenterMost = {
140
+ ...Primary,
141
+ args: {
142
+ width: "500px",
143
+ height: "500px",
144
+ preferredHorizontal: ["center-most"],
145
+ preferredVertical: ["center-most"],
146
+ },
147
+ }
148
+ export const LeftMenuShapeExample = {
149
+ ...Primary,
150
+ args: {
151
+ width: "300px",
152
+ height: "500px",
153
+ preferredHorizontal: ["left-most"],
154
+ preferredVertical: ["center-most"],
155
+ avoidRepositioning: true,
156
+ },
157
+ }