@betteroffice/docx 0.4.0 → 0.4.1
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-2HLVVQIL.mjs +1 -0
- package/dist/chunk-3OWET2KZ.mjs +1 -0
- package/dist/{chunk-24Z6ZVFZ.mjs → chunk-4GEXNR7A.mjs} +1 -1
- package/dist/chunk-4QHAMEAS.mjs +1 -0
- package/dist/chunk-7DDF4RHB.mjs +16 -0
- package/dist/chunk-C5BX34CG.mjs +2 -0
- package/dist/chunk-DKWD4P4J.mjs +1 -0
- package/dist/chunk-EIPVFGIC.mjs +1 -0
- package/dist/{chunk-NMDQHUQB.mjs → chunk-FMOSOX5V.mjs} +1 -1
- package/dist/collaboration/index.d.mts +4 -3
- package/dist/compareDocx-QX2YF3EF.mjs +1 -0
- package/dist/core.d.mts +3 -3
- package/dist/core.mjs +1 -1
- package/dist/{displayListQueries-H5YnU_hX.d.mts → displayListQueries-DnHmHUPY.d.mts} +1 -1
- package/dist/docx/index.d.mts +2 -2
- package/dist/docx/index.mjs +1 -1
- package/dist/editor/index.d.mts +5 -4
- 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-CHy6_Yuo.d.mts → index-yOtBET85.d.mts} +301 -4
- package/dist/layout/index.mjs +1 -1
- package/dist/layout/pagination/index.d.mts +2 -2
- package/dist/layout/render/index.d.mts +29 -8
- package/dist/layout/render/index.mjs +1 -1
- package/dist/{pagedExport---0Dlmzo.d.mts → pagedExport-BmSlEhoP.d.mts} +1 -1
- package/dist/plugin-api/RenderedDomContext.d.mts +3 -3
- package/dist/{rustDisplayList-LcRZHCSL.d.mts → rustDisplayList-DcaA5iok.d.mts} +1 -1
- package/dist/{types-D6Pra38E.d.mts → types-Buyw6dFd.d.mts} +20 -0
- package/dist/utils/index.mjs +1 -1
- package/dist/{wasm-NF6B3AH7.mjs → wasm-6WSIEYWC.mjs} +1 -1
- package/dist/{wasm-K6DRABAA.mjs → wasm-IBCLSJQU.mjs} +1 -1
- package/dist/wasm-edit.d.mts +14 -0
- package/dist/wasm-edit.mjs +1 -1
- package/dist/wasm-layout.mjs +1 -1
- package/dist/yrs/index.d.mts +3 -2
- package/dist/yrs/index.mjs +1 -1
- package/dist/yrs/residentEngineWorker.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-F2VBW6RB.mjs +0 -1
- package/dist/chunk-L2ML3DDI.mjs +0 -1
- package/dist/chunk-LIGZ75FP.mjs +0 -1
- package/dist/chunk-ND3FBCB3.mjs +0 -16
- package/dist/chunk-OK5UFGX3.mjs +0 -1
- package/dist/chunk-RZQ3OXZY.mjs +0 -2
- package/dist/compareDocx-IHFPGIGV.mjs +0 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { C as ColorValue } from './formatting-gqLFeJ9X.mjs';
|
|
2
2
|
import { Document, CompatibilityFlags } from './types/document.mjs';
|
|
3
|
-
import { a0 as DocxEditSuggestion, a1 as DocxEditFailure, a2 as DocxEditFailureCode, a3 as
|
|
3
|
+
import { a0 as DocxEditSuggestion, a1 as DocxEditFailure, a2 as DocxEditFailureCode, a3 as DocxTextRange, a4 as DocxReadParagraphsRequest, a5 as DocxReadParagraphsResult, a6 as DocxFindTextRequest, a7 as DocxFindTextResult, a8 as DocxEditRequest, a9 as DocxValidationResult, aa as DocxEditResult, ab as DocxTextTarget, ac as DocxEditRefusal, a as DocxExportOptions, H as DocxExportResult, c as DocxStructuredContent, b as DocxMarkdownContent, d as DocxPageExportOptions, f as DocxPagedStructuredContent, i as DocxLayoutMap, g as DocxSnapshotLayoutMap, D as DocxExportFailure, V as DocxParagraphHeading, m as DocxContentControlsOptions, w as DocxContentControlsResult, l as DocxContentControlQuery } from './pagedExport-BmSlEhoP.mjs';
|
|
4
4
|
import { R as RetainedFrame } from './frameDelta-ByU7HBuB.mjs';
|
|
5
5
|
import { a as WasmModuleMemory } from './loadWasmAsset-Cr95TImt.mjs';
|
|
6
6
|
import { R as RepackOptions } from './rezip-Bxiq4Z_R.mjs';
|
|
7
|
+
import { e as Comment } from './content-BzoC6bSz.mjs';
|
|
8
|
+
import { PointPosition } from './plugin-api/index.mjs';
|
|
7
9
|
|
|
8
10
|
type CollaborationUpdateOrigin = 'local' | 'remote';
|
|
9
11
|
interface CollaborationReplica {
|
|
@@ -292,6 +294,18 @@ interface DocxProposalSnapshot {
|
|
|
292
294
|
previewVersion: number;
|
|
293
295
|
proposals: readonly DocxProposalRecord[];
|
|
294
296
|
}
|
|
297
|
+
/** @internal */
|
|
298
|
+
interface DocxProposalRegistryState {
|
|
299
|
+
previewVersion: number;
|
|
300
|
+
entries: {
|
|
301
|
+
record: DocxProposalRecord;
|
|
302
|
+
key: string;
|
|
303
|
+
suggest: {
|
|
304
|
+
author: string;
|
|
305
|
+
date: string;
|
|
306
|
+
};
|
|
307
|
+
}[];
|
|
308
|
+
}
|
|
295
309
|
type DocxProposalFailure = Omit<DocxEditFailure, 'code'> & {
|
|
296
310
|
code: DocxEditFailureCode | 'stale-preview' | 'unknown-proposal' | 'proposal-id-conflict';
|
|
297
311
|
proposalId?: string;
|
|
@@ -367,6 +381,142 @@ declare function residentCaretDeviceRect(rect: Pick<YrsResidentCaretRect, 'x' |
|
|
|
367
381
|
};
|
|
368
382
|
declare function residentCaretSnapshotForFrame(snapshot: YrsResidentCaretSnapshot, frame: RetainedFrame): YrsResidentCaretSnapshot | null;
|
|
369
383
|
|
|
384
|
+
/** @internal */
|
|
385
|
+
interface AnchorResolutionFailure {
|
|
386
|
+
ok: false;
|
|
387
|
+
failure: {
|
|
388
|
+
code: 'stale-version' | 'missing-target' | 'ambiguous-target' | 'layout-unavailable' | 'unsupported' | 'unknown-proposal';
|
|
389
|
+
message: string;
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/** @internal */
|
|
393
|
+
type AnchorReader = Pick<YrsSession, 'resolveParagraphAnchor' | 'hasStory' | 'paragraphSpans' | 'storySegments' | 'findText' | 'listRevisions'>;
|
|
394
|
+
/** @internal */
|
|
395
|
+
type ProposalGeometryReader = AnchorReader & Pick<YrsSession, 'storyIds' | 'paragraphs' | 'paragraphIdCount' | 'locateParagraph' | 'version'>;
|
|
396
|
+
/** @internal */
|
|
397
|
+
type AnchorGeometryTarget = {
|
|
398
|
+
kind: 'proposal';
|
|
399
|
+
id: string;
|
|
400
|
+
} | {
|
|
401
|
+
kind: 'revision';
|
|
402
|
+
revisionId: string;
|
|
403
|
+
} | {
|
|
404
|
+
kind: 'paragraph';
|
|
405
|
+
paragraph: DocxParagraphAnchor;
|
|
406
|
+
} | {
|
|
407
|
+
kind: 'search';
|
|
408
|
+
paragraph: DocxParagraphAnchor;
|
|
409
|
+
text: string;
|
|
410
|
+
occurrence?: DocxOccurrence;
|
|
411
|
+
} | {
|
|
412
|
+
kind: 'range';
|
|
413
|
+
version: string;
|
|
414
|
+
range: DocxTextRange;
|
|
415
|
+
};
|
|
416
|
+
/** @internal */
|
|
417
|
+
interface RawAnchorRange {
|
|
418
|
+
start: YrsLoc;
|
|
419
|
+
end: YrsLoc;
|
|
420
|
+
}
|
|
421
|
+
type AnchorResolution = {
|
|
422
|
+
ok: true;
|
|
423
|
+
ranges: RawAnchorRange[];
|
|
424
|
+
paragraph: YrsLoc;
|
|
425
|
+
} | AnchorResolutionFailure;
|
|
426
|
+
/** @internal */
|
|
427
|
+
declare function anchorFailure(code: AnchorResolutionFailure['failure']['code'], message: string): AnchorResolutionFailure;
|
|
428
|
+
/** @internal */
|
|
429
|
+
declare function isBodyStory(story: string): boolean;
|
|
430
|
+
/** @internal */
|
|
431
|
+
declare function textRangeToRaw(segments: readonly YrsStorySegment[], range: DocxTextRange): {
|
|
432
|
+
ok: true;
|
|
433
|
+
range: RawAnchorRange;
|
|
434
|
+
} | AnchorResolutionFailure;
|
|
435
|
+
/** @internal */
|
|
436
|
+
declare function hiddenRanges(session: AnchorReader, version: string, snapshot: DocxProposalSnapshot | null): RawAnchorRange[];
|
|
437
|
+
/** @internal */
|
|
438
|
+
declare function resolveAnchorTarget(session: AnchorReader, target: AnchorGeometryTarget, version: string, snapshot?: DocxProposalSnapshot | null): AnchorResolution;
|
|
439
|
+
/** @internal */
|
|
440
|
+
interface ProposalDisplayTarget {
|
|
441
|
+
ranges: {
|
|
442
|
+
from: number;
|
|
443
|
+
to: number;
|
|
444
|
+
}[];
|
|
445
|
+
paragraph: number | null;
|
|
446
|
+
}
|
|
447
|
+
/** @internal */
|
|
448
|
+
type ProposalGeometryTarget = ({
|
|
449
|
+
ok: true;
|
|
450
|
+
} & ProposalDisplayTarget) | AnchorResolutionFailure;
|
|
451
|
+
/** @internal */
|
|
452
|
+
interface ProposalGeometryMirror {
|
|
453
|
+
version: string;
|
|
454
|
+
previewVersion: number;
|
|
455
|
+
proposals: string;
|
|
456
|
+
targets: Record<string, ProposalGeometryTarget>;
|
|
457
|
+
hidden: {
|
|
458
|
+
from: number;
|
|
459
|
+
to: number;
|
|
460
|
+
}[];
|
|
461
|
+
}
|
|
462
|
+
/** @internal */
|
|
463
|
+
declare function proposalSetIdentity(snapshot: DocxProposalSnapshot): string;
|
|
464
|
+
/** @internal */
|
|
465
|
+
declare function computeProposalGeometryMirror(reader: ProposalGeometryReader, snapshot: DocxProposalSnapshot): ProposalGeometryMirror;
|
|
466
|
+
/** @internal */
|
|
467
|
+
declare function resolveNavigationTarget(reader: ProposalGeometryReader, story: string, paraId: string): {
|
|
468
|
+
loc: YrsLoc;
|
|
469
|
+
position: number;
|
|
470
|
+
} | 'missing-target' | 'ambiguous-target' | 'unsupported';
|
|
471
|
+
|
|
472
|
+
/** @internal */
|
|
473
|
+
type ResidentProposalOperation = {
|
|
474
|
+
kind: 'propose';
|
|
475
|
+
request: DocxProposalRequest;
|
|
476
|
+
} | {
|
|
477
|
+
kind: 'setStates';
|
|
478
|
+
request: DocxProposalStateRequest;
|
|
479
|
+
} | {
|
|
480
|
+
kind: 'withdraw';
|
|
481
|
+
request: DocxProposalWithdrawRequest;
|
|
482
|
+
} | {
|
|
483
|
+
kind: 'snapshot';
|
|
484
|
+
};
|
|
485
|
+
/** @internal */
|
|
486
|
+
interface ResidentProposalResponse {
|
|
487
|
+
result?: DocxProposalResult;
|
|
488
|
+
mirror: {
|
|
489
|
+
version: string;
|
|
490
|
+
proposals: DocxProposalRegistryState;
|
|
491
|
+
};
|
|
492
|
+
changedStories: string[];
|
|
493
|
+
updates: ArrayBuffer[];
|
|
494
|
+
stateVector: ArrayBuffer;
|
|
495
|
+
geometry: ProposalGeometryMirror;
|
|
496
|
+
}
|
|
497
|
+
/** @internal */
|
|
498
|
+
type ResidentDocumentRead = {
|
|
499
|
+
kind: 'paragraphIdentities';
|
|
500
|
+
} | {
|
|
501
|
+
kind: 'resolveParagraphAnchors';
|
|
502
|
+
anchors: DocxParagraphAnchor[];
|
|
503
|
+
} | {
|
|
504
|
+
kind: 'readParagraphs';
|
|
505
|
+
request: DocxReadParagraphsRequest;
|
|
506
|
+
} | {
|
|
507
|
+
kind: 'navigationTarget';
|
|
508
|
+
story: string;
|
|
509
|
+
paraId: string;
|
|
510
|
+
};
|
|
511
|
+
/** @internal */
|
|
512
|
+
interface ResidentDocumentReadValues {
|
|
513
|
+
paragraphIdentities: DocxParagraphIdentitySnapshot;
|
|
514
|
+
resolveParagraphAnchors: {
|
|
515
|
+
results: DocxParagraphAnchorResult[];
|
|
516
|
+
};
|
|
517
|
+
readParagraphs: DocxReadParagraphsResult;
|
|
518
|
+
navigationTarget: ReturnType<typeof resolveNavigationTarget>;
|
|
519
|
+
}
|
|
370
520
|
type ResidentEngineWorkerRequest = {
|
|
371
521
|
id: number;
|
|
372
522
|
type: 'warm';
|
|
@@ -411,6 +561,17 @@ type ResidentEngineWorkerRequest = {
|
|
|
411
561
|
} | {
|
|
412
562
|
id: number;
|
|
413
563
|
type: 'encodeState';
|
|
564
|
+
} | {
|
|
565
|
+
id: number;
|
|
566
|
+
type: 'revisionCount';
|
|
567
|
+
} | {
|
|
568
|
+
id: number;
|
|
569
|
+
type: 'proposal';
|
|
570
|
+
operation: ResidentProposalOperation;
|
|
571
|
+
} | {
|
|
572
|
+
id: number;
|
|
573
|
+
type: 'documentRead';
|
|
574
|
+
read: ResidentDocumentRead;
|
|
414
575
|
} | {
|
|
415
576
|
id: number;
|
|
416
577
|
type: 'sync';
|
|
@@ -524,6 +685,18 @@ type ResidentEngineWorkerResponse = ({
|
|
|
524
685
|
requirementsJson?: string;
|
|
525
686
|
/** An `encodeState` reply: the document state as one yrs v1 update. */
|
|
526
687
|
state?: ArrayBuffer;
|
|
688
|
+
revisionCount?: number;
|
|
689
|
+
/** @internal */
|
|
690
|
+
proposals?: DocxProposalRegistryState;
|
|
691
|
+
/** @internal */
|
|
692
|
+
version?: string;
|
|
693
|
+
/** @internal */
|
|
694
|
+
proposal?: ResidentProposalResponse;
|
|
695
|
+
/** @internal */
|
|
696
|
+
read?: {
|
|
697
|
+
version: string;
|
|
698
|
+
value: unknown;
|
|
699
|
+
};
|
|
527
700
|
} | {
|
|
528
701
|
id: number;
|
|
529
702
|
ok: false;
|
|
@@ -538,6 +711,11 @@ type ResidentEngineWorkerResponse = ({
|
|
|
538
711
|
memory?: WasmModuleMemory[];
|
|
539
712
|
};
|
|
540
713
|
|
|
714
|
+
/** @internal */
|
|
715
|
+
interface ResidentProposalReply extends Omit<ResidentProposalResponse, 'updates' | 'stateVector'> {
|
|
716
|
+
updates: Uint8Array[];
|
|
717
|
+
stateVector: Uint8Array;
|
|
718
|
+
}
|
|
541
719
|
interface ResidentEngineWorkerFrame {
|
|
542
720
|
frame: Uint8Array;
|
|
543
721
|
updates: Uint8Array[];
|
|
@@ -661,8 +839,24 @@ declare class ResidentEngineWorkerClient {
|
|
|
661
839
|
}): Promise<ResidentEngineWorkerOpened>;
|
|
662
840
|
/** The font requirements of a region layout request, read from the opened document. */
|
|
663
841
|
fontRequirements(layoutInput: string): Promise<string>;
|
|
842
|
+
/** @internal */
|
|
843
|
+
proposal(operation: ResidentProposalOperation): Promise<ResidentProposalReply>;
|
|
844
|
+
/** @internal */
|
|
845
|
+
documentRead<K extends ResidentDocumentRead['kind']>(read: ResidentDocumentRead & {
|
|
846
|
+
kind: K;
|
|
847
|
+
}): Promise<{
|
|
848
|
+
version: string;
|
|
849
|
+
value: ResidentDocumentReadValues[K];
|
|
850
|
+
}>;
|
|
851
|
+
/** @internal */
|
|
852
|
+
handOver(): Promise<{
|
|
853
|
+
state: Uint8Array;
|
|
854
|
+
version: string;
|
|
855
|
+
proposals: DocxProposalRegistryState;
|
|
856
|
+
}>;
|
|
664
857
|
/** The worker's whole document state as one yrs v1 update. */
|
|
665
858
|
encodeState(): Promise<Uint8Array>;
|
|
859
|
+
revisionCount(): Promise<number>;
|
|
666
860
|
warm(): Promise<void>;
|
|
667
861
|
bootstrap(snapshot: YrsResidentWorkerSnapshot, extras: string, options?: ResidentEngineWorkerLayoutOptions & ResidentEngineWorkerSnapshotOptions): Promise<ResidentEngineWorkerFrame>;
|
|
668
862
|
sync(snapshot: YrsResidentWorkerSnapshot, extras: string, expectedFrameEpoch: number, paintCaret?: boolean, options?: ResidentEngineWorkerLayoutOptions & ResidentEngineWorkerSnapshotOptions): Promise<ResidentEngineWorkerFrame>;
|
|
@@ -799,7 +993,7 @@ declare function captureSessionSave(session: YrsSession): DocxSessionSave;
|
|
|
799
993
|
* it selects none unless `originalBuffer` is the session's source package.
|
|
800
994
|
* @internal
|
|
801
995
|
*/
|
|
802
|
-
declare function writeSessionSave(session: YrsSession, document: Document, capture: DocxSessionSave, originalBuffer: ArrayBuffer, options?: RepackOptions, patches?: (part: string) => boolean): Promise<DocxSavedDocument>;
|
|
996
|
+
declare function writeSessionSave(session: YrsSession, document: Document, capture: DocxSessionSave, originalBuffer: ArrayBuffer, options?: RepackOptions, patches?: (part: string) => boolean, skipMutations?: boolean): Promise<DocxSavedDocument>;
|
|
803
997
|
/**
|
|
804
998
|
* Saves a session opened from DOCX bytes and reports each saved paragraph's
|
|
805
999
|
* persisted anchor, read from the same projection the bytes are written
|
|
@@ -815,6 +1009,91 @@ declare function writeSessionSave(session: YrsSession, document: Document, captu
|
|
|
815
1009
|
*/
|
|
816
1010
|
declare function saveYrsDocx(session: YrsSession, options?: RepackOptions): Promise<DocxSavedDocument>;
|
|
817
1011
|
|
|
1012
|
+
/** @internal */
|
|
1013
|
+
declare function editorSaveKeys(document: Document, comments?: readonly Comment[]): {
|
|
1014
|
+
metadata: string;
|
|
1015
|
+
comments: string;
|
|
1016
|
+
commentIds: number[];
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
/** Engine operations the package runs on sessions it creates itself; not public API. */
|
|
1020
|
+
|
|
1021
|
+
/** Returns the session's opened source package when available. @internal */
|
|
1022
|
+
declare function sessionSourcePackage(session: YrsSession): {
|
|
1023
|
+
buffer: ArrayBuffer;
|
|
1024
|
+
keys: ReturnType<typeof editorSaveKeys>;
|
|
1025
|
+
} | null;
|
|
1026
|
+
|
|
1027
|
+
type PositionReader = Pick<YrsSession, 'hasStory' | 'storySegments'>;
|
|
1028
|
+
/** @internal */
|
|
1029
|
+
interface YrsProjectedNode {
|
|
1030
|
+
kind: string;
|
|
1031
|
+
start: number;
|
|
1032
|
+
nodeSize: number;
|
|
1033
|
+
attrs: Record<string, unknown>;
|
|
1034
|
+
story: string;
|
|
1035
|
+
}
|
|
1036
|
+
/** @internal */
|
|
1037
|
+
interface YrsProjectedTable extends YrsProjectedNode {
|
|
1038
|
+
kind: 'table';
|
|
1039
|
+
tableIndex: number;
|
|
1040
|
+
widthsTwips: number[];
|
|
1041
|
+
rowCount: number;
|
|
1042
|
+
cells: YrsProjectedCell[];
|
|
1043
|
+
}
|
|
1044
|
+
/** @internal */
|
|
1045
|
+
interface YrsProjectedCell {
|
|
1046
|
+
row: number;
|
|
1047
|
+
column: number;
|
|
1048
|
+
rowspan: number;
|
|
1049
|
+
colspan: number;
|
|
1050
|
+
story: string;
|
|
1051
|
+
start: number;
|
|
1052
|
+
contentStart: number;
|
|
1053
|
+
nodeSize: number;
|
|
1054
|
+
attrs: Record<string, unknown>;
|
|
1055
|
+
}
|
|
1056
|
+
/** @internal */
|
|
1057
|
+
interface YrsPointerProjectionTarget {
|
|
1058
|
+
story: string;
|
|
1059
|
+
displayPosition: number;
|
|
1060
|
+
cell?: YrsCellLoc;
|
|
1061
|
+
}
|
|
1062
|
+
/** @internal */
|
|
1063
|
+
interface YrsStorySegmentSource {
|
|
1064
|
+
segments(story: string): YrsStorySegment[];
|
|
1065
|
+
}
|
|
1066
|
+
/** @internal */
|
|
1067
|
+
declare function createYrsPositionProjection(session: PositionReader, rootStory: string, source?: YrsStorySegmentSource): YrsPositionProjection | null;
|
|
1068
|
+
/** @internal */
|
|
1069
|
+
declare function projectYrsDisplayPosition(position: number | PointPosition, getProjection: (rootStory: string) => YrsPositionProjection | null): YrsPointerProjectionTarget | null;
|
|
1070
|
+
/** @internal */
|
|
1071
|
+
declare class YrsPositionProjection {
|
|
1072
|
+
readonly rootStory: string;
|
|
1073
|
+
private readonly stories;
|
|
1074
|
+
private readonly nodes;
|
|
1075
|
+
private readonly tables;
|
|
1076
|
+
private readonly source;
|
|
1077
|
+
private readonly paragraphsById;
|
|
1078
|
+
constructor(session: Pick<YrsSession, 'storySegments'>, rootStory: string, source?: YrsStorySegmentSource);
|
|
1079
|
+
get size(): number;
|
|
1080
|
+
nodeAt(position: number): YrsProjectedNode | null;
|
|
1081
|
+
tableAtPosition(position: number): YrsProjectedTable | null;
|
|
1082
|
+
tableAtStart(start: number): YrsProjectedTable | null;
|
|
1083
|
+
tableStartForLoc(at: YrsCellLoc): number | null;
|
|
1084
|
+
cellPosition(tableStart: number, row: number, column: number): number | null;
|
|
1085
|
+
targetAt(position: number): YrsPointerProjectionTarget;
|
|
1086
|
+
positionForLoc(loc: YrsLoc): number | null;
|
|
1087
|
+
/** First paragraph for each paraId. */
|
|
1088
|
+
private paragraphIndex;
|
|
1089
|
+
bookmarkPosition(name: string): number | null;
|
|
1090
|
+
private buildStory;
|
|
1091
|
+
private inputPositionAt;
|
|
1092
|
+
private buildTable;
|
|
1093
|
+
}
|
|
1094
|
+
/** @internal */
|
|
1095
|
+
declare function yrsLocToProjectedDisplayPosition(reader: Pick<YrsSession, 'hasStory' | 'paragraphSpans'>, projectionFor: (rootStory: string) => YrsPositionProjection | null, loc: YrsLoc, activeRootStory?: string, inputMap?: (story: string) => YrsInputPositionMap | null): number | null;
|
|
1096
|
+
|
|
818
1097
|
interface YrsDocxHost {
|
|
819
1098
|
document: Document;
|
|
820
1099
|
referencedFonts: string[];
|
|
@@ -1298,6 +1577,8 @@ type YrsResidentFontRegistration = Uint8Array | {
|
|
|
1298
1577
|
family: string;
|
|
1299
1578
|
};
|
|
1300
1579
|
interface YrsResidentWorkerSnapshot {
|
|
1580
|
+
/** @internal */
|
|
1581
|
+
workerAuthoritative?: true;
|
|
1301
1582
|
clientId: number;
|
|
1302
1583
|
/** Full document state, or a state-vector diff when the caller supplied
|
|
1303
1584
|
* the worker's known vector — both apply through the same merge path. */
|
|
@@ -1500,6 +1781,11 @@ interface YrsMediaSource {
|
|
|
1500
1781
|
bytes: Uint8Array;
|
|
1501
1782
|
mimeType: string;
|
|
1502
1783
|
}
|
|
1784
|
+
/** @internal */
|
|
1785
|
+
interface YrsWorkerDocumentMirror {
|
|
1786
|
+
version: string;
|
|
1787
|
+
proposals: DocxProposalRegistryState;
|
|
1788
|
+
}
|
|
1503
1789
|
interface YrsSession extends CollaborationReplica {
|
|
1504
1790
|
/** The yrs client id this replica writes with. */
|
|
1505
1791
|
readonly clientId: number;
|
|
@@ -1668,6 +1954,8 @@ interface YrsSession extends CollaborationReplica {
|
|
|
1668
1954
|
applyUpdate(update: Uint8Array): CollaborationTextInsertion | null;
|
|
1669
1955
|
/** Apply a same-user worker update under the local undo origin. @internal */
|
|
1670
1956
|
applyLocalUpdate(update: Uint8Array): void;
|
|
1957
|
+
/** Adopt another replica's host batch outside undo history. @internal */
|
|
1958
|
+
applyHostUpdate(update: Uint8Array, stories?: readonly string[]): void;
|
|
1671
1959
|
/**
|
|
1672
1960
|
* Subscribes to every committed transaction's v1 update (local AND
|
|
1673
1961
|
* applied-remote). Returns an unsubscribe function.
|
|
@@ -1802,7 +2090,10 @@ interface YrsSession extends CollaborationReplica {
|
|
|
1802
2090
|
* promotes an editor-only paragraph they author into.
|
|
1803
2091
|
*/
|
|
1804
2092
|
applyRawOps(story: string, ops: readonly YrsRawOp[]): void;
|
|
1805
|
-
/**
|
|
2093
|
+
/**
|
|
2094
|
+
* Applies seed raw operations with deterministic item ordering. A
|
|
2095
|
+
* `setComment` for a comment already seeded adds its ranges to it.
|
|
2096
|
+
*/
|
|
1806
2097
|
applySeedRawOps(story: string, ops: readonly YrsRawOp[]): void;
|
|
1807
2098
|
/** Sets one paragraph property (any JSON value). `paraId` is reserved. */
|
|
1808
2099
|
setParagraphAttr(paraId: string, key: string, value: unknown): void;
|
|
@@ -1873,6 +2164,8 @@ interface YrsSession extends CollaborationReplica {
|
|
|
1873
2164
|
tablePayload(story: string, tableIndex: number): Record<string, unknown> | null;
|
|
1874
2165
|
/** A paragraph's story span (start unit, pilcrow index). */
|
|
1875
2166
|
locateParagraph(story: string, paraId: string): YrsParagraphSpan;
|
|
2167
|
+
/** How many paragraphs of `story` carry `paraId`: 0, 1, or 2 for two or more. */
|
|
2168
|
+
paragraphIdCount(story: string, paraId: string): number;
|
|
1876
2169
|
/**
|
|
1877
2170
|
* Session, persisted and source anchors of every paragraph, including the
|
|
1878
2171
|
* source package's paragraphs outside the stories, and the Word paragraph ID
|
|
@@ -1950,6 +2243,10 @@ interface YrsSession extends CollaborationReplica {
|
|
|
1950
2243
|
withdrawProposals(request: DocxProposalWithdrawRequest): DocxProposalResult;
|
|
1951
2244
|
/** The proposals in the order they were made. */
|
|
1952
2245
|
getProposals(): DocxProposalSnapshot;
|
|
2246
|
+
/** @internal */
|
|
2247
|
+
mirrorWorkerDocument(mirror: YrsWorkerDocumentMirror | null): void;
|
|
2248
|
+
/** @internal */
|
|
2249
|
+
workerDocumentMirrored(): boolean;
|
|
1953
2250
|
/** Listens for new proposals, decisions and a forgotten registry. Returns the unsubscribe. */
|
|
1954
2251
|
onProposalChange(listener: (snapshot: DocxProposalSnapshot) => void): () => void;
|
|
1955
2252
|
/**
|
|
@@ -2023,4 +2320,4 @@ declare function decodeDocxHostJson(json: string, source: Uint8Array): YrsDocxHo
|
|
|
2023
2320
|
*/
|
|
2024
2321
|
declare function createYrsSession(options?: CreateYrsSessionOptions): Promise<YrsSession>;
|
|
2025
2322
|
|
|
2026
|
-
export { type
|
|
2323
|
+
export { type DocxSavedDocument as $, type AnchorGeometryTarget as A, type DocxParagraphAnchor as B, type CollaborationReplica as C, type DocxOccurrence as D, type DocxParagraphAnchorResult as E, type DocxParagraphIdAssignment as F, type DocxParagraphIdDiagnostic as G, type DocxParagraphIdOrigin as H, type DocxParagraphIdRefusal as I, type DocxParagraphIdentity as J, type DocxParagraphIdentityReceipt as K, type DocxParagraphIdentitySnapshot as L, type DocxParagraphOrigin as M, type DocxParagraphRef as N, type DocxParagraphSavePlan as O, type DocxPersistedParagraphAnchor as P, type DocxProposalFailure as Q, type DocxProposalInput as R, type DocxProposalRecord as S, type DocxProposalRegistryState as T, type DocxProposalRequest as U, type DocxProposalResult as V, type DocxProposalSnapshot as W, type DocxProposalState as X, type YrsSession as Y, type DocxProposalStateRequest as Z, type DocxProposalWithdrawRequest as _, type YrsRenderEnv as a, type YrsSelectionContext as a$, type DocxSavedParagraph as a0, type DocxSessionParagraphAnchor as a1, type DocxSessionSave as a2, type DocxSourceParagraphAnchor as a3, type DocxSourceStory as a4, type ProposalDisplayTarget as a5, type ProposalGeometryMirror as a6, type ProposalGeometryReader as a7, type ProposalGeometryTarget as a8, type RawAnchorRange as a9, type YrsNumberingProperties as aA, type YrsOpeningOptions as aB, type YrsParaOffset as aC, type YrsParagraph as aD, type YrsParagraphAttrs as aE, type YrsParagraphLength as aF, type YrsParagraphReceipt as aG, type YrsParagraphSeed as aH, type YrsParagraphSpan as aI, type YrsParagraphTabStop as aJ, type YrsPointerProjectionTarget as aK, YrsPositionProjection as aL, type YrsProjectedCell as aM, type YrsProjectedNode as aN, type YrsProjectedTable as aO, type YrsRawOp as aP, type YrsRegionLayoutProgress as aQ, type YrsReplaceReceipt as aR, type YrsResidentCaretRect as aS, type YrsResidentCaretSnapshot as aT, type YrsResidentFontRegistration as aU, type YrsResidentWorkerSnapshot as aV, type YrsResidentWorkerSyncOptions as aW, type YrsResolveReceipt as aX, type YrsResolvedCommentAnchor as aY, type YrsRevisionReceipt as aZ, type YrsRunMark as a_, type ResidentCaretPaintStyle as aa, type ResidentEngineOffscreenPage as ab, type ResidentEngineWorkerApplyResult as ac, ResidentEngineWorkerClient as ad, type ResidentEngineWorkerFrame as ae, type ResidentEngineWorkerOpened as af, type ResidentProposalReply as ag, ResidentWorkerFailureError as ah, ResidentWorkerOutOfMemoryError as ai, type YrsAuthor as aj, type YrsCellBorder as ak, type YrsCellBorders as al, type YrsCellLoc as am, type YrsChangeTarget as an, type YrsCommentInfo as ao, type YrsCommentReceipt as ap, type YrsContentControlValue as aq, type YrsDocxHost as ar, type YrsEngineApplyProfile as as, type YrsHyperlinkAttrs as at, type YrsImageGeometry as au, type YrsInlineFormatDelta as av, type YrsInputParagraphSeed as aw, type YrsInputParagraphSpan as ax, type YrsInputPositionMap as ay, type YrsMediaSource as az, type CollaborationTransport as b, type YrsSelectionText as b0, type YrsSplitReceipt as b1, type YrsStickyPosition as b2, type YrsStoryRange as b3, type YrsStorySeed as b4, type YrsStorySegmentSource as b5, type YrsTableLoc as b6, type YrsTableRange as b7, type YrsTableReceipt as b8, type YrsTargetEditResult as b9, proposalRevisionPreview as bA, proposalSetIdentity as bB, residentCaretDeviceRect as bC, residentCaretSnapshotForFrame as bD, resolveAnchorTarget as bE, resolveNavigationTarget as bF, retainPreloadedResidentEngineWorker as bG, sameYrsSelection as bH, saveYrsDocx as bI, sessionSourcePackage as bJ, takePreloadedResidentEngineWorker as bK, textRangeToRaw as bL, writeSessionSave as bM, yrsLocToDisplayPosition as bN, yrsLocToProjectedDisplayPosition as bO, yrsToDocument as bP, type YrsTextColor as ba, type YrsTextMatch as bb, type YrsTextSearchOptions as bc, type YrsTriState as bd, type YrsUndoCaptureMode as be, type YrsWatermark as bf, type YrsWorkerDocumentMirror as bg, anchorFailure as bh, canUseResidentEngineWorker as bi, captureSessionSave as bj, compareYrsLocs as bk, computeProposalGeometryMirror as bl, createYrsInputPositionMap as bm, createYrsPositionProjection as bn, createYrsSession as bo, decodeDocxHostJson as bp, displayPositionToYrsLoc as bq, documentToYrs as br, editorSaveKeys as bs, hiddenRanges as bt, isBodyStory as bu, preloadDocxEngine as bv, preloadResidentEngineWorker as bw, prepareDocxBytes as bx, preparedDocxDigest as by, projectYrsDisplayPosition as bz, type CollaborationProviderOptions as c, type CollaborationStatus as d, type CollaborationPeer as e, type CollaborationCursor as f, type CollaborationPeerListener as g, type CollaborationStatusListener as h, type CollaborationErrorListener as i, type YrsSelection as j, type CollaborationAwarenessState as k, CollaborationError as l, type CollaborationErrorCode as m, type CollaborationPresence as n, type CollaborationResolvedUser as o, type CollaborationStatusChange as p, type CollaborationTextInsertion as q, type CollaborationTransportEvent as r, type CollaborationUpdateOrigin as s, type CollaborationUser as t, type YrsLoc as u, type YrsStorySegment as v, type YrsRevisionInfo as w, type AnchorReader as x, type AnchorResolutionFailure as y, type CreateYrsSessionOptions as z };
|
package/dist/layout/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'../chunk-DLXIZBB6.mjs';export{b as configureDefaultFonts,c as resolveDefaultFontProvider}from'../chunk-DLXIZBB6.mjs';import {d,e,g as g$1,c as c$1,f,b as b$1}from'../chunk-TTRUPDAB.mjs';function C(u){return u.trim().toLowerCase()}function B(u,e,t){return `${C(u)}|${e?1:0}|${t?1:0}`}function v(u,e,t,i){t.then(r=>{i(r)&&u.get(e)===t&&u.delete(e);},()=>{u.get(e)===t&&u.delete(e);});}var k=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(i=>{i===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 i=C(t.family),r=this.facesByFamily.get(i);r?r.push(t):this.facesByFamily.set(i,[t]);}this.chains=new Map,this.chainResults=new Map;}getFontIdChain(e,t,i){let r=B(e,t,i),s=this.chains.get(r);if(!s){let n=this.chains,o=this.chainResults,l=this.generation,f=this.resolveChain(e,t,i);f.then(d=>{l===this.generation&&(o.set(r,d),d.retryable&&n.get(r)===f&&n.delete(r));},()=>{n.get(r)===f&&n.delete(r);}),n.set(r,f),s=f;}return s.then(n=>n.ids)}getCachedFontIdChain(e,t,i,r=true){let s=B(e,t,i),n=this.chainResults.get(s);if(r&&n?.retryable){let o=this.chainResults;queueMicrotask(()=>{o.get(s)===n&&o.delete(s);});}return n?.ids}getScriptFallbackIds(e){let t=[...new Set(e)];return Promise.all(t.map(i=>this.resolveScript(i))).then(i=>{let r=[];for(let{id:s}of i)s!==null&&!r.includes(s)&&r.push(s);return r})}getCachedScriptFallbackIds(e,t=true){let i=this.scriptResults,r=[];for(let n of e){let o=i.get(n);if(!o)return;r.push([n,o]);}let s=[];for(let[n,o]of r){let{id:l}=o;l!==null&&!s.includes(l)&&s.push(l),t&&o.retryable&&queueMicrotask(()=>{i.get(n)===o&&i.delete(n);});}return s}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,i){let r=B(e,t,i),s=[],n=false,o=this.pickEmbeddedFace(e,t,i);if(o){let a=await this.registerFace(o);a!==null?s.push(a):n=true;}let l=await this.bundled();l===void 0&&typeof this.bundledSource=="function"&&(n=true);let f;try{f=l?.resolve(e,t,i);}catch(a){n=true,console.warn(`[fontRegistry] bundled face resolver for "${e}" failed; falling back: ${a instanceof Error?a.message:String(a)}`);}if(f){let a=await this.registerBundled(r,f,e);a!==null&&!s.includes(a)&&s.push(a),a===null&&(n=true);}let d;try{d=l?.resolveLastResort?.(e,t,i,"word");}catch(a){n=true,console.warn(`[fontRegistry] last-resort resolver for "${e}" failed; falling back: ${a instanceof Error?a.message:String(a)}`);}if(d){let a=await this.registerLastResort(r,d,e);a!==null&&!s.includes(a)&&s.push(a),a===null&&(n=true);}return s.length===0&&this.warnFallback(e,l!==void 0,f!==void 0||d!==void 0),{ids:s,retryable:n}}warnFallback(e,t,i){if(this.warnedFallback)return;this.warnedFallback=true;let r="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(i?`[fontRegistry] no font bytes for "${e}" \u2014 the font provider resolved but every matching face failed to load. ${r} 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. ${r}`:`[fontRegistry] no font bytes for "${e}" \u2014 no font provider is configured. Install @betteroffice/fonts and pass it with configureDefaultFonts({ fonts }). `+r);}pickEmbeddedFace(e,t,i){let r=this.facesByFamily.get(C(e));if(!r)return;let s=t?"bold":"normal",n=i?"italic":"normal";return r.find(o=>o.weight===s&&o.style===n)??r.find(o=>o.weight==="normal"&&o.style==="normal")}measuredAs(e,t){let i=this.sink.registerSubstituteFont;if(!i)return e;try{return i.call(this.sink,e,t)}catch(r){return console.warn(`[fontRegistry] measurement view of the substitute for "${t}" failed; measuring with the substitute's own metrics: ${r instanceof Error?r.message:String(r)}`),e}}registerBuffer(e){let t=this.bufferIds.get(e);if(!t){let i=this.bufferIds;t=Promise.resolve().then(()=>this.sink.registerFont(new Uint8Array(e))),v(i,e,t,()=>false),i.set(e,t);}return t}registerFace(e){let t=this.faceIds.get(e);if(!t){let i=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}})(),v(i,e,t,r=>r===null),i.set(e,t);}return t}registerBundled(e,t,i){let r=this.bundledIds.get(e);if(!r){let s=this.bundledIds;r=(async()=>{try{let n=await t();return this.measuredAs(await this.registerBuffer(n),i)}catch(n){return console.warn(`[fontRegistry] bundled face for "${i}" failed to load or register; falling back: ${n instanceof Error?n.message:String(n)}`),null}})(),v(s,e,r,n=>n===null),s.set(e,r);}return r}registerLastResort(e,t,i){let r=this.lastResortIds.get(e);if(!r){let s=this.lastResortIds;r=(async()=>{try{let n=await t();return this.measuredAs(await this.registerBuffer(n),i)}catch{return console.warn(`[fontRegistry] last-resort base face for "${i}" failed to load or register; falling back`),null}})(),v(s,e,r,n=>n===null),s.set(e,r);}return r}resolveScript(e){let t=this.scriptIds.get(e);if(!t){let i=this.scriptIds,r=this.scriptResults;t=(async()=>{let s=null,n=false,o=await this.bundled();o===void 0&&typeof this.bundledSource=="function"&&(n=true);let l;try{l=o?.resolveScriptFallback?.(e,!1,!1);}catch(d){n=true,console.warn(`[fontRegistry] script-fallback resolver for "${e}" failed; falling back: ${d instanceof Error?d.message:String(d)}`);}if(l)try{let d=await l();s=await this.registerBuffer(d);}catch(d){n=true,console.warn(`[fontRegistry] script-fallback face for "${e}" failed to load or register; falling back: ${d instanceof Error?d.message:String(d)}`);}let f={id:s,retryable:n};return r.set(e,f),f})(),v(i,e,t,s=>s.retryable),i.set(e,t);}return t}};var T=null;function L(){return T??(T=import('../wasm-K6DRABAA.mjs').then(async u=>(await u.preloadLayoutWasm(),{registerFont:u.registerMeasureFont,registerSubstituteFont:u.registerSubstituteMeasureFont,clearFonts:u.clearMeasureFonts}))),T}function H(u){let e=u.engine,t=new k({registerFont:r=>e.registerFont(r),...e.registerSubstituteFont&&{registerSubstituteFont:(r,s)=>e.registerSubstituteFont(r,s)}},{bundled:u.bundled??c}),i;return {setEmbeddedFaces(r){t.setEmbeddedFaces(r);},setCompat(r){i=r;},async prepareFontRequirements(r){return (await Promise.all(r.flatMap(n=>[(async()=>{try{return t.getCachedFontIdChain(n.family,n.bold,n.italic,!1)!==void 0?!1:(await t.getFontIdChain(n.family,n.bold,n.italic),!0)}catch{return false}})(),...Array.from(new Set(n.scripts??[]),async o=>{try{return t.getCachedScriptFallbackIds([o],!1)!==void 0?!1:(await t.getScriptFallbackIds([o]),!0)}catch{return false}})]))).some(Boolean)},measurementConfigForRequirements(r){let s=r.map(o=>({requirement:o,familyIds:t.getCachedFontIdChain(o.family,o.bold,o.italic,false),scriptIds:t.getCachedScriptFallbackIds(o.scripts??[],false)}));if(s.some(({familyIds:o,scriptIds:l})=>o===void 0||l===void 0))return;let n={};for(let{requirement:o}of s){let l=t.getCachedFontIdChain(o.family,o.bold,o.italic),f=t.getCachedScriptFallbackIds(o.scripts??[]);if(l===void 0||f===void 0)return;let d=Array.from(l);for(let a of f)d.includes(a)||d.push(a);d.length>0&&(n[o.key]=d);}return {fontChains:n,defaults:{fontSize:11,fontFamily:"Calibri"},compat:{noLeading:i?.noLeading??false,doNotExpandShiftReturn:i?.doNotExpandShiftReturn??false},authoritativeShaping:true}},clear(){t.clear();}}}var D=1056;function U(u,e){let t=u?.package.headers,i=u?.package.footers,r=e?.headerReferences?.find(F=>F.type==="default"),s=e?.headerReferences?.find(F=>F.type==="first"),n=e?.footerReferences?.find(F=>F.type==="default"),o=e?.footerReferences?.find(F=>F.type==="first"),l=r?t?.get(r.rId)??null:null,f=n?i?.get(n.rId)??null:null,d=s?t?.get(s.rId)??null:null,a=o?i?.get(o.rId)??null:null;return e?.titlePg||(l??(l=d),f??(f=a)),{header:l,footer:f,firstHeader:d,firstFooter:a}}var g,b,m,y,R,I,A,M=class{constructor(){d(this,I);d(this,g,0);d(this,b,0);d(this,m,false);d(this,y,false);d(this,R,new Set);}setStateSeq(e$1){e(this,g,e$1);}incrementStateSeq(){return ++g$1(this,g)._}getStateSeq(){return c$1(this,g)}getRenderSeq(){return c$1(this,b)}onLayoutStart(){e(this,m,true);}onLayoutComplete(e$1){e(this,b,e$1),e(this,m,false),c$1(this,y)&&this.isSafeToRender()&&(e(this,y,false),f(this,I,A).call(this));}isSafeToRender(){return !c$1(this,m)&&c$1(this,b)>=c$1(this,g)}requestRender(){this.isSafeToRender()?f(this,I,A).call(this):e(this,y,true);}onRender(e){return c$1(this,R).add(e),()=>c$1(this,R).delete(e)}reset(){e(this,g,0),e(this,b,0),e(this,m,false),e(this,y,false);}getDebugInfo(){return {stateSeq:c$1(this,g),renderSeq:c$1(this,b),layoutUpdating:c$1(this,m),hasPendingRender:c$1(this,y),isSafe:this.isSafeToRender()}}};g=new WeakMap,b=new WeakMap,m=new WeakMap,y=new WeakMap,R=new WeakMap,I=new WeakSet,A=function(){for(let e of c$1(this,R))try{e();}catch(t){console.error("LayoutSelectionGate: render callback error",t);}};export{D as DEFAULT_PAGE_HEIGHT_PX,M as LayoutSelectionGate,H as createRustMeasureSource,L as getRustTextEngine,U as resolveHeaderFooter};
|
|
1
|
+
import {c}from'../chunk-DLXIZBB6.mjs';export{b as configureDefaultFonts,c as resolveDefaultFontProvider}from'../chunk-DLXIZBB6.mjs';import {d,e,g as g$1,c as c$1,f,b as b$1}from'../chunk-TTRUPDAB.mjs';function C(u){return u.trim().toLowerCase()}function B(u,e,t){return `${C(u)}|${e?1:0}|${t?1:0}`}function v(u,e,t,i){t.then(r=>{i(r)&&u.get(e)===t&&u.delete(e);},()=>{u.get(e)===t&&u.delete(e);});}var k=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(i=>{i===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 i=C(t.family),r=this.facesByFamily.get(i);r?r.push(t):this.facesByFamily.set(i,[t]);}this.chains=new Map,this.chainResults=new Map;}getFontIdChain(e,t,i){let r=B(e,t,i),s=this.chains.get(r);if(!s){let n=this.chains,o=this.chainResults,l=this.generation,f=this.resolveChain(e,t,i);f.then(d=>{l===this.generation&&(o.set(r,d),d.retryable&&n.get(r)===f&&n.delete(r));},()=>{n.get(r)===f&&n.delete(r);}),n.set(r,f),s=f;}return s.then(n=>n.ids)}getCachedFontIdChain(e,t,i,r=true){let s=B(e,t,i),n=this.chainResults.get(s);if(r&&n?.retryable){let o=this.chainResults;queueMicrotask(()=>{o.get(s)===n&&o.delete(s);});}return n?.ids}getScriptFallbackIds(e){let t=[...new Set(e)];return Promise.all(t.map(i=>this.resolveScript(i))).then(i=>{let r=[];for(let{id:s}of i)s!==null&&!r.includes(s)&&r.push(s);return r})}getCachedScriptFallbackIds(e,t=true){let i=this.scriptResults,r=[];for(let n of e){let o=i.get(n);if(!o)return;r.push([n,o]);}let s=[];for(let[n,o]of r){let{id:l}=o;l!==null&&!s.includes(l)&&s.push(l),t&&o.retryable&&queueMicrotask(()=>{i.get(n)===o&&i.delete(n);});}return s}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,i){let r=B(e,t,i),s=[],n=false,o=this.pickEmbeddedFace(e,t,i);if(o){let a=await this.registerFace(o);a!==null?s.push(a):n=true;}let l=await this.bundled();l===void 0&&typeof this.bundledSource=="function"&&(n=true);let f;try{f=l?.resolve(e,t,i);}catch(a){n=true,console.warn(`[fontRegistry] bundled face resolver for "${e}" failed; falling back: ${a instanceof Error?a.message:String(a)}`);}if(f){let a=await this.registerBundled(r,f,e);a!==null&&!s.includes(a)&&s.push(a),a===null&&(n=true);}let d;try{d=l?.resolveLastResort?.(e,t,i,"word");}catch(a){n=true,console.warn(`[fontRegistry] last-resort resolver for "${e}" failed; falling back: ${a instanceof Error?a.message:String(a)}`);}if(d){let a=await this.registerLastResort(r,d,e);a!==null&&!s.includes(a)&&s.push(a),a===null&&(n=true);}return s.length===0&&this.warnFallback(e,l!==void 0,f!==void 0||d!==void 0),{ids:s,retryable:n}}warnFallback(e,t,i){if(this.warnedFallback)return;this.warnedFallback=true;let r="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(i?`[fontRegistry] no font bytes for "${e}" \u2014 the font provider resolved but every matching face failed to load. ${r} 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. ${r}`:`[fontRegistry] no font bytes for "${e}" \u2014 no font provider is configured. Install @betteroffice/fonts and pass it with configureDefaultFonts({ fonts }). `+r);}pickEmbeddedFace(e,t,i){let r=this.facesByFamily.get(C(e));if(!r)return;let s=t?"bold":"normal",n=i?"italic":"normal";return r.find(o=>o.weight===s&&o.style===n)??r.find(o=>o.weight==="normal"&&o.style==="normal")}measuredAs(e,t){let i=this.sink.registerSubstituteFont;if(!i)return e;try{return i.call(this.sink,e,t)}catch(r){return console.warn(`[fontRegistry] measurement view of the substitute for "${t}" failed; measuring with the substitute's own metrics: ${r instanceof Error?r.message:String(r)}`),e}}registerBuffer(e){let t=this.bufferIds.get(e);if(!t){let i=this.bufferIds;t=Promise.resolve().then(()=>this.sink.registerFont(new Uint8Array(e))),v(i,e,t,()=>false),i.set(e,t);}return t}registerFace(e){let t=this.faceIds.get(e);if(!t){let i=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}})(),v(i,e,t,r=>r===null),i.set(e,t);}return t}registerBundled(e,t,i){let r=this.bundledIds.get(e);if(!r){let s=this.bundledIds;r=(async()=>{try{let n=await t();return this.measuredAs(await this.registerBuffer(n),i)}catch(n){return console.warn(`[fontRegistry] bundled face for "${i}" failed to load or register; falling back: ${n instanceof Error?n.message:String(n)}`),null}})(),v(s,e,r,n=>n===null),s.set(e,r);}return r}registerLastResort(e,t,i){let r=this.lastResortIds.get(e);if(!r){let s=this.lastResortIds;r=(async()=>{try{let n=await t();return this.measuredAs(await this.registerBuffer(n),i)}catch{return console.warn(`[fontRegistry] last-resort base face for "${i}" failed to load or register; falling back`),null}})(),v(s,e,r,n=>n===null),s.set(e,r);}return r}resolveScript(e){let t=this.scriptIds.get(e);if(!t){let i=this.scriptIds,r=this.scriptResults;t=(async()=>{let s=null,n=false,o=await this.bundled();o===void 0&&typeof this.bundledSource=="function"&&(n=true);let l;try{l=o?.resolveScriptFallback?.(e,!1,!1);}catch(d){n=true,console.warn(`[fontRegistry] script-fallback resolver for "${e}" failed; falling back: ${d instanceof Error?d.message:String(d)}`);}if(l)try{let d=await l();s=await this.registerBuffer(d);}catch(d){n=true,console.warn(`[fontRegistry] script-fallback face for "${e}" failed to load or register; falling back: ${d instanceof Error?d.message:String(d)}`);}let f={id:s,retryable:n};return r.set(e,f),f})(),v(i,e,t,s=>s.retryable),i.set(e,t);}return t}};var T=null;function L(){return T??(T=import('../wasm-IBCLSJQU.mjs').then(async u=>(await u.preloadLayoutWasm(),{registerFont:u.registerMeasureFont,registerSubstituteFont:u.registerSubstituteMeasureFont,clearFonts:u.clearMeasureFonts}))),T}function H(u){let e=u.engine,t=new k({registerFont:r=>e.registerFont(r),...e.registerSubstituteFont&&{registerSubstituteFont:(r,s)=>e.registerSubstituteFont(r,s)}},{bundled:u.bundled??c}),i;return {setEmbeddedFaces(r){t.setEmbeddedFaces(r);},setCompat(r){i=r;},async prepareFontRequirements(r){return (await Promise.all(r.flatMap(n=>[(async()=>{try{return t.getCachedFontIdChain(n.family,n.bold,n.italic,!1)!==void 0?!1:(await t.getFontIdChain(n.family,n.bold,n.italic),!0)}catch{return false}})(),...Array.from(new Set(n.scripts??[]),async o=>{try{return t.getCachedScriptFallbackIds([o],!1)!==void 0?!1:(await t.getScriptFallbackIds([o]),!0)}catch{return false}})]))).some(Boolean)},measurementConfigForRequirements(r){let s=r.map(o=>({requirement:o,familyIds:t.getCachedFontIdChain(o.family,o.bold,o.italic,false),scriptIds:t.getCachedScriptFallbackIds(o.scripts??[],false)}));if(s.some(({familyIds:o,scriptIds:l})=>o===void 0||l===void 0))return;let n={};for(let{requirement:o}of s){let l=t.getCachedFontIdChain(o.family,o.bold,o.italic),f=t.getCachedScriptFallbackIds(o.scripts??[]);if(l===void 0||f===void 0)return;let d=Array.from(l);for(let a of f)d.includes(a)||d.push(a);d.length>0&&(n[o.key]=d);}return {fontChains:n,defaults:{fontSize:11,fontFamily:"Calibri"},compat:{noLeading:i?.noLeading??false,doNotExpandShiftReturn:i?.doNotExpandShiftReturn??false},authoritativeShaping:true}},clear(){t.clear();}}}var D=1056;function U(u,e){let t=u?.package.headers,i=u?.package.footers,r=e?.headerReferences?.find(F=>F.type==="default"),s=e?.headerReferences?.find(F=>F.type==="first"),n=e?.footerReferences?.find(F=>F.type==="default"),o=e?.footerReferences?.find(F=>F.type==="first"),l=r?t?.get(r.rId)??null:null,f=n?i?.get(n.rId)??null:null,d=s?t?.get(s.rId)??null:null,a=o?i?.get(o.rId)??null:null;return e?.titlePg||(l??(l=d),f??(f=a)),{header:l,footer:f,firstHeader:d,firstFooter:a}}var g,b,m,y,R,I,A,M=class{constructor(){d(this,I);d(this,g,0);d(this,b,0);d(this,m,false);d(this,y,false);d(this,R,new Set);}setStateSeq(e$1){e(this,g,e$1);}incrementStateSeq(){return ++g$1(this,g)._}getStateSeq(){return c$1(this,g)}getRenderSeq(){return c$1(this,b)}onLayoutStart(){e(this,m,true);}onLayoutComplete(e$1){e(this,b,e$1),e(this,m,false),c$1(this,y)&&this.isSafeToRender()&&(e(this,y,false),f(this,I,A).call(this));}isSafeToRender(){return !c$1(this,m)&&c$1(this,b)>=c$1(this,g)}requestRender(){this.isSafeToRender()?f(this,I,A).call(this):e(this,y,true);}onRender(e){return c$1(this,R).add(e),()=>c$1(this,R).delete(e)}reset(){e(this,g,0),e(this,b,0),e(this,m,false),e(this,y,false);}getDebugInfo(){return {stateSeq:c$1(this,g),renderSeq:c$1(this,b),layoutUpdating:c$1(this,m),hasPendingRender:c$1(this,y),isSafe:this.isSafeToRender()}}};g=new WeakMap,b=new WeakMap,m=new WeakMap,y=new WeakMap,R=new WeakMap,I=new WeakSet,A=function(){for(let e of c$1(this,R))try{e();}catch(t){console.error("LayoutSelectionGate: render callback error",t);}};export{D as DEFAULT_PAGE_HEIGHT_PX,M as LayoutSelectionGate,H as createRustMeasureSource,L as getRustTextEngine,U as resolveHeaderFooter};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b 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, L as Layout, a 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-
|
|
1
|
+
import { b as LayoutBlock, B as BlockExtent } from '../../types-Buyw6dFd.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, L as Layout, a 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-Buyw6dFd.mjs';
|
|
3
3
|
import '../../content-BzoC6bSz.mjs';
|
|
4
4
|
import '../../formatting-gqLFeJ9X.mjs';
|
|
5
5
|
import '../../docx/wrapTypes.mjs';
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { a as DisplayPage, G as GlyphRunPrimitive, L as LinePrimitive, T as TextRunPrimitive, b as DisplayPrimitive, D as DisplayList } from '../../frameDelta-ByU7HBuB.mjs';
|
|
2
2
|
export { c as DecodedFrameDelta, d as DecorationPrimitive, e as DisplayBounds, f as DocAttrs, F as FRAME_DELTA_HEADER_BYTES, g as FRAME_DELTA_PAGE_OP_BYTES, h as FRAME_DELTA_VERSION, i as FrameDeltaError, j as FrameDeltaErrorCode, k as FramePageOperation, H as HfRegion, I as ImagePrimitive, P as PositionedGlyph, l as RectPrimitive, R as RetainedFrame, m as RetainedFramePage, n as TableCellRef, o as applyFrameDelta, p as applyFrameDeltaOwned, q as decodeFrameDelta, r as displayPageNoteAnchorRevision, s as displayPageRevision } from '../../frameDelta-ByU7HBuB.mjs';
|
|
3
|
-
export { a as DisplayListBuildInputs, D as DisplayListHeadersFooters, b as DisplayListHfVariant, c as DisplayListPictureWatermark, d as DisplayListTextWatermark, e as DisplayListWatermark, f as RustDisplayFrameResult, g as RustDisplayListEngine, R as RustDisplayListQueryEngine, h as RustDisplayListSourceError, i as RustDisplayListSourceErrorStage, j as buildRustDisplayFrame, k as buildRustDisplayList, l as encodeDisplayListFrameExtras, m as loadRustDisplayListQueryEngine } from '../../rustDisplayList-
|
|
4
|
-
import { a as DisplayListQueries, b as DisplayListRegionHit, D as DisplayListRect } from '../../displayListQueries-
|
|
5
|
-
export { c as DisplayListHitRegion, d as DisplayListHoverTarget, e as DisplayListImageGeometry, f as DisplayListImageRegion, g as DisplayListParagraphGeometry, h as DisplayListQuerySourceState, i as DisplayListVerticalMove, j as DisplayListVisualLine, L as LocatedImagePrimitive, R as ResidentDisplayListQueryEngine, V as VisualLineExtent, k as captureInlinePositionEmuFromDisplayList, l as createDisplayListQueries, m as endDisplayListQueriesLine, n as findImagePrimitiveAtPoint, o as findImagePrimitiveByDocPos, p as isDisplayListQuerySourceDead, q as onDisplayListQuerySourceFailure } from '../../displayListQueries-
|
|
6
|
-
import { u as YrsLoc, Y as YrsSession,
|
|
3
|
+
export { a as DisplayListBuildInputs, D as DisplayListHeadersFooters, b as DisplayListHfVariant, c as DisplayListPictureWatermark, d as DisplayListTextWatermark, e as DisplayListWatermark, f as RustDisplayFrameResult, g as RustDisplayListEngine, R as RustDisplayListQueryEngine, h as RustDisplayListSourceError, i as RustDisplayListSourceErrorStage, j as buildRustDisplayFrame, k as buildRustDisplayList, l as encodeDisplayListFrameExtras, m as loadRustDisplayListQueryEngine } from '../../rustDisplayList-DcaA5iok.mjs';
|
|
4
|
+
import { a as DisplayListQueries, b as DisplayListRegionHit, D as DisplayListRect } from '../../displayListQueries-DnHmHUPY.mjs';
|
|
5
|
+
export { c as DisplayListHitRegion, d as DisplayListHoverTarget, e as DisplayListImageGeometry, f as DisplayListImageRegion, g as DisplayListParagraphGeometry, h as DisplayListQuerySourceState, i as DisplayListVerticalMove, j as DisplayListVisualLine, L as LocatedImagePrimitive, R as ResidentDisplayListQueryEngine, V as VisualLineExtent, k as captureInlinePositionEmuFromDisplayList, l as createDisplayListQueries, m as endDisplayListQueriesLine, n as findImagePrimitiveAtPoint, o as findImagePrimitiveByDocPos, p as isDisplayListQuerySourceDead, q as onDisplayListQuerySourceFailure } from '../../displayListQueries-DnHmHUPY.mjs';
|
|
6
|
+
import { u as YrsLoc, v as YrsStorySegment, Y as YrsSession, w as YrsRevisionInfo } from '../../index-yOtBET85.mjs';
|
|
7
7
|
import { TrackedChangeEntry } from '../../utils/comments.mjs';
|
|
8
8
|
import '../../formatting-gqLFeJ9X.mjs';
|
|
9
9
|
import '../../content-BzoC6bSz.mjs';
|
|
10
10
|
import '../../docx/wrapTypes.mjs';
|
|
11
|
-
import '../../types-
|
|
11
|
+
import '../../types-Buyw6dFd.mjs';
|
|
12
12
|
import '../pagination/index.mjs';
|
|
13
13
|
import '../../types/document.mjs';
|
|
14
14
|
import '../../styles-AryxLAhx.mjs';
|
|
15
|
-
import '../../pagedExport
|
|
15
|
+
import '../../pagedExport-BmSlEhoP.mjs';
|
|
16
16
|
import '../../loadWasmAsset-Cr95TImt.mjs';
|
|
17
17
|
import '../../rezip-Bxiq4Z_R.mjs';
|
|
18
|
+
import '../../plugin-api/index.mjs';
|
|
18
19
|
|
|
19
20
|
/** a cached glyph: its outline path (font units) plus the font's units-per-em. */
|
|
20
21
|
interface GlyphOutline {
|
|
@@ -165,6 +166,16 @@ declare function mirrorPageHasTabStops(page: DisplayPage): boolean;
|
|
|
165
166
|
declare function reduceMirrorToLinks(mirror: HTMLElement): HTMLElement;
|
|
166
167
|
/** `buildMirrorPage(page)` reduced to its links: see `reduceMirrorToLinks`. */
|
|
167
168
|
declare function buildMirrorPageLinks(page: DisplayPage, options?: BuildMirrorPageOptions): HTMLElement;
|
|
169
|
+
/**
|
|
170
|
+
* Reduces a `buildMirrorPage` tree, in place, to what a screen reader reads:
|
|
171
|
+
* everything `reduceMirrorToLinks` keeps, unchanged, plus the text of every
|
|
172
|
+
* other run as plain text inside its paragraph, table and region wrappers,
|
|
173
|
+
* and images with an accessible name. Wrappers that hold no kept element lose
|
|
174
|
+
* their ids and data attributes, so painter-contract queries never match them.
|
|
175
|
+
*/
|
|
176
|
+
declare function reduceMirrorToText(mirror: HTMLElement): HTMLElement;
|
|
177
|
+
/** `buildMirrorPage(page)` reduced to readable text: see `reduceMirrorToText`. */
|
|
178
|
+
declare function buildMirrorPageText(page: DisplayPage, options?: BuildMirrorPageOptions): HTMLElement;
|
|
168
179
|
/** Whether `page`'s mirror holds the note or note reference with element id `id`. */
|
|
169
180
|
declare function displayPageHoldsMirrorId(page: DisplayPage, id: string): boolean;
|
|
170
181
|
/**
|
|
@@ -505,6 +516,7 @@ interface A11yAnnouncement {
|
|
|
505
516
|
*/
|
|
506
517
|
declare function computeA11yAnnouncements(prev: A11ySelectionSnapshot | null, next: A11ySelectionSnapshot): A11yAnnouncement[];
|
|
507
518
|
|
|
519
|
+
type SidebarReader = Pick<YrsSession, 'storyIds' | 'storySegments' | 'version' | 'paragraphs' | 'locateParagraph'>;
|
|
508
520
|
/** A yrs location projected into the position space used by the display list. */
|
|
509
521
|
interface YrsSidebarDisplayPoint {
|
|
510
522
|
story: string;
|
|
@@ -517,6 +529,15 @@ interface YrsSidebarProjection {
|
|
|
517
529
|
locToDisplayPoint(loc: YrsLoc): YrsSidebarDisplayPoint | null;
|
|
518
530
|
storyOffsetToDisplayPoint(story: string, offset: number): YrsSidebarDisplayPoint | null;
|
|
519
531
|
}
|
|
532
|
+
/**
|
|
533
|
+
* Where a sidebar projection reads story segments. `segments` must answer for the session's
|
|
534
|
+
* current state on every call, as `YrsSession.storySegments` does; the arrays it returns are shared
|
|
535
|
+
* and never mutated. A projection remembers the last source given for a session and reads
|
|
536
|
+
* through it for the session's lifetime.
|
|
537
|
+
*/
|
|
538
|
+
interface YrsStorySegmentSource {
|
|
539
|
+
segments(story: string): YrsStorySegment[];
|
|
540
|
+
}
|
|
520
541
|
/**
|
|
521
542
|
* Convert a string yrs identity into the numeric id used by the existing
|
|
522
543
|
* layout/sidebar contract. This is the same UTF-8 FNV-1a projection used by
|
|
@@ -529,7 +550,7 @@ declare function yrsIdToNumericId(value: string): number;
|
|
|
529
550
|
* and block-SDT stories are recursively sized so container tokens are included.
|
|
530
551
|
* A session gets the same projection back until its document changes.
|
|
531
552
|
*/
|
|
532
|
-
declare function createYrsSidebarProjection(session:
|
|
553
|
+
declare function createYrsSidebarProjection(session: SidebarReader, source?: YrsStorySegmentSource): YrsSidebarProjection;
|
|
533
554
|
|
|
534
555
|
/**
|
|
535
556
|
* Comment / tracked-change anchor derivation over the display list, shared
|
|
@@ -775,4 +796,4 @@ declare function findDisplayListHyperlinkAtPoint(list: DisplayList, pageIndex: n
|
|
|
775
796
|
*/
|
|
776
797
|
declare const demoDisplayList: DisplayList;
|
|
777
798
|
|
|
778
|
-
export { type A11yAnnouncement, type A11yCommentThreadDetails, type A11ySelectionSnapshot, type AnchorEditorView, type BuildInteractiveOverlayOptions, type BuildMirrorPageOptions, CANVAS_PAGES_PADDING_PX, CANVAS_PAGE_GAP_PX, type CanvasImageResolverOptions, type CanvasPointHit, DISPLAY_LIST_TABLE_INSERT_HIDE_DELAY_MS, DisplayList, type DisplayListHfAnchorSource, type DisplayListHyperlinkHit, DisplayListQueries, DisplayListRect, DisplayListRegionHit, type DisplayListSelectedCellRect, type DisplayListSelectedCellSpec, type DisplayListTableFragment, type DisplayListTableInsertHoverHit, type DisplayListTableInsertHoverInput, type DisplayListTableRegion, DisplayPage, type DisplayPageClientRect, type DisplayPageHostOptions, DisplayPageRegistry, DisplayPrimitive, type DrawPageOptions, type GeoRect, GlyphCache, type GlyphCacheOptions, type GlyphOutline, type GlyphOutlineProvider, GlyphRunPrimitive, type ImageResolver, type InteractiveOverlayLabels, LinePrimitive, MIRROR_CLASS_NAMES, type MirrorLabels, type PageCanvasBuffer, type PageCanvasLike, type TableKeyResolver, type TableRowBand, TextRunPrimitive, type TrackedChangesResult, type YrsHeaderFooterRegions, type YrsSidebarDisplayPoint, type YrsSidebarProjection, applyInteractiveSdtFocus, bindDisplayPageRegistry, buildInteractiveOverlayPage, buildMirrorPage, buildMirrorPageLinks, canvasPageTops, computeA11yAnnouncements, computeAnchorPositionsFromDisplayList, computeAnchorPositionsFromYrs, createCanvasImageResolver, createYrsSidebarProjection, demoDisplayList, deriveDisplayListSelectedCellRects, deriveDisplayListTableFragments, deriveDisplayListTableFragmentsOnPages, detectDisplayListTableInsertHover, displayPageCanvas, displayPageCanvases, displayPageHoldsMirrorId, drawDisplayPage, drawPrimitive, effectiveZoom, extractTrackedChangesFromYrs, findDisplayListHyperlinkAtPoint, fontSizePxFromShorthand, glyphRunRect, interactiveOverlayHasTabStops, lineRect, loadGlyphOutlineProvider, materializeDisplayPages, mergeHfAnchorPositionsFromDisplayList, mirrorPageHasHeaderCells, mirrorPageHasTabStops, presentDisplayPageBackBuffer, presentOffscreenPageBackBuffer, rasterizeDisplayListPages, rasterizeDisplayPageToBackBuffer, reduceMirrorToLinks, resolveCanvasPoint, resolveDisplayPageClientRect, sizeCanvasForPage, snapshotFromSelectionContext, textRunRect, visitAnchorKeys, yrsIdToNumericId };
|
|
799
|
+
export { type A11yAnnouncement, type A11yCommentThreadDetails, type A11ySelectionSnapshot, type AnchorEditorView, type BuildInteractiveOverlayOptions, type BuildMirrorPageOptions, CANVAS_PAGES_PADDING_PX, CANVAS_PAGE_GAP_PX, type CanvasImageResolverOptions, type CanvasPointHit, DISPLAY_LIST_TABLE_INSERT_HIDE_DELAY_MS, DisplayList, type DisplayListHfAnchorSource, type DisplayListHyperlinkHit, DisplayListQueries, DisplayListRect, DisplayListRegionHit, type DisplayListSelectedCellRect, type DisplayListSelectedCellSpec, type DisplayListTableFragment, type DisplayListTableInsertHoverHit, type DisplayListTableInsertHoverInput, type DisplayListTableRegion, DisplayPage, type DisplayPageClientRect, type DisplayPageHostOptions, DisplayPageRegistry, DisplayPrimitive, type DrawPageOptions, type GeoRect, GlyphCache, type GlyphCacheOptions, type GlyphOutline, type GlyphOutlineProvider, GlyphRunPrimitive, type ImageResolver, type InteractiveOverlayLabels, LinePrimitive, MIRROR_CLASS_NAMES, type MirrorLabels, type PageCanvasBuffer, type PageCanvasLike, type TableKeyResolver, type TableRowBand, TextRunPrimitive, type TrackedChangesResult, type YrsHeaderFooterRegions, type YrsSidebarDisplayPoint, type YrsSidebarProjection, type YrsStorySegmentSource, applyInteractiveSdtFocus, bindDisplayPageRegistry, buildInteractiveOverlayPage, buildMirrorPage, buildMirrorPageLinks, buildMirrorPageText, canvasPageTops, computeA11yAnnouncements, computeAnchorPositionsFromDisplayList, computeAnchorPositionsFromYrs, createCanvasImageResolver, createYrsSidebarProjection, demoDisplayList, deriveDisplayListSelectedCellRects, deriveDisplayListTableFragments, deriveDisplayListTableFragmentsOnPages, detectDisplayListTableInsertHover, displayPageCanvas, displayPageCanvases, displayPageHoldsMirrorId, drawDisplayPage, drawPrimitive, effectiveZoom, extractTrackedChangesFromYrs, findDisplayListHyperlinkAtPoint, fontSizePxFromShorthand, glyphRunRect, interactiveOverlayHasTabStops, lineRect, loadGlyphOutlineProvider, materializeDisplayPages, mergeHfAnchorPositionsFromDisplayList, mirrorPageHasHeaderCells, mirrorPageHasTabStops, presentDisplayPageBackBuffer, presentOffscreenPageBackBuffer, rasterizeDisplayListPages, rasterizeDisplayPageToBackBuffer, reduceMirrorToLinks, reduceMirrorToText, resolveCanvasPoint, resolveDisplayPageClientRect, sizeCanvasForPage, snapshotFromSelectionContext, textRunRect, visitAnchorKeys, yrsIdToNumericId };
|