plitejs 54.0.0-beta.2 → 54.0.0-beta.3

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 (865) hide show
  1. package/dist/{internal/view/annotation-store-metrics.js → annotation-store-metrics-Ccjkef45.js} +1 -1
  2. package/dist/annotations/index.d.ts +1 -1
  3. package/dist/annotations/index.js +1 -1
  4. package/dist/authored/index.d.ts +596 -9
  5. package/dist/authored/index.js +18557 -4
  6. package/dist/{core/authored-veto.js → authored-veto-DSnQcHGR.js} +2 -2
  7. package/dist/{internal/browser-protocol.js → browser-protocol-pvt4HFF7.js} +1 -1
  8. package/dist/comparison-plan-CEQL0ooW.js +1338 -0
  9. package/dist/{diff/lib/comparison-types.d.ts → comparison-types-Dt-unJZY.d.ts} +11 -6
  10. package/dist/create-editor-CkHtPWXV.js +1107 -0
  11. package/dist/diff/index.d.ts +31 -3
  12. package/dist/diff/index.js +1747 -1
  13. package/dist/dom/index.d.ts +2 -19
  14. package/dist/dom/index.js +2 -16
  15. package/dist/dom-Cgfscvnm.js +9220 -0
  16. package/dist/{core/same-result.js → editor-owner-IUmkTeXz.js} +77 -2
  17. package/dist/{core/editor-view-lifetime.js → editor-view-lifetime-GJKa_QGh.js} +1 -1
  18. package/dist/history/index.d.ts +169 -3
  19. package/dist/history/index.js +6717 -2
  20. package/dist/hyperscript/index.d.ts +1 -19
  21. package/dist/hyperscript/index.js +1 -8
  22. package/dist/{hyperscript/creators.js → hyperscript-FPuoArEi.js} +134 -8
  23. package/dist/index-BpQx2UG4.d.ts +1093 -0
  24. package/dist/{yjs/core/plugin.d.ts → index-Cw-oC2ps.d.ts} +88 -5
  25. package/dist/{annotations/store.d.ts → index-DPWyk3lG.d.ts} +21 -6
  26. package/dist/index-DpltOCot.d.ts +9753 -0
  27. package/dist/index-HPYawTae.d.ts +119 -0
  28. package/dist/index-K0Za9YXc.d.ts +1246 -0
  29. package/dist/index.d.ts +1 -50
  30. package/dist/index.js +4 -34
  31. package/dist/internal/index.d.ts +2 -54
  32. package/dist/internal/index.js +156 -52
  33. package/dist/{internal/view/mapped-view-store.js → mapped-view-store-ld-6uxEU.js} +2 -3
  34. package/dist/{core/native-grouping-input.js → native-grouping-input-DMNcsIaW.js} +2 -2
  35. package/dist/pagination/index.d.ts +1 -7
  36. package/dist/pagination/index.js +1 -693
  37. package/dist/pagination/react.d.ts +2 -4
  38. package/dist/pagination/react.js +436 -30
  39. package/dist/pagination-D_A8iPJP.js +1021 -0
  40. package/dist/plugin-DWzkJbnJ.js +50999 -0
  41. package/dist/{react/range-geometry.d.ts → range-geometry-BLAHRE11.d.ts} +2 -2
  42. package/dist/{react/range-geometry.js → range-geometry-BjeLHOnl.js} +23 -18
  43. package/dist/react/index.d.ts +5 -97
  44. package/dist/react/index.js +7 -72
  45. package/dist/react/virtualized.d.ts +2 -4
  46. package/dist/react/virtualized.js +146 -7
  47. package/dist/react-DZ15gmz2.js +1018 -0
  48. package/dist/{core/change/retraction.js → retraction-BMem8Rfk.js} +16 -4
  49. package/dist/src-cT1OTKP_.js +1386 -0
  50. package/dist/{internal/view/stable-id-mapped-source.js → store-Cz2mXyDe.js} +240 -3
  51. package/dist/testing/index.d.ts +182 -8
  52. package/dist/testing/index.js +95 -8
  53. package/dist/use-editor-dom-scope-BbMDSCpW.js +28354 -0
  54. package/dist/yjs/index.d.ts +1 -4
  55. package/dist/yjs/index.js +1 -2
  56. package/dist/yjs/react/index.d.ts +25 -5
  57. package/dist/yjs/react/index.js +84 -3
  58. package/dist/yjs-DOK-m7kl.js +13413 -0
  59. package/package.json +1 -1
  60. package/dist/annotations/store.js +0 -244
  61. package/dist/authored/authored.d.ts +0 -116
  62. package/dist/authored/authored.js +0 -1271
  63. package/dist/authored/changes.js +0 -365
  64. package/dist/authored/comparison.d.ts +0 -41
  65. package/dist/authored/comparison.js +0 -270
  66. package/dist/authored/decision-window.js +0 -42
  67. package/dist/authored/decision.js +0 -306
  68. package/dist/authored/facts/admission.js +0 -388
  69. package/dist/authored/facts/compact.d.ts +0 -2
  70. package/dist/authored/facts/compact.js +0 -91
  71. package/dist/authored/facts/dependencies.d.ts +0 -5
  72. package/dist/authored/facts/dependencies.js +0 -66
  73. package/dist/authored/facts/editing.js +0 -12
  74. package/dist/authored/facts/facts.d.ts +0 -8
  75. package/dist/authored/facts/facts.js +0 -535
  76. package/dist/authored/facts/records.d.ts +0 -28
  77. package/dist/authored/facts/records.js +0 -226
  78. package/dist/authored/facts/settle.js +0 -529
  79. package/dist/authored/format.d.ts +0 -34
  80. package/dist/authored/format.js +0 -175
  81. package/dist/authored/ledger/book.js +0 -809
  82. package/dist/authored/ledger/cards.js +0 -223
  83. package/dist/authored/ledger/ledger.js +0 -830
  84. package/dist/authored/ledger/level.js +0 -1081
  85. package/dist/authored/ledger/links.js +0 -20
  86. package/dist/authored/ledger/pairs.js +0 -334
  87. package/dist/authored/ledger/places.js +0 -524
  88. package/dist/authored/ledger/preview-lens.js +0 -252
  89. package/dist/authored/ledger/projection.js +0 -163
  90. package/dist/authored/ledger/roots.js +0 -11
  91. package/dist/authored/ledger/runs.js +0 -480
  92. package/dist/authored/ledger/slots.js +0 -330
  93. package/dist/authored/ledger/work.js +0 -66
  94. package/dist/authored/refusal.d.ts +0 -33
  95. package/dist/authored/refusal.js +0 -188
  96. package/dist/authored/resolve-schema.js +0 -62
  97. package/dist/authored/tree/alignment.js +0 -456
  98. package/dist/authored/tree/carried.js +0 -205
  99. package/dist/authored/tree/command-values.js +0 -344
  100. package/dist/authored/tree/cuts.js +0 -320
  101. package/dist/authored/tree/grid.js +0 -49
  102. package/dist/authored/tree/halves.js +0 -120
  103. package/dist/authored/tree/holders.js +0 -345
  104. package/dist/authored/tree/holds.js +0 -135
  105. package/dist/authored/tree/layers.d.ts +0 -49
  106. package/dist/authored/tree/layers.js +0 -354
  107. package/dist/authored/tree/marks.d.ts +0 -136
  108. package/dist/authored/tree/marks.js +0 -263
  109. package/dist/authored/tree/proposed.js +0 -212
  110. package/dist/authored/tree/readiness.js +0 -545
  111. package/dist/authored/tree/record-completion.js +0 -423
  112. package/dist/authored/tree/record.js +0 -2908
  113. package/dist/authored/tree/reserves.js +0 -449
  114. package/dist/authored/tree/resolve.d.ts +0 -9
  115. package/dist/authored/tree/resolve.js +0 -1860
  116. package/dist/authored/tree/shown.js +0 -153
  117. package/dist/authored/tree/spare-lines.js +0 -119
  118. package/dist/authored/tree/spares.js +0 -61
  119. package/dist/authored/types.d.ts +0 -177
  120. package/dist/core/anchor-state.d.ts +0 -15
  121. package/dist/core/anchor-state.js +0 -792
  122. package/dist/core/anchor.d.ts +0 -34
  123. package/dist/core/anchor.js +0 -843
  124. package/dist/core/authored-document-capability.d.ts +0 -106
  125. package/dist/core/authored-document-capability.js +0 -6
  126. package/dist/core/authored-runtime.d.ts +0 -10
  127. package/dist/core/authored-runtime.js +0 -67
  128. package/dist/core/authored-veto.d.ts +0 -30
  129. package/dist/core/change/builder.d.ts +0 -546
  130. package/dist/core/change/builder.js +0 -1120
  131. package/dist/core/change/carried-projection.js +0 -1518
  132. package/dist/core/change/carried-run.d.ts +0 -26
  133. package/dist/core/change/carried-run.js +0 -251
  134. package/dist/core/change/carry-program.js +0 -537
  135. package/dist/core/change/classification.d.ts +0 -22
  136. package/dist/core/change/classification.js +0 -205
  137. package/dist/core/change/cross-rule.js +0 -238
  138. package/dist/core/change/cross.js +0 -577
  139. package/dist/core/change/document-change.d.ts +0 -137
  140. package/dist/core/change/document-change.js +0 -872
  141. package/dist/core/change/document-index.d.ts +0 -117
  142. package/dist/core/change/document-index.js +0 -542
  143. package/dist/core/change/draft-facts.js +0 -323
  144. package/dist/core/change/enclosure.d.ts +0 -12
  145. package/dist/core/change/enclosure.js +0 -272
  146. package/dist/core/change/join.js +0 -751
  147. package/dist/core/change/json.d.ts +0 -4
  148. package/dist/core/change/json.js +0 -26
  149. package/dist/core/change/lazy-root.d.ts +0 -1
  150. package/dist/core/change/lazy-root.js +0 -73
  151. package/dist/core/change/lineage.d.ts +0 -49
  152. package/dist/core/change/lineage.js +0 -390
  153. package/dist/core/change/mapping.d.ts +0 -31
  154. package/dist/core/change/mapping.js +0 -186
  155. package/dist/core/change/new-letters.d.ts +0 -14
  156. package/dist/core/change/new-letters.js +0 -139
  157. package/dist/core/change/range-association.js +0 -10
  158. package/dist/core/change/read-back.d.ts +0 -7
  159. package/dist/core/change/read-back.js +0 -7
  160. package/dist/core/change/record.d.ts +0 -59
  161. package/dist/core/change/record.js +0 -346
  162. package/dist/core/change/root-change.d.ts +0 -180
  163. package/dist/core/change/root-change.js +0 -3544
  164. package/dist/core/change/slice-facts.js +0 -89
  165. package/dist/core/change/text-splices.js +0 -98
  166. package/dist/core/change/tokens.d.ts +0 -97
  167. package/dist/core/change/tokens.js +0 -449
  168. package/dist/core/change/transform.d.ts +0 -36
  169. package/dist/core/change/transform.js +0 -97
  170. package/dist/core/change/wrap-fidelity.js +0 -295
  171. package/dist/core/change-events.js +0 -223
  172. package/dist/core/clone.js +0 -28
  173. package/dist/core/command-definition.d.ts +0 -25
  174. package/dist/core/command-definition.js +0 -48
  175. package/dist/core/command-document.d.ts +0 -4
  176. package/dist/core/command-document.js +0 -20
  177. package/dist/core/command-frame.js +0 -628
  178. package/dist/core/command-registry.d.ts +0 -36
  179. package/dist/core/command-registry.js +0 -283
  180. package/dist/core/commit-publication.js +0 -40
  181. package/dist/core/commit.d.ts +0 -26
  182. package/dist/core/commit.js +0 -686
  183. package/dist/core/composition-stamp.d.ts +0 -14
  184. package/dist/core/composition-stamp.js +0 -79
  185. package/dist/core/content-completion.d.ts +0 -4
  186. package/dist/core/content-completion.js +0 -343
  187. package/dist/core/content-landing.js +0 -124
  188. package/dist/core/content-slice-roots.js +0 -36
  189. package/dist/core/content-slice.d.ts +0 -38
  190. package/dist/core/content-slice.js +0 -253
  191. package/dist/core/content.js +0 -18
  192. package/dist/core/correction.js +0 -25
  193. package/dist/core/default-storage.js +0 -53
  194. package/dist/core/document-admission.d.ts +0 -4
  195. package/dist/core/document-admission.js +0 -64
  196. package/dist/core/document-change.d.ts +0 -3
  197. package/dist/core/document-recorder.d.ts +0 -6
  198. package/dist/core/document-recorder.js +0 -67
  199. package/dist/core/document-shape.d.ts +0 -68
  200. package/dist/core/document-shape.js +0 -173
  201. package/dist/core/document-view-read.d.ts +0 -16
  202. package/dist/core/document-view-read.js +0 -36
  203. package/dist/core/draft-track.d.ts +0 -3
  204. package/dist/core/draft-track.js +0 -90
  205. package/dist/core/editor-commands.d.ts +0 -99
  206. package/dist/core/editor-commands.js +0 -505
  207. package/dist/core/editor-lifecycle-api.d.ts +0 -8
  208. package/dist/core/editor-lifecycle-api.js +0 -219
  209. package/dist/core/editor-lifetime.js +0 -12
  210. package/dist/core/editor-owner.d.ts +0 -24
  211. package/dist/core/editor-owner.js +0 -78
  212. package/dist/core/editor-read-execution.d.ts +0 -6
  213. package/dist/core/editor-read-execution.js +0 -64
  214. package/dist/core/editor-read-runtime.js +0 -176
  215. package/dist/core/editor-reads.d.ts +0 -128
  216. package/dist/core/editor-reads.js +0 -63
  217. package/dist/core/editor-runtime.d.ts +0 -112
  218. package/dist/core/editor-runtime.js +0 -20
  219. package/dist/core/editor-schema.d.ts +0 -314
  220. package/dist/core/editor-schema.js +0 -2295
  221. package/dist/core/element-owned-root-index.d.ts +0 -4
  222. package/dist/core/element-owned-root-index.js +0 -353
  223. package/dist/core/get-content-slice.js +0 -118
  224. package/dist/core/get-fragment.js +0 -22
  225. package/dist/core/identity-owner.js +0 -697
  226. package/dist/core/import-content-slice.js +0 -26
  227. package/dist/core/initial-value.js +0 -87
  228. package/dist/core/insert-limit.js +0 -81
  229. package/dist/core/is-empty-element.js +0 -20
  230. package/dist/core/json-fingerprint.js +0 -16
  231. package/dist/core/landing.d.ts +0 -11
  232. package/dist/core/landing.js +0 -279
  233. package/dist/core/lifecycle-error.d.ts +0 -11
  234. package/dist/core/lifecycle-error.js +0 -68
  235. package/dist/core/listener-state.d.ts +0 -1
  236. package/dist/core/listener-state.js +0 -59
  237. package/dist/core/measured-sequence.d.ts +0 -43
  238. package/dist/core/measured-sequence.js +0 -404
  239. package/dist/core/missing-reference.js +0 -15
  240. package/dist/core/node-property-mutation.js +0 -10
  241. package/dist/core/node-selection.js +0 -85
  242. package/dist/core/node-write-veto.d.ts +0 -37
  243. package/dist/core/node-write-veto.js +0 -17
  244. package/dist/core/persisted-document.d.ts +0 -6
  245. package/dist/core/persisted-document.js +0 -39
  246. package/dist/core/persistent-map.js +0 -139
  247. package/dist/core/plain-text.d.ts +0 -32
  248. package/dist/core/plain-text.js +0 -92
  249. package/dist/core/plugin-dispatch.d.ts +0 -21
  250. package/dist/core/plugin-dispatch.js +0 -166
  251. package/dist/core/plugin-point.d.ts +0 -6
  252. package/dist/core/plugin-point.js +0 -21
  253. package/dist/core/plugin-registry.d.ts +0 -78
  254. package/dist/core/plugin-registry.js +0 -485
  255. package/dist/core/plugin-slot.d.ts +0 -23
  256. package/dist/core/plugin-slot.js +0 -30
  257. package/dist/core/plugin.d.ts +0 -125
  258. package/dist/core/plugin.js +0 -1485
  259. package/dist/core/prefix-occupant-join.js +0 -52
  260. package/dist/core/profiling.js +0 -18
  261. package/dist/core/property-validity.d.ts +0 -14
  262. package/dist/core/property-validity.js +0 -65
  263. package/dist/core/public-root.d.ts +0 -10
  264. package/dist/core/public-root.js +0 -50
  265. package/dist/core/public-state.d.ts +0 -191
  266. package/dist/core/public-state.js +0 -6772
  267. package/dist/core/read-definition.js +0 -22
  268. package/dist/core/read-registry.js +0 -127
  269. package/dist/core/record-store.d.ts +0 -12
  270. package/dist/core/record-store.js +0 -297
  271. package/dist/core/refusal.d.ts +0 -1
  272. package/dist/core/refusal.js +0 -40
  273. package/dist/core/representation.d.ts +0 -11
  274. package/dist/core/representation.js +0 -844
  275. package/dist/core/resolved-token-cursor.d.ts +0 -21
  276. package/dist/core/resolved-token-cursor.js +0 -294
  277. package/dist/core/root-entries.js +0 -121
  278. package/dist/core/root-ownership.d.ts +0 -19
  279. package/dist/core/root-ownership.js +0 -354
  280. package/dist/core/root-target.d.ts +0 -7
  281. package/dist/core/root-target.js +0 -281
  282. package/dist/core/same-result.d.ts +0 -18
  283. package/dist/core/schema-compiler.d.ts +0 -345
  284. package/dist/core/schema-compiler.js +0 -3166
  285. package/dist/core/schema-contribution-registry.d.ts +0 -12
  286. package/dist/core/schema-contribution-registry.js +0 -88
  287. package/dist/core/schema-definition.d.ts +0 -307
  288. package/dist/core/schema-definition.js +0 -628
  289. package/dist/core/schema-source.internal.d.ts +0 -49
  290. package/dist/core/schema-validation.d.ts +0 -11
  291. package/dist/core/schema-validation.js +0 -85
  292. package/dist/core/screen-reader-announcement.d.ts +0 -13
  293. package/dist/core/screen-reader-announcement.js +0 -17
  294. package/dist/core/selection-protocol.d.ts +0 -38
  295. package/dist/core/selection-protocol.js +0 -523
  296. package/dist/core/selection-state.js +0 -9
  297. package/dist/core/semantic-update-method.d.ts +0 -11
  298. package/dist/core/semantic-update-method.js +0 -26
  299. package/dist/core/set-root.d.ts +0 -3
  300. package/dist/core/set-root.js +0 -244
  301. package/dist/core/slice-end-matter.js +0 -77
  302. package/dist/core/slice-fit/compiled-slice-fitter.d.ts +0 -56
  303. package/dist/core/slice-fit/compiled-slice-fitter.js +0 -2087
  304. package/dist/core/slice-fit/fit-report.d.ts +0 -36
  305. package/dist/core/slice-fit/fit-report.js +0 -122
  306. package/dist/core/slice-fit/frontier.js +0 -98
  307. package/dist/core/slice-fit/origin.js +0 -57
  308. package/dist/core/slice-fit/provenance.d.ts +0 -30
  309. package/dist/core/slice-fit/provenance.js +0 -245
  310. package/dist/core/slice-identities.js +0 -21
  311. package/dist/core/slice-landing-types.d.ts +0 -61
  312. package/dist/core/slice-landing.js +0 -124
  313. package/dist/core/snapshot-index.d.ts +0 -13
  314. package/dist/core/snapshot-index.js +0 -860
  315. package/dist/core/state-field.d.ts +0 -12
  316. package/dist/core/state-field.js +0 -102
  317. package/dist/core/state-fields.js +0 -36
  318. package/dist/core/survival.js +0 -61
  319. package/dist/core/target-runtime.d.ts +0 -5
  320. package/dist/core/target-runtime.js +0 -42
  321. package/dist/core/transaction-values.d.ts +0 -47
  322. package/dist/core/transaction-values.js +0 -66
  323. package/dist/core/transfer-guard.js +0 -299
  324. package/dist/core/transfer-types.d.ts +0 -170
  325. package/dist/core/transfer.d.ts +0 -72
  326. package/dist/core/transfer.js +0 -655
  327. package/dist/core/tx-only.d.ts +0 -64
  328. package/dist/core/tx-only.js +0 -84
  329. package/dist/core/unique-values.js +0 -298
  330. package/dist/core/update-context.js +0 -28
  331. package/dist/core/update-policy.d.ts +0 -17
  332. package/dist/core/update-policy.js +0 -45
  333. package/dist/core/value-codec.d.ts +0 -35
  334. package/dist/core/value-codec.js +0 -240
  335. package/dist/core/view-carets.d.ts +0 -39
  336. package/dist/core/view-carets.js +0 -676
  337. package/dist/core/view-presentation.d.ts +0 -9
  338. package/dist/core/view-presentation.js +0 -70
  339. package/dist/core/work.d.ts +0 -192
  340. package/dist/core/work.js +0 -122
  341. package/dist/core/writable-text.js +0 -37
  342. package/dist/create-editor.d.ts +0 -187
  343. package/dist/create-editor.js +0 -281
  344. package/dist/diff/lib/compare.d.ts +0 -33
  345. package/dist/diff/lib/compare.js +0 -459
  346. package/dist/diff/lib/comparison-align.js +0 -324
  347. package/dist/diff/lib/comparison-index.js +0 -160
  348. package/dist/diff/lib/comparison-internal.js +0 -108
  349. package/dist/diff/lib/comparison-matcher.js +0 -1221
  350. package/dist/diff/lib/comparison-moves.js +0 -151
  351. package/dist/diff/lib/comparison-plan.js +0 -556
  352. package/dist/diff/lib/index.d.ts +0 -3
  353. package/dist/dom/dom-soft-line-end.d.ts +0 -3
  354. package/dist/dom/dom-soft-line-end.js +0 -295
  355. package/dist/dom/internal/index.d.ts +0 -15
  356. package/dist/dom/plugin/data-transfer-format.d.ts +0 -90
  357. package/dist/dom/plugin/data-transfer-format.js +0 -525
  358. package/dist/dom/plugin/dom-clipboard-runtime.d.ts +0 -50
  359. package/dist/dom/plugin/dom-clipboard-runtime.js +0 -482
  360. package/dist/dom/plugin/dom-coverage.d.ts +0 -140
  361. package/dist/dom/plugin/dom-coverage.js +0 -443
  362. package/dist/dom/plugin/dom-drag-scroll.js +0 -176
  363. package/dist/dom/plugin/dom-drag.d.ts +0 -54
  364. package/dist/dom/plugin/dom-drag.js +0 -507
  365. package/dist/dom/plugin/dom-editor.d.ts +0 -421
  366. package/dist/dom/plugin/dom-editor.js +0 -1316
  367. package/dist/dom/plugin/dom-event-range-targets.js +0 -39
  368. package/dist/dom/plugin/dom-geometry.d.ts +0 -11
  369. package/dist/dom/plugin/dom-geometry.js +0 -888
  370. package/dist/dom/plugin/dom-input-runtime.d.ts +0 -1
  371. package/dist/dom/plugin/dom-input-runtime.js +0 -571
  372. package/dist/dom/plugin/dom-integrity-observer.js +0 -436
  373. package/dist/dom/plugin/dom-node-path.js +0 -61
  374. package/dist/dom/plugin/dom-phase-scheduler.d.ts +0 -1
  375. package/dist/dom/plugin/dom-phase-scheduler.js +0 -284
  376. package/dist/dom/plugin/dom-root-runtime.d.ts +0 -10
  377. package/dist/dom/plugin/dom-root-runtime.js +0 -716
  378. package/dist/dom/plugin/dom-sync-mutation-ownership.d.ts +0 -1
  379. package/dist/dom/plugin/dom-sync-mutation-ownership.js +0 -120
  380. package/dist/dom/plugin/dom-text-flow-index.js +0 -396
  381. package/dist/dom/plugin/dom-text-freshness.js +0 -188
  382. package/dist/dom/plugin/dom-text-proofs.d.ts +0 -2
  383. package/dist/dom/plugin/dom-text-proofs.js +0 -350
  384. package/dist/dom/plugin/dom-view-caret.js +0 -28
  385. package/dist/dom/plugin/with-dom.d.ts +0 -53
  386. package/dist/dom/plugin/with-dom.js +0 -101
  387. package/dist/dom/utils/constants.d.ts +0 -5
  388. package/dist/dom/utils/constants.js +0 -5
  389. package/dist/dom/utils/diff-text.d.ts +0 -51
  390. package/dist/dom/utils/diff-text.js +0 -264
  391. package/dist/dom/utils/dom.d.ts +0 -104
  392. package/dist/dom/utils/dom.js +0 -257
  393. package/dist/dom/utils/drag-session.d.ts +0 -2
  394. package/dist/dom/utils/drag-session.js +0 -115
  395. package/dist/dom/utils/drop-indicator.d.ts +0 -18
  396. package/dist/dom/utils/drop-indicator.js +0 -36
  397. package/dist/dom/utils/environment.d.ts +0 -12
  398. package/dist/dom/utils/environment.js +0 -118
  399. package/dist/dom/utils/hotkey-match.d.ts +0 -36
  400. package/dist/dom/utils/hotkey-match.js +0 -208
  401. package/dist/dom/utils/hotkeys.d.ts +0 -32
  402. package/dist/dom/utils/hotkeys.js +0 -121
  403. package/dist/dom/utils/key.d.ts +0 -14
  404. package/dist/dom/utils/key.js +0 -18
  405. package/dist/dom/utils/plite-dom-markers.d.ts +0 -26
  406. package/dist/dom/utils/plite-dom-markers.js +0 -25
  407. package/dist/dom/utils/selection-writes.d.ts +0 -18
  408. package/dist/dom/utils/selection-writes.js +0 -63
  409. package/dist/dom/utils/weak-maps.d.ts +0 -2
  410. package/dist/dom/utils/weak-maps.js +0 -51
  411. package/dist/editor/above.js +0 -30
  412. package/dist/editor/add-mark.js +0 -79
  413. package/dist/editor/adjacent-character-point.js +0 -120
  414. package/dist/editor/after.js +0 -37
  415. package/dist/editor/before.js +0 -124
  416. package/dist/editor/block-void-break.js +0 -20
  417. package/dist/editor/correct-document.js +0 -225
  418. package/dist/editor/delete-backward.js +0 -64
  419. package/dist/editor/delete-forward.js +0 -11
  420. package/dist/editor/delete-fragment.js +0 -40
  421. package/dist/editor/edges.js +0 -5
  422. package/dist/editor/element-read-only.js +0 -35
  423. package/dist/editor/end.d.ts +0 -7
  424. package/dist/editor/end.js +0 -5
  425. package/dist/editor/exit-break.js +0 -51
  426. package/dist/editor/first.js +0 -8
  427. package/dist/editor/get-void.js +0 -9
  428. package/dist/editor/has-blocks.js +0 -6
  429. package/dist/editor/has-inlines.js +0 -6
  430. package/dist/editor/has-path.js +0 -5
  431. package/dist/editor/has-texts.js +0 -5
  432. package/dist/editor/insert-break.js +0 -77
  433. package/dist/editor/insert-default-child.js +0 -55
  434. package/dist/editor/insert-soft-break.js +0 -14
  435. package/dist/editor/insert-text.js +0 -83
  436. package/dist/editor/is-block.js +0 -5
  437. package/dist/editor/is-edge.js +0 -5
  438. package/dist/editor/is-editor.js +0 -13
  439. package/dist/editor/is-empty.js +0 -6
  440. package/dist/editor/is-end.js +0 -9
  441. package/dist/editor/is-start.js +0 -9
  442. package/dist/editor/last.js +0 -20
  443. package/dist/editor/leaf.js +0 -9
  444. package/dist/editor/levels.js +0 -21
  445. package/dist/editor/next.js +0 -46
  446. package/dist/editor/node.js +0 -9
  447. package/dist/editor/nodes.js +0 -106
  448. package/dist/editor/parent.js +0 -14
  449. package/dist/editor/path.js +0 -26
  450. package/dist/editor/point.js +0 -52
  451. package/dist/editor/positions.js +0 -322
  452. package/dist/editor/previous.js +0 -48
  453. package/dist/editor/project-range.js +0 -6
  454. package/dist/editor/range.js +0 -12
  455. package/dist/editor/remove-mark.js +0 -65
  456. package/dist/editor/should-merge-nodes-remove-prev-node.js +0 -11
  457. package/dist/editor/string.js +0 -35
  458. package/dist/editor/toggle-mark.js +0 -71
  459. package/dist/editor/unhang-range.js +0 -71
  460. package/dist/editor-runtime-view.d.ts +0 -33
  461. package/dist/editor-runtime-view.js +0 -788
  462. package/dist/history/history-carets.js +0 -127
  463. package/dist/history/history-character-map.js +0 -425
  464. package/dist/history/history-codec.js +0 -176
  465. package/dist/history/history-merge-policy.js +0 -164
  466. package/dist/history/history-plugin.d.ts +0 -71
  467. package/dist/history/history-plugin.js +0 -814
  468. package/dist/history/history-replay.js +0 -799
  469. package/dist/history/history-selection.js +0 -75
  470. package/dist/history/history-state.js +0 -1287
  471. package/dist/history/history.d.ts +0 -112
  472. package/dist/history/history.js +0 -29
  473. package/dist/hyperscript/creators.d.ts +0 -51
  474. package/dist/hyperscript/hyperscript.d.ts +0 -36
  475. package/dist/hyperscript/hyperscript.js +0 -66
  476. package/dist/hyperscript/tokens.d.ts +0 -31
  477. package/dist/hyperscript/tokens.js +0 -63
  478. package/dist/interfaces/decoration.d.ts +0 -35
  479. package/dist/interfaces/editor.d.ts +0 -2783
  480. package/dist/interfaces/editor.js +0 -348
  481. package/dist/interfaces/element.d.ts +0 -66
  482. package/dist/interfaces/element.js +0 -34
  483. package/dist/interfaces/index.d.ts +0 -13
  484. package/dist/interfaces/json.d.ts +0 -7
  485. package/dist/interfaces/location.d.ts +0 -50
  486. package/dist/interfaces/location.js +0 -26
  487. package/dist/interfaces/node.d.ts +0 -306
  488. package/dist/interfaces/node.js +0 -339
  489. package/dist/interfaces/path.d.ts +0 -118
  490. package/dist/interfaces/path.js +0 -116
  491. package/dist/interfaces/point.d.ts +0 -45
  492. package/dist/interfaces/point.js +0 -32
  493. package/dist/interfaces/range.d.ts +0 -80
  494. package/dist/interfaces/range.js +0 -85
  495. package/dist/interfaces/schema-validation.d.ts +0 -33
  496. package/dist/interfaces/schema.d.ts +0 -870
  497. package/dist/interfaces/selection.d.ts +0 -61
  498. package/dist/interfaces/selection.js +0 -106
  499. package/dist/interfaces/text.d.ts +0 -68
  500. package/dist/interfaces/text.js +0 -52
  501. package/dist/interfaces/transforms/node.d.ts +0 -222
  502. package/dist/interfaces/transforms/selection.d.ts +0 -48
  503. package/dist/interfaces/transforms/text.d.ts +0 -58
  504. package/dist/internal/browser-protocol.d.ts +0 -5
  505. package/dist/internal/document-range.d.ts +0 -9
  506. package/dist/internal/document-range.js +0 -31
  507. package/dist/internal/editor-options.d.ts +0 -37
  508. package/dist/internal/editor-options.js +0 -36
  509. package/dist/internal/fail-invariant.d.ts +0 -4
  510. package/dist/internal/fail-invariant.js +0 -6
  511. package/dist/internal/get-defined.js +0 -7
  512. package/dist/internal/law-check.js +0 -7
  513. package/dist/internal/range-text-marks.js +0 -31
  514. package/dist/internal/root-location.d.ts +0 -23
  515. package/dist/internal/root-location.js +0 -86
  516. package/dist/internal/text-run.d.ts +0 -13
  517. package/dist/internal/text-run.js +0 -44
  518. package/dist/internal/view/annotation-store-metrics.d.ts +0 -11
  519. package/dist/internal/view/view-source.d.ts +0 -20
  520. package/dist/pagination/page-composition.internal.js +0 -313
  521. package/dist/pagination/page-geometry.internal.js +0 -99
  522. package/dist/pagination/page-layout-engine-invalidation.internal.js +0 -20
  523. package/dist/pagination/page-mount-plan.js +0 -84
  524. package/dist/pagination/paged-view-lines.js +0 -163
  525. package/dist/range-projection.d.ts +0 -7
  526. package/dist/range-projection.js +0 -50
  527. package/dist/react/components/dom-coverage-boundary.d.ts +0 -14
  528. package/dist/react/components/dom-coverage-boundary.js +0 -143
  529. package/dist/react/components/editable-descendant-binding.js +0 -70
  530. package/dist/react/components/editable-dom-commit-fence.js +0 -107
  531. package/dist/react/components/editable-element-placement.d.ts +0 -2
  532. package/dist/react/components/editable-element-placement.js +0 -117
  533. package/dist/react/components/editable-external-text.js +0 -47
  534. package/dist/react/components/editable-node-equality.js +0 -25
  535. package/dist/react/components/editable-rendered-element.d.ts +0 -3
  536. package/dist/react/components/editable-rendered-element.js +0 -61
  537. package/dist/react/components/editable-text-blocks.d.ts +0 -192
  538. package/dist/react/components/editable-text-blocks.js +0 -896
  539. package/dist/react/components/editable-text-containers.d.ts +0 -3
  540. package/dist/react/components/editable-text-containers.js +0 -28
  541. package/dist/react/components/editable-text-flow.js +0 -1039
  542. package/dist/react/components/editable-text-pieces.d.ts +0 -7
  543. package/dist/react/components/editable-text-pieces.js +0 -193
  544. package/dist/react/components/editable-text.d.ts +0 -80
  545. package/dist/react/components/editable-text.js +0 -322
  546. package/dist/react/components/editable.d.ts +0 -35
  547. package/dist/react/components/editable.js +0 -406
  548. package/dist/react/components/editor-announcement-live-region.js +0 -113
  549. package/dist/react/components/plite-element.d.ts +0 -18
  550. package/dist/react/components/plite-element.js +0 -54
  551. package/dist/react/components/plite-leaf.d.ts +0 -18
  552. package/dist/react/components/plite-leaf.js +0 -21
  553. package/dist/react/components/plite-placeholder.d.ts +0 -19
  554. package/dist/react/components/plite-placeholder.js +0 -39
  555. package/dist/react/components/plite-spacer.js +0 -14
  556. package/dist/react/components/plite-text.d.ts +0 -23
  557. package/dist/react/components/plite-text.js +0 -32
  558. package/dist/react/components/plite-void-shell.js +0 -49
  559. package/dist/react/components/plite.d.ts +0 -45
  560. package/dist/react/components/plite.js +0 -297
  561. package/dist/react/components/text-string.js +0 -18
  562. package/dist/react/components/windowed-editable.internal.js +0 -51
  563. package/dist/react/components/zero-width-string.js +0 -26
  564. package/dist/react/context.js +0 -11
  565. package/dist/react/decoration-context.d.ts +0 -2
  566. package/dist/react/decoration-context.js +0 -22
  567. package/dist/react/decoration-source.d.ts +0 -11
  568. package/dist/react/decoration-source.js +0 -1030
  569. package/dist/react/dom-text-sync.d.ts +0 -24
  570. package/dist/react/dom-text-sync.js +0 -48
  571. package/dist/react/editable/android-composition.d.ts +0 -3
  572. package/dist/react/editable/android-composition.js +0 -496
  573. package/dist/react/editable/browser-handle.js +0 -515
  574. package/dist/react/editable/caret-engine.js +0 -681
  575. package/dist/react/editable/clipboard-input-strategy.js +0 -632
  576. package/dist/react/editable/composition-lease.d.ts +0 -3
  577. package/dist/react/editable/composition-lease.js +0 -350
  578. package/dist/react/editable/composition-state.js +0 -716
  579. package/dist/react/editable/content-root-boundaries.js +0 -79
  580. package/dist/react/editable/content-root-coordinate-navigation.js +0 -28
  581. package/dist/react/editable/content-root-navigation-actions.js +0 -190
  582. package/dist/react/editable/content-root-navigation.js +0 -819
  583. package/dist/react/editable/content-root-owner-target.js +0 -36
  584. package/dist/react/editable/content-root-owners.js +0 -191
  585. package/dist/react/editable/content-root-vertical-geometry.js +0 -60
  586. package/dist/react/editable/decoration-repair-bridge.js +0 -29
  587. package/dist/react/editable/dom-coverage-selection.js +0 -158
  588. package/dist/react/editable/dom-coverage-vertical-selection.js +0 -446
  589. package/dist/react/editable/dom-input-event.js +0 -14
  590. package/dist/react/editable/dom-repair-queue.d.ts +0 -7
  591. package/dist/react/editable/dom-repair-queue.js +0 -543
  592. package/dist/react/editable/dom-repair-text.js +0 -47
  593. package/dist/react/editable/editable-command-types.d.ts +0 -1
  594. package/dist/react/editable/editable-dom-runtime.d.ts +0 -66
  595. package/dist/react/editable/editable-dom-runtime.js +0 -1022
  596. package/dist/react/editable/editing-epoch-adapter.js +0 -46
  597. package/dist/react/editable/editing-kernel.d.ts +0 -7
  598. package/dist/react/editable/editing-kernel.js +0 -593
  599. package/dist/react/editable/external-text-binding.js +0 -43
  600. package/dist/react/editable/external-text-runtime.d.ts +0 -5
  601. package/dist/react/editable/external-text-runtime.js +0 -851
  602. package/dist/react/editable/history-focus.js +0 -71
  603. package/dist/react/editable/history-keyboard.d.ts +0 -4
  604. package/dist/react/editable/history-keyboard.js +0 -9
  605. package/dist/react/editable/input-controller.d.ts +0 -7
  606. package/dist/react/editable/input-controller.js +0 -175
  607. package/dist/react/editable/input-history.js +0 -21
  608. package/dist/react/editable/input-router.js +0 -742
  609. package/dist/react/editable/input-state.d.ts +0 -18
  610. package/dist/react/editable/input-state.js +0 -330
  611. package/dist/react/editable/input-target.js +0 -30
  612. package/dist/react/editable/install-browser-handle.d.ts +0 -12
  613. package/dist/react/editable/install-browser-handle.js +0 -18
  614. package/dist/react/editable/interaction-owner.js +0 -88
  615. package/dist/react/editable/keyboard-input-strategy.js +0 -730
  616. package/dist/react/editable/line-boundary.js +0 -37
  617. package/dist/react/editable/model-input-strategy.d.ts +0 -9
  618. package/dist/react/editable/model-input-strategy.js +0 -242
  619. package/dist/react/editable/model-selection-dom-preference.js +0 -11
  620. package/dist/react/editable/mutation-block-editing.js +0 -48
  621. package/dist/react/editable/mutation-controller.d.ts +0 -32
  622. package/dist/react/editable/mutation-controller.js +0 -632
  623. package/dist/react/editable/mutation-full-block-editing.d.ts +0 -2
  624. package/dist/react/editable/mutation-full-block-editing.js +0 -44
  625. package/dist/react/editable/mutation-history.d.ts +0 -3
  626. package/dist/react/editable/mutation-history.js +0 -146
  627. package/dist/react/editable/native-input-strategy.js +0 -86
  628. package/dist/react/editable/native-text-input-delta.js +0 -40
  629. package/dist/react/editable/placed-drag.js +0 -177
  630. package/dist/react/editable/plite-string-coordinate-placement.js +0 -46
  631. package/dist/react/editable/press-fence.d.ts +0 -2
  632. package/dist/react/editable/press-fence.js +0 -70
  633. package/dist/react/editable/projected-clipboard.js +0 -123
  634. package/dist/react/editable/projected-native-affordance.js +0 -30
  635. package/dist/react/editable/projected-selection-target.js +0 -13
  636. package/dist/react/editable/render-contract-monitor.d.ts +0 -3
  637. package/dist/react/editable/render-contract-monitor.js +0 -152
  638. package/dist/react/editable/root-interaction-controller.js +0 -1400
  639. package/dist/react/editable/root-interaction-dom-selection-replay.js +0 -40
  640. package/dist/react/editable/root-interaction-resolver.js +0 -116
  641. package/dist/react/editable/root-selector-sources.js +0 -90
  642. package/dist/react/editable/runtime-android-engine.js +0 -40
  643. package/dist/react/editable/runtime-before-input-events.js +0 -671
  644. package/dist/react/editable/runtime-browser-handle-events.js +0 -40
  645. package/dist/react/editable/runtime-clipboard-events.js +0 -169
  646. package/dist/react/editable/runtime-composition-events.js +0 -163
  647. package/dist/react/editable/runtime-drag-events.js +0 -136
  648. package/dist/react/editable/runtime-editor-api.d.ts +0 -20
  649. package/dist/react/editable/runtime-editor-api.js +0 -21
  650. package/dist/react/editable/runtime-event-engine.js +0 -213
  651. package/dist/react/editable/runtime-focus-mouse-events.js +0 -264
  652. package/dist/react/editable/runtime-input-events.js +0 -166
  653. package/dist/react/editable/runtime-kernel-trace.js +0 -185
  654. package/dist/react/editable/runtime-keyboard-events.js +0 -333
  655. package/dist/react/editable/runtime-live-state.js +0 -44
  656. package/dist/react/editable/runtime-mutation-state.js +0 -11
  657. package/dist/react/editable/runtime-repair-engine.js +0 -118
  658. package/dist/react/editable/runtime-root-engine.js +0 -244
  659. package/dist/react/editable/runtime-root-lifecycle.js +0 -118
  660. package/dist/react/editable/runtime-root-selection-export.js +0 -38
  661. package/dist/react/editable/runtime-root-selection-import.js +0 -54
  662. package/dist/react/editable/runtime-root-state.js +0 -62
  663. package/dist/react/editable/runtime-selection-engine.js +0 -260
  664. package/dist/react/editable/runtime-selection-state.js +0 -12
  665. package/dist/react/editable/runtime-target-bridge.js +0 -29
  666. package/dist/react/editable/schema-runtime-invalidation.js +0 -26
  667. package/dist/react/editable/selection-change-listener.js +0 -99
  668. package/dist/react/editable/selection-claim.d.ts +0 -3
  669. package/dist/react/editable/selection-claim.js +0 -398
  670. package/dist/react/editable/selection-controller.d.ts +0 -8
  671. package/dist/react/editable/selection-controller.js +0 -693
  672. package/dist/react/editable/selection-dom-range.js +0 -84
  673. package/dist/react/editable/selection-projected-dom.js +0 -156
  674. package/dist/react/editable/selection-reconciler.js +0 -630
  675. package/dist/react/editable/selection-runtime.js +0 -89
  676. package/dist/react/editable/selection-side-effect-policy.js +0 -20
  677. package/dist/react/editable/selection-triple-click.js +0 -48
  678. package/dist/react/editable/selection-void-target.js +0 -172
  679. package/dist/react/editable/set-root-endpoints.js +0 -75
  680. package/dist/react/editable/soft-line-end-delete.js +0 -106
  681. package/dist/react/editable/text-direction.js +0 -82
  682. package/dist/react/editable/typed-text.d.ts +0 -17
  683. package/dist/react/editable/typed-text.js +0 -89
  684. package/dist/react/editable/unread-press.d.ts +0 -2
  685. package/dist/react/editable/unread-press.js +0 -86
  686. package/dist/react/editable/view-caret-restore.js +0 -128
  687. package/dist/react/editable/view-lines.d.ts +0 -7
  688. package/dist/react/editable/view-lines.js +0 -166
  689. package/dist/react/external-text.d.ts +0 -131
  690. package/dist/react/history-step-views.d.ts +0 -4
  691. package/dist/react/history-step-views.js +0 -119
  692. package/dist/react/hooks/android-input-manager/android-input-manager.d.ts +0 -7
  693. package/dist/react/hooks/android-input-manager/android-input-manager.js +0 -716
  694. package/dist/react/hooks/android-input-manager/use-android-input-manager.js +0 -53
  695. package/dist/react/hooks/focus-plite-editable.js +0 -116
  696. package/dist/react/hooks/use-claim-editable-dom-commit.d.ts +0 -12
  697. package/dist/react/hooks/use-claim-editable-dom-commit.js +0 -31
  698. package/dist/react/hooks/use-drop-indicator.d.ts +0 -9
  699. package/dist/react/hooks/use-drop-indicator.js +0 -14
  700. package/dist/react/hooks/use-editable-clip.d.ts +0 -18
  701. package/dist/react/hooks/use-editable-clip.js +0 -31
  702. package/dist/react/hooks/use-editable-layout-pass.js +0 -53
  703. package/dist/react/hooks/use-editor-composing.d.ts +0 -7
  704. package/dist/react/hooks/use-editor-composing.js +0 -12
  705. package/dist/react/hooks/use-editor-context.d.ts +0 -10
  706. package/dist/react/hooks/use-editor-context.js +0 -18
  707. package/dist/react/hooks/use-editor-dom-scope.d.ts +0 -27
  708. package/dist/react/hooks/use-editor-dom-scope.js +0 -23
  709. package/dist/react/hooks/use-editor-focused.d.ts +0 -7
  710. package/dist/react/hooks/use-editor-focused.js +0 -12
  711. package/dist/react/hooks/use-editor-read-only.d.ts +0 -25
  712. package/dist/react/hooks/use-editor-read-only.js +0 -19
  713. package/dist/react/hooks/use-editor-runtime-state.d.ts +0 -18
  714. package/dist/react/hooks/use-editor-runtime-state.js +0 -38
  715. package/dist/react/hooks/use-editor-selection.d.ts +0 -10
  716. package/dist/react/hooks/use-editor-selection.js +0 -13
  717. package/dist/react/hooks/use-editor-selector.d.ts +0 -38
  718. package/dist/react/hooks/use-editor-selector.js +0 -265
  719. package/dist/react/hooks/use-editor-view-state.d.ts +0 -16
  720. package/dist/react/hooks/use-editor-view-state.js +0 -20
  721. package/dist/react/hooks/use-editor.d.ts +0 -26
  722. package/dist/react/hooks/use-editor.js +0 -27
  723. package/dist/react/hooks/use-element-path.d.ts +0 -7
  724. package/dist/react/hooks/use-element-path.js +0 -36
  725. package/dist/react/hooks/use-element-selected.d.ts +0 -26
  726. package/dist/react/hooks/use-element-selected.js +0 -91
  727. package/dist/react/hooks/use-element.d.ts +0 -13
  728. package/dist/react/hooks/use-element.js +0 -17
  729. package/dist/react/hooks/use-generic-selector.js +0 -91
  730. package/dist/react/hooks/use-hydrated.js +0 -12
  731. package/dist/react/hooks/use-isomorphic-layout-effect.js +0 -9
  732. package/dist/react/hooks/use-node-selector.d.ts +0 -40
  733. package/dist/react/hooks/use-node-selector.js +0 -102
  734. package/dist/react/hooks/use-plite-annotation-store.d.ts +0 -21
  735. package/dist/react/hooks/use-plite-annotation-store.js +0 -61
  736. package/dist/react/hooks/use-plite-annotations.d.ts +0 -9
  737. package/dist/react/hooks/use-plite-annotations.js +0 -16
  738. package/dist/react/hooks/use-plite-child-root.d.ts +0 -14
  739. package/dist/react/hooks/use-plite-child-root.js +0 -38
  740. package/dist/react/hooks/use-plite-content-root.d.ts +0 -21
  741. package/dist/react/hooks/use-plite-content-root.js +0 -26
  742. package/dist/react/hooks/use-plite-history.d.ts +0 -43
  743. package/dist/react/hooks/use-plite-history.js +0 -137
  744. package/dist/react/hooks/use-plite-node-ref.js +0 -513
  745. package/dist/react/hooks/use-plite-root-chrome.d.ts +0 -34
  746. package/dist/react/hooks/use-plite-root-chrome.js +0 -98
  747. package/dist/react/hooks/use-plite-runtime.d.ts +0 -86
  748. package/dist/react/hooks/use-plite-runtime.js +0 -433
  749. package/dist/react/hooks/use-runtime-focus-state.js +0 -37
  750. package/dist/react/hooks/use-selection-geometry.d.ts +0 -12
  751. package/dist/react/hooks/use-selection-geometry.js +0 -39
  752. package/dist/react/hooks/use-selection-view.d.ts +0 -14
  753. package/dist/react/hooks/use-selection-view.js +0 -14
  754. package/dist/react/hooks/use-state-field.d.ts +0 -26
  755. package/dist/react/hooks/use-state-field.js +0 -38
  756. package/dist/react/inactive-selection.js +0 -175
  757. package/dist/react/plugin/react-editor.d.ts +0 -20
  758. package/dist/react/plugin/react-editor.js +0 -6
  759. package/dist/react/plugin/with-react.d.ts +0 -108
  760. package/dist/react/plugin/with-react.js +0 -58
  761. package/dist/react/render-profiler.js +0 -20
  762. package/dist/react/root-key.js +0 -12
  763. package/dist/react/shell-runtime.js +0 -29
  764. package/dist/react/update-policy.d.ts +0 -10
  765. package/dist/react/update-policy.js +0 -15
  766. package/dist/react/utils/environment.js +0 -5
  767. package/dist/react/view-boundary-graph-core.d.ts +0 -1
  768. package/dist/react/view-boundary-graph-core.js +0 -208
  769. package/dist/react/view-boundary-graph.js +0 -105
  770. package/dist/react/view-selection-decoration.js +0 -97
  771. package/dist/react/view-selection.js +0 -184
  772. package/dist/react/viewport-boundary.js +0 -45
  773. package/dist/react/viewport-commands.d.ts +0 -1
  774. package/dist/react/viewport-commands.js +0 -17
  775. package/dist/react/viewport-plan.d.ts +0 -2
  776. package/dist/react/viewport-plan.js +0 -77
  777. package/dist/react/virtualized/use-virtualized-root-plan.js +0 -148
  778. package/dist/testing/createDataTransfer.d.ts +0 -4
  779. package/dist/testing/createDataTransfer.js +0 -13
  780. package/dist/testing/jsx.d.ts +0 -181
  781. package/dist/testing/jsx.js +0 -82
  782. package/dist/transforms-node/insert-nodes.js +0 -143
  783. package/dist/transforms-node/lift-nodes.js +0 -117
  784. package/dist/transforms-node/merge-nodes.js +0 -180
  785. package/dist/transforms-node/move-nodes.js +0 -58
  786. package/dist/transforms-node/remove-nodes.js +0 -86
  787. package/dist/transforms-node/replace-children.js +0 -117
  788. package/dist/transforms-node/set-nodes.js +0 -188
  789. package/dist/transforms-node/split-nodes.js +0 -258
  790. package/dist/transforms-node/unset-nodes.js +0 -10
  791. package/dist/transforms-node/unwrap-nodes.js +0 -182
  792. package/dist/transforms-node/wrap-nodes.js +0 -250
  793. package/dist/transforms-selection/collapse.js +0 -20
  794. package/dist/transforms-selection/deselect.js +0 -8
  795. package/dist/transforms-selection/move.js +0 -35
  796. package/dist/transforms-selection/select.js +0 -59
  797. package/dist/transforms-selection/set-point.js +0 -32
  798. package/dist/transforms-selection/set-selection.js +0 -52
  799. package/dist/transforms-text/delete-text-collapsed-path-targets.js +0 -102
  800. package/dist/transforms-text/delete-text-grid.js +0 -402
  801. package/dist/transforms-text/delete-text-inline-points.js +0 -82
  802. package/dist/transforms-text/delete-text-plan.js +0 -55
  803. package/dist/transforms-text/delete-text-removal.js +0 -153
  804. package/dist/transforms-text/delete-text-structural-cleanup.js +0 -130
  805. package/dist/transforms-text/delete-text-whole-blocks.js +0 -70
  806. package/dist/transforms-text/delete-text.js +0 -804
  807. package/dist/transforms-text/full-document-range.js +0 -12
  808. package/dist/transforms-text/insert-text.js +0 -314
  809. package/dist/types/types.d.ts +0 -13
  810. package/dist/utils/format-debug-value.d.ts +0 -8
  811. package/dist/utils/format-debug-value.js +0 -31
  812. package/dist/utils/get-default-insert-location.js +0 -19
  813. package/dist/utils/is-object.d.ts +0 -4
  814. package/dist/utils/is-object.js +0 -4
  815. package/dist/utils/match-path.js +0 -8
  816. package/dist/utils/node-keys.d.ts +0 -15
  817. package/dist/utils/node-keys.js +0 -179
  818. package/dist/utils/node-match.js +0 -9
  819. package/dist/utils/string.js +0 -283
  820. package/dist/yjs/core/addresses.js +0 -98
  821. package/dist/yjs/core/ancestor-properties.js +0 -56
  822. package/dist/yjs/core/attributes.js +0 -21
  823. package/dist/yjs/core/awareness-adapter.d.ts +0 -5
  824. package/dist/yjs/core/awareness-adapter.js +0 -399
  825. package/dist/yjs/core/awareness-relative-selection.js +0 -22
  826. package/dist/yjs/core/awareness.js +0 -25
  827. package/dist/yjs/core/binding.d.ts +0 -3
  828. package/dist/yjs/core/binding.js +0 -128
  829. package/dist/yjs/core/boundaries.js +0 -453
  830. package/dist/yjs/core/canonical-split.js +0 -130
  831. package/dist/yjs/core/change-bridge.js +0 -124
  832. package/dist/yjs/core/change-regions.js +0 -119
  833. package/dist/yjs/core/controller-registry.js +0 -70
  834. package/dist/yjs/core/controller.d.ts +0 -6
  835. package/dist/yjs/core/controller.js +0 -1282
  836. package/dist/yjs/core/document.js +0 -1499
  837. package/dist/yjs/core/editor-adapter.d.ts +0 -18
  838. package/dist/yjs/core/editor-adapter.js +0 -145
  839. package/dist/yjs/core/editor-only-roots.js +0 -53
  840. package/dist/yjs/core/editor-types.d.ts +0 -1
  841. package/dist/yjs/core/enclosures.js +0 -410
  842. package/dist/yjs/core/event-change-bridge.js +0 -3642
  843. package/dist/yjs/core/index.d.ts +0 -4
  844. package/dist/yjs/core/joined-lines.js +0 -81
  845. package/dist/yjs/core/joins.js +0 -587
  846. package/dist/yjs/core/json-equality.js +0 -31
  847. package/dist/yjs/core/keys.js +0 -29
  848. package/dist/yjs/core/letter-scripts.js +0 -449
  849. package/dist/yjs/core/new-letters.js +0 -300
  850. package/dist/yjs/core/path.js +0 -25
  851. package/dist/yjs/core/plugin.js +0 -206
  852. package/dist/yjs/core/record.js +0 -4
  853. package/dist/yjs/core/replacement.js +0 -165
  854. package/dist/yjs/core/retraction.js +0 -132
  855. package/dist/yjs/core/root-owners.js +0 -110
  856. package/dist/yjs/core/root-projection-index.js +0 -428
  857. package/dist/yjs/core/schema-metadata.js +0 -88
  858. package/dist/yjs/core/selection.js +0 -34
  859. package/dist/yjs/core/set-valued-attributes.js +0 -57
  860. package/dist/yjs/core/shared-effect-log.d.ts +0 -4
  861. package/dist/yjs/core/shared-effect-log.js +0 -674
  862. package/dist/yjs/core/text-runs.js +0 -1596
  863. package/dist/yjs/core/types.d.ts +0 -76
  864. package/dist/yjs/react/useYjs.d.ts +0 -25
  865. package/dist/yjs/react/useYjs.js +0 -85
@@ -1,2783 +0,0 @@
1
- import { EditorJsonValue } from "./json.js";
2
- import { Path } from "./path.js";
3
- import { Point } from "./point.js";
4
- import { Location, Span } from "./location.js";
5
- import { Range } from "./range.js";
6
- import { Anchor, AnchorOptions, AnchorValue, EditorDocumentRange } from "../core/anchor.js";
7
- import { Ancestor, Descendant, DescendantIn, Node, NodeEntry, NodeIn, NodeMatch, NodeProps, NodeTypeSelector } from "./node.js";
8
- import { EditorSelection, NodeSelection, NodeSelectionMode, Selection, SelectionValue } from "./selection.js";
9
- import { DocumentChange } from "../core/change/document-change.js";
10
- import { defineCommand as defineCommand$1 } from "../core/command-definition.js";
11
- import { TxOnlyMethod } from "../core/tx-only.js";
12
- import { LeafEdge, MaximizeMode, RangeMode, SelectionMode, TextDirection, TextUnit, TextUnitAdjustment } from "../types/types.js";
13
- import { BlockDuplicateOptions, NodeInsertNodesOptions, NodeInsertSplitOptions, NodeLiftNodesOptions, NodeMergeNodesOptions, NodeMoveNodesOptions, NodeMutationMethods, NodeRemoveNodesOptions, NodeReplaceChildrenOptions, NodeSetNodesOptions, NodeSplitNodesOptions, NodeUnsetNodesOptions, NodeUnwrapNodesOptions, NodeWrapNodesOptions } from "./transforms/node.js";
14
- import { SelectionCollapseOptions, SelectionMoveOptions, SelectionMutationMethods, SelectionSetPointOptions } from "./transforms/selection.js";
15
- import { TextDeleteOptions, TextInsertFragmentOptions, TextInsertTextOptions, TextMutationMethods } from "./transforms/text.js";
16
- import { Text } from "./text.js";
17
- import { Element, ElementIn, ElementOf, ElementOrTextIn } from "./element.js";
18
- import { EditorSchemaPluginProvider, EditorSchemaSource, SchemaDescendantInValue } from "../core/schema-source.internal.js";
19
- import { EditorSchemaDeclaration, EditorSchemaDelta, EditorSchemaElement, EditorSchemaIdentity, EditorSchemaProperty, EditorSchemaPropertyQuery, SchemaElementConstructionPropertiesFor, SchemaElementFor, SchemaElementHandle, SchemaElementTypes, SchemaPropertyHandle, SchemaValueFromPlugins } from "./schema.js";
20
- import "../index.js";
21
- //#region src/interfaces/editor.d.ts
22
- /**
23
- * The `Editor` interface exposes the runtime API of an editor. Document
24
- * state is read through editor methods and mutated through `editor.update`.
25
- */
26
- type Value = readonly Element[];
27
- type NodePropertyEntryIn<V extends Value> = NodeIn<V> extends (infer TNode) ? TNode extends Descendant ? { [TKey in Extract<keyof NodeProps<TNode>, string>]: Readonly<{
28
- key: TKey;
29
- value: NodeProps<TNode>[TKey];
30
- }>; }[Extract<keyof NodeProps<TNode>, string>] : never : never;
31
- type NodePropertyKeyIn<V extends Value> = NodePropertyEntryIn<V>['key'];
32
- type WithNodeKeyTarget<TOptions extends {
33
- at?: Location | NodeSelection;
34
- }> = Omit<TOptions, 'at'> & {
35
- at?: Location | NodeKey | NodeSelection;
36
- };
37
- type NodePropertyPatch<TProps> = TProps extends unknown ? { [TKey in keyof TProps]?: TProps[TKey] | undefined; } : never;
38
- type EditorNodeSetObject<V extends Value> = {
39
- <const TType extends NodeTypeSelector>(props: NodePropertyPatch<NodeProps<NodeForTypeSelector<TType>>>, options: WithNodeKeyTarget<NodeSetNodesOptions<NodeForTypeSelector<TType>, TType>> & {
40
- type: TType;
41
- }): void;
42
- <T extends Descendant>(props: NodePropertyPatch<NodeProps<NoInfer<T>>>, options: Omit<NodeSetNodesOptions<T>, 'at'> & {
43
- at: T;
44
- }): void;
45
- (props: [Value] extends [V] ? NodePropertyPatch<Omit<Element, 'children'>> : never, options?: WithNodeKeyTarget<NodeSetNodesOptions<Element>>): void;
46
- (props: NodePropertyPatch<NodeProps<NodeIn<V>>>, options?: WithNodeKeyTarget<NodeSetNodesOptions<NodeIn<V>>>): void;
47
- };
48
- type EditorBlockSetOptions<T extends Element, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> = {
49
- at?: NodeSelectionTarget;
50
- match?: NodeMatch<T>;
51
- mode?: MaximizeMode;
52
- type?: TType;
53
- voids?: boolean;
54
- };
55
- /**
56
- * Where `tx.blocks.insert` lands blocks: after a block, before one, or at an
57
- * exact path, one of the three. With none, the blocks land after the
58
- * selection's block, or at the end of the root without a selection.
59
- */
60
- type BlockInsertOptions<TAfter extends NodeSelectionTarget = NodeSelectionTarget> = ({
61
- after?: TAfter;
62
- at?: never;
63
- before?: never;
64
- /**
65
- * Replace the empty editable text block the blocks land after, instead
66
- * of keeping it.
67
- */
68
- replaceEmpty?: boolean;
69
- } | {
70
- after?: never;
71
- at?: never;
72
- before: NodeTarget;
73
- replaceEmpty?: never;
74
- } | {
75
- after?: never;
76
- /** Insert at this exact path, a slot among its parent's children. */
77
- at: Path;
78
- before?: never;
79
- replaceEmpty?: never;
80
- }) & {
81
- select?: boolean;
82
- voids?: boolean;
83
- };
84
- type EditorTransactionBlocksApi<V extends Value = Value> = {
85
- /**
86
- * Copy the target blocks, with the roots they own, and insert the copies
87
- * after the last of them. The copies pass through the `slice.export` read
88
- * over a block node selection of the blocks, then the `slice.landing` read
89
- * with intent `copy` and a `beside` target, so plugins shape what lands.
90
- * Changes nothing when a copy is not allowed at its place.
91
- */
92
- duplicate: {
93
- <const TType extends NodeTypeSelector>(options: Omit<BlockDuplicateOptions<NodeForTypeSelector<TType>, TType>, 'at'> & {
94
- at?: NodeSelectionTarget;
95
- type: TType;
96
- }): void;
97
- (options?: Omit<BlockDuplicateOptions<ElementIn<V>>, 'at'> & {
98
- at?: NodeSelectionTarget;
99
- }): void;
100
- };
101
- /**
102
- * Insert blocks where `options` places them and return the keys of the
103
- * top-level blocks that landed, in order. Each key resolves its block from
104
- * any root. The keys leave out a block the editor's length limit dropped. A
105
- * block that is live in another root lands under its source's key. Returns
106
- * `undefined` and changes nothing when the blocks do not fit the landing
107
- * parent's content, such as a parent at its child limit, when an `after` or
108
- * `before` target does not resolve, or when the length limit admits none of
109
- * them. An `at` path past its parent's last child, more than one placement,
110
- * or `replaceEmpty` beside `before` or `at` throws.
111
- */
112
- insert: <T extends ElementIn<V>>(nodes: T | readonly T[], options?: BlockInsertOptions) => readonly [NodeKey, ...NodeKey[]] | undefined;
113
- /**
114
- * Reset blocks to the immediate parent or root schema default, keeping the
115
- * properties a type change preserves and removing the `unset` properties
116
- * that default does not set. Returns `false` and changes nothing when any
117
- * block has no default it can become: its parent or root declares no
118
- * element default, the default lacks a required property nothing supplies,
119
- * its type change leaves the block's content without one, or the default is
120
- * not allowed at the block's position.
121
- */
122
- reset: (options?: {
123
- at?: NodeSelectionTarget;
124
- unset?: string | readonly string[] | SchemaPropertyHandle;
125
- }) => boolean;
126
- /**
127
- * Set props on every target block, all or nothing. A function patch is
128
- * called once per block before any block changes. Returns `false` and
129
- * changes nothing when no block is targeted, a patch is not allowed at its
130
- * block's position, or every block already matches its patch.
131
- */
132
- set: (props: NodePropertyPatch<NodeProps<ElementIn<V>>> | ((node: Readonly<ElementIn<V>>) => NodePropertyPatch<NodeProps<ElementIn<V>>>), options?: EditorBlockSetOptions<ElementIn<V>>) => boolean;
133
- /**
134
- * Set `props` on every target block, or, when any target already has them,
135
- * reset every target as `reset` does. With `wrap`, wrap the targets in a
136
- * `props` element or unwrap them from one. Returns `false` and changes
137
- * nothing when any target cannot take the change, and `false` when nothing
138
- * changed.
139
- */
140
- toggle: (props: NodePropertyPatch<NodeProps<ElementIn<V>>> & {
141
- type: string;
142
- }, options?: EditorBlockToggleOptions) => boolean;
143
- };
144
- type EditorNodeUnsetOptions<T extends Node, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> = {
145
- at?: NodeSelectionTarget;
146
- match?(node: T, path: Path): boolean;
147
- type?: TType;
148
- mode?: MaximizeMode;
149
- hanging?: boolean;
150
- split?: boolean;
151
- voids?: boolean;
152
- };
153
- type ValueDescendant<V extends Value> = [SchemaDescendantInValue<V>] extends [never] ? Extract<DescendantIn<V>, Descendant> : Extract<SchemaDescendantInValue<V>, Descendant>;
154
- type ValueElement<V extends Value> = Extract<ValueDescendant<V>, Element>;
155
- type ValueText<V extends Value> = Extract<ValueDescendant<V>, Text>;
156
- type ValueTreeNode<_V extends Value> = Node;
157
- type NodeForSelectorItem<TItem> = TItem extends SchemaElementHandle<infer TSchema, infer TElementType> ? TSchema extends EditorSchemaSource ? SchemaElementFor<TSchema, Extract<TElementType, SchemaElementTypes<TSchema>>> : never : TItem extends string ? string extends TItem ? Element : Element & {
158
- type: TItem;
159
- } : never;
160
- /** The element selected by a persisted type or raw schema element handle. */
161
- type NodeForTypeSelector<TType extends NodeTypeSelector> = TType extends ReadonlyArray<infer TItem> ? NodeForSelectorItem<TItem> : NodeForSelectorItem<TType>;
162
- type NodeInsertSplitTarget<V extends Value, TType extends NodeTypeSelector | undefined> = undefined extends TType ? NodeIn<V> : NodeForTypeSelector<Extract<TType, NodeTypeSelector>>;
163
- type RootKey = string;
164
- /** A named secondary root. Literal `main` is never a public root argument. */
165
- type NamedRootKey<TRoot extends RootKey = RootKey> = TRoot extends 'main' ? never : TRoot;
166
- /** An element that owns a named root, at its place in the document. */
167
- type EditorRootOwner = Readonly<{
168
- path: Path;
169
- /** The owner's root, absent when the owner is on the page. */
170
- root?: NamedRootKey;
171
- /** The owner's `contentRoots` slot that names the root. */
172
- slot: string;
173
- }>;
174
- /** A named root with the elements that own it, as `read.roots()` lists it. */
175
- type EditorRootEntry = Readonly<{
176
- /** The elements that own the root, in reading order. */
177
- owners: readonly EditorRootOwner[];
178
- root: NamedRootKey;
179
- /**
180
- * The path of the page element that holds the root through its first
181
- * owners, or `null` when no chain of owners reaches the page.
182
- */
183
- top: Path | null;
184
- }>;
185
- /**
186
- * Keyed data a plugin keeps beside the document's children, by record set and
187
- * then by record id. Records have no position, so no read of `children` or
188
- * `roots` meets them, and a set never drops a record while people edit.
189
- */
190
- type EditorDocumentRecords = Readonly<Record<string, Readonly<Record<string, Readonly<Record<string, unknown>>>>>>;
191
- type EditorDocumentValue<V extends Value = Value> = Readonly<{
192
- children: V;
193
- meta?: Readonly<Record<string, unknown>>;
194
- /** Omitted when no record set holds a record. */
195
- records?: EditorDocumentRecords;
196
- roots?: Readonly<Record<RootKey, V>>;
197
- }>;
198
- /** Schema-owned structural document content, excluding state-field metadata. */
199
- type EditorSchemaDocumentValue<V extends Value = Value> = Readonly<{
200
- children: V;
201
- roots?: Readonly<Record<RootKey, V>>;
202
- }>;
203
- type InitialValue<V extends Value = Value> = V | Readonly<{
204
- children: V;
205
- meta?: Readonly<Record<string, unknown>>;
206
- records?: EditorDocumentRecords;
207
- roots?: Readonly<Record<RootKey, V>>;
208
- }>;
209
- /** A document location, node key, or live node to resolve. */
210
- type NodeTarget<N extends Descendant = Descendant> = Location | N | NodeKey;
211
- type EditorReplaceChildrenOptions = Omit<NodeReplaceChildrenOptions, 'at'> & ({
212
- at: Path;
213
- /** Named root the path addresses. Omit for this editor's or view's root. */
214
- root?: NamedRootKey;
215
- } | {
216
- at: Exclude<NodeTarget<Element>, Path>;
217
- root?: never;
218
- });
219
- /** Options for replacing exactly one node with zero or more nodes. */
220
- type EditorReplaceNodeOptions = {
221
- at: Descendant | NodeKey | Path;
222
- select?: boolean;
223
- };
224
- type NodeSelectionTarget<TNode extends Descendant = Descendant> = NodeSelection | NodeTarget<TNode>;
225
- type WithNodeTarget<TOptions extends {
226
- at?: Location;
227
- }, TNode extends Descendant = Descendant> = Omit<TOptions, 'at'> & {
228
- at?: NodeTarget<TNode>;
229
- };
230
- type WithNodeTargetOrSpan<TOptions extends {
231
- at?: Location | NodeSelection | Span;
232
- }, TNode extends Descendant = Descendant> = Omit<TOptions, 'at'> & {
233
- at?: NodeSelectionTarget<TNode> | Span;
234
- };
235
- type EditorNodesReadOptions<T extends Node, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> = WithNodeTargetOrSpan<EditorNodesOptions<T, TType>>;
236
- type EditorBlocksReadOptions<T extends Node, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> = Omit<EditorNodesReadOptions<T, TType>, 'pass' | 'universal'> & {
237
- /**
238
- * `'full'` reads only the blocks whose whole content the target covers, at
239
- * every depth unless `mode` says otherwise. A path covers its block and
240
- * every block inside it. A range covers a block with content when it runs
241
- * from the block's start to its end, so one that ends at its start does
242
- * not. An empty block counts as covered when a range reaches its start, a
243
- * block that holds blocks is covered when each of them is, and a collapsed
244
- * range covers none. `mode` then picks among the covered blocks.
245
- */
246
- coverage?: 'full';
247
- };
248
- type EditorNodeGetOptions<T extends Node, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> = {
249
- match?: NodeMatch<T>;
250
- type?: TType;
251
- };
252
- type StateFieldCollabPolicy = 'local' | 'shared';
253
- type StateFieldHistoryPolicy = 'push' | 'skip';
254
- /** Result of replaying one live-session history effect. */
255
- type EditorEffectHistoryReplayResult<TValue = unknown> = Readonly<{
256
- status: 'applied';
257
- value: TValue;
258
- }> | Readonly<{
259
- reason: string;
260
- status: 'blocked';
261
- }>;
262
- /** Final outcome of a replay that waited on its effect owner or failed. */
263
- type HistorySettlement = Readonly<{
264
- status: 'applied';
265
- }> | Readonly<{
266
- reason: string;
267
- status: 'blocked';
268
- }> | Readonly<{
269
- status: 'failed';
270
- }>;
271
- /** Outcome of an undo or redo that has finished. */
272
- type HistoryOutcome = HistorySettlement | Readonly<{
273
- status: 'busy' | 'empty';
274
- }> | Readonly<{
275
- conflicts: readonly string[];
276
- status: 'blocked';
277
- }>;
278
- /**
279
- * Result of one undo or redo call. A document batch has already applied or
280
- * failed when the call returns; only a batch whose effect owner is still
281
- * working returns `pending`.
282
- */
283
- type HistoryResult = HistoryOutcome | Readonly<{
284
- /** Resolves once the effect owner finishes. Never rejects. */
285
- settled: Promise<HistorySettlement>;
286
- status: 'pending';
287
- }>;
288
- type HistoryApi = {
289
- /** Replay the current redo batch as one complete editor update. */
290
- redo: () => HistoryResult;
291
- /** Replay the current undo batch as one complete editor update. */
292
- undo: () => HistoryResult;
293
- };
294
- type StateFieldInitial<TValue> = TValue | (() => TValue);
295
- /** Versioned persistence for one live editor value. */
296
- type EditorValuePersistence<TValue = unknown, TEncoded extends EditorJsonValue = EditorJsonValue> = Readonly<{
297
- decode: (value: unknown) => TValue;
298
- encode: (value: TValue) => TEncoded;
299
- legacyDecoders?: Readonly<Record<number, (value: unknown) => TValue>>;
300
- /** Current positive integer envelope version. */
301
- version: number;
302
- }>;
303
- /** JSON envelope produced by versioned editor value persistence. */
304
- type SerializedEditorValue<TEncoded extends EditorJsonValue = EditorJsonValue> = Readonly<{
305
- value: TEncoded;
306
- version: number;
307
- }>;
308
- /** JSON envelope for one typed editor effect. */
309
- type SerializedEditorEffect<TEncoded extends EditorJsonValue = EditorJsonValue> = SerializedEditorValue<TEncoded> & Readonly<{
310
- key: string;
311
- }>;
312
- /** JSON envelope for one installed editor selection kind. */
313
- type SerializedEditorSelection<TEncoded extends EditorJsonValue = EditorJsonValue> = SerializedEditorValue<TEncoded> & Readonly<{
314
- kind: string;
315
- }>;
316
- type StateFieldDescriptor<TValue = unknown, TEncoded extends EditorJsonValue = EditorJsonValue> = Readonly<{
317
- collab?: StateFieldCollabPolicy;
318
- /** Suppresses transitions whose stored values are semantically equal. */
319
- compare?: (left: TValue, right: TValue) => boolean;
320
- history?: StateFieldHistoryPolicy;
321
- initial?: StateFieldInitial<TValue>;
322
- key: string;
323
- persist?: EditorValuePersistence<TValue, TEncoded>;
324
- reduce?: (value: TValue, effect: EditorEffect) => TValue;
325
- }>;
326
- type StateFieldValueInput<TValue> = TValue | ((previous: TValue) => TValue);
327
- type StateFieldTransition<TValue> = Readonly<{
328
- previousValue: TValue;
329
- value: TValue;
330
- }>;
331
- type EditorStateField<TValue = unknown, TEncoded extends EditorJsonValue = EditorJsonValue> = PluginDefinitionInput & Readonly<{
332
- name: string;
333
- }> & Omit<StateFieldDescriptor<TValue, TEncoded>, 'compare'> & {
334
- compare: (left: TValue, right: TValue) => boolean;
335
- deserialize: (value: unknown) => TValue;
336
- effect: EditorEffectType<StateFieldTransition<TValue>>;
337
- serialize: (value: TValue) => SerializedEditorValue<TEncoded>;
338
- };
339
- /** Yjs-agnostic helpers supplied by a collaboration adapter while encoding. */
340
- type EditorEffectCollabEncodeContext = Readonly<{
341
- point: (point: Point) => unknown;
342
- range: (range: Range) => unknown;
343
- }>;
344
- /** Yjs-agnostic helpers supplied by a collaboration adapter while decoding. */
345
- type EditorEffectCollabDecodeContext = Readonly<{
346
- point: (value: unknown) => Point | null;
347
- range: (value: unknown) => Range | null;
348
- }>;
349
- /**
350
- * Maps a persisted effect payload through collaboration-relative positions.
351
- * Returning `undefined` while decoding drops an effect whose target vanished.
352
- */
353
- type EditorEffectCollabTransport<TValue = unknown> = Readonly<{
354
- decode: (value: unknown, context: EditorEffectCollabDecodeContext) => TValue | undefined;
355
- encode: (value: TValue, context: EditorEffectCollabEncodeContext) => unknown;
356
- }>;
357
- /**
358
- * Persistence semantics for a shared collaboration effect.
359
- *
360
- * `latest` is reserved for absolute, idempotent restore values. `live` effects
361
- * are delivered exactly once to causally registered active peers and are
362
- * intentionally absent from late-join checkpoints.
363
- */
364
- type EditorEffectCollabReplay = 'latest' | 'live';
365
- type EditorEffectHistoryReplay<TValue> = (editor: Editor, value: TValue) => EditorEffectHistoryReplayResult<TValue> | Promise<EditorEffectHistoryReplayResult<TValue>>;
366
- type EditorEffectSessionHistory<TValue> = Readonly<{
367
- replay: EditorEffectHistoryReplay<TValue>;
368
- }>;
369
- type EditorEffectTypeBase<TValue, TEncoded extends EditorJsonValue> = Readonly<{
370
- invert: (value: TValue) => TValue;
371
- key: string;
372
- map: (value: TValue, changes: DocumentChange) => TValue | undefined;
373
- persist?: EditorValuePersistence<TValue, TEncoded>;
374
- }>;
375
- type EditorEffectLocalType<TValue, TEncoded extends EditorJsonValue> = EditorEffectTypeBase<TValue, TEncoded> & Readonly<{
376
- collab: 'local';
377
- collabReplay: 'live';
378
- collabSnapshot?: never;
379
- collabTransport?: never;
380
- history: EditorEffectSessionHistory<TValue> | StateFieldHistoryPolicy;
381
- }>;
382
- type EditorEffectSharedLiveType<TValue, TEncoded extends EditorJsonValue> = EditorEffectTypeBase<TValue, TEncoded> & Readonly<{
383
- persist: EditorValuePersistence<TValue, TEncoded>;
384
- collab: 'shared';
385
- collabReplay: 'live';
386
- collabSnapshot?: never;
387
- collabTransport?: EditorEffectCollabTransport<TValue>;
388
- history: StateFieldHistoryPolicy;
389
- }>;
390
- type EditorEffectSharedLatestType<TValue, TEncoded extends EditorJsonValue> = EditorEffectTypeBase<TValue, TEncoded> & Readonly<{
391
- persist: EditorValuePersistence<TValue, TEncoded>;
392
- collab: 'shared';
393
- collabReplay: 'latest';
394
- /** Pure capture of the current absolute value for late-join checkpoints. */
395
- collabSnapshot: (state: EditorStateView<Value, any>) => TValue | undefined;
396
- collabTransport?: EditorEffectCollabTransport<TValue>;
397
- history: StateFieldHistoryPolicy;
398
- }>;
399
- type EditorEffectType<TValue = any, TEncoded extends EditorJsonValue = EditorJsonValue> = EditorEffectLocalType<TValue, TEncoded> | EditorEffectSharedLatestType<TValue, TEncoded> | EditorEffectSharedLiveType<TValue, TEncoded>;
400
- type EditorEffect<TValue = any, TEncoded extends EditorJsonValue = EditorJsonValue> = Readonly<{
401
- type: EditorEffectType<TValue, TEncoded>;
402
- value: TValue;
403
- }>;
404
- type EditorUpdateAnnotation<TValue = unknown> = Readonly<{
405
- combine: (previous: TValue, next: TValue) => TValue;
406
- key: string;
407
- }>;
408
- type EditorTransactionEffectsApi = {
409
- all: () => readonly EditorEffect[];
410
- emit: <TValue>(type: EditorEffectType<TValue>, value: TValue) => void;
411
- };
412
- type PluginMigrationContext = Readonly<{
413
- /** Immutable structural document before candidate configuration publication. */
414
- document: EditorSchemaDocumentValue;
415
- /** Candidate schema that validates the returned document. */
416
- next: EditorStateSchemaApi;
417
- }>;
418
- type PluginReconfigureOptions = Readonly<{
419
- /**
420
- * Return the complete structural document to publish with the candidate.
421
- *
422
- * Runs when the change alters the schema or leaves a plugin name
423
- * uninstalled. Omit it only when the current document already validates
424
- * under the candidate schema. Live reconfiguration never fills schema
425
- * defaults implicitly.
426
- */
427
- migrate?: (context: PluginMigrationContext) => EditorSchemaDocumentValue;
428
- }>;
429
- type EditorTransactionPluginsApi = {
430
- /** Whether the current editor has this plugin name or descriptor installed. */
431
- has: (plugin: PluginReference | string) => boolean;
432
- /** Replace one named plugin slot when the surrounding update commits. */
433
- reconfigure: (slot: PluginSlotLike, input: PluginInput, options?: PluginReconfigureOptions) => void;
434
- };
435
- type EditorTransactionAnnotationsApi = {
436
- get: <TValue>(annotation: EditorUpdateAnnotation<TValue>) => TValue | undefined;
437
- set: <TValue>(annotation: EditorUpdateAnnotation<TValue>, value: TValue) => void;
438
- };
439
- type BivariantMethod<TArgs extends readonly unknown[], TResult> = {
440
- bivarianceHack(...args: TArgs): TResult;
441
- }['bivarianceHack'];
442
- type BivariantFunction<TFn> = TFn extends ((...args: infer TArgs) => infer TResult) ? BivariantMethod<TArgs, TResult> : never;
443
- declare const editorGenericMethod: unique symbol;
444
- /**
445
- * Preserve a generic plugin method through editor projections.
446
- *
447
- * @internal
448
- */
449
- type EditorGenericMethod<TMethod extends (...args: any[]) => any> = TMethod & Readonly<{
450
- [editorGenericMethod]: true;
451
- }>;
452
- type EditorStateValueApi<V extends Value = Value> = () => EditorDocumentValue<V>;
453
- type SnapshotSelectionInput<TSelection extends SelectionValue = SelectionValue> = Selection<TSelection> | 'end' | 'start';
454
- /** Application persistence envelope for one complete external document. */
455
- type PersistedDocumentInput<V extends Value = Value> = Readonly<{
456
- document: EditorDocumentValue<V>;
457
- schema: EditorSchemaIdentity;
458
- selection?: SnapshotSelectionInput;
459
- }>;
460
- type EditorTransactionValueApi<V extends Value = Value> = EditorStateValueApi<V> & {
461
- /**
462
- * Load a complete document and its metadata, resetting local history.
463
- * A root-bound view instead authors a replacement of its own root;
464
- * load document metadata through the complete editor.
465
- */
466
- replace: (input: SnapshotInput<V>) => void;
467
- };
468
- type EditorUpdateValueApi<V extends Value = Value> = EditorStateValueApi<V> & {
469
- /**
470
- * Repair every document root with the installed corrections.
471
- *
472
- * This maintenance task starts its own history-skipped update and
473
- * cannot run inside another update.
474
- */
475
- repair: () => void;
476
- /**
477
- * Load a complete document and its metadata, resetting local history.
478
- * A root-bound view instead authors a replacement of its own root;
479
- * load document metadata through the complete editor.
480
- */
481
- replace: (input: SnapshotInput<V>) => void;
482
- };
483
- type EditorSelectionTargetOptions = {
484
- at?: NodeTarget | null;
485
- };
486
- type EditorSelectionSetNodesOptions = Readonly<{
487
- /** `object` picks one object itself; defaults to `block`. */
488
- mode?: NodeSelectionMode;
489
- } & ({
490
- anchor?: never;
491
- focus?: never;
492
- } | {
493
- /** First exact selected node in the user's selection direction. */
494
- anchor: Descendant | NodeKey | Path;
495
- /** Active exact selected node in the user's selection direction. */
496
- focus: Descendant | NodeKey | Path;
497
- })>;
498
- type EditorSelectionBlockOptions = EditorSelectionTargetOptions & {
499
- match?: NodeMatch<Element>;
500
- type?: NodeTypeSelector;
501
- };
502
- type EditorStateSelectionApi<TSelection extends SelectionValue = SelectionValue, V extends Value = Value> = (() => Range | null) & {
503
- contains: (target: NodeTarget) => boolean;
504
- intersects: (target: NodeTarget) => boolean;
505
- isAcrossBlocks: (options?: EditorSelectionBlockOptions) => boolean;
506
- isAtBlockEnd: (options?: EditorSelectionBlockOptions) => boolean;
507
- isAtBlockStart: (options?: EditorSelectionBlockOptions) => boolean;
508
- /** Whether the active representative range is collapsed. */
509
- isCollapsed: () => boolean;
510
- /** Whether the active representative range is expanded. */
511
- isExpanded: () => boolean;
512
- isValid: (value: unknown) => value is Selection<TSelection>;
513
- isWithinBlock: (options?: EditorSelectionBlockOptions) => boolean;
514
- /** How the current node selection was made, or `null` without one. */
515
- nodeMode: () => NodeSelectionMode | null;
516
- /** Exact live entries in the current node selection. */
517
- nodes: () => ReadonlyArray<NodeEntry<ValueDescendant<V>>>;
518
- ranges: () => readonly Range[];
519
- };
520
- type EditorStateViewApi = {
521
- isComposing: () => boolean;
522
- isFocused: () => boolean;
523
- isReadOnly: () => boolean;
524
- /**
525
- * Whether this view's editor root is in Viewing, set through
526
- * `setEditorViewing` or by a lock on the outermost view. A nested view's own
527
- * lock makes it read-only without putting its editor root in Viewing.
528
- */
529
- isViewing: () => boolean;
530
- /** Named view root, or `undefined` for the primary document. */
531
- root: () => NamedRootKey | undefined;
532
- };
533
- /** Where the node that holds one value of a `unique` property sits. */
534
- type EditorUniqueHolder = Readonly<{
535
- key: NodeKey;
536
- path: Path;
537
- root: RootKey;
538
- }>;
539
- type EditorStateUniqueApi = Readonly<{
540
- /**
541
- * Find the node that holds `value` of the `unique` property `property` in
542
- * the current state, without a scan. Inside an update it also finds a node
543
- * that got the value earlier in the same update, reading only the content
544
- * the update wrote. When the update gave the value to a second node, it reads
545
- * the node that held it before the update.
546
- */
547
- holder: (property: string, value: unknown) => EditorUniqueHolder | null;
548
- }>;
549
- type EditorFragmentReadOptions = {
550
- at?: Range;
551
- unwrap?: readonly string[];
552
- };
553
- type EditorStateFragmentApi<V extends Value = Value> = (options?: EditorFragmentReadOptions) => ReadonlyArray<DescendantIn<V>>;
554
- type EditorSliceReadOptions = Readonly<{
555
- at?: NodeSelection | Range;
556
- }>;
557
- type EditorStateSliceApi<V extends Value = Value> = {
558
- /** Read the selection slice and apply every external export projection. */
559
- export: (options?: EditorSliceReadOptions) => ContentSlice<V>;
560
- /** Build an atomic replacement transaction without publishing it. */
561
- fit: (slice: ContentSlice, options?: WithNodeTarget<TextInsertFragmentOptions, DescendantIn<V>>) => false | TransactionSpec;
562
- /** Fit immutable slice content against one detached parent without publishing. */
563
- fitContent: <TRoot extends RootKey>(slice: ContentSlice, options: Readonly<{
564
- parent: Element;
565
- /** Named secondary-root context. Omit for the primary root. */
566
- root?: NamedRootKey<TRoot>;
567
- }>) => ReadonlyArray<DescendantIn<V>> | null;
568
- /** Read one immutable slice with structural openness preserved. */
569
- get: (options?: EditorSliceReadOptions) => ContentSlice<V>;
570
- };
571
- type EditorSelectionLocation = Path | Point | (Range & Readonly<{
572
- kind?: never;
573
- }>);
574
- /** What a selection write takes: a selection, or a path, point or range to select. */
575
- type EditorSelectionTarget<TSelection extends SelectionValue = SelectionValue> = TSelection | EditorSelectionLocation;
576
- type EditorTransactionSelectionApi<TSelection extends SelectionValue = SelectionValue, V extends Value = Value> = EditorStateSelectionApi<TSelection, V> & {
577
- collapse: (options?: SelectionCollapseOptions) => void;
578
- move: (options?: SelectionMoveOptions) => void;
579
- set: BivariantMethod<[target: EditorSelectionTarget<TSelection> | null], void>;
580
- /** Select exact live nodes. An empty collection clears the selection. */
581
- setNodes: (targets: ReadonlyArray<Descendant | NodeKey | Path>, options?: EditorSelectionSetNodesOptions) => void;
582
- setPoint: (props: Partial<Point>, options?: SelectionSetPointOptions) => void;
583
- };
584
- /** A mapped location whose lifetime is limited to one transaction callback. */
585
- type EditorTransactionAnchor<TValue extends AnchorValue> = Readonly<{
586
- resolve: () => TValue | null;
587
- }>;
588
- type EditorTransactionAnchorApi = <TValue extends AnchorValue, const TRoot extends RootKey>(value: TValue, options: AnchorOptions<TValue, TRoot>) => EditorTransactionAnchor<TValue>;
589
- type EditorStateMarksApi<V extends Value = Value> = () => EditorMarks<V> | null;
590
- type EditorToggleMarkOptions = {
591
- /** Collapse the resulting selection in the same command commit. */
592
- collapse?: boolean | SelectionCollapseOptions;
593
- };
594
- type EditorBlockToggleOptions = {
595
- at?: NodeSelectionTarget;
596
- voids?: boolean;
597
- wrap?: boolean;
598
- };
599
- type EditorToggleBlockOptions = EditorBlockToggleOptions & {
600
- /** Collapse the resulting selection in the same command commit. */
601
- collapse?: boolean | SelectionCollapseOptions;
602
- };
603
- type EditorTransactionMarksApi<V extends Value = Value> = EditorStateMarksApi<V> & {
604
- add: (key: string, value: unknown) => void;
605
- remove: (key: string) => void;
606
- set: (marks: EditorMarks<V> | null) => void;
607
- toggle: (key: string, value?: unknown) => void;
608
- };
609
- type EditorCanonicalUpdateTag = 'history-push' | 'history-merge' | 'history-skip' | 'historic' | 'paste' | 'collaboration' | 'skip-collab' | 'skip-dom-selection' | 'skip-scroll-into-view' | 'skip-selection-focus' | 'native-text-input' | 'semantic-command' | 'focus' | 'composition-start' | 'composition-end';
610
- type EditorUpdateTag = EditorCanonicalUpdateTag | (string & {});
611
- type EditorUpdateTagInput = EditorUpdateTag | readonly EditorUpdateTag[];
612
- /** Semantic policy applied to one editor update. */
613
- type EditorUpdatePolicy = Readonly<{
614
- /** History behavior. Requires an installed History plugin. */
615
- history?: 'merge' | 'new-batch' | 'skip';
616
- /** Tags applied in input order before the semantic history mode. */
617
- tags?: EditorUpdateTagInput;
618
- }>;
619
- type EditorTransactionChangesApi = {
620
- /** Apply one canonical document change to the active transaction draft. */
621
- apply: (change: DocumentChange) => void;
622
- };
623
- type EditorTransactionRootsApi<V extends Value = Value> = {
624
- create: <TRoot extends RootKey>(root: NamedRootKey<TRoot>, children: V) => void;
625
- delete: <TRoot extends RootKey>(root: NamedRootKey<TRoot>) => void;
626
- replace: <TRoot extends RootKey>(root: NamedRootKey<TRoot>, children: V) => void;
627
- };
628
- /** Write keyed records into a record set a plugin declares. */
629
- type EditorTransactionRecordsApi = {
630
- /** Drop `id` from `set`; a set without `id` stays as it is. */
631
- drop: (set: string, id: string) => void;
632
- /**
633
- * Put `record` under `id` in `set`. Putting equal content again changes
634
- * nothing, and an id that holds other content refuses the put.
635
- */
636
- put: (set: string, id: string, record: Readonly<Record<string, unknown>>) => void;
637
- };
638
- /** Inspect and extend the final tag set of the active update. */
639
- type EditorTransactionTagsApi = {
640
- add: (tag: EditorUpdateTag) => void;
641
- has: (tag: EditorUpdateTag) => boolean;
642
- };
643
- type EditorStateNodesApi<V extends Value = Value> = {
644
- above: {
645
- <TGuard extends Ancestor>(options: WithNodeTarget<EditorAboveOptions<Ancestor, undefined>> & {
646
- match: (node: Ancestor, path: Path) => node is TGuard;
647
- }): NodeEntry<TGuard> | undefined;
648
- <const TType extends NodeTypeSelector>(options: WithNodeTarget<EditorAboveOptions<NodeForTypeSelector<TType>, TType>> & {
649
- type: TType;
650
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
651
- (options?: WithNodeTarget<EditorAboveOptions<Ancestor>>): NodeEntry<Ancestor> | undefined;
652
- };
653
- block: {
654
- <TGuard extends ValueElement<V>>(options: WithNodeTarget<EditorBlockOptions<ValueElement<V>, undefined>> & {
655
- match: (node: ValueElement<V>, path: Path) => node is TGuard;
656
- }): NodeEntry<TGuard> | undefined;
657
- <const TType extends NodeTypeSelector>(options: WithNodeTarget<EditorBlockOptions<NodeForTypeSelector<TType>, TType>> & {
658
- type: TType;
659
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
660
- (options?: WithNodeTarget<EditorBlockOptions<ValueElement<V>>>): NodeEntry<ValueElement<V>> | undefined;
661
- };
662
- /** Read every schema block relevant to the target or active selection. */
663
- blocks: {
664
- <TGuard extends ValueElement<V>>(options: EditorBlocksReadOptions<ValueElement<V>, undefined> & {
665
- match: (node: ValueElement<V>, path: Path) => node is TGuard;
666
- }): ReadonlyArray<NodeEntry<TGuard>>;
667
- <const TType extends NodeTypeSelector>(options: EditorBlocksReadOptions<NodeForTypeSelector<TType>, TType> & {
668
- type: TType;
669
- }): ReadonlyArray<NodeEntry<NodeForTypeSelector<TType>>>;
670
- (options?: EditorBlocksReadOptions<ValueElement<V>>): ReadonlyArray<NodeEntry<ValueElement<V>>>;
671
- };
672
- children: (at?: NodeTarget) => ReadonlyArray<ValueDescendant<V>>;
673
- elementReadOnly: (options?: WithNodeTarget<EditorElementReadOnlyOptions>) => NodeEntry<Element> | undefined;
674
- first: (at: NodeTarget) => NodeEntry | undefined;
675
- get: {
676
- <TGuard extends ValueTreeNode<V>>(at: NodeTarget, options: EditorNodeGetOptions<ValueTreeNode<V>, undefined> & {
677
- match: (node: ValueTreeNode<V>, path: Path) => node is TGuard;
678
- }): NodeEntry<TGuard> | undefined;
679
- <const TType extends NodeTypeSelector>(at: NodeTarget, options: EditorNodeGetOptions<NodeForTypeSelector<TType>, TType> & {
680
- type: TType;
681
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
682
- <TNode extends Descendant>(at: TNode): NodeEntry<TNode> | undefined;
683
- (at: Location | NodeKey, options?: EditorNodeGetOptions<ValueTreeNode<V>>): NodeEntry | undefined;
684
- };
685
- /**
686
- * Whether a node is content. A capability that keeps non-content nodes in
687
- * the document, such as struck suggestions, answers false for them, so code
688
- * that derives a value from children or the document can skip them while
689
- * keeping each child's real path. Without one, every node is content.
690
- */
691
- isContent: (node: Node) => boolean;
692
- isSelectable: (element: Node) => boolean;
693
- isEmpty: (element: Element) => boolean;
694
- last: (at: NodeTarget, options?: EditorLastOptions) => NodeEntry | undefined;
695
- leaf: (at: NodeTarget<Text>, options?: EditorLeafOptions) => NodeEntry<ValueText<V>> | undefined;
696
- levels: {
697
- <TGuard extends ValueTreeNode<V>>(options: WithNodeTarget<EditorLevelsOptions<ValueTreeNode<V>, undefined>> & {
698
- match: (node: ValueTreeNode<V>, path: Path) => node is TGuard;
699
- }): Generator<NodeEntry<TGuard>, void, undefined>;
700
- <const TType extends NodeTypeSelector>(options: WithNodeTarget<EditorLevelsOptions<NodeForTypeSelector<TType>, TType>> & {
701
- type: TType;
702
- }): Generator<NodeEntry<NodeForTypeSelector<TType>>, void, undefined>;
703
- (options?: WithNodeTarget<EditorLevelsOptions<ValueTreeNode<V>>>): Generator<NodeEntry, void, undefined>;
704
- };
705
- /**
706
- * Resolve a path in this editor/view root. A `NodeKey` owned by another root
707
- * returns `undefined`; create that root's view because `Path` has no root.
708
- */
709
- path: (at: NodeTarget, options?: EditorPathOptions) => Path | undefined;
710
- entries: {
711
- <TGuard extends ValueTreeNode<V>>(options: EditorNodesReadOptions<ValueTreeNode<V>, undefined> & {
712
- match: (node: ValueTreeNode<V>, path: Path) => node is TGuard;
713
- }): Generator<NodeEntry<TGuard>, void, undefined>;
714
- <const TType extends NodeTypeSelector>(options: EditorNodesReadOptions<NodeForTypeSelector<TType>, TType> & {
715
- type: TType;
716
- }): Generator<NodeEntry<NodeForTypeSelector<TType>>, void, undefined>;
717
- (options?: EditorNodesReadOptions<ValueTreeNode<V>>): Generator<NodeEntry, void, undefined>;
718
- };
719
- find: {
720
- <TGuard extends ValueTreeNode<V>>(options: EditorNodesReadOptions<ValueTreeNode<V>> & {
721
- match: (node: ValueTreeNode<V>, path: Path) => node is TGuard;
722
- type?: undefined;
723
- }): NodeEntry<TGuard> | undefined;
724
- <const TType extends NodeTypeSelector>(options: EditorNodesReadOptions<NodeForTypeSelector<TType>, TType> & {
725
- type: TType;
726
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
727
- (options?: EditorNodesReadOptions<ValueTreeNode<V>>): NodeEntry | undefined;
728
- };
729
- some: {
730
- <const TType extends NodeTypeSelector>(options: EditorNodesReadOptions<NodeForTypeSelector<TType>, TType> & {
731
- type: TType;
732
- }): boolean;
733
- (options?: EditorNodesReadOptions<ValueTreeNode<V>>): boolean;
734
- };
735
- toArray: {
736
- <TGuard extends ValueTreeNode<V>>(options: EditorNodesReadOptions<ValueTreeNode<V>, undefined> & {
737
- match: (node: ValueTreeNode<V>, path: Path) => node is TGuard;
738
- }): ReadonlyArray<NodeEntry<TGuard>>;
739
- <const TType extends NodeTypeSelector>(options: EditorNodesReadOptions<NodeForTypeSelector<TType>, TType> & {
740
- type: TType;
741
- }): ReadonlyArray<NodeEntry<NodeForTypeSelector<TType>>>;
742
- (options?: EditorNodesReadOptions<ValueTreeNode<V>>): readonly NodeEntry[];
743
- };
744
- next: {
745
- <TGuard extends ValueDescendant<V>>(options: WithNodeTarget<EditorNextOptions<ValueDescendant<V>>> & {
746
- match: (node: ValueDescendant<V>, path: Path) => node is TGuard;
747
- }): NodeEntry<TGuard> | undefined;
748
- <const TType extends NodeTypeSelector>(options: WithNodeTarget<EditorNextOptions<NodeForTypeSelector<TType>, TType>> & {
749
- type: TType;
750
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
751
- (options?: WithNodeTarget<EditorNextOptions<ValueDescendant<V>>>): NodeEntry<ValueDescendant<V>> | undefined;
752
- };
753
- parent: {
754
- <TGuard extends Ancestor>(at: NodeTarget, options: EditorParentOptions<Ancestor, undefined> & {
755
- match: (node: Ancestor, path: Path) => node is TGuard;
756
- }): NodeEntry<TGuard> | undefined;
757
- <const TType extends NodeTypeSelector>(at: NodeTarget, options: EditorParentOptions<NodeForTypeSelector<TType>, TType> & {
758
- type: TType;
759
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
760
- (at: NodeTarget, options?: EditorParentOptions): NodeEntry<Ancestor> | undefined;
761
- };
762
- previous: {
763
- <TGuard extends ValueTreeNode<V>>(options: WithNodeTarget<EditorPreviousOptions<ValueTreeNode<V>, undefined>> & {
764
- match: (node: ValueTreeNode<V>, path: Path) => node is TGuard;
765
- }): NodeEntry<TGuard> | undefined;
766
- <const TType extends NodeTypeSelector>(options: WithNodeTarget<EditorPreviousOptions<NodeForTypeSelector<TType>, TType>> & {
767
- type: TType;
768
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
769
- (options?: WithNodeTarget<EditorPreviousOptions<ValueTreeNode<V>>>): NodeEntry | undefined;
770
- };
771
- void: (options?: WithNodeTarget<EditorVoidOptions>) => NodeEntry<Element> | undefined;
772
- };
773
- type EditorTransactionNodesApi<V extends Value = Value> = EditorStateNodesApi<V> & {
774
- insert: {
775
- <T extends ElementOrTextIn<V>, const TType extends NodeTypeSelector | undefined>(nodes: T | readonly T[], options: WithNodeTarget<NodeInsertNodesOptions<NodeInsertSplitTarget<V, TType>, TType>> & {
776
- split: NodeInsertNodesOptions<NodeInsertSplitTarget<V, TType>, TType>['split'] & {
777
- type: TType;
778
- };
779
- }): void;
780
- <T extends ElementOrTextIn<V>>(nodes: T | readonly T[], options?: WithNodeTarget<NodeInsertNodesOptions<NodeIn<V>>>): void;
781
- };
782
- lift: {
783
- <const TType extends NodeTypeSelector>(options: {
784
- at?: NodeSelectionTarget;
785
- match?: NodeMatch<NodeForTypeSelector<TType>>;
786
- mode?: MaximizeMode;
787
- type: TType;
788
- voids?: boolean;
789
- }): void;
790
- (options?: {
791
- at?: NodeSelectionTarget;
792
- match?: NodeMatch<NodeIn<V>>;
793
- mode?: MaximizeMode;
794
- type?: NodeTypeSelector;
795
- voids?: boolean;
796
- }): void;
797
- };
798
- merge: {
799
- <const TType extends NodeTypeSelector>(options: {
800
- at?: NodeSelectionTarget;
801
- match?: NodeMatch<NodeForTypeSelector<TType>>;
802
- mode?: RangeMode;
803
- hanging?: boolean;
804
- type: TType;
805
- voids?: boolean;
806
- }): void;
807
- (options?: {
808
- at?: NodeSelectionTarget;
809
- match?: NodeMatch<NodeIn<V>>;
810
- mode?: RangeMode;
811
- hanging?: boolean;
812
- type?: NodeTypeSelector;
813
- voids?: boolean;
814
- }): void;
815
- };
816
- move: {
817
- <const TType extends NodeTypeSelector>(options: {
818
- at?: NodeSelectionTarget;
819
- match?: NodeMatch<NodeForTypeSelector<TType>>;
820
- mode?: MaximizeMode;
821
- to: Path;
822
- type: TType;
823
- voids?: boolean;
824
- }): void;
825
- (options: {
826
- at?: NodeSelectionTarget;
827
- match?: NodeMatch<NodeIn<V>>;
828
- mode?: MaximizeMode;
829
- to: Path;
830
- type?: NodeTypeSelector;
831
- voids?: boolean;
832
- }): void;
833
- };
834
- remove: {
835
- <const TType extends NodeTypeSelector>(options: {
836
- at?: NodeSelectionTarget;
837
- match?: NodeMatch<NodeForTypeSelector<TType>>;
838
- mode?: MaximizeMode;
839
- hanging?: boolean;
840
- type: TType;
841
- voids?: boolean;
842
- }): void;
843
- (options?: {
844
- at?: NodeSelectionTarget;
845
- match?: NodeMatch<NodeIn<V>>;
846
- mode?: MaximizeMode;
847
- hanging?: boolean;
848
- type?: NodeTypeSelector;
849
- voids?: boolean;
850
- }): void;
851
- };
852
- replace: <T extends ElementOrTextIn<V>>(nodes: T | readonly T[], options: EditorReplaceNodeOptions) => boolean;
853
- replaceChildren: (children: ReadonlyArray<ElementOrTextIn<V>>, options: EditorReplaceChildrenOptions) => void;
854
- set: EditorNodeSetObject<V>;
855
- split: {
856
- <const TType extends NodeTypeSelector>(options: {
857
- at?: NodeTarget;
858
- match?: NodeMatch<NodeForTypeSelector<TType>>;
859
- mode?: RangeMode;
860
- always?: boolean;
861
- height?: number;
862
- position?: number;
863
- type: TType;
864
- voids?: boolean;
865
- }): void;
866
- (options?: {
867
- at?: NodeTarget;
868
- match?: NodeMatch<NodeIn<V>>;
869
- mode?: RangeMode;
870
- always?: boolean;
871
- height?: number;
872
- position?: number;
873
- type?: NodeTypeSelector;
874
- voids?: boolean;
875
- }): void;
876
- };
877
- unset: {
878
- <const TKey extends NodePropertyKeyIn<V>, const TType extends NodeTypeSelector>(props: TKey | readonly TKey[], options: EditorNodeUnsetOptions<NodeForTypeSelector<TType>, TType> & {
879
- type: TType;
880
- }): void;
881
- <const TKey extends NodePropertyKeyIn<V>>(props: TKey | readonly TKey[], options?: EditorNodeUnsetOptions<NodeIn<V>>): void;
882
- <const TType extends NodeTypeSelector>(property: SchemaPropertyHandle<string>, options: EditorNodeUnsetOptions<NodeForTypeSelector<TType>, TType> & {
883
- type: TType;
884
- }): void;
885
- (property: SchemaPropertyHandle<string>, options?: EditorNodeUnsetOptions<NodeIn<V>>): void;
886
- <TKey extends string, const TType extends NodeTypeSelector>(property: string extends TKey ? TKey | readonly TKey[] : never, options: EditorNodeUnsetOptions<NodeForTypeSelector<TType>, TType> & {
887
- type: TType;
888
- }): void;
889
- <TKey extends string>(property: string extends TKey ? TKey | readonly TKey[] : never, options?: EditorNodeUnsetOptions<NodeIn<V>>): void;
890
- };
891
- unwrap: {
892
- <const TType extends NodeTypeSelector>(options: {
893
- at?: NodeSelectionTarget;
894
- match?: NodeMatch<NodeForTypeSelector<TType>>;
895
- mode?: MaximizeMode;
896
- split?: boolean;
897
- type: TType;
898
- voids?: boolean;
899
- }): boolean;
900
- (options?: {
901
- at?: NodeSelectionTarget;
902
- match?: NodeMatch<NodeIn<V>>;
903
- mode?: MaximizeMode;
904
- split?: boolean;
905
- type?: NodeTypeSelector;
906
- voids?: boolean;
907
- }): boolean;
908
- };
909
- wrap: {
910
- <const TType extends NodeTypeSelector>(element: ElementIn<V>, options: {
911
- at?: NodeSelectionTarget;
912
- match?: NodeMatch<NodeForTypeSelector<TType>>;
913
- mode?: MaximizeMode;
914
- split?: boolean;
915
- type: TType;
916
- voids?: boolean;
917
- }): boolean;
918
- (element: ElementIn<V>, options?: {
919
- at?: NodeSelectionTarget;
920
- match?: NodeMatch<NodeIn<V>>;
921
- mode?: MaximizeMode;
922
- split?: boolean;
923
- type?: NodeTypeSelector;
924
- voids?: boolean;
925
- }): boolean;
926
- };
927
- };
928
- type EditorStatePointsApi = {
929
- after: (at: NodeTarget, options?: EditorAfterOptions) => Point | undefined;
930
- before: (at: NodeTarget, options?: EditorBeforeOptions) => Point | undefined;
931
- end: (at: NodeTarget) => Point | undefined;
932
- get: (at: NodeTarget, options?: EditorPointOptions) => Point | undefined;
933
- isEdge: (point: Point, at: NodeTarget) => boolean;
934
- isEnd: (point: Point, at: NodeTarget) => boolean;
935
- isStart: (point: Point, at: NodeTarget) => boolean;
936
- isWordEnd: (point: Point) => boolean;
937
- positions: (options?: WithNodeTarget<EditorPositionsOptions>) => Generator<Point, void, undefined>;
938
- start: (at: NodeTarget) => Point | undefined;
939
- };
940
- type EditorStateRangesApi = {
941
- edges: (at: NodeTarget) => readonly [Point, Point] | undefined;
942
- fromEntries: (entries: readonly NodeEntry[]) => Range | undefined;
943
- get: (at: NodeTarget, to?: Location) => Range | undefined;
944
- project: (range: Range) => readonly ProjectedRangeSegment[];
945
- unhang: (range: Range, options?: EditorUnhangRangeOptions) => Range;
946
- };
947
- type EditorStateTextApi = {
948
- /** Return text at a target, or at the current selection when omitted. */
949
- string: (at?: NodeSelectionTarget, options?: EditorStringOptions) => string;
950
- };
951
- type EditorTransactionFragmentApi<V extends Value = Value> = EditorStateFragmentApi<V> & {
952
- delete: (options?: WithNodeTarget<EditorFragmentDeletionOptions, DescendantIn<V>>) => void;
953
- /** Fit and replace known-closed content as one canonical closed slice. */
954
- replace: (content: ReadonlyArray<DescendantIn<V>>, options?: WithNodeTarget<TextInsertFragmentOptions, DescendantIn<V>>) => boolean;
955
- };
956
- type EditorTransactionSliceApi<V extends Value = Value> = Pick<EditorStateSliceApi<V>, 'get'> & {
957
- /**
958
- * Fit and atomically replace content at the transaction target.
959
- *
960
- * Returns `false` without mutating when the target cannot be resolved, is a
961
- * protected void, or the compiled schema cannot fit a well-formed slice.
962
- * Malformed slice shapes are programmer errors and throw.
963
- */
964
- replace: (slice: ContentSlice, options?: WithNodeTarget<TextInsertFragmentOptions, DescendantIn<V>>) => boolean;
965
- };
966
- type EditorBreakExitOptions = {
967
- /** Land before the exited structure instead of after it. */
968
- before?: boolean;
969
- /**
970
- * Which levels may be exited: the selected block when it owns its exit, then
971
- * its ancestors. The selected block stays the last resort.
972
- */
973
- match?: (node: Element, path: Path) => boolean;
974
- };
975
- type EditorTransactionBreakApi = {
976
- /**
977
- * Leave the nearest structure around the collapsed selection. The selected
978
- * block is that structure when it owns its exit, as a void, an object or an
979
- * `ownsExit` text block does, and its parent can build a default beside it
980
- * that does not put the caret in another block that owns its exit. Otherwise
981
- * it is the nearest ancestor that is a root child or sits in a parent that
982
- * declares no content or whose content after any leading prefix admits a text
983
- * block, skipping one that is not a root child when its landing would put the
984
- * caret back in its own type; with none, it is the selected block. Inserts
985
- * and selects the default that the structure's parent declares at the landing
986
- * position. Returns whether a block landed; false changes nothing, as when
987
- * that parent declares no content, its default needs a property nobody
988
- * supplies, or that default ends without text.
989
- */
990
- exit: (options?: EditorBreakExitOptions) => boolean;
991
- insert: () => void;
992
- insertSoft: () => void;
993
- };
994
- type EditorTransactionTextApi = EditorStateTextApi & {
995
- delete: (options?: WithNodeTarget<TextDeleteOptions>) => void;
996
- deleteBackward: (options?: EditorDirectedDeletionOptions) => void;
997
- deleteForward: (options?: EditorDirectedDeletionOptions) => void;
998
- insert: (text: string, options?: WithNodeTarget<TextInsertTextOptions>) => void;
999
- };
1000
- /** Concrete registered schema targets available to DataTransfer formats. */
1001
- type EditorSchemaVocabulary = Readonly<{
1002
- elementTypes: readonly string[];
1003
- groupNames: readonly string[];
1004
- propertyIds: readonly string[];
1005
- rootNames: readonly string[];
1006
- }>;
1007
- type WithoutInternalPrimaryRoot<TQuery> = TQuery extends {
1008
- readonly root?: infer TRoot;
1009
- } ? string extends Exclude<TRoot, null | undefined> ? unknown : 'main' extends Exclude<TRoot, null | undefined> ? Readonly<{
1010
- root?: never;
1011
- }> : unknown : unknown;
1012
- type EditorSchemaCreate = {
1013
- <TSchema extends EditorSchemaSource, TType extends SchemaElementTypes<TSchema>>(element: SchemaElementHandle<TSchema, TType>, ...properties: {} extends SchemaElementConstructionPropertiesFor<TSchema, TType> ? [properties?: SchemaElementConstructionPropertiesFor<TSchema, TType>] : [properties: SchemaElementConstructionPropertiesFor<TSchema, TType>]): SchemaElementFor<TSchema, TType>;
1014
- (type: string, properties?: Readonly<Record<string, unknown>>): Element;
1015
- };
1016
- type EditorSchemaPropertyReadOptions = Readonly<{
1017
- /** Immediate parent first. Required to apply targeted text-property defaults. */
1018
- ancestors?: readonly Element[];
1019
- /** Parent element for a text-property target. */
1020
- parent?: Element;
1021
- /** Omission addresses the implicit primary root. */
1022
- root?: RootKey;
1023
- }>;
1024
- type EditorSchemaReadProperty = {
1025
- <TValue>(node: Element | Text, property: SchemaPropertyHandle<string, TValue>, options?: EditorSchemaPropertyReadOptions): TValue | undefined;
1026
- (node: Element | Text, property: string, options?: EditorSchemaPropertyReadOptions): unknown;
1027
- };
1028
- type EditorSchemaGetProperty = {
1029
- (property: SchemaPropertyHandle): EditorSchemaProperty | null;
1030
- <const TQuery extends EditorSchemaPropertyQuery>(query: TQuery & WithoutInternalPrimaryRoot<TQuery>): EditorSchemaProperty | null;
1031
- };
1032
- type EditorStateSchemaApi<V extends Value = Value> = {
1033
- /** Whether one child element type is accepted directly by one parent type. */
1034
- allowsElementType: (parentType: string, childType: string) => boolean;
1035
- /** Create one valid canonical element with every required default child. */
1036
- create: EditorSchemaCreate;
1037
- /** Copy one node through its compiled property lifecycle. */
1038
- copy: <TNode extends Descendant>(node: TNode, options: Readonly<{
1039
- at: Path;
1040
- root?: NamedRootKey;
1041
- }>) => TNode;
1042
- /**
1043
- * Create the default child that the parent of `at` declares for the slot
1044
- * `at` ends in. A one-step path names a slot of the root. The parent and its
1045
- * ancestors are read from the root's current document; the slot need not
1046
- * exist. A parent without declared `content`, such as an undeclared element
1047
- * type, yields the root's default child for the root slot holding it, built
1048
- * as a root child. Returns null when the parent is missing or the deciding
1049
- * `content` has no default child for that slot. Omit `root` for the primary
1050
- * root.
1051
- */
1052
- createDefaultChild: <TRoot extends RootKey>(options: Readonly<{
1053
- at: Path;
1054
- root?: NamedRootKey<TRoot>;
1055
- }>) => Descendant | null;
1056
- /** Semantic resources changed by the current configuration publication. */
1057
- delta: () => EditorSchemaDelta | null;
1058
- /** Read immutable compiled facts for one declared element type. */
1059
- element: (type: string) => EditorSchemaElement | null;
1060
- /** Fit one external document through the candidate schema without publishing it. */
1061
- fitDocument: <TValue extends Value>(value: EditorDocumentValue<TValue>) => EditorDocumentValue<V>;
1062
- findWrapping: (parent: Element, child: Descendant) => readonly string[] | null;
1063
- getElementBehavior: (element: Element) => EditorElementBehavior;
1064
- /** Resolve every named document root projected by an element, keyed by slot. */
1065
- getElementContentRoots: (element: Element) => Readonly<Record<string, NamedRootKey>>;
1066
- /** Read one stored or defaulted property through its schema identity. */
1067
- getProperty: EditorSchemaReadProperty;
1068
- /** Compiled open-slice boundary behavior for one element. */
1069
- getElementSlicePolicy: (element: Element) => EditorElementSlicePolicy;
1070
- /** Return the immutable compiled schema vocabulary. */
1071
- getVocabulary: () => EditorSchemaVocabulary;
1072
- /** Whether the schema declares any element-owned document roots. */
1073
- hasContentRoots: () => boolean;
1074
- /** Stable persisted identity for the current compiled schema. */
1075
- identity: () => EditorSchemaIdentity;
1076
- isAtom: (element: Node) => boolean;
1077
- isBlock: (element: Node) => boolean;
1078
- /** Test one compiled, transitive schema group membership. */
1079
- isElementTypeInGroup: (type: string, group: string) => boolean;
1080
- isInline: (element: Node) => boolean;
1081
- isIsolating: (element: Node) => boolean;
1082
- isObject: (element: Node) => boolean;
1083
- isReadOnly: (element: Node) => boolean;
1084
- isSelectable: (element: Node) => boolean;
1085
- isVoid: (element: Node) => boolean;
1086
- isMarkableVoid: (element: Node) => boolean;
1087
- /**
1088
- * Resolve one compiled property declaration for an exact runtime context.
1089
- * Omitting `type` succeeds only when the key has one unambiguous declaration.
1090
- */
1091
- property: EditorSchemaGetProperty;
1092
- /**
1093
- * Validate an external document against the compiled schema.
1094
- *
1095
- * Throws `EditorSchemaValidationError` with immutable root/path/property
1096
- * diagnostics on failure.
1097
- */
1098
- assertDocument(value: unknown): asserts value is EditorDocumentValue<V>;
1099
- /**
1100
- * Validate an external fragment against the compiled schema.
1101
- *
1102
- * Throws `EditorSchemaValidationError` with immutable path/property
1103
- * diagnostics on failure.
1104
- */
1105
- assertFragment(children: unknown): asserts children is ReadonlyArray<DescendantIn<V>>;
1106
- };
1107
- /** Immutable open document content carried across host and insertion boundaries. */
1108
- type ContentSlice<V extends Value = Value> = Readonly<{
1109
- content: ReadonlyArray<DescendantIn<V>>;
1110
- openEnd: number;
1111
- openStart: number;
1112
- /** Detached secondary roots referenced by the slice content. */
1113
- roots?: Readonly<Record<RootKey, ReadonlyArray<DescendantIn<V>>>>;
1114
- }>;
1115
- type EditorStateRuntimeApi<V extends Value = Value> = {
1116
- snapshot: () => EditorSnapshot<V>;
1117
- };
1118
- type EditorElementBehavior = Readonly<{
1119
- atom: boolean;
1120
- inline: boolean;
1121
- isolating: boolean;
1122
- markableVoid: boolean;
1123
- object: boolean;
1124
- /**
1125
- * Whether the element owns its exit, which every void and object does, as
1126
- * does a text block that declares `ownsExit`. `tx.break.exit` treats a
1127
- * selected block that owns its exit as a structure of its own.
1128
- */
1129
- ownsExit: boolean;
1130
- readOnly: boolean;
1131
- selectable: boolean;
1132
- void: boolean;
1133
- }>;
1134
- type EditorElementSlicePolicy = Readonly<{
1135
- endMatter: boolean;
1136
- preserveContext: boolean;
1137
- replaceWhenCovered: boolean;
1138
- }>;
1139
- declare const editorSelectionCapability: unique symbol;
1140
- type EditorSelectionCapability<TSelection extends SelectionValue> = SelectionValue extends TSelection ? {} : Readonly<{
1141
- /**
1142
- * Keep concrete installed selection capabilities invariant.
1143
- *
1144
- * @internal
1145
- */
1146
- [editorSelectionCapability]?: (selection: TSelection) => TSelection;
1147
- }>;
1148
- type EditorCoreStateView<V extends Value = Value, TSelection extends SelectionValue = SelectionValue> = {
1149
- /**
1150
- * Read the primary document children without cloning the full serializable
1151
- * document value. Treat the returned nodes as read-only live state.
1152
- */
1153
- children: () => readonly [...V];
1154
- fragment: EditorStateFragmentApi<V>;
1155
- getField: <TValue>(field: EditorStateField<TValue>) => TValue;
1156
- lastCommit: () => EditorCommit<V> | null;
1157
- /** Return the stable runtime key for a live node or location. */
1158
- key: EditorKeyApi;
1159
- marks: EditorStateMarksApi<V>;
1160
- /**
1161
- * Read persisted document metadata. Use state fields for typed access.
1162
- */
1163
- meta: () => Readonly<Record<string, unknown>> | undefined;
1164
- nodes: EditorStateNodesApi<V>;
1165
- points: EditorStatePointsApi;
1166
- ranges: EditorStateRangesApi;
1167
- /**
1168
- * Read a named secondary root. Use `children()` for the primary document.
1169
- */
1170
- root: <TRoot extends RootKey>(root: NamedRootKey<TRoot>) => ReadonlyArray<V[number]>;
1171
- /**
1172
- * List every named root in reading order, a root right after its first
1173
- * owner's place, with the elements that own it. Roots no chain of owners
1174
- * reaches from the page come last: each root no other root owns, in key
1175
- * order, then the roots it owns. Any root left, which only a ring of owners
1176
- * reaches, follows the same way.
1177
- */
1178
- roots: () => readonly EditorRootEntry[];
1179
- runtime: EditorStateRuntimeApi<V>;
1180
- schema: EditorStateSchemaApi<V>;
1181
- selection: EditorStateSelectionApi<TSelection, V>;
1182
- slice: EditorStateSliceApi<V>;
1183
- text: EditorStateTextApi;
1184
- unique: EditorStateUniqueApi;
1185
- value: EditorStateValueApi<V>;
1186
- view: EditorStateViewApi;
1187
- };
1188
- type EditorStateView<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = EditorCoreStateView<V, EditorSelection> & EditorInstalledReadGroups<V, TPlugins> & EditorSelectionCapability<EditorSelection> & {
1189
- /**
1190
- * Build an immutable transaction without mutating or publishing editor
1191
- * state. An empty spec represents an intentionally handled no-op.
1192
- */
1193
- transaction: ((fn: (transaction: EditorTransactionSpecBuilder<V, TPlugins>) => void) => TransactionSpec) & {
1194
- /** Continue building from a delegated spec without publishing either step. */
1195
- extend: (base: TransactionSpec, fn: (transaction: EditorTransactionSpecBuilder<V, TPlugins>) => void) => TransactionSpec;
1196
- };
1197
- };
1198
- type EditorCoreUpdateTransaction<V extends Value = Value, TSelection extends SelectionValue = SelectionValue> = Omit<EditorCoreStateView<V, TSelection>, 'marks' | 'nodes' | 'roots' | 'selection' | 'slice' | 'text' | 'value'> & {
1199
- /** Track a location from the current draft until this transaction ends. */
1200
- anchor: EditorTransactionAnchorApi;
1201
- annotations: EditorTransactionAnnotationsApi;
1202
- blocks: EditorTransactionBlocksApi<V>;
1203
- break: EditorTransactionBreakApi;
1204
- changes: EditorTransactionChangesApi;
1205
- effects: EditorTransactionEffectsApi;
1206
- plugins: EditorTransactionPluginsApi;
1207
- fragment: EditorTransactionFragmentApi<V>;
1208
- marks: EditorTransactionMarksApi<V>;
1209
- nodes: EditorTransactionNodesApi<V>;
1210
- records: EditorTransactionRecordsApi;
1211
- roots: EditorTransactionRootsApi<V>;
1212
- slice: EditorTransactionSliceApi<V>;
1213
- selection: EditorTransactionSelectionApi<TSelection, V>;
1214
- setField: <TValue>(field: EditorStateField<TValue>, value: StateFieldValueInput<TValue>) => void;
1215
- tags: EditorTransactionTagsApi;
1216
- text: EditorTransactionTextApi;
1217
- value: EditorTransactionValueApi<V>;
1218
- };
1219
- type EditorUpdateTransaction<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = EditorCoreUpdateTransaction<V, EditorSelection> & {
1220
- /** Dispatch a typed semantic command inside this active update. */
1221
- command: EditorCommandDispatch<BaseEditor<V, TPlugins>>;
1222
- /**
1223
- * Select an installed plugin's group without leaving this transaction.
1224
- * Prefer direct named groups when the editor type carries the complete graph.
1225
- */
1226
- plugin: EditorTransactionPluginPortal<V, EditorInstalledTransactionGroups<V, TPlugins>>;
1227
- } & EditorInstalledTransactionGroups<V, TPlugins> & EditorSelectionCapability<EditorSelection>;
1228
- /** Pure transaction builder available while producing a command spec. */
1229
- type EditorTransactionSpecBuilder<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = Omit<EditorCoreUpdateTransaction<V, EditorSelection>, 'plugins' | 'key'> & Readonly<{
1230
- /**
1231
- * Return the key for a node or location in this draft. A node the draft
1232
- * created carries a prepared key, which becomes its live key when the
1233
- * editor adopts this draft.
1234
- */
1235
- key: EditorKeyApi;
1236
- plugin: EditorTransactionPluginPortal<V, PluginUpdateMethods<EditorInstalledTransactionGroups<V, TPlugins>>>;
1237
- }> & PluginUpdateMethods<EditorInstalledTransactionGroups<V, TPlugins>> & EditorSelectionCapability<EditorSelection>;
1238
- type EditorReadMethods<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = Omit<EditorCoreStateView<V, EditorSelection>, 'key'> & EditorInstalledReadGroups<V, TPlugins>;
1239
- type EditorRead<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = (<T>(fn: (state: EditorStateView<V, TPlugins>) => T) => T) & EditorReadMethods<V, TPlugins>;
1240
- type EditorBivariantMethods<T> = { [K in keyof T as T[K] extends TxOnlyMethod<(...args: any[]) => any> ? never : K]: T[K] extends EditorGenericMethod<(...args: any[]) => any> ? T[K] : T[K] extends ((...args: any[]) => any) ? BivariantFunction<T[K]> : T[K]; };
1241
- type EditorDirectMethods<T> = { [K in keyof T as T[K] extends TxOnlyMethod<(...args: any[]) => any> ? never : K]: T[K] extends EditorGenericMethod<(...args: any[]) => any> ? T[K] : T[K] extends ((...args: infer TArgs) => infer TResult) ? BivariantMethod<TArgs, TResult | undefined> : T[K] extends object ? EditorDirectMethods<T[K]> : T[K]; };
1242
- type EditorCoreUpdateMethods<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = {
1243
- annotations: EditorDirectMethods<EditorTransactionAnnotationsApi>;
1244
- blocks: EditorDirectMethods<EditorTransactionBlocksApi<V>>;
1245
- break: EditorDirectMethods<EditorTransactionBreakApi>;
1246
- changes: EditorDirectMethods<EditorTransactionChangesApi>;
1247
- /** Dispatch a typed semantic command in one update. */
1248
- command: EditorDirectCommandDispatch<BaseEditor<V, TPlugins>>;
1249
- effects: EditorDirectMethods<EditorTransactionEffectsApi>;
1250
- plugins: EditorDirectMethods<Pick<EditorTransactionPluginsApi, 'reconfigure'>>;
1251
- fragment: EditorDirectMethods<Pick<EditorTransactionFragmentApi<V>, 'delete' | 'replace'>>;
1252
- marks: EditorDirectMethods<Pick<EditorTransactionMarksApi<V>, 'add' | 'remove' | 'set' | 'toggle'>>;
1253
- nodes: EditorDirectMethods<Pick<EditorTransactionNodesApi<V>, 'insert' | 'lift' | 'merge' | 'move' | 'remove' | 'replace' | 'replaceChildren' | 'split' | 'unwrap' | 'wrap'>> & Pick<EditorTransactionNodesApi<V>, 'set' | 'unset'>;
1254
- records: EditorTransactionRecordsApi;
1255
- roots: EditorDirectMethods<EditorTransactionRootsApi<V>>;
1256
- slice: EditorDirectMethods<Pick<EditorTransactionSliceApi<V>, 'replace'>>;
1257
- selection: EditorDirectMethods<Pick<EditorTransactionSelectionApi<EditorSelection>, 'collapse' | 'move' | 'set' | 'setNodes' | 'setPoint'>>;
1258
- setField: BivariantFunction<EditorCoreUpdateTransaction<V>['setField']>;
1259
- text: EditorDirectMethods<Pick<EditorTransactionTextApi, 'delete' | 'deleteBackward' | 'deleteForward' | 'insert'>>;
1260
- value: EditorDirectMethods<Pick<EditorUpdateValueApi<V>, 'repair' | 'replace'>>;
1261
- };
1262
- type PluginUpdateMethods<TGroups> = { [K in keyof TGroups]: TGroups[K] extends TxOnlyMethod<(...args: never[]) => unknown> ? Readonly<Record<never, never>> : TGroups[K] extends object ? EditorBivariantMethods<TGroups[K]> : TGroups[K]; };
1263
- type DirectPluginUpdateMethods<TGroups> = { [K in keyof TGroups]: TGroups[K] extends TxOnlyMethod<(...args: never[]) => unknown> ? Readonly<Record<never, never>> : TGroups[K] extends object ? EditorDirectMethods<TGroups[K]> : TGroups[K]; };
1264
- type EditorDirectUpdateMethods<TMethods> = TMethods extends TxOnlyMethod<(...args: never[]) => unknown> ? Readonly<Record<never, never>> : { [K in keyof TMethods as TMethods[K] extends TxOnlyMethod<(...args: never[]) => unknown> ? never : K]: TMethods[K]; };
1265
- /**
1266
- * A plugin's update methods called directly. Each call opens its own update,
1267
- * so top-level transaction-only controls are left out, and a transaction-only
1268
- * group offers nothing.
1269
- *
1270
- * @internal
1271
- */
1272
- type EditorDirectUpdate<TMethods> = EditorDirectUpdateMethods<TMethods> & ((policy: EditorUpdatePolicy) => EditorDirectUpdateMethods<TMethods>);
1273
- type EditorAvailableUpdatePolicy<TTxGroups> = Readonly<Omit<EditorUpdatePolicy, 'history'> & (string extends keyof TTxGroups ? {
1274
- history?: never;
1275
- } : 'history' extends keyof TTxGroups ? Pick<EditorUpdatePolicy, 'history'> : {
1276
- history?: never;
1277
- })>;
1278
- type EditorUpdateMethods<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = EditorCoreUpdateMethods<V, TPlugins> & DirectPluginUpdateMethods<EditorInstalledUpdateGroups<V, TPlugins>>;
1279
- type EditorUpdate<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = {
1280
- <R = void>(fn: (transaction: EditorUpdateTransaction<V, TPlugins>, context: EditorUpdateContext<BaseEditor<V, TPlugins>>) => R): R | undefined;
1281
- <R = void>(policy: EditorAvailableUpdatePolicy<EditorInstalledUpdateGroups<V, TPlugins>>, fn: (transaction: EditorUpdateTransaction<V, TPlugins>, context: EditorUpdateContext<BaseEditor<V, TPlugins>>) => R): R | undefined;
1282
- (policy: EditorAvailableUpdatePolicy<EditorInstalledUpdateGroups<V, TPlugins>>): EditorUpdateMethods<V, TPlugins>;
1283
- } & EditorUpdateMethods<V, TPlugins>;
1284
- type EditorUpdateContext<TEditor = Editor> = {
1285
- afterCommit: (handler: EditorCommitHandler<TEditor>) => void;
1286
- };
1287
- interface BaseEditor<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> {
1288
- api: Readonly<EditorCoreApiGroups & EditorInstalledApiGroups<TPlugins>>;
1289
- /** Create a live location that rebases across document changes. */
1290
- anchor: EditorAnchorApi;
1291
- /** Stable logical identity for this editor instance. */
1292
- id: string;
1293
- plugin: <const TPlugin extends PluginReference>(plugin: TPlugin) => PluginPortal<TPlugin, V>;
1294
- /** Return the stable runtime key for a live node or location. */
1295
- key: EditorKeyApi;
1296
- read: EditorRead<V, TPlugins>;
1297
- subscribeCommit: (listener: EditorCommitListener<any>) => () => void;
1298
- update: EditorUpdate<V, TPlugins>;
1299
- /**
1300
- * Add plugins to this live editor in a commit of their own, and return a
1301
- * function that removes, in another commit, each plugin this call added that
1302
- * nothing else still holds. Both throw while an editor update or read is
1303
- * open; inside an update, change plugins with `tx.plugins.reconfigure` on a
1304
- * plugin slot.
1305
- */
1306
- install: (plugin: PluginInput, options?: PluginReconfigureOptions) => (options?: PluginReconfigureOptions) => void;
1307
- /**
1308
- * End this editor's runtime: release every plugin's acquired resources
1309
- * and run every plugin cleanup with reason `remove`. Afterwards `update`
1310
- * and `install` throw and an uninstall handle does nothing. Idempotent.
1311
- * A `useEditor` editor is ended by its component; call this only for an
1312
- * editor you created with `createEditor`.
1313
- */
1314
- destroy: () => void;
1315
- }
1316
- /** Update policy available for a specific editor's installed plugins. */
1317
- type EditorUpdatePolicyFor<TEditor extends BaseEditor<any, any>> = TEditor extends BaseEditor<infer V, infer TPlugins extends readonly unknown[]> ? EditorAvailableUpdatePolicy<EditorInstalledUpdateGroups<V, TPlugins>> : never;
1318
- type EditorViewOptions<TRoot extends RootKey = RootKey> = {
1319
- /**
1320
- * How this view treats suggestions. An `intent` view edits the document
1321
- * with its review marks: `edit` applies writes as written and `propose`
1322
- * records them as suggestions. A `preview` view reads the document with
1323
- * every pending change accepted (`proposed`) or rejected (`accepted`) and
1324
- * throws on a plain edit, though some other writes still change the
1325
- * document, such as an update that makes a decision, undo and redo, and
1326
- * remote collaboration changes. Outside a transaction, its
1327
- * `read.selection()` names places of that preview.
1328
- */
1329
- authored?: Readonly<{
1330
- intent: 'edit' | 'propose';
1331
- }> | Readonly<{
1332
- preview: 'accepted' | 'proposed';
1333
- }>;
1334
- /**
1335
- * Author of every recorded write through this view, such as an AI's
1336
- * suggestions in a person's editor. Omit it to keep the source view's
1337
- * author, or the editor's when no view names one. It is fixed for the
1338
- * life of the view, and a non-empty string without a NUL character,
1339
- * because authored changes store it.
1340
- */
1341
- authorId?: string;
1342
- /**
1343
- * Immutable document the view reads instead of the source editor's value.
1344
- * Reads, plugin reads and plugin APIs resolve against it through the source
1345
- * editor's schema and plugins. The view is read-only, has no selection or
1346
- * last commit, and never notifies subscribers. The document must satisfy the
1347
- * source editor's schema.
1348
- */
1349
- document?: EditorDocumentValue;
1350
- readOnly?: boolean;
1351
- /** Named secondary root. Omit for the primary document. */
1352
- root?: NamedRootKey<TRoot>;
1353
- };
1354
- type EditorView<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = BaseEditor<V, TPlugins> & {
1355
- blur: () => void;
1356
- focus: () => void;
1357
- /** Named view root, or `undefined` for the primary document. */
1358
- readonly root: NamedRootKey | undefined;
1359
- };
1360
- type Editor<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = BaseEditor<V, TPlugins>;
1361
- /**
1362
- * Existential editor boundary for runtime registries.
1363
- *
1364
- * @internal
1365
- */
1366
- type AnyEditor<V extends Value = any, TPlugins extends readonly unknown[] = any> = BaseEditor<V, TPlugins>;
1367
- type CreateEditorOptions<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = {
1368
- plugins?: TPlugins;
1369
- /** Stable logical identity for this editor instance. */
1370
- id?: string;
1371
- initialSelection?: Selection<EditorSelection>;
1372
- initialValue?: InitialValue<V>;
1373
- /**
1374
- * Receives errors the editor catches so they cannot stop it: throws from
1375
- * plugin lifecycle observers, history replays and their handlers,
1376
- * data-transfer formats, external text adapters and pagination, and reports
1377
- * from the `renderElement` check. With no sink, each one goes to
1378
- * `reportError` as one `Error` that names its source, or to `console.error`
1379
- * where `reportError` does not exist.
1380
- */
1381
- lifecycleErrorSink?: EditorLifecycleErrorSink<Editor<V, TPlugins>>;
1382
- maxLength?: number;
1383
- readOnly?: boolean;
1384
- };
1385
- /** Default document value inferred from complete installed schema plugins. */
1386
- type EditorValueFromPlugins<TPlugins extends readonly unknown[]> = [SchemaValueFromPlugins<EditorResolvedInstalledPlugins<TPlugins>>] extends [never] ? Value : SchemaValueFromPlugins<EditorResolvedInstalledPlugins<TPlugins>> extends (infer V extends Value) ? V : Value;
1387
- type IsAny<T> = 0 extends 1 & T ? true : false;
1388
- declare const EDITOR_VALUE_TYPE: unique symbol;
1389
- declare const EDITOR_NODE_TYPES: unique symbol;
1390
- /**
1391
- * Deferred exact-node witness for hosts with a broad runtime editor.
1392
- *
1393
- * @internal
1394
- */
1395
- interface EditorNodeTypeProvider<TElementFactory extends () => Element = () => Element, TTextFactory extends () => Text = () => Text> {
1396
- readonly [EDITOR_NODE_TYPES]: Readonly<{
1397
- element: TElementFactory;
1398
- text: TTextFactory;
1399
- }>;
1400
- }
1401
- /**
1402
- * Deferred exact-value witness for hosts with a broad runtime editor.
1403
- *
1404
- * @internal
1405
- */
1406
- interface EditorValueTypeProvider<TValueFactory extends () => Value = () => Value> {
1407
- readonly [EDITOR_VALUE_TYPE]: TValueFactory;
1408
- }
1409
- type ValueOf<E> = E extends EditorValueTypeProvider<infer TValueFactory> ? ReturnType<TValueFactory> extends (infer TProvidedValue) ? IsAny<TProvidedValue> extends true ? Value : TProvidedValue extends Value ? TProvidedValue : Value : Value : E extends BaseEditor<infer V, any> ? IsAny<V> extends true ? Value : V extends Value ? V : Value : Value;
1410
- type PluginsOf<E> = E extends BaseEditor<any, infer TPlugins extends readonly unknown[]> ? TPlugins : readonly [];
1411
- type EditorMarks<V extends Value = Value> = Partial<Omit<ValueText<V>, 'text'>>;
1412
- type EditorMarksOf<E extends BaseEditor<any, any> = Editor> = EditorMarks<ValueOf<E>>;
1413
- /** Opaque identity for one descendant inside one editor runtime. */
1414
- type NodeKey = string & {
1415
- readonly '~nodeKey': true;
1416
- };
1417
- type SnapshotIndex = Readonly<{
1418
- /** Materialize the lazy index and return stable, frozen node-key/path pairs. */
1419
- entries: () => ReadonlyArray<readonly [NodeKey, Path]>;
1420
- /** Return the node key at a snapshot path, or `null` when absent. */
1421
- keyAt: (path: Path) => NodeKey | null;
1422
- /** Return the snapshot path for a node key, or `null` when absent. */
1423
- pathOf: (nodeKey: NodeKey) => Path | null;
1424
- }>;
1425
- type ProjectedRangeSegment = Readonly<{
1426
- path: Path;
1427
- key: NodeKey;
1428
- start: number;
1429
- end: number;
1430
- }>;
1431
- type EditorSnapshot<V extends Value = Value> = Readonly<{
1432
- children: V;
1433
- index: SnapshotIndex;
1434
- selection: Selection;
1435
- version: number;
1436
- }>;
1437
- type SnapshotInput<V extends Value = Value> = PersistedDocumentInput<V> | Readonly<{
1438
- children: V | readonly Descendant[];
1439
- meta?: Readonly<Record<string, unknown>>;
1440
- /** Omitted, the editor's records stay as they are. */
1441
- records?: EditorDocumentRecords;
1442
- roots?: Readonly<Record<RootKey, V | readonly Descendant[]>>;
1443
- selection?: SnapshotSelectionInput;
1444
- }>;
1445
- type SnapshotListener<V extends Value = Value> = (snapshot: EditorSnapshot<V>, change: EditorCommit<V>) => void;
1446
- type EditorCommitSource = 'commit' | 'selection' | 'text' | 'node' | 'decoration' | 'annotation' | 'root' | 'state' | 'focus' | 'composition' | 'external';
1447
- type TargetFreshnessRequest = {
1448
- fallback: Selection;
1449
- reason: 'implicit-target';
1450
- };
1451
- type EditorTargetRuntime = {
1452
- resolveImplicitTarget: (editor: Editor, request: TargetFreshnessRequest) => Selection;
1453
- };
1454
- declare const TRANSACTION_SPEC_TYPE: unique symbol;
1455
- interface TransactionSpec<TRoot extends RootKey = RootKey> {
1456
- /**
1457
- * Opaque proof that this spec was built by the owning editor.
1458
- *
1459
- * @internal
1460
- */
1461
- readonly [TRANSACTION_SPEC_TYPE]: true;
1462
- readonly annotations: ReadonlyArray<Readonly<{
1463
- type: EditorUpdateAnnotation;
1464
- value: unknown;
1465
- }>>;
1466
- readonly changes: DocumentChange;
1467
- readonly effects: readonly EditorEffect[];
1468
- readonly kind: 'transaction';
1469
- readonly selection?: Readonly<{
1470
- /** Named selection root. Omitted for the primary document. */
1471
- root?: NamedRootKey<TRoot>;
1472
- value: Selection;
1473
- }>;
1474
- readonly tags: readonly EditorUpdateTag[];
1475
- }
1476
- type EditorCommandResult = false | TransactionSpec;
1477
- /** @internal */
1478
- declare const editorStateViewTypes: unique symbol;
1479
- /**
1480
- * Deferred state-view carrier for editor layers with richer transactions.
1481
- *
1482
- * @internal
1483
- */
1484
- interface EditorStateViewProvider<TStateFactory extends () => unknown> {
1485
- readonly [editorStateViewTypes]: TStateFactory;
1486
- }
1487
- /**
1488
- * Deferred update-transaction carrier for layered editor types.
1489
- *
1490
- * @internal
1491
- */
1492
- /** @internal */
1493
- declare const editorUpdateTransactionTypes: unique symbol;
1494
- interface EditorUpdateTransactionProvider<TTransactionFactory extends () => unknown> {
1495
- readonly [editorUpdateTransactionTypes]: TTransactionFactory;
1496
- }
1497
- /**
1498
- * Resolve a layered editor's exact live update transaction.
1499
- *
1500
- * @internal
1501
- */
1502
- type EditorUpdateTransactionOf<TEditor> = TEditor extends EditorUpdateTransactionProvider<infer TTransactionFactory> ? ReturnType<TTransactionFactory> : EditorUpdateTransaction<ValueOf<TEditor>, PluginsOf<TEditor>>;
1503
- type EditorStateViewOf<TEditor> = TEditor extends EditorStateViewProvider<infer TStateFactory> ? ReturnType<TStateFactory> : EditorStateView<ValueOf<TEditor>, PluginsOf<TEditor>>;
1504
- type EditorCommandContext<Input, TEditor = Editor> = {
1505
- input: Readonly<Input>;
1506
- state: EditorStateViewOf<TEditor>;
1507
- /** Frozen semantic tags visible across the active update/spec stack. */
1508
- tags: readonly EditorUpdateTag[];
1509
- };
1510
- /**
1511
- * Where a command's stored targets land in the document it decides on. A
1512
- * point lands where typing there would land, a range keeps content at its
1513
- * edges out, and a path or a span's paths land on their nodes' paths. A node
1514
- * or node key names its node in both documents, so it stays as given. Each
1515
- * target keeps its kind, and `location` returns null when it has no place
1516
- * there.
1517
- */
1518
- type EditorCommandPlace = Readonly<{
1519
- location: <T extends NodeTarget | NodeSelection | Span>(at: T) => T | null;
1520
- }>;
1521
- type EditorCommandContinuation<Input> = ((...input: [] | [input: Input]) => EditorCommandResult) & {
1522
- /** Run downstream against the immutable state produced by the prefix. */
1523
- after: (prefix: TransactionSpec, ...input: [] | [input: Input]) => EditorCommandResult;
1524
- };
1525
- type EditorCommandHandler<Input, TEditor = Editor> = (context: EditorCommandContext<Input, TEditor>) => EditorCommandResult;
1526
- type EditorCommandAroundHandler<Input, TEditor = Editor> = (context: EditorCommandContext<Input, TEditor> & {
1527
- next: EditorCommandContinuation<Input>;
1528
- }) => EditorCommandResult;
1529
- /** @internal */
1530
- declare const editorCommandRegistrationTypes: unique symbol;
1531
- type EditorCommandRegistration<TEditor = Editor> = Readonly<{
1532
- [editorCommandRegistrationTypes]: (capabilities: EditorCommandCapabilities<TEditor>) => void;
1533
- }>;
1534
- type PluginCommandContext<TEditor extends BaseEditor<any, any> = Editor> = Readonly<{
1535
- /** Register ordinary conditional behavior. `false` falls through. */
1536
- handle: <TCommand extends EditorCommandDescriptor>(command: CompatibleEditorCommand<TEditor, TCommand>, handler: EditorCommandHandler<EditorCommandInput<TCommand>, TEditor>) => EditorCommandRegistration<TEditor>;
1537
- /**
1538
- * Register input rewriting or downstream spec composition. Delegate with
1539
- * `next()` or `next.after()`; returning `false` rejects the command.
1540
- */
1541
- around: <TCommand extends EditorCommandDescriptor>(command: CompatibleEditorCommand<TEditor, TCommand>, handler: EditorCommandAroundHandler<EditorCommandInput<TCommand>, TEditor>) => EditorCommandRegistration<TEditor>;
1542
- }>;
1543
- /** @internal */
1544
- declare const editorReadTypes: unique symbol;
1545
- type PrivateEditorReadTypes<Input, Result, TEditor> = Readonly<{
1546
- [editorReadTypes]: Readonly<{
1547
- editor: TEditor;
1548
- input: Input;
1549
- result: Result;
1550
- }>;
1551
- }>;
1552
- type EditorReadDescriptor<Input = void, Result = unknown, TEditor extends BaseEditor<any, any> = Editor> = Readonly<{
1553
- /** Stable configuration and diagnostics identity. */
1554
- id: string;
1555
- }> & PrivateEditorReadTypes<Input, Result, TEditor>;
1556
- type EditorReadInput<TRead extends EditorReadDescriptor<any, any, any>> = TRead extends PrivateEditorReadTypes<infer Input, any, any> ? Input : never;
1557
- type EditorReadResult<TRead extends EditorReadDescriptor<any, any, any>> = TRead extends PrivateEditorReadTypes<any, infer Result, any> ? Result : never;
1558
- type EditorReadRequiredEditor<TRead extends EditorReadDescriptor<any, any, any>> = TRead extends PrivateEditorReadTypes<any, any, infer TEditor> ? TEditor : never;
1559
- type EditorReadCapabilities<TEditor> = TEditor extends BaseEditor<infer V extends Value, infer TPlugins extends readonly unknown[]> ? Readonly<{
1560
- state: EditorInstalledReadGroups<V, TPlugins>;
1561
- value: V;
1562
- }> : never;
1563
- type IsDefaultEditor<TEditor> = [PluginsOf<TEditor>] extends [readonly []] ? [Value] extends [ValueOf<TEditor>] ? [ValueOf<TEditor>] extends [Value] ? true : false : false : false;
1564
- type CompatibleEditorRead<TEditor, TRead extends EditorReadDescriptor<any, any, any>> = IsDefaultEditor<EditorReadRequiredEditor<TRead>> extends true ? TRead : EditorReadCapabilities<TEditor> extends EditorReadCapabilities<EditorReadRequiredEditor<TRead>> ? TRead : never;
1565
- type EditorReadContinuation<Input, Result> = (...input: [] | [input: Input]) => Result;
1566
- type EditorReadContext<Input, Result, TEditor extends BaseEditor<any, any> = Editor> = Readonly<{
1567
- editor: TEditor;
1568
- input: Readonly<Input>;
1569
- next: EditorReadContinuation<Input, Result>;
1570
- state: EditorStateView<ValueOf<TEditor>, PluginsOf<TEditor>>;
1571
- }>;
1572
- type EditorReadAroundHandler<Input, Result, TEditor extends BaseEditor<any, any> = Editor> = (context: EditorReadContext<Input, Result, TEditor>) => Result;
1573
- /** @internal */
1574
- declare const editorReadRegistrationTypes: unique symbol;
1575
- type EditorReadRegistration<TEditor = Editor> = Readonly<{
1576
- [editorReadRegistrationTypes]: (capabilities: EditorReadCapabilities<TEditor>) => void;
1577
- }>;
1578
- type PluginReadContext<TEditor extends BaseEditor<any, any> = Editor> = Readonly<{
1579
- around: <TRead extends EditorReadDescriptor<any, any, any>>(read: CompatibleEditorRead<TEditor, TRead>, handler: EditorReadAroundHandler<EditorReadInput<TRead>, EditorReadResult<TRead>, TEditor>) => EditorReadRegistration<TEditor>;
1580
- }>;
1581
- type PluginReadMiddlewareFactory<TEditor extends BaseEditor<any, any> = Editor> = BivariantMethod<[context: PluginReadContext<TEditor>], ReadonlyArray<EditorReadRegistration<TEditor>>>;
1582
- /** @internal */
1583
- declare const editorCommandTypes: unique symbol;
1584
- type PrivateEditorCommandTypes<Input, TEditor> = Readonly<{
1585
- [editorCommandTypes]: Readonly<{
1586
- editor: TEditor;
1587
- input: Input;
1588
- }>;
1589
- }>;
1590
- type EditorCommand<Input = void, TEditor extends BaseEditor<any, any> = Editor> = Readonly<{
1591
- /** Stable configuration and diagnostics identity. */
1592
- id: string;
1593
- }> & PrivateEditorCommandTypes<Input, TEditor>;
1594
- /** Minimal descriptor shape shared by every semantic editor command. */
1595
- type EditorCommandDescriptor = Readonly<{
1596
- id: string;
1597
- }> & PrivateEditorCommandTypes<any, any>;
1598
- /** Input accepted by one semantic command descriptor. */
1599
- type EditorCommandInput<TCommand extends EditorCommandDescriptor> = TCommand extends PrivateEditorCommandTypes<infer Input, any> ? Input : never;
1600
- /**
1601
- * Editor capability required by one semantic command descriptor.
1602
- *
1603
- * @internal
1604
- */
1605
- type EditorCommandRequiredEditor<TCommand extends EditorCommandDescriptor> = TCommand extends PrivateEditorCommandTypes<any, infer TEditor> ? TEditor : never;
1606
- /**
1607
- * Pure capabilities visible while building a semantic command.
1608
- *
1609
- * @internal
1610
- */
1611
- type EditorCommandCapabilities<TEditor> = TEditor extends BaseEditor<infer V extends Value, infer TPlugins extends readonly unknown[]> ? Readonly<{
1612
- state: EditorInstalledReadGroups<V, TPlugins>;
1613
- transaction: PluginUpdateMethods<EditorInstalledUpdateGroups<V, TPlugins>>;
1614
- value: V;
1615
- }> : never;
1616
- /** A command accepted only when the actual editor meets its requirements. */
1617
- type CompatibleEditorCommand<TEditor, TCommand extends EditorCommandDescriptor> = IsDefaultEditor<EditorCommandRequiredEditor<TCommand>> extends true ? TCommand : EditorCommandCapabilities<TEditor> extends EditorCommandCapabilities<EditorCommandRequiredEditor<TCommand>> ? TCommand : never;
1618
- type EditorCommandDispatch<TEditor = Editor> = <TCommand extends EditorCommandDescriptor>(command: TCommand & CompatibleEditorCommand<TEditor, TCommand>, ...input: [EditorCommandInput<TCommand>] extends [void] ? [] | [input: EditorCommandInput<TCommand>] : [input: EditorCommandInput<TCommand>]) => boolean;
1619
- /**
1620
- * Dispatch a command in its own update. It answers `undefined` when the editor
1621
- * refuses that update.
1622
- */
1623
- type EditorDirectCommandDispatch<TEditor = Editor> = <TCommand extends EditorCommandDescriptor>(command: TCommand & CompatibleEditorCommand<TEditor, TCommand>, ...input: [EditorCommandInput<TCommand>] extends [void] ? [] | [input: EditorCommandInput<TCommand>] : [input: EditorCommandInput<TCommand>]) => boolean | undefined;
1624
- type EditorCorrectionTransaction<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = Pick<EditorCoreUpdateTransaction<V>, 'anchor' | 'blocks' | 'break' | 'fragment' | 'marks' | 'nodes' | 'schema' | 'selection' | 'tags' | 'text'> & EditorInstalledUpdateGroups<V, TPlugins> & {
1625
- value: EditorStateValueApi<V>;
1626
- };
1627
- type EditorCorrectionEvent = 'children' | 'content' | 'properties';
1628
- type EditorCorrectionQuery<TNode extends Node = Node> = 'root' | Readonly<{
1629
- match?(node: TNode, path: Path): boolean;
1630
- type?: NodeTypeSelector;
1631
- }>;
1632
- type EditorCorrectionContext<TEditor extends BaseEditor<any, any> = Editor> = {
1633
- editor: TEditor;
1634
- entry: NodeEntry;
1635
- tx: EditorCorrectionTransaction<ValueOf<TEditor>, PluginsOf<TEditor>>;
1636
- };
1637
- type EditorCorrection<TEditor extends BaseEditor<any, any> = Editor> = {
1638
- correct: (context: EditorCorrectionContext<TEditor>) => void;
1639
- event: EditorCorrectionEvent;
1640
- query?: EditorCorrectionQuery;
1641
- };
1642
- type PluginReadFactoryContext<TEditor extends BaseEditor<any, any> = Editor> = Readonly<{
1643
- editor: TEditor;
1644
- state: EditorStateView<ValueOf<TEditor>, PluginsOf<TEditor>>;
1645
- }>;
1646
- type EditorReadMethodRecord = Readonly<{
1647
- [key: string]: EditorReadMethodTree;
1648
- }>;
1649
- type EditorReadMethodTree = ((...args: any[]) => unknown) | EditorReadMethodRecord;
1650
- type PluginUpdateFactoryContext<TEditor extends BaseEditor<any, any> = Editor> = Readonly<{
1651
- context: EditorUpdateContext<TEditor>;
1652
- editor: TEditor;
1653
- tx: EditorUpdateTransaction<ValueOf<TEditor>, PluginsOf<TEditor>>;
1654
- }>;
1655
- type PluginReadFactory<TEditor extends BaseEditor<any, any> = Editor, TResult extends EditorReadMethodTree = EditorReadMethodTree> = BivariantMethod<[context: PluginReadFactoryContext<TEditor>], TResult>;
1656
- type PluginUpdateFactory<TEditor extends BaseEditor<any, any> = Editor, TResult = unknown> = BivariantMethod<[context: PluginUpdateFactoryContext<TEditor>], TResult>;
1657
- /**
1658
- * Runtime storage keyed by the owning plugin name.
1659
- *
1660
- * @internal
1661
- */
1662
- type PluginApiMap = Record<string, unknown>;
1663
- type PluginCandidateEditor<TEditor extends BaseEditor<any, any> = Editor> = TEditor & {
1664
- plugin: TEditor['plugin'];
1665
- };
1666
- declare const PLUGIN_REQUIRED_EDITOR: unique symbol;
1667
- type PluginPoint<TValue> = Readonly<{
1668
- id: string;
1669
- of: (value: TValue) => PluginContribution<TValue>;
1670
- }>;
1671
- /** Contextual installation requirement for one opaque plugin contribution. */
1672
- type PluginContributionInput<TRequiredEditor = unknown> = Readonly<{
1673
- point: Readonly<{
1674
- id: string;
1675
- }>;
1676
- /**
1677
- * Contravariant proof of the editor capabilities this value needs.
1678
- *
1679
- * @internal
1680
- */
1681
- [PLUGIN_REQUIRED_EDITOR]?: (editor: TRequiredEditor) => void;
1682
- }>;
1683
- type PluginContribution<TValue, TRequiredEditor = unknown> = PluginContributionInput<TRequiredEditor> & Readonly<{
1684
- point: PluginPoint<TValue>;
1685
- }>;
1686
- /**
1687
- * Resolve host APIs against one stable plugin candidate.
1688
- * API-factory results become visible only after every factory has resolved.
1689
- */
1690
- type PluginApiFactoryContext<TEditor extends BaseEditor<any, any> = Editor> = Readonly<{
1691
- editor: PluginCandidateEditor<TEditor>;
1692
- getContributions: <TValue>(point: PluginPoint<TValue>) => ReadonlyArray<Readonly<TValue>>;
1693
- /** Named view root, or `undefined` for the primary document. */
1694
- root: NamedRootKey | undefined;
1695
- }>;
1696
- type PluginApiFactory<TEditor extends BaseEditor<any, any> = Editor, TResult = unknown> = BivariantMethod<[context: PluginApiFactoryContext<TEditor>], TResult>;
1697
- type PluginPortal<TPlugin, V extends Value = Value> = Readonly<{
1698
- api: EditorApiValueFromPlugin<TPlugin>;
1699
- /** Whether this exact descriptor or an adopted descendant is installed. */
1700
- installed: boolean;
1701
- read: EditorReadValueFromPlugin<V, TPlugin>;
1702
- update: EditorDirectUpdate<EditorUpdateValueFromPlugin<V, TPlugin>>;
1703
- }>;
1704
- type EditorAnchorApi = {
1705
- <TValue extends AnchorValue, const TRoot extends RootKey>(value: TValue, options: AnchorOptions<TValue, TRoot>): Anchor<TValue>;
1706
- /** Save a mapped range with the document; the JSON owns no live resources. */
1707
- save: (anchor: Anchor<Range>) => EditorDocumentRange;
1708
- /** Restore a saved range in this view. Release the returned live handle. */
1709
- restore: (range: unknown) => Anchor<Range>;
1710
- };
1711
- type EditorKeyApi = {
1712
- (node: Descendant): NodeKey;
1713
- (at: Location): NodeKey | null;
1714
- };
1715
- type EditorCoreApiGroups = Record<never, never>;
1716
- type PluginCleanupContext = Readonly<{
1717
- reason: 'remove' | 'replace' | 'rollback';
1718
- }>;
1719
- type PluginActivationContext = Readonly<{
1720
- /**
1721
- * Register `take`, which claims something outside the editor, such as a
1722
- * listener on a shared document or a network channel, and returns its
1723
- * release. Activation can run in a React render that never commits, so
1724
- * keep `activate` in memory and claim outside resources only here. On an
1725
- * editor from `createEditor`, or a component's editor after React commits
1726
- * it, `take` runs during publication once every `beforePublish` has
1727
- * passed, and a throw rolls the publication back. On a component's editor
1728
- * before that commit, `take` runs at the commit. Each release runs once:
1729
- * when the component unmounts, when the editor is destroyed, or when the
1730
- * plugin is removed, replaced or rolled back. `take` and its release must
1731
- * be synchronous and must not update the editor.
1732
- */
1733
- acquire: (take: () => (context: PluginCleanupContext) => void) => void;
1734
- afterPublish: (callback: () => void) => void;
1735
- /**
1736
- * Initialize against the final document before publication becomes permanent.
1737
- * Must be synchronous. Throwing aborts publication and runs activation cleanup.
1738
- * Document writes are forbidden; take outside resources with `acquire`.
1739
- */
1740
- beforePublish: (callback: () => void) => void;
1741
- pluginName: string;
1742
- /**
1743
- * Drop in-memory state when the plugin is removed, replaced or rolled back,
1744
- * or when the editor is destroyed.
1745
- */
1746
- onCleanup: (cleanup: (context: PluginCleanupContext) => void) => void;
1747
- /** Named view root, or `undefined` for the primary document. */
1748
- root: NamedRootKey | undefined;
1749
- schema: EditorStateSchemaApi;
1750
- signal: AbortSignal;
1751
- }>;
1752
- type EditorLifecycleError<TEditor = Editor> = Readonly<{
1753
- cause: unknown;
1754
- editor: TEditor;
1755
- phase: 'cleanup' | 'measure' | 'publish';
1756
- source: 'pagination';
1757
- }> | Readonly<{
1758
- cause: unknown;
1759
- editor: TEditor;
1760
- phase: 'mount' | 'update' | 'focus' | 'offsetAt' | 'destroy';
1761
- source: 'external-text';
1762
- }> | Readonly<{
1763
- cause: unknown;
1764
- editor: TEditor;
1765
- pluginName: string;
1766
- phase: 'after-commit' | 'afterPublish' | 'cleanup' | 'commit-listener' | 'node-change-listener' | 'snapshot-listener' | 'source-listener' | 'text-change-listener';
1767
- }> | Readonly<{
1768
- cause: unknown;
1769
- editor: TEditor;
1770
- pluginName: string;
1771
- mimeType: string;
1772
- key: string;
1773
- phase: 'accept' | 'decode' | 'encode';
1774
- source: 'data-transfer-format';
1775
- }> | Readonly<{
1776
- cause: unknown;
1777
- direction: 'redo' | 'undo';
1778
- editor: TEditor;
1779
- /**
1780
- * `replay` when the replay could not finish; `observer` when a step
1781
- * after its outcome threw, such as `onHistoryReplay` or focus repair.
1782
- */
1783
- phase: 'observer' | 'replay';
1784
- source: 'history';
1785
- }> | Readonly<{
1786
- cause: Error;
1787
- /** The editable child the renderer left without DOM or a DOM coverage boundary. */
1788
- childPath: Path;
1789
- editor: TEditor;
1790
- /** The element whose `renderElement` omitted the child. */
1791
- element: Element;
1792
- path: Path;
1793
- /**
1794
- * `commit` from the development check after an element renders;
1795
- * `selection-export` from a failed post-commit selection export.
1796
- */
1797
- phase: 'commit' | 'selection-export';
1798
- source: 'render-element';
1799
- }> | Readonly<{
1800
- cause: Error;
1801
- editor: TEditor;
1802
- /** This peer's copy of the root, which the merge replaced. */
1803
- lost: readonly Descendant[];
1804
- /**
1805
- * `merge` when a teammate's concurrent write of a root replaced this
1806
- * peer's copy, such as when both restored one deleted board apart.
1807
- */
1808
- phase: 'merge';
1809
- root: NamedRootKey;
1810
- source: 'yjs';
1811
- }>;
1812
- type EditorLifecycleErrorSink<TEditor = Editor> = (error: EditorLifecycleError<TEditor>) => void;
1813
- type PluginCandidateContext<TEditor extends BaseEditor<any, any> = Editor> = PluginApiFactoryContext<TEditor> & Readonly<{
1814
- name: string;
1815
- schema: EditorStateSchemaApi<ValueOf<TEditor>>;
1816
- }>;
1817
- type EditorCommitContext<TEditor = Editor> = {
1818
- commit: EditorCommit<ValueOf<TEditor>>;
1819
- editor: TEditor;
1820
- snapshot: EditorSnapshot<ValueOf<TEditor>>;
1821
- };
1822
- type EditorCommitHandler<TEditor = Editor> = (context: EditorCommitContext<TEditor>) => void;
1823
- type EditorTransactionChangeContext<TEditor = Editor> = Readonly<{
1824
- after: EditorDocumentValue<ValueOf<TEditor>>;
1825
- before: EditorDocumentValue<ValueOf<TEditor>>;
1826
- change: DocumentChange;
1827
- /** Lazy final-coordinate document-change queries for this transaction step. */
1828
- changed: EditorTransactionChanged;
1829
- editor: TEditor;
1830
- selectionAfter: Selection;
1831
- selectionAfterRoot: NamedRootKey | undefined;
1832
- selectionBefore: Selection;
1833
- selectionBeforeRoot: NamedRootKey | undefined;
1834
- tx: EditorUpdateTransaction<ValueOf<TEditor>, PluginsOf<TEditor>>;
1835
- }>;
1836
- type EditorTransactionChangeHandler<TEditor = Editor> = (context: EditorTransactionChangeContext<TEditor>) => void;
1837
- type EditorNodeChangeKind = 'insert' | 'move' | 'remove' | 'update';
1838
- type EditorNodeChangeContext<TEditor = Editor> = {
1839
- commit: EditorCommit<ValueOf<TEditor>>;
1840
- editor: TEditor;
1841
- kind: EditorNodeChangeKind;
1842
- node: DescendantIn<ValueOf<TEditor>> | null;
1843
- path: Path;
1844
- previousPath: Path | null;
1845
- previousNode: DescendantIn<ValueOf<TEditor>> | null;
1846
- /** Named changed root, or `undefined` for the primary document. */
1847
- root: NamedRootKey | undefined;
1848
- };
1849
- type EditorTextChangeContext<TEditor = Editor> = {
1850
- commit: EditorCommit<ValueOf<TEditor>>;
1851
- editor: TEditor;
1852
- node: DescendantIn<ValueOf<TEditor>> | null;
1853
- path: Path;
1854
- previousPath: Path;
1855
- previousText: string;
1856
- /** Named changed root, or `undefined` for the primary document. */
1857
- root: NamedRootKey | undefined;
1858
- text: string;
1859
- };
1860
- type EditorNodeChangeHandler<TEditor = Editor> = (context: EditorNodeChangeContext<TEditor>) => void;
1861
- type EditorTextChangeHandler<TEditor = Editor> = (context: EditorTextChangeContext<TEditor>) => void;
1862
- type PluginChangeHandlers<TEditor = Editor> = Readonly<{
1863
- commit?: EditorCommitHandler<TEditor>;
1864
- nodeChange?: EditorNodeChangeHandler<TEditor>;
1865
- textChange?: EditorTextChangeHandler<TEditor>;
1866
- transactionChange?: EditorTransactionChangeHandler<TEditor>;
1867
- }>;
1868
- type PluginSchemaFactoryContext = Readonly<{
1869
- name: string;
1870
- }>;
1871
- type PluginSchemaFactory = (context: PluginSchemaFactoryContext) => EditorSchemaDeclaration;
1872
- /**
1873
- * Erased runtime descriptor reference. Exact author capabilities live only in
1874
- * `Plugin<D>`'s private invariant witness.
1875
- */
1876
- declare class PrivatePluginReferenceBrand {
1877
- protected get pluginReference(): true;
1878
- }
1879
- type PluginReference = Readonly<{
1880
- enabled?: boolean;
1881
- name: string;
1882
- }> & PrivatePluginReferenceBrand;
1883
- type PluginShallowReference = Readonly<{
1884
- enabled?: boolean;
1885
- name: string;
1886
- }>;
1887
- type PluginDefinition = Readonly<{
1888
- api?: unknown;
1889
- activate?: true;
1890
- commands?: true;
1891
- conflicts?: readonly PluginShallowReference[];
1892
- contributions?: true;
1893
- corrections?: true;
1894
- dependencies?: readonly PluginShallowReference[];
1895
- effectTypes?: true;
1896
- enabled?: boolean;
1897
- name: string;
1898
- on?: true;
1899
- read?: unknown;
1900
- readMiddleware?: true;
1901
- schema?: EditorSchemaDeclaration;
1902
- stateFields?: true;
1903
- update?: unknown;
1904
- validate?: true;
1905
- }>;
1906
- declare class PrivatePluginWitness<TWitness> {
1907
- protected get witness(): TWitness;
1908
- }
1909
- type PluginWitnessOf<TPlugin> = TPlugin extends PrivatePluginWitness<infer TWitness> ? TWitness : never;
1910
- type PluginCapabilityOf<TPlugin> = TPlugin extends unknown ? [PluginWitnessOf<TPlugin>] extends [never] ? TPlugin extends PluginDefinition ? TPlugin : never : PluginWitnessOf<TPlugin> extends {
1911
- capability: infer TCapability;
1912
- } ? TCapability : never : never;
1913
- type PluginInternalDefinitionOf<TPlugin> = TPlugin extends unknown ? [PluginWitnessOf<TPlugin>] extends [never] ? never : PluginWitnessOf<TPlugin> extends {
1914
- internalDefinition: (definition: infer TDefinition) => infer TDefinition;
1915
- } ? TDefinition : never : never;
1916
- type PluginDependencyReferences<TInput> = TInput extends readonly unknown[] ? { readonly [TIndex in keyof TInput]: PluginShallowReferenceOf<TInput[TIndex]>; } : never;
1917
- type PluginPublicDefinition<TDefinition> = Readonly<{ [TKey in keyof TDefinition]: TKey extends 'conflicts' | 'dependencies' ? PluginDependencyReferences<TDefinition[TKey]> : TDefinition[TKey]; }>;
1918
- type DefinitionOf<TPlugin> = TPlugin extends unknown ? PluginWitnessOf<TPlugin> extends {
1919
- definition: (definition: infer TDefinition) => infer TDefinition;
1920
- } ? TDefinition : never : never;
1921
- type PluginCapabilityFromPublicDefinition<TDefinition> = Readonly<Pick<TDefinition, Extract<keyof TDefinition, 'api' | 'enabled' | 'name' | 'read' | 'schema' | 'update'>>>;
1922
- type PluginCapabilityDefinition<TDefinition> = PluginCapabilityFromPublicDefinition<PluginPublicDefinition<TDefinition>>;
1923
- /** Shallow public reference to an plugin dependency. */
1924
- interface PluginDependencyReference extends PrivatePluginReferenceBrand {
1925
- readonly enabled?: boolean;
1926
- readonly name: string;
1927
- }
1928
- type PluginDependencyContract = Readonly<{
1929
- direct: PluginDefinition;
1930
- installed: unknown;
1931
- }>;
1932
- declare class PrivatePluginDependencyWitness<TContract> {
1933
- protected get dependencyContract(): TContract;
1934
- }
1935
- /**
1936
- * Named declaration carrier for one finite dependency contract.
1937
- *
1938
- */
1939
- interface PluginDependencyContractReference<in out TContract extends PluginDependencyContract> extends PluginDependencyReference, PrivatePluginDependencyWitness<TContract> {}
1940
- type PluginDependencyContractOf<TReference> = TReference extends PrivatePluginDependencyWitness<infer TContract extends PluginDependencyContract> ? TContract : never;
1941
- type PluginShallowReferenceFromDefinition<TDefinition> = Readonly<{
1942
- name: TDefinition extends {
1943
- name: infer TName extends string;
1944
- } ? TName : string;
1945
- }> & (TDefinition extends {
1946
- enabled: infer TEnabled extends boolean;
1947
- } ? Readonly<{
1948
- enabled: TEnabled;
1949
- }> : Readonly<Record<never, never>>) & PrivatePluginReferenceBrand;
1950
- type PluginShallowReferenceOf<TReference> = PluginDependencyContractOf<TReference> extends (infer TContract) ? TContract extends PluginDependencyContract ? PluginShallowReferenceFromDefinition<TContract['direct']> : PluginShallowReferenceFromDefinition<TReference> : PluginShallowReferenceFromDefinition<TReference>;
1951
- type PluginInstalledFromReference<TReference> = PluginDependencyContractOf<TReference> extends (infer TContract) ? TContract extends PluginDependencyContract ? TContract['installed'] : never : never;
1952
- type PluginDirectFromReference<TReference> = PluginDependencyContractOf<TReference> extends (infer TContract) ? TContract extends PluginDependencyContract ? TContract['direct'] : never : never;
1953
- type PluginRequirementNames<TRequirement> = TRequirement extends unknown ? TRequirement extends {
1954
- name: infer TName extends PropertyKey;
1955
- } ? TName : never : never;
1956
- type PluginExcludeRequirementNames<TRequirement, TNames extends PropertyKey> = TRequirement extends unknown ? TRequirement extends {
1957
- name: infer TName extends PropertyKey;
1958
- } ? TName extends TNames ? never : TRequirement : TRequirement : never;
1959
- type PluginRequirementsFromReferences<TReferences extends readonly unknown[]> = number extends TReferences['length'] ? PluginInstalledFromReference<TReferences[number]> : TReferences extends readonly [...infer TPrevious extends readonly unknown[], infer TLast] ? PluginInstalledFromReference<TLast> extends (infer TInstalledLast) ? TInstalledLast | PluginExcludeRequirementNames<PluginRequirementsFromReferences<TPrevious>, PluginRequirementNames<PluginDirectFromReference<TLast>>> : never : never;
1960
- type PluginRequirementsOf<TPlugin> = TPlugin extends unknown ? [PluginDependencyContractOf<TPlugin>] extends [never] ? PluginInternalDefinitionOf<TPlugin> extends {
1961
- dependencies: infer TDependencies extends readonly unknown[];
1962
- } ? PluginRequirementsFromReferences<TDependencies> : never : PluginDependencyContractOf<TPlugin>['installed'] : never;
1963
- type ResolvedPluginTypeProvider<TPlugin> = TPlugin extends unknown ? TPlugin extends PluginTypeProvider<infer TProvider extends PluginTypeLambda> ? PluginTypeProvider<TProvider> : Readonly<Record<never, never>> : never;
1964
- type EditorSchemaPluginProviderOf<TPlugin> = TPlugin extends unknown ? TPlugin extends EditorSchemaPluginProvider<infer TSchema> ? EditorSchemaPluginProvider<TSchema> : Readonly<Record<never, never>> : never;
1965
- /**
1966
- * Preserve only one plugin's finite type-provider projection.
1967
- *
1968
- */
1969
- type PluginTypeProviderOf<TPlugin> = ResolvedPluginTypeProvider<TPlugin>;
1970
- type PluginDirectCapability<TPlugin> = TPlugin extends unknown ? PluginCapabilityOf<TPlugin> extends (infer TCapability extends PluginDefinition) ? TCapability & ResolvedPluginTypeProvider<TPlugin> & EditorSchemaPluginProviderOf<TPlugin> : never : never;
1971
- type PluginDirectDependencyCapability<TPlugin> = TPlugin extends unknown ? PluginCapabilityOf<TPlugin> extends (infer TCapability extends PluginDefinition) ? TCapability extends {
1972
- enabled: false;
1973
- } ? Readonly<Pick<TCapability, 'enabled' | 'name'>> : PluginDirectCapability<TPlugin> : never : never;
1974
- type PluginInstallRequirement<TPlugin> = TPlugin extends unknown ? PluginCapabilityOf<TPlugin> extends {
1975
- enabled: false;
1976
- } ? never : PluginDirectCapability<TPlugin> extends (infer TDirect) ? TDirect | PluginExcludeRequirementNames<PluginRequirementsOf<TPlugin>, PluginRequirementNames<TDirect>> : never : never;
1977
- type PluginDependencyContractFor<TPlugin> = TPlugin extends unknown ? [PluginDependencyContractOf<TPlugin>] extends [never] ? Readonly<{
1978
- direct: PluginDirectDependencyCapability<TPlugin>;
1979
- installed: PluginInstallRequirement<TPlugin>;
1980
- }> : PluginDependencyContractOf<TPlugin> : never;
1981
- /**
1982
- * Compact install contract for one direct dependency.
1983
- *
1984
- */
1985
- type PluginDependencyReferenceFor<TPlugin> = TPlugin extends unknown ? PluginDependencyContractReference<PluginDependencyContractFor<TPlugin>> : never;
1986
- /**
1987
- * Finite installed capability carried by one dependency reference.
1988
- *
1989
- */
1990
- type PluginInstalledCapabilitiesOf<TReference> = PluginDependencyContractOf<TReference> extends (infer TContract) ? TContract extends Readonly<{
1991
- installed: infer TInstalled;
1992
- }> ? TInstalled : never : never;
1993
- type PluginRuntimeReferences<TInput> = TInput extends readonly unknown[] ? { readonly [TIndex in keyof TInput]: PluginShallowReferenceOf<TInput[TIndex]>; } : never;
1994
- type PluginRuntimeField<TDefinition, TKey extends keyof TDefinition> = TKey extends 'conflicts' | 'dependencies' ? PluginRuntimeReferences<TDefinition[TKey]> : TKey extends 'enabled' | 'name' | 'schema' ? TDefinition[TKey] : unknown;
1995
- /**
1996
- * Exact type witness without public runtime descriptor fields.
1997
- *
1998
- * The factory defers definition expansion until a consumer reads the witness.
1999
- *
2000
- */
2001
- type PluginWitnessFor<TDefinitionFactory extends () => PluginDefinition> = PrivatePluginWitness<{
2002
- capability: PluginCapabilityDefinition<ReturnType<TDefinitionFactory>>;
2003
- definition: (definition: PluginPublicDefinition<ReturnType<TDefinitionFactory>>) => PluginPublicDefinition<ReturnType<TDefinitionFactory>>;
2004
- internalDefinition: (definition: ReturnType<TDefinitionFactory>) => ReturnType<TDefinitionFactory>;
2005
- }>;
2006
- type Plugin<TDefinition extends PluginDefinition> = Readonly<{ [TKey in keyof TDefinition]: PluginRuntimeField<TDefinition, TKey>; }> & PluginWitnessFor<() => TDefinition> & PrivatePluginReferenceBrand;
2007
- /**
2008
- * Contextually typed author input. `definePlugin` normalizes this
2009
- * callback-rich shape to the compact definition carried by `DefinitionOf`.
2010
- */
2011
- type PluginDefinitionInput<TEditor extends BaseEditor<any, any> = BaseEditor<any>> = {
2012
- enabled?: boolean;
2013
- dependencies?: readonly PluginReference[];
2014
- conflicts?: readonly PluginReference[];
2015
- schema?: EditorSchemaDeclaration | PluginSchemaFactory;
2016
- api?: PluginApiFactory<TEditor>;
2017
- read?: PluginReadFactory<TEditor>;
2018
- update?: PluginUpdateFactory<TEditor>;
2019
- readMiddleware?: PluginReadMiddlewareFactory<TEditor>;
2020
- commands?: (context: PluginCommandContext<TEditor>) => ReadonlyArray<EditorCommandRegistration<TEditor>>;
2021
- corrections?: ReadonlyArray<EditorCorrection<TEditor>>;
2022
- stateFields?: ReadonlyArray<EditorStateField<any>>;
2023
- effectTypes?: readonly EditorEffectType[];
2024
- contributions?: ReadonlyArray<PluginContributionInput<NoInfer<TEditor>>>;
2025
- on?: PluginChangeHandlers<TEditor>;
2026
- activate?: (context: PluginActivationContext & Readonly<{
2027
- editor: TEditor;
2028
- }>) => void;
2029
- validate?: BivariantMethod<[context: PluginCandidateContext<TEditor>], void>;
2030
- };
2031
- type PluginInput = PluginReference | readonly PluginReference[];
2032
- type PluginSlotLike = Readonly<{
2033
- key: string;
2034
- of: (input: PluginInput) => PluginReference;
2035
- }>;
2036
- type PluginTypes = {
2037
- api?: Record<string, unknown>;
2038
- read?: EditorReadMethodTree;
2039
- update?: Record<string, unknown>;
2040
- };
2041
- /** Type lambda for value-sensitive plugin capabilities. */
2042
- interface PluginTypeLambda {
2043
- readonly input: Value;
2044
- readonly output: PluginTypes;
2045
- }
2046
- /** Internal type lambda for input-sensitive plugin constructors. */
2047
- interface PluginFactoryTypeLambda {
2048
- readonly input: object;
2049
- readonly output: PluginReference;
2050
- }
2051
- /** Internal relation carried by an input-sensitive plugin constructor. */
2052
- declare class PluginFactoryTypeProvider<TProvider extends PluginFactoryTypeLambda> {
2053
- protected readonly pluginFactoryTypes: TProvider;
2054
- }
2055
- /** Recover the input/output relation carried by a plugin constructor. */
2056
- type PluginFactoryTypeProviderOf<TFactory> = TFactory extends PluginFactoryTypeProvider<infer TProvider extends PluginFactoryTypeLambda> ? TProvider : never;
2057
- /** Fixed capabilities contributed by an plugin regardless of editor value. */
2058
- interface PluginCapabilities<TOutput extends PluginTypes> {
2059
- readonly input: Value;
2060
- readonly output: TOutput;
2061
- }
2062
- declare class PluginTypeProvider<TProvider extends PluginTypeLambda> {
2063
- protected readonly pluginTypes: TProvider;
2064
- }
2065
- type UnionToIntersection<T> = (T extends unknown ? (value: T) => void : never) extends ((value: infer TIntersection) => void) ? TIntersection : never;
2066
- type PluginName<TPlugin> = TPlugin extends {
2067
- name: infer TName extends PropertyKey;
2068
- } ? TName : never;
2069
- type EditorLiteralPluginName<TPlugin> = PluginName<TPlugin> extends (infer TName) ? TName extends string ? string extends TName ? never : TName : TName extends number ? number extends TName ? never : TName : TName extends symbol ? symbol extends TName ? never : TName : never : never;
2070
- type IsEqual<TLeft, TRight> = (<T>() => T extends TLeft ? 1 : 2) extends (<T>() => (T extends TRight ? 1 : 2)) ? true : false;
2071
- type PluginEnabled<TPlugin> = TPlugin extends {
2072
- enabled: infer TEnabled;
2073
- } ? IsEqual<TEnabled, false> extends true ? never : TPlugin : TPlugin;
2074
- type PluginNames<TPlugins extends readonly unknown[]> = TPlugins[number] extends (infer TPlugin) ? EditorLiteralPluginName<TPlugin> : never;
2075
- type EditorResolvedPluginAndDependencies<TPlugin> = PluginEnabled<TPlugin> extends (infer TEnabled) ? [TEnabled] extends [never] ? readonly [] : readonly [PluginRequirementsOf<TEnabled> | TEnabled] : readonly [];
2076
- type EditorResolvedArrayPluginAndDependencies<TPlugin> = PluginEnabled<TPlugin> extends (infer TEnabled) ? TEnabled extends unknown ? PluginRequirementsOf<TEnabled> | TEnabled : never : never;
2077
- type EditorResolvedVariadicPlugins<TPlugins extends readonly unknown[]> = TPlugins extends readonly [infer TFirst, ...infer TRest extends readonly unknown[]] ? readonly [...EditorResolvedInstalledPlugins<readonly [TFirst]>, ...EditorResolvedVariadicPlugins<TRest>] : TPlugins extends readonly [...infer TRest extends readonly unknown[], infer TLast] ? readonly [...EditorResolvedVariadicPlugins<TRest>, ...EditorResolvedInstalledPlugins<readonly [TLast]>] : unknown extends TPlugins[number] ? readonly [] : ReadonlyArray<EditorResolvedArrayPluginAndDependencies<TPlugins[number]>>;
2078
- type EditorResolvedInstalledPlugins<TPlugins extends readonly unknown[]> = number extends TPlugins['length'] ? EditorResolvedVariadicPlugins<TPlugins> : TPlugins extends readonly [] ? readonly [] : TPlugins extends readonly [infer TFirst, ...infer TRest extends readonly unknown[]] ? [PluginName<TFirst>] extends [never] ? EditorResolvedInstalledPlugins<TRest> : [EditorLiteralPluginName<TFirst>] extends [never] ? PluginEnabled<TFirst> extends never ? EditorResolvedInstalledPlugins<TRest> : [...EditorResolvedPluginAndDependencies<TFirst>, ...EditorResolvedInstalledPlugins<TRest>] : EditorLiteralPluginName<TFirst> extends PluginNames<TRest> ? EditorResolvedInstalledPlugins<TRest> : PluginEnabled<TFirst> extends never ? EditorResolvedInstalledPlugins<TRest> : [...EditorResolvedPluginAndDependencies<TFirst>, ...EditorResolvedInstalledPlugins<TRest>] : readonly [];
2079
- type EditorDefinitionSlot<TPlugin, TSlot extends 'api' | 'read' | 'update'> = PluginCapabilityOf<TPlugin> extends (infer TDefinition) ? TDefinition extends object ? TSlot extends keyof TDefinition ? TDefinition[TSlot] : unknown : unknown : unknown;
2080
- type EditorProvidedTypesFromPlugin<V extends Value, TPlugin> = IsAny<TPlugin> extends true ? never : TPlugin extends PluginTypeProvider<infer TProvider extends PluginTypeLambda> ? (TProvider & Readonly<{
2081
- input: V;
2082
- }>)['output'] : never;
2083
- type EditorProvidedSlot<V extends Value, TPlugin, TSlot extends keyof PluginTypes> = EditorProvidedTypesFromPlugin<V, TPlugin> extends (infer TTypes) ? TTypes extends object ? TSlot extends keyof TTypes ? NonNullable<TTypes[TSlot]> : never : never : never;
2084
- type EditorReadGroupsFromPlugin<V extends Value, TPlugin> = TPlugin extends unknown ? EditorProvidedSlot<V, TPlugin, 'read'> extends (infer TProvidedState) ? [TProvidedState] extends [never] ? EditorDefinitionSlot<TPlugin, 'read'> extends (infer TRead) ? [unknown] extends [TRead] ? never : EditorLiteralPluginName<TPlugin> extends (infer TName extends PropertyKey) ? { [K in TName]: TRead; } : never : never : TProvidedState : never : never;
2085
- type EditorUpdateGroupsFromPlugin<V extends Value, TPlugin> = TPlugin extends unknown ? EditorProvidedSlot<V, TPlugin, 'update'> extends (infer TProvidedTx) ? [TProvidedTx] extends [never] ? EditorDefinitionSlot<TPlugin, 'update'> extends (infer TUpdate) ? [unknown] extends [TUpdate] ? never : EditorLiteralPluginName<TPlugin> extends (infer TName extends PropertyKey) ? { [K in TName]: TUpdate; } : never : never : TProvidedTx : never : never;
2086
- type EditorApiGroupsFromPlugin<TPlugin> = TPlugin extends unknown ? EditorProvidedSlot<Value, TPlugin, 'api'> extends (infer TProvidedApi) ? [TProvidedApi] extends [never] ? EditorDefinitionSlot<TPlugin, 'api'> extends (infer TApi) ? [unknown] extends [TApi] ? never : EditorLiteralPluginName<TPlugin> extends (infer TName extends PropertyKey) ? { [K in TName]: TApi; } : never : never : TProvidedApi : never : never;
2087
- type EditorInstalledReadGroups<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = IsAny<TPlugins> extends true ? Record<string, any> : UnionToIntersection<EditorReadGroupsFromPlugin<V, EditorResolvedInstalledPlugins<TPlugins>[number]>>;
2088
- type EditorInstalledUpdateGroups<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = IsAny<TPlugins> extends true ? Record<string, any> : UnionToIntersection<EditorUpdateGroupsFromPlugin<V, EditorResolvedInstalledPlugins<TPlugins>[number]>>;
2089
- type EditorInstalledTransactionGroups<V extends Value, TPlugins extends readonly unknown[], TRead = EditorInstalledReadGroups<V, TPlugins>, TUpdate = EditorInstalledUpdateGroups<V, TPlugins>> = Omit<TRead, keyof TUpdate> & { [K in keyof TUpdate]: K extends keyof TRead ? TRead[K] extends Record<string, unknown> ? TUpdate[K] extends Record<string, unknown> ? Omit<TRead[K], keyof TUpdate[K]> & TUpdate[K] : TUpdate[K] : TUpdate[K] : TUpdate[K]; };
2090
- type EditorTransactionGroupFromPlugin<V extends Value, TPlugin> = TPlugin extends {
2091
- name: infer TName extends PropertyKey;
2092
- } ? TName extends keyof EditorInstalledTransactionGroups<V, readonly [TPlugin]> ? EditorInstalledTransactionGroups<V, readonly [TPlugin]>[TName] : never : never;
2093
- type DynamicEditorTransactionPluginGroup = {
2094
- readonly [name: string]: DynamicEditorTransactionPluginGroup;
2095
- } & ((...args: unknown[]) => unknown);
2096
- type EditorTransactionPluginPortal<V extends Value, TGroups> = {
2097
- <const TPlugin extends PluginReference>(plugin: TPlugin): EditorTransactionGroupFromPlugin<V, TPlugin>;
2098
- <const TName extends Extract<keyof TGroups, string>>(name: TName): TGroups[TName];
2099
- (name: string): DynamicEditorTransactionPluginGroup;
2100
- };
2101
- type EditorInstalledApiGroups<TPlugins extends readonly unknown[] = readonly []> = IsAny<TPlugins> extends true ? Record<string, any> : UnionToIntersection<EditorApiGroupsFromPlugin<EditorResolvedInstalledPlugins<TPlugins>[number]>>;
2102
- type EditorApiValueFromPlugin<TPlugin> = EditorApiGroupsFromPlugin<TPlugin> extends (infer TApi) ? TPlugin extends {
2103
- name: infer TName;
2104
- } ? TName extends keyof TApi ? TApi[TName] : never : never : never;
2105
- type EditorReadValueFromPlugin<V extends Value, TPlugin> = EditorReadGroupsFromPlugin<V, TPlugin> extends (infer TRead) ? TPlugin extends {
2106
- name: infer TName;
2107
- } ? TName extends keyof TRead ? TRead[TName] : never : never : never;
2108
- type EditorUpdateValueFromPlugin<V extends Value, TPlugin> = EditorUpdateGroupsFromPlugin<V, TPlugin> extends (infer TUpdate) ? TPlugin extends {
2109
- name: infer TName;
2110
- } ? TName extends keyof TUpdate ? TUpdate[TName] : never : never : never;
2111
- type RegisteredPlugin = {
2112
- conflicts: readonly PluginReference[];
2113
- dependencies: readonly PluginReference[];
2114
- descriptor: PluginReference;
2115
- name: string;
2116
- order: number;
2117
- requiredBy: ReadonlySet<PluginReference>;
2118
- };
2119
- type PluginRegistry = {
2120
- commands: Readonly<{
2121
- byDescriptor: ReadonlyMap<object, Readonly<{
2122
- descriptor: object;
2123
- entries: readonly unknown[];
2124
- hasAround: boolean;
2125
- id: string;
2126
- }>>;
2127
- byId: ReadonlyMap<string, object>;
2128
- revision: number;
2129
- }>;
2130
- commitListeners: Set<EditorCommitListener>;
2131
- contributions: Map<object, readonly unknown[]>;
2132
- dependencyOrder: readonly PluginReference[];
2133
- plugins: Map<string, RegisteredPlugin>;
2134
- pluginsByDescriptor: ReadonlyMap<PluginReference, RegisteredPlugin>;
2135
- nodeChangeListeners: Set<EditorNodeChangeHandler>;
2136
- reads: Readonly<{
2137
- byDescriptor: ReadonlyMap<object, Readonly<{
2138
- descriptor: object;
2139
- entries: readonly unknown[];
2140
- id: string;
2141
- }>>;
2142
- byId: ReadonlyMap<string, object>;
2143
- revision: number;
2144
- }>;
2145
- corrections: Map<string, EditorCorrection>;
2146
- stateGroups: Map<string, unknown>;
2147
- textChangeListeners: Set<EditorTextChangeHandler>;
2148
- txGroups: Map<string, unknown>;
2149
- };
2150
- type EditorCommitListener<V extends Value = Value> = BivariantMethod<[commit: EditorCommit<V>, snapshot: EditorSnapshot<V>], void>;
2151
- type TopLevelRuntimeRange = readonly [number, number];
2152
- type EditorCommitChangeKind = 'document' | 'marks' | 'properties' | 'replace' | 'root-order' | 'selection' | 'snapshot' | 'state' | 'structure' | 'text';
2153
- type EditorCommitRuntimeChangeKind = 'decoration' | 'node' | 'path' |
2154
- /** Runtime node identities added to or removed from a document root. */
2155
- 'presence' | 'selection' | 'text';
2156
- /** Lazy commit queries derived from canonical changes and snapshot indexes. */
2157
- type EditorCommitChanged = {
2158
- has: <TRoot extends RootKey>(kind: EditorCommitChangeKind, root?: NamedRootKey<TRoot>) => boolean;
2159
- /**
2160
- * Whether any document root has this change kind. A record write counts as
2161
- * a `document` and `snapshot` change too, since records hold no root.
2162
- */
2163
- hasAny: (kind: EditorCommitChangeKind) => boolean;
2164
- /**
2165
- * Whether this key has this change kind in `root`, where `undefined` means
2166
- * the primary document. A key that left the root, or whose root the commit
2167
- * deleted, reports `'presence'` there, not `'path'`. For `'path'` and
2168
- * `'presence'`, a root whose children the commit did not change answers
2169
- * `false` without reading any index.
2170
- */
2171
- hasNodeKey: <TRoot extends RootKey>(nodeKey: NodeKey, kind: EditorCommitRuntimeChangeKind, root: NamedRootKey<TRoot> | undefined) => boolean;
2172
- /** Final-coordinate paths touching changed ranges in one document root. */
2173
- paths: <TRoot extends RootKey>(root?: NamedRootKey<TRoot>) => readonly Path[];
2174
- nodeKeys: <TRoot extends RootKey>(kind: EditorCommitRuntimeChangeKind, root?: NamedRootKey<TRoot>) => readonly NodeKey[];
2175
- /** Node keys with this change kind across every document root. */
2176
- nodeKeysAll: (kind: EditorCommitRuntimeChangeKind) => readonly NodeKey[];
2177
- topLevelRanges: <TRoot extends RootKey>(root?: NamedRootKey<TRoot>) => readonly TopLevelRuntimeRange[];
2178
- };
2179
- type EditorTransactionDocumentChangeKind = 'properties' | 'structure' | 'text';
2180
- type EditorTransactionTopLevelRange = Readonly<{
2181
- /** Inclusive top-level window in the final transaction-step document. */
2182
- after: TopLevelRuntimeRange | null;
2183
- /** Inclusive top-level window in the transaction-step source document. */
2184
- before: TopLevelRuntimeRange | null;
2185
- }>;
2186
- /**
2187
- * One node a step took out of a root: its key is in the root's index before
2188
- * the step and not after it. A node the step moves, splits or wraps keeps its
2189
- * key, and so do the children of a node it unwraps or merges into another. A
2190
- * step with no structure change can remove a node too, as `replace` does when
2191
- * it gives the new node a new key.
2192
- */
2193
- type EditorTransactionRemoved = Readonly<{
2194
- key: NodeKey;
2195
- /** The node as it stood before the step. Each descendant that left has its
2196
- * own entry. */
2197
- node: Descendant;
2198
- /** Where the node's start lands in the step's result, as a child index of
2199
- * its nearest ancestor the step kept: right after the nearest earlier
2200
- * sibling the step kept, of the node or of an ancestor the step removed,
2201
- * when that sibling is still a child of that ancestor; else the count of
2202
- * that ancestor's children that start before where the node's start
2203
- * lands. The last index may equal the ancestor's child count. */
2204
- path: Path;
2205
- }>;
2206
- /** Lazy semantic queries over one transaction-local document change. */
2207
- type EditorTransactionChanged = {
2208
- has: <TRoot extends RootKey>(kind: EditorTransactionDocumentChangeKind, root?: NamedRootKey<TRoot>) => boolean;
2209
- /** Final-coordinate paths touching changed ranges in one document root. */
2210
- paths: <TRoot extends RootKey>(root?: NamedRootKey<TRoot>) => readonly Path[];
2211
- /** The nodes the step took out of one document root. */
2212
- removed: <TRoot extends RootKey>(root?: NamedRootKey<TRoot>) => readonly EditorTransactionRemoved[];
2213
- /** Bounded before/after top-level windows for each changed range. */
2214
- topLevelRanges: <TRoot extends RootKey>(root?: NamedRootKey<TRoot>) => readonly EditorTransactionTopLevelRange[];
2215
- };
2216
- type EditorCommit<V extends Value = Value> = Readonly<{
2217
- annotations: Readonly<Record<string, unknown>>;
2218
- after: EditorSnapshot<V>;
2219
- before: EditorSnapshot<V>;
2220
- changed: EditorCommitChanged;
2221
- changes: DocumentChange;
2222
- inverseChanges: DocumentChange;
2223
- dirtyStateKeys: readonly string[];
2224
- effects: readonly EditorEffect[];
2225
- previousVersion: number;
2226
- selectionAfter: Selection;
2227
- /** Named selection root, or `undefined` for the primary document. */
2228
- selectionAfterRoot: NamedRootKey | undefined;
2229
- selectionBefore: Selection;
2230
- /** Named selection root, or `undefined` for the primary document. */
2231
- selectionBeforeRoot: NamedRootKey | undefined;
2232
- selectionChanged: boolean;
2233
- tags: readonly EditorUpdateTag[];
2234
- version: number;
2235
- }>;
2236
- interface EditorAboveOptions<T extends Ancestor, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> {
2237
- at?: Location;
2238
- match?: NodeMatch<T>;
2239
- type?: TType;
2240
- mode?: MaximizeMode;
2241
- voids?: boolean;
2242
- }
2243
- interface EditorBlockOptions<T extends Element = Element, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> {
2244
- at?: Location;
2245
- match?: NodeMatch<T>;
2246
- type?: TType;
2247
- mode?: MaximizeMode;
2248
- voids?: boolean;
2249
- }
2250
- interface EditorAfterOptions {
2251
- distance?: number;
2252
- unit?: TextUnitAdjustment;
2253
- voids?: boolean;
2254
- }
2255
- interface EditorBeforeOptions {
2256
- /**
2257
- * Return the point after the matched text or predicate instead of the point
2258
- * before it.
2259
- */
2260
- afterMatch?: boolean;
2261
- distance?: number;
2262
- /** Return the current block start when a match is not found before crossing blocks. */
2263
- matchBlockStart?: boolean;
2264
- /** Interpret `matchString` entries as regular expressions. */
2265
- matchByRegex?: boolean;
2266
- /** Lookup backward until one of these strings is matched. */
2267
- matchString?: readonly string[] | string;
2268
- /** Lookup backward until this predicate returns true. */
2269
- match?: (value: {
2270
- at: Location;
2271
- beforePoint: Point;
2272
- beforeString: string;
2273
- }) => boolean;
2274
- /** Continue looking past non-matching text until block start. */
2275
- skipInvalid?: boolean;
2276
- unit?: TextUnitAdjustment;
2277
- voids?: boolean;
2278
- }
2279
- interface EditorDirectedDeletionOptions {
2280
- unit?: TextUnit;
2281
- }
2282
- interface EditorElementReadOnlyOptions {
2283
- at?: Location;
2284
- mode?: MaximizeMode;
2285
- voids?: boolean;
2286
- }
2287
- interface EditorFragmentDeletionOptions {
2288
- at?: Location;
2289
- direction?: TextDirection;
2290
- }
2291
- interface EditorIsEditorOptions {
2292
- deep?: boolean;
2293
- }
2294
- interface EditorLeafOptions {
2295
- depth?: number;
2296
- edge?: LeafEdge;
2297
- }
2298
- interface EditorLevelsOptions<T extends Node, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> {
2299
- at?: Location;
2300
- match?: NodeMatch<T>;
2301
- type?: TType;
2302
- reverse?: boolean;
2303
- voids?: boolean;
2304
- }
2305
- interface EditorLastOptions {
2306
- level?: number;
2307
- }
2308
- interface EditorNextOptions<T extends Descendant, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> {
2309
- at?: Location;
2310
- from?: 'after' | 'child';
2311
- match?: NodeMatch<T>;
2312
- type?: TType;
2313
- mode?: SelectionMode;
2314
- voids?: boolean;
2315
- }
2316
- interface EditorNodesOptions<T extends Node, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> {
2317
- at?: Location | NodeSelection | Span;
2318
- match?: NodeMatch<T>;
2319
- type?: TType;
2320
- mode?: SelectionMode;
2321
- universal?: boolean;
2322
- reverse?: boolean;
2323
- voids?: boolean;
2324
- pass?: (entry: NodeEntry) => boolean;
2325
- }
2326
- interface EditorParentOptions<T extends Ancestor = Ancestor, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> {
2327
- depth?: number;
2328
- edge?: LeafEdge;
2329
- match?: NodeMatch<T>;
2330
- type?: TType;
2331
- }
2332
- interface EditorPathOptions {
2333
- depth?: number;
2334
- edge?: LeafEdge;
2335
- }
2336
- interface EditorPointOptions {
2337
- edge?: LeafEdge;
2338
- }
2339
- interface EditorPositionsOptions {
2340
- at?: Location;
2341
- unit?: TextUnitAdjustment;
2342
- reverse?: boolean;
2343
- voids?: boolean;
2344
- }
2345
- interface EditorPreviousOptions<T extends Node, TType extends NodeTypeSelector | undefined = NodeTypeSelector | undefined> {
2346
- at?: Location;
2347
- from?: 'before' | 'parent';
2348
- match?: NodeMatch<T>;
2349
- type?: TType;
2350
- mode?: SelectionMode;
2351
- sibling?: boolean;
2352
- voids?: boolean;
2353
- }
2354
- interface EditorStringOptions {
2355
- /**
2356
- * Read only content text: text a capability keeps in the document without
2357
- * counting it as content, such as struck suggestions, is skipped.
2358
- */
2359
- content?: boolean;
2360
- voids?: boolean;
2361
- }
2362
- interface EditorUnhangRangeOptions {
2363
- character?: boolean;
2364
- unhang?: boolean;
2365
- voids?: boolean;
2366
- }
2367
- interface EditorVoidOptions {
2368
- at?: Location;
2369
- mode?: MaximizeMode;
2370
- voids?: boolean;
2371
- }
2372
- type EditorStaticAbove = {
2373
- <V extends Value, TGuard extends Ancestor>(editor: AnyEditor<V>, options: EditorAboveOptions<Ancestor, undefined> & {
2374
- match: (node: Ancestor, path: Path) => node is TGuard;
2375
- }): NodeEntry<TGuard> | undefined;
2376
- <V extends Value, const TType extends NodeTypeSelector>(editor: AnyEditor<V>, options: EditorAboveOptions<NodeForTypeSelector<TType>, TType> & {
2377
- type: TType;
2378
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
2379
- <V extends Value>(editor: AnyEditor<V>, options?: EditorAboveOptions<Ancestor>): NodeEntry<Ancestor> | undefined;
2380
- };
2381
- type EditorStaticLevels = {
2382
- <V extends Value, TGuard extends ValueTreeNode<V>>(editor: AnyEditor<V>, options: EditorLevelsOptions<ValueTreeNode<V>, undefined> & {
2383
- match: (node: ValueTreeNode<V>, path: Path) => node is TGuard;
2384
- }): Generator<NodeEntry<TGuard>, void, undefined>;
2385
- <V extends Value, const TType extends NodeTypeSelector>(editor: AnyEditor<V>, options: EditorLevelsOptions<NodeForTypeSelector<TType>, TType> & {
2386
- type: TType;
2387
- }): Generator<NodeEntry<NodeForTypeSelector<TType>>, void, undefined>;
2388
- <V extends Value>(editor: AnyEditor<V>, options?: EditorLevelsOptions<ValueTreeNode<V>>): Generator<NodeEntry, void, undefined>;
2389
- };
2390
- type EditorStaticNext = {
2391
- <V extends Value, TGuard extends ValueDescendant<V>>(editor: AnyEditor<V>, options: EditorNextOptions<ValueDescendant<V>, undefined> & {
2392
- match: (node: ValueDescendant<V>, path: Path) => node is TGuard;
2393
- }): NodeEntry<TGuard> | undefined;
2394
- <V extends Value, const TType extends NodeTypeSelector>(editor: AnyEditor<V>, options: EditorNextOptions<NodeForTypeSelector<TType>, TType> & {
2395
- type: TType;
2396
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
2397
- <V extends Value>(editor: AnyEditor<V>, options?: EditorNextOptions<ValueDescendant<V>>): NodeEntry<ValueDescendant<V>> | undefined;
2398
- };
2399
- type EditorStaticPrevious = {
2400
- <V extends Value, TGuard extends ValueTreeNode<V>>(editor: AnyEditor<V>, options: EditorPreviousOptions<ValueTreeNode<V>, undefined> & {
2401
- match: (node: ValueTreeNode<V>, path: Path) => node is TGuard;
2402
- }): NodeEntry<TGuard> | undefined;
2403
- <V extends Value, const TType extends NodeTypeSelector>(editor: AnyEditor<V>, options: EditorPreviousOptions<NodeForTypeSelector<TType>, TType> & {
2404
- type: TType;
2405
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
2406
- <V extends Value>(editor: AnyEditor<V>, options?: EditorPreviousOptions<ValueTreeNode<V>>): NodeEntry | undefined;
2407
- };
2408
- type EditorStaticParent = {
2409
- <TGuard extends Ancestor>(editor: AnyEditor, at: Location, options: EditorParentOptions<Ancestor, undefined> & {
2410
- match: (node: Ancestor, path: Path) => node is TGuard;
2411
- }): NodeEntry<TGuard> | undefined;
2412
- <const TType extends NodeTypeSelector>(editor: AnyEditor, at: Location, options: EditorParentOptions<NodeForTypeSelector<TType>, TType> & {
2413
- type: TType;
2414
- }): NodeEntry<NodeForTypeSelector<TType>> | undefined;
2415
- (editor: AnyEditor, at: Location, options?: EditorParentOptions<Ancestor, undefined> & {
2416
- match?: undefined;
2417
- type?: undefined;
2418
- }): NodeEntry<Ancestor>;
2419
- (editor: AnyEditor, at: Location, options: EditorParentOptions): NodeEntry<Ancestor> | undefined;
2420
- };
2421
- interface EditorStaticApi {
2422
- /**
2423
- * Get the ancestor above a location in the document.
2424
- */
2425
- above: EditorStaticAbove;
2426
- /**
2427
- * Add a custom property to the leaf text nodes in the current selection.
2428
- *
2429
- * If the selection is currently collapsed, the marks are stored by the
2430
- * editor runtime and applied when text is inserted next.
2431
- */
2432
- addMark: (editor: AnyEditor, key: string, value: any) => void;
2433
- /**
2434
- * Get the point after a location.
2435
- */
2436
- after: (editor: AnyEditor, at: Location, options?: EditorAfterOptions) => Point | undefined;
2437
- /**
2438
- * Get the point before a location.
2439
- */
2440
- before: (editor: AnyEditor, at: Location, options?: EditorBeforeOptions) => Point | undefined;
2441
- /**
2442
- * Delete content in the editor backward from the current selection.
2443
- */
2444
- deleteBackward: (editor: AnyEditor, options?: EditorDirectedDeletionOptions) => void;
2445
- /**
2446
- * Delete content in the editor forward from the current selection.
2447
- */
2448
- deleteForward: (editor: AnyEditor, options?: EditorDirectedDeletionOptions) => void;
2449
- /**
2450
- * Delete the content in the current selection.
2451
- */
2452
- deleteFragment: (editor: AnyEditor, options?: EditorFragmentDeletionOptions) => void;
2453
- delete: TextMutationMethods['delete'];
2454
- collapse: SelectionMutationMethods['collapse'];
2455
- deselect: SelectionMutationMethods['deselect'];
2456
- /**
2457
- * Get the start and end points of a location.
2458
- */
2459
- edges: (editor: AnyEditor, at: Location) => readonly [Point, Point];
2460
- /**
2461
- * Get the latest committed transaction metadata.
2462
- */
2463
- getLastCommit: <V extends Value>(editor: AnyEditor<V>) => EditorCommit<V> | null;
2464
- /**
2465
- * Return effects that are marked for collaboration.
2466
- */
2467
- getCollabEffects: <V extends Value>(editor: AnyEditor<V>, commit: EditorCommit<V>) => readonly EditorEffect[];
2468
- /**
2469
- * Get the plugin registry for an editor.
2470
- */
2471
- getPluginRegistry: (editor: AnyEditor) => PluginRegistry;
2472
- /**
2473
- * Resolve the current-root live path for a node key without rebuilding a
2474
- * snapshot.
2475
- */
2476
- getPathByNodeKey: (editor: AnyEditor, nodeKey: NodeKey) => Path | null;
2477
- /**
2478
- * Get the node key for a live node path without rebuilding a snapshot.
2479
- */
2480
- getNodeKey: <V extends Value>(editor: AnyEditor<V>, path: Path) => NodeKey | null;
2481
- /**
2482
- * Run a coherent synchronous read against the current editor/runtime state.
2483
- */
2484
- read: <V extends Value, TPlugins extends readonly unknown[], T>(editor: Editor<V, TPlugins>, fn: (state: EditorStateView<V, TPlugins>) => T) => T;
2485
- /**
2486
- * Match a read-only element in the current branch of the editor.
2487
- */
2488
- elementReadOnly: (editor: AnyEditor, options?: EditorElementReadOnlyOptions) => NodeEntry<Element> | undefined;
2489
- /**
2490
- * Get the first node at a location.
2491
- */
2492
- first: (editor: AnyEditor, at: Location) => NodeEntry;
2493
- /**
2494
- * Get the current children through the public accessor boundary.
2495
- */
2496
- getChildren: <V extends Value>(editor: AnyEditor<V>) => V;
2497
- /**
2498
- * Get the current selection through the selection freshness runtime.
2499
- */
2500
- getSelection: (editor: AnyEditor) => Selection;
2501
- /**
2502
- * Get the fragment at a location.
2503
- */
2504
- fragment: <V extends Value>(editor: AnyEditor<V>, at: Location) => ReadonlyArray<DescendantIn<V>>;
2505
- /**
2506
- * Get the fragment at the current selection.
2507
- */
2508
- getFragment: <V extends Value>(editor: AnyEditor<V>) => ReadonlyArray<DescendantIn<V>>;
2509
- /**
2510
- * Get the current immutable snapshot of editor state.
2511
- */
2512
- getSnapshot: <V extends Value>(editor: AnyEditor<V>) => EditorSnapshot<V>;
2513
- /**
2514
- * Check if a node has block children.
2515
- */
2516
- hasBlocks: (editor: AnyEditor, element: Element) => boolean;
2517
- /**
2518
- * Check if a node has inline and text children.
2519
- */
2520
- hasInlines: (editor: AnyEditor, element: Element) => boolean;
2521
- hasPath: (editor: AnyEditor, path: Path) => boolean;
2522
- /**
2523
- * Check if a node has text children.
2524
- */
2525
- hasTexts: (editor: AnyEditor, element: Element) => boolean;
2526
- /**
2527
- * Insert a block break at the current selection.
2528
- *
2529
- * If the selection is currently expanded, it will be deleted first.
2530
- */
2531
- insertBreak: (editor: AnyEditor) => void;
2532
- /**
2533
- * Atomically inserts `nodes`
2534
- * at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
2535
- */
2536
- insertNode: {
2537
- <V extends Value, const TType extends NodeTypeSelector | undefined>(editor: AnyEditor<V>, node: ElementOrTextIn<V>, options: NodeInsertNodesOptions<NodeInsertSplitTarget<V, TType>, TType> & {
2538
- split: NodeInsertNodesOptions<NodeInsertSplitTarget<V, TType>, TType>['split'] & {
2539
- type: TType;
2540
- };
2541
- }): void;
2542
- <V extends Value>(editor: AnyEditor<V>, node: ElementOrTextIn<V>, options?: NodeInsertNodesOptions<NodeIn<V>>): void;
2543
- };
2544
- insertNodes: NodeMutationMethods['insertNodes'];
2545
- /**
2546
- * Insert a soft break at the current selection.
2547
- *
2548
- * If the selection is currently expanded, it will be deleted first.
2549
- */
2550
- insertSoftBreak: (editor: AnyEditor) => void;
2551
- /**
2552
- * Insert a string of text
2553
- * at the specified location or (if not defined) the current selection or (if not defined) the end of the document.
2554
- */
2555
- insertText: (editor: AnyEditor, text: string, options?: TextInsertTextOptions) => void;
2556
- mergeNodes: NodeMutationMethods['mergeNodes'];
2557
- move: SelectionMutationMethods['move'];
2558
- moveNodes: NodeMutationMethods['moveNodes'];
2559
- /**
2560
- * Check if a value is a block `Element` object.
2561
- */
2562
- isBlock: (editor: AnyEditor, value: Node) => boolean;
2563
- /**
2564
- * Check if a point is an edge of a location.
2565
- */
2566
- isEdge: (editor: AnyEditor, point: Point, at: Location) => boolean;
2567
- /**
2568
- * Check if a value is an `AnyEditor` object.
2569
- */
2570
- isEditor: (value: unknown, options?: EditorIsEditorOptions) => value is AnyEditor;
2571
- /**
2572
- * Check if a value is a read-only `Element` object.
2573
- */
2574
- isElementReadOnly: (editor: AnyEditor, element: Element) => boolean;
2575
- /**
2576
- * Check if an element is empty, accounting for void nodes.
2577
- */
2578
- isEmpty: (editor: AnyEditor, element: Element) => boolean;
2579
- /**
2580
- * Check if a point is the end point of a location.
2581
- */
2582
- isEnd: (editor: AnyEditor, point: Point, at: Location) => boolean;
2583
- /**
2584
- * Check if a value is an inline `Element` object.
2585
- */
2586
- isInline: (editor: AnyEditor, value: Node) => boolean;
2587
- /**
2588
- * Check if a value is a selectable `Element` object.
2589
- */
2590
- isSelectable: (editor: AnyEditor, element: Node) => boolean;
2591
- /**
2592
- * Check if a point is the start point of a location.
2593
- */
2594
- isStart: (editor: AnyEditor, point: Point, at: Location) => boolean;
2595
- /**
2596
- * Check if a value is a void `Element` object.
2597
- */
2598
- isVoid: (editor: AnyEditor, value: Node) => boolean;
2599
- /**
2600
- * Get the last node at a location.
2601
- */
2602
- last: (editor: AnyEditor, at: Location, options?: EditorLastOptions) => NodeEntry | undefined;
2603
- /**
2604
- * Get the leaf text node at a location.
2605
- */
2606
- leaf: (editor: AnyEditor, at: Location, options?: EditorLeafOptions) => NodeEntry<Text>;
2607
- /**
2608
- * Iterate through all of the levels at a location.
2609
- */
2610
- levels: EditorStaticLevels;
2611
- liftNodes: NodeMutationMethods['liftNodes'];
2612
- /**
2613
- * Get the matching node in the branch of the document after a location.
2614
- */
2615
- next: EditorStaticNext;
2616
- /**
2617
- * Normalize any dirty objects in the editor.
2618
- */
2619
- /**
2620
- * Get the parent node of a location.
2621
- */
2622
- parent: EditorStaticParent;
2623
- /**
2624
- * Get the path of a location.
2625
- */
2626
- path: (editor: AnyEditor, at: Location, options?: EditorPathOptions) => Path;
2627
- /**
2628
- * Get the start or end point of a location.
2629
- */
2630
- point: (editor: AnyEditor, at: Location, options?: EditorPointOptions) => Point;
2631
- projectRange: (editor: AnyEditor, range: Range) => readonly ProjectedRangeSegment[];
2632
- /**
2633
- * Return all the positions in `at` range where a `Point` can be placed.
2634
- *
2635
- * By default, moves forward by individual offsets at a time, but
2636
- * the `unit` option can be used to to move by character, word, line, or block.
2637
- *
2638
- * The `reverse` option can be used to change iteration direction.
2639
- *
2640
- * Note: By default void nodes are treated as a single point and iteration
2641
- * will not happen inside their content unless you pass in true for the
2642
- * `voids` option, then iteration will occur.
2643
- */
2644
- positions: (editor: AnyEditor, options?: EditorPositionsOptions) => Generator<Point, void, undefined>;
2645
- /**
2646
- * Get the matching node in the branch of the document before a location.
2647
- */
2648
- previous: EditorStaticPrevious;
2649
- /**
2650
- * Get a range of a location.
2651
- */
2652
- range: (editor: AnyEditor, at: Location, to?: Location) => Range;
2653
- install: (editor: AnyEditor, plugin: PluginInput, options?: PluginReconfigureOptions) => (options?: PluginReconfigureOptions) => void;
2654
- replace: <V extends Value>(editor: AnyEditor<V>, input: SnapshotInput<V>) => void;
2655
- reset: <V extends Value>(editor: AnyEditor<V>, input: SnapshotInput<V>) => void;
2656
- /**
2657
- * Remove a custom property from all of the leaf text nodes in the current
2658
- * selection.
2659
- *
2660
- * If the selection is currently collapsed, the removal is stored by the
2661
- * editor runtime and applied to the text inserted next.
2662
- */
2663
- removeMark: (editor: AnyEditor, key: string) => void;
2664
- removeNodes: NodeMutationMethods['removeNodes'];
2665
- replaceChildren: NodeMutationMethods['replaceChildren'];
2666
- select: SelectionMutationMethods['select'];
2667
- setPoint: SelectionMutationMethods['setPoint'];
2668
- setNodes: NodeMutationMethods['setNodes'];
2669
- setSelection: SelectionMutationMethods['setSelection'];
2670
- splitNodes: NodeMutationMethods['splitNodes'];
2671
- /**
2672
- * Toggle a custom property on the leaf text nodes in the current selection.
2673
- *
2674
- * If the selection is collapsed, the mark is stored for the next inserted
2675
- * text.
2676
- */
2677
- toggleMark: (editor: AnyEditor, key: string, value?: any, options?: EditorToggleMarkOptions) => void;
2678
- /** Toggle selected blocks between target properties and the schema default. */
2679
- toggleBlock: <V extends Value, TPlugins extends readonly unknown[]>(editor: Editor<V, TPlugins>, props: NodePropertyPatch<NodeProps<ElementIn<V>>> & {
2680
- type: string;
2681
- }, options?: EditorToggleBlockOptions) => void;
2682
- unsetNodes: NodeMutationMethods['unsetNodes'];
2683
- unwrapNodes: NodeMutationMethods['unwrapNodes'];
2684
- wrapNodes: NodeMutationMethods['wrapNodes'];
2685
- /**
2686
- * Get the text string content of a location.
2687
- *
2688
- * Note: by default the text of void nodes is considered to be an empty
2689
- * string, regardless of content, unless you pass in true for the voids option
2690
- */
2691
- string: (editor: AnyEditor, at: Location, options?: EditorStringOptions) => string;
2692
- subscribeSource: <V extends Value>(editor: AnyEditor<V>, source: EditorCommitSource, listener: SnapshotListener<V>) => () => void;
2693
- update: <V extends Value, TPlugins extends readonly unknown[]>(editor: Editor<V, TPlugins>, fn: (transaction: EditorUpdateTransaction<V, TPlugins>, context: EditorUpdateContext<Editor<V, TPlugins>>) => void) => void;
2694
- /**
2695
- * Convert a range into a non-hanging one.
2696
- */
2697
- unhangRange: (editor: AnyEditor, range: Range, options?: EditorUnhangRangeOptions) => Range;
2698
- /**
2699
- * Match a void node in the current branch of the editor.
2700
- */
2701
- void: (editor: AnyEditor, options?: EditorVoidOptions) => NodeEntry<Element> | undefined;
2702
- /**
2703
- * Whether a merge removes the previous node, such as an empty block, instead
2704
- * of joining the current node into it. Returns `false` without running
2705
- * `editorReads.nodes.shouldMergeNodesRemovePrevNode` when the previous node
2706
- * is an empty block in a required prefix slot, the update has not moved it
2707
- * into that slot or replaced it, and the current node, its next sibling, fits
2708
- * that slot as it stands without leaving a required block to build. That
2709
- * exception also needs the current node to hold only text and inlines and
2710
- * own no content root, neither node to be a void, an atom or read-only, and
2711
- * an empty current node to carry the previous node's text properties. An
2712
- * authored-document capability turns it off.
2713
- */
2714
- shouldMergeNodesRemovePrevNode: (editor: AnyEditor, prevNodeEntry: NodeEntry, curNodeEntry: NodeEntry) => boolean;
2715
- }
2716
- declare const above: EditorStaticAbove, addMark: (editor: AnyEditor, key: string, value: any) => void, after: (editor: AnyEditor, at: Location, options?: EditorAfterOptions) => Point | undefined, before: (editor: AnyEditor, at: Location, options?: EditorBeforeOptions) => Point | undefined, deleteBackward: (editor: AnyEditor, options?: EditorDirectedDeletionOptions) => void, deleteForward: (editor: AnyEditor, options?: EditorDirectedDeletionOptions) => void, deleteFragment: (editor: AnyEditor, options?: EditorFragmentDeletionOptions) => void, collapse: <V extends Value, TPlugins extends readonly unknown[]>(editor: Editor<V, TPlugins>, options?: SelectionCollapseOptions) => void, deselect: <V extends Value, TPlugins extends readonly unknown[]>(editor: Editor<V, TPlugins>) => void, edges: (editor: AnyEditor, at: Location) => readonly [Point, Point], elementReadOnly: (editor: AnyEditor, options?: EditorElementReadOnlyOptions) => NodeEntry<Element> | undefined, first: (editor: AnyEditor, at: Location) => NodeEntry, fragment: <V extends Value>(editor: AnyEditor<V>, at: Location) => ReadonlyArray<DescendantIn<V>>, getFragment: <V extends Value>(editor: AnyEditor<V>) => ReadonlyArray<DescendantIn<V>>, getChildren: <V extends Value>(editor: AnyEditor<V>) => V, getLastCommit: <V extends Value>(editor: AnyEditor<V>) => EditorCommit<V> | null, getCollabEffects: <V extends Value>(editor: AnyEditor<V>, commit: EditorCommit<V>) => readonly EditorEffect[], getPluginRegistry: (editor: AnyEditor) => PluginRegistry, getSnapshot: <V extends Value>(editor: AnyEditor<V>) => EditorSnapshot<V>, getPathByNodeKey: (editor: AnyEditor, nodeKey: NodeKey) => Path | null, getNodeKey: <V extends Value>(editor: AnyEditor<V>, path: Path) => NodeKey | null, read: <V extends Value, TPlugins extends readonly unknown[], T>(editor: Editor<V, TPlugins>, fn: (state: EditorStateView<V, TPlugins>) => T) => T, getSelection: (editor: AnyEditor) => Selection, hasBlocks: (editor: AnyEditor, element: Element) => boolean, hasInlines: (editor: AnyEditor, element: Element) => boolean, hasPath: (editor: AnyEditor, path: Path) => boolean, hasTexts: (editor: AnyEditor, element: Element) => boolean, insertBreak: (editor: AnyEditor) => void, insertNode: {
2717
- <V extends Value, const TType extends NodeTypeSelector | undefined>(editor: AnyEditor<V>, node: ElementOrTextIn<V>, options: NodeInsertNodesOptions<NodeInsertSplitTarget<V, TType>, TType> & {
2718
- split: NodeInsertNodesOptions<NodeInsertSplitTarget<V, TType>, TType>['split'] & {
2719
- type: TType;
2720
- };
2721
- }): void;
2722
- <V extends Value>(editor: AnyEditor<V>, node: ElementOrTextIn<V>, options?: NodeInsertNodesOptions<NodeIn<V>>): void;
2723
- }, insertNodes: {
2724
- <TValue extends Value, TPlugins extends readonly unknown[], T extends ElementOrTextIn<TValue>, const TType extends NodeTypeSelector | undefined>(editor: Editor<TValue, TPlugins>, nodes: T | readonly T[], options: NodeInsertNodesOptions<undefined extends TType ? NodeIn<TValue> : NodeForTypeSelector<Extract<TType, NodeTypeSelector>>, TType> & {
2725
- split: NodeInsertSplitOptions<undefined extends TType ? NodeIn<TValue> : NodeForTypeSelector<Extract<TType, NodeTypeSelector>>, TType> & {
2726
- type: TType;
2727
- };
2728
- }): void;
2729
- <TValue extends Value, TPlugins extends readonly unknown[], T extends ElementOrTextIn<TValue>>(editor: Editor<TValue, TPlugins>, nodes: T | readonly T[], options?: NodeInsertNodesOptions<NodeIn<TValue>, undefined> | undefined): void;
2730
- }, insertSoftBreak: (editor: AnyEditor) => void, insertText: (editor: AnyEditor, text: string, options?: TextInsertTextOptions) => void, isBlock: (editor: AnyEditor, value: Node) => boolean, isEdge: (editor: AnyEditor, point: Point, at: Location) => boolean, isEditor: (value: unknown, options?: EditorIsEditorOptions) => value is AnyEditor, isElementReadOnly: (editor: AnyEditor, element: Element) => boolean, isEmpty: (editor: AnyEditor, element: Element) => boolean, isEnd: (editor: AnyEditor, point: Point, at: Location) => boolean, isInline: (editor: AnyEditor, value: Node) => boolean, isSelectable: (editor: AnyEditor, element: Node) => boolean, isStart: (editor: AnyEditor, point: Point, at: Location) => boolean, isVoid: (editor: AnyEditor, value: Node) => boolean, last: (editor: AnyEditor, at: Location, options?: EditorLastOptions) => NodeEntry | undefined, leaf: (editor: AnyEditor, at: Location, options?: EditorLeafOptions) => NodeEntry<Text>, liftNodes: {
2731
- <TValue extends Value, TPlugins extends readonly unknown[], const TType extends NodeTypeSelector>(editor: Editor<TValue, TPlugins>, options: NodeLiftNodesOptions<NodeForTypeSelector<TType>, TType> & {
2732
- type: TType;
2733
- }): void;
2734
- <TValue extends Value, TPlugins extends readonly unknown[], const TOptions extends NodeLiftNodesOptions<NodeIn<TValue>> = NodeLiftNodesOptions<NodeIn<TValue>, NodeTypeSelector | undefined>>(editor: Editor<TValue, TPlugins>, options?: (undefined extends TOptions["type"] ? TOptions : never) | undefined): void;
2735
- }, levels: EditorStaticLevels, next: EditorStaticNext, mergeNodes: {
2736
- <TValue extends Value, TPlugins extends readonly unknown[], const TType extends NodeTypeSelector>(editor: Editor<TValue, TPlugins>, options: NodeMergeNodesOptions<NodeForTypeSelector<TType>, TType> & {
2737
- type: TType;
2738
- }): void;
2739
- <TValue extends Value, TPlugins extends readonly unknown[], const TOptions extends NodeMergeNodesOptions<NodeIn<TValue>> = NodeMergeNodesOptions<NodeIn<TValue>, NodeTypeSelector | undefined>>(editor: Editor<TValue, TPlugins>, options?: (undefined extends TOptions["type"] ? TOptions : never) | undefined): void;
2740
- }, move: <V extends Value, TPlugins extends readonly unknown[]>(editor: Editor<V, TPlugins>, options?: SelectionMoveOptions) => void, moveNodes: {
2741
- <TValue extends Value, TPlugins extends readonly unknown[], const TType extends NodeTypeSelector>(editor: Editor<TValue, TPlugins>, options: NodeMoveNodesOptions<NodeForTypeSelector<TType>, TType> & {
2742
- type: TType;
2743
- }): void;
2744
- <TValue extends Value, TPlugins extends readonly unknown[], const TOptions extends NodeMoveNodesOptions<NodeIn<TValue>> = NodeMoveNodesOptions<NodeIn<TValue>, NodeTypeSelector | undefined>>(editor: Editor<TValue, TPlugins>, options: undefined extends TOptions["type"] ? TOptions : never): void;
2745
- }, parent: EditorStaticParent, path: (editor: AnyEditor, at: Location, options?: EditorPathOptions) => Path, point: (editor: AnyEditor, at: Location, options?: EditorPointOptions) => Point, projectRange: (editor: AnyEditor, range: Range) => readonly ProjectedRangeSegment[], positions: (editor: AnyEditor, options?: EditorPositionsOptions) => Generator<Point, void, undefined>, previous: EditorStaticPrevious, range: (editor: AnyEditor, at: Location, to?: Location) => Range, defineCommand: typeof defineCommand$1, install: (editor: AnyEditor, plugin: PluginInput, options?: PluginReconfigureOptions) => (options?: PluginReconfigureOptions) => void, replace: <V extends Value>(editor: AnyEditor<V>, input: SnapshotInput<V>) => void, reset: <V extends Value>(editor: AnyEditor<V>, input: SnapshotInput<V>) => void, removeMark: (editor: AnyEditor, key: string) => void, removeNodes: {
2746
- <TValue extends Value, TPlugins extends readonly unknown[], const TType extends NodeTypeSelector>(editor: Editor<TValue, TPlugins>, options: NodeRemoveNodesOptions<NodeForTypeSelector<TType>, TType> & {
2747
- type: TType;
2748
- }): void;
2749
- <TValue extends Value, TPlugins extends readonly unknown[], const TOptions extends NodeRemoveNodesOptions<NodeIn<TValue>> = NodeRemoveNodesOptions<NodeIn<TValue>, NodeTypeSelector | undefined>>(editor: Editor<TValue, TPlugins>, options?: (undefined extends TOptions["type"] ? TOptions : never) | undefined): void;
2750
- }, replaceChildren: <TValue extends Value, TPlugins extends readonly unknown[]>(editor: Editor<TValue, TPlugins>, children: readonly ElementOrTextIn<TValue>[], options: NodeReplaceChildrenOptions) => void, select: <V extends Value, TPlugins extends readonly unknown[]>(editor: Editor<V, TPlugins>, target: EditorSelection | Location) => void, setPoint: <V extends Value, TPlugins extends readonly unknown[]>(editor: Editor<V, TPlugins>, props: Partial<Point>, options?: SelectionSetPointOptions) => void, setNodes: {
2751
- <TValue extends Value, TPlugins extends readonly unknown[], const TType extends NodeTypeSelector>(editor: Editor<TValue, TPlugins>, props: Partial<NodeProps<NodeForTypeSelector<TType>>>, options: NodeSetNodesOptions<NodeForTypeSelector<TType>, TType> & {
2752
- type: TType;
2753
- }): void;
2754
- <TValue extends Value, TPlugins extends readonly unknown[], const TOptions extends NodeSetNodesOptions<NodeIn<TValue>> = NodeSetNodesOptions<NodeIn<TValue>, NodeTypeSelector | undefined>>(editor: Editor<TValue, TPlugins>, props: Partial<NodeProps<NodeIn<TValue>>>, options?: (undefined extends TOptions["type"] ? TOptions : never) | undefined): void;
2755
- }, setSelection: <V extends Value, TPlugins extends readonly unknown[]>(editor: Editor<V, TPlugins>, props: Partial<Range>) => void, splitNodes: {
2756
- <TValue extends Value, TPlugins extends readonly unknown[], const TType extends NodeTypeSelector>(editor: Editor<TValue, TPlugins>, options: NodeSplitNodesOptions<NodeForTypeSelector<TType>, TType> & {
2757
- type: TType;
2758
- }): void;
2759
- <TValue extends Value, TPlugins extends readonly unknown[], const TOptions extends NodeSplitNodesOptions<NodeIn<TValue>> = NodeSplitNodesOptions<NodeIn<TValue>, NodeTypeSelector | undefined>>(editor: Editor<TValue, TPlugins>, options?: (undefined extends TOptions["type"] ? TOptions : never) | undefined): void;
2760
- }, toggleBlock: <V extends Value, TPlugins extends readonly unknown[]>(editor: Editor<V, TPlugins>, props: NodePropertyPatch<NodeProps<ElementIn<V>>> & {
2761
- type: string;
2762
- }, options?: EditorToggleBlockOptions) => void, toggleMark: (editor: AnyEditor, key: string, value?: any, options?: EditorToggleMarkOptions) => void, unwrapNodes: {
2763
- <TValue extends Value, TPlugins extends readonly unknown[], const TType extends NodeTypeSelector>(editor: Editor<TValue, TPlugins>, options: NodeUnwrapNodesOptions<NodeForTypeSelector<TType>, TType> & {
2764
- type: TType;
2765
- }): void;
2766
- <TValue extends Value, TPlugins extends readonly unknown[], const TOptions extends NodeUnwrapNodesOptions<NodeIn<TValue>> = NodeUnwrapNodesOptions<NodeIn<TValue>, NodeTypeSelector | undefined>>(editor: Editor<TValue, TPlugins>, options?: (undefined extends TOptions["type"] ? TOptions : never) | undefined): void;
2767
- }, unsetNodes: {
2768
- <TValue extends Value, TPlugins extends readonly unknown[], const TType extends NodeTypeSelector>(editor: Editor<TValue, TPlugins>, props: string | readonly string[], options: NodeUnsetNodesOptions<NodeForTypeSelector<TType>, TType> & {
2769
- type: TType;
2770
- }): void;
2771
- <TValue extends Value, TPlugins extends readonly unknown[], const TOptions extends NodeUnsetNodesOptions<NodeIn<TValue>> = NodeUnsetNodesOptions<NodeIn<TValue>, NodeTypeSelector | undefined>>(editor: Editor<TValue, TPlugins>, props: string | readonly string[], options?: (undefined extends TOptions["type"] ? TOptions : never) | undefined): void;
2772
- }, wrapNodes: {
2773
- <TValue extends Value, TPlugins extends readonly unknown[], const TType extends NodeTypeSelector>(editor: Editor<TValue, TPlugins>, element: ElementOf<TValue[number]>, options: NodeWrapNodesOptions<NodeForTypeSelector<TType>, TType> & {
2774
- type: TType;
2775
- }): void;
2776
- <TValue extends Value, TPlugins extends readonly unknown[], const TOptions extends NodeWrapNodesOptions<NodeIn<TValue>> = NodeWrapNodesOptions<NodeIn<TValue>, NodeTypeSelector | undefined>>(editor: Editor<TValue, TPlugins>, element: ElementOf<TValue[number]>, options?: (undefined extends TOptions["type"] ? TOptions : never) | undefined): void;
2777
- }, string: (editor: AnyEditor, at: Location, options?: EditorStringOptions) => string, subscribeSource: <V extends Value>(editor: AnyEditor<V>, source: EditorCommitSource, listener: SnapshotListener<V>) => () => void, update: <V extends Value, TPlugins extends readonly unknown[]>(editor: Editor<V, TPlugins>, fn: (transaction: EditorUpdateTransaction<V, TPlugins>, context: EditorUpdateContext<Editor<V, TPlugins>>) => void) => void, unhangRange: (editor: AnyEditor, range: Range, options?: EditorUnhangRangeOptions) => Range, shouldMergeNodesRemovePrevNode: (editor: AnyEditor, prevNodeEntry: NodeEntry, curNodeEntry: NodeEntry) => boolean;
2778
- declare const deleteEditor: <TValue extends Value, TPlugins extends readonly unknown[]>(editor: Editor<TValue, TPlugins>, options?: TextDeleteOptions) => void;
2779
- declare const voidEditor: (editor: AnyEditor, options?: EditorVoidOptions) => NodeEntry<Element> | undefined;
2780
- type PropsCompare = (prop: unknown, node: unknown) => boolean;
2781
- type PropsMerge = (prop: unknown, node: unknown) => unknown;
2782
- //#endregion
2783
- export { AnyEditor, BaseEditor, BlockInsertOptions, CompatibleEditorCommand, CompatibleEditorRead, ContentSlice, CreateEditorOptions, DefinitionOf, Editor, EditorAboveOptions, EditorAfterOptions, EditorAnchorApi, EditorApiValueFromPlugin, EditorBeforeOptions, EditorBlockOptions, EditorBlockToggleOptions, EditorBreakExitOptions, EditorCanonicalUpdateTag, EditorCommand, EditorCommandAroundHandler, EditorCommandCapabilities, EditorCommandContext, EditorCommandContinuation, EditorCommandDescriptor, EditorCommandDispatch, EditorCommandHandler, EditorCommandInput, EditorCommandPlace, EditorCommandRegistration, EditorCommandRequiredEditor, EditorCommandResult, EditorCommit, EditorCommitChangeKind, EditorCommitChanged, EditorCommitContext, EditorCommitHandler, EditorCommitListener, EditorCommitRuntimeChangeKind, EditorCommitSource, EditorCoreApiGroups, EditorCoreStateView, EditorCoreUpdateMethods, EditorCoreUpdateTransaction, EditorCorrection, EditorCorrectionContext, EditorCorrectionEvent, EditorCorrectionQuery, EditorCorrectionTransaction, EditorDirectCommandDispatch, EditorDirectUpdate, EditorDirectedDeletionOptions, EditorDocumentRecords, EditorDocumentValue, EditorEffect, EditorEffectCollabDecodeContext, EditorEffectCollabEncodeContext, EditorEffectCollabReplay, EditorEffectCollabTransport, EditorEffectHistoryReplayResult, EditorEffectType, EditorElementBehavior, EditorElementReadOnlyOptions, EditorElementSlicePolicy, EditorFragmentDeletionOptions, EditorFragmentReadOptions, EditorGenericMethod, EditorInstalledApiGroups, EditorInstalledReadGroups, EditorInstalledUpdateGroups, EditorIsEditorOptions, EditorKeyApi, EditorLastOptions, EditorLeafOptions, EditorLevelsOptions, EditorLifecycleError, EditorLifecycleErrorSink, EditorMarks, EditorMarksOf, EditorNextOptions, EditorNodeChangeContext, EditorNodeChangeHandler, EditorNodeChangeKind, EditorNodeGetOptions, EditorNodeTypeProvider, EditorNodeUnsetOptions, EditorNodesOptions, EditorNodesReadOptions, EditorParentOptions, EditorPathOptions, EditorPointOptions, EditorPositionsOptions, EditorPreviousOptions, EditorRead, EditorReadAroundHandler, EditorReadCapabilities, EditorReadContext, EditorReadContinuation, EditorReadDescriptor, EditorReadInput, EditorReadMethodRecord, EditorReadMethodTree, EditorReadMethods, EditorReadRegistration, EditorReadRequiredEditor, EditorReadResult, EditorReadValueFromPlugin, EditorReplaceChildrenOptions, EditorReplaceNodeOptions, EditorResolvedInstalledPlugins, EditorRootEntry, EditorRootOwner, EditorSchemaCreate, EditorSchemaDocumentValue, EditorSchemaGetProperty, EditorSchemaPropertyReadOptions, EditorSchemaReadProperty, EditorSchemaVocabulary, EditorSelectionBlockOptions, EditorSelectionSetNodesOptions, EditorSelectionTarget, EditorSelectionTargetOptions, EditorSliceReadOptions, EditorSnapshot, EditorStateField, EditorStateFragmentApi, EditorStateMarksApi, EditorStateNodesApi, EditorStatePointsApi, EditorStateRangesApi, EditorStateRuntimeApi, EditorStateSchemaApi, EditorStateSelectionApi, EditorStateSliceApi, EditorStateTextApi, EditorStateUniqueApi, EditorStateValueApi, EditorStateView, EditorStateViewApi, EditorStateViewProvider, EditorStaticApi, EditorStringOptions, EditorTargetRuntime, EditorTextChangeContext, EditorTextChangeHandler, EditorToggleBlockOptions, EditorToggleMarkOptions, EditorTransactionAnchor, EditorTransactionAnchorApi, EditorTransactionAnnotationsApi, EditorTransactionBlocksApi, EditorTransactionBreakApi, EditorTransactionChangeContext, EditorTransactionChangeHandler, EditorTransactionChanged, EditorTransactionChangesApi, EditorTransactionDocumentChangeKind, EditorTransactionEffectsApi, EditorTransactionFragmentApi, EditorTransactionMarksApi, EditorTransactionNodesApi, EditorTransactionPluginsApi, EditorTransactionRecordsApi, EditorTransactionRemoved, EditorTransactionRootsApi, EditorTransactionSelectionApi, EditorTransactionSliceApi, EditorTransactionSpecBuilder, EditorTransactionTagsApi, EditorTransactionTextApi, EditorTransactionTopLevelRange, EditorTransactionValueApi, EditorUnhangRangeOptions, EditorUniqueHolder, EditorUpdate, EditorUpdateAnnotation, EditorUpdateContext, EditorUpdateMethods, EditorUpdatePolicy, EditorUpdatePolicyFor, EditorUpdateTag, EditorUpdateTagInput, EditorUpdateTransaction, EditorUpdateTransactionOf, EditorUpdateTransactionProvider, EditorUpdateValueApi, EditorUpdateValueFromPlugin, EditorValueFromPlugins, EditorValuePersistence, EditorValueTypeProvider, EditorView, EditorViewOptions, EditorVoidOptions, HistoryApi, HistoryOutcome, HistoryResult, HistorySettlement, InitialValue, NamedRootKey, NodeForTypeSelector, NodeKey, NodeTarget, PersistedDocumentInput, Plugin, PluginActivationContext, PluginApiFactory, PluginApiFactoryContext, PluginApiMap, PluginCandidateContext, PluginCandidateEditor, PluginCapabilities, PluginChangeHandlers, PluginCleanupContext, PluginCommandContext, PluginContribution, PluginContributionInput, PluginDefinition, PluginDefinitionInput, PluginDependencyContractReference, PluginDependencyReference, PluginDependencyReferenceFor, PluginFactoryTypeLambda, PluginFactoryTypeProvider, PluginFactoryTypeProviderOf, PluginInput, PluginInstalledCapabilitiesOf, PluginMigrationContext, PluginPoint, PluginPortal, PluginReadContext, PluginReadFactory, PluginReadFactoryContext, PluginReadMiddlewareFactory, PluginReconfigureOptions, PluginReference, PluginRegistry, PluginSchemaFactory, PluginSchemaFactoryContext, PluginSlotLike, PluginTypeLambda, PluginTypeProvider, PluginTypeProviderOf, PluginTypes, PluginUpdateFactory, PluginUpdateFactoryContext, PluginWitnessFor, PluginsOf, ProjectedRangeSegment, PropsCompare, PropsMerge, RegisteredPlugin, RootKey, type Selection, SerializedEditorEffect, SerializedEditorSelection, SerializedEditorValue, SnapshotIndex, SnapshotInput, SnapshotListener, SnapshotSelectionInput, StateFieldCollabPolicy, StateFieldDescriptor, StateFieldHistoryPolicy, StateFieldInitial, StateFieldTransition, StateFieldValueInput, TargetFreshnessRequest, TopLevelRuntimeRange, TransactionSpec, Value, ValueOf, above, addMark, after, before, collapse, deleteEditor as delete, deleteBackward, deleteForward, deleteFragment, deselect, edges, editorCommandRegistrationTypes, editorCommandTypes, editorReadRegistrationTypes, editorReadTypes, editorStateViewTypes, editorUpdateTransactionTypes, elementReadOnly, first, fragment, getChildren, getCollabEffects, getFragment, getLastCommit, getNodeKey, getPathByNodeKey, getPluginRegistry, getSelection, getSnapshot, hasBlocks, hasInlines, hasPath, hasTexts, insertBreak, insertNode, insertNodes, insertSoftBreak, insertText, install, isBlock, isEdge, isEditor, isElementReadOnly, isEmpty, isEnd, isInline, isSelectable, isStart, isVoid, last, leaf, levels, liftNodes, mergeNodes, move, moveNodes, next, parent, path, point, positions, previous, projectRange, range, read, removeMark, removeNodes, replace, replaceChildren, reset, select, setNodes, setPoint, setSelection, shouldMergeNodesRemovePrevNode, splitNodes, string, subscribeSource, toggleBlock, toggleMark, unhangRange, unsetNodes, unwrapNodes, update, voidEditor as void, wrapNodes };