@productcloudos/editor 1.0.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.
Files changed (166) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/LICENSE +21 -0
  3. package/README.md +377 -0
  4. package/dist/pc-editor.esm.js +24820 -0
  5. package/dist/pc-editor.esm.js.map +1 -0
  6. package/dist/pc-editor.js +24877 -0
  7. package/dist/pc-editor.js.map +1 -0
  8. package/dist/pc-editor.min.js +2 -0
  9. package/dist/pc-editor.min.js.map +1 -0
  10. package/dist/types/lib/clipboard/ClipboardManager.d.ts +77 -0
  11. package/dist/types/lib/clipboard/ClipboardManager.d.ts.map +1 -0
  12. package/dist/types/lib/clipboard/HtmlConverter.d.ts +43 -0
  13. package/dist/types/lib/clipboard/HtmlConverter.d.ts.map +1 -0
  14. package/dist/types/lib/clipboard/index.d.ts +9 -0
  15. package/dist/types/lib/clipboard/index.d.ts.map +1 -0
  16. package/dist/types/lib/clipboard/types.d.ts +76 -0
  17. package/dist/types/lib/clipboard/types.d.ts.map +1 -0
  18. package/dist/types/lib/controls/BaseControl.d.ts +72 -0
  19. package/dist/types/lib/controls/BaseControl.d.ts.map +1 -0
  20. package/dist/types/lib/controls/index.d.ts +11 -0
  21. package/dist/types/lib/controls/index.d.ts.map +1 -0
  22. package/dist/types/lib/controls/rulers/HorizontalRuler.d.ts +55 -0
  23. package/dist/types/lib/controls/rulers/HorizontalRuler.d.ts.map +1 -0
  24. package/dist/types/lib/controls/rulers/RulerControl.d.ts +98 -0
  25. package/dist/types/lib/controls/rulers/RulerControl.d.ts.map +1 -0
  26. package/dist/types/lib/controls/rulers/VerticalRuler.d.ts +65 -0
  27. package/dist/types/lib/controls/rulers/VerticalRuler.d.ts.map +1 -0
  28. package/dist/types/lib/controls/rulers/index.d.ts +8 -0
  29. package/dist/types/lib/controls/rulers/index.d.ts.map +1 -0
  30. package/dist/types/lib/controls/rulers/types.d.ts +62 -0
  31. package/dist/types/lib/controls/rulers/types.d.ts.map +1 -0
  32. package/dist/types/lib/controls/types.d.ts +51 -0
  33. package/dist/types/lib/controls/types.d.ts.map +1 -0
  34. package/dist/types/lib/core/Document.d.ts +34 -0
  35. package/dist/types/lib/core/Document.d.ts.map +1 -0
  36. package/dist/types/lib/core/PCEditor.d.ts +761 -0
  37. package/dist/types/lib/core/PCEditor.d.ts.map +1 -0
  38. package/dist/types/lib/core/Page.d.ts +40 -0
  39. package/dist/types/lib/core/Page.d.ts.map +1 -0
  40. package/dist/types/lib/data/DataBinder.d.ts +11 -0
  41. package/dist/types/lib/data/DataBinder.d.ts.map +1 -0
  42. package/dist/types/lib/events/EventEmitter.d.ts +11 -0
  43. package/dist/types/lib/events/EventEmitter.d.ts.map +1 -0
  44. package/dist/types/lib/hit-test/HitTestManager.d.ts +81 -0
  45. package/dist/types/lib/hit-test/HitTestManager.d.ts.map +1 -0
  46. package/dist/types/lib/hit-test/index.d.ts +32 -0
  47. package/dist/types/lib/hit-test/index.d.ts.map +1 -0
  48. package/dist/types/lib/hit-test/types.d.ts +113 -0
  49. package/dist/types/lib/hit-test/types.d.ts.map +1 -0
  50. package/dist/types/lib/import/ContentAnalyzer.d.ts +76 -0
  51. package/dist/types/lib/import/ContentAnalyzer.d.ts.map +1 -0
  52. package/dist/types/lib/import/DocumentBuilder.d.ts +44 -0
  53. package/dist/types/lib/import/DocumentBuilder.d.ts.map +1 -0
  54. package/dist/types/lib/import/PDFImporter.d.ts +65 -0
  55. package/dist/types/lib/import/PDFImporter.d.ts.map +1 -0
  56. package/dist/types/lib/import/PDFParser.d.ts +46 -0
  57. package/dist/types/lib/import/PDFParser.d.ts.map +1 -0
  58. package/dist/types/lib/import/index.d.ts +9 -0
  59. package/dist/types/lib/import/index.d.ts.map +1 -0
  60. package/dist/types/lib/import/types.d.ts +182 -0
  61. package/dist/types/lib/import/types.d.ts.map +1 -0
  62. package/dist/types/lib/index.d.ts +16 -0
  63. package/dist/types/lib/index.d.ts.map +1 -0
  64. package/dist/types/lib/layout/FlowManager.d.ts +29 -0
  65. package/dist/types/lib/layout/FlowManager.d.ts.map +1 -0
  66. package/dist/types/lib/layout/LayoutEngine.d.ts +39 -0
  67. package/dist/types/lib/layout/LayoutEngine.d.ts.map +1 -0
  68. package/dist/types/lib/objects/BaseEmbeddedObject.d.ts +133 -0
  69. package/dist/types/lib/objects/BaseEmbeddedObject.d.ts.map +1 -0
  70. package/dist/types/lib/objects/EmbeddedObjectFactory.d.ts +57 -0
  71. package/dist/types/lib/objects/EmbeddedObjectFactory.d.ts.map +1 -0
  72. package/dist/types/lib/objects/ImageObject.d.ts +60 -0
  73. package/dist/types/lib/objects/ImageObject.d.ts.map +1 -0
  74. package/dist/types/lib/objects/TextBoxObject.d.ts +208 -0
  75. package/dist/types/lib/objects/TextBoxObject.d.ts.map +1 -0
  76. package/dist/types/lib/objects/index.d.ts +9 -0
  77. package/dist/types/lib/objects/index.d.ts.map +1 -0
  78. package/dist/types/lib/objects/table/TableCell.d.ts +165 -0
  79. package/dist/types/lib/objects/table/TableCell.d.ts.map +1 -0
  80. package/dist/types/lib/objects/table/TableCellMerger.d.ts +66 -0
  81. package/dist/types/lib/objects/table/TableCellMerger.d.ts.map +1 -0
  82. package/dist/types/lib/objects/table/TableObject.d.ts +434 -0
  83. package/dist/types/lib/objects/table/TableObject.d.ts.map +1 -0
  84. package/dist/types/lib/objects/table/TableResizeHandler.d.ts +80 -0
  85. package/dist/types/lib/objects/table/TableResizeHandler.d.ts.map +1 -0
  86. package/dist/types/lib/objects/table/TableRow.d.ts +65 -0
  87. package/dist/types/lib/objects/table/TableRow.d.ts.map +1 -0
  88. package/dist/types/lib/objects/table/index.d.ts +12 -0
  89. package/dist/types/lib/objects/table/index.d.ts.map +1 -0
  90. package/dist/types/lib/objects/table/types.d.ts +239 -0
  91. package/dist/types/lib/objects/table/types.d.ts.map +1 -0
  92. package/dist/types/lib/objects/types.d.ts +135 -0
  93. package/dist/types/lib/objects/types.d.ts.map +1 -0
  94. package/dist/types/lib/rendering/CanvasManager.d.ts +282 -0
  95. package/dist/types/lib/rendering/CanvasManager.d.ts.map +1 -0
  96. package/dist/types/lib/rendering/FlowingTextRenderer.d.ts +348 -0
  97. package/dist/types/lib/rendering/FlowingTextRenderer.d.ts.map +1 -0
  98. package/dist/types/lib/rendering/PDFGenerator.d.ts +103 -0
  99. package/dist/types/lib/rendering/PDFGenerator.d.ts.map +1 -0
  100. package/dist/types/lib/rendering/pdf-utils.d.ts +54 -0
  101. package/dist/types/lib/rendering/pdf-utils.d.ts.map +1 -0
  102. package/dist/types/lib/text/EditableTextRegion.d.ts +105 -0
  103. package/dist/types/lib/text/EditableTextRegion.d.ts.map +1 -0
  104. package/dist/types/lib/text/EmbeddedObjectManager.d.ts +97 -0
  105. package/dist/types/lib/text/EmbeddedObjectManager.d.ts.map +1 -0
  106. package/dist/types/lib/text/FieldFormatter.d.ts +26 -0
  107. package/dist/types/lib/text/FieldFormatter.d.ts.map +1 -0
  108. package/dist/types/lib/text/FlowingTextContent.d.ts +571 -0
  109. package/dist/types/lib/text/FlowingTextContent.d.ts.map +1 -0
  110. package/dist/types/lib/text/HyperlinkManager.d.ts +110 -0
  111. package/dist/types/lib/text/HyperlinkManager.d.ts.map +1 -0
  112. package/dist/types/lib/text/MarkdownParser.d.ts +55 -0
  113. package/dist/types/lib/text/MarkdownParser.d.ts.map +1 -0
  114. package/dist/types/lib/text/ParagraphFormatting.d.ts +123 -0
  115. package/dist/types/lib/text/ParagraphFormatting.d.ts.map +1 -0
  116. package/dist/types/lib/text/RegionManager.d.ts +75 -0
  117. package/dist/types/lib/text/RegionManager.d.ts.map +1 -0
  118. package/dist/types/lib/text/RepeatingSectionManager.d.ts +99 -0
  119. package/dist/types/lib/text/RepeatingSectionManager.d.ts.map +1 -0
  120. package/dist/types/lib/text/SubstitutionFieldManager.d.ts +153 -0
  121. package/dist/types/lib/text/SubstitutionFieldManager.d.ts.map +1 -0
  122. package/dist/types/lib/text/TextFormatting.d.ts +85 -0
  123. package/dist/types/lib/text/TextFormatting.d.ts.map +1 -0
  124. package/dist/types/lib/text/TextLayout.d.ts +126 -0
  125. package/dist/types/lib/text/TextLayout.d.ts.map +1 -0
  126. package/dist/types/lib/text/TextMeasurer.d.ts +107 -0
  127. package/dist/types/lib/text/TextMeasurer.d.ts.map +1 -0
  128. package/dist/types/lib/text/TextPositionCalculator.d.ts +72 -0
  129. package/dist/types/lib/text/TextPositionCalculator.d.ts.map +1 -0
  130. package/dist/types/lib/text/TextState.d.ts +236 -0
  131. package/dist/types/lib/text/TextState.d.ts.map +1 -0
  132. package/dist/types/lib/text/index.d.ts +27 -0
  133. package/dist/types/lib/text/index.d.ts.map +1 -0
  134. package/dist/types/lib/text/regions/BodyTextRegion.d.ts +68 -0
  135. package/dist/types/lib/text/regions/BodyTextRegion.d.ts.map +1 -0
  136. package/dist/types/lib/text/regions/FooterTextRegion.d.ts +68 -0
  137. package/dist/types/lib/text/regions/FooterTextRegion.d.ts.map +1 -0
  138. package/dist/types/lib/text/regions/HeaderTextRegion.d.ts +68 -0
  139. package/dist/types/lib/text/regions/HeaderTextRegion.d.ts.map +1 -0
  140. package/dist/types/lib/text/regions/index.d.ts +7 -0
  141. package/dist/types/lib/text/regions/index.d.ts.map +1 -0
  142. package/dist/types/lib/text/types.d.ts +268 -0
  143. package/dist/types/lib/text/types.d.ts.map +1 -0
  144. package/dist/types/lib/types/index.d.ts +206 -0
  145. package/dist/types/lib/types/index.d.ts.map +1 -0
  146. package/dist/types/lib/undo/index.d.ts +8 -0
  147. package/dist/types/lib/undo/index.d.ts.map +1 -0
  148. package/dist/types/lib/undo/transaction/ContentDiscovery.d.ts +101 -0
  149. package/dist/types/lib/undo/transaction/ContentDiscovery.d.ts.map +1 -0
  150. package/dist/types/lib/undo/transaction/FocusTracker.d.ts +49 -0
  151. package/dist/types/lib/undo/transaction/FocusTracker.d.ts.map +1 -0
  152. package/dist/types/lib/undo/transaction/MutationUndo.d.ts +57 -0
  153. package/dist/types/lib/undo/transaction/MutationUndo.d.ts.map +1 -0
  154. package/dist/types/lib/undo/transaction/ObjectMutationObserver.d.ts +79 -0
  155. package/dist/types/lib/undo/transaction/ObjectMutationObserver.d.ts.map +1 -0
  156. package/dist/types/lib/undo/transaction/TextMutationObserver.d.ts +60 -0
  157. package/dist/types/lib/undo/transaction/TextMutationObserver.d.ts.map +1 -0
  158. package/dist/types/lib/undo/transaction/TransactionManager.d.ts +148 -0
  159. package/dist/types/lib/undo/transaction/TransactionManager.d.ts.map +1 -0
  160. package/dist/types/lib/undo/transaction/index.d.ts +17 -0
  161. package/dist/types/lib/undo/transaction/index.d.ts.map +1 -0
  162. package/dist/types/lib/undo/transaction/types.d.ts +269 -0
  163. package/dist/types/lib/undo/transaction/types.d.ts.map +1 -0
  164. package/dist/types/lib/utils/blob-utils.d.ts +2 -0
  165. package/dist/types/lib/utils/blob-utils.d.ts.map +1 -0
  166. package/package.json +88 -0
