@beyondwork/docx-react-component 1.0.41 → 1.0.43

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 (118) hide show
  1. package/package.json +38 -37
  2. package/src/api/awareness-identity-types.ts +35 -0
  3. package/src/api/comment-negotiation-types.ts +130 -0
  4. package/src/api/comment-presentation-types.ts +106 -0
  5. package/src/api/editor-state-types.ts +110 -0
  6. package/src/api/external-custody-types.ts +74 -0
  7. package/src/api/participants-types.ts +18 -0
  8. package/src/api/public-types.ts +541 -5
  9. package/src/api/scope-metadata-resolver-types.ts +88 -0
  10. package/src/core/commands/formatting-commands.ts +1 -1
  11. package/src/core/commands/index.ts +601 -9
  12. package/src/core/search/search-text.ts +15 -2
  13. package/src/index.ts +131 -1
  14. package/src/io/docx-session.ts +672 -2
  15. package/src/io/export/escape-xml-attribute.ts +26 -0
  16. package/src/io/export/external-send.ts +188 -0
  17. package/src/io/export/serialize-comments.ts +13 -16
  18. package/src/io/export/serialize-footnotes.ts +17 -24
  19. package/src/io/export/serialize-headers-footers.ts +17 -24
  20. package/src/io/export/serialize-main-document.ts +59 -62
  21. package/src/io/export/serialize-numbering.ts +20 -27
  22. package/src/io/export/serialize-runtime-revisions.ts +2 -9
  23. package/src/io/export/serialize-tables.ts +8 -15
  24. package/src/io/export/table-properties-xml.ts +25 -32
  25. package/src/io/import/external-reimport.ts +40 -0
  26. package/src/io/load-scheduler.ts +230 -0
  27. package/src/io/normalize/normalize-text.ts +83 -0
  28. package/src/io/ooxml/bw-xml.ts +244 -0
  29. package/src/io/ooxml/canonicalize-payload.ts +301 -0
  30. package/src/io/ooxml/comment-negotiation-payload.ts +288 -0
  31. package/src/io/ooxml/comment-presentation-payload.ts +311 -0
  32. package/src/io/ooxml/external-custody-payload.ts +102 -0
  33. package/src/io/ooxml/participants-payload.ts +97 -0
  34. package/src/io/ooxml/payload-signature.ts +112 -0
  35. package/src/io/ooxml/workflow-payload-validator.ts +367 -0
  36. package/src/io/ooxml/workflow-payload.ts +317 -7
  37. package/src/runtime/awareness-identity.ts +173 -0
  38. package/src/runtime/collab/event-types.ts +27 -0
  39. package/src/runtime/collab-session-bridge.ts +157 -0
  40. package/src/runtime/collab-session-facet.ts +193 -0
  41. package/src/runtime/collab-session.ts +273 -0
  42. package/src/runtime/comment-negotiation-sync.ts +91 -0
  43. package/src/runtime/comment-negotiation.ts +158 -0
  44. package/src/runtime/comment-presentation.ts +223 -0
  45. package/src/runtime/document-runtime.ts +639 -124
  46. package/src/runtime/editor-state-channel.ts +544 -0
  47. package/src/runtime/editor-state-integration.ts +217 -0
  48. package/src/runtime/external-send-runtime.ts +117 -0
  49. package/src/runtime/layout/docx-font-loader.ts +11 -30
  50. package/src/runtime/layout/index.ts +2 -0
  51. package/src/runtime/layout/inert-layout-facet.ts +4 -0
  52. package/src/runtime/layout/layout-engine-instance.ts +139 -14
  53. package/src/runtime/layout/page-graph.ts +79 -7
  54. package/src/runtime/layout/paginated-layout-engine.ts +441 -48
  55. package/src/runtime/layout/public-facet.ts +585 -14
  56. package/src/runtime/layout/table-row-split.ts +316 -0
  57. package/src/runtime/markdown-sanitizer.ts +132 -0
  58. package/src/runtime/participants.ts +134 -0
  59. package/src/runtime/perf-counters.ts +28 -0
  60. package/src/runtime/render/render-frame-types.ts +17 -0
  61. package/src/runtime/render/render-kernel.ts +172 -29
  62. package/src/runtime/resign-payload.ts +120 -0
  63. package/src/runtime/surface-projection.ts +10 -5
  64. package/src/runtime/tamper-gate.ts +157 -0
  65. package/src/runtime/workflow-markup.ts +80 -16
  66. package/src/runtime/workflow-rail-segments.ts +244 -5
  67. package/src/ui/WordReviewEditor.tsx +654 -45
  68. package/src/ui/editor-command-bag.ts +14 -0
  69. package/src/ui/editor-runtime-boundary.ts +111 -11
  70. package/src/ui/editor-shell-view.tsx +21 -0
  71. package/src/ui/editor-surface-controller.tsx +5 -0
  72. package/src/ui/headless/selection-helpers.ts +10 -0
  73. package/src/ui-tailwind/chrome/chrome-preset-model.ts +28 -0
  74. package/src/ui-tailwind/chrome/chrome-preset-toolbar.tsx +62 -2
  75. package/src/ui-tailwind/chrome/collab-audience-chip.tsx +73 -0
  76. package/src/ui-tailwind/chrome/collab-negotiation-action-bar.tsx +244 -0
  77. package/src/ui-tailwind/chrome/collab-presence-strip.tsx +150 -0
  78. package/src/ui-tailwind/chrome/collab-role-chip.tsx +62 -0
  79. package/src/ui-tailwind/chrome/collab-send-to-supplier-button.tsx +68 -0
  80. package/src/ui-tailwind/chrome/collab-send-to-supplier-modal.tsx +149 -0
  81. package/src/ui-tailwind/chrome/collab-tamper-banner.tsx +68 -0
  82. package/src/ui-tailwind/chrome/collab-top-nav-container.tsx +281 -0
  83. package/src/ui-tailwind/chrome/forward-non-drag-click.ts +104 -0
  84. package/src/ui-tailwind/chrome/tw-mode-dock.tsx +1 -0
  85. package/src/ui-tailwind/chrome/tw-selection-tool-host.tsx +7 -1
  86. package/src/ui-tailwind/chrome/tw-table-grip-layer.tsx +1 -38
  87. package/src/ui-tailwind/chrome-overlay/index.ts +6 -0
  88. package/src/ui-tailwind/chrome-overlay/scope-card-role-model.ts +78 -0
  89. package/src/ui-tailwind/chrome-overlay/scope-keyboard-cycle.ts +49 -0
  90. package/src/ui-tailwind/chrome-overlay/tw-chrome-overlay.tsx +106 -0
  91. package/src/ui-tailwind/chrome-overlay/tw-page-stack-overlay-layer.tsx +527 -0
  92. package/src/ui-tailwind/chrome-overlay/tw-scope-card-layer.tsx +120 -22
  93. package/src/ui-tailwind/chrome-overlay/tw-scope-card.tsx +310 -32
  94. package/src/ui-tailwind/chrome-overlay/tw-scope-rail-layer.tsx +93 -14
  95. package/src/ui-tailwind/editor-surface/paste-plain-text.ts +72 -0
  96. package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +118 -8
  97. package/src/ui-tailwind/editor-surface/pm-decorations.ts +35 -1
  98. package/src/ui-tailwind/editor-surface/pm-page-break-decorations.ts +86 -3
  99. package/src/ui-tailwind/editor-surface/pm-schema.ts +167 -17
  100. package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +35 -7
  101. package/src/ui-tailwind/editor-surface/remote-cursor-plugin.ts +20 -3
  102. package/src/ui-tailwind/editor-surface/tw-page-block-view.helpers.ts +265 -0
  103. package/src/ui-tailwind/editor-surface/tw-page-block-view.tsx +10 -256
  104. package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +9 -0
  105. package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +66 -0
  106. package/src/ui-tailwind/index.ts +37 -1
  107. package/src/ui-tailwind/page-stack/tw-endnote-area.tsx +57 -0
  108. package/src/ui-tailwind/page-stack/tw-footnote-area.tsx +71 -0
  109. package/src/ui-tailwind/page-stack/tw-page-footer-band.tsx +73 -0
  110. package/src/ui-tailwind/page-stack/tw-page-header-band.tsx +74 -0
  111. package/src/ui-tailwind/page-stack/tw-page-stack-chrome-layer.tsx +477 -0
  112. package/src/ui-tailwind/page-stack/tw-region-block-renderer.tsx +374 -0
  113. package/src/ui-tailwind/review/comment-markdown-renderer.tsx +155 -0
  114. package/src/ui-tailwind/review/tw-comment-sidebar.tsx +77 -16
  115. package/src/ui-tailwind/review/tw-review-rail-footer.tsx +29 -3
  116. package/src/ui-tailwind/status/tw-status-bar.tsx +52 -1
  117. package/src/ui-tailwind/theme/editor-theme.css +25 -0
  118. package/src/ui-tailwind/tw-review-workspace.tsx +455 -118
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Metadata persistence mode — overlay-level default.
3
+ *
4
+ * - `"internal"`: every entry / field is inlined in the bw:workflowPayload
5
+ * XML body. Self-contained docx; no host callback required.
6
+ * - `"external"`: entries / fields are stored by reference via a host-owned
7
+ * ScopeMetadataResolver; the docx carries only a `storageRef` string.
8
+ *
9
+ * Unknown values → preserve-only (spec §8.2). Readers must never silently
10
+ * coerce to a known value.
11
+ */
12
+ export type MetadataPersistenceMode = "internal" | "external";
13
+
14
+ /**
15
+ * Per-scope / per-entry / per-field override. `"inherit"` defers to the
16
+ * parent (entry inherits scope; scope inherits overlay; overlay inherits
17
+ * the default `"internal"`).
18
+ */
19
+ export type ScopeMetadataPersistence = "internal" | "external" | "inherit";
20
+
21
+ /**
22
+ * Opaque host-owned reference for externally-stored metadata values. The
23
+ * editor never parses this string — it is passed verbatim to the
24
+ * resolver. Host examples:
25
+ *
26
+ * "clm-workblock-row:wb-123:row-42:v-3"
27
+ * "https://rowstore.internal/metadata/abc"
28
+ * "s3://bucket/tenant-1/scope-metadata/e91a.json"
29
+ */
30
+ export type ScopeMetadataStorageRef = string;
31
+
32
+ /**
33
+ * Host-supplied resolver. The editor calls `resolve` whenever it needs
34
+ * the actual value of an external entry / field; it calls `publish` when
35
+ * toggling a scope / entry from `"internal"` to `"external"` and needs
36
+ * to hand the current inline value off to the host's store.
37
+ *
38
+ * All methods are async so the host can make network calls. An
39
+ * `undefined` return from `resolve` signals a missing or revoked ref;
40
+ * the editor surfaces this as a non-fatal warning and renders the entry
41
+ * as detached in the scope card. `undefined` (rather than `null`)
42
+ * matches the shipped `ExternalCustodyResolver.restore` convention (P7).
43
+ *
44
+ * `delete` is optional — hosts that don't need cleanup on toggle may
45
+ * omit it. The editor only calls it when transitioning a scope from
46
+ * `"external"` back to `"internal"` (hand the value back inline, then
47
+ * release the ref).
48
+ */
49
+ export interface ScopeMetadataResolver {
50
+ /**
51
+ * Fetch the value for an opaque storageRef. Returns `undefined`
52
+ * when the ref is unknown or revoked — the editor surfaces this as
53
+ * a non-fatal warning and renders the entry as detached in the
54
+ * scope card. `version` (when present) is the rowstore's current
55
+ * version; the editor compares it against the docx's embedded
56
+ * `metadataVersion` hint and emits `metadata_conflict_detected` on
57
+ * mismatch. Matches the `ExternalCustodyResolver.restore`
58
+ * convention (P7) — prefer `undefined` over `null` for consistency.
59
+ */
60
+ resolve(ref: ScopeMetadataStorageRef): Promise<
61
+ | { value: Record<string, unknown>; version?: number }
62
+ | undefined
63
+ >;
64
+
65
+ /**
66
+ * Publish an inline value to the host store. `expectedVersion`
67
+ * (when set) enables optimistic concurrency: the host rejects the
68
+ * write if the stored row has advanced past the expected version,
69
+ * throwing a host-defined error that the editor surfaces via
70
+ * `metadata_conflict_detected`.
71
+ *
72
+ * Returns the opaque ref plus the version the store recorded for
73
+ * this write. The editor embeds this version on the XML element.
74
+ */
75
+ publish(input: {
76
+ scopeId: string;
77
+ metadataId: string;
78
+ entryId?: string;
79
+ fieldKey?: string;
80
+ value: Record<string, unknown>;
81
+ expectedVersion?: number;
82
+ }): Promise<{
83
+ ref: ScopeMetadataStorageRef;
84
+ version: number;
85
+ }>;
86
+
87
+ delete?(ref: ScopeMetadataStorageRef): Promise<void>;
88
+ }
@@ -188,7 +188,7 @@ type ToggleFormattingMark =
188
188
  | "strikethrough"
189
189
  | "superscript"
190
190
  | "subscript";
191
- type FormattingOperation =
191
+ export type FormattingOperation =
192
192
  | { type: "toggle"; mark: ToggleFormattingMark }
193
193
  | { type: "set-font-family"; fontFamily: string | null }
194
194
  | { type: "set-font-size"; size: number | null }