@beyondwork/docx-react-component 1.0.28 → 1.0.29
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/canonical-document-BLEbzL2J.d.cts +844 -0
- package/dist/canonical-document-BLEbzL2J.d.ts +844 -0
- package/dist/chunk-2FJS5GZM.js +763 -0
- package/dist/chunk-2FJS5GZM.js.map +1 -0
- package/{src/core/commands/section-layout-commands.ts → dist/chunk-2OQBZS3F.js} +106 -340
- package/dist/chunk-2OQBZS3F.js.map +1 -0
- package/dist/chunk-2S7W4KFO.js +127 -0
- package/dist/chunk-2S7W4KFO.js.map +1 -0
- package/dist/chunk-2TG72QSW.js +3874 -0
- package/dist/chunk-2TG72QSW.js.map +1 -0
- package/{src/core/commands/table-structure-commands.ts → dist/chunk-36QNIZBO.js} +126 -315
- package/dist/chunk-36QNIZBO.js.map +1 -0
- package/dist/chunk-4AQOYAW4.js +3069 -0
- package/dist/chunk-4AQOYAW4.js.map +1 -0
- package/dist/chunk-4D5EWJ3P.js +77 -0
- package/dist/chunk-4D5EWJ3P.js.map +1 -0
- package/dist/chunk-5FN54NDH.js +2257 -0
- package/dist/chunk-5FN54NDH.js.map +1 -0
- package/dist/chunk-BOYGQYRQ.js +7306 -0
- package/dist/chunk-BOYGQYRQ.js.map +1 -0
- package/dist/chunk-CN3XMECL.js +212 -0
- package/dist/chunk-CN3XMECL.js.map +1 -0
- package/dist/chunk-EBI3BX6U.js +164 -0
- package/dist/chunk-EBI3BX6U.js.map +1 -0
- package/dist/chunk-EILUG3VB.js +1275 -0
- package/dist/chunk-EILUG3VB.js.map +1 -0
- package/dist/chunk-FUDY333O.js +70 -0
- package/dist/chunk-FUDY333O.js.map +1 -0
- package/dist/chunk-GBVOWFIK.js +1237 -0
- package/dist/chunk-GBVOWFIK.js.map +1 -0
- package/dist/chunk-H4TQ3H3Y.js +262 -0
- package/dist/chunk-H4TQ3H3Y.js.map +1 -0
- package/{src/core/commands/style-commands.ts → dist/chunk-JGB3IXZO.js} +40 -113
- package/dist/chunk-JGB3IXZO.js.map +1 -0
- package/dist/chunk-KD2QRQPY.js +4342 -0
- package/dist/chunk-KD2QRQPY.js.map +1 -0
- package/dist/chunk-KLMXQVYK.js +369 -0
- package/dist/chunk-KLMXQVYK.js.map +1 -0
- package/dist/chunk-KZUG5KFQ.js +214 -0
- package/dist/chunk-KZUG5KFQ.js.map +1 -0
- package/{src/core/state/text-transaction.ts → dist/chunk-QDAQ4CJU.js} +79 -236
- package/dist/chunk-QDAQ4CJU.js.map +1 -0
- package/{src/legal/bookmarks.ts → dist/chunk-RMH72RZI.js} +44 -130
- package/dist/chunk-RMH72RZI.js.map +1 -0
- package/dist/chunk-SWKWQZXM.js +117 -0
- package/dist/chunk-SWKWQZXM.js.map +1 -0
- package/{src/core/commands/formatting-commands.ts → dist/chunk-TJBP2K4T.js} +196 -536
- package/dist/chunk-TJBP2K4T.js.map +1 -0
- package/dist/chunk-TLCEAQDQ.js +542 -0
- package/dist/chunk-TLCEAQDQ.js.map +1 -0
- package/{src/core/commands/text-commands.ts → dist/chunk-UZXBISGO.js} +86 -142
- package/dist/chunk-UZXBISGO.js.map +1 -0
- package/dist/chunk-WGBAKP3Q.js +3220 -0
- package/dist/chunk-WGBAKP3Q.js.map +1 -0
- package/dist/compare/index.cjs +5475 -0
- package/dist/compare/index.cjs.map +1 -0
- package/dist/compare/index.d.cts +114 -0
- package/dist/compare/index.d.ts +114 -0
- package/dist/compare/index.js +731 -0
- package/dist/compare/index.js.map +1 -0
- package/dist/core/commands/formatting-commands.cjs +828 -0
- package/dist/core/commands/formatting-commands.cjs.map +1 -0
- package/dist/core/commands/formatting-commands.d.cts +63 -0
- package/dist/core/commands/formatting-commands.d.ts +63 -0
- package/dist/core/commands/formatting-commands.js +37 -0
- package/dist/core/commands/formatting-commands.js.map +1 -0
- package/dist/core/commands/image-commands.cjs +2023 -0
- package/dist/core/commands/image-commands.cjs.map +1 -0
- package/dist/core/commands/image-commands.d.cts +58 -0
- package/dist/core/commands/image-commands.d.ts +58 -0
- package/dist/core/commands/image-commands.js +18 -0
- package/dist/core/commands/image-commands.js.map +1 -0
- package/dist/core/commands/section-layout-commands.cjs +477 -0
- package/dist/core/commands/section-layout-commands.cjs.map +1 -0
- package/dist/core/commands/section-layout-commands.d.cts +62 -0
- package/dist/core/commands/section-layout-commands.d.ts +62 -0
- package/dist/core/commands/section-layout-commands.js +21 -0
- package/dist/core/commands/section-layout-commands.js.map +1 -0
- package/dist/core/commands/style-commands.cjs +214 -0
- package/dist/core/commands/style-commands.cjs.map +1 -0
- package/dist/core/commands/style-commands.d.cts +13 -0
- package/dist/core/commands/style-commands.d.ts +13 -0
- package/dist/core/commands/style-commands.js +9 -0
- package/dist/core/commands/style-commands.js.map +1 -0
- package/dist/core/commands/table-structure-commands.cjs +1883 -0
- package/dist/core/commands/table-structure-commands.cjs.map +1 -0
- package/dist/core/commands/table-structure-commands.d.cts +59 -0
- package/dist/core/commands/table-structure-commands.d.ts +59 -0
- package/dist/core/commands/table-structure-commands.js +12 -0
- package/dist/core/commands/table-structure-commands.js.map +1 -0
- package/dist/core/commands/text-commands.cjs +2391 -0
- package/dist/core/commands/text-commands.cjs.map +1 -0
- package/dist/core/commands/text-commands.d.cts +24 -0
- package/dist/core/commands/text-commands.d.ts +24 -0
- package/dist/core/commands/text-commands.js +28 -0
- package/dist/core/commands/text-commands.js.map +1 -0
- package/dist/core/selection/mapping.cjs +200 -0
- package/dist/core/selection/mapping.cjs.map +1 -0
- package/dist/core/selection/mapping.d.cts +2 -0
- package/dist/core/selection/mapping.d.ts +2 -0
- package/dist/core/selection/mapping.js +31 -0
- package/dist/core/selection/mapping.js.map +1 -0
- package/dist/core/state/editor-state.cjs +2278 -0
- package/dist/core/state/editor-state.cjs.map +1 -0
- package/dist/core/state/editor-state.d.cts +2 -0
- package/dist/core/state/editor-state.d.ts +2 -0
- package/dist/core/state/editor-state.js +26 -0
- package/dist/core/state/editor-state.js.map +1 -0
- package/dist/index.cjs +38553 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +7856 -0
- package/dist/index.js.map +1 -0
- package/dist/io/docx-session.cjs +16236 -0
- package/dist/io/docx-session.cjs.map +1 -0
- package/dist/io/docx-session.d.cts +21 -0
- package/dist/io/docx-session.d.ts +21 -0
- package/dist/io/docx-session.js +18 -0
- package/dist/io/docx-session.js.map +1 -0
- package/dist/legal/index.cjs +3900 -0
- package/dist/legal/index.cjs.map +1 -0
- package/dist/legal/index.d.cts +86 -0
- package/dist/legal/index.d.ts +86 -0
- package/dist/legal/index.js +616 -0
- package/dist/legal/index.js.map +1 -0
- package/dist/public-types-7ZL_94cz.d.ts +1573 -0
- package/dist/public-types-CeMaDueh.d.cts +1573 -0
- package/dist/public-types.cjs +19 -0
- package/dist/public-types.cjs.map +1 -0
- package/dist/public-types.d.cts +2 -0
- package/dist/public-types.d.ts +2 -0
- package/dist/public-types.js +1 -0
- package/dist/public-types.js.map +1 -0
- package/dist/runtime/document-runtime.cjs +11140 -0
- package/dist/runtime/document-runtime.cjs.map +1 -0
- package/dist/runtime/document-runtime.d.cts +231 -0
- package/dist/runtime/document-runtime.d.ts +231 -0
- package/dist/runtime/document-runtime.js +21 -0
- package/dist/runtime/document-runtime.js.map +1 -0
- package/dist/structural-helpers-CilgOVhh.d.cts +10 -0
- package/dist/structural-helpers-q0Gd-eBN.d.ts +10 -0
- package/dist/ui-tailwind/editor-surface/search-plugin.cjs +313 -0
- package/dist/ui-tailwind/editor-surface/search-plugin.cjs.map +1 -0
- package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +67 -0
- package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +67 -0
- package/dist/ui-tailwind/editor-surface/search-plugin.js +23 -0
- package/dist/ui-tailwind/editor-surface/search-plugin.js.map +1 -0
- package/dist/ui-tailwind/index.cjs +4833 -0
- package/dist/ui-tailwind/index.cjs.map +1 -0
- package/dist/ui-tailwind/index.d.cts +617 -0
- package/dist/ui-tailwind/index.d.ts +617 -0
- package/dist/ui-tailwind/index.js +575 -0
- package/dist/ui-tailwind/index.js.map +1 -0
- package/package.json +61 -41
- package/src/README.md +0 -85
- package/src/api/README.md +0 -26
- package/src/api/public-types.ts +0 -1421
- package/src/api/session-state.ts +0 -60
- package/src/compare/diff-engine.ts +0 -623
- package/src/compare/export-redlines.ts +0 -280
- package/src/compare/index.ts +0 -25
- package/src/compare/snapshot.ts +0 -97
- package/src/component-inventory.md +0 -99
- package/src/core/README.md +0 -10
- package/src/core/commands/README.md +0 -3
- package/src/core/commands/image-commands.ts +0 -373
- package/src/core/commands/index.ts +0 -1757
- package/src/core/commands/list-commands.ts +0 -565
- package/src/core/commands/paragraph-layout-commands.ts +0 -339
- package/src/core/commands/review-commands.ts +0 -108
- package/src/core/commands/structural-helpers.ts +0 -309
- package/src/core/schema/README.md +0 -3
- package/src/core/schema/text-schema.ts +0 -516
- package/src/core/search/search-text.ts +0 -357
- package/src/core/selection/README.md +0 -3
- package/src/core/selection/mapping.ts +0 -289
- package/src/core/selection/review-anchors.ts +0 -183
- package/src/core/state/README.md +0 -3
- package/src/core/state/editor-state.ts +0 -892
- package/src/formats/xlsx/io/parse-shared-strings.ts +0 -41
- package/src/formats/xlsx/io/parse-sheet.ts +0 -459
- package/src/formats/xlsx/io/parse-styles.ts +0 -59
- package/src/formats/xlsx/io/parse-workbook.ts +0 -75
- package/src/formats/xlsx/io/serialize-shared-strings.ts +0 -72
- package/src/formats/xlsx/io/serialize-sheet.ts +0 -333
- package/src/formats/xlsx/io/serialize-styles.ts +0 -98
- package/src/formats/xlsx/io/serialize-workbook.ts +0 -429
- package/src/formats/xlsx/io/xlsx-session.ts +0 -314
- package/src/formats/xlsx/model/cell.ts +0 -189
- package/src/formats/xlsx/model/sheet.ts +0 -326
- package/src/formats/xlsx/model/styles.ts +0 -118
- package/src/formats/xlsx/model/workbook.ts +0 -453
- package/src/formats/xlsx/runtime/cell-commands.ts +0 -567
- package/src/formats/xlsx/runtime/sheet-commands.ts +0 -206
- package/src/formats/xlsx/runtime/workbook-runtime.ts +0 -177
- package/src/formats/xlsx/runtime/workbook-transaction.ts +0 -822
- package/src/index.ts +0 -101
- package/src/io/README.md +0 -10
- package/src/io/docx-session.ts +0 -2882
- package/src/io/export/README.md +0 -3
- package/src/io/export/export-session.ts +0 -220
- package/src/io/export/minimal-docx.ts +0 -115
- package/src/io/export/reattach-preserved-parts.ts +0 -54
- package/src/io/export/serialize-comments.ts +0 -947
- package/src/io/export/serialize-footnotes.ts +0 -399
- package/src/io/export/serialize-headers-footers.ts +0 -372
- package/src/io/export/serialize-main-document.ts +0 -1376
- package/src/io/export/serialize-numbering.ts +0 -118
- package/src/io/export/serialize-revisions.ts +0 -389
- package/src/io/export/serialize-runtime-revisions.ts +0 -269
- package/src/io/export/serialize-tables.ts +0 -174
- package/src/io/export/split-review-boundaries.ts +0 -356
- package/src/io/normalize/README.md +0 -3
- package/src/io/normalize/normalize-text.ts +0 -639
- package/src/io/ooxml/README.md +0 -3
- package/src/io/ooxml/highlight-colors.ts +0 -39
- package/src/io/ooxml/numbering-sentinels.ts +0 -44
- package/src/io/ooxml/parse-comments.ts +0 -846
- package/src/io/ooxml/parse-complex-content.ts +0 -287
- package/src/io/ooxml/parse-fields.ts +0 -834
- package/src/io/ooxml/parse-footnotes.ts +0 -896
- package/src/io/ooxml/parse-headers-footers.ts +0 -1169
- package/src/io/ooxml/parse-inline-media.ts +0 -461
- package/src/io/ooxml/parse-main-document.ts +0 -2877
- package/src/io/ooxml/parse-numbering.ts +0 -432
- package/src/io/ooxml/parse-revisions.ts +0 -931
- package/src/io/ooxml/parse-settings.ts +0 -184
- package/src/io/ooxml/parse-shapes.ts +0 -296
- package/src/io/ooxml/parse-styles.ts +0 -463
- package/src/io/ooxml/parse-tables.ts +0 -618
- package/src/io/ooxml/parse-theme.ts +0 -346
- package/src/io/ooxml/part-manifest.ts +0 -136
- package/src/io/ooxml/revision-boundaries.ts +0 -351
- package/src/io/opc/README.md +0 -3
- package/src/io/opc/corrupt-package.ts +0 -166
- package/src/io/opc/docx-package.ts +0 -74
- package/src/io/opc/package-reader.ts +0 -325
- package/src/io/opc/package-writer.ts +0 -273
- package/src/io/source-package-provenance.ts +0 -241
- package/src/legal/cross-references.ts +0 -414
- package/src/legal/defined-terms.ts +0 -203
- package/src/legal/index.ts +0 -32
- package/src/legal/signature-blocks.ts +0 -259
- package/src/model/README.md +0 -3
- package/src/model/canonical-document.ts +0 -2632
- package/src/model/cds-1.0.0.ts +0 -212
- package/src/model/snapshot.ts +0 -649
- package/src/preservation/README.md +0 -3
- package/src/preservation/markup-compatibility.ts +0 -48
- package/src/preservation/opaque-fragment-store.ts +0 -89
- package/src/preservation/opaque-region.ts +0 -233
- package/src/preservation/package-preservation.ts +0 -113
- package/src/preservation/preserved-part-manifest.ts +0 -56
- package/src/preservation/relationship-retention.ts +0 -57
- package/src/preservation/store.ts +0 -185
- package/src/review/README.md +0 -16
- package/src/review/store/README.md +0 -3
- package/src/review/store/comment-anchors.ts +0 -70
- package/src/review/store/comment-remapping.ts +0 -154
- package/src/review/store/comment-store.ts +0 -331
- package/src/review/store/comment-thread.ts +0 -109
- package/src/review/store/revision-actions.ts +0 -394
- package/src/review/store/revision-store.ts +0 -312
- package/src/review/store/revision-types.ts +0 -171
- package/src/review/store/runtime-comment-store.ts +0 -43
- package/src/runtime/README.md +0 -3
- package/src/runtime/ai-action-policy.ts +0 -764
- package/src/runtime/document-layout.ts +0 -332
- package/src/runtime/document-navigation.ts +0 -603
- package/src/runtime/document-runtime.ts +0 -3159
- package/src/runtime/document-search.ts +0 -145
- package/src/runtime/numbering-prefix.ts +0 -216
- package/src/runtime/page-layout-estimation.ts +0 -212
- package/src/runtime/read-only-diagnostics-runtime.ts +0 -241
- package/src/runtime/review-runtime.ts +0 -44
- package/src/runtime/revision-runtime.ts +0 -107
- package/src/runtime/session-capabilities.ts +0 -192
- package/src/runtime/story-context.ts +0 -164
- package/src/runtime/story-targeting.ts +0 -162
- package/src/runtime/surface-projection.ts +0 -1357
- package/src/runtime/table-commands.ts +0 -173
- package/src/runtime/table-schema.ts +0 -309
- package/src/runtime/view-state.ts +0 -477
- package/src/runtime/virtualized-rendering.ts +0 -258
- package/src/runtime/workflow-markup.ts +0 -353
- package/src/ui/README.md +0 -30
- package/src/ui/WordReviewEditor.tsx +0 -4086
- package/src/ui/browser-export.ts +0 -52
- package/src/ui/comments/README.md +0 -3
- package/src/ui/compatibility/README.md +0 -3
- package/src/ui/editor-command-bag.ts +0 -120
- package/src/ui/editor-runtime-boundary.ts +0 -1457
- package/src/ui/editor-shell-view.tsx +0 -142
- package/src/ui/editor-surface/README.md +0 -3
- package/src/ui/editor-surface-controller.tsx +0 -61
- package/src/ui/headless/comment-decoration-model.ts +0 -124
- package/src/ui/headless/preserve-editor-selection.ts +0 -5
- package/src/ui/headless/revision-decoration-model.ts +0 -128
- package/src/ui/headless/selection-helpers.ts +0 -54
- package/src/ui/headless/selection-toolbar-model.ts +0 -34
- package/src/ui/headless/use-editor-keyboard.ts +0 -103
- package/src/ui/review/README.md +0 -3
- package/src/ui/runtime-snapshot-selectors.ts +0 -197
- package/src/ui/shared/revision-filters.ts +0 -31
- package/src/ui/status/README.md +0 -3
- package/src/ui/theme/README.md +0 -3
- package/src/ui/toolbar/README.md +0 -3
- package/src/ui/workflow-surface-blocked-rails.ts +0 -94
- package/src/ui-tailwind/chrome/tw-alert-banner.tsx +0 -64
- package/src/ui-tailwind/chrome/tw-image-context-toolbar.tsx +0 -129
- package/src/ui-tailwind/chrome/tw-layout-panel.tsx +0 -114
- package/src/ui-tailwind/chrome/tw-object-context-toolbar.tsx +0 -34
- package/src/ui-tailwind/chrome/tw-page-ruler.tsx +0 -386
- package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +0 -186
- package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +0 -139
- package/src/ui-tailwind/chrome/tw-table-context-toolbar.tsx +0 -128
- package/src/ui-tailwind/chrome/tw-unsaved-modal.tsx +0 -58
- package/src/ui-tailwind/chrome/use-before-unload.ts +0 -20
- package/src/ui-tailwind/editor-surface/perf-probe.ts +0 -179
- package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +0 -184
- package/src/ui-tailwind/editor-surface/pm-contextual-ui.ts +0 -31
- package/src/ui-tailwind/editor-surface/pm-decorations.ts +0 -427
- package/src/ui-tailwind/editor-surface/pm-position-map.ts +0 -123
- package/src/ui-tailwind/editor-surface/pm-schema.ts +0 -876
- package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +0 -504
- package/src/ui-tailwind/editor-surface/search-plugin.ts +0 -168
- package/src/ui-tailwind/editor-surface/surface-build-keys.ts +0 -61
- package/src/ui-tailwind/editor-surface/tw-caret.tsx +0 -12
- package/src/ui-tailwind/editor-surface/tw-editor-surface.tsx +0 -150
- package/src/ui-tailwind/editor-surface/tw-inline-token.tsx +0 -129
- package/src/ui-tailwind/editor-surface/tw-opaque-block.tsx +0 -58
- package/src/ui-tailwind/editor-surface/tw-paragraph-block.tsx +0 -151
- package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +0 -944
- package/src/ui-tailwind/editor-surface/tw-segment-view.tsx +0 -111
- package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +0 -436
- package/src/ui-tailwind/index.ts +0 -62
- package/src/ui-tailwind/page-chrome-model.ts +0 -27
- package/src/ui-tailwind/review/tw-comment-sidebar.tsx +0 -406
- package/src/ui-tailwind/review/tw-health-panel.tsx +0 -149
- package/src/ui-tailwind/review/tw-review-rail.tsx +0 -120
- package/src/ui-tailwind/review/tw-revision-sidebar.tsx +0 -164
- package/src/ui-tailwind/status/tw-status-bar.tsx +0 -61
- package/src/ui-tailwind/toolbar/tw-toolbar-icon-button.tsx +0 -52
- package/src/ui-tailwind/toolbar/tw-toolbar.tsx +0 -1064
- package/src/ui-tailwind/tw-review-workspace.tsx +0 -1417
- package/src/validation/README.md +0 -3
- package/src/validation/compatibility-engine.ts +0 -634
- package/src/validation/compatibility-report.ts +0 -161
- package/src/validation/diagnostics.ts +0 -204
- package/src/validation/docx-comment-proof.ts +0 -707
- package/src/validation/import-diagnostics.ts +0 -128
- package/src/validation/low-priority-word-surfaces.ts +0 -373
- /package/{src → dist}/ui-tailwind/theme/editor-theme.css +0 -0
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
import {
|
|
2
|
+
describeOpaqueFragment,
|
|
3
|
+
listOpaqueFragments,
|
|
4
|
+
listPreservedPackageParts
|
|
5
|
+
} from "./chunk-SWKWQZXM.js";
|
|
6
|
+
import {
|
|
7
|
+
createRangeAnchor,
|
|
8
|
+
mapAnchor,
|
|
9
|
+
normalizeRange
|
|
10
|
+
} from "./chunk-EBI3BX6U.js";
|
|
11
|
+
|
|
12
|
+
// src/api/session-state.ts
|
|
13
|
+
var EDITOR_SESSION_STATE_VERSION = "editor-session-state/1";
|
|
14
|
+
function cloneStructuredValue(value) {
|
|
15
|
+
return structuredClone(value);
|
|
16
|
+
}
|
|
17
|
+
function createEditorSessionState(input) {
|
|
18
|
+
return cloneStructuredValue({
|
|
19
|
+
sessionVersion: EDITOR_SESSION_STATE_VERSION,
|
|
20
|
+
...input
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function editorSessionStateFromPersistedSnapshot(snapshot) {
|
|
24
|
+
return createEditorSessionState({
|
|
25
|
+
schemaVersion: snapshot.schemaVersion,
|
|
26
|
+
documentId: snapshot.documentId,
|
|
27
|
+
docId: snapshot.docId,
|
|
28
|
+
createdAt: snapshot.createdAt,
|
|
29
|
+
updatedAt: snapshot.updatedAt,
|
|
30
|
+
editorBuild: snapshot.editorBuild,
|
|
31
|
+
canonicalDocument: snapshot.canonicalDocument,
|
|
32
|
+
compatibility: snapshot.compatibility,
|
|
33
|
+
warningLog: snapshot.warningLog,
|
|
34
|
+
protectionSnapshot: snapshot.protectionSnapshot,
|
|
35
|
+
sourcePackage: snapshot.sourcePackage
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function persistedSnapshotFromEditorSessionState(sessionState, options) {
|
|
39
|
+
return cloneStructuredValue({
|
|
40
|
+
snapshotVersion: "persisted-editor-snapshot/2",
|
|
41
|
+
schemaVersion: sessionState.schemaVersion,
|
|
42
|
+
documentId: sessionState.documentId,
|
|
43
|
+
docId: sessionState.docId,
|
|
44
|
+
createdAt: sessionState.createdAt,
|
|
45
|
+
updatedAt: sessionState.updatedAt,
|
|
46
|
+
savedAt: options.savedAt,
|
|
47
|
+
editorBuild: sessionState.editorBuild,
|
|
48
|
+
canonicalDocument: sessionState.canonicalDocument,
|
|
49
|
+
compatibility: sessionState.compatibility,
|
|
50
|
+
warningLog: sessionState.warningLog,
|
|
51
|
+
protectionSnapshot: sessionState.protectionSnapshot,
|
|
52
|
+
sourcePackage: sessionState.sourcePackage
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/review/store/revision-types.ts
|
|
57
|
+
function createRevisionRangeAnchor(from, to = from, assoc) {
|
|
58
|
+
return createRangeAnchor(from, to, assoc);
|
|
59
|
+
}
|
|
60
|
+
function remapRevisionAnchor(anchor, mapping) {
|
|
61
|
+
return mapAnchor(anchor, mapping);
|
|
62
|
+
}
|
|
63
|
+
function isDetachedRevisionAnchor(anchor) {
|
|
64
|
+
return anchor.kind === "detached";
|
|
65
|
+
}
|
|
66
|
+
function summarizeRevisionAnchor(anchor) {
|
|
67
|
+
if (anchor.kind === "range") {
|
|
68
|
+
return {
|
|
69
|
+
anchor,
|
|
70
|
+
state: "active",
|
|
71
|
+
range: normalizeRange(anchor.range)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (anchor.kind === "node") {
|
|
75
|
+
return {
|
|
76
|
+
anchor,
|
|
77
|
+
state: "active",
|
|
78
|
+
range: {
|
|
79
|
+
from: anchor.at,
|
|
80
|
+
to: anchor.at
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
anchor,
|
|
86
|
+
state: "detached",
|
|
87
|
+
range: normalizeRange(anchor.lastKnownRange)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function getRevisionActionability(revision) {
|
|
91
|
+
if (typeof revision !== "string" && typeof revision.metadata.preserveOnlyReason === "string" && revision.metadata.preserveOnlyReason.length > 0) {
|
|
92
|
+
return "preserve-only";
|
|
93
|
+
}
|
|
94
|
+
const kind = typeof revision === "string" ? revision : revision.kind;
|
|
95
|
+
switch (kind) {
|
|
96
|
+
case "insertion":
|
|
97
|
+
case "deletion":
|
|
98
|
+
case "property-change":
|
|
99
|
+
return "actionable";
|
|
100
|
+
case "formatting":
|
|
101
|
+
case "move":
|
|
102
|
+
return "preserve-only";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function isRevisionActionable(record) {
|
|
106
|
+
return getRevisionActionability(record) === "actionable" && record.status === "active";
|
|
107
|
+
}
|
|
108
|
+
function describeRevisionKind(kind) {
|
|
109
|
+
switch (kind) {
|
|
110
|
+
case "insertion":
|
|
111
|
+
return "Insertion";
|
|
112
|
+
case "deletion":
|
|
113
|
+
return "Deletion";
|
|
114
|
+
case "formatting":
|
|
115
|
+
return "Formatting change";
|
|
116
|
+
case "move":
|
|
117
|
+
return "Move";
|
|
118
|
+
case "property-change":
|
|
119
|
+
return "Property change";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// src/review/store/revision-store.ts
|
|
124
|
+
function createRevisionStore(revisions = {}) {
|
|
125
|
+
return {
|
|
126
|
+
version: "revision-store/1",
|
|
127
|
+
revisions
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function createRevisionRecord(params) {
|
|
131
|
+
return normalizeRevisionRecord({
|
|
132
|
+
revisionId: params.revisionId,
|
|
133
|
+
kind: params.kind,
|
|
134
|
+
anchor: params.anchor,
|
|
135
|
+
authorId: params.authorId,
|
|
136
|
+
createdAt: params.createdAt,
|
|
137
|
+
status: params.status ?? "active",
|
|
138
|
+
warningIds: [...params.warningIds ?? []],
|
|
139
|
+
metadata: {
|
|
140
|
+
source: params.metadata?.source ?? "runtime",
|
|
141
|
+
storyTarget: params.metadata?.storyTarget,
|
|
142
|
+
preserveOnlyReason: params.metadata?.preserveOnlyReason ?? (getRevisionActionability(params.kind) === "preserve-only" ? "Imported preserve-only revision." : void 0),
|
|
143
|
+
importedRevisionForm: params.metadata?.importedRevisionForm,
|
|
144
|
+
originalRevisionType: params.metadata?.originalRevisionType,
|
|
145
|
+
ooxmlRevisionId: params.metadata?.ooxmlRevisionId,
|
|
146
|
+
propertyChangeData: params.metadata?.propertyChangeData,
|
|
147
|
+
moveData: params.metadata?.moveData
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function upsertRevisionRecord(store, revision) {
|
|
152
|
+
return {
|
|
153
|
+
...store,
|
|
154
|
+
revisions: {
|
|
155
|
+
...store.revisions,
|
|
156
|
+
[revision.revisionId]: normalizeRevisionRecord(revision)
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function setRevisionStatus(store, revisionId, status) {
|
|
161
|
+
const existing = store.revisions[revisionId];
|
|
162
|
+
if (!existing) {
|
|
163
|
+
return store;
|
|
164
|
+
}
|
|
165
|
+
if (existing.status === "detached") {
|
|
166
|
+
return store;
|
|
167
|
+
}
|
|
168
|
+
if ((status === "accepted" || status === "rejected") && getRevisionActionability(existing) !== "actionable") {
|
|
169
|
+
return store;
|
|
170
|
+
}
|
|
171
|
+
return upsertRevisionRecord(store, {
|
|
172
|
+
...existing,
|
|
173
|
+
status
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function remapRevisionStore(store, mapping) {
|
|
177
|
+
return createRevisionStore(
|
|
178
|
+
Object.fromEntries(
|
|
179
|
+
Object.entries(store.revisions).map(([revisionId, revision]) => {
|
|
180
|
+
const anchor = remapRevisionAnchor(revision.anchor, mapping);
|
|
181
|
+
const status = anchor.kind === "detached" ? "detached" : revision.status === "accepted" || revision.status === "rejected" ? revision.status : "active";
|
|
182
|
+
return [
|
|
183
|
+
revisionId,
|
|
184
|
+
normalizeRevisionRecord({
|
|
185
|
+
...revision,
|
|
186
|
+
anchor,
|
|
187
|
+
status
|
|
188
|
+
})
|
|
189
|
+
];
|
|
190
|
+
})
|
|
191
|
+
)
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
function createRevisionSidebarProjection(store) {
|
|
195
|
+
const revisions = Object.values(store.revisions).map(toSidebarEntry).sort(compareRevisionEntries);
|
|
196
|
+
return {
|
|
197
|
+
totalCount: revisions.length,
|
|
198
|
+
activeRevisionIds: revisions.filter((revision) => revision.status === "active").map((revision) => revision.revisionId),
|
|
199
|
+
acceptedRevisionIds: revisions.filter((revision) => revision.status === "accepted").map((revision) => revision.revisionId),
|
|
200
|
+
rejectedRevisionIds: revisions.filter((revision) => revision.status === "rejected").map((revision) => revision.revisionId),
|
|
201
|
+
detachedRevisionIds: revisions.filter((revision) => revision.status === "detached").map((revision) => revision.revisionId),
|
|
202
|
+
actionableRevisionIds: revisions.filter((revision) => revision.actionability === "actionable").map((revision) => revision.revisionId),
|
|
203
|
+
preserveOnlyRevisionIds: revisions.filter((revision) => revision.actionability === "preserve-only").map((revision) => revision.revisionId),
|
|
204
|
+
revisions
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function toSidebarEntry(revision) {
|
|
208
|
+
const anchorSummary = summarizeRevisionAnchor(revision.anchor);
|
|
209
|
+
const actionability = getRevisionActionability(revision);
|
|
210
|
+
const moveData = revision.metadata.moveData;
|
|
211
|
+
return {
|
|
212
|
+
revisionId: revision.revisionId,
|
|
213
|
+
kind: revision.kind,
|
|
214
|
+
label: describeRevisionKind(revision.kind),
|
|
215
|
+
status: revision.status,
|
|
216
|
+
actionability,
|
|
217
|
+
anchorLabel: anchorSummary.state === "detached" ? `Detached ${anchorSummary.range.from}-${anchorSummary.range.to}` : `Range ${anchorSummary.range.from}-${anchorSummary.range.to}`,
|
|
218
|
+
createdAt: revision.createdAt,
|
|
219
|
+
authorId: revision.authorId,
|
|
220
|
+
warningCount: revision.warningIds.length,
|
|
221
|
+
canAccept: isRevisionActionable(revision),
|
|
222
|
+
canReject: isRevisionActionable(revision),
|
|
223
|
+
preserveOnlyReason: revision.metadata.preserveOnlyReason,
|
|
224
|
+
linkedMoveRevisionId: moveData?.linkedRevisionId,
|
|
225
|
+
moveDirection: moveData?.direction
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function normalizeRevisionRecord(revision) {
|
|
229
|
+
const actionability = getRevisionActionability(revision);
|
|
230
|
+
if (isDetachedRevisionAnchor(revision.anchor)) {
|
|
231
|
+
return {
|
|
232
|
+
...revision,
|
|
233
|
+
status: "detached",
|
|
234
|
+
metadata: {
|
|
235
|
+
...revision.metadata,
|
|
236
|
+
preserveOnlyReason: revision.metadata.preserveOnlyReason ?? (actionability === "preserve-only" ? "Imported preserve-only revision." : void 0)
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
if (actionability === "preserve-only" && revision.status !== "detached") {
|
|
241
|
+
return {
|
|
242
|
+
...revision,
|
|
243
|
+
status: revision.status === "accepted" || revision.status === "rejected" ? "active" : revision.status,
|
|
244
|
+
metadata: {
|
|
245
|
+
...revision.metadata,
|
|
246
|
+
preserveOnlyReason: revision.metadata.preserveOnlyReason ?? "Imported preserve-only revision."
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
return revision;
|
|
251
|
+
}
|
|
252
|
+
function compareRevisionEntries(left, right) {
|
|
253
|
+
const statusDelta = priorityForStatus(left.status) - priorityForStatus(right.status);
|
|
254
|
+
if (statusDelta !== 0) {
|
|
255
|
+
return statusDelta;
|
|
256
|
+
}
|
|
257
|
+
const actionabilityDelta = priorityForActionability(left.actionability) - priorityForActionability(right.actionability);
|
|
258
|
+
if (actionabilityDelta !== 0) {
|
|
259
|
+
return actionabilityDelta;
|
|
260
|
+
}
|
|
261
|
+
return left.createdAt.localeCompare(right.createdAt);
|
|
262
|
+
}
|
|
263
|
+
function priorityForStatus(status) {
|
|
264
|
+
switch (status) {
|
|
265
|
+
case "active":
|
|
266
|
+
return 0;
|
|
267
|
+
case "detached":
|
|
268
|
+
return 1;
|
|
269
|
+
case "accepted":
|
|
270
|
+
return 2;
|
|
271
|
+
case "rejected":
|
|
272
|
+
return 3;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function priorityForActionability(actionability) {
|
|
276
|
+
switch (actionability) {
|
|
277
|
+
case "actionable":
|
|
278
|
+
return 0;
|
|
279
|
+
case "preserve-only":
|
|
280
|
+
return 1;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// src/validation/compatibility-engine.ts
|
|
285
|
+
function buildCompatibilityReport(input) {
|
|
286
|
+
const content = normalizeDocumentRoot(input.document.content);
|
|
287
|
+
const contentFeatures = collectContentFeatures(content);
|
|
288
|
+
if (hasSupportedRuntimeComments(input.document.review.comments)) {
|
|
289
|
+
contentFeatures.push(
|
|
290
|
+
supportedEntry(
|
|
291
|
+
"comments-single-paragraph",
|
|
292
|
+
"Single-paragraph review comments stay mappable through runtime selections."
|
|
293
|
+
)
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
const featureEntries = [
|
|
297
|
+
...contentFeatures,
|
|
298
|
+
...collectPreservationFeatures(input.document)
|
|
299
|
+
];
|
|
300
|
+
const warnings = dedupeWarnings([
|
|
301
|
+
...input.warnings ?? [],
|
|
302
|
+
...collectDiagnosticWarnings(input.document)
|
|
303
|
+
]);
|
|
304
|
+
const errors = dedupeErrors([
|
|
305
|
+
...collectDiagnosticErrors(input.document),
|
|
306
|
+
...input.fatalError ? [input.fatalError] : []
|
|
307
|
+
]);
|
|
308
|
+
return {
|
|
309
|
+
reportVersion: "compatibility-report/1",
|
|
310
|
+
generatedAt: input.generatedAt,
|
|
311
|
+
blockExport: featureEntries.some((entry) => entry.featureClass === "unsupported-fatal") || errors.some((error) => error.isFatal),
|
|
312
|
+
featureEntries,
|
|
313
|
+
warnings,
|
|
314
|
+
errors
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function hasSupportedRuntimeComments(comments) {
|
|
318
|
+
return Object.values(comments).some((comment) => comment.anchor.kind !== "detached");
|
|
319
|
+
}
|
|
320
|
+
function normalizeDocumentRoot(content) {
|
|
321
|
+
if (content && typeof content === "object" && content.type === "doc") {
|
|
322
|
+
return content;
|
|
323
|
+
}
|
|
324
|
+
if (Array.isArray(content)) {
|
|
325
|
+
return {
|
|
326
|
+
type: "doc",
|
|
327
|
+
children: content.filter(
|
|
328
|
+
(value) => Boolean(value) && typeof value === "object" && (value.type === "paragraph" || value.type === "opaque_block")
|
|
329
|
+
)
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
return {
|
|
333
|
+
type: "doc",
|
|
334
|
+
children: [{ type: "paragraph", children: [] }]
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
function collectContentFeatures(content) {
|
|
338
|
+
const flags = {
|
|
339
|
+
paragraphs: false,
|
|
340
|
+
runs: false,
|
|
341
|
+
whitespace: false,
|
|
342
|
+
headings: false,
|
|
343
|
+
lists: false,
|
|
344
|
+
hyperlinks: false,
|
|
345
|
+
images: false,
|
|
346
|
+
tables: false,
|
|
347
|
+
sections: false,
|
|
348
|
+
contentControls: false
|
|
349
|
+
};
|
|
350
|
+
for (let index = 0; index < content.children.length; index += 1) {
|
|
351
|
+
measureBlock(content.children[index], flags);
|
|
352
|
+
}
|
|
353
|
+
const entries = [];
|
|
354
|
+
if (flags.paragraphs) {
|
|
355
|
+
entries.push(supportedEntry("paragraphs", "Paragraph structure is editable and round-trippable."));
|
|
356
|
+
}
|
|
357
|
+
if (flags.runs) {
|
|
358
|
+
entries.push(supportedEntry("runs", "Runs and inline text are editable through runtime commands."));
|
|
359
|
+
}
|
|
360
|
+
if (flags.whitespace) {
|
|
361
|
+
entries.push(supportedEntry("whitespace", "Whitespace-sensitive text units stay explicit in the runtime model."));
|
|
362
|
+
}
|
|
363
|
+
if (flags.headings) {
|
|
364
|
+
entries.push(supportedEntry("headings", "Heading styles remain attached to paragraph structure."));
|
|
365
|
+
}
|
|
366
|
+
if (flags.lists) {
|
|
367
|
+
entries.push(supportedEntry("lists", "Numbering metadata stays attached to paragraph blocks."));
|
|
368
|
+
}
|
|
369
|
+
if (flags.hyperlinks) {
|
|
370
|
+
entries.push(supportedEntry("hyperlinks", "Hyperlink relationships are preserved and re-serialized."));
|
|
371
|
+
}
|
|
372
|
+
if (flags.images) {
|
|
373
|
+
entries.push(supportedEntry("inline-images", "Inline image placements stay attached to preserved media parts."));
|
|
374
|
+
}
|
|
375
|
+
if (flags.tables) {
|
|
376
|
+
entries.push(
|
|
377
|
+
supportedEntry(
|
|
378
|
+
"tables",
|
|
379
|
+
"Structured tables keep cell topology and common visual properties through runtime editing and export."
|
|
380
|
+
)
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
if (flags.sections) {
|
|
384
|
+
entries.push(
|
|
385
|
+
supportedEntry(
|
|
386
|
+
"sections",
|
|
387
|
+
"Section boundaries and page-layout properties remain structured and export-safe."
|
|
388
|
+
)
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
if (flags.contentControls) {
|
|
392
|
+
entries.push(
|
|
393
|
+
supportedEntry(
|
|
394
|
+
"content-controls",
|
|
395
|
+
"Common content controls render through structured SDT state and round-trip without flattening to opaque placeholders."
|
|
396
|
+
)
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
return entries;
|
|
400
|
+
}
|
|
401
|
+
function measureBlock(block, flags) {
|
|
402
|
+
switch (block.type) {
|
|
403
|
+
case "paragraph":
|
|
404
|
+
flags.paragraphs = true;
|
|
405
|
+
if (block.styleId?.toLowerCase().startsWith("heading")) {
|
|
406
|
+
flags.headings = true;
|
|
407
|
+
}
|
|
408
|
+
if (block.numbering) {
|
|
409
|
+
flags.lists = true;
|
|
410
|
+
}
|
|
411
|
+
return measureParagraph(block, flags);
|
|
412
|
+
case "table":
|
|
413
|
+
flags.tables = true;
|
|
414
|
+
return block.rows.reduce(
|
|
415
|
+
(size, row) => size + row.cells.reduce(
|
|
416
|
+
(cellSize, cell) => cellSize + cell.children.reduce((childSize, child) => childSize + measureBlock(child, flags), 0),
|
|
417
|
+
0
|
|
418
|
+
),
|
|
419
|
+
0
|
|
420
|
+
);
|
|
421
|
+
case "sdt":
|
|
422
|
+
flags.contentControls = true;
|
|
423
|
+
return block.children.reduce((size, child) => size + measureBlock(child, flags), 0);
|
|
424
|
+
case "custom_xml":
|
|
425
|
+
return block.children.reduce((size, child) => size + measureBlock(child, flags), 0);
|
|
426
|
+
case "section_break":
|
|
427
|
+
flags.sections = true;
|
|
428
|
+
return 1;
|
|
429
|
+
default:
|
|
430
|
+
return 0;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function measureParagraph(paragraph, flags) {
|
|
434
|
+
let size = 0;
|
|
435
|
+
const children = Array.isArray(paragraph.children) ? paragraph.children : [];
|
|
436
|
+
for (const child of children) {
|
|
437
|
+
size += measureInlineNode(child, flags);
|
|
438
|
+
}
|
|
439
|
+
return size;
|
|
440
|
+
}
|
|
441
|
+
function measureInlineNode(node, flags) {
|
|
442
|
+
switch (node.type) {
|
|
443
|
+
case "text":
|
|
444
|
+
flags.runs = flags.runs || node.text.length > 0;
|
|
445
|
+
flags.whitespace = flags.whitespace || /^\s/u.test(node.text) || /\s$/u.test(node.text) || node.text.includes(" ");
|
|
446
|
+
return Array.from(node.text).length;
|
|
447
|
+
case "tab":
|
|
448
|
+
case "hard_break":
|
|
449
|
+
flags.runs = true;
|
|
450
|
+
flags.whitespace = true;
|
|
451
|
+
return 1;
|
|
452
|
+
case "hyperlink":
|
|
453
|
+
flags.runs = true;
|
|
454
|
+
flags.hyperlinks = true;
|
|
455
|
+
return node.children.reduce((size, child) => size + measureInlineNode(child, flags), 0);
|
|
456
|
+
case "image":
|
|
457
|
+
flags.images = true;
|
|
458
|
+
flags.runs = true;
|
|
459
|
+
return 1;
|
|
460
|
+
case "opaque_inline":
|
|
461
|
+
flags.runs = true;
|
|
462
|
+
return 1;
|
|
463
|
+
case "column_break":
|
|
464
|
+
case "symbol":
|
|
465
|
+
case "field":
|
|
466
|
+
case "bookmark_start":
|
|
467
|
+
case "bookmark_end":
|
|
468
|
+
case "footnote_ref":
|
|
469
|
+
case "chart_preview":
|
|
470
|
+
case "smartart_preview":
|
|
471
|
+
case "shape":
|
|
472
|
+
case "wordart":
|
|
473
|
+
case "vml_shape":
|
|
474
|
+
default:
|
|
475
|
+
flags.runs = true;
|
|
476
|
+
return 1;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function collectPreservationFeatures(document) {
|
|
480
|
+
const entries = [];
|
|
481
|
+
const structuredSubPartPaths = collectStructuredSubPartPaths(document);
|
|
482
|
+
entries.push(...collectSubPartFeatures(document));
|
|
483
|
+
for (const fragment of listOpaqueFragments(document.preservation)) {
|
|
484
|
+
const descriptor = describeOpaqueFragment(fragment);
|
|
485
|
+
entries.push({
|
|
486
|
+
featureEntryId: `feature:${fragment.fragmentId}`,
|
|
487
|
+
featureKey: descriptor.featureKey,
|
|
488
|
+
featureClass: "preserve-only",
|
|
489
|
+
message: descriptor.label,
|
|
490
|
+
affectedAnchor: createRangeAnchor(
|
|
491
|
+
fragment.lastKnownRange.from,
|
|
492
|
+
fragment.lastKnownRange.to
|
|
493
|
+
),
|
|
494
|
+
details: {
|
|
495
|
+
fragmentId: fragment.fragmentId,
|
|
496
|
+
warningId: fragment.warningId,
|
|
497
|
+
detail: descriptor.detail
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
for (const packagePart of listPreservedPackageParts(document.preservation)) {
|
|
502
|
+
if (structuredSubPartPaths.has(packagePart.packagePartName)) {
|
|
503
|
+
continue;
|
|
504
|
+
}
|
|
505
|
+
entries.push({
|
|
506
|
+
featureEntryId: `feature:package:${packagePart.packagePartName}`,
|
|
507
|
+
featureKey: "unknown-package-parts",
|
|
508
|
+
featureClass: "preserve-only",
|
|
509
|
+
message: `Preserved package part ${packagePart.packagePartName}.`,
|
|
510
|
+
details: {
|
|
511
|
+
packagePartName: packagePart.packagePartName,
|
|
512
|
+
contentType: packagePart.contentType,
|
|
513
|
+
relationshipIds: packagePart.relationshipIds
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
return entries;
|
|
518
|
+
}
|
|
519
|
+
function collectStructuredSubPartPaths(document) {
|
|
520
|
+
const subParts = document.subParts;
|
|
521
|
+
if (!subParts) {
|
|
522
|
+
return /* @__PURE__ */ new Set();
|
|
523
|
+
}
|
|
524
|
+
const paths = /* @__PURE__ */ new Set();
|
|
525
|
+
for (const header of subParts.headers ?? []) {
|
|
526
|
+
paths.add(header.partPath);
|
|
527
|
+
}
|
|
528
|
+
for (const footer of subParts.footers ?? []) {
|
|
529
|
+
paths.add(footer.partPath);
|
|
530
|
+
}
|
|
531
|
+
if (subParts.footnoteCollection) {
|
|
532
|
+
paths.add("/word/footnotes.xml");
|
|
533
|
+
paths.add("/word/endnotes.xml");
|
|
534
|
+
}
|
|
535
|
+
if (subParts.theme) {
|
|
536
|
+
paths.add("/word/theme/theme1.xml");
|
|
537
|
+
}
|
|
538
|
+
return paths;
|
|
539
|
+
}
|
|
540
|
+
function collectSubPartFeatures(document) {
|
|
541
|
+
const subParts = document.subParts;
|
|
542
|
+
if (!subParts) {
|
|
543
|
+
return [];
|
|
544
|
+
}
|
|
545
|
+
const entries = collectLossySubPartFeatures(subParts);
|
|
546
|
+
const hasHeaderFooterContent = (subParts.headers?.length ?? 0) > 0 || (subParts.footers?.length ?? 0) > 0;
|
|
547
|
+
const noteCount = Object.keys(subParts.footnoteCollection?.footnotes ?? {}).length + Object.keys(subParts.footnoteCollection?.endnotes ?? {}).length;
|
|
548
|
+
if (hasHeaderFooterContent && !entries.some((entry) => entry.featureKey === "headers-footers-lossy")) {
|
|
549
|
+
entries.push({
|
|
550
|
+
featureEntryId: "feature:subparts:headers-footers",
|
|
551
|
+
featureKey: "headers-footers",
|
|
552
|
+
featureClass: "supported-roundtrip",
|
|
553
|
+
message: "Headers and footers resolve as structured secondary stories with export-safe ownership.",
|
|
554
|
+
details: {
|
|
555
|
+
headerCount: subParts.headers?.length ?? 0,
|
|
556
|
+
footerCount: subParts.footers?.length ?? 0
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
if (noteCount > 0 && !entries.some((entry) => entry.featureKey === "notes-lossy")) {
|
|
561
|
+
entries.push({
|
|
562
|
+
featureEntryId: "feature:subparts:notes",
|
|
563
|
+
featureKey: "notes",
|
|
564
|
+
featureClass: "supported-roundtrip",
|
|
565
|
+
message: "Footnotes and endnotes resolve as structured secondary stories with export-safe ownership.",
|
|
566
|
+
details: {
|
|
567
|
+
footnoteCount: Object.keys(subParts.footnoteCollection?.footnotes ?? {}).length,
|
|
568
|
+
endnoteCount: Object.keys(subParts.footnoteCollection?.endnotes ?? {}).length
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
if (subParts.theme) {
|
|
573
|
+
entries.push({
|
|
574
|
+
featureEntryId: "feature:subparts:theme",
|
|
575
|
+
featureKey: "unknown-package-parts",
|
|
576
|
+
featureClass: "preserve-only",
|
|
577
|
+
message: "Theme metadata is preserved through structured sub-part ownership.",
|
|
578
|
+
details: {
|
|
579
|
+
surface: "theme-subpart",
|
|
580
|
+
themeName: subParts.theme.name
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
return entries;
|
|
585
|
+
}
|
|
586
|
+
function collectLossySubPartFeatures(subParts) {
|
|
587
|
+
const entries = [];
|
|
588
|
+
const headerFooterLossy = [
|
|
589
|
+
...(subParts.headers ?? []).flatMap(
|
|
590
|
+
(header) => collectLossyBlocks(header.blocks, `header:${header.partPath}`)
|
|
591
|
+
),
|
|
592
|
+
...(subParts.footers ?? []).flatMap(
|
|
593
|
+
(footer) => collectLossyBlocks(footer.blocks, `footer:${footer.partPath}`)
|
|
594
|
+
)
|
|
595
|
+
];
|
|
596
|
+
if (headerFooterLossy.length > 0) {
|
|
597
|
+
entries.push({
|
|
598
|
+
featureEntryId: "feature:subparts:headers-footers-lossy",
|
|
599
|
+
featureKey: "headers-footers-lossy",
|
|
600
|
+
featureClass: "unsupported-fatal",
|
|
601
|
+
message: "Headers or footers contain content the current sub-part serializer cannot re-emit safely.",
|
|
602
|
+
details: {
|
|
603
|
+
issues: headerFooterLossy
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
const noteLossy = [
|
|
608
|
+
...Object.values(subParts.footnoteCollection?.footnotes ?? {}).flatMap(
|
|
609
|
+
(note) => collectLossyBlocks(note.blocks, `footnote:${note.noteId}`)
|
|
610
|
+
),
|
|
611
|
+
...Object.values(subParts.footnoteCollection?.endnotes ?? {}).flatMap(
|
|
612
|
+
(note) => collectLossyBlocks(note.blocks, `endnote:${note.noteId}`)
|
|
613
|
+
)
|
|
614
|
+
];
|
|
615
|
+
if (noteLossy.length > 0) {
|
|
616
|
+
entries.push({
|
|
617
|
+
featureEntryId: "feature:subparts:notes-lossy",
|
|
618
|
+
featureKey: "notes-lossy",
|
|
619
|
+
featureClass: "unsupported-fatal",
|
|
620
|
+
message: "Footnotes or endnotes contain content the current sub-part serializer cannot re-emit safely.",
|
|
621
|
+
details: {
|
|
622
|
+
issues: noteLossy
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
return entries;
|
|
627
|
+
}
|
|
628
|
+
function collectLossyBlocks(blocks, surface) {
|
|
629
|
+
const issues = [];
|
|
630
|
+
for (const block of blocks) {
|
|
631
|
+
if (block.type === "table") {
|
|
632
|
+
for (const row of block.rows) {
|
|
633
|
+
for (const cell of row.cells) {
|
|
634
|
+
issues.push(...collectLossyBlocks(cell.children, `${surface}:table-cell`));
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
if (block.type !== "paragraph") {
|
|
640
|
+
issues.push(`${surface}:${block.type}`);
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
if (block.numbering !== void 0 || block.keepNext !== void 0 || block.keepLines !== void 0 || block.outlineLevel !== void 0 || block.pageBreakBefore !== void 0 || block.widowControl !== void 0 || block.borders !== void 0 || block.shading !== void 0 || block.bidi !== void 0 || block.suppressLineNumbers !== void 0 || block.cnfStyle !== void 0) {
|
|
644
|
+
issues.push(`${surface}:paragraph-properties`);
|
|
645
|
+
}
|
|
646
|
+
for (const child of block.children) {
|
|
647
|
+
issues.push(...collectLossyInlineContent(child, surface));
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
return [...new Set(issues)];
|
|
651
|
+
}
|
|
652
|
+
function collectLossyInlineContent(node, surface) {
|
|
653
|
+
switch (node.type) {
|
|
654
|
+
case "text": {
|
|
655
|
+
const allowSecondaryStoryColorMarks = surface.startsWith("header:") || surface.startsWith("footer:");
|
|
656
|
+
const unsupportedMarks = (node.marks ?? []).filter(
|
|
657
|
+
(mark) => mark.type !== "bold" && mark.type !== "italic" && mark.type !== "underline" && mark.type !== "strikethrough" && mark.type !== "doubleStrikethrough" && mark.type !== "fontFamily" && mark.type !== "fontSize" && mark.type !== "textColor" && (!allowSecondaryStoryColorMarks || mark.type !== "backgroundColor") && (!allowSecondaryStoryColorMarks || mark.type !== "highlight") && mark.type !== "smallCaps" && mark.type !== "allCaps"
|
|
658
|
+
).map((mark) => `${surface}:mark:${mark.type}`);
|
|
659
|
+
return unsupportedMarks;
|
|
660
|
+
}
|
|
661
|
+
case "tab":
|
|
662
|
+
case "hard_break":
|
|
663
|
+
case "footnote_ref":
|
|
664
|
+
case "field":
|
|
665
|
+
case "bookmark_start":
|
|
666
|
+
case "bookmark_end":
|
|
667
|
+
case "shape":
|
|
668
|
+
case "wordart":
|
|
669
|
+
case "vml_shape":
|
|
670
|
+
case "chart_preview":
|
|
671
|
+
case "smartart_preview":
|
|
672
|
+
return [];
|
|
673
|
+
default:
|
|
674
|
+
return [`${surface}:${node.type}`];
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function collectDiagnosticWarnings(document) {
|
|
678
|
+
const diagnostics = Array.isArray(document.diagnostics?.warnings) ? document.diagnostics.warnings : [];
|
|
679
|
+
return diagnostics.map((warning) => ({
|
|
680
|
+
warningId: warning.warningId,
|
|
681
|
+
code: warning.source === "validation" || warning.source === "export" ? "export_roundtrip_risk" : warning.source === "preservation" ? "unsupported_ooxml_preserved" : "import_normalized",
|
|
682
|
+
severity: "warning",
|
|
683
|
+
message: warning.message,
|
|
684
|
+
source: warning.source
|
|
685
|
+
}));
|
|
686
|
+
}
|
|
687
|
+
function collectDiagnosticErrors(document) {
|
|
688
|
+
const diagnostics = Array.isArray(document.diagnostics?.errors) ? document.diagnostics.errors : [];
|
|
689
|
+
return diagnostics.map((error) => ({
|
|
690
|
+
errorId: error.diagnosticId,
|
|
691
|
+
code: error.code === "load_failed" ? "import_failed" : error.code,
|
|
692
|
+
message: error.message,
|
|
693
|
+
isFatal: error.isFatal,
|
|
694
|
+
source: error.source
|
|
695
|
+
}));
|
|
696
|
+
}
|
|
697
|
+
function supportedEntry(featureKey, message) {
|
|
698
|
+
return {
|
|
699
|
+
featureEntryId: `feature:${featureKey}`,
|
|
700
|
+
featureKey,
|
|
701
|
+
featureClass: "supported-roundtrip",
|
|
702
|
+
message
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
function dedupeWarnings(warnings) {
|
|
706
|
+
const byId = /* @__PURE__ */ new Map();
|
|
707
|
+
for (const warning of warnings) {
|
|
708
|
+
byId.set(warning.warningId, warning);
|
|
709
|
+
}
|
|
710
|
+
return [...byId.values()];
|
|
711
|
+
}
|
|
712
|
+
function dedupeErrors(errors) {
|
|
713
|
+
const byId = /* @__PURE__ */ new Map();
|
|
714
|
+
for (const error of errors) {
|
|
715
|
+
byId.set(error.errorId, error);
|
|
716
|
+
}
|
|
717
|
+
return [...byId.values()];
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// src/validation/diagnostics.ts
|
|
721
|
+
var EXPORT_BLOCKING_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
722
|
+
"import_failed",
|
|
723
|
+
"export_failed",
|
|
724
|
+
"package_corrupt",
|
|
725
|
+
"validation_failed"
|
|
726
|
+
]);
|
|
727
|
+
function createDiagnostics(input = {}) {
|
|
728
|
+
return {
|
|
729
|
+
featureEntries: freezeArray(input.featureEntries ?? []),
|
|
730
|
+
warnings: freezeArray(input.warnings ?? []),
|
|
731
|
+
errors: freezeArray(input.errors ?? [])
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
function diagnosticsBlockExport(diagnostics, explicitBlockExport = false) {
|
|
735
|
+
if (explicitBlockExport) {
|
|
736
|
+
return true;
|
|
737
|
+
}
|
|
738
|
+
return diagnostics.featureEntries.some(
|
|
739
|
+
(entry) => entry.featureClass === "unsupported-fatal"
|
|
740
|
+
) || diagnostics.errors.some(
|
|
741
|
+
(error) => error.isFatal || EXPORT_BLOCKING_ERROR_CODES.has(error.code)
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
function freezeArray(items) {
|
|
745
|
+
return Object.freeze([...items]);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
export {
|
|
749
|
+
EDITOR_SESSION_STATE_VERSION,
|
|
750
|
+
createEditorSessionState,
|
|
751
|
+
editorSessionStateFromPersistedSnapshot,
|
|
752
|
+
persistedSnapshotFromEditorSessionState,
|
|
753
|
+
createRevisionRangeAnchor,
|
|
754
|
+
getRevisionActionability,
|
|
755
|
+
createRevisionRecord,
|
|
756
|
+
setRevisionStatus,
|
|
757
|
+
remapRevisionStore,
|
|
758
|
+
createRevisionSidebarProjection,
|
|
759
|
+
buildCompatibilityReport,
|
|
760
|
+
createDiagnostics,
|
|
761
|
+
diagnosticsBlockExport
|
|
762
|
+
};
|
|
763
|
+
//# sourceMappingURL=chunk-2FJS5GZM.js.map
|