testdrive-jsui/types/index.d.ts
tegwick f17363c491
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
docs/fix: reconcile STANDALONE_PLAN (open/deferred), add types/index.d.ts, eslint config matches code style
- STANDALONE_PLAN.md marked open/deferred; docs/STANDALONE_PLAN_STATUS.md has phase status
- types/index.d.ts hand-written (dist/index.d.ts was never generated); package.json types+files updated
- eslint: semi always, indent 4, no space-before-function-paren (9956 -> 1172 problems)
- document pytest -p no:xvfb --no-cov for WSL
- README: flag nonexistent TestDriveJSUIEngine standalone usage

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: sonnet
Assistant-Process: 299063@bnt-lap001
Assistant-Session: 53eb1e1c-c13a-4277-9ce2-3702960d93f7
2026-10-02 22:38:33 +02:00

69 lines
1.9 KiB
TypeScript

/**
* Hand-written type declarations for testdrive-jsui (public API of the
* TestDriveJSUI class). Kept in types/ (tracked) because dist/ is generated
* and git-ignored. Update together with js/testdrive-jsui.js.
*/
export type Mode = 'edit' | 'view';
export type ControlPosition = 'nw' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w';
export interface TestDriveJSUIControls {
editControl?: boolean;
statusControl?: boolean;
contentsControl?: boolean;
debugControl?: boolean;
simpleControls?: boolean;
}
export interface TestDriveJSUIControlPositions {
editControl?: ControlPosition;
statusControl?: ControlPosition;
contentsControl?: ControlPosition;
debugControl?: ControlPosition;
}
export interface TestDriveJSUIOptions {
/** CSS selector or element that hosts the editor (required). */
container: string | HTMLElement;
markdown?: string;
mode?: Mode;
theme?: string;
autosave?: boolean;
shortcuts?: boolean;
sections?: boolean;
debug?: boolean;
controls?: TestDriveJSUIControls;
controlPositions?: TestDriveJSUIControlPositions;
[key: string]: unknown;
}
export interface TestDriveJSUIStatus {
mode: Mode;
totalSections?: number;
editingSections?: number;
modifiedSections?: number;
wordCount: number;
characterCount: number;
}
export class TestDriveJSUI {
constructor(options: TestDriveJSUIOptions);
readonly config: TestDriveJSUIOptions;
readonly isInitialized: boolean;
getMarkdown(): string;
setMarkdown(markdown: string): void;
getStatus(): TestDriveJSUIStatus;
getWordCount(): number;
applyTheme(themeName: string): void;
save(): void;
download(filename?: string): void;
resetAll(): void;
toggleDebug(): void;
on(event: string, callback: (data?: any) => void): void;
off(event: string, callback: (data?: any) => void): void;
emit(event: string, data?: unknown): void;
destroy(): void;
}
export const version: string;
export default TestDriveJSUI;