platejs 54.0.0-beta.12 → 54.0.0-beta.14

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 (332) hide show
  1. package/dist/{EditorStatic-DLn-Y0NA.d.ts → EditorStatic-eXOA489B.d.ts} +12 -11
  2. package/dist/ai/index.d.ts +2 -2
  3. package/dist/ai/lib/aiDraftSession.js +9 -7
  4. package/dist/ai/lib/aiPolicy.internal.js +43 -6
  5. package/dist/ai/lib/editorAgent.js +476 -563
  6. package/dist/ai/lib/editorAgentDispatcher.internal.js +205 -0
  7. package/dist/ai/lib/editorAgentPresence.internal.js +3 -2
  8. package/dist/ai/lib/editorAgentSync.internal.js +303 -0
  9. package/dist/ai/lib/lockedContext.js +5 -4
  10. package/dist/ai/lib/registerEditorTools.js +6 -3
  11. package/dist/ai/react/copilotInline.internal.js +6 -5
  12. package/dist/ai/react/index.d.ts +7 -7
  13. package/dist/ai/react/useEditorAgent.js +101 -41
  14. package/dist/authored/index.d.ts +4 -4
  15. package/dist/{authored-D-sIdWDF-BO8GVDW5.d.ts → authored-qetvpvU--DSWESzxK.d.ts} +3 -3
  16. package/dist/clipboard-format-key-BBu85J9m-BLhtd159.d.ts +1 -0
  17. package/dist/code-block/codemirror/index.d.ts +2 -2
  18. package/dist/{comment-anchor.internal-Qv9thB9E.d.ts → comment-anchor.internal-CoNK9gTD.d.ts} +2 -2
  19. package/dist/compiler/index.d.ts +3 -3
  20. package/dist/{core-BWS1N1EV.d.ts → core-By92GWYW.d.ts} +68 -23
  21. package/dist/diff/index.d.ts +2 -2
  22. package/dist/docs/agents/skills.md +26 -2
  23. package/dist/docs/agents.md +2 -2
  24. package/dist/docs/ai-agents.md +9 -5
  25. package/dist/docs/ai.md +81 -26
  26. package/dist/docs/api/core/plate-components.md +6 -2
  27. package/dist/docs/api/dom.md +5 -3
  28. package/dist/docs/api/plate.md +15 -7
  29. package/dist/docs/api/react-hooks.md +32 -2
  30. package/dist/docs/authored-changes.md +6 -2
  31. package/dist/docs/block-menu.md +3 -1
  32. package/dist/docs/board.md +4 -0
  33. package/dist/docs/callout.md +63 -13
  34. package/dist/docs/code-block.md +1 -1
  35. package/dist/docs/collaboration.md +6 -1
  36. package/dist/docs/column.md +2 -0
  37. package/dist/docs/combobox.md +9 -2
  38. package/dist/docs/comment.md +8 -3
  39. package/dist/docs/components/toolbar-buttons.md +1 -1
  40. package/dist/docs/copilot.md +4 -4
  41. package/dist/docs/deck.md +173 -0
  42. package/dist/docs/details.md +8 -4
  43. package/dist/docs/diff.md +5 -1
  44. package/dist/docs/discussion.md +6 -2
  45. package/dist/docs/dnd.md +4 -0
  46. package/dist/docs/docx.md +24 -15
  47. package/dist/docs/emoji.md +2 -2
  48. package/dist/docs/equation.md +9 -9
  49. package/dist/docs/examples/collaboration-example.md +4 -0
  50. package/dist/docs/examples/export.md +40 -34
  51. package/dist/docs/examples/merge.md +4 -0
  52. package/dist/docs/examples/version-history.md +4 -0
  53. package/dist/docs/external-text.md +1 -1
  54. package/dist/docs/field.md +4 -0
  55. package/dist/docs/find.md +13 -5
  56. package/dist/docs/footnote.md +21 -10
  57. package/dist/docs/format-painter.md +4 -4
  58. package/dist/docs/html.md +8 -3
  59. package/dist/docs/index.md +12 -10
  60. package/dist/docs/ink.md +7 -1
  61. package/dist/docs/installation/manual.md +2 -4
  62. package/dist/docs/installation/next.md +1 -3
  63. package/dist/docs/installation/plate-ui.md +8 -4
  64. package/dist/docs/installation/rsc.md +1 -1
  65. package/dist/docs/installation.md +4 -0
  66. package/dist/docs/link.md +4 -4
  67. package/dist/docs/llms.txt +3 -1
  68. package/dist/docs/lock.md +34 -2
  69. package/dist/docs/markdown.md +12 -7
  70. package/dist/docs/media.md +4 -4
  71. package/dist/docs/mention.md +5 -0
  72. package/dist/docs/pagination.md +4 -0
  73. package/dist/docs/prompt-editor.md +17 -1
  74. package/dist/docs/reference.md +192 -0
  75. package/dist/docs/roots.md +4 -0
  76. package/dist/docs/serializing.md +25 -2
  77. package/dist/docs/slash-command.md +58 -8
  78. package/dist/docs/static.md +29 -20
  79. package/dist/docs/suggestion.md +12 -4
  80. package/dist/docs/sync.md +16 -1
  81. package/dist/docs/table.md +36 -5
  82. package/dist/docs/text-align.md +3 -3
  83. package/dist/docs/toc.md +0 -4
  84. package/dist/docs/toolbar.md +4 -4
  85. package/dist/docs/unit-testing.md +33 -0
  86. package/dist/docs/upload.md +4 -0
  87. package/dist/docx/export/index.d.ts +7 -7
  88. package/dist/docx/export/lib/compileAst.js +334 -35
  89. package/dist/docx/export/lib/docxComments.js +26 -2
  90. package/dist/docx/export/lib/exportDocx.js +30 -30
  91. package/dist/docx/export/lib/mathOmml.js +16 -17
  92. package/dist/docx/export/lib/ooxmlBuilder.js +381 -227
  93. package/dist/docx/export/lib/outputSafety.js +9 -1
  94. package/dist/docx/export/lib/reviewProjection.js +99 -29
  95. package/dist/docx/export/lib/sourcePreservation.js +38 -51
  96. package/dist/docx/export/lib/wordStyles.js +23 -2
  97. package/dist/docx/html/cleanWordHtml.internal.js +112 -99
  98. package/dist/docx/{internal/domParser.js → html/domParser.internal.js} +1 -1
  99. package/dist/docx/import/index.d.ts +6 -6
  100. package/dist/docx/import/lib/docxComments.js +1 -1
  101. package/dist/docx/import/lib/importDocx.js +1216 -64
  102. package/dist/docx/import/lib/opcRelationships.js +11 -1
  103. package/dist/docx/import/lib/readWordDocument.js +675 -122
  104. package/dist/docx/import/lib/wordStyles.js +96 -36
  105. package/dist/docx/internal/abort.js +3 -3
  106. package/dist/docx/{export/lib → internal}/colors.js +1 -1
  107. package/dist/docx/internal/docxComments.js +1 -1
  108. package/dist/docx/internal/docxPackage.js +316 -28
  109. package/dist/docx/internal/packageParts.js +2 -2
  110. package/dist/docx/internal/readDocxNumbering.js +45 -22
  111. package/dist/docx/internal/reviewPart.js +50 -22
  112. package/dist/docx/internal/sourceEligibility.js +89 -16
  113. package/dist/docx/internal/wordMath.js +44 -39
  114. package/dist/docx/internal/xmlTree.js +27 -2
  115. package/dist/docx/internal/xmlWriter.js +1 -1
  116. package/dist/docx/paste/index.d.ts +4 -4
  117. package/dist/docx/paste/lib/WordPastePlugin.js +63 -71
  118. package/dist/dom/index.d.ts +1 -1
  119. package/dist/facade.js +3 -3
  120. package/dist/features/basic-nodes/lib/BaseMarkPlugins.js +1 -1
  121. package/dist/features/basic-styles/lib/BaseFormattingPlugin.js +61 -28
  122. package/dist/features/basic-styles/lib/BaseStylePlugins.js +68 -10
  123. package/dist/features/board/index.d.ts +1 -1
  124. package/dist/features/callout/index.d.ts +2 -160
  125. package/dist/features/callout/lib/BaseCalloutPlugin.js +109 -9
  126. package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +17 -7
  127. package/dist/features/column/index.d.ts +1 -1
  128. package/dist/features/column/lib/BaseColumnPlugin.js +163 -89
  129. package/dist/features/comments/BaseCommentsPlugin.js +80 -39
  130. package/dist/features/comments/comment-unresolved-index.internal.js +20 -10
  131. package/dist/features/comments/fitCommentBody.js +338 -0
  132. package/dist/features/comments/index.d.ts +3 -3
  133. package/dist/features/comments/index.js +2 -1
  134. package/dist/features/date/index.d.ts +3 -3
  135. package/dist/features/details/index.d.ts +3 -3
  136. package/dist/features/field/index.d.ts +1 -1
  137. package/dist/features/field/lib/BaseFieldPlugin.js +111 -53
  138. package/dist/features/field/lib/fieldCache.internal.js +9 -21
  139. package/dist/features/find/index.d.ts +7 -6
  140. package/dist/features/find/lib/BaseFindPlugin.js +226 -37
  141. package/dist/features/footnote/index.d.ts +4 -3
  142. package/dist/features/footnote/lib/BaseFootnotePlugin.js +48 -24
  143. package/dist/features/indent/lib/BaseIndentPlugin.js +23 -18
  144. package/dist/features/indent/lib/indentHtml.internal.js +30 -4
  145. package/dist/features/ink/index.d.ts +1 -1
  146. package/dist/features/link/lib/BaseLinkPlugin.js +5 -12
  147. package/dist/features/lint/index.d.ts +3 -3
  148. package/dist/features/list/lib/BaseListPlugin.js +7 -2
  149. package/dist/features/list/lib/listKeyboard.internal.js +7 -2
  150. package/dist/features/list/lib/listMarkdown.internal.js +23 -27
  151. package/dist/features/lock/index.d.ts +1 -1
  152. package/dist/features/lock/lib/BaseLockPlugin.js +40 -11
  153. package/dist/features/media/index.d.ts +1 -1
  154. package/dist/features/media/lib/image/BaseImagePlugin.js +27 -13
  155. package/dist/features/mention/index.d.ts +1 -1
  156. package/dist/features/reference/index.d.ts +236 -0
  157. package/dist/features/reference/index.js +2 -0
  158. package/dist/features/reference/lib/BaseReferencePlugin.js +589 -0
  159. package/dist/features/table/index.d.ts +2 -2
  160. package/dist/features/table/lib/BaseTablePlugin.js +3 -48
  161. package/dist/features/table/lib/internal/mutation.js +4 -2
  162. package/dist/features/table/lib/internal/paste.js +4 -3
  163. package/dist/features/toc/index.d.ts +1 -1
  164. package/dist/features/upload/index.d.ts +1 -1
  165. package/dist/history/index.d.ts +1 -1
  166. package/dist/html/index.d.ts +4 -4
  167. package/dist/html/server/index.d.ts +2 -2
  168. package/dist/html/server/index.js +1 -1
  169. package/dist/html/server/serverCssParser.internal.js +17 -145
  170. package/dist/html/server/serverCssStyle.internal.js +16 -10
  171. package/dist/{htmlConversion-CSKHZpPj.d.ts → htmlConversion-CRnxMGw-.d.ts} +2 -2
  172. package/dist/{htmlTypes-BWVmZblT.d.ts → htmlTypes-3laowz-3.d.ts} +3 -3
  173. package/dist/hyperscript/index.d.ts +1 -1
  174. package/dist/{index-BcyYN0cZ.d.ts → index-B3VOCxNR.d.ts} +6 -8
  175. package/dist/{index-DgPZlAbx.d.ts → index-B9UlNijk.d.ts} +2 -2
  176. package/dist/{index-hWp8X22M.d.ts → index-BJPT0Tv_.d.ts} +11 -9
  177. package/dist/{index-BufRKKbx-D3xRkmBz.d.ts → index-BKPWmnLg-Bp_vItjr.d.ts} +1 -1
  178. package/dist/{index-BXvEAvgI.d.ts → index-BcD2RAB9.d.ts} +3 -3
  179. package/dist/{index-BnxfTW_D.d.ts → index-C5Xw3JDc.d.ts} +1 -1
  180. package/dist/{index-SOntT3DN.d.ts → index-CAshLTjV.d.ts} +103 -4
  181. package/dist/{index-YycKj5Rf.d.ts → index-CHlITvuq.d.ts} +7 -7
  182. package/dist/index-CKSwab_O.d.ts +1 -0
  183. package/dist/{index-Cov2Zhgo.d.ts → index-CRQoHk18.d.ts} +3 -3
  184. package/dist/index-CyY3O6c7.d.ts +3 -0
  185. package/dist/index-D8EGVCeT.d.ts +305 -0
  186. package/dist/{index-D0hlRs2L-CIw3VG6r.d.ts → index-DAKucat0--VOaL_NN.d.ts} +4 -4
  187. package/dist/{index-nO2mlsRF.d.ts → index-DCTRNYwy.d.ts} +2 -2
  188. package/dist/{index-Dsj3VBEr.d.ts → index-DQpHoxDX.d.ts} +1 -1
  189. package/dist/{index-BYUrsInt.d.ts → index-DTd1D-BF.d.ts} +3 -3
  190. package/dist/index-DUhUT9bV.d.ts +1 -0
  191. package/dist/{index-Cnj81Ocd.d.ts → index-DXm_v0Qq.d.ts} +3 -3
  192. package/dist/{index-Bwli-ZAF.d.ts → index-Djwcl0Ff.d.ts} +3 -3
  193. package/dist/{index-CsmfJqlG.d.ts → index-Dyw6BJx8.d.ts} +3 -3
  194. package/dist/{index-C_c8FQDA.d.ts → index-KG95XVaC.d.ts} +26 -5
  195. package/dist/{index-BwvwktHw-CcWHZqCi.d.ts → index-LEcSTRgn-BR_p4GVY.d.ts} +2 -2
  196. package/dist/{index-QhGbk8ma.d.ts → index-k-wvVxKl.d.ts} +2 -2
  197. package/dist/{index-BC79Ewsl.d.ts → index-s34W6hUI.d.ts} +5 -5
  198. package/dist/{index-DOdoRr4z.d.ts → index-wEkvA-wI.d.ts} +58 -31
  199. package/dist/index.d.ts +3 -3
  200. package/dist/internal/comments/comment-anchor.internal.js +4 -0
  201. package/dist/internal/plugin/conversionLaws.js +41 -13
  202. package/dist/internal/plugin/createPlateRuntimePlugins.js +5 -2
  203. package/dist/internal/plugin/endMatterPartition.js +28 -0
  204. package/dist/internal/plugin/plateRuntime.js +3 -1
  205. package/dist/internal/plugin/pluginDescriptorSnapshot.js +1 -0
  206. package/dist/internal/plugin/pluginInjectNodeProps.js +33 -5
  207. package/dist/internal/plugin/resolvePlugin.js +2 -1
  208. package/dist/internal/utils/urlPolicy.js +19 -2
  209. package/dist/lib/editor/withPlite.js +21 -31
  210. package/dist/lib/plugins/dom/DOMPlugin.js +14 -11
  211. package/dist/lib/plugins/html/HtmlPlugin.js +6 -3
  212. package/dist/lib/plugins/html/cssLexer.internal.js +399 -0
  213. package/dist/lib/plugins/html/cssSafety.internal.js +100 -0
  214. package/dist/lib/plugins/html/htmlAst.js +17 -2
  215. package/dist/lib/plugins/html/htmlConversion.js +8 -4
  216. package/dist/lib/plugins/html/htmlDecode.internal.js +3 -3
  217. package/dist/lib/plugins/html/htmlDom.js +3 -4
  218. package/dist/lib/plugins/html/htmlMatcher.internal.js +1 -1
  219. package/dist/lib/plugins/html/htmlRules.internal.js +8 -59
  220. package/dist/lib/plugins/html/htmlSafety.js +30 -24
  221. package/dist/lib/plugins/html/htmlSerialize.internal.js +17 -3
  222. package/dist/lib/plugins/html/htmlStyleInline.internal.js +680 -0
  223. package/dist/lib/plugins/html/htmlWhitespace.internal.js +1 -1
  224. package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +27 -1
  225. package/dist/markdown/index.d.ts +1 -1
  226. package/dist/markdown/lib/MarkdownPlugin.js +33 -37
  227. package/dist/markdown/lib/internal/markdownAttributes.js +18 -8
  228. package/dist/markdown/lib/internal/markdownDiagnostics.js +14 -3
  229. package/dist/markdown/lib/internal/markdownDocument.js +2 -2
  230. package/dist/markdown/lib/internal/markdownIntrinsics.js +1 -3
  231. package/dist/markdown/lib/internal/markdownLine.js +42 -28
  232. package/dist/markdown/lib/internal/markdownMappings.js +131 -19
  233. package/dist/markdown/lib/internal/markdownParse.js +40 -77
  234. package/dist/markdown/lib/internal/markdownRuntime.js +13 -8
  235. package/dist/markdown/lib/internal/markdownStream.js +10 -18
  236. package/dist/markdown/lib/internal/markdownTailHeal.js +69 -42
  237. package/dist/markdown/lib/serializer/convertNodesSerialize.js +10 -10
  238. package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +16 -1
  239. package/dist/markdown/lib/serializer/listToMdastTree.js +7 -6
  240. package/dist/math/index.d.ts +3 -3
  241. package/dist/math/react/index.d.ts +4 -4
  242. package/dist/migrations/index.d.ts +4 -4
  243. package/dist/migrations/migratePlateV54Urls.internal.js +63 -1
  244. package/dist/pagination/index.d.ts +1 -1
  245. package/dist/pagination/react/index.d.ts +3 -3
  246. package/dist/plain-text.js +10 -4
  247. package/dist/{protocol-CikFZBQT-CkSt_wOg.d.ts → protocol-Cp9xayOe-0OSfTMnt.d.ts} +1 -1
  248. package/dist/react/authored/AuthoredReactPlugin.js +4 -3
  249. package/dist/react/authored/index.d.ts +12 -9
  250. package/dist/react/authored/useAuthored.js +57 -21
  251. package/dist/react/components/NodeSelection.js +6 -30
  252. package/dist/react/components/PlateView.js +7 -1
  253. package/dist/react/features/board/boardCamera.internal.js +1 -1
  254. package/dist/react/features/board/boardClipboard.internal.js +5 -8
  255. package/dist/react/features/board/boardGesture.internal.js +1 -1
  256. package/dist/react/features/board/boardKeys.internal.js +1 -1
  257. package/dist/react/features/board/boardLanding.internal.js +1 -1
  258. package/dist/react/features/board/index.d.ts +5 -5
  259. package/dist/react/features/callout/index.d.ts +93 -4
  260. package/dist/react/features/column/index.d.ts +172 -9
  261. package/dist/react/features/combobox/combobox.internal.js +35 -22
  262. package/dist/react/features/combobox/comboboxOwner.internal.js +29 -2
  263. package/dist/react/features/combobox/index.d.ts +8 -6
  264. package/dist/react/features/comments/index.d.ts +8 -8
  265. package/dist/react/features/comments/useCommentThreadIndex.js +23 -9
  266. package/dist/react/features/date/index.d.ts +4 -4
  267. package/dist/react/features/details/index.d.ts +4 -4
  268. package/dist/react/features/field/FieldPlugin.js +2 -2
  269. package/dist/react/features/field/index.d.ts +5 -5
  270. package/dist/react/features/footnote/index.d.ts +6 -6
  271. package/dist/react/features/format-painter/FormatPainterPlugin.js +31 -38
  272. package/dist/react/features/format-painter/index.d.ts +8 -8
  273. package/dist/react/features/ink/index.d.ts +5 -5
  274. package/dist/react/features/ink/inkCapture.internal.js +2 -1
  275. package/dist/react/features/ink/inkPick.internal.js +1 -0
  276. package/dist/react/features/lock/index.d.ts +5 -5
  277. package/dist/react/features/media/index.d.ts +5 -5
  278. package/dist/react/features/mention/index.d.ts +4 -4
  279. package/dist/react/features/resizable/Resizable.js +1 -1
  280. package/dist/react/features/table/TablePlugin.js +41 -28
  281. package/dist/react/features/table/index.d.ts +8 -8
  282. package/dist/react/features/table/measureTableColumnWidths.internal.js +5 -1
  283. package/dist/react/features/table/useTableControls.js +43 -21
  284. package/dist/react/features/table/useTableResize.js +24 -9
  285. package/dist/react/features/toc/index.d.ts +2 -2
  286. package/dist/react/features/upload/UploadPlugin.js +2 -2
  287. package/dist/react/features/upload/index.d.ts +5 -5
  288. package/dist/react/index.d.ts +6 -6
  289. package/dist/react/virtualized.d.ts +3 -3
  290. package/dist/refusal-CwFxNUf7-BLhtd159.d.ts +1 -0
  291. package/dist/{registerEditorTools-CyPL0VPh.d.ts → registerEditorTools-D_3hPpTx.d.ts} +135 -98
  292. package/dist/shared-room-26tNRhZE-BLhtd159.d.ts +1 -0
  293. package/dist/skills/plate/SKILL.md +4 -3
  294. package/dist/skills/plate/references/ai-and-agents.md +4 -4
  295. package/dist/skills/plate/references/pricing.md +3 -3
  296. package/dist/skills/plate/references/setup.md +6 -0
  297. package/dist/skills/plate/references/ui-and-sync.md +4 -2
  298. package/dist/{source-pnhMdrj3.d.ts → source-BW7JD_oS.d.ts} +5 -3
  299. package/dist/static/components/EditorStatic.js +60 -7
  300. package/dist/static/components/plite-nodes.js +0 -2
  301. package/dist/static/index.d.ts +23 -9
  302. package/dist/static/internal/staticDocumentView.js +72 -20
  303. package/dist/static/internal/staticPendingMedia.internal.js +30 -46
  304. package/dist/static/internal/staticPresentation.js +8 -17
  305. package/dist/static/internal/staticViewState.internal.js +47 -0
  306. package/dist/static/pipeRenderElementStatic.internal.js +0 -1
  307. package/dist/static/pluginRenderElementStatic.internal.js +0 -1
  308. package/dist/static/pluginRenderMarkStatic.internal.js +90 -0
  309. package/dist/static/renderStaticHtml.js +87 -36
  310. package/dist/{storage-Be0SAaPi-CAmIGvmd.d.ts → storage-C7xSH1I5-BJLoUfo9.d.ts} +2 -2
  311. package/dist/sync/cloudflare/index.d.ts +3 -3
  312. package/dist/sync/index.d.ts +5 -5
  313. package/dist/sync/index.js +2 -2
  314. package/dist/sync/postgres/index.d.ts +1 -1
  315. package/dist/sync/react/index.d.ts +12 -12
  316. package/dist/sync/server/index.d.ts +5 -5
  317. package/dist/tabbable/react/TabbableEffects.internal.js +7 -7
  318. package/dist/tabbable/react/index.d.ts +4 -4
  319. package/dist/testing/index.d.ts +3 -3
  320. package/dist/{transport-DhoWUkMZ-Dg4M_Ihs.d.ts → transport-B-ON68Y4-DCfT5-eN.d.ts} +1 -1
  321. package/dist/{tx-only-mEsamESa-Bzy5hDat.d.ts → tx-only-sIj7BcYh-BMFkGMuq.d.ts} +28 -2
  322. package/dist/utils/plate-keys.js +1 -0
  323. package/dist/{widths-Dlj60VjK.d.ts → widths-9NNziDRW.d.ts} +5 -5
  324. package/package.json +10 -7
  325. package/dist/clipboard-format-key-C8pLG2_c-D8fWV8GB.d.ts +0 -1
  326. package/dist/index-B3oYKAuz.d.ts +0 -1
  327. package/dist/index-BTjtVYbH.d.ts +0 -1
  328. package/dist/index-z7QR7V33.d.ts +0 -3
  329. package/dist/refusal-C6nSOIMX-D8fWV8GB.d.ts +0 -1
  330. package/dist/shared-room-BxXvrWve-D8fWV8GB.d.ts +0 -1
  331. package/dist/static/pluginRenderLeafStatic.internal.js +0 -82
  332. package/dist/static/pluginRenderTextStatic.internal.js +0 -83
