@bettercms-ai/kit 3.0.1 → 3.1.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.
@@ -1,3 +1,9 @@
1
+ /**
2
+ * RICH TEXT · a link inside the text. A text link and a button are edited in V2's own link panel (controls/link.tsx
3
+ * LinkPopoverBody: Type, the page/section/address, new tab and Rel; RTE:1696) and stored as production's link mark:
4
+ * the resolved href, target and rel (`toLinkValue` / `fromLinkValue`). The image block uses the same panel; `LinkForm`
5
+ * below is kept only as a deprecated alias of it.
6
+ */
1
7
  import { type LinkRel, type LinkValue } from "../link";
2
8
  export interface TextLink {
3
9
  href: string;
@@ -14,6 +20,10 @@ export declare const toLinkValue: (l: TextLink) => LinkValue;
14
20
  export declare const fromLinkValue: (v: LinkValue, allowNewTab: boolean) => TextLink;
15
21
  /** An address a link may carry: http(s), mailto, tel, a site path or an in-page anchor. */
16
22
  export declare function linkProblem(href: string): string | null;
23
+ /**
24
+ * @deprecated since 3.1.0: the address-only form V2 never had. It now renders V2's one link panel (`LinkPopoverBody`,
25
+ * controls/link.tsx), so every link opens the same UI; import that directly. Removed at the next major.
26
+ */
17
27
  export declare function LinkForm({ initial, allowNewTab, onSave, onCancel, onDetach, dirty, }: {
18
28
  initial: TextLink;
19
29
  allowNewTab: boolean;
@@ -1,16 +1,11 @@
1
- import { Button } from "../../ui/button.js";
2
- import { Switch } from "../../ui/controls.js";
3
- import { Input } from "../../ui/input.js";
4
- import { LinkLine, normLink } from "../link.js";
5
- import * as React from "react";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { IconLink } from "@tabler/icons-react";
1
+ import { LinkPopoverBody } from "../link.js";
2
+ import { jsx } from "react/jsx-runtime";
8
3
  //#region src/controls/rich-text/link-form.tsx
9
4
  /**
10
5
  * RICH TEXT · a link inside the text. A text link and a button are edited in V2's own link panel (controls/link.tsx
11
6
  * LinkPopoverBody: Type, the page/section/address, new tab and Rel; RTE:1696) and stored as production's link mark:
12
- * the resolved href, target and rel (`toLinkValue` / `fromLinkValue`). `LinkForm` below is the address-only form an
13
- * image block links with.
7
+ * the resolved href, target and rel (`toLinkValue` / `fromLinkValue`). The image block uses the same panel; `LinkForm`
8
+ * below is kept only as a deprecated alias of it.
14
9
  */
15
10
  var RELS = [
16
11
  "nofollow",
@@ -55,124 +50,18 @@ function linkProblem(href) {
55
50
  if (/^[^\s/]+\.[^\s]+$/.test(h)) return `Add https:// in front: https://${h}`;
56
51
  return "Use a full address (https://…), a page path (/about) or an anchor (#section).";
57
52
  }
53
+ /**
54
+ * @deprecated since 3.1.0: the address-only form V2 never had. It now renders V2's one link panel (`LinkPopoverBody`,
55
+ * controls/link.tsx), so every link opens the same UI; import that directly. Removed at the next major.
56
+ */
58
57
  function LinkForm({ initial, allowNewTab, onSave, onCancel, onDetach, dirty = false }) {
59
- const [href, setHref] = React.useState(initial.href);
60
- const [newTab, setNewTab] = React.useState(!!initial.newTab);
61
- const [problem, setProblem] = React.useState(null);
62
- const urlId = React.useId();
63
- const tabId = React.useId();
64
- const errId = React.useId();
65
- const start = initial.href.trim();
66
- const changed = dirty || href.trim() !== start || allowNewTab && newTab !== !!initial.newTab;
67
- const ok = !linkProblem(href);
68
- return /* @__PURE__ */ jsxs("form", {
69
- className: "flex flex-col gap-3",
70
- onSubmit: (e) => {
71
- e.preventDefault();
72
- const p = linkProblem(href);
73
- setProblem(p);
74
- if (!p) onSave({
75
- href: href.trim(),
76
- newTab: allowNewTab && newTab
77
- });
78
- },
79
- children: [
80
- /* @__PURE__ */ jsxs("div", {
81
- className: "flex min-w-0 flex-col gap-1",
82
- children: [/* @__PURE__ */ jsx("span", {
83
- className: "text-kit-sm font-medium text-kit-fg",
84
- children: "Link"
85
- }), start ? /* @__PURE__ */ jsx("span", {
86
- className: "flex min-w-0 text-kit-fg-2",
87
- children: /* @__PURE__ */ jsx(LinkLine, { v: normLink({
88
- href: start,
89
- newTab: !!initial.newTab
90
- }) })
91
- }) : /* @__PURE__ */ jsx("span", {
92
- className: "text-kit-xs text-kit-fg-3",
93
- children: "No link yet"
94
- })]
95
- }),
96
- /* @__PURE__ */ jsxs("div", {
97
- className: "flex flex-col gap-1.5",
98
- onBlur: (e) => {
99
- if (!e.currentTarget.contains(e.relatedTarget) && href.trim()) setProblem(linkProblem(href));
100
- },
101
- children: [
102
- /* @__PURE__ */ jsx("label", {
103
- htmlFor: urlId,
104
- className: "text-kit-xs text-kit-fg-2",
105
- children: "Link to"
106
- }),
107
- /* @__PURE__ */ jsx(Input, {
108
- id: urlId,
109
- autoFocus: true,
110
- size: "sm",
111
- value: href,
112
- onChange: (e) => {
113
- setHref(e.target.value);
114
- if (problem) setProblem(null);
115
- },
116
- onKeyDown: (e) => {
117
- if (e.key === "Enter" && !ok) {
118
- e.preventDefault();
119
- setProblem(linkProblem(href));
120
- }
121
- },
122
- placeholder: "https://… or /page",
123
- leading: /* @__PURE__ */ jsx(IconLink, { stroke: 1.5 }),
124
- "aria-invalid": problem ? true : void 0,
125
- "aria-describedby": problem ? errId : void 0
126
- }),
127
- problem ? /* @__PURE__ */ jsx("p", {
128
- id: errId,
129
- role: "alert",
130
- className: "text-kit-xs text-kit-danger-fg",
131
- children: problem
132
- }) : null
133
- ]
134
- }),
135
- allowNewTab ? /* @__PURE__ */ jsxs("label", {
136
- htmlFor: tabId,
137
- className: "flex min-h-7 items-center justify-between gap-3",
138
- children: [/* @__PURE__ */ jsx("span", {
139
- className: "text-kit-xs text-kit-fg-2",
140
- children: "Open in new tab"
141
- }), /* @__PURE__ */ jsx(Switch, {
142
- id: tabId,
143
- size: "sm",
144
- checked: newTab,
145
- onCheckedChange: setNewTab
146
- })]
147
- }) : null,
148
- /* @__PURE__ */ jsxs("div", {
149
- className: "flex items-center gap-2 border-t border-kit-line pt-2.5",
150
- children: [
151
- onDetach ? /* @__PURE__ */ jsx(Button, {
152
- type: "button",
153
- size: "xs",
154
- variant: "danger-ghost",
155
- onClick: onDetach,
156
- children: "Remove link"
157
- }) : null,
158
- /* @__PURE__ */ jsx("span", { className: "flex-1" }),
159
- /* @__PURE__ */ jsx(Button, {
160
- type: "button",
161
- size: "xs",
162
- variant: "ghost",
163
- onClick: onCancel,
164
- children: "Cancel"
165
- }),
166
- /* @__PURE__ */ jsx(Button, {
167
- type: "submit",
168
- size: "xs",
169
- variant: "primary",
170
- disabled: !changed || !ok,
171
- children: "Apply"
172
- })
173
- ]
174
- })
175
- ]
58
+ return /* @__PURE__ */ jsx(LinkPopoverBody, {
59
+ initial: toLinkValue(initial),
60
+ hideOptions: !allowNewTab,
61
+ onSave: (v) => onSave(fromLinkValue(v, allowNewTab)),
62
+ onCancel,
63
+ onDetach,
64
+ dirty
176
65
  });
177
66
  }
178
67
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"link-form.js","names":[],"sources":["../../../src/controls/rich-text/link-form.tsx"],"sourcesContent":["/**\n * RICH TEXT · a link inside the text. A text link and a button are edited in V2's own link panel (controls/link.tsx\n * LinkPopoverBody: Type, the page/section/address, new tab and Rel; RTE:1696) and stored as production's link mark:\n * the resolved href, target and rel (`toLinkValue` / `fromLinkValue`). `LinkForm` below is the address-only form an\n * image block links with.\n */\nimport * as React from \"react\";\nimport { IconLink } from \"@tabler/icons-react\";\nimport { Button } from \"../../ui/button\";\nimport { Switch } from \"../../ui/controls\";\nimport { Input } from \"../../ui/input\";\nimport { LinkLine, normLink, type LinkRel, type LinkValue } from \"../link\";\n\nexport interface TextLink {\n href: string;\n newTab?: boolean;\n /** absent = follow (V2 writes no rel for it) */\n rel?: Exclude<LinkRel, \"follow\">;\n}\n\nconst RELS: Exclude<LinkRel, \"follow\">[] = [\"nofollow\", \"sponsored\", \"ugc\"];\n/** An anchor's link as stored: href, a new tab, and its rel (a new tab's noopener/noreferrer are the renderer's). */\nexport function textLinkOf(a: HTMLAnchorElement): TextLink {\n const tokens = (a.getAttribute(\"rel\") ?? \"\").toLowerCase().split(/\\s+/);\n const rel = RELS.find((r) => tokens.includes(r));\n return { href: a.getAttribute(\"href\") ?? \"\", newTab: a.getAttribute(\"target\") === \"_blank\", ...(rel ? { rel } : {}) };\n}\n/** Writes a link onto its anchor: href, target and rel (none for follow). */\nexport function applyTextLink(a: HTMLAnchorElement, l: TextLink) {\n a.setAttribute(\"href\", l.href);\n if (l.newTab) a.setAttribute(\"target\", \"_blank\");\n else a.removeAttribute(\"target\");\n if (l.rel) a.setAttribute(\"rel\", l.rel);\n else a.removeAttribute(\"rel\");\n}\nexport const toLinkValue = (l: TextLink): LinkValue => ({ href: l.href, newTab: !!l.newTab, rel: l.rel ?? \"follow\" });\n/** V2 saveLink (RTE:883-899): the resolved href is what is stored; a page or section pick re-reads from it. */\nexport const fromLinkValue = (v: LinkValue, allowNewTab: boolean): TextLink => ({\n href: v.href,\n newTab: allowNewTab && !!v.newTab,\n ...(v.rel && v.rel !== \"follow\" ? { rel: v.rel } : {}),\n});\n\n/** An address a link may carry: http(s), mailto, tel, a site path or an in-page anchor. */\nexport function linkProblem(href: string): string | null {\n const h = href.trim();\n if (!h) return \"Add an address first.\";\n if (/^(https?:\\/\\/[^\\s]+|mailto:[^\\s]+|tel:[+\\d][\\d\\s()-]*|\\/(?!\\/)[^\\s]*|#[^\\s]+)$/i.test(h)) return null;\n if (/^[a-z][a-z0-9+.-]*:/i.test(h)) return \"Use an address that starts with https://, mailto: or tel:.\";\n if (/^[^\\s/]+\\.[^\\s]+$/.test(h)) return `Add https:// in front: https://${h}`;\n return \"Use a full address (https://…), a page path (/about) or an anchor (#section).\";\n}\n\nexport function LinkForm({\n initial,\n allowNewTab,\n onSave,\n onCancel,\n onDetach,\n dirty = false,\n}: {\n initial: TextLink;\n allowNewTab: boolean;\n onSave: (v: TextLink) => void;\n onCancel: () => void;\n onDetach?: () => void;\n /** something the host draws beside the form changed (a button's label), so Apply has something to save */\n dirty?: boolean;\n}) {\n const [href, setHref] = React.useState(initial.href);\n const [newTab, setNewTab] = React.useState(!!initial.newTab);\n const [problem, setProblem] = React.useState<string | null>(null);\n const urlId = React.useId();\n const tabId = React.useId();\n const errId = React.useId();\n const start = initial.href.trim();\n // V2 LinkPopoverBody (controls/link.tsx): Apply only when something changed and the link can be saved\n const changed = dirty || href.trim() !== start || (allowNewTab && newTab !== !!initial.newTab);\n const ok = !linkProblem(href);\n return (\n <form\n className=\"flex flex-col gap-3\"\n onSubmit={(e) => {\n e.preventDefault();\n const p = linkProblem(href);\n setProblem(p);\n if (!p) onSave({ href: href.trim(), newTab: allowNewTab && newTab });\n }}\n >\n <div className=\"flex min-w-0 flex-col gap-1\">\n <span className=\"text-kit-sm font-medium text-kit-fg\">Link</span>\n {start ? (\n <span className=\"flex min-w-0 text-kit-fg-2\">\n <LinkLine v={normLink({ href: start, newTab: !!initial.newTab })} />\n </span>\n ) : (\n <span className=\"text-kit-xs text-kit-fg-3\">No link yet</span>\n )}\n </div>\n <div\n className=\"flex flex-col gap-1.5\"\n onBlur={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node) && href.trim()) setProblem(linkProblem(href));\n }}\n >\n <label htmlFor={urlId} className=\"text-kit-xs text-kit-fg-2\">\n Link to\n </label>\n <Input\n id={urlId}\n autoFocus\n size=\"sm\"\n value={href}\n onChange={(e) => {\n setHref(e.target.value);\n if (problem) setProblem(null);\n }}\n onKeyDown={(e) => {\n // Apply is disabled while the address cannot be saved, so Enter says why instead of doing nothing\n if (e.key === \"Enter\" && !ok) {\n e.preventDefault();\n setProblem(linkProblem(href));\n }\n }}\n placeholder=\"https://… or /page\"\n leading={<IconLink stroke={1.5} />}\n aria-invalid={problem ? true : undefined}\n aria-describedby={problem ? errId : undefined}\n />\n {problem ? (\n <p id={errId} role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">\n {problem}\n </p>\n ) : null}\n </div>\n {allowNewTab ? (\n <label htmlFor={tabId} className=\"flex min-h-7 items-center justify-between gap-3\">\n <span className=\"text-kit-xs text-kit-fg-2\">Open in new tab</span>\n <Switch id={tabId} size=\"sm\" checked={newTab} onCheckedChange={setNewTab} />\n </label>\n ) : null}\n <div className=\"flex items-center gap-2 border-t border-kit-line pt-2.5\">\n {onDetach ? (\n <Button type=\"button\" size=\"xs\" variant=\"danger-ghost\" onClick={onDetach}>\n Remove link\n </Button>\n ) : null}\n <span className=\"flex-1\" />\n <Button type=\"button\" size=\"xs\" variant=\"ghost\" onClick={onCancel}>\n Cancel\n </Button>\n <Button type=\"submit\" size=\"xs\" variant=\"primary\" disabled={!changed || !ok}>\n Apply\n </Button>\n </div>\n </form>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,IAAM,OAAqC;CAAC;CAAY;CAAa;AAAK;;AAE1E,SAAgB,WAAW,GAAgC;CACzD,MAAM,UAAU,EAAE,aAAa,KAAK,KAAK,GAAA,CAAI,YAAY,CAAC,CAAC,MAAM,KAAK;CACtE,MAAM,MAAM,KAAK,MAAM,MAAM,OAAO,SAAS,CAAC,CAAC;CAC/C,OAAO;EAAE,MAAM,EAAE,aAAa,MAAM,KAAK;EAAI,QAAQ,EAAE,aAAa,QAAQ,MAAM;EAAU,GAAI,MAAM,EAAE,IAAI,IAAI,CAAC;CAAG;AACtH;;AAEA,SAAgB,cAAc,GAAsB,GAAa;CAC/D,EAAE,aAAa,QAAQ,EAAE,IAAI;CAC7B,IAAI,EAAE,QAAQ,EAAE,aAAa,UAAU,QAAQ;MAC1C,EAAE,gBAAgB,QAAQ;CAC/B,IAAI,EAAE,KAAK,EAAE,aAAa,OAAO,EAAE,GAAG;MACjC,EAAE,gBAAgB,KAAK;AAC9B;AACA,IAAa,eAAe,OAA4B;CAAE,MAAM,EAAE;CAAM,QAAQ,CAAC,CAAC,EAAE;CAAQ,KAAK,EAAE,OAAO;AAAS;;AAEnH,IAAa,iBAAiB,GAAc,iBAAoC;CAC9E,MAAM,EAAE;CACR,QAAQ,eAAe,CAAC,CAAC,EAAE;CAC3B,GAAI,EAAE,OAAO,EAAE,QAAQ,WAAW,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC;AACtD;;AAG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AAK;MAAK,SAAQ;MAAQ,SAAS;MAAU,UAAA;KAE3D,CAAA;KACR,oBAAC,QAAD;MAAQ,MAAK;MAAS,MAAK;MAAK,SAAQ;MAAU,UAAU,CAAC,WAAW,CAAC;MAAI,UAAA;KAErE,CAAA;IACL;;EACD;;AAEV"}
1
+ {"version":3,"file":"link-form.js","names":[],"sources":["../../../src/controls/rich-text/link-form.tsx"],"sourcesContent":["/**\n * RICH TEXT · a link inside the text. A text link and a button are edited in V2's own link panel (controls/link.tsx\n * LinkPopoverBody: Type, the page/section/address, new tab and Rel; RTE:1696) and stored as production's link mark:\n * the resolved href, target and rel (`toLinkValue` / `fromLinkValue`). The image block uses the same panel; `LinkForm`\n * below is kept only as a deprecated alias of it.\n */\nimport { LinkPopoverBody, type LinkRel, type LinkValue } from \"../link\";\n\nexport interface TextLink {\n href: string;\n newTab?: boolean;\n /** absent = follow (V2 writes no rel for it) */\n rel?: Exclude<LinkRel, \"follow\">;\n}\n\nconst RELS: Exclude<LinkRel, \"follow\">[] = [\"nofollow\", \"sponsored\", \"ugc\"];\n/** An anchor's link as stored: href, a new tab, and its rel (a new tab's noopener/noreferrer are the renderer's). */\nexport function textLinkOf(a: HTMLAnchorElement): TextLink {\n const tokens = (a.getAttribute(\"rel\") ?? \"\").toLowerCase().split(/\\s+/);\n const rel = RELS.find((r) => tokens.includes(r));\n return { href: a.getAttribute(\"href\") ?? \"\", newTab: a.getAttribute(\"target\") === \"_blank\", ...(rel ? { rel } : {}) };\n}\n/** Writes a link onto its anchor: href, target and rel (none for follow). */\nexport function applyTextLink(a: HTMLAnchorElement, l: TextLink) {\n a.setAttribute(\"href\", l.href);\n if (l.newTab) a.setAttribute(\"target\", \"_blank\");\n else a.removeAttribute(\"target\");\n if (l.rel) a.setAttribute(\"rel\", l.rel);\n else a.removeAttribute(\"rel\");\n}\nexport const toLinkValue = (l: TextLink): LinkValue => ({ href: l.href, newTab: !!l.newTab, rel: l.rel ?? \"follow\" });\n/** V2 saveLink (RTE:883-899): the resolved href is what is stored; a page or section pick re-reads from it. */\nexport const fromLinkValue = (v: LinkValue, allowNewTab: boolean): TextLink => ({\n href: v.href,\n newTab: allowNewTab && !!v.newTab,\n ...(v.rel && v.rel !== \"follow\" ? { rel: v.rel } : {}),\n});\n\n/** An address a link may carry: http(s), mailto, tel, a site path or an in-page anchor. */\nexport function linkProblem(href: string): string | null {\n const h = href.trim();\n if (!h) return \"Add an address first.\";\n if (/^(https?:\\/\\/[^\\s]+|mailto:[^\\s]+|tel:[+\\d][\\d\\s()-]*|\\/(?!\\/)[^\\s]*|#[^\\s]+)$/i.test(h)) return null;\n if (/^[a-z][a-z0-9+.-]*:/i.test(h)) return \"Use an address that starts with https://, mailto: or tel:.\";\n if (/^[^\\s/]+\\.[^\\s]+$/.test(h)) return `Add https:// in front: https://${h}`;\n return \"Use a full address (https://…), a page path (/about) or an anchor (#section).\";\n}\n\n/**\n * @deprecated since 3.1.0: the address-only form V2 never had. It now renders V2's one link panel (`LinkPopoverBody`,\n * controls/link.tsx), so every link opens the same UI; import that directly. Removed at the next major.\n */\nexport function LinkForm({\n initial,\n allowNewTab,\n onSave,\n onCancel,\n onDetach,\n dirty = false,\n}: {\n initial: TextLink;\n allowNewTab: boolean;\n onSave: (v: TextLink) => void;\n onCancel: () => void;\n onDetach?: () => void;\n /** something the host draws beside the form changed (a button's label), so Apply has something to save */\n dirty?: boolean;\n}) {\n return (\n <LinkPopoverBody\n initial={toLinkValue(initial)}\n hideOptions={!allowNewTab}\n onSave={(v) => onSave(fromLinkValue(v, allowNewTab))}\n onCancel={onCancel}\n onDetach={onDetach}\n dirty={dirty}\n />\n );\n}\n"],"mappings":";;;;;;;;;AAeA,IAAM,OAAqC;CAAC;CAAY;CAAa;AAAK;;AAE1E,SAAgB,WAAW,GAAgC;CACzD,MAAM,UAAU,EAAE,aAAa,KAAK,KAAK,GAAA,CAAI,YAAY,CAAC,CAAC,MAAM,KAAK;CACtE,MAAM,MAAM,KAAK,MAAM,MAAM,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, sticky, stickyTop = 0, width, dense, fmt, md, allows, hideFullscreen, insertOpen, setInsertOpen, onMenuOpen, onStyle, onMark, onList, onLink, onClear, onComment, onInlineCode, onCodeBlock, onInsert, keepFocusOnInsertClose, onFullscreen, onMarkdown, saveSel }) {
140
140
  const w = width - (dense ? 40 : 0);
141
- const foldUS = w < 430;
141
+ const foldU = w < 280;
142
+ const foldS = w < 430;
142
143
  const foldLists = w < 480;
143
144
  const foldMd = w < 400;
144
145
  const foldClear = w < 360;
@@ -146,6 +147,9 @@ function FormatToolbar({ open, sticky, stickyTop = 0, width, dense, fmt, md, all
146
147
  const off = md;
147
148
  const styles = stylesFor(allows);
148
149
  const marks = ["underline", "strikeThrough"].filter((m) => allows(MARK_FEATURE[m]));
150
+ const folded = (m) => m === "underline" ? foldU : foldS;
151
+ const barMarks = marks.filter((m) => !folded(m));
152
+ const menuMarks = marks.filter(folded);
149
153
  const lists = ["ul", "ol"].filter((l) => allows(l));
150
154
  const linkTip = fmt.hasSel || fmt.onLink ? "Link" : "Link (select some text first)";
151
155
  const commentTip = fmt.hasSel ? "Comment" : "Comment (select some text first)";
@@ -158,7 +162,7 @@ function FormatToolbar({ open, sticky, stickyTop = 0, width, dense, fmt, md, all
158
162
  const listLabel = (l) => l === "ul" ? "Bulleted list" : "Numbered list";
159
163
  const markIcon = (m) => m === "underline" ? /* @__PURE__ */ jsx(IconUnderline, { stroke: 1.5 }) : /* @__PURE__ */ jsx(IconStrikethrough, { stroke: 1.5 });
160
164
  const markLabel = (m) => m === "underline" ? "Underline" : "Strikethrough";
161
- const more = foldUS && marks.length || foldLists && lists.length || foldClear || foldMd || allows("code") || allows("pre");
165
+ const more = menuMarks.length > 0 || foldLists && lists.length || foldClear || foldMd || allows("code") || allows("pre");
162
166
  return /* @__PURE__ */ jsx("div", {
163
167
  className: cn("overflow-clip rounded-t-kit-lg", open ? "h-8 pointer-coarse:h-11" : "h-0", sticky && open && "sticky z-[4]"),
164
168
  style: sticky && open ? { top: stickyTop } : void 0,
@@ -195,7 +199,7 @@ function FormatToolbar({ open, sticky, stickyTop = 0, width, dense, fmt, md, all
195
199
  disabled: off,
196
200
  onClick: () => onMark("italic")
197
201
  }) : null,
198
- foldUS ? null : marks.map((m) => /* @__PURE__ */ jsx(ToolButton, {
202
+ barMarks.map((m) => /* @__PURE__ */ jsx(ToolButton, {
199
203
  label: markLabel(m),
200
204
  icon: markIcon(m),
201
205
  shortcut: m === "underline" ? "⌘U" : void 0,
@@ -254,7 +258,7 @@ function FormatToolbar({ open, sticky, stickyTop = 0, width, dense, fmt, md, all
254
258
  className: "w-56",
255
259
  finalFocus: false,
256
260
  children: [
257
- foldUS ? marks.map((m) => /* @__PURE__ */ jsx(MenuItem, {
261
+ menuMarks.map((m) => /* @__PURE__ */ jsx(MenuItem, {
258
262
  disabled: off,
259
263
  icon: markIcon(m),
260
264
  shortcut: m === "underline" ? "⌘U" : void 0,
@@ -263,7 +267,7 @@ function FormatToolbar({ open, sticky, stickyTop = 0, width, dense, fmt, md, all
263
267
  className: "flex w-full items-center",
264
268
  children: [markLabel(m), check(m === "underline" ? fmt.underline : fmt.strike)]
265
269
  })
266
- }, m)) : null,
270
+ }, m)),
267
271
  foldLists ? lists.map((l) => /* @__PURE__ */ jsx(MenuItem, {
268
272
  disabled: off,
269
273
  icon: listIcon(l),
@@ -281,7 +285,7 @@ function FormatToolbar({ open, sticky, stickyTop = 0, width, dense, fmt, md, all
281
285
  onClick: onMarkdown,
282
286
  children: md ? "Return to rich text" : "View and edit as Markdown"
283
287
  }) : null,
284
- foldUS && marks.length || foldLists && lists.length || foldClear || foldMd ? /* @__PURE__ */ jsx(MenuSeparator, {}) : null,
288
+ menuMarks.length > 0 || foldLists && lists.length || foldClear || foldMd ? /* @__PURE__ */ jsx(MenuSeparator, {}) : null,
285
289
  allows("code") ? /* @__PURE__ */ jsx(MenuItem, {
286
290
  disabled: off,
287
291
  icon: /* @__PURE__ */ jsx(IconCode, { stroke: 1.5 }),
@@ -1 +1 @@
1
- {"version":3,"file":"toolbar.js","names":[],"sources":["../../../src/controls/rich-text/toolbar.tsx"],"sourcesContent":["/**\n * RICH TEXT · the field toolbar (V2 HEAD controls/rich-text/toolbar.tsx, production order):\n * Style ▾ | B I U S | • 1. | Link, Clear formatting, Comment | ▾ more | + Insert ····· Markdown · Open full editor\n * The overflow is a chevron next to the formatting, never a second \"⋯\" (the field's label row owns the one ⋯ menu).\n * It takes no room at rest (h-0, inert, aria-hidden) and slides open to 32px when the field is in use. Items fold into\n * \"More formatting options\" as the field narrows. A control whose element the field does not accept is not drawn.\n */\nimport * as React from \"react\";\nimport {\n IconArrowsMaximize, IconBlockquote, IconBold, IconCheck, IconChevronDown, IconClearFormatting, IconCode, IconH1, IconH2, IconH3, IconH4, IconH5,\n IconH6, IconItalic, IconLink, IconList, IconListNumbers, IconMarkdown, IconMarkdownOff, IconMessage, IconPilcrow, IconPlus, IconStrikethrough,\n IconTerminal2, IconUnderline,\n} from \"@tabler/icons-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Popover, PopoverTrigger, Tooltip } from \"../../ui/overlay\";\nimport { InsertMenuContent, type CatalogItem } from \"./catalog\";\nimport type { RichTextFeature } from \"./codec\";\n\nexport interface Fmt {\n bold: boolean;\n italic: boolean;\n underline: boolean;\n strike: boolean;\n sup: boolean;\n sub: boolean;\n ul: boolean;\n ol: boolean;\n /** lower-case tag of the caret's top-level block, or \"island\" */\n block: string;\n hasSel: boolean;\n onLink: boolean;\n}\nexport const EMPTY_FMT: Fmt = { bold: false, italic: false, underline: false, strike: false, sup: false, sub: false, ul: false, ol: false, block: \"p\", hasSel: false, onLink: false };\n\nexport type MarkCmd = \"bold\" | \"italic\" | \"underline\" | \"strikeThrough\" | \"superscript\" | \"subscript\";\nexport const MARK_FEATURE: Record<MarkCmd, RichTextFeature> = { bold: \"bold\", italic: \"italic\", underline: \"underline\", strikeThrough: \"strike\", superscript: \"sup\", subscript: \"sub\" };\n\nexport const STYLES: { tag: string; label: string; short: string; icon: React.ReactNode }[] = [\n { tag: \"p\", label: \"Text\", short: \"Text\", icon: <IconPilcrow stroke={1.5} /> },\n { tag: \"h1\", label: \"Heading 1\", short: \"H1\", icon: <IconH1 stroke={1.5} /> },\n { tag: \"h2\", label: \"Heading 2\", short: \"H2\", icon: <IconH2 stroke={1.5} /> },\n { tag: \"h3\", label: \"Heading 3\", short: \"H3\", icon: <IconH3 stroke={1.5} /> },\n { tag: \"h4\", label: \"Heading 4\", short: \"H4\", icon: <IconH4 stroke={1.5} /> },\n { tag: \"h5\", label: \"Heading 5\", short: \"H5\", icon: <IconH5 stroke={1.5} /> },\n { tag: \"h6\", label: \"Heading 6\", short: \"H6\", icon: <IconH6 stroke={1.5} /> },\n { tag: \"blockquote\", label: \"Quote\", short: \"Quote\", icon: <IconBlockquote stroke={1.5} /> },\n];\n/** The block styles a field accepts (Text always). */\nexport const stylesFor = (allows: (f: RichTextFeature) => boolean) => STYLES.filter((s) => s.tag === \"p\" || allows(s.tag as RichTextFeature));\n\nconst keepCaret = (e: React.MouseEvent) => e.preventDefault();\n\nexport function ToolButton({\n label,\n tip,\n icon,\n onClick,\n active,\n disabled,\n shortcut,\n children,\n className,\n side,\n}: {\n label: string;\n tip?: string;\n icon: React.ReactNode;\n onClick?: () => void;\n active?: boolean;\n disabled?: boolean;\n shortcut?: string;\n children?: React.ReactNode;\n className?: string;\n /** The tooltip's side; the overlay's default (top) when omitted. */\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n}) {\n return (\n <Tooltip content={tip ?? label} shortcut={shortcut} side={side}>\n <button\n type=\"button\"\n aria-label={label}\n aria-pressed={active}\n aria-disabled={disabled || undefined}\n onMouseDown={keepCaret}\n onClick={() => !disabled && onClick?.()}\n className={cn(\n \"flex h-7 min-w-7 shrink-0 items-center justify-center gap-1 rounded-kit-md px-1.5 text-kit-sm text-kit-fg-2 transition-colors hover:bg-kit-hover hover:text-kit-fg [&_svg]:size-4\",\n active && \"bg-kit-selected text-kit-fg\",\n disabled && \"opacity-40 hover:bg-transparent hover:text-kit-fg-2\",\n className,\n )}\n >\n {icon}\n {children}\n </button>\n </Tooltip>\n );\n}\n\n/** \"Block style\" dropdown. Compact trigger: Text / H1…H6 / Quote. */\nexport function StyleMenu({\n block,\n styles,\n onPick,\n onOpenChange,\n disabled,\n className,\n}: {\n block: string;\n styles: typeof STYLES;\n onPick: (tag: string) => void;\n onOpenChange?: (o: boolean) => void;\n disabled?: boolean;\n className?: string;\n}) {\n const cur = STYLES.find((s) => s.tag === block);\n return (\n <Menu onOpenChange={onOpenChange}>\n <Tooltip content=\"Block style\">\n <MenuTrigger\n disabled={disabled}\n aria-label=\"Block style\"\n onMouseDown={keepCaret}\n className={cn(\n \"flex h-7 shrink-0 items-center gap-1 rounded-kit-md pl-2 pr-1.5 text-kit-sm font-medium text-kit-fg hover:bg-kit-hover disabled:opacity-40 data-[popup-open]:bg-kit-hover\",\n !cur && \"text-kit-fg-2\",\n className,\n )}\n >\n {cur?.short ?? \"Text\"}\n <IconChevronDown className=\"size-3.5 text-kit-fg-3\" stroke={1.5} aria-hidden />\n </MenuTrigger>\n </Tooltip>\n <MenuContent className=\"w-48\" finalFocus={false}>\n {styles.map((s) => (\n <MenuItem key={s.tag} icon={s.icon} onClick={() => onPick(s.tag)}>\n <span className=\"flex w-full items-center justify-between\">\n {s.label}\n {block === s.tag ? <IconCheck className=\"size-3.5 text-kit-fg-2\" stroke={2} aria-hidden /> : null}\n </span>\n </MenuItem>\n ))}\n </MenuContent>\n </Menu>\n );\n}\n\nconst Sep = () => <span aria-hidden className=\"mx-1 h-4 w-px shrink-0 bg-kit-line\" />;\n\nexport function FormatToolbar({\n open,\n sticky,\n stickyTop = 0,\n width,\n dense,\n fmt,\n md,\n allows,\n hideFullscreen,\n insertOpen,\n setInsertOpen,\n onMenuOpen,\n onStyle,\n onMark,\n onList,\n onLink,\n onClear,\n onComment,\n onInlineCode,\n onCodeBlock,\n onInsert,\n keepFocusOnInsertClose,\n onFullscreen,\n onMarkdown,\n saveSel,\n}: {\n open: boolean;\n sticky: boolean;\n stickyTop?: number;\n width: number;\n dense: boolean;\n fmt: Fmt;\n md: boolean;\n allows: (f: RichTextFeature) => boolean;\n hideFullscreen?: boolean;\n insertOpen: boolean;\n setInsertOpen: (o: boolean) => void;\n onMenuOpen: (name: \"style\" | \"more\", o: boolean) => void;\n onStyle: (tag: string) => void;\n onMark: (cmd: MarkCmd) => void;\n onList: (kind: \"ul\" | \"ol\") => void;\n onLink: () => void;\n onClear: () => void;\n onComment?: () => void;\n onInlineCode: () => void;\n onCodeBlock: () => void;\n onInsert: (it: CatalogItem) => void;\n keepFocusOnInsertClose: () => boolean;\n onFullscreen: () => void;\n onMarkdown: () => void;\n saveSel: () => void;\n}) {\n const w = width - (dense ? 40 : 0);\n const foldUS = w < 430;\n const foldLists = w < 480;\n const foldMd = w < 400;\n const foldClear = w < 360;\n const insertLabel = w >= 590;\n const off = md;\n const styles = stylesFor(allows);\n const marks = ([\"underline\", \"strikeThrough\"] as const).filter((m) => allows(MARK_FEATURE[m]));\n const lists = ([\"ul\", \"ol\"] as const).filter((l) => allows(l));\n const linkTip = fmt.hasSel || fmt.onLink ? \"Link\" : \"Link (select some text first)\";\n const commentTip = fmt.hasSel ? \"Comment\" : \"Comment (select some text first)\";\n const check = (on: boolean) => (on ? <IconCheck className=\"ml-auto size-3.5 text-kit-fg-2\" stroke={2} aria-hidden /> : null);\n const listIcon = (l: \"ul\" | \"ol\") => (l === \"ul\" ? <IconList stroke={1.5} /> : <IconListNumbers stroke={1.5} />);\n const listLabel = (l: \"ul\" | \"ol\") => (l === \"ul\" ? \"Bulleted list\" : \"Numbered list\");\n const markIcon = (m: \"underline\" | \"strikeThrough\") => (m === \"underline\" ? <IconUnderline stroke={1.5} /> : <IconStrikethrough stroke={1.5} />);\n const markLabel = (m: \"underline\" | \"strikeThrough\") => (m === \"underline\" ? \"Underline\" : \"Strikethrough\");\n const more = (foldUS && marks.length) || (foldLists && lists.length) || foldClear || foldMd || allows(\"code\") || allows(\"pre\");\n\n return (\n <div\n // Opens at once: it shows on every focus of the body, and a height animation is layout work every frame.\n className={cn(\"overflow-clip rounded-t-kit-lg\", open ? \"h-8 pointer-coarse:h-11\" : \"h-0\", sticky && open && \"sticky z-[4]\")}\n style={sticky && open ? { top: stickyTop } : undefined}\n inert={!open}\n aria-hidden={!open}\n >\n <div\n role=\"toolbar\"\n aria-label=\"Text formatting\"\n onMouseDown={(e) => {\n if (!(e.target as HTMLElement).closest(\"button\")) e.preventDefault();\n }}\n className={cn(\"flex h-full items-center gap-0.5 border-b border-kit-line bg-kit-subtle px-1 transition-opacity duration-[120ms] ease-out motion-reduce:transition-none\", open ? \"opacity-100\" : \"opacity-0\")}\n >\n {styles.length > 1 ? (\n <>\n <StyleMenu block={fmt.block} styles={styles} onPick={onStyle} disabled={off} onOpenChange={(o) => onMenuOpen(\"style\", o)} />\n <Sep />\n </>\n ) : null}\n {allows(\"bold\") ? <ToolButton label=\"Bold\" icon={<IconBold stroke={1.5} />} shortcut=\"⌘B\" active={fmt.bold} disabled={off} onClick={() => onMark(\"bold\")} /> : null}\n {allows(\"italic\") ? <ToolButton label=\"Italic\" icon={<IconItalic stroke={1.5} />} shortcut=\"⌘I\" active={fmt.italic} disabled={off} onClick={() => onMark(\"italic\")} /> : null}\n {foldUS\n ? null\n : marks.map((m) => (\n <ToolButton key={m} label={markLabel(m)} icon={markIcon(m)} shortcut={m === \"underline\" ? \"⌘U\" : undefined} active={m === \"underline\" ? fmt.underline : fmt.strike} disabled={off} onClick={() => onMark(m)} />\n ))}\n {foldLists || !lists.length ? null : (\n <>\n <Sep />\n {lists.map((l) => (\n <ToolButton key={l} label={listLabel(l)} icon={listIcon(l)} active={fmt[l]} disabled={off} onClick={() => onList(l)} />\n ))}\n </>\n )}\n <Sep />\n {allows(\"link\") ? (\n <ToolButton label=\"Link\" tip={linkTip} icon={<IconLink stroke={1.5} />} shortcut={fmt.hasSel || fmt.onLink ? \"⌘K\" : undefined} active={fmt.onLink} disabled={off || !(fmt.hasSel || fmt.onLink)} onClick={onLink} />\n ) : null}\n {foldClear ? null : <ToolButton label=\"Clear formatting\" icon={<IconClearFormatting stroke={1.5} />} disabled={off} onClick={onClear} />}\n {onComment ? <ToolButton label=\"Comment\" tip={commentTip} icon={<IconMessage stroke={1.5} />} disabled={off || !fmt.hasSel} onClick={onComment} /> : null}\n {more ? (\n <Menu onOpenChange={(o) => onMenuOpen(\"more\", o)}>\n <Tooltip content=\"More formatting\">\n <MenuTrigger\n aria-label=\"More formatting options\"\n onMouseDown={(e) => {\n e.preventDefault();\n saveSel();\n }}\n className=\"flex h-7 w-5 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg [&_svg]:size-3.5\"\n >\n <IconChevronDown stroke={1.5} aria-hidden />\n </MenuTrigger>\n </Tooltip>\n <MenuContent align=\"start\" className=\"w-56\" finalFocus={false}>\n {foldUS\n ? marks.map((m) => (\n <MenuItem key={m} disabled={off} icon={markIcon(m)} shortcut={m === \"underline\" ? \"⌘U\" : undefined} onClick={() => onMark(m)}>\n <span className=\"flex w-full items-center\">\n {markLabel(m)}\n {check(m === \"underline\" ? fmt.underline : fmt.strike)}\n </span>\n </MenuItem>\n ))\n : null}\n {foldLists\n ? lists.map((l) => (\n <MenuItem key={l} disabled={off} icon={listIcon(l)} onClick={() => onList(l)}>\n {listLabel(l)}\n </MenuItem>\n ))\n : null}\n {foldClear ? (\n <MenuItem disabled={off} icon={<IconClearFormatting stroke={1.5} />} onClick={onClear}>\n Clear formatting\n </MenuItem>\n ) : null}\n {foldMd ? (\n <MenuItem icon={md ? <IconMarkdownOff stroke={1.5} /> : <IconMarkdown stroke={1.5} />} onClick={onMarkdown}>\n {md ? \"Return to rich text\" : \"View and edit as Markdown\"}\n </MenuItem>\n ) : null}\n {(foldUS && marks.length) || (foldLists && lists.length) || foldClear || foldMd ? <MenuSeparator /> : null}\n {allows(\"code\") ? (\n <MenuItem disabled={off} icon={<IconCode stroke={1.5} />} shortcut=\"⌘E\" onClick={onInlineCode}>\n Inline code\n </MenuItem>\n ) : null}\n {allows(\"pre\") ? (\n <MenuItem disabled={off} icon={<IconTerminal2 stroke={1.5} />} onClick={onCodeBlock}>\n Code\n </MenuItem>\n ) : null}\n </MenuContent>\n </Menu>\n ) : null}\n <Sep />\n <Popover open={insertOpen} onOpenChange={setInsertOpen}>\n <Tooltip content=\"Insert a block\">\n <PopoverTrigger\n disabled={off}\n aria-label=\"Insert\"\n onMouseDown={() => saveSel()}\n className=\"flex h-7 shrink-0 items-center gap-1 rounded-kit-md px-1.5 text-kit-sm text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg disabled:opacity-40 data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg [&_svg]:size-4\"\n >\n <IconPlus stroke={1.5} aria-hidden />\n {insertLabel ? \"Insert\" : null}\n </PopoverTrigger>\n </Tooltip>\n {insertOpen ? <InsertMenuContent allows={allows} onInsert={onInsert} keepFocusOnClose={keepFocusOnInsertClose} /> : null}\n </Popover>\n\n <span className=\"min-w-1 flex-1\" />\n\n {foldMd ? null : (\n <ToolButton label={md ? \"Return to rich text\" : \"View and edit as Markdown\"} icon={md ? <IconMarkdownOff stroke={1.5} /> : <IconMarkdown stroke={1.5} />} active={md} onClick={onMarkdown} />\n )}\n {hideFullscreen ? null : <ToolButton label=\"Expand editor\" icon={<IconArrowsMaximize stroke={1.5} />} shortcut=\"⌘↵\" onClick={onFullscreen} />}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAgCA,IAAa,YAAiB;CAAE,MAAM;CAAO,QAAQ;CAAO,WAAW;CAAO,QAAQ;CAAO,KAAK;CAAO,KAAK;CAAO,IAAI;CAAO,IAAI;CAAO,OAAO;CAAK,QAAQ;CAAO,QAAQ;AAAM;AAGpL,IAAa,eAAiD;CAAE,MAA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S,OACR,oBAAC,YAAD;KAAY,OAAO,KAAK,wBAAwB;KAA6B,MAAM,KAAK,oBAAC,iBAAD,EAAiB,QAAQ,IAAM,CAAA,IAAI,oBAAC,cAAD,EAAc,QAAQ,IAAM,CAAA;KAAG,QAAQ;KAAI,SAAS;IAAa,CAAA;IAE7L,iBAAiB,OAAO,oBAAC,YAAD;KAAY,OAAM;KAAgB,MAAM,oBAAC,oBAAD,EAAoB,QAAQ,IAAM,CAAA;KAAG,UAAS;KAAK,SAAS;IAAe,CAAA;GACzI;;CACF,CAAA;AAET"}
1
+ {"version":3,"file":"toolbar.js","names":[],"sources":["../../../src/controls/rich-text/toolbar.tsx"],"sourcesContent":["/**\n * RICH TEXT · the field toolbar (V2 HEAD controls/rich-text/toolbar.tsx, production order):\n * Style ▾ | B I U S | • 1. | Link, Clear formatting, Comment | ▾ more | + Insert ····· Markdown · Open full editor\n * The overflow is a chevron next to the formatting, never a second \"⋯\" (the field's label row owns the one ⋯ menu).\n * It takes no room at rest (h-0, inert, aria-hidden) and slides open to 32px when the field is in use. Items fold into\n * \"More formatting options\" as the field narrows. A control whose element the field does not accept is not drawn.\n */\nimport * as React from \"react\";\nimport {\n IconArrowsMaximize, IconBlockquote, IconBold, IconCheck, IconChevronDown, IconClearFormatting, IconCode, IconH1, IconH2, IconH3, IconH4, IconH5,\n IconH6, IconItalic, IconLink, IconList, IconListNumbers, IconMarkdown, IconMarkdownOff, IconMessage, IconPilcrow, IconPlus, IconStrikethrough,\n IconTerminal2, IconUnderline,\n} from \"@tabler/icons-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Popover, PopoverTrigger, Tooltip } from \"../../ui/overlay\";\nimport { InsertMenuContent, type CatalogItem } from \"./catalog\";\nimport type { RichTextFeature } from \"./codec\";\n\nexport interface Fmt {\n bold: boolean;\n italic: boolean;\n underline: boolean;\n strike: boolean;\n sup: boolean;\n sub: boolean;\n ul: boolean;\n ol: boolean;\n /** lower-case tag of the caret's top-level block, or \"island\" */\n block: string;\n hasSel: boolean;\n onLink: boolean;\n}\nexport const EMPTY_FMT: Fmt = { bold: false, italic: false, underline: false, strike: false, sup: false, sub: false, ul: false, ol: false, block: \"p\", hasSel: false, onLink: false };\n\nexport type MarkCmd = \"bold\" | \"italic\" | \"underline\" | \"strikeThrough\" | \"superscript\" | \"subscript\";\nexport const MARK_FEATURE: Record<MarkCmd, RichTextFeature> = { bold: \"bold\", italic: \"italic\", underline: \"underline\", strikeThrough: \"strike\", superscript: \"sup\", subscript: \"sub\" };\n\nexport const STYLES: { tag: string; label: string; short: string; icon: React.ReactNode }[] = [\n { tag: \"p\", label: \"Text\", short: \"Text\", icon: <IconPilcrow stroke={1.5} /> },\n { tag: \"h1\", label: \"Heading 1\", short: \"H1\", icon: <IconH1 stroke={1.5} /> },\n { tag: \"h2\", label: \"Heading 2\", short: \"H2\", icon: <IconH2 stroke={1.5} /> },\n { tag: \"h3\", label: \"Heading 3\", short: \"H3\", icon: <IconH3 stroke={1.5} /> },\n { tag: \"h4\", label: \"Heading 4\", short: \"H4\", icon: <IconH4 stroke={1.5} /> },\n { tag: \"h5\", label: \"Heading 5\", short: \"H5\", icon: <IconH5 stroke={1.5} /> },\n { tag: \"h6\", label: \"Heading 6\", short: \"H6\", icon: <IconH6 stroke={1.5} /> },\n { tag: \"blockquote\", label: \"Quote\", short: \"Quote\", icon: <IconBlockquote stroke={1.5} /> },\n];\n/** The block styles a field accepts (Text always). */\nexport const stylesFor = (allows: (f: RichTextFeature) => boolean) => STYLES.filter((s) => s.tag === \"p\" || allows(s.tag as RichTextFeature));\n\nconst keepCaret = (e: React.MouseEvent) => e.preventDefault();\n\nexport function ToolButton({\n label,\n tip,\n icon,\n onClick,\n active,\n disabled,\n shortcut,\n children,\n className,\n side,\n}: {\n label: string;\n tip?: string;\n icon: React.ReactNode;\n onClick?: () => void;\n active?: boolean;\n disabled?: boolean;\n shortcut?: string;\n children?: React.ReactNode;\n className?: string;\n /** The tooltip's side; the overlay's default (top) when omitted. */\n side?: \"top\" | \"bottom\" | \"left\" | \"right\";\n}) {\n return (\n <Tooltip content={tip ?? label} shortcut={shortcut} side={side}>\n <button\n type=\"button\"\n aria-label={label}\n aria-pressed={active}\n aria-disabled={disabled || undefined}\n onMouseDown={keepCaret}\n onClick={() => !disabled && onClick?.()}\n className={cn(\n \"flex h-7 min-w-7 shrink-0 items-center justify-center gap-1 rounded-kit-md px-1.5 text-kit-sm text-kit-fg-2 transition-colors hover:bg-kit-hover hover:text-kit-fg [&_svg]:size-4\",\n active && \"bg-kit-selected text-kit-fg\",\n disabled && \"opacity-40 hover:bg-transparent hover:text-kit-fg-2\",\n className,\n )}\n >\n {icon}\n {children}\n </button>\n </Tooltip>\n );\n}\n\n/** \"Block style\" dropdown. Compact trigger: Text / H1…H6 / Quote. */\nexport function StyleMenu({\n block,\n styles,\n onPick,\n onOpenChange,\n disabled,\n className,\n}: {\n block: string;\n styles: typeof STYLES;\n onPick: (tag: string) => void;\n onOpenChange?: (o: boolean) => void;\n disabled?: boolean;\n className?: string;\n}) {\n const cur = STYLES.find((s) => s.tag === block);\n return (\n <Menu onOpenChange={onOpenChange}>\n <Tooltip content=\"Block style\">\n <MenuTrigger\n disabled={disabled}\n aria-label=\"Block style\"\n onMouseDown={keepCaret}\n className={cn(\n \"flex h-7 shrink-0 items-center gap-1 rounded-kit-md pl-2 pr-1.5 text-kit-sm font-medium text-kit-fg hover:bg-kit-hover disabled:opacity-40 data-[popup-open]:bg-kit-hover\",\n !cur && \"text-kit-fg-2\",\n className,\n )}\n >\n {cur?.short ?? \"Text\"}\n <IconChevronDown className=\"size-3.5 text-kit-fg-3\" stroke={1.5} aria-hidden />\n </MenuTrigger>\n </Tooltip>\n <MenuContent className=\"w-48\" finalFocus={false}>\n {styles.map((s) => (\n <MenuItem key={s.tag} icon={s.icon} onClick={() => onPick(s.tag)}>\n <span className=\"flex w-full items-center justify-between\">\n {s.label}\n {block === s.tag ? <IconCheck className=\"size-3.5 text-kit-fg-2\" stroke={2} aria-hidden /> : null}\n </span>\n </MenuItem>\n ))}\n </MenuContent>\n </Menu>\n );\n}\n\nconst Sep = () => <span aria-hidden className=\"mx-1 h-4 w-px shrink-0 bg-kit-line\" />;\n\nexport function FormatToolbar({\n open,\n sticky,\n stickyTop = 0,\n width,\n dense,\n fmt,\n md,\n allows,\n hideFullscreen,\n insertOpen,\n setInsertOpen,\n onMenuOpen,\n onStyle,\n onMark,\n onList,\n onLink,\n onClear,\n onComment,\n onInlineCode,\n onCodeBlock,\n onInsert,\n keepFocusOnInsertClose,\n onFullscreen,\n onMarkdown,\n saveSel,\n}: {\n open: boolean;\n sticky: boolean;\n stickyTop?: number;\n width: number;\n dense: boolean;\n fmt: Fmt;\n md: boolean;\n allows: (f: RichTextFeature) => boolean;\n hideFullscreen?: boolean;\n insertOpen: boolean;\n setInsertOpen: (o: boolean) => void;\n onMenuOpen: (name: \"style\" | \"more\", o: boolean) => void;\n onStyle: (tag: string) => void;\n onMark: (cmd: MarkCmd) => void;\n onList: (kind: \"ul\" | \"ol\") => void;\n onLink: () => void;\n onClear: () => void;\n onComment?: () => void;\n onInlineCode: () => void;\n onCodeBlock: () => void;\n onInsert: (it: CatalogItem) => void;\n keepFocusOnInsertClose: () => boolean;\n onFullscreen: () => void;\n onMarkdown: () => void;\n saveSel: () => void;\n}) {\n const w = width - (dense ? 40 : 0);\n // BL-538: Underline keeps its button down to a narrow field; Strikethrough folds first\n const foldU = w < 280;\n const foldS = w < 430;\n const foldLists = w < 480;\n const foldMd = w < 400;\n const foldClear = w < 360;\n const insertLabel = w >= 590;\n const off = md;\n const styles = stylesFor(allows);\n const marks = ([\"underline\", \"strikeThrough\"] as const).filter((m) => allows(MARK_FEATURE[m]));\n const folded = (m: (typeof marks)[number]) => (m === \"underline\" ? foldU : foldS);\n const barMarks = marks.filter((m) => !folded(m));\n const menuMarks = marks.filter(folded);\n const lists = ([\"ul\", \"ol\"] as const).filter((l) => allows(l));\n const linkTip = fmt.hasSel || fmt.onLink ? \"Link\" : \"Link (select some text first)\";\n const commentTip = fmt.hasSel ? \"Comment\" : \"Comment (select some text first)\";\n const check = (on: boolean) => (on ? <IconCheck className=\"ml-auto size-3.5 text-kit-fg-2\" stroke={2} aria-hidden /> : null);\n const listIcon = (l: \"ul\" | \"ol\") => (l === \"ul\" ? <IconList stroke={1.5} /> : <IconListNumbers stroke={1.5} />);\n const listLabel = (l: \"ul\" | \"ol\") => (l === \"ul\" ? \"Bulleted list\" : \"Numbered list\");\n const markIcon = (m: \"underline\" | \"strikeThrough\") => (m === \"underline\" ? <IconUnderline stroke={1.5} /> : <IconStrikethrough stroke={1.5} />);\n const markLabel = (m: \"underline\" | \"strikeThrough\") => (m === \"underline\" ? \"Underline\" : \"Strikethrough\");\n const more = menuMarks.length > 0 || (foldLists && lists.length) || foldClear || foldMd || allows(\"code\") || allows(\"pre\");\n\n return (\n <div\n // Opens at once: it shows on every focus of the body, and a height animation is layout work every frame.\n className={cn(\"overflow-clip rounded-t-kit-lg\", open ? \"h-8 pointer-coarse:h-11\" : \"h-0\", sticky && open && \"sticky z-[4]\")}\n style={sticky && open ? { top: stickyTop } : undefined}\n inert={!open}\n aria-hidden={!open}\n >\n <div\n role=\"toolbar\"\n aria-label=\"Text formatting\"\n onMouseDown={(e) => {\n if (!(e.target as HTMLElement).closest(\"button\")) e.preventDefault();\n }}\n className={cn(\"flex h-full items-center gap-0.5 border-b border-kit-line bg-kit-subtle px-1 transition-opacity duration-[120ms] ease-out motion-reduce:transition-none\", open ? \"opacity-100\" : \"opacity-0\")}\n >\n {styles.length > 1 ? (\n <>\n <StyleMenu block={fmt.block} styles={styles} onPick={onStyle} disabled={off} onOpenChange={(o) => onMenuOpen(\"style\", o)} />\n <Sep />\n </>\n ) : null}\n {allows(\"bold\") ? <ToolButton label=\"Bold\" icon={<IconBold stroke={1.5} />} shortcut=\"⌘B\" active={fmt.bold} disabled={off} onClick={() => onMark(\"bold\")} /> : null}\n {allows(\"italic\") ? <ToolButton label=\"Italic\" icon={<IconItalic stroke={1.5} />} shortcut=\"⌘I\" active={fmt.italic} disabled={off} onClick={() => onMark(\"italic\")} /> : null}\n {barMarks.map((m) => (\n <ToolButton key={m} label={markLabel(m)} icon={markIcon(m)} shortcut={m === \"underline\" ? \"⌘U\" : undefined} active={m === \"underline\" ? fmt.underline : fmt.strike} disabled={off} onClick={() => onMark(m)} />\n ))}\n {foldLists || !lists.length ? null : (\n <>\n <Sep />\n {lists.map((l) => (\n <ToolButton key={l} label={listLabel(l)} icon={listIcon(l)} active={fmt[l]} disabled={off} onClick={() => onList(l)} />\n ))}\n </>\n )}\n <Sep />\n {allows(\"link\") ? (\n <ToolButton label=\"Link\" tip={linkTip} icon={<IconLink stroke={1.5} />} shortcut={fmt.hasSel || fmt.onLink ? \"⌘K\" : undefined} active={fmt.onLink} disabled={off || !(fmt.hasSel || fmt.onLink)} onClick={onLink} />\n ) : null}\n {foldClear ? null : <ToolButton label=\"Clear formatting\" icon={<IconClearFormatting stroke={1.5} />} disabled={off} onClick={onClear} />}\n {onComment ? <ToolButton label=\"Comment\" tip={commentTip} icon={<IconMessage stroke={1.5} />} disabled={off || !fmt.hasSel} onClick={onComment} /> : null}\n {more ? (\n <Menu onOpenChange={(o) => onMenuOpen(\"more\", o)}>\n <Tooltip content=\"More formatting\">\n <MenuTrigger\n aria-label=\"More formatting options\"\n onMouseDown={(e) => {\n e.preventDefault();\n saveSel();\n }}\n className=\"flex h-7 w-5 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-3 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg [&_svg]:size-3.5\"\n >\n <IconChevronDown stroke={1.5} aria-hidden />\n </MenuTrigger>\n </Tooltip>\n <MenuContent align=\"start\" className=\"w-56\" finalFocus={false}>\n {menuMarks.map((m) => (\n <MenuItem key={m} disabled={off} icon={markIcon(m)} shortcut={m === \"underline\" ? \"⌘U\" : undefined} onClick={() => onMark(m)}>\n <span className=\"flex w-full items-center\">\n {markLabel(m)}\n {check(m === \"underline\" ? fmt.underline : fmt.strike)}\n </span>\n </MenuItem>\n ))}\n {foldLists\n ? lists.map((l) => (\n <MenuItem key={l} disabled={off} icon={listIcon(l)} onClick={() => onList(l)}>\n {listLabel(l)}\n </MenuItem>\n ))\n : null}\n {foldClear ? (\n <MenuItem disabled={off} icon={<IconClearFormatting stroke={1.5} />} onClick={onClear}>\n Clear formatting\n </MenuItem>\n ) : null}\n {foldMd ? (\n <MenuItem icon={md ? <IconMarkdownOff stroke={1.5} /> : <IconMarkdown stroke={1.5} />} onClick={onMarkdown}>\n {md ? \"Return to rich text\" : \"View and edit as Markdown\"}\n </MenuItem>\n ) : null}\n {menuMarks.length > 0 || (foldLists && lists.length) || foldClear || foldMd ? <MenuSeparator /> : null}\n {allows(\"code\") ? (\n <MenuItem disabled={off} icon={<IconCode stroke={1.5} />} shortcut=\"⌘E\" onClick={onInlineCode}>\n Inline code\n </MenuItem>\n ) : null}\n {allows(\"pre\") ? (\n <MenuItem disabled={off} icon={<IconTerminal2 stroke={1.5} />} onClick={onCodeBlock}>\n Code\n </MenuItem>\n ) : null}\n </MenuContent>\n </Menu>\n ) : null}\n <Sep />\n <Popover open={insertOpen} onOpenChange={setInsertOpen}>\n <Tooltip content=\"Insert a block\">\n <PopoverTrigger\n disabled={off}\n aria-label=\"Insert\"\n onMouseDown={() => saveSel()}\n className=\"flex h-7 shrink-0 items-center gap-1 rounded-kit-md px-1.5 text-kit-sm text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg disabled:opacity-40 data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg [&_svg]:size-4\"\n >\n <IconPlus stroke={1.5} aria-hidden />\n {insertLabel ? \"Insert\" : null}\n </PopoverTrigger>\n </Tooltip>\n {insertOpen ? <InsertMenuContent allows={allows} onInsert={onInsert} keepFocusOnClose={keepFocusOnInsertClose} /> : null}\n </Popover>\n\n <span className=\"min-w-1 flex-1\" />\n\n {foldMd ? null : (\n <ToolButton label={md ? \"Return to rich text\" : \"View and edit as Markdown\"} icon={md ? <IconMarkdownOff stroke={1.5} /> : <IconMarkdown stroke={1.5} />} active={md} onClick={onMarkdown} />\n )}\n {hideFullscreen ? null : <ToolButton label=\"Expand editor\" icon={<IconArrowsMaximize stroke={1.5} />} shortcut=\"⌘↵\" onClick={onFullscreen} />}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAgCA,IAAa,YAAiB;CAAE,MAAM;CAAO,QAAQ;CAAO,WAAW;CAAO,QAAQ;CAAO,KAAK;CAAO,KAAK;CAAO,IAAI;CAAO,IAAI;CAAO,OAAO;CAAK,QAAQ;CAAO,QAAQ;AAAM;AAGpL,IAAa,eAAiD;CAAE,MAAM;CAAQ,QAAQ;CAAU,WAAW;CAAa,eAAe;CAAU,aAAa;CAAO,WAAW;AAAM;AAEtL,IAAa,SAAiF;CAC5F;EAAE,KAAK;EAAK,OAAO;EAAQ,OAAO;EAAQ,MAAM,oBAAC,aAAD,EAAa,QAAQ,IAAM,CAAA;CAAE;CAC7E;EAAE,KAAK;EAAM,OAAO;EAAa,OAAO;EAAM,MAAM,oBAAC,QAAD,EAAQ,QAAQ,IAAM,CAAA;CAAE;CAC5E;EAAE,KAAK;EAAM,OAAO;EAAa,OAAO;EAAM,MAAM,oBAAC,QAAD,EAAQ,QAAQ,IAAM,CAAA;CAAE;CAC5E;EAAE,KAAK;EAAM,OAAO;EAAa,OAAO;EAAM,MAAM,oBAAC,QAAD,EAAQ,QAAQ,IAAM,CAAA;CAAE;CAC5E;EAAE,KAAK;EAAM,OAAO;EAAa,OAAO;EAAM,MAAM,oBAAC,QAAD,EAAQ,QAAQ,IAAM,CAAA;CAAE;CAC5E;EAAE,KAAK;EAAM,OAAO;EAAa,OAAO;EAAM,MAAM,oBAAC,QAAD,EAAQ,QAAQ,IAAM,CAAA;CAAE;CAC5E;EAAE,KAAK;EAAM,OAAO;EAAa,OAAO;EAAM,MAA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CAAA,IACR;OACH,OAAO,KAAK,IACX,oBAAC,UAAD;QAAU,UAAU;QAAK,MAAM,oBAAC,eAAD,EAAe,QAAQ,IAAM,CAAA;QAAG,SAAS;QAAa,UAAA;OAE3E,CAAA,IACR;MACO;KACT,CAAA,CAAA;IACJ,CAAA,IAAA;IACJ,oBAAC,KAAD,CAAM,CAAA;IACN,qBAAC,SAAD;KAAS,MAAM;KAAY,cAAc;KAAzC,UAAA,CACE,oBAAC,SAAD;MAAS,SAAQ;MACf,UAAA,qBAAC,gBAAD;OACE,UAAU;OACV,cAAW;OACX,mBAAmB,QAAQ;OAC3B,WAAU;OAJZ,UAAA,CAME,oBAAC,UAAD;QAAU,QAAQ;QAAK,eAAA;OAAa,CAAA,GACnC,cAAc,WAAW,IACZ;;KACT,CAAA,GACR,aAAa,oBAAC,mBAAD;MAA2B;MAAkB;MAAU,kBAAkB;KAAyB,CAAA,IAAI,IAC7G;;IAET,oBAAC,QAAD,EAAM,WAAU,iBAAkB,CAAA;IAEjC,SAAS,OACR,oBAAC,YAAD;KAAY,OAAO,KAAK,wBAAwB;KAA6B,MAAM,KAAK,oBAAC,iBAAD,EAAiB,QAAQ,IAAM,CAAA,IAAI,oBAAC,cAAD,EAAc,QAAQ,IAAM,CAAA;KAAG,QAAQ;KAAI,SAAS;IAAa,CAAA;IAE7L,iBAAiB,OAAO,oBAAC,YAAD;KAAY,OAAM;KAAgB,MAAM,oBAAC,oBAAD,EAAoB,QAAQ,IAAM,CAAA;KAAG,UAAS;KAAK,SAAS;IAAe,CAAA;GACzI;;CACF,CAAA;AAET"}
@@ -10,8 +10,9 @@ import { IconLink } from "@tabler/icons-react";
10
10
  //#region src/controls/table/table-link.tsx
11
11
  /**
12
12
  * A link cell's address (BE TableLink `{ label, href, newTab?, rel? }`): the address, "Open in a new tab" and the
13
- * relationship search engines read. V2 opened its global link panel (controls/link.tsx LinkPopoverBody); that panel is the
14
- * link lane's, so the table carries this one, writing the same four keys the backend takes and nothing else.
13
+ * relationship search engines read. V2's spreadsheet has its own cell popover for this (table/table-editor.tsx `LinkUrl`:
14
+ * an address and Save), apart from the global link panel the rest of the kit uses; this is that popover, writing the same
15
+ * four keys the backend takes and nothing else.
15
16
  *
16
17
  * Refusals are named before anything is written: a script address (javascript:, data:, vbscript:) is refused here
17
18
  * exactly as the backend refuses it (`link_value_invalid`).
@@ -1 +1 @@
1
- {"version":3,"file":"table-link.js","names":[],"sources":["../../../src/controls/table/table-link.tsx"],"sourcesContent":["/**\n * A link cell's address (BE TableLink `{ label, href, newTab?, rel? }`): the address, \"Open in a new tab\" and the\n * relationship search engines read. V2 opened its global link panel (controls/link.tsx LinkPopoverBody); that panel is the\n * link lane's, so the table carries this one, writing the same four keys the backend takes and nothing else.\n *\n * Refusals are named before anything is written: a script address (javascript:, data:, vbscript:) is refused here\n * exactly as the backend refuses it (`link_value_invalid`).\n */\nimport * as React from \"react\";\nimport { IconLink } from \"@tabler/icons-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../../ui/button\";\nimport { Input } from \"../../ui/input\";\nimport { Switch } from \"../../ui/controls\";\nimport { Select } from \"../../ui/select\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/overlay\";\nimport type { TableLink } from \"../../schema/table\";\n\nexport const LINK_RELS: { value: NonNullable<TableLink[\"rel\"]>; label: string }[] = [\n { value: \"follow\", label: \"Follow (default)\" },\n { value: \"nofollow\", label: \"Don't vouch for it (nofollow)\" },\n { value: \"sponsored\", label: \"Paid or sponsored\" },\n { value: \"ugc\", label: \"Written by visitors\" },\n];\n\n/** BE link-value.ts isScriptHref: what no link may hold. */\nexport const isScriptHref = (href: string) => /^\\s*(javascript|data|vbscript):/i.test(href.replace(/[\\p{Cc}\\s]+/gu, \"\"));\nexport const hrefProblem = (href: string) => (isScriptHref(href) ? \"Script links (javascript:, data:, vbscript:) aren't allowed.\" : null);\n\n/** The stored link with only the keys it uses: `newTab` only when on, `rel` only when not the default. */\nexport function tableLink(label: string, href: string, newTab?: boolean, rel?: TableLink[\"rel\"]): TableLink {\n return { label, href, ...(newTab ? { newTab: true } : {}), ...(rel && rel !== \"follow\" ? { rel } : {}) };\n}\n\n/** Address + options, as one popover body (the spreadsheet's link button) or inline (a row's link cell). */\nexport function LinkAddressEditor({\n link,\n onSave,\n onCancel,\n autoFocus,\n}: {\n link: TableLink;\n onSave: (next: TableLink) => void;\n onCancel?: () => void;\n autoFocus?: boolean;\n}) {\n const [href, setHref] = React.useState(link.href);\n const [newTab, setNewTab] = React.useState(!!link.newTab);\n const [rel, setRel] = React.useState<NonNullable<TableLink[\"rel\"]>>(link.rel ?? \"follow\");\n const id = React.useId();\n const problem = hrefProblem(href);\n const save = () => !problem && onSave(tableLink(link.label, href.trim(), newTab, rel));\n return (\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex flex-col gap-1.5\">\n <label htmlFor={`${id}-href`} className=\"text-kit-xs font-medium text-kit-fg-2\">Address</label>\n <Input\n id={`${id}-href`}\n size=\"sm\"\n autoFocus={autoFocus}\n value={href}\n placeholder=\"https://… or /pricing\"\n aria-invalid={problem ? true : undefined}\n aria-describedby={problem ? `${id}-problem` : undefined}\n onChange={(e) => setHref(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") { e.preventDefault(); save(); }\n }}\n />\n {problem ? <p id={`${id}-problem`} role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">{problem}</p> : null}\n </div>\n <div className=\"flex min-h-8 items-center justify-between gap-2 text-kit-sm text-kit-fg-2\">\n <span aria-hidden>Open in a new tab</span>\n <Switch size=\"sm\" checked={newTab} onCheckedChange={setNewTab} aria-label=\"Open in a new tab\" />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <span id={`${id}-rel`} className=\"text-kit-xs font-medium text-kit-fg-2\">Search engines</span>\n <Select aria-label=\"Search engines\" size=\"sm\" value={rel} onValueChange={(v) => setRel(v as typeof rel)} options={LINK_RELS} />\n </div>\n <div className=\"flex items-center justify-end gap-1.5\">\n {link.href ? (\n <Button size=\"sm\" variant=\"ghost\" className=\"mr-auto text-kit-fg-2\" onClick={() => onSave(tableLink(link.label, \"\"))}>\n Remove link\n </Button>\n ) : null}\n {onCancel ? (\n <Button size=\"sm\" variant=\"ghost\" onClick={onCancel}>\n Cancel\n </Button>\n ) : null}\n <Button size=\"sm\" variant=\"primary\" disabled={!!problem} onClick={save}>\n Save\n </Button>\n </div>\n </div>\n );\n}\n\n/** The small link button beside a link cell's words: opens the address editor. */\nexport function LinkAddressButton({ link, onSave, readOnly, className }: { link: TableLink; onSave: (l: TableLink) => void; readOnly?: boolean; className?: string }) {\n const [open, setOpen] = React.useState(false);\n if (readOnly && !link.href) return null;\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n disabled={readOnly}\n tabIndex={-1}\n aria-label={link.href ? `Link: ${link.href}` : \"Add a link address\"}\n className={cn(\n \"flex size-5 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 outline-none hover:bg-kit-hover hover:text-kit-fg\",\n link.href && \"text-kit-fg-2\",\n className,\n )}\n >\n <IconLink className=\"size-3.5\" stroke={1.75} />\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-[320px] p-3\">\n <LinkAddressEditor\n link={link}\n autoFocus\n onCancel={() => setOpen(false)}\n onSave={(l) => {\n onSave(l);\n setOpen(false);\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAa,YAAuE;CAClF;EAAE,OAAO;EAAU,OAAO;CAAmB;CAC7C;EAAE,OAAO;EAAY,OAAO;CAAgC;CAC5D;EAAE,OAAO;EAAa,OAAO;CAAoB;CACjD;EAAE,OAAO;EAAO,OAAO;CAAsB;AAC/C;;AAGA,IAAa,gBAAgB,SAAiB,mCAAmC,KAAK,KAAK,QAAQ,iBAAiB,EAAE,CAAC;AACvH,IAAa,eAAe,SAAkB,aAAa,IAAI,IAAI,iEAAiE;;AAGpI,SAAgB,UAAU,O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ACQ;IACN,WAAA;IACA,gBAAgB,QAAQ,KAAK;IAC7B,SAAS,MAAM;KACb,OAAO,CAAC;KACR,QAAQ,KAAK;IACf;GACD,CAAA;EACa,CAAA,CACT;;AAEb"}
1
+ {"version":3,"file":"table-link.js","names":[],"sources":["../../../src/controls/table/table-link.tsx"],"sourcesContent":["/**\n * A link cell's address (BE TableLink `{ label, href, newTab?, rel? }`): the address, \"Open in a new tab\" and the\n * relationship search engines read. V2's spreadsheet has its own cell popover for this (table/table-editor.tsx `LinkUrl`:\n * an address and Save), apart from the global link panel the rest of the kit uses; this is that popover, writing the same\n * four keys the backend takes and nothing else.\n *\n * Refusals are named before anything is written: a script address (javascript:, data:, vbscript:) is refused here\n * exactly as the backend refuses it (`link_value_invalid`).\n */\nimport * as React from \"react\";\nimport { IconLink } from \"@tabler/icons-react\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../../ui/button\";\nimport { Input } from \"../../ui/input\";\nimport { Switch } from \"../../ui/controls\";\nimport { Select } from \"../../ui/select\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/overlay\";\nimport type { TableLink } from \"../../schema/table\";\n\nexport const LINK_RELS: { value: NonNullable<TableLink[\"rel\"]>; label: string }[] = [\n { value: \"follow\", label: \"Follow (default)\" },\n { value: \"nofollow\", label: \"Don't vouch for it (nofollow)\" },\n { value: \"sponsored\", label: \"Paid or sponsored\" },\n { value: \"ugc\", label: \"Written by visitors\" },\n];\n\n/** BE link-value.ts isScriptHref: what no link may hold. */\nexport const isScriptHref = (href: string) => /^\\s*(javascript|data|vbscript):/i.test(href.replace(/[\\p{Cc}\\s]+/gu, \"\"));\nexport const hrefProblem = (href: string) => (isScriptHref(href) ? \"Script links (javascript:, data:, vbscript:) aren't allowed.\" : null);\n\n/** The stored link with only the keys it uses: `newTab` only when on, `rel` only when not the default. */\nexport function tableLink(label: string, href: string, newTab?: boolean, rel?: TableLink[\"rel\"]): TableLink {\n return { label, href, ...(newTab ? { newTab: true } : {}), ...(rel && rel !== \"follow\" ? { rel } : {}) };\n}\n\n/** Address + options, as one popover body (the spreadsheet's link button) or inline (a row's link cell). */\nexport function LinkAddressEditor({\n link,\n onSave,\n onCancel,\n autoFocus,\n}: {\n link: TableLink;\n onSave: (next: TableLink) => void;\n onCancel?: () => void;\n autoFocus?: boolean;\n}) {\n const [href, setHref] = React.useState(link.href);\n const [newTab, setNewTab] = React.useState(!!link.newTab);\n const [rel, setRel] = React.useState<NonNullable<TableLink[\"rel\"]>>(link.rel ?? \"follow\");\n const id = React.useId();\n const problem = hrefProblem(href);\n const save = () => !problem && onSave(tableLink(link.label, href.trim(), newTab, rel));\n return (\n <div className=\"flex flex-col gap-3\">\n <div className=\"flex flex-col gap-1.5\">\n <label htmlFor={`${id}-href`} className=\"text-kit-xs font-medium text-kit-fg-2\">Address</label>\n <Input\n id={`${id}-href`}\n size=\"sm\"\n autoFocus={autoFocus}\n value={href}\n placeholder=\"https://… or /pricing\"\n aria-invalid={problem ? true : undefined}\n aria-describedby={problem ? `${id}-problem` : undefined}\n onChange={(e) => setHref(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") { e.preventDefault(); save(); }\n }}\n />\n {problem ? <p id={`${id}-problem`} role=\"alert\" className=\"text-kit-xs text-kit-danger-fg\">{problem}</p> : null}\n </div>\n <div className=\"flex min-h-8 items-center justify-between gap-2 text-kit-sm text-kit-fg-2\">\n <span aria-hidden>Open in a new tab</span>\n <Switch size=\"sm\" checked={newTab} onCheckedChange={setNewTab} aria-label=\"Open in a new tab\" />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <span id={`${id}-rel`} className=\"text-kit-xs font-medium text-kit-fg-2\">Search engines</span>\n <Select aria-label=\"Search engines\" size=\"sm\" value={rel} onValueChange={(v) => setRel(v as typeof rel)} options={LINK_RELS} />\n </div>\n <div className=\"flex items-center justify-end gap-1.5\">\n {link.href ? (\n <Button size=\"sm\" variant=\"ghost\" className=\"mr-auto text-kit-fg-2\" onClick={() => onSave(tableLink(link.label, \"\"))}>\n Remove link\n </Button>\n ) : null}\n {onCancel ? (\n <Button size=\"sm\" variant=\"ghost\" onClick={onCancel}>\n Cancel\n </Button>\n ) : null}\n <Button size=\"sm\" variant=\"primary\" disabled={!!problem} onClick={save}>\n Save\n </Button>\n </div>\n </div>\n );\n}\n\n/** The small link button beside a link cell's words: opens the address editor. */\nexport function LinkAddressButton({ link, onSave, readOnly, className }: { link: TableLink; onSave: (l: TableLink) => void; readOnly?: boolean; className?: string }) {\n const [open, setOpen] = React.useState(false);\n if (readOnly && !link.href) return null;\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n disabled={readOnly}\n tabIndex={-1}\n aria-label={link.href ? `Link: ${link.href}` : \"Add a link address\"}\n className={cn(\n \"flex size-5 shrink-0 items-center justify-center rounded-kit-sm text-kit-fg-4 outline-none hover:bg-kit-hover hover:text-kit-fg\",\n link.href && \"text-kit-fg-2\",\n className,\n )}\n >\n <IconLink className=\"size-3.5\" stroke={1.75} />\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-[320px] p-3\">\n <LinkAddressEditor\n link={link}\n autoFocus\n onCancel={() => setOpen(false)}\n onSave={(l) => {\n onSave(l);\n setOpen(false);\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAa,YAAuE;CAClF;EAAE,OAAO;EAAU,OAAO;CAAmB;CAC7C;EAAE,OAAO;EAAY,OAAO;CAAgC;CAC5D;EAAE,OAAO;EAAa,OAAO;CAAoB;CACjD;EAAE,OAAO;EAAO,OAAO;CAAsB;AAC/C;;AAGA,IAAa,gBAAgB,SAAiB,mCAAmC,KAAK,KAAK,QAAQ,iBAAiB,EAAE,CAAC;AACvH,IAAa,eAAe,SAAkB,aAAa,IAAI,IAAI,iEAAiE;;AAGpI,SAAgB,UAAU,OAAe,MAAc,QAAkB,KAAmC;CAC1G,OAAO;EAAE;EAAO;EAAM,GAAI,SAA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OAAO,CAAC;KACR,QAAQ,KAAK;IACf;GACD,CAAA;EACa,CAAA,CACT;;AAEb"}
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { KIT_ICONS, KitIcon, iconKey } from "./lib/icons.js";
9
9
  import { FieldDescribedByContext, FieldLabelledByContext, useFieldDescribedBy, useFieldId, useFieldLabelledBy } from "./ui/field-context.js";
10
10
  import { Spinner } from "./ui/spinner.js";
11
11
  import { Button, HintTooltip, IconButton, RevealLink, Sparkle, TooltipScope, buttonVariants, iconButtonVariants } from "./ui/button.js";
12
- import { ShortcutHint, ShortcutHintsProvider, shortcutHintsOn, useShortcutHints } from "./ui/shortcut-hint.js";
12
+ import { ShortcutHint, ShortcutHintsProvider, platformKeys, shortcutHintsOn, useShortcutHints } from "./ui/shortcut-hint.js";
13
13
  import { Checkbox, ChoiceCard, ChoiceList, Progress, Radio, RadioGroup, Segmented, Slider, Switch, ToggleGroup, ToggleItem } from "./ui/controls.js";
14
14
  import { FLOATING_LAYER, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, HeaderStatus, HoverCard, HoverCardContent, HoverCardTrigger, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, MoreOptions, OptionRow, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Sheet, SheetClose, SheetContent, SheetTrigger, Tooltip, TooltipProvider, useFocusReturn } from "./ui/overlay.js";
15
15
  import { IssueDot, Kbdish, RowChrome, Thumb, useLoadedFit } from "./engine/bits.js";
@@ -79,6 +79,6 @@ import "./kit.css";
79
79
  //#region src/index.ts
80
80
  registerKitControls();
81
81
  //#endregion
82
- export { ACTIONS, ACTION_WHEN_READ_ONLY, ADD_SEARCH_AT, AGENT_PRESENCE, AI_PRESETS, ARRAY_CONTROLS, ActionTray, AnimatedFields, Appear, ArrayField, Autocomplete, Avatar, AvatarStack, BUTTON_ICONS, Badge, BlockPicker, BooleanControl, BreakpointGroup, Button, ButtonControl, ButtonIconPicker, ButtonLinkEditor, ButtonPreview, ButtonScreen, ButtonStyleGrid, C1_ACTIONS, C1_CONTROLS, C2_CONTROLS, CAP_IDS, CATEGORY_TO_PROD, COALESCE_MS, CONTROLS, Card, CardHeader, Checkbox, ChoiceCard, ChoiceList, ChoiceSwitch, CodeControl, CodeDialogField, CodeSurface, ColorControl, ComponentSlotControl, DEFAULT_ENV, DEV_FIELD, DEV_ONLY_FIELD, DateControl, Dot, EmailControl, EmptyState, ExpandedEditorModal, FLOATING_LAYER, FallbackControl, Field, FieldDescribedByContext, FieldHeaderSlot, FieldInset, FieldLabelledByContext, FieldList, FieldSection, FieldShell, FieldUnit, FieldUnitRow, FieldsetSection, FileControl, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, FormPickerControl, FormProvider, FrameCrumbs, FrameHeader, FrameSlotsProvider, FrameStage, FrameView, GalleryControl, GroupTabs, HELP_STRINGS, HEX_COLOR, HISTORY_SEGMENT, HeaderStatus, HelpMore, Highlight, HintTooltip, HoverCard, HoverCardContent, HoverCardTrigger, IconButton, IconControl, IconPicker, IconValueGlyph, ImageControl, Input, InsetScope, IssueDot, ItemList, JsonControl, KIT_ICONS, Kbd, Kbdish, KitAddressContext, KitBreadcrumb, KitEnvProvider, KitField, KitIcon, KitSectionTitle, KitServicesProvider, KitToaster, LABEL_HINT_AT, LINK_TYPES, Label, LegacyFallback, LinkControl, LinkField, LinkForm, LinkLine, LinkOptions, LinkPicker, LinkPopoverBody, LinkQuickEdit, LocationControl, MediaPicker, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, MiniCalendar, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, ModeBar, ModeBarDot, ModeBarLink, MoreOptions, MultiSelectControl, NUMBER_SCALE, NavRow, NestedForm, NumberControl, OptionRow, OrderLockSlot, PageHeader, PeerStack, PlainNumber, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, REL_ITEMS, RHYTHM, RT_PROSE, Radio, RadioGroup, RatingControl, RefThumb, ReferenceControl, ReferencesControl, RevealLink, RichTextControl, RichTextEditor, RichTextExpandAction, RowChrome, RowList, RowsHostContext, SEARCH_THRESHOLD, SEGMENTED_MAX, SEGMENTED_MAX_LABEL, SHOPIFY_REF_LOCK, SITE_PALETTE, STYLE_ITEMS, ScaleControl, ScaleSlider, SchemaForm, SearchInput, SectionAnchorsProvider, Segmented, Select, SelectControl, Separator, SettingsSection, SharedSortProvider, Sheet, SheetClose, SheetContent, SheetTrigger, ShortcutHint, ShortcutHintsProvider, Skeleton, Slider, SlotDepthContext, SlotField, SlotPicker, SlugControl, SlugGenerate, Sparkle, Spinner, Stat, StatusMark, StatusPill, StringControl, StyleGlyph, Switch, TARGET_KEYS, TEXT_FOCUS, Tab, TabList, TabPanel, Table, TableControl, TableFrame, TableFullScreenAction, Tabs, TagsControl, Td, TextControl, Textarea, Th, Thumb, ToggleGroup, ToggleItem, Tooltip, TooltipProvider, TooltipScope, Tr, TrayMeta, TrayMore, UNDO_STEPS, UnknownValueNote, UnreadableValue, UrlControl, VideoControl, VideoPreview, acceptsFile, actionTrayClass, apiName, arrangeFields, arrayMove, avatarRingSpread, badgeVariants, blockDefToSchema, buttonFromProd, buttonToProd, buttonVariants, cn, codeFromProd, codeToProd, collectIssues, colorFor, conventionalHelp, cropChoice, cropPreset, cropRect, crumbSignature, dateFromProd, dateToProd, datetimeFromProd, datetimeToProd, defaultGroup, describeLink, detectType, ensureKeys, failingRules, fieldAccessOf, fieldDefToSchema, fieldDefsToSchema, fileNameFromUrl, fileTarget, filterOptions, finalizeLink, findTarget, fitsSegmented, formatBytes, frameContext, frameDirection, framesToCrumbs, fromAsset, fromTypeSchema, getIn, groupSummary, hasLink, hrefOf, iconButtonVariants, iconKey, imageFromProd, imageToProd, inferField, isBreakpointName, isCropRect, isDockIcon, isDrillable, isFormOnly, isHidden, isShort, isVideoUrl, jsonProblem, kitPathItems, kitToast, kitToastManager, leafValuePlan, linkFromProd, linkIcon, linkProblem, linkShapeOf, linkText, linkToProd, listFromProd, listToProd, locationFromDraft, lookLabel, lookOf, matchPositions, matchScore, newBlock, newItem, nextButton, nodeText, normImage, normLink, optionIcons, parentTitleOf, parseTargetTag, pathKey, pickerHex, plainOf, plainText, planFromProd, planToProd, presenceColor, presenceSlot, previewOf, prod_types_exports as prod, propDefToField, propsToTypeSchema, ratingFromProd, ratingScale, ratingToProd, refFilterText, referenceFromProd, referenceNoun, referenceToProd, registerC1Controls, registerC2Controls, registerKitControls, registerKitServices, registerPresenceRoster, resetFieldClipboard, resolveFieldAccess, resolveFrames, resolveHelp, rootFrame, rowToggleField, scaleFromProd, scaleToProd, schemaSlugOf, seesDevSurfaces, selectTriggerClass, setIn, shortcutHintsOn, slugSource, slugTidy, slugTyping, snapRating, statusMap, storedLink, str, summarize, tableFromProd, tableToProd, tagRefusal, tagsFromProd, tagsToProd, targetTag, textLength, titleFromKey, toNum, toTypeSchema, typedRowsFromProd, typedRowsToProd, uniqueKey, useAvailableBlocks, useDragReorder, useDrill, useFieldAccess, useFieldDescribedBy, useFieldId, useFieldLabelledBy, useFocusReturn, useForm, useFrameNavigation, useFrameSlots, useGroupStatus, useInsetDepth, useKitEnv, useKitServices, useLinkTargets, useListOps, useLoadedFit, useOwnDescription, useReferenceRecords, useRhythm, useRichTextRefs, useSharedSort, useShortcutHints, useUpload, validateValue, variantFamilyFromTypeSchema, variantFamilyToTypeSchema, variantGroupV2, videoFromProd, videoProvider, videoToProd, visibleFields, visibleSchema, withCrop, withDefaultHelp, withTarget, withText, youTubeId, zoneListFromProd, zoneListToProd };
82
+ export { ACTIONS, ACTION_WHEN_READ_ONLY, ADD_SEARCH_AT, AGENT_PRESENCE, AI_PRESETS, ARRAY_CONTROLS, ActionTray, AnimatedFields, Appear, ArrayField, Autocomplete, Avatar, AvatarStack, BUTTON_ICONS, Badge, BlockPicker, BooleanControl, BreakpointGroup, Button, ButtonControl, ButtonIconPicker, ButtonLinkEditor, ButtonPreview, ButtonScreen, ButtonStyleGrid, C1_ACTIONS, C1_CONTROLS, C2_CONTROLS, CAP_IDS, CATEGORY_TO_PROD, COALESCE_MS, CONTROLS, Card, CardHeader, Checkbox, ChoiceCard, ChoiceList, ChoiceSwitch, CodeControl, CodeDialogField, CodeSurface, ColorControl, ComponentSlotControl, DEFAULT_ENV, DEV_FIELD, DEV_ONLY_FIELD, DateControl, Dot, EmailControl, EmptyState, ExpandedEditorModal, FLOATING_LAYER, FallbackControl, Field, FieldDescribedByContext, FieldHeaderSlot, FieldInset, FieldLabelledByContext, FieldList, FieldSection, FieldShell, FieldUnit, FieldUnitRow, FieldsetSection, FileControl, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, FormPickerControl, FormProvider, FrameCrumbs, FrameHeader, FrameSlotsProvider, FrameStage, FrameView, GalleryControl, GroupTabs, HELP_STRINGS, HEX_COLOR, HISTORY_SEGMENT, HeaderStatus, HelpMore, Highlight, HintTooltip, HoverCard, HoverCardContent, HoverCardTrigger, IconButton, IconControl, IconPicker, IconValueGlyph, ImageControl, Input, InsetScope, IssueDot, ItemList, JsonControl, KIT_ICONS, Kbd, Kbdish, KitAddressContext, KitBreadcrumb, KitEnvProvider, KitField, KitIcon, KitSectionTitle, KitServicesProvider, KitToaster, LABEL_HINT_AT, LINK_TYPES, Label, LegacyFallback, LinkControl, LinkField, LinkForm, LinkLine, LinkOptions, LinkPicker, LinkPopoverBody, LinkQuickEdit, LocationControl, MediaPicker, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, MiniCalendar, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, ModeBar, ModeBarDot, ModeBarLink, MoreOptions, MultiSelectControl, NUMBER_SCALE, NavRow, NestedForm, NumberControl, OptionRow, OrderLockSlot, PageHeader, PeerStack, PlainNumber, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, REL_ITEMS, RHYTHM, RT_PROSE, Radio, RadioGroup, RatingControl, RefThumb, ReferenceControl, ReferencesControl, RevealLink, RichTextControl, RichTextEditor, RichTextExpandAction, RowChrome, RowList, RowsHostContext, SEARCH_THRESHOLD, SEGMENTED_MAX, SEGMENTED_MAX_LABEL, SHOPIFY_REF_LOCK, SITE_PALETTE, STYLE_ITEMS, ScaleControl, ScaleSlider, SchemaForm, SearchInput, SectionAnchorsProvider, Segmented, Select, SelectControl, Separator, SettingsSection, SharedSortProvider, Sheet, SheetClose, SheetContent, SheetTrigger, ShortcutHint, ShortcutHintsProvider, Skeleton, Slider, SlotDepthContext, SlotField, SlotPicker, SlugControl, SlugGenerate, Sparkle, Spinner, Stat, StatusMark, StatusPill, StringControl, StyleGlyph, Switch, TARGET_KEYS, TEXT_FOCUS, Tab, TabList, TabPanel, Table, TableControl, TableFrame, TableFullScreenAction, Tabs, TagsControl, Td, TextControl, Textarea, Th, Thumb, ToggleGroup, ToggleItem, Tooltip, TooltipProvider, TooltipScope, Tr, TrayMeta, TrayMore, UNDO_STEPS, UnknownValueNote, UnreadableValue, UrlControl, VideoControl, VideoPreview, acceptsFile, actionTrayClass, apiName, arrangeFields, arrayMove, avatarRingSpread, badgeVariants, blockDefToSchema, buttonFromProd, buttonToProd, buttonVariants, cn, codeFromProd, codeToProd, collectIssues, colorFor, conventionalHelp, cropChoice, cropPreset, cropRect, crumbSignature, dateFromProd, dateToProd, datetimeFromProd, datetimeToProd, defaultGroup, describeLink, detectType, ensureKeys, failingRules, fieldAccessOf, fieldDefToSchema, fieldDefsToSchema, fileNameFromUrl, fileTarget, filterOptions, finalizeLink, findTarget, fitsSegmented, formatBytes, frameContext, frameDirection, framesToCrumbs, fromAsset, fromTypeSchema, getIn, groupSummary, hasLink, hrefOf, iconButtonVariants, iconKey, imageFromProd, imageToProd, inferField, isBreakpointName, isCropRect, isDockIcon, isDrillable, isFormOnly, isHidden, isShort, isVideoUrl, jsonProblem, kitPathItems, kitToast, kitToastManager, leafValuePlan, linkFromProd, linkIcon, linkProblem, linkShapeOf, linkText, linkToProd, listFromProd, listToProd, locationFromDraft, lookLabel, lookOf, matchPositions, matchScore, newBlock, newItem, nextButton, nodeText, normImage, normLink, optionIcons, parentTitleOf, parseTargetTag, pathKey, pickerHex, plainOf, plainText, planFromProd, planToProd, platformKeys, presenceColor, presenceSlot, previewOf, prod_types_exports as prod, propDefToField, propsToTypeSchema, ratingFromProd, ratingScale, ratingToProd, refFilterText, referenceFromProd, referenceNoun, referenceToProd, registerC1Controls, registerC2Controls, registerKitControls, registerKitServices, registerPresenceRoster, resetFieldClipboard, resolveFieldAccess, resolveFrames, resolveHelp, rootFrame, rowToggleField, scaleFromProd, scaleToProd, schemaSlugOf, seesDevSurfaces, selectTriggerClass, setIn, shortcutHintsOn, slugSource, slugTidy, slugTyping, snapRating, statusMap, storedLink, str, summarize, tableFromProd, tableToProd, tagRefusal, tagsFromProd, tagsToProd, targetTag, textLength, titleFromKey, toNum, toTypeSchema, typedRowsFromProd, typedRowsToProd, uniqueKey, useAvailableBlocks, useDragReorder, useDrill, useFieldAccess, useFieldDescribedBy, useFieldId, useFieldLabelledBy, useFocusReturn, useForm, useFrameNavigation, useFrameSlots, useGroupStatus, useInsetDepth, useKitEnv, useKitServices, useLinkTargets, useListOps, useLoadedFit, useOwnDescription, useReferenceRecords, useRhythm, useRichTextRefs, useSharedSort, useShortcutHints, useUpload, validateValue, variantFamilyFromTypeSchema, variantFamilyToTypeSchema, variantGroupV2, videoFromProd, videoProvider, videoToProd, visibleFields, visibleSchema, withCrop, withDefaultHelp, withTarget, withText, youTubeId, zoneListFromProd, zoneListToProd };
83
83
 
84
84
  //# sourceMappingURL=index.js.map
package/dist/ui/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { FieldDescribedByContext, FieldLabelledByContext, useFieldDescribedBy, useFieldId, useFieldLabelledBy } from "./field-context.js";
2
2
  import { Spinner } from "./spinner.js";
3
3
  import { Button, HintTooltip, IconButton, RevealLink, Sparkle, TooltipScope, buttonVariants, iconButtonVariants } from "./button.js";
4
- import { ShortcutHint, ShortcutHintsProvider, shortcutHintsOn, useShortcutHints } from "./shortcut-hint.js";
4
+ import { ShortcutHint, ShortcutHintsProvider, platformKeys, shortcutHintsOn, useShortcutHints } from "./shortcut-hint.js";
5
5
  import { Checkbox, ChoiceCard, ChoiceList, Progress, Radio, RadioGroup, Segmented, Slider, Switch, ToggleGroup, ToggleItem } from "./controls.js";
6
6
  import { FLOATING_LAYER, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, HeaderStatus, HoverCard, HoverCardContent, HoverCardTrigger, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, MoreOptions, OptionRow, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Sheet, SheetClose, SheetContent, SheetTrigger, Tooltip, TooltipProvider, useFocusReturn } from "./overlay.js";
7
7
  import { Avatar, AvatarStack, Badge, Card, CardHeader, Dot, EmptyState, Kbd, PageHeader, Separator, SettingsSection, Skeleton, Stat, StatusMark, StatusPill, Table, Td, Th, Tr, avatarRingSpread, badgeVariants, colorFor, statusMap } from "./display.js";
@@ -15,4 +15,4 @@ import { ActionTray, TrayMeta, TrayMore, actionTrayClass } from "./action-tray.j
15
15
  import { ModeBar, ModeBarDot, ModeBarLink } from "./mode-bar.js";
16
16
  import { Tab, TabList, TabPanel, Tabs } from "./tab.js";
17
17
  import { KitToaster, kitToast, kitToastManager } from "./toast.js";
18
- export { AGENT_PRESENCE, ActionTray, Autocomplete, Avatar, AvatarStack, Badge, Button, Card, CardHeader, Checkbox, ChoiceCard, ChoiceList, ChoiceSwitch, Dot, EmptyState, ExpandedEditorModal, FLOATING_LAYER, Field, FieldDescribedByContext, FieldLabelledByContext, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, HeaderStatus, HelpMore, Highlight, HintTooltip, HoverCard, HoverCardContent, HoverCardTrigger, IconButton, Input, Kbd, KitToaster, Label, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, ModeBar, ModeBarDot, ModeBarLink, MoreOptions, OptionRow, PageHeader, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, Radio, RadioGroup, RevealLink, SEARCH_THRESHOLD, SEGMENTED_MAX, SEGMENTED_MAX_LABEL, SearchInput, Segmented, Select, Separator, SettingsSection, Sheet, SheetClose, SheetContent, SheetTrigger, ShortcutHint, ShortcutHintsProvider, Skeleton, Slider, Sparkle, Spinner, Stat, StatusMark, StatusPill, Switch, Tab, TabList, TabPanel, Table, Tabs, Td, Textarea, Th, ToggleGroup, ToggleItem, Tooltip, TooltipProvider, TooltipScope, Tr, TrayMeta, TrayMore, actionTrayClass, avatarRingSpread, badgeVariants, buttonVariants, colorFor, filterOptions, fitsSegmented, iconButtonVariants, kitToast, kitToastManager, matchPositions, matchScore, nodeText, presenceColor, presenceSlot, registerPresenceRoster, selectTriggerClass, shortcutHintsOn, statusMap, useFieldDescribedBy, useFieldId, useFieldLabelledBy, useFocusReturn, useShortcutHints };
18
+ export { AGENT_PRESENCE, ActionTray, Autocomplete, Avatar, AvatarStack, Badge, Button, Card, CardHeader, Checkbox, ChoiceCard, ChoiceList, ChoiceSwitch, Dot, EmptyState, ExpandedEditorModal, FLOATING_LAYER, Field, FieldDescribedByContext, FieldLabelledByContext, FlowBody, FlowClose, FlowFooter, FlowHeader, FlowLabel, FlowModal, HeaderStatus, HelpMore, Highlight, HintTooltip, HoverCard, HoverCardContent, HoverCardTrigger, IconButton, Input, Kbd, KitToaster, Label, Menu, MenuCheckItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Modal, ModalBody, ModalClose, ModalContent, ModalFooter, ModalHeader, ModalTrigger, ModeBar, ModeBarDot, ModeBarLink, MoreOptions, OptionRow, PageHeader, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, Radio, RadioGroup, RevealLink, SEARCH_THRESHOLD, SEGMENTED_MAX, SEGMENTED_MAX_LABEL, SearchInput, Segmented, Select, Separator, SettingsSection, Sheet, SheetClose, SheetContent, SheetTrigger, ShortcutHint, ShortcutHintsProvider, Skeleton, Slider, Sparkle, Spinner, Stat, StatusMark, StatusPill, Switch, Tab, TabList, TabPanel, Table, Tabs, Td, Textarea, Th, ToggleGroup, ToggleItem, Tooltip, TooltipProvider, TooltipScope, Tr, TrayMeta, TrayMore, actionTrayClass, avatarRingSpread, badgeVariants, buttonVariants, colorFor, filterOptions, fitsSegmented, iconButtonVariants, kitToast, kitToastManager, matchPositions, matchScore, nodeText, platformKeys, presenceColor, presenceSlot, registerPresenceRoster, selectTriggerClass, shortcutHintsOn, statusMap, useFieldDescribedBy, useFieldId, useFieldLabelledBy, useFocusReturn, useShortcutHints };
@@ -2,7 +2,7 @@ import { cn } from "../lib/cn.js";
2
2
  import { KIT_SCOPE } from "./surfaces.js";
3
3
  import { MODAL_LAYER, TooltipLayer, TooltipRoot } from "./tooltip-root.js";
4
4
  import { IconButton, TooltipScope } from "./button.js";
5
- import { useShortcutHints } from "./shortcut-hint.js";
5
+ import { platformKeys, useShortcutHints } from "./shortcut-hint.js";
6
6
  import * as React from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { IconCheck, IconChevronRight, IconX } from "@tabler/icons-react";
@@ -49,7 +49,7 @@ function Tooltip({ content, children, side = "top", shortcut, delay = 350, disab
49
49
  }), shortcut && hints ? /* @__PURE__ */ jsx("kbd", {
50
50
  "data-hint": "shortcuts",
51
51
  className: "mt-px shrink-0 rounded-kit-sm bg-kit-ink-active px-1 font-kit-sans text-kit-2xs",
52
- children: shortcut
52
+ children: platformKeys(shortcut)
53
53
  }) : null]
54
54
  })] })
55
55
  });
@@ -155,7 +155,7 @@ function MenuItem({ className, icon, shortcut, danger, children, ...props }) {
155
155
  }),
156
156
  shortcut ? /* @__PURE__ */ jsx("span", {
157
157
  className: "text-kit-xs text-kit-fg-3",
158
- children: shortcut
158
+ children: platformKeys(shortcut)
159
159
  }) : null
160
160
  ]
161
161
  });