@beyondwork/docx-react-component 1.0.22 → 1.0.23
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 +81 -38
- package/package.json +1 -1
- package/src/api/public-types.ts +66 -1
- package/src/core/commands/index.ts +574 -5
- package/src/index.ts +5 -0
- package/src/io/docx-session.ts +181 -2
- package/src/io/export/serialize-main-document.ts +21 -1
- package/src/io/normalize/normalize-text.ts +4 -0
- package/src/io/ooxml/parse-main-document.ts +88 -7
- package/src/model/canonical-document.ts +22 -0
- package/src/review/store/revision-store.ts +1 -0
- package/src/review/store/revision-types.ts +2 -0
- package/src/runtime/document-runtime.ts +503 -51
- package/src/runtime/session-capabilities.ts +6 -5
- package/src/runtime/surface-projection.ts +2 -0
- package/src/runtime/table-schema.ts +2 -0
- package/src/runtime/workflow-markup.ts +5 -1
- package/src/ui/WordReviewEditor.tsx +661 -132
- package/src/ui/editor-runtime-boundary.ts +10 -1
- package/src/ui/editor-shell-view.tsx +8 -0
- package/src/ui/editor-surface-controller.tsx +5 -0
- package/src/ui/headless/selection-toolbar-model.ts +12 -0
- package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +139 -0
- package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +6 -0
- package/src/ui-tailwind/editor-surface/pm-decorations.ts +44 -16
- package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +2 -0
- package/src/ui-tailwind/editor-surface/surface-build-keys.ts +4 -0
- package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +127 -10
- package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +82 -1
- package/src/ui-tailwind/status/tw-status-bar.tsx +4 -1
- package/src/ui-tailwind/theme/editor-theme.css +10 -0
- package/src/ui-tailwind/toolbar/tw-toolbar.tsx +21 -5
- package/src/ui-tailwind/tw-review-workspace.tsx +110 -32
package/README.md
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: React OOXML Office
|
|
3
|
+
summary: Shipped docx package landing page and primary router into consumer, wrapper, agent, and maintainer documentation.
|
|
4
|
+
audience: consumer, wrapper, agent, maintainer
|
|
5
|
+
stability: main-path
|
|
6
|
+
docRole: main-path
|
|
7
|
+
canonical: true
|
|
8
|
+
---
|
|
9
|
+
|
|
1
10
|
# React OOXML Office
|
|
2
11
|
|
|
3
12
|
[](https://github.com/bwllaming/React-OOXML-Office/actions/workflows/ci.yml)
|
|
4
13
|
|
|
5
|
-
`@beyondwork/docx-react-component` is the shipped product in this repository:
|
|
14
|
+
`@beyondwork/docx-react-component` is the shipped product in this repository: a fidelity-first React docx editor centered on `WordReviewEditor`.
|
|
15
|
+
|
|
16
|
+
## Use This README For
|
|
17
|
+
|
|
18
|
+
- confirming what is shipped today
|
|
19
|
+
- installing the package
|
|
20
|
+
- finding the right documentation lane quickly
|
|
21
|
+
|
|
22
|
+
Do not use this README as the full package contract. The canonical consumer path starts in `docs/README.md`, `docs/reference/public-api.md`, and `docs/reference/integration-guide.md`.
|
|
23
|
+
|
|
24
|
+
## Current Package Reality
|
|
6
25
|
|
|
7
|
-
The
|
|
26
|
+
The repository may also carry broader branch-local work, but the shipped contract today is still docx-first:
|
|
8
27
|
|
|
9
28
|
- `docx` is the only implemented and shipped runtime contract
|
|
10
|
-
- `xlsx` is the
|
|
11
|
-
- `pdf`
|
|
29
|
+
- `xlsx` is planned work, not part of the current package contract
|
|
30
|
+
- `pdf` remains future work outside the current package boundary
|
|
12
31
|
|
|
13
32
|
## Install
|
|
14
33
|
|
|
@@ -54,12 +73,27 @@ Snapshot/export note:
|
|
|
54
73
|
- when a session starts from a real `.docx`, persisted snapshots now carry embedded source-package provenance so later snapshot-origin `.docx` export can use the same package-backed exporter
|
|
55
74
|
- legacy snapshots without that provenance still load, but `.docx` export is intentionally blocked rather than falling back to a lossy minimal package
|
|
56
75
|
|
|
57
|
-
The current
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
- `@beyondwork/docx-react-component
|
|
61
|
-
- `@beyondwork/docx-react-component/
|
|
62
|
-
- `@beyondwork/docx-react-component/ui-tailwind
|
|
76
|
+
The current shipped ESM exports include:
|
|
77
|
+
|
|
78
|
+
- stable default entrypoints:
|
|
79
|
+
- `@beyondwork/docx-react-component`
|
|
80
|
+
- `@beyondwork/docx-react-component/public-types`
|
|
81
|
+
- `@beyondwork/docx-react-component/ui-tailwind`
|
|
82
|
+
- `@beyondwork/docx-react-component/legal`
|
|
83
|
+
- `@beyondwork/docx-react-component/compare`
|
|
84
|
+
- `@beyondwork/docx-react-component/ui-tailwind/theme/editor-theme.css`
|
|
85
|
+
- advanced-supported subpaths for wrapper teams and package-adjacent integrations:
|
|
86
|
+
- `@beyondwork/docx-react-component/runtime/document-runtime`
|
|
87
|
+
- `@beyondwork/docx-react-component/io/docx-session`
|
|
88
|
+
- `@beyondwork/docx-react-component/core/commands/*`
|
|
89
|
+
- `@beyondwork/docx-react-component/core/selection/mapping`
|
|
90
|
+
- `@beyondwork/docx-react-component/core/state/editor-state`
|
|
91
|
+
- `@beyondwork/docx-react-component/ui-tailwind/editor-surface/search-plugin`
|
|
92
|
+
- alias subpaths:
|
|
93
|
+
- `@beyondwork/docx-react-component/tailwind`
|
|
94
|
+
- `@beyondwork/docx-react-component/api/public-types`
|
|
95
|
+
|
|
96
|
+
Use `docs/reference/public-api.md` and `docs/reference/public-api.manifest.json` for the current contract inventory and stability guidance.
|
|
63
97
|
|
|
64
98
|
## Product Contract
|
|
65
99
|
|
|
@@ -74,48 +108,56 @@ For the current shipped `docx` implementation, that specifically means:
|
|
|
74
108
|
- preserve unsupported but preservable OOXML
|
|
75
109
|
- remain editable in Word after export
|
|
76
110
|
|
|
77
|
-
|
|
111
|
+
For the normative API and host contract, use:
|
|
112
|
+
|
|
113
|
+
- [`docs/reference/public-api.md`](docs/reference/public-api.md)
|
|
114
|
+
- [`docs/reference/integration-guide.md`](docs/reference/integration-guide.md)
|
|
115
|
+
- [`docs/reference/ooxml-compliance.md`](docs/reference/ooxml-compliance.md)
|
|
78
116
|
|
|
79
|
-
|
|
117
|
+
## Documentation Map
|
|
80
118
|
|
|
81
|
-
|
|
82
|
-
- format-specific runtimes with explicit capability boundaries
|
|
83
|
-
- host-facing review and editing surfaces for each supported format
|
|
119
|
+
### Start Here
|
|
84
120
|
|
|
85
|
-
|
|
121
|
+
- [`docs/README.md`](docs/README.md)
|
|
86
122
|
|
|
87
|
-
|
|
123
|
+
### Main Consumer Path
|
|
124
|
+
|
|
125
|
+
- [`docs/reference/quick-start.md`](docs/reference/quick-start.md)
|
|
126
|
+
- [`docs/reference/consumer-matrix.md`](docs/reference/consumer-matrix.md)
|
|
127
|
+
- [`docs/reference/public-api.md`](docs/reference/public-api.md)
|
|
128
|
+
- [`docs/reference/integration-guide.md`](docs/reference/integration-guide.md)
|
|
129
|
+
|
|
130
|
+
### Wrapper And Agent Path
|
|
131
|
+
|
|
132
|
+
- [`docs/reference/consumer-matrix.md`](docs/reference/consumer-matrix.md)
|
|
133
|
+
- [`docs/reference/agent-integration-guide.md`](docs/reference/agent-integration-guide.md)
|
|
134
|
+
- [`docs/reference/public-api.md`](docs/reference/public-api.md)
|
|
135
|
+
- [`docs/reference/service-wrapper-guidance.md`](docs/reference/service-wrapper-guidance.md)
|
|
136
|
+
- [`docs/reference/agent-capability-map.md`](docs/reference/agent-capability-map.md)
|
|
137
|
+
- [`docs/reference/agent-read-models-and-snapshots.md`](docs/reference/agent-read-models-and-snapshots.md)
|
|
138
|
+
- [`docs/reference/agent-workflow-and-suggestions.md`](docs/reference/agent-workflow-and-suggestions.md)
|
|
139
|
+
- [`docs/reference/scope-aware-selection-tooling.md`](docs/reference/scope-aware-selection-tooling.md)
|
|
140
|
+
- [`docs/reference/editor-integration-style.md`](docs/reference/editor-integration-style.md)
|
|
141
|
+
- [`docs/reference/beyondwork-runtime-environment.md`](docs/reference/beyondwork-runtime-environment.md)
|
|
88
142
|
|
|
89
|
-
|
|
143
|
+
Wrapper and agent docs stay on `main`, but they are downstream integration guidance rather than the canonical package contract.
|
|
90
144
|
|
|
91
|
-
|
|
92
|
-
- `DESIGN.md`
|
|
93
|
-
- `docs/README.md`
|
|
94
|
-
- `docs/roadmap.md`
|
|
95
|
-
- `docs/plans/current-state.md`
|
|
96
|
-
- `docs/plans/master-plan.md`
|
|
145
|
+
Current integration honesty:
|
|
97
146
|
|
|
98
|
-
|
|
147
|
+
- the shipped React host surface is still `WordReviewEditor`
|
|
148
|
+
- `showReviewPanel={false}` only hides the bundled review rail
|
|
149
|
+
- a distinct public chromeless React surface is not yet shipped
|
|
99
150
|
|
|
100
|
-
|
|
101
|
-
This doc separates the shipped Waves 20-23 surface from the future Waves 25 through 27 ref expansion.
|
|
102
|
-
- `docs/reference/ooxml-compliance.md`
|
|
103
|
-
- `docs/reference/word-review-editor-frontend-architecture.md`
|
|
104
|
-
- `docs/reference/word-review-editor-ux-guide.md`
|
|
151
|
+
### Maintainer Path
|
|
105
152
|
|
|
106
|
-
|
|
153
|
+
- [`docs/maintainers/README.md`](docs/maintainers/README.md)
|
|
107
154
|
|
|
108
|
-
|
|
109
|
-
- `docs/architecture/xlsx/spreadsheet-editor-frontend-architecture.md`
|
|
110
|
-
- `docs/architecture/xlsx/canonical-workbook-model-and-commands.md`
|
|
111
|
-
- `docs/reference/xlsx/xlsx-ooxml-compliance.md`
|
|
112
|
-
- `docs/plans/xlsx/xlsx-fixture-corpus-and-certification-plan.md`
|
|
113
|
-
- `docs/xlsx-react/README.md`
|
|
155
|
+
Maintainer prompts, operator runbooks, and proof/closure material remain important, but they are not the first reading path for package consumers.
|
|
114
156
|
|
|
115
157
|
## Packaging And Release
|
|
116
158
|
|
|
117
159
|
- `.github/workflows/publish.yml` publishes on `v*` tags after verifying the tag matches `package.json`
|
|
118
|
-
- `pnpm pack --dry-run` is the baseline package proof
|
|
160
|
+
- `pnpm pack --dry-run` is the baseline package proof
|
|
119
161
|
- npm provenance is enabled in `publishConfig` and in the publish workflow invocation
|
|
120
162
|
- the published package currently ships source ESM entry points plus TypeScript source-backed `types` exports
|
|
121
163
|
- the Microsoft Open XML SDK remains CI/internal-service only, never part of the shipped browser runtime
|
|
@@ -129,6 +171,7 @@ Shared platform and planned xlsx docs:
|
|
|
129
171
|
- keep docs honest about shipped versus planned behavior
|
|
130
172
|
- add or extend fixtures for compatibility-critical changes
|
|
131
173
|
- `bash scripts/validate-fixtures.sh` now uses the Railway validator service and requires `OPENXML_VALIDATOR_AUTH_TOKEN` when hitting the public domain
|
|
174
|
+
- `node scripts/validate-docs-navigation.mjs` enforces the core docs catalog, required indexes, and frontmatter contract
|
|
132
175
|
|
|
133
176
|
## Guiding Principle
|
|
134
177
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beyondwork/docx-react-component",
|
|
3
3
|
"publisher": "beyondwork",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.23",
|
|
5
5
|
"description": "Embeddable React Word (docx) editor with review, comments, tracked changes, and round-trip OOXML fidelity.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": [
|
package/src/api/public-types.ts
CHANGED
|
@@ -235,6 +235,7 @@ export interface TrackedChangeEntrySnapshot {
|
|
|
235
235
|
label: string;
|
|
236
236
|
status: "active" | "accepted" | "rejected" | "detached";
|
|
237
237
|
actionability: "actionable" | "preserve-only";
|
|
238
|
+
storyTarget?: EditorStoryTarget;
|
|
238
239
|
importedRevisionForm?:
|
|
239
240
|
| "run-insertion"
|
|
240
241
|
| "run-deletion"
|
|
@@ -552,6 +553,8 @@ export interface SurfaceTableCellSnapshot {
|
|
|
552
553
|
|
|
553
554
|
export interface SurfaceTableRowSnapshot {
|
|
554
555
|
cells: SurfaceTableCellSnapshot[];
|
|
556
|
+
gridBefore?: number;
|
|
557
|
+
gridAfter?: number;
|
|
555
558
|
height?: number;
|
|
556
559
|
heightRule?: "auto" | "atLeast" | "exact";
|
|
557
560
|
isHeader?: boolean;
|
|
@@ -954,7 +957,8 @@ export interface WorkflowBlockedCommandReason {
|
|
|
954
957
|
| "document_read_only"
|
|
955
958
|
| "document_viewing_mode"
|
|
956
959
|
| "protected_range"
|
|
957
|
-
| "unsupported_surface"
|
|
960
|
+
| "unsupported_surface"
|
|
961
|
+
| "suggesting_unsupported";
|
|
958
962
|
message: string;
|
|
959
963
|
scopeId?: string;
|
|
960
964
|
workItemId?: string;
|
|
@@ -971,7 +975,13 @@ export interface WorkflowScopeSnapshot {
|
|
|
971
975
|
blockedReasons: WorkflowBlockedCommandReason[];
|
|
972
976
|
}
|
|
973
977
|
|
|
978
|
+
export type EffectiveSelectionMode = WorkflowScopeMode | "blocked";
|
|
979
|
+
|
|
974
980
|
export interface InteractionGuardSnapshot {
|
|
981
|
+
effectiveMode: EffectiveSelectionMode;
|
|
982
|
+
matchedScopeId?: string;
|
|
983
|
+
matchedScopeMode?: WorkflowScopeMode;
|
|
984
|
+
disabledReason?: string;
|
|
975
985
|
blockedReasons: WorkflowBlockedCommandReason[];
|
|
976
986
|
}
|
|
977
987
|
|
|
@@ -1064,6 +1074,36 @@ export interface WorkflowMarkupSnapshot {
|
|
|
1064
1074
|
opaqueFragments: WorkflowOpaqueFragmentMarkup[];
|
|
1065
1075
|
}
|
|
1066
1076
|
|
|
1077
|
+
export type HostAnnotationKind =
|
|
1078
|
+
| "note"
|
|
1079
|
+
| "scope_hint"
|
|
1080
|
+
| "readonly_marker"
|
|
1081
|
+
| "suggestion"
|
|
1082
|
+
| "warning";
|
|
1083
|
+
|
|
1084
|
+
export interface HostAnnotationItem {
|
|
1085
|
+
annotationId: string;
|
|
1086
|
+
kind: HostAnnotationKind;
|
|
1087
|
+
label: string;
|
|
1088
|
+
anchor: EditorAnchorProjection;
|
|
1089
|
+
storyTarget?: EditorStoryTarget;
|
|
1090
|
+
detail?: string;
|
|
1091
|
+
scopeMode?: WorkflowScopeMode;
|
|
1092
|
+
severity?: "low" | "medium" | "high";
|
|
1093
|
+
workItemId?: string;
|
|
1094
|
+
provenance: "host";
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
export interface HostAnnotationOverlay {
|
|
1098
|
+
overlayVersion: "host-annotation-overlay/1";
|
|
1099
|
+
annotations: HostAnnotationItem[];
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
export interface HostAnnotationSnapshot {
|
|
1103
|
+
totalCount: number;
|
|
1104
|
+
annotations: HostAnnotationItem[];
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1067
1107
|
export interface WorkflowCandidateRangeOptions {
|
|
1068
1108
|
kinds?: WorkflowMarkupKind[];
|
|
1069
1109
|
includeDetached?: boolean;
|
|
@@ -1177,6 +1217,17 @@ export type WordReviewEditorEvent =
|
|
|
1177
1217
|
documentId: string;
|
|
1178
1218
|
activeWorkItemId: string | null;
|
|
1179
1219
|
}
|
|
1220
|
+
| {
|
|
1221
|
+
type: "host_annotation_overlay_changed";
|
|
1222
|
+
documentId: string;
|
|
1223
|
+
snapshot: HostAnnotationSnapshot;
|
|
1224
|
+
}
|
|
1225
|
+
| {
|
|
1226
|
+
type: "change_authored";
|
|
1227
|
+
documentId: string;
|
|
1228
|
+
changeId: string;
|
|
1229
|
+
kind: "insertion" | "deletion";
|
|
1230
|
+
}
|
|
1180
1231
|
| {
|
|
1181
1232
|
type: "command_blocked";
|
|
1182
1233
|
documentId: string;
|
|
@@ -1327,6 +1378,9 @@ export interface WordReviewEditorRef {
|
|
|
1327
1378
|
getWorkflowScopeSnapshot(): WorkflowScopeSnapshot | null;
|
|
1328
1379
|
getInteractionGuardSnapshot(): InteractionGuardSnapshot;
|
|
1329
1380
|
getWorkflowMarkupSnapshot(): WorkflowMarkupSnapshot;
|
|
1381
|
+
setHostAnnotationOverlay(overlay: HostAnnotationOverlay): void;
|
|
1382
|
+
clearHostAnnotationOverlay(): void;
|
|
1383
|
+
getHostAnnotationSnapshot(): HostAnnotationSnapshot;
|
|
1330
1384
|
getWorkflowCandidateRanges(options?: WorkflowCandidateRangeOptions): WorkflowCandidateRange[];
|
|
1331
1385
|
replaceWorkflowMarkupText(markupId: string, text: string): void;
|
|
1332
1386
|
}
|
|
@@ -1346,6 +1400,7 @@ export interface WordReviewEditorProps {
|
|
|
1346
1400
|
reviewMode?: "editing" | "review";
|
|
1347
1401
|
markupDisplay?: "clean" | "simple" | "all";
|
|
1348
1402
|
showReviewPanel?: boolean;
|
|
1403
|
+
chromeVisibility?: Partial<WordReviewEditorChromeVisibility>;
|
|
1349
1404
|
hostAdapter?: EditorHostAdapter;
|
|
1350
1405
|
datastore?: EditorDatastoreAdapter;
|
|
1351
1406
|
autosave?: AutosaveConfig;
|
|
@@ -1353,3 +1408,13 @@ export interface WordReviewEditorProps {
|
|
|
1353
1408
|
onWarning?: (warning: EditorWarning) => void;
|
|
1354
1409
|
onError?: (error: EditorError) => void;
|
|
1355
1410
|
}
|
|
1411
|
+
|
|
1412
|
+
export interface WordReviewEditorChromeVisibility {
|
|
1413
|
+
toolbar: boolean;
|
|
1414
|
+
alerts: boolean;
|
|
1415
|
+
selectionOverlay: boolean;
|
|
1416
|
+
contextToolbars: boolean;
|
|
1417
|
+
pageChrome: boolean;
|
|
1418
|
+
statusBar: boolean;
|
|
1419
|
+
reviewRail: boolean;
|
|
1420
|
+
}
|