@fiestaboard/ui 3.1.0 → 3.2.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 (97) hide show
  1. package/dist/components/editor/color-picker-content.d.ts +25 -0
  2. package/dist/components/editor/color-picker-content.js +118 -0
  3. package/dist/components/editor/color-picker-content.js.map +1 -0
  4. package/dist/components/editor/constants.d.ts +87 -0
  5. package/dist/components/editor/constants.js +29 -0
  6. package/dist/components/editor/constants.js.map +1 -0
  7. package/dist/components/editor/draw-char-picker-content.d.ts +22 -0
  8. package/dist/components/editor/draw-char-picker-content.js +79 -0
  9. package/dist/components/editor/draw-char-picker-content.js.map +1 -0
  10. package/dist/components/editor/extensions/color-tile-node.d.ts +10 -0
  11. package/dist/components/editor/extensions/color-tile-node.js +43 -0
  12. package/dist/components/editor/extensions/color-tile-node.js.map +1 -0
  13. package/dist/components/editor/extensions/fill-space-node.d.ts +10 -0
  14. package/dist/components/editor/extensions/fill-space-node.js +40 -0
  15. package/dist/components/editor/extensions/fill-space-node.js.map +1 -0
  16. package/dist/components/editor/extensions/formula-node.d.ts +6 -0
  17. package/dist/components/editor/extensions/formula-node.js +40 -0
  18. package/dist/components/editor/extensions/formula-node.js.map +1 -0
  19. package/dist/components/editor/extensions/line-navigation.d.ts +18 -0
  20. package/dist/components/editor/extensions/line-navigation.js +16 -0
  21. package/dist/components/editor/extensions/line-navigation.js.map +1 -0
  22. package/dist/components/editor/extensions/single-paragraph-doc.d.ts +15 -0
  23. package/dist/components/editor/extensions/single-paragraph-doc.js +11 -0
  24. package/dist/components/editor/extensions/single-paragraph-doc.js.map +1 -0
  25. package/dist/components/editor/extensions/trailing-newline.d.ts +13 -0
  26. package/dist/components/editor/extensions/trailing-newline.js +27 -0
  27. package/dist/components/editor/extensions/trailing-newline.js.map +1 -0
  28. package/dist/components/editor/extensions/variable-node.d.ts +15 -0
  29. package/dist/components/editor/extensions/variable-node.js +56 -0
  30. package/dist/components/editor/extensions/variable-node.js.map +1 -0
  31. package/dist/components/editor/extensions/wrapped-text-node.d.ts +9 -0
  32. package/dist/components/editor/extensions/wrapped-text-node.js +31 -0
  33. package/dist/components/editor/extensions/wrapped-text-node.js.map +1 -0
  34. package/dist/components/editor/filter-picker-content.d.ts +24 -0
  35. package/dist/components/editor/filter-picker-content.js +146 -0
  36. package/dist/components/editor/filter-picker-content.js.map +1 -0
  37. package/dist/components/editor/formatting-picker-content.d.ts +30 -0
  38. package/dist/components/editor/formatting-picker-content.js +154 -0
  39. package/dist/components/editor/formatting-picker-content.js.map +1 -0
  40. package/dist/components/editor/formula/formula-editor-panel.d.ts +102 -0
  41. package/dist/components/editor/formula/formula-editor-panel.js +527 -0
  42. package/dist/components/editor/formula/formula-editor-panel.js.map +1 -0
  43. package/dist/components/editor/node-views/color-tile-node-view.d.ts +21 -0
  44. package/dist/components/editor/node-views/color-tile-node-view.js +66 -0
  45. package/dist/components/editor/node-views/color-tile-node-view.js.map +1 -0
  46. package/dist/components/editor/node-views/fill-space-node-view.d.ts +16 -0
  47. package/dist/components/editor/node-views/fill-space-node-view.js +43 -0
  48. package/dist/components/editor/node-views/fill-space-node-view.js.map +1 -0
  49. package/dist/components/editor/node-views/formula-node-view.d.ts +39 -0
  50. package/dist/components/editor/node-views/formula-node-view.js +109 -0
  51. package/dist/components/editor/node-views/formula-node-view.js.map +1 -0
  52. package/dist/components/editor/node-views/node-view-context.d.ts +58 -0
  53. package/dist/components/editor/node-views/node-view-context.js +22 -0
  54. package/dist/components/editor/node-views/node-view-context.js.map +1 -0
  55. package/dist/components/editor/node-views/variable-node-view.d.ts +16 -0
  56. package/dist/components/editor/node-views/variable-node-view.js +63 -0
  57. package/dist/components/editor/node-views/variable-node-view.js.map +1 -0
  58. package/dist/components/editor/node-views/wrapped-text-view.d.ts +14 -0
  59. package/dist/components/editor/node-views/wrapped-text-view.js +46 -0
  60. package/dist/components/editor/node-views/wrapped-text-view.js.map +1 -0
  61. package/dist/components/editor/template-editor-toolbar.d.ts +146 -0
  62. package/dist/components/editor/template-editor-toolbar.js +434 -0
  63. package/dist/components/editor/template-editor-toolbar.js.map +1 -0
  64. package/dist/components/editor/template-editor.d.ts +109 -0
  65. package/dist/components/editor/template-editor.js +662 -0
  66. package/dist/components/editor/template-editor.js.map +1 -0
  67. package/dist/components/editor/toolbar-dropdown.d.ts +20 -0
  68. package/dist/components/editor/toolbar-dropdown.js +88 -0
  69. package/dist/components/editor/toolbar-dropdown.js.map +1 -0
  70. package/dist/components/editor/utils/draw-mode.d.ts +55 -0
  71. package/dist/components/editor/utils/draw-mode.js +79 -0
  72. package/dist/components/editor/utils/draw-mode.js.map +1 -0
  73. package/dist/components/editor/utils/insertion.d.ts +11 -0
  74. package/dist/components/editor/utils/insertion.js +26 -0
  75. package/dist/components/editor/utils/insertion.js.map +1 -0
  76. package/dist/components/editor/utils/length-calculator.d.ts +36 -0
  77. package/dist/components/editor/utils/length-calculator.js +32 -0
  78. package/dist/components/editor/utils/length-calculator.js.map +1 -0
  79. package/dist/components/editor/utils/serialization.d.ts +34 -0
  80. package/dist/components/editor/utils/serialization.js +184 -0
  81. package/dist/components/editor/utils/serialization.js.map +1 -0
  82. package/dist/components/editor/utils/stroke-transaction.d.ts +36 -0
  83. package/dist/components/editor/utils/stroke-transaction.js +57 -0
  84. package/dist/components/editor/utils/stroke-transaction.js.map +1 -0
  85. package/dist/components/editor/variable-picker-content.d.ts +130 -0
  86. package/dist/components/editor/variable-picker-content.js +422 -0
  87. package/dist/components/editor/variable-picker-content.js.map +1 -0
  88. package/dist/editor.css +164 -0
  89. package/dist/index.d.ts +28 -0
  90. package/dist/index.js +41 -13
  91. package/dist/lib/board-colors.d.ts +16 -0
  92. package/dist/lib/board-colors.js +14 -14
  93. package/dist/lib/board-colors.js.map +1 -1
  94. package/dist/lib/use-deps-changed.d.ts +33 -0
  95. package/dist/lib/use-deps-changed.js +11 -0
  96. package/dist/lib/use-deps-changed.js.map +1 -0
  97. package/package.json +50 -2
