@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
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
EditorSurfaceSnapshot,
|
|
3
|
-
SurfaceBlockSnapshot,
|
|
4
|
-
} from "../api/public-types";
|
|
5
|
-
|
|
6
|
-
export interface VirtualizedRenderingMetrics {
|
|
7
|
-
blockId: string;
|
|
8
|
-
index: number;
|
|
9
|
-
top: number;
|
|
10
|
-
height: number;
|
|
11
|
-
bottom: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface VirtualizedRenderingSession {
|
|
15
|
-
blocks: SurfaceBlockSnapshot[];
|
|
16
|
-
metrics: VirtualizedRenderingMetrics[];
|
|
17
|
-
totalHeight: number;
|
|
18
|
-
averageBlockHeight: number;
|
|
19
|
-
estimatedPageCount: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface CreateVirtualizedRenderingSessionOptions {
|
|
23
|
-
averagePageHeight?: number;
|
|
24
|
-
paragraphBaseHeight?: number;
|
|
25
|
-
paragraphLineHeight?: number;
|
|
26
|
-
segmentWrapWidth?: number;
|
|
27
|
-
tableRowHeight?: number;
|
|
28
|
-
opaqueBlockHeight?: number;
|
|
29
|
-
sdtPaddingHeight?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface VirtualizedViewport {
|
|
33
|
-
scrollTop: number;
|
|
34
|
-
viewportHeight: number;
|
|
35
|
-
overscanHeight?: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface VirtualizedWindow {
|
|
39
|
-
startIndex: number;
|
|
40
|
-
endIndex: number;
|
|
41
|
-
totalHeight: number;
|
|
42
|
-
offsetTop: number;
|
|
43
|
-
offsetBottom: number;
|
|
44
|
-
visibleBlocks: SurfaceBlockSnapshot[];
|
|
45
|
-
visibleMetrics: VirtualizedRenderingMetrics[];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const DEFAULT_PAGE_HEIGHT = 1120;
|
|
49
|
-
const DEFAULT_PARAGRAPH_BASE_HEIGHT = 28;
|
|
50
|
-
const DEFAULT_PARAGRAPH_LINE_HEIGHT = 18;
|
|
51
|
-
const DEFAULT_SEGMENT_WRAP_WIDTH = 96;
|
|
52
|
-
const DEFAULT_TABLE_ROW_HEIGHT = 44;
|
|
53
|
-
const DEFAULT_OPAQUE_BLOCK_HEIGHT = 72;
|
|
54
|
-
const DEFAULT_SDT_PADDING_HEIGHT = 24;
|
|
55
|
-
|
|
56
|
-
export function createVirtualizedRenderingSession(
|
|
57
|
-
surface: EditorSurfaceSnapshot,
|
|
58
|
-
previous: VirtualizedRenderingSession | undefined = undefined,
|
|
59
|
-
options: CreateVirtualizedRenderingSessionOptions = {},
|
|
60
|
-
): VirtualizedRenderingSession {
|
|
61
|
-
const blocks = surface.blocks;
|
|
62
|
-
const metrics = previous?.metrics ?? [];
|
|
63
|
-
|
|
64
|
-
if (metrics.length > blocks.length) {
|
|
65
|
-
metrics.length = blocks.length;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
let cursor = 0;
|
|
69
|
-
for (let index = 0; index < blocks.length; index += 1) {
|
|
70
|
-
const block = blocks[index]!;
|
|
71
|
-
const height = estimateBlockHeight(block, options);
|
|
72
|
-
const top = cursor;
|
|
73
|
-
const bottom = top + height;
|
|
74
|
-
const metric = metrics[index];
|
|
75
|
-
if (metric) {
|
|
76
|
-
metric.blockId = block.blockId;
|
|
77
|
-
metric.index = index;
|
|
78
|
-
metric.top = top;
|
|
79
|
-
metric.height = height;
|
|
80
|
-
metric.bottom = bottom;
|
|
81
|
-
} else {
|
|
82
|
-
metrics.push({
|
|
83
|
-
blockId: block.blockId,
|
|
84
|
-
index,
|
|
85
|
-
top,
|
|
86
|
-
height,
|
|
87
|
-
bottom,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
cursor = bottom;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const totalHeight = cursor;
|
|
94
|
-
const averageBlockHeight = blocks.length > 0 ? totalHeight / blocks.length : 0;
|
|
95
|
-
const estimatedPageCount =
|
|
96
|
-
totalHeight > 0
|
|
97
|
-
? Math.max(
|
|
98
|
-
1,
|
|
99
|
-
Math.ceil(totalHeight / (options.averagePageHeight ?? DEFAULT_PAGE_HEIGHT)),
|
|
100
|
-
)
|
|
101
|
-
: 0;
|
|
102
|
-
|
|
103
|
-
if (previous) {
|
|
104
|
-
previous.blocks = blocks;
|
|
105
|
-
previous.metrics = metrics;
|
|
106
|
-
previous.totalHeight = totalHeight;
|
|
107
|
-
previous.averageBlockHeight = averageBlockHeight;
|
|
108
|
-
previous.estimatedPageCount = estimatedPageCount;
|
|
109
|
-
return previous;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
blocks,
|
|
114
|
-
metrics,
|
|
115
|
-
totalHeight,
|
|
116
|
-
averageBlockHeight,
|
|
117
|
-
estimatedPageCount,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export function computeVirtualizedWindow(
|
|
122
|
-
session: VirtualizedRenderingSession,
|
|
123
|
-
viewport: VirtualizedViewport,
|
|
124
|
-
): VirtualizedWindow {
|
|
125
|
-
if (session.metrics.length === 0) {
|
|
126
|
-
return {
|
|
127
|
-
startIndex: 0,
|
|
128
|
-
endIndex: 0,
|
|
129
|
-
totalHeight: 0,
|
|
130
|
-
offsetTop: 0,
|
|
131
|
-
offsetBottom: 0,
|
|
132
|
-
visibleBlocks: [],
|
|
133
|
-
visibleMetrics: [],
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const overscanHeight = Math.max(0, viewport.overscanHeight ?? viewport.viewportHeight * 0.5);
|
|
138
|
-
const windowTop = Math.max(0, viewport.scrollTop - overscanHeight);
|
|
139
|
-
const windowBottom = Math.min(
|
|
140
|
-
session.totalHeight,
|
|
141
|
-
viewport.scrollTop + viewport.viewportHeight + overscanHeight,
|
|
142
|
-
);
|
|
143
|
-
const startIndex = findFirstVisibleIndex(session.metrics, windowTop);
|
|
144
|
-
const endIndexExclusive = findLastVisibleIndex(session.metrics, windowBottom) + 1;
|
|
145
|
-
const safeEndIndex = Math.max(startIndex + 1, endIndexExclusive);
|
|
146
|
-
const visibleMetrics = session.metrics.slice(startIndex, safeEndIndex);
|
|
147
|
-
const visibleBlocks = session.blocks.slice(startIndex, safeEndIndex);
|
|
148
|
-
const lastMetric = visibleMetrics[visibleMetrics.length - 1]!;
|
|
149
|
-
|
|
150
|
-
return {
|
|
151
|
-
startIndex,
|
|
152
|
-
endIndex: safeEndIndex,
|
|
153
|
-
totalHeight: session.totalHeight,
|
|
154
|
-
offsetTop: visibleMetrics[0]?.top ?? 0,
|
|
155
|
-
offsetBottom: Math.max(0, session.totalHeight - lastMetric.bottom),
|
|
156
|
-
visibleBlocks,
|
|
157
|
-
visibleMetrics,
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function findFirstVisibleIndex(
|
|
162
|
-
metrics: VirtualizedRenderingMetrics[],
|
|
163
|
-
top: number,
|
|
164
|
-
): number {
|
|
165
|
-
let low = 0;
|
|
166
|
-
let high = metrics.length - 1;
|
|
167
|
-
let result = 0;
|
|
168
|
-
|
|
169
|
-
while (low <= high) {
|
|
170
|
-
const middle = (low + high) >> 1;
|
|
171
|
-
const metric = metrics[middle]!;
|
|
172
|
-
if (metric.bottom >= top) {
|
|
173
|
-
result = middle;
|
|
174
|
-
high = middle - 1;
|
|
175
|
-
} else {
|
|
176
|
-
low = middle + 1;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return result;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function findLastVisibleIndex(
|
|
184
|
-
metrics: VirtualizedRenderingMetrics[],
|
|
185
|
-
bottom: number,
|
|
186
|
-
): number {
|
|
187
|
-
let low = 0;
|
|
188
|
-
let high = metrics.length - 1;
|
|
189
|
-
let result = metrics.length - 1;
|
|
190
|
-
|
|
191
|
-
while (low <= high) {
|
|
192
|
-
const middle = (low + high) >> 1;
|
|
193
|
-
const metric = metrics[middle]!;
|
|
194
|
-
if (metric.top <= bottom) {
|
|
195
|
-
result = middle;
|
|
196
|
-
low = middle + 1;
|
|
197
|
-
} else {
|
|
198
|
-
high = middle - 1;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return result;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function estimateBlockHeight(
|
|
206
|
-
block: SurfaceBlockSnapshot,
|
|
207
|
-
options: CreateVirtualizedRenderingSessionOptions,
|
|
208
|
-
): number {
|
|
209
|
-
switch (block.kind) {
|
|
210
|
-
case "paragraph":
|
|
211
|
-
return estimateParagraphHeight(block, options);
|
|
212
|
-
case "table":
|
|
213
|
-
return Math.max(
|
|
214
|
-
options.tableRowHeight ?? DEFAULT_TABLE_ROW_HEIGHT,
|
|
215
|
-
block.rows.length * (options.tableRowHeight ?? DEFAULT_TABLE_ROW_HEIGHT),
|
|
216
|
-
);
|
|
217
|
-
case "opaque_block":
|
|
218
|
-
return options.opaqueBlockHeight ?? DEFAULT_OPAQUE_BLOCK_HEIGHT;
|
|
219
|
-
case "sdt_block":
|
|
220
|
-
return (
|
|
221
|
-
(options.sdtPaddingHeight ?? DEFAULT_SDT_PADDING_HEIGHT) +
|
|
222
|
-
block.children.reduce(
|
|
223
|
-
(total, child) => total + estimateBlockHeight(child, options),
|
|
224
|
-
0,
|
|
225
|
-
)
|
|
226
|
-
);
|
|
227
|
-
default:
|
|
228
|
-
return options.paragraphBaseHeight ?? DEFAULT_PARAGRAPH_BASE_HEIGHT;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function estimateParagraphHeight(
|
|
233
|
-
block: Extract<SurfaceBlockSnapshot, { kind: "paragraph" }>,
|
|
234
|
-
options: CreateVirtualizedRenderingSessionOptions,
|
|
235
|
-
): number {
|
|
236
|
-
const wrapWidth = options.segmentWrapWidth ?? DEFAULT_SEGMENT_WRAP_WIDTH;
|
|
237
|
-
let consumedCharacters = 0;
|
|
238
|
-
|
|
239
|
-
for (const segment of block.segments) {
|
|
240
|
-
switch (segment.kind) {
|
|
241
|
-
case "text":
|
|
242
|
-
consumedCharacters += segment.text.length;
|
|
243
|
-
break;
|
|
244
|
-
case "image":
|
|
245
|
-
consumedCharacters += wrapWidth;
|
|
246
|
-
break;
|
|
247
|
-
default:
|
|
248
|
-
consumedCharacters += 4;
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const estimatedLines = Math.max(1, Math.ceil(consumedCharacters / wrapWidth));
|
|
254
|
-
return (
|
|
255
|
-
(options.paragraphBaseHeight ?? DEFAULT_PARAGRAPH_BASE_HEIGHT) +
|
|
256
|
-
estimatedLines * (options.paragraphLineHeight ?? DEFAULT_PARAGRAPH_LINE_HEIGHT)
|
|
257
|
-
);
|
|
258
|
-
}
|
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CommentSidebarSnapshot,
|
|
3
|
-
EditorAnchorProjection,
|
|
4
|
-
EditorStoryTarget,
|
|
5
|
-
FieldSnapshot,
|
|
6
|
-
ProtectionSnapshot,
|
|
7
|
-
RuntimeRenderSnapshot,
|
|
8
|
-
SurfaceBlockSnapshot,
|
|
9
|
-
SurfaceInlineSegment,
|
|
10
|
-
TrackedChangesSnapshot,
|
|
11
|
-
WorkflowCandidateRange,
|
|
12
|
-
WorkflowCandidateRangeOptions,
|
|
13
|
-
WorkflowFieldMarkup,
|
|
14
|
-
WorkflowHighlightMarkup,
|
|
15
|
-
WorkflowMarkupItem,
|
|
16
|
-
WorkflowMarkupSnapshot,
|
|
17
|
-
WorkflowOpaqueFragmentMarkup,
|
|
18
|
-
WorkflowProtectedRangeMarkup,
|
|
19
|
-
WorkflowRevisionMarkup,
|
|
20
|
-
WorkflowCommentMarkup,
|
|
21
|
-
} from "../api/public-types";
|
|
22
|
-
import { MAIN_STORY_TARGET } from "../core/selection/mapping.ts";
|
|
23
|
-
import { searchSurfaceBlocks } from "../core/search/search-text.ts";
|
|
24
|
-
import { describeOpaqueFragment } from "../preservation/store.ts";
|
|
25
|
-
import type { CanonicalDocumentEnvelope } from "../core/state/editor-state.ts";
|
|
26
|
-
|
|
27
|
-
const BLOCKED_IMPORT_FEATURE_KEYS = new Set(["alt-chunk", "alternate-content", "custom-xml"]);
|
|
28
|
-
|
|
29
|
-
export function collectWorkflowMarkupSnapshot(input: {
|
|
30
|
-
renderSnapshot: RuntimeRenderSnapshot;
|
|
31
|
-
fieldSnapshot: FieldSnapshot;
|
|
32
|
-
protectionSnapshot: ProtectionSnapshot;
|
|
33
|
-
preservation: CanonicalDocumentEnvelope["preservation"];
|
|
34
|
-
}): WorkflowMarkupSnapshot {
|
|
35
|
-
const highlights: WorkflowHighlightMarkup[] = [];
|
|
36
|
-
const fields: WorkflowFieldMarkup[] = [];
|
|
37
|
-
const opaqueFragments: WorkflowOpaqueFragmentMarkup[] = [];
|
|
38
|
-
const surface = input.renderSnapshot.surface;
|
|
39
|
-
|
|
40
|
-
if (surface) {
|
|
41
|
-
collectSurfaceMarkup(
|
|
42
|
-
surface.blocks,
|
|
43
|
-
MAIN_STORY_TARGET,
|
|
44
|
-
input.preservation,
|
|
45
|
-
highlights,
|
|
46
|
-
opaqueFragments,
|
|
47
|
-
);
|
|
48
|
-
for (const story of surface.secondaryStories) {
|
|
49
|
-
collectSurfaceMarkup(
|
|
50
|
-
story.blocks,
|
|
51
|
-
story.target,
|
|
52
|
-
input.preservation,
|
|
53
|
-
highlights,
|
|
54
|
-
opaqueFragments,
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
fields.push(...collectFieldMarkup(surface, input.fieldSnapshot));
|
|
59
|
-
}
|
|
60
|
-
opaqueFragments.push(...collectOpaqueFragmentMarkup(input.preservation, opaqueFragments));
|
|
61
|
-
|
|
62
|
-
const comments = input.renderSnapshot.comments.threads.map((thread): WorkflowCommentMarkup => ({
|
|
63
|
-
markupId: `comment:${thread.commentId}`,
|
|
64
|
-
kind: "comment",
|
|
65
|
-
commentId: thread.commentId,
|
|
66
|
-
anchor: thread.anchor,
|
|
67
|
-
label: thread.anchorLabel,
|
|
68
|
-
excerpt: thread.excerpt,
|
|
69
|
-
status: thread.status,
|
|
70
|
-
warningCount: thread.warningCount,
|
|
71
|
-
entryCount: thread.entryCount,
|
|
72
|
-
createdAt: thread.createdAt,
|
|
73
|
-
createdBy: thread.createdBy,
|
|
74
|
-
}));
|
|
75
|
-
|
|
76
|
-
const revisions = input.renderSnapshot.trackedChanges.revisions.map(
|
|
77
|
-
(revision): WorkflowRevisionMarkup => ({
|
|
78
|
-
markupId: `revision:${revision.revisionId}`,
|
|
79
|
-
kind: "revision",
|
|
80
|
-
revisionId: revision.revisionId,
|
|
81
|
-
revisionKind: revision.kind,
|
|
82
|
-
anchor: revision.anchor,
|
|
83
|
-
label: revision.label,
|
|
84
|
-
excerpt: revision.excerpt,
|
|
85
|
-
status: revision.status,
|
|
86
|
-
actionability: revision.actionability,
|
|
87
|
-
authorId: revision.authorId,
|
|
88
|
-
createdAt: revision.createdAt,
|
|
89
|
-
preserveOnlyReason: revision.preserveOnlyReason,
|
|
90
|
-
}),
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
const protectedRanges = input.protectionSnapshot.ranges
|
|
94
|
-
.filter(
|
|
95
|
-
(range): range is typeof range & { start: number; end: number } =>
|
|
96
|
-
typeof range.start === "number" && typeof range.end === "number",
|
|
97
|
-
)
|
|
98
|
-
.map(
|
|
99
|
-
(range): WorkflowProtectedRangeMarkup => ({
|
|
100
|
-
markupId: `protected-range:${range.rangeId}`,
|
|
101
|
-
kind: "protected_range",
|
|
102
|
-
rangeId: range.rangeId,
|
|
103
|
-
anchor: createRangeAnchor(range.start, range.end),
|
|
104
|
-
storyTarget: MAIN_STORY_TARGET,
|
|
105
|
-
label: `Protected range ${range.rangeId}`,
|
|
106
|
-
excerpt: range.enforcementReason,
|
|
107
|
-
enforced: range.enforced,
|
|
108
|
-
enforcementReason: range.enforcementReason,
|
|
109
|
-
editorGroup: range.editorGroup,
|
|
110
|
-
editor: range.editor,
|
|
111
|
-
}),
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
const items: WorkflowMarkupItem[] = [
|
|
115
|
-
...highlights,
|
|
116
|
-
...comments,
|
|
117
|
-
...revisions,
|
|
118
|
-
...fields,
|
|
119
|
-
...protectedRanges,
|
|
120
|
-
...opaqueFragments,
|
|
121
|
-
];
|
|
122
|
-
|
|
123
|
-
return {
|
|
124
|
-
totalCount: items.length,
|
|
125
|
-
items,
|
|
126
|
-
highlights,
|
|
127
|
-
comments,
|
|
128
|
-
revisions,
|
|
129
|
-
fields,
|
|
130
|
-
protectedRanges,
|
|
131
|
-
opaqueFragments,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export function deriveWorkflowCandidateRangesFromMarkup(
|
|
136
|
-
snapshot: WorkflowMarkupSnapshot,
|
|
137
|
-
options: WorkflowCandidateRangeOptions = {},
|
|
138
|
-
): WorkflowCandidateRange[] {
|
|
139
|
-
const allowedKinds = options.kinds ? new Set(options.kinds) : null;
|
|
140
|
-
const includeDetached = options.includeDetached === true;
|
|
141
|
-
|
|
142
|
-
return snapshot.items
|
|
143
|
-
.filter((item) => (allowedKinds ? allowedKinds.has(item.kind) : true))
|
|
144
|
-
.filter((item) => includeDetached || item.anchor.kind !== "detached")
|
|
145
|
-
.map(
|
|
146
|
-
(item): WorkflowCandidateRange => ({
|
|
147
|
-
candidateId: item.markupId,
|
|
148
|
-
storyTarget: item.storyTarget,
|
|
149
|
-
anchor: item.anchor,
|
|
150
|
-
label: item.label,
|
|
151
|
-
source: options.source ?? "host",
|
|
152
|
-
}),
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function collectSurfaceMarkup(
|
|
157
|
-
blocks: readonly SurfaceBlockSnapshot[],
|
|
158
|
-
storyTarget: EditorStoryTarget,
|
|
159
|
-
preservation: CanonicalDocumentEnvelope["preservation"],
|
|
160
|
-
highlights: WorkflowHighlightMarkup[],
|
|
161
|
-
opaqueFragments: WorkflowOpaqueFragmentMarkup[],
|
|
162
|
-
): void {
|
|
163
|
-
for (const block of blocks) {
|
|
164
|
-
if (block.kind === "paragraph") {
|
|
165
|
-
for (const segment of block.segments) {
|
|
166
|
-
collectSegmentMarkup(segment, storyTarget, preservation, highlights, opaqueFragments);
|
|
167
|
-
}
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (block.kind === "table") {
|
|
172
|
-
for (const row of block.rows) {
|
|
173
|
-
for (const cell of row.cells) {
|
|
174
|
-
collectSurfaceMarkup(cell.content, storyTarget, preservation, highlights, opaqueFragments);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (block.kind === "sdt_block") {
|
|
181
|
-
collectSurfaceMarkup(block.children, storyTarget, preservation, highlights, opaqueFragments);
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const fragment = preservation.opaqueFragments[block.fragmentId];
|
|
186
|
-
const descriptor = fragment ? describeOpaqueFragment(fragment) : null;
|
|
187
|
-
const blockedReasonCode =
|
|
188
|
-
fragment && BLOCKED_IMPORT_FEATURE_KEYS.has(descriptor?.featureKey ?? "")
|
|
189
|
-
? "workflow_blocked_import"
|
|
190
|
-
: "workflow_preserve_only";
|
|
191
|
-
opaqueFragments.push({
|
|
192
|
-
markupId: `opaque:${block.fragmentId}`,
|
|
193
|
-
kind: "opaque_fragment",
|
|
194
|
-
fragmentId: block.fragmentId,
|
|
195
|
-
warningId: block.warningId,
|
|
196
|
-
anchor: createRangeAnchor(block.from, block.to),
|
|
197
|
-
storyTarget,
|
|
198
|
-
label: block.label,
|
|
199
|
-
excerpt: block.detail,
|
|
200
|
-
detail: block.detail,
|
|
201
|
-
blockedReasonCode,
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function collectSegmentMarkup(
|
|
207
|
-
segment: SurfaceInlineSegment,
|
|
208
|
-
storyTarget: EditorStoryTarget,
|
|
209
|
-
preservation: CanonicalDocumentEnvelope["preservation"],
|
|
210
|
-
highlights: WorkflowHighlightMarkup[],
|
|
211
|
-
opaqueFragments: WorkflowOpaqueFragmentMarkup[],
|
|
212
|
-
): void {
|
|
213
|
-
if (segment.kind === "text" && segment.markAttrs?.backgroundColor) {
|
|
214
|
-
highlights.push({
|
|
215
|
-
markupId: `highlight:${storyTargetKey(storyTarget)}:${segment.from}:${segment.to}:${segment.markAttrs.backgroundColor}`,
|
|
216
|
-
kind: "highlight",
|
|
217
|
-
anchor: createRangeAnchor(segment.from, segment.to),
|
|
218
|
-
storyTarget,
|
|
219
|
-
label: `Highlight ${segment.markAttrs.backgroundColor}`,
|
|
220
|
-
excerpt: segment.text,
|
|
221
|
-
color: segment.markAttrs.backgroundColor,
|
|
222
|
-
text: segment.text,
|
|
223
|
-
});
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (segment.kind === "opaque_inline") {
|
|
228
|
-
const fragment = preservation.opaqueFragments[segment.fragmentId];
|
|
229
|
-
const descriptor = fragment ? describeOpaqueFragment(fragment) : null;
|
|
230
|
-
const blockedReasonCode =
|
|
231
|
-
fragment && BLOCKED_IMPORT_FEATURE_KEYS.has(descriptor?.featureKey ?? "")
|
|
232
|
-
? "workflow_blocked_import"
|
|
233
|
-
: "workflow_preserve_only";
|
|
234
|
-
opaqueFragments.push({
|
|
235
|
-
markupId: `opaque:${segment.fragmentId}`,
|
|
236
|
-
kind: "opaque_fragment",
|
|
237
|
-
fragmentId: segment.fragmentId,
|
|
238
|
-
warningId: segment.warningId,
|
|
239
|
-
anchor: createRangeAnchor(segment.from, segment.to),
|
|
240
|
-
storyTarget,
|
|
241
|
-
label: segment.label,
|
|
242
|
-
excerpt: segment.detail,
|
|
243
|
-
detail: segment.detail,
|
|
244
|
-
blockedReasonCode,
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function collectFieldMarkup(
|
|
250
|
-
surface: RuntimeRenderSnapshot["surface"],
|
|
251
|
-
fieldSnapshot: FieldSnapshot,
|
|
252
|
-
): WorkflowFieldMarkup[] {
|
|
253
|
-
if (!surface) {
|
|
254
|
-
return [];
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const stories = [
|
|
258
|
-
{ blocks: surface.blocks, storyTarget: MAIN_STORY_TARGET },
|
|
259
|
-
...surface.secondaryStories.map((story) => ({
|
|
260
|
-
blocks: story.blocks,
|
|
261
|
-
storyTarget: story.target,
|
|
262
|
-
})),
|
|
263
|
-
];
|
|
264
|
-
|
|
265
|
-
return fieldSnapshot.fields.flatMap((field) => {
|
|
266
|
-
const displayText = field.displayText.trim();
|
|
267
|
-
if (!displayText) {
|
|
268
|
-
return [];
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
for (const story of stories) {
|
|
272
|
-
const matches = searchSurfaceBlocks(story.blocks, displayText, { limit: 2 });
|
|
273
|
-
if (matches.length === 1) {
|
|
274
|
-
const match = matches[0]!;
|
|
275
|
-
return [
|
|
276
|
-
{
|
|
277
|
-
markupId: `field:${field.index}`,
|
|
278
|
-
kind: "field",
|
|
279
|
-
anchor: createRangeAnchor(match.from, match.to),
|
|
280
|
-
storyTarget: story.storyTarget,
|
|
281
|
-
label: displayText,
|
|
282
|
-
excerpt: field.instruction,
|
|
283
|
-
fieldIndex: field.index,
|
|
284
|
-
fieldFamily: field.fieldFamily,
|
|
285
|
-
fieldTarget: field.fieldTarget,
|
|
286
|
-
refreshStatus: field.refreshStatus,
|
|
287
|
-
displayText: field.displayText,
|
|
288
|
-
} satisfies WorkflowFieldMarkup,
|
|
289
|
-
];
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return [];
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
function collectOpaqueFragmentMarkup(
|
|
298
|
-
preservation: CanonicalDocumentEnvelope["preservation"],
|
|
299
|
-
existing: WorkflowOpaqueFragmentMarkup[],
|
|
300
|
-
): WorkflowOpaqueFragmentMarkup[] {
|
|
301
|
-
const seen = new Set(existing.map((item) => item.fragmentId));
|
|
302
|
-
|
|
303
|
-
return Object.values(preservation.opaqueFragments)
|
|
304
|
-
.filter(
|
|
305
|
-
(fragment) =>
|
|
306
|
-
!seen.has(fragment.fragmentId)
|
|
307
|
-
&& fragment.packagePartName === "/word/document.xml",
|
|
308
|
-
)
|
|
309
|
-
.map((fragment) => {
|
|
310
|
-
const descriptor = describeOpaqueFragment(fragment);
|
|
311
|
-
const blockedReasonCode = BLOCKED_IMPORT_FEATURE_KEYS.has(descriptor.featureKey)
|
|
312
|
-
? "workflow_blocked_import"
|
|
313
|
-
: "workflow_preserve_only";
|
|
314
|
-
|
|
315
|
-
return {
|
|
316
|
-
markupId: `opaque:${fragment.fragmentId}`,
|
|
317
|
-
kind: "opaque_fragment",
|
|
318
|
-
fragmentId: fragment.fragmentId,
|
|
319
|
-
warningId: fragment.warningId,
|
|
320
|
-
anchor: createRangeAnchor(fragment.lastKnownRange.from, fragment.lastKnownRange.to),
|
|
321
|
-
storyTarget: MAIN_STORY_TARGET,
|
|
322
|
-
label: descriptor.label,
|
|
323
|
-
excerpt: descriptor.detail,
|
|
324
|
-
detail: descriptor.detail,
|
|
325
|
-
blockedReasonCode,
|
|
326
|
-
} satisfies WorkflowOpaqueFragmentMarkup;
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function createRangeAnchor(from: number, to: number): EditorAnchorProjection {
|
|
331
|
-
return {
|
|
332
|
-
kind: "range",
|
|
333
|
-
from,
|
|
334
|
-
to,
|
|
335
|
-
assoc: {
|
|
336
|
-
start: -1,
|
|
337
|
-
end: 1,
|
|
338
|
-
},
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function storyTargetKey(storyTarget: EditorStoryTarget): string {
|
|
343
|
-
switch (storyTarget.kind) {
|
|
344
|
-
case "main":
|
|
345
|
-
return "main";
|
|
346
|
-
case "header":
|
|
347
|
-
case "footer":
|
|
348
|
-
return `${storyTarget.kind}:${storyTarget.relationshipId}:${storyTarget.variant}:${storyTarget.sectionIndex ?? "none"}`;
|
|
349
|
-
case "footnote":
|
|
350
|
-
case "endnote":
|
|
351
|
-
return `${storyTarget.kind}:${storyTarget.noteId}`;
|
|
352
|
-
}
|
|
353
|
-
}
|
package/src/ui/README.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# UI
|
|
2
|
-
|
|
3
|
-
This directory contains the public entry point and shared headless logic for the editor UI.
|
|
4
|
-
|
|
5
|
-
## Entry Point
|
|
6
|
-
|
|
7
|
-
`WordReviewEditor.tsx` is the public component. It bridges the `DocumentRuntime` to the Tailwind rendering layer in `src/ui-tailwind/`.
|
|
8
|
-
|
|
9
|
-
## Headless Logic
|
|
10
|
-
|
|
11
|
-
`headless/` contains pure, framework-free utilities shared across implementations:
|
|
12
|
-
|
|
13
|
-
- `use-editor-keyboard.ts` — Keyboard event handler factory
|
|
14
|
-
- `comment-decoration-model.ts` — Comment anchor → highlight class computation
|
|
15
|
-
- `revision-decoration-model.ts` — Revision anchor → highlight class computation
|
|
16
|
-
- `selection-helpers.ts` — Selection snapshot utilities
|
|
17
|
-
|
|
18
|
-
## Session Capabilities
|
|
19
|
-
|
|
20
|
-
`src/runtime/session-capabilities.ts` derives all UI control states from `RuntimeRenderSnapshot`. The `deriveCapabilities(snapshot, reviewMode)` function is called on every render in `WordReviewEditor.tsx` and the result is passed to the workspace components.
|
|
21
|
-
|
|
22
|
-
## Shared Utilities
|
|
23
|
-
|
|
24
|
-
`shared/revision-filters.ts` — Shared revision filtering and empty state helpers.
|
|
25
|
-
|
|
26
|
-
## Rendering
|
|
27
|
-
|
|
28
|
-
All visual rendering is in `src/ui-tailwind/`. See `docs/reference/word-review-editor-frontend-architecture.md` for the canonical architecture.
|
|
29
|
-
|
|
30
|
-
Legacy inline-CSSProperties components have been removed.
|