@beyondwork/docx-react-component 1.0.57 → 1.0.59
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 +1 -1
- package/package.json +2 -1
- package/src/api/awareness-identity-types.ts +4 -2
- package/src/api/comment-negotiation-types.ts +4 -1
- package/src/api/external-custody-types.ts +16 -0
- package/src/api/internal/build-ref-projections.ts +108 -0
- package/src/api/package-version.ts +1 -1
- package/src/api/participants-types.ts +11 -1
- package/src/api/public-types.ts +1149 -8
- package/src/api/scope-metadata-resolver-types.ts +6 -0
- package/src/compare/diff-engine.ts +3 -0
- package/src/core/commands/formatting-commands.ts +1 -0
- package/src/core/commands/index.ts +225 -16
- package/src/core/commands/legacy-form-field-commands.ts +181 -0
- package/src/core/commands/table-structure-commands.ts +149 -31
- package/src/core/selection/mapping.ts +20 -0
- package/src/core/state/editor-state.ts +2 -1
- package/src/index.ts +28 -0
- package/src/io/docx-session.ts +22 -3
- package/src/io/export/export-session.ts +11 -7
- package/src/io/export/ooxml-namespaces.ts +47 -0
- package/src/io/export/reattach-preserved-parts.ts +4 -16
- package/src/io/export/serialize-comments.ts +3 -131
- package/src/io/export/serialize-ffdata.ts +89 -0
- package/src/io/export/serialize-headers-footers.ts +5 -0
- package/src/io/export/serialize-main-document.ts +224 -34
- package/src/io/export/serialize-numbering.ts +22 -2
- package/src/io/export/serialize-revisions.ts +99 -0
- package/src/io/export/serialize-tables.ts +9 -0
- package/src/io/export/split-review-boundaries.ts +1 -0
- package/src/io/export/table-properties-xml.ts +14 -0
- package/src/io/load-scheduler.ts +70 -28
- package/src/io/normalize/normalize-text.ts +13 -0
- package/src/io/ooxml/_mini-xml.ts +198 -0
- package/src/io/ooxml/canonicalize-payload.ts +1 -4
- package/src/io/ooxml/chart/chart-style-table.ts +4 -3
- package/src/io/ooxml/chart/parse-chart-space.ts +2 -4
- package/src/io/ooxml/chart/parse-series.ts +2 -1
- package/src/io/ooxml/chart/resolve-color.ts +2 -2
- package/src/io/ooxml/chart/types.ts +6 -434
- package/src/io/ooxml/comment-presentation-payload.ts +6 -5
- package/src/io/ooxml/highlight-colors.ts +8 -5
- package/src/io/ooxml/parse-anchor.ts +68 -53
- package/src/io/ooxml/parse-comments.ts +14 -142
- package/src/io/ooxml/parse-complex-content.ts +3 -106
- package/src/io/ooxml/parse-drawing.ts +100 -195
- package/src/io/ooxml/parse-ffdata.ts +93 -0
- package/src/io/ooxml/parse-fields.ts +7 -146
- package/src/io/ooxml/parse-fill.ts +88 -8
- package/src/io/ooxml/parse-font-table.ts +5 -105
- package/src/io/ooxml/parse-footnotes.ts +28 -152
- package/src/io/ooxml/parse-headers-footers.ts +106 -212
- package/src/io/ooxml/parse-inline-media.ts +3 -200
- package/src/io/ooxml/parse-main-document.ts +180 -217
- package/src/io/ooxml/parse-numbering.ts +154 -335
- package/src/io/ooxml/parse-object.ts +147 -0
- package/src/io/ooxml/parse-ole-relationship.ts +82 -0
- package/src/io/ooxml/parse-paragraph-formatting.ts +7 -10
- package/src/io/ooxml/parse-picture-sdt.ts +85 -0
- package/src/io/ooxml/parse-picture.ts +120 -39
- package/src/io/ooxml/parse-revisions.ts +285 -51
- package/src/io/ooxml/parse-settings.ts +6 -99
- package/src/io/ooxml/parse-shapes.ts +25 -140
- package/src/io/ooxml/parse-styles.ts +3 -218
- package/src/io/ooxml/parse-tables.ts +76 -256
- package/src/io/ooxml/parse-theme.ts +1 -4
- package/src/io/ooxml/property-grab-bag.ts +5 -47
- package/src/io/ooxml/xml-element-serialize.ts +32 -0
- package/src/io/ooxml/xml-parser.ts +183 -0
- package/src/legal/bookmarks.ts +1 -1
- package/src/legal/cross-references.ts +1 -1
- package/src/legal/defined-terms.ts +1 -1
- package/src/legal/{_document-root.ts → document-root.ts} +8 -0
- package/src/legal/signature-blocks.ts +1 -1
- package/src/model/canonical-document.ts +165 -6
- package/src/model/chart-types.ts +439 -0
- package/src/model/snapshot.ts +3 -1
- package/src/review/store/comment-remapping.ts +24 -11
- package/src/review/store/revision-actions.ts +482 -2
- package/src/review/store/revision-store.ts +15 -0
- package/src/review/store/revision-types.ts +76 -0
- package/src/runtime/collab/remote-cursor-awareness.ts +24 -0
- package/src/runtime/collab/runtime-collab-sync.ts +33 -0
- package/src/runtime/diagnostics/build-diagnostic.ts +151 -0
- package/src/runtime/diagnostics/code-metadata-table.ts +221 -0
- package/src/runtime/document-runtime.ts +544 -35
- package/src/runtime/document-search.ts +176 -0
- package/src/runtime/edit-ops/index.ts +18 -2
- package/src/runtime/footnote-resolver.ts +130 -0
- package/src/runtime/layout/layout-engine-instance.ts +31 -4
- package/src/runtime/layout/layout-engine-version.ts +37 -1
- package/src/runtime/layout/page-graph.ts +14 -1
- package/src/runtime/layout/resolved-formatting-state.ts +21 -0
- package/src/runtime/numbering-prefix.ts +17 -0
- package/src/runtime/query-scopes.ts +183 -0
- package/src/runtime/resolved-numbering-geometry.ts +37 -6
- package/src/runtime/revision-runtime.ts +27 -1
- package/src/runtime/scope-resolver.ts +60 -0
- package/src/runtime/selection/post-edit-validator.ts +60 -6
- package/src/runtime/structure-ops/index.ts +20 -4
- package/src/runtime/surface-projection.ts +293 -18
- package/src/runtime/table-schema.ts +6 -0
- package/src/runtime/theme-color-resolver.ts +2 -2
- package/src/runtime/units.ts +9 -0
- package/src/runtime/workflow-rail-segments.ts +4 -0
- package/src/ui/WordReviewEditor.tsx +258 -44
- package/src/ui/editor-runtime-boundary.ts +13 -0
- package/src/ui/editor-shell-view.tsx +4 -1
- package/src/ui/headless/chrome-registry.ts +53 -0
- package/src/ui/headless/selection-tool-resolver.ts +11 -1
- package/src/ui-tailwind/chrome/chrome-preset-model.ts +13 -0
- package/src/ui-tailwind/chrome/tw-command-palette-mount.tsx +96 -0
- package/src/ui-tailwind/chrome/tw-context-menu.tsx +2 -1
- package/src/ui-tailwind/chrome/tw-image-context-toolbar.tsx +5 -4
- package/src/ui-tailwind/chrome/tw-mode-dock.tsx +6 -2
- package/src/ui-tailwind/chrome/use-container-breakpoint.ts +111 -0
- package/src/ui-tailwind/chrome-overlay/tw-chrome-overlay.tsx +23 -9
- package/src/ui-tailwind/chrome-overlay/tw-object-selection-overlay.tsx +158 -0
- package/src/ui-tailwind/chrome-overlay/tw-page-stack-overlay-layer.tsx +6 -7
- package/src/ui-tailwind/editor-surface/pm-schema.ts +105 -17
- package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +13 -0
- package/src/ui-tailwind/editor-surface/shape-renderer.ts +76 -14
- package/src/ui-tailwind/editor-surface/tw-page-block-view.helpers.ts +18 -1
- package/src/ui-tailwind/editor-surface/tw-page-block-view.tsx +2 -0
- package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +18 -2
- package/src/ui-tailwind/index.ts +9 -0
- package/src/ui-tailwind/page-chrome-model.ts +77 -5
- package/src/ui-tailwind/page-stack/tw-page-stack-chrome-layer.tsx +56 -1
- package/src/ui-tailwind/page-stack/tw-region-block-renderer.tsx +2 -0
- package/src/ui-tailwind/review/tw-comment-sidebar.tsx +116 -113
- package/src/ui-tailwind/review/tw-review-rail-footer.tsx +2 -2
- package/src/ui-tailwind/theme/tokens.ts +14 -0
- package/src/ui-tailwind/toolbar/tw-shell-header.tsx +5 -0
- package/src/ui-tailwind/tw-review-workspace.tsx +52 -87
- package/src/validation/diagnostics.ts +1 -0
package/README.md
CHANGED
|
@@ -239,7 +239,7 @@ Engineering work is organized into 9 lanes (5 active now + 2 later polish + 2 fi
|
|
|
239
239
|
| 6c | [**Context & Review Surfaces**](docs/plans/lane-6c-context-review-surfaces.md) | **~15%** | Gated on 6a.S1+S2 — selection toolbar + suggestion card + rail + scope + context toolbars + health panel restyle; TwCommentPreview / TwEmptyState / TwShortcutHint |
|
|
240
240
|
| 6d | [**Visual Fidelity**](docs/plans/lane-6d-visual-fidelity.md) | **~20%** | Gated on 6a.S1+S2 + external-lane deps — L8 A/B/C shipped; L8 Phase D + P11 overlays + P7 + P12 + P14 next |
|
|
241
241
|
| 7a | [**Visual Fidelity Register**](docs/plans/lane-7a-visual-fidelity-register.md) | **0%** | LATER (gated on 6a–6d) — V5 covers, V6 REF/PAGEREF, V7 cascade audit |
|
|
242
|
-
| 7b | [**Revision & Redline Completion**](docs/plans/lane-7b-revision-redline-completion.md) | **
|
|
242
|
+
| 7b | [**Revision & Redline Completion**](docs/plans/lane-prompts/lane-7b-revision-redline-completion.md) | **✅ CLOSED** | Phases A–N shipped on `lane-7b-revision-redline` (17 commits) — full X4.a parse (container + range markers), X4.b complete (cellIns accept + reject + row-ins/row-del accept + reject), move-promotion (linked-pair atomic accept/reject). Trigger-gated: X4.c + X5 + nested-table row-insertion scope limit. Validator pass handed off to coordinator |
|
|
243
243
|
| 7c | [**Preservation & Format Coverage**](docs/plans/lane-7c-preservation-format-coverage.md) | **0%** | LATER (gated on 6a–6d) — O6 Strict, OLE preserve-only, picture-SDT, w14/kern/VML defer |
|
|
244
244
|
| 7d | [**Platform Hardening & Hygiene**](docs/plans/lane-7d-platform-hardening-hygiene.md) | **0%** | LATER (gated on 6a–6d) — harness-crash-hardening, fastload activation, worktree consolidation |
|
|
245
245
|
| 8 | [**API Ergonomics / Errors / BC**](docs/plans/lane-8-api-ergonomics.md) | **40%** | LATER — Tracks A+C shipped (error catalog + ergonomics fixes); Tracks B+D+E + public-api.md end-to-end refactor remain |
|
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.59",
|
|
5
5
|
"description": "Embeddable React Word (docx) editor with review, comments, tracked changes, and round-trip OOXML fidelity.",
|
|
6
6
|
"packageManager": "pnpm@10.30.3",
|
|
7
7
|
"type": "module",
|
|
@@ -104,6 +104,7 @@
|
|
|
104
104
|
"test:harness": "pnpm --filter @docx-react-component/react-word-editor-harness test",
|
|
105
105
|
"test:visual": "VISUAL_SMOKE_PROFILE=bare pnpm exec playwright test --project=chromium",
|
|
106
106
|
"test:visual:chrome": "VISUAL_SMOKE_PROFILE=chrome-cycle pnpm exec playwright test --project=chromium",
|
|
107
|
+
"test:visual:redline": "VISUAL_SMOKE_PROFILE=redline-cycle pnpm exec playwright test --project=chromium",
|
|
107
108
|
"visual:list-runs": "node scripts/visual-smoke-list-runs.mjs",
|
|
108
109
|
"mcp:visual-smoke": "node scripts/visual-smoke-mcp.mjs",
|
|
109
110
|
"lint": "pnpm run lint:no-authored-js && pnpm run lint:docs-contracts && pnpm run lint:tsgo && pnpm run lint:tsgo:harness",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { CollabParticipantRole } from "./participants-types.ts";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Typed shape carried in the Awareness `identity` field. One per
|
|
3
5
|
* connected client. Written by the local client on attach; read by
|
|
@@ -7,7 +9,7 @@ export interface AwarenessIdentity {
|
|
|
7
9
|
userId: string;
|
|
8
10
|
displayName: string;
|
|
9
11
|
collabIdentity?: string;
|
|
10
|
-
role:
|
|
12
|
+
role: CollabParticipantRole;
|
|
11
13
|
authorKind: "human" | "agent" | "system";
|
|
12
14
|
/** Identifier of the story the peer is currently looking at, if any. */
|
|
13
15
|
activeStoryId?: string;
|
|
@@ -28,7 +30,7 @@ export interface PresenceSnapshot {
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export interface CollabPosture {
|
|
31
|
-
role:
|
|
33
|
+
role: CollabParticipantRole;
|
|
32
34
|
transport: "none" | "attached";
|
|
33
35
|
/** Count of other connected peers (self excluded). */
|
|
34
36
|
peers: number;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { CollabParticipantRole } from "./participants-types.ts";
|
|
2
|
+
|
|
1
3
|
export type CommentNegotiationState =
|
|
2
4
|
| "proposed"
|
|
3
5
|
| "negotiating"
|
|
@@ -105,7 +107,8 @@ export type CommentNegotiationAction =
|
|
|
105
107
|
actorId: string;
|
|
106
108
|
};
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
/** @deprecated Use {@link CollabParticipantRole} from participants-types */
|
|
111
|
+
export type NegotiationRole = CollabParticipantRole;
|
|
109
112
|
|
|
110
113
|
export type NegotiationBlockReason =
|
|
111
114
|
| "negotiation_invalid_transition"
|
|
@@ -65,10 +65,26 @@ export interface ExternalCustodyRestoredContent {
|
|
|
65
65
|
* this so the library never directly persists internal content.
|
|
66
66
|
*/
|
|
67
67
|
export interface ExternalCustodyResolver {
|
|
68
|
+
/**
|
|
69
|
+
* Persist the stripped internal content keyed by `custodyId`.
|
|
70
|
+
* Must be idempotent. Rejections propagate as fatal errors in
|
|
71
|
+
* the send-to-external flow and are surfaced via `onError`.
|
|
72
|
+
*/
|
|
68
73
|
archive(payload: ExternalCustodyArchivePayload): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Retrieve archived content by custody ID. Returns `undefined`
|
|
76
|
+
* when the custody record is not found (non-fatal; editor treats
|
|
77
|
+
* the re-import as a fresh document). Rejections are fatal and
|
|
78
|
+
* surfaced via `onError`.
|
|
79
|
+
*/
|
|
69
80
|
restore(args: {
|
|
70
81
|
custodyId: string;
|
|
71
82
|
originContentHash: string;
|
|
72
83
|
}): Promise<ExternalCustodyRestoredContent | undefined>;
|
|
84
|
+
/**
|
|
85
|
+
* Delete a custody record after a successful internal conversion.
|
|
86
|
+
* Optional. Rejections are logged non-fatally; conversion completes
|
|
87
|
+
* regardless.
|
|
88
|
+
*/
|
|
73
89
|
delete?(custodyId: string): Promise<void>;
|
|
74
90
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// v2.0.0 Track D — purpose-grouped ref projections. Pure dispatch over
|
|
2
|
+
// the already-built WordReviewEditorRef. Called by WordReviewEditor.tsx
|
|
3
|
+
// at both ref-construction sites (the real-runtime bridge and the
|
|
4
|
+
// loading bridge) so projections always point at the live ref.
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
EditorDiagnosticCode,
|
|
8
|
+
EditorDiagnosticLlmMetadata,
|
|
9
|
+
WordReviewEditorChangesFacet,
|
|
10
|
+
WordReviewEditorCommentsFacet,
|
|
11
|
+
WordReviewEditorDiagnosticsFacet,
|
|
12
|
+
WordReviewEditorDocumentFacet,
|
|
13
|
+
WordReviewEditorFieldsFacet,
|
|
14
|
+
WordReviewEditorRef,
|
|
15
|
+
WordReviewEditorScopesFacet,
|
|
16
|
+
} from "../public-types.ts";
|
|
17
|
+
import {
|
|
18
|
+
CODE_METADATA_TABLE,
|
|
19
|
+
KNOWN_DIAGNOSTIC_CODES,
|
|
20
|
+
} from "../../runtime/diagnostics/code-metadata-table.ts";
|
|
21
|
+
|
|
22
|
+
type RefProjections = Pick<
|
|
23
|
+
WordReviewEditorRef,
|
|
24
|
+
"comments" | "changes" | "fields" | "document" | "scopes" | "diagnostics"
|
|
25
|
+
>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Build all six purpose-grouped ref projections. The returned object is
|
|
29
|
+
* stateless dispatch — each projection method calls back into the live
|
|
30
|
+
* ref via `getRef()` at call time, so the projections stay current even
|
|
31
|
+
* if the ref itself is rebuilt (e.g., when the runtime re-mounts).
|
|
32
|
+
*/
|
|
33
|
+
export function buildRefProjections(
|
|
34
|
+
getRef: () => WordReviewEditorRef,
|
|
35
|
+
): RefProjections {
|
|
36
|
+
const comments: WordReviewEditorCommentsFacet = {
|
|
37
|
+
add: (params) => getRef().addComment(params),
|
|
38
|
+
addReply: (commentId, body) => getRef().addCommentReply(commentId, body),
|
|
39
|
+
resolve: (commentId) => getRef().resolveComment(commentId),
|
|
40
|
+
reopen: (commentId) => getRef().reopenComment(commentId),
|
|
41
|
+
edit: (commentId, body) => getRef().editCommentBody(commentId, body),
|
|
42
|
+
delete: (commentId) => getRef().deleteComment(commentId),
|
|
43
|
+
open: (commentId) => getRef().openComment(commentId),
|
|
44
|
+
scrollTo: (commentId) => getRef().scrollToComment(commentId),
|
|
45
|
+
get: () => getRef().getComments(),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const changes: WordReviewEditorChangesFacet = {
|
|
49
|
+
accept: (changeId) => getRef().acceptChange(changeId),
|
|
50
|
+
reject: (changeId) => getRef().rejectChange(changeId),
|
|
51
|
+
acceptAll: () => getRef().acceptAllChanges(),
|
|
52
|
+
rejectAll: () => getRef().rejectAllChanges(),
|
|
53
|
+
acceptGroup: (groupId) => getRef().acceptSuggestionGroup(groupId),
|
|
54
|
+
rejectGroup: (groupId) => getRef().rejectSuggestionGroup(groupId),
|
|
55
|
+
scrollTo: (revisionId) => getRef().scrollToRevision(revisionId),
|
|
56
|
+
get: () => getRef().getTrackedChanges(),
|
|
57
|
+
getSuggestions: () => getRef().getSuggestionsSnapshot(),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const fields: WordReviewEditorFieldsFacet = {
|
|
61
|
+
getSnapshot: () => getRef().getFieldSnapshot(),
|
|
62
|
+
update: (options) => getRef().updateFields(options),
|
|
63
|
+
updateToc: (options) => getRef().updateTableOfContents(options),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const document: WordReviewEditorDocumentFacet = {
|
|
67
|
+
export: (options) => getRef().exportDocx(options),
|
|
68
|
+
getSessionState: () => getRef().getSessionState(),
|
|
69
|
+
getSnapshot: () => getRef().getSnapshot(),
|
|
70
|
+
getRenderSnapshot: () => getRef().getRenderSnapshot(),
|
|
71
|
+
isDirty: () => getRef().isDirty(),
|
|
72
|
+
getCompatibilityReport: () => getRef().getCompatibilityReport(),
|
|
73
|
+
getStats: () => getRef().getRenderSnapshot().documentStats,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const scopes: WordReviewEditorScopesFacet = {
|
|
77
|
+
add: (params) => getRef().addScope(params),
|
|
78
|
+
get: (scopeId) => getRef().getScope(scopeId),
|
|
79
|
+
remove: (scopeId) => getRef().removeScope(scopeId),
|
|
80
|
+
query: (filter) => getRef().queryScopes(filter),
|
|
81
|
+
findAt: (position, options) => getRef().findScopesAt(position, options),
|
|
82
|
+
findIntersecting: (range, options) =>
|
|
83
|
+
getRef().findScopesIntersecting(range, options),
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Catalog built once — shape is derived from the static code-metadata table.
|
|
87
|
+
const catalog: ReadonlyArray<{
|
|
88
|
+
code: EditorDiagnosticCode;
|
|
89
|
+
severity: "fatal" | "error" | "warning" | "info";
|
|
90
|
+
llmMetadata: EditorDiagnosticLlmMetadata;
|
|
91
|
+
}> = Object.freeze(
|
|
92
|
+
KNOWN_DIAGNOSTIC_CODES.map((code) => {
|
|
93
|
+
const row = CODE_METADATA_TABLE[code];
|
|
94
|
+
return Object.freeze({
|
|
95
|
+
code,
|
|
96
|
+
severity: row.severity,
|
|
97
|
+
llmMetadata: row.llmMetadata,
|
|
98
|
+
});
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const diagnostics: WordReviewEditorDiagnosticsFacet = {
|
|
103
|
+
getWarnings: () => getRef().getWarnings(),
|
|
104
|
+
getCatalog: () => catalog,
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return { comments, changes, fields, document, scopes, diagnostics };
|
|
108
|
+
}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Collab-layer role shared across awareness, negotiation, and participant
|
|
3
|
+
* roster contexts. Distinct from `EditorRole` which governs chrome posture.
|
|
4
|
+
*
|
|
5
|
+
* - `"author"` — originating author; full write capability.
|
|
6
|
+
* - `"reviewer"` — reviewing party; comment + tracked-change capability.
|
|
7
|
+
* - `"observer"` — read-only presence; no mutations.
|
|
8
|
+
*/
|
|
9
|
+
export type CollabParticipantRole = "author" | "reviewer" | "observer";
|
|
10
|
+
/** @deprecated Use {@link CollabParticipantRole} */
|
|
11
|
+
export type ParticipantRole = CollabParticipantRole;
|
|
2
12
|
export type AuthorKind = "human" | "agent" | "system";
|
|
3
13
|
|
|
4
14
|
export interface Participant {
|