@byyuurin/ui 0.0.11 → 0.2.0

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 (297) hide show
  1. package/README.md +170 -58
  2. package/dist/module.d.mts +4 -13
  3. package/dist/module.json +4 -4
  4. package/dist/module.mjs +54 -20
  5. package/dist/runtime/components/Accordion.vue +28 -23
  6. package/dist/runtime/components/Accordion.vue.d.ts +51 -29
  7. package/dist/runtime/components/Alert.vue +47 -27
  8. package/dist/runtime/components/Alert.vue.d.ts +37 -25
  9. package/dist/runtime/components/App.vue +9 -8
  10. package/dist/runtime/components/App.vue.d.ts +22 -20
  11. package/dist/runtime/components/Avatar.vue +65 -21
  12. package/dist/runtime/components/Avatar.vue.d.ts +27 -13
  13. package/dist/runtime/components/AvatarGroup.vue +14 -10
  14. package/dist/runtime/components/AvatarGroup.vue.d.ts +12 -9
  15. package/dist/runtime/components/Badge.vue +64 -32
  16. package/dist/runtime/components/Badge.vue.d.ts +30 -29
  17. package/dist/runtime/components/Breadcrumb.vue +40 -22
  18. package/dist/runtime/components/Breadcrumb.vue.d.ts +48 -21
  19. package/dist/runtime/components/Button.vue +113 -52
  20. package/dist/runtime/components/Button.vue.d.ts +36 -20
  21. package/dist/runtime/components/Calendar.vue +50 -43
  22. package/dist/runtime/components/Calendar.vue.d.ts +58 -31
  23. package/dist/runtime/components/Card.vue +18 -14
  24. package/dist/runtime/components/Card.vue.d.ts +18 -14
  25. package/dist/runtime/components/Carousel.vue +99 -46
  26. package/dist/runtime/components/Carousel.vue.d.ts +46 -25
  27. package/dist/runtime/components/Checkbox.vue +60 -35
  28. package/dist/runtime/components/Checkbox.vue.d.ts +35 -28
  29. package/dist/runtime/components/CheckboxGroup.vue +131 -0
  30. package/dist/runtime/components/CheckboxGroup.vue.d.ts +89 -0
  31. package/dist/runtime/components/Chip.vue +35 -32
  32. package/dist/runtime/components/Chip.vue.d.ts +33 -15
  33. package/dist/runtime/components/Collapsible.vue +13 -9
  34. package/dist/runtime/components/Collapsible.vue.d.ts +16 -8
  35. package/dist/runtime/components/Drawer.vue +80 -70
  36. package/dist/runtime/components/Drawer.vue.d.ts +51 -28
  37. package/dist/runtime/components/DropdownMenu.vue +23 -16
  38. package/dist/runtime/components/DropdownMenu.vue.d.ts +77 -36
  39. package/dist/runtime/components/DropdownMenuContent.vue +136 -106
  40. package/dist/runtime/components/DropdownMenuContent.vue.d.ts +38 -26
  41. package/dist/runtime/components/FieldGroup.vue +33 -0
  42. package/dist/runtime/components/FieldGroup.vue.d.ts +33 -0
  43. package/dist/runtime/components/Form.vue +172 -88
  44. package/dist/runtime/components/Form.vue.d.ts +69 -44
  45. package/dist/runtime/components/FormField.vue +108 -0
  46. package/dist/runtime/components/FormField.vue.d.ts +63 -0
  47. package/dist/runtime/components/Icon.vue +20 -0
  48. package/dist/runtime/components/Icon.vue.d.ts +9 -0
  49. package/dist/runtime/components/Input.vue +84 -79
  50. package/dist/runtime/components/Input.vue.d.ts +55 -43
  51. package/dist/runtime/components/InputNumber.vue +66 -52
  52. package/dist/runtime/components/InputNumber.vue.d.ts +50 -109
  53. package/dist/runtime/components/InputTags.vue +155 -0
  54. package/dist/runtime/components/InputTags.vue.d.ts +85 -0
  55. package/dist/runtime/components/Kbd.vue +11 -5
  56. package/dist/runtime/components/Kbd.vue.d.ts +17 -11
  57. package/dist/runtime/components/Link.vue +54 -197
  58. package/dist/runtime/components/Link.vue.d.ts +17 -17
  59. package/dist/runtime/components/LinkBase.vue +11 -33
  60. package/dist/runtime/components/LinkBase.vue.d.ts +8 -3
  61. package/dist/runtime/components/Marquee.vue +38 -0
  62. package/dist/runtime/components/Marquee.vue.d.ts +54 -0
  63. package/dist/runtime/components/Modal.vue +53 -39
  64. package/dist/runtime/components/Modal.vue.d.ts +64 -34
  65. package/dist/runtime/components/NavigationMenu.vue +345 -0
  66. package/dist/runtime/components/NavigationMenu.vue.d.ts +216 -0
  67. package/dist/runtime/components/OverlayProvider.vue +3 -3
  68. package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -1
  69. package/dist/runtime/components/Pagination.vue +39 -47
  70. package/dist/runtime/components/Pagination.vue.d.ts +54 -31
  71. package/dist/runtime/components/PinInput.vue +46 -32
  72. package/dist/runtime/components/PinInput.vue.d.ts +40 -21
  73. package/dist/runtime/components/Popover.vue +33 -19
  74. package/dist/runtime/components/Popover.vue.d.ts +57 -32
  75. package/dist/runtime/components/Progress.vue +31 -26
  76. package/dist/runtime/components/Progress.vue.d.ts +32 -23
  77. package/dist/runtime/components/RadioGroup.vue +75 -48
  78. package/dist/runtime/components/RadioGroup.vue.d.ts +58 -36
  79. package/dist/runtime/components/ScrollArea.vue +33 -31
  80. package/dist/runtime/components/ScrollArea.vue.d.ts +9 -5
  81. package/dist/runtime/components/Select.vue +166 -76
  82. package/dist/runtime/components/Select.vue.d.ts +206 -65
  83. package/dist/runtime/components/Separator.vue +42 -16
  84. package/dist/runtime/components/Separator.vue.d.ts +35 -14
  85. package/dist/runtime/components/Skeleton.vue +18 -6
  86. package/dist/runtime/components/Skeleton.vue.d.ts +4 -4
  87. package/dist/runtime/components/Slider.vue +42 -24
  88. package/dist/runtime/components/Slider.vue.d.ts +43 -27
  89. package/dist/runtime/components/Switch.vue +40 -31
  90. package/dist/runtime/components/Switch.vue.d.ts +36 -27
  91. package/dist/runtime/components/Table.vue +329 -79
  92. package/dist/runtime/components/Table.vue.d.ts +152 -66
  93. package/dist/runtime/components/Tabs.vue +70 -23
  94. package/dist/runtime/components/Tabs.vue.d.ts +61 -29
  95. package/dist/runtime/components/Textarea.vue +102 -54
  96. package/dist/runtime/components/Textarea.vue.d.ts +57 -41
  97. package/dist/runtime/components/Timeline.vue +102 -0
  98. package/dist/runtime/components/Timeline.vue.d.ts +74 -0
  99. package/dist/runtime/components/Toast.vue +84 -38
  100. package/dist/runtime/components/Toast.vue.d.ts +48 -27
  101. package/dist/runtime/components/ToastProvider.vue +31 -22
  102. package/dist/runtime/components/ToastProvider.vue.d.ts +30 -17
  103. package/dist/runtime/components/Tooltip.vue +33 -21
  104. package/dist/runtime/components/Tooltip.vue.d.ts +37 -15
  105. package/dist/runtime/composables/defineShortcuts.d.ts +16 -0
  106. package/dist/runtime/composables/defineShortcuts.js +129 -0
  107. package/dist/runtime/composables/useAvatarGroup.d.ts +8 -3
  108. package/dist/runtime/composables/useAvatarGroup.js +10 -3
  109. package/dist/runtime/composables/useComponentIcons.d.ts +9 -6
  110. package/dist/runtime/composables/useComponentIcons.js +4 -4
  111. package/dist/runtime/composables/useFieldGroup.d.ts +8 -0
  112. package/dist/runtime/composables/useFieldGroup.js +14 -0
  113. package/dist/runtime/composables/useFormField.d.ts +62 -0
  114. package/dist/runtime/composables/useFormField.js +99 -0
  115. package/dist/runtime/composables/useKbd.d.ts +3 -2
  116. package/dist/runtime/composables/useKbd.js +3 -2
  117. package/dist/runtime/composables/useLocale.d.ts +68 -5
  118. package/dist/runtime/composables/useLocale.js +11 -11
  119. package/dist/runtime/composables/useOverlay.d.ts +51 -15
  120. package/dist/runtime/composables/useOverlay.js +44 -30
  121. package/dist/runtime/composables/usePortal.d.ts +6 -0
  122. package/dist/runtime/composables/usePortal.js +17 -0
  123. package/dist/runtime/composables/useToast.d.ts +12 -5
  124. package/dist/runtime/composables/useToast.js +12 -7
  125. package/dist/runtime/locale/en.d.ts +30 -1
  126. package/dist/runtime/locale/en.js +2 -1
  127. package/dist/runtime/locale/index.d.ts +2 -2
  128. package/dist/runtime/locale/index.js +1 -1
  129. package/dist/runtime/locale/zh_tw.d.ts +31 -0
  130. package/dist/runtime/locale/{zh-tw.js → zh_tw.js} +2 -1
  131. package/dist/runtime/plugins/colors.d.ts +2 -0
  132. package/dist/runtime/plugins/colors.js +50 -0
  133. package/dist/runtime/types/app.config.d.ts +6 -0
  134. package/dist/runtime/types/form.d.ts +58 -17
  135. package/dist/runtime/types/form.js +11 -0
  136. package/dist/runtime/types/index.d.ts +56 -8
  137. package/dist/runtime/types/index.js +49 -1
  138. package/dist/runtime/types/input.d.ts +8 -0
  139. package/dist/runtime/types/locale.d.ts +5 -0
  140. package/dist/runtime/types/style.d.ts +33 -0
  141. package/dist/runtime/types/style.js +0 -0
  142. package/dist/runtime/types/unocss.d.ts +4 -0
  143. package/dist/runtime/types/utils.d.ts +41 -37
  144. package/dist/runtime/utils/form.d.ts +5 -1
  145. package/dist/runtime/utils/form.js +49 -0
  146. package/dist/runtime/utils/index.d.ts +10 -13
  147. package/dist/runtime/utils/index.js +41 -48
  148. package/dist/runtime/utils/link.d.ts +3 -2
  149. package/dist/runtime/utils/link.js +16 -2
  150. package/dist/runtime/utils/locale.d.ts +5 -0
  151. package/dist/runtime/utils/locale.js +10 -0
  152. package/dist/runtime/utils/style.d.ts +94 -0
  153. package/dist/runtime/utils/style.js +37 -0
  154. package/dist/runtime/vue/components/Icon.vue +15 -0
  155. package/dist/runtime/vue/components/Icon.vue.d.ts +7 -0
  156. package/dist/runtime/vue/components/Link.vue +163 -0
  157. package/dist/runtime/vue/components/Link.vue.d.ts +95 -0
  158. package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
  159. package/dist/runtime/vue/composables/useAppConfig.js +4 -0
  160. package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
  161. package/dist/runtime/vue/plugins/color-mode.js +6 -0
  162. package/dist/runtime/vue/plugins/head.d.ts +4 -0
  163. package/dist/runtime/vue/plugins/head.js +9 -0
  164. package/dist/runtime/vue/stubs.d.ts +16 -1
  165. package/dist/runtime/vue/stubs.js +32 -1
  166. package/dist/setup.d.mts +13 -0
  167. package/dist/setup.mjs +12 -0
  168. package/dist/shared/ui.CzIlLITK.mjs +51 -0
  169. package/dist/shared/ui.DLOxhmP0.mjs +4242 -0
  170. package/dist/shared/ui.DpbffTXs.d.mts +84 -0
  171. package/dist/shared/ui.IulR-OYx.d.mts +64 -0
  172. package/dist/types.d.mts +3 -1
  173. package/dist/unocss.d.mts +12 -52
  174. package/dist/unocss.mjs +144 -254
  175. package/dist/unplugin.d.mts +13 -26
  176. package/dist/unplugin.mjs +193 -18
  177. package/dist/vite.d.mts +10 -1
  178. package/dist/vite.mjs +12 -3
  179. package/package.json +154 -87
  180. package/vue-plugin.d.ts +5 -0
  181. package/dist/module.d.ts +0 -13
  182. package/dist/module.mjs.map +0 -1
  183. package/dist/runtime/app/injections.d.ts +0 -9331
  184. package/dist/runtime/app/injections.js +0 -61
  185. package/dist/runtime/components/ButtonGroup.vue +0 -26
  186. package/dist/runtime/components/ButtonGroup.vue.d.ts +0 -26
  187. package/dist/runtime/components/FormItem.vue +0 -90
  188. package/dist/runtime/components/FormItem.vue.d.ts +0 -60
  189. package/dist/runtime/composables/useButtonGroup.d.ts +0 -5
  190. package/dist/runtime/composables/useButtonGroup.js +0 -9
  191. package/dist/runtime/composables/useFormItem.d.ts +0 -27
  192. package/dist/runtime/composables/useFormItem.js +0 -64
  193. package/dist/runtime/composables/useTheme.d.ts +0 -9
  194. package/dist/runtime/composables/useTheme.js +0 -23
  195. package/dist/runtime/index.d.ts +0 -44
  196. package/dist/runtime/index.js +0 -44
  197. package/dist/runtime/locale/zh-tw.d.ts +0 -2
  198. package/dist/runtime/theme/accordion.d.ts +0 -50
  199. package/dist/runtime/theme/accordion.js +0 -28
  200. package/dist/runtime/theme/alert.d.ts +0 -119
  201. package/dist/runtime/theme/alert.js +0 -47
  202. package/dist/runtime/theme/app.d.ts +0 -19
  203. package/dist/runtime/theme/app.js +0 -19
  204. package/dist/runtime/theme/avatar-group.d.ts +0 -46
  205. package/dist/runtime/theme/avatar-group.js +0 -32
  206. package/dist/runtime/theme/avatar.d.ts +0 -50
  207. package/dist/runtime/theme/avatar.js +0 -34
  208. package/dist/runtime/theme/badge.d.ts +0 -76
  209. package/dist/runtime/theme/badge.js +0 -92
  210. package/dist/runtime/theme/breadcrumb.d.ts +0 -61
  211. package/dist/runtime/theme/breadcrumb.js +0 -44
  212. package/dist/runtime/theme/button-group.d.ts +0 -60
  213. package/dist/runtime/theme/button-group.js +0 -42
  214. package/dist/runtime/theme/button.d.ts +0 -184
  215. package/dist/runtime/theme/button.js +0 -164
  216. package/dist/runtime/theme/calendar.d.ts +0 -58
  217. package/dist/runtime/theme/calendar.js +0 -86
  218. package/dist/runtime/theme/card.d.ts +0 -56
  219. package/dist/runtime/theme/card.js +0 -37
  220. package/dist/runtime/theme/carousel.d.ts +0 -107
  221. package/dist/runtime/theme/carousel.js +0 -43
  222. package/dist/runtime/theme/checkbox.d.ts +0 -82
  223. package/dist/runtime/theme/checkbox.js +0 -54
  224. package/dist/runtime/theme/chip.d.ts +0 -61
  225. package/dist/runtime/theme/chip.js +0 -66
  226. package/dist/runtime/theme/collapsible.d.ts +0 -32
  227. package/dist/runtime/theme/collapsible.js +0 -10
  228. package/dist/runtime/theme/drawer.d.ts +0 -142
  229. package/dist/runtime/theme/drawer.js +0 -113
  230. package/dist/runtime/theme/dropdown-menu.d.ts +0 -65
  231. package/dist/runtime/theme/dropdown-menu.js +0 -83
  232. package/dist/runtime/theme/form-item.d.ts +0 -70
  233. package/dist/runtime/theme/form-item.js +0 -34
  234. package/dist/runtime/theme/form.d.ts +0 -2
  235. package/dist/runtime/theme/form.js +0 -7
  236. package/dist/runtime/theme/index.d.ts +0 -41
  237. package/dist/runtime/theme/index.js +0 -41
  238. package/dist/runtime/theme/input-number.d.ts +0 -115
  239. package/dist/runtime/theme/input-number.js +0 -95
  240. package/dist/runtime/theme/input.d.ts +0 -172
  241. package/dist/runtime/theme/input.js +0 -151
  242. package/dist/runtime/theme/kbd.d.ts +0 -33
  243. package/dist/runtime/theme/kbd.js +0 -26
  244. package/dist/runtime/theme/link.d.ts +0 -38
  245. package/dist/runtime/theme/link.js +0 -26
  246. package/dist/runtime/theme/modal.d.ts +0 -42
  247. package/dist/runtime/theme/modal.js +0 -55
  248. package/dist/runtime/theme/pagination.d.ts +0 -74
  249. package/dist/runtime/theme/pagination.js +0 -17
  250. package/dist/runtime/theme/pinInput.d.ts +0 -94
  251. package/dist/runtime/theme/pinInput.js +0 -111
  252. package/dist/runtime/theme/popover.d.ts +0 -32
  253. package/dist/runtime/theme/popover.js +0 -13
  254. package/dist/runtime/theme/progress.d.ts +0 -180
  255. package/dist/runtime/theme/progress.js +0 -95
  256. package/dist/runtime/theme/radio-group.d.ts +0 -104
  257. package/dist/runtime/theme/radio-group.js +0 -61
  258. package/dist/runtime/theme/scroll-area.d.ts +0 -67
  259. package/dist/runtime/theme/scroll-area.js +0 -33
  260. package/dist/runtime/theme/select.d.ts +0 -186
  261. package/dist/runtime/theme/select.js +0 -173
  262. package/dist/runtime/theme/separator.d.ts +0 -74
  263. package/dist/runtime/theme/separator.js +0 -53
  264. package/dist/runtime/theme/skeleton.d.ts +0 -2
  265. package/dist/runtime/theme/skeleton.js +0 -7
  266. package/dist/runtime/theme/slider.d.ts +0 -70
  267. package/dist/runtime/theme/slider.js +0 -52
  268. package/dist/runtime/theme/switch.d.ts +0 -116
  269. package/dist/runtime/theme/switch.js +0 -78
  270. package/dist/runtime/theme/table.d.ts +0 -86
  271. package/dist/runtime/theme/table.js +0 -36
  272. package/dist/runtime/theme/tabs.d.ts +0 -129
  273. package/dist/runtime/theme/tabs.js +0 -146
  274. package/dist/runtime/theme/textarea.d.ts +0 -90
  275. package/dist/runtime/theme/textarea.js +0 -116
  276. package/dist/runtime/theme/toast-provider.d.ts +0 -116
  277. package/dist/runtime/theme/toast-provider.js +0 -97
  278. package/dist/runtime/theme/toast.d.ts +0 -83
  279. package/dist/runtime/theme/toast.js +0 -35
  280. package/dist/runtime/theme/tooltip.d.ts +0 -38
  281. package/dist/runtime/theme/tooltip.js +0 -11
  282. package/dist/runtime/types/components.d.ts +0 -42
  283. package/dist/runtime/utils/extend-theme.d.ts +0 -9
  284. package/dist/runtime/utils/extend-theme.js +0 -27
  285. package/dist/runtime/utils/styler.d.ts +0 -4
  286. package/dist/runtime/utils/styler.js +0 -10
  287. package/dist/runtime/utils/translator.d.ts +0 -18
  288. package/dist/runtime/utils/translator.js +0 -8
  289. package/dist/shared/ui.D1BTWZFB.mjs +0 -5
  290. package/dist/shared/ui.D1BTWZFB.mjs.map +0 -1
  291. package/dist/unocss.d.ts +0 -52
  292. package/dist/unocss.mjs.map +0 -1
  293. package/dist/unplugin.d.ts +0 -26
  294. package/dist/unplugin.mjs.map +0 -1
  295. package/dist/vite.d.ts +0 -9
  296. package/dist/vite.mjs.map +0 -1
  297. /package/dist/runtime/types/{components.js → input.js} +0 -0
