@fiestaboard/ui 5.6.0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/components/editor/color-picker-content.d.ts +25 -1
  2. package/dist/components/editor/color-picker-content.js +51 -44
  3. package/dist/components/editor/color-picker-content.js.map +1 -1
  4. package/dist/components/editor/draw-char-picker-content.d.ts +13 -3
  5. package/dist/components/editor/draw-char-picker-content.js +37 -36
  6. package/dist/components/editor/draw-char-picker-content.js.map +1 -1
  7. package/dist/components/editor/formatting-picker-content.js +10 -10
  8. package/dist/components/editor/template-editor-toolbar.d.ts +17 -1
  9. package/dist/components/editor/template-editor-toolbar.js +167 -163
  10. package/dist/components/editor/template-editor-toolbar.js.map +1 -1
  11. package/dist/components/editor/template-editor.d.ts +13 -1
  12. package/dist/components/editor/template-editor.js +132 -131
  13. package/dist/components/editor/template-editor.js.map +1 -1
  14. package/dist/components/feedback/badge.d.ts +23 -3
  15. package/dist/components/feedback/badge.js +29 -12
  16. package/dist/components/feedback/badge.js.map +1 -1
  17. package/dist/components/forms/button.d.ts +1 -1
  18. package/dist/components/forms/copy-button.d.ts +74 -0
  19. package/dist/components/forms/copy-button.js +49 -0
  20. package/dist/components/forms/copy-button.js.map +1 -0
  21. package/dist/components/forms/swatch.d.ts +40 -11
  22. package/dist/components/forms/swatch.js +40 -29
  23. package/dist/components/forms/swatch.js.map +1 -1
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.js +101 -100
  26. package/dist/theme.css +21 -8
  27. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import type { ComponentProps } from "react";
2
+ import type { Code62Glyph } from "../../lib/board-characters";
2
3
  import type { DeviceType } from "./constants";
3
4
  import { TemplateEditorToolbar } from "./template-editor-toolbar";
4
5
  import type { DrawBrush } from "./utils/draw-mode";
@@ -69,7 +70,7 @@ export declare const DEFAULT_TEMPLATE_EDITOR_LABELS: TemplateEditorLabels;
69
70
  * The editor-owned props (`editor`, alignment/wrap state, device, draw mode)
70
71
  * are omitted — the editor passes those itself, from its own state.
71
72
  */
