@beyondwork/docx-react-component 1.0.56 → 1.0.57

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 (107) hide show
  1. package/package.json +1 -1
  2. package/src/api/public-types.ts +157 -0
  3. package/src/compare/diff-engine.ts +3 -0
  4. package/src/core/commands/formatting-commands.ts +1 -0
  5. package/src/core/commands/index.ts +17 -11
  6. package/src/core/selection/mapping.ts +18 -1
  7. package/src/core/selection/review-anchors.ts +29 -18
  8. package/src/io/chart-preview-resolver.ts +175 -41
  9. package/src/io/docx-session.ts +57 -2
  10. package/src/io/export/serialize-main-document.ts +82 -0
  11. package/src/io/export/serialize-styles.ts +61 -3
  12. package/src/io/export/table-properties-xml.ts +19 -4
  13. package/src/io/normalize/normalize-text.ts +33 -0
  14. package/src/io/ooxml/parse-anchor.ts +182 -0
  15. package/src/io/ooxml/parse-drawing.ts +319 -0
  16. package/src/io/ooxml/parse-fields.ts +115 -2
  17. package/src/io/ooxml/parse-fill.ts +215 -0
  18. package/src/io/ooxml/parse-font-table.ts +190 -0
  19. package/src/io/ooxml/parse-footnotes.ts +52 -1
  20. package/src/io/ooxml/parse-main-document.ts +241 -1
  21. package/src/io/ooxml/parse-numbering.ts +96 -0
  22. package/src/io/ooxml/parse-picture.ts +107 -0
  23. package/src/io/ooxml/parse-settings.ts +34 -0
  24. package/src/io/ooxml/parse-shapes.ts +87 -0
  25. package/src/io/ooxml/parse-solid-fill.ts +11 -0
  26. package/src/io/ooxml/parse-styles.ts +74 -1
  27. package/src/io/ooxml/parse-theme.ts +60 -0
  28. package/src/io/paste/html-clipboard.ts +449 -0
  29. package/src/io/paste/word-clipboard.ts +5 -1
  30. package/src/legal/_document-root.ts +26 -0
  31. package/src/legal/bookmarks.ts +4 -3
  32. package/src/legal/cross-references.ts +3 -2
  33. package/src/legal/defined-terms.ts +2 -1
  34. package/src/legal/signature-blocks.ts +2 -1
  35. package/src/model/canonical-document.ts +415 -3
  36. package/src/runtime/chart/chart-model-store.ts +73 -10
  37. package/src/runtime/document-runtime.ts +693 -41
  38. package/src/runtime/edit-ops/index.ts +129 -0
  39. package/src/runtime/event-refresh-hints.ts +7 -0
  40. package/src/runtime/field-resolver.ts +341 -0
  41. package/src/runtime/footnote-resolver.ts +55 -0
  42. package/src/runtime/hyperlink-color-resolver.ts +13 -10
  43. package/src/runtime/object-grab/index.ts +51 -0
  44. package/src/runtime/paragraph-style-resolver.ts +105 -0
  45. package/src/runtime/resolved-numbering-geometry.ts +12 -0
  46. package/src/runtime/selection/cursor-ops.ts +186 -15
  47. package/src/runtime/selection/index.ts +17 -1
  48. package/src/runtime/structure-ops/index.ts +77 -0
  49. package/src/runtime/styles-cascade.ts +33 -0
  50. package/src/runtime/surface-projection.ts +186 -12
  51. package/src/runtime/theme-color-resolver.ts +189 -44
  52. package/src/runtime/units.ts +46 -0
  53. package/src/runtime/view-state.ts +13 -2
  54. package/src/ui/WordReviewEditor.tsx +168 -10
  55. package/src/ui/editor-runtime-boundary.ts +94 -1
  56. package/src/ui/editor-shell-view.tsx +1 -1
  57. package/src/ui/runtime-shortcut-dispatch.ts +17 -3
  58. package/src/ui-tailwind/chart/ChartSurface.tsx +36 -10
  59. package/src/ui-tailwind/chart/layout/plot-area.ts +120 -45
  60. package/src/ui-tailwind/chart/render/area.tsx +22 -4
  61. package/src/ui-tailwind/chart/render/bar-column.tsx +37 -11
  62. package/src/ui-tailwind/chart/render/bubble.tsx +6 -2
  63. package/src/ui-tailwind/chart/render/combo.tsx +37 -4
  64. package/src/ui-tailwind/chart/render/line.tsx +28 -5
  65. package/src/ui-tailwind/chart/render/pie.tsx +36 -16
  66. package/src/ui-tailwind/chart/render/progressive-render.ts +8 -1
  67. package/src/ui-tailwind/chart/render/scatter.tsx +9 -4
  68. package/src/ui-tailwind/chrome/avatar-initials.ts +15 -0
  69. package/src/ui-tailwind/chrome/tw-comment-preview.tsx +3 -1
  70. package/src/ui-tailwind/chrome/tw-context-menu.tsx +14 -0
  71. package/src/ui-tailwind/chrome/tw-selection-tool-host.tsx +3 -2
  72. package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +30 -11
  73. package/src/ui-tailwind/chrome/tw-shortcut-hint.tsx +15 -2
  74. package/src/ui-tailwind/chrome/tw-suggestion-card.tsx +1 -1
  75. package/src/ui-tailwind/chrome/tw-table-context-toolbar.tsx +24 -7
  76. package/src/ui-tailwind/chrome/tw-table-grip-layer.tsx +31 -12
  77. package/src/ui-tailwind/chrome-overlay/page-border-resolver.ts +211 -0
  78. package/src/ui-tailwind/chrome-overlay/tw-chrome-overlay.tsx +1 -0
  79. package/src/ui-tailwind/chrome-overlay/tw-comment-balloon-layer.tsx +74 -0
  80. package/src/ui-tailwind/chrome-overlay/tw-locked-block-layer.tsx +65 -0
  81. package/src/ui-tailwind/chrome-overlay/tw-page-border-overlay.tsx +233 -0
  82. package/src/ui-tailwind/chrome-overlay/tw-page-stack-overlay-layer.tsx +135 -13
  83. package/src/ui-tailwind/chrome-overlay/tw-revision-margin-bar-layer.tsx +51 -0
  84. package/src/ui-tailwind/chrome-overlay/tw-scope-card-layer.tsx +12 -4
  85. package/src/ui-tailwind/chrome-overlay/tw-scope-card.tsx +32 -12
  86. package/src/ui-tailwind/chrome-overlay/tw-toc-outline-sidebar.tsx +133 -0
  87. package/src/ui-tailwind/editor-surface/chart-node-view.tsx +49 -10
  88. package/src/ui-tailwind/editor-surface/float-wrap-resolver.ts +119 -0
  89. package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +236 -9
  90. package/src/ui-tailwind/editor-surface/pm-schema.ts +188 -11
  91. package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +28 -2
  92. package/src/ui-tailwind/editor-surface/shape-renderer.ts +206 -0
  93. package/src/ui-tailwind/editor-surface/surface-layer.ts +66 -0
  94. package/src/ui-tailwind/editor-surface/tw-inline-token.tsx +29 -0
  95. package/src/ui-tailwind/editor-surface/tw-segment-view.tsx +7 -1
  96. package/src/ui-tailwind/page-stack/tw-page-stack-chrome-layer.tsx +22 -6
  97. package/src/ui-tailwind/review/tw-comment-sidebar.tsx +10 -16
  98. package/src/ui-tailwind/review/tw-health-panel.tsx +0 -25
  99. package/src/ui-tailwind/review/tw-rail-card.tsx +38 -17
  100. package/src/ui-tailwind/review/tw-review-rail.tsx +2 -2
  101. package/src/ui-tailwind/review/tw-revision-sidebar.tsx +5 -12
  102. package/src/ui-tailwind/review/tw-workflow-tab.tsx +2 -2
  103. package/src/ui-tailwind/theme/editor-theme.css +1 -0
  104. package/src/ui-tailwind/theme/tokens.css +6 -0
  105. package/src/ui-tailwind/theme/tokens.ts +10 -0
  106. package/src/validation/compatibility-engine.ts +2 -0
  107. package/src/validation/docx-comment-proof.ts +12 -3
