@fiestaboard/ui 3.0.1 → 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.
- package/dist/components/containment/json-tree.d.ts +59 -0
- package/dist/components/containment/json-tree.js +122 -0
- package/dist/components/containment/json-tree.js.map +1 -0
- package/dist/components/editor/color-picker-content.d.ts +25 -0
- package/dist/components/editor/color-picker-content.js +118 -0
- package/dist/components/editor/color-picker-content.js.map +1 -0
- package/dist/components/editor/constants.d.ts +87 -0
- package/dist/components/editor/constants.js +29 -0
- package/dist/components/editor/constants.js.map +1 -0
- package/dist/components/editor/draw-char-picker-content.d.ts +22 -0
- package/dist/components/editor/draw-char-picker-content.js +79 -0
- package/dist/components/editor/draw-char-picker-content.js.map +1 -0
- package/dist/components/editor/extensions/color-tile-node.d.ts +10 -0
- package/dist/components/editor/extensions/color-tile-node.js +43 -0
- package/dist/components/editor/extensions/color-tile-node.js.map +1 -0
- package/dist/components/editor/extensions/fill-space-node.d.ts +10 -0
- package/dist/components/editor/extensions/fill-space-node.js +40 -0
- package/dist/components/editor/extensions/fill-space-node.js.map +1 -0
- package/dist/components/editor/extensions/formula-node.d.ts +6 -0
- package/dist/components/editor/extensions/formula-node.js +40 -0
- package/dist/components/editor/extensions/formula-node.js.map +1 -0
- package/dist/components/editor/extensions/line-navigation.d.ts +18 -0
- package/dist/components/editor/extensions/line-navigation.js +16 -0
- package/dist/components/editor/extensions/line-navigation.js.map +1 -0
- package/dist/components/editor/extensions/single-paragraph-doc.d.ts +15 -0
- package/dist/components/editor/extensions/single-paragraph-doc.js +11 -0
- package/dist/components/editor/extensions/single-paragraph-doc.js.map +1 -0
- package/dist/components/editor/extensions/trailing-newline.d.ts +13 -0
- package/dist/components/editor/extensions/trailing-newline.js +27 -0
- package/dist/components/editor/extensions/trailing-newline.js.map +1 -0
- package/dist/components/editor/extensions/variable-node.d.ts +15 -0
- package/dist/components/editor/extensions/variable-node.js +56 -0
- package/dist/components/editor/extensions/variable-node.js.map +1 -0
- package/dist/components/editor/extensions/wrapped-text-node.d.ts +9 -0
- package/dist/components/editor/extensions/wrapped-text-node.js +31 -0
- package/dist/components/editor/extensions/wrapped-text-node.js.map +1 -0
- package/dist/components/editor/filter-picker-content.d.ts +24 -0
- package/dist/components/editor/filter-picker-content.js +146 -0
- package/dist/components/editor/filter-picker-content.js.map +1 -0
- package/dist/components/editor/formatting-picker-content.d.ts +30 -0
- package/dist/components/editor/formatting-picker-content.js +154 -0
- package/dist/components/editor/formatting-picker-content.js.map +1 -0
- package/dist/components/editor/formula/formula-editor-panel.d.ts +102 -0
- package/dist/components/editor/formula/formula-editor-panel.js +527 -0
- package/dist/components/editor/formula/formula-editor-panel.js.map +1 -0
- package/dist/components/editor/node-views/color-tile-node-view.d.ts +21 -0
- package/dist/components/editor/node-views/color-tile-node-view.js +66 -0
- package/dist/components/editor/node-views/color-tile-node-view.js.map +1 -0
- package/dist/components/editor/node-views/fill-space-node-view.d.ts +16 -0
- package/dist/components/editor/node-views/fill-space-node-view.js +43 -0
- package/dist/components/editor/node-views/fill-space-node-view.js.map +1 -0
- package/dist/components/editor/node-views/formula-node-view.d.ts +39 -0
- package/dist/components/editor/node-views/formula-node-view.js +109 -0
- package/dist/components/editor/node-views/formula-node-view.js.map +1 -0
- package/dist/components/editor/node-views/node-view-context.d.ts +58 -0
- package/dist/components/editor/node-views/node-view-context.js +22 -0
- package/dist/components/editor/node-views/node-view-context.js.map +1 -0
- package/dist/components/editor/node-views/variable-node-view.d.ts +16 -0
- package/dist/components/editor/node-views/variable-node-view.js +63 -0
- package/dist/components/editor/node-views/variable-node-view.js.map +1 -0
- package/dist/components/editor/node-views/wrapped-text-view.d.ts +14 -0
- package/dist/components/editor/node-views/wrapped-text-view.js +46 -0
- package/dist/components/editor/node-views/wrapped-text-view.js.map +1 -0
- package/dist/components/editor/template-editor-toolbar.d.ts +146 -0
- package/dist/components/editor/template-editor-toolbar.js +434 -0
- package/dist/components/editor/template-editor-toolbar.js.map +1 -0
- package/dist/components/editor/template-editor.d.ts +109 -0
- package/dist/components/editor/template-editor.js +662 -0
- package/dist/components/editor/template-editor.js.map +1 -0
- package/dist/components/editor/toolbar-dropdown.d.ts +20 -0
- package/dist/components/editor/toolbar-dropdown.js +88 -0
- package/dist/components/editor/toolbar-dropdown.js.map +1 -0
- package/dist/components/editor/utils/draw-mode.d.ts +55 -0
- package/dist/components/editor/utils/draw-mode.js +79 -0
- package/dist/components/editor/utils/draw-mode.js.map +1 -0
- package/dist/components/editor/utils/insertion.d.ts +11 -0
- package/dist/components/editor/utils/insertion.js +26 -0
- package/dist/components/editor/utils/insertion.js.map +1 -0
- package/dist/components/editor/utils/length-calculator.d.ts +36 -0
- package/dist/components/editor/utils/length-calculator.js +32 -0
- package/dist/components/editor/utils/length-calculator.js.map +1 -0
- package/dist/components/editor/utils/serialization.d.ts +34 -0
- package/dist/components/editor/utils/serialization.js +184 -0
- package/dist/components/editor/utils/serialization.js.map +1 -0
- package/dist/components/editor/utils/stroke-transaction.d.ts +36 -0
- package/dist/components/editor/utils/stroke-transaction.js +57 -0
- package/dist/components/editor/utils/stroke-transaction.js.map +1 -0
- package/dist/components/editor/variable-picker-content.d.ts +130 -0
- package/dist/components/editor/variable-picker-content.js +422 -0
- package/dist/components/editor/variable-picker-content.js.map +1 -0
- package/dist/components/feedback/status-dot.d.ts +49 -0
- package/dist/components/feedback/status-dot.js +58 -0
- package/dist/components/feedback/status-dot.js.map +1 -0
- package/dist/components/forms/secret-input.d.ts +38 -0
- package/dist/components/forms/secret-input.js +42 -0
- package/dist/components/forms/secret-input.js.map +1 -0
- package/dist/components/forms/time-picker.d.ts +87 -0
- package/dist/components/forms/time-picker.js +260 -0
- package/dist/components/forms/time-picker.js.map +1 -0
- package/dist/components/forms/toggle-card.d.ts +120 -0
- package/dist/components/forms/toggle-card.js +211 -0
- package/dist/components/forms/toggle-card.js.map +1 -0
- package/dist/components/overlays/popover.d.ts +65 -0
- package/dist/components/overlays/popover.js +89 -0
- package/dist/components/overlays/popover.js.map +1 -0
- package/dist/editor.css +164 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +95 -61
- package/dist/lib/board-colors.d.ts +16 -0
- package/dist/lib/board-colors.js +14 -14
- package/dist/lib/board-colors.js.map +1 -1
- package/dist/lib/use-deps-changed.d.ts +33 -0
- package/dist/lib/use-deps-changed.js +11 -0
- package/dist/lib/use-deps-changed.js.map +1 -0
- package/package.json +50 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface JsonTreeLabels {
|
|
3
|
+
/**
|
|
4
|
+
* Accessible name (and tooltip) for a leaf's select button.
|
|
5
|
+
* Default: `` (path) => `Use path: ${path}` ``
|
|
6
|
+
*/
|
|
7
|
+
selectPath?: (path: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Accessible name for a branch's expand/collapse toggle — the visible
|
|
10
|
+
* `{3}` / `[2]` summary is decorative and hidden from assistive tech.
|
|
11
|
+
* Default: `` (path, count) => `${path} (${count} items)` ``
|
|
12
|
+
*/
|
|
13
|
+
toggleNode?: (path: string, count: number) => string;
|
|
14
|
+
/** Stands in for the path of the root node, which has none. Default: `"root"` */
|
|
15
|
+
root?: string;
|
|
16
|
+
/** Announced politely after a leaf is selected. Default: `"Path copied"` */
|
|
17
|
+
selected?: string;
|
|
18
|
+
/** Shown in place of children for an empty object or array. Default: `"empty"` */
|
|
19
|
+
empty?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface JsonTreeProps {
|
|
22
|
+
/** Any JSON-shaped value. Objects and arrays branch; everything else is a leaf. */
|
|
23
|
+
data: unknown;
|
|
24
|
+
/**
|
|
25
|
+
* Dot/bracket path of `data` itself, prefixed onto every child path.
|
|
26
|
+
* Defaults to `""`, which makes children read `a.b[0]` rather than `.a.b[0]`.
|
|
27
|
+
*/
|
|
28
|
+
path?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Called with the dot/bracket path of the leaf the user picked and its
|
|
31
|
+
* value. Omit for a read-only tree: the per-leaf select buttons disappear.
|
|
32
|
+
*/
|
|
33
|
+
onSelect?: (path: string, value: unknown) => void;
|
|
34
|
+
/** Expand this node on first render. Default: `false`. */
|
|
35
|
+
defaultExpanded?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Expand the first N levels on first render — `2` opens this node and its
|
|
38
|
+
* direct branch children. Default: `0`.
|
|
39
|
+
*/
|
|
40
|
+
defaultExpandedDepth?: number;
|
|
41
|
+
labels?: JsonTreeLabels;
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A collapsible JSON tree whose every leaf offers its own dot/bracket path.
|
|
46
|
+
*
|
|
47
|
+
* It knows nothing about plugins, settings, or where the data came from — it
|
|
48
|
+
* renders a value and reports the path the user picked — so any surface that
|
|
49
|
+
* needs "show me this response and let me point at part of it" can use it.
|
|
50
|
+
*
|
|
51
|
+
* Branches are nested WAI-ARIA **disclosures**, not a `role="tree"`: a correct
|
|
52
|
+
* tree owes callers a roving tabindex and full arrow-key navigation across a
|
|
53
|
+
* recursive component boundary, and a half-built one is worse than none — it
|
|
54
|
+
* would strip Tab access from the nested select buttons while advertising an
|
|
55
|
+
* interaction contract the widget doesn't honour. Disclosures are keyboard
|
|
56
|
+
* complete out of the box (Tab to reach, Enter/Space to toggle); Arrow
|
|
57
|
+
* Left/Right are wired up on top as the affordance tree users reach for.
|
|
58
|
+
*/
|
|
59
|
+
export declare function JsonTree({ data, path, onSelect, defaultExpanded, defaultExpandedDepth, labels, className, }: JsonTreeProps): React.JSX.Element;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { Check as t, ChevronDown as n, ChevronRight as r, Copy as i } from "lucide-react";
|
|
4
|
+
import * as a from "react";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/containment/json-tree.tsx
|
|
7
|
+
var c = {
|
|
8
|
+
string: "text-success",
|
|
9
|
+
number: "text-warning",
|
|
10
|
+
boolean: "text-warning",
|
|
11
|
+
nullish: "text-muted-foreground italic",
|
|
12
|
+
other: "text-foreground"
|
|
13
|
+
}, l = "text-info", u = "text-tag-variable-foreground", d = "-ml-1 flex w-full items-center gap-1 rounded-sm px-1 py-0.5 text-left text-xs text-muted-foreground transition-colors duration-control hover:bg-muted/60 outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px]", f = "shrink-0 rounded-sm p-0.5 opacity-0 transition-opacity duration-control hover:bg-muted group-hover:opacity-100 focus-visible:opacity-100 outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px]", p = 1500;
|
|
14
|
+
function m(e) {
|
|
15
|
+
return typeof e == "object" && !!e;
|
|
16
|
+
}
|
|
17
|
+
function h(e) {
|
|
18
|
+
if (e == null) return c.nullish;
|
|
19
|
+
switch (typeof e) {
|
|
20
|
+
case "string": return c.string;
|
|
21
|
+
case "number":
|
|
22
|
+
case "bigint": return c.number;
|
|
23
|
+
case "boolean": return c.boolean;
|
|
24
|
+
default: return c.other;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function g(e) {
|
|
28
|
+
return e == null ? "null" : typeof e == "string" ? `"${e}"` : String(e);
|
|
29
|
+
}
|
|
30
|
+
function _({ data: c, path: v = "", onSelect: y, defaultExpanded: b = !1, defaultExpandedDepth: x = 0, labels: S, className: C }) {
|
|
31
|
+
let { selectPath: w = (e) => `Use path: ${e}`, toggleNode: T = (e, t) => `${e} (${t} ${t === 1 ? "item" : "items"})`, root: E = "root", selected: D = "Path copied", empty: O = "empty" } = S ?? {}, k = x > 0, [A, j] = a.useState(b || k), [M, N] = a.useState(b || k), [P, F] = a.useState(null), I = a.useId(), L = a.useRef(null);
|
|
32
|
+
a.useEffect(() => () => {
|
|
33
|
+
L.current !== null && clearTimeout(L.current);
|
|
34
|
+
}, []);
|
|
35
|
+
function R(e, t) {
|
|
36
|
+
y?.(e, t), F(e), L.current !== null && clearTimeout(L.current), L.current = setTimeout(() => F(null), p);
|
|
37
|
+
}
|
|
38
|
+
function z() {
|
|
39
|
+
j((e) => !e), N(!0);
|
|
40
|
+
}
|
|
41
|
+
function B(e) {
|
|
42
|
+
e.key === "ArrowRight" && !A ? (e.preventDefault(), z()) : e.key === "ArrowLeft" && A && (e.preventDefault(), j(!1));
|
|
43
|
+
}
|
|
44
|
+
if (!m(c)) return /* @__PURE__ */ o("span", {
|
|
45
|
+
"data-slot": "json-tree-value",
|
|
46
|
+
className: e("font-mono text-xs", h(c), C),
|
|
47
|
+
children: g(c)
|
|
48
|
+
});
|
|
49
|
+
let V = Array.isArray(c), H = V ? c.map((e, t) => [String(t), e]) : Object.entries(c), U = V ? `[${H.length}]` : `{${H.length}}`, W = Math.max(0, x - 1);
|
|
50
|
+
return /* @__PURE__ */ s("div", {
|
|
51
|
+
"data-slot": "json-tree",
|
|
52
|
+
className: e("ml-1", C),
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ s("button", {
|
|
55
|
+
type: "button",
|
|
56
|
+
"aria-expanded": A,
|
|
57
|
+
"aria-controls": M ? I : void 0,
|
|
58
|
+
onClick: z,
|
|
59
|
+
onKeyDown: B,
|
|
60
|
+
className: d,
|
|
61
|
+
children: [
|
|
62
|
+
o(A ? n : r, { className: "size-3 shrink-0" }),
|
|
63
|
+
/* @__PURE__ */ o("span", {
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
className: "font-mono",
|
|
66
|
+
children: U
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ o("span", {
|
|
69
|
+
className: "sr-only",
|
|
70
|
+
children: T(v || E, H.length)
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
}),
|
|
74
|
+
M && /* @__PURE__ */ o("span", {
|
|
75
|
+
role: "status",
|
|
76
|
+
className: "sr-only",
|
|
77
|
+
children: P === null ? "" : D
|
|
78
|
+
}),
|
|
79
|
+
M && /* @__PURE__ */ s("ul", {
|
|
80
|
+
id: I,
|
|
81
|
+
hidden: !A,
|
|
82
|
+
className: "ml-3 flex flex-col gap-0.5 border-l border-border pl-2 [&[hidden]]:hidden",
|
|
83
|
+
children: [H.length === 0 && /* @__PURE__ */ o("li", {
|
|
84
|
+
className: "text-xs italic text-muted-foreground",
|
|
85
|
+
children: O
|
|
86
|
+
}), H.map(([n, r]) => {
|
|
87
|
+
let a = V ? `${v}[${n}]` : v ? `${v}.${n}` : n, c = V ? `[${n}]:` : `${n}:`;
|
|
88
|
+
return /* @__PURE__ */ s("li", {
|
|
89
|
+
className: "flex items-start gap-1",
|
|
90
|
+
children: [/* @__PURE__ */ o("span", {
|
|
91
|
+
className: e("shrink-0 pt-0.5 font-mono text-xs font-medium", V ? u : l),
|
|
92
|
+
children: c
|
|
93
|
+
}), m(r) ? /* @__PURE__ */ o(_, {
|
|
94
|
+
data: r,
|
|
95
|
+
path: a,
|
|
96
|
+
onSelect: y,
|
|
97
|
+
defaultExpandedDepth: W,
|
|
98
|
+
labels: S
|
|
99
|
+
}) : /* @__PURE__ */ s("span", {
|
|
100
|
+
className: "group flex min-w-0 items-center gap-1",
|
|
101
|
+
children: [/* @__PURE__ */ o("span", {
|
|
102
|
+
className: e("truncate font-mono text-xs", h(r)),
|
|
103
|
+
children: g(r)
|
|
104
|
+
}), y && /* @__PURE__ */ o("button", {
|
|
105
|
+
type: "button",
|
|
106
|
+
onClick: () => R(a, r),
|
|
107
|
+
"aria-label": w(a),
|
|
108
|
+
title: w(a),
|
|
109
|
+
className: f,
|
|
110
|
+
children: P === a ? /* @__PURE__ */ o(t, { className: "size-3 text-success" }) : /* @__PURE__ */ o(i, { className: "size-3 text-muted-foreground" })
|
|
111
|
+
})]
|
|
112
|
+
})]
|
|
113
|
+
}, n);
|
|
114
|
+
})]
|
|
115
|
+
})
|
|
116
|
+
]
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
export { _ as JsonTree };
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=json-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-tree.js","names":[],"sources":["../../../src/components/containment/json-tree.tsx"],"mappings":";;;;;;AAeA,IAAM,IAAa;CACjB,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,SAAS;CACT,OAAO;AACT,GAGM,IAAW,aACX,IAAa,gCAEb,IACJ,6NAKI,IACJ,6MAEI,IAAoB;AAE1B,SAAS,EAAS,GAA8D;CAC9E,OAAO,OAAO,KAAU,cAAY;AACtC;AAEA,SAAS,EAAQ,GAAwB;CACvC,IAAI,KAAU,MAA6B,OAAO,EAAW;CAC7D,QAAQ,OAAO,GAAf;EACE,KAAK,UACH,OAAO,EAAW;EACpB,KAAK;EACL,KAAK,UACH,OAAO,EAAW;EACpB,KAAK,WACH,OAAO,EAAW;EACpB,SACE,OAAO,EAAW;CACtB;AACF;AAGA,SAAS,EAAa,GAAwB;CAG5C,OAFI,KAAU,OAAoC,SAC9C,OAAO,KAAU,WAAiB,IAAI,EAAM,KACzC,OAAO,CAAK;AACrB;AA6DA,SAAgB,EAAS,EACvB,SACA,UAAO,IACP,aACA,qBAAkB,IAClB,0BAAuB,GACvB,WACA,gBACgB;CAChB,IAAM,EACJ,iBAAc,MAAc,aAAa,KACzC,iBAAc,GAAW,MAAkB,GAAG,EAAE,IAAI,EAAM,GAAG,MAAU,IAAI,SAAS,QAAQ,IAC5F,UAAO,QACP,cAAW,eACX,WAAQ,YACN,KAAU,CAAC,GAET,IAAc,IAAuB,GACrC,CAAC,GAAU,KAAe,EAAM,SAAS,KAAmB,CAAW,GAIvE,CAAC,GAAS,KAAc,EAAM,SAAS,KAAmB,CAAW,GACrE,CAAC,GAAc,KAAmB,EAAM,SAAwB,IAAI,GACpE,IAAU,EAAM,MAAM,GACtB,IAAa,EAAM,OAA6C,IAAI;CAE1E,EAAM,sBACS;EACX,AAAI,EAAW,YAAY,QAAM,aAAa,EAAW,OAAO;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
|
2
|
+
import type { DeviceType } from "../../lib/board-dimensions";
|
|
3
|
+
export interface ColorPickerLabels {
|
|
4
|
+
/** Accessible name for the swatch grid. */
|
|
5
|
+
colorPickerAriaLabel: string;
|
|
6
|
+
/**
|
|
7
|
+
* Display name per board color. Maps 1:1 to the app's
|
|
8
|
+
* `templateEditor.drawColors` catalog — the app's picker rendered the raw
|
|
9
|
+
* English key, which is the one string in it that never got translated.
|
|
10
|
+
*/
|
|
11
|
+
colorNames: Record<BoardColorName, string>;
|
|
12
|
+
/** Accessible name for one swatch, given its display name. */
|
|
13
|
+
colorOptionLabel: (colorName: string) => string;
|
|
14
|
+
heartCharacterAriaLabel: string;
|
|
15
|
+
heartLabel: string;
|
|
16
|
+
insertHeartTooltip: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const DEFAULT_COLOR_PICKER_LABELS: ColorPickerLabels;
|
|
19
|
+
export interface ColorPickerContentProps {
|
|
20
|
+
/** Receives a template color token, e.g. `{{red}}` — or `°` for the Note heart. */
|
|
21
|
+
onInsert: (colorValue: string) => void;
|
|
22
|
+
deviceType?: DeviceType;
|
|
23
|
+
labels?: Partial<ColorPickerLabels>;
|
|
24
|
+
}
|
|
25
|
+
export declare function ColorPickerContent({ onInsert, deviceType, labels }: ColorPickerContentProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { Box as t } from "../layout/box.js";
|
|
4
|
+
import { Grid as n } from "../layout/grid.js";
|
|
5
|
+
import { Text as r } from "../typography/text.js";
|
|
6
|
+
import { Tooltip as i, TooltipContent as a, TooltipProvider as o, TooltipTrigger as s } from "../overlays/tooltip.js";
|
|
7
|
+
import { AVAILABLE_COLORS as c, COLOR_DISPLAY as l } from "../../lib/board-colors.js";
|
|
8
|
+
import { Heart as u } from "lucide-react";
|
|
9
|
+
import { useRef as d, useState as f } from "react";
|
|
10
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/editor/color-picker-content.tsx
|
|
12
|
+
var h = {
|
|
13
|
+
colorPickerAriaLabel: "Color picker",
|
|
14
|
+
colorNames: {
|
|
15
|
+
red: "Red",
|
|
16
|
+
orange: "Orange",
|
|
17
|
+
yellow: "Yellow",
|
|
18
|
+
green: "Green",
|
|
19
|
+
blue: "Blue",
|
|
20
|
+
violet: "Violet",
|
|
21
|
+
white: "White",
|
|
22
|
+
black: "Black"
|
|
23
|
+
},
|
|
24
|
+
colorOptionLabel: (e) => `${e} color`,
|
|
25
|
+
heartCharacterAriaLabel: "Heart character",
|
|
26
|
+
heartLabel: "heart",
|
|
27
|
+
insertHeartTooltip: "Insert heart character (Note only)"
|
|
28
|
+
}, g = c, _ = { red: "text-black" }, v = 4;
|
|
29
|
+
function y({ onInsert: c, deviceType: y, labels: b }) {
|
|
30
|
+
let x = {
|
|
31
|
+
...h,
|
|
32
|
+
...b
|
|
33
|
+
}, S = y === "note", [C, w] = f(-1), T = d([]), E = (e) => {
|
|
34
|
+
let t = (e % g.length + g.length) % g.length;
|
|
35
|
+
w(t);
|
|
36
|
+
let n = T.current[t];
|
|
37
|
+
n?.scrollIntoView({
|
|
38
|
+
block: "nearest",
|
|
39
|
+
behavior: "smooth"
|
|
40
|
+
}), n?.focus();
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ p(o, { children: /* @__PURE__ */ m(t, {
|
|
43
|
+
className: e("p-2", !S && "pb-1"),
|
|
44
|
+
tabIndex: 0,
|
|
45
|
+
role: "listbox",
|
|
46
|
+
"aria-label": x.colorPickerAriaLabel,
|
|
47
|
+
onKeyDown: (e) => {
|
|
48
|
+
switch (e.key) {
|
|
49
|
+
case "ArrowRight":
|
|
50
|
+
e.preventDefault(), E(C + 1);
|
|
51
|
+
break;
|
|
52
|
+
case "ArrowLeft":
|
|
53
|
+
e.preventDefault(), E(C - 1);
|
|
54
|
+
break;
|
|
55
|
+
case "ArrowDown":
|
|
56
|
+
e.preventDefault(), E(C + v);
|
|
57
|
+
break;
|
|
58
|
+
case "ArrowUp":
|
|
59
|
+
e.preventDefault(), E(C - v);
|
|
60
|
+
break;
|
|
61
|
+
case "Enter":
|
|
62
|
+
case " ": e.preventDefault(), c(`{{${g[C] ?? g[0]}}}`);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
onFocus: (e) => {
|
|
66
|
+
e.target === e.currentTarget && C === -1 && E(0);
|
|
67
|
+
},
|
|
68
|
+
children: [/* @__PURE__ */ p(n, {
|
|
69
|
+
cols: "4",
|
|
70
|
+
gap: "2",
|
|
71
|
+
className: "w-64",
|
|
72
|
+
role: "presentation",
|
|
73
|
+
children: g.map((t, n) => {
|
|
74
|
+
let o = C === n;
|
|
75
|
+
return /* @__PURE__ */ m(i, { children: [/* @__PURE__ */ p(s, {
|
|
76
|
+
asChild: !0,
|
|
77
|
+
children: /* @__PURE__ */ p("button", {
|
|
78
|
+
ref: (e) => {
|
|
79
|
+
T.current[n] = e;
|
|
80
|
+
},
|
|
81
|
+
type: "button",
|
|
82
|
+
onClick: () => c(`{{${t}}}`),
|
|
83
|
+
onFocus: () => w(n),
|
|
84
|
+
className: e("h-10 rounded-md text-xs font-medium transition-all hover:scale-105 hover:shadow-md", "flex items-center justify-center focus:outline-none", o && "ring-2 ring-offset-2 ring-primary scale-105 shadow-md", l[t].bg, _[t] ?? l[t].text),
|
|
85
|
+
"aria-label": x.colorOptionLabel(x.colorNames[t]),
|
|
86
|
+
role: "option",
|
|
87
|
+
"aria-selected": o,
|
|
88
|
+
children: x.colorNames[t]
|
|
89
|
+
})
|
|
90
|
+
}), /* @__PURE__ */ p(a, { children: /* @__PURE__ */ p(r, { children: x.colorNames[t] }) })] }, t);
|
|
91
|
+
})
|
|
92
|
+
}), S && /* @__PURE__ */ p(t, {
|
|
93
|
+
className: "mt-2 pt-2 border-t border-border",
|
|
94
|
+
role: "presentation",
|
|
95
|
+
children: /* @__PURE__ */ m(i, { children: [/* @__PURE__ */ p(s, {
|
|
96
|
+
asChild: !0,
|
|
97
|
+
children: /* @__PURE__ */ m("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
onClick: () => c("°"),
|
|
100
|
+
className: e("w-full h-10 rounded-md text-sm font-medium transition-all hover:scale-[1.02] hover:shadow-md", "flex items-center justify-center gap-1.5 focus:outline-none", "bg-board-red/10 text-board-red border border-board-red/20 hover:bg-board-red/20"),
|
|
101
|
+
"aria-label": x.heartCharacterAriaLabel,
|
|
102
|
+
role: "option",
|
|
103
|
+
"aria-selected": !1,
|
|
104
|
+
children: [/* @__PURE__ */ p(u, { className: "w-4 h-4 fill-current" }), /* @__PURE__ */ p(r, {
|
|
105
|
+
as: "span",
|
|
106
|
+
weight: "medium",
|
|
107
|
+
className: "text-board-red",
|
|
108
|
+
children: x.heartLabel
|
|
109
|
+
})]
|
|
110
|
+
})
|
|
111
|
+
}), /* @__PURE__ */ p(a, { children: /* @__PURE__ */ p(r, { children: x.insertHeartTooltip }) })] })
|
|
112
|
+
})]
|
|
113
|
+
}) });
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { y as ColorPickerContent, h as DEFAULT_COLOR_PICKER_LABELS };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=color-picker-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-picker-content.js","names":[],"sources":["../../../src/components/editor/color-picker-content.tsx"],"mappings":";;;;;;;;;;;AAgCA,IAAa,IAAiD;CAC5D,sBAAsB;CACtB,YAAY;EACV,KAAK;EACL,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,MAAM;EACN,QAAQ;EACR,OAAO;EACP,OAAO;CACT;CACA,mBAAmB,MAAc,GAAG,EAAU;CAC9C,yBAAyB;CACzB,YAAY;CACZ,oBAAoB;AACtB,GAiBM,IAAS,GAgBT,IAAgE,EACpE,KAAK,aACP,GAGM,IAAY;AAElB,SAAgB,EAAmB,EAAE,aAAU,eAAY,aAA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MAAO;OACX,EAAW,QAAQ,KAAS;MAC9B;MACA,MAAK;MACL,eAAe,EAAS,KAAK,EAAU,GAAG;MAC1C,eAAe,EAAoB,CAAK;MACxC,WAAW,EACT,sFACA,uDACA,KAAiB,yDACjB,EAAc,EAAU,CAAC,IACzB,EAAqB,MAAc,EAAc,EAAU,CAAC,IAC9D;MACA,cAAY,EAAE,iBAAiB,EAAE,WAAW,EAAU;MACtD,MAAK;MACL,iBAAe;MAEd,UAAA,EAAE,WAAW;KACR,CAAA;IACM,CAAA,GAChB,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAA,UAAO,EAAE,WAAW,GAAiB,CAAA,EACvB,CAAA,CACT,EAAA,GA1BK,CA0BL;GAEb,CAAC;EACG,CAAA,GACL,KACC,kBAAC,GAAD;GAAK,WAAU;GAAmC,MAAK;GACrD,UAAA,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;IAAgB,SAAA;IACd,UAAA,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,EAAS,GAAG;KAC3B,WAAW,EACT,gGACA,+DACA,iFACF;KACA,cAAY,EAAE;KACd,MAAK;KACL,iBAAe;KAVjB,UAAA,CAYE,kBAAC,GAAD,EAAO,WAAU,uBAAwB,CAAA,GACzC,kBAAC,GAAD;MAAM,IAAG;MAAO,QAAO;MAAS,WAAU;MACvC,UAAA,EAAE;KACC,CAAA,CACA;;GACM,CAAA,GAChB,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAA,UAAO,EAAE,mBAAyB,CAAA,EACpB,CAAA,CACT,EAAA,CAAA;EACN,CAAA,CAEJ;CACU,CAAA,EAAA,CAAA;AAErB"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for the TipTap template editor.
|
|
3
|
+
* Maps template syntax to FiestaBoard hardware constraints.
|
|
4
|
+
*
|
|
5
|
+
* PORTING NOTE — this file is deliberately thin. The FiestaBoard app's
|
|
6
|
+
* `tiptap-template-editor/utils/constants.ts` re-declared the device grid, the
|
|
7
|
+
* board palette and the board character set, all of which FiestaUI already owns
|
|
8
|
+
* in `src/lib/`. Duplicating them here would give the package two sources of
|
|
9
|
+
* truth for a hardware parity contract. So everything that already exists is
|
|
10
|
+
* re-exported, and only genuinely new editor-specific values are defined below.
|
|
11
|
+
*
|
|
12
|
+
* Already owned by FiestaUI (re-exported, never redefined):
|
|
13
|
+
* - DeviceType / DEVICE_DIMENSIONS / resolveDimensions → lib/board-dimensions
|
|
14
|
+
* - BOARD_COLORS (name → hex) / BoardColorName → lib/board-colors
|
|
15
|
+
* - BOARD_CHARS (code → character) → lib/board-characters
|
|
16
|
+
*/
|
|
17
|
+
import type { BoardColorName } from "../../lib/board-colors";
|
|
18
|
+
import type { BoardDimensions } from "../../lib/board-dimensions";
|
|
19
|
+
export { BOARD_CHARS } from "../../lib/board-characters";
|
|
20
|
+
export { BOARD_COLORS, type BoardColorName } from "../../lib/board-colors";
|
|
21
|
+
export { type BoardDimensions, DEVICE_DIMENSIONS, type DeviceType, resolveDimensions, } from "../../lib/board-dimensions";
|
|
22
|
+
/**
|
|
23
|
+
* `DeviceDimensions` was the app's name for the { rows, cols } shape that
|
|
24
|
+
* FiestaUI calls `BoardDimensions`. Aliased so ported editor code reads the
|
|
25
|
+
* same, without a second interface declaration.
|
|
26
|
+
*/
|
|
27
|
+
export type DeviceDimensions = BoardDimensions;
|
|
28
|
+
/**
|
|
29
|
+
* Color names usable inside a template token, including the `purple` alias for
|
|
30
|
+
* `violet`. Wider than `BoardColorName` (which is the hardware palette) because
|
|
31
|
+
* template authors may type either spelling.
|
|
32
|
+
*/
|
|
33
|
+
export type BoardColorToken = BoardColorName | "purple";
|
|
34
|
+
/**
|
|
35
|
+
* FiestaBoard color codes (63–70), keyed by template token name.
|
|
36
|
+
*
|
|
37
|
+
* NEW: FiestaUI's `lib/board-colors` maps names → hex and codes → hex, but has
|
|
38
|
+
* no name → numeric code direction. The editor needs it because a colorTile
|
|
39
|
+
* node stores the numeric code the board hardware addresses.
|
|
40
|
+
*
|
|
41
|
+
* The `satisfies` clause fails the build if a palette color is ever added to
|
|
42
|
+
* BOARD_COLORS without a code being assigned here.
|
|
43
|
+
*/
|
|
44
|
+
export declare const BOARD_COLOR_CODES: {
|
|
45
|
+
readonly red: 63;
|
|
46
|
+
readonly orange: 64;
|
|
47
|
+
readonly yellow: 65;
|
|
48
|
+
readonly green: 66;
|
|
49
|
+
readonly blue: 67;
|
|
50
|
+
readonly violet: 68;
|
|
51
|
+
readonly purple: 68;
|
|
52
|
+
readonly white: 69;
|
|
53
|
+
readonly black: 70;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Numeric board codes → canonical color names (71 = filled tile; the closest
|
|
57
|
+
* palette entry is black). Inverse of BOARD_COLOR_CODES, minus the alias.
|
|
58
|
+
*/
|
|
59
|
+
export declare const BOARD_CODE_TO_COLOR: Record<number, BoardColorName>;
|
|
60
|
+
/**
|
|
61
|
+
* Flagship geometry, used ONLY as a default when no device is known.
|
|
62
|
+
*
|
|
63
|
+
* The app's constants.ts exported these as `BOARD_WIDTH` / `BOARD_LINES` and
|
|
64
|
+
* modules imported them directly, which silently hard-coded flagship even when
|
|
65
|
+
* the caller was editing a Note template. They are renamed to DEFAULT_* here so
|
|
66
|
+
* that reaching for one is a visible choice: anything that knows its device
|
|
67
|
+
* MUST take the width / line count as a parameter (see length-calculator.ts).
|
|
68
|
+
*/
|
|
69
|
+
export declare const DEFAULT_BOARD_WIDTH: number;
|
|
70
|
+
export declare const DEFAULT_BOARD_LINES: number;
|
|
71
|
+
/** Special variable names. */
|
|
72
|
+
export declare const FILL_SPACE_VAR = "fill_space";
|
|
73
|
+
export declare const FILL_SPACE_REPEAT_VAR = "fill_space_repeat";
|
|
74
|
+
/**
|
|
75
|
+
* Zero-width space (U+200B) inserted at the start and end of each line, and on
|
|
76
|
+
* both sides of every inline atom, so the caret always has a text node to sit
|
|
77
|
+
* in. Without it the cursor does not render at line boundaries, and it
|
|
78
|
+
* "selects" atom nodes during arrow navigation.
|
|
79
|
+
*
|
|
80
|
+
* Stripped on serialize so it never appears in a saved template string.
|
|
81
|
+
*
|
|
82
|
+
* Single source of truth: the app declared this character separately in
|
|
83
|
+
* serialization.ts, stroke-transaction.ts and trailing-newline.ts (each with a
|
|
84
|
+
* "mirroring serialization.ts" comment). Three copies of one caret contract is
|
|
85
|
+
* exactly the drift those comments were warning about, so it lives here.
|
|
86
|
+
*/
|
|
87
|
+
export declare const CURSOR_ANCHOR = "\u200B";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import "../../lib/board-colors.js";
|
|
2
|
+
import "../../lib/board-characters.js";
|
|
3
|
+
import { DEVICE_DIMENSIONS as e, resolveDimensions as t } from "../../lib/board-dimensions.js";
|
|
4
|
+
//#region src/components/editor/constants.ts
|
|
5
|
+
var n = {
|
|
6
|
+
red: 63,
|
|
7
|
+
orange: 64,
|
|
8
|
+
yellow: 65,
|
|
9
|
+
green: 66,
|
|
10
|
+
blue: 67,
|
|
11
|
+
violet: 68,
|
|
12
|
+
purple: 68,
|
|
13
|
+
white: 69,
|
|
14
|
+
black: 70
|
|
15
|
+
}, r = {
|
|
16
|
+
63: "red",
|
|
17
|
+
64: "orange",
|
|
18
|
+
65: "yellow",
|
|
19
|
+
66: "green",
|
|
20
|
+
67: "blue",
|
|
21
|
+
68: "violet",
|
|
22
|
+
69: "white",
|
|
23
|
+
70: "black",
|
|
24
|
+
71: "black"
|
|
25
|
+
}, i = e.flagship.cols, a = e.flagship.rows, o = "fill_space", s = "fill_space_repeat", c = "";
|
|
26
|
+
//#endregion
|
|
27
|
+
export { r as BOARD_CODE_TO_COLOR, n as BOARD_COLOR_CODES, c as CURSOR_ANCHOR, a as DEFAULT_BOARD_LINES, i as DEFAULT_BOARD_WIDTH, s as FILL_SPACE_REPEAT_VAR, o as FILL_SPACE_VAR, t as resolveDimensions };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/components/editor/constants.ts"],"mappings":";;;;AAwDA,IAAa,IAAoB;CAC/B,KAAK;CACL,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,OAAO;AACT,GAMa,IAAsD;CACjE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAaa,IAAsB,EAAkB,SAAS,MACjD,IAAsB,EAAkB,SAAS,MAKjD,IAAiB,cACjB,IAAwB,qBAexB,IAAgB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DeviceType } from "../../lib/board-dimensions";
|
|
2
|
+
import type { DrawBrush } from "./utils/draw-mode";
|
|
3
|
+
export interface DrawCharPickerLabels {
|
|
4
|
+
/** Accessible name for the character grid. */
|
|
5
|
+
characters: string;
|
|
6
|
+
/** Accessible name for the code-62 button on Flagship hardware. */
|
|
7
|
+
degree: string;
|
|
8
|
+
/** Accessible name for the code-62 button on a Note, where it draws a heart. */
|
|
9
|
+
heart: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_DRAW_CHAR_PICKER_LABELS: DrawCharPickerLabels;
|
|
12
|
+
export interface DrawCharPickerContentProps {
|
|
13
|
+
current: DrawBrush;
|
|
14
|
+
onSelect: (brush: DrawBrush) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Board the template targets. Only affects how code 62 is drawn and named —
|
|
17
|
+
* the inserted character is the degree symbol either way.
|
|
18
|
+
*/
|
|
19
|
+
deviceType?: DeviceType;
|
|
20
|
+
labels?: Partial<DrawCharPickerLabels>;
|
|
21
|
+
}
|
|
22
|
+
export declare function DrawCharPickerContent({ current, onSelect, deviceType, labels }: DrawCharPickerContentProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { Box as t } from "../layout/box.js";
|
|
4
|
+
import { Grid as n } from "../layout/grid.js";
|
|
5
|
+
import { DRAW_CHARS as r } from "./utils/draw-mode.js";
|
|
6
|
+
import { useRef as i, useState as a } from "react";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/editor/draw-char-picker-content.tsx
|
|
9
|
+
var s = "°", c = "♥", l = {
|
|
10
|
+
characters: "Characters",
|
|
11
|
+
degree: "Degree",
|
|
12
|
+
heart: "Heart"
|
|
13
|
+
}, u = 8;
|
|
14
|
+
function d({ current: d, onSelect: f, deviceType: p, labels: m }) {
|
|
15
|
+
let h = {
|
|
16
|
+
...l,
|
|
17
|
+
...m
|
|
18
|
+
}, g = p === "note", _ = d.kind === "char" ? d.char : null, v = i([]), [y, b] = a(() => {
|
|
19
|
+
let e = _ ? r.indexOf(_) : -1;
|
|
20
|
+
return e >= 0 ? e : 0;
|
|
21
|
+
}), x = (e) => {
|
|
22
|
+
let t = (e % r.length + r.length) % r.length;
|
|
23
|
+
b(t), v.current[t]?.focus();
|
|
24
|
+
}, S = (e, t) => {
|
|
25
|
+
switch (e.key) {
|
|
26
|
+
case "ArrowRight":
|
|
27
|
+
e.preventDefault(), x(t + 1);
|
|
28
|
+
break;
|
|
29
|
+
case "ArrowLeft":
|
|
30
|
+
e.preventDefault(), x(t - 1);
|
|
31
|
+
break;
|
|
32
|
+
case "ArrowDown":
|
|
33
|
+
e.preventDefault(), x(t + u);
|
|
34
|
+
break;
|
|
35
|
+
case "ArrowUp":
|
|
36
|
+
e.preventDefault(), x(t - u);
|
|
37
|
+
break;
|
|
38
|
+
case "Home":
|
|
39
|
+
e.preventDefault(), x(0);
|
|
40
|
+
break;
|
|
41
|
+
case "End": e.preventDefault(), x(r.length - 1);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ o(t, {
|
|
45
|
+
className: "w-64 p-2",
|
|
46
|
+
"data-testid": "draw-char-picker",
|
|
47
|
+
role: "group",
|
|
48
|
+
"aria-label": h.characters,
|
|
49
|
+
children: /* @__PURE__ */ o(n, {
|
|
50
|
+
cols: "8",
|
|
51
|
+
gap: "1",
|
|
52
|
+
children: r.map((t, n) => {
|
|
53
|
+
let r = t === s, i = r && g ? c : t;
|
|
54
|
+
return /* @__PURE__ */ o("button", {
|
|
55
|
+
ref: (e) => {
|
|
56
|
+
v.current[n] = e;
|
|
57
|
+
},
|
|
58
|
+
type: "button",
|
|
59
|
+
"data-draw-char": t,
|
|
60
|
+
tabIndex: n === y ? 0 : -1,
|
|
61
|
+
"aria-pressed": _ === t,
|
|
62
|
+
"aria-label": r ? g ? h.heart : h.degree : t,
|
|
63
|
+
onClick: () => f({
|
|
64
|
+
kind: "char",
|
|
65
|
+
char: t
|
|
66
|
+
}),
|
|
67
|
+
onFocus: () => b(n),
|
|
68
|
+
onKeyDown: (e) => S(e, n),
|
|
69
|
+
className: e("flex h-7 w-7 items-center justify-center rounded-md border font-mono text-sm transition-shadow", _ === t ? "ring-2 ring-primary ring-offset-1" : "hover:bg-muted/50"),
|
|
70
|
+
children: i
|
|
71
|
+
}, t);
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { l as DEFAULT_DRAW_CHAR_PICKER_LABELS, d as DrawCharPickerContent };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=draw-char-picker-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draw-char-picker-content.js","names":[],"sources":["../../../src/components/editor/draw-char-picker-content.tsx"],"mappings":";;;;;;;;AA0BA,IAAM,IAAc,KAEd,IAAkB,KAWX,IAAwD;CACnE,YAAY;CACZ,QAAQ;CACR,OAAO;AACT,GAaM,IAAY;AAElB,SAAgB,EAAsB,EAAE,YAAS,aAAU,eAAY,aAAsC;CAC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iB;KAC/B,cAAY,IAAY,IAAS,EAAE,QAAQ,EAAE,SAAU;KACvD,eAAe,EAAS;MAAE,MAAM;MAAQ;KAAK,CAAC;KAC9C,eAAe,EAAgB,CAAK;KACpC,YAAY,MAAU,EAAc,GAAO,CAAK;KAChD,WAAW,EACT,kGACA,MAAiB,IAAO,sCAAsC,mBAChE;KAEC,UAAA;IACK,GAlBD,CAkBC;GAEZ,CAAC;EACG,CAAA;CACH,CAAA;AAET"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ColorTileNode - Inline node for {{red}}, {{blue}}, etc.
|
|
3
|
+
* Renders as actual colored tiles matching FiestaBoard hardware
|
|
4
|
+
*/
|
|
5
|
+
import { Node } from "@tiptap/core";
|
|
6
|
+
export interface ColorTileAttrs {
|
|
7
|
+
color: string;
|
|
8
|
+
code: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const ColorTileNode: Node<any, any>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ColorTileNodeView as e } from "../node-views/color-tile-node-view.js";
|
|
3
|
+
import { ReactNodeViewRenderer as t } from "@tiptap/react";
|
|
4
|
+
import { Node as n, mergeAttributes as r } from "@tiptap/core";
|
|
5
|
+
//#region src/components/editor/extensions/color-tile-node.ts
|
|
6
|
+
var i = n.create({
|
|
7
|
+
name: "colorTile",
|
|
8
|
+
group: "inline",
|
|
9
|
+
inline: !0,
|
|
10
|
+
atom: !0,
|
|
11
|
+
selectable: !1,
|
|
12
|
+
draggable: !0,
|
|
13
|
+
addAttributes() {
|
|
14
|
+
return {
|
|
15
|
+
color: {
|
|
16
|
+
default: "red",
|
|
17
|
+
parseHTML: (e) => e.getAttribute("data-color"),
|
|
18
|
+
renderHTML: (e) => ({ "data-color": e.color })
|
|
19
|
+
},
|
|
20
|
+
code: {
|
|
21
|
+
default: 63,
|
|
22
|
+
parseHTML: (e) => {
|
|
23
|
+
let t = e.getAttribute("data-code");
|
|
24
|
+
return t ? parseInt(t, 10) : 63;
|
|
25
|
+
},
|
|
26
|
+
renderHTML: (e) => ({ "data-code": e.code?.toString() || "63" })
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
parseHTML() {
|
|
31
|
+
return [{ tag: "span[data-type=\"color-tile\"]" }];
|
|
32
|
+
},
|
|
33
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
34
|
+
return ["span", r({ "data-type": "color-tile" }, e)];
|
|
35
|
+
},
|
|
36
|
+
addNodeView() {
|
|
37
|
+
return t(e);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
//#endregion
|
|
41
|
+
export { i as ColorTileNode };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=color-tile-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-tile-node.js","names":[],"sources":["../../../../src/components/editor/extensions/color-tile-node.ts"],"mappings":";;;;;AAgBA,IAAa,IAAgB,EAAK,OAAO;CACvC,MAAM;CAEN,OAAO;CAEP,QAAQ;CAER,MAAM;CAEN,YAAY;CAEZ,WAAW;CAEX,gBAAgB;EACd,OAAO;GACL,OAAO;IACL,SAAS;IACT,YAAY,MAAY,EAAQ,aAAa,YAAY;IACzD,aAAa,OAAgB,EAC3B,cAAc,EAAW,MAC3B;GACF;GACA,MAAM;IACJ,SAAS;IACT,YAAY,MAAY;KACtB,IAAM,IAAO,EAAQ,aAAa,WAAW;KAC7C,OAAO,IAAO,SAAS,GAAM,EAAE,IAAI;IACrC;IACA,aAAa,OAAgB,EAC3B,aAAa,EAAW,MAAM,SAAS,KAAK,KAC9C;GACF;EACF;CACF;CAEA,YAAY;EACV,OAAO,CACL,EACE,KAAK,iCACP,CACF;CACF;CAEA,WAAW,EAAE,qBAAkB;EAC7B,OAAO,CAAC,QAAQ,EAAgB,EAAE,aAAa,aAAa,GAAG,CAAc,CAAC;CAChF;CAEA,cAAc;EACZ,OAAO,EAAsB,CAAiB;CAChD;AACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FillSpaceNode - Inline node for {{fill_space}}
|
|
3
|
+
* Visualizes expandable spacing that fills remaining line width
|
|
4
|
+
*/
|
|
5
|
+
import { Node } from "@tiptap/core";
|
|
6
|
+
export interface FillSpaceAttrs {
|
|
7
|
+
id: string;
|
|
8
|
+
repeatChar?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const FillSpaceNode: Node<any, any>;
|