@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.
- package/CHANGELOG.md +95 -0
- package/LICENSE +21 -0
- package/README.md +377 -0
- package/dist/pc-editor.esm.js +24820 -0
- package/dist/pc-editor.esm.js.map +1 -0
- package/dist/pc-editor.js +24877 -0
- package/dist/pc-editor.js.map +1 -0
- package/dist/pc-editor.min.js +2 -0
- package/dist/pc-editor.min.js.map +1 -0
- package/dist/types/lib/clipboard/ClipboardManager.d.ts +77 -0
- package/dist/types/lib/clipboard/ClipboardManager.d.ts.map +1 -0
- package/dist/types/lib/clipboard/HtmlConverter.d.ts +43 -0
- package/dist/types/lib/clipboard/HtmlConverter.d.ts.map +1 -0
- package/dist/types/lib/clipboard/index.d.ts +9 -0
- package/dist/types/lib/clipboard/index.d.ts.map +1 -0
- package/dist/types/lib/clipboard/types.d.ts +76 -0
- package/dist/types/lib/clipboard/types.d.ts.map +1 -0
- package/dist/types/lib/controls/BaseControl.d.ts +72 -0
- package/dist/types/lib/controls/BaseControl.d.ts.map +1 -0
- package/dist/types/lib/controls/index.d.ts +11 -0
- package/dist/types/lib/controls/index.d.ts.map +1 -0
- package/dist/types/lib/controls/rulers/HorizontalRuler.d.ts +55 -0
- package/dist/types/lib/controls/rulers/HorizontalRuler.d.ts.map +1 -0
- package/dist/types/lib/controls/rulers/RulerControl.d.ts +98 -0
- package/dist/types/lib/controls/rulers/RulerControl.d.ts.map +1 -0
- package/dist/types/lib/controls/rulers/VerticalRuler.d.ts +65 -0
- package/dist/types/lib/controls/rulers/VerticalRuler.d.ts.map +1 -0
- package/dist/types/lib/controls/rulers/index.d.ts +8 -0
- package/dist/types/lib/controls/rulers/index.d.ts.map +1 -0
- package/dist/types/lib/controls/rulers/types.d.ts +62 -0
- package/dist/types/lib/controls/rulers/types.d.ts.map +1 -0
- package/dist/types/lib/controls/types.d.ts +51 -0
- package/dist/types/lib/controls/types.d.ts.map +1 -0
- package/dist/types/lib/core/Document.d.ts +34 -0
- package/dist/types/lib/core/Document.d.ts.map +1 -0
- package/dist/types/lib/core/PCEditor.d.ts +761 -0
- package/dist/types/lib/core/PCEditor.d.ts.map +1 -0
- package/dist/types/lib/core/Page.d.ts +40 -0
- package/dist/types/lib/core/Page.d.ts.map +1 -0
- package/dist/types/lib/data/DataBinder.d.ts +11 -0
- package/dist/types/lib/data/DataBinder.d.ts.map +1 -0
- package/dist/types/lib/events/EventEmitter.d.ts +11 -0
- package/dist/types/lib/events/EventEmitter.d.ts.map +1 -0
- package/dist/types/lib/hit-test/HitTestManager.d.ts +81 -0
- package/dist/types/lib/hit-test/HitTestManager.d.ts.map +1 -0
- package/dist/types/lib/hit-test/index.d.ts +32 -0
- package/dist/types/lib/hit-test/index.d.ts.map +1 -0
- package/dist/types/lib/hit-test/types.d.ts +113 -0
- package/dist/types/lib/hit-test/types.d.ts.map +1 -0
- package/dist/types/lib/import/ContentAnalyzer.d.ts +76 -0
- package/dist/types/lib/import/ContentAnalyzer.d.ts.map +1 -0
- package/dist/types/lib/import/DocumentBuilder.d.ts +44 -0
- package/dist/types/lib/import/DocumentBuilder.d.ts.map +1 -0
- package/dist/types/lib/import/PDFImporter.d.ts +65 -0
- package/dist/types/lib/import/PDFImporter.d.ts.map +1 -0
- package/dist/types/lib/import/PDFParser.d.ts +46 -0
- package/dist/types/lib/import/PDFParser.d.ts.map +1 -0
- package/dist/types/lib/import/index.d.ts +9 -0
- package/dist/types/lib/import/index.d.ts.map +1 -0
- package/dist/types/lib/import/types.d.ts +182 -0
- package/dist/types/lib/import/types.d.ts.map +1 -0
- package/dist/types/lib/index.d.ts +16 -0
- package/dist/types/lib/index.d.ts.map +1 -0
- package/dist/types/lib/layout/FlowManager.d.ts +29 -0
- package/dist/types/lib/layout/FlowManager.d.ts.map +1 -0
- package/dist/types/lib/layout/LayoutEngine.d.ts +39 -0
- package/dist/types/lib/layout/LayoutEngine.d.ts.map +1 -0
- package/dist/types/lib/objects/BaseEmbeddedObject.d.ts +133 -0
- package/dist/types/lib/objects/BaseEmbeddedObject.d.ts.map +1 -0
- package/dist/types/lib/objects/EmbeddedObjectFactory.d.ts +57 -0
- package/dist/types/lib/objects/EmbeddedObjectFactory.d.ts.map +1 -0
- package/dist/types/lib/objects/ImageObject.d.ts +60 -0
- package/dist/types/lib/objects/ImageObject.d.ts.map +1 -0
- package/dist/types/lib/objects/TextBoxObject.d.ts +208 -0
- package/dist/types/lib/objects/TextBoxObject.d.ts.map +1 -0
- package/dist/types/lib/objects/index.d.ts +9 -0
- package/dist/types/lib/objects/index.d.ts.map +1 -0
- package/dist/types/lib/objects/table/TableCell.d.ts +165 -0
- package/dist/types/lib/objects/table/TableCell.d.ts.map +1 -0
- package/dist/types/lib/objects/table/TableCellMerger.d.ts +66 -0
- package/dist/types/lib/objects/table/TableCellMerger.d.ts.map +1 -0
- package/dist/types/lib/objects/table/TableObject.d.ts +434 -0
- package/dist/types/lib/objects/table/TableObject.d.ts.map +1 -0
- package/dist/types/lib/objects/table/TableResizeHandler.d.ts +80 -0
- package/dist/types/lib/objects/table/TableResizeHandler.d.ts.map +1 -0
- package/dist/types/lib/objects/table/TableRow.d.ts +65 -0
- package/dist/types/lib/objects/table/TableRow.d.ts.map +1 -0
- package/dist/types/lib/objects/table/index.d.ts +12 -0
- package/dist/types/lib/objects/table/index.d.ts.map +1 -0
- package/dist/types/lib/objects/table/types.d.ts +239 -0
- package/dist/types/lib/objects/table/types.d.ts.map +1 -0
- package/dist/types/lib/objects/types.d.ts +135 -0
- package/dist/types/lib/objects/types.d.ts.map +1 -0
- package/dist/types/lib/rendering/CanvasManager.d.ts +282 -0
- package/dist/types/lib/rendering/CanvasManager.d.ts.map +1 -0
- package/dist/types/lib/rendering/FlowingTextRenderer.d.ts +348 -0
- package/dist/types/lib/rendering/FlowingTextRenderer.d.ts.map +1 -0
- package/dist/types/lib/rendering/PDFGenerator.d.ts +103 -0
- package/dist/types/lib/rendering/PDFGenerator.d.ts.map +1 -0
- package/dist/types/lib/rendering/pdf-utils.d.ts +54 -0
- package/dist/types/lib/rendering/pdf-utils.d.ts.map +1 -0
- package/dist/types/lib/text/EditableTextRegion.d.ts +105 -0
- package/dist/types/lib/text/EditableTextRegion.d.ts.map +1 -0
- package/dist/types/lib/text/EmbeddedObjectManager.d.ts +97 -0
- package/dist/types/lib/text/EmbeddedObjectManager.d.ts.map +1 -0
- package/dist/types/lib/text/FieldFormatter.d.ts +26 -0
- package/dist/types/lib/text/FieldFormatter.d.ts.map +1 -0
- package/dist/types/lib/text/FlowingTextContent.d.ts +571 -0
- package/dist/types/lib/text/FlowingTextContent.d.ts.map +1 -0
- package/dist/types/lib/text/HyperlinkManager.d.ts +110 -0
- package/dist/types/lib/text/HyperlinkManager.d.ts.map +1 -0
- package/dist/types/lib/text/MarkdownParser.d.ts +55 -0
- package/dist/types/lib/text/MarkdownParser.d.ts.map +1 -0
- package/dist/types/lib/text/ParagraphFormatting.d.ts +123 -0
- package/dist/types/lib/text/ParagraphFormatting.d.ts.map +1 -0
- package/dist/types/lib/text/RegionManager.d.ts +75 -0
- package/dist/types/lib/text/RegionManager.d.ts.map +1 -0
- package/dist/types/lib/text/RepeatingSectionManager.d.ts +99 -0
- package/dist/types/lib/text/RepeatingSectionManager.d.ts.map +1 -0
- package/dist/types/lib/text/SubstitutionFieldManager.d.ts +153 -0
- package/dist/types/lib/text/SubstitutionFieldManager.d.ts.map +1 -0
- package/dist/types/lib/text/TextFormatting.d.ts +85 -0
- package/dist/types/lib/text/TextFormatting.d.ts.map +1 -0
- package/dist/types/lib/text/TextLayout.d.ts +126 -0
- package/dist/types/lib/text/TextLayout.d.ts.map +1 -0
- package/dist/types/lib/text/TextMeasurer.d.ts +107 -0
- package/dist/types/lib/text/TextMeasurer.d.ts.map +1 -0
- package/dist/types/lib/text/TextPositionCalculator.d.ts +72 -0
- package/dist/types/lib/text/TextPositionCalculator.d.ts.map +1 -0
- package/dist/types/lib/text/TextState.d.ts +236 -0
- package/dist/types/lib/text/TextState.d.ts.map +1 -0
- package/dist/types/lib/text/index.d.ts +27 -0
- package/dist/types/lib/text/index.d.ts.map +1 -0
- package/dist/types/lib/text/regions/BodyTextRegion.d.ts +68 -0
- package/dist/types/lib/text/regions/BodyTextRegion.d.ts.map +1 -0
- package/dist/types/lib/text/regions/FooterTextRegion.d.ts +68 -0
- package/dist/types/lib/text/regions/FooterTextRegion.d.ts.map +1 -0
- package/dist/types/lib/text/regions/HeaderTextRegion.d.ts +68 -0
- package/dist/types/lib/text/regions/HeaderTextRegion.d.ts.map +1 -0
- package/dist/types/lib/text/regions/index.d.ts +7 -0
- package/dist/types/lib/text/regions/index.d.ts.map +1 -0
- package/dist/types/lib/text/types.d.ts +268 -0
- package/dist/types/lib/text/types.d.ts.map +1 -0
- package/dist/types/lib/types/index.d.ts +206 -0
- package/dist/types/lib/types/index.d.ts.map +1 -0
- package/dist/types/lib/undo/index.d.ts +8 -0
- package/dist/types/lib/undo/index.d.ts.map +1 -0
- package/dist/types/lib/undo/transaction/ContentDiscovery.d.ts +101 -0
- package/dist/types/lib/undo/transaction/ContentDiscovery.d.ts.map +1 -0
- package/dist/types/lib/undo/transaction/FocusTracker.d.ts +49 -0
- package/dist/types/lib/undo/transaction/FocusTracker.d.ts.map +1 -0
- package/dist/types/lib/undo/transaction/MutationUndo.d.ts +57 -0
- package/dist/types/lib/undo/transaction/MutationUndo.d.ts.map +1 -0
- package/dist/types/lib/undo/transaction/ObjectMutationObserver.d.ts +79 -0
- package/dist/types/lib/undo/transaction/ObjectMutationObserver.d.ts.map +1 -0
- package/dist/types/lib/undo/transaction/TextMutationObserver.d.ts +60 -0
- package/dist/types/lib/undo/transaction/TextMutationObserver.d.ts.map +1 -0
- package/dist/types/lib/undo/transaction/TransactionManager.d.ts +148 -0
- package/dist/types/lib/undo/transaction/TransactionManager.d.ts.map +1 -0
- package/dist/types/lib/undo/transaction/index.d.ts +17 -0
- package/dist/types/lib/undo/transaction/index.d.ts.map +1 -0
- package/dist/types/lib/undo/transaction/types.d.ts +269 -0
- package/dist/types/lib/undo/transaction/types.d.ts.map +1 -0
- package/dist/types/lib/utils/blob-utils.d.ts +2 -0
- package/dist/types/lib/utils/blob-utils.d.ts.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
export interface Point {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface Size {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export interface Rect extends Point, Size {
|
|
10
|
+
}
|
|
11
|
+
export interface Margin {
|
|
12
|
+
top: number;
|
|
13
|
+
right: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
left: number;
|
|
16
|
+
}
|
|
17
|
+
export type PageSize = 'A4' | 'Letter' | 'Legal' | 'A3' | 'Custom';
|
|
18
|
+
export type PageOrientation = 'portrait' | 'landscape';
|
|
19
|
+
export type Units = 'px' | 'mm' | 'in' | 'pt';
|
|
20
|
+
/**
|
|
21
|
+
* Represents which section of the document is being edited.
|
|
22
|
+
*/
|
|
23
|
+
export type EditingSection = 'header' | 'body' | 'footer';
|
|
24
|
+
export interface PageDimensions {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
units: Units;
|
|
28
|
+
}
|
|
29
|
+
export interface EditorOptions {
|
|
30
|
+
pageSize?: PageSize;
|
|
31
|
+
pageOrientation?: PageOrientation;
|
|
32
|
+
customPageSize?: PageDimensions | undefined;
|
|
33
|
+
units?: Units;
|
|
34
|
+
gridSize?: number;
|
|
35
|
+
showGrid?: boolean;
|
|
36
|
+
showRulers?: boolean;
|
|
37
|
+
showControlCharacters?: boolean;
|
|
38
|
+
defaultFont?: string;
|
|
39
|
+
defaultFontSize?: number;
|
|
40
|
+
theme?: 'light' | 'dark';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Complete serialized FlowingTextContent.
|
|
44
|
+
*/
|
|
45
|
+
export interface FlowingTextContentData {
|
|
46
|
+
text: string;
|
|
47
|
+
formattingRuns?: TextFormattingRunData[];
|
|
48
|
+
paragraphFormatting?: ParagraphFormattingData[];
|
|
49
|
+
substitutionFields?: SubstitutionFieldData[];
|
|
50
|
+
repeatingSections?: RepeatingSectionData[];
|
|
51
|
+
embeddedObjects?: EmbeddedObjectReference[];
|
|
52
|
+
hyperlinks?: HyperlinkSerializedData[];
|
|
53
|
+
}
|
|
54
|
+
export interface DocumentData {
|
|
55
|
+
version: string;
|
|
56
|
+
pages: PageData[];
|
|
57
|
+
settings?: DocumentSettings;
|
|
58
|
+
bodyContent?: FlowingTextContentData;
|
|
59
|
+
headerContent?: FlowingTextContentData;
|
|
60
|
+
footerContent?: FlowingTextContentData;
|
|
61
|
+
metadata?: {
|
|
62
|
+
createdAt?: string;
|
|
63
|
+
modifiedAt?: string;
|
|
64
|
+
title?: string;
|
|
65
|
+
author?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export interface DocumentSettings {
|
|
69
|
+
pageSize: PageSize;
|
|
70
|
+
pageOrientation: PageOrientation;
|
|
71
|
+
customPageSize?: PageDimensions;
|
|
72
|
+
margins: Margin;
|
|
73
|
+
units: Units;
|
|
74
|
+
}
|
|
75
|
+
export interface PageData {
|
|
76
|
+
id: string;
|
|
77
|
+
}
|
|
78
|
+
export interface EditorEvent {
|
|
79
|
+
type: string;
|
|
80
|
+
data?: any;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Unified selection type representing cursor position, text selection, or no selection.
|
|
84
|
+
* Text-based selections (cursor, text) include which section is being edited.
|
|
85
|
+
*/
|
|
86
|
+
export type EditorSelection = {
|
|
87
|
+
type: 'cursor';
|
|
88
|
+
position: number;
|
|
89
|
+
section: EditingSection;
|
|
90
|
+
} | {
|
|
91
|
+
type: 'text';
|
|
92
|
+
start: number;
|
|
93
|
+
end: number;
|
|
94
|
+
section: EditingSection;
|
|
95
|
+
} | {
|
|
96
|
+
type: 'repeating-section';
|
|
97
|
+
sectionId: string;
|
|
98
|
+
} | {
|
|
99
|
+
type: 'none';
|
|
100
|
+
};
|
|
101
|
+
export interface SelectionEvent extends EditorEvent {
|
|
102
|
+
type: 'selection-change';
|
|
103
|
+
data: {
|
|
104
|
+
selection: EditorSelection;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export interface DocumentChangeEvent extends EditorEvent {
|
|
108
|
+
type: 'document-change';
|
|
109
|
+
data: {
|
|
110
|
+
document: DocumentData;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export interface DataBindingContext {
|
|
114
|
+
[key: string]: any;
|
|
115
|
+
}
|
|
116
|
+
export interface PDFExportOptions {
|
|
117
|
+
quality?: number;
|
|
118
|
+
compress?: boolean;
|
|
119
|
+
embedFonts?: boolean;
|
|
120
|
+
/** If true, apply merge data before generating PDF */
|
|
121
|
+
applyMergeData?: boolean;
|
|
122
|
+
/** Data to use for merge (requires applyMergeData: true) */
|
|
123
|
+
mergeData?: Record<string, unknown>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Serialized text formatting run.
|
|
127
|
+
* Represents formatting applied at a specific character index.
|
|
128
|
+
*/
|
|
129
|
+
export interface TextFormattingRunData {
|
|
130
|
+
index: number;
|
|
131
|
+
formatting: {
|
|
132
|
+
fontFamily: string;
|
|
133
|
+
fontSize: number;
|
|
134
|
+
fontWeight?: string;
|
|
135
|
+
fontStyle?: string;
|
|
136
|
+
color: string;
|
|
137
|
+
backgroundColor?: string;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Serialized paragraph formatting.
|
|
142
|
+
*/
|
|
143
|
+
export interface ParagraphFormattingData {
|
|
144
|
+
paragraphStart: number;
|
|
145
|
+
formatting: {
|
|
146
|
+
alignment: 'left' | 'center' | 'right' | 'justify';
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Serialized field format configuration.
|
|
151
|
+
*/
|
|
152
|
+
export interface FieldFormatConfigData {
|
|
153
|
+
valueType?: 'string' | 'number' | 'currency' | 'date' | 'markdown';
|
|
154
|
+
numberFormat?: string;
|
|
155
|
+
decimalPlaces?: number;
|
|
156
|
+
useGrouping?: boolean;
|
|
157
|
+
currencyFormat?: 'USD' | 'EUR' | 'GBP' | 'JPY' | 'custom';
|
|
158
|
+
currencySymbol?: string;
|
|
159
|
+
currencyPosition?: 'before' | 'after';
|
|
160
|
+
dateFormat?: string;
|
|
161
|
+
locale?: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Serialized substitution field.
|
|
165
|
+
*/
|
|
166
|
+
export interface SubstitutionFieldData {
|
|
167
|
+
id: string;
|
|
168
|
+
textIndex: number;
|
|
169
|
+
fieldName: string;
|
|
170
|
+
fieldType?: 'data' | 'pageNumber' | 'pageCount';
|
|
171
|
+
displayFormat?: string;
|
|
172
|
+
defaultValue?: string;
|
|
173
|
+
formatting?: TextFormattingRunData['formatting'];
|
|
174
|
+
formatConfig?: FieldFormatConfigData;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Serialized repeating section.
|
|
178
|
+
*/
|
|
179
|
+
export interface RepeatingSectionData {
|
|
180
|
+
id: string;
|
|
181
|
+
fieldPath: string;
|
|
182
|
+
startIndex: number;
|
|
183
|
+
endIndex: number;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Serialized embedded object reference in FlowingTextContent.
|
|
187
|
+
*/
|
|
188
|
+
export interface EmbeddedObjectReference {
|
|
189
|
+
textIndex: number;
|
|
190
|
+
object: import('../objects').EmbeddedObjectData;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Serialized hyperlink.
|
|
194
|
+
*/
|
|
195
|
+
export interface HyperlinkSerializedData {
|
|
196
|
+
id: string;
|
|
197
|
+
url: string;
|
|
198
|
+
startIndex: number;
|
|
199
|
+
endIndex: number;
|
|
200
|
+
title?: string;
|
|
201
|
+
formatting?: {
|
|
202
|
+
color?: string;
|
|
203
|
+
underline?: boolean;
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAK,SAAQ,KAAK,EAAE,IAAI;CAAG;AAE5C,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,GAAG,QAAQ,CAAC;AACnE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,WAAW,CAAC;AACvD,MAAM,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,cAAc,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IAC5C,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,C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CAAC,EAAE,qBAAqB,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,YAAY,EAAE,kBAAkB,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/undo/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ContentDiscovery - Automatically discovers and registers content sources.
|
|
3
|
+
*
|
|
4
|
+
* Listens for focus events and registers FlowingTextContent instances
|
|
5
|
+
* with the TextMutationObserver when they become active.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from '../../events/EventEmitter';
|
|
8
|
+
import { FlowingTextContent } from '../../text/FlowingTextContent';
|
|
9
|
+
import { TextMutationObserver } from './TextMutationObserver';
|
|
10
|
+
import { ContentSourceId } from './types';
|
|
11
|
+
import { BaseEmbeddedObject } from '../../objects';
|
|
12
|
+
/**
|
|
13
|
+
* Interface for the document that provides FlowingTextContent.
|
|
14
|
+
*/
|
|
15
|
+
export interface DocumentProvider {
|
|
16
|
+
bodyFlowingContent: FlowingTextContent;
|
|
17
|
+
headerFlowingContent: FlowingTextContent;
|
|
18
|
+
footerFlowingContent: FlowingTextContent;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Interface for the canvas manager that provides focus events.
|
|
22
|
+
*/
|
|
23
|
+
export interface FocusEventSource extends EventEmitter {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* ContentDiscovery manages automatic content registration.
|
|
27
|
+
*/
|
|
28
|
+
export declare class ContentDiscovery {
|
|
29
|
+
private mutationObserver;
|
|
30
|
+
private document;
|
|
31
|
+
private focusEventSource;
|
|
32
|
+
private currentFocusedContent;
|
|
33
|
+
private currentSourceId;
|
|
34
|
+
private registeredContent;
|
|
35
|
+
constructor(mutationObserver: TextMutationObserver, document: DocumentProvider, focusEventSource: FocusEventSource);
|
|
36
|
+
/**
|
|
37
|
+
* Register body/header/footer content (always present).
|
|
38
|
+
*/
|
|
39
|
+
private registerDocumentContent;
|
|
40
|
+
/**
|
|
41
|
+
* Set up tracking for dynamic content (tables, text boxes).
|
|
42
|
+
*/
|
|
43
|
+
private setupFocusTracking;
|
|
44
|
+
/**
|
|
45
|
+
* Register a FlowingTextContent with the mutation observer.
|
|
46
|
+
*/
|
|
47
|
+
registerContent(content: FlowingTextContent, sourceId: ContentSourceId): void;
|
|
48
|
+
/**
|
|
49
|
+
* Unregister a FlowingTextContent.
|
|
50
|
+
*/
|
|
51
|
+
unregisterContent(content: FlowingTextContent): void;
|
|
52
|
+
/**
|
|
53
|
+
* Set the currently focused content.
|
|
54
|
+
*/
|
|
55
|
+
private setCurrentFocus;
|
|
56
|
+
/**
|
|
57
|
+
* Clear the current focus.
|
|
58
|
+
*/
|
|
59
|
+
private clearCurrentFocus;
|
|
60
|
+
/**
|
|
61
|
+
* Get the currently focused content.
|
|
62
|
+
*/
|
|
63
|
+
getCurrentFocus(): {
|
|
64
|
+
content: FlowingTextContent;
|
|
65
|
+
sourceId: ContentSourceId;
|
|
66
|
+
} | null;
|
|
67
|
+
/**
|
|
68
|
+
* Get content for a document section.
|
|
69
|
+
*/
|
|
70
|
+
private getContentForSection;
|
|
71
|
+
/**
|
|
72
|
+
* Get FlowingTextContent by source ID.
|
|
73
|
+
*/
|
|
74
|
+
getContentBySourceId(sourceId: ContentSourceId): FlowingTextContent | null;
|
|
75
|
+
/**
|
|
76
|
+
* Check if two source IDs are the same.
|
|
77
|
+
*/
|
|
78
|
+
private sameSourceId;
|
|
79
|
+
/**
|
|
80
|
+
* Register an embedded object for potential content tracking.
|
|
81
|
+
* Called when an object is inserted or focused.
|
|
82
|
+
*/
|
|
83
|
+
registerObject(object: BaseEmbeddedObject): void;
|
|
84
|
+
/**
|
|
85
|
+
* Register all cells of a table.
|
|
86
|
+
*/
|
|
87
|
+
private registerTableCells;
|
|
88
|
+
/**
|
|
89
|
+
* Unregister an object and its content.
|
|
90
|
+
*/
|
|
91
|
+
unregisterObject(object: BaseEmbeddedObject): void;
|
|
92
|
+
/**
|
|
93
|
+
* Unregister all cells of a table.
|
|
94
|
+
*/
|
|
95
|
+
private unregisterTableCells;
|
|
96
|
+
/**
|
|
97
|
+
* Clear all registrations.
|
|
98
|
+
*/
|
|
99
|
+
clear(): void;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=ContentDiscovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentDiscovery.d.ts","sourceRoot":"","sources":["../../../../../src/lib/undo/transaction/ContentDiscovery.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAA8B,kBAAkB,EAAE,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AC,kBAAkB;IAoB1B;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAUlD;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;IACH,KAAK,IAAI,IAAI;CAQd"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FocusTracker - Captures and restores focus/cursor state.
|
|
3
|
+
*
|
|
4
|
+
* Tracks which content source is active (body, header, footer, table cell, textbox)
|
|
5
|
+
* and the cursor/selection state within that source.
|
|
6
|
+
*/
|
|
7
|
+
import { FocusState } from './types';
|
|
8
|
+
import { FlowingTextContent } from '../../text/FlowingTextContent';
|
|
9
|
+
/**
|
|
10
|
+
* Callback to get the currently active FlowingTextContent.
|
|
11
|
+
*/
|
|
12
|
+
export type GetActiveContentFn = () => {
|
|
13
|
+
content: FlowingTextContent | null;
|
|
14
|
+
section: 'body' | 'header' | 'footer';
|
|
15
|
+
focusedObjectId: string | null;
|
|
16
|
+
tableCellAddress: {
|
|
17
|
+
row: number;
|
|
18
|
+
col: number;
|
|
19
|
+
} | null;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Callback to restore focus to a specific state.
|
|
23
|
+
*/
|
|
24
|
+
export type RestoreFocusFn = (state: FocusState) => void;
|
|
25
|
+
/**
|
|
26
|
+
* FocusTracker captures and restores focus state for undo/redo.
|
|
27
|
+
*/
|
|
28
|
+
export declare class FocusTracker {
|
|
29
|
+
private getActiveContent;
|
|
30
|
+
private restoreFocus;
|
|
31
|
+
constructor(getActiveContent: GetActiveContentFn, restoreFocus: RestoreFocusFn);
|
|
32
|
+
/**
|
|
33
|
+
* Capture the current focus state.
|
|
34
|
+
*/
|
|
35
|
+
capture(): FocusState;
|
|
36
|
+
/**
|
|
37
|
+
* Restore focus to a previously captured state.
|
|
38
|
+
*/
|
|
39
|
+
restore(state: FocusState): void;
|
|
40
|
+
/**
|
|
41
|
+
* Capture focus state for a specific FlowingTextContent.
|
|
42
|
+
* Used when we know exactly which content to capture from.
|
|
43
|
+
*/
|
|
44
|
+
captureFromContent(content: FlowingTextContent, section: 'body' | 'header' | 'footer', focusedObjectId?: string | null, tableCellAddress?: {
|
|
45
|
+
row: number;
|
|
46
|
+
col: number;
|
|
47
|
+
} | null): FocusState;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=FocusTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusTracker.d.ts","sourceRoot":"","sources":["../../../../../src/lib/undo/transaction/FocusTracker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM;IACrC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACtC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACvD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AAEzD;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,YAAY,CAAiB;gBAGnC,gBAAgB,EAAE,kBAAkB,EACpC,YAAY,EAAE,cAAc;IAM9B;;OAEG;IACH,OAAO,IAAI,UAAU;IAyBrB;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAIhC;;;OAGG;IACH,kBAAkB,CAChB,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,EACrC,eAAe,GAAE,MAAM,GAAG,IAAW,EACrC,gBAAgB,GAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAW,GAC3D,UAAU;CAWd"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MutationUndo - Handles undoing and redoing mutations.
|
|
3
|
+
*
|
|
4
|
+
* Provides the logic for reversing text and object mutations.
|
|
5
|
+
*/
|
|
6
|
+
import { FlowingTextContent } from '../../text/FlowingTextContent';
|
|
7
|
+
import { MutationRecord, ContentSourceId, ObjectSourceId } from './types';
|
|
8
|
+
import { BaseEmbeddedObject } from '../../objects';
|
|
9
|
+
/**
|
|
10
|
+
* Callback to get a FlowingTextContent by source ID.
|
|
11
|
+
*/
|
|
12
|
+
export type GetContentFn = (sourceId: ContentSourceId) => FlowingTextContent | null;
|
|
13
|
+
/**
|
|
14
|
+
* Callback to get an object by source ID.
|
|
15
|
+
*/
|
|
16
|
+
export type GetObjectFn = (sourceId: ObjectSourceId) => BaseEmbeddedObject | null;
|
|
17
|
+
/**
|
|
18
|
+
* MutationUndo provides undo/redo logic for mutations.
|
|
19
|
+
*/
|
|
20
|
+
export declare class MutationUndo {
|
|
21
|
+
private getContent;
|
|
22
|
+
private getObject;
|
|
23
|
+
constructor(getContent: GetContentFn, getObject: GetObjectFn);
|
|
24
|
+
/**
|
|
25
|
+
* Undo a mutation.
|
|
26
|
+
*/
|
|
27
|
+
undoMutation(mutation: MutationRecord): void;
|
|
28
|
+
/**
|
|
29
|
+
* Redo a mutation.
|
|
30
|
+
*/
|
|
31
|
+
redoMutation(mutation: MutationRecord): void;
|
|
32
|
+
private undoInsert;
|
|
33
|
+
private redoInsert;
|
|
34
|
+
private undoDelete;
|
|
35
|
+
private redoDelete;
|
|
36
|
+
private undoFormat;
|
|
37
|
+
private redoFormat;
|
|
38
|
+
private undoAlignment;
|
|
39
|
+
private redoAlignment;
|
|
40
|
+
private undoFieldInsert;
|
|
41
|
+
private redoFieldInsert;
|
|
42
|
+
private undoFieldUpdate;
|
|
43
|
+
private redoFieldUpdate;
|
|
44
|
+
private undoObjectInsert;
|
|
45
|
+
private redoObjectInsert;
|
|
46
|
+
private undoObjectDelete;
|
|
47
|
+
private redoObjectDelete;
|
|
48
|
+
private undoResize;
|
|
49
|
+
private redoResize;
|
|
50
|
+
private undoMove;
|
|
51
|
+
private redoMove;
|
|
52
|
+
private undoProperty;
|
|
53
|
+
private redoProperty;
|
|
54
|
+
private undoTableStructure;
|
|
55
|
+
private redoTableStructure;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=MutationUndo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MutationUndo.d.ts","sourceRoot":"","sources":["../../../../../src/lib/undo/transaction/MutationUndo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EAYf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,kBAAkB,EAAsC,MAAM,eAAe,CAAC;AAGvF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,eAAe,KAAK,kBAAkB,GAAG,IAAI,CAAC;AAEpF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,cAAc,KAAK,kBAAkB,GAAG,IAAI,CAAC;AAElF;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,UAAU,CAAe;IACjC,OAAO,CAAC,SAAS,CAAc;gBAEnB,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW;IAK5D;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAgD5C;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAkD5C,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,UAAU;IA6BlB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,gBAAgB;IAWxB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,kBAAkB;CAU3B"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObjectMutationObserver - Intercepts object methods to capture mutations.
|
|
3
|
+
*
|
|
4
|
+
* Uses method wrapping to intercept object mutations (resize, move, table structure, properties)
|
|
5
|
+
* without requiring changes to the object classes themselves.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseEmbeddedObject } from '../../objects';
|
|
8
|
+
import { TransactionManager } from './TransactionManager';
|
|
9
|
+
/**
|
|
10
|
+
* ObjectMutationObserver intercepts object methods to capture mutations.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ObjectMutationObserver {
|
|
13
|
+
private manager;
|
|
14
|
+
private observedObjects;
|
|
15
|
+
constructor(manager: TransactionManager);
|
|
16
|
+
/**
|
|
17
|
+
* Find a property descriptor by traversing the prototype chain.
|
|
18
|
+
*/
|
|
19
|
+
private findPropertyDescriptor;
|
|
20
|
+
/**
|
|
21
|
+
* Start observing an embedded object.
|
|
22
|
+
* Wraps mutation methods to intercept changes.
|
|
23
|
+
*/
|
|
24
|
+
observe(object: BaseEmbeddedObject): void;
|
|
25
|
+
/**
|
|
26
|
+
* Wrap common object methods (resize, size setters, offset).
|
|
27
|
+
*/
|
|
28
|
+
private wrapCommonMethods;
|
|
29
|
+
/**
|
|
30
|
+
* Wrap ImageObject property setters.
|
|
31
|
+
*/
|
|
32
|
+
private wrapImageProperties;
|
|
33
|
+
/**
|
|
34
|
+
* Wrap TextBoxObject property setters.
|
|
35
|
+
*/
|
|
36
|
+
private wrapTextBoxProperties;
|
|
37
|
+
/**
|
|
38
|
+
* Wrap TableObject-specific methods.
|
|
39
|
+
*/
|
|
40
|
+
private wrapTableMethods;
|
|
41
|
+
/**
|
|
42
|
+
* Stop observing an embedded object.
|
|
43
|
+
* Restores original methods.
|
|
44
|
+
*/
|
|
45
|
+
unobserve(object: BaseEmbeddedObject): void;
|
|
46
|
+
/**
|
|
47
|
+
* Check if an object is being observed.
|
|
48
|
+
*/
|
|
49
|
+
isObserving(object: BaseEmbeddedObject): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Get the object type for an ObjectSourceId.
|
|
52
|
+
*/
|
|
53
|
+
private getObjectType;
|
|
54
|
+
/**
|
|
55
|
+
* Create an ObjectState from current object data.
|
|
56
|
+
*/
|
|
57
|
+
private createObjectState;
|
|
58
|
+
/**
|
|
59
|
+
* Record a resize mutation.
|
|
60
|
+
*/
|
|
61
|
+
private recordResizeMutation;
|
|
62
|
+
/**
|
|
63
|
+
* Record a move mutation.
|
|
64
|
+
*/
|
|
65
|
+
private recordMoveMutation;
|
|
66
|
+
/**
|
|
67
|
+
* Record a property mutation.
|
|
68
|
+
*/
|
|
69
|
+
private recordPropertyMutation;
|
|
70
|
+
/**
|
|
71
|
+
* Record a table structure mutation.
|
|
72
|
+
*/
|
|
73
|
+
private recordTableStructureMutation;
|
|
74
|
+
/**
|
|
75
|
+
* Capture a snapshot of table state for undo/redo.
|
|
76
|
+
*/
|
|
77
|
+
private captureTableSnapshot;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=ObjectMutationObserver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectMutationObserver.d.ts","sourceRoot":"","sources":["../../../../../src/lib/undo/transaction/ObjectMutationObserver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAA2C,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAyD1D;;GAEG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,eAAe,CAMJ;gBAEP,OAAO,EAAE,kBAAkB;IAIvC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAY9B;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IA8DzC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwGzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA0E3B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA6I7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA0FxB;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAwD3C;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO;IAIhD;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAIzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAuB5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAyB9B;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAwBpC;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAG7B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextMutationObserver - Intercepts FlowingTextContent methods to capture text mutations.
|
|
3
|
+
*
|
|
4
|
+
* Uses method wrapping to intercept mutations without requiring changes to FlowingTextContent.
|
|
5
|
+
* Each observed FlowingTextContent has its methods wrapped to capture before/after state.
|
|
6
|
+
*/
|
|
7
|
+
import { FlowingTextContent } from '../../text/FlowingTextContent';
|
|
8
|
+
import { TransactionManager } from './TransactionManager';
|
|
9
|
+
import { ContentSourceId } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* TextMutationObserver intercepts FlowingTextContent methods.
|
|
12
|
+
*/
|
|
13
|
+
export declare class TextMutationObserver {
|
|
14
|
+
private manager;
|
|
15
|
+
private observedContents;
|
|
16
|
+
constructor(manager: TransactionManager);
|
|
17
|
+
/**
|
|
18
|
+
* Start observing a FlowingTextContent instance.
|
|
19
|
+
* Wraps mutation methods to intercept changes.
|
|
20
|
+
*/
|
|
21
|
+
observe(content: FlowingTextContent, sourceId: ContentSourceId): void;
|
|
22
|
+
/**
|
|
23
|
+
* Stop observing a FlowingTextContent instance.
|
|
24
|
+
* Restores original methods.
|
|
25
|
+
*/
|
|
26
|
+
unobserve(content: FlowingTextContent): void;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a FlowingTextContent is being observed.
|
|
29
|
+
*/
|
|
30
|
+
isObserving(content: FlowingTextContent): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Get the source ID for a FlowingTextContent.
|
|
33
|
+
*/
|
|
34
|
+
private getSourceId;
|
|
35
|
+
/**
|
|
36
|
+
* Capture current content state.
|
|
37
|
+
*/
|
|
38
|
+
private captureState;
|
|
39
|
+
/**
|
|
40
|
+
* Capture formatting in a range.
|
|
41
|
+
*/
|
|
42
|
+
private captureFormattingInRange;
|
|
43
|
+
/**
|
|
44
|
+
* Capture substitution fields in a range.
|
|
45
|
+
*/
|
|
46
|
+
private captureFieldsInRange;
|
|
47
|
+
/**
|
|
48
|
+
* Capture embedded objects in a range.
|
|
49
|
+
*/
|
|
50
|
+
private captureObjectsInRange;
|
|
51
|
+
/**
|
|
52
|
+
* Get paragraph index from cursor position and paragraph boundaries.
|
|
53
|
+
*/
|
|
54
|
+
private getParagraphIndexFromBoundaries;
|
|
55
|
+
/**
|
|
56
|
+
* Record a mutation with the transaction manager.
|
|
57
|
+
*/
|
|
58
|
+
private recordMutation;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=TextMutationObserver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextMutationObserver.d.ts","sourceRoot":"","sources":["../../../../../src/lib/undo/transaction/TextMutationObserver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,eAAe,EAUhB,MAAM,SAAS,CAAC;AAqBjB;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,gBAAgB,CAGL;gBAEP,OAAO,EAAE,kBAAkB;IAIvC;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI;IA0TrE;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAqB5C;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO;IAIjD;;OAEG;IACH,OAAO,CAAC,WAAW;IAKnB;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAc5B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAqB7B;;OAEG;IACH,OAAO,CAAC,+BAA+B;IASvC;;OAEG;IACH,OAAO,CAAC,cAAc;CAGvB"}
|