@onodocs/canvas 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/LICENSE +12 -4
- package/LICENSING.md +19 -3
- package/README.md +400 -256
- package/SDK.md +400 -256
- package/agreement-review.md +13 -0
- package/ai-report-demo.md +40 -0
- package/application-integration.md +89 -0
- package/document-collaboration.md +54 -0
- package/document-forms.md +84 -0
- package/document-modes.md +44 -0
- package/editor.md +39 -0
- package/index.js +214 -41
- package/package.json +12 -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 +3 -0
- package/types/canvas/text-selection.d.ts +6 -0
- package/types/foundation/page-interaction.d.ts +17 -0
- package/types/render-api/page-display-list.d.ts +4 -0
package/types/canvas/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Spec: pipeline.sdk.pdf-export */
|
|
1
2
|
/** Spec: pipeline.sdk.page-source */
|
|
2
3
|
import { type PageInteraction } from "../foundation/index.js";
|
|
3
4
|
import type { DocumentSource, PageSize } from "../render-api/index.js";
|
|
@@ -5,6 +6,7 @@ import type { DocumentView, ViewOptions } from "./presentation.js";
|
|
|
5
6
|
export { materializePageDisplayListToCanvas } from "./canvas-materializer.js";
|
|
6
7
|
export { encode, decode } from "./transport.js";
|
|
7
8
|
export type * from "../render-api/index.js";
|
|
9
|
+
export type { SelectionOverlay } from "./text-selection.js";
|
|
8
10
|
export type { DocumentView, ViewOptions, ViewAnchor, DocumentAttachment, AttachmentOptions, AttachmentPlacement } from "./presentation.js";
|
|
9
11
|
export interface DocumentPage {
|
|
10
12
|
readonly index: number;
|
|
@@ -12,6 +14,7 @@ export interface DocumentPage {
|
|
|
12
14
|
readonly interaction: PageInteraction;
|
|
13
15
|
render(canvas: HTMLCanvasElement, options?: Readonly<{
|
|
14
16
|
dpi?: number;
|
|
17
|
+
background?: "white" | "transparent";
|
|
15
18
|
signal?: AbortSignal;
|
|
16
19
|
}>): Promise<void>;
|
|
17
20
|
}
|
|
@@ -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;
|
|
@@ -20,6 +21,7 @@ export type AttachmentOptions = Readonly<{
|
|
|
20
21
|
anchor: ViewAnchor;
|
|
21
22
|
offset?: DocumentPoint;
|
|
22
23
|
size?: PageSize;
|
|
24
|
+
interactive?: boolean;
|
|
23
25
|
}> & (Readonly<{
|
|
24
26
|
placement?: "overlay";
|
|
25
27
|
inset?: never;
|
|
@@ -46,6 +48,7 @@ export interface DocumentView {
|
|
|
46
48
|
hitTest(point: DocumentPoint): DocumentHit | undefined;
|
|
47
49
|
readonly selection: DocumentSelection | undefined;
|
|
48
50
|
setSelection(selection: DocumentSelection): void;
|
|
51
|
+
setSelectionOverlays(selections: readonly SelectionOverlay[]): void;
|
|
49
52
|
scrollTo(anchor: ViewAnchor, options?: ScrollIntoViewOptions): boolean;
|
|
50
53
|
attach(element: HTMLElement, options: AttachmentOptions): DocumentAttachment;
|
|
51
54
|
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
|
}>[];
|
|
@@ -7,6 +7,10 @@ import type { GeometryPathOperation } from "../foundation/index.js";
|
|
|
7
7
|
/** Spec: spec/document/body/drawing/vml/gradient-fills.md */
|
|
8
8
|
/** Spec: `spec/pipeline/render/page-display-list/_index.md`; `spec/pipeline/render/page-display-list/positioned-text/shading.md#positioned-text-shading-compilation`; `spec/pipeline/render/page-display-list/positioned-text/highlight.md#highlight-command-compilation`; `spec/pipeline/render/page-display-list/positioned-text/decoration.md#strike-command-compilation`. */
|
|
9
9
|
import type { RasterColorEffectPlan, RasterSourceRectangle, VectorShapeFill, VectorShapePath } from "../foundation/index.js";
|
|
10
|
+
/** Spec: pipeline.render.page-display-list.comment-projection */
|
|
11
|
+
export interface PageDisplayListOptions {
|
|
12
|
+
readonly commentDisplay?: "markers" | "hidden";
|
|
13
|
+
}
|
|
10
14
|
export interface PaintRectangle {
|
|
11
15
|
readonly x: bigint;
|
|
12
16
|
readonly y: bigint;
|