@aseity/idocs-preview 0.3.0 → 0.5.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.
- package/CHANGELOG.md +12 -0
- package/README.md +59 -3
- package/dist/core/display.d.ts +90 -0
- package/dist/core/editor.d.ts +180 -0
- package/dist/core/editor.js +533 -0
- package/dist/core/engine.js +132 -38
- package/dist/core/index.d.ts +6 -19
- package/dist/core/index.js +13 -17
- package/dist/core/protocol.d.ts +87 -0
- package/dist/core/protocol.js +13 -1
- package/dist/view/edit-selection.d.ts +82 -0
- package/dist/view/edit-selection.js +786 -0
- package/dist/view/editor.d.ts +78 -0
- package/dist/view/editor.js +1485 -0
- package/dist/view/find.d.ts +2 -1
- package/dist/view/find.js +7 -0
- package/dist/view/ime.d.ts +63 -0
- package/dist/view/ime.js +352 -0
- package/dist/view/index.d.ts +4 -0
- package/dist/view/index.js +3 -0
- package/dist/view/selection-layer.d.ts +1 -0
- package/dist/view/selection-layer.js +4 -4
- package/dist/view/workspace-styles.d.ts +1 -0
- package/dist/view/workspace-styles.js +939 -0
- package/dist/view/workspace.d.ts +77 -0
- package/dist/view/workspace.js +1121 -0
- package/package.json +8 -3
- package/wasm/idocs_wasm.d.ts +30 -0
- package/wasm/idocs_wasm.js +147 -0
- package/wasm/idocs_wasm_bg.wasm +0 -0
- package/wasm/idocs_wasm_bg.wasm.d.ts +13 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Anchor, BlockStyle, CalloutColors, 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 InsertDockButton {
|
|
9
|
+
readonly container: HTMLElement;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly className: string;
|
|
12
|
+
activate(): void;
|
|
13
|
+
bind(button: HTMLButtonElement | null): void;
|
|
14
|
+
}
|
|
15
|
+
export interface EditorWorkspaceOptions {
|
|
16
|
+
readonly view?: EditorViewOptions;
|
|
17
|
+
readonly readOnly?: boolean;
|
|
18
|
+
readonly processing?: boolean;
|
|
19
|
+
readonly busyLabel?: string;
|
|
20
|
+
readonly railOpen?: boolean;
|
|
21
|
+
readonly assistantName?: string;
|
|
22
|
+
readonly calloutColors?: CalloutColors;
|
|
23
|
+
readonly onPickImage?: () => Promise<PickedImage | null>;
|
|
24
|
+
readonly onQuoteSelection?: (selection: {
|
|
25
|
+
text: string;
|
|
26
|
+
path: string;
|
|
27
|
+
page: number;
|
|
28
|
+
}) => void;
|
|
29
|
+
readonly mountInsertButtons?: (buttons: readonly InsertDockButton[]) => () => void;
|
|
30
|
+
}
|
|
31
|
+
export interface EditorWorkspace {
|
|
32
|
+
readonly view: EditorView;
|
|
33
|
+
readonly readOnly: boolean;
|
|
34
|
+
readonly processing: boolean;
|
|
35
|
+
setReadOnly(readOnly: boolean, busyLabel?: string, processing?: boolean): void;
|
|
36
|
+
setRailOpen(open: boolean): void;
|
|
37
|
+
destroy(): void;
|
|
38
|
+
}
|
|
39
|
+
export interface OutlineEntry {
|
|
40
|
+
readonly path: string;
|
|
41
|
+
readonly level: 1 | 2 | 3;
|
|
42
|
+
readonly text: string;
|
|
43
|
+
readonly page: number;
|
|
44
|
+
readonly anchor?: Anchor;
|
|
45
|
+
}
|
|
46
|
+
export type ToolbarContext = {
|
|
47
|
+
readonly kind: 'readOnly';
|
|
48
|
+
readonly processing: boolean;
|
|
49
|
+
readonly label: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: 'readOnlyTarget';
|
|
52
|
+
readonly target: ReadOnlyTarget;
|
|
53
|
+
} | {
|
|
54
|
+
readonly kind: 'image';
|
|
55
|
+
readonly target: SelectedImageTarget;
|
|
56
|
+
} | {
|
|
57
|
+
readonly kind: 'editable';
|
|
58
|
+
readonly inTable: boolean;
|
|
59
|
+
readonly blockStyle?: BlockStyle;
|
|
60
|
+
readonly align?: TextAlign;
|
|
61
|
+
readonly collapsed: boolean;
|
|
62
|
+
} | {
|
|
63
|
+
readonly kind: 'empty';
|
|
64
|
+
};
|
|
65
|
+
export declare function formatAskAssistantLabel(assistantName?: string): string;
|
|
66
|
+
export declare function extractOutline(doc: PreviewDocument): OutlineEntry[];
|
|
67
|
+
export declare function isTableCellPath(path: string): boolean;
|
|
68
|
+
export declare function resolveToolbarContext(input: {
|
|
69
|
+
readOnly: boolean;
|
|
70
|
+
processing?: boolean;
|
|
71
|
+
busyLabel?: string;
|
|
72
|
+
readOnlyTarget: ReadOnlyTarget | null;
|
|
73
|
+
selectedImage: SelectedImageTarget | null;
|
|
74
|
+
selection: EditorViewSelection | null;
|
|
75
|
+
document?: PreviewDocument;
|
|
76
|
+
}): ToolbarContext;
|
|
77
|
+
export declare function mountEditorWorkspace(container: HTMLElement, session: EditorSession, options?: EditorWorkspaceOptions): EditorWorkspace;
|