oasis-editor 0.0.10 → 0.0.11

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.
@@ -26,6 +26,31 @@ export interface OasisPdfLineOptions {
26
26
  lineWidth?: number;
27
27
  dashArray?: number[];
28
28
  }
29
+ export type OasisPdfPathSegment = {
30
+ type: "move";
31
+ x: number;
32
+ y: number;
33
+ } | {
34
+ type: "line";
35
+ x: number;
36
+ y: number;
37
+ } | {
38
+ type: "cubic";
39
+ x1: number;
40
+ y1: number;
41
+ x2: number;
42
+ y2: number;
43
+ x: number;
44
+ y: number;
45
+ } | {
46
+ type: "close";
47
+ };
48
+ export interface OasisPdfPathOptions {
49
+ segments: OasisPdfPathSegment[];
50
+ fill?: string;
51
+ stroke?: string;
52
+ lineWidth?: number;
53
+ }
29
54
  export interface OasisPdfTextOptions {
30
55
  x: number;
31
56
  y: number;
@@ -78,6 +103,11 @@ export declare class OasisPdfWriter {
78
103
  getPageCount(): number;
79
104
  drawRect(pageIndex: number, options: OasisPdfRectOptions): void;
80
105
  drawLine(pageIndex: number, options: OasisPdfLineOptions): void;
106
+ drawPath(pageIndex: number, options: OasisPdfPathOptions): void;
107
+ saveGraphicsState(pageIndex: number): void;
108
+ restoreGraphicsState(pageIndex: number): void;
109
+ rotateAbout(pageIndex: number, centerX: number, centerY: number, degrees: number): void;
110
+ clipRect(pageIndex: number, x: number, y: number, width: number, height: number): void;
81
111
  drawText(pageIndex: number, options: OasisPdfTextOptions): void;
82
112
  registerImageResource(resource: Omit<OasisPdfImageResource, "resourceName"> & {
83
113
  resourceName?: string;
@@ -1,5 +1,5 @@
1
- import { EditorDocument, EditorLayoutBlock } from '../../../../../../core/model.js';
1
+ import { EditorDocument, EditorLayoutBlock, EditorPageSettings } from '../../../../../../core/model.js';
2
2
  import { PdfFontRegistry } from '../../../../fonts/PdfFontRegistry.js';
3
3
  import { OasisPdfWriter } from '../../../../OasisPdfWriter.js';
4
4
 
5
- export declare function drawBlockList(writer: OasisPdfWriter, pageIndex: number, blocks: EditorLayoutBlock[] | undefined, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, number>): Promise<void>;
5
+ export declare function drawBlockList(writer: OasisPdfWriter, pageIndex: number, blocks: EditorLayoutBlock[] | undefined, document: EditorDocument, originX: number, originY: number, contentWidth: number, fontRegistry: PdfFontRegistry, listOrdinals: Map<string, number>, pageSettings?: EditorPageSettings): Promise<void>;
@@ -0,0 +1,34 @@
1
+ import { EditorDocument, EditorLayoutLine, EditorPageSettings, EditorTextBoxData } from '../../../../../../core/model.js';
2
+ import { PdfFontRegistry } from '../../../../fonts/PdfFontRegistry.js';
3
+ import { OasisPdfWriter } from '../../../../OasisPdfWriter.js';
4
+
5
+ interface TextBoxPaintContext {
6
+ document: EditorDocument;
7
+ fontRegistry: PdfFontRegistry;
8
+ pageIndex: number;
9
+ }
10
+ /**
11
+ * Paints a text box / shape (geometry + inner content) at the given box,
12
+ * honoring `textBox.rotation` by rotating about the box center — mirroring the
13
+ * canvas `paintTextBox`. Shared by inline and floating text box rendering.
14
+ */
15
+ export declare function paintTextBox(writer: OasisPdfWriter, textBox: EditorTextBoxData, ctx: TextBoxPaintContext, xPx: number, yPx: number, widthPx: number, heightPx: number): Promise<void>;
16
+ /**
17
+ * Paints the floating (anchored) text boxes / shapes of a single paragraph,
18
+ * mirroring the canvas `drawFloatingTextBoxesForParagraph`: positions are
19
+ * resolved with {@link resolveFloatingObjectRect} into absolute page
20
+ * coordinates. Inline (non-floating) boxes are handled in the fragment loop.
21
+ */
22
+ export declare function drawFloatingTextBoxesForParagraph(options: {
23
+ writer: OasisPdfWriter;
24
+ document: EditorDocument;
25
+ fontRegistry: PdfFontRegistry;
26
+ pageIndex: number;
27
+ lines: EditorLayoutLine[];
28
+ pageSettings: EditorPageSettings;
29
+ contentLeft: number;
30
+ contentTop: number;
31
+ contentWidth: number;
32
+ paragraphTop: number;
33
+ }): Promise<void>;
34
+ export {};
@@ -6,6 +6,13 @@ export declare const en: {
6
6
  "toolbar.redo": string;
7
7
  "toolbar.insert": string;
8
8
  "toolbar.image": string;
9
+ "toolbar.shapes": string;
10
+ "toolbar.shape.rect": string;
11
+ "toolbar.shape.roundRect": string;
12
+ "toolbar.shape.ellipse": string;
13
+ "toolbar.shape.triangle": string;
14
+ "toolbar.shape.rtTriangle": string;
15
+ "toolbar.shape.diamond": string;
9
16
  "toolbar.table": string;
10
17
  "toolbar.pageNumber": string;
11
18
  "toolbar.totalPages": string;
@@ -6,6 +6,13 @@ export declare const ptBR: {
6
6
  "toolbar.redo": string;
7
7
  "toolbar.insert": string;
8
8
  "toolbar.image": string;
9
+ "toolbar.shapes": string;
10
+ "toolbar.shape.rect": string;
11
+ "toolbar.shape.roundRect": string;
12
+ "toolbar.shape.ellipse": string;
13
+ "toolbar.shape.triangle": string;
14
+ "toolbar.shape.rtTriangle": string;
15
+ "toolbar.shape.diamond": string;
9
16
  "toolbar.table": string;
10
17
  "toolbar.pageNumber": string;
11
18
  "toolbar.totalPages": string;