72
- export type TemplateEditorToolbarSlotProps = Omit<ComponentProps<typeof TemplateEditorToolbar>, "editor" | "currentAlignment" | "currentWrapEnabled" | "onAlignmentChange" | "onWrapToggle" | "deviceType" | "onSyncFromBoard" | "syncFromBoardPending" | "drawMode" | "onDrawModeToggle" | "drawBrush" | "onDrawBrushChange">;
73
+ export type TemplateEditorToolbarSlotProps = Omit<ComponentProps<typeof TemplateEditorToolbar>, "editor" | "currentAlignment" | "currentWrapEnabled" | "onAlignmentChange" | "onWrapToggle" | "deviceType" | "code62Glyph" | "onSyncFromBoard" | "syncFromBoardPending" | "drawMode" | "onDrawModeToggle" | "drawBrush" | "onDrawBrushChange">;
73
74
  export interface TemplateEditorProps {
74
75
  value: string;
75
76
  onChange: (value: string) => void;
@@ -88,6 +89,17 @@ export interface TemplateEditorProps {
88
89
  boardLines?: number;
89
90
  onLineCountChange?: (lineCount: number) => void;
90
91
  deviceType?: DeviceType;
92
+ /**
93
+ * Which glyph the target board's code-62 flap draws. Forwarded to the
94
+ * toolbar, and from there to the colour and draw-character pickers.
95
+ *
96
+ * It is a property of the individual board, not of the device family:
97
+ * since 2026 some Flagships ship a heart flap in that slot, so nothing
98
+ * queryable distinguishes them and only the owner knows
99
+ * (FiestaBoard#1657, #1664). Unset means `"degree"` on Flagship hardware,
100
+ * which is how every Flagship behaved before the change.
101
+ */
102
+ code62Glyph?: Code62Glyph;
91
103
  onSyncFromBoard?: () => void;
92
104
  syncFromBoardPending?: boolean;
93
105
  drawMode?: boolean;
@@ -10,25 +10,25 @@ import { resolveDimensions as ee } from "../../lib/board-dimensions.js";
10
10
  import { DEFAULT_BOARD_LINES as te, DEFAULT_BOARD_WIDTH as ne } from "./constants.js";
11
11
  import { ColorTileNode as re } from "./extensions/color-tile-node.js";
12
12
  import { FillSpaceNode as ie } from "./extensions/fill-space-node.js";
13
- import { FormulaNode as u } from "./extensions/formula-node.js";
14
- import { LineNavigation as ae } from "./extensions/line-navigation.js";
15
- import { SingleParagraphDoc as oe } from "./extensions/single-paragraph-doc.js";
16
- import { TrailingNewline as se } from "./extensions/trailing-newline.js";
17
- import { VariableNode as ce } from "./extensions/variable-node.js";
18
- import { WrappedTextNode as le } from "./extensions/wrapped-text-node.js";
19
- import { brushToCell as ue } from "./utils/draw-mode.js";
20
- import { parseLineContent as de, parseTemplateSimple as d, serializeTemplateSimple as f } from "./utils/serialization.js";
21
- import { TemplateEditorToolbar as fe } from "./template-editor-toolbar.js";
22
- import { buildStrokeTransaction as pe } from "./utils/stroke-transaction.js";
23
- import { AlignCenter as me, AlignLeft as he, AlignRight as ge } from "lucide-react";
24
- import { forwardRef as p, useCallback as m, useEffect as h, useImperativeHandle as _e, useMemo as ve, useRef as g, useState as _ } from "react";
25
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
26
- import { closeHistory as b, undoDepth as ye } from "@tiptap/pm/history";
27
- import { TextSelection as x } from "@tiptap/pm/state";
28
- import { EditorContent as be, useEditor as xe } from "@tiptap/react";
29
- import Se from "@tiptap/starter-kit";
13
+ import { FormulaNode as ae } from "./extensions/formula-node.js";
14
+ import { LineNavigation as oe } from "./extensions/line-navigation.js";
15
+ import { SingleParagraphDoc as se } from "./extensions/single-paragraph-doc.js";
16
+ import { TrailingNewline as ce } from "./extensions/trailing-newline.js";
17
+ import { VariableNode as le } from "./extensions/variable-node.js";
18
+ import { WrappedTextNode as ue } from "./extensions/wrapped-text-node.js";
19
+ import { brushToCell as de } from "./utils/draw-mode.js";
20
+ import { parseLineContent as fe, parseTemplateSimple as u, serializeTemplateSimple as d } from "./utils/serialization.js";
21
+ import { TemplateEditorToolbar as pe } from "./template-editor-toolbar.js";
22
+ import { buildStrokeTransaction as me } from "./utils/stroke-transaction.js";
23
+ import { AlignCenter as he, AlignLeft as ge, AlignRight as _e } from "lucide-react";
24
+ import { forwardRef as f, useCallback as p, useEffect as m, useImperativeHandle as ve, useMemo as ye, useRef as h, useState as g } from "react";
25
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
26
+ import { closeHistory as y, undoDepth as be } from "@tiptap/pm/history";
27
+ import { TextSelection as b } from "@tiptap/pm/state";
28
+ import { EditorContent as xe, useEditor as Se } from "@tiptap/react";
29
+ import Ce from "@tiptap/starter-kit";
30
30
  //#region src/components/editor/template-editor.tsx
31
- var S = {
31
+ var x = {
32
32
  lineCount: (e, t) => `${e} / ${t} lines`,
33
33
  overLineLimit: (e) => ` — exceeds the ${e}-line board limit`,
34
34
  currentLine: (e) => `(Line ${e})`,
@@ -37,14 +37,14 @@ var S = {
37
37
  alignCenter: "Align center",
38
38
  alignRight: "Align right",
39
39
  editorAriaLabel: "Template editor"
40
- }, Ce = /* @__PURE__ */ new Set([
40
+ }, we = /* @__PURE__ */ new Set([
41
41
  "variable",
42
42
  "colorTile",
43
43
  "fillSpace",
44
44
  "formula",
45
45
  "wrappedText"
46
46
  ]);
47
- function C(e) {
47
+ function S(e) {
48
48
  try {
49
49
  if (!e || !e.content || e.content.size === 0) return "";
50
50
  let t = "";
@@ -67,15 +67,15 @@ function C(e) {
67
67
  return console.warn("Error in serializeSliceToTemplate:", e), "";
68
68
  }
69
69
  }
70
- var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type text or insert variables...", className: T, showAlignmentControls: Ee = !0, onLineAlignmentChange: E, lineAlignments: De, onLineWrapChange: D, lineWrapEnabled: Oe, showToolbar: O = !0, boardWidth: ke, boardLines: Ae, onLineCountChange: k, deviceType: A, onSyncFromBoard: je, syncFromBoardPending: Me = !1, drawMode: j = !1, onDrawModeToggle: Ne, drawBrush: Pe, onDrawBrushChange: Fe, onDrawHistoryEvent: M, labels: Ie, toolbarProps: Le }, Re) {
70
+ var C = f(function({ value: f, onChange: C, onFocus: Te, placeholder: Ee = "Type text or insert variables...", className: w, showAlignmentControls: De = !0, onLineAlignmentChange: T, lineAlignments: Oe, onLineWrapChange: E, lineWrapEnabled: ke, showToolbar: D = !0, boardWidth: Ae, boardLines: je, onLineCountChange: O, deviceType: k, code62Glyph: Me, onSyncFromBoard: Ne, syncFromBoardPending: Pe = !1, drawMode: A = !1, onDrawModeToggle: Fe, drawBrush: j, onDrawBrushChange: Ie, onDrawHistoryEvent: M, labels: Le, toolbarProps: Re }, ze) {
71
71
  let N = {
72
- ...S,
73
- ...Ie
74
- }, P = A ? ee(A) : null, F = ke ?? P?.cols ?? ne, I = Ae ?? P?.rows ?? te, ze = De || Array.from({ length: I }, () => "left"), L = Oe || Array.from({ length: I }, () => !1), Be = g(!1), R = g(null), z = g(null), [B, V] = _(() => (p || "").split("\n").length), [Ve, He] = _(() => Array.from({ length: I }, () => 24)), H = g(!1), U = g(null), W = xe({
72
+ ...x,
73
+ ...Le
74
+ }, P = k ? ee(k) : null, F = Ae ?? P?.cols ?? ne, I = je ?? P?.rows ?? te, Be = Oe || Array.from({ length: I }, () => "left"), L = ke || Array.from({ length: I }, () => !1), Ve = h(!1), R = h(null), z = h(null), [B, V] = g(() => (f || "").split("\n").length), [He, Ue] = g(() => Array.from({ length: I }, () => 24)), H = h(!1), U = h(null), W = Se({
75
75
  immediatelyRender: !1,
76
76
  extensions: [
77
- oe,
78
- Se.configure({
77
+ se,
78
+ Ce.configure({
79
79
  heading: !1,
80
80
  blockquote: !1,
81
81
  codeBlock: !1,
@@ -89,19 +89,19 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
89
89
  strike: !1,
90
90
  document: !1
91
91
  }),
92
- ce,
92
+ le,
93
93
  re,
94
94
  ie,
95
- u,
96
- le,
97
95
  ae,
98
- se
96
+ ue,
97
+ oe,
98
+ ce
99
99
  ],
100
- content: d(p || "", I),
100
+ content: u(f || "", I),
101
101
  editorProps: {
102
102
  attributes: {
103
- class: e("w-full font-mono text-sm", "prose prose-sm max-w-none", "[&_.ProseMirror]:outline-none", "[&_.ProseMirror]:font-mono", "[&_.ProseMirror]:text-sm", "[&_.ProseMirror]:resize-none", "[&_.ProseMirror]:uppercase", "[&_.ProseMirror_p]:my-0 [&_.ProseMirror_p]:leading-tight", "[&_.ProseMirror_p]:min-h-[1.5rem]", T),
104
- "data-placeholder": Te,
103
+ class: e("w-full font-mono text-sm", "prose prose-sm max-w-none", "[&_.ProseMirror]:outline-none", "[&_.ProseMirror]:font-mono", "[&_.ProseMirror]:text-sm", "[&_.ProseMirror]:resize-none", "[&_.ProseMirror]:uppercase", "[&_.ProseMirror_p]:my-0 [&_.ProseMirror_p]:leading-tight", "[&_.ProseMirror_p]:min-h-[1.5rem]", w),
104
+ "data-placeholder": Ee,
105
105
  role: "textbox",
106
106
  "aria-label": N.editorAriaLabel,
107
107
  "aria-multiline": "true"
@@ -146,7 +146,7 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
146
146
  }
147
147
  if ((t.key === "ArrowRight" || t.key === "ArrowLeft") && !t.altKey && !t.ctrlKey && !t.metaKey) {
148
148
  let { state: n } = e, { selection: r } = n;
149
- if (!(r instanceof x)) return !1;
149
+ if (!(r instanceof b)) return !1;
150
150
  let i = r.$head.pos, a = r.$head.start(), o = r.$head.end();
151
151
  if (t.key === "ArrowRight") {
152
152
  if (i >= o) return !1;
@@ -154,7 +154,7 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
154
154
  for (; a < o && n.doc.textBetween(a - 1, a, void 0, "") === "​";) a++;
155
155
  if (a === i + 1 && !t.shiftKey) return !1;
156
156
  t.preventDefault();
157
- let s = t.shiftKey ? x.create(n.doc, r.$anchor.pos, a) : x.create(n.doc, a);
157
+ let s = t.shiftKey ? b.create(n.doc, r.$anchor.pos, a) : b.create(n.doc, a);
158
158
  return e.dispatch(n.tr.setSelection(s).scrollIntoView()), !0;
159
159
  }
160
160
  if (t.key === "ArrowLeft") {
@@ -163,7 +163,7 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
163
163
  for (; o > a && n.doc.textBetween(o, o + 1, void 0, "") === "​";) o--;
164
164
  if (o === i - 1 && !t.shiftKey) return !1;
165
165
  t.preventDefault();
166
- let s = t.shiftKey ? x.create(n.doc, r.$anchor.pos, o) : x.create(n.doc, o);
166
+ let s = t.shiftKey ? b.create(n.doc, r.$anchor.pos, o) : b.create(n.doc, o);
167
167
  return e.dispatch(n.tr.setSelection(s).scrollIntoView()), !0;
168
168
  }
169
169
  }
@@ -184,7 +184,7 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
184
184
  try {
185
185
  let e = r.content();
186
186
  if (e) {
187
- let t = C(e);
187
+ let t = S(e);
188
188
  navigator.clipboard && navigator.clipboard.writeText && navigator.clipboard.writeText(t).catch(() => {});
189
189
  }
190
190
  } catch (e) {
@@ -201,7 +201,7 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
201
201
  try {
202
202
  let e = t.clipboardData?.getData("text/plain") || "";
203
203
  if (e && (e.includes("{{") || e.match(/\{[a-z]+\}/i))) {
204
- let t = de(e);
204
+ let t = fe(e);
205
205
  if (t.length > 0 && R.current?.state && R.current?.chain) return R.current.chain().focus().insertContent(t).run(), !0;
206
206
  }
207
207
  } catch (e) {
@@ -237,9 +237,9 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
237
237
  });
238
238
  if (!n) return !1;
239
239
  let r = e.state.doc.nodeAt(n.pos);
240
- if (!r || !Ce.has(r.type.name)) return !1;
240
+ if (!r || !we.has(r.type.name)) return !1;
241
241
  let i = n.pos + r.nodeSize;
242
- e.dispatch(e.state.tr.setSelection(x.create(e.state.doc, i)));
242
+ e.dispatch(e.state.tr.setSelection(b.create(e.state.doc, i)));
243
243
  let a = e.nodeDOM(n.pos);
244
244
  return a instanceof HTMLElement && a.classList.add("selected-inline"), t.preventDefault(), !0;
245
245
  }
@@ -263,7 +263,7 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
263
263
  if (c >= 0 && c <= s.doc.content.size) {
264
264
  s.insert(c, a);
265
265
  let t = c + a.nodeSize;
266
- return t <= s.doc.content.size && s.setSelection(x.create(s.doc, t)), e.dispatch(s), z.current = null, !0;
266
+ return t <= s.doc.content.size && s.setSelection(b.create(s.doc, t)), e.dispatch(s), z.current = null, !0;
267
267
  }
268
268
  } catch (e) {
269
269
  console.warn("Error handling drop:", e);
@@ -274,7 +274,7 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
274
274
  },
275
275
  clipboardTextSerializer: (e) => {
276
276
  try {
277
- return !e || !e.content ? "" : C(e);
277
+ return !e || !e.content ? "" : S(e);
278
278
  } catch (e) {
279
279
  return console.warn("Error in clipboardTextSerializer:", e), "";
280
280
  }
@@ -293,32 +293,32 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
293
293
  });
294
294
  },
295
295
  onUpdate: ({ editor: e }) => {
296
- if (Be.current || !e || !e.state) return;
297
- let t = e.getJSON(), n = f(t, I), r = n.split("\n").length;
298
- w(n), V(r), k && k(r), U.current?.();
296
+ if (Ve.current || !e || !e.state) return;
297
+ let t = e.getJSON(), n = d(t, I), r = n.split("\n").length;
298
+ C(n), V(r), O && O(r), U.current?.();
299
299
  },
300
300
  onCreate: ({ editor: e }) => {
301
- let t = e.getJSON(), n = f(t, I).split("\n").length;
302
- V(n), k && k(n), U.current?.();
301
+ let t = e.getJSON(), n = d(t, I).split("\n").length;
302
+ V(n), O && O(n), U.current?.();
303
303
  },
304
304
  onFocus: () => {
305
- we?.();
305
+ Te?.();
306
306
  }
307
307
  });
308
- h(() => {
308
+ m(() => {
309
309
  W && (R.current = W);
310
310
  }, [W]);
311
- let Ue = g({
311
+ let We = h({
312
312
  done: [],
313
313
  undone: []
314
- }), G = g(!1), K = g(M);
315
- h(() => {
314
+ }), G = h(!1), K = h(M);
315
+ m(() => {
316
316
  K.current = M;
317
- }, [M]), h(() => {
317
+ }, [M]), m(() => {
318
318
  if (!W) return;
319
319
  let e = ({ transaction: e }) => {
320
320
  if (!e.docChanged) return;
321
- let t = Ue.current, n = e.getMeta("history$"), r = ye(W.state);
321
+ let t = We.current, n = e.getMeta("history$"), r = be(W.state);
322
322
  if (n && typeof n == "object" && typeof n.redo == "boolean") if (n.redo) {
323
323
  for (; t.undone.length > 0 && t.undone[t.undone.length - 1] > r;) t.undone.pop();
324
324
  let e = t.undone[t.undone.length - 1] === r;
@@ -343,11 +343,11 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
343
343
  return W.on("transaction", e), () => {
344
344
  W.off("transaction", e);
345
345
  };
346
- }, [W]), _e(Re, () => ({
346
+ }, [W]), ve(ze, () => ({
347
347
  applyStroke(e, t) {
348
348
  let n = R.current;
349
349
  if (!n || n.isDestroyed) return [];
350
- let r = ue(t), i = f(n.getJSON(), I).split("\n"), a = /* @__PURE__ */ new Map();
350
+ let r = de(t), i = d(n.getJSON(), I).split("\n"), a = /* @__PURE__ */ new Map();
351
351
  for (let t of e) {
352
352
  if (t.row < 0 || t.row >= I || t.col < 0 || t.col >= F) continue;
353
353
  let e = a.get(t.row) ?? [];
@@ -357,10 +357,10 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
357
357
  }), a.set(t.row, e);
358
358
  }
359
359
  if (a.size === 0) return [];
360
- let o = pe(n.state, i, a, F);
360
+ let o = me(n.state, i, a, F);
361
361
  if (!o) return [];
362
362
  let { view: s } = n;
363
- return G.current = !0, s.dispatch(b(o)), s.dispatch(b(s.state.tr)), [...a.keys()].sort((e, t) => e - t);
363
+ return G.current = !0, s.dispatch(y(o)), s.dispatch(y(s.state.tr)), [...a.keys()].sort((e, t) => e - t);
364
364
  },
365
365
  undo() {
366
366
  let e = R.current;
@@ -371,8 +371,8 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
371
371
  !e || e.isDestroyed || e.chain().redo().run();
372
372
  }
373
373
  }), [I, F]);
374
- let q = m(() => {
375
- if (!(!W || W.isDestroyed) && !j) try {
374
+ let q = p(() => {
375
+ if (!(!W || W.isDestroyed) && !A) try {
376
376
  let { state: e, view: t } = W;
377
377
  if (!t.dom.isConnected) return;
378
378
  let n = [];
@@ -397,26 +397,26 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
397
397
  i.push(Math.max(Math.round(a - r[e]), 24));
398
398
  }
399
399
  for (; i.length < I;) i.push(24);
400
- He((e) => e.length === i.length && e.every((e, t) => e === i[t]) ? e : i);
400
+ Ue((e) => e.length === i.length && e.every((e, t) => e === i[t]) ? e : i);
401
401
  } catch {}
402
402
  }, [
403
403
  W,
404
404
  I,
405
- j
406
- ]), J = m(() => {
405
+ A
406
+ ]), J = p(() => {
407
407
  H.current || (H.current = !0, requestAnimationFrame(() => {
408
408
  H.current = !1, q();
409
409
  }));
410
410
  }, [q]);
411
- h(() => {
411
+ m(() => {
412
412
  U.current = J;
413
- }, [J]), h(() => {
414
- j || J();
415
- }, [j, J]), h(() => {
413
+ }, [J]), m(() => {
414
+ A || J();
415
+ }, [A, J]), m(() => {
416
416
  if (!W) return;
417
417
  let e = new ResizeObserver(J);
418
418
  return e.observe(W.view.dom), J(), () => e.disconnect();
419
- }, [W, J]), h(() => {
419
+ }, [W, J]), m(() => {
420
420
  if (!W) return;
421
421
  let e = W.view.dom, t = (e) => {
422
422
  if (!z.current) return;
@@ -444,7 +444,7 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
444
444
  if (s >= 0 && s <= o.doc.content.size) {
445
445
  o.insert(s, i);
446
446
  let e = s + i.nodeSize;
447
- e <= o.doc.content.size && o.setSelection(x.create(o.doc, e)), W.view.dispatch(o), z.current = null;
447
+ e <= o.doc.content.size && o.setSelection(b.create(o.doc, e)), W.view.dispatch(o), z.current = null;
448
448
  }
449
449
  } catch (e) {
450
450
  console.warn("Error handling DOM drop:", e), z.current = null;
@@ -455,23 +455,23 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
455
455
  return e.addEventListener("drop", t), e.addEventListener("dragover", n), () => {
456
456
  e.removeEventListener("drop", t), e.removeEventListener("dragover", n);
457
457
  };
458
- }, [W]), h(() => {
458
+ }, [W]), m(() => {
459
459
  if (!W || W.isDestroyed) return;
460
- W.isFocused || p !== f(W.getJSON(), I) && queueMicrotask(() => {
461
- !W || W.isDestroyed || W.commands.setContent(d(p || "", I), {
460
+ W.isFocused || f !== d(W.getJSON(), I) && queueMicrotask(() => {
461
+ !W || W.isDestroyed || W.commands.setContent(u(f || "", I), {
462
462
  emitUpdate: !1,
463
463
  parseOptions: { preserveWhitespace: !0 }
464
464
  });
465
465
  });
466
- let e = (p || "").split("\n").length;
467
- V(e), k && k(e), U.current?.();
466
+ let e = (f || "").split("\n").length;
467
+ V(e), O && O(e), U.current?.();
468
468
  }, [
469
- p,
469
+ f,
470
470
  W,
471
471
  I,
472
- k
472
+ O
473
473
  ]);
474
- let Y = m(() => {
474
+ let Y = p(() => {
475
475
  try {
476
476
  if (!W || !W.state || !W.state.selection) return null;
477
477
  let { state: e } = W, { selection: t } = e;
@@ -483,7 +483,7 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
483
483
  } catch (e) {
484
484
  return console.warn("Error in getCurrentLineIndex:", e), null;
485
485
  }
486
- }, [W]), X = m((e) => {
486
+ }, [W]), X = p((e) => {
487
487
  if (W) try {
488
488
  if (!W.state || !W.state.selection) return;
489
489
  let { state: t } = W, { selection: n } = t;
@@ -497,27 +497,27 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
497
497
  e && e.type && e.type.name === "hardBreak" && i++;
498
498
  }), r < 0 || r >= I) return;
499
499
  let a = Math.min(i, I - 1);
500
- if (E) for (let t = r; t <= a; t++) E(t, e);
500
+ if (T) for (let t = r; t <= a; t++) T(t, e);
501
501
  } catch (e) {
502
502
  console.warn("Error in handleAlignmentClick:", e);
503
503
  }
504
504
  }, [
505
505
  W,
506
506
  I,
507
- E
508
- ]), We = m(() => {
507
+ T
508
+ ]), Ge = p(() => {
509
509
  if (!W) return;
510
510
  let e = Y();
511
511
  if (e === null || e < 0 || e >= I) return;
512
512
  let t = !L[e];
513
- D && D(e, t);
513
+ E && E(e, t);
514
514
  }, [
515
515
  W,
516
516
  Y,
517
- D,
517
+ E,
518
518
  I,
519
519
  L
520
- ]), Z = ve(() => {
520
+ ]), Z = ye(() => {
521
521
  try {
522
522
  if (!W?.state?.selection?.$from || !W.state.doc) return null;
523
523
  let e = 0;
@@ -527,44 +527,45 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
527
527
  } catch (e) {
528
528
  return console.warn("Error getting current line index:", e), null;
529
529
  }
530
- }, [W, W?.state?.selection?.$from?.pos]), Q = Z !== null && Z >= 0 && Z < I && ze[Z] || "left";
531
- if (!W) return /* @__PURE__ */ v(t, {
532
- className: e("min-h-[9rem] border rounded-md p-2 bg-muted/30", T),
533
- children: /* @__PURE__ */ v(a, {
530
+ }, [W, W?.state?.selection?.$from?.pos]), Q = Z !== null && Z >= 0 && Z < I && Be[Z] || "left";
531
+ if (!W) return /* @__PURE__ */ _(t, {
532
+ className: e("min-h-[9rem] border rounded-md p-2 bg-muted/30", w),
533
+ children: /* @__PURE__ */ _(a, {
534
534
  gap: "1",
535
- children: Array.from({ length: I }).map((e, t) => /* @__PURE__ */ v(r, { className: "h-6" }, t))
535
+ children: Array.from({ length: I }).map((e, t) => /* @__PURE__ */ _(r, { className: "h-6" }, t))
536
536
  })
537
537
  });
538
- let Ge = Z !== null && Z >= 0 && Z < I && L[Z] || !1, $ = B > I;
539
- return /* @__PURE__ */ y(t, {
540
- className: e("relative", T),
541
- children: [O && /* @__PURE__ */ v(fe, {
542
- ...Le,
538
+ let Ke = Z !== null && Z >= 0 && Z < I && L[Z] || !1, $ = B > I;
539
+ return /* @__PURE__ */ v(t, {
540
+ className: e("relative", w),
541
+ children: [D && /* @__PURE__ */ _(pe, {
542
+ ...Re,
543
543
  editor: W,
544
544
  currentAlignment: Q,
545
- currentWrapEnabled: Ge,
545
+ currentWrapEnabled: Ke,
546
546
  onAlignmentChange: X,
547
- onWrapToggle: We,
548
- deviceType: A,
549
- onSyncFromBoard: je,
550
- syncFromBoardPending: Me,
551
- drawMode: j,
552
- onDrawModeToggle: Ne,
553
- drawBrush: Pe,
554
- onDrawBrushChange: Fe
555
- }), /* @__PURE__ */ y(t, {
556
- className: e("flex-1", j && "hidden"),
547
+ onWrapToggle: Ge,
548
+ deviceType: k,
549
+ code62Glyph: Me,
550
+ onSyncFromBoard: Ne,
551
+ syncFromBoardPending: Pe,
552
+ drawMode: A,
553
+ onDrawModeToggle: Fe,
554
+ drawBrush: j,
555
+ onDrawBrushChange: Ie
556
+ }), /* @__PURE__ */ v(t, {
557
+ className: e("flex-1", A && "hidden"),
557
558
  children: [
558
- /* @__PURE__ */ v(t, {
559
- className: e("border bg-background relative rounded-md", O ? "rounded-t-none" : "", $ && "border-warning"),
559
+ /* @__PURE__ */ _(t, {
560
+ className: e("border bg-background relative rounded-md", D ? "rounded-t-none" : "", $ && "border-warning"),
560
561
  style: {
561
562
  padding: "0.75rem",
562
563
  minHeight: `${I * 1.5 + 1.5}rem`
563
564
  },
564
- children: /* @__PURE__ */ y(n, {
565
+ children: /* @__PURE__ */ v(n, {
565
566
  gap: "2",
566
567
  style: { minHeight: `${I * 1.5}rem` },
567
- children: [/* @__PURE__ */ v(t, {
568
+ children: [/* @__PURE__ */ _(t, {
568
569
  className: "select-none shrink-0 text-right",
569
570
  style: {
570
571
  fontSize: "0.75rem",
@@ -572,75 +573,75 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
572
573
  minWidth: "1.25rem"
573
574
  },
574
575
  "aria-hidden": "true",
575
- children: Array.from({ length: Math.max(B, I) }, (e, n) => /* @__PURE__ */ v(t, {
576
+ children: Array.from({ length: Math.max(B, I) }, (e, n) => /* @__PURE__ */ _(t, {
576
577
  style: {
577
- height: `${Ve[n] ?? 24}px`,
578
+ height: `${He[n] ?? 24}px`,
578
579
  lineHeight: "1.5rem",
579
580
  color: n === Z ? "var(--foreground)" : "var(--muted-foreground)",
580
581
  opacity: n === Z ? .7 : .4
581
582
  },
582
583
  children: n + 1
583
584
  }, n))
584
- }), /* @__PURE__ */ v(t, {
585
+ }), /* @__PURE__ */ _(t, {
585
586
  className: "relative flex-1 min-w-0",
586
- children: /* @__PURE__ */ v(be, { editor: W })
587
+ children: /* @__PURE__ */ _(xe, { editor: W })
587
588
  })]
588
589
  })
589
590
  }),
590
- /* @__PURE__ */ y(i, {
591
+ /* @__PURE__ */ v(i, {
591
592
  size: "xs",
592
593
  tone: $ ? "warning" : "muted",
593
594
  weight: $ ? "medium" : "normal",
594
595
  className: "mt-1",
595
596
  children: [N.lineCount(B, I), $ && N.overLineLimit(I)]
596
597
  }),
597
- !O && Ee && /* @__PURE__ */ v(c, { children: /* @__PURE__ */ y(n, {
598
+ !D && De && /* @__PURE__ */ _(c, { children: /* @__PURE__ */ v(n, {
598
599
  align: "center",
599
600
  gap: "2",
600
601
  className: "mt-2",
601
602
  children: [
602
- /* @__PURE__ */ v(i, {
603
+ /* @__PURE__ */ _(i, {
603
604
  as: "span",
604
605
  size: "xs",
605
606
  tone: "muted",
606
607
  children: N.alignment
607
608
  }),
608
- /* @__PURE__ */ y(n, {
609
+ /* @__PURE__ */ v(n, {
609
610
  className: "rounded-md border overflow-hidden",
610
611
  children: [
611
- /* @__PURE__ */ y(o, { children: [/* @__PURE__ */ v(l, {
612
+ /* @__PURE__ */ v(o, { children: [/* @__PURE__ */ _(l, {
612
613
  asChild: !0,
613
- children: /* @__PURE__ */ v("button", {
614
+ children: /* @__PURE__ */ _("button", {
614
615
  type: "button",
615
616
  onClick: () => X("left"),
616
617
  "aria-label": N.alignLeft,
617
618
  className: e("px-3 py-1.5 text-xs transition-colors", Q === "left" ? "bg-primary text-primary-foreground" : "hover:bg-muted text-muted-foreground"),
618
- children: /* @__PURE__ */ v(he, { className: "w-4 h-4" })
619
+ children: /* @__PURE__ */ _(ge, { className: "w-4 h-4" })
619
620
  })
620
- }), /* @__PURE__ */ v(s, { children: N.alignLeft })] }),
621
- /* @__PURE__ */ y(o, { children: [/* @__PURE__ */ v(l, {
621
+ }), /* @__PURE__ */ _(s, { children: N.alignLeft })] }),
622
+ /* @__PURE__ */ v(o, { children: [/* @__PURE__ */ _(l, {
622
623
  asChild: !0,
623
- children: /* @__PURE__ */ v("button", {
624
+ children: /* @__PURE__ */ _("button", {
624
625
  type: "button",
625
626
  onClick: () => X("center"),
626
627
  "aria-label": N.alignCenter,
627
628
  className: e("px-3 py-1.5 text-xs border-x transition-colors", Q === "center" ? "bg-primary text-primary-foreground border-primary" : "hover:bg-muted text-muted-foreground"),
628
- children: /* @__PURE__ */ v(me, { className: "w-4 h-4" })
629
+ children: /* @__PURE__ */ _(he, { className: "w-4 h-4" })
629
630
  })
630
- }), /* @__PURE__ */ v(s, { children: N.alignCenter })] }),
631
- /* @__PURE__ */ y(o, { children: [/* @__PURE__ */ v(l, {
631
+ }), /* @__PURE__ */ _(s, { children: N.alignCenter })] }),
632
+ /* @__PURE__ */ v(o, { children: [/* @__PURE__ */ _(l, {
632
633
  asChild: !0,
633
- children: /* @__PURE__ */ v("button", {
634
+ children: /* @__PURE__ */ _("button", {
634
635
  type: "button",
635
636
  onClick: () => X("right"),
636
637
  "aria-label": N.alignRight,
637
638
  className: e("px-3 py-1.5 text-xs transition-colors", Q === "right" ? "bg-primary text-primary-foreground" : "hover:bg-muted text-muted-foreground"),
638
- children: /* @__PURE__ */ v(ge, { className: "w-4 h-4" })
639
+ children: /* @__PURE__ */ _(_e, { className: "w-4 h-4" })
639
640
  })
640
- }), /* @__PURE__ */ v(s, { children: N.alignRight })] })
641
+ }), /* @__PURE__ */ _(s, { children: N.alignRight })] })
641
642
  ]
642
643
  }),
643
- Z !== null && /* @__PURE__ */ v(i, {
644
+ Z !== null && /* @__PURE__ */ _(i, {
644
645
  as: "span",
645
646
  size: "xs",
646
647
  tone: "muted",
@@ -653,6 +654,6 @@ var w = p(function({ value: p, onChange: w, onFocus: we, placeholder: Te = "Type
653
654
  });
654
655
  });
655
656
  //#endregion
656
- export { S as DEFAULT_TEMPLATE_EDITOR_LABELS, w as TemplateEditor };
657
+ export { x as DEFAULT_TEMPLATE_EDITOR_LABELS, C as TemplateEditor };
657
658
 
658
659
  //# sourceMappingURL=template-editor.js.map