vueless 0.0.479 → 0.0.481

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 (298) hide show
  1. package/README.md +3 -3
  2. package/adatper.locale/vue-i18n.ts +14 -0
  3. package/adatper.locale/{vueless.js → vueless.ts} +67 -19
  4. package/composables/useAutoPosition.ts +113 -0
  5. package/composables/useBreakpoint.ts +109 -0
  6. package/composables/useLocale.ts +22 -0
  7. package/composables/useMutationObserver.ts +53 -0
  8. package/composables/{useUI.js → useUI.ts} +109 -105
  9. package/constants.js +124 -2
  10. package/directives/clickOutside/storybook/Docs.mdx +1 -1
  11. package/directives/clickOutside/storybook/{stories.js → stories.ts} +7 -9
  12. package/directives/clickOutside/types.ts +22 -0
  13. package/directives/clickOutside/vClickOutside.ts +96 -0
  14. package/directives/index.js +7 -2
  15. package/directives/tooltip/storybook/Docs.mdx +1 -1
  16. package/directives/tooltip/storybook/{stories.js → stories.ts} +22 -10
  17. package/directives/tooltip/types.ts +14 -0
  18. package/directives/tooltip/vTooltip.ts +82 -0
  19. package/{index.js → index.ts} +12 -9
  20. package/package.json +38 -25
  21. package/plugin-vite.d.ts +10 -0
  22. package/plugin-vite.js +97 -0
  23. package/{preset.tailwind.js → preset-tailwind.js} +21 -7
  24. package/types.ts +322 -0
  25. package/ui.button/UButton.vue +1 -1
  26. package/ui.button/storybook/Docs.mdx +1 -1
  27. package/ui.button/storybook/stories.js +11 -6
  28. package/ui.button/useAttrs.js +1 -1
  29. package/ui.button-link/ULink.vue +2 -2
  30. package/ui.button-link/storybook/Docs.mdx +1 -1
  31. package/ui.button-link/storybook/stories.js +2 -2
  32. package/ui.button-link/useAttrs.js +1 -1
  33. package/ui.button-toggle/UToggle.vue +1 -1
  34. package/ui.button-toggle/storybook/Docs.mdx +1 -1
  35. package/ui.button-toggle/storybook/stories.js +2 -2
  36. package/ui.button-toggle/useAttrs.js +1 -1
  37. package/ui.button-toggle-item/UToggleItem.vue +1 -1
  38. package/ui.button-toggle-item/storybook/Docs.mdx +1 -1
  39. package/ui.button-toggle-item/storybook/stories.js +1 -1
  40. package/ui.button-toggle-item/useAttrs.js +1 -1
  41. package/ui.container-accordion/UAccordion.vue +1 -1
  42. package/ui.container-accordion/storybook/Docs.mdx +1 -1
  43. package/ui.container-accordion/storybook/stories.js +1 -1
  44. package/ui.container-accordion/useAttrs.js +1 -1
  45. package/ui.container-card/storybook/Docs.mdx +1 -1
  46. package/ui.container-card/storybook/stories.js +1 -1
  47. package/ui.container-card/useAttrs.js +1 -1
  48. package/ui.container-col/UCol.vue +1 -1
  49. package/ui.container-col/storybook/Docs.mdx +1 -1
  50. package/ui.container-col/storybook/stories.js +1 -1
  51. package/ui.container-col/useAttrs.js +1 -1
  52. package/ui.container-divider/UDivider.vue +1 -1
  53. package/ui.container-divider/storybook/Docs.mdx +1 -1
  54. package/ui.container-divider/storybook/stories.js +2 -2
  55. package/ui.container-divider/useAttrs.js +1 -1
  56. package/ui.container-group/UGroup.vue +1 -1
  57. package/ui.container-group/storybook/Docs.mdx +1 -1
  58. package/ui.container-group/storybook/stories.js +1 -1
  59. package/ui.container-group/useAttrs.js +1 -1
  60. package/ui.container-modal/UModal.vue +1 -1
  61. package/ui.container-modal/storybook/Docs.mdx +1 -1
  62. package/ui.container-modal/storybook/stories.js +2 -2
  63. package/ui.container-modal/useAttrs.js +1 -1
  64. package/ui.container-modal-confirm/UModalConfirm.vue +2 -2
  65. package/ui.container-modal-confirm/storybook/Docs.mdx +1 -1
  66. package/ui.container-modal-confirm/storybook/stories.js +2 -2
  67. package/ui.container-modal-confirm/useAttrs.js +1 -1
  68. package/ui.container-page/UPage.vue +2 -2
  69. package/ui.container-page/storybook/Docs.mdx +1 -1
  70. package/ui.container-page/storybook/stories.js +1 -1
  71. package/ui.container-page/useAttrs.js +2 -2
  72. package/ui.container-row/URow.vue +1 -1
  73. package/ui.container-row/storybook/Docs.mdx +1 -1
  74. package/ui.container-row/storybook/stories.js +2 -2
  75. package/ui.container-row/useAttrs.js +1 -1
  76. package/ui.data-list/UDataList.vue +6 -6
  77. package/ui.data-list/storybook/Docs.mdx +1 -1
  78. package/ui.data-list/storybook/stories.js +1 -1
  79. package/ui.data-list/useAttrs.js +1 -1
  80. package/ui.data-table/UTable.vue +3 -3
  81. package/ui.data-table/UTableRow.vue +7 -6
  82. package/ui.data-table/config.js +10 -3
  83. package/ui.data-table/storybook/Docs.mdx +1 -1
  84. package/ui.data-table/storybook/stories.js +5 -3
  85. package/ui.data-table/useAttrs.js +1 -1
  86. package/ui.data-table/utilTable.js +1 -1
  87. package/ui.dropdown-badge/UDropdownBadge.vue +1 -1
  88. package/ui.dropdown-badge/storybook/Docs.mdx +1 -1
  89. package/ui.dropdown-badge/storybook/stories.js +2 -2
  90. package/ui.dropdown-badge/useAttrs.js +1 -1
  91. package/ui.dropdown-button/UDropdownButton.vue +1 -1
  92. package/ui.dropdown-button/storybook/Docs.mdx +1 -1
  93. package/ui.dropdown-button/storybook/stories.js +3 -3
  94. package/ui.dropdown-button/useAttrs.js +1 -1
  95. package/ui.dropdown-link/UDropdownLink.vue +1 -1
  96. package/ui.dropdown-link/config.js +1 -1
  97. package/ui.dropdown-link/storybook/Docs.mdx +1 -1
  98. package/ui.dropdown-link/storybook/stories.js +2 -2
  99. package/ui.dropdown-link/useAttrs.js +4 -6
  100. package/ui.dropdown-list/UDropdownList.vue +3 -3
  101. package/ui.dropdown-list/storybook/Docs.mdx +1 -1
  102. package/ui.dropdown-list/storybook/stories.js +2 -2
  103. package/ui.dropdown-list/useAttrs.js +1 -1
  104. package/ui.form-calendar/UCalendar.vue +2 -2
  105. package/ui.form-calendar/storybook/Docs.mdx +1 -1
  106. package/ui.form-calendar/storybook/stories.js +1 -1
  107. package/ui.form-calendar/useAttrs.js +1 -1
  108. package/ui.form-checkbox/UCheckbox.vue +1 -1
  109. package/ui.form-checkbox/storybook/Docs.mdx +1 -1
  110. package/ui.form-checkbox/storybook/stories.js +2 -2
  111. package/ui.form-checkbox/useAttrs.js +1 -1
  112. package/ui.form-checkbox-group/UCheckboxGroup.vue +1 -1
  113. package/ui.form-checkbox-group/storybook/Docs.mdx +1 -1
  114. package/ui.form-checkbox-group/storybook/stories.js +2 -2
  115. package/ui.form-checkbox-group/useAttrs.js +1 -1
  116. package/ui.form-checkbox-multi-state/UCheckboxMultiState.vue +1 -1
  117. package/ui.form-checkbox-multi-state/storybook/Docs.mdx +1 -1
  118. package/ui.form-checkbox-multi-state/storybook/stories.js +2 -2
  119. package/ui.form-checkbox-multi-state/useAttrs.js +1 -1
  120. package/ui.form-color-picker/UColorPicker.vue +1 -1
  121. package/ui.form-color-picker/storybook/Docs.mdx +1 -1
  122. package/ui.form-color-picker/storybook/stories.js +2 -2
  123. package/ui.form-color-picker/useAttrs.js +1 -1
  124. package/ui.form-date-picker/UDatePicker.vue +4 -7
  125. package/ui.form-date-picker/storybook/Docs.mdx +1 -1
  126. package/ui.form-date-picker/storybook/stories.js +3 -3
  127. package/ui.form-date-picker/useAttrs.js +2 -2
  128. package/ui.form-date-picker-range/UDatePickerRange.vue +2 -2
  129. package/ui.form-date-picker-range/storybook/Docs.mdx +1 -1
  130. package/ui.form-date-picker-range/storybook/stories.js +2 -2
  131. package/ui.form-date-picker-range/useAttrs.js +2 -2
  132. package/ui.form-date-picker-range/useLocale.js +1 -1
  133. package/ui.form-input/UInput.vue +3 -3
  134. package/ui.form-input/storybook/Docs.mdx +1 -1
  135. package/ui.form-input/storybook/stories.js +2 -2
  136. package/ui.form-input/useAttrs.js +1 -1
  137. package/ui.form-input-file/UInputFile.vue +2 -2
  138. package/ui.form-input-file/storybook/Docs.mdx +1 -1
  139. package/ui.form-input-file/storybook/stories.js +2 -2
  140. package/ui.form-input-file/useAttrs.js +1 -1
  141. package/ui.form-input-money/UInputMoney.vue +1 -1
  142. package/ui.form-input-money/storybook/Docs.mdx +1 -1
  143. package/ui.form-input-money/storybook/stories.js +2 -2
  144. package/ui.form-input-money/useAttrs.js +1 -1
  145. package/ui.form-input-money/useFormatCurrency.js +1 -1
  146. package/ui.form-input-number/UInputNumber.vue +5 -4
  147. package/ui.form-input-number/storybook/Docs.mdx +1 -1
  148. package/ui.form-input-number/storybook/stories.js +2 -2
  149. package/ui.form-input-number/useAttrs.js +1 -1
  150. package/ui.form-input-rating/UInputRating.vue +1 -1
  151. package/ui.form-input-rating/storybook/Docs.mdx +1 -1
  152. package/ui.form-input-rating/storybook/stories.js +2 -2
  153. package/ui.form-input-rating/useAttrs.js +1 -1
  154. package/ui.form-input-search/UInputSearch.vue +2 -2
  155. package/ui.form-input-search/storybook/Docs.mdx +1 -1
  156. package/ui.form-input-search/storybook/stories.js +2 -2
  157. package/ui.form-input-search/useAttrs.js +1 -1
  158. package/ui.form-label/ULabel.vue +1 -1
  159. package/ui.form-label/config.js +2 -2
  160. package/ui.form-label/storybook/Docs.mdx +1 -1
  161. package/ui.form-label/storybook/stories.js +2 -2
  162. package/ui.form-label/useAttrs.js +1 -1
  163. package/ui.form-radio/URadio.vue +1 -1
  164. package/ui.form-radio/storybook/Docs.mdx +1 -1
  165. package/ui.form-radio/storybook/stories.js +1 -1
  166. package/ui.form-radio/useAttrs.js +1 -1
  167. package/ui.form-radio-group/URadioGroup.vue +1 -1
  168. package/ui.form-radio-group/storybook/Docs.mdx +1 -1
  169. package/ui.form-radio-group/storybook/stories.js +2 -2
  170. package/ui.form-radio-group/useAttrs.js +1 -1
  171. package/ui.form-select/USelect.vue +4 -4
  172. package/ui.form-select/storybook/Docs.mdx +1 -1
  173. package/ui.form-select/storybook/stories.js +2 -2
  174. package/ui.form-select/useAttrs.js +1 -1
  175. package/ui.form-switch/USwitch.vue +2 -2
  176. package/ui.form-switch/storybook/Docs.mdx +1 -1
  177. package/ui.form-switch/storybook/stories.js +2 -2
  178. package/ui.form-switch/useAttrs.js +1 -1
  179. package/ui.form-switch/utilVariant.js +1 -1
  180. package/ui.form-textarea/UTextarea.vue +1 -1
  181. package/ui.form-textarea/storybook/Docs.mdx +1 -1
  182. package/ui.form-textarea/storybook/stories.js +2 -2
  183. package/ui.form-textarea/useAttrs.js +1 -1
  184. package/ui.image-avatar/UAvatar.vue +1 -1
  185. package/ui.image-avatar/storybook/Docs.mdx +1 -1
  186. package/ui.image-avatar/storybook/stories.js +2 -2
  187. package/ui.image-avatar/useAttrs.js +1 -1
  188. package/ui.image-icon/UIcon.vue +14 -8
  189. package/ui.image-icon/storybook/Docs.mdx +2 -2
  190. package/ui.image-icon/storybook/stories.js +2 -2
  191. package/ui.image-icon/useAttrs.js +2 -2
  192. package/ui.loader/ULoader.vue +1 -1
  193. package/ui.loader/storybook/Docs.mdx +1 -1
  194. package/ui.loader/storybook/stories.js +2 -2
  195. package/ui.loader/useAttrs.js +1 -1
  196. package/ui.loader-overlay/ULoaderOverlay.vue +1 -1
  197. package/ui.loader-overlay/storybook/Docs.mdx +1 -1
  198. package/ui.loader-overlay/storybook/stories.js +1 -1
  199. package/ui.loader-overlay/useAttrs.js +1 -1
  200. package/ui.loader-progress/ULoaderProgress.vue +33 -48
  201. package/ui.loader-progress/constants.js +1 -0
  202. package/ui.loader-progress/storybook/Docs.mdx +1 -1
  203. package/ui.loader-progress/storybook/stories.js +3 -4
  204. package/ui.loader-progress/useAttrs.js +1 -1
  205. package/ui.loader-progress/useLoaderProgress.js +13 -8
  206. package/ui.loader-progress/utilLoaderProgress.js +1 -1
  207. package/ui.navigation-pagination/UPagination.vue +1 -1
  208. package/ui.navigation-pagination/storybook/Docs.mdx +1 -1
  209. package/ui.navigation-pagination/storybook/stories.js +1 -1
  210. package/ui.navigation-pagination/useAttrs.js +1 -1
  211. package/ui.navigation-progress/UProgress.vue +1 -1
  212. package/ui.navigation-progress/storybook/Docs.mdx +1 -1
  213. package/ui.navigation-progress/storybook/stories.js +2 -2
  214. package/ui.navigation-progress/useAttrs.js +1 -1
  215. package/ui.navigation-tab/UTab.vue +1 -1
  216. package/ui.navigation-tab/storybook/Docs.mdx +1 -1
  217. package/ui.navigation-tab/storybook/stories.js +1 -1
  218. package/ui.navigation-tab/useAttrs.js +1 -1
  219. package/ui.navigation-tabs/UTabs.vue +1 -1
  220. package/ui.navigation-tabs/storybook/Docs.mdx +1 -1
  221. package/ui.navigation-tabs/storybook/stories.js +2 -2
  222. package/ui.navigation-tabs/useAttrs.js +1 -1
  223. package/ui.other-dot/UDot.vue +1 -1
  224. package/ui.other-dot/storybook/Docs.mdx +1 -1
  225. package/ui.other-dot/storybook/stories.js +2 -2
  226. package/ui.other-dot/useAttrs.js +1 -1
  227. package/ui.text-alert/UAlert.vue +1 -1
  228. package/ui.text-alert/storybook/Docs.mdx +1 -1
  229. package/ui.text-alert/storybook/stories.js +2 -2
  230. package/ui.text-alert/useAttrs.js +1 -1
  231. package/ui.text-badge/UBadge.vue +89 -179
  232. package/ui.text-badge/storybook/Docs.mdx +3 -3
  233. package/ui.text-badge/storybook/{stories.js → stories.ts} +33 -37
  234. package/ui.text-badge/types.ts +84 -0
  235. package/ui.text-badge/useAttrs.ts +28 -0
  236. package/ui.text-block/UText.vue +18 -62
  237. package/ui.text-block/storybook/Docs.mdx +3 -3
  238. package/ui.text-block/storybook/{stories.js → stories.ts} +13 -8
  239. package/ui.text-block/types.ts +33 -0
  240. package/ui.text-block/useAttrs.ts +20 -0
  241. package/ui.text-empty/UEmpty.vue +1 -1
  242. package/ui.text-empty/storybook/Docs.mdx +1 -1
  243. package/ui.text-empty/storybook/stories.js +2 -2
  244. package/ui.text-empty/useAttrs.js +1 -1
  245. package/ui.text-file/UFile.vue +13 -16
  246. package/ui.text-file/config.js +12 -2
  247. package/ui.text-file/storybook/Docs.mdx +1 -1
  248. package/ui.text-file/storybook/stories.js +1 -1
  249. package/ui.text-file/useAttrs.js +1 -1
  250. package/ui.text-files/UFiles.vue +1 -1
  251. package/ui.text-files/config.js +1 -1
  252. package/ui.text-files/storybook/Docs.mdx +1 -1
  253. package/ui.text-files/storybook/stories.js +1 -1
  254. package/ui.text-files/useAttrs.js +1 -1
  255. package/ui.text-header/UHeader.vue +1 -1
  256. package/ui.text-header/storybook/Docs.mdx +1 -1
  257. package/ui.text-header/storybook/stories.js +2 -2
  258. package/ui.text-header/useAttrs.js +1 -1
  259. package/ui.text-money/UMoney.vue +1 -1
  260. package/ui.text-money/storybook/Docs.mdx +1 -1
  261. package/ui.text-money/storybook/stories.js +2 -2
  262. package/ui.text-money/useAttrs.js +1 -1
  263. package/ui.text-money/utilMoney.js +2 -2
  264. package/ui.text-notify/UNotify.vue +2 -2
  265. package/ui.text-notify/storybook/Docs.mdx +1 -1
  266. package/ui.text-notify/storybook/stories.js +1 -1
  267. package/ui.text-notify/useAttrs.js +1 -1
  268. package/ui.text-notify/utilNotify.js +1 -1
  269. package/utils/{utilHelper.js → helper.ts} +14 -27
  270. package/utils/node/helper.js +78 -0
  271. package/utils/node/loaderIcon.js +232 -0
  272. package/utils/node/loaderSvg.js +71 -0
  273. package/utils/node/mergeConfigs.js +199 -0
  274. package/utils/node/tailwindSafelist.js +366 -0
  275. package/utils/node/vuelessConfig.js +42 -0
  276. package/utils/node/vuelessResolver.js +28 -0
  277. package/utils/{utilPlatform.js → platform.ts} +10 -3
  278. package/utils/{utilStorybook.js → storybook.ts} +102 -36
  279. package/utils/tailwindConfig.ts +33 -0
  280. package/utils/{utilTheme.js → theme.ts} +65 -30
  281. package/utils/ui.ts +129 -0
  282. package/web-types.json +1362 -157
  283. package/adatper.locale/vue-i18n.js +0 -11
  284. package/composables/useAutoPosition.js +0 -94
  285. package/composables/useBreakpoint.js +0 -104
  286. package/composables/useLocale.js +0 -25
  287. package/composables/useMutationObserver.js +0 -48
  288. package/directives/clickOutside/vClickOutside.js +0 -64
  289. package/directives/tooltip/vTooltip.js +0 -56
  290. package/ui.text-badge/useAttrs.js +0 -23
  291. package/ui.text-block/useAttrs.js +0 -15
  292. package/utils/utilUI.js +0 -360
  293. /package/adatper.locale/locales/{en.js → en.ts} +0 -0
  294. /package/ui.image-icon/{config.js → config.ts} +0 -0
  295. /package/ui.text-badge/{config.js → config.ts} +0 -0
  296. /package/ui.text-badge/{constants.js → constants.ts} +0 -0
  297. /package/ui.text-block/{config.js → config.ts} +0 -0
  298. /package/ui.text-block/{constants.js → constants.ts} +0 -0
