@betteroffice/docx 0.0.4 → 0.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/README.md +2 -1
- package/dist/chunk-24DL53QL.mjs +1 -0
- package/dist/chunk-5F6DLQZP.mjs +1 -0
- package/dist/{chunk-YTILOUAA.mjs → chunk-BUZ2X5CT.mjs} +1 -1
- package/dist/{chunk-B4IR6YP4.mjs → chunk-GHEHBYQK.mjs} +1 -1
- package/dist/{chunk-NJHOPXZW.mjs → chunk-HLDJMU3R.mjs} +1 -1
- package/dist/{chunk-4V6MDZIK.mjs → chunk-HTDNSQ44.mjs} +1 -1
- package/dist/{chunk-NTSSE5QK.mjs → chunk-PI2I3TO5.mjs} +1 -1
- package/dist/{chunk-6KDV6AIL.mjs → chunk-TMHG7OAZ.mjs} +1 -1
- package/dist/{chunk-NBSLB77E.mjs → chunk-VRGUAKOC.mjs} +1 -1
- package/dist/collaboration/index.d.mts +6 -6
- package/dist/{content-C3sTRz-u.d.mts → content-DrqzbIr7.d.mts} +67 -18
- package/dist/core.d.mts +7 -7
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-DLzpvJV6.d.mts → displayListQueries-DGDR-OWc.d.mts} +87 -50
- package/dist/docx/index.d.mts +5 -5
- package/dist/docx/index.mjs +1 -1
- package/dist/editor/index.d.mts +8 -8
- package/dist/{fontLoader-CMH3bZ2Z.d.mts → fontLoader-DnixuYST.d.mts} +1 -1
- package/dist/{formatting-BEkIBePP.d.mts → formatting-BqrFPeev.d.mts} +8 -0
- package/dist/{frameDelta-B2kC6XiP.d.mts → frameDelta-DMgR8n13.d.mts} +15 -10
- package/dist/generated/edit/docx_edit_bg.wasm +0 -0
- package/dist/generated/layout/docx_layout_bg.wasm +0 -0
- package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
- package/dist/generated/parse/docx_parse_bg.wasm +0 -0
- package/dist/{index-2piKi4gO.d.mts → index-ImoMd0Ju.d.mts} +32 -65
- package/dist/layout/index.d.mts +40 -13
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +4 -4
- package/dist/layout/render/index.d.mts +33 -77
- package/dist/layout/render/index.mjs +1 -1
- package/dist/plugin-api/RenderedDomContext.d.mts +7 -7
- package/dist/plugin-api/index.d.mts +3 -3
- package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
- package/dist/{rustDisplayList-B0M2eBkU.d.mts → rustDisplayList-B9dQoLHI.d.mts} +74 -50
- package/dist/{rustMeasureSource-D1KsQvVC.d.mts → rustMeasureSource-C0EZB055.d.mts} +5 -2
- package/dist/{selectiveSave-CVoajSKE.d.mts → selectiveSave-CRh-_Y_C.d.mts} +3 -3
- package/dist/styles/index.d.mts +3 -3
- package/dist/{styles-BK3Jecxs.d.mts → styles-CMybYYHS.d.mts} +1 -1
- package/dist/types/content.d.mts +2 -2
- package/dist/types/document.d.mts +7 -7
- package/dist/{types-C1rv3KM-.d.mts → types-CXLxVF1t.d.mts} +27 -23
- package/dist/utils/comments.d.mts +2 -2
- package/dist/utils/index.d.mts +11 -13
- package/dist/utils/index.mjs +1 -1
- package/dist/utils/stylePreview.d.mts +2 -2
- package/dist/wasm-CJHQHBDE.mjs +1 -0
- package/dist/{wasm-JE7B3ROD.mjs → wasm-T2CRCO7S.mjs} +1 -1
- package/dist/wasm-edit.d.mts +505 -173
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-layout.d.mts +31 -28
- package/dist/wasm-layout.mjs +1 -1
- package/dist/wasm-opc.mjs +1 -1
- package/dist/wasm-parse.mjs +1 -1
- package/dist/yrs/index.d.mts +5 -5
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +19 -2
- package/dist/chunk-GGEGIQRK.mjs +0 -1
- package/dist/chunk-T4EZMUXM.mjs +0 -1
- package/dist/wasm-F2ETFAYL.mjs +0 -1
package/dist/editor/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { R as ResidentMeasurementConfig } from '../rustMeasureSource-
|
|
2
|
-
import { L as LayoutBlock, B as BlockExtent, a as Layout, b as LayoutOptions } from '../types-
|
|
1
|
+
import { R as ResidentMeasurementConfig } from '../rustMeasureSource-C0EZB055.mjs';
|
|
2
|
+
import { L as LayoutBlock, B as BlockExtent, a as Layout, b as LayoutOptions } from '../types-CXLxVF1t.mjs';
|
|
3
3
|
import { MeasuredBlock } from '../layout/pagination/index.mjs';
|
|
4
|
-
import { D as DisplayListHeadersFooters } from '../rustDisplayList-
|
|
4
|
+
import { D as DisplayListHeadersFooters } from '../rustDisplayList-B9dQoLHI.mjs';
|
|
5
5
|
import { Document } from '../types/document.mjs';
|
|
6
|
-
import { Y as YrsSession, a as YrsRenderEnv } from '../index-
|
|
7
|
-
import { S as SectionProperties, N as NoteKind } from '../content-
|
|
8
|
-
import '../formatting-
|
|
9
|
-
import '../frameDelta-
|
|
10
|
-
import '../styles-
|
|
6
|
+
import { Y as YrsSession, a as YrsRenderEnv } from '../index-ImoMd0Ju.mjs';
|
|
7
|
+
import { S as SectionProperties, N as NoteKind } from '../content-DrqzbIr7.mjs';
|
|
8
|
+
import '../formatting-BqrFPeev.mjs';
|
|
9
|
+
import '../frameDelta-DMgR8n13.mjs';
|
|
10
|
+
import '../styles-CMybYYHS.mjs';
|
|
11
11
|
import '../docx/wrapTypes.mjs';
|
|
12
12
|
|
|
13
13
|
interface ResidentRegionLayoutRequest {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { y as ThemeColorSlot, C as ColorValue, f as Theme, x as ThemeColorScheme } from './formatting-
|
|
1
|
+
import { y as ThemeColorSlot, C as ColorValue, f as Theme, x as ThemeColorScheme } from './formatting-BqrFPeev.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Color primitives and math shared across OOXML formats.
|
|
@@ -411,6 +411,14 @@ interface ParagraphFormatting {
|
|
|
411
411
|
indentFirstLine?: number;
|
|
412
412
|
/** Whether first line is hanging indent */
|
|
413
413
|
hangingIndent?: boolean;
|
|
414
|
+
/** Left indent in hundredths of a character (w:ind/@w:leftChars) */
|
|
415
|
+
indentLeftChars?: number;
|
|
416
|
+
/** Right indent in hundredths of a character (w:ind/@w:rightChars) */
|
|
417
|
+
indentRightChars?: number;
|
|
418
|
+
/** First line indent in hundredths of a character - negative for hanging (w:ind/@w:firstLineChars or @w:hangingChars) */
|
|
419
|
+
indentFirstLineChars?: number;
|
|
420
|
+
/** Whether the character first-line indent is hanging; the sign of a zero does not survive JSON */
|
|
421
|
+
hangingIndentChars?: boolean;
|
|
414
422
|
/** Paragraph borders (w:pBdr) */
|
|
415
423
|
borders?: {
|
|
416
424
|
top?: BorderSpec;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TextModernEffects } from './formatting-
|
|
2
|
-
import { D as DrawingScene, d as ShapeTextBodyProperties } from './content-
|
|
1
|
+
import { T as TextModernEffects } from './formatting-BqrFPeev.mjs';
|
|
2
|
+
import { D as DrawingScene, d as ShapeTextBodyProperties } from './content-DrqzbIr7.mjs';
|
|
3
3
|
|
|
4
4
|
interface DisplayList {
|
|
5
5
|
/** Contract version. Undefined reads as legacy version 0. */
|
|
@@ -57,7 +57,7 @@ interface NoteRegion {
|
|
|
57
57
|
primitives?: DisplayPrimitive[];
|
|
58
58
|
noteIds?: number[];
|
|
59
59
|
/**
|
|
60
|
-
* Per-note backlink metadata (W17): the body-doc
|
|
60
|
+
* Per-note backlink metadata (W17): the body-doc range of each note's
|
|
61
61
|
* reference mark plus its formatted label, so the a11y mirror can wire
|
|
62
62
|
* note ↔ reference associations (doc-noteref / doc-backlink). Parallel to
|
|
63
63
|
* `noteIds`; undefined = legacy region without backlink data.
|
|
@@ -67,7 +67,7 @@ interface NoteRegion {
|
|
|
67
67
|
/** Backlink metadata for one note in a NoteRegion. */
|
|
68
68
|
interface NoteRegionNote {
|
|
69
69
|
id?: number;
|
|
70
|
-
/** Body-doc
|
|
70
|
+
/** Body-doc range of the reference mark anchoring this note. */
|
|
71
71
|
anchorDocStart?: number;
|
|
72
72
|
anchorDocEnd?: number;
|
|
73
73
|
/** Formatted reference label (display number / custom mark). File-derived. */
|
|
@@ -168,6 +168,11 @@ interface DisplayClipGroupMetadata {
|
|
|
168
168
|
};
|
|
169
169
|
opacity?: number;
|
|
170
170
|
}
|
|
171
|
+
/** Horizontal paint slot for text laid out with guessed metrics. */
|
|
172
|
+
interface DisplayPaintClip {
|
|
173
|
+
x: number;
|
|
174
|
+
w: number;
|
|
175
|
+
}
|
|
171
176
|
interface StructuralRevision {
|
|
172
177
|
scope: 'pmark' | 'table' | 'row' | 'cell';
|
|
173
178
|
author: string;
|
|
@@ -290,10 +295,7 @@ interface DocAttrs {
|
|
|
290
295
|
groupId?: string;
|
|
291
296
|
/** Review presentation for comment-associated primitives. */
|
|
292
297
|
comment?: DisplayCommentMetadata;
|
|
293
|
-
/**
|
|
294
|
-
* Scoped clip/group membership. Undefined = ungrouped. Kept as metadata
|
|
295
|
-
* until the canvas/mirror batch activates `ClipGroupPrimitive` in the union.
|
|
296
|
-
*/
|
|
298
|
+
/** Scoped clip/group membership. Undefined = ungrouped. */
|
|
297
299
|
clipGroup?: DisplayClipGroupMetadata;
|
|
298
300
|
/** Enclosing table-fragment identity and accessibility semantics. */
|
|
299
301
|
table?: DisplayTableMetadata;
|
|
@@ -304,6 +306,7 @@ interface TextRunPrimitive extends DocAttrs {
|
|
|
304
306
|
x: number;
|
|
305
307
|
baselineY: number;
|
|
306
308
|
width: number;
|
|
309
|
+
paintClip?: DisplayPaintClip;
|
|
307
310
|
font: string;
|
|
308
311
|
color: string;
|
|
309
312
|
letterSpacing?: number;
|
|
@@ -321,7 +324,7 @@ interface TextRunPrimitive extends DocAttrs {
|
|
|
321
324
|
smallCaps?: boolean;
|
|
322
325
|
/** Hidden run shown in editing view as dimmed/dotted, matching the DOM painter. */
|
|
323
326
|
hidden?: boolean;
|
|
324
|
-
/** CSS-like shadow effect
|
|
327
|
+
/** CSS-like shadow effect from run formatting. */
|
|
325
328
|
textShadow?: 'shadow' | 'emboss' | 'imprint';
|
|
326
329
|
/** Outlined / hollow text. */
|
|
327
330
|
textOutline?: boolean;
|
|
@@ -345,6 +348,7 @@ interface PositionedGlyph {
|
|
|
345
348
|
/** Bidi embedding level for this cluster. */
|
|
346
349
|
bidiLevel?: number;
|
|
347
350
|
}
|
|
351
|
+
/** Shaped glyph run with source text for accessibility. */
|
|
348
352
|
interface GlyphRunPrimitive extends DocAttrs {
|
|
349
353
|
kind: 'glyphRun';
|
|
350
354
|
fontId: number;
|
|
@@ -352,6 +356,7 @@ interface GlyphRunPrimitive extends DocAttrs {
|
|
|
352
356
|
color: string;
|
|
353
357
|
text: string;
|
|
354
358
|
glyphs: PositionedGlyph[];
|
|
359
|
+
paintClip?: DisplayPaintClip;
|
|
355
360
|
fallbackFont?: string;
|
|
356
361
|
wordSpacing?: number;
|
|
357
362
|
rtl?: boolean;
|
|
@@ -367,7 +372,7 @@ interface GlyphRunPrimitive extends DocAttrs {
|
|
|
367
372
|
smallCaps?: boolean;
|
|
368
373
|
/** Hidden run shown in editing view as dimmed/dotted, matching the DOM painter. */
|
|
369
374
|
hidden?: boolean;
|
|
370
|
-
/** CSS-like shadow effect
|
|
375
|
+
/** CSS-like shadow effect from run formatting. */
|
|
371
376
|
textShadow?: 'shadow' | 'emboss' | 'imprint';
|
|
372
377
|
/** Outlined / hollow text. */
|
|
373
378
|
textOutline?: boolean;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Document } from './types/document.mjs';
|
|
2
|
-
import { R as RetainedFrame } from './frameDelta-
|
|
2
|
+
import { R as RetainedFrame } from './frameDelta-DMgR8n13.mjs';
|
|
3
3
|
|
|
4
4
|
type CollaborationUpdateOrigin = 'local' | 'remote';
|
|
5
5
|
interface CollaborationReplica {
|
|
@@ -195,15 +195,7 @@ declare class ResidentEngineWorkerClient {
|
|
|
195
195
|
}
|
|
196
196
|
declare function canUseResidentEngineWorker(): boolean;
|
|
197
197
|
|
|
198
|
-
/**
|
|
199
|
-
* Direct Document -> yrs load projection.
|
|
200
|
-
*
|
|
201
|
-
* This is the Document-model twin of the coexistence seed path. It emits the
|
|
202
|
-
* same flat story vocabulary as `seedFromPm`, but never constructs a
|
|
203
|
-
* ProseMirror node: text becomes attributed Y.Text, paragraphs become pilcrow
|
|
204
|
-
* embeds, tables/block SDTs become structural embeds with child stories, and
|
|
205
|
-
* comments become root-story side-map entries.
|
|
206
|
-
*/
|
|
198
|
+
/** Direct Document-to-yrs load projection. */
|
|
207
199
|
|
|
208
200
|
/**
|
|
209
201
|
* Seeds every yrs-owned editable story directly from a parsed Document.
|
|
@@ -216,14 +208,7 @@ declare function canUseResidentEngineWorker(): boolean;
|
|
|
216
208
|
*/
|
|
217
209
|
declare function documentToYrs(session: YrsSession, document: Document): void;
|
|
218
210
|
|
|
219
|
-
/**
|
|
220
|
-
* yrs -> OOXML Document save projection.
|
|
221
|
-
*
|
|
222
|
-
* The yrs coexistence model stores each editable container as a flat story:
|
|
223
|
-
* text carries inline formatting attributes, pilcrows carry paragraph
|
|
224
|
-
* properties, and structural/inline atoms are map embeds. This module reads
|
|
225
|
-
* that representation directly and rebuilds the serializer-facing Document.
|
|
226
|
-
*/
|
|
211
|
+
/** yrs-to-OOXML save projection. */
|
|
227
212
|
|
|
228
213
|
/**
|
|
229
214
|
* Rebuild all yrs-owned editable stories into the serializer-facing Document
|
|
@@ -511,8 +496,8 @@ interface YrsRevisionReceipt {
|
|
|
511
496
|
revisionId: string | null;
|
|
512
497
|
}
|
|
513
498
|
/**
|
|
514
|
-
* Receipt of {@link YrsSession.splitParagraph}.
|
|
515
|
-
*
|
|
499
|
+
* Receipt of {@link YrsSession.splitParagraph}. The first half keeps the
|
|
500
|
+
* original paraId and the second half is re-minted; suggesting
|
|
516
501
|
* mode stamps a `pPrIns` revision on the first half.
|
|
517
502
|
*/
|
|
518
503
|
interface YrsSplitReceipt {
|
|
@@ -520,12 +505,7 @@ interface YrsSplitReceipt {
|
|
|
520
505
|
secondParaId: string;
|
|
521
506
|
revisionId: string | null;
|
|
522
507
|
}
|
|
523
|
-
/**
|
|
524
|
-
* One low-level story mirror operation for {@link YrsSession.applyRawOps}. The
|
|
525
|
-
* coexistence bridge lowers a ProseMirror transaction to a list of these and
|
|
526
|
-
* applies them in one yrs transaction. Indices are UTF-16 story units, each read
|
|
527
|
-
* against the story state after all prior ops in the batch.
|
|
528
|
-
*/
|
|
508
|
+
/** Low-level UTF-16 story operation for {@link YrsSession.applyRawOps}. */
|
|
529
509
|
type YrsRawOp = {
|
|
530
510
|
op: 'insert';
|
|
531
511
|
index: number;
|
|
@@ -552,13 +532,7 @@ type YrsRawOp = {
|
|
|
552
532
|
key: string;
|
|
553
533
|
value: unknown;
|
|
554
534
|
} | {
|
|
555
|
-
/**
|
|
556
|
-
* Upserts the side-map comment keyed by `id`, (re-)anchoring it to
|
|
557
|
-
* `ranges` — non-empty `[start, end)` story-unit spans in the batch's
|
|
558
|
-
* story (sticky `Assoc::After` starts / `Assoc::Before` ends). The
|
|
559
|
-
* coexistence bridge keys by the PM comment id so identity survives the
|
|
560
|
-
* mirror.
|
|
561
|
-
*/
|
|
535
|
+
/** Upserts a side-map comment with sticky story-unit ranges. */
|
|
562
536
|
op: 'setComment';
|
|
563
537
|
id: string;
|
|
564
538
|
ranges: ReadonlyArray<readonly [number, number]>;
|
|
@@ -686,7 +660,7 @@ interface YrsSelectionContext {
|
|
|
686
660
|
strike: YrsTriState;
|
|
687
661
|
/** Uniform ASCII font family, or `null` when absent/mixed. */
|
|
688
662
|
fontFamily: string | null;
|
|
689
|
-
/** Uniform font size in half-points (the
|
|
663
|
+
/** Uniform font size in half-points (the OOXML `w:sz` unit). */
|
|
690
664
|
fontSize: number | null;
|
|
691
665
|
/** Uniform RGB hex or theme-color name, or `null` when absent/mixed. */
|
|
692
666
|
color: string | null;
|
|
@@ -695,7 +669,7 @@ interface YrsSelectionContext {
|
|
|
695
669
|
styleId: string | null;
|
|
696
670
|
alignment: string | null;
|
|
697
671
|
/**
|
|
698
|
-
* Full authored pilcrow property bag. Known toolbar fields retain their
|
|
672
|
+
* Full authored pilcrow property bag. Known toolbar fields retain their
|
|
699
673
|
* names (`indentLeft`, `spaceBefore`, `lineSpacing`, `numPr`, and so on);
|
|
700
674
|
* paragraph style is stored as `pStyle`.
|
|
701
675
|
*/
|
|
@@ -764,8 +738,8 @@ interface YrsCellLoc extends YrsTableLoc {
|
|
|
764
738
|
column: number;
|
|
765
739
|
}
|
|
766
740
|
/**
|
|
767
|
-
* Anchor-cell to head-cell rectangular selection,
|
|
768
|
-
*
|
|
741
|
+
* Anchor-cell to head-cell rectangular selection, addressed by grid
|
|
742
|
+
* coordinates rather than document positions.
|
|
769
743
|
*
|
|
770
744
|
* @public
|
|
771
745
|
*/
|
|
@@ -789,7 +763,7 @@ interface YrsTableReceipt {
|
|
|
789
763
|
revisionIds: string[];
|
|
790
764
|
}
|
|
791
765
|
/**
|
|
792
|
-
* OOXML
|
|
766
|
+
* OOXML-shaped cell border value passed through to `tcPr.borders`.
|
|
793
767
|
*
|
|
794
768
|
* @public
|
|
795
769
|
*/
|
|
@@ -801,11 +775,13 @@ interface YrsCellBorder {
|
|
|
801
775
|
};
|
|
802
776
|
}
|
|
803
777
|
/**
|
|
804
|
-
*
|
|
778
|
+
* Per-side border patch for {@link YrsSession.setCellBorders}. An omitted side
|
|
779
|
+
* is left alone, `style: 'none'` authors an explicit no-border, and `null`
|
|
780
|
+
* drops the authored side.
|
|
805
781
|
*
|
|
806
782
|
* @public
|
|
807
783
|
*/
|
|
808
|
-
type YrsCellBorders = Partial<Record<'top' | 'bottom' | 'left' | 'right' | 'insideH' | 'insideV', YrsCellBorder>>;
|
|
784
|
+
type YrsCellBorders = Partial<Record<'top' | 'bottom' | 'left' | 'right' | 'insideH' | 'insideV', YrsCellBorder | null>>;
|
|
809
785
|
/**
|
|
810
786
|
* One live replica of the yrs editing model. Thin typed wrapper over the
|
|
811
787
|
* wasm `EditSession` — no editing logic on this side of the boundary.
|
|
@@ -871,11 +847,7 @@ interface YrsSession extends CollaborationReplica {
|
|
|
871
847
|
openDocx(bytes: Uint8Array, seedStories: boolean): YrsDocxHost;
|
|
872
848
|
/** Materializes the retained canonical package for compatibility APIs. */
|
|
873
849
|
materializeDocx(): Document | null;
|
|
874
|
-
/**
|
|
875
|
-
* Seeds stories from parsed content (S1 scaffold; the real
|
|
876
|
-
* `load(ParsedDocument)` lands with the ops track). Returns paraIds per
|
|
877
|
-
* story in document order.
|
|
878
|
-
*/
|
|
850
|
+
/** Seeds stories and returns paragraph IDs in document order. */
|
|
879
851
|
loadStories(stories: readonly YrsStorySeed[]): Record<string, string[]>;
|
|
880
852
|
/** Full document state as one yrs v1 update (Yjs wire format). */
|
|
881
853
|
encodeState(): Uint8Array;
|
|
@@ -910,6 +882,8 @@ interface YrsSession extends CollaborationReplica {
|
|
|
910
882
|
cellSelection(): YrsTableRange | null;
|
|
911
883
|
/** Lazily begin local-origin undo capture after import/seeding has completed. */
|
|
912
884
|
beginUndoCapture(story: string, includeTableStories?: boolean): void;
|
|
885
|
+
/** Story owned by the current undo/redo scope, or null before the first local edit. */
|
|
886
|
+
historyStory(): string | null;
|
|
913
887
|
/** Coalesce the stack entries added since `startDepth` into one host undo intent. */
|
|
914
888
|
markUndoGroup(startDepth: number): void;
|
|
915
889
|
/** Undo/redo only local-origin direct operations (never remote/system transactions). */
|
|
@@ -943,11 +917,14 @@ interface YrsSession extends CollaborationReplica {
|
|
|
943
917
|
/** Sets or clears the selected cells' background color. */
|
|
944
918
|
setCellShading(range: YrsTableRange, color: string | null): YrsTableReceipt;
|
|
945
919
|
/**
|
|
946
|
-
* Merges an OOXML
|
|
920
|
+
* Merges an OOXML-shaped patch into selected cells' `tcPr`. JSON `null`
|
|
947
921
|
* clears a property; merge/split-owned span keys are rejected.
|
|
948
922
|
*/
|
|
949
923
|
setCellTextFormat(range: YrsTableRange, patch: Readonly<Record<string, unknown>>): YrsTableReceipt;
|
|
950
|
-
/**
|
|
924
|
+
/**
|
|
925
|
+
* Merges border sides into the selected cells. `insideH`/`insideV` resolve
|
|
926
|
+
* per cell to the physical edges interior to the selection.
|
|
927
|
+
*/
|
|
951
928
|
setCellBorders(range: YrsTableRange, borders: YrsCellBorders): YrsTableReceipt;
|
|
952
929
|
/** Sets one authored grid-column width in twips. */
|
|
953
930
|
setColumnWidth(at: YrsCellLoc, widthTwips: number): YrsTableReceipt;
|
|
@@ -969,7 +946,10 @@ interface YrsSession extends CollaborationReplica {
|
|
|
969
946
|
splitParagraph(at: YrsLoc, suggesting?: YrsAuthor): YrsSplitReceipt;
|
|
970
947
|
/** Merges `paraId` with the FOLLOWING paragraph. Errors on the final paragraph. */
|
|
971
948
|
mergeParagraphs(story: string, paraId: string, suggesting?: YrsAuthor): YrsRevisionReceipt;
|
|
972
|
-
/**
|
|
949
|
+
/**
|
|
950
|
+
* Toggles one run mark across a range: removes it when every unit already
|
|
951
|
+
* carries it, otherwise adds it.
|
|
952
|
+
*/
|
|
973
953
|
toggleMark(range: YrsStoryRange, mark: YrsRunMark): void;
|
|
974
954
|
/** Applies set-valued direct formatting; omitted fields are kept and `null` fields clear. */
|
|
975
955
|
formatRange(range: YrsStoryRange, delta: YrsInlineFormatDelta): void;
|
|
@@ -997,18 +977,14 @@ interface YrsSession extends CollaborationReplica {
|
|
|
997
977
|
insertSectionBreak(at: YrsLoc, type: 'nextPage' | 'continuous' | 'oddPage' | 'evenPage'): void;
|
|
998
978
|
/** Inserts a typed watermark embed at a paragraph-keyed location. */
|
|
999
979
|
insertWatermark(at: YrsLoc, watermark: YrsWatermark): void;
|
|
1000
|
-
/**
|
|
1001
|
-
* Applies a batch of raw story mirror ops in one transaction — the coexistence
|
|
1002
|
-
* bridge's mirror-into-yrs path (a faithful mirror of lowered PM state, not a
|
|
1003
|
-
* user-intent op). Not for direct app use.
|
|
1004
|
-
*/
|
|
980
|
+
/** Applies raw story operations in one transaction. */
|
|
1005
981
|
applyRawOps(story: string, ops: readonly YrsRawOp[]): void;
|
|
1006
982
|
/** Sets one paragraph property (any JSON value). `paraId` is reserved. */
|
|
1007
983
|
setParagraphAttr(paraId: string, key: string, value: unknown): void;
|
|
1008
984
|
/** Adds a sticky-anchored comment over one or more ranges. */
|
|
1009
985
|
addComment(ranges: readonly YrsStoryRange[], author: string, date: string, body: unknown): YrsCommentReceipt;
|
|
1010
986
|
/**
|
|
1011
|
-
* Accepts tracked changes
|
|
987
|
+
* Accepts tracked changes: pending insertions become plain content,
|
|
1012
988
|
* pending deletions are carried out; a `pPrIns` paragraph mark clears (the
|
|
1013
989
|
* split stays), a `pPrDel` mark joins with the following paragraph (whose
|
|
1014
990
|
* pPr survives — Word's surviving-`w:p` rule). Resolving never stamps a new
|
|
@@ -1031,18 +1007,9 @@ interface YrsSession extends CollaborationReplica {
|
|
|
1031
1007
|
storyIds(): string[];
|
|
1032
1008
|
/** Story length in UTF-16 units (every embed, pilcrows included, counts 1). */
|
|
1033
1009
|
storyLength(story: string): number;
|
|
1034
|
-
/**
|
|
1035
|
-
* The story's `canonical-stream-v1` FNV-1a checksum. The coexistence watchdog
|
|
1036
|
-
* compares it against the PM projector's checksum after every mirrored edit.
|
|
1037
|
-
*/
|
|
1010
|
+
/** Returns the story's canonical-stream checksum. */
|
|
1038
1011
|
storyChecksum(story: string): bigint;
|
|
1039
|
-
/**
|
|
1040
|
-
* Lowers a story through the resident Rust bridge. Throws with an
|
|
1041
|
-
* unsupported-embed message on any non-native content (opaque blobs) until
|
|
1042
|
-
* that class is promoted to native.
|
|
1043
|
-
* The return is the layout pipeline's `LayoutBlock[]` (kept as `unknown[]` to
|
|
1044
|
-
* keep this facade decoupled from the layout types).
|
|
1045
|
-
*/
|
|
1012
|
+
/** Lowers a story to layout blocks and rejects unsupported embeds. */
|
|
1046
1013
|
yrsBlocksForStory(story: string, env?: YrsRenderEnv): unknown[];
|
|
1047
1014
|
/** Paragraph snapshots in document order. */
|
|
1048
1015
|
paragraphs(story: string): YrsParagraph[];
|
package/dist/layout/index.d.mts
CHANGED
|
@@ -1,15 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { B as BundledFontProvider } from '../rustMeasureSource-C0EZB055.mjs';
|
|
2
|
+
export { a as BundledFontProviderSource, E as EmbeddedFaceInput, F as FontScript, b as ResidentFontRequirement, R as ResidentMeasurementConfig, c as RustMeasureSource, d as RustTextEngine, e as createRustMeasureSource, g as getRustTextEngine } from '../rustMeasureSource-C0EZB055.mjs';
|
|
3
|
+
import { S as SectionProperties, H as HeaderFooter } from '../content-DrqzbIr7.mjs';
|
|
4
|
+
export { D as DrawingScene, V as DrawingSceneNode, c as ShapeEffect, aW as ShapeFillPaint, aX as ShapeStrokePaint, d as ShapeTextBodyProperties } from '../content-DrqzbIr7.mjs';
|
|
4
5
|
import { Document } from '../types/document.mjs';
|
|
5
|
-
import
|
|
6
|
-
import '../formatting-BEkIBePP.mjs';
|
|
6
|
+
import '../formatting-BqrFPeev.mjs';
|
|
7
7
|
import '../docx/wrapTypes.mjs';
|
|
8
|
-
import '../styles-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
import '../styles-CMybYYHS.mjs';
|
|
9
|
+
|
|
10
|
+
/** Opt-in bundled-font provider resolution. @packageDocumentation */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The slice of `@betteroffice/fonts` this module consumes. Structural on
|
|
14
|
+
* purpose: the engine never names that package, so no bundler ever has to
|
|
15
|
+
* resolve it.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
interface BundledFontModule {
|
|
20
|
+
createFontProvider(options?: {
|
|
21
|
+
baseUrl?: string | URL;
|
|
22
|
+
}): BundledFontProvider;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* How to obtain bundled fonts. Nothing is loaded until one of `fonts` or
|
|
26
|
+
* `load` is given — the engine never reaches for a font package on its own.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
interface DefaultFontOptions {
|
|
31
|
+
/** The imported `@betteroffice/fonts` module. */
|
|
32
|
+
fonts?: BundledFontModule;
|
|
33
|
+
/** Lazy alternative to {@link DefaultFontOptions.fonts}, resolving to the same module. */
|
|
34
|
+
load?: () => Promise<unknown>;
|
|
35
|
+
/** Fetch the faces from this base URL instead of the module's own assets. */
|
|
36
|
+
baseUrl?: string | URL;
|
|
37
|
+
}
|
|
38
|
+
/** Configure the default provider and reset its memoized resolution. @public */
|
|
39
|
+
declare function configureDefaultFonts(next: DefaultFontOptions): void;
|
|
40
|
+
/** Resolve the configured provider, or `undefined` when no font source is set. @public */
|
|
41
|
+
declare function resolveDefaultFontProvider(): Promise<BundledFontProvider | undefined>;
|
|
13
42
|
|
|
14
43
|
/**
|
|
15
44
|
* Selection-overlay geometry value types, shared by the canvas overlays and
|
|
@@ -59,8 +88,6 @@ declare function resolveHeaderFooter(document: Document | null, section: Section
|
|
|
59
88
|
firstHeader: HeaderFooter | null;
|
|
60
89
|
firstFooter: HeaderFooter | null;
|
|
61
90
|
};
|
|
62
|
-
declare function computeHfCaretRectsFromDisplayList(queries: DisplayListQueries, section: 'header' | 'footer', rId: string, position: number, pageIndex?: number): DisplayListRect[];
|
|
63
|
-
declare function computeHfSelectionRectsFromDisplayList(queries: DisplayListQueries, section: 'header' | 'footer', rId: string, from: number, to: number, pageIndex?: number): DisplayListRect[];
|
|
64
91
|
|
|
65
92
|
/** Coordinates selection paint with the latest completed layout sequence. */
|
|
66
93
|
declare class LayoutSelectionGate {
|
|
@@ -84,4 +111,4 @@ declare class LayoutSelectionGate {
|
|
|
84
111
|
};
|
|
85
112
|
}
|
|
86
113
|
|
|
87
|
-
export { type CaretPosition, DEFAULT_PAGE_HEIGHT_PX, LayoutSelectionGate, type SelectionRect,
|
|
114
|
+
export { type BundledFontModule, BundledFontProvider, type CaretPosition, DEFAULT_PAGE_HEIGHT_PX, type DefaultFontOptions, LayoutSelectionGate, type SelectionRect, configureDefaultFonts, resolveDefaultFontProvider, resolveHeaderFooter };
|
package/dist/layout/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {d,e,g as g$1,c,f,b as b$1}from'../chunk-TTRUPDAB.mjs';function x(o){return o.trim().toLowerCase()}function B(o,e,t){return `${x(o)}|${e?1:0}|${t?1:0}`}var I=class{constructor(e,t){b$1(this,"sink");b$1(this,"bundled");b$1(this,"facesByFamily",new Map);b$1(this,"faceIds",new WeakMap);b$1(this,"bundledIds",new Map);b$1(this,"lastResortIds",new Map);b$1(this,"bufferIds",new WeakMap);b$1(this,"scriptIds",new Map);b$1(this,"scriptResults",new Map);b$1(this,"chains",new Map);b$1(this,"chainResults",new Map);b$1(this,"generation",0);this.sink=e,this.bundled=t?.bundled;}setEmbeddedFaces(e){this.generation++,this.facesByFamily=new Map;for(let t of e){let n=x(t.family),r=this.facesByFamily.get(n);r?r.push(t):this.facesByFamily.set(n,[t]);}this.chains=new Map,this.chainResults=new Map;}getFontIdChain(e,t,n){let r=B(e,t,n),i=this.chains.get(r);return i||(i=this.resolveChain(r,e,t,n),this.chains.set(r,i)),i}getCachedFontIdChain(e,t,n){return this.chainResults.get(B(e,t,n))}getScriptFallbackIds(e){let t=[...new Set(e)];return Promise.all(t.map(n=>this.resolveScript(n))).then(n=>{let r=[];for(let i of n)i!==null&&!r.includes(i)&&r.push(i);return r})}getCachedScriptFallbackIds(e){let t=[];for(let n of e){if(!this.scriptResults.has(n))return;let r=this.scriptResults.get(n);r!==null&&!t.includes(r)&&t.push(r);}return t}clear(){this.generation++,this.faceIds=new WeakMap,this.bundledIds=new Map,this.lastResortIds=new Map,this.bufferIds=new WeakMap,this.scriptIds=new Map,this.scriptResults=new Map,this.chains=new Map,this.chainResults=new Map;}async resolveChain(e,t,n,r){let i=this.generation,s=[],a=this.pickEmbeddedFace(t,n,r);if(a){let l=await this.registerFace(a);l!==null&&s.push(l);}let f=this.bundled?.resolve(t,n,r);if(f){let l=await this.registerBundled(e,f,t);l!==null&&!s.includes(l)&&s.push(l);}let h=this.bundled?.resolveLastResort?.(t,n,r);if(h){let l=await this.registerLastResort(e,h,t);l!==null&&!s.includes(l)&&s.push(l);}return i===this.generation&&this.chainResults.set(e,s),s}pickEmbeddedFace(e,t,n){let r=this.facesByFamily.get(x(e));if(!r)return;let i=t?"bold":"normal",s=n?"italic":"normal";return r.find(a=>a.weight===i&&a.style===s)??r.find(a=>a.weight==="normal"&&a.style==="normal")}registerBuffer(e){let t=this.bufferIds.get(e);return t||(t=Promise.resolve().then(()=>this.sink.registerFont(new Uint8Array(e))),t.catch(()=>{}),this.bufferIds.set(e,t)),t}registerFace(e){let t=this.faceIds.get(e);return t||(t=(async()=>{try{return await this.registerBuffer(e.data)}catch{return console.warn(`[fontRegistry] embedded face "${e.family}" (${e.weight} ${e.style}) was rejected by the text engine; falling back`),null}})(),this.faceIds.set(e,t)),t}registerBundled(e,t,n){let r=this.bundledIds.get(e);return r||(r=(async()=>{try{let i=await t();return await this.registerBuffer(i)}catch{return console.warn(`[fontRegistry] bundled face for "${n}" failed to load or register; falling back`),null}})(),this.bundledIds.set(e,r)),r}registerLastResort(e,t,n){let r=this.lastResortIds.get(e);return r||(r=(async()=>{try{let i=await t();return await this.registerBuffer(i)}catch{return console.warn(`[fontRegistry] last-resort base face for "${n}" failed to load or register; falling back`),null}})(),this.lastResortIds.set(e,r)),r}resolveScript(e){let t=this.scriptIds.get(e);if(!t){let n=this.scriptResults;t=(async()=>{let r=null,i=this.bundled?.resolveScriptFallback?.(e,false,false);if(i)try{let s=await i();r=await this.registerBuffer(s);}catch{console.warn(`[fontRegistry] script-fallback face for "${e}" failed to load or register; falling back`);}return n.set(e,r),r})(),this.scriptIds.set(e,t);}return t}};var L=null;function T(){return L??(L=import('../wasm-JE7B3ROD.mjs').then(async o=>(await o.preloadLayoutWasm(),{registerFont:o.registerMeasureFont,clearFonts:o.clearMeasureFonts}))),L}function H(o){let e=new I({registerFont:n=>o.engine.registerFont(n)},{bundled:o.bundled}),t;return {setEmbeddedFaces(n){e.setEmbeddedFaces(n);},setCompat(n){t=n;},async prepareFontRequirements(n){return (await Promise.all(n.flatMap(i=>[(async()=>{try{return e.getCachedFontIdChain(i.family,i.bold,i.italic)!==void 0?!1:(await e.getFontIdChain(i.family,i.bold,i.italic),!0)}catch{return false}})(),...Array.from(new Set(i.scripts??[]),async s=>{try{return e.getCachedScriptFallbackIds([s])!==void 0?!1:(await e.getScriptFallbackIds([s]),!0)}catch{return false}})]))).some(Boolean)},measurementConfigForRequirements(n){let r={};for(let i of n){let s=e.getCachedFontIdChain(i.family,i.bold,i.italic),a=e.getCachedScriptFallbackIds(i.scripts??[]);if(s===void 0||a===void 0)return;let f=Array.from(s);for(let h of a)f.includes(h)||f.push(h);f.length>0&&(r[i.key]=f);}return {fontChains:r,defaults:{fontSize:11,fontFamily:"Calibri"},compat:{noLeading:t?.noLeading??false,doNotExpandShiftReturn:t?.doNotExpandShiftReturn??false},authoritativeShaping:true}},clear(){e.clear();}}}var q=1056;function A(o,e){let t=o?.package.headers,n=o?.package.footers,r=e?.headerReferences?.find(y=>y.type==="default"),i=e?.headerReferences?.find(y=>y.type==="first"),s=e?.footerReferences?.find(y=>y.type==="default"),a=e?.footerReferences?.find(y=>y.type==="first"),f=r?t?.get(r.rId)??null:null,h=s?n?.get(s.rId)??null:null,l=i?t?.get(i.rId)??null:null,k=a?n?.get(a.rId)??null:null;return e?.titlePg||(f??(f=l),h??(h=k)),{header:f,footer:h,firstHeader:l,firstFooter:k}}function D(o,e,t,n,r){let i=o.hfCaretRects(e,t,n);return r===void 0?i:i.filter(s=>s.pageIndex===r)}function $(o,e,t,n,r,i){let s=o.hfRangeRects(e,t,Math.min(n,r),Math.max(n,r));return i===void 0?s:s.filter(a=>a.pageIndex===i)}var p,m,g,b,R,w,E,C=class{constructor(){d(this,w);d(this,p,0);d(this,m,0);d(this,g,false);d(this,b,false);d(this,R,new Set);}setStateSeq(e$1){e(this,p,e$1);}incrementStateSeq(){return ++g$1(this,p)._}getStateSeq(){return c(this,p)}getRenderSeq(){return c(this,m)}onLayoutStart(){e(this,g,true);}onLayoutComplete(e$1){e(this,m,e$1),e(this,g,false),c(this,b)&&this.isSafeToRender()&&(e(this,b,false),f(this,w,E).call(this));}isSafeToRender(){return !c(this,g)&&c(this,m)>=c(this,p)}requestRender(){this.isSafeToRender()?f(this,w,E).call(this):e(this,b,true);}onRender(e){return c(this,R).add(e),()=>c(this,R).delete(e)}reset(){e(this,p,0),e(this,m,0),e(this,g,false),e(this,b,false);}getDebugInfo(){return {stateSeq:c(this,p),renderSeq:c(this,m),layoutUpdating:c(this,g),hasPendingRender:c(this,b),isSafe:this.isSafeToRender()}}};p=new WeakMap,m=new WeakMap,g=new WeakMap,b=new WeakMap,R=new WeakMap,w=new WeakSet,E=function(){for(let e of c(this,R))try{e();}catch(t){console.error("LayoutSelectionGate: render callback error",t);}};export{q as DEFAULT_PAGE_HEIGHT_PX,C as LayoutSelectionGate,D as computeHfCaretRectsFromDisplayList,$ as computeHfSelectionRectsFromDisplayList,H as createRustMeasureSource,T as getRustTextEngine,A as resolveHeaderFooter};
|
|
1
|
+
import {d,e,g as g$1,c,f,b as b$1}from'../chunk-TTRUPDAB.mjs';var I={},R;function L(s){if(s===void 0)return;let e=typeof s=="string"?s:s.href,t=typeof location>"u"?void 0:location.href;try{return new URL(e,t)}catch{throw new TypeError(`configureDefaultFonts baseUrl must be absolute when no browser location exists: ${e}`)}}function U(){return I.fonts!==void 0||I.load!==void 0}function H(s){I={...s,baseUrl:L(s.baseUrl)},R=void 0,I.baseUrl!==void 0&&!U()&&console.warn("[configureDefaultFonts] a baseUrl on its own loads nothing \u2014 the face manifest lives in @betteroffice/fonts. Pass the module too: configureDefaultFonts({ fonts, baseUrl }).");}async function K(){let{baseUrl:s,fonts:e,load:t}=I;try{return (e??await t()).createFontProvider(s===void 0?void 0:{baseUrl:s})}catch(r){console.warn("[configureDefaultFonts] the configured font source failed to load",r);return}}function M(){if(!U())return Promise.resolve(void 0);if(R===void 0){let s=K();s.then(e=>{e===void 0&&R===s&&(R=void 0);}),R=s;}return R}function $(s){return s.trim().toLowerCase()}function C(s,e,t){return `${$(s)}|${e?1:0}|${t?1:0}`}function k(s,e,t,r){t.then(n=>{r(n)&&s.get(e)===t&&s.delete(e);},()=>{s.get(e)===t&&s.delete(e);});}var x=class{constructor(e,t){b$1(this,"sink");b$1(this,"bundledSource");b$1(this,"bundledPromise");b$1(this,"warnedFallback",false);b$1(this,"facesByFamily",new Map);b$1(this,"faceIds",new WeakMap);b$1(this,"bundledIds",new Map);b$1(this,"lastResortIds",new Map);b$1(this,"bufferIds",new WeakMap);b$1(this,"scriptIds",new Map);b$1(this,"scriptResults",new Map);b$1(this,"chains",new Map);b$1(this,"chainResults",new Map);b$1(this,"generation",0);this.sink=e,this.bundledSource=t?.bundled;}bundled(){if(this.bundledPromise===void 0){let e=this.bundledSource,t=Promise.resolve().then(()=>typeof e=="function"?e():e).catch(()=>{});t.then(r=>{r===void 0&&this.bundledPromise===t&&(this.bundledPromise=void 0);}),this.bundledPromise=t;}return this.bundledPromise}setEmbeddedFaces(e){this.generation++,this.facesByFamily=new Map;for(let t of e){let r=$(t.family),n=this.facesByFamily.get(r);n?n.push(t):this.facesByFamily.set(r,[t]);}this.chains=new Map,this.chainResults=new Map;}getFontIdChain(e,t,r){let n=C(e,t,r),o=this.chains.get(n);if(!o){let i=this.chains,a=this.chainResults,f=this.generation,u=this.resolveChain(e,t,r);u.then(l=>{f===this.generation&&(a.set(n,l),l.retryable&&i.get(n)===u&&i.delete(n));},()=>{i.get(n)===u&&i.delete(n);}),i.set(n,u),o=u;}return o.then(i=>i.ids)}getCachedFontIdChain(e,t,r){let n=C(e,t,r),o=this.chainResults.get(n);if(o?.retryable){let i=this.chainResults;queueMicrotask(()=>{i.get(n)===o&&i.delete(n);});}return o?.ids}getScriptFallbackIds(e){let t=[...new Set(e)];return Promise.all(t.map(r=>this.resolveScript(r))).then(r=>{let n=[];for(let{id:o}of r)o!==null&&!n.includes(o)&&n.push(o);return n})}getCachedScriptFallbackIds(e){let t=this.scriptResults,r=[];for(let o of e){let i=t.get(o);if(!i)return;r.push([o,i]);}let n=[];for(let[o,i]of r){let{id:a}=i;a!==null&&!n.includes(a)&&n.push(a),i.retryable&&queueMicrotask(()=>{t.get(o)===i&&t.delete(o);});}return n}clear(){this.generation++,this.bundledPromise=void 0,this.faceIds=new WeakMap,this.bundledIds=new Map,this.lastResortIds=new Map,this.bufferIds=new WeakMap,this.scriptIds=new Map,this.scriptResults=new Map,this.chains=new Map,this.chainResults=new Map;}async resolveChain(e,t,r){let n=C(e,t,r),o=[],i=false,a=this.pickEmbeddedFace(e,t,r);if(a){let d=await this.registerFace(a);d!==null?o.push(d):i=true;}let f=await this.bundled();f===void 0&&typeof this.bundledSource=="function"&&(i=true);let u;try{u=f?.resolve(e,t,r);}catch(d){i=true,console.warn(`[fontRegistry] bundled face resolver for "${e}" failed; falling back: ${d instanceof Error?d.message:String(d)}`);}if(u){let d=await this.registerBundled(n,u,e);d!==null&&!o.includes(d)&&o.push(d),d===null&&(i=true);}let l;try{l=f?.resolveLastResort?.(e,t,r);}catch(d){i=true,console.warn(`[fontRegistry] last-resort resolver for "${e}" failed; falling back: ${d instanceof Error?d.message:String(d)}`);}if(l){let d=await this.registerLastResort(n,l,e);d!==null&&!o.includes(d)&&o.push(d),d===null&&(i=true);}return o.length===0&&this.warnFallback(e,f!==void 0,u!==void 0||l!==void 0),{ids:o,retryable:i}}warnFallback(e,t,r){if(this.warnedFallback)return;this.warnedFallback=true;let n="Native measurement is unsupported; browser hosts fall back to measureText and may use different OS fonts, so pagination can vary. Reported once per registry.";console.warn(r?`[fontRegistry] no font bytes for "${e}" \u2014 the font provider resolved but every matching face failed to load. ${n} If a bundler inlined @betteroffice/fonts, mark it external so its asset URLs resolve.`:t?`[fontRegistry] no font bytes for "${e}" \u2014 the configured font provider has no matching face. Add coverage for this family. ${n}`:`[fontRegistry] no font bytes for "${e}" \u2014 no font provider is configured. Install @betteroffice/fonts and pass it with configureDefaultFonts({ fonts }). `+n);}pickEmbeddedFace(e,t,r){let n=this.facesByFamily.get($(e));if(!n)return;let o=t?"bold":"normal",i=r?"italic":"normal";return n.find(a=>a.weight===o&&a.style===i)??n.find(a=>a.weight==="normal"&&a.style==="normal")}registerBuffer(e){let t=this.bufferIds.get(e);if(!t){let r=this.bufferIds;t=Promise.resolve().then(()=>this.sink.registerFont(new Uint8Array(e))),k(r,e,t,()=>false),r.set(e,t);}return t}registerFace(e){let t=this.faceIds.get(e);if(!t){let r=this.faceIds;t=(async()=>{try{return await this.registerBuffer(e.data)}catch{return console.warn(`[fontRegistry] embedded face "${e.family}" (${e.weight} ${e.style}) was rejected by the text engine; falling back`),null}})(),k(r,e,t,n=>n===null),r.set(e,t);}return t}registerBundled(e,t,r){let n=this.bundledIds.get(e);if(!n){let o=this.bundledIds;n=(async()=>{try{let i=await t();return await this.registerBuffer(i)}catch(i){return console.warn(`[fontRegistry] bundled face for "${r}" failed to load or register; falling back: ${i instanceof Error?i.message:String(i)}`),null}})(),k(o,e,n,i=>i===null),o.set(e,n);}return n}registerLastResort(e,t,r){let n=this.lastResortIds.get(e);if(!n){let o=this.lastResortIds;n=(async()=>{try{let i=await t();return await this.registerBuffer(i)}catch{return console.warn(`[fontRegistry] last-resort base face for "${r}" failed to load or register; falling back`),null}})(),k(o,e,n,i=>i===null),o.set(e,n);}return n}resolveScript(e){let t=this.scriptIds.get(e);if(!t){let r=this.scriptIds,n=this.scriptResults;t=(async()=>{let o=null,i=false,a=await this.bundled();a===void 0&&typeof this.bundledSource=="function"&&(i=true);let f;try{f=a?.resolveScriptFallback?.(e,!1,!1);}catch(l){i=true,console.warn(`[fontRegistry] script-fallback resolver for "${e}" failed; falling back: ${l instanceof Error?l.message:String(l)}`);}if(f)try{let l=await f();o=await this.registerBuffer(l);}catch(l){i=true,console.warn(`[fontRegistry] script-fallback face for "${e}" failed to load or register; falling back: ${l instanceof Error?l.message:String(l)}`);}let u={id:o,retryable:i};return n.set(e,u),u})(),k(r,e,t,o=>o.retryable),r.set(e,t);}return t}};var q=null;function j(){return q??(q=import('../wasm-T2CRCO7S.mjs').then(async s=>(await s.preloadLayoutWasm(),{registerFont:s.registerMeasureFont,clearFonts:s.clearMeasureFonts}))),q}function V(s){let e=new x({registerFont:r=>s.engine.registerFont(r)},{bundled:s.bundled??M}),t;return {setEmbeddedFaces(r){e.setEmbeddedFaces(r);},setCompat(r){t=r;},async prepareFontRequirements(r){return (await Promise.all(r.flatMap(o=>[(async()=>{try{return e.getCachedFontIdChain(o.family,o.bold,o.italic)!==void 0?!1:(await e.getFontIdChain(o.family,o.bold,o.italic),!0)}catch{return false}})(),...Array.from(new Set(o.scripts??[]),async i=>{try{return e.getCachedScriptFallbackIds([i])!==void 0?!1:(await e.getScriptFallbackIds([i]),!0)}catch{return false}})]))).some(Boolean)},measurementConfigForRequirements(r){let n={};for(let o of r){let i=e.getCachedFontIdChain(o.family,o.bold,o.italic),a=e.getCachedScriptFallbackIds(o.scripts??[]);if(i===void 0||a===void 0)return;let f=Array.from(i);for(let u of a)f.includes(u)||f.push(u);f.length>0&&(n[o.key]=f);}return {fontChains:n,defaults:{fontSize:11,fontFamily:"Calibri"},compat:{noLeading:t?.noLeading??false,doNotExpandShiftReturn:t?.doNotExpandShiftReturn??false},authoritativeShaping:true}},clear(){e.clear();}}}var _=1056;function G(s,e){let t=s?.package.headers,r=s?.package.footers,n=e?.headerReferences?.find(F=>F.type==="default"),o=e?.headerReferences?.find(F=>F.type==="first"),i=e?.footerReferences?.find(F=>F.type==="default"),a=e?.footerReferences?.find(F=>F.type==="first"),f=n?t?.get(n.rId)??null:null,u=i?r?.get(i.rId)??null:null,l=o?t?.get(o.rId)??null:null,d=a?r?.get(a.rId)??null:null;return e?.titlePg||(f??(f=l),u??(u=d)),{header:f,footer:u,firstHeader:l,firstFooter:d}}var g,b,m,y,w,B,T,A=class{constructor(){d(this,B);d(this,g,0);d(this,b,0);d(this,m,false);d(this,y,false);d(this,w,new Set);}setStateSeq(e$1){e(this,g,e$1);}incrementStateSeq(){return ++g$1(this,g)._}getStateSeq(){return c(this,g)}getRenderSeq(){return c(this,b)}onLayoutStart(){e(this,m,true);}onLayoutComplete(e$1){e(this,b,e$1),e(this,m,false),c(this,y)&&this.isSafeToRender()&&(e(this,y,false),f(this,B,T).call(this));}isSafeToRender(){return !c(this,m)&&c(this,b)>=c(this,g)}requestRender(){this.isSafeToRender()?f(this,B,T).call(this):e(this,y,true);}onRender(e){return c(this,w).add(e),()=>c(this,w).delete(e)}reset(){e(this,g,0),e(this,b,0),e(this,m,false),e(this,y,false);}getDebugInfo(){return {stateSeq:c(this,g),renderSeq:c(this,b),layoutUpdating:c(this,m),hasPendingRender:c(this,y),isSafe:this.isSafeToRender()}}};g=new WeakMap,b=new WeakMap,m=new WeakMap,y=new WeakMap,w=new WeakMap,B=new WeakSet,T=function(){for(let e of c(this,w))try{e();}catch(t){console.error("LayoutSelectionGate: render callback error",t);}};export{_ as DEFAULT_PAGE_HEIGHT_PX,A as LayoutSelectionGate,H as configureDefaultFonts,V as createRustMeasureSource,j as getRustTextEngine,M as resolveDefaultFontProvider,G as resolveHeaderFooter};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as LayoutBlock, B as BlockExtent } from '../../types-
|
|
2
|
-
export { A as AnchoredObjectPositionInput, d as BlockId, e as BorderStyle, C as CellBorderSpec, f as CellBorders, g as ChartBlock, h as ChartExtent, i as ChartFragment, j as ColumnBreakBlock, k as ColumnBreakExtent, l as ColumnLayout, D as DEFAULT_TEXTBOX_MARGINS, m as DEFAULT_TEXTBOX_WIDTH, n as DocumentPosition, o as FieldRun, p as FloatingTablePosition, F as FootnoteContent, q as FootnoteRenderItem, r as Fragment, s as FragmentBase, H as HeaderFooterContent, t as HeaderFooterContentHeights, u as HeaderFooterLayout, v as HitTestResult, w as HyperlinkInfo, I as ImageBlock, x as ImageExtent, y as ImageFragment, z as ImageRun, E as ImageRunPosition, G as InlineSdtWidget, a as Layout, b as LayoutOptions, J as LineBreakRun, K as ListNumPr, N as NoteAreaContract, M as NoteLayoutItem, O as NoteSettingsContract, P as Page, Q as PageBorderContract, S as PageBreakBlock, T as PageBreakExtent, U as PageGeometry, V as PageHeaderFooterRefs, W as PageMargins, X as PageNumberingContract, Y as ParagraphAttrs, Z as ParagraphBlock, _ as ParagraphBorders, $ as ParagraphExtent, a0 as ParagraphFragment, a1 as ParagraphIndent, a2 as ParagraphSpacing, R as ResolvedLine, c as ResolvedSegment, a3 as Run, a4 as RunFontSlots, a5 as RunFormatting, a6 as RunLanguageSlots, a7 as SdtGroup, a8 as SectionBreakBlock, a9 as SectionBreakExtent, aa as ShapeBlock, ab as ShapeBlockFill, ac as ShapeBlockStroke, ad as ShapeBlockTransform, ae as ShapeExtent, af as ShapeFragment, ag as TabAlignment, ah as TabRun, ai as TabStop, aj as TableBlock, ak as TableCell, al as TableCellExtent, am as TableExtent, an as TableFragment, ao as TableRow, ap as TableRowExtent, aq as TextBoxBlock, ar as TextBoxExtent, as as TextBoxFragment, at as TextRun, au as TypesetBidiSlice, av as TypesetClusterAdvance, aw as TypesetRow, ax as TypesetRowSegment, ay as TypesetRunAdvance, az as WrapTextDirection, aA as assertExhaustiveLayoutBlock, aB as isTextWrappingFloatingImageRun, aC as pageGeometryFromPage, aD as resolveAnchoredObjectVerticalTop } from '../../types-
|
|
3
|
-
import '../../content-
|
|
4
|
-
import '../../formatting-
|
|
1
|
+
import { L as LayoutBlock, B as BlockExtent } from '../../types-CXLxVF1t.mjs';
|
|
2
|
+
export { A as AnchoredObjectPositionInput, d as BlockId, e as BorderStyle, C as CellBorderSpec, f as CellBorders, g as ChartBlock, h as ChartExtent, i as ChartFragment, j as ColumnBreakBlock, k as ColumnBreakExtent, l as ColumnLayout, D as DEFAULT_TEXTBOX_MARGINS, m as DEFAULT_TEXTBOX_WIDTH, n as DocumentPosition, o as FieldRun, p as FloatingTablePosition, F as FootnoteContent, q as FootnoteRenderItem, r as Fragment, s as FragmentBase, H as HeaderFooterContent, t as HeaderFooterContentHeights, u as HeaderFooterLayout, v as HitTestResult, w as HyperlinkInfo, I as ImageBlock, x as ImageExtent, y as ImageFragment, z as ImageRun, E as ImageRunPosition, G as InlineSdtWidget, a as Layout, b as LayoutOptions, J as LineBreakRun, K as ListNumPr, N as NoteAreaContract, M as NoteLayoutItem, O as NoteSettingsContract, P as Page, Q as PageBorderContract, S as PageBreakBlock, T as PageBreakExtent, U as PageGeometry, V as PageHeaderFooterRefs, W as PageMargins, X as PageNumberingContract, Y as ParagraphAttrs, Z as ParagraphBlock, _ as ParagraphBorders, $ as ParagraphExtent, a0 as ParagraphFragment, a1 as ParagraphIndent, a2 as ParagraphSpacing, R as ResolvedLine, c as ResolvedSegment, a3 as Run, a4 as RunFontSlots, a5 as RunFormatting, a6 as RunLanguageSlots, a7 as SdtGroup, a8 as SectionBreakBlock, a9 as SectionBreakExtent, aa as ShapeBlock, ab as ShapeBlockFill, ac as ShapeBlockStroke, ad as ShapeBlockTransform, ae as ShapeExtent, af as ShapeFragment, ag as TabAlignment, ah as TabRun, ai as TabStop, aj as TableBlock, ak as TableCell, al as TableCellExtent, am as TableExtent, an as TableFragment, ao as TableRow, ap as TableRowExtent, aq as TextBoxBlock, ar as TextBoxExtent, as as TextBoxFragment, at as TextRun, au as TypesetBidiSlice, av as TypesetClusterAdvance, aw as TypesetRow, ax as TypesetRowSegment, ay as TypesetRunAdvance, az as WrapTextDirection, aA as assertExhaustiveLayoutBlock, aB as isTextWrappingFloatingImageRun, aC as pageGeometryFromPage, aD as resolveAnchoredObjectVerticalTop } from '../../types-CXLxVF1t.mjs';
|
|
3
|
+
import '../../content-DrqzbIr7.mjs';
|
|
4
|
+
import '../../formatting-BqrFPeev.mjs';
|
|
5
5
|
import '../../docx/wrapTypes.mjs';
|
|
6
6
|
|
|
7
7
|
interface MeasuredBlock {
|