@@ -1,7 +1,7 @@
1
- import { $o as Range, Hc as StateFieldValueInput, Hl as Value, Jc as Text, O as DecorationAttributes, Oi as HistoryOutcome, Ol as TransferPlugin, Qa as Plugin, Wa as Path, Yi as NamedRootKey, _l as TransferCheck, _t as EditorDocumentValue, bl as TransferInput, d as AnyEditor, fo as PluginDependencyContractReference, fs as RootKey, gi as Element$1, gl as TransferApi, ja as NodeTarget, ma as NodeKey, mo as PluginDependencyReferenceFor, ti as EditorUpdatePolicy, tr as EditorSelectorDependencies, wl as TransferOutcome, xl as TransferIntent } from "./tx-only-mEsamESa-Bzy5hDat.js";
2
- import "./htmlTypes-BWVmZblT.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-DgPZlAbx.js";
4
- import { o as Editor$2, st as BasePluginInput } from "./core-BWS1N1EV.js";
1
+ import { $o as Range, Al as TransferPlugin, Cl as TransferIntent, El as TransferOutcome, Hc as StateFieldValueInput, O as DecorationAttributes, Oi as HistoryOutcome, Qa as Plugin, Sl as TransferInput, Wa as Path, Wl as Value, Xc as Text, Yi as NamedRootKey, _t as EditorDocumentValue, d as AnyEditor, fo as PluginDependencyContractReference, fs as RootKey, gi as Element$1, ja as NodeTarget, ma as NodeKey, mo as PluginDependencyReferenceFor, ti as EditorUpdatePolicy, tr as EditorSelectorDependencies, vl as TransferApi, yl as TransferCheck } from "./tx-only-sIj7BcYh-BMFkGMuq.js";
2
+ import "./htmlTypes-3laowz-3.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-B9UlNijk.js";
4
+ import { o as Editor$2, st as BasePluginInput } from "./core-By92GWYW.js";
5
5
  import React$1, { CSSProperties, KeyboardEvent as KeyboardEvent$1, MouseEventHandler, ReactNode, Ref, RefObject, TextareaHTMLAttributes } from "react";
