@dou-ui/code 0.1.0-alpha.2 → 0.1.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/extension.js CHANGED
@@ -5,12 +5,17 @@ function defineCodeExtension(extension) {
5
5
  return extension;
6
6
  }
7
7
  var CODE_EDITOR_KEY = Symbol("DouCodeEditor");
8
+ /**
9
+ * Internal: told each widget height an editor measures, by `extension/id`;
10
+ * DouCodeDiff leaves a blank of the same height across from it.
11
+ */
12
+ var WIDGET_HEIGHT_KEY = Symbol("DouCodeWidgetHeight");
8
13
  /** The editor a panel or gutter component is drawn in. */
9
14
  function useCodeEditor() {
10
15
  const context = inject(CODE_EDITOR_KEY, null);
11
16
  if (!context) throw new Error("[@dou-ui/code] useCodeEditor() must be called inside <DouCodeEditor>");
12
17
  return context;
13
18
  }
14
- export { CODE_EDITOR_KEY, defineCodeExtension, useCodeEditor };
19
+ export { CODE_EDITOR_KEY, WIDGET_HEIGHT_KEY, defineCodeExtension, useCodeEditor };
15
20
 
16
21
  //# sourceMappingURL=extension.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension.js","names":[],"sources":["../src/extension.ts"],"sourcesContent":["import type { CodeMessages } from './locale'\nimport { type Component, type InjectionKey, type VNodeChild, inject } from 'vue'\nimport type { CodeKeymap } from './core/keymap'\nimport type { CodeSelection } from './core/selection'\nimport type { CodeText } from './core/text'\nimport type { CodeState, CodeTransaction, CodeTransactionResult } from './core/transaction'\nimport type { CodeEditorExpose } from './types'\n\n/** How bad a diagnostic is, worst first. */\nexport type CodeDiagnosticSeverity = 'error' | 'warning' | 'info' | 'hint'\n\n/** A fix offered with a diagnostic. */\nexport interface CodeDiagnosticAction {\n label: string\n /** Makes the fix, usually with `context.transact`. */\n run: (context: CodeExtensionContext, diagnostic: CodeDiagnostic) => void\n}\n\n/**\n * A problem found in the text, from `from` to `to` (offsets in the text,\n * the same as a language service's ranges). An empty range marks the\n * character after it.\n */\nexport interface CodeDiagnostic {\n from: number\n to: number\n severity: CodeDiagnosticSeverity\n message: string\n /** Who found it, shown after the message, e.g. the name of a linter. */\n source?: string\n /** Fixes, shown under the message and with `Mod` + `.`. */\n actions?: CodeDiagnosticAction[]\n}\n\n/**\n * How a part of the text is drawn. Marks and line classes only change how\n * the text looks (colors, backgrounds, underlines, borders), never its\n * size, so the cursor still lands where the characters are; an inline\n * widget takes its own room in the line.\n */\nexport type CodeDecoration =\n /**\n * Classes on the characters from `from` to `to`. `style` sets inline\n * styles on them as well, e.g. a CSS variable holding a person's color;\n * where marks overlap, the later one's styles win.\n */\n | {\n type: 'mark'\n from: number\n to: number\n class: string\n title?: string\n style?: Readonly<Record<string, string>>\n }\n /** A class on a whole line (`line` from 1), e.g. a tinted background. */\n | { type: 'line'; line: number; class: string }\n /**\n * Something drawn inside a line, before the character at `pos`, such as\n * a color swatch or a parameter's name. It isn't text: the cursor steps\n * over it and copying leaves it out. `width` in px saves measuring it;\n * without it the widget is measured once drawn, and the width is kept by\n * `id`.\n */\n | { type: 'inline'; pos: number; render: () => VNodeChild; width?: number; id?: string }\n\n/**\n * A component drawn between lines, across the editor, e.g. a review\n * comment. The lines below move down to make room, and it moves with the\n * text as lines are added or removed above it.\n */\nexport interface CodeWidget {\n /** Tells widgets apart, unique among one extension's; its measured height is kept by it. */\n id: string\n /**\n * Where it is: below the line of text position `pos`, or below line\n * `line` (from 1); above with `position: 'above'`. Give one of them.\n */\n pos?: number\n line?: number\n /** Defaults to `below`. */\n position?: 'above' | 'below'\n render: () => VNodeChild\n /** Its height in px before it has been drawn and measured; defaults to one line. */\n height?: number\n /** What it is, read out when the cursor moves onto its line, e.g. \"戴兜的评论\". */\n label?: string\n}\n\n/** Something drawn in a column beside the line numbers, on line `line` (from 1). */\nexport interface CodeGutterMarker {\n line: number\n /** Drawn in the middle of the column. */\n icon?: Component\n /** Short text, when there is no icon. */\n text?: string\n class?: string\n /** Shown on hover and read out. */\n title?: string\n}\n\n/** A column of the gutter, left of the line numbers. */\nexport interface CodeGutter {\n name: string\n /** In px. Defaults to 16. */\n width?: number\n /** The markers on the lines in view; reactive state read here updates them. */\n markers: (context: CodeExtensionContext) => CodeGutterMarker[]\n /** A press on the column, on line `line`, e.g. to set a breakpoint. */\n onPress?: (line: number, event: PointerEvent, context: CodeExtensionContext) => void\n}\n\n/** An undo history that takes the place of the editor's own, e.g. one shared with others. */\nexport interface CodeHistoryHandler {\n /** `false` when there is nothing to undo. */\n undo: () => boolean\n redo: () => boolean\n /** Read in templates and computed values: keep them reactive. */\n canUndo: () => boolean\n canRedo: () => boolean\n /** The next change starts a new undo step, e.g. when the editor loses focus. */\n close?: () => void\n}\n\n/** A bar above or below the text, inside the editor's frame. */\nexport interface CodePanel {\n /** Tells panels apart, unique among one extension's. */\n name: string\n /** Defaults to `bottom`. */\n position?: 'top' | 'bottom'\n render: () => VNodeChild\n}\n\n/** What a completion is, shown as its icon. */\nexport type CodeCompletionKind =\n | 'keyword'\n | 'function'\n | 'method'\n | 'variable'\n | 'property'\n | 'constant'\n | 'class'\n | 'type'\n | 'module'\n | 'snippet'\n | 'text'\n\n/** One entry of the completion list. */\nexport interface CodeCompletion {\n /** Shown, and matched against what was typed. */\n label: string\n kind?: CodeCompletionKind\n /** Short, after the label, e.g. a type. */\n detail?: string\n /** Longer, below the list while this entry is picked: text, or a function returning VNodes. */\n info?: string | (() => VNodeChild)\n /** What goes into the text, if not the label. */\n insert?: string\n /** Inserted as a snippet instead: `${1:name}` places to fill in, Tab to the next, `$0` where it ends. */\n snippet?: string\n /** Moves the entry up (positive) or down among equally good matches. */\n boost?: number\n}\n\n/** What a completion source is asked with. */\nexport interface CodeCompletionRequest {\n /** The cursor. */\n pos: number\n /** The word right before the cursor, by the language's word characters; empty when there is none. */\n word: { from: number; to: number; text: string }\n /** Asked for from the keyboard (`Ctrl` + `Space`, `Alt` + `Esc`) rather than by typing. */\n explicit: boolean\n /** Aborted when the answer is no longer wanted, so a slow source can stop. */\n signal: AbortSignal\n}\n\n/** What a hover or signature source is asked with. */\nexport interface CodePositionRequest {\n /** The position asked about: under the pointer, or the cursor. */\n pos: number\n /** Aborted when the answer is no longer wanted, so a slow source can stop. */\n signal: AbortSignal\n}\n\n/** What a completion source answers: entries to put in place of `from`–cursor. */\nexport interface CodeCompletionResult {\n from: number\n options: CodeCompletion[]\n}\n\n/** Text shown on hover, or with the cursor on it from the keyboard. */\nexport interface CodeHoverResult {\n /** What it is about, `from`–`to`; defaults to the word under the pointer. */\n from?: number\n to?: number\n /** Plain text, or a render function for anything else. */\n content: string | (() => VNodeChild)\n}\n\n/** The parameters of the call the cursor is in. */\nexport interface CodeSignatureResult {\n /** The whole signature, e.g. `slice(start, end)`. */\n label: string\n /** Each parameter as `[from, to]` in `label`. */\n params: Array<[number, number]>\n /** Which parameter the cursor is at, from 0. */\n active: number\n /** Shown under the signature: text, or a function returning VNodes. */\n info?: string | (() => VNodeChild)\n}\n\nexport interface CodeExtension {\n name: string\n /** Higher runs first: its keys and hooks come before others. Defaults to 100. */\n priority?: number\n /** Keys tried before the built-in ones, and after the `keymap` prop. */\n keymap?: (context: CodeExtensionContext) => CodeKeymap\n /**\n * How parts of the text look, read while drawing: reactive state read\n * here updates them. Asked for the lines in view (`context.visible`),\n * which is all that needs them.\n */\n decorations?: (context: CodeExtensionContext) => CodeDecoration[]\n /** Columns beside the line numbers. */\n gutters?: CodeGutter[]\n /**\n * Components between lines. Unlike decorations, these are asked for the\n * whole text, since their heights place every line after them; keep\n * them few (comments, not one per line).\n */\n widgets?: (context: CodeExtensionContext) => CodeWidget[]\n /**\n * Lines left out of view: line numbers (from 1, not text positions), from\n * line `from` to line `to`, both left out,\n * e.g. the unchanged lines of a diff. Unlike a fold, nothing marks the\n * spot; put a widget there for that. Asked for the whole text; reactive\n * state read here updates them. Moving up and down steps over them.\n */\n hide?: (context: CodeExtensionContext) => Array<{ from: number; to: number }>\n /** Bars above or below the text; reactive state read here updates them. */\n panels?: (context: CodeExtensionContext) => CodePanel[]\n /**\n * Finds problems in the text. Run when the editor mounts and again a\n * moment after the text stops changing; an answer that arrives after\n * the text changed again is dropped, and the next run follows it.\n * Meanwhile the problems found move with the text.\n */\n lint?: (\n context: CodeExtensionContext,\n ) => CodeDiagnostic[] | null | undefined | Promise<CodeDiagnostic[] | null | undefined>\n /**\n * Offers completions while typing (after a word character or one of\n * `completionTriggers`) and on `Ctrl` + `Space` or `Alt` + `Esc`. Answers from every\n * extension are put in one list; a Promise is waited for, and dropped\n * when the text has moved on.\n */\n completion?: (\n request: CodeCompletionRequest,\n context: CodeExtensionContext,\n ) => CodeCompletionResult | null | undefined | Promise<CodeCompletionResult | null | undefined>\n /** Characters that ask for completions when typed, such as `.`. */\n completionTriggers?: string[]\n /**\n * Text about a position, shown on hover and with `Mod` + `I`. A Promise\n * is waited for; `signal` aborts when the pointer moves on.\n */\n hover?: (\n request: CodePositionRequest,\n context: CodeExtensionContext,\n ) => CodeHoverResult | null | undefined | Promise<CodeHoverResult | null | undefined>\n /**\n * The parameters of the call around the cursor, shown while typing its\n * arguments. A Promise is waited for, and dropped when the cursor has\n * moved on.\n */\n signature?: (\n request: CodePositionRequest,\n context: CodeExtensionContext,\n ) => CodeSignatureResult | null | undefined | Promise<CodeSignatureResult | null | undefined>\n /**\n * Sees every change before it is applied, in priority order, and may add\n * to it (positions are in the text before the change). Undo, redo, new\n * `v-model` values and other people's changes (`action: 'remote'`) don't\n * come through here.\n */\n transaction?: (tr: CodeTransaction, context: CodeExtensionContext) => void\n /**\n * Runs after every step the editor took, with the text and selection\n * already updated: typing, commands, undo and redo, new `v-model`\n * values and other people's changes. `result.meta.action` tells them\n * apart.\n */\n update?: (result: CodeTransactionResult, context: CodeExtensionContext) => void\n /**\n * Replaces the editor's undo history; the first extension that has one\n * wins. Called once per list of extensions: return the same handler\n * each time.\n */\n history?: (context: CodeExtensionContext) => CodeHistoryHandler\n /**\n * Buttons added to the toolbar shown over the selection on touch screens,\n * after cut, copy, paste and select all. Read again as the selection\n * changes.\n */\n menu?: (context: CodeExtensionContext) => CodeMenuItem[]\n /** Runs once the editor is mounted. Return a function to run when it unmounts. */\n setup?: (context: CodeExtensionContext) => void | (() => void)\n}\n\n/** A button of the touch toolbar, from an extension's `menu`. */\nexport interface CodeMenuItem {\n label: string\n run: (context: CodeExtensionContext) => void\n}\n\n/** What an extension sees of the editor: its instance, plus a little more. */\nexport interface CodeExtensionContext extends CodeEditorExpose {\n /** The text and selection now; reading them in `decorations` or `panels` follows every change. */\n readonly state: CodeState\n readonly doc: CodeText\n readonly selection: CodeSelection\n /** The lines in view: line numbers (from 1, not text positions), both ends in view. */\n readonly visible: { readonly from: number; readonly to: number }\n /** The problems found now, by all linters and the `diagnostics` prop, in text order. */\n readonly diagnostics: readonly CodeDiagnostic[]\n /** Whether the editor has focus; reading it in reactive code follows it. */\n readonly focused: boolean\n /** The editor's texts, in DouUI's locale or as given by the `messages` prop. */\n readonly messages: CodeMessages\n /** Reads a message out to screen readers. */\n announce: (message: string) => void\n /**\n * Runs the linter of the extension named `name` again now (every linter\n * without a name), for problems that arrive by themselves, such as ones a\n * server pushes.\n */\n relint: (name?: string) => void\n}\n\n/** Types an extension; returns it as it is. */\nexport function defineCodeExtension(extension: CodeExtension): CodeExtension {\n return extension\n}\n\nexport const CODE_EDITOR_KEY: InjectionKey<CodeExtensionContext> = Symbol('DouCodeEditor')\n\n/** The editor a panel or gutter component is drawn in. */\nexport function useCodeEditor(): CodeExtensionContext {\n const context = inject(CODE_EDITOR_KEY, null)\n if (!context)\n throw new Error('[@dou-ui/code] useCodeEditor() must be called inside <DouCodeEditor>')\n return context\n}\n"],"mappings":";;;AAmVA,SAAgB,oBAAoB,WAAyC;CAC3E,OAAO;AACT;AAEA,IAAa,kBAAsD,OAAO,eAAe;;AAGzF,SAAgB,gBAAsC;CACpD,MAAM,UAAU,OAAO,iBAAiB,IAAI;CAC5C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,sEAAsE;CACxF,OAAO;AACT"}
1
+ {"version":3,"file":"extension.js","names":[],"sources":["../src/extension.ts"],"sourcesContent":["import type { CodeMessages } from './locale'\nimport { type Component, type InjectionKey, type VNodeChild, inject } from 'vue'\nimport type { CodeKeymap } from './core/keymap'\nimport type { CodeSelection } from './core/selection'\nimport type { CodeText } from './core/text'\nimport type { CodeState, CodeTransaction, CodeTransactionResult } from './core/transaction'\nimport type { CodeEditorExpose } from './types'\n\n/** How bad a diagnostic is, worst first. */\nexport type CodeDiagnosticSeverity = 'error' | 'warning' | 'info' | 'hint'\n\n/** A fix offered with a diagnostic. */\nexport interface CodeDiagnosticAction {\n label: string\n /** Makes the fix, usually with `context.transact`. */\n run: (context: CodeExtensionContext, diagnostic: CodeDiagnostic) => void\n}\n\n/**\n * A problem found in the text, from `from` to `to` (offsets in the text,\n * the same as a language service's ranges). An empty range marks the\n * character after it.\n */\nexport interface CodeDiagnostic {\n from: number\n to: number\n severity: CodeDiagnosticSeverity\n message: string\n /** Who found it, shown after the message, e.g. the name of a linter. */\n source?: string\n /** Fixes, shown under the message and with `Mod` + `.`. */\n actions?: CodeDiagnosticAction[]\n}\n\n/**\n * How a part of the text is drawn. Marks and line classes only change how\n * the text looks (colors, backgrounds, underlines, borders), never its\n * size, so the cursor still lands where the characters are; an inline\n * widget takes its own room in the line.\n */\nexport type CodeDecoration =\n /**\n * Classes on the characters from `from` to `to`. `style` sets inline\n * styles on them as well, e.g. a CSS variable holding a person's color;\n * where marks overlap, the later one's styles win.\n */\n | {\n type: 'mark'\n from: number\n to: number\n class: string\n title?: string\n style?: Readonly<Record<string, string>>\n }\n /** A class on a whole line (`line` from 1), e.g. a tinted background. */\n | { type: 'line'; line: number; class: string }\n /**\n * Something drawn inside a line, before the character at `pos`, such as\n * a color swatch or a parameter's name. It isn't text: the cursor steps\n * over it and copying leaves it out. `width` in px saves measuring it;\n * without it the widget is measured once drawn, and the width is kept by\n * `id`.\n */\n | { type: 'inline'; pos: number; render: () => VNodeChild; width?: number; id?: string }\n\n/**\n * A component drawn between lines, across the editor, e.g. a review\n * comment. The lines below move down to make room, and it moves with the\n * text as lines are added or removed above it.\n */\nexport interface CodeWidget {\n /** Tells widgets apart, unique among one extension's; its measured height is kept by it. */\n id: string\n /**\n * Where it is: below the line of text position `pos`, or below line\n * `line` (from 1); above with `position: 'above'`. Give one of them.\n */\n pos?: number\n line?: number\n /** Defaults to `below`. */\n position?: 'above' | 'below'\n render: () => VNodeChild\n /** Its height in px before it has been drawn and measured; defaults to one line. */\n height?: number\n /** What it is, read out when the cursor moves onto its line, e.g. \"戴兜的评论\". */\n label?: string\n}\n\n/** Something drawn in a column beside the line numbers, on line `line` (from 1). */\nexport interface CodeGutterMarker {\n line: number\n /** Drawn in the middle of the column. */\n icon?: Component\n /** Short text, when there is no icon. */\n text?: string\n class?: string\n /**\n * Shown on hover. Required when the column has `onPress`: the marker is\n * then a button, and this is its name.\n */\n title?: string\n /**\n * When the marker shows: `always`, or `hover`, out of sight until its\n * line is hovered, holds the cursor, or the marker has the focus, e.g. a\n * \"comment\" mark offered on every line. Defaults to `always`.\n */\n visible?: 'always' | 'hover'\n}\n\n/** A column of the gutter, left of the line numbers. */\nexport interface CodeGutter {\n name: string\n /** In px. Defaults to 16. */\n width?: number\n /** The markers on the lines in view; reactive state read here updates them. */\n markers: (context: CodeExtensionContext) => CodeGutterMarker[]\n /**\n * A press on the column, on line `line`, e.g. to set a breakpoint. A\n * marker in such a column is a button: the one on the cursor's line is\n * reached with Escape then Shift+Tab, and Enter or Space presses it.\n */\n onPress?: (\n line: number,\n event: PointerEvent | KeyboardEvent,\n context: CodeExtensionContext,\n ) => void\n}\n\n/** An undo history that takes the place of the editor's own, e.g. one shared with others. */\nexport interface CodeHistoryHandler {\n /** `false` when there is nothing to undo. */\n undo: () => boolean\n redo: () => boolean\n /** Read in templates and computed values: keep them reactive. */\n canUndo: () => boolean\n canRedo: () => boolean\n /** The next change starts a new undo step, e.g. when the editor loses focus. */\n close?: () => void\n}\n\n/** A bar above or below the text, inside the editor's frame. */\nexport interface CodePanel {\n /** Tells panels apart, unique among one extension's. */\n name: string\n /** Defaults to `bottom`. */\n position?: 'top' | 'bottom'\n render: () => VNodeChild\n}\n\n/** What a completion is, shown as its icon. */\nexport type CodeCompletionKind =\n | 'keyword'\n | 'function'\n | 'method'\n | 'variable'\n | 'property'\n | 'constant'\n | 'class'\n | 'type'\n | 'module'\n | 'snippet'\n | 'text'\n\n/** One entry of the completion list. */\nexport interface CodeCompletion {\n /** Shown, and matched against what was typed. */\n label: string\n kind?: CodeCompletionKind\n /** Short, after the label, e.g. a type. */\n detail?: string\n /** Longer, below the list while this entry is picked: text, or a function returning VNodes. */\n info?: string | (() => VNodeChild)\n /** What goes into the text, if not the label. */\n insert?: string\n /** Inserted as a snippet instead: `${1:name}` places to fill in, Tab to the next, `$0` where it ends. */\n snippet?: string\n /** Moves the entry up (positive) or down among equally good matches. */\n boost?: number\n}\n\n/** What a completion source is asked with. */\nexport interface CodeCompletionRequest {\n /** The cursor. */\n pos: number\n /** The word right before the cursor, by the language's word characters; empty when there is none. */\n word: { from: number; to: number; text: string }\n /** Asked for from the keyboard (`Ctrl` + `Space`, `Alt` + `Esc`) rather than by typing. */\n explicit: boolean\n /** Aborted when the answer is no longer wanted, so a slow source can stop. */\n signal: AbortSignal\n}\n\n/** What a hover or signature source is asked with. */\nexport interface CodePositionRequest {\n /** The position asked about: under the pointer, or the cursor. */\n pos: number\n /** Aborted when the answer is no longer wanted, so a slow source can stop. */\n signal: AbortSignal\n}\n\n/** What a completion source answers: entries to put in place of `from`–cursor. */\nexport interface CodeCompletionResult {\n from: number\n options: CodeCompletion[]\n}\n\n/** Text shown on hover, or with the cursor on it from the keyboard. */\nexport interface CodeHoverResult {\n /** What it is about, `from`–`to`; defaults to the word under the pointer. */\n from?: number\n to?: number\n /** Plain text, or a render function for anything else. */\n content: string | (() => VNodeChild)\n}\n\n/** The parameters of the call the cursor is in. */\nexport interface CodeSignatureResult {\n /** The whole signature, e.g. `slice(start, end)`. */\n label: string\n /** Each parameter as `[from, to]` in `label`. */\n params: Array<[number, number]>\n /** Which parameter the cursor is at, from 0. */\n active: number\n /** Shown under the signature: text, or a function returning VNodes. */\n info?: string | (() => VNodeChild)\n}\n\nexport interface CodeExtension {\n name: string\n /** Higher runs first: its keys and hooks come before others. Defaults to 100. */\n priority?: number\n /** Keys tried before the built-in ones, and after the `keymap` prop. */\n keymap?: (context: CodeExtensionContext) => CodeKeymap\n /**\n * How parts of the text look, read while drawing: reactive state read\n * here updates them. Asked for the lines in view (`context.visible`),\n * which is all that needs them.\n */\n decorations?: (context: CodeExtensionContext) => CodeDecoration[]\n /** Columns beside the line numbers. */\n gutters?: CodeGutter[]\n /**\n * Components between lines. Unlike decorations, these are asked for the\n * whole text, since their heights place every line after them; keep\n * them few (comments, not one per line).\n */\n widgets?: (context: CodeExtensionContext) => CodeWidget[]\n /**\n * Lines left out of view: line numbers (from 1, not text positions), from\n * line `from` to line `to`, both left out,\n * e.g. the unchanged lines of a diff. Unlike a fold, nothing marks the\n * spot; put a widget there for that. Asked for the whole text; reactive\n * state read here updates them. Moving up and down steps over them.\n */\n hide?: (context: CodeExtensionContext) => Array<{ from: number; to: number }>\n /** Bars above or below the text; reactive state read here updates them. */\n panels?: (context: CodeExtensionContext) => CodePanel[]\n /**\n * Finds problems in the text. Run when the editor mounts and again a\n * moment after the text stops changing; an answer that arrives after\n * the text changed again is dropped, and the next run follows it.\n * Meanwhile the problems found move with the text.\n */\n lint?: (\n context: CodeExtensionContext,\n ) => CodeDiagnostic[] | null | undefined | Promise<CodeDiagnostic[] | null | undefined>\n /**\n * Offers completions while typing (after a word character or one of\n * `completionTriggers`) and on `Ctrl` + `Space` or `Alt` + `Esc`. Answers from every\n * extension are put in one list; a Promise is waited for, and dropped\n * when the text has moved on.\n */\n completion?: (\n request: CodeCompletionRequest,\n context: CodeExtensionContext,\n ) => CodeCompletionResult | null | undefined | Promise<CodeCompletionResult | null | undefined>\n /** Characters that ask for completions when typed, such as `.`. */\n completionTriggers?: string[]\n /**\n * Text about a position, shown on hover and with `Mod` + `I`. A Promise\n * is waited for; `signal` aborts when the pointer moves on.\n */\n hover?: (\n request: CodePositionRequest,\n context: CodeExtensionContext,\n ) => CodeHoverResult | null | undefined | Promise<CodeHoverResult | null | undefined>\n /**\n * The parameters of the call around the cursor, shown while typing its\n * arguments. A Promise is waited for, and dropped when the cursor has\n * moved on.\n */\n signature?: (\n request: CodePositionRequest,\n context: CodeExtensionContext,\n ) => CodeSignatureResult | null | undefined | Promise<CodeSignatureResult | null | undefined>\n /**\n * Sees every change before it is applied, in priority order, and may add\n * to it (positions are in the text before the change). Undo, redo, new\n * `v-model` values and other people's changes (`action: 'remote'`) don't\n * come through here.\n */\n transaction?: (tr: CodeTransaction, context: CodeExtensionContext) => void\n /**\n * Runs after every step the editor took, with the text and selection\n * already updated: typing, commands, undo and redo, new `v-model`\n * values and other people's changes. `result.meta.action` tells them\n * apart.\n */\n update?: (result: CodeTransactionResult, context: CodeExtensionContext) => void\n /**\n * Replaces the editor's undo history; the first extension that has one\n * wins. Called once per list of extensions: return the same handler\n * each time.\n */\n history?: (context: CodeExtensionContext) => CodeHistoryHandler\n /**\n * Buttons added to the toolbar shown over the selection on touch screens,\n * after cut, copy, paste and select all. Read again as the selection\n * changes.\n */\n menu?: (context: CodeExtensionContext) => CodeMenuItem[]\n /** Runs once the editor is mounted. Return a function to run when it unmounts. */\n setup?: (context: CodeExtensionContext) => void | (() => void)\n}\n\n/** A button of the touch toolbar, from an extension's `menu`. */\nexport interface CodeMenuItem {\n label: string\n run: (context: CodeExtensionContext) => void\n}\n\n/** What an extension sees of the editor: its instance, plus a little more. */\nexport interface CodeExtensionContext extends CodeEditorExpose {\n /** The text and selection now; reading them in `decorations` or `panels` follows every change. */\n readonly state: CodeState\n readonly doc: CodeText\n readonly selection: CodeSelection\n /** The lines in view: line numbers (from 1, not text positions), both ends in view. */\n readonly visible: { readonly from: number; readonly to: number }\n /** The problems found now, by all linters and the `diagnostics` prop, in text order. */\n readonly diagnostics: readonly CodeDiagnostic[]\n /** Whether the editor has focus; reading it in reactive code follows it. */\n readonly focused: boolean\n /** The editor's texts, in DouUI's locale or as given by the `messages` prop. */\n readonly messages: CodeMessages\n /** Reads a message out to screen readers. */\n announce: (message: string) => void\n /**\n * Runs the linter of the extension named `name` again now (every linter\n * without a name), for problems that arrive by themselves, such as ones a\n * server pushes.\n */\n relint: (name?: string) => void\n}\n\n/** Types an extension; returns it as it is. */\nexport function defineCodeExtension(extension: CodeExtension): CodeExtension {\n return extension\n}\n\nexport const CODE_EDITOR_KEY: InjectionKey<CodeExtensionContext> = Symbol('DouCodeEditor')\n\n/**\n * Internal: told each widget height an editor measures, by `extension/id`;\n * DouCodeDiff leaves a blank of the same height across from it.\n */\nexport const WIDGET_HEIGHT_KEY: InjectionKey<((key: string, height: number) => void) | null> =\n Symbol('DouCodeWidgetHeight')\n\n/** The editor a panel or gutter component is drawn in. */\nexport function useCodeEditor(): CodeExtensionContext {\n const context = inject(CODE_EDITOR_KEY, null)\n if (!context)\n throw new Error('[@dou-ui/code] useCodeEditor() must be called inside <DouCodeEditor>')\n return context\n}\n"],"mappings":";;;AAoWA,SAAgB,oBAAoB,WAAyC;CAC3E,OAAO;AACT;AAEA,IAAa,kBAAsD,OAAO,eAAe;;;;;AAMzF,IAAa,oBACX,OAAO,qBAAqB;;AAG9B,SAAgB,gBAAsC;CACpD,MAAM,UAAU,OAAO,iBAAiB,IAAI;CAC5C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,sEAAsE;CACxF,OAAO;AACT"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["CodeEditor","CodeKeys","CodeInput","CodeDiff"],"sources":["../src/index.ts"],"sourcesContent":["import { withInstall } from 'dou-ui'\nimport CodeEditor from './code-editor.vue'\nimport CodeDiff from './code-diff.vue'\nimport CodeInput from './code-input.vue'\nimport CodeKeys from './code-keys.vue'\n\nexport const DouCodeEditor = withInstall(CodeEditor)\nexport const DouCodeKeys = withInstall(CodeKeys)\nexport const DouCodeInput = withInstall(CodeInput)\nexport const DouCodeDiff = withInstall(CodeDiff)\nexport { diffText } from './core/diff'\nexport type { CodeDiffHunk, CodeDiffOptions, CodeDiffPart } from './core/diff'\nexport { defaultCodeKeys } from './code-keys'\nexport { defineCodeExtension, useCodeEditor } from './extension'\nexport type {\n CodeDecoration,\n CodeDiagnostic,\n CodeDiagnosticAction,\n CodeDiagnosticSeverity,\n CodeExtension,\n CodeExtensionContext,\n CodeGutter,\n CodeGutterMarker,\n CodeHistoryHandler,\n CodeCompletion,\n CodeCompletionKind,\n CodeCompletionRequest,\n CodePositionRequest,\n CodeCompletionResult,\n CodeHoverResult,\n CodeMenuItem,\n CodePanel,\n CodeSignatureResult,\n CodeWidget,\n} from './extension'\nexport default DouCodeEditor\n\nexport type {\n CodeDiffEmits,\n CodeDiffProps,\n CodeEditorEmits,\n CodeEditorExpose,\n CodeEditorProps,\n CodeInputEmits,\n CodeInputProps,\n CodeKey,\n CodeKeysProps,\n} from './types'\nexport { CodeText, splitLines } from './core/text'\nexport type { CodeLine } from './core/text'\nexport { ChangeSet } from './core/changes'\nexport type { CodeChange, CodeChangeSpec, MapAssoc } from './core/changes'\nexport {\n isEmptyRange,\n mainRange,\n mapSelection,\n normalizeSelection,\n rangeFrom,\n rangeTo,\n sameSelection,\n selectionOf,\n} from './core/selection'\nexport type { CodeRange, CodeSelection } from './core/selection'\nexport { CodeTransaction } from './core/transaction'\nexport type {\n CodeAction,\n CodeState,\n CodeTransactionMeta,\n CodeTransactionResult,\n} from './core/transaction'\nexport * as codeCommands from './core/commands'\nexport type { CodeCommand, CodeCommandTarget } from './core/commands'\nexport { defaultKeymap } from './core/keymap'\nexport { findPartner, matchBracket } from './core/brackets'\nexport type { BracketMatch } from './core/brackets'\nexport { CodeStream } from './language/stream'\nexport {\n copyPlain,\n defineCodeLanguage,\n languageFor,\n lineParts,\n samePlain,\n tokenizeLine,\n tokenTypes,\n} from './language/language'\nexport type {\n CodeLanguage,\n CodeLanguageSpec,\n CodeLineTokens,\n CodeTokenType,\n} from './language/language'\nexport { CodeHighlighter } from './language/highlighter'\nexport { createCodeHighlighter, highlightToHtml } from './language/to-html'\nexport { createJavaScript, javascript, jsx, tsx, typescript } from './languages/javascript'\nexport type { JavaScriptOptions, JavaScriptState } from './languages/javascript'\nexport { createCss, css, scss } from './languages/css'\nexport type { CssState } from './languages/css'\nexport { json } from './languages/json'\nexport type { JsonState } from './languages/json'\nexport { createHtml, html, vue } from './languages/html'\nexport type { HtmlState } from './languages/html'\nexport { createMarkdown, markdown } from './languages/markdown'\nexport type { MarkdownOptions, MarkdownState } from './languages/markdown'\nexport { python } from './languages/python'\nexport type { PythonState } from './languages/python'\nexport { shell } from './languages/shell'\nexport type { ShellState } from './languages/shell'\nexport { sql } from './languages/sql'\nexport type { SqlState } from './languages/sql'\nexport { yaml } from './languages/yaml'\nexport type { YamlState } from './languages/yaml'\nexport type { CodeKeyBinding, CodeKeymap } from './core/keymap'\nexport type { CodeAssistControl, CodeDiagnosticControl, CodeSearchControl } from './core/commands'\nexport { matchAfter, queryRegExp, replacementFor, searchText } from './core/search'\nexport type { CodeMatch, CodeSearchQuery, CodeSearchResult } from './core/search'\nexport { codeLocales } from './locale'\nexport type { CodeMessages } from './locale'\n\ndeclare module 'vue' {\n export interface GlobalComponents {\n DouCodeEditor: typeof DouCodeEditor\n DouCodeKeys: typeof DouCodeKeys\n DouCodeInput: typeof DouCodeInput\n DouCodeDiff: typeof DouCodeDiff\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAa,gBAAgB,YAAYA,mBAAU;AACnD,IAAa,cAAc,YAAYC,iBAAQ;AAC/C,IAAa,eAAe,YAAYC,kBAAS;AACjD,IAAa,cAAc,YAAYC,iBAAQ"}
1
+ {"version":3,"file":"index.js","names":["CodeEditor","CodeKeys","CodeInput","CodeDiff"],"sources":["../src/index.ts"],"sourcesContent":["import { withInstall } from 'dou-ui'\nimport CodeEditor from './code-editor.vue'\nimport CodeDiff from './code-diff.vue'\nimport CodeInput from './code-input.vue'\nimport CodeKeys from './code-keys.vue'\n\nexport const DouCodeEditor = withInstall(CodeEditor)\nexport const DouCodeKeys = withInstall(CodeKeys)\nexport const DouCodeInput = withInstall(CodeInput)\nexport const DouCodeDiff = withInstall(CodeDiff)\nexport { diffText } from './core/diff'\nexport type { CodeDiffHunk, CodeDiffOptions, CodeDiffPart } from './core/diff'\nexport { defaultCodeKeys } from './code-keys'\nexport { defineCodeExtension, useCodeEditor } from './extension'\nexport type {\n CodeDecoration,\n CodeDiagnostic,\n CodeDiagnosticAction,\n CodeDiagnosticSeverity,\n CodeExtension,\n CodeExtensionContext,\n CodeGutter,\n CodeGutterMarker,\n CodeHistoryHandler,\n CodeCompletion,\n CodeCompletionKind,\n CodeCompletionRequest,\n CodePositionRequest,\n CodeCompletionResult,\n CodeHoverResult,\n CodeMenuItem,\n CodePanel,\n CodeSignatureResult,\n CodeWidget,\n} from './extension'\nexport default DouCodeEditor\n\nexport type {\n CodeDiffEmits,\n CodeDiffGutter,\n CodeDiffGutterMarker,\n CodeDiffProps,\n CodeDiffSide,\n CodeDiffWidget,\n CodeEditorEmits,\n CodeEditorExpose,\n CodeEditorProps,\n CodeInputEmits,\n CodeInputProps,\n CodeKey,\n CodeKeysProps,\n} from './types'\nexport { CodeText, splitLines } from './core/text'\nexport type { CodeLine } from './core/text'\nexport { ChangeSet } from './core/changes'\nexport type { CodeChange, CodeChangeSpec, MapAssoc } from './core/changes'\nexport {\n isEmptyRange,\n mainRange,\n mapSelection,\n normalizeSelection,\n rangeFrom,\n rangeTo,\n sameSelection,\n selectionOf,\n} from './core/selection'\nexport type { CodeRange, CodeSelection } from './core/selection'\nexport { CodeTransaction } from './core/transaction'\nexport type {\n CodeAction,\n CodeState,\n CodeTransactionMeta,\n CodeTransactionResult,\n} from './core/transaction'\nexport * as codeCommands from './core/commands'\nexport type { CodeCommand, CodeCommandTarget } from './core/commands'\nexport { defaultKeymap } from './core/keymap'\nexport { findPartner, matchBracket } from './core/brackets'\nexport type { BracketMatch } from './core/brackets'\nexport { CodeStream } from './language/stream'\nexport {\n copyPlain,\n defineCodeLanguage,\n languageFor,\n lineParts,\n samePlain,\n tokenizeLine,\n tokenTypes,\n} from './language/language'\nexport type {\n CodeLanguage,\n CodeLanguageSpec,\n CodeLineTokens,\n CodeTokenType,\n} from './language/language'\nexport { CodeHighlighter } from './language/highlighter'\nexport { createCodeHighlighter, highlightToHtml } from './language/to-html'\nexport { createJavaScript, javascript, jsx, tsx, typescript } from './languages/javascript'\nexport type { JavaScriptOptions, JavaScriptState } from './languages/javascript'\nexport { createCss, css, scss } from './languages/css'\nexport type { CssState } from './languages/css'\nexport { json } from './languages/json'\nexport type { JsonState } from './languages/json'\nexport { createHtml, html, vue } from './languages/html'\nexport type { HtmlState } from './languages/html'\nexport { createMarkdown, markdown } from './languages/markdown'\nexport type { MarkdownOptions, MarkdownState } from './languages/markdown'\nexport { python } from './languages/python'\nexport type { PythonState } from './languages/python'\nexport { shell } from './languages/shell'\nexport type { ShellState } from './languages/shell'\nexport { sql } from './languages/sql'\nexport type { SqlState } from './languages/sql'\nexport { yaml } from './languages/yaml'\nexport type { YamlState } from './languages/yaml'\nexport type { CodeKeyBinding, CodeKeymap } from './core/keymap'\nexport type { CodeAssistControl, CodeDiagnosticControl, CodeSearchControl } from './core/commands'\nexport { matchAfter, queryRegExp, replacementFor, searchText } from './core/search'\nexport type { CodeMatch, CodeSearchQuery, CodeSearchResult } from './core/search'\nexport { codeLocales } from './locale'\nexport type { CodeMessages } from './locale'\n\ndeclare module 'vue' {\n export interface GlobalComponents {\n DouCodeEditor: typeof DouCodeEditor\n DouCodeKeys: typeof DouCodeKeys\n DouCodeInput: typeof DouCodeInput\n DouCodeDiff: typeof DouCodeDiff\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IAAa,gBAAgB,YAAYA,mBAAU;AACnD,IAAa,cAAc,YAAYC,iBAAQ;AAC/C,IAAa,eAAe,YAAYC,kBAAS;AACjD,IAAa,cAAc,YAAYC,iBAAQ"}
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @layer dou.components{.dou-code-editor{--dou-code-editor-font-size:var(--dou-font-size-sm);--dou-code-editor-line-height:20px;--dou-code-editor-padding-y:8px;--dou-code-editor-padding-x:12px;--dou-code-editor-bg:var(--dou-color-bg-surface);--dou-code-editor-gutter-bg:var(--dou-code-editor-bg);--dou-code-editor-gutter-text:var(--dou-color-text-tertiary);--dou-code-editor-border:var(--dou-color-border);--dou-code-editor-border-focus:color-mix(in oklab,var(--dou-color-focus)70%,var(--dou-color-text));--dou-code-editor-cursor:var(--dou-color-text);--dou-code-editor-active-line:color-mix(in oklab,var(--dou-color-text)4%,transparent);--dou-code-editor-selection:color-mix(in oklab,var(--dou-color-primary)20%,transparent);--dou-code-editor-match:color-mix(in oklab,var(--dou-color-warning)22%,transparent);--dou-code-editor-match-current:color-mix(in oklab,var(--dou-color-warning-text)80%,transparent);--dou-code-editor-match-mark:color-mix(in oklab,var(--dou-color-warning)60%,transparent);--dou-code-editor-bracket:color-mix(in oklab,var(--dou-color-text)35%,transparent);--dou-code-editor-error:var(--dou-color-danger-text);--dou-code-editor-warning:var(--dou-color-warning-text);--dou-code-editor-info:var(--dou-color-primary-text);--dou-code-editor-bracket-unmatched:color-mix(in oklab,var(--dou-color-danger-text)70%,transparent);position:relative;display:flex;box-sizing:border-box;min-height:calc(var(--dou-code-editor-line-height) + 2*var(--dou-code-editor-padding-y) + 2px);overflow:hidden;border:1px solid var(--dou-code-editor-border);border-radius:var(--dou-radius-container);background-color:var(--dou-code-editor-bg);color:var(--dou-color-text);font-family:var(--dou-font-family-mono);font-size:var(--dou-code-editor-font-size);font-variant-ligatures:none;line-height:var(--dou-code-editor-line-height);transition:border-color var(--dou-motion-duration-fast)var(--dou-motion-easing);flex-direction:column;width:100%;min-width:0}.dou-code-editor.is-focused{border-color:var(--dou-code-editor-border-focus)}.dou-code-editor:not(.is-focused){--dou-code-editor-selection:color-mix(in oklab,var(--dou-color-text)10%,transparent)}.dou-code-editor.is-disabled{color:var(--dou-color-text-disabled);cursor:not-allowed}.dou-code-editor__body{position:relative;display:flex;flex:auto;min-height:0}.dou-code-editor__scroller{position:relative;overflow:auto;overscroll-behavior-x:contain;scrollbar-width:thin;flex:auto;min-width:0;min-height:0}.dou-code-editor__minimap{position:relative;overflow:hidden;box-shadow:inset 1px 0 0 color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text-tertiary);cursor:default;touch-action:none;user-select:none;flex:none;width:96px}.dou-code-editor__minimap-canvas{position:absolute;width:100%;height:100%;inset:0}.dou-code-editor__minimap-view{position:absolute;background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);transition:background-color var(--dou-motion-duration-fast)var(--dou-motion-easing);top:0;left:0;right:0}.dou-code-editor__minimap:hover .dou-code-editor__minimap-view{background-color:color-mix(in oklab,var(--dou-color-text)9%,transparent)}.dou-code-editor__minimap:active .dou-code-editor__minimap-view{background-color:color-mix(in oklab,var(--dou-color-text)12%,transparent)}.dou-code-editor__sizer{position:relative;display:flex;box-sizing:border-box;width:max-content;min-width:100%}.dou-code-editor__gutter{position:sticky;z-index:2;box-sizing:border-box;width:var(--dou-code-editor-gutter);background-color:var(--dou-code-editor-gutter-bg);color:var(--dou-code-editor-gutter-text);font-variant-numeric:tabular-nums;cursor:default;user-select:none;-webkit-user-select:none;touch-action:manipulation;flex:none;left:0}.dou-code-editor__numbers{position:absolute;will-change:transform;top:0;left:0;right:0}.dou-code-editor__number{position:relative;box-sizing:border-box;height:var(--dou-code-editor-line-height);padding:0 12px 0 calc(16px + var(--dou-code-editor-gutter-cells,0px));text-align:right}.dou-code-editor__number.is-active{color:var(--dou-color-text-secondary)}.dou-code-editor.is-foldable .dou-code-editor__number{padding-right:24px}.dou-code-editor__fold-toggle{position:absolute;display:flex;height:var(--dou-code-editor-line-height);color:var(--dou-color-text-tertiary);cursor:pointer;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);justify-content:center;align-items: center;width:14px;font-size:12px;top:0;right:6px}.dou-code-editor__gutter:hover .dou-code-editor__fold-toggle{opacity:1}.dou-code-editor__fold-toggle.is-folded{opacity:1}.dou-code-editor__fold-toggle:hover{color:var(--dou-color-text)}@media (pointer:coarse){.dou-code-editor__fold-toggle{opacity:1}.dou-code-editor__fold-toggle:before{position:absolute;content:"";inset:-4px -6px}}.dou-code-editor__content{position:relative;cursor:text;touch-action:manipulation;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;flex:auto;min-width:0}.dou-code-editor.is-disabled .dou-code-editor__content{cursor:not-allowed}.dou-code-editor__lines,.dou-code-editor__matches,.dou-code-editor__brackets,.dou-code-editor__selections,.dou-code-editor__cursors{position:absolute;pointer-events:none;top:0;left:0}.dou-code-editor__lines{will-change:transform;right:0}.dou-code-editor__line{box-sizing:border-box;height:var(--dou-code-editor-line-height);padding:0 var(--dou-code-editor-padding-x);white-space:pre;tab-size:var(--dou-code-editor-tab-size,2)}.dou-code-editor__line.is-wrapped{height:auto}.dou-code-editor__row{box-sizing:border-box;height:var(--dou-code-editor-line-height)}.dou-code-editor__fold-marker{display:inline-block;box-sizing:border-box;border:1px solid var(--dou-color-border);background-color:var(--dou-color-bg-muted);color:var(--dou-color-text-secondary);vertical-align:1px;cursor:pointer;pointer-events:auto;border-radius:4px;height:16px;margin-left:6px;padding:0 6px;font-size:12px;line-height:14px}.dou-code-editor__fold-marker:hover{color:var(--dou-color-text)}.dou-code-editor__line :-webkit-any(.dou-syntax-heading,.dou-syntax-strong){font-weight:inherit}.dou-code-editor__line :-moz-any(.dou-syntax-heading,.dou-syntax-strong){font-weight:inherit}.dou-code-editor__line :is(.dou-syntax-heading,.dou-syntax-strong){font-weight:inherit}.dou-code-editor__compose{text-decoration:underline;text-decoration-color:var(--dou-color-text-tertiary);text-underline-offset:3px}.dou-code-editor__probe{position:absolute;visibility:hidden;white-space:pre;pointer-events:none;top:0;left:0}.dou-code-editor__active-line{position:absolute;height:var(--dou-code-editor-line-height);background-color:var(--dou-code-editor-active-line);pointer-events:none;top:0;left:0;right:0}.dou-code-editor:not(.is-focused) .dou-code-editor__active-line{background-color:#0000}.dou-code-editor__match{position:absolute;box-sizing:border-box;height:var(--dou-code-editor-line-height);background-color:var(--dou-code-editor-match);border-radius:2px;top:0;left:0}.dou-code-editor__match.is-current{box-shadow:inset 0 0 0 1px var(--dou-code-editor-match-current)}.dou-code-editor__marks{position:absolute;z-index:3;pointer-events:none;width:6px;top:0;bottom:0;right:0}.dou-code-editor__mark{position:absolute;background-color:var(--dou-code-editor-match-mark);border-radius:1px;width:6px;height:2px;right:0}.dou-code-editor__mark.is-current{background-color:var(--dou-code-editor-match-current);height:3px}.dou-code-editor__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}.dou-code-editor__search{position:absolute;z-index:4;display:flex;container-type:inline-size;pointer-events:none;justify-content:flex-end;top:6px;left:6px;right:14px}.dou-code-editor__search>*{pointer-events:auto}.dou-code-editor__bracket{position:absolute;box-sizing:border-box;height:var(--dou-code-editor-line-height);border:1px solid var(--dou-code-editor-bracket);border-radius:2px;top:0;left:0}.dou-code-editor__bracket.is-unmatched{border-color:var(--dou-code-editor-bracket-unmatched)}.dou-code-editor__selection{position:absolute;height:var(--dou-code-editor-line-height);background-color:var(--dou-code-editor-selection);border-radius:2px;top:0;left:0}.dou-code-editor__cursor{position:absolute;height:var(--dou-code-editor-line-height);background-color:var(--dou-code-editor-cursor);animation:1.2s step-end .5s infinite dou-code-editor-blink;border-radius:1px;width:2px;top:0;left:0}.dou-code-editor.is-readonly .dou-code-editor__cursor{opacity:.4;animation:none}@media (prefers-reduced-motion:reduce){.dou-code-editor__cursor{animation:none}}.dou-code-editor__placeholder{position:absolute;top:var(--dou-code-editor-padding-y);left:var(--dou-code-editor-padding-x);color:var(--dou-color-text-tertiary);white-space:pre;pointer-events:none}.dou-code-editor__input{position:absolute;z-index:-1;box-sizing:border-box;width:calc(100% - var(--dou-code-editor-padding-x));overflow:hidden;outline:none;color:#0000;caret-color:transparent;font:inherit;font-size:max(var(--dou-font-size-input-min),var(--dou-code-editor-font-size));line-height:inherit;letter-spacing:inherit;white-space:pre;tab-size:var(--dou-code-editor-tab-size,2);resize:none;pointer-events:none;background:0 0;border:0;min-width:1px;margin:0;padding:0}.dou-code-editor__input::selection{background:0 0}}@layer dou.components{.dou-code-editor__problem{text-decoration-line:underline;text-decoration-style:wavy;text-decoration-thickness:1px;text-decoration-skip-ink:none;text-underline-offset:3px}.dou-code-editor__problem.is-error{text-decoration-color:var(--dou-code-editor-error)}.dou-code-editor__problem.is-warning{text-decoration-color:var(--dou-code-editor-warning)}.dou-code-editor__problem.is-info{text-decoration-color:var(--dou-code-editor-info)}.dou-code-editor__problem.is-hint{text-decoration-style:dotted;text-decoration-color:var(--dou-color-text-tertiary)}.dou-code-editor__cells{position:absolute;display:flex;height:var(--dou-code-editor-line-height);top:0;left:0}.dou-code-editor__cell{display:inline-flex;font-size:var(--dou-font-size-sm);flex:none;justify-content:center;align-items: center;height:100%}.dou-code-editor__cell[data-gutter-cell]{cursor:pointer}.dou-code-editor__cell>svg{width:14px;height:14px}.dou-code-editor__problem-icon.is-error{color:var(--dou-code-editor-error)}.dou-code-editor__problem-icon.is-warning{color:var(--dou-code-editor-warning)}.dou-code-editor__problem-icon.is-info{color:var(--dou-code-editor-info)}.dou-code-editor__problem-icon.is-hint{color:var(--dou-color-text-tertiary)}.dou-code-editor__problem-mark.is-error{background-color:var(--dou-code-editor-error)}.dou-code-editor__problem-mark.is-warning{background-color:var(--dou-code-editor-warning)}.dou-code-editor__problem-mark.is-info{background-color:var(--dou-code-editor-info)}.dou-code-editor__problem-mark.is-hint{background-color:var(--dou-color-text-tertiary)}.dou-code-editor__floating{display:contents}.dou-code-editor__floating.is-outside{--dou-code-editor-font-size:var(--dou-font-size-sm);--dou-code-editor-bg:var(--dou-color-bg-surface);--dou-code-editor-error:var(--dou-color-danger-text);--dou-code-editor-warning:var(--dou-color-warning-text);--dou-code-editor-info:var(--dou-color-primary-text);position:absolute;display:block;color:var(--dou-color-text);transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);width:0;height:0;line-height:20px;top:0;left:0}.dou-code-editor__floating.is-outside.is-scrolling{opacity:0;pointer-events:none;transition:none}.dou-code-editor__floating.is-outside.is-fixed{position:fixed}.dou-code-editor__problems{position:absolute;z-index:6;box-sizing:border-box;display:flex;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);white-space:normal;overflow-y:auto;overscroll-behavior:contain;flex-direction:column;gap:4px;width:max-content;max-width:min(440px,100% - 8px);padding:6px;line-height:20px;top:0;left:0}.dou-code-editor__problems>*{flex-shrink:0}.dou-code-editor__problem-item{display:flex;align-items: flex-start;gap:6px;padding:0 2px}.dou-code-editor__problem-item.is-error{--dou-code-editor-problem:var(--dou-code-editor-error)}.dou-code-editor__problem-item.is-warning{--dou-code-editor-problem:var(--dou-code-editor-warning)}.dou-code-editor__problem-item.is-info{--dou-code-editor-problem:var(--dou-code-editor-info)}.dou-code-editor__problem-item.is-hint{--dou-code-editor-problem:var(--dou-color-text-tertiary)}.dou-code-editor__problem-severity{color:var(--dou-code-editor-problem);flex:none;width:14px;height:20px}.dou-code-editor__problem-message{overflow-wrap:anywhere;color:var(--dou-color-text);min-width:0}.dou-code-editor__problem-source{color:var(--dou-color-text-tertiary);margin-left:8px}.dou-code-editor__fixes{display:flex;border-top:1px solid var(--dou-color-border-subtle);flex-wrap:wrap;gap:2px;padding-top:4px}.dou-code-editor__fix{display:inline-flex;border-radius:calc(var(--dou-radius-control) - 2px);color:var(--dou-color-primary-text);font:inherit;cursor:pointer;background:0 0;border:0;align-items: center;height:24px;padding:0 8px}.dou-code-editor__fix.is-active{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent)}.dou-code-editor__fix:hover{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent)}@media (pointer:coarse){.dou-code-editor__fix{height:36px}}.dou-code-editor__hover{color:var(--dou-color-text);overflow-wrap:anywhere;white-space:pre-wrap;padding:0 2px}.dou-code-editor__hover+.dou-code-editor__problem-item{border-top:1px solid var(--dou-color-border-subtle);padding-top:4px}.dou-code-lsp-markup{display:flex;white-space:normal;flex-direction:column;gap:6px}.dou-code-lsp-markup__text{white-space:pre-wrap;margin:0}.dou-code-lsp-markup__code{font-family:var(--dou-font-family-mono);white-space:pre-wrap;margin:0}.dou-code-lsp-markup__inline{font-family:var(--dou-font-family-mono)}.dou-code-editor__completions{position:absolute;z-index:7;box-sizing:border-box;display:flex;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);font-family:var(--dou-font-family-mono);font-size:var(--dou-code-editor-font-size);flex-direction:column;width:max-content;min-width:min(200px,100%);max-height:264px;padding:4px;line-height:20px;top:0;left:0}.dou-code-editor__completion-list{overflow-y:auto;overscroll-behavior:contain;flex:0 auto;min-height:28px}.dou-code-editor__completion{display:flex;border-radius:calc(var(--dou-radius-control) - 2px);color:var(--dou-color-text);cursor:pointer;align-items: center;gap:8px;height:28px;padding:0 8px 0 6px}.dou-code-editor__completion.is-active{background-color:color-mix(in oklab,var(--dou-color-text)8%,transparent)}@media (hover:hover){.dou-code-editor__completion:not(.is-active):hover{background-color:color-mix(in oklab,var(--dou-color-text)4%,transparent)}}@media (pointer:coarse){.dou-code-editor__completion{height:36px}}.dou-code-editor__completion-kind{color:var(--dou-color-text-tertiary);flex:none;width:16px;height:16px}.dou-code-editor__completion-label{overflow:hidden;text-overflow:ellipsis;white-space:pre;flex:none;max-width:75%}.dou-code-editor__completion-match{color:var(--dou-color-primary-text);background:0 0;font-weight:600}.dou-code-editor__completion-detail{overflow:hidden;color:var(--dou-color-text-tertiary);font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;margin-left:auto;padding-left:16px}.dou-code-editor__completion-info{border-top:1px solid var(--dou-color-border-subtle);color:var(--dou-color-text-secondary);font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);white-space:pre-wrap;overflow-wrap:anywhere;flex:none;max-width:400px;margin-top:4px;padding:6px 6px 2px}.dou-code-editor__signature{position:absolute;z-index:6;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);font-size:var(--dou-font-size-sm);overflow-y:auto;pointer-events:none;width:max-content;max-width:min(440px,100% - 8px);padding:4px 8px;line-height:20px;top:0;left:0}.dou-code-editor__signature-label{color:var(--dou-color-text-secondary);font-family:var(--dou-font-family-mono);font-size:var(--dou-code-editor-font-size);overflow-wrap:anywhere}.dou-code-editor__signature-active{color:var(--dou-color-text);text-decoration:underline;text-underline-offset:3px;font-weight:600}.dou-code-editor__signature-info{color:var(--dou-color-text-tertiary);font-family:var(--dou-font-family);white-space:pre-wrap}.dou-code-editor__field{box-shadow:inset 0 0 0 1px var(--dou-color-border-strong);border-radius:2px}.dou-code-editor__widgets{position:absolute;z-index:3;top:0;left:0}.dou-code-editor__widget{position:absolute;box-sizing:border-box;cursor:auto;font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);white-space:normal;user-select:text;-webkit-user-select:text;display:flow-root;line-height:20px;top:0;left:0}.dou-code-editor__inline{display:inline-block;vertical-align:top;height:var(--dou-code-editor-line-height);white-space:nowrap}.dou-code-editor__panels{font-family:var(--dou-font-family);flex:none}.dou-code-editor__panels.is-top{border-bottom:1px solid var(--dou-color-border-subtle)}.dou-code-editor__panels.is-bottom{border-top:1px solid var(--dou-color-border-subtle)}.dou-code-editor__handle{position:absolute;z-index:5;touch-action:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;width:0;height:0;top:0;left:0}.dou-code-editor__handle:before{position:absolute;content:"";width:36px;height:36px;top:-6px}.dou-code-editor__handle:after{position:absolute;background-color:var(--dou-color-primary);content:"";width:14px;height:14px;top:0}.dou-code-editor__handle.is-start:before{left:-27px}.dou-code-editor__handle.is-start:after{border-radius:50% 0 50% 50%;right:0}.dou-code-editor__handle.is-end:before{left:-9px}.dou-code-editor__handle.is-end:after{border-radius:0 50% 50%;left:0}.dou-code-editor__handle.is-caret:before{left:-18px}.dou-code-editor__handle.is-caret:after{border-radius:0 50% 50%;width:12px;height:12px;top:4px;left:-6px;transform:rotate(45deg)}.dou-code-editor__magnifier{position:absolute;z-index:6;box-sizing:border-box;overflow:hidden;border:1px solid var(--dou-color-border);background:linear-gradient(var(--dou-code-editor-bg),var(--dou-code-editor-bg)),var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);pointer-events:none;border-radius:999px;width:128px;top:0;left:0}.dou-code-editor__magnifier-text{position:absolute;height:var(--dou-code-editor-line-height);margin-top:calc(var(--dou-code-editor-line-height)/-2);white-space:pre;tab-size:var(--dou-code-editor-tab-size);transform-origin:0 50%;top:50%;left:0}.dou-code-editor__magnifier-caret{position:absolute;height:calc(var(--dou-code-editor-line-height)*1.5);background-color:var(--dou-color-primary);border-radius:1px;width:2px;top:50%;translate:0 -50%}.dou-code-editor__menu{position:absolute;z-index:6;display:flex;border:1px solid var(--dou-color-border);border-radius:calc(var(--dou-radius-control) + 2px);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);font-family:var(--dou-font-family);white-space:nowrap;gap:2px;padding:2px;top:0;left:0}.dou-code-editor__menu-button{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-color-text);font:inherit;font-size:var(--dou-font-size-sm);cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;align-items: center;min-width:36px;height:36px;padding:0 12px;line-height:1}.dou-code-editor__menu-button:active{background-color:color-mix(in oklab,var(--dou-color-text)8%,transparent)}@media (hover:hover){.dou-code-editor__menu-button:hover{background-color:color-mix(in oklab,var(--dou-color-text)5%,transparent)}}.dou-code-editor__keys{position:absolute;box-sizing:border-box;display:flex;border:1px solid color-mix(in oklab,var(--dou-color-text)10%,transparent);background-color:color-mix(in oklab,var(--dou-color-bg-surface)92%,transparent);box-shadow:var(--dou-shadow-md);-webkit-backdrop-filter:blur(20px)saturate(1.8);backdrop-filter:blur(20px)saturate(1.8);transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);border-radius:22px;height:44px;padding:0 3px 0 0;top:0;left:0}.dou-code-editor__keys.is-fixed{position:fixed}.dou-code-editor__keys.is-scrolling{opacity:0;pointer-events:none;transition:none}.dou-code-editor__keys>.dou-code-keys{background-color:#0000;border-top:0;flex:auto;min-width:0;height:42px}.dou-code-editor__keys>.dou-code-keys .dou-code-keys__scroll{padding:0}.dou-code-editor__keys>.dou-code-keys .dou-code-keys__arrows{position:relative;box-shadow:none;padding:0 0 0 5px}.dou-code-editor__keys>.dou-code-keys .dou-code-keys__arrows:before{position:absolute;background-color:var(--dou-color-border-subtle);content:"";width:1px;top:10px;bottom:10px;left:0}.dou-code-editor__keys>.dou-code-keys .dou-code-keys__key{border-radius:18px}.dou-code-editor__keys-grip{display:flex;color:var(--dou-color-text-tertiary);cursor:grab;touch-action:none;-webkit-tap-highlight-color:transparent;background:0 0;border:0;flex:none;justify-content:center;align-items: center;width:36px;margin:0;padding:0 0 0 6px}.dou-code-editor__keys-grip>svg{width:18px;height:18px}.dou-code-editor__keys-grip:active{cursor:grabbing}.dou-code-editor__keys-grip:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-4px;border-radius:18px}.dou-code-keys{display:flex;box-sizing:border-box;border-top:1px solid var(--dou-color-border);background-color:var(--dou-color-bg-surface);color:var(--dou-color-text);font-family:var(--dou-font-family-mono);font-size:var(--dou-font-size-md);user-select:none;-webkit-user-select:none;height:45px}.dou-code-keys__scroll{display:flex;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;touch-action:pan-x;flex:auto;align-items: center;gap:2px;min-width:0;padding:0 4px}.dou-code-keys__scroll::-webkit-scrollbar{display:none}.dou-code-keys__arrows{display:flex;box-shadow:-1px 0 0 var(--dou-color-border-subtle);flex:none;align-items: center;gap:2px;padding:0 4px}.dou-code-keys__stick{position:relative;color:var(--dou-color-text-tertiary);cursor:grab;touch-action:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;background:0 0;border:0;border-radius:50%;flex:none;width:36px;height:36px;margin:0;padding:0}.dou-code-keys__stick:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:0}.dou-code-keys__pad{position:absolute;z-index:1;display:flex;box-sizing:border-box;background-color:var(--dou-color-bg-muted);box-shadow:inset 0 0 0 1px var(--dou-color-border-subtle);pointer-events:none;transition-property:width,height,margin,background-color,box-shadow,translate;transition-duration:var(--dou-motion-duration-normal);transition-timing-function:var(--dou-motion-easing);border-radius:50%;justify-content:center;align-items: center;width:32px;height:32px;margin:-16px 0 0 -16px;top:50%;left:50%}.dou-code-keys__way{position:absolute;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);width:16px;height:16px}.dou-code-keys__way.is-up{top:8px}.dou-code-keys__way.is-down{bottom:8px}.dou-code-keys__way.is-left{left:8px}.dou-code-keys__way.is-right{right:8px}.dou-code-keys__thumb{box-sizing:border-box;background-color:var(--dou-color-bg-surface);box-shadow:0 0 0 1px color-mix(in oklab,var(--dou-color-text)14%,transparent),var(--dou-shadow-sm);transition-property:width,height,transform;transition-duration:var(--dou-motion-duration-normal);transition-timing-function:var(--dou-motion-easing-spring);border-radius:50%;width:18px;height:18px}.dou-code-keys__stick.is-held{cursor:grabbing}.dou-code-keys__stick.is-held .dou-code-keys__pad{background-color:var(--dou-color-bg-surface);box-shadow:inset 0 0 0 1px var(--dou-color-border),var(--dou-shadow-lg);transition-duration:var(--dou-motion-duration-slow);transition-timing-function:var(--dou-motion-easing-spring);width:104px;height:104px;margin:-52px 0 0 -52px}.dou-code-keys__stick.is-held .dou-code-keys__way{opacity:1}.dou-code-keys__stick.is-held .dou-code-keys__thumb{background-color:color-mix(in oklab,var(--dou-color-text)8%,var(--dou-color-bg-surface));width:40px;height:40px;transition-property:width,height}.dou-code-keys__key{display:inline-flex;box-sizing:border-box;border-radius:var(--dou-radius-control);color:inherit;font:inherit;cursor:pointer;touch-action:pan-x;-webkit-tap-highlight-color:transparent;transition-property:background-color,transform;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing-exit);background:0 0;border:0;flex:none;justify-content:center;align-items: center;min-width:36px;height:36px;padding:0 8px;line-height:1}.dou-code-keys__key>svg{color:var(--dou-color-text-secondary);width:18px;height:18px}@media (hover:hover){.dou-code-keys__key:hover{background-color:color-mix(in oklab,var(--dou-color-text)5%,transparent)}}.dou-code-keys__key.is-pressed{background-color:color-mix(in oklab,var(--dou-color-text)10%,transparent);transition-duration:var(--dou-motion-duration-slow);transition-timing-function:var(--dou-motion-easing-spring);transform:scale(1.12)}}@layer dou.components{.dou-code-input{--dou-code-input-height:var(--dou-control-height-md);display:block;width:100%;min-width:0}.dou-code-input .dou-code-editor{--dou-code-editor-padding-x:var(--dou-control-padding-x-md);--dou-code-editor-padding-y:calc((var(--dou-code-input-height) - var(--dou-code-editor-line-height) - 2px)/2);min-height:var(--dou-code-input-height);border-radius:var(--dou-radius-control);transition-property:border-color,box-shadow}@media (hover:hover){.dou-code-input .dou-code-editor:not(:-webkit-any(.is-focused,.is-disabled)):hover{--dou-code-editor-border:var(--dou-color-border-strong)}.dou-code-input .dou-code-editor:not(:-moz-any(.is-focused,.is-disabled)):hover{--dou-code-editor-border:var(--dou-color-border-strong)}.dou-code-input .dou-code-editor:not(:is(.is-focused,.is-disabled)):hover{--dou-code-editor-border:var(--dou-color-border-strong)}}.dou-code-input .dou-code-editor__marks{display:none}.dou-code-input:not(.is-multiline) .dou-code-editor{height:var(--dou-code-input-height)}.dou-code-input:not(.is-multiline) .dou-code-editor .dou-code-editor__scroller{scrollbar-width:none}.dou-code-input:not(.is-multiline) .dou-code-editor .dou-code-editor__scroller::-webkit-scrollbar{display:none}.dou-code-input.is-multiline .dou-code-editor{min-height:calc(var(--dou-code-input-min-rows,1)*var(--dou-code-editor-line-height) + 2*var(--dou-code-editor-padding-y) + 2px);max-height:calc(var(--dou-code-input-max-rows,6)*var(--dou-code-editor-line-height) + 2*var(--dou-code-editor-padding-y) + 2px)}.dou-code-input.is-invalid .dou-code-editor{--dou-code-editor-border:color-mix(in oklab,var(--dou-color-danger)55%,var(--dou-color-border));--dou-code-editor-border-focus:var(--dou-color-danger)}.dou-code-input--sm{--dou-code-input-height:var(--dou-control-height-sm)}.dou-code-input--sm .dou-code-editor{--dou-code-editor-padding-x:var(--dou-control-padding-x-sm)}.dou-code-input--lg{--dou-code-input-height:var(--dou-control-height-lg)}.dou-code-input--lg .dou-code-editor{--dou-code-editor-padding-x:var(--dou-control-padding-x-lg)}}@keyframes dou-code-peer-name{to{opacity:0;visibility:hidden}}@keyframes dou-code-editor-blink{50%{opacity:0}}@layer dou.components{.dou-code-diff{--dou-code-diff-removed:color-mix(in oklab,var(--dou-color-danger)10%,transparent);--dou-code-diff-added:color-mix(in oklab,var(--dou-color-success)10%,transparent);--dou-code-diff-removed-word:color-mix(in oklab,var(--dou-color-danger-text)30%,transparent);--dou-code-diff-added-word:color-mix(in oklab,var(--dou-color-success-text)30%,transparent);--dou-code-diff-border:var(--dou-color-border);position:relative;display:flex;box-sizing:border-box;overflow:hidden;border:1px solid var(--dou-code-diff-border);border-radius:var(--dou-radius-container);background-color:var(--dou-color-bg-surface);transition:border-color var(--dou-motion-duration-fast)var(--dou-motion-easing);flex-direction:column;width:100%;min-width:0}.dou-code-diff:focus-within{border-color:color-mix(in oklab,var(--dou-color-focus)70%,var(--dou-color-text))}.dou-code-diff .dou-code-editor{border:0;border-radius:0}.dou-code-diff__toolbar{display:flex;border-bottom:1px solid var(--dou-code-diff-border);font-size:var(--dou-font-size-sm);flex:none;align-items: center;gap:2px;min-height:36px;padding:0 6px 0 12px}@media (pointer:coarse){.dou-code-diff__toolbar{min-height:44px}}.dou-code-diff__stats{display:flex;overflow:hidden;white-space:nowrap;flex:auto;align-items: center;gap:8px;min-width:0}.dou-code-diff__count{font-family:var(--dou-font-family-mono);font-variant-numeric:tabular-nums}.dou-code-diff__count.is-added{color:var(--dou-color-success-text)}.dou-code-diff__count.is-removed{color:var(--dou-color-danger-text)}.dou-code-diff__summary{overflow:hidden;color:var(--dou-color-text-secondary);text-overflow:ellipsis}.dou-code-diff__hidden-text{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}@media (pointer:coarse){.dou-code-diff__toolbar .dou-button{position:relative;min-width:36px;min-height:36px}.dou-code-diff__toolbar .dou-button:after{position:absolute;content:"";inset:-2px}}.dou-code-diff__body{display:grid;grid-template-rows:minmax(0,1fr);grid-template-columns:minmax(0,1fr);flex:auto;min-height:0}.dou-code-diff--split>.dou-code-diff__body{grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr)minmax(0,1fr)}.dou-code-diff__label{border-bottom:1px solid var(--dou-code-diff-border);color:var(--dou-color-text-secondary);padding:4px 12px;font-size:12px}.dou-code-diff__label:nth-child(2){border-left:1px solid var(--dou-code-diff-border)}.dou-code-diff__side{display:flex;flex-direction:column;min-width:0;min-height:0}.dou-code-diff__side.is-modified{border-left:1px solid var(--dou-code-diff-border)}.dou-code-diff__side>.dou-code-editor{flex:auto}.dou-code-diff__line.is-removed{background-color:var(--dou-code-diff-removed)}.dou-code-diff__line.is-added{background-color:var(--dou-code-diff-added)}.dou-code-diff__word.is-removed{background-color:var(--dou-code-diff-removed-word)}.dou-code-diff__word.is-added{background-color:var(--dou-code-diff-added-word)}.dou-code-editor__cell.dou-code-diff__sign{font-family:var(--dou-font-family-mono)}.dou-code-editor__cell.dou-code-diff__sign.is-removed{background-color:var(--dou-code-diff-removed);color:var(--dou-color-danger-text)}.dou-code-editor__cell.dou-code-diff__sign.is-added{background-color:var(--dou-code-diff-added);color:var(--dou-color-success-text)}.dou-code-editor__cell.dou-code-diff__number{box-sizing:border-box;color:var(--dou-code-editor-gutter-text);font-family:var(--dou-font-family-mono);font-size:inherit;font-variant-numeric:tabular-nums;justify-content:flex-end;padding-right:8px}.dou-code-editor__cell.dou-code-diff__number.is-removed{background-color:var(--dou-code-diff-removed)}.dou-code-editor__cell.dou-code-diff__number.is-added{background-color:var(--dou-code-diff-added)}.dou-code-diff__filler{background-image:repeating-linear-gradient(-45deg,transparent 0 6px,color-mix(in oklab,var(--dou-color-text)5%,transparent)6px 7px)}.dou-code-diff__bar{display:flex;box-sizing:border-box;border:0;border-block:1px solid var(--dou-code-diff-border);background-color:color-mix(in oklab,var(--dou-color-text)3%,transparent);color:var(--dou-color-text-secondary);font:inherit;text-align:left;cursor:pointer;align-items: center;gap:6px;width:100%;height:28px;margin:0;padding:0 12px;font-size:12px}@media (hover:hover){.dou-code-diff__bar:hover{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text)}}.dou-code-diff__bar:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-2px}@media (pointer:coarse){.dou-code-diff__bar{height:36px}}.dou-code-diff__bar-icon{flex:none;font-size:14px}.dou-code-diff__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}.dou-code-peer{position:relative;z-index:1;display:inline-block;height:var(--dou-code-editor-line-height);vertical-align:top;pointer-events:none;width:0}.dou-code-peer:before{content:"";position:absolute;background-color:var(--dou-code-peer-color);border-radius:1px;width:2px;height:100%;top:0;left:-1px}.dou-code-peer__name{position:absolute;background-color:var(--dou-code-peer-color);color:oklch(from var(--dou-code-peer-color)clamp(.2,(.66 - l)*100,.99)0 0);font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);white-space:nowrap;user-select:none;animation:dou-code-peer-name var(--dou-motion-duration-fast)var(--dou-motion-easing)3s forwards;border-radius:4px 4px 4px 0;padding:0 6px;line-height:18px;bottom:100%;left:-1px}.dou-code-peer.is-below .dou-code-peer__name{border-radius:0 4px 4px;top:100%;bottom:auto}.dou-code-peer-selection{background-color:color-mix(in oklab,var(--dou-code-peer-color)20%,transparent)}}
1
+ @layer dou.components{.dou-code-editor{--dou-code-editor-font-size:var(--dou-font-size-sm);--dou-code-editor-line-height:20px;--dou-code-editor-padding-y:8px;--dou-code-editor-padding-x:12px;--dou-code-editor-bg:var(--dou-color-bg-surface);--dou-code-editor-gutter-bg:var(--dou-code-editor-bg);--dou-code-editor-gutter-text:var(--dou-color-text-tertiary);--dou-code-editor-border:var(--dou-color-border);--dou-code-editor-border-focus:color-mix(in oklab,var(--dou-color-focus)70%,var(--dou-color-text));--dou-code-editor-cursor:var(--dou-color-text);--dou-code-editor-active-line:color-mix(in oklab,var(--dou-color-text)4%,transparent);--dou-code-editor-selection:color-mix(in oklab,var(--dou-color-primary)20%,transparent);--dou-code-editor-match:color-mix(in oklab,var(--dou-color-warning)22%,transparent);--dou-code-editor-match-current:color-mix(in oklab,var(--dou-color-warning-text)80%,transparent);--dou-code-editor-match-mark:color-mix(in oklab,var(--dou-color-warning)60%,transparent);--dou-code-editor-bracket:color-mix(in oklab,var(--dou-color-text)35%,transparent);--dou-code-editor-error:var(--dou-color-danger-text);--dou-code-editor-warning:var(--dou-color-warning-text);--dou-code-editor-info:var(--dou-color-primary-text);--dou-code-editor-bracket-unmatched:color-mix(in oklab,var(--dou-color-danger-text)70%,transparent);position:relative;display:flex;box-sizing:border-box;min-height:calc(var(--dou-code-editor-line-height) + 2*var(--dou-code-editor-padding-y) + 2px);overflow:hidden;border:1px solid var(--dou-code-editor-border);border-radius:var(--dou-radius-container);background-color:var(--dou-code-editor-bg);color:var(--dou-color-text);font-family:var(--dou-font-family-mono);font-size:var(--dou-code-editor-font-size);font-variant-ligatures:none;line-height:var(--dou-code-editor-line-height);transition:border-color var(--dou-motion-duration-fast)var(--dou-motion-easing);flex-direction:column;width:100%;min-width:0}.dou-code-editor.is-focused{border-color:var(--dou-code-editor-border-focus)}.dou-code-editor:not(.is-bordered){min-height:calc(var(--dou-code-editor-line-height) + 2*var(--dou-code-editor-padding-y));border:0;border-radius:0}.dou-code-editor:not(.is-focused){--dou-code-editor-selection:color-mix(in oklab,var(--dou-color-text)10%,transparent)}.dou-code-editor.is-disabled{color:var(--dou-color-text-disabled);cursor:not-allowed}.dou-code-editor__body{position:relative;display:flex;flex:auto;min-height:0}.dou-code-editor__scroller{position:relative;overflow:auto;overscroll-behavior-x:contain;scrollbar-width:thin;flex:auto;min-width:0;min-height:0}.dou-code-editor__minimap{position:relative;overflow:hidden;box-shadow:inset 1px 0 0 color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text-tertiary);cursor:default;touch-action:none;user-select:none;flex:none;width:96px}.dou-code-editor__minimap-canvas{position:absolute;width:100%;height:100%;inset:0}.dou-code-editor__minimap-view{position:absolute;background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);transition:background-color var(--dou-motion-duration-fast)var(--dou-motion-easing);top:0;left:0;right:0}.dou-code-editor__minimap:hover .dou-code-editor__minimap-view{background-color:color-mix(in oklab,var(--dou-color-text)9%,transparent)}.dou-code-editor__minimap:active .dou-code-editor__minimap-view{background-color:color-mix(in oklab,var(--dou-color-text)12%,transparent)}.dou-code-editor__sizer{position:relative;display:flex;box-sizing:border-box;width:max-content;min-width:100%}.dou-code-editor__gutter{position:sticky;z-index:2;box-sizing:border-box;width:var(--dou-code-editor-gutter);background-color:var(--dou-code-editor-gutter-bg);color:var(--dou-code-editor-gutter-text);font-variant-numeric:tabular-nums;cursor:default;user-select:none;-webkit-user-select:none;touch-action:manipulation;flex:none;left:0}.dou-code-editor__numbers{position:absolute;will-change:transform;top:0;left:0;right:0}.dou-code-editor__number{position:relative;box-sizing:border-box;height:var(--dou-code-editor-line-height);padding:0 12px 0 calc(16px + var(--dou-code-editor-gutter-cells,0px));text-align:right}.dou-code-editor__number.is-active{color:var(--dou-color-text-secondary)}.dou-code-editor.is-foldable .dou-code-editor__number{padding-right:24px}.dou-code-editor__fold-toggle{position:absolute;display:flex;height:var(--dou-code-editor-line-height);color:var(--dou-color-text-tertiary);cursor:pointer;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);justify-content:center;align-items: center;width:14px;font-size:12px;top:0;right:6px}.dou-code-editor__gutter:hover .dou-code-editor__fold-toggle{opacity:1}.dou-code-editor__fold-toggle.is-folded{opacity:1}.dou-code-editor__fold-toggle:hover{color:var(--dou-color-text)}@media (pointer:coarse){.dou-code-editor__fold-toggle{opacity:1}.dou-code-editor__fold-toggle:before{position:absolute;content:"";inset:-4px -6px}}.dou-code-editor__content{position:relative;cursor:text;touch-action:manipulation;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;flex:auto;min-width:0}.dou-code-editor.is-disabled .dou-code-editor__content{cursor:not-allowed}.dou-code-editor__lines,.dou-code-editor__matches,.dou-code-editor__brackets,.dou-code-editor__selections,.dou-code-editor__cursors{position:absolute;pointer-events:none;top:0;left:0}.dou-code-editor__lines{will-change:transform;right:0}.dou-code-editor__line{box-sizing:border-box;height:var(--dou-code-editor-line-height);padding:0 var(--dou-code-editor-padding-x);white-space:pre;tab-size:var(--dou-code-editor-tab-size,2)}.dou-code-editor__line.is-wrapped{height:auto}.dou-code-editor__row{box-sizing:border-box;height:var(--dou-code-editor-line-height)}.dou-code-editor__fold-marker{display:inline-block;box-sizing:border-box;border:1px solid var(--dou-color-border);background-color:var(--dou-color-bg-muted);color:var(--dou-color-text-secondary);vertical-align:1px;cursor:pointer;pointer-events:auto;border-radius:4px;height:16px;margin-left:6px;padding:0 6px;font-size:12px;line-height:14px}.dou-code-editor__fold-marker:hover{color:var(--dou-color-text)}.dou-code-editor__line :-webkit-any(.dou-syntax-heading,.dou-syntax-strong){font-weight:inherit}.dou-code-editor__line :-moz-any(.dou-syntax-heading,.dou-syntax-strong){font-weight:inherit}.dou-code-editor__line :is(.dou-syntax-heading,.dou-syntax-strong){font-weight:inherit}.dou-code-editor__compose{text-decoration:underline;text-decoration-color:var(--dou-color-text-tertiary);text-underline-offset:3px}.dou-code-editor__probe{position:absolute;visibility:hidden;white-space:pre;pointer-events:none;top:0;left:0}.dou-code-editor__active-line{position:absolute;height:var(--dou-code-editor-line-height);background-color:var(--dou-code-editor-active-line);pointer-events:none;top:0;left:0;right:0}.dou-code-editor:not(.is-focused) .dou-code-editor__active-line{background-color:#0000}.dou-code-editor__match{position:absolute;box-sizing:border-box;height:var(--dou-code-editor-line-height);background-color:var(--dou-code-editor-match);border-radius:2px;top:0;left:0}.dou-code-editor__match.is-current{box-shadow:inset 0 0 0 1px var(--dou-code-editor-match-current)}.dou-code-editor__marks{position:absolute;z-index:3;pointer-events:none;width:6px;top:0;bottom:0;right:0}.dou-code-editor__mark{position:absolute;background-color:var(--dou-code-editor-match-mark);border-radius:1px;width:6px;height:2px;right:0}.dou-code-editor__mark.is-current{background-color:var(--dou-code-editor-match-current);height:3px}.dou-code-editor__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}.dou-code-editor__search{position:absolute;z-index:4;display:flex;container-type:inline-size;pointer-events:none;justify-content:flex-end;top:6px;left:6px;right:14px}.dou-code-editor__search>*{pointer-events:auto}.dou-code-editor__bracket{position:absolute;box-sizing:border-box;height:var(--dou-code-editor-line-height);border:1px solid var(--dou-code-editor-bracket);border-radius:2px;top:0;left:0}.dou-code-editor__bracket.is-unmatched{border-color:var(--dou-code-editor-bracket-unmatched)}.dou-code-editor__selection{position:absolute;height:var(--dou-code-editor-line-height);background-color:var(--dou-code-editor-selection);border-radius:2px;top:0;left:0}.dou-code-editor__cursor{position:absolute;height:var(--dou-code-editor-line-height);background-color:var(--dou-code-editor-cursor);animation:1.2s step-end .5s infinite dou-code-editor-blink;border-radius:1px;width:2px;top:0;left:0}.dou-code-editor.is-readonly .dou-code-editor__cursor{opacity:.4;animation:none}@media (prefers-reduced-motion:reduce){.dou-code-editor__cursor{animation:none}}.dou-code-editor__placeholder{position:absolute;top:var(--dou-code-editor-padding-y);left:var(--dou-code-editor-padding-x);color:var(--dou-color-text-tertiary);white-space:pre;pointer-events:none}.dou-code-editor__input{position:absolute;z-index:-1;box-sizing:border-box;width:calc(100% - var(--dou-code-editor-padding-x));overflow:hidden;outline:none;color:#0000;caret-color:transparent;font:inherit;font-size:max(var(--dou-font-size-input-min),var(--dou-code-editor-font-size));line-height:inherit;letter-spacing:inherit;white-space:pre;tab-size:var(--dou-code-editor-tab-size,2);resize:none;pointer-events:none;background:0 0;border:0;min-width:1px;margin:0;padding:0}.dou-code-editor__input::selection{background:0 0}}@layer dou.components{.dou-code-editor__problem{text-decoration-line:underline;text-decoration-style:wavy;text-decoration-thickness:1px;text-decoration-skip-ink:none;text-underline-offset:3px}.dou-code-editor__problem.is-error{text-decoration-color:var(--dou-code-editor-error)}.dou-code-editor__problem.is-warning{text-decoration-color:var(--dou-code-editor-warning)}.dou-code-editor__problem.is-info{text-decoration-color:var(--dou-code-editor-info)}.dou-code-editor__problem.is-hint{text-decoration-style:dotted;text-decoration-color:var(--dou-color-text-tertiary)}.dou-code-editor__cells{position:absolute;display:flex;height:var(--dou-code-editor-line-height);top:0;left:0}.dou-code-editor__cell{display:inline-flex;font-size:var(--dou-font-size-sm);flex:none;justify-content:center;align-items: center;height:100%}.dou-code-editor__cell[data-gutter-cell]{cursor:pointer}.dou-code-editor.is-disabled .dou-code-editor__cell[data-gutter-cell]{cursor:default}.dou-code-editor__cell[role=button]{border-radius:var(--dou-radius-control)}.dou-code-editor__cell[role=button]:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-2px}.dou-code-editor__cell>svg{width:14px;height:14px}.dou-code-editor__cell.is-on-hover{opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing)}.dou-code-editor:not(.is-disabled) .dou-code-editor__number:-webkit-any(:hover,.is-hovered)>.dou-code-editor__cells>.dou-code-editor__cell.is-on-hover{opacity:1}.dou-code-editor:not(.is-disabled) .dou-code-editor__number:-moz-any(:hover,.is-hovered)>.dou-code-editor__cells>.dou-code-editor__cell.is-on-hover{opacity:1}.dou-code-editor:not(.is-disabled) .dou-code-editor__number:is(:hover,.is-hovered)>.dou-code-editor__cells>.dou-code-editor__cell.is-on-hover{opacity:1}.dou-code-editor.is-focused .dou-code-editor__number.is-active>.dou-code-editor__cells>.dou-code-editor__cell.is-on-hover{opacity:1}.dou-code-editor__cell.is-on-hover:focus-visible{opacity:1}.dou-code-editor__problem-icon.is-error{color:var(--dou-code-editor-error)}.dou-code-editor__problem-icon.is-warning{color:var(--dou-code-editor-warning)}.dou-code-editor__problem-icon.is-info{color:var(--dou-code-editor-info)}.dou-code-editor__problem-icon.is-hint{color:var(--dou-color-text-tertiary)}.dou-code-editor__problem-mark.is-error{background-color:var(--dou-code-editor-error)}.dou-code-editor__problem-mark.is-warning{background-color:var(--dou-code-editor-warning)}.dou-code-editor__problem-mark.is-info{background-color:var(--dou-code-editor-info)}.dou-code-editor__problem-mark.is-hint{background-color:var(--dou-color-text-tertiary)}.dou-code-editor__floating{display:contents}.dou-code-editor__floating.is-outside{--dou-code-editor-font-size:var(--dou-font-size-sm);--dou-code-editor-bg:var(--dou-color-bg-surface);--dou-code-editor-error:var(--dou-color-danger-text);--dou-code-editor-warning:var(--dou-color-warning-text);--dou-code-editor-info:var(--dou-color-primary-text);position:absolute;display:block;color:var(--dou-color-text);transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);width:0;height:0;line-height:20px;top:0;left:0}.dou-code-editor__floating.is-outside.is-scrolling{opacity:0;pointer-events:none;transition:none}.dou-code-editor__floating.is-outside.is-fixed{position:fixed}.dou-code-editor__problems{position:absolute;z-index:6;box-sizing:border-box;display:flex;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);white-space:normal;overflow-y:auto;overscroll-behavior:contain;flex-direction:column;gap:4px;width:max-content;max-width:min(440px,100% - 8px);padding:6px;line-height:20px;top:0;left:0}.dou-code-editor__problems>*{flex-shrink:0}.dou-code-editor__problem-item{display:flex;align-items: flex-start;gap:6px;padding:0 2px}.dou-code-editor__problem-item.is-error{--dou-code-editor-problem:var(--dou-code-editor-error)}.dou-code-editor__problem-item.is-warning{--dou-code-editor-problem:var(--dou-code-editor-warning)}.dou-code-editor__problem-item.is-info{--dou-code-editor-problem:var(--dou-code-editor-info)}.dou-code-editor__problem-item.is-hint{--dou-code-editor-problem:var(--dou-color-text-tertiary)}.dou-code-editor__problem-severity{color:var(--dou-code-editor-problem);flex:none;width:14px;height:20px}.dou-code-editor__problem-message{overflow-wrap:anywhere;color:var(--dou-color-text);min-width:0}.dou-code-editor__problem-source{color:var(--dou-color-text-tertiary);margin-left:8px}.dou-code-editor__fixes{display:flex;border-top:1px solid var(--dou-color-border-subtle);flex-wrap:wrap;gap:2px;padding-top:4px}.dou-code-editor__fix{display:inline-flex;border-radius:calc(var(--dou-radius-control) - 2px);color:var(--dou-color-primary-text);font:inherit;cursor:pointer;background:0 0;border:0;align-items: center;height:24px;padding:0 8px}.dou-code-editor__fix.is-active{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent)}.dou-code-editor__fix:hover{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent)}@media (pointer:coarse){.dou-code-editor__fix{height:36px}}.dou-code-editor__hover{color:var(--dou-color-text);overflow-wrap:anywhere;white-space:pre-wrap;padding:0 2px}.dou-code-editor__hover+.dou-code-editor__problem-item{border-top:1px solid var(--dou-color-border-subtle);padding-top:4px}.dou-code-lsp-markup{display:flex;white-space:normal;flex-direction:column;gap:6px}.dou-code-lsp-markup__text{white-space:pre-wrap;margin:0}.dou-code-lsp-markup__code{font-family:var(--dou-font-family-mono);white-space:pre-wrap;margin:0}.dou-code-lsp-markup__inline{font-family:var(--dou-font-family-mono)}.dou-code-editor__completions{position:absolute;z-index:7;box-sizing:border-box;display:flex;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);font-family:var(--dou-font-family-mono);font-size:var(--dou-code-editor-font-size);flex-direction:column;width:max-content;min-width:min(200px,100%);max-height:264px;padding:4px;line-height:20px;top:0;left:0}.dou-code-editor__completion-list{overflow-y:auto;overscroll-behavior:contain;flex:0 auto;min-height:28px}.dou-code-editor__completion{display:flex;border-radius:calc(var(--dou-radius-control) - 2px);color:var(--dou-color-text);cursor:pointer;align-items: center;gap:8px;height:28px;padding:0 8px 0 6px}.dou-code-editor__completion.is-active{background-color:color-mix(in oklab,var(--dou-color-text)8%,transparent)}@media (hover:hover){.dou-code-editor__completion:not(.is-active):hover{background-color:color-mix(in oklab,var(--dou-color-text)4%,transparent)}}@media (pointer:coarse){.dou-code-editor__completion{height:36px}}.dou-code-editor__completion-kind{color:var(--dou-color-text-tertiary);flex:none;width:16px;height:16px}.dou-code-editor__completion-label{overflow:hidden;text-overflow:ellipsis;white-space:pre;flex:none;max-width:75%}.dou-code-editor__completion-match{color:var(--dou-color-primary-text);background:0 0;font-weight:600}.dou-code-editor__completion-detail{overflow:hidden;color:var(--dou-color-text-tertiary);font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;margin-left:auto;padding-left:16px}.dou-code-editor__completion-info{border-top:1px solid var(--dou-color-border-subtle);color:var(--dou-color-text-secondary);font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);white-space:pre-wrap;overflow-wrap:anywhere;flex:none;max-width:400px;margin-top:4px;padding:6px 6px 2px}.dou-code-editor__signature{position:absolute;z-index:6;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);font-size:var(--dou-font-size-sm);overflow-y:auto;pointer-events:none;width:max-content;max-width:min(440px,100% - 8px);padding:4px 8px;line-height:20px;top:0;left:0}.dou-code-editor__signature-label{color:var(--dou-color-text-secondary);font-family:var(--dou-font-family-mono);font-size:var(--dou-code-editor-font-size);overflow-wrap:anywhere}.dou-code-editor__signature-active{color:var(--dou-color-text);text-decoration:underline;text-underline-offset:3px;font-weight:600}.dou-code-editor__signature-info{color:var(--dou-color-text-tertiary);font-family:var(--dou-font-family);white-space:pre-wrap}.dou-code-editor__field{box-shadow:inset 0 0 0 1px var(--dou-color-border-strong);border-radius:2px}.dou-code-editor__widgets{position:absolute;z-index:3;top:0;left:0}.dou-code-editor__widget{position:absolute;box-sizing:border-box;cursor:auto;font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);white-space:normal;user-select:text;-webkit-user-select:text;display:flow-root;line-height:20px;top:0;left:0}.dou-code-editor__inline{display:inline-block;vertical-align:top;height:var(--dou-code-editor-line-height);white-space:nowrap}.dou-code-editor__panels{font-family:var(--dou-font-family);flex:none}.dou-code-editor__panels.is-top{border-bottom:1px solid var(--dou-color-border-subtle)}.dou-code-editor__panels.is-bottom{border-top:1px solid var(--dou-color-border-subtle)}.dou-code-editor__handle{position:absolute;z-index:5;touch-action:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;width:0;height:0;top:0;left:0}.dou-code-editor__handle:before{position:absolute;content:"";width:36px;height:36px;top:-6px}.dou-code-editor__handle:after{position:absolute;background-color:var(--dou-color-primary);content:"";width:14px;height:14px;top:0}.dou-code-editor__handle.is-start:before{left:-27px}.dou-code-editor__handle.is-start:after{border-radius:50% 0 50% 50%;right:0}.dou-code-editor__handle.is-end:before{left:-9px}.dou-code-editor__handle.is-end:after{border-radius:0 50% 50%;left:0}.dou-code-editor__handle.is-caret:before{left:-18px}.dou-code-editor__handle.is-caret:after{border-radius:0 50% 50%;width:12px;height:12px;top:4px;left:-6px;transform:rotate(45deg)}.dou-code-editor__magnifier{position:absolute;z-index:6;box-sizing:border-box;overflow:hidden;border:1px solid var(--dou-color-border);background:linear-gradient(var(--dou-code-editor-bg),var(--dou-code-editor-bg)),var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);pointer-events:none;border-radius:999px;width:128px;top:0;left:0}.dou-code-editor__magnifier-text{position:absolute;height:var(--dou-code-editor-line-height);margin-top:calc(var(--dou-code-editor-line-height)/-2);white-space:pre;tab-size:var(--dou-code-editor-tab-size);transform-origin:0 50%;top:50%;left:0}.dou-code-editor__magnifier-caret{position:absolute;height:calc(var(--dou-code-editor-line-height)*1.5);background-color:var(--dou-color-primary);border-radius:1px;width:2px;top:50%;translate:0 -50%}.dou-code-editor__menu{position:absolute;z-index:6;display:flex;border:1px solid var(--dou-color-border);border-radius:calc(var(--dou-radius-control) + 2px);background-color:var(--dou-color-bg-surface);box-shadow:var(--dou-shadow-md);font-family:var(--dou-font-family);white-space:nowrap;gap:2px;padding:2px;top:0;left:0}.dou-code-editor__menu-button{display:inline-flex;border-radius:var(--dou-radius-control);color:var(--dou-color-text);font:inherit;font-size:var(--dou-font-size-sm);cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;align-items: center;min-width:36px;height:36px;padding:0 12px;line-height:1}.dou-code-editor__menu-button:active{background-color:color-mix(in oklab,var(--dou-color-text)8%,transparent)}@media (hover:hover){.dou-code-editor__menu-button:hover{background-color:color-mix(in oklab,var(--dou-color-text)5%,transparent)}}.dou-code-editor__keys{position:absolute;box-sizing:border-box;display:flex;border:1px solid color-mix(in oklab,var(--dou-color-text)10%,transparent);background-color:color-mix(in oklab,var(--dou-color-bg-surface)92%,transparent);box-shadow:var(--dou-shadow-md);-webkit-backdrop-filter:blur(20px)saturate(1.8);backdrop-filter:blur(20px)saturate(1.8);transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);border-radius:22px;height:44px;padding:0 3px 0 0;top:0;left:0}.dou-code-editor__keys.is-fixed{position:fixed}.dou-code-editor__keys.is-scrolling{opacity:0;pointer-events:none;transition:none}.dou-code-editor__keys>.dou-code-keys{background-color:#0000;border-top:0;flex:auto;min-width:0;height:42px}.dou-code-editor__keys>.dou-code-keys .dou-code-keys__scroll{padding:0}.dou-code-editor__keys>.dou-code-keys .dou-code-keys__arrows{position:relative;box-shadow:none;padding:0 0 0 5px}.dou-code-editor__keys>.dou-code-keys .dou-code-keys__arrows:before{position:absolute;background-color:var(--dou-color-border-subtle);content:"";width:1px;top:10px;bottom:10px;left:0}.dou-code-editor__keys>.dou-code-keys .dou-code-keys__key{border-radius:18px}.dou-code-editor__keys-grip{display:flex;color:var(--dou-color-text-tertiary);cursor:grab;touch-action:none;-webkit-tap-highlight-color:transparent;background:0 0;border:0;flex:none;justify-content:center;align-items: center;width:36px;margin:0;padding:0 0 0 6px}.dou-code-editor__keys-grip>svg{width:18px;height:18px}.dou-code-editor__keys-grip:active{cursor:grabbing}.dou-code-editor__keys-grip:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-4px;border-radius:18px}.dou-code-keys{display:flex;box-sizing:border-box;border-top:1px solid var(--dou-color-border);background-color:var(--dou-color-bg-surface);color:var(--dou-color-text);font-family:var(--dou-font-family-mono);font-size:var(--dou-font-size-md);user-select:none;-webkit-user-select:none;height:45px}.dou-code-keys__scroll{display:flex;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;touch-action:pan-x;flex:auto;align-items: center;gap:2px;min-width:0;padding:0 4px}.dou-code-keys__scroll::-webkit-scrollbar{display:none}.dou-code-keys__arrows{display:flex;box-shadow:-1px 0 0 var(--dou-color-border-subtle);flex:none;align-items: center;gap:2px;padding:0 4px}.dou-code-keys__stick{position:relative;color:var(--dou-color-text-tertiary);cursor:grab;touch-action:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;background:0 0;border:0;border-radius:50%;flex:none;width:36px;height:36px;margin:0;padding:0}.dou-code-keys__stick:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:0}.dou-code-keys__pad{position:absolute;z-index:1;display:flex;box-sizing:border-box;background-color:var(--dou-color-bg-muted);box-shadow:inset 0 0 0 1px var(--dou-color-border-subtle);pointer-events:none;transition-property:width,height,margin,background-color,box-shadow,translate;transition-duration:var(--dou-motion-duration-normal);transition-timing-function:var(--dou-motion-easing);border-radius:50%;justify-content:center;align-items: center;width:32px;height:32px;margin:-16px 0 0 -16px;top:50%;left:50%}.dou-code-keys__way{position:absolute;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);width:16px;height:16px}.dou-code-keys__way.is-up{top:8px}.dou-code-keys__way.is-down{bottom:8px}.dou-code-keys__way.is-left{left:8px}.dou-code-keys__way.is-right{right:8px}.dou-code-keys__thumb{box-sizing:border-box;background-color:var(--dou-color-bg-surface);box-shadow:0 0 0 1px color-mix(in oklab,var(--dou-color-text)14%,transparent),var(--dou-shadow-sm);transition-property:width,height,transform;transition-duration:var(--dou-motion-duration-normal);transition-timing-function:var(--dou-motion-easing-spring);border-radius:50%;width:18px;height:18px}.dou-code-keys__stick.is-held{cursor:grabbing}.dou-code-keys__stick.is-held .dou-code-keys__pad{background-color:var(--dou-color-bg-surface);box-shadow:inset 0 0 0 1px var(--dou-color-border),var(--dou-shadow-lg);transition-duration:var(--dou-motion-duration-slow);transition-timing-function:var(--dou-motion-easing-spring);width:104px;height:104px;margin:-52px 0 0 -52px}.dou-code-keys__stick.is-held .dou-code-keys__way{opacity:1}.dou-code-keys__stick.is-held .dou-code-keys__thumb{background-color:color-mix(in oklab,var(--dou-color-text)8%,var(--dou-color-bg-surface));width:40px;height:40px;transition-property:width,height}.dou-code-keys__key{display:inline-flex;box-sizing:border-box;border-radius:var(--dou-radius-control);color:inherit;font:inherit;cursor:pointer;touch-action:pan-x;-webkit-tap-highlight-color:transparent;transition-property:background-color,transform;transition-duration:var(--dou-motion-duration-fast);transition-timing-function:var(--dou-motion-easing-exit);background:0 0;border:0;flex:none;justify-content:center;align-items: center;min-width:36px;height:36px;padding:0 8px;line-height:1}.dou-code-keys__key>svg{color:var(--dou-color-text-secondary);width:18px;height:18px}@media (hover:hover){.dou-code-keys__key:hover{background-color:color-mix(in oklab,var(--dou-color-text)5%,transparent)}}.dou-code-keys__key.is-pressed{background-color:color-mix(in oklab,var(--dou-color-text)10%,transparent);transition-duration:var(--dou-motion-duration-slow);transition-timing-function:var(--dou-motion-easing-spring);transform:scale(1.12)}}@layer dou.components{.dou-code-input{--dou-code-input-height:var(--dou-control-height-md);display:block;width:100%;min-width:0}.dou-code-input .dou-code-editor{--dou-code-editor-padding-x:var(--dou-control-padding-x-md);--dou-code-editor-padding-y:calc((var(--dou-code-input-height) - var(--dou-code-editor-line-height) - 2px)/2);min-height:var(--dou-code-input-height);border-radius:var(--dou-radius-control);transition-property:border-color,box-shadow}@media (hover:hover){.dou-code-input .dou-code-editor:not(:-webkit-any(.is-focused,.is-disabled)):hover{--dou-code-editor-border:var(--dou-color-border-strong)}.dou-code-input .dou-code-editor:not(:-moz-any(.is-focused,.is-disabled)):hover{--dou-code-editor-border:var(--dou-color-border-strong)}.dou-code-input .dou-code-editor:not(:is(.is-focused,.is-disabled)):hover{--dou-code-editor-border:var(--dou-color-border-strong)}}.dou-code-input .dou-code-editor__marks{display:none}.dou-code-input:not(.is-multiline) .dou-code-editor{height:var(--dou-code-input-height)}.dou-code-input:not(.is-multiline) .dou-code-editor .dou-code-editor__scroller{scrollbar-width:none}.dou-code-input:not(.is-multiline) .dou-code-editor .dou-code-editor__scroller::-webkit-scrollbar{display:none}.dou-code-input.is-multiline .dou-code-editor{min-height:calc(var(--dou-code-input-min-rows,1)*var(--dou-code-editor-line-height) + 2*var(--dou-code-editor-padding-y) + 2px);max-height:calc(var(--dou-code-input-max-rows,6)*var(--dou-code-editor-line-height) + 2*var(--dou-code-editor-padding-y) + 2px)}.dou-code-input.is-invalid .dou-code-editor{--dou-code-editor-border:color-mix(in oklab,var(--dou-color-danger)55%,var(--dou-color-border));--dou-code-editor-border-focus:var(--dou-color-danger)}.dou-code-input--sm{--dou-code-input-height:var(--dou-control-height-sm)}.dou-code-input--sm .dou-code-editor{--dou-code-editor-padding-x:var(--dou-control-padding-x-sm)}.dou-code-input--lg{--dou-code-input-height:var(--dou-control-height-lg)}.dou-code-input--lg .dou-code-editor{--dou-code-editor-padding-x:var(--dou-control-padding-x-lg)}}@keyframes dou-code-peer-name{to{opacity:0;visibility:hidden}}@keyframes dou-code-editor-blink{50%{opacity:0}}@layer dou.components{.dou-code-diff{--dou-code-diff-removed:color-mix(in oklab,var(--dou-color-danger)10%,transparent);--dou-code-diff-added:color-mix(in oklab,var(--dou-color-success)10%,transparent);--dou-code-diff-removed-word:color-mix(in oklab,var(--dou-color-danger-text)30%,transparent);--dou-code-diff-added-word:color-mix(in oklab,var(--dou-color-success-text)30%,transparent);--dou-code-diff-border:var(--dou-color-border);position:relative;display:flex;box-sizing:border-box;overflow:hidden;border:1px solid var(--dou-code-diff-border);border-radius:var(--dou-radius-container);background-color:var(--dou-color-bg-surface);transition:border-color var(--dou-motion-duration-fast)var(--dou-motion-easing);flex-direction:column;width:100%;min-width:0}.dou-code-diff:focus-within{border-color:color-mix(in oklab,var(--dou-color-focus)70%,var(--dou-color-text))}.dou-code-diff:not(.is-bordered){border:0;border-radius:0}.dou-code-diff__toolbar{display:flex;border-bottom:1px solid var(--dou-code-diff-border);font-size:var(--dou-font-size-sm);flex:none;align-items: center;gap:2px;min-height:36px;padding:0 6px 0 12px}@media (pointer:coarse){.dou-code-diff__toolbar{min-height:44px}}.dou-code-diff__stats{display:flex;overflow:hidden;white-space:nowrap;flex:auto;align-items: center;gap:8px;min-width:0}.dou-code-diff__count{font-family:var(--dou-font-family-mono);font-variant-numeric:tabular-nums}.dou-code-diff__count.is-added{color:var(--dou-color-success-text)}.dou-code-diff__count.is-removed{color:var(--dou-color-danger-text)}.dou-code-diff__summary{overflow:hidden;color:var(--dou-color-text-secondary);text-overflow:ellipsis}.dou-code-diff__hidden-text{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}@media (pointer:coarse){.dou-code-diff__toolbar .dou-button{position:relative;min-width:36px;min-height:36px}.dou-code-diff__toolbar .dou-button:after{position:absolute;content:"";inset:-2px}}.dou-code-diff__body{display:grid;grid-template-rows:minmax(0,1fr);grid-template-columns:minmax(0,1fr);flex:auto;min-height:0}.dou-code-diff--split>.dou-code-diff__body{grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr)minmax(0,1fr)}.dou-code-diff__label{border-bottom:1px solid var(--dou-code-diff-border);color:var(--dou-color-text-secondary);padding:4px 12px;font-size:12px}.dou-code-diff__label:nth-child(2){border-left:1px solid var(--dou-code-diff-border)}.dou-code-diff__side{display:flex;flex-direction:column;min-width:0;min-height:0}.dou-code-diff__side.is-modified{border-left:1px solid var(--dou-code-diff-border)}.dou-code-diff__side>.dou-code-editor{flex:auto}.dou-code-diff__line.is-removed{background-color:var(--dou-code-diff-removed)}.dou-code-diff__line.is-added{background-color:var(--dou-code-diff-added)}.dou-code-diff__word.is-removed{background-color:var(--dou-code-diff-removed-word)}.dou-code-diff__word.is-added{background-color:var(--dou-code-diff-added-word)}.dou-code-editor__cell.dou-code-diff__sign{font-family:var(--dou-font-family-mono)}.dou-code-editor__cell.dou-code-diff__sign.is-removed{background-color:var(--dou-code-diff-removed);color:var(--dou-color-danger-text)}.dou-code-editor__cell.dou-code-diff__sign.is-added{background-color:var(--dou-code-diff-added);color:var(--dou-color-success-text)}.dou-code-editor__cell.dou-code-diff__number{box-sizing:border-box;color:var(--dou-code-editor-gutter-text);font-family:var(--dou-font-family-mono);font-size:inherit;font-variant-numeric:tabular-nums;justify-content:flex-end;padding-right:8px}.dou-code-editor__cell.dou-code-diff__number.is-removed{background-color:var(--dou-code-diff-removed)}.dou-code-editor__cell.dou-code-diff__number.is-added{background-color:var(--dou-code-diff-added)}.dou-code-diff__widget{display:flow-root}.dou-code-diff--split>.dou-code-diff__body{position:relative}.dou-code-diff__spans{position:absolute;z-index:3;overflow:hidden;pointer-events:none;left:0;right:0}.dou-code-diff__span{position:absolute;display:flow-root;box-sizing:border-box;font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);pointer-events:auto;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);line-height:20px;top:0;left:0;right:0}.dou-code-diff__span:not(.is-placed){visibility:hidden;opacity:0;transition:none}.dou-code-diff__filler{background-image:repeating-linear-gradient(-45deg,transparent 0 6px,color-mix(in oklab,var(--dou-color-text)5%,transparent)6px 7px)}.dou-code-diff__bar{display:flex;box-sizing:border-box;border:0;border-block:1px solid var(--dou-code-diff-border);background-color:color-mix(in oklab,var(--dou-color-text)3%,transparent);color:var(--dou-color-text-secondary);font:inherit;text-align:left;cursor:pointer;align-items: center;gap:6px;width:100%;height:28px;margin:0;padding:0 12px;font-size:12px}@media (hover:hover){.dou-code-diff__bar:hover{background-color:color-mix(in oklab,var(--dou-color-text)6%,transparent);color:var(--dou-color-text)}}.dou-code-diff__bar:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:-2px}@media (pointer:coarse){.dou-code-diff__bar{height:36px}}.dou-code-diff__bar-icon{flex:none;font-size:14px}.dou-code-diff__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}.dou-code-peer{position:relative;z-index:1;display:inline-block;height:var(--dou-code-editor-line-height);vertical-align:top;pointer-events:none;width:0}.dou-code-peer:before{content:"";position:absolute;background-color:var(--dou-code-peer-color);border-radius:1px;width:2px;height:100%;top:0;left:-1px}.dou-code-peer__name{position:absolute;background-color:var(--dou-code-peer-color);color:oklch(from var(--dou-code-peer-color)clamp(.2,(.66 - l)*100,.99)0 0);font-family:var(--dou-font-family);font-size:var(--dou-font-size-sm);white-space:nowrap;user-select:none;animation:dou-code-peer-name var(--dou-motion-duration-fast)var(--dou-motion-easing)3s forwards;border-radius:4px 4px 4px 0;padding:0 6px;line-height:18px;bottom:100%;left:-1px}.dou-code-peer.is-below .dou-code-peer__name{border-radius:0 4px 4px;top:100%;bottom:auto}.dou-code-peer-selection{background-color:color-mix(in oklab,var(--dou-code-peer-color)20%,transparent)}}
@@ -1,6 +1,6 @@
1
1
  import { type CodeDiffHunk } from './core/diff';
2
2
  import { type CodeExtension } from './extension';
3
- import type { CodeDiffProps, CodeEditorExpose } from './types';
3
+ import type { CodeDiffGutter, CodeDiffProps, CodeDiffWidget, CodeEditorExpose } from './types';
4
4
  declare function next(): boolean;
5
5
  declare function previous(): boolean;
6
6
  declare const __VLS_export: import("vue").DefineComponent<CodeDiffProps, {
@@ -27,19 +27,22 @@ declare const __VLS_export: import("vue").DefineComponent<CodeDiffProps, {
27
27
  toolbar: boolean;
28
28
  language: import("./index.js").CodeLanguage<any> | null;
29
29
  tabSize: number;
30
+ original: string;
30
31
  messages: Partial<import("./locale").CodeMessages>;
31
32
  mode: "split" | "inline" | "auto";
32
33
  modelValue: string;
34
+ bordered: boolean;
33
35
  wrap: boolean;
34
36
  extensions: CodeExtension[];
35
37
  editable: boolean;
36
- original: string;
38
+ widgets: CodeDiffWidget[];
37
39
  collapseUnchanged: boolean | {
38
40
  context?: number;
39
41
  minLines?: number;
40
42
  };
41
43
  ignoreWhitespace: boolean;
42
44
  words: boolean;
45
+ gutters: CodeDiffGutter[];
43
46
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
44
47
  declare const _default: typeof __VLS_export;
45
48
  export default _default;
@@ -29,6 +29,7 @@ declare const __VLS_export: import("vue").DefineComponent<CodeEditorProps, CodeE
29
29
  modelValue: string;
30
30
  lineNumbers: boolean;
31
31
  gutter: boolean;
32
+ bordered: boolean;
32
33
  activeLine: boolean;
33
34
  closeBrackets: boolean;
34
35
  matchBrackets: boolean;
@@ -98,8 +98,17 @@ export interface CodeGutterMarker {
98
98
  /** Short text, when there is no icon. */
99
99
  text?: string;
100
100
  class?: string;
101
- /** Shown on hover and read out. */
101
+ /**
102
+ * Shown on hover. Required when the column has `onPress`: the marker is
103
+ * then a button, and this is its name.
104
+ */
102
105
  title?: string;
106
+ /**
107
+ * When the marker shows: `always`, or `hover`, out of sight until its
108
+ * line is hovered, holds the cursor, or the marker has the focus, e.g. a
109
+ * "comment" mark offered on every line. Defaults to `always`.
110
+ */
111
+ visible?: 'always' | 'hover';
103
112
  }
104
113
  /** A column of the gutter, left of the line numbers. */
105
114
  export interface CodeGutter {
@@ -108,8 +117,12 @@ export interface CodeGutter {
108
117
  width?: number;
109
118
  /** The markers on the lines in view; reactive state read here updates them. */
110
119
  markers: (context: CodeExtensionContext) => CodeGutterMarker[];
111
- /** A press on the column, on line `line`, e.g. to set a breakpoint. */
112
- onPress?: (line: number, event: PointerEvent, context: CodeExtensionContext) => void;
120
+ /**
121
+ * A press on the column, on line `line`, e.g. to set a breakpoint. A
122
+ * marker in such a column is a button: the one on the cursor's line is
123
+ * reached with Escape then Shift+Tab, and Enter or Space presses it.
124
+ */
125
+ onPress?: (line: number, event: PointerEvent | KeyboardEvent, context: CodeExtensionContext) => void;
113
126
  }
114
127
  /** An undo history that takes the place of the editor's own, e.g. one shared with others. */
115
128
  export interface CodeHistoryHandler {
@@ -317,5 +330,10 @@ export interface CodeExtensionContext extends CodeEditorExpose {
317
330
  /** Types an extension; returns it as it is. */
318
331
  export declare function defineCodeExtension(extension: CodeExtension): CodeExtension;
319
332
  export declare const CODE_EDITOR_KEY: InjectionKey<CodeExtensionContext>;
333
+ /**
334
+ * Internal: told each widget height an editor measures, by `extension/id`;
335
+ * DouCodeDiff leaves a blank of the same height across from it.
336
+ */
337
+ export declare const WIDGET_HEIGHT_KEY: InjectionKey<((key: string, height: number) => void) | null>;
320
338
  /** The editor a panel or gutter component is drawn in. */
321
339
  export declare function useCodeEditor(): CodeExtensionContext;
@@ -25,6 +25,7 @@ export declare const DouCodeEditor: import("dou-ui").WithInstall<import("vue").D
25
25
  modelValue: string;
26
26
  lineNumbers: boolean;
27
27
  gutter: boolean;
28
+ bordered: boolean;
28
29
  activeLine: boolean;
29
30
  closeBrackets: boolean;
30
31
  matchBrackets: boolean;
@@ -86,19 +87,22 @@ export declare const DouCodeDiff: import("dou-ui").WithInstall<import("vue").Def
86
87
  toolbar: boolean;
87
88
  language: import("./index.js").CodeLanguage<any> | null;
88
89
  tabSize: number;
90
+ original: string;
89
91
  messages: Partial<import("./locale").CodeMessages>;
90
92
  mode: "split" | "inline" | "auto";
91
93
  modelValue: string;
94
+ bordered: boolean;
92
95
  wrap: boolean;
93
96
  extensions: import("./extension").CodeExtension[];
94
97
  editable: boolean;
95
- original: string;
98
+ widgets: import("./types").CodeDiffWidget[];
96
99
  collapseUnchanged: boolean | {
97
100
  context?: number;
98
101
  minLines?: number;
99
102
  };
100
103
  ignoreWhitespace: boolean;
101
104
  words: boolean;
105
+ gutters: import("./types").CodeDiffGutter[];
102
106
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, import("vue").HTMLAttributes>;
103
107
  export { diffText } from './core/diff';
104
108
  export type { CodeDiffHunk, CodeDiffOptions, CodeDiffPart } from './core/diff';
@@ -106,7 +110,7 @@ export { defaultCodeKeys } from './code-keys';
106
110
  export { defineCodeExtension, useCodeEditor } from './extension';
107
111
  export type { CodeDecoration, CodeDiagnostic, CodeDiagnosticAction, CodeDiagnosticSeverity, CodeExtension, CodeExtensionContext, CodeGutter, CodeGutterMarker, CodeHistoryHandler, CodeCompletion, CodeCompletionKind, CodeCompletionRequest, CodePositionRequest, CodeCompletionResult, CodeHoverResult, CodeMenuItem, CodePanel, CodeSignatureResult, CodeWidget, } from './extension';
108
112
  export default DouCodeEditor;
109
- export type { CodeDiffEmits, CodeDiffProps, CodeEditorEmits, CodeEditorExpose, CodeEditorProps, CodeInputEmits, CodeInputProps, CodeKey, CodeKeysProps, } from './types';
113
+ export type { CodeDiffEmits, CodeDiffGutter, CodeDiffGutterMarker, CodeDiffProps, CodeDiffSide, CodeDiffWidget, CodeEditorEmits, CodeEditorExpose, CodeEditorProps, CodeInputEmits, CodeInputProps, CodeKey, CodeKeysProps, } from './types';
110
114
  export { CodeText, splitLines } from './core/text';
111
115
  export type { CodeLine } from './core/text';
112
116
  export { ChangeSet } from './core/changes';
@@ -1,5 +1,5 @@
1
- import type { Component } from 'vue';
2
- import type { CodeDiagnostic, CodeExtension } from './extension';
1
+ import type { Component, VNodeChild } from 'vue';
2
+ import type { CodeDiagnostic, CodeExtension, CodeGutterMarker } from './extension';
3
3
  import type { CodeCommand } from './core/commands';
4
4
  import type { CodeKeymap } from './core/keymap';
5
5
  import type { CodeSearchQuery } from './core/search';
@@ -32,6 +32,12 @@ export interface CodeEditorProps {
32
32
  * On by default.
33
33
  */
34
34
  gutter?: boolean;
35
+ /**
36
+ * The hairline frame and rounded corners. Off, the editor takes no
37
+ * border at all, for a panel or card that already has an edge. On by
38
+ * default.
39
+ */
40
+ bordered?: boolean;
35
41
  /** Tints the line with the cursor. */
36
42
  activeLine?: boolean;
37
43
  /** Columns per tab stop, also the width of one indent. */
@@ -254,13 +260,72 @@ export interface CodeDiffProps {
254
260
  words?: boolean;
255
261
  /** Wraps long lines in the inline view; side by side, lines never wrap, to stay aligned. */
256
262
  wrap?: boolean;
257
- /** Extensions of the modified side, side by side only. */
263
+ /**
264
+ * Extensions of the modified side, side by side only: for things that
265
+ * read the text, such as a language service or a linter. Markers and
266
+ * widgets for both sides go in `gutters` and `widgets`.
267
+ */
258
268
  extensions?: CodeExtension[];
269
+ /**
270
+ * Columns left of the line numbers, with markers on either text's lines;
271
+ * drawn on both sides side by side, and on the matching rows inline.
272
+ */
273
+ gutters?: CodeDiffGutter[];
274
+ /**
275
+ * Components between lines of either text, e.g. review comments. The
276
+ * other side leaves a blank of the same height, so the two stay lined up.
277
+ */
278
+ widgets?: CodeDiffWidget[];
259
279
  tabSize?: number;
260
280
  /** The toolbar above: change count, previous and next, expand, and the view toggle. On by default. */
261
281
  toolbar?: boolean;
282
+ /**
283
+ * The hairline frame and rounded corners around the whole diff. Off,
284
+ * the diff takes no border at all and no focus edge, for a panel or
285
+ * card that already has one; the lines between the toolbar and the
286
+ * sides stay. On by default.
287
+ */
288
+ bordered?: boolean;
262
289
  messages?: Partial<CodeMessages>;
263
290
  }
291
+ /** Which of the two texts a line is counted in. */
292
+ export type CodeDiffSide = 'original' | 'modified';
293
+ /** A marker in a column of `DouCodeDiff`, on line `line` (from 1) of side `side`. */
294
+ export interface CodeDiffGutterMarker extends CodeGutterMarker {
295
+ side: CodeDiffSide;
296
+ }
297
+ /** A column of `DouCodeDiff`'s gutter, left of the line numbers. */
298
+ export interface CodeDiffGutter {
299
+ name: string;
300
+ /** In px. Defaults to 16. */
301
+ width?: number;
302
+ markers: CodeDiffGutterMarker[];
303
+ /**
304
+ * A press on the column, on line `line` of `side`. Inline, a row both
305
+ * texts share counts as the marker's side there, else as `modified`.
306
+ */
307
+ onPress?: (line: number, event: PointerEvent | KeyboardEvent, side: CodeDiffSide) => void;
308
+ }
309
+ /** A component drawn between lines of `DouCodeDiff`. */
310
+ export interface CodeDiffWidget {
311
+ /** Tells widgets apart across both sides; its measured height is kept by it. */
312
+ id: string;
313
+ side: CodeDiffSide;
314
+ /** Below line `line` (from 1) of `side`; above with `position: 'above'`. */
315
+ line: number;
316
+ /** Defaults to `below`. */
317
+ position?: 'above' | 'below';
318
+ render: () => VNodeChild;
319
+ /** Its height in px before it has been drawn and measured; defaults to one line. */
320
+ height?: number;
321
+ /** What it is, read out when the cursor moves onto its line. */
322
+ label?: string;
323
+ /**
324
+ * Side by side: `side` (the default) draws it in its own column, `both`
325
+ * across the two. Inline, it always takes the one column.
326
+ */
327
+ span?: 'side' | 'both';
328
+ }
264
329
  export interface CodeDiffEmits {
265
330
  'update:modelValue': [value: string];
266
331
  'update:mode': [mode: 'split' | 'inline'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dou-ui/code",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.4",
4
4
  "description": "DouUI 的代码编辑器:大文件流畅编辑、输入法友好、多光标与协同",
5
5
  "keywords": [
6
6
  "vue",
@@ -63,10 +63,10 @@
63
63
  "build": "vite build && vue-tsc -p tsconfig.build.json && bun scripts/build-style.ts"
64
64
  },
65
65
  "dependencies": {
66
- "@dou-ui/icons": "0.1.0-alpha.2"
66
+ "@dou-ui/icons": "0.1.0-alpha.4"
67
67
  },
68
68
  "peerDependencies": {
69
- "dou-ui": "0.1.0-alpha.2",
69
+ "dou-ui": "0.1.0-alpha.4",
70
70
  "vue": "^3.5.0",
71
71
  "yjs": "^13.6.0",
72
72
  "shiki": "^1.0.0 || ^2.0.0 || ^3.0.0"