/** Session binding for reading and driving the editor's named surfaces. * Each verb accepts a document-probe scope: document, header, shelf, rail, * outliner, utility or area. Targets outside that scope are refused. Chrome * scopes remain available without an open document. The eval member listing * groups these verbs under editor.document. */ import type { DocumentProbeResult, DocumentProbeScope } from '@volter/sdk'; import type { EditorClient } from './client.js'; /** Which named surface a verb runs against; `document` when omitted. */ export interface DocumentScopeOption { scope?: DocumentProbeScope; } /** Modifier/targeting options shared by the gesture verbs. */ export interface DocumentGestureOptions extends DocumentScopeOption { /** Which match to drive when the selector matches several (default 0). */ index?: number; } export interface DocumentKeyOptions extends DocumentGestureOptions { /** Target one element instead of whatever inside the scope has focus. */ selector?: string; code?: string; ctrlKey?: boolean; metaKey?: boolean; shiftKey?: boolean; altKey?: boolean; /** Hold the key this long before releasing it (a person holding W). * Finite, nonnegative, and at most 120,000 ms. */ holdMs?: number; } export interface DocumentPasteOptions extends DocumentGestureOptions { selector?: string; } export interface DocumentTypeOptions extends DocumentGestureOptions { /** The field; omitted types into whatever inside the scope has focus. */ selector?: string; /** Replace what the field holds first (default true). */ replace?: boolean; /** Press Enter after the text (default true). */ enter?: boolean; } export declare class LiveEditorDocument { #private; constructor(client: EditorClient); /** * Read matching elements inside the active document: tag, text, attributes, * value/checked/disabled and rect. `matched` is the total before `limit`. * * `styles` additionally resolves named properties per match — and resolving * is the point, because a theme token is an expression until an element * paints it. Ask for the standard property to learn the colour a person * sees; ask for a `--volter-…` custom property to learn what a rule WOULD * paint, which is the only way to measure a `:hover` colour (`:hover` is a * browser state no synthetic event can enter, so there is deliberately no * hover verb on this door). * * await editor.document.query('.volter-tree-row', { * styles: ['backgroundColor', '--volter-widget-regular-hover'], * }); */ query(selector: string, options?: DocumentScopeOption & { limit?: number; styles?: readonly string[]; }): Promise; /** A REAL pointer gesture (pointerdown/mousedown/focus/pointerup/mouseup/click) * — not `element.click()`, which a `pointerdown` listener never sees. */ click(selector: string, options?: DocumentGestureOptions & { clicks?: number; at?: [number, number]; altKey?: boolean; ctrlKey?: boolean; metaKey?: boolean; shiftKey?: boolean; }): Promise; /** * TYPE into a field and commit with Enter, the way a person does — one * character at a time through the prototype's value setter, between real * `keydown`/`keyup`. * * `paste` is not a substitute: an untrusted `ClipboardEvent` performs no * default action, so a plain `` with no paste handler keeps its old * value. Omit `selector` to type into whatever inside the scope has focus — * which is what a rename field is, one gesture after * `click(row, { clicks: 2 })`. */ type(text: string, options?: DocumentTypeOptions): Promise; /** * A real pointer DRAG across one matched element — press at `from`, move, * release at `to`. A zero-length drag presses and releases at one fraction. * * `from`, `to` and every point in `via` are `[x, y]` FRACTIONS OF THE * MATCHED ELEMENT'S BOX, 0..1 from its top-left — NEVER pixels and never * page coordinates. `[0.5, 0.5]` is its center, `[1, 0]` its top-right. * Compute a pixel target by measuring the element first: `query` answers * its `rect`, and `(px - rect.x) / rect.width` is the fraction to pass. */ drag(selector: string, options: DocumentGestureOptions & { from: [number, number]; to: [number, number]; via?: [number, number][]; steps?: number; altKey?: boolean; ctrlKey?: boolean; metaKey?: boolean; shiftKey?: boolean; /** 0 primary (default), 1 middle, 2 secondary. */ button?: 0 | 1 | 2; /** `via`/`to` may leave the element's box after the press (a handle drag). */ leave?: boolean; /** Keep the button down at `to`, for readings taken mid-gesture; {@link release} lets go. */ hold?: boolean; }): Promise; /** Lets go of the drag `hold: true` left pressed, where it was left. */ release(options?: DocumentGestureOptions): Promise; /** A real keydown/keyup on the target, or on whatever inside the document has focus. */ key(key: string, options?: DocumentKeyOptions): Promise; /** A real `ClipboardEvent` carrying `text/plain` — the gesture nothing else * in the product can produce. */ paste(text: string, options?: DocumentPasteOptions): Promise; /** * Choose `value` on a `