@bettercms-ai/kit 4.1.1 → 4.2.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/context.d.ts +8 -0
  2. package/dist/context.js.map +1 -1
  3. package/dist/controls/rich-text/block-tool.d.ts +1 -1
  4. package/dist/controls/rich-text/block-tool.js +1 -1
  5. package/dist/controls/rich-text/block-tool.js.map +1 -1
  6. package/dist/controls/rich-text/blocks.js +3 -1
  7. package/dist/controls/rich-text/blocks.js.map +1 -1
  8. package/dist/controls/rich-text/catalog.d.ts +26 -3
  9. package/dist/controls/rich-text/catalog.js +239 -58
  10. package/dist/controls/rich-text/catalog.js.map +1 -1
  11. package/dist/controls/rich-text/codec.d.ts +1 -1
  12. package/dist/controls/rich-text/codec.js +2 -1
  13. package/dist/controls/rich-text/codec.js.map +1 -1
  14. package/dist/controls/rich-text/dom.js +8 -3
  15. package/dist/controls/rich-text/dom.js.map +1 -1
  16. package/dist/controls/rich-text/editor.js +32 -6
  17. package/dist/controls/rich-text/editor.js.map +1 -1
  18. package/dist/controls/rich-text/rewriteSelection.d.ts +25 -0
  19. package/dist/controls/rich-text/rewriteSelection.js +28 -0
  20. package/dist/controls/rich-text/rewriteSelection.js.map +1 -0
  21. package/dist/controls/rich-text/slash-preview.js +18 -5
  22. package/dist/controls/rich-text/slash-preview.js.map +1 -1
  23. package/dist/controls/rich-text/table-grid.js +26 -21
  24. package/dist/controls/rich-text/table-grid.js.map +1 -1
  25. package/dist/controls/rich-text/toolbar.js +1 -0
  26. package/dist/controls/rich-text/toolbar.js.map +1 -1
  27. package/dist/controls/text.js +1 -1
  28. package/dist/controls/text.js.map +1 -1
  29. package/dist/engine/field-shell.js +8 -4
  30. package/dist/engine/field-shell.js.map +1 -1
  31. package/dist/engine/frame.js +3 -2
  32. package/dist/engine/frame.js.map +1 -1
  33. package/dist/engine/grouping.js +4 -3
  34. package/dist/engine/grouping.js.map +1 -1
  35. package/dist/engine/item-list.js +2 -2
  36. package/dist/engine/item-list.js.map +1 -1
  37. package/dist/engine/schema-form.d.ts +2 -0
  38. package/dist/engine/schema-form.js +2 -0
  39. package/dist/engine/schema-form.js.map +1 -1
  40. package/dist/index.js +2 -2
  41. package/dist/kit.css +6 -32
  42. package/dist/lib/reduced-motion.d.ts +1 -0
  43. package/dist/lib/reduced-motion.js +19 -0
  44. package/dist/lib/reduced-motion.js.map +1 -0
  45. package/dist/styles.css +1 -1
  46. package/dist/theme.css +100 -0
  47. package/dist/tokens.css +6 -0
  48. package/dist/ui/content-fields.js +3 -2
  49. package/dist/ui/content-fields.js.map +1 -1
  50. package/dist/ui/controls.js +3 -2
  51. package/dist/ui/controls.js.map +1 -1
  52. package/dist/ui/floating-panel.js +3 -2
  53. package/dist/ui/floating-panel.js.map +1 -1
  54. package/dist/ui/foundations.js +3 -2
  55. package/dist/ui/foundations.js.map +1 -1
  56. package/dist/ui/index.js +2 -2
  57. package/dist/ui/inspector.d.ts +22 -4
  58. package/dist/ui/inspector.js +72 -27
  59. package/dist/ui/inspector.js.map +1 -1
  60. package/dist/ui/tab.js +3 -2
  61. package/dist/ui/tab.js.map +1 -1
  62. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ /**
2
+ * F66 (content revamp): what a selection AI rewrite would lose. The rewrite sends plain text and puts plain text back,
3
+ * so any formatting or link inside the range goes with it. Two cases are handled instead of silently:
4
+ * - the range sits wholly inside one link: the link is kept (restored over the new text if the browser drops it);
5
+ * - the range holds formatted runs or links (elements in the cloned range, a link's inner marks included): the
6
+ * author is told. A line break (<br>) alone is not formatting.
7
+ */
8
+ export interface SelectionShape {
9
+ /** The one link the whole range sits inside, if any. */
10
+ link: HTMLAnchorElement | null;
11
+ /** The range holds formatting or links that a plain-text replacement removes. */
12
+ loses: boolean;
13
+ }
14
+ export declare function selectionShape(range: Range, root: Element): SelectionShape;
15
+ export declare const FORMATTING_REMOVED = "Formatting in the selection was removed";
16
+ /** A copy of the link's own attributes (href, target, rel…), to put the link back over the rewritten text. */
17
+ export declare const linkAttrs: (a: HTMLAnchorElement) => [string, string][];
18
+ /** The throwaway href the link restore creates the anchor with (execCommand("createLink") takes only an href). */
19
+ export declare const LINK_SENTINEL = "https://bcms-link.invalid/";
20
+ /**
21
+ * Data safety (all looks): unwrap every anchor still carrying the sentinel href, keeping its text and children. The
22
+ * restore rewrites the sentinel anchor's attributes; if that ever misses, the throwaway link must not reach the content.
23
+ * Returns how many it unwrapped.
24
+ */
25
+ export declare function unwrapLinkSentinels(root: ParentNode): number;
@@ -0,0 +1,28 @@
1
+ //#region src/controls/rich-text/rewriteSelection.ts
2
+ function selectionShape(range, root) {
3
+ const anc = range.commonAncestorContainer;
4
+ const a = (anc.nodeType === 1 ? anc : anc.parentElement)?.closest("a");
5
+ return {
6
+ link: a && root.contains(a) ? a : null,
7
+ loses: Array.from(range.cloneContents().querySelectorAll("*")).some((n) => n.tagName !== "BR")
8
+ };
9
+ }
10
+ var FORMATTING_REMOVED = "Formatting in the selection was removed";
11
+ /** A copy of the link's own attributes (href, target, rel…), to put the link back over the rewritten text. */
12
+ var linkAttrs = (a) => Array.from(a.attributes).map((x) => [x.name, x.value]);
13
+ /** The throwaway href the link restore creates the anchor with (execCommand("createLink") takes only an href). */
14
+ var LINK_SENTINEL = "https://bcms-link.invalid/";
15
+ /**
16
+ * Data safety (all looks): unwrap every anchor still carrying the sentinel href, keeping its text and children. The
17
+ * restore rewrites the sentinel anchor's attributes; if that ever misses, the throwaway link must not reach the content.
18
+ * Returns how many it unwrapped.
19
+ */
20
+ function unwrapLinkSentinels(root) {
21
+ const left = Array.from(root.querySelectorAll(`a[href^="${LINK_SENTINEL}"]`));
22
+ for (const a of left) a.replaceWith(...Array.from(a.childNodes));
23
+ return left.length;
24
+ }
25
+ //#endregion
26
+ export { FORMATTING_REMOVED, LINK_SENTINEL, linkAttrs, selectionShape, unwrapLinkSentinels };
27
+
28
+ //# sourceMappingURL=rewriteSelection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewriteSelection.js","names":[],"sources":["../../../src/controls/rich-text/rewriteSelection.ts"],"sourcesContent":["/**\n * F66 (content revamp): what a selection AI rewrite would lose. The rewrite sends plain text and puts plain text back,\n * so any formatting or link inside the range goes with it. Two cases are handled instead of silently:\n * - the range sits wholly inside one link: the link is kept (restored over the new text if the browser drops it);\n * - the range holds formatted runs or links (elements in the cloned range, a link's inner marks included): the\n * author is told. A line break (<br>) alone is not formatting.\n */\nexport interface SelectionShape {\n /** The one link the whole range sits inside, if any. */\n link: HTMLAnchorElement | null;\n /** The range holds formatting or links that a plain-text replacement removes. */\n loses: boolean;\n}\n\nexport function selectionShape(range: Range, root: Element): SelectionShape {\n const anc = range.commonAncestorContainer;\n const el = anc.nodeType === 1 ? (anc as Element) : anc.parentElement;\n const a = el?.closest(\"a\");\n const link = a && root.contains(a) ? (a as HTMLAnchorElement) : null;\n // A line break is not formatting: a range holding only text and <br> loses nothing a plain-text rewrite can keep.\n const loses = Array.from(range.cloneContents().querySelectorAll(\"*\")).some((n) => n.tagName !== \"BR\");\n return { link, loses };\n}\n\nexport const FORMATTING_REMOVED = \"Formatting in the selection was removed\";\n\n/** A copy of the link's own attributes (href, target, rel…), to put the link back over the rewritten text. */\nexport const linkAttrs = (a: HTMLAnchorElement): [string, string][] => Array.from(a.attributes).map((x) => [x.name, x.value]);\n\n/** The throwaway href the link restore creates the anchor with (execCommand(\"createLink\") takes only an href). */\nexport const LINK_SENTINEL = \"https://bcms-link.invalid/\";\n\n/**\n * Data safety (all looks): unwrap every anchor still carrying the sentinel href, keeping its text and children. The\n * restore rewrites the sentinel anchor's attributes; if that ever misses, the throwaway link must not reach the content.\n * Returns how many it unwrapped.\n */\nexport function unwrapLinkSentinels(root: ParentNode): number {\n const left = Array.from(root.querySelectorAll<HTMLAnchorElement>(`a[href^=\"${LINK_SENTINEL}\"]`));\n for (const a of left) a.replaceWith(...Array.from(a.childNodes));\n return left.length;\n}\n"],"mappings":";AAcA,SAAgB,eAAe,OAAc,MAA+B;CAC1E,MAAM,MAAM,MAAM;CAElB,MAAM,KADK,IAAI,aAAa,IAAK,MAAkB,IAAI,cAAA,EACzC,QAAQ,GAAG;CAIzB,OAAO;EAAE,MAHI,KAAK,KAAK,SAAS,CAAC,IAAK,IAA0B;EAGjD,OADD,MAAM,KAAK,MAAM,cAAc,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,YAAY,IACjF;CAAM;AACvB;AAEA,IAAa,qBAAqB;;AAGlC,IAAa,aAAa,MAA6C,MAAM,KAAK,EAAE,UAAU,CAAC,CAAC,KAAK,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC;;AAG5H,IAAa,gBAAgB;;;;;;AAO7B,SAAgB,oBAAoB,MAA0B;CAC5D,MAAM,OAAO,MAAM,KAAK,KAAK,iBAAoC,YAAY,cAAc,GAAG,CAAC;CAC/F,KAAK,MAAM,KAAK,MAAM,EAAE,YAAY,GAAG,MAAM,KAAK,EAAE,UAAU,CAAC;CAC/D,OAAO,KAAK;AACd"}
@@ -1,4 +1,6 @@
1
1
  import { cn } from "../../lib/cn.js";
