@linkdesk/ui 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/combobox/Combobox.d.ts +1 -1
- package/dist/hooks/useClickPreview.d.ts +33 -0
- package/dist/hooks/useClipboardKeys.d.ts +33 -0
- package/dist/hooks/useDebouncedInput.d.ts +18 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +605 -564
- package/dist/select-box/SelectBox.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useRef as
|
|
4
|
-
import Ae, { createPortal as
|
|
2
|
+
import { jsx as f, jsxs as H, Fragment as xe } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as F, useEffect as R, useState as P, useCallback as K, useLayoutEffect as oe, useMemo as z, forwardRef as ce, useImperativeHandle as Me, useContext as Ne, createContext as Ce, createElement as re } from "react";
|
|
4
|
+
import Ae, { createPortal as se } from "react-dom";
|
|
5
5
|
import { useTranslation as j } from "react-i18next";
|
|
6
|
-
function
|
|
7
|
-
return /* @__PURE__ */
|
|
6
|
+
function Ee({ children: t, onClick: n, disabled: e, title: r, type: o = "button" }) {
|
|
7
|
+
return /* @__PURE__ */ f("button", { type: o, className: "button", onClick: n, disabled: e, title: r, children: t });
|
|
8
8
|
}
|
|
9
9
|
var q = {}, ae;
|
|
10
10
|
function Ie() {
|
|
@@ -15,17 +15,17 @@ function Ie() {
|
|
|
15
15
|
q.createRoot = t.createRoot, q.hydrateRoot = t.hydrateRoot;
|
|
16
16
|
else {
|
|
17
17
|
var n = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
18
|
-
q.createRoot = function(e,
|
|
18
|
+
q.createRoot = function(e, r) {
|
|
19
19
|
n.usingClientEntryPoint = !0;
|
|
20
20
|
try {
|
|
21
|
-
return t.createRoot(e,
|
|
21
|
+
return t.createRoot(e, r);
|
|
22
22
|
} finally {
|
|
23
23
|
n.usingClientEntryPoint = !1;
|
|
24
24
|
}
|
|
25
|
-
}, q.hydrateRoot = function(e,
|
|
25
|
+
}, q.hydrateRoot = function(e, r, o) {
|
|
26
26
|
n.usingClientEntryPoint = !0;
|
|
27
27
|
try {
|
|
28
|
-
return t.hydrateRoot(e,
|
|
28
|
+
return t.hydrateRoot(e, r, o);
|
|
29
29
|
} finally {
|
|
30
30
|
n.usingClientEntryPoint = !1;
|
|
31
31
|
}
|
|
@@ -39,45 +39,45 @@ function we() {
|
|
|
39
39
|
return document.getElementById(_e) ?? document.body;
|
|
40
40
|
}
|
|
41
41
|
const le = 'a[href],button:not([disabled]),input:not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';
|
|
42
|
-
function ie({ children: t, onClose: n, triggerRef: e, trapFocus:
|
|
43
|
-
const
|
|
42
|
+
function ie({ children: t, onClose: n, triggerRef: e, trapFocus: r, zIndex: o, rootId: s, open: c = !0 }) {
|
|
43
|
+
const i = F(null);
|
|
44
44
|
R(() => {
|
|
45
|
-
if (!
|
|
46
|
-
const
|
|
47
|
-
var
|
|
48
|
-
const k =
|
|
45
|
+
if (!c || !n) return;
|
|
46
|
+
const a = (l) => {
|
|
47
|
+
var u, x;
|
|
48
|
+
const k = l.target, v = (u = i.current) == null ? void 0 : u.contains(k), m = ((x = e == null ? void 0 : e.current) == null ? void 0 : x.contains(k)) ?? !1;
|
|
49
49
|
!v && !m && n();
|
|
50
50
|
};
|
|
51
|
-
return window.addEventListener("mousedown",
|
|
52
|
-
}, [
|
|
53
|
-
if (!
|
|
54
|
-
const
|
|
55
|
-
|
|
51
|
+
return window.addEventListener("mousedown", a, !0), () => window.removeEventListener("mousedown", a, !0);
|
|
52
|
+
}, [c, n, e]), R(() => {
|
|
53
|
+
if (!c || !n) return;
|
|
54
|
+
const a = (l) => {
|
|
55
|
+
l.key === "Escape" && n();
|
|
56
56
|
};
|
|
57
|
-
return window.addEventListener("keydown",
|
|
58
|
-
}, [
|
|
59
|
-
if (!
|
|
60
|
-
const
|
|
61
|
-
if (!
|
|
62
|
-
const
|
|
63
|
-
|
|
57
|
+
return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
|
|
58
|
+
}, [c, n]), R(() => {
|
|
59
|
+
if (!c || !r) return;
|
|
60
|
+
const a = i.current;
|
|
61
|
+
if (!a) return;
|
|
62
|
+
const l = a.querySelector(le);
|
|
63
|
+
l ? l.focus() : (a.tabIndex = -1, a.focus());
|
|
64
64
|
const k = (v) => {
|
|
65
65
|
if (v.key !== "Tab") return;
|
|
66
|
-
const m = Array.from(
|
|
66
|
+
const m = Array.from(a.querySelectorAll(le));
|
|
67
67
|
if (m.length === 0) {
|
|
68
68
|
v.preventDefault();
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
v.shiftKey && document.activeElement ===
|
|
71
|
+
const u = m[0], x = m[m.length - 1];
|
|
72
|
+
v.shiftKey && document.activeElement === u ? (v.preventDefault(), x.focus()) : !v.shiftKey && document.activeElement === x && (v.preventDefault(), u.focus());
|
|
73
73
|
};
|
|
74
74
|
return window.addEventListener("keydown", k), () => window.removeEventListener("keydown", k);
|
|
75
|
-
}, [
|
|
76
|
-
const
|
|
75
|
+
}, [c, r]);
|
|
76
|
+
const d = {
|
|
77
77
|
position: "relative",
|
|
78
|
-
...
|
|
78
|
+
...o ? { zIndex: o } : {}
|
|
79
79
|
};
|
|
80
|
-
return
|
|
80
|
+
return se(
|
|
81
81
|
// E5.8#109:data-overlay-wrapper 结构标记——浮层权威的「隔离地板」(index.css)用它排除本包装盒。
|
|
82
82
|
// 包装盒是结构容器(ref/zIndex 载体)不是表面:若地板规则的深度 2 选择器给它的 backdrop-filter,
|
|
83
83
|
// 它就成了 backdrop root,把内部真实表面的 backdrop 采样掐断(E5.8#103 地板因此从未对
|
|
@@ -86,23 +86,23 @@ function ie({ children: t, onClose: n, triggerRef: e, trapFocus: o, zIndex: r, r
|
|
|
86
86
|
// 对外只算包装盒 z-auto(0),被 scrim 遮罩 z500 盖住 → 点在预期位置实中遮罩 onClose =「点一下自己退」。
|
|
87
87
|
// 故包装盒必须保持零 stacking-context 属性(backdrop-filter/filter/transform/z-index 均禁;
|
|
88
88
|
// zIndex 例外见 prop 契约——需 z-index 时必须 > scrim 遮罩 500)。
|
|
89
|
-
/* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ f("div", { ref: i, "data-overlay-wrapper": !0, style: Object.keys(d).length > 1 ? d : {}, children: t }),
|
|
90
90
|
// E5.8#107 单一门:默认 → #overlay-root(浮层权威 surface 根);显式 rootId 优先;根缺失回退 body
|
|
91
|
-
(
|
|
91
|
+
(s ? document.getElementById(s) : document.getElementById(Le)) ?? document.body
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
|
-
const ue = 232, de = 224, fe = 263,
|
|
95
|
-
function J(t, n, e,
|
|
96
|
-
const
|
|
97
|
-
t.x + n +
|
|
98
|
-
|
|
99
|
-
),
|
|
100
|
-
t.y + e +
|
|
101
|
-
|
|
102
|
-
),
|
|
103
|
-
return { left:
|
|
94
|
+
const ue = 232, de = 224, fe = 263, De = 8;
|
|
95
|
+
function J(t, n, e, r, o = De) {
|
|
96
|
+
const s = Math.max(o, r.width - n - o), c = Math.max(o, r.height - e - o), i = Math.min(Math.max(
|
|
97
|
+
t.x + n + o <= r.width ? t.x : t.x - n - o,
|
|
98
|
+
o
|
|
99
|
+
), s), d = Math.min(Math.max(
|
|
100
|
+
t.y + e + o <= r.height ? t.y : t.y - e - o,
|
|
101
|
+
o
|
|
102
|
+
), c);
|
|
103
|
+
return { left: i, top: d };
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function $e(t) {
|
|
106
106
|
const n = t.replace("#", "");
|
|
107
107
|
return [
|
|
108
108
|
parseInt(n.substring(0, 2), 16),
|
|
@@ -110,112 +110,112 @@ function De(t) {
|
|
|
110
110
|
parseInt(n.substring(4, 6), 16)
|
|
111
111
|
];
|
|
112
112
|
}
|
|
113
|
-
function Se(t, n, e) {
|
|
114
|
-
return "#" + [t, n, e].map((o) => Math.max(0, Math.min(255, Math.round(o))).toString(16).padStart(2, "0")).join("");
|
|
115
|
-
}
|
|
116
113
|
function Re(t, n, e) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
return "#" + [t, n, e].map((r) => Math.max(0, Math.min(255, Math.round(r))).toString(16).padStart(2, "0")).join("");
|
|
115
|
+
}
|
|
116
|
+
function Se(t, n, e) {
|
|
117
|
+
const r = e * n, o = r * (1 - Math.abs(t / 60 % 2 - 1)), s = e - r;
|
|
118
|
+
let c = 0, i = 0, d = 0;
|
|
119
|
+
return t < 60 ? (c = r, i = o) : t < 120 ? (c = o, i = r) : t < 180 ? (i = r, d = o) : t < 240 ? (i = o, d = r) : t < 300 ? (c = o, d = r) : (c = r, d = o), [Math.round((c + s) * 255), Math.round((i + s) * 255), Math.round((d + s) * 255)];
|
|
120
120
|
}
|
|
121
121
|
function Te(t, n, e) {
|
|
122
|
-
const
|
|
123
|
-
let
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
return { h:
|
|
122
|
+
const r = Math.max(t, n, e) / 255, o = Math.min(t, n, e) / 255, s = r - o;
|
|
123
|
+
let c = 0;
|
|
124
|
+
s > 0 && (r === t / 255 ? c = 60 * ((n / 255 - e / 255) / s % 6) : r === n / 255 ? c = 60 * ((e / 255 - t / 255) / s + 2) : c = 60 * ((t / 255 - n / 255) / s + 4)), c < 0 && (c += 360);
|
|
125
|
+
const i = r === 0 ? 0 : s / r;
|
|
126
|
+
return { h: c, s: i, v: r };
|
|
127
127
|
}
|
|
128
128
|
function X(t) {
|
|
129
|
-
const [n, e,
|
|
130
|
-
return Te(n, e,
|
|
129
|
+
const [n, e, r] = $e(t);
|
|
130
|
+
return Te(n, e, r);
|
|
131
131
|
}
|
|
132
132
|
function Q(t, n, e) {
|
|
133
|
-
const [
|
|
134
|
-
return
|
|
133
|
+
const [r, o, s] = Se(t, n, e);
|
|
134
|
+
return Re(r, o, s);
|
|
135
135
|
}
|
|
136
136
|
function Pe(t) {
|
|
137
137
|
let n = t.replace(/[^0-9a-fA-F]/g, "").slice(0, 6);
|
|
138
138
|
return n.length > 0 && (n = "#" + n), n;
|
|
139
139
|
}
|
|
140
|
-
function At({ open: t, value: n, onChange: e, onClose:
|
|
141
|
-
const [
|
|
140
|
+
function At({ open: t, value: n, onChange: e, onClose: r, presets: o, anchor: s }) {
|
|
141
|
+
const [c, i] = P(() => X(n)), [d, a] = P(n), l = F(null), k = F(null), v = F(null), m = F(null), u = F(c), [x, $] = P(null);
|
|
142
142
|
R(() => {
|
|
143
143
|
if (t) {
|
|
144
144
|
const p = X(n);
|
|
145
|
-
|
|
145
|
+
u.current = p, i(p), a(n);
|
|
146
146
|
}
|
|
147
147
|
}, [n, t]);
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
151
|
-
const
|
|
152
|
-
return
|
|
148
|
+
const D = K((p) => {
|
|
149
|
+
const E = Pe(p);
|
|
150
|
+
if (a(E), /^#[0-9a-fA-F]{6}$/.test(E)) {
|
|
151
|
+
const W = X(E);
|
|
152
|
+
return u.current = W, i(W), E;
|
|
153
153
|
}
|
|
154
154
|
return null;
|
|
155
|
-
}, []), A =
|
|
156
|
-
var
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
}, []), _ =
|
|
155
|
+
}, []), A = K((p) => {
|
|
156
|
+
var C;
|
|
157
|
+
const E = (C = l.current) == null ? void 0 : C.getBoundingClientRect();
|
|
158
|
+
if (!E) return;
|
|
159
|
+
const W = Math.max(0, Math.min(1, (p.clientX - E.left) / E.width)), V = Math.max(0, Math.min(1, (p.clientY - E.top) / E.height)), w = { ...u.current, s: W, v: 1 - V };
|
|
160
|
+
u.current = w, i(w), a(Q(w.h, w.s, w.v));
|
|
161
|
+
}, []), _ = K((p) => {
|
|
162
162
|
var w;
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
165
|
-
const
|
|
166
|
-
|
|
163
|
+
const E = (w = k.current) == null ? void 0 : w.getBoundingClientRect();
|
|
164
|
+
if (!E) return;
|
|
165
|
+
const W = Math.max(0, Math.min(1, (p.clientX - E.left) / E.width)), y = { ...u.current, h: W * 360 };
|
|
166
|
+
u.current = y, i(y), a(Q(y.h, y.s, y.v));
|
|
167
167
|
}, []);
|
|
168
168
|
if (R(() => {
|
|
169
169
|
if (!t) return;
|
|
170
170
|
const p = () => {
|
|
171
171
|
m.current = null;
|
|
172
|
-
},
|
|
173
|
-
m.current === "sv" ? A(
|
|
172
|
+
}, E = (W) => {
|
|
173
|
+
m.current === "sv" ? A(W) : m.current === "hue" && _(W);
|
|
174
174
|
};
|
|
175
|
-
return window.addEventListener("mouseup", p), window.addEventListener("mousemove",
|
|
176
|
-
window.removeEventListener("mouseup", p), window.removeEventListener("mousemove",
|
|
175
|
+
return window.addEventListener("mouseup", p), window.addEventListener("mousemove", E), () => {
|
|
176
|
+
window.removeEventListener("mouseup", p), window.removeEventListener("mousemove", E);
|
|
177
177
|
};
|
|
178
|
-
}, [t, A, _]),
|
|
179
|
-
if (!t || !
|
|
180
|
-
|
|
178
|
+
}, [t, A, _]), oe(() => {
|
|
179
|
+
if (!t || !s) {
|
|
180
|
+
$(null);
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
|
-
const p = v.current,
|
|
184
|
-
|
|
185
|
-
}, [t,
|
|
186
|
-
const I = Q(
|
|
187
|
-
|
|
183
|
+
const p = v.current, E = { width: window.innerWidth, height: window.innerHeight }, W = p ? J(s, p.offsetWidth, p.offsetHeight, E) : J(s, ue, o != null && o.length ? fe : de, E);
|
|
184
|
+
$((V) => V && V.left === W.left && V.top === W.top ? V : W);
|
|
185
|
+
}, [t, s, o]), !t) return null;
|
|
186
|
+
const I = Q(c.h, 1, 1), S = `${Math.round(c.s * 100)}%`, M = `${Math.round((1 - c.v) * 100)}%`, g = `${Math.round(c.h / 360 * 100)}%`, b = s && !x ? J(
|
|
187
|
+
s,
|
|
188
188
|
ue,
|
|
189
|
-
|
|
189
|
+
o != null && o.length ? fe : de,
|
|
190
190
|
{ width: window.innerWidth, height: window.innerHeight }
|
|
191
|
-
) : null,
|
|
192
|
-
return /* @__PURE__ */
|
|
193
|
-
|
|
194
|
-
/* @__PURE__ */
|
|
191
|
+
) : null, h = x ?? b;
|
|
192
|
+
return /* @__PURE__ */ H(ie, { onClose: r, children: [
|
|
193
|
+
se(/* @__PURE__ */ f("div", { className: "colorpicker-overlay", onClick: () => r() }), we()),
|
|
194
|
+
/* @__PURE__ */ H(
|
|
195
195
|
"div",
|
|
196
196
|
{
|
|
197
197
|
ref: v,
|
|
198
198
|
className: "colorpicker-panel",
|
|
199
|
-
style:
|
|
199
|
+
style: s && h ? { left: h.left, top: h.top } : void 0,
|
|
200
200
|
onClick: (p) => p.stopPropagation(),
|
|
201
201
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ H(
|
|
203
203
|
"div",
|
|
204
204
|
{
|
|
205
|
-
ref:
|
|
205
|
+
ref: l,
|
|
206
206
|
className: "colorpicker-sv",
|
|
207
207
|
style: { background: I },
|
|
208
208
|
onMouseDown: (p) => {
|
|
209
209
|
m.current = "sv", A(p);
|
|
210
210
|
},
|
|
211
211
|
children: [
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ f("div", { className: "colorpicker-sv-white" }),
|
|
213
|
+
/* @__PURE__ */ f("div", { className: "colorpicker-sv-black" }),
|
|
214
|
+
/* @__PURE__ */ f("div", { className: "colorpicker-sv-cursor", style: { left: S, top: M } })
|
|
215
215
|
]
|
|
216
216
|
}
|
|
217
217
|
),
|
|
218
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ f(
|
|
219
219
|
"div",
|
|
220
220
|
{
|
|
221
221
|
ref: k,
|
|
@@ -223,43 +223,43 @@ function At({ open: t, value: n, onChange: e, onClose: o, presets: r, anchor: c
|
|
|
223
223
|
onMouseDown: (p) => {
|
|
224
224
|
m.current = "hue", _(p);
|
|
225
225
|
},
|
|
226
|
-
children: /* @__PURE__ */
|
|
226
|
+
children: /* @__PURE__ */ f("div", { className: "colorpicker-hue-cursor", style: { left: g } })
|
|
227
227
|
}
|
|
228
228
|
),
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ H("div", { className: "colorpicker-footer", children: [
|
|
230
|
+
/* @__PURE__ */ f("div", { className: "colorpicker-preview", style: { background: d } }),
|
|
231
|
+
/* @__PURE__ */ f(
|
|
232
232
|
"input",
|
|
233
233
|
{
|
|
234
234
|
className: "colorpicker-hex",
|
|
235
235
|
type: "text",
|
|
236
|
-
value:
|
|
236
|
+
value: d,
|
|
237
237
|
onChange: (p) => {
|
|
238
|
-
const
|
|
239
|
-
|
|
238
|
+
const E = D(p.target.value);
|
|
239
|
+
E && e(E);
|
|
240
240
|
},
|
|
241
241
|
onKeyDown: (p) => {
|
|
242
242
|
if (p.key === "Enter") {
|
|
243
|
-
const
|
|
244
|
-
|
|
243
|
+
const E = D(d);
|
|
244
|
+
E && e(E);
|
|
245
245
|
}
|
|
246
246
|
},
|
|
247
247
|
spellCheck: !1
|
|
248
248
|
}
|
|
249
249
|
),
|
|
250
|
-
/* @__PURE__ */
|
|
251
|
-
e(
|
|
250
|
+
/* @__PURE__ */ f("button", { className: "colorpicker-ok", onClick: () => {
|
|
251
|
+
e(d), r();
|
|
252
252
|
}, children: "OK" })
|
|
253
253
|
] }),
|
|
254
|
-
|
|
254
|
+
o && o.length > 0 && /* @__PURE__ */ f("div", { className: "colorpicker-presets", children: o.map((p) => /* @__PURE__ */ f(
|
|
255
255
|
"div",
|
|
256
256
|
{
|
|
257
257
|
className: "colorpicker-preset",
|
|
258
258
|
style: { background: p },
|
|
259
259
|
title: p,
|
|
260
260
|
onClick: () => {
|
|
261
|
-
const
|
|
262
|
-
|
|
261
|
+
const E = X(p);
|
|
262
|
+
u.current = E, i(E), a(p), e(p);
|
|
263
263
|
}
|
|
264
264
|
},
|
|
265
265
|
p
|
|
@@ -270,47 +270,47 @@ function At({ open: t, value: n, onChange: e, onClose: o, presets: r, anchor: c
|
|
|
270
270
|
] });
|
|
271
271
|
}
|
|
272
272
|
const Fe = { left: 0, top: 0, width: 100, maxWidth: 300 };
|
|
273
|
-
function ve({ containerRef: t, onClose: n, onKeyDown: e, listRef:
|
|
274
|
-
const [
|
|
273
|
+
function ve({ containerRef: t, onClose: n, onKeyDown: e, listRef: r, search: o, children: s }) {
|
|
274
|
+
const [c, i] = P(Fe), d = K(() => {
|
|
275
275
|
var k;
|
|
276
|
-
const
|
|
277
|
-
if (!
|
|
278
|
-
const
|
|
279
|
-
left: Math.round(
|
|
280
|
-
top: Math.round(
|
|
281
|
-
width: Math.round(
|
|
282
|
-
maxWidth: Math.round(window.innerWidth -
|
|
276
|
+
const a = (k = t.current) == null ? void 0 : k.getBoundingClientRect();
|
|
277
|
+
if (!a) return;
|
|
278
|
+
const l = {
|
|
279
|
+
left: Math.round(a.left),
|
|
280
|
+
top: Math.round(a.bottom) + 2,
|
|
281
|
+
width: Math.round(a.width),
|
|
282
|
+
maxWidth: Math.round(window.innerWidth - a.left - 24)
|
|
283
283
|
};
|
|
284
|
-
|
|
285
|
-
(v) => v.left ===
|
|
284
|
+
i(
|
|
285
|
+
(v) => v.left === l.left && v.top === l.top && v.width === l.width && v.maxWidth === l.maxWidth ? v : l
|
|
286
286
|
);
|
|
287
287
|
}, [t]);
|
|
288
|
-
return
|
|
289
|
-
window.removeEventListener("resize",
|
|
290
|
-
}), [
|
|
291
|
-
t.current ||
|
|
292
|
-
}, [t,
|
|
288
|
+
return oe(() => (d(), window.addEventListener("resize", d), window.addEventListener("scroll", d, !0), () => {
|
|
289
|
+
window.removeEventListener("resize", d), window.removeEventListener("scroll", d, !0);
|
|
290
|
+
}), [d]), R(() => {
|
|
291
|
+
t.current || d();
|
|
292
|
+
}, [t, d]), /* @__PURE__ */ f(ie, { onClose: n, triggerRef: t, children: /* @__PURE__ */ H(
|
|
293
293
|
"div",
|
|
294
294
|
{
|
|
295
295
|
className: "selectbox-dropdown",
|
|
296
296
|
onKeyDown: e,
|
|
297
297
|
style: {
|
|
298
298
|
position: "fixed",
|
|
299
|
-
left:
|
|
300
|
-
top:
|
|
301
|
-
minWidth:
|
|
299
|
+
left: c.left,
|
|
300
|
+
top: c.top,
|
|
301
|
+
minWidth: c.width,
|
|
302
302
|
// 动态 maxWidth——面板不超过窗口右边缘 - 24px 呼吸,不硬编码固定值
|
|
303
|
-
maxWidth:
|
|
303
|
+
maxWidth: c.maxWidth
|
|
304
304
|
},
|
|
305
305
|
children: [
|
|
306
|
-
|
|
307
|
-
/* @__PURE__ */
|
|
306
|
+
o,
|
|
307
|
+
/* @__PURE__ */ f("ul", { ref: r, className: "selectbox-list", tabIndex: -1, children: s })
|
|
308
308
|
]
|
|
309
309
|
}
|
|
310
310
|
) });
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
const { t:
|
|
312
|
+
function Et({ value: t, options: n, onChange: e, disabled: r, placeholder: o, title: s, className: c, onOpen: i, inputMode: d = "text" }) {
|
|
313
|
+
const { t: a } = j(), [l, k] = P(!1), [v, m] = P(t), [u, x] = P(-1), $ = F(null), D = F(null), A = F(!1);
|
|
314
314
|
R(() => {
|
|
315
315
|
A.current || m(t);
|
|
316
316
|
}, [t]);
|
|
@@ -320,24 +320,24 @@ function Ct({ value: t, options: n, onChange: e, disabled: o, placeholder: r, ti
|
|
|
320
320
|
return g ? n.filter((b) => b.toLowerCase().includes(g)) : n;
|
|
321
321
|
}, [n, v, _]);
|
|
322
322
|
R(() => {
|
|
323
|
-
|
|
324
|
-
}, [I.length,
|
|
325
|
-
if (!
|
|
326
|
-
|
|
323
|
+
u >= I.length && x(Math.max(0, I.length - 1));
|
|
324
|
+
}, [I.length, u]), R(() => {
|
|
325
|
+
if (!l) return;
|
|
326
|
+
i == null || i();
|
|
327
327
|
const g = I.findIndex((b) => b === t);
|
|
328
328
|
x(g >= 0 ? g : 0);
|
|
329
|
-
}, [
|
|
330
|
-
if (!
|
|
331
|
-
const g =
|
|
329
|
+
}, [l]), R(() => {
|
|
330
|
+
if (!l || !D.current) return;
|
|
331
|
+
const g = D.current.children[u];
|
|
332
332
|
g == null || g.scrollIntoView({ block: "nearest" });
|
|
333
|
-
}, [
|
|
334
|
-
const S =
|
|
333
|
+
}, [u, l]);
|
|
334
|
+
const S = K(
|
|
335
335
|
(g) => {
|
|
336
336
|
const b = g.trim();
|
|
337
337
|
k(!1), b && (m(b), b !== t && e(b));
|
|
338
338
|
},
|
|
339
339
|
[t, e]
|
|
340
|
-
), M =
|
|
340
|
+
), M = K(
|
|
341
341
|
(g) => {
|
|
342
342
|
switch (g.key) {
|
|
343
343
|
case "ArrowDown":
|
|
@@ -347,33 +347,33 @@ function Ct({ value: t, options: n, onChange: e, disabled: o, placeholder: r, ti
|
|
|
347
347
|
g.preventDefault(), k(!0), x((b) => Math.max(b - 1, 0));
|
|
348
348
|
break;
|
|
349
349
|
case "Enter":
|
|
350
|
-
g.preventDefault(),
|
|
350
|
+
g.preventDefault(), l && I[u] ? S(I[u]) : S(v);
|
|
351
351
|
break;
|
|
352
352
|
case "Escape":
|
|
353
353
|
g.preventDefault(), m(t), k(!1);
|
|
354
354
|
break;
|
|
355
355
|
}
|
|
356
356
|
},
|
|
357
|
-
[
|
|
357
|
+
[l, I, u, S, v, t]
|
|
358
358
|
);
|
|
359
|
-
return /* @__PURE__ */
|
|
359
|
+
return /* @__PURE__ */ H(
|
|
360
360
|
"div",
|
|
361
361
|
{
|
|
362
|
-
className: `combobox ${
|
|
363
|
-
ref:
|
|
362
|
+
className: `combobox ${l ? "selectbox-open" : ""} ${r ? "selectbox-disabled" : ""} ${c ?? ""}`,
|
|
363
|
+
ref: $,
|
|
364
364
|
children: [
|
|
365
|
-
/* @__PURE__ */
|
|
366
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ H("div", { className: "combobox-field", children: [
|
|
366
|
+
/* @__PURE__ */ f(
|
|
367
367
|
"input",
|
|
368
368
|
{
|
|
369
369
|
type: "text",
|
|
370
|
-
inputMode:
|
|
370
|
+
inputMode: d,
|
|
371
371
|
className: "combobox-input",
|
|
372
372
|
value: v,
|
|
373
|
-
title:
|
|
374
|
-
"aria-label":
|
|
375
|
-
placeholder:
|
|
376
|
-
disabled:
|
|
373
|
+
title: s,
|
|
374
|
+
"aria-label": s,
|
|
375
|
+
placeholder: o,
|
|
376
|
+
disabled: r,
|
|
377
377
|
onFocus: () => {
|
|
378
378
|
A.current = !0, k(!0);
|
|
379
379
|
},
|
|
@@ -386,20 +386,20 @@ function Ct({ value: t, options: n, onChange: e, disabled: o, placeholder: r, ti
|
|
|
386
386
|
onKeyDown: M
|
|
387
387
|
}
|
|
388
388
|
),
|
|
389
|
-
/* @__PURE__ */
|
|
389
|
+
/* @__PURE__ */ f("span", { className: `codicon codicon-chevron-down selectbox-arrow ${l ? "selectbox-arrow-up" : ""}` })
|
|
390
390
|
] }),
|
|
391
|
-
|
|
391
|
+
l && /* @__PURE__ */ f(
|
|
392
392
|
ve,
|
|
393
393
|
{
|
|
394
|
-
containerRef:
|
|
394
|
+
containerRef: $,
|
|
395
395
|
onClose: () => k(!1),
|
|
396
|
-
listRef:
|
|
397
|
-
children: I.length === 0 ? /* @__PURE__ */
|
|
396
|
+
listRef: D,
|
|
397
|
+
children: I.length === 0 ? /* @__PURE__ */ f("li", { className: "selectbox-empty", children: a("无匹配项") }) : I.map((g, b) => /* @__PURE__ */ f(
|
|
398
398
|
"li",
|
|
399
399
|
{
|
|
400
|
-
className: `selectbox-item ${b ===
|
|
401
|
-
onMouseDown: (
|
|
402
|
-
|
|
400
|
+
className: `selectbox-item ${b === u ? "selectbox-item-focus" : ""} ${g === t ? "selectbox-item-selected" : ""}`,
|
|
401
|
+
onMouseDown: (h) => {
|
|
402
|
+
h.preventDefault(), S(g);
|
|
403
403
|
},
|
|
404
404
|
onMouseEnter: () => x(b),
|
|
405
405
|
children: g
|
|
@@ -419,44 +419,44 @@ function ee() {
|
|
|
419
419
|
function ye(t, n) {
|
|
420
420
|
return t.map((e) => {
|
|
421
421
|
if (typeof e == "string") return { id: e, label: e, group: n };
|
|
422
|
-
const
|
|
422
|
+
const r = e.children && e.children.length > 0 ? ye(e.children, n) : void 0;
|
|
423
423
|
return {
|
|
424
424
|
id: e.command,
|
|
425
425
|
label: e.label ?? e.command,
|
|
426
426
|
group: n,
|
|
427
427
|
checked: e.checked,
|
|
428
428
|
commandArgs: e.commandArgs,
|
|
429
|
-
...
|
|
429
|
+
...r ? { children: r } : {}
|
|
430
430
|
};
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
|
-
function It({ menuId: t, anchor: n, context: e, onClose:
|
|
434
|
-
const
|
|
433
|
+
function It({ menuId: t, anchor: n, context: e, onClose: r, resolveChildren: o, items: s, variant: c }) {
|
|
434
|
+
const i = F(null), d = F(/* @__PURE__ */ new Map()), a = F(null), [l, k] = P([]), v = z(() => JSON.stringify(e ?? {}), [e]);
|
|
435
435
|
R(() => {
|
|
436
|
-
var w,
|
|
436
|
+
var w, C;
|
|
437
437
|
let y = !1;
|
|
438
|
-
return
|
|
438
|
+
return s ? (k(s), () => {
|
|
439
439
|
y = !0;
|
|
440
|
-
}) : ((
|
|
440
|
+
}) : ((C = (w = ee().menu) == null ? void 0 : w.getItems) == null || C.call(w, t, e).then((N) => {
|
|
441
441
|
!y && N && k(N);
|
|
442
442
|
}).catch(() => {
|
|
443
443
|
}), () => {
|
|
444
444
|
y = !0;
|
|
445
445
|
});
|
|
446
|
-
}, [t, v,
|
|
446
|
+
}, [t, v, s]);
|
|
447
447
|
const m = z(() => {
|
|
448
448
|
const y = /* @__PURE__ */ new Map(), w = [];
|
|
449
|
-
for (const N of
|
|
449
|
+
for (const N of l) {
|
|
450
450
|
const T = N.children;
|
|
451
451
|
if (!N.command && !T) continue;
|
|
452
452
|
const L = N.group ?? "__default";
|
|
453
453
|
y.has(L) || (y.set(L, []), w.push(L));
|
|
454
|
-
let
|
|
454
|
+
let B;
|
|
455
455
|
if (T && T.length > 0)
|
|
456
|
-
|
|
457
|
-
else if (T && T.length === 0 &&
|
|
458
|
-
const U =
|
|
459
|
-
U && U.length > 0 && (
|
|
456
|
+
B = ye(T, L);
|
|
457
|
+
else if (T && T.length === 0 && o) {
|
|
458
|
+
const U = o(N.command, e ?? {});
|
|
459
|
+
U && U.length > 0 && (B = U.map((Z) => ({ id: Z.id, label: Z.label, group: L })));
|
|
460
460
|
}
|
|
461
461
|
y.get(L).push({
|
|
462
462
|
id: N.command || N.label || "",
|
|
@@ -468,88 +468,88 @@ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r,
|
|
|
468
468
|
shortcut: N.shortcut,
|
|
469
469
|
checked: N.checked,
|
|
470
470
|
commandArgs: N.commandArgs,
|
|
471
|
-
children:
|
|
471
|
+
children: B
|
|
472
472
|
});
|
|
473
473
|
}
|
|
474
|
-
const
|
|
474
|
+
const C = [];
|
|
475
475
|
for (let N = 0; N < w.length; N++)
|
|
476
|
-
N > 0 &&
|
|
477
|
-
return
|
|
478
|
-
}, [
|
|
479
|
-
|
|
480
|
-
}, []),
|
|
481
|
-
|
|
482
|
-
}, []), A =
|
|
483
|
-
|
|
476
|
+
N > 0 && C.push({ type: "divider", group: w[N] }), C.push(...y.get(w[N]));
|
|
477
|
+
return C;
|
|
478
|
+
}, [l, e, o]), [u, x] = P([]), $ = K(() => {
|
|
479
|
+
a.current && (clearTimeout(a.current), a.current = null);
|
|
480
|
+
}, []), D = K((y) => {
|
|
481
|
+
a.current && (clearTimeout(a.current), a.current = null), a.current = setTimeout(() => x((w) => w.slice(0, y)), 150);
|
|
482
|
+
}, []), A = K((y, w, C) => {
|
|
483
|
+
$();
|
|
484
484
|
const N = y.getBoundingClientRect(), T = 160, L = N.right + T > window.innerWidth ? N.left - T - 4 : N.right + 4;
|
|
485
|
-
x((
|
|
486
|
-
}, [
|
|
485
|
+
x((B) => [...B.slice(0, C), { x: L, y: N.top, items: w }]);
|
|
486
|
+
}, [$]), [_, I] = P({ left: n.x, top: n.y }), [S, M] = P(!1), g = S;
|
|
487
487
|
R(() => {
|
|
488
488
|
if (!g) return;
|
|
489
489
|
const y = (T) => {
|
|
490
|
-
T.key === "Escape" && (
|
|
491
|
-
}, w = () =>
|
|
490
|
+
T.key === "Escape" && (u.length > 0 ? x((L) => L.slice(0, L.length - 1)) : r());
|
|
491
|
+
}, w = () => r(), C = () => r(), N = (T) => {
|
|
492
492
|
var U;
|
|
493
493
|
const L = T.target;
|
|
494
|
-
(((U =
|
|
494
|
+
(((U = i.current) == null ? void 0 : U.contains(L)) ?? !1) || [...d.current.values()].some((Z) => Z.contains(L)) || r();
|
|
495
495
|
};
|
|
496
|
-
return window.addEventListener("keydown", y), window.addEventListener("blur", w), window.addEventListener("wheel",
|
|
497
|
-
window.removeEventListener("keydown", y), window.removeEventListener("blur", w), window.removeEventListener("wheel",
|
|
496
|
+
return window.addEventListener("keydown", y), window.addEventListener("blur", w), window.addEventListener("wheel", C, !0), c !== "embedded" && window.addEventListener("mousedown", N, !0), () => {
|
|
497
|
+
window.removeEventListener("keydown", y), window.removeEventListener("blur", w), window.removeEventListener("wheel", C, !0), c !== "embedded" && window.removeEventListener("mousedown", N, !0);
|
|
498
498
|
};
|
|
499
|
-
}, [
|
|
500
|
-
const [b,
|
|
499
|
+
}, [r, u, g, c]);
|
|
500
|
+
const [b, h] = P(-1), p = F(/* @__PURE__ */ new Map()), E = z(() => m.filter((y) => !("type" in y)), [m]);
|
|
501
501
|
R(() => {
|
|
502
502
|
if (!g) return;
|
|
503
503
|
const y = (w) => {
|
|
504
|
-
var
|
|
504
|
+
var C, N, T;
|
|
505
505
|
if (w.key === "ArrowDown")
|
|
506
|
-
w.preventDefault(),
|
|
506
|
+
w.preventDefault(), h((L) => Math.min(L + 1, E.length - 1));
|
|
507
507
|
else if (w.key === "ArrowUp")
|
|
508
|
-
w.preventDefault(),
|
|
508
|
+
w.preventDefault(), h((L) => Math.max(L - 1, 0));
|
|
509
509
|
else if (w.key === "ArrowRight" && b >= 0) {
|
|
510
|
-
const L =
|
|
511
|
-
if ((
|
|
510
|
+
const L = E[b];
|
|
511
|
+
if ((C = L == null ? void 0 : L.children) != null && C.length) {
|
|
512
512
|
w.preventDefault();
|
|
513
|
-
const
|
|
514
|
-
|
|
513
|
+
const B = p.current.get(b);
|
|
514
|
+
B && A(B, L.children, 0);
|
|
515
515
|
}
|
|
516
516
|
} else if (w.key === "ArrowLeft")
|
|
517
|
-
|
|
517
|
+
u.length > 0 && (w.preventDefault(), x((L) => L.slice(0, L.length - 1)));
|
|
518
518
|
else if (w.key === "Enter" && b >= 0) {
|
|
519
519
|
w.preventDefault();
|
|
520
|
-
const L =
|
|
521
|
-
L && ((T = (N = ee().commands) == null ? void 0 : N.executeCommand) == null || T.call(N, L.id, void 0, ...L.commandArgs ?? [], e),
|
|
520
|
+
const L = E[b];
|
|
521
|
+
L && ((T = (N = ee().commands) == null ? void 0 : N.executeCommand) == null || T.call(N, L.id, void 0, ...L.commandArgs ?? [], e), r());
|
|
522
522
|
}
|
|
523
523
|
};
|
|
524
524
|
return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
|
|
525
|
-
}, [
|
|
525
|
+
}, [E, b, e, r, g, u, A]), R(() => {
|
|
526
526
|
var y;
|
|
527
527
|
b >= 0 && ((y = p.current.get(b)) == null || y.scrollIntoView({ block: "nearest" }));
|
|
528
528
|
}, [b]);
|
|
529
|
-
const
|
|
530
|
-
var w,
|
|
531
|
-
|
|
532
|
-
}, [e,
|
|
533
|
-
|
|
529
|
+
const W = K(async (y) => {
|
|
530
|
+
var w, C;
|
|
531
|
+
r(), await ((C = (w = ee().commands) == null ? void 0 : w.executeCommand) == null ? void 0 : C.call(w, y.id, void 0, ...y.commandArgs ?? [], e));
|
|
532
|
+
}, [e, r]);
|
|
533
|
+
oe(() => {
|
|
534
534
|
I({ left: n.x, top: Math.max(30, n.y) }), M(!1);
|
|
535
535
|
}, [n.x, n.y, m.length]), R(() => {
|
|
536
|
-
const y =
|
|
536
|
+
const y = i.current;
|
|
537
537
|
if (!y) return;
|
|
538
538
|
const w = y.getBoundingClientRect();
|
|
539
|
-
let
|
|
540
|
-
|
|
539
|
+
let C = n.x, N = Math.max(30, n.y);
|
|
540
|
+
C + w.width > window.innerWidth && (C = Math.max(0, window.innerWidth - w.width - 4)), N + w.height > window.innerHeight && (N = Math.max(30, window.innerHeight - w.height - 4)), I({ left: C, top: N });
|
|
541
541
|
const T = requestAnimationFrame(() => {
|
|
542
542
|
M(!0), y.classList.add("show");
|
|
543
543
|
});
|
|
544
544
|
return () => cancelAnimationFrame(T);
|
|
545
545
|
}, [n.x, n.y, m.length]), R(() => {
|
|
546
546
|
var y;
|
|
547
|
-
S && ((y =
|
|
547
|
+
S && ((y = i.current) == null || y.focus());
|
|
548
548
|
}, [S]);
|
|
549
549
|
let V = 0;
|
|
550
|
-
return /* @__PURE__ */
|
|
551
|
-
|
|
552
|
-
/* @__PURE__ */
|
|
550
|
+
return /* @__PURE__ */ H(ie, { rootId: "context-menu-root", zIndex: String(Y), children: [
|
|
551
|
+
c !== "embedded" && c !== "non-modal" && se(
|
|
552
|
+
/* @__PURE__ */ f(
|
|
553
553
|
"div",
|
|
554
554
|
{
|
|
555
555
|
style: {
|
|
@@ -561,10 +561,10 @@ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r,
|
|
|
561
561
|
),
|
|
562
562
|
we()
|
|
563
563
|
),
|
|
564
|
-
/* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ f(
|
|
565
565
|
"div",
|
|
566
566
|
{
|
|
567
|
-
ref:
|
|
567
|
+
ref: i,
|
|
568
568
|
className: "ctx-menu",
|
|
569
569
|
tabIndex: -1,
|
|
570
570
|
style: {
|
|
@@ -574,32 +574,32 @@ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r,
|
|
|
574
574
|
visibility: S ? void 0 : "hidden"
|
|
575
575
|
},
|
|
576
576
|
children: m.map((y, w) => {
|
|
577
|
-
if ("type" in y) return /* @__PURE__ */
|
|
578
|
-
const
|
|
577
|
+
if ("type" in y) return /* @__PURE__ */ f("div", { className: "ctx-divider" }, `div-${w}`);
|
|
578
|
+
const C = V++, N = !!(y.children && y.children.length > 0), T = C === b, L = y.group === "delete";
|
|
579
579
|
return (
|
|
580
580
|
// E5.8#37.7.1:复合 key——共享命令 id 的动态项(面板视图清单全用同一 toggle 命令)会撞 key;
|
|
581
581
|
// 并入数组索引消歧(菜单项在菜单生命周期内静态,索引稳定)。
|
|
582
|
-
/* @__PURE__ */
|
|
582
|
+
/* @__PURE__ */ H(
|
|
583
583
|
"div",
|
|
584
584
|
{
|
|
585
|
-
ref: (
|
|
586
|
-
|
|
585
|
+
ref: (B) => {
|
|
586
|
+
B ? p.current.set(C, B) : p.current.delete(C);
|
|
587
587
|
},
|
|
588
588
|
className: `ctx-item${T ? " focused" : ""}${L ? " ctx-item-danger" : ""}`,
|
|
589
|
-
onClick: (
|
|
590
|
-
|
|
589
|
+
onClick: (B) => {
|
|
590
|
+
B.stopPropagation(), N || W(y);
|
|
591
591
|
},
|
|
592
|
-
onMouseEnter: (
|
|
593
|
-
|
|
592
|
+
onMouseEnter: (B) => {
|
|
593
|
+
h(C), N ? A(B.currentTarget, y.children, 0) : x((U) => U.slice(0, 0));
|
|
594
594
|
},
|
|
595
595
|
onMouseLeave: () => {
|
|
596
|
-
N &&
|
|
596
|
+
N && D(1);
|
|
597
597
|
},
|
|
598
598
|
children: [
|
|
599
|
-
/* @__PURE__ */
|
|
600
|
-
/* @__PURE__ */
|
|
601
|
-
N && /* @__PURE__ */
|
|
602
|
-
y.shortcut && /* @__PURE__ */
|
|
599
|
+
/* @__PURE__ */ f("span", { className: "ctx-item-check", "aria-hidden": "true", children: y.checked ? "✓" : "" }),
|
|
600
|
+
/* @__PURE__ */ f("span", { className: "ctx-item-label", children: y.label }),
|
|
601
|
+
N && /* @__PURE__ */ f("span", { className: "ctx-item-chevron", children: "›" }),
|
|
602
|
+
y.shortcut && /* @__PURE__ */ f("span", { className: "ctx-item-shortcut", children: y.shortcut })
|
|
603
603
|
]
|
|
604
604
|
},
|
|
605
605
|
`${y.id}::${w}`
|
|
@@ -608,39 +608,39 @@ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r,
|
|
|
608
608
|
})
|
|
609
609
|
}
|
|
610
610
|
),
|
|
611
|
-
|
|
611
|
+
u.map((y, w) => /* @__PURE__ */ f(
|
|
612
612
|
"div",
|
|
613
613
|
{
|
|
614
|
-
ref: (
|
|
615
|
-
|
|
614
|
+
ref: (C) => {
|
|
615
|
+
C ? d.current.set(w, C) : d.current.delete(w);
|
|
616
616
|
},
|
|
617
617
|
className: "ctx-menu show",
|
|
618
618
|
style: { left: y.x, top: y.y, zIndex: Y },
|
|
619
|
-
onMouseEnter:
|
|
620
|
-
onMouseLeave: () =>
|
|
621
|
-
children: y.items.map((
|
|
622
|
-
const T = !!(
|
|
623
|
-
return /* @__PURE__ */
|
|
619
|
+
onMouseEnter: $,
|
|
620
|
+
onMouseLeave: () => D(w + 1),
|
|
621
|
+
children: y.items.map((C, N) => {
|
|
622
|
+
const T = !!(C.children && C.children.length > 0);
|
|
623
|
+
return /* @__PURE__ */ H(
|
|
624
624
|
"div",
|
|
625
625
|
{
|
|
626
626
|
className: "ctx-item",
|
|
627
627
|
onClick: (L) => {
|
|
628
|
-
L.stopPropagation(), T ||
|
|
628
|
+
L.stopPropagation(), T || W(C);
|
|
629
629
|
},
|
|
630
630
|
onMouseEnter: (L) => {
|
|
631
|
-
T ? A(L.currentTarget,
|
|
631
|
+
T ? A(L.currentTarget, C.children, w + 1) : x((B) => B.slice(0, w + 1));
|
|
632
632
|
},
|
|
633
633
|
onMouseLeave: () => {
|
|
634
|
-
T &&
|
|
634
|
+
T && D(w + 2);
|
|
635
635
|
},
|
|
636
636
|
children: [
|
|
637
|
-
/* @__PURE__ */
|
|
638
|
-
/* @__PURE__ */
|
|
639
|
-
T && /* @__PURE__ */
|
|
640
|
-
|
|
637
|
+
/* @__PURE__ */ f("span", { className: "ctx-item-check", "aria-hidden": "true", children: C.checked ? "✓" : "" }),
|
|
638
|
+
/* @__PURE__ */ f("span", { className: "ctx-item-label", children: C.label }),
|
|
639
|
+
T && /* @__PURE__ */ f("span", { className: "ctx-item-chevron", children: "›" }),
|
|
640
|
+
C.shortcut && /* @__PURE__ */ f("span", { className: "ctx-item-shortcut", children: C.shortcut })
|
|
641
641
|
]
|
|
642
642
|
},
|
|
643
|
-
`${
|
|
643
|
+
`${C.id}::${N}`
|
|
644
644
|
);
|
|
645
645
|
})
|
|
646
646
|
},
|
|
@@ -651,109 +651,109 @@ function It({ menuId: t, anchor: n, context: e, onClose: o, resolveChildren: r,
|
|
|
651
651
|
function He(t) {
|
|
652
652
|
return typeof t == "object" && "value" in t && "label" in t;
|
|
653
653
|
}
|
|
654
|
-
function ge({ value: t, options: n, onChange: e, disabled:
|
|
655
|
-
const { t:
|
|
656
|
-
() => n.map((
|
|
654
|
+
function ge({ value: t, options: n, onChange: e, disabled: r, placeholder: o, title: s, className: c, onOpen: i }) {
|
|
655
|
+
const { t: d } = j(), [a, l] = P(!1), [k, v] = P(""), [m, u] = P(-1), x = F(null), $ = F(null), D = F(null), A = z(
|
|
656
|
+
() => n.map((h) => He(h) ? h : { value: h, label: h }),
|
|
657
657
|
[n]
|
|
658
658
|
), _ = z(() => {
|
|
659
659
|
if (!k) return A;
|
|
660
|
-
const
|
|
661
|
-
return A.filter((p) => p.label.toLowerCase().includes(
|
|
662
|
-
}, [A, k]), I = z(() => A.find((
|
|
660
|
+
const h = k.toLowerCase();
|
|
661
|
+
return A.filter((p) => p.label.toLowerCase().includes(h));
|
|
662
|
+
}, [A, k]), I = z(() => A.find((h) => h.value === t), [A, t]), S = z(() => I ? I.label : t !== "" ? t : o ?? t, [I, t, o]);
|
|
663
663
|
R(() => {
|
|
664
|
-
m >= _.length &&
|
|
664
|
+
m >= _.length && u(Math.max(0, _.length - 1));
|
|
665
665
|
}, [_.length, m]), R(() => {
|
|
666
|
-
var p,
|
|
667
|
-
if (!
|
|
668
|
-
v(""),
|
|
666
|
+
var p, E;
|
|
667
|
+
if (!a) {
|
|
668
|
+
v(""), u(-1);
|
|
669
669
|
return;
|
|
670
670
|
}
|
|
671
|
-
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
}, [
|
|
675
|
-
const M =
|
|
676
|
-
(
|
|
677
|
-
e(
|
|
671
|
+
i == null || i();
|
|
672
|
+
const h = _.findIndex((W) => W.value === t);
|
|
673
|
+
u(h >= 0 ? h : 0), A.length > 8 ? (p = $.current) == null || p.focus() : (E = D.current) == null || E.focus();
|
|
674
|
+
}, [a]);
|
|
675
|
+
const M = K(
|
|
676
|
+
(h) => {
|
|
677
|
+
e(h), l(!1);
|
|
678
678
|
},
|
|
679
679
|
[e]
|
|
680
|
-
), g =
|
|
681
|
-
(
|
|
682
|
-
switch (
|
|
680
|
+
), g = K(
|
|
681
|
+
(h) => {
|
|
682
|
+
switch (h.key) {
|
|
683
683
|
case "ArrowDown":
|
|
684
|
-
|
|
684
|
+
h.preventDefault(), u((p) => Math.min(p + 1, _.length - 1));
|
|
685
685
|
break;
|
|
686
686
|
case "ArrowUp":
|
|
687
|
-
|
|
687
|
+
h.preventDefault(), u((p) => Math.max(p - 1, 0));
|
|
688
688
|
break;
|
|
689
689
|
case "Enter":
|
|
690
|
-
|
|
690
|
+
h.preventDefault(), _[m] && M(_[m].value);
|
|
691
691
|
break;
|
|
692
692
|
}
|
|
693
693
|
},
|
|
694
694
|
[_, m, M]
|
|
695
695
|
);
|
|
696
696
|
R(() => {
|
|
697
|
-
if (!
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
}, [m,
|
|
697
|
+
if (!a || !D.current) return;
|
|
698
|
+
const h = D.current.children[m];
|
|
699
|
+
h == null || h.scrollIntoView({ block: "nearest" });
|
|
700
|
+
}, [m, a]);
|
|
701
701
|
const b = A.length > 8;
|
|
702
|
-
return /* @__PURE__ */
|
|
702
|
+
return /* @__PURE__ */ H(
|
|
703
703
|
"div",
|
|
704
704
|
{
|
|
705
|
-
className: `selectbox ${
|
|
705
|
+
className: `selectbox ${a ? "selectbox-open" : ""} ${r ? "selectbox-disabled" : ""} ${c ?? ""}`,
|
|
706
706
|
ref: x,
|
|
707
707
|
children: [
|
|
708
|
-
/* @__PURE__ */
|
|
708
|
+
/* @__PURE__ */ H(
|
|
709
709
|
"button",
|
|
710
710
|
{
|
|
711
711
|
type: "button",
|
|
712
712
|
className: "selectbox-trigger",
|
|
713
|
-
disabled:
|
|
714
|
-
title:
|
|
715
|
-
onClick: () =>
|
|
713
|
+
disabled: r,
|
|
714
|
+
title: s,
|
|
715
|
+
onClick: () => l((h) => !h),
|
|
716
716
|
children: [
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
(I == null ? void 0 : I.preview) && /* @__PURE__ */
|
|
717
|
+
/* @__PURE__ */ H("span", { className: "selectbox-label", children: [
|
|
718
|
+
(I == null ? void 0 : I.preview) && /* @__PURE__ */ f("span", { className: "selectbox-swatch", style: { background: I.preview } }),
|
|
719
719
|
S
|
|
720
720
|
] }),
|
|
721
|
-
/* @__PURE__ */
|
|
721
|
+
/* @__PURE__ */ f("span", { className: `codicon codicon-chevron-down selectbox-arrow ${a ? "selectbox-arrow-up" : ""}` })
|
|
722
722
|
]
|
|
723
723
|
}
|
|
724
724
|
),
|
|
725
|
-
|
|
725
|
+
a && /* @__PURE__ */ f(
|
|
726
726
|
ve,
|
|
727
727
|
{
|
|
728
728
|
containerRef: x,
|
|
729
|
-
onClose: () =>
|
|
729
|
+
onClose: () => l(!1),
|
|
730
730
|
onKeyDown: g,
|
|
731
|
-
listRef:
|
|
732
|
-
search: b ? /* @__PURE__ */
|
|
731
|
+
listRef: D,
|
|
732
|
+
search: b ? /* @__PURE__ */ f("div", { className: "selectbox-search", children: /* @__PURE__ */ f(
|
|
733
733
|
"input",
|
|
734
734
|
{
|
|
735
|
-
ref:
|
|
735
|
+
ref: $,
|
|
736
736
|
type: "text",
|
|
737
737
|
className: "selectbox-search-input",
|
|
738
|
-
placeholder:
|
|
738
|
+
placeholder: d("筛选..."),
|
|
739
739
|
value: k,
|
|
740
|
-
onChange: (
|
|
741
|
-
v(
|
|
740
|
+
onChange: (h) => {
|
|
741
|
+
v(h.target.value), u(0);
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
744
|
) }) : void 0,
|
|
745
|
-
children: _.length === 0 ? /* @__PURE__ */
|
|
745
|
+
children: _.length === 0 ? /* @__PURE__ */ f("li", { className: "selectbox-empty", children: d("无匹配项") }) : _.map((h, p) => /* @__PURE__ */ H(
|
|
746
746
|
"li",
|
|
747
747
|
{
|
|
748
|
-
className: `selectbox-item ${p === m ? "selectbox-item-focus" : ""} ${
|
|
749
|
-
onClick: () => M(
|
|
750
|
-
onMouseEnter: () =>
|
|
748
|
+
className: `selectbox-item ${p === m ? "selectbox-item-focus" : ""} ${h.value === t ? "selectbox-item-selected" : ""}`,
|
|
749
|
+
onClick: () => M(h.value),
|
|
750
|
+
onMouseEnter: () => u(p),
|
|
751
751
|
children: [
|
|
752
|
-
|
|
753
|
-
|
|
752
|
+
h.preview && /* @__PURE__ */ f("span", { className: "selectbox-swatch", style: { background: h.preview } }),
|
|
753
|
+
h.label
|
|
754
754
|
]
|
|
755
755
|
},
|
|
756
|
-
|
|
756
|
+
h.value
|
|
757
757
|
))
|
|
758
758
|
}
|
|
759
759
|
)
|
|
@@ -762,118 +762,118 @@ function ge({ value: t, options: n, onChange: e, disabled: o, placeholder: r, ti
|
|
|
762
762
|
);
|
|
763
763
|
}
|
|
764
764
|
const he = "followTheme", te = [];
|
|
765
|
-
function Lt({ value: t, onChange: n, optionsFrom: e, domain:
|
|
766
|
-
const { t:
|
|
765
|
+
function Lt({ value: t, onChange: n, optionsFrom: e, domain: r, disabled: o, placeholder: s, title: c }) {
|
|
766
|
+
const { t: i } = j(), [d, a] = P(te), l = e === "theme.colorways" && r === "colors", [k, v] = P(void 0);
|
|
767
767
|
R(() => {
|
|
768
|
-
var
|
|
769
|
-
if (!
|
|
768
|
+
var D, A, _, I, S;
|
|
769
|
+
if (!l) return;
|
|
770
770
|
let x = !1;
|
|
771
|
-
(A = (
|
|
771
|
+
(A = (D = window.linkdesk) == null ? void 0 : D.configuration) == null || A.get("app.appearanceMode").then((M) => {
|
|
772
772
|
x || v(M);
|
|
773
773
|
});
|
|
774
|
-
const
|
|
774
|
+
const $ = (S = (I = (_ = window.linkdesk) == null ? void 0 : _.configuration) == null ? void 0 : I.onChange) == null ? void 0 : S.call(I, "app.appearanceMode", (M) => v(M));
|
|
775
775
|
return () => {
|
|
776
|
-
x = !0,
|
|
776
|
+
x = !0, $ == null || $();
|
|
777
777
|
};
|
|
778
|
-
}, [
|
|
779
|
-
const m =
|
|
780
|
-
var D,
|
|
781
|
-
const x = (
|
|
778
|
+
}, [l]);
|
|
779
|
+
const m = l && k === "custom", u = K(async () => {
|
|
780
|
+
var $, D, A, _;
|
|
781
|
+
const x = (D = ($ = window.linkdesk) == null ? void 0 : $.theme) == null ? void 0 : D.listRecipes;
|
|
782
782
|
if (x)
|
|
783
783
|
try {
|
|
784
784
|
const I = await x() ?? [];
|
|
785
785
|
if (e === "theme.sources" || m) {
|
|
786
|
-
if (
|
|
787
|
-
|
|
788
|
-
{ value: he, label:
|
|
786
|
+
if (r === "colors") {
|
|
787
|
+
a([
|
|
788
|
+
{ value: he, label: i("跟随主题") },
|
|
789
789
|
...I.flatMap(
|
|
790
|
-
(
|
|
791
|
-
var
|
|
790
|
+
(h) => h.colorways.map((p) => {
|
|
791
|
+
var E;
|
|
792
792
|
return {
|
|
793
793
|
value: p.id,
|
|
794
|
-
label: `${
|
|
795
|
-
preview: ((
|
|
794
|
+
label: `${h.name}·${p.name}`,
|
|
795
|
+
preview: ((E = p.preview) == null ? void 0 : E.accent) || void 0
|
|
796
796
|
};
|
|
797
797
|
})
|
|
798
798
|
)
|
|
799
799
|
]);
|
|
800
800
|
return;
|
|
801
801
|
}
|
|
802
|
-
const b =
|
|
803
|
-
|
|
804
|
-
{ value: he, label:
|
|
805
|
-
...b.map((
|
|
802
|
+
const b = r ? I.filter((h) => h.domains.includes(r)) : I;
|
|
803
|
+
a([
|
|
804
|
+
{ value: he, label: i("跟随主题") },
|
|
805
|
+
...b.map((h) => ({ value: h.id, label: h.name }))
|
|
806
806
|
]);
|
|
807
807
|
return;
|
|
808
808
|
}
|
|
809
809
|
const S = (_ = (A = window.linkdesk) == null ? void 0 : A.configuration) == null ? void 0 : _.get, M = S ? await S("app.theme") : "", g = I.find((b) => b.id === M);
|
|
810
|
-
|
|
810
|
+
a(
|
|
811
811
|
g ? g.colorways.map((b) => {
|
|
812
|
-
var
|
|
813
|
-
return { value: b.id, label: b.name, preview: ((
|
|
812
|
+
var h;
|
|
813
|
+
return { value: b.id, label: b.name, preview: ((h = b.preview) == null ? void 0 : h.accent) || void 0 };
|
|
814
814
|
}) : te
|
|
815
815
|
);
|
|
816
816
|
} catch {
|
|
817
|
-
|
|
817
|
+
a(te);
|
|
818
818
|
}
|
|
819
|
-
}, [e,
|
|
819
|
+
}, [e, r, i, m]);
|
|
820
820
|
return R(() => {
|
|
821
|
-
var
|
|
822
|
-
|
|
823
|
-
const x = (_ = (A = (
|
|
824
|
-
|
|
825
|
-
}),
|
|
826
|
-
|
|
821
|
+
var D, A, _, I, S, M;
|
|
822
|
+
u();
|
|
823
|
+
const x = (_ = (A = (D = window.linkdesk) == null ? void 0 : D.configuration) == null ? void 0 : A.onPluginLifecycleChange) == null ? void 0 : _.call(A, () => {
|
|
824
|
+
u();
|
|
825
|
+
}), $ = e === "theme.colorways" ? (M = (S = (I = window.linkdesk) == null ? void 0 : I.configuration) == null ? void 0 : S.onChange) == null ? void 0 : M.call(S, "app.theme", () => {
|
|
826
|
+
u();
|
|
827
827
|
}) : void 0;
|
|
828
828
|
return () => {
|
|
829
|
-
x == null || x(),
|
|
829
|
+
x == null || x(), $ == null || $();
|
|
830
830
|
};
|
|
831
|
-
}, [
|
|
831
|
+
}, [u, e]), l && !m && d.length === 1 ? null : /* @__PURE__ */ f(
|
|
832
832
|
ge,
|
|
833
833
|
{
|
|
834
834
|
value: t,
|
|
835
|
-
options:
|
|
835
|
+
options: d,
|
|
836
836
|
onChange: n,
|
|
837
|
-
disabled:
|
|
838
|
-
placeholder:
|
|
839
|
-
title:
|
|
837
|
+
disabled: o,
|
|
838
|
+
placeholder: s,
|
|
839
|
+
title: c,
|
|
840
840
|
onOpen: () => {
|
|
841
|
-
|
|
841
|
+
u();
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
844
|
);
|
|
845
845
|
}
|
|
846
846
|
function _t({ value: t, onChange: n, dialogType: e }) {
|
|
847
|
-
const { t:
|
|
848
|
-
var
|
|
849
|
-
const
|
|
850
|
-
if (!
|
|
851
|
-
const
|
|
852
|
-
filters: [{ name:
|
|
847
|
+
const { t: r } = j(), o = async () => {
|
|
848
|
+
var i;
|
|
849
|
+
const s = (i = window.linkdesk) == null ? void 0 : i.dialog;
|
|
850
|
+
if (!s) return;
|
|
851
|
+
const c = e === "directory" ? { directory: !0 } : {
|
|
852
|
+
filters: [{ name: r("所有文件"), extensions: ["*"] }]
|
|
853
853
|
};
|
|
854
854
|
try {
|
|
855
|
-
const
|
|
856
|
-
|
|
855
|
+
const d = await s.open(c);
|
|
856
|
+
d && n(d);
|
|
857
857
|
} catch {
|
|
858
858
|
}
|
|
859
859
|
};
|
|
860
|
-
return /* @__PURE__ */
|
|
861
|
-
/* @__PURE__ */
|
|
860
|
+
return /* @__PURE__ */ H("div", { style: { display: "flex", gap: 4, alignItems: "center" }, children: [
|
|
861
|
+
/* @__PURE__ */ f(
|
|
862
862
|
"input",
|
|
863
863
|
{
|
|
864
864
|
className: "input",
|
|
865
865
|
type: "text",
|
|
866
866
|
value: t,
|
|
867
|
-
onChange: (
|
|
867
|
+
onChange: (s) => n(s.target.value),
|
|
868
868
|
style: { flex: 1 },
|
|
869
|
-
placeholder:
|
|
869
|
+
placeholder: r(e === "directory" ? "选择目录…" : "选择文件…")
|
|
870
870
|
}
|
|
871
871
|
),
|
|
872
|
-
/* @__PURE__ */
|
|
873
|
-
|
|
872
|
+
/* @__PURE__ */ f(
|
|
873
|
+
Ee,
|
|
874
874
|
{
|
|
875
|
-
onClick:
|
|
876
|
-
title:
|
|
875
|
+
onClick: o,
|
|
876
|
+
title: r(e === "directory" ? "浏览目录…" : "浏览文件…"),
|
|
877
877
|
children: "…"
|
|
878
878
|
}
|
|
879
879
|
)
|
|
@@ -926,8 +926,8 @@ function We(t) {
|
|
|
926
926
|
const e = document.createElement("canvas").getContext("2d");
|
|
927
927
|
if (!e) return !1;
|
|
928
928
|
e.font = `16px "${t}"`;
|
|
929
|
-
const
|
|
930
|
-
return Math.abs(
|
|
929
|
+
const r = e.measureText("i").width, o = e.measureText("W").width;
|
|
930
|
+
return Math.abs(r - o) < 0.5;
|
|
931
931
|
} catch {
|
|
932
932
|
return !1;
|
|
933
933
|
}
|
|
@@ -935,179 +935,179 @@ function We(t) {
|
|
|
935
935
|
function Be(t) {
|
|
936
936
|
const [n, e] = P([]);
|
|
937
937
|
return R(() => {
|
|
938
|
-
let
|
|
939
|
-
async function
|
|
940
|
-
var
|
|
941
|
-
let
|
|
938
|
+
let r = !1;
|
|
939
|
+
async function o() {
|
|
940
|
+
var i;
|
|
941
|
+
let s = [];
|
|
942
942
|
if ("queryLocalFonts" in window)
|
|
943
943
|
try {
|
|
944
|
-
const
|
|
945
|
-
|
|
944
|
+
const d = await ((i = window.queryLocalFonts) == null ? void 0 : i.call(window));
|
|
945
|
+
r || (s = (d ?? []).map((a) => a.family).filter((a, l, k) => k.indexOf(a) === l));
|
|
946
946
|
} catch {
|
|
947
947
|
}
|
|
948
|
-
|
|
949
|
-
const
|
|
950
|
-
|
|
948
|
+
s.length === 0 && (s = t ? be : Ke);
|
|
949
|
+
const c = t ? s.filter((d) => We(d)) : s;
|
|
950
|
+
r || e(c.sort((d, a) => d.localeCompare(a)));
|
|
951
951
|
}
|
|
952
|
-
return
|
|
953
|
-
|
|
952
|
+
return o(), () => {
|
|
953
|
+
r = !0;
|
|
954
954
|
};
|
|
955
955
|
}, [t]), n;
|
|
956
956
|
}
|
|
957
|
-
function
|
|
958
|
-
const { t:
|
|
959
|
-
{ value: "", label:
|
|
960
|
-
{ value: "__none__", label:
|
|
961
|
-
...
|
|
962
|
-
], [e,
|
|
963
|
-
return /* @__PURE__ */
|
|
957
|
+
function Dt({ value: t, onChange: n, monoOnly: e = !0 }) {
|
|
958
|
+
const { t: r } = j(), o = Be(e), s = z(() => e ? o.map((c) => ({ value: c, label: c })) : [
|
|
959
|
+
{ value: "", label: r("跟随主题") },
|
|
960
|
+
{ value: "__none__", label: r("系统字体") },
|
|
961
|
+
...o.map((c) => ({ value: c, label: c }))
|
|
962
|
+
], [e, o, r]);
|
|
963
|
+
return /* @__PURE__ */ f(
|
|
964
964
|
ge,
|
|
965
965
|
{
|
|
966
966
|
value: t,
|
|
967
|
-
options:
|
|
967
|
+
options: s,
|
|
968
968
|
onChange: n,
|
|
969
|
-
placeholder:
|
|
969
|
+
placeholder: r(e ? "选择等宽字体…" : "跟随主题")
|
|
970
970
|
}
|
|
971
971
|
);
|
|
972
972
|
}
|
|
973
|
-
function
|
|
974
|
-
return /* @__PURE__ */
|
|
975
|
-
/* @__PURE__ */
|
|
973
|
+
function $t({ label: t, children: n }) {
|
|
974
|
+
return /* @__PURE__ */ H("div", { className: "form-row", children: [
|
|
975
|
+
/* @__PURE__ */ f("label", { children: t }),
|
|
976
976
|
n
|
|
977
977
|
] });
|
|
978
978
|
}
|
|
979
|
-
function
|
|
980
|
-
const { t:
|
|
979
|
+
function Rt({ value: t, onChange: n, min: e, max: r, step: o = 1, unit: s, style: c }) {
|
|
980
|
+
const { t: i } = j(), d = K(
|
|
981
981
|
(m) => {
|
|
982
|
-
let
|
|
983
|
-
return e !== void 0 && (
|
|
982
|
+
let u = m;
|
|
983
|
+
return e !== void 0 && (u = Math.max(e, u)), r !== void 0 && (u = Math.min(r, u)), u;
|
|
984
984
|
},
|
|
985
|
-
[e,
|
|
986
|
-
),
|
|
987
|
-
return /* @__PURE__ */
|
|
988
|
-
/* @__PURE__ */
|
|
985
|
+
[e, r]
|
|
986
|
+
), a = () => n(d(t - o)), l = () => n(d(t + o)), k = e !== void 0 && t <= e, v = r !== void 0 && t >= r;
|
|
987
|
+
return /* @__PURE__ */ H("div", { className: "number-input", style: c, children: [
|
|
988
|
+
/* @__PURE__ */ f(
|
|
989
989
|
"button",
|
|
990
990
|
{
|
|
991
991
|
className: "number-input-btn",
|
|
992
|
-
onClick:
|
|
992
|
+
onClick: a,
|
|
993
993
|
disabled: k,
|
|
994
994
|
tabIndex: -1,
|
|
995
|
-
"aria-label":
|
|
995
|
+
"aria-label": i("减少"),
|
|
996
996
|
children: "−"
|
|
997
997
|
}
|
|
998
998
|
),
|
|
999
|
-
/* @__PURE__ */
|
|
999
|
+
/* @__PURE__ */ f(
|
|
1000
1000
|
"input",
|
|
1001
1001
|
{
|
|
1002
1002
|
className: "input number-input-field",
|
|
1003
1003
|
type: "text",
|
|
1004
1004
|
value: t,
|
|
1005
1005
|
onChange: (m) => {
|
|
1006
|
-
const
|
|
1007
|
-
isNaN(
|
|
1006
|
+
const u = Number(m.target.value);
|
|
1007
|
+
isNaN(u) || n(d(u));
|
|
1008
1008
|
},
|
|
1009
1009
|
style: { width: 56, textAlign: "center" }
|
|
1010
1010
|
}
|
|
1011
1011
|
),
|
|
1012
|
-
|
|
1013
|
-
/* @__PURE__ */
|
|
1012
|
+
s ? /* @__PURE__ */ f("span", { className: "number-input-unit", children: s }) : null,
|
|
1013
|
+
/* @__PURE__ */ f(
|
|
1014
1014
|
"button",
|
|
1015
1015
|
{
|
|
1016
1016
|
className: "number-input-btn",
|
|
1017
|
-
onClick:
|
|
1017
|
+
onClick: l,
|
|
1018
1018
|
disabled: v,
|
|
1019
1019
|
tabIndex: -1,
|
|
1020
|
-
"aria-label":
|
|
1020
|
+
"aria-label": i("增加"),
|
|
1021
1021
|
children: "+"
|
|
1022
1022
|
}
|
|
1023
1023
|
)
|
|
1024
1024
|
] });
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1027
|
-
const
|
|
1028
|
-
var
|
|
1029
|
-
if (!["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(
|
|
1030
|
-
|
|
1031
|
-
const
|
|
1032
|
-
(
|
|
1026
|
+
function St({ options: t, value: n, onChange: e, ariaLabel: r }) {
|
|
1027
|
+
const o = F([]), s = (c, i) => {
|
|
1028
|
+
var l;
|
|
1029
|
+
if (!["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(c.key)) return;
|
|
1030
|
+
c.preventDefault();
|
|
1031
|
+
const d = c.key === "ArrowRight" || c.key === "ArrowDown" ? 1 : -1, a = (i + d + t.length) % t.length;
|
|
1032
|
+
(l = o.current[a]) == null || l.focus(), e(t[a].value);
|
|
1033
1033
|
};
|
|
1034
|
-
return /* @__PURE__ */
|
|
1035
|
-
const
|
|
1036
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ f("div", { className: "segmented-radio", role: "radiogroup", "aria-label": r, children: t.map((c, i) => {
|
|
1035
|
+
const d = n === c.value;
|
|
1036
|
+
return /* @__PURE__ */ H(
|
|
1037
1037
|
"button",
|
|
1038
1038
|
{
|
|
1039
1039
|
type: "button",
|
|
1040
|
-
ref: (
|
|
1041
|
-
|
|
1040
|
+
ref: (a) => {
|
|
1041
|
+
o.current[i] = a;
|
|
1042
1042
|
},
|
|
1043
1043
|
role: "radio",
|
|
1044
|
-
"aria-checked":
|
|
1045
|
-
tabIndex:
|
|
1046
|
-
className: `segmented-radio__option${
|
|
1047
|
-
title:
|
|
1048
|
-
onClick: () => e(
|
|
1049
|
-
onKeyDown: (
|
|
1044
|
+
"aria-checked": d,
|
|
1045
|
+
tabIndex: d ? 0 : -1,
|
|
1046
|
+
className: `segmented-radio__option${d ? " is-selected" : ""}`,
|
|
1047
|
+
title: c.title ?? c.label,
|
|
1048
|
+
onClick: () => e(c.value),
|
|
1049
|
+
onKeyDown: (a) => s(a, i),
|
|
1050
1050
|
children: [
|
|
1051
|
-
|
|
1052
|
-
/* @__PURE__ */
|
|
1051
|
+
c.preview,
|
|
1052
|
+
/* @__PURE__ */ f("span", { className: "segmented-radio__label", children: c.label })
|
|
1053
1053
|
]
|
|
1054
1054
|
},
|
|
1055
|
-
|
|
1055
|
+
c.value
|
|
1056
1056
|
);
|
|
1057
1057
|
}) });
|
|
1058
1058
|
}
|
|
1059
|
-
function Tt({ value: t, onChange: n, min: e = 0, max:
|
|
1060
|
-
const
|
|
1061
|
-
return /* @__PURE__ */
|
|
1059
|
+
function Tt({ value: t, onChange: n, min: e = 0, max: r = 100, step: o = 1, ariaLabel: s, disabled: c, style: i }) {
|
|
1060
|
+
const d = (l) => Math.min(r, Math.max(e, l)), a = r > e ? (d(t) - e) / (r - e) * 100 : 0;
|
|
1061
|
+
return /* @__PURE__ */ f(
|
|
1062
1062
|
"input",
|
|
1063
1063
|
{
|
|
1064
1064
|
type: "range",
|
|
1065
1065
|
className: "slider",
|
|
1066
|
-
value:
|
|
1066
|
+
value: d(t),
|
|
1067
1067
|
min: e,
|
|
1068
|
-
max:
|
|
1069
|
-
step:
|
|
1070
|
-
disabled:
|
|
1071
|
-
"aria-label":
|
|
1072
|
-
onChange: (
|
|
1073
|
-
style: { ...
|
|
1068
|
+
max: r,
|
|
1069
|
+
step: o,
|
|
1070
|
+
disabled: c,
|
|
1071
|
+
"aria-label": s,
|
|
1072
|
+
onChange: (l) => n(Number(l.target.value)),
|
|
1073
|
+
style: { ...i, "--slider-pct": `${a}%` }
|
|
1074
1074
|
}
|
|
1075
1075
|
);
|
|
1076
1076
|
}
|
|
1077
1077
|
const Oe = 6, Ve = "color-mix(in srgb, var(--text-secondary) 45%, transparent)";
|
|
1078
1078
|
function Pt({ value: t, onChange: n }) {
|
|
1079
|
-
const { t: e } = j(), [
|
|
1079
|
+
const { t: e } = j(), [r, o] = P([]), [s, c] = P(0), i = F([]), d = K((l) => {
|
|
1080
1080
|
var v, m;
|
|
1081
1081
|
const k = (m = (v = window.linkdesk) == null ? void 0 : v.theme) == null ? void 0 : m.listRecipes;
|
|
1082
|
-
k && k().then((
|
|
1083
|
-
|
|
1082
|
+
k && k().then((u) => {
|
|
1083
|
+
l && !l() || o(u ?? []);
|
|
1084
1084
|
}).catch(() => {
|
|
1085
1085
|
});
|
|
1086
1086
|
}, []);
|
|
1087
1087
|
R(() => {
|
|
1088
|
-
var m,
|
|
1089
|
-
let
|
|
1090
|
-
|
|
1091
|
-
const v = (x = (
|
|
1092
|
-
|
|
1088
|
+
var m, u, x;
|
|
1089
|
+
let l = !1;
|
|
1090
|
+
d(() => !l);
|
|
1091
|
+
const v = (x = (u = (m = window.linkdesk) == null ? void 0 : m.configuration) == null ? void 0 : u.onPluginLifecycleChange) == null ? void 0 : x.call(u, () => {
|
|
1092
|
+
d();
|
|
1093
1093
|
});
|
|
1094
1094
|
return () => {
|
|
1095
|
-
|
|
1095
|
+
l = !0, v == null || v();
|
|
1096
1096
|
};
|
|
1097
|
-
}, [
|
|
1098
|
-
const
|
|
1097
|
+
}, [d]);
|
|
1098
|
+
const a = (l) => {
|
|
1099
1099
|
var m;
|
|
1100
|
-
const k =
|
|
1100
|
+
const k = r.length;
|
|
1101
1101
|
if (k === 0) return;
|
|
1102
|
-
let v =
|
|
1103
|
-
switch (
|
|
1102
|
+
let v = s;
|
|
1103
|
+
switch (l.key) {
|
|
1104
1104
|
case "ArrowRight":
|
|
1105
1105
|
case "ArrowDown":
|
|
1106
|
-
v = Math.min(
|
|
1106
|
+
v = Math.min(s + 1, k - 1);
|
|
1107
1107
|
break;
|
|
1108
1108
|
case "ArrowLeft":
|
|
1109
1109
|
case "ArrowUp":
|
|
1110
|
-
v = Math.max(
|
|
1110
|
+
v = Math.max(s - 1, 0);
|
|
1111
1111
|
break;
|
|
1112
1112
|
case "Home":
|
|
1113
1113
|
v = 0;
|
|
@@ -1118,44 +1118,44 @@ function Pt({ value: t, onChange: n }) {
|
|
|
1118
1118
|
default:
|
|
1119
1119
|
return;
|
|
1120
1120
|
}
|
|
1121
|
-
|
|
1121
|
+
l.preventDefault(), c(v), (m = i.current[v]) == null || m.focus();
|
|
1122
1122
|
};
|
|
1123
|
-
return
|
|
1123
|
+
return r.length === 0 ? /* @__PURE__ */ f("span", { className: "theme-picker-empty", children: e("无可用主题配方") }) : /* @__PURE__ */ f(
|
|
1124
1124
|
"div",
|
|
1125
1125
|
{
|
|
1126
1126
|
className: "theme-picker",
|
|
1127
1127
|
role: "group",
|
|
1128
1128
|
"aria-label": e("主题配方"),
|
|
1129
|
-
onKeyDown:
|
|
1130
|
-
children:
|
|
1131
|
-
var D
|
|
1132
|
-
const v =
|
|
1133
|
-
return /* @__PURE__ */
|
|
1129
|
+
onKeyDown: a,
|
|
1130
|
+
children: r.map((l, k) => {
|
|
1131
|
+
var $, D;
|
|
1132
|
+
const v = l.colorways.length <= 1, m = ($ = l.colorways[0]) == null ? void 0 : $.preview, u = (m == null ? void 0 : m.accent) || Ve, x = l.id === t;
|
|
1133
|
+
return /* @__PURE__ */ H(
|
|
1134
1134
|
"button",
|
|
1135
1135
|
{
|
|
1136
1136
|
ref: (A) => {
|
|
1137
|
-
|
|
1137
|
+
i.current[k] = A;
|
|
1138
1138
|
},
|
|
1139
1139
|
type: "button",
|
|
1140
1140
|
className: `theme-card${x ? " active" : ""}`,
|
|
1141
|
-
tabIndex:
|
|
1142
|
-
"aria-label":
|
|
1141
|
+
tabIndex: s === k ? 0 : -1,
|
|
1142
|
+
"aria-label": l.name,
|
|
1143
1143
|
"aria-pressed": x,
|
|
1144
|
-
onClick: () => n(
|
|
1145
|
-
onFocus: () =>
|
|
1144
|
+
onClick: () => n(l.id),
|
|
1145
|
+
onFocus: () => c(k),
|
|
1146
1146
|
children: [
|
|
1147
|
-
/* @__PURE__ */
|
|
1147
|
+
/* @__PURE__ */ f("div", { className: "theme-preview", style: m != null && m.bgWindow ? { background: m.bgWindow } : void 0, children: v ? (
|
|
1148
1148
|
// 单配色配方——3 条强调色预览条(mockup .pv-bar)
|
|
1149
|
-
/* @__PURE__ */
|
|
1150
|
-
/* @__PURE__ */
|
|
1151
|
-
/* @__PURE__ */
|
|
1152
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ H(xe, { children: [
|
|
1150
|
+
/* @__PURE__ */ f("span", { className: "pv-bar", style: { background: u } }),
|
|
1151
|
+
/* @__PURE__ */ f("span", { className: "pv-bar", style: { background: u } }),
|
|
1152
|
+
/* @__PURE__ */ f("span", { className: "pv-bar", style: { background: u } })
|
|
1153
1153
|
] })
|
|
1154
1154
|
) : (
|
|
1155
1155
|
// 多配色配方——配色圆点色板(mockup .pv-dot)
|
|
1156
|
-
/* @__PURE__ */
|
|
1156
|
+
/* @__PURE__ */ f("span", { className: "pv-dots", children: l.colorways.slice(0, Oe).map((A) => {
|
|
1157
1157
|
var _;
|
|
1158
|
-
return /* @__PURE__ */
|
|
1158
|
+
return /* @__PURE__ */ f(
|
|
1159
1159
|
"span",
|
|
1160
1160
|
{
|
|
1161
1161
|
className: "pv-dot",
|
|
@@ -1165,20 +1165,20 @@ function Pt({ value: t, onChange: n }) {
|
|
|
1165
1165
|
);
|
|
1166
1166
|
}) })
|
|
1167
1167
|
) }),
|
|
1168
|
-
/* @__PURE__ */
|
|
1169
|
-
/* @__PURE__ */
|
|
1170
|
-
/* @__PURE__ */
|
|
1168
|
+
/* @__PURE__ */ H("div", { className: "tname", children: [
|
|
1169
|
+
/* @__PURE__ */ f("span", { className: "tname-name", children: l.name }),
|
|
1170
|
+
/* @__PURE__ */ f("span", { className: "badge", children: v ? ((D = l.colorways[0]) == null ? void 0 : D.name) ?? "" : e("{{count}} 配色", { count: l.colorways.length }) })
|
|
1171
1171
|
] })
|
|
1172
1172
|
]
|
|
1173
1173
|
},
|
|
1174
|
-
|
|
1174
|
+
l.id
|
|
1175
1175
|
);
|
|
1176
1176
|
})
|
|
1177
1177
|
}
|
|
1178
1178
|
);
|
|
1179
1179
|
}
|
|
1180
1180
|
function Ft({ checked: t, onChange: n, disabled: e }) {
|
|
1181
|
-
return /* @__PURE__ */
|
|
1181
|
+
return /* @__PURE__ */ f(
|
|
1182
1182
|
"div",
|
|
1183
1183
|
{
|
|
1184
1184
|
className: `toggle${t ? " on" : ""}${e ? " disabled" : ""}`,
|
|
@@ -1193,91 +1193,91 @@ function Ft({ checked: t, onChange: n, disabled: e }) {
|
|
|
1193
1193
|
function G() {
|
|
1194
1194
|
return window.linkdesk;
|
|
1195
1195
|
}
|
|
1196
|
-
const Ht =
|
|
1196
|
+
const Ht = ce(function({
|
|
1197
1197
|
size: n,
|
|
1198
1198
|
value: e,
|
|
1199
|
-
onConfirm:
|
|
1200
|
-
onCancel:
|
|
1201
|
-
onChange:
|
|
1202
|
-
selectMode:
|
|
1203
|
-
width:
|
|
1204
|
-
autoFocus:
|
|
1205
|
-
placeholder:
|
|
1206
|
-
type:
|
|
1199
|
+
onConfirm: r,
|
|
1200
|
+
onCancel: o,
|
|
1201
|
+
onChange: s,
|
|
1202
|
+
selectMode: c = "all",
|
|
1203
|
+
width: i,
|
|
1204
|
+
autoFocus: d,
|
|
1205
|
+
placeholder: a,
|
|
1206
|
+
type: l = "text",
|
|
1207
1207
|
min: k,
|
|
1208
1208
|
max: v
|
|
1209
1209
|
}, m) {
|
|
1210
|
-
const
|
|
1210
|
+
const u = F(null), [x, $] = P(e), [D, A] = P(!0);
|
|
1211
1211
|
Me(m, () => ({
|
|
1212
1212
|
getValue: () => x
|
|
1213
1213
|
}), [x]), R(() => {
|
|
1214
|
-
if (!
|
|
1215
|
-
|
|
1216
|
-
if (
|
|
1217
|
-
if (
|
|
1214
|
+
if (!d || !u.current) return;
|
|
1215
|
+
u.current.focus(), requestAnimationFrame(() => {
|
|
1216
|
+
if (u.current)
|
|
1217
|
+
if (c === "nameOnly") {
|
|
1218
1218
|
const g = e.lastIndexOf(".");
|
|
1219
|
-
g > 0 ?
|
|
1219
|
+
g > 0 ? u.current.setSelectionRange(0, g) : u.current.select();
|
|
1220
1220
|
} else
|
|
1221
|
-
|
|
1221
|
+
u.current.select();
|
|
1222
1222
|
});
|
|
1223
|
-
}, [
|
|
1223
|
+
}, [d]), R(() => {
|
|
1224
1224
|
var M, g;
|
|
1225
|
-
if (
|
|
1225
|
+
if (!D) {
|
|
1226
1226
|
(g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !1);
|
|
1227
1227
|
const b = requestAnimationFrame(() => {
|
|
1228
|
-
var
|
|
1229
|
-
(p = (
|
|
1228
|
+
var h, p;
|
|
1229
|
+
(p = (h = G().keybindings) == null ? void 0 : h.setKeybindingCaptureActive) == null || p.call(h, !1);
|
|
1230
1230
|
});
|
|
1231
1231
|
return () => cancelAnimationFrame(b);
|
|
1232
1232
|
}
|
|
1233
|
-
}, [
|
|
1234
|
-
var M, g, b,
|
|
1235
|
-
(g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !1), (
|
|
1233
|
+
}, [D]), R(() => () => {
|
|
1234
|
+
var M, g, b, h;
|
|
1235
|
+
(g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !1), (h = (b = G().keybindings) == null ? void 0 : b.setKeybindingCaptureActive) == null || h.call(b, !1);
|
|
1236
1236
|
}, []);
|
|
1237
1237
|
const _ = (M) => {
|
|
1238
|
-
M.key === "Enter" ? (M.preventDefault(), A(!1),
|
|
1238
|
+
M.key === "Enter" ? (M.preventDefault(), A(!1), r(x)) : M.key === "Escape" && (M.preventDefault(), A(!1), o()), M.stopPropagation();
|
|
1239
1239
|
}, I = () => {
|
|
1240
|
-
|
|
1240
|
+
D && (A(!1), r(x));
|
|
1241
1241
|
}, S = () => {
|
|
1242
|
-
var M, g, b,
|
|
1243
|
-
(g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !0), (
|
|
1242
|
+
var M, g, b, h;
|
|
1243
|
+
(g = (M = G().contextKey) == null ? void 0 : M.set) == null || g.call(M, "inputFocus", !0), (h = (b = G().keybindings) == null ? void 0 : b.setKeybindingCaptureActive) == null || h.call(b, !0);
|
|
1244
1244
|
};
|
|
1245
|
-
return /* @__PURE__ */
|
|
1245
|
+
return /* @__PURE__ */ f(
|
|
1246
1246
|
"input",
|
|
1247
1247
|
{
|
|
1248
|
-
ref:
|
|
1248
|
+
ref: u,
|
|
1249
1249
|
className: `inline-input inline-input--${n}`,
|
|
1250
|
-
type:
|
|
1250
|
+
type: l,
|
|
1251
1251
|
value: x,
|
|
1252
1252
|
onChange: (M) => {
|
|
1253
|
-
const g =
|
|
1254
|
-
|
|
1253
|
+
const g = l === "number" ? M.target.value.replace(/\D/g, "") : M.target.value;
|
|
1254
|
+
$(g), s == null || s(g);
|
|
1255
1255
|
},
|
|
1256
1256
|
onKeyDown: _,
|
|
1257
1257
|
onBlur: I,
|
|
1258
1258
|
onFocus: S,
|
|
1259
1259
|
onDragStart: (M) => M.preventDefault(),
|
|
1260
|
-
placeholder:
|
|
1260
|
+
placeholder: a,
|
|
1261
1261
|
min: k,
|
|
1262
1262
|
max: v,
|
|
1263
|
-
style:
|
|
1263
|
+
style: i ? { width: i } : void 0,
|
|
1264
1264
|
autoComplete: "off",
|
|
1265
1265
|
spellCheck: !1
|
|
1266
1266
|
}
|
|
1267
1267
|
);
|
|
1268
1268
|
});
|
|
1269
1269
|
function ze(t, n) {
|
|
1270
|
-
const e = n.icon,
|
|
1271
|
-
if (
|
|
1270
|
+
const e = n.icon, r = n.iconSource;
|
|
1271
|
+
if (r === "lucide" && e)
|
|
1272
1272
|
return { lucide: e };
|
|
1273
|
-
if (
|
|
1273
|
+
if (r === "codicon" && e)
|
|
1274
1274
|
return { codicon: `codicon-${e}` };
|
|
1275
|
-
if (e && (
|
|
1275
|
+
if (e && (r === "svg" || r === "url"))
|
|
1276
1276
|
return { src: e };
|
|
1277
1277
|
if (e) {
|
|
1278
1278
|
if (e.includes("/") || e.includes(".")) {
|
|
1279
|
-
const
|
|
1280
|
-
return { src: `linkdesk://${t}/${
|
|
1279
|
+
const o = e.includes(".") ? e : `${e}.png`;
|
|
1280
|
+
return { src: `linkdesk://${t}/${o}` };
|
|
1281
1281
|
}
|
|
1282
1282
|
return { codicon: `codicon-${e}` };
|
|
1283
1283
|
}
|
|
@@ -1289,7 +1289,7 @@ function ze(t, n) {
|
|
|
1289
1289
|
* This source code is licensed under the ISC license.
|
|
1290
1290
|
* See the LICENSE file in the root directory of this source tree.
|
|
1291
1291
|
*/
|
|
1292
|
-
const ke = (...t) => t.filter((n, e,
|
|
1292
|
+
const ke = (...t) => t.filter((n, e, r) => !!n && n.trim() !== "" && r.indexOf(n) === e).join(" ").trim();
|
|
1293
1293
|
/**
|
|
1294
1294
|
* @license lucide-react v1.29.0 - ISC
|
|
1295
1295
|
*
|
|
@@ -1305,7 +1305,7 @@ const Ue = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
|
1305
1305
|
*/
|
|
1306
1306
|
const je = (t) => t.replace(
|
|
1307
1307
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
1308
|
-
(n, e,
|
|
1308
|
+
(n, e, r) => r ? r.toUpperCase() : e.toLowerCase()
|
|
1309
1309
|
);
|
|
1310
1310
|
/**
|
|
1311
1311
|
* @license lucide-react v1.29.0 - ISC
|
|
@@ -1345,31 +1345,31 @@ const qe = (t) => {
|
|
|
1345
1345
|
if (n.startsWith("aria-") || n === "role" || n === "title")
|
|
1346
1346
|
return !0;
|
|
1347
1347
|
return !1;
|
|
1348
|
-
}, Ge =
|
|
1349
|
-
({ color: t, size: n, strokeWidth: e, absoluteStrokeWidth:
|
|
1348
|
+
}, Ge = Ce({}), Ze = () => Ne(Ge), Xe = ce(
|
|
1349
|
+
({ color: t, size: n, strokeWidth: e, absoluteStrokeWidth: r, className: o = "", children: s, iconNode: c, ...i }, d) => {
|
|
1350
1350
|
const {
|
|
1351
|
-
size:
|
|
1352
|
-
strokeWidth:
|
|
1351
|
+
size: a = 24,
|
|
1352
|
+
strokeWidth: l = 2,
|
|
1353
1353
|
absoluteStrokeWidth: k = !1,
|
|
1354
1354
|
color: v = "currentColor",
|
|
1355
1355
|
className: m = ""
|
|
1356
|
-
} = Ze() ?? {},
|
|
1357
|
-
return
|
|
1356
|
+
} = Ze() ?? {}, u = r ?? k ? Number(e ?? l) * 24 / Number(n ?? a) : e ?? l;
|
|
1357
|
+
return re(
|
|
1358
1358
|
"svg",
|
|
1359
1359
|
{
|
|
1360
|
-
ref:
|
|
1360
|
+
ref: d,
|
|
1361
1361
|
...ne,
|
|
1362
|
-
width: n ??
|
|
1363
|
-
height: n ??
|
|
1362
|
+
width: n ?? a ?? ne.width,
|
|
1363
|
+
height: n ?? a ?? ne.height,
|
|
1364
1364
|
stroke: t ?? v,
|
|
1365
|
-
strokeWidth:
|
|
1366
|
-
className: ke("lucide", m,
|
|
1367
|
-
...!
|
|
1368
|
-
...
|
|
1365
|
+
strokeWidth: u,
|
|
1366
|
+
className: ke("lucide", m, o),
|
|
1367
|
+
...!s && !qe(i) && { "aria-hidden": "true" },
|
|
1368
|
+
...i
|
|
1369
1369
|
},
|
|
1370
1370
|
[
|
|
1371
|
-
...
|
|
1372
|
-
...Array.isArray(
|
|
1371
|
+
...c.map(([x, $]) => re(x, $)),
|
|
1372
|
+
...Array.isArray(s) ? s : [s]
|
|
1373
1373
|
]
|
|
1374
1374
|
);
|
|
1375
1375
|
}
|
|
@@ -1381,16 +1381,16 @@ const qe = (t) => {
|
|
|
1381
1381
|
* See the LICENSE file in the root directory of this source tree.
|
|
1382
1382
|
*/
|
|
1383
1383
|
const O = (t, n) => {
|
|
1384
|
-
const e =
|
|
1385
|
-
({ className:
|
|
1386
|
-
ref:
|
|
1384
|
+
const e = ce(
|
|
1385
|
+
({ className: r, ...o }, s) => re(Xe, {
|
|
1386
|
+
ref: s,
|
|
1387
1387
|
iconNode: n,
|
|
1388
1388
|
className: ke(
|
|
1389
1389
|
`lucide-${Ue(me(t))}`,
|
|
1390
1390
|
`lucide-${t}`,
|
|
1391
|
-
|
|
1391
|
+
r
|
|
1392
1392
|
),
|
|
1393
|
-
...
|
|
1393
|
+
...o
|
|
1394
1394
|
})
|
|
1395
1395
|
);
|
|
1396
1396
|
return e.displayName = me(t), e;
|
|
@@ -1445,7 +1445,7 @@ const tt = [
|
|
|
1445
1445
|
* This source code is licensed under the ISC license.
|
|
1446
1446
|
* See the LICENSE file in the root directory of this source tree.
|
|
1447
1447
|
*/
|
|
1448
|
-
const
|
|
1448
|
+
const rt = [
|
|
1449
1449
|
[
|
|
1450
1450
|
"path",
|
|
1451
1451
|
{
|
|
@@ -1453,14 +1453,14 @@ const ot = [
|
|
|
1453
1453
|
key: "usdka0"
|
|
1454
1454
|
}
|
|
1455
1455
|
]
|
|
1456
|
-
],
|
|
1456
|
+
], ot = O("folder-open", rt);
|
|
1457
1457
|
/**
|
|
1458
1458
|
* @license lucide-react v1.29.0 - ISC
|
|
1459
1459
|
*
|
|
1460
1460
|
* This source code is licensed under the ISC license.
|
|
1461
1461
|
* See the LICENSE file in the root directory of this source tree.
|
|
1462
1462
|
*/
|
|
1463
|
-
const
|
|
1463
|
+
const ct = [
|
|
1464
1464
|
[
|
|
1465
1465
|
"path",
|
|
1466
1466
|
{
|
|
@@ -1477,7 +1477,7 @@ const st = [
|
|
|
1477
1477
|
],
|
|
1478
1478
|
["path", { d: "M3 5a2 2 0 0 0 2 2h3", key: "f2jnh7" }],
|
|
1479
1479
|
["path", { d: "M3 3v13a2 2 0 0 0 2 2h3", key: "k8epm1" }]
|
|
1480
|
-
],
|
|
1480
|
+
], st = O("folder-tree", ct);
|
|
1481
1481
|
/**
|
|
1482
1482
|
* @license lucide-react v1.29.0 - ISC
|
|
1483
1483
|
*
|
|
@@ -1584,8 +1584,8 @@ const gt = [
|
|
|
1584
1584
|
], bt = O("shopping-bag", gt), kt = {
|
|
1585
1585
|
File: nt,
|
|
1586
1586
|
Folder: at,
|
|
1587
|
-
FolderOpen:
|
|
1588
|
-
FolderTree:
|
|
1587
|
+
FolderOpen: ot,
|
|
1588
|
+
FolderTree: st,
|
|
1589
1589
|
Package: wt,
|
|
1590
1590
|
ShoppingBag: bt,
|
|
1591
1591
|
Monitor: mt,
|
|
@@ -1595,35 +1595,76 @@ const gt = [
|
|
|
1595
1595
|
Lightbulb: ut,
|
|
1596
1596
|
Lock: ft
|
|
1597
1597
|
}, pe = "📄";
|
|
1598
|
-
function Kt({ pluginId: t, manifest: n, className: e, alt:
|
|
1599
|
-
const
|
|
1600
|
-
if (
|
|
1601
|
-
const
|
|
1602
|
-
if (
|
|
1603
|
-
return /* @__PURE__ */
|
|
1598
|
+
function Kt({ pluginId: t, manifest: n, className: e, alt: r = "" }) {
|
|
1599
|
+
const o = n ? ze(t, n) : { emoji: pe };
|
|
1600
|
+
if (o.lucide) {
|
|
1601
|
+
const s = kt[o.lucide];
|
|
1602
|
+
if (s)
|
|
1603
|
+
return /* @__PURE__ */ f(s, { className: `plugin-icon plugin-icon--lucide ${e ?? ""}` });
|
|
1604
1604
|
}
|
|
1605
|
-
return
|
|
1605
|
+
return o.codicon ? /* @__PURE__ */ f("span", { className: `codicon ${o.codicon} plugin-icon plugin-icon--codicon ${e ?? ""}` }) : o.src ? /* @__PURE__ */ f("img", { src: o.src, alt: r, className: `plugin-icon plugin-icon--img ${e ?? ""}`, draggable: !1 }) : /* @__PURE__ */ f("span", { className: `plugin-icon plugin-icon--emoji ${e ?? ""}`, children: o.emoji ?? pe });
|
|
1606
|
+
}
|
|
1607
|
+
function Wt({ onPreview: t, onPin: n, disabled: e, delay: r = 250 }) {
|
|
1608
|
+
const o = F(null);
|
|
1609
|
+
R(() => () => {
|
|
1610
|
+
o.current && clearTimeout(o.current);
|
|
1611
|
+
}, []);
|
|
1612
|
+
const s = K((i) => {
|
|
1613
|
+
e || i.button !== void 0 && i.button !== 0 || (o.current ? (clearTimeout(o.current), o.current = null) : o.current = setTimeout(() => {
|
|
1614
|
+
o.current = null, t();
|
|
1615
|
+
}, r));
|
|
1616
|
+
}, [e, r, t]), c = K((i) => {
|
|
1617
|
+
e || i.button !== void 0 && i.button !== 0 || i.detail === 2 && (o.current && (clearTimeout(o.current), o.current = null), n());
|
|
1618
|
+
}, [e, n]);
|
|
1619
|
+
return { handleMouseDown: s, handleClick: c };
|
|
1620
|
+
}
|
|
1621
|
+
function Bt(t) {
|
|
1622
|
+
const n = F(t);
|
|
1623
|
+
return n.current = t, K((e) => {
|
|
1624
|
+
var o, s, c, i, d, a;
|
|
1625
|
+
if (!(e.ctrlKey || e.metaKey)) return !1;
|
|
1626
|
+
const r = e.key.toLowerCase();
|
|
1627
|
+
return r !== "c" && r !== "x" && r !== "v" ? !1 : (e.preventDefault(), r === "c" ? (s = (o = n.current).onCopy) == null || s.call(o) : r === "x" ? (i = (c = n.current).onCut) == null || i.call(c) : (a = (d = n.current).onPaste) == null || a.call(d), !0);
|
|
1628
|
+
}, []);
|
|
1629
|
+
}
|
|
1630
|
+
function Ot(t, n = 150) {
|
|
1631
|
+
const [e, r] = P(""), o = F(null), s = K(
|
|
1632
|
+
(i) => {
|
|
1633
|
+
r(i), o.current && clearTimeout(o.current), o.current = setTimeout(() => {
|
|
1634
|
+
t(i);
|
|
1635
|
+
}, n);
|
|
1636
|
+
},
|
|
1637
|
+
[t, n]
|
|
1638
|
+
), c = K(() => {
|
|
1639
|
+
o.current && clearTimeout(o.current), r(""), t("");
|
|
1640
|
+
}, [t]);
|
|
1641
|
+
return R(() => () => {
|
|
1642
|
+
o.current && clearTimeout(o.current);
|
|
1643
|
+
}, []), { value: e, onChange: s, onClear: c };
|
|
1606
1644
|
}
|
|
1607
|
-
function
|
|
1645
|
+
function Vt(t, n) {
|
|
1608
1646
|
const e = n - t;
|
|
1609
1647
|
return !Number.isInteger(t) || !Number.isInteger(n) || e <= 2 ? 0.01 : 1;
|
|
1610
1648
|
}
|
|
1611
1649
|
export {
|
|
1612
|
-
|
|
1650
|
+
Ee as Button,
|
|
1613
1651
|
At as ColorPicker,
|
|
1614
|
-
|
|
1652
|
+
Et as Combobox,
|
|
1615
1653
|
It as ContextMenu,
|
|
1616
1654
|
Lt as DynamicSelect,
|
|
1617
1655
|
_t as FilePathInput,
|
|
1618
|
-
|
|
1619
|
-
|
|
1656
|
+
Dt as FontFamilySelect,
|
|
1657
|
+
$t as FormRow,
|
|
1620
1658
|
Ht as InlineInput,
|
|
1621
|
-
|
|
1659
|
+
Rt as NumberInput,
|
|
1622
1660
|
Kt as PluginIcon,
|
|
1623
|
-
|
|
1661
|
+
St as SegmentedRadio,
|
|
1624
1662
|
ge as SelectBox,
|
|
1625
1663
|
Tt as Slider,
|
|
1626
1664
|
Pt as ThemePicker,
|
|
1627
1665
|
Ft as Toggle,
|
|
1628
|
-
|
|
1666
|
+
Vt as inferSliderStep,
|
|
1667
|
+
Wt as useClickPreview,
|
|
1668
|
+
Bt as useClipboardKeys,
|
|
1669
|
+
Ot as useDebouncedInput
|
|
1629
1670
|
};
|