@docx-editor.dev/core 2.9.2 → 2.10.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/dist/automation.cjs +1 -1
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +74 -10
- package/dist/binding.d.ts +74 -10
- package/dist/binding.js +1 -1
- package/dist/chunk-27APDXY2.js +2 -0
- package/dist/chunk-35MI6K7M.cjs +10 -0
- package/dist/chunk-4XL7SOWQ.cjs +2 -0
- package/dist/chunk-6K6QQVAZ.cjs +18 -0
- package/dist/chunk-7ZJL5AEY.cjs +1 -0
- package/dist/chunk-C6LK2BYA.cjs +2 -0
- package/dist/chunk-HBEBUCRM.cjs +5 -0
- package/dist/chunk-LG5K46OM.js +2 -0
- package/dist/chunk-LWADHMVV.js +5 -0
- package/dist/chunk-N725IUO7.js +18 -0
- package/dist/chunk-N7DBENH4.js +10 -0
- package/dist/chunk-NVGFWMCO.js +1 -0
- package/dist/chunk-SYTWKJPJ.cjs +18 -0
- package/dist/chunk-YI6JXF7U.js +18 -0
- package/dist/contracts/document.d.cts +6 -1
- package/dist/contracts/document.d.ts +6 -1
- package/dist/contracts/editor.d.cts +6 -6
- package/dist/contracts/editor.d.ts +6 -6
- package/dist/contracts/interaction.d.cts +6 -6
- package/dist/contracts/interaction.d.ts +6 -6
- package/dist/contracts/modules.d.cts +3 -4
- package/dist/contracts/modules.d.ts +3 -4
- package/dist/{custom-node-writes-D6SGwebL.d.ts → custom-node-writes-BvpWCnW8.d.ts} +35 -4
- package/dist/{custom-node-writes-Dy3b20PS.d.cts → custom-node-writes-Db8H6Z3n.d.cts} +35 -4
- package/dist/{editor-Cvd7Geoc.d.ts → editor-C0my6Uta.d.ts} +35 -14
- package/dist/{editor-cAEf1uXW.d.cts → editor-CwzY2Hcg.d.cts} +35 -14
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +57 -456
- package/dist/editor.d.cts +20 -20
- package/dist/editor.d.ts +20 -20
- package/dist/editor.js +1 -1
- package/dist/{index-DRqY5JVF.d.ts → index-kID8Ymkp.d.ts} +79 -19
- package/dist/{index-wb-iOxfh.d.cts → index-nLFwo_17.d.cts} +79 -19
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +38 -19
- package/dist/layout.d.ts +38 -19
- package/dist/layout.js +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +6 -6
- package/dist/output.d.ts +6 -6
- package/dist/output.js +1 -1
- package/dist/{review-items-B8tffIXj.d.cts → review-items-CwixiHNe.d.cts} +1 -1
- package/dist/{review-items-bdGxFWNA.d.ts → review-items-Dw-8a6Ie.d.ts} +1 -1
- package/dist/{review-reads-Bxz03tHG.d.cts → review-reads-BqkiJTeR.d.cts} +1 -1
- package/dist/{review-reads-CHODU0LI.d.ts → review-reads-C0u-IKEA.d.ts} +1 -1
- package/dist/{semantic-cell-selection-BPzx6DdT.d.cts → semantic-cell-selection-DT9x9WLf.d.cts} +2 -2
- package/dist/{semantic-cell-selection-CsHcr-yk.d.ts → semantic-cell-selection-Utrf0lz7.d.ts} +2 -2
- package/dist/{semantic-interaction-BfWDD_0V.d.cts → semantic-interaction-B6hFRQLy.d.ts} +21 -2
- package/dist/{semantic-interaction-D-RZ9Ust.d.ts → semantic-interaction-Z0xKQcB4.d.cts} +21 -2
- package/dist/{semantic-paint-WhVtSDJK.d.ts → semantic-paint-CQEOC0Od.d.cts} +2 -2
- package/dist/{semantic-paint-Bd7EqzXV.d.cts → semantic-paint-quke354p.d.ts} +2 -2
- package/dist/{semantic-records-DadVT_E1.d.cts → semantic-records-CMakzQ1X.d.cts} +16 -2
- package/dist/{semantic-records-DCt-ZwKU.d.ts → semantic-records-Do3-i5oB.d.ts} +16 -2
- package/dist/{shaped-measurer-B9f4A7QA.d.ts → shaped-measurer-BxwTUluj.d.ts} +1 -1
- package/dist/{shaped-measurer-CninrHr_.d.cts → shaped-measurer-DzRwWrL5.d.cts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +128 -12
- package/dist/store.d.ts +128 -12
- package/dist/store.js +1 -1
- package/dist/tree-op-revision-attribution-CN06Xshv.d.cts +24 -0
- package/dist/tree-op-revision-attribution-CN06Xshv.d.ts +24 -0
- package/dist/{tree-op-types-CnRb7AYo.d.ts → tree-op-types-BuOfCrkp.d.ts} +259 -32
- package/dist/{tree-op-types-D1vNJ7XC.d.cts → tree-op-types-DSJYmf5b.d.cts} +259 -32
- package/dist/{tree-session-Df02ajqc.d.cts → tree-session-contract-ByWx8eew.d.cts} +44 -104
- package/dist/{tree-session-ZuBFOhIh.d.ts → tree-session-contract-C1dfE9hy.d.ts} +44 -104
- package/dist/{tree-store-DgETo6Mf.d.ts → tree-store-ASBtz7UB.d.ts} +1 -1
- package/dist/{tree-store-B_sJBMIS.d.cts → tree-store-CWOUMGN8.d.cts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-6JWP2H7K.js +0 -2
- package/dist/chunk-6KNLLEUW.cjs +0 -18
- package/dist/chunk-7ADTI533.cjs +0 -10
- package/dist/chunk-7ETDCPF6.cjs +0 -2
- package/dist/chunk-7I3BSGGS.js +0 -1
- package/dist/chunk-7UU5YFCD.cjs +0 -2
- package/dist/chunk-CKDAK3MV.js +0 -10
- package/dist/chunk-DIMEYVNS.js +0 -2
- package/dist/chunk-H2656QDI.cjs +0 -1
- package/dist/chunk-KQGENNL5.cjs +0 -15
- package/dist/chunk-LIXPSV4T.js +0 -18
- package/dist/chunk-O4UULRAQ.cjs +0 -5
- package/dist/chunk-SIIFNE6U.js +0 -15
- package/dist/chunk-VXYECPKA.js +0 -5
- package/dist/image-resources-BgA9EQxY.d.ts +0 -203
- package/dist/image-resources-BiA-IXgo.d.cts +0 -203
|
@@ -1,5 +1,60 @@
|
|
|
1
|
+
import { a as OoxmlNode, b as OoxmlElement, r as OoxmlDrawingNode, c as OoxmlPackage, p as OoxmlContentControlNode, q as OoxmlContentControlContentNode, s as OoxmlContentControlEndPropertiesNode, t as OoxmlContentControlPropertiesNode, O as OoxmlPart } from './ooxml-package-CdEy9ufK.cjs';
|
|
1
2
|
import { ParagraphTabStop } from './contracts/types.cjs';
|
|
2
|
-
import { a as
|
|
3
|
+
import { a as RevisionAttributionInput, R as RevisionAddress } from './tree-op-revision-attribution-CN06Xshv.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The engine's trust-boundary caps: recursion depth, element counts, and the rest.
|
|
7
|
+
*
|
|
8
|
+
* A caller may LOWER any of these but never raise or disable one — an override of `Infinity`,
|
|
9
|
+
* zero, a negative or `NaN` clamps into `(0, ceiling]` rather than turning the limit off. These
|
|
10
|
+
* are security ceilings, not performance budgets.
|
|
11
|
+
*/
|
|
12
|
+
interface ResourceLimits {
|
|
13
|
+
/** Max nested-structure recursion (tables/shapes/SDT/groups). */
|
|
14
|
+
readonly maxRecursionDepth: number;
|
|
15
|
+
/** Max total parsed element count. */
|
|
16
|
+
readonly maxElementCount: number;
|
|
17
|
+
/** Max package part count. */
|
|
18
|
+
readonly maxPartCount: number;
|
|
19
|
+
/** Max total decompressed bytes (zip-bomb guard). */
|
|
20
|
+
readonly maxDecompressedBytes: number;
|
|
21
|
+
/** Max total compressed input bytes. */
|
|
22
|
+
readonly maxCompressedBytes: number;
|
|
23
|
+
/** Max decompressed:compressed ratio per entry. */
|
|
24
|
+
readonly maxCompressionRatio: number;
|
|
25
|
+
/** In-memory chunk budget for streaming/spooling. */
|
|
26
|
+
readonly maxChunkBytes: number;
|
|
27
|
+
/** Max pagination passes before non-convergence is declared. */
|
|
28
|
+
readonly maxPaginationPasses: number;
|
|
29
|
+
/** Max queued items in any bounded work queue. */
|
|
30
|
+
readonly maxQueueDepth: number;
|
|
31
|
+
}
|
|
32
|
+
/** Non-disableable hard ceilings: no resolved limit may exceed these. */
|
|
33
|
+
declare const HARD_CEILINGS: ResourceLimits;
|
|
34
|
+
/** Finite defaults, all <= their hard ceiling. */
|
|
35
|
+
declare const DEFAULT_LIMITS: ResourceLimits;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve caller overrides into a frozen, always-finite limit set. Each value is
|
|
38
|
+
* `min(override>0 ? override : default, ceiling)`. Infinity/0/negative/NaN can
|
|
39
|
+
* never disable a limit — the hard ceiling always wins.
|
|
40
|
+
*/
|
|
41
|
+
declare function resolveLimits(overrides?: Partial<ResourceLimits>): ResourceLimits;
|
|
42
|
+
/** Bounded image decode limits (typed-drawings-and-images task 4). */
|
|
43
|
+
/** Trust-boundary caps specific to image decoding and embedding. */
|
|
44
|
+
interface ImageResourceLimits {
|
|
45
|
+
readonly maxEncodedBytes: number;
|
|
46
|
+
readonly maxDecodedBytes: number;
|
|
47
|
+
readonly maxPixels: number;
|
|
48
|
+
readonly maxDimension: number;
|
|
49
|
+
readonly maxPolygonPoints: number;
|
|
50
|
+
readonly maxExternalRedirects: number;
|
|
51
|
+
}
|
|
52
|
+
/** Image caps nothing can raise past. A caller's override clamps into these. */
|
|
53
|
+
declare const IMAGE_RESOURCE_HARD_CEILINGS: ImageResourceLimits;
|
|
54
|
+
/** The image caps in force when a host configures none. Conservative and finite. */
|
|
55
|
+
declare const DEFAULT_IMAGE_RESOURCE_LIMITS: ImageResourceLimits;
|
|
56
|
+
/** Resolve caller overrides into frozen image limits; hard ceilings cannot be raised. */
|
|
57
|
+
declare function resolveImageResourceLimits(overrides?: Partial<ImageResourceLimits>): ImageResourceLimits;
|
|
3
58
|
|
|
4
59
|
/** The relationship namespace `r:id` lives in. */
|
|
5
60
|
declare const OFFICE_RELATIONSHIP_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
@@ -328,6 +383,151 @@ declare function projectDrawing(drawing: OoxmlDrawingNode, context: Readonly<{
|
|
|
328
383
|
resolveRelationship?: RelationshipTargetResolver;
|
|
329
384
|
}>): DrawingProjection | null;
|
|
330
385
|
|
|
386
|
+
/** Opaque handle — bytes are reachable only through {@link mintValidatedImageBytes}. */
|
|
387
|
+
interface ValidatedImageBytesHandle {
|
|
388
|
+
readonly registryId: number;
|
|
389
|
+
readonly resourceKey: string;
|
|
390
|
+
readonly contentId: string;
|
|
391
|
+
readonly generation: number;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Raster media the decode port measures and any authoring path may write.
|
|
396
|
+
*
|
|
397
|
+
* BMP and WebP are here for the same reason the other three are: an `<img>` decodes them
|
|
398
|
+
* natively, so they need a signature and a structural header and nothing else. BMP is what
|
|
399
|
+
* older documents carry; WebP is what current Word writes.
|
|
400
|
+
*/
|
|
401
|
+
type SupportedImageMime = 'image/png' | 'image/jpeg' | 'image/gif' | 'image/bmp' | 'image/webp';
|
|
402
|
+
/**
|
|
403
|
+
* Vector media painted straight from validated bytes. An `<img>` renders SVG in the
|
|
404
|
+
* browser's secure static mode — no script, no external subresource loads — so there is
|
|
405
|
+
* no decode step and no raster buffer sized by a file-supplied number.
|
|
406
|
+
*/
|
|
407
|
+
type VectorImageMime = 'image/svg+xml';
|
|
408
|
+
/** Every mime the painter can hand to an `<img>`. */
|
|
409
|
+
type RenderableImageMime = SupportedImageMime | VectorImageMime;
|
|
410
|
+
/**
|
|
411
|
+
* Media kept in the package byte-for-byte that the painter cannot hand to an `<img>`.
|
|
412
|
+
* A decode port may rasterize it; without one it paints as a labelled placeholder.
|
|
413
|
+
*/
|
|
414
|
+
type PreservedImageMime = 'image/tiff' | 'image/x-emf' | 'image/x-wmf';
|
|
415
|
+
/**
|
|
416
|
+
* What is known about one embedded image: validated, refused, or still decoding.
|
|
417
|
+
*
|
|
418
|
+
* Content type is a CLAIM. Signature sniffing, structural header validation and the decode port
|
|
419
|
+
* are authoritative, and bytes that fail them never enter public state.
|
|
420
|
+
*/
|
|
421
|
+
type ImageResourceState = {
|
|
422
|
+
readonly kind: 'ready';
|
|
423
|
+
readonly partName: string;
|
|
424
|
+
readonly contentId: string;
|
|
425
|
+
readonly resourceKey: string;
|
|
426
|
+
readonly validatedHandle: ValidatedImageBytesHandle;
|
|
427
|
+
readonly mime: RenderableImageMime;
|
|
428
|
+
readonly pixelWidth: number;
|
|
429
|
+
readonly pixelHeight: number;
|
|
430
|
+
readonly dpiX: number;
|
|
431
|
+
readonly dpiY: number;
|
|
432
|
+
} | {
|
|
433
|
+
readonly kind: 'unrenderable';
|
|
434
|
+
readonly partName: string | null;
|
|
435
|
+
readonly mime: RenderableImageMime | PreservedImageMime | 'unknown';
|
|
436
|
+
readonly reason: 'unsupported-format' | 'non-picture-graphic' | 'signature-mismatch' | 'decode-failed' | 'resource-limit';
|
|
437
|
+
} | {
|
|
438
|
+
readonly kind: 'external';
|
|
439
|
+
readonly relationshipId: string;
|
|
440
|
+
readonly sinkSafe: boolean;
|
|
441
|
+
} | {
|
|
442
|
+
readonly kind: 'missing';
|
|
443
|
+
readonly relationshipId: string;
|
|
444
|
+
} | {
|
|
445
|
+
readonly kind: 'pending';
|
|
446
|
+
readonly resourceKey: string;
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* The injected image decoder.
|
|
450
|
+
*
|
|
451
|
+
* A port rather than a direct `Image`/`createImageBitmap` call, so a worker or server runtime
|
|
452
|
+
* supplies its own and the engine never reaches for a browser global.
|
|
453
|
+
*/
|
|
454
|
+
interface ImageDecodePort {
|
|
455
|
+
decode(bytes: Uint8Array, mime: SupportedImageMime, limits: ImageResourceLimits): Promise<Readonly<{
|
|
456
|
+
pixelWidth: number;
|
|
457
|
+
pixelHeight: number;
|
|
458
|
+
dpiX: number;
|
|
459
|
+
dpiY: number;
|
|
460
|
+
}>>;
|
|
461
|
+
/**
|
|
462
|
+
* Optional conversion of media an `<img>` cannot render (EMF/WMF metafiles, TIFF) into a
|
|
463
|
+
* renderable raster. The returned bytes are untrusted and re-enter the full raster
|
|
464
|
+
* validation path (sniff, header, pixel caps, decode) before they can become a ready
|
|
465
|
+
* resource. A null return declines the format and keeps the labelled placeholder; so does
|
|
466
|
+
* a throw, as `decode-failed`.
|
|
467
|
+
*/
|
|
468
|
+
convertPreserved?(bytes: Uint8Array, mime: PreservedImageMime, limits: ImageResourceLimits): Promise<Readonly<{
|
|
469
|
+
bytes: Uint8Array;
|
|
470
|
+
mime: SupportedImageMime;
|
|
471
|
+
}> | null>;
|
|
472
|
+
}
|
|
473
|
+
/** Resolves a relationship id to a validated image resource, or reports why it could not. */
|
|
474
|
+
interface ImageResourceLookup {
|
|
475
|
+
readonly resolveEmbedded: (ownerPartName: string, relationshipId: string) => Promise<ImageResourceState>;
|
|
476
|
+
readonly resolveLinked: (ownerPartName: string, relationshipId: string) => ImageResourceState;
|
|
477
|
+
readonly resolveForProjection: (projection: DrawingProjection) => Promise<ImageResourceState>;
|
|
478
|
+
readonly liveReferenceCount: (partName: string) => number;
|
|
479
|
+
readonly dispose: () => void;
|
|
480
|
+
}
|
|
481
|
+
/** Maximum prefix inspected for SVG root detection (exported for bounded-scan tests). */
|
|
482
|
+
declare const MAX_SVG_SNIFF_BYTES = 512;
|
|
483
|
+
/** A raster header that passed structural validation: its real MIME type and pixel extent. */
|
|
484
|
+
interface ValidatedRasterHeader {
|
|
485
|
+
readonly pixelWidth: number;
|
|
486
|
+
readonly pixelHeight: number;
|
|
487
|
+
}
|
|
488
|
+
/** Bounded scan for an `<svg` document root (optional `<?xml` prolog only). */
|
|
489
|
+
declare function hasBoundedSvgRoot(bytes: Uint8Array): boolean;
|
|
490
|
+
/** Signature sniffing — authoritative over declared content type. */
|
|
491
|
+
declare function sniffImageMime(bytes: Uint8Array): RenderableImageMime | PreservedImageMime | 'unknown';
|
|
492
|
+
/** Structural PNG IHDR validation before decode. */
|
|
493
|
+
declare function validatePngHeader(bytes: Uint8Array): ValidatedRasterHeader | null;
|
|
494
|
+
/** Structural GIF logical screen descriptor validation before decode. */
|
|
495
|
+
declare function validateGifHeader(bytes: Uint8Array): ValidatedRasterHeader | null;
|
|
496
|
+
/** Bounded JPEG marker scan through the first supported SOF marker. */
|
|
497
|
+
declare function validateJpegHeader(bytes: Uint8Array): ValidatedRasterHeader | null;
|
|
498
|
+
/**
|
|
499
|
+
* Intrinsic size of an SVG, resolved the way a browser sizes one: absolute `width`/`height`
|
|
500
|
+
* first, then `viewBox` for the missing axis or ratio, then the CSS 300x150 default.
|
|
501
|
+
*
|
|
502
|
+
* This is metadata for insert and reset-to-natural-size only. Layout uses the authored
|
|
503
|
+
* `wp:extent` and the browser rasterizes into that box, so nothing here sizes an allocation
|
|
504
|
+
* and an out-of-range value is clamped rather than refused.
|
|
505
|
+
*/
|
|
506
|
+
declare function resolveSvgIntrinsicSize(bytes: Uint8Array, limits: ImageResourceLimits): ValidatedRasterHeader | null;
|
|
507
|
+
/**
|
|
508
|
+
* Validate a raster image's header structurally and report its real MIME type and extent.
|
|
509
|
+
*
|
|
510
|
+
* Content type is a CLAIM; this is what makes it a fact. A file declaring `image/png` over JPEG
|
|
511
|
+
* bytes is caught here rather than at decode.
|
|
512
|
+
*/
|
|
513
|
+
declare function validateRasterHeader(bytes: Uint8Array, mime: SupportedImageMime): ValidatedRasterHeader | null;
|
|
514
|
+
/** Package-wide live drawing references to a media part name. */
|
|
515
|
+
declare function liveDrawingReferenceCount(pkg: OoxmlPackage, partName: string): number;
|
|
516
|
+
/** How the image cache decodes, and what it will spend doing so. */
|
|
517
|
+
interface CreateImageResourceCacheOptions {
|
|
518
|
+
readonly limits?: Partial<ImageResourceLimits>;
|
|
519
|
+
readonly decodePort: ImageDecodePort;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Derived cache for one immutable package snapshot. Registry identity is
|
|
523
|
+
* `(package snapshot, decodePort object, normalized limits)` — the first caller
|
|
524
|
+
* never imposes its decoder or limits on later callers with different options.
|
|
525
|
+
*/
|
|
526
|
+
declare function imageResourceLookupFor(pkg: OoxmlPackage, options: CreateImageResourceCacheOptions): ImageResourceLookup;
|
|
527
|
+
/** @deprecated Prefer {@link imageResourceLookupFor} — registry binds cache to package identity. */
|
|
528
|
+
/** Build the per-document image cache. Validated bytes only; refusals are remembered too. */
|
|
529
|
+
declare function createImageResourceCache(initialPkg: OoxmlPackage, options: CreateImageResourceCacheOptions): ImageResourceLookup;
|
|
530
|
+
|
|
331
531
|
/** How deep controls may nest before a walk stops descending. Shared by every lane. */
|
|
332
532
|
declare const MAX_CONTENT_CONTROL_NESTING = 32;
|
|
333
533
|
/** Cap on controls one walk reports, so a hostile file cannot make a read unbounded. */
|
|
@@ -649,32 +849,7 @@ interface OoxmlProperty {
|
|
|
649
849
|
readonly localName: string;
|
|
650
850
|
readonly attributes?: Readonly<Record<string, string>>;
|
|
651
851
|
}
|
|
652
|
-
|
|
653
|
-
* The identity of one revision WITHIN a part: `@w:id`, `@w:author` and `@w:date` together.
|
|
654
|
-
*
|
|
655
|
-
* `@w:id` is not unique and not author-scoped, so `(part, id)` alone would merge two authors'
|
|
656
|
-
* distinct revisions; and one logical revision — a tracked row insertion — is deliberately
|
|
657
|
-
* many elements sharing an id, which a uniqueness rule could not express at all.
|
|
658
|
-
*/
|
|
659
|
-
/**
|
|
660
|
-
* How a tracked change is addressed: its numeric id plus the PART it lives in.
|
|
661
|
-
*
|
|
662
|
-
* Both, always — `@w:id` is unique only within a part, so an id alone names two revisions in any
|
|
663
|
-
* package with a header or a comments part.
|
|
664
|
-
*/
|
|
665
|
-
interface RevisionAddress {
|
|
666
|
-
readonly id: string;
|
|
667
|
-
readonly author: string;
|
|
668
|
-
/** Absent when the file wrote no `@w:date`; part of the identity either way. */
|
|
669
|
-
readonly date?: string;
|
|
670
|
-
}
|
|
671
|
-
/** Who a tracked edit is attributed to. `CT_TrackChange` requires an author. */
|
|
672
|
-
/** The author and timestamp a tracked edit is recorded under. */
|
|
673
|
-
interface RevisionAttributionInput {
|
|
674
|
-
readonly author: string;
|
|
675
|
-
/** ISO-8601. Omitted writes no `@w:date`. */
|
|
676
|
-
readonly date?: string;
|
|
677
|
-
}
|
|
852
|
+
|
|
678
853
|
/**
|
|
679
854
|
* Every mutation the store accepts, as one JSON-safe discriminated union.
|
|
680
855
|
*
|
|
@@ -877,6 +1052,8 @@ type TreeDocOp = {
|
|
|
877
1052
|
readonly op: 'setParagraphMarkProperties';
|
|
878
1053
|
readonly paragraphId: string;
|
|
879
1054
|
readonly properties: readonly OoxmlProperty[];
|
|
1055
|
+
/** Record this as a TRACKED format change (`w:pPr/w:rPr/w:rPrChange`, §17.13.5.31). */
|
|
1056
|
+
readonly revision?: RevisionAttributionInput;
|
|
880
1057
|
} | {
|
|
881
1058
|
readonly op: 'setListNumbering';
|
|
882
1059
|
readonly paragraphId: string;
|
|
@@ -909,6 +1086,16 @@ type TreeDocOp = {
|
|
|
909
1086
|
readonly op: 'splitParagraph';
|
|
910
1087
|
readonly paragraphId: string;
|
|
911
1088
|
readonly offset: number;
|
|
1089
|
+
/**
|
|
1090
|
+
* The `w:pStyle` the MINTED tail takes, instead of the head's own.
|
|
1091
|
+
*
|
|
1092
|
+
* A split otherwise clones the whole `w:pPr`, which is right for every property but
|
|
1093
|
+
* the style when the caller is an Enter at the end of a paragraph: Word gives that
|
|
1094
|
+
* new paragraph the style's `w:next`, so a heading is followed by body text rather
|
|
1095
|
+
* than by a second heading. `null` authors no `w:pStyle` at all, which is what the
|
|
1096
|
+
* document's default style is spelled as. Omit to clone the head's style unchanged.
|
|
1097
|
+
*/
|
|
1098
|
+
readonly tailStyleId?: string | null;
|
|
912
1099
|
} | {
|
|
913
1100
|
/**
|
|
914
1101
|
* Split one `w:p` at MANY offsets in a single op.
|
|
@@ -944,6 +1131,11 @@ type TreeDocOp = {
|
|
|
944
1131
|
readonly start: number;
|
|
945
1132
|
readonly end: number;
|
|
946
1133
|
readonly properties: readonly OoxmlProperty[];
|
|
1134
|
+
/**
|
|
1135
|
+
* Record this as a TRACKED format change: each run keeps its new `w:rPr` and gains a
|
|
1136
|
+
* `w:rPrChange` (§17.13.5.30) holding the properties it had, so Reject restores them.
|
|
1137
|
+
*/
|
|
1138
|
+
readonly revision?: RevisionAttributionInput;
|
|
947
1139
|
/**
|
|
948
1140
|
* When set, format only these runs (field result ownership). Offset range still
|
|
949
1141
|
* gates the edit and drives edge splits; without this, multi-run field results that
|
|
@@ -954,6 +1146,8 @@ type TreeDocOp = {
|
|
|
954
1146
|
readonly op: 'setParagraphProperties';
|
|
955
1147
|
readonly paragraphId: string;
|
|
956
1148
|
readonly properties: readonly OoxmlProperty[];
|
|
1149
|
+
/** Record this as a TRACKED format change (`w:pPrChange`, §17.13.5.29). */
|
|
1150
|
+
readonly revision?: RevisionAttributionInput;
|
|
957
1151
|
} | {
|
|
958
1152
|
/**
|
|
959
1153
|
* Set page-setup fields — page size, orientation, margins — on every targeted
|
|
@@ -983,11 +1177,20 @@ type TreeDocOp = {
|
|
|
983
1177
|
/**
|
|
984
1178
|
* End a section AT this paragraph: mint a `w:pPr/w:sectPr` cloning the governing
|
|
985
1179
|
* section's effective page setup, so the blocks up to and including this paragraph
|
|
986
|
-
* become their own section
|
|
987
|
-
* already carry one.
|
|
1180
|
+
* become their own section. The paragraph must not already carry one.
|
|
988
1181
|
*/
|
|
989
1182
|
readonly op: 'setSectionMark';
|
|
990
1183
|
readonly paragraphId: string;
|
|
1184
|
+
/**
|
|
1185
|
+
* Where the section that STARTS after this mark begins — Word's Breaks menu.
|
|
1186
|
+
*
|
|
1187
|
+
* `w:type` states how a section starts relative to the previous one (§17.6.22), so it
|
|
1188
|
+
* is written on the section FOLLOWING the mark, never on the minted one, which keeps
|
|
1189
|
+
* the cloned type because it starts where the section it was cut from did. `'nextPage'`
|
|
1190
|
+
* clears `w:type` (absent IS nextPage), so a next-page break inside a continuous
|
|
1191
|
+
* section really starts a page. Omitted leaves the following section untouched.
|
|
1192
|
+
*/
|
|
1193
|
+
readonly breakType?: 'nextPage' | 'continuous';
|
|
991
1194
|
} | {
|
|
992
1195
|
/**
|
|
993
1196
|
* Wrap `[start, end)` of a paragraph in a `w:hyperlink`.
|
|
@@ -1366,11 +1569,29 @@ type TreeDocOp = {
|
|
|
1366
1569
|
readonly position?: string;
|
|
1367
1570
|
readonly numStart?: number;
|
|
1368
1571
|
};
|
|
1572
|
+
} | {
|
|
1573
|
+
/**
|
|
1574
|
+
* Insert clipboard-fragment blocks at a paragraph position, atomically.
|
|
1575
|
+
*
|
|
1576
|
+
* Blocks only — resources (styles, numbering, media, rels, note parts) merge through
|
|
1577
|
+
* the package-edit path in the same transaction, and the whole commit is promoted to
|
|
1578
|
+
* a package undo unit. A merged edge paragraph takes the properties of the paragraph
|
|
1579
|
+
* mark that ends it: the fragment's first mark leading, the host's original mark
|
|
1580
|
+
* trailing. Nodes receive fresh ids at apply.
|
|
1581
|
+
*/
|
|
1582
|
+
readonly op: 'insertFragment';
|
|
1583
|
+
readonly paragraphId: string;
|
|
1584
|
+
readonly offset: number;
|
|
1585
|
+
readonly blocks: readonly OoxmlNode[];
|
|
1586
|
+
/** True when the fragment's last paragraph mark travelled (its paragraph stays whole). */
|
|
1587
|
+
readonly lastMarkCovered?: boolean;
|
|
1369
1588
|
} | {
|
|
1370
1589
|
readonly op: 'insertDrawing';
|
|
1371
1590
|
readonly paragraphId: string;
|
|
1372
1591
|
readonly offset: number;
|
|
1373
1592
|
readonly drawing: OoxmlDrawingNode;
|
|
1593
|
+
/** Present in suggesting mode: the drawing's run goes into a `w:ins` as one proposal. */
|
|
1594
|
+
readonly revision?: RevisionAttributionInput;
|
|
1374
1595
|
} | {
|
|
1375
1596
|
readonly op: 'replaceDrawingResource';
|
|
1376
1597
|
readonly drawingNodeId: string;
|
|
@@ -1451,7 +1672,7 @@ type DrawingTreeDocOp = Extract<TreeDocOp, {
|
|
|
1451
1672
|
/** Just the `op` discriminants, for dispatch tables and validation. */
|
|
1452
1673
|
type TreeDocOpKind = TreeDocOp['op'];
|
|
1453
1674
|
/** Every {@link TreeDocOpKind}, for validation and exhaustiveness checks. */
|
|
1454
|
-
declare const TREE_DOC_OP_KINDS: readonly ["replaceStoryBlocks", "insertText", "deleteText", "setParagraphMarkRevision", "proposeParagraphMerge", "insertCommentMarker", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "insertTab", "insertHardBreak", "insertPageBreak", "insertPageField", "setListLevel", "setListNumbering", "setParagraphTabStops", "setParagraphMarkProperties", "splitParagraph", "splitParagraphMany", "joinParagraphs", "setRunProperties", "setParagraphProperties", "setSectionProperties", "setSectionMark", "insertHyperlink", "setHyperlinkTarget", "removeHyperlink", "setMathEquation", "removeMathEquation", "setContentControlValue", "removeContentControl", "insertInlineContentControl", "addRepeatingSectionItem", "removeRepeatingSectionItem", "deleteBlock", "insertTable", "insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "setTableColumnWidths", "setTableRightEdgeWidth", "setTableRowHeight", "setTableCellBorders", "setTableCellFill", "setTableCellVerticalAlignment", "createHeaderFooter", "deleteHeaderFooter", "linkToPrevious", "unlinkFromPrevious", "setSectionFurnitureOptions", "insertNote", "deleteNote", "convertNote", "convertAllNotes", "setNoteProperties", "setContentControlProperties", "insertContentControl", "insertDrawing", "replaceDrawingResource", "deleteDrawing", "resizeDrawing", "cropDrawing", "positionDrawing", "setDrawingWrap", "setDrawingMetadata", "setDrawingLocks", "transformDrawing", "insertToc", "replaceTocResult", "rewriteTocPageNumbers"];
|
|
1675
|
+
declare const TREE_DOC_OP_KINDS: readonly ["replaceStoryBlocks", "insertText", "deleteText", "setParagraphMarkRevision", "proposeParagraphMerge", "insertCommentMarker", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "insertTab", "insertHardBreak", "insertPageBreak", "insertPageField", "setListLevel", "setListNumbering", "setParagraphTabStops", "setParagraphMarkProperties", "splitParagraph", "splitParagraphMany", "joinParagraphs", "setRunProperties", "setParagraphProperties", "setSectionProperties", "setSectionMark", "insertHyperlink", "setHyperlinkTarget", "removeHyperlink", "setMathEquation", "removeMathEquation", "setContentControlValue", "removeContentControl", "insertInlineContentControl", "addRepeatingSectionItem", "removeRepeatingSectionItem", "deleteBlock", "insertTable", "insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "setTableColumnWidths", "setTableRightEdgeWidth", "setTableRowHeight", "setTableCellBorders", "setTableCellFill", "setTableCellVerticalAlignment", "createHeaderFooter", "deleteHeaderFooter", "linkToPrevious", "unlinkFromPrevious", "setSectionFurnitureOptions", "insertNote", "deleteNote", "convertNote", "convertAllNotes", "setNoteProperties", "setContentControlProperties", "insertContentControl", "insertFragment", "insertDrawing", "replaceDrawingResource", "deleteDrawing", "resizeDrawing", "cropDrawing", "positionDrawing", "setDrawingWrap", "setDrawingMetadata", "setDrawingLocks", "transformDrawing", "insertToc", "replaceTocResult", "rewriteTocPageNumbers"];
|
|
1455
1676
|
/**
|
|
1456
1677
|
* How far a committed op can reach, so layout can scope its work (task 5.2).
|
|
1457
1678
|
*
|
|
@@ -1574,7 +1795,13 @@ type TreeOpRejection = 'unknown-op' | 'unknown-paragraph' | 'not-a-paragraph' |
|
|
|
1574
1795
|
/** Suggesting-mode drawing deletion is not implemented in this change. */
|
|
1575
1796
|
| 'trackedDrawingDeletionUnsupported'
|
|
1576
1797
|
/** Hyperlink target creation or change needs an OPC relationship in a package transaction. */
|
|
1577
|
-
| 'packageTransactionRequired'
|
|
1798
|
+
| 'packageTransactionRequired'
|
|
1799
|
+
/** A clipboard fragment block nests deeper than the recursion cap. */
|
|
1800
|
+
| 'fragment-too-deep'
|
|
1801
|
+
/** A clipboard fragment block is not a paragraph, table, or content control subtree. */
|
|
1802
|
+
| 'fragment-invalid-block'
|
|
1803
|
+
/** A clipboard fragment exceeds its block or node budget. */
|
|
1804
|
+
| 'fragment-resource-budget';
|
|
1578
1805
|
/** Whether an op applied, with the effect it produced or the reason it was refused. */
|
|
1579
1806
|
type TreeOpResult = {
|
|
1580
1807
|
readonly ok: true;
|
|
@@ -1586,4 +1813,4 @@ type TreeOpResult = {
|
|
|
1586
1813
|
readonly detail?: string;
|
|
1587
1814
|
};
|
|
1588
1815
|
|
|
1589
|
-
export {
|
|
1816
|
+
export { type HyperlinkTarget as $, type ContentControlDataBinding as A, type ResourceLimits as B, type ContentControlKind as C, type DrawingKind as D, type TreeOpResult as E, ACCEPTED_PARAGRAPH_PROPERTIES as F, ACCEPTED_RUN_PROPERTIES as G, CONTENT_CONTROL_ID_MAX as H, type ImpactClass as I, CONTENT_CONTROL_PROPERTY_ORDER as J, type ContentControlCheckbox as K, type ContentControlCheckboxState as L, type ContentControlDateFormat as M, type ContentControlEntry as N, type OoxmlProperty as O, type PreservedImageMime as P, type ContentControlListItem as Q, type RenderableImageMime as R, type SourceCrop as S, type TreeDocOp as T, type ContentControlProperties as U, type ValidatedImageBytesHandle as V, type CreateImageResourceCacheOptions as W, DEFAULT_LIMITS as X, HARD_CEILINGS as Y, HYPERLINK_RELATIONSHIP_TYPE as Z, type HyperlinkKind as _, type TreeOpRejection as a, IMAGE_RESOURCE_HARD_CEILINGS as a0, type ImageResourceLookup as a1, MAX_CONTENT_CONTROLS_PER_PART as a2, MAX_CONTENT_CONTROL_NESTING as a3, MAX_SVG_SNIFF_BYTES as a4, OFFICE_RELATIONSHIP_NAMESPACE_URI as a5, type RelationshipTargetResolver as a6, TABLE_BORDER_STYLES as a7, TREE_DOC_OP_KINDS as a8, type TabStopWrite as a9, lockForbidsRemoval as aA, orderedContentControlProperties as aB, parseContentControlId as aC, projectDrawing as aD, resolveContentControlLock as aE, resolveLimits as aF, validateGifHeader as aG, validateJpegHeader as aH, validatePngHeader as aI, type TreeDocOpKind as aa, type TreeOpEffect as ab, type ValidatedRasterHeader as ac, allocateContentControlId as ad, contentControlContentChildren as ae, contentControlContentNodeOf as af, contentControlEndPropertiesNodeOf as ag, contentControlLevelOf as ah, contentControlPropertiesNodeOf as ai, contentControlPropertiesOf as aj, contentControlTextOf as ak, contentControlsIn as al, createImageResourceCache as am, findContentControl as an, flattenContentControls as ao, hasBoundedSvgRoot as ap, hyperlinkAnchorOf as aq, hyperlinkRelationshipIdOf as ar, hyperlinkTargetOf as as, imageResourceLookupFor as at, isContentControlContentNode as au, isContentControlNode as av, isContentControlWrapper as aw, isHyperlinkNode as ax, liveDrawingReferenceCount as ay, lockForbidsEdit as az, type ImageWrapTarget as b, type SupportedImageMime as c, type DrawingPositionInput as d, type DrawingLocks as e, type ImageResourceState as f, type DrawingHorizontalReferenceFrame as g, type DrawingVerticalReferenceFrame as h, type VectorImageMime as i, type ImageDecodePort as j, type DrawingTreeDocOp as k, type TreeDocColorValue as l, DEFAULT_IMAGE_RESOURCE_LIMITS as m, IMAGE_WRAP_TARGETS as n, type ImageResourceLimits as o, resolveSvgIntrinsicSize as p, type DrawingAccessibility as q, resolveImageResourceLimits as r, sniffImageMime as s, type DrawingTransform as t, type VectorShapeProjection as u, validateRasterHeader as v, type DrawingProjection as w, type TableBorderStyle as x, type ContentControlLevel as y, type ContentControlLock as z };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { O as OoxmlPart, a as OoxmlNode, c as OoxmlPackage, b as OoxmlElement, o as OoxmlPackageRejection } from './ooxml-package-CdEy9ufK.cjs';
|
|
1
|
+
import { S as StoryScope, a as StoryTargetRejection, D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, b as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind, c as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput, F as FragmentPasteInput, e as FragmentPasteResult } from './custom-node-writes-Db8H6Z3n.cjs';
|
|
2
|
+
import { T as TreeDocOp, c as SupportedImageMime, j as ImageDecodePort } from './tree-op-types-DSJYmf5b.cjs';
|
|
3
|
+
import { O as OoxmlPart, a as OoxmlNode, c as OoxmlPackage, b as OoxmlElement } from './ooxml-package-CdEy9ufK.cjs';
|
|
5
4
|
import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-Dvk6De4Q.cjs';
|
|
6
|
-
import { T as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-CWOUMGN8.cjs';
|
|
6
|
+
import { a as ReviewItem } from './review-items-CwixiHNe.cjs';
|
|
7
|
+
import { Node } from 'prosemirror-model';
|
|
8
|
+
import { a as RevisionAttributionInput } from './tree-op-revision-attribution-CN06Xshv.cjs';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Why an edited projection could not be mapped back into tree ops.
|
|
@@ -91,6 +90,27 @@ interface DocumentStyleEntry {
|
|
|
91
90
|
readonly preview: DocumentStylePreview;
|
|
92
91
|
}
|
|
93
92
|
|
|
93
|
+
/**
|
|
94
|
+
* The scheme slots the picker shows, in Word's column order.
|
|
95
|
+
*
|
|
96
|
+
* Assumes the default `w:clrSchemeMapping` (bg1→lt1, t1→dk1, ...); a settings part
|
|
97
|
+
* that remaps them is rare and a follow-up.
|
|
98
|
+
*/
|
|
99
|
+
declare const PICKER_SLOTS: readonly ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
100
|
+
type ThemeColorSlot = (typeof PICKER_SLOTS)[number];
|
|
101
|
+
/** One theme colour: the scheme slot and its resolved six-digit hex (no '#'). */
|
|
102
|
+
interface DocumentThemeColorEntry {
|
|
103
|
+
readonly slot: ThemeColorSlot;
|
|
104
|
+
readonly hex: string;
|
|
105
|
+
}
|
|
106
|
+
/** The theme's two font slots, for resolving `w:rFonts` theme attributes. */
|
|
107
|
+
interface DocumentThemeFonts {
|
|
108
|
+
/** `a:majorFont` latin typeface — headings. */
|
|
109
|
+
readonly major: string | null;
|
|
110
|
+
/** `a:minorFont` latin typeface — body text. */
|
|
111
|
+
readonly minor: string | null;
|
|
112
|
+
}
|
|
113
|
+
|
|
94
114
|
/** One heading of the outline, in document order. `level` is 0-based (Heading 1 = 0). */
|
|
95
115
|
interface DocumentOutlineEntry {
|
|
96
116
|
/** The paragraph's text, control characters flattened, bounded to 200 characters. */
|
|
@@ -142,38 +162,6 @@ interface DocumentSearchResult {
|
|
|
142
162
|
readonly truncated: boolean;
|
|
143
163
|
}
|
|
144
164
|
|
|
145
|
-
/**
|
|
146
|
-
* The scheme slots the picker shows, in Word's column order.
|
|
147
|
-
*
|
|
148
|
-
* Assumes the default `w:clrSchemeMapping` (bg1→lt1, t1→dk1, ...); a settings part
|
|
149
|
-
* that remaps them is rare and a follow-up.
|
|
150
|
-
*/
|
|
151
|
-
declare const PICKER_SLOTS: readonly ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
152
|
-
type ThemeColorSlot = (typeof PICKER_SLOTS)[number];
|
|
153
|
-
/** One theme colour: the scheme slot and its resolved six-digit hex (no '#'). */
|
|
154
|
-
interface DocumentThemeColorEntry {
|
|
155
|
-
readonly slot: ThemeColorSlot;
|
|
156
|
-
readonly hex: string;
|
|
157
|
-
}
|
|
158
|
-
/** The theme's two font slots, for resolving `w:rFonts` theme attributes. */
|
|
159
|
-
interface DocumentThemeFonts {
|
|
160
|
-
/** `a:majorFont` latin typeface — headings. */
|
|
161
|
-
readonly major: string | null;
|
|
162
|
-
/** `a:minorFont` latin typeface — body text. */
|
|
163
|
-
readonly minor: string | null;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/** What a run inherits at one point of the chain — null means "nothing authored". */
|
|
167
|
-
interface StyleRunDefaults {
|
|
168
|
-
readonly fontFamily: string | null;
|
|
169
|
-
readonly fontSizeHalfPoints: number | null;
|
|
170
|
-
}
|
|
171
|
-
/** One run property as the layout records carry it (structurally SurfaceProperty). */
|
|
172
|
-
interface RunPropertyLike {
|
|
173
|
-
readonly localName: string;
|
|
174
|
-
readonly attributes?: Record<string, string>;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
165
|
interface ParagraphAnchorIndex {
|
|
178
166
|
/** nodeId → `w14:paraId`, verbatim as authored/minted. Paragraphs without one are absent. */
|
|
179
167
|
readonly paraIdByNode: ReadonlyMap<string, string>;
|
|
@@ -209,6 +197,17 @@ interface ParagraphAnchorIndex {
|
|
|
209
197
|
readonly claimantsByParaId: ReadonlyMap<string, readonly string[]>;
|
|
210
198
|
}
|
|
211
199
|
|
|
200
|
+
/** What a run inherits at one point of the chain — null means "nothing authored". */
|
|
201
|
+
interface StyleRunDefaults {
|
|
202
|
+
readonly fontFamily: string | null;
|
|
203
|
+
readonly fontSizeHalfPoints: number | null;
|
|
204
|
+
}
|
|
205
|
+
/** One run property as the layout records carry it (structurally SurfaceProperty). */
|
|
206
|
+
interface RunPropertyLike {
|
|
207
|
+
readonly localName: string;
|
|
208
|
+
readonly attributes?: Record<string, string>;
|
|
209
|
+
}
|
|
210
|
+
|
|
212
211
|
/**
|
|
213
212
|
* What applying ops produced: whether it committed, and why not when it did not.
|
|
214
213
|
*
|
|
@@ -570,71 +569,12 @@ interface TreeDocxSessionView {
|
|
|
570
569
|
replaceImage(scope: StoryScope, drawingNodeId: string, bytes: Uint8Array, mime: SupportedImageMime, decodePort: ImageDecodePort, options: ReplaceImageOptions): Promise<ImageIntentResult>;
|
|
571
570
|
/** Delete a picture drawing and collect orphaned media in one package undo unit. */
|
|
572
571
|
deleteImage(scope: StoryScope, drawingNodeId: string): ImageIntentResult;
|
|
572
|
+
/** Propose the drawing's deletion as a tracked change (`w:del`); media stays untouched. */
|
|
573
|
+
deleteImageTracked(scope: StoryScope, drawingNodeId: string, revision: RevisionAttributionInput): ImageIntentResult;
|
|
573
574
|
/** Apply image property tree ops plus hyperlink relationship wiring atomically. */
|
|
574
575
|
applyImageProperties(scope: StoryScope, input: ApplyImagePropertiesInput): ImageIntentResult;
|
|
576
|
+
/** Land a clipboard fragment (resource merge + blocks) as one package undo unit. */
|
|
577
|
+
applyFragmentPaste(scope: StoryScope, input: FragmentPasteInput): FragmentPasteResult;
|
|
575
578
|
}
|
|
576
|
-
/**
|
|
577
|
-
* Binding-only session methods that exchange ProseMirror projections.
|
|
578
|
-
*
|
|
579
|
-
* Editor surfaces expose {@link TreeDocxSessionView}. Only the binding lane sees this extension.
|
|
580
|
-
*/
|
|
581
|
-
interface TreeDocxSession extends TreeDocxSessionView {
|
|
582
|
-
/** Project the current BODY revision into a ProseMirror doc. */
|
|
583
|
-
projectDoc(): Node;
|
|
584
|
-
/** Re-project incrementally from the last committed change, reusing untouched paragraphs. */
|
|
585
|
-
reconcile(previousDoc: Node): Node;
|
|
586
|
-
/**
|
|
587
|
-
* Whether the last commit changed the BLOCK SEQUENCE (a split, join, insert or delete).
|
|
588
|
-
*
|
|
589
|
-
* A host needs this to decide whether the view must be re-projected at all. After a pure
|
|
590
|
-
* text edit, the view already holds what the model holds. Re-projecting wastes work and
|
|
591
|
-
* races the next keystroke.
|
|
592
|
-
*/
|
|
593
|
-
lastCommitWasStructural(): boolean;
|
|
594
|
-
/** Map an edited BODY doc to tree ops and commit them as one transaction. */
|
|
595
|
-
applyPmDoc(doc: Node): TreeApplyResult;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* Why bytes could not be opened: any bounded-reader rejection, plus the package that parsed but
|
|
600
|
-
* carried no main document tree.
|
|
601
|
-
*/
|
|
602
|
-
type TreeSessionRejection = OoxmlPackageRejection | 'no-main-document-tree';
|
|
603
|
-
/**
|
|
604
|
-
* An open session, or a typed refusal.
|
|
605
|
-
*
|
|
606
|
-
* A result rather than a throw: every failure here is a property of the FILE, and a host needs to
|
|
607
|
-
* tell "this is not a package" from "this package is malicious" from "this document has no body".
|
|
608
|
-
*/
|
|
609
|
-
type OpenTreeSessionResult = {
|
|
610
|
-
readonly ok: true;
|
|
611
|
-
readonly session: TreeDocxSession;
|
|
612
|
-
} | {
|
|
613
|
-
readonly ok: false;
|
|
614
|
-
readonly reason: TreeSessionRejection;
|
|
615
|
-
readonly detail?: string;
|
|
616
|
-
};
|
|
617
|
-
interface OpenTreeSessionOptions {
|
|
618
|
-
/**
|
|
619
|
-
* The review module's derivation hooks, contributed through the editor's
|
|
620
|
-
* `EditorModule` seam. Absent — the free engine — the session's
|
|
621
|
-
* `reviewItems()` reports the typed empty queue; parse, preservation, and
|
|
622
|
-
* `hasReviewContent` are unaffected.
|
|
623
|
-
*/
|
|
624
|
-
readonly reviewModel?: ReviewModuleContribution;
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Open DOCX bytes into a tree-backed session.
|
|
628
|
-
*
|
|
629
|
-
* Returns a typed rejection rather than throwing: every failure here is a property of the FILE,
|
|
630
|
-
* and a host needs to tell "this is not a package" from "this package is malicious" from "this
|
|
631
|
-
* document has no body".
|
|
632
|
-
*
|
|
633
|
-
* The read is BOUNDED — decompression ratio, part count, XML depth and element counts are all
|
|
634
|
-
* capped — because the bytes are untrusted by definition.
|
|
635
|
-
*/
|
|
636
|
-
declare function openTreeSession(bytes: Uint8Array, options?: OpenTreeSessionOptions): OpenTreeSessionResult;
|
|
637
|
-
/** The origin a host should use when committing a reconciliation rather than a user edit. */
|
|
638
|
-
declare const PROJECTION_ORIGIN: "dev.docx-editor.core.origin.projection";
|
|
639
579
|
|
|
640
|
-
export { type DocumentStyleEntry as D, type MapResult as M, type
|
|
580
|
+
export { type DocumentStyleEntry as D, type MapResult as M, type TreeDocxSessionView as T, type TreeApplyResult as a, type TreeBindingRejection as b, bodyParagraphs as c, docToTreeOps as d, type DocumentThemeColorEntry as e, partHasNode as p, reconcileDoc as r, treeToDoc as t };
|