@beyondwork/docx-react-component 1.0.120 → 1.0.122

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 (116) hide show
  1. package/README.md +1 -0
  2. package/dist/api/public-types.cjs +1713 -55
  3. package/dist/api/public-types.d.cts +2 -2
  4. package/dist/api/public-types.d.ts +2 -2
  5. package/dist/api/public-types.js +6 -6
  6. package/dist/api/v3.cjs +4958 -406
  7. package/dist/api/v3.d.cts +3 -3
  8. package/dist/api/v3.d.ts +3 -3
  9. package/dist/api/v3.js +14 -14
  10. package/dist/{canonical-document-fNawStsc.d.cts → canonical-document-ByIqTd4s.d.cts} +9 -1
  11. package/dist/{canonical-document-fNawStsc.d.ts → canonical-document-ByIqTd4s.d.ts} +9 -1
  12. package/dist/{chunk-5RNMPLXU.js → chunk-37SEJQ3G.js} +4 -4
  13. package/dist/{chunk-FXGQM2JB.js → chunk-3OFSP2IX.js} +11 -5
  14. package/dist/{chunk-U5BSQXF4.js → chunk-3OHVK2D6.js} +70 -12
  15. package/dist/{chunk-AUQDC5BD.js → chunk-3TUQCHYT.js} +101 -2
  16. package/dist/{chunk-SJSMYEMU.js → chunk-B4YHWFE3.js} +3 -3
  17. package/dist/{chunk-XC56YLIS.js → chunk-C2LWJ4CZ.js} +4 -0
  18. package/dist/{chunk-VDIUVT46.js → chunk-CX42VC67.js} +1 -1
  19. package/dist/{chunk-KCHEAX4Z.js → chunk-EMDH4IQN.js} +148 -70
  20. package/dist/{chunk-TMQGWF7R.js → chunk-G3B2OBCZ.js} +352 -17
  21. package/dist/{chunk-VCL5MJMZ.js → chunk-GON2DNTE.js} +149 -28
  22. package/dist/{chunk-WVZX4NYG.js → chunk-GZW2ERUO.js} +601 -47
  23. package/dist/{chunk-WDNEPRFW.js → chunk-ICX54W4U.js} +1 -1
  24. package/dist/{chunk-FIGWJ43K.js → chunk-IT2DK3A7.js} +1883 -90
  25. package/dist/{chunk-2ZWFQ74R.js → chunk-OBCP6VTG.js} +1 -1
  26. package/dist/{chunk-FLNQY74K.js → chunk-OYGMRRR7.js} +1 -1
  27. package/dist/{chunk-MPYYBRVN.js → chunk-PCXTMEGY.js} +782 -124
  28. package/dist/{chunk-4JNUMMM7.js → chunk-PGGPPZ65.js} +17 -2
  29. package/dist/{chunk-KHZNNBTN.js → chunk-QFU7ZOAD.js} +43 -39
  30. package/dist/{chunk-4ZNQFWFM.js → chunk-QIO6V46H.js} +84 -4
  31. package/dist/{chunk-IQ2VJEF6.js → chunk-QNGJRZ2D.js} +1 -1
  32. package/dist/{chunk-BM5NSDII.js → chunk-S4ANOS2M.js} +2 -2
  33. package/dist/{chunk-AQA7OZ2R.js → chunk-TFSXOIAI.js} +959 -43
  34. package/dist/{chunk-NQZUGMLW.js → chunk-TMU7JMXX.js} +184 -32
  35. package/dist/{chunk-KD5K5XIA.js → chunk-UHQOUTAX.js} +568 -88
  36. package/dist/{chunk-327AIUXL.js → chunk-UWDWGQH5.js} +11 -4
  37. package/dist/{chunk-BBB4GSDB.js → chunk-XVFENXLK.js} +2 -2
  38. package/dist/{chunk-MUEN2WOG.js → chunk-ZKSDVHGH.js} +6 -3
  39. package/dist/compare.cjs +17 -2
  40. package/dist/compare.d.cts +1 -1
  41. package/dist/compare.d.ts +1 -1
  42. package/dist/compare.js +3 -3
  43. package/dist/core/commands/formatting-commands.d.cts +2 -2
  44. package/dist/core/commands/formatting-commands.d.ts +2 -2
  45. package/dist/core/commands/image-commands.cjs +814 -45
  46. package/dist/core/commands/image-commands.d.cts +2 -2
  47. package/dist/core/commands/image-commands.d.ts +2 -2
  48. package/dist/core/commands/image-commands.js +8 -8
  49. package/dist/core/commands/section-layout-commands.d.cts +2 -2
  50. package/dist/core/commands/section-layout-commands.d.ts +2 -2
  51. package/dist/core/commands/style-commands.d.cts +2 -2
  52. package/dist/core/commands/style-commands.d.ts +2 -2
  53. package/dist/core/commands/table-structure-commands.cjs +750 -42
  54. package/dist/core/commands/table-structure-commands.d.cts +2 -2
  55. package/dist/core/commands/table-structure-commands.d.ts +2 -2
  56. package/dist/core/commands/table-structure-commands.js +6 -6
  57. package/dist/core/commands/text-commands.cjs +910 -57
  58. package/dist/core/commands/text-commands.d.cts +2 -2
  59. package/dist/core/commands/text-commands.d.ts +2 -2
  60. package/dist/core/commands/text-commands.js +8 -8
  61. package/dist/core/selection/mapping.d.cts +2 -2
  62. package/dist/core/selection/mapping.d.ts +2 -2
  63. package/dist/core/state/editor-state.cjs +17 -2
  64. package/dist/core/state/editor-state.d.cts +2 -2
  65. package/dist/core/state/editor-state.d.ts +2 -2
  66. package/dist/core/state/editor-state.js +2 -2
  67. package/dist/index.cjs +6203 -625
  68. package/dist/index.d.cts +5 -5
  69. package/dist/index.d.ts +5 -5
  70. package/dist/index.js +299 -67
  71. package/dist/io/docx-session.cjs +354 -102
  72. package/dist/io/docx-session.d.cts +4 -4
  73. package/dist/io/docx-session.d.ts +4 -4
  74. package/dist/io/docx-session.js +5 -5
  75. package/dist/legal.cjs +183 -31
  76. package/dist/legal.d.cts +1 -1
  77. package/dist/legal.d.ts +1 -1
  78. package/dist/legal.js +3 -3
  79. package/dist/{loader-CaohrhNl.d.ts → loader-BF8ju_LK.d.ts} +22 -4
  80. package/dist/{loader-BpCyGnZl.d.cts → loader-g54WRvj1.d.cts} +22 -4
  81. package/dist/{public-types-Dpch9JG0.d.cts → public-types-D_y4Ptcj.d.cts} +747 -21
  82. package/dist/{public-types-C948HNVF.d.ts → public-types-Dl1jiWjk.d.ts} +747 -21
  83. package/dist/public-types.cjs +1713 -55
  84. package/dist/public-types.d.cts +2 -2
  85. package/dist/public-types.d.ts +2 -2
  86. package/dist/public-types.js +6 -6
  87. package/dist/runtime/collab.cjs +4 -0
  88. package/dist/runtime/collab.d.cts +3 -3
  89. package/dist/runtime/collab.d.ts +3 -3
  90. package/dist/runtime/collab.js +2 -2
  91. package/dist/runtime/document-runtime.cjs +3699 -507
  92. package/dist/runtime/document-runtime.d.cts +2 -2
  93. package/dist/runtime/document-runtime.d.ts +2 -2
  94. package/dist/runtime/document-runtime.js +18 -18
  95. package/dist/{session-Dqg17V3s.d.ts → session-C1EPAkcI.d.ts} +3 -3
  96. package/dist/{session-BlXE5zxz.d.cts → session-D15QOO0Q.d.cts} +3 -3
  97. package/dist/session.cjs +951 -104
  98. package/dist/session.d.cts +5 -5
  99. package/dist/session.d.ts +5 -5
  100. package/dist/session.js +10 -8
  101. package/dist/tailwind.cjs +1752 -91
  102. package/dist/tailwind.d.cts +2 -2
  103. package/dist/tailwind.d.ts +2 -2
  104. package/dist/tailwind.js +10 -10
  105. package/dist/{types-C9vZVpKy.d.cts → types-BoSRp2Vg.d.cts} +2 -2
  106. package/dist/{types-B1tlF1bq.d.ts → types-DEvRwq9C.d.ts} +2 -2
  107. package/dist/ui-tailwind/editor-surface/search-plugin.d.cts +3 -3
  108. package/dist/ui-tailwind/editor-surface/search-plugin.d.ts +3 -3
  109. package/dist/ui-tailwind/editor-surface/search-plugin.js +7 -7
  110. package/dist/ui-tailwind/theme/editor-theme.css +5 -5
  111. package/dist/ui-tailwind.cjs +1752 -91
  112. package/dist/ui-tailwind.d.cts +8 -8
  113. package/dist/ui-tailwind.d.ts +8 -8
  114. package/dist/ui-tailwind.js +10 -10
  115. package/package.json +17 -5
  116. package/dist/ui-tailwind/theme/tokens.css +0 -382
