@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 fromUnixSeconds = (e) => fromDate(/* @__PURE__ */ new Date(e * 1e3), getLocalTimeZone()), toUnixSeconds = (e) => Math.floor(toZoned(e, getLocalTimeZone()).toDate().getTime() / 1e3), toDateValues = (e) => {
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(fromUnixSeconds(e)) : p.push(e));
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] ? toUnixSeconds(e.value[0]) : null), I?.(e);
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: _, formValidation: y, onChange: b, disabled: x = !1, readonly: w = !1, singleLine: k = !1, placeholder: j, value: re, initialValue: ie, defaultValue: P, children: F } = e, I = String(re ?? ie ?? P ?? ""), L = k ? I.replace(/\n/g, " ") : I, R = useMemo(() => {
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
- }, []), ae = useMemo(() => textToSlate(L, d), []), oe = useRef(L), [z, B] = useState(L);
50
+ }, []), ie = useMemo(() => textToSlate(R, d), []), ae = useRef(R), [B, oe] = useState(R);
51
51
  useEffect(() => {
52
- if (L === oe.current || (oe.current = L, B(L), slateToText(R.children) === L)) return;
53
- let e = textToSlate(L, d);
54
- Editor.withoutNormalizing(R, () => {
55
- Transforms.deselect(R);
56
- let t = R.children.length;
57
- Transforms.insertNodes(R, e, { at: [0] });
58
- for (let n = 0; n < t; n++) Transforms.removeNodes(R, { at: [e.length] });
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(R, Editor.end(R, []));
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
- R.selection && (r = ReactEditor.toDOMRange(R, R.selection).getBoundingClientRect());
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
- }, [R]), de = y?.setValue, fe = useCallback((e) => {
87
+ }, [z]), de = b?.setValue, fe = useCallback((e) => {
83
88
  V && G();
84
89
  let t = slateToText(e);
85
- t !== oe.current && (oe.current = t, B(t), de?.(t), b?.(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
- b
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(() => H(!1), 150);
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: R,
192
+ editor: z,
185
193
  tokenRules: d,
186
- singleLine: k,
187
- disabled: x,
188
- readonly: w,
189
- placeholder: j,
190
- search: _,
191
- documentText: z,
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: R,
248
- initialValue: ae,
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: y,
271
+ formValidation: b,
264
272
  ...u ?? {},
265
273
  style: {
266
274
  position: "relative",
267
275
  ...u?.style
268
276
  },
269
- children: F
277
+ children: I
270
278
  })
271
279
  })
272
280
  })
273
281
  });