@@ -0,0 +1,96 @@
1
+ import { unref } from "vue";
2
+
3
+ import type { MaybeRef } from "vue";
4
+ import type {
5
+ ClickOutsideOptions,
6
+ ClickCallback,
7
+ RemoveEvents,
8
+ ClickOutsideTargetElement,
9
+ DirectiveBindingCallback,
10
+ DirectiveBindingOptions,
11
+ } from "./types";
12
+
13
+ function clickOutside(
14
+ target: MaybeRef<HTMLElement | null>,
15
+ handler: ClickCallback,
16
+ options: ClickOutsideOptions,
17
+ ): RemoveEvents {
18
+ const { capture = true, ignore = [] } = options;
19
+
20
+ const ignoreList = ignore.map((item) => unref(item));
21
+ const el = unref(target);
22
+
23
+ function onClick(event: MouseEvent) {
24
+ if (!(event.target instanceof HTMLElement)) return;
25
+
26
+ const targetElements = event.composedPath().filter((element) => element instanceof HTMLElement);
27
+
28
+ if (
29
+ !el ||
30
+ el === event.target ||
31
+ targetElements.some((pathEl) => ignoreList.includes(pathEl)) ||
32
+ targetElements.includes(el) ||
33
+ ignoreList.includes(event.target)
34
+ ) {
35
+ return;
36
+ }
37
+
38
+ handler(event);
39
+ }
40
+
41
+ window.addEventListener("click", onClick, { passive: true, capture });
42
+ window.addEventListener("pointerdown", onClick, { passive: true });
43
+
44
+ function removeEvents() {
45
+ window.removeEventListener("click", onClick, capture);
46
+ window.removeEventListener("pointerdown", onClick);
47
+ }
48
+
49
+ return removeEvents;
50
+ }
51
+
52
+ function onMounted(el: ClickOutsideTargetElement, binding: DirectiveBindingCallback): void;
53
+ function onMounted(el: ClickOutsideTargetElement, binding: DirectiveBindingOptions): void;
54
+ function onMounted(
55
+ el: ClickOutsideTargetElement,
56
+ binding: DirectiveBindingOptions | DirectiveBindingCallback,
57
+ ): void {
58
+ const capture = !binding.modifiers.bubble;
59
+
60
+ if (typeof binding.value === "function") {
61
+ el._clickOutsideRemove = clickOutside(el, binding.value, { capture });
62
+ } else {
63
+ const [handler, options] = binding.value;
64
+
65
+ el._clickOutsideRemove = clickOutside(el, handler, Object.assign({ capture }, options));
66
+ }
67
+ }
68
+
69
+ function onUpdated(el: ClickOutsideTargetElement, binding: DirectiveBindingCallback): void;
70
+ function onUpdated(el: ClickOutsideTargetElement, binding: DirectiveBindingOptions): void;
71
+ function onUpdated(
72
+ el: ClickOutsideTargetElement,
73
+ binding: DirectiveBindingOptions | DirectiveBindingCallback,
74
+ ): void {
75
+ el._clickOutsideRemove();
76
+
77
+ const capture = !binding.modifiers.bubble;
78
+
79
+ if (typeof binding.value === "function") {
80
+ el._clickOutsideRemove = clickOutside(el, binding.value, { capture });
81
+ } else {
82
+ const [handler, options] = binding.value;
83
+
84
+ el._clickOutsideRemove = clickOutside(el, handler, Object.assign({ capture }, options));
85
+ }
86
+ }
87
+
88
+ function onUnmounted(el: ClickOutsideTargetElement) {
89
+ el._clickOutsideRemove();
90
+ }
91
+
92
+ export default {
93
+ mounted: onMounted,
94
+ updated: onUpdated,
95
+ unmounted: onUnmounted,
96
+ };
@@ -1,2 +1,7 @@
1
- export { default as vTooltip } from "./tooltip/vTooltip.js";
2
- export { default as vClickOutside } from "./clickOutside/vClickOutside.js";
1
+ /**
2
+ * The file should have `.js` extension to allow import from the folder without adding `/index.ts` in the end.
3
+ * Vite doesn't recognize `.ts` files without extension.
4
+ */
5
+
6
+ export { default as vTooltip } from "./tooltip/vTooltip.ts";
7
+ export { default as vClickOutside } from "./clickOutside/vClickOutside.ts";
@@ -1,6 +1,6 @@
1
1
  import { Meta, Title, Subtitle, Description, Primary, Controls, Stories, Source } from "@storybook/blocks";