@@ -642,6 +642,9 @@ function validateDocumentNode(value, path, issues, context = "root") {
642
642
  }
643
643
  return;
644
644
  case "table_row":
645
+ if (record.sourceRef !== void 0) {
646
+ validateCanonicalSourceRef(record.sourceRef, `${path}.sourceRef`, issues);
647
+ }
645
648
  if (!Array.isArray(record.cells)) {
646
649
  issues.push({ path: `${path}.cells`, message: "cells must be an array." });
647
650
  } else {
@@ -651,6 +654,9 @@ function validateDocumentNode(value, path, issues, context = "root") {
651
654
  }
652
655
  return;
653
656
  case "table_cell":
657
+ if (record.sourceRef !== void 0) {
658
+ validateCanonicalSourceRef(record.sourceRef, `${path}.sourceRef`, issues);
659
+ }
654
660
  if (!Array.isArray(record.children)) {
655
661
  issues.push({ path: `${path}.children`, message: "children must be an array." });
656
662
  } else {
@@ -681,9 +687,15 @@ function validateDocumentNode(value, path, issues, context = "root") {
681
687
  case "bookmark_start":
682
688
  expectString(record.bookmarkId, `${path}.bookmarkId`, issues);
683
689
  expectString(record.name, `${path}.name`, issues);
690
+ if (record.sourceRef !== void 0) {
691
+ validateCanonicalSourceRef(record.sourceRef, `${path}.sourceRef`, issues);
692
+ }
684
693
  return;
685
694
  case "bookmark_end":
686
695
  expectString(record.bookmarkId, `${path}.bookmarkId`, issues);
696
+ if (record.sourceRef !== void 0) {
697
+ validateCanonicalSourceRef(record.sourceRef, `${path}.sourceRef`, issues);
698
+ }
687
699
  return;
688
700
  case "scope_marker_start":
689
701
  case "scope_marker_end":
@@ -784,6 +796,9 @@ function validateDocumentNode(value, path, issues, context = "root") {
784
796
  return;
785
797
  }
786
798
  case "ole_embed":
799
+ if (record.sourceRef !== void 0) {
800
+ validateCanonicalSourceRef(record.sourceRef, `${path}.sourceRef`, issues);
801
+ }
787
802
  expectString(record.id, `${path}.id`, issues);
788
803
  expectString(record.relationshipId, `${path}.relationshipId`, issues);
789
804
  expectString(record.rawXml, `${path}.rawXml`, issues);
@@ -912,12 +927,12 @@ function validateCanonicalSourceRef(value, path, issues) {
912
927
  return;
913
928
  }
914
929
  expectString(record.sourceId, `${path}.sourceId`, issues);
915
- for (const key of ["partPath", "storyKind", "element"]) {
930
+ for (const key of ["partPath", "storyKind", "element", "xmlPath", "tableCellPath"]) {
916
931
  if (record[key] !== void 0) {
917
932
  expectString(record[key], `${path}.${key}`, issues);
918
933
  }
919
934
  }
920
- for (const key of ["ordinal", "startOffset", "endOffset"]) {
935
+ for (const key of ["ordinal", "startOffset", "endOffset", "tableDepth"]) {
921
936
  if (record[key] !== void 0 && (!Number.isInteger(record[key]) || record[key] < 0)) {
922
937
  issues.push({
923
938
  path: `${path}.${key}`,
@@ -2,7 +2,7 @@ import {
2
2
  incrementInvalidationCounter,
3
3
  recordPerfSample,
4
4
  resolvePageOverlayRectsFromGeometry
5
- } from "./chunk-WVZX4NYG.js";
5
+ } from "./chunk-GZW2ERUO.js";
6
6
  import {
7
7
  buildPageAnchorAttributes,
8
8
  buildPageAnchorSelector,
@@ -10,7 +10,7 @@ import {
10
10
  resolveChromePreset,
11
11
  resolveChromePresetOptions,
12
12
  resolveChromeVisibilityForPreset
13
- } from "./chunk-VCL5MJMZ.js";
13
+ } from "./chunk-GON2DNTE.js";
14
14
  import {
15
15
  DEFAULT_PAGE_ESTIMATE_PX_PER_TWIP,
16
16
  DEFAULT_PX_PER_TWIP,
@@ -20,23 +20,23 @@ import {
20
20
  findPageForOffset,
21
21
  getUsableColumnWidth,
22
22
  sanitizeMarkdown
23
- } from "./chunk-TMQGWF7R.js";
23
+ } from "./chunk-G3B2OBCZ.js";
24
24
  import {
25
25
  createCanvasBackend
26
26
  } from "./chunk-KFCQYZXR.js";
27
27
  import {
28
28
  storyTargetKey
29
- } from "./chunk-AUQDC5BD.js";
29
+ } from "./chunk-3TUQCHYT.js";
30
30
  import {
31
31
  EMU_PER_INCH,
32
32
  EMU_PER_PX,
33
33
  ROTATION_UNITS_PER_DEGREE,
34
34
  TWIPS_PER_PX
35
- } from "./chunk-AQA7OZ2R.js";
35
+ } from "./chunk-TFSXOIAI.js";
36
36
  import {
37
37
  createPublicNodeAnchor,
38
38
  createPublicRangeAnchor
39
- } from "./chunk-4JNUMMM7.js";
39
+ } from "./chunk-PGGPPZ65.js";
40
40
 
41
41
  // src/ui/headless/chrome-registry.ts
42
42
  var ALL_ROLES = ["editor", "review", "workflow"];
@@ -754,8 +754,8 @@ function TwToolbarIconButton(props) {
754
754
  "transition-colors duration-[var(--motion-fast)]",
755
755
  "disabled:opacity-30 disabled:cursor-not-allowed",
756
756
  props.active ? (
757
- // Active = underline-tint grammar: accent-soft fill, accent-primary glyph, accent border ring.
758
- "bg-[var(--color-accent-soft)] text-[var(--color-accent-primary)] border-[var(--color-border-accent)]"
757
+ // Active = neutral elevated surface + accent glyph + accent border. No mint fill.
758
+ "bg-[var(--color-bg-elevated)] text-[var(--color-accent-primary)] border-[var(--color-border-accent)]"
759
759
  ) : props.emphasis ? "text-[var(--color-accent-primary)] hover:bg-[var(--color-bg-hover)] hover:border-[var(--color-border-subtle)]" : "text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-text-primary)] hover:border-[var(--color-border-subtle)]",
760
760
  focusRingClass
761
761
  ].join(" "),
@@ -1884,7 +1884,7 @@ function TwToolbar(props) {
1884
1884
  },
1885
1885
  className: [
1886
1886
  "shrink-0 rounded-[var(--radius-sm)] border border-[var(--color-border-subtle)]",
1887
- "bg-[var(--color-bg-chrome)]/92 px-2.5 shadow-[var(--shadow-soft)] backdrop-blur-sm",
1887
+ "bg-[var(--color-bg-chrome)] px-2.5",
1888
1888
  isCompact ? "flex min-h-10 flex-wrap items-center gap-1.5 py-1.5" : "flex items-center gap-1"
1889
1889
  ].join(" "),
1890
1890
  children: [
@@ -4022,29 +4022,29 @@ import { Baseline as Baseline2, Bold as Bold2, Highlighter as Highlighter3, Ital
4022
4022
  var BRAND_TOKENS = {
4023
4023
  color: {
4024
4024
  bg: {
4025
- app: "#F4F7F5",
4026
- chrome: "#FAFCFA",
4027
- sidebar: "#F1F6F2",
4025
+ app: "#F6F6F6",
4026
+ chrome: "#FBFBFB",
4027
+ sidebar: "#F4F4F4",
4028
4028
  canvas: "#FFFFFF",
4029
4029
  elevated: "#FFFFFF",
4030
- hover: "#EAF6EF",
4031
- selected: "#E2F2E8",
4032
- muted: "#F7FAF8",
4033
- overlay: "rgba(21, 26, 23, 0.08)"
4030
+ hover: "#F0F0F0",
4031
+ selected: "#E8E8E8",
4032
+ muted: "#F5F5F5",
4033
+ overlay: "rgba(17, 17, 17, 0.10)"
4034
4034
  },
4035
4035
  border: {
4036
- subtle: "#E2EAE4",
4037
- default: "#D3DED6",
4038
- strong: "#BECDBF",
4036
+ subtle: "#E6E6E6",
4037
+ default: "#D6D6D6",
4038
+ strong: "#BFBFBF",
4039
4039
  accent: "#8FC9AD"
4040
4040
  },
4041
4041
  text: {
4042
- primary: "#151A17",
4043
- secondary: "#5E6D63",
4044
- tertiary: "#8A978F",
4045
- quiet: "#A4AEA8",
4046
- inverse: "#F7FAF8",
4047
- onAccent: "#F7FAF8",
4042
+ primary: "#111111",
4043
+ secondary: "#555555",
4044
+ tertiary: "#888888",
4045
+ quiet: "#A8A8A8",
4046
+ inverse: "#FAFAFA",
4047
+ onAccent: "#FAFAFA",
4048
4048
  onSoftAccent: "#18563F"
4049
4049
  },
4050
4050
  accent: {
@@ -4292,7 +4292,7 @@ function ToolbarActionButton(props) {
4292
4292
  disabled: props.disabled,
4293
4293
  onMouseDown: preserveEditorSelectionMouseDown,
4294
4294
  onClick: props.onClick,
4295
- className: `inline-flex h-[30px] w-[30px] items-center justify-center rounded-[8px] transition-colors duration-[var(--motion-fast)] disabled:cursor-not-allowed disabled:opacity-40 ${props.pressed ? "bg-[var(--color-accent-soft)] text-[var(--color-text-on-soft-accent)]" : "text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-text-primary)]"} ${focusRingClass3}`,
4295
+ className: `inline-flex h-[30px] w-[30px] items-center justify-center rounded-[8px] border transition-colors duration-[var(--motion-fast)] disabled:cursor-not-allowed disabled:opacity-40 ${props.pressed ? "border-[var(--color-border-accent)] bg-[var(--color-bg-elevated)] text-[var(--color-accent-primary)]" : "border-transparent text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] hover:text-[var(--color-text-primary)]"} ${focusRingClass3}`,
4296
4296
  children: props.icon
4297
4297
  }
4298
4298
  ) }),
@@ -5743,7 +5743,7 @@ import * as Tabs from "@radix-ui/react-tabs";
5743
5743
  import * as ScrollArea from "@radix-ui/react-scroll-area";
5744
5744
  import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
5745
5745
  var focusRingClass9 = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-canvas";
5746
- var PILL_TRIGGER_CLASS = `flex-1 rounded-[var(--radius-md)] px-3 py-1.5 text-xs font-medium text-[var(--color-text-tertiary)] transition-colors data-[state=active]:bg-[var(--color-bg-selected)] data-[state=active]:text-[var(--color-text-primary)] outline-none ${focusRingClass9}`;
5746
+ var PILL_TRIGGER_CLASS = `flex-1 px-3 py-1.5 text-xs font-medium text-[var(--color-text-tertiary)] border-b-2 border-transparent transition-colors data-[state=active]:border-[var(--color-accent-primary)] data-[state=active]:text-[var(--color-text-primary)] data-[state=active]:font-semibold outline-none ${focusRingClass9}`;
5747
5747
  var UNDERLINE_TRIGGER_CLASS = `flex items-center gap-1.5 px-3 py-2 text-xs font-medium text-[var(--color-text-tertiary)] border-b-2 border-transparent transition-colors data-[state=active]:border-[var(--color-accent-primary)] data-[state=active]:text-[var(--color-text-primary)] outline-none ${focusRingClass9}`;
5748
5748
  function TwReviewRail(props) {
5749
5749
  const variant = props.variant ?? "docked";
@@ -5762,7 +5762,7 @@ function TwReviewRail(props) {
5762
5762
  "data-wre-drawer": variant === "drawer" ? "true" : "false",
5763
5763
  "data-editorial-header": editorial ? "true" : "false",
5764
5764
  className: [
5765
- "flex flex-col border-l border-[var(--color-border-subtle)]/60 bg-[var(--color-bg-sidebar)]",
5765
+ "flex flex-col border-l border-[var(--color-border-subtle)] bg-[var(--color-bg-chrome)]",
5766
5766
  variant === "drawer" ? `h-full ${drawerWidthClass} max-w-full shrink-0 shadow-[var(--shadow-float)]` : `${widthClass} shrink-0`
5767
5767
  ].join(" "),
5768
5768
  children: [
@@ -6316,7 +6316,7 @@ function TwCommandPalette(props) {
6316
6316
  "text-sm",
6317
6317
  "transition-colors duration-[var(--motion-fast)]",
6318
6318
  "disabled:opacity-40 disabled:cursor-not-allowed",
6319
- isActive ? "bg-[var(--color-accent-soft)] text-[var(--color-accent-primary)]" : "text-[var(--color-text-primary)] hover:bg-[var(--color-bg-hover)]"
6319
+ isActive ? "bg-[var(--color-bg-hover)] text-[var(--color-text-primary)] font-medium" : "text-[var(--color-text-primary)] hover:bg-[var(--color-bg-hover)]"
6320
6320
  ].join(" "),
6321
6321
  children: [
6322
6322
  cmd.icon ? /* @__PURE__ */ jsx24(
@@ -10103,9 +10103,9 @@ function TwImageContextToolbar(props) {
10103
10103
  widthEmu: preset.widthEmu,
10104
10104
  heightEmu: preset.heightEmu
10105
10105
  }),
10106
- className: `inline-flex h-6 items-center px-2 text-[length:var(--text-xs)] font-medium rounded-[var(--radius-sm)] transition-colors disabled:cursor-not-allowed disabled:opacity-40
10107
- aria-pressed:bg-[var(--color-bg-selected)] aria-pressed:text-[var(--color-accent-primary)]
10108
- text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)]`,
10106
+ className: `inline-flex h-6 items-center px-2 text-[length:var(--text-xs)] font-medium rounded-[var(--radius-sm)] border border-transparent transition-colors disabled:cursor-not-allowed disabled:opacity-40
10107
+ aria-pressed:border-[var(--color-border-accent)] aria-pressed:text-[var(--color-accent-primary)]
10108
+ text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] hover:bg-[var(--color-bg-hover)]`,
10109
10109
  children: shortLabel
10110
10110
  },
10111
10111
  preset.label
@@ -10170,7 +10170,7 @@ function ToolbarButton(props) {
10170
10170
  disabled: props.disabled,
10171
10171
  onMouseDown: preserveEditorSelectionMouseDown,
10172
10172
  onClick: props.onClick,
10173
- className: "inline-flex h-7 items-center rounded-md px-2 text-[length:var(--text-xs)] font-medium text-[var(--color-text-primary)] transition-colors hover:bg-[var(--color-accent-soft)] disabled:cursor-not-allowed disabled:opacity-40",
10173
+ className: "inline-flex h-7 items-center rounded-md px-2 text-[length:var(--text-xs)] font-medium text-[var(--color-text-primary)] transition-colors hover:bg-[var(--color-bg-hover)] disabled:cursor-not-allowed disabled:opacity-40",
10174
10174
  children: props.children
10175
10175
  }
10176
10176
  );
@@ -14378,7 +14378,9 @@ function resolveBlockRangeFromOffsetSpan(input) {
14378
14378
  const block = blocks[index];
14379
14379
  if (!block) continue;
14380
14380
  if (block.from >= endOffset) break;
14381
- if (block.from < endOffset && block.to > startOffset) {
14381
+ const intersectsSpan = block.from < endOffset && block.to > startOffset;
14382
+ const zeroWidthInsideSpan = block.from === block.to && block.from >= startOffset && block.from < endOffset;
14383
+ if (intersectsSpan || zeroWidthInsideSpan) {
14382
14384
  if (first < 0) first = index;
14383
14385
  last = index;
14384
14386
  }
@@ -16380,7 +16382,7 @@ var TwActiveBandRibbon = React29.memo(({
16380
16382
  pointerEvents: "auto",
16381
16383
  zIndex: 2
16382
16384
  },
16383
- className: "flex flex-col gap-1 rounded-md border border-border/50 bg-canvas/95 px-2 py-1 shadow-sm backdrop-blur-sm",
16385
+ className: "flex flex-col gap-1 rounded-md border border-border bg-canvas px-2 py-1 shadow-sm",
16384
16386
  children: [
16385
16387
  /* @__PURE__ */ jsxs44("div", { className: "flex flex-wrap items-center gap-1", children: [
16386
16388
  /* @__PURE__ */ jsxs44("span", { className: "text-[10px] font-semibold uppercase tracking-[var(--tracking-status)] text-tertiary", children: [
@@ -18528,20 +18530,22 @@ var noopModeChange = (_scopeId, _mode) => void 0;
18528
18530
  var noopIssueAction = (_scopeId, _issueId, _action) => void 0;
18529
18531
 
18530
18532
  // src/ui/headless/selection-helpers.ts
18531
- function createSelectionSnapshot(anchor, head = anchor) {
18533
+ function createSelectionSnapshot(anchor, head = anchor, editableTarget) {
18532
18534
  return {
18533
18535
  anchor,
18534
18536
  head,
18535
18537
  isCollapsed: anchor === head,
18536
- activeRange: createPublicRangeAnchor(anchor, head)
18538
+ activeRange: createPublicRangeAnchor(anchor, head),
18539
+ ...editableTarget ? { editableTarget } : {}
18537
18540
  };
18538
18541
  }
18539
- function createNodeSelectionSnapshot(at, assoc = 1) {
18542
+ function createNodeSelectionSnapshot(at, assoc = 1, editableTarget) {
18540
18543
  return {
18541
18544
  anchor: at,
18542
18545
  head: at,
18543
18546
  isCollapsed: true,
18544
- activeRange: createPublicNodeAnchor(at, assoc)
18547
+ activeRange: createPublicNodeAnchor(at, assoc),
18548
+ ...editableTarget ? { editableTarget } : {}
18545
18549
  };
18546
18550
  }
18547
18551
  function selectionTouchesRange(selection, from, to) {
@@ -41,7 +41,7 @@ function parseTextStory(content) {
41
41
  function countLogicalPositions(units) {
42
42
  let size = 0;
43
43
  for (const unit of units) {
44
- if (unit.kind !== "scope_marker") size += 1;
44
+ size += unitLogicalSize(unit);
45
45
  }
46
46
  return size;
47
47
  }
@@ -53,11 +53,15 @@ function logicalPositionToUnitIndex(units, logicalPos, startBias = "after") {
53
53
  return unitIndex;
54
54
  }
55
55
  const unit = units[unitIndex];
56
- if (unit.kind !== "scope_marker") {
56
+ const unitSize = unitLogicalSize(unit);
57
+ if (unitSize > 0) {
57
58
  if (logicalCursor === logicalPos && startBias === "after") {
58
59
  return unitIndex;
59
60
  }
60
- logicalCursor += 1;
61
+ if (logicalPos > logicalCursor && logicalPos < logicalCursor + unitSize) {
62
+ return unitIndex;
63
+ }
64
+ logicalCursor += unitSize;
61
65
  }
62
66
  unitIndex += 1;
63
67
  }
@@ -191,6 +195,9 @@ function serializeTextStory(story) {
191
195
  warningId: unit.warningId
192
196
  });
193
197
  break;
198
+ case "protected_inline":
199
+ pushInlineNode(structuredClone(unit.node));
200
+ break;
194
201
  case "scope_marker":
195
202
  pushInlineNode({
196
203
  type: unit.boundary === "start" ? "scope_marker_start" : "scope_marker_end",
@@ -223,6 +230,8 @@ function createPlainText(story) {
223
230
  return "\uFFFC";
224
231
  case "opaque_inline":
225
232
  return "\uFFF9";
233
+ case "protected_inline":
234
+ return protectedInlineText(unit.node);
226
235
  case "opaque_block":
227
236
  return "\uFFFA";
228
237
  case "structural_block":
@@ -263,6 +272,13 @@ function cloneStoryUnit(unit) {
263
272
  fragmentId: unit.fragmentId,
264
273
  warningId: unit.warningId
265
274
  };
275
+ case "protected_inline":
276
+ return {
277
+ kind: "protected_inline",
278
+ node: structuredClone(unit.node),
279
+ logicalSize: unit.logicalSize,
280
+ reason: unit.reason
281
+ };
266
282
  case "opaque_block":
267
283
  return {
268
284
  kind: "opaque_block",
@@ -345,7 +361,29 @@ function flattenInlineNodes(nodes, hyperlinkHref) {
345
361
  });
346
362
  break;
347
363
  case "hyperlink":
348
- units.push(...flattenInlineNodes(node.children, node.href));
364
+ units.push({
365
+ kind: "protected_inline",
366
+ node: structuredClone(node),
367
+ logicalSize: inlineLogicalLength(node),
368
+ reason: "hyperlink"
369
+ });
370
+ break;
371
+ case "field":
372
+ units.push({
373
+ kind: "protected_inline",
374
+ node: structuredClone(node),
375
+ logicalSize: inlineLogicalLength(node),
376
+ reason: "field"
377
+ });
378
+ break;
379
+ case "bookmark_start":
380
+ case "bookmark_end":
381
+ units.push({
382
+ kind: "protected_inline",
383
+ node: structuredClone(node),
384
+ logicalSize: 0,
385
+ reason: "bookmark"
386
+ });
349
387
  break;
350
388
  case "image":
351
389
  units.push({
@@ -379,6 +417,48 @@ function flattenInlineNodes(nodes, hyperlinkHref) {
379
417
  }
380
418
  return units;
381
419
  }
420
+ function unitLogicalSize(unit) {
421
+ switch (unit.kind) {
422
+ case "scope_marker":
423
+ return 0;
424
+ case "protected_inline":
425
+ return unit.logicalSize;
426
+ default:
427
+ return 1;
428
+ }
429
+ }
430
+ function inlineLogicalLength(node) {
431
+ switch (node.type) {
432
+ case "text":
433
+ return Array.from(node.text).length;
434
+ case "hyperlink":
435
+ case "field":
436
+ return node.children.reduce((total, child) => total + inlineLogicalLength(child), 0);
437
+ case "bookmark_start":
438
+ case "bookmark_end":
439
+ case "scope_marker_start":
440
+ case "scope_marker_end":
441
+ return 0;
442
+ default:
443
+ return 1;
444
+ }
445
+ }
446
+ function protectedInlineText(node) {
447
+ switch (node.type) {
448
+ case "text":
449
+ return node.text;
450
+ case "hyperlink":
451
+ case "field":
452
+ return node.children.map((child) => protectedInlineText(child)).join("");
453
+ case "bookmark_start":
454
+ case "bookmark_end":
455
+ case "scope_marker_start":
456
+ case "scope_marker_end":
457
+ return "";
458
+ default:
459
+ return "\uFFF9";
460
+ }
461
+ }
382
462
  function extractParagraphProperties(paragraph) {
383
463
  return {
384
464
  ...paragraph.styleId ? { styleId: paragraph.styleId } : {},
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildSearchPattern
3
- } from "./chunk-TMQGWF7R.js";
3
+ } from "./chunk-G3B2OBCZ.js";
4
4
 
5
5
  // src/ui-tailwind/editor-surface/search-plugin.ts
6
6
  import { Plugin, PluginKey } from "prosemirror-state";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  loadDocxSessionAsync
3
- } from "./chunk-KCHEAX4Z.js";
3
+ } from "./chunk-EMDH4IQN.js";
4
4
  import {
5
5
  buildCompatibilityReport,
6
6
  createLoadScheduler
7
- } from "./chunk-327AIUXL.js";
7
+ } from "./chunk-UWDWGQH5.js";
8
8
  import {
9
9
  decodePersistedSourcePackageBytes,
10
10
  hasValidPersistedSourcePackageDigest,