@beyondwork/docx-react-component 1.0.29 → 1.0.31
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/package.json +65 -96
- package/src/README.md +85 -0
- package/src/api/README.md +26 -0
- package/src/api/public-types.ts +1952 -0
- package/src/api/session-state.ts +62 -0
- package/src/compare/diff-engine.ts +623 -0
- package/src/compare/export-redlines.ts +280 -0
- package/src/compare/index.ts +25 -0
- package/src/compare/snapshot.ts +97 -0
- package/src/component-inventory.md +99 -0
- package/src/core/README.md +10 -0
- package/src/core/commands/README.md +3 -0
- package/{dist/chunk-TJBP2K4T.js → src/core/commands/formatting-commands.ts} +536 -196
- package/src/core/commands/image-commands.ts +373 -0
- package/src/core/commands/index.ts +1879 -0
- package/src/core/commands/list-commands.ts +565 -0
- package/src/core/commands/paragraph-layout-commands.ts +339 -0
- package/src/core/commands/review-commands.ts +108 -0
- package/{dist/core/commands/section-layout-commands.cjs → src/core/commands/section-layout-commands.ts} +340 -137
- package/src/core/commands/structural-helpers.ts +309 -0
- package/{dist/core/commands/style-commands.cjs → src/core/commands/style-commands.ts} +113 -65
- package/src/core/commands/table-structure-commands.ts +854 -0
- package/{dist/chunk-UZXBISGO.js → src/core/commands/text-commands.ts} +142 -86
- package/src/core/schema/README.md +3 -0
- package/src/core/schema/text-schema.ts +516 -0
- package/src/core/search/search-text.ts +357 -0
- package/src/core/selection/README.md +3 -0
- package/src/core/selection/mapping.ts +289 -0
- package/src/core/selection/review-anchors.ts +183 -0
- package/src/core/state/README.md +3 -0
- package/src/core/state/editor-state.ts +892 -0
- package/src/core/state/text-transaction.ts +869 -0
- package/src/formats/xlsx/io/parse-shared-strings.ts +41 -0
- package/src/formats/xlsx/io/parse-sheet.ts +459 -0
- package/src/formats/xlsx/io/parse-styles.ts +59 -0
- package/src/formats/xlsx/io/parse-workbook.ts +75 -0
- package/src/formats/xlsx/io/serialize-shared-strings.ts +72 -0
- package/src/formats/xlsx/io/serialize-sheet.ts +333 -0
- package/src/formats/xlsx/io/serialize-styles.ts +98 -0
- package/src/formats/xlsx/io/serialize-workbook.ts +429 -0
- package/src/formats/xlsx/io/xlsx-session.ts +314 -0
- package/src/formats/xlsx/model/cell.ts +189 -0
- package/src/formats/xlsx/model/sheet.ts +326 -0
- package/src/formats/xlsx/model/styles.ts +118 -0
- package/src/formats/xlsx/model/workbook.ts +453 -0
- package/src/formats/xlsx/runtime/cell-commands.ts +567 -0
- package/src/formats/xlsx/runtime/sheet-commands.ts +206 -0
- package/src/formats/xlsx/runtime/workbook-runtime.ts +177 -0
- package/src/formats/xlsx/runtime/workbook-transaction.ts +822 -0
- package/src/index.ts +142 -0
- package/src/io/README.md +10 -0
- package/src/io/docx-session.ts +3175 -0
- package/src/io/export/README.md +3 -0
- package/src/io/export/export-session.ts +220 -0
- package/src/io/export/minimal-docx.ts +115 -0
- package/src/io/export/reattach-preserved-parts.ts +54 -0
- package/src/io/export/serialize-comments.ts +947 -0
- package/src/io/export/serialize-footnotes.ts +394 -0
- package/src/io/export/serialize-headers-footers.ts +368 -0
- package/src/io/export/serialize-main-document.ts +1342 -0
- package/src/io/export/serialize-numbering.ts +218 -0
- package/src/io/export/serialize-revisions.ts +389 -0
- package/src/io/export/serialize-runtime-revisions.ts +463 -0
- package/src/io/export/serialize-tables.ts +174 -0
- package/src/io/export/split-review-boundaries.ts +356 -0
- package/src/io/export/split-story-blocks-for-runtime-revisions.ts +252 -0
- package/src/io/export/table-properties-xml.ts +318 -0
- package/src/io/normalize/README.md +3 -0
- package/src/io/normalize/normalize-text.ts +670 -0
- package/src/io/ooxml/README.md +3 -0
- package/src/io/ooxml/highlight-colors.ts +39 -0
- package/src/io/ooxml/numbering-sentinels.ts +44 -0
- package/src/io/ooxml/parse-comments.ts +852 -0
- package/src/io/ooxml/parse-complex-content.ts +287 -0
- package/src/io/ooxml/parse-fields.ts +834 -0
- package/src/io/ooxml/parse-footnotes.ts +952 -0
- package/src/io/ooxml/parse-headers-footers.ts +1212 -0
- package/src/io/ooxml/parse-inline-media.ts +461 -0
- package/src/io/ooxml/parse-main-document.ts +2947 -0
- package/src/io/ooxml/parse-numbering.ts +747 -0
- package/src/io/ooxml/parse-revisions.ts +1045 -0
- package/src/io/ooxml/parse-settings.ts +184 -0
- package/src/io/ooxml/parse-shapes.ts +296 -0
- package/src/io/ooxml/parse-styles.ts +639 -0
- package/src/io/ooxml/parse-tables.ts +627 -0
- package/src/io/ooxml/parse-theme.ts +346 -0
- package/src/io/ooxml/part-manifest.ts +136 -0
- package/src/io/ooxml/revision-boundaries.ts +475 -0
- package/src/io/ooxml/workflow-payload.ts +544 -0
- package/src/io/opc/README.md +3 -0
- package/src/io/opc/corrupt-package.ts +166 -0
- package/src/io/opc/docx-package.ts +74 -0
- package/src/io/opc/package-reader.ts +325 -0
- package/src/io/opc/package-writer.ts +273 -0
- package/src/io/source-package-provenance.ts +241 -0
- package/{dist/chunk-RMH72RZI.js → src/legal/bookmarks.ts} +130 -44
- package/src/legal/cross-references.ts +414 -0
- package/src/legal/defined-terms.ts +203 -0
- package/src/legal/index.ts +32 -0
- package/src/legal/signature-blocks.ts +259 -0
- package/src/model/README.md +3 -0
- package/src/model/canonical-document.ts +2722 -0
- package/src/model/cds-1.0.0.ts +212 -0
- package/src/model/snapshot.ts +760 -0
- package/src/preservation/README.md +3 -0
- package/src/preservation/markup-compatibility.ts +48 -0
- package/src/preservation/opaque-fragment-store.ts +89 -0
- package/src/preservation/opaque-region.ts +233 -0
- package/src/preservation/package-preservation.ts +113 -0
- package/src/preservation/preserved-part-manifest.ts +56 -0
- package/src/preservation/relationship-retention.ts +57 -0
- package/src/preservation/store.ts +255 -0
- package/src/review/README.md +16 -0
- package/src/review/store/README.md +3 -0
- package/src/review/store/comment-anchors.ts +70 -0
- package/src/review/store/comment-remapping.ts +154 -0
- package/src/review/store/comment-store.ts +349 -0
- package/src/review/store/comment-thread.ts +109 -0
- package/src/review/store/revision-actions.ts +423 -0
- package/src/review/store/revision-store.ts +323 -0
- package/src/review/store/revision-types.ts +182 -0
- package/src/review/store/runtime-comment-store.ts +43 -0
- package/src/runtime/README.md +3 -0
- package/src/runtime/ai-action-policy.ts +764 -0
- package/src/runtime/context-analytics.ts +824 -0
- package/src/runtime/document-layout.ts +332 -0
- package/src/runtime/document-locations.ts +521 -0
- package/src/runtime/document-navigation.ts +616 -0
- package/src/runtime/document-outline.ts +440 -0
- package/src/runtime/document-runtime.ts +4055 -0
- package/src/runtime/document-search.ts +145 -0
- package/src/runtime/event-refresh-hints.ts +137 -0
- package/src/runtime/numbering-prefix.ts +244 -0
- package/src/runtime/page-layout-estimation.ts +305 -0
- package/src/runtime/read-only-diagnostics-runtime.ts +241 -0
- package/src/runtime/resolved-numbering-geometry.ts +293 -0
- package/src/runtime/review-runtime.ts +44 -0
- package/src/runtime/revision-runtime.ts +107 -0
- package/src/runtime/session-capabilities.ts +192 -0
- package/src/runtime/story-context.ts +164 -0
- package/src/runtime/story-targeting.ts +162 -0
- package/src/runtime/suggestions-snapshot.ts +137 -0
- package/src/runtime/surface-projection.ts +1553 -0
- package/src/runtime/table-commands.ts +173 -0
- package/src/runtime/table-schema.ts +309 -0
- package/src/runtime/table-style-resolver.ts +409 -0
- package/src/runtime/view-state.ts +493 -0
- package/src/runtime/virtualized-rendering.ts +258 -0
- package/src/runtime/workflow-markup.ts +393 -0
- package/src/ui/README.md +30 -0
- package/src/ui/WordReviewEditor.tsx +5268 -0
- package/src/ui/browser-export.ts +52 -0
- package/src/ui/comments/README.md +3 -0
- package/src/ui/compatibility/README.md +3 -0
- package/src/ui/editor-command-bag.ts +127 -0
- package/src/ui/editor-runtime-boundary.ts +1558 -0
- package/src/ui/editor-shell-view.tsx +144 -0
- package/src/ui/editor-surface/README.md +3 -0
- package/src/ui/editor-surface-controller.tsx +66 -0
- package/src/ui/headless/comment-decoration-model.ts +124 -0
- package/src/ui/headless/preserve-editor-selection.ts +5 -0
- package/src/ui/headless/revision-decoration-model.ts +128 -0
- package/src/ui/headless/selection-helpers.ts +54 -0
- package/src/ui/headless/selection-tool-context.ts +19 -0
- package/src/ui/headless/selection-tool-resolver.ts +752 -0
- package/src/ui/headless/selection-tool-types.ts +129 -0
- package/src/ui/headless/selection-toolbar-model.ts +11 -0
- package/src/ui/headless/use-editor-keyboard.ts +103 -0
- package/src/ui/review/README.md +3 -0
- package/src/ui/runtime-shortcut-dispatch.ts +365 -0
- package/src/ui/runtime-snapshot-selectors.ts +197 -0
- package/src/ui/shared/revision-filters.ts +31 -0
- package/src/ui/status/README.md +3 -0
- package/src/ui/theme/README.md +3 -0
- package/src/ui/toolbar/README.md +3 -0
- package/src/ui/workflow-surface-blocked-rails.ts +94 -0
- package/src/ui-tailwind/chrome/chrome-preset-model.ts +107 -0
- package/src/ui-tailwind/chrome/chrome-preset-toolbar.tsx +15 -0
- package/src/ui-tailwind/chrome/responsive-chrome.ts +46 -0
- package/src/ui-tailwind/chrome/review-queue-bar.tsx +97 -0
- package/src/ui-tailwind/chrome/tw-alert-banner.tsx +64 -0
- package/src/ui-tailwind/chrome/tw-context-analytics-summary.tsx +122 -0
- package/src/ui-tailwind/chrome/tw-image-context-toolbar.tsx +121 -0
- package/src/ui-tailwind/chrome/tw-layout-panel.tsx +114 -0
- package/src/ui-tailwind/chrome/tw-object-context-toolbar.tsx +30 -0
- package/src/ui-tailwind/chrome/tw-page-ruler.tsx +365 -0
- package/src/ui-tailwind/chrome/tw-selection-tool-blocked.tsx +23 -0
- package/src/ui-tailwind/chrome/tw-selection-tool-comment.tsx +35 -0
- package/src/ui-tailwind/chrome/tw-selection-tool-formatting.tsx +37 -0
- package/src/ui-tailwind/chrome/tw-selection-tool-host.tsx +303 -0
- package/src/ui-tailwind/chrome/tw-selection-tool-structure.tsx +116 -0
- package/src/ui-tailwind/chrome/tw-selection-tool-suggestion.tsx +29 -0
- package/src/ui-tailwind/chrome/tw-selection-tool-workflow.tsx +27 -0
- package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +186 -0
- package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +139 -0
- package/src/ui-tailwind/chrome/tw-table-context-toolbar.tsx +250 -0
- package/src/ui-tailwind/chrome/tw-unsaved-modal.tsx +58 -0
- package/src/ui-tailwind/chrome/use-before-unload.ts +20 -0
- package/src/ui-tailwind/editor-surface/perf-probe.ts +179 -0
- package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +189 -0
- package/src/ui-tailwind/editor-surface/pm-contextual-ui.ts +31 -0
- package/src/ui-tailwind/editor-surface/pm-decorations.ts +411 -0
- package/src/ui-tailwind/editor-surface/pm-position-map.ts +123 -0
- package/src/ui-tailwind/editor-surface/pm-schema.ts +927 -0
- package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +567 -0
- package/src/ui-tailwind/editor-surface/search-plugin.ts +168 -0
- package/src/ui-tailwind/editor-surface/surface-build-keys.ts +63 -0
- package/src/ui-tailwind/editor-surface/tw-caret.tsx +12 -0
- package/src/ui-tailwind/editor-surface/tw-editor-surface.tsx +150 -0
- package/src/ui-tailwind/editor-surface/tw-inline-token.tsx +129 -0
- package/src/ui-tailwind/editor-surface/tw-opaque-block.tsx +58 -0
- package/src/ui-tailwind/editor-surface/tw-paragraph-block.tsx +151 -0
- package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +1047 -0
- package/src/ui-tailwind/editor-surface/tw-segment-view.tsx +111 -0
- package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +503 -0
- package/src/ui-tailwind/index.ts +62 -0
- package/src/ui-tailwind/page-chrome-model.ts +27 -0
- package/src/ui-tailwind/review/tw-comment-sidebar.tsx +406 -0
- package/src/ui-tailwind/review/tw-health-panel.tsx +149 -0
- package/src/ui-tailwind/review/tw-review-rail.tsx +130 -0
- package/src/ui-tailwind/review/tw-revision-sidebar.tsx +164 -0
- package/src/ui-tailwind/status/tw-status-bar.tsx +65 -0
- package/{dist → src}/ui-tailwind/theme/editor-theme.css +58 -40
- package/src/ui-tailwind/toolbar/toolbar-layout.ts +47 -0
- package/src/ui-tailwind/toolbar/tw-toolbar-icon-button.tsx +52 -0
- package/src/ui-tailwind/toolbar/tw-toolbar.tsx +1478 -0
- package/src/ui-tailwind/tw-review-workspace.tsx +1587 -0
- package/src/validation/README.md +3 -0
- package/src/validation/compatibility-engine.ts +878 -0
- package/src/validation/compatibility-report.ts +161 -0
- package/src/validation/diagnostics.ts +204 -0
- package/src/validation/docx-comment-proof.ts +720 -0
- package/src/validation/import-diagnostics.ts +128 -0
- package/src/validation/low-priority-word-surfaces.ts +373 -0
- package/dist/canonical-document-BLEbzL2J.d.cts +0 -844
- package/dist/canonical-document-BLEbzL2J.d.ts +0 -844
- package/dist/chunk-2FJS5GZM.js +0 -763
- package/dist/chunk-2FJS5GZM.js.map +0 -1
- package/dist/chunk-2OQBZS3F.js +0 -446
- package/dist/chunk-2OQBZS3F.js.map +0 -1
- package/dist/chunk-2S7W4KFO.js +0 -127
- package/dist/chunk-2S7W4KFO.js.map +0 -1
- package/dist/chunk-2TG72QSW.js +0 -3874
- package/dist/chunk-2TG72QSW.js.map +0 -1
- package/dist/chunk-36QNIZBO.js +0 -532
- package/dist/chunk-36QNIZBO.js.map +0 -1
- package/dist/chunk-4AQOYAW4.js +0 -3069
- package/dist/chunk-4AQOYAW4.js.map +0 -1
- package/dist/chunk-4D5EWJ3P.js +0 -77
- package/dist/chunk-4D5EWJ3P.js.map +0 -1
- package/dist/chunk-5FN54NDH.js +0 -2257
- package/dist/chunk-5FN54NDH.js.map +0 -1
- package/dist/chunk-BOYGQYRQ.js +0 -7306
- package/dist/chunk-BOYGQYRQ.js.map +0 -1
- package/dist/chunk-CN3XMECL.js +0 -212
- package/dist/chunk-CN3XMECL.js.map +0 -1
- package/dist/chunk-EBI3BX6U.js +0 -164
- package/dist/chunk-EBI3BX6U.js.map +0 -1
- package/dist/chunk-EILUG3VB.js +0 -1275
- package/dist/chunk-EILUG3VB.js.map +0 -1
- package/dist/chunk-FUDY333O.js +0 -70
- package/dist/chunk-FUDY333O.js.map +0 -1
- package/dist/chunk-GBVOWFIK.js +0 -1237
- package/dist/chunk-GBVOWFIK.js.map +0 -1
- package/dist/chunk-H4TQ3H3Y.js +0 -262
- package/dist/chunk-H4TQ3H3Y.js.map +0 -1
- package/dist/chunk-JGB3IXZO.js +0 -189
- package/dist/chunk-JGB3IXZO.js.map +0 -1
- package/dist/chunk-KD2QRQPY.js +0 -4342
- package/dist/chunk-KD2QRQPY.js.map +0 -1
- package/dist/chunk-KLMXQVYK.js +0 -369
- package/dist/chunk-KLMXQVYK.js.map +0 -1
- package/dist/chunk-KZUG5KFQ.js +0 -214
- package/dist/chunk-KZUG5KFQ.js.map +0 -1
- package/dist/chunk-QDAQ4CJU.js +0 -345
- package/dist/chunk-QDAQ4CJU.js.map +0 -1
- package/dist/chunk-RMH72RZI.js.map +0 -1
- package/dist/chunk-SWKWQZXM.js +0 -117
- package/dist/chunk-SWKWQZXM.js.map +0 -1
- package/dist/chunk-TJBP2K4T.js.map +0 -1
- package/dist/chunk-TLCEAQDQ.js +0 -542
- package/dist/chunk-TLCEAQDQ.js.map +0 -1
- package/dist/chunk-UZXBISGO.js.map +0 -1
- package/dist/chunk-WGBAKP3Q.js +0 -3220
- package/dist/chunk-WGBAKP3Q.js.map +0 -1
- package/dist/compare/index.cjs +0 -5475
- package/dist/compare/index.cjs.map +0 -1
- package/dist/compare/index.d.cts +0 -114
- package/dist/compare/index.d.ts +0 -114
- package/dist/compare/index.js +0 -731
- package/dist/compare/index.js.map +0 -1
- package/dist/core/commands/formatting-commands.cjs +0 -828
- package/dist/core/commands/formatting-commands.cjs.map +0 -1
- package/dist/core/commands/formatting-commands.d.cts +0 -63
- package/dist/core/commands/formatting-commands.d.ts +0 -63
- package/dist/core/commands/formatting-commands.js +0 -37
- package/dist/core/commands/formatting-commands.js.map +0 -1
- package/dist/core/commands/image-commands.cjs +0 -2023
- package/dist/core/commands/image-commands.cjs.map +0 -1
- package/dist/core/commands/image-commands.d.cts +0 -58
- package/dist/core/commands/image-commands.d.ts +0 -58
- package/dist/core/commands/image-commands.js +0 -18
- package/dist/core/commands/image-commands.js.map +0 -1
- package/dist/core/commands/section-layout-commands.cjs.map +0 -1
- package/dist/core/commands/section-layout-commands.d.cts +0 -62
- package/dist/core/commands/section-layout-commands.d.ts +0 -62
- package/dist/core/commands/section-layout-commands.js +0 -21
- package/dist/core/commands/section-layout-commands.js.map +0 -1
- package/dist/core/commands/style-commands.cjs.map +0 -1
- package/dist/core/commands/style-commands.d.cts +0 -13
- package/dist/core/commands/style-commands.d.ts +0 -13
- package/dist/core/commands/style-commands.js +0 -9
- package/dist/core/commands/style-commands.js.map +0 -1
- package/dist/core/commands/table-structure-commands.cjs +0 -1883
- package/dist/core/commands/table-structure-commands.cjs.map +0 -1
- package/dist/core/commands/table-structure-commands.d.cts +0 -59
- package/dist/core/commands/table-structure-commands.d.ts +0 -59
- package/dist/core/commands/table-structure-commands.js +0 -12
- package/dist/core/commands/table-structure-commands.js.map +0 -1
- package/dist/core/commands/text-commands.cjs +0 -2391
- package/dist/core/commands/text-commands.cjs.map +0 -1
- package/dist/core/commands/text-commands.d.cts +0 -24
- package/dist/core/commands/text-commands.d.ts +0 -24
- package/dist/core/commands/text-commands.js +0 -28
- package/dist/core/commands/text-commands.js.map +0 -1
- package/dist/core/selection/mapping.cjs +0 -200
- package/dist/core/selection/mapping.cjs.map +0 -1
- package/dist/core/selection/mapping.d.cts +0 -2
- package/dist/core/selection/mapping.d.ts +0 -2
- package/dist/core/selection/mapping.js +0 -31
- package/dist/core/selection/mapping.js.map +0 -1
- package/dist/core/state/editor-state.cjs +0 -2278
- package/dist/core/state/editor-state.cjs.map +0 -1
- package/dist/core/state/editor-state.d.cts +0 -2
- package/dist/core/state/editor-state.d.ts +0 -2
- package/dist/core/state/editor-state.js +0 -26
- package/dist/core/state/editor-state.js.map +0 -1
- package/dist/index.cjs +0 -38553
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -15
- package/dist/index.d.ts +0 -15
- package/dist/index.js +0 -7856
- package/dist/index.js.map +0 -1
- package/dist/io/docx-session.cjs +0 -16236
- package/dist/io/docx-session.cjs.map +0 -1
- package/dist/io/docx-session.d.cts +0 -21
- package/dist/io/docx-session.d.ts +0 -21
- package/dist/io/docx-session.js +0 -18
- package/dist/io/docx-session.js.map +0 -1
- package/dist/legal/index.cjs +0 -3900
- package/dist/legal/index.cjs.map +0 -1
- package/dist/legal/index.d.cts +0 -86
- package/dist/legal/index.d.ts +0 -86
- package/dist/legal/index.js +0 -616
- package/dist/legal/index.js.map +0 -1
- package/dist/public-types-7ZL_94cz.d.ts +0 -1573
- package/dist/public-types-CeMaDueh.d.cts +0 -1573
- package/dist/public-types.cjs +0 -19
- package/dist/public-types.cjs.map +0 -1
- package/dist/public-types.d.cts +0 -2
- package/dist/public-types.d.ts +0 -2
- package/dist/public-types.js +0 -1
- package/dist/public-types.js.map +0 -1
- package/dist/runtime/document-runtime.cjs +0 -11140
- package/dist/runtime/document-runtime.cjs.map +0 -1
- package/dist/runtime/document-runtime.d.cts +0 -231
- package/dist/runtime/document-runtime.d.ts +0 -231
- package/dist/runtime/document-runtime.js +0 -21
- package/dist/runtime/document-runtime.js.map +0 -1
- package/dist/structural-helpers-CilgOVhh.d.cts +0 -10
- package/dist/structural-helpers-q0Gd-eBN.d.ts +0 -10
- package/dist/ui-tailwind/editor-surface/search-plugin.cjs +0 -313
- package/dist/ui-tailwind/editor-surface/search-plugin.cjs.map +0 -1
- package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +0 -67
- package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +0 -67
- package/dist/ui-tailwind/editor-surface/search-plugin.js +0 -23
- package/dist/ui-tailwind/editor-surface/search-plugin.js.map +0 -1
- package/dist/ui-tailwind/index.cjs +0 -4833
- package/dist/ui-tailwind/index.cjs.map +0 -1
- package/dist/ui-tailwind/index.d.cts +0 -617
- package/dist/ui-tailwind/index.d.ts +0 -617
- package/dist/ui-tailwind/index.js +0 -575
- package/dist/ui-tailwind/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/commands/section-layout-commands.ts"],"sourcesContent":["/**\n * Section layout authoring commands.\n *\n * Supports inserting and deleting section breaks, bounded section layout\n * updates (page size, margins, gutter, orientation, columns, first-page /\n * odd-even variants, page-numbering restart / format), and section break\n * deletion with following-section merge semantics.\n *\n * All mutations are command-backed and export-safe.\n */\nimport type {\n RuntimeRenderSnapshot,\n SelectionSnapshot,\n} from \"../../api/public-types\";\nimport type {\n CanonicalDocument as CanonicalDocumentEnvelope,\n ColumnProperties,\n PageMargins,\n PageNumbering,\n PageSize,\n SectionBreakNode,\n SectionProperties,\n} from \"../../model/canonical-document.ts\";\n\n// ---- Public types ----\n\nexport interface SectionLayoutCommandContext {\n timestamp: string;\n}\n\nexport interface SectionLayoutMutationResult {\n document: CanonicalDocumentEnvelope;\n selection: SelectionSnapshot;\n changed: boolean;\n}\n\nexport type SectionBreakType =\n | \"nextPage\"\n | \"continuous\"\n | \"evenPage\"\n | \"oddPage\"\n | \"nextColumn\";\n\nexport interface SectionLayoutPatch {\n pageSize?: Partial<PageSize>;\n pageMargins?: Partial<PageMargins>;\n columns?: Partial<ColumnProperties>;\n pageNumbering?: Partial<PageNumbering>;\n titlePage?: boolean;\n sectionType?: SectionBreakType;\n}\n\nexport interface SectionLinkPatch {\n kind: \"header\" | \"footer\";\n variant: \"default\" | \"first\" | \"even\";\n linkToPrevious: boolean;\n relationshipId?: string | null;\n}\n\n// ---- Insert section break ----\n\n/**\n * Insert a section break at the current selection position.\n * The new section inherits properties from the section that contained the\n * insertion point (the *following* section keeps its own properties).\n */\nexport function insertSectionBreak(\n document: CanonicalDocumentEnvelope,\n snapshot: RuntimeRenderSnapshot,\n breakType: SectionBreakType,\n _context: SectionLayoutCommandContext,\n): SectionLayoutMutationResult {\n const cloned = structuredClone(document) as CanonicalDocumentEnvelope;\n const surface = snapshot.surface;\n\n if (!surface) {\n return noopResult(document, snapshot.selection);\n }\n\n const position = snapshot.selection.head;\n const blockIndex = resolveBlockIndexForPosition(surface.blocks, position);\n\n if (blockIndex < 0) {\n return noopResult(document, snapshot.selection);\n }\n\n const sectionTarget = resolveSectionTarget(cloned, surface.blocks, position);\n const inheritedProperties = cloneSectionProperties(sectionTarget?.properties);\n const sectionBreak: SectionBreakNode = {\n type: \"section_break\",\n sectionProperties: {\n ...inheritedProperties,\n sectionType: breakType,\n },\n };\n\n cloned.content.children.splice(blockIndex + 1, 0, sectionBreak);\n cloned.updatedAt = _context.timestamp;\n\n return {\n document: cloned,\n selection: snapshot.selection,\n changed: true,\n };\n}\n\nexport function insertSectionBreakAfterSectionIndex(\n document: CanonicalDocumentEnvelope,\n sectionIndex: number,\n breakType: SectionBreakType,\n context: SectionLayoutCommandContext,\n): SectionLayoutMutationResult {\n const cloned = structuredClone(document) as CanonicalDocumentEnvelope;\n const insertionIndex = findSectionInsertionIndex(cloned, sectionIndex);\n if (insertionIndex < 0) {\n return noopResult(document, createSelectionSnapshot(0, 0));\n }\n\n const inheritedProperties = cloneSectionProperties(\n getSectionPropertiesAtIndex(cloned, sectionIndex),\n );\n const sectionBreak: SectionBreakNode = {\n type: \"section_break\",\n sectionProperties: {\n ...inheritedProperties,\n sectionType: breakType,\n },\n };\n\n cloned.content.children.splice(insertionIndex, 0, sectionBreak);\n cloned.updatedAt = context.timestamp;\n\n return {\n document: cloned,\n selection: createSelectionSnapshot(0, 0),\n changed: true,\n };\n}\n\n// ---- Delete section break ----\n\n/**\n * Delete the section break at or nearest to the current selection position.\n * On deletion the *following* section's formatting and header/footer linkage\n * are adopted (Word merge semantics).\n */\nexport function deleteSectionBreak(\n document: CanonicalDocumentEnvelope,\n snapshot: RuntimeRenderSnapshot,\n _context: SectionLayoutCommandContext,\n): SectionLayoutMutationResult {\n const cloned = structuredClone(document) as CanonicalDocumentEnvelope;\n\n const breakIndex = findNearestSectionBreak(cloned, snapshot);\n if (breakIndex < 0) {\n return noopResult(document, snapshot.selection);\n }\n\n const breakNode = cloned.content.children[breakIndex];\n if (!breakNode || breakNode.type !== \"section_break\") {\n return noopResult(document, snapshot.selection);\n }\n\n // Remove the section break node\n cloned.content.children.splice(breakIndex, 1);\n\n cloned.updatedAt = _context.timestamp;\n\n return {\n document: cloned,\n selection: snapshot.selection,\n changed: true,\n };\n}\n\nexport function deleteSectionBreakAtSectionIndex(\n document: CanonicalDocumentEnvelope,\n sectionIndex: number,\n context: SectionLayoutCommandContext,\n): SectionLayoutMutationResult {\n if (sectionIndex <= 0) {\n return noopResult(document, createSelectionSnapshot(0, 0));\n }\n\n const cloned = structuredClone(document) as CanonicalDocumentEnvelope;\n const breakIndex = findSectionBreakNodeIndexForSection(cloned, sectionIndex);\n if (breakIndex < 0) {\n return noopResult(document, createSelectionSnapshot(0, 0));\n }\n\n cloned.content.children.splice(breakIndex, 1);\n cloned.updatedAt = context.timestamp;\n\n return {\n document: cloned,\n selection: createSelectionSnapshot(0, 0),\n changed: true,\n };\n}\n\n// ---- Update section layout ----\n\n/**\n * Apply a bounded layout patch to the section containing the current selection.\n * Supports: page size, margins, gutter, orientation, columns,\n * first-page / odd-even variants, page-numbering restart / format.\n */\nexport function updateSectionLayout(\n document: CanonicalDocumentEnvelope,\n snapshot: RuntimeRenderSnapshot,\n patch: SectionLayoutPatch,\n _context: SectionLayoutCommandContext,\n): SectionLayoutMutationResult {\n const cloned = structuredClone(document) as CanonicalDocumentEnvelope;\n const surface = snapshot.surface;\n\n if (!surface) {\n return noopResult(document, snapshot.selection);\n }\n\n const position = snapshot.selection.head;\n const sectionTarget = resolveSectionTarget(cloned, surface.blocks, position);\n\n if (!sectionTarget) {\n return noopResult(document, snapshot.selection);\n }\n\n const existing = sectionTarget.properties ?? {};\n const updated = applySectionLayoutPatch(existing, patch);\n\n if (sectionTarget.kind === \"inline\") {\n const breakNode = cloned.content.children[sectionTarget.blockIndex];\n if (breakNode && breakNode.type === \"section_break\") {\n breakNode.sectionProperties = updated;\n // Clear raw XML so the structured properties are used on export\n delete breakNode.sectionPropertiesXml;\n delete breakNode.propertiesXml;\n }\n } else {\n // Final section: update subParts.finalSectionProperties\n if (!cloned.subParts) {\n return noopResult(document, snapshot.selection);\n }\n cloned.subParts.finalSectionProperties = updated;\n }\n\n cloned.updatedAt = _context.timestamp;\n\n return {\n document: cloned,\n selection: snapshot.selection,\n changed: true,\n };\n}\n\nexport function updateSectionLayoutAtSectionIndex(\n document: CanonicalDocumentEnvelope,\n sectionIndex: number,\n patch: SectionLayoutPatch,\n context: SectionLayoutCommandContext,\n): SectionLayoutMutationResult {\n const cloned = structuredClone(document) as CanonicalDocumentEnvelope;\n const target = resolveSectionPropertiesOwner(cloned, sectionIndex);\n if (!target) {\n return noopResult(document, createSelectionSnapshot(0, 0));\n }\n\n const updated = applySectionLayoutPatch(target.properties ?? {}, patch);\n if (target.kind === \"inline\") {\n const breakNode = cloned.content.children[target.blockIndex];\n if (breakNode && breakNode.type === \"section_break\") {\n breakNode.sectionProperties = updated;\n delete breakNode.sectionPropertiesXml;\n delete breakNode.propertiesXml;\n }\n } else {\n cloned.subParts = {\n ...(cloned.subParts ?? {\n headers: [],\n footers: [],\n }),\n finalSectionProperties: updated,\n };\n }\n\n cloned.updatedAt = context.timestamp;\n return {\n document: cloned,\n selection: createSelectionSnapshot(0, 0),\n changed: true,\n };\n}\n\nexport function setSectionPageNumberingAtSectionIndex(\n document: CanonicalDocumentEnvelope,\n sectionIndex: number,\n pageNumbering: Partial<PageNumbering> | null,\n context: SectionLayoutCommandContext,\n): SectionLayoutMutationResult {\n const cloned = structuredClone(document) as CanonicalDocumentEnvelope;\n const target = resolveSectionPropertiesOwner(cloned, sectionIndex);\n if (!target) {\n return noopResult(document, createSelectionSnapshot(0, 0));\n }\n\n const nextProperties = cloneSectionProperties(target.properties);\n if (pageNumbering === null) {\n delete nextProperties.pageNumbering;\n } else {\n nextProperties.pageNumbering = {\n ...(target.properties?.pageNumbering ?? {}),\n ...pageNumbering,\n };\n }\n\n if (target.kind === \"inline\") {\n const breakNode = cloned.content.children[target.blockIndex];\n if (breakNode && breakNode.type === \"section_break\") {\n breakNode.sectionProperties = nextProperties;\n delete breakNode.sectionPropertiesXml;\n delete breakNode.propertiesXml;\n }\n } else {\n cloned.subParts = {\n ...(cloned.subParts ?? {\n headers: [],\n footers: [],\n }),\n finalSectionProperties: nextProperties,\n };\n }\n\n cloned.updatedAt = context.timestamp;\n return {\n document: cloned,\n selection: createSelectionSnapshot(0, 0),\n changed: true,\n };\n}\n\nexport function setHeaderFooterLinkAtSectionIndex(\n document: CanonicalDocumentEnvelope,\n sectionIndex: number,\n patch: SectionLinkPatch,\n context: SectionLayoutCommandContext,\n): SectionLayoutMutationResult {\n const cloned = structuredClone(document) as CanonicalDocumentEnvelope;\n const target = resolveSectionPropertiesOwner(cloned, sectionIndex);\n if (!target) {\n return noopResult(document, createSelectionSnapshot(0, 0));\n }\n\n const referencesKey =\n patch.kind === \"header\" ? \"headerReferences\" : \"footerReferences\";\n const currentProperties = cloneSectionProperties(target.properties);\n const currentReferences = [...(currentProperties?.[referencesKey] ?? [])];\n const nextReferences = currentReferences.filter((entry) => entry.variant !== patch.variant);\n\n if (!patch.linkToPrevious) {\n const relationshipId =\n normalizeRelationshipId(patch.relationshipId) ??\n resolveInheritedRelationshipId(cloned, sectionIndex, patch.kind, patch.variant);\n if (!relationshipId) {\n return noopResult(document, createSelectionSnapshot(0, 0));\n }\n\n nextReferences.push({\n variant: patch.variant,\n relationshipId,\n });\n }\n\n const nextProperties = {\n ...(currentProperties ?? {}),\n [referencesKey]: nextReferences.length > 0 ? nextReferences : undefined,\n };\n\n if (target.kind === \"inline\") {\n const breakNode = cloned.content.children[target.blockIndex];\n if (breakNode && breakNode.type === \"section_break\") {\n breakNode.sectionProperties = nextProperties;\n delete breakNode.sectionPropertiesXml;\n delete breakNode.propertiesXml;\n }\n } else {\n cloned.subParts = {\n ...(cloned.subParts ?? {\n headers: [],\n footers: [],\n }),\n finalSectionProperties: nextProperties,\n };\n }\n\n cloned.updatedAt = context.timestamp;\n return {\n document: cloned,\n selection: createSelectionSnapshot(0, 0),\n changed: true,\n };\n}\n\n// ---- Helpers ----\n\nfunction noopResult(\n document: CanonicalDocumentEnvelope,\n selection: SelectionSnapshot,\n): SectionLayoutMutationResult {\n return { document, selection, changed: false };\n}\n\nfunction createSelectionSnapshot(anchor: number, head: number): SelectionSnapshot {\n return {\n anchor,\n head,\n isCollapsed: anchor === head,\n activeRange: {\n kind: \"range\",\n from: Math.min(anchor, head),\n to: Math.max(anchor, head),\n assoc: {\n start: -1,\n end: 1,\n },\n },\n };\n}\n\nfunction resolveBlockIndexForPosition(\n blocks: ReadonlyArray<{ from: number; to: number }>,\n position: number,\n): number {\n for (let i = blocks.length - 1; i >= 0; i--) {\n const block = blocks[i];\n if (block && position >= block.from) {\n return i;\n }\n }\n return blocks.length > 0 ? 0 : -1;\n}\n\ninterface SectionTarget {\n kind: \"inline\" | \"final\";\n blockIndex: number;\n properties?: SectionProperties;\n}\n\nfunction findSectionBreakNodeIndexForSection(\n document: CanonicalDocumentEnvelope,\n sectionIndex: number,\n): number {\n if (sectionIndex <= 0) {\n return -1;\n }\n\n let currentSection = 0;\n for (let index = 0; index < document.content.children.length; index += 1) {\n const block = document.content.children[index];\n if (block?.type !== \"section_break\") {\n continue;\n }\n currentSection += 1;\n if (currentSection === sectionIndex) {\n return index;\n }\n }\n\n return -1;\n}\n\nfunction findSectionInsertionIndex(\n document: CanonicalDocumentEnvelope,\n sectionIndex: number,\n): number {\n let currentSection = 0;\n for (let index = 0; index < document.content.children.length; index += 1) {\n const block = document.content.children[index];\n if (block?.type !== \"section_break\") {\n continue;\n }\n if (currentSection === sectionIndex) {\n return index;\n }\n currentSection += 1;\n }\n\n return sectionIndex === currentSection ? document.content.children.length : -1;\n}\n\nfunction getSectionPropertiesAtIndex(\n document: CanonicalDocumentEnvelope,\n sectionIndex: number,\n): SectionProperties | undefined {\n const target = resolveSectionPropertiesOwner(document, sectionIndex);\n return target?.properties;\n}\n\nfunction resolveSectionPropertiesOwner(\n document: CanonicalDocumentEnvelope,\n sectionIndex: number,\n): SectionTarget | null {\n if (sectionIndex < 0) {\n return null;\n }\n\n let currentSection = 0;\n for (let index = 0; index < document.content.children.length; index += 1) {\n const block = document.content.children[index];\n if (block?.type !== \"section_break\") {\n continue;\n }\n if (currentSection === sectionIndex) {\n return {\n kind: \"inline\",\n blockIndex: index,\n properties: block.sectionProperties,\n };\n }\n currentSection += 1;\n }\n\n return currentSection === sectionIndex\n ? {\n kind: \"final\",\n blockIndex: document.content.children.length - 1,\n properties: document.subParts?.finalSectionProperties,\n }\n : null;\n}\n\nfunction normalizeRelationshipId(value: string | null | undefined): string | undefined {\n if (typeof value !== \"string\") {\n return undefined;\n }\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\nfunction resolveInheritedRelationshipId(\n document: CanonicalDocumentEnvelope,\n sectionIndex: number,\n kind: \"header\" | \"footer\",\n variant: \"default\" | \"first\" | \"even\",\n): string | undefined {\n for (let candidateIndex = sectionIndex - 1; candidateIndex >= 0; candidateIndex -= 1) {\n const properties = getSectionPropertiesAtIndex(document, candidateIndex);\n const references =\n kind === \"header\" ? properties?.headerReferences : properties?.footerReferences;\n const directMatch = references?.find((entry) => entry.variant === variant);\n if (directMatch?.relationshipId) {\n return directMatch.relationshipId;\n }\n }\n\n const documents = kind === \"header\"\n ? document.subParts?.headers ?? []\n : document.subParts?.footers ?? [];\n return documents.find((entry) => entry.variant === variant)?.relationshipId;\n}\n\nfunction resolveSectionTarget(\n document: CanonicalDocumentEnvelope,\n blocks: ReadonlyArray<{ from: number; to: number }>,\n position: number,\n): SectionTarget | null {\n const blockIndex = resolveBlockIndexForPosition(blocks, position);\n if (blockIndex < 0) {\n return null;\n }\n\n // Walk forward from the resolved block to find the next section break\n for (let i = blockIndex; i < document.content.children.length; i++) {\n const block = document.content.children[i];\n if (block && block.type === \"section_break\") {\n return {\n kind: \"inline\",\n blockIndex: i,\n properties: block.sectionProperties,\n };\n }\n }\n\n // No section break found; this is the final section\n return {\n kind: \"final\",\n blockIndex: document.content.children.length - 1,\n properties: document.subParts?.finalSectionProperties,\n };\n}\n\nfunction findNearestSectionBreak(\n document: CanonicalDocumentEnvelope,\n snapshot: RuntimeRenderSnapshot,\n): number {\n const surface = snapshot.surface;\n if (!surface) {\n return -1;\n }\n\n const position = snapshot.selection.head;\n let bestIndex = -1;\n let bestDistance = Number.POSITIVE_INFINITY;\n\n for (let i = 0; i < document.content.children.length; i++) {\n const block = document.content.children[i];\n if (!block || block.type !== \"section_break\") {\n continue;\n }\n const surfaceBlock = surface.blocks[i];\n if (!surfaceBlock) {\n continue;\n }\n const distance = Math.min(\n Math.abs(position - surfaceBlock.from),\n Math.abs(position - surfaceBlock.to),\n );\n if (distance < bestDistance) {\n bestDistance = distance;\n bestIndex = i;\n }\n }\n\n return bestIndex;\n}\n\nfunction applySectionLayoutPatch(\n existing: SectionProperties,\n patch: SectionLayoutPatch,\n): SectionProperties {\n const result: SectionProperties = { ...existing };\n\n if (patch.pageSize) {\n result.pageSize = {\n ...(existing.pageSize ?? { width: 12240, height: 15840 }),\n ...patch.pageSize,\n };\n }\n\n if (patch.pageMargins) {\n result.pageMargins = {\n ...(existing.pageMargins ?? {\n top: 1440,\n right: 1440,\n bottom: 1440,\n left: 1440,\n }),\n ...patch.pageMargins,\n };\n }\n\n if (patch.columns) {\n result.columns = {\n ...(existing.columns ?? {}),\n ...patch.columns,\n };\n }\n\n if (patch.pageNumbering) {\n result.pageNumbering = {\n ...(existing.pageNumbering ?? {}),\n ...patch.pageNumbering,\n };\n }\n\n if (patch.titlePage !== undefined) {\n result.titlePage = patch.titlePage;\n }\n\n if (patch.sectionType !== undefined) {\n result.sectionType = patch.sectionType;\n }\n\n return result;\n}\n\nfunction cloneSectionProperties(\n properties: SectionProperties | undefined,\n): SectionProperties {\n return properties ? structuredClone(properties) : {};\n}\n"],"mappings":";;;;;;;;;;;;;;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hD,MAAI,MAAM,UAAU;AAClB,WAAO,WAAW;AAAA,MAChB,GAAI,SAAS,YAAY,EAAE,OAAO,OAAO,QAAQ,MAAM;AAAA,MACvD,GAAG,MAAM;AAAA,IACX;AAAA,EACF;AAEA,MAAI,MAAM,aAAa;AACrB,WAAO,cAAc;AAAA,MACnB,GAAI,SAAS,eAAe;AAAA,QAC1B,KAAK;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,MACA,GAAG,MAAM;AAAA,IACX;AAAA,EACF;AAEA,MAAI,MAAM,SAAS;AACjB,WAAO,UAAU;AAAA,MACf,GAAI,SAAS,WAAW,CAAC;AAAA,MACzB,GAAG,MAAM;AAAA,IACX;AAAA,EACF;AAEA,MAAI,MAAM,eAAe;AACvB,WAAO,gBAAgB;AAAA,MACrB,GAAI,SAAS,iBAAiB,CAAC;AAAA,MAC/B,GAAG,MAAM;AAAA,IACX;AAAA,EACF;AAEA,MAAI,MAAM,cAAc,QAAW;AACjC,WAAO,YAAY,MAAM;AAAA,EAC3B;AAEA,MAAI,MAAM,gBAAgB,QAAW;AACnC,WAAO,cAAc,MAAM;AAAA,EAC7B;AAEA,SAAO;AACT;AAEA,SAAS,uBACP,YACmB;AACnB,SAAO,aAAa,gBAAgB,UAAU,IAAI,CAAC;AACrD;","names":[]}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { a5 as SelectionSnapshot, X as RuntimeRenderSnapshot } from '../../public-types-CeMaDueh.cjs';
|
|
2
|
-
import { C as CanonicalDocument, P as PageSize, a as PageMargins, b as ColumnProperties, c as PageNumbering } from '../../canonical-document-BLEbzL2J.cjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Section layout authoring commands.
|
|
6
|
-
*
|
|
7
|
-
* Supports inserting and deleting section breaks, bounded section layout
|
|
8
|
-
* updates (page size, margins, gutter, orientation, columns, first-page /
|
|
9
|
-
* odd-even variants, page-numbering restart / format), and section break
|
|
10
|
-
* deletion with following-section merge semantics.
|
|
11
|
-
*
|
|
12
|
-
* All mutations are command-backed and export-safe.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
interface SectionLayoutCommandContext {
|
|
16
|
-
timestamp: string;
|
|
17
|
-
}
|
|
18
|
-
interface SectionLayoutMutationResult {
|
|
19
|
-
document: CanonicalDocument;
|
|
20
|
-
selection: SelectionSnapshot;
|
|
21
|
-
changed: boolean;
|
|
22
|
-
}
|
|
23
|
-
type SectionBreakType = "nextPage" | "continuous" | "evenPage" | "oddPage" | "nextColumn";
|
|
24
|
-
interface SectionLayoutPatch {
|
|
25
|
-
pageSize?: Partial<PageSize>;
|
|
26
|
-
pageMargins?: Partial<PageMargins>;
|
|
27
|
-
columns?: Partial<ColumnProperties>;
|
|
28
|
-
pageNumbering?: Partial<PageNumbering>;
|
|
29
|
-
titlePage?: boolean;
|
|
30
|
-
sectionType?: SectionBreakType;
|
|
31
|
-
}
|
|
32
|
-
interface SectionLinkPatch {
|
|
33
|
-
kind: "header" | "footer";
|
|
34
|
-
variant: "default" | "first" | "even";
|
|
35
|
-
linkToPrevious: boolean;
|
|
36
|
-
relationshipId?: string | null;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Insert a section break at the current selection position.
|
|
40
|
-
* The new section inherits properties from the section that contained the
|
|
41
|
-
* insertion point (the *following* section keeps its own properties).
|
|
42
|
-
*/
|
|
43
|
-
declare function insertSectionBreak(document: CanonicalDocument, snapshot: RuntimeRenderSnapshot, breakType: SectionBreakType, _context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
44
|
-
declare function insertSectionBreakAfterSectionIndex(document: CanonicalDocument, sectionIndex: number, breakType: SectionBreakType, context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
45
|
-
/**
|
|
46
|
-
* Delete the section break at or nearest to the current selection position.
|
|
47
|
-
* On deletion the *following* section's formatting and header/footer linkage
|
|
48
|
-
* are adopted (Word merge semantics).
|
|
49
|
-
*/
|
|
50
|
-
declare function deleteSectionBreak(document: CanonicalDocument, snapshot: RuntimeRenderSnapshot, _context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
51
|
-
declare function deleteSectionBreakAtSectionIndex(document: CanonicalDocument, sectionIndex: number, context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
52
|
-
/**
|
|
53
|
-
* Apply a bounded layout patch to the section containing the current selection.
|
|
54
|
-
* Supports: page size, margins, gutter, orientation, columns,
|
|
55
|
-
* first-page / odd-even variants, page-numbering restart / format.
|
|
56
|
-
*/
|
|
57
|
-
declare function updateSectionLayout(document: CanonicalDocument, snapshot: RuntimeRenderSnapshot, patch: SectionLayoutPatch, _context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
58
|
-
declare function updateSectionLayoutAtSectionIndex(document: CanonicalDocument, sectionIndex: number, patch: SectionLayoutPatch, context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
59
|
-
declare function setSectionPageNumberingAtSectionIndex(document: CanonicalDocument, sectionIndex: number, pageNumbering: Partial<PageNumbering> | null, context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
60
|
-
declare function setHeaderFooterLinkAtSectionIndex(document: CanonicalDocument, sectionIndex: number, patch: SectionLinkPatch, context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
61
|
-
|
|
62
|
-
export { type SectionBreakType, type SectionLayoutCommandContext, type SectionLayoutMutationResult, type SectionLayoutPatch, type SectionLinkPatch, deleteSectionBreak, deleteSectionBreakAtSectionIndex, insertSectionBreak, insertSectionBreakAfterSectionIndex, setHeaderFooterLinkAtSectionIndex, setSectionPageNumberingAtSectionIndex, updateSectionLayout, updateSectionLayoutAtSectionIndex };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { a5 as SelectionSnapshot, X as RuntimeRenderSnapshot } from '../../public-types-7ZL_94cz.js';
|
|
2
|
-
import { C as CanonicalDocument, P as PageSize, a as PageMargins, b as ColumnProperties, c as PageNumbering } from '../../canonical-document-BLEbzL2J.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Section layout authoring commands.
|
|
6
|
-
*
|
|
7
|
-
* Supports inserting and deleting section breaks, bounded section layout
|
|
8
|
-
* updates (page size, margins, gutter, orientation, columns, first-page /
|
|
9
|
-
* odd-even variants, page-numbering restart / format), and section break
|
|
10
|
-
* deletion with following-section merge semantics.
|
|
11
|
-
*
|
|
12
|
-
* All mutations are command-backed and export-safe.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
interface SectionLayoutCommandContext {
|
|
16
|
-
timestamp: string;
|
|
17
|
-
}
|
|
18
|
-
interface SectionLayoutMutationResult {
|
|
19
|
-
document: CanonicalDocument;
|
|
20
|
-
selection: SelectionSnapshot;
|
|
21
|
-
changed: boolean;
|
|
22
|
-
}
|
|
23
|
-
type SectionBreakType = "nextPage" | "continuous" | "evenPage" | "oddPage" | "nextColumn";
|
|
24
|
-
interface SectionLayoutPatch {
|
|
25
|
-
pageSize?: Partial<PageSize>;
|
|
26
|
-
pageMargins?: Partial<PageMargins>;
|
|
27
|
-
columns?: Partial<ColumnProperties>;
|
|
28
|
-
pageNumbering?: Partial<PageNumbering>;
|
|
29
|
-
titlePage?: boolean;
|
|
30
|
-
sectionType?: SectionBreakType;
|
|
31
|
-
}
|
|
32
|
-
interface SectionLinkPatch {
|
|
33
|
-
kind: "header" | "footer";
|
|
34
|
-
variant: "default" | "first" | "even";
|
|
35
|
-
linkToPrevious: boolean;
|
|
36
|
-
relationshipId?: string | null;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Insert a section break at the current selection position.
|
|
40
|
-
* The new section inherits properties from the section that contained the
|
|
41
|
-
* insertion point (the *following* section keeps its own properties).
|
|
42
|
-
*/
|
|
43
|
-
declare function insertSectionBreak(document: CanonicalDocument, snapshot: RuntimeRenderSnapshot, breakType: SectionBreakType, _context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
44
|
-
declare function insertSectionBreakAfterSectionIndex(document: CanonicalDocument, sectionIndex: number, breakType: SectionBreakType, context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
45
|
-
/**
|
|
46
|
-
* Delete the section break at or nearest to the current selection position.
|
|
47
|
-
* On deletion the *following* section's formatting and header/footer linkage
|
|
48
|
-
* are adopted (Word merge semantics).
|
|
49
|
-
*/
|
|
50
|
-
declare function deleteSectionBreak(document: CanonicalDocument, snapshot: RuntimeRenderSnapshot, _context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
51
|
-
declare function deleteSectionBreakAtSectionIndex(document: CanonicalDocument, sectionIndex: number, context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
52
|
-
/**
|
|
53
|
-
* Apply a bounded layout patch to the section containing the current selection.
|
|
54
|
-
* Supports: page size, margins, gutter, orientation, columns,
|
|
55
|
-
* first-page / odd-even variants, page-numbering restart / format.
|
|
56
|
-
*/
|
|
57
|
-
declare function updateSectionLayout(document: CanonicalDocument, snapshot: RuntimeRenderSnapshot, patch: SectionLayoutPatch, _context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
58
|
-
declare function updateSectionLayoutAtSectionIndex(document: CanonicalDocument, sectionIndex: number, patch: SectionLayoutPatch, context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
59
|
-
declare function setSectionPageNumberingAtSectionIndex(document: CanonicalDocument, sectionIndex: number, pageNumbering: Partial<PageNumbering> | null, context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
60
|
-
declare function setHeaderFooterLinkAtSectionIndex(document: CanonicalDocument, sectionIndex: number, patch: SectionLinkPatch, context: SectionLayoutCommandContext): SectionLayoutMutationResult;
|
|
61
|
-
|
|
62
|
-
export { type SectionBreakType, type SectionLayoutCommandContext, type SectionLayoutMutationResult, type SectionLayoutPatch, type SectionLinkPatch, deleteSectionBreak, deleteSectionBreakAtSectionIndex, insertSectionBreak, insertSectionBreakAfterSectionIndex, setHeaderFooterLinkAtSectionIndex, setSectionPageNumberingAtSectionIndex, updateSectionLayout, updateSectionLayoutAtSectionIndex };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
deleteSectionBreak,
|
|
3
|
-
deleteSectionBreakAtSectionIndex,
|
|
4
|
-
insertSectionBreak,
|
|
5
|
-
insertSectionBreakAfterSectionIndex,
|
|
6
|
-
setHeaderFooterLinkAtSectionIndex,
|
|
7
|
-
setSectionPageNumberingAtSectionIndex,
|
|
8
|
-
updateSectionLayout,
|
|
9
|
-
updateSectionLayoutAtSectionIndex
|
|
10
|
-
} from "../../chunk-2OQBZS3F.js";
|
|
11
|
-
export {
|
|
12
|
-
deleteSectionBreak,
|
|
13
|
-
deleteSectionBreakAtSectionIndex,
|
|
14
|
-
insertSectionBreak,
|
|
15
|
-
insertSectionBreakAfterSectionIndex,
|
|
16
|
-
setHeaderFooterLinkAtSectionIndex,
|
|
17
|
-
setSectionPageNumberingAtSectionIndex,
|
|
18
|
-
updateSectionLayout,
|
|
19
|
-
updateSectionLayoutAtSectionIndex
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=section-layout-commands.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/commands/style-commands.ts"],"sourcesContent":["import type {\n PersistedEditorSnapshot,\n RuntimeRenderSnapshot,\n SurfaceBlockSnapshot,\n} from \"../../api/public-types\";\nimport type {\n BlockNode,\n DocumentRootNode,\n ParagraphNode,\n TableNode,\n} from \"../../model/canonical-document.ts\";\n\ntype CanonicalDocumentEnvelope = PersistedEditorSnapshot[\"canonicalDocument\"];\n\nexport interface StyleMutationResult {\n document: CanonicalDocumentEnvelope;\n selection: RuntimeRenderSnapshot[\"selection\"];\n changed: boolean;\n}\n\nexport function applyParagraphStyleToDocument(\n document: CanonicalDocumentEnvelope,\n snapshot: RuntimeRenderSnapshot,\n styleId: string | null,\n): StyleMutationResult {\n const surface = snapshot.surface;\n if (!surface) {\n return {\n document,\n selection: snapshot.selection,\n changed: false,\n };\n }\n\n const nextDocument = structuredClone(document);\n const root = nextDocument.content as DocumentRootNode;\n const normalizedStyleId = normalizeStyleId(styleId);\n if (!isValidParagraphStyleId(document, normalizedStyleId)) {\n return {\n document,\n selection: snapshot.selection,\n changed: false,\n };\n }\n let changed = false;\n\n visitParagraphBindings(root.children, surface.blocks, (paragraph, paragraphSurface) => {\n if (\n !selectionTouchesRange(\n snapshot.selection.anchor,\n snapshot.selection.head,\n paragraphSurface.from,\n paragraphSurface.to,\n )\n ) {\n return;\n }\n\n if (paragraph.styleId === normalizedStyleId) {\n return;\n }\n\n if (normalizedStyleId) {\n paragraph.styleId = normalizedStyleId;\n } else {\n delete paragraph.styleId;\n }\n changed = true;\n });\n\n return {\n document: changed ? nextDocument : document,\n selection: snapshot.selection,\n changed,\n };\n}\n\nexport function applyTableStyleToDocument(\n document: CanonicalDocumentEnvelope,\n snapshot: RuntimeRenderSnapshot,\n styleId: string | null,\n): StyleMutationResult {\n const surface = snapshot.surface;\n if (!surface) {\n return {\n document,\n selection: snapshot.selection,\n changed: false,\n };\n }\n\n const nextDocument = structuredClone(document);\n const root = nextDocument.content as DocumentRootNode;\n const normalizedStyleId = normalizeStyleId(styleId);\n if (!isValidTableStyleId(document, normalizedStyleId)) {\n return {\n document,\n selection: snapshot.selection,\n changed: false,\n };\n }\n let changed = false;\n let applied = false;\n\n visitTableBindings(root.children, surface.blocks, (table, tableSurface) => {\n if (\n applied ||\n !selectionTouchesRange(\n snapshot.selection.anchor,\n snapshot.selection.head,\n tableSurface.from,\n tableSurface.to,\n )\n ) {\n return;\n }\n\n if (table.styleId === normalizedStyleId) {\n applied = true;\n return;\n }\n\n if (normalizedStyleId) {\n table.styleId = normalizedStyleId;\n } else {\n delete table.styleId;\n }\n changed = true;\n applied = true;\n });\n\n return {\n document: changed ? nextDocument : document,\n selection: snapshot.selection,\n changed,\n };\n}\n\nfunction normalizeStyleId(styleId: string | null): string | undefined {\n if (styleId === null) {\n return undefined;\n }\n const normalized = styleId.trim();\n return normalized.length > 0 ? normalized : undefined;\n}\n\nfunction isValidParagraphStyleId(\n document: CanonicalDocumentEnvelope,\n styleId: string | undefined,\n): boolean {\n return styleId === undefined || Boolean(document.styles.paragraphs[styleId]);\n}\n\nfunction isValidTableStyleId(\n document: CanonicalDocumentEnvelope,\n styleId: string | undefined,\n): boolean {\n return styleId === undefined || Boolean(document.styles.tables[styleId]);\n}\n\nfunction visitParagraphBindings(\n blocks: BlockNode[],\n surfaceBlocks: SurfaceBlockSnapshot[],\n visitor: (paragraph: ParagraphNode, surface: Extract<SurfaceBlockSnapshot, { kind: \"paragraph\" }>) => void,\n): void {\n for (let index = 0; index < Math.min(blocks.length, surfaceBlocks.length); index += 1) {\n const block = blocks[index];\n const surface = surfaceBlocks[index];\n if (!block || !surface) {\n continue;\n }\n\n if (block.type === \"paragraph\" && surface.kind === \"paragraph\") {\n visitor(block, surface);\n continue;\n }\n\n if (block.type === \"table\" && surface.kind === \"table\") {\n for (let rowIndex = 0; rowIndex < Math.min(block.rows.length, surface.rows.length); rowIndex += 1) {\n const row = block.rows[rowIndex];\n const surfaceRow = surface.rows[rowIndex];\n if (!row || !surfaceRow) {\n continue;\n }\n for (let cellIndex = 0; cellIndex < Math.min(row.cells.length, surfaceRow.cells.length); cellIndex += 1) {\n const cell = row.cells[cellIndex];\n const surfaceCell = surfaceRow.cells[cellIndex];\n if (!cell || !surfaceCell) {\n continue;\n }\n visitParagraphBindings(cell.children, surfaceCell.content, visitor);\n }\n }\n continue;\n }\n\n if (block.type === \"sdt\" && surface.kind === \"sdt_block\") {\n visitParagraphBindings(block.children, surface.children, visitor);\n }\n }\n}\n\nfunction visitTableBindings(\n blocks: BlockNode[],\n surfaceBlocks: SurfaceBlockSnapshot[],\n visitor: (table: TableNode, surface: Extract<SurfaceBlockSnapshot, { kind: \"table\" }>) => void,\n): void {\n for (let index = 0; index < Math.min(blocks.length, surfaceBlocks.length); index += 1) {\n const block = blocks[index];\n const surface = surfaceBlocks[index];\n if (!block || !surface) {\n continue;\n }\n\n if (block.type === \"table\" && surface.kind === \"table\") {\n visitor(block, surface);\n for (let rowIndex = 0; rowIndex < Math.min(block.rows.length, surface.rows.length); rowIndex += 1) {\n const row = block.rows[rowIndex];\n const surfaceRow = surface.rows[rowIndex];\n if (!row || !surfaceRow) {\n continue;\n }\n for (let cellIndex = 0; cellIndex < Math.min(row.cells.length, surfaceRow.cells.length); cellIndex += 1) {\n const cell = row.cells[cellIndex];\n const surfaceCell = surfaceRow.cells[cellIndex];\n if (!cell || !surfaceCell) {\n continue;\n }\n visitTableBindings(cell.children, surfaceCell.content, visitor);\n }\n }\n continue;\n }\n\n if (block.type === \"sdt\" && surface.kind === \"sdt_block\") {\n visitTableBindings(block.children, surface.children, visitor);\n }\n }\n}\n\nfunction selectionTouchesRange(\n anchor: number,\n head: number,\n rangeFrom: number,\n rangeTo: number,\n): boolean {\n const selectionFrom = Math.min(anchor, head);\n const selectionTo = Math.max(anchor, head);\n if (selectionFrom === selectionTo) {\n return selectionFrom >= rangeFrom && selectionFrom <= rangeTo;\n }\n return rangesOverlap(selectionFrom, selectionTo, rangeFrom, rangeTo);\n}\n\nfunction rangesOverlap(\n leftFrom: number,\n leftTo: number,\n rightFrom: number,\n rightTo: number,\n): boolean {\n return leftFrom < rightTo && leftTo > rightFrom;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBO,SAAS,8BACd,UACA,UACA,SACqB;AACrB,QAAM,UAAU,SAAS;AACzB,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,MACL;AAAA,MACA,WAAW,SAAS;AAAA,MACpB,SAAS;AAAA,IACX;AAAA,EACF;AAEA,QAAM,eAAe,gBAAgB,QAAQ;AAC7C,QAAM,OAAO,aAAa;AAC1B,QAAM,oBAAoB,iBAAiB,OAAO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QAChE;AAAA,MACF;AACA;AAAA,IACF;AAEA,QAAI,MAAM,SAAS,SAAS,QAAQ,SAAS,aAAa;AACxD,yBAAmB,MAAM,UAAU,QAAQ,UAAU,OAAO;AAAA,IAC9D;AAAA,EACF;AACF;AAEA,SAAS,sBACP,QACA,MACA,WACA,SACS;AACT,QAAM,gBAAgB,KAAK,IAAI,QAAQ,IAAI;AAC3C,QAAM,cAAc,KAAK,IAAI,QAAQ,IAAI;AACzC,MAAI,kBAAkB,aAAa;AACjC,WAAO,iBAAiB,aAAa,iBAAiB;AAAA,EACxD;AACA,SAAO,cAAc,eAAe,aAAa,WAAW,OAAO;AACrE;AAEA,SAAS,cACP,UACA,QACA,WACA,SACS;AACT,SAAO,WAAW,WAAW,SAAS;AACxC;","names":[]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { P as PersistedEditorSnapshot, X as RuntimeRenderSnapshot } from '../../public-types-CeMaDueh.cjs';
|
|
2
|
-
import '../../canonical-document-BLEbzL2J.cjs';
|
|
3
|
-
|
|
4
|
-
type CanonicalDocumentEnvelope = PersistedEditorSnapshot["canonicalDocument"];
|
|
5
|
-
interface StyleMutationResult {
|
|
6
|
-
document: CanonicalDocumentEnvelope;
|
|
7
|
-
selection: RuntimeRenderSnapshot["selection"];
|
|
8
|
-
changed: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare function applyParagraphStyleToDocument(document: CanonicalDocumentEnvelope, snapshot: RuntimeRenderSnapshot, styleId: string | null): StyleMutationResult;
|
|
11
|
-
declare function applyTableStyleToDocument(document: CanonicalDocumentEnvelope, snapshot: RuntimeRenderSnapshot, styleId: string | null): StyleMutationResult;
|
|
12
|
-
|
|
13
|
-
export { type StyleMutationResult, applyParagraphStyleToDocument, applyTableStyleToDocument };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { P as PersistedEditorSnapshot, X as RuntimeRenderSnapshot } from '../../public-types-7ZL_94cz.js';
|
|
2
|
-
import '../../canonical-document-BLEbzL2J.js';
|
|
3
|
-
|
|
4
|
-
type CanonicalDocumentEnvelope = PersistedEditorSnapshot["canonicalDocument"];
|
|
5
|
-
interface StyleMutationResult {
|
|
6
|
-
document: CanonicalDocumentEnvelope;
|
|
7
|
-
selection: RuntimeRenderSnapshot["selection"];
|
|
8
|
-
changed: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare function applyParagraphStyleToDocument(document: CanonicalDocumentEnvelope, snapshot: RuntimeRenderSnapshot, styleId: string | null): StyleMutationResult;
|
|
11
|
-
declare function applyTableStyleToDocument(document: CanonicalDocumentEnvelope, snapshot: RuntimeRenderSnapshot, styleId: string | null): StyleMutationResult;
|
|
12
|
-
|
|
13
|
-
export { type StyleMutationResult, applyParagraphStyleToDocument, applyTableStyleToDocument };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|