@@ -87,6 +87,15 @@ export const BRAND_TOKENS = {
87
87
  comment: "#E8F4EC",
88
88
  selection: "#DDF1E4",
89
89
  },
90
+ highlight: {
91
+ // Text-highlighter yellow. User-driven content color (like cell fills
92
+ // and author avatars) — intentionally stable across themes so highlights
93
+ // persist when the document is re-opened under a different theme.
94
+ // Light mode picks Material Amber-A100 for contrast on white canvas;
95
+ // dark mode dims the same chroma (~#B8A829) to avoid glare on dark
96
+ // canvas while keeping the mark recognizably "yellow".
97
+ default: "#FFF59D",
98
+ },
90
99
  scopeTint: {
91
100
  blocked: "#FBE3E6",
92
101
  inScope: "#E2F2E8",
@@ -170,6 +179,7 @@ export type BrandTokenPath =
170
179
  | `color.status.${keyof BrandTokens["color"]["status"]}`
171
180
  | `color.comment.${keyof BrandTokens["color"]["comment"]}`
172
181
  | `color.change.${keyof BrandTokens["color"]["change"]}`
182
+ | `color.highlight.${keyof BrandTokens["color"]["highlight"]}`
173
183
  | `color.scopeTint.${keyof BrandTokens["color"]["scopeTint"]}`
174
184
  | `color.chart.categorical.${keyof BrandTokens["color"]["chart"]["categorical"]}`
175
185
  | `color.chart.sequential.${keyof BrandTokens["color"]["chart"]["sequential"]}`
@@ -444,6 +444,7 @@ function measureInlineNode(
444
444
  flags.hyperlinks = true;
445
445
  return node.children.reduce((size, child) => size + measureInlineNode(child, flags), 0);
446
446
  case "image":
447
+ case "drawing_frame":
447
448
  flags.images = true;
448
449
  flags.runs = true;
449
450
  return 1;
@@ -778,6 +779,7 @@ function collectLossyInlineContent(
778
779
  case "field":
779
780
  case "bookmark_start":
780
781
  case "bookmark_end":
782
+ case "drawing_frame":
781
783
  case "shape":
782
784
  case "wordart":
783
785
  case "vml_shape":
@@ -70,6 +70,7 @@ export type ClosureValidationCheck =
70
70
  | { type: "minCommentThreads"; count: number }
71
71
  | { type: "lockedFragmentCountAtLeast"; count: number }
72
72
  | { type: "surfaceBlockKind"; kind: string; count?: number }
73
+ | { type: "segmentLabelPrefix"; value: string; kind?: string }
73
74
  | { type: "opaqueBlockLabelPrefix"; value: string }
74
75
  | { type: "opaqueInlineLabelPrefix"; value: string }
75
76
  | {
@@ -238,6 +239,12 @@ export function evaluateClosureCheck(
238
239
  (check.count ?? 1),
239
240
  reason: `expected at least ${check.count ?? 1} surface blocks of kind ${check.kind}`,
240
241
  };
242
+ case "segmentLabelPrefix":
243
+ return {
244
+ type: check.type,
245
+ passed: hasSegmentLabelPrefix(context.surface, check.value, check.kind),
246
+ reason: `expected a ${check.kind ?? "surface"} segment label starting with ${check.value}`,
247
+ };
241
248
  case "opaqueBlockLabelPrefix":
242
249
  return {
243
250
  type: check.type,
@@ -253,7 +260,7 @@ export function evaluateClosureCheck(
253
260
  case "opaqueInlineLabelPrefix":
254
261
  return {
255
262
  type: check.type,
256
- passed: hasOpaqueInlineLabelPrefix(context.surface, check.value),
263
+ passed: hasSegmentLabelPrefix(context.surface, check.value, "opaque_inline"),
257
264
  reason: `expected an opaque inline label starting with ${check.value}`,
258
265
  };
259
266
  case "trackedChangeMatch": {
@@ -458,9 +465,10 @@ export function extractDocxCommentProof(bytes: Uint8Array): DocxCommentProof {
458
465
  };
459
466
  }
460
467
 
461
- function hasOpaqueInlineLabelPrefix(
468
+ function hasSegmentLabelPrefix(
462
469
  surface: RuntimeRenderSnapshot["surface"],
463
470
  prefix: string,
471
+ segmentKind?: string,
464
472
  ): boolean {
465
473
  if (!surface) {
466
474
  return false;
@@ -474,7 +482,8 @@ function hasOpaqueInlineLabelPrefix(
474
482
  if (
475
483
  block.segments.some(
476
484
  (segment) =>
477
- segment.kind === "opaque_inline" &&
485
+ (segmentKind === undefined || segment.kind === segmentKind) &&
486
+ "label" in segment &&
478
487
  typeof segment.label === "string" &&
479
488
  segment.label.startsWith(prefix),
480
489
  )