@docx-editor.dev/core 2.14.0 → 2.15.0

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 (133) hide show
  1. package/README.md +42 -0
  2. package/dist/automation.cjs +1 -1
  3. package/dist/automation.d.ts +6 -5
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.ts +16 -10
  7. package/dist/binding.js +1 -1
  8. package/dist/chunk-24APKZAN.cjs +11 -0
  9. package/dist/chunk-2YH4MSHX.cjs +2 -0
  10. package/dist/chunk-5Y7AADI6.js +1 -0
  11. package/dist/chunk-AREFLNUP.js +11 -0
  12. package/dist/chunk-AS7YZNQE.cjs +2 -0
  13. package/dist/chunk-AVGCKH6A.cjs +20 -0
  14. package/dist/chunk-CDYVDQRI.cjs +5 -0
  15. package/dist/chunk-FGBADUSK.cjs +1 -0
  16. package/dist/chunk-HOEWFH5U.cjs +1 -0
  17. package/dist/chunk-KFELX7CN.js +2 -0
  18. package/dist/{chunk-OKEDGR65.js → chunk-KXPVOPR5.js} +1 -1
  19. package/dist/chunk-LGFKIF4M.cjs +1 -0
  20. package/dist/chunk-M52QXFKI.js +1 -0
  21. package/dist/chunk-MNUKSXRO.js +1 -0
  22. package/dist/chunk-PBOIGBDO.js +2 -0
  23. package/dist/chunk-PMHGONET.cjs +1 -0
  24. package/dist/chunk-PXKZUTHX.cjs +2 -0
  25. package/dist/chunk-Q4AB7E4O.cjs +1 -0
  26. package/dist/chunk-QJYH6AYD.js +1 -0
  27. package/dist/chunk-QRC37MWG.cjs +20 -0
  28. package/dist/chunk-RJSB6RJ7.js +20 -0
  29. package/dist/chunk-SB54HLFJ.js +20 -0
  30. package/dist/chunk-VP7SDFCM.js +1 -0
  31. package/dist/chunk-XCESLTJL.js +2 -0
  32. package/dist/{chunk-KIAP7PFQ.cjs → chunk-YL4Q5LZP.cjs} +1 -1
  33. package/dist/chunk-Z4527AXR.js +5 -0
  34. package/dist/collaboration/replication.cjs +1 -1
  35. package/dist/collaboration/replication.d.ts +4 -3
  36. package/dist/collaboration/replication.js +1 -1
  37. package/dist/collaboration.d.ts +4 -3
  38. package/dist/contracts/editor.d.ts +7 -7
  39. package/dist/contracts/interaction.d.ts +7 -7
  40. package/dist/contracts/modules.d.ts +8 -7
  41. package/dist/{custom-node-writes-DntmaAVW.d.ts → custom-node-writes-C9ArIlJh.d.ts} +2 -2
  42. package/dist/{editor-a6VvsfYU.d.ts → editor-sRxrFJd8.d.ts} +29 -21
  43. package/dist/editor.cjs +1 -1
  44. package/dist/editor.d.ts +27 -58
  45. package/dist/editor.js +1 -1
  46. package/dist/export.cjs +2 -0
  47. package/dist/export.d.ts +337 -0
  48. package/dist/export.js +2 -0
  49. package/dist/font-resolver-BYEHQGTw.d.ts +251 -0
  50. package/dist/headless-document-view-DELC4E5v.d.ts +134 -0
  51. package/dist/hf-references-DTrHkktY.d.ts +70 -0
  52. package/dist/{index-C5ZnSRkF.d.ts → index-C3Gvq4jN.d.ts} +55 -246
  53. package/dist/index.cjs +1 -1
  54. package/dist/index.d.ts +18 -16
  55. package/dist/index.js +1 -1
  56. package/dist/{shaped-measurer-CFPnXFs9.d.cts → layout-shaping-DoGR5cf8.d.ts} +86 -12
  57. package/dist/layout.cjs +1 -1
  58. package/dist/layout.d.ts +1106 -729
  59. package/dist/layout.js +1 -1
  60. package/dist/{note-properties-CDFiNXcD.d.ts → note-properties-DSe8igrz.d.ts} +2 -2
  61. package/dist/{omml-equation-BY49UOIF.d.ts → omml-equation-BpRmfDAf.d.ts} +1 -1
  62. package/dist/output.cjs +1 -1
  63. package/dist/output.d.ts +6 -6
  64. package/dist/output.js +1 -1
  65. package/dist/{protocol-gOY5GA8K.d.cts → protocol-DZzKxH5r.d.ts} +18 -12
  66. package/dist/{review-items-CCS1h93f.d.ts → review-items-DYRx187i.d.ts} +2 -2
  67. package/dist/{review-reads-BjZYeMd4.d.ts → review-reads-LbGUdNzn.d.ts} +22 -25
  68. package/dist/{revision-projection-BeXVrSSV.d.ts → revision-projection-DHRJH48u.d.ts} +1 -1
  69. package/dist/{semantic-cell-selection-BK91NCCG.d.ts → semantic-cell-selection-BXVWCBYm.d.ts} +4 -4
  70. package/dist/{semantic-interaction-BmQ7h2cq.d.ts → semantic-interaction-DZsDmPg5.d.ts} +1 -1
  71. package/dist/{semantic-paint-WJD2KeG1.d.ts → semantic-paint-f7SqN4oW.d.ts} +2 -2
  72. package/dist/{semantic-records-BpozY7-j.d.cts → semantic-records-EIdwId-a.d.ts} +301 -205
  73. package/dist/store.cjs +1 -1
  74. package/dist/store.d.ts +15 -65
  75. package/dist/store.js +1 -1
  76. package/dist/{tree-op-types-D6HzlPR4.d.ts → tree-op-types-egdarvH_.d.ts} +7 -3
  77. package/dist/{tree-package-fragment-CWFjgH6a.d.ts → tree-package-fragment-DjkH4ESI.d.ts} +4 -70
  78. package/dist/{tree-session-contract-B2HfGt79.d.ts → tree-session-contract-CGOOgPjW.d.ts} +29 -23
  79. package/dist/{tree-store-APgWx6qn.d.ts → tree-store-DKJB0IcA.d.ts} +2 -2
  80. package/package.json +7 -2
  81. package/dist/automation.d.cts +0 -82
  82. package/dist/binding.d.cts +0 -153
  83. package/dist/chunk-2PIHW2QM.cjs +0 -1
  84. package/dist/chunk-2QTY5S6T.js +0 -1
  85. package/dist/chunk-4Z5MODAE.cjs +0 -2
  86. package/dist/chunk-5TKAPFZT.cjs +0 -2
  87. package/dist/chunk-DRQHIQ4R.cjs +0 -1
  88. package/dist/chunk-F2K6SDHA.cjs +0 -20
  89. package/dist/chunk-FBA57EUJ.js +0 -2
  90. package/dist/chunk-KTAQ7BRQ.js +0 -20
  91. package/dist/chunk-LBAHXZCU.cjs +0 -5
  92. package/dist/chunk-MCDUQYWP.js +0 -5
  93. package/dist/chunk-MQP26KCF.js +0 -1
  94. package/dist/chunk-NDJGSR6M.cjs +0 -19
  95. package/dist/chunk-NJNFJPGB.cjs +0 -11
  96. package/dist/chunk-O5M4CR4P.cjs +0 -2
  97. package/dist/chunk-UKUOZXUD.js +0 -19
  98. package/dist/chunk-VQ4R5LTU.js +0 -2
  99. package/dist/chunk-ZBEJHJN2.js +0 -11
  100. package/dist/chunk-ZVTW7RGD.js +0 -2
  101. package/dist/collaboration/replication.d.cts +0 -216
  102. package/dist/collaboration.d.cts +0 -176
  103. package/dist/contracts/document.d.cts +0 -273
  104. package/dist/contracts/editor.d.cts +0 -10
  105. package/dist/contracts/interaction.d.cts +0 -10
  106. package/dist/contracts/modules.d.cts +0 -130
  107. package/dist/contracts/types.d.cts +0 -562
  108. package/dist/custom-node-writes-C46r3_5O.d.cts +0 -310
  109. package/dist/document-properties-D6Ahr8D6.d.cts +0 -28
  110. package/dist/document-properties-D6Ahr8D6.d.ts +0 -28
  111. package/dist/editor-AJ06hyyg.d.cts +0 -1994
  112. package/dist/editor.d.cts +0 -393
  113. package/dist/failure-BnGjoXf0.d.cts +0 -64
  114. package/dist/index-Cbw4lkOt.d.cts +0 -3391
  115. package/dist/index.d.cts +0 -23
  116. package/dist/layout.d.cts +0 -2486
  117. package/dist/note-properties-Y6qYh2Hv.d.cts +0 -67
  118. package/dist/omml-equation-DB8d-jCq.d.cts +0 -84
  119. package/dist/output.d.cts +0 -74
  120. package/dist/protocol-BsmQgblT.d.ts +0 -1358
  121. package/dist/review-items-CaAkgi5s.d.cts +0 -360
  122. package/dist/review-reads-DEsV0OOW.d.cts +0 -163
  123. package/dist/revision-projection-DXbrfNGD.d.cts +0 -156
  124. package/dist/semantic-cell-selection-BMhku3B1.d.cts +0 -451
  125. package/dist/semantic-interaction-DUAnxbgf.d.cts +0 -160
  126. package/dist/semantic-paint-DufNL1Zr.d.cts +0 -247
  127. package/dist/semantic-records-92UnKeU_.d.ts +0 -2821
  128. package/dist/shaped-measurer-BWbindlI.d.ts +0 -168
  129. package/dist/store.d.cts +0 -2500
  130. package/dist/tree-op-types-BUulYD5y.d.cts +0 -3099
  131. package/dist/tree-package-fragment-Dhyw7oPm.d.cts +0 -732
  132. package/dist/tree-session-contract-BY9xd7s_.d.cts +0 -613
  133. package/dist/tree-store-DEEQ9wz_.d.cts +0 -416
