@epilot/zenith-react 0.2.0-next.0 → 0.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/components/accordion/accordion.js +57 -48
  2. package/dist/components/accordion/accordion.js.map +1 -1
  3. package/dist/components/alert-dialog/alert-dialog.js +120 -92
  4. package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
  5. package/dist/components/avatar/avatar-group.js +38 -35
  6. package/dist/components/avatar/avatar-group.js.map +1 -1
  7. package/dist/components/avatar/avatar.js +78 -71
  8. package/dist/components/avatar/avatar.js.map +1 -1
  9. package/dist/components/badge/badge.js +60 -55
  10. package/dist/components/badge/badge.js.map +1 -1
  11. package/dist/components/breadcrumb/breadcrumb.js +99 -54
  12. package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
  13. package/dist/components/button/button.js +87 -77
  14. package/dist/components/button/button.js.map +1 -1
  15. package/dist/components/button-group/button-group.js +36 -32
  16. package/dist/components/button-group/button-group.js.map +1 -1
  17. package/dist/components/callout/callout.js +105 -98
  18. package/dist/components/callout/callout.js.map +1 -1
  19. package/dist/components/card/card.js +62 -52
  20. package/dist/components/card/card.js.map +1 -1
  21. package/dist/components/checkbox/checkbox.js +22 -19
  22. package/dist/components/checkbox/checkbox.js.map +1 -1
  23. package/dist/components/code-block/code-block.js +135 -123
  24. package/dist/components/code-block/code-block.js.map +1 -1
  25. package/dist/components/code-editor/code-editor.js +276 -260
  26. package/dist/components/code-editor/code-editor.js.map +1 -1
  27. package/dist/components/collapsible-sidebar/collapsible-sidebar.js +62 -56
  28. package/dist/components/collapsible-sidebar/collapsible-sidebar.js.map +1 -1
  29. package/dist/components/command/command.js +116 -105
  30. package/dist/components/command/command.js.map +1 -1
  31. package/dist/components/data-table/data-table-body.js +38 -34
  32. package/dist/components/data-table/data-table-body.js.map +1 -1
  33. package/dist/components/data-table/data-table-column-header.js +30 -26
  34. package/dist/components/data-table/data-table-column-header.js.map +1 -1
  35. package/dist/components/data-table/data-table-column-order.js +79 -73
  36. package/dist/components/data-table/data-table-column-order.js.map +1 -1
  37. package/dist/components/data-table/data-table-column-visibility.js +25 -22
  38. package/dist/components/data-table/data-table-column-visibility.js.map +1 -1
  39. package/dist/components/data-table/data-table-content.js +47 -44
  40. package/dist/components/data-table/data-table-content.js.map +1 -1
  41. package/dist/components/data-table/data-table-error.js +36 -32
  42. package/dist/components/data-table/data-table-error.js.map +1 -1
  43. package/dist/components/data-table/data-table-footer.js +10 -8
  44. package/dist/components/data-table/data-table-footer.js.map +1 -1
  45. package/dist/components/data-table/data-table-header-draggable.js +40 -36
  46. package/dist/components/data-table/data-table-header-draggable.js.map +1 -1
  47. package/dist/components/data-table/data-table-loading.js +21 -18
  48. package/dist/components/data-table/data-table-loading.js.map +1 -1
  49. package/dist/components/data-table/data-table-resize-handle.js +13 -11
  50. package/dist/components/data-table/data-table-resize-handle.js.map +1 -1
  51. package/dist/components/data-table/data-table-row.js +47 -44
  52. package/dist/components/data-table/data-table-row.js.map +1 -1
  53. package/dist/components/data-table/data-table-toolbar.js +9 -7
  54. package/dist/components/data-table/data-table-toolbar.js.map +1 -1
  55. package/dist/components/data-table/data-table.js +48 -46
  56. package/dist/components/data-table/data-table.js.map +1 -1
  57. package/dist/components/date-range-picker/date-range-picker.js +173 -164
  58. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  59. package/dist/components/date-range-picker/range-calendar.js +36 -34
  60. package/dist/components/date-range-picker/range-calendar.js.map +1 -1
  61. package/dist/components/date-time-picker/calendar.js +290 -272
  62. package/dist/components/date-time-picker/calendar.js.map +1 -1
  63. package/dist/components/date-time-picker/date-time-picker-input.js +22 -20
  64. package/dist/components/date-time-picker/date-time-picker-input.js.map +1 -1
  65. package/dist/components/date-time-picker/date-time-picker-panel.js +126 -120
  66. package/dist/components/date-time-picker/date-time-picker-panel.js.map +1 -1
  67. package/dist/components/date-time-picker/date-time-picker.js +42 -40
  68. package/dist/components/date-time-picker/date-time-picker.js.map +1 -1
  69. package/dist/components/date-time-picker/time-picker.js +95 -87
  70. package/dist/components/date-time-picker/time-picker.js.map +1 -1
  71. package/dist/components/dialog/dialog.js +115 -95
  72. package/dist/components/dialog/dialog.js.map +1 -1
  73. package/dist/components/drawer/drawer.js +144 -109
  74. package/dist/components/drawer/drawer.js.map +1 -1
  75. package/dist/components/dropdown-menu/dropdown-menu.js +141 -112
  76. package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
  77. package/dist/components/field/field-combobox.js +196 -176
  78. package/dist/components/field/field-combobox.js.map +1 -1
  79. package/dist/components/field/field.js +137 -126
  80. package/dist/components/field/field.js.map +1 -1
  81. package/dist/components/list/list.js +237 -219
  82. package/dist/components/list/list.js.map +1 -1
  83. package/dist/components/option-card/option-card.js +129 -116
  84. package/dist/components/option-card/option-card.js.map +1 -1
  85. package/dist/components/pill/pill.js +55 -51
  86. package/dist/components/pill/pill.js.map +1 -1
  87. package/dist/components/popover/popover.js +53 -36
  88. package/dist/components/popover/popover.js.map +1 -1
  89. package/dist/components/radio/radio.js +38 -34
  90. package/dist/components/radio/radio.js.map +1 -1
  91. package/dist/components/scroll-area/scroll-area.js +38 -35
  92. package/dist/components/scroll-area/scroll-area.js.map +1 -1
  93. package/dist/components/scroll-overflow/scroll-overflow.js +166 -151
  94. package/dist/components/scroll-overflow/scroll-overflow.js.map +1 -1
  95. package/dist/components/segmented-control/segmented-control.js +93 -85
  96. package/dist/components/segmented-control/segmented-control.js.map +1 -1
  97. package/dist/components/select/select.js +149 -128
  98. package/dist/components/select/select.js.map +1 -1
  99. package/dist/components/separator/separator.js +19 -16
  100. package/dist/components/separator/separator.js.map +1 -1
  101. package/dist/components/skeleton/skeleton.js +34 -30
  102. package/dist/components/skeleton/skeleton.js.map +1 -1
  103. package/dist/components/spinner/spinner.js +22 -17
  104. package/dist/components/spinner/spinner.js.map +1 -1
  105. package/dist/components/surface/surface.js +25 -22
  106. package/dist/components/surface/surface.js.map +1 -1
  107. package/dist/components/switch/switch.js +66 -57
  108. package/dist/components/switch/switch.js.map +1 -1
  109. package/dist/components/table/table-pagination.js +139 -129
  110. package/dist/components/table/table-pagination.js.map +1 -1
  111. package/dist/components/table/table.js +104 -90
  112. package/dist/components/table/table.js.map +1 -1
  113. package/dist/components/tabs/tabs.js +206 -128
  114. package/dist/components/tabs/tabs.js.map +1 -1
  115. package/dist/components/toast/toast.js +112 -100
  116. package/dist/components/toast/toast.js.map +1 -1
  117. package/dist/components/toggle/toggle.js +32 -30
  118. package/dist/components/toggle/toggle.js.map +1 -1
  119. package/dist/components/tooltip/tooltip.js +59 -46
  120. package/dist/components/tooltip/tooltip.js.map +1 -1
  121. package/dist/index.d.ts +12 -0
  122. package/dist/lib/clear-button.js +18 -17
  123. package/dist/lib/clear-button.js.map +1 -1
  124. package/dist/styles/host-reset.js +47 -0
  125. package/dist/styles/host-reset.js.map +1 -0
  126. package/dist/styles/overlay-layer.js +5 -0
  127. package/dist/styles/overlay-layer.js.map +1 -0
  128. package/dist/tokens.json +1 -1
  129. package/package.json +8 -7
  130. package/scripts/migration-diagnostics.mjs +42 -7
  131. package/scripts/migration-sweep.mjs +9 -1
