@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
|
@@ -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 { useKitLook } from \"../../context\";\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 const v16 = useKitLook() === \"v16\";\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 // look \"v16\" (prototype kit.css:263-268 .rtx-b): 28 square, radius 4, 14 icons, #3B3B3B; hover and on #E5E5E5\n v16\n ? \"flex h-7 min-w-7 shrink-0 items-center justify-center gap-0.5 rounded-[4px] px-1 text-[13px] text-kit-insp-tip-body outline-none transition-[background-color] duration-[120ms] hover:bg-kit-insp-line hover:text-kit-insp-tip-title focus-visible:shadow-[inset_0_0_0_2px_var(--kit-insp-accent)] [&_svg]:size-3.5\"\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 && (v16 ? \"bg-kit-insp-line text-kit-insp-tip-title\" : \"bg-kit-selected text-kit-fg\"),\n disabled && (v16 ? \"opacity-40 hover:bg-transparent hover:text-kit-insp-tip-body\" : \"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 = () => {\n // look \"v16\" (prototype content.css:227 .rtx-sep): 16 high, 6 either side, #E5E5E5\n const v16 = useKitLook() === \"v16\";\n return <span aria-hidden className={cn(\"h-4 w-px shrink-0\", v16 ? \"mx-1.5 bg-kit-insp-line\" : \"mx-1 bg-kit-line\")} />;\n};\n/** Look \"v16\" Focus mode glyph (prototype content.jsx:85 `focus`, a 14 grid). */\nconst FocusIcon = () => (\n <svg viewBox=\"0 0 14 14\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M2.333 4.667V3.5c0-.644.523-1.167 1.167-1.167h1.167M2.333 9.333V10.5c0 .644.523 1.167 1.167 1.167h1.167M9.333 2.333H10.5c.644 0 1.167.523 1.167 1.167v1.167M11.667 9.333V10.5c0 .644-.523 1.167-1.167 1.167H9.333\" />\n </svg>\n);\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 v16 = useKitLook() === \"v16\";\n const w = width - (dense ? 40 : 0);\n // BL-538: Underline keeps its button down to a narrow field (a 250px dock column, dense too); Strikethrough folds first\n const foldU = w < 200;\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 // look \"v16\" (prototype content.css:56 .ce-tb): the bar is 44 high, 16 in, 2 between buttons\n className={cn(\"overflow-clip rounded-t-kit-lg\", open ? (v16 ? \"h-11\" : \"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\", v16 && \"px-4\", 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 {/* look \"v16\" (prototype content.jsx:1018): Quote sits with the lists */}\n {v16 && allows(\"blockquote\") ? (\n <ToolButton label=\"Quote\" icon={<IconBlockquote stroke={1.5} />} active={fmt.block === \"blockquote\"} disabled={off} onClick={() => onStyle(fmt.block === \"blockquote\" ? \"p\" : \"blockquote\")} />\n ) : null}\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 // look \"v16\" (prototype content.css:478-480 .ce-insert): 13/18 medium, radius 6, 8 left 6 right, a 14 plus and a 12 chevron; grey while open\n aria-haspopup={v16 ? \"menu\" : undefined}\n className={\n v16\n ? \"mx-0.5 flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-[6px] pl-2 pr-1.5 text-[13px] font-medium leading-[18px] text-kit-insp-tip-title outline-none transition-[background-color] duration-[120ms] hover:bg-kit-insp-card focus-visible:shadow-[inset_0_0_0_2px_var(--kit-insp-accent)] disabled:opacity-40 data-[popup-open]:bg-kit-insp-card [&_svg]:shrink-0 [&_svg]:text-kit-insp-tip-body\"\n : \"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 >\n <IconPlus className={v16 ? \"size-3.5\" : undefined} stroke={v16 ? 1.8 : 1.5} aria-hidden />\n {insertLabel ? \"Insert\" : null}\n {v16 ? <IconChevronDown className=\"size-3\" stroke={1.8} aria-hidden /> : 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 : v16 ? (\n // look \"v16\" (prototype content.jsx:1020): the way into the full-screen writing view is \"Focus mode · ⇧⌘F\"\n <ToolButton label=\"Focus mode\" icon={<FocusIcon />} shortcut=\"⇧⌘F\" onClick={onFullscreen} />\n ) : (\n <ToolButton label=\"Expand editor\" icon={<IconArrowsMaximize stroke={1.5} />} shortcut=\"⌘↵\" onClick={onFullscreen} />\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAiCA,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,MA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A;OAC9B,WACE,MACI,mZACA;OATR,UAAA;QAYE,oBAAC,UAAD;SAAU,WAAW,MAAM,aAAa,KAAA;SAAW,QAAQ,MAAM,MAAM;SAAK,eAAA;QAAa,CAAA;QACxF,cAAc,WAAW;QACzB,MAAM,oBAAC,iBAAD;SAAiB,WAAU;SAAS,QAAQ;SAAK,eAAA;QAAa,CAAA,IAAI;OAC3D;;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,MAEvB,oBAAC,YAAD;KAAY,OAAM;KAAa,MAAM,oBAAC,WAAD,CAAY,CAAA;KAAG,UAAS;KAAM,SAAS;IAAe,CAAA,IAE3F,oBAAC,YAAD;KAAY,OAAM;KAAgB,MAAM,oBAAC,oBAAD,EAAoB,QAAQ,IAAM,CAAA;KAAG,UAAS;KAAK,SAAS;IAAe,CAAA;GAElH;;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, IconDots, 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 { useKitLook } from \"../../context\";\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 const v16 = useKitLook() === \"v16\";\n return (\n // look \"v16\" (prototype content.jsx TipBtn): the white card tooltip, its shortcut always shown (\"Bold · ⌘B\")\n <Tooltip content={tip ?? label} shortcut={shortcut} side={side} variant={v16 ? \"card\" : undefined}>\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 // look \"v16\" (prototype kit.css:263-268 .rtx-b): 28 square, radius 4, 14 icons, #3B3B3B; hover and on #E5E5E5\n v16\n ? \"flex h-7 min-w-7 shrink-0 items-center justify-center gap-0.5 rounded-[4px] px-1 text-[13px] text-kit-insp-tip-body outline-none transition-[background-color] duration-[120ms] hover:bg-kit-insp-line hover:text-kit-insp-tip-title focus-visible:shadow-[inset_0_0_0_2px_var(--kit-insp-accent)] [&_svg]:size-3.5\"\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 && (v16 ? \"bg-kit-insp-line text-kit-insp-tip-title\" : \"bg-kit-selected text-kit-fg\"),\n disabled && (v16 ? \"opacity-40 hover:bg-transparent hover:text-kit-insp-tip-body\" : \"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 textLabel = \"Text\",\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 /** what the trigger calls a plain paragraph (look v16: \"Paragraph\") */\n textLabel?: 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 || cur.tag === \"p\" ? textLabel : cur.short}\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 = () => {\n // look \"v16\" (prototype content.css:227 .rtx-sep): 16 high, 6 either side, #E5E5E5\n const v16 = useKitLook() === \"v16\";\n return <span aria-hidden className={cn(\"h-4 w-px shrink-0\", v16 ? \"mx-1.5 bg-kit-insp-line\" : \"mx-1 bg-kit-line\")} />;\n};\n/** Look \"v16\" Focus mode glyph (prototype content.jsx:85 `focus`, a 14 grid). */\nconst FocusIcon = () => (\n <svg viewBox=\"0 0 14 14\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M2.333 4.667V3.5c0-.644.523-1.167 1.167-1.167h1.167M2.333 9.333V10.5c0 .644.523 1.167 1.167 1.167h1.167M9.333 2.333H10.5c.644 0 1.167.523 1.167 1.167v1.167M11.667 9.333V10.5c0 .644-.523 1.167-1.167 1.167H9.333\" />\n </svg>\n);\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 onFocusMode,\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 /** look v16: the Focus button (the host's full-screen writing view, else the expanded editor) */\n onFocusMode?: () => void;\n onMarkdown: () => void;\n saveSel: () => void;\n}) {\n const v16 = useKitLook() === \"v16\";\n const w = width - (dense ? 40 : 0);\n // BL-538: Underline keeps its button down to a narrow field (a 250px dock column, dense too); Strikethrough folds first\n const foldU = w < 200;\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 if (v16) {\n /* look \"v16\" (prototype content.jsx:1015-1020 + richtext.jsx:343-353, r7 #5): always shown, in the prototype's order\n Paragraph ▾ · B I U S Link | • 1. ❝ | Insert ▾ · Focus ····· ⋯ \"More · Expand editor\" (Clear formatting, Comment,\n Markdown and code live in ⋯). Tooltips carry their shortcuts. */\n const quote = allows(\"blockquote\");\n const menuIcon = (on: boolean, icon: React.ReactNode) => (on ? <IconCheck stroke={2} /> : icon);\n return (\n <div className={cn(\"h-11 overflow-clip rounded-t-[10px]\", sticky && \"sticky z-[4]\")} style={sticky ? { top: stickyTop } : undefined}>\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-insp-line bg-kit-subtle\", dense ? \"px-2\" : \"px-4\")}\n >\n {styles.length > 1 ? (\n <StyleMenu\n block={fmt.block}\n styles={styles}\n onPick={onStyle}\n disabled={off}\n textLabel=\"Paragraph\"\n className=\"min-w-24 justify-between\"\n onOpenChange={(o) => onMenuOpen(\"style\", o)}\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 {allows(\"link\") ? (\n <ToolButton label=\"Link\" tip={linkTip} icon={<IconLink stroke={1.5} />} shortcut=\"⌘K\" active={fmt.onLink} disabled={off || !(fmt.hasSel || fmt.onLink)} onClick={onLink} />\n ) : null}\n {foldLists || !(lists.length || quote) ? 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 {quote ? (\n <ToolButton label=\"Quote\" icon={<IconBlockquote stroke={1.5} />} active={fmt.block === \"blockquote\"} disabled={off} onClick={() => onStyle(fmt.block === \"blockquote\" ? \"p\" : \"blockquote\")} />\n ) : null}\n </>\n )}\n <Sep />\n <Popover open={insertOpen} onOpenChange={setInsertOpen}>\n <Tooltip content=\"Insert a block\" variant=\"card\">\n <PopoverTrigger\n disabled={off}\n aria-label=\"Insert\"\n onMouseDown={() => saveSel()}\n // prototype content.css:478-480 .ce-insert: 13/18 medium, radius 6, 8 left 6 right, a 14 plus and a 12 chevron; grey while open\n aria-haspopup=\"menu\"\n className=\"mx-0.5 flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-[6px] pl-2 pr-1.5 text-[13px] font-medium leading-[18px] text-kit-insp-tip-title outline-none transition-[background-color] duration-[120ms] hover:bg-kit-insp-card focus-visible:shadow-[inset_0_0_0_2px_var(--kit-insp-accent)] disabled:opacity-40 data-[popup-open]:bg-kit-insp-card [&_svg]:shrink-0 [&_svg]:text-kit-insp-tip-body\"\n >\n <IconPlus className=\"size-3.5\" stroke={1.8} aria-hidden />\n {w >= 360 ? \"Insert\" : null}\n <IconChevronDown className=\"size-3\" stroke={1.8} aria-hidden />\n </PopoverTrigger>\n </Tooltip>\n {insertOpen ? <InsertMenuContent list=\"curated\" allows={allows} onInsert={onInsert} keepFocusOnClose={keepFocusOnInsertClose} /> : null}\n </Popover>\n {hideFullscreen ? null : <ToolButton label=\"Focus mode\" icon={<FocusIcon />} shortcut=\"⇧⌘F\" onClick={onFocusMode ?? onFullscreen} />}\n <span className=\"min-w-1 flex-1\" />\n <Menu onOpenChange={(o) => onMenuOpen(\"more\", o)}>\n <Tooltip content={hideFullscreen ? \"More formatting\" : \"More · Expand editor\"} variant=\"card\">\n <MenuTrigger\n aria-label={hideFullscreen ? \"More formatting options\" : \"More · Expand editor\"}\n onMouseDown={(e) => {\n e.preventDefault();\n saveSel();\n }}\n className=\"flex size-7 shrink-0 items-center justify-center rounded-[4px] text-kit-insp-tip-body outline-none hover:bg-kit-insp-line hover:text-kit-insp-tip-title focus-visible:shadow-[inset_0_0_0_2px_var(--kit-insp-accent)] data-[popup-open]:bg-kit-insp-line [&_svg]:size-3.5\"\n >\n <IconDots stroke={1.5} aria-hidden />\n </MenuTrigger>\n </Tooltip>\n <MenuContent align=\"end\" className=\"w-60\" finalFocus={false}>\n {hideFullscreen ? null : (\n <>\n <MenuItem icon={<IconArrowsMaximize stroke={1.5} />} shortcut=\"⇧⌘E\" onClick={onFullscreen}>\n Expand editor\n </MenuItem>\n <MenuSeparator />\n </>\n )}\n {menuMarks.map((m) => (\n <MenuItem key={m} disabled={off} icon={menuIcon(m === \"underline\" ? fmt.underline : fmt.strike, markIcon(m))} shortcut={m === \"underline\" ? \"⌘U\" : undefined} onClick={() => onMark(m)}>\n {markLabel(m)}\n </MenuItem>\n ))}\n {foldLists\n ? lists.map((l) => (\n <MenuItem key={l} disabled={off} icon={menuIcon(fmt[l], listIcon(l))} onClick={() => onList(l)}>\n {listLabel(l)}\n </MenuItem>\n ))\n : null}\n {foldLists && quote ? (\n <MenuItem disabled={off} icon={menuIcon(fmt.block === \"blockquote\", <IconBlockquote stroke={1.5} />)} onClick={() => onStyle(fmt.block === \"blockquote\" ? \"p\" : \"blockquote\")}>\n Quote\n </MenuItem>\n ) : null}\n <MenuItem disabled={off} icon={<IconClearFormatting stroke={1.5} />} onClick={onClear}>\n Clear formatting\n </MenuItem>\n {onComment ? (\n <MenuItem disabled={off || !fmt.hasSel} icon={<IconMessage stroke={1.5} />} onClick={onComment}>\n {commentTip}\n </MenuItem>\n ) : null}\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 {allows(\"code\") || allows(\"pre\") ? <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 </div>\n </div>\n );\n }\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 // look \"v16\" (prototype content.css:56 .ce-tb): the bar is 44 high, 16 in, 2 between buttons\n className={cn(\"overflow-clip rounded-t-kit-lg\", open ? (v16 ? \"h-11\" : \"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\", v16 && \"px-4\", 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 {/* look \"v16\" (prototype content.jsx:1018): Quote sits with the lists */}\n {v16 && allows(\"blockquote\") ? (\n <ToolButton label=\"Quote\" icon={<IconBlockquote stroke={1.5} />} active={fmt.block === \"blockquote\"} disabled={off} onClick={() => onStyle(fmt.block === \"blockquote\" ? \"p\" : \"blockquote\")} />\n ) : null}\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 // look \"v16\" (prototype content.css:478-480 .ce-insert): 13/18 medium, radius 6, 8 left 6 right, a 14 plus and a 12 chevron; grey while open\n aria-haspopup={v16 ? \"menu\" : undefined}\n className={\n v16\n ? \"mx-0.5 flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-[6px] pl-2 pr-1.5 text-[13px] font-medium leading-[18px] text-kit-insp-tip-title outline-none transition-[background-color] duration-[120ms] hover:bg-kit-insp-card focus-visible:shadow-[inset_0_0_0_2px_var(--kit-insp-accent)] disabled:opacity-40 data-[popup-open]:bg-kit-insp-card [&_svg]:shrink-0 [&_svg]:text-kit-insp-tip-body\"\n : \"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 >\n <IconPlus className={v16 ? \"size-3.5\" : undefined} stroke={v16 ? 1.8 : 1.5} aria-hidden />\n {insertLabel ? \"Insert\" : null}\n {v16 ? <IconChevronDown className=\"size-3\" stroke={1.8} aria-hidden /> : null}\n </PopoverTrigger>\n </Tooltip>\n {insertOpen ? <InsertMenuContent list=\"curated\" 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 : v16 ? (\n // look \"v16\" (prototype content.jsx:1020): the way into the full-screen writing view is \"Focus mode · ⇧⌘F\"\n <ToolButton label=\"Focus mode\" icon={<FocusIcon />} shortcut=\"⇧⌘F\" onClick={onFullscreen} />\n ) : (\n <ToolButton label=\"Expand editor\" icon={<IconArrowsMaximize stroke={1.5} />} shortcut=\"⌘↵\" onClick={onFullscreen} />\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAiCA,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;EA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;KAAzC,UAAA,CACE,oBAAC,SAAD;MAAS,SAAQ;MACf,UAAA,qBAAC,gBAAD;OACE,UAAU;OACV,cAAW;OACX,mBAAmB,QAAQ;OAE3B,iBAAe,MAAM,SAAS,KAAA;OAC9B,WACE,MACI,mZACA;OATR,UAAA;QAYE,oBAAC,UAAD;SAAU,WAAW,MAAM,aAAa,KAAA;SAAW,QAAQ,MAAM,MAAM;SAAK,eAAA;QAAa,CAAA;QACxF,cAAc,WAAW;QACzB,MAAM,oBAAC,iBAAD;SAAiB,WAAU;SAAS,QAAQ;SAAK,eAAA;QAAa,CAAA,IAAI;OAC3D;;KACT,CAAA,GACR,aAAa,oBAAC,mBAAD;MAAmB,MAAK;MAAkB;MAAkB;MAAU,kBAAkB;KAAyB,CAAA,IAAI,IAC5H;;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,MAEvB,oBAAC,YAAD;KAAY,OAAM;KAAa,MAAM,oBAAC,WAAD,CAAY,CAAA;KAAG,UAAS;KAAM,SAAS;IAAe,CAAA,IAE3F,oBAAC,YAAD;KAAY,OAAM;KAAgB,MAAM,oBAAC,oBAAD,EAAoB,QAAQ,IAAM,CAAA;KAAG,UAAS;KAAK,SAAS;IAAe,CAAA;GAElH;;CACF,CAAA;AAET"}
|
package/dist/controls/text.d.ts
CHANGED
|
@@ -20,4 +20,4 @@ export declare const slugTyping: (s: string) => string;
|
|
|
20
20
|
export declare const slugTidy: (s: string) => string;
|
|
21
21
|
/** Label-row "Generate" for slug fields (ACTIONS.slug; prod: ghost button in the label row). */
|
|
22
22
|
export declare function SlugGenerate({ parent, value, onChange, readOnly }: Pick<ControlProps, "parent" | "value" | "onChange" | "readOnly">): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
-
export declare function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onBlur }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function SlugControl({ field, value, onChange, readOnly, id, invalid, parent, path, onBlur }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/controls/text.js
CHANGED
|
@@ -88,7 +88,7 @@ function TextControl({ field, value, onChange, readOnly, id, invalid, onBlur })
|
|
|
88
88
|
placeholder: field.placeholder,
|
|
89
89
|
onBlur,
|
|
90
90
|
onChange: (e) => onChange(e.target.value),
|
|
91
|
-
className: cn(TEXT_FOCUS, "leading-5", v16 && cn("rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] tracking-[-0.1625px] text-kit-insp-tip-title shadow-none placeholder:text-kit-group-sub transition-[background-color,border-color] duration-[120ms] ease-out hover:border-transparent hover:bg-kit-insp-field-hover focus:border-kit-insp-accent focus:bg-kit-insp-card-focus aria-[invalid=true]:border-kit-insp-error", "max-h-[162px] min-h-[72px] overflow-y-auto py-2 transition-[
|
|
91
|
+
className: cn(TEXT_FOCUS, "leading-5", v16 && cn("rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] tracking-[-0.1625px] text-kit-insp-tip-title shadow-none placeholder:text-kit-group-sub transition-[background-color,border-color] duration-[120ms] ease-out hover:border-transparent hover:bg-kit-insp-field-hover focus:border-kit-insp-accent focus:bg-kit-insp-card-focus aria-[invalid=true]:border-kit-insp-error", "max-h-[162px] min-h-[72px] overflow-y-auto py-2 transition-[background-color,border-color] duration-[160ms]"))
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
function EmailControl({ field, value, onChange, readOnly, id, invalid, onBlur }) {
|
|
@@ -184,7 +184,7 @@ function SlugGenerate({ parent, value, onChange, readOnly }) {
|
|
|
184
184
|
})
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onBlur }) {
|
|
187
|
+
function SlugControl({ field, value, onChange, readOnly, id, invalid, parent, path, onBlur }) {
|
|
188
188
|
const v = str(value);
|
|
189
189
|
const env = useKitEnv();
|
|
190
190
|
const form = useForm();
|
|
@@ -207,7 +207,10 @@ function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onB
|
|
|
207
207
|
const changedLive = !!live && live !== v && confirmed !== v;
|
|
208
208
|
const host = env.urlPrefix?.replace(/^https?:\/\//, "");
|
|
209
209
|
const url = host ? `https://${host}${v}` : "";
|
|
210
|
-
const
|
|
210
|
+
const prefix = (field.prefix ?? "").replace(/^\/+/, "");
|
|
211
|
+
const urlField = !!(env.slugIsAddress && host || prefix);
|
|
212
|
+
const greyText = host ? `${host.replace(/\/+$/, "")}/${prefix}` : prefix;
|
|
213
|
+
const lead = prefix ? "" : "/";
|
|
211
214
|
const [typed, setTyped] = React.useState(null);
|
|
212
215
|
const shown = typed ?? v;
|
|
213
216
|
const slugBad = typed !== null && !/^[a-z0-9-]*$/.test(typed);
|
|
@@ -221,14 +224,14 @@ function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onB
|
|
|
221
224
|
children: [/* @__PURE__ */ jsx("span", {
|
|
222
225
|
"aria-hidden": true,
|
|
223
226
|
className: "shrink-0 select-none whitespace-nowrap text-kit-insp-faint",
|
|
224
|
-
children: host.replace(/\/+$/, "")
|
|
227
|
+
children: prefix ? greyText : host.replace(/\/+$/, "")
|
|
225
228
|
}), /* @__PURE__ */ jsx("input", {
|
|
226
229
|
id,
|
|
227
|
-
value:
|
|
230
|
+
value: `${lead}${shown}`,
|
|
228
231
|
readOnly,
|
|
229
232
|
"aria-invalid": slugBad || invalid,
|
|
230
233
|
spellCheck: false,
|
|
231
|
-
placeholder:
|
|
234
|
+
placeholder: field.placeholder ?? `${lead}page-slug`,
|
|
232
235
|
onChange: (e) => {
|
|
233
236
|
following.current = false;
|
|
234
237
|
const next = e.target.value.replace(/^\/+/, "");
|
|
@@ -255,7 +258,7 @@ function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onB
|
|
|
255
258
|
value: v,
|
|
256
259
|
readOnly,
|
|
257
260
|
"aria-invalid": invalid,
|
|
258
|
-
placeholder: "
|
|
261
|
+
placeholder: field.placeholder ?? "page-slug",
|
|
259
262
|
className: cn(TEXT_FOCUS, "font-kit-mono [&_input]:font-kit-mono"),
|
|
260
263
|
onChange: (e) => {
|
|
261
264
|
following.current = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":[],"sources":["../../src/controls/text.tsx"],"sourcesContent":["/**\n * TEXT — string · text · email · url · slug (V2 HEAD 9829bf1 kit/controls/text.tsx, DESIGN §8.2–8.3).\n * Founder rule: text grows to show its whole value, never clipped. Text entry gets NO focus ring or halo — the border\n * steps rest → hover → focus on the box only (prod CPO-069).\n *\n * Stored shapes (prod): string / longtext / email / slug / url (text + inputType \"url\") all store a plain string.\n * Slug keeps the backend's `^[a-z0-9]+(?:-[a-z0-9]+)*$`: keystrokes are filtered, and the stray hyphens typing leaves\n * (a trailing \"-\" before the next word) are tidied on blur.\n */\nimport * as React from \"react\";\nimport { IconAlertTriangle, IconExternalLink, IconMail, IconWorld } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { slugify } from \"../lib/utils\";\nimport { plainText } from \"../lib/schema\";\nimport { KitAddressContext, useForm, useKitEnv, useKitLook, useKitServices } from \"../context\";\nimport { Button, IconButton } from \"../ui/button\";\nimport { Input, Textarea } from \"../ui/input\";\nimport { Tooltip } from \"../ui/overlay\";\nimport { Checkbox } from \"../ui/controls\";\nimport type { ControlProps } from \"../types\";\n\nexport const str = (v: unknown) => (typeof v === \"string\" ? v : v == null ? \"\" : String(v));\n/** border-only focus (no halo) for text entry */\nexport const TEXT_FOCUS = \"focus:shadow-none focus-visible:shadow-none\";\n/** look \"v16\" text entry (F1342, prototype inspector.jsx:94, editor.css:416-418): #F5F5F5, radius 6, no edge at rest,\n * 13/18 -0.1625px #171717, placeholder #707070; hover #E9E9E9; focus #FAFAFA with the violet edge; red edge invalid */\nexport const V16_TEXT_SURFACE =\n \"rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] tracking-[-0.1625px] text-kit-insp-tip-title shadow-none placeholder:text-kit-group-sub transition-[background-color,border-color] duration-[120ms] ease-out hover:border-transparent hover:bg-kit-insp-field-hover focus:border-kit-insp-accent focus:bg-kit-insp-card-focus aria-[invalid=true]:border-kit-insp-error\";\n\n/** `FieldSchema.prefix` (F1344, F1215, F1217): the prototype `.inp-url`, 34 high, grey fill, the prefix 13/18 #A3A3A3\n * right before the value; violet edge while focused, red when invalid. A scheme prefix drops a typed scheme. */\nexport function PrefixedInput({ field, value, onChange, readOnly, id, invalid, onBlur }: Omit<ControlProps, \"path\" | \"parent\">) {\n const prefix = field.prefix ?? \"\";\n const scheme = /^[a-z][a-z0-9+.-]*:\\/\\/$/i.test(prefix);\n return (\n <label\n className={cn(\n \"flex h-[34px] w-full cursor-text items-center rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] text-kit-insp-ink transition-[background-color,border-color] duration-[120ms] ease-out\",\n \"hover:bg-kit-insp-field-hover focus-within:border-kit-insp-accent focus-within:bg-kit-insp-card-focus\",\n invalid && \"!border-kit-insp-error bg-kit-insp-card-focus\",\n readOnly && \"cursor-default\",\n )}\n >\n <span aria-hidden className=\"shrink-0 select-none whitespace-nowrap text-kit-insp-faint\">\n {prefix}\n </span>\n <input\n id={id}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n spellCheck={false}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onChange={(e) => {\n const v = e.target.value.replace(/\\r?\\n/g, \" \");\n onChange(scheme ? v.replace(/^[a-z][a-z0-9+.-]*:\\/\\//i, \"\") : v);\n }}\n className=\"min-w-0 flex-1 border-0 bg-transparent p-0 text-inherit outline-none placeholder:text-kit-fg-3\"\n />\n </label>\n );\n}\n\nexport function StringControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n const v16 = useKitLook() === \"v16\";\n if (field.prefix) return <PrefixedInput field={field} value={value} onChange={onChange} readOnly={readOnly} id={id} invalid={invalid} onBlur={onBlur} />;\n return (\n <Textarea\n id={id}\n rows={1}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onKeyDown={(e) => e.key === \"Enter\" && e.preventDefault()}\n onChange={(e) => onChange(e.target.value.replace(/\\r?\\n/g, \" \"))}\n className={cn(TEXT_FOCUS, \"min-h-8 py-1.5 leading-5\", variant === \"document\" && \"min-h-9 py-2\", v16 && cn(V16_TEXT_SURFACE, \"min-h-[34px] py-[7px]\"))}\n />\n );\n}\n\nexport function TextControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n // look v16 (F1343): 3 rows (72) at least, grows to 8 (162), scrolls after\n const v16 = useKitLook() === \"v16\";\n return (\n <Textarea\n id={id}\n rows={field.rows ?? 3}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onChange={(e) => onChange(e.target.value)}\n className={cn(TEXT_FOCUS, \"leading-5\", v16 && cn(V16_TEXT_SURFACE, \"max-h-[162px] min-h-[72px] overflow-y-auto py-2 transition-[height,background-color,border-color] duration-[160ms]\"))}\n />\n );\n}\n\nexport function EmailControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n return (\n <Input\n id={id}\n size={variant === \"document\" ? \"lg\" : \"md\"}\n type=\"email\"\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n onBlur={onBlur}\n placeholder={field.placeholder ?? \"name@company.com\"}\n leading={<IconMail stroke={1.5} />}\n onChange={(e) => onChange(e.target.value.trim())}\n className={TEXT_FOCUS}\n />\n );\n}\n\nexport function UrlControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const v = str(value);\n const { variant } = useKitEnv();\n if (field.prefix) return <PrefixedInput field={field} value={value} onChange={onChange} readOnly={readOnly} id={id} invalid={invalid} onBlur={onBlur} />;\n const open = /^https?:\\/\\/\\S+/.test(v);\n return (\n <Input\n id={id}\n size={variant === \"document\" ? \"lg\" : \"md\"}\n value={v}\n readOnly={readOnly}\n aria-invalid={invalid}\n onBlur={onBlur}\n placeholder={field.placeholder ?? \"https://example.com\"}\n onChange={(e) => onChange(e.target.value.trim())}\n leading={<IconWorld stroke={1.5} />}\n className={cn(TEXT_FOCUS, \"[&_input]:text-kit-accent-fg\")}\n trailing={\n open ? (\n <Tooltip content=\"Open link in a new tab\">\n <button\n type=\"button\"\n aria-label=\"Open link\"\n className=\"pointer-events-auto flex rounded-kit-md p-0.5 hover:bg-kit-selected hover:text-kit-fg\"\n onClick={() => window.open(v, \"_blank\", \"noopener\")}\n >\n <IconExternalLink className=\"size-4\" stroke={1.5} />\n </button>\n </Tooltip>\n ) : undefined\n }\n />\n );\n}\n\n/* ── Slug ──────────────────────────────────────────────────────────── */\nconst TITLE_KEYS = [\"title\", \"name\", \"heading\", \"question\", \"label\"];\n/** The text a slug follows: the first title-like sibling, else the document title. */\nexport function slugSource(parent: Record<string, unknown> | undefined, docTitle?: string) {\n for (const k of TITLE_KEYS) {\n const t = plainText(parent?.[k]);\n if (t) return t;\n }\n return docTitle ?? \"\";\n}\n/** What a keystroke may leave in a slug: lowercase letters, digits and hyphens (spaces become hyphens). */\nexport const slugTyping = (s: string) => s.toLowerCase().replace(/\\s+/g, \"-\").replace(/[^a-z0-9-]/g, \"\");\n/** The stored slug: no leading, trailing or doubled hyphens (the backend's pattern). */\nexport const slugTidy = (s: string) => slugTyping(s).replace(/-+/g, \"-\").replace(/^-|-$/g, \"\");\n\n/** Label-row \"Generate\" for slug fields (ACTIONS.slug; prod: ghost button in the label row). */\nexport function SlugGenerate({ parent, value, onChange, readOnly }: Pick<ControlProps, \"parent\" | \"value\" | \"onChange\" | \"readOnly\">) {\n const { docTitle } = useKitEnv();\n const src = slugSource(parent, docTitle);\n if (readOnly || !src) return null;\n const next = slugify(src);\n if (!next) return null;\n return (\n <Tooltip content={`Generate from “${src.length > 32 ? `${src.slice(0, 30)}…` : src}”`}>\n <Button size=\"xs\" variant=\"ghost\" className=\"h-5 px-1.5 text-kit-xs text-kit-fg-2\" disabled={next === value} onClick={() => onChange(next)}>\n Generate\n </Button>\n </Tooltip>\n );\n}\n\nexport function SlugControl({ value, onChange, readOnly, id, invalid, parent, path, onBlur }: ControlProps) {\n const v = str(value);\n const env = useKitEnv();\n const form = useForm();\n const { toast, redirectSlug, saveSlug } = useKitServices();\n const address = React.useContext(KitAddressContext);\n const src = slugSource(parent, env.docTitle);\n /* Follows the title until someone edits it or the document is published (CPO-087), V2's rule (`!env.isPublished`):\n a host that passes no isPublished (the dock) follows too, as the help line says. It reacts to a title edit, never\n to mounting, so opening a form writes nothing. */\n const following = React.useRef(!env.isPublished && (v === \"\" || v === slugify(src)));\n const seenSrc = React.useRef(src);\n React.useEffect(() => {\n if (seenSrc.current === src) return;\n seenSrc.current = src;\n if (!following.current || readOnly) return;\n const next = slugify(src);\n if (next && next !== v) onChange(next);\n }, [src]); // eslint-disable-line react-hooks/exhaustive-deps\n\n /* the address the site serves today: the published value, else (published doc, no published copy) the mount value.\n Only where the host says the slug IS the address: a slug prop or a key has no address to break. */\n const live = !env.slugIsAddress ? \"\" : form?.hasPublished ? str(form.publishedAt(path)) : env.isPublished ? str(form?.baselineAt(path) ?? \"\") : \"\";\n const [saving, setSaving] = React.useState(false);\n const [redirect, setRedirect] = React.useState(true);\n const [confirmed, setConfirmed] = React.useState<string | null>(null);\n const changedLive = !!live && live !== v && confirmed !== v;\n const host = env.urlPrefix?.replace(/^https?:\\/\\//, \"\");\n const url = host ? `https://${host}${v}` : \"\";\n /* REQ-5-7 (prototype inspector.jsx:994-998, editor.css:416-432): where the slug IS the address and the host knows\n the site's address, the field is the prototype's URL input: the host grey before \"/slug\", the stored value\n slash-less, and a typed character the address cannot hold kept on screen with the error under the field (the\n stored slug changes only to a valid one). */\n const urlField = !!(env.slugIsAddress && host);\n const [typed, setTyped] = React.useState<string | null>(null);\n const shown = typed ?? v;\n const slugBad = typed !== null && !/^[a-z0-9-]*$/.test(typed);\n\n return (\n <div className=\"flex flex-col gap-1.5\">\n {urlField ? (\n <div className=\"flex flex-col gap-1.5\">\n <label\n className={cn(\n \"flex h-[34px] w-full cursor-text items-center rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] text-kit-insp-ink transition-[background-color,border-color] duration-[120ms] ease-out\",\n \"focus-within:border-kit-insp-accent focus-within:bg-kit-insp-card-focus\",\n (slugBad || invalid) && \"!border-kit-insp-error bg-kit-insp-card-focus\",\n )}\n >\n <span aria-hidden className=\"shrink-0 select-none whitespace-nowrap text-kit-insp-faint\">\n {host!.replace(/\\/+$/, \"\")}\n </span>\n <input\n id={id}\n value={`/${shown}`}\n readOnly={readOnly}\n aria-invalid={slugBad || invalid}\n spellCheck={false}\n placeholder=\"/page-slug\"\n onChange={(e) => {\n following.current = false;\n const next = e.target.value.replace(/^\\/+/, \"\");\n if (/^[a-z0-9-]*$/.test(next)) {\n setTyped(null);\n onChange(next);\n } else setTyped(next);\n }}\n onBlur={() => {\n if (typed === null) {\n const tidy = slugTidy(v);\n if (tidy !== v) onChange(tidy);\n }\n onBlur?.();\n }}\n className=\"min-w-0 flex-1 border-0 bg-transparent p-0 text-inherit outline-none placeholder:text-kit-fg-3\"\n />\n </label>\n {slugBad ? <p className=\"text-[12px] leading-4 text-kit-insp-error\">Use lowercase letters, numbers and hyphens</p> : null}\n </div>\n ) : (\n <Input\n id={id}\n value={v}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder=\"empty-is-the-home-page\"\n className={cn(TEXT_FOCUS, \"font-kit-mono [&_input]:font-kit-mono\")}\n onChange={(e) => {\n following.current = false;\n onChange(slugTyping(e.target.value));\n }}\n onBlur={() => {\n const tidy = slugTidy(v);\n if (tidy !== v) onChange(tidy);\n onBlur?.();\n }}\n />\n )}\n {changedLive ? (\n <div className=\"flex flex-col gap-2 rounded-kit-md border border-kit-warning-line bg-kit-warning-soft px-3 py-2.5 text-kit-sm\">\n <p className=\"flex items-start gap-1.5 text-kit-warning-fg\">\n <IconAlertTriangle className=\"mt-0.5 size-4 shrink-0\" stroke={1.5} />\n <span>\n The old address <span className=\"font-kit-mono\">/{live}</span> will stop working.\n </span>\n </p>\n {/* only where the host files the redirect: the box must not promise one nothing creates */}\n {redirectSlug ? (\n <label className=\"flex items-center gap-2 text-kit-fg-2\">\n <Checkbox checked={redirect} onCheckedChange={(c) => setRedirect(c === true)} nativeButton render={<button type=\"button\" />} />\n Redirect it to the new address\n </label>\n ) : null}\n <div className=\"flex gap-1.5\">\n <Button\n size=\"xs\"\n variant=\"primary\"\n disabled={saving}\n onClick={async () => {\n const from = live;\n const to = v;\n const redirected = redirect && !!redirectSlug;\n setSaving(true);\n try {\n if (saveSlug) await saveSlug(to);\n } catch (err) {\n setSaving(false);\n toast?.(\"Couldn't save the new address\", { description: errorText(err) });\n return;\n }\n setSaving(false);\n setConfirmed(to);\n if (redirected) {\n try {\n await redirectSlug(from, to);\n } catch (err) {\n toast?.(\"New address saved. The redirect wasn't created\", { description: errorText(err) });\n return;\n }\n }\n toast?.success(\"New address saved\", { description: redirected ? `/${from} now redirects to /${to}` : `/${from} will return “Not found”` });\n }}\n >\n Save new address\n </Button>\n <Button\n size=\"xs\"\n variant=\"ghost\"\n onClick={() => {\n following.current = false;\n onChange(live);\n }}\n >\n Keep the old slug\n </Button>\n </div>\n </div>\n ) : null}\n {address ? (\n address(v)\n ) : url && host ? (\n <AddressLine\n url={url}\n domain={host.replace(/\\/.*$/, \"\")}\n status={env.isPublished === undefined ? undefined : env.isPublished ? { live: true, label: \"Live\" } : { live: false, label: \"Not live yet\" }}\n onCopy={() => {\n void navigator.clipboard?.writeText(url).then(\n () => toast?.success(\"Address copied\", { description: url }),\n () => toast?.(\"Couldn't copy the address\", { description: \"The browser blocked clipboard access.\" }),\n );\n }}\n >\n {env.isPublished ? (\n <IconButton size=\"xs\" label=\"Open live\" onClick={() => window.open(url, \"_blank\", \"noopener\")}>\n <IconExternalLink stroke={1.5} />\n </IconButton>\n ) : null}\n </AddressLine>\n ) : null}\n </div>\n );\n}\n\n/** A host's refusal as one line (an Error's message, else the value itself). */\nconst errorText = (err: unknown) => (err instanceof Error ? err.message : String(err));\n\n/* V2 features/hosting/address-line.tsx (D66): one calm line under the slug — the mono URL (middle-truncated so the slug\n end stays; full URL in the tooltip; copies on click) · the live state as a dot and a word · trailing icon buttons. */\nfunction splitTail(display: string): [string, string] {\n const cut = display.indexOf(\"/\") >= 0 ? display.lastIndexOf(\"/\") : -1;\n let tail = cut > 0 ? display.slice(cut) : \"\";\n if (tail.length > 18) tail = tail.slice(-14);\n return [display.slice(0, display.length - tail.length), tail];\n}\n\nfunction AddressLine({ url, domain, status, onCopy, children }: { url: string; domain: string; status?: { live: boolean; label: string }; onCopy: () => void; children?: React.ReactNode }) {\n const display = url.replace(/^https?:\\/\\//, \"\");\n const [head, tail] = splitTail(display);\n const domainPart = head.startsWith(domain) ? domain : \"\";\n return (\n <div className=\"flex h-6 min-w-0 items-center gap-2\">\n <Tooltip content={<span className=\"font-kit-mono\">{display}</span>}>\n <button\n type=\"button\"\n onClick={onCopy}\n aria-label={`Copy address ${url}`}\n className=\"-ml-1 flex h-6 min-w-0 items-center rounded-kit-md px-1 font-kit-mono text-kit-xs text-kit-fg-2 transition-colors hover:bg-kit-hover hover:text-kit-fg\"\n >\n <span className=\"min-w-0 truncate\">\n {domainPart ? <span className=\"text-kit-fg-3\">{domainPart}</span> : null}\n {head.slice(domainPart.length)}\n </span>\n {tail ? <span className=\"shrink-0 whitespace-pre\">{tail}</span> : null}\n </button>\n </Tooltip>\n <span className=\"ml-auto flex shrink-0 items-center gap-1.5\">\n {status ? (\n <span className=\"mr-0.5 inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-kit-xs text-kit-fg-2\">\n <span aria-hidden className={cn(\"size-1.5 shrink-0 rounded-full\", status.live ? \"bg-kit-success\" : \"bg-kit-fg-4\")} />\n {status.label}\n </span>\n ) : null}\n {children ? <span className=\"flex items-center gap-0.5\">{children}</span> : null}\n </span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,OAAO,MAAgB,OAAO,MAAM,WAAW,IAAI,KAAK,OAAO,KAAK,OAAO,CAAC;;AAEzF,IAAa,aAAa;;;AAG1B,IAAa,mBACX;;;AAIF,SAAgB,cAAc,EAAE,OAAO,OAAO,UAAU,UAAU,IAAI,SAAS,UAAiD;CAC9H,MAAM,SAAS,MAAM,UAAU;CAC/B,MAAM,SAAS,4BAA4B,KAAK,MAAM;CACtD,OACE,qBAAC,SAAD;EACE,WAAW,GACT,mOACA,yGACA,WAAW,iDACX,YAAY,gBACd;EANF,UAAA,CAQE,oBAAC,QAAD;GAAM,eAAA;GAAY,WAAU;GACzB,UAAA;EACG,CAAA,GACN,oBAAC,SAAD;GACM;GACJ,OAAO,IAAI,KAAK;GACN;GACV,gBAAc;GACd,YAAY;GACZ,aAAa,MAAM;GACX;GACR,WAAW,MAAM;IACf,MAAM,IAAI,EAAE,OAAO,MAAM,QAAQ,UAAU,GAAG;IAC9C,SAAS,SAAS,EAAE,QAAQ,4BAA4B,EAAE,IAAI,CAAC;GACjE;GACA,WAAU;EACX,CAAA,CACI;;AAEX;AAEA,SAAgB,cAAc,EAAE,OAAO,OAAO,UAAU,UAAU,IAAI,SAAS,UAAwB;CACrG,MAAM,EAAE,YAAY,UAAU;CAC9B,MAAM,MAAM,WAAW,MAAM;CAC7B,IAAI,MAAM,QAAQ,OAAO,oBAAC,eAAD;EAAsB;EAAc;EAAiB;EAAoB;EAAc;EAAa;EAAiB;CAAS,CAAA;CACvJ,OAC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AAE;CAC9C,MAAM,CAAC,MAAM,QAAQ,UAAU,OAAO;CACtC,MAAM,aAAa,KAAK,WAAW,MAAM,IAAI,SAAS;CACtD,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,SAAD;GAAS,SAAS,oBAAC,QAAD;IAAM,WAAU;IAAiB,UAAA;GAAc,CAAA;GAC/D,UAAA,qBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,cAAY,gBAAgB;IAC5B,WAAU;IAJZ,UAAA,CAME,qBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA,CACG,aAAa,oBAAC,QAAD;MAAM,WAAU;MAAiB,UAAA;KAAiB,CAAA,IAAI,MACnE,KAAK,MAAM,WAAW,MAAM,CACzB;IACL,CAAA,GAAA,OAAO,oBAAC,QAAD;KAAM,WAAU;KAA2B,UAAA;IAAW,CAAA,IAAI,IAC5D;;EACD,CAAA,GACT,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACG,SACC,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,QAAD;KAAM,eAAA;KAAY,WAAW,GAAG,kCAAkC,OAAO,OAAO,mBAAmB,aAAa;IAAI,CAAA,GACnH,OAAO,KACJ;GACJ,CAAA,IAAA,MACH,WAAW,oBAAC,QAAD;IAAM,WAAU;IAA6B;GAAe,CAAA,IAAI,IACxE;EACH,CAAA,CAAA;;AAET"}
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../src/controls/text.tsx"],"sourcesContent":["/**\n * TEXT — string · text · email · url · slug (V2 HEAD 9829bf1 kit/controls/text.tsx, DESIGN §8.2–8.3).\n * Founder rule: text grows to show its whole value, never clipped. Text entry gets NO focus ring or halo — the border\n * steps rest → hover → focus on the box only (prod CPO-069).\n *\n * Stored shapes (prod): string / longtext / email / slug / url (text + inputType \"url\") all store a plain string.\n * Slug keeps the backend's `^[a-z0-9]+(?:-[a-z0-9]+)*$`: keystrokes are filtered, and the stray hyphens typing leaves\n * (a trailing \"-\" before the next word) are tidied on blur.\n */\nimport * as React from \"react\";\nimport { IconAlertTriangle, IconExternalLink, IconMail, IconWorld } from \"@tabler/icons-react\";\nimport { cn } from \"../lib/cn\";\nimport { slugify } from \"../lib/utils\";\nimport { plainText } from \"../lib/schema\";\nimport { KitAddressContext, useForm, useKitEnv, useKitLook, useKitServices } from \"../context\";\nimport { Button, IconButton } from \"../ui/button\";\nimport { Input, Textarea } from \"../ui/input\";\nimport { Tooltip } from \"../ui/overlay\";\nimport { Checkbox } from \"../ui/controls\";\nimport type { ControlProps } from \"../types\";\n\nexport const str = (v: unknown) => (typeof v === \"string\" ? v : v == null ? \"\" : String(v));\n/** border-only focus (no halo) for text entry */\nexport const TEXT_FOCUS = \"focus:shadow-none focus-visible:shadow-none\";\n/** look \"v16\" text entry (F1342, prototype inspector.jsx:94, editor.css:416-418): #F5F5F5, radius 6, no edge at rest,\n * 13/18 -0.1625px #171717, placeholder #707070; hover #E9E9E9; focus #FAFAFA with the violet edge; red edge invalid */\nexport const V16_TEXT_SURFACE =\n \"rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] tracking-[-0.1625px] text-kit-insp-tip-title shadow-none placeholder:text-kit-group-sub transition-[background-color,border-color] duration-[120ms] ease-out hover:border-transparent hover:bg-kit-insp-field-hover focus:border-kit-insp-accent focus:bg-kit-insp-card-focus aria-[invalid=true]:border-kit-insp-error\";\n\n/** `FieldSchema.prefix` (F1344, F1215, F1217): the prototype `.inp-url`, 34 high, grey fill, the prefix 13/18 #A3A3A3\n * right before the value; violet edge while focused, red when invalid. A scheme prefix drops a typed scheme. */\nexport function PrefixedInput({ field, value, onChange, readOnly, id, invalid, onBlur }: Omit<ControlProps, \"path\" | \"parent\">) {\n const prefix = field.prefix ?? \"\";\n const scheme = /^[a-z][a-z0-9+.-]*:\\/\\/$/i.test(prefix);\n return (\n <label\n className={cn(\n \"flex h-[34px] w-full cursor-text items-center rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] text-kit-insp-ink transition-[background-color,border-color] duration-[120ms] ease-out\",\n \"hover:bg-kit-insp-field-hover focus-within:border-kit-insp-accent focus-within:bg-kit-insp-card-focus\",\n invalid && \"!border-kit-insp-error bg-kit-insp-card-focus\",\n readOnly && \"cursor-default\",\n )}\n >\n <span aria-hidden className=\"shrink-0 select-none whitespace-nowrap text-kit-insp-faint\">\n {prefix}\n </span>\n <input\n id={id}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n spellCheck={false}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onChange={(e) => {\n const v = e.target.value.replace(/\\r?\\n/g, \" \");\n onChange(scheme ? v.replace(/^[a-z][a-z0-9+.-]*:\\/\\//i, \"\") : v);\n }}\n className=\"min-w-0 flex-1 border-0 bg-transparent p-0 text-inherit outline-none placeholder:text-kit-fg-3\"\n />\n </label>\n );\n}\n\nexport function StringControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n const v16 = useKitLook() === \"v16\";\n if (field.prefix) return <PrefixedInput field={field} value={value} onChange={onChange} readOnly={readOnly} id={id} invalid={invalid} onBlur={onBlur} />;\n return (\n <Textarea\n id={id}\n rows={1}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onKeyDown={(e) => e.key === \"Enter\" && e.preventDefault()}\n onChange={(e) => onChange(e.target.value.replace(/\\r?\\n/g, \" \"))}\n className={cn(TEXT_FOCUS, \"min-h-8 py-1.5 leading-5\", variant === \"document\" && \"min-h-9 py-2\", v16 && cn(V16_TEXT_SURFACE, \"min-h-[34px] py-[7px]\"))}\n />\n );\n}\n\nexport function TextControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n // look v16 (F1343): 3 rows (72) at least, grows to 8 (162), scrolls after. The autosize snaps (height is never\n // transitioned: a layout animation per keystroke); only the fill and the edge ease.\n const v16 = useKitLook() === \"v16\";\n return (\n <Textarea\n id={id}\n rows={field.rows ?? 3}\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n placeholder={field.placeholder}\n onBlur={onBlur}\n onChange={(e) => onChange(e.target.value)}\n className={cn(TEXT_FOCUS, \"leading-5\", v16 && cn(V16_TEXT_SURFACE, \"max-h-[162px] min-h-[72px] overflow-y-auto py-2 transition-[background-color,border-color] duration-[160ms]\"))}\n />\n );\n}\n\nexport function EmailControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const { variant } = useKitEnv();\n return (\n <Input\n id={id}\n size={variant === \"document\" ? \"lg\" : \"md\"}\n type=\"email\"\n value={str(value)}\n readOnly={readOnly}\n aria-invalid={invalid}\n onBlur={onBlur}\n placeholder={field.placeholder ?? \"name@company.com\"}\n leading={<IconMail stroke={1.5} />}\n onChange={(e) => onChange(e.target.value.trim())}\n className={TEXT_FOCUS}\n />\n );\n}\n\nexport function UrlControl({ field, value, onChange, readOnly, id, invalid, onBlur }: ControlProps) {\n const v = str(value);\n const { variant } = useKitEnv();\n if (field.prefix) return <PrefixedInput field={field} value={value} onChange={onChange} readOnly={readOnly} id={id} invalid={invalid} onBlur={onBlur} />;\n const open = /^https?:\\/\\/\\S+/.test(v);\n return (\n <Input\n id={id}\n size={variant === \"document\" ? \"lg\" : \"md\"}\n value={v}\n readOnly={readOnly}\n aria-invalid={invalid}\n onBlur={onBlur}\n placeholder={field.placeholder ?? \"https://example.com\"}\n onChange={(e) => onChange(e.target.value.trim())}\n leading={<IconWorld stroke={1.5} />}\n className={cn(TEXT_FOCUS, \"[&_input]:text-kit-accent-fg\")}\n trailing={\n open ? (\n <Tooltip content=\"Open link in a new tab\">\n <button\n type=\"button\"\n aria-label=\"Open link\"\n className=\"pointer-events-auto flex rounded-kit-md p-0.5 hover:bg-kit-selected hover:text-kit-fg\"\n onClick={() => window.open(v, \"_blank\", \"noopener\")}\n >\n <IconExternalLink className=\"size-4\" stroke={1.5} />\n </button>\n </Tooltip>\n ) : undefined\n }\n />\n );\n}\n\n/* ── Slug ──────────────────────────────────────────────────────────── */\nconst TITLE_KEYS = [\"title\", \"name\", \"heading\", \"question\", \"label\"];\n/** The text a slug follows: the first title-like sibling, else the document title. */\nexport function slugSource(parent: Record<string, unknown> | undefined, docTitle?: string) {\n for (const k of TITLE_KEYS) {\n const t = plainText(parent?.[k]);\n if (t) return t;\n }\n return docTitle ?? \"\";\n}\n/** What a keystroke may leave in a slug: lowercase letters, digits and hyphens (spaces become hyphens). */\nexport const slugTyping = (s: string) => s.toLowerCase().replace(/\\s+/g, \"-\").replace(/[^a-z0-9-]/g, \"\");\n/** The stored slug: no leading, trailing or doubled hyphens (the backend's pattern). */\nexport const slugTidy = (s: string) => slugTyping(s).replace(/-+/g, \"-\").replace(/^-|-$/g, \"\");\n\n/** Label-row \"Generate\" for slug fields (ACTIONS.slug; prod: ghost button in the label row). */\nexport function SlugGenerate({ parent, value, onChange, readOnly }: Pick<ControlProps, \"parent\" | \"value\" | \"onChange\" | \"readOnly\">) {\n const { docTitle } = useKitEnv();\n const src = slugSource(parent, docTitle);\n if (readOnly || !src) return null;\n const next = slugify(src);\n if (!next) return null;\n return (\n <Tooltip content={`Generate from “${src.length > 32 ? `${src.slice(0, 30)}…` : src}”`}>\n <Button size=\"xs\" variant=\"ghost\" className=\"h-5 px-1.5 text-kit-xs text-kit-fg-2\" disabled={next === value} onClick={() => onChange(next)}>\n Generate\n </Button>\n </Tooltip>\n );\n}\n\nexport function SlugControl({ field, value, onChange, readOnly, id, invalid, parent, path, onBlur }: ControlProps) {\n const v = str(value);\n const env = useKitEnv();\n const form = useForm();\n const { toast, redirectSlug, saveSlug } = useKitServices();\n const address = React.useContext(KitAddressContext);\n const src = slugSource(parent, env.docTitle);\n /* Follows the title until someone edits it or the document is published (CPO-087), V2's rule (`!env.isPublished`):\n a host that passes no isPublished (the dock) follows too, as the help line says. It reacts to a title edit, never\n to mounting, so opening a form writes nothing. */\n const following = React.useRef(!env.isPublished && (v === \"\" || v === slugify(src)));\n const seenSrc = React.useRef(src);\n React.useEffect(() => {\n if (seenSrc.current === src) return;\n seenSrc.current = src;\n if (!following.current || readOnly) return;\n const next = slugify(src);\n if (next && next !== v) onChange(next);\n }, [src]); // eslint-disable-line react-hooks/exhaustive-deps\n\n /* the address the site serves today: the published value, else (published doc, no published copy) the mount value.\n Only where the host says the slug IS the address: a slug prop or a key has no address to break. */\n const live = !env.slugIsAddress ? \"\" : form?.hasPublished ? str(form.publishedAt(path)) : env.isPublished ? str(form?.baselineAt(path) ?? \"\") : \"\";\n const [saving, setSaving] = React.useState(false);\n const [redirect, setRedirect] = React.useState(true);\n const [confirmed, setConfirmed] = React.useState<string | null>(null);\n const changedLive = !!live && live !== v && confirmed !== v;\n const host = env.urlPrefix?.replace(/^https?:\\/\\//, \"\");\n const url = host ? `https://${host}${v}` : \"\";\n /* REQ-5-7 (prototype inspector.jsx:994-998, editor.css:416-432): where the slug IS the address and the host knows\n the site's address, the field is the prototype's URL input: the host grey before \"/slug\", the stored value\n slash-less, and a typed character the address cannot hold kept on screen with the error under the field (the\n stored slug changes only to a valid one). */\n /* r7 #10: the model's `ui.prefix` (\"blog/\") is the grey text before the value, after the site's host when known */\n const prefix = (field.prefix ?? \"\").replace(/^\\/+/, \"\");\n const urlField = !!((env.slugIsAddress && host) || prefix);\n const greyText = host ? `${host.replace(/\\/+$/, \"\")}/${prefix}` : prefix;\n const lead = prefix ? \"\" : \"/\";\n const [typed, setTyped] = React.useState<string | null>(null);\n const shown = typed ?? v;\n const slugBad = typed !== null && !/^[a-z0-9-]*$/.test(typed);\n\n return (\n <div className=\"flex flex-col gap-1.5\">\n {urlField ? (\n <div className=\"flex flex-col gap-1.5\">\n <label\n className={cn(\n \"flex h-[34px] w-full cursor-text items-center rounded-[6px] border border-transparent bg-kit-insp-card px-2.5 text-[13px] leading-[18px] text-kit-insp-ink transition-[background-color,border-color] duration-[120ms] ease-out\",\n \"focus-within:border-kit-insp-accent focus-within:bg-kit-insp-card-focus\",\n (slugBad || invalid) && \"!border-kit-insp-error bg-kit-insp-card-focus\",\n )}\n >\n <span aria-hidden className=\"shrink-0 select-none whitespace-nowrap text-kit-insp-faint\">\n {prefix ? greyText : host!.replace(/\\/+$/, \"\")}\n </span>\n <input\n id={id}\n value={`${lead}${shown}`}\n readOnly={readOnly}\n aria-invalid={slugBad || invalid}\n spellCheck={false}\n placeholder={field.placeholder ?? `${lead}page-slug`}\n onChange={(e) => {\n following.current = false;\n const next = e.target.value.replace(/^\\/+/, \"\");\n if (/^[a-z0-9-]*$/.test(next)) {\n setTyped(null);\n onChange(next);\n } else setTyped(next);\n }}\n onBlur={() => {\n if (typed === null) {\n const tidy = slugTidy(v);\n if (tidy !== v) onChange(tidy);\n }\n onBlur?.();\n }}\n className=\"min-w-0 flex-1 border-0 bg-transparent p-0 text-inherit outline-none placeholder:text-kit-fg-3\"\n />\n </label>\n {slugBad ? <p className=\"text-[12px] leading-4 text-kit-insp-error\">Use lowercase letters, numbers and hyphens</p> : null}\n </div>\n ) : (\n <Input\n id={id}\n value={v}\n readOnly={readOnly}\n aria-invalid={invalid}\n // r7 #10: no home-page hint here: an entry's slug is never the home page (a host passes its own placeholder)\n placeholder={field.placeholder ?? \"page-slug\"}\n className={cn(TEXT_FOCUS, \"font-kit-mono [&_input]:font-kit-mono\")}\n onChange={(e) => {\n following.current = false;\n onChange(slugTyping(e.target.value));\n }}\n onBlur={() => {\n const tidy = slugTidy(v);\n if (tidy !== v) onChange(tidy);\n onBlur?.();\n }}\n />\n )}\n {changedLive ? (\n <div className=\"flex flex-col gap-2 rounded-kit-md border border-kit-warning-line bg-kit-warning-soft px-3 py-2.5 text-kit-sm\">\n <p className=\"flex items-start gap-1.5 text-kit-warning-fg\">\n <IconAlertTriangle className=\"mt-0.5 size-4 shrink-0\" stroke={1.5} />\n <span>\n The old address <span className=\"font-kit-mono\">/{live}</span> will stop working.\n </span>\n </p>\n {/* only where the host files the redirect: the box must not promise one nothing creates */}\n {redirectSlug ? (\n <label className=\"flex items-center gap-2 text-kit-fg-2\">\n <Checkbox checked={redirect} onCheckedChange={(c) => setRedirect(c === true)} nativeButton render={<button type=\"button\" />} />\n Redirect it to the new address\n </label>\n ) : null}\n <div className=\"flex gap-1.5\">\n <Button\n size=\"xs\"\n variant=\"primary\"\n disabled={saving}\n onClick={async () => {\n const from = live;\n const to = v;\n const redirected = redirect && !!redirectSlug;\n setSaving(true);\n try {\n if (saveSlug) await saveSlug(to);\n } catch (err) {\n setSaving(false);\n toast?.(\"Couldn't save the new address\", { description: errorText(err) });\n return;\n }\n setSaving(false);\n setConfirmed(to);\n if (redirected) {\n try {\n await redirectSlug(from, to);\n } catch (err) {\n toast?.(\"New address saved. The redirect wasn't created\", { description: errorText(err) });\n return;\n }\n }\n toast?.success(\"New address saved\", { description: redirected ? `/${from} now redirects to /${to}` : `/${from} will return “Not found”` });\n }}\n >\n Save new address\n </Button>\n <Button\n size=\"xs\"\n variant=\"ghost\"\n onClick={() => {\n following.current = false;\n onChange(live);\n }}\n >\n Keep the old slug\n </Button>\n </div>\n </div>\n ) : null}\n {address ? (\n address(v)\n ) : url && host ? (\n <AddressLine\n url={url}\n domain={host.replace(/\\/.*$/, \"\")}\n status={env.isPublished === undefined ? undefined : env.isPublished ? { live: true, label: \"Live\" } : { live: false, label: \"Not live yet\" }}\n onCopy={() => {\n void navigator.clipboard?.writeText(url).then(\n () => toast?.success(\"Address copied\", { description: url }),\n () => toast?.(\"Couldn't copy the address\", { description: \"The browser blocked clipboard access.\" }),\n );\n }}\n >\n {env.isPublished ? (\n <IconButton size=\"xs\" label=\"Open live\" onClick={() => window.open(url, \"_blank\", \"noopener\")}>\n <IconExternalLink stroke={1.5} />\n </IconButton>\n ) : null}\n </AddressLine>\n ) : null}\n </div>\n );\n}\n\n/** A host's refusal as one line (an Error's message, else the value itself). */\nconst errorText = (err: unknown) => (err instanceof Error ? err.message : String(err));\n\n/* V2 features/hosting/address-line.tsx (D66): one calm line under the slug — the mono URL (middle-truncated so the slug\n end stays; full URL in the tooltip; copies on click) · the live state as a dot and a word · trailing icon buttons. */\nfunction splitTail(display: string): [string, string] {\n const cut = display.indexOf(\"/\") >= 0 ? display.lastIndexOf(\"/\") : -1;\n let tail = cut > 0 ? display.slice(cut) : \"\";\n if (tail.length > 18) tail = tail.slice(-14);\n return [display.slice(0, display.length - tail.length), tail];\n}\n\nfunction AddressLine({ url, domain, status, onCopy, children }: { url: string; domain: string; status?: { live: boolean; label: string }; onCopy: () => void; children?: React.ReactNode }) {\n const display = url.replace(/^https?:\\/\\//, \"\");\n const [head, tail] = splitTail(display);\n const domainPart = head.startsWith(domain) ? domain : \"\";\n return (\n <div className=\"flex h-6 min-w-0 items-center gap-2\">\n <Tooltip content={<span className=\"font-kit-mono\">{display}</span>}>\n <button\n type=\"button\"\n onClick={onCopy}\n aria-label={`Copy address ${url}`}\n className=\"-ml-1 flex h-6 min-w-0 items-center rounded-kit-md px-1 font-kit-mono text-kit-xs text-kit-fg-2 transition-colors hover:bg-kit-hover hover:text-kit-fg\"\n >\n <span className=\"min-w-0 truncate\">\n {domainPart ? <span className=\"text-kit-fg-3\">{domainPart}</span> : null}\n {head.slice(domainPart.length)}\n </span>\n {tail ? <span className=\"shrink-0 whitespace-pre\">{tail}</span> : null}\n </button>\n </Tooltip>\n <span className=\"ml-auto flex shrink-0 items-center gap-1.5\">\n {status ? (\n <span className=\"mr-0.5 inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap text-kit-xs text-kit-fg-2\">\n <span aria-hidden className={cn(\"size-1.5 shrink-0 rounded-full\", status.live ? \"bg-kit-success\" : \"bg-kit-fg-4\")} />\n {status.label}\n </span>\n ) : null}\n {children ? <span className=\"flex items-center gap-0.5\">{children}</span> : null}\n </span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,OAAO,MAAgB,OAAO,MAAM,WAAW,IAAI,KAAK,OAAO,KAAK,OAAO,CAAC;;AAEz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AC,SAAD;GAAS,SAAS,oBAAC,QAAD;IAAM,WAAU;IAAiB,UAAA;GAAc,CAAA;GAC/D,UAAA,qBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,cAAY,gBAAgB;IAC5B,WAAU;IAJZ,UAAA,CAME,qBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA,CACG,aAAa,oBAAC,QAAD;MAAM,WAAU;MAAiB,UAAA;KAAiB,CAAA,IAAI,MACnE,KAAK,MAAM,WAAW,MAAM,CACzB;IACL,CAAA,GAAA,OAAO,oBAAC,QAAD;KAAM,WAAU;KAA2B,UAAA;IAAW,CAAA,IAAI,IAC5D;;EACD,CAAA,GACT,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACG,SACC,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,QAAD;KAAM,eAAA;KAAY,WAAW,GAAG,kCAAkC,OAAO,OAAO,mBAAmB,aAAa;IAAI,CAAA,GACnH,OAAO,KACJ;GACJ,CAAA,IAAA,MACH,WAAW,oBAAC,QAAD;IAAM,WAAU;IAA6B;GAAe,CAAA,IAAI,IACxE;EACH,CAAA,CAAA;;AAET"}
|
|
@@ -5,7 +5,7 @@ import { AI_PRESETS, FieldHeaderSlot, KitSectionTitle, seesDevSurfaces, useForm,
|
|
|
5
5
|
import { Button, Sparkle } from "../ui/button.js";
|
|
6
6
|
import { InfoTooltip } from "../ui/tooltip-card.js";
|
|
7
7
|
import { Menu, MenuContent, MenuItem, MenuSeparator, MenuTrigger, Popover, PopoverAnchor, PopoverContent, Tooltip } from "../ui/overlay.js";
|
|
8
|
-
import { FieldCounter, FieldSweep, FocusDot, counterState, overLimitText } from "../ui/inspector.js";
|
|
8
|
+
import { FieldCounter, FieldSweep, FocusDot, counterState, overLimitText, useOverLimit } from "../ui/inspector.js";
|
|
9
9
|
import { RowChrome } from "./bits.js";
|
|
10
10
|
import { Avatar, avatarRingSpread } from "../ui/display.js";
|
|
11
11
|
import { presenceColor } from "../ui/presence.js";
|
|
@@ -156,9 +156,12 @@ function FieldShell({ field, path, id, value, onChange, readOnly, issue, action,
|
|
|
156
156
|
const limit = field.validation?.max ?? field.validation?.recommendedMax;
|
|
157
157
|
const len = textLength(value);
|
|
158
158
|
const near = !!limit && len >= limit * .8;
|
|
159
|
-
const
|
|
159
|
+
const counted = !!limit && (field.type === "string" || field.type === "text" || field.type === "richtext");
|
|
160
|
+
const overLimit = useOverLimit(v16 && counted && counterState(len, limit) === "over");
|
|
161
|
+
const counter = counted ? v16 ? counterState(len, limit) === "ok" ? null : /* @__PURE__ */ jsx(FieldCounter, {
|
|
160
162
|
value: len,
|
|
161
|
-
max: limit
|
|
163
|
+
max: limit,
|
|
164
|
+
size: env.counterSize ?? 11
|
|
162
165
|
}) : /* @__PURE__ */ jsxs("span", {
|
|
163
166
|
"data-slot": "field-counter",
|
|
164
167
|
className: cn("tabular-nums text-kit-xs", !near && "hidden group-focus-within/field:inline", field.validation?.max && len > field.validation.max ? "text-kit-danger-fg" : field.validation?.recommendedMax && len > field.validation.recommendedMax ? "text-kit-warning-fg" : "text-kit-fg-3"),
|
|
@@ -363,7 +366,8 @@ function FieldShell({ field, path, id, value, onChange, readOnly, issue, action,
|
|
|
363
366
|
})
|
|
364
367
|
] });
|
|
365
368
|
const control = /* @__PURE__ */ jsx("div", {
|
|
366
|
-
className: cn("relative", editor && "[&_.border-kit-field-border]:border-[var(--peer)]"),
|
|
369
|
+
className: cn("relative", editor && "[&_.border-kit-field-border]:border-[var(--peer)]", overLimit.className),
|
|
370
|
+
onAnimationEnd: overLimit.onAnimationEnd,
|
|
367
371
|
style: editor ? { "--peer": editor.color ?? presenceColor(editor.id ?? editor.name) } : void 0,
|
|
368
372
|
children
|
|
369
373
|
});
|