@stll/docx-core 0.39.1 → 0.39.2
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/{document-BkGU2ctn.d.ts → document-BWDHON3T.d.ts} +1 -47
- package/dist/{document-oU-dz9zs.js → document-NtScxyHH.js} +18 -36
- package/dist/docx_kernel_bg.wasm +0 -0
- package/dist/{href-2XSCK-T8.js → href-ogmJmncc.js} +2 -4
- package/dist/index.d.ts +1 -27
- package/dist/index.js +19 -35
- package/dist/model/document.d.ts +2 -2
- package/dist/model/document.js +1 -1
- package/dist/ops/documentOps.d.ts +1 -61
- package/dist/ops/documentOps.js +55 -108
- package/dist/{preservedMarkup-G8XjWhs2.d.ts → preservedMarkup-9L4lbGnE.d.ts} +0 -2
- package/dist/projection.d.ts +0 -4
- package/dist/projection.js +2 -4
- package/dist/schema/sequenceChildren.d.ts +1 -5
- package/dist/schema/sequenceChildren.js +1 -1
- package/dist/{sequenceChildren-9SUK1Tm1.js → sequenceChildren-CrMcryEF.js} +2 -4
- package/dist/zip/writeZipPart.d.ts +0 -2
- package/dist/zip/writeZipPart.js +1 -2
- package/package.json +1 -1
package/dist/ops/documentOps.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { M as PARAGRAPH_ALIGNMENTS, et as isNumberingLevel, gt as finalizeParagraphFormatting, o as INSERTION_SEAM_POLICIES, rt as isNumberingReference, s as MAX_REVISION_ID, st as paragraphNumberingReference, t as COMMENT_PART_RELATIONSHIPS, vt as setDocumentBodyComments, yt as getSingularRunPropertyChange } from "../document-
|
|
2
|
-
import { a as hasIllegalXmlCharacters, t as sanitizeExternalUrl } from "../href-
|
|
1
|
+
import { M as PARAGRAPH_ALIGNMENTS, et as isNumberingLevel, gt as finalizeParagraphFormatting, o as INSERTION_SEAM_POLICIES, rt as isNumberingReference, s as MAX_REVISION_ID, st as paragraphNumberingReference, t as COMMENT_PART_RELATIONSHIPS, vt as setDocumentBodyComments, yt as getSingularRunPropertyChange } from "../document-NtScxyHH.js";
|
|
2
|
+
import { a as hasIllegalXmlCharacters, t as sanitizeExternalUrl } from "../href-ogmJmncc.js";
|
|
3
3
|
import { Result, TaggedError, panic } from "better-result";
|
|
4
4
|
import { encodeUtf8 } from "@stll/utf8-boundaries";
|
|
5
|
-
|
|
5
|
+
// src/ops/equality.ts
|
|
6
6
|
const NOTHING = /* @__PURE__ */ new Set();
|
|
7
7
|
const equal = (left, right, skipped) => {
|
|
8
8
|
if (Object.is(left, right)) return true;
|
|
@@ -36,8 +36,7 @@ const derivedFields = (entries) => entries.some(([key, value]) => key === "type"
|
|
|
36
36
|
* numbering or pagination was recomputed since.
|
|
37
37
|
*/
|
|
38
38
|
const equalForStaleness = (left, right) => equal(left, right, derivedFields);
|
|
39
|
-
|
|
40
|
-
//#region src/ops/refusal.ts
|
|
39
|
+
// src/ops/refusal.ts
|
|
41
40
|
const DocumentOpRefusalBase = TaggedError("DocumentOpRefusal");
|
|
42
41
|
/**
|
|
43
42
|
* Why an operation was not applied. A refused operation changes nothing: the
|
|
@@ -139,8 +138,7 @@ const DOCUMENT_OP_REFUSAL_REASONS = Object.freeze({
|
|
|
139
138
|
});
|
|
140
139
|
/** An operation the document cannot take as stated. */
|
|
141
140
|
var DocumentOpRefusal = class extends DocumentOpRefusalBase {};
|
|
142
|
-
|
|
143
|
-
//#region src/ops/paragraphPropertySnapshot.ts
|
|
141
|
+
// src/ops/paragraphPropertySnapshot.ts
|
|
144
142
|
const snapshots = /* @__PURE__ */ new WeakMap();
|
|
145
143
|
/** Bind effective formatting to the authored properties a review must record. */
|
|
146
144
|
const registerParagraphPropertySnapshot = ({ paragraph, snapshot }) => {
|
|
@@ -161,8 +159,7 @@ const getParagraphPropertySnapshot = (paragraph) => {
|
|
|
161
159
|
const registered = snapshots.get(paragraph);
|
|
162
160
|
return registered !== void 0 && structurallyEqual(paragraph.formatting, registered.effective) ? registered.snapshot : paragraph.formatting;
|
|
163
161
|
};
|
|
164
|
-
|
|
165
|
-
//#region src/ops/modelClone.ts
|
|
162
|
+
// src/ops/modelClone.ts
|
|
166
163
|
const copyPrivateBindings = ({ source, target, seen }) => {
|
|
167
164
|
if (typeof source !== "object" || source === null || typeof target !== "object" || target === null || seen.has(source)) return;
|
|
168
165
|
seen.add(source);
|
|
@@ -225,8 +222,7 @@ const cloneModel = (value) => {
|
|
|
225
222
|
});
|
|
226
223
|
return cloned;
|
|
227
224
|
};
|
|
228
|
-
|
|
229
|
-
//#region src/ops/wire.ts
|
|
225
|
+
// src/ops/wire.ts
|
|
230
226
|
const PRESENCE_FIELD = "undefinedFields";
|
|
231
227
|
const RESERVED_SEGMENTS = /* @__PURE__ */ new Set([
|
|
232
228
|
"__proto__",
|
|
@@ -297,8 +293,7 @@ const restoreDocumentOp = (op) => {
|
|
|
297
293
|
delete restored.undefinedFields;
|
|
298
294
|
return Result.ok(restored);
|
|
299
295
|
};
|
|
300
|
-
|
|
301
|
-
//#region src/ops/types.ts
|
|
296
|
+
// src/ops/types.ts
|
|
302
297
|
/**
|
|
303
298
|
* The operation schema this module reads and writes.
|
|
304
299
|
*
|
|
@@ -420,8 +415,7 @@ const toOpEnvelope = (op) => ({
|
|
|
420
415
|
schema: 10,
|
|
421
416
|
op: captureDocumentOp(op)
|
|
422
417
|
});
|
|
423
|
-
|
|
424
|
-
//#region src/ops/stories.ts
|
|
418
|
+
// src/ops/stories.ts
|
|
425
419
|
/** Stable package-story addressing, shared by operations and editor projections. */
|
|
426
420
|
const sameStory = (left, right) => {
|
|
427
421
|
if (left === OP_STORIES.MAIN || right === OP_STORIES.MAIN) return left === right;
|
|
@@ -553,8 +547,7 @@ const replaceStoryBody = ({ document, story, body }) => {
|
|
|
553
547
|
default: return story;
|
|
554
548
|
}
|
|
555
549
|
};
|
|
556
|
-
|
|
557
|
-
//#region src/ops/blocks.ts
|
|
550
|
+
// src/ops/blocks.ts
|
|
558
551
|
/**
|
|
559
552
|
* Finding and replacing paragraphs in a story.
|
|
560
553
|
*
|
|
@@ -966,8 +959,7 @@ const replaceParagraphs = ({ document, story, at, count, replacement, restoreSec
|
|
|
966
959
|
body: nextBody
|
|
967
960
|
}));
|
|
968
961
|
};
|
|
969
|
-
|
|
970
|
-
//#region src/ops/offsets.ts
|
|
962
|
+
// src/ops/offsets.ts
|
|
971
963
|
/**
|
|
972
964
|
* A paragraph's logical offset space.
|
|
973
965
|
*
|
|
@@ -1230,8 +1222,7 @@ const withChildren = (container, items) => {
|
|
|
1230
1222
|
default: return container;
|
|
1231
1223
|
}
|
|
1232
1224
|
};
|
|
1233
|
-
|
|
1234
|
-
//#region src/ops/ids.ts
|
|
1225
|
+
// src/ops/ids.ts
|
|
1235
1226
|
const isPlainRecord = (value) => {
|
|
1236
1227
|
const prototype = Object.getPrototypeOf(value);
|
|
1237
1228
|
return prototype === Object.prototype || prototype === null;
|
|
@@ -1460,8 +1451,7 @@ const reservedIdentityKeysIn = (value) => {
|
|
|
1460
1451
|
};
|
|
1461
1452
|
/** Every revision and content-control id of a package, each story walked once. */
|
|
1462
1453
|
const packageIdentityKeys = (pkg) => identityKeysIn(storiesOf(pkg));
|
|
1463
|
-
|
|
1464
|
-
//#region src/ops/slots.ts
|
|
1454
|
+
// src/ops/slots.ts
|
|
1465
1455
|
const revision$1 = (id) => ({
|
|
1466
1456
|
space: IDENTITY_SPACES.REVISION,
|
|
1467
1457
|
id
|
|
@@ -1557,8 +1547,7 @@ const maskIdentity = (node) => {
|
|
|
1557
1547
|
const slots = identitySlots(node);
|
|
1558
1548
|
return slots.length === 0 ? node : withInlineIdentity(node, slots.map(() => 0));
|
|
1559
1549
|
};
|
|
1560
|
-
|
|
1561
|
-
//#region src/ops/leaves.ts
|
|
1550
|
+
// src/ops/leaves.ts
|
|
1562
1551
|
/**
|
|
1563
1552
|
* A paragraph's content as a sequence of leaves, and the three moves every
|
|
1564
1553
|
* edit is made of: partition the leaves between gaps, find the records that
|
|
@@ -2350,8 +2339,7 @@ const rejectCopyOriginAncestorsInNodes = (nodes, removedAddedAncestors) => {
|
|
|
2350
2339
|
};
|
|
2351
2340
|
return visit(nodes, removedAddedAncestors);
|
|
2352
2341
|
};
|
|
2353
|
-
|
|
2354
|
-
//#region src/ops/noteMarks.ts
|
|
2342
|
+
// src/ops/noteMarks.ts
|
|
2355
2343
|
const noteContentWithAutomaticMark = ({ note, customMark }) => {
|
|
2356
2344
|
if (customMark || note.noteType !== void 0 && note.noteType !== "normal") return note.content;
|
|
2357
2345
|
const paragraphs = storyParagraphs({ content: note.content });
|
|
@@ -2389,8 +2377,7 @@ const removedNoteStories = (before, after) => {
|
|
|
2389
2377
|
};
|
|
2390
2378
|
});
|
|
2391
2379
|
};
|
|
2392
|
-
|
|
2393
|
-
//#region src/ops/contract.ts
|
|
2380
|
+
// src/ops/contract.ts
|
|
2394
2381
|
/**
|
|
2395
2382
|
* The seed contract: what a document must be for operations to apply to it.
|
|
2396
2383
|
*
|
|
@@ -2601,8 +2588,7 @@ const normalizeForOps = (document) => {
|
|
|
2601
2588
|
}
|
|
2602
2589
|
return current;
|
|
2603
2590
|
};
|
|
2604
|
-
|
|
2605
|
-
//#region src/ops/patch.ts
|
|
2591
|
+
// src/ops/patch.ts
|
|
2606
2592
|
/**
|
|
2607
2593
|
* A property set with a patch applied: a value (including explicit undefined)
|
|
2608
2594
|
* sets its key, null removes it, and an absent key is untouched. The input is
|
|
@@ -2623,8 +2609,7 @@ const priorValues = (base, patch) => {
|
|
|
2623
2609
|
for (const key of Object.keys(patch)) Reflect.set(restore, key, base !== void 0 && Object.hasOwn(base, key) ? Reflect.get(base, key) : null);
|
|
2624
2610
|
return restore;
|
|
2625
2611
|
};
|
|
2626
|
-
|
|
2627
|
-
//#region src/ops/comments.ts
|
|
2612
|
+
// src/ops/comments.ts
|
|
2628
2613
|
/** Semantic comment definitions and anchors, with narrow exact-state inverses. */
|
|
2629
2614
|
const fail = (op, message, reason = DOCUMENT_OP_REFUSAL_REASONS.STRUCTURE_MISMATCH) => Result.err(new DocumentOpRefusal({
|
|
2630
2615
|
opType: op.type,
|
|
@@ -3362,8 +3347,7 @@ const applyCommentOp = (document, op, applyOps) => {
|
|
|
3362
3347
|
}
|
|
3363
3348
|
return edited(document, withComments(current, comments.filter(({ id }) => !ids.has(id)), comments.every(({ id }) => ids.has(id)) ? "absent" : "present"), op, ids);
|
|
3364
3349
|
};
|
|
3365
|
-
|
|
3366
|
-
//#region src/ops/storyLifecycle.ts
|
|
3350
|
+
// src/ops/storyLifecycle.ts
|
|
3367
3351
|
/** Explicit story lifecycle and section property edits, with exact JSON-safe inverses. */
|
|
3368
3352
|
const refuse$5 = (op, message) => Result.err(new DocumentOpRefusal({
|
|
3369
3353
|
opType: op.type,
|
|
@@ -3811,8 +3795,7 @@ const applyStoryLifecycle = (document, op) => {
|
|
|
3811
3795
|
}
|
|
3812
3796
|
return storyLifecycleEdit(document, next, op);
|
|
3813
3797
|
};
|
|
3814
|
-
|
|
3815
|
-
//#region src/ops/review.ts
|
|
3798
|
+
// src/ops/review.ts
|
|
3816
3799
|
/**
|
|
3817
3800
|
* Tracked changes: how an operation carrying a {@link RevisionStamp} records
|
|
3818
3801
|
* its edit instead of making it, and the pieces resolution shares with it.
|
|
@@ -4231,8 +4214,7 @@ const wrapTracked = ({ items, from, to, kind, stamp, resolutionJoin, acceptance,
|
|
|
4231
4214
|
content: out
|
|
4232
4215
|
};
|
|
4233
4216
|
};
|
|
4234
|
-
|
|
4235
|
-
//#region src/ops/identity.ts
|
|
4217
|
+
// src/ops/identity.ts
|
|
4236
4218
|
/**
|
|
4237
4219
|
* How an edit keeps the ids of identified records unique (see `slots.ts`).
|
|
4238
4220
|
*
|
|
@@ -4674,8 +4656,7 @@ const freshenIdentities = ({ before, after, newIds, usedElsewhere, inserted = /*
|
|
|
4674
4656
|
id: invalid
|
|
4675
4657
|
};
|
|
4676
4658
|
};
|
|
4677
|
-
|
|
4678
|
-
//#region src/ops/rangeBoundaries.ts
|
|
4659
|
+
// src/ops/rangeBoundaries.ts
|
|
4679
4660
|
/**
|
|
4680
4661
|
* Range boundaries in content a resolution removes.
|
|
4681
4662
|
*
|
|
@@ -5160,8 +5141,7 @@ const wellFormedRanges = ({ contents, order, relocated }) => {
|
|
|
5160
5141
|
}
|
|
5161
5142
|
return changed;
|
|
5162
5143
|
};
|
|
5163
|
-
|
|
5164
|
-
//#region src/ops/blockDeletion.ts
|
|
5144
|
+
// src/ops/blockDeletion.ts
|
|
5165
5145
|
/** Whole-paragraph deletion within one block list, including its final paragraph. */
|
|
5166
5146
|
/**
|
|
5167
5147
|
* One paragraph's content as its tracked deletion leaves it: every leaf
|
|
@@ -5414,8 +5394,7 @@ const deleteBlocks = ({ document, op, applyOps }) => {
|
|
|
5414
5394
|
default: return fresh;
|
|
5415
5395
|
}
|
|
5416
5396
|
};
|
|
5417
|
-
|
|
5418
|
-
//#region src/ops/blockInsertion.ts
|
|
5397
|
+
// src/ops/blockInsertion.ts
|
|
5419
5398
|
/** Paragraph insertion, isolated from the inline and table operation implementations. */
|
|
5420
5399
|
const insertBlocks = ({ document, op, applyOps }) => {
|
|
5421
5400
|
const refuse = (reason, message) => Result.err(new DocumentOpRefusal({
|
|
@@ -5511,8 +5490,7 @@ const insertBlocks = ({ document, op, applyOps }) => {
|
|
|
5511
5490
|
default: return fresh;
|
|
5512
5491
|
}
|
|
5513
5492
|
};
|
|
5514
|
-
|
|
5515
|
-
//#region src/ops/edits.ts
|
|
5493
|
+
// src/ops/edits.ts
|
|
5516
5494
|
const TOUCHED_STATES = [
|
|
5517
5495
|
"modified",
|
|
5518
5496
|
"inserted",
|
|
@@ -5556,8 +5534,7 @@ const combineEdits = (document, edits) => {
|
|
|
5556
5534
|
}
|
|
5557
5535
|
};
|
|
5558
5536
|
};
|
|
5559
|
-
|
|
5560
|
-
//#region src/ops/gaps.ts
|
|
5537
|
+
// src/ops/gaps.ts
|
|
5561
5538
|
const isHighSurrogate = (code) => code >= 55296 && code <= 56319;
|
|
5562
5539
|
const isLowSurrogate = (code) => code >= 56320 && code <= 57343;
|
|
5563
5540
|
const resolveGap = ({ paragraph, position, fallback }) => {
|
|
@@ -5583,8 +5560,7 @@ const resolveGap = ({ paragraph, position, fallback }) => {
|
|
|
5583
5560
|
default: return fallback;
|
|
5584
5561
|
}
|
|
5585
5562
|
};
|
|
5586
|
-
|
|
5587
|
-
//#region src/ops/runMerge.ts
|
|
5563
|
+
// src/ops/runMerge.ts
|
|
5588
5564
|
/**
|
|
5589
5565
|
* Check if two TextFormatting objects are equivalent
|
|
5590
5566
|
*
|
|
@@ -5758,8 +5734,7 @@ function mergeRunContent(content1, content2) {
|
|
|
5758
5734
|
} else for (const c of content2) result.push(c);
|
|
5759
5735
|
return result;
|
|
5760
5736
|
}
|
|
5761
|
-
|
|
5762
|
-
//#region src/ops/inline.ts
|
|
5737
|
+
// src/ops/inline.ts
|
|
5763
5738
|
/**
|
|
5764
5739
|
* Edits over a paragraph's content in its logical offset space.
|
|
5765
5740
|
*
|
|
@@ -6225,8 +6200,7 @@ const patchRunsBetween = (items, from, to, patch, whenEmpty, decorate) => {
|
|
|
6225
6200
|
}))
|
|
6226
6201
|
};
|
|
6227
6202
|
};
|
|
6228
|
-
|
|
6229
|
-
//#region src/ops/numberingSections.ts
|
|
6203
|
+
// src/ops/numberingSections.ts
|
|
6230
6204
|
const failed = (op, reason, message) => Result.err(new DocumentOpRefusal({
|
|
6231
6205
|
message,
|
|
6232
6206
|
reason,
|
|
@@ -6481,8 +6455,7 @@ const applyNumberingSectionOp = (document, op) => {
|
|
|
6481
6455
|
default: return op;
|
|
6482
6456
|
}
|
|
6483
6457
|
};
|
|
6484
|
-
|
|
6485
|
-
//#region src/ops/packageResources.ts
|
|
6458
|
+
// src/ops/packageResources.ts
|
|
6486
6459
|
const partOf = (present, value) => {
|
|
6487
6460
|
if (!present) return { type: "omitted" };
|
|
6488
6461
|
return value === void 0 ? { type: "undefined" } : {
|
|
@@ -6772,16 +6745,14 @@ const applyPackageResourcesOp = (document, op) => {
|
|
|
6772
6745
|
}
|
|
6773
6746
|
});
|
|
6774
6747
|
};
|
|
6775
|
-
|
|
6776
|
-
//#region src/model/tableCellVerticalMerge.ts
|
|
6748
|
+
// src/model/tableCellVerticalMerge.ts
|
|
6777
6749
|
const TABLE_CELL_VERTICAL_MERGES = {
|
|
6778
6750
|
NONE: "none",
|
|
6779
6751
|
RESTART: "restart",
|
|
6780
6752
|
CONTINUE: "continue"
|
|
6781
6753
|
};
|
|
6782
6754
|
const tableCellVerticalMerge = (value) => value ?? TABLE_CELL_VERTICAL_MERGES.NONE;
|
|
6783
|
-
|
|
6784
|
-
//#region src/ops/tableGrid.ts
|
|
6755
|
+
// src/ops/tableGrid.ts
|
|
6785
6756
|
/** Logical slots, including omitted cells and vertical continuation ownership. */
|
|
6786
6757
|
const nonnegative = (value) => Number.isSafeInteger(value) && value >= 0;
|
|
6787
6758
|
/** Each row covers one common grid; continuations exactly match the preceding span. */
|
|
@@ -6839,8 +6810,7 @@ const tableGrid = (table, opType) => {
|
|
|
6839
6810
|
rows
|
|
6840
6811
|
});
|
|
6841
6812
|
};
|
|
6842
|
-
|
|
6843
|
-
//#region src/ops/tableLocation.ts
|
|
6813
|
+
// src/ops/tableLocation.ts
|
|
6844
6814
|
/** Shared addressing for row and whole-table operations. */
|
|
6845
6815
|
/** A paragraph selects its innermost table, even through block wrappers. */
|
|
6846
6816
|
const locateTableRow = (document, op) => {
|
|
@@ -6874,8 +6844,7 @@ const tableRowAnchor = (rows) => storyParagraphs({ content: [{
|
|
|
6874
6844
|
type: "table",
|
|
6875
6845
|
rows: [...rows]
|
|
6876
6846
|
}] }).find(({ list }) => list.filter((step) => step.kind === "tableCell").length === 1)?.paragraph.paraId;
|
|
6877
|
-
|
|
6878
|
-
//#region src/ops/resolveTableRows.ts
|
|
6847
|
+
// src/ops/resolveTableRows.ts
|
|
6879
6848
|
/** Table-level review after inline changes, before paragraph-mark joins. */
|
|
6880
6849
|
const collectTables = (blocks, out) => {
|
|
6881
6850
|
for (const block of blocks) switch (block.type) {
|
|
@@ -7342,8 +7311,7 @@ const reachableOnTable = (table) => /* @__PURE__ */ new Set([
|
|
|
7342
7311
|
...row.cells.flatMap((cell) => [...propertyIds(cell.propertyChanges), ...cellStructuralIds(cell)])
|
|
7343
7312
|
])
|
|
7344
7313
|
]);
|
|
7345
|
-
|
|
7346
|
-
//#region src/ops/resolve.ts
|
|
7314
|
+
// src/ops/resolve.ts
|
|
7347
7315
|
/**
|
|
7348
7316
|
* `resolveRevision`: accepting or rejecting tracked changes, expanded to the
|
|
7349
7317
|
* primitive operations that carry it out.
|
|
@@ -8780,8 +8748,7 @@ const resolveRevision = (document, op, applyOps) => planRevisionResolution({
|
|
|
8780
8748
|
op,
|
|
8781
8749
|
applyOps
|
|
8782
8750
|
}).map(({ edit }) => edit);
|
|
8783
|
-
|
|
8784
|
-
//#region src/ops/tableEditBoundary.ts
|
|
8751
|
+
// src/ops/tableEditBoundary.ts
|
|
8785
8752
|
/** Validate untyped table edits before reading fields or revision stamps. */
|
|
8786
8753
|
const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8787
8754
|
const tableSnapshot = (value) => {
|
|
@@ -8843,8 +8810,7 @@ const tableEditBoundaryRefusal = (op) => {
|
|
|
8843
8810
|
if (ids.some((id) => !Number.isInteger(id) || id < 0 || id > 2147483647)) return fail(DOCUMENT_OP_REFUSAL_REASONS.INVALID_NEW_ID, "Revision ids must be nonnegative 31-bit integers.");
|
|
8844
8811
|
if (new Set(ids).size !== ids.length) return fail(DOCUMENT_OP_REFUSAL_REASONS.ID_COLLISION, "Revision ids must be distinct within the operation.");
|
|
8845
8812
|
};
|
|
8846
|
-
|
|
8847
|
-
//#region src/ops/tableEditDependencies.ts
|
|
8813
|
+
// src/ops/tableEditDependencies.ts
|
|
8848
8814
|
/** Content removed with a cell may own records outside that cell. */
|
|
8849
8815
|
const DEPENDENT_TYPES = /* @__PURE__ */ new Set([
|
|
8850
8816
|
"commentRangeStart",
|
|
@@ -8878,8 +8844,7 @@ const hasTableCellDependencies = (value) => {
|
|
|
8878
8844
|
}
|
|
8879
8845
|
return false;
|
|
8880
8846
|
};
|
|
8881
|
-
|
|
8882
|
-
//#region src/ops/tableTracking.ts
|
|
8847
|
+
// src/ops/tableTracking.ts
|
|
8883
8848
|
/** Shared tracked construction for table rows and whole tables. */
|
|
8884
8849
|
const refused$1 = ({ op, reason, message }) => Result.err(new DocumentOpRefusal({
|
|
8885
8850
|
opType: op.type,
|
|
@@ -9177,8 +9142,7 @@ const stampedTableRevisionIds = ({ blocks, stamp, known }) => {
|
|
|
9177
9142
|
visit(blocks);
|
|
9178
9143
|
return out;
|
|
9179
9144
|
};
|
|
9180
|
-
|
|
9181
|
-
//#region src/ops/tables.ts
|
|
9145
|
+
// src/ops/tables.ts
|
|
9182
9146
|
/** Whole-table edits and their exact structural inverse. */
|
|
9183
9147
|
const refuse$4 = ({ op, reason, message }) => Result.err(new DocumentOpRefusal({
|
|
9184
9148
|
opType: op.type,
|
|
@@ -9566,8 +9530,7 @@ const applyTableOp = (document, op) => {
|
|
|
9566
9530
|
default: return op;
|
|
9567
9531
|
}
|
|
9568
9532
|
};
|
|
9569
|
-
|
|
9570
|
-
//#region src/ops/tableEdits.ts
|
|
9533
|
+
// src/ops/tableEdits.ts
|
|
9571
9534
|
/** Semantic grid/cell/property edits; one exact, stale-checked table inverse. */
|
|
9572
9535
|
const CELL_VERTICAL_MERGES = {
|
|
9573
9536
|
RESTART: "restart",
|
|
@@ -10436,8 +10399,7 @@ const applyTableEdit = (document, op) => {
|
|
|
10436
10399
|
table: changed.value
|
|
10437
10400
|
});
|
|
10438
10401
|
};
|
|
10439
|
-
|
|
10440
|
-
//#region src/ops/tableRows.ts
|
|
10402
|
+
// src/ops/tableRows.ts
|
|
10441
10403
|
/** Row edits and their exact inverse, addressed through a paragraph in the row. */
|
|
10442
10404
|
const refused = ({ op, reason, message }) => Result.err(new DocumentOpRefusal({
|
|
10443
10405
|
opType: op.type,
|
|
@@ -10673,8 +10635,7 @@ const applyRowOp = (document, op) => {
|
|
|
10673
10635
|
default: return op;
|
|
10674
10636
|
}
|
|
10675
10637
|
};
|
|
10676
|
-
|
|
10677
|
-
//#region src/ops/apply.ts
|
|
10638
|
+
// src/ops/apply.ts
|
|
10678
10639
|
/**
|
|
10679
10640
|
* Apply a document operation and record its exact inverse.
|
|
10680
10641
|
*
|
|
@@ -12219,8 +12180,7 @@ const applyDocumentOps = (document, ops) => {
|
|
|
12219
12180
|
revisions
|
|
12220
12181
|
});
|
|
12221
12182
|
};
|
|
12222
|
-
|
|
12223
|
-
//#region src/ops/tocIntent.ts
|
|
12183
|
+
// src/ops/tocIntent.ts
|
|
12224
12184
|
const refuse$1 = (message, reason = DOCUMENT_OP_REFUSAL_REASONS.UNTRACKABLE) => Result.err(new DocumentOpRefusal({
|
|
12225
12185
|
message,
|
|
12226
12186
|
reason,
|
|
@@ -12531,8 +12491,7 @@ const compileGenerateTOCIntent = (document, intent, mode) => {
|
|
|
12531
12491
|
}
|
|
12532
12492
|
});
|
|
12533
12493
|
};
|
|
12534
|
-
|
|
12535
|
-
//#region src/ops/editorIntentCensus.ts
|
|
12494
|
+
// src/ops/editorIntentCensus.ts
|
|
12536
12495
|
const sameFieldsExcept = (before, after, excluded) => {
|
|
12537
12496
|
const beforeFields = Object.entries(before).filter(([key]) => !excluded.has(key));
|
|
12538
12497
|
const afterFields = new Map(Object.entries(after).filter(([key]) => !excluded.has(key)));
|
|
@@ -12619,8 +12578,7 @@ const createCensusReader = () => {
|
|
|
12619
12578
|
return version.census;
|
|
12620
12579
|
};
|
|
12621
12580
|
};
|
|
12622
|
-
|
|
12623
|
-
//#region src/ops/plan.ts
|
|
12581
|
+
// src/ops/plan.ts
|
|
12624
12582
|
/**
|
|
12625
12583
|
* Pure planning around tracked operations: how many new revision ids an
|
|
12626
12584
|
* operation takes, and the operations a tracked deletion of a range is made
|
|
@@ -13155,8 +13113,7 @@ const planTrackedDeletion = (document, options) => {
|
|
|
13155
13113
|
});
|
|
13156
13114
|
return appended.isErr() ? Result.err(appended.error) : Result.ok(plan.ops);
|
|
13157
13115
|
};
|
|
13158
|
-
|
|
13159
|
-
//#region src/ops/hyperlinkIntent.ts
|
|
13116
|
+
// src/ops/hyperlinkIntent.ts
|
|
13160
13117
|
const refuse = (message, reason = DOCUMENT_OP_REFUSAL_REASONS.UNTRACKABLE) => Result.err(new DocumentOpRefusal({
|
|
13161
13118
|
message,
|
|
13162
13119
|
reason,
|
|
@@ -13350,8 +13307,7 @@ const compileHyperlinkIntent = (document, { intent: sourceIntent, mode, compileE
|
|
|
13350
13307
|
selection: intent.to
|
|
13351
13308
|
});
|
|
13352
13309
|
};
|
|
13353
|
-
|
|
13354
|
-
//#region src/ops/rangeReplacement.ts
|
|
13310
|
+
// src/ops/rangeReplacement.ts
|
|
13355
13311
|
/** Tracked replacement fragments share deletion's validation and physical-id pool. */
|
|
13356
13312
|
/** Own inserted marks can be cancelled, moving the prefix to its next live paragraph. */
|
|
13357
13313
|
const rangeStartAfterDeletion = ({ before, after, from, to }) => {
|
|
@@ -13484,8 +13440,7 @@ const planTrackedReplace = (document, options) => {
|
|
|
13484
13440
|
}
|
|
13485
13441
|
return Result.ok(plan.ops);
|
|
13486
13442
|
};
|
|
13487
|
-
|
|
13488
|
-
//#region src/ops/editorIntent.ts
|
|
13443
|
+
// src/ops/editorIntent.ts
|
|
13489
13444
|
/** One editor intent, compiled to direct or tracked document operations. */
|
|
13490
13445
|
const intentEndpoints = (intent) => {
|
|
13491
13446
|
switch (intent.type) {
|
|
@@ -15191,15 +15146,13 @@ const compileEditorIntent = (document, { intent, mode, firstBlockId }) => {
|
|
|
15191
15146
|
selection
|
|
15192
15147
|
});
|
|
15193
15148
|
};
|
|
15194
|
-
|
|
15195
|
-
//#region src/ops/sequencing/address.ts
|
|
15149
|
+
// src/ops/sequencing/address.ts
|
|
15196
15150
|
const DECLARED_STORIES = Object.values(OP_STORIES);
|
|
15197
15151
|
/** Compare story identities without depending on their representation. */
|
|
15198
15152
|
const sameStory$1 = (left, right) => structurallyEqual(left, right);
|
|
15199
15153
|
/** The wire decoder accepts only stories declared by the operation contract. */
|
|
15200
15154
|
const isOpStory = (value) => DECLARED_STORIES.some((story) => structurallyEqual(story, value));
|
|
15201
|
-
|
|
15202
|
-
//#region src/ops/sequencing/envelope.ts
|
|
15155
|
+
// src/ops/sequencing/envelope.ts
|
|
15203
15156
|
/** An operation with no position or structural effect. */
|
|
15204
15157
|
const NO_SEQUENCED_EFFECT = "none";
|
|
15205
15158
|
const BATCH_REJECTION_REASONS = {
|
|
@@ -15689,8 +15642,7 @@ const parseDocumentBatch = (json) => {
|
|
|
15689
15642
|
}));
|
|
15690
15643
|
return validateDocumentBatch(parsed.value);
|
|
15691
15644
|
};
|
|
15692
|
-
|
|
15693
|
-
//#region src/ops/sequencing/transform.ts
|
|
15645
|
+
// src/ops/sequencing/transform.ts
|
|
15694
15646
|
const operationStory = (op) => {
|
|
15695
15647
|
switch (op.type) {
|
|
15696
15648
|
case DOCUMENT_OP_TYPES.INSERT_TEXT:
|
|
@@ -16044,8 +15996,7 @@ const transformBatch = (batch, over, options = {}) => {
|
|
|
16044
15996
|
ops: captured
|
|
16045
15997
|
});
|
|
16046
15998
|
};
|
|
16047
|
-
|
|
16048
|
-
//#region src/ops/sequencing/applyBatch.ts
|
|
15999
|
+
// src/ops/sequencing/applyBatch.ts
|
|
16049
16000
|
const TOUCHED_BLOCKS_EFFECT = "touchedBlocks";
|
|
16050
16001
|
/** Capture position facts before each operation, including within an atomic batch. */
|
|
16051
16002
|
const applyBatch = (document, ops) => {
|
|
@@ -16091,8 +16042,7 @@ const applyBatch = (document, ops) => {
|
|
|
16091
16042
|
effects
|
|
16092
16043
|
});
|
|
16093
16044
|
};
|
|
16094
|
-
|
|
16095
|
-
//#region src/ops/sequencing/sequencer.ts
|
|
16045
|
+
// src/ops/sequencing/sequencer.ts
|
|
16096
16046
|
const SUBMISSION_TYPES = {
|
|
16097
16047
|
ACK: "ack",
|
|
16098
16048
|
REJECT: "reject"
|
|
@@ -16180,8 +16130,7 @@ const createSequencer = (document) => {
|
|
|
16180
16130
|
}
|
|
16181
16131
|
};
|
|
16182
16132
|
};
|
|
16183
|
-
|
|
16184
|
-
//#region src/ops/sequencing/client.ts
|
|
16133
|
+
// src/ops/sequencing/client.ts
|
|
16185
16134
|
const PENDING_STATUSES = {
|
|
16186
16135
|
QUEUED: "queued",
|
|
16187
16136
|
SUBMITTED: "submitted",
|
|
@@ -16464,8 +16413,7 @@ const createClient = (document) => {
|
|
|
16464
16413
|
}
|
|
16465
16414
|
};
|
|
16466
16415
|
};
|
|
16467
|
-
|
|
16468
|
-
//#region src/ops/batchOrder.ts
|
|
16416
|
+
// src/ops/batchOrder.ts
|
|
16469
16417
|
const PHASE = {
|
|
16470
16418
|
annotation: 0,
|
|
16471
16419
|
content: 1,
|
|
@@ -16532,5 +16480,4 @@ const groupInsertionRuns = (operations, insertionPositionOf, keepsGap = () => fa
|
|
|
16532
16480
|
}
|
|
16533
16481
|
return groups;
|
|
16534
16482
|
};
|
|
16535
|
-
//#endregion
|
|
16536
16483
|
export { BATCH_REJECTION_REASONS, BATCH_WIRE_OP_TYPES, BatchRejection, DOCUMENT_OP_REFUSAL_REASONS, DOCUMENT_OP_SCHEMA_VERSION, DOCUMENT_OP_TYPES, DocumentOpRefusal, DocumentOpsContractError, EMPTY_PROPERTY_SETS, INHERIT_RUN_PROPS, MAX_BATCH_WIRE_BYTES, OBJECT_REPLACEMENT_CHARACTER, OP_STORIES, PARAGRAPH_MARK_FORMATTING_KEYS, PROPERTY_REVIEW_POLICIES, REVISION_DECISIONS, SPLIT_HALVES, acceptCopyOriginAncestors, addCopyOriginAncestor, allocateCommentAnchorIds, applyDocumentOp, applyDocumentOpEnvelope, applyDocumentOps, captureDocumentOp, combineEdits, commentDocumentIssue, compareBatchOrder, compareGaps, compileEditorIntent, contentRank, createClient, createEditorIntentIdAllocator, createSequencer, defaultInsertionGap, documentStories, editorParagraphGroups, editorPositionAtPhysicalPosition, findStoryBody, formattingEquals, freshCommentId, groupInsertionRuns, idKey, inlineLeafSpans, isCommentAnchorCarrierType, isCommentExhausted, isCopyOriginAncestors, isTextOnlyRun, mapTocBookmarkPosition, mergeRunContent, normalizeForOps, noteUsesCustomMark, orderBatchOperations, packageParagraphIds, packageResourcesOpOf, paragraphContentVerdict, paragraphIdsIn, paragraphLength, paragraphLogicalText, paragraphMarkOutcome, paragraphRemains, paragraphVisibleText, parseDocumentBatch, physicalOffsetAtVisibleOffset, physicalPositionAtEditorOffset, planTrackedDeletion, planTrackedReplace, planWellFormedRanges, reconcileDocumentPartRelationships, registerParagraphPropertySnapshot, rejectCopyOriginAncestors, revisionIdDemand, runsMergeable, sameStory, sectionPropertiesAt, shiftCopyOriginAncestors, storyBody, survivingComments, toOpEnvelope, transformBatch, validateDocumentBatch, validateOpsDocument, validateSequencedBatch, withBodyContent, withoutCommentThreads, zeroWidthLeavesAt };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/model/preservedMarkup.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* The ordered verbatim sink: where a container's unmodelled markup goes.
|
|
4
3
|
*
|
|
@@ -64,5 +63,4 @@ type PreservedAttribute = {
|
|
|
64
63
|
name: string;
|
|
65
64
|
value: string;
|
|
66
65
|
};
|
|
67
|
-
//#endregion
|
|
68
66
|
export { PreservedChild as n, PreservedMarkup as r, PreservedAttribute as t };
|
package/dist/projection.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TaggedErrorClass } from "better-result";
|
|
2
|
-
//#region src/generated/docx_kernel.d.ts
|
|
3
2
|
/* tslint:disable */
|
|
4
3
|
/* eslint-disable */
|
|
5
4
|
type DocxProjectionFormattingSpan = readonly [startUtf16: number, endUtf16: number, style: "bold" | "highlight" | "superscript"];
|
|
@@ -44,8 +43,6 @@ type DocxReviewFactsWire = readonly [schemaVersion: 2, revisions: DocxReviewFact
|
|
|
44
43
|
/** Fused package wire schema. A new tuple layout requires a schema-version bump. */
|
|
45
44
|
type DocxPackageProjectionWire = readonly [schemaVersion: 2, document: DocxProjectionWire, reviewFacts: DocxReviewFactsWire];
|
|
46
45
|
type DocxProjectionContainer = "body" | "tableCell";
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region src/projection.d.ts
|
|
49
46
|
declare const DocxProjectionInitializationErrorBase: TaggedErrorClass<"DocxProjectionInitializationError">;
|
|
50
47
|
export declare class DocxProjectionInitializationError extends DocxProjectionInitializationErrorBase<{
|
|
51
48
|
message: string;
|
|
@@ -84,5 +81,4 @@ export declare const projectParagraphFragment: (bytes: Uint8Array) => Promise<Do
|
|
|
84
81
|
* fact families rather than invalidating the document snapshot.
|
|
85
82
|
*/
|
|
86
83
|
export declare const projectCompressedDocxWithReviewFacts: (bytes: Uint8Array, { textMaterialization }?: ProjectCompressedDocxWithReviewFactsOptions) => Promise<DocxPackageProjectionWire>;
|
|
87
|
-
//#endregion
|
|
88
84
|
export type { DocxAttributedComment, DocxAttributedRevision, DocxPackageProjectionWire, DocxParagraphFragmentWire, DocxProjectionAlignment, DocxProjectionAlignmentSource, DocxProjectionAlignmentValue, DocxProjectionBookmarkFact, DocxProjectionContainer, DocxProjectionFactSet, DocxProjectionFormattingCompleteness, DocxProjectionFormattingFamily, DocxProjectionFormattingFamilyStatus, DocxProjectionFormattingSpan, DocxProjectionFormattingUnknownReason, DocxProjectionIndentationFact, DocxProjectionNumberingFact, DocxProjectionOutlineLevelFact, DocxProjectionParagraph, DocxProjectionReferenceFact, DocxProjectionRevisionStatus, DocxProjectionRevisionUnsupportedReason, DocxProjectionStructuralFacts, DocxProjectionStructuralSpan, DocxProjectionStructure, DocxProjectionUnknownReason, DocxProjectionWire, DocxReviewFactSet, DocxReviewFactsWire, DocxReviewUnknownReason, DocxRevisionKind };
|
package/dist/projection.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TaggedError } from "better-result";
|
|
2
|
-
|
|
2
|
+
// src/generated/docx_kernel.js
|
|
3
3
|
/**
|
|
4
4
|
* The version used by the document projection serializer.
|
|
5
5
|
* @returns {number}
|
|
@@ -289,8 +289,7 @@ async function __wbg_init(module_or_path) {
|
|
|
289
289
|
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
290
290
|
return __wbg_finalize_init(instance, module);
|
|
291
291
|
}
|
|
292
|
-
|
|
293
|
-
//#region src/projection.ts
|
|
292
|
+
// src/projection.ts
|
|
294
293
|
const DocxProjectionInitializationErrorBase = TaggedError("DocxProjectionInitializationError");
|
|
295
294
|
var DocxProjectionInitializationError = class extends DocxProjectionInitializationErrorBase {};
|
|
296
295
|
const DocxProjectionErrorBase = TaggedError("DocxProjectionError");
|
|
@@ -357,5 +356,4 @@ const projectCompressedDocxWithReviewFacts = (bytes, { textMaterialization = "wo
|
|
|
357
356
|
project: textMaterialization === "word-host" ? projectCompressedDocxWithReviewFacts$1 : projectCompressedDocxWithReadableReviewFacts,
|
|
358
357
|
message: PACKAGE_PROJECTION_FAILURE_MESSAGE
|
|
359
358
|
});
|
|
360
|
-
//#endregion
|
|
361
359
|
export { DocxProjectionError, DocxProjectionInitializationError, docxProjectionSchemaVersion, initializeDocxProjection, projectCompressedDocx, projectCompressedDocxWithReviewFacts, projectMainDocumentXml, projectParagraphFragment };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { r as PreservedMarkup } from "../preservedMarkup-
|
|
2
|
-
//#region src/schema/sequenceChildren.gen.d.ts
|
|
1
|
+
import { r as PreservedMarkup } from "../preservedMarkup-9L4lbGnE.js";
|
|
3
2
|
/**
|
|
4
3
|
* GENERATED FILE — do not edit.
|
|
5
4
|
*
|
|
@@ -37,8 +36,6 @@ export declare const SETTINGS_CHILDREN: readonly ["writeProtection", "view", "zo
|
|
|
37
36
|
type SequenceContainer = keyof typeof SEQUENCE_CHILDREN;
|
|
38
37
|
/** Every child the schema declares for `Container`, in declaration order. */
|
|
39
38
|
type SequenceChild<Container extends SequenceContainer> = (typeof SEQUENCE_CHILDREN)[Container][number];
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/schema/sequenceChildren.d.ts
|
|
42
39
|
type SerializeSequenceChildrenOptions<Container extends SequenceContainer> = {
|
|
43
40
|
container: Container;
|
|
44
41
|
/**
|
|
@@ -70,5 +67,4 @@ export declare const assertSafePreservedMarkup: (preserved: PreservedMarkup | un
|
|
|
70
67
|
* it. The sort is stable and the modelled child leads.
|
|
71
68
|
*/
|
|
72
69
|
export declare const serializeSequenceChildren: <Container extends SequenceContainer>({ container, modelled, preserved }: SerializeSequenceChildrenOptions<Container>) => string[];
|
|
73
|
-
//#endregion
|
|
74
70
|
export type { SequenceChild, SequenceContainer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as SEQUENCE_CHILDREN, o as SETTINGS_CHILDREN, t as assertSafePreservedMarkup, n as isSafePreservedChildXml, r as isWithinPreservedMarkupBudget, i as serializeSequenceChildren } from "../sequenceChildren-
|
|
1
|
+
export { a as SEQUENCE_CHILDREN, o as SETTINGS_CHILDREN, t as assertSafePreservedMarkup, n as isSafePreservedChildXml, r as isWithinPreservedMarkupBudget, i as serializeSequenceChildren } from "../sequenceChildren-CrMcryEF.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TaggedError } from "better-result";
|
|
2
2
|
import { XMLParser, XMLValidator } from "fast-xml-parser";
|
|
3
3
|
import { OOXML_NS } from "@stll/docx-utils";
|
|
4
|
-
|
|
4
|
+
// src/schema/sequenceChildren.gen.ts
|
|
5
5
|
/**
|
|
6
6
|
* GENERATED FILE — do not edit.
|
|
7
7
|
*
|
|
@@ -352,8 +352,7 @@ const SETTINGS_CHILDREN = [
|
|
|
352
352
|
"decimalSymbol",
|
|
353
353
|
"listSeparator"
|
|
354
354
|
];
|
|
355
|
-
|
|
356
|
-
//#region src/schema/sequenceChildren.ts
|
|
355
|
+
// src/schema/sequenceChildren.ts
|
|
357
356
|
/**
|
|
358
357
|
* The one writer of a property set's children, in the order the schema
|
|
359
358
|
* declares them.
|
|
@@ -576,5 +575,4 @@ const serializeSequenceChildren = ({ container, modelled, preserved }) => {
|
|
|
576
575
|
});
|
|
577
576
|
return placed.sort((left, right) => left.at - right.at || left.rank - right.rank).map(({ xml }) => xml);
|
|
578
577
|
};
|
|
579
|
-
//#endregion
|
|
580
578
|
export { SEQUENCE_CHILDREN as a, serializeSequenceChildren as i, isSafePreservedChildXml as n, SETTINGS_CHILDREN as o, isWithinPreservedMarkupBudget as r, assertSafePreservedMarkup as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import JSZip from "jszip";
|
|
2
|
-
//#region src/zip/writeZipPart.d.ts
|
|
3
2
|
type WriteZipPartOptions = {
|
|
4
3
|
zip: JSZip;
|
|
5
4
|
path: string;
|
|
@@ -8,5 +7,4 @@ type WriteZipPartOptions = {
|
|
|
8
7
|
};
|
|
9
8
|
/** Write exactly one entry, without synthesizing parent directory entries. */
|
|
10
9
|
export declare const writeZipPart: ({ zip, path, data, options }: WriteZipPartOptions) => void;
|
|
11
|
-
//#endregion
|
|
12
10
|
export {};
|
package/dist/zip/writeZipPart.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { writeZipEntry } from "@stll/utf8-boundaries";
|
|
2
|
-
|
|
2
|
+
// src/zip/writeZipPart.ts
|
|
3
3
|
const FIXED_ZIP_DATE_MS = Date.UTC(2e3, 0, 1);
|
|
4
4
|
const UNIX_DIRECTORY_FLAG = 16384;
|
|
5
5
|
const DOS_DIRECTORY_FLAG = 16;
|
|
@@ -13,5 +13,4 @@ const writeZipPart = ({ zip, path, data, options = {} }) => {
|
|
|
13
13
|
createFolders: false
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
//#endregion
|
|
17
16
|
export { writeZipPart };
|
package/package.json
CHANGED