@mieweb/ui 0.11.0-dev.46 → 0.11.0-dev.48
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/agent/evals/install.md +6 -4
- package/agent/skills/mieweb-ui-tailwind4/SKILL.md +6 -2
- package/dist/{EncounterMdyEditor-XA7HLLVD.cjs → EncounterMdyEditor-KW52MD2Q.cjs} +6 -6
- package/dist/{EncounterMdyEditor-XA7HLLVD.cjs.map → EncounterMdyEditor-KW52MD2Q.cjs.map} +1 -1
- package/dist/{EncounterMdyEditor-ATNWXQ72.js → EncounterMdyEditor-OYO3H5GJ.js} +3 -3
- package/dist/{EncounterMdyEditor-ATNWXQ72.js.map → EncounterMdyEditor-OYO3H5GJ.js.map} +1 -1
- package/dist/{chunk-F6ZTKNAL.cjs → chunk-3XR7BPKD.cjs} +4 -4
- package/dist/{chunk-F6ZTKNAL.cjs.map → chunk-3XR7BPKD.cjs.map} +1 -1
- package/dist/{chunk-ULKDK6W6.js → chunk-3XVDSLDT.js} +4 -4
- package/dist/chunk-3XVDSLDT.js.map +1 -0
- package/dist/{chunk-WI35L5TR.js → chunk-DHCSY2JY.js} +3 -3
- package/dist/{chunk-WI35L5TR.js.map → chunk-DHCSY2JY.js.map} +1 -1
- package/dist/{chunk-IYXZ25E6.js → chunk-ETAYMSCW.js} +4 -4
- package/dist/{chunk-IYXZ25E6.js.map → chunk-ETAYMSCW.js.map} +1 -1
- package/dist/{chunk-LE3HZ7MM.cjs → chunk-LVUSCBG4.cjs} +11 -11
- package/dist/{chunk-LE3HZ7MM.cjs.map → chunk-LVUSCBG4.cjs.map} +1 -1
- package/dist/{chunk-BUM72SAI.cjs → chunk-LWAXTZGG.cjs} +7 -7
- package/dist/{chunk-BUM72SAI.cjs.map → chunk-LWAXTZGG.cjs.map} +1 -1
- package/dist/{chunk-QJ75ZMCG.js → chunk-R4DQRXZY.js} +3 -3
- package/dist/{chunk-QJ75ZMCG.js.map → chunk-R4DQRXZY.js.map} +1 -1
- package/dist/{chunk-5O54NWAL.cjs → chunk-TA5K5546.cjs} +4 -4
- package/dist/chunk-TA5K5546.cjs.map +1 -0
- package/dist/{chunk-2D6TFO2Y.js → chunk-XJ37SWVD.js} +3 -3
- package/dist/{chunk-2D6TFO2Y.js.map → chunk-XJ37SWVD.js.map} +1 -1
- package/dist/{chunk-6I2G26AX.cjs → chunk-YKL66TCM.cjs} +4 -4
- package/dist/{chunk-6I2G26AX.cjs.map → chunk-YKL66TCM.cjs.map} +1 -1
- package/dist/collabKit-652AGQW6.js +99 -0
- package/dist/collabKit-652AGQW6.js.map +1 -0
- package/dist/collabKit-DVSTUBN4.cjs +102 -0
- package/dist/collabKit-DVSTUBN4.cjs.map +1 -0
- package/dist/components/EmailEditor/index.cjs +13 -13
- package/dist/components/EmailEditor/index.js +4 -4
- package/dist/components/Textarea/index.cjs +6 -6
- package/dist/components/Textarea/index.js +3 -3
- package/dist/esheet.cjs +18 -18
- package/dist/esheet.js +5 -5
- package/dist/index.cjs +53 -53
- package/dist/index.js +7 -7
- package/dist/kerebron.cjs +5 -5
- package/dist/kerebron.js +2 -2
- package/dist/styles/init.css +8 -4
- package/package.json +1 -1
- package/dist/chunk-5O54NWAL.cjs.map +0 -1
- package/dist/chunk-ULKDK6W6.js.map +0 -1
- package/dist/collabKit-GCRHP25F.cjs +0 -76
- package/dist/collabKit-GCRHP25F.cjs.map +0 -1
- package/dist/collabKit-SJPDPXU4.js +0 -52
- package/dist/collabKit-SJPDPXU4.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TextAreaPlain/TextAreaPlain.tsx","../src/components/Textarea/Textarea.tsx"],"names":["cva","React","jsx","RequiredMark","cn","jsxs","React2","TextAreaRichKerebron"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,gBAAA,GAAmBA,0BAAA;AAAA,EACvB;AAAA,IACE,kBAAA;AAAA,IACA,gCAAA;AAAA,I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AAC,SAAA,oBACdA,cAAAA;AAAA,gBAAC,GAAA;AAAA,gBAAA;AAAA,kBACC,EAAA,EAAI,QAAA;AAAA,kBACJ,WAAA,EAAU,iBAAA;AAAA,kBACV,SAAA,EAAU,+BAAA;AAAA,kBAET,QAAA,EAAA;AAAA;AAAA;AACH,aAAA,EAEJ,CAAA;AAAA,YACC,6BACCG,eAAAA;AAAA,cAAC,GAAA;AAAA,cAAA;AAAA,gBACC,EAAA,EAAI,OAAA;AAAA,gBACJ,WAAA,EAAU,gBAAA;AAAA,gBACV,SAAA,EAAWD,oBAAA;AAAA,kBACT,wCAAA;AAAA,kBACA,SAAA,IAAa,kBAAkB,SAAA,IAAa;AAAA,iBAC9C;AAAA,gBAEC,QAAA,EAAA;AAAA,kBAAA,cAAA;AAAA,kBACA,SAAA,IAAa,IAAI,SAAS,CAAA;AAAA;AAAA;AAAA;AAC7B;AAAA;AAAA;AAEJ,KAAA,EACF,CAAA;AAAA,EAEJ;AACF,CAAA;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;AAkB3B,IAAM,QAAA,GAAiBE,iBAAA,CAAA,UAAA;AAAA,EACrB,CAAC,EAAE,QAAA,GAAW,IAAA,EAAM,GAAG,KAAA,EAAM,EAAG,QAC9B,QAAA,mBACEJ,eAAC,YAAA,EAAA,EAAa,GAAA,EAAW,GAAG,KAAA,EAAO,CAAA,mBAEnCA,cAAAA,CAAC,aAAA,EAAA,EAAc,GAAA,EAAW,GAAG,KAAA,EAAO;AAE1C;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"chunk-F6ZTKNAL.cjs","sourcesContent":["import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { RequiredMark, type RequiredMarkVariant } from '../Input';\n\nconst textareaVariants = cva(\n [\n 'w-full px-3 py-2',\n 'border border-input rounded-lg',\n 'bg-background text-foreground',\n 'placeholder:text-muted-foreground',\n 'transition-colors duration-200',\n 'focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'resize-y',\n ],\n {\n variants: {\n size: {\n sm: 'text-sm min-h-[60px]',\n md: 'text-base min-h-[80px]',\n lg: 'text-lg min-h-[100px]',\n },\n hasError: {\n true: 'border-destructive focus:ring-destructive',\n false: '',\n },\n resize: {\n none: 'resize-none',\n vertical: 'resize-y',\n horizontal: 'resize-x',\n both: 'resize',\n },\n labelVariant: {\n stacked: '',\n floating: 'peer placeholder:text-transparent',\n },\n autoResize: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n // Floating labels reserve top padding so entered text always starts\n // below the floated label, plus a little extra min-height.\n {\n labelVariant: 'floating',\n size: 'sm',\n className: 'pt-5 min-h-[76px]',\n },\n {\n labelVariant: 'floating',\n size: 'md',\n className: 'pt-6 min-h-[96px]',\n },\n {\n labelVariant: 'floating',\n size: 'lg',\n className: 'pt-7 min-h-[120px]',\n },\n // Auto-growing textareas start at the same visual height as a\n // single-line Input (h-8/h-10/h-12): min-height matches the Input\n // size token and the vertical padding is tuned so one line of text\n // plus padding plus borders lands exactly on that height.\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'sm',\n className: 'min-h-8 py-[5px]',\n },\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'md',\n className: 'min-h-10 py-[7px]',\n },\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'lg',\n className: 'min-h-12 py-[9px]',\n },\n // Floating label + auto-grow: single line below the floated label.\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'sm',\n className: 'min-h-[50px]',\n },\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'md',\n className: 'min-h-[58px]',\n },\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'lg',\n className: 'min-h-[66px]',\n },\n ],\n defaultVariants: {\n size: 'md',\n hasError: false,\n resize: 'vertical',\n labelVariant: 'stacked',\n autoResize: true,\n },\n }\n);\n\nconst floatingLabelVariants = cva(\n [\n 'absolute start-3 pointer-events-none select-none',\n 'transition-all duration-200 ease-out',\n ],\n {\n variants: {\n size: {\n sm: [\n 'text-sm top-3',\n 'peer-focus:top-1 peer-[:not(:placeholder-shown)]:top-1 peer-autofill:top-1',\n 'peer-focus:text-[0.65rem] peer-[:not(:placeholder-shown)]:text-[0.65rem] peer-autofill:text-[0.65rem]',\n ],\n md: [\n 'text-base top-4',\n 'peer-focus:top-1.5 peer-[:not(:placeholder-shown)]:top-1.5 peer-autofill:top-1.5',\n 'peer-focus:text-xs peer-[:not(:placeholder-shown)]:text-xs peer-autofill:text-xs',\n ],\n lg: [\n 'text-lg top-5',\n 'peer-focus:top-2 peer-[:not(:placeholder-shown)]:top-2 peer-autofill:top-2',\n 'peer-focus:text-sm peer-[:not(:placeholder-shown)]:text-sm peer-autofill:text-sm',\n ],\n },\n hasError: {\n true: 'text-destructive',\n false: 'text-muted-foreground',\n },\n },\n defaultVariants: {\n size: 'md',\n hasError: false,\n },\n }\n);\n\nexport interface TextAreaPlainProps\n extends\n Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>,\n Omit<VariantProps<typeof textareaVariants>, 'labelVariant'> {\n /** Label for the textarea */\n label?: string;\n /**\n * How the label is rendered.\n * - `stacked` (default): label above the textarea.\n * - `floating`: label rests inside the textarea like a placeholder and\n * floats to the top (staying inside it) when focused or filled.\n * Ignores `placeholder`; when `hideLabel` is set, falls back to a\n * visually-hidden stacked label.\n */\n labelVariant?: 'stacked' | 'floating';\n /** Whether the label should be visually hidden */\n hideLabel?: boolean;\n /** Error message to display */\n error?: string;\n /** Helper text to display */\n helperText?: string;\n /** Maximum character count */\n maxLength?: number;\n /** Show character count */\n showCount?: boolean;\n /**\n * Grow and shrink with content (default). The empty control matches a\n * single-line `Input`'s height; `rows` sets a taller growth floor, and\n * dragging the native resize handle sets a new floor the same way. Set\n * `false` for a classic fixed-height textarea.\n */\n autoResize?: boolean;\n /**\n * Color of the required asterisk.\n * - `default`: destructive (hard requirement).\n * - `warning`: warning color (soft requirement / recommended).\n */\n requiredVariant?: RequiredMarkVariant;\n}\n\n/**\n * A multi-line text input component with character count and auto-resize.\n *\n * @example\n * ```tsx\n * <TextAreaPlain label=\"Description\" placeholder=\"Enter a description...\" />\n * <TextAreaPlain\n * label=\"Bio\"\n * maxLength={280}\n * showCount\n * helperText=\"Tell us about yourself\"\n * />\n * ```\n */\nconst TextAreaPlain = React.forwardRef<HTMLTextAreaElement, TextAreaPlainProps>(\n (\n {\n className,\n size,\n hasError,\n resize,\n label,\n labelVariant = 'stacked',\n hideLabel,\n error,\n helperText,\n maxLength,\n showCount = false,\n autoResize = true,\n required = false,\n requiredVariant,\n id,\n rows,\n value,\n defaultValue,\n onChange,\n placeholder,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref\n ) => {\n const internalRef = React.useRef<HTMLTextAreaElement>(null);\n const [internalValue, setInternalValue] = React.useState(\n (defaultValue as string) || ''\n );\n\n const generatedId = React.useId();\n const textareaId = id || generatedId;\n const errorId = `${textareaId}-error`;\n const helperId = `${textareaId}-helper`;\n const countId = `${textareaId}-count`;\n\n // Combine refs\n React.useImperativeHandle(ref, () => internalRef.current!);\n\n // Get current value\n const currentValue = value !== undefined ? String(value) : internalValue;\n const characterCount = currentValue.length;\n\n // Auto-resize logic: collapse to natural height, then grow to fit\n // content. CSS min-height (single-line baseline) and rows (via\n // scrollHeight) act as floors; a consumer-configured initial height\n // (style/class) and dragging the native resize handle set a user floor;\n // a consumer max-height still caps the rendered height.\n const userFloorRef = React.useRef<number | null>(null);\n const expectedHeightRef = React.useRef<number | null>(null);\n const initialFloorCapturedRef = React.useRef(false);\n\n const adjustHeight = React.useCallback(() => {\n const textarea = internalRef.current;\n if (textarea && autoResize) {\n textarea.style.height = 'auto';\n const borders = textarea.offsetHeight - textarea.clientHeight;\n const next = Math.max(\n textarea.scrollHeight + borders,\n userFloorRef.current ?? 0\n );\n textarea.style.height = `${next}px`;\n // Record the actual rendered height (a CSS max-height may clamp the\n // value we set) so clamping is never mistaken for a manual drag.\n expectedHeightRef.current = textarea.offsetHeight || next;\n }\n }, [autoResize]);\n\n // Measures prefilled values on mount and controlled values on update.\n // On mount, a consumer-configured initial height (inline style or a\n // height class) that exceeds the content height becomes the growth\n // floor — auto-sizing must not collapse below a configured baseline.\n React.useEffect(() => {\n const textarea = internalRef.current;\n if (textarea && autoResize && !initialFloorCapturedRef.current) {\n initialFloorCapturedRef.current = true;\n const configured = textarea.offsetHeight;\n adjustHeight();\n if (configured - textarea.offsetHeight > 1) {\n userFloorRef.current = configured;\n textarea.style.height = `${configured}px`;\n expectedHeightRef.current = textarea.offsetHeight || configured;\n }\n return;\n }\n adjustHeight();\n }, [currentValue, adjustHeight, autoResize]);\n\n // Re-measure when the available width changes (wrapping changes), and\n // detect heights we didn't set ourselves — the user dragging the native\n // resize handle — adopting the dragged height as the new growth floor.\n // The drag check runs first so a diagonal resize (width + height in one\n // notification) keeps the dragged height through the re-measure.\n React.useEffect(() => {\n const textarea = internalRef.current;\n if (!autoResize || !textarea || typeof ResizeObserver === 'undefined') {\n return;\n }\n let lastWidth = textarea.offsetWidth;\n const observer = new ResizeObserver(() => {\n const expected = expectedHeightRef.current;\n const height = textarea.offsetHeight;\n if (expected !== null && Math.abs(height - expected) > 1) {\n userFloorRef.current = height;\n expectedHeightRef.current = height;\n }\n if (textarea.offsetWidth !== lastWidth) {\n lastWidth = textarea.offsetWidth;\n adjustHeight();\n }\n });\n observer.observe(textarea);\n return () => observer.disconnect();\n }, [autoResize, adjustHeight]);\n\n // Handle change\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (value === undefined) {\n setInternalValue(e.target.value);\n }\n onChange?.(e);\n adjustHeight();\n },\n [value, onChange, adjustHeight]\n );\n\n // Build aria-describedby\n const describedByIds = [\n error ? errorId : null,\n helperText && !error ? helperId : null,\n showCount ? countId : null,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(' ');\n\n const isFloating = labelVariant === 'floating' && !!label && !hideLabel;\n\n const requiredMark = required && <RequiredMark variant={requiredVariant} />;\n\n const textareaElement = (\n <textarea\n data-slot=\"textarea\"\n data-auto-resize={autoResize ? 'true' : undefined}\n ref={internalRef}\n id={textareaId}\n value={value}\n defaultValue={value === undefined ? defaultValue : undefined}\n onChange={handleChange}\n maxLength={maxLength}\n aria-invalid={hasError || !!error}\n aria-describedby={describedByIds || undefined}\n required={required}\n // Auto-grow starts at one visible line; an explicit rows raises the\n // floor (scrollHeight never reports less than the rows box).\n rows={autoResize ? (rows ?? 1) : rows}\n // A single-space placeholder keeps :placeholder-shown reliable so the\n // label can float via CSS alone.\n placeholder={isFloating ? ' ' : placeholder}\n className={cn(\n textareaVariants({\n size,\n hasError: hasError || !!error,\n resize,\n labelVariant: isFloating ? 'floating' : 'stacked',\n autoResize,\n }),\n className\n )}\n {...props}\n />\n );\n\n return (\n <div data-slot=\"textarea-wrapper\" className=\"flex flex-col gap-1.5\">\n {label && !isFloating && (\n <label\n data-slot=\"textarea-label\"\n htmlFor={textareaId}\n className={cn(\n 'text-foreground text-sm font-medium',\n hideLabel && 'sr-only'\n )}\n >\n {label}\n {requiredMark}\n </label>\n )}\n {isFloating ? (\n <div className=\"relative\">\n {textareaElement}\n <label\n data-slot=\"textarea-label\"\n htmlFor={textareaId}\n className={floatingLabelVariants({\n size,\n hasError: hasError || !!error,\n })}\n >\n {label}\n {requiredMark}\n </label>\n </div>\n ) : (\n textareaElement\n )}\n <div\n data-slot=\"textarea-footer\"\n className=\"flex items-center justify-between gap-2\"\n >\n <div className=\"flex-1\">\n {error && (\n <p\n id={errorId}\n data-slot=\"textarea-error\"\n className=\"text-destructive-700 dark:text-destructive-400 text-sm\"\n role=\"alert\"\n >\n {error}\n </p>\n )}\n {helperText && !error && (\n <p\n id={helperId}\n data-slot=\"textarea-helper\"\n className=\"text-muted-foreground text-sm\"\n >\n {helperText}\n </p>\n )}\n </div>\n {showCount && (\n <p\n id={countId}\n data-slot=\"textarea-count\"\n className={cn(\n 'text-muted-foreground shrink-0 text-xs',\n maxLength && characterCount >= maxLength && 'text-destructive'\n )}\n >\n {characterCount}\n {maxLength && `/${maxLength}`}\n </p>\n )}\n </div>\n </div>\n );\n }\n);\n\nTextAreaPlain.displayName = 'TextAreaPlain';\n\nexport { TextAreaPlain, textareaVariants };\n","import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { RequiredMark } from '../Input';\nimport { TextAreaRichKerebron } from '../TextAreaRich/TextAreaRichKerebron';\nimport { TextAreaPlain } from '../TextAreaPlain';\nimport type { TextAreaPlainProps } from '../TextAreaPlain';\n\n/**\n * `Textarea` keeps `TextAreaPlain`'s prop surface so existing call sites\n * compile unchanged while rendering `TextAreaRich` underneath.\n */\nexport interface TextareaProps extends TextAreaPlainProps {\n /**\n * Set `false` to opt out of the rich surface: renders the native\n * `TextAreaPlain` instead — no block gutter menu, no formatting, no HTML —\n * and restores every native textarea behaviour (`maxLength` enforcement,\n * `resize`, `autoResize={false}`, floating labels).\n */\n richText?: boolean;\n}\n\n// --- plain text <-> HTML (lossless round-trip for plain text) --------------\n\nfunction escapeHtml(text: string): string {\n return text\n .replaceAll('&', '&')\n .replaceAll('<', '<')\n .replaceAll('>', '>');\n}\n\n/**\n * Newline normalization applied to every incoming plain value: a native\n * textarea's API value never contains CR, so CRLF/CR collapse to LF before\n * any conversion. Without this, `'a\\r\\nb'` would leave a literal CR inside a\n * paragraph and gain a blank line on the next round-trip.\n */\nfunction normalizeNewlines(text: string): string {\n return text.replace(/\\r\\n?/g, '\\n');\n}\n\n/**\n * Converts plain text to the editor's HTML: each line becomes a paragraph,\n * empty lines become `<p><br></p>`. Newlines are normalized to LF first\n * (matching native textarea behaviour); after that,\n * `htmlToPlain(plainToHtml(text)) === text` for every string, so stored\n * plain values survive untouched.\n */\nexport function plainToHtml(text: string): string {\n if (!text) return '';\n return normalizeNewlines(text)\n .split('\\n')\n .map((line) => (line ? `<p>${escapeHtml(line)}</p>` : '<p><br></p>'))\n .join('');\n}\n\nconst BLOCK_TAGS = new Set([\n 'P',\n 'DIV',\n 'H1',\n 'H2',\n 'H3',\n 'H4',\n 'H5',\n 'H6',\n 'LI',\n 'UL',\n 'OL',\n 'BLOCKQUOTE',\n 'PRE',\n 'TABLE',\n 'CAPTION',\n 'THEAD',\n 'TBODY',\n 'TFOOT',\n 'TR',\n]);\n\n/** Table cells separate with tabs; their row supplies the newline. */\nconst CELL_TAGS = new Set(['TD', 'TH']);\n\n/**\n * Structural table tags never render text of their own — whitespace-only\n * text nodes directly under them are pretty-printing between cells/rows\n * (`<tr>\\n <td>`), not field content.\n */\nconst TABLE_STRUCTURE_TAGS = new Set([\n 'TABLE',\n 'THEAD',\n 'TBODY',\n 'TFOOT',\n 'TR',\n]);\n\n/** Tags whose text is invisible — contributing it would leak code as text. */\nconst IGNORED_TAGS = new Set(['SCRIPT', 'STYLE', 'TEMPLATE', 'NOSCRIPT']);\n\nfunction nodeListToText(nodes: Iterable<Node>): string {\n let out = '';\n // Cell separators are positional, not content-based: an empty cell still\n // owns a column, so `Drug | (blank) | Dose` must stay `Drug\\t\\tDose`.\n let afterCell = false;\n for (const node of nodes) {\n if (node.nodeType === Node.TEXT_NODE) {\n const text = node.textContent ?? '';\n const parentTag = node.parentElement?.tagName;\n // Indentation between structural table elements is markup\n // formatting, not content — whitespace inside cells still counts.\n if (!text.trim() && parentTag && TABLE_STRUCTURE_TAGS.has(parentTag)) {\n continue;\n }\n out += text;\n // Inter-cell whitespace from pretty-printed table markup does not\n // break the cell sequence.\n if (text.trim()) afterCell = false;\n continue;\n }\n if (node.nodeType !== Node.ELEMENT_NODE) continue;\n const el = node as Element;\n if (IGNORED_TAGS.has(el.tagName)) continue;\n if (el.tagName === 'BR') {\n afterCell = false;\n out += '\\n';\n continue;\n }\n if (CELL_TAGS.has(el.tagName)) {\n if (afterCell) out += '\\t';\n out += nodeListToText(el.childNodes);\n afterCell = true;\n continue;\n }\n afterCell = false;\n if (BLOCK_TAGS.has(el.tagName)) {\n // A block starts its own line — inline content before it\n // (`a<div>b</div>`) must not fuse with the block's first line.\n if (out && !out.endsWith('\\n')) out += '\\n';\n let inner = nodeListToText(el.childNodes);\n // A lone <br> inside a block is the \"empty paragraph\" convention,\n // not an extra line break.\n if (inner === '\\n') inner = '';\n out += inner;\n // A block ends its own line — but a nested block\n // (`<blockquote><p>a</p></blockquote>`) already supplied the\n // newline; adding another would fabricate a blank line.\n if (inner === '' || !inner.endsWith('\\n')) out += '\\n';\n continue;\n }\n out += nodeListToText(el.childNodes);\n }\n return out;\n}\n\n/** Extracts plain text from editor HTML: blocks and `<br>` become newlines. */\nexport function htmlToPlain(html: string): string {\n if (!html) return '';\n // A <template> is the spec's inert parser: untrusted markup (pasted HTML\n // reaches this extractor) cannot load resources or run handlers like\n // `<img onerror>` while being read — unlike a detached <div>, whose\n // subtree is still \"browsing-context connected\" enough to fetch.\n const root = document.createElement('template');\n root.innerHTML = html;\n const text = nodeListToText(root.content.childNodes);\n return text.endsWith('\\n') ? text.slice(0, -1) : text;\n}\n\n/**\n * Paste/drop insertion policy: clipboard HTML is flattened to escaped plain\n * paragraphs before it reaches the live editable, so clipboard styles, host\n * CSS classes and embedded content never become active inside a field whose\n * contract is plain text.\n */\nfunction sanitizePastedHtml(html: string): string {\n return plainToHtml(htmlToPlain(html));\n}\n\n// --- dev-only one-time warnings for dropped native behaviours ---------------\n\nconst warned = new Set<string>();\nfunction warnOnce(key: string, message: string): void {\n if (process.env.NODE_ENV !== 'production' && !warned.has(key)) {\n warned.add(key);\n console.warn(`[mieweb/ui Textarea] ${message}`);\n }\n}\n\n/**\n * The rich implementation behind `Textarea` (see its docs). Separate\n * component so the `richText={false}` branch never mounts these hooks.\n */\nconst RichTextarea = React.forwardRef<HTMLTextAreaElement, TextAreaPlainProps>(\n (\n {\n label,\n labelVariant = 'stacked',\n hideLabel,\n error,\n helperText,\n maxLength,\n showCount,\n autoResize = true,\n requiredVariant,\n size = 'md',\n hasError,\n resize,\n className,\n value,\n defaultValue,\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n onKeyUp,\n name,\n form,\n id,\n rows,\n required,\n readOnly,\n disabled,\n placeholder,\n 'aria-describedby': ariaDescribedBy,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n },\n ref\n ) => {\n // One-time upgrade notice: this surface replaced the native <textarea>\n // in 0.12.0 — reaches exactly the developers affected, in dev only.\n warnOnce(\n 'rich-upgrade',\n 'Since 0.12.0 Textarea renders a rich text surface (plain-text value ' +\n 'contract unchanged). Watch for: CSS \"textarea\" selectors, E2E ' +\n 'fill()/type(), and maxLength no longer blocking typing. Opt out per ' +\n 'field with richText={false} or use TextAreaPlain. See MIGRATION.md.'\n );\n if (labelVariant === 'floating') {\n warnOnce(\n 'floating',\n 'labelVariant=\"floating\" is not supported by the rich surface; ' +\n 'falling back to a stacked label. Use TextAreaPlain for floating labels.'\n );\n }\n if (autoResize === false) {\n warnOnce(\n 'autoResize',\n 'autoResize={false} is ignored; the rich surface always grows with ' +\n 'content. Use TextAreaPlain for a fixed-height textarea.'\n );\n }\n if (resize !== undefined) {\n warnOnce(\n 'resize',\n 'resize is ignored; the rich surface has no native resize handle. ' +\n 'Use TextAreaPlain for drag-resizing.'\n );\n }\n if (maxLength !== undefined) {\n warnOnce(\n 'maxLength',\n 'maxLength is not enforced while typing; the character count still ' +\n 'reflects it. Enforce limits in onChange or use TextAreaPlain.'\n );\n }\n\n const reactId = React.useId();\n const errorId = `${reactId}-error`;\n const helperId = `${reactId}-helper`;\n const countId = `${reactId}-count`;\n\n const controlledValue =\n value !== undefined ? normalizeNewlines(String(value)) : undefined;\n\n const [state, setState] = React.useState(() => {\n const plain =\n controlledValue ??\n (defaultValue !== undefined\n ? normalizeNewlines(String(defaultValue))\n : '');\n return { html: plainToHtml(plain), plain };\n });\n\n // Controlled resync: only when the parent hands us a value different from\n // the plain text we last reported — echoing our own value back (the usual\n // controlled round-trip) keeps the user's rich formatting intact.\n if (controlledValue !== undefined && controlledValue !== state.plain) {\n setState({ html: plainToHtml(controlledValue), plain: controlledValue });\n }\n\n const hiddenRef = React.useRef<HTMLTextAreaElement>(null);\n const editorWrapperRef = React.useRef<HTMLDivElement>(null);\n\n // Rejected edits need no DOM poking here: the Kerebron surface is\n // strictly controlled (it converges to `value` on every render — see\n // RichEditor's `strictValue`), so when a controlled parent refuses an\n // edit and the optimistic state above is reverted during the same\n // render, the editor reloads the committed HTML transaction-safely.\n\n // The ProseMirror surface mounts asynchronously, so a mount-time\n // `ref.current.focus()` (the autoFocus-era idiom) can run before\n // `[role=\"textbox\"]` exists. The request is retained and honored when\n // the editable appears — unless focus has moved on to another control\n // in the meantime, which must not have its focus stolen.\n const pendingFocusRef = React.useRef<MutationObserver | null>(null);\n React.useEffect(() => () => pendingFocusRef.current?.disconnect(), []);\n const focusEditor = React.useCallback(() => {\n const wrapper = editorWrapperRef.current;\n if (!wrapper) return;\n const editable = wrapper.querySelector<HTMLElement>('[role=\"textbox\"]');\n if (editable) {\n editable.focus();\n return;\n }\n pendingFocusRef.current?.disconnect();\n const observer = new MutationObserver(() => {\n const target = wrapper.querySelector<HTMLElement>('[role=\"textbox\"]');\n if (!target) return;\n observer.disconnect();\n pendingFocusRef.current = null;\n const active = document.activeElement;\n if (!active || active === document.body || wrapper.contains(active)) {\n target.focus();\n }\n });\n // `role=\"textbox\"` arrives as an ATTRIBUTE write in the adapter's\n // readiness effect, possibly after the node insertions — watch both.\n observer.observe(wrapper, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['role'],\n });\n pendingFocusRef.current = observer;\n }, []);\n\n // The forwarded ref is the hidden mirror <textarea> — `ref.current.value`\n // reads the current plain text — with focus/blur redirected to the editor.\n React.useImperativeHandle(ref, () => {\n const node = hiddenRef.current as HTMLTextAreaElement;\n node.focus = focusEditor;\n node.blur = () => {\n // A focus request may still be waiting for the editable to mount;\n // blur() must cancel it, or the editor grabs focus (and reopens the\n // mobile keyboard) as soon as it appears.\n pendingFocusRef.current?.disconnect();\n pendingFocusRef.current = null;\n const editable =\n editorWrapperRef.current?.querySelector<HTMLElement>(\n '[role=\"textbox\"]'\n );\n if (document.activeElement === editable) editable?.blur();\n };\n return node;\n }, [focusEditor]);\n\n // External-label bridge: existing call sites pair\n // `<Label htmlFor={id}>` with `<Textarea id={id}>`. The id now lands on a\n // contenteditable div, which `htmlFor` neither names nor focuses. Find\n // the external label, point `aria-labelledby` at it (restoring the\n // accessible name) and focus the editor when it is clicked.\n const [externalLabelId, setExternalLabelId] = React.useState<string>();\n React.useEffect(() => {\n if (!id) return;\n const externalLabel = document.querySelector<HTMLLabelElement>(\n `label[for=\"${globalThis.CSS.escape(id)}\"]`\n );\n if (!externalLabel) return;\n if (!externalLabel.id) externalLabel.id = `${reactId}-external-label`;\n setExternalLabelId(externalLabel.id);\n const handleClick = () => focusEditor();\n externalLabel.addEventListener('click', handleClick);\n return () => externalLabel.removeEventListener('click', handleClick);\n }, [id, reactId, focusEditor]);\n\n // Re-targets editor events at the mirror so legacy handlers keep reading\n // `event.target.value` as plain text, like they did on the native\n // textarea. The original event is the prototype — reads and propagation\n // state delegate to it — with only the targets overridden;\n // stopPropagation/preventDefault forward to the original so React's\n // dispatch loop (which checks the original) honours them.\n const retargetEvent = React.useCallback(\n <E extends React.SyntheticEvent>(event: E): E => {\n const node = hiddenRef.current;\n if (!node) return event;\n const retargeted = Object.create(event) as E;\n Object.defineProperties(retargeted, {\n target: { value: node, enumerable: true },\n currentTarget: { value: node, enumerable: true },\n stopPropagation: { value: () => event.stopPropagation() },\n preventDefault: { value: () => event.preventDefault() },\n });\n return retargeted;\n },\n []\n );\n\n type MirrorFocusEvent = React.FocusEvent<HTMLTextAreaElement>;\n type MirrorKeyboardEvent = React.KeyboardEvent<HTMLTextAreaElement>;\n\n // Focus boundary that includes the editor's own portals: the block\n // gutter menu mounts under `document.body` and moves focus to its first\n // item on open, so DOM containment alone would fire the host's blur\n // mid-format (a blur-to-save consumer would commit early). A portal is\n // ours when a trigger inside this wrapper `aria-controls` its menu.\n const focusStaysInside = (\n event: React.FocusEvent<HTMLDivElement>\n ): boolean => {\n const related = event.relatedTarget;\n if (!related) return false;\n if (event.currentTarget.contains(related)) return true;\n const menuId = related\n .closest('[data-slot=\"dropdown-menu\"]')\n ?.querySelector('[role=\"menu\"]')?.id;\n return (\n !!menuId &&\n !!event.currentTarget.querySelector(\n `[aria-controls=\"${globalThis.CSS.escape(menuId)}\"]`\n )\n );\n };\n\n const handleHtmlChange = (html: string) => {\n const plain = htmlToPlain(html);\n setState({ html, plain });\n const node = hiddenRef.current;\n if (onChange && node) {\n node.value = plain;\n const nativeEvent = new Event('change');\n onChange({\n target: node,\n currentTarget: node,\n type: 'change',\n bubbles: false,\n cancelable: false,\n defaultPrevented: false,\n eventPhase: 0,\n isTrusted: false,\n timeStamp: Date.now(),\n nativeEvent,\n preventDefault: () => {},\n stopPropagation: () => {},\n isDefaultPrevented: () => false,\n isPropagationStopped: () => false,\n persist: () => {},\n } as React.ChangeEvent<HTMLTextAreaElement>);\n }\n };\n\n const showError = !!error;\n const invalid = hasError || showError;\n const describedByIds =\n [\n showError ? errorId : null,\n helperText && !showError ? helperId : null,\n showCount ? countId : null,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const characterCount = state.plain.length;\n\n // The editable's own metrics: `size` restyles the font, `rows` restores\n // the size-aware growth floor a native textarea got for free. Text\n // utilities cannot size the editable — unlayered package CSS\n // (kerebron.css's `[data-slot='textarea-rich'] .kb-editor` rule and\n // Kerebron's own base.css) outranks them on both font-size and\n // line-height — so the sm/lg metrics ride CSS variables that those\n // rules read. The defaults (16px/24px) are the md pair, keeping\n // `lineHeightPx` and the 40px rest-height match with Input honest.\n const lineHeightPx = size === 'sm' ? 20 : size === 'lg' ? 28 : 24;\n const sizeVars =\n size === 'sm'\n ? {\n '--textarea-rich-font-size': '0.875rem',\n '--textarea-rich-line-height': '1.25rem',\n }\n : size === 'lg'\n ? {\n '--textarea-rich-font-size': '1.125rem',\n '--textarea-rich-line-height': '1.75rem',\n }\n : null;\n const editorStyle =\n rows || sizeVars\n ? ({\n ...(rows\n ? // 7px block padding each side, matching the editable's py-[7px].\n { minHeight: `${rows * lineHeightPx + 14}px` }\n : null),\n ...sizeVars,\n } as React.CSSProperties)\n : undefined;\n\n return (\n <div data-slot=\"textarea-wrapper\" className=\"flex flex-col gap-1.5\">\n {label && (\n <label\n data-slot=\"textarea-label\"\n className={cn(\n 'text-foreground text-sm font-medium',\n hideLabel && 'sr-only'\n )}\n >\n {label}\n {required && <RequiredMark variant={requiredVariant} />}\n </label>\n )}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions --\n not interactive itself: delegates events bubbling from the\n contenteditable textbox inside, like a native field's wrapper */}\n <div\n ref={editorWrapperRef}\n className=\"w-full\"\n // Composed like native textarea events: blur/focus only fire when\n // focus actually leaves/enters the field (moves inside the editor\n // chrome — gutter menu, toolbar — don't count), and all events are\n // re-targeted at the mirror so `event.target.value` stays plain.\n onBlur={\n onBlur &&\n ((event: React.FocusEvent<HTMLDivElement>) => {\n if (focusStaysInside(event)) return;\n onBlur(retargetEvent(event) as unknown as MirrorFocusEvent);\n })\n }\n onFocus={\n onFocus &&\n ((event: React.FocusEvent<HTMLDivElement>) => {\n if (focusStaysInside(event)) return;\n onFocus(retargetEvent(event) as unknown as MirrorFocusEvent);\n })\n }\n onKeyDown={\n onKeyDown &&\n ((event: React.KeyboardEvent<HTMLDivElement>) =>\n onKeyDown(retargetEvent(event) as unknown as MirrorKeyboardEvent))\n }\n onKeyUp={\n onKeyUp &&\n ((event: React.KeyboardEvent<HTMLDivElement>) =>\n onKeyUp(retargetEvent(event) as unknown as MirrorKeyboardEvent))\n }\n >\n <TextAreaRichKerebron\n value={state.html}\n onChange={handleHtmlChange}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n id={id}\n // Paste flattening: honored by the legacy engine (which the unit\n // tests stub in — see src/test/textAreaRichKerebronStub); the\n // Kerebron engine instead filters pastes through its ProseMirror\n // schema, so markup never reaches the live document raw.\n sanitizeHtml={sanitizePastedHtml}\n aria-label={ariaLabel ?? label}\n aria-labelledby={ariaLabelledBy ?? externalLabelId}\n aria-describedby={describedByIds}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n editorClassName={cn(\n // A native textarea renders repeated spaces and tabs\n // faithfully; normal HTML layout would collapse them.\n // (Font metrics ride editorStyle's CSS variables — text-sm/\n // text-lg utilities lose to unlayered package CSS here.)\n 'whitespace-pre-wrap'\n )}\n editorStyle={editorStyle}\n className={cn(\n size === 'sm' && 'text-sm',\n size === 'lg' && 'text-lg',\n invalid &&\n 'border-destructive focus-within:ring-destructive focus-within:border-destructive',\n disabled && 'cursor-not-allowed opacity-50',\n className\n )}\n />\n </div>\n {/* Mirrors the plain value for form posts and the forwarded ref. */}\n <textarea\n data-slot=\"textarea-mirror\"\n ref={hiddenRef}\n hidden\n readOnly\n tabIndex={-1}\n aria-hidden=\"true\"\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n value={state.plain}\n />\n <div\n data-slot=\"textarea-footer\"\n className=\"flex items-center justify-between gap-2\"\n >\n <div className=\"flex-1\">\n {showError && (\n <p\n id={errorId}\n data-slot=\"textarea-error\"\n className=\"text-destructive-700 dark:text-destructive-400 text-sm\"\n role=\"alert\"\n >\n {error}\n </p>\n )}\n {helperText && !showError && (\n <p\n id={helperId}\n data-slot=\"textarea-helper\"\n className=\"text-muted-foreground text-sm\"\n >\n {helperText}\n </p>\n )}\n </div>\n {showCount && (\n <p\n id={countId}\n data-slot=\"textarea-count\"\n className={cn(\n 'text-muted-foreground shrink-0 text-xs',\n maxLength && characterCount >= maxLength && 'text-destructive'\n )}\n >\n {characterCount}\n {maxLength && `/${maxLength}`}\n </p>\n )}\n </div>\n </div>\n );\n }\n);\n\nRichTextarea.displayName = 'RichTextarea';\n\n/**\n * A multi-line text input that is rich text underneath. `Textarea` keeps its\n * plain-text contract — `value`, `defaultValue` and `onChange`'s\n * `event.target.value` are plain strings — while rendering `TextAreaRich`\n * (hidden toolbar, markdown shortcuts, block gutter menu) so every note\n * field gets formatting for free.\n *\n * Formatting the user applies is visible while editing but only the plain\n * text is reported through `onChange`; hosts that persist HTML should use\n * `TextAreaRich` directly. Need the native `<textarea>` element (hard\n * `maxLength`, native validation, autofill, drag-resize, floating label) —\n * pass `richText={false}` or use `TextAreaPlain`.\n *\n * A hidden `<textarea>` mirrors the plain value so `name` form posts and\n * `ref.current.value` keep working; `ref.current.focus()` focuses the editor.\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ richText = true, ...props }, ref) =>\n richText ? (\n <RichTextarea ref={ref} {...props} />\n ) : (\n <TextAreaPlain ref={ref} {...props} />\n )\n);\n\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/TextAreaPlain/TextAreaPlain.tsx","../src/components/Textarea/Textarea.tsx"],"names":["cva","React","jsx","RequiredMark","cn","jsxs","React2","TextAreaRichKerebron"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,gBAAA,GAAmBA,0BAAA;AAAA,EACvB;AAAA,IACE,kBAAA;AAAA,IACA,gCAAA;AAAA,IACA,+BAAA;AAAA,IACA,mCAAA;AAAA,IACA,gCAAA;AAAA,IACA,0EAAA;AAAA,IACA,iDAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,sBAAA;AAAA,QACJ,EAAA,EAAI,wBAAA;AAAA,QACJ,EAAA,EAAI;AAAA,OACN;AAAA,MACA,QAAA,EAAU;AAAA,QACR,IAAA,EAAM,2CAAA;AAAA,QACN,KAAA,EAAO;AAAA,OACT;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,IAAA,EAAM,aAAA;AAAA,QACN,QAAA,EAAU,UAAA;AAAA,QACV,UAAA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AA,gBAEC,QAAA,EAAA;AAAA,kBAAA,cAAA;AAAA,kBACA,SAAA,IAAa,IAAI,SAAS,CAAA;AAAA;AAAA;AAAA;AAC7B;AAAA;AAAA;AAEJ,KAAA,EACF,CAAA;AAAA,EAEJ;AACF,CAAA;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA;AAkB3B,IAAM,QAAA,GAAiBE,iBAAA,CAAA,UAAA;AAAA,EACrB,CAAC,EAAE,QAAA,GAAW,IAAA,EAAM,GAAG,KAAA,EAAM,EAAG,QAC9B,QAAA,mBACEJ,eAAC,YAAA,EAAA,EAAa,GAAA,EAAW,GAAG,KAAA,EAAO,CAAA,mBAEnCA,cAAAA,CAAC,aAAA,EAAA,EAAc,GAAA,EAAW,GAAG,KAAA,EAAO;AAE1C;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"chunk-3XR7BPKD.cjs","sourcesContent":["import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { cn } from '../../utils/cn';\nimport { RequiredMark, type RequiredMarkVariant } from '../Input';\n\nconst textareaVariants = cva(\n [\n 'w-full px-3 py-2',\n 'border border-input rounded-lg',\n 'bg-background text-foreground',\n 'placeholder:text-muted-foreground',\n 'transition-colors duration-200',\n 'focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'resize-y',\n ],\n {\n variants: {\n size: {\n sm: 'text-sm min-h-[60px]',\n md: 'text-base min-h-[80px]',\n lg: 'text-lg min-h-[100px]',\n },\n hasError: {\n true: 'border-destructive focus:ring-destructive',\n false: '',\n },\n resize: {\n none: 'resize-none',\n vertical: 'resize-y',\n horizontal: 'resize-x',\n both: 'resize',\n },\n labelVariant: {\n stacked: '',\n floating: 'peer placeholder:text-transparent',\n },\n autoResize: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n // Floating labels reserve top padding so entered text always starts\n // below the floated label, plus a little extra min-height.\n {\n labelVariant: 'floating',\n size: 'sm',\n className: 'pt-5 min-h-[76px]',\n },\n {\n labelVariant: 'floating',\n size: 'md',\n className: 'pt-6 min-h-[96px]',\n },\n {\n labelVariant: 'floating',\n size: 'lg',\n className: 'pt-7 min-h-[120px]',\n },\n // Auto-growing textareas start at the same visual height as a\n // single-line Input (h-8/h-10/h-12): min-height matches the Input\n // size token and the vertical padding is tuned so one line of text\n // plus padding plus borders lands exactly on that height.\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'sm',\n className: 'min-h-8 py-[5px]',\n },\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'md',\n className: 'min-h-10 py-[7px]',\n },\n {\n autoResize: true,\n labelVariant: 'stacked',\n size: 'lg',\n className: 'min-h-12 py-[9px]',\n },\n // Floating label + auto-grow: single line below the floated label.\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'sm',\n className: 'min-h-[50px]',\n },\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'md',\n className: 'min-h-[58px]',\n },\n {\n autoResize: true,\n labelVariant: 'floating',\n size: 'lg',\n className: 'min-h-[66px]',\n },\n ],\n defaultVariants: {\n size: 'md',\n hasError: false,\n resize: 'vertical',\n labelVariant: 'stacked',\n autoResize: true,\n },\n }\n);\n\nconst floatingLabelVariants = cva(\n [\n 'absolute start-3 pointer-events-none select-none',\n 'transition-all duration-200 ease-out',\n ],\n {\n variants: {\n size: {\n sm: [\n 'text-sm top-3',\n 'peer-focus:top-1 peer-[:not(:placeholder-shown)]:top-1 peer-autofill:top-1',\n 'peer-focus:text-[0.65rem] peer-[:not(:placeholder-shown)]:text-[0.65rem] peer-autofill:text-[0.65rem]',\n ],\n md: [\n 'text-base top-4',\n 'peer-focus:top-1.5 peer-[:not(:placeholder-shown)]:top-1.5 peer-autofill:top-1.5',\n 'peer-focus:text-xs peer-[:not(:placeholder-shown)]:text-xs peer-autofill:text-xs',\n ],\n lg: [\n 'text-lg top-5',\n 'peer-focus:top-2 peer-[:not(:placeholder-shown)]:top-2 peer-autofill:top-2',\n 'peer-focus:text-sm peer-[:not(:placeholder-shown)]:text-sm peer-autofill:text-sm',\n ],\n },\n hasError: {\n true: 'text-destructive',\n false: 'text-muted-foreground',\n },\n },\n defaultVariants: {\n size: 'md',\n hasError: false,\n },\n }\n);\n\nexport interface TextAreaPlainProps\n extends\n Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'>,\n Omit<VariantProps<typeof textareaVariants>, 'labelVariant'> {\n /** Label for the textarea */\n label?: string;\n /**\n * How the label is rendered.\n * - `stacked` (default): label above the textarea.\n * - `floating`: label rests inside the textarea like a placeholder and\n * floats to the top (staying inside it) when focused or filled.\n * Ignores `placeholder`; when `hideLabel` is set, falls back to a\n * visually-hidden stacked label.\n */\n labelVariant?: 'stacked' | 'floating';\n /** Whether the label should be visually hidden */\n hideLabel?: boolean;\n /** Error message to display */\n error?: string;\n /** Helper text to display */\n helperText?: string;\n /** Maximum character count */\n maxLength?: number;\n /** Show character count */\n showCount?: boolean;\n /**\n * Grow and shrink with content (default). The empty control matches a\n * single-line `Input`'s height; `rows` sets a taller growth floor, and\n * dragging the native resize handle sets a new floor the same way. Set\n * `false` for a classic fixed-height textarea.\n */\n autoResize?: boolean;\n /**\n * Color of the required asterisk.\n * - `default`: destructive (hard requirement).\n * - `warning`: warning color (soft requirement / recommended).\n */\n requiredVariant?: RequiredMarkVariant;\n}\n\n/**\n * A multi-line text input component with character count and auto-resize.\n *\n * @example\n * ```tsx\n * <TextAreaPlain label=\"Description\" placeholder=\"Enter a description...\" />\n * <TextAreaPlain\n * label=\"Bio\"\n * maxLength={280}\n * showCount\n * helperText=\"Tell us about yourself\"\n * />\n * ```\n */\nconst TextAreaPlain = React.forwardRef<HTMLTextAreaElement, TextAreaPlainProps>(\n (\n {\n className,\n size,\n hasError,\n resize,\n label,\n labelVariant = 'stacked',\n hideLabel,\n error,\n helperText,\n maxLength,\n showCount = false,\n autoResize = true,\n required = false,\n requiredVariant,\n id,\n rows,\n value,\n defaultValue,\n onChange,\n placeholder,\n 'aria-describedby': ariaDescribedBy,\n ...props\n },\n ref\n ) => {\n const internalRef = React.useRef<HTMLTextAreaElement>(null);\n const [internalValue, setInternalValue] = React.useState(\n (defaultValue as string) || ''\n );\n\n const generatedId = React.useId();\n const textareaId = id || generatedId;\n const errorId = `${textareaId}-error`;\n const helperId = `${textareaId}-helper`;\n const countId = `${textareaId}-count`;\n\n // Combine refs\n React.useImperativeHandle(ref, () => internalRef.current!);\n\n // Get current value\n const currentValue = value !== undefined ? String(value) : internalValue;\n const characterCount = currentValue.length;\n\n // Auto-resize logic: collapse to natural height, then grow to fit\n // content. CSS min-height (single-line baseline) and rows (via\n // scrollHeight) act as floors; a consumer-configured initial height\n // (style/class) and dragging the native resize handle set a user floor;\n // a consumer max-height still caps the rendered height.\n const userFloorRef = React.useRef<number | null>(null);\n const expectedHeightRef = React.useRef<number | null>(null);\n const initialFloorCapturedRef = React.useRef(false);\n\n const adjustHeight = React.useCallback(() => {\n const textarea = internalRef.current;\n if (textarea && autoResize) {\n textarea.style.height = 'auto';\n const borders = textarea.offsetHeight - textarea.clientHeight;\n const next = Math.max(\n textarea.scrollHeight + borders,\n userFloorRef.current ?? 0\n );\n textarea.style.height = `${next}px`;\n // Record the actual rendered height (a CSS max-height may clamp the\n // value we set) so clamping is never mistaken for a manual drag.\n expectedHeightRef.current = textarea.offsetHeight || next;\n }\n }, [autoResize]);\n\n // Measures prefilled values on mount and controlled values on update.\n // On mount, a consumer-configured initial height (inline style or a\n // height class) that exceeds the content height becomes the growth\n // floor — auto-sizing must not collapse below a configured baseline.\n React.useEffect(() => {\n const textarea = internalRef.current;\n if (textarea && autoResize && !initialFloorCapturedRef.current) {\n initialFloorCapturedRef.current = true;\n const configured = textarea.offsetHeight;\n adjustHeight();\n if (configured - textarea.offsetHeight > 1) {\n userFloorRef.current = configured;\n textarea.style.height = `${configured}px`;\n expectedHeightRef.current = textarea.offsetHeight || configured;\n }\n return;\n }\n adjustHeight();\n }, [currentValue, adjustHeight, autoResize]);\n\n // Re-measure when the available width changes (wrapping changes), and\n // detect heights we didn't set ourselves — the user dragging the native\n // resize handle — adopting the dragged height as the new growth floor.\n // The drag check runs first so a diagonal resize (width + height in one\n // notification) keeps the dragged height through the re-measure.\n React.useEffect(() => {\n const textarea = internalRef.current;\n if (!autoResize || !textarea || typeof ResizeObserver === 'undefined') {\n return;\n }\n let lastWidth = textarea.offsetWidth;\n const observer = new ResizeObserver(() => {\n const expected = expectedHeightRef.current;\n const height = textarea.offsetHeight;\n if (expected !== null && Math.abs(height - expected) > 1) {\n userFloorRef.current = height;\n expectedHeightRef.current = height;\n }\n if (textarea.offsetWidth !== lastWidth) {\n lastWidth = textarea.offsetWidth;\n adjustHeight();\n }\n });\n observer.observe(textarea);\n return () => observer.disconnect();\n }, [autoResize, adjustHeight]);\n\n // Handle change\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n if (value === undefined) {\n setInternalValue(e.target.value);\n }\n onChange?.(e);\n adjustHeight();\n },\n [value, onChange, adjustHeight]\n );\n\n // Build aria-describedby\n const describedByIds = [\n error ? errorId : null,\n helperText && !error ? helperId : null,\n showCount ? countId : null,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(' ');\n\n const isFloating = labelVariant === 'floating' && !!label && !hideLabel;\n\n const requiredMark = required && <RequiredMark variant={requiredVariant} />;\n\n const textareaElement = (\n <textarea\n data-slot=\"textarea\"\n data-auto-resize={autoResize ? 'true' : undefined}\n ref={internalRef}\n id={textareaId}\n value={value}\n defaultValue={value === undefined ? defaultValue : undefined}\n onChange={handleChange}\n maxLength={maxLength}\n aria-invalid={hasError || !!error}\n aria-describedby={describedByIds || undefined}\n required={required}\n // Auto-grow starts at one visible line; an explicit rows raises the\n // floor (scrollHeight never reports less than the rows box).\n rows={autoResize ? (rows ?? 1) : rows}\n // A single-space placeholder keeps :placeholder-shown reliable so the\n // label can float via CSS alone.\n placeholder={isFloating ? ' ' : placeholder}\n className={cn(\n textareaVariants({\n size,\n hasError: hasError || !!error,\n resize,\n labelVariant: isFloating ? 'floating' : 'stacked',\n autoResize,\n }),\n className\n )}\n {...props}\n />\n );\n\n return (\n <div data-slot=\"textarea-wrapper\" className=\"flex flex-col gap-1.5\">\n {label && !isFloating && (\n <label\n data-slot=\"textarea-label\"\n htmlFor={textareaId}\n className={cn(\n 'text-foreground text-sm font-medium',\n hideLabel && 'sr-only'\n )}\n >\n {label}\n {requiredMark}\n </label>\n )}\n {isFloating ? (\n <div className=\"relative\">\n {textareaElement}\n <label\n data-slot=\"textarea-label\"\n htmlFor={textareaId}\n className={floatingLabelVariants({\n size,\n hasError: hasError || !!error,\n })}\n >\n {label}\n {requiredMark}\n </label>\n </div>\n ) : (\n textareaElement\n )}\n <div\n data-slot=\"textarea-footer\"\n className=\"flex items-center justify-between gap-2\"\n >\n <div className=\"flex-1\">\n {error && (\n <p\n id={errorId}\n data-slot=\"textarea-error\"\n className=\"text-destructive-700 dark:text-destructive-400 text-sm\"\n role=\"alert\"\n >\n {error}\n </p>\n )}\n {helperText && !error && (\n <p\n id={helperId}\n data-slot=\"textarea-helper\"\n className=\"text-muted-foreground text-sm\"\n >\n {helperText}\n </p>\n )}\n </div>\n {showCount && (\n <p\n id={countId}\n data-slot=\"textarea-count\"\n className={cn(\n 'text-muted-foreground shrink-0 text-xs',\n maxLength && characterCount >= maxLength && 'text-destructive'\n )}\n >\n {characterCount}\n {maxLength && `/${maxLength}`}\n </p>\n )}\n </div>\n </div>\n );\n }\n);\n\nTextAreaPlain.displayName = 'TextAreaPlain';\n\nexport { TextAreaPlain, textareaVariants };\n","import * as React from 'react';\nimport { cn } from '../../utils/cn';\nimport { RequiredMark } from '../Input';\nimport { TextAreaRichKerebron } from '../TextAreaRich/TextAreaRichKerebron';\nimport { TextAreaPlain } from '../TextAreaPlain';\nimport type { TextAreaPlainProps } from '../TextAreaPlain';\n\n/**\n * `Textarea` keeps `TextAreaPlain`'s prop surface so existing call sites\n * compile unchanged while rendering `TextAreaRich` underneath.\n */\nexport interface TextareaProps extends TextAreaPlainProps {\n /**\n * Set `false` to opt out of the rich surface: renders the native\n * `TextAreaPlain` instead — no block gutter menu, no formatting, no HTML —\n * and restores every native textarea behaviour (`maxLength` enforcement,\n * `resize`, `autoResize={false}`, floating labels).\n */\n richText?: boolean;\n}\n\n// --- plain text <-> HTML (lossless round-trip for plain text) --------------\n\nfunction escapeHtml(text: string): string {\n return text\n .replaceAll('&', '&')\n .replaceAll('<', '<')\n .replaceAll('>', '>');\n}\n\n/**\n * Newline normalization applied to every incoming plain value: a native\n * textarea's API value never contains CR, so CRLF/CR collapse to LF before\n * any conversion. Without this, `'a\\r\\nb'` would leave a literal CR inside a\n * paragraph and gain a blank line on the next round-trip.\n */\nfunction normalizeNewlines(text: string): string {\n return text.replace(/\\r\\n?/g, '\\n');\n}\n\n/**\n * Converts plain text to the editor's HTML: each line becomes a paragraph,\n * empty lines become `<p><br></p>`. Newlines are normalized to LF first\n * (matching native textarea behaviour); after that,\n * `htmlToPlain(plainToHtml(text)) === text` for every string, so stored\n * plain values survive untouched.\n */\nexport function plainToHtml(text: string): string {\n if (!text) return '';\n return normalizeNewlines(text)\n .split('\\n')\n .map((line) => (line ? `<p>${escapeHtml(line)}</p>` : '<p><br></p>'))\n .join('');\n}\n\nconst BLOCK_TAGS = new Set([\n 'P',\n 'DIV',\n 'H1',\n 'H2',\n 'H3',\n 'H4',\n 'H5',\n 'H6',\n 'LI',\n 'UL',\n 'OL',\n 'BLOCKQUOTE',\n 'PRE',\n 'TABLE',\n 'CAPTION',\n 'THEAD',\n 'TBODY',\n 'TFOOT',\n 'TR',\n]);\n\n/** Table cells separate with tabs; their row supplies the newline. */\nconst CELL_TAGS = new Set(['TD', 'TH']);\n\n/**\n * Structural table tags never render text of their own — whitespace-only\n * text nodes directly under them are pretty-printing between cells/rows\n * (`<tr>\\n <td>`), not field content.\n */\nconst TABLE_STRUCTURE_TAGS = new Set([\n 'TABLE',\n 'THEAD',\n 'TBODY',\n 'TFOOT',\n 'TR',\n]);\n\n/** Tags whose text is invisible — contributing it would leak code as text. */\nconst IGNORED_TAGS = new Set(['SCRIPT', 'STYLE', 'TEMPLATE', 'NOSCRIPT']);\n\nfunction nodeListToText(nodes: Iterable<Node>): string {\n let out = '';\n // Cell separators are positional, not content-based: an empty cell still\n // owns a column, so `Drug | (blank) | Dose` must stay `Drug\\t\\tDose`.\n let afterCell = false;\n for (const node of nodes) {\n if (node.nodeType === Node.TEXT_NODE) {\n const text = node.textContent ?? '';\n const parentTag = node.parentElement?.tagName;\n // Indentation between structural table elements is markup\n // formatting, not content — whitespace inside cells still counts.\n if (!text.trim() && parentTag && TABLE_STRUCTURE_TAGS.has(parentTag)) {\n continue;\n }\n out += text;\n // Inter-cell whitespace from pretty-printed table markup does not\n // break the cell sequence.\n if (text.trim()) afterCell = false;\n continue;\n }\n if (node.nodeType !== Node.ELEMENT_NODE) continue;\n const el = node as Element;\n if (IGNORED_TAGS.has(el.tagName)) continue;\n if (el.tagName === 'BR') {\n afterCell = false;\n out += '\\n';\n continue;\n }\n if (CELL_TAGS.has(el.tagName)) {\n if (afterCell) out += '\\t';\n out += nodeListToText(el.childNodes);\n afterCell = true;\n continue;\n }\n afterCell = false;\n if (BLOCK_TAGS.has(el.tagName)) {\n // A block starts its own line — inline content before it\n // (`a<div>b</div>`) must not fuse with the block's first line.\n if (out && !out.endsWith('\\n')) out += '\\n';\n let inner = nodeListToText(el.childNodes);\n // A lone <br> inside a block is the \"empty paragraph\" convention,\n // not an extra line break.\n if (inner === '\\n') inner = '';\n out += inner;\n // A block ends its own line — but a nested block\n // (`<blockquote><p>a</p></blockquote>`) already supplied the\n // newline; adding another would fabricate a blank line.\n if (inner === '' || !inner.endsWith('\\n')) out += '\\n';\n continue;\n }\n out += nodeListToText(el.childNodes);\n }\n return out;\n}\n\n/** Extracts plain text from editor HTML: blocks and `<br>` become newlines. */\nexport function htmlToPlain(html: string): string {\n if (!html) return '';\n // A <template> is the spec's inert parser: untrusted markup (pasted HTML\n // reaches this extractor) cannot load resources or run handlers like\n // `<img onerror>` while being read — unlike a detached <div>, whose\n // subtree is still \"browsing-context connected\" enough to fetch.\n const root = document.createElement('template');\n root.innerHTML = html;\n const text = nodeListToText(root.content.childNodes);\n return text.endsWith('\\n') ? text.slice(0, -1) : text;\n}\n\n/**\n * Paste/drop insertion policy: clipboard HTML is flattened to escaped plain\n * paragraphs before it reaches the live editable, so clipboard styles, host\n * CSS classes and embedded content never become active inside a field whose\n * contract is plain text.\n */\nfunction sanitizePastedHtml(html: string): string {\n return plainToHtml(htmlToPlain(html));\n}\n\n// --- dev-only one-time warnings for dropped native behaviours ---------------\n\nconst warned = new Set<string>();\nfunction warnOnce(key: string, message: string): void {\n if (process.env.NODE_ENV !== 'production' && !warned.has(key)) {\n warned.add(key);\n console.warn(`[mieweb/ui Textarea] ${message}`);\n }\n}\n\n/**\n * The rich implementation behind `Textarea` (see its docs). Separate\n * component so the `richText={false}` branch never mounts these hooks.\n */\nconst RichTextarea = React.forwardRef<HTMLTextAreaElement, TextAreaPlainProps>(\n (\n {\n label,\n labelVariant = 'stacked',\n hideLabel,\n error,\n helperText,\n maxLength,\n showCount,\n autoResize = true,\n requiredVariant,\n size = 'md',\n hasError,\n resize,\n className,\n value,\n defaultValue,\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n onKeyUp,\n name,\n form,\n id,\n rows,\n required,\n readOnly,\n disabled,\n placeholder,\n 'aria-describedby': ariaDescribedBy,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n },\n ref\n ) => {\n // One-time upgrade notice: this surface replaced the native <textarea>\n // in 0.12.0 — reaches exactly the developers affected, in dev only.\n warnOnce(\n 'rich-upgrade',\n 'Since 0.12.0 Textarea renders a rich text surface (plain-text value ' +\n 'contract unchanged). Watch for: CSS \"textarea\" selectors, E2E ' +\n 'fill()/type(), and maxLength no longer blocking typing. Opt out per ' +\n 'field with richText={false} or use TextAreaPlain. See MIGRATION.md.'\n );\n if (labelVariant === 'floating') {\n warnOnce(\n 'floating',\n 'labelVariant=\"floating\" is not supported by the rich surface; ' +\n 'falling back to a stacked label. Use TextAreaPlain for floating labels.'\n );\n }\n if (autoResize === false) {\n warnOnce(\n 'autoResize',\n 'autoResize={false} is ignored; the rich surface always grows with ' +\n 'content. Use TextAreaPlain for a fixed-height textarea.'\n );\n }\n if (resize !== undefined) {\n warnOnce(\n 'resize',\n 'resize is ignored; the rich surface has no native resize handle. ' +\n 'Use TextAreaPlain for drag-resizing.'\n );\n }\n if (maxLength !== undefined) {\n warnOnce(\n 'maxLength',\n 'maxLength is not enforced while typing; the character count still ' +\n 'reflects it. Enforce limits in onChange or use TextAreaPlain.'\n );\n }\n\n const reactId = React.useId();\n const errorId = `${reactId}-error`;\n const helperId = `${reactId}-helper`;\n const countId = `${reactId}-count`;\n\n const controlledValue =\n value !== undefined ? normalizeNewlines(String(value)) : undefined;\n\n const [state, setState] = React.useState(() => {\n const plain =\n controlledValue ??\n (defaultValue !== undefined\n ? normalizeNewlines(String(defaultValue))\n : '');\n return { html: plainToHtml(plain), plain };\n });\n\n // Controlled resync: only when the parent hands us a value different from\n // the plain text we last reported — echoing our own value back (the usual\n // controlled round-trip) keeps the user's rich formatting intact.\n if (controlledValue !== undefined && controlledValue !== state.plain) {\n setState({ html: plainToHtml(controlledValue), plain: controlledValue });\n }\n\n const hiddenRef = React.useRef<HTMLTextAreaElement>(null);\n const editorWrapperRef = React.useRef<HTMLDivElement>(null);\n\n // Rejected edits need no DOM poking here: the Kerebron surface is\n // strictly controlled (it converges to `value` on every render — see\n // RichEditor's `strictValue`), so when a controlled parent refuses an\n // edit and the optimistic state above is reverted during the same\n // render, the editor reloads the committed HTML transaction-safely.\n\n // The ProseMirror surface mounts asynchronously, so a mount-time\n // `ref.current.focus()` (the autoFocus-era idiom) can run before\n // `[role=\"textbox\"]` exists. The request is retained and honored when\n // the editable appears — unless focus has moved on to another control\n // in the meantime, which must not have its focus stolen.\n const pendingFocusRef = React.useRef<MutationObserver | null>(null);\n React.useEffect(() => () => pendingFocusRef.current?.disconnect(), []);\n const focusEditor = React.useCallback(() => {\n const wrapper = editorWrapperRef.current;\n if (!wrapper) return;\n const editable = wrapper.querySelector<HTMLElement>('[role=\"textbox\"]');\n if (editable) {\n editable.focus();\n return;\n }\n pendingFocusRef.current?.disconnect();\n const observer = new MutationObserver(() => {\n const target = wrapper.querySelector<HTMLElement>('[role=\"textbox\"]');\n if (!target) return;\n observer.disconnect();\n pendingFocusRef.current = null;\n const active = document.activeElement;\n if (!active || active === document.body || wrapper.contains(active)) {\n target.focus();\n }\n });\n // `role=\"textbox\"` arrives as an ATTRIBUTE write in the adapter's\n // readiness effect, possibly after the node insertions — watch both.\n observer.observe(wrapper, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['role'],\n });\n pendingFocusRef.current = observer;\n }, []);\n\n // The forwarded ref is the hidden mirror <textarea> — `ref.current.value`\n // reads the current plain text — with focus/blur redirected to the editor.\n React.useImperativeHandle(ref, () => {\n const node = hiddenRef.current as HTMLTextAreaElement;\n node.focus = focusEditor;\n node.blur = () => {\n // A focus request may still be waiting for the editable to mount;\n // blur() must cancel it, or the editor grabs focus (and reopens the\n // mobile keyboard) as soon as it appears.\n pendingFocusRef.current?.disconnect();\n pendingFocusRef.current = null;\n const editable =\n editorWrapperRef.current?.querySelector<HTMLElement>(\n '[role=\"textbox\"]'\n );\n if (document.activeElement === editable) editable?.blur();\n };\n return node;\n }, [focusEditor]);\n\n // External-label bridge: existing call sites pair\n // `<Label htmlFor={id}>` with `<Textarea id={id}>`. The id now lands on a\n // contenteditable div, which `htmlFor` neither names nor focuses. Find\n // the external label, point `aria-labelledby` at it (restoring the\n // accessible name) and focus the editor when it is clicked.\n const [externalLabelId, setExternalLabelId] = React.useState<string>();\n React.useEffect(() => {\n if (!id) return;\n const externalLabel = document.querySelector<HTMLLabelElement>(\n `label[for=\"${globalThis.CSS.escape(id)}\"]`\n );\n if (!externalLabel) return;\n if (!externalLabel.id) externalLabel.id = `${reactId}-external-label`;\n setExternalLabelId(externalLabel.id);\n const handleClick = () => focusEditor();\n externalLabel.addEventListener('click', handleClick);\n return () => externalLabel.removeEventListener('click', handleClick);\n }, [id, reactId, focusEditor]);\n\n // Re-targets editor events at the mirror so legacy handlers keep reading\n // `event.target.value` as plain text, like they did on the native\n // textarea. The original event is the prototype — reads and propagation\n // state delegate to it — with only the targets overridden;\n // stopPropagation/preventDefault forward to the original so React's\n // dispatch loop (which checks the original) honours them.\n const retargetEvent = React.useCallback(\n <E extends React.SyntheticEvent>(event: E): E => {\n const node = hiddenRef.current;\n if (!node) return event;\n const retargeted = Object.create(event) as E;\n Object.defineProperties(retargeted, {\n target: { value: node, enumerable: true },\n currentTarget: { value: node, enumerable: true },\n stopPropagation: { value: () => event.stopPropagation() },\n preventDefault: { value: () => event.preventDefault() },\n });\n return retargeted;\n },\n []\n );\n\n type MirrorFocusEvent = React.FocusEvent<HTMLTextAreaElement>;\n type MirrorKeyboardEvent = React.KeyboardEvent<HTMLTextAreaElement>;\n\n // Focus boundary that includes the editor's own portals: the block\n // gutter menu mounts under `document.body` and moves focus to its first\n // item on open, so DOM containment alone would fire the host's blur\n // mid-format (a blur-to-save consumer would commit early). A portal is\n // ours when a trigger inside this wrapper `aria-controls` its menu.\n const focusStaysInside = (\n event: React.FocusEvent<HTMLDivElement>\n ): boolean => {\n const related = event.relatedTarget;\n if (!related) return false;\n if (event.currentTarget.contains(related)) return true;\n const menuId = related\n .closest('[data-slot=\"dropdown-menu\"]')\n ?.querySelector('[role=\"menu\"]')?.id;\n return (\n !!menuId &&\n !!event.currentTarget.querySelector(\n `[aria-controls=\"${globalThis.CSS.escape(menuId)}\"]`\n )\n );\n };\n\n const handleHtmlChange = (html: string) => {\n const plain = htmlToPlain(html);\n setState({ html, plain });\n const node = hiddenRef.current;\n if (onChange && node) {\n node.value = plain;\n const nativeEvent = new Event('change');\n onChange({\n target: node,\n currentTarget: node,\n type: 'change',\n bubbles: false,\n cancelable: false,\n defaultPrevented: false,\n eventPhase: 0,\n isTrusted: false,\n timeStamp: Date.now(),\n nativeEvent,\n preventDefault: () => {},\n stopPropagation: () => {},\n isDefaultPrevented: () => false,\n isPropagationStopped: () => false,\n persist: () => {},\n } as React.ChangeEvent<HTMLTextAreaElement>);\n }\n };\n\n const showError = !!error;\n const invalid = hasError || showError;\n const describedByIds =\n [\n showError ? errorId : null,\n helperText && !showError ? helperId : null,\n showCount ? countId : null,\n ariaDescribedBy,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const characterCount = state.plain.length;\n\n // The editable's own metrics: `size` restyles the font, `rows` restores\n // the size-aware growth floor a native textarea got for free. Text\n // utilities cannot size the editable — unlayered package CSS\n // (kerebron.css's `[data-slot='textarea-rich'] .kb-editor` rule and\n // Kerebron's own base.css) outranks them on both font-size and\n // line-height — so the sm/lg metrics ride CSS variables that those\n // rules read. The defaults (16px/24px) are the md pair, keeping\n // `lineHeightPx` and the 40px rest-height match with Input honest.\n const lineHeightPx = size === 'sm' ? 20 : size === 'lg' ? 28 : 24;\n const sizeVars =\n size === 'sm'\n ? {\n '--textarea-rich-font-size': '0.875rem',\n '--textarea-rich-line-height': '1.25rem',\n }\n : size === 'lg'\n ? {\n '--textarea-rich-font-size': '1.125rem',\n '--textarea-rich-line-height': '1.75rem',\n }\n : null;\n const editorStyle =\n rows || sizeVars\n ? ({\n ...(rows\n ? // 7px block padding each side, matching the editable's py-[7px].\n { minHeight: `${rows * lineHeightPx + 14}px` }\n : null),\n ...sizeVars,\n } as React.CSSProperties)\n : undefined;\n\n return (\n <div data-slot=\"textarea-wrapper\" className=\"flex flex-col gap-1.5\">\n {label && (\n <label\n data-slot=\"textarea-label\"\n className={cn(\n 'text-foreground text-sm font-medium',\n hideLabel && 'sr-only'\n )}\n >\n {label}\n {required && <RequiredMark variant={requiredVariant} />}\n </label>\n )}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions --\n not interactive itself: delegates events bubbling from the\n contenteditable textbox inside, like a native field's wrapper */}\n <div\n ref={editorWrapperRef}\n className=\"w-full\"\n // Composed like native textarea events: blur/focus only fire when\n // focus actually leaves/enters the field (moves inside the editor\n // chrome — gutter menu, toolbar — don't count), and all events are\n // re-targeted at the mirror so `event.target.value` stays plain.\n onBlur={\n onBlur &&\n ((event: React.FocusEvent<HTMLDivElement>) => {\n if (focusStaysInside(event)) return;\n onBlur(retargetEvent(event) as unknown as MirrorFocusEvent);\n })\n }\n onFocus={\n onFocus &&\n ((event: React.FocusEvent<HTMLDivElement>) => {\n if (focusStaysInside(event)) return;\n onFocus(retargetEvent(event) as unknown as MirrorFocusEvent);\n })\n }\n onKeyDown={\n onKeyDown &&\n ((event: React.KeyboardEvent<HTMLDivElement>) =>\n onKeyDown(retargetEvent(event) as unknown as MirrorKeyboardEvent))\n }\n onKeyUp={\n onKeyUp &&\n ((event: React.KeyboardEvent<HTMLDivElement>) =>\n onKeyUp(retargetEvent(event) as unknown as MirrorKeyboardEvent))\n }\n >\n <TextAreaRichKerebron\n value={state.html}\n onChange={handleHtmlChange}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readOnly}\n id={id}\n // Paste flattening: honored by the legacy engine (which the unit\n // tests stub in — see src/test/textAreaRichKerebronStub); the\n // Kerebron engine instead filters pastes through its ProseMirror\n // schema, so markup never reaches the live document raw.\n sanitizeHtml={sanitizePastedHtml}\n aria-label={ariaLabel ?? label}\n aria-labelledby={ariaLabelledBy ?? externalLabelId}\n aria-describedby={describedByIds}\n aria-invalid={invalid || undefined}\n aria-required={required || undefined}\n editorClassName={cn(\n // A native textarea renders repeated spaces and tabs\n // faithfully; normal HTML layout would collapse them.\n // (Font metrics ride editorStyle's CSS variables — text-sm/\n // text-lg utilities lose to unlayered package CSS here.)\n 'whitespace-pre-wrap'\n )}\n editorStyle={editorStyle}\n className={cn(\n size === 'sm' && 'text-sm',\n size === 'lg' && 'text-lg',\n invalid &&\n 'border-destructive focus-within:ring-destructive focus-within:border-destructive',\n disabled && 'cursor-not-allowed opacity-50',\n className\n )}\n />\n </div>\n {/* Mirrors the plain value for form posts and the forwarded ref. */}\n <textarea\n data-slot=\"textarea-mirror\"\n ref={hiddenRef}\n hidden\n readOnly\n tabIndex={-1}\n aria-hidden=\"true\"\n name={name}\n form={form}\n required={required}\n disabled={disabled}\n value={state.plain}\n />\n <div\n data-slot=\"textarea-footer\"\n className=\"flex items-center justify-between gap-2\"\n >\n <div className=\"flex-1\">\n {showError && (\n <p\n id={errorId}\n data-slot=\"textarea-error\"\n className=\"text-destructive-700 dark:text-destructive-400 text-sm\"\n role=\"alert\"\n >\n {error}\n </p>\n )}\n {helperText && !showError && (\n <p\n id={helperId}\n data-slot=\"textarea-helper\"\n className=\"text-muted-foreground text-sm\"\n >\n {helperText}\n </p>\n )}\n </div>\n {showCount && (\n <p\n id={countId}\n data-slot=\"textarea-count\"\n className={cn(\n 'text-muted-foreground shrink-0 text-xs',\n maxLength && characterCount >= maxLength && 'text-destructive'\n )}\n >\n {characterCount}\n {maxLength && `/${maxLength}`}\n </p>\n )}\n </div>\n </div>\n );\n }\n);\n\nRichTextarea.displayName = 'RichTextarea';\n\n/**\n * A multi-line text input that is rich text underneath. `Textarea` keeps its\n * plain-text contract — `value`, `defaultValue` and `onChange`'s\n * `event.target.value` are plain strings — while rendering `TextAreaRich`\n * (hidden toolbar, markdown shortcuts, block gutter menu) so every note\n * field gets formatting for free.\n *\n * Formatting the user applies is visible while editing but only the plain\n * text is reported through `onChange`; hosts that persist HTML should use\n * `TextAreaRich` directly. Need the native `<textarea>` element (hard\n * `maxLength`, native validation, autofill, drag-resize, floating label) —\n * pass `richText={false}` or use `TextAreaPlain`.\n *\n * A hidden `<textarea>` mirrors the plain value so `name` form posts and\n * `ref.current.value` keep working; `ref.current.focus()` focuses the editor.\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ richText = true, ...props }, ref) =>\n richText ? (\n <RichTextarea ref={ref} {...props} />\n ) : (\n <TextAreaPlain ref={ref} {...props} />\n )\n);\n\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n"]}
|
|
@@ -105,7 +105,7 @@ async function createEditorKits(config, mediaUpload, modifyMenu, omitExtensions)
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
try {
|
|
108
|
-
const {
|
|
108
|
+
const { createHuddleYjsKit, defaultWsUrl } = await import('./collabKit-652AGQW6.js');
|
|
109
109
|
const url = config.wsUrl ?? defaultWsUrl();
|
|
110
110
|
return {
|
|
111
111
|
kits: [
|
|
@@ -115,7 +115,7 @@ async function createEditorKits(config, mediaUpload, modifyMenu, omitExtensions)
|
|
|
115
115
|
modifyMenu,
|
|
116
116
|
omitExtensions
|
|
117
117
|
),
|
|
118
|
-
|
|
118
|
+
await createHuddleYjsKit(
|
|
119
119
|
url,
|
|
120
120
|
config.params ?? {},
|
|
121
121
|
config.WebSocketPolyfill,
|
|
@@ -472,5 +472,5 @@ var RichEditor = forwardRef(
|
|
|
472
472
|
RichEditor.displayName = "RichEditor";
|
|
473
473
|
|
|
474
474
|
export { MDY_PROJECTION_META, RichEditor };
|
|
475
|
-
//# sourceMappingURL=chunk-
|
|
476
|
-
//# sourceMappingURL=chunk-
|
|
475
|
+
//# sourceMappingURL=chunk-3XVDSLDT.js.map
|
|
476
|
+
//# sourceMappingURL=chunk-3XVDSLDT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/RichEditor/mdyTransaction.ts","../src/components/RichEditor/editorKits.ts","../src/components/RichEditor/RichEditor.tsx"],"names":["RichEditor","doc"],"mappings":";;;;;;;;;;AACO,IAAM,mBAAA,GAAsB;ACqGnC,IAAM,gBAAA,GAAmB,CAAC,cAAA,EAAgB,OAAO,CAAA;AAoBjD,SAAS,sBAAsB,UAAA,EAA6B;AAC1D,EAAA,KAAA,MAAW,QAAQ,UAAA,EAAY;AAC7B,IAAA,IAAI,CAAC,IAAA,IAAQ,OAAO,IAAA,KA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AAAA,OACF,EACF,CAAA;AAAA,MAEC,WAAA,oBACC,GAAA,CAAC,KAAA,EAAA,EACC,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,QAAG,QAAA,EAAA,iBAAA,EAAe,CAAA;AAAA,wBACnB,GAAA,CAAC,SAAK,QAAA,EAAA,EAAA,EAAG;AAAA,OAAA,EACX,CAAA,EACF;AAAA,KAAA,EAEJ,CAAA;AAAA,EAEJ;AACF;AAEA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"chunk-3XVDSLDT.js","sourcesContent":["/** Shared metadata for host-created MDY projection updates. */\nexport const MDY_PROJECTION_META = 'mdyProjectionRefresh';\n","/**\n * Editor kit assembly for {@link RichEditor}, for both plain and collaborative\n * (Yjs) mode.\n *\n * Both modes start from {@link AdvancedEditorKit} and drop the extensions that\n * are unsafe for our usage — see {@link unsafeExtensions} — then collaborative\n * mode adds the Yjs pieces on top.\n *\n * The Yjs pieces live in `collabKit.ts` behind a dynamic `import()`, so\n * `@kerebron/extension-yjs`, `yjs` and `y-protocols` remain truly optional\n * peers — plain-mode consumers never load them.\n */\nimport type { EditorKit } from '@kerebron/editor';\nimport type { NodeSpec } from 'prosemirror-model';\nimport { AdvancedEditorKit } from '@kerebron/editor-kits/AdvancedEditorKit';\nimport {\n ExtensionMediaUpload,\n type MediaUploadOptions,\n} from '@kerebron/extension-basic-editor/ExtensionMediaUpload';\nimport {\n ExtensionCustomMenu,\n type MenuElement,\n} from '@kerebron/extension-menu';\n\nexport type { MediaUploadOptions };\nexport type { MenuElement };\n\n/**\n * Reshape the toolbar menu before it renders: receives the stock menu's\n * item groups and returns the groups to render. Append custom\n * {@link MenuElement}s (e.g. a Macros toggle) or drop stock groups.\n */\nexport type ModifyMenu = (menus: MenuElement[][]) => MenuElement[][];\n\nexport interface CollabConfig {\n /** Room id — one shared document per room (e.g. a post id). */\n room: string;\n /**\n * WebSocket base URL for the Yjs relay. Defaults to\n * `<ws|wss>://<location.host>/yjs`. The room id is appended by the provider.\n */\n wsUrl?: string;\n /** Extra query params for the socket (e.g. `{ token }` for auth). */\n params?: Record<string, string>;\n /**\n * Who this editor is, published on awareness (`kerebron:user`) so peers see\n * a named, coloured cursor. Without it remote cursors do not render — the\n * position plugin skips awareness states that carry no user — and the\n * `id` is what the cursor colour is derived from (kerebron's `User` shape).\n */\n user?: { id: string; name: string; color?: string };\n /**\n * Custom WebSocket implementation handed to the Yjs provider — e.g. a\n * loopback socket for demos/tests, or a polyfill outside the browser.\n * Defaults to `globalThis.WebSocket`.\n */\n WebSocketPolyfill?: typeof globalThis.WebSocket;\n /**\n * Called when collaborative editing could not be started at all — the Yjs\n * kit failed to load (see {@link createEditorKits}). The editor mounts\n * anyway, as a local one; this is how the host finds out that edits are no\n * longer shared, so it can say so, or tear its own editor down if unshared\n * editing would be unsafe.\n *\n * Not for connection trouble: a room that is reachable but currently\n * disconnected still has the Yjs kit loaded, and the provider retries on its\n * own. This fires once, before the editor is created.\n */\n onUnavailable?: (error: unknown) => void;\n}\n\n/** What {@link createEditorKits} resolves to. */\nexport interface EditorKits {\n kits: EditorKit[];\n /**\n * Whether the returned kits can actually collaborate. False when `config`\n * asked for a room but the Yjs kit could not be loaded, so callers know not\n * to join one.\n */\n collaborative: boolean;\n}\n\n/**\n * Extensions dropped from {@link AdvancedEditorKit}, and why.\n *\n * `autocomplete` and `hover` debounce their DOM handlers (200ms) and then call\n * `dispatchMeta`, which reads `this.editor.state` with no guard that the editor\n * is still alive. Any teardown or document swap inside that debounce window\n * lands the deferred call on a dead view and throws\n * `null.matchesNode()` inside ProseMirror's `EditorView.updateStateInner`,\n * leaving the view permanently broken. Two ways to hit it:\n * - remount (e.g. a `key` change) while the pointer is over the editor, which\n * fires the debounced `onMouseLeave` after the view is destroyed;\n * - a Yjs remote update replacing the document tree under a pending callback.\n * The first applies to *every* editor, so both extensions come out in both\n * modes. No functional cost — autocomplete popups and node-hover tooltips are\n * compositor conveniences, not required for editing.\n *\n * `history` is collab-only: ExtensionYjs supplies its own CRDT-aware undo/redo\n * and the editor throws `Extension conflict: yjs vs history` if both are\n * present. Plain mode keeps it, so undo/redo still works there.\n */\nconst unsafeExtensions = ['autocomplete', 'hover'] as const;\n\n/**\n * Fix the `shortcode_inline` node's DOM round-trip (mieweb/ui#695).\n *\n * The stock node chips `{{merge_tokens}}` into atomic spans but its `toDOM`\n * drops the braces, so serializing a document back to HTML/text silently\n * corrupts every merge token. Patch the spec on the kit's own instance:\n * serialize the braces, strip them again on parse — the `content` attr stays\n * brace-less, which the input rule and the markdown serializer both rely on.\n *\n * Done here, in the kit we ship, so npm consumers on stock\n * `@kerebron/extension-basic-editor` get the fix too — `@kerebron/*` is\n * externalized (`tsup.config.ts`), so a workspace-level package patch would\n * never reach them. Drop once fixed upstream.\n *\n * The node is nested: `AdvancedEditorKit` → `ExtensionBasicEditor`, whose\n * `requires` carries the `BasicEditorKit` extension *instances* (names and\n * instances mix in `requires`), hence the recursive walk.\n */\nfunction fixShortcodeRoundTrip(extensions: unknown[]): void {\n for (const item of extensions) {\n if (!item || typeof item !== 'object') continue; // name-only requires\n const extension = item as {\n name?: unknown;\n requires?: unknown;\n getNodeSpec?: () => NodeSpec;\n };\n if (\n extension.name === 'shortcode_inline' &&\n typeof extension.getNodeSpec === 'function'\n ) {\n const stockSpec = extension.getNodeSpec.bind(extension);\n extension.getNodeSpec = (): NodeSpec => ({\n ...stockSpec(),\n parseDOM: [\n {\n tag: 'span.kb-shortcode-inline',\n getAttrs: (dom) => {\n const text = dom.textContent ?? '';\n const match = /^\\{\\{([^}]+)\\}\\}$/.exec(text);\n return { content: match ? match[1] : text || null };\n },\n },\n ],\n toDOM: (node) => [\n 'span',\n { class: 'kb-shortcode-inline' },\n node.attrs.content ? `{{${String(node.attrs.content)}}}` : '',\n ],\n });\n return;\n }\n if (Array.isArray(extension.requires)) {\n fixShortcodeRoundTrip(extension.requires);\n }\n }\n}\n\n/**\n * Remove extensions by name, wherever they sit: extensions nest (e.g.\n * `ExtensionBasicEditor.requires` carries the BasicEditorKit node instances),\n * so the walk descends `requires` arrays and filters each level in place.\n * Name-only (string) requires entries are left alone — they declare ordering,\n * not instances.\n */\nfunction dropNamedExtensions(\n extensions: unknown[],\n names: readonly string[]\n): unknown[] {\n const kept = extensions.filter(\n (item) =>\n !(\n item &&\n typeof item === 'object' &&\n 'name' in item &&\n names.includes((item as { name: string }).name)\n )\n );\n for (const item of kept) {\n if (!item || typeof item !== 'object') continue;\n const extension = item as { requires?: unknown };\n if (Array.isArray(extension.requires)) {\n extension.requires = dropNamedExtensions(extension.requires, names);\n }\n }\n return kept;\n}\n\n/**\n * {@link AdvancedEditorKit} minus {@link unsafeExtensions} (and, for collab\n * mode, minus `history`), with `mediaUpload` reconfigured when the host asks.\n *\n * `AdvancedEditorKit` constructs `ExtensionMediaUpload` with no options, and an\n * extension's options are fixed at construction — so the only way to configure\n * it is to drop that instance and append one of our own. `modifyMenu` works\n * the same way: the stock `ExtensionCustomMenu` is constructed with no config,\n * so customizing the toolbar means replacing it with a configured instance.\n */\nclass SafeAdvancedEditorKit implements EditorKit {\n name = 'advanced-editor';\n constructor(\n private readonly forCollab: boolean,\n private readonly mediaUpload?: MediaUploadOptions,\n private readonly modifyMenu?: ModifyMenu,\n private readonly omitExtensions?: readonly string[]\n ) {}\n\n getExtensions() {\n const dropped: string[] = [...unsafeExtensions];\n if (this.forCollab) dropped.push('history');\n if (this.mediaUpload) dropped.push('mediaUpload');\n if (this.modifyMenu) dropped.push('customMenu');\n\n let extensions = new AdvancedEditorKit()\n .getExtensions()\n .filter(\n (extension) =>\n !('name' in extension && dropped.includes(extension.name))\n );\n\n if (this.omitExtensions?.length) {\n extensions = dropNamedExtensions(\n extensions,\n this.omitExtensions\n ) as typeof extensions;\n }\n if (this.modifyMenu) {\n extensions.push(new ExtensionCustomMenu({ modifyMenu: this.modifyMenu }));\n }\n if (this.mediaUpload) {\n extensions.push(new ExtensionMediaUpload(this.mediaUpload));\n }\n fixShortcodeRoundTrip(extensions);\n return extensions;\n }\n}\n\n/** MarkYChange + ExtensionYjs live in `collabKit.ts` (lazy-loaded). */\n\n/**\n * Build the editor kits for a session. Pass `config` to join a collaborative\n * room; omit it for a plain local editor. Pass `mediaUpload` to configure how\n * pasted/dropped files are handled — most importantly `uploadHandler`, without\n * which every image is embedded in the document as a base64 `data:` URL.\n * Pass `omitExtensions` to remove schema extensions by name — the toolbar is\n * schema-driven, so dropping a node removes its menu items, input rules and\n * paste handling in one move (e.g. the email surface drops `task_list`).\n *\n * Async because collaborative mode lazy-loads the Yjs kit (and its optional\n * peer deps) on first use; plain mode resolves immediately.\n *\n * That lazy load is allowed to fail. `@kerebron/extension-yjs`, `yjs` and\n * `y-protocols` are optional peers, so the chunk can be absent (peers never\n * installed), stale (a dev server's dependency hash moved under a running\n * page) or simply unreachable (a partial deploy, an offline client). None of\n * that is a reason to leave the caller without an editor: collaboration is an\n * enhancement, editing is the feature. So a failed load degrades to the local\n * kit and reports itself through {@link CollabConfig.onUnavailable} rather\n * than rejecting.\n */\nexport async function createEditorKits(\n config?: CollabConfig,\n mediaUpload?: MediaUploadOptions,\n modifyMenu?: ModifyMenu,\n omitExtensions?: readonly string[]\n): Promise<EditorKits> {\n if (!config) {\n return {\n kits: [\n new SafeAdvancedEditorKit(\n false,\n mediaUpload,\n modifyMenu,\n omitExtensions\n ),\n ],\n collaborative: false,\n };\n }\n\n try {\n const { createHuddleYjsKit, defaultWsUrl } = await import('./collabKit');\n const url = config.wsUrl ?? defaultWsUrl();\n return {\n kits: [\n new SafeAdvancedEditorKit(\n true,\n mediaUpload,\n modifyMenu,\n omitExtensions\n ),\n await createHuddleYjsKit(\n url,\n config.params ?? {},\n config.WebSocketPolyfill,\n config.user\n ),\n ],\n collaborative: true,\n };\n } catch (error) {\n console.warn(\n '[RichEditor] Collaborative editing unavailable — the Yjs kit failed to load. Continuing as a local editor.',\n error\n );\n config.onUnavailable?.(error);\n // Degrading to a local editor must not also drop `mediaUpload`: without it\n // the stock extension comes back and pasted files are embedded as base64.\n return {\n kits: [\n new SafeAdvancedEditorKit(\n false,\n mediaUpload,\n modifyMenu,\n omitExtensions\n ),\n ],\n collaborative: false,\n };\n }\n}\n","'use client';\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useReducer,\n useRef,\n useState,\n} from 'react';\n\nimport { CoreEditor, type AssetLoad, type EditorKit } from '@kerebron/editor';\nimport { createAssetLoad } from '@kerebron/wasm/web';\n\nimport { useIsDarkMode } from '../../hooks/useIsDarkMode';\nimport { MDY_PROJECTION_META } from './mdyTransaction';\nimport {\n createEditorKits,\n type CollabConfig,\n type MediaUploadOptions,\n type ModifyMenu,\n} from './editorKits';\n\nexport type {\n CollabConfig,\n MediaUploadOptions,\n MenuElement,\n ModifyMenu,\n} from './editorKits';\n\nconst MARKDOWN_TYPE = 'text/x-markdown';\n\n/**\n * The markdown converter's tree-sitter WASM init is not concurrency-safe, so\n * every editor's *first* load queues behind the previous one. Later loads (a\n * `value` change) are free — by then the grammars are warm.\n */\nlet initialLoadQueue: Promise<unknown> = Promise.resolve();\n\nfunction queueInitialLoad(load: () => Promise<void>): Promise<void> {\n const queued = initialLoadQueue.catch(() => undefined).then(load);\n initialLoadQueue = queued.catch(() => undefined);\n return queued;\n}\n\nexport interface RichEditorProps {\n /** Markdown to load. Changing it reloads the editor unless `collab` is set. */\n value?: string;\n /** Called with the editor's markdown content whenever it changes. */\n onChange?: (value: string) => void;\n /** Called when editor setup or a Markdown load fails. getContent also rejects. */\n onError?: (error: unknown) => void;\n /** Called after the initial Markdown load completes. */\n onReady?: (editor: CoreEditor) => void;\n /** Whether to render the live markdown output preview. Defaults to `false`. */\n showPreview?: boolean;\n /**\n * Enable live collaborative editing (Yjs) for the given room. When set, the\n * editor connects to the `/yjs` websocket relay and every peer in the same\n * `room` co-edits one shared document. Uncontrolled like `value` — remount via\n * `key` to switch rooms.\n *\n * Best-effort: if the Yjs kit cannot be loaded the editor still mounts, as a\n * local one, and `collab.onUnavailable` is called. Pass that callback if\n * unshared editing is something your users need to be told about.\n */\n collab?: CollabConfig;\n /** Read-only surface: no typing, and the content dims. */\n disabled?: boolean;\n /**\n * Lock edits while keeping the surface focusable and selectable, without\n * the dimmed `disabled` styling. Applied from creation, so the document\n * cannot be edited even while the initial load is still in flight.\n */\n readOnly?: boolean;\n /**\n * Id for the editor host element — an `aria-labelledby`/`aria-describedby`\n * anchor. The host is a `div`, not a labelable control, so a\n * `<label htmlFor>` will not associate; name the editor with `aria-label`\n * or `aria-labelledby` instead.\n */\n id?: string;\n /** Extra classes on the editor surface, beside `kb-component`. */\n className?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n /**\n * Where the tree-sitter WASM grammars load from. Defaults to\n * `createAssetLoad('/kerebron-wasm')`; supply your own when the host serves\n * `@kerebron/wasm`'s `assets/` somewhere else.\n */\n assetLoad?: AssetLoad;\n /**\n * How files pasted or dropped into the editor are handled.\n *\n * **Set `uploadHandler` if your documents are persisted anywhere.** Without\n * it, a pasted image is embedded in the document as a base64 `data:` URL and\n * a video as a blob object URL: a 4 MB screenshot becomes ~5.8 MB of\n * markdown, which most APIs will refuse, and an object URL is dead as soon as\n * the page reloads. `uploadHandler` receives the file and returns the URL to\n * reference it by, so the document carries a link instead of the bytes.\n *\n * ```tsx\n * <RichEditor\n * mediaUpload={{ uploadHandler: (file) => uploadToMyMediaStore(file) }}\n * />\n * ```\n *\n * Read once, when the editor mounts — like {@link collab}, remount via `key`\n * to change it.\n */\n mediaUpload?: MediaUploadOptions;\n /** Additional editor kits, installed once when the editor mounts. */\n editorKits?: EditorKit[];\n /**\n * Reshape the stock toolbar before it renders: receives the menu's item\n * groups and returns the groups to render — append custom controls (a\n * macros toggle, dictation) or drop stock ones. Read once, when the editor\n * mounts — like {@link collab}, remount via `key` to change it.\n */\n modifyMenu?: ModifyMenu;\n /**\n * Schema extensions to remove by name (e.g. `['task_list', 'task_item']`).\n * The toolbar, input rules and paste handling are all schema-driven, so\n * dropping a node here removes the whole feature in one move. Read once,\n * when the editor mounts — like {@link collab}, remount via `key` to\n * change it.\n */\n omitExtensions?: readonly string[];\n /**\n * MIME type of the `value`/`onChange` contract (`'text/x-markdown'` by\n * default; pass `'text/html'` for an HTML-valued surface). Governs both\n * how `value` is parsed and what `onChange`/`getContent()` emit.\n */\n valueType?: string;\n /**\n * Converge the document to `value` on every render, not only when the\n * prop changes — native controlled-input semantics: when a host's\n * `onChange` does not echo an edit back into `value`, the edit reverts.\n * A rejected edit leaves the prop identity unchanged while the document\n * moved on, which a change-gated reload can never see. Off by default,\n * which tolerates read-once hosts that call `getContent()` on submit.\n */\n strictValue?: boolean;\n}\n\nexport interface RichEditorHandle {\n /**\n * The editor's markdown, awaiting the initial load. `onChange` can lag the\n * last keystroke, so read this on submit rather than trusting mirrored state.\n */\n getContent: () => Promise<string>;\n /** Focus the editor, restoring the caret where the writer left it. */\n focus: () => void;\n}\n\n/**\n * Markdown editor over Kerebron's `CoreEditor`.\n *\n * The editor mounts into a **disposable child div**: `CoreEditor.destroy()`\n * replaces its host element with a clone, which would strand React's ref (and,\n * under StrictMode's double-mount, leave the live editor detached behind a\n * dead clone).\n */\nconst RichEditor = forwardRef<RichEditorHandle, RichEditorProps>(\n function RichEditor(\n {\n value = '',\n onChange,\n onError,\n onReady,\n showPreview = false,\n collab,\n disabled = false,\n readOnly = false,\n id,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n assetLoad,\n mediaUpload,\n editorKits: additionalEditorKits,\n modifyMenu,\n omitExtensions,\n valueType = MARKDOWN_TYPE,\n strictValue = false,\n },\n ref\n ) {\n const isDark = useIsDarkMode();\n const hostRef = useRef<HTMLDivElement>(null);\n const editorInstance = useRef<CoreEditor | null>(null);\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n const onErrorRef = useRef(onError);\n onErrorRef.current = onError;\n const onReadyRef = useRef(onReady);\n onReadyRef.current = onReady;\n // Mirrors what the editor last held, so an echo of our own `onChange`\n // doesn't reload the document out from under the caret.\n const valueRef = useRef(value);\n const readyRef = useRef<Promise<void> | null>(null);\n const loadingRef = useRef(false);\n const loadVersionRef = useRef(0);\n // Return the exact source until a writer changes the loaded document.\n // Running the Markdown converter alone can normalize whitespace or links.\n const loadedDocRef = useRef<unknown>(null);\n const disabledRef = useRef(disabled);\n const readOnlyRef = useRef(readOnly);\n\n const [md, setMd] = useState<string>('');\n // A strict surface reconciles in an after-render effect, but publishing\n // an edit only mutates refs — a host whose `onChange` ignores the edit\n // (rejection) triggers no render, so the stale document would stay\n // visible. Each publication schedules one render; an accepted update\n // from the host batches into the same pass, so the effect compares the\n // freshest prop either way.\n const [, scheduleStrictReconcile] = useReducer(\n (tick: number) => tick + 1,\n 0\n );\n const strictValueRef = useRef(strictValue);\n strictValueRef.current = strictValue;\n // Serializing the document is the expensive part of a transaction, so the\n // last doc that was serialized is kept to recognise the transactions that\n // did not change it. ProseMirror documents are immutable, so identity is an\n // exact test.\n const lastSerializedDoc = useRef<unknown>(null);\n // Read inside effects created once on mount.\n const showPreviewRef = useRef(showPreview);\n showPreviewRef.current = showPreview;\n const valueTypeRef = useRef(valueType);\n valueTypeRef.current = valueType;\n\n // The contenteditable surface has no implicit ARIA role, so labeling\n // attributes are only permitted alongside an explicit textbox role — and\n // `aria-readonly` is only valid on such a role, not on the host div.\n const surfaceAttributes = useCallback(\n () =>\n ariaLabel || ariaLabelledBy\n ? {\n role: 'textbox',\n 'aria-multiline': 'true',\n ...(ariaLabel ? { 'aria-label': ariaLabel } : {}),\n ...(ariaLabelledBy ? { 'aria-labelledby': ariaLabelledBy } : {}),\n ...(readOnlyRef.current ? { 'aria-readonly': 'true' } : {}),\n }\n : null,\n [ariaLabel, ariaLabelledBy]\n );\n\n // Applies the read state everywhere it matters: the view's `editable`\n // prop, the surface's ARIA attributes, and the stock toolbar — whose\n // buttons dispatch commands regardless of `editable`, so disabled and\n // readOnly must neutralize it with `inert` (blocks pointer and keyboard\n // access while the document's text stays selectable).\n // ProseMirror drops natural tabbability once `editable` is false, so a\n // read-only (not disabled) surface restores it with a direct tabindex —\n // tracked by ownership so a host-supplied tabindex (the TextAreaRich\n // adapter sets its own through `setProps`) is never touched.\n const ownsTabindexRef = useRef(false);\n const syncReadState = useCallback(() => {\n const editor = editorInstance.current;\n if (editor) {\n const attributes = surfaceAttributes();\n editor.view.setProps({\n editable: () => !disabledRef.current && !readOnlyRef.current,\n ...(attributes ? { attributes } : {}),\n });\n const dom = editor.view.dom as HTMLElement;\n if (readOnlyRef.current && !disabledRef.current) {\n if (!dom.hasAttribute('tabindex')) {\n dom.setAttribute('tabindex', '0');\n ownsTabindexRef.current = true;\n }\n } else if (ownsTabindexRef.current) {\n if (dom.getAttribute('tabindex') === '0')\n dom.removeAttribute('tabindex');\n ownsTabindexRef.current = false;\n }\n }\n const inert = disabledRef.current || readOnlyRef.current;\n for (const toolbar of hostRef.current?.querySelectorAll<HTMLElement>(\n '.kb-custom-menu, .kb-custom-menu__overflow-menu'\n ) ?? []) {\n toolbar.inert = inert;\n }\n }, [surfaceAttributes]);\n\n useEffect(() => {\n disabledRef.current = disabled;\n readOnlyRef.current = readOnly;\n syncReadState();\n }, [disabled, readOnly, syncReadState]);\n\n // Runs after every render (no dependency array): a `strictValue` surface\n // must converge even when the prop identity never changed — a rejected\n // edit keeps `value` as-is while the document moved on. The\n // `value === valueRef` guard keeps the common case free; non-strict\n // hosts additionally require the prop itself to have changed (tracked\n // manually below), preserving tolerance for read-once hosts.\n const lastValuePropRef = useRef(value);\n useEffect(() => {\n const propChanged = lastValuePropRef.current !== value;\n lastValuePropRef.current = value;\n // In collab mode the CRDT owns the content; reloading would fight it.\n if (collab || value === valueRef.current) return;\n if (!strictValue && !propChanged) return;\n valueRef.current = value;\n const editor = editorInstance.current;\n if (!editor) return;\n\n loadingRef.current = true;\n const loadVersion = ++loadVersionRef.current;\n const previousReady = readyRef.current;\n // Serialize reloads behind setup and one another. Saving while a reload\n // is pending awaits that same promise rather than reading stale prose.\n const pending = (previousReady ?? Promise.resolve())\n .catch(() => undefined)\n .then(async () => {\n if (editorInstance.current !== editor) return;\n // Reloading the document must not cost the writer their caret: a\n // host-composed update (macro pick, finding) lands mid-flow and\n // the next keystroke should keep going into the editable.\n const hadFocus = editor.view.hasFocus();\n await editor.loadDocumentText(valueTypeRef.current, value);\n if (editorInstance.current !== editor) return;\n loadedDocRef.current = editor.view.state.doc;\n lastSerializedDoc.current = editor.view.state.doc;\n if (hadFocus) {\n // The load can take long enough for the writer to move on —\n // only reclaim the caret when no other control has taken it.\n const active = document.activeElement;\n if (\n !active ||\n active === document.body ||\n (editor.view.dom as HTMLElement).contains(active)\n ) {\n editor.view.focus();\n }\n }\n if (showPreviewRef.current) setMd(value);\n })\n .finally(() => {\n if (\n editorInstance.current === editor &&\n loadVersion === loadVersionRef.current\n ) {\n loadingRef.current = false;\n }\n });\n readyRef.current = pending;\n void pending.catch((error) => {\n if (editorInstance.current !== editor) return;\n console.error('Failed to load markdown:', error);\n onErrorRef.current?.(error);\n });\n });\n\n useEffect(() => {\n if (!hostRef.current) return;\n const host = hostRef.current;\n\n // Set on cleanup so async continuations (kit loading and the\n // `loadDocumentText` chain) don't touch the editor after `destroy()`.\n let disposed = false;\n let editor: CoreEditor | null = null;\n\n const mount = document.createElement('div');\n host.appendChild(mount);\n\n // Listen to transactions and update markdown preview\n const onTransaction = async (event?: Event) => {\n const transaction = (\n event as\n | globalThis.CustomEvent<{\n transaction?: {\n getMeta: (key: string) => unknown;\n before: unknown;\n };\n }>\n | undefined\n )?.detail?.transaction;\n if (transaction?.getMeta(MDY_PROJECTION_META) === true) {\n const doc = editorInstance.current?.view.state.doc;\n if (transaction.before === loadedDocRef.current) {\n loadedDocRef.current = doc;\n lastSerializedDoc.current = doc;\n } else {\n lastSerializedDoc.current = null;\n // A host projection can overtake a pending user-edit save. That\n // older result is discarded below, so publish the newest composed\n // document even if the writer does not make another transaction.\n // A microtask coalesces a burst of clinical updates into one save.\n void Promise.resolve().then(() => {\n if (!disposed) return onTransaction();\n });\n }\n return;\n }\n // Programmatic loads are not edits — reporting them would echo the\n // caller's own `value` back through `onChange`.\n if (loadingRef.current || !editorInstance.current) return;\n\n // ProseMirror fires a transaction for every selection change too —\n // arrow keys, clicks, a blur. Serializing the whole document to\n // markdown for those costs a full tree-sitter pass and two React\n // renders for a caret move, so only a changed document is re-read.\n const { doc } = editorInstance.current.view.state;\n if (doc === lastSerializedDoc.current) return;\n lastSerializedDoc.current = doc;\n const loadVersion = loadVersionRef.current;\n\n try {\n const buffer = await editorInstance.current.saveDocument(\n valueTypeRef.current\n );\n const markdown = new globalThis.TextDecoder().decode(buffer);\n if (\n disposed ||\n loadingRef.current ||\n loadVersion !== loadVersionRef.current ||\n doc !== editorInstance.current?.view.state.doc\n ) {\n return;\n }\n valueRef.current = markdown;\n // `md` only feeds the preview pane; setting it with the preview off\n // re-renders the editor on every keystroke for nothing.\n if (showPreviewRef.current) setMd(markdown);\n onChangeRef.current?.(markdown);\n if (strictValueRef.current) scheduleStrictReconcile();\n // This source is now published. Future clinical-only projections\n // preserve it without starting another authored-prose write.\n loadedDocRef.current = doc;\n } catch (err) {\n // The document was marked as serialized before the attempt, to keep\n // selection-only transactions arriving mid-save from re-entering.\n // A failure has to undo that, or this document is never retried.\n lastSerializedDoc.current = null;\n console.error('Failed to save markdown:', err);\n }\n };\n\n // Initialize the editor. Both modes drop the teardown-unsafe extensions;\n // collaborative mode additionally swaps `history` for the Yjs CRDT sync\n // and lazy-loads the Yjs kit (see `editorKits.ts` for why).\n const setup = async () => {\n loadingRef.current = true;\n const loadVersion = ++loadVersionRef.current;\n // `collaborative` is false when a room was asked for but the Yjs kit\n // could not be loaded — the editor is still created, just a local one,\n // so there is no room to join below.\n const { kits: editorKits, collaborative } = await createEditorKits(\n collab,\n mediaUpload,\n modifyMenu,\n omitExtensions\n );\n if (disposed) return;\n\n editor = CoreEditor.create({\n element: mount,\n uri: 'file:///untitled.md',\n assetLoad: assetLoad ?? createAssetLoad('/kerebron-wasm'),\n editorKits: [...editorKits, ...(additionalEditorKits ?? [])],\n readOnly: disabledRef.current || readOnlyRef.current,\n });\n\n editorInstance.current = editor;\n syncReadState();\n editor.addEventListener('transaction', onTransaction);\n\n // Seed initial content, then populate the preview once on mount.\n //\n // In collaborative mode we still load the local markdown first, then\n // join the room: the Yjs binding seeds an *empty* shared document from\n // this content on the first join, and overwrites the editor with the\n // shared content when the room already has edits — so the stored\n // markdown is the starting point without ever double-inserting.\n const joinRoom = () => {\n if (collaborative && collab && editor && !disposed) {\n (\n editor.run as Record<string, (...args: unknown[]) => boolean>\n ).changeRoom?.(collab.room);\n reseedWhenRoomStaysEmpty();\n }\n };\n\n // The Yjs binding is supposed to seed an empty room from the local\n // content, but the sync import can land as an overwrite that blanks\n // the just-loaded seed (observed with extension-yjs 0.8.x). Heal it:\n // once the join settles, an empty document with a non-empty seed\n // means nobody's content won — reload the seed, which the binding\n // then pushes into the room. Joiners pass no value, so exactly one\n // participant ever does this.\n const seed = valueRef.current;\n const reseedWhenRoomStaysEmpty = () => {\n if (!seed) return;\n const check = async (attempt: number) => {\n if (disposed || !editorInstance.current) return;\n try {\n const buffer =\n await editorInstance.current.saveDocument(MARKDOWN_TYPE);\n const current = new globalThis.TextDecoder()\n .decode(buffer)\n .trim();\n if (disposed || !editorInstance.current) return;\n if (current) return; // somebody's content arrived — done\n if (attempt >= 2) {\n await editorInstance.current.loadDocumentText(\n valueTypeRef.current,\n seed\n );\n return;\n }\n setTimeout(() => void check(attempt + 1), 300);\n } catch {\n // A failed probe must not break the editor; the room stays as-is.\n }\n };\n setTimeout(() => void check(0), 300);\n };\n\n if (valueRef.current) {\n await queueInitialLoad(() =>\n editor!.loadDocumentText(valueTypeRef.current, valueRef.current)\n );\n }\n if (disposed) return;\n loadedDocRef.current = editor.view.state.doc;\n lastSerializedDoc.current = editor.view.state.doc;\n if (showPreviewRef.current) setMd(valueRef.current);\n if (loadVersion === loadVersionRef.current) loadingRef.current = false;\n onReadyRef.current?.(editor);\n joinRoom();\n };\n\n const pending = setup();\n readyRef.current = pending;\n // Observe the rejection without replacing the readiness promise: callers\n // must be able to detect a failed load instead of saving stale content.\n void pending.catch((error) => {\n if (disposed) return;\n loadingRef.current = false;\n console.error('Failed to set up editor:', error);\n onErrorRef.current?.(error);\n });\n\n // Cleanup on unmount\n return () => {\n disposed = true;\n editorInstance.current = null; // makes onTransaction's guard effective\n editor?.removeEventListener('transaction', onTransaction);\n editor?.destroy();\n readyRef.current = null;\n host.replaceChildren();\n };\n // Initial `value`/`collab` are intentionally only applied on mount\n // (uncontrolled). Remount via `key` to switch rooms.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useImperativeHandle(\n ref,\n () => ({\n getContent: async (): Promise<string> => {\n while (true) {\n await readyRef.current;\n const editor = editorInstance.current;\n if (!editor) return valueRef.current;\n const doc = editor.view.state.doc;\n const loadVersion = loadVersionRef.current;\n if (doc === loadedDocRef.current) return valueRef.current;\n const buffer = await editor.saveDocument(valueTypeRef.current);\n if (\n editorInstance.current !== editor ||\n loadVersion !== loadVersionRef.current ||\n doc !== editor.view.state.doc\n )\n continue;\n const markdown = new globalThis.TextDecoder().decode(buffer);\n valueRef.current = markdown;\n loadedDocRef.current = doc;\n lastSerializedDoc.current = doc;\n return markdown;\n }\n },\n focus: (): void => {\n const apply = (): void => {\n const view = editorInstance.current?.view as\n | { focus?: () => void }\n | undefined;\n if (view?.focus) {\n view.focus();\n return;\n }\n hostRef.current\n ?.querySelector<HTMLElement>('[contenteditable=\"true\"], textarea')\n ?.focus();\n };\n // Callers focus on mount; the editor may still be loading its kits.\n if (editorInstance.current) apply();\n else void readyRef.current?.then(apply, () => undefined);\n },\n }),\n []\n );\n\n return (\n <div>\n <div>\n <div\n ref={hostRef}\n id={id}\n className={[\n 'kb-component',\n isDark ? 'kb-component--dark' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ')}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-disabled={disabled || undefined}\n style={{\n isolation: 'isolate',\n opacity: disabled ? 0.65 : undefined,\n pointerEvents: disabled ? 'none' : undefined,\n }}\n />\n </div>\n\n {showPreview && (\n <div>\n <div>\n <h5>Markdown Output</h5>\n <pre>{md}</pre>\n </div>\n </div>\n )}\n </div>\n );\n }\n);\n\nRichEditor.displayName = 'RichEditor';\n\nexport { RichEditor };\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RichEditor } from './chunk-
|
|
1
|
+
import { RichEditor } from './chunk-3XVDSLDT.js';
|
|
2
2
|
import { processDictation, MacroLibrary } from './chunk-N6STVVB6.js';
|
|
3
3
|
import { useMessages } from './chunk-5YOT4DVH.js';
|
|
4
4
|
import { Dropdown, DropdownItem, DropdownSeparator, DropdownSubmenu, DropdownLabel } from './chunk-GTRYDFMT.js';
|
|
@@ -1184,5 +1184,5 @@ var TextAreaRichKerebron = React2.forwardRef(
|
|
|
1184
1184
|
TextAreaRichKerebron.displayName = "TextAreaRichKerebron";
|
|
1185
1185
|
|
|
1186
1186
|
export { CodeEditor, TextAreaRichKerebron };
|
|
1187
|
-
//# sourceMappingURL=chunk-
|
|
1188
|
-
//# sourceMappingURL=chunk-
|
|
1187
|
+
//# sourceMappingURL=chunk-DHCSY2JY.js.map
|
|
1188
|
+
//# sourceMappingURL=chunk-DHCSY2JY.js.map
|