@bettercms-ai/kit 4.1.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/lossy.d.ts +1 -1
- package/dist/adapters/lossy.js +1 -1
- package/dist/adapters/lossy.js.map +1 -1
- package/dist/adapters/schema.js +1 -1
- package/dist/adapters/schema.js.map +1 -1
- package/dist/context.d.ts +8 -0
- package/dist/context.js.map +1 -1
- package/dist/controls/index.js +2 -2
- package/dist/controls/media-v16.d.ts +3 -1
- package/dist/controls/media-v16.js +3 -1
- package/dist/controls/media-v16.js.map +1 -1
- package/dist/controls/media.d.ts +5 -1
- package/dist/controls/media.js +25 -7
- package/dist/controls/media.js.map +1 -1
- package/dist/controls/rich-text/block-tool.d.ts +1 -1
- package/dist/controls/rich-text/block-tool.js +1 -1
- package/dist/controls/rich-text/block-tool.js.map +1 -1
- package/dist/controls/rich-text/blocks.js +3 -1
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/catalog.d.ts +26 -3
- package/dist/controls/rich-text/catalog.js +239 -58
- package/dist/controls/rich-text/catalog.js.map +1 -1
- package/dist/controls/rich-text/codec.d.ts +7 -1
- package/dist/controls/rich-text/codec.js +2 -1
- package/dist/controls/rich-text/codec.js.map +1 -1
- package/dist/controls/rich-text/control.js +2 -1
- package/dist/controls/rich-text/control.js.map +1 -1
- package/dist/controls/rich-text/dom.js +8 -3
- package/dist/controls/rich-text/dom.js.map +1 -1
- package/dist/controls/rich-text/editor.d.ts +3 -1
- package/dist/controls/rich-text/editor.js +160 -44
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/rewriteSelection.d.ts +25 -0
- package/dist/controls/rich-text/rewriteSelection.js +28 -0
- package/dist/controls/rich-text/rewriteSelection.js.map +1 -0
- package/dist/controls/rich-text/slash-preview.js +18 -5
- package/dist/controls/rich-text/slash-preview.js.map +1 -1
- package/dist/controls/rich-text/table-grid.js +28 -21
- package/dist/controls/rich-text/table-grid.js.map +1 -1
- package/dist/controls/rich-text/toolbar.d.ts +6 -2
- package/dist/controls/rich-text/toolbar.js +205 -4
- package/dist/controls/rich-text/toolbar.js.map +1 -1
- package/dist/controls/text.d.ts +1 -1
- package/dist/controls/text.js +10 -7
- package/dist/controls/text.js.map +1 -1
- package/dist/engine/field-shell.js +8 -4
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +9 -2
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.js +4 -3
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/item-list.js +2 -2
- package/dist/engine/item-list.js.map +1 -1
- package/dist/engine/schema-form.d.ts +2 -0
- package/dist/engine/schema-form.js +2 -0
- package/dist/engine/schema-form.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/kit.css +6 -32
- package/dist/lib/reduced-motion.d.ts +1 -0
- package/dist/lib/reduced-motion.js +19 -0
- package/dist/lib/reduced-motion.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme.css +101 -0
- package/dist/tokens.css +9 -0
- package/dist/ui/content-fields.js +3 -2
- package/dist/ui/content-fields.js.map +1 -1
- package/dist/ui/controls.js +3 -2
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/floating-panel.js +3 -2
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/foundations.js +3 -2
- package/dist/ui/foundations.js.map +1 -1
- package/dist/ui/index.js +2 -2
- package/dist/ui/inspector.d.ts +23 -5
- package/dist/ui/inspector.js +75 -30
- package/dist/ui/inspector.js.map +1 -1
- package/dist/ui/overlay.js +2 -2
- package/dist/ui/overlay.js.map +1 -1
- package/dist/ui/tab.js +3 -2
- package/dist/ui/tab.js.map +1 -1
- 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,QAAQ,WAAW,QAAQ;CAC9E,IAAI;CACJ,QAAQ,KAAR;EACE,KAAK;GAAa,OAAO,qBAAA,UAAA,EAAA,UAAA;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AC,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,OAAO,EAAE;AAAI,CAAA;AACvF,IAAM,OAAO;AAGb,IAAM,MAAqC;CACzC,GAAG;CAAa,IAAI;CAAM,I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AC,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)
|
|
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:
|
|
376
|
-
var DOT_ICON = `relative z-[2] size-3 scale-[.6] opacity-0
|
|
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);
|
|
@@ -447,12 +450,14 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
|
|
|
447
450
|
const delCol = (i) => {
|
|
448
451
|
if (m.columns.length <= 1) return removeTable();
|
|
449
452
|
set((t) => gridDeleteColumn(t, i), "Delete column");
|
|
453
|
+
ctx.notify("Column deleted", "Press ⌘Z to undo.");
|
|
450
454
|
setHcol(null);
|
|
451
455
|
};
|
|
452
456
|
const delRow = (i) => {
|
|
453
457
|
if (drawn <= 1) return removeTable();
|
|
454
458
|
if (i < h) set({ headerRow: false }, "Delete header row");
|
|
455
459
|
else set((t) => gridDeleteRow(t, i - h), "Delete row");
|
|
460
|
+
ctx.notify("Row deleted", "Press ⌘Z to undo.");
|
|
456
461
|
setHrow(null);
|
|
457
462
|
setSel(null);
|
|
458
463
|
};
|
|
@@ -830,22 +835,23 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
|
|
|
830
835
|
style: { left: drop.x }
|
|
831
836
|
}) : null,
|
|
832
837
|
/* @__PURE__ */ jsx(AnimatePresence, { children: dot && !drag ? "x" in dot ? /* @__PURE__ */ jsx(motion.i, {
|
|
833
|
-
|
|
838
|
+
"data-rt-guide": "col",
|
|
839
|
+
className: cn(GUIDE, "inset-y-0 left-0 -ml-px block w-[2px] origin-top"),
|
|
834
840
|
initial: {
|
|
835
|
-
scaleY: 0,
|
|
841
|
+
scaleY: reduce ? 1 : 0,
|
|
836
842
|
opacity: 1,
|
|
837
|
-
|
|
843
|
+
x: dot.x
|
|
838
844
|
},
|
|
839
845
|
animate: {
|
|
840
846
|
scaleY: 1,
|
|
841
847
|
opacity: 1,
|
|
842
|
-
|
|
848
|
+
x: dot.x
|
|
843
849
|
},
|
|
844
850
|
exit: {
|
|
845
851
|
opacity: 0,
|
|
846
|
-
transition: { duration: .12 }
|
|
852
|
+
transition: { duration: reduce ? 0 : .12 }
|
|
847
853
|
},
|
|
848
|
-
transition: {
|
|
854
|
+
transition: reduce ? { duration: 0 } : {
|
|
849
855
|
scaleY: {
|
|
850
856
|
duration: .22,
|
|
851
857
|
ease: [
|
|
@@ -855,29 +861,30 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
|
|
|
855
861
|
1
|
|
856
862
|
]
|
|
857
863
|
},
|
|
858
|
-
|
|
864
|
+
x: {
|
|
859
865
|
type: "spring",
|
|
860
866
|
stiffness: 420,
|
|
861
867
|
damping: 34
|
|
862
868
|
}
|
|
863
869
|
}
|
|
864
870
|
}, "gv") : /* @__PURE__ */ jsx(motion.i, {
|
|
865
|
-
|
|
871
|
+
"data-rt-guide": "row",
|
|
872
|
+
className: cn(GUIDE, "inset-x-0 top-0 -mt-px block h-[2px] origin-left"),
|
|
866
873
|
initial: {
|
|
867
|
-
scaleX: 0,
|
|
874
|
+
scaleX: reduce ? 1 : 0,
|
|
868
875
|
opacity: 1,
|
|
869
|
-
|
|
876
|
+
y: dot.y
|
|
870
877
|
},
|
|
871
878
|
animate: {
|
|
872
879
|
scaleX: 1,
|
|
873
880
|
opacity: 1,
|
|
874
|
-
|
|
881
|
+
y: dot.y
|
|
875
882
|
},
|
|
876
883
|
exit: {
|
|
877
884
|
opacity: 0,
|
|
878
|
-
transition: { duration: .12 }
|
|
885
|
+
transition: { duration: reduce ? 0 : .12 }
|
|
879
886
|
},
|
|
880
|
-
transition: {
|
|
887
|
+
transition: reduce ? { duration: 0 } : {
|
|
881
888
|
scaleX: {
|
|
882
889
|
duration: .22,
|
|
883
890
|
ease: [
|
|
@@ -887,7 +894,7 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
|
|
|
887
894
|
1
|
|
888
895
|
]
|
|
889
896
|
},
|
|
890
|
-
|
|
897
|
+
y: {
|
|
891
898
|
type: "spring",
|
|
892
899
|
stiffness: 420,
|
|
893
900
|
damping: 34
|
|
@@ -901,7 +908,7 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
|
|
|
901
908
|
"aria-label": "Table",
|
|
902
909
|
contentEditable: false,
|
|
903
910
|
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]",
|
|
911
|
+
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
912
|
children: [
|
|
906
913
|
/* @__PURE__ */ jsx("button", {
|
|
907
914
|
type: "button",
|
|
@@ -945,7 +952,7 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
|
|
|
945
952
|
onClick: () => act("center"),
|
|
946
953
|
children: /* @__PURE__ */ jsx(Ti, { n: "center" })
|
|
947
954
|
}),
|
|
948
|
-
/* @__PURE__ */ jsx("button", {
|
|
955
|
+
ctx.allows?.("tableFit") ? /* @__PURE__ */ jsx("button", {
|
|
949
956
|
type: "button",
|
|
950
957
|
title: "Fit to width",
|
|
951
958
|
"aria-label": "Fit to width",
|
|
@@ -953,7 +960,7 @@ function TableGridV16({ m, set, el, ctx, autoFocus, options }) {
|
|
|
953
960
|
className: TOOL_BTN,
|
|
954
961
|
onClick: () => act("fit"),
|
|
955
962
|
children: /* @__PURE__ */ jsx(Ti, { n: "fit" })
|
|
956
|
-
}),
|
|
963
|
+
}) : null,
|
|
957
964
|
/* @__PURE__ */ jsx("button", {
|
|
958
965
|
type: "button",
|
|
959
966
|
title: "Table settings",
|