@beyondwork/docx-react-component 1.0.67 → 1.0.70
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/README.md +75 -932
- package/package.json +26 -27
- package/src/api/anchor-conversion.ts +43 -0
- package/src/api/editor-state-types.ts +2 -1
- package/src/api/public-types.ts +504 -101
- package/src/api/session-state.ts +4 -0
- package/src/api/v3/README.md +91 -0
- package/src/api/v3/_create.ts +146 -0
- package/src/api/v3/_layer-metadata.ts +362 -0
- package/src/api/v3/_mocks.ts +84 -0
- package/src/api/v3/_runtime-handle.ts +162 -0
- package/src/api/v3/_ux-response.ts +73 -0
- package/src/api/v3/ai/_metadata-audit.ts +225 -0
- package/src/api/v3/ai/attach.ts +235 -0
- package/src/api/v3/ai/bundle.ts +132 -0
- package/src/api/v3/ai/explain.ts +144 -0
- package/src/api/v3/ai/export.ts +54 -0
- package/src/api/v3/ai/inspect.ts +118 -0
- package/src/api/v3/ai/policy.ts +77 -0
- package/src/api/v3/ai/replacement.ts +341 -0
- package/src/api/v3/ai/resolve.ts +133 -0
- package/src/api/v3/index.ts +79 -0
- package/src/api/v3/runtime/chart.ts +310 -0
- package/src/api/v3/runtime/clipboard.ts +81 -0
- package/src/api/v3/runtime/collab.ts +331 -0
- package/src/api/v3/runtime/content.ts +236 -0
- package/src/api/v3/runtime/document.ts +282 -0
- package/src/api/v3/runtime/formatting.ts +186 -0
- package/src/api/v3/runtime/geometry.ts +349 -0
- package/src/api/v3/runtime/layout.ts +108 -0
- package/src/api/v3/runtime/review.ts +129 -0
- package/src/api/v3/runtime/search.ts +74 -0
- package/src/api/v3/runtime/table.ts +63 -0
- package/src/api/v3/runtime/workflow.ts +434 -0
- package/src/api/v3/ui/_context.ts +86 -0
- package/src/api/v3/ui/_create.ts +65 -0
- package/src/api/v3/ui/_types.ts +520 -0
- package/src/api/v3/ui/chrome-composition.ts +342 -0
- package/src/{ui-tailwind/chrome → api/v3/ui}/chrome-preset-model.ts +11 -1
- package/src/api/v3/ui/chrome.ts +476 -0
- package/src/api/v3/ui/debug.ts +124 -0
- package/src/api/v3/ui/index.ts +64 -0
- package/src/api/v3/ui/overlays-visibility.ts +170 -0
- package/src/api/v3/ui/overlays.ts +427 -0
- package/src/api/v3/ui/scope.ts +71 -0
- package/src/api/v3/ui/session.ts +100 -0
- package/src/api/v3/ui/surface.ts +170 -0
- package/src/api/v3/ui/viewport.ts +303 -0
- package/src/core/commands/index.ts +28 -6
- package/src/core/commands/list-commands.ts +3 -2
- package/src/core/commands/section-layout-commands.ts +9 -8
- package/src/core/schema/text-schema.ts +16 -0
- package/src/core/selection/mapping.ts +33 -72
- package/src/core/state/editor-state.ts +96 -189
- package/src/index.ts +23 -4
- package/src/io/chart-preview-resolver.ts +1 -1
- package/src/io/docx-session.ts +36 -4797
- package/src/io/export/build-app-properties-xml.ts +1 -1
- package/src/io/export/serialize-comments.ts +1 -1
- package/src/io/export/serialize-headers-footers.ts +6 -1
- package/src/io/export/serialize-main-document.ts +45 -0
- package/src/io/export/serialize-run-formatting.ts +17 -2
- package/src/io/export/twip.ts +1 -1
- package/src/io/normalize/normalize-text.ts +27 -20
- package/src/io/ooxml/chart/parse-series.ts +1 -1
- package/src/io/ooxml/chart/resolve-color.ts +2 -2
- package/src/io/ooxml/chart/types.ts +1 -1
- package/src/io/ooxml/classify-embedding.ts +83 -33
- package/src/io/ooxml/parse-fill.ts +1 -1
- package/src/io/ooxml/parse-main-document.ts +71 -1
- package/src/io/ooxml/parse-object.ts +14 -10
- package/src/io/ooxml/parse-run-formatting.ts +47 -1
- package/src/io/ooxml/property-grab-bag.ts +2 -2
- package/src/io/ooxml/units.ts +11 -0
- package/src/io/ooxml/workflow-payload.ts +282 -7
- package/src/model/anchor.ts +85 -0
- package/src/model/canonical-document.ts +351 -15
- package/src/model/chart-types.ts +1 -1
- package/src/model/layout/index.ts +83 -0
- package/src/model/layout/page-graph-types.ts +181 -0
- package/src/model/layout/page-layout-snapshot.ts +105 -0
- package/src/model/layout/resolved-layout-types.ts +47 -0
- package/src/model/layout/runtime-page-graph-types.ts +102 -0
- package/src/model/paragraph-scope-ids.ts +72 -0
- package/src/model/review/comment-types.ts +112 -0
- package/src/model/review/index.ts +2 -0
- package/src/model/review/revision-types.ts +215 -0
- package/src/model/snapshot.ts +32 -0
- package/src/review/store/comment-store.ts +21 -47
- package/src/review/store/revision-types.ts +40 -198
- package/src/runtime/collab/base-doc-fingerprint.ts +6 -1
- package/src/runtime/collab/runtime-collab-sync.ts +13 -3
- package/src/runtime/collab-session.ts +1 -1
- package/src/runtime/debug/build-debug-inspector-snapshot.ts +686 -0
- package/src/runtime/debug/event-ring-buffer.ts +64 -0
- package/src/runtime/debug/probability-sampler.ts +18 -0
- package/src/runtime/debug/runtime-debug-facet.ts +67 -0
- package/src/runtime/debug/stage-tokens.ts +31 -0
- package/src/runtime/debug/telemetry-bus.ts +271 -0
- package/src/runtime/debug/types.ts +275 -0
- package/src/runtime/debug/wrap-ref-for-telemetry.ts +118 -0
- package/src/runtime/document-layout.ts +8 -6
- package/src/runtime/document-runtime.ts +843 -1141
- package/src/runtime/document-search.ts +1 -1
- package/src/runtime/edit-ops/index.ts +1 -1
- package/src/runtime/external-send-runtime.ts +1 -1
- package/src/runtime/formatting/document-lookup.ts +235 -0
- package/src/runtime/formatting/field/registry.ts +41 -0
- package/src/runtime/{field-resolver.ts → formatting/field/resolver.ts} +27 -2
- package/src/runtime/formatting/font-resolution.ts +83 -0
- package/src/runtime/formatting/formatting-context.ts +903 -0
- package/src/runtime/formatting/formatting-types.ts +157 -0
- package/src/runtime/{hyperlink-color-resolver.ts → formatting/hyperlink-color.ts} +2 -2
- package/src/runtime/formatting/index.ts +125 -0
- package/src/runtime/{resolved-numbering-geometry.ts → formatting/numbering/geometry.ts} +1 -1
- package/src/runtime/{numbering-prefix.ts → formatting/numbering/prefix.ts} +170 -3
- package/src/runtime/formatting/paragraph-style-resolver.ts +92 -0
- package/src/runtime/formatting/projector.ts +75 -0
- package/src/runtime/formatting/resolve-effective.ts +407 -0
- package/src/runtime/formatting/revision-display.ts +105 -0
- package/src/runtime/{paragraph-style-resolver.ts → formatting/style-cascade.ts} +84 -141
- package/src/runtime/{table-style-resolver.ts → formatting/table-style-resolver.ts} +1 -1
- package/src/runtime/formatting/telemetry-bridge.ts +106 -0
- package/src/runtime/{theme-color-resolver.ts → formatting/theme-color.ts} +2 -30
- package/src/runtime/geometry/caret-geometry.ts +164 -0
- package/src/runtime/geometry/geometry-facet.ts +364 -0
- package/src/runtime/geometry/geometry-types.ts +256 -0
- package/src/runtime/geometry/hit-test.ts +125 -0
- package/src/runtime/geometry/index.ts +71 -0
- package/src/runtime/geometry/inert-geometry-facet.ts +43 -0
- package/src/runtime/geometry/invalidation.ts +35 -0
- package/src/runtime/geometry/object-handles.ts +77 -0
- package/src/runtime/geometry/overlay-rects.ts +85 -0
- package/src/runtime/geometry/project-anchors.ts +100 -0
- package/src/runtime/geometry/project-fragments.ts +216 -0
- package/src/runtime/geometry/projector.ts +129 -0
- package/src/runtime/geometry/replacement-envelope.ts +130 -0
- package/src/runtime/geometry/viewport.ts +218 -0
- package/src/runtime/layout/compat-input-ledger.ts +211 -0
- package/src/runtime/layout/index.ts +6 -1
- package/src/runtime/layout/inert-layout-facet.ts +12 -7
- package/src/runtime/layout/layout-engine-instance.ts +189 -11
- package/src/runtime/layout/layout-engine-version.ts +450 -1
- package/src/runtime/layout/layout-facet-types.ts +60 -0
- package/src/runtime/layout/layout-measurement-provider.ts +13 -0
- package/src/runtime/layout/measurement-backend-canvas.ts +14 -2
- package/src/runtime/layout/measurement-backend-empirical.ts +23 -4
- package/src/runtime/layout/page-graph.ts +62 -209
- package/src/runtime/layout/page-story-resolver.ts +7 -12
- package/src/runtime/layout/paginated-layout-engine.ts +186 -11
- package/src/runtime/layout/project-block-fragments.ts +11 -0
- package/src/runtime/layout/projector.ts +90 -0
- package/src/runtime/layout/public-facet.ts +187 -442
- package/src/runtime/layout/resolved-formatting-state.ts +158 -26
- package/src/runtime/layout/table-render-plan.ts +1 -1
- package/src/runtime/prerender/cache-envelope.ts +6 -1
- package/src/runtime/prerender/prerender-document.ts +18 -23
- package/src/runtime/render/decoration-resolver.ts +1 -1
- package/src/runtime/render/render-frame-types.ts +20 -0
- package/src/runtime/render/render-kernel.ts +94 -25
- package/src/runtime/scopes/_formatting-seam.ts +262 -0
- package/src/runtime/scopes/_scope-dependencies.ts +49 -0
- package/src/runtime/scopes/action-validation.ts +356 -0
- package/src/runtime/scopes/attach-explanation.ts +102 -0
- package/src/runtime/scopes/audit-bundle.ts +71 -0
- package/src/runtime/scopes/compile-scope-bundle.ts +163 -0
- package/src/runtime/scopes/compile-scope.ts +262 -0
- package/src/runtime/scopes/compiler-service.ts +431 -0
- package/src/runtime/scopes/create-issue.ts +107 -0
- package/src/runtime/scopes/enumerate-scopes.ts +543 -0
- package/src/runtime/scopes/evidence.ts +233 -0
- package/src/runtime/scopes/index.ts +150 -0
- package/src/runtime/scopes/position-map.ts +214 -0
- package/src/runtime/scopes/preservation-boundary.ts +91 -0
- package/src/runtime/scopes/projector.ts +49 -0
- package/src/runtime/scopes/replaceability.ts +87 -0
- package/src/runtime/scopes/replacement/apply.ts +228 -0
- package/src/runtime/scopes/replacement/compile.ts +59 -0
- package/src/runtime/scopes/replacement/propose.ts +42 -0
- package/src/runtime/scopes/resolve-reference.ts +347 -0
- package/src/runtime/scopes/review-bundle.ts +141 -0
- package/src/runtime/scopes/scope-kinds/_paragraph-text.ts +57 -0
- package/src/runtime/scopes/scope-kinds/_table-text.ts +42 -0
- package/src/runtime/scopes/scope-kinds/comment-thread.ts +59 -0
- package/src/runtime/scopes/scope-kinds/field.ts +65 -0
- package/src/runtime/scopes/scope-kinds/heading.ts +84 -0
- package/src/runtime/scopes/scope-kinds/list-item.ts +77 -0
- package/src/runtime/scopes/scope-kinds/paragraph.ts +182 -0
- package/src/runtime/scopes/scope-kinds/revision.ts +62 -0
- package/src/runtime/scopes/scope-kinds/table-cell.ts +57 -0
- package/src/runtime/scopes/scope-kinds/table-row.ts +61 -0
- package/src/runtime/scopes/scope-kinds/table.ts +55 -0
- package/src/runtime/scopes/scope-range.ts +208 -0
- package/src/runtime/scopes/semantic-scope-types.ts +454 -0
- package/src/runtime/scopes/workflow-overlap.ts +92 -0
- package/src/runtime/selection/index.ts +1 -1
- package/src/runtime/structure-ops/fragment-insert.ts +1 -1
- package/src/runtime/structure-ops/index.ts +1 -1
- package/src/runtime/surface-projection.ts +232 -262
- package/src/runtime/units.ts +4 -2
- package/src/runtime/workflow/coordinator.ts +1348 -0
- package/src/runtime/workflow/derived-scope-resolver.ts +125 -0
- package/src/runtime/workflow/index.ts +25 -0
- package/src/runtime/workflow/markup-mode-policy.ts +98 -0
- package/src/runtime/{workflow-markup.ts → workflow/markup.ts} +6 -6
- package/src/runtime/workflow/metadata-persistence.ts +306 -0
- package/src/runtime/workflow/metadata-writer.ts +123 -0
- package/src/runtime/workflow/overlay-store.ts +690 -0
- package/src/runtime/workflow/projector.ts +127 -0
- package/src/runtime/{query-scopes.ts → workflow/query-scopes.ts} +3 -3
- package/src/runtime/{workflow-rail-segments.ts → workflow/rail/compose.ts} +60 -165
- package/src/runtime/workflow/rail/types.ts +198 -0
- package/src/runtime/workflow/scope-rail-composer.ts +39 -0
- package/src/runtime/{scope-resolver.ts → workflow/scope-resolver.ts} +3 -3
- package/src/runtime/workflow/scope-writer.ts +188 -0
- package/src/runtime/{tamper-gate.ts → workflow/tamper-gate.ts} +1 -1
- package/src/runtime/workflow/visibility-policy.ts +129 -0
- package/src/session/_sync-legacy.ts +66 -0
- package/src/session/export/embedded-reconstitute.ts +104 -0
- package/src/session/export/export-diagnostics.ts +85 -0
- package/src/session/export/export-validation.ts +110 -0
- package/src/session/export/index.ts +34 -0
- package/src/session/export/preservation-reattach.ts +30 -0
- package/src/session/export/serialize-dispatch.ts +165 -0
- package/src/session/export/stateful-export-pipeline.ts +432 -0
- package/src/session/export/stateful-export.ts +684 -0
- package/src/session/import/canonical-assembly.ts +227 -0
- package/src/session/import/diagnostics-session.ts +54 -0
- package/src/session/import/embedded-discovery.ts +225 -0
- package/src/session/import/embedded-offload.ts +337 -0
- package/src/session/import/import-diagnostics.ts +69 -0
- package/src/session/import/loader-types.ts +313 -0
- package/src/session/import/loader.ts +1834 -0
- package/src/session/import/normalize.ts +195 -0
- package/src/session/import/package-parts.ts +217 -0
- package/src/session/import/package-read.ts +195 -0
- package/src/session/import/parse-orchestration.ts +105 -0
- package/src/session/import/part-constants.ts +70 -0
- package/src/session/import/part-discovery.ts +94 -0
- package/src/session/import/preservation-index.ts +46 -0
- package/src/{runtime/read-only-diagnostics-runtime.ts → session/import/read-only-diagnostics.ts} +24 -3
- package/src/session/import/review-import.ts +508 -0
- package/src/session/import/styles-consolidation.ts +281 -0
- package/src/session/import/workflow-scope-import.ts +256 -0
- package/src/session/index.ts +37 -0
- package/src/session/session-state.ts +69 -0
- package/src/session/session.ts +532 -0
- package/src/session/shared/protection.ts +228 -0
- package/src/session/shared/session-utils.ts +82 -0
- package/src/session/types.ts +499 -0
- package/src/shell/chart-snapshots.ts +96 -0
- package/src/shell/media-previews.ts +85 -0
- package/src/shell/overlay-anchor-bridge.ts +53 -0
- package/src/shell/paste-adapter.ts +23 -0
- package/src/shell/ref-commands.ts +1697 -0
- package/src/shell/ref-utilities.ts +48 -0
- package/src/shell/search.ts +51 -0
- package/src/{ui/editor-runtime-boundary.ts → shell/session-bootstrap.ts} +243 -67
- package/src/shell/ui-subscriber-channels.ts +81 -0
- package/src/shell/use-collab-sync.ts +116 -0
- package/src/ui/WordReviewEditor.tsx +496 -2051
- package/src/ui/editor-shell-view.tsx +30 -1
- package/src/ui/editor-surface-controller.tsx +49 -1
- package/src/ui/headless/revision-decoration-model.ts +83 -0
- package/src/{ui-tailwind/chrome → ui/headless}/role-action-sets.ts +1 -1
- package/src/ui/headless/scoped-chrome-policy.ts +2 -2
- package/src/ui/headless/selection-tool-context.ts +1 -1
- package/src/ui/headless/selection-tool-resolver.ts +1 -1
- package/src/ui/runtime-shortcut-dispatch.ts +46 -1
- package/src/ui/ui-controller-factory.ts +221 -0
- package/src/ui-tailwind/chart/ChartSurface.tsx +2 -2
- package/src/ui-tailwind/chart/layout/legend-layout.ts +1 -1
- package/src/ui-tailwind/chart/layout/plot-area.ts +2 -2
- package/src/ui-tailwind/chart/layout/title-layout.ts +1 -1
- package/src/ui-tailwind/chart/render/area.tsx +3 -3
- package/src/ui-tailwind/chart/render/bar-column.tsx +3 -3
- package/src/ui-tailwind/chart/render/bubble.tsx +3 -3
- package/src/ui-tailwind/chart/render/combo.tsx +2 -2
- package/src/ui-tailwind/chart/render/data-labels.tsx +2 -2
- package/src/ui-tailwind/chart/render/font-metrics.ts +2 -2
- package/src/ui-tailwind/chart/render/line.tsx +3 -3
- package/src/ui-tailwind/chart/render/pie.tsx +6 -6
- package/src/ui-tailwind/chart/render/scatter.tsx +3 -3
- package/src/ui-tailwind/chart/render/svg-primitives.ts +3 -3
- package/src/ui-tailwind/chart/render/unsupported.tsx +2 -2
- package/src/ui-tailwind/chrome/build-context-menu-entries.ts +88 -0
- package/src/ui-tailwind/chrome/chrome-preset-toolbar.tsx +1 -1
- package/src/ui-tailwind/chrome/collab-send-to-supplier-button.tsx +1 -1
- package/src/ui-tailwind/chrome/collab-tamper-banner.tsx +1 -1
- package/src/ui-tailwind/chrome/collab-top-nav-container.tsx +1 -1
- package/src/ui-tailwind/chrome/editor-action-registry.ts +553 -0
- package/src/ui-tailwind/chrome/editor-actions-to-palette.ts +182 -0
- package/src/ui-tailwind/chrome/local-surface-arbiter.ts +534 -0
- package/src/ui-tailwind/chrome/resolve-target-kind.ts +226 -0
- package/src/ui-tailwind/chrome/tw-alert-banner.tsx +38 -4
- package/src/ui-tailwind/chrome/tw-context-band.tsx +125 -0
- package/src/ui-tailwind/chrome/tw-context-menu-portal.tsx +248 -0
- package/src/ui-tailwind/chrome/tw-image-context-toolbar.tsx +42 -1
- package/src/ui-tailwind/chrome/tw-selection-anchor-resolver.ts +8 -7
- package/src/ui-tailwind/chrome/tw-selection-tool-blocked.tsx +38 -4
- package/src/ui-tailwind/chrome/tw-selection-tool-comment.tsx +104 -6
- package/src/ui-tailwind/chrome/tw-selection-tool-host.tsx +66 -7
- package/src/ui-tailwind/chrome/tw-selection-tool-workflow.tsx +54 -8
- package/src/ui-tailwind/chrome/tw-shortcut-hint.tsx +7 -1
- package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +33 -0
- package/src/ui-tailwind/chrome/tw-table-context-toolbar.tsx +78 -1
- package/src/ui-tailwind/chrome/tw-table-grip-layer.tsx +16 -8
- package/src/ui-tailwind/chrome/tw-workspace-chrome-host.tsx +276 -0
- package/src/ui-tailwind/chrome/use-context-menu-controller.ts +201 -0
- package/src/ui-tailwind/chrome-overlay/chrome-overlay-projector.ts +1 -1
- package/src/ui-tailwind/chrome-overlay/tw-chrome-overlay.tsx +22 -4
- package/src/ui-tailwind/chrome-overlay/tw-comment-balloon-layer.tsx +1 -1
- package/src/ui-tailwind/chrome-overlay/tw-locked-block-layer.tsx +1 -1
- package/src/ui-tailwind/chrome-overlay/tw-object-selection-overlay.tsx +11 -5
- package/src/ui-tailwind/chrome-overlay/tw-page-stack-overlay-layer.tsx +197 -3
- package/src/ui-tailwind/chrome-overlay/tw-revision-margin-bar-layer.tsx +1 -1
- package/src/ui-tailwind/chrome-overlay/tw-scope-card-layer.tsx +35 -6
- package/src/ui-tailwind/chrome-overlay/tw-scope-rail-layer.tsx +24 -16
- package/src/ui-tailwind/chrome-overlay/tw-table-continuation-header.tsx +1 -1
- package/src/ui-tailwind/debug/README.md +57 -0
- package/src/ui-tailwind/debug/index.ts +3 -0
- package/src/ui-tailwind/debug/tw-debug-overlay.tsx +186 -0
- package/src/ui-tailwind/debug/tw-debug-presentation.tsx +80 -0
- package/src/ui-tailwind/debug/tw-debug-top-bar.tsx +83 -0
- package/src/ui-tailwind/editor-surface/chart-node-view.tsx +2 -2
- package/src/ui-tailwind/editor-surface/float-wrap-resolver.ts +1 -1
- package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +135 -10
- package/src/ui-tailwind/editor-surface/pm-decorations.ts +40 -13
- package/src/ui-tailwind/editor-surface/pm-page-break-decorations.ts +1 -1
- package/src/ui-tailwind/editor-surface/pm-schema.ts +1 -1
- package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +3 -3
- package/src/ui-tailwind/editor-surface/predicted-tag-preflight.ts +1 -1
- package/src/ui-tailwind/editor-surface/remote-cursor-plugin.ts +2 -2
- package/src/ui-tailwind/editor-surface/scroll-anchor.ts +91 -9
- package/src/ui-tailwind/editor-surface/shape-renderer.ts +1 -1
- package/src/ui-tailwind/editor-surface/surface-layer.ts +1 -1
- package/src/ui-tailwind/editor-surface/tw-opaque-block.tsx +1 -1
- package/src/ui-tailwind/editor-surface/tw-page-block-view.helpers.ts +23 -6
- package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +132 -22
- package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +1 -1
- package/src/ui-tailwind/index.ts +0 -5
- package/src/ui-tailwind/overlay-anchor-bridge-context.tsx +33 -0
- package/src/ui-tailwind/page-stack/floating-image-overlay-model.ts +66 -29
- package/src/ui-tailwind/page-stack/tw-floating-image-layer.tsx +25 -2
- package/src/ui-tailwind/review/comment-markdown-renderer.tsx +15 -0
- package/src/ui-tailwind/review/tw-review-rail.tsx +92 -4
- package/src/ui-tailwind/review/tw-workflow-tab.tsx +1 -1
- package/src/ui-tailwind/review-workspace/page-chrome.ts +210 -0
- package/src/ui-tailwind/review-workspace/page-shell-metrics.ts +101 -0
- package/src/ui-tailwind/review-workspace/paragraph-layout.ts +115 -0
- package/src/ui-tailwind/review-workspace/selection-toolbar-placement.ts +97 -0
- package/src/ui-tailwind/review-workspace/tw-review-workspace-navigator.tsx +130 -0
- package/src/ui-tailwind/review-workspace/tw-review-workspace-page-toolbar.tsx +240 -0
- package/src/ui-tailwind/review-workspace/tw-review-workspace-rail.tsx +59 -0
- package/src/ui-tailwind/review-workspace/types.ts +408 -0
- package/src/ui-tailwind/review-workspace/use-chrome-policy.ts +104 -0
- package/src/ui-tailwind/review-workspace/use-derived-view-state.ts +151 -0
- package/src/ui-tailwind/review-workspace/use-diagnostics-signal.ts +70 -0
- package/src/ui-tailwind/review-workspace/use-grabbed-segment-offsets.ts +40 -0
- package/src/ui-tailwind/review-workspace/use-layout-facet-render-signal.ts +55 -0
- package/src/ui-tailwind/review-workspace/use-page-markers.ts +130 -0
- package/src/ui-tailwind/review-workspace/use-pm-surface-capture.ts +60 -0
- package/src/ui-tailwind/review-workspace/use-review-rail-state.ts +63 -0
- package/src/ui-tailwind/review-workspace/use-scope-card-state.ts +170 -0
- package/src/ui-tailwind/review-workspace/use-scroll-root-capture.ts +28 -0
- package/src/ui-tailwind/review-workspace/use-selection-toolbar-placement.ts +113 -0
- package/src/ui-tailwind/review-workspace/use-shell-selection-anchor-bridge.ts +120 -0
- package/src/ui-tailwind/review-workspace/use-status-bar-page-facts.ts +55 -0
- package/src/ui-tailwind/review-workspace/use-viewport-dimensions.ts +43 -0
- package/src/ui-tailwind/review-workspace/use-workspace-arbiter.ts +25 -0
- package/src/ui-tailwind/review-workspace/use-workspace-composition.ts +86 -0
- package/src/ui-tailwind/review-workspace/use-workspace-side-effects.ts +150 -0
- package/src/ui-tailwind/theme/editor-theme.css +25 -0
- package/src/ui-tailwind/toolbar/tw-role-action-region.tsx +2 -2
- package/src/ui-tailwind/toolbar/tw-toolbar.tsx +61 -98
- package/src/ui-tailwind/tw-review-workspace.tsx +521 -1802
- package/src/ui-tailwind/ui-api-context.tsx +43 -0
- package/src/ui-tailwind/ui-shell-channels-context.tsx +49 -0
- package/src/validation/compatibility-engine.ts +6 -6
- package/src/runtime/styles-cascade.ts +0 -33
- package/src/ui-tailwind/chrome/tw-mode-dock.tsx +0 -85
- /package/src/runtime/{page-number-format.ts → formatting/field/page-number-format.ts} +0 -0
- /package/src/runtime/{ai-action-policy.ts → workflow/ai-action-policy.ts} +0 -0
- /package/src/runtime/{scope-tag-registry.ts → workflow/scope-tag-registry.ts} +0 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @endStateApi v3 — `runtime.chart` family.
|
|
3
|
+
*
|
|
4
|
+
* Ships coord-07 §2.1 / coord-11 §4.1 — the chart-family substrate
|
|
5
|
+
* seam. Before this family, the 7 chart renderers under
|
|
6
|
+
* `src/ui-tailwind/chart/render/**` + `chart-node-view.tsx` reached
|
|
7
|
+
* into `src/io/ooxml/chart/**` and `src/runtime/chart/**` directly,
|
|
8
|
+
* keeping the Layer-11 boundary register at +11 imports that the
|
|
9
|
+
* refactor/11 guard must track. This family re-exposes the pure
|
|
10
|
+
* helpers through the v3 seam so L11 consumers can flip their
|
|
11
|
+
* imports from `src/io/ooxml/chart/**` → `src/api/v3/runtime/chart.ts`
|
|
12
|
+
* (a v3 import is outside the L11 substrate-boundary rule).
|
|
13
|
+
*
|
|
14
|
+
* Every function is `live` — direct delegation, no adapter debt.
|
|
15
|
+
* Pure read-only computations over typed inputs (theme, styleXml,
|
|
16
|
+
* seriesIdx, chartId). No runtime state mutated; no UxResponse
|
|
17
|
+
* emission. `stateClass: "C-local"` + `persistsTo: "none"`.
|
|
18
|
+
*
|
|
19
|
+
* Type re-exports (`ChartStyle`, `SeriesColorMode`) move the non-
|
|
20
|
+
* public chart-style-table types onto the v3 surface so presentation
|
|
21
|
+
* consumers don't have to peek into `src/io/ooxml/chart/**` for
|
|
22
|
+
* types either. This mirrors the pattern `public-types.ts` uses for
|
|
23
|
+
* chart-model types (`export type * from "../model/chart-types"`).
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import type { RuntimeApiHandle } from "../_runtime-handle.ts";
|
|
27
|
+
import type { ApiV3FnMetadata } from "../_layer-metadata.ts";
|
|
28
|
+
import type { ChartModel, ColorRef, ResolvedTheme } from "../../public-types.ts";
|
|
29
|
+
import {
|
|
30
|
+
composeSeriesColor as composeSeriesColorImpl,
|
|
31
|
+
deriveResolvedColors as deriveResolvedColorsImpl,
|
|
32
|
+
} from "../../../io/ooxml/chart/compose-series-color.ts";
|
|
33
|
+
import { resolveColor as resolveColorImpl } from "../../../io/ooxml/chart/resolve-color.ts";
|
|
34
|
+
import { paletteColorRef as paletteColorRefImpl } from "../../../io/ooxml/chart/color-palette.ts";
|
|
35
|
+
import {
|
|
36
|
+
getChartStyle as getChartStyleImpl,
|
|
37
|
+
resolveChartStyleId as resolveChartStyleIdImpl,
|
|
38
|
+
type ChartStyle,
|
|
39
|
+
type SeriesColorMode,
|
|
40
|
+
} from "../../../io/ooxml/chart/chart-style-table.ts";
|
|
41
|
+
import {
|
|
42
|
+
chartModelStore,
|
|
43
|
+
type ChartStoreEntry,
|
|
44
|
+
} from "../../../runtime/chart/chart-model-store.ts";
|
|
45
|
+
|
|
46
|
+
// Re-exports — presentation consumers migrating off `src/io/**` reach
|
|
47
|
+
// for these types through the v3 namespace.
|
|
48
|
+
export type { ChartStyle, SeriesColorMode, ChartStoreEntry };
|
|
49
|
+
|
|
50
|
+
// ---------------------------------------------------------------------
|
|
51
|
+
// L11-facing named re-exports (coord-11 §4.1 migration seam)
|
|
52
|
+
// ---------------------------------------------------------------------
|
|
53
|
+
//
|
|
54
|
+
// The chart renderers at `src/ui-tailwind/chart/render/**` +
|
|
55
|
+
// `src/ui-tailwind/editor-surface/chart-node-view.tsx` are pure React
|
|
56
|
+
// consumers of these helpers — no runtime handle in scope. Exposing
|
|
57
|
+
// the helpers as top-level named exports (identity re-exports of the
|
|
58
|
+
// same impls the factory binds) lets those consumers migrate their
|
|
59
|
+
// imports from `src/io/ooxml/chart/**` + `src/runtime/chart/**` onto
|
|
60
|
+
// the v3 seam without threading the factory instance through props /
|
|
61
|
+
// context. Matches the pattern `table.ts` established for
|
|
62
|
+
// `TableSelectionDescriptor` (type re-export), extended to values
|
|
63
|
+
// because these are structurally pure + read-only.
|
|
64
|
+
//
|
|
65
|
+
// Agents still use `api.runtime.chart.*` via `createChartFamily(...)`;
|
|
66
|
+
// both paths delegate to identical implementations, and the live-parity
|
|
67
|
+
// tests cover the factory path.
|
|
68
|
+
export {
|
|
69
|
+
composeSeriesColorImpl as composeSeriesColor,
|
|
70
|
+
deriveResolvedColorsImpl as deriveResolvedColors,
|
|
71
|
+
};
|
|
72
|
+
export { resolveColorImpl as resolveColor };
|
|
73
|
+
export { paletteColorRefImpl as paletteColorRef };
|
|
74
|
+
export {
|
|
75
|
+
getChartStyleImpl as getChartStyle,
|
|
76
|
+
resolveChartStyleIdImpl as resolveChartStyleId,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* L11-facing read of the runtime chart-model store. Thin wrapper over
|
|
81
|
+
* `chartModelStore.get(chartId)` — mirrors what
|
|
82
|
+
* `api.runtime.chart.getModel(chartId)` does on a bound factory, but
|
|
83
|
+
* surface-callable without a runtime handle because the store itself
|
|
84
|
+
* is a module-level singleton populated by the surface-projection
|
|
85
|
+
* pass. Presentation callers (ChartNodeView) use this form so they
|
|
86
|
+
* don't reach into `src/runtime/chart/**` directly.
|
|
87
|
+
*/
|
|
88
|
+
export function getChartModel(chartId: string): ChartStoreEntry | null {
|
|
89
|
+
return chartModelStore.get(chartId) ?? null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* ================================================================== */
|
|
93
|
+
/* composeSeriesColor */
|
|
94
|
+
/* ================================================================== */
|
|
95
|
+
|
|
96
|
+
export const composeSeriesColorMetadata: ApiV3FnMetadata = {
|
|
97
|
+
name: "runtime.chart.composeSeriesColor",
|
|
98
|
+
status: "live",
|
|
99
|
+
sourceLayer: "package-session",
|
|
100
|
+
liveEvidence: {
|
|
101
|
+
runnerTest: "test/api/v3/live-parity.test.ts",
|
|
102
|
+
commit: "refactor-07-chart-family-2026-04-23",
|
|
103
|
+
},
|
|
104
|
+
uxIntent: { uiVisible: false, expectsUxResponse: "none" },
|
|
105
|
+
agentMetadata: {
|
|
106
|
+
readOrMutate: "read",
|
|
107
|
+
boundedScope: "document",
|
|
108
|
+
auditCategory: "chart-color",
|
|
109
|
+
},
|
|
110
|
+
stateClass: "C-local",
|
|
111
|
+
persistsTo: "none",
|
|
112
|
+
rwdReference:
|
|
113
|
+
"§Runtime API § runtime.chart.composeSeriesColor. Direct delegation to composeSeriesColor (src/io/ooxml/chart/compose-series-color.ts). Stitches the 3-layer OOXML chart-color cascade: explicit per-series override → palette (chart-style seriesColorMode) → resolveColor(ref, theme). Always returns #RRGGBB.",
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/* ================================================================== */
|
|
117
|
+
/* deriveResolvedColors */
|
|
118
|
+
/* ================================================================== */
|
|
119
|
+
|
|
120
|
+
export const deriveResolvedColorsMetadata: ApiV3FnMetadata = {
|
|
121
|
+
name: "runtime.chart.deriveResolvedColors",
|
|
122
|
+
status: "live",
|
|
123
|
+
sourceLayer: "package-session",
|
|
124
|
+
liveEvidence: {
|
|
125
|
+
runnerTest: "test/api/v3/live-parity.test.ts",
|
|
126
|
+
commit: "refactor-07-chart-family-2026-04-23",
|
|
127
|
+
},
|
|
128
|
+
uxIntent: { uiVisible: false, expectsUxResponse: "none" },
|
|
129
|
+
agentMetadata: {
|
|
130
|
+
readOrMutate: "read",
|
|
131
|
+
boundedScope: "document",
|
|
132
|
+
auditCategory: "chart-color",
|
|
133
|
+
},
|
|
134
|
+
stateClass: "C-local",
|
|
135
|
+
persistsTo: "none",
|
|
136
|
+
rwdReference:
|
|
137
|
+
"§Runtime API § runtime.chart.deriveResolvedColors. Pre-composes the full series (or slice) color list so renderers don't touch the chart-style table in hot paths. Delegates to deriveResolvedColors (src/io/ooxml/chart/compose-series-color.ts).",
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/* ================================================================== */
|
|
141
|
+
/* resolveColor */
|
|
142
|
+
/* ================================================================== */
|
|
143
|
+
|
|
144
|
+
export const resolveColorMetadata: ApiV3FnMetadata = {
|
|
145
|
+
name: "runtime.chart.resolveColor",
|
|
146
|
+
status: "live",
|
|
147
|
+
sourceLayer: "package-session",
|
|
148
|
+
liveEvidence: {
|
|
149
|
+
runnerTest: "test/api/v3/live-parity.test.ts",
|
|
150
|
+
commit: "refactor-07-chart-family-2026-04-23",
|
|
151
|
+
},
|
|
152
|
+
uxIntent: { uiVisible: false, expectsUxResponse: "none" },
|
|
153
|
+
agentMetadata: {
|
|
154
|
+
readOrMutate: "read",
|
|
155
|
+
boundedScope: "document",
|
|
156
|
+
auditCategory: "chart-color",
|
|
157
|
+
},
|
|
158
|
+
stateClass: "C-local",
|
|
159
|
+
persistsTo: "none",
|
|
160
|
+
rwdReference:
|
|
161
|
+
"§Runtime API § runtime.chart.resolveColor. Direct delegation to resolveColor (src/io/ooxml/chart/resolve-color.ts). Resolves a ColorRef against the workbook theme + applies OOXML modifiers (lumMod/lumOff/shade/tint/satMod/hueMod). Always returns #RRGGBB; falls through to #808080 on bad inputs.",
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
/* ================================================================== */
|
|
165
|
+
/* paletteColorRef */
|
|
166
|
+
/* ================================================================== */
|
|
167
|
+
|
|
168
|
+
export const paletteColorRefMetadata: ApiV3FnMetadata = {
|
|
169
|
+
name: "runtime.chart.paletteColorRef",
|
|
170
|
+
status: "live",
|
|
171
|
+
sourceLayer: "package-session",
|
|
172
|
+
liveEvidence: {
|
|
173
|
+
runnerTest: "test/api/v3/live-parity.test.ts",
|
|
174
|
+
commit: "refactor-07-chart-family-2026-04-23",
|
|
175
|
+
},
|
|
176
|
+
uxIntent: { uiVisible: false, expectsUxResponse: "none" },
|
|
177
|
+
agentMetadata: {
|
|
178
|
+
readOrMutate: "read",
|
|
179
|
+
boundedScope: "document",
|
|
180
|
+
auditCategory: "chart-color",
|
|
181
|
+
},
|
|
182
|
+
stateClass: "C-local",
|
|
183
|
+
persistsTo: "none",
|
|
184
|
+
rwdReference:
|
|
185
|
+
"§Runtime API § runtime.chart.paletteColorRef. Returns the ColorRef for a given series index under a SeriesColorMode (accent1-6 round-robin or monochromatic accent with tint/shade variations). Direct delegation to paletteColorRef (src/io/ooxml/chart/color-palette.ts).",
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/* ================================================================== */
|
|
189
|
+
/* getChartStyle */
|
|
190
|
+
/* ================================================================== */
|
|
191
|
+
|
|
192
|
+
export const getChartStyleMetadata: ApiV3FnMetadata = {
|
|
193
|
+
name: "runtime.chart.getChartStyle",
|
|
194
|
+
status: "live",
|
|
195
|
+
sourceLayer: "package-session",
|
|
196
|
+
liveEvidence: {
|
|
197
|
+
runnerTest: "test/api/v3/live-parity.test.ts",
|
|
198
|
+
commit: "refactor-07-chart-family-2026-04-23",
|
|
199
|
+
},
|
|
200
|
+
uxIntent: { uiVisible: false, expectsUxResponse: "none" },
|
|
201
|
+
agentMetadata: {
|
|
202
|
+
readOrMutate: "read",
|
|
203
|
+
boundedScope: "document",
|
|
204
|
+
auditCategory: "chart-style",
|
|
205
|
+
},
|
|
206
|
+
stateClass: "C-local",
|
|
207
|
+
persistsTo: "none",
|
|
208
|
+
rwdReference:
|
|
209
|
+
"§Runtime API § runtime.chart.getChartStyle. Returns the ChartStyle descriptor (seriesColorMode + fill/stroke/text defaults) for a given style id. Unknown ids fall through to the default ChartStyle (id=2). Direct delegation to getChartStyle (src/io/ooxml/chart/chart-style-table.ts).",
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/* ================================================================== */
|
|
213
|
+
/* resolveChartStyleId */
|
|
214
|
+
/* ================================================================== */
|
|
215
|
+
|
|
216
|
+
export const resolveChartStyleIdMetadata: ApiV3FnMetadata = {
|
|
217
|
+
name: "runtime.chart.resolveChartStyleId",
|
|
218
|
+
status: "live",
|
|
219
|
+
sourceLayer: "package-session",
|
|
220
|
+
liveEvidence: {
|
|
221
|
+
runnerTest: "test/api/v3/live-parity.test.ts",
|
|
222
|
+
commit: "refactor-07-chart-family-2026-04-23",
|
|
223
|
+
},
|
|
224
|
+
uxIntent: { uiVisible: false, expectsUxResponse: "none" },
|
|
225
|
+
agentMetadata: {
|
|
226
|
+
readOrMutate: "read",
|
|
227
|
+
boundedScope: "document",
|
|
228
|
+
auditCategory: "chart-style",
|
|
229
|
+
},
|
|
230
|
+
stateClass: "C-local",
|
|
231
|
+
persistsTo: "none",
|
|
232
|
+
rwdReference:
|
|
233
|
+
"§Runtime API § runtime.chart.resolveChartStyleId. Normalizes a raw (possibly undefined / out-of-range) chart-style id to one of the known CHART_STYLES keys. Returns DEFAULT_CHART_STYLE_ID (2) on miss. Direct delegation to resolveChartStyleId (src/io/ooxml/chart/chart-style-table.ts).",
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/* ================================================================== */
|
|
237
|
+
/* getModel — chartModelStore read */
|
|
238
|
+
/* ================================================================== */
|
|
239
|
+
|
|
240
|
+
export const getModelMetadata: ApiV3FnMetadata = {
|
|
241
|
+
name: "runtime.chart.getModel",
|
|
242
|
+
status: "live",
|
|
243
|
+
sourceLayer: "runtime-core",
|
|
244
|
+
liveEvidence: {
|
|
245
|
+
runnerTest: "test/api/v3/live-parity.test.ts",
|
|
246
|
+
commit: "refactor-07-chart-family-2026-04-23",
|
|
247
|
+
},
|
|
248
|
+
uxIntent: { uiVisible: false, expectsUxResponse: "none" },
|
|
249
|
+
agentMetadata: {
|
|
250
|
+
readOrMutate: "read",
|
|
251
|
+
boundedScope: "document",
|
|
252
|
+
auditCategory: "chart-model-read",
|
|
253
|
+
},
|
|
254
|
+
stateClass: "A-canonical",
|
|
255
|
+
persistsTo: "canonical",
|
|
256
|
+
rwdReference:
|
|
257
|
+
"§Runtime API § runtime.chart.getModel. Read-side lookup over the runtime-owned chartModelStore (src/runtime/chart/chart-model-store.ts) keyed by stable chartId. Returns the parsed ChartModel + px dimensions + resolved theme the surface-projection pass populated, or null when the id does not enumerate. Write-side (set/beginBuildPass/endBuildPass) stays internal to the runtime.",
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
/* ================================================================== */
|
|
261
|
+
/* family factory */
|
|
262
|
+
/* ================================================================== */
|
|
263
|
+
|
|
264
|
+
export function createChartFamily(_runtime: RuntimeApiHandle) {
|
|
265
|
+
// Runtime handle is accepted for factory-signature symmetry with the
|
|
266
|
+
// sibling families; every helper below is either a pure function over
|
|
267
|
+
// its inputs or a direct store read — no DocumentRuntime reads here.
|
|
268
|
+
return {
|
|
269
|
+
composeSeriesColor(
|
|
270
|
+
model: ChartModel,
|
|
271
|
+
theme: ResolvedTheme,
|
|
272
|
+
seriesIdx: number,
|
|
273
|
+
): string {
|
|
274
|
+
// @endStateApi — live.
|
|
275
|
+
return composeSeriesColorImpl(model, theme, seriesIdx);
|
|
276
|
+
},
|
|
277
|
+
|
|
278
|
+
deriveResolvedColors(model: ChartModel, theme: ResolvedTheme): string[] {
|
|
279
|
+
// @endStateApi — live.
|
|
280
|
+
return deriveResolvedColorsImpl(model, theme);
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
resolveColor(ref: ColorRef, theme: ResolvedTheme): string {
|
|
284
|
+
// @endStateApi — live.
|
|
285
|
+
return resolveColorImpl(ref, theme);
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
paletteColorRef(mode: SeriesColorMode, seriesIdx: number): ColorRef {
|
|
289
|
+
// @endStateApi — live.
|
|
290
|
+
return paletteColorRefImpl(mode, seriesIdx);
|
|
291
|
+
},
|
|
292
|
+
|
|
293
|
+
getChartStyle(id: number | undefined): ChartStyle {
|
|
294
|
+
// @endStateApi — live.
|
|
295
|
+
return getChartStyleImpl(id);
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
resolveChartStyleId(raw: number | undefined): number {
|
|
299
|
+
// @endStateApi — live.
|
|
300
|
+
return resolveChartStyleIdImpl(raw);
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
getModel(chartId: string): ChartStoreEntry | null {
|
|
304
|
+
// @endStateApi — live. Read-only lookup against the runtime's
|
|
305
|
+
// chartModelStore. Returns null instead of undefined so agents
|
|
306
|
+
// branch cleanly on `result === null`.
|
|
307
|
+
return chartModelStore.get(chartId) ?? null;
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @endStateApi v3 — `runtime.clipboard` family.
|
|
3
|
+
*
|
|
4
|
+
* Single function: `parse({payload, hint})`. Live delegation to the
|
|
5
|
+
* shipped paste-parser pipeline in `src/io/paste/**`
|
|
6
|
+
* (`parseCanonicalFragmentFromWordML` + `parseCanonicalFragmentFromHtml`),
|
|
7
|
+
* which in turn routes through the authoritative
|
|
8
|
+
* `parseMainDocumentXml` → `normalizeParsedTextDocument` chain.
|
|
9
|
+
*
|
|
10
|
+
* Ships coord-07 §2.1 first family — coord-11 §4.2 asked for a
|
|
11
|
+
* Runtime API seam so agents + headless services can parse WordML /
|
|
12
|
+
* HTML clipboard payloads into `CanonicalDocumentFragment` without
|
|
13
|
+
* reaching into `src/io/paste/**` directly. The existing
|
|
14
|
+
* `PasteFragmentParserAdapter` (refactor/11 Slice 5) remains the PM
|
|
15
|
+
* command bridge's native seam; `runtime.clipboard.parse` is the
|
|
16
|
+
* agent-facing surface and can back the shell adapter when hosts
|
|
17
|
+
* migrate off `shellPasteFragmentParser`.
|
|
18
|
+
*
|
|
19
|
+
* Pure-function read: no runtime state touched, no UxResponse emitted,
|
|
20
|
+
* no broadcast. `stateClass: "C-local"` + `persistsTo: "none"` +
|
|
21
|
+
* `readOrMutate: "read"`. See `docs/architecture/07-runtime-api.md` §R9
|
|
22
|
+
* for the state-class taxonomy.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { RuntimeApiHandle } from "../_runtime-handle.ts";
|
|
26
|
+
import type { ApiV3FnMetadata } from "../_layer-metadata.ts";
|
|
27
|
+
import type { CanonicalDocumentFragment } from "../../public-types.ts";
|
|
28
|
+
import { parseCanonicalFragmentFromWordML } from "../../../io/paste/word-clipboard.ts";
|
|
29
|
+
import { parseCanonicalFragmentFromHtml } from "../../../io/paste/html-clipboard.ts";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Discriminator — the two rich formats the shipped pipeline supports.
|
|
33
|
+
* Plain-text paste is handled by the PM bridge's Tier A path directly;
|
|
34
|
+
* exposing it here would be a no-op wrapper around `String(payload)`.
|
|
35
|
+
*/
|
|
36
|
+
export type ClipboardHint = "wordml" | "html";
|
|
37
|
+
|
|
38
|
+
export interface ClipboardParseInput {
|
|
39
|
+
readonly payload: string;
|
|
40
|
+
readonly hint: ClipboardHint;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type ClipboardParseResult =
|
|
44
|
+
| { readonly ok: true; readonly fragment: CanonicalDocumentFragment }
|
|
45
|
+
| { readonly ok: false; readonly reason: string };
|
|
46
|
+
|
|
47
|
+
export const parseMetadata: ApiV3FnMetadata = {
|
|
48
|
+
name: "runtime.clipboard.parse",
|
|
49
|
+
status: "live",
|
|
50
|
+
sourceLayer: "package-session",
|
|
51
|
+
// Direct delegation to the shipped Tier B paste parsers — no
|
|
52
|
+
// adapter debt. Validator log is the same corpus the parsers
|
|
53
|
+
// themselves ship under; runnerTest covers the v3 shape.
|
|
54
|
+
liveEvidence: {
|
|
55
|
+
runnerTest: "test/api/v3/live-parity.test.ts",
|
|
56
|
+
commit: "refactor-07-clipboard-family-2026-04-23",
|
|
57
|
+
},
|
|
58
|
+
uxIntent: { uiVisible: false, expectsUxResponse: "none" },
|
|
59
|
+
agentMetadata: { readOrMutate: "read", boundedScope: "document", auditCategory: "clipboard-parse" },
|
|
60
|
+
stateClass: "C-local",
|
|
61
|
+
persistsTo: "none",
|
|
62
|
+
rwdReference:
|
|
63
|
+
"§Runtime API § runtime.clipboard.parse. Delegates to parseCanonicalFragmentFromWordML / parseCanonicalFragmentFromHtml (src/io/paste/**). Pure-function read — parse a string payload into a `CanonicalDocumentFragment`. Failure returns `{ok:false, reason}` instead of throwing so callers can fall back to plain-text paste (matches the pm-command-bridge `PasteFragmentParserAdapter` contract shipped by refactor/11 Slice 5).",
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export function createClipboardFamily(_runtime: RuntimeApiHandle) {
|
|
67
|
+
// Runtime handle is accepted for factory-signature symmetry with the
|
|
68
|
+
// sibling families; no state is read. Parser is pure over its string
|
|
69
|
+
// input.
|
|
70
|
+
return {
|
|
71
|
+
parse(input: ClipboardParseInput): ClipboardParseResult {
|
|
72
|
+
// @endStateApi — live. Dispatches on the hint; returns structured
|
|
73
|
+
// failure on empty / malformed payloads so callers can gracefully
|
|
74
|
+
// fall through (matches the native adapter's shape).
|
|
75
|
+
if (input.hint === "wordml") {
|
|
76
|
+
return parseCanonicalFragmentFromWordML(input.payload);
|
|
77
|
+
}
|
|
78
|
+
return parseCanonicalFragmentFromHtml(input.payload);
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|