x-next 1.10.0 → 1.11.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 (182) hide show
  1. package/AI_CODING.md +97 -0
  2. package/AI_USAGE/catalog.md +111 -0
  3. package/AI_USAGE/components/alert.md +33 -0
  4. package/AI_USAGE/components/bar-chart.md +46 -0
  5. package/AI_USAGE/components/button.md +35 -0
  6. package/AI_USAGE/components/checkbox.md +34 -0
  7. package/AI_USAGE/components/color-picker.md +36 -0
  8. package/AI_USAGE/components/config-provider.md +58 -0
  9. package/AI_USAGE/components/date-picker.md +34 -0
  10. package/AI_USAGE/components/dialog.md +37 -0
  11. package/AI_USAGE/components/dropdown.md +38 -0
  12. package/AI_USAGE/components/empty.md +30 -0
  13. package/AI_USAGE/components/input.md +32 -0
  14. package/AI_USAGE/components/line-chart.md +45 -0
  15. package/AI_USAGE/components/message-box.md +39 -0
  16. package/AI_USAGE/components/message.md +36 -0
  17. package/AI_USAGE/components/notification.md +37 -0
  18. package/AI_USAGE/components/pagination.md +32 -0
  19. package/AI_USAGE/components/pie-chart.md +55 -0
  20. package/AI_USAGE/components/popconfirm.md +33 -0
  21. package/AI_USAGE/components/popover.md +35 -0
  22. package/AI_USAGE/components/progress.md +32 -0
  23. package/AI_USAGE/components/radio.md +35 -0
  24. package/AI_USAGE/components/rate.md +30 -0
  25. package/AI_USAGE/components/select.md +38 -0
  26. package/AI_USAGE/components/slider.md +34 -0
  27. package/AI_USAGE/components/steps.md +33 -0
  28. package/AI_USAGE/components/switch.md +32 -0
  29. package/AI_USAGE/components/tabs.md +33 -0
  30. package/AI_USAGE/components/textarea.md +31 -0
  31. package/AI_USAGE/components/time-picker.md +34 -0
  32. package/AI_USAGE/components/upload.md +60 -0
  33. package/AI_USAGE/core.md +37 -0
  34. package/AI_USAGE/index.md +52 -0
  35. package/AI_USAGE/recipes/form-on-demand.md +42 -0
  36. package/AI_USAGE.md +173 -46
  37. package/CHANGELOG.md +36 -1
  38. package/README.md +15 -2
  39. package/dist/_container/resize-trigger.vue.d.ts +1 -1
  40. package/dist/_hooks/use-dialog-focus.d.ts +7 -0
  41. package/dist/_hooks/use-pointer-drag.d.ts +6 -0
  42. package/dist/_hooks/use-popup-close.d.ts +11 -0
  43. package/dist/_hooks/use-popup-theme.d.ts +5 -0
  44. package/dist/_utils/palette.d.ts +2 -0
  45. package/dist/components/_components/picker/input-range.vue.d.ts +1 -3
  46. package/dist/components/_components/picker/input.vue.d.ts +1 -3
  47. package/dist/components/_components/select-view/select-view.d.ts +9 -0
  48. package/dist/components/alert/Alert.vue.d.ts +1 -1
  49. package/dist/components/alert/index.d.ts +3 -3
  50. package/dist/components/bar-chart/BarChart.d.ts +3 -3
  51. package/dist/components/bar-chart/index.d.ts +9 -9
  52. package/dist/components/color-picker/ColorPicker.d.ts +2 -1
  53. package/dist/components/color-picker/index.d.ts +2 -0
  54. package/dist/components/color-picker/panel.d.ts +6 -0
  55. package/dist/components/config-provider/context.d.ts +7 -1
  56. package/dist/components/date-picker/DatePicker.vue.d.ts +9 -12
  57. package/dist/components/date-picker/index.d.ts +19 -27
  58. package/dist/components/drawer/index.d.ts +51 -9
  59. package/dist/components/drawer/src/Drawer.vue.d.ts +19 -4
  60. package/dist/components/dropdown/Dropdown.vue.d.ts +6 -3
  61. package/dist/components/dropdown/DropdownButton.vue.d.ts +6 -3
  62. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +6 -3
  63. package/dist/components/dropdown/dropdown-panel.vue.d.ts +6 -3
  64. package/dist/components/dropdown/index.d.ts +36 -18
  65. package/dist/components/form-select/Select.d.ts +18 -5
  66. package/dist/components/form-select/SelectDropdown.vue.d.ts +6 -3
  67. package/dist/components/form-select/SelectOption.vue.d.ts +1 -0
  68. package/dist/components/form-select/SelectOptionGroup.vue.d.ts +1 -0
  69. package/dist/components/form-select/hooks/use-options.d.ts +1 -1
  70. package/dist/components/form-select/hooks/use-select.d.ts +1 -1
  71. package/dist/components/form-select/index.d.ts +57 -17
  72. package/dist/components/form-select/interface.d.ts +8 -0
  73. package/dist/components/form-slider/Slider.vue.d.ts +1 -1
  74. package/dist/components/form-slider/index.d.ts +3 -3
  75. package/dist/components/form-textarea/Textarea.vue.d.ts +2 -4
  76. package/dist/components/form-textarea/index.d.ts +6 -12
  77. package/dist/components/image/Image.vue.d.ts +2 -4
  78. package/dist/components/image/index.d.ts +6 -12
  79. package/dist/components/layout/LayoutSidebar.vue.d.ts +5 -5
  80. package/dist/components/layout/index.d.ts +10 -10
  81. package/dist/components/line-chart/LineChart.d.ts +3 -3
  82. package/dist/components/line-chart/index.d.ts +9 -9
  83. package/dist/components/menu/Menu.d.ts +6 -3
  84. package/dist/components/menu/base-menu.vue.d.ts +6 -3
  85. package/dist/components/menu/index.d.ts +12 -6
  86. package/dist/components/menu/sub-menu-pop.vue.d.ts +6 -3
  87. package/dist/components/network/Network.vue.d.ts +1 -1
  88. package/dist/components/network/index.d.ts +3 -3
  89. package/dist/components/pagination/page-options.vue.d.ts +60 -32
  90. package/dist/components/pie-chart/PieChart.d.ts +1 -1
  91. package/dist/components/pie-chart/index.d.ts +3 -3
  92. package/dist/components/resize-box/ResizeBox.vue.d.ts +2 -2
  93. package/dist/components/resize-box/index.d.ts +5 -5
  94. package/dist/components/scrollbar-v2/Scrollbar.vue.d.ts +2 -1
  95. package/dist/components/scrollbar-v2/index.d.ts +6 -3
  96. package/dist/components/table/Table.d.ts +1 -1
  97. package/dist/components/table/index.d.ts +3 -3
  98. package/dist/components/tabs/Tabs.d.ts +1 -1
  99. package/dist/components/tabs/index.d.ts +3 -3
  100. package/dist/components/time-picker/TimeColumn.vue.d.ts +6 -3
  101. package/dist/components/time-picker/TimePanel.vue.d.ts +6 -3
  102. package/dist/components/time-picker/TimePicker.vue.d.ts +9 -12
  103. package/dist/components/time-picker/index.d.ts +19 -27
  104. package/dist/components/trend-chart/components/TrendChart.d.ts +5 -5
  105. package/dist/components/trend-chart/components/trend-chart-curve.d.ts +1 -1
  106. package/dist/components/trend-chart/index.d.ts +14 -14
  107. package/dist/components/trigger/interface.d.ts +2 -0
  108. package/dist/components/virtual-list-v2/virtual-list.vue.d.ts +7 -4
  109. package/dist/es/_hooks/use-dialog-focus.js +69 -0
  110. package/dist/es/_hooks/use-pointer-drag.js +18 -0
  111. package/dist/es/_hooks/use-popup-close.js +27 -0
  112. package/dist/es/_hooks/use-popup-manager.js +26 -24
  113. package/dist/es/_hooks/use-popup-theme.js +18 -0
  114. package/dist/es/_hooks/use-teleport-container.js +9 -10
  115. package/dist/es/_utils/palette.js +57 -52
  116. package/dist/es/components/_components/select-view/select-view.js +89 -78
  117. package/dist/es/components/button/Button.js +1 -1
  118. package/dist/es/components/color-picker/ColorPicker.js +131 -102
  119. package/dist/es/components/color-picker/gradient-slider.js +38 -40
  120. package/dist/es/components/color-picker/panel.js +221 -192
  121. package/dist/es/components/color-picker/sv-panel.js +51 -50
  122. package/dist/es/components/config-provider/ConfigProvider.js +58 -41
  123. package/dist/es/components/dialog/Dialog.js +133 -186
  124. package/dist/es/components/drawer/src/Drawer.vue.js +59 -51
  125. package/dist/es/components/drawer/src/Drawer.vue2.js +117 -107
  126. package/dist/es/components/form/FormItem.vue.js +12 -12
  127. package/dist/es/components/form-input-tag/InputTag.js +1 -1
  128. package/dist/es/components/form-select/Select.js +348 -300
  129. package/dist/es/components/form-select/SelectDropdown.vue.js +7 -7
  130. package/dist/es/components/form-select/SelectOption.vue.js +22 -17
  131. package/dist/es/components/form-select/SelectOption.vue2.js +59 -51
  132. package/dist/es/components/form-select/SelectOptionGroup.vue.js +17 -13
  133. package/dist/es/components/form-select/SelectOptionGroup.vue2.js +8 -5
  134. package/dist/es/components/form-select/hooks/use-options.js +40 -40
  135. package/dist/es/components/form-select/hooks/use-select.js +76 -71
  136. package/dist/es/components/form-switch/Switch.vue.js +24 -24
  137. package/dist/es/components/image/Image.vue.js +12 -12
  138. package/dist/es/components/link/Link.vue.js +6 -6
  139. package/dist/es/components/menu/sub-menu-inline.vue.js +11 -11
  140. package/dist/es/components/menu/sub-menu-pop.vue.js +12 -12
  141. package/dist/es/components/notification/Notification.js +59 -59
  142. package/dist/es/components/resize-box/ResizeBox.vue.js +19 -22
  143. package/dist/es/components/skeleton/Skeleton.vue.js +9 -9
  144. package/dist/es/components/tag/Tag.vue.js +7 -7
  145. package/dist/es/components/trigger/Trigger.js +171 -163
  146. package/dist/es/style.css +1 -1
  147. package/dist/index.cjs +3 -3
  148. package/dist/index.umd.js +3 -3
  149. package/dist/style/bar-chart.js +1 -0
  150. package/dist/style/base.css +1 -1
  151. package/dist/style/button.css +1 -1
  152. package/dist/style/color-picker.css +1 -1
  153. package/dist/style/color-picker.js +4 -0
  154. package/dist/style/date-picker.js +4 -0
  155. package/dist/style/dependencies.json +296 -0
  156. package/dist/style/dialog.js +2 -0
  157. package/dist/style/drawer.js +3 -0
  158. package/dist/style/dropdown.js +5 -0
  159. package/dist/style/form-checkbox.css +1 -1
  160. package/dist/style/form-input-number.js +2 -0
  161. package/dist/style/form-input.css +1 -1
  162. package/dist/style/form-input.js +1 -0
  163. package/dist/style/form-select.js +5 -0
  164. package/dist/style/form-slider.js +5 -0
  165. package/dist/style/form.js +3 -0
  166. package/dist/style/heatmap.js +1 -0
  167. package/dist/style/image.js +2 -0
  168. package/dist/style/layout.js +1 -0
  169. package/dist/style/line-chart.js +1 -0
  170. package/dist/style/menu.js +3 -0
  171. package/dist/style/message-box.js +3 -0
  172. package/dist/style/pagination.js +9 -0
  173. package/dist/style/pie-chart.js +1 -0
  174. package/dist/style/popconfirm.js +3 -0
  175. package/dist/style/popover.js +1 -0
  176. package/dist/style/popup.js +2 -0
  177. package/dist/style/table.js +12 -0
  178. package/dist/style/time-picker.js +3 -0
  179. package/dist/style/tooltip.js +1 -0
  180. package/dist/style/upload.js +4 -0
  181. package/dist/style.css +1 -1
  182. package/package.json +17 -7
