@onodocs/canvas 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.
- package/README.md +382 -256
- package/SDK.md +382 -256
- package/agreement-review.md +13 -0
- package/ai-report-demo.md +40 -0
- package/application-integration.md +87 -0
- package/document-collaboration.md +50 -0
- package/document-forms.md +84 -0
- package/document-modes.md +44 -0
- package/index.js +213 -40
- package/package.json +11 -3
- package/proposal.md +36 -0
- package/templates.md +71 -0
- package/types/canvas/index.d.ts +3 -0
- package/types/canvas/presentation.d.ts +2 -0
- package/types/canvas/text-selection.d.ts +6 -0
- package/types/foundation/page-interaction.d.ts +17 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/** Spec: pipeline.sdk.presentation */
|
|
3
3
|
import type { DocumentFragment, DocumentHit, DocumentPoint, DocumentSelection } from "../render-api/index.js";
|
|
4
4
|
import type { DocumentPage, PageSize } from "./index.js";
|
|
5
|
+
import { type SelectionOverlay } from "./text-selection.js";
|
|
5
6
|
export interface ViewOptions {
|
|
6
7
|
readonly zoom?: number | "fit-width";
|
|
7
8
|
readonly gap?: number;
|
|
@@ -46,6 +47,7 @@ export interface DocumentView {
|
|
|
46
47
|
hitTest(point: DocumentPoint): DocumentHit | undefined;
|
|
47
48
|
readonly selection: DocumentSelection | undefined;
|
|
48
49
|
setSelection(selection: DocumentSelection): void;
|
|
50
|
+
setSelectionOverlays(selections: readonly SelectionOverlay[]): void;
|
|
49
51
|
scrollTo(anchor: ViewAnchor, options?: ScrollIntoViewOptions): boolean;
|
|
50
52
|
attach(element: HTMLElement, options: AttachmentOptions): DocumentAttachment;
|
|
51
53
|
dispose(): void;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { DocumentSelection, PageTextLine } from "../render-api/index.js";
|
|
2
2
|
import type { DocumentPage } from "./index.js";
|
|
3
|
+
export interface SelectionOverlay {
|
|
4
|
+
readonly selection: DocumentSelection;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly color: string;
|
|
7
|
+
}
|
|
3
8
|
/** Spec: pipeline.sdk.presentation */
|
|
4
9
|
export declare function mountTextSelection(pageText: readonly PageTextLine[], viewport: HTMLElement, shells: readonly HTMLElement[], pageBounds: readonly DocumentPage["size"][], nearby: ReadonlySet<number>, signal: AbortSignal, input?: HTMLTextAreaElement, onSelectionChange?: (selection: DocumentSelection | undefined) => void): {
|
|
5
10
|
paint: () => void;
|
|
11
|
+
setSelectionOverlays(values: readonly SelectionOverlay[]): void;
|
|
6
12
|
readonly selection: DocumentSelection | undefined;
|
|
7
13
|
setSelection(value: DocumentSelection): void;
|
|
8
14
|
};
|
|
@@ -43,6 +43,7 @@ export interface DocumentHit {
|
|
|
43
43
|
}>;
|
|
44
44
|
}
|
|
45
45
|
export interface PageTextLine {
|
|
46
|
+
readonly ink?: PageRectangle;
|
|
46
47
|
readonly pageIndex: number;
|
|
47
48
|
readonly order: number;
|
|
48
49
|
readonly clip: PageRectangle | null;
|
|
@@ -52,6 +53,12 @@ export interface PageTextLine {
|
|
|
52
53
|
transform?: PageTransform;
|
|
53
54
|
}>[];
|
|
54
55
|
readonly selection: Readonly<{
|
|
56
|
+
storyId?: string;
|
|
57
|
+
generated?: readonly Readonly<{
|
|
58
|
+
text: string;
|
|
59
|
+
x: number;
|
|
60
|
+
width: number;
|
|
61
|
+
}>[];
|
|
55
62
|
transform?: PageTransform;
|
|
56
63
|
paragraphId: string;
|
|
57
64
|
sourceOrder?: bigint;
|
|
@@ -86,9 +93,19 @@ export interface PageHitLine {
|
|
|
86
93
|
readonly emptyParagraph: boolean;
|
|
87
94
|
}
|
|
88
95
|
export interface PageInteraction {
|
|
96
|
+
readonly readingOrder: readonly Readonly<{
|
|
97
|
+
text: string;
|
|
98
|
+
headingLevel?: number;
|
|
99
|
+
}>[];
|
|
100
|
+
/** Spec: pipeline.sdk.pdf-export */
|
|
101
|
+
readonly figures?: readonly Readonly<{
|
|
102
|
+
elementId: string;
|
|
103
|
+
fragment: DocumentFragment;
|
|
104
|
+
}>[];
|
|
89
105
|
readonly text: readonly PageTextLine[];
|
|
90
106
|
readonly lines: readonly PageHitLine[];
|
|
91
107
|
readonly areas: readonly Readonly<{
|
|
108
|
+
kind?: "image";
|
|
92
109
|
elementId: string;
|
|
93
110
|
fragment: DocumentFragment;
|
|
94
111
|
}>[];
|