platejs 54.0.0-beta.0 → 54.0.0-beta.10

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 (781) hide show
  1. package/README.md +2 -2
  2. package/THIRD_PARTY_NOTICES.md +85 -0
  3. package/dist/EditorStatic-4yeXBk1l.d.ts +770 -0
  4. package/dist/_virtual/_rolldown/runtime.js +28 -0
  5. package/dist/_virtual/builtin_esm-external-require-react.js +9 -0
  6. package/dist/ai/index.d.ts +2 -0
  7. package/dist/ai/index.js +5 -0
  8. package/dist/ai/lib/aiDraftSession.js +984 -0
  9. package/dist/ai/lib/aiOutputLanding.internal.js +266 -0
  10. package/dist/ai/lib/aiPolicy.internal.js +403 -0
  11. package/dist/ai/lib/editorAgent.js +2285 -0
  12. package/dist/ai/lib/lockedContext.internal.js +144 -0
  13. package/dist/ai/lib/lockedContext.js +271 -0
  14. package/dist/ai/lib/registerEditorTools.js +236 -0
  15. package/dist/ai/react/AIPlugin.js +246 -0
  16. package/dist/ai/react/CopilotPlugin.js +553 -0
  17. package/dist/ai/react/copilotInline.internal.js +358 -0
  18. package/dist/ai/react/index.d.ts +637 -0
  19. package/dist/ai/react/index.js +4 -0
  20. package/dist/ai/react/useEditorAgent.js +193 -0
  21. package/dist/authored/AuthoredPlugin.js +43 -0
  22. package/dist/authored/index.d.ts +5 -0
  23. package/dist/authored/index.js +4 -0
  24. package/dist/authored/suggestionColorOf.js +15 -0
  25. package/dist/authored-mT5Oeocy-CDtuTn9d.d.ts +601 -0
  26. package/dist/clipboard-format-key-CagX2TDf-DE0xLvUC.d.ts +1 -0
  27. package/dist/code-block/codemirror/createCodeMirrorAdapter.js +673 -0
  28. package/dist/code-block/codemirror/index.d.ts +19 -0
  29. package/dist/code-block/codemirror/index.js +2 -0
  30. package/dist/comment-anchor.internal-D88DNGve.d.ts +28 -0
  31. package/dist/compiler/compileEditor.js +10 -0
  32. package/dist/compiler/index.d.ts +18 -0
  33. package/dist/compiler/index.js +4 -0
  34. package/dist/core-BkabAj0S.d.ts +11057 -0
  35. package/dist/core.js +28 -0
  36. package/dist/diff/index.d.ts +3 -0
  37. package/dist/diff/index.js +1 -0
  38. package/dist/docs/agents/mcp.md +105 -0
  39. package/dist/docs/agents/skills.md +47 -0
  40. package/dist/docs/agents.md +84 -0
  41. package/dist/docs/ai.md +761 -0
  42. package/dist/docs/annotations.md +159 -0
  43. package/dist/docs/api/anchor.md +105 -0
  44. package/dist/docs/api/core/plate-components.md +600 -0
  45. package/dist/docs/api/core/plate-controller.md +81 -0
  46. package/dist/docs/api/core/plate-editor.md +310 -0
  47. package/dist/docs/api/core/plate-plugin.md +833 -0
  48. package/dist/docs/api/core/plate-store.md +107 -0
  49. package/dist/docs/api/core.md +723 -0
  50. package/dist/docs/api/document-change.md +257 -0
  51. package/dist/docs/api/dom.md +438 -0
  52. package/dist/docs/api/editor-api.md +604 -0
  53. package/dist/docs/api/editor-transforms.md +673 -0
  54. package/dist/docs/api/element.md +88 -0
  55. package/dist/docs/api/location.md +51 -0
  56. package/dist/docs/api/node.md +213 -0
  57. package/dist/docs/api/path.md +123 -0
  58. package/dist/docs/api/plate.md +99 -0
  59. package/dist/docs/api/point.md +59 -0
  60. package/dist/docs/api/range.md +105 -0
  61. package/dist/docs/api/react-hooks.md +692 -0
  62. package/dist/docs/api/resizable.md +121 -0
  63. package/dist/docs/api/selection.md +176 -0
  64. package/dist/docs/api/text.md +55 -0
  65. package/dist/docs/api/utils.md +149 -0
  66. package/dist/docs/authored-changes.md +458 -0
  67. package/dist/docs/autoformat.md +178 -0
  68. package/dist/docs/basic-blocks.md +205 -0
  69. package/dist/docs/basic-marks.md +186 -0
  70. package/dist/docs/block-menu.md +68 -0
  71. package/dist/docs/block-placeholder.md +165 -0
  72. package/dist/docs/blockquote.md +164 -0
  73. package/dist/docs/board.md +738 -0
  74. package/dist/docs/bold.md +140 -0
  75. package/dist/docs/browser.md +189 -0
  76. package/dist/docs/callout.md +200 -0
  77. package/dist/docs/clear-formatting.md +169 -0
  78. package/dist/docs/clipboard.md +511 -0
  79. package/dist/docs/code-block.md +579 -0
  80. package/dist/docs/code.md +134 -0
  81. package/dist/docs/column.md +186 -0
  82. package/dist/docs/combobox.md +232 -0
  83. package/dist/docs/comment.md +604 -0
  84. package/dist/docs/controlled.md +278 -0
  85. package/dist/docs/copilot.md +479 -0
  86. package/dist/docs/date.md +209 -0
  87. package/dist/docs/debugging.md +209 -0
  88. package/dist/docs/decorations.md +66 -0
  89. package/dist/docs/details.md +324 -0
  90. package/dist/docs/discussion.md +176 -0
  91. package/dist/docs/dnd.md +355 -0
  92. package/dist/docs/document-meta.md +232 -0
  93. package/dist/docs/document-model.md +396 -0
  94. package/dist/docs/docx.md +490 -0
  95. package/dist/docs/dom-coverage.md +101 -0
  96. package/dist/docs/editing-behavior.md +322 -0
  97. package/dist/docs/editor-methods.md +257 -0
  98. package/dist/docs/editor.md +909 -0
  99. package/dist/docs/emoji.md +223 -0
  100. package/dist/docs/equation.md +295 -0
  101. package/dist/docs/examples/collaboration-example.md +46 -0
  102. package/dist/docs/examples/editable-voids.md +58 -0
  103. package/dist/docs/examples/export.md +90 -0
  104. package/dist/docs/examples/huge-document.md +3 -0
  105. package/dist/docs/examples/hundreds-editors.md +41 -0
  106. package/dist/docs/examples/preview-markdown.md +43 -0
  107. package/dist/docs/examples/version-history.md +55 -0
  108. package/dist/docs/excalidraw.md +200 -0
  109. package/dist/docs/exit-break.md +240 -0
  110. package/dist/docs/external-text.md +158 -0
  111. package/dist/docs/feature-kits.md +147 -0
  112. package/dist/docs/field.md +682 -0
  113. package/dist/docs/find.md +151 -0
  114. package/dist/docs/font.md +188 -0
  115. package/dist/docs/footnote.md +575 -0
  116. package/dist/docs/form.md +441 -0
  117. package/dist/docs/format-painter.md +224 -0
  118. package/dist/docs/heading.md +99 -0
  119. package/dist/docs/highlight.md +135 -0
  120. package/dist/docs/history.md +548 -0
  121. package/dist/docs/horizontal-rule.md +181 -0
  122. package/dist/docs/html.md +415 -0
  123. package/dist/docs/indent.md +233 -0
  124. package/dist/docs/index.md +116 -0
  125. package/dist/docs/ink.md +246 -0
  126. package/dist/docs/installation/manual.md +392 -0
  127. package/dist/docs/installation/next.md +368 -0
  128. package/dist/docs/installation/node.md +152 -0
  129. package/dist/docs/installation/plate-ui.md +316 -0
  130. package/dist/docs/installation/react.md +347 -0
  131. package/dist/docs/installation/rsc.md +138 -0
  132. package/dist/docs/installation.md +93 -0
  133. package/dist/docs/italic.md +128 -0
  134. package/dist/docs/kbd.md +125 -0
  135. package/dist/docs/line-height.md +171 -0
  136. package/dist/docs/link.md +316 -0
  137. package/dist/docs/lint.md +482 -0
  138. package/dist/docs/list.md +317 -0
  139. package/dist/docs/llms.txt +151 -0
  140. package/dist/docs/locations.md +232 -0
  141. package/dist/docs/lock.md +271 -0
  142. package/dist/docs/markdown.md +809 -0
  143. package/dist/docs/media.md +703 -0
  144. package/dist/docs/mention.md +184 -0
  145. package/dist/docs/multi-select.md +105 -0
  146. package/dist/docs/navigation-feedback.md +196 -0
  147. package/dist/docs/pagination.md +181 -0
  148. package/dist/docs/performance.md +105 -0
  149. package/dist/docs/plugin-components.md +236 -0
  150. package/dist/docs/plugin-context.md +391 -0
  151. package/dist/docs/plugin-input-rules.md +993 -0
  152. package/dist/docs/plugin-methods.md +468 -0
  153. package/dist/docs/plugin-rules.md +880 -0
  154. package/dist/docs/plugin-shortcuts.md +443 -0
  155. package/dist/docs/plugin.md +611 -0
  156. package/dist/docs/prompt-editor.md +269 -0
  157. package/dist/docs/releases.md +3 -0
  158. package/dist/docs/roots.md +399 -0
  159. package/dist/docs/rtl.md +64 -0
  160. package/dist/docs/schema.md +159 -0
  161. package/dist/docs/selection.md +239 -0
  162. package/dist/docs/serializing.md +216 -0
  163. package/dist/docs/single-block.md +136 -0
  164. package/dist/docs/slash-command.md +143 -0
  165. package/dist/docs/static.md +458 -0
  166. package/dist/docs/strikethrough.md +131 -0
  167. package/dist/docs/subscript.md +113 -0
  168. package/dist/docs/suggestion.md +345 -0
  169. package/dist/docs/superscript.md +113 -0
  170. package/dist/docs/sync.md +286 -0
  171. package/dist/docs/tabbable.md +238 -0
  172. package/dist/docs/table.md +378 -0
  173. package/dist/docs/text-align.md +161 -0
  174. package/dist/docs/toc.md +295 -0
  175. package/dist/docs/toolbar.md +321 -0
  176. package/dist/docs/trailing-block.md +111 -0
  177. package/dist/docs/transactions.md +300 -0
  178. package/dist/docs/troubleshooting.md +159 -0
  179. package/dist/docs/typescript.md +77 -0
  180. package/dist/docs/underline.md +125 -0
  181. package/dist/docs/unit-testing.md +340 -0
  182. package/dist/docs/upload.md +379 -0
  183. package/dist/docs/virtualized-rendering.md +75 -0
  184. package/dist/docx/export/index.d.ts +225 -0
  185. package/dist/docx/export/index.js +2 -0
  186. package/dist/docx/export/lib/colors.js +307 -0
  187. package/dist/docx/export/lib/compileAst.js +1955 -0
  188. package/dist/docx/export/lib/exportDocx.js +415 -0
  189. package/dist/docx/export/lib/mathOmml.js +233 -0
  190. package/dist/docx/export/lib/ooxmlBuilder.js +1760 -0
  191. package/dist/docx/export/lib/outputSafety.js +196 -0
  192. package/dist/docx/export/lib/reviewProjection.js +135 -0
  193. package/dist/docx/export/lib/sourcePreservation.js +435 -0
  194. package/dist/docx/export/lib/wordStyles.js +399 -0
  195. package/dist/docx/html/cleanWordHtml.internal.js +371 -0
  196. package/dist/docx/import/index.d.ts +44 -0
  197. package/dist/docx/import/index.js +3 -0
  198. package/dist/docx/import/lib/importDocx.js +1637 -0
  199. package/dist/docx/import/lib/opcRelationships.js +77 -0
  200. package/dist/docx/import/lib/readWordDocument.js +990 -0
  201. package/dist/docx/import/lib/wordStyles.js +534 -0
  202. package/dist/docx/internal/abort.js +8 -0
  203. package/dist/docx/internal/diagnostics.js +67 -0
  204. package/dist/docx/internal/docxPackage.js +298 -0
  205. package/dist/docx/internal/domParser.js +4 -0
  206. package/dist/docx/internal/packageParts.js +72 -0
  207. package/dist/docx/internal/readDocxNumbering.js +196 -0
  208. package/dist/docx/internal/reviewPart.js +250 -0
  209. package/dist/docx/internal/source.js +77 -0
  210. package/dist/docx/internal/sourceEligibility.js +406 -0
  211. package/dist/docx/internal/wordMath.js +340 -0
  212. package/dist/docx/internal/wordMathVocabulary.js +110 -0
  213. package/dist/docx/internal/xmlTree.js +262 -0
  214. package/dist/docx/internal/xmlWriter.js +44 -0
  215. package/dist/docx/paste/index.d.ts +28 -0
  216. package/dist/docx/paste/index.js +2 -0
  217. package/dist/docx/paste/lib/WordPastePlugin.js +330 -0
  218. package/dist/dom/index.d.ts +2 -0
  219. package/dist/dom/index.js +2 -0
  220. package/dist/dom/plite-dom.internal.js +2 -0
  221. package/dist/excalidraw/index.d.ts +60 -0
  222. package/dist/excalidraw/index.js +2 -0
  223. package/dist/excalidraw/lib/BaseExcalidrawPlugin.js +27 -0
  224. package/dist/excalidraw/react/ExcalidrawPlugin.js +6 -0
  225. package/dist/excalidraw/react/index.d.ts +104 -0
  226. package/dist/excalidraw/react/index.js +3 -0
  227. package/dist/excalidraw/react/useExcalidrawSync.js +103 -0
  228. package/dist/facade.js +3 -0
  229. package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +215 -0
  230. package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +167 -0
  231. package/dist/features/basic-nodes/lib/BaseMarkPlugins.js +404 -0
  232. package/dist/features/basic-styles/lib/BaseFormattingPlugin.js +394 -0
  233. package/dist/features/basic-styles/lib/BaseStylePlugins.js +258 -0
  234. package/dist/features/board/index.d.ts +2 -0
  235. package/dist/features/board/index.js +10 -0
  236. package/dist/features/board/lib/BaseBoardArrowPlugin.js +126 -0
  237. package/dist/features/board/lib/BaseBoardFramePlugin.js +84 -0
  238. package/dist/features/board/lib/BaseBoardGeoPlugin.js +13 -0
  239. package/dist/features/board/lib/BaseBoardImagePlugin.js +72 -0
  240. package/dist/features/board/lib/BaseBoardNotePlugin.js +12 -0
  241. package/dist/features/board/lib/BaseBoardPlugin.js +765 -0
  242. package/dist/features/board/lib/BaseBoardStrokePlugin.js +83 -0
  243. package/dist/features/board/lib/BaseBoardTextPlugin.js +13 -0
  244. package/dist/features/board/lib/boardArrow.internal.js +193 -0
  245. package/dist/features/board/lib/boardCopy.internal.js +284 -0
  246. package/dist/features/board/lib/boardFrame.internal.js +123 -0
  247. package/dist/features/board/lib/boardGeometry.internal.js +124 -0
  248. package/dist/features/board/lib/boardHeights.internal.js +57 -0
  249. package/dist/features/board/lib/boardHtml.internal.js +114 -0
  250. package/dist/features/board/lib/boardMember.internal.js +143 -0
  251. package/dist/features/board/lib/boardRatio.internal.js +21 -0
  252. package/dist/features/board/lib/boardShape.internal.js +84 -0
  253. package/dist/features/board/lib/boardStroke.internal.js +45 -0
  254. package/dist/features/board/lib/boardStyle.internal.js +130 -0
  255. package/dist/features/board/lib/boardTypes.internal.js +28 -0
  256. package/dist/features/callout/index.d.ts +160 -0
  257. package/dist/features/callout/index.js +2 -0
  258. package/dist/features/callout/lib/BaseCalloutPlugin.js +356 -0
  259. package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +736 -0
  260. package/dist/features/code-block/lib/CodeBlockRules.js +140 -0
  261. package/dist/features/column/index.d.ts +2 -0
  262. package/dist/features/column/index.js +2 -0
  263. package/dist/features/column/lib/BaseColumnPlugin.js +693 -0
  264. package/dist/features/comments/BaseCommentsPlugin.js +1984 -0
  265. package/dist/features/comments/comment-thread-index.internal.js +823 -0
  266. package/dist/features/comments/index.d.ts +3 -0
  267. package/dist/features/comments/index.js +2 -0
  268. package/dist/features/date/index.d.ts +42 -0
  269. package/dist/features/date/index.js +3 -0
  270. package/dist/features/date/lib/BaseDatePlugin.js +158 -0
  271. package/dist/features/date/lib/dateValue.js +17 -0
  272. package/dist/features/date/lib/legacyDateValue.internal.js +39 -0
  273. package/dist/features/details/index.d.ts +364 -0
  274. package/dist/features/details/index.js +2 -0
  275. package/dist/features/details/lib/BaseDetailsPlugin.js +615 -0
  276. package/dist/features/field/index.d.ts +2 -0
  277. package/dist/features/field/index.js +4 -0
  278. package/dist/features/field/lib/BaseFieldPlugin.js +550 -0
  279. package/dist/features/field/lib/applyFieldValues.js +437 -0
  280. package/dist/features/field/lib/fieldRules.internal.js +710 -0
  281. package/dist/features/find/index.d.ts +138 -0
  282. package/dist/features/find/index.js +2 -0
  283. package/dist/features/find/lib/BaseFindPlugin.js +1618 -0
  284. package/dist/features/footnote/index.d.ts +428 -0
  285. package/dist/features/footnote/index.js +2 -0
  286. package/dist/features/footnote/lib/BaseFootnotePlugin.js +733 -0
  287. package/dist/features/footnote/lib/internal/getFootnoteTarget.js +31 -0
  288. package/dist/features/indent/lib/BaseIndentPlugin.js +311 -0
  289. package/dist/features/indent/lib/indentHtml.internal.js +9 -0
  290. package/dist/features/indent/lib/indentLevel.internal.js +9 -0
  291. package/dist/features/ink/index.d.ts +2 -0
  292. package/dist/features/ink/index.js +2 -0
  293. package/dist/features/ink/lib/BaseInkPlugin.js +801 -0
  294. package/dist/features/ink/lib/inkAnchor.internal.js +436 -0
  295. package/dist/features/ink/lib/inkCodec.internal.js +145 -0
  296. package/dist/features/ink/lib/inkMatch.internal.js +443 -0
  297. package/dist/features/ink/lib/inkPlaces.internal.js +232 -0
  298. package/dist/features/ink/lib/inkReflow.internal.js +406 -0
  299. package/dist/features/link/lib/BaseLinkPlugin.js +786 -0
  300. package/dist/features/lint/index.d.ts +117 -0
  301. package/dist/features/lint/index.js +2 -0
  302. package/dist/features/lint/lib/BaseLintPlugin.js +1034 -0
  303. package/dist/features/list/lib/BaseListPlugin.js +279 -0
  304. package/dist/features/list/lib/listCommands.internal.js +161 -0
  305. package/dist/features/list/lib/listConversion.internal.js +55 -0
  306. package/dist/features/list/lib/listFamily.internal.js +165 -0
  307. package/dist/features/list/lib/listHtml.internal.js +195 -0
  308. package/dist/features/list/lib/listIdentity.internal.js +455 -0
  309. package/dist/features/list/lib/listIndex.internal.js +376 -0
  310. package/dist/features/list/lib/listKeyboard.internal.js +176 -0
  311. package/dist/features/list/lib/listMarkdown.internal.js +127 -0
  312. package/dist/features/list/lib/listNumbering.internal.js +391 -0
  313. package/dist/features/list/lib/listPaste.internal.js +81 -0
  314. package/dist/features/list/lib/listRules.internal.js +125 -0
  315. package/dist/features/lock/index.d.ts +2 -0
  316. package/dist/features/lock/index.js +2 -0
  317. package/dist/features/lock/lib/BaseLockPlugin.js +644 -0
  318. package/dist/features/media/index.d.ts +2 -0
  319. package/dist/features/media/index.js +5 -0
  320. package/dist/features/media/lib/BaseMediaPlugin.js +316 -0
  321. package/dist/features/media/lib/image/BaseImagePlugin.js +355 -0
  322. package/dist/features/media/lib/media/parseMediaEmbedUrl.internal.js +326 -0
  323. package/dist/features/media/lib/media/parseMediaEmbedUrl.js +12 -0
  324. package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +193 -0
  325. package/dist/features/media/lib/mediaHtml.internal.js +43 -0
  326. package/dist/features/media/lib/mediaPasteRule.internal.js +89 -0
  327. package/dist/features/media/lib/mediaPlugin.internal.js +201 -0
  328. package/dist/features/mention/index.d.ts +66 -0
  329. package/dist/features/mention/index.js +2 -0
  330. package/dist/features/mention/lib/BaseMentionPlugin.js +116 -0
  331. package/dist/features/table/index.d.ts +3 -0
  332. package/dist/features/table/index.js +2 -0
  333. package/dist/features/table/lib/BaseTablePlugin.js +1886 -0
  334. package/dist/features/table/lib/internal/authoredProjection.js +172 -0
  335. package/dist/features/table/lib/internal/axisMove.js +152 -0
  336. package/dist/features/table/lib/internal/context.js +58 -0
  337. package/dist/features/table/lib/internal/docxBorders.js +39 -0
  338. package/dist/features/table/lib/internal/grid.js +226 -0
  339. package/dist/features/table/lib/internal/mutation.js +546 -0
  340. package/dist/features/table/lib/internal/paste.js +327 -0
  341. package/dist/features/table/lib/internal/selection.js +420 -0
  342. package/dist/features/table/lib/internal/tableCellHtml.js +280 -0
  343. package/dist/features/table/lib/internal/tabularText.js +51 -0
  344. package/dist/features/table/lib/internal/widths.js +136 -0
  345. package/dist/features/toc/index.d.ts +2 -0
  346. package/dist/features/toc/index.js +2 -0
  347. package/dist/features/toc/lib/BaseTocPlugin.js +133 -0
  348. package/dist/features/upload/index.d.ts +2 -0
  349. package/dist/features/upload/index.js +3 -0
  350. package/dist/features/upload/lib/BaseUploadPlugin.js +895 -0
  351. package/dist/features/upload/lib/uploadRules.internal.js +259 -0
  352. package/dist/history/index.d.ts +2 -0
  353. package/dist/history/index.js +2 -0
  354. package/dist/history/plite-history.internal.js +2 -0
  355. package/dist/html/index.d.ts +5 -0
  356. package/dist/html/index.js +3 -0
  357. package/dist/html/server/index.d.ts +7 -0
  358. package/dist/html/server/index.js +20 -0
  359. package/dist/html/server/serverCssParser.internal.js +500 -0
  360. package/dist/html/server/serverCssStyle.internal.js +208 -0
  361. package/dist/htmlConversion-BvIl0E7N.d.ts +9 -0
  362. package/dist/htmlTypes-Cn2NA_Ob.d.ts +208 -0
  363. package/dist/hyperscript/index.d.ts +2 -0
  364. package/dist/hyperscript/index.js +1 -0
  365. package/dist/index-892oQuAa.d.ts +652 -0
  366. package/dist/index-B5qZ1xmJ.d.ts +602 -0
  367. package/dist/index-B9-eQ9Fa.d.ts +97 -0
  368. package/dist/index-BEuhgxYz-D9RcNZzE.d.ts +328 -0
  369. package/dist/index-BJMoiUqB.d.ts +57 -0
  370. package/dist/index-BRQpLUWT.d.ts +451 -0
  371. package/dist/index-BbxcY2IS.d.ts +1328 -0
  372. package/dist/index-Bkxx74P-.d.ts +37 -0
  373. package/dist/index-C-okUBnX.d.ts +116 -0
  374. package/dist/index-CDXEH2X0.d.ts +81 -0
  375. package/dist/index-CV_mklE2.d.ts +283 -0
  376. package/dist/index-ClDyiA1c-Bf4Rfc1t.d.ts +111 -0
  377. package/dist/index-Cz3XONhi.d.ts +899 -0
  378. package/dist/index-D-erws2m.d.ts +359 -0
  379. package/dist/index-DA6Ffr7b.d.ts +222 -0
  380. package/dist/index-DDJTmHad.d.ts +2414 -0
  381. package/dist/index-DH36U6tA.d.ts +21 -0
  382. package/dist/index-DN80H5GJ.d.ts +3 -0
  383. package/dist/index-DjKIXVz4.d.ts +1 -0
  384. package/dist/index-bZwY4JGn.d.ts +1414 -0
  385. package/dist/index-lyvnkmwk.d.ts +1 -0
  386. package/dist/index-s9cC9I5m-BgzFbzDU.d.ts +139 -0
  387. package/dist/index-wLIOjeY1.d.ts +5653 -0
  388. package/dist/index.d.ts +4 -4
  389. package/dist/index.js +39 -7
  390. package/dist/internal/comments/comment-anchor.internal.js +636 -0
  391. package/dist/internal/failInvariant.js +6 -0
  392. package/dist/internal/mergePlateRenderedAttributes.js +38 -0
  393. package/dist/internal/penStroke.internal.js +91 -0
  394. package/dist/internal/plugin/OverridePlugin.js +281 -0
  395. package/dist/internal/plugin/blockInsertion.js +67 -0
  396. package/dist/internal/plugin/blockRelease.js +60 -0
  397. package/dist/internal/plugin/collectPlateNodeMappings.js +72 -0
  398. package/dist/internal/plugin/compilePlainTextMappings.js +109 -0
  399. package/dist/internal/plugin/compilePlateFormats.js +127 -0
  400. package/dist/internal/plugin/compilePlateModel.js +829 -0
  401. package/dist/internal/plugin/compilePlateShortcuts.js +22 -0
  402. package/dist/internal/plugin/compilePluginInputMaps.js +126 -0
  403. package/dist/internal/plugin/createPlateModelPublication.js +270 -0
  404. package/dist/internal/plugin/createPlateRuntimePlugins.js +274 -0
  405. package/dist/internal/plugin/defaultElementTag.js +24 -0
  406. package/dist/internal/plugin/domHandlers.js +166 -0
  407. package/dist/internal/plugin/getPlateDecorationSources.js +48 -0
  408. package/dist/internal/plugin/getPluginRenderAttributes.js +16 -0
  409. package/dist/internal/plugin/imageLink.js +11 -0
  410. package/dist/internal/plugin/indentShift.js +44 -0
  411. package/dist/internal/plugin/inlineInsertion.js +29 -0
  412. package/dist/internal/plugin/insertionAnchor.js +28 -0
  413. package/dist/internal/plugin/isEditOnlyDisabled.js +27 -0
  414. package/dist/internal/plugin/markdownEscapes.js +20 -0
  415. package/dist/internal/plugin/markdownParagraph.js +29 -0
  416. package/dist/internal/plugin/matchesPluginInject.internal.js +20 -0
  417. package/dist/internal/plugin/mergeNodeAttributes.internal.js +76 -0
  418. package/dist/internal/plugin/mergePluginCapabilities.js +90 -0
  419. package/dist/internal/plugin/pastedUploadFiles.js +4 -0
  420. package/dist/internal/plugin/pipeInjectNodeProps.js +25 -0
  421. package/dist/internal/plugin/plateRuntime.js +29 -0
  422. package/dist/internal/plugin/pluginDescriptorSnapshot.js +171 -0
  423. package/dist/internal/plugin/pluginFormatOperation.js +105 -0
  424. package/dist/internal/plugin/pluginInjectNodeProps.js +66 -0
  425. package/dist/internal/plugin/pluginNodeClass.internal.js +6 -0
  426. package/dist/internal/plugin/pluginStore.js +161 -0
  427. package/dist/internal/plugin/resolvePlugin.js +250 -0
  428. package/dist/internal/plugin/resolvePluginGraph.js +352 -0
  429. package/dist/internal/plugin/resolvePlugins.js +57 -0
  430. package/dist/internal/plugin/staticReuseKey.internal.js +15 -0
  431. package/dist/internal/plugin/uploadDrafts.js +11 -0
  432. package/dist/internal/utils/isFunction.js +6 -0
  433. package/dist/internal/utils/mergePlugins.js +220 -0
  434. package/dist/internal/utils/snapshotApiValue.js +29 -0
  435. package/dist/internal/utils/trustedContentSlice.js +9 -0
  436. package/dist/internal/utils/urlPolicy.js +128 -0
  437. package/dist/internal/utils/vscodeClipboard.js +11 -0
  438. package/dist/lib/editor/editorApplicationSchema.js +19 -0
  439. package/dist/lib/editor/editorUser.internal.js +47 -0
  440. package/dist/lib/editor/withPlite.js +528 -0
  441. package/dist/lib/libs/nanoid.js +2 -0
  442. package/dist/lib/libs/zustand.js +53 -0
  443. package/dist/lib/plugin/assertNoPrepareDocument.internal.js +7 -0
  444. package/dist/lib/plugin/basePluginFactory.internal.js +7 -0
  445. package/dist/lib/plugin/createPluginContext.internal.js +344 -0
  446. package/dist/lib/plugin/defineBasePlugin.internal.js +263 -0
  447. package/dist/lib/plugin/definePlugin.js +11 -0
  448. package/dist/lib/plugin/pluginAuthoringContext.js +19 -0
  449. package/dist/lib/plugin/pluginFactoryRuntime.internal.js +40 -0
  450. package/dist/lib/plugins/HistoryPlugin.js +15 -0
  451. package/dist/lib/plugins/TransferPlugin.js +7 -0
  452. package/dist/lib/plugins/affinity/AffinityPlugin.js +185 -0
  453. package/dist/lib/plugins/debug/DebugPlugin.js +62 -0
  454. package/dist/lib/plugins/dom/DOMPlugin.js +92 -0
  455. package/dist/lib/plugins/dom/clipboardFormatKey.internal.js +9 -0
  456. package/dist/lib/plugins/dom/isPlainTextPasteTarget.internal.js +13 -0
  457. package/dist/lib/plugins/dom/plateDOMPlugin.internal.js +6 -0
  458. package/dist/lib/plugins/getCorePlugins.internal.js +23 -0
  459. package/dist/lib/plugins/html/HtmlPlugin.js +256 -0
  460. package/dist/lib/plugins/html/htmlAst.js +319 -0
  461. package/dist/lib/plugins/html/htmlConversion.js +19 -0
  462. package/dist/lib/plugins/html/htmlDecode.internal.js +891 -0
  463. package/dist/lib/plugins/html/htmlDom.js +194 -0
  464. package/dist/lib/plugins/html/htmlMatcher.internal.js +108 -0
  465. package/dist/lib/plugins/html/htmlRules.internal.js +490 -0
  466. package/dist/lib/plugins/html/htmlSafety.js +150 -0
  467. package/dist/lib/plugins/html/htmlSerialize.internal.js +462 -0
  468. package/dist/lib/plugins/html/htmlWhitespace.internal.js +137 -0
  469. package/dist/lib/plugins/input-rules/InputRulesPlugin.js +470 -0
  470. package/dist/lib/plugins/input-rules/createInputRules.js +286 -0
  471. package/dist/lib/plugins/input-rules/defineInputRule.js +6 -0
  472. package/dist/lib/plugins/input-rules/inputRuleContinuation.internal.js +13 -0
  473. package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +118 -0
  474. package/dist/lib/plugins/input-rules/inputRuleVeto.js +9 -0
  475. package/dist/lib/plugins/input-rules/inputRules.internal.js +20 -0
  476. package/dist/lib/plugins/input-rules/markInputRule.internal.js +106 -0
  477. package/dist/lib/plugins/paragraph/BaseParagraphPlugin.js +30 -0
  478. package/dist/lib/utils/applyDeepToNodes.js +17 -0
  479. package/dist/lib/utils/defaultsDeepToNodes.js +12 -0
  480. package/dist/lib/utils/environment.js +4 -0
  481. package/dist/lib/utils/getFragmentProp.js +27 -0
  482. package/dist/lib/utils/getInjectMatch.js +9 -0
  483. package/dist/lib/utils/isDefined.js +5 -0
  484. package/dist/lib/utils/isUrl.js +27 -0
  485. package/dist/lib/utils/mergeDeepToNodes.js +12 -0
  486. package/dist/markdown/index.d.ts +2 -0
  487. package/dist/markdown/index.js +3 -0
  488. package/dist/markdown/lib/MarkdownPlugin.js +159 -0
  489. package/dist/markdown/lib/deserializer/convertChildrenDeserialize.js +8 -0
  490. package/dist/markdown/lib/deserializer/convertNodesDeserialize.js +103 -0
  491. package/dist/markdown/lib/deserializer/mdastToSlate.js +26 -0
  492. package/dist/markdown/lib/internal/markdownAttributes.js +178 -0
  493. package/dist/markdown/lib/internal/markdownBareLinks.js +265 -0
  494. package/dist/markdown/lib/internal/markdownBreaks.js +191 -0
  495. package/dist/markdown/lib/internal/markdownDiagnostics.js +145 -0
  496. package/dist/markdown/lib/internal/markdownDocument.js +51 -0
  497. package/dist/markdown/lib/internal/markdownFootnoteWriter.js +35 -0
  498. package/dist/markdown/lib/internal/markdownFrontmatter.js +102 -0
  499. package/dist/markdown/lib/internal/markdownIntrinsics.js +228 -0
  500. package/dist/markdown/lib/internal/markdownLine.js +575 -0
  501. package/dist/markdown/lib/internal/markdownMappings.js +767 -0
  502. package/dist/markdown/lib/internal/markdownParse.js +601 -0
  503. package/dist/markdown/lib/internal/markdownReferences.js +76 -0
  504. package/dist/markdown/lib/internal/markdownRuntime.js +353 -0
  505. package/dist/markdown/lib/internal/markdownSafety.js +175 -0
  506. package/dist/markdown/lib/internal/markdownSerialize.js +197 -0
  507. package/dist/markdown/lib/internal/markdownStream.js +1239 -0
  508. package/dist/markdown/lib/internal/markdownTags.js +704 -0
  509. package/dist/markdown/lib/internal/markdownTailHeal.js +813 -0
  510. package/dist/markdown/lib/internal/walkMdast.js +34 -0
  511. package/dist/markdown/lib/serializer/convertNodesSerialize.js +98 -0
  512. package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +307 -0
  513. package/dist/markdown/lib/serializer/listToMdastTree.js +254 -0
  514. package/dist/markdown/lib/serializer/mdastContent.js +22 -0
  515. package/dist/markdown/lib/serializer/reportOmittedProperties.js +35 -0
  516. package/dist/markdown/lib/utils/remarkPlugins.js +55 -0
  517. package/dist/math/index.d.ts +523 -0
  518. package/dist/math/index.js +2 -0
  519. package/dist/math/lib/BaseEquationPlugin.js +427 -0
  520. package/dist/math/lib/mathmlTex.internal.js +1123 -0
  521. package/dist/math/lib/mathmlTexSymbols.internal.js +1852 -0
  522. package/dist/math/react/EquationPlugin.js +7 -0
  523. package/dist/math/react/index.d.ts +66 -0
  524. package/dist/math/react/index.js +2 -0
  525. package/dist/migrations/documentMigrationAuthored.internal.js +19 -0
  526. package/dist/migrations/documentMigrationSelection.internal.js +163 -0
  527. package/dist/migrations/documentMigrationTarget.internal.js +25 -0
  528. package/dist/migrations/documentMigrations.js +311 -0
  529. package/dist/migrations/extractLegacyCommentRanges.js +141 -0
  530. package/dist/migrations/index.d.ts +192 -0
  531. package/dist/migrations/index.js +4 -0
  532. package/dist/migrations/migratePlateV54.js +173 -0
  533. package/dist/migrations/migratePlateV54Ast.internal.js +504 -0
  534. package/dist/migrations/migratePlateV54BuiltIns.internal.js +87 -0
  535. package/dist/migrations/migratePlateV54CodeBlocks.internal.js +121 -0
  536. package/dist/migrations/migratePlateV54Inputs.internal.js +193 -0
  537. package/dist/migrations/migratePlateV54ListIdentity.internal.js +220 -0
  538. package/dist/migrations/migratePlateV54Ownership.internal.js +20 -0
  539. package/dist/migrations/migratePlateV54Profile.internal.js +393 -0
  540. package/dist/migrations/migratePlateV54RetiredMarks.internal.js +63 -0
  541. package/dist/migrations/migratePlateV54Stage.internal.js +127 -0
  542. package/dist/migrations/migratePlateV54Suggestions.internal.js +236 -0
  543. package/dist/migrations/migratePlateV54Toggle.internal.js +66 -0
  544. package/dist/migrations/migratePlateV54Urls.internal.js +154 -0
  545. package/dist/migrations/v53-manifest.internal.js +275 -0
  546. package/dist/node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +73 -0
  547. package/dist/node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +75 -0
  548. package/dist/node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.2.8/node_modules/use-sync-external-store/with-selector.js +11 -0
  549. package/dist/pagination/index.d.ts +2 -0
  550. package/dist/pagination/index.js +2 -0
  551. package/dist/pagination/react/PaginationPlugin.js +278 -0
  552. package/dist/pagination/react/index.d.ts +100 -0
  553. package/dist/pagination/react/index.js +3 -0
  554. package/dist/plain-text.js +35 -0
  555. package/dist/react/authored/AuthoredReactPlugin.js +126 -0
  556. package/dist/react/authored/index.d.ts +34 -0
  557. package/dist/react/authored/index.js +3 -0
  558. package/dist/react/authored/useAuthored.js +82 -0
  559. package/dist/react/components/EditorContentView.internal.js +323 -0
  560. package/dist/react/components/EditorProvider.js +33 -0
  561. package/dist/react/components/EditorRefEffect.internal.js +59 -0
  562. package/dist/react/components/EditorRefEffect.js +21 -0
  563. package/dist/react/components/NodeSelection.js +880 -0
  564. package/dist/react/components/Plate.js +337 -0
  565. package/dist/react/components/PlateContainer.js +160 -0
  566. package/dist/react/components/PlateContent.js +36 -0
  567. package/dist/react/components/PlateController.js +39 -0
  568. package/dist/react/components/PlateRoot.internal.js +89 -0
  569. package/dist/react/components/PlateView.js +43 -0
  570. package/dist/react/components/getPlainText.internal.js +20 -0
  571. package/dist/react/components/plate-nodes.js +125 -0
  572. package/dist/react/components/writeStaticSelectionClipboardData.internal.js +221 -0
  573. package/dist/react/core.js +53 -0
  574. package/dist/react/editor/getPlateCorePlugins.internal.js +20 -0
  575. package/dist/react/editor/useCreateEditor.js +45 -0
  576. package/dist/react/editor/withPlate.js +25 -0
  577. package/dist/react/features/basic-nodes/BasicNodesPlugins.js +29 -0
  578. package/dist/react/features/basic-styles/BasicStylePlugins.js +14 -0
  579. package/dist/react/features/board/BoardPlugin.js +29 -0
  580. package/dist/react/features/board/BoardShape.js +573 -0
  581. package/dist/react/features/board/BoardSurface.js +315 -0
  582. package/dist/react/features/board/boardCamera.internal.js +295 -0
  583. package/dist/react/features/board/boardClipboard.internal.js +100 -0
  584. package/dist/react/features/board/boardConnect.internal.js +190 -0
  585. package/dist/react/features/board/boardExport.internal.js +616 -0
  586. package/dist/react/features/board/boardGesture.internal.js +749 -0
  587. package/dist/react/features/board/boardIndex.internal.js +672 -0
  588. package/dist/react/features/board/boardInk.internal.js +30 -0
  589. package/dist/react/features/board/boardKeys.internal.js +513 -0
  590. package/dist/react/features/board/boardLanding.internal.js +147 -0
  591. package/dist/react/features/board/boardPick.internal.js +74 -0
  592. package/dist/react/features/board/boardPicking.internal.js +67 -0
  593. package/dist/react/features/board/boardPictureStyles.internal.js +415 -0
  594. package/dist/react/features/board/boardPictures.internal.js +96 -0
  595. package/dist/react/features/board/boardPreview.internal.js +239 -0
  596. package/dist/react/features/board/boardResize.internal.js +220 -0
  597. package/dist/react/features/board/boardSnap.internal.js +272 -0
  598. package/dist/react/features/board/boardStyleView.internal.js +123 -0
  599. package/dist/react/features/board/boardTextFit.internal.js +311 -0
  600. package/dist/react/features/board/boardView.internal.js +919 -0
  601. package/dist/react/features/board/boardVoice.internal.js +205 -0
  602. package/dist/react/features/board/boardWindow.internal.js +138 -0
  603. package/dist/react/features/board/index.d.ts +2484 -0
  604. package/dist/react/features/board/index.js +4 -0
  605. package/dist/react/features/callout/CalloutPlugin.js +6 -0
  606. package/dist/react/features/callout/index.d.ts +167 -0
  607. package/dist/react/features/callout/index.js +2 -0
  608. package/dist/react/features/code-block/CodeBlockPlugin.js +9 -0
  609. package/dist/react/features/column/ColumnPlugin.js +9 -0
  610. package/dist/react/features/column/index.d.ts +560 -0
  611. package/dist/react/features/column/index.js +2 -0
  612. package/dist/react/features/combobox/combobox.internal.js +106 -0
  613. package/dist/react/features/combobox/comboboxOwner.internal.js +291 -0
  614. package/dist/react/features/combobox/index.d.ts +94 -0
  615. package/dist/react/features/combobox/index.js +2 -0
  616. package/dist/react/features/combobox/useCombobox.js +108 -0
  617. package/dist/react/features/comments/CommentsPlugin.js +33 -0
  618. package/dist/react/features/comments/index.d.ts +671 -0
  619. package/dist/react/features/comments/index.js +3 -0
  620. package/dist/react/features/comments/useCommentThreadIndex.js +288 -0
  621. package/dist/react/features/date/DatePlugin.js +6 -0
  622. package/dist/react/features/date/index.d.ts +40 -0
  623. package/dist/react/features/date/index.js +2 -0
  624. package/dist/react/features/details/DetailsPlugin.js +8 -0
  625. package/dist/react/features/details/index.d.ts +501 -0
  626. package/dist/react/features/details/index.js +2 -0
  627. package/dist/react/features/field/FieldPlugin.js +35 -0
  628. package/dist/react/features/field/index.d.ts +311 -0
  629. package/dist/react/features/field/index.js +2 -0
  630. package/dist/react/features/footnote/FootnotePlugin.js +41 -0
  631. package/dist/react/features/footnote/index.d.ts +1095 -0
  632. package/dist/react/features/footnote/index.js +2 -0
  633. package/dist/react/features/format-painter/FormatPainterPlugin.js +202 -0
  634. package/dist/react/features/format-painter/index.d.ts +205 -0
  635. package/dist/react/features/format-painter/index.js +2 -0
  636. package/dist/react/features/indent/IndentPlugin.js +6 -0
  637. package/dist/react/features/ink/InkContent.js +307 -0
  638. package/dist/react/features/ink/InkPlugin.js +105 -0
  639. package/dist/react/features/ink/index.d.ts +503 -0
  640. package/dist/react/features/ink/index.js +3 -0
  641. package/dist/react/features/ink/inkCapture.internal.js +407 -0
  642. package/dist/react/features/ink/inkImages.internal.js +278 -0
  643. package/dist/react/features/ink/inkInput.internal.js +19 -0
  644. package/dist/react/features/ink/inkLayout.internal.js +29 -0
  645. package/dist/react/features/ink/inkMeasure.internal.js +268 -0
  646. package/dist/react/features/ink/inkPaint.internal.js +111 -0
  647. package/dist/react/features/ink/inkPick.internal.js +243 -0
  648. package/dist/react/features/ink/inkPlacement.internal.js +583 -0
  649. package/dist/react/features/ink/inkWatch.internal.js +257 -0
  650. package/dist/react/features/link/LinkPlugin.js +7 -0
  651. package/dist/react/features/list/ListPlugin.js +161 -0
  652. package/dist/react/features/lock/LockPlugin.js +105 -0
  653. package/dist/react/features/lock/index.d.ts +58 -0
  654. package/dist/react/features/lock/index.js +2 -0
  655. package/dist/react/features/media/index.d.ts +689 -0
  656. package/dist/react/features/media/index.js +2 -0
  657. package/dist/react/features/media/plugins.js +12 -0
  658. package/dist/react/features/mention/MentionPlugin.js +6 -0
  659. package/dist/react/features/mention/index.d.ts +56 -0
  660. package/dist/react/features/mention/index.js +2 -0
  661. package/dist/react/features/resizable/Resizable.js +204 -0
  662. package/dist/react/features/resizable/index.d.ts +28 -0
  663. package/dist/react/features/resizable/index.js +2 -0
  664. package/dist/react/features/resizable/resizeLength.internal.js +11 -0
  665. package/dist/react/features/table/TablePlugin.js +586 -0
  666. package/dist/react/features/table/index.d.ts +4806 -0
  667. package/dist/react/features/table/index.js +4 -0
  668. package/dist/react/features/table/measureTableColumnWidths.internal.js +44 -0
  669. package/dist/react/features/table/tableSelectionHostBinding.internal.js +95 -0
  670. package/dist/react/features/table/useTableControls.js +897 -0
  671. package/dist/react/features/table/useTableResize.js +114 -0
  672. package/dist/react/features/toc/TocPlugin.js +7 -0
  673. package/dist/react/features/toc/index.d.ts +18 -0
  674. package/dist/react/features/toc/index.js +2 -0
  675. package/dist/react/features/upload/UploadPlugin.js +50 -0
  676. package/dist/react/features/upload/index.d.ts +252 -0
  677. package/dist/react/features/upload/index.js +2 -0
  678. package/dist/react/index.d.ts +7 -4
  679. package/dist/react/index.js +70 -7
  680. package/dist/react/internal/block-redraws.js +83 -0
  681. package/dist/react/internal/getPlateEditorInstanceKey.js +13 -0
  682. package/dist/react/internal/plate-context.js +537 -0
  683. package/dist/react/internal/plite-components.js +12 -0
  684. package/dist/react/internal/react-helpers.js +19 -0
  685. package/dist/react/internal/rendered-attributes.js +190 -0
  686. package/dist/react/internal/useDeepCompareMemo.js +42 -0
  687. package/dist/react/internal/usePlateInstancesWarn.js +24 -0
  688. package/dist/react/internal/usePlateModelRevision.js +21 -0
  689. package/dist/react/internal/useZustandSelector.js +35 -0
  690. package/dist/react/plite-react.js +2 -0
  691. package/dist/react/plugin/createPluginContext.internal.js +7 -0
  692. package/dist/react/plugin/definePlugin.js +26 -0
  693. package/dist/react/plugin/pluginFactory.internal.js +7 -0
  694. package/dist/react/plugin/toReactPlugin.js +97 -0
  695. package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +109 -0
  696. package/dist/react/plugins/paragraph/ParagraphPlugin.js +14 -0
  697. package/dist/react/stores/element/useElement.js +11 -0
  698. package/dist/react/stores/element/useElementSelector.js +22 -0
  699. package/dist/react/stores/element/useElementStore.js +186 -0
  700. package/dist/react/stores/element/useElementStoreSelector.internal.js +125 -0
  701. package/dist/react/stores/element/usePath.js +57 -0
  702. package/dist/react/stores/plate/pluginStoreSelector.internal.js +44 -0
  703. package/dist/react/stores/plate/useEditor.js +147 -0
  704. package/dist/react/stores/plate/useEditorHistory.js +55 -0
  705. package/dist/react/stores/plate/useEditorSelector.js +36 -0
  706. package/dist/react/stores/plate/usePluginStore.js +49 -0
  707. package/dist/react/stores/plate/useViewStore.js +50 -0
  708. package/dist/react/stores/plate-controller/document-focus.internal.js +72 -0
  709. package/dist/react/stores/plate-controller/useFocusedLast.js +30 -0
  710. package/dist/react/utils/BlockPlaceholderPlugin.js +79 -0
  711. package/dist/react/utils/annotationPointer.internal.js +35 -0
  712. package/dist/react/utils/bindPointerSession.internal.js +35 -0
  713. package/dist/react/utils/dispatchPlateShortcut.internal.js +19 -0
  714. package/dist/react/utils/editableKeyDown.internal.js +12 -0
  715. package/dist/react/utils/getRenderNodeProps.internal.js +57 -0
  716. package/dist/react/utils/hardAffinityBoundary.internal.js +25 -0
  717. package/dist/react/utils/pipeHandler.internal.js +95 -0
  718. package/dist/react/utils/pipeRenderElement.internal.js +511 -0
  719. package/dist/react/utils/pipeRenderLeaf.internal.js +162 -0
  720. package/dist/react/utils/pipeRenderText.internal.js +140 -0
  721. package/dist/react/utils/pluginRenderElement.internal.js +165 -0
  722. package/dist/react/utils/pluginRenderLeaf.internal.js +67 -0
  723. package/dist/react/utils/pluginRenderText.internal.js +40 -0
  724. package/dist/react/utils/tapOrder.internal.js +106 -0
  725. package/dist/react/utils/useSelectionFragment.js +30 -0
  726. package/dist/react/virtualized.d.ts +14 -0
  727. package/dist/react/virtualized.js +48 -0
  728. package/dist/refusal-Bd_fl5WN-DE0xLvUC.d.ts +1 -0
  729. package/dist/registerEditorTools-DO-PSLVj.d.ts +409 -0
  730. package/dist/root.js +39 -0
  731. package/dist/skills/plate/SKILL.md +48 -0
  732. package/dist/skills/plate/references/ai-and-agents.md +16 -0
  733. package/dist/skills/plate/references/plugins.md +22 -0
  734. package/dist/skills/plate/references/plus-and-pro.md +12 -0
  735. package/dist/skills/plate/references/report-a-bug.md +8 -0
  736. package/dist/skills/plate/references/setup.md +61 -0
  737. package/dist/skills/plate/references/testing.md +15 -0
  738. package/dist/skills/plate/references/ui-and-sync.md +23 -0
  739. package/dist/source-ZEzJ6HMc.d.ts +144 -0
  740. package/dist/static/components/EditorStatic.js +455 -0
  741. package/dist/static/components/plite-nodes.js +68 -0
  742. package/dist/static/index.d.ts +133 -1
  743. package/dist/static/index.js +4 -1
  744. package/dist/static/internal/loadStaticRenderer.js +4 -0
  745. package/dist/static/internal/staticDocumentView.js +122 -0
  746. package/dist/static/internal/staticPendingMedia.internal.js +136 -0
  747. package/dist/static/internal/staticPresentation.js +67 -0
  748. package/dist/static/pipeRenderElementStatic.internal.js +23 -0
  749. package/dist/static/pluginRenderElementStatic.internal.js +96 -0
  750. package/dist/static/pluginRenderLeafStatic.internal.js +82 -0
  751. package/dist/static/pluginRenderTextStatic.internal.js +83 -0
  752. package/dist/static/renderStaticHtml.js +38 -0
  753. package/dist/static/utils/fallbackContentRoots.internal.js +15 -0
  754. package/dist/static/utils/getRenderNodeStaticProps.internal.js +38 -0
  755. package/dist/sync/SyncPlugin.js +16 -0
  756. package/dist/sync/cloudflare/index.d.ts +71 -0
  757. package/dist/sync/cloudflare/index.js +2 -0
  758. package/dist/sync/index.d.ts +4 -0
  759. package/dist/sync/index.js +3 -0
  760. package/dist/sync/react/SyncReactPlugin.js +20 -0
  761. package/dist/sync/react/hooks.js +64 -0
  762. package/dist/sync/react/index.d.ts +100 -0
  763. package/dist/sync/react/index.js +4 -0
  764. package/dist/sync/server/index.d.ts +4 -0
  765. package/dist/sync/server/index.js +2 -0
  766. package/dist/tabbable/react/TabbableEffects.internal.js +261 -0
  767. package/dist/tabbable/react/TabbablePlugin.js +20 -0
  768. package/dist/tabbable/react/index.d.ts +67 -0
  769. package/dist/tabbable/react/index.js +2 -0
  770. package/dist/testing/index.d.ts +176 -0
  771. package/dist/testing/index.js +1 -0
  772. package/dist/transport-C54J2-C4-C3WX_jBu.d.ts +129 -0
  773. package/dist/tx-only-D93eVI65-Brv2zR4A.d.ts +8164 -0
  774. package/dist/utils/plate-keys.js +72 -0
  775. package/dist/utils/plugins/SingleBlockPlugin.js +21 -0
  776. package/dist/utils/plugins/SingleLinePlugin.js +32 -0
  777. package/dist/utils/plugins/TrailingBlockPlugin.js +32 -0
  778. package/dist/utils/plugins/joinSingleRootBlock.internal.js +24 -0
  779. package/dist/utils/plugins/resolveTrailingBlockType.internal.js +8 -0
  780. package/dist/widths-BMZN3LCs.d.ts +2750 -0
  781. package/package.json +620 -36
