@betteroffice/docx 0.0.2 → 0.0.4
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/README.md +20 -7
- package/dist/chunk-4V6MDZIK.mjs +1 -0
- package/dist/chunk-6KDV6AIL.mjs +1 -0
- package/dist/chunk-CTBUQRYQ.mjs +1 -0
- package/dist/chunk-GGEGIQRK.mjs +1 -0
- package/dist/chunk-J7LNO6SM.mjs +1 -0
- package/dist/{chunk-IFT6DUJX.mjs → chunk-LTVVQMHB.mjs} +1 -1
- package/dist/chunk-NBSLB77E.mjs +1 -0
- package/dist/chunk-NTSSE5QK.mjs +57 -0
- package/dist/chunk-YTILOUAA.mjs +16 -0
- package/dist/collaboration/index.d.mts +31 -6
- package/dist/collaboration/index.mjs +1 -1
- package/dist/{content-DLFHRQav.d.mts → content-C3sTRz-u.d.mts} +115 -248
- package/dist/core.d.mts +6 -6
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-UGc_XBUv.d.mts → displayListQueries-DLzpvJV6.d.mts} +36 -7
- package/dist/docx/index.d.mts +3 -3
- package/dist/docx/index.mjs +1 -1
- package/dist/editor/index.d.mts +7 -6
- package/dist/{fontLoader-aSewHMKF.d.mts → fontLoader-CMH3bZ2Z.d.mts} +127 -2
- package/dist/{formatting-D1EPSaJP.d.mts → formatting-BEkIBePP.d.mts} +77 -203
- package/dist/{rustDisplayList-CX78djsZ.d.mts → frameDelta-B2kC6XiP.d.mts} +5 -274
- package/dist/generated/edit/docx_edit_bg.wasm +0 -0
- package/dist/generated/layout/docx_layout_bg.wasm +0 -0
- package/dist/generated/parse/docx_parse_bg.wasm +0 -0
- package/dist/{index-Bwxm3oiC.d.mts → index-2piKi4gO.d.mts} +147 -8
- package/dist/layout/index.d.mts +8 -6
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +4 -4
- package/dist/layout/pagination/index.mjs +1 -1
- package/dist/layout/render/index.d.mts +10 -9
- package/dist/layout/render/index.mjs +1 -1
- package/dist/plugin-api/RenderedDomContext.d.mts +7 -6
- package/dist/plugin-api/index.d.mts +3 -3
- package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
- package/dist/rustDisplayList-B0M2eBkU.d.mts +283 -0
- package/dist/styles/index.d.mts +2 -2
- package/dist/{styles-Dn_o3Vo5.d.mts → styles-BK3Jecxs.d.mts} +1 -1
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +6 -6
- package/dist/{types-DMkDbvEu.d.mts → types-C1rv3KM-.d.mts} +2 -2
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/index.d.mts +4 -4
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/utils/units.d.mts +4 -34
- package/dist/utils/units.mjs +1 -1
- package/dist/wasm-F2ETFAYL.mjs +1 -0
- package/dist/wasm-JE7B3ROD.mjs +1 -0
- package/dist/wasm-edit.d.mts +25 -0
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-layout.d.mts +14 -1
- package/dist/wasm-layout.mjs +1 -1
- package/dist/yrs/index.d.mts +5 -4
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +1 -2
- package/dist/chunk-3UBMCDME.mjs +0 -1
- package/dist/chunk-6NEKRDXF.mjs +0 -1
- package/dist/chunk-AEQOEQJ7.mjs +0 -57
- package/dist/chunk-AZ52IWB6.mjs +0 -16
- package/dist/chunk-CIRN3LZA.mjs +0 -1
- package/dist/chunk-NTQM4EYN.mjs +0 -1
- package/dist/wasm-BGQBTR2J.mjs +0 -1
- package/dist/wasm-SA237OSP.mjs +0 -1
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { a as Layout } from './types-C1rv3KM-.mjs';
|
|
2
|
+
import { MeasuredBlock } from './layout/pagination/index.mjs';
|
|
3
|
+
import { D as DisplayList, R as RetainedFrame } from './frameDelta-B2kC6XiP.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* JS seam to the Rust display-list builder (crates/docx-layout).
|
|
7
|
+
*
|
|
8
|
+
* Marshals the same `{ measured, options, layout }` triple the golden
|
|
9
|
+
* fixtures pin (see scripts/export-displaylist-fixtures.ts) across the wasm
|
|
10
|
+
* boundary and parses the resulting DisplayList. All paint/geometry decisions
|
|
11
|
+
* happen in Rust — this module is serialization glue only.
|
|
12
|
+
*
|
|
13
|
+
* The wasm module is loaded lazily via dynamic import on first build, so the
|
|
14
|
+
* ~800KB inlined binary costs nothing until the experimental canvas renderer
|
|
15
|
+
* is actually enabled.
|
|
16
|
+
*
|
|
17
|
+
* @experimental part of the rust-canvas-engine change; shape may evolve.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* One header/footer part in the `headersFooters` envelope field: the measured
|
|
22
|
+
* blocks of the HF ProseMirror doc identified by `rId`, plus the band metrics
|
|
23
|
+
* `convertHeaderFooterPmDocToContent` computed (passed through verbatim — the
|
|
24
|
+
* Rust builder re-derives nothing).
|
|
25
|
+
*/
|
|
26
|
+
interface DisplayListHfVariant {
|
|
27
|
+
rId: string;
|
|
28
|
+
kind: 'header' | 'footer';
|
|
29
|
+
type: 'default' | 'first' | 'even';
|
|
30
|
+
/** `toMeasuredBlocks(content.blocks, content.measures)` — same schema as body `measured` */
|
|
31
|
+
measured: MeasuredBlock[];
|
|
32
|
+
/** HeaderFooterContent.height (in-flow stack incl. floating blocks) */
|
|
33
|
+
height: number;
|
|
34
|
+
/** HeaderFooterContent.flowHeight (in-flow band height; fallback: height) */
|
|
35
|
+
flowHeight?: number;
|
|
36
|
+
visualTop?: number;
|
|
37
|
+
visualBottom?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Per-page resolved widths of PAGE/NUMPAGES field runs in this HF part, so a
|
|
40
|
+
* centered/right-aligned line carrying such a field re-centers per page. The
|
|
41
|
+
* line width is measured ONCE at the field's fallback text ("1"), so without
|
|
42
|
+
* this the builder holds the same centered position on every page even though
|
|
43
|
+
* "Page 2 of 3"/"Page 10 of 12" have different widths. Omitted ⇒ the fields
|
|
44
|
+
* ride the char-distributed fallback width (byte-identical to before).
|
|
45
|
+
*/
|
|
46
|
+
fieldWidths?: DisplayListFieldWidths[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Per-page widths of one PAGE/NUMPAGES field run in an HF part. `pmStart` is the
|
|
50
|
+
* field run's position in the HF ProseMirror doc (the key the Rust builder
|
|
51
|
+
* matches). `fallbackWidth` is the width the measure baked into `line.width`
|
|
52
|
+
* (the field's fallback text); `perPage[i]` is the width of the field's resolved
|
|
53
|
+
* text on layout page index `i` (PAGE → that page's number, NUMPAGES → total).
|
|
54
|
+
*/
|
|
55
|
+
interface DisplayListFieldWidths {
|
|
56
|
+
pmStart: number;
|
|
57
|
+
fallbackWidth: number;
|
|
58
|
+
perPage: number[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Optional header/footer payload of the builder envelope. Absent ⇒ the Rust
|
|
62
|
+
* output is byte-identical to the body-only build. Flags come off the section
|
|
63
|
+
* properties / settings the DOM painter uses; distances are the same px the
|
|
64
|
+
* painter resolves (`headerDistance ?? page.margins.header ?? 48`).
|
|
65
|
+
*/
|
|
66
|
+
interface DisplayListHeadersFooters {
|
|
67
|
+
titlePg?: boolean;
|
|
68
|
+
evenAndOddHeaders?: boolean;
|
|
69
|
+
headerDistance?: number;
|
|
70
|
+
footerDistance?: number;
|
|
71
|
+
/** Page-level Word watermark, painted behind body/header/footer content. */
|
|
72
|
+
watermark?: DisplayListWatermark;
|
|
73
|
+
variants: DisplayListHfVariant[];
|
|
74
|
+
/** Stable section identity. Undefined = document-global legacy envelope. */
|
|
75
|
+
sectionId?: string;
|
|
76
|
+
/** Zero-based section index. */
|
|
77
|
+
sectionIndex?: number;
|
|
78
|
+
}
|
|
79
|
+
type DisplayListWatermark = DisplayListTextWatermark | DisplayListPictureWatermark;
|
|
80
|
+
interface DisplayListTextWatermark {
|
|
81
|
+
kind: 'text';
|
|
82
|
+
text: string;
|
|
83
|
+
font: string;
|
|
84
|
+
color: string;
|
|
85
|
+
semitransparent: boolean;
|
|
86
|
+
layout: 'diagonal' | 'horizontal';
|
|
87
|
+
fontSize?: number;
|
|
88
|
+
/** Undefined defaults to true for watermarks. */
|
|
89
|
+
decorative?: boolean;
|
|
90
|
+
}
|
|
91
|
+
interface DisplayListPictureWatermark {
|
|
92
|
+
kind: 'picture';
|
|
93
|
+
relId?: string;
|
|
94
|
+
dataUrl?: string;
|
|
95
|
+
scale: number;
|
|
96
|
+
washout: boolean;
|
|
97
|
+
widthEmu?: number;
|
|
98
|
+
heightEmu?: number;
|
|
99
|
+
/** Undefined defaults to true for watermarks. */
|
|
100
|
+
decorative?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/** One measured note in a page/section note area. */
|
|
103
|
+
interface DisplayListNoteItem {
|
|
104
|
+
kind?: 'footnote' | 'endnote';
|
|
105
|
+
id?: number;
|
|
106
|
+
displayLabel?: string;
|
|
107
|
+
measured?: MeasuredBlock[];
|
|
108
|
+
height?: number;
|
|
109
|
+
anchorDocStart?: number;
|
|
110
|
+
anchorDocEnd?: number;
|
|
111
|
+
customMarkFollows?: boolean;
|
|
112
|
+
}
|
|
113
|
+
/** Typed non-fragmented note-region input for the Rust display builder. */
|
|
114
|
+
interface DisplayListNoteArea {
|
|
115
|
+
pageIndex?: number;
|
|
116
|
+
sectionId?: string;
|
|
117
|
+
kind?: 'footnote' | 'endnote';
|
|
118
|
+
placement?: 'pageBottom' | 'beneathText' | 'sectEnd' | 'docEnd';
|
|
119
|
+
y?: number;
|
|
120
|
+
height?: number;
|
|
121
|
+
columns?: number;
|
|
122
|
+
separator?: DisplayListNoteItem;
|
|
123
|
+
notes?: DisplayListNoteItem[];
|
|
124
|
+
}
|
|
125
|
+
/** Stable reviewer palette entry for comments/revisions. */
|
|
126
|
+
interface DisplayListCommentAuthor {
|
|
127
|
+
id?: string;
|
|
128
|
+
name?: string;
|
|
129
|
+
paletteIndex?: number;
|
|
130
|
+
color?: string;
|
|
131
|
+
}
|
|
132
|
+
/** One reply of a comment thread (a11y announcement input). */
|
|
133
|
+
interface DisplayListCommentReply {
|
|
134
|
+
id?: number;
|
|
135
|
+
authorId?: string;
|
|
136
|
+
authorName?: string;
|
|
137
|
+
date?: string;
|
|
138
|
+
/** Plain-text body (the builder caps it before it reaches primitives). */
|
|
139
|
+
text?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Per-comment thread metadata keyed by comment id, joined by the builder onto
|
|
143
|
+
* every primitive carrying that id in `commentIds` so the a11y mirror can
|
|
144
|
+
* announce the complete thread (author name, date, body, replies). All string
|
|
145
|
+
* values are file-derived/attacker-controlled; consumers must only ever
|
|
146
|
+
* assign them via textContent/setAttribute.
|
|
147
|
+
*/
|
|
148
|
+
interface DisplayListCommentThread {
|
|
149
|
+
/** Comment id — matches the numeric ids in `resolvedCommentIds`/`commentIds`. */
|
|
150
|
+
id?: number;
|
|
151
|
+
authorId?: string;
|
|
152
|
+
authorName?: string;
|
|
153
|
+
date?: string;
|
|
154
|
+
/** Plain-text body (builder-capped before emission). */
|
|
155
|
+
text?: string;
|
|
156
|
+
/** Replies in thread order (builder-capped count and text). */
|
|
157
|
+
replies?: DisplayListCommentReply[];
|
|
158
|
+
}
|
|
159
|
+
/** The `{ measured, options, layout }` envelope the Rust builder consumes. */
|
|
160
|
+
interface DisplayListBuildInputs {
|
|
161
|
+
/** Serialization contract version. Undefined reads as legacy version 0. */
|
|
162
|
+
contractVersion?: number;
|
|
163
|
+
measured: MeasuredBlock[];
|
|
164
|
+
options: unknown;
|
|
165
|
+
layout: Layout;
|
|
166
|
+
/** header/footer parts + section flags; omitted ⇒ body-only display list */
|
|
167
|
+
headersFooters?: DisplayListHeadersFooters;
|
|
168
|
+
/**
|
|
169
|
+
* Doc-wide font-id chains keyed `"<family lowercase>|<bold 0|1>|<italic 0|1>"`
|
|
170
|
+
* → measurement `FontStore` ids — the SAME map the measurement input carries.
|
|
171
|
+
* Present only under Rust measurement (the ids must belong to a populated
|
|
172
|
+
* store); its presence against that store is what gates GlyphRun emission.
|
|
173
|
+
* Omitted ⇒ every text run takes the browser-measured `TextRunPrimitive` path
|
|
174
|
+
* (byte-identical to the pre-glyph build).
|
|
175
|
+
*/
|
|
176
|
+
fontChains?: Record<string, number[]>;
|
|
177
|
+
/** Page/section note regions. Undefined = no note emission. */
|
|
178
|
+
noteAreas?: DisplayListNoteArea[];
|
|
179
|
+
/** Resolved comments suppressed from active tint. Undefined = none known. */
|
|
180
|
+
resolvedCommentIds?: number[];
|
|
181
|
+
/** Stable reviewer palette. Undefined = legacy hard-coded colors. */
|
|
182
|
+
commentAuthors?: DisplayListCommentAuthor[];
|
|
183
|
+
/** Per-comment thread metadata for a11y announcements. Undefined = none. */
|
|
184
|
+
commentThreads?: DisplayListCommentThread[];
|
|
185
|
+
}
|
|
186
|
+
/** Minimal engine surface, injectable so tests can fake the wasm module. */
|
|
187
|
+
interface RustDisplayListEngine {
|
|
188
|
+
buildDisplayListJson(input: string): string;
|
|
189
|
+
/** Resident editing engines expose binary deltas; the stateless layout wasm does not. */
|
|
190
|
+
buildDisplayListFrame?(input: string, expectedFrameEpoch: number): Uint8Array;
|
|
191
|
+
/** One-owner ordinary input path; available on the resident editing engine. */
|
|
192
|
+
applyInput?(text: string, expectedFrameEpoch: number): Uint8Array;
|
|
193
|
+
displayHitTestRegionsJson?(pageIndex: number, x: number, y: number): string;
|
|
194
|
+
displayVerticalMoveJson?(position: number, direction: 'up' | 'down', goalX: number): string;
|
|
195
|
+
displayRangeRectsJson?(from: number, to: number): string;
|
|
196
|
+
displayRangeRectsRegionJson?(region: 'body' | 'header' | 'footer', rId: string, from: number, to: number): string;
|
|
197
|
+
}
|
|
198
|
+
type RustDisplayListSourceErrorStage = 'load' | 'build' | 'parse' | 'decode' | 'apply';
|
|
199
|
+
interface RustDisplayFrameResult {
|
|
200
|
+
displayList: DisplayList;
|
|
201
|
+
/** Null only on the compatibility JSON engine path. */
|
|
202
|
+
frame: RetainedFrame | null;
|
|
203
|
+
transport: 'frame-delta-v1' | 'json';
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Typed terminal error from the mandatory Rust display-list source. Hosts may
|
|
207
|
+
* surface this through their editor error boundary; it is never permission to
|
|
208
|
+
* silently substitute painter geometry.
|
|
209
|
+
*/
|
|
210
|
+
declare class RustDisplayListSourceError extends Error {
|
|
211
|
+
readonly stage: RustDisplayListSourceErrorStage;
|
|
212
|
+
constructor(stage: RustDisplayListSourceErrorStage, cause: unknown);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Query surface over an already-built display list, injectable so tests can
|
|
216
|
+
* fake the wasm module.
|
|
217
|
+
*
|
|
218
|
+
* The `*Json` calls take the display-list JSON string as an argument (the Rust
|
|
219
|
+
* side re-parses it per query — callers should cache the string). The
|
|
220
|
+
* session-handle members parse the list ONCE (`openDisplayList` → handle) and
|
|
221
|
+
* answer many queries by handle with no re-serialization, reusing the same
|
|
222
|
+
* hit/range logic so results are byte-identical. The handle members are
|
|
223
|
+
* OPTIONAL: the embedded wasm carries them only after the integrator re-embeds,
|
|
224
|
+
* so `createDisplayListQueries` feature-detects `hasDisplayListSession` and
|
|
225
|
+
* falls back to the `*Json` path when they are absent.
|
|
226
|
+
*/
|
|
227
|
+
interface RustDisplayListQueryEngine {
|
|
228
|
+
/** region-aware hit test → `{"region","rId"?,"pos"}` or `"null"` JSON */
|
|
229
|
+
hitTestRegionsJson(displayList: string, pageIndex: number, x: number, y: number): string;
|
|
230
|
+
/** closest caret position on the adjacent visual line */
|
|
231
|
+
verticalMoveJson?(displayList: string, position: number, direction: 'up' | 'down', goalX: number): string;
|
|
232
|
+
/** body PM range → JSON array of `{pageIndex,x,y,width,height}` rects */
|
|
233
|
+
rangeRectsJson(displayList: string, from: number, to: number): string;
|
|
234
|
+
/**
|
|
235
|
+
* Region-aware PM range → JSON array of rects. `region` is
|
|
236
|
+
* `'body' | 'header' | 'footer'`; `rId` scopes header/footer to one HF part
|
|
237
|
+
* (empty for body / match-any). OPTIONAL: the embedded wasm carries it only
|
|
238
|
+
* after the integrator re-embeds, so `createDisplayListQueries` falls back to
|
|
239
|
+
* `[]` when absent (HF selection geometry stays a documented gap until then).
|
|
240
|
+
*/
|
|
241
|
+
rangeRectsRegionJson?(displayList: string, region: string, rId: string, from: number, to: number): string;
|
|
242
|
+
/** true when the embedded wasm carries the region-aware range-rect exports */
|
|
243
|
+
hasRangeRectsRegion?(): boolean;
|
|
244
|
+
/** true when the embedded wasm carries the session-handle exports below */
|
|
245
|
+
hasDisplayListSession?(): boolean;
|
|
246
|
+
/** parse a display list once, return a handle for the by-handle queries */
|
|
247
|
+
openDisplayList?(displayList: string): number;
|
|
248
|
+
/** free a handle's parsed display list */
|
|
249
|
+
closeDisplayList?(handle: number): void;
|
|
250
|
+
/** patch a stored display list's changed pages in place (see layout wasm) */
|
|
251
|
+
updateDisplayList?(handle: number, update: string): void;
|
|
252
|
+
/** true when the embedded wasm carries the page-delta update export */
|
|
253
|
+
hasDisplayListUpdate?(): boolean;
|
|
254
|
+
/** region-aware hit test against a stored display list (by handle) */
|
|
255
|
+
hitTestRegionsByHandle?(handle: number, pageIndex: number, x: number, y: number): string;
|
|
256
|
+
/** adjacent visual-line move against a stored display list */
|
|
257
|
+
verticalMoveByHandle?(handle: number, position: number, direction: 'up' | 'down', goalX: number): string;
|
|
258
|
+
/** body PM range against a stored display list (by handle) */
|
|
259
|
+
rangeRectsByHandle?(handle: number, from: number, to: number): string;
|
|
260
|
+
/** region-aware PM range against a stored display list (by handle) */
|
|
261
|
+
rangeRectsRegionByHandle?(handle: number, region: string, rId: string, from: number, to: number): string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Lazily load the wasm query surface (hit-test + range-rects). Shares the
|
|
265
|
+
* module promise with `buildRustDisplayList`, so on the canvas-renderer path
|
|
266
|
+
* the engine is already resolved by the time the first display list lands.
|
|
267
|
+
*/
|
|
268
|
+
declare function loadRustDisplayListQueryEngine(): Promise<RustDisplayListQueryEngine>;
|
|
269
|
+
/** Display-only fields sent to an engine that already retains pagination. */
|
|
270
|
+
declare function encodeDisplayListFrameExtras(inputs: DisplayListBuildInputs): string;
|
|
271
|
+
/**
|
|
272
|
+
* Build a DisplayList for a computed layout through the Rust engine. Throws
|
|
273
|
+
* when the wasm module fails to load or the builder rejects the input — the
|
|
274
|
+
* caller is expected to fall back to the DOM painter.
|
|
275
|
+
*/
|
|
276
|
+
declare function buildRustDisplayList(inputs: DisplayListBuildInputs, engine?: RustDisplayListEngine): Promise<DisplayList>;
|
|
277
|
+
/**
|
|
278
|
+
* Production display build. Resident editing engines return FrameDelta v1;
|
|
279
|
+
* older/stateless engines retain the full-JSON parity path.
|
|
280
|
+
*/
|
|
281
|
+
declare function buildRustDisplayFrame(inputs: DisplayListBuildInputs, engine?: RustDisplayListEngine, previous?: RetainedFrame | null): Promise<RustDisplayFrameResult>;
|
|
282
|
+
|
|
283
|
+
export { type DisplayListHeadersFooters as D, type RustDisplayListQueryEngine as R, type DisplayListBuildInputs as a, type DisplayListHfVariant as b, type DisplayListPictureWatermark as c, type DisplayListTextWatermark as d, type DisplayListWatermark as e, type RustDisplayFrameResult as f, type RustDisplayListEngine as g, RustDisplayListSourceError as h, type RustDisplayListSourceErrorStage as i, buildRustDisplayFrame as j, buildRustDisplayList as k, encodeDisplayListFrameExtras as l, loadRustDisplayListQueryEngine as m };
|
package/dist/styles/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-
|
|
1
|
+
import { a as ParagraphFormatting, b as TextFormatting } from '../formatting-BEkIBePP.mjs';
|
|
2
|
+
import { S as StyleDefinitions, a as Style, D as DocDefaults } from '../styles-BK3Jecxs.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Style Resolver for ProseMirror Editor
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as TextFormatting, a as ParagraphFormatting, c as TableFormatting, d as TableRowFormatting, e as TableCellFormatting } from './formatting-BEkIBePP.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Styles, Theme, Font Table, Relationships & Media Types
|
package/dist/types/content.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { B as BlockContent,
|
|
2
|
-
|
|
1
|
+
export { B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, e as Chart, p as ChartAxis, q as ChartContent, s as ChartLegend, v as ChartSeries, w as ChartType, x as Column, f as Comment, G as CommentRangeEnd, I as CommentRangeStart, K as ComplexField, M as DEFAULT_WATERMARK_PRESETS, O as Deletion, g as DocumentBody, Q as DrawingContent, j as Endnote, U as EndnotePosition, E as EndnoteProperties, V as Field, X as FieldCharContent, _ as FieldType, $ as FooterReference, i as Footnote, a0 as FootnotePosition, F as FootnoteProperties, H as HeaderFooter, a1 as HeaderFooterType, a2 as HeaderReference, a3 as Hyperlink, a5 as Image, a6 as ImageCrop, a9 as ImagePadding, aa as ImagePosition, ac as ImageSize, ad as ImageTransform, ae as ImageWrap, ag as InlineSdt, ah as Insertion, ai as InstrTextContent, ak as LineNumberRestart, an as MathEquation, ao as MoveFrom, ap as MoveFromRangeEnd, aq as MoveFromRangeStart, ar as MoveTo, as as MoveToRangeEnd, at as MoveToRangeStart, au as NoBreakHyphenContent, av as NoteNumberRestart, aw as NoteRefMarkContent, ax as NoteReferenceContent, aC as PageOrientation, P as Paragraph, aD as ParagraphContent, aE as ParagraphPropertyChange, aF as PictureWatermark, aG as PropertyChangeInfo, aH as Run, aI as RunContent, aJ as RunPropertyChange, aL as SdtDataBinding, b as SdtProperties, aO as SdtType, aP as Section, S as SectionProperties, aQ as SectionStart, aR as SeparatorContent, aS as Shape, aT as ShapeContent, aW as ShapeTextBody, aX as SimpleField, aY as SoftHyphenContent, a$ as SymbolContent, b0 as TabContent, b1 as Table, b2 as TableCell, b3 as TableCellPropertyChange, b4 as TablePropertyChange, b5 as TableRow, b6 as TableRowPropertyChange, b7 as TableStructuralChangeInfo, b8 as TextBox, b9 as TextContent, ba as TextWatermark, bb as TrackedChangeInfo, bc as TrackedRunChange, bd as VerticalAlign, W as Watermark, be as pictureWatermarkDisplayEmu } from '../content-C3sTRz-u.mjs';
|
|
2
|
+
export { k as ShapeFill, l as ShapeOutline, m as ShapeType } from '../formatting-BEkIBePP.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F as FootnoteProperties, E as EndnoteProperties,
|
|
2
|
-
export { A as AbstractNumbering, B as BlockContent,
|
|
3
|
-
import {
|
|
4
|
-
export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment,
|
|
5
|
-
import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-
|
|
6
|
-
export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-
|
|
1
|
+
import { F as FootnoteProperties, E as EndnoteProperties, g as DocumentBody, h as NumberingDefinitions, i as Footnote, j as Endnote, H as HeaderFooter, e as Chart, k as BookmarkRange } from '../content-C3sTRz-u.mjs';
|
|
2
|
+
export { A as AbstractNumbering, B as BlockContent, l as BlockSdt, m as BookmarkEnd, n as BookmarkStart, o as BreakContent, p as ChartAxis, q as ChartContent, r as ChartGrouping, s as ChartLegend, t as ChartPlotGroup, u as ChartPoint, v as ChartSeries, w as ChartType, x as Column, f as Comment, y as CommentAnchorRange, z as CommentAuthor, G as CommentRangeEnd, I as CommentRangeStart, J as CommentReferenceContent, K as ComplexField, L as ContentPosition, M as DEFAULT_WATERMARK_PRESETS, O as Deletion, Q as DrawingContent, D as DrawingScene, T as DrawingSceneNode, U as EndnotePosition, V as Field, X as FieldCharContent, Y as FieldFormData, Z as FieldInlineContent, _ as FieldType, $ as FooterReference, a0 as FootnotePosition, a1 as HeaderFooterType, a2 as HeaderReference, a3 as Hyperlink, a4 as HyperlinkContent, a5 as Image, a6 as ImageCrop, a7 as ImageEffect, a8 as ImageHyperlink, a9 as ImagePadding, aa as ImagePosition, ab as ImageRotationBounds, ac as ImageSize, ad as ImageTransform, ae as ImageWrap, af as ImageWrapPoint, ag as InlineSdt, ah as Insertion, ai as InstrTextContent, aj as LevelSuffix, ak as LineNumberRestart, al as ListLevel, am as ListRendering, an as MathEquation, ao as MoveFrom, ap as MoveFromRangeEnd, aq as MoveFromRangeStart, ar as MoveTo, as as MoveToRangeEnd, at as MoveToRangeStart, au as NoBreakHyphenContent, N as NoteKind, av as NoteNumberRestart, aw as NoteRefMarkContent, ax as NoteReferenceContent, ay as NoteSeparatorReference, az as NumberFormat, aA as NumberingInstance, aB as PageNumberingProperties, aC as PageOrientation, P as Paragraph, aD as ParagraphContent, aE as ParagraphPropertyChange, aF as PictureWatermark, aG as PropertyChangeInfo, aH as Run, aI as RunContent, aJ as RunPropertyChange, aK as SdtCheckboxGlyph, a as SdtControlState, aL as SdtDataBinding, aM as SdtDateState, aN as SdtGalleryState, b as SdtProperties, aO as SdtType, aP as Section, S as SectionProperties, aQ as SectionStart, aR as SeparatorContent, aS as Shape, aT as ShapeContent, c as ShapeEffect, aU as ShapeFillPaint, aV as ShapeStrokePaint, aW as ShapeTextBody, d as ShapeTextBodyProperties, aX as SimpleField, aY as SoftHyphenContent, aZ as StructuredFieldContent, a_ as StructuredFieldTree, a$ as SymbolContent, b0 as TabContent, b1 as Table, b2 as TableCell, b3 as TableCellPropertyChange, b4 as TablePropertyChange, b5 as TableRow, b6 as TableRowPropertyChange, b7 as TableStructuralChangeInfo, b8 as TextBox, b9 as TextContent, ba as TextWatermark, bb as TrackedChangeInfo, bc as TrackedRunChange, bd as VerticalAlign, W as Watermark, be as pictureWatermarkDisplayEmu } from '../content-C3sTRz-u.mjs';
|
|
3
|
+
import { f as Theme, C as ColorValue } from '../formatting-BEkIBePP.mjs';
|
|
4
|
+
export { B as BorderSpec, g as CellMargins, h as ConditionalFormatStyle, E as EmphasisMark, F as FloatingTableProperties, L as LineSpacingRule, i as ParagraphAlignment, a as ParagraphFormatting, R as RunFontHint, j as RunLanguage, S as ShadingProperties, k as ShapeFill, l as ShapeOutline, m as ShapeType, n as TabLeader, o as TabStop, p as TabStopAlignment, q as TableBorders, e as TableCellFormatting, c as TableFormatting, r as TableLook, s as TableMeasurement, d as TableRowFormatting, t as TableStyleCascade, u as TableStyleRegion, v as TableWidthType, w as TextEffect, b as TextFormatting, T as TextModernEffects, x as ThemeColorScheme, y as ThemeColorSlot, z as ThemeFont, A as ThemeFontScheme, U as UnderlineStyle } from '../formatting-BEkIBePP.mjs';
|
|
5
|
+
import { S as StyleDefinitions, F as FontTable, R as RelationshipMap, M as MediaFile } from '../styles-BK3Jecxs.mjs';
|
|
6
|
+
export { D as DocDefaults, b as FontEmbed, c as FontInfo, d as Relationship, e as RelationshipType, a as Style, f as StyleType } from '../styles-BK3Jecxs.mjs';
|
|
7
7
|
import '../docx/wrapTypes.mjs';
|
|
8
8
|
|
|
9
9
|
interface CompatibilityFlags {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as SdtControlState, b as SdtProperties, R as RevisionInfo, C as CellMarker,
|
|
2
|
-
import { T as TextModernEffects, B as BorderSpec } from './formatting-
|
|
1
|
+
import { a as SdtControlState, b as SdtProperties, R as RevisionInfo, C as CellMarker, D as DrawingScene, c as ShapeEffect, d as ShapeTextBodyProperties, e as Chart, W as Watermark, F as FootnoteProperties, E as EndnoteProperties } from './content-C3sTRz-u.mjs';
|
|
2
|
+
import { T as TextModernEffects, P as PresetGeometryPathCommand, B as BorderSpec } from './formatting-BEkIBePP.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Inline SDT widget metadata carried by a painted text run.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../formatting-
|
|
1
|
+
import { P as Paragraph, B as BlockContent, f as Comment } from '../content-C3sTRz-u.mjs';
|
|
2
|
+
import '../formatting-BEkIBePP.mjs';
|
|
3
3
|
import '../docx/wrapTypes.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { PIXELS_PER_INCH, TWIPS_PER_INCH, clamp, eighthsToPixels, emuToPixels, emuToTwips, formatPx, halfPointsToPixels, halfPointsToPoints, pixelsToEmu, pixelsToTwips, pointsToHalfPoints, pointsToPixels, roundPixels, twipsToEmu, twipsToPixels } from './units.mjs';
|
|
2
|
-
export { F as FONT_MAPPING,
|
|
2
|
+
export { F as FONT_MAPPING, C as FontDefinition, T as ThemeMatrixCell, b as blendColors, c as canRenderFont, a as colorsEqual, d as createRgbColor, e as createThemeColor, f as darkenColor, g as ensureHexPrefix, D as extractFontsFromDocument, h as generateThemeTintShadeMatrix, i as getContrastingColor, E as getGoogleFontEquivalent, j as getLoadedFonts, k as getThemeTintShadeHex, l as isBlack, m as isFontLoaded, o as isGoogleFontsEnabled, n as isLoading, p as isWhite, q as lightenColor, G as loadDocumentFonts, r as loadFont, H as loadFontDefinitions, s as loadFontFromBuffer, I as loadFontFromUrl, J as loadFontWithMapping, t as loadFonts, K as loadFontsWithMapping, L as onFontError, u as onFontsLoaded, v as parseColorString, w as preloadCommonFonts, x as resolveColor, M as resolveColorToHex, y as resolveHighlightColor, z as resolveHighlightToCss, A as resolveShadingColor, B as setGoogleFontsEnabled } from '../fontLoader-CMH3bZ2Z.mjs';
|
|
3
3
|
export { D as DocxInput, t as toArrayBuffer } from '../docxInput-DTbCa48g.mjs';
|
|
4
|
-
import { F as FontTable } from '../styles-
|
|
4
|
+
import { F as FontTable } from '../styles-BK3Jecxs.mjs';
|
|
5
5
|
import { Document } from '../types/document.mjs';
|
|
6
6
|
import { FontOption } from './fontOptions.mjs';
|
|
7
7
|
export { MIN_CARD_GAP, SIDEBAR_DOCUMENT_SHIFT, SIDEBAR_PAGE_GAP, SIDEBAR_WIDTH } from './sidebarConstants.mjs';
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import { f as Comment } from '../content-C3sTRz-u.mjs';
|
|
9
|
+
import '../formatting-BEkIBePP.mjs';
|
|
10
10
|
import '../docx/wrapTypes.mjs';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-IFT6DUJX.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-3UBMCDME.mjs';import {o,e}from'../chunk-AZ52IWB6.mjs';export{s as FONT_MAPPING,o as canRenderFont,d as deobfuscateFont,B as extractEmbeddedFontFaces,x as extractFontsFromDocument,A as getEmbeddedFontFaces,z as getEmbeddedFontFamilies,t as getGoogleFontEquivalent,l as getLoadedFonts,h as isFontLoaded,j as isGoogleFontsEnabled,k as isLoading,c as isValidFontKey,y as loadDocumentFonts,C as loadEmbeddedFonts,f as loadFont,r as loadFontDefinitions,p as loadFontFromBuffer,q as loadFontFromUrl,u as loadFontWithMapping,g as loadFonts,v as loadFontsWithMapping,n as onFontError,m as onFontsLoaded,w as preloadCommonFonts,i as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-AZ52IWB6.mjs';import'../chunk-NJHOPXZW.mjs';import'../chunk-B4IR6YP4.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';function H(e){let t=new Set,o=e.package;if(o.theme&&nt(o.theme,t),o.styles&&rt(o.styles,t),o.document)for(let n of o.document.content)T(n,t);if(o.headers)for(let n of o.headers.values())O(n,t);if(o.footers)for(let n of o.footers.values())O(n,t);if(o.footnotes)for(let n of o.footnotes)ut(n,t);if(o.endnotes)for(let n of o.endnotes)mt(n,t);return Array.from(t).sort()}function nt(e,t){let o=e.fontScheme;o&&(o.majorFont&&_(o.majorFont,t),o.minorFont&&_(o.minorFont,t));}function _(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function rt(e,t){e.docDefaults&&(e.docDefaults.rPr&&h(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&h(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&h(o.rPr,t),o.pPr?.runProperties&&h(o.pPr.runProperties,t);}function h(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function at(e,t){e.runProperties&&h(e.runProperties,t);}function T(e,t){e.type==="paragraph"?st(e,t):e.type==="table"&&ct(e,t);}function st(e,t){e.formatting&&at(e.formatting,t);for(let o of e.content)it(o,t);}function it(e,t){if(e.type==="run")b(e,t);else if(e.type==="hyperlink")lt(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&b(o,t);if("fieldResult"in e)for(let o of e.fieldResult)b(o,t);}}function b(e,t){e.formatting&&h(e.formatting,t);}function lt(e,t){for(let o of e.children)o.type==="run"&&b(o,t);}function ct(e,t){for(let o of e.rows)ft(o,t);}function ft(e,t){for(let o of e.cells)dt(o,t);}function dt(e,t){for(let o of e.content)T(o,t);}function O(e,t){for(let o of e.content)T(o,t);}function ut(e,t){for(let o of e.content)T(o,t);}function mt(e,t){for(let o of e.content)T(o,t);}var pt=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function N(e$1,t={}){let o$1=t.canRender??o,n=new Set;for(let i of t.exclude??[])n.add(i.trim().toLowerCase());let r=new Set;for(let i of t.embeddedFamilies??[])r.add(i.trim().toLowerCase());let s=[],a=new Set;for(let i of e$1){let c=i.trim(),f=c.toLowerCase();!c||pt.has(f)||n.has(f)||a.has(f)||!r.has(f)&&!o$1(c)||(a.add(f),s.push({name:c,fontFamily:e(c).cssFallback,category:"other"}));}return s}function gt(e,t={}){return N(H(e),t)}function ht(e,t){if(!e||e.length===0)return [];let o=new Set;for(let s of t)o.add(s.trim().toLowerCase());let n=new Set,r=[];for(let s of e){let a=s.name.trim().toLowerCase();o.has(a)||n.has(a)||(n.add(a),r.push(s));}return r}function xt(e){let t=[];return e.descendants((o,n)=>{if(o.type.name==="paragraph"){let r=o.attrs.outlineLevel,s=o.attrs.styleId,a=r;if(a==null&&s){let i=s.match(/^[Hh]eading(\d)$/);i&&(a=parseInt(i[1],10)-1);}if(a!=null&&a>=0&&a<=8){let i="";o.forEach(c=>{c.isText&&(i+=c.text||"");}),i.trim()&&t.push({text:i.trim(),level:a,pmPos:n});}}}),t}var L="rgba(255, 235, 59, 0.55)",Ft=1200,y="docx-paragraph-flash",S=new WeakMap;function Tt(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function bt(e){return e?.color?.trim()||L}function yt(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function k(e,t){if(!t||!t.trim())return [];let o=Tt(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function W(e,t){let o=0,n=bt(t),r=yt(t);for(let s of e){o++;let a=S.get(s);a!==void 0&&clearTimeout(a),s.classList.remove(y),s.offsetWidth,s.style.setProperty("--docx-paragraph-flash-color",n),s.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),s.classList.add(y);let i=setTimeout(()=>{s.classList.remove(y),s.style.removeProperty("--docx-paragraph-flash-color"),s.style.removeProperty("--docx-paragraph-flash-duration"),S.delete(s);},r);S.set(s,i);}return o}function Ct(e,t,o){let n=k(e,t);return W(n,o)>0}function B(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function At(e,t,o,n){let r=B(e,t,o),s=Math.floor(r/Math.max(n,1)),a=r-s*n,i=Array.from({length:n},(c,f)=>s+(f<a?1:0));return [...e.slice(0,t),...i,...e.slice(t+o)]}function St(e,t,o,n,r,s){let a=o-t.rowspan,i=n-t.colspan,c=r+a,f=t.row+t.rowspan,F=t.col+t.colspan,p=[];for(let l of e){if(l===t)continue;let g=l.row+l.rowspan,C=l.col+l.colspan,I=l.row<f&&g>t.row,v=l.col<F&&C>t.col;p.push({data:l.data,row:l.row>=f?l.row+a:l.row,col:l.col>=F?l.col+i:l.col,rowspan:l.rowspan+(a>0&&I&&!v?a:0),colspan:l.colspan+(i>0&&v&&!I?i:0)});}for(let l=0;l<o;l++)for(let g=0;g<n;g++){let C=l===0&&g===0;p.push({data:s(C,l,g),row:t.row+l,col:t.col+g,rowspan:1,colspan:1});}return {anchors:p,deltaRows:a,deltaCols:i,newRowCount:c}}function wt(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let s=n.col;s<n.col+n.colspan;s++)o.set(`${r}-${s}`,n);}return {byStart:t,byCoveredSlot:o}}function Et(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}var Pt=/[\p{L}\p{N}\p{M}_''\-]/u,Rt=/\s/;function w(e){return !e||e.length===0?false:Pt.test(e)}function E(e){return !e||e.length===0?false:Rt.test(e)}function m(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(E(o)){let n=t,r=t;for(;n>0&&E(e[n-1]);)n--;for(;r<e.length&&E(e[r]);)r++;return [n,r]}if(w(o)){let n=t,r=t;for(;n>0&&w(e[n-1]);)n--;for(;r<e.length&&w(e[r]);)r++;return [n,r]}return [t,t+1]}function Dt(e,t){let[o,n]=m(e,t);return e.slice(o,n)}function It(e,t){let[o,n]=m(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function D(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[s,a]=m(n,r);if(a>s)return t.setStart(o,s),t.setEnd(o,a),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=G(n);if(r.length>0){let s=t.startOffset,a=null,i=s;if(s<n.childNodes.length){let c=n.childNodes[s];if(c.nodeType===Node.TEXT_NODE)a=c,i=0;else if(c instanceof Element){let f=G(c);f.length>0&&(a=f[0],i=0);}}if(!a&&r.length>0&&(a=r[0],i=0),a){let c=a.textContent||"",[f,F]=m(c,i);if(F>f){let p=document.createRange();return p.setStart(a,f),p.setEnd(a,F),e.removeAllRanges(),e.addRange(p),true}}}}return false}function vt(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,s]=m(n,t);if(s>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,s),o.removeAllRanges(),o.addRange(a),true}return false}function Mt(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return D();let o=t.startContainer,n=t.endContainer,r=t.startOffset,s=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",[i]=m(a,t.startOffset);r=i;}if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",i=Math.max(0,t.endOffset-1),[,c]=m(a,i);s=c;}try{return t.setStart(o,r),t.setEnd(n,s),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function X(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=_t(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function _t(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function G(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var P=0,x=null,R=null,Ot=500;function U(){P=0,R=null,x&&(clearTimeout(x),x=null);}function K(e){return e.target!==R&&U(),P++,R=e.target,x&&clearTimeout(x),x=setTimeout(U,Ot),Math.min(P,3)}function Ht(){return e=>{e.ctrlKey||e.metaKey||e.altKey||D();}}function Nt(){return e=>{if(K(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;X();}}}async function Lt(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var $="(prefers-color-scheme: dark)";function z(){return typeof window<"u"&&typeof window.matchMedia=="function"}function kt(){return z()?window.matchMedia($).matches:false}function Wt(e,t){return e==="dark"||e==="system"&&t}function Bt(e){if(!z())return ()=>{};let t=window.matchMedia($);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gt=-1;function Ut(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Xt(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}var Kt=/^[a-z][a-z0-9+.-]*:/i,$t=/^(https?|mailto|tel|ftp):/i;function zt(e){if(!e)return;let t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(t)return Kt.test(t)?$t.test(t)?e:void 0:e}export{L as DEFAULT_PARAGRAPH_FLASH_COLOR,Ft as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,y as PARAGRAPH_FLASH_CLASS_NAME,Gt as PENDING_COMMENT_ID,wt as buildAnchorMaps,xt as collectHeadings,Et as computeSplitDialogDefaults,St as computeSplitLayout,Xt as createComment,Ut as createCommentIdAllocator,Ht as createDoubleClickWordSelector,Nt as createTripleClickParagraphSelector,ht as excludeFontsByName,Mt as expandSelectionToWordBoundaries,k as findParagraphFragmentsByParaId,It as findWordAt,m as findWordBoundaries,W as flashParagraphElements,Ct as flashParagraphFragmentsByParaId,gt as getRenderableDocumentFonts,Dt as getWordAt,K as handleClickForMultiClick,kt as prefersColorSchemeDark,Lt as readDocxFileFromInput,At as redistributeColumnWidths,Wt as resolveIsDark,zt as sanitizeHref,X as selectParagraphAtCursor,N as selectRenderableFonts,D as selectWordAtCursor,vt as selectWordInTextNode,Bt as subscribeSystemDark,B as sumColumnWidths};
|
|
1
|
+
export{d as MIN_CARD_GAP,c as SIDEBAR_DOCUMENT_SHIFT,b as SIDEBAR_PAGE_GAP,a as SIDEBAR_WIDTH}from'../chunk-YUOKI2HB.mjs';export{f as blendColors,r as colorsEqual,o as createRgbColor,n as createThemeColor,d as darkenColor,p as ensureHexPrefix,h as generateThemeTintShadeMatrix,c as getContrastingColor,g as getThemeTintShadeHex,k as isBlack,l as isWhite,e as lightenColor,m as parseColorString,a as resolveColor,b as resolveColorToHex,i as resolveHighlightColor,q as resolveHighlightToCss,j as resolveShadingColor}from'../chunk-LTVVQMHB.mjs';export{a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-CTBUQRYQ.mjs';import {n,d}from'../chunk-YTILOUAA.mjs';export{r as FONT_MAPPING,n as canRenderFont,c as deobfuscateFont,A as extractEmbeddedFontFaces,w as extractFontsFromDocument,z as getEmbeddedFontFaces,y as getEmbeddedFontFamilies,s as getGoogleFontEquivalent,k as getLoadedFonts,g as isFontLoaded,i as isGoogleFontsEnabled,j as isLoading,b as isValidFontKey,x as loadDocumentFonts,B as loadEmbeddedFonts,e as loadFont,q as loadFontDefinitions,o as loadFontFromBuffer,p as loadFontFromUrl,t as loadFontWithMapping,f as loadFonts,u as loadFontsWithMapping,m as onFontError,l as onFontsLoaded,v as preloadCommonFonts,h as setGoogleFontsEnabled,a as toArrayBuffer}from'../chunk-YTILOUAA.mjs';import'../chunk-6KDV6AIL.mjs';import'../chunk-NJHOPXZW.mjs';import'../chunk-B4IR6YP4.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';function H(e){let t=new Set,o=e.package;if(o.theme&&nt(o.theme,t),o.styles&&rt(o.styles,t),o.document)for(let n of o.document.content)T(n,t);if(o.headers)for(let n of o.headers.values())O(n,t);if(o.footers)for(let n of o.footers.values())O(n,t);if(o.footnotes)for(let n of o.footnotes)ut(n,t);if(o.endnotes)for(let n of o.endnotes)mt(n,t);return Array.from(t).sort()}function nt(e,t){let o=e.fontScheme;o&&(o.majorFont&&_(o.majorFont,t),o.minorFont&&_(o.minorFont,t));}function _(e,t){if(e.latin&&t.add(e.latin),e.ea&&t.add(e.ea),e.cs&&t.add(e.cs),e.fonts)for(let o of Object.values(e.fonts))o&&t.add(o);}function rt(e,t){e.docDefaults&&(e.docDefaults.rPr&&h(e.docDefaults.rPr,t),e.docDefaults.pPr?.runProperties&&h(e.docDefaults.pPr.runProperties,t));for(let o of e.styles)o.rPr&&h(o.rPr,t),o.pPr?.runProperties&&h(o.pPr.runProperties,t);}function h(e,t){let o=e.fontFamily;o&&(o.ascii&&t.add(o.ascii),o.hAnsi&&t.add(o.hAnsi),o.eastAsia&&t.add(o.eastAsia),o.cs&&t.add(o.cs));}function at(e,t){e.runProperties&&h(e.runProperties,t);}function T(e,t){e.type==="paragraph"?st(e,t):e.type==="table"&&ct(e,t);}function st(e,t){e.formatting&&at(e.formatting,t);for(let o of e.content)it(o,t);}function it(e,t){if(e.type==="run")b(e,t);else if(e.type==="hyperlink")lt(e,t);else if(e.type==="simpleField"||e.type==="complexField"){if("content"in e)for(let o of e.content)o.type==="run"&&b(o,t);if("fieldResult"in e)for(let o of e.fieldResult)b(o,t);}}function b(e,t){e.formatting&&h(e.formatting,t);}function lt(e,t){for(let o of e.children)o.type==="run"&&b(o,t);}function ct(e,t){for(let o of e.rows)ft(o,t);}function ft(e,t){for(let o of e.cells)dt(o,t);}function dt(e,t){for(let o of e.content)T(o,t);}function O(e,t){for(let o of e.content)T(o,t);}function ut(e,t){for(let o of e.content)T(o,t);}function mt(e,t){for(let o of e.content)T(o,t);}var pt=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui"]);function N(e,t={}){let o=t.canRender??n,n$1=new Set;for(let i of t.exclude??[])n$1.add(i.trim().toLowerCase());let r=new Set;for(let i of t.embeddedFamilies??[])r.add(i.trim().toLowerCase());let s=[],a=new Set;for(let i of e){let c=i.trim(),f=c.toLowerCase();!c||pt.has(f)||n$1.has(f)||a.has(f)||!r.has(f)&&!o(c)||(a.add(f),s.push({name:c,fontFamily:d(c).cssFallback,category:"other"}));}return s}function gt(e,t={}){return N(H(e),t)}function ht(e,t){if(!e||e.length===0)return [];let o=new Set;for(let s of t)o.add(s.trim().toLowerCase());let n=new Set,r=[];for(let s of e){let a=s.name.trim().toLowerCase();o.has(a)||n.has(a)||(n.add(a),r.push(s));}return r}function xt(e){let t=[];return e.descendants((o,n)=>{if(o.type.name==="paragraph"){let r=o.attrs.outlineLevel,s=o.attrs.styleId,a=r;if(a==null&&s){let i=s.match(/^[Hh]eading(\d)$/);i&&(a=parseInt(i[1],10)-1);}if(a!=null&&a>=0&&a<=8){let i="";o.forEach(c=>{c.isText&&(i+=c.text||"");}),i.trim()&&t.push({text:i.trim(),level:a,pmPos:n});}}}),t}var L="rgba(255, 235, 59, 0.55)",Ft=1200,y="docx-paragraph-flash",S=new WeakMap;function Tt(e){let t=globalThis;return typeof t.CSS?.escape=="function"?t.CSS.escape(e):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function bt(e){return e?.color?.trim()||L}function yt(e){let t=e?.durationMs;return t==null||!Number.isFinite(t)||t<0?1200:t}function k(e,t){if(!t||!t.trim())return [];let o=Tt(t);return Array.from(e.querySelectorAll(`.layout-paragraph[data-para-id="${o}"]`))}function W(e,t){let o=0,n=bt(t),r=yt(t);for(let s of e){o++;let a=S.get(s);a!==void 0&&clearTimeout(a),s.classList.remove(y),s.offsetWidth,s.style.setProperty("--docx-paragraph-flash-color",n),s.style.setProperty("--docx-paragraph-flash-duration",`${r}ms`),s.classList.add(y);let i=setTimeout(()=>{s.classList.remove(y),s.style.removeProperty("--docx-paragraph-flash-color"),s.style.removeProperty("--docx-paragraph-flash-duration"),S.delete(s);},r);S.set(s,i);}return o}function Ct(e,t,o){let n=k(e,t);return W(n,o)>0}function B(e,t,o){let n=0;for(let r=t;r<t+o&&r<e.length;r++)n+=e[r];return n}function At(e,t,o,n){let r=B(e,t,o),s=Math.floor(r/Math.max(n,1)),a=r-s*n,i=Array.from({length:n},(c,f)=>s+(f<a?1:0));return [...e.slice(0,t),...i,...e.slice(t+o)]}function St(e,t,o,n,r,s){let a=o-t.rowspan,i=n-t.colspan,c=r+a,f=t.row+t.rowspan,F=t.col+t.colspan,p=[];for(let l of e){if(l===t)continue;let g=l.row+l.rowspan,C=l.col+l.colspan,I=l.row<f&&g>t.row,v=l.col<F&&C>t.col;p.push({data:l.data,row:l.row>=f?l.row+a:l.row,col:l.col>=F?l.col+i:l.col,rowspan:l.rowspan+(a>0&&I&&!v?a:0),colspan:l.colspan+(i>0&&v&&!I?i:0)});}for(let l=0;l<o;l++)for(let g=0;g<n;g++){let C=l===0&&g===0;p.push({data:s(C,l,g),row:t.row+l,col:t.col+g,rowspan:1,colspan:1});}return {anchors:p,deltaRows:a,deltaCols:i,newRowCount:c}}function wt(e){let t=new Map,o=new Map;for(let n of e){t.set(`${n.row}-${n.col}`,n);for(let r=n.row;r<n.row+n.rowspan;r++)for(let s=n.col;s<n.col+n.colspan;s++)o.set(`${r}-${s}`,n);}return {byStart:t,byCoveredSlot:o}}function Et(e,t){let o=e>1||t>1;return {minRows:e,minCols:t,initialRows:e,initialCols:o?t:t+1}}var Pt=/[\p{L}\p{N}\p{M}_''\-]/u,Rt=/\s/;function w(e){return !e||e.length===0?false:Pt.test(e)}function E(e){return !e||e.length===0?false:Rt.test(e)}function m(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(E(o)){let n=t,r=t;for(;n>0&&E(e[n-1]);)n--;for(;r<e.length&&E(e[r]);)r++;return [n,r]}if(w(o)){let n=t,r=t;for(;n>0&&w(e[n-1]);)n--;for(;r<e.length&&w(e[r]);)r++;return [n,r]}return [t,t+1]}function Dt(e,t){let[o,n]=m(e,t);return e.slice(o,n)}function It(e,t){let[o,n]=m(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function D(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[s,a]=m(n,r);if(a>s)return t.setStart(o,s),t.setEnd(o,a),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=G(n);if(r.length>0){let s=t.startOffset,a=null,i=s;if(s<n.childNodes.length){let c=n.childNodes[s];if(c.nodeType===Node.TEXT_NODE)a=c,i=0;else if(c instanceof Element){let f=G(c);f.length>0&&(a=f[0],i=0);}}if(!a&&r.length>0&&(a=r[0],i=0),a){let c=a.textContent||"",[f,F]=m(c,i);if(F>f){let p=document.createRange();return p.setStart(a,f),p.setEnd(a,F),e.removeAllRanges(),e.addRange(p),true}}}}return false}function vt(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,s]=m(n,t);if(s>r){let a=document.createRange();return a.setStart(e,r),a.setEnd(e,s),o.removeAllRanges(),o.addRange(a),true}return false}function Mt(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return D();let o=t.startContainer,n=t.endContainer,r=t.startOffset,s=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let a=o.textContent||"",[i]=m(a,t.startOffset);r=i;}if(n.nodeType===Node.TEXT_NODE){let a=n.textContent||"",i=Math.max(0,t.endOffset-1),[,c]=m(a,i);s=c;}try{return t.setStart(o,r),t.setEnd(n,s),e.removeAllRanges(),e.addRange(t),!0}catch(a){return console.warn("Could not expand selection to word boundaries:",a),false}}function X(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=_t(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function _t(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function G(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var P=0,x=null,R=null,Ot=500;function U(){P=0,R=null,x&&(clearTimeout(x),x=null);}function K(e){return e.target!==R&&U(),P++,R=e.target,x&&clearTimeout(x),x=setTimeout(U,Ot),Math.min(P,3)}function Ht(){return e=>{e.ctrlKey||e.metaKey||e.altKey||D();}}function Nt(){return e=>{if(K(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;X();}}}async function Lt(e){let t=e.target;if(!t||!t.files)return null;let o=t.files[0];return t.value="",o?{buffer:await o.arrayBuffer(),name:o.name.replace(/\.docx$/i,"")}:null}var $="(prefers-color-scheme: dark)";function z(){return typeof window<"u"&&typeof window.matchMedia=="function"}function kt(){return z()?window.matchMedia($).matches:false}function Wt(e,t){return e==="dark"||e==="system"&&t}function Bt(e){if(!z())return ()=>{};let t=window.matchMedia($);e(t.matches);let o=n=>e(n.matches);return t.addEventListener("change",o),()=>t.removeEventListener("change",o)}var Gt=-1;function Ut(){let e=1;return {next:()=>e++,seedAbove(t){t>=e&&(e=t+1);}}}function Xt(e,t,o,n){return {id:e.next(),author:o,date:new Date().toISOString(),content:[{type:"paragraph",formatting:{},content:[{type:"run",formatting:{},content:[{type:"text",text:t}]}]}],...n!==void 0&&{parentId:n}}}var Kt=/^[a-z][a-z0-9+.-]*:/i,$t=/^(https?|mailto|tel|ftp):/i;function zt(e){if(!e)return;let t=e.replace(/[\t\n\r]/g,"").replace(/^[\x00-\x20]+/,"");if(t)return Kt.test(t)?$t.test(t)?e:void 0:e}export{L as DEFAULT_PARAGRAPH_FLASH_COLOR,Ft as DEFAULT_PARAGRAPH_FLASH_DURATION_MS,y as PARAGRAPH_FLASH_CLASS_NAME,Gt as PENDING_COMMENT_ID,wt as buildAnchorMaps,xt as collectHeadings,Et as computeSplitDialogDefaults,St as computeSplitLayout,Xt as createComment,Ut as createCommentIdAllocator,Ht as createDoubleClickWordSelector,Nt as createTripleClickParagraphSelector,ht as excludeFontsByName,Mt as expandSelectionToWordBoundaries,k as findParagraphFragmentsByParaId,It as findWordAt,m as findWordBoundaries,W as flashParagraphElements,Ct as flashParagraphFragmentsByParaId,gt as getRenderableDocumentFonts,Dt as getWordAt,K as handleClickForMultiClick,kt as prefersColorSchemeDark,Lt as readDocxFileFromInput,At as redistributeColumnWidths,Wt as resolveIsDark,zt as sanitizeHref,X as selectParagraphAtCursor,N as selectRenderableFonts,D as selectWordAtCursor,vt as selectWordInTextNode,Bt as subscribeSystemDark,B as sumColumnWidths};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Style } from '../styles-
|
|
2
|
-
import '../formatting-
|
|
1
|
+
import { a as Style } from '../styles-BK3Jecxs.mjs';
|
|
2
|
+
import '../formatting-BEkIBePP.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Paragraph-style preview + option resolution — shared between the React and
|
package/dist/utils/units.d.mts
CHANGED
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pixels per inch at standard DPI
|
|
3
|
-
*
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
declare const PIXELS_PER_INCH = 96;
|
|
7
|
-
/**
|
|
8
|
-
* Convert EMUs to pixels (at 96 DPI)
|
|
9
|
-
*
|
|
10
|
-
* 1 inch = 914400 EMUs = 96 pixels
|
|
11
|
-
* Returns 0 for null/undefined/NaN inputs.
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
declare function emuToPixels(emu: number | undefined | null): number;
|
|
16
|
-
/**
|
|
17
|
-
* Convert pixels to EMUs.
|
|
18
|
-
* EMU coordinates in OOXML are integer-typed (xs:long); rounding here keeps
|
|
19
|
-
* floating-point drift (e.g. 52 px → 495299.99999999994) out of the document.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
declare function pixelsToEmu(px: number): number;
|
|
24
|
-
/**
|
|
25
|
-
* Convert points to pixels (at 96 DPI)
|
|
26
|
-
*
|
|
27
|
-
* 1 inch = 72 points = 96 pixels
|
|
28
|
-
* → 1 point = 96/72 pixels = 4/3 pixels
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
declare function pointsToPixels(points: number): number;
|
|
33
|
-
|
|
34
1
|
/**
|
|
35
2
|
* Unit Conversion Utilities - Convert OOXML units to CSS/pixels
|
|
36
3
|
*
|
|
@@ -45,7 +12,10 @@ declare function pointsToPixels(points: number): number;
|
|
|
45
12
|
* @packageDocumentation
|
|
46
13
|
* @public
|
|
47
14
|
*/
|
|
48
|
-
|
|
15
|
+
declare const PIXELS_PER_INCH = 96;
|
|
16
|
+
declare function emuToPixels(emu: number | undefined | null): number;
|
|
17
|
+
declare function pixelsToEmu(px: number): number;
|
|
18
|
+
declare function pointsToPixels(points: number): number;
|
|
49
19
|
/** Twips per inch (1 inch = 1440 twips) */
|
|
50
20
|
declare const TWIPS_PER_INCH = 1440;
|
|
51
21
|
/**
|
package/dist/utils/units.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{f as AUTO_PARAGRAPH_SPACING_PX,a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-
|
|
1
|
+
export{f as AUTO_PARAGRAPH_SPACING_PX,a as PIXELS_PER_INCH,e as TWIPS_PER_INCH,p as clamp,n as eighthsToPixels,b as emuToPixels,i as emuToTwips,q as formatPx,k as halfPointsToPixels,l as halfPointsToPoints,c as pixelsToEmu,h as pixelsToTwips,m as pointsToHalfPoints,d as pointsToPixels,o as roundPixels,j as twipsToEmu,g as twipsToPixels}from'../chunk-CTBUQRYQ.mjs';import'../chunk-TTRUPDAB.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'./chunk-EUUIJVM6.mjs';export{b as createEditSession,a as preloadEditWasm}from'./chunk-4V6MDZIK.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{p as buildDisplayListJson,s as clearMeasureFonts,g as closeDisplayList,d as hasDisplayListSession,i as hasDisplayListUpdate,e as hasRangeRectsRegion,j as hitTestRegionsByHandle,b as hitTestRegionsJson,q as layoutDocumentJson,t as measureParagraphJson,f as openDisplayList,u as outlineGlyphJson,a as preloadLayoutWasm,m as rangeRectsByHandle,c as rangeRectsJson,o as rangeRectsRegionByHandle,n as rangeRectsRegionJson,r as registerMeasureFont,h as updateDisplayList,l as verticalMoveByHandle,k as verticalMoveJson}from'./chunk-NBSLB77E.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
|
package/dist/wasm-edit.d.mts
CHANGED
|
@@ -82,6 +82,7 @@ declare class EditSession {
|
|
|
82
82
|
* Applies a remote/incremental yrs v1 update.
|
|
83
83
|
*/
|
|
84
84
|
apply_update(update: Uint8Array): void;
|
|
85
|
+
apply_update_with_inference(update: Uint8Array): string;
|
|
85
86
|
/**
|
|
86
87
|
* Binary FrameDelta v1 display output. The returned `Vec<u8>` is exposed
|
|
87
88
|
* by wasm-bindgen as a transferable-friendly `Uint8Array`.
|
|
@@ -159,6 +160,7 @@ declare class EditSession {
|
|
|
159
160
|
* Region-scoped range geometry without a display-list JSON round trip.
|
|
160
161
|
*/
|
|
161
162
|
display_range_rects_region_json(region: string, r_id: string, from: number, to: number): string;
|
|
163
|
+
display_vertical_move_json(position: number, direction: string, goal_x: number): string;
|
|
162
164
|
drain_update_event(): Uint8Array;
|
|
163
165
|
encode_diff(remote_state_vector: Uint8Array): Uint8Array;
|
|
164
166
|
/**
|
|
@@ -166,6 +168,11 @@ declare class EditSession {
|
|
|
166
168
|
*/
|
|
167
169
|
encode_state(): Uint8Array;
|
|
168
170
|
encode_state_vector(): Uint8Array;
|
|
171
|
+
/**
|
|
172
|
+
* Encodes one paragraph location as a sticky position.
|
|
173
|
+
*/
|
|
174
|
+
encode_sticky_position(story: string, para_id: string, offset: number): Uint8Array;
|
|
175
|
+
encoded_selection(): string;
|
|
169
176
|
/**
|
|
170
177
|
* Applies a set-valued, tri-state inline formatting delta over
|
|
171
178
|
* `[start, end)` in one transaction. Omitted fields are kept and `null`
|
|
@@ -239,6 +246,10 @@ declare class EditSession {
|
|
|
239
246
|
* index, so `end - start` is the paragraph length (`offset` domain).
|
|
240
247
|
*/
|
|
241
248
|
locate_paragraph(story: string, para_id: string): string;
|
|
249
|
+
/**
|
|
250
|
+
* Materializes the retained canonical package for compatibility APIs.
|
|
251
|
+
*/
|
|
252
|
+
materialize_docx(): string | undefined;
|
|
242
253
|
/**
|
|
243
254
|
* Paragraph-measure compatibility export on the resident engine module.
|
|
244
255
|
*/
|
|
@@ -258,6 +269,10 @@ declare class EditSession {
|
|
|
258
269
|
* the host allocates it (yjs-style random 32-bit ids are fine).
|
|
259
270
|
*/
|
|
260
271
|
constructor(client_id: number);
|
|
272
|
+
/**
|
|
273
|
+
* Parses a DOCX and optionally seeds its editable stories.
|
|
274
|
+
*/
|
|
275
|
+
open_docx(bytes: Uint8Array, seed_stories: boolean): string;
|
|
261
276
|
/**
|
|
262
277
|
* Resolve one glyph outline from the session's resident font store.
|
|
263
278
|
*/
|
|
@@ -300,11 +315,21 @@ declare class EditSession {
|
|
|
300
315
|
* deletion and insertion share one revision id.
|
|
301
316
|
*/
|
|
302
317
|
replace_range(story: string, start_para: string, start_offset: number, end_para: string, end_offset: number, text: string, author_name?: string | null, author_date?: string | null): string;
|
|
318
|
+
resident_caret_snapshot_json(): string;
|
|
303
319
|
/**
|
|
304
320
|
* Current offsets of a comment's sticky anchors:
|
|
305
321
|
* `[{"story","start","end"}]`. Errors when an anchor no longer resolves.
|
|
306
322
|
*/
|
|
307
323
|
resolve_comment(comment_id: string): string;
|
|
324
|
+
resolve_encoded_selection(story: string, anchor: Uint8Array, head: Uint8Array): string;
|
|
325
|
+
/**
|
|
326
|
+
* Resolves one encoded sticky position to a paragraph location.
|
|
327
|
+
*/
|
|
328
|
+
resolve_sticky_position(story: string, position: Uint8Array): string;
|
|
329
|
+
/**
|
|
330
|
+
* Parses a DOCX, seeds its stories, and returns thin host metadata.
|
|
331
|
+
*/
|
|
332
|
+
seed_from_docx(bytes: Uint8Array): string;
|
|
308
333
|
/**
|
|
309
334
|
* Resolves this peer's current sticky selection as two public Locs, or
|
|
310
335
|
* `null` before the host establishes an initial selection.
|
package/dist/wasm-edit.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as createEditSession,a as preloadEditWasm}from'./chunk-
|
|
1
|
+
export{b as createEditSession,a as preloadEditWasm}from'./chunk-4V6MDZIK.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
|
package/dist/wasm-layout.d.mts
CHANGED
|
@@ -48,12 +48,25 @@ declare function hasRangeRectsRegion(): boolean;
|
|
|
48
48
|
declare function openDisplayList(displayList: string): number;
|
|
49
49
|
/** Drop a display-list handle so its parsed list is freed. No-op when the export is absent. */
|
|
50
50
|
declare function closeDisplayList(handle: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* Apply a page-delta update to a stored display list, re-parsing only its
|
|
53
|
+
* changed pages. Throws when the export is absent or the update is
|
|
54
|
+
* inconsistent — the Rust side closes the handle on failure, so the facade's
|
|
55
|
+
* fallback (a fresh `openDisplayList`) is always safe.
|
|
56
|
+
*/
|
|
57
|
+
declare function updateDisplayList(handle: number, update: string): void;
|
|
58
|
+
/** True when the embedded layout wasm carries the page-delta update export. */
|
|
59
|
+
declare function hasDisplayListUpdate(): boolean;
|
|
51
60
|
/**
|
|
52
61
|
* Region-aware hit test against a stored display list (by handle). Throws when
|
|
53
62
|
* the export is absent or the handle is unknown/closed — the facade catches it
|
|
54
63
|
* and falls back to `hitTestRegionsJson`.
|
|
55
64
|
*/
|
|
56
65
|
declare function hitTestRegionsByHandle(handle: number, pageIndex: number, x: number, y: number): string;
|
|
66
|
+
/** Resolve the closest caret position on the adjacent visual line. */
|
|
67
|
+
declare function verticalMoveJson(displayList: string, position: number, direction: 'up' | 'down', goalX: number): string;
|
|
68
|
+
/** Resolve the closest caret position on the adjacent visual line by handle. */
|
|
69
|
+
declare function verticalMoveByHandle(handle: number, position: number, direction: 'up' | 'down', goalX: number): string;
|
|
57
70
|
/**
|
|
58
71
|
* Highlight rects for a body PM range against a stored display list (by handle).
|
|
59
72
|
* Throws when the export is absent or the handle is unknown/closed.
|
|
@@ -109,4 +122,4 @@ declare function measureParagraphJson(input: string): string;
|
|
|
109
122
|
*/
|
|
110
123
|
declare function outlineGlyphJson(fontId: number, glyphId: number): string;
|
|
111
124
|
|
|
112
|
-
export { buildDisplayListJson, clearMeasureFonts, closeDisplayList, hasDisplayListSession, hasRangeRectsRegion, hitTestRegionsByHandle, hitTestRegionsJson, layoutDocumentJson, measureParagraphJson, openDisplayList, outlineGlyphJson, preloadLayoutWasm, rangeRectsByHandle, rangeRectsJson, rangeRectsRegionByHandle, rangeRectsRegionJson, registerMeasureFont };
|
|
125
|
+
export { buildDisplayListJson, clearMeasureFonts, closeDisplayList, hasDisplayListSession, hasDisplayListUpdate, hasRangeRectsRegion, hitTestRegionsByHandle, hitTestRegionsJson, layoutDocumentJson, measureParagraphJson, openDisplayList, outlineGlyphJson, preloadLayoutWasm, rangeRectsByHandle, rangeRectsJson, rangeRectsRegionByHandle, rangeRectsRegionJson, registerMeasureFont, updateDisplayList, verticalMoveByHandle, verticalMoveJson };
|