@docx-editor.dev/core 0.0.1 → 2.1.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/LICENSE +201 -0
- package/README.md +91 -2
- package/THIRD_PARTY_NOTICES.md +18 -0
- package/dist/automation.cjs +1 -0
- package/dist/automation.d.cts +74 -0
- package/dist/automation.d.ts +74 -0
- package/dist/automation.js +1 -0
- package/dist/binding.cjs +1 -0
- package/dist/binding.d.cts +88 -0
- package/dist/binding.d.ts +88 -0
- package/dist/binding.js +1 -0
- package/dist/chunk-2DTQDAN7.js +2 -0
- package/dist/chunk-3JKQE4QJ.cjs +2 -0
- package/dist/chunk-4WWEDTTE.js +2 -0
- package/dist/chunk-6WIIHJFY.js +1 -0
- package/dist/chunk-7VQ7YLW3.cjs +1 -0
- package/dist/chunk-BS554B6D.cjs +2 -0
- package/dist/chunk-BZK64YU3.cjs +10 -0
- package/dist/chunk-CZFUMACF.cjs +12 -0
- package/dist/chunk-GQQOL4PV.js +1 -0
- package/dist/chunk-HBL3NNH5.cjs +1 -0
- package/dist/chunk-JQFDLZXQ.cjs +2 -0
- package/dist/chunk-O2WQY7IT.cjs +5 -0
- package/dist/chunk-PC76F2HR.cjs +1 -0
- package/dist/chunk-QRAUDDVY.js +2 -0
- package/dist/chunk-REZUWYB7.js +1 -0
- package/dist/chunk-STCITBJK.js +12 -0
- package/dist/chunk-TBBXCC7D.js +5 -0
- package/dist/chunk-TSXT537P.cjs +12 -0
- package/dist/chunk-WOGYVM3W.js +12 -0
- package/dist/chunk-Y7TA7TPF.js +10 -0
- package/dist/content-control-walk-CbTqHq6O.d.cts +56 -0
- package/dist/content-control-walk-D06GijR0.d.ts +56 -0
- package/dist/contracts/document.cjs +1 -0
- package/dist/contracts/document.d.cts +246 -0
- package/dist/contracts/document.d.ts +246 -0
- package/dist/contracts/document.js +0 -0
- package/dist/contracts/editor.cjs +1 -0
- package/dist/contracts/editor.d.cts +11 -0
- package/dist/contracts/editor.d.ts +11 -0
- package/dist/contracts/editor.js +1 -0
- package/dist/contracts/interaction.cjs +1 -0
- package/dist/contracts/interaction.d.cts +11 -0
- package/dist/contracts/interaction.d.ts +11 -0
- package/dist/contracts/interaction.js +0 -0
- package/dist/contracts/modules.cjs +1 -0
- package/dist/contracts/modules.d.cts +117 -0
- package/dist/contracts/modules.d.ts +117 -0
- package/dist/contracts/modules.js +1 -0
- package/dist/contracts/types.cjs +1 -0
- package/dist/contracts/types.d.cts +452 -0
- package/dist/contracts/types.d.ts +452 -0
- package/dist/contracts/types.js +0 -0
- package/dist/custom-node-writes-YqISlSRl.d.cts +885 -0
- package/dist/custom-node-writes-ttKuYd0M.d.ts +885 -0
- package/dist/editor-B93PggnR.d.cts +1690 -0
- package/dist/editor-CFsSrxGR.d.ts +1690 -0
- package/dist/editor.cjs +1 -0
- package/dist/editor.css +7106 -0
- package/dist/editor.d.cts +271 -0
- package/dist/editor.d.ts +271 -0
- package/dist/editor.js +1 -0
- package/dist/hf-references-BdjsQNE_.d.ts +71 -0
- package/dist/hf-references-CgEOSw3i.d.cts +71 -0
- package/dist/image-resources-C_YnqPhn.d.ts +203 -0
- package/dist/image-resources-DwpNnTg3.d.cts +203 -0
- package/dist/index-BjZelfWL.d.cts +2532 -0
- package/dist/index-DP1yJJ3R.d.ts +2532 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +1 -0
- package/dist/layout.cjs +1 -0
- package/dist/layout.d.cts +2366 -0
- package/dist/layout.d.ts +2366 -0
- package/dist/layout.js +1 -0
- package/dist/note-nodes-BPSTVDMr.d.ts +108 -0
- package/dist/note-nodes-C6DLxlvj.d.cts +108 -0
- package/dist/ooxml-package-CR5us6ad.d.cts +354 -0
- package/dist/ooxml-package-D_CtywTW.d.ts +354 -0
- package/dist/ooxml-tree-BU0e3DVi.d.cts +871 -0
- package/dist/ooxml-tree-BU0e3DVi.d.ts +871 -0
- package/dist/output.cjs +1 -0
- package/dist/output.d.cts +158 -0
- package/dist/output.d.ts +158 -0
- package/dist/output.js +1 -0
- package/dist/protocol-BWVA3Q1p.d.ts +1255 -0
- package/dist/protocol-FAz_nPm_.d.cts +1255 -0
- package/dist/review-reads-CsoXSvUg.d.ts +401 -0
- package/dist/review-reads-qW0jvdF1.d.cts +401 -0
- package/dist/review-support-D64Wu236.d.cts +358 -0
- package/dist/review-support-nsLXC9jf.d.ts +358 -0
- package/dist/revision-projection-72ZApe-g.d.cts +84 -0
- package/dist/revision-projection-DHAkcD_L.d.ts +84 -0
- package/dist/semantic-cell-selection-D_8RbPII.d.ts +427 -0
- package/dist/semantic-cell-selection-DwLB71fF.d.cts +427 -0
- package/dist/semantic-interaction-CXH2wFqi.d.ts +187 -0
- package/dist/semantic-interaction-DqcEonqD.d.cts +187 -0
- package/dist/semantic-paint-drawings-B5Wk2so5.d.ts +21 -0
- package/dist/semantic-paint-drawings-x8g44lD_.d.cts +21 -0
- package/dist/semantic-records-COVFW5aS.d.cts +1505 -0
- package/dist/semantic-records-zTC0_1zi.d.ts +1505 -0
- package/dist/shaped-measurer-AFnFxoot.d.cts +613 -0
- package/dist/shaped-measurer-CZXL-a6v.d.ts +613 -0
- package/dist/store.cjs +1 -0
- package/dist/store.d.cts +2153 -0
- package/dist/store.d.ts +2153 -0
- package/dist/store.js +1 -0
- package/dist/tree-op-types-DWLCllG7.d.ts +1486 -0
- package/dist/tree-op-types-UOXlRUqQ.d.cts +1486 -0
- package/dist/tree-session-BtVFXsF6.d.ts +580 -0
- package/dist/tree-session-DxIOHUOD.d.cts +580 -0
- package/dist/tree-store-B1lEkdXc.d.cts +273 -0
- package/dist/tree-store-BscFPB7x.d.ts +273 -0
- package/package.json +110 -8
- package/index.js +0 -1
package/dist/output.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk3JKQE4QJ_cjs=require('./chunk-3JKQE4QJ.cjs');require('./chunk-TSXT537P.cjs'),require('./chunk-BS554B6D.cjs'),require('./chunk-JQFDLZXQ.cjs'),require('./chunk-BZK64YU3.cjs');Object.defineProperty(exports,"paintSelectionOverlay",{enumerable:true,get:function(){return chunk3JKQE4QJ_cjs.e}});Object.defineProperty(exports,"paintSemanticLayout",{enumerable:true,get:function(){return chunk3JKQE4QJ_cjs.d}});
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { C as ContentControlBoundaryRecord, S as SemanticLayout } from './semantic-records-COVFW5aS.cjs';
|
|
2
|
+
import { D as DrawingPaintStrings, P as PaintImageUrlPort } from './semantic-paint-drawings-x8g44lD_.cjs';
|
|
3
|
+
import './tree-op-types-UOXlRUqQ.cjs';
|
|
4
|
+
import './ooxml-tree-BU0e3DVi.cjs';
|
|
5
|
+
import './image-resources-DwpNnTg3.cjs';
|
|
6
|
+
import './ooxml-package-CR5us6ad.cjs';
|
|
7
|
+
import './revision-projection-72ZApe-g.cjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* How a layout is painted into DOM. Every field is optional.
|
|
11
|
+
*
|
|
12
|
+
* The painted pages ARE the editable surface, so everything here is presentation-only — nothing
|
|
13
|
+
* set through these options is ever serialised back into the document.
|
|
14
|
+
*/
|
|
15
|
+
interface PaintOptions {
|
|
16
|
+
/** Points to CSS pixels. 96/72 renders a point as a CSS point at 100% zoom. */
|
|
17
|
+
readonly scale?: number;
|
|
18
|
+
/** Generated paragraphs that paint as non-editable navigation surfaces. */
|
|
19
|
+
readonly readOnlyParagraphIds?: ReadonlySet<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Empty-TOC begin paragraphs that paint subtle identifiable furniture. Paint-only — never
|
|
22
|
+
* serialised into the document.
|
|
23
|
+
*/
|
|
24
|
+
readonly emptyTocPlaceholderIds?: ReadonlySet<string>;
|
|
25
|
+
/** Marks painted pages as presentational, so assistive tech reads the editable projection. */
|
|
26
|
+
readonly ariaHidden?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Page indices to build in detail (task 9.4).
|
|
29
|
+
*
|
|
30
|
+
* Omitted means all of them. A page left out keeps its size and position but no content,
|
|
31
|
+
* so the document's height and page count are unchanged and scrolling to it reveals it
|
|
32
|
+
* instead of reflowing everything underneath.
|
|
33
|
+
*/
|
|
34
|
+
readonly materialize?: ReadonlySet<number>;
|
|
35
|
+
/**
|
|
36
|
+
* Family-alias lookup for fonts the host registered on behalf of THIS document (see
|
|
37
|
+
* {@link PaintContext.fontAlias}). Painted runs emit the alias ahead of the declared
|
|
38
|
+
* family, so a file can never shadow a family name the host page uses.
|
|
39
|
+
*/
|
|
40
|
+
readonly fontAlias?: (family: string) => string | undefined;
|
|
41
|
+
/** See {@link PaintContext.defaultFontFamily}. */
|
|
42
|
+
readonly defaultFontFamily?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Relationship id of the header/footer story currently open for editing.
|
|
45
|
+
*
|
|
46
|
+
* When set, the matching `[data-docx-hf]` container is editable and every body
|
|
47
|
+
* `.docx-page-content` box is inert; all other furniture stays read-only.
|
|
48
|
+
*/
|
|
49
|
+
readonly activeHeaderFooterRId?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Sheet that hosts the active visual occurrence of a shared furniture part.
|
|
52
|
+
*
|
|
53
|
+
* Required with {@link activeHeaderFooterRId} so only one painted copy receives
|
|
54
|
+
* `data-docx-hf-active` / the engine caret when the same rId appears on many pages.
|
|
55
|
+
*/
|
|
56
|
+
readonly activeHeaderFooterPageIndex?: number;
|
|
57
|
+
/**
|
|
58
|
+
* On-demand content-control boundary chrome (show-all and/or caret-entry).
|
|
59
|
+
*
|
|
60
|
+
* Furniture only — never contributes layout records or changes page geometry. Omitted or
|
|
61
|
+
* empty means no control chrome is painted. Folded into the paint-reuse key so a toggle
|
|
62
|
+
* rebuilds furniture without a layout pass.
|
|
63
|
+
*/
|
|
64
|
+
readonly contentControlChrome?: {
|
|
65
|
+
readonly showAll?: boolean;
|
|
66
|
+
/** Control ids whose boundaries are visible because the caret is inside them. */
|
|
67
|
+
readonly activeIds?: ReadonlySet<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Control ids whose boundaries are visible because the pointer is over them.
|
|
70
|
+
* Used for TOC hover chrome without projecting a persistent caret-active state.
|
|
71
|
+
*
|
|
72
|
+
* Deliberately OUTSIDE the paint-reuse key: hover must never rebuild a page. The
|
|
73
|
+
* surface toggles `data-hover` / `data-boundary-visible` on the painted chrome it
|
|
74
|
+
* already has, and this set only tells a page that rebuilds for some OTHER reason
|
|
75
|
+
* which of its controls is currently under the pointer.
|
|
76
|
+
*/
|
|
77
|
+
readonly hoverIds?: ReadonlySet<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Control ids whose boundary furniture is painted by something else.
|
|
80
|
+
*
|
|
81
|
+
* An empty TOC paints its own placeholder box on the begin paragraph, so drawing the
|
|
82
|
+
* control boundary as well left two rounded rectangles (of different heights) plus a
|
|
83
|
+
* label chip stacked over one empty region.
|
|
84
|
+
*/
|
|
85
|
+
readonly suppressedIds?: ReadonlySet<string>;
|
|
86
|
+
/** Checkbox control ids whose canonical `w14:checked` state is on. */
|
|
87
|
+
readonly checkedIds?: ReadonlySet<string>;
|
|
88
|
+
/** Non-SDT structured regions that intentionally reuse content-control chrome. */
|
|
89
|
+
readonly additionalBoundaries?: readonly ContentControlBoundaryRecord[];
|
|
90
|
+
/** Control ids that represent TOC regions (hover-only chrome; never caret-sticky). */
|
|
91
|
+
readonly tocControlIds?: ReadonlySet<string>;
|
|
92
|
+
};
|
|
93
|
+
readonly drawingStrings?: DrawingPaintStrings;
|
|
94
|
+
readonly imageUrlPort?: PaintImageUrlPort;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Paint a whole layout into a container, reusing the pages that did not change.
|
|
99
|
+
*
|
|
100
|
+
* The DOM is built with `createElement` and `textContent` only — no file-derived string is
|
|
101
|
+
* ever parsed as markup — and stray children (nothing this module painted) are removed, so
|
|
102
|
+
* the container's content is always exactly the painted pages.
|
|
103
|
+
*/
|
|
104
|
+
declare function paintSemanticLayout(container: HTMLElement, layout: SemanticLayout, options?: PaintOptions): void;
|
|
105
|
+
|
|
106
|
+
/** A rectangle in page-content coordinates, on a named page. */
|
|
107
|
+
interface OverlayRect {
|
|
108
|
+
readonly pageIndex: number;
|
|
109
|
+
readonly x: number;
|
|
110
|
+
readonly y: number;
|
|
111
|
+
readonly width: number;
|
|
112
|
+
readonly height: number;
|
|
113
|
+
/**
|
|
114
|
+
* Class for THIS rectangle, overriding the layer's default.
|
|
115
|
+
*
|
|
116
|
+
* One layer draws bands that mean different things — every commented range, and the one the
|
|
117
|
+
* caret is in — and splitting them into two layers would stack two absolutely positioned
|
|
118
|
+
* sheets over the pages just to vary a colour.
|
|
119
|
+
*/
|
|
120
|
+
readonly className?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* How the selection overlay draws its rectangles over the painted pages.
|
|
124
|
+
*
|
|
125
|
+
* `scale` and `pageOffsetX` must match what the page painter used, or the highlight lands beside
|
|
126
|
+
* the content it describes rather than on it.
|
|
127
|
+
*/
|
|
128
|
+
interface SelectionOverlayOptions {
|
|
129
|
+
/** Points to CSS pixels. */
|
|
130
|
+
readonly scale: number;
|
|
131
|
+
/**
|
|
132
|
+
* Per-page horizontal offset the page painter applied, by page index.
|
|
133
|
+
*
|
|
134
|
+
* A document whose pages differ in width centres each one individually, so a page is drawn
|
|
135
|
+
* at an x its record does not carry. Without the same offset here a highlight would sit
|
|
136
|
+
* beside the cells it describes.
|
|
137
|
+
*/
|
|
138
|
+
readonly pageOffsetX?: ReadonlyMap<number, number>;
|
|
139
|
+
/**
|
|
140
|
+
* Class for each painted rectangle. Defaults to the cell-selection class, because a cell
|
|
141
|
+
* rectangle was the only thing this layer drew when it was written.
|
|
142
|
+
*
|
|
143
|
+
* A retained TEXT range is drawn here too and must not look like selected cells — one is
|
|
144
|
+
* "these cells are chosen", the other is "your selection is still here while you type in
|
|
145
|
+
* this panel". Same geometry, different meaning, so the caller names the class.
|
|
146
|
+
*/
|
|
147
|
+
readonly className?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Draw a set of rectangles over the pages.
|
|
151
|
+
*
|
|
152
|
+
* The layer is a SIBLING of the pages, never a child: the page painter sweeps anything it did
|
|
153
|
+
* not paint out of its own subtree, and a stray child of a contenteditable is editable content
|
|
154
|
+
* a keystroke could land in.
|
|
155
|
+
*/
|
|
156
|
+
declare function paintSelectionOverlay(layer: HTMLElement, layout: SemanticLayout, rects: readonly OverlayRect[], options: SelectionOverlayOptions): void;
|
|
157
|
+
|
|
158
|
+
export { type OverlayRect, type PaintOptions, type SelectionOverlayOptions, paintSelectionOverlay, paintSemanticLayout };
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { C as ContentControlBoundaryRecord, S as SemanticLayout } from './semantic-records-zTC0_1zi.js';
|
|
2
|
+
import { D as DrawingPaintStrings, P as PaintImageUrlPort } from './semantic-paint-drawings-B5Wk2so5.js';
|
|
3
|
+
import './tree-op-types-DWLCllG7.js';
|
|
4
|
+
import './ooxml-tree-BU0e3DVi.js';
|
|
5
|
+
import './image-resources-C_YnqPhn.js';
|
|
6
|
+
import './ooxml-package-D_CtywTW.js';
|
|
7
|
+
import './revision-projection-DHAkcD_L.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* How a layout is painted into DOM. Every field is optional.
|
|
11
|
+
*
|
|
12
|
+
* The painted pages ARE the editable surface, so everything here is presentation-only — nothing
|
|
13
|
+
* set through these options is ever serialised back into the document.
|
|
14
|
+
*/
|
|
15
|
+
interface PaintOptions {
|
|
16
|
+
/** Points to CSS pixels. 96/72 renders a point as a CSS point at 100% zoom. */
|
|
17
|
+
readonly scale?: number;
|
|
18
|
+
/** Generated paragraphs that paint as non-editable navigation surfaces. */
|
|
19
|
+
readonly readOnlyParagraphIds?: ReadonlySet<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Empty-TOC begin paragraphs that paint subtle identifiable furniture. Paint-only — never
|
|
22
|
+
* serialised into the document.
|
|
23
|
+
*/
|
|
24
|
+
readonly emptyTocPlaceholderIds?: ReadonlySet<string>;
|
|
25
|
+
/** Marks painted pages as presentational, so assistive tech reads the editable projection. */
|
|
26
|
+
readonly ariaHidden?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Page indices to build in detail (task 9.4).
|
|
29
|
+
*
|
|
30
|
+
* Omitted means all of them. A page left out keeps its size and position but no content,
|
|
31
|
+
* so the document's height and page count are unchanged and scrolling to it reveals it
|
|
32
|
+
* instead of reflowing everything underneath.
|
|
33
|
+
*/
|
|
34
|
+
readonly materialize?: ReadonlySet<number>;
|
|
35
|
+
/**
|
|
36
|
+
* Family-alias lookup for fonts the host registered on behalf of THIS document (see
|
|
37
|
+
* {@link PaintContext.fontAlias}). Painted runs emit the alias ahead of the declared
|
|
38
|
+
* family, so a file can never shadow a family name the host page uses.
|
|
39
|
+
*/
|
|
40
|
+
readonly fontAlias?: (family: string) => string | undefined;
|
|
41
|
+
/** See {@link PaintContext.defaultFontFamily}. */
|
|
42
|
+
readonly defaultFontFamily?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Relationship id of the header/footer story currently open for editing.
|
|
45
|
+
*
|
|
46
|
+
* When set, the matching `[data-docx-hf]` container is editable and every body
|
|
47
|
+
* `.docx-page-content` box is inert; all other furniture stays read-only.
|
|
48
|
+
*/
|
|
49
|
+
readonly activeHeaderFooterRId?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Sheet that hosts the active visual occurrence of a shared furniture part.
|
|
52
|
+
*
|
|
53
|
+
* Required with {@link activeHeaderFooterRId} so only one painted copy receives
|
|
54
|
+
* `data-docx-hf-active` / the engine caret when the same rId appears on many pages.
|
|
55
|
+
*/
|
|
56
|
+
readonly activeHeaderFooterPageIndex?: number;
|
|
57
|
+
/**
|
|
58
|
+
* On-demand content-control boundary chrome (show-all and/or caret-entry).
|
|
59
|
+
*
|
|
60
|
+
* Furniture only — never contributes layout records or changes page geometry. Omitted or
|
|
61
|
+
* empty means no control chrome is painted. Folded into the paint-reuse key so a toggle
|
|
62
|
+
* rebuilds furniture without a layout pass.
|
|
63
|
+
*/
|
|
64
|
+
readonly contentControlChrome?: {
|
|
65
|
+
readonly showAll?: boolean;
|
|
66
|
+
/** Control ids whose boundaries are visible because the caret is inside them. */
|
|
67
|
+
readonly activeIds?: ReadonlySet<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Control ids whose boundaries are visible because the pointer is over them.
|
|
70
|
+
* Used for TOC hover chrome without projecting a persistent caret-active state.
|
|
71
|
+
*
|
|
72
|
+
* Deliberately OUTSIDE the paint-reuse key: hover must never rebuild a page. The
|
|
73
|
+
* surface toggles `data-hover` / `data-boundary-visible` on the painted chrome it
|
|
74
|
+
* already has, and this set only tells a page that rebuilds for some OTHER reason
|
|
75
|
+
* which of its controls is currently under the pointer.
|
|
76
|
+
*/
|
|
77
|
+
readonly hoverIds?: ReadonlySet<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Control ids whose boundary furniture is painted by something else.
|
|
80
|
+
*
|
|
81
|
+
* An empty TOC paints its own placeholder box on the begin paragraph, so drawing the
|
|
82
|
+
* control boundary as well left two rounded rectangles (of different heights) plus a
|
|
83
|
+
* label chip stacked over one empty region.
|
|
84
|
+
*/
|
|
85
|
+
readonly suppressedIds?: ReadonlySet<string>;
|
|
86
|
+
/** Checkbox control ids whose canonical `w14:checked` state is on. */
|
|
87
|
+
readonly checkedIds?: ReadonlySet<string>;
|
|
88
|
+
/** Non-SDT structured regions that intentionally reuse content-control chrome. */
|
|
89
|
+
readonly additionalBoundaries?: readonly ContentControlBoundaryRecord[];
|
|
90
|
+
/** Control ids that represent TOC regions (hover-only chrome; never caret-sticky). */
|
|
91
|
+
readonly tocControlIds?: ReadonlySet<string>;
|
|
92
|
+
};
|
|
93
|
+
readonly drawingStrings?: DrawingPaintStrings;
|
|
94
|
+
readonly imageUrlPort?: PaintImageUrlPort;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Paint a whole layout into a container, reusing the pages that did not change.
|
|
99
|
+
*
|
|
100
|
+
* The DOM is built with `createElement` and `textContent` only — no file-derived string is
|
|
101
|
+
* ever parsed as markup — and stray children (nothing this module painted) are removed, so
|
|
102
|
+
* the container's content is always exactly the painted pages.
|
|
103
|
+
*/
|
|
104
|
+
declare function paintSemanticLayout(container: HTMLElement, layout: SemanticLayout, options?: PaintOptions): void;
|
|
105
|
+
|
|
106
|
+
/** A rectangle in page-content coordinates, on a named page. */
|
|
107
|
+
interface OverlayRect {
|
|
108
|
+
readonly pageIndex: number;
|
|
109
|
+
readonly x: number;
|
|
110
|
+
readonly y: number;
|
|
111
|
+
readonly width: number;
|
|
112
|
+
readonly height: number;
|
|
113
|
+
/**
|
|
114
|
+
* Class for THIS rectangle, overriding the layer's default.
|
|
115
|
+
*
|
|
116
|
+
* One layer draws bands that mean different things — every commented range, and the one the
|
|
117
|
+
* caret is in — and splitting them into two layers would stack two absolutely positioned
|
|
118
|
+
* sheets over the pages just to vary a colour.
|
|
119
|
+
*/
|
|
120
|
+
readonly className?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* How the selection overlay draws its rectangles over the painted pages.
|
|
124
|
+
*
|
|
125
|
+
* `scale` and `pageOffsetX` must match what the page painter used, or the highlight lands beside
|
|
126
|
+
* the content it describes rather than on it.
|
|
127
|
+
*/
|
|
128
|
+
interface SelectionOverlayOptions {
|
|
129
|
+
/** Points to CSS pixels. */
|
|
130
|
+
readonly scale: number;
|
|
131
|
+
/**
|
|
132
|
+
* Per-page horizontal offset the page painter applied, by page index.
|
|
133
|
+
*
|
|
134
|
+
* A document whose pages differ in width centres each one individually, so a page is drawn
|
|
135
|
+
* at an x its record does not carry. Without the same offset here a highlight would sit
|
|
136
|
+
* beside the cells it describes.
|
|
137
|
+
*/
|
|
138
|
+
readonly pageOffsetX?: ReadonlyMap<number, number>;
|
|
139
|
+
/**
|
|
140
|
+
* Class for each painted rectangle. Defaults to the cell-selection class, because a cell
|
|
141
|
+
* rectangle was the only thing this layer drew when it was written.
|
|
142
|
+
*
|
|
143
|
+
* A retained TEXT range is drawn here too and must not look like selected cells — one is
|
|
144
|
+
* "these cells are chosen", the other is "your selection is still here while you type in
|
|
145
|
+
* this panel". Same geometry, different meaning, so the caller names the class.
|
|
146
|
+
*/
|
|
147
|
+
readonly className?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Draw a set of rectangles over the pages.
|
|
151
|
+
*
|
|
152
|
+
* The layer is a SIBLING of the pages, never a child: the page painter sweeps anything it did
|
|
153
|
+
* not paint out of its own subtree, and a stray child of a contenteditable is editable content
|
|
154
|
+
* a keystroke could land in.
|
|
155
|
+
*/
|
|
156
|
+
declare function paintSelectionOverlay(layer: HTMLElement, layout: SemanticLayout, rects: readonly OverlayRect[], options: SelectionOverlayOptions): void;
|
|
157
|
+
|
|
158
|
+
export { type OverlayRect, type PaintOptions, type SelectionOverlayOptions, paintSelectionOverlay, paintSemanticLayout };
|
package/dist/output.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{e as paintSelectionOverlay,d as paintSemanticLayout}from'./chunk-QRAUDDVY.js';import'./chunk-STCITBJK.js';import'./chunk-4WWEDTTE.js';import'./chunk-2DTQDAN7.js';import'./chunk-Y7TA7TPF.js';
|