@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,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClipboardManager handles copy, cut, and paste operations for the PC Editor.
|
|
3
|
+
*
|
|
4
|
+
* Supports:
|
|
5
|
+
* - Proprietary format (full fidelity)
|
|
6
|
+
* - Plain text
|
|
7
|
+
* - HTML (for interoperability)
|
|
8
|
+
* - Image paste
|
|
9
|
+
*/
|
|
10
|
+
import { EventEmitter } from '../events/EventEmitter';
|
|
11
|
+
import type { FlowingTextContent } from '../text/FlowingTextContent';
|
|
12
|
+
import { type PCEditorClipboardData, type ClipboardContent, type ClipboardReadResult, type CopyOptions, type PasteOptions } from './types';
|
|
13
|
+
/**
|
|
14
|
+
* Manages clipboard operations for the editor.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ClipboardManager extends EventEmitter {
|
|
17
|
+
private htmlConverter;
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Copy the selected content from a FlowingTextContent to the clipboard.
|
|
21
|
+
* Returns true if content was copied, false if nothing was selected.
|
|
22
|
+
*/
|
|
23
|
+
copy(flowingContent: FlowingTextContent, options?: CopyOptions): Promise<boolean>;
|
|
24
|
+
private cachedClipboardData;
|
|
25
|
+
/**
|
|
26
|
+
* Read content from the clipboard.
|
|
27
|
+
* Returns the best available format.
|
|
28
|
+
*/
|
|
29
|
+
read(options?: PasteOptions): Promise<ClipboardReadResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Extract content from a FlowingTextContent for a given range.
|
|
32
|
+
* All indices in the result are relative to the start of the selection (0-based).
|
|
33
|
+
*/
|
|
34
|
+
extractSelectionContent(flowingContent: FlowingTextContent, start: number, end: number): PCEditorClipboardData;
|
|
35
|
+
/**
|
|
36
|
+
* Extract formatting runs for a range, adjusting indices to be 0-based.
|
|
37
|
+
*/
|
|
38
|
+
private extractFormattingRuns;
|
|
39
|
+
/**
|
|
40
|
+
* Extract paragraph formatting for a range, adjusting indices to be 0-based.
|
|
41
|
+
*/
|
|
42
|
+
private extractParagraphFormatting;
|
|
43
|
+
/**
|
|
44
|
+
* Extract substitution fields in a range, adjusting indices to be 0-based.
|
|
45
|
+
*/
|
|
46
|
+
private extractSubstitutionFields;
|
|
47
|
+
/**
|
|
48
|
+
* Extract embedded objects in a range, adjusting indices to be 0-based.
|
|
49
|
+
*/
|
|
50
|
+
private extractEmbeddedObjects;
|
|
51
|
+
/**
|
|
52
|
+
* Extract hyperlinks in a range, adjusting indices to be 0-based.
|
|
53
|
+
*/
|
|
54
|
+
private extractHyperlinks;
|
|
55
|
+
/**
|
|
56
|
+
* Extract plain text from content, replacing embedded objects with placeholders.
|
|
57
|
+
*/
|
|
58
|
+
private extractPlainText;
|
|
59
|
+
/**
|
|
60
|
+
* Parse HTML content into clipboard data format.
|
|
61
|
+
*/
|
|
62
|
+
parseHtml(html: string): ClipboardContent;
|
|
63
|
+
/**
|
|
64
|
+
* Generate new IDs for all items in clipboard content.
|
|
65
|
+
* This is needed when pasting to avoid ID conflicts.
|
|
66
|
+
*/
|
|
67
|
+
generateNewIds(content: ClipboardContent): ClipboardContent;
|
|
68
|
+
/**
|
|
69
|
+
* Create an ImageObject data from a Blob.
|
|
70
|
+
*/
|
|
71
|
+
createImageFromBlob(blob: Blob): Promise<{
|
|
72
|
+
dataUrl: string;
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=ClipboardManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClipboardManager.d.ts","sourceRoot":"","sources":["../../../../src/lib/clipboard/ClipboardManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,Y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|
|
|
1
|
+
/**
|
|
2
|
+
* HtmlConverter handles conversion between PC Editor content and HTML.
|
|
3
|
+
* Used for clipboard interoperability with external applications.
|
|
4
|
+
*/
|
|
5
|
+
import type { ClipboardContent } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Converts between PC Editor content format and HTML.
|
|
8
|
+
*/
|
|
9
|
+
export declare class HtmlConverter {
|
|
10
|
+
/**
|
|
11
|
+
* Convert clipboard content to HTML string.
|
|
12
|
+
*/
|
|
13
|
+
toHtml(content: ClipboardContent): string;
|
|
14
|
+
/**
|
|
15
|
+
* Parse HTML string into clipboard content format.
|
|
16
|
+
*/
|
|
17
|
+
fromHtml(html: string): ClipboardContent;
|
|
18
|
+
/**
|
|
19
|
+
* Process a DOM node and extract text with formatting.
|
|
20
|
+
*/
|
|
21
|
+
private processNode;
|
|
22
|
+
/**
|
|
23
|
+
* Extract formatting from an HTML element.
|
|
24
|
+
*/
|
|
25
|
+
private extractFormatting;
|
|
26
|
+
/**
|
|
27
|
+
* Compare two formatting objects for equality.
|
|
28
|
+
*/
|
|
29
|
+
private formattingEquals;
|
|
30
|
+
/**
|
|
31
|
+
* Create an HTML span with inline styles from formatting.
|
|
32
|
+
*/
|
|
33
|
+
private createStyledSpan;
|
|
34
|
+
/**
|
|
35
|
+
* Escape HTML special characters.
|
|
36
|
+
*/
|
|
37
|
+
private escapeHtml;
|
|
38
|
+
/**
|
|
39
|
+
* Normalize a color value to hex format.
|
|
40
|
+
*/
|
|
41
|
+
private normalizeColor;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=HtmlConverter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HtmlConverter.d.ts","sourceRoot":"","sources":["../../../../src/lib/clipboard/HtmlConverter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGhD;;GAEG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM;IAsDzC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;IAoBxC;;OAEG;IACH,OAAO,CAAC,WAAW;IAyDnB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiDzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAYxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAyBxB;;OAEG;IACH,OAAO,CAAC,UAAU;IASlB;;OAEG;IACH,OAAO,CAAC,cAAc;CAavB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clipboard module for PC Editor.
|
|
3
|
+
* Provides copy, cut, and paste functionality with support for
|
|
4
|
+
* proprietary format, HTML, plain text, and images.
|
|
5
|
+
*/
|
|
6
|
+
export { ClipboardManager } from './ClipboardManager';
|
|
7
|
+
export { HtmlConverter } from './HtmlConverter';
|
|
8
|
+
export * from './types';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/clipboard/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clipboard types for PC Editor copy/paste functionality.
|
|
3
|
+
*/
|
|
4
|
+
import type { TextFormattingRunData, ParagraphFormattingData, SubstitutionFieldData, EmbeddedObjectReference, HyperlinkSerializedData } from '../types';
|
|
5
|
+
export declare const CLIPBOARD_FORMAT_VERSION = "1.0.0";
|
|
6
|
+
export declare const PCEDITOR_MIME_TYPE = "application/x-pceditor-content";
|
|
7
|
+
/**
|
|
8
|
+
* Type of content in the clipboard.
|
|
9
|
+
*/
|
|
10
|
+
export type ClipboardContentType = 'text' | 'object' | 'mixed';
|
|
11
|
+
/**
|
|
12
|
+
* The proprietary clipboard format for PC Editor.
|
|
13
|
+
* Contains all information needed to preserve full fidelity on paste.
|
|
14
|
+
*/
|
|
15
|
+
export interface PCEditorClipboardData {
|
|
16
|
+
version: string;
|
|
17
|
+
type: ClipboardContentType;
|
|
18
|
+
content: ClipboardContent;
|
|
19
|
+
metadata?: ClipboardMetadata;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The actual content being copied.
|
|
23
|
+
*/
|
|
24
|
+
export interface ClipboardContent {
|
|
25
|
+
/** The plain text content (with U+FFFC for embedded objects) */
|
|
26
|
+
text: string;
|
|
27
|
+
/** Text formatting runs, with indices relative to the copied text (0-based) */
|
|
28
|
+
formattingRuns?: TextFormattingRunData[];
|
|
29
|
+
/** Paragraph formatting, with indices relative to the copied text (0-based) */
|
|
30
|
+
paragraphFormatting?: ParagraphFormattingData[];
|
|
31
|
+
/** Substitution fields, with indices relative to the copied text (0-based) */
|
|
32
|
+
substitutionFields?: SubstitutionFieldData[];
|
|
33
|
+
/** Embedded objects, with indices relative to the copied text (0-based) */
|
|
34
|
+
embeddedObjects?: EmbeddedObjectReference[];
|
|
35
|
+
/** Hyperlinks, with indices relative to the copied text (0-based) */
|
|
36
|
+
hyperlinks?: HyperlinkSerializedData[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Metadata about the copy operation.
|
|
40
|
+
*/
|
|
41
|
+
export interface ClipboardMetadata {
|
|
42
|
+
/** Which section the content was copied from */
|
|
43
|
+
sourceSection?: 'header' | 'body' | 'footer';
|
|
44
|
+
/** If copied from a text box or table cell, the object ID */
|
|
45
|
+
sourceObjectId?: string;
|
|
46
|
+
/** Timestamp of when the content was copied */
|
|
47
|
+
copiedAt?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Result of reading from the clipboard.
|
|
51
|
+
*/
|
|
52
|
+
export interface ClipboardReadResult {
|
|
53
|
+
/** The format that was successfully read */
|
|
54
|
+
type: 'pceditor' | 'html' | 'text' | 'image' | 'empty';
|
|
55
|
+
/** The data read from clipboard */
|
|
56
|
+
data: PCEditorClipboardData | string | Blob | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Options for the copy operation.
|
|
60
|
+
*/
|
|
61
|
+
export interface CopyOptions {
|
|
62
|
+
/** Include plain text fallback (default: true) */
|
|
63
|
+
includePlainText?: boolean;
|
|
64
|
+
/** Include HTML fallback (default: true) */
|
|
65
|
+
includeHtml?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Options for the paste operation.
|
|
69
|
+
*/
|
|
70
|
+
export interface PasteOptions {
|
|
71
|
+
/** Preferred format to paste (default: auto-detect best available) */
|
|
72
|
+
preferredFormat?: 'pceditor' | 'html' | 'text';
|
|
73
|
+
/** If true, paste as plain text only, stripping all formatting */
|
|
74
|
+
asPlainText?: boolean;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/clipboard/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,wBAAwB,UAAU,CAAC;AAChD,eAAO,MAAM,kBAAkB,mCAAmC,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,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/**
|
|
2
|
+
* BaseControl - Abstract base class for all editor controls.
|
|
3
|
+
*
|
|
4
|
+
* Controls are optional components that work with PCEditor via the public API only.
|
|
5
|
+
* They are completely decoupled from the core library.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from '../events/EventEmitter';
|
|
8
|
+
import type { PCEditor } from '../core/PCEditor';
|
|
9
|
+
import type { EditorControl, ControlAttachOptions, ControlOptions } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Abstract base class for editor controls.
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class BaseControl extends EventEmitter implements EditorControl {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
protected _isAttached: boolean;
|
|
16
|
+
protected _isVisible: boolean;
|
|
17
|
+
protected editor: PCEditor | null;
|
|
18
|
+
protected container: HTMLElement | null;
|
|
19
|
+
protected element: HTMLElement | null;
|
|
20
|
+
protected eventCleanup: Array<() => void>;
|
|
21
|
+
constructor(id: string, options?: ControlOptions);
|
|
22
|
+
get isAttached(): boolean;
|
|
23
|
+
get isVisible(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Attach the control to an editor.
|
|
26
|
+
*/
|
|
27
|
+
attach(options: ControlAttachOptions): void;
|
|
28
|
+
/**
|
|
29
|
+
* Detach the control from the editor.
|
|
30
|
+
*/
|
|
31
|
+
detach(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Show the control.
|
|
34
|
+
*/
|
|
35
|
+
show(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Hide the control.
|
|
38
|
+
*/
|
|
39
|
+
hide(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Toggle visibility.
|
|
42
|
+
*/
|
|
43
|
+
toggle(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Clean up and destroy the control.
|
|
46
|
+
*/
|
|
47
|
+
destroy(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Create the control's DOM element.
|
|
50
|
+
* Subclasses must implement this.
|
|
51
|
+
*/
|
|
52
|
+
protected abstract createElement(): HTMLElement;
|
|
53
|
+
/**
|
|
54
|
+
* Set up event listeners on the editor.
|
|
55
|
+
* Subclasses should override this to add their own listeners.
|
|
56
|
+
*/
|
|
57
|
+
protected setupEventListeners(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Clean up event listeners.
|
|
60
|
+
*/
|
|
61
|
+
protected cleanupEventListeners(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Add an event listener with automatic cleanup.
|
|
64
|
+
*/
|
|
65
|
+
protected addEditorListener<T>(event: string, handler: (data: T) => void): void;
|
|
66
|
+
/**
|
|
67
|
+
* Update the control's display.
|
|
68
|
+
* Subclasses must implement this.
|
|
69
|
+
*/
|
|
70
|
+
abstract update(): void;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=BaseControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseControl.d.ts","sourceRoot":"","sources":["../../../../src/lib/controls/BaseControl.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEnF;;GAEG;AACH,8BAAsB,WAAY,SAAQ,YAAa,YAAW,aAAa;IAC7E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,WAAW,EAAE,OAAO,CAAS;IACvC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAQ;IACrC,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAQ;IACzC,SAAS,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAQ;IAC/C,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAQ;IAC7C,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAM;gBAEnC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB;IAMpD,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI;IA4B3C;;OAEG;IACH,MAAM,IAAI,IAAI;IAqBd;;OAEG;IACH,IAAI,IAAI,IAAI;IASZ;;OAEG;IACH,IAAI,IAAI,IAAI;IAQZ;;OAEG;IACH,MAAM,IAAI,IAAI;IAQd;;OAEG;IACH,OAAO,IAAI,IAAI;IAKf;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,WAAW;IAE/C;;;OAGG;IACH,SAAS,CAAC,mBAAmB,IAAI,IAAI;IAIrC;;OAEG;IACH,SAAS,CAAC,qBAAqB,IAAI,IAAI;IAOvC;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,CAAC,EAC3B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GACzB,IAAI;IAOP;;;OAGG;IACH,QAAQ,CAAC,MAAM,IAAI,IAAI;CACxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional editor controls module.
|
|
3
|
+
*
|
|
4
|
+
* Controls are standalone components that interact with PCEditor
|
|
5
|
+
* via the public API only. They are completely decoupled from the core library.
|
|
6
|
+
*/
|
|
7
|
+
export { BaseControl } from './BaseControl';
|
|
8
|
+
export * from './types';
|
|
9
|
+
export { RulerControl, HorizontalRuler, VerticalRuler } from './rulers';
|
|
10
|
+
export type { RulerOptions, RulerOrientation, TickMark } from './rulers';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/controls/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACT,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HorizontalRuler - Horizontal ruler control that displays above the editor canvas.
|
|
3
|
+
*
|
|
4
|
+
* This control only uses the PCEditor public API - no DOM queries into the editor.
|
|
5
|
+
*/
|
|
6
|
+
import { RulerControl } from './RulerControl';
|
|
7
|
+
import type { RulerOptions, RulerOrientation, TickMark } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Horizontal ruler control.
|
|
10
|
+
*/
|
|
11
|
+
export declare class HorizontalRuler extends RulerControl {
|
|
12
|
+
protected readonly orientation: RulerOrientation;
|
|
13
|
+
private contentOffsetX;
|
|
14
|
+
constructor(options?: RulerOptions);
|
|
15
|
+
/**
|
|
16
|
+
* Update scroll offset from the editor API.
|
|
17
|
+
*/
|
|
18
|
+
protected updateScrollOffset(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get the content offset for horizontal orientation.
|
|
21
|
+
*/
|
|
22
|
+
protected getContentOffset(): number;
|
|
23
|
+
/**
|
|
24
|
+
* Update from document metrics.
|
|
25
|
+
*/
|
|
26
|
+
protected updateFromMetrics(metrics: {
|
|
27
|
+
pageWidth: number;
|
|
28
|
+
pageHeight: number;
|
|
29
|
+
margins: {
|
|
30
|
+
top: number;
|
|
31
|
+
right: number;
|
|
32
|
+
bottom: number;
|
|
33
|
+
left: number;
|
|
34
|
+
};
|
|
35
|
+
totalPages: number;
|
|
36
|
+
} | null): void;
|
|
37
|
+
/**
|
|
38
|
+
* Calculate tick marks for the page, stopping at the page edge.
|
|
39
|
+
* Overrides the base class method to limit ticks to page width.
|
|
40
|
+
*/
|
|
41
|
+
protected calculateTickMarks(): TickMark[];
|
|
42
|
+
/**
|
|
43
|
+
* Render margin indicators.
|
|
44
|
+
*/
|
|
45
|
+
protected renderMargins(width: number, height: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* Render tick marks.
|
|
48
|
+
*/
|
|
49
|
+
protected renderTicks(ticks: TickMark[], _width: number, height: number): void;
|
|
50
|
+
/**
|
|
51
|
+
* Render cursor position indicator.
|
|
52
|
+
*/
|
|
53
|
+
protected renderCursorIndicator(_width: number, height: number): void;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=HorizontalRuler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HorizontalRuler.d.ts","sourceRoot":"","sources":["../../../../../src/lib/controls/rulers/HorizontalRuler.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxE;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAgB;IAChE,OAAO,CAAC,cAAc,CAAa;gBAEvB,OAAO,GAAE,YAAiB;IAItC;;OAEG;IACH,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAMpC;;OAEG;IACH,SAAS,CAAC,gBAAgB,IAAI,MAAM;IAIpC;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE;QACnC,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QACtE,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,GAAG,IAAI;IAkBf;;;OAGG;IACH,SAAS,CAAC,kBAAkB,IAAI,QAAQ,EAAE;IAyC1C;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA0C5D;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAmC9E;;OAEG;IACH,SAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CActE"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RulerControl - Base class for horizontal and vertical rulers.
|
|
3
|
+
*
|
|
4
|
+
* Provides common functionality for calculating tick marks,
|
|
5
|
+
* rendering, and responding to editor events.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseControl } from '../BaseControl';
|
|
8
|
+
import { RulerOptions, RulerOrientation, TickMark } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Abstract base class for ruler controls.
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class RulerControl extends BaseControl {
|
|
13
|
+
protected options: Required<RulerOptions>;
|
|
14
|
+
protected canvas: HTMLCanvasElement | null;
|
|
15
|
+
protected ctx: CanvasRenderingContext2D | null;
|
|
16
|
+
protected currentMousePosition: number | null;
|
|
17
|
+
protected zoomLevel: number;
|
|
18
|
+
protected scrollOffset: number;
|
|
19
|
+
protected documentSize: number;
|
|
20
|
+
protected marginStart: number;
|
|
21
|
+
protected marginEnd: number;
|
|
22
|
+
protected abstract readonly orientation: RulerOrientation;
|
|
23
|
+
constructor(id: string, options?: RulerOptions);
|
|
24
|
+
private resizeObserver;
|
|
25
|
+
/**
|
|
26
|
+
* Create the ruler element.
|
|
27
|
+
*/
|
|
28
|
+
protected createElement(): HTMLElement;
|
|
29
|
+
/**
|
|
30
|
+
* Set up mouse position tracking.
|
|
31
|
+
*/
|
|
32
|
+
protected setupMouseTracking(element: HTMLElement): void;
|
|
33
|
+
/**
|
|
34
|
+
* Set up event listeners on the editor.
|
|
35
|
+
*/
|
|
36
|
+
protected setupEventListeners(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Clean up event listeners and observers.
|
|
39
|
+
*/
|
|
40
|
+
protected cleanupEventListeners(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Update scroll offset from the editor.
|
|
43
|
+
*/
|
|
44
|
+
protected abstract updateScrollOffset(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Update the ruler based on current editor state.
|
|
47
|
+
*/
|
|
48
|
+
update(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Update ruler state from document metrics.
|
|
51
|
+
*/
|
|
52
|
+
protected abstract updateFromMetrics(metrics: {
|
|
53
|
+
pageWidth: number;
|
|
54
|
+
pageHeight: number;
|
|
55
|
+
margins: {
|
|
56
|
+
top: number;
|
|
57
|
+
right: number;
|
|
58
|
+
bottom: number;
|
|
59
|
+
left: number;
|
|
60
|
+
};
|
|
61
|
+
totalPages: number;
|
|
62
|
+
} | null): void;
|
|
63
|
+
/**
|
|
64
|
+
* Resize the canvas to match the container.
|
|
65
|
+
*/
|
|
66
|
+
protected resizeCanvas(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Calculate tick marks for the visible portion of the ruler.
|
|
69
|
+
* Takes into account the content offset to generate ticks for the
|
|
70
|
+
* document range that's currently visible.
|
|
71
|
+
*/
|
|
72
|
+
protected calculateTickMarks(): TickMark[];
|
|
73
|
+
/**
|
|
74
|
+
* Get the content offset for this ruler orientation.
|
|
75
|
+
*/
|
|
76
|
+
protected abstract getContentOffset(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Get the visible length of the ruler.
|
|
79
|
+
*/
|
|
80
|
+
protected getVisibleLength(): number;
|
|
81
|
+
/**
|
|
82
|
+
* Render the ruler.
|
|
83
|
+
*/
|
|
84
|
+
protected render(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Render margin indicators.
|
|
87
|
+
*/
|
|
88
|
+
protected abstract renderMargins(width: number, height: number): void;
|
|
89
|
+
/**
|
|
90
|
+
* Render tick marks.
|
|
91
|
+
*/
|
|
92
|
+
protected abstract renderTicks(ticks: TickMark[], width: number, height: number): void;
|
|
93
|
+
/**
|
|
94
|
+
* Render the cursor position indicator.
|
|
95
|
+
*/
|
|
96
|
+
protected abstract renderCursorIndicator(width: number, height: number): void;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=RulerControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RulerControl.d.ts","sourceRoot":"","sources":["../../../../../src/lib/controls/rulers/RulerControl.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EAGT,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,8BAAsB,YAAa,SAAQ,WAAW;IACpD,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC1C,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IAClD,SAAS,CAAC,GAAG,EAAE,wBAAwB,GAAG,IAAI,CAAQ;IACtD,SAAS,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAQ;IACrD,SAAS,CAAC,SAAS,EAAE,MAAM,CAAK;IAChC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAK;IACnC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAK;IACnC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAK;IAClC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAK;IAEhC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAE9C,EAAE,EAAE,MAAM,EAAE,OAAO,GAA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AAM,GAAG,IAAI;IAEtF;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;CAC9E"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VerticalRuler - Vertical ruler control that displays to the left of the editor canvas.
|
|
3
|
+
*
|
|
4
|
+
* This control only uses the PCEditor public API - no DOM queries into the editor.
|
|
5
|
+
*
|
|
6
|
+
* The vertical ruler shows measurements starting from 0 at the top of each page,
|
|
7
|
+
* with gray areas displayed in the gaps between pages.
|
|
8
|
+
*/
|
|
9
|
+
import { RulerControl } from './RulerControl';
|
|
10
|
+
import type { RulerOptions, RulerOrientation, TickMark } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* Vertical ruler control.
|
|
13
|
+
*/
|
|
14
|
+
export declare class VerticalRuler extends RulerControl {
|
|
15
|
+
protected readonly orientation: RulerOrientation;
|
|
16
|
+
private contentOffsetY;
|
|
17
|
+
private pageHeightPx;
|
|
18
|
+
private pageGap;
|
|
19
|
+
private totalPages;
|
|
20
|
+
constructor(options?: RulerOptions);
|
|
21
|
+
/**
|
|
22
|
+
* Update scroll offset from the editor API.
|
|
23
|
+
*/
|
|
24
|
+
protected updateScrollOffset(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get the content offset for vertical orientation.
|
|
27
|
+
*/
|
|
28
|
+
protected getContentOffset(): number;
|
|
29
|
+
/**
|
|
30
|
+
* Update from document metrics.
|
|
31
|
+
*/
|
|
32
|
+
protected updateFromMetrics(metrics: {
|
|
33
|
+
pageWidth: number;
|
|
34
|
+
pageHeight: number;
|
|
35
|
+
margins: {
|
|
36
|
+
top: number;
|
|
37
|
+
right: number;
|
|
38
|
+
bottom: number;
|
|
39
|
+
left: number;
|
|
40
|
+
};
|
|
41
|
+
totalPages: number;
|
|
42
|
+
} | null): void;
|
|
43
|
+
/**
|
|
44
|
+
* Render margin indicators - gray areas before document, after document, and between pages.
|
|
45
|
+
*/
|
|
46
|
+
protected renderMargins(width: number, height: number): void;
|
|
47
|
+
/**
|
|
48
|
+
* Calculate tick marks for each page, starting from 0 at the top of each page.
|
|
49
|
+
* Overrides the base class method to handle per-page measurements.
|
|
50
|
+
*/
|
|
51
|
+
protected calculateTickMarks(): TickMark[];
|
|
52
|
+
/**
|
|
53
|
+
* Render tick marks.
|
|
54
|
+
*/
|
|
55
|
+
protected renderTicks(ticks: TickMark[], width: number, _height: number): void;
|
|
56
|
+
/**
|
|
57
|
+
* Check if a position (in document coordinates) falls within a page gap.
|
|
58
|
+
*/
|
|
59
|
+
private isInPageGap;
|
|
60
|
+
/**
|
|
61
|
+
* Render cursor position indicator.
|
|
62
|
+
*/
|
|
63
|
+
protected renderCursorIndicator(width: number, _height: number): void;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=VerticalRuler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VerticalRuler.d.ts","sourceRoot":"","sources":["../../../../../src/lib/controls/rulers/VerticalRuler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxE;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;IAC7C,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAc;IAC9D,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,UAAU,CAAa;gBAEnB,OAAO,GAAE,YAAiB;IAItC;;OAEG;IACH,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAMpC;;OAEG;IACH,SAAS,CAAC,gBAAgB,IAAI,MAAM;IAIpC;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE;QACnC,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;QACtE,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,GAAG,IAAI;IAyBf;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA0D5D;;;OAGG;IACH,SAAS,CAAC,kBAAkB,IAAI,QAAQ,EAAE;IA4C1C;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IA4C9E;;OAEG;IACH,OAAO,CAAC,WAAW;IAWnB;;OAEG;IACH,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;CActE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/controls/rulers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for ruler controls.
|
|
3
|
+
*/
|
|
4
|
+
import type { Units, ControlOptions } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Options for creating a ruler control.
|
|
7
|
+
*/
|
|
8
|
+
export interface RulerOptions extends ControlOptions {
|
|
9
|
+
/** Measurement units to display */
|
|
10
|
+
units?: Units;
|
|
11
|
+
/** Interval for major tick marks (in the specified units) */
|
|
12
|
+
majorTickInterval?: number;
|
|
13
|
+
/** Number of minor ticks between major ticks */
|
|
14
|
+
minorTicksPerMajor?: number;
|
|
15
|
+
/** Whether to show labels on major ticks */
|
|
16
|
+
showLabels?: boolean;
|
|
17
|
+
/** Thickness of the ruler in pixels */
|
|
18
|
+
thickness?: number;
|
|
19
|
+
/** Background color */
|
|
20
|
+
backgroundColor?: string;
|
|
21
|
+
/** Color for tick marks */
|
|
22
|
+
tickColor?: string;
|
|
23
|
+
/** Color for labels */
|
|
24
|
+
labelColor?: string;
|
|
25
|
+
/** Color for the active position indicator */
|
|
26
|
+
activeColor?: string;
|
|
27
|
+
/** Font size for labels */
|
|
28
|
+
labelFontSize?: number;
|
|
29
|
+
/** Whether to show margin indicators */
|
|
30
|
+
showMargins?: boolean;
|
|
31
|
+
/** Color for margin indicators */
|
|
32
|
+
marginColor?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Default ruler options.
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEFAULT_RULER_OPTIONS: Required<RulerOptions>;
|
|
38
|
+
/**
|
|
39
|
+
* Ruler orientation.
|
|
40
|
+
*/
|
|
41
|
+
export type RulerOrientation = 'horizontal' | 'vertical';
|
|
42
|
+
/**
|
|
43
|
+
* A tick mark on the ruler.
|
|
44
|
+
*/
|
|
45
|
+
export interface TickMark {
|
|
46
|
+
/** Position in pixels (from ruler start) */
|
|
47
|
+
position: number;
|
|
48
|
+
/** Whether this is a major tick */
|
|
49
|
+
isMajor: boolean;
|
|
50
|
+
/** Label text (for major ticks with labels) */
|
|
51
|
+
label?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Conversion factors from various units to pixels.
|
|
55
|
+
* Based on 96 DPI standard.
|
|
56
|
+
*/
|
|
57
|
+
export declare const PIXELS_PER_UNIT: Record<Units, number>;
|
|
58
|
+
/**
|
|
59
|
+
* Get pixels per unit for a given unit type.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getPixelsPerUnit(units: Units): number;
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/controls/rulers/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,cAAc;IAClD,mCAAmC;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,6DAA6D;IAC7D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gDAAgD;IAChD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,YAAY,CAcxD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,UAAU,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,4CAA4C;IAC5C,QAA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