2
+ import { platformKeys } from "../../ui/shortcut-hint.js";
3
+ import { useKitReducedMotion } from "../../lib/reduced-motion.js";
2
4
  import * as React from "react";
3
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
6
  import { AnimatePresence, motion } from "framer-motion";
@@ -238,6 +240,7 @@ function ComponentArt({ it }) {
238
240
  /** The card, placed by the panel (absolute, right of the menu); `top` = the highlighted row's top - 6. */
239
241
  function SlashPreviewCard({ item, top }) {
240
242
  const [shown, setShown] = React.useState(null);
243
+ const reduce = !!useKitReducedMotion();
241
244
  const key = item?.key;
242
245
  React.useEffect(() => {
243
246
  setShown(null);
@@ -252,14 +255,23 @@ function SlashPreviewCard({ item, top }) {
252
255
  style: { marginTop: top },
253
256
  initial: {
254
257
  opacity: 0,
255
- x: -4
258
+ x: reduce ? 0 : -4
256
259
  },
257
260
  animate: {
258
261
  opacity: 1,
259
- x: 0
262
+ x: 0,
263
+ transition: {
264
+ duration: .16,
265
+ ease: "easeOut"
266
+ }
267
+ },
268
+ exit: {
269
+ opacity: 0,
270
+ transition: {
271
+ duration: .1,
272
+ ease: "easeIn"
273
+ }
260
274
  },
261
- exit: { opacity: 0 },
262
- transition: { duration: .16 },
263
275
  children: [/* @__PURE__ */ jsx("div", {
264
276
  className: "grid h-28 place-items-center rounded-md bg-kit-insp-card-focus",
265
277
  children: shown.kind === "component" ? /* @__PURE__ */ jsx(ComponentArt, { it: shown }) : /* @__PURE__ */ jsx(Wireframe, { art: shown.id ? ART[shown.id] : void 0 })
@@ -275,8 +287,9 @@ function SlashPreviewCard({ item, top }) {
275
287
  children: shown.description
276
288
  })]
277
289
  }), shown.hint ? /* @__PURE__ */ jsx("kbd", {
290
+ "data-hint": "shortcuts",
278
291
  className: "shrink-0 font-kit-sans text-[13px] text-kit-group-sub",
279
- children: shown.hint
292
+ children: platformKeys(shown.hint)
280
293
  }) : null]
281
294
  })]
282
295
  }, shown.key) : null });
