platejs 54.0.0-beta.7 → 54.0.0-beta.9

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 (612) hide show
  1. package/THIRD_PARTY_NOTICES.md +0 -28
  2. package/dist/EditorStatic-BKBBZZn8.d.ts +771 -0
  3. package/dist/ai/index.d.ts +2 -2
  4. package/dist/ai/index.js +5 -2
  5. package/dist/ai/lib/aiDraftSession.js +984 -0
  6. package/dist/ai/{react → lib}/aiOutputLanding.internal.js +90 -96
  7. package/dist/ai/lib/aiPolicy.internal.js +403 -0
  8. package/dist/ai/lib/editorAgent.js +1696 -0
  9. package/dist/ai/lib/lockedContext.internal.js +130 -0
  10. package/dist/ai/lib/lockedContext.js +271 -0
  11. package/dist/ai/lib/registerEditorTools.js +235 -0
  12. package/dist/ai/react/AIPlugin.js +246 -0
  13. package/dist/ai/react/CopilotPlugin.js +327 -178
  14. package/dist/ai/react/copilotInline.internal.js +358 -0
  15. package/dist/ai/react/index.d.ts +200 -788
  16. package/dist/ai/react/index.js +3 -3
  17. package/dist/ai/react/useEditorAgent.js +193 -0
  18. package/dist/authored/AuthoredPlugin.js +34 -2
  19. package/dist/authored/index.d.ts +5 -4
  20. package/dist/authored/index.js +3 -2
  21. package/dist/{features/suggestion → authored}/suggestionColorOf.js +4 -4
  22. package/dist/{index-CLNem74G.d.ts → authored-BQAGqGhS-DN3sw1OP.d.ts} +101 -75
  23. package/dist/clipboard-format-key-CWuwPPe2-BJGVrNlz.d.ts +1 -0
  24. package/dist/code-block/codemirror/createCodeMirrorAdapter.js +224 -58
  25. package/dist/code-block/codemirror/index.d.ts +2 -1
  26. package/dist/comment-anchor.internal-L2GsNCIh.d.ts +28 -0
  27. package/dist/compiler/index.d.ts +9 -3
  28. package/dist/compiler/index.js +3 -1
  29. package/dist/{core-Cqc_KzpG.d.ts → core-N8rIvQxS.d.ts} +2451 -2213
  30. package/dist/core.js +4 -8
  31. package/dist/diff/index.d.ts +3 -30
  32. package/dist/docs/ai.md +475 -387
  33. package/dist/docs/api/anchor.md +1 -1
  34. package/dist/docs/api/core/plate-components.md +12 -3
  35. package/dist/docs/api/core/plate-editor.md +1 -1
  36. package/dist/docs/api/core/plate-plugin.md +40 -27
  37. package/dist/docs/api/core/plate-store.md +14 -13
  38. package/dist/docs/api/core.md +68 -92
  39. package/dist/docs/api/document-change.md +39 -28
  40. package/dist/docs/api/dom.md +66 -102
  41. package/dist/docs/api/editor-api.md +74 -42
  42. package/dist/docs/api/editor-transforms.md +17 -39
  43. package/dist/docs/api/location.md +5 -12
  44. package/dist/docs/api/plate.md +2 -2
  45. package/dist/docs/api/react-hooks.md +119 -54
  46. package/dist/docs/api/selection.md +10 -2
  47. package/dist/docs/api/utils.md +14 -14
  48. package/dist/docs/authored-changes.md +38 -33
  49. package/dist/docs/autoformat.md +4 -1
  50. package/dist/docs/basic-marks.md +0 -1
  51. package/dist/docs/block-menu.md +2 -3
  52. package/dist/docs/block-placeholder.md +2 -3
  53. package/dist/docs/board.md +28 -24
  54. package/dist/docs/bold.md +0 -2
  55. package/dist/docs/clear-formatting.md +4 -4
  56. package/dist/docs/clipboard.md +25 -18
  57. package/dist/docs/code-block.md +62 -40
  58. package/dist/docs/column.md +28 -15
  59. package/dist/docs/combobox.md +36 -51
  60. package/dist/docs/comment.md +171 -141
  61. package/dist/docs/controlled.md +5 -7
  62. package/dist/docs/copilot.md +183 -148
  63. package/dist/docs/debugging.md +5 -14
  64. package/dist/docs/discussion.md +34 -28
  65. package/dist/docs/dnd.md +7 -6
  66. package/dist/docs/document-meta.md +27 -28
  67. package/dist/docs/document-model.md +12 -11
  68. package/dist/docs/docx.md +102 -111
  69. package/dist/docs/editor-methods.md +3 -3
  70. package/dist/docs/editor.md +59 -95
  71. package/dist/docs/emoji.md +4 -5
  72. package/dist/docs/equation.md +4 -4
  73. package/dist/docs/examples/collaboration-example.md +15 -30
  74. package/dist/docs/examples/export.md +10 -9
  75. package/dist/docs/examples/version-history.md +7 -6
  76. package/dist/docs/exit-break.md +32 -59
  77. package/dist/docs/external-text.md +28 -15
  78. package/dist/docs/field.md +3 -3
  79. package/dist/docs/find.md +70 -102
  80. package/dist/docs/footnote.md +104 -92
  81. package/dist/docs/format-painter.md +1 -1
  82. package/dist/docs/history.md +49 -63
  83. package/dist/docs/html.md +69 -33
  84. package/dist/docs/indent.md +46 -34
  85. package/dist/docs/ink.md +46 -31
  86. package/dist/docs/installation/docs.md +10 -0
  87. package/dist/docs/installation/node.md +12 -8
  88. package/dist/docs/installation/plate-ui.md +12 -7
  89. package/dist/docs/line-height.md +1 -1
  90. package/dist/docs/link.md +95 -98
  91. package/dist/docs/list.md +75 -47
  92. package/dist/docs/llms.txt +14 -11
  93. package/dist/docs/lock.md +271 -0
  94. package/dist/docs/markdown.md +124 -209
  95. package/dist/docs/media.md +31 -31
  96. package/dist/docs/mention.md +6 -9
  97. package/dist/docs/multi-select.md +17 -9
  98. package/dist/docs/pagination.md +144 -127
  99. package/dist/docs/performance.md +2 -2
  100. package/dist/docs/plugin-context.md +18 -13
  101. package/dist/docs/plugin-input-rules.md +84 -125
  102. package/dist/docs/plugin-methods.md +11 -9
  103. package/dist/docs/plugin-rules.md +11 -35
  104. package/dist/docs/plugin-shortcuts.md +1 -1
  105. package/dist/docs/plugin.md +53 -2
  106. package/dist/docs/prompt-editor.md +0 -1
  107. package/dist/docs/roots.md +2 -3
  108. package/dist/docs/schema.md +12 -3
  109. package/dist/docs/selection.md +3 -1
  110. package/dist/docs/serializing.md +34 -10
  111. package/dist/docs/slash-command.md +4 -4
  112. package/dist/docs/static.md +30 -10
  113. package/dist/docs/suggestion.md +51 -71
  114. package/dist/docs/sync.md +256 -0
  115. package/dist/docs/table.md +35 -20
  116. package/dist/docs/text-align.md +4 -4
  117. package/dist/docs/toolbar.md +26 -5
  118. package/dist/docs/trailing-block.md +18 -45
  119. package/dist/docs/underline.md +2 -2
  120. package/dist/docs/unit-testing.md +1 -1
  121. package/dist/docs/upload.md +71 -36
  122. package/dist/docx/export/index.d.ts +152 -56
  123. package/dist/docx/export/lib/colors.js +268 -0
  124. package/dist/docx/export/lib/compileAst.js +1825 -0
  125. package/dist/docx/export/lib/exportDocx.js +57 -113
  126. package/dist/docx/export/lib/mathOmml.js +233 -0
  127. package/dist/docx/export/lib/ooxmlBuilder.js +1759 -0
  128. package/dist/docx/export/lib/outputSafety.js +155 -82
  129. package/dist/docx/export/lib/reviewProjection.js +31 -202
  130. package/dist/docx/export/lib/sourcePreservation.js +133 -73
  131. package/dist/docx/export/lib/wordStyles.js +399 -0
  132. package/dist/docx/import/index.d.ts +4 -4
  133. package/dist/docx/import/lib/importDocx.js +1401 -1062
  134. package/dist/docx/import/lib/opcRelationships.js +77 -0
  135. package/dist/docx/import/lib/readWordDocument.js +990 -0
  136. package/dist/docx/import/lib/wordStyles.js +534 -0
  137. package/dist/docx/internal/diagnostics.js +67 -0
  138. package/dist/docx/internal/docxPackage.js +20 -44
  139. package/dist/docx/internal/domParser.js +2 -21
  140. package/dist/docx/internal/packageParts.js +15 -16
  141. package/dist/docx/internal/readDocxNumbering.js +35 -38
  142. package/dist/docx/internal/reviewPart.js +22 -21
  143. package/dist/docx/internal/sourceEligibility.js +87 -30
  144. package/dist/docx/internal/wordMath.js +102 -137
  145. package/dist/docx/internal/xmlTree.js +262 -0
  146. package/dist/docx/internal/xmlWriter.js +44 -0
  147. package/dist/docx/paste/index.d.ts +4 -4
  148. package/dist/docx/paste/lib/WordPastePlugin.js +12 -11
  149. package/dist/dom/index.d.ts +2 -2
  150. package/dist/dom/index.js +2 -2
  151. package/dist/dom/plite-dom.internal.js +2 -2
  152. package/dist/excalidraw/index.d.ts +6 -4
  153. package/dist/excalidraw/lib/BaseExcalidrawPlugin.js +19 -7
  154. package/dist/excalidraw/react/index.d.ts +6 -4
  155. package/dist/facade.js +3 -3
  156. package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +32 -12
  157. package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +46 -7
  158. package/dist/features/basic-nodes/lib/BaseMarkPlugins.js +159 -81
  159. package/dist/features/basic-styles/lib/BaseStylePlugins.js +79 -82
  160. package/dist/features/board/index.d.ts +2 -2
  161. package/dist/features/board/index.js +2 -2
  162. package/dist/features/board/lib/BaseBoardArrowPlugin.js +90 -87
  163. package/dist/features/board/lib/BaseBoardFramePlugin.js +7 -7
  164. package/dist/features/board/lib/BaseBoardGeoPlugin.js +3 -2
  165. package/dist/features/board/lib/BaseBoardImagePlugin.js +9 -6
  166. package/dist/features/board/lib/BaseBoardNotePlugin.js +3 -2
  167. package/dist/features/board/lib/BaseBoardPlugin.js +368 -283
  168. package/dist/features/board/lib/BaseBoardStrokePlugin.js +8 -5
  169. package/dist/features/board/lib/BaseBoardTextPlugin.js +3 -2
  170. package/dist/features/board/lib/boardArrow.internal.js +2 -2
  171. package/dist/features/board/lib/boardCopy.internal.js +42 -36
  172. package/dist/features/board/lib/boardFrame.internal.js +5 -7
  173. package/dist/features/board/lib/boardGeometry.internal.js +124 -0
  174. package/dist/features/board/lib/boardHtml.internal.js +36 -36
  175. package/dist/features/board/lib/boardMember.internal.js +8 -8
  176. package/dist/features/board/lib/boardShape.internal.js +10 -124
  177. package/dist/features/board/lib/boardStyle.internal.js +6 -6
  178. package/dist/features/board/lib/boardTypes.internal.js +9 -0
  179. package/dist/features/callout/index.d.ts +3 -3
  180. package/dist/features/callout/lib/BaseCalloutPlugin.js +43 -2
  181. package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +208 -181
  182. package/dist/features/code-block/lib/CodeBlockRules.js +133 -14
  183. package/dist/features/column/index.d.ts +2 -0
  184. package/dist/features/column/lib/BaseColumnPlugin.js +693 -0
  185. package/dist/features/comments/BaseCommentsPlugin.js +1315 -408
  186. package/dist/features/comments/comment-thread-index.internal.js +5 -4
  187. package/dist/features/comments/index.d.ts +3 -2
  188. package/dist/features/date/index.d.ts +3 -3
  189. package/dist/features/date/lib/BaseDatePlugin.js +72 -31
  190. package/dist/features/details/index.d.ts +4 -3
  191. package/dist/features/details/lib/BaseDetailsPlugin.js +226 -122
  192. package/dist/features/field/index.d.ts +1 -1
  193. package/dist/features/field/lib/BaseFieldPlugin.js +64 -48
  194. package/dist/features/field/lib/fieldRules.internal.js +6 -6
  195. package/dist/features/find/index.d.ts +98 -34
  196. package/dist/features/find/lib/BaseFindPlugin.js +939 -370
  197. package/dist/features/footnote/index.d.ts +428 -2
  198. package/dist/features/footnote/lib/BaseFootnotePlugin.js +437 -160
  199. package/dist/features/indent/lib/BaseIndentPlugin.js +222 -75
  200. package/dist/features/indent/lib/indentHtml.internal.js +9 -0
  201. package/dist/features/indent/lib/indentLevel.internal.js +3 -3
  202. package/dist/features/ink/index.d.ts +2 -2
  203. package/dist/features/ink/lib/BaseInkPlugin.js +122 -85
  204. package/dist/features/ink/lib/inkMatch.internal.js +79 -78
  205. package/dist/features/ink/lib/inkPlaces.internal.js +167 -536
  206. package/dist/features/link/lib/BaseLinkPlugin.js +504 -188
  207. package/dist/features/lint/index.d.ts +5 -5
  208. package/dist/features/lint/lib/BaseLintPlugin.js +3 -1
  209. package/dist/features/list/lib/BaseListPlugin.js +100 -691
  210. package/dist/features/list/lib/listCommands.internal.js +161 -0
  211. package/dist/features/list/lib/listFamily.internal.js +68 -23
  212. package/dist/features/list/lib/listHtml.internal.js +185 -69
  213. package/dist/features/list/lib/listIndex.internal.js +50 -20
  214. package/dist/features/list/lib/listKeyboard.internal.js +176 -0
  215. package/dist/features/list/lib/listMarkdown.internal.js +127 -0
  216. package/dist/features/list/lib/listRules.internal.js +125 -0
  217. package/dist/features/lock/index.d.ts +2 -0
  218. package/dist/features/lock/index.js +2 -0
  219. package/dist/features/lock/lib/BaseLockPlugin.js +626 -0
  220. package/dist/features/media/index.d.ts +1 -1
  221. package/dist/features/media/lib/BaseMediaPlugin.js +117 -4
  222. package/dist/features/media/lib/image/BaseImagePlugin.js +46 -10
  223. package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +26 -8
  224. package/dist/features/media/lib/mediaHtml.internal.js +2 -2
  225. package/dist/features/mention/index.d.ts +4 -11
  226. package/dist/features/mention/lib/BaseMentionPlugin.js +12 -16
  227. package/dist/features/table/index.d.ts +2 -2
  228. package/dist/features/table/lib/BaseTablePlugin.js +711 -410
  229. package/dist/features/table/lib/internal/authoredProjection.js +172 -0
  230. package/dist/features/table/lib/internal/axisMove.js +152 -0
  231. package/dist/features/table/lib/internal/docxBorders.js +39 -0
  232. package/dist/features/table/lib/internal/grid.js +34 -1
  233. package/dist/features/table/lib/internal/mutation.js +18 -121
  234. package/dist/features/table/lib/internal/selection.js +114 -3
  235. package/dist/features/table/lib/internal/tabularText.js +2 -1
  236. package/dist/features/table/lib/internal/widths.js +118 -0
  237. package/dist/features/toc/index.d.ts +1 -1
  238. package/dist/features/toc/lib/BaseTocPlugin.js +42 -2
  239. package/dist/features/upload/index.d.ts +2 -2
  240. package/dist/features/upload/index.js +3 -2
  241. package/dist/features/upload/lib/BaseUploadPlugin.js +262 -298
  242. package/dist/features/upload/lib/uploadRules.internal.js +259 -0
  243. package/dist/history/index.d.ts +2 -3
  244. package/dist/html/index.d.ts +4 -3
  245. package/dist/html/server/index.d.ts +6 -2
  246. package/dist/html/server/index.js +7 -3
  247. package/dist/html/server/serverCssParser.internal.js +500 -0
  248. package/dist/html/server/serverCssStyle.internal.js +208 -0
  249. package/dist/{index-BI0NS7kx.d.ts → htmlConversion-DkPBUAhF.d.ts} +6 -3
  250. package/dist/{htmlTypes-i_FBCMf2.d.ts → htmlTypes-BtbQ2kEr.d.ts} +24 -14
  251. package/dist/hyperscript/index.d.ts +1 -1
  252. package/dist/{index-KteL56rA.d.ts → index-1OVDeYPV.d.ts} +4 -3
  253. package/dist/{index-Cc2ajXAd.d.ts → index-B32tPEDz.d.ts} +152 -83
  254. package/dist/index-BG8rVWFU.d.ts +21 -0
  255. package/dist/{index-B4ZhSQdk.d.ts → index-BTr77Bx4.d.ts} +65 -79
  256. package/dist/{index-1rcWTB-o.d.ts → index-Bjidr3Bh.d.ts} +89 -38
  257. package/dist/index-BrH9LjUL.d.ts +1 -0
  258. package/dist/index-C5UBSjnN.d.ts +3 -0
  259. package/dist/{index-CrJ9Km8W.d.ts → index-C9NdczaJ.d.ts} +9 -12
  260. package/dist/{index-1PlYsibA.d.ts → index-CQIZktRx.d.ts} +144 -55
  261. package/dist/{index-uVbqCpDa.d.ts → index-CXykQDCy.d.ts} +172 -115
  262. package/dist/{comparison-types-CsmDG5r2-z1s4gX06.d.ts → index-CkM6HC0j-Dl58Hah-.d.ts} +19 -57
  263. package/dist/{index-By7BkzIN.d.ts → index-CpPTPirx.d.ts} +2 -2
  264. package/dist/index-DFTcRJUh.d.ts +97 -0
  265. package/dist/index-DUPlSPvg.d.ts +81 -0
  266. package/dist/{index-CxG1Atvg.d.ts → index-DayqETUb.d.ts} +243 -241
  267. package/dist/{index-DNXr_SN-.d.ts → index-DlfamnX-.d.ts} +128 -230
  268. package/dist/index-DlmWL_1-.d.ts +116 -0
  269. package/dist/index-Dqd1rrEG-BSmp1a8x.d.ts +316 -0
  270. package/dist/{index-CTTjpWgb-Fdrn8NP4.d.ts → index-Du3tBg6V-CtvB7eak.d.ts} +3 -3
  271. package/dist/{index-CmISVYmz.d.ts → index-MQmrgI2L.d.ts} +20 -50
  272. package/dist/{index-Bv13FX9o.d.ts → index-SKTw56CW.d.ts} +9 -9
  273. package/dist/{index-DfkFmApH.d.ts → index-drvpTZ3S.d.ts} +743 -1532
  274. package/dist/index-vP4xFieu.d.ts +184 -0
  275. package/dist/index-zK527a0f.d.ts +57 -0
  276. package/dist/index.d.ts +4 -4
  277. package/dist/index.js +7 -11
  278. package/dist/internal/comments/comment-anchor.internal.js +636 -0
  279. package/dist/internal/plugin/OverridePlugin.js +155 -53
  280. package/dist/internal/plugin/blockInsertion.js +4 -4
  281. package/dist/internal/plugin/collectPlateNodeMappings.js +18 -8
  282. package/dist/internal/plugin/compilePlainTextMappings.js +68 -15
  283. package/dist/internal/plugin/compilePlateModel.js +56 -17
  284. package/dist/internal/plugin/compilePlateShortcuts.js +2 -1
  285. package/dist/internal/plugin/compilePluginInputMaps.js +126 -0
  286. package/dist/internal/plugin/createPlateModelPublication.js +261 -0
  287. package/dist/internal/plugin/createPlateRuntimePlugins.js +263 -0
  288. package/dist/internal/plugin/getPlateDecorationSources.js +2 -1
  289. package/dist/internal/plugin/indentShift.js +44 -0
  290. package/dist/internal/plugin/markdownParagraph.js +23 -1
  291. package/dist/internal/plugin/plateRuntime.js +9 -3
  292. package/dist/internal/plugin/pluginDescriptorSnapshot.js +178 -0
  293. package/dist/internal/plugin/pluginFormatOperation.js +8 -3
  294. package/dist/internal/plugin/pluginStore.js +4 -7
  295. package/dist/internal/plugin/resolvePlugin.js +32 -14
  296. package/dist/internal/plugin/resolvePluginGraph.js +354 -0
  297. package/dist/internal/plugin/resolvePlugins.js +19 -1135
  298. package/dist/internal/plugin/staticReuseKey.internal.js +15 -0
  299. package/dist/internal/plugin/uploadDrafts.js +6 -1
  300. package/dist/internal/utils/mergePlugins.js +6 -5
  301. package/dist/internal/utils/trustedContentSlice.js +1 -1
  302. package/dist/internal/utils/urlPolicy.js +19 -1
  303. package/dist/lib/editor/editorUser.internal.js +13 -5
  304. package/dist/lib/editor/withPlite.js +55 -44
  305. package/dist/lib/libs/zustand.js +31 -7
  306. package/dist/lib/plugin/basePluginFactory.internal.js +7 -0
  307. package/dist/lib/plugin/createPluginContext.internal.js +6 -24
  308. package/dist/lib/plugin/defineBasePlugin.internal.js +69 -9
  309. package/dist/lib/plugin/definePlugin.js +1 -1
  310. package/dist/lib/plugin/pluginFactoryRuntime.internal.js +40 -0
  311. package/dist/lib/plugins/affinity/AffinityPlugin.js +9 -8
  312. package/dist/lib/plugins/debug/DebugPlugin.js +1 -4
  313. package/dist/lib/plugins/dom/DOMPlugin.js +20 -7
  314. package/dist/lib/plugins/dom/clipboardFormatKey.internal.js +9 -0
  315. package/dist/lib/plugins/dom/isPlainTextPasteTarget.internal.js +13 -0
  316. package/dist/lib/plugins/getCorePlugins.internal.js +1 -3
  317. package/dist/lib/plugins/html/HtmlPlugin.js +30 -1747
  318. package/dist/lib/plugins/html/htmlAst.js +10 -5
  319. package/dist/lib/plugins/html/htmlConversion.js +4 -0
  320. package/dist/lib/plugins/html/htmlDecode.internal.js +891 -0
  321. package/dist/lib/plugins/html/htmlDom.js +1 -10
  322. package/dist/lib/plugins/html/htmlMatcher.internal.js +24 -1
  323. package/dist/lib/plugins/html/htmlRules.internal.js +490 -0
  324. package/dist/lib/plugins/html/htmlSerialize.internal.js +462 -0
  325. package/dist/lib/plugins/html/htmlWhitespace.internal.js +137 -0
  326. package/dist/lib/plugins/input-rules/InputRulesPlugin.js +114 -30
  327. package/dist/lib/plugins/input-rules/createInputRules.js +64 -68
  328. package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +111 -9
  329. package/dist/lib/plugins/input-rules/inputRuleVeto.js +2 -2
  330. package/dist/lib/plugins/input-rules/inputRules.internal.js +20 -0
  331. package/dist/lib/plugins/input-rules/markInputRule.internal.js +64 -2
  332. package/dist/lib/plugins/paragraph/BaseParagraphPlugin.js +21 -8
  333. package/dist/lib/utils/pluginNodeClass.js +1 -5
  334. package/dist/markdown/index.d.ts +2 -2
  335. package/dist/markdown/index.js +1 -2
  336. package/dist/markdown/lib/MarkdownPlugin.js +40 -49
  337. package/dist/markdown/lib/deserializer/convertNodesDeserialize.js +30 -6
  338. package/dist/markdown/lib/deserializer/mdastToSlate.js +2 -4
  339. package/dist/markdown/lib/internal/markdownBareLinks.js +265 -0
  340. package/dist/markdown/lib/internal/markdownBreaks.js +191 -0
  341. package/dist/markdown/lib/internal/markdownDiagnostics.js +2 -2
  342. package/dist/markdown/lib/internal/markdownDocument.js +13 -32
  343. package/dist/markdown/lib/internal/markdownIntrinsics.js +68 -228
  344. package/dist/markdown/lib/internal/markdownLine.js +134 -118
  345. package/dist/markdown/lib/internal/markdownMappings.js +178 -88
  346. package/dist/markdown/lib/internal/markdownParse.js +601 -0
  347. package/dist/markdown/lib/internal/markdownReferences.js +9 -3
  348. package/dist/markdown/lib/internal/markdownRuntime.js +353 -0
  349. package/dist/markdown/lib/internal/markdownSafety.js +101 -1
  350. package/dist/markdown/lib/internal/markdownSerialize.js +197 -0
  351. package/dist/markdown/lib/internal/markdownStream.js +1239 -0
  352. package/dist/markdown/lib/internal/markdownTags.js +52 -63
  353. package/dist/markdown/lib/internal/markdownTailHeal.js +813 -0
  354. package/dist/markdown/lib/serializer/convertNodesSerialize.js +18 -5
  355. package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +134 -53
  356. package/dist/markdown/lib/serializer/listToMdastTree.js +23 -4
  357. package/dist/markdown/lib/serializer/reportOmittedProperties.js +1 -0
  358. package/dist/markdown/lib/utils/remarkPlugins.js +44 -23
  359. package/dist/math/index.d.ts +11 -11
  360. package/dist/math/lib/BaseEquationPlugin.js +99 -20
  361. package/dist/math/react/index.d.ts +4 -4
  362. package/dist/migrations/documentMigrationAuthored.internal.js +2 -1
  363. package/dist/migrations/documentMigrationSelection.internal.js +138 -2
  364. package/dist/migrations/documentMigrationTarget.internal.js +10 -2
  365. package/dist/migrations/documentMigrations.js +113 -140
  366. package/dist/migrations/index.d.ts +30 -44
  367. package/dist/migrations/index.js +1 -2
  368. package/dist/migrations/migratePlateV54.js +50 -45
  369. package/dist/migrations/migratePlateV54Ast.internal.js +180 -119
  370. package/dist/migrations/migratePlateV54BuiltIns.internal.js +2 -2
  371. package/dist/migrations/migratePlateV54CodeBlocks.internal.js +68 -34
  372. package/dist/migrations/migratePlateV54Inputs.internal.js +39 -32
  373. package/dist/migrations/migratePlateV54ListIdentity.internal.js +220 -0
  374. package/dist/migrations/migratePlateV54Profile.internal.js +52 -22
  375. package/dist/migrations/migratePlateV54RetiredMarks.internal.js +2 -2
  376. package/dist/migrations/migratePlateV54Stage.internal.js +127 -0
  377. package/dist/migrations/migratePlateV54Toggle.internal.js +66 -0
  378. package/dist/migrations/migratePlateV54Urls.internal.js +86 -57
  379. package/dist/pagination/index.d.ts +2 -167
  380. package/dist/pagination/index.js +2 -2
  381. package/dist/pagination/react/PaginationPlugin.js +278 -0
  382. package/dist/pagination/react/index.d.ts +94 -34
  383. package/dist/pagination/react/index.js +3 -5
  384. package/dist/plain-text.js +9 -12
  385. package/dist/react/authored/AuthoredReactPlugin.js +126 -0
  386. package/dist/react/authored/index.d.ts +34 -0
  387. package/dist/react/authored/index.js +3 -0
  388. package/dist/react/authored/useAuthored.js +82 -0
  389. package/dist/react/components/EditorContentView.internal.js +64 -45
  390. package/dist/react/components/EditorProvider.js +25 -24
  391. package/dist/react/components/EditorRefEffect.internal.js +56 -0
  392. package/dist/react/components/EditorRefEffect.js +12 -56
  393. package/dist/react/components/NodeSelection.js +435 -486
  394. package/dist/react/components/Plate.js +215 -168
  395. package/dist/react/components/PlateContainer.js +96 -43
  396. package/dist/react/components/PlateView.js +2 -2
  397. package/dist/{static/internal/getPlainText.js → react/components/getPlainText.internal.js} +1 -4
  398. package/dist/react/components/plate-nodes.js +49 -42
  399. package/dist/{static/internal/writeStaticSelectionClipboardData.js → react/components/writeStaticSelectionClipboardData.internal.js} +4 -5
  400. package/dist/react/core.js +7 -11
  401. package/dist/react/editor/useCreateEditor.js +19 -17
  402. package/dist/react/editor/withPlate.js +10 -13
  403. package/dist/react/features/basic-styles/BasicStylePlugins.js +2 -3
  404. package/dist/react/features/board/BoardPlugin.js +1 -1
  405. package/dist/react/features/board/BoardShape.js +51 -26
  406. package/dist/react/features/board/BoardSurface.js +1 -1
  407. package/dist/react/features/board/boardCamera.internal.js +295 -0
  408. package/dist/react/features/board/boardClipboard.internal.js +20 -20
  409. package/dist/react/features/board/boardConnect.internal.js +2 -10
  410. package/dist/react/features/board/boardExport.internal.js +5 -4
  411. package/dist/react/features/board/boardGesture.internal.js +44 -38
  412. package/dist/react/features/board/boardIndex.internal.js +1 -1
  413. package/dist/react/features/board/boardKeys.internal.js +68 -43
  414. package/dist/react/features/board/boardLanding.internal.js +147 -0
  415. package/dist/react/features/board/boardPick.internal.js +2 -2
  416. package/dist/react/features/board/boardPicking.internal.js +0 -17
  417. package/dist/react/features/board/boardPreview.internal.js +16 -2
  418. package/dist/react/features/board/boardResize.internal.js +17 -32
  419. package/dist/react/features/board/boardStyleView.internal.js +123 -0
  420. package/dist/react/features/board/boardTextFit.internal.js +311 -0
  421. package/dist/react/features/board/boardView.internal.js +333 -909
  422. package/dist/react/features/board/boardVoice.internal.js +19 -7
  423. package/dist/react/features/board/boardWindow.internal.js +138 -0
  424. package/dist/react/features/board/index.d.ts +97 -89
  425. package/dist/react/features/callout/index.d.ts +3 -3
  426. package/dist/react/features/{layout → column}/ColumnPlugin.js +4 -3
  427. package/dist/react/features/{layout → column}/index.d.ts +61 -44
  428. package/dist/react/features/combobox/combobox.internal.js +106 -0
  429. package/dist/react/features/combobox/comboboxOwner.internal.js +28 -26
  430. package/dist/react/features/combobox/index.d.ts +47 -16
  431. package/dist/react/features/combobox/useCombobox.js +50 -13
  432. package/dist/react/features/comments/CommentsPlugin.js +3 -3
  433. package/dist/react/features/comments/index.d.ts +142 -75
  434. package/dist/react/features/comments/index.js +2 -1
  435. package/dist/react/features/comments/useCommentThreadIndex.js +288 -0
  436. package/dist/react/features/date/index.d.ts +4 -4
  437. package/dist/react/features/details/index.d.ts +5 -5
  438. package/dist/react/features/field/index.d.ts +6 -5
  439. package/dist/react/features/footnote/FootnotePlugin.js +13 -8
  440. package/dist/react/features/footnote/index.d.ts +952 -105
  441. package/dist/react/features/format-painter/index.d.ts +6 -6
  442. package/dist/react/features/ink/InkContent.js +28 -100
  443. package/dist/react/features/ink/InkPlugin.js +12 -23
  444. package/dist/react/features/ink/index.d.ts +53 -106
  445. package/dist/react/features/ink/index.js +1 -2
  446. package/dist/react/features/ink/inkCapture.internal.js +107 -65
  447. package/dist/react/features/ink/inkImages.internal.js +20 -5
  448. package/dist/react/features/ink/inkMeasure.internal.js +35 -22
  449. package/dist/react/features/ink/inkPlacement.internal.js +78 -203
  450. package/dist/react/features/ink/inkWatch.internal.js +1 -32
  451. package/dist/react/features/list/ListPlugin.js +68 -36
  452. package/dist/react/features/lock/LockPlugin.js +105 -0
  453. package/dist/react/features/lock/index.d.ts +58 -0
  454. package/dist/react/features/lock/index.js +2 -0
  455. package/dist/react/features/media/index.d.ts +10 -10
  456. package/dist/react/features/mention/index.d.ts +4 -11
  457. package/dist/react/features/table/TablePlugin.js +215 -61
  458. package/dist/react/features/table/index.d.ts +158 -59
  459. package/dist/react/features/table/index.js +2 -1
  460. package/dist/react/features/table/measureTableColumnWidths.internal.js +44 -0
  461. package/dist/react/features/table/useTableControls.js +897 -0
  462. package/dist/react/features/table/useTableResize.js +33 -16
  463. package/dist/react/features/toc/index.d.ts +8 -11
  464. package/dist/react/features/upload/UploadPlugin.js +12 -3
  465. package/dist/react/features/upload/index.d.ts +36 -97
  466. package/dist/react/index.d.ts +7 -5
  467. package/dist/react/index.js +11 -15
  468. package/dist/react/internal/plate-context.js +118 -68
  469. package/dist/react/internal/useDeepCompareMemo.js +36 -7
  470. package/dist/react/internal/usePlateModelRevision.js +12 -7
  471. package/dist/react/plite-react.js +2 -2
  472. package/dist/react/plugin/pluginFactory.internal.js +1 -37
  473. package/dist/react/plugin/toReactPlugin.js +15 -4
  474. package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +2 -2
  475. package/dist/react/stores/element/useElement.js +2 -2
  476. package/dist/react/stores/element/useElementSelector.js +4 -2
  477. package/dist/react/stores/element/useElementStore.js +96 -86
  478. package/dist/react/stores/element/useElementStoreSelector.internal.js +80 -24
  479. package/dist/react/stores/element/usePath.js +32 -32
  480. package/dist/react/stores/plate/pluginStoreSelector.internal.js +44 -0
  481. package/dist/react/stores/plate/useEditor.js +62 -89
  482. package/dist/react/stores/plate/useEditorSelector.js +17 -204
  483. package/dist/react/stores/plate/usePluginStore.js +36 -43
  484. package/dist/react/stores/plate/useViewStore.js +38 -23
  485. package/dist/react/utils/BlockPlaceholderPlugin.js +13 -4
  486. package/dist/react/utils/pipeHandler.internal.js +20 -7
  487. package/dist/react/utils/pipeRenderElement.internal.js +32 -30
  488. package/dist/react/utils/pipeRenderLeaf.internal.js +1 -2
  489. package/dist/react/utils/pipeRenderText.internal.js +1 -1
  490. package/dist/react/utils/useSelectionFragment.js +8 -2
  491. package/dist/react/virtualized.d.ts +6 -5
  492. package/dist/refusal-CBecclcb-BJGVrNlz.d.ts +1 -0
  493. package/dist/registerEditorTools-dPLJZ0PP.d.ts +386 -0
  494. package/dist/root.js +7 -11
  495. package/dist/skills/plate/SKILL.md +43 -0
  496. package/dist/{source-Dcgqj5Mf.d.ts → source-BnYE-ryK.d.ts} +14 -14
  497. package/dist/static/components/{PlateStatic.js → EditorStatic.js} +86 -31
  498. package/dist/static/components/plite-nodes.js +32 -12
  499. package/dist/static/index.d.ts +24 -20
  500. package/dist/static/index.js +1 -1
  501. package/dist/static/internal/loadStaticRenderer.js +4 -0
  502. package/dist/static/internal/staticDocumentView.js +8 -5
  503. package/dist/static/internal/staticPendingMedia.internal.js +136 -0
  504. package/dist/static/internal/staticPresentation.js +12 -12
  505. package/dist/static/pipeRenderElementStatic.internal.js +2 -10
  506. package/dist/static/pluginRenderElementStatic.internal.js +28 -5
  507. package/dist/static/pluginRenderLeafStatic.internal.js +4 -3
  508. package/dist/static/pluginRenderTextStatic.internal.js +3 -1
  509. package/dist/static/renderStaticHtml.js +31 -2
  510. package/dist/static/utils/getRenderNodeStaticProps.internal.js +8 -3
  511. package/dist/sync/SyncPlugin.js +16 -0
  512. package/dist/sync/cloudflare/index.d.ts +56 -0
  513. package/dist/sync/cloudflare/index.js +2 -0
  514. package/dist/sync/index.d.ts +3 -0
  515. package/dist/sync/index.js +3 -0
  516. package/dist/sync/react/SyncReactPlugin.js +20 -0
  517. package/dist/sync/react/hooks.js +64 -0
  518. package/dist/{yjs → sync}/react/index.d.ts +74 -68
  519. package/dist/sync/react/index.js +4 -0
  520. package/dist/sync/server/index.d.ts +3 -0
  521. package/dist/sync/server/index.js +2 -0
  522. package/dist/tabbable/index.d.ts +1 -1
  523. package/dist/tabbable/react/TabbableEffects.internal.js +5 -5
  524. package/dist/tabbable/react/index.d.ts +3 -3
  525. package/dist/testing/index.d.ts +7 -6
  526. package/dist/transport-CRrArpJZ-Bm6uVAsa.d.ts +115 -0
  527. package/dist/{tx-only-1FM45FSj-D40jacZv.d.ts → tx-only-DXWFNuXJ-DuOaZk8U.d.ts} +2818 -2677
  528. package/dist/utils/plate-keys.js +2 -8
  529. package/dist/utils/plugins/TrailingBlockPlugin.js +10 -7
  530. package/dist/utils/plugins/resolveTrailingBlockType.internal.js +8 -0
  531. package/package.json +61 -115
  532. package/dist/AIChatRequestContext-DVGOeWhQ.d.ts +0 -34
  533. package/dist/BaseSuggestionPlugin-BRFMMyEo.d.ts +0 -91
  534. package/dist/PlateStatic-DIwBAVqF.d.ts +0 -19
  535. package/dist/ai/lib/AIChatRequestContext.js +0 -16
  536. package/dist/ai/lib/findQuotedSpan.internal.js +0 -63
  537. package/dist/ai/react/AIChatPlugin.js +0 -1244
  538. package/dist/ai/react/useAIChat.js +0 -332
  539. package/dist/combobox-CfCJYKT0.d.ts +0 -22
  540. package/dist/docs/yjs.md +0 -256
  541. package/dist/docx/export/lib/comments.js +0 -311
  542. package/dist/docx/export/lib/docxStaticComponents.js +0 -381
  543. package/dist/docx/export/lib/exportHtmlToDocx.internal.js +0 -70
  544. package/dist/docx/export/lib/generatedParts.js +0 -51
  545. package/dist/docx/export/lib/hostIndex.js +0 -92
  546. package/dist/docx/export/lib/html-to-docx.internal.js +0 -40
  547. package/dist/docx/export/lib/internal/constants.js +0 -106
  548. package/dist/docx/export/lib/internal/docx-document.js +0 -652
  549. package/dist/docx/export/lib/internal/escape-xml.js +0 -4
  550. package/dist/docx/export/lib/internal/html-to-docx.js +0 -148
  551. package/dist/docx/export/lib/internal/list-item.js +0 -85
  552. package/dist/docx/export/lib/internal/list.js +0 -43
  553. package/dist/docx/export/lib/internal/math.js +0 -187
  554. package/dist/docx/export/lib/internal/namespaces.js +0 -40
  555. package/dist/docx/export/lib/internal/render-document-file.js +0 -403
  556. package/dist/docx/export/lib/internal/schemas/content-types.js +0 -25
  557. package/dist/docx/export/lib/internal/schemas/core.js +0 -26
  558. package/dist/docx/export/lib/internal/schemas/document-rels.js +0 -15
  559. package/dist/docx/export/lib/internal/schemas/document.template.js +0 -36
  560. package/dist/docx/export/lib/internal/schemas/font-table.js +0 -55
  561. package/dist/docx/export/lib/internal/schemas/generic-rels.js +0 -9
  562. package/dist/docx/export/lib/internal/schemas/numbering.js +0 -18
  563. package/dist/docx/export/lib/internal/schemas/rels.js +0 -12
  564. package/dist/docx/export/lib/internal/schemas/settings.js +0 -17
  565. package/dist/docx/export/lib/internal/schemas/styles.js +0 -142
  566. package/dist/docx/export/lib/internal/schemas/theme.js +0 -198
  567. package/dist/docx/export/lib/internal/schemas/web-settings.js +0 -10
  568. package/dist/docx/export/lib/internal/unit-conversion.js +0 -24
  569. package/dist/docx/export/lib/internal/vnode.js +0 -4
  570. package/dist/docx/export/lib/internal/word-styles.js +0 -123
  571. package/dist/docx/export/lib/internal/xml-builder.js +0 -1803
  572. package/dist/docx/export/lib/reviewPart.js +0 -234
  573. package/dist/docx/import/lib/wordFormatting.js +0 -608
  574. package/dist/features/combobox/index.d.ts +0 -3
  575. package/dist/features/combobox/index.js +0 -2
  576. package/dist/features/combobox/lib/combobox.internal.js +0 -111
  577. package/dist/features/combobox/lib/filterWords.js +0 -23
  578. package/dist/features/ink/lib/inkGone.internal.js +0 -290
  579. package/dist/features/layout/index.d.ts +0 -2
  580. package/dist/features/layout/lib/BaseColumnPlugin.js +0 -249
  581. package/dist/features/suggestion/BaseSuggestionPlugin.js +0 -31
  582. package/dist/features/suggestion/index.d.ts +0 -10
  583. package/dist/features/suggestion/index.js +0 -3
  584. package/dist/features/upload/lib/mimeTypes.internal.js +0 -3982
  585. package/dist/index-BWCC4DCP.d.ts +0 -156
  586. package/dist/index-CJGkjkH6.d.ts +0 -8
  587. package/dist/index-CS4G_W_R.d.ts +0 -184
  588. package/dist/index-CVAHIQ3p.d.ts +0 -29
  589. package/dist/index-OMa7dlcS.d.ts +0 -161
  590. package/dist/lib/plugins/element-state/ElementStatePlugin.js +0 -14
  591. package/dist/lib/utils/hotkeys.js +0 -113
  592. package/dist/markdown/lib/RawHtmlPlugin.js +0 -26
  593. package/dist/markdown/lib/internal/markdownConversion.js +0 -1358
  594. package/dist/markdown/lib/internal/markdownOpenTail.js +0 -381
  595. package/dist/markdown/lib/internal/markdownRawHtml.js +0 -353
  596. package/dist/markdown/lib/internal/markdownSegments.js +0 -143
  597. package/dist/migrations/migrateListIdentity.js +0 -93
  598. package/dist/pagination/react/PagedEditorContent.js +0 -77
  599. package/dist/react/features/ink/InkCopyView.js +0 -214
  600. package/dist/react/features/suggestion/SuggestionPlugin.js +0 -24
  601. package/dist/react/features/suggestion/index.d.ts +0 -45
  602. package/dist/react/features/suggestion/index.js +0 -3
  603. package/dist/react/features/suggestion/suggestion-view.internal.js +0 -114
  604. package/dist/react/features/suggestion/useSuggestion.js +0 -138
  605. package/dist/static/internal/renderStaticHtmlWithOverrides.js +0 -33
  606. package/dist/utils/plugins/ExitBreakPlugin.js +0 -26
  607. package/dist/yjs/index.d.ts +0 -2
  608. package/dist/yjs/index.js +0 -1
  609. package/dist/yjs/react/YjsPlugin.js +0 -60
  610. package/dist/yjs/react/index.js +0 -3
  611. /package/dist/features/{layout → column}/index.js +0 -0
  612. /package/dist/react/features/{layout → column}/index.js +0 -0
