@code0-tech/pictor 1.1.3 → 1.1.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
.input-wrapper{z-index:1;box-sizing:border-box;color:#ffffffbf;background:#201e2c;border:none;align-items:start;gap:.14075rem;width:100%;display:flex;position:relative;box-shadow:inset 0 1px 1px #ffffff1a}.input-wrapper:hover{background:#bfbfbf26;box-shadow:inset 0 1px 1px #ffffff1a}.input-wrapper:active,.input-wrapper:focus,.input-wrapper[aria-selected=true],.input-wrapper[data-state=open]{background:#bfbfbf33;outline:none;box-shadow:inset 0 1px 1px #ffffff1a}.input-wrapper{letter-spacing:-.5px;border-radius:1rem;font-family:Inter,sans-serif;font-weight:400}.input-wrapper:has(.input-wrapper__control:focus){background:#bfbfbf33;outline:none;box-shadow:inset 0 1px 1px #ffffff1a}.input-wrapper--not-valid{color:#ffffffbf;box-sizing:border-box;background:#1c0516;border:none;position:relative;box-shadow:inset 0 1px 1px #d904291a}.input-wrapper:disabled,.input-wrapper[data-disabled],.input-wrapper[aria-disabled=true],.input-wrapper--disabled{cursor:not-allowed;opacity:.25;pointer-events:none}.input-wrapper:disabled *,.input-wrapper[data-disabled] *,.input-wrapper[aria-disabled=true] *,.input-wrapper--disabled *{pointer-events:none}:is(.input-wrapper:has(.input-wrapper__control:disabled),.input-wrapper:has([data-disabled])){cursor:not-allowed;opacity:.25;pointer-events:none}:is(.input-wrapper:has(.input-wrapper__control:disabled) *,.input-wrapper:has([data-disabled]) *){pointer-events:none}.input-wrapper>:first-child{padding-left:.563rem}.input-wrapper__left,.input-wrapper__right{justify-content:center;align-items:center;gap:.563rem;min-height:30px;margin:.14075rem;display:flex}.input-wrapper__left--action,.input-wrapper__right--action{padding:0}.input-wrapper__left--placeholder,.input-wrapper__right--placeholder{color:#ffffffbf;box-sizing:border-box;letter-spacing:-.5px;box-shadow:inset 0 1px 1px #bfbfbf1a;box-shadow:none;background:#070514;border:none;border-radius:.85925rem;padding:.563rem;font-family:Inter,sans-serif;font-weight:400;position:relative}.input-wrapper__left--icon,.input-wrapper__right--icon{align-items:center}
|
|
1
|
+
.input-wrapper{z-index:1;box-sizing:border-box;color:#ffffffbf;background:#201e2c;border:none;align-items:start;gap:.14075rem;width:100%;display:flex;position:relative;box-shadow:inset 0 1px 1px #ffffff1a}.input-wrapper:hover{background:#bfbfbf26;box-shadow:inset 0 1px 1px #ffffff1a}.input-wrapper:active,.input-wrapper:focus,.input-wrapper[aria-selected=true],.input-wrapper[data-state=open]{background:#bfbfbf33;outline:none;box-shadow:inset 0 1px 1px #ffffff1a}.input-wrapper{letter-spacing:-.5px;border-radius:1rem;font-family:Inter,sans-serif;font-weight:400}.input-wrapper:has(.input-wrapper__control:focus){background:#bfbfbf33;outline:none;box-shadow:inset 0 1px 1px #ffffff1a}.input-wrapper--not-valid{color:#ffffffbf;box-sizing:border-box;background:#1c0516;border:none;position:relative;box-shadow:inset 0 1px 1px #d904291a}.input-wrapper:disabled,.input-wrapper[data-disabled],.input-wrapper[aria-disabled=true],.input-wrapper--disabled{cursor:not-allowed;opacity:.25;pointer-events:none}.input-wrapper:disabled *,.input-wrapper[data-disabled] *,.input-wrapper[aria-disabled=true] *,.input-wrapper--disabled *{pointer-events:none}:is(.input-wrapper:has(.input-wrapper__control:disabled),.input-wrapper:has([data-disabled]:not([data-type=literal]))){cursor:not-allowed;opacity:.25;pointer-events:none}:is(.input-wrapper:has(.input-wrapper__control:disabled) *,.input-wrapper:has([data-disabled]:not([data-type=literal])) *){pointer-events:none}.input-wrapper>:first-child{padding-left:.563rem}.input-wrapper__left,.input-wrapper__right{justify-content:center;align-items:center;gap:.563rem;min-height:30px;margin:.14075rem;display:flex}.input-wrapper__left--action,.input-wrapper__right--action{padding:0}.input-wrapper__left--placeholder,.input-wrapper__right--placeholder{color:#ffffffbf;box-sizing:border-box;letter-spacing:-.5px;box-shadow:inset 0 1px 1px #bfbfbf1a;box-shadow:none;background:#070514;border:none;border-radius:.85925rem;padding:.563rem;font-family:Inter,sans-serif;font-weight:400;position:relative}.input-wrapper__left--icon,.input-wrapper__right--icon{align-items:center}
|
|
@@ -30,7 +30,7 @@ const DataTable = (c) => {
|
|
|
30
30
|
className: "data-table__row",
|
|
31
31
|
onClick: () => _?.(e),
|
|
32
32
|
children: C?.(e, r)
|
|
33
|
-
})), D.length === 0 && !m && g ? /* @__PURE__ */ jsx("tr", {
|
|
33
|
+
}, r)), D.length === 0 && !m && g ? /* @__PURE__ */ jsx("tr", {
|
|
34
34
|
className: "data-table__row",
|
|
35
35
|
onClick: () => _?.(void 0),
|
|
36
36
|
children: g
|
|
@@ -12,9 +12,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
import { IconChevronDown } from "@tabler/icons-react";
|
|
13
13
|
import { DateInput as DateInput$1, DatePicker } from "@ark-ui/react";
|
|
14
14
|
import { fromDate, getLocalTimeZone, toZoned } from "@internationalized/date";
|
|
15
|
-
var
|
|
15
|
+
var microsecondsPerMillisecond = 1e3, fromUnixMicroseconds = (e) => fromDate(new Date(e / microsecondsPerMillisecond), getLocalTimeZone()), toUnixMicroseconds = (e) => toZoned(e, getLocalTimeZone()).toDate().getTime() * microsecondsPerMillisecond, toDateValues = (e) => {
|
|
16
16
|
let f = Array.isArray(e) ? e : [e], p = [];
|
|
17
|
-
for (let e of f) e == null || e === "" || (typeof e == "number" ? Number.isNaN(e) || p.push(
|
|
17
|
+
for (let e of f) e == null || e === "" || (typeof e == "number" ? Number.isNaN(e) || p.push(fromUnixMicroseconds(e)) : p.push(e));
|
|
18
18
|
return p;
|
|
19
19
|
};
|
|
20
20
|
const DateInput = (f) => {
|
|
@@ -26,7 +26,7 @@ const DateInput = (f) => {
|
|
|
26
26
|
}, H = [T], p[4] = T, p[5] = V, p[6] = H), React.useEffect(V, H);
|
|
27
27
|
let [U, W] = React.useState(!1), G;
|
|
28
28
|
p[7] !== S || p[8] !== I ? (G = (e) => {
|
|
29
|
-
B(e.value), S?.setValue?.(e.value[0] ?
|
|
29
|
+
B(e.value), S?.setValue?.(e.value[0] ? toUnixMicroseconds(e.value[0]) : null), I?.(e);
|
|
30
30
|
}, p[7] = S, p[8] = I, p[9] = G) : G = p[9];
|
|
31
31
|
let K = G, q;
|
|
32
32
|
p[10] !== z || p[11] !== A || p[12] !== E || p[13] !== K || p[14] !== P || p[15] !== k || p[16] !== F || p[17] !== N ? (q = mergeComponentProps("date-input", {
|
|
@@ -44,25 +44,30 @@ var isTokenElement = (e) => e?.type === "token", lineToChildren = (e, t) => {
|
|
|
44
44
|
return e;
|
|
45
45
|
};
|
|
46
46
|
const EditorInput = (e) => {
|
|
47
|
-
let { title: r, right: i, left: a, rightType: o, leftType: s, description: l, wrapperComponent: u, tokenRules: d = [], onSelect: f, search:
|
|
47
|
+
let { title: r, right: i, left: a, rightType: o, leftType: s, description: l, wrapperComponent: u, tokenRules: d = [], onSelect: f, search: v, formValidation: b, onChange: x, disabled: S = !1, readonly: T = !1, singleLine: A = !1, placeholder: M, value: ne, initialValue: re, defaultValue: F, children: I } = e, L = String(ne ?? re ?? F ?? ""), R = A ? L.replace(/\n/g, " ") : L, z = useMemo(() => {
|
|
48
48
|
let e = withHistory(withReact(createEditor())), { isInline: t, isVoid: n } = e;
|
|
49
49
|
return e.isInline = (e) => isTokenElement(e) || t(e), e.isVoid = (e) => isTokenElement(e) || n(e), e;
|
|
50
|
-
}, []),
|
|
50
|
+
}, []), ie = useMemo(() => textToSlate(R, d), []), ae = useRef(R), [B, oe] = useState(R);
|
|
51
51
|
useEffect(() => {
|
|
52
|
-
if (
|
|
53
|
-
let e = textToSlate(
|
|
54
|
-
Editor.withoutNormalizing(
|
|
55
|
-
Transforms.deselect(
|
|
56
|
-
let t =
|
|
57
|
-
Transforms.insertNodes(
|
|
58
|
-
for (let n = 0; n < t; n++) Transforms.removeNodes(
|
|
52
|
+
if (R === ae.current || (ae.current = R, oe(R), slateToText(z.children) === R)) return;
|
|
53
|
+
let e = textToSlate(R, d), t = ReactEditor.isFocused(z);
|
|
54
|
+
Editor.withoutNormalizing(z, () => {
|
|
55
|
+
Transforms.deselect(z);
|
|
56
|
+
let t = z.children.length;
|
|
57
|
+
Transforms.insertNodes(z, e, { at: [0] });
|
|
58
|
+
for (let n = 0; n < t; n++) Transforms.removeNodes(z, { at: [e.length] });
|
|
59
59
|
});
|
|
60
60
|
try {
|
|
61
|
-
Transforms.select(
|
|
61
|
+
Transforms.select(z, Editor.end(z, []));
|
|
62
62
|
} catch {}
|
|
63
|
+
t && requestAnimationFrame(() => {
|
|
64
|
+
try {
|
|
65
|
+
ReactEditor.focus(z);
|
|
66
|
+
} catch {}
|
|
67
|
+
});
|
|
63
68
|
}, [
|
|
64
|
-
L,
|
|
65
69
|
R,
|
|
70
|
+
z,
|
|
66
71
|
d
|
|
67
72
|
]);
|
|
68
73
|
let [V, H] = useState(!1), [U, se] = useState("shortcut"), ce = useRef(U);
|
|
@@ -72,22 +77,22 @@ const EditorInput = (e) => {
|
|
|
72
77
|
if (!e || !t || !n) return;
|
|
73
78
|
let r = null;
|
|
74
79
|
try {
|
|
75
|
-
|
|
80
|
+
z.selection && (r = ReactEditor.toDOMRange(z, z.selection).getBoundingClientRect());
|
|
76
81
|
} catch {
|
|
77
82
|
r = null;
|
|
78
83
|
}
|
|
79
84
|
(!r || !r.width && !r.height && !r.left && !r.top) && (r = t.getBoundingClientRect());
|
|
80
85
|
let i = n.getBoundingClientRect();
|
|
81
86
|
e.style.left = `${r.left - i.left}px`, e.style.top = `${r.top - i.top}px`, e.style.width = "0px", e.style.height = `${r.height || parseFloat(getComputedStyle(t).lineHeight) || 16}px`;
|
|
82
|
-
}, [
|
|
87
|
+
}, [z]), de = b?.setValue, fe = useCallback((e) => {
|
|
83
88
|
V && G();
|
|
84
89
|
let t = slateToText(e);
|
|
85
|
-
t !==
|
|
90
|
+
t !== ae.current && (ae.current = t, oe(t), de?.(t), x?.(t));
|
|
86
91
|
}, [
|
|
87
92
|
V,
|
|
88
93
|
G,
|
|
89
94
|
de,
|
|
90
|
-
|
|
95
|
+
x
|
|
91
96
|
]), pe = useCallback(() => {
|
|
92
97
|
ue.current && (W.current && clearTimeout(W.current), G(), H(!0));
|
|
93
98
|
}, [G]);
|
|
@@ -95,7 +100,10 @@ const EditorInput = (e) => {
|
|
|
95
100
|
V && G();
|
|
96
101
|
}, [V, G]);
|
|
97
102
|
let me = useCallback(() => {
|
|
98
|
-
W.current && clearTimeout(W.current), W.current = setTimeout(() =>
|
|
103
|
+
W.current && clearTimeout(W.current), W.current = setTimeout(() => {
|
|
104
|
+
let e = le.current;
|
|
105
|
+
e && e.contains(document.activeElement) || H(!1);
|
|
106
|
+
}, 150);
|
|
99
107
|
}, []), he = useCallback(() => {
|
|
100
108
|
W.current && clearTimeout(W.current);
|
|
101
109
|
}, []), K = useRef(/* @__PURE__ */ new Map()), [ge, _e] = useState(null), q = useRef(null), J = useCallback((e) => {
|
|
@@ -181,14 +189,14 @@ const EditorInput = (e) => {
|
|
|
181
189
|
X
|
|
182
190
|
]), useEffect(() => $, [$]);
|
|
183
191
|
let Ne = useMemo(() => ({
|
|
184
|
-
editor:
|
|
192
|
+
editor: z,
|
|
185
193
|
tokenRules: d,
|
|
186
|
-
singleLine:
|
|
187
|
-
disabled:
|
|
188
|
-
readonly:
|
|
189
|
-
placeholder:
|
|
190
|
-
search:
|
|
191
|
-
documentText:
|
|
194
|
+
singleLine: A,
|
|
195
|
+
disabled: S,
|
|
196
|
+
readonly: T,
|
|
197
|
+
placeholder: M,
|
|
198
|
+
search: v,
|
|
199
|
+
documentText: B,
|
|
192
200
|
open: V,
|
|
193
201
|
setOpen: H,
|
|
194
202
|
openMenu: pe,
|
|
@@ -214,14 +222,14 @@ const EditorInput = (e) => {
|
|
|
214
222
|
cancelHoverSub: $,
|
|
215
223
|
openActiveSub: Me
|
|
216
224
|
}), [
|
|
217
|
-
R,
|
|
218
|
-
d,
|
|
219
|
-
k,
|
|
220
|
-
x,
|
|
221
|
-
w,
|
|
222
|
-
j,
|
|
223
|
-
_,
|
|
224
225
|
z,
|
|
226
|
+
d,
|
|
227
|
+
A,
|
|
228
|
+
S,
|
|
229
|
+
T,
|
|
230
|
+
M,
|
|
231
|
+
v,
|
|
232
|
+
B,
|
|
225
233
|
V,
|
|
226
234
|
pe,
|
|
227
235
|
U,
|
|
@@ -244,8 +252,8 @@ const EditorInput = (e) => {
|
|
|
244
252
|
Me
|
|
245
253
|
]);
|
|
246
254
|
return /* @__PURE__ */ jsx(Slate, {
|
|
247
|
-
editor:
|
|
248
|
-
initialValue:
|
|
255
|
+
editor: z,
|
|
256
|
+
initialValue: ie,
|
|
249
257
|
onChange: fe,
|
|
250
258
|
children: /* @__PURE__ */ jsx(EditorInputContext.Provider, {
|
|
251
259
|
value: Ne,
|
|
@@ -260,24 +268,24 @@ const EditorInput = (e) => {
|
|
|
260
268
|
left: a,
|
|
261
269
|
rightType: o,
|
|
262
270
|
leftType: s,
|
|
263
|
-
formValidation:
|
|
271
|
+
formValidation: b,
|
|
264
272
|
...u ?? {},
|
|
265
273
|
style: {
|
|
266
274
|
position: "relative",
|
|
267
275
|
...u?.style
|
|
268
276
|
},
|
|
269
|
-
children:
|
|
277
|
+
children: I
|
|
270
278
|
})
|
|
271
279
|
})
|
|
272
280
|
})
|
|
273
281
|
});
|
|
274
282
|
}, EditorInputValue = (t) => {
|
|
275
|
-
let n = c(
|
|
276
|
-
n[0] !==
|
|
277
|
-
|
|
278
|
-
}, n[0] =
|
|
279
|
-
let
|
|
280
|
-
n[4] === i ?
|
|
283
|
+
let n = c(45), { editor: r, tokenRules: i, singleLine: a, disabled: o, readonly: s, placeholder: l, open: u, openMenu: f, setOpen: p, menuOpenMode: m, editorContainerRef: h, scheduleClose: g, cancelClose: _, highlightNext: w, highlightPrevious: te, focusFirst: E, selectActive: D, openSubPath: O, exitSub: A, openActiveSub: j } = useEditorInputContext(), M;
|
|
284
|
+
n[0] !== _ || n[1] !== m || n[2] !== f ? (M = () => {
|
|
285
|
+
_(), m === "focus" && f();
|
|
286
|
+
}, n[0] = _, n[1] = m, n[2] = f, n[3] = M) : M = n[3];
|
|
287
|
+
let N = M, P;
|
|
288
|
+
n[4] === i ? P = n[5] : (P = (e) => {
|
|
281
289
|
let [t, n] = e, r = [];
|
|
282
290
|
if (!Text.isText(t) || !i.length) return r;
|
|
283
291
|
let { text: a } = t;
|
|
@@ -298,9 +306,9 @@ const EditorInput = (e) => {
|
|
|
298
306
|
tokenMatch: o
|
|
299
307
|
});
|
|
300
308
|
}), r;
|
|
301
|
-
}, n[4] = i, n[5] =
|
|
302
|
-
let
|
|
303
|
-
n[6] === i ?
|
|
309
|
+
}, n[4] = i, n[5] = P);
|
|
310
|
+
let ne = P, F;
|
|
311
|
+
n[6] === i ? F = n[7] : (F = (e) => {
|
|
304
312
|
let { attributes: t, children: n, leaf: r } = e, a = r;
|
|
305
313
|
if (a.tokenRuleIndex !== void 0) {
|
|
306
314
|
let e = i[a.tokenRuleIndex];
|
|
@@ -320,9 +328,9 @@ const EditorInput = (e) => {
|
|
|
320
328
|
...t,
|
|
321
329
|
children: n
|
|
322
330
|
});
|
|
323
|
-
}, n[6] = i, n[7] =
|
|
324
|
-
let
|
|
325
|
-
n[8] === i ?
|
|
331
|
+
}, n[6] = i, n[7] = F);
|
|
332
|
+
let I = F, L;
|
|
333
|
+
n[8] === i ? L = n[9] : (L = (e) => {
|
|
326
334
|
let { attributes: t, children: n, element: r } = e;
|
|
327
335
|
if (isTokenElement(r)) {
|
|
328
336
|
let e = i[r.ruleIndex], a = e?.wrap ? e.wrap(r.token, null, r.match ?? []) : /* @__PURE__ */ jsx("span", {
|
|
@@ -345,40 +353,40 @@ const EditorInput = (e) => {
|
|
|
345
353
|
style: { position: "relative" },
|
|
346
354
|
children: n
|
|
347
355
|
});
|
|
348
|
-
}, n[8] = i, n[9] =
|
|
349
|
-
let
|
|
350
|
-
n[10] !== r || n[11] !==
|
|
356
|
+
}, n[8] = i, n[9] = L);
|
|
357
|
+
let R = L, z;
|
|
358
|
+
n[10] !== r || n[11] !== A || n[12] !== E || n[13] !== w || n[14] !== te || n[15] !== m || n[16] !== u || n[17] !== j || n[18] !== f || n[19] !== O || n[20] !== D || n[21] !== p || n[22] !== a || n[23] !== i ? (z = (e) => {
|
|
351
359
|
if (a && e.key === "Enter" && e.preventDefault(), e.ctrlKey && e.code === "Space") {
|
|
352
|
-
e.preventDefault(), u ?
|
|
360
|
+
e.preventDefault(), u ? E() : f();
|
|
353
361
|
return;
|
|
354
362
|
}
|
|
355
363
|
if (u) {
|
|
356
364
|
if (e.key === "ArrowDown") {
|
|
357
|
-
e.preventDefault(),
|
|
365
|
+
e.preventDefault(), w();
|
|
358
366
|
return;
|
|
359
367
|
}
|
|
360
368
|
if (e.key === "ArrowUp") {
|
|
361
|
-
e.preventDefault(),
|
|
369
|
+
e.preventDefault(), te();
|
|
362
370
|
return;
|
|
363
371
|
}
|
|
364
|
-
if (e.key === "ArrowRight" &&
|
|
372
|
+
if (e.key === "ArrowRight" && j()) {
|
|
365
373
|
e.preventDefault();
|
|
366
374
|
return;
|
|
367
375
|
}
|
|
368
|
-
if (e.key === "ArrowLeft" &&
|
|
369
|
-
e.preventDefault(),
|
|
376
|
+
if (e.key === "ArrowLeft" && O.length > 0) {
|
|
377
|
+
e.preventDefault(), A();
|
|
370
378
|
return;
|
|
371
379
|
}
|
|
372
380
|
if (e.key === "Enter") {
|
|
373
|
-
|
|
381
|
+
D() && e.preventDefault();
|
|
374
382
|
return;
|
|
375
383
|
}
|
|
376
384
|
if (e.key === "Escape") {
|
|
377
|
-
e.preventDefault(),
|
|
385
|
+
e.preventDefault(), O.length > 0 ? A() : p(!1);
|
|
378
386
|
return;
|
|
379
387
|
}
|
|
380
388
|
}
|
|
381
|
-
if ((e.key === "ArrowLeft" || e.key === "ArrowRight") && !e.shiftKey && i.some(_temp) && r.selection && Range.isCollapsed(r.selection)) {
|
|
389
|
+
if (!u && m === "focus" && !e.ctrlKey && !e.metaKey && !e.altKey && (e.key.length === 1 || e.key === "Backspace" || e.key === "Delete") && f(), (e.key === "ArrowLeft" || e.key === "ArrowRight") && !e.shiftKey && i.some(_temp) && r.selection && Range.isCollapsed(r.selection)) {
|
|
382
390
|
e.preventDefault();
|
|
383
391
|
let t = e.key === "ArrowLeft";
|
|
384
392
|
Transforms.move(r, {
|
|
@@ -394,33 +402,33 @@ const EditorInput = (e) => {
|
|
|
394
402
|
});
|
|
395
403
|
}
|
|
396
404
|
}
|
|
397
|
-
}, n[10] = r, n[11] =
|
|
398
|
-
let
|
|
399
|
-
n[
|
|
400
|
-
let
|
|
401
|
-
n[
|
|
405
|
+
}, n[10] = r, n[11] = A, n[12] = E, n[13] = w, n[14] = te, n[15] = m, n[16] = u, n[17] = j, n[18] = f, n[19] = O, n[20] = D, n[21] = p, n[22] = a, n[23] = i, n[24] = z) : z = n[24];
|
|
406
|
+
let ie = z, B;
|
|
407
|
+
n[25] === t ? B = n[26] : (B = mergeComponentProps("editor-input", t), n[25] = t, n[26] = B);
|
|
408
|
+
let oe = a ? "input-wrapper__control input-wrapper__control--single-line" : "input-wrapper__control", V = o || s, H;
|
|
409
|
+
n[27] !== r || n[28] !== a ? (H = a ? (e) => {
|
|
402
410
|
e.preventDefault(), r.insertText(e.clipboardData.getData("text/plain").replace(/\r?\n/g, " "));
|
|
403
|
-
} : void 0, n[
|
|
411
|
+
} : void 0, n[27] = r, n[28] = a, n[29] = H) : H = n[29];
|
|
404
412
|
let U;
|
|
405
|
-
n[
|
|
406
|
-
className:
|
|
407
|
-
decorate:
|
|
408
|
-
renderLeaf:
|
|
409
|
-
renderElement:
|
|
413
|
+
n[30] !== ne || n[31] !== N || n[32] !== ie || n[33] !== l || n[34] !== R || n[35] !== I || n[36] !== g || n[37] !== oe || n[38] !== V || n[39] !== H ? (U = /* @__PURE__ */ jsx(Editable, {
|
|
414
|
+
className: oe,
|
|
415
|
+
decorate: ne,
|
|
416
|
+
renderLeaf: I,
|
|
417
|
+
renderElement: R,
|
|
410
418
|
readOnly: V,
|
|
411
419
|
spellCheck: !1,
|
|
412
420
|
placeholder: l,
|
|
413
|
-
onBlur:
|
|
414
|
-
onFocus:
|
|
415
|
-
onKeyDown:
|
|
421
|
+
onBlur: g,
|
|
422
|
+
onFocus: N,
|
|
423
|
+
onKeyDown: ie,
|
|
416
424
|
onPaste: H
|
|
417
|
-
}), n[
|
|
425
|
+
}), n[30] = ne, n[31] = N, n[32] = ie, n[33] = l, n[34] = R, n[35] = I, n[36] = g, n[37] = oe, n[38] = V, n[39] = H, n[40] = U) : U = n[40];
|
|
418
426
|
let se;
|
|
419
|
-
return n[
|
|
420
|
-
...
|
|
421
|
-
ref:
|
|
427
|
+
return n[41] !== h || n[42] !== B || n[43] !== U ? (se = /* @__PURE__ */ jsx("div", {
|
|
428
|
+
...B,
|
|
429
|
+
ref: h,
|
|
422
430
|
children: U
|
|
423
|
-
}), n[
|
|
431
|
+
}), n[41] = h, n[42] = B, n[43] = U, n[44] = se) : se = n[44], se;
|
|
424
432
|
}, EditorInputTrigger = (t) => {
|
|
425
433
|
let n = c(5), { triggerRef: r } = useEditorInputContext(), i;
|
|
426
434
|
n[0] === t ? i = n[1] : (i = mergeComponentProps("editor-input__menu-anchor", t), n[0] = t, n[1] = i);
|
|
@@ -439,95 +447,95 @@ const EditorInput = (e) => {
|
|
|
439
447
|
}, EditorInputMenu = (e) => {
|
|
440
448
|
let t = c(21), { editor: n, editorContainerRef: i, setMenuOpenMode: o } = useEditorInputContext(), s, l, u;
|
|
441
449
|
t[0] === e ? (s = t[1], l = t[2], u = t[3]) : ({children: s, openOn: u, ...l} = e, t[0] = e, t[1] = s, t[2] = l, t[3] = u);
|
|
442
|
-
let f = u === void 0 ? "shortcut" : u, p,
|
|
443
|
-
t[4] !== f || t[5] !== o ? (p = () => o(f),
|
|
444
|
-
let
|
|
445
|
-
t[8] === n ? (
|
|
450
|
+
let f = u === void 0 ? "shortcut" : u, p, h;
|
|
451
|
+
t[4] !== f || t[5] !== o ? (p = () => o(f), h = [f, o], t[4] = f, t[5] = o, t[6] = p, t[7] = h) : (p = t[6], h = t[7]), useEffect(p, h);
|
|
452
|
+
let g, _;
|
|
453
|
+
t[8] === n ? (g = t[9], _ = t[10]) : (g = (e) => {
|
|
446
454
|
e.preventDefault(), ReactEditor.focus(n);
|
|
447
|
-
},
|
|
448
|
-
let
|
|
449
|
-
t[11] === i ?
|
|
455
|
+
}, _ = () => ReactEditor.focus(n), t[8] = n, t[9] = g, t[10] = _);
|
|
456
|
+
let v;
|
|
457
|
+
t[11] === i ? v = t[12] : (v = (e) => {
|
|
450
458
|
let t = e.target;
|
|
451
459
|
t && i.current?.contains(t) && e.preventDefault();
|
|
452
|
-
}, t[11] = i, t[12] =
|
|
453
|
-
let
|
|
454
|
-
t[13] !== l || t[14] !==
|
|
460
|
+
}, t[11] = i, t[12] = v);
|
|
461
|
+
let y;
|
|
462
|
+
t[13] !== l || t[14] !== g || t[15] !== _ || t[16] !== v ? (y = {
|
|
455
463
|
color: "primary",
|
|
456
464
|
align: "start",
|
|
457
465
|
sideOffset: 8,
|
|
458
466
|
onContextMenuCapture: _temp3,
|
|
459
467
|
onCloseAutoFocus: _temp4,
|
|
460
|
-
onOpenAutoFocus:
|
|
461
|
-
onFocusCapture:
|
|
462
|
-
onInteractOutside:
|
|
468
|
+
onOpenAutoFocus: g,
|
|
469
|
+
onFocusCapture: _,
|
|
470
|
+
onInteractOutside: v,
|
|
463
471
|
...l
|
|
464
|
-
}, t[13] = l, t[14] =
|
|
465
|
-
let
|
|
466
|
-
return t[18] !== s || t[19] !==
|
|
467
|
-
...
|
|
472
|
+
}, t[13] = l, t[14] = g, t[15] = _, t[16] = v, t[17] = y) : y = t[17];
|
|
473
|
+
let b = y, x;
|
|
474
|
+
return t[18] !== s || t[19] !== b ? (x = /* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsx(MenuContent, {
|
|
475
|
+
...b,
|
|
468
476
|
children: s
|
|
469
|
-
}) }), t[18] = s, t[19] =
|
|
477
|
+
}) }), t[18] = s, t[19] = b, t[20] = x) : x = t[20], x;
|
|
470
478
|
}, EditorInputMenuItem = (e) => {
|
|
471
|
-
let { value: t, data: n, children: r, onlyOnce: a, aliases: o, onActivate: s, ...l } = e, { editor: u, registerItem: d, activeId: p, setActiveId:
|
|
479
|
+
let { value: t, data: n, children: r, onlyOnce: a, aliases: o, onActivate: s, ...l } = e, { editor: u, registerItem: d, activeId: p, setActiveId: h, select: _, search: v, documentText: y, cancelHoverSub: b } = useEditorInputContext(), x = React.useContext(SubMenuIdContext), S = React.useId(), C = useRef(null), w = useRef({
|
|
472
480
|
value: t,
|
|
473
481
|
data: n
|
|
474
482
|
});
|
|
475
|
-
|
|
483
|
+
w.current = {
|
|
476
484
|
value: t,
|
|
477
485
|
data: n
|
|
478
486
|
};
|
|
479
|
-
let
|
|
480
|
-
|
|
481
|
-
let
|
|
487
|
+
let T = useRef(s);
|
|
488
|
+
T.current = s;
|
|
489
|
+
let E = !!s, D = !!a && y.includes(String(t)), O = v?.trim().toLowerCase() ?? "", k = !O || [typeof r == "string" ? r : String(t), ...o ?? []].some((e) => e.toLowerCase().includes(O)), A = D || !k;
|
|
482
490
|
if (useEffect(() => {
|
|
483
|
-
if (!
|
|
484
|
-
getValue: () =>
|
|
485
|
-
getData: () =>
|
|
486
|
-
el:
|
|
487
|
-
parentId:
|
|
488
|
-
onActivate:
|
|
491
|
+
if (!A) return d(S, {
|
|
492
|
+
getValue: () => w.current.value,
|
|
493
|
+
getData: () => w.current.data,
|
|
494
|
+
el: C,
|
|
495
|
+
parentId: x,
|
|
496
|
+
onActivate: E ? () => T.current?.() : void 0
|
|
489
497
|
});
|
|
490
498
|
}, [
|
|
491
|
-
|
|
499
|
+
S,
|
|
492
500
|
d,
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
]),
|
|
497
|
-
let
|
|
501
|
+
x,
|
|
502
|
+
A,
|
|
503
|
+
E
|
|
504
|
+
]), A) return null;
|
|
505
|
+
let j = p === S;
|
|
498
506
|
return /* @__PURE__ */ jsx(MenuItem, {
|
|
499
507
|
...l,
|
|
500
508
|
ref: (e) => {
|
|
501
|
-
|
|
509
|
+
C.current = e;
|
|
502
510
|
},
|
|
503
511
|
textValue: "",
|
|
504
|
-
"data-focus":
|
|
512
|
+
"data-focus": j || void 0,
|
|
505
513
|
onPointerDown: (e) => {
|
|
506
|
-
e.preventDefault(),
|
|
514
|
+
e.preventDefault(), h(S), ReactEditor.focus(u);
|
|
507
515
|
},
|
|
508
516
|
onPointerMove: (e) => {
|
|
509
|
-
e.preventDefault(),
|
|
517
|
+
e.preventDefault(), b(), p !== S && h(S);
|
|
510
518
|
},
|
|
511
|
-
onSelect: () => setTimeout(() =>
|
|
519
|
+
onSelect: () => setTimeout(() => T.current ? T.current() : _(w.current.value, w.current.data), 0),
|
|
512
520
|
children: r
|
|
513
521
|
});
|
|
514
522
|
}, EditorInputSubMenu = (e) => {
|
|
515
|
-
let t = c(47), { label: n, children: r } = e, { editor: i, registerItem: a, activeId: u, setActiveId: p, openSubPath:
|
|
516
|
-
t[0] !==
|
|
523
|
+
let t = c(47), { label: n, children: r } = e, { editor: i, registerItem: a, activeId: u, setActiveId: p, openSubPath: h, enterSub: _, exitSub: y, hoverSub: b, cancelHoverSub: x } = useEditorInputContext(), S = React.useContext(SubMenuIdContext), C = React.useId(), w = useRef(null), T, E;
|
|
524
|
+
t[0] !== _ || t[1] !== C || t[2] !== S || t[3] !== a ? (T = () => a(C, {
|
|
517
525
|
isSub: !0,
|
|
518
526
|
getValue: _temp5,
|
|
519
527
|
getData: _temp6,
|
|
520
|
-
el:
|
|
521
|
-
parentId:
|
|
522
|
-
onActivate: () =>
|
|
523
|
-
}),
|
|
524
|
-
|
|
528
|
+
el: w,
|
|
529
|
+
parentId: S,
|
|
530
|
+
onActivate: () => _(C)
|
|
531
|
+
}), E = [
|
|
532
|
+
C,
|
|
525
533
|
a,
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
], t[0] =
|
|
529
|
-
let
|
|
530
|
-
t[6] === i ?
|
|
534
|
+
S,
|
|
535
|
+
_
|
|
536
|
+
], t[0] = _, t[1] = C, t[2] = S, t[3] = a, t[4] = T, t[5] = E) : (T = t[4], E = t[5]), useEffect(T, E);
|
|
537
|
+
let D;
|
|
538
|
+
t[6] === i ? D = t[7] : (D = {
|
|
531
539
|
onOpenAutoFocus: (e) => {
|
|
532
540
|
e.preventDefault(), ReactEditor.focus(i);
|
|
533
541
|
},
|
|
@@ -535,54 +543,54 @@ const EditorInput = (e) => {
|
|
|
535
543
|
onCloseAutoFocus: _temp7,
|
|
536
544
|
onFocusOutside: _temp8,
|
|
537
545
|
onInteractOutside: _temp9
|
|
538
|
-
}, t[6] = i, t[7] =
|
|
539
|
-
let
|
|
540
|
-
t[8] !==
|
|
541
|
-
let k;
|
|
542
|
-
t[11] !== g || t[12] !== v || t[13] !== S ? (k = (e) => e ? g(S) : v(S), t[11] = g, t[12] = v, t[13] = S, t[14] = k) : k = t[14];
|
|
546
|
+
}, t[6] = i, t[7] = D);
|
|
547
|
+
let O = D, k;
|
|
548
|
+
t[8] !== C || t[9] !== h ? (k = h.includes(C), t[8] = C, t[9] = h, t[10] = k) : k = t[10];
|
|
543
549
|
let A;
|
|
544
|
-
t[
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
t[
|
|
553
|
-
p(S), y(S);
|
|
554
|
-
}, t[21] = y, t[22] = S, t[23] = p, t[24] = N) : N = t[24];
|
|
550
|
+
t[11] !== _ || t[12] !== y || t[13] !== C ? (A = (e) => e ? _(C) : y(C), t[11] = _, t[12] = y, t[13] = C, t[14] = A) : A = t[14];
|
|
551
|
+
let j;
|
|
552
|
+
t[15] === Symbol.for("react.memo_cache_sentinel") ? (j = (e) => {
|
|
553
|
+
w.current = e;
|
|
554
|
+
}, t[15] = j) : j = t[15];
|
|
555
|
+
let M = u === C || void 0, N;
|
|
556
|
+
t[16] !== i || t[17] !== _ || t[18] !== C || t[19] !== p ? (N = (e) => {
|
|
557
|
+
e.preventDefault(), p(C), _(C), ReactEditor.focus(i);
|
|
558
|
+
}, t[16] = i, t[17] = _, t[18] = C, t[19] = p, t[20] = N) : N = t[20];
|
|
555
559
|
let P;
|
|
556
|
-
t[
|
|
557
|
-
|
|
558
|
-
}, t[
|
|
560
|
+
t[21] !== b || t[22] !== C || t[23] !== p ? (P = () => {
|
|
561
|
+
p(C), b(C);
|
|
562
|
+
}, t[21] = b, t[22] = C, t[23] = p, t[24] = P) : P = t[24];
|
|
559
563
|
let F;
|
|
560
|
-
t[
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
onPointerDown: M,
|
|
564
|
-
onPointerEnter: N,
|
|
565
|
-
onPointerMove: P,
|
|
566
|
-
onPointerLeave: b,
|
|
567
|
-
children: n
|
|
568
|
-
}), t[29] = b, t[30] = n, t[31] = P, t[32] = j, t[33] = M, t[34] = N, t[35] = F) : F = t[35];
|
|
564
|
+
t[25] !== u || t[26] !== C || t[27] !== p ? (F = (e) => {
|
|
565
|
+
e.preventDefault(), u !== C && p(C);
|
|
566
|
+
}, t[25] = u, t[26] = C, t[27] = p, t[28] = F) : F = t[28];
|
|
569
567
|
let I;
|
|
570
|
-
t[
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
568
|
+
t[29] !== x || t[30] !== n || t[31] !== F || t[32] !== M || t[33] !== N || t[34] !== P ? (I = /* @__PURE__ */ jsx(MenuSubTrigger, {
|
|
569
|
+
ref: j,
|
|
570
|
+
"data-focus": M,
|
|
571
|
+
onPointerDown: N,
|
|
572
|
+
onPointerEnter: P,
|
|
573
|
+
onPointerMove: F,
|
|
574
|
+
onPointerLeave: x,
|
|
575
|
+
children: n
|
|
576
|
+
}), t[29] = x, t[30] = n, t[31] = F, t[32] = M, t[33] = N, t[34] = P, t[35] = I) : I = t[35];
|
|
574
577
|
let L;
|
|
575
|
-
t[
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
}), t[39] = D, t[40] = I, t[41] = L) : L = t[41];
|
|
578
|
+
t[36] !== r || t[37] !== C ? (L = /* @__PURE__ */ jsx(SubMenuIdContext.Provider, {
|
|
579
|
+
value: C,
|
|
580
|
+
children: r
|
|
581
|
+
}), t[36] = r, t[37] = C, t[38] = L) : L = t[38];
|
|
580
582
|
let R;
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
children:
|
|
585
|
-
}), t[
|
|
583
|
+
t[39] !== O || t[40] !== L ? (R = /* @__PURE__ */ jsx(MenuSubContent, {
|
|
584
|
+
color: "primary",
|
|
585
|
+
...O,
|
|
586
|
+
children: L
|
|
587
|
+
}), t[39] = O, t[40] = L, t[41] = R) : R = t[41];
|
|
588
|
+
let z;
|
|
589
|
+
return t[42] !== I || t[43] !== R || t[44] !== k || t[45] !== A ? (z = /* @__PURE__ */ jsxs(MenuSub, {
|
|
590
|
+
open: k,
|
|
591
|
+
onOpenChange: A,
|
|
592
|
+
children: [I, R]
|
|
593
|
+
}), t[42] = I, t[43] = R, t[44] = k, t[45] = A, t[46] = z) : z = t[46], z;
|
|
586
594
|
};
|
|
587
595
|
function _temp(e) {
|
|
588
596
|
return e.void;
|
package/dist/utils/component.js
CHANGED
|
@@ -50,10 +50,8 @@ var createStyle = (e) => ({
|
|
|
50
50
|
...e.tf ? { transform: e.tf } : {}
|
|
51
51
|
});
|
|
52
52
|
const mergeComponentProps = (n, r) => {
|
|
53
|
-
let i = createStyle(r), a =
|
|
54
|
-
return (
|
|
55
|
-
delete a[e];
|
|
56
|
-
}), mergeProps(a, {
|
|
53
|
+
let i = createStyle(r), a = new Set(/* @__PURE__ */ "m.my.mx.mt.mb.ml.mr.p.py.px.pt.pb.pl.pr.bg.c.opacity.ff.fz.fw.lts.ta.lh.fs.tt.td.w.miw.maw.h.mih.mah.bgsz.bgp.bgr.bga.pos.top.left.bottom.right.inset.display.flex.align.justify.tf".split("."));
|
|
54
|
+
return mergeProps(Object.fromEntries(Object.entries(r).filter(([e]) => !a.has(e))), {
|
|
57
55
|
className: n,
|
|
58
56
|
...Object.keys(i).length === 0 ? {} : { style: i }
|
|
59
57
|
});
|