@@ -1 +1 @@
1
- {"version":3,"file":"slash-preview.js","names":[],"sources":["../../../src/controls/rich-text/slash-preview.tsx"],"sourcesContent":["/* Slash menu hover preview card · look \"v16\" (F2107; prototype content.jsx:1238-1258 + PvArt :1309-1330, content.css:236,\n 285-292, 401-428). 250ms after a row is highlighted a 232 wide white card (ring + 12/28 shadow, radius 10, padding\n 6/6/4) opens 6px to the right of the menu, level with that row: a 112 high #FAFAFA art box with a wireframe of the\n block, then the 13/500 title, the 12 #707070 description and the key hint. Not shown for the AI view's rows, More\n components, the way back or a refused row. Fades in from x -4 over 160ms. */\nimport * as React from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { cn } from \"../../lib/cn\";\nimport type { BasicId, CatalogItem } from \"./catalog\";\n\n/** The row a preview card is drawn for (null: none). Exported for tests. */\nexport function previewable(it: CatalogItem | undefined): it is CatalogItem {\n return !!it && !it.kind?.match(/^(folder|back|ai)$/) && !it.ai && !it.disabled;\n}\n\nconst BAR = \"block h-1.5 rounded-[3px] bg-kit-insp-line\";\nconst bar = (w: number, cls = \"\") => <i className={cn(BAR, cls)} style={{ width: w }} />;\nconst HEAD = \"h-2.5 bg-kit-insp-tip-title opacity-85\";\n\ntype Art = \"paragraph\" | \"h1\" | \"h2\" | \"h3\" | \"bullets\" | \"numbers\" | \"checklist\" | \"quote\" | \"callout\" | \"divider\" | \"toggle\" | \"table\" | \"stats\" | \"code\" | \"image\" | \"video\" | \"file\";\nconst ART: Partial<Record<BasicId, Art>> = {\n p: \"paragraph\", h1: \"h1\", h2: \"h2\", h3: \"h3\", h4: \"h3\", h5: \"h3\", h6: \"h3\", ul: \"bullets\", ol: \"numbers\", task: \"checklist\",\n quote: \"quote\", pullquote: \"quote\", callout: \"callout\", hr: \"divider\", toggle: \"toggle\", table: \"table\", stats: \"stats\",\n code: \"code\", image: \"image\", gallery: \"image\", video: \"video\", embed: \"video\", file: \"file\",\n};\n\nfunction rows3(mark: (i: number) => React.ReactNode) {\n return [110, 130, 90].map((w, i) => (\n <span key={i} className=\"flex items-center gap-2\">\n {mark(i)}\n {bar(w, \"min-w-0 shrink\")}\n </span>\n ));\n}\n\nfunction Wireframe({ art }: { art: Art | undefined }) {\n const flush = art === \"table\" || art === \"code\" || art === \"image\" || art === \"video\";\n let body: React.ReactNode;\n switch (art) {\n case \"paragraph\": body = <>{bar(150)}{bar(140)}{bar(96)}</>; break;\n case \"h1\": body = <>{bar(120, \"h-3.5 bg-kit-insp-tip-title opacity-85\")}{bar(150)}{bar(110)}</>; break;\n case \"h2\": body = <>{bar(100, HEAD)}{bar(150)}{bar(118)}</>; break;\n case \"h3\": body = <>{bar(80, \"h-2 bg-kit-insp-tip-title opacity-85\")}{bar(150)}{bar(126)}</>; break;\n case \"bullets\": body = rows3(() => <b className=\"size-[5px] shrink-0 rounded-full bg-kit-insp-tip-title\" />); break;\n case \"numbers\": body = rows3((i) => <b className=\"shrink-0 text-[9px] font-normal leading-[10px] text-kit-group-sub\">{i + 1}</b>); break;\n case \"checklist\":\n body = rows3((i) => <b className={cn(\"size-[9px] shrink-0 rounded-[3px]\", i ? \"shadow-[inset_0_0_0_1.4px_var(--kit-insp-faint)]\" : \"bg-kit-insp-tip-title\")} />);\n break;\n case \"quote\": body = <span className=\"flex flex-col gap-[7px] border-l-[3px] border-kit-insp-tip-title pl-2.5\">{bar(130)}{bar(140)}{bar(90)}</span>; break;\n case \"callout\":\n body = (\n <span className=\"relative flex flex-col gap-[7px] rounded-lg bg-kit-insp-callout-info py-2.5 pl-[26px] pr-2.5 shadow-[inset_0_0_0_1px_var(--kit-insp-callout-info-line)]\">\n <b className=\"absolute left-[9px] top-[9px] size-[9px] rounded-full bg-kit-insp-callout-info-icon\" />\n {bar(110, \"bg-kit-insp-callout-info-line\")}\n {bar(90, \"bg-kit-insp-callout-info-line\")}\n </span>\n );\n break;\n case \"divider\": body = <>{bar(150)}<hr className=\"-mx-3.5 my-0.5 h-[1.5px] border-0 bg-kit-insp-faint\" />{bar(120)}</>; break;\n case \"toggle\":\n body = (\n <span className=\"relative flex flex-col gap-[7px] pl-3.5\">\n <b className=\"absolute left-0 top-0.5 border-y-4 border-l-[6px] border-y-transparent border-l-kit-insp-tip-title\" />\n {bar(100, HEAD)}\n <span className=\"flex flex-col gap-[7px]\">{bar(120)}{bar(96)}</span>\n </span>\n );\n break;\n case \"table\":\n body = (\n <span className=\"flex flex-col\">\n {[0, 1, 2].map((r) => (\n <span key={r} className={cn(\"flex\", r === 0 && \"bg-kit-insp-card-focus\")}>\n {[0, 1, 2].map((c) => <i key={c} className=\"h-[22px] flex-1 shadow-[inset_-1px_-1px_0_var(--kit-insp-line)]\" />)}\n </span>\n ))}\n </span>\n );\n break;\n case \"stats\":\n body = (\n <span className=\"grid grid-cols-3 gap-1.5\">\n {[0, 1, 2].map((x) => (\n <span key={x} className=\"flex flex-col gap-1 rounded-md p-1.5 shadow-[inset_0_0_0_1px_var(--kit-insp-divider)]\">\n <i className={BAR} />\n <b className=\"h-[9px] rounded-[3px] bg-kit-insp-tip-title\" />\n <i className={BAR} />\n </span>\n ))}\n </span>\n );\n break;\n case \"code\":\n body = (\n <span className=\"flex flex-col gap-1.5 bg-kit-insp-code-bg pb-2.5\">\n <span className=\"h-3.5 border-b border-kit-insp-code-menu-line\" />\n {([[60, \"c\"], [24, \"k\", 70], [50, \"s\"], [90]] as [number, string?, number?][]).map(([w, c, w2], n) => (\n <span key={n} className=\"flex gap-1.5 px-2.5\">\n <i className={cn(\"block h-1 rounded-[3px]\", c === \"c\" ? \"bg-kit-insp-code-gutter\" : c === \"k\" ? \"bg-kit-insp-code-kw\" : c === \"s\" ? \"bg-kit-insp-code-str\" : \"bg-kit-insp-code-fg opacity-80\")} style={{ width: w }} />\n {w2 ? <i className=\"block h-1 rounded-[3px] bg-kit-insp-code-fg opacity-80\" style={{ width: w2 }} /> : null}\n </span>\n ))}\n </span>\n );\n break;\n case \"image\":\n body = (\n <span className=\"relative block h-[68px] bg-kit-insp-divider\">\n <b className=\"absolute right-[22px] top-3 size-3 rounded-full bg-kit-insp-tip-bg\" />\n <b className=\"absolute bottom-0 left-[18px] border-x-[40px] border-b-[38px] border-x-transparent border-b-kit-insp-line-strong\" />\n <b className=\"absolute bottom-0 left-[66px] border-x-[36px] border-b-[28px] border-x-transparent border-b-kit-insp-faint\" />\n </span>\n );\n break;\n case \"video\":\n body = (\n <span className=\"grid h-[68px] place-items-center bg-kit-insp-code-bg\">\n <b className=\"size-6 rounded-full bg-kit-insp-tip-bg\" />\n </span>\n );\n break;\n case \"file\":\n body = (\n <span className=\"grid grid-cols-[22px_1fr] items-center gap-x-2 gap-y-[5px]\">\n <b className=\"row-span-2 size-[22px] rounded-[5px] bg-kit-insp-divider\" />\n {bar(70, HEAD)}\n {bar(46)}\n </span>\n );\n break;\n default: body = <>{bar(100, HEAD)}{bar(150)}{bar(120)}</>;\n }\n return (\n <div data-art={art ?? \"block\"} className={cn(\"flex w-[168px] flex-col gap-2 rounded-md bg-kit-insp-tip-bg shadow-[inset_0_0_0_1px_var(--kit-insp-divider)]\", flush ? \"overflow-hidden p-0\" : \"p-3.5\")}>\n {body}\n </div>\n );\n}\n\n/** A site component's card: its own thumbnail (the row's tile) on the white mini card of the prototype's site blocks. */\nfunction ComponentArt({ it }: { it: CatalogItem }) {\n return (\n <div className=\"flex h-[88px] w-[170px] items-center justify-center overflow-hidden rounded-md bg-kit-insp-tip-bg shadow-[inset_0_0_0_1px_var(--kit-insp-divider),0_2px_6px_rgb(0_0_0/0.06)] [&_img]:max-h-full [&_img]:max-w-full [&_svg]:size-8 [&_svg]:text-kit-insp-faint\">\n {it.icon}\n </div>\n );\n}\n\n/** The card, placed by the panel (absolute, right of the menu); `top` = the highlighted row's top - 6. */\nexport function SlashPreviewCard({ item, top }: { item: CatalogItem | undefined; top: number }) {\n const [shown, setShown] = React.useState<CatalogItem | null>(null);\n const key = item?.key;\n React.useEffect(() => {\n setShown(null);\n if (!previewable(item)) return;\n const t = window.setTimeout(() => setShown(item), 250);\n return () => window.clearTimeout(t);\n // the card follows the highlighted row, not a new object for the same row\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [key]);\n return (\n <AnimatePresence>\n {shown ? (\n <motion.div\n key={shown.key}\n data-slash-preview=\"\"\n aria-hidden\n className=\"pointer-events-none absolute left-[calc(100%+6px)] top-0 w-[232px] rounded-[10px] bg-kit-insp-tip-bg px-1.5 pb-1 pt-1.5 text-[13px] leading-[19.5px] text-kit-insp-tip-title shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_12px_28px_rgb(0_0_0/0.12)]\"\n style={{ marginTop: top }}\n initial={{ opacity: 0, x: -4 }}\n animate={{ opacity: 1, x: 0 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.16 }}\n >\n <div className=\"grid h-28 place-items-center rounded-md bg-kit-insp-card-focus\">\n {shown.kind === \"component\" ? <ComponentArt it={shown} /> : <Wireframe art={shown.id ? ART[shown.id] : undefined} />}\n </div>\n <div className=\"flex items-start gap-2 px-2 pb-1.5 pt-2\">\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <b className=\"truncate font-medium text-kit-insp-tip-title\">{shown.label}</b>\n <small className=\"text-[12px] leading-[18px] text-kit-group-sub\">{shown.description}</small>\n </span>\n {shown.hint ? <kbd className=\"shrink-0 font-kit-sans text-[13px] text-kit-group-sub\">{shown.hint}</kbd> : null}\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n );\n}\n"],"mappings":";;;;;;AAWA,SAAgB,YAAY,IAAgD;CAC1E,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,MAAM,oBAAoB,KAAK,CAAC,GAAG,MAAM,CAAC,GAAG;AACxE;AAEA,IAAM,MAAM;AACZ,IAAM,OAAO,GAAW,MAAM,OAAO,oBAAC,KAAD;CAAG,WAAW,GAAG,KAAK,GAAG;CAAG,OAAO,EAAE,OAAO,EAAE;AAAI,CAAA;AACvF,IAAM,OAAO;AAGb,IAAM,MAAqC;CACzC,GAAG;CAAa,IAAI;CAAM,IAAI;CAAM,IAAI;CAAM,IAAI;CAAM,IAAI;CAAM,IAAI;CAAM,IAAI;CAAW,IAAI;CAAW,MAAM;CAChH,OAAO;CAAS,WAAW;CAAS,SAAS;CAAW,IAAI;CAAW,QAAQ;CAAU,OAAO;CAAS,OAAO;CAChH,MAAM;CAAQ,OAAO;CAAS,SAAS;CAAS,OAAO;CAAS,OAAO;CAAS,MAAM;AACxF;AAEA,SAAS,MAAM,MAAsC;CACnD,OAAO;EAAC;EAAK;EAAK;CAAE,CAAC,CAAC,KAAK,GAAG,MAC5B,qBAAC,QAAD;EAAc,WAAU;EAAxB,UAAA,CACG,KAAK,CAAC,GACN,IAAI,GAAG,gBAAgB,CACpB;CAHK,GAAA,CAGL,CACP;AACH;AAEA,SAAS,UAAU,EAAE,OAAiC;CACpD,MAAM,QAAQ,QAAQ,WAAW,QAAQ,UAAU,Q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AAY,MAAM,SAA6B,IAAI;CACjE,MAAM,MAAM,MAAM;CAClB,MAAM,gBAAgB;EACpB,SAAS,IAAI;EACb,IAAI,CAAC,YAAY,IAAI,GAAG;EACxB,MAAM,IAAI,OAAO,iBAAiB,SAAS,IAAI,GAAG,GAAG;EACrD,aAAa,OAAO,aAAa,CAAC;CAGpC,GAAG,CAAC,GAAG,CAAC;CACR,OACE,oBAAC,iBAAD,EAAA,UACG,QACC,qBAAC,OAAO,KAAR;EAEE,sBAAmB;EACnB,eAAA;EACA,WAAU;EACV,OAAO,EAAE,WAAW,IAAI;EACxB,SAAS;GAAE,SAAS;GAAG,GAAG;EAAG;EAC7B,SAAS;GAAE,SAAS;GAAG,GAAG;EAAE;EAC5B,MAAM,EAAE,SAAS,EAAE;EACnB,YAAY,EAAE,UAAU,IAAK;EAT/B,UAAA,CAWE,oBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,MAAM,SAAS,cAAc,oBAAC,cAAD,EAAc,IAAI,MAAQ,CAAA,IAAI,oBAAC,WAAD,EAAW,KAAK,MAAM,KAAK,IAAI,MAAM,MAAM,KAAA,EAAY,CAAA;EAChH,CAAA,GACL,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,KAAD;KAAG,WAAU;KAAgD,UAAA,MAAM;IAAS,CAAA,GAC5E,oBAAC,SAAD;KAAO,WAAU;KAAiD,UAAA,MAAM;IAAmB,CAAA,CACvF;GACL,CAAA,GAAA,MAAM,OAAO,oBAAC,OAAD;IAAK,WAAU;IAAyD,UAAA,MAAM;GAAU,CAAA,IAAI,IACvG;EACK,CAAA,CAAA;CApBL,GAAA,MAAM,GAoBD,IACV,KACW,CAAA;AAErB"}
1
+ {"version":3,"file":"slash-preview.js","names":[],"sources":["../../../src/controls/rich-text/slash-preview.tsx"],"sourcesContent":["/* Slash menu hover preview card · look \"v16\" (F2107; prototype content.jsx:1238-1258 + PvArt :1309-1330, content.css:236,\n 285-292, 401-428). 250ms after a row is highlighted a 232 wide white card (ring + 12/28 shadow, radius 10, padding\n 6/6/4) opens 6px to the right of the menu, level with that row: a 112 high #FAFAFA art box with a wireframe of the\n block, then the 13/500 title, the 12 #707070 description and the key hint. Not shown for the AI view's rows, More\n components, the way back or a refused row. Fades in from x -4 over 160ms and fades out in 100ms; reduced motion\n (the OS, or a host MotionConfig \"always\"): a fade with no travel. */\nimport * as React from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { cn } from \"../../lib/cn\";\nimport { platformKeys } from \"../../ui/shortcut-hint\";\nimport type { BasicId, CatalogItem } from \"./catalog\";\nimport { useKitReducedMotion } from \"../../lib/reduced-motion\";\n\n/** The row a preview card is drawn for (null: none). Exported for tests. */\nexport function previewable(it: CatalogItem | undefined): it is CatalogItem {\n return !!it && !it.kind?.match(/^(folder|back|ai)$/) && !it.ai && !it.disabled;\n}\n\nconst BAR = \"block h-1.5 rounded-[3px] bg-kit-insp-line\";\nconst bar = (w: number, cls = \"\") => <i className={cn(BAR, cls)} style={{ width: w }} />;\nconst HEAD = \"h-2.5 bg-kit-insp-tip-title opacity-85\";\n\ntype Art = \"paragraph\" | \"h1\" | \"h2\" | \"h3\" | \"bullets\" | \"numbers\" | \"checklist\" | \"quote\" | \"callout\" | \"divider\" | \"toggle\" | \"table\" | \"stats\" | \"code\" | \"image\" | \"video\" | \"file\";\nconst ART: Partial<Record<BasicId, Art>> = {\n p: \"paragraph\", h1: \"h1\", h2: \"h2\", h3: \"h3\", h4: \"h3\", h5: \"h3\", h6: \"h3\", ul: \"bullets\", ol: \"numbers\", task: \"checklist\",\n quote: \"quote\", pullquote: \"quote\", callout: \"callout\", hr: \"divider\", toggle: \"toggle\", table: \"table\", stats: \"stats\",\n code: \"code\", image: \"image\", gallery: \"image\", video: \"video\", embed: \"video\", file: \"file\",\n};\n\nfunction rows3(mark: (i: number) => React.ReactNode) {\n return [110, 130, 90].map((w, i) => (\n <span key={i} className=\"flex items-center gap-2\">\n {mark(i)}\n {bar(w, \"min-w-0 shrink\")}\n </span>\n ));\n}\n\nfunction Wireframe({ art }: { art: Art | undefined }) {\n const flush = art === \"table\" || art === \"code\" || art === \"image\" || art === \"video\";\n let body: React.ReactNode;\n switch (art) {\n case \"paragraph\": body = <>{bar(150)}{bar(140)}{bar(96)}</>; break;\n case \"h1\": body = <>{bar(120, \"h-3.5 bg-kit-insp-tip-title opacity-85\")}{bar(150)}{bar(110)}</>; break;\n case \"h2\": body = <>{bar(100, HEAD)}{bar(150)}{bar(118)}</>; break;\n case \"h3\": body = <>{bar(80, \"h-2 bg-kit-insp-tip-title opacity-85\")}{bar(150)}{bar(126)}</>; break;\n case \"bullets\": body = rows3(() => <b className=\"size-[5px] shrink-0 rounded-full bg-kit-insp-tip-title\" />); break;\n case \"numbers\": body = rows3((i) => <b className=\"shrink-0 text-[9px] font-normal leading-[10px] text-kit-group-sub\">{i + 1}</b>); break;\n case \"checklist\":\n body = rows3((i) => <b className={cn(\"size-[9px] shrink-0 rounded-[3px]\", i ? \"shadow-[inset_0_0_0_1.4px_var(--kit-insp-faint)]\" : \"bg-kit-insp-tip-title\")} />);\n break;\n case \"quote\": body = <span className=\"flex flex-col gap-[7px] border-l-[3px] border-kit-insp-tip-title pl-2.5\">{bar(130)}{bar(140)}{bar(90)}</span>; break;\n case \"callout\":\n body = (\n <span className=\"relative flex flex-col gap-[7px] rounded-lg bg-kit-insp-callout-info py-2.5 pl-[26px] pr-2.5 shadow-[inset_0_0_0_1px_var(--kit-insp-callout-info-line)]\">\n <b className=\"absolute left-[9px] top-[9px] size-[9px] rounded-full bg-kit-insp-callout-info-icon\" />\n {bar(110, \"bg-kit-insp-callout-info-line\")}\n {bar(90, \"bg-kit-insp-callout-info-line\")}\n </span>\n );\n break;\n case \"divider\": body = <>{bar(150)}<hr className=\"-mx-3.5 my-0.5 h-[1.5px] border-0 bg-kit-insp-faint\" />{bar(120)}</>; break;\n case \"toggle\":\n body = (\n <span className=\"relative flex flex-col gap-[7px] pl-3.5\">\n <b className=\"absolute left-0 top-0.5 border-y-4 border-l-[6px] border-y-transparent border-l-kit-insp-tip-title\" />\n {bar(100, HEAD)}\n <span className=\"flex flex-col gap-[7px]\">{bar(120)}{bar(96)}</span>\n </span>\n );\n break;\n case \"table\":\n body = (\n <span className=\"flex flex-col\">\n {[0, 1, 2].map((r) => (\n <span key={r} className={cn(\"flex\", r === 0 && \"bg-kit-insp-card-focus\")}>\n {[0, 1, 2].map((c) => <i key={c} className=\"h-[22px] flex-1 shadow-[inset_-1px_-1px_0_var(--kit-insp-line)]\" />)}\n </span>\n ))}\n </span>\n );\n break;\n case \"stats\":\n body = (\n <span className=\"grid grid-cols-3 gap-1.5\">\n {[0, 1, 2].map((x) => (\n <span key={x} className=\"flex flex-col gap-1 rounded-md p-1.5 shadow-[inset_0_0_0_1px_var(--kit-insp-divider)]\">\n <i className={BAR} />\n <b className=\"h-[9px] rounded-[3px] bg-kit-insp-tip-title\" />\n <i className={BAR} />\n </span>\n ))}\n </span>\n );\n break;\n case \"code\":\n body = (\n <span className=\"flex flex-col gap-1.5 bg-kit-insp-code-bg pb-2.5\">\n <span className=\"h-3.5 border-b border-kit-insp-code-menu-line\" />\n {([[60, \"c\"], [24, \"k\", 70], [50, \"s\"], [90]] as [number, string?, number?][]).map(([w, c, w2], n) => (\n <span key={n} className=\"flex gap-1.5 px-2.5\">\n <i className={cn(\"block h-1 rounded-[3px]\", c === \"c\" ? \"bg-kit-insp-code-gutter\" : c === \"k\" ? \"bg-kit-insp-code-kw\" : c === \"s\" ? \"bg-kit-insp-code-str\" : \"bg-kit-insp-code-fg opacity-80\")} style={{ width: w }} />\n {w2 ? <i className=\"block h-1 rounded-[3px] bg-kit-insp-code-fg opacity-80\" style={{ width: w2 }} /> : null}\n </span>\n ))}\n </span>\n );\n break;\n case \"image\":\n body = (\n <span className=\"relative block h-[68px] bg-kit-insp-divider\">\n <b className=\"absolute right-[22px] top-3 size-3 rounded-full bg-kit-insp-tip-bg\" />\n <b className=\"absolute bottom-0 left-[18px] border-x-[40px] border-b-[38px] border-x-transparent border-b-kit-insp-line-strong\" />\n <b className=\"absolute bottom-0 left-[66px] border-x-[36px] border-b-[28px] border-x-transparent border-b-kit-insp-faint\" />\n </span>\n );\n break;\n case \"video\":\n body = (\n <span className=\"grid h-[68px] place-items-center bg-kit-insp-code-bg\">\n <b className=\"size-6 rounded-full bg-kit-insp-tip-bg\" />\n </span>\n );\n break;\n case \"file\":\n body = (\n <span className=\"grid grid-cols-[22px_1fr] items-center gap-x-2 gap-y-[5px]\">\n <b className=\"row-span-2 size-[22px] rounded-[5px] bg-kit-insp-divider\" />\n {bar(70, HEAD)}\n {bar(46)}\n </span>\n );\n break;\n default: body = <>{bar(100, HEAD)}{bar(150)}{bar(120)}</>;\n }\n return (\n <div data-art={art ?? \"block\"} className={cn(\"flex w-[168px] flex-col gap-2 rounded-md bg-kit-insp-tip-bg shadow-[inset_0_0_0_1px_var(--kit-insp-divider)]\", flush ? \"overflow-hidden p-0\" : \"p-3.5\")}>\n {body}\n </div>\n );\n}\n\n/** A site component's card: its own thumbnail (the row's tile) on the white mini card of the prototype's site blocks. */\nfunction ComponentArt({ it }: { it: CatalogItem }) {\n return (\n <div className=\"flex h-[88px] w-[170px] items-center justify-center overflow-hidden rounded-md bg-kit-insp-tip-bg shadow-[inset_0_0_0_1px_var(--kit-insp-divider),0_2px_6px_rgb(0_0_0/0.06)] [&_img]:max-h-full [&_img]:max-w-full [&_svg]:size-8 [&_svg]:text-kit-insp-faint\">\n {it.icon}\n </div>\n );\n}\n\n/** The card, placed by the panel (absolute, right of the menu); `top` = the highlighted row's top - 6. */\nexport function SlashPreviewCard({ item, top }: { item: CatalogItem | undefined; top: number }) {\n const [shown, setShown] = React.useState<CatalogItem | null>(null);\n const reduce = !!useKitReducedMotion();\n const key = item?.key;\n React.useEffect(() => {\n setShown(null);\n if (!previewable(item)) return;\n const t = window.setTimeout(() => setShown(item), 250);\n return () => window.clearTimeout(t);\n // the card follows the highlighted row, not a new object for the same row\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [key]);\n return (\n <AnimatePresence>\n {shown ? (\n <motion.div\n key={shown.key}\n data-slash-preview=\"\"\n aria-hidden\n className=\"pointer-events-none absolute left-[calc(100%+6px)] top-0 w-[232px] rounded-[10px] bg-kit-insp-tip-bg px-1.5 pb-1 pt-1.5 text-[13px] leading-[19.5px] text-kit-insp-tip-title shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_12px_28px_rgb(0_0_0/0.12)]\"\n style={{ marginTop: top }}\n initial={{ opacity: 0, x: reduce ? 0 : -4 }}\n animate={{ opacity: 1, x: 0, transition: { duration: 0.16, ease: \"easeOut\" } }}\n exit={{ opacity: 0, transition: { duration: 0.1, ease: \"easeIn\" } }}\n >\n <div className=\"grid h-28 place-items-center rounded-md bg-kit-insp-card-focus\">\n {shown.kind === \"component\" ? <ComponentArt it={shown} /> : <Wireframe art={shown.id ? ART[shown.id] : undefined} />}\n </div>\n <div className=\"flex items-start gap-2 px-2 pb-1.5 pt-2\">\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <b className=\"truncate font-medium text-kit-insp-tip-title\">{shown.label}</b>\n <small className=\"text-[12px] leading-[18px] text-kit-group-sub\">{shown.description}</small>\n </span>\n {shown.hint ? (\n <kbd data-hint=\"shortcuts\" className=\"shrink-0 font-kit-sans text-[13px] text-kit-group-sub\">\n {platformKeys(shown.hint)}\n </kbd>\n ) : null}\n </div>\n </motion.div>\n ) : null}\n </AnimatePresence>\n );\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,YAAY,IAAgD;CAC1E,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,MAAM,oBAAoB,KAAK,CAAC,GAAG,MAAM,CAAC,GAAG;AACxE;AAEA,IAAM,MAAM;AACZ,IAAM,OAAO,GAAW,MAAM,OAAO,oBAAC,KAAD;CAAG,WAAW,GAAG,KAAK,GAAG;CAAG,OAAO,EAAE,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AM;GAAS;EAAE;EARpE,UAAA,CAUE,oBAAC,OAAD;GAAK,WAAU;GACZ,UAAA,MAAM,SAAS,cAAc,oBAAC,cAAD,EAAc,IAAI,MAAQ,CAAA,IAAI,oBAAC,WAAD,EAAW,KAAK,MAAM,KAAK,IAAI,MAAM,MAAM,KAAA,EAAY,CAAA;EAChH,CAAA,GACL,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,KAAD;KAAG,WAAU;KAAgD,UAAA,MAAM;IAAS,CAAA,GAC5E,oBAAC,SAAD;KAAO,WAAU;KAAiD,UAAA,MAAM;IAAmB,CAAA,CACvF;GACL,CAAA,GAAA,MAAM,OACL,oBAAC,OAAD;IAAK,aAAU;IAAY,WAAU;IAClC,UAAA,aAAa,MAAM,IAAI;GACrB,CAAA,IACH,IACD;EACK,CAAA,CAAA;CAvBL,GAAA,MAAM,GAuBD,IACV,KACW,CAAA;AAErB"}
@@ -1,5 +1,6 @@
1
1
  import { cellNote, cellText, cellType, cellValue, isObjLike, orderedRows, tkey, withValue } from "../../schema/table.js";
2
2
  import { cn } from "../../lib/cn.js";
3
+ import { useKitReducedMotion } from "../../lib/reduced-motion.js";
3
4
  import { Menu, MenuContent, MenuItem, MenuLabel, MenuSeparator, MenuTrigger, Modal, ModalBody, ModalContent, ModalHeader } from "../../ui/overlay.js";
4
5
  import { Textarea } from "../../ui/input.js";
5
6
  import { TableEditor, moveRowTo, typedCell } from "../table/table-editor.js";
@@ -31,7 +32,8 @@ import { AnimatePresence, motion } from "framer-motion";
31
32
  * column / row menus as "Column type and settings…" / "Row group and settings…") opens the full table editor in a
