@docx-editor.dev/core 0.0.1-placeholder → 2.0.1

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/LICENSE +201 -0
  2. package/README.md +92 -2
  3. package/THIRD_PARTY_NOTICES.md +18 -0
  4. package/dist/automation.cjs +1 -0
  5. package/dist/automation.d.cts +74 -0
  6. package/dist/automation.d.ts +74 -0
  7. package/dist/automation.js +1 -0
  8. package/dist/binding.cjs +1 -0
  9. package/dist/binding.d.cts +82 -0
  10. package/dist/binding.d.ts +82 -0
  11. package/dist/binding.js +1 -0
  12. package/dist/chunk-5KSCB2OZ.js +2 -0
  13. package/dist/chunk-BSC44TIT.js +5 -0
  14. package/dist/chunk-DLPL5DAG.js +12 -0
  15. package/dist/chunk-DOEIARE2.js +2 -0
  16. package/dist/chunk-G7YCQBZE.cjs +5 -0
  17. package/dist/chunk-HBL3NNH5.cjs +1 -0
  18. package/dist/chunk-HR7K3W6A.js +1 -0
  19. package/dist/chunk-HVAV2JSN.js +11 -0
  20. package/dist/chunk-MYH2HCUJ.cjs +2 -0
  21. package/dist/chunk-NSM75TN6.cjs +1 -0
  22. package/dist/chunk-PHDVKUWZ.js +1 -0
  23. package/dist/chunk-QADYGK5L.cjs +12 -0
  24. package/dist/chunk-REZUWYB7.js +1 -0
  25. package/dist/chunk-RNBHTPW7.js +10 -0
  26. package/dist/chunk-UD2ZXLFI.cjs +2 -0
  27. package/dist/chunk-VYAVK2AH.cjs +1 -0
  28. package/dist/chunk-YUK46A2N.cjs +11 -0
  29. package/dist/chunk-ZMIX42J7.cjs +10 -0
  30. package/dist/chunk-ZT55Q52J.cjs +2 -0
  31. package/dist/chunk-ZUALAR4M.js +2 -0
  32. package/dist/content-control-walk-CbTqHq6O.d.cts +56 -0
  33. package/dist/content-control-walk-D06GijR0.d.ts +56 -0
  34. package/dist/contracts/document.cjs +1 -0
  35. package/dist/contracts/document.d.cts +246 -0
  36. package/dist/contracts/document.d.ts +246 -0
  37. package/dist/contracts/document.js +0 -0
  38. package/dist/contracts/editor.cjs +1 -0
  39. package/dist/contracts/editor.d.cts +11 -0
  40. package/dist/contracts/editor.d.ts +11 -0
  41. package/dist/contracts/editor.js +1 -0
  42. package/dist/contracts/interaction.cjs +1 -0
  43. package/dist/contracts/interaction.d.cts +11 -0
  44. package/dist/contracts/interaction.d.ts +11 -0
  45. package/dist/contracts/interaction.js +0 -0
  46. package/dist/contracts/modules.cjs +1 -0
  47. package/dist/contracts/modules.d.cts +90 -0
  48. package/dist/contracts/modules.d.ts +90 -0
  49. package/dist/contracts/modules.js +1 -0
  50. package/dist/contracts/types.cjs +1 -0
  51. package/dist/contracts/types.d.cts +452 -0
  52. package/dist/contracts/types.d.ts +452 -0
  53. package/dist/contracts/types.js +0 -0
  54. package/dist/editor-C1QRi1v4.d.ts +1671 -0
  55. package/dist/editor-D0UDock4.d.cts +1671 -0
  56. package/dist/editor.cjs +1 -0
  57. package/dist/editor.css +6017 -0
  58. package/dist/editor.d.cts +271 -0
  59. package/dist/editor.d.ts +271 -0
  60. package/dist/editor.js +1 -0
  61. package/dist/hf-references-BdjsQNE_.d.ts +71 -0
  62. package/dist/hf-references-CgEOSw3i.d.cts +71 -0
  63. package/dist/image-resources-BJnTpG66.d.ts +195 -0
  64. package/dist/image-resources-BpIydXtU.d.cts +195 -0
  65. package/dist/index-CrW-IxXt.d.cts +2515 -0
  66. package/dist/index-ZqBEOrTV.d.ts +2515 -0
  67. package/dist/index.cjs +1 -0
  68. package/dist/index.d.cts +22 -0
  69. package/dist/index.d.ts +22 -0
  70. package/dist/index.js +1 -0
  71. package/dist/layout.cjs +1 -0
  72. package/dist/layout.d.cts +2316 -0
  73. package/dist/layout.d.ts +2316 -0
  74. package/dist/layout.js +1 -0
  75. package/dist/note-nodes-BPSTVDMr.d.ts +108 -0
  76. package/dist/note-nodes-C6DLxlvj.d.cts +108 -0
  77. package/dist/note-properties-CnmCoory.d.cts +68 -0
  78. package/dist/note-properties-m75hmP70.d.ts +68 -0
  79. package/dist/ooxml-package-CR5us6ad.d.cts +354 -0
  80. package/dist/ooxml-package-D_CtywTW.d.ts +354 -0
  81. package/dist/ooxml-tree-BU0e3DVi.d.cts +871 -0
  82. package/dist/ooxml-tree-BU0e3DVi.d.ts +871 -0
  83. package/dist/output.cjs +1 -0
  84. package/dist/output.d.cts +158 -0
  85. package/dist/output.d.ts +158 -0
  86. package/dist/output.js +1 -0
  87. package/dist/protocol-CAkOBBGE.d.cts +1201 -0
  88. package/dist/protocol-oxHaWmt4.d.ts +1201 -0
  89. package/dist/review-support-DS8DYX2a.d.cts +326 -0
  90. package/dist/review-support-Fy3vdIea.d.ts +326 -0
  91. package/dist/revision-projection-72ZApe-g.d.cts +84 -0
  92. package/dist/revision-projection-DHAkcD_L.d.ts +84 -0
  93. package/dist/semantic-cell-selection-CZjBSmMv.d.cts +427 -0
  94. package/dist/semantic-cell-selection-DsmHmLJ5.d.ts +427 -0
  95. package/dist/semantic-interaction-D-Dszxrn.d.cts +187 -0
  96. package/dist/semantic-interaction-Dy-dCUFF.d.ts +187 -0
  97. package/dist/semantic-paint-drawings-BA3z9jl8.d.ts +21 -0
  98. package/dist/semantic-paint-drawings-D7qbB0E2.d.cts +21 -0
  99. package/dist/semantic-records-CJR3BvHs.d.cts +1432 -0
  100. package/dist/semantic-records-CWodBJsz.d.ts +1432 -0
  101. package/dist/shaped-measurer-B-TAtcQU.d.ts +613 -0
  102. package/dist/shaped-measurer-CNIT_svZ.d.cts +613 -0
  103. package/dist/store.cjs +1 -0
  104. package/dist/store.d.cts +2247 -0
  105. package/dist/store.d.ts +2247 -0
  106. package/dist/store.js +1 -0
  107. package/dist/tree-op-types-CwOeiaQ8.d.ts +1431 -0
  108. package/dist/tree-op-types-DMiW6nIH.d.cts +1431 -0
  109. package/dist/tree-package-store-D5S7VKs5.d.ts +708 -0
  110. package/dist/tree-package-store-DOKMtCnh.d.cts +708 -0
  111. package/dist/tree-session-CiUel5Kz.d.ts +542 -0
  112. package/dist/tree-session-D47_imvR.d.cts +542 -0
  113. package/dist/tree-store-CxifqwIv.d.cts +273 -0
  114. package/dist/tree-store-hLtjeyWE.d.ts +273 -0
  115. package/package.json +105 -15
  116. package/index.js +0 -1
