@beyondwork/docx-react-component 1.0.1 → 1.0.2

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.
Files changed (172) hide show
  1. package/README.md +44 -104
  2. package/package.json +76 -46
  3. package/src/README.md +85 -0
  4. package/src/api/README.md +22 -0
  5. package/src/api/public-types.ts +525 -0
  6. package/src/compare/diff-engine.ts +530 -0
  7. package/src/compare/export-redlines.ts +162 -0
  8. package/src/compare/snapshot.ts +37 -0
  9. package/src/component-inventory.md +99 -0
  10. package/src/core/README.md +10 -0
  11. package/src/core/commands/README.md +3 -0
  12. package/src/core/commands/formatting-commands.ts +161 -0
  13. package/src/core/commands/image-commands.ts +144 -0
  14. package/src/core/commands/index.ts +1013 -0
  15. package/src/core/commands/list-commands.ts +370 -0
  16. package/src/core/commands/review-commands.ts +108 -0
  17. package/src/core/commands/text-commands.ts +119 -0
  18. package/src/core/schema/README.md +3 -0
  19. package/src/core/schema/text-schema.ts +512 -0
  20. package/src/core/selection/README.md +3 -0
  21. package/src/core/selection/mapping.ts +238 -0
  22. package/src/core/selection/review-anchors.ts +94 -0
  23. package/src/core/state/README.md +3 -0
  24. package/src/core/state/editor-state.ts +580 -0
  25. package/src/core/state/text-transaction.ts +276 -0
  26. package/src/formats/xlsx/io/parse-shared-strings.ts +41 -0
  27. package/src/formats/xlsx/io/parse-sheet.ts +289 -0
  28. package/src/formats/xlsx/io/parse-styles.ts +57 -0
  29. package/src/formats/xlsx/io/parse-workbook.ts +75 -0
  30. package/src/formats/xlsx/io/xlsx-session.ts +306 -0
  31. package/src/formats/xlsx/model/cell.ts +189 -0
  32. package/src/formats/xlsx/model/sheet.ts +244 -0
  33. package/src/formats/xlsx/model/styles.ts +118 -0
  34. package/src/formats/xlsx/model/workbook.ts +449 -0
  35. package/src/index.ts +45 -0
  36. package/src/io/README.md +10 -0
  37. package/src/io/docx-session.ts +1763 -0
  38. package/src/io/export/README.md +3 -0
  39. package/src/io/export/export-session.ts +165 -0
  40. package/src/io/export/minimal-docx.ts +115 -0
  41. package/src/io/export/reattach-preserved-parts.ts +54 -0
  42. package/src/io/export/serialize-comments.ts +876 -0
  43. package/src/io/export/serialize-footnotes.ts +217 -0
  44. package/src/io/export/serialize-headers-footers.ts +200 -0
  45. package/src/io/export/serialize-main-document.ts +982 -0
  46. package/src/io/export/serialize-numbering.ts +97 -0
  47. package/src/io/export/serialize-revisions.ts +389 -0
  48. package/src/io/export/serialize-runtime-revisions.ts +265 -0
  49. package/src/io/export/serialize-tables.ts +147 -0
  50. package/src/io/export/split-review-boundaries.ts +194 -0
  51. package/src/io/normalize/README.md +3 -0
  52. package/src/io/normalize/normalize-text.ts +437 -0
  53. package/src/io/ooxml/README.md +3 -0
  54. package/src/io/ooxml/parse-comments.ts +779 -0
  55. package/src/io/ooxml/parse-complex-content.ts +287 -0
  56. package/src/io/ooxml/parse-fields.ts +438 -0
  57. package/src/io/ooxml/parse-footnotes.ts +403 -0
  58. package/src/io/ooxml/parse-headers-footers.ts +483 -0
  59. package/src/io/ooxml/parse-inline-media.ts +431 -0
  60. package/src/io/ooxml/parse-main-document.ts +1846 -0
  61. package/src/io/ooxml/parse-numbering.ts +425 -0
  62. package/src/io/ooxml/parse-revisions.ts +658 -0
  63. package/src/io/ooxml/parse-shapes.ts +271 -0
  64. package/src/io/ooxml/parse-tables.ts +568 -0
  65. package/src/io/ooxml/parse-theme.ts +314 -0
  66. package/src/io/ooxml/part-manifest.ts +136 -0
  67. package/src/io/ooxml/revision-boundaries.ts +351 -0
  68. package/src/io/opc/README.md +3 -0
  69. package/src/io/opc/corrupt-package.ts +166 -0
  70. package/src/io/opc/docx-package.ts +74 -0
  71. package/src/io/opc/package-reader.ts +320 -0
  72. package/src/io/opc/package-writer.ts +273 -0
  73. package/src/legal/bookmarks.ts +196 -0
  74. package/src/legal/cross-references.ts +356 -0
  75. package/src/legal/defined-terms.ts +203 -0
  76. package/src/model/README.md +3 -0
  77. package/src/model/canonical-document.ts +1911 -0
  78. package/src/model/cds-1.0.0.ts +196 -0
  79. package/src/model/snapshot.ts +393 -0
  80. package/src/preservation/README.md +3 -0
  81. package/src/preservation/markup-compatibility.ts +48 -0
  82. package/src/preservation/opaque-fragment-store.ts +89 -0
  83. package/src/preservation/opaque-region.ts +233 -0
  84. package/src/preservation/package-preservation.ts +120 -0
  85. package/src/preservation/preserved-part-manifest.ts +56 -0
  86. package/src/preservation/relationship-retention.ts +57 -0
  87. package/src/preservation/store.ts +185 -0
  88. package/src/review/README.md +16 -0
  89. package/src/review/store/README.md +3 -0
  90. package/src/review/store/comment-anchors.ts +70 -0
  91. package/src/review/store/comment-remapping.ts +154 -0
  92. package/src/review/store/comment-store.ts +331 -0
  93. package/src/review/store/comment-thread.ts +109 -0
  94. package/src/review/store/revision-actions.ts +394 -0
  95. package/src/review/store/revision-store.ts +303 -0
  96. package/src/review/store/revision-types.ts +168 -0
  97. package/src/review/store/runtime-comment-store.ts +43 -0
  98. package/src/runtime/README.md +3 -0
  99. package/src/runtime/ai-action-policy.ts +764 -0
  100. package/src/runtime/document-runtime.ts +967 -0
  101. package/src/runtime/read-only-diagnostics-runtime.ts +232 -0
  102. package/src/runtime/review-runtime.ts +44 -0
  103. package/src/runtime/revision-runtime.ts +107 -0
  104. package/src/runtime/session-capabilities.ts +138 -0
  105. package/src/runtime/surface-projection.ts +570 -0
  106. package/src/runtime/table-commands.ts +87 -0
  107. package/src/runtime/table-schema.ts +140 -0
  108. package/src/runtime/virtualized-rendering.ts +258 -0
  109. package/src/ui/README.md +30 -0
  110. package/src/ui/WordReviewEditor.tsx +1504 -0
  111. package/src/ui/comments/README.md +3 -0
  112. package/src/ui/compatibility/README.md +3 -0
  113. package/src/ui/editor-surface/README.md +3 -0
  114. package/src/ui/headless/comment-decoration-model.ts +124 -0
  115. package/src/ui/headless/revision-decoration-model.ts +128 -0
  116. package/src/ui/headless/selection-helpers.ts +34 -0
  117. package/src/ui/headless/use-editor-keyboard.ts +98 -0
  118. package/src/ui/review/README.md +3 -0
  119. package/src/ui/shared/revision-filters.ts +31 -0
  120. package/src/ui/status/README.md +3 -0
  121. package/src/ui/theme/README.md +3 -0
  122. package/src/ui/toolbar/README.md +3 -0
  123. package/src/ui-tailwind/chrome/tw-alert-banner.tsx +48 -0
  124. package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +44 -0
  125. package/src/ui-tailwind/chrome/tw-unsaved-modal.tsx +58 -0
  126. package/src/ui-tailwind/chrome/use-before-unload.ts +20 -0
  127. package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +139 -0
  128. package/src/ui-tailwind/editor-surface/pm-decorations.ts +98 -0
  129. package/src/ui-tailwind/editor-surface/pm-position-map.ts +123 -0
  130. package/src/ui-tailwind/editor-surface/pm-schema.ts +452 -0
  131. package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +327 -0
  132. package/src/ui-tailwind/editor-surface/search-plugin.ts +157 -0
  133. package/src/ui-tailwind/editor-surface/tw-caret.tsx +12 -0
  134. package/src/ui-tailwind/editor-surface/tw-editor-surface.tsx +150 -0
  135. package/src/ui-tailwind/editor-surface/tw-inline-token.tsx +118 -0
  136. package/src/ui-tailwind/editor-surface/tw-opaque-block.tsx +52 -0
  137. package/src/ui-tailwind/editor-surface/tw-paragraph-block.tsx +151 -0
  138. package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +215 -0
  139. package/src/ui-tailwind/editor-surface/tw-segment-view.tsx +111 -0
  140. package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +122 -0
  141. package/src/ui-tailwind/index.ts +61 -0
  142. package/src/ui-tailwind/review/tw-comment-sidebar.tsx +276 -0
  143. package/src/ui-tailwind/review/tw-health-panel.tsx +120 -0
  144. package/src/ui-tailwind/review/tw-review-rail.tsx +120 -0
  145. package/src/ui-tailwind/review/tw-revision-sidebar.tsx +164 -0
  146. package/src/ui-tailwind/status/tw-status-bar.tsx +58 -0
  147. package/src/ui-tailwind/theme/editor-theme.css +190 -0
  148. package/src/ui-tailwind/toolbar/tw-toolbar-icon-button.tsx +48 -0
  149. package/src/ui-tailwind/toolbar/tw-toolbar.tsx +231 -0
  150. package/src/ui-tailwind/tw-review-workspace.tsx +140 -0
  151. package/src/validation/README.md +3 -0
  152. package/src/validation/compatibility-engine.ts +317 -0
  153. package/src/validation/compatibility-report.ts +160 -0
  154. package/src/validation/diagnostics.ts +203 -0
  155. package/src/validation/import-diagnostics.ts +128 -0
  156. package/src/validation/low-priority-word-surfaces.ts +373 -0
  157. package/dist/chunk-32W6IVQE.js +0 -7725
  158. package/dist/chunk-32W6IVQE.js.map +0 -1
  159. package/dist/index.cjs +0 -23722
  160. package/dist/index.cjs.map +0 -1
  161. package/dist/index.d.cts +0 -7
  162. package/dist/index.d.ts +0 -7
  163. package/dist/index.js +0 -16011
  164. package/dist/index.js.map +0 -1
  165. package/dist/public-types-DqCURAz8.d.cts +0 -1152
  166. package/dist/public-types-DqCURAz8.d.ts +0 -1152
  167. package/dist/tailwind.cjs +0 -8295
  168. package/dist/tailwind.cjs.map +0 -1
  169. package/dist/tailwind.d.cts +0 -323
  170. package/dist/tailwind.d.ts +0 -323
  171. package/dist/tailwind.js +0 -553
  172. package/dist/tailwind.js.map +0 -1
