@aseity/idocs-preview 0.3.0 → 0.4.0

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.
@@ -0,0 +1,70 @@
1
+ import type { Anchor, BlockStyle, EditorSession, PreviewDocument, TextAlign } from '../core/index.js';
2
+ import type { ReadOnlyTarget } from './edit-selection.js';
3
+ import { type EditorView, type EditorViewOptions, type EditorViewSelection, type SelectedImageTarget } from './editor.js';
4
+ export interface PickedImage {
5
+ readonly src: string;
6
+ readonly alt?: string;
7
+ }
8
+ export interface EditorWorkspaceOptions {
9
+ readonly view?: EditorViewOptions;
10
+ readonly readOnly?: boolean;
11
+ readonly processing?: boolean;
12
+ readonly busyLabel?: string;
13
+ readonly railOpen?: boolean;
14
+ readonly assistantName?: string;
15
+ readonly onPickImage?: () => Promise<PickedImage | null>;
16
+ readonly onQuoteSelection?: (selection: {
17
+ text: string;
18
+ path: string;
19
+ page: number;
20
+ }) => void;
21
+ }
22
+ export interface EditorWorkspace {
23
+ readonly view: EditorView;
24
+ readonly readOnly: boolean;
25
+ readonly processing: boolean;
26
+ setReadOnly(readOnly: boolean, busyLabel?: string, processing?: boolean): void;
27
+ setRailOpen(open: boolean): void;
28
+ destroy(): void;
29
+ }
30
+ export interface OutlineEntry {
31
+ readonly path: string;
32
+ readonly level: 1 | 2 | 3;
33
+ readonly text: string;
34
+ readonly page: number;
35
+ readonly anchor?: Anchor;
36
+ }
37
+ export type ToolbarContext = {
38
+ readonly kind: 'readOnly';
39
+ readonly processing: boolean;
40
+ readonly label: string;
41
+ } | {
42
+ readonly kind: 'readOnlyTarget';
43
+ readonly target: ReadOnlyTarget;
44
+ readonly badge: string;
45
+ readonly message: string;
46
+ } | {
47
+ readonly kind: 'image';
48
+ readonly target: SelectedImageTarget;
49
+ } | {
50
+ readonly kind: 'editable';
51
+ readonly inTable: boolean;
52
+ readonly blockStyle?: BlockStyle;
53
+ readonly align?: TextAlign;
54
+ readonly collapsed: boolean;
55
+ } | {
56
+ readonly kind: 'empty';
57
+ };
58
+ export declare function formatAskAssistantLabel(assistantName?: string): string;
59
+ export declare function extractOutline(doc: PreviewDocument): OutlineEntry[];
60
+ export declare function isTableCellPath(path: string): boolean;
61
+ export declare function resolveToolbarContext(input: {
62
+ readOnly: boolean;
63
+ processing?: boolean;
64
+ busyLabel?: string;
65
+ readOnlyTarget: ReadOnlyTarget | null;
66
+ selectedImage: SelectedImageTarget | null;
67
+ selection: EditorViewSelection | null;
68
+ document?: PreviewDocument;
69
+ }): ToolbarContext;
70
+ export declare function mountEditorWorkspace(container: HTMLElement, session: EditorSession, options?: EditorWorkspaceOptions): EditorWorkspace;