6
6
  type DecorationSlice = Readonly<{
7
7
  attributes: DecorationAttributes;
@@ -572,13 +572,14 @@ type EditorContentProps<TElement extends Element$1 = Element$1, TRoot extends Ro
572
572
  */
573
573
  onPasteResult?: (result: EditablePasteResult) => void;
574
574
  /**
575
- * Called once after a primary mouse press that began on this editable's own
576
- * text has its final text range: after the mouseup's import and every later
577
- * write of that press, such as a drag released outside the editable or a
578
- * click inside selected text that collapses it. Not called for a press on a
579
- * control, an external text host or a nested editor, for touch or pen, when
580
- * the press ends in a node selection, or when a key other than a modifier,
581
- * a composition, a native drag, a blur, another press or an unmount comes
575
+ * Called once after a primary pointer press (mouse, touch, or pen) that began
576
+ * on this editable's own text has its final text range: after the release's
577
+ * import and every later write of that press, such as a drag released outside
578
+ * the editable, a click inside selected text that collapses it, or a touch
579
+ * long-press word selection. Not called for a press on a control, an external
580
+ * text host or a nested editor, for a cancelled scroll or pinch, when the
581
+ * press ends in a node selection, or when a key other than a modifier, a
582
+ * composition, a native drag, a blur, another press or an unmount comes
582
583
  * first.
583
584
  */
584
585
  onPointerSelectionEnd?: EditablePointerSelectionEndHandler;
@@ -1,2 +1,2 @@
1
- import { A as EditorReadSelection, B as GetEditorToolsOptions, C as EditorIdempotencyEntry, D as EditorReadBlock, E as EditorInkPassageImage, F as EditorToolErrorCode, G as SyncServerAgentPresenceOptions, H as SyncServerAgentHost, I as EditorToolErrorResult, J as SyncServerAgentReceipt, K as SyncServerAgentPresencePoint, L as EditorToolResult, M as EditorToolAnnotation, N as EditorToolCall, O as EditorReadInkResult, P as EditorToolDefinition, Q as getEditorTools, R as EditorVisibilityFilter, S as EditorFindResult, T as EditorInkPassage, U as SyncServerAgentOptions, V as SyncServerAgentGrant, W as SyncServerAgentPresenceInput, X as createEditorAgent, Y as SyncServerAgentRunResult, Z as createSyncServerAgent, _ as EditorAgentPresence, a as HasEditableAISelectionRefs, b as EditorCommentsListResult, c as SerializeAISelectionMarkdownOptions, d as serializeAIEditContext, f as serializeAISelectionMarkdown, g as EditorAgentOptions, h as EditorAgentExecuteOptions, i as AILockedBlockRef, j as EditorSuggestionsListResult, k as EditorReadResult, l as SerializedAIEditContext, m as EditorAgentAccess, n as WebMCPProducerContext, o as LOCKED_BLOCK_PLACEHOLDER_TAG, p as EditorAgent, q as SyncServerAgentPresenceSelection, r as registerEditorTools, s as SerializeAIEditContextOptions, t as RegisterEditorToolsOptions, u as hasEditableAISelection, v as EditorAgentPresenceState, w as EditorIdempotencyStore, x as EditorDebugResult, y as EditorCommentEntry, z as EditorWriteReceipt } from "../registerEditorTools-CyPL0VPh.js";
2
- export { AILockedBlockRef, EditorAgent, EditorAgentAccess, EditorAgentExecuteOptions, EditorAgentOptions, EditorAgentPresence, EditorAgentPresenceState, EditorCommentEntry, EditorCommentsListResult, EditorDebugResult, EditorFindResult, EditorIdempotencyEntry, EditorIdempotencyStore, EditorInkPassage, EditorInkPassageImage, EditorReadBlock, EditorReadInkResult, EditorReadResult, EditorReadSelection, EditorSuggestionsListResult, EditorToolAnnotation, EditorToolCall, EditorToolDefinition, EditorToolErrorCode, EditorToolErrorResult, EditorToolResult, EditorVisibilityFilter, EditorWriteReceipt, GetEditorToolsOptions, HasEditableAISelectionRefs, LOCKED_BLOCK_PLACEHOLDER_TAG, RegisterEditorToolsOptions, SerializeAIEditContextOptions, SerializeAISelectionMarkdownOptions, SerializedAIEditContext, SyncServerAgentGrant, SyncServerAgentHost, SyncServerAgentOptions, SyncServerAgentPresenceInput, SyncServerAgentPresenceOptions, SyncServerAgentPresencePoint, SyncServerAgentPresenceSelection, SyncServerAgentReceipt, SyncServerAgentRunResult, WebMCPProducerContext, createEditorAgent, createSyncServerAgent, getEditorTools, hasEditableAISelection, registerEditorTools, serializeAIEditContext, serializeAISelectionMarkdown };
1
+ import { $ as SyncServerAgentPresencePoint, A as EditorReadBlock, B as EditorToolResult, C as EditorCommentsListResult, D as EditorIdempotencyStore, E as EditorIdempotencyEntry, F as EditorToolAnnotation, G as createEditorAgent, H as EditorVisibilityPredicate, I as EditorToolCall, J as SyncServerAgentGrant, K as createSyncServerAgent, L as EditorToolDefinition, M as EditorReadResult, N as EditorReadSelection, O as EditorInkPassage, P as EditorSuggestionsListResult, Q as SyncServerAgentPresenceOptions, R as EditorToolErrorCode, S as EditorCommentThreadItem, T as EditorFindResult, U as EditorWriteReceipt, V as EditorVisibilityFilter, W as GetEditorToolsOptions, X as SyncServerAgentOptions, Y as SyncServerAgentHost, Z as SyncServerAgentPresenceInput, _ as EditorAgentPresence, a as HasEditableAISelectionRefs, b as EditorCommentAction, c as SerializeAISelectionMarkdownOptions, d as serializeAIEditContext, et as SyncServerAgentPresenceSelection, f as serializeAISelectionMarkdown, g as EditorAgentOptions, h as EditorAgentExecuteOptions, i as AILockedBlockRef, j as EditorReadInkResult, k as EditorInkPassageImage, l as SerializedAIEditContext, m as EditorAgentAccess, n as WebMCPProducerContext, nt as SyncServerAgentRunResult, o as LOCKED_BLOCK_PLACEHOLDER_TAG, p as EditorAgent, q as getEditorTools, r as registerEditorTools, s as SerializeAIEditContextOptions, t as RegisterEditorToolsOptions, tt as SyncServerAgentReceipt, u as hasEditableAISelection, v as EditorAgentPresenceState, w as EditorDebugResult, x as EditorCommentEntry, y as EditorAgentTraceEvent, z as EditorToolErrorResult } from "../registerEditorTools-D_3hPpTx.js";
2
+ export { AILockedBlockRef, EditorAgent, EditorAgentAccess, EditorAgentExecuteOptions, EditorAgentOptions, EditorAgentPresence, EditorAgentPresenceState, EditorAgentTraceEvent, EditorCommentAction, EditorCommentEntry, EditorCommentThreadItem, EditorCommentsListResult, EditorDebugResult, EditorFindResult, EditorIdempotencyEntry, EditorIdempotencyStore, EditorInkPassage, EditorInkPassageImage, EditorReadBlock, EditorReadInkResult, EditorReadResult, EditorReadSelection, EditorSuggestionsListResult, EditorToolAnnotation, EditorToolCall, EditorToolDefinition, EditorToolErrorCode, EditorToolErrorResult, EditorToolResult, EditorVisibilityFilter, EditorVisibilityPredicate, EditorWriteReceipt, GetEditorToolsOptions, HasEditableAISelectionRefs, LOCKED_BLOCK_PLACEHOLDER_TAG, RegisterEditorToolsOptions, SerializeAIEditContextOptions, SerializeAISelectionMarkdownOptions, SerializedAIEditContext, type SyncServerAgentGrant, type SyncServerAgentHost, type SyncServerAgentOptions, type SyncServerAgentPresenceInput, type SyncServerAgentPresenceOptions, type SyncServerAgentPresencePoint, type SyncServerAgentPresenceSelection, type SyncServerAgentReceipt, type SyncServerAgentRunResult, WebMCPProducerContext, createEditorAgent, createSyncServerAgent, getEditorTools, hasEditableAISelection, registerEditorTools, serializeAIEditContext, serializeAISelectionMarkdown };
@@ -5,7 +5,7 @@ import { isListItem } from "../../features/list/lib/listIndex.internal.js";
5
5
  import { AuthoredPlugin } from "../../authored/AuthoredPlugin.js";
6
6
  import { MarkdownPlugin } from "../../markdown/lib/MarkdownPlugin.js";
7
7
  import { applyMinimalTextBlockEdits, fillEmptyListItem, landAIOutput, normalizeUnlockedListRun, suggestionBlocks } from "./aiOutputLanding.internal.js";
8
- import { findDisallowedRemoteMediaUrlsInMarkdown, hasHiddenDescendant, isPathVisible, isRangeVisible, pruneHiddenDescendants, sanitizeRemoteMediaNodes } from "./aiPolicy.internal.js";
8
+ import { findDisallowedRemoteMediaUrlsInMarkdown, hasHiddenDescendant, isEditorVisibilityFilter, isPathVisible, isRangeVisible, pruneHiddenDescendants, resolveVisibilityFilter, sanitizeRemoteMediaNodes } from "./aiPolicy.internal.js";
9
9
  import { areAIBlockTargetsContiguous, isAIPathNonWritable, resolveAISelectedBlocks } from "./lockedContext.internal.js";
10
10
  import { LOCKED_BLOCK_PLACEHOLDER_TAG } from "./lockedContext.js";
11
11
  import isEqual from "lodash/isEqual.js";
@@ -85,9 +85,10 @@ const toElementValue = (nodes) => nodes.filter((node) => ElementApi.isElement(no
85
85
  */
86
86
  const createAIDraftSession = (editor, options) => {
87
87
  if (typeof options.authorId !== "string" || options.authorId.trim().length === 0) throw new TypeError("createAIDraftSession requires a non-empty authorId.");
88
- if (options.filter !== "allow-all" && typeof options.filter !== "function") throw new TypeError("createAIDraftSession requires filter to be \"allow-all\" or a function.");
88
+ if (!isEditorVisibilityFilter(options.filter)) throw new TypeError("createAIDraftSession requires filter to be \"allow-all\", a function, or { forDocument }.");
89
89
  const { authorId } = options;
90
90
  const { filter } = options;
91
+ const currentFilter = (target = editor) => resolveVisibilityFilter(target, filter);
91
92
  const { mode } = options;
92
93
  const pinnedRoot = editor.read.view.root();
93
94
  const baselineRevision = editor.read.revision();
@@ -95,8 +96,9 @@ const createAIDraftSession = (editor, options) => {
95
96
  const capturedSelection = currentSelection ? cloneDeep(currentSelection) : null;
96
97
  const resolvedSelection = resolveAISelectedBlocks(editor);
97
98
  const initialRoots = editor.read.value().roots;
98
- const selectionContainsHiddenBlocks = resolvedSelection.entries.some(([node, path]) => !isPathVisible(editor, filter, path, pinnedRoot) || hasHiddenDescendant(filter, node, path, pinnedRoot, initialRoots));
99
- const visibleEntries = resolvedSelection.entries.filter(([node, path]) => isPathVisible(editor, filter, path, pinnedRoot) && pruneHiddenDescendants(filter, node, path, pinnedRoot) !== null);
99
+ const initialFilter = currentFilter(editor);
100
+ const selectionContainsHiddenBlocks = resolvedSelection.entries.some(([node, path]) => !isPathVisible(editor, initialFilter, path, pinnedRoot) || hasHiddenDescendant(initialFilter, node, path, pinnedRoot, initialRoots));
101
+ const visibleEntries = resolvedSelection.entries.filter(([node, path]) => isPathVisible(editor, initialFilter, path, pinnedRoot) && pruneHiddenDescendants(initialFilter, node, path, pinnedRoot) !== null);
100
102
  const selectionAnchor = capturedSelection && RangeApi.isExpanded(capturedSelection) ? editor.anchor(capturedSelection, {
101
103
  association: "inward",
102
104
  deletion: "drop"
@@ -333,7 +335,7 @@ const createAIDraftSession = (editor, options) => {
333
335
  };
334
336
  const hasHiddenEditableTarget = (entries) => {
335
337
  const { roots } = editor.read.value();
336
- return selectionContainsHiddenBlocks || entries.some(([node, path]) => hasHiddenDescendant(filter, node, path, pinnedRoot, roots));
338
+ return selectionContainsHiddenBlocks || entries.some(([node, path]) => hasHiddenDescendant(currentFilter(editor), node, path, pinnedRoot, roots));
337
339
  };
338
340
  const isRevisionCurrent = () => isTargetAnchorCurrent(getRootView());
339
341
  const landLockedSuggestion = (proposeView, rawDisallowedUrls) => {
@@ -799,7 +801,7 @@ const createAIDraftSession = (editor, options) => {
799
801
  const wasTargetAnchorCurrent = isTargetAnchorCurrent();
800
802
  const cellEntry = proposeView.read.nodes.get(cellKey, { match: ElementApi.isElement });
801
803
  if (!cellEntry || !isPathVisible(proposeView, filter, cellEntry[1], pinnedRoot)) return Object.freeze({ status: "stale" });
802
- if (hasHiddenDescendant(filter, cellEntry[0], cellEntry[1], pinnedRoot, editor.read.value().roots)) return Object.freeze({
804
+ if (hasHiddenDescendant(currentFilter(proposeView), cellEntry[0], cellEntry[1], pinnedRoot, editor.read.value().roots)) return Object.freeze({
803
805
  refusal: {
804
806
  reason: "hidden-content",
805
807
  ref: record.ref
@@ -904,7 +906,7 @@ const createAIDraftSession = (editor, options) => {
904
906
  const segments = [];
905
907
  let flat = "";
906
908
  const appendBlockTexts = (node, blockPath, clipStart, clipEnd) => {
907
- if (!pruneHiddenDescendants(filter, node, blockPath, pinnedRoot)) return;
909
+ if (!pruneHiddenDescendants(currentFilter(rootView), node, blockPath, pinnedRoot)) return;
908
910
  let addedAny = false;
909
911
  for (const [textNode, relPath] of NodeApi.texts(node)) {
910
912
  const leafPath = [...blockPath, ...relPath];
@@ -1,6 +1,38 @@
1
1
  import { PLUGINS } from "../../utils/plate-keys.js";
2
2
  import { ElementApi, SelectionApi, TextApi, createEditorView } from "../../core.js";
3
3
  //#region src/ai/lib/aiPolicy.internal.ts
4
+ const visibilityFilterCache = /* @__PURE__ */ new WeakMap();
5
+ /**
6
+ * Validate that `value` is a supported `EditorVisibilityFilter` (`'allow-all'`,
7
+ * a per-block predicate, or `{ forDocument }`).
8
+ *
9
+ * @internal
10
+ */
11
+ const isEditorVisibilityFilter = (value) => value === "allow-all" || typeof value === "function" || typeof value === "object" && value !== null && typeof value.forDocument === "function";
12
+ /**
13
+ * Compile a document-scoped `{ forDocument }` visibility filter once per stored
14
+ * document revision and cache the resulting predicate per `(filter, editor)`.
15
+ *
16
+ * @internal
17
+ */
18
+ const resolveVisibilityFilter = (editor, filter) => {
19
+ if (filter === "allow-all" || typeof filter === "function") return filter;
20
+ const revision = editor.read.revision();
21
+ let perEditor = visibilityFilterCache.get(filter);
22
+ const cached = perEditor?.get(editor);
23
+ if (cached && cached.revision === revision) return cached.predicate;
24
+ const predicate = filter.forDocument(editor.read.value());
25
+ if (typeof predicate !== "function") throw new TypeError("EditorVisibilityFilter.forDocument must return a predicate function.");
26
+ if (!perEditor) {
27
+ perEditor = /* @__PURE__ */ new WeakMap();
28
+ visibilityFilterCache.set(filter, perEditor);
29
+ }
30
+ perEditor.set(editor, {
31
+ predicate,
32
+ revision
33
+ });
34
+ return predicate;
35
+ };
4
36
  const REMOTE_URL_SCHEME_RE = /^(?:https?:|[/\\]{2})/i;
5
37
  const REMOTE_URL_BASE = "https://editor.invalid";
6
38
  const stripControlChars = (input) => {
@@ -56,10 +88,12 @@ const isElementAllowed = (filter, block, path, root) => {
56
88
  */
57
89
  const isPathVisible = (editor, filter, path, root) => {
58
90
  if (filter === "allow-all") return true;
91
+ const resolved = resolveVisibilityFilter(editor, filter);
92
+ if (resolved === "allow-all") return true;
59
93
  for (let depth = 1; depth <= path.length; depth += 1) {
60
94
  const ancestorPath = path.slice(0, depth);
61
95
  const entry = editor.read.nodes.get(ancestorPath, { match: ElementApi.isElement });
62
- if (entry && !isElementAllowed(filter, entry[0], entry[1], root)) return false;
96
+ if (entry && !isElementAllowed(resolved, entry[0], entry[1], root)) return false;
63
97
  }
64
98
  return true;
65
99
  };
@@ -158,12 +192,14 @@ const isRangeVisible = (editor, filter, range, root) => {
158
192
  path: range.focus.path
159
193
  }
160
194
  };
161
- if (!isPathVisible(view, filter, localRange.anchor.path, rangeRoot)) return false;
162
- if (!isPathVisible(view, filter, localRange.focus.path, rangeRoot)) return false;
195
+ const resolved = resolveVisibilityFilter(editor, filter);
196
+ if (resolved === "allow-all") return true;
197
+ if (!isPathVisible(view, resolved, localRange.anchor.path, rangeRoot)) return false;
198
+ if (!isPathVisible(view, resolved, localRange.focus.path, rangeRoot)) return false;
163
199
  for (const [node, path] of view.read.nodes.entries({
164
200
  at: localRange,
165
201
  match: ElementApi.isElement
166
- })) if (!isElementAllowed(filter, node, path, rangeRoot)) return false;
202
+ })) if (!isElementAllowed(resolved, node, path, rangeRoot)) return false;
167
203
  return true;
168
204
  };
169
205
  const hasChildRootRefs = (items) => {
@@ -187,6 +223,7 @@ const buildFilteredSerializeDocument = (editor, nodes, filter, options) => {
187
223
  const needsRoots = hasChildRootRefs(nodes);
188
224
  if (!includeRecords && !needsRoots) return { children: [...nodes] };
189
225
  const value = editor.read.value();
226
+ const resolved = resolveVisibilityFilter(editor, filter);
190
227
  const root = editor.read.view.root();
191
228
  let roots;
192
229
  if (needsRoots && value.roots) {
@@ -215,7 +252,7 @@ const buildFilteredSerializeDocument = (editor, nodes, filter, options) => {
215
252
  for (let index = 0; index < rootNodes.length; index += 1) {
216
253
  const child = rootNodes[index];
217
254
  if (!child || !ElementApi.isElement(child)) continue;
218
- const pruned = pruneHiddenDescendants(filter, child, [index], key);
255
+ const pruned = pruneHiddenDescendants(resolved, child, [index], key);
219
256
  if (pruned) filteredRootNodes.push(pruned);
220
257
  }
221
258
  roots ??= {};
@@ -399,4 +436,4 @@ const sanitizeRemoteMediaNodes = (nodes, allowRemoteMediaUrl) => {
399
436
  };
400
437
  };
401
438
  //#endregion
402
- export { buildFilteredSerializeDocument, findDisallowedRemoteMediaUrls, findDisallowedRemoteMediaUrlsInMarkdown, hasHiddenDescendant, isElementAllowed, isPathVisible, isRangeVisible, isRemoteMediaUrl, pruneHiddenDescendants, sanitizeRemoteMediaNodes };
439
+ export { buildFilteredSerializeDocument, findDisallowedRemoteMediaUrls, findDisallowedRemoteMediaUrlsInMarkdown, hasHiddenDescendant, isEditorVisibilityFilter, isElementAllowed, isPathVisible, isRangeVisible, isRemoteMediaUrl, pruneHiddenDescendants, resolveVisibilityFilter, sanitizeRemoteMediaNodes };