@@ -1 +1 @@
1
- {"version":3,"file":"code-editor.js","sources":["../../../src/components/code-editor/code-editor.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport { Button } from \"../button/button\"\nimport { applyIndent } from \"./indent\"\nimport { highlightCode, splitTokenLines } from \"../../lib/code-highlight\"\nimport { useCodeTokenRenderer } from \"../../lib/code-tokens\"\nimport {\n caretAfterRewrite,\n gutterDigits,\n lineIndexAt,\n severityByLine,\n visibleDiagnostics,\n type CodeDiagnostic,\n type CodeDiagnosticSeverity,\n} from \"../../lib/code-lines\"\n\n/**\n * Compact code editing on a native textarea. Highlighting is decorative; the textarea remains the\n * only focusable, labelled, form-participating control. Formatting and diagnostics are supplied by\n * the caller rather than computed here.\n */\n\n/** How long a formatting outcome stays in the live region. */\nconst FORMAT_FEEDBACK_MS = 2000\n\n/** Shared gutter width for the number cells and textarea padding. */\nconst GUTTER = \"--zenith-code-gutter\"\n\n/**\n * Metrics shared by the textarea and highlight layer. `tabSize` varies per instance and gutter\n * padding intentionally differs between layers.\n */\nconst CODE_METRICS = {\n ...shorthands.margin(0),\n ...shorthands.borderWidth(0),\n ...shorthands.borderStyle(\"none\"),\n ...shorthands.padding(tokens.spacingElement2),\n fontFamily: tokens.fontMono,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n letterSpacing: tokens.trackingNormal,\n fontWeight: tokens.fontWeightNormal,\n textIndent: 0,\n boxSizing: \"border-box\",\n // A classic, space-consuming scrollbar narrows the textarea's content box but not the layer's,\n // which moves where wrapped lines break. Reserving the gutter on both keeps one content width.\n // Platforms with overlay scrollbars never had the problem.\n scrollbarGutter: \"stable\",\n} as const\n\n/** Core-sheet colours used by diagnostic rules and numbers. */\nconst SEVERITY_TOKENS: Record<\n CodeDiagnosticSeverity,\n { rule: string; number: string }\n> = {\n error: { rule: tokens.errorUi, number: tokens.error11 },\n warning: { rule: tokens.warningUi, number: tokens.warning11 },\n info: { rule: tokens.infoUi, number: tokens.info11 },\n}\n\nconst useStyles = makeZenithStyles({\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n position: \"relative\",\n backgroundColor: tokens.surfaceField,\n ...shorthands.borderWidth(tokens.borderWidthField),\n ...shorthands.borderStyle(\"solid\"),\n ...shorthands.borderColor(tokens.borderField),\n borderRadius: tokens.surfaceRadiusField,\n // Declared before the state rules below so those win by source order, per AGENTS.md rule 2.\n \"&:focus-within\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"-1px\",\n outlineColor: tokens.focusRing,\n },\n \"&[data-invalid]\": {\n ...shorthands.borderColor(tokens.errorUi),\n },\n \"&[data-disabled]\": {\n backgroundColor: tokens.grayA3,\n },\n },\n // Repaint the opaque gutter when the surrounding field is disabled.\n rootDisabledGutter: {\n [`&[data-disabled] [${SLOT_ATTR}='code-editor-line-number']`]: {\n backgroundColor: tokens.grayA3,\n },\n },\n // focus-within would keep the overlay visible throughout the editing session.\n rootFormatReveal: {\n \"&:hover [data-format-state]\": { opacity: 1 },\n },\n // The textarea defines the box; this decorative layer stretches without measurement.\n highlight: {\n ...CODE_METRICS,\n position: \"absolute\",\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n // Paint only: it must never take a click, a caret or a selection away from the control.\n pointerEvents: \"none\",\n userSelect: \"none\",\n color: tokens.grayA12,\n \"&[data-composing]\": {\n // Provisional IME text lives in the textarea, so the layer would be showing stale colours\n // over it. Declared after the base so it wins by source order.\n opacity: 0,\n },\n },\n /** With a gutter, the left padding moves into the number cell so the cell can pin flush. */\n highlightGutter: {\n paddingLeft: 0,\n },\n textarea: {\n ...CODE_METRICS,\n position: \"relative\",\n width: \"100%\",\n minWidth: 0,\n backgroundColor: \"transparent\",\n // The glyphs come from the layer beneath; only the caret is painted here.\n color: \"transparent\",\n caretColor: tokens.grayA12,\n overflowX: \"auto\",\n overflowY: \"auto\",\n // The root paints the ring for the whole surface; a second one on the control would double it.\n outlineStyle: \"none\",\n \"::placeholder\": {\n color: tokens.grayA8,\n // Placeholders are the textarea's own paint, so they need a real colour despite the above.\n WebkitTextFillColor: tokens.grayA8,\n },\n \"::selection\": {\n // An alpha tint, so highlighted glyphs stay legible through the selection band instead of\n // being covered by it — transparent text under an opaque selection is invisible text.\n backgroundColor: tokens.accentA5,\n },\n \":disabled\": {\n cursor: \"not-allowed\",\n },\n \"&[data-composing]\": {\n // Reveal what the IME is composing. Without this the author types blind through a CJK\n // composition, which is the one way this technique can fail outright.\n color: tokens.grayA12,\n },\n },\n // Keep textarea glyphs aligned with the highlighted rows.\n textareaGutter: {\n paddingLeft: `calc(${tokens.spacingElement2} + var(${GUTTER}) + ${tokens.spacingElement3})`,\n },\n // Unsupported browsers fall back to the native rows height.\n autoSize: {\n fieldSizing: \"content\",\n },\n resizeNone: {\n resize: \"none\",\n },\n resizeVertical: {\n resize: \"vertical\",\n },\n resizeHorizontal: {\n resize: \"horizontal\",\n },\n resizeBoth: {\n resize: \"both\",\n },\n noWrap: {\n whiteSpace: \"pre\",\n overflowWrap: \"normal\",\n },\n wrap: {\n whiteSpace: \"pre-wrap\",\n overflowWrap: \"break-word\",\n },\n // Width constraints below require a block formatting context.\n codeRows: {\n display: \"block\",\n },\n // Give the sticky gutter and active-line band the full width of unwrapped code.\n codeNoWrap: {\n width: \"max-content\",\n minWidth: \"100%\",\n },\n line: {\n display: \"flex\",\n width: \"100%\",\n },\n /** The band under the caret's line. See `caretLine` in the component for when it is on. */\n lineActive: {\n backgroundImage: `linear-gradient(${tokens.grayA2}, ${tokens.grayA2})`,\n },\n lineNumber: {\n userSelect: \"none\",\n textAlign: \"right\",\n flexGrow: 0,\n flexShrink: 0,\n color: tokens.grayA8,\n boxSizing: \"border-box\",\n width: `calc(var(${GUTTER}) + ${tokens.spacingElement2} + ${tokens.spacingElement3})`,\n paddingLeft: tokens.spacingElement2,\n paddingRight: tokens.spacingElement3,\n // Pinned, so a long line scrolled sideways does not take the numbers with it. Opaque, because\n // scrolled code passes underneath.\n position: \"sticky\",\n left: 0,\n backgroundColor: tokens.surfaceField,\n },\n /** The caret's line number, lifted out of the gutter's grey. */\n lineNumberActive: {\n color: tokens.grayA12,\n },\n lineContent: {\n minWidth: 0,\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"auto\",\n },\n lineContentWrap: {\n overflowWrap: \"break-word\",\n },\n // Underline only the text; a line fill would compete with selection and active-line paint.\n diagnosticError: {\n textDecorationLine: \"underline\",\n textDecorationStyle: \"wavy\",\n textDecorationColor: SEVERITY_TOKENS.error.rule,\n textDecorationSkipInk: \"none\",\n textUnderlineOffset: \"0.2em\",\n },\n diagnosticWarning: {\n textDecorationLine: \"underline\",\n textDecorationStyle: \"wavy\",\n textDecorationColor: SEVERITY_TOKENS.warning.rule,\n textDecorationSkipInk: \"none\",\n textUnderlineOffset: \"0.2em\",\n },\n diagnosticInfo: {\n textDecorationLine: \"underline\",\n textDecorationStyle: \"wavy\",\n textDecorationColor: SEVERITY_TOKENS.info.rule,\n textDecorationSkipInk: \"none\",\n textUnderlineOffset: \"0.2em\",\n },\n numberError: { color: SEVERITY_TOKENS.error.number },\n numberWarning: { color: SEVERITY_TOKENS.warning.number },\n numberInfo: { color: SEVERITY_TOKENS.info.number },\n format: {\n position: \"absolute\",\n top: tokens.spacingElement05,\n right: tokens.spacingElement05,\n zIndex: 1,\n backgroundColor: tokens.surfaceField,\n opacity: 0,\n transitionProperty: \"opacity\",\n transitionDuration: \"120ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0s\",\n },\n \"@media (hover: none)\": {\n opacity: 1,\n },\n // After the base, so they win by source order (AGENTS.md rule 2).\n \"&:focus-visible\": { opacity: 1 },\n \"&[data-format-state='pending']\": { opacity: 1 },\n },\n srOnly: {\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n ...shorthands.padding(0),\n ...shorthands.margin(\"-1px\"),\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n },\n})\n\nconst FormatIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n <path d=\"M4 5h16\" />\n <path d=\"M9 10h11\" />\n <path d=\"M9 15h7\" />\n <path d=\"M4 20h16\" />\n </svg>\n)\n\nexport type CodeEditorResize = \"none\" | \"vertical\" | \"horizontal\" | \"both\"\n\nexport type CodeEditorProps = Omit<\n React.ComponentProps<\"textarea\">,\n \"value\" | \"defaultValue\" | \"wrap\" | \"children\"\n> & {\n /** Controlled source text. Omit for an uncontrolled editor. */\n value?: string\n /** Initial source text for an uncontrolled editor. Ignored when `value` is passed. */\n defaultValue?: string\n /** The next source text, after any edit — typing, paste, Tab indentation, or a format. */\n onValueChange?: (value: string) => void\n /** Language grammar used for syntax highlighting. Unknown values fall back to plain text. */\n language?: string\n /**\n * Soft-wrap long lines. Off by default, so a long line scrolls rather than silently folding.\n *\n * This replaces the native `wrap` attribute's `\"off\" | \"soft\" | \"hard\"`, whose `\"hard\"` value\n * rewrites the submitted value with real newlines — never what a code buffer wants.\n */\n wrap?: boolean\n /** Which directions the caller may drag to resize. Defaults to `none` under `autoSize`. */\n resize?: CodeEditorResize\n /**\n * Let Tab and Shift+Tab indent instead of moving focus.\n *\n * Off by default, because a textarea that swallows Tab is a keyboard trap. When on, Escape\n * releases the next Tab to focus movement — the escape hatch every code editor that takes Tab\n * has to provide — and the release lasts until the next keystroke or refocus.\n */\n indentWithTab?: boolean\n /** Spaces inserted per indent level, and the rendered width of a literal tab. */\n indentSize?: number\n /** Marks the control invalid: sets `aria-invalid` and the invalid styling. */\n invalid?: boolean\n /**\n * Render a line-number gutter, and mark the line the caret is on. Off by default: on the four-\n * line snippets this component is for, numbers are a column of noise that also costs horizontal\n * space.\n */\n showLineNumbers?: boolean\n /**\n * Problems the CALLER found, one per line. Nothing here computes them. Rendered as a wavy rule\n * under the line and a coloured gutter number, and enumerated in a visually hidden list that is\n * added to the control's `aria-describedby` — so a screen reader gets the text on focus rather\n * than a colour it cannot see.\n */\n diagnostics?: readonly CodeDiagnostic[]\n /**\n * Reformat the buffer. The caller supplies the formatter; this component supplies the keystroke,\n * the caret, and the announcement. Bound to **Shift+Alt+F**, VS Code's \"Format Document\", and to\n * a quiet button revealed on hover.\n */\n onFormat?: (value: string) => string | Promise<string>\n /** Called when the formatter threw, rejected, or its result had to be discarded. */\n onFormatError?: (error: unknown) => void\n /** Accessible name of the format button. */\n formatLabel?: string\n /** Announced after the formatter ran. */\n formattedLabel?: string\n /** Announced when the formatter failed or its result was discarded. */\n formatErrorLabel?: string\n /**\n * Grow with the content instead of reserving a fixed height.\n *\n * `rows` becomes the minimum and `maxRows` the maximum, past which the editor scrolls. Off by\n * default, and progressive: browsers without CSS `field-sizing` fall back to `rows`, which is\n * what this component did before the property existed.\n */\n autoSize?: boolean\n /** With `autoSize`, the height past which the editor scrolls instead of growing. */\n maxRows?: number\n}\n\nexport const CodeEditor = React.forwardRef<\n HTMLTextAreaElement,\n CodeEditorProps\n>(function CodeEditor(\n {\n value,\n defaultValue,\n onValueChange,\n onChange,\n onKeyDown,\n onBlur,\n onFocus,\n onSelect,\n onScroll,\n onCompositionStart,\n onCompositionEnd,\n language,\n wrap = false,\n resize,\n indentWithTab = false,\n indentSize = 2,\n invalid = false,\n readOnly = false,\n disabled = false,\n showLineNumbers = false,\n diagnostics,\n onFormat,\n onFormatError,\n formatLabel = \"Format code\",\n formattedLabel = \"Formatted\",\n formatErrorLabel = \"Formatting failed\",\n autoSize = false,\n maxRows,\n rows,\n className,\n style,\n spellCheck = false,\n autoComplete = \"off\",\n autoCorrect = \"off\",\n autoCapitalize = \"off\",\n dir = \"ltr\",\n ...props\n },\n forwardedRef\n) {\n const styles = useStyles()\n const reactId = React.useId()\n const diagnosticsId = `${reactId}-diagnostics`\n\n const isControlled = value !== undefined\n const [uncontrolled, setUncontrolled] = React.useState(defaultValue ?? \"\")\n const current = isControlled ? value : uncontrolled\n\n const renderTokens = useCodeTokenRenderer()\n const highlightRef = React.useRef<HTMLPreElement | null>(null)\n\n const [composing, setComposing] = React.useState(false)\n\n const innerRef = React.useRef<HTMLTextAreaElement | null>(null)\n const setRefs = React.useCallback(\n (el: HTMLTextAreaElement | null) => {\n innerRef.current = el\n if (typeof forwardedRef === \"function\") forwardedRef(el)\n else if (forwardedRef) forwardedRef.current = el\n },\n [forwardedRef]\n )\n\n // Escape releases the next Tab without triggering a render.\n const tabReleased = React.useRef(false)\n\n const commit = React.useCallback(\n (next: string) => {\n if (!isControlled) setUncontrolled(next)\n onValueChange?.(next)\n },\n [isControlled, onValueChange]\n )\n\n const lineCount = React.useMemo(() => current.split(\"\\n\").length, [current])\n const severities = React.useMemo(\n () => severityByLine(diagnostics, lineCount),\n [diagnostics, lineCount]\n )\n const listed = React.useMemo(\n () => visibleDiagnostics(diagnostics, lineCount),\n [diagnostics, lineCount]\n )\n const rowMode = showLineNumbers || severities.size > 0\n\n // Null while blurred or range-selected, when an active-line band would be misleading.\n const [caretLine, setCaretLine] = React.useState<number | null>(null)\n\n const syncCaretLine = React.useCallback(() => {\n // Avoid caret state and rerenders when no row affordance is enabled.\n if (!rowMode) return\n const el = innerRef.current\n if (el === null) return\n if (el.selectionStart !== el.selectionEnd) {\n setCaretLine(null)\n return\n }\n setCaretLine(lineIndexAt(el.value, el.selectionStart ?? 0))\n }, [rowMode])\n\n const handleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n commit(event.target.value)\n onChange?.(event)\n },\n [commit, onChange]\n )\n\n const handleSelect = React.useCallback(\n (event: React.SyntheticEvent<HTMLTextAreaElement>) => {\n syncCaretLine()\n onSelect?.(event)\n },\n [onSelect, syncCaretLine]\n )\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTextAreaElement>) => {\n syncCaretLine()\n onFocus?.(event)\n },\n [onFocus, syncCaretLine]\n )\n\n // The ref gates calls synchronously; state paints the pending affordance.\n const formatPending = React.useRef(false)\n const [formatting, setFormatting] = React.useState(false)\n const [formatStatus, setFormatStatus] = React.useState(\"\")\n const formatTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n React.useEffect(\n () => () => {\n if (formatTimer.current !== null) clearTimeout(formatTimer.current)\n },\n []\n )\n\n const announceFormat = React.useCallback((message: string) => {\n setFormatStatus(message)\n if (formatTimer.current !== null) clearTimeout(formatTimer.current)\n // Clearing lets a repeated identical outcome be announced again.\n formatTimer.current = setTimeout(() => {\n formatTimer.current = null\n setFormatStatus(\"\")\n }, FORMAT_FEEDBACK_MS)\n }, [])\n\n const runFormat = React.useCallback(async () => {\n if (onFormat === undefined || readOnly || disabled) return\n const el = innerRef.current\n if (el === null) return\n // Do not queue stale work behind an in-flight formatter.\n if (formatPending.current) return\n\n const source = el.value\n formatPending.current = true\n setFormatting(true)\n\n let next: string\n try {\n next = await onFormat(source)\n } catch (error) {\n formatPending.current = false\n setFormatting(false)\n announceFormat(formatErrorLabel)\n onFormatError?.(error ?? new Error(\"Formatting failed\"))\n return\n }\n\n formatPending.current = false\n setFormatting(false)\n\n const live = innerRef.current\n if (live === null) return\n if (live.value !== source) {\n // Never overwrite edits made while the formatter was running.\n announceFormat(formatErrorLabel)\n onFormatError?.(\n new Error(\"Formatting discarded: the value changed while formatting\")\n )\n return\n }\n\n if (next !== source) {\n const caret = caretAfterRewrite(source, next, live.selectionStart ?? 0)\n // Place the caret before React reconciles the controlled value.\n live.value = next\n live.setSelectionRange(caret, caret)\n commit(next)\n }\n announceFormat(formattedLabel)\n }, [\n announceFormat,\n commit,\n disabled,\n formatErrorLabel,\n formattedLabel,\n onFormat,\n onFormatError,\n readOnly,\n ])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n onKeyDown?.(event)\n if (event.defaultPrevented) return\n if (readOnly || disabled) return\n\n // Shift+Alt+F, matched on `code` rather than `key`: Alt rewrites `key` on macOS layouts, so\n // the physical key is the only stable identity this chord has.\n if (\n onFormat !== undefined &&\n event.altKey &&\n event.shiftKey &&\n !event.ctrlKey &&\n !event.metaKey &&\n (event.code === \"KeyF\" || event.key.toLowerCase() === \"f\")\n ) {\n event.preventDefault()\n tabReleased.current = false\n void runFormat()\n return\n }\n\n if (!indentWithTab) return\n\n if (event.key === \"Escape\") {\n // Deliberately NOT prevented: an editor inside a Dialog must still let Escape close it.\n // The latch is the whole effect.\n tabReleased.current = true\n return\n }\n\n if (event.key !== \"Tab\") {\n tabReleased.current = false\n return\n }\n // A released Tab, or any modified Tab, is focus movement. Shift is the one modifier that\n // still means indentation, because Shift+Tab is outdent.\n if (tabReleased.current || event.ctrlKey || event.metaKey || event.altKey)\n return\n\n const el = event.currentTarget\n const next = applyIndent(\n {\n value: el.value,\n selectionStart: el.selectionStart ?? 0,\n selectionEnd: el.selectionEnd ?? 0,\n },\n { outdent: event.shiftKey, indentSize }\n )\n if (\n next.value === el.value &&\n next.selectionStart === el.selectionStart &&\n next.selectionEnd === el.selectionEnd\n ) {\n // Shift+Tab on an already-flush line changes nothing; let it move focus rather than\n // silently eating the key.\n return\n }\n\n event.preventDefault()\n // Write the DOM before the state update so the caret lands where the transform said. React\n // then renders the same string, sees the node already holds it, and leaves the selection\n // alone — restoring it from an effect would fight the browser for a frame first.\n el.value = next.value\n el.setSelectionRange(next.selectionStart, next.selectionEnd)\n commit(next.value)\n },\n [\n commit,\n disabled,\n indentSize,\n indentWithTab,\n onFormat,\n onKeyDown,\n readOnly,\n runFormat,\n ]\n )\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLTextAreaElement>) => {\n tabReleased.current = false\n setCaretLine(null)\n onBlur?.(event)\n },\n [onBlur]\n )\n\n const handleScroll = React.useCallback(\n (event: React.UIEvent<HTMLTextAreaElement>) => {\n const layer = highlightRef.current\n if (layer !== null) {\n // Synchronous, deliberately. `scroll` is not cancelable and fires at a high rate, and the\n // usual advice is to throttle it — but deferring to a frame puts the colours behind the\n // text for that frame, which is exactly the artefact this sync exists to prevent. Two\n // property writes are cheaper than the reflow a throttle would be saving.\n layer.scrollTop = event.currentTarget.scrollTop\n layer.scrollLeft = event.currentTarget.scrollLeft\n }\n onScroll?.(event)\n },\n [onScroll]\n )\n\n const handleCompositionStart = React.useCallback(\n (event: React.CompositionEvent<HTMLTextAreaElement>) => {\n setComposing(true)\n onCompositionStart?.(event)\n },\n [onCompositionStart]\n )\n\n const handleCompositionEnd = React.useCallback(\n (event: React.CompositionEvent<HTMLTextAreaElement>) => {\n setComposing(false)\n onCompositionEnd?.(event)\n },\n [onCompositionEnd]\n )\n\n /**\n * A `<pre>` does not render a final empty line, so a value ending in a newline would leave the\n * layer one line short of the textarea and everything below the fold misaligned. The extra space\n * gives that last line something to occupy.\n */\n const highlightSource = rowMode\n ? current\n : current.endsWith(\"\\n\")\n ? `${current} `\n : current\n\n // Synchronous tokenization: the server render and the first client render produce the same\n // markup, so there is nothing for hydration to reconcile.\n const highlighted = React.useMemo(\n () => highlightCode(highlightSource, language),\n [highlightSource, language]\n )\n\n const plainLines = React.useMemo(\n () => (rowMode ? current.split(\"\\n\") : null),\n [current, rowMode]\n )\n const tokenLines = React.useMemo(\n () =>\n rowMode && highlighted !== null ? splitTokenLines(highlighted) : null,\n [highlighted, rowMode]\n )\n\n const wrapStyle = wrap ? styles.wrap : styles.noWrap\n\n const effectiveResize = resize ?? (autoSize ? \"none\" : \"vertical\")\n const resizeStyle =\n effectiveResize === \"vertical\"\n ? styles.resizeVertical\n : effectiveResize === \"horizontal\"\n ? styles.resizeHorizontal\n : effectiveResize === \"both\"\n ? styles.resizeBoth\n : styles.resizeNone\n\n /**\n * `rows` is ignored under `field-sizing: content`, so it is translated into the floor it means.\n * The terms are the ones `CODE_METRICS` sets: N line boxes plus the block padding, with the\n * control's border already at zero and `box-sizing: border-box`.\n */\n const autoSizeStyle = autoSize\n ? {\n minHeight: `calc(${rows ?? 3} * ${tokens.leadingXs} + ${tokens.spacingElement2} * 2)`,\n maxHeight:\n maxRows === undefined\n ? undefined\n : `calc(${maxRows} * ${tokens.leadingXs} + ${tokens.spacingElement2} * 2)`,\n }\n : undefined\n\n const rootStyle = showLineNumbers\n ? ({\n [GUTTER]: `${gutterDigits(lineCount)}ch`,\n ...style,\n } as React.CSSProperties)\n : style\n\n const describedBy =\n listed.length === 0\n ? props[\"aria-describedby\"]\n : [props[\"aria-describedby\"], diagnosticsId].filter(Boolean).join(\" \")\n\n const severityClass = {\n error: styles.diagnosticError,\n warning: styles.diagnosticWarning,\n info: styles.diagnosticInfo,\n } as const\n const numberClass = {\n error: styles.numberError,\n warning: styles.numberWarning,\n info: styles.numberInfo,\n } as const\n\n return (\n <div\n data-slot=\"code-editor\"\n {...{ [SLOT_ATTR]: \"code-editor\" }}\n data-language={language}\n // Value-less boolean attributes, so `&[data-invalid]` and `&[data-disabled]` match the way\n // Field's do rather than matching the string \"false\".\n data-invalid={invalid || undefined}\n data-disabled={disabled || undefined}\n data-readonly={readOnly || undefined}\n data-formatting={formatting || undefined}\n // `className` and `style` address the component, which is this element — the same contract\n // every other component in the package offers. Everything else in `...props` is a textarea\n // attribute and lands on the control below.\n className={mergeClasses(\n styles.root,\n showLineNumbers ? styles.rootDisabledGutter : undefined,\n onFormat === undefined ? undefined : styles.rootFormatReveal,\n className\n )}\n style={rootStyle}\n >\n {/*\n Decoration, and nothing else. `aria-hidden` because it is a duplicate of the textarea's own\n text and contains nothing focusable — the one case MDN names for it — so a screen reader\n reads the control once, not twice. `pointer-events: none` keeps clicks, the caret and\n selection on the control beneath it. CodeMirror marks its own gutter `aria-hidden` for the\n same reason: a line number is a position, and the position is already in the control.\n */}\n <pre\n ref={highlightRef}\n aria-hidden=\"true\"\n data-slot=\"code-editor-highlight\"\n {...{ [SLOT_ATTR]: \"code-editor-highlight\" }}\n data-composing={composing || undefined}\n className={mergeClasses(\n styles.highlight,\n showLineNumbers ? styles.highlightGutter : undefined,\n wrapStyle\n )}\n style={{ tabSize: indentSize }}\n >\n <code\n className={mergeClasses(\n plainLines === null ? undefined : styles.codeRows,\n plainLines !== null && !wrap ? styles.codeNoWrap : undefined\n )}\n >\n {plainLines === null\n ? highlighted === null\n ? highlightSource\n : renderTokens(highlighted)\n : plainLines.map((line, index) => {\n const severity = severities.get(index + 1)\n const active = caretLine === index\n return (\n <span\n key={index}\n data-slot=\"code-editor-line\"\n {...{ [SLOT_ATTR]: \"code-editor-line\" }}\n data-line={index + 1}\n data-active={active || undefined}\n data-severity={severity}\n className={mergeClasses(\n styles.line,\n active ? styles.lineActive : undefined\n )}\n >\n {showLineNumbers ? (\n <span\n data-slot=\"code-editor-line-number\"\n {...{ [SLOT_ATTR]: \"code-editor-line-number\" }}\n className={mergeClasses(\n styles.lineNumber,\n active ? styles.lineNumberActive : undefined,\n severity === undefined\n ? undefined\n : numberClass[severity]\n )}\n >\n {index + 1}\n </span>\n ) : null}\n <span\n data-slot=\"code-editor-line-content\"\n {...{ [SLOT_ATTR]: \"code-editor-line-content\" }}\n className={mergeClasses(\n styles.lineContent,\n wrap ? styles.lineContentWrap : undefined\n )}\n >\n {/* The rule goes on this inner span so it ends with the text rather than\n running out to the fold; the newline stays outside it. */}\n <span\n className={\n severity === undefined\n ? undefined\n : severityClass[severity]\n }\n >\n {tokenLines === null\n ? line\n : renderTokens(tokenLines[index] ?? [])}\n </span>\n {\"\\n\"}\n </span>\n </span>\n )\n })}\n </code>\n </pre>\n\n <textarea\n {...props}\n ref={setRefs}\n data-slot=\"code-editor-input\"\n {...{ [SLOT_ATTR]: \"code-editor-input\" }}\n value={current}\n rows={rows}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onSelect={handleSelect}\n onScroll={handleScroll}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n data-composing={composing || undefined}\n readOnly={readOnly}\n disabled={disabled}\n aria-invalid={invalid || undefined}\n aria-describedby={describedBy}\n aria-busy={formatting || undefined}\n // Code is not prose: a squiggle under every identifier is noise, and an editor that\n // capitalises `const` or \"corrects\" `-->` corrupts the buffer.\n spellCheck={spellCheck}\n autoComplete={autoComplete}\n autoCorrect={autoCorrect}\n autoCapitalize={autoCapitalize}\n // Source is left-to-right even on a right-to-left page; `auto` would flip a buffer that\n // happens to start with an RTL character in a string literal.\n dir={dir}\n wrap={wrap ? \"soft\" : \"off\"}\n // One indent level, one tab stop: a literal tab in the buffer renders exactly as wide as\n // the spaces Tab inserts. Dynamic, so it is an inline declaration rather than an atom.\n style={{ tabSize: indentSize, ...autoSizeStyle }}\n className={mergeClasses(\n styles.textarea,\n showLineNumbers ? styles.textareaGutter : undefined,\n autoSize ? styles.autoSize : undefined,\n wrapStyle,\n resizeStyle\n )}\n />\n\n {onFormat === undefined ? null : (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n data-format-state={formatting ? \"pending\" : \"idle\"}\n aria-label={formatLabel}\n disabled={disabled || readOnly || formatting}\n className={styles.format}\n // Keeps the caret where it is: without this the button takes focus on press and the\n // editor's selection — which the format is about to restore — is gone before it runs.\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n void runFormat()\n }}\n >\n <FormatIcon />\n </Button>\n )}\n\n {listed.length === 0 ? null : (\n <ul\n id={diagnosticsId}\n data-slot=\"code-editor-diagnostics\"\n {...{ [SLOT_ATTR]: \"code-editor-diagnostics\" }}\n className={styles.srOnly}\n >\n {listed.map((diagnostic, index) => (\n <li key={index}>\n {`${diagnostic.severity ?? \"error\"}, line ${diagnostic.line}${\n diagnostic.column === undefined\n ? \"\"\n : `, column ${diagnostic.column}`\n }: ${diagnostic.message}`}\n </li>\n ))}\n </ul>\n )}\n\n {onFormat === undefined ? null : (\n <span\n role=\"status\"\n aria-live=\"polite\"\n data-slot=\"code-editor-format-status\"\n {...{ [SLOT_ATTR]: \"code-editor-format-status\" }}\n className={styles.srOnly}\n >\n {formatStatus}\n </span>\n )}\n </div>\n )\n})\n"],"names":["FORMAT_FEEDBACK_MS","GUTTER","CODE_METRICS","shorthands","tokens.spacingElement2","tokens.fontMono","tokens.textXs","tokens.leadingXs","tokens.trackingNormal","tokens.fontWeightNormal","SEVERITY_TOKENS","tokens.errorUi","tokens.error11","tokens.warningUi","tokens.warning11","tokens.infoUi","tokens.info11","useStyles","makeZenithStyles","tokens.surfaceField","tokens.borderWidthField","tokens.borderField","tokens.surfaceRadiusField","tokens.focusRing","tokens.grayA3","SLOT_ATTR","tokens.grayA12","tokens.grayA8","tokens.accentA5","tokens.spacingElement3","tokens.grayA2","tokens.spacingElement05","FormatIcon","props","jsxs","jsx","CodeEditor","React","value","defaultValue","onValueChange","onChange","onKeyDown","onBlur","onFocus","onSelect","onScroll","onCompositionStart","onCompositionEnd","language","wrap","resize","indentWithTab","indentSize","invalid","readOnly","disabled","showLineNumbers","diagnostics","onFormat","onFormatError","formatLabel","formattedLabel","formatErrorLabel","autoSize","maxRows","rows","className","style","spellCheck","autoComplete","autoCorrect","autoCapitalize","dir","forwardedRef","styles","diagnosticsId","isControlled","uncontrolled","setUncontrolled","current","renderTokens","useCodeTokenRenderer","highlightRef","composing","setComposing","innerRef","setRefs","el","tabReleased","commit","next","lineCount","severities","severityByLine","listed","visibleDiagnostics","rowMode","caretLine","setCaretLine","syncCaretLine","lineIndexAt","handleChange","event","handleSelect","handleFocus","formatPending","formatting","setFormatting","formatStatus","setFormatStatus","formatTimer","announceFormat","message","runFormat","source","error","live","caret","caretAfterRewrite","handleKeyDown","applyIndent","handleBlur","handleScroll","layer","handleCompositionStart","handleCompositionEnd","highlightSource","highlighted","highlightCode","plainLines","tokenLines","splitTokenLines","wrapStyle","effectiveResize","resizeStyle","autoSizeStyle","rootStyle","gutterDigits","describedBy","severityClass","numberClass","mergeClasses","line","index","severity","active","Button","diagnostic"],"mappings":";;;;;;;;;;AA4BA,MAAMA,KAAqB,KAGrBC,KAAS,wBAMTC,KAAe;AAAA,EACnB,GAAGC,EAAW,OAAO,CAAC;AAAA,EACtB,GAAGA,EAAW,YAAY,CAAC;AAAA,EAC3B,GAAGA,EAAW,YAAY,MAAM;AAAA,EAChC,GAAGA,EAAW,QAAQC,CAAsB;AAAA,EAC5C,YAAYC;AAAAA,EACZ,UAAUC;AAAAA,EACV,YAAYC;AAAAA,EACZ,eAAeC;AAAAA,EACf,YAAYC;AAAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA;AAAA;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oB,EAAO,IAAI,CAACqD,GAAYJ,MACvB,gBAAA7G,EAAC,MAAA,EACE,UAAA,GAAGiH,EAAW,YAAY,OAAO,UAAUA,EAAW,IAAI,GACzDA,EAAW,WAAW,SAClB,KACA,YAAYA,EAAW,MAAM,EACnC,KAAKA,EAAW,OAAO,GAAA,GALhBJ,CAMT,CACD;AAAA,UAAA;AAAA,QAAA;AAAA,QAIJrF,MAAa,SAAY,OACxB,gBAAAxB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,aAAU;AAAA,YACV,aAAU;AAAA,YACJ,CAACV,CAAS,GAAG;AAAA,YACnB,WAAWkD,EAAO;AAAA,YAEjB,UAAAkC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
1
+ {"version":3,"file":"code-editor.js","sources":["../../../src/components/code-editor/code-editor.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { boxModel, nativeControl } from \"../../styles/host-reset\"\nimport * as tokens from \"../../tokens\"\nimport { Button } from \"../button/button\"\nimport { applyIndent } from \"./indent\"\nimport { highlightCode, splitTokenLines } from \"../../lib/code-highlight\"\nimport { useCodeTokenRenderer } from \"../../lib/code-tokens\"\nimport {\n caretAfterRewrite,\n gutterDigits,\n lineIndexAt,\n severityByLine,\n visibleDiagnostics,\n type CodeDiagnostic,\n type CodeDiagnosticSeverity,\n} from \"../../lib/code-lines\"\n\n/**\n * Compact code editing on a native textarea. Highlighting is decorative; the textarea remains the\n * only focusable, labelled, form-participating control. Formatting and diagnostics are supplied by\n * the caller rather than computed here.\n */\n\n/** How long a formatting outcome stays in the live region. */\nconst FORMAT_FEEDBACK_MS = 2000\n\n/** Shared gutter width for the number cells and textarea padding. */\nconst GUTTER = \"--zenith-code-gutter\"\n\n/**\n * Metrics shared by the textarea and highlight layer. `tabSize` varies per instance and gutter\n * padding intentionally differs between layers.\n */\nconst CODE_METRICS = {\n ...shorthands.margin(0),\n ...shorthands.borderWidth(0),\n ...shorthands.borderStyle(\"none\"),\n ...shorthands.padding(tokens.spacingElement2),\n fontFamily: tokens.fontMono,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n letterSpacing: tokens.trackingNormal,\n fontWeight: tokens.fontWeightNormal,\n textIndent: 0,\n boxSizing: \"border-box\",\n // A classic, space-consuming scrollbar narrows the textarea's content box but not the layer's,\n // which moves where wrapped lines break. Reserving the gutter on both keeps one content width.\n // Platforms with overlay scrollbars never had the problem.\n scrollbarGutter: \"stable\",\n} as const\n\n/** Core-sheet colours used by diagnostic rules and numbers. */\nconst SEVERITY_TOKENS: Record<\n CodeDiagnosticSeverity,\n { rule: string; number: string }\n> = {\n error: { rule: tokens.errorUi, number: tokens.error11 },\n warning: { rule: tokens.warningUi, number: tokens.warning11 },\n info: { rule: tokens.infoUi, number: tokens.info11 },\n}\n\nconst useStyles = makeZenithStyles({\n root: {\n ...boxModel,\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n position: \"relative\",\n backgroundColor: tokens.surfaceField,\n ...shorthands.borderWidth(tokens.borderWidthField),\n ...shorthands.borderStyle(\"solid\"),\n ...shorthands.borderColor(tokens.borderField),\n borderRadius: tokens.surfaceRadiusField,\n // Declared before the state rules below so those win by source order, per AGENTS.md rule 2.\n \"&:focus-within\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"-1px\",\n outlineColor: tokens.focusRing,\n },\n \"&[data-invalid]\": {\n ...shorthands.borderColor(tokens.errorUi),\n },\n \"&[data-disabled]\": {\n backgroundColor: tokens.grayA3,\n },\n },\n // Repaint the opaque gutter when the surrounding field is disabled.\n rootDisabledGutter: {\n [`&[data-disabled] [${SLOT_ATTR}='code-editor-line-number']`]: {\n backgroundColor: tokens.grayA3,\n },\n },\n // focus-within would keep the overlay visible throughout the editing session.\n rootFormatReveal: {\n \"&:hover [data-format-state]\": { opacity: 1 },\n },\n // The textarea defines the box; this decorative layer stretches without measurement.\n highlight: {\n ...CODE_METRICS,\n position: \"absolute\",\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n // Paint only: it must never take a click, a caret or a selection away from the control.\n pointerEvents: \"none\",\n userSelect: \"none\",\n color: tokens.grayA12,\n \"&[data-composing]\": {\n // Provisional IME text lives in the textarea, so the layer would be showing stale colours\n // over it. Declared after the base so it wins by source order.\n opacity: 0,\n },\n },\n /** With a gutter, the left padding moves into the number cell so the cell can pin flush. */\n highlightGutter: {\n ...boxModel,\n paddingLeft: 0,\n },\n textarea: {\n ...nativeControl,\n ...CODE_METRICS,\n position: \"relative\",\n width: \"100%\",\n minWidth: 0,\n backgroundColor: \"transparent\",\n // The glyphs come from the layer beneath; only the caret is painted here.\n color: \"transparent\",\n caretColor: tokens.grayA12,\n overflowX: \"auto\",\n overflowY: \"auto\",\n // The root paints the ring for the whole surface; a second one on the control would double it.\n outlineStyle: \"none\",\n \"::placeholder\": {\n color: tokens.grayA8,\n // Placeholders are the textarea's own paint, so they need a real colour despite the above.\n WebkitTextFillColor: tokens.grayA8,\n },\n \"::selection\": {\n // An alpha tint, so highlighted glyphs stay legible through the selection band instead of\n // being covered by it — transparent text under an opaque selection is invisible text.\n backgroundColor: tokens.accentA5,\n },\n \":disabled\": {\n cursor: \"not-allowed\",\n },\n \"&[data-composing]\": {\n // Reveal what the IME is composing. Without this the author types blind through a CJK\n // composition, which is the one way this technique can fail outright.\n color: tokens.grayA12,\n },\n },\n // Keep textarea glyphs aligned with the highlighted rows.\n textareaGutter: {\n ...boxModel,\n paddingLeft: `calc(${tokens.spacingElement2} + var(${GUTTER}) + ${tokens.spacingElement3})`,\n },\n // Unsupported browsers fall back to the native rows height.\n autoSize: {\n fieldSizing: \"content\",\n },\n resizeNone: {\n resize: \"none\",\n },\n resizeVertical: {\n resize: \"vertical\",\n },\n resizeHorizontal: {\n resize: \"horizontal\",\n },\n resizeBoth: {\n resize: \"both\",\n },\n noWrap: {\n whiteSpace: \"pre\",\n overflowWrap: \"normal\",\n },\n wrap: {\n whiteSpace: \"pre-wrap\",\n overflowWrap: \"break-word\",\n },\n // The UA gives `<code>` its own monospace family and size, so the pre's metrics would not reach\n // the rows without this.\n code: {\n fontFamily: tokens.fontMono,\n fontSize: \"1em\",\n },\n // Width constraints below require a block formatting context.\n codeRows: {\n display: \"block\",\n },\n // Give the sticky gutter and active-line band the full width of unwrapped code.\n codeNoWrap: {\n ...boxModel,\n width: \"max-content\",\n minWidth: \"100%\",\n },\n line: {\n ...boxModel,\n display: \"flex\",\n width: \"100%\",\n },\n /** The band under the caret's line. See `caretLine` in the component for when it is on. */\n lineActive: {\n backgroundImage: `linear-gradient(${tokens.grayA2}, ${tokens.grayA2})`,\n },\n lineNumber: {\n userSelect: \"none\",\n textAlign: \"right\",\n flexGrow: 0,\n flexShrink: 0,\n color: tokens.grayA8,\n boxSizing: \"border-box\",\n width: `calc(var(${GUTTER}) + ${tokens.spacingElement2} + ${tokens.spacingElement3})`,\n paddingLeft: tokens.spacingElement2,\n paddingRight: tokens.spacingElement3,\n // Pinned, so a long line scrolled sideways does not take the numbers with it. Opaque, because\n // scrolled code passes underneath.\n position: \"sticky\",\n left: 0,\n backgroundColor: tokens.surfaceField,\n },\n /** The caret's line number, lifted out of the gutter's grey. */\n lineNumberActive: {\n color: tokens.grayA12,\n },\n lineContent: {\n ...boxModel,\n minWidth: 0,\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"auto\",\n },\n lineContentWrap: {\n overflowWrap: \"break-word\",\n },\n // Underline only the text; a line fill would compete with selection and active-line paint.\n diagnosticError: {\n textDecorationLine: \"underline\",\n textDecorationStyle: \"wavy\",\n textDecorationColor: SEVERITY_TOKENS.error.rule,\n textDecorationSkipInk: \"none\",\n textUnderlineOffset: \"0.2em\",\n },\n diagnosticWarning: {\n textDecorationLine: \"underline\",\n textDecorationStyle: \"wavy\",\n textDecorationColor: SEVERITY_TOKENS.warning.rule,\n textDecorationSkipInk: \"none\",\n textUnderlineOffset: \"0.2em\",\n },\n diagnosticInfo: {\n textDecorationLine: \"underline\",\n textDecorationStyle: \"wavy\",\n textDecorationColor: SEVERITY_TOKENS.info.rule,\n textDecorationSkipInk: \"none\",\n textUnderlineOffset: \"0.2em\",\n },\n numberError: { color: SEVERITY_TOKENS.error.number },\n numberWarning: { color: SEVERITY_TOKENS.warning.number },\n numberInfo: { color: SEVERITY_TOKENS.info.number },\n format: {\n position: \"absolute\",\n top: tokens.spacingElement05,\n right: tokens.spacingElement05,\n zIndex: 1,\n backgroundColor: tokens.surfaceField,\n opacity: 0,\n transitionProperty: \"opacity\",\n transitionDuration: \"120ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0s\",\n },\n \"@media (hover: none)\": {\n opacity: 1,\n },\n // After the base, so they win by source order (AGENTS.md rule 2).\n \"&:focus-visible\": { opacity: 1 },\n \"&[data-format-state='pending']\": { opacity: 1 },\n },\n srOnly: {\n ...boxModel,\n position: \"absolute\",\n width: \"1px\",\n height: \"1px\",\n ...shorthands.padding(0),\n ...shorthands.margin(\"-1px\"),\n overflowX: \"hidden\",\n overflowY: \"hidden\",\n clip: \"rect(0, 0, 0, 0)\",\n whiteSpace: \"nowrap\",\n },\n})\n\nconst FormatIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n focusable=\"false\"\n {...props}\n >\n <path d=\"M4 5h16\" />\n <path d=\"M9 10h11\" />\n <path d=\"M9 15h7\" />\n <path d=\"M4 20h16\" />\n </svg>\n)\n\nexport type CodeEditorResize = \"none\" | \"vertical\" | \"horizontal\" | \"both\"\n\nexport type CodeEditorProps = Omit<\n React.ComponentProps<\"textarea\">,\n \"value\" | \"defaultValue\" | \"wrap\" | \"children\"\n> & {\n /** Controlled source text. Omit for an uncontrolled editor. */\n value?: string\n /** Initial source text for an uncontrolled editor. Ignored when `value` is passed. */\n defaultValue?: string\n /** The next source text, after any edit — typing, paste, Tab indentation, or a format. */\n onValueChange?: (value: string) => void\n /** Language grammar used for syntax highlighting. Unknown values fall back to plain text. */\n language?: string\n /**\n * Soft-wrap long lines. Off by default, so a long line scrolls rather than silently folding.\n *\n * This replaces the native `wrap` attribute's `\"off\" | \"soft\" | \"hard\"`, whose `\"hard\"` value\n * rewrites the submitted value with real newlines — never what a code buffer wants.\n */\n wrap?: boolean\n /** Which directions the caller may drag to resize. Defaults to `none` under `autoSize`. */\n resize?: CodeEditorResize\n /**\n * Let Tab and Shift+Tab indent instead of moving focus.\n *\n * Off by default, because a textarea that swallows Tab is a keyboard trap. When on, Escape\n * releases the next Tab to focus movement — the escape hatch every code editor that takes Tab\n * has to provide — and the release lasts until the next keystroke or refocus.\n */\n indentWithTab?: boolean\n /** Spaces inserted per indent level, and the rendered width of a literal tab. */\n indentSize?: number\n /** Marks the control invalid: sets `aria-invalid` and the invalid styling. */\n invalid?: boolean\n /**\n * Render a line-number gutter, and mark the line the caret is on. Off by default: on the four-\n * line snippets this component is for, numbers are a column of noise that also costs horizontal\n * space.\n */\n showLineNumbers?: boolean\n /**\n * Problems the CALLER found, one per line. Nothing here computes them. Rendered as a wavy rule\n * under the line and a coloured gutter number, and enumerated in a visually hidden list that is\n * added to the control's `aria-describedby` — so a screen reader gets the text on focus rather\n * than a colour it cannot see.\n */\n diagnostics?: readonly CodeDiagnostic[]\n /**\n * Reformat the buffer. The caller supplies the formatter; this component supplies the keystroke,\n * the caret, and the announcement. Bound to **Shift+Alt+F**, VS Code's \"Format Document\", and to\n * a quiet button revealed on hover.\n */\n onFormat?: (value: string) => string | Promise<string>\n /** Called when the formatter threw, rejected, or its result had to be discarded. */\n onFormatError?: (error: unknown) => void\n /** Accessible name of the format button. */\n formatLabel?: string\n /** Announced after the formatter ran. */\n formattedLabel?: string\n /** Announced when the formatter failed or its result was discarded. */\n formatErrorLabel?: string\n /**\n * Grow with the content instead of reserving a fixed height.\n *\n * `rows` becomes the minimum and `maxRows` the maximum, past which the editor scrolls. Off by\n * default, and progressive: browsers without CSS `field-sizing` fall back to `rows`, which is\n * what this component did before the property existed.\n */\n autoSize?: boolean\n /** With `autoSize`, the height past which the editor scrolls instead of growing. */\n maxRows?: number\n}\n\nexport const CodeEditor = React.forwardRef<\n HTMLTextAreaElement,\n CodeEditorProps\n>(function CodeEditor(\n {\n value,\n defaultValue,\n onValueChange,\n onChange,\n onKeyDown,\n onBlur,\n onFocus,\n onSelect,\n onScroll,\n onCompositionStart,\n onCompositionEnd,\n language,\n wrap = false,\n resize,\n indentWithTab = false,\n indentSize = 2,\n invalid = false,\n readOnly = false,\n disabled = false,\n showLineNumbers = false,\n diagnostics,\n onFormat,\n onFormatError,\n formatLabel = \"Format code\",\n formattedLabel = \"Formatted\",\n formatErrorLabel = \"Formatting failed\",\n autoSize = false,\n maxRows,\n rows,\n className,\n style,\n spellCheck = false,\n autoComplete = \"off\",\n autoCorrect = \"off\",\n autoCapitalize = \"off\",\n dir = \"ltr\",\n ...props\n },\n forwardedRef\n) {\n const styles = useStyles()\n const reactId = React.useId()\n const diagnosticsId = `${reactId}-diagnostics`\n\n const isControlled = value !== undefined\n const [uncontrolled, setUncontrolled] = React.useState(defaultValue ?? \"\")\n const current = isControlled ? value : uncontrolled\n\n const renderTokens = useCodeTokenRenderer()\n const highlightRef = React.useRef<HTMLPreElement | null>(null)\n\n const [composing, setComposing] = React.useState(false)\n\n const innerRef = React.useRef<HTMLTextAreaElement | null>(null)\n const setRefs = React.useCallback(\n (el: HTMLTextAreaElement | null) => {\n innerRef.current = el\n if (typeof forwardedRef === \"function\") forwardedRef(el)\n else if (forwardedRef) forwardedRef.current = el\n },\n [forwardedRef]\n )\n\n // Escape releases the next Tab without triggering a render.\n const tabReleased = React.useRef(false)\n\n const commit = React.useCallback(\n (next: string) => {\n if (!isControlled) setUncontrolled(next)\n onValueChange?.(next)\n },\n [isControlled, onValueChange]\n )\n\n const lineCount = React.useMemo(() => current.split(\"\\n\").length, [current])\n const severities = React.useMemo(\n () => severityByLine(diagnostics, lineCount),\n [diagnostics, lineCount]\n )\n const listed = React.useMemo(\n () => visibleDiagnostics(diagnostics, lineCount),\n [diagnostics, lineCount]\n )\n const rowMode = showLineNumbers || severities.size > 0\n\n // Null while blurred or range-selected, when an active-line band would be misleading.\n const [caretLine, setCaretLine] = React.useState<number | null>(null)\n\n const syncCaretLine = React.useCallback(() => {\n // Avoid caret state and rerenders when no row affordance is enabled.\n if (!rowMode) return\n const el = innerRef.current\n if (el === null) return\n if (el.selectionStart !== el.selectionEnd) {\n setCaretLine(null)\n return\n }\n setCaretLine(lineIndexAt(el.value, el.selectionStart ?? 0))\n }, [rowMode])\n\n const handleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n commit(event.target.value)\n onChange?.(event)\n },\n [commit, onChange]\n )\n\n const handleSelect = React.useCallback(\n (event: React.SyntheticEvent<HTMLTextAreaElement>) => {\n syncCaretLine()\n onSelect?.(event)\n },\n [onSelect, syncCaretLine]\n )\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLTextAreaElement>) => {\n syncCaretLine()\n onFocus?.(event)\n },\n [onFocus, syncCaretLine]\n )\n\n // The ref gates calls synchronously; state paints the pending affordance.\n const formatPending = React.useRef(false)\n const [formatting, setFormatting] = React.useState(false)\n const [formatStatus, setFormatStatus] = React.useState(\"\")\n const formatTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n React.useEffect(\n () => () => {\n if (formatTimer.current !== null) clearTimeout(formatTimer.current)\n },\n []\n )\n\n const announceFormat = React.useCallback((message: string) => {\n setFormatStatus(message)\n if (formatTimer.current !== null) clearTimeout(formatTimer.current)\n // Clearing lets a repeated identical outcome be announced again.\n formatTimer.current = setTimeout(() => {\n formatTimer.current = null\n setFormatStatus(\"\")\n }, FORMAT_FEEDBACK_MS)\n }, [])\n\n const runFormat = React.useCallback(async () => {\n if (onFormat === undefined || readOnly || disabled) return\n const el = innerRef.current\n if (el === null) return\n // Do not queue stale work behind an in-flight formatter.\n if (formatPending.current) return\n\n const source = el.value\n formatPending.current = true\n setFormatting(true)\n\n let next: string\n try {\n next = await onFormat(source)\n } catch (error) {\n formatPending.current = false\n setFormatting(false)\n announceFormat(formatErrorLabel)\n onFormatError?.(error ?? new Error(\"Formatting failed\"))\n return\n }\n\n formatPending.current = false\n setFormatting(false)\n\n const live = innerRef.current\n if (live === null) return\n if (live.value !== source) {\n // Never overwrite edits made while the formatter was running.\n announceFormat(formatErrorLabel)\n onFormatError?.(\n new Error(\"Formatting discarded: the value changed while formatting\")\n )\n return\n }\n\n if (next !== source) {\n const caret = caretAfterRewrite(source, next, live.selectionStart ?? 0)\n // Place the caret before React reconciles the controlled value.\n live.value = next\n live.setSelectionRange(caret, caret)\n commit(next)\n }\n announceFormat(formattedLabel)\n }, [\n announceFormat,\n commit,\n disabled,\n formatErrorLabel,\n formattedLabel,\n onFormat,\n onFormatError,\n readOnly,\n ])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n onKeyDown?.(event)\n if (event.defaultPrevented) return\n if (readOnly || disabled) return\n\n // Shift+Alt+F, matched on `code` rather than `key`: Alt rewrites `key` on macOS layouts, so\n // the physical key is the only stable identity this chord has.\n if (\n onFormat !== undefined &&\n event.altKey &&\n event.shiftKey &&\n !event.ctrlKey &&\n !event.metaKey &&\n (event.code === \"KeyF\" || event.key.toLowerCase() === \"f\")\n ) {\n event.preventDefault()\n tabReleased.current = false\n void runFormat()\n return\n }\n\n if (!indentWithTab) return\n\n if (event.key === \"Escape\") {\n // Deliberately NOT prevented: an editor inside a Dialog must still let Escape close it.\n // The latch is the whole effect.\n tabReleased.current = true\n return\n }\n\n if (event.key !== \"Tab\") {\n tabReleased.current = false\n return\n }\n // A released Tab, or any modified Tab, is focus movement. Shift is the one modifier that\n // still means indentation, because Shift+Tab is outdent.\n if (tabReleased.current || event.ctrlKey || event.metaKey || event.altKey)\n return\n\n const el = event.currentTarget\n const next = applyIndent(\n {\n value: el.value,\n selectionStart: el.selectionStart ?? 0,\n selectionEnd: el.selectionEnd ?? 0,\n },\n { outdent: event.shiftKey, indentSize }\n )\n if (\n next.value === el.value &&\n next.selectionStart === el.selectionStart &&\n next.selectionEnd === el.selectionEnd\n ) {\n // Shift+Tab on an already-flush line changes nothing; let it move focus rather than\n // silently eating the key.\n return\n }\n\n event.preventDefault()\n // Write the DOM before the state update so the caret lands where the transform said. React\n // then renders the same string, sees the node already holds it, and leaves the selection\n // alone — restoring it from an effect would fight the browser for a frame first.\n el.value = next.value\n el.setSelectionRange(next.selectionStart, next.selectionEnd)\n commit(next.value)\n },\n [\n commit,\n disabled,\n indentSize,\n indentWithTab,\n onFormat,\n onKeyDown,\n readOnly,\n runFormat,\n ]\n )\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLTextAreaElement>) => {\n tabReleased.current = false\n setCaretLine(null)\n onBlur?.(event)\n },\n [onBlur]\n )\n\n const handleScroll = React.useCallback(\n (event: React.UIEvent<HTMLTextAreaElement>) => {\n const layer = highlightRef.current\n if (layer !== null) {\n // Synchronous, deliberately. `scroll` is not cancelable and fires at a high rate, and the\n // usual advice is to throttle it — but deferring to a frame puts the colours behind the\n // text for that frame, which is exactly the artefact this sync exists to prevent. Two\n // property writes are cheaper than the reflow a throttle would be saving.\n layer.scrollTop = event.currentTarget.scrollTop\n layer.scrollLeft = event.currentTarget.scrollLeft\n }\n onScroll?.(event)\n },\n [onScroll]\n )\n\n const handleCompositionStart = React.useCallback(\n (event: React.CompositionEvent<HTMLTextAreaElement>) => {\n setComposing(true)\n onCompositionStart?.(event)\n },\n [onCompositionStart]\n )\n\n const handleCompositionEnd = React.useCallback(\n (event: React.CompositionEvent<HTMLTextAreaElement>) => {\n setComposing(false)\n onCompositionEnd?.(event)\n },\n [onCompositionEnd]\n )\n\n /**\n * A `<pre>` does not render a final empty line, so a value ending in a newline would leave the\n * layer one line short of the textarea and everything below the fold misaligned. The extra space\n * gives that last line something to occupy.\n */\n const highlightSource = rowMode\n ? current\n : current.endsWith(\"\\n\")\n ? `${current} `\n : current\n\n // Synchronous tokenization: the server render and the first client render produce the same\n // markup, so there is nothing for hydration to reconcile.\n const highlighted = React.useMemo(\n () => highlightCode(highlightSource, language),\n [highlightSource, language]\n )\n\n const plainLines = React.useMemo(\n () => (rowMode ? current.split(\"\\n\") : null),\n [current, rowMode]\n )\n const tokenLines = React.useMemo(\n () =>\n rowMode && highlighted !== null ? splitTokenLines(highlighted) : null,\n [highlighted, rowMode]\n )\n\n const wrapStyle = wrap ? styles.wrap : styles.noWrap\n\n const effectiveResize = resize ?? (autoSize ? \"none\" : \"vertical\")\n const resizeStyle =\n effectiveResize === \"vertical\"\n ? styles.resizeVertical\n : effectiveResize === \"horizontal\"\n ? styles.resizeHorizontal\n : effectiveResize === \"both\"\n ? styles.resizeBoth\n : styles.resizeNone\n\n /**\n * `rows` is ignored under `field-sizing: content`, so it is translated into the floor it means.\n * The terms are the ones `CODE_METRICS` sets: N line boxes plus the block padding, with the\n * control's border already at zero and `box-sizing: border-box`.\n */\n const autoSizeStyle = autoSize\n ? {\n minHeight: `calc(${rows ?? 3} * ${tokens.leadingXs} + ${tokens.spacingElement2} * 2)`,\n maxHeight:\n maxRows === undefined\n ? undefined\n : `calc(${maxRows} * ${tokens.leadingXs} + ${tokens.spacingElement2} * 2)`,\n }\n : undefined\n\n const rootStyle = showLineNumbers\n ? ({\n [GUTTER]: `${gutterDigits(lineCount)}ch`,\n ...style,\n } as React.CSSProperties)\n : style\n\n const describedBy =\n listed.length === 0\n ? props[\"aria-describedby\"]\n : [props[\"aria-describedby\"], diagnosticsId].filter(Boolean).join(\" \")\n\n const severityClass = {\n error: styles.diagnosticError,\n warning: styles.diagnosticWarning,\n info: styles.diagnosticInfo,\n } as const\n const numberClass = {\n error: styles.numberError,\n warning: styles.numberWarning,\n info: styles.numberInfo,\n } as const\n\n return (\n <div\n data-slot=\"code-editor\"\n {...{ [SLOT_ATTR]: \"code-editor\" }}\n data-language={language}\n // Value-less boolean attributes, so `&[data-invalid]` and `&[data-disabled]` match the way\n // Field's do rather than matching the string \"false\".\n data-invalid={invalid || undefined}\n data-disabled={disabled || undefined}\n data-readonly={readOnly || undefined}\n data-formatting={formatting || undefined}\n // `className` and `style` address the component, which is this element — the same contract\n // every other component in the package offers. Everything else in `...props` is a textarea\n // attribute and lands on the control below.\n className={mergeClasses(\n styles.root,\n showLineNumbers ? styles.rootDisabledGutter : undefined,\n onFormat === undefined ? undefined : styles.rootFormatReveal,\n className\n )}\n style={rootStyle}\n >\n {/*\n Decoration, and nothing else. `aria-hidden` because it is a duplicate of the textarea's own\n text and contains nothing focusable — the one case MDN names for it — so a screen reader\n reads the control once, not twice. `pointer-events: none` keeps clicks, the caret and\n selection on the control beneath it. CodeMirror marks its own gutter `aria-hidden` for the\n same reason: a line number is a position, and the position is already in the control.\n */}\n <pre\n ref={highlightRef}\n aria-hidden=\"true\"\n data-slot=\"code-editor-highlight\"\n {...{ [SLOT_ATTR]: \"code-editor-highlight\" }}\n data-composing={composing || undefined}\n className={mergeClasses(\n styles.highlight,\n showLineNumbers ? styles.highlightGutter : undefined,\n wrapStyle\n )}\n style={{ tabSize: indentSize }}\n >\n <code\n className={mergeClasses(\n styles.code,\n plainLines === null ? undefined : styles.codeRows,\n plainLines !== null && !wrap ? styles.codeNoWrap : undefined\n )}\n >\n {plainLines === null\n ? highlighted === null\n ? highlightSource\n : renderTokens(highlighted)\n : plainLines.map((line, index) => {\n const severity = severities.get(index + 1)\n const active = caretLine === index\n return (\n <span\n key={index}\n data-slot=\"code-editor-line\"\n {...{ [SLOT_ATTR]: \"code-editor-line\" }}\n data-line={index + 1}\n data-active={active || undefined}\n data-severity={severity}\n className={mergeClasses(\n styles.line,\n active ? styles.lineActive : undefined\n )}\n >\n {showLineNumbers ? (\n <span\n data-slot=\"code-editor-line-number\"\n {...{ [SLOT_ATTR]: \"code-editor-line-number\" }}\n className={mergeClasses(\n styles.lineNumber,\n active ? styles.lineNumberActive : undefined,\n severity === undefined\n ? undefined\n : numberClass[severity]\n )}\n >\n {index + 1}\n </span>\n ) : null}\n <span\n data-slot=\"code-editor-line-content\"\n {...{ [SLOT_ATTR]: \"code-editor-line-content\" }}\n className={mergeClasses(\n styles.lineContent,\n wrap ? styles.lineContentWrap : undefined\n )}\n >\n {/* The rule goes on this inner span so it ends with the text rather than\n running out to the fold; the newline stays outside it. */}\n <span\n className={\n severity === undefined\n ? undefined\n : severityClass[severity]\n }\n >\n {tokenLines === null\n ? line\n : renderTokens(tokenLines[index] ?? [])}\n </span>\n {\"\\n\"}\n </span>\n </span>\n )\n })}\n </code>\n </pre>\n\n <textarea\n {...props}\n ref={setRefs}\n data-slot=\"code-editor-input\"\n {...{ [SLOT_ATTR]: \"code-editor-input\" }}\n value={current}\n rows={rows}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onSelect={handleSelect}\n onScroll={handleScroll}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n data-composing={composing || undefined}\n readOnly={readOnly}\n disabled={disabled}\n aria-invalid={invalid || undefined}\n aria-describedby={describedBy}\n aria-busy={formatting || undefined}\n // Code is not prose: a squiggle under every identifier is noise, and an editor that\n // capitalises `const` or \"corrects\" `-->` corrupts the buffer.\n spellCheck={spellCheck}\n autoComplete={autoComplete}\n autoCorrect={autoCorrect}\n autoCapitalize={autoCapitalize}\n // Source is left-to-right even on a right-to-left page; `auto` would flip a buffer that\n // happens to start with an RTL character in a string literal.\n dir={dir}\n wrap={wrap ? \"soft\" : \"off\"}\n // One indent level, one tab stop: a literal tab in the buffer renders exactly as wide as\n // the spaces Tab inserts. Dynamic, so it is an inline declaration rather than an atom.\n style={{ tabSize: indentSize, ...autoSizeStyle }}\n className={mergeClasses(\n styles.textarea,\n showLineNumbers ? styles.textareaGutter : undefined,\n autoSize ? styles.autoSize : undefined,\n wrapStyle,\n resizeStyle\n )}\n />\n\n {onFormat === undefined ? null : (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n data-format-state={formatting ? \"pending\" : \"idle\"}\n aria-label={formatLabel}\n disabled={disabled || readOnly || formatting}\n className={styles.format}\n // Keeps the caret where it is: without this the button takes focus on press and the\n // editor's selection — which the format is about to restore — is gone before it runs.\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n void runFormat()\n }}\n >\n <FormatIcon />\n </Button>\n )}\n\n {listed.length === 0 ? null : (\n <ul\n id={diagnosticsId}\n data-slot=\"code-editor-diagnostics\"\n {...{ [SLOT_ATTR]: \"code-editor-diagnostics\" }}\n className={styles.srOnly}\n >\n {listed.map((diagnostic, index) => (\n <li key={index}>\n {`${diagnostic.severity ?? \"error\"}, line ${diagnostic.line}${\n diagnostic.column === undefined\n ? \"\"\n : `, column ${diagnostic.column}`\n }: ${diagnostic.message}`}\n </li>\n ))}\n </ul>\n )}\n\n {onFormat === undefined ? null : (\n <span\n role=\"status\"\n aria-live=\"polite\"\n data-slot=\"code-editor-format-status\"\n {...{ [SLOT_ATTR]: \"code-editor-format-status\" }}\n className={styles.srOnly}\n >\n {formatStatus}\n </span>\n )}\n </div>\n )\n})\n"],"names":["FORMAT_FEEDBACK_MS","GUTTER","CODE_METRICS","shorthands","tokens.spacingElement2","tokens.fontMono","tokens.textXs","tokens.leadingXs","tokens.trackingNormal","tokens.fontWeightNormal","SEVERITY_TOKENS","tokens.errorUi","tokens.error11","tokens.warningUi","tokens.warning11","tokens.infoUi","tokens.info11","useStyles","makeZenithStyles","boxModel","tokens.surfaceField","tokens.borderWidthField","tokens.borderField","tokens.surfaceRadiusField","tokens.focusRing","tokens.grayA3","SLOT_ATTR","tokens.grayA12","nativeControl","tokens.grayA8","tokens.accentA5","tokens.spacingElement3","tokens.grayA2","tokens.spacingElement05","FormatIcon","props","jsxs","jsx","CodeEditor","React","value","defaultValue","onValueChange","onChange","onKeyDown","onBlur","onFocus","onSelect","onScroll","onCompositionStart","onCompositionEnd","language","wrap","resize","indentWithTab","indentSize","invalid","readOnly","disabled","showLineNumbers","diagnostics","onFormat","onFormatError","formatLabel","formattedLabel","formatErrorLabel","autoSize","maxRows","rows","className","style","spellCheck","autoComplete","autoCorrect","autoCapitalize","dir","forwardedRef","styles","diagnosticsId","isControlled","uncontrolled","setUncontrolled","current","renderTokens","useCodeTokenRenderer","highlightRef","composing","setComposing","innerRef","setRefs","el","tabReleased","commit","next","lineCount","severities","severityByLine","listed","visibleDiagnostics","rowMode","caretLine","setCaretLine","syncCaretLine","lineIndexAt","handleChange","event","handleSelect","handleFocus","formatPending","formatting","setFormatting","formatStatus","setFormatStatus","formatTimer","announceFormat","message","runFormat","source","error","live","caret","caretAfterRewrite","handleKeyDown","applyIndent","handleBlur","handleScroll","layer","handleCompositionStart","handleCompositionEnd","highlightSource","highlighted","highlightCode","plainLines","tokenLines","splitTokenLines","wrapStyle","effectiveResize","resizeStyle","autoSizeStyle","rootStyle","gutterDigits","describedBy","severityClass","numberClass","mergeClasses","line","index","severity","active","Button","diagnostic"],"mappings":";;;;;;;;;;;AA6BA,MAAMA,KAAqB,KAGrBC,KAAS,wBAMTC,KAAe;AAAA,EACnB,GAAGC,EAAW,OAAO,CAAC;AAAA,EACtB,GAAGA,EAAW,YAAY,CAAC;AAAA,EAC3B,GAAGA,EAAW,YAAY,MAAM;AAAA,EAChC,GAAGA,EAAW,QAAQC,CAAsB;AAAA,EAC5C,YAAYC;AAAAA,EACZ,UAAUC;AAAAA,EACV,YAAYC;AAAAA,EACZ,eAAeC;AAAAA,EACf,YAAYC;AAAAA,EACZ,YAAY;AAAA,EACZ,WAAW;AAAA;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,YACP;AAAA,YAEA,4BAAClF,IAAA,CAAA,CAAW;AAAA,UAAA;AAAA,QAAA;AAAA,QAIf+D,EAAO,WAAW,IAAI,OACrB,gBAAA5D;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAIyC;AAAA,YACJ,aAAU;AAAA,YACJ,CAACpD,CAAS,GAAG;AAAA,YACnB,WAAWmD,EAAO;AAAA,YAEjB,UAAAoB,EAAO,IAAI,CAACqD,GAAYJ,MACvB,gBAAA7G,EAAC,MAAA,EACE,UAAA,GAAGiH,EAAW,YAAY,OAAO,UAAUA,EAAW,IAAI,GACzDA,EAAW,WAAW,SAClB,KACA,YAAYA,EAAW,MAAM,EACnC,KAAKA,EAAW,OAAO,GAAA,GALhBJ,CAMT,CACD;AAAA,UAAA;AAAA,QAAA;AAAA,QAIJrF,MAAa,SAAY,OACxB,gBAAAxB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,aAAU;AAAA,YACV,aAAU;AAAA,YACJ,CAACX,CAAS,GAAG;AAAA,YACnB,WAAWmD,EAAO;AAAA,YAEjB,UAAAkC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
@@ -1,25 +1,28 @@
1
- import { jsx as b, jsxs as L, Fragment as P } from "react/jsx-runtime";
1
+ import { jsx as b, jsxs as P, Fragment as V } from "react/jsx-runtime";
2
2
  import * as e from "react";
3
3
  import { mergeClasses as m, SLOT_ATTR as x, shorthands as y } from "@epilot/zenith-runtime/v1";
4
- import { makeZenithStyles as V } from "../../styles/make-styles.js";
5
- import { spacingGroup2 as M, body as z, spacingElement3 as B, radius2xl as X } from "../../tokens/index.js";
6
- const D = e.createContext(null);
7
- function k() {
8
- const u = e.useContext(D);
4
+ import { makeZenithStyles as z } from "../../styles/make-styles.js";
5
+ import { nativeControl as B, boxModel as S } from "../../styles/host-reset.js";
6
+ import { spacingGroup2 as D, body as X, spacingElement3 as $, radius2xl as q } from "../../tokens/index.js";
7
+ const F = e.createContext(null);
8
+ function E() {
9
+ const u = e.useContext(F);
9
10
  if (!u)
10
11
  throw new Error(
11
12
  "CollapsibleSidebar sub-components must be used within CollapsibleSidebar"
12
13
  );
13
14
  return u;
14
15
  }
15
- const S = V({
16
+ const h = z({
16
17
  root: {
18
+ ...S,
17
19
  position: "relative",
18
20
  height: "100%",
19
21
  display: "flex",
20
22
  flexDirection: "column"
21
23
  },
22
24
  content: {
25
+ ...S,
23
26
  display: "flex",
24
27
  flexDirection: "column",
25
28
  height: "100%",
@@ -28,14 +31,15 @@ const S = V({
28
31
  flexBasis: "0%"
29
32
  },
30
33
  floating: {
34
+ ...S,
31
35
  position: "absolute",
32
36
  top: 0,
33
37
  left: 0,
34
38
  height: "100%",
35
39
  // v1 z-50; floating panel layer above collapsed sidebar.
36
40
  zIndex: 50,
37
- ...y.borderRadius(X),
38
- backgroundColor: z,
41
+ ...y.borderRadius(q),
42
+ backgroundColor: X,
39
43
  // v1 shadow-[0_4px_20px_rgba(0,0,0,0.15)]; no shadow token exists in this package.
40
44
  boxShadow: "0 4px 20px rgba(0, 0, 0, 0.15)",
41
45
  display: "flex",
@@ -56,137 +60,139 @@ const S = V({
56
60
  transitionProperty: "none"
57
61
  },
58
62
  condensed: {
63
+ ...S,
59
64
  display: "flex",
60
65
  flexDirection: "column",
61
66
  alignItems: "center",
62
- paddingTop: M,
67
+ paddingTop: D,
63
68
  // v1 gap-3 is 0.75rem; no spacing token for 0.75rem exists in this package.
64
- ...y.gap(B),
69
+ ...y.gap($),
65
70
  flexGrow: 1,
66
71
  flexShrink: 1,
67
72
  flexBasis: "0%"
68
73
  },
69
74
  toggle: {
75
+ ...B,
70
76
  display: "flex",
71
77
  alignItems: "center",
72
78
  justifyContent: "flex-end",
73
- ...y.padding(M),
79
+ ...y.padding(D),
74
80
  cursor: "pointer",
75
81
  backgroundColor: "transparent",
76
82
  ...y.border("0")
77
83
  }
78
- }), Z = e.forwardRef(function({
79
- collapsed: n,
84
+ }), K = e.forwardRef(function({
85
+ collapsed: a,
80
86
  defaultCollapsed: l = !1,
81
87
  onCollapsedChange: o,
82
88
  width: i = 264,
83
89
  collapsedWidth: r = 64,
84
90
  expandOnHover: t = !0,
85
91
  hoverDelay: s = 100,
86
- className: a,
92
+ className: n,
87
93
  children: c,
88
94
  ...g
89
- }, h) {
90
- const v = S(), [C, F] = e.useState(l), T = n !== void 0, p = T ? n : C, [E, R] = e.useState(!1), N = e.useCallback(
95
+ }, v) {
96
+ const T = h(), [C, j] = e.useState(l), w = a !== void 0, p = w ? a : C, [R, N] = e.useState(!1), M = e.useCallback(
91
97
  (f) => {
92
- f || R(!0), T || F(f), o == null || o(f);
98
+ f || N(!0), w || j(f), o == null || o(f);
93
99
  },
94
- [T, o]
95
- ), [I, w] = e.useState(!1), d = e.useRef(void 0), j = e.useCallback(() => {
96
- !p || !t || (d.current && clearTimeout(d.current), d.current = setTimeout(() => w(!0), s));
97
- }, [p, t, s]), A = e.useCallback(() => {
98
- d.current && clearTimeout(d.current), w(!1);
100
+ [w, o]
101
+ ), [I, k] = e.useState(!1), d = e.useRef(void 0), A = e.useCallback(() => {
102
+ !p || !t || (d.current && clearTimeout(d.current), d.current = setTimeout(() => k(!0), s));
103
+ }, [p, t, s]), G = e.useCallback(() => {
104
+ d.current && clearTimeout(d.current), k(!1);
99
105
  }, []);
100
106
  e.useEffect(() => {
101
- w(!1);
102
- const f = requestAnimationFrame(() => R(!1));
107
+ k(!1);
108
+ const f = requestAnimationFrame(() => N(!1));
103
109
  return () => cancelAnimationFrame(f);
104
110
  }, [p]), e.useEffect(() => () => {
105
111
  d.current && clearTimeout(d.current);
106
112
  }, []);
107
- const G = e.useMemo(
113
+ const L = e.useMemo(
108
114
  () => ({
109
115
  collapsed: p,
110
- onCollapsedChange: N,
116
+ onCollapsedChange: M,
111
117
  width: i,
112
118
  collapsedWidth: r,
113
119
  isHovered: I,
114
120
  expandOnHover: t,
115
- skipTransition: E
121
+ skipTransition: R
116
122
  }),
117
123
  [
118
124
  p,
119
- N,
125
+ M,
120
126
  i,
121
127
  r,
122
128
  I,
123
129
  t,
124
- E
130
+ R
125
131
  ]
126
132
  );
127
- return /* @__PURE__ */ b(D.Provider, { value: G, children: /* @__PURE__ */ b(
133
+ return /* @__PURE__ */ b(F.Provider, { value: L, children: /* @__PURE__ */ b(
128
134
  "div",
129
135
  {
130
- ref: h,
136
+ ref: v,
131
137
  "data-slot": "collapsible-sidebar",
132
138
  [x]: "collapsible-sidebar",
133
139
  "data-collapsed": p ? "" : void 0,
134
- className: m(v.root, a),
135
- onMouseEnter: j,
136
- onMouseLeave: A,
140
+ className: m(T.root, n),
141
+ onMouseEnter: A,
142
+ onMouseLeave: G,
137
143
  ...g,
138
144
  children: c
139
145
  }
140
146
  ) });
141
- }), _ = e.forwardRef(function({ className: n, floatingClassName: l, children: o, style: i, ...r }, t) {
142
- const s = S(), { collapsed: a, width: c, isHovered: g, expandOnHover: h, skipTransition: v } = k(), C = typeof c == "number" ? `${c}px` : c;
143
- return /* @__PURE__ */ L(P, { children: [
144
- !a && /* @__PURE__ */ b(
147
+ }), Q = e.forwardRef(function({ className: a, floatingClassName: l, children: o, style: i, ...r }, t) {
148
+ const s = h(), { collapsed: n, width: c, isHovered: g, expandOnHover: v, skipTransition: T } = E(), C = typeof c == "number" ? `${c}px` : c;
149
+ return /* @__PURE__ */ P(V, { children: [
150
+ !n && /* @__PURE__ */ b(
145
151
  "aside",
146
152
  {
147
153
  ref: t,
148
154
  "data-slot": "collapsible-sidebar-content",
149
155
  [x]: "collapsible-sidebar-content",
150
- className: m(s.content, n),
156
+ className: m(s.content, a),
151
157
  style: { width: C, ...i },
152
158
  ...r,
153
159
  children: o
154
160
  }
155
161
  ),
156
- h && /* @__PURE__ */ b(
162
+ v && /* @__PURE__ */ b(
157
163
  "div",
158
164
  {
159
165
  "data-slot": "collapsible-sidebar-floating",
160
166
  [x]: "collapsible-sidebar-floating",
161
- "data-visible": a && g ? "" : void 0,
167
+ "data-visible": n && g ? "" : void 0,
162
168
  className: m(
163
169
  s.floating,
164
- v && s.transitionNone,
170
+ T && s.transitionNone,
165
171
  l
166
172
  ),
167
173
  style: { width: C },
168
- children: a && g && o
174
+ children: n && g && o
169
175
  }
170
176
  )
171
177
  ] });
172
- }), J = e.forwardRef(function({ className: n, children: l, style: o, ...i }, r) {
173
- const t = S(), { collapsed: s, collapsedWidth: a } = k();
178
+ }), U = e.forwardRef(function({ className: a, children: l, style: o, ...i }, r) {
179
+ const t = h(), { collapsed: s, collapsedWidth: n } = E();
174
180
  if (!s) return null;
175
- const c = typeof a == "number" ? `${a}px` : a;
181
+ const c = typeof n == "number" ? `${n}px` : n;
176
182
  return /* @__PURE__ */ b(
177
183
  "div",
178
184
  {
179
185
  ref: r,
180
186
  "data-slot": "collapsible-sidebar-condensed",
181
187
  [x]: "collapsible-sidebar-condensed",
182
- className: m(t.condensed, n),
188
+ className: m(t.condensed, a),
183
189
  style: { width: c, ...o },
184
190
  ...i,
185
191
  children: l
186
192
  }
187
193
  );
188
- }), K = e.forwardRef(function({ className: n, children: l, ...o }, i) {
189
- const r = S(), { collapsed: t, onCollapsedChange: s } = k();
194
+ }), Y = e.forwardRef(function({ className: a, children: l, ...o }, i) {
195
+ const r = h(), { collapsed: t, onCollapsedChange: s } = E();
190
196
  return /* @__PURE__ */ b(
191
197
  "button",
192
198
  {
@@ -197,7 +203,7 @@ const S = V({
197
203
  type: "button",
198
204
  "aria-expanded": !t,
199
205
  "aria-label": t ? "Expand sidebar" : "Collapse sidebar",
200
- className: m(r.toggle, n),
206
+ className: m(r.toggle, a),
201
207
  onClick: () => s(!t),
202
208
  ...o,
203
209
  children: typeof l == "function" ? l({ collapsed: t }) : l
@@ -205,10 +211,10 @@ const S = V({
205
211
  );
206
212
  });
207
213
  export {
208
- Z as CollapsibleSidebar,
209
- J as CollapsibleSidebarCondensed,
210
- _ as CollapsibleSidebarContent,
211
- K as CollapsibleSidebarToggle,
212
- k as useCollapsibleSidebar
214
+ K as CollapsibleSidebar,
215
+ U as CollapsibleSidebarCondensed,
216
+ Q as CollapsibleSidebarContent,
217
+ Y as CollapsibleSidebarToggle,
218
+ E as useCollapsibleSidebar
213
219
  };
214
220
  //# sourceMappingURL=collapsible-sidebar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible-sidebar.js","sources":["../../../src/components/collapsible-sidebar/collapsible-sidebar.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\n\n// --- Context ---\n\nexport interface CollapsibleSidebarContextValue {\n collapsed: boolean\n onCollapsedChange: (collapsed: boolean) => void\n width: number | string\n collapsedWidth: number | string\n isHovered: boolean\n expandOnHover: boolean\n skipTransition: boolean\n}\n\nconst CollapsibleSidebarContext =\n React.createContext<CollapsibleSidebarContextValue | null>(null)\n\nexport function useCollapsibleSidebar() {\n const ctx = React.useContext(CollapsibleSidebarContext)\n\n if (!ctx) {\n throw new Error(\n \"CollapsibleSidebar sub-components must be used within CollapsibleSidebar\"\n )\n }\n\n return ctx\n}\n\n// --- Styles ---\n\nconst useStyles = makeZenithStyles({\n root: {\n position: \"relative\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n height: \"100%\",\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"0%\",\n },\n floating: {\n position: \"absolute\",\n top: 0,\n left: 0,\n height: \"100%\",\n // v1 z-50; floating panel layer above collapsed sidebar.\n zIndex: 50,\n ...shorthands.borderRadius(tokens.radius2xl),\n backgroundColor: tokens.body,\n // v1 shadow-[0_4px_20px_rgba(0,0,0,0.15)]; no shadow token exists in this package.\n boxShadow: \"0 4px 20px rgba(0, 0, 0, 0.15)\",\n display: \"flex\",\n flexDirection: \"column\",\n opacity: 0,\n transform: \"translateX(-50%)\",\n pointerEvents: \"none\",\n transitionProperty: \"all\",\n transitionDuration: \"200ms\",\n transitionTimingFunction: \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"&[data-visible]\": {\n opacity: 1,\n transform: \"translateX(0)\",\n pointerEvents: \"auto\",\n },\n },\n transitionNone: {\n transitionProperty: \"none\",\n },\n condensed: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n paddingTop: tokens.spacingGroup2,\n // v1 gap-3 is 0.75rem; no spacing token for 0.75rem exists in this package.\n ...shorthands.gap(tokens.spacingElement3),\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"0%\",\n },\n toggle: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n ...shorthands.padding(tokens.spacingGroup2),\n cursor: \"pointer\",\n backgroundColor: \"transparent\",\n ...shorthands.border(\"0\"),\n },\n})\n\n// --- CollapsibleSidebar (root) ---\n\nexport type CollapsibleSidebarProps = React.ComponentProps<\"div\"> & {\n collapsed?: boolean\n defaultCollapsed?: boolean\n onCollapsedChange?: (collapsed: boolean) => void\n width?: number | string\n collapsedWidth?: number | string\n expandOnHover?: boolean\n hoverDelay?: number\n}\n\nexport const CollapsibleSidebar = React.forwardRef<\n HTMLDivElement,\n CollapsibleSidebarProps\n>(function CollapsibleSidebar(\n {\n collapsed: controlledCollapsed,\n defaultCollapsed = false,\n onCollapsedChange,\n width = 264,\n collapsedWidth = 64,\n expandOnHover = true,\n hoverDelay = 100,\n className,\n children,\n ...props\n },\n ref\n) {\n const styles = useStyles()\n\n const [internalCollapsed, setInternalCollapsed] =\n React.useState(defaultCollapsed)\n const isControlled = controlledCollapsed !== undefined\n const collapsed = isControlled ? controlledCollapsed : internalCollapsed\n\n // Skip floating panel transition when expanding (to avoid overlap with inline panel)\n const [skipTransition, setSkipTransition] = React.useState(false)\n\n const handleCollapsedChange = React.useCallback(\n (value: boolean) => {\n if (!value) setSkipTransition(true)\n if (!isControlled) setInternalCollapsed(value)\n onCollapsedChange?.(value)\n },\n [isControlled, onCollapsedChange]\n )\n\n // Hover state for floating panel\n const [isHovered, setIsHovered] = React.useState(false)\n const hoverTimeoutRef = React.useRef<ReturnType<typeof setTimeout>>(undefined)\n\n const handleMouseEnter = React.useCallback(() => {\n if (!collapsed || !expandOnHover) return\n if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current)\n hoverTimeoutRef.current = setTimeout(() => setIsHovered(true), hoverDelay)\n }, [collapsed, expandOnHover, hoverDelay])\n\n const handleMouseLeave = React.useCallback(() => {\n if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current)\n setIsHovered(false)\n }, [])\n\n // Reset hover when collapse state changes\n React.useEffect(() => {\n setIsHovered(false)\n // Reset skipTransition after the render so future hover exits animate normally\n const raf = requestAnimationFrame(() => setSkipTransition(false))\n return () => cancelAnimationFrame(raf)\n }, [collapsed])\n\n // Cleanup timeout on unmount\n React.useEffect(() => {\n return () => {\n if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current)\n }\n }, [])\n\n const contextValue = React.useMemo(\n () => ({\n collapsed,\n onCollapsedChange: handleCollapsedChange,\n width,\n collapsedWidth,\n isHovered,\n expandOnHover,\n skipTransition,\n }),\n [\n collapsed,\n handleCollapsedChange,\n width,\n collapsedWidth,\n isHovered,\n expandOnHover,\n skipTransition,\n ]\n )\n\n return (\n <CollapsibleSidebarContext.Provider value={contextValue}>\n <div\n ref={ref}\n data-slot=\"collapsible-sidebar\"\n {...{ [SLOT_ATTR]: \"collapsible-sidebar\" }}\n data-collapsed={collapsed ? \"\" : undefined}\n className={mergeClasses(styles.root, className)}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n {...props}\n >\n {children}\n </div>\n </CollapsibleSidebarContext.Provider>\n )\n})\n\n// --- CollapsibleSidebarContent ---\n\nexport type CollapsibleSidebarContentProps = React.ComponentProps<\"aside\"> & {\n floatingClassName?: string\n}\n\nexport const CollapsibleSidebarContent = React.forwardRef<\n HTMLElement,\n CollapsibleSidebarContentProps\n>(function CollapsibleSidebarContent(\n { className, floatingClassName, children, style, ...props },\n ref\n) {\n const styles = useStyles()\n const { collapsed, width, isHovered, expandOnHover, skipTransition } =\n useCollapsibleSidebar()\n\n const widthValue = typeof width === \"number\" ? `${width}px` : width\n\n return (\n <>\n {/* Inline panel: only rendered when expanded */}\n {!collapsed && (\n <aside\n ref={ref}\n data-slot=\"collapsible-sidebar-content\"\n {...{ [SLOT_ATTR]: \"collapsible-sidebar-content\" }}\n className={mergeClasses(styles.content, className)}\n style={{ width: widthValue, ...style }}\n {...props}\n >\n {children}\n </aside>\n )}\n\n {/* Floating panel: visible on hover when collapsed (only if expandOnHover is enabled) */}\n {expandOnHover && (\n <div\n data-slot=\"collapsible-sidebar-floating\"\n {...{ [SLOT_ATTR]: \"collapsible-sidebar-floating\" }}\n data-visible={collapsed && isHovered ? \"\" : undefined}\n className={mergeClasses(\n styles.floating,\n skipTransition && styles.transitionNone,\n floatingClassName\n )}\n style={{ width: widthValue }}\n >\n {collapsed && isHovered && children}\n </div>\n )}\n </>\n )\n})\n\n// --- CollapsibleSidebarCondensed ---\n\nexport type CollapsibleSidebarCondensedProps = React.ComponentProps<\"div\">\n\nexport const CollapsibleSidebarCondensed = React.forwardRef<\n HTMLDivElement,\n CollapsibleSidebarCondensedProps\n>(function CollapsibleSidebarCondensed(\n { className, children, style, ...props },\n ref\n) {\n const styles = useStyles()\n const { collapsed, collapsedWidth } = useCollapsibleSidebar()\n\n if (!collapsed) return null\n\n const collapsedWidthValue =\n typeof collapsedWidth === \"number\" ? `${collapsedWidth}px` : collapsedWidth\n\n return (\n <div\n ref={ref}\n data-slot=\"collapsible-sidebar-condensed\"\n {...{ [SLOT_ATTR]: \"collapsible-sidebar-condensed\" }}\n className={mergeClasses(styles.condensed, className)}\n style={{ width: collapsedWidthValue, ...style }}\n {...props}\n >\n {children}\n </div>\n )\n})\n\n// --- CollapsibleSidebarToggle ---\n\nexport type CollapsibleSidebarToggleProps = Omit<\n React.ComponentProps<\"button\">,\n \"onClick\" | \"children\"\n> & {\n children?:\n React.ReactNode | ((props: { collapsed: boolean }) => React.ReactNode)\n}\n\nexport const CollapsibleSidebarToggle = React.forwardRef<\n HTMLButtonElement,\n CollapsibleSidebarToggleProps\n>(function CollapsibleSidebarToggle({ className, children, ...props }, ref) {\n const styles = useStyles()\n const { collapsed, onCollapsedChange } = useCollapsibleSidebar()\n\n return (\n <button\n ref={ref}\n data-slot=\"collapsible-sidebar-toggle\"\n {...{ [SLOT_ATTR]: \"collapsible-sidebar-toggle\" }}\n data-collapsed={collapsed ? \"\" : undefined}\n type=\"button\"\n aria-expanded={!collapsed}\n aria-label={collapsed ? \"Expand sidebar\" : \"Collapse sidebar\"}\n className={mergeClasses(styles.toggle, className)}\n onClick={() => onCollapsedChange(!collapsed)}\n {...props}\n >\n {typeof children === \"function\" ? children({ collapsed }) : children}\n </button>\n )\n})\n"],"names":["CollapsibleSidebarContext","React","useCollapsibleSidebar","ctx","useStyles","makeZenithStyles","shorthands","tokens.radius2xl","tokens.body","tokens.spacingGroup2","tokens.spacingElement3","CollapsibleSidebar","controlledCollapsed","defaultCollapsed","onCollapsedChange","width","collapsedWidth","expandOnHover","hoverDelay","className","children","props","ref","styles","internalCollapsed","setInternalCollapsed","isControlled","collapsed","skipTransition","setSkipTransition","handleCollapsedChange","value","isHovered","setIsHovered","hoverTimeoutRef","handleMouseEnter","handleMouseLeave","raf","contextValue","jsx","SLOT_ATTR","mergeClasses","CollapsibleSidebarContent","floatingClassName","style","widthValue","jsxs","Fragment","CollapsibleSidebarCondensed","collapsedWidthValue","CollapsibleSidebarToggle"],"mappings":";;;;;AAoBA,MAAMA,IACJC,EAAM,cAAqD,IAAI;AAE1D,SAASC,IAAwB;AACtC,QAAMC,IAAMF,EAAM,WAAWD,CAAyB;AAEtD,MAAI,CAACG;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAIJ,SAA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AAK;AAC1E,QAAMC,IAASnB,EAAA,GACT,EAAE,WAAAuB,GAAW,mBAAAb,EAAA,IAAsBZ,EAAA;AAEzC,SACE,gBAAAqC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAjB;AAAA,MACA,aAAU;AAAA,MACJ,CAACkB,CAAS,GAAG;AAAA,MACnB,kBAAgBb,IAAY,KAAK;AAAA,MACjC,MAAK;AAAA,MACL,iBAAe,CAACA;AAAA,MAChB,cAAYA,IAAY,mBAAmB;AAAA,MAC3C,WAAWc,EAAalB,EAAO,QAAQJ,CAAS;AAAA,MAChD,SAAS,MAAML,EAAkB,CAACa,CAAS;AAAA,MAC1C,GAAGN;AAAA,MAEH,iBAAOD,KAAa,aAAaA,EAAS,EAAE,WAAAO,EAAA,CAAW,IAAIP;AAAA,IAAA;AAAA,EAAA;AAGlE,CAAC;"}
1
+ {"version":3,"file":"collapsible-sidebar.js","sources":["../../../src/components/collapsible-sidebar/collapsible-sidebar.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { boxModel, nativeControl } from \"../../styles/host-reset\"\nimport * as tokens from \"../../tokens\"\n\n// --- Context ---\n\nexport interface CollapsibleSidebarContextValue {\n collapsed: boolean\n onCollapsedChange: (collapsed: boolean) => void\n width: number | string\n collapsedWidth: number | string\n isHovered: boolean\n expandOnHover: boolean\n skipTransition: boolean\n}\n\nconst CollapsibleSidebarContext =\n React.createContext<CollapsibleSidebarContextValue | null>(null)\n\nexport function useCollapsibleSidebar() {\n const ctx = React.useContext(CollapsibleSidebarContext)\n\n if (!ctx) {\n throw new Error(\n \"CollapsibleSidebar sub-components must be used within CollapsibleSidebar\"\n )\n }\n\n return ctx\n}\n\n// --- Styles ---\n\nconst useStyles = makeZenithStyles({\n root: {\n ...boxModel,\n position: \"relative\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n content: {\n ...boxModel,\n display: \"flex\",\n flexDirection: \"column\",\n height: \"100%\",\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"0%\",\n },\n floating: {\n ...boxModel,\n position: \"absolute\",\n top: 0,\n left: 0,\n height: \"100%\",\n // v1 z-50; floating panel layer above collapsed sidebar.\n zIndex: 50,\n ...shorthands.borderRadius(tokens.radius2xl),\n backgroundColor: tokens.body,\n // v1 shadow-[0_4px_20px_rgba(0,0,0,0.15)]; no shadow token exists in this package.\n boxShadow: \"0 4px 20px rgba(0, 0, 0, 0.15)\",\n display: \"flex\",\n flexDirection: \"column\",\n opacity: 0,\n transform: \"translateX(-50%)\",\n pointerEvents: \"none\",\n transitionProperty: \"all\",\n transitionDuration: \"200ms\",\n transitionTimingFunction: \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"&[data-visible]\": {\n opacity: 1,\n transform: \"translateX(0)\",\n pointerEvents: \"auto\",\n },\n },\n transitionNone: {\n transitionProperty: \"none\",\n },\n condensed: {\n ...boxModel,\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n paddingTop: tokens.spacingGroup2,\n // v1 gap-3 is 0.75rem; no spacing token for 0.75rem exists in this package.\n ...shorthands.gap(tokens.spacingElement3),\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"0%\",\n },\n toggle: {\n ...nativeControl,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n ...shorthands.padding(tokens.spacingGroup2),\n cursor: \"pointer\",\n backgroundColor: \"transparent\",\n ...shorthands.border(\"0\"),\n },\n})\n\n// --- CollapsibleSidebar (root) ---\n\nexport type CollapsibleSidebarProps = React.ComponentProps<\"div\"> & {\n collapsed?: boolean\n defaultCollapsed?: boolean\n onCollapsedChange?: (collapsed: boolean) => void\n width?: number | string\n collapsedWidth?: number | string\n expandOnHover?: boolean\n hoverDelay?: number\n}\n\nexport const CollapsibleSidebar = React.forwardRef<\n HTMLDivElement,\n CollapsibleSidebarProps\n>(function CollapsibleSidebar(\n {\n collapsed: controlledCollapsed,\n defaultCollapsed = false,\n onCollapsedChange,\n width = 264,\n collapsedWidth = 64,\n expandOnHover = true,\n hoverDelay = 100,\n className,\n children,\n ...props\n },\n ref\n) {\n const styles = useStyles()\n\n const [internalCollapsed, setInternalCollapsed] =\n React.useState(defaultCollapsed)\n const isControlled = controlledCollapsed !== undefined\n const collapsed = isControlled ? controlledCollapsed : internalCollapsed\n\n // Skip floating panel transition when expanding (to avoid overlap with inline panel)\n const [skipTransition, setSkipTransition] = React.useState(false)\n\n const handleCollapsedChange = React.useCallback(\n (value: boolean) => {\n if (!value) setSkipTransition(true)\n if (!isControlled) setInternalCollapsed(value)\n onCollapsedChange?.(value)\n },\n [isControlled, onCollapsedChange]\n )\n\n // Hover state for floating panel\n const [isHovered, setIsHovered] = React.useState(false)\n const hoverTimeoutRef = React.useRef<ReturnType<typeof setTimeout>>(undefined)\n\n const handleMouseEnter = React.useCallback(() => {\n if (!collapsed || !expandOnHover) return\n if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current)\n hoverTimeoutRef.current = setTimeout(() => setIsHovered(true), hoverDelay)\n }, [collapsed, expandOnHover, hoverDelay])\n\n const handleMouseLeave = React.useCallback(() => {\n if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current)\n setIsHovered(false)\n }, [])\n\n // Reset hover when collapse state changes\n React.useEffect(() => {\n setIsHovered(false)\n // Reset skipTransition after the render so future hover exits animate normally\n const raf = requestAnimationFrame(() => setSkipTransition(false))\n return () => cancelAnimationFrame(raf)\n }, [collapsed])\n\n // Cleanup timeout on unmount\n React.useEffect(() => {\n return () => {\n if (hoverTimeoutRef.current) clearTimeout(hoverTimeoutRef.current)\n }\n }, [])\n\n const contextValue = React.useMemo(\n () => ({\n collapsed,\n onCollapsedChange: handleCollapsedChange,\n width,\n collapsedWidth,\n isHovered,\n expandOnHover,\n skipTransition,\n }),\n [\n collapsed,\n handleCollapsedChange,\n width,\n collapsedWidth,\n isHovered,\n expandOnHover,\n skipTransition,\n ]\n )\n\n return (\n <CollapsibleSidebarContext.Provider value={contextValue}>\n <div\n ref={ref}\n data-slot=\"collapsible-sidebar\"\n {...{ [SLOT_ATTR]: \"collapsible-sidebar\" }}\n data-collapsed={collapsed ? \"\" : undefined}\n className={mergeClasses(styles.root, className)}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n {...props}\n >\n {children}\n </div>\n </CollapsibleSidebarContext.Provider>\n )\n})\n\n// --- CollapsibleSidebarContent ---\n\nexport type CollapsibleSidebarContentProps = React.ComponentProps<\"aside\"> & {\n floatingClassName?: string\n}\n\nexport const CollapsibleSidebarContent = React.forwardRef<\n HTMLElement,\n CollapsibleSidebarContentProps\n>(function CollapsibleSidebarContent(\n { className, floatingClassName, children, style, ...props },\n ref\n) {\n const styles = useStyles()\n const { collapsed, width, isHovered, expandOnHover, skipTransition } =\n useCollapsibleSidebar()\n\n const widthValue = typeof width === \"number\" ? `${width}px` : width\n\n return (\n <>\n {/* Inline panel: only rendered when expanded */}\n {!collapsed && (\n <aside\n ref={ref}\n data-slot=\"collapsible-sidebar-content\"\n {...{ [SLOT_ATTR]: \"collapsible-sidebar-content\" }}\n className={mergeClasses(styles.content, className)}\n style={{ width: widthValue, ...style }}\n {...props}\n >\n {children}\n </aside>\n )}\n\n {/* Floating panel: visible on hover when collapsed (only if expandOnHover is enabled) */}\n {expandOnHover && (\n <div\n data-slot=\"collapsible-sidebar-floating\"\n {...{ [SLOT_ATTR]: \"collapsible-sidebar-floating\" }}\n data-visible={collapsed && isHovered ? \"\" : undefined}\n className={mergeClasses(\n styles.floating,\n skipTransition && styles.transitionNone,\n floatingClassName\n )}\n style={{ width: widthValue }}\n >\n {collapsed && isHovered && children}\n </div>\n )}\n </>\n )\n})\n\n// --- CollapsibleSidebarCondensed ---\n\nexport type CollapsibleSidebarCondensedProps = React.ComponentProps<\"div\">\n\nexport const CollapsibleSidebarCondensed = React.forwardRef<\n HTMLDivElement,\n CollapsibleSidebarCondensedProps\n>(function CollapsibleSidebarCondensed(\n { className, children, style, ...props },\n ref\n) {\n const styles = useStyles()\n const { collapsed, collapsedWidth } = useCollapsibleSidebar()\n\n if (!collapsed) return null\n\n const collapsedWidthValue =\n typeof collapsedWidth === \"number\" ? `${collapsedWidth}px` : collapsedWidth\n\n return (\n <div\n ref={ref}\n data-slot=\"collapsible-sidebar-condensed\"\n {...{ [SLOT_ATTR]: \"collapsible-sidebar-condensed\" }}\n className={mergeClasses(styles.condensed, className)}\n style={{ width: collapsedWidthValue, ...style }}\n {...props}\n >\n {children}\n </div>\n )\n})\n\n// --- CollapsibleSidebarToggle ---\n\nexport type CollapsibleSidebarToggleProps = Omit<\n React.ComponentProps<\"button\">,\n \"onClick\" | \"children\"\n> & {\n children?:\n React.ReactNode | ((props: { collapsed: boolean }) => React.ReactNode)\n}\n\nexport const CollapsibleSidebarToggle = React.forwardRef<\n HTMLButtonElement,\n CollapsibleSidebarToggleProps\n>(function CollapsibleSidebarToggle({ className, children, ...props }, ref) {\n const styles = useStyles()\n const { collapsed, onCollapsedChange } = useCollapsibleSidebar()\n\n return (\n <button\n ref={ref}\n data-slot=\"collapsible-sidebar-toggle\"\n {...{ [SLOT_ATTR]: \"collapsible-sidebar-toggle\" }}\n data-collapsed={collapsed ? \"\" : undefined}\n type=\"button\"\n aria-expanded={!collapsed}\n aria-label={collapsed ? \"Expand sidebar\" : \"Collapse sidebar\"}\n className={mergeClasses(styles.toggle, className)}\n onClick={() => onCollapsedChange(!collapsed)}\n {...props}\n >\n {typeof children === \"function\" ? children({ collapsed }) : children}\n </button>\n )\n})\n"],"names":["CollapsibleSidebarContext","React","useCollapsibleSidebar","ctx","useStyles","makeZenithStyles","boxModel","shorthands","tokens.radius2xl","tokens.body","tokens.spacingGroup2","tokens.spacingElement3","nativeControl","CollapsibleSidebar","controlledCollapsed","defaultCollapsed","onCollapsedChange","width","collapsedWidth","expandOnHover","hoverDelay","className","children","props","ref","styles","internalCollapsed","setInternalCollapsed","isControlled","collapsed","skipTransition","setSkipTransition","handleCollapsedChange","value","isHovered","setIsHovered","hoverTimeoutRef","handleMouseEnter","handleMouseLeave","raf","contextValue","jsx","SLOT_ATTR","mergeClasses","CollapsibleSidebarContent","floatingClassName","style","widthValue","jsxs","Fragment","CollapsibleSidebarCondensed","collapsedWidthValue","CollapsibleSidebarToggle"],"mappings":";;;;;;AAqBA,MAAMA,IACJC,EAAM,cAAqD,IAAI;AAE1D,SAASC,IAAwB;AACtC,QAAMC,IAAMF,EAAM,WAAWD,CAAyB;AAEtD,MAAI,CAACG;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAIJ,SAAOA;AACT;AAIA,MAAMC,IAAYC,EAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,GAAGC;AAAA,IACH,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,eAAe;AAAA,EAAA;AAAA,EAEjB,SAAS;AAAA,IACP,GAAGA;AAAA,IACH,SAAS;AAAA,IACT,eAAe;AAAA,IACf,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,EAAA;AAAA,EAEb,UAAU;AAAA,IACR,GAAGA;AAAA,IACH,UAAU;AAAA,IACV,KAAK;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA;AAAA,IAER,QAAQ;AAAA,IACR,GAAGC,EAAW,aAAaC,CAAgB;AAAA,IAC3C,iBAAiBC;AAAAA;AAAAA,IAEjB,WAAW;AAAA,IACX,SAAS;AAAA,IACT,eAAe;AAAA,IACf,SAAS;AAAA,IACT,WAAW;AAAA,IACX,eAAe;AAAA,IACf,oBAAoB;AAAA,IACpB,oBAAoB;AAAA,IACpB,0BAA0B;AAAA,IAC1B,mBAAmB;AAAA,MACjB,SAAS;AAAA,MACT,WAAW;AAAA,MACX,eAAe;AAAA,IAAA;AAAA,EACjB;AAAA,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