import * as monaco from 'monaco-editor/editor/editor.api'; import { type CodedProblem, type ProblemParams } from '../components/Provider.js'; import { type NestedWorkflowText } from './nestedText.js'; import './monacoFeatures.js'; /** * A problem Monaco or the YAML service found in the text, as `onValidate` reports it. Its `message` * is in the reader's language; `problem` is the coded problem it was worded from, when it has a * code, with the text the service wrote as its `message`. */ export type ValidationMarker = monaco.editor.IMarker & { problem?: CodedProblem; }; /** A problem to mark on one line of the editor. With a `code`, the host's `useProblemMessage` * words it in the reader's language, and `message` is the text shown when it has none. */ export interface EditorMarker { line: number; message: string; code?: string | null | undefined; params?: ProblemParams | null | undefined; type?: string | null | undefined; } export interface EditorProps extends monaco.editor.IStandaloneEditorConstructionOptions { className?: string; /** Shows the text greyed out and read-only, as a disabled field does. */ disabled?: boolean | undefined; /** * Shows the text to read rather than edit: it stays selectable, copyable and reachable by * keyboard, announces itself read-only, and shows no cursor, current line or quick fixes. The * view ends at the last line, and the wheel scrolls the page once the text has none left. */ readOnly?: boolean; /** The text as the person edits it, with carriage returns removed. */ onChange?: (value: string) => void; /** Every marker on the text, each time they change: the schema's, the lint's and the host's. */ onValidate?: (markers: ValidationMarker[]) => void; width?: string | number; height?: string | number; /** * The model's URI. A YAML schema registered with `configureEditorYaml` applies where its * `fileMatch` matches this path, and `revealLines` finds the editor by it. Each editor gets one * of its own when left out. It is read once: give the editor a `key` to edit another path. */ path?: string; /** Apply outside `value` changes as undoable edits instead of resetting the undo history. */ preserveUndo?: boolean; /** Checks a whole workflow for what the schema can't, such as needs read but never listed. */ lint?: boolean; /** Problems found elsewhere to mark in the text, such as a job's in the workflow around it. */ markers?: EditorMarker[]; /** Set when the text is one job or step, for completions that touch the rest of the workflow. */ nested?: NestedWorkflowText; } export default function MonacoEditor({ className, disabled, onChange, onValidate, width, height, path: pathProp, preserveUndo, lint, markers, nested, value, language, ...options }: EditorProps): import("react").JSX.Element;