2
2
 
3
- import * as stories from "./stories.js";
3
+ import * as stories from "./stories.ts";
4
4
 
5
5
  <Meta of={stories} />
6
6
  <Title of={stories} />
@@ -1,8 +1,20 @@
1
- import { getArgTypes } from "../../../utils/utilStorybook.js";
1
+ import type { Meta, StoryFn } from "@storybook/vue3";
2
+ import { getArgTypes } from "../../../utils/storybook.ts";
2
3
 
3
4
  import UIcon from "../../../ui.image-icon/UIcon.vue";
4
5
  import URow from "../../../ui.container-row/URow.vue";
5
- import tooltip from "../vTooltip.js";
6
+ import tooltip from "../vTooltip.ts";
7
+
8
+ import type { Props } from "tippy.js";
9
+
10
+ interface VTooltipArgs {
11
+ tooltip: Partial<Props> | string;
12
+ }
13
+
14
+ interface VTooltipEnumArgs extends VTooltipArgs {
15
+ enum: keyof Props;
16
+ options: unknown[];
17
+ }
6
18
 
7
19
  /**
8
20
  * The `v-tooltip` directive. | [View on GitHub](https://github.com/vuelessjs/vueless/tree/main/src/directives/tooltip)
@@ -15,9 +27,9 @@ export default {
15
27
  argTypes: {
16
28
  ...getArgTypes(UIcon.__name),
17
29
  },
18
- };
30
+ } as Meta;
19
31
 
20
- const DefaultTemplate = (args) => ({
32
+ const DefaultTemplate: StoryFn<VTooltipArgs> = (args: VTooltipArgs) => ({
21
33
  components: { UIcon },
22
34
  directives: { tooltip },
23
35
  setup() {
@@ -28,7 +40,7 @@ const DefaultTemplate = (args) => ({
28
40
  `,
29
41
  });
30
42
 
31
- const EnumTemplate = (args) => ({
43
+ const EnumTemplate: StoryFn<VTooltipEnumArgs> = (args: VTooltipEnumArgs) => ({
32
44
  components: { UIcon, URow },
33
45
  directives: { tooltip },
34
46
  setup() {
@@ -36,11 +48,11 @@ const EnumTemplate = (args) => ({
36
48
  },
37
49
  template: `
38
50
  <URow>
39
- <UIcon
40
- v-for="option in args.options"
41
- interactive
42
- name="sentiment_satisfied"
43
- v-tooltip="{ content: option, ...args.tooltip, [args.enum]: option }"
51
+ <UIcon
52
+ v-for="option in args.options"
53
+ interactive
54
+ name="sentiment_satisfied"
55
+ v-tooltip="{ content: option, ...args.tooltip, [args.enum]: option }"
44
56
  >
45
57
  </URow>
46
58
  `,
@@ -0,0 +1,14 @@
1
+ import type { Instance as TippyInstance, Props } from "tippy.js";
2
+ import type { DirectiveBinding } from "vue";
3
+
4
+ export interface TippyTargetElement extends HTMLElement {
5
+ _tippy: TippyInstance;
6
+ }
7
+
8
+ export interface DirectiveBindingContent extends DirectiveBinding {
9
+ value: string;
10
+ }
11
+
12
+ export interface DirectiveBindingProps extends DirectiveBinding {
13
+ value: Props;
14
+ }
@@ -0,0 +1,82 @@
1
+ import tippy from "tippy.js";
2
+ import { merge } from "lodash-es";
3
+
4
+ import { vuelessConfig } from "../../utils/ui.ts";
5
+ import { isCSR, isSSR } from "../../utils/helper.ts";
6
+
7
+ import type { DefaultProps } from "tippy.js";
8
+ import type {
9
+ TippyTargetElement,
10
+ DirectiveBindingContent,
11
+ DirectiveBindingProps,
12
+ } from "./types.ts";
13
+
14
+ let settings: Partial<DefaultProps> = {};
15
+
16
+ if (isCSR) {
17
+ import("tippy.js/dist/tippy.css");
18
+ import("tippy.js/themes/light.css");
19
+ import("tippy.js/animations/shift-away.css");
20
+
21
+ const defaultSettings = {
22
+ arrow: true,
23
+ theme: "light",
24
+ animation: "shift-away",
25
+ };
26
+
27
+ settings = merge(defaultSettings, {});
28
+ settings = merge(defaultSettings, vuelessConfig.directive?.tooltip || {}) as DefaultProps;
29
+ tippy.setDefaultProps(settings);
30
+ }
31
+
32
+ function onMounted(el: TippyTargetElement, bindings: DirectiveBindingContent): void;
33
+ function onMounted(el: TippyTargetElement, bindings: DirectiveBindingProps): void;
34
+ function onMounted(
35
+ el: TippyTargetElement,
36
+ bindings: DirectiveBindingProps | DirectiveBindingContent,
37
+ ): void {
38
+ if (isSSR) return;
39
+
40
+ if (typeof bindings.value === "string" && bindings.value.length) {
41
+ tippy(el, merge(settings, { content: bindings.value }));
42
+
43
+ return;
44
+ }
45
+
46
+ if (
47
+ typeof bindings.value !== "string" &&
48
+ bindings.value.content &&
49
+ String(bindings.value.content).length
50
+ ) {
51
+ tippy(el, merge(settings, bindings.value || {}));
52
+ }
53
+ }
54
+
55
+ function onUpdated(el: TippyTargetElement, bindings: DirectiveBindingContent): void;
56
+ function onUpdated(el: TippyTargetElement, bindings: DirectiveBindingProps): void;
57
+ function onUpdated(
58
+ el: TippyTargetElement,
59
+ bindings: DirectiveBindingProps | DirectiveBindingContent,
60
+ ): void {
61
+ if (!el._tippy || isSSR) return;
62
+
63
+ if (typeof bindings.value === "string") {
64
+ el._tippy.setProps(merge(settings, { content: bindings.value }));
65
+
66
+ return;
67
+ }
68
+
69
+ el._tippy.setProps(merge(settings, bindings.value || {}));
70
+ }
71
+
72
+ function onUnmounted(el: TippyTargetElement) {
73
+ if (!el._tippy || isSSR) return;
74
+
75
+ el._tippy.destroy();
76
+ }
77
+
78
+ export default {
79
+ mounted: onMounted,
80
+ updated: onUpdated,
81
+ unmounted: onUnmounted,
82
+ };
@@ -1,14 +1,17 @@
1
- /* eslint-disable vue/max-len, prettier/prettier */
2
- import { createLocale, LocaleSymbol } from "./composables/useLocale.js";
1
+ /* eslint-disable prettier/prettier */
2
+ import { createLocale, LocaleSymbol } from "./composables/useLocale.ts";
3
3
  import { createLoaderOverlay, LoaderOverlaySymbol } from "./ui.loader-overlay/useLoaderOverlay.js";
