oasis-editor 0.0.38 → 0.0.39
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/dist/{OasisEditorApp-Bq6fZsEX.js → OasisEditorApp-rHCQJW6I.js} +1 -1
- package/dist/{index-lzzJKBU1.js → index-XgdC48U9.js} +5810 -5795
- package/dist/oasis-editor.js +1 -1
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/ui/canvas/canvasBlockPainters.d.ts +17 -0
- package/dist/ui/canvas/canvasFontResolution.d.ts +10 -0
- package/dist/ui/canvas/canvasParagraphPainter.d.ts +3 -11
- package/dist/ui/canvas/canvasTablePainter.d.ts +2 -1
- package/dist/ui/canvas/canvasTextBoxPainter.d.ts +4 -2
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EditorLayoutBlock, EditorParagraphNode, EditorLayoutLine, EditorState, EditorTableNode } from '../../core/model.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The block-level painters a text box's inner content recurses into. Injected
|
|
5
|
+
* into the canvas paint pipeline so `canvasTextBoxPainter` can render nested
|
|
6
|
+
* paragraphs/tables without importing `canvasParagraphPainter`/
|
|
7
|
+
* `canvasTablePainter` (which import back through the text-box painter), keeping
|
|
8
|
+
* the painter graph acyclic. The concrete object is owned by `canvasBlockPainter`,
|
|
9
|
+
* the orchestrator above this pipeline.
|
|
10
|
+
*
|
|
11
|
+
* Each painter takes the `painters` bundle so deeper nesting (a text box inside
|
|
12
|
+
* a text box) keeps threading the same callbacks.
|
|
13
|
+
*/
|
|
14
|
+
export interface CanvasBlockPainters {
|
|
15
|
+
drawParagraph(ctx: CanvasRenderingContext2D, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], state: EditorState, originX: number, originY: number, onUpdate: () => void, painters: CanvasBlockPainters, pageIndex?: number): void;
|
|
16
|
+
drawTable(ctx: CanvasRenderingContext2D, table: EditorTableNode, tableSegment: EditorLayoutBlock["tableSegment"] | undefined, state: EditorState, originX: number, originY: number, contentWidth: number, estimatedHeight: number, pageIndex: number, onUpdate: () => void, painters: CanvasBlockPainters): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function resolveCanvasFontFamily(fontFamily: string | null | undefined): string;
|
|
2
|
+
export declare function resolveCanvasTextRenderMetrics(styles: {
|
|
3
|
+
superscript?: boolean;
|
|
4
|
+
subscript?: boolean;
|
|
5
|
+
smallCaps?: boolean;
|
|
6
|
+
baselineShift?: number | null;
|
|
7
|
+
} | undefined, fontSize: number): {
|
|
8
|
+
fontSize: number;
|
|
9
|
+
baselineOffset: number;
|
|
10
|
+
};
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { EditorLayoutLine, EditorPageSettings, EditorParagraphNode, EditorState } from '../../core/model.js';
|
|
2
|
+
import { CanvasBlockPainters } from './canvasBlockPainters.js';
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
-
export declare function resolveCanvasTextRenderMetrics(styles: {
|
|
5
|
-
superscript?: boolean;
|
|
6
|
-
subscript?: boolean;
|
|
7
|
-
smallCaps?: boolean;
|
|
8
|
-
baselineShift?: number | null;
|
|
9
|
-
} | undefined, fontSize: number): {
|
|
10
|
-
fontSize: number;
|
|
11
|
-
baselineOffset: number;
|
|
12
|
-
};
|
|
4
|
+
export { resolveCanvasFontFamily, resolveCanvasTextRenderMetrics, } from './canvasFontResolution.js';
|
|
13
5
|
/**
|
|
14
6
|
* Paints the floating images anchored within a paragraph, mirroring
|
|
15
7
|
* `drawFloatingTextBoxesForParagraph`. Split into `behind`/`front` layers so a
|
|
@@ -27,7 +19,7 @@ export declare function drawFloatingImagesForParagraph(options: {
|
|
|
27
19
|
onUpdate: () => void;
|
|
28
20
|
layer: "behind" | "front";
|
|
29
21
|
}): void;
|
|
30
|
-
export declare function drawParagraph(ctx: CanvasRenderingContext2D, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], state: EditorState, originX: number, originY: number, onUpdate: () => void, pageIndex?: number): void;
|
|
22
|
+
export declare function drawParagraph(ctx: CanvasRenderingContext2D, paragraph: EditorParagraphNode, lines: EditorLayoutLine[], state: EditorState, originX: number, originY: number, onUpdate: () => void, painters: CanvasBlockPainters, pageIndex?: number): void;
|
|
31
23
|
export declare function resolveFragmentPaintBounds(line: EditorLayoutLine, fragment: EditorLayoutLine["fragments"][number]): {
|
|
32
24
|
left: number;
|
|
33
25
|
right: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { EditorLayoutBlock, EditorState, EditorTableNode } from '../../core/model.js';
|
|
2
|
+
import { CanvasBlockPainters } from './canvasBlockPainters.js';
|
|
2
3
|
|
|
3
|
-
export declare function drawTable(ctx: CanvasRenderingContext2D, table: EditorTableNode, tableSegment: EditorLayoutBlock["tableSegment"] | undefined, state: EditorState, originX: number, originY: number, contentWidth: number, estimatedHeight: number, pageIndex: number, onUpdate: () => void): void;
|
|
4
|
+
export declare function drawTable(ctx: CanvasRenderingContext2D, table: EditorTableNode, tableSegment: EditorLayoutBlock["tableSegment"] | undefined, state: EditorState, originX: number, originY: number, contentWidth: number, estimatedHeight: number, pageIndex: number, onUpdate: () => void, painters: CanvasBlockPainters): void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { EditorLayoutLine, EditorPageSettings, EditorState, EditorTextBoxData } from '../../core/model.js';
|
|
2
|
+
import { CanvasBlockPainters } from './canvasBlockPainters.js';
|
|
2
3
|
|
|
3
4
|
export declare function drawTextBoxShape(ctx: CanvasRenderingContext2D, textBox: EditorTextBoxData, x: number, y: number, width: number, height: number): void;
|
|
4
|
-
export declare function renderTextBoxContent(ctx: CanvasRenderingContext2D, textBox: EditorTextBoxData, state: EditorState, x: number, y: number, width: number, height: number, pageIndex: number, onUpdate: () => void): void;
|
|
5
|
+
export declare function renderTextBoxContent(ctx: CanvasRenderingContext2D, textBox: EditorTextBoxData, state: EditorState, x: number, y: number, width: number, height: number, pageIndex: number, onUpdate: () => void, painters: CanvasBlockPainters): void;
|
|
5
6
|
/**
|
|
6
7
|
* Paint a text box (shape + content) at the given box, honoring
|
|
7
8
|
* `textBox.rotation`. Rotation pivots around the box center so the painted
|
|
8
9
|
* result lines up with the selection overlay (which rotates the same way).
|
|
9
10
|
* Shared by inline and floating text box rendering.
|
|
10
11
|
*/
|
|
11
|
-
export declare function paintTextBox(ctx: CanvasRenderingContext2D, textBox: EditorTextBoxData, state: EditorState, x: number, y: number, width: number, height: number, pageIndex: number, onUpdate: () => void): void;
|
|
12
|
+
export declare function paintTextBox(ctx: CanvasRenderingContext2D, textBox: EditorTextBoxData, state: EditorState, x: number, y: number, width: number, height: number, pageIndex: number, onUpdate: () => void, painters: CanvasBlockPainters): void;
|
|
12
13
|
export declare function drawFloatingTextBoxesForParagraph(options: {
|
|
13
14
|
ctx: CanvasRenderingContext2D;
|
|
14
15
|
paragraphLines: EditorLayoutLine[];
|
|
@@ -21,4 +22,5 @@ export declare function drawFloatingTextBoxesForParagraph(options: {
|
|
|
21
22
|
pageIndex: number;
|
|
22
23
|
onUpdate: () => void;
|
|
23
24
|
layer: "behind" | "front";
|
|
25
|
+
painters: CanvasBlockPainters;
|
|
24
26
|
}): void;
|