@@ -1,43 +1,52 @@
1
1
  import { createSharedComposable } from "@vueuse/core";
2
2
  import { markRaw, reactive, shallowReactive } from "vue";
3
- export const useOverlay = createSharedComposable(() => {
3
+ function _useOverlay() {
4
4
  const overlays = shallowReactive([]);
5
- const generateId = () => `overlay-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
6
- function create(component, options = {}) {
7
- const { props = {}, defaultOpen = false, unmountOnHide = true } = options;
8
- const state = reactive({
9
- id: generateId(),
10
- modelValue: defaultOpen,
11
- component: markRaw(component),
5
+ function create(component, options) {
6
+ const { props = {}, defaultOpen = false, unmountOnHide = true } = options || {};
7
+ const optionsPrivate = reactive({
8
+ id: Symbol(import.meta.dev ? "useOverlay" : ""),
9
+ isOpen: defaultOpen,
12
10
  isMounted: defaultOpen,
11
+ component: markRaw(component),
12
+ originalProps: props,
13
13
  unmountOnHide,
14
- props
14
+ props: { ...props }
15
15
  });
16
- overlays.push(state);
16
+ overlays.push(optionsPrivate);
17
17
  return {
18
- open: (props2) => open(state.id, props2),
19
- close: (value) => close(state.id, value),
20
- patch: (props2) => patch(state.id, props2)
18
+ ...optionsPrivate,
19
+ open: (props2) => open(optionsPrivate.id, props2),
20
+ close: (value) => close(optionsPrivate.id, value),
21
+ patch: (props2) => patch(optionsPrivate.id, props2)
21
22
  };
22
23
  }
23
24
  function open(id, props) {
24
25
  const overlay = getOverlay(id);
25
- if (props)
26
- patch(id, props);
27
- overlay.modelValue = true;
26
+ overlay.props = props ? { ...overlay.originalProps, ...props } : { ...overlay.originalProps };
27
+ overlay.isOpen = true;
28
28
  overlay.isMounted = true;
29
- return new Promise((resolve) => {
30
- overlay.resolve = resolve;
29
+ const result = new Promise((resolve) => {
30
+ overlay.resolvePromise = resolve;
31
+ });
32
+ return Object.assign(result, {
33
+ id,
34
+ isMounted: overlay.isMounted,
35
+ isOpen: overlay.isOpen,
36
+ result
31
37
  });
32
38
  }
33
39
  function close(id, value) {
34
40
  const overlay = getOverlay(id);
35
- overlay.modelValue = false;
36
- if (overlay.resolve) {
37
- overlay.resolve(value);
38
- overlay.resolve = void 0;
41
+ overlay.isOpen = false;
42
+ if (overlay.resolvePromise) {
43
+ overlay.resolvePromise(value);
44
+ overlay.resolvePromise = void 0;
39
45
  }
40
46
  }
47
+ function closeAll() {
48
+ overlays.forEach((overlay) => close(overlay.id));
49
+ }
41
50
  function unmount(id) {
42
51
  const overlay = getOverlay(id);
43
52
  overlay.isMounted = false;
@@ -48,22 +57,27 @@ export const useOverlay = createSharedComposable(() => {
48
57
  }
49
58
  function patch(id, props) {
50
59
  const overlay = getOverlay(id);
51
- Object.entries(props).forEach(([key, value]) => {
52
- overlay.props[key] = value;
53
- });
60
+ overlay.props = { ...overlay.props, ...props };
54
61
  }
55
62
  function getOverlay(id) {
56
- const item = overlays.find((item2) => item2.id === id);
57
- if (!item)
63
+ const overlay = overlays.find((item) => item.id === id);
64
+ if (!overlay)
58
65
  throw new Error("Overlay not found");
59
- return item;
66
+ return overlay;
67
+ }
68
+ function isOpen(id) {
69
+ const overlay = getOverlay(id);
70
+ return overlay.isOpen;
60
71
  }
61
72
  return {
62
73
  overlays,
63
74
  open,
64
75
  close,
76
+ closeAll,
65
77
  create,
66
78
  patch,
67
- unmount
79
+ unmount,
80
+ isOpen
68
81
  };
69
- });
82
+ }
83
+ export const useOverlay = /* @__PURE__ */ createSharedComposable(_useOverlay);
@@ -0,0 +1,6 @@
1
+ import { type Ref } from 'vue';
2
+ export declare const InjectionKeyPortalTarget: import("vue").InjectionKey<Ref<string | boolean | HTMLElement | undefined, string | boolean | HTMLElement | undefined>>, injectPortalTarget: () => Ref<string | boolean | HTMLElement | undefined, string | boolean | HTMLElement | undefined> | undefined, providePortalTarget: (value: Ref<string | boolean | HTMLElement | undefined, string | boolean | HTMLElement | undefined>) => void;
3
+ export declare function usePortal(portal: Ref<boolean | string | HTMLElement | undefined>): import("vue").ComputedRef<{
4
+ to: string | HTMLElement | undefined;
5
+ disabled: boolean;
6
+ }>;
@@ -0,0 +1,17 @@
1
+ import { computed } from "vue";
2
+ import { defineInjection } from "../utils/index.js";
3
+ export const {
4
+ InjectionKey: InjectionKeyPortalTarget,
5
+ inject: injectPortalTarget,
6
+ provide: providePortalTarget
7
+ } = defineInjection("ui.portal-target");
8
+ export function usePortal(portal) {
9
+ const globalPortal = injectPortalTarget();
10
+ const value = computed(() => portal.value === true ? globalPortal?.value : portal.value);
11
+ const disabled = computed(() => typeof value.value === "boolean" ? !value.value : false);
12
+ const to = computed(() => typeof value.value === "boolean" ? "body" : value.value);
13
+ return computed(() => ({
14
+ to: to.value,
15
+ disabled: disabled.value
16
+ }));
17
+ }
@@ -1,8 +1,15 @@
1
- import type { ToastState } from '../types/index.js';
2
- export declare const useToast: () => {
3
- toasts: any;
4
- add: (toast: Partial<ToastState>) => ToastState;
5
- update: (id: string | number, toast: Partial<Omit<ToastState, "id">>) => void;
1
+ import type { Ref } from 'vue';
2
+ import type { ToastEmits, ToastProps } from '../types';
3
+ import type { EmitsToProps } from '../types/utils';
4
+ export declare const InjectionKeyToastMax: import("vue").InjectionKey<Ref<number, number>>, injectToastMax: () => Ref<number, number> | undefined, provideToastMax: (value: Ref<number, number>) => void;
5
+ export interface Toast extends Omit<ToastProps, 'defaultOpen'>, EmitsToProps<ToastEmits> {
6
+ id: string | number;
7
+ onClick?: (toast: Toast) => void;
8
+ }
9
+ export declare function useToast(): {
10
+ toasts: Ref<Toast[], Toast[]>;
11
+ add: (toast: Partial<Toast>) => Toast;
12
+ update: (id: string | number, toast: Partial<Omit<Toast, "id">>) => void;
6
13
  remove: (id: string | number) => void;
7
14
  clear: () => void;
8
15
  };
@@ -1,11 +1,16 @@
1
- import { createSharedComposable } from "@vueuse/core";
2
- import { nextTick, ref } from "vue";
1
+ import { nextTick, shallowRef } from "vue";
3
2
  import { useState } from "#imports";
4
- export const useToast = createSharedComposable(() => {
3
+ import { defineInjection } from "../utils/index.js";
4
+ export const {
5
+ InjectionKey: InjectionKeyToastMax,
6
+ inject: injectToastMax,
7
+ provide: provideToastMax
8
+ } = defineInjection("ui.toast-max");
9
+ export function useToast() {
5
10
  const toasts = useState("toasts", () => []);
6
- const running = ref(false);
7
- const maxToasts = 5;
11
+ const max = injectToastMax();
8
12
  const queue = [];
13
+ const running = shallowRef(false);
9
14
  const generateId = () => `toast-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
10
15
  async function processQueue() {
11
16
  if (running.value || queue.length === 0)
@@ -14,7 +19,7 @@ export const useToast = createSharedComposable(() => {
14
19
  while (queue.length > 0) {
15
20
  const toast = queue.shift();
16
21
  await nextTick();
17
- toasts.value = [...toasts.value, toast].slice(-maxToasts);
22
+ toasts.value = [...toasts.value, toast].slice(-(max?.value ?? 5));
18
23
  }
19
24
  running.value = false;
20
25
  }
@@ -59,4 +64,4 @@ export const useToast = createSharedComposable(() => {
59
64
  remove,
60
65
  clear
61
66
  };
62
- });
67
+ }
@@ -1,2 +1,31 @@
1
- declare const _default: import("../utils/index.js").Locale<import("../types/index.js").Messages>;
1
+ declare const _default: Required<import("@byyuurin/ui-kit").Locale<{
2
+ alert: {
3
+ close: string;
4
+ };
5
+ calendar: {
6
+ prevYear: string;
7
+ nextYear: string;
8
+ prevMonth: string;
9
+ nextMonth: string;
10
+ };
11
+ carousel: {
12
+ dots: string;
13
+ prev: string;
14
+ next: string;
15
+ goto: string;
16
+ };
17
+ inputNumber: {
18
+ increment: string;
19
+ decrement: string;
20
+ };
21
+ modal: {
22
+ close: string;
23
+ };
24
+ table: {
25
+ noData: string;
26
+ };
27
+ toast: {
28
+ close: string;
29
+ };
30
+ }>>;
2
31
  export default _default;
@@ -1,4 +1,4 @@
1
- import { defineLocale } from "../utils/index.js";
1
+ import { defineLocale } from "../utils/locale.js";
2
2
  export default defineLocale({
3
3
  name: "English",
4
4
  code: "en",
@@ -13,6 +13,7 @@ export default defineLocale({
13
13
  nextMonth: "Next month"
14
14
  },
15
15
  carousel: {
16
+ dots: "Choose slide to display",
16
17
  prev: "Prev",
17
18
  next: "Next",
18
19
  goto: "Go to slide {page}"
@@ -1,2 +1,2 @@
1
- export { default as en } from './en.js';
2
- export { default as zhTW } from './zh-tw.js';
1
+ export { default as en } from './en';
2
+ export { default as zh_tw } from './zh_tw';
@@ -1,2 +1,2 @@
1
1
  export { default as en } from "./en.js";
2
- export { default as zhTW } from "./zh-tw.js";
2
+ export { default as zh_tw } from "./zh_tw.js";
@@ -0,0 +1,31 @@
1
+ declare const _default: Required<import("@byyuurin/ui-kit").Locale<{
2
+ alert: {
3
+ close: string;
4
+ };
5
+ calendar: {
6
+ prevYear: string;
7
+ nextYear: string;
8
+ prevMonth: string;
9
+ nextMonth: string;
10
+ };
11
+ carousel: {
12
+ dots: string;
13
+ prev: string;
14
+ next: string;
15
+ goto: string;
16
+ };
17
+ inputNumber: {
18
+ increment: string;
19
+ decrement: string;
20
+ };
21
+ modal: {
22
+ close: string;
23
+ };
24
+ table: {
25
+ noData: string;
26
+ };
27
+ toast: {
28
+ close: string;
29
+ };
30
+ }>>;
31
+ export default _default;
@@ -1,4 +1,4 @@
1
- import { defineLocale } from "../utils/index.js";
1
+ import { defineLocale } from "../utils/locale.js";
2
2
  export default defineLocale({
3
3
  name: "\u7E41\u9AD4\u4E2D\u6587",
4
4
  code: "zh-TW",
@@ -13,6 +13,7 @@ export default defineLocale({
13
13
  nextMonth: "\u4E0B\u500B\u6708"
14
14
  },
15
15
  carousel: {
16
+ dots: "\u9078\u64C7\u8981\u986F\u793A\u7684\u6295\u5F71\u7247",
16
17
  prev: "\u4E0A\u4E00\u9801",
17
18
  next: "\u4E0B\u4E00\u9801",
18
19
  goto: "\u8DF3\u8F49\u5230\u7B2C {page} \u9801"
@@ -0,0 +1,2 @@
1
+ declare const _default: import("#app").Plugin<Record<string, unknown>> & import("#app").ObjectPlugin<Record<string, unknown>>;
2
+ export default _default;
@@ -0,0 +1,50 @@
1
+ import { colors } from "@unocss/preset-wind4/colors";
2
+ import { computed } from "vue";
3
+ import { defineNuxtPlugin, useAppConfig, useHead, useNuxtApp } from "#imports";
4
+ const themeShades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
5
+ function getColor(color, shade) {
6
+ if (color in colors && typeof colors[color] === "object" && shade in colors[color])
7
+ return colors[color][shade];
8
+ return "";
9
+ }
10
+ function generateShades(key, value) {
11
+ return themeShades.map((shade) => `--ui-color-${key}-${shade}: var(--colors-${value === "neutral" ? "tw-neutral" : value}-${shade}, ${getColor(value, shade)});`).join("\n ");
12
+ }
13
+ function generateColor(key, shade) {
14
+ return `--ui-${key}: var(--ui-color-${key}-${shade});`;
15
+ }
16
+ export default defineNuxtPlugin(() => {
17
+ const appConfig = useAppConfig();
18
+ const nuxtApp = useNuxtApp();
19
+ const root = computed(() => {
20
+ const { neutral, ...colors2 } = appConfig.ui.colors;
21
+ return `:root {
22
+ ${Object.entries(appConfig.ui.colors).map(([key, value]) => generateShades(key, value)).join("\n ")}
23
+ }
24
+ :root,
25
+ .light {
26
+ ${Object.keys(colors2).map((key) => generateColor(key, 500)).join("\n ")}
27
+ }
28
+ .dark {
29
+ ${Object.keys(colors2).map((key) => generateColor(key, 400)).join("\n ")}
30
+ }
31
+ `;
32
+ });
33
+ const headData = {
34
+ style: [{
35
+ innerHTML: () => root.value,
36
+ tagPriority: -2,
37
+ id: "ui-colors"
38
+ }]
39
+ };
40
+ if (import.meta.client && nuxtApp.isHydrating && !nuxtApp.payload.serverRendered) {
41
+ const style = document.createElement("style");
42
+ style.innerHTML = root.value;
43
+ style.dataset.uiColors = "";
44
+ document.head.append(style);
45
+ headData.script = [{
46
+ innerHTML: "document.head.removeChild(document.querySelector('[data-ui-colors]'))"
47
+ }];
48
+ }
49
+ useHead(headData);
50
+ });
@@ -0,0 +1,6 @@
1
+ declare module '#build/app.config' {
2
+ import type { AppConfig } from '@nuxt/schema'
3
+
4
+ const _default: AppConfig
5
+ export default _default
6
+ }
@@ -1,6 +1,31 @@
1
1
  import type { StandardSchemaV1 } from '@standard-schema/spec';
2
- import type { FormExpose } from './components.js';
3
- export type FormSchema<_T> = StandardSchemaV1;
2
+ import type { Struct as SuperstructSchema } from 'superstruct';
3
+ import type { ComputedRef, DeepReadonly, Ref } from 'vue';
4
+ import type { GetObjectField, MaybeNull } from './utils';
5
+ export interface Form<S extends FormSchema> {
6
+ validate: <T extends boolean>(opts?: {
7
+ name?: keyof FormData<S, false> | (keyof FormData<S, false>)[];
8
+ silent?: boolean;
9
+ nested?: boolean;
10
+ transform?: T;
11
+ }) => Promise<FormData<S, T> | false>;
12
+ clear: (path?: keyof FormData<S, false> | string | RegExp) => void;
13
+ errors: Ref<FormError[]>;
14
+ setErrors: (errs: FormError[], name?: keyof FormData<S, false> | string | RegExp) => void;
15
+ getErrors: (name?: keyof FormData<S, false> | string | RegExp) => FormError[];
16
+ submit: () => Promise<void>;
17
+ disabled: ComputedRef<boolean>;
18
+ dirty: ComputedRef<boolean>;
19
+ loading: Ref<boolean>;
20
+ dirtyFields: ReadonlySet<DeepReadonly<keyof FormData<S, false>>>;
21
+ touchedFields: ReadonlySet<DeepReadonly<keyof FormData<S, false>>>;
22
+ blurredFields: ReadonlySet<DeepReadonly<keyof FormData<S, false>>>;
23
+ }
24
+ export type FormSchema<I extends object = object, O extends object = I> = SuperstructSchema<any, any> | StandardSchemaV1<I, O>;
25
+ export type InferInput<Schema> = Schema extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Schema> : Schema extends SuperstructSchema<infer I, any> ? I : Schema extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Schema> : never;
26
+ export type InferOutput<Schema> = Schema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Schema> : Schema extends SuperstructSchema<infer O, any> ? O : never;
27
+ export type FormData<S extends FormSchema, T extends boolean = true> = T extends true ? InferOutput<S> : InferInput<S>;
28
+ export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
4
29
  export interface FormError<P extends string = string> {
5
30
  name?: P;
6
31
  message: string;
@@ -8,15 +33,21 @@ export interface FormError<P extends string = string> {
8
33
  export interface FormErrorWithId extends FormError {
9
34
  id?: string;
10
35
  }
11
- export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
12
- export type FormEventType = FormInputEvents;
13
36
  export type FormSubmitEvent<T> = SubmitEvent & {
14
37
  data: T;
15
38
  };
16
- export interface FormChildAttachEvent {
39
+ export interface FormValidationError {
40
+ errors: FormErrorWithId[];
41
+ children?: FormErrorWithId[];
42
+ }
43
+ export type FormErrorEvent = SubmitEvent & FormValidationError;
44
+ export type FormEventType = FormInputEvents;
45
+ export interface FormChildAttachEvent<S extends FormSchema> {
17
46
  type: 'attach';
18
47
  formId: string | number;
19
- validate: FormExpose<any>['validate'];
48
+ validate: Form<any>['validate'];
49
+ name?: string;
50
+ api: Form<S>;
20
51
  }
21
52
  export interface FormChildDetachEvent {
22
53
  type: 'detach';
@@ -27,19 +58,29 @@ export interface FormInputEvent<T extends object> {
27
58
  name: keyof T;
28
59
  eager?: boolean;
29
60
  }
30
- export type FormEvent<T extends object> = FormInputEvent<T> | FormChildAttachEvent | FormChildDetachEvent;
31
- export interface FormValidationError {
32
- errors: FormErrorWithId[];
33
- children?: FormValidationError[];
61
+ export type FormEvent<T extends object> = FormInputEvent<T> | FormChildAttachEvent<any> | FormChildDetachEvent;
62
+ export interface FormInjectedOptions {
63
+ disabled?: boolean;
64
+ validateOnInputDelay?: number;
65
+ }
66
+ export interface FormFieldInjectedOptions<T> {
67
+ name?: string;
68
+ size?: GetObjectField<T, 'size'>;
69
+ error?: string | boolean;
70
+ eagerValidation?: boolean;
71
+ validateOnInputDelay?: number;
72
+ errorPattern?: RegExp;
73
+ hint?: string;
74
+ description?: string;
75
+ help?: string;
76
+ ariaId: string;
34
77
  }
35
- export type FormErrorEvent = SubmitEvent & FormValidationError;
36
78
  export interface ValidateReturnSchema<T> {
37
79
  result: T;
38
- errors: FormError[] | null;
80
+ errors: MaybeNull<FormError[]>;
39
81
  }
40
- export interface FormValidateOptions<T extends object> {
41
- name?: keyof T | (keyof T)[];
42
- silent?: boolean;
43
- nested?: boolean;
44
- transform?: boolean;
82
+ export declare class FormValidationException extends Error {
83
+ formId: string | number;
84
+ errors: FormErrorWithId[];
85
+ constructor(formId: string | number, errors: FormErrorWithId[]);
45
86
  }
@@ -0,0 +1,11 @@
1
+ export class FormValidationException extends Error {
2
+ formId;
3
+ errors;
4
+ // eslint-disable-next-line unicorn/custom-error-definition
5
+ constructor(formId, errors) {
6
+ super("Form validation exception");
7
+ this.formId = formId;
8
+ this.errors = errors;
9
+ Object.setPrototypeOf(this, FormValidationException.prototype);
10
+ }
11
+ }
@@ -1,9 +1,57 @@
1
- import type * as theme from '../theme/index.js';
2
- export * from './components.js';
3
- export * from './form.js';
4
- export * from './locale.js';
5
- export * from './utils.js';
6
- type MergeThemes<T> = {
7
- [P in keyof T as T[P] extends undefined ? never : P]?: T[P] extends Array<infer V> ? V extends string ? string : V[] : T[P] extends object ? MergeThemes<T[P]> : T[P] extends string ? string : T[P];
1
+ import type { AppConfig } from '@nuxt/schema';
2
+ import type { AppConfigUI } from '#build/types/ui';
3
+ export * from '../components/Accordion.vue';
4
+ export * from '../components/Alert.vue';
5
+ export * from '../components/App.vue';
6
+ export * from '../components/Avatar.vue';
7
+ export * from '../components/AvatarGroup.vue';
8
+ export * from '../components/Badge.vue';
9
+ export * from '../components/Breadcrumb.vue';
10
+ export * from '../components/Button.vue';
11
+ export * from '../components/Calendar.vue';
12
+ export * from '../components/Card.vue';
13
+ export * from '../components/Carousel.vue';
14
+ export * from '../components/Checkbox.vue';
15
+ export * from '../components/CheckboxGroup.vue';
16
+ export * from '../components/Chip.vue';
17
+ export * from '../components/Collapsible.vue';
18
+ export * from '../components/Drawer.vue';
19
+ export * from '../components/DropdownMenu.vue';
20
+ export * from '../components/FieldGroup.vue';
21
+ export * from '../components/Form.vue';
22
+ export * from '../components/FormField.vue';
23
+ export * from '../components/Icon.vue';
24
+ export * from '../components/Input.vue';
25
+ export * from '../components/InputNumber.vue';
26
+ export * from '../components/InputTags.vue';
27
+ export * from '../components/Kbd.vue';
28
+ export * from '../components/Link.vue';
29
+ export * from '../components/Marquee.vue';
30
+ export * from '../components/Modal.vue';
31
+ export * from '../components/NavigationMenu.vue';
32
+ export * from '../components/OverlayProvider.vue';
33
+ export * from '../components/Pagination.vue';
34
+ export * from '../components/PinInput.vue';
35
+ export * from '../components/Popover.vue';
36
+ export * from '../components/Progress.vue';
37
+ export * from '../components/RadioGroup.vue';
38
+ export * from '../components/ScrollArea.vue';
39
+ export * from '../components/Select.vue';
40
+ export * from '../components/Separator.vue';
41
+ export * from '../components/Skeleton.vue';
42
+ export * from '../components/Slider.vue';
43
+ export * from '../components/Switch.vue';
44
+ export * from '../components/Table.vue';
45
+ export * from '../components/Tabs.vue';
46
+ export * from '../components/Textarea.vue';
47
+ export * from '../components/Timeline.vue';
48
+ export * from '../components/Toast.vue';
49
+ export * from '../components/ToastProvider.vue';
50
+ export * from '../components/Tooltip.vue';
51
+ export * from './form';
52
+ export * from './locale';
53
+ export * from './style';
54
+ export * from './utils';
55
+ export type RuntimeAppConfig = AppConfig & {
56
+ ui: AppConfigUI;
8
57
  };
9
- export type ThemeExtension = MergeThemes<typeof theme>;
@@ -1,4 +1,52 @@
1
- export * from "./components.js";
1
+ export * from "../components/Accordion.vue";
2
+ export * from "../components/Alert.vue";
3
+ export * from "../components/App.vue";
4
+ export * from "../components/Avatar.vue";
5
+ export * from "../components/AvatarGroup.vue";
6
+ export * from "../components/Badge.vue";
7
+ export * from "../components/Breadcrumb.vue";
8
+ export * from "../components/Button.vue";
9
+ export * from "../components/Calendar.vue";
10
+ export * from "../components/Card.vue";
11
+ export * from "../components/Carousel.vue";
12
+ export * from "../components/Checkbox.vue";
13
+ export * from "../components/CheckboxGroup.vue";
14
+ export * from "../components/Chip.vue";
15
+ export * from "../components/Collapsible.vue";
16
+ export * from "../components/Drawer.vue";
17
+ export * from "../components/DropdownMenu.vue";
18
+ export * from "../components/FieldGroup.vue";
19
+ export * from "../components/Form.vue";
20
+ export * from "../components/FormField.vue";
21
+ export * from "../components/Icon.vue";
22
+ export * from "../components/Input.vue";
23
+ export * from "../components/InputNumber.vue";
24
+ export * from "../components/InputTags.vue";
25
+ export * from "../components/Kbd.vue";
26
+ export * from "../components/Link.vue";
27
+ export * from "../components/Marquee.vue";
28
+ export * from "../components/Modal.vue";
29
+ export * from "../components/NavigationMenu.vue";
30
+ export * from "../components/OverlayProvider.vue";
31
+ export * from "../components/Pagination.vue";
32
+ export * from "../components/PinInput.vue";
33
+ export * from "../components/Popover.vue";
34
+ export * from "../components/Progress.vue";
35
+ export * from "../components/RadioGroup.vue";
36
+ export * from "../components/ScrollArea.vue";
37
+ export * from "../components/Select.vue";
38
+ export * from "../components/Separator.vue";
39
+ export * from "../components/Skeleton.vue";
40
+ export * from "../components/Slider.vue";
41
+ export * from "../components/Switch.vue";
42
+ export * from "../components/Table.vue";
43
+ export * from "../components/Tabs.vue";
44
+ export * from "../components/Textarea.vue";
45
+ export * from "../components/Timeline.vue";
46
+ export * from "../components/Toast.vue";
47
+ export * from "../components/ToastProvider.vue";
48
+ export * from "../components/Tooltip.vue";
2
49
  export * from "./form.js";
3
50
  export * from "./locale.js";
51
+ export * from "./style.js";
4
52
  export * from "./utils.js";
@@ -0,0 +1,8 @@
1
+ export interface ModelModifiers {
2
+ string?: boolean;
3
+ number?: boolean;
4
+ trim?: boolean;
5
+ lazy?: boolean;
6
+ nullable?: boolean;
7
+ optional?: boolean;
8
+ }
@@ -1,3 +1,7 @@
1
+ import type { Locale as DefineLocale, LocaleDirection } from '@byyuurin/ui-kit';
2
+ export type DefineLocaleOptions<M> = DefineLocale<M>;
3
+ export type Locale<M> = Required<DefineLocale<M>>;
4
+ export type Direction = LocaleDirection;
1
5
  export interface Messages {
2
6
  alert: {
3
7
  close: string;
@@ -9,6 +13,7 @@ export interface Messages {
9
13
  nextMonth: string;
10
14
  };
11
15
  carousel: {
16
+ dots: string;
12
17
  prev: string;
13
18
  next: string;
14
19
  goto: string;