@@ -0,0 +1,527 @@
1
+ "use client";
2
+ import { cn as e } from "../../../lib/utils.js";
3
+ import { Button as t } from "../../forms/button.js";
4
+ import { Box as n } from "../../layout/box.js";
5
+ import { Flex as r } from "../../layout/flex.js";
6
+ import { Tabs as i, TabsContent as a, TabsList as o, TabsTrigger as s } from "../../containment/tabs.js";
7
+ import { Skeleton as c } from "../../feedback/skeleton.js";
8
+ import { Text as l } from "../../typography/text.js";
9
+ import { Stack as u } from "../../layout/stack.js";
10
+ import { Tooltip as ee, TooltipContent as te, TooltipProvider as ne, TooltipTrigger as re } from "../../overlays/tooltip.js";
11
+ import { ArrowLeftRight as d, CheckCircle2 as ie, ChevronDown as ae, ChevronRight as oe, GitBranch as f, Hash as p, Loader2 as se, Palette as m, Type as h, XCircle as g } from "lucide-react";
12
+ import { Suspense as ce, useCallback as _, useEffect as v, useId as le, useRef as y, useState as b } from "react";
13
+ import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
14
+ import { history as ue, historyKeymap as de, indentWithTab as fe } from "@codemirror/commands";
15
+ import { HighlightStyle as w, StreamLanguage as T, syntaxHighlighting as pe } from "@codemirror/language";
16
+ import { EditorState as me } from "@codemirror/state";
17
+ import { EditorView as E, keymap as he } from "@codemirror/view";
18
+ import { tags as D } from "@lezer/highlight";
19
+ //#region src/components/editor/formula/formula-editor-panel.tsx
20
+ function O(e) {
21
+ let t = "", n = 0, r = !1, i = !1;
22
+ for (let a = 0; a < e.length; a++) {
23
+ let o = e[a];
24
+ if (r) {
25
+ t += o, o === "\"" && (r = !1);
26
+ continue;
27
+ }
28
+ if (o === "\"") {
29
+ r = !0, i = !1, t += o;
30
+ continue;
31
+ }
32
+ i && o === " " || (i = !1, o === "(" ? (n++, t += "(\n" + " ".repeat(n), i = !0) : o === ")" ? (n--, t += "\n" + " ".repeat(n) + ")") : o === "," ? (t += ",\n" + " ".repeat(n), i = !0) : t += o);
33
+ }
34
+ return t.trim();
35
+ }
36
+ function k(e) {
37
+ let t = "", n = !1, r = !1;
38
+ for (let i of e) n ? (t += i, i === "\"" && (n = !1), r = !1) : i === "\"" ? (n = !0, t += i, r = !1) : i === "\n" ? r = !0 : i === " " && r || (t += i, r = !1);
39
+ return t.trim();
40
+ }
41
+ var ge = T.define({
42
+ token(e) {
43
+ return e.eatSpace() ? null : e.match(/"[^"]*"/) ? "string" : e.match(/\d+\.?\d*/) ? "number" : e.match(/[a-z_][a-z0-9_]*(?:\.[a-z_][a-z0-9_]*)*/) ? "variable" : e.match(/[A-Z][A-Z0-9_]*/) ? "function" : e.match(/[<>]=?|[!=]=|[+\-*/]/) ? "operator" : e.match(/[(),]/) ? "punctuation" : (e.next(), null);
44
+ },
45
+ tokenTable: {
46
+ string: D.string,
47
+ number: D.number,
48
+ variable: D.variableName,
49
+ function: D.keyword,
50
+ operator: D.operator,
51
+ punctuation: D.punctuation
52
+ }
53
+ }), _e = w.define([
54
+ {
55
+ tag: D.keyword,
56
+ color: "var(--fiesta-formula-function)",
57
+ fontWeight: "600"
58
+ },
59
+ {
60
+ tag: D.string,
61
+ color: "var(--fiesta-formula-string)"
62
+ },
63
+ {
64
+ tag: D.number,
65
+ color: "var(--fiesta-formula-number)"
66
+ },
67
+ {
68
+ tag: D.variableName,
69
+ color: "var(--fiesta-formula-variable)"
70
+ },
71
+ {
72
+ tag: D.operator,
73
+ color: "var(--muted-foreground)"
74
+ },
75
+ {
76
+ tag: D.punctuation,
77
+ color: "var(--muted-foreground)"
78
+ }
79
+ ]), ve = E.theme({
80
+ "&": {
81
+ fontSize: "0.75rem",
82
+ fontFamily: "var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace)",
83
+ background: "var(--background)",
84
+ height: "100%",
85
+ "--fiesta-formula-function": "#8b5cf6",
86
+ "--fiesta-formula-string": "#16a34a",
87
+ "--fiesta-formula-number": "#ea580c",
88
+ "--fiesta-formula-variable": "#0284c7"
89
+ },
90
+ ".dark &": {
91
+ "--fiesta-formula-function": "#a78bfa",
92
+ "--fiesta-formula-string": "#4ade80",
93
+ "--fiesta-formula-number": "#fb923c",
94
+ "--fiesta-formula-variable": "#38bdf8"
95
+ },
96
+ ".cm-scroller": { overflow: "auto" },
97
+ ".cm-content": {
98
+ padding: "0.375rem 0.625rem",
99
+ caretColor: "var(--foreground)",
100
+ color: "var(--foreground)",
101
+ minHeight: "5rem"
102
+ },
103
+ ".cm-focused": { outline: "none" },
104
+ ".cm-line": { padding: "0" },
105
+ ".cm-cursor, .cm-dropCursor": { borderLeftColor: "var(--foreground)" },
106
+ ".cm-selectionBackground": { background: "var(--muted) !important" },
107
+ "&.cm-focused .cm-selectionBackground": { background: "var(--accent) !important" },
108
+ ".cm-gutters": { display: "none" },
109
+ ".cm-placeholder": { color: "var(--muted-foreground)" }
110
+ }), A = [
111
+ "logic",
112
+ "math",
113
+ "text",
114
+ "convert",
115
+ "color"
116
+ ], ye = {
117
+ logic: {
118
+ icon: f,
119
+ text: "text-violet-400",
120
+ border: "border-l-violet-400/60"
121
+ },
122
+ math: {
123
+ icon: p,
124
+ text: "text-emerald-400",
125
+ border: "border-l-emerald-400/60"
126
+ },
127
+ text: {
128
+ icon: h,
129
+ text: "text-sky-400",
130
+ border: "border-l-sky-400/60"
131
+ },
132
+ convert: {
133
+ icon: d,
134
+ text: "text-amber-400",
135
+ border: "border-l-amber-400/60"
136
+ },
137
+ color: {
138
+ icon: m,
139
+ text: "text-pink-400",
140
+ border: "border-l-pink-400/60"
141
+ }
142
+ };
143
+ function j(e, t) {
144
+ return Object.hasOwn(e, t) ? e[t] : void 0;
145
+ }
146
+ var M = {
147
+ functionsTab: "Functions",
148
+ variablesTab: "Variables",
149
+ loading: "Loading…",
150
+ formulaExpression: "Formula expression",
151
+ insert: "Insert",
152
+ done: "Done",
153
+ cancel: "Cancel",
154
+ close: "Close",
155
+ categoryLogic: "Logic",
156
+ categoryMath: "Math",
157
+ categoryText: "Text",
158
+ categoryConversion: "Conversion",
159
+ categoryColor: "Color"
160
+ };
161
+ function be({ render: e, onInsert: t }) {
162
+ return /* @__PURE__ */ S(x, { children: e({ onInsert: t }) });
163
+ }
164
+ function N(e, t, n, r) {
165
+ let i = e.trim();
166
+ return i ? !n || t === "valid" && r === i : !1;
167
+ }
168
+ function P({ initialExpr: d = "", mode: f, onConfirm: p, onCancel: m, formulaFunctions: h, isLoadingFunctions: x = !1, validateExpression: w, renderVariablePicker: T, labels: D, className: P }) {
169
+ let F = {
170
+ ...M,
171
+ ...D
172
+ }, xe = {
173
+ logic: F.categoryLogic,
174
+ math: F.categoryMath,
175
+ text: F.categoryText,
176
+ convert: F.categoryConversion,
177
+ color: F.categoryColor
178
+ }, I = w !== void 0, L = le(), [R, z] = b(d), [B, V] = b(d && I ? "validating" : "idle"), [H, U] = b(null), [Se, Ce] = b(/* @__PURE__ */ new Set()), W = y(null), G = y(null), K = y(null), q = y(R);
179
+ v(() => {
180
+ q.current = R;
181
+ }, [R]);
182
+ let J = y(null), [we, Y] = b(null), Te = y({
183
+ expr: R,
184
+ validationState: B,
185
+ hasValidator: I,
186
+ onConfirm: p
187
+ });
188
+ v(() => {
189
+ Te.current = {
190
+ expr: R,
191
+ validationState: B,
192
+ hasValidator: I,
193
+ onConfirm: p
194
+ };
195
+ }, [
196
+ R,
197
+ B,
198
+ I,
199
+ p
200
+ ]);
201
+ let Ee = y(w);
202
+ v(() => {
203
+ Ee.current = w;
204
+ }, [w]);
205
+ let X = _((e) => {
206
+ K.current && clearTimeout(K.current);
207
+ let t = e.trim();
208
+ t && (K.current = setTimeout(async () => {
209
+ let e = Ee.current;
210
+ if (e && q.current.trim() === t) try {
211
+ let n = await e(t);
212
+ if (q.current.trim() !== t) return;
213
+ n.valid ? (J.current = t, Y(t), V("valid"), U(null)) : (J.current = null, Y(null), V("invalid"), U(n.error ? n.error.replace(/^Formula\s+/, "") : null));
214
+ } catch {
215
+ V("idle"), U(null);
216
+ }
217
+ }, 300));
218
+ }, []), Z = _((e) => {
219
+ if (!e.trim() || !I) {
220
+ K.current && clearTimeout(K.current), J.current = null, Y(null), V("idle"), U(null);
221
+ return;
222
+ }
223
+ V("validating"), X(e);
224
+ }, [I, X]), Q = y(Z);
225
+ v(() => {
226
+ Q.current = Z;
227
+ }, [Z]), v(() => (X(d), () => {
228
+ K.current && clearTimeout(K.current);
229
+ }), [d, X]), v(() => {
230
+ if (!W.current) return;
231
+ let e = new E({
232
+ state: me.create({
233
+ doc: O(d),
234
+ extensions: [
235
+ ge,
236
+ pe(_e),
237
+ ve,
238
+ ue(),
239
+ E.lineWrapping,
240
+ E.contentAttributes.of({ "aria-labelledby": L }),
241
+ he.of([
242
+ ...de,
243
+ fe,
244
+ {
245
+ key: "Mod-Enter",
246
+ run: () => {
247
+ let { expr: e, validationState: t, hasValidator: n, onConfirm: r } = Te.current;
248
+ return N(e, t, n, J.current) ? (r(e.trim()), !0) : !1;
249
+ }
250
+ }
251
+ ]),
252
+ E.updateListener.of((e) => {
253
+ if (!e.docChanged) return;
254
+ let t = k(e.state.doc.toString());
255
+ z(t), Q.current(t);
256
+ }),
257
+ E.domEventHandlers({ mousedown: (e) => e.stopPropagation() })
258
+ ]
259
+ }),
260
+ parent: W.current
261
+ });
262
+ return G.current = e, e.focus(), f === "edit" && d && e.dispatch({ selection: {
263
+ anchor: 0,
264
+ head: e.state.doc.length
265
+ } }), () => {
266
+ e.destroy(), G.current = null;
267
+ };
268
+ }, []), v(() => {
269
+ let e = G.current;
270
+ if (!e || k(e.state.doc.toString()) === R) return;
271
+ let t = O(R);
272
+ e.dispatch({
273
+ changes: {
274
+ from: 0,
275
+ to: e.state.doc.length,
276
+ insert: t
277
+ },
278
+ selection: { anchor: t.length }
279
+ });
280
+ }, [R]);
281
+ let De = () => {
282
+ N(R, B, I, we) && p(R.trim());
283
+ }, Oe = (e) => {
284
+ let t = `${e}()`, n = G.current;
285
+ if (!n) return;
286
+ let r = O(t), i = r.indexOf("\n"), a = i >= 0 ? r.indexOf("\n", i + 1) : -1, o = a >= 0 ? a : r.length;
287
+ n.dispatch({
288
+ changes: {
289
+ from: 0,
290
+ to: n.state.doc.length,
291
+ insert: r
292
+ },
293
+ selection: { anchor: o }
294
+ }), n.focus(), z(t);
295
+ }, ke = (e) => {
296
+ let t = e.replace(/^\{\{/, "").replace(/\}\}$/, ""), n = G.current;
297
+ if (!n) return;
298
+ let r = n.state.selection.main.head;
299
+ n.dispatch({
300
+ changes: {
301
+ from: r,
302
+ to: r,
303
+ insert: t
304
+ },
305
+ selection: { anchor: r + t.length }
306
+ }), n.focus();
307
+ let i = k(n.state.doc.toString());
308
+ z(i);
309
+ }, Ae = (e) => {
310
+ Ce((t) => {
311
+ let n = new Set(t);
312
+ return n.has(e) ? n.delete(e) : n.add(e), n;
313
+ });
314
+ }, je = !N(R, B, I, we), $ = /* @__PURE__ */ new Map();
315
+ for (let e of h ?? []) {
316
+ let t = $.get(e.category);
317
+ t ? t.push(e) : $.set(e.category, [e]);
318
+ }
319
+ for (let e of $.values()) e.sort((e, t) => e.name.localeCompare(t.name));
320
+ let Me = [...A.filter((e) => $.get(e)?.length), ...[...$.keys()].filter((e) => !A.includes(e)).sort((e, t) => e.localeCompare(t))];
321
+ return /* @__PURE__ */ S(ne, { children: /* @__PURE__ */ C(r, {
322
+ "data-slot": "formula-editor-panel",
323
+ direction: "col",
324
+ className: e("sm:flex-row w-full sm:h-[560px]", P),
325
+ children: [/* @__PURE__ */ S(n, {
326
+ className: e("order-2 sm:order-1", "sm:w-[260px] sm:flex-shrink-0", "border-t sm:border-t-0 sm:border-r border-border", "sm:overflow-y-auto"),
327
+ children: /* @__PURE__ */ C(i, {
328
+ defaultValue: "functions",
329
+ children: [
330
+ T && /* @__PURE__ */ S(n, {
331
+ className: "px-3 pt-2 pb-1 sm:sticky sm:top-0 sm:bg-popover sm:z-10 sm:border-b sm:border-border/50",
332
+ children: /* @__PURE__ */ C(o, {
333
+ className: "h-8 w-full bg-muted p-0.5",
334
+ children: [/* @__PURE__ */ S(s, {
335
+ value: "functions",
336
+ className: "flex-1 h-full text-xs px-2 data-[active]:bg-background data-[active]:shadow-sm",
337
+ children: F.functionsTab
338
+ }), /* @__PURE__ */ S(s, {
339
+ value: "variables",
340
+ className: "flex-1 h-full text-xs px-2 data-[active]:bg-background data-[active]:shadow-sm",
341
+ children: F.variablesTab
342
+ })]
343
+ })
344
+ }),
345
+ /* @__PURE__ */ C(a, {
346
+ value: "functions",
347
+ className: "mt-0",
348
+ children: [x && /* @__PURE__ */ C(u, {
349
+ gap: "1.5",
350
+ className: "px-3 py-2",
351
+ role: "status",
352
+ "aria-label": F.loading,
353
+ children: [
354
+ /* @__PURE__ */ S(c, { className: "h-3 w-2/3" }),
355
+ /* @__PURE__ */ S(c, { className: "h-3 w-1/2" }),
356
+ /* @__PURE__ */ S(c, { className: "h-3 w-3/4" })
357
+ ]
358
+ }), /* @__PURE__ */ S(u, {
359
+ gap: "1",
360
+ className: "px-2 pb-2",
361
+ children: Me.map((t) => {
362
+ let r = Se.has(t), i = $.get(t) ?? [], a = j(ye, t), o = a?.icon, s = `${L}-cat-${t}`;
363
+ return /* @__PURE__ */ C(n, {
364
+ className: e("overflow-hidden border-l-2", a?.border ?? "border-border/0"),
365
+ children: [/* @__PURE__ */ C("button", {
366
+ type: "button",
367
+ onClick: () => Ae(t),
368
+ "aria-expanded": !r,
369
+ "aria-controls": s,
370
+ className: e("flex items-center justify-between w-full px-2 py-1.5 text-[11px] font-semibold transition-colors", "bg-muted/40 hover:bg-muted/70", "outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", a?.text ?? "text-muted-foreground"),
371
+ children: [/* @__PURE__ */ C(l, {
372
+ as: "span",
373
+ weight: "semibold",
374
+ className: e("flex items-center gap-1.5 text-[11px]", a?.text ?? "text-muted-foreground"),
375
+ children: [o && /* @__PURE__ */ S(o, { className: "w-3 h-3" }), j(xe, t) ?? t]
376
+ }), S(r ? oe : ae, { className: "w-3 h-3 text-muted-foreground" })]
377
+ }), !r && /* @__PURE__ */ S(n, {
378
+ id: s,
379
+ className: "py-0.5",
380
+ children: i.map((e) => /* @__PURE__ */ C(ee, { children: [/* @__PURE__ */ S(re, {
381
+ asChild: !0,
382
+ children: /* @__PURE__ */ C("button", {
383
+ type: "button",
384
+ onClick: () => Oe(e.name),
385
+ className: "w-full text-left px-3 py-1 text-xs hover:bg-accent hover:text-accent-foreground transition-colors flex items-baseline gap-2 group outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",
386
+ children: [/* @__PURE__ */ S(l, {
387
+ as: "span",
388
+ size: "xs",
389
+ weight: "semibold",
390
+ className: "font-mono flex-shrink-0 group-hover:text-accent-foreground",
391
+ children: e.name
392
+ }), /* @__PURE__ */ S(l, {
393
+ as: "span",
394
+ tone: "muted",
395
+ className: "font-mono text-[10px] truncate group-hover:text-accent-foreground/70",
396
+ children: e.signature
397
+ })]
398
+ })
399
+ }), /* @__PURE__ */ C(te, {
400
+ side: "right",
401
+ className: "max-w-[220px]",
402
+ children: [/* @__PURE__ */ S(l, {
403
+ size: "xs",
404
+ weight: "semibold",
405
+ className: "font-mono",
406
+ children: e.signature
407
+ }), /* @__PURE__ */ S(l, {
408
+ size: "xs",
409
+ tone: "muted",
410
+ className: "mt-0.5",
411
+ children: e.summary
412
+ })]
413
+ })] }, e.name))
414
+ })]
415
+ }, t);
416
+ })
417
+ })]
418
+ }),
419
+ T && /* @__PURE__ */ S(a, {
420
+ value: "variables",
421
+ className: "mt-0",
422
+ children: /* @__PURE__ */ S(ce, {
423
+ fallback: /* @__PURE__ */ C(n, {
424
+ className: "p-3 min-w-[300px]",
425
+ children: [
426
+ /* @__PURE__ */ S(c, { className: "h-4 w-full mb-2" }),
427
+ /* @__PURE__ */ S(c, { className: "h-4 w-3/4 mb-2" }),
428
+ /* @__PURE__ */ S(c, { className: "h-4 w-1/2" })
429
+ ]
430
+ }),
431
+ children: /* @__PURE__ */ S(be, {
432
+ render: T,
433
+ onInsert: ke
434
+ })
435
+ })
436
+ })
437
+ ]
438
+ })
439
+ }), /* @__PURE__ */ C(r, {
440
+ direction: "col",
441
+ className: "order-1 sm:order-2 flex-1 min-w-0 sm:overflow-hidden",
442
+ children: [/* @__PURE__ */ C(u, {
443
+ gap: "1.5",
444
+ className: "px-3 pt-3 pb-2.5 sm:flex-1 sm:flex sm:flex-col sm:overflow-hidden",
445
+ children: [
446
+ /* @__PURE__ */ S(l, {
447
+ as: "span",
448
+ id: L,
449
+ tone: "muted",
450
+ weight: "semibold",
451
+ className: "text-[10px] uppercase tracking-widest",
452
+ children: F.formulaExpression
453
+ }),
454
+ /* @__PURE__ */ C(n, {
455
+ className: e("rounded-md border overflow-hidden sm:flex-1 sm:flex sm:flex-col sm:min-h-0", B === "invalid" && "border-destructive", B === "valid" && "border-success", B !== "invalid" && B !== "valid" && "border-border"),
456
+ children: [
457
+ /* @__PURE__ */ C(r, {
458
+ align: "center",
459
+ justify: "between",
460
+ className: e("px-2.5 py-1 border-b sm:flex-shrink-0", "bg-muted/20 select-none", B === "invalid" && "border-destructive/40", B === "valid" && "border-success/40", B !== "invalid" && B !== "valid" && "border-border"),
461
+ children: [/* @__PURE__ */ S(l, {
462
+ as: "span",
463
+ className: "text-[10px] text-muted-foreground/50 font-mono",
464
+ children: "{{="
465
+ }), /* @__PURE__ */ S(l, {
466
+ as: "span",
467
+ className: "flex items-center",
468
+ children: B === "valid" && R.trim() ? /* @__PURE__ */ S(ie, { className: "w-3.5 h-3.5 text-success" }) : B === "invalid" ? /* @__PURE__ */ S(g, { className: "w-3.5 h-3.5 text-destructive" }) : B === "validating" ? /* @__PURE__ */ S(se, { className: "w-3.5 h-3.5 text-muted-foreground/50 animate-spin motion-reduce:animate-none" }) : null
469
+ })]
470
+ }),
471
+ /* @__PURE__ */ S(n, {
472
+ ref: W,
473
+ className: "sm:flex-1 sm:min-h-0 sm:overflow-hidden"
474
+ }),
475
+ /* @__PURE__ */ S(n, {
476
+ className: e("px-2.5 py-1 border-t bg-muted/20 select-none sm:flex-shrink-0", B === "invalid" && "border-destructive/40", B === "valid" && "border-success/40", B !== "invalid" && B !== "valid" && "border-border"),
477
+ children: /* @__PURE__ */ S(l, {
478
+ as: "span",
479
+ className: "text-[10px] text-muted-foreground/50 font-mono",
480
+ children: "}}"
481
+ })
482
+ })
483
+ ]
484
+ }),
485
+ B === "invalid" && H && /* @__PURE__ */ C(r, {
486
+ align: "start",
487
+ gap: "1",
488
+ role: "alert",
489
+ className: "text-destructive",
490
+ children: [/* @__PURE__ */ S(g, { className: "w-3 h-3 flex-shrink-0 mt-0.5" }), /* @__PURE__ */ S(l, {
491
+ as: "span",
492
+ tone: "destructive",
493
+ className: "text-[10px]",
494
+ children: H
495
+ })]
496
+ })
497
+ ]
498
+ }), /* @__PURE__ */ C(r, {
499
+ justify: "end",
500
+ gap: "2",
501
+ className: "flex-shrink-0 border-t border-border px-3 py-2",
502
+ children: [f === "edit" && m && /* @__PURE__ */ S(t, {
503
+ type: "button",
504
+ variant: "outline",
505
+ size: "sm",
506
+ onClick: m,
507
+ className: "text-xs",
508
+ children: d ? F.close : F.cancel
509
+ }), /* @__PURE__ */ C(t, {
510
+ type: "button",
511
+ size: "sm",
512
+ onClick: De,
513
+ disabled: je,
514
+ className: "text-xs",
515
+ children: [f === "create" ? F.insert : F.done, /* @__PURE__ */ S("kbd", {
516
+ className: "hidden sm:inline-flex items-center gap-0.5 px-1 py-0.5 rounded-sm text-[9px] font-sans opacity-60 bg-primary-foreground/20",
517
+ children: "⌘↵"
518
+ })]
519
+ })]
520
+ })]
521
+ })]
522
+ }) });
523
+ }
524
+ //#endregion
525
+ export { M as DEFAULT_FORMULA_EDITOR_LABELS, P as FormulaEditorPanel };
526
+
527
+ //# sourceMappingURL=formula-editor-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formula-editor-panel.js","names":[],"sources":["../../../../src/components/editor/formula/formula-editor-panel.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,SAAS,EAAc,GAAsB;CAC3C,IAAI,IAAS,IACT,IAAQ,GACR,IAAW,IACX,IAAa;CAGjB,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EAAE;IACrB,CAAA,GAEV,kBAAC,GAAD;KAAQ,MAAK;KAAS,MAAK;KAAK,SAAS;KAAe,UAAU;KAAmB,WAAU;KAA/F,UAAA,CACG,MAAS,WAAW,EAAE,SAAS,EAAE,MAClC,kBAAC,OAAD;MAAK,WAAU;MAA6H,UAAA;KAEvI,CAAA,CACC;IACJ,CAAA,CAAA;GACF,CAAA,CAAA;EACF,CAAA,CAAA;CACS,CAAA,EAAA,CAAA;AAErB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * React NodeView for Color Tile nodes
3
+ * Displays {{red}}, {{blue}}, etc. as solid colored tiles
4
+ * Can be dragged and dropped, deleted with backspace, and copied/pasted
5
+ */
6
+ import type { ReactNodeViewProps } from "@tiptap/react";
7
+ export interface ColorTileNodeViewLabels {
8
+ /** Tile tooltip. `color` is the token name, `code` the hardware color code. */
9
+ colorTileTooltip: (color: string, code: number) => string;
10
+ /**
11
+ * Accessible name for the tile. The app hard-coded this one in English while
12
+ * translating its sibling tooltip, so screen-reader users got the untranslated
13
+ * string; it is a label here like every other user-visible string.
14
+ */
15
+ colorTileAriaLabel: (color: string) => string;
16
+ }
17
+ export declare const DEFAULT_COLOR_TILE_NODE_VIEW_LABELS: ColorTileNodeViewLabels;
18
+ export type ColorTileNodeViewProps = ReactNodeViewProps & {
19
+ labels?: Partial<ColorTileNodeViewLabels>;
20
+ };
21
+ export declare function ColorTileNodeView({ node, labels }: ColorTileNodeViewProps): import("react").JSX.Element;
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { cn as e } from "../../../lib/utils.js";
3
+ import { Box as t } from "../../layout/box.js";
4
+ import { Text as n } from "../../typography/text.js";
5
+ import { Tooltip as r, TooltipContent as i, TooltipProvider as a, TooltipTrigger as o } from "../../overlays/tooltip.js";
6
+ import { BOARD_COLORS as s, getBoardColor as c, isValidBoardColor as l } from "../../../lib/board-colors.js";
7
+ import { useNodeViewInjection as u } from "./node-view-context.js";
8
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ import { NodeViewWrapper as p } from "@tiptap/react";
10
+ //#region src/components/editor/node-views/color-tile-node-view.tsx
11
+ var m = {
12
+ colorTileTooltip: (e, t) => `${e} tile (code ${t}) - drag to move, backspace to delete`,
13
+ colorTileAriaLabel: (e) => `${e} color tile`
14
+ };
15
+ function h({ node: h, labels: g }) {
16
+ let _ = u(), v = {
17
+ ...m,
18
+ ..._.labels,
19
+ ...g
20
+ }, { color: y, code: b } = h.attrs, x = l(y) ? c(y) : s.red;
21
+ return /* @__PURE__ */ d(a, { children: /* @__PURE__ */ f(r, { children: [/* @__PURE__ */ d(o, {
22
+ asChild: !0,
23
+ children: /* @__PURE__ */ f(p, {
24
+ as: "span",
25
+ className: e("relative rounded-[3px] cursor-grab", "transition-all duration-control", "hover:scale-105", "active:cursor-grabbing active:scale-100"),
26
+ "data-drag-handle": !0,
27
+ style: {
28
+ backgroundColor: x,
29
+ width: "1.5ch",
30
+ height: "1rem",
31
+ maxHeight: "1rem",
32
+ minHeight: "1rem",
33
+ boxShadow: "\n 0 2px 4px rgba(0,0,0,0.3),\n inset 0 1px 1px rgba(255,255,255,0.15),\n inset 0 -1px 1px rgba(0,0,0,0.25),\n inset 1px 0 1px rgba(255,255,255,0.1),\n inset -1px 0 1px rgba(0,0,0,0.2)\n ",
34
+ display: "inline-block",
35
+ verticalAlign: "middle",
36
+ marginLeft: "1px",
37
+ marginRight: "1px",
38
+ whiteSpace: "nowrap"
39
+ },
40
+ children: [
41
+ /* @__PURE__ */ d(t, { className: "absolute top-1/2 left-0 right-0 h-[1px] bg-black/10" }),
42
+ /* @__PURE__ */ d(t, {
43
+ className: "absolute inset-0 pointer-events-none rounded-[3px]",
44
+ style: { background: "linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 50%, rgba(0,0,0,0.2) 100%)" }
45
+ }),
46
+ /* @__PURE__ */ d("span", {
47
+ "aria-label": v.colorTileAriaLabel(y),
48
+ style: {
49
+ position: "absolute",
50
+ inset: 0,
51
+ color: "transparent",
52
+ overflow: "hidden",
53
+ lineHeight: "1rem",
54
+ fontSize: "1rem",
55
+ pointerEvents: "none"
56
+ },
57
+ children: "█"
58
+ })
59
+ ]
60
+ })
61
+ }), /* @__PURE__ */ d(i, { children: /* @__PURE__ */ d(n, { children: v.colorTileTooltip(y, b) }) })] }) });
62
+ }
63
+ //#endregion
64
+ export { h as ColorTileNodeView, m as DEFAULT_COLOR_TILE_NODE_VIEW_LABELS };
65
+
66
+ //# sourceMappingURL=color-tile-node-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-tile-node-view.js","names":[],"sources":["../../../../src/components/editor/node-views/color-tile-node-view.tsx"],"mappings":";;;;;;;;;;AAkCA,IAAa,IAA+D;CAC1E,mBAAmB,GAAO,MAAS,GAAG,EAAM,cAAc,EAAK;CAC/D,qBAAqB,MAAU,GAAG,EAAM;AAC1C;AAMA,SAAgB,EAAkB,EAAE,SAAM,aAAkC;CAC1E,IAAM,IAAW,EAAqB,GAChC,IAAI;EAAE,GAAG;EAAqC,GAAG,EAAS;EAAQ,GAAG;CAAO,GAC5E,EAAE,UAAO,YAAS,EAAK,OAavB,IAAU,EAAkB,CAAK,IAAI,EAAc,CAAK,IAAI,EAAa;CAW/E,OACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;EAAgB,SAAA;EACd,UAAA,kBAAC,GAAD;GACE,IAAG;GACH,WAAW,EACT,sCACA,mCACA,mBACA,yCACF;GACA,oBAAA;GACA,OAAO;IACL,iBAAiB;IACjB,OAAO;IACP,QAAQ;IACR,WAAW;IACX,WAAW;IACX,WAAA;IACA,SAAS;IACT,eAAe;IACf,YAAY;IACZ,aAAa;IACb,YAAY;GACd;GArBF,UAAA;IAwBE,kBAAC,GAAD,EAAK,WAAU,sDAAuD,CAAA;IAGtE,kBAAC,GAAD;KACE,WAAU;KACV,OAAO,EACL,YAAY,4FACd;IACD,CAAA;IASD,kBAAC,QAAD;KACE,cAAY,EAAE,mBAAmB,CAAK;KACtC,OAAO;MACL,UAAU;MACV,OAAO;MACP,OAAO;MACP,UAAU;MACV,YAAY;MACZ,UAAU;MACV,eAAe;KACjB;KAEC,UAAA;IACG,CAAA;GACS;;CACH,CAAA,GAChB,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAA,UAAO,EAAE,iBAAiB,GAAO,CAAI,EAAQ,CAAA,EAC/B,CAAA,CACT,EAAA,CAAA,EACM,CAAA;AAErB"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * React NodeView for FillSpace nodes
3
+ * Displays {{fill_space}} as an expandable ruler with estimated expansion
4
+ */
5
+ import type { ReactNodeViewProps } from "@tiptap/react";
6
+ export interface FillSpaceNodeViewLabels {
7
+ /** Tooltip for a plain `{{fill_space}}`. */
8
+ fillSpaceTooltip: string;
9
+ /** Tooltip for `{{fill_space_repeat:x}}`. `char` is the repeated character. */
10
+ fillSpaceRepeatTooltip: (char: string) => string;
11
+ }
12
+ export declare const DEFAULT_FILL_SPACE_NODE_VIEW_LABELS: FillSpaceNodeViewLabels;
13
+ export type FillSpaceNodeViewProps = ReactNodeViewProps & {
14
+ labels?: Partial<FillSpaceNodeViewLabels>;
15
+ };
16
+ export declare function FillSpaceNodeView({ node, labels }: FillSpaceNodeViewProps): import("react").JSX.Element;