32
33
  * dialog for column types and their settings, row groups, totals, highlights, footnote marks, search and phones.
33
34
  *
34
- * "Fit to width" stores `design.fit` (REQ-KIT-3, written `data-fit="true"`): the table spans the column.
35
+ * "Fit to width" stores `design.fit` (REQ-KIT-3, written `data-fit="true"`): the table spans the column. The toggle shows only
36
+ * where the field's features include "tableFit"; a stored data-fit is kept either way.
35
37
  */
36
38
  /** Rows as the table shows them (ungrouped, then each row group, then the totals): the grid's row order. */
37
39
  function gridRows(t) {
@@ -371,9 +373,9 @@ var sameGeo = (a, b) => !!a && [
371
373
  ].every((k) => a[k].length === b[k].length && a[k].every((x, i) => Math.abs(x - b[k][i]) < .5));
372
374
  var CELL = "min-w-20 border border-kit-insp-line px-3 py-[9px] align-top";
373
375
  var HEAD_CELL = "bg-[var(--kit-insp-table-head)] text-[13px] font-medium text-[var(--kit-insp-table-head-fg)]";
374
- var POP = "opacity_160ms_cubic-bezier(.22,1,.36,1),transform_260ms_cubic-bezier(.34,1.56,.64,1),filter_160ms_cubic-bezier(.22,1,.36,1)";
375
- var DOT = cn("group/dt pointer-events-auto absolute grid size-[18px] place-items-center rounded-full text-kit-insp-btool-icon outline-none", "before:absolute before:z-[1] before:size-[5px] before:rounded-full before:bg-kit-insp-faint before:[transition:opacity_120ms_cubic-bezier(.22,1,.36,1),transform_120ms_cubic-bezier(.22,1,.36,1)]", "hover:before:scale-[.4] hover:before:opacity-0 focus-visible:before:scale-[.4] focus-visible:before:opacity-0", `after:absolute after:inset-0 after:scale-[.6] after:rounded-full after:bg-kit-insp-btool-bg after:opacity-0 after:blur-[4px] after:shadow-[inset_0_0_0_1px_var(--kit-insp-btool-line),0_1px_3px_rgb(0_0_0/0.1)] after:[transition:${POP}]`, "hover:after:scale-100 hover:after:opacity-100 hover:after:blur-none focus-visible:after:scale-100 focus-visible:after:opacity-100 focus-visible:after:blur-none");
376
- var DOT_ICON = `relative z-[2] size-3 scale-[.6] opacity-0 blur-[4px] [transition:${POP}] group-hover/dt:scale-100 group-hover/dt:opacity-100 group-hover/dt:blur-none group-focus-visible/dt:scale-100 group-focus-visible/dt:opacity-100 group-focus-visible/dt:blur-none`;
376
+ var POP = "opacity_160ms_cubic-bezier(.22,1,.36,1),transform_260ms_cubic-bezier(.34,1.56,.64,1)";
377
+ var DOT = cn("group/dt pointer-events-auto absolute grid size-[18px] place-items-center rounded-full text-kit-insp-btool-icon outline-none", "before:absolute before:z-[1] before:size-[5px] before:rounded-full before:bg-kit-insp-faint before:[transition:opacity_120ms_cubic-bezier(.22,1,.36,1),transform_120ms_cubic-bezier(.22,1,.36,1)] motion-reduce:before:[transition:opacity_120ms_ease-out]", "hover:before:scale-[.4] hover:before:opacity-0 focus-visible:before:scale-[.4] focus-visible:before:opacity-0", `after:absolute after:inset-0 after:scale-[.6] after:rounded-full after:bg-kit-insp-btool-bg after:opacity-0 after:shadow-[inset_0_0_0_1px_var(--kit-insp-btool-line),0_1px_3px_rgb(0_0_0/0.1)] after:[transition:${POP}] motion-reduce:after:[transition:opacity_120ms_ease-out]`, "hover:after:scale-100 hover:after:opacity-100 focus-visible:after:scale-100 focus-visible:after:opacity-100");
378
+ var DOT_ICON = `relative z-[2] size-3 scale-[.6] opacity-0 [transition:${POP}] motion-reduce:[transition:opacity_120ms_ease-out] group-hover/dt:scale-100 group-hover/dt:opacity-100 group-focus-visible/dt:scale-100 group-focus-visible/dt:opacity-100`;
377
379
  var HANDLE = "pointer-events-auto absolute grid cursor-grab touch-none place-items-center rounded-[4px] bg-kit-insp-btool-bg text-kit-insp-btool-icon shadow-[inset_0_0_0_1px_var(--kit-insp-btool-line),0_1px_2px_rgb(0_0_0/0.06)] outline-none hover:bg-kit-insp-btool-hover focus-visible:shadow-[inset_0_0_0_1px_var(--kit-insp-btool-line),0_0_0_2px_var(--kit-focus-ring)] active:cursor-grabbing data-[popup-open]:bg-kit-insp-btool-hover";
378
380
  var GUIDE = "pointer-events-none absolute bg-[var(--kit-insp-table-guide)]";
379
381
  var TOOL_BTN = "grid size-7 shrink-0 place-items-center rounded-[6px] text-kit-insp-btool-icon outline-none transition-colors duration-100 hover:bg-kit-insp-btool-hover focus-visible:shadow-[0_0_0_2px_var(--kit-focus-ring)] aria-pressed:bg-kit-insp-btool-hover";
@@ -394,6 +396,7 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
394
396
  const [hcol, setHcol] = React.useState(null);
395
397
  const [hrow, setHrow] = React.useState(null);
396
398
  const [dot, setDot] = React.useState(null);
399
+ const reduce = !!useKitReducedMotion();
397
400
  const [menu, setMenu] = React.useState(null);
398
401
  const [drag, setDrag] = React.useState(null);
399
402
  const [drop, setDrop] = React.useState(null);
@@ -830,22 +833,23 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
830
833
  style: { left: drop.x }
831
834
  }) : null,