package/dist/editor.d.cts DELETED
@@ -1,393 +0,0 @@
1
- import { O as OoxmlPart, G as TreeDocColorValue, v as DrawingPositionInput } from './tree-op-types-BUulYD5y.cjs';
2
- export { H as DEFAULT_IMAGE_RESOURCE_LIMITS, J as IMAGE_WRAP_TARGETS, C as ImageDecodePort, K as ImageResourceLimits, u as ImageWrapTarget, t as RenderableImageMime, y as SupportedImageMime, B as VectorImageMime, L as resolveImageResourceLimits, M as resolveSvgIntrinsicSize, N as sniffImageMime, Q as validateRasterHeader } from './tree-op-types-BUulYD5y.cjs';
3
- import { ColorValue } from './contracts/types.cjs';
4
- export { ParagraphFlags, ParagraphTabStop } from './contracts/types.cjs';
5
- export { R as ReviewModelInput } from './review-items-CaAkgi5s.cjs';
6
- export { CollectReviewItems, EditorModule, EditorModuleRegistry, ReviewModuleContribution, resolveEditorModules } from './contracts/modules.cjs';
7
- import { T as TreeDocxSessionView, f as DocumentThemeColorEntry } from './tree-session-contract-BY9xd7s_.cjs';
8
- export { a as TreeApplyResult } from './tree-session-contract-BY9xd7s_.cjs';
9
- import { F as FontConfiguration, E as EditorFontError, a as EditorSnapshot, b as EditorCommand, C as CanResult, Z as ZoomMode } from './editor-AJ06hyyg.cjs';
10
- export { I as ImageContext, c as ImageCropPercent, d as ImageCropPermille, S as SelectedImageState, T as TrackedChangeFilterMode, e as TrackedChangePredicate, f as cropPercentFromCropPermille, g as cropPercentFromPermille, h as cropPercentFromSourceCrop, i as cropPermilleFromCropPercent, j as cropPermilleFromPercent, s as sourceCropFromCropPercent, v as validateImageCropPercent } from './editor-AJ06hyyg.cjs';
11
- import { L as LayoutShapingOptions } from './shaped-measurer-CFPnXFs9.cjs';
12
- import { P as PaginatedSurfaceOptions, O as OpenPaginatedResult, a as PaginatedSurface, T as TableCommandPlan, D as DocxEditorInstance } from './index-Cbw4lkOt.cjs';
13
- export { A as AnchorFrameOrigin, C as CHROME_GROUPS, b as CHROME_MENUS, c as CHROME_UNAVAILABLE_KEY, d as ChromeControl, e as ChromeControlId, f as ChromeControlState, g as ChromeGroup, h as ChromeGroupId, i as ChromeMenu, j as ChromeMenuEntry, k as ChromeMenuId, l as ChromeMenuItemEntry, m as ChromeMenuSeparatorEntry, n as ChromeMenuSubmenuEntry, o as ChromeSlotId, p as DEFAULT_TABLE_CHROME_DRAFT, q as DocxEditorConfig, r as DrawingSelectionIntent, E as EMU_PER_POINT, s as EquationActivation, t as EquationChromeHandlers, u as EquationOps, F as FONT_RESOLVER_BRAND, v as FONT_RESOLVER_MARK_KEY, w as FinalizedImageOverlayInteraction, x as FontConfigurationBase, y as FontConfigurationFragment, z as FontLoadFailure, B as FontLoadFailureReason, G as FontMeasurementState, H as FontOrigin, I as FontResolutionRequest, J as FontResolver, K as FontResolverMark, L as FontUrlSource, M as HyperlinkActivation, N as HyperlinkChromeHandlers, Q as HyperlinkOps, R as IMAGE_OVERLAY_NUDGE_PT, S as IMAGE_OVERLAY_NUDGE_SHIFT_PT, U as ImageInteractionSession, V as ImageOverlayScrollPort, W as ImageResizeHandle, X as ImageResizeResult, Y as LoadFontsRequest, Z as LoadFontsResult, _ as MAX_RESOLVER_FAMILIES, $ as MarkedFontResolver, a0 as OverlayFrameRect, a1 as PaginatedSurfaceState, a2 as ParagraphPropertyEdit, a3 as RemoteCaretLabelAnchor, a4 as RemoteCaretLabelHost, a5 as ReviewWriteIntent, a6 as RunTableChromeCommandResult, a7 as SectionAnchor, a8 as SectionBreakInsertType, a9 as SelectedDrawingOverlayTarget, aa as SurfaceEquation, ab as SurfaceFormatting, ac as SurfaceHyperlink, ad as SurfaceInsertImageInput, ae as SurfaceNavigation, af as SurfaceOverlayCoordinates, ag as SurfaceParagraphFormat, ah as TABLE_BORDER_STYLE_OPTIONS, ai as TABLE_BORDER_TARGET_OPTIONS, aj as TABLE_BORDER_WIDTH_OPTIONS, ak as TABLE_CHROME_SLOT_IDS, al as TableBorderStyleOption, am as TableBorderTargetOption, an as TableBorderTargetValue, ao as TableBorderWidthOption, ap as TableChromeDraft, aq as TableChromePick, ar as TableChromeSlotId, as as TableInteractionLabelKey, at as ToolbarCommandState, au as WORD_DEFAULT_FONT, av as applyTableChromePick, aw as blankDocumentBytes, ax as canExecuteImageCommand, ay as captureImageMutationPreconditions, az as chromeControlCount, aA as chromeMenuSlots, aB as chromeProbeForSlot, aC as chromeSlotId, aD as chromeSlotIsToggle, aE as commandForSlot, aF as commandForSlotValue, aG as commandForTableChromeSlotValue, aH as composeFontConfiguration, aI as composeFontOrigins, aJ as computeImageResizeResult, aK as computeMovedImagePosition, aL as computeResizedImageExtentEmu, aM as createDocxEditor, aN as createFontSource, aO as createImageOverlayScrollPort, aP as cssPixelsToLayoutPoints, aQ as defaultChromeGroups, aR as defaultTableLabel, aS as defineFontResolver, aT as emuToOverlayPoints, aU as equationAtPosition, aV as executeImageCommand, aW as finalizeImageOverlayInteraction, aX as formattingBarChromeGroups, aY as isFontResolver, aZ as isStaleImageInteractionCommit, a_ as isTableChromeSlot, a$ as layoutPointsToCssPixels, b0 as loadFonts, b1 as overlayFrameToSheetCssPixels, b2 as overlayHostOrigin, b3 as pointsToEmu, b4 as probeTableChromeCommand, b5 as resizePreservesAspect, b6 as runSave, b7 as runTableChromeCommand, b8 as runTableCommand, b9 as runToolbarCommand, ba as selectedDrawingOverlayTargetOf, bb as selectedImageStateOf, bc as surfacePaintScale, bd as tableChromeIconPaths, be as tableChromeLabelKeyForTarget, bf as tableChromeToolbarState, bg as tableChromeVisible, bh as tableCommandToolbarState, bi as toolbarCommandState, bj as toolbarCommandStates } from './index-Cbw4lkOt.cjs';
14
- import { A as AutomationCapabilities, a as AutomationHost } from './protocol-gOY5GA8K.cjs';
15
- import { S as SemanticLayout } from './semantic-records-BpozY7-j.cjs';
16
- export { T as TextMeasurer } from './semantic-records-BpozY7-j.cjs';
17
- export { S as SectionProperties } from './semantic-cell-selection-BMhku3B1.cjs';
18
- export { N as NavigationCommand, S as SemanticPosition, a as SemanticSelection } from './semantic-interaction-DUAnxbgf.cjs';
19
- export { F as FieldShadingMode, R as ReviewAuthorInfo, a as RevisionAuthorAssignments, b as RevisionAuthorStyle, c as RevisionStyles } from './semantic-paint-DufNL1Zr.cjs';
20
- export { CollaborationModuleContribution } from './collaboration.cjs';
21
- import './revision-projection-DXbrfNGD.cjs';
22
- import './tree-package-fragment-Dhyw7oPm.cjs';
23
- import './tree-store-DEEQ9wz_.cjs';
24
- import './collaboration/replication.cjs';
25
- import './failure-BnGjoXf0.cjs';
26
- import './custom-node-writes-C46r3_5O.cjs';
27
- import './document-properties-D6Ahr8D6.cjs';
28
- import 'prosemirror-model';
29
- import './contracts/document.cjs';
30
- import './note-properties-Y6qYh2Hv.cjs';
31
- import './omml-equation-DB8d-jCq.cjs';
32
-
33
- interface LayoutShapingInstrumentation {
34
- readonly onFontByteCopy?: () => void;
35
- readonly onFontHash?: () => void;
36
- readonly onFontAdmission?: () => void;
37
- }
38
- /**
39
- * Normalize anything thrown during font work into an {@link EditorFontError}.
40
- *
41
- * One error type reaches consumers whether the failure came from resolution, admission or
42
- * shaping, so a host branches on `code` rather than on which layer happened to throw.
43
- */
44
- declare function toEditorFontError(error: unknown): EditorFontError;
45
- /** Adapt the published byte-source contract to the private deterministic layout snapshot. */
46
- declare function createLayoutShaping(configuration: FontConfiguration, instrumentation?: LayoutShapingInstrumentation): Promise<LayoutShapingOptions>;
47
- /**
48
- * Release a shaping environment's native resources.
49
- *
50
- * The shaper holds WASM memory that garbage collection cannot reclaim on its own, so a host that
51
- * builds shaping options must dispose them when the editor goes away. Safe on a shaper that has
52
- * no `dispose`.
53
- */
54
- declare function disposeLayoutShaping(shaping: LayoutShapingOptions): void;
55
-
56
- /**
57
- * What `snapshot()` reports before an editor exists: loading, not editable, nothing
58
- * selected, nothing undoable — never invented state.
59
- *
60
- * @public
61
- */
62
- declare const LOADING_SNAPSHOT: EditorSnapshot;
63
-
64
- /**
65
- * True when the engine's PASTE lanes will land user-visible content from this payload, so
66
- * a host's image-FILE lane must stand down or insert a duplicate.
67
- *
68
- * In order of cost: visible `text/plain` (the plain lane's unconditional fallback), visible
69
- * HTML text (the projection and the plain lane's HTML fallback both land it), a
70
- * zip-shaped embedded fragment, and finally the projection probe for text-free HTML.
71
- *
72
- * Deliberate asymmetries against the router's letter: text made only of invisible
73
- * characters (zero-width wrappers, bidi marks, a bare newline) does not count — the router
74
- * technically lands it, but standing down for it would drop a real image for characters
75
- * nobody can see. And engine-state gates the adapter cannot observe (suggesting mode, cell
76
- * selections, the force-plain window) are ignored; in those states the engine may land
77
- * nothing where this predicate said it would.
78
- *
79
- * @internal
80
- */
81
- declare function clipboardPasteLandsContent(transfer: DataTransfer | null | undefined): boolean;
82
- /**
83
- * True when the engine's DROP lane will land text from this payload, so a host's
84
- * image-FILE drop lane must stand down — by NOT preventing the default, which is what
85
- * lets the browser fire `insertFromDrop`, the engine's only drop path.
86
- *
87
- * Only visible HTML text counts. The drop lane is plain text end to end, so fragments and
88
- * `data:` images never land from a drop — and `text/plain` says nothing about intent here,
89
- * because image-file drags routinely mirror the file's path or URL into it. A text drag
90
- * that carries an image file beside it (Word's rendering PNG again) always carries the
91
- * text in HTML too.
92
- *
93
- * @internal
94
- */
95
- declare function clipboardDropLandsText(transfer: DataTransfer | null | undefined): boolean;
96
-
97
- /**
98
- * Mount a paginated surface over DOCX bytes.
99
- *
100
- * Returns a typed rejection rather than throwing: a failure here is a property of the file,
101
- * and a host must be able to tell "not a package" from "no body" without parsing an error
102
- * message.
103
- */
104
- declare function mountPaginatedSurface(container: HTMLElement, bytes: Uint8Array, options?: PaginatedSurfaceOptions): OpenPaginatedResult;
105
-
106
- /**
107
- * The story a NODE lives in, which is what a write about that node must target.
108
- *
109
- * The open scope is a near-enough proxy most of the time and wrong exactly when it matters:
110
- * nothing binds a node id to it, so a verb invoked on a control, a chip or a paragraph the
111
- * reader is not currently standing in wrote against the wrong store — or, where the id came
112
- * from a body-only index, against body content the reader could not see.
113
- *
114
- * Answered from the id's own PART NAME. Node ids are minted `${partName}#${path}`, so the
115
- * question is constant-time and needs no store to be opened. That last part is load-bearing:
116
- * asking each scope for its paragraph list instead OPENS a story store, the store cap is 64,
117
- * and a store whose part is still in the package is never evicted — on a many-section
118
- * document that left later headers unopenable for the rest of the session.
119
- *
120
- * Falls back to `fallback` for an id no story claims, so the store refuses it rather than this.
121
- */
122
- /**
123
- * The part a NODE lives in, WITHOUT opening a story store.
124
- *
125
- * `session.partFor(scope)` resolves a scope by opening that story's store, and an open store is
126
- * retained for as long as its part is in the package. The cap is 64. So routing a pure READ —
127
- * "is this control locked", "what is its tab index" — through `partFor` spent a permanent slot
128
- * per part touched, and an id naming no node at all still spent one, because the part name is
129
- * matched from the id's prefix before anything is looked up. Sixty-four such reads and no
130
- * further header could be opened for the rest of the session, silently.
131
- *
132
- * Read straight from the live package instead. Ids carry the canonical part name, so this is a
133
- * map lookup.
134
- */
135
- declare function partOfNodeId(session: Pick<TreeDocxSessionView, 'currentPackage' | 'part'>, nodeId: string | undefined): OoxmlPart | null;
136
-
137
- /** The engine paints at 96 px per inch (twips / 15, 1440 twips per inch). */
138
- declare const PX_PER_INCH = 96;
139
- /** Painted pixels per centimetre, derived from {@link PX_PER_INCH}. */
140
- declare const PX_PER_CM: number;
141
- /** Which measurement system the ruler shows. Drives both tick cadence and drag snapping. */
142
- type RulerUnit = 'inch' | 'cm';
143
- /** One tick on the ruler: where it sits, how tall it is, and its label if it carries one. */
144
- interface RulerTick {
145
- /** Offset along the ruler in content pixels. */
146
- readonly position: number;
147
- readonly height: number;
148
- /** Whole-unit label, omitted at the origin and on minor ticks. */
149
- readonly label?: string;
150
- }
151
- /**
152
- * Ticks across one page dimension, matching the legacy cadence: eighth-inch
153
- * minors with labelled inches, or millimetre minors with labelled centimetres.
154
- */
155
- declare function generateRulerTicks(lengthPx: number, unit: RulerUnit): RulerTick[];
156
- /** The first page's box, which the rulers measure against. */
157
- declare function rulerPageBox(pages: readonly {
158
- readonly index: number;
159
- readonly box: {
160
- width: number;
161
- height: number;
162
- };
163
- }[]): {
164
- width: number;
165
- height: number;
166
- } | null;
167
-
168
- /** Twips per inch, as OOXML defines them. */
169
- declare const TWIPS_PER_INCH = 1440;
170
- /** Twips per centimetre, as Word rounds them. */
171
- declare const TWIPS_PER_CM = 567;
172
- /** Word snaps ruler drags to the eighth-inch grid its ticks already draw. */
173
- declare const SNAP_TWIPS_INCH: number;
174
- /** The centimetre ruler's grid is the millimetre. */
175
- declare const SNAP_TWIPS_CM: number;
176
-
177
- /**
178
- * The four handles Word's ruler carries.
179
- *
180
- * `hanging` and `left` sit at the SAME position and differ only in what a drag takes with
181
- * them — the box moves the whole paragraph, the triangle leaves the first line where it is.
182
- */
183
- type RulerIndentHandle = 'firstLine' | 'hanging' | 'left' | 'right';
184
- /** A paragraph's indent as the ruler works with it. Twips; `firstLine` signed. */
185
- interface RulerIndent {
186
- readonly left: number;
187
- readonly right: number;
188
- readonly firstLine: number;
189
- }
190
- /** The page the handles are placed against. Twips. */
191
- interface RulerPageMetrics {
192
- readonly pageWidth: number;
193
- readonly leftMargin: number;
194
- readonly rightMargin: number;
195
- }
196
- /**
197
- * How a ruler drag resolves: which grid it snaps to, and whether it snaps at all.
198
- *
199
- * @public
200
- */
201
- interface RulerDragOptions {
202
- /** Which snap grid applies. Defaults to inches. */
203
- readonly unit?: RulerUnit;
204
- /** Alt held: continuous, twip-precision drag, bypassing the snap grid — as in Word. */
205
- readonly precise?: boolean;
206
- }
207
- /** Where a handle sits, in twips from the page's LEFT SHEET EDGE (not the margin). */
208
- declare function handlePosition(handle: RulerIndentHandle, indent: RulerIndent, page: RulerPageMetrics): number;
209
- /** Round to the ruler's grid, or to the twip when the drag is precise. */
210
- declare function snapTwips(value: number, unit: RulerUnit, precise: boolean): number;
211
- /**
212
- * The indent a drag of `handle` to `positionTwips` produces.
213
- *
214
- * Clamps differ from the MARGIN drags this ruler also carries, and deliberately:
215
- *
216
- * - Indents may go NEGATIVE, pulling text into the margin, which Word allows. The floor is
217
- * the sheet edge, not the margin.
218
- * - There is no minimum text width. The 720-twip floor the margin drags use mirrors an
219
- * engine refusal that does not exist for indents, and enforcing one here would make a
220
- * narrow pull-quote unreachable. Left and right markers may MEET; they may not cross.
221
- * - The left box needs a first-line clamp of its own. It does not move `firstLine`, so on a
222
- * hanging paragraph dragging the box left can push the first-line marker off the sheet
223
- * while the box itself is still in range. The drag stops when the LEADING marker lands.
224
- */
225
- declare function dragIndent(handle: RulerIndentHandle, positionTwips: number, indent: RulerIndent, page: RulerPageMetrics, options?: RulerDragOptions): RulerIndent;
226
-
227
- /**
228
- * Stable value identity for a command, including nested payloads.
229
- *
230
- * @internal
231
- */
232
- declare function editorCommandKey(command: EditorCommand): string;
233
-
234
- /** Planner-backed can/plan pair — production gate for table commands. Task 9 maps chrome slots. */
235
- declare function tableCommandState(command: EditorCommand, surface: PaginatedSurface): {
236
- readonly can: CanResult;
237
- readonly plan: TableCommandPlan;
238
- };
239
-
240
- /**
241
- * What a browser host can do.
242
- *
243
- * `selection`, `scrolling` and `layout` are true because a mounted editor genuinely has a
244
- * caret, a scroll container and paginated layout — a consumer may branch on them. The
245
- * DOCUMENT operations behave identically to the headless host regardless; the extra
246
- * capabilities widen what may be asked later, never what an existing operation means.
247
- */
248
- declare const BROWSER_AUTOMATION_CAPABILITIES: AutomationCapabilities;
249
- /**
250
- * An automation host over a live editor.
251
- *
252
- * The editor keeps its own lifetime: `dispose()` on the returned host releases the change
253
- * subscription this adapter took and leaves the editor mounted and editable.
254
- */
255
- declare function createBrowserAutomationHost(editor: DocxEditorInstance): AutomationHost;
256
-
257
- /** Clamp and validate an OOXML theme modifier fraction (0, 1]. */
258
- declare function validateThemeModifier(value: unknown): value is number;
259
- /** Blend toward white. `keep` is the fraction of the base colour retained (OOXML themeTint byte). */
260
- declare function applyThemeTint(hex: string, keep: number): string;
261
- /** Blend toward black. `keep` is the fraction of the base colour retained (OOXML themeShade byte). */
262
- declare function applyThemeShade(hex: string, keep: number): string;
263
- /** Resolve a theme colour to literal hex. When both tint and shade are present, ECMA-376
264
- * §17.3.2.6 / §17.3.4 / §17.3.5 require tint precedence — shade is ignored for paint. */
265
- declare function resolveThemeColorHex(color: Extract<ColorValue, {
266
- kind: 'theme';
267
- }>, themeColors: readonly DocumentThemeColorEntry[]): {
268
- ok: true;
269
- hex: string;
270
- } | {
271
- ok: false;
272
- reason: string;
273
- };
274
- type ColorLowerRefusal = {
275
- readonly ok: false;
276
- readonly reason: string;
277
- };
278
- /**
279
- * A public colour lowered for a border or fill op, or the reason it could not be.
280
- *
281
- * Refusals happen because paint needs a literal: a theme colour the document's theme does not
282
- * define has no hex to draw, and inventing one would show a border in a colour the file never
283
- * named.
284
- */
285
- type ColorLowerResult = {
286
- readonly ok: true;
287
- readonly color: TreeDocColorValue;
288
- } | ColorLowerRefusal;
289
- /**
290
- * Lower a public colour for table border ops. Theme colours require a resolved literal for
291
- * paint; `auto` preserves OOXML automatic semantics with a black render fallback.
292
- */
293
- declare function lowerColorValueForBorder(color: ColorValue, themeColors: readonly DocumentThemeColorEntry[]): ColorLowerResult;
294
- /**
295
- * Lower a public colour for cell fill. `auto` refuses because the cascade literal
296
- * cannot be named honestly at commit time.
297
- */
298
- declare function lowerColorValueForFill(color: ColorValue, themeColors: readonly DocumentThemeColorEntry[]): ColorLowerResult;
299
- /** Resolve any public colour to a CSS `#RRGGBB` string for chrome display. */
300
- declare function resolveColorValueToCss(color: ColorValue | undefined | null, themeColors: readonly DocumentThemeColorEntry[], defaultHex?: string): string;
301
-
302
- /** Surface sizing derived from layout records, in layout points (not CSS pixels). */
303
- interface SurfaceExtent {
304
- /** Width the surface container should occupy. */
305
- readonly width: number;
306
- /** Total document height (always from every page, for scroll extent). */
307
- readonly height: number;
308
- /**
309
- * Extra horizontal offset per page, in layout points, so narrower sheets centre inside a
310
- * mixed-width materialized window. Absent entries mean no offset beyond layout `box.x`.
311
- */
312
- readonly pageOffsetX: ReadonlyMap<number, number>;
313
- }
314
- /**
315
- * How wide and tall the paginated surface should be.
316
- *
317
- * When `materialize` is set — virtualization is active — width follows only those pages so a
318
- * distant landscape section does not stretch a portrait viewport. Without it (print, export,
319
- * tests with no scroller) every page contributes, which is the safe reading.
320
- */
321
- declare function surfaceExtent(layout: SemanticLayout, materialize: ReadonlySet<number> | undefined): SurfaceExtent;
322
-
323
- /** The narrowest scale the editor contract accepts. One definition, every user. */
324
- declare const ZOOM_MIN = 0.1;
325
- /** The widest scale the editor contract accepts. */
326
- declare const ZOOM_MAX = 5;
327
- /**
328
- * Fit the page width, but never magnify and never shrink past legibility: the default.
329
- *
330
- * A wide container keeps the 100% it has always had, and only one too narrow to hold the
331
- * sheet shrinks. Uncapped fitting would render a Letter page at 183% on a 1600px monitor,
332
- * which is a reader app, not Word; unfloored fitting would render it at 20% beside an open
333
- * comments rail on a phone.
334
- */
335
- declare const AUTO_ZOOM_MODE: ZoomMode;
336
- /**
337
- * Fit the page width in BOTH directions — the uncapped fit, unlike `'auto'`.
338
- *
339
- * A shared constant rather than a literal per call site: modes are compared by value, but a
340
- * control also has to render its own selected state, and two spellings of one mode in two
341
- * files is how a menu ends up ticking a row the editor is not in.
342
- */
343
- declare const FIT_WIDTH_ZOOM_MODE: ZoomMode;
344
- /**
345
- * Normalize the `'auto'` shorthand a host may pass anywhere a {@link ZoomMode} is accepted.
346
- *
347
- * Returns `null` for a value that is neither, so callers refuse rather than silently
348
- * substituting a mode the caller did not ask for.
349
- */
350
- declare function resolveZoomMode(mode: ZoomMode | 'auto'): ZoomMode | null;
351
- /**
352
- * Whether two modes say the same thing.
353
- *
354
- * `snapshotsEqual` compares `zoomMode` by IDENTITY, and a host's `zoomMode` prop is an object
355
- * — `<DocxEditor zoomMode={{ type: 'fit', fit: 'pageWidth' }} />` is a fresh literal on every
356
- * render, which is the spelling the docs show. Without a value comparison somewhere, each of
357
- * those renders reinstalled the observer, refitted, bumped the tick, and re-rendered every
358
- * `useEditorState` consumer in the tree — including the page selector that the slice
359
- * memoization exists to keep asleep. The lane holds its object and compares by value here.
360
- */
361
- declare function sameZoomMode(a: ZoomMode, b: ZoomMode): boolean;
362
-
363
- /** Validate a position input, refusing offsets or bases outside what OOXML allows. */
364
- declare function validateDrawingPositionInput(position: DrawingPositionInput): boolean;
365
- /** Legal `relativeFrom` bases for a horizontal offset (page, margin, column, character, …). */
366
- declare const DRAWING_REL_FROM_H: readonly string[];
367
- /** Legal `relativeFrom` bases for a vertical offset (page, margin, paragraph, line, …). */
368
- declare const DRAWING_REL_FROM_V: readonly string[];
369
- /** Whether an image-properties command carries any positioning fields at all. */
370
- declare function propertiesCommandHasPositionFields(command: {
371
- readonly horizontalEmu?: number;
372
- readonly verticalEmu?: number;
373
- readonly relativeToH?: string;
374
- readonly relativeToV?: string;
375
- }): boolean;
376
- /** Extract the position input from an image-properties command, or null when it carries none. */
377
- declare function positionInputFromPropertiesCommand(command: {
378
- readonly horizontalEmu?: number;
379
- readonly verticalEmu?: number;
380
- readonly relativeToH?: string;
381
- readonly relativeToV?: string;
382
- }, selected: {
383
- readonly position?: DrawingPositionInput | null;
384
- } | null): DrawingPositionInput;
385
- /** Validate a set-position command before it reaches the store. */
386
- declare function validateSetImagePositionCommand(command: {
387
- readonly horizontalEmu?: number;
388
- readonly verticalEmu?: number;
389
- readonly relativeToH?: string;
390
- readonly relativeToV?: string;
391
- }, mode: 'frame' | 'simple'): boolean;
392
-
393
- export { AUTO_ZOOM_MODE, BROWSER_AUTOMATION_CAPABILITIES, type ColorLowerResult, DRAWING_REL_FROM_H, DRAWING_REL_FROM_V, DocxEditorInstance, DrawingPositionInput, FIT_WIDTH_ZOOM_MODE, LOADING_SNAPSHOT, OpenPaginatedResult, PX_PER_CM, PX_PER_INCH, PaginatedSurface, PaginatedSurfaceOptions, type RulerDragOptions, type RulerIndent, type RulerIndentHandle, type RulerPageMetrics, type RulerTick, type RulerUnit, SNAP_TWIPS_CM, SNAP_TWIPS_INCH, type SurfaceExtent, TWIPS_PER_CM, TWIPS_PER_INCH, TreeDocxSessionView, ZOOM_MAX, ZOOM_MIN, applyThemeShade, applyThemeTint, clipboardDropLandsText, clipboardPasteLandsContent, createBrowserAutomationHost, createLayoutShaping, disposeLayoutShaping, dragIndent, editorCommandKey, generateRulerTicks, handlePosition, lowerColorValueForBorder, lowerColorValueForFill, mountPaginatedSurface, partOfNodeId, positionInputFromPropertiesCommand, propertiesCommandHasPositionFields, resolveColorValueToCss, resolveThemeColorHex, resolveZoomMode, rulerPageBox, sameZoomMode, snapTwips, surfaceExtent, tableCommandState, toEditorFontError, validateDrawingPositionInput, validateSetImagePositionCommand, validateThemeModifier };
@@ -1,64 +0,0 @@
1
- /**
2
- * Lifecycle state of one collaboration replica.
3
- *
4
- * One axis, because the only question a host has to answer is whether to tell the reader to
5
- * wait or to reload:
6
- *
7
- * - `initializing` — joining. Edits are refused. Recovers on its own.
8
- * - `ready` — replicating. The only state that accepts edits.
9
- * - `disconnected` — the transport dropped. The replica is intact and recovers on its own,
10
- * so wait rather than reload. Edits are refused until reconnect by default; a session
11
- * created with offline editing enabled keeps accepting them, and the buffered updates
12
- * merge on reconnect.
13
- * - `error` — this replica no longer agrees with the room. It does not recover: only a
14
- * reload rejoins. {@link CollaborationStatusSnapshot.reason} says why.
15
- * - `destroyed` — torn down. Terminal.
16
- *
17
- * @public
18
- */
19
- type CollaborationStatus = 'initializing' | 'ready' | 'disconnected' | 'error' | 'destroyed';
20
- /**
21
- * Why a replica refused work, left `ready`, or failed a schema check.
22
- *
23
- * Free-form extras (a transport phrase, a blob key, a store refusal) travel in
24
- * {@link CollaborationFailure.detail}, not here. `invalid-shared-metadata` follows that rule:
25
- * it names one malformed field of the room's shared metadata, and which field is the detail.
26
- * Distinct from `invalid-document-id`, which rejects a document id this host passed in.
27
- * `concurrent-seed` reports two merged seed transactions in one room; the room cannot be
28
- * repaired client-side — create a new room from saved bytes.
29
- *
30
- * Two of these name a transport condition a host has to tell apart, because the answers are
31
- * opposite. `transport-disconnected` recovers on its own, so wait. `authentication-failed`
32
- * never does: the credential the provider re-sent was rejected, so refresh it and rejoin.
33
- * `transport` remains the catch-all for a provider that reported neither.
34
- *
35
- * @public
36
- */
37
- type CollaborationFailureCode = 'already-initialized' | 'authentication-failed' | 'baseline-digest-mismatch' | 'baseline-too-large' | 'blob-digest-mismatch' | 'blob-read' | 'blob-store-full' | 'blob-too-large' | 'collaboration-session-destroyed' | 'collaboration-session-not-attached' | 'collaboration-session-not-ready' | 'collaboration-text-limit' | 'concurrent-seed' | 'document-id-mismatch' | 'duplicate-paragraph-id' | 'experimental-collaboration-body-text-only' | 'experimental-collaboration-existing-paragraphs-only' | 'experimental-collaboration-text-only' | 'experimental-collaboration-untracked-text-only' | 'immutable-baseline-changed' | 'immutable-metadata-changed' | 'initialization-aborted' | 'initialization-timeout' | 'invalid-baseline' | 'invalid-blob-descriptor' | 'invalid-bound' | 'invalid-document-id' | 'invalid-identity' | 'invalid-identity-color' | 'invalid-logical-id' | 'invalid-relationships' | 'invalid-session-id' | 'invalid-shared-metadata' | 'invalid-string' | 'local-mirror-failed' | 'materialize-dropped-content' | 'missing-blob' | 'missing-local-blob' | 'missing-root' | 'no-main-document-part' | 'not-initialized' | 'paragraph-set-mismatch' | 'port-already-attached' | 'protocol-version-mismatch' | 'prototype-key' | 'remote-apply-failed' | 'schema-version-mismatch' | 'shared-schema-invalid' | 'text-too-long' | 'too-many-attributes' | 'too-many-children' | 'too-many-nodes' | 'too-many-parts' | 'too-many-relationships' | 'transport' | 'transport-disconnected' | 'tree-too-deep' | 'unknown-logical-id' | 'unknown-paragraph-id' | 'unsafe-part-name' | 'unsupported-root-key';
38
- /** True when `value` is a {@link CollaborationFailureCode} member. @public */
39
- declare function isCollaborationFailureCode(value: string): value is CollaborationFailureCode;
40
- /** One collaboration failure: a typed code plus optional free-form detail. @public */
41
- interface CollaborationFailure {
42
- readonly code: CollaborationFailureCode;
43
- readonly detail?: string;
44
- }
45
- /**
46
- * Cached status read. Same reference until status, reason, or last failure change.
47
- *
48
- * @public
49
- */
50
- interface CollaborationStatusSnapshot {
51
- readonly status: CollaborationStatus;
52
- readonly reason: CollaborationFailure | undefined;
53
- readonly lastFailure: CollaborationFailure | undefined;
54
- }
55
- /** @internal */
56
- interface CollaborationStatusTracker {
57
- status(): CollaborationStatus;
58
- snapshot(): CollaborationStatusSnapshot;
59
- set(status: CollaborationStatus, code?: CollaborationFailureCode, detail?: string): boolean;
60
- }
61
- /** @internal */
62
- declare function createCollaborationStatusTracker(initial?: CollaborationStatus): CollaborationStatusTracker;
63
-
64
- export { type CollaborationStatus as C, type CollaborationStatusSnapshot as a, type CollaborationFailureCode as b, type CollaborationFailure as c, createCollaborationStatusTracker as d, isCollaborationFailureCode as i };