@@ -0,0 +1,161 @@
1
+ import { getViewPresentation, onPresentationRelease, reportEditorLifecycleError } from "../../facade.js";
2
+ import { brandPluginDescriptor, freezePluginDataSnapshot, getPluginSchemaFamily, isImmutablePluginData, isNominalPluginDescriptor } from "../utils/mergePlugins.js";
3
+ import { getPlateRuntimeOwner } from "./plateRuntime.js";
4
+ import { createZustandStore } from "../../lib/libs/zustand.js";
5
+ import { create } from "mutative";
6
+ //#region src/internal/plugin/pluginStore.ts
7
+ const createPluginStore = (editor, plugin, base, selectors) => {
8
+ const owner = getPlateRuntimeOwner(editor);
9
+ const name = typeof plugin === "string" ? plugin : plugin.name;
10
+ const state = base.store.getState();
11
+ for (const key of Object.keys(selectors)) if (Object.hasOwn(state, key)) throw new Error(`Plate plugin "${name}" defines "${key}" as both state and selector.`);
12
+ const replace = (value) => {
13
+ base.set("state", snapshotPluginState(value, true));
14
+ };
15
+ return Object.freeze({
16
+ base,
17
+ public: Object.freeze({
18
+ get(key, ...args) {
19
+ const current = base.store.getState();
20
+ if (key === void 0) return current;
21
+ const selector = selectors[key];
22
+ if (typeof selector === "function") return selector(current, ...args);
23
+ if (Object.hasOwn(current, key)) return current[key];
24
+ throw new Error(`Plate plugin "${name}" has no state field or selector "${String(key)}".`);
25
+ },
26
+ set(value) {
27
+ const current = base.store.getState();
28
+ if (typeof value === "function") replace(create(current, value));
29
+ else replace({
30
+ ...current,
31
+ ...value
32
+ });
33
+ },
34
+ subscribe: (listener) => base.store.subscribe((current, previous) => {
35
+ try {
36
+ listener(current, previous);
37
+ } catch (error) {
38
+ reportEditorLifecycleError({
39
+ cause: error,
40
+ editor: owner,
41
+ phase: "snapshot-listener",
42
+ pluginName: name
43
+ });
44
+ }
45
+ })
46
+ }),
47
+ selectors: Object.freeze({ ...selectors })
48
+ });
49
+ };
50
+ const isMinimalPluginReference = (value) => Object.isFrozen(value) && Reflect.ownKeys(value).every((key) => key === "name");
51
+ const ownedStateSnapshots = /* @__PURE__ */ new WeakSet();
52
+ const snapshotPluginStateValue = (value, context) => {
53
+ if (!value || typeof value !== "object") return value;
54
+ if (isImmutablePluginData(value)) return value;
55
+ if (context.reuseSnapshots && ownedStateSnapshots.has(value)) return value;
56
+ if (isNominalPluginDescriptor(value)) {
57
+ const family = getPluginSchemaFamily(value);
58
+ const canonicalByName = family ? context.canonicalReferences?.get(family) : void 0;
59
+ const canonicalReference = canonicalByName?.get(value.name);
60
+ if (canonicalReference) return canonicalReference;
61
+ if (isMinimalPluginReference(value)) {
62
+ if (context.canonicalReferences && family) {
63
+ const byName = canonicalByName ?? /* @__PURE__ */ new Map();
64
+ byName.set(value.name, value);
65
+ context.canonicalReferences.set(family, byName);
66
+ }
67
+ return value;
68
+ }
69
+ const existingReference = context.references.get(value);
70
+ if (existingReference) return existingReference;
71
+ const reference = Object.freeze(brandPluginDescriptor({ name: value.name }, value));
72
+ context.references.set(value, reference);
73
+ if (context.canonicalReferences && family) {
74
+ const byName = canonicalByName ?? /* @__PURE__ */ new Map();
75
+ byName.set(value.name, reference);
76
+ context.canonicalReferences.set(family, byName);
77
+ }
78
+ return reference;
79
+ }
80
+ const existing = context.snapshots.get(value);
81
+ if (existing !== void 0) return existing;
82
+ if (Array.isArray(value)) {
83
+ const snapshot = [];
84
+ context.snapshots.set(value, snapshot);
85
+ snapshot.push(...value.map((item) => snapshotPluginStateValue(item, context)));
86
+ ownedStateSnapshots.add(snapshot);
87
+ return freezePluginDataSnapshot(snapshot);
88
+ }
89
+ const prototype = Object.getPrototypeOf(value);
90
+ if (prototype !== Object.prototype && prototype !== null) return value;
91
+ const snapshot = Object.create(prototype);
92
+ context.snapshots.set(value, snapshot);
93
+ for (const key of Reflect.ownKeys(value)) {
94
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
95
+ if (!descriptor) continue;
96
+ if (!Object.hasOwn(descriptor, "value")) throw new Error("Plate plugin `initialState` must be data-only. Accessor properties are not supported; declare computed values as pure plugin selectors.");
97
+ Object.defineProperty(snapshot, key, {
98
+ enumerable: descriptor.enumerable,
99
+ value: snapshotPluginStateValue(descriptor.value, context)
100
+ });
101
+ }
102
+ ownedStateSnapshots.add(snapshot);
103
+ return freezePluginDataSnapshot(snapshot);
104
+ };
105
+ /** Own one initial-state graph without retaining caller-owned plain data. */
106
+ const snapshotPluginState = (value, reuseSnapshots = false) => snapshotPluginStateValue(value, {
107
+ references: /* @__PURE__ */ new WeakMap(),
108
+ reuseSnapshots,
109
+ snapshots: /* @__PURE__ */ new WeakMap()
110
+ });
111
+ /** Canonicalize resolved state graphs through one editor-local token set. */
112
+ const createPluginStateSnapshot = () => {
113
+ const context = {
114
+ canonicalReferences: /* @__PURE__ */ new WeakMap(),
115
+ references: /* @__PURE__ */ new WeakMap(),
116
+ snapshots: /* @__PURE__ */ new WeakMap()
117
+ };
118
+ return (value) => snapshotPluginStateValue(value, context);
119
+ };
120
+ const PLUGIN_STORES = /* @__PURE__ */ new WeakMap();
121
+ const getPluginStoreEntry = (owner) => {
122
+ let entry = PLUGIN_STORES.get(owner);
123
+ if (!entry) {
124
+ entry = {
125
+ plugins: /* @__PURE__ */ new Map(),
126
+ views: /* @__PURE__ */ new WeakMap()
127
+ };
128
+ PLUGIN_STORES.set(owner, entry);
129
+ }
130
+ return entry;
131
+ };
132
+ const clearPluginStores = (editor) => {
133
+ PLUGIN_STORES.delete(getPlateRuntimeOwner(editor));
134
+ };
135
+ const getViewStore = (editor, plugin, presentation) => {
136
+ const entry = getPluginStoreEntry(getPlateRuntimeOwner(editor));
137
+ const stores = entry.views.get(presentation) ?? /* @__PURE__ */ new Map();
138
+ if (!entry.views.has(presentation)) {
139
+ entry.views.set(presentation, stores);
140
+ onPresentationRelease(presentation, () => {
141
+ entry.views.delete(presentation);
142
+ });
143
+ }
144
+ let store = stores.get(plugin.name);
145
+ if (!store) {
146
+ store = createPluginStore(editor, plugin, createZustandStore(snapshotPluginState(plugin.initialViewState?.() ?? {}), { name: plugin.name }), {});
147
+ stores.set(plugin.name, store);
148
+ }
149
+ return store;
150
+ };
151
+ const getEditorViewStore = (editor, plugin) => getViewStore(editor, plugin, getViewPresentation(editor));
152
+ function getPluginStore(editor, plugin) {
153
+ const name = typeof plugin === "string" ? plugin : plugin.name;
154
+ return PLUGIN_STORES.get(getPlateRuntimeOwner(editor))?.plugins.get(name);
155
+ }
156
+ const setPluginStore = (editor, plugin, store) => {
157
+ const name = typeof plugin === "string" ? plugin : plugin.name;
158
+ getPluginStoreEntry(getPlateRuntimeOwner(editor)).plugins.set(name, store);
159
+ };
160
+ //#endregion
161
+ export { clearPluginStores, createPluginStateSnapshot, createPluginStore, getEditorViewStore, getPluginStore, getViewStore, setPluginStore, snapshotPluginState };
@@ -0,0 +1,250 @@
1
+ import { isRuntimePlugin } from "../../facade.js";
2
+ import { getPluginDescriptorMetadata, isNominalPluginDescriptor, mergePlugins, registerHtmlMappingSchemaFamilies, setPluginDescriptorMetadata } from "../utils/mergePlugins.js";
3
+ import { withResolvingPlatePlugin } from "./compilePlateModel.js";
4
+ import { pluginFormatMapDeclaration } from "../../lib/plugin/pluginAuthoringContext.js";
5
+ import { createPluginContext, withPluginViewStore } from "../../lib/plugin/createPluginContext.internal.js";
6
+ import { assertNoPrepareDocument } from "../../lib/plugin/assertNoPrepareDocument.internal.js";
7
+ import { snapshotApiValue } from "../utils/snapshotApiValue.js";
8
+ import { DebugPlugin } from "../../lib/plugins/debug/DebugPlugin.js";
9
+ //#region src/internal/plugin/resolvePlugin.ts
10
+ const emptyResolvedPluginCapabilities = Object.freeze({
11
+ api: Object.freeze([]),
12
+ nativeSources: Object.freeze([]),
13
+ read: Object.freeze([]),
14
+ update: Object.freeze([])
15
+ });
16
+ const resolvedPluginCapabilities = /* @__PURE__ */ new WeakMap();
17
+ const getResolvedPluginCapabilities = (plugin) => resolvedPluginCapabilities.get(plugin) ?? emptyResolvedPluginCapabilities;
18
+ const inheritResolvedPluginCapabilities = (source, target) => {
19
+ const capabilities = resolvedPluginCapabilities.get(source);
20
+ if (capabilities) resolvedPluginCapabilities.set(target, capabilities);
21
+ return target;
22
+ };
23
+ const isObjectRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
24
+ const assertConfiguredInputRules = (value) => {
25
+ if (value === void 0 || Array.isArray(value)) return;
26
+ throw new Error("inputRules must be an array of explicit rule instances.");
27
+ };
28
+ const mergeLifecycleHandlers = (plugin, previous, contribution) => {
29
+ const handlers = isObjectRecord(previous) ? { ...previous } : {};
30
+ for (const name of Reflect.ownKeys(contribution)) {
31
+ const prior = handlers[name];
32
+ const next = contribution[name];
33
+ if (typeof prior === "function" && typeof next === "function") handlers[name] = (...args) => {
34
+ return Reflect.apply(prior, void 0, args) === true ? true : Reflect.apply(next, void 0, args);
35
+ };
36
+ else if (next === null || next === void 0 || typeof next === "function") handlers[name] = next;
37
+ else throw new Error(`Plate plugin "${plugin.name}" on.${String(name)} must be a function or null.`);
38
+ }
39
+ return handlers;
40
+ };
41
+ const mergeFactory = (previous, next, pluginContext) => (context) => {
42
+ const prior = typeof previous === "function" ? Reflect.apply(previous, void 0, [context]) : {};
43
+ const contribution = Reflect.apply(next, void 0, [Object.assign(Object.create(pluginContext), context)]);
44
+ if (!isObjectRecord(contribution)) throw new Error(`Plate plugin "${pluginContext.plugin.name}" capability factories must return an object.`);
45
+ return mergePlugins(prior, contribution);
46
+ };
47
+ const mergeActivate = (plugin, previous, next) => {
48
+ if (typeof next !== "function") throw new Error(`Plate plugin "${plugin.name}" activate must be a function.`);
49
+ if (typeof previous !== "function") return next;
50
+ return (context) => {
51
+ Reflect.apply(previous, void 0, [context]);
52
+ Reflect.apply(next, void 0, [context]);
53
+ };
54
+ };
55
+ const mergeCommandFactories = (plugin, previous, next) => (context) => {
56
+ const prior = typeof previous === "function" ? Reflect.apply(previous, void 0, [context]) : [];
57
+ const contribution = Reflect.apply(next, void 0, [context]);
58
+ if (!Array.isArray(prior) || !Array.isArray(contribution)) throw new Error(`Plate plugin "${plugin.name}" command factories must return arrays.`);
59
+ return [...prior, ...contribution];
60
+ };
61
+ const assertNativeTopology = (plugin, field, contribution) => {
62
+ if (contribution === void 0) return;
63
+ if (!Array.isArray(contribution) || contribution.some((reference) => !reference || typeof reference !== "object" || typeof Reflect.get(reference, "name") !== "string")) throw new Error(`Plate plugin "${plugin.name}" adopted a native plugin with invalid ${field}.`);
64
+ const declared = plugin[field];
65
+ if (declared.length !== contribution.length || declared.some((reference, index) => reference.name !== Reflect.get(contribution[index], "name"))) throw new Error(`Plate plugin "${plugin.name}" must declare the same ${field} as its adopted native plugin.`);
66
+ };
67
+ const applyFormatDeclaration = (plugin, formats) => {
68
+ if (formats[pluginFormatMapDeclaration] !== true) throw new Error(`Plate plugin "${plugin.name}" formats must be declared with the context-bound \`defineFormats(...)\` helper.`);
69
+ const { html: htmlMapping, ...productMappings } = formats;
70
+ for (const format of Object.keys(productMappings)) if (format !== "docx" && format !== "markdown" && format !== "plainText") throw new Error(`Plate plugin "${plugin.name}" declares unknown format "${format}".`);
71
+ const currentFormats = Reflect.get(plugin, "formats");
72
+ const definedProductMappings = Object.entries(productMappings).filter(([, value]) => value !== void 0);
73
+ if (definedProductMappings.length > 0) {
74
+ const merged = {};
75
+ if (isObjectRecord(currentFormats)) for (const [format, existing] of Object.entries(currentFormats)) {
76
+ if (existing === void 0) continue;
77
+ merged[format] = Array.isArray(existing) ? existing : [existing];
78
+ }
79
+ for (const [format, value] of definedProductMappings) {
80
+ const incoming = Array.isArray(value) ? value : [value];
81
+ if (incoming.length === 0) throw new Error(`Plate plugin "${plugin.name}" \`formats.${format}\` tuples must be non-empty.`);
82
+ merged[format] = Object.freeze([...merged[format] ?? [], ...incoming]);
83
+ }
84
+ Reflect.set(plugin, "formats", Object.freeze(merged));
85
+ }
86
+ if (htmlMapping === void 0) return;
87
+ const htmlMappings = Array.isArray(htmlMapping) ? htmlMapping : [htmlMapping];
88
+ if (htmlMappings.length === 0) throw new Error("Plate plugin `formats.html` tuples must be non-empty.");
89
+ for (const declaration of htmlMappings) {
90
+ if (!isObjectRecord(declaration)) throw new Error("Plate plugin `formats.html` must contain mapping declarations.");
91
+ const { target, ...rule } = declaration;
92
+ const targetPlugin = target ?? plugin;
93
+ if (!isNominalPluginDescriptor(targetPlugin)) throw new Error("Plate plugin HTML mapping `target` must be a plugin descriptor.");
94
+ if (target !== void 0 && targetPlugin.name === plugin.name) throw new Error("Plate plugin HTML mapping `target` must be a different plugin descriptor.");
95
+ const contribution = registerHtmlMappingSchemaFamilies(() => rule, plugin, targetPlugin);
96
+ const metadata = getPluginDescriptorMetadata(plugin);
97
+ setPluginDescriptorMetadata(plugin, {
98
+ ...metadata,
99
+ htmlMappingContributions: [...metadata.htmlMappingContributions, Object.freeze({
100
+ factory: contribution,
101
+ targetPlugin: target === void 0 ? null : targetPlugin.name
102
+ })]
103
+ });
104
+ }
105
+ };
106
+ const applyFormats = (plugin, formats) => {
107
+ if (Array.isArray(formats)) {
108
+ if (formats.length === 0) throw new Error(`Plate plugin "${plugin.name}" \`formats\` tuples must be non-empty.`);
109
+ for (const entry of formats) {
110
+ if (!isObjectRecord(entry)) throw new Error(`Plate plugin "${plugin.name}" formats must be a semantic mapping object.`);
111
+ applyFormatDeclaration(plugin, entry);
112
+ }
113
+ return;
114
+ }
115
+ if (!isObjectRecord(formats)) throw new Error(`Plate plugin "${plugin.name}" formats must be a semantic mapping object.`);
116
+ applyFormatDeclaration(plugin, formats);
117
+ };
118
+ const applyStage = (editor, plugin, contribution, pluginContext) => {
119
+ assertNoPrepareDocument(contribution);
120
+ const isRawPliteDescriptor = Boolean(isRuntimePlugin(contribution) && !isNominalPluginDescriptor(contribution));
121
+ if (isRawPliteDescriptor && contribution.name !== void 0 && contribution.name !== plugin.name) throw new Error(`Plate plugin "${plugin.name}" cannot adopt native plugin "${contribution.name}". Their names must match.`);
122
+ const { activate, api, dataTransferFormats, formats, commands, conflicts, dependencies, name: _name, on, read, update, ...configuration } = contribution;
123
+ if (isRawPliteDescriptor) {
124
+ assertNativeTopology(plugin, "conflicts", conflicts);
125
+ assertNativeTopology(plugin, "dependencies", dependencies);
126
+ }
127
+ const next = mergePlugins(plugin, isRawPliteDescriptor ? configuration : {
128
+ ...configuration,
129
+ ...conflicts === void 0 ? {} : { conflicts },
130
+ ...dependencies === void 0 ? {} : { dependencies }
131
+ });
132
+ const previousCapabilities = getResolvedPluginCapabilities(plugin);
133
+ let apiContributions = previousCapabilities.api;
134
+ let { nativeSources } = previousCapabilities;
135
+ let readContributions = previousCapabilities.read;
136
+ let updateContributions = previousCapabilities.update;
137
+ if (isRawPliteDescriptor) nativeSources = Object.freeze([...nativeSources, contribution]);
138
+ if (activate !== void 0) Reflect.set(next, "activate", mergeActivate(plugin, Reflect.get(next, "activate"), activate));
139
+ if (on !== void 0) {
140
+ if (!isObjectRecord(on)) throw new Error(`Plate plugin "${plugin.name}" on must be an object.`);
141
+ Reflect.set(next, "on", mergeLifecycleHandlers(plugin, Reflect.get(next, "on"), on));
142
+ }
143
+ if (commands !== void 0) {
144
+ if (typeof commands !== "function") throw new Error(`Plate plugin "${plugin.name}" commands must be a context factory.`);
145
+ Reflect.set(next, "commands", mergeCommandFactories(plugin, Reflect.get(next, "commands"), commands));
146
+ }
147
+ if (dataTransferFormats !== void 0) {
148
+ if (!Array.isArray(dataTransferFormats)) throw new Error(`Plate plugin "${plugin.name}" dataTransferFormats must be an array.`);
149
+ const previous = Reflect.get(next, "dataTransferFormats");
150
+ if (previous !== void 0 && !Array.isArray(previous)) throw new Error(`Plate plugin "${plugin.name}" dataTransferFormats must be an array.`);
151
+ Reflect.set(next, "dataTransferFormats", Object.freeze([...previous ?? [], ...dataTransferFormats]));
152
+ }
153
+ if (api !== void 0) {
154
+ if (typeof api !== "function") throw new Error(`Plate plugin "${plugin.name}" API must be a context factory.`);
155
+ if (isRawPliteDescriptor) apiContributions = Object.freeze([...apiContributions, Object.freeze({
156
+ factory: api,
157
+ kind: "native"
158
+ })]);
159
+ else {
160
+ const apiValue = Reflect.apply(api, void 0, [withPluginViewStore(pluginContext, editor, plugin)]);
161
+ if (!isObjectRecord(apiValue)) throw new Error(`Plate plugin "${plugin.name}" API factories must return an object.`);
162
+ const snapshot = snapshotApiValue(apiValue);
163
+ apiContributions = Object.freeze([...apiContributions, Object.freeze({
164
+ factory: api,
165
+ kind: "definition",
166
+ value: snapshot
167
+ })]);
168
+ Reflect.set(next, "api", snapshotApiValue(mergePlugins(isObjectRecord(Reflect.get(next, "api")) ? Reflect.get(next, "api") : {}, snapshot)));
169
+ }
170
+ }
171
+ if (typeof read === "function") {
172
+ readContributions = Object.freeze([...readContributions, Object.freeze({
173
+ factory: read,
174
+ kind: isRawPliteDescriptor ? "native" : "definition"
175
+ })]);
176
+ if (!isRawPliteDescriptor) Reflect.set(next, "read", mergeFactory(Reflect.get(next, "read"), read, pluginContext));
177
+ }
178
+ if (typeof update === "function") {
179
+ updateContributions = Object.freeze([...updateContributions, Object.freeze({
180
+ factory: update,
181
+ kind: isRawPliteDescriptor ? "native" : "definition"
182
+ })]);
183
+ if (!isRawPliteDescriptor) Reflect.set(next, "update", mergeFactory(Reflect.get(next, "update"), update, pluginContext));
184
+ }
185
+ if (formats !== void 0) {
186
+ const resolvedFormats = typeof formats === "function" ? Reflect.apply(formats, void 0, [Object.freeze({
187
+ defineFormats: pluginContext.defineFormats,
188
+ schema: pluginContext.schema
189
+ })]) : formats;
190
+ applyFormats(next, resolvedFormats);
191
+ }
192
+ if (apiContributions.length > 0 || nativeSources.length > 0 || readContributions.length > 0 || updateContributions.length > 0) resolvedPluginCapabilities.set(next, Object.freeze({
193
+ api: apiContributions,
194
+ nativeSources,
195
+ read: readContributions,
196
+ update: updateContributions
197
+ }));
198
+ return next;
199
+ };
200
+ const finalizeResolvedPlugin = (editor, plugin) => {
201
+ plugin.targetPlugins = Object.freeze([...plugin.targetPlugins]);
202
+ validatePlugin(editor, plugin);
203
+ return plugin;
204
+ };
205
+ /** Reapply captured terminal configuration without executing callbacks again. */
206
+ const reapplyResolvedPluginConfigurations = (editor, plugin, configurations) => {
207
+ let configured = plugin;
208
+ for (const configuration of configurations) {
209
+ assertNoPrepareDocument(configuration);
210
+ configured = inheritResolvedPluginCapabilities(configured, mergePlugins(configured, configuration));
211
+ }
212
+ return finalizeResolvedPlugin(editor, configured);
213
+ };
214
+ const resolvePluginWithConfigurations = (editor, descriptor) => {
215
+ assertNoPrepareDocument(descriptor);
216
+ let plugin = mergePlugins({}, descriptor);
217
+ const descriptorMetadata = getPluginDescriptorMetadata(plugin);
218
+ setPluginDescriptorMetadata(plugin, {
219
+ ...descriptorMetadata,
220
+ resolved: true
221
+ });
222
+ const layers = [...descriptorMetadata.configurationLayers];
223
+ const configurations = [];
224
+ for (const layer of layers) {
225
+ const value = layer.kind === "context" ? withResolvingPlatePlugin(editor, plugin, () => Reflect.apply(layer.value, void 0, [createPluginContext(editor, plugin)])) : layer.value;
226
+ if (!isObjectRecord(value)) throw new Error(`Plate plugin "${plugin.name}" configuration must resolve to an object.`);
227
+ assertNoPrepareDocument(value);
228
+ if (Object.hasOwn(value, "inputRules")) assertConfiguredInputRules(value.inputRules);
229
+ const snapshot = { ...value };
230
+ plugin = mergePlugins(plugin, snapshot);
231
+ configurations.push(snapshot);
232
+ }
233
+ const stages = [...getPluginDescriptorMetadata(plugin).stages];
234
+ for (const stage of stages) plugin = withResolvingPlatePlugin(editor, plugin, () => {
235
+ const context = createPluginContext(editor, plugin);
236
+ const contribution = Reflect.apply(stage, void 0, [context]);
237
+ if (!isObjectRecord(contribution)) throw new Error(`Plate plugin "${plugin.name}" stage must return an object.`);
238
+ return applyStage(editor, plugin, contribution, context);
239
+ });
240
+ plugin = reapplyResolvedPluginConfigurations(editor, plugin, configurations);
241
+ return Object.freeze({
242
+ configurations: Object.freeze(configurations),
243
+ plugin
244
+ });
245
+ };
246
+ const validatePlugin = (editor, plugin) => {
247
+ if (!isNominalPluginDescriptor(plugin)) createPluginContext(editor, DebugPlugin).api.error(`Invalid plugin '${plugin.name}', use definePlugin.`, "INVALID_PLUGIN");
248
+ };
249
+ //#endregion
250
+ export { getResolvedPluginCapabilities, inheritResolvedPluginCapabilities, reapplyResolvedPluginConfigurations, resolvePluginWithConfigurations, validatePlugin };