@@ -0,0 +1,187 @@
1
+ import { T as TextMeasurer, S as SemanticLayout, B as BlockFragmentRecord, C as ContentControlBoundaryRecord, a as StyleSpanRecord } from './semantic-records-CWodBJsz.js';
2
+
3
+ /** A caret position in the model. */
4
+ interface SemanticPosition {
5
+ readonly paragraphId: string;
6
+ readonly offset: number;
7
+ }
8
+ /** A caret position with the geometry that renders it. */
9
+ interface CaretGeometry {
10
+ readonly position: SemanticPosition;
11
+ /** Page-relative, in the same coordinate space as the line boxes. */
12
+ readonly x: number;
13
+ readonly y: number;
14
+ readonly height: number;
15
+ readonly lineId: string;
16
+ readonly pageIndex: number;
17
+ }
18
+ /**
19
+ * A selection as two semantic positions — never as DOM nodes.
20
+ *
21
+ * `anchor` is where the selection started and `head` is where it currently ends, so `head` before
22
+ * `anchor` is an ordinary backwards selection rather than an error. Collapsed when the two are
23
+ * equal, which is what a caret is.
24
+ */
25
+ interface SemanticSelection {
26
+ readonly anchor: SemanticPosition;
27
+ readonly head: SemanticPosition;
28
+ }
29
+ /** One painted selection rectangle, in page-relative layout points. */
30
+ interface SelectionRect {
31
+ readonly pageIndex: number;
32
+ readonly x: number;
33
+ readonly y: number;
34
+ readonly width: number;
35
+ readonly height: number;
36
+ }
37
+ /**
38
+ * Every caret stop in the document body, in reading order.
39
+ *
40
+ * One per character boundary on every line, plus the line end. Derived rather than stored,
41
+ * so a stop can never survive the content it described. Ownership of a position SHARED by
42
+ * two lines is decided here exactly as `caretAt` decides it. Furniture stories use
43
+ * {@link caretStopsForBlocks} so open header/footer navigation never walks body stops.
44
+ */
45
+ declare function caretStops(layout: SemanticLayout, measurer?: TextMeasurer): CaretGeometry[];
46
+ /**
47
+ * Caret stops for one story's block fragments (header/footer), in reading order.
48
+ *
49
+ * Coordinates stay story-relative — the same space `hitTestFragments` and furniture paint
50
+ * use — so arrow motion follows tab-stop geometry and projected field atoms without mixing
51
+ * body sheet offsets.
52
+ */
53
+ declare function caretStopsForBlocks(layout: SemanticLayout, pageIndex: number, fragments: readonly BlockFragmentRecord[], measurer?: TextMeasurer): CaretGeometry[];
54
+ /**
55
+ * How caret geometry is resolved.
56
+ *
57
+ * `preferPage` disambiguates a paragraph that paints on SEVERAL pages — a shared header appears
58
+ * once per page, and without a preference the caret could be placed on any of its copies.
59
+ */
60
+ interface CaretAtOptions {
61
+ readonly measurer?: TextMeasurer;
62
+ /**
63
+ * Prefer geometry from this sheet when the same paragraph paints on multiple pages
64
+ * (shared header/footer copies).
65
+ */
66
+ readonly preferredPageIndex?: number;
67
+ }
68
+ /** Geometry for one model position, or null when it is not laid out. */
69
+ declare function caretAt(layout: SemanticLayout, position: SemanticPosition, measurerOrOptions?: TextMeasurer | CaretAtOptions): CaretGeometry | null;
70
+ /**
71
+ * The caret position nearest a point, in PAGE-CONTENT coordinates.
72
+ *
73
+ * Never returns null for a point inside the document: a click in the margin, past the end of
74
+ * a line, or below the last line still has an obvious intended caret, and refusing to answer
75
+ * would make those clicks do nothing.
76
+ *
77
+ * The rules live in `semantic-hit-test.ts`, which answers with the cell address and the
78
+ * on-glyphs flag a pointer controller needs too; this keeps the geometry-only shape for
79
+ * callers that want nothing else.
80
+ */
81
+ declare function hitTestSemantic(layout: SemanticLayout, point: {
82
+ readonly x: number;
83
+ readonly y: number;
84
+ readonly pageIndex?: number;
85
+ }): CaretGeometry | null;
86
+ /**
87
+ * Innermost content-control boundary at a page-content point, or null outside every control.
88
+ *
89
+ * Prefers the deepest nesting depth when nested boundaries share geometry.
90
+ */
91
+ declare function contentControlAtSemantic(layout: SemanticLayout, point: {
92
+ readonly x: number;
93
+ readonly y: number;
94
+ readonly pageIndex?: number;
95
+ }): ContentControlBoundaryRecord | null;
96
+ /** Layout-published content-control boundaries in document order. */
97
+ declare function contentControlsInLayout(layout: SemanticLayout): readonly ContentControlBoundaryRecord[];
98
+ /** The rectangles covering a selection, one per line it spans. */
99
+ declare function selectionRects(layout: SemanticLayout, selection: SemanticSelection): SelectionRect[];
100
+ /** A model range to highlight, and the key the caller knows it by. */
101
+ interface KeyedRange {
102
+ readonly key: string;
103
+ readonly from: SemanticPosition;
104
+ readonly to: SemanticPosition;
105
+ }
106
+ /**
107
+ * Rectangles for MANY ranges in ONE pass over the lines.
108
+ *
109
+ * Not `selectionRects` in a loop. That walks every page, fragment and line per range, and a
110
+ * contract with two hundred comments would re-walk the whole document two hundred times on
111
+ * every layout — the highlight would cost more than the layout it decorates. One pass tests
112
+ * each line against every range instead, which is the same work a single selection does.
113
+ */
114
+ declare function keyedRangeRects(layout: SemanticLayout, ranges: readonly KeyedRange[],
115
+ /**
116
+ * Pages to measure, or every page when absent.
117
+ *
118
+ * A band that is not on screen is not painted, so measuring it is pure cost — and it is
119
+ * cost paid per keystroke, because an edit republishes the layout. Bounding this to the
120
+ * materialized pages is what keeps typing in a heavily reviewed document as fast as
121
+ * typing in a clean one.
122
+ */
123
+ pages?: ReadonlySet<number>): Map<string, SelectionRect[]>;
124
+ /** Paragraph ids in document order, deduplicated across fragments. */
125
+ declare function documentOrder(layout: SemanticLayout): string[];
126
+ /**
127
+ * One caret movement, in Word's own vocabulary.
128
+ *
129
+ * Visual rather than logical where the two differ: `left` means left on screen, which in
130
+ * right-to-left text is forward through the string.
131
+ */
132
+ type NavigationCommand = 'left' | 'right' | 'up' | 'down' | 'wordLeft' | 'wordRight' | 'lineStart' | 'lineEnd' | 'documentStart' | 'documentEnd' | 'pageUp' | 'pageDown';
133
+ /**
134
+ * The text of one paragraph, read back from the layout records.
135
+ *
136
+ * Word boundaries need characters, and the records carry them: every span holds the text it
137
+ * was laid out from, keyed by the source range it covers. Reading them back keeps word
138
+ * motion in the interaction lane instead of making it a second consumer of the model.
139
+ */
140
+ declare function paragraphTextFromLayout(layout: SemanticLayout, paragraphId: string): string;
141
+ /**
142
+ * The next word boundary from `offset`, in `direction`.
143
+ *
144
+ * Word-LEFT skips any whitespace immediately behind the caret and then the word behind that,
145
+ * which is what every editor does and what makes repeated presses walk words rather than
146
+ * alternate between a word and the space before it. Word-RIGHT stops at the END of the
147
+ * current word, then skips the following whitespace on the next press.
148
+ */
149
+ declare function wordBoundary(text: string, offset: number, direction: -1 | 1): number;
150
+ /**
151
+ * How a caret move resolves.
152
+ *
153
+ * Story-scoped stops are REQUIRED when navigating inside an open header or footer: the body's
154
+ * stops describe a different story, and moving through them would walk the caret out of the
155
+ * furniture the user is editing.
156
+ */
157
+ interface MoveCaretOptions {
158
+ /**
159
+ * Precomputed stops for the active story. Open header/footer navigation MUST pass
160
+ * story-scoped stops from {@link caretStopsForBlocks}; body keeps the default.
161
+ */
162
+ readonly stops?: readonly CaretGeometry[];
163
+ readonly measurer?: TextMeasurer;
164
+ }
165
+ /**
166
+ * Move a caret.
167
+ *
168
+ * Vertical movement keeps a DESIRED X so a caret travelling through short lines returns to
169
+ * its original column rather than collapsing to the end of the shortest one. The caller
170
+ * threads that value; passing null starts a fresh vertical run from the current position.
171
+ */
172
+ declare function moveCaret(layout: SemanticLayout, position: SemanticPosition, command: NavigationCommand, desiredX?: number | null, options?: MoveCaretOptions): {
173
+ position: SemanticPosition;
174
+ desiredX: number | null;
175
+ } | null;
176
+ /**
177
+ * The anchor an IME composition is attached to.
178
+ *
179
+ * Composition needs a position that survives the intermediate transactions it produces, so
180
+ * it is expressed in model coordinates and re-resolved against each new layout rather than
181
+ * cached as geometry.
182
+ */
183
+ declare function compositionAnchor(layout: SemanticLayout, position: SemanticPosition): CaretGeometry | null;
184
+ /** The style spans a selection touches, for reporting active formatting. */
185
+ declare function spansInSelection(layout: SemanticLayout, selection: SemanticSelection): StyleSpanRecord[];
186
+
187
+ export { type CaretGeometry as C, type KeyedRange as K, type MoveCaretOptions as M, type NavigationCommand as N, type SemanticPosition as S, type SemanticSelection as a, type CaretAtOptions as b, type SelectionRect as c, caretAt as d, caretStops as e, caretStopsForBlocks as f, compositionAnchor as g, contentControlAtSemantic as h, contentControlsInLayout as i, documentOrder as j, hitTestSemantic as k, keyedRangeRects as l, moveCaret as m, spansInSelection as n, paragraphTextFromLayout as p, selectionRects as s, wordBoundary as w };
@@ -0,0 +1,21 @@
1
+ import { V as ValidatedImageBytesHandle, R as RenderableImageMime } from './image-resources-BJnTpG66.js';
2
+
3
+ /** Host port for safe blob URLs — only called for {@link ImageResourceState.kind} `ready`. */
4
+ interface PaintImageUrlPort {
5
+ create(handle: ValidatedImageBytesHandle, mime: RenderableImageMime): string;
6
+ revoke(url: string): void;
7
+ }
8
+ /** Localized refusal labels; adapters supply i18n-backed implementations. */
9
+ interface DrawingPaintStrings {
10
+ readonly unsupportedFormat: (format: string) => string;
11
+ readonly nonPictureGraphic: (kind: string) => string;
12
+ readonly missingResource: string;
13
+ readonly externalResource: string;
14
+ readonly invalidResource: string;
15
+ readonly contentMismatch: string;
16
+ readonly decodeFailed: string;
17
+ readonly resourceLimit: string;
18
+ readonly pendingResource: string;
19
+ }
20
+
21
+ export type { DrawingPaintStrings as D, PaintImageUrlPort as P };
@@ -0,0 +1,21 @@
1
+ import { V as ValidatedImageBytesHandle, R as RenderableImageMime } from './image-resources-BpIydXtU.cjs';
2
+
3
+ /** Host port for safe blob URLs — only called for {@link ImageResourceState.kind} `ready`. */
4
+ interface PaintImageUrlPort {
5
+ create(handle: ValidatedImageBytesHandle, mime: RenderableImageMime): string;
6
+ revoke(url: string): void;
7
+ }
8
+ /** Localized refusal labels; adapters supply i18n-backed implementations. */
9
+ interface DrawingPaintStrings {
10
+ readonly unsupportedFormat: (format: string) => string;
11
+ readonly nonPictureGraphic: (kind: string) => string;
12
+ readonly missingResource: string;
13
+ readonly externalResource: string;
14
+ readonly invalidResource: string;
15
+ readonly contentMismatch: string;
16
+ readonly decodeFailed: string;
17
+ readonly resourceLimit: string;
18
+ readonly pendingResource: string;
19
+ }
20
+
21
+ export type { DrawingPaintStrings as D, PaintImageUrlPort as P };