@beyondwork/docx-react-component 1.0.36 → 1.0.38
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 +103 -13
- package/package.json +1 -1
- package/src/api/package-version.ts +13 -0
- package/src/api/public-types.ts +402 -1
- package/src/core/commands/index.ts +18 -1
- package/src/core/commands/section-layout-commands.ts +58 -0
- package/src/core/commands/table-grid.ts +431 -0
- package/src/core/commands/table-structure-commands.ts +815 -55
- package/src/core/selection/mapping.ts +6 -0
- package/src/io/docx-session.ts +24 -9
- package/src/io/export/build-app-properties-xml.ts +88 -0
- package/src/io/export/serialize-comments.ts +6 -1
- package/src/io/export/serialize-footnotes.ts +10 -9
- package/src/io/export/serialize-headers-footers.ts +11 -10
- package/src/io/export/serialize-main-document.ts +328 -50
- package/src/io/export/serialize-numbering.ts +114 -24
- package/src/io/export/serialize-tables.ts +87 -11
- package/src/io/export/table-properties-xml.ts +174 -20
- package/src/io/export/twip.ts +66 -0
- package/src/io/normalize/normalize-text.ts +20 -0
- package/src/io/ooxml/parse-footnotes.ts +62 -1
- package/src/io/ooxml/parse-headers-footers.ts +62 -1
- package/src/io/ooxml/parse-main-document.ts +158 -1
- package/src/io/ooxml/parse-tables.ts +249 -0
- package/src/legal/bookmarks.ts +78 -0
- package/src/model/canonical-document.ts +45 -0
- package/src/review/store/scope-tag-diff.ts +130 -0
- package/src/runtime/document-layout.ts +4 -2
- package/src/runtime/document-navigation.ts +2 -306
- package/src/runtime/document-runtime.ts +287 -11
- package/src/runtime/layout/default-page-format.ts +96 -0
- package/src/runtime/layout/docx-font-loader.ts +143 -0
- package/src/runtime/layout/index.ts +233 -0
- package/src/runtime/layout/inert-layout-facet.ts +59 -0
- package/src/runtime/layout/layout-engine-instance.ts +628 -0
- package/src/runtime/layout/layout-invalidation.ts +257 -0
- package/src/runtime/layout/layout-measurement-provider.ts +175 -0
- package/src/runtime/layout/margin-preset-catalog.ts +178 -0
- package/src/runtime/layout/measurement-backend-canvas.ts +307 -0
- package/src/runtime/layout/measurement-backend-empirical.ts +208 -0
- package/src/runtime/layout/page-format-catalog.ts +233 -0
- package/src/runtime/layout/page-fragment-mapper.ts +179 -0
- package/src/runtime/layout/page-graph.ts +452 -0
- package/src/runtime/layout/page-layout-snapshot-adapter.ts +70 -0
- package/src/runtime/layout/page-story-resolver.ts +195 -0
- package/src/runtime/layout/paginated-layout-engine.ts +921 -0
- package/src/runtime/layout/project-block-fragments.ts +91 -0
- package/src/runtime/layout/public-facet.ts +1398 -0
- package/src/runtime/layout/resolved-formatting-document.ts +317 -0
- package/src/runtime/layout/resolved-formatting-state.ts +430 -0
- package/src/runtime/layout/table-render-plan.ts +229 -0
- package/src/runtime/render/block-fragment-projection.ts +35 -0
- package/src/runtime/render/decoration-resolver.ts +189 -0
- package/src/runtime/render/index.ts +57 -0
- package/src/runtime/render/pending-op-delta-reader.ts +129 -0
- package/src/runtime/render/render-frame-types.ts +317 -0
- package/src/runtime/render/render-kernel.ts +755 -0
- package/src/runtime/scope-tag-registry.ts +95 -0
- package/src/runtime/surface-projection.ts +1 -0
- package/src/runtime/text-ack-range.ts +49 -0
- package/src/runtime/view-state.ts +67 -0
- package/src/runtime/workflow-markup.ts +1 -5
- package/src/runtime/workflow-rail-segments.ts +280 -0
- package/src/ui/WordReviewEditor.tsx +99 -15
- package/src/ui/editor-runtime-boundary.ts +10 -1
- package/src/ui/editor-shell-view.tsx +6 -0
- package/src/ui/editor-surface-controller.tsx +3 -0
- package/src/ui/headless/chrome-registry.ts +501 -0
- package/src/ui/headless/scoped-chrome-policy.ts +183 -0
- package/src/ui/headless/selection-tool-context.ts +2 -0
- package/src/ui/headless/selection-tool-resolver.ts +36 -17
- package/src/ui/headless/selection-tool-types.ts +10 -0
- package/src/ui-tailwind/chrome/chrome-preset-model.ts +23 -2
- package/src/ui-tailwind/chrome/role-action-sets.ts +74 -0
- package/src/ui-tailwind/chrome/tw-detach-handle.tsx +147 -0
- package/src/ui-tailwind/chrome/tw-selection-anchor-resolver.ts +163 -0
- package/src/ui-tailwind/chrome/tw-selection-tool-host.tsx +57 -92
- package/src/ui-tailwind/chrome/tw-selection-tool-placement.ts +149 -0
- package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +15 -4
- package/src/ui-tailwind/chrome/tw-table-context-toolbar.tsx +274 -138
- package/src/ui-tailwind/chrome-overlay/chrome-overlay-projector.ts +90 -0
- package/src/ui-tailwind/chrome-overlay/index.ts +22 -0
- package/src/ui-tailwind/chrome-overlay/tw-chrome-overlay.tsx +86 -0
- package/src/ui-tailwind/chrome-overlay/tw-scope-rail-layer.tsx +178 -0
- package/src/ui-tailwind/chrome-overlay/tw-workspace-view-switcher.tsx +95 -0
- package/src/ui-tailwind/editor-surface/fast-text-edit-lane.ts +337 -0
- package/src/ui-tailwind/editor-surface/local-edit-session-state.ts +100 -0
- package/src/ui-tailwind/editor-surface/perf-probe.ts +27 -1
- package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +20 -2
- package/src/ui-tailwind/editor-surface/pm-decorations.ts +93 -23
- package/src/ui-tailwind/editor-surface/predicted-position-map.ts +78 -0
- package/src/ui-tailwind/editor-surface/predicted-tag-preflight.ts +63 -0
- package/src/ui-tailwind/editor-surface/predicted-tx-gate.ts +39 -0
- package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +176 -6
- package/src/ui-tailwind/index.ts +33 -0
- package/src/ui-tailwind/review/tw-comment-sidebar.tsx +2 -2
- package/src/ui-tailwind/review/tw-rail-card.tsx +150 -0
- package/src/ui-tailwind/review/tw-review-rail-footer.tsx +52 -0
- package/src/ui-tailwind/review/tw-review-rail.tsx +166 -11
- package/src/ui-tailwind/review/tw-workflow-tab.tsx +108 -0
- package/src/ui-tailwind/theme/editor-theme.css +505 -144
- package/src/ui-tailwind/toolbar/tw-role-action-region.tsx +559 -0
- package/src/ui-tailwind/toolbar/tw-scope-posture-menu.tsx +182 -0
- package/src/ui-tailwind/toolbar/tw-shell-header.tsx +162 -0
- package/src/ui-tailwind/toolbar/tw-toolbar-icon-button.tsx +2 -2
- package/src/ui-tailwind/toolbar/tw-toolbar.tsx +304 -166
- package/src/ui-tailwind/tw-review-workspace.tsx +163 -2
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-owned paginated layout engine — internal API surface.
|
|
3
|
+
*
|
|
4
|
+
* Runtime consumption (live, wired):
|
|
5
|
+
* buildPageStack, computePageStack — shipped façade
|
|
6
|
+
* createLayoutEngine — stateful engine owned by DocumentRuntime
|
|
7
|
+
* resolvePageStories — per-page header/footer variant selection
|
|
8
|
+
* buildPageGraph — RuntimePageGraph construction
|
|
9
|
+
* analyzeInvalidation / computeFieldDirtiness — invalidation + field dirtiness
|
|
10
|
+
* createPageFragmentMapper — offset ↔ fragment ↔ region mapping
|
|
11
|
+
*
|
|
12
|
+
* Measurement:
|
|
13
|
+
* LayoutMeasurementProvider + empirical and canvas backends
|
|
14
|
+
* DocxFontLoader — FontFace registration for canvas fidelity
|
|
15
|
+
*
|
|
16
|
+
* Nothing in this module is part of the package's public API.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Façade (backward-compatible entry point)
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
buildPageStack,
|
|
25
|
+
buildPageStackFrom,
|
|
26
|
+
computePageStack,
|
|
27
|
+
requiresFullRecompute,
|
|
28
|
+
type LayoutInvalidationReason,
|
|
29
|
+
type PageStackResult,
|
|
30
|
+
} from "./paginated-layout-engine.ts";
|
|
31
|
+
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// Stateful engine (Phase 1)
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
createLayoutEngine,
|
|
38
|
+
findActivePageNode,
|
|
39
|
+
type LayoutEngineInstance,
|
|
40
|
+
type LayoutEngineViewState,
|
|
41
|
+
type LayoutEngineQueryInput,
|
|
42
|
+
type LayoutEngineEvent,
|
|
43
|
+
type CreateLayoutEngineOptions,
|
|
44
|
+
} from "./layout-engine-instance.ts";
|
|
45
|
+
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Formatting resolution
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
resolveBlockFormatting,
|
|
52
|
+
resolveTextWidth,
|
|
53
|
+
resolveCharsPerLine,
|
|
54
|
+
calculateParagraphHeight,
|
|
55
|
+
resolveNumberingPrefixLength,
|
|
56
|
+
type ResolvedParagraphFormatting,
|
|
57
|
+
type ResolvedTableRowFormatting,
|
|
58
|
+
type LayoutTabStop,
|
|
59
|
+
} from "./resolved-formatting-state.ts";
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
buildResolvedFormattingState,
|
|
63
|
+
collectUsedFontFamilies,
|
|
64
|
+
populateNumberingInstances,
|
|
65
|
+
getResolvedParagraph,
|
|
66
|
+
getResolvedRun,
|
|
67
|
+
type ResolvedFormattingState,
|
|
68
|
+
type ResolvedRunFormatting,
|
|
69
|
+
type ResolvedFontCatalog,
|
|
70
|
+
type ResolvedFontDescriptor,
|
|
71
|
+
type ResolvedTabSettings,
|
|
72
|
+
type ResolvedNumberingGeometry,
|
|
73
|
+
type ResolvedDocumentSettings,
|
|
74
|
+
type NumberingInstanceMetadata,
|
|
75
|
+
type RunId,
|
|
76
|
+
} from "./resolved-formatting-document.ts";
|
|
77
|
+
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// Page story resolution + graph + fragment mapping
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
resolvePageStories,
|
|
84
|
+
resolveDisplayPageNumber,
|
|
85
|
+
resolveTotalPageCount,
|
|
86
|
+
type ResolvedPageStories,
|
|
87
|
+
} from "./page-story-resolver.ts";
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
buildPageGraph,
|
|
91
|
+
spliceGraph,
|
|
92
|
+
findPageNodeForOffset,
|
|
93
|
+
findPagesForSection,
|
|
94
|
+
findPageForStoryTarget,
|
|
95
|
+
toDocumentPageSnapshots,
|
|
96
|
+
type RuntimePageGraph,
|
|
97
|
+
type RuntimePageNode,
|
|
98
|
+
type RuntimePageRegions,
|
|
99
|
+
type RuntimePageRegion,
|
|
100
|
+
type RuntimeBlockFragment,
|
|
101
|
+
type RuntimeLineBox,
|
|
102
|
+
type RuntimeNoteAllocation,
|
|
103
|
+
type RuntimePageAnchor,
|
|
104
|
+
type BuildPageGraphInput,
|
|
105
|
+
} from "./page-graph.ts";
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
createPageFragmentMapper,
|
|
109
|
+
rebuildMapper,
|
|
110
|
+
// Deprecated alias retained for one release after §6 E.5 rename:
|
|
111
|
+
updateMapperIncremental,
|
|
112
|
+
type PageFragmentMapper,
|
|
113
|
+
type PageFragmentLocation,
|
|
114
|
+
type PageSpan,
|
|
115
|
+
} from "./page-fragment-mapper.ts";
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
derivePageLayoutSnapshotFromGraph,
|
|
119
|
+
deriveDocumentPageSnapshots,
|
|
120
|
+
deriveActivePageIndex,
|
|
121
|
+
deriveActiveSectionIndex,
|
|
122
|
+
deriveActivePage,
|
|
123
|
+
} from "./page-layout-snapshot-adapter.ts";
|
|
124
|
+
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// Invalidation + field dirtiness
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
analyzeInvalidation,
|
|
131
|
+
computeFieldDirtiness,
|
|
132
|
+
type InvalidationResult,
|
|
133
|
+
} from "./layout-invalidation.ts";
|
|
134
|
+
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
// Measurement provider
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
|
|
139
|
+
export {
|
|
140
|
+
createMeasurementProvider,
|
|
141
|
+
createEmpiricalMeasurementProvider,
|
|
142
|
+
type LayoutMeasurementProvider,
|
|
143
|
+
type MeasurementFidelity,
|
|
144
|
+
type MeasurementBackendPreference,
|
|
145
|
+
type CreateMeasurementProviderOptions,
|
|
146
|
+
type MeasureLineFragmentsInput,
|
|
147
|
+
type MeasuredLineFragments,
|
|
148
|
+
type MeasureInlineObjectInput,
|
|
149
|
+
type MeasuredInlineObject,
|
|
150
|
+
type MeasureTableBlockInput,
|
|
151
|
+
type MeasuredTableBlock,
|
|
152
|
+
} from "./layout-measurement-provider.ts";
|
|
153
|
+
|
|
154
|
+
export {
|
|
155
|
+
createDocxFontLoader,
|
|
156
|
+
type DocxFontLoader,
|
|
157
|
+
type FontLoaderInput,
|
|
158
|
+
type EmbeddedFontBytes,
|
|
159
|
+
} from "./docx-font-loader.ts";
|
|
160
|
+
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
162
|
+
// Public facet (Phase 7)
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
|
|
165
|
+
export { createInertLayoutFacet } from "./inert-layout-facet.ts";
|
|
166
|
+
|
|
167
|
+
export {
|
|
168
|
+
createLayoutFacet,
|
|
169
|
+
type WordReviewEditorLayoutFacet,
|
|
170
|
+
type PublicPageNode,
|
|
171
|
+
type PublicPageRegions,
|
|
172
|
+
type PublicPageRegion,
|
|
173
|
+
type PublicBlockFragment,
|
|
174
|
+
type PublicLineBox,
|
|
175
|
+
type PublicNoteAllocation,
|
|
176
|
+
type PublicPageAnchor,
|
|
177
|
+
type PublicPageSpan,
|
|
178
|
+
type PublicSectionNode,
|
|
179
|
+
type PublicResolvedPageStories,
|
|
180
|
+
type PublicResolvedParagraphFormatting,
|
|
181
|
+
type PublicResolvedRunFormatting,
|
|
182
|
+
type PublicBlockMeasurement,
|
|
183
|
+
type PublicMeasurementFidelity,
|
|
184
|
+
type PublicFieldDirtinessReport,
|
|
185
|
+
type LayoutFacetEvent,
|
|
186
|
+
type LayoutFacetInvalidationReason,
|
|
187
|
+
type RenderZoomSummary,
|
|
188
|
+
type CreateLayoutFacetInput,
|
|
189
|
+
type PageFormatDefinition,
|
|
190
|
+
type ActivePageFormat,
|
|
191
|
+
type MarginPresetDefinition,
|
|
192
|
+
type ActiveMarginPreset,
|
|
193
|
+
} from "./public-facet.ts";
|
|
194
|
+
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
// Page-format catalog + margin preset catalog + locale defaults (R0.5)
|
|
197
|
+
// ---------------------------------------------------------------------------
|
|
198
|
+
|
|
199
|
+
export {
|
|
200
|
+
PAGE_FORMAT_CATALOG,
|
|
201
|
+
matchPageFormat,
|
|
202
|
+
getPageFormatById,
|
|
203
|
+
type PageFormatId,
|
|
204
|
+
type PageFormatRegion,
|
|
205
|
+
type PageFormatLocaleDefault,
|
|
206
|
+
type PageFormatDisplay,
|
|
207
|
+
type MatchPageFormatInput,
|
|
208
|
+
} from "./page-format-catalog.ts";
|
|
209
|
+
|
|
210
|
+
export {
|
|
211
|
+
MARGIN_PRESET_CATALOG,
|
|
212
|
+
matchMarginPreset,
|
|
213
|
+
getMarginPresetById,
|
|
214
|
+
type MarginPresetId,
|
|
215
|
+
type MatchMarginPresetInput,
|
|
216
|
+
} from "./margin-preset-catalog.ts";
|
|
217
|
+
|
|
218
|
+
export {
|
|
219
|
+
resolveDefaultPageFormat,
|
|
220
|
+
resolveDefaultPageSizeTwips,
|
|
221
|
+
type ResolveDefaultPageFormatOptions,
|
|
222
|
+
} from "./default-page-format.ts";
|
|
223
|
+
|
|
224
|
+
// ---------------------------------------------------------------------------
|
|
225
|
+
// Workflow rail segments (R3a)
|
|
226
|
+
// ---------------------------------------------------------------------------
|
|
227
|
+
|
|
228
|
+
export {
|
|
229
|
+
collectScopeRailSegments,
|
|
230
|
+
type CollectScopeRailSegmentsInput,
|
|
231
|
+
type ScopeRailPosture,
|
|
232
|
+
type ScopeRailSegment,
|
|
233
|
+
} from "../workflow-rail-segments.ts";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inert layout facet used during the runtime-loading phase.
|
|
3
|
+
*
|
|
4
|
+
* Returns empty or null values for every query; `subscribe` is a no-op.
|
|
5
|
+
* The React shell replaces this with the real facet once the runtime is
|
|
6
|
+
* ready, so consumers never see a "missing" facet — only an empty one.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
LayoutFacetEvent,
|
|
11
|
+
PublicFieldDirtinessReport,
|
|
12
|
+
PublicMeasurementFidelity,
|
|
13
|
+
WordReviewEditorLayoutFacet,
|
|
14
|
+
} from "./public-facet.ts";
|
|
15
|
+
import { MARGIN_PRESET_CATALOG } from "./margin-preset-catalog.ts";
|
|
16
|
+
import { PAGE_FORMAT_CATALOG } from "./page-format-catalog.ts";
|
|
17
|
+
|
|
18
|
+
export function createInertLayoutFacet(): WordReviewEditorLayoutFacet {
|
|
19
|
+
const emptyReport: PublicFieldDirtinessReport = {
|
|
20
|
+
families: [],
|
|
21
|
+
revision: 0,
|
|
22
|
+
};
|
|
23
|
+
const fidelity: PublicMeasurementFidelity = "empirical";
|
|
24
|
+
return {
|
|
25
|
+
getPageCount: () => 0,
|
|
26
|
+
getPage: () => null,
|
|
27
|
+
getPages: () => [],
|
|
28
|
+
getSection: () => null,
|
|
29
|
+
getSections: () => [],
|
|
30
|
+
getPageForOffset: () => null,
|
|
31
|
+
getPageSpanForSelection: () => null,
|
|
32
|
+
getFragmentForOffset: () => null,
|
|
33
|
+
getAnchorForOffset: () => null,
|
|
34
|
+
getActiveStoriesOnPage: () => null,
|
|
35
|
+
getDisplayPageNumber: () => null,
|
|
36
|
+
getLineBoxes: () => [],
|
|
37
|
+
getLineBoxesForRegion: () => [],
|
|
38
|
+
getFragmentsForPage: () => [],
|
|
39
|
+
getPageFormatCatalog: () => PAGE_FORMAT_CATALOG,
|
|
40
|
+
getActivePageFormat: () => null,
|
|
41
|
+
getMarginPresetCatalog: () => MARGIN_PRESET_CATALOG,
|
|
42
|
+
getActiveMarginPreset: () => null,
|
|
43
|
+
getRenderFrame: () => null,
|
|
44
|
+
getRenderZoom: () => null,
|
|
45
|
+
hitTest: () => null,
|
|
46
|
+
getAnchorRects: () => [],
|
|
47
|
+
getScopeRailSegments: () => [],
|
|
48
|
+
getAllScopeRailSegments: () => [],
|
|
49
|
+
getResolvedFormatting: () => null,
|
|
50
|
+
getResolvedRunFormatting: () => null,
|
|
51
|
+
getMeasurement: () => null,
|
|
52
|
+
getMeasurementFidelity: () => fidelity,
|
|
53
|
+
whenMeasurementReady: () => Promise.resolve(),
|
|
54
|
+
getTableRenderPlan: () => null,
|
|
55
|
+
getDirtyFieldFamilies: () => [],
|
|
56
|
+
getFieldDirtinessReport: () => emptyReport,
|
|
57
|
+
subscribe: (_listener: (event: LayoutFacetEvent) => void) => () => undefined,
|
|
58
|
+
};
|
|
59
|
+
}
|