@@ -85,13 +85,13 @@ export declare const TrendChart: {
85
85
  }, import('vue').PublicProps, {
86
86
  fill: boolean;
87
87
  status: import('./props').TrendChartStatus;
88
- height: string | number;
89
- width: string | number;
90
88
  grid: Record<string, unknown> | null;
91
- padding: string | number;
92
- stroke: boolean;
93
89
  smooth: boolean;
90
+ stroke: boolean;
94
91
  tooltip: boolean;
92
+ padding: string | number;
93
+ height: string | number;
94
+ width: string | number;
95
95
  dataset: import('./props').DataSet;
96
96
  labels: Record<string, unknown> | null;
97
97
  theme: import('./props').Theme;
@@ -226,8 +226,8 @@ export declare const TrendChart: {
226
226
  }>> & Readonly<{}>, {
227
227
  fill: boolean;
228
228
  data: number[];
229
- stroke: boolean;
230
229
  smooth: boolean;
230
+ stroke: boolean;
231
231
  tooltip: boolean;
232
232
  boundary: import('./props').Boundary;
233
233
  showPoints: import('./props').ShowPoints;
@@ -321,13 +321,13 @@ export declare const TrendChart: {
321
321
  }>, () => VNode, {}, {}, {}, {
322
322
  fill: boolean;
323
323
  status: import('./props').TrendChartStatus;
324
- height: string | number;
325
- width: string | number;
326
324
  grid: Record<string, unknown> | null;
327
- padding: string | number;
328
- stroke: boolean;
329
325
  smooth: boolean;
326
+ stroke: boolean;
330
327
  tooltip: boolean;
328
+ padding: string | number;
329
+ height: string | number;
330
+ width: string | number;
331
331
  dataset: import('./props').DataSet;
332
332
  labels: Record<string, unknown> | null;
333
333
  theme: import('./props').Theme;
@@ -424,13 +424,13 @@ export declare const TrendChart: {
424
424
  }, string, {
425
425
  fill: boolean;
426
426
  status: import('./props').TrendChartStatus;
427
- height: string | number;
428
- width: string | number;
429
427
  grid: Record<string, unknown> | null;
430
- padding: string | number;
431
- stroke: boolean;
432
428
  smooth: boolean;
429
+ stroke: boolean;
433
430
  tooltip: boolean;
431
+ padding: string | number;
432
+ height: string | number;
433
+ width: string | number;
434
434
  dataset: import('./props').DataSet;
435
435
  labels: Record<string, unknown> | null;
436
436
  theme: import('./props').Theme;
@@ -565,8 +565,8 @@ export declare const TrendChart: {
565
565
  }>> & Readonly<{}>, {
566
566
  fill: boolean;
567
567
  data: number[];
568
- stroke: boolean;
569
568
  smooth: boolean;
569
+ stroke: boolean;
570
570
  tooltip: boolean;
571
571
  boundary: import('./props').Boundary;
572
572
  showPoints: import('./props').ShowPoints;
@@ -17,6 +17,8 @@ export interface TriggerProps {
17
17
  blurToClose?: boolean;
18
18
  clickToClose?: boolean;
19
19
  clickOutsideToClose?: boolean;
20
+ scrollToClose?: boolean;
21
+ scrollToCloseDistance?: number;
20
22
  unmountOnClose?: boolean;
21
23
  contentClass?: any;
22
24
  contentStyle?: CSSProperties;
@@ -133,8 +133,8 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
133
133
  }>, {
134
134
  data: Record<string, any>[];
135
135
  component: string | Record<string, any>;
136
- height: string | number;
137
136
  scrollbar: boolean | ScrollbarProps;
137
+ height: string | number;
138
138
  fixedSize: boolean;
139
139
  estimatedSize: number;
140
140
  buffer: number;
@@ -198,11 +198,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
198
198
  modifier: (className: string) => string;
199
199
  is: (className: string) => string;
200
200
  };
201
- cls: import('vue').ComputedRef<unknown[]>;
201
+ cls: import('vue').ComputedRef<(string | false | Record<string, any> | unknown[] | null | undefined)[]>;
202
202
  style: import('vue').ComputedRef<import('vue').StyleValue[]>;
203
203
  rootRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
204
204
  getContainerAttrs: () => {
205
205
  [x: string]: unknown;
206
+ class?: import('vue').ClassValue;
206
207
  };
207
208
  getContainerStyle: () => import('vue').StyleValue;
208
209
  containerRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
@@ -325,11 +326,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
325
326
  modifier: (className: string) => string;
326
327
  is: (className: string) => string;
327
328
  };
328
- cls: import('vue').ComputedRef<unknown[]>;
329
+ cls: import('vue').ComputedRef<(string | false | Record<string, any> | unknown[] | null | undefined)[]>;
329
330
  style: import('vue').ComputedRef<import('vue').StyleValue[]>;
330
331
  rootRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
331
332
  getContainerAttrs: () => {
332
333
  [x: string]: unknown;
334
+ class?: import('vue').ClassValue;
333
335
  };
334
336
  getContainerStyle: () => import('vue').StyleValue;
335
337
  containerRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
@@ -396,11 +398,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
396
398
  modifier: (className: string) => string;
397
399
  is: (className: string) => string;
398
400
  };
399
- cls: import('vue').ComputedRef<unknown[]>;
401
+ cls: import('vue').ComputedRef<(string | false | Record<string, any> | unknown[] | null | undefined)[]>;
400
402
  style: import('vue').ComputedRef<import('vue').StyleValue[]>;
401
403
  rootRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
402
404
  getContainerAttrs: () => {
403
405
  [x: string]: unknown;
406
+ class?: import('vue').ClassValue;
404
407
  };
405
408
  getContainerStyle: () => import('vue').StyleValue;
406
409
  containerRef: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
@@ -0,0 +1,69 @@
1
+ import { watch as g, onBeforeUnmount as S, nextTick as N } from "vue";
2
+ const w = [
3
+ "a[href]",
4
+ "button:not([disabled])",
5
+ "textarea:not([disabled])",
6
+ 'input:not([disabled]):not([type="hidden"])',
7
+ "select:not([disabled])",
8
+ "[tabindex]"
9
+ ].join(","), f = (r) => r instanceof HTMLInputElement && r.type === "radio" && !!r.name, v = (r, d) => r.name === d.name && r.form === d.form && r.getRootNode() === d.getRootNode(), x = (r) => {
10
+ const d = Array.from(r.querySelectorAll(w)).filter((t) => {
11
+ if (t.tabIndex < 0 || t.matches(':disabled, input[type="hidden"]') || t.closest('[hidden], [inert], [aria-hidden="true"]')) return !1;
12
+ for (let n = t; n; n = n.parentElement) {
13
+ if (n.matches("fieldset[disabled]") && t.matches("button, input, select, textarea")) {
14
+ const l = Array.from(n.children).find((c) => c.tagName === "LEGEND");
15
+ if (!(l != null && l.contains(t))) return !1;
16
+ }
17
+ const i = window.getComputedStyle(n);
18
+ if (i.display === "none" || i.visibility === "hidden" || i.visibility === "collapse") return !1;
19
+ }
20
+ return !0;
21
+ });
22
+ return d.filter((t) => {
23
+ if (!f(t)) return !0;
24
+ const n = d.filter(
25
+ (i) => f(i) && v(t, i)
26
+ );
27
+ return t === (n.find((i) => i.checked) ?? n[0]);
28
+ }).sort((t, n) => (t.tabIndex || 1 / 0) - (n.tabIndex || 1 / 0));
29
+ }, K = (r, d, t, n, i) => {
30
+ let l = null, c = !1;
31
+ g(r, (e) => {
32
+ e && typeof document < "u" && (l = document.activeElement);
33
+ }, { immediate: !0, flush: "sync" });
34
+ const E = () => {
35
+ typeof document > "u" || N(() => {
36
+ const e = t.value;
37
+ !e || !r.value || c || !i() || (x(e)[0] ?? e).focus({ preventScroll: !0 });
38
+ });
39
+ }, m = () => {
40
+ var o;
41
+ const e = l;
42
+ if (l = null, !(e != null && e.isConnected) || typeof document > "u") return;
43
+ const s = document.activeElement;
44
+ s != null && s.isConnected && s !== document.body && s !== document.documentElement && s !== e && !((o = d.value) != null && o.contains(s)) || e.focus({ preventScroll: !0 });
45
+ }, I = (e) => {
46
+ if (e.key !== "Tab" || !n.value || !i()) return;
47
+ const s = t.value;
48
+ if (!s) return;
49
+ const o = x(s), u = document.activeElement;
50
+ if (f(u)) {
51
+ const a = o.findIndex((h) => f(h) && v(u, h));
52
+ a >= 0 && (o[a] = u);
53
+ }
54
+ const p = o.indexOf(u);
55
+ if (p >= 0 && o.some((a) => a.tabIndex > 0)) {
56
+ e.preventDefault(), o[(p + (e.shiftKey ? -1 : 1) + o.length) % o.length].focus({ preventScroll: !0 });
57
+ return;
58
+ }
59
+ const y = o[0] ?? s, b = o.at(-1) ?? s;
60
+ (!o.includes(u) || (e.shiftKey ? u === y : u === b)) && (e.preventDefault(), (e.shiftKey ? b : y).focus({ preventScroll: !0 }));
61
+ };
62
+ return S(() => {
63
+ c = !0, m();
64
+ }), { focus: E, restore: m, onKeydown: I };
65
+ };
66
+ export {
67
+ x as getTabbableElements,
68
+ K as useDialogFocus
69
+ };
@@ -0,0 +1,18 @@
1
+ import { ref as p, watch as s, onBeforeUnmount as c } from "vue";
2
+ const l = (u, d) => {
3
+ const o = p(!1);
4
+ let r, n;
5
+ const i = (e) => {
6
+ !o.value || n === "pointer" && e.pointerId !== r || d(e.clientX, e.clientY);
7
+ }, t = (e) => {
8
+ e && "pointerId" in e && e.pointerId !== r || (o.value = !1, n = void 0, r = void 0, !(typeof document > "u") && (document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", t), document.removeEventListener("pointermove", i), document.removeEventListener("pointerup", t), document.removeEventListener("pointercancel", t), window.removeEventListener("blur", t)));
9
+ }, m = (e) => {
10
+ u.value || o.value || e.button !== 0 || (e.preventDefault(), o.value = !0, n = e.type === "pointerdown" ? "pointer" : "mouse", r = n === "pointer" ? e.pointerId : void 0, d(e.clientX, e.clientY), document.addEventListener(n === "pointer" ? "pointermove" : "mousemove", i), document.addEventListener(n === "pointer" ? "pointerup" : "mouseup", t), n === "pointer" && document.addEventListener("pointercancel", t), window.addEventListener("blur", t));
11
+ };
12
+ return s(u, (e) => {
13
+ e && t();
14
+ }, { flush: "sync" }), c(() => t()), { dragging: o, start: m };
15
+ };
16
+ export {
17
+ l as usePointerDrag
18
+ };
@@ -0,0 +1,27 @@
1
+ import { reactive as h, watch as m, onBeforeUnmount as d } from "vue";
2
+ const y = (n, f, u) => {
3
+ const e = h({ ok: !1, cancel: !1 });
4
+ let r = 0, l = !1;
5
+ const c = () => {
6
+ r++, e.ok = e.cancel = !1;
7
+ };
8
+ return m(n, c, { flush: "sync" }), d(() => {
9
+ l = !0, c();
10
+ }), { loading: e, requestClose: (s, a) => {
11
+ if (l || !n.value || e.ok || e.cancel) return;
12
+ const i = ++r;
13
+ e[s] = !0;
14
+ const p = () => !l && n.value && i === r, o = (t) => {
15
+ p() && (e[s] = !1, t && u(s, a));
16
+ };
17
+ try {
18
+ const t = f(s, a);
19
+ t && typeof t == "object" && "then" in t ? Promise.resolve(t).then(o, () => o(!1)) : o(t);
20
+ } catch {
21
+ o(!1);
22
+ }
23
+ } };
24
+ };
25
+ export {
26
+ y as usePopupClose
27
+ };
@@ -1,51 +1,53 @@
1
1
  var c = Object.defineProperty;
2
- var i = (o, e, t) => e in o ? c(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var p = (o, e, t) => i(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { ref as l, watch as g, onMounted as S, onBeforeUnmount as f, readonly as m } from "vue";
5
- const h = 1e3, k = 3e3, E = 1;
6
- class _ {
2
+ var l = (o, e, t) => e in o ? c(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var a = (o, e, t) => l(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { ref as f, watch as g, onMounted as S, onBeforeUnmount as m, readonly as h } from "vue";
5
+ const k = 1e3, E = 3e3, _ = 1;
6
+ class x {
7
7
  constructor() {
8
- p(this, "popupStack", {
8
+ a(this, "popupStack", {
9
9
  popup: /* @__PURE__ */ new Set(),
10
10
  dialog: /* @__PURE__ */ new Set(),
11
11
  message: /* @__PURE__ */ new Set()
12
12
  });
13
- p(this, "getNextZIndex", (e) => (e === "message" ? Array.from(this.popupStack.message).pop() || k : Array.from(this.popupStack.popup).pop() || h) + E);
14
- p(this, "add", (e) => {
13
+ a(this, "getNextZIndex", (e) => (e === "message" ? Array.from(this.popupStack.message).pop() || E : Array.from(this.popupStack.popup).pop() || k) + _);
14
+ a(this, "add", (e) => {
15
15
  const t = this.getNextZIndex(e);
16
16
  return this.popupStack[e].add(t), e === "dialog" && this.popupStack.popup.add(t), t;
17
17
  });
18
- p(this, "delete", (e, t) => {
18
+ a(this, "delete", (e, t) => {
19
19
  this.popupStack[t].delete(e), t === "dialog" && this.popupStack.popup.delete(e);
20
20
  });
21
- p(this, "isLastDialog", (e) => this.popupStack.dialog.size > 1 ? e === Array.from(this.popupStack.dialog).pop() : !0);
21
+ a(this, "isLastDialog", (e) => this.popupStack.dialog.size > 1 ? e === Array.from(this.popupStack.dialog).pop() : !0);
22
22
  }
23
23
  }
24
- const u = new _();
25
- function A(o, {
24
+ const s = new x();
25
+ function D(o, {
26
26
  visible: e,
27
27
  runOnMounted: t
28
28
  } = {}) {
29
- const a = l(0), n = () => {
30
- a.value = u.add(o);
31
- }, r = () => {
32
- u.delete(a.value, o);
33
- }, s = () => o === "dialog" ? u.isLastDialog(a.value) : !1;
29
+ const p = f(0);
30
+ let r = !1;
31
+ const n = () => {
32
+ r || (p.value = s.add(o), r = !0);
33
+ }, u = () => {
34
+ r && (s.delete(p.value, o), r = !1);
35
+ }, d = () => o === "dialog" ? s.isLastDialog(p.value) : !1;
34
36
  return g(
35
37
  () => e == null ? void 0 : e.value,
36
- (d) => {
37
- d ? n() : r();
38
+ (i) => {
39
+ i ? n() : u();
38
40
  },
39
41
  {
40
42
  immediate: !0
41
43
  }
42
- ), t && (S(n), f(r)), {
43
- zIndex: m(a),
44
+ ), t && S(n), m(u), {
45
+ zIndex: h(p),
44
46
  open: n,
45
- close: r,
46
- isLastDialog: s
47
+ close: u,
48
+ isLastDialog: d
47
49
  };
48
50
  }
49
51
  export {
50
- A as default
52
+ D as default
51
53
  };
@@ -0,0 +1,18 @@
1
+ import { inject as m, computed as o } from "vue";
2
+ import { configProviderInjectionKey as r } from "../components/config-provider/context.js";
3
+ const d = () => {
4
+ const e = m(r, void 0);
5
+ return {
6
+ popupThemeStyle: o(() => {
7
+ var p;
8
+ return (p = e == null ? void 0 : e.popupTheme) == null ? void 0 : p.value.style;
9
+ }),
10
+ popupThemeName: o(() => {
11
+ var p;
12
+ return (p = e == null ? void 0 : e.popupTheme) != null && p.value.dark ? "dark" : void 0;
13
+ })
14
+ };
15
+ };
16
+ export {
17
+ d as usePopupTheme
18
+ };
@@ -1,20 +1,19 @@
1
- import { ref as c, onMounted as i, watch as v } from "vue";
1
+ import { ref as u, onMounted as f, watch as i } from "vue";
2
2
  import { getElement as s } from "../_utils/dom.js";
3
3
  const g = ({
4
4
  popupContainer: e,
5
- visible: u,
5
+ visible: a,
6
6
  defaultContainer: m = "body",
7
- documentContainer: f
7
+ documentContainer: d
8
8
  }) => {
9
- const t = c(e.value), o = c(), l = () => {
10
- const n = s(e.value), r = n ? e.value : m, a = n ?? document.documentElement;
11
- r !== t.value && (t.value = r), a !== o.value && (o.value = a);
9
+ const t = u(e.value), n = u(), o = () => {
10
+ if (typeof document > "u") return;
11
+ const r = s(e.value), l = r ? e.value : m, c = r ?? document.documentElement;
12
+ l !== t.value && (t.value = l), c !== n.value && (n.value = c);
12
13
  };
13
- return i(() => l()), v(u, (n) => {
14
- t.value !== e.value && n && l();
15
- }), {
14
+ return f(() => o()), i([e, a], o, { flush: "post" }), {
16
15
  teleportContainer: t,
17
- containerRef: o
16
+ containerRef: n
18
17
  };
19
18
  };
20
19
  export {
@@ -1,65 +1,70 @@
1
- import { PALETTE_ALIASES as g, PALETTE_ALIASES_DARK as E } from "../_styles/palette-aliases.js";
2
- const x = 2.05, d = 95.5, p = 22, A = [1, 0.8, 0.6, 0.4, 0.2], _ = [1 / 3, 2 / 3, 1], b = 90, y = 300, m = (s, a, i) => Math.min(i, Math.max(a, s)), $ = (s) => {
3
- if (typeof s != "string") return null;
4
- const a = s.trim();
5
- if (a.startsWith("#")) {
6
- const t = a.slice(1);
1
+ import { PALETTE_ALIASES as x, PALETTE_ALIASES_DARK as b } from "../_styles/palette-aliases.js";
2
+ const y = 2.05, p = 95.5, d = 22, A = [1, 0.8, 0.6, 0.4, 0.2], _ = [1 / 3, 2 / 3, 1], S = 90, H = 300, u = (r, c, i) => Math.min(i, Math.max(c, r)), P = (r) => {
3
+ if (typeof r != "string") return null;
4
+ const c = r.trim();
5
+ if (c.startsWith("#")) {
6
+ const t = c.slice(1);
7
7
  if (!/^(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)) return null;
8
- const c = t.length === 3 ? [...t].map((h) => h + h).join("") : t.length === 6 || t.length === 8 ? t.slice(0, 6) : null;
9
- return c ? [0, 2, 4].map((h) => parseInt(c.slice(h, h + 2), 16)) : null;
8
+ const m = t.length === 3 ? [...t].map((a) => a + a).join("") : t.length === 6 || t.length === 8 ? t.slice(0, 6) : null;
9
+ return m ? [0, 2, 4].map((a) => parseInt(m.slice(a, a + 2), 16)) : null;
10
10
  }
11
- const i = a.match(/^rgba?\(([^)]+)\)$/i);
11
+ const i = c.match(/^rgba?\(([^)]+)\)$/i);
12
12
  if (!i) return null;
13
- const o = i[1].trim(), r = o.includes(",") ? o.split(",").map((t) => t.trim()) : o.split(/\s*\/\s*/)[0].split(/\s+/), e = o.includes(",") ? r[3] : o.includes("/") ? o.split("/")[1].trim() : void 0;
14
- if (o.split("/").length > 2 || r.length < 3 || r.length > (o.includes(",") ? 4 : 3)) return null;
15
- const n = /^[+-]?(?:\d+\.?\d*|\.\d+)%?$/;
16
- if (r.slice(0, 3).some((t) => !n.test(t)) || e !== void 0 && !n.test(e)) return null;
17
- const l = r.slice(0, 3).map((t) => t.endsWith("%") ? Math.round(parseFloat(t) / 100 * 255) : Number(t));
18
- return l.some((t) => !Number.isFinite(t)) ? null : l.map((t) => m(Math.round(t), 0, 255));
19
- }, H = ([s, a, i]) => {
20
- const o = s / 255, r = a / 255, e = i / 255, n = Math.max(o, r, e), l = Math.min(o, r, e), t = n - l, c = (n + l) / 2;
21
- let h = 0, u = 0;
22
- return t !== 0 && (u = c > 0.5 ? t / (2 - n - l) : t / (n + l), n === o ? h = (r - e) / t + (r < e ? 6 : 0) : n === r ? h = (e - o) / t + 2 : h = (o - r) / t + 4, h *= 60), { h, s: u * 100, l: c * 100 };
23
- }, S = ({ h: s, s: a, l: i }) => {
24
- const o = m(a, 0, 100) / 100, r = m(i, 0, 100) / 100, e = (s % 360 + 360) % 360, n = (1 - Math.abs(2 * r - 1)) * o, l = n * (1 - Math.abs(e / 60 % 2 - 1)), t = r - n / 2;
25
- let c;
26
- return e < 60 ? c = [n, l, 0] : e < 120 ? c = [l, n, 0] : e < 180 ? c = [0, n, l] : e < 240 ? c = [0, l, n] : e < 300 ? c = [l, 0, n] : c = [n, 0, l], c.map((h) => m(Math.round((h + t) * 255), 0, 255));
27
- }, P = (s) => `#${s.map((a) => m(Math.round(a), 0, 255).toString(16).padStart(2, "0")).join("")}`, I = (s) => s <= b || s >= y ? 1 : -1, L = (s, a = {}) => {
28
- const i = $(s);
13
+ const n = i[1].trim(), s = n.includes(",") ? n.split(",").map((t) => t.trim()) : n.split(/\s*\/\s*/)[0].split(/\s+/), e = n.includes(",") ? s[3] : n.includes("/") ? n.split("/")[1].trim() : void 0;
14
+ if (n.split("/").length > 2 || s.length < 3 || s.length > (n.includes(",") ? 4 : 3)) return null;
15
+ const o = /^[+-]?(?:\d+\.?\d*|\.\d+)%?$/;
16
+ if (s.slice(0, 3).some((t) => !o.test(t)) || e !== void 0 && !o.test(e)) return null;
17
+ const l = s.slice(0, 3).map((t) => t.endsWith("%") ? Math.round(parseFloat(t) / 100 * 255) : Number(t));
18
+ return l.some((t) => !Number.isFinite(t)) ? null : l.map((t) => u(Math.round(t), 0, 255));
19
+ }, $ = ([r, c, i]) => {
20
+ const n = r / 255, s = c / 255, e = i / 255, o = Math.max(n, s, e), l = Math.min(n, s, e), t = o - l, m = (o + l) / 2;
21
+ let a = 0, h = 0;
22
+ return t !== 0 && (h = m > 0.5 ? t / (2 - o - l) : t / (o + l), o === n ? a = (s - e) / t + (s < e ? 6 : 0) : o === s ? a = (e - n) / t + 2 : a = (n - s) / t + 4, a *= 60), { h: a, s: h * 100, l: m * 100 };
23
+ }, I = ({ h: r, s: c, l: i }) => {
24
+ const n = u(c, 0, 100) / 100, s = u(i, 0, 100) / 100, e = (r % 360 + 360) % 360, o = (1 - Math.abs(2 * s - 1)) * n, l = o * (1 - Math.abs(e / 60 % 2 - 1)), t = s - o / 2;
25
+ let m;
26
+ return e < 60 ? m = [o, l, 0] : e < 120 ? m = [l, o, 0] : e < 180 ? m = [0, o, l] : e < 240 ? m = [0, l, o] : e < 300 ? m = [l, 0, o] : m = [o, 0, l], m.map((a) => u(Math.round((a + t) * 255), 0, 255));
27
+ }, L = (r) => `#${r.map((c) => u(Math.round(c), 0, 255).toString(16).padStart(2, "0")).join("")}`, R = (r) => r <= S || r >= H ? 1 : -1, g = (r, c = {}) => {
28
+ const i = P(r);
29
29
  if (!i)
30
- throw new Error(`[x-next] generatePalette: 无法解析种子色 "${s}"`);
31
- const { h: o, s: r, l: e } = H(i), n = I(o), { dark: l = !1 } = a, t = l ? Math.min(p, e) : Math.max(d, e), c = l ? Math.max(d, e) : Math.min(p, e), h = [];
32
- for (let u = 0; u < 9; u += 1) {
30
+ throw new Error(`[x-next] generatePalette: 无法解析种子色 "${r}"`);
31
+ const { h: n, s, l: e } = $(i), o = R(n), { dark: l = !1 } = c, t = l ? Math.min(d, e) : Math.max(p, e), m = l ? Math.max(p, e) : Math.min(d, e), a = [];
32
+ for (let h = 0; h < 9; h += 1) {
33
33
  let f;
34
- u < 5 ? f = e + (t - e) * A[u] : u === 5 ? f = e : f = e + (c - e) * _[u - 6];
35
- const T = 5 - u, M = n * x * T * (l ? -1 : 1);
36
- h.push(P(S({ h: o + M, s: r, l: m(f, 0, 100) })));
34
+ h < 5 ? f = e + (t - e) * A[h] : h === 5 ? f = e : f = e + (m - e) * _[h - 6];
35
+ const E = 5 - h, M = o * y * E * (l ? -1 : 1);
36
+ a.push(L(I({ h: n + M, s, l: u(f, 0, 100) })));
37
37
  }
38
- return h;
39
- }, G = (s, a = {}) => {
40
- const { name: i = "primary", target: o, dark: r } = a, e = L(s, { dark: r }), n = o ?? (typeof document < "u" ? document.documentElement : null);
41
- if (n) {
42
- n.style.setProperty(`--x-color-${i}`, e[5]), e.forEach((t, c) => {
43
- n.style.setProperty(`--x-color-${i}-${c + 1}`, t);
38
+ return a;
39
+ }, G = (r, c = {}) => {
40
+ const { name: i = "primary", target: n, dark: s } = c, e = g(r, { dark: s }), o = n ?? (typeof document < "u" ? document.documentElement : null);
41
+ if (o) {
42
+ o.style.setProperty(`--x-color-${i}`, e[5]), e.forEach((l, t) => {
43
+ o.style.setProperty(`--x-color-${i}-${t + 1}`, l);
44
44
  });
45
- const l = g[i];
46
- if (l) {
47
- const t = r ? E[i] : void 0;
48
- for (const [c, h] of Object.entries(l))
49
- n.style.setProperty(c, (t == null ? void 0 : t[c]) ?? h);
50
- }
45
+ for (const [l, t] of Object.entries(T(i, s)))
46
+ o.style.setProperty(l, t);
51
47
  }
52
48
  return e;
53
- }, W = (s = "primary") => {
54
- const a = [`--x-color-${s}`, ...Array.from({ length: 9 }, (o, r) => `--x-color-${s}-${r + 1}`)], i = g[s];
55
- return i ? [...a, ...Object.keys(i)] : a;
49
+ }, T = (r, c) => {
50
+ const i = x[r] ?? {}, n = c ? b[r] : void 0;
51
+ return Object.fromEntries(
52
+ Object.entries(i).map(([s, e]) => [s, (n == null ? void 0 : n[s]) ?? e])
53
+ );
54
+ }, W = (r, c = !1) => {
55
+ const i = g(r, { dark: c });
56
+ return {
57
+ "--x-color-primary": i[5],
58
+ ...Object.fromEntries(i.map((n, s) => [`--x-color-primary-${s + 1}`, n])),
59
+ ...T("primary", c)
60
+ };
56
61
  };
57
62
  export {
58
63
  G as applyThemeColor,
59
- L as generatePalette,
60
- W as getThemeColorProperties,
61
- S as hslToRgb,
62
- $ as parseColor,
63
- H as rgbToHsl,
64
- P as toHex
64
+ g as generatePalette,
65
+ W as getThemeColorStyles,
66
+ I as hslToRgb,
67
+ P as parseColor,
68
+ $ as rgbToHsl,
69
+ L as toHex
65
70
  };