@@ -0,0 +1,239 @@
1
+ /**
2
+ * Table-related type definitions for embedded table objects.
3
+ */
4
+ import { BorderSide, EmbeddedObjectConfig, EmbeddedObjectData } from '../types';
5
+ import { TextFormattingStyle } from '../../text/types';
6
+ import type { TableCell } from './TableCell';
7
+ /**
8
+ * Vertical alignment within a cell.
9
+ */
10
+ export type VerticalAlign = 'top' | 'middle' | 'bottom';
11
+ /**
12
+ * Cell border configuration (per-side).
13
+ */
14
+ export interface CellBorder {
15
+ top: BorderSide;
16
+ right: BorderSide;
17
+ bottom: BorderSide;
18
+ left: BorderSide;
19
+ }
20
+ /**
21
+ * Cell padding configuration.
22
+ */
23
+ export interface CellPadding {
24
+ top: number;
25
+ right: number;
26
+ bottom: number;
27
+ left: number;
28
+ }
29
+ /**
30
+ * Configuration for creating a table cell.
31
+ */
32
+ export interface TableCellConfig {
33
+ id?: string;
34
+ rowSpan?: number;
35
+ colSpan?: number;
36
+ backgroundColor?: string;
37
+ border?: Partial<CellBorder>;
38
+ padding?: number | Partial<CellPadding>;
39
+ verticalAlign?: VerticalAlign;
40
+ content?: string;
41
+ fontFamily?: string;
42
+ fontSize?: number;
43
+ color?: string;
44
+ }
45
+ /**
46
+ * Serialized cell data for persistence.
47
+ */
48
+ export interface TableCellData {
49
+ id: string;
50
+ rowSpan: number;
51
+ colSpan: number;
52
+ backgroundColor: string;
53
+ border: CellBorder;
54
+ padding: CellPadding;
55
+ verticalAlign: VerticalAlign;
56
+ content: string;
57
+ fontFamily: string;
58
+ fontSize: number;
59
+ color: string;
60
+ formattingRuns?: Array<[number, Partial<TextFormattingStyle>]>;
61
+ substitutionFields?: Array<unknown>;
62
+ }
63
+ /**
64
+ * Row configuration for creating a table row.
65
+ */
66
+ export interface TableRowConfig {
67
+ id?: string;
68
+ height?: number | null;
69
+ minHeight?: number;
70
+ isHeader?: boolean;
71
+ cells?: TableCellConfig[];
72
+ }
73
+ /**
74
+ * Serialized row data for persistence.
75
+ */
76
+ export interface TableRowData {
77
+ id: string;
78
+ height: number | null;
79
+ minHeight: number;
80
+ isHeader: boolean;
81
+ cells: TableCellData[];
82
+ }
83
+ /**
84
+ * Column configuration.
85
+ */
86
+ export interface TableColumnConfig {
87
+ id?: string;
88
+ width: number;
89
+ minWidth?: number;
90
+ isHeader?: boolean;
91
+ }
92
+ /**
93
+ * Configuration for creating a table object.
94
+ */
95
+ export interface TableObjectConfig extends EmbeddedObjectConfig {
96
+ rows?: number;
97
+ columns?: number;
98
+ columnWidths?: number[];
99
+ rowData?: TableRowConfig[];
100
+ columnConfig?: TableColumnConfig[];
101
+ defaultCellPadding?: number;
102
+ defaultBorderColor?: string;
103
+ defaultBorderWidth?: number;
104
+ defaultFontFamily?: string;
105
+ defaultFontSize?: number;
106
+ defaultColor?: string;
107
+ }
108
+ /**
109
+ * Configuration for a table row loop.
110
+ * Defines which rows should be repeated for each item in an array during merge.
111
+ */
112
+ export interface TableRowLoop {
113
+ id: string;
114
+ fieldPath: string;
115
+ startRowIndex: number;
116
+ endRowIndex: number;
117
+ }
118
+ /**
119
+ * Serialized loop data for persistence.
120
+ */
121
+ export interface TableRowLoopData {
122
+ id: string;
123
+ fieldPath: string;
124
+ startRowIndex: number;
125
+ endRowIndex: number;
126
+ }
127
+ /**
128
+ * Serialized table data for persistence.
129
+ */
130
+ export interface TableObjectData extends EmbeddedObjectData {
131
+ objectType: 'table';
132
+ data: {
133
+ columns: TableColumnConfig[];
134
+ rows: TableRowData[];
135
+ rowLoops?: TableRowLoopData[];
136
+ defaultCellPadding: number;
137
+ defaultBorderColor: string;
138
+ defaultBorderWidth: number;
139
+ defaultFontFamily: string;
140
+ defaultFontSize: number;
141
+ defaultColor: string;
142
+ };
143
+ }
144
+ /**
145
+ * Cell address for identifying cells.
146
+ */
147
+ export interface CellAddress {
148
+ row: number;
149
+ col: number;
150
+ }
151
+ /**
152
+ * Cell range for selection/operations.
153
+ */
154
+ export interface CellRange {
155
+ start: CellAddress;
156
+ end: CellAddress;
157
+ }
158
+ /**
159
+ * Result of resolving a cell (handles merged cells).
160
+ */
161
+ export interface ResolvedCell {
162
+ cell: TableCell;
163
+ rowIndex: number;
164
+ colIndex: number;
165
+ isSpanned: boolean;
166
+ }
167
+ /**
168
+ * Default table styling values.
169
+ */
170
+ export declare const DEFAULT_TABLE_STYLE: {
171
+ cellPadding: number;
172
+ borderColor: string;
173
+ borderWidth: number;
174
+ fontFamily: string;
175
+ fontSize: number;
176
+ color: string;
177
+ backgroundColor: string;
178
+ minColumnWidth: number;
179
+ minRowHeight: number;
180
+ defaultColumnWidth: number;
181
+ defaultRowHeight: null;
182
+ };
183
+ /**
184
+ * Default border side for table cells.
185
+ */
186
+ export declare const DEFAULT_CELL_BORDER_SIDE: BorderSide;
187
+ /**
188
+ * Create a full cell border from partial config.
189
+ */
190
+ export declare function createCellBorder(partial?: Partial<CellBorder>, defaultSide?: BorderSide): CellBorder;
191
+ /**
192
+ * Create cell padding from number or partial config.
193
+ */
194
+ export declare function createCellPadding(padding?: number | Partial<CellPadding>, defaultPadding?: number): CellPadding;
195
+ /**
196
+ * Calculate total horizontal padding.
197
+ */
198
+ export declare function getHorizontalPadding(padding: CellPadding): number;
199
+ /**
200
+ * Calculate total vertical padding.
201
+ */
202
+ export declare function getVerticalPadding(padding: CellPadding): number;
203
+ /**
204
+ * Calculate total horizontal border width.
205
+ */
206
+ export declare function getHorizontalBorderWidth(border: CellBorder): number;
207
+ /**
208
+ * Calculate total vertical border width.
209
+ */
210
+ export declare function getVerticalBorderWidth(border: CellBorder): number;
211
+ /**
212
+ * Describes which rows of a table appear on a specific page.
213
+ */
214
+ export interface TablePageSlice {
215
+ /** Starting row index (inclusive) for data rows on this page */
216
+ startRow: number;
217
+ /** Ending row index (exclusive) for data rows on this page */
218
+ endRow: number;
219
+ /** Whether this is a continuation page (header rows should be repeated) */
220
+ isContinuation: boolean;
221
+ /** Height of this slice (including repeated headers if continuation) */
222
+ height: number;
223
+ /** Y offset within the table where this slice starts */
224
+ yOffset: number;
225
+ }
226
+ /**
227
+ * Complete layout information for a table spanning multiple pages.
228
+ */
229
+ export interface TablePageLayout {
230
+ /** Array of page slices, one per page the table spans */
231
+ slices: TablePageSlice[];
232
+ /** Total height if the table were rendered on a single page */
233
+ totalHeight: number;
234
+ /** Height of header rows (to be repeated on continuation pages) */
235
+ headerHeight: number;
236
+ /** Indices of header rows */
237
+ headerRowIndices: number[];
238
+ }
239
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/objects/table/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAExD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AAE,UAItC,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,EAAE,UAAU,GAAG,UAAU,CAQpG;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,WAAW,CAW/G;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAEjE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAE/D;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAInE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAIjE;AAMD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,cAAc,EAAE,OAAO,CAAC;IACxB,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Object-related type definitions for embedded objects in text flow.
3
+ */
4
+ /**
5
+ * Position type for objects within text flow.
6
+ * - inline: Within text flow, affects line height
7
+ * - block: Standalone paragraph with implicit newlines before and after
8
+ * - relative: Free position relative to anchor point in text
9
+ *
10
+ * Note: Tables only support 'block' positioning.
11
+ */
12
+ export type ObjectPosition = 'inline' | 'block' | 'relative';
13
+ /**
14
+ * Offset for relative-positioned objects.
15
+ * Position is relative to the top-left of the anchor line.
16
+ */
17
+ export interface RelativeOffset {
18
+ x: number;
19
+ y: number;
20
+ }
21
+ /**
22
+ * Resize handle positions.
23
+ */
24
+ export type ResizeHandle = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w';
25
+ /**
26
+ * Basic size type.
27
+ */
28
+ export interface Size {
29
+ width: number;
30
+ height: number;
31
+ }
32
+ /**
33
+ * Basic point type.
34
+ */
35
+ export interface Point {
36
+ x: number;
37
+ y: number;
38
+ }
39
+ /**
40
+ * Basic rectangle type.
41
+ */
42
+ export interface Rect {
43
+ x: number;
44
+ y: number;
45
+ width: number;
46
+ height: number;
47
+ }
48
+ /**
49
+ * Configuration for creating an embedded object.
50
+ */
51
+ export interface EmbeddedObjectConfig {
52
+ id: string;
53
+ textIndex: number;
54
+ position?: ObjectPosition;
55
+ size: Size;
56
+ relativeOffset?: RelativeOffset;
57
+ }
58
+ /**
59
+ * Serialized data for an embedded object.
60
+ */
61
+ export interface EmbeddedObjectData {
62
+ id: string;
63
+ objectType: string;
64
+ textIndex: number;
65
+ position: ObjectPosition;
66
+ size: Size;
67
+ data: Record<string, unknown>;
68
+ relativeOffset?: RelativeOffset;
69
+ }
70
+ /**
71
+ * Configuration specific to image objects.
72
+ */
73
+ export interface ImageObjectConfig extends EmbeddedObjectConfig {
74
+ src: string;
75
+ fit?: ImageFitMode;
76
+ resizeMode?: ImageResizeMode;
77
+ alt?: string;
78
+ naturalWidth?: number;
79
+ naturalHeight?: number;
80
+ }
81
+ /**
82
+ * Border style options.
83
+ */
84
+ export type BorderStyle = 'solid' | 'dashed' | 'dotted' | 'none';
85
+ /**
86
+ * Configuration for a single border side.
87
+ */
88
+ export interface BorderSide {
89
+ width: number;
90
+ color: string;
91
+ style: BorderStyle;
92
+ }
93
+ /**
94
+ * Full border configuration with per-side control.
95
+ */
96
+ export interface TextBoxBorder {
97
+ top: BorderSide;
98
+ right: BorderSide;
99
+ bottom: BorderSide;
100
+ left: BorderSide;
101
+ }
102
+ /**
103
+ * Default border side values.
104
+ */
105
+ export declare const DEFAULT_BORDER_SIDE: BorderSide;
106
+ /**
107
+ * Configuration specific to text box objects.
108
+ */
109
+ export interface TextBoxObjectConfig extends EmbeddedObjectConfig {
110
+ content?: string;
111
+ fontFamily?: string;
112
+ fontSize?: number;
113
+ color?: string;
114
+ backgroundColor?: string;
115
+ /** @deprecated Use border instead */
116
+ borderColor?: string;
117
+ border?: Partial<TextBoxBorder>;
118
+ padding?: number;
119
+ }
120
+ /**
121
+ * Image fit modes - how the image content displays within its bounding box.
122
+ * - contain: Fit image within bounds, preserving aspect ratio (letterboxed)
123
+ * - cover: Fill bounds, preserving aspect ratio (may crop)
124
+ * - fill: Stretch to fill (distorts if aspect ratios differ)
125
+ * - none: Original size, centered
126
+ * - tile: Repeat image to fill bounds
127
+ */
128
+ export type ImageFitMode = 'contain' | 'cover' | 'fill' | 'none' | 'tile';
129
+ /**
130
+ * Image resize modes - how the bounding box resizes when user drags handles.
131
+ * - free: Width and height can be changed independently
132
+ * - locked-aspect-ratio: Resizing preserves the original aspect ratio
133
+ */
134
+ export type ImageResizeMode = 'free' | 'locked-aspect-ratio';
135
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/objects/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG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,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,WAAW,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,UAIjC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1E;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,qBAAqB,CAAC"}
@@ -0,0 +1,282 @@
1
+ import { Document } from '../core/Document';
2
+ import { EditorOptions, Point, PageDimensions, EditingSection } from '../types';
3
+ import { EventEmitter } from '../events/EventEmitter';
4
+ import { TextBoxObject, BaseEmbeddedObject } from '../objects';
5
+ import { Focusable, FlowedPage } from '../text/types';
6
+ import { FlowingTextContent } from '../text';
7
+ export declare class CanvasManager extends EventEmitter {
8
+ private container;
9
+ private document;
10
+ private options;
11
+ private canvases;
12
+ private contexts;
13
+ private zoomLevel;
14
+ private selectedElements;
15
+ private isDragging;
16
+ private dragStart;
17
+ private isResizing;
18
+ private wasResizing;
19
+ private resizeHandle;
20
+ private resizeStartSize;
21
+ private resizeStartPos;
22
+ private resizingElementId;
23
+ private flowingTextRenderer;
24
+ private showMargins;
25
+ private isHandlingOverflow;
26
+ private isSelectingText;
27
+ private textSelectionStartPageId;
28
+ private selectedSectionId;
29
+ private _activeSection;
30
+ private lastClickTime;
31
+ private lastClickPosition;
32
+ private clickCount;
33
+ private editingTextBox;
34
+ private _editingTextBoxPageId;
35
+ private _focusedControl;
36
+ private _cursorSuspended;
37
+ private isSelectingTextInTextBox;
38
+ private regionManager;
39
+ private tableResizeHandler;
40
+ private isSelectingTableCells;
41
+ private tableCellSelectionPending;
42
+ private tableCellSelectionStart;
43
+ private tableCellSelectionStartPoint;
44
+ private tableCellSelectionTable;
45
+ private isSelectingTextInTableCell;
46
+ private static readonly CELL_SELECTION_THRESHOLD;
47
+ private isDraggingRelativeObject;
48
+ private relativeObjectDragPending;
49
+ private relativeObjectDragStart;
50
+ private relativeObjectBeingDragged;
51
+ private relativeObjectDragStartOffset;
52
+ private static readonly RELATIVE_DRAG_THRESHOLD;
53
+ constructor(container: HTMLElement, document: Document, options: Required<Omit<EditorOptions, 'customPageSize'>> & {
54
+ customPageSize?: PageDimensions;
55
+ });
56
+ /**
57
+ * Initialize text regions from the document.
58
+ */
59
+ private initializeRegions;
60
+ initialize(): void;
61
+ private createCanvases;
62
+ setDocument(document: Document): void;
63
+ private clearCanvases;
64
+ render(): void;
65
+ /**
66
+ * Draw transparent white overlays on inactive sections.
67
+ * Overlays span the full page width.
68
+ */
69
+ private drawInactiveSectionOverlays;
70
+ private drawGrid;
71
+ private renderPageElements;
72
+ /**
73
+ * Render selection marks (resize handles) for selected embedded objects.
74
+ * Called separately to ensure selection marks are drawn on top of all other content.
75
+ */
76
+ private renderSelectionMarks;
77
+ private drawBaseEmbeddedObjectResizeHandles;
78
+ private getResizeHandles;
79
+ private setupEventListeners;
80
+ private handleMouseDown;
81
+ private handleMouseMove;
82
+ private handleMouseUp;
83
+ private handleMouseLeave;
84
+ private handleClick;
85
+ /**
86
+ * Get the EditableTextRegion for the currently active section.
87
+ */
88
+ private getRegionForActiveSection;
89
+ /**
90
+ * Get the FlowingTextContent for the currently active section.
91
+ */
92
+ getFlowingContentForActiveSection(): FlowingTextContent | null;
93
+ private getMousePosition;
94
+ /**
95
+ * Get mouse position relative to the scroll container viewport.
96
+ * Used for ruler mouse tracking.
97
+ */
98
+ private getViewportMousePosition;
99
+ private getResizeHandleAt;
100
+ private getSelectedElementAt;
101
+ private calculateNewSize;
102
+ private updateCursor;
103
+ /**
104
+ * Get table resize handle at a point, if any.
105
+ * Uses HitTestManager to find registered table dividers.
106
+ */
107
+ private getTableResizeHandleAt;
108
+ removeEmbeddedObject(objectId: string): void;
109
+ selectElement(elementId: string): void;
110
+ /**
111
+ * Find an embedded object by ID across all flowing content sources.
112
+ */
113
+ private findEmbeddedObjectById;
114
+ /**
115
+ * Update resize handle hit targets based on current selection.
116
+ * Call this whenever selection changes.
117
+ */
118
+ private updateResizeHandleHitTargets;
119
+ clearSelection(): void;
120
+ /**
121
+ * Get the IDs of all currently selected elements.
122
+ */
123
+ getSelectedElements(): string[];
124
+ /**
125
+ * Check if there are any selected elements.
126
+ */
127
+ hasSelectedElements(): boolean;
128
+ selectBaseEmbeddedObject(embeddedObject: any, isPartOfRangeSelection?: boolean): void;
129
+ /**
130
+ * @deprecated Use selectBaseEmbeddedObject instead
131
+ */
132
+ selectInlineElement(inlineElement: any): void;
133
+ getBaseEmbeddedObjectAtPoint(point: Point, _pageId: string): BaseEmbeddedObject | null;
134
+ /**
135
+ * Get the current zoom level.
136
+ */
137
+ getZoom(): number;
138
+ /**
139
+ * Get the current scroll position of the editor viewport.
140
+ */
141
+ getScrollPosition(): {
142
+ x: number;
143
+ y: number;
144
+ };
145
+ /**
146
+ * Get the offset of the document content within the viewport.
147
+ * This is where the first page starts relative to the scroll viewport.
148
+ */
149
+ getContentOffset(): {
150
+ x: number;
151
+ y: number;
152
+ };
153
+ /**
154
+ * Find the scrollable container element.
155
+ */
156
+ private findScrollContainer;
157
+ /**
158
+ * Set up scroll event forwarding.
159
+ */
160
+ setupScrollListener(): void;
161
+ zoomIn(): void;
162
+ zoomOut(): void;
163
+ setZoom(level: number): void;
164
+ private updateCanvasScale;
165
+ fitToWidth(): void;
166
+ fitToPage(): void;
167
+ private setupFlowingTextListeners;
168
+ private handleTextOverflow;
169
+ private createNewPage;
170
+ showTextCursor(): void;
171
+ hideTextCursor(): void;
172
+ /**
173
+ * Suspend the cursor (stop blinking) without clearing focus.
174
+ * Used when the editor loses browser focus but we want to preserve selection.
175
+ */
176
+ suspendCursor(): void;
177
+ /**
178
+ * Resume the cursor after it was suspended.
179
+ * Used when the editor regains browser focus.
180
+ */
181
+ resumeCursor(): void;
182
+ /**
183
+ * Check if cursor is currently suspended.
184
+ */
185
+ isCursorSuspended(): boolean;
186
+ /**
187
+ * Move cursor vertically by visual lines, maintaining X position.
188
+ * Returns the new text index, or null if can't move.
189
+ */
190
+ moveCursorVertical(direction: -1 | 1): number | null;
191
+ private drawMarginLines;
192
+ checkForEmptyPages(): void;
193
+ /**
194
+ * Set whether control characters are shown.
195
+ */
196
+ setShowControlCharacters(show: boolean): void;
197
+ /**
198
+ * Set whether the grid is shown.
199
+ */
200
+ setShowGrid(show: boolean): void;
201
+ /**
202
+ * Get whether the grid is shown.
203
+ */
204
+ getShowGrid(): boolean;
205
+ /**
206
+ * Set whether margin lines are shown.
207
+ */
208
+ setShowMarginLines(show: boolean): void;
209
+ /**
210
+ * Get whether margin lines are shown.
211
+ */
212
+ getShowMarginLines(): boolean;
213
+ /**
214
+ * Get the currently active editing section.
215
+ */
216
+ getActiveSection(): EditingSection;
217
+ /**
218
+ * Set the active editing section.
219
+ * This changes which section receives keyboard input and cursor positioning.
220
+ * Uses the unified focus system for cursor blink management.
221
+ */
222
+ setActiveSection(section: EditingSection): void;
223
+ /**
224
+ * Detect which section a point is in based on Y coordinate.
225
+ * Uses full page width areas (not just content bounds).
226
+ */
227
+ private getSectionAtPoint;
228
+ /**
229
+ * Handle double-click to select word or enter text box/table editing.
230
+ */
231
+ private handleDoubleClick;
232
+ /**
233
+ * Handle triple-click to select paragraph.
234
+ */
235
+ private handleTripleClick;
236
+ /**
237
+ * Set the currently editing text box.
238
+ * Uses the unified focus system internally.
239
+ */
240
+ setEditingTextBox(textBox: TextBoxObject | null, pageId?: string): void;
241
+ /**
242
+ * Get the currently editing text box.
243
+ */
244
+ getEditingTextBox(): TextBoxObject | null;
245
+ /**
246
+ * Check if a text box is currently being edited.
247
+ */
248
+ isEditingTextBox(): boolean;
249
+ /**
250
+ * Get the page ID where text box is being edited.
251
+ */
252
+ getEditingTextBoxPageId(): string | null;
253
+ /**
254
+ * Get the canvas rendering context for a page.
255
+ */
256
+ getContext(pageId: string): CanvasRenderingContext2D | null;
257
+ /**
258
+ * Set the currently focused control.
259
+ * Handles blurring the previous control and focusing the new one.
260
+ * Also manages cursor blink subscriptions for re-rendering.
261
+ */
262
+ setFocus(control: Focusable | null): void;
263
+ /**
264
+ * Get the currently focused control.
265
+ */
266
+ getFocusedControl(): Focusable | null;
267
+ /**
268
+ * Get a snapshot of all flowed content for PDF export.
269
+ */
270
+ getFlowedPagesSnapshot(): {
271
+ body: FlowedPage[];
272
+ header: FlowedPage | null;
273
+ footer: FlowedPage | null;
274
+ };
275
+ /**
276
+ * Handler for cursor blink events from the focused control.
277
+ * Triggers a re-render to update cursor visibility.
278
+ */
279
+ private handleFocusedCursorBlink;
280
+ destroy(): void;
281
+ }
282
+ //# sourceMappingURL=CanvasManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CanvasManager.d.ts","sourceRoot":"","sources":["../../../../src/lib/rendering/CanvasManager.ts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