package/README.md CHANGED
@@ -2,121 +2,74 @@
2
2
 
3
3
  [![CI](https://github.com/bwllaming/React-OOXML-Office/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bwllaming/React-OOXML-Office/actions/workflows/ci.yml)
4
4
 
5
- React OOXML Office is a repo for embeddable office-document runtimes, shared OOXML platform work, and host-facing review or editing surfaces.
5
+ `docx-react-component` is now configured as an npm-ready package for the shipped product in this repository: `WordReviewEditor`, a fidelity-first React editor for legal-review-safe `docx` workflows.
6
6
 
7
- This repository is evolving from the original docx-first `React Word Editor` codebase into a broader layered story:
7
+ The broader repository is still evolving toward a layered `react-ooxml-office` platform, but the source reality is unchanged:
8
8
 
9
- - a shared OOXML platform for package, preservation, diagnostics, and validation concerns
10
- - format-specific runtimes with honest capability boundaries
11
- - host-facing editor surfaces for each supported format
9
+ - `docx` is the only implemented and shipped runtime contract
10
+ - `xlsx` is the next planned OOXML sibling
11
+ - `pdf` is future work and outside the first shared OOXML platform contract
12
12
 
13
- ## Current Status
13
+ ## Install
14
14
 
15
- The code in source today is still centered on one shipped editor:
15
+ ```bash
16
+ pnpm add docx-react-component react react-dom \
17
+ prosemirror-commands prosemirror-keymap prosemirror-model \
18
+ prosemirror-state prosemirror-tables prosemirror-transform prosemirror-view
19
+ ```
20
+
21
+ Current packaging truth:
22
+
23
+ - the package is ESM-only
24
+ - exports point at shipped TypeScript source entry points
25
+ - consumers need a bundler or runtime that can resolve `.ts` and `.tsx` ESM imports
26
+ - package and source identifiers remain docx-first until a deliberate rename lands
27
+
28
+ ## Shipped Product
29
+
30
+ The primary shipped surface is:
16
31
 
17
32
  ```tsx
33
+ import { WordReviewEditor } from "docx-react-component";
34
+
18
35
  <WordReviewEditor />
19
36
  ```
20
37
 
21
- That means:
22
-
23
- - `docx` is the only implemented and shipped runtime contract in this repo today
24
- - `xlsx` is now documented as the next planned OOXML sibling
25
- - `pdf` is acknowledged as a future vertical, but it is not part of the first shared OOXML platform contract
38
+ `WordReviewEditor` remains uncontrolled by default:
26
39
 
27
- The repo path, many source folders, and the internal harness are still docx-first. The docs now distinguish clearly between:
40
+ - host passes `initialDocx` or `initialSnapshot`
41
+ - runtime owns the live working session
42
+ - host receives events, warnings, errors, snapshots, and exported artifacts
28
43
 
29
- - what is already landed
30
- - what is the target shared architecture
31
- - what is still research or future planning
44
+ The current public ESM exports are:
32
45
 
33
- The `react-ooxml-office` name is currently a documentation and architecture umbrella. Package, workspace, and many source identifiers remain docx-first until a later rename is intentionally landed.
46
+ - `docx-react-component` -> `WordReviewEditor`
47
+ - `docx-react-component/public-types` -> public TypeScript contracts
48
+ - `docx-react-component/ui-tailwind` -> current Tailwind UI primitives
34
49
 
35
- ## Core Goal
50
+ ## Product Contract
36
51
 
37
52
  For every format the repo eventually ships, the standard is:
38
53
 
39
54
  > Open -> edit -> save -> reopen in the host application without damage.
40
55
 
41
- For the current shipped `docx` implementation, that still specifically means:
56
+ For the current shipped `docx` implementation, that specifically means:
42
57
 
43
58
  - open in recent Microsoft Word without repair prompts
44
59
  - preserve supported content and review structures
45
60
  - preserve unsupported but preservable OOXML
46
61
  - remain editable in Word after export
47
62
 
48
- ## Repo Principles
49
-
50
- - Compatibility first: host-format fidelity outranks convenience.
51
- - Structured editing over DOM editing: runtime-owned canonical state is the source of truth.
52
- - Preserve, do not destroy: unsupported but preservable OOXML must survive round trips.
53
- - Explicit capability classes: features are `supported-roundtrip`, `preserve-only`, or `unsupported-fatal`.
54
- - Clean UX over suite chrome: contextual, low-noise UI beats ribbon-style sprawl.
55
- - Separate platform, runtime, validation, preservation, and UI concerns.
56
- - Main-thread only for shipped runtimes unless the architecture explicitly changes.
57
-
58
- ## Architecture Layers
59
-
60
- All landed and planned editor work follows the same high-level mutation path:
61
-
62
- ```text
63
- UI -> Command -> Transaction -> State Update -> Render
64
- ```
65
-
66
- The broader architecture is layered like this:
63
+ ## Repository Direction
67
64
 
68
- ```text
69
- shared platform
70
- package io, preservation, diagnostics, validation, host doctrine
65
+ This repo is broadening from the original docx-first editor into a layered shared-OOXML story:
71
66
 
72
- format runtimes
73
- docx runtime today
74
- xlsx runtime next
75
- pdf future, outside the first OOXML platform contract
76
-
77
- host surfaces
78
- embeddable components, internal harnesses, certification views
79
- ```
67
+ - shared platform concerns for package IO, preservation, diagnostics, and validation
68
+ - format-specific runtimes with explicit capability boundaries
69
+ - host-facing review and editing surfaces for each supported format
80
70
 
81
71
  The canonical shared-platform overview lives in `docs/architecture/platform/shared-openxml-editor-platform.md`.
82
72
 
83
- ## Current Landed Source Layout
84
-
85
- The truthful current source layout remains docx-first:
86
-
87
- ```text
88
- src/
89
- api/
90
- model/
91
- core/
92
- review/
93
- io/
94
- preservation/
95
- validation/
96
- runtime/
97
- ui/
98
- services/
99
- react-word-editor/
100
- openxml-validator/
101
- test/
102
- fixtures/
103
- docs/
104
- ```
105
-
106
- The target future source layout is broader, but it is still only a planning direction:
107
-
108
- ```text
109
- src/
110
- platform/
111
- formats/
112
- docx/
113
- xlsx/
114
- pdf/
115
- services/
116
- office-harness/
117
- openxml-validator/
118
- ```
119
-
120
73
  ## Documentation Map
121
74
 
122
75
  Start here:
@@ -144,25 +97,12 @@ Shared platform and planned xlsx docs:
144
97
  - `docs/plans/xlsx/xlsx-fixture-corpus-and-certification-plan.md`
145
98
  - `docs/xlsx-react/README.md`
146
99
 
147
- ## Docx Surface Today
148
-
149
- `WordReviewEditor` remains uncontrolled by default:
150
-
151
- - host passes `initialDocx` or `initialSnapshot`
152
- - runtime owns the live working session
153
- - host receives events, warnings, errors, snapshots, and exported artifacts
154
-
155
- The current shipped scope is still the legal-review-safe docx slice documented in the docx reference set. Tables, shell structures, and later legal-fidelity work remain governed by the existing wave sequence.
156
-
157
- ## Validation Strategy
158
-
159
- The runtime editor does not ship the Microsoft Open XML SDK.
160
-
161
- Instead:
100
+ ## Packaging And Release
162
101
 
163
- - runtime and test code produce structural compatibility data in TypeScript
164
- - the internal validator service uses the Open XML SDK in CI and service workflows
165
- - Word or, later, Excel reopen behavior remains the final certification bar for supported flows
102
+ - `.github/workflows/publish.yml` publishes on `v*` tags
103
+ - `pnpm pack --dry-run` is the baseline package proof for this wave
104
+ - npm provenance is enabled in `publishConfig`
105
+ - the Microsoft Open XML SDK remains CI/internal-service only, never part of the shipped browser runtime
166
106
 
167
107
  ## Contribution Rules
168
108
 
package/package.json CHANGED
@@ -1,27 +1,55 @@
1
1
  {
2
2
  "name": "@beyondwork/docx-react-component",
3
- "version": "1.0.1",
3
+ "publisher": "beyondwork",
4
+ "version": "1.0.2",
4
5
  "description": "Embeddable React Word (docx) editor with review, comments, tracked changes, and round-trip OOXML fidelity.",
6
+ "packageManager": "pnpm@10.30.3",
5
7
  "type": "module",
8
+ "files": [
9
+ "README.md",
10
+ "LICENSE.md",
11
+ "src"
12
+ ],
6
13
  "exports": {
7
14
  ".": {
8
- "types": "./dist/index.d.ts",
9
- "import": "./dist/index.js",
10
- "require": "./dist/index.cjs"
15
+ "types": "./src/index.ts",
16
+ "import": "./src/index.ts"
17
+ },
18
+ "./public-types": {
19
+ "types": "./src/api/public-types.ts",
20
+ "import": "./src/api/public-types.ts"
21
+ },
22
+ "./ui-tailwind": {
23
+ "types": "./src/ui-tailwind/index.ts",
24
+ "import": "./src/ui-tailwind/index.ts"
11
25
  },
12
26
  "./tailwind": {
13
- "types": "./dist/tailwind.d.ts",
14
- "import": "./dist/tailwind.js",
15
- "require": "./dist/tailwind.cjs"
16
- }
27
+ "types": "./src/ui-tailwind/index.ts",
28
+ "import": "./src/ui-tailwind/index.ts"
29
+ },
30
+ "./io/docx-session": "./src/io/docx-session.ts",
31
+ "./runtime/document-runtime": "./src/runtime/document-runtime.ts",
32
+ "./api/public-types": "./src/api/public-types.ts",
33
+ "./package.json": "./package.json"
34
+ },
35
+ "types": "./src/index.ts",
36
+ "scripts": {
37
+ "build": "tsup",
38
+ "test": "bash scripts/run-workspace-tests.sh",
39
+ "test:repo": "pnpm exec tsx --test $(find test -type f \\( -name '*.test.ts' -o -name '*.test.tsx' \\) | sort)",
40
+ "test:harness": "pnpm --filter @docx-react-component/react-word-editor-harness test",
41
+ "lint:no-authored-js": "bash scripts/check-no-authored-js.sh",
42
+ "context7:api-check": "bash scripts/context7-export-env.sh run bash scripts/context7-api-check.sh",
43
+ "wave:doctor": "bash scripts/context7-export-env.sh run pnpm exec wave doctor --json",
44
+ "wave:dry-run": "bash scripts/context7-export-env.sh run pnpm exec wave launch --lane main --dry-run --no-dashboard",
45
+ "wave:launch": "bash scripts/context7-export-env.sh run pnpm exec wave launch --lane main",
46
+ "wave:launch:managed": "bash scripts/wave-launch.sh",
47
+ "wave:status": "bash scripts/wave-status.sh",
48
+ "wave:watch": "bash scripts/wave-watch.sh --follow",
49
+ "wave:dashboard:current": "bash scripts/wave-dashboard-attach.sh current",
50
+ "wave:dashboard:global": "bash scripts/wave-dashboard-attach.sh global",
51
+ "harness:dev": "pnpm --filter @docx-react-component/react-word-editor-harness dev"
17
52
  },
18
- "main": "./dist/index.cjs",
19
- "module": "./dist/index.js",
20
- "types": "./dist/index.d.ts",
21
- "files": [
22
- "dist",
23
- "LICENSE.md"
24
- ],
25
53
  "keywords": [
26
54
  "docx",
27
55
  "word",
@@ -29,16 +57,13 @@
29
57
  "editor",
30
58
  "react",
31
59
  "comments",
32
- "tracked-changes"
60
+ "tracked-changes",
61
+ "word-review",
62
+ "prosemirror"
33
63
  ],
34
64
  "author": "",
35
65
  "license": "SEE LICENSE IN LICENSE.md",
36
- "peerDependencies": {
37
- "react": ">=18",
38
- "react-dom": ">=18"
39
- },
40
- "devDependencies": {
41
- "@chllming/wave-orchestration": "^0.9.8",
66
+ "dependencies": {
42
67
  "@radix-ui/react-popover": "^1.1.15",
43
68
  "@radix-ui/react-scroll-area": "^1.2.10",
44
69
  "@radix-ui/react-select": "^2.2.6",
@@ -46,39 +71,44 @@
46
71
  "@radix-ui/react-toggle": "^1.1.10",
47
72
  "@radix-ui/react-toggle-group": "^1.1.11",
48
73
  "@radix-ui/react-tooltip": "^1.2.8",
74
+ "lucide-react": "^1.7.0"
75
+ },
76
+ "peerDependencies": {
77
+ "prosemirror-commands": "^1.7.1",
78
+ "prosemirror-keymap": "^1.2.3",
79
+ "prosemirror-model": "^1.25.4",
80
+ "prosemirror-state": "^1.4.4",
81
+ "prosemirror-tables": "^1.8.5",
82
+ "prosemirror-transform": "^1.11.0",
83
+ "prosemirror-view": "^1.41.7",
84
+ "react": "^19.2.0",
85
+ "react-dom": "^19.2.0"
86
+ },
87
+ "devDependencies": {
88
+ "@chllming/wave-orchestration": "^0.9.8",
49
89
  "@types/react": "19.2.14",
50
90
  "@types/react-dom": "19.2.3",
51
91
  "jsdom": "^29.0.1",
52
- "lucide-react": "^1.7.0",
53
- "react": "19.2.4",
54
- "react-dom": "19.2.4",
55
- "tsup": "^8.3.0",
56
- "tsx": "^4.21.0"
57
- },
58
- "dependencies": {
59
92
  "prosemirror-commands": "^1.7.1",
60
93
  "prosemirror-keymap": "^1.2.3",
61
94
  "prosemirror-model": "^1.25.4",
62
95
  "prosemirror-state": "^1.4.4",
63
96
  "prosemirror-tables": "^1.8.5",
64
97
  "prosemirror-transform": "^1.11.0",
65
- "prosemirror-view": "^1.41.7"
98
+ "prosemirror-view": "^1.41.7",
99
+ "react": "19.2.4",
100
+ "react-dom": "19.2.4",
101
+ "tsup": "^8.3.0",
102
+ "tsx": "^4.21.0"
66
103
  },
67
- "scripts": {
68
- "build": "tsup",
69
- "test": "bash scripts/run-workspace-tests.sh",
70
- "test:repo": "pnpm exec tsx --test $(find test -type f \\( -name '*.test.ts' -o -name '*.test.tsx' \\) | sort)",
71
- "test:harness": "pnpm --filter @docx-react-component/react-word-editor-harness test",
72
- "lint:no-authored-js": "bash scripts/check-no-authored-js.sh",
73
- "context7:api-check": "bash scripts/context7-export-env.sh run bash scripts/context7-api-check.sh",
74
- "wave:doctor": "bash scripts/context7-export-env.sh run pnpm exec wave doctor --json",
75
- "wave:dry-run": "bash scripts/context7-export-env.sh run pnpm exec wave launch --lane main --dry-run --no-dashboard",
76
- "wave:launch": "bash scripts/context7-export-env.sh run pnpm exec wave launch --lane main",
77
- "wave:launch:managed": "bash scripts/wave-launch.sh",
78
- "wave:status": "bash scripts/wave-status.sh",
79
- "wave:watch": "bash scripts/wave-watch.sh --follow",
80
- "wave:dashboard:current": "bash scripts/wave-dashboard-attach.sh current",
81
- "wave:dashboard:global": "bash scripts/wave-dashboard-attach.sh global",
82
- "harness:dev": "pnpm --filter @docx-react-component/react-word-editor-harness dev"
104
+ "pnpm": {
105
+ "onlyBuiltDependencies": [
106
+ "esbuild",
107
+ "sharp"
108
+ ],
109
+ "overrides": {
110
+ "react": "19.2.4",
111
+ "react-dom": "19.2.4"
112
+ }
83
113
  }
84
114
  }
package/src/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # Source Layout
2
+
3
+ The landed source tree is still organized around the active docx implementation, not around the future target office-wide layout.
4
+
5
+ ## Current Landed Layout
6
+
7
+ ```text
8
+ src/
9
+ api/
10
+ model/
11
+ core/
12
+ schema/
13
+ state/
14
+ commands/
15
+ selection/
16
+ review/
17
+ store/
18
+ io/
19
+ opc/
20
+ ooxml/
21
+ normalize/
22
+ export/
23
+ preservation/
24
+ validation/
25
+ runtime/
26
+ ui/
27
+ headless/ # Shared pure logic (framework-free)
28
+ shared/ # Shared utilities (revision-filters)
29
+ WordReviewEditor.tsx # Entry point
30
+ ui-tailwind/ # Default rendering (Tailwind + Radix + Lucide)
31
+ editor-surface/
32
+ toolbar/
33
+ review/
34
+ status/
35
+ chrome/
36
+ theme/
37
+ ```
38
+
39
+ This is the truthful current layout for implementation work today.
40
+
41
+ ## Target Broader Layout
42
+
43
+ The broader repo story now targets a future layout like this:
44
+
45
+ ```text
46
+ src/
47
+ platform/
48
+ formats/
49
+ docx/
50
+ xlsx/
51
+ pdf/
52
+ ```
53
+
54
+ That layout is not landed yet. Use it as a planning direction, not as evidence that the current code has already been reorganized.
55
+
56
+ ## UI Layer Strategy
57
+
58
+ - `ui/headless/` — Pure logic: keyboard handling, decoration models, selection utilities. No React dependencies.
59
+ - `ui-tailwind/` — Default rendering: Tailwind CSS, Radix UI primitives, Lucide icons. All styling via CSS custom properties.
60
+ - `ui/WordReviewEditor.tsx` — Public entry point that bridges the runtime to the Tailwind layer.
61
+
62
+ Legacy inline-CSSProperties components have been removed. See `docs/reference/word-review-editor-frontend-architecture.md` for the canonical frontend architecture.
63
+
64
+ Keep business rules close to the subsystem that owns them. Do not centralize unrelated logic into generic utility layers.
65
+
66
+ Ownership rules:
67
+
68
+ - `api` exposes public contracts only.
69
+ - `model`, `core`, `review`, `io`, `preservation`, and `validation` should remain React-free when possible.
70
+ - `runtime` is the only mutation boundary the UI calls into.
71
+ - `ui` consumes runtime contracts and design tokens; it does not own canonical document truth.
72
+
73
+ ## Broader Repo Direction
74
+
75
+ As the repo broadens:
76
+
77
+ - shared package and preservation concerns should move toward `src/platform/`
78
+ - current docx runtime code remains the active implementation track until a deliberate source move lands
79
+ - future xlsx work should gain its own source area rather than widening docx-specific modules by implication
80
+ - future pdf work should remain separate from the first OOXML platform layer unless architecture decisions intentionally broaden it
81
+
82
+ Wave 0 inventory references:
83
+
84
+ - `component-inventory.md`
85
+ Wave-owned inventory for the major editor subsystems, their boundaries, and the promotion target for this scaffold phase.
@@ -0,0 +1,22 @@
1
+ # API
2
+
3
+ Public TypeScript contracts for `WordReviewEditor` belong here.
4
+
5
+ This layer should expose:
6
+
7
+ - component props and ref types
8
+ - datastore adapter interfaces
9
+ - runtime-derived position and selection projection types used by the public API
10
+ - discriminated event unions
11
+ - warning and error payloads
12
+ - persisted snapshot contracts
13
+ - export and compatibility report types
14
+
15
+ Do not place runtime logic here.
16
+
17
+ Frozen naming and boundary rules:
18
+
19
+ - the shipped component name is `WordReviewEditor`
20
+ - `DocumentRuntime` is an internal runtime contract, not a public React component name
21
+ - public range references are canonical-position projections, not DOM-path handles
22
+ - render snapshots stay in `src/runtime`; `src/api` only exposes persisted host-facing snapshot types