832
835
  /* @__PURE__ */ jsx(AnimatePresence, { children: dot && !drag ? "x" in dot ? /* @__PURE__ */ jsx(motion.i, {
833
- className: cn(GUIDE, "inset-y-0 -ml-px block w-[2px] origin-top"),
836
+ "data-rt-guide": "col",
837
+ className: cn(GUIDE, "inset-y-0 left-0 -ml-px block w-[2px] origin-top"),
834
838
  initial: {
835
- scaleY: 0,
839
+ scaleY: reduce ? 1 : 0,
836
840
  opacity: 1,
837
- left: dot.x
841
+ x: dot.x
838
842
  },
839
843
  animate: {
840
844
  scaleY: 1,
841
845
  opacity: 1,
842
- left: dot.x
846
+ x: dot.x
843
847
  },
844
848
  exit: {
845
849
  opacity: 0,
846
- transition: { duration: .12 }
850
+ transition: { duration: reduce ? 0 : .12 }
847
851
  },
848
- transition: {
852
+ transition: reduce ? { duration: 0 } : {
849
853
  scaleY: {
850
854
  duration: .22,
851
855
  ease: [
@@ -855,29 +859,30 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
855
859
  1
856
860
  ]
857
861
  },
858
- left: {
862
+ x: {
859
863
  type: "spring",
860
864
  stiffness: 420,
861
865
  damping: 34
862
866
  }
863
867
  }
864
868
  }, "gv") : /* @__PURE__ */ jsx(motion.i, {
865
- className: cn(GUIDE, "inset-x-0 -mt-px block h-[2px] origin-left"),
869
+ "data-rt-guide": "row",
870
+ className: cn(GUIDE, "inset-x-0 top-0 -mt-px block h-[2px] origin-left"),
866
871
  initial: {
867
- scaleX: 0,
872
+ scaleX: reduce ? 1 : 0,
868
873
  opacity: 1,
869
- top: dot.y
874
+ y: dot.y
870
875
  },
871
876
  animate: {
872
877
  scaleX: 1,
873
878
  opacity: 1,
874
- top: dot.y
879
+ y: dot.y
875
880
  },
876
881
  exit: {
877
882
  opacity: 0,
878
- transition: { duration: .12 }
883
+ transition: { duration: reduce ? 0 : .12 }
879
884
  },
880
- transition: {
885
+ transition: reduce ? { duration: 0 } : {
881
886
  scaleX: {
882
887
  duration: .22,
883
888
  ease: [
@@ -887,7 +892,7 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
887
892
  1
888
893
  ]
889
894
  },
890
- top: {
895
+ y: {
891
896
  type: "spring",
892
897
  stiffness: 420,
893
898
  damping: 34
@@ -901,7 +906,7 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
901
906
  "aria-label": "Table",
902
907
  contentEditable: false,
903
908
  onMouseDown: (e) => e.preventDefault(),
904
- className: "absolute -top-[52px] left-0 z-[6] flex w-max origin-bottom-left items-center gap-0.5 rounded-[10px] bg-kit-insp-btool-bg p-1 shadow-[0_0_0_1px_var(--kit-insp-btool-line),0_1px_2px_rgb(0_0_0/0.05),0_8px_24px_-4px_rgb(0_0_0/0.1)] motion-safe:animate-[kit-insp-appear_160ms_cubic-bezier(0.22,1,0.36,1)_both]",
909
+ className: "absolute -top-[52px] left-0 z-[6] flex w-max origin-bottom-left items-center gap-0.5 rounded-[10px] bg-kit-insp-btool-bg p-1 shadow-[0_0_0_1px_var(--kit-insp-btool-line),0_1px_2px_rgb(0_0_0/0.05),0_8px_24px_-4px_rgb(0_0_0/0.1)] motion-safe:animate-[kit-insp-appear_160ms_cubic-bezier(0.22,1,0.36,1)_both] motion-reduce:animate-[kit-fade-in_120ms_ease-out_both]",
905
910
  children: [
906
911
  /* @__PURE__ */ jsx("button", {
907
912
  type: "button",
@@ -945,7 +950,7 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
945
950
  onClick: () => act("center"),
946
951
  children: /* @__PURE__ */ jsx(Ti, { n: "center" })
947
952
  }),
948
- /* @__PURE__ */ jsx("button", {
953
+ ctx.allows?.("tableFit") ? /* @__PURE__ */ jsx("button", {
949
954
  type: "button",
950
955
  title: "Fit to width",
951
956
  "aria-label": "Fit to width",
@@ -953,7 +958,7 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
953
958
  className: TOOL_BTN,
954
959
  onClick: () => act("fit"),
955
960
  children: /* @__PURE__ */ jsx(Ti, { n: "fit" })
956
- }),
961
+ }) : null,
957
962
  /* @__PURE__ */ jsx("button", {
958
963
  type: "button",
959
964
  title: "Table settings",