4
4
  import { createLoaderProgress, LoaderProgressSymbol } from "./ui.loader-progress/useLoaderProgress.js";
5
- import { themeInit } from "./utils/utilTheme.js";
5
+ import { themeInit } from "./utils/theme.ts";
6
6
 
7
- export { setTitle } from "./utils/utilHelper.js";
8
- export { setTheme } from "./utils/utilTheme.js";
7
+ import type { App } from 'vue'
8
+ import type { CreateVuelessOptions } from './types.ts'
9
+
10
+ export { setTitle } from "./utils/helper.ts";
11
+ export { setTheme } from "./utils/theme.ts";
9
12
  export { default as createVueI18nAdapter } from "./adatper.locale/vue-i18n.js";
10
13
  export { default as defaultEnLocale } from "./adatper.locale/locales/en.js";
11
- export { useLocale } from "./composables/useLocale.js";
14
+ export { useLocale } from "./composables/useLocale.ts";
12
15
  export { useLoaderProgress } from "./ui.loader-progress/useLoaderProgress.js";
13
16
  export { loaderProgressOn, loaderProgressOff } from "./ui.loader-progress/utilLoaderProgress.js";
14
17
  export { useLoaderOverlay } from "./ui.loader-overlay/useLoaderOverlay.js";
@@ -22,14 +25,14 @@ export {
22
25
  setDelayedNotify,
23
26
  getDelayedNotify,
24
27
  } from "./ui.text-notify/utilNotify.js";
