@mcistudio/unoui-vue 1.0.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.
- package/README.md +95 -0
- package/dist/alert/Alert.vue.d.ts +67 -0
- package/dist/alert/index.d.ts +40 -0
- package/dist/alert/index.js +2 -0
- package/dist/attrs.d.ts +11 -0
- package/dist/attrs.js +16 -0
- package/dist/attrs.js.map +1 -0
- package/dist/badge/Badge.vue.d.ts +57 -0
- package/dist/badge/BadgeRibbon.vue.d.ts +34 -0
- package/dist/badge/index.d.ts +42 -0
- package/dist/badge/index.js +2 -0
- package/dist/build.d.ts +2 -0
- package/dist/button/Button.vue.d.ts +46 -0
- package/dist/button/ButtonGroup.vue.d.ts +13 -0
- package/dist/button/index.d.ts +13 -0
- package/dist/button/index.js +2 -0
- package/dist/checkbox/Checkbox.vue.d.ts +47 -0
- package/dist/checkbox/CheckboxGroup.vue.d.ts +38 -0
- package/dist/checkbox/index.d.ts +30 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/chunks/Progress-BL4KZ3HE.js +271 -0
- package/dist/chunks/Progress-BL4KZ3HE.js.map +1 -0
- package/dist/chunks/Skeleton-ohStUD4M.js +153 -0
- package/dist/chunks/Skeleton-ohStUD4M.js.map +1 -0
- package/dist/chunks/Table-DhXmuKQd.js +330 -0
- package/dist/chunks/Table-DhXmuKQd.js.map +1 -0
- package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/chunks/alert-CczW_DKs.js +190 -0
- package/dist/chunks/alert-CczW_DKs.js.map +1 -0
- package/dist/chunks/badge-BHOZeImh.js +287 -0
- package/dist/chunks/badge-BHOZeImh.js.map +1 -0
- package/dist/chunks/button-pDObrN_X.js +168 -0
- package/dist/chunks/button-pDObrN_X.js.map +1 -0
- package/dist/chunks/checkbox-9_0oR4kg.js +260 -0
- package/dist/chunks/checkbox-9_0oR4kg.js.map +1 -0
- package/dist/chunks/colorpicker-CcizUCQv.js +594 -0
- package/dist/chunks/colorpicker-CcizUCQv.js.map +1 -0
- package/dist/chunks/datepicker-Cy808x7X.js +1414 -0
- package/dist/chunks/datepicker-Cy808x7X.js.map +1 -0
- package/dist/chunks/drawer-C3JZ28Xo.js +193 -0
- package/dist/chunks/drawer-C3JZ28Xo.js.map +1 -0
- package/dist/chunks/dropdown-0l967g7D.js +329 -0
- package/dist/chunks/dropdown-0l967g7D.js.map +1 -0
- package/dist/chunks/form-Qeqkd-HH.js +642 -0
- package/dist/chunks/form-Qeqkd-HH.js.map +1 -0
- package/dist/chunks/input-BDOXVCrK.js +1281 -0
- package/dist/chunks/input-BDOXVCrK.js.map +1 -0
- package/dist/chunks/inputOtp-Dyxj9lNj.js +261 -0
- package/dist/chunks/inputOtp-Dyxj9lNj.js.map +1 -0
- package/dist/chunks/message-xPfuG0EX.js +107 -0
- package/dist/chunks/message-xPfuG0EX.js.map +1 -0
- package/dist/chunks/millercolumns-Dp3fBrq6.js +426 -0
- package/dist/chunks/millercolumns-Dp3fBrq6.js.map +1 -0
- package/dist/chunks/modal-D6l1iIvE.js +81 -0
- package/dist/chunks/modal-D6l1iIvE.js.map +1 -0
- package/dist/chunks/pagination-Bc583AQX.js +265 -0
- package/dist/chunks/pagination-Bc583AQX.js.map +1 -0
- package/dist/chunks/popconfirm-D6lUfSxG.js +343 -0
- package/dist/chunks/popconfirm-D6lUfSxG.js.map +1 -0
- package/dist/chunks/qrcode-B0t_pZna.js +1099 -0
- package/dist/chunks/qrcode-B0t_pZna.js.map +1 -0
- package/dist/chunks/radio-DnYm59xH.js +477 -0
- package/dist/chunks/radio-DnYm59xH.js.map +1 -0
- package/dist/chunks/rate-0sme__Kb.js +309 -0
- package/dist/chunks/rate-0sme__Kb.js.map +1 -0
- package/dist/chunks/select-ChTfQM5u.js +417 -0
- package/dist/chunks/select-ChTfQM5u.js.map +1 -0
- package/dist/chunks/slider-C-W5GzTP.js +724 -0
- package/dist/chunks/slider-C-W5GzTP.js.map +1 -0
- package/dist/chunks/splitter-CgfiXY65.js +524 -0
- package/dist/chunks/splitter-CgfiXY65.js.map +1 -0
- package/dist/chunks/switch-BULGbODP.js +327 -0
- package/dist/chunks/switch-BULGbODP.js.map +1 -0
- package/dist/chunks/tab-Dxfg1_To.js +663 -0
- package/dist/chunks/tab-Dxfg1_To.js.map +1 -0
- package/dist/chunks/tag-BYmNsrZC.js +167 -0
- package/dist/chunks/tag-BYmNsrZC.js.map +1 -0
- package/dist/chunks/timepicker-DsGIdcf8.js +1059 -0
- package/dist/chunks/timepicker-DsGIdcf8.js.map +1 -0
- package/dist/chunks/tooltip-DMhiAqto.js +242 -0
- package/dist/chunks/tooltip-DMhiAqto.js.map +1 -0
- package/dist/colorpicker/ColorPicker.vue.d.ts +30 -0
- package/dist/colorpicker/color.d.ts +56 -0
- package/dist/colorpicker/color.js +99 -0
- package/dist/colorpicker/color.js.map +1 -0
- package/dist/colorpicker/index.d.ts +12 -0
- package/dist/colorpicker/index.js +2 -0
- package/dist/config.d.ts +55 -0
- package/dist/config.js +260 -0
- package/dist/config.js.map +1 -0
- package/dist/datepicker/DatePicker.vue.d.ts +82 -0
- package/dist/datepicker/RangePicker.vue.d.ts +87 -0
- package/dist/datepicker/index.d.ts +59 -0
- package/dist/datepicker/index.js +2 -0
- package/dist/drawer/Drawer.vue.d.ts +86 -0
- package/dist/drawer/index.d.ts +23 -0
- package/dist/drawer/index.js +2 -0
- package/dist/dropdown/Dropdown.vue.d.ts +118 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +2 -0
- package/dist/form/Form.vue.d.ts +170 -0
- package/dist/form/FormItem.vue.d.ts +83 -0
- package/dist/form/index.d.ts +176 -0
- package/dist/form/index.js +2 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +32 -0
- package/dist/input/Autocomplete.vue.d.ts +121 -0
- package/dist/input/Input.vue.d.ts +142 -0
- package/dist/input/InputI18n.vue.d.ts +80 -0
- package/dist/input/InputTag.vue.d.ts +114 -0
- package/dist/input/index.d.ts +41 -0
- package/dist/input/index.js +2 -0
- package/dist/inputOtp/InputOtp.vue.d.ts +60 -0
- package/dist/inputOtp/index.d.ts +21 -0
- package/dist/inputOtp/index.js +2 -0
- package/dist/message/MessageContainer.vue.d.ts +11 -0
- package/dist/message/index.d.ts +20 -0
- package/dist/message/index.js +2 -0
- package/dist/message/types.d.ts +25 -0
- package/dist/millercolumns/MillerColumns.vue.d.ts +88 -0
- package/dist/millercolumns/index.d.ts +39 -0
- package/dist/millercolumns/index.js +2 -0
- package/dist/modal/Modal.vue.d.ts +54 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +2 -0
- package/dist/pagination/Pagination.vue.d.ts +70 -0
- package/dist/pagination/index.d.ts +12 -0
- package/dist/pagination/index.js +2 -0
- package/dist/popconfirm/Popconfirm.vue.d.ts +104 -0
- package/dist/popconfirm/index.d.ts +36 -0
- package/dist/popconfirm/index.js +2 -0
- package/dist/progress/Progress.vue.d.ts +64 -0
- package/dist/progress/index.d.ts +26 -0
- package/dist/progress/index.js +2 -0
- package/dist/qrcode/QRCode.vue.d.ts +87 -0
- package/dist/qrcode/index.d.ts +43 -0
- package/dist/qrcode/index.js +2 -0
- package/dist/qrcode/qr.d.ts +51 -0
- package/dist/qrcode/qrcodegen.d.ts +94 -0
- package/dist/radio/Radio.vue.d.ts +52 -0
- package/dist/radio/RadioGroup.vue.d.ts +44 -0
- package/dist/radio/index.d.ts +55 -0
- package/dist/radio/index.js +2 -0
- package/dist/rate/Rate.vue.d.ts +100 -0
- package/dist/rate/index.d.ts +38 -0
- package/dist/rate/index.js +2 -0
- package/dist/select/Select.vue.d.ts +129 -0
- package/dist/select/index.d.ts +33 -0
- package/dist/select/index.js +2 -0
- package/dist/skeleton/Skeleton.vue.d.ts +31 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/slider/Slider.vue.d.ts +81 -0
- package/dist/slider/index.d.ts +61 -0
- package/dist/slider/index.js +2 -0
- package/dist/splitter/Splitter.vue.d.ts +63 -0
- package/dist/splitter/SplitterPanel.vue.d.ts +53 -0
- package/dist/splitter/index.d.ts +39 -0
- package/dist/splitter/index.js +2 -0
- package/dist/style.css +2 -0
- package/dist/switch/Switch.vue.d.ts +97 -0
- package/dist/switch/index.d.ts +31 -0
- package/dist/switch/index.js +2 -0
- package/dist/tab/TabPane.vue.d.ts +32 -0
- package/dist/tab/Tabs.vue.d.ts +87 -0
- package/dist/tab/index.d.ts +78 -0
- package/dist/tab/index.js +2 -0
- package/dist/table/Table.vue.d.ts +96 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/index.js +2 -0
- package/dist/table/types.d.ts +35 -0
- package/dist/table/types.js +0 -0
- package/dist/tag/Tag.vue.d.ts +46 -0
- package/dist/tag/index.d.ts +11 -0
- package/dist/tag/index.js +2 -0
- package/dist/timepicker/TimePicker.vue.d.ts +92 -0
- package/dist/timepicker/TimeRangePicker.vue.d.ts +90 -0
- package/dist/timepicker/index.d.ts +39 -0
- package/dist/timepicker/index.js +2 -0
- package/dist/tooltip/Tooltip.vue.d.ts +79 -0
- package/dist/tooltip/index.d.ts +14 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/uno.d.ts +32 -0
- package/dist/uno.js +83 -0
- package/dist/uno.js.map +1 -0
- package/dist/utils/DnD.d.ts +38 -0
- package/package.json +115 -0
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import { getUiExposeAttrs as e } from "../attrs.js";
|
|
2
|
+
import { cva as t } from "class-variance-authority";
|
|
3
|
+
import { Comment as n, Fragment as r, Text as i, cloneVNode as a, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as ee, defineComponent as u, mergeProps as d, nextTick as te, normalizeClass as f, normalizeStyle as p, onBeforeUnmount as ne, onMounted as re, openBlock as m, ref as h, renderList as ie, renderSlot as ae, unref as g, useAttrs as oe, useSlots as se, watch as ce, withModifiers as _ } from "vue";
|
|
4
|
+
import { clsx as v } from "clsx";
|
|
5
|
+
//#region src/splitter/SplitterPanel.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var y = ["aria-hidden"], le = /* @__PURE__ */ u({
|
|
7
|
+
inheritAttrs: !1,
|
|
8
|
+
__name: "SplitterPanel",
|
|
9
|
+
props: {
|
|
10
|
+
size: { default: void 0 },
|
|
11
|
+
defaultSize: { default: void 0 },
|
|
12
|
+
min: { default: void 0 },
|
|
13
|
+
max: { default: void 0 },
|
|
14
|
+
resizable: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: !0
|
|
17
|
+
},
|
|
18
|
+
collapsible: {
|
|
19
|
+
type: [Boolean, Object],
|
|
20
|
+
default: !1
|
|
21
|
+
},
|
|
22
|
+
destroyOnHidden: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: void 0
|
|
25
|
+
},
|
|
26
|
+
splitterSize: { default: void 0 },
|
|
27
|
+
splitterOrientation: { default: "horizontal" },
|
|
28
|
+
splitterCollapsed: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !1
|
|
31
|
+
},
|
|
32
|
+
splitterDestroyOnHidden: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
splitterMotion: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !1
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
setup(t) {
|
|
42
|
+
let n = t, r = oe(), i = o(() => e(r)), a = o(() => v(x({ collapsed: n.splitterCollapsed }), r.class)), l = o(() => {
|
|
43
|
+
let e = n.splitterSize === void 0 ? void 0 : `${n.splitterSize * 100}%`;
|
|
44
|
+
return [
|
|
45
|
+
e ? n.splitterOrientation === "vertical" ? {
|
|
46
|
+
flex: `0 0 ${e}`,
|
|
47
|
+
height: e,
|
|
48
|
+
width: "100%"
|
|
49
|
+
} : {
|
|
50
|
+
flex: `0 0 ${e}`,
|
|
51
|
+
height: "100%",
|
|
52
|
+
width: e
|
|
53
|
+
} : { flex: "1 1 0%" },
|
|
54
|
+
n.splitterMotion ? { transition: "flex-basis 180ms ease, width 180ms ease, height 180ms ease" } : void 0,
|
|
55
|
+
r.style
|
|
56
|
+
];
|
|
57
|
+
}), ee = o(() => !(n.splitterCollapsed && (n.destroyOnHidden ?? n.splitterDestroyOnHidden)));
|
|
58
|
+
return (e, n) => (m(), c("div", d(i.value, {
|
|
59
|
+
"data-ui-splitter-panel": "true",
|
|
60
|
+
"aria-hidden": t.splitterCollapsed || void 0,
|
|
61
|
+
class: a.value,
|
|
62
|
+
style: l.value
|
|
63
|
+
}), [ee.value ? ae(e.$slots, "default", { key: 0 }) : s("", !0)], 16, y));
|
|
64
|
+
}
|
|
65
|
+
}), ue = ["aria-label"], de = [
|
|
66
|
+
"aria-controls",
|
|
67
|
+
"aria-disabled",
|
|
68
|
+
"aria-orientation",
|
|
69
|
+
"aria-valuenow",
|
|
70
|
+
"aria-valuemin",
|
|
71
|
+
"aria-valuemax",
|
|
72
|
+
"tabindex",
|
|
73
|
+
"onPointerdown",
|
|
74
|
+
"onKeydown",
|
|
75
|
+
"onDblclick"
|
|
76
|
+
], fe = {
|
|
77
|
+
key: 0,
|
|
78
|
+
class: "pointer-events-none absolute left-1/2 top-1/2 z-10 inline-flex size-4 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded bg-primary text-tertiary"
|
|
79
|
+
}, pe = ["aria-label", "onClick"], me = ["aria-label", "onClick"], b = 1e-6, he = /* @__PURE__ */ u({
|
|
80
|
+
inheritAttrs: !1,
|
|
81
|
+
__name: "Splitter",
|
|
82
|
+
props: {
|
|
83
|
+
modelValue: { default: void 0 },
|
|
84
|
+
defaultValue: { default: void 0 },
|
|
85
|
+
orientation: { default: "horizontal" },
|
|
86
|
+
lazy: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: !1
|
|
89
|
+
},
|
|
90
|
+
keyboardStep: { default: 10 },
|
|
91
|
+
collapsible: { default: void 0 },
|
|
92
|
+
destroyOnHidden: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: !1
|
|
95
|
+
},
|
|
96
|
+
ariaLabel: { default: "分割面板" }
|
|
97
|
+
},
|
|
98
|
+
emits: [
|
|
99
|
+
"update:modelValue",
|
|
100
|
+
"resize-start",
|
|
101
|
+
"resize",
|
|
102
|
+
"resize-end",
|
|
103
|
+
"collapse",
|
|
104
|
+
"dragger-double-click"
|
|
105
|
+
],
|
|
106
|
+
setup(t, { expose: y, emit: he }) {
|
|
107
|
+
let x = t, w = he, T = oe(), ve = se(), E = h(null), D = h(0), O = h([]), k = h(null), A = h(null), j = h(-1), M = h(0), N = /* @__PURE__ */ new Map(), ye = `ui-splitter-${Math.random().toString(36).slice(2, 9)}`, P = null, F = "", I = "", be = u({
|
|
108
|
+
name: "SplitterVNodeRenderer",
|
|
109
|
+
props: { node: {
|
|
110
|
+
type: Object,
|
|
111
|
+
required: !0
|
|
112
|
+
} },
|
|
113
|
+
setup(e) {
|
|
114
|
+
return () => e.node;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
function L(e, t = []) {
|
|
118
|
+
for (let a of e) {
|
|
119
|
+
if (a.type === r && Array.isArray(a.children)) {
|
|
120
|
+
L(a.children, t);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
a.type === n || a.type === i || (a.type === le || typeof a.type == "object" && "__name" in a.type && a.type.__name === "SplitterPanel") && t.push(a);
|
|
124
|
+
}
|
|
125
|
+
return t;
|
|
126
|
+
}
|
|
127
|
+
function R(e, t) {
|
|
128
|
+
let n = t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
129
|
+
return e.props?.[t] ?? e.props?.[n];
|
|
130
|
+
}
|
|
131
|
+
function xe(e) {
|
|
132
|
+
if (e && typeof e == "object") {
|
|
133
|
+
let t = e;
|
|
134
|
+
return {
|
|
135
|
+
start: !!t.start,
|
|
136
|
+
end: !!t.end,
|
|
137
|
+
showCollapsibleIcon: t.showCollapsibleIcon ?? "auto"
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
let t = e === !0 || e === "";
|
|
141
|
+
return {
|
|
142
|
+
start: t,
|
|
143
|
+
end: t,
|
|
144
|
+
showCollapsibleIcon: "auto"
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
let z = o(() => L(ve.default?.() ?? []).map((e, t) => ({
|
|
148
|
+
vnode: e,
|
|
149
|
+
key: e.key ?? t,
|
|
150
|
+
size: R(e, "size"),
|
|
151
|
+
defaultSize: R(e, "defaultSize"),
|
|
152
|
+
min: R(e, "min"),
|
|
153
|
+
max: R(e, "max"),
|
|
154
|
+
resizable: R(e, "resizable") !== !1,
|
|
155
|
+
collapsible: xe(R(e, "collapsible")),
|
|
156
|
+
destroyOnHidden: R(e, "destroyOnHidden")
|
|
157
|
+
}))), Se = o(() => z.value.map((e) => String(e.key)).join("|")), B = o(() => z.value.some((e) => e.size !== void 0)), Ce = o(() => x.modelValue !== void 0 || B.value), we = o(() => x.modelValue === void 0 ? B.value ? z.value.map((e) => e.size) : O.value.length === z.value.length ? O.value : x.defaultValue?.length ? x.defaultValue : z.value.map((e) => e.defaultSize) : x.modelValue);
|
|
158
|
+
function V(e, t, n) {
|
|
159
|
+
if (e == null || e === "") return n;
|
|
160
|
+
if (typeof e == "string" && e.trim().endsWith("%")) {
|
|
161
|
+
let r = Number(e.trim().slice(0, -1));
|
|
162
|
+
return Number.isFinite(r) ? r / 100 * t : n;
|
|
163
|
+
}
|
|
164
|
+
let r = Number(e);
|
|
165
|
+
return Number.isFinite(r) ? r : n;
|
|
166
|
+
}
|
|
167
|
+
function Te(e, t, n) {
|
|
168
|
+
let r = e.map((e, r) => Math.min(n[r], Math.max(t[r], e)));
|
|
169
|
+
for (let e = 0; e < r.length * 2; e += 1) {
|
|
170
|
+
let e = 1 - r.reduce((e, t) => e + t, 0);
|
|
171
|
+
if (Math.abs(e) <= b) break;
|
|
172
|
+
let i = r.map((r, i) => ({
|
|
173
|
+
index: i,
|
|
174
|
+
room: e > 0 ? n[i] - r : r - t[i]
|
|
175
|
+
})).filter((e) => e.room > b);
|
|
176
|
+
if (!i.length) break;
|
|
177
|
+
let a = Math.abs(e) / i.length;
|
|
178
|
+
for (let t of i) {
|
|
179
|
+
let n = Math.min(t.room, a);
|
|
180
|
+
r[t.index] += e > 0 ? n : -n;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
let i = 1 - r.reduce((e, t) => e + t, 0);
|
|
184
|
+
return Math.abs(i) > b && r.length && (r[r.length - 1] = Math.max(0, r[r.length - 1] + i)), r;
|
|
185
|
+
}
|
|
186
|
+
function Ee(e, t = z.value) {
|
|
187
|
+
let n = t.length;
|
|
188
|
+
if (!n) return [];
|
|
189
|
+
let r = D.value > 0 ? D.value : 1, i = Array.from({ length: n }, (t, n) => {
|
|
190
|
+
let i = V(e[n], r);
|
|
191
|
+
return i === void 0 ? void 0 : Math.max(0, i / r);
|
|
192
|
+
}), a = t.map((e, t) => i[t] === 0 ? 0 : Math.max(0, (V(e.min, r, 0) ?? 0) / r)), o = t.map((e) => Math.max(0, Math.min(1, (V(e.max, r, r) ?? r) / r))), s = i.reduce((e, t) => e + (t ?? 0), 0), c = i.map((e, t) => e === void 0 ? t : -1).filter((e) => e >= 0), l;
|
|
193
|
+
if (!c.length) l = s <= b ? i.map(() => 1 / n) : i.map((e) => (e ?? 0) / s);
|
|
194
|
+
else if (s >= 1) l = i.map((e) => e === void 0 ? 0 : e / s);
|
|
195
|
+
else {
|
|
196
|
+
let e = (1 - s) / c.length;
|
|
197
|
+
l = i.map((t) => t ?? e);
|
|
198
|
+
}
|
|
199
|
+
return Te(l, a, o);
|
|
200
|
+
}
|
|
201
|
+
let De = o(() => Ee(we.value)), H = o(() => k.value ?? De.value), Oe = o(() => v(ge({ orientation: x.orientation }), T.class)), ke = o(() => T.style), Ae = o(() => e(T)), U = o(() => z.value.map((e, t) => R(e.vnode, "id") ?? `${ye}-panel-${t}`));
|
|
202
|
+
ce(Se, () => {
|
|
203
|
+
O.value = [], k.value = null, N.clear();
|
|
204
|
+
}), ce(() => x.orientation, async () => {
|
|
205
|
+
await te(), W();
|
|
206
|
+
});
|
|
207
|
+
function W() {
|
|
208
|
+
let e = E.value?.getBoundingClientRect(), t = x.orientation === "vertical" ? e?.height : e?.width;
|
|
209
|
+
t && Number.isFinite(t) && (D.value = t);
|
|
210
|
+
}
|
|
211
|
+
function G(e) {
|
|
212
|
+
let t = D.value;
|
|
213
|
+
return e.map((e) => Number((e * t).toFixed(2)));
|
|
214
|
+
}
|
|
215
|
+
function K(e, t = !1) {
|
|
216
|
+
return t && H.value[e] <= b ? 0 : V(z.value[e]?.min, D.value, 0) ?? 0;
|
|
217
|
+
}
|
|
218
|
+
function q(e) {
|
|
219
|
+
return V(z.value[e]?.max, D.value, D.value) ?? D.value;
|
|
220
|
+
}
|
|
221
|
+
function J(e) {
|
|
222
|
+
let t = z.value[e], n = z.value[e + 1];
|
|
223
|
+
if (!t || !n || !t.resizable || !n.resizable) return !1;
|
|
224
|
+
let r = G(H.value);
|
|
225
|
+
return !(r[e] <= b && K(e) > 0 || r[e + 1] <= b && K(e + 1) > 0);
|
|
226
|
+
}
|
|
227
|
+
function je(e, t, n) {
|
|
228
|
+
let r = G(n), i = r[e] ?? 0, a = r[e + 1] ?? 0, o = Math.max(K(e) - i, a - q(e + 1)), s = Math.min(q(e) - i, a - K(e + 1));
|
|
229
|
+
return Math.min(s, Math.max(o, t));
|
|
230
|
+
}
|
|
231
|
+
function Y(e, t, n) {
|
|
232
|
+
if (D.value <= 0) return n;
|
|
233
|
+
let r = je(e, t, n), i = [...n];
|
|
234
|
+
return i[e] += r / D.value, i[e + 1] -= r / D.value, i;
|
|
235
|
+
}
|
|
236
|
+
function X(e, t = !0) {
|
|
237
|
+
let n = G(e);
|
|
238
|
+
return Ce.value || (O.value = n), A.value && (k.value = e), w("update:modelValue", n), t && w("resize", n), n;
|
|
239
|
+
}
|
|
240
|
+
function Me(e) {
|
|
241
|
+
return H.value.slice(0, e + 1).reduce((e, t) => e + t, 0) * 100;
|
|
242
|
+
}
|
|
243
|
+
function Ne(e) {
|
|
244
|
+
let t = x.collapsible?.motion && j.value < 0 ? `${x.orientation === "vertical" ? "top" : "left"} 180ms ease` : void 0;
|
|
245
|
+
return x.orientation === "vertical" ? {
|
|
246
|
+
top: `${Me(e)}%`,
|
|
247
|
+
transition: t
|
|
248
|
+
} : {
|
|
249
|
+
left: `${Me(e)}%`,
|
|
250
|
+
transition: t
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function Pe(e) {
|
|
254
|
+
let t = j.value === e && x.lazy;
|
|
255
|
+
return x.orientation === "vertical" ? {
|
|
256
|
+
left: 0,
|
|
257
|
+
right: 0,
|
|
258
|
+
top: `calc(50% + ${t ? M.value : 0}px)`,
|
|
259
|
+
height: "2px",
|
|
260
|
+
transform: "translateY(-50%)"
|
|
261
|
+
} : {
|
|
262
|
+
bottom: 0,
|
|
263
|
+
left: `calc(50% + ${t ? M.value : 0}px)`,
|
|
264
|
+
top: 0,
|
|
265
|
+
width: "2px",
|
|
266
|
+
transform: "translateX(-50%)"
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function Fe(e, t) {
|
|
270
|
+
let n = H.value[t] ?? 0;
|
|
271
|
+
return a(e.vnode, {
|
|
272
|
+
id: U.value[t],
|
|
273
|
+
splitterSize: n,
|
|
274
|
+
splitterOrientation: x.orientation,
|
|
275
|
+
splitterCollapsed: n <= b,
|
|
276
|
+
splitterDestroyOnHidden: x.destroyOnHidden,
|
|
277
|
+
splitterMotion: !!x.collapsible?.motion && j.value < 0
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function Z(e) {
|
|
281
|
+
if (!(typeof document > "u")) {
|
|
282
|
+
if (e) {
|
|
283
|
+
F = document.body.style.cursor, I = document.body.style.userSelect, document.body.style.cursor = x.orientation === "vertical" ? "row-resize" : "col-resize", document.body.style.userSelect = "none";
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
document.body.style.cursor = F, document.body.style.userSelect = I;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function Ie(e, t) {
|
|
290
|
+
if (e.button !== 0 || !J(t)) return;
|
|
291
|
+
W(), e.preventDefault();
|
|
292
|
+
let n = [...H.value];
|
|
293
|
+
A.value = {
|
|
294
|
+
index: t,
|
|
295
|
+
pointerId: e.pointerId,
|
|
296
|
+
startClient: x.orientation === "vertical" ? e.clientY : e.clientX,
|
|
297
|
+
startRatios: n
|
|
298
|
+
}, k.value = n, j.value = t, M.value = 0, Z(!0), E.value?.setPointerCapture?.(e.pointerId), w("resize-start", G(n));
|
|
299
|
+
}
|
|
300
|
+
function Le(e) {
|
|
301
|
+
let t = A.value;
|
|
302
|
+
if (!t || e.pointerId !== void 0 && t.pointerId !== e.pointerId) return;
|
|
303
|
+
let n = x.orientation === "vertical" ? e.clientY : e.clientX, r = je(t.index, n - t.startClient, t.startRatios);
|
|
304
|
+
if (x.lazy) {
|
|
305
|
+
M.value = r;
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
X(Y(t.index, r, t.startRatios));
|
|
309
|
+
}
|
|
310
|
+
function Q(e) {
|
|
311
|
+
let t = A.value;
|
|
312
|
+
if (!t || e?.pointerId !== void 0 && t.pointerId !== e.pointerId) return;
|
|
313
|
+
let n = k.value ?? t.startRatios;
|
|
314
|
+
x.lazy && (n = Y(t.index, M.value, t.startRatios), Math.abs(M.value) > b && X(n)), w("resize-end", G(n)), A.value = null, k.value = null, j.value = -1, M.value = 0, Z(!1);
|
|
315
|
+
}
|
|
316
|
+
function $(e) {
|
|
317
|
+
let t = G(H.value), n = t[e] ?? 0, r = n + (t[e + 1] ?? 0);
|
|
318
|
+
return {
|
|
319
|
+
now: Math.round(n),
|
|
320
|
+
min: Math.round(Math.max(K(e, !0), r - q(e + 1))),
|
|
321
|
+
max: Math.round(Math.min(q(e), r - K(e + 1, !0)))
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function Re(e, t) {
|
|
325
|
+
if (!J(t)) return;
|
|
326
|
+
let n = $(t), r = Math.max(1, x.keyboardStep), i;
|
|
327
|
+
if (x.orientation === "horizontal" && e.key === "ArrowLeft" && (i = -r), x.orientation === "horizontal" && e.key === "ArrowRight" && (i = r), x.orientation === "vertical" && e.key === "ArrowUp" && (i = -r), x.orientation === "vertical" && e.key === "ArrowDown" && (i = r), e.key === "Home" && (i = n.min - n.now), e.key === "End" && (i = n.max - n.now), i === void 0) return;
|
|
328
|
+
e.preventDefault(), W();
|
|
329
|
+
let a = [...H.value];
|
|
330
|
+
w("resize-start", G(a)), w("resize-end", X(Y(t, i, a)));
|
|
331
|
+
}
|
|
332
|
+
function ze(e) {
|
|
333
|
+
return e !== !1;
|
|
334
|
+
}
|
|
335
|
+
function Be(e) {
|
|
336
|
+
return v("pointer-events-auto absolute z-30 inline-flex size-5 items-center justify-center rounded border border-medium bg-primary text-tertiary shadow-sm outline-none transition-[color,opacity,background-color] hover:bg-secondary hover:text-brand-500 focus-visible:ring-2 focus-visible:ring-brand-400", e === "auto" && "opacity-0 group-hover/ui-splitter-bar:opacity-100 group-focus-within/ui-splitter-bar:opacity-100");
|
|
337
|
+
}
|
|
338
|
+
function Ve(e) {
|
|
339
|
+
let t = e === "previous" ? "-13px" : "13px";
|
|
340
|
+
return x.orientation === "vertical" ? {
|
|
341
|
+
left: `calc(50% + ${t})`,
|
|
342
|
+
top: "50%",
|
|
343
|
+
transform: "translate(-50%, -50%)"
|
|
344
|
+
} : {
|
|
345
|
+
left: "50%",
|
|
346
|
+
top: `calc(50% + ${t})`,
|
|
347
|
+
transform: "translate(-50%, -50%)"
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
function He(e, t) {
|
|
351
|
+
return x.orientation === "vertical" ? e === "previous" ? t ? "i-lucide:chevron-down" : "i-lucide:chevron-up" : t ? "i-lucide:chevron-up" : "i-lucide:chevron-down" : e === "previous" ? t ? "i-lucide:chevron-right" : "i-lucide:chevron-left" : t ? "i-lucide:chevron-left" : "i-lucide:chevron-right";
|
|
352
|
+
}
|
|
353
|
+
function Ue(e, t) {
|
|
354
|
+
W();
|
|
355
|
+
let n = G(H.value), r = n[e] ?? 0, i = r + (n[t] ?? 0), a = [...n];
|
|
356
|
+
if (r > b) N.set(e, r), a[e] = 0, a[t] = i;
|
|
357
|
+
else {
|
|
358
|
+
let n = N.get(e) ?? V(z.value[e]?.defaultSize, D.value, i / 2) ?? i / 2, r = Math.max(K(e), i - q(t)), o = Math.min(q(e), i - K(t)), s = Math.min(o, Math.max(r, n));
|
|
359
|
+
a[e] = s, a[t] = i - s;
|
|
360
|
+
}
|
|
361
|
+
let o = X(a.map((e) => D.value > 0 ? e / D.value : 0));
|
|
362
|
+
w("collapse", o.map((e) => e <= b), o);
|
|
363
|
+
}
|
|
364
|
+
function We(e) {
|
|
365
|
+
Ue(e, e + 1);
|
|
366
|
+
}
|
|
367
|
+
function Ge(e) {
|
|
368
|
+
Ue(e + 1, e);
|
|
369
|
+
}
|
|
370
|
+
function Ke(e) {
|
|
371
|
+
w("dragger-double-click", e);
|
|
372
|
+
}
|
|
373
|
+
function qe() {
|
|
374
|
+
return Ee(x.defaultValue?.length ? x.defaultValue : z.value.map((e) => e.defaultSize));
|
|
375
|
+
}
|
|
376
|
+
function Je() {
|
|
377
|
+
let e = X(qe());
|
|
378
|
+
return w("resize-end", e), e;
|
|
379
|
+
}
|
|
380
|
+
function Ye() {
|
|
381
|
+
return W(), G(H.value);
|
|
382
|
+
}
|
|
383
|
+
return re(() => {
|
|
384
|
+
W(), window.addEventListener("pointermove", Le, { capture: !0 }), window.addEventListener("pointerup", Q, { capture: !0 }), window.addEventListener("pointercancel", Q, { capture: !0 }), window.addEventListener("resize", W), typeof ResizeObserver < "u" && E.value && (P = new ResizeObserver(W), P.observe(E.value));
|
|
385
|
+
}), ne(() => {
|
|
386
|
+
window.removeEventListener("pointermove", Le, { capture: !0 }), window.removeEventListener("pointerup", Q, { capture: !0 }), window.removeEventListener("pointercancel", Q, { capture: !0 }), window.removeEventListener("resize", W), P?.disconnect(), Z(!1);
|
|
387
|
+
}), y({
|
|
388
|
+
reset: Je,
|
|
389
|
+
getSizes: Ye
|
|
390
|
+
}), (e, n) => (m(), c("div", d({
|
|
391
|
+
ref_key: "rootRef",
|
|
392
|
+
ref: E
|
|
393
|
+
}, Ae.value, {
|
|
394
|
+
"data-ui-splitter": "true",
|
|
395
|
+
role: "group",
|
|
396
|
+
"aria-label": t.ariaLabel,
|
|
397
|
+
class: Oe.value,
|
|
398
|
+
style: ke.value
|
|
399
|
+
}), [(m(!0), c(r, null, ie(z.value, (i, a) => (m(), c(r, { key: i.key }, [ee(g(be), { node: Fe(i, a) }, null, 8, ["node"]), a < z.value.length - 1 ? (m(), c("div", {
|
|
400
|
+
key: 0,
|
|
401
|
+
"data-ui-splitter-bar": "true",
|
|
402
|
+
class: f(g(_e)({ orientation: t.orientation })),
|
|
403
|
+
style: p(Ne(a))
|
|
404
|
+
}, [
|
|
405
|
+
t.lazy && j.value === a ? (m(), c("span", {
|
|
406
|
+
key: 0,
|
|
407
|
+
"data-ui-splitter-preview": "true",
|
|
408
|
+
class: "pointer-events-none absolute z-20 bg-brand-500 dark:bg-brand-400",
|
|
409
|
+
style: p(Pe(a))
|
|
410
|
+
}, null, 4)) : s("", !0),
|
|
411
|
+
l("div", {
|
|
412
|
+
"data-ui-splitter-dragger": "true",
|
|
413
|
+
role: "separator",
|
|
414
|
+
"aria-controls": `${U.value[a]} ${U.value[a + 1]}`,
|
|
415
|
+
"aria-disabled": !J(a),
|
|
416
|
+
"aria-orientation": t.orientation === "vertical" ? "horizontal" : "vertical",
|
|
417
|
+
"aria-valuenow": $(a).now,
|
|
418
|
+
"aria-valuemin": $(a).min,
|
|
419
|
+
"aria-valuemax": $(a).max,
|
|
420
|
+
tabindex: J(a) ? 0 : -1,
|
|
421
|
+
class: f(g(S)({
|
|
422
|
+
orientation: t.orientation,
|
|
423
|
+
resizable: J(a)
|
|
424
|
+
})),
|
|
425
|
+
onPointerdown: (e) => Ie(e, a),
|
|
426
|
+
onKeydown: (e) => Re(e, a),
|
|
427
|
+
onDblclick: (e) => Ke(a)
|
|
428
|
+
}, [l("span", { class: f(g(C)({
|
|
429
|
+
orientation: t.orientation,
|
|
430
|
+
active: j.value === a,
|
|
431
|
+
resizable: J(a)
|
|
432
|
+
})) }, null, 2), e.$slots.dragger ? (m(), c("span", fe, [ae(e.$slots, "dragger", {
|
|
433
|
+
index: a,
|
|
434
|
+
active: j.value === a
|
|
435
|
+
})])) : s("", !0)], 42, de),
|
|
436
|
+
i.collapsible.end && ze(i.collapsible.showCollapsibleIcon) ? (m(), c("button", {
|
|
437
|
+
key: 1,
|
|
438
|
+
type: "button",
|
|
439
|
+
"data-ui-splitter-collapse": "previous",
|
|
440
|
+
"aria-label": H.value[a] <= b ? "展开前一面板" : "折叠前一面板",
|
|
441
|
+
class: f(Be(i.collapsible.showCollapsibleIcon)),
|
|
442
|
+
style: p(Ve("previous")),
|
|
443
|
+
onPointerdown: n[0] ||= _(() => {}, ["stop"]),
|
|
444
|
+
onClick: (e) => We(a)
|
|
445
|
+
}, [l("span", { class: f([He("previous", H.value[a] <= b), "size-3.5"]) }, null, 2)], 46, pe)) : s("", !0),
|
|
446
|
+
z.value[a + 1].collapsible.start && ze(z.value[a + 1].collapsible.showCollapsibleIcon) ? (m(), c("button", {
|
|
447
|
+
key: 2,
|
|
448
|
+
type: "button",
|
|
449
|
+
"data-ui-splitter-collapse": "next",
|
|
450
|
+
"aria-label": H.value[a + 1] <= b ? "展开后一面板" : "折叠后一面板",
|
|
451
|
+
class: f(Be(z.value[a + 1].collapsible.showCollapsibleIcon)),
|
|
452
|
+
style: p(Ve("next")),
|
|
453
|
+
onPointerdown: n[1] ||= _(() => {}, ["stop"]),
|
|
454
|
+
onClick: (e) => Ge(a)
|
|
455
|
+
}, [l("span", { class: f([He("next", H.value[a + 1] <= b), "size-3.5"]) }, null, 2)], 46, me)) : s("", !0)
|
|
456
|
+
], 6)) : s("", !0)], 64))), 128))], 16, ue));
|
|
457
|
+
}
|
|
458
|
+
}), ge = t("relative flex min-h-0 min-w-0 overflow-hidden bg-primary text-primary", {
|
|
459
|
+
variants: { orientation: {
|
|
460
|
+
horizontal: "flex-row",
|
|
461
|
+
vertical: "flex-col"
|
|
462
|
+
} },
|
|
463
|
+
defaultVariants: { orientation: "horizontal" }
|
|
464
|
+
}), x = t("relative min-h-0 min-w-0 overflow-auto", {
|
|
465
|
+
variants: { collapsed: {
|
|
466
|
+
true: "overflow-hidden",
|
|
467
|
+
false: ""
|
|
468
|
+
} },
|
|
469
|
+
defaultVariants: { collapsed: !1 }
|
|
470
|
+
}), _e = t("group/ui-splitter-bar pointer-events-none absolute z-20", {
|
|
471
|
+
variants: { orientation: {
|
|
472
|
+
horizontal: "inset-y-0 w-3 -translate-x-1/2",
|
|
473
|
+
vertical: "inset-x-0 h-3 -translate-y-1/2"
|
|
474
|
+
} },
|
|
475
|
+
defaultVariants: { orientation: "horizontal" }
|
|
476
|
+
}), S = t("group/ui-splitter-dragger pointer-events-auto absolute inset-0 touch-none select-none outline-none", {
|
|
477
|
+
variants: {
|
|
478
|
+
orientation: {
|
|
479
|
+
horizontal: "cursor-col-resize",
|
|
480
|
+
vertical: "cursor-row-resize"
|
|
481
|
+
},
|
|
482
|
+
resizable: {
|
|
483
|
+
true: "",
|
|
484
|
+
false: "cursor-default"
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
defaultVariants: {
|
|
488
|
+
orientation: "horizontal",
|
|
489
|
+
resizable: !0
|
|
490
|
+
}
|
|
491
|
+
}), C = t("pointer-events-none absolute bg-zinc-200 transition-[background-color,width,height] duration-150 dark:bg-zinc-700", {
|
|
492
|
+
variants: {
|
|
493
|
+
orientation: {
|
|
494
|
+
horizontal: "inset-y-0 left-1/2 w-px -translate-x-1/2",
|
|
495
|
+
vertical: "inset-x-0 top-1/2 h-px -translate-y-1/2"
|
|
496
|
+
},
|
|
497
|
+
active: {
|
|
498
|
+
true: "bg-brand-500 dark:bg-brand-400",
|
|
499
|
+
false: "group-hover/ui-splitter-dragger:bg-brand-400 group-focus-visible/ui-splitter-dragger:bg-brand-500 dark:group-hover/ui-splitter-dragger:bg-brand-400"
|
|
500
|
+
},
|
|
501
|
+
resizable: {
|
|
502
|
+
true: "",
|
|
503
|
+
false: "bg-zinc-200 opacity-70 dark:bg-zinc-700"
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
compoundVariants: [{
|
|
507
|
+
orientation: "horizontal",
|
|
508
|
+
active: !0,
|
|
509
|
+
class: "w-0.5"
|
|
510
|
+
}, {
|
|
511
|
+
orientation: "vertical",
|
|
512
|
+
active: !0,
|
|
513
|
+
class: "h-0.5"
|
|
514
|
+
}],
|
|
515
|
+
defaultVariants: {
|
|
516
|
+
orientation: "horizontal",
|
|
517
|
+
active: !1,
|
|
518
|
+
resizable: !0
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
//#endregion
|
|
522
|
+
export { ge as a, x as i, S as n, he as o, C as r, le as s, _e as t };
|
|
523
|
+
|
|
524
|
+
//# sourceMappingURL=splitter-CgfiXY65.js.map
|