274
282
  }, EditorInputValue = (t) => {
275
- let n = c(44), { editor: r, tokenRules: i, singleLine: a, disabled: o, readonly: s, placeholder: l, open: u, openMenu: f, setOpen: p, menuOpenMode: te, editorContainerRef: m, scheduleClose: h, cancelClose: g, highlightNext: C, highlightPrevious: ne, focusFirst: T, selectActive: E, openSubPath: D, exitSub: k, openActiveSub: A } = useEditorInputContext(), j;
276
- n[0] !== g || n[1] !== te || n[2] !== f ? (j = () => {
277
- g(), te === "focus" && f();
278
- }, n[0] = g, n[1] = te, n[2] = f, n[3] = j) : j = n[3];
279
- let M = j, N;
280
- n[4] === i ? N = n[5] : (N = (e) => {
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] = N);
302
- let re = N, P;
303
- n[6] === i ? P = n[7] : (P = (e) => {
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] = P);
324
- let F = P, I;
325
- n[8] === i ? I = n[9] : (I = (e) => {
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] = I);
349
- let L = I, R;
350
- n[10] !== r || n[11] !== k || n[12] !== T || n[13] !== C || n[14] !== ne || n[15] !== u || n[16] !== A || n[17] !== f || n[18] !== D || n[19] !== E || n[20] !== p || n[21] !== a || n[22] !== i ? (R = (e) => {
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 ? T() : f();
360
+ e.preventDefault(), u ? E() : f();
353
361
  return;
354
362
  }
355
363
  if (u) {
356
364
  if (e.key === "ArrowDown") {
357
- e.preventDefault(), C();
365
+ e.preventDefault(), w();
358
366
  return;
359
367
  }
360
368
  if (e.key === "ArrowUp") {
361
- e.preventDefault(), ne();
369
+ e.preventDefault(), te();
362
370
  return;
363
371
  }
364
- if (e.key === "ArrowRight" && A()) {
372
+ if (e.key === "ArrowRight" && j()) {
365
373
  e.preventDefault();
366
374
  return;
367
375
  }
368
- if (e.key === "ArrowLeft" && D.length > 0) {
369
- e.preventDefault(), k();
376
+ if (e.key === "ArrowLeft" && O.length > 0) {
377
+ e.preventDefault(), A();
370
378
  return;
371
379
  }
372
380
  if (e.key === "Enter") {
373
- E() && e.preventDefault();
381
+ D() && e.preventDefault();
374
382
  return;
375
383
  }
376
384
  if (e.key === "Escape") {
377
- e.preventDefault(), D.length > 0 ? k() : p(!1);
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] = k, n[12] = T, n[13] = C, n[14] = ne, n[15] = u, n[16] = A, n[17] = f, n[18] = D, n[19] = E, n[20] = p, n[21] = a, n[22] = i, n[23] = R) : R = n[23];
398
- let ae = R, z;
399
- n[24] === t ? z = n[25] : (z = mergeComponentProps("editor-input", t), n[24] = t, n[25] = z);
400
- let B = a ? "input-wrapper__control input-wrapper__control--single-line" : "input-wrapper__control", V = o || s, H;
401
- n[26] !== r || n[27] !== a ? (H = a ? (e) => {
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[26] = r, n[27] = a, n[28] = H) : H = n[28];
411
+ } : void 0, n[27] = r, n[28] = a, n[29] = H) : H = n[29];
404
412
  let U;
405
- n[29] !== re || n[30] !== M || n[31] !== ae || n[32] !== l || n[33] !== L || n[34] !== F || n[35] !== h || n[36] !== B || n[37] !== V || n[38] !== H ? (U = /* @__PURE__ */ jsx(Editable, {
406
- className: B,
407
- decorate: re,
408
- renderLeaf: F,
409
- renderElement: L,
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: h,
414
- onFocus: M,
415
- onKeyDown: ae,
421
+ onBlur: g,
422
+ onFocus: N,
423
+ onKeyDown: ie,
416
424
  onPaste: H
417
- }), n[29] = re, n[30] = M, n[31] = ae, n[32] = l, n[33] = L, n[34] = F, n[35] = h, n[36] = B, n[37] = V, n[38] = H, n[39] = U) : U = n[39];
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[40] !== m || n[41] !== z || n[42] !== U ? (se = /* @__PURE__ */ jsx("div", {
420
- ...z,
421
- ref: m,
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[40] = m, n[41] = z, n[42] = U, n[43] = se) : se = n[43], se;
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, m;
443
- t[4] !== f || t[5] !== o ? (p = () => o(f), m = [f, o], t[4] = f, t[5] = o, t[6] = p, t[7] = m) : (p = t[6], m = t[7]), useEffect(p, m);
444
- let h, g;
445
- t[8] === n ? (h = t[9], g = t[10]) : (h = (e) => {
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
- }, g = () => ReactEditor.focus(n), t[8] = n, t[9] = h, t[10] = g);
448
- let _;
449
- t[11] === i ? _ = t[12] : (_ = (e) => {
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 v;
454
- t[13] !== l || t[14] !== h || t[15] !== g || t[16] !== _ ? (v = {
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: h,
461
- onFocusCapture: g,
462
- onInteractOutside: _,
468
+ onOpenAutoFocus: g,
469
+ onFocusCapture: _,
470
+ onInteractOutside: v,
463
471
  ...l
464
- }, t[13] = l, t[14] = h, t[15] = g, t[16] = _, t[17] = v) : v = t[17];
465
- let y = v, b;
466
- return t[18] !== s || t[19] !== y ? (b = /* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsx(MenuContent, {
467
- ...y,
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] = y, t[20] = b) : b = t[20], b;
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: m, select: g, search: _, documentText: v, cancelHoverSub: y } = useEditorInputContext(), b = React.useContext(SubMenuIdContext), x = React.useId(), S = useRef(null), C = useRef({
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
- C.current = {
483
+ w.current = {
476
484
  value: t,
477
485
  data: n
478
486
  };
479
- let w = useRef(s);
480
- w.current = s;
481
- let T = !!s, E = !!a && v.includes(String(t)), D = _?.trim().toLowerCase() ?? "", O = !D || [typeof r == "string" ? r : String(t), ...o ?? []].some((e) => e.toLowerCase().includes(D)), k = E || !O;
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 (!k) return d(x, {
484
- getValue: () => C.current.value,
485
- getData: () => C.current.data,
486
- el: S,
487
- parentId: b,
488
- onActivate: T ? () => w.current?.() : void 0
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
- x,
499
+ S,
492
500
  d,
493
- b,
494
- k,
495
- T
496
- ]), k) return null;
497
- let A = p === x;
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
- S.current = e;
509
+ C.current = e;
502
510
  },
503
511
  textValue: "",
504
- "data-focus": A || void 0,
512
+ "data-focus": j || void 0,
505
513
  onPointerDown: (e) => {
506
- e.preventDefault(), m(x), ReactEditor.focus(u);
514
+ e.preventDefault(), h(S), ReactEditor.focus(u);
507
515
  },
508
516
  onPointerMove: (e) => {
509
- e.preventDefault(), y(), p !== x && m(x);
517
+ e.preventDefault(), b(), p !== S && h(S);
510
518
  },
511
- onSelect: () => setTimeout(() => w.current ? w.current() : g(C.current.value, C.current.data), 0),
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: m, enterSub: g, exitSub: v, hoverSub: y, cancelHoverSub: b } = useEditorInputContext(), x = React.useContext(SubMenuIdContext), S = React.useId(), C = useRef(null), w, T;
516
- t[0] !== g || t[1] !== S || t[2] !== x || t[3] !== a ? (w = () => a(S, {
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: C,
521
- parentId: x,
522
- onActivate: () => g(S)
523
- }), T = [
524
- S,
528
+ el: w,
529
+ parentId: S,
530
+ onActivate: () => _(C)
531
+ }), E = [
532
+ C,
525
533
  a,
526
- x,
527
- g
528
- ], t[0] = g, t[1] = S, t[2] = x, t[3] = a, t[4] = w, t[5] = T) : (w = t[4], T = t[5]), useEffect(w, T);
529
- let E;
530
- t[6] === i ? E = t[7] : (E = {
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] = E);
539
- let D = E, O;
540
- t[8] !== S || t[9] !== m ? (O = m.includes(S), t[8] = S, t[9] = m, t[10] = O) : O = t[10];
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[15] === Symbol.for("react.memo_cache_sentinel") ? (A = (e) => {
545
- C.current = e;
546
- }, t[15] = A) : A = t[15];
547
- let j = u === S || void 0, M;
548
- t[16] !== i || t[17] !== g || t[18] !== S || t[19] !== p ? (M = (e) => {
549
- e.preventDefault(), p(S), g(S), ReactEditor.focus(i);
550
- }, t[16] = i, t[17] = g, t[18] = S, t[19] = p, t[20] = M) : M = t[20];
551
- let N;
552
- t[21] !== y || t[22] !== S || t[23] !== p ? (N = () => {
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[25] !== u || t[26] !== S || t[27] !== p ? (P = (e) => {
557
- e.preventDefault(), u !== S && p(S);
558
- }, t[25] = u, t[26] = S, t[27] = p, t[28] = P) : P = t[28];
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[29] !== b || t[30] !== n || t[31] !== P || t[32] !== j || t[33] !== M || t[34] !== N ? (F = /* @__PURE__ */ jsx(MenuSubTrigger, {
561
- ref: A,
562
- "data-focus": j,
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[36] !== r || t[37] !== S ? (I = /* @__PURE__ */ jsx(SubMenuIdContext.Provider, {
571
- value: S,
572
- children: r
573
- }), t[36] = r, t[37] = S, t[38] = I) : I = t[38];
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[39] !== D || t[40] !== I ? (L = /* @__PURE__ */ jsx(MenuSubContent, {
576
- color: "primary",
577
- ...D,
578
- children: I
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
- return t[42] !== F || t[43] !== L || t[44] !== O || t[45] !== k ? (R = /* @__PURE__ */ jsxs(MenuSub, {
582
- open: O,
583
- onOpenChange: k,
584
- children: [F, L]
585
- }), t[42] = F, t[43] = L, t[44] = O, t[45] = k, t[46] = R) : R = t[46], R;
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;
@@ -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 = { ...r };
54
- return (/* @__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(".")).forEach((e) => {
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code0-tech/pictor",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "type": "module",
5
5
  "description": "A simple template for a custom React component library",
6
6
  "scripts": {