25
- /* eslint-enable vue/max-len, prettier/prettier */
28
+ /* eslint-enable prettier/prettier */
26
29
 
27
- export function createVueless(options = {}) {
30
+ export function createVueless(options: CreateVuelessOptions = {}) {
28
31
  const i18n = createLocale(options.i18n);
29
32
  const loaderOverlay = createLoaderOverlay();
30
33
  const loaderProgress = createLoaderProgress();
31
34
 
32
- const install = (app) => {
35
+ const install = (app: App) => {
33
36
  app.provide(LocaleSymbol, i18n);
34
37
  app.provide(LoaderOverlaySymbol, loaderOverlay);
35
38
  app.provide(LoaderProgressSymbol, loaderProgress);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.479",
3
+ "version": "0.0.481",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -21,58 +21,71 @@
21
21
  ],
22
22
  "homepage": "https://vueless.com",
23
23
  "author": "Johnny Grid",
24
- "main": "index.js",
24
+ "main": "index.ts",
25
25
  "type": "module",
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
29
  "scripts": {
30
- "dev:docs": "npx @vueless/web-types && node prepare.icons && storybook dev -p 6006 --docs --no-open",
31
- "dev": "npx @vueless/web-types && node prepare.icons && STORYBOOK_FULL=1 storybook dev -p 6006 --no-open",
32
- "build": "npx @vueless/web-types && node prepare.icons && storybook build --docs",
30
+ "pre:start": "npx @vueless/web-types && node .scripts/icons",
31
+ "dev:docs": "npm run pre:start && storybook dev -p 6006 --docs --no-open",
32
+ "dev": "npm run pre:start && STORYBOOK_FULL=1 storybook dev -p 6006 --no-open",
33
+ "build": "npm run pre:start && storybook build --docs",
33
34
  "preview": "vite preview --host --outDir=storybook-static",
34
- "release:prepare": "npx @vueless/web-types && node prepare.icons && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE web-types.json README.md dist/ && node prepare.package",
35
+ "ts:check": "vue-tsc --build --force",
36
+ "release:prepare": "npm run pre:start && rm -rf dist && mkdir -p dist && cp -r src/. package.json LICENSE README.md node_modules/.cache/vueless/web-types.json dist/ && node .scripts/package",
37
+ "release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
35
38
  "release:patch": "release-it patch --ci --npm.publish",
36
39
  "release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
37
40
  "release:major": "release-it major --ci --npm.publish --git.tag --github.release",
38
- "lint": "eslint --ext .vue,.js,.ts --no-fix --ignore-path .eslintignore src/ .storybook/",
39
- "lint:fix": "eslint --ext .vue,.js,.ts --fix --ignore-path .eslintignore src/ .storybook/",
40
- "lint:ci": "eslint --ext .vue,.js,.ts --no-fix --ignore-path .eslintignore --max-warnings=0"
41
+ "lint": "eslint --no-fix src/ .storybook/",
42
+ "lint:fix": "eslint --fix src/ .storybook/",
43
+ "lint:ci": "eslint --no-fix --max-warnings=0"
41
44
  },
42
45
  "dependencies": {
43
- "@tailwindcss/forms": "^0.5.7",
46
+ "@tailwindcss/forms": "^0.5.9",
44
47
  "cva": "^1.0.0-beta.1",
45
48
  "lodash-es": "^4.17.21",
46
- "tailwind-merge": "^2.3.0",
47
- "tailwindcss": "^3.4.4",
49
+ "svgo": "^3.3.2",
50
+ "tailwind-merge": "^2.5.4",
51
+ "tailwindcss": "^3.4.14",
48
52
  "tippy.js": "^6.3.7",
53
+ "unplugin-vue-components": "^0.27.4",
49
54
  "vuedraggable": "^4.1.0"
50
55
  },
51
56
  "devDependencies": {
57
+ "@eslint/js": "^9.12.0",
52
58
  "@material-symbols/svg-500": "^0.17.4",
53
59
  "@release-it/bumper": "^6.0.1",
60
+ "@tsconfig/node20": "^20.1.4",
61
+ "@types/jsdom": "^21.1.7",
62
+ "@types/lodash-es": "^4.17.12",
63
+ "@types/node": "^22.7.7",
54
64
  "@vitejs/plugin-vue": "^5.0.5",
55
- "@vue/eslint-config-prettier": "^9.0.0",
56
- "@vueless/plugin-vite": "^0.0.76",
65
+ "@vitest/eslint-plugin": "^1.1.7",
66
+ "@vue/eslint-config-prettier": "^10.0.0",
67
+ "@vue/eslint-config-typescript": "^14.1.1",
68
+ "@vue/tsconfig": "^0.5.1",
57
69
  "@vueless/storybook": "^0.0.37",
58
- "@vueless/web-types": "^0.0.17",
70
+ "@vueless/web-types": "^0.0.21",
59
71
  "autoprefixer": "^10.4.19",
60
72
  "cssnano": "^6.1.2",
61
- "eslint": "^8.55.0",
62
- "eslint-plugin-node": "^11.1.0",
63
- "eslint-plugin-prettier": "^5.1.3",
64
- "eslint-plugin-storybook": "^0.8.0",
65
- "eslint-plugin-tailwindcss": "^3.15.1",
73
+ "eslint": "^9.12.0",
74
+ "eslint-plugin-storybook": "^0.10.0--canary.156.ce8985b.0",
75
+ "eslint-plugin-tailwindcss": "^3.17.5",
66
76
  "eslint-plugin-vue": "^9.25.0",
77
+ "globals": "^15.11.0",
78
+ "jsdom": "^25.0.1",
67
79
  "postcss": "^8.4.38",
68
- "prettier": "^3.2.5",
69
- "prettier-eslint": "^16.3.0",
80
+ "prettier": "^3.3.3",
70
81
  "release-it": "^17.2.1",
71
- "vite": "^5.2.13",
82
+ "typescript": "^5.6.3",
83
+ "vite": "^5.4.9",
72
84
  "vite-plugin-compression": "^0.5.1",
73
- "vite-plugin-eslint": "^1.8.1",
74
85
  "vue": "^3.5.4",
75
- "vue-router": "^4.3.2"
86
+ "vue-i18n": "^10.0.4",
87
+ "vue-router": "^4.3.2",
88
+ "vue-tsc": "^2.1.6"
76
89
  },
77
90
  "resolutions": {
78
91
  "jackspeak": "2.3.6"
@@ -0,0 +1,10 @@
1
+ export function VuelessUnpluginComponents(options?: unknown): import("vite").Plugin<unknown> & {
2
+ api: import("unplugin-vue-components/types.js").PublicPluginAPI;
3
+ };
4
+
5
+ export function Vueless(options?: {
6
+ env?: string;
7
+ mode?: string;
8
+ debug?: boolean;
9
+ include?: string[];
10
+ }): never;
package/plugin-vite.js ADDED
@@ -0,0 +1,97 @@
1
+ /**
2
+ * The file has `.js` extension because it is a node script.
3
+ * Please do not change the extension if you do not fully understand the consequences.
4
+ */
5
+
6
+ import UnpluginVueComponents from "unplugin-vue-components/vite";
7
+
8
+ import { loadSvg } from "./utils/node/loaderSvg.js";
9
+ import { copyIcons, removeIcons } from "./utils/node/loaderIcon.js";
10
+ import { createTailwindSafelist, clearTailwindSafelist } from "./utils/node/tailwindSafelist.js";
11
+ import { getNuxtFiles, getVueSourceFile } from "./utils/node/helper.js";
12
+ import { componentResolver, directiveResolver } from "./utils/node/vuelessResolver.js";
13
+
14
+ /* Automatically importing Vueless components on demand */
15
+ export const VuelessUnpluginComponents = (options) =>
16
+ UnpluginVueComponents({
17
+ resolvers: [componentResolver, directiveResolver],
18
+ dts: false,
19
+ ...options,
20
+ });
21
+
22
+ /*
23
+ – Creates tailwind colors safelist (collect only used on the project colors).
24
+ – Collects SVG icons for build (UIcon bundle size optimization).
25
+ – Loads SVG images as a Vue components.
26
+ */
27
+ export const Vueless = function (options = {}) {
28
+ const { mode, debug, env, include } = options;
29
+
30
+ const isNuxt = mode === "nuxt-module";
31
+ const srcDir = isNuxt ? process.cwd() : getVueSourceFile();
32
+
33
+ const targetFiles = [srcDir, ...(include || []), ...(isNuxt ? getNuxtFiles() : [])];
34
+
35
+ /* if server stopped by developer (Ctrl+C) */
36
+ process.on("SIGINT", async () => {
37
+ /* remove dynamically copied icons */
38
+ await removeIcons({ debug, isNuxt });
39
+
40
+ /* clear tailwind safelist */
41
+ clearTailwindSafelist(debug);
42
+ process.exit(0);
43
+ });
44
+
45
+ return {
46
+ name: "vite-plugin-vue-vueless",
47
+ enforce: "pre",
48
+
49
+ config: () => ({
50
+ define: {
51
+ "process.env": {},
52
+ },
53
+ optimizeDeps: {
54
+ include: ["tailwindcss/colors.js"],
55
+ },
56
+ }),
57
+
58
+ configResolved: async (config) => {
59
+ /* collect used in project colors for tailwind safelist */
60
+ if (!isNuxt) {
61
+ await createTailwindSafelist({ mode, env, debug, targetFiles });
62
+ }
63
+
64
+ if (config.command === "build") {
65
+ await removeIcons({ debug, isNuxt });
66
+
67
+ /* dynamically copy used icons before build */
68
+ await copyIcons({ mode: "vuelessIcons", env, debug, targetFiles });
69
+ await copyIcons({ mode, env, debug, targetFiles, isNuxt });
70
+ }
71
+
72
+ if (config.command === "dev" || config.command === "serve") {
73
+ /* remove dynamically copied icons on dev server start */
74
+ await removeIcons({ debug, isNuxt });
75
+ }
76
+ },
77
+
78
+ /* remove dynamically copied icons after build */
79
+ buildEnd: async () => {
80
+ await removeIcons({ debug, isNuxt });
81
+ },
82
+
83
+ /* load SVG images as a Vue components */
84
+ load: async (id) => await loadSvg(id, options),
85
+
86
+ handleHotUpdate: async ({ file, read }) => {
87
+ if (!isNuxt && [".js", ".jsx", ".ts", ".tsx", ".vue"].some((ext) => file.endsWith(ext))) {
88
+ const fileContent = await read();
89
+
90
+ if (fileContent.includes("safelist:") || fileContent.includes("color=")) {
91
+ /* collect used in project colors for tailwind safelist */
92
+ await createTailwindSafelist({ mode, env, debug, targetFiles });
93
+ }
94
+ }
95
+ },
96
+ };
97
+ };
@@ -1,3 +1,8 @@
1
+ /**
2
+ * The file has `.js` extension because it is a node script.
3
+ * Please do not change the extension if you do not fully understand the consequences.
4
+ */
5
+
1
6
  import forms from "@tailwindcss/forms";
2
7
  import colors from "tailwindcss/colors.js";
3
8
  import {
@@ -10,9 +15,14 @@ import {
10
15
  DEFAULT_RING,
11
16
  DEFAULT_RING_OFFSET,
12
17
  DEFAULT_RING_OFFSET_COLOR_LIGHT,
18
+ DEFAULT_BRAND_COLOR,
19
+ DEFAULT_GRAY_COLOR,
20
+ GRAYSCALE_COLOR,
13
21
  } from "./constants.js";
14
22
 
15
23
  const isStrategyOverride = process.env.VUELESS_STRATEGY === "override";
24
+ const brandColor = process.env.VUELESS_BRAND || DEFAULT_BRAND_COLOR;
25
+ const grayColor = process.env.VUELESS_GRAY || DEFAULT_GRAY_COLOR;
16
26
 
17
27
  /**
18
28
  * Vueless Tailwind CSS `content` config.
@@ -76,6 +86,9 @@ export const vuelessTailwindConfig = {
76
86
  fontSize: {
77
87
  "2xs": ["0.625rem", "0.875rem"] /* 10px / 14px */,
78
88
  },
89
+ borderRadius: {
90
+ dynamic: "var(--vl-rounding)",
91
+ },
79
92
  ringWidth: {
80
93
  dynamic: "var(--vl-ring)",
81
94
  },
@@ -83,10 +96,7 @@ export const vuelessTailwindConfig = {
83
96
  dynamic: "var(--vl-ring-offset)",
84
97
  },
85
98
  ringOffsetColor: {
86
- dynamic: "var(--vl-ring-offset-color)",
87
- },
88
- borderRadius: {
89
- dynamic: "var(--vl-rounding)",
99
+ "color-dynamic": twColorWithOpacity("--vl-ring-offset-color"),
90
100
  },
91
101
  },
92
102
  configViewer: {
@@ -96,8 +106,8 @@ export const vuelessTailwindConfig = {
96
106
  "var(--vl-ring-offset)": DEFAULT_RING_OFFSET,
97
107
  "var(--vl-ring-offset-color)": DEFAULT_RING_OFFSET_COLOR_LIGHT,
98
108
  "var(--vl-rounding)": DEFAULT_ROUNDING,
99
- ...getReplacementColors(GRAY_COLOR, GRAY_COLOR),
100
- ...getReplacementColors(BRAND_COLOR, GRAY_COLOR),
109
+ ...getReplacementColors(GRAY_COLOR, grayColor),
110
+ ...getReplacementColors(BRAND_COLOR, brandColor),
101
111
  },
102
112
  },
103
113
  },
@@ -141,7 +151,7 @@ function twColorWithOpacity(variableName) {
141
151
  * @returns { Object } - TailwindCSS color object palette.
142
152
  */
143
153
  function getPalette(color) {
144
- let palette = {
154
+ const palette = {
145
155
  DEFAULT: twColorWithOpacity(`--vl-color-${color}-default`),
146
156
  };
147
157
 
@@ -159,6 +169,10 @@ function getPalette(color) {
159
169
  * @returns { Object } - `tailwind-config-viewer` color replacement object.
160
170
  */
161
171
  function getReplacementColors(color, tailwindColor) {
172
+ if (tailwindColor === GRAYSCALE_COLOR || tailwindColor === COOL_COLOR) {
173
+ tailwindColor = GRAY_COLOR;
174
+ }
175
+
162
176
  const varsPalette = {
163
177
  [twColorWithOpacity(`--vl-color-${color}-default`)]: colors[tailwindColor][600],
164
178
  };