@@ -0,0 +1,771 @@
1
+ import { $a as Plugin, Al as TransferPlugin, Cl as TransferIntent, El as TransferOutcome, Ga as Path, Kc as StateFieldValueInput, Ma as NodeTarget, O as DecorationAttributes, Sl as TransferInput, Wl as Value, Xc as Text, Xi as NamedRootKey, _i as Element$1, _t as EditorDocumentValue, d as AnyEditor, ha as NodeKey, ho as PluginDependencyReferenceFor, ki as HistoryOutcome, ms as RootKey, ni as EditorUpdatePolicy, po as PluginDependencyContractReference, tr as EditorSelectorDependencies, ts as Range, vl as TransferApi, yl as TransferCheck } from "./tx-only-DXWFNuXJ-DuOaZk8U.js";
2
+ import "./htmlTypes-BtbQ2kEr.js";
3
+ import { N as DataTransferDiagnostic, S as DOMEditor, V as ViewportRect, c as DOMApi, d as DOMCoverageCopyPolicy, f as DOMCoverageMaterializeRangeRole, h as DOMCoverageSelectionPolicy, l as DOMClipboardApi, m as DOMCoverageReason, n as DOMPluginTypes, p as DOMCoverageMaterializeReason, r as DropIndicator, t as DOMPlugin, u as DOMCoverageBoundary } from "./index-DlfamnX-.js";
4
+ import { s as Editor$2 } from "./core-N8rIvQxS.js";
5
+ import React$1, { CSSProperties, KeyboardEvent as KeyboardEvent$1, MouseEventHandler, ReactNode, Ref, RefObject, TextareaHTMLAttributes } from "react";
6
+ import "lodash";
7
+ type DecorationSlice = Readonly<{
8
+ attributes: DecorationAttributes;
9
+ end: number;
10
+ key: string;
11
+ start: number;
12
+ }>;
13
+ /** The boxes of one range in viewport coordinates. */
14
+ type RangeRects = Readonly<{
15
+ boundingRect: ViewportRect;
16
+ focusRect: ViewportRect | null;
17
+ rects: readonly ViewportRect[];
18
+ }>;
19
+ /** Immutable DOM geometry for one range in one mounted Editable. */
20
+ type RangeGeometry = RangeRects & Readonly<{
21
+ /**
22
+ * The part of the Editable anyone can see: the viewport cut by every box
23
+ * that clips the Editable, its own box included when its overflow clips.
24
+ * Every range of one Editable shares it in a frame. `null` when none shows.
25
+ */
26
+ clipRect: ViewportRect | null;
27
+ /**
28
+ * The range's boxes cut to `clipRect`, each line outside it dropped. A
29
+ * line that only touches the edge is outside; a caret on the edge is
30
+ * inside. `null` when nothing of the range is inside. Show or hide by it,
31
+ * and draw inside `clipRect`.
32
+ */
33
+ visible: RangeRects | null;
34
+ }>;
35
+ type Editor$1<V extends Value = any> = AnyEditor<V>;
36
+ type InputIntent = 'clipboard' | 'composition' | 'delete' | 'history' | 'insert-break' | 'internal-control' | 'model-selection-move' | 'native-selection-move' | 'viewport-selection' | 'text-insert';
37
+ type SelectionSource = 'app-owned' | 'composition-owned' | 'dom-current' | 'internal-control' | 'model-owned' | 'viewport-backed' | 'unknown';
38
+ type EditableSelectionSourceTransition = {
39
+ preferModelSelection: boolean;
40
+ reason: 'internal-control' | 'model-command' | 'native-selection-move' | 'decoration-refresh' | 'repair-induced' | 'unknown-selection';
41
+ selectionSource: SelectionSource;
42
+ };
43
+ /** Text a mounted Editable committed with typing intent. */
44
+ type TypedText = Readonly<{
45
+ /** The Editable root element whose input produced the text. */
46
+ editable: HTMLElement;
47
+ /** The inserted text in the model, ending at the caret. */
48
+ range: Range;
49
+ text: string;
50
+ }>;
51
+ /** Listener called when a mounted Editable commits typed text. */
52
+ type TypedTextListener = (typed: TypedText) => void;
53
+ /** Options for installing React over one exact DOM plugin descriptor. */
54
+ interface ReactPluginOptions<TDOMPlugin extends DOMPlugin = DOMPlugin> {
55
+ /** DOM plugin owned by this React bridge. */
56
+ dom: TDOMPlugin;
57
+ }
58
+ /** React capability exposed through `editor.api.react`. */
59
+ type ReactApi = {
60
+ isComposing: () => boolean;
61
+ isFocused: () => boolean;
62
+ isReadOnly: () => boolean;
63
+ /**
64
+ * Commit pending native input to the model, including an active Android
65
+ * keyboard draft. Returns false while a non-Android composition is active or
66
+ * when the mounted Editable unmounts during the flush.
67
+ */
68
+ settleInput: () => boolean;
69
+ /**
70
+ * Call `listener` with the text each mounted Editable of this editor types:
71
+ * an `insertText` input or composition commit whose one change is an
72
+ * insertion ending at a collapsed caret. Paste, drop, yank, replacement and
73
+ * data-transfer input, history replay, remote edits and typing over a
74
+ * selection report nothing, and so does a commit whose document an earlier
75
+ * commit listener changes before the report. Android keyboards that paste through
76
+ * `insertText` report the pasted text. Returns the unsubscribe function.
77
+ */
78
+ subscribeTypedText: (listener: TypedTextListener) => () => void;
79
+ };
80
+ declare const createReactPlugin: <const TDOMPlugin extends DOMPlugin>(domPlugin: TDOMPlugin) => Plugin<Readonly<{
81
+ readonly api: ReactApi;
82
+ readonly dependencies: readonly [PluginDependencyReferenceFor<TDOMPlugin>, PluginDependencyContractReference<Readonly<{
83
+ direct: Readonly<Pick<Readonly<{
84
+ readonly name: "transfer";
85
+ readonly read: Readonly<{
86
+ check: (input: TransferInput, options?: Readonly<{
87
+ intent?: TransferIntent;
88
+ }>) => TransferCheck;
89
+ nodes: (options?: Readonly<{
90
+ node?: NodeTarget<Element$1>;
91
+ }>) => readonly NodeKey[];
92
+ }>;
93
+ readonly api: Readonly<{
94
+ copy: (input: TransferInput) => TransferOutcome;
95
+ move: (input: TransferInput) => TransferOutcome;
96
+ }>;
97
+ }>, "api" | "name" | "read">> & Readonly<Record<never, never>>;
98
+ installed: Readonly<Pick<Readonly<{
99
+ readonly name: "transfer";
100
+ readonly read: Readonly<{
101
+ check: (input: TransferInput, options?: Readonly<{
102
+ intent?: TransferIntent;
103
+ }>) => TransferCheck;
104
+ nodes: (options?: Readonly<{
105
+ node?: NodeTarget<Element$1>;
106
+ }>) => readonly NodeKey[];
107
+ }>;
108
+ readonly api: Readonly<{
109
+ copy: (input: TransferInput) => TransferOutcome;
110
+ move: (input: TransferInput) => TransferOutcome;
111
+ }>;
112
+ }>, "api" | "name" | "read">> & Readonly<Record<never, never>>;
113
+ }>>];
114
+ }> & Readonly<{
115
+ name: "react";
116
+ }>>;
117
+ /** React plugin backed by one exact DOM dependency. */
118
+ type ReactPlugin<TDOMPlugin extends DOMPlugin = DOMPlugin> = ReturnType<typeof createReactPlugin<TDOMPlugin>>;
119
+ /**
120
+ * Installs the DOM bridge and exposes React focus, read-only, and composition
121
+ * APIs through the editor plugin system.
122
+ */
123
+ declare const react: <const TDOMPlugin extends DOMPlugin>({ dom: domPlugin }: ReactPluginOptions<TDOMPlugin>) => ReactPlugin<TDOMPlugin>;
124
+ type ReactDefaultPlugins<TPlugins extends readonly unknown[]> = readonly [...TPlugins, DOMPlugin, TransferPlugin, ReactPlugin];
125
+ type EditorBase<V extends Value, TPlugins extends readonly unknown[]> = AnyEditor<V, ReactDefaultPlugins<TPlugins>>;
126
+ /** AnyEditor type with the React and DOM plugins installed. */
127
+ type Editor<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = Omit<EditorBase<V, TPlugins>, 'api'> & {
128
+ readonly api: EditorBase<V, TPlugins>['api'] & DOMPluginTypes['api'] & {
129
+ react: ReactApi;
130
+ transfer: TransferApi;
131
+ };
132
+ };
133
+ /**
134
+ * A React and DOM-specific version of the `Editor` interface.
135
+ */
136
+ interface ReactRuntimeEditor<V extends Value = Value, TPlugins extends readonly unknown[] = any> extends DOMEditor<V, TPlugins> {
137
+ api: DOMEditor<V, TPlugins>['api'] & {
138
+ dom: DOMApi & {
139
+ clipboard: DOMClipboardApi;
140
+ };
141
+ react: ReactApi;
142
+ };
143
+ }
144
+ type EditableRepairRequest = {
145
+ focus?: boolean;
146
+ forceRender?: boolean;
147
+ kind: 'force-render';
148
+ selectionSourceTransition?: EditableSelectionSourceTransition;
149
+ } | {
150
+ focus?: boolean;
151
+ forceRender?: boolean;
152
+ kind: 'sync-selection';
153
+ selectionSourceTransition?: EditableSelectionSourceTransition;
154
+ syncDOMSelection?: boolean;
155
+ } | {
156
+ focus?: boolean;
157
+ forceRender?: boolean;
158
+ kind: 'repair-caret' | 'repair-caret-after-text-insert';
159
+ selectionSourceTransition?: EditableSelectionSourceTransition;
160
+ } | {
161
+ kind: 'none' | 'skip-dom-sync';
162
+ };
163
+ /** An exact replacement in the observed text's UTF-16 before coordinates. */
164
+ type ExternalTextChange = Readonly<{
165
+ from: number;
166
+ insert: string;
167
+ to: number;
168
+ }>;
169
+ /** Directed UTF-16 offsets within one canonical Text. */
170
+ type ExternalTextSelection = Readonly<{
171
+ anchor: number;
172
+ focus: number;
173
+ }>;
174
+ /** Only the focused view may install a native selection. */
175
+ type ExternalTextSelectionState = ExternalTextSelection & Readonly<{
176
+ mode: 'model' | 'native';
177
+ }>;
178
+ /** A keyed editor decoration clipped to this Text's offsets. */
179
+ type ExternalTextDecoration = DecorationSlice;
180
+ /** Canonical state delivered to one mounted external text view. */
181
+ type ExternalTextState<TConfig = undefined> = Readonly<{
182
+ config: TConfig;
183
+ decorations: readonly ExternalTextDecoration[];
184
+ readOnly: boolean;
185
+ selection: ExternalTextSelectionState | null;
186
+ /** The canonical string reference; retain it without diffing whole strings. */
187
+ text: string;
188
+ /** Echo this observed version in actions; unrelated commits need no update. */
189
+ version: number;
190
+ }>;
191
+ /** The only mutation bridge from an external view to its owning editor runtime.
192
+ * Invoke actions from input and command handlers, never from adapter lifecycle
193
+ * callbacks or `offsetAt`. When the runtime rejects a mutating action, a stale
194
+ * action, or a read-only `composition('start')` outside those non-reentrant
195
+ * callbacks, it synchronously delivers a canonical reset
196
+ * (`update({ changes: null, state })`) before returning.
197
+ */
198
+ type ExternalTextActions = Readonly<{
199
+ composition: (phase: 'end' | 'start') => void;
200
+ deleteOut: (input: {
201
+ baseVersion: number;
202
+ direction: 'backward' | 'forward';
203
+ }) => void;
204
+ dispatch: (input: {
205
+ baseVersion: number;
206
+ changes: readonly ExternalTextChange[];
207
+ intent: 'composition' | 'cut' | 'drop' | 'input' | 'paste';
208
+ selection: ExternalTextSelection;
209
+ }) => void;
210
+ /** Delegate to installed editor history; adapters must disable local history. */
211
+ history: (direction: 'redo' | 'undo') => boolean;
212
+ navigateOut: (input: {
213
+ baseVersion: number;
214
+ direction: 'backward' | 'forward';
215
+ extend?: boolean;
216
+ /** The caret's goal client x for an ArrowUp or ArrowDown exit; omit it for other keys. */
217
+ x?: number;
218
+ }) => void;
219
+ select: (input: {
220
+ baseVersion: number;
221
+ selection: ExternalTextSelection;
222
+ }) => void;
223
+ /**
224
+ * Offer a keydown the view declined to the EditorContent's `onKeyDown`. Pass
225
+ * the DOM event from its own listener, after every local handler passed on
226
+ * it. The editor drops the key when something prevents its default or stops
227
+ * its propagation before the editor root, and refuses keys a text input
228
+ * uses natively, such as composing and modifier keys, typing, Enter without
229
+ * Ctrl or Meta, Tab, navigation keys, deletion, select-all, clipboard, undo
230
+ * and redo keys, and on Apple hosts Control with a letter, the quote key or
231
+ * Enter. It also refuses every key while the editor or the element is
232
+ * read-only, during an authored preview, or while any part of the selection
233
+ * is outside this view's Text. When the view held focus as the key arrived,
234
+ * focus follows the selection once React commits the handler's change. It
235
+ * stays put when the handler unmounted the EditorContent, when the handler
236
+ * moved focus out of the view or blurred it before returning while the view
237
+ * stayed mounted, or when focus sits outside the view, other than on the
238
+ * page body, once React has committed. When the view did not hold focus,
239
+ * focus stays where it was.
240
+ */
241
+ yieldKey: (event: KeyboardEvent) => void;
242
+ }>;
243
+ /** Adapter-owned DOM and local resources for one mounted host. */
244
+ type ExternalTextView<TConfig = undefined> = Readonly<{
245
+ destroy: () => void;
246
+ /** Install the delivered `state.selection`, then focus the local input. */
247
+ focus: () => void;
248
+ /**
249
+ * The offset nearest client `x` on the view's first (`'start'`) or last
250
+ * (`'end'`) visual line, in the delivered `state.text`; `null` when the view
251
+ * cannot tell. The owning editor asks before a vertical arrow enters the
252
+ * view and writes the selection itself. Read layout only: never dispatch an
253
+ * action, change the view's text or selection, focus, scroll, or run work
254
+ * the view deferred, such as a pending layout pass. Actions called during
255
+ * the query are refused. Omitted, the caret enters at the first or last
256
+ * offset.
257
+ */
258
+ offsetAt?: (input: {
259
+ edge: 'end' | 'start';
260
+ x: number;
261
+ }) => number | null;
262
+ /**
263
+ * Reveal `selection` inside any view-owned scroll container without scrolling
264
+ * outer document ancestors, and return the revealed range's viewport
265
+ * `DOMRect` (or `null`/`void` to fall back to the host box). The owning
266
+ * editor performs outer scrolling from that rect so outer `scrollMargin` and
267
+ * `scrollMode` stay authoritative.
268
+ */
269
+ scrollIntoView?: (selection: ExternalTextSelection) => DOMRect | null | void;
270
+ /** Apply patches and canonical state before returning without dispatching an action. */
271
+ update: (input: {
272
+ /** `null` resets from state.text; a list applies exact patches; [] acknowledges. */
273
+ changes: readonly ExternalTextChange[] | null;
274
+ state: ExternalTextState<TConfig>;
275
+ }) => void;
276
+ }>;
277
+ /** Render one exact-one-Text block without a second model or history owner.
278
+ * Lifecycle callbacks are synchronous notifications and must not mutate the
279
+ * owning editor or reenter the mounted view.
280
+ */
281
+ type ExternalTextAdapter<TConfig = undefined> = Readonly<{
282
+ mount: (context: {
283
+ actions: ExternalTextActions;
284
+ host: HTMLElement;
285
+ state: ExternalTextState<TConfig>;
286
+ }) => ExternalTextView<TConfig>;
287
+ }>;
288
+ /** Mount options inferred from the adapter; changing config does not remount it. */
289
+ type ExternalTextOptions<TConfig = undefined> = Readonly<{
290
+ adapter: ExternalTextAdapter<TConfig>;
291
+ ariaLabel: string;
292
+ /** Wrap native children when the block cannot mount an external view, such as in Suggesting mode, with pending authored changes, with multiple text leaves, or in static rendering. */
293
+ fallback?: (children: ReactNode) => ReactNode;
294
+ }> & (undefined extends TConfig ? Readonly<{
295
+ config?: TConfig;
296
+ }> : Readonly<{
297
+ config: TConfig;
298
+ }>);
299
+ type EditorHistoryFocusPolicy$1 = 'none' | 'preserve' | 'restore-root';
300
+ type NodeSelectionFocus = RefObject<HTMLElement | null>;
301
+ type EditableHistoryReplayResult = HistoryOutcome | Readonly<{
302
+ reason: 'composing' | 'not-installed' | 'unmounted';
303
+ status: 'unavailable';
304
+ }> | Readonly<{
305
+ /** No shown `Editable` of the presentation can edit `root`. */
306
+ reason: 'hidden' | 'read-only';
307
+ /** The root the replay would change, `undefined` for the primary document. */
308
+ root: RootKey | undefined;
309
+ status: 'unavailable';
310
+ }>;
311
+ type EditableHistoryReplayEvent = Readonly<{
312
+ direction: 'redo' | 'undo';
313
+ result: EditableHistoryReplayResult;
314
+ }>;
315
+ /** Hears the final range of a mouse selection made in an Editable's own text. */
316
+ type EditablePointerSelectionEndHandler = (selection: Range, context: EditableHandlerContext) => void;
317
+ /** Outcome of one paste that an editable's built-in insertion handled. */
318
+ type EditablePasteResult = Readonly<{
319
+ /**
320
+ * Reports from the format that inserted or claimed the payload, plus loss
321
+ * from payloads that could not be used. `impact: 'lossy'` means pasted
322
+ * content was left out.
323
+ */
324
+ diagnostics: readonly DataTransferDiagnostic[];
325
+ /** Whether the paste committed content. */
326
+ inserted: boolean;
327
+ }>;
328
+ /** What one drop the Editable settled did. */
329
+ type EditableDropResult = Readonly<{
330
+ kind: 'data';
331
+ /** Format reports for external data inserted on the paste path. */
332
+ diagnostics: readonly DataTransferDiagnostic[];
333
+ inserted: boolean;
334
+ }> | Readonly<{
335
+ kind: 'transfer';
336
+ outcome: TransferOutcome;
337
+ }>;
338
+ type EditableHandlerResult = boolean | EditableRepairRequest | void;
339
+ /**
340
+ * What an editable passes each DOM handler after its event. `editor` is the
341
+ * view whose editable runs the handler, such as a content root's.
342
+ */
343
+ type EditableHandlerContext = {
344
+ editor: ReactRuntimeEditor;
345
+ };
346
+ type EditableInputEventContext = EditableHandlerContext & {
347
+ data: unknown;
348
+ event?: InputEvent | React$1.KeyboardEvent<HTMLDivElement>;
349
+ inputType?: string;
350
+ intent: InputIntent | null;
351
+ native: boolean;
352
+ selection: Range | null;
353
+ };
354
+ type EditableDOMBeforeInputContext = EditableInputEventContext & {
355
+ event: InputEvent;
356
+ inputType: string;
357
+ };
358
+ type EditableDOMBeforeInputHandler = (event: InputEvent, context: EditableDOMBeforeInputContext) => EditableHandlerResult;
359
+ type EditableKeyDownHandler = (event: React$1.KeyboardEvent<HTMLDivElement>, context: EditableHandlerContext) => EditableHandlerResult;
360
+ /**
361
+ * Expose the browser test handle that `@platejs/test` reads on every
362
+ * `Editable` root mounted afterwards, and keep the kernel trace it reads.
363
+ *
364
+ * Call once at module scope in a test or development entry, before the first
365
+ * editor mounts. Production entries never call it, so their bundles drop the
366
+ * handle. Calling it again changes nothing.
367
+ */
368
+ declare const installBrowserHandle: () => void;
369
+ type DOMTextSyncOptOutReason = 'empty-text' | 'decoration' | 'custom-leaf' | 'custom-text';
370
+ type RenderLeafProps = {
371
+ attributes: {
372
+ 'data-editor-leaf': true;
373
+ 'data-editor-leaf-end'?: number;
374
+ 'data-editor-leaf-start'?: number;
375
+ };
376
+ children: ReactNode;
377
+ leaf: Omit<Text, 'text'>;
378
+ leafPosition?: {
379
+ end: number;
380
+ isFirst?: true;
381
+ isLast?: true;
382
+ start: number;
383
+ };
384
+ path?: Path;
385
+ text: Omit<Text, 'text'>;
386
+ };
387
+ /** Props of a `renderText` call for a text node. */
388
+ type RenderTextProps = {
389
+ attributes: {
390
+ 'data-editor-dom-sync'?: true;
391
+ 'data-editor-node': 'text';
392
+ 'data-editor-dom-sync-reason'?: DOMTextSyncOptOutReason;
393
+ 'data-editor-path'?: string;
394
+ 'data-editor-node-key'?: string;
395
+ ref?: Ref<HTMLSpanElement>;
396
+ };
397
+ children: ReactNode;
398
+ text: Text;
399
+ };
400
+ type RenderPlaceholderProps = {
401
+ attributes: {
402
+ 'aria-hidden': true;
403
+ 'data-editor-placeholder': true;
404
+ contentEditable: false;
405
+ dir?: 'rtl';
406
+ ref: React$1.RefCallback<HTMLElement>;
407
+ style: CSSProperties;
408
+ };
409
+ children: ReactNode;
410
+ };
411
+ type DOMCoverageBoundaryMaterializePayload = {
412
+ boundary: DOMCoverageBoundary;
413
+ range?: Range;
414
+ rangeRole?: DOMCoverageMaterializeRangeRole;
415
+ reason: DOMCoverageMaterializeReason;
416
+ };
417
+ type EditableDOMCoverageBoundaryScope = {
418
+ from: number;
419
+ to?: number;
420
+ type: 'children';
421
+ } | {
422
+ type: 'self';
423
+ };
424
+ type EditableDOMCoverageBoundaryPlaceholderContext = {
425
+ materialize: () => void;
426
+ };
427
+ type EditableDOMCoverageBoundaryMaterializePayload = DOMCoverageBoundaryMaterializePayload;
428
+ type EditableDOMCoverageBoundaryProps = {
429
+ boundaryId?: string;
430
+ children?: ReactNode;
431
+ copyPolicy?: DOMCoverageCopyPolicy;
432
+ mounted?: boolean;
433
+ onMaterialize?: (payload: DOMCoverageBoundaryMaterializePayload) => void;
434
+ reason?: DOMCoverageReason;
435
+ renderPlaceholder?: (context: EditableDOMCoverageBoundaryPlaceholderContext) => ReactNode;
436
+ scope: EditableDOMCoverageBoundaryScope;
437
+ selectionPolicy?: DOMCoverageSelectionPolicy;
438
+ };
439
+ type EditableContentRootViewport = {
440
+ /**
441
+ * The root's top-level blocks in view, such as the shapes a camera shows.
442
+ * The slot also mounts the blocks the selection's ends are in, and hides
443
+ * each run of the others behind a boundary whose copy reads the model.
444
+ */
445
+ mountedKeys: ReadonlySet<NodeKey>;
446
+ /**
447
+ * Brings `path` into view, such as when the selection moves into a block
448
+ * outside `mountedKeys`. `editor.api.dom.scrollIntoView` calls it with
449
+ * `align` `'auto'` for a mounted path, point or range in this root, and
450
+ * `'auto'` leaves a block already in view where it is. It adds the block at
451
+ * `path[0]` to `mountedKeys` before or on the next render, and returns false
452
+ * when it cannot.
453
+ */
454
+ reveal: (path: Path, align?: 'auto' | 'center' | 'end' | 'start') => boolean;
455
+ };
456
+ type EditableContentRootSlotOptions = {
457
+ ariaLabel?: string;
458
+ /** Focus the content root's editable surface when it mounts. */
459
+ autoFocus?: boolean;
460
+ className?: string;
461
+ disableDefaultStyles?: boolean;
462
+ id?: string;
463
+ /**
464
+ * The element that takes focus in place of this root's editable when the
465
+ * editor moves focus here, as after an undo, on a click that selects an
466
+ * object or on a call to `editor.api.dom.focus()`. It takes focus only while
467
+ * no range is shown into this root and the root's own selection is none or
468
+ * a node selection of its top-level blocks, including a node selection the
469
+ * root kept while the caret was in another root. Once the element holds
470
+ * focus, that kept node selection becomes the selection again, so a key the
471
+ * element handles acts on it. It does not come back when the element's focus
472
+ * handler leaves focus on another element, asks for focus elsewhere or
473
+ * changes the selection. A focus call made inside an update or a read focuses
474
+ * the editable instead, as on a root without this element. When the render
475
+ * that follows a focus call replaces the element, focus falls to the page.
476
+ * Give the element `contentEditable={false}`: one that inherits editing runs
477
+ * the editable's own focus handler, which in Firefox moves focus to the
478
+ * editable. Unless the element is a control, such as a button, the editor
479
+ * reads no keys from it, so it must handle the keys it needs, such as undo
480
+ * and redo.
481
+ */
482
+ nodeSelectionFocus?: NodeSelectionFocus;
483
+ placeholder?: ReactNode;
484
+ readOnly?: boolean;
485
+ spellCheck?: TextareaHTMLAttributes<HTMLDivElement>['spellCheck'];
486
+ style?: CSSProperties;
487
+ tabIndex?: number;
488
+ /** Mount only some of the root's top-level blocks, such as a board's shapes in view. */
489
+ viewport?: EditableContentRootViewport;
490
+ };
491
+ /**
492
+ * Render slots passed to custom element renderers for child projection,
493
+ * external text views, DOM coverage boundaries, and schema-owned content roots.
494
+ */
495
+ type EditableElementSlots = {
496
+ children: (range?: {
497
+ from?: number;
498
+ to?: number;
499
+ }) => ReactNode;
500
+ /** Delegate one exact-one-Text block to an adapter while the editor owns its value. */
501
+ externalText: <TConfig = undefined>(options: ExternalTextOptions<TConfig>) => ReactNode;
502
+ /**
503
+ * Renders model-present content whose editable DOM may be intentionally
504
+ * absent, such as closed accordion bodies or inactive tab panels.
505
+ */
506
+ contentBoundary: (props: EditableDOMCoverageBoundaryProps) => ReactNode;
507
+ /** Render a schema-owned child content root declared on the element's `contentRoots`. */
508
+ contentRoot: (slot: string, options?: EditableContentRootSlotOptions) => ReactNode;
509
+ };
510
+ type RenderElementProps<TElement extends Element$1 = Element$1> = TElement extends Element$1 ? {
511
+ attributes: {
512
+ 'data-editor-inline'?: true;
513
+ 'data-editor-node': 'element';
514
+ 'data-editor-path': string;
515
+ 'data-editor-node-key': string;
516
+ 'data-editor-void'?: true;
517
+ /** The direction of a text block's first letter, absent when none decides. */
518
+ dir?: 'ltr' | 'rtl';
519
+ /**
520
+ * Binds and places the element. It changes when the node or its page
521
+ * placement changes, so a ref merge must change with it and pass a
522
+ * detach on as a call with `null`.
523
+ */
524
+ ref: React$1.RefCallback<HTMLElement>;
525
+ };
526
+ children: ReactNode;
527
+ element: TElement;
528
+ isInline: boolean;
529
+ slots: EditableElementSlots;
530
+ } : never;
531
+ type RenderElementRenderer<TElement extends Element$1 = Element$1> = (props: RenderElementProps<TElement>) => ReactNode;
532
+ /**
533
+ * Props passed to `renderVoid` for rendering a void element's visible content
534
+ * inside the runtime-managed void shell.
535
+ */
536
+ type RenderVoidProps<TElement extends Element$1 = Element$1> = {
537
+ /** The rendered void element node. */
538
+ element: TElement;
539
+ /** Element render slots available to void renderers (`slots.contentRoot` for schema-owned child roots). */
540
+ slots: {
541
+ contentRoot: EditableElementSlots['contentRoot'];
542
+ };
543
+ };
544
+ type RenderVoidRenderer<TElement extends Element$1 = Element$1> = (props: RenderVoidProps<TElement>) => ReactNode;
545
+ type EditableDOMHandlers<TAttributes> = { [K in keyof TAttributes]: K extends `on${string}` ? NonNullable<TAttributes[K]> extends ((event: infer E) => void) ? (event: E, context: EditableHandlerContext) => void : TAttributes[K] : TAttributes[K]; };
546
+ /**
547
+ * Each DOM handler gets an `EditableHandlerContext` after its event, whose
548
+ * `editor` is the view whose editable runs it. An editable skips an event
549
+ * inside a content root's editable, which runs the same handlers on the
550
+ * content root's view.
551
+ */
552
+ type EditorContentProps<TElement extends Element$1 = Element$1, TRoot extends RootKey = RootKey> = {
553
+ autoFocus?: boolean;
554
+ className?: string;
555
+ disableDefaultStyles?: boolean;
556
+ id?: string;
557
+ ignoreBlankEditableRootClicks?: boolean;
558
+ onDOMBeforeInput?: EditableDOMBeforeInputHandler;
559
+ onHistoryReplay?: (event: EditableHistoryReplayEvent) => void;
560
+ onKeyDown?: EditableKeyDownHandler;
561
+ /**
562
+ * Called once for each paste this editable handles through its built-in
563
+ * formats: after the paste commits (`inserted: true`), or when no format
564
+ * can insert it or a format claims it with an empty slice
565
+ * (`inserted: false`). A diagnostic with `impact: 'lossy'` means pasted
566
+ * content was left out.
567
+ *
568
+ * Not called when `onPaste` or a plugin command handles the paste without
569
+ * the built-in formats, or when this editable unmounts before the paste
570
+ * settles. An `onPaste` handler that inserts through
571
+ * `editor.api.dom.clipboard.insertData` during the paste gets that
572
+ * insertion's result.
573
+ */
574
+ onPasteResult?: (result: EditablePasteResult) => void;
575
+ /**
576
+ * Called once after a primary mouse press that began on this editable's own
577
+ * text has its final text range: after the mouseup's import and every later
578
+ * write of that press, such as a drag released outside the editable or a
579
+ * click inside selected text that collapses it. Not called for a press on a
580
+ * control, an external text host or a nested editor, for touch or pen, when
581
+ * the press ends in a node selection, or when a key other than a modifier,
582
+ * a composition, a native drag, a blur, another press or an unmount comes
583
+ * first.
584
+ */
585
+ onPointerSelectionEnd?: EditablePointerSelectionEndHandler;
586
+ /** Reports a drop this Editable lands: the transfer outcome, or the data it inserted. */
587
+ onDropResult?: (result: EditableDropResult) => void;
588
+ placeholder?: ReactNode;
589
+ readOnly?: boolean;
590
+ ref?: React$1.Ref<HTMLDivElement>;
591
+ renderElement?: RenderElementRenderer<TElement>;
592
+ renderLeaf?: (props: RenderLeafProps) => ReactNode;
593
+ renderPlaceholder?: (props: RenderPlaceholderProps) => ReactNode;
594
+ renderText?: (props: RenderTextProps) => ReactNode;
595
+ renderVoid?: RenderVoidRenderer<TElement>;
596
+ root?: NamedRootKey<TRoot>;
597
+ scrollSelectionIntoView?: (editor: Editor$1, domRange: globalThis.Range) => void;
598
+ spellCheck?: TextareaHTMLAttributes<HTMLDivElement>['spellCheck'];
599
+ style?: CSSProperties;
600
+ } & EditableDOMHandlers<Omit<TextareaHTMLAttributes<HTMLDivElement>, 'autoFocus' | 'children' | 'className' | 'id' | 'onKeyDown' | 'placeholder' | 'readOnly' | 'spellCheck' | 'style'>>;
601
+ type DOMScopeEditor = {
602
+ api: {
603
+ dom: Pick<DOMApi, 'editable' | 'root' | 'scroll'>;
604
+ };
605
+ };
606
+ /** Return the mounted editable element for an editor root. */
607
+ declare const useEditorEditableElement: <const TRoot extends RootKey = RootKey>(editor: DOMScopeEditor, root?: NamedRootKey<TRoot>) => HTMLElement | null;
608
+ /** Return the mounted editor root element. */
609
+ declare const useEditorRootElement: (editor: DOMScopeEditor) => HTMLElement | null;
610
+ /** Return the editor scroll container element. */
611
+ declare const useEditorScrollElement: (editor: DOMScopeEditor) => HTMLElement | null;
612
+ /**
613
+ * Register the element that scrolls the editor, such as a page's scrolling
614
+ * `main`. Every editor of the document returns it from
615
+ * `editor.api.dom.scroll()`, and virtualized editables follow its scroll. A
616
+ * `fallback` registration applies only while no other element is registered.
617
+ */
618
+ declare const useEditorScrollElementRef: (editor: DOMScopeEditor, { fallback }?: {
619
+ fallback?: boolean;
620
+ }) => (element: HTMLElement | null) => void;
621
+ /** Commit and view-state subscription options for `useEditorSelector`. */
622
+ type UseEditorSelectorOptions<T = unknown> = {
623
+ dependsOn?: EditorSelectorDependencies;
624
+ equalityFn?: (a: T, b: T) => boolean;
625
+ };
626
+ /** Standalone editing areas mounted in a view's presentation. */
627
+ type EditorRootAreas<TEditor extends AnyEditor = AnyEditor> = Readonly<{
628
+ /** Whether this view is the active shown standalone editing area for its root in this presentation. */
629
+ isPrimaryForRoot: boolean;
630
+ /** Return the mounted view of a nested content root inside this editing area, if one is mounted. */
631
+ nestedView: (root: NamedRootKey) => TEditor | null;
632
+ /** Named roots that currently have their own shown standalone editing area in this presentation. */
633
+ standaloneRoots: readonly NamedRootKey[];
634
+ }>;
635
+ /**
636
+ * Subscribe to the standalone editing areas mounted in this view's
637
+ * presentation, and whether this view is the active standalone area for its
638
+ * root.
639
+ */
640
+ declare function useEditorRootAreas<TEditor extends AnyEditor = AnyEditor>(editor: TEditor): EditorRootAreas<TEditor>;
641
+ /**
642
+ * Selection match mode for `useElementSelected`:
643
+ *
644
+ * - `intersects`: any selection reaches the element.
645
+ * - `collapsed`: a collapsed selection reaches the element.
646
+ * - `text`: a text selection reaches the element; any node selection is false.
647
+ * - `node`: a node selection holds the element.
648
+ * - `object`: an object node selection holds the element itself.
649
+ */
650
+ type UseElementSelectedMode = 'collapsed' | 'intersects' | 'node' | 'object' | 'text';
651
+ /** Options for selecting the context element or an explicit element path. */
652
+ type UseElementSelectedOptions = {
653
+ at?: NodeKey | Path | null;
654
+ mode?: UseElementSelectedMode;
655
+ };
656
+ /**
657
+ * Subscribe to whether an element path matches the current view's selection,
658
+ * including retained content in a mounted markup view.
659
+ */
660
+ declare const useElementSelected: ({ at, mode }?: UseElementSelectedOptions) => boolean;
661
+ /**
662
+ * Resolve a stable same-runtime root key owned by an element.
663
+ *
664
+ * Prefer storing `childRoots[slot]` on the element when the child root is part
665
+ * of persisted document data. The node-key fallback is useful for ephemeral
666
+ * island roots, but it is intentionally not a persistence contract.
667
+ */
668
+ declare function useChildRoot(element?: Element$1 | null, slot?: string): NamedRootKey;
669
+ /**
670
+ * This view's block drop indicator while a block drag hovers an admitted
671
+ * edge: the target key, edge, axis and the viewport line to paint.
672
+ */
673
+ declare const useDropIndicator: () => DropIndicator | null;
674
+ /** Identifies the exact mounted Editable whose visible part cuts the boxes. */
675
+ type UseEditableClipOptions = Readonly<{
676
+ editableRef: RefObject<HTMLElement | null>;
677
+ }>;
678
+ type EditableClip = (rects: Iterable<Pick<ViewportRect, 'bottom' | 'left' | 'right' | 'top'>>) => readonly ViewportRect[];
679
+ /**
680
+ * Cuts viewport boxes to `RangeGeometry.clipRect` of one Editable, with the
681
+ * edge rule of `RangeGeometry.visible`. Returns [] when no part shows or no
682
+ * Editable is mounted. It reads layout, so call it where you measure. The
683
+ * returned function is stable.
684
+ */
685
+ declare function useEditableClip({ editableRef }: UseEditableClipOptions): EditableClip;
686
+ type HistoryDirection = 'redo' | 'undo';
687
+ /** Focus behavior after mounted undo or redo applies a history batch. */
688
+ type EditorHistoryFocusPolicy = EditorHistoryFocusPolicy$1;
689
+ /** Options for history commands and shortcut handling. */
690
+ type UseEditorHistoryOptions<TRoot extends RootKey = RootKey> = {
691
+ focusPolicy?: EditorHistoryFocusPolicy;
692
+ } & ({
693
+ /** Bind commands and focus to this existing view, including outside an editor root. */
694
+ editor: Editor<any, any>;
695
+ root?: never;
696
+ } | {
697
+ editor?: undefined;
698
+ root?: NamedRootKey<TRoot>;
699
+ });
700
+ /** Undo/redo availability and command handlers for the document's history. */
701
+ type EditorHistoryController = {
702
+ canRedo: boolean;
703
+ canUndo: boolean;
704
+ onKeyDown: (event: KeyboardEvent$1) => void;
705
+ pending: HistoryDirection | null;
706
+ redo: () => void;
707
+ undo: () => void;
708
+ };
709
+ /** Options for mouse interaction on root-level chrome outside editable text. */
710
+ type UseRootChromeOptions = {
711
+ disabled?: boolean;
712
+ selection?: 'end' | 'restore';
713
+ };
714
+ /** Props and root metadata for root-level mouse interaction chrome. */
715
+ type RootChromeController = {
716
+ props: {
717
+ 'data-editor-root-chrome'?: NamedRootKey;
718
+ onMouseDownCapture: MouseEventHandler<HTMLElement>;
719
+ onMouseMoveCapture: MouseEventHandler<HTMLElement>;
720
+ onMouseUpCapture: MouseEventHandler<HTMLElement>;
721
+ };
722
+ root: NamedRootKey | undefined;
723
+ };
724
+ /**
725
+ * Create props for root-level mouse interaction outside editable content.
726
+ *
727
+ * Each mounted `Editable` of the root is a copy of it. A press acts on the copy
728
+ * that the chrome surrounds, even while another copy of that root was used
729
+ * last. A press on a control or widget inside the chrome, such as a button,
730
+ * acts on no copy. When one chrome holds several copies, a press outside them
731
+ * acts on the copy used last, or else the first. Chrome of the primary
732
+ * document inside another chrome of it acts as part of the outer one. A press
733
+ * that an `Editable` of another root around the chrome handles first never
734
+ * reaches the chrome.
735
+ */
736
+ declare function useRootChrome<const TRoot extends RootKey = RootKey>(root?: NamedRootKey<TRoot>, { disabled, selection }?: UseRootChromeOptions): RootChromeController;
737
+ /** Options for creating a root-specific command editor. */
738
+ type UseRootEditorOptions = {
739
+ readOnly?: boolean;
740
+ };
741
+ /** Identifies the exact mounted Editable used to resolve selection geometry. */
742
+ type UseSelectionGeometryOptions = Readonly<{
743
+ editableRef: RefObject<HTMLElement | null>;
744
+ }>;
745
+ /** Read geometry for the current selection in one exact Editable. */
746
+ declare function useSelectionGeometry({ editableRef }: UseSelectionGeometryOptions): RangeGeometry | null;
747
+ /** Selector options for subscribing to one editor state field. */
748
+ type UseStateFieldValueOptions<TValue = unknown> = Pick<UseEditorSelectorOptions<TValue>, 'equalityFn'>;
749
+ /** Setter returned by `useSetStateField` for one editor state field. */
750
+ type StateFieldSetter<TValue> = (value: StateFieldValueInput<TValue>, policy?: EditorUpdatePolicy) => void;
751
+ /** Selection-effect policies owned by the editor React runtime. */
752
+ declare const ReactUpdatePolicy: Readonly<{
753
+ preserveSelection: Readonly<{
754
+ tags: readonly ["skip-dom-selection", "skip-selection-focus", "skip-scroll-into-view"];
755
+ }>;
756
+ }>;
757
+ type EditorStaticProps<E = Editor$2> = {
758
+ /**
759
+ * A document to render instead of the editor's own, such as a streamed
760
+ * preview. The editor supplies the plugins and is not edited. Pass the same
761
+ * object again to reuse its validated view. Reads, plugin reads and plugin
762
+ * APIs on the rendered editor see the document; an editor captured when a
763
+ * plugin was created still holds its own value.
764
+ */
765
+ document?: EditorDocumentValue;
766
+ /** Editor instance. */
767
+ editor: E;
768
+ style?: React$1.CSSProperties;
769
+ } & React$1.HTMLAttributes<HTMLDivElement>;
770
+ declare function EditorStatic<E = Editor$2>(props: EditorStaticProps<E>): React$1.JSX.Element;
771
+ export { react as $, ReactApi as A, StateFieldSetter as B, ExternalTextChange as C, ExternalTextSelectionState as D, ExternalTextSelection as E, RenderLeafProps as F, UseEditorSelectorOptions as G, TypedTextListener as H, RenderPlaceholderProps as I, UseRootChromeOptions as J, UseElementSelectedMode as K, RenderTextProps as L, ReactPluginOptions as M, ReactUpdatePolicy as N, ExternalTextState as O, RenderElementProps as P, installBrowserHandle as Q, RenderVoidProps as R, ExternalTextAdapter as S, ExternalTextOptions as T, UseEditableClipOptions as U, TypedText as V, UseEditorHistoryOptions as W, UseSelectionGeometryOptions as X, UseRootEditorOptions as Y, UseStateFieldValueOptions as Z, EditorContentProps as _, EditableDOMCoverageBoundaryPlaceholderContext as a, useEditorRootElement as at, EditorRootAreas as b, EditableDropResult as c, useElementSelected as ct, EditableHandlerResult as d, RangeGeometry as dt, useChildRoot as et, EditableHistoryReplayEvent as f, RangeRects as ft, Editor as g, EditablePasteResult as h, EditableDOMCoverageBoundaryMaterializePayload as i, useEditorRootAreas as it, ReactPlugin as j, ExternalTextView as k, EditableElementSlots as l, useRootChrome as lt, EditableInputEventContext as m, EditorStaticProps as n, useEditableClip as nt, EditableDOMCoverageBoundaryProps as o, useEditorScrollElement as ot, EditableHistoryReplayResult as p, UseElementSelectedOptions as q, EditableDOMBeforeInputContext as r, useEditorEditableElement as rt, EditableDOMCoverageBoundaryScope as s, useEditorScrollElementRef as st, EditorStatic as t, useDropIndicator as tt, EditableHandlerContext as u, useSelectionGeometry as ut, EditorHistoryController as v, ExternalTextDecoration as w, ExternalTextActions as x, EditorHistoryFocusPolicy as y, RootChromeController as z };