@ansonlai/docx-redline-js 0.4.0 → 0.5.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/AGENTS.md +589 -287
- package/ARCHITECTURE.md +215 -9
- package/CHANGELOG.md +319 -0
- package/README.md +604 -360
- package/adapters/config.js +45 -43
- package/bin/docx-redline.js +3 -0
- package/core/list-targeting.js +101 -110
- package/core/paragraph-targeting.js +501 -61
- package/core/paragraph-text.js +209 -0
- package/core/revision-cloning.js +38 -0
- package/core/types.js +64 -10
- package/core/word-xml.js +43 -15
- package/dist/docx-redline-js.esm.js +2849 -466
- package/dist/docx-redline-js.esm.js.map +4 -4
- package/dist/docx-redline-js.esm.min.js +87 -76
- package/dist/docx-redline-js.esm.min.js.map +4 -4
- package/docs/TESTING.md +342 -23
- package/docs/plans/2026-09-05-structural-revisions-and-fidelity-oracles.md +1669 -0
- package/docs/plans/completed/2026-09-01-performance-and-complexity-reduction.md +669 -0
- package/docs/plans/completed/2026-09-03-agent-friendly-document-workflows.md +427 -0
- package/docs/plans/completed/2026-09-04-comment-anchor-and-cli-reliability.md +519 -0
- package/docs/plans/completed/PERFORMANCE-CONSOLIDATION.md +69 -0
- package/docs/plans/completed/structural-revision-capability-matrix.md +115 -0
- package/docs/schemas/document-operations.schema.json +109 -0
- package/docs/test-comparison-dashboard.html +4250 -7
- package/engine/formatting-removal.js +11 -2
- package/engine/oxml-engine.js +491 -336
- package/engine/reconstruction-mode.js +15 -14
- package/engine/reconstruction-writer.js +247 -142
- package/engine/route-selection.js +35 -0
- package/engine/rpr-helpers.js +334 -35
- package/engine/run-builders.js +239 -196
- package/engine/surgical-diff-application.js +222 -37
- package/engine/surgical-mode.js +134 -6
- package/engine/surgical-spans.js +52 -1
- package/engine/table-cell-context.js +3 -6
- package/engine/table-mode.js +1 -1
- package/index.d.ts +234 -6
- package/index.js +24 -1
- package/node/cli.js +317 -0
- package/node/docx-document.js +302 -0
- package/node/index.d.ts +31 -0
- package/node/index.js +2 -0
- package/node/zip-archive.js +52 -0
- package/orchestration/list-markdown.js +10 -16
- package/orchestration/list-parsing.js +7 -12
- package/orchestration/list-structural-fallback.js +21 -10
- package/package.json +24 -3
- package/pipeline/content-analysis.js +12 -17
- package/pipeline/ingestion-export.js +3 -31
- package/pipeline/ingestion-paragraph.js +10 -5
- package/pipeline/list-generation.js +150 -55
- package/pipeline/list-markers.js +70 -3
- package/pipeline/serialization.js +4 -2
- package/pipeline/structured-content.js +160 -0
- package/scripts/apply_changes.mjs +27 -0
- package/scripts/benchmark-operation-session.mjs +137 -0
- package/scripts/benchmark-targeting-browser.html +74 -0
- package/scripts/benchmark-targeting-hot-paths.mjs +67 -0
- package/scripts/benchmark-test-runner.mjs +59 -0
- package/scripts/build-test-dashboard.mjs +23 -0
- package/scripts/export-lane1-fixtures.mjs +380 -0
- package/scripts/export-reredline-stress-fixtures.mjs +317 -0
- package/scripts/export-validation-fixtures.mjs +1 -1
- package/scripts/extract_text.mjs +7 -0
- package/scripts/generate-paragraph-boundary-fixtures.ps1 +215 -0
- package/scripts/generate-test-dashboard.mjs +362 -11
- package/scripts/lib/word-coverage-catalogue.mjs +6 -2
- package/scripts/profile-route-selection.mjs +19 -0
- package/scripts/render-agenda-multilevel.mjs +0 -5
- package/scripts/render-multilevel-cases.mjs +0 -1
- package/scripts/run-tests.mjs +107 -35
- package/scripts/word-com-corpus-suite.ps1 +3 -0
- package/scripts/word-com-differential.ps1 +64 -4
- package/scripts/word-com-suite.ps1 +3 -0
- package/services/batch-operation-orchestrator.js +494 -0
- package/services/capture-engine.js +226 -0
- package/services/comment-builders.js +23 -6
- package/services/comment-engine.js +108 -47
- package/services/comment-locator.js +187 -82
- package/services/comment-replies.js +95 -0
- package/services/document-inspection.js +258 -0
- package/services/document-operation-applier.js +372 -0
- package/services/document-operation-contract.js +323 -0
- package/services/document-operation-mutations.js +1733 -0
- package/services/document-operation-session.js +258 -0
- package/services/numbering-service.js +14 -5
- package/services/operation-heuristics.js +173 -0
- package/services/operation-preflight.js +366 -0
- package/services/receipt-collector.js +288 -0
- package/services/revision-comment-management.js +37 -5
- package/services/revision-token.js +290 -0
- package/services/standalone-docx-plumbing.js +123 -8
- package/services/standalone-operation-runner.d.ts +296 -0
- package/services/standalone-operation-runner.js +10 -1455
- package/services/table-reconciliation.js +15 -6
- package/docs/VALIDATION.md +0 -183
- package/docs/WORD-MANUAL-REVIEW.md +0 -138
- package/docs/plans/2026-09-01-performance-and-complexity-reduction.md +0 -210
- /package/docs/plans/{2026-08-30-reliability-testing-improvements.md → completed/2026-08-30-reliability-testing-improvements.md} +0 -0
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
seedRevisionIdsFromDocument
|
|
15
15
|
} from '../core/types.js';
|
|
16
16
|
import { createWordElement } from '../core/word-xml.js';
|
|
17
|
+
import { refreshRunPropertyChangeIds } from '../core/revision-cloning.js';
|
|
17
18
|
|
|
18
19
|
function removeNode(node) {
|
|
19
20
|
if (node?.parentNode) {
|
|
@@ -236,10 +237,12 @@ export function applyHighlightToOoxml(ooxmlString, targetText, color = 'yellow',
|
|
|
236
237
|
|
|
237
238
|
const doc = parseOoxml(ooxmlString);
|
|
238
239
|
if (!doc) return ooxmlString;
|
|
240
|
+
let revisionIdAllocator;
|
|
239
241
|
if (options?._revisionIdAllocator instanceof RevisionIdAllocator) {
|
|
240
|
-
|
|
242
|
+
revisionIdAllocator = options._revisionIdAllocator;
|
|
243
|
+
seedRevisionIdsFromDocument(doc, revisionIdAllocator);
|
|
241
244
|
} else {
|
|
242
|
-
createRevisionIdAllocator(doc);
|
|
245
|
+
revisionIdAllocator = createRevisionIdAllocator(doc);
|
|
243
246
|
}
|
|
244
247
|
const NS_W = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
|
|
245
248
|
|
|
@@ -252,8 +255,14 @@ export function applyHighlightToOoxml(ooxmlString, targetText, color = 'yellow',
|
|
|
252
255
|
// Find all runs recursively (this already includes runs inside w:ins)
|
|
253
256
|
const allRuns = Array.from(doc.getElementsByTagNameNS(NS_W, 'r'));
|
|
254
257
|
|
|
258
|
+
const sourceRunsWithClaimedRevisionIds = new WeakSet();
|
|
255
259
|
const cloneRunWithText = (sourceRun, text, shouldHighlight) => {
|
|
256
260
|
const clonedRun = sourceRun.cloneNode(true);
|
|
261
|
+
if (sourceRunsWithClaimedRevisionIds.has(sourceRun)) {
|
|
262
|
+
refreshRunPropertyChangeIds(clonedRun, revisionIdAllocator);
|
|
263
|
+
} else {
|
|
264
|
+
sourceRunsWithClaimedRevisionIds.add(sourceRun);
|
|
265
|
+
}
|
|
257
266
|
const textNodes = clonedRun.getElementsByTagNameNS(NS_W, 't');
|
|
258
267
|
Array.from(textNodes).forEach(removeNode);
|
|
259
268
|
|