@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,97 @@
1
+ import { EventEmitter } from '../events/EventEmitter';
2
+ import { BaseEmbeddedObject, ObjectPosition } from '../objects';
3
+ /**
4
+ * Entry for an embedded object in the manager.
5
+ */
6
+ export interface EmbeddedObjectEntry {
7
+ object: BaseEmbeddedObject;
8
+ textIndex: number;
9
+ }
10
+ /**
11
+ * Manages embedded objects within text content.
12
+ * Handles insertion, removal, and position shifting when text changes.
13
+ */
14
+ export declare class EmbeddedObjectManager extends EventEmitter {
15
+ private objects;
16
+ constructor();
17
+ /**
18
+ * Get all embedded objects.
19
+ */
20
+ getObjects(): Map<number, BaseEmbeddedObject>;
21
+ /**
22
+ * Get all embedded objects as an array, sorted by text index.
23
+ */
24
+ getObjectsArray(): EmbeddedObjectEntry[];
25
+ /**
26
+ * Get the embedded object at a specific text index.
27
+ */
28
+ getObjectAt(textIndex: number): BaseEmbeddedObject | undefined;
29
+ /**
30
+ * Get all embedded objects within a range.
31
+ */
32
+ getObjectsInRange(start: number, end: number): EmbeddedObjectEntry[];
33
+ /**
34
+ * Check if there's an embedded object at the given text index.
35
+ */
36
+ hasObjectAt(textIndex: number): boolean;
37
+ /**
38
+ * Insert an embedded object at a specific text index.
39
+ * Note: The caller is responsible for inserting the placeholder character.
40
+ */
41
+ insert(object: BaseEmbeddedObject, textIndex: number): void;
42
+ /**
43
+ * Remove an embedded object at a specific text index.
44
+ * Note: The caller is responsible for removing the placeholder character.
45
+ */
46
+ remove(textIndex: number): BaseEmbeddedObject | undefined;
47
+ /**
48
+ * Shift all object positions when text is inserted.
49
+ * @param fromIndex The position where text was inserted
50
+ * @param delta The number of characters inserted (positive)
51
+ */
52
+ shiftObjects(fromIndex: number, delta: number): void;
53
+ /**
54
+ * Handle deletion of text range.
55
+ * Objects within the deleted range are removed.
56
+ * Objects after the range are shifted.
57
+ * @returns Array of removed objects
58
+ */
59
+ handleDeletion(start: number, length: number): BaseEmbeddedObject[];
60
+ /**
61
+ * Get the count of embedded objects.
62
+ */
63
+ get count(): number;
64
+ /**
65
+ * Check if there are any embedded objects.
66
+ */
67
+ get isEmpty(): boolean;
68
+ /**
69
+ * Clear all embedded objects.
70
+ */
71
+ clear(): void;
72
+ /**
73
+ * Get all object IDs.
74
+ */
75
+ getObjectIds(): string[];
76
+ /**
77
+ * Find an embedded object by its ID.
78
+ */
79
+ findById(objectId: string): EmbeddedObjectEntry | undefined;
80
+ /**
81
+ * Find all embedded objects of a specific type.
82
+ */
83
+ findByType(objectType: string): EmbeddedObjectEntry[];
84
+ /**
85
+ * Update an object's position mode.
86
+ */
87
+ updatePosition(textIndex: number, position: ObjectPosition): boolean;
88
+ /**
89
+ * Deselect all objects.
90
+ */
91
+ deselectAll(): void;
92
+ /**
93
+ * Get the currently selected object (if any).
94
+ */
95
+ getSelectedObject(): EmbeddedObjectEntry | undefined;
96
+ }
97
+ //# sourceMappingURL=EmbeddedObjectManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmbeddedObjectManager.d.ts","sourceRoot":"","sources":["../../../../src/lib/text/EmbeddedObjectManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IACrD,OAAO,CAAC,OAAO,CAA8C;;IAM7D;;OAEG;IACH,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAI7C;;OAEG;IACH,eAAe,IAAI,mBAAmB,EAAE;IAMxC;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAI9D;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,EAAE;IAUpE;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIvC;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAkB3D;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAUzD;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IA+BpD;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAwCnE;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;IAQb;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE;IAIxB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAS3D;;OAEG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,EAAE;IAUrD;;OAEG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO;IAUpE;;OAEG;IACH,WAAW,IAAI,IAAI;IAQnB;;OAEG;IACH,iBAAiB,IAAI,mBAAmB,GAAG,SAAS;CAQrD"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * FieldFormatter - Formats field values based on format configuration.
3
+ *
4
+ * Provides formatting for:
5
+ * - Numbers (integer, decimal, thousands, percent, scientific)
6
+ * - Currency (USD, EUR, GBP, JPY, custom)
7
+ * - Dates (various presets using Intl.DateTimeFormat)
8
+ */
9
+ import type { FieldFormatConfig } from './types';
10
+ /**
11
+ * Format a value according to the provided format configuration.
12
+ *
13
+ * @param value - The raw value to format
14
+ * @param config - Format configuration specifying how to format the value
15
+ * @returns Formatted string representation of the value
16
+ */
17
+ export declare function formatFieldValue(value: unknown, config?: FieldFormatConfig): string;
18
+ /**
19
+ * Check if a format config requires markdown processing.
20
+ */
21
+ export declare function isMarkdownFormat(config?: FieldFormatConfig): boolean;
22
+ /**
23
+ * Get display text for a format config (for UI purposes).
24
+ */
25
+ export declare function getFormatDisplayName(config?: FieldFormatConfig): string;
26
+ //# sourceMappingURL=FieldFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldFormatter.d.ts","sourceRoot":"","sources":["../../../../src/lib/text/FieldFormatter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,iBAAiB,EAIlB,MAAM,SAAS,CAAC;AAiBjB;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,CA0BnF;AAmMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAEpE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAuBvE"}
@@ -0,0 +1,571 @@
1
+ import { EventEmitter } from '../events/EventEmitter';
2
+ import { TextState } from './TextState';
3
+ import { TextFormattingManager } from './TextFormatting';
4
+ import { ParagraphFormattingManager } from './ParagraphFormatting';
5
+ import { SubstitutionFieldManager } from './SubstitutionFieldManager';
6
+ import { EmbeddedObjectManager } from './EmbeddedObjectManager';
7
+ import { RepeatingSectionManager } from './RepeatingSectionManager';
8
+ import { HyperlinkManager, Hyperlink, HyperlinkOptions, HyperlinkUpdate } from './HyperlinkManager';
9
+ import { TextLayout } from './TextLayout';
10
+ import { TextFormattingStyle, TextAlignment, SubstitutionField, SubstitutionFieldConfig, FlowedPage, RepeatingSection, ObjectPosition, Focusable } from './types';
11
+ import { BaseEmbeddedObject } from '../objects';
12
+ import { FlowingTextContentData } from '../types';
13
+ export type { TextRun, SubstitutionField, RepeatingSection, FlowedLine, FlowedPage, ObjectPosition, TextAlignment } from './types';
14
+ export type { TextFormattingStyle as TextFormatting } from './types';
15
+ /**
16
+ * Facade for flowing text content management.
17
+ * Coordinates text state, formatting, substitution fields, embedded objects, and layout.
18
+ * Implements Focusable for unified focus management.
19
+ */
20
+ export declare class FlowingTextContent extends EventEmitter implements Focusable {
21
+ private textState;
22
+ private formatting;
23
+ private paragraphFormatting;
24
+ private substitutionFields;
25
+ private embeddedObjects;
26
+ private repeatingSections;
27
+ private hyperlinks;
28
+ private layout;
29
+ private _hasFocus;
30
+ private _cursorBlinkTimer;
31
+ private _cursorVisible;
32
+ private _cursorBlinkHandlers;
33
+ constructor(initialContent?: string);
34
+ /**
35
+ * Set up the callback for cursor skipping over substitution fields.
36
+ */
37
+ private setupFieldCheckCallback;
38
+ /**
39
+ * Set up event forwarding from sub-components.
40
+ */
41
+ private setupEventForwarding;
42
+ /**
43
+ * Get the current text content.
44
+ */
45
+ getText(): string;
46
+ /**
47
+ * Set the entire text content.
48
+ */
49
+ setText(text: string): void;
50
+ /**
51
+ * Insert text at a position or at the cursor.
52
+ */
53
+ insertText(text: string, position?: number): void;
54
+ /**
55
+ * Insert a page break at the cursor position.
56
+ */
57
+ insertPageBreak(): void;
58
+ /**
59
+ * Delete text from a range.
60
+ * @param start The starting position
61
+ * @param length The number of characters to delete
62
+ * @param isBackspace Whether this is a backspace deletion (vs forward delete)
63
+ */
64
+ deleteText(start: number, length: number, isBackspace?: boolean): void;
65
+ /**
66
+ * Insert text at a specific position (for undo/redo commands).
67
+ * This method inserts text without moving the cursor or affecting pending formatting.
68
+ */
69
+ insertTextAt(position: number, text: string): void;
70
+ /**
71
+ * Delete text at a specific position (for undo/redo commands).
72
+ * This method deletes text without moving the cursor.
73
+ */
74
+ deleteTextAt(position: number, length: number): void;
75
+ /**
76
+ * Get the current cursor position.
77
+ */
78
+ getCursorPosition(): number;
79
+ /**
80
+ * Set the cursor position.
81
+ * Clears pending formatting since this is explicit cursor navigation.
82
+ */
83
+ setCursorPosition(position: number): void;
84
+ /**
85
+ * Move cursor left, skipping over substitution fields.
86
+ * Clears pending formatting since this is explicit cursor navigation.
87
+ */
88
+ moveCursorLeft(): void;
89
+ /**
90
+ * Move cursor right, skipping over substitution fields.
91
+ * Clears pending formatting since this is explicit cursor navigation.
92
+ */
93
+ moveCursorRight(): void;
94
+ /**
95
+ * Get the current text selection range.
96
+ */
97
+ getSelection(): {
98
+ start: number;
99
+ end: number;
100
+ } | null;
101
+ /**
102
+ * Set the selection anchor point.
103
+ * Call this when starting a selection (e.g., mouse down).
104
+ */
105
+ setSelectionAnchor(position?: number): void;
106
+ /**
107
+ * Check if there is an active text selection.
108
+ */
109
+ hasSelection(): boolean;
110
+ /**
111
+ * Check if the selection anchor is set (even if cursor equals anchor).
112
+ */
113
+ hasSelectionAnchor(): boolean;
114
+ /**
115
+ * Clear the current text selection.
116
+ */
117
+ clearSelection(): void;
118
+ /**
119
+ * Set a selection range.
120
+ * Sets the anchor at start and cursor at end.
121
+ */
122
+ setSelection(start: number, end: number): void;
123
+ /**
124
+ * Get the selected text content.
125
+ */
126
+ getSelectedText(): string;
127
+ /**
128
+ * Delete the selected text.
129
+ */
130
+ deleteSelection(): boolean;
131
+ /**
132
+ * Replace the selected text with new text.
133
+ * This is a compound operation that will be undone as a single action.
134
+ */
135
+ replaceSelection(text: string): void;
136
+ /**
137
+ * Signal the start of a compound operation (for undo grouping).
138
+ */
139
+ beginCompoundOperation(description?: string): void;
140
+ /**
141
+ * Signal the end of a compound operation (for undo grouping).
142
+ */
143
+ endCompoundOperation(): void;
144
+ /**
145
+ * Move cursor left while extending selection (shift+left).
146
+ */
147
+ selectLeft(): void;
148
+ /**
149
+ * Move cursor right while extending selection (shift+right).
150
+ */
151
+ selectRight(): void;
152
+ /**
153
+ * Select the word at the current cursor position.
154
+ */
155
+ selectWord(): void;
156
+ /**
157
+ * Select the paragraph at the current cursor position.
158
+ */
159
+ selectParagraph(): void;
160
+ /**
161
+ * Select all text content.
162
+ */
163
+ selectAll(): void;
164
+ /**
165
+ * Get word boundaries at a position.
166
+ */
167
+ getWordBoundaries(position: number): {
168
+ start: number;
169
+ end: number;
170
+ };
171
+ /**
172
+ * Get paragraph boundaries at a position.
173
+ */
174
+ getParagraphBoundariesAt(position: number): {
175
+ start: number;
176
+ end: number;
177
+ };
178
+ /**
179
+ * Move cursor to the start of the current line.
180
+ */
181
+ moveCursorToLineStart(): void;
182
+ /**
183
+ * Move cursor to the end of the current line.
184
+ */
185
+ moveCursorToLineEnd(): void;
186
+ /**
187
+ * Move cursor to the start of the document.
188
+ */
189
+ moveCursorToDocumentStart(): void;
190
+ /**
191
+ * Move cursor to the end of the document.
192
+ */
193
+ moveCursorToDocumentEnd(): void;
194
+ /**
195
+ * Select from current cursor to line start.
196
+ */
197
+ selectToLineStart(): void;
198
+ /**
199
+ * Select from current cursor to line end.
200
+ */
201
+ selectToLineEnd(): void;
202
+ /**
203
+ * Select from current cursor to document start.
204
+ */
205
+ selectToDocumentStart(): void;
206
+ /**
207
+ * Select from current cursor to document end.
208
+ */
209
+ selectToDocumentEnd(): void;
210
+ /**
211
+ * Move cursor to the start of the previous word.
212
+ */
213
+ moveCursorWordLeft(): void;
214
+ /**
215
+ * Move cursor to the start of the next word.
216
+ */
217
+ moveCursorWordRight(): void;
218
+ /**
219
+ * Select word left from current position.
220
+ */
221
+ selectWordLeft(): void;
222
+ /**
223
+ * Select word right from current position.
224
+ */
225
+ selectWordRight(): void;
226
+ /**
227
+ * Get formatting at a specific position.
228
+ */
229
+ getFormattingAt(position: number): TextFormattingStyle;
230
+ /**
231
+ * Apply formatting to a range of text.
232
+ * Also updates any substitution fields within the range.
233
+ */
234
+ applyFormatting(start: number, end: number, formatting: Partial<TextFormattingStyle>): void;
235
+ /**
236
+ * Get the default formatting.
237
+ */
238
+ getDefaultFormatting(): TextFormattingStyle;
239
+ /**
240
+ * Set the default formatting.
241
+ */
242
+ setDefaultFormatting(formatting: Partial<TextFormattingStyle>): void;
243
+ /**
244
+ * Set pending formatting to apply to the next inserted character.
245
+ * Used when formatting is applied with just a cursor (no selection).
246
+ */
247
+ setPendingFormatting(formatting: Partial<TextFormattingStyle>): void;
248
+ /**
249
+ * Get the current pending formatting, if any.
250
+ */
251
+ getPendingFormatting(): Partial<TextFormattingStyle> | null;
252
+ /**
253
+ * Check if there is pending formatting.
254
+ */
255
+ hasPendingFormatting(): boolean;
256
+ /**
257
+ * Clear pending formatting.
258
+ */
259
+ clearPendingFormatting(): void;
260
+ /**
261
+ * Get the effective formatting at cursor, considering pending formatting.
262
+ * If pending formatting exists, merge it with the formatting at cursor position.
263
+ * Otherwise, return the formatting at the position before cursor (or default if at start).
264
+ */
265
+ getEffectiveFormattingAtCursor(): TextFormattingStyle;
266
+ /**
267
+ * Get all substitution fields.
268
+ */
269
+ getSubstitutionFields(): Map<number, SubstitutionField>;
270
+ /**
271
+ * Insert a substitution field at the current cursor position.
272
+ * The field inherits the text formatting at the cursor position.
273
+ */
274
+ insertSubstitutionField(fieldName: string, config?: SubstitutionFieldConfig): SubstitutionField;
275
+ /**
276
+ * Insert a page number field at the current cursor position.
277
+ * @param displayFormat Optional format string (e.g., "Page %d")
278
+ */
279
+ insertPageNumberField(displayFormat?: string): SubstitutionField;
280
+ /**
281
+ * Insert a page count field at the current cursor position.
282
+ * @param displayFormat Optional format string (e.g., "of %d")
283
+ */
284
+ insertPageCountField(displayFormat?: string): SubstitutionField;
285
+ /**
286
+ * Insert a substitution field at a specific text index.
287
+ * Used for paste operations where the text already contains U+FFFC.
288
+ */
289
+ insertSubstitutionFieldAt(fieldName: string, textIndex: number, config?: SubstitutionFieldConfig): SubstitutionField;
290
+ /**
291
+ * Remove a substitution field at a specific text index.
292
+ */
293
+ removeSubstitutionField(textIndex: number): boolean;
294
+ /**
295
+ * Get a substitution field at a specific text index.
296
+ */
297
+ getSubstitutionFieldAt(textIndex: number): SubstitutionField | undefined;
298
+ /**
299
+ * Update a substitution field's configuration.
300
+ */
301
+ updateSubstitutionFieldConfig(textIndex: number, config: Partial<SubstitutionFieldConfig & {
302
+ fieldName?: string;
303
+ }>): boolean;
304
+ /**
305
+ * Get all embedded objects.
306
+ */
307
+ getEmbeddedObjects(): Map<number, BaseEmbeddedObject>;
308
+ /**
309
+ * Get embedded objects within a text index range.
310
+ */
311
+ getEmbeddedObjectsInRange(start: number, end: number): Array<{
312
+ textIndex: number;
313
+ object: BaseEmbeddedObject;
314
+ }>;
315
+ /**
316
+ * Get substitution fields within a text index range.
317
+ */
318
+ getSubstitutionFieldsInRange(start: number, end: number): Array<{
319
+ textIndex: number;
320
+ field: SubstitutionField;
321
+ } & SubstitutionField>;
322
+ /**
323
+ * Insert an embedded object at the current cursor position.
324
+ */
325
+ insertEmbeddedObject(object: BaseEmbeddedObject, position?: ObjectPosition): void;
326
+ /**
327
+ * Insert an embedded object at a specific position (for undo/redo).
328
+ * This doesn't emit the embedded-object-inserted event to avoid duplicate undo entries.
329
+ */
330
+ insertEmbeddedObjectAt(object: BaseEmbeddedObject, textIndex: number, position?: ObjectPosition): void;
331
+ /**
332
+ * Remove an embedded object at a specific text index.
333
+ */
334
+ removeEmbeddedObject(textIndex: number): boolean;
335
+ /**
336
+ * Get an embedded object at a specific text index.
337
+ */
338
+ getEmbeddedObjectAt(textIndex: number): BaseEmbeddedObject | undefined;
339
+ /**
340
+ * Find an embedded object by its ID.
341
+ */
342
+ findEmbeddedObjectById(objectId: string): {
343
+ object: BaseEmbeddedObject;
344
+ textIndex: number;
345
+ } | undefined;
346
+ /**
347
+ * Get the currently selected embedded object.
348
+ */
349
+ getSelectedEmbeddedObject(): {
350
+ object: BaseEmbeddedObject;
351
+ textIndex: number;
352
+ } | undefined;
353
+ /**
354
+ * Deselect all embedded objects.
355
+ */
356
+ deselectAllEmbeddedObjects(): void;
357
+ /**
358
+ * Flow text into pages based on available dimensions.
359
+ * This is the main layout operation.
360
+ */
361
+ flowText(availableWidth: number, availableHeight: number, ctx: CanvasRenderingContext2D): FlowedPage[];
362
+ /**
363
+ * Find the page and line for a given text index.
364
+ */
365
+ findPositionForIndex(pages: FlowedPage[], textIndex: number): {
366
+ pageIndex: number;
367
+ lineIndex: number;
368
+ } | null;
369
+ /**
370
+ * Get the text length.
371
+ */
372
+ get length(): number;
373
+ /**
374
+ * Check if content is empty.
375
+ */
376
+ get isEmpty(): boolean;
377
+ /**
378
+ * Clear all content, formatting, and embedded content.
379
+ */
380
+ clear(): void;
381
+ /**
382
+ * Called when this control receives focus.
383
+ * Starts cursor blinking and prepares for keyboard input.
384
+ */
385
+ focus(): void;
386
+ /**
387
+ * Called when this control loses focus.
388
+ * Stops cursor blinking and hides cursor.
389
+ */
390
+ blur(): void;
391
+ /**
392
+ * Returns whether this control currently has focus.
393
+ */
394
+ hasFocus(): boolean;
395
+ /**
396
+ * Returns whether the cursor should be visible (for rendering).
397
+ */
398
+ isCursorVisible(): boolean;
399
+ /**
400
+ * Handle a keyboard event.
401
+ * @returns true if the event was handled, false otherwise
402
+ */
403
+ handleKeyDown(e: KeyboardEvent): boolean;
404
+ /**
405
+ * Subscribe to cursor blink events (for re-rendering).
406
+ */
407
+ onCursorBlink(handler: () => void): void;
408
+ /**
409
+ * Unsubscribe from cursor blink events.
410
+ */
411
+ offCursorBlink(handler: () => void): void;
412
+ /**
413
+ * Start the cursor blink timer.
414
+ */
415
+ private startCursorBlink;
416
+ /**
417
+ * Stop the cursor blink timer.
418
+ */
419
+ private stopCursorBlink;
420
+ /**
421
+ * Reset cursor blink (e.g., after typing).
422
+ * Makes cursor visible and restarts the blink timer.
423
+ */
424
+ resetCursorBlink(): void;
425
+ /**
426
+ * Get alignment at a specific text position.
427
+ */
428
+ getAlignmentAt(textIndex: number): TextAlignment;
429
+ /**
430
+ * Set alignment for the paragraph at the cursor position.
431
+ */
432
+ setAlignment(alignment: TextAlignment): void;
433
+ /**
434
+ * Set alignment for all paragraphs in a text range.
435
+ */
436
+ setAlignmentForRange(start: number, end: number, alignment: TextAlignment): void;
437
+ /**
438
+ * Get the text state manager.
439
+ */
440
+ getTextState(): TextState;
441
+ /**
442
+ * Get the formatting manager.
443
+ */
444
+ getFormattingManager(): TextFormattingManager;
445
+ /**
446
+ * Get the paragraph formatting manager.
447
+ */
448
+ getParagraphFormattingManager(): ParagraphFormattingManager;
449
+ /**
450
+ * Get the substitution field manager.
451
+ */
452
+ getSubstitutionFieldManager(): SubstitutionFieldManager;
453
+ /**
454
+ * Get the embedded object manager.
455
+ */
456
+ getEmbeddedObjectManager(): EmbeddedObjectManager;
457
+ /**
458
+ * Get the repeating section manager.
459
+ */
460
+ getRepeatingSectionManager(): RepeatingSectionManager;
461
+ /**
462
+ * Get the layout engine.
463
+ */
464
+ getLayoutEngine(): TextLayout;
465
+ /**
466
+ * Get the hyperlink manager.
467
+ */
468
+ getHyperlinkManager(): HyperlinkManager;
469
+ /**
470
+ * Toggle bullet list for the current paragraph (or selection).
471
+ */
472
+ toggleBulletList(): void;
473
+ /**
474
+ * Toggle numbered list for the current paragraph (or selection).
475
+ */
476
+ toggleNumberedList(): void;
477
+ /**
478
+ * Indent the current paragraph (increase list nesting level).
479
+ */
480
+ indentParagraph(): void;
481
+ /**
482
+ * Outdent the current paragraph (decrease list nesting level).
483
+ */
484
+ outdentParagraph(): void;
485
+ /**
486
+ * Get the list formatting for the current paragraph.
487
+ */
488
+ getListFormatting(): import('./types').ListFormatting | undefined;
489
+ /**
490
+ * Insert a hyperlink for the current selection.
491
+ * The selection range is used to define the hyperlink bounds.
492
+ * @returns The created hyperlink, or null if no selection
493
+ */
494
+ insertHyperlink(url: string, options?: HyperlinkOptions): Hyperlink | null;
495
+ /**
496
+ * Insert a hyperlink at a specific range.
497
+ */
498
+ insertHyperlinkAt(url: string, startIndex: number, endIndex: number, options?: HyperlinkOptions): Hyperlink;
499
+ /**
500
+ * Remove a hyperlink by ID.
501
+ */
502
+ removeHyperlink(id: string): void;
503
+ /**
504
+ * Update a hyperlink's properties.
505
+ */
506
+ updateHyperlink(id: string, updates: HyperlinkUpdate): void;
507
+ /**
508
+ * Get the hyperlink at a specific text index.
509
+ */
510
+ getHyperlinkAt(textIndex: number): Hyperlink | undefined;
511
+ /**
512
+ * Get a hyperlink by ID.
513
+ */
514
+ getHyperlinkById(id: string): Hyperlink | undefined;
515
+ /**
516
+ * Get all hyperlinks overlapping a range.
517
+ */
518
+ getHyperlinksInRange(startIndex: number, endIndex: number): Hyperlink[];
519
+ /**
520
+ * Get all hyperlinks.
521
+ */
522
+ getAllHyperlinks(): Hyperlink[];
523
+ /**
524
+ * Get all paragraph boundaries in the current content.
525
+ * Returns indices that are valid start/end points for repeating sections.
526
+ */
527
+ getParagraphBoundaries(): number[];
528
+ /**
529
+ * Get all repeating sections.
530
+ */
531
+ getRepeatingSections(): RepeatingSection[];
532
+ /**
533
+ * Create a repeating section.
534
+ * @param startIndex Text index at paragraph start (must be at a paragraph boundary)
535
+ * @param endIndex Text index at closing paragraph start (must be at a paragraph boundary)
536
+ * @param fieldPath The field path to the array to loop over
537
+ * @returns The created section, or null if boundaries are invalid
538
+ */
539
+ createRepeatingSection(startIndex: number, endIndex: number, fieldPath: string): RepeatingSection | null;
540
+ /**
541
+ * Remove a repeating section by ID.
542
+ */
543
+ removeRepeatingSection(id: string): boolean;
544
+ /**
545
+ * Get a repeating section by ID.
546
+ */
547
+ getRepeatingSection(id: string): RepeatingSection | undefined;
548
+ /**
549
+ * Find a repeating section that has a boundary at the given text index.
550
+ */
551
+ getRepeatingSectionAtBoundary(textIndex: number): RepeatingSection | undefined;
552
+ /**
553
+ * Update a repeating section's field path.
554
+ */
555
+ updateRepeatingSectionFieldPath(id: string, fieldPath: string): boolean;
556
+ /**
557
+ * Serialize the complete FlowingTextContent state to JSON-compatible data.
558
+ */
559
+ toData(): FlowingTextContentData;
560
+ /**
561
+ * Restore FlowingTextContent state from serialized data.
562
+ * Static factory method for creating from data.
563
+ */
564
+ static fromData(data: FlowingTextContentData): FlowingTextContent;
565
+ /**
566
+ * Load state from serialized data into this instance.
567
+ * Instance method for updating existing FlowingTextContent.
568
+ */
569
+ loadFromData(data: FlowingTextContentData): void;
570
+ }
571
+ //# sourceMappingURL=FlowingTextContent.d.ts.map