@dou-ui/code 0.1.0-alpha.3 → 0.1.0-alpha.30
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/assets/default-BWWFJmzn.js.map +1 -0
- package/dist/code-diff.js.map +1 -1
- package/dist/code-diff.vue_vue_type_script_setup_true_lang.js +756 -63
- package/dist/code-diff.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-editor.js.map +1 -1
- package/dist/code-editor.vue_vue_type_script_setup_true_lang.js +784 -474
- package/dist/code-editor.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/extension.js +6 -1
- package/dist/extension.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/language/highlighter.js +1 -1
- package/dist/language/highlighter.js.map +1 -1
- package/dist/language/language.js +24 -2
- package/dist/language/language.js.map +1 -1
- package/dist/language/remote-tokens.js +131 -0
- package/dist/language/remote-tokens.js.map +1 -0
- package/dist/language/worker-client.js +308 -33
- package/dist/language/worker-client.js.map +1 -1
- package/dist/language/worker-protocol.js.map +1 -1
- package/dist/shiki/index.js +54 -3
- package/dist/shiki/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/code-diff.vue.d.ts +18 -21
- package/dist/types/code-editor.vue.d.ts +3 -1
- package/dist/types/extension.d.ts +57 -5
- package/dist/types/index.d.ts +97 -21
- package/dist/types/language/language.d.ts +27 -0
- package/dist/types/language/remote-tokens.d.ts +38 -0
- package/dist/types/language/worker-client.d.ts +85 -15
- package/dist/types/language/worker-protocol.d.ts +53 -2
- package/dist/types/shiki/index.d.ts +36 -1
- package/dist/types/types.d.ts +166 -10
- package/dist/types/view/measure.d.ts +6 -0
- package/dist/types/worker/index.d.ts +27 -12
- package/dist/view/measure.js +23 -5
- package/dist/view/measure.js.map +1 -1
- package/dist/worker/default.js +1 -1
- package/dist/worker/index.js +280 -53
- package/dist/worker/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/assets/default-BZBMZKf_.js.map +0 -1
package/dist/shiki/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/shiki/index.ts"],"sourcesContent":["import { type CodeLanguage, type CodeTokenType, defineCodeLanguage } from '../language/language'\n\n/** The part of a TextMate rule stack the editor uses: Shiki's `StateStack`. */\nexport interface ShikiStateStack {\n equals(other: ShikiStateStack): boolean\n}\n\n/** What the editor needs of a Shiki highlighter (`createHighlighter()` from `shiki`). */\nexport interface ShikiHighlighterLike {\n getLanguage(name: string): {\n tokenizeLine(\n line: string,\n state: ShikiStateStack | null,\n timeLimit?: number,\n ): {\n tokens: Array<{ startIndex: number; endIndex: number; scopes: string[] }>\n ruleStack: ShikiStateStack\n /** The time limit ran out before the end of the line. */\n stoppedEarly?: boolean\n }\n }\n}\n\nexport interface ShikiLanguageOptions {\n /** The name the editor and code blocks know it by; defaults to the Shiki language's. */\n name?: string\n aliases?: string[]\n /** How the language writes comments, for toggling them; Shiki doesn't say. */\n comment?: { line?: string; block?: [open: string, close: string] }\n brackets?: string\n autoClose?: string\n indentAfter?: RegExp\n /**\n * The token kind (syntax color) for a token's scopes, outermost first;\n * return `undefined` to use the built-in mapping (`tokenTypeOfScopes`).\n */\n tokenType?: (scopes: readonly string[]) => CodeTokenType | null | undefined\n}\n\nexport interface ShikiState {\n /** The grammar's state at the start of the line being read, or after the last line. */\n stack: ShikiStateStack | null\n /** The tokens of the line being read; positions from `base`. */\n line: { text: string; base: number; ends: number[]; types: Array<CodeTokenType | null> } | null\n}\n\n/** Scope prefixes and the kind each is drawn as; the first that matches a token's scopes, from the innermost scope out, wins. */\nconst SCOPES: Array<[prefix: string, type: CodeTokenType]> = [\n ['comment', 'comment'],\n ['punctuation.definition.comment', 'comment'],\n ['string.regexp', 'string'],\n ['constant.character.escape', 'string'],\n ['punctuation.definition.string', 'string'],\n ['string', 'string'],\n ['constant.numeric', 'number'],\n ['constant.language', 'keyword'],\n ['constant.other.color', 'number'],\n ['keyword.operator', 'operator'],\n ['storage.type.function.arrow', 'operator'],\n ['keyword', 'keyword'],\n ['storage', 'keyword'],\n ['entity.name.function', 'function'],\n ['support.function', 'function'],\n ['meta.function-call', 'function'],\n ['entity.name.tag', 'tag'],\n ['entity.other.attribute-name', 'attribute'],\n ['entity.name.type', 'type'],\n ['entity.name.class', 'type'],\n ['entity.other.inherited-class', 'type'],\n ['support.type.property-name', 'property'],\n ['support.type', 'type'],\n ['support.class', 'type'],\n ['variable.other.property', 'property'],\n ['variable.other.object.property', 'property'],\n ['support.variable.property', 'property'],\n ['meta.object-literal.key', 'property'],\n ['variable.language', 'keyword'],\n ['variable', 'variable'],\n ['entity.name', 'variable'],\n ['markup.heading', 'heading'],\n ['markup.bold', 'strong'],\n ['markup.italic', 'emphasis'],\n ['markup.underline.link', 'link'],\n ['markup.inline.raw', 'string'],\n ['meta.preprocessor', 'meta'],\n ['meta.decorator', 'meta'],\n ['meta.annotation', 'meta'],\n ['invalid', 'invalid'],\n ['punctuation', 'punctuation'],\n]\n\nconst matches = (scope: string, prefix: string) =>\n scope === prefix || (scope.startsWith(prefix) && scope[prefix.length] === '.')\n\n/** The kind a token with these scopes (outermost first, as Shiki gives them) is drawn as. */\nexport function tokenTypeOfScopes(scopes: readonly string[]): CodeTokenType | null {\n for (let i = scopes.length - 1; i > 0; i--) {\n const scope = scopes[i]!\n for (const [prefix, type] of SCOPES) if (matches(scope, prefix)) return type\n }\n return null\n}\n\n/** How long one line may take to read, in milliseconds, so a huge line doesn't hold up typing. */\nconst TIME_LIMIT = 50\n/**\n * Lines up to this long are read to the end even past the time limit. The\n * first lines a grammar reads also build its patterns, which on a busy\n * machine can take longer than the limit; stopping there would cut a block\n * comment or string in two and color the lines after it wrongly.\n */\nconst ALWAYS_WHOLE = 2000\n\ntype ShikiGrammar = ReturnType<ShikiHighlighterLike['getLanguage']>\n/** Reads a line within the time limit, and to its end when it is not too long. */\nfunction readLine(grammar: ShikiGrammar, text: string, stack: ShikiStateStack | null) {\n const result = grammar.tokenizeLine(text, stack, TIME_LIMIT)\n return result.stoppedEarly && text.length <= ALWAYS_WHOLE\n ? grammar.tokenizeLine(text, stack, 0)\n : result\n}\n\n/**\n * Turns a language loaded into a Shiki highlighter into one the editor\n * reads. Shiki's grammar does the reading; its scopes are drawn with the\n * editor's own syntax colors, so the theme and dark mode apply as they do\n * to the built-in languages.\n *\n * ```ts\n * const highlighter = await createHighlighter({ langs: ['rust'], themes: [] })\n * const rust = shikiLanguage(highlighter, 'rust', { comment: { line: '//' } })\n * ```\n */\nexport function shikiLanguage(\n highlighter: ShikiHighlighterLike,\n language: string,\n options: ShikiLanguageOptions = {},\n): CodeLanguage<ShikiState> {\n const grammar = highlighter.getLanguage(language)\n const typeOf = options.tokenType\n ? (scopes: readonly string[]) => {\n const own = options.tokenType!(scopes)\n return own === undefined ? tokenTypeOfScopes(scopes) : own\n }\n : tokenTypeOfScopes\n return defineCodeLanguage<ShikiState>({\n name: options.name ?? language,\n aliases: options.aliases,\n startState: () => ({ stack: null, line: null }),\n // the stack never changes once made: copies share it\n copyState: (state) => ({ stack: state.stack, line: state.line }),\n sameState: (a, b) => a.stack === b.stack || (!!a.stack && !!b.stack && a.stack.equals(b.stack)),\n token(stream, state) {\n let line = state.line\n if (!line || line.text !== stream.string || stream.pos < line.base) {\n // a new line: read it whole, and keep the state after it\n const text = stream.string.slice(stream.pos, stream.end)\n const result = readLine(grammar, text, state.stack)\n const ends: number[] = []\n const types: Array<CodeTokenType | null> = []\n for (const token of result.tokens) {\n ends.push(stream.pos + Math.min(token.endIndex, text.length))\n types.push(typeOf(token.scopes))\n }\n line = { text: stream.string, base: stream.pos, ends, types }\n state.stack = result.ruleStack\n state.line = line\n }\n for (let i = 0; i < line.ends.length; i++)\n if (line.ends[i]! > stream.pos) {\n stream.pos = Math.min(line.ends[i]!, stream.end)\n // the line is read: the next one is read afresh, even with the same text\n if (stream.pos >= stream.end) state.line = null\n return line.types[i]!\n }\n stream.skipToEnd()\n state.line = null\n return null\n },\n blankLine(state) {\n state.stack = readLine(grammar, '', state.stack).ruleStack\n state.line = null\n },\n comment: options.comment,\n brackets: options.brackets,\n autoClose: options.autoClose,\n indentAfter: options.indentAfter,\n })\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/shiki/index.ts"],"sourcesContent":["import {\n type CodeLanguage,\n type CodeTokenType,\n type RemoteCodeLanguageOptions,\n defineCodeLanguage,\n remoteCodeLanguage,\n} from '../language/language'\n\nexport { remoteCodeLanguage }\nexport type { RemoteCodeLanguageOptions }\n\n/** The part of a TextMate rule stack the editor uses: Shiki's `StateStack`. */\nexport interface ShikiStateStack {\n equals(other: ShikiStateStack): boolean\n}\n\n/** What the editor needs of a Shiki highlighter (`createHighlighter()` from `shiki`). */\nexport interface ShikiHighlighterLike {\n getLanguage(name: string): {\n tokenizeLine(\n line: string,\n state: ShikiStateStack | null,\n timeLimit?: number,\n ): {\n tokens: Array<{ startIndex: number; endIndex: number; scopes: string[] }>\n ruleStack: ShikiStateStack\n /** The time limit ran out before the end of the line. */\n stoppedEarly?: boolean\n }\n }\n getLoadedLanguages?: () => string[]\n loadLanguage?: (lang: never) => Promise<void>\n}\n\nexport interface ShikiLanguageOptions {\n /** The name the editor and code blocks know it by; defaults to the Shiki language's. */\n name?: string\n aliases?: string[]\n /** How the language writes comments, for toggling them; Shiki doesn't say. */\n comment?: { line?: string; block?: [open: string, close: string] }\n brackets?: string\n autoClose?: string\n indentAfter?: RegExp\n /**\n * The token kind (syntax color) for a token's scopes, outermost first;\n * return `undefined` to use the built-in mapping (`tokenTypeOfScopes`).\n */\n tokenType?: (scopes: readonly string[]) => CodeTokenType | null | undefined\n}\n\nexport interface ShikiState {\n /** The grammar's state at the start of the line being read, or after the last line. */\n stack: ShikiStateStack | null\n /** The tokens of the line being read; positions from `base`. */\n line: { text: string; base: number; ends: number[]; types: Array<CodeTokenType | null> } | null\n}\n\n/** Scope prefixes and the kind each is drawn as; the first that matches a token's scopes, from the innermost scope out, wins. */\nconst SCOPES: Array<[prefix: string, type: CodeTokenType]> = [\n ['comment', 'comment'],\n ['punctuation.definition.comment', 'comment'],\n ['string.regexp', 'string'],\n ['constant.character.escape', 'string'],\n ['punctuation.definition.string', 'string'],\n ['string', 'string'],\n ['constant.numeric', 'number'],\n ['constant.language', 'keyword'],\n ['constant.other.color', 'number'],\n ['keyword.operator', 'operator'],\n ['storage.type.function.arrow', 'operator'],\n ['keyword', 'keyword'],\n ['storage', 'keyword'],\n ['entity.name.function', 'function'],\n ['support.function', 'function'],\n ['meta.function-call', 'function'],\n ['entity.name.tag', 'tag'],\n ['entity.other.attribute-name', 'attribute'],\n ['entity.name.type', 'type'],\n ['entity.name.class', 'type'],\n ['entity.other.inherited-class', 'type'],\n ['support.type.property-name', 'property'],\n ['support.type', 'type'],\n ['support.class', 'type'],\n ['variable.other.property', 'property'],\n ['variable.other.object.property', 'property'],\n ['support.variable.property', 'property'],\n ['meta.object-literal.key', 'property'],\n ['variable.language', 'keyword'],\n ['variable', 'variable'],\n ['entity.name', 'variable'],\n ['markup.heading', 'heading'],\n ['markup.bold', 'strong'],\n ['markup.italic', 'emphasis'],\n ['markup.underline.link', 'link'],\n ['markup.inline.raw', 'string'],\n ['meta.preprocessor', 'meta'],\n ['meta.decorator', 'meta'],\n ['meta.annotation', 'meta'],\n ['invalid', 'invalid'],\n ['punctuation', 'punctuation'],\n]\n\nconst matches = (scope: string, prefix: string) =>\n scope === prefix || (scope.startsWith(prefix) && scope[prefix.length] === '.')\n\n/** The kind a token with these scopes (outermost first, as Shiki gives them) is drawn as. */\nexport function tokenTypeOfScopes(scopes: readonly string[]): CodeTokenType | null {\n for (let i = scopes.length - 1; i > 0; i--) {\n const scope = scopes[i]!\n for (const [prefix, type] of SCOPES) if (matches(scope, prefix)) return type\n }\n return null\n}\n\n/** How long one line may take to read, in milliseconds, so a huge line doesn't hold up typing. */\nconst TIME_LIMIT = 50\n/**\n * Lines up to this long are read to the end even past the time limit. The\n * first lines a grammar reads also build its patterns, which on a busy\n * machine can take longer than the limit; stopping there would cut a block\n * comment or string in two and color the lines after it wrongly.\n */\nconst ALWAYS_WHOLE = 2000\n\ntype ShikiGrammar = ReturnType<ShikiHighlighterLike['getLanguage']>\n/** Reads a line within the time limit, and to its end when it is not too long. */\nfunction readLine(grammar: ShikiGrammar, text: string, stack: ShikiStateStack | null) {\n const result = grammar.tokenizeLine(text, stack, TIME_LIMIT)\n return result.stoppedEarly && text.length <= ALWAYS_WHOLE\n ? grammar.tokenizeLine(text, stack, 0)\n : result\n}\n\n/**\n * Turns a language loaded into a Shiki highlighter into one the editor\n * reads. Shiki's grammar does the reading; its scopes are drawn with the\n * editor's own syntax colors, so the theme and dark mode apply as they do\n * to the built-in languages.\n *\n * ```ts\n * const highlighter = await createHighlighter({ langs: ['rust'], themes: [] })\n * const rust = shikiLanguage(highlighter, 'rust', { comment: { line: '//' } })\n * ```\n */\nexport function shikiLanguage(\n highlighter: ShikiHighlighterLike,\n language: string,\n options: ShikiLanguageOptions = {},\n): CodeLanguage<ShikiState> {\n const grammar = highlighter.getLanguage(language)\n const typeOf = options.tokenType\n ? (scopes: readonly string[]) => {\n const own = options.tokenType!(scopes)\n return own === undefined ? tokenTypeOfScopes(scopes) : own\n }\n : tokenTypeOfScopes\n return defineCodeLanguage<ShikiState>({\n name: options.name ?? language,\n aliases: options.aliases,\n startState: () => ({ stack: null, line: null }),\n // the stack never changes once made: copies share it\n copyState: (state) => ({ stack: state.stack, line: state.line }),\n sameState: (a, b) => a.stack === b.stack || (!!a.stack && !!b.stack && a.stack.equals(b.stack)),\n token(stream, state) {\n let line = state.line\n if (!line || line.text !== stream.string || stream.pos < line.base) {\n // a new line: read it whole, and keep the state after it\n const text = stream.string.slice(stream.pos, stream.end)\n const result = readLine(grammar, text, state.stack)\n const ends: number[] = []\n const types: Array<CodeTokenType | null> = []\n for (const token of result.tokens) {\n ends.push(stream.pos + Math.min(token.endIndex, text.length))\n types.push(typeOf(token.scopes))\n }\n line = { text: stream.string, base: stream.pos, ends, types }\n state.stack = result.ruleStack\n state.line = line\n }\n for (let i = 0; i < line.ends.length; i++)\n if (line.ends[i]! > stream.pos) {\n stream.pos = Math.min(line.ends[i]!, stream.end)\n // the line is read: the next one is read afresh, even with the same text\n if (stream.pos >= stream.end) state.line = null\n return line.types[i]!\n }\n stream.skipToEnd()\n state.line = null\n return null\n },\n blankLine(state) {\n state.stack = readLine(grammar, '', state.stack).ruleStack\n state.line = null\n },\n comment: options.comment,\n brackets: options.brackets,\n autoClose: options.autoClose,\n indentAfter: options.indentAfter,\n // Shiki's StateStack cannot cross postMessage: in a worker, return flat line tokens directly.\n workerMode: 'tokens',\n })\n}\n\nexport interface ShikiResolverOptions {\n /** Lazily returns (or creates) a Shiki highlighter instance inside the worker. */\n highlighter: () => ShikiHighlighterLike | Promise<ShikiHighlighterLike>\n /**\n * Loads a language grammar into the highlighter on demand. When omitted, calls\n * `highlighter.loadLanguage(name)` if available and the language is not yet loaded.\n */\n loadLanguage?: (highlighter: ShikiHighlighterLike, name: string) => Promise<void> | void\n /** Optional `ShikiLanguageOptions` applied to resolved languages. */\n options?: ShikiLanguageOptions | ((name: string) => ShikiLanguageOptions | undefined)\n}\n\n/**\n * Creates a `resolve` callback for `serveCodeHighlighting` that lazy-loads\n * Shiki grammars inside the worker and wraps them with `shikiLanguage`.\n *\n * ```ts\n * // shiki.worker.ts\n * import { createHighlighter } from 'shiki'\n * import { createShikiLanguageResolver } from '@dou-ui/code/shiki'\n * import { serveCodeHighlighting, typescript } from '@dou-ui/code/worker'\n *\n * let highlighter: ReturnType<typeof createHighlighter> | undefined\n * serveCodeHighlighting({\n * languages: [typescript],\n * resolve: createShikiLanguageResolver(\n * () => (highlighter ??= createHighlighter({ langs: [], themes: [] })),\n * ),\n * })\n * ```\n */\nexport function createShikiLanguageResolver(\n highlighterOrOptions: ShikiResolverOptions['highlighter'] | ShikiResolverOptions,\n): (name: string) => Promise<CodeLanguage<ShikiState> | null> {\n const opts: ShikiResolverOptions =\n typeof highlighterOrOptions === 'function'\n ? { highlighter: highlighterOrOptions }\n : highlighterOrOptions\n let shared: Promise<ShikiHighlighterLike> | null = null\n const getHighlighter = () => {\n if (!shared) {\n const pending = Promise.resolve()\n .then(() => opts.highlighter())\n .catch((error) => {\n if (shared === pending) shared = null\n throw error\n })\n shared = pending\n }\n return shared\n }\n\n return async (name: string): Promise<CodeLanguage<ShikiState> | null> => {\n try {\n const hl = await getHighlighter()\n const loaded = hl.getLoadedLanguages?.()\n if (!loaded || !loaded.includes(name)) {\n if (opts.loadLanguage) {\n await opts.loadLanguage(hl, name)\n } else if (hl.loadLanguage) {\n await hl.loadLanguage(name as never)\n }\n }\n const langOptions = typeof opts.options === 'function' ? opts.options(name) : opts.options\n return shikiLanguage(hl, name, { ...langOptions, name: langOptions?.name ?? name })\n } catch {\n return null\n }\n }\n}\n"],"mappings":"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"}
|
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-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__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: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__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-gutter-padding-left:16px;--dou-code-editor-gutter-padding-right:12px;--dou-code-editor-gutter-overlay-offset:-4px;--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:not(.is-scroll-y)>.dou-code-editor__body>.dou-code-editor__scroller{overflow-x:auto;overflow-y:hidden}.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 var(--dou-code-editor-gutter-padding-right)0 calc(var(--dou-code-editor-gutter-padding-left) + 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__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number{padding-right:calc(var(--dou-code-editor-gutter-padding-right) + 12px)}.dou-code-editor:not(.is-line-numbers)>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number{padding:0}.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;top:0;bottom:0;left:0}.dou-code-editor__cell{display:inline-grid;grid-template-rows:var(--dou-code-editor-line-height);grid-auto-flow:column;position:relative;font-size:var(--dou-font-size-sm);flex:none;place-content: start 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:none}.dou-code-editor__cell[role=button]:focus-visible:after{position:absolute;box-sizing:border-box;height:var(--dou-code-editor-line-height);border:2px solid var(--dou-color-focus);border-radius:var(--dou-radius-control);content:"";pointer-events:none;top:0;left:0;right:0}.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__overlays{position:absolute;top:0;right:var(--dou-code-editor-gutter-overlay-offset,-4px);z-index:1;display:flex;height:var(--dou-code-editor-line-height);pointer-events:none;align-items: center;gap:2px}.dou-code-editor.is-gutter-empty>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number>.dou-code-editor__overlays{left:2px;right:auto}.dou-code-editor__cell.is-overlay{display:inline-flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-code-editor-bg);box-shadow:var(--dou-shadow-sm);color:var(--dou-color-text-secondary);pointer-events:auto;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing),background-color var(--dou-motion-duration-fast)var(--dou-motion-easing),border-color var(--dou-motion-duration-fast)var(--dou-motion-easing),color var(--dou-motion-duration-fast)var(--dou-motion-easing);height:18px;font-size:12px;line-height:1}.dou-code-editor__cell.is-overlay>svg{width:12px;height:12px}@media (hover:hover){.dou-code-editor__cell.is-overlay:hover{border-color:var(--dou-color-border-strong);background-color:var(--dou-color-bg-muted);color:var(--dou-color-text)}}.dou-code-editor__cell.is-overlay[role=button]:focus-visible:after{height:auto;inset:-1px}@media (pointer:coarse){.dou-code-editor__cell.is-overlay:before{position:absolute;content:"";inset:-6px}}.dou-code-editor__cell.is-overlay.is-on-hover{opacity:0;pointer-events:none}.dou-code-editor:not(.is-disabled)>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number:-webkit-any(:hover,.is-hovered)>.dou-code-editor__overlays>.dou-code-editor__cell.is-overlay.is-on-hover{opacity:1;pointer-events:auto}.dou-code-editor:not(.is-disabled)>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number:-moz-any(:hover,.is-hovered)>.dou-code-editor__overlays>.dou-code-editor__cell.is-overlay.is-on-hover{opacity:1;pointer-events:auto}.dou-code-editor:not(.is-disabled)>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number:is(:hover,.is-hovered)>.dou-code-editor__overlays>.dou-code-editor__cell.is-overlay.is-on-hover{opacity:1;pointer-events:auto}.dou-code-editor.is-focused>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number.is-active>.dou-code-editor__overlays>.dou-code-editor__cell.is-overlay.is-on-hover{opacity:1;pointer-events:auto}.dou-code-editor__cell.is-overlay.is-on-hover:focus-visible{opacity:1;pointer-events:auto}.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;overflow-x:clip;pointer-events:none;inset:0}.dou-code-editor__widget-slot{position:absolute;top:0;right:0;left:var(--dou-code-editor-gutter,0px);pointer-events:none}.dou-code-editor__widget-slot.is-full-width{left:0}.dou-code-editor__widget{position:sticky;left:var(--dou-code-editor-gutter,0px);box-sizing:border-box;width:var(--dou-code-editor-widget-width,100%);pointer-events:auto;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;max-width:100%;line-height:20px}.dou-code-editor__widget.is-full-width{width:var(--dou-code-editor-view-width,100%);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);--dou-code-diff-toolbar-bg:var(--dou-color-bg-surface);--dou-code-diff-toolbar-top:0px;position:relative;display:flex;box-sizing:border-box;overflow:clip;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);background-color:var(--dou-code-diff-toolbar-bg);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__toolbar.is-sticky{position:sticky;top:var(--dou-code-diff-toolbar-top);z-index:4}.dou-code-diff__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;margin-inline-end:8px}.dou-code-diff__stats{display:flex;overflow:hidden;white-space:nowrap;flex:auto;align-items: center;gap:8px;min-width:0}.dou-code-diff__title+.dou-code-diff__stats{flex:none;margin-inline-end:4px}.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}.dou-code-diff__toolbar .dou-button{flex:none}@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);isolation:isolate;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--split>.dou-code-diff__body>.dou-code-diff__side>.dou-code-editor{--dou-code-editor-gutter-padding-left:6px;--dou-code-editor-gutter-padding-right:8px;--dou-code-editor-padding-x:8px}.dou-code-diff--split>.dou-code-diff__body>.dou-code-diff__side>.dou-code-editor>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number{font-size:12px}.dou-code-diff--split>.dou-code-diff__body>.dou-code-diff__side>.dou-code-editor>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number>.dou-code-editor__overlays{right:auto;left:calc(var(--dou-code-editor-gutter-cells,16px) - 15px)}.dou-code-diff--inline>.dou-code-diff__body>.dou-code-editor{--dou-code-editor-padding-x:6px;--dou-code-editor-gutter-overlay-offset:-2px}.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:after{position:absolute;z-index:-1;top:0;bottom:0;left:calc(100% - var(--dou-code-editor-gutter-cells));width:var(--dou-code-editor-gutter);content:"";pointer-events:none}.dou-code-editor__cell.dou-code-diff__sign.is-removed{color:var(--dou-color-danger-text)}.dou-code-editor__cell.dou-code-diff__sign.is-removed:after{background-color:var(--dou-code-diff-removed)}.dou-code-editor__cell.dou-code-diff__sign.is-added{color:var(--dou-color-success-text)}.dou-code-editor__cell.dou-code-diff__sign.is-added:after{background-color:var(--dou-code-diff-added)}.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-variant-numeric:tabular-nums;justify-content:flex-end;padding:0 6px;font-size:12px}.dou-code-editor__cell.dou-code-diff__number.is-modified{padding-left:2px}.dou-code-diff.is-compact>.dou-code-diff__body>.dou-code-editor>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number>.dou-code-editor__cells>.dou-code-editor__cell.dou-code-diff__number{padding:0 4px;font-size:11px}.dou-code-diff.is-compact>.dou-code-diff__body>.dou-code-editor>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number>.dou-code-editor__cells>.dou-code-editor__cell.dou-code-diff__number.is-modified{padding-left:2px}.dou-code-diff.is-compact>.dou-code-diff__body>.dou-code-editor>.dou-code-editor__body>.dou-code-editor__scroller>.dou-code-editor__sizer>.dou-code-editor__gutter>.dou-code-editor__numbers>.dou-code-editor__number>.dou-code-editor__cells>.dou-code-editor__cell.dou-code-diff__sign{font-size:12px}.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-color:var(--dou-code-editor-bg);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%,var(--dou-code-editor-bg));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%,var(--dou-code-editor-bg));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,46 +1,43 @@
|
|
|
1
|
-
import { type CodeDiffHunk } from './core/diff';
|
|
2
1
|
import { type CodeExtension } from './extension';
|
|
3
|
-
import type { CodeDiffProps,
|
|
4
|
-
|
|
5
|
-
declare
|
|
6
|
-
declare const __VLS_export: import("vue").DefineComponent<CodeDiffProps, {
|
|
7
|
-
/** The changes found now. */
|
|
8
|
-
readonly hunks: CodeDiffHunk[];
|
|
9
|
-
/** Moves to the next change; `false` when there is none. */
|
|
10
|
-
next: typeof next;
|
|
11
|
-
/** Moves to the previous change. */
|
|
12
|
-
previous: typeof previous;
|
|
13
|
-
/** Shows every unchanged line. */
|
|
14
|
-
expandAll: () => boolean;
|
|
15
|
-
/** Hides the runs of unchanged lines again. */
|
|
16
|
-
collapseAll: () => void;
|
|
17
|
-
/** The editors drawn now: both sides, or the inline one as `modified`. */
|
|
18
|
-
readonly original: CodeEditorExpose | undefined;
|
|
19
|
-
readonly modified: CodeEditorExpose | undefined;
|
|
20
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
2
|
+
import type { CodeDiffExpose, CodeDiffGutter, CodeDiffProps, CodeDiffSlots, CodeDiffWidget } from './types';
|
|
3
|
+
type __VLS_Slots = CodeDiffSlots;
|
|
4
|
+
declare const __VLS_base: import("vue").DefineComponent<CodeDiffProps, CodeDiffExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
5
|
"update:modelValue": (value: string) => any;
|
|
22
6
|
"update:mode": (mode: "split" | "inline") => any;
|
|
23
7
|
}, string, import("vue").PublicProps, Readonly<CodeDiffProps> & Readonly<{
|
|
24
8
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
25
9
|
"onUpdate:mode"?: ((mode: "split" | "inline") => any) | undefined;
|
|
26
10
|
}>, {
|
|
11
|
+
scrollY: boolean;
|
|
27
12
|
toolbar: boolean;
|
|
28
13
|
language: import("./index.js").CodeLanguage<any> | null;
|
|
29
14
|
tabSize: number;
|
|
15
|
+
mode: "auto" | "split" | "inline";
|
|
16
|
+
original: string;
|
|
30
17
|
messages: Partial<import("./locale").CodeMessages>;
|
|
31
|
-
mode: "split" | "inline" | "auto";
|
|
32
18
|
modelValue: string;
|
|
33
19
|
bordered: boolean;
|
|
20
|
+
worker: import("./index.js").CodeWorkerOption;
|
|
21
|
+
syncHighlightLines: number;
|
|
34
22
|
wrap: boolean;
|
|
35
23
|
extensions: CodeExtension[];
|
|
36
24
|
editable: boolean;
|
|
37
|
-
|
|
25
|
+
widgets: CodeDiffWidget[];
|
|
26
|
+
syncDiffLines: number;
|
|
38
27
|
collapseUnchanged: boolean | {
|
|
39
28
|
context?: number;
|
|
40
29
|
minLines?: number;
|
|
41
30
|
};
|
|
42
31
|
ignoreWhitespace: boolean;
|
|
43
32
|
words: boolean;
|
|
33
|
+
gutters: CodeDiffGutter[];
|
|
34
|
+
stickyToolbar: boolean;
|
|
44
35
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
45
37
|
declare const _default: typeof __VLS_export;
|
|
46
38
|
export default _default;
|
|
39
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
40
|
+
new (): {
|
|
41
|
+
$slots: S;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -22,15 +22,17 @@ declare const __VLS_export: import("vue").DefineComponent<CodeEditorProps, CodeE
|
|
|
22
22
|
keys: boolean | readonly (string | import("./types").CodeKey)[];
|
|
23
23
|
selection: CodeSelection;
|
|
24
24
|
doc: CodeText;
|
|
25
|
+
scrollY: boolean;
|
|
25
26
|
language: import(".").CodeLanguage<any> | null;
|
|
26
27
|
tabSize: number;
|
|
27
|
-
worker: boolean | (() => Worker);
|
|
28
28
|
messages: Partial<import("./locale").CodeMessages>;
|
|
29
29
|
modelValue: string;
|
|
30
30
|
lineNumbers: boolean;
|
|
31
31
|
gutter: boolean;
|
|
32
32
|
bordered: boolean;
|
|
33
33
|
activeLine: boolean;
|
|
34
|
+
worker: import(".").CodeWorkerOption;
|
|
35
|
+
syncHighlightLines: number;
|
|
34
36
|
closeBrackets: boolean;
|
|
35
37
|
matchBrackets: boolean;
|
|
36
38
|
searchable: boolean;
|
|
@@ -89,6 +89,11 @@ export interface CodeWidget {
|
|
|
89
89
|
height?: number;
|
|
90
90
|
/** What it is, read out when the cursor moves onto its line, e.g. "戴兜的评论". */
|
|
91
91
|
label?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Draws across the gutter too, taking the full width of the editor's view.
|
|
94
|
+
* Off by default, so widgets start beside the gutter, aligned with the text.
|
|
95
|
+
*/
|
|
96
|
+
fullWidth?: boolean;
|
|
92
97
|
}
|
|
93
98
|
/** Something drawn in a column beside the line numbers, on line `line` (from 1). */
|
|
94
99
|
export interface CodeGutterMarker {
|
|
@@ -98,18 +103,60 @@ export interface CodeGutterMarker {
|
|
|
98
103
|
/** Short text, when there is no icon. */
|
|
99
104
|
text?: string;
|
|
100
105
|
class?: string;
|
|
101
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Shown on hover. Required when the column has `onPress`: the marker is
|
|
108
|
+
* then a button, and this is its name.
|
|
109
|
+
*/
|
|
102
110
|
title?: string;
|
|
111
|
+
/**
|
|
112
|
+
* When the marker shows: `always`, or `hover`, out of sight until its
|
|
113
|
+
* line is hovered, holds the cursor, or the marker has the focus, e.g. a
|
|
114
|
+
* "comment" mark offered on every line. Defaults to `always`.
|
|
115
|
+
*/
|
|
116
|
+
visible?: 'always' | 'hover';
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The marker a column shows on every line without one of its own, out of
|
|
120
|
+
* sight until the line is hovered (as `visible: 'hover'`), e.g. "add a
|
|
121
|
+
* breakpoint" offered on every line.
|
|
122
|
+
*/
|
|
123
|
+
export interface CodeGutterHoverMarker extends Pick<CodeGutterMarker, 'icon' | 'text' | 'class'> {
|
|
124
|
+
/**
|
|
125
|
+
* Its name, as a marker's `title`; a function names the marker of each
|
|
126
|
+
* line, e.g. "Add a breakpoint on line 3". It is called for every line in
|
|
127
|
+
* view, often: keep it quick.
|
|
128
|
+
*/
|
|
129
|
+
title?: string | ((line: number) => string);
|
|
103
130
|
}
|
|
104
131
|
/** A column of the gutter, left of the line numbers. */
|
|
105
132
|
export interface CodeGutter {
|
|
106
133
|
name: string;
|
|
107
|
-
/** In px. Defaults to 16. */
|
|
134
|
+
/** In px. Defaults to 16 (or 18 when `overlay` is set). */
|
|
108
135
|
width?: number;
|
|
136
|
+
/**
|
|
137
|
+
* Draws markers floating over the gutter's right edge without reserving a
|
|
138
|
+
* dedicated column width (0px layout footprint). Best paired with
|
|
139
|
+
* `hoverMarker` or `visible: 'hover'` for row actions such as adding review
|
|
140
|
+
* comments. Empty rows take no pointer events.
|
|
141
|
+
*/
|
|
142
|
+
overlay?: boolean;
|
|
109
143
|
/** The markers on the lines in view; reactive state read here updates them. */
|
|
110
|
-
markers
|
|
111
|
-
/** A
|
|
112
|
-
|
|
144
|
+
markers?: (context: CodeExtensionContext) => CodeGutterMarker[];
|
|
145
|
+
/** A marker on every other line, shown on hover. */
|
|
146
|
+
hoverMarker?: CodeGutterHoverMarker;
|
|
147
|
+
/**
|
|
148
|
+
* Where `onPress` answers: `any` cell of the column (the default), e.g. to
|
|
149
|
+
* set a breakpoint on an empty line, or only its `markers`.
|
|
150
|
+
*/
|
|
151
|
+
pressOn?: 'any' | 'markers';
|
|
152
|
+
/**
|
|
153
|
+
* A press on the column, on line `line`, e.g. to set a breakpoint. A
|
|
154
|
+
* marker in such a column is a button: the one on the cursor's line is
|
|
155
|
+
* reached with Escape then Shift+Tab, and Enter or Space presses it. A
|
|
156
|
+
* finger or pen presses when it lifts in place; a tap on a marker still
|
|
157
|
+
* out of sight first moves the cursor to its line, which shows it.
|
|
158
|
+
*/
|
|
159
|
+
onPress?: (line: number, event: PointerEvent | KeyboardEvent, context: CodeExtensionContext) => void;
|
|
113
160
|
}
|
|
114
161
|
/** An undo history that takes the place of the editor's own, e.g. one shared with others. */
|
|
115
162
|
export interface CodeHistoryHandler {
|
|
@@ -317,5 +364,10 @@ export interface CodeExtensionContext extends CodeEditorExpose {
|
|
|
317
364
|
/** Types an extension; returns it as it is. */
|
|
318
365
|
export declare function defineCodeExtension(extension: CodeExtension): CodeExtension;
|
|
319
366
|
export declare const CODE_EDITOR_KEY: InjectionKey<CodeExtensionContext>;
|
|
367
|
+
/**
|
|
368
|
+
* Internal: told each widget height an editor measures, by `extension/id`;
|
|
369
|
+
* DouCodeDiff leaves a blank of the same height across from it.
|
|
370
|
+
*/
|
|
371
|
+
export declare const WIDGET_HEIGHT_KEY: InjectionKey<((key: string, height: number) => void) | null>;
|
|
320
372
|
/** The editor a panel or gutter component is drawn in. */
|
|
321
373
|
export declare function useCodeEditor(): CodeExtensionContext;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,15 +18,17 @@ export declare const DouCodeEditor: import("dou-ui").WithInstall<import("vue").D
|
|
|
18
18
|
keys: boolean | readonly (string | import("./types").CodeKey)[];
|
|
19
19
|
selection: import("./index.js").CodeSelection;
|
|
20
20
|
doc: import("./index.js").CodeText;
|
|
21
|
+
scrollY: boolean;
|
|
21
22
|
language: import("./index.js").CodeLanguage<any> | null;
|
|
22
23
|
tabSize: number;
|
|
23
|
-
worker: boolean | (() => Worker);
|
|
24
24
|
messages: Partial<import("./locale").CodeMessages>;
|
|
25
25
|
modelValue: string;
|
|
26
26
|
lineNumbers: boolean;
|
|
27
27
|
gutter: boolean;
|
|
28
28
|
bordered: boolean;
|
|
29
29
|
activeLine: boolean;
|
|
30
|
+
worker: import("./index.js").CodeWorkerOption;
|
|
31
|
+
syncHighlightLines: number;
|
|
30
32
|
closeBrackets: boolean;
|
|
31
33
|
matchBrackets: boolean;
|
|
32
34
|
searchable: boolean;
|
|
@@ -69,46 +71,118 @@ export declare const DouCodeInput: import("dou-ui").WithInstall<import("vue").De
|
|
|
69
71
|
maxRows?: number;
|
|
70
72
|
};
|
|
71
73
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, import("vue").HTMLAttributes>;
|
|
72
|
-
export declare const DouCodeDiff: import("dou-ui").WithInstall<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
export declare const DouCodeDiff: import("dou-ui").WithInstall<{
|
|
75
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./types").CodeDiffProps> & Readonly<{
|
|
76
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
77
|
+
"onUpdate:mode"?: ((mode: "split" | "inline") => any) | undefined;
|
|
78
|
+
}>, import("./types").CodeDiffExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
79
|
+
"update:modelValue": (value: string) => any;
|
|
80
|
+
"update:mode": (mode: "split" | "inline") => any;
|
|
81
|
+
}, import("vue").PublicProps, {
|
|
82
|
+
scrollY: boolean;
|
|
83
|
+
toolbar: boolean;
|
|
84
|
+
language: import("./index.js").CodeLanguage<any> | null;
|
|
85
|
+
tabSize: number;
|
|
86
|
+
mode: "auto" | "split" | "inline";
|
|
87
|
+
original: string;
|
|
88
|
+
messages: Partial<import("./locale").CodeMessages>;
|
|
89
|
+
modelValue: string;
|
|
90
|
+
bordered: boolean;
|
|
91
|
+
worker: import("./index.js").CodeWorkerOption;
|
|
92
|
+
syncHighlightLines: number;
|
|
93
|
+
wrap: boolean;
|
|
94
|
+
extensions: import("./extension").CodeExtension[];
|
|
95
|
+
editable: boolean;
|
|
96
|
+
widgets: import("./types").CodeDiffWidget[];
|
|
97
|
+
syncDiffLines: number;
|
|
98
|
+
collapseUnchanged: boolean | {
|
|
99
|
+
context?: number;
|
|
100
|
+
minLines?: number;
|
|
101
|
+
};
|
|
102
|
+
ignoreWhitespace: boolean;
|
|
103
|
+
words: boolean;
|
|
104
|
+
gutters: import("./types").CodeDiffGutter[];
|
|
105
|
+
stickyToolbar: boolean;
|
|
106
|
+
}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
107
|
+
P: {};
|
|
108
|
+
B: {};
|
|
109
|
+
D: {};
|
|
110
|
+
C: {};
|
|
111
|
+
M: {};
|
|
112
|
+
Defaults: {};
|
|
113
|
+
}, Readonly<import("./types").CodeDiffProps> & Readonly<{
|
|
114
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
115
|
+
"onUpdate:mode"?: ((mode: "split" | "inline") => any) | undefined;
|
|
116
|
+
}>, import("./types").CodeDiffExpose, {}, {}, {}, {
|
|
117
|
+
scrollY: boolean;
|
|
118
|
+
toolbar: boolean;
|
|
119
|
+
language: import("./index.js").CodeLanguage<any> | null;
|
|
120
|
+
tabSize: number;
|
|
121
|
+
mode: "auto" | "split" | "inline";
|
|
122
|
+
original: string;
|
|
123
|
+
messages: Partial<import("./locale").CodeMessages>;
|
|
124
|
+
modelValue: string;
|
|
125
|
+
bordered: boolean;
|
|
126
|
+
worker: import("./index.js").CodeWorkerOption;
|
|
127
|
+
syncHighlightLines: number;
|
|
128
|
+
wrap: boolean;
|
|
129
|
+
extensions: import("./extension").CodeExtension[];
|
|
130
|
+
editable: boolean;
|
|
131
|
+
widgets: import("./types").CodeDiffWidget[];
|
|
132
|
+
syncDiffLines: number;
|
|
133
|
+
collapseUnchanged: boolean | {
|
|
134
|
+
context?: number;
|
|
135
|
+
minLines?: number;
|
|
136
|
+
};
|
|
137
|
+
ignoreWhitespace: boolean;
|
|
138
|
+
words: boolean;
|
|
139
|
+
gutters: import("./types").CodeDiffGutter[];
|
|
140
|
+
stickyToolbar: boolean;
|
|
141
|
+
}>;
|
|
142
|
+
__isFragment?: never;
|
|
143
|
+
__isTeleport?: never;
|
|
144
|
+
__isSuspense?: never;
|
|
145
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("./types").CodeDiffProps> & Readonly<{
|
|
84
146
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
85
147
|
"onUpdate:mode"?: ((mode: "split" | "inline") => any) | undefined;
|
|
86
|
-
}>, {
|
|
148
|
+
}>, import("./types").CodeDiffExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
149
|
+
"update:modelValue": (value: string) => any;
|
|
150
|
+
"update:mode": (mode: "split" | "inline") => any;
|
|
151
|
+
}, string, {
|
|
152
|
+
scrollY: boolean;
|
|
87
153
|
toolbar: boolean;
|
|
88
154
|
language: import("./index.js").CodeLanguage<any> | null;
|
|
89
155
|
tabSize: number;
|
|
156
|
+
mode: "auto" | "split" | "inline";
|
|
157
|
+
original: string;
|
|
90
158
|
messages: Partial<import("./locale").CodeMessages>;
|
|
91
|
-
mode: "split" | "inline" | "auto";
|
|
92
159
|
modelValue: string;
|
|
93
160
|
bordered: boolean;
|
|
161
|
+
worker: import("./index.js").CodeWorkerOption;
|
|
162
|
+
syncHighlightLines: number;
|
|
94
163
|
wrap: boolean;
|
|
95
164
|
extensions: import("./extension").CodeExtension[];
|
|
96
165
|
editable: boolean;
|
|
97
|
-
|
|
166
|
+
widgets: import("./types").CodeDiffWidget[];
|
|
167
|
+
syncDiffLines: number;
|
|
98
168
|
collapseUnchanged: boolean | {
|
|
99
169
|
context?: number;
|
|
100
170
|
minLines?: number;
|
|
101
171
|
};
|
|
102
172
|
ignoreWhitespace: boolean;
|
|
103
173
|
words: boolean;
|
|
104
|
-
|
|
174
|
+
gutters: import("./types").CodeDiffGutter[];
|
|
175
|
+
stickyToolbar: boolean;
|
|
176
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
177
|
+
$slots: import("./types").CodeDiffSlots;
|
|
178
|
+
}), import("vue").HTMLAttributes>;
|
|
105
179
|
export { diffText } from './core/diff';
|
|
106
180
|
export type { CodeDiffHunk, CodeDiffOptions, CodeDiffPart } from './core/diff';
|
|
107
181
|
export { defaultCodeKeys } from './code-keys';
|
|
108
182
|
export { defineCodeExtension, useCodeEditor } from './extension';
|
|
109
|
-
export type { CodeDecoration, CodeDiagnostic, CodeDiagnosticAction, CodeDiagnosticSeverity, CodeExtension, CodeExtensionContext, CodeGutter, CodeGutterMarker, CodeHistoryHandler, CodeCompletion, CodeCompletionKind, CodeCompletionRequest, CodePositionRequest, CodeCompletionResult, CodeHoverResult, CodeMenuItem, CodePanel, CodeSignatureResult, CodeWidget, } from './extension';
|
|
183
|
+
export type { CodeDecoration, CodeDiagnostic, CodeDiagnosticAction, CodeDiagnosticSeverity, CodeExtension, CodeExtensionContext, CodeGutter, CodeGutterHoverMarker, CodeGutterMarker, CodeHistoryHandler, CodeCompletion, CodeCompletionKind, CodeCompletionRequest, CodePositionRequest, CodeCompletionResult, CodeHoverResult, CodeMenuItem, CodePanel, CodeSignatureResult, CodeWidget, } from './extension';
|
|
110
184
|
export default DouCodeEditor;
|
|
111
|
-
export type { CodeDiffEmits, CodeDiffProps, CodeEditorEmits, CodeEditorExpose, CodeEditorProps, CodeInputEmits, CodeInputProps, CodeKey, CodeKeysProps, } from './types';
|
|
185
|
+
export type { CodeDiffEmits, CodeDiffExpose, CodeDiffGutter, CodeDiffGutterMarker, CodeDiffHoverMarker, CodeDiffProps, CodeDiffSide, CodeDiffSlots, CodeDiffWidget, CodeEditorEmits, CodeEditorExpose, CodeEditorProps, CodeInputEmits, CodeInputProps, CodeKey, CodeKeysProps, } from './types';
|
|
112
186
|
export { CodeText, splitLines } from './core/text';
|
|
113
187
|
export type { CodeLine } from './core/text';
|
|
114
188
|
export { ChangeSet } from './core/changes';
|
|
@@ -123,8 +197,10 @@ export { defaultKeymap } from './core/keymap';
|
|
|
123
197
|
export { findPartner, matchBracket } from './core/brackets';
|
|
124
198
|
export type { BracketMatch } from './core/brackets';
|
|
125
199
|
export { CodeStream } from './language/stream';
|
|
126
|
-
export { copyPlain, defineCodeLanguage, languageFor, lineParts, samePlain, tokenizeLine, tokenTypes, } from './language/language';
|
|
127
|
-
export type { CodeLanguage, CodeLanguageSpec, CodeLineTokens, CodeTokenType, } from './language/language';
|
|
200
|
+
export { copyPlain, defineCodeLanguage, languageFor, lineParts, remoteCodeLanguage, samePlain, tokenizeLine, tokenTypes, } from './language/language';
|
|
201
|
+
export type { CodeLanguage, CodeLanguageSpec, CodeLineTokens, CodeTokenType, RemoteCodeLanguageOptions, } from './language/language';
|
|
202
|
+
export { createCodeWorkerPool } from './language/worker-client';
|
|
203
|
+
export type { CodeWorkerOption, CodeWorkerPool, CodeWorkerPoolOptions, } from './language/worker-client';
|
|
128
204
|
export { CodeHighlighter } from './language/highlighter';
|
|
129
205
|
export { createCodeHighlighter, highlightToHtml } from './language/to-html';
|
|
130
206
|
export { createJavaScript, javascript, jsx, tsx, typescript } from './languages/javascript';
|