platejs 54.0.0-beta.5 → 54.0.0-beta.7

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 (265) hide show
  1. package/dist/{AIChatRequestContext-CwCmEMVV.d.ts → AIChatRequestContext-DVGOeWhQ.d.ts} +2 -2
  2. package/dist/{BaseSuggestionPlugin-CpVkv7k2.d.ts → BaseSuggestionPlugin-BRFMMyEo.d.ts} +8 -7
  3. package/dist/{PlateStatic-C7FfXu-Z.d.ts → PlateStatic-DIwBAVqF.d.ts} +3 -3
  4. package/dist/ai/index.d.ts +1 -1
  5. package/dist/ai/react/AIChatPlugin.js +12 -6
  6. package/dist/ai/react/CopilotPlugin.js +10 -5
  7. package/dist/ai/react/index.d.ts +94 -82
  8. package/dist/ai/react/useAIChat.js +41 -36
  9. package/dist/authored/index.d.ts +4 -4
  10. package/dist/code-block/codemirror/index.d.ts +1 -1
  11. package/dist/{combobox-BhhymlUs.d.ts → combobox-CfCJYKT0.d.ts} +2 -2
  12. package/dist/{comparison-types-Bvvxzxq2-08gzpgF6.d.ts → comparison-types-CsmDG5r2-z1s4gX06.d.ts} +1 -1
  13. package/dist/compiler/index.d.ts +2 -2
  14. package/dist/{core-Bu--Bog3.d.ts → core-Cqc_KzpG.d.ts} +411 -474
  15. package/dist/core.js +1 -2
  16. package/dist/diff/index.d.ts +2 -2
  17. package/dist/docs/annotations.md +41 -122
  18. package/dist/docs/api/anchor.md +15 -0
  19. package/dist/docs/api/core/plate-components.md +17 -8
  20. package/dist/docs/api/core/plate-plugin.md +1 -1
  21. package/dist/docs/api/core/plate-store.md +5 -5
  22. package/dist/docs/api/core.md +33 -65
  23. package/dist/docs/api/document-change.md +21 -0
  24. package/dist/docs/api/editor-api.md +19 -16
  25. package/dist/docs/api/editor-transforms.md +27 -8
  26. package/dist/docs/api/range.md +17 -0
  27. package/dist/docs/api/react-hooks.md +103 -130
  28. package/dist/docs/authored-changes.md +14 -15
  29. package/dist/docs/board.md +46 -35
  30. package/dist/docs/clipboard.md +11 -7
  31. package/dist/docs/comment.md +3 -1
  32. package/dist/docs/decorations.md +3 -4
  33. package/dist/docs/dnd.md +1 -1
  34. package/dist/docs/docx.md +6 -4
  35. package/dist/docs/editor-methods.md +7 -16
  36. package/dist/docs/editor.md +28 -69
  37. package/dist/docs/field.md +255 -61
  38. package/dist/docs/find.md +36 -28
  39. package/dist/docs/footnote.md +14 -8
  40. package/dist/docs/history.md +166 -12
  41. package/dist/docs/ink.md +231 -0
  42. package/dist/docs/installation/plate-ui.md +56 -14
  43. package/dist/docs/llms.txt +5 -5
  44. package/dist/docs/markdown.md +4 -3
  45. package/dist/docs/plugin-methods.md +3 -1
  46. package/dist/docs/roots.md +108 -27
  47. package/dist/docs/schema.md +5 -3
  48. package/dist/docs/selection.md +5 -0
  49. package/dist/docs/suggestion.md +29 -16
  50. package/dist/docs/table.md +2 -2
  51. package/dist/docs/toc.md +2 -2
  52. package/dist/docs/toolbar.md +11 -2
  53. package/dist/docx/export/index.d.ts +3 -3
  54. package/dist/docx/export/lib/comments.js +124 -44
  55. package/dist/docx/export/lib/exportDocx.js +31 -22
  56. package/dist/docx/export/lib/hostIndex.js +92 -0
  57. package/dist/docx/export/lib/internal/unit-conversion.js +1 -1
  58. package/dist/docx/export/lib/internal/xml-builder.js +1 -1
  59. package/dist/docx/export/lib/reviewProjection.js +154 -55
  60. package/dist/docx/import/index.d.ts +4 -4
  61. package/dist/docx/paste/index.d.ts +4 -4
  62. package/dist/dom/index.d.ts +2 -2
  63. package/dist/dom/plite-dom.internal.js +2 -2
  64. package/dist/excalidraw/index.d.ts +3 -3
  65. package/dist/excalidraw/react/index.d.ts +3 -3
  66. package/dist/facade.js +3 -3
  67. package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +4 -2
  68. package/dist/features/basic-styles/lib/BaseFormattingPlugin.js +5 -2
  69. package/dist/features/board/index.d.ts +2 -2
  70. package/dist/features/board/index.js +2 -1
  71. package/dist/features/board/lib/BaseBoardPlugin.js +80 -22
  72. package/dist/features/board/lib/BaseBoardTextPlugin.js +12 -0
  73. package/dist/features/board/lib/boardArrow.internal.js +2 -2
  74. package/dist/features/board/lib/boardHeights.internal.js +57 -0
  75. package/dist/features/board/lib/boardHtml.internal.js +18 -1
  76. package/dist/features/board/lib/boardMember.internal.js +2 -2
  77. package/dist/features/board/lib/boardShape.internal.js +6 -1
  78. package/dist/features/board/lib/boardStyle.internal.js +5 -1
  79. package/dist/features/board/lib/boardTypes.internal.js +4 -1
  80. package/dist/features/callout/index.d.ts +3 -3
  81. package/dist/features/combobox/index.d.ts +2 -2
  82. package/dist/features/comments/BaseCommentsPlugin.js +47 -227
  83. package/dist/features/comments/comment-thread-index.internal.js +822 -0
  84. package/dist/features/comments/index.d.ts +2 -2
  85. package/dist/features/date/index.d.ts +3 -3
  86. package/dist/features/details/index.d.ts +3 -3
  87. package/dist/features/field/index.d.ts +2 -2
  88. package/dist/features/field/index.js +2 -2
  89. package/dist/features/field/lib/BaseFieldPlugin.js +242 -76
  90. package/dist/features/field/lib/applyFieldValues.js +342 -93
  91. package/dist/features/field/lib/fieldRules.internal.js +583 -82
  92. package/dist/features/find/index.d.ts +15 -16
  93. package/dist/features/find/lib/BaseFindPlugin.js +871 -123
  94. package/dist/features/footnote/index.d.ts +1 -1
  95. package/dist/features/footnote/lib/BaseFootnotePlugin.js +35 -15
  96. package/dist/features/ink/index.d.ts +2 -2
  97. package/dist/features/ink/lib/BaseInkPlugin.js +432 -74
  98. package/dist/features/ink/lib/inkAnchor.internal.js +436 -0
  99. package/dist/features/ink/lib/inkCodec.internal.js +16 -1
  100. package/dist/features/ink/lib/inkGone.internal.js +8 -6
  101. package/dist/features/ink/lib/inkMatch.internal.js +293 -58
  102. package/dist/features/ink/lib/inkPlaces.internal.js +73 -27
  103. package/dist/features/ink/lib/inkReflow.internal.js +406 -0
  104. package/dist/features/layout/index.d.ts +1 -1
  105. package/dist/features/lint/index.d.ts +16 -16
  106. package/dist/features/list/lib/BaseListPlugin.js +2 -1
  107. package/dist/features/list/lib/listIndex.internal.js +1 -1
  108. package/dist/features/list/lib/listNumbering.internal.js +1 -1
  109. package/dist/features/media/index.d.ts +1 -1
  110. package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +2 -1
  111. package/dist/features/mention/index.d.ts +5 -5
  112. package/dist/features/suggestion/BaseSuggestionPlugin.js +3 -2
  113. package/dist/features/suggestion/index.d.ts +5 -4
  114. package/dist/features/suggestion/suggestionColorOf.js +5 -4
  115. package/dist/features/table/index.d.ts +1 -1
  116. package/dist/features/table/lib/BaseTablePlugin.js +284 -142
  117. package/dist/features/table/lib/internal/selection.js +1 -1
  118. package/dist/features/toc/index.d.ts +1 -1
  119. package/dist/features/upload/index.d.ts +1 -1
  120. package/dist/features/upload/lib/BaseUploadPlugin.js +5 -4
  121. package/dist/history/index.d.ts +3 -3
  122. package/dist/history/index.js +2 -1
  123. package/dist/html/index.d.ts +3 -3
  124. package/dist/html/server/index.d.ts +1 -1
  125. package/dist/{htmlTypes-aE9Qlenu.d.ts → htmlTypes-i_FBCMf2.d.ts} +2 -2
  126. package/dist/hyperscript/index.d.ts +1 -1
  127. package/dist/{index-dpi2ErEe.d.ts → index-1PlYsibA.d.ts} +11 -12
  128. package/dist/{index-DqpzKYwP.d.ts → index-1rcWTB-o.d.ts} +3 -3
  129. package/dist/{index-BT1-fX5o.d.ts → index-B4ZhSQdk.d.ts} +41 -41
  130. package/dist/{index-BR2S-6Js.d.ts → index-BI0NS7kx.d.ts} +3 -3
  131. package/dist/{index-CTwrWir_.d.ts → index-BWCC4DCP.d.ts} +2 -12
  132. package/dist/{index-CGUt4h_4.d.ts → index-Bv13FX9o.d.ts} +32 -32
  133. package/dist/{index-Bf6EwY5O.d.ts → index-By7BkzIN.d.ts} +2 -2
  134. package/dist/{index-C9WSACSv.d.ts → index-CJGkjkH6.d.ts} +1 -1
  135. package/dist/{index-DqKFQcfb.d.ts → index-CLNem74G.d.ts} +25 -8
  136. package/dist/{index-DhurStYU.d.ts → index-CS4G_W_R.d.ts} +1 -1
  137. package/dist/{index-BwmXxqbi-COlJb0HZ.d.ts → index-CTTjpWgb-Fdrn8NP4.d.ts} +1 -1
  138. package/dist/{index-CYR4jNU7.d.ts → index-CVAHIQ3p.d.ts} +5 -5
  139. package/dist/{index-CeVE8JR-.d.ts → index-Cc2ajXAd.d.ts} +7 -7
  140. package/dist/index-CmISVYmz.d.ts +389 -0
  141. package/dist/{index-BYAqyTSY.d.ts → index-CrJ9Km8W.d.ts} +2 -2
  142. package/dist/{index-DgVsTFYL.d.ts → index-CxG1Atvg.d.ts} +298 -38
  143. package/dist/{index-DlBey0zf.d.ts → index-DNXr_SN-.d.ts} +9 -7
  144. package/dist/{index-DhVOU0pS.d.ts → index-DfkFmApH.d.ts} +303 -387
  145. package/dist/{index-CbcYN_S_.d.ts → index-KteL56rA.d.ts} +338 -219
  146. package/dist/{index-BXs4598V.d.ts → index-OMa7dlcS.d.ts} +35 -33
  147. package/dist/{index-DFvzP8N_.d.ts → index-uVbqCpDa.d.ts} +149 -130
  148. package/dist/index.d.ts +4 -4
  149. package/dist/index.js +1 -2
  150. package/dist/internal/penStroke.internal.js +28 -3
  151. package/dist/internal/plugin/OverridePlugin.js +2 -0
  152. package/dist/internal/plugin/compilePlateModel.js +17 -9
  153. package/dist/internal/plugin/plateChangeHandlers.js +1 -1
  154. package/dist/internal/plugin/pluginStore.js +0 -3
  155. package/dist/internal/plugin/resolvePlugin.js +10 -1
  156. package/dist/internal/plugin/resolvePlugins.js +1 -1
  157. package/dist/lib/editor/withPlite.js +33 -3
  158. package/dist/lib/plugin/createPluginContext.internal.js +2 -3
  159. package/dist/lib/plugins/dom/DOMPlugin.js +6 -2
  160. package/dist/lib/plugins/html/HtmlPlugin.js +6 -3
  161. package/dist/lib/plugins/input-rules/createInputRules.js +3 -3
  162. package/dist/lib/utils/getInjectMatch.js +1 -1
  163. package/dist/markdown/index.d.ts +1 -1
  164. package/dist/markdown/lib/deserializer/convertNodesDeserialize.js +2 -2
  165. package/dist/markdown/lib/internal/markdownConversion.js +7 -17
  166. package/dist/markdown/lib/internal/markdownRawHtml.js +1 -1
  167. package/dist/markdown/lib/serializer/convertNodesSerialize.js +1 -1
  168. package/dist/markdown/lib/serializer/listToMdastTree.js +1 -1
  169. package/dist/math/index.d.ts +3 -3
  170. package/dist/math/react/index.d.ts +4 -4
  171. package/dist/migrations/documentMigrations.js +23 -5
  172. package/dist/migrations/index.d.ts +3 -3
  173. package/dist/migrations/migratePlateV54Ast.internal.js +4 -1
  174. package/dist/migrations/migratePlateV54Profile.internal.js +0 -4
  175. package/dist/pagination/index.d.ts +1 -1
  176. package/dist/pagination/react/PagedEditorContent.js +6 -6
  177. package/dist/pagination/react/index.d.ts +16 -13
  178. package/dist/react/components/NodeSelection.js +129 -50
  179. package/dist/react/components/Plate.js +142 -119
  180. package/dist/react/components/PlateContainer.js +51 -47
  181. package/dist/react/components/PlateContent.js +3 -3
  182. package/dist/react/core.js +3 -4
  183. package/dist/react/editor/getPlateCorePlugins.internal.js +1 -1
  184. package/dist/react/editor/withPlate.js +10 -4
  185. package/dist/react/features/board/BoardPlugin.js +7 -1
  186. package/dist/react/features/board/BoardShape.js +422 -146
  187. package/dist/react/features/board/BoardSurface.js +2 -2
  188. package/dist/react/features/board/boardExport.internal.js +225 -80
  189. package/dist/react/features/board/boardGesture.internal.js +193 -33
  190. package/dist/react/features/board/boardIndex.internal.js +273 -27
  191. package/dist/react/features/board/boardInk.internal.js +2 -13
  192. package/dist/react/features/board/boardKeys.internal.js +7 -3
  193. package/dist/react/features/board/boardPick.internal.js +3 -2
  194. package/dist/react/features/board/boardPreview.internal.js +56 -8
  195. package/dist/react/features/board/boardResize.internal.js +110 -28
  196. package/dist/react/features/board/boardSnap.internal.js +14 -9
  197. package/dist/react/features/board/boardView.internal.js +440 -24
  198. package/dist/react/features/board/boardVoice.internal.js +1 -0
  199. package/dist/react/features/board/index.d.ts +369 -77
  200. package/dist/react/features/board/index.js +3 -3
  201. package/dist/react/features/callout/index.d.ts +3 -3
  202. package/dist/react/features/combobox/index.d.ts +5 -5
  203. package/dist/react/features/comments/index.d.ts +66 -65
  204. package/dist/react/features/date/index.d.ts +4 -4
  205. package/dist/react/features/details/index.d.ts +5 -5
  206. package/dist/react/features/field/FieldPlugin.js +3 -3
  207. package/dist/react/features/field/index.d.ts +87 -92
  208. package/dist/react/features/footnote/index.d.ts +63 -60
  209. package/dist/react/features/format-painter/index.d.ts +4 -4
  210. package/dist/react/features/ink/InkContent.js +113 -60
  211. package/dist/react/features/ink/InkCopyView.js +13 -2
  212. package/dist/react/features/ink/InkPlugin.js +87 -6
  213. package/dist/react/features/ink/index.d.ts +366 -160
  214. package/dist/react/features/ink/inkCapture.internal.js +39 -10
  215. package/dist/react/features/ink/inkImages.internal.js +263 -0
  216. package/dist/react/features/ink/inkMeasure.internal.js +25 -12
  217. package/dist/react/features/ink/inkPaint.internal.js +38 -23
  218. package/dist/react/features/ink/inkPick.internal.js +243 -0
  219. package/dist/react/features/ink/inkPlacement.internal.js +190 -40
  220. package/dist/react/features/ink/inkWatch.internal.js +1 -1
  221. package/dist/react/features/layout/index.d.ts +6 -6
  222. package/dist/react/features/list/ListPlugin.js +10 -6
  223. package/dist/react/features/media/index.d.ts +26 -26
  224. package/dist/react/features/mention/index.d.ts +6 -6
  225. package/dist/react/features/suggestion/index.d.ts +6 -6
  226. package/dist/react/features/suggestion/suggestion-view.internal.js +38 -36
  227. package/dist/react/features/suggestion/useSuggestion.js +17 -14
  228. package/dist/react/features/table/TablePlugin.js +12 -5
  229. package/dist/react/features/table/index.d.ts +20 -22
  230. package/dist/react/features/table/useTableResize.js +4 -4
  231. package/dist/react/features/toc/index.d.ts +2 -2
  232. package/dist/react/features/upload/index.d.ts +44 -44
  233. package/dist/react/index.d.ts +5 -6
  234. package/dist/react/index.js +3 -4
  235. package/dist/react/internal/plate-context.js +13 -42
  236. package/dist/react/internal/plite-components.js +2 -2
  237. package/dist/react/internal/rendered-attributes.js +1 -1
  238. package/dist/react/internal/usePlateModelRevision.js +2 -3
  239. package/dist/react/plite-react.js +2 -2
  240. package/dist/react/stores/element/useElementStore.js +78 -52
  241. package/dist/react/stores/plate/useEditor.js +70 -32
  242. package/dist/react/stores/plate/useEditorSelector.js +193 -53
  243. package/dist/react/utils/BlockPlaceholderPlugin.js +10 -4
  244. package/dist/react/virtualized.d.ts +4 -4
  245. package/dist/react/virtualized.js +2 -2
  246. package/dist/root.js +1 -2
  247. package/dist/{source-GMnTi_Vr.d.ts → source-Dcgqj5Mf.d.ts} +3 -3
  248. package/dist/static/components/PlateStatic.js +13 -2
  249. package/dist/static/index.d.ts +6 -6
  250. package/dist/static/internal/staticDocumentView.js +67 -1
  251. package/dist/static/pluginRenderTextStatic.internal.js +2 -1
  252. package/dist/tabbable/index.d.ts +1 -1
  253. package/dist/tabbable/react/index.d.ts +3 -3
  254. package/dist/testing/index.d.ts +2 -2
  255. package/dist/{index-QuqD4Dyj-DlOIX0sH.d.ts → tx-only-1FM45FSj-D40jacZv.d.ts} +6959 -6645
  256. package/dist/yjs/index.d.ts +1 -1
  257. package/dist/yjs/react/index.d.ts +5 -5
  258. package/package.json +2 -6
  259. package/dist/docs/migration/plite-to-plate.md +0 -251
  260. package/dist/features/comments/plite-comments.internal.js +0 -2
  261. package/dist/index-Be_YFFLS.d.ts +0 -316
  262. package/dist/index-CRmyGzS8-BTrk6JzL.d.ts +0 -65
  263. package/dist/lib/plugins/element-id/ElementIdPlugin.js +0 -43
  264. package/dist/lib/plugins/element-id/elementIdAdmission.internal.js +0 -34
  265. package/dist/react/libs/jotai.js +0 -3
@@ -1,5 +1,5 @@
1
- import { $a as Path, Fc as Selection, La as NodeSelectionMode, ps as Range, su as Value } from "./index-QuqD4Dyj-DlOIX0sH.js";
2
- import "./core-Bu--Bog3.js";
1
+ import { Wa as NodeSelectionMode, Yc as Selection, bs as Range, oo as Path, xu as Value } from "./tx-only-1FM45FSj-D40jacZv.js";
2
+ import "./core-Cqc_KzpG.js";
3
3
  type AIToolName = 'comment' | 'edit' | 'generate' | null;
4
4
  /** Request-local reference into `AIChatRequestContext.children`. */
5
5
  type AIChatRequestNodeRef = Readonly<{
@@ -1,7 +1,7 @@
1
- import { Ca as NodeKey, Ji as Location, iu as TxDeclaredMethod, oo as Plugin, ou as TxOnlyMethod } from "./index-QuqD4Dyj-DlOIX0sH.js";
2
- import "./htmlTypes-aE9Qlenu.js";
3
- import { Co as PluginReference, V as InternalBasePluginRuntimeExtension, _ as BasePlugin, aa as BasePluginDependencyReferenceFor, xo as PluginDependency } from "./core-Bu--Bog3.js";
4
- import { S as AuthoredView, _ as AuthoredPlugin, b as AuthoredResult, c as AuthoredDecision, h as AuthoredPage, m as AuthoredOutcome, n as AuthoredChangeDetails, o as AuthoredChangesDelta, r as AuthoredChangeGroup, t as AuthoredChange, u as AuthoredGroupDetails, v as AuthoredQuery, x as AuthoredReview, y as AuthoredRefusal } from "./index-DqKFQcfb.js";
1
+ import { Aa as NodeKey, bu as TxOnlyMethod, po as Plugin, ta as Location, vu as TxDeclaredMethod } from "./tx-only-1FM45FSj-D40jacZv.js";
2
+ import "./htmlTypes-i_FBCMf2.js";
3
+ import { $i as BasePluginDependencyReferenceFor, H as InternalBasePluginRuntimeExtension, go as PluginReference, mo as PluginDependency, v as BasePlugin } from "./core-Cqc_KzpG.js";
4
+ import { S as AuthoredView, _ as AuthoredPlugin, b as AuthoredResult, c as AuthoredDecision, h as AuthoredPage, m as AuthoredOutcome, n as AuthoredChangeDetails, o as AuthoredChangesDelta, r as AuthoredChangeGroup, t as AuthoredChange, u as AuthoredGroupDetails, v as AuthoredQuery, x as AuthoredReview, y as AuthoredRefusal } from "./index-CLNem74G.js";
5
5
  /** Paints each node's pending authored changes as `data-editor-authored-*` attributes. */
6
6
  declare const BaseSuggestionPlugin: BasePlugin<Readonly<{
7
7
  inject: true;
@@ -29,6 +29,7 @@ declare const BaseSuggestionPlugin: BasePlugin<Readonly<{
29
29
  }>) => readonly AuthoredChangeGroup[];
30
30
  groupOf: (changeId: string) => AuthoredChangeGroup | null;
31
31
  outcome: (id: string) => AuthoredOutcome | null;
32
+ gridLocked: (node: unknown) => boolean;
32
33
  reviewOf: (node: unknown) => AuthoredReview;
33
34
  }>> & Readonly<Record<"update", {
34
35
  decide: TxDeclaredMethod<(decisions: AuthoredDecision | readonly AuthoredDecision[]) => AuthoredResult>;
@@ -49,7 +50,7 @@ declare const BaseSuggestionPlugin: BasePlugin<Readonly<{
49
50
  };
50
51
  };
51
52
  }> & Readonly<{
52
- name: "authored-records";
53
+ name: "authoredRecords";
53
54
  }>>>, "enabled" | "name">> & PluginDependency<never>];
54
55
  }>> & Pick<InternalBasePluginRuntimeExtension<BasePlugin<Readonly<{}> & Readonly<{
55
56
  name: "authored";
@@ -66,7 +67,7 @@ declare const BaseSuggestionPlugin: BasePlugin<Readonly<{
66
67
  };
67
68
  };
68
69
  }> & Readonly<{
69
- name: "authored-records";
70
+ name: "authoredRecords";
70
71
  }>>>];
71
72
  }> & Readonly<Record<never, never>>>, Readonly<{}> & Readonly<{
72
73
  name: "authored";
@@ -83,7 +84,7 @@ declare const BaseSuggestionPlugin: BasePlugin<Readonly<{
83
84
  };
84
85
  };
85
86
  }> & Readonly<{
86
- name: "authored-records";
87
+ name: "authoredRecords";
87
88
  }>>>];
88
89
  }> & Readonly<Record<never, never>>, AuthoredPlugin>, "~schema.plugins">];
89
90
  }> & Readonly<Record<never, never>>>;
@@ -1,6 +1,6 @@
1
- import { Tt as EditorDocumentValue } from "./index-QuqD4Dyj-DlOIX0sH.js";
2
- import "./htmlTypes-aE9Qlenu.js";
3
- import { u as Editor } from "./core-Bu--Bog3.js";
1
+ import { Tt as EditorDocumentValue } from "./tx-only-1FM45FSj-D40jacZv.js";
2
+ import "./htmlTypes-i_FBCMf2.js";
3
+ import { u as Editor } from "./core-Cqc_KzpG.js";
4
4
  import React$1 from "react";
5
5
  type EditorStaticProps<E = Editor> = {
6
6
  /**
@@ -1,2 +1,2 @@
1
- import { a as AIToolName, i as AIChatRequestRefs, n as AIChatRequestNodeRef, o as resolveAIChatRequestContext, r as AIChatRequestNodeSelection, t as AIChatRequestContext } from "../AIChatRequestContext-CwCmEMVV.js";
1
+ import { a as AIToolName, i as AIChatRequestRefs, n as AIChatRequestNodeRef, o as resolveAIChatRequestContext, r as AIChatRequestNodeSelection, t as AIChatRequestContext } from "../AIChatRequestContext-DVGOeWhQ.js";
2
2
  export { AIChatRequestContext, AIChatRequestNodeRef, AIChatRequestNodeSelection, AIChatRequestRefs, AIToolName, resolveAIChatRequestContext };
@@ -161,7 +161,8 @@ const AIChatPlugin = definePlugin(PLUGINS.aiChat, {
161
161
  const selectionPath = state.selection.nodes().at(-1)?.[1] ?? selection?.focus.path;
162
162
  const path = generated?.[1] ?? selectionPath?.slice(0, 1) ?? [0];
163
163
  const entry = state.nodes.get(path, { match: ElementApi.isElement });
164
- const containerTypes = /* @__PURE__ */ new Set([...columnGroup ? [columnGroup.schema.type] : [], ...tablePlugin.installed ? [tablePlugin.schema.type] : []]);
164
+ const columnGroupSchema = columnGroup?.schema;
165
+ const containerTypes = /* @__PURE__ */ new Set([...columnGroupSchema && "type" in columnGroupSchema ? [columnGroupSchema.type] : [], ...tablePlugin.installed ? [tablePlugin.schema.type] : []]);
165
166
  return entry && containerTypes.has(entry[0].type) ? state.nodes.above()?.[1] ?? path : path;
166
167
  };
167
168
  const getInsertStart = (state) => {
@@ -212,11 +213,16 @@ const AIChatPlugin = definePlugin(PLUGINS.aiChat, {
212
213
  const view = projectEditorView(editor, root ? { root } : {});
213
214
  const { chatNodes } = context.store.get();
214
215
  const restored = suggestionTarget.paths.map((path) => view.read.nodes.get(path, { match: ElementApi.isElement })?.[0]);
215
- if (restored.length !== chatNodes.length || !restored.every((node, index) => node !== void 0 && node.type === chatNodes[index].node.type && NodeApi.string(node) === NodeApi.string(chatNodes[index].node))) return;
216
- context.store.set({ chatNodes: chatNodes.map((chatNode, index) => ({
217
- ...chatNode,
218
- nodeKey: view.key(restored[index])
219
- })) });
216
+ if (restored.length !== chatNodes.length) return;
217
+ const nextChatNodes = chatNodes.flatMap((chatNode, index) => {
218
+ const node = restored[index];
219
+ return node && node.type === chatNode.node.type && NodeApi.string(node) === NodeApi.string(chatNode.node) ? [{
220
+ ...chatNode,
221
+ nodeKey: view.key(node)
222
+ }] : [];
223
+ });
224
+ if (nextChatNodes.length !== chatNodes.length) return;
225
+ context.store.set({ chatNodes: nextChatNodes });
220
226
  };
221
227
  const withReviewRecords = (blocks) => {
222
228
  const { records } = editor.read.value();
@@ -1,7 +1,7 @@
1
1
  "use client";
2
+ import { subscribeSharedEditorViewState } from "../../facade.js";
2
3
  import { PLUGINS } from "../../utils/plate-keys.js";
3
4
  import { NodeApi, RangeApi, defineEffect, defineStateField, editorCommands, locateAt, txLocate } from "../../core.js";
4
- import { useEditorViewState } from "../../react/plite-react.js";
5
5
  import { definePlugin } from "../../react/plugin/definePlugin.js";
6
6
  import { MarkdownPlugin } from "../../markdown/lib/MarkdownPlugin.js";
7
7
  import { AIChatPlugin } from "./AIChatPlugin.js";
@@ -304,7 +304,6 @@ const CopilotPlugin = definePlugin(PLUGINS.copilot, {
304
304
  debouncedTrigger = context.store.get().debounceDelay ? debounce(triggerImmediately, context.store.get().debounceDelay) : null;
305
305
  return {
306
306
  slots: { wrapRoot: function CopilotIntegration({ children, editableRef }) {
307
- useEditorViewState(context.editor, (view) => view.isReadOnly());
308
307
  const attachment = React.useRef(null);
309
308
  React.useLayoutEffect(() => {
310
309
  const element = editableRef.current;
@@ -317,9 +316,15 @@ const CopilotPlugin = definePlugin(PLUGINS.copilot, {
317
316
  }
318
317
  if (!isWritable()) stop();
319
318
  });
320
- React.useLayoutEffect(() => () => {
321
- attachment.current?.detach();
322
- attachment.current = null;
319
+ React.useLayoutEffect(() => {
320
+ const unsubscribeReadOnly = subscribeSharedEditorViewState(context.editor, "readOnly", () => {
321
+ if (!isWritable()) stop();
322
+ });
323
+ return () => {
324
+ unsubscribeReadOnly();
325
+ attachment.current?.detach();
326
+ attachment.current = null;
327
+ };
323
328
  }, []);
324
329
  return children;
325
330
  } },
@@ -1,12 +1,12 @@
1
- import { $a as Path, Ca as NodeKey, Ci as Element, Fo as PluginReference, Ji as Location, La as NodeSelectionMode, Pi as HistoryApi, aa as Node, b as BasePoint, dn as EditorReadMethodTree, iu as TxDeclaredMethod, oo as Plugin, ou as TxOnlyMethod, pa as NodeEntry, ps as Range, su as Value, tn as EditorNodesOptions, v as BaseElement, zo as PluginTypeProvider } from "../../index-QuqD4Dyj-DlOIX0sH.js";
2
- import "../../htmlTypes-aE9Qlenu.js";
3
- import { Co as PluginReference$1, Eo as PluginSchemaDeclaration, V as InternalBasePluginRuntimeExtension, _ as BasePlugin, aa as BasePluginDependencyReferenceFor, ea as HistoryPluginState, qa as DefinitionOf, xo as PluginDependency } from "../../core-Bu--Bog3.js";
4
- import { c as HistoryPluginTypeProvider, d as HistoryTxApi, n as History, u as HistoryStateApi } from "../../index-CTwrWir_.js";
5
- import { a as AIToolName } from "../../AIChatRequestContext-CwCmEMVV.js";
6
- import { At as Plugin$1, n as InternalReactEditorWithInstalledPlugins, t as Editor, xt as InternalPluginAuthorExtension } from "../../index-DhVOU0pS.js";
7
- import { O as MarkdownSyncPlugin, d as Unsafe, i as MarkdownEditor, l as Handle, n as MarkdownApi, u as Join } from "../../index-CeVE8JR-.js";
8
- import { S as AuthoredView, _ as AuthoredPlugin, b as AuthoredResult, c as AuthoredDecision, h as AuthoredPage, m as AuthoredOutcome, n as AuthoredChangeDetails, o as AuthoredChangesDelta, r as AuthoredChangeGroup, t as AuthoredChange, u as AuthoredGroupDetails, v as AuthoredQuery, x as AuthoredReview, y as AuthoredRefusal } from "../../index-DqKFQcfb.js";
9
- import "../../index-CYR4jNU7.js";
1
+ import { Aa as NodeKey, Ho as PluginReference, Ko as PluginTypeProvider, Oi as Element, Wa as NodeSelectionMode, b as BasePoint, ba as NodeEntry, bs as Range, bu as TxOnlyMethod, fa as Node, oo as Path, pn as EditorReadMethodTree, po as Plugin, rn as EditorNodesOptions, ta as Location, v as BaseElement, vu as TxDeclaredMethod, xu as Value, zi as HistoryApi } from "../../tx-only-1FM45FSj-D40jacZv.js";
2
+ import "../../htmlTypes-i_FBCMf2.js";
3
+ import { $i as BasePluginDependencyReferenceFor, Ba as DefinitionOf, H as InternalBasePluginRuntimeExtension, Ji as HistoryPluginState, go as PluginReference$1, mo as PluginDependency, v as BasePlugin, yo as PluginSchemaDeclaration } from "../../core-Cqc_KzpG.js";
4
+ import { c as HistoryStateApi, l as HistoryTxApi, n as History, s as HistoryPluginTypeProvider } from "../../index-BWCC4DCP.js";
5
+ import { a as AIToolName } from "../../AIChatRequestContext-DVGOeWhQ.js";
6
+ import { kt as Plugin$1, n as InternalReactEditorWithInstalledPlugins, t as Editor, xt as InternalPluginAuthorExtension } from "../../index-DfkFmApH.js";
7
+ import { O as MarkdownSyncPlugin, d as Unsafe, i as MarkdownEditor, l as Handle, n as MarkdownApi, u as Join } from "../../index-Cc2ajXAd.js";
8
+ import { S as AuthoredView, _ as AuthoredPlugin, b as AuthoredResult, c as AuthoredDecision, h as AuthoredPage, m as AuthoredOutcome, n as AuthoredChangeDetails, o as AuthoredChangesDelta, r as AuthoredChangeGroup, t as AuthoredChange, u as AuthoredGroupDetails, v as AuthoredQuery, x as AuthoredReview, y as AuthoredRefusal } from "../../index-CLNem74G.js";
9
+ import "../../index-CVAHIQ3p.js";
10
10
  import * as React from "react";
11
11
  import React$1 from "react";
12
12
  import { ChatRequestOptions, ChatStatus, ChatTransport, DataUIPart, UIMessage } from "ai";
@@ -193,6 +193,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
193
193
  readonly [x: string]: unknown;
194
194
  readonly text: string;
195
195
  })[];
196
+ readonly id?: string;
196
197
  readonly type: string;
197
198
  };
198
199
  readonly nodeKey: NodeKey;
@@ -206,6 +207,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
206
207
  readonly [x: string]: unknown;
207
208
  readonly text: string;
208
209
  })[];
210
+ readonly id?: string;
209
211
  readonly type: string;
210
212
  }[];
211
213
  readonly streaming: boolean;
@@ -219,9 +221,6 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
219
221
  }> & Readonly<{
220
222
  __pluginWritableProperties: never;
221
223
  }> & Readonly<Record<"api", MarkdownApi<Value>>> & Readonly<Record<never, never>>> & Pick<BasePlugin<Readonly<{
222
- readonly name: "markdown";
223
- readonly api: MarkdownApi<Value>;
224
- readonly dataTransferFormats: true;
225
224
  readonly initialState: {
226
225
  readonly plainMarks: readonly string[] | null;
227
226
  readonly remarkPlugins: readonly (MarkdownSyncPlugin<readonly never[]> | readonly [MarkdownSyncPlugin<readonly never[]>, ...unknown[]])[];
@@ -282,6 +281,9 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
282
281
  readonly unsafe?: readonly Unsafe[] | null | undefined;
283
282
  } | null;
284
283
  };
284
+ readonly name: "markdown";
285
+ readonly api: MarkdownApi<Value>;
286
+ readonly dataTransferFormats: true;
285
287
  readonly validate: true;
286
288
  }>> & Readonly<Record<never, never>>, "~schema.plugins">, PluginReference$1<"authored"> & PluginDependency<Readonly<{
287
289
  name: "authored";
@@ -304,6 +306,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
304
306
  }>) => readonly AuthoredChangeGroup[];
305
307
  groupOf: (changeId: string) => AuthoredChangeGroup | null;
306
308
  outcome: (id: string) => AuthoredOutcome | null;
309
+ gridLocked: (node: unknown) => boolean;
307
310
  reviewOf: (node: unknown) => AuthoredReview;
308
311
  }>> & Readonly<Record<"update", {
309
312
  decide: TxDeclaredMethod<(decisions: AuthoredDecision | readonly AuthoredDecision[]) => AuthoredResult>;
@@ -324,7 +327,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
324
327
  };
325
328
  };
326
329
  }> & Readonly<{
327
- name: "authored-records";
330
+ name: "authoredRecords";
328
331
  }>>>, "enabled" | "name">> & PluginDependency<never>];
329
332
  }>> & Pick<InternalBasePluginRuntimeExtension<BasePlugin<Readonly<{}> & Readonly<{
330
333
  name: "authored";
@@ -341,7 +344,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
341
344
  };
342
345
  };
343
346
  }> & Readonly<{
344
- name: "authored-records";
347
+ name: "authoredRecords";
345
348
  }>>>];
346
349
  }> & Readonly<Record<never, never>>>, Readonly<{}> & Readonly<{
347
350
  name: "authored";
@@ -358,7 +361,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
358
361
  };
359
362
  };
360
363
  }> & Readonly<{
361
- name: "authored-records";
364
+ name: "authoredRecords";
362
365
  }>>>];
363
366
  }> & Readonly<Record<never, never>>, AuthoredPlugin>, "~schema.plugins">, PluginReference$1<"history"> & PluginDependency<Readonly<{
364
367
  name: "history";
@@ -419,6 +422,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
419
422
  readonly [x: string]: unknown;
420
423
  readonly text: string;
421
424
  })[];
425
+ readonly id?: string;
422
426
  readonly type: string;
423
427
  };
424
428
  readonly nodeKey: NodeKey;
@@ -432,6 +436,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
432
436
  readonly [x: string]: unknown;
433
437
  readonly text: string;
434
438
  })[];
439
+ readonly id?: string;
435
440
  readonly type: string;
436
441
  }[];
437
442
  readonly streaming: boolean;
@@ -445,9 +450,6 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
445
450
  }> & Readonly<{
446
451
  __pluginWritableProperties: never;
447
452
  }> & Readonly<Record<"api", MarkdownApi<Value>>> & Readonly<Record<never, never>>> & Pick<BasePlugin<Readonly<{
448
- readonly name: "markdown";
449
- readonly api: MarkdownApi<Value>;
450
- readonly dataTransferFormats: true;
451
453
  readonly initialState: {
452
454
  readonly plainMarks: readonly string[] | null;
453
455
  readonly remarkPlugins: readonly (MarkdownSyncPlugin<readonly never[]> | readonly [MarkdownSyncPlugin<readonly never[]>, ...unknown[]])[];
@@ -508,6 +510,9 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
508
510
  readonly unsafe?: readonly Unsafe[] | null | undefined;
509
511
  } | null;
510
512
  };
513
+ readonly name: "markdown";
514
+ readonly api: MarkdownApi<Value>;
515
+ readonly dataTransferFormats: true;
511
516
  readonly validate: true;
512
517
  }>> & Readonly<Record<never, never>>, "~schema.plugins">, PluginReference$1<"authored"> & PluginDependency<Readonly<{
513
518
  name: "authored";
@@ -530,6 +535,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
530
535
  }>) => readonly AuthoredChangeGroup[];
531
536
  groupOf: (changeId: string) => AuthoredChangeGroup | null;
532
537
  outcome: (id: string) => AuthoredOutcome | null;
538
+ gridLocked: (node: unknown) => boolean;
533
539
  reviewOf: (node: unknown) => AuthoredReview;
534
540
  }>> & Readonly<Record<"update", {
535
541
  decide: TxDeclaredMethod<(decisions: AuthoredDecision | readonly AuthoredDecision[]) => AuthoredResult>;
@@ -550,7 +556,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
550
556
  };
551
557
  };
552
558
  }> & Readonly<{
553
- name: "authored-records";
559
+ name: "authoredRecords";
554
560
  }>>>, "enabled" | "name">> & PluginDependency<never>];
555
561
  }>> & Pick<InternalBasePluginRuntimeExtension<BasePlugin<Readonly<{}> & Readonly<{
556
562
  name: "authored";
@@ -567,7 +573,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
567
573
  };
568
574
  };
569
575
  }> & Readonly<{
570
- name: "authored-records";
576
+ name: "authoredRecords";
571
577
  }>>>];
572
578
  }> & Readonly<Record<never, never>>>, Readonly<{}> & Readonly<{
573
579
  name: "authored";
@@ -584,7 +590,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
584
590
  };
585
591
  };
586
592
  }> & Readonly<{
587
- name: "authored-records";
593
+ name: "authoredRecords";
588
594
  }>>>];
589
595
  }> & Readonly<Record<never, never>>, AuthoredPlugin>, "~schema.plugins">, PluginReference$1<"history"> & PluginDependency<Readonly<{
590
596
  name: "history";
@@ -658,7 +664,9 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
658
664
  } | undefined;
659
665
  readonly insertStart: () => {
660
666
  path: Path;
661
- startBlock: BaseElement | undefined;
667
+ startBlock: (BaseElement & Readonly<{
668
+ id: string;
669
+ }>) | undefined;
662
670
  startInEmptyParagraph: boolean;
663
671
  };
664
672
  readonly markdown: (args_0: {
@@ -666,7 +674,9 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
666
674
  }) => string;
667
675
  readonly node: (options?: Omit<EditorNodesOptions<Node>, 'type'> & {
668
676
  streaming?: boolean;
669
- }) => NodeEntry<BaseElement> | undefined;
677
+ }) => NodeEntry<BaseElement & Readonly<{
678
+ id: string;
679
+ }>> | undefined;
670
680
  readonly prompt: (args_0: {
671
681
  prompt?: EditorPrompt;
672
682
  }) => string;
@@ -708,6 +718,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
708
718
  readonly [x: string]: unknown;
709
719
  readonly text: string;
710
720
  })[];
721
+ readonly id?: string;
711
722
  readonly type: string;
712
723
  };
713
724
  readonly nodeKey: NodeKey;
@@ -721,6 +732,7 @@ declare const AIChatPlugin: InternalPluginAuthorExtension<Plugin$1<Readonly<{
721
732
  readonly [x: string]: unknown;
722
733
  readonly text: string;
723
734
  })[];
735
+ readonly id?: string;
724
736
  readonly type: string;
725
737
  }[];
726
738
  readonly streaming: boolean;
@@ -831,9 +843,6 @@ declare const CopilotPlugin: InternalPluginAuthorExtension<InternalPluginAuthorE
831
843
  }> & Readonly<{
832
844
  __pluginWritableProperties: never;
833
845
  }> & Readonly<Record<"api", MarkdownApi<Value>>> & Readonly<Record<never, never>>> & Pick<BasePlugin<Readonly<{
834
- readonly name: "markdown";
835
- readonly api: MarkdownApi<Value>;
836
- readonly dataTransferFormats: true;
837
846
  readonly initialState: {
838
847
  readonly plainMarks: readonly string[] | null;
839
848
  readonly remarkPlugins: readonly (MarkdownSyncPlugin<readonly never[]> | readonly [MarkdownSyncPlugin<readonly never[]>, ...unknown[]])[];
@@ -894,6 +903,9 @@ declare const CopilotPlugin: InternalPluginAuthorExtension<InternalPluginAuthorE
894
903
  readonly unsafe?: readonly Unsafe[] | null | undefined;
895
904
  } | null;
896
905
  };
906
+ readonly name: "markdown";
907
+ readonly api: MarkdownApi<Value>;
908
+ readonly dataTransferFormats: true;
897
909
  readonly validate: true;
898
910
  }>> & Readonly<Record<never, never>>, "~schema.plugins">];
899
911
  readonly editOnly: true;
@@ -956,9 +968,6 @@ declare const CopilotPlugin: InternalPluginAuthorExtension<InternalPluginAuthorE
956
968
  }> & Readonly<{
957
969
  __pluginWritableProperties: never;
958
970
  }> & Readonly<Record<"api", MarkdownApi<Value>>> & Readonly<Record<never, never>>> & Pick<BasePlugin<Readonly<{
959
- readonly name: "markdown";
960
- readonly api: MarkdownApi<Value>;
961
- readonly dataTransferFormats: true;
962
971
  readonly initialState: {
963
972
  readonly plainMarks: readonly string[] | null;
964
973
  readonly remarkPlugins: readonly (MarkdownSyncPlugin<readonly never[]> | readonly [MarkdownSyncPlugin<readonly never[]>, ...unknown[]])[];
@@ -1019,6 +1028,9 @@ declare const CopilotPlugin: InternalPluginAuthorExtension<InternalPluginAuthorE
1019
1028
  readonly unsafe?: readonly Unsafe[] | null | undefined;
1020
1029
  } | null;
1021
1030
  };
1031
+ readonly name: "markdown";
1032
+ readonly api: MarkdownApi<Value>;
1033
+ readonly dataTransferFormats: true;
1022
1034
  readonly validate: true;
1023
1035
  }>> & Readonly<Record<never, never>>, "~schema.plugins">];
1024
1036
  readonly editOnly: true;
@@ -1029,14 +1041,61 @@ declare const CopilotPlugin: InternalPluginAuthorExtension<InternalPluginAuthorE
1029
1041
  readonly triggerSuggestion: () => Promise<false | undefined> | undefined;
1030
1042
  }, {}, {}, {}, readonly [], boolean, readonly []>, Readonly<{
1031
1043
  readonly name: "copilot";
1044
+ readonly initialState: {
1045
+ readonly abortController: AbortController | null;
1046
+ readonly autoTriggerQuery: (options: {
1047
+ editor: MarkdownEditor<Editor>;
1048
+ }) => boolean;
1049
+ readonly completeOptions: {
1050
+ readonly api: string;
1051
+ readonly body?: {
1052
+ readonly [x: string]: unknown;
1053
+ } | undefined;
1054
+ readonly credentials?: RequestCredentials;
1055
+ readonly fetch?: typeof fetch;
1056
+ readonly headers?: Headers | readonly (readonly [string, string])[] | {
1057
+ readonly [x: string]: string;
1058
+ } | undefined;
1059
+ readonly onError?: (error: Error) => void;
1060
+ readonly onFinish?: (prompt: string, completion: string) => void;
1061
+ readonly onResponse?: (response: Response) => Promise<void> | void;
1062
+ } | null;
1063
+ readonly completion: string | null;
1064
+ readonly debounceDelay: number;
1065
+ readonly error: Error | null;
1066
+ readonly getNextWord: (options: {
1067
+ text: string;
1068
+ }) => {
1069
+ firstWord: string;
1070
+ remainingText: string;
1071
+ };
1072
+ readonly getPrompt: (options: {
1073
+ editor: MarkdownEditor<Editor>;
1074
+ }) => string;
1075
+ readonly isLoading: boolean;
1076
+ readonly renderGhostText: (() => React$1.ReactNode) | null;
1077
+ readonly shouldAbort: boolean;
1078
+ readonly suggestionNodeKey: NodeKey | null;
1079
+ readonly suggestionText: string | null;
1080
+ readonly triggerQuery: (options: {
1081
+ editor: MarkdownEditor<Editor>;
1082
+ }) => boolean;
1083
+ };
1084
+ readonly update: {
1085
+ accept: () => false | undefined;
1086
+ acceptNextWord: () => false | undefined;
1087
+ reject: () => false | undefined;
1088
+ setBlockSuggestion: TxDeclaredMethod<({ key, text }: {
1089
+ text: string;
1090
+ key?: NodeKey | null;
1091
+ }) => void>;
1092
+ setSuggestion: TxDeclaredMethod<(next: CopilotSuggestionState) => void>;
1093
+ };
1032
1094
  readonly dependencies: readonly [PluginReference$1<"markdown"> & PluginDependency<Readonly<{
1033
1095
  name: "markdown";
1034
1096
  }> & Readonly<{
1035
1097
  __pluginWritableProperties: never;
1036
1098
  }> & Readonly<Record<"api", MarkdownApi<Value>>> & Readonly<Record<never, never>>> & Pick<BasePlugin<Readonly<{
1037
- readonly name: "markdown";
1038
- readonly api: MarkdownApi<Value>;
1039
- readonly dataTransferFormats: true;
1040
1099
  readonly initialState: {
1041
1100
  readonly plainMarks: readonly string[] | null;
1042
1101
  readonly remarkPlugins: readonly (MarkdownSyncPlugin<readonly never[]> | readonly [MarkdownSyncPlugin<readonly never[]>, ...unknown[]])[];
@@ -1097,6 +1156,9 @@ declare const CopilotPlugin: InternalPluginAuthorExtension<InternalPluginAuthorE
1097
1156
  readonly unsafe?: readonly Unsafe[] | null | undefined;
1098
1157
  } | null;
1099
1158
  };
1159
+ readonly name: "markdown";
1160
+ readonly api: MarkdownApi<Value>;
1161
+ readonly dataTransferFormats: true;
1100
1162
  readonly validate: true;
1101
1163
  }>> & Readonly<Record<never, never>>, "~schema.plugins">];
1102
1164
  readonly api: {
@@ -1105,58 +1167,8 @@ declare const CopilotPlugin: InternalPluginAuthorExtension<InternalPluginAuthorE
1105
1167
  };
1106
1168
  readonly editOnly: true;
1107
1169
  readonly effectTypes: true;
1108
- readonly initialState: {
1109
- readonly abortController: AbortController | null;
1110
- readonly autoTriggerQuery: (options: {
1111
- editor: MarkdownEditor<Editor>;
1112
- }) => boolean;
1113
- readonly completeOptions: {
1114
- readonly api: string;
1115
- readonly body?: {
1116
- readonly [x: string]: unknown;
1117
- } | undefined;
1118
- readonly credentials?: RequestCredentials;
1119
- readonly fetch?: typeof fetch;
1120
- readonly headers?: Headers | readonly (readonly [string, string])[] | {
1121
- readonly [x: string]: string;
1122
- } | undefined;
1123
- readonly onError?: (error: Error) => void;
1124
- readonly onFinish?: (prompt: string, completion: string) => void;
1125
- readonly onResponse?: (response: Response) => Promise<void> | void;
1126
- } | null;
1127
- readonly completion: string | null;
1128
- readonly debounceDelay: number;
1129
- readonly error: Error | null;
1130
- readonly getNextWord: (options: {
1131
- text: string;
1132
- }) => {
1133
- firstWord: string;
1134
- remainingText: string;
1135
- };
1136
- readonly getPrompt: (options: {
1137
- editor: MarkdownEditor<Editor>;
1138
- }) => string;
1139
- readonly isLoading: boolean;
1140
- readonly renderGhostText: (() => React$1.ReactNode) | null;
1141
- readonly shouldAbort: boolean;
1142
- readonly suggestionNodeKey: NodeKey | null;
1143
- readonly suggestionText: string | null;
1144
- readonly triggerQuery: (options: {
1145
- editor: MarkdownEditor<Editor>;
1146
- }) => boolean;
1147
- };
1148
1170
  readonly slots: true;
1149
1171
  readonly stateFields: true;
1150
- readonly update: {
1151
- accept: () => false | undefined;
1152
- acceptNextWord: () => false | undefined;
1153
- reject: () => false | undefined;
1154
- setBlockSuggestion: TxDeclaredMethod<({ key, text }: {
1155
- text: string;
1156
- key?: NodeKey | null;
1157
- }) => void>;
1158
- setSuggestion: TxDeclaredMethod<(next: CopilotSuggestionState) => void>;
1159
- };
1160
1172
  }>, "commands" | "on" | "selectors" | "shortcuts" | "slots", {}, {}, {}, {
1161
1173
  readonly isSuggested: (state: Readonly<{
1162
1174
  readonly abortController: AbortController | null;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { getEditorRuntimeOwner } from "../../core.js";
3
- import { useEditorViewState } from "../../react/plite-react.js";
3
+ import { useEditorSelector } from "../../react/stores/plate/useEditorSelector.js";
4
4
  import { useEditor } from "../../react/stores/plate/useEditor.js";
5
5
  import { AIChatPlugin, getAIChatCommandEditor } from "./AIChatPlugin.js";
6
6
  import * as React$1 from "react";
@@ -237,7 +237,7 @@ function createEditorChat(editor, transport) {
237
237
  * the last view cancels the request. Check the data callback's signal after await.
238
238
  */
239
239
  function useAIChat(t0) {
240
- const $ = c(14);
240
+ const $ = c(15);
241
241
  const { editableRef, transport, onData } = t0;
242
242
  const mountedEditor = useEditor();
243
243
  let t1;
@@ -247,11 +247,16 @@ function useAIChat(t0) {
247
247
  $[1] = t1;
248
248
  } else t1 = $[1];
249
249
  const editor = t1;
250
- const readOnly = useEditorViewState(mountedEditor, _temp);
251
- const attachment = React$1.useRef(null);
252
250
  let t2;
253
- if ($[2] !== editableRef || $[3] !== editor || $[4] !== onData || $[5] !== transport) {
254
- t2 = () => {
251
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
252
+ t2 = { dependsOn: "readOnly" };
253
+ $[2] = t2;
254
+ } else t2 = $[2];
255
+ const readOnly = useEditorSelector(mountedEditor, _temp, t2);
256
+ const attachment = React$1.useRef(null);
257
+ let t3;
258
+ if ($[3] !== editableRef || $[4] !== editor || $[5] !== onData || $[6] !== transport) {
259
+ t3 = () => {
255
260
  const element = editableRef.current;
256
261
  const previous = attachment.current;
257
262
  if (previous?.element === element && previous.session === sessions.get(editor) && previous.session.transport === transport) {
@@ -281,47 +286,47 @@ function useAIChat(t0) {
281
286
  detach: session.attach(view)
282
287
  };
283
288
  };
284
- $[2] = editableRef;
285
- $[3] = editor;
286
- $[4] = onData;
287
- $[5] = transport;
288
- $[6] = t2;
289
- } else t2 = $[6];
290
- React$1.useLayoutEffect(t2);
291
- let t3;
289
+ $[3] = editableRef;
290
+ $[4] = editor;
291
+ $[5] = onData;
292
+ $[6] = transport;
293
+ $[7] = t3;
294
+ } else t3 = $[7];
295
+ React$1.useLayoutEffect(t3);
292
296
  let t4;
293
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
294
- t3 = () => () => {
297
+ let t5;
298
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
299
+ t4 = () => () => {
295
300
  attachment.current?.detach();
296
301
  attachment.current = null;
297
302
  };
298
- t4 = [];
299
- $[7] = t3;
303
+ t5 = [];
300
304
  $[8] = t4;
305
+ $[9] = t5;
301
306
  } else {
302
- t3 = $[7];
303
307
  t4 = $[8];
308
+ t5 = $[9];
304
309
  }
305
- React$1.useLayoutEffect(t3, t4);
306
- let t5;
307
- if ($[9] !== editor) {
308
- t5 = () => {
310
+ React$1.useLayoutEffect(t4, t5);
311
+ let t6;
312
+ if ($[10] !== editor) {
313
+ t6 = () => {
309
314
  sessions.get(editor)?.refresh();
310
315
  };
311
- $[9] = editor;
312
- $[10] = t5;
313
- } else t5 = $[10];
314
- let t6;
315
- if ($[11] !== editor || $[12] !== readOnly) {
316
- t6 = [editor, readOnly];
317
- $[11] = editor;
318
- $[12] = readOnly;
319
- $[13] = t6;
320
- } else t6 = $[13];
321
- React$1.useEffect(t5, t6);
316
+ $[10] = editor;
317
+ $[11] = t6;
318
+ } else t6 = $[11];
319
+ let t7;
320
+ if ($[12] !== editor || $[13] !== readOnly) {
321
+ t7 = [editor, readOnly];
322
+ $[12] = editor;
323
+ $[13] = readOnly;
324
+ $[14] = t7;
325
+ } else t7 = $[14];
326
+ React$1.useEffect(t6, t7);
322
327
  }
323
- function _temp(state) {
324
- return state.isReadOnly();
328
+ function _temp(current) {
329
+ return current.read.view.isReadOnly();
325
330
  }
326
331
  //#endregion
327
332
  export { useAIChat };
@@ -1,4 +1,4 @@
1
- import { h as AuthoredProjectionRefusal, m as AuthoredProjectionDiagnostic, p as AuthoredDocumentProjection } from "../index-QuqD4Dyj-DlOIX0sH.js";
2
- import { C as projectAuthoredDocument, S as AuthoredView, T as proposeAuthoredComparison, a as AuthoredChangePart, b as AuthoredResult, c as AuthoredDecision, d as AuthoredGroupPart, f as AuthoredMark, g as AuthoredPlaceError, h as AuthoredPage, i as AuthoredChangeKind, l as AuthoredFormatProjection, m as AuthoredOutcome, n as AuthoredChangeDetails, o as AuthoredChangesDelta, p as AuthoredOptions, r as AuthoredChangeGroup, s as AuthoredComparisonImportResult, t as AuthoredChange, u as AuthoredGroupDetails, v as AuthoredQuery, w as projectAuthoredRange, x as AuthoredReview, y as AuthoredRefusal } from "../index-DqKFQcfb.js";
3
- import { t as AuthoredPlugin } from "../index-CYR4jNU7.js";
4
- export { type AuthoredChange, type AuthoredChangeDetails, type AuthoredChangeGroup, type AuthoredChangeKind, type AuthoredChangePart, type AuthoredChangesDelta, type AuthoredComparisonImportResult, type AuthoredDecision, type AuthoredDocumentProjection, type AuthoredFormatProjection, type AuthoredGroupDetails, type AuthoredGroupPart, type AuthoredMark, type AuthoredOptions, type AuthoredOutcome, type AuthoredPage, AuthoredPlaceError, AuthoredPlugin, type AuthoredProjectionDiagnostic, type AuthoredProjectionRefusal, type AuthoredQuery, type AuthoredRefusal, type AuthoredResult, type AuthoredReview, type AuthoredView, projectAuthoredDocument, projectAuthoredRange, proposeAuthoredComparison };
1
+ import { h as AuthoredProjectionRefusal, m as AuthoredProjectionDiagnostic, p as AuthoredDocumentProjection } from "../tx-only-1FM45FSj-D40jacZv.js";
2
+ import { C as GaveWrite, D as proposeAuthoredComparison, E as projectAuthoredRange, S as AuthoredView, T as projectAuthoredDocument, a as AuthoredChangePart, b as AuthoredResult, c as AuthoredDecision, d as AuthoredGroupPart, f as AuthoredMark, g as AuthoredPlaceError, h as AuthoredPage, i as AuthoredChangeKind, l as AuthoredFormatProjection, m as AuthoredOutcome, n as AuthoredChangeDetails, o as AuthoredChangesDelta, p as AuthoredOptions, r as AuthoredChangeGroup, s as AuthoredComparisonImportResult, t as AuthoredChange, u as AuthoredGroupDetails, v as AuthoredQuery, w as SplitGave, x as AuthoredReview, y as AuthoredRefusal } from "../index-CLNem74G.js";
3
+ import { t as AuthoredPlugin } from "../index-CVAHIQ3p.js";
4
+ export { type AuthoredChange, type AuthoredChangeDetails, type AuthoredChangeGroup, type AuthoredChangeKind, type AuthoredChangePart, type AuthoredChangesDelta, type AuthoredComparisonImportResult, type AuthoredDecision, type AuthoredDocumentProjection, type AuthoredFormatProjection, type AuthoredGroupDetails, type AuthoredGroupPart, type AuthoredMark, type AuthoredOptions, type AuthoredOutcome, type AuthoredPage, AuthoredPlaceError, AuthoredPlugin, type AuthoredProjectionDiagnostic, type AuthoredProjectionRefusal, type AuthoredQuery, type AuthoredRefusal, type AuthoredResult, type AuthoredReview, type AuthoredView, type GaveWrite, type SplitGave, projectAuthoredDocument, projectAuthoredRange, proposeAuthoredComparison };
@@ -1,4 +1,4 @@
1
- import { Xn as ExternalTextAdapter } from "../../index-DhVOU0pS.js";
1
+ import { Jn as ExternalTextAdapter } from "../../index-DfkFmApH.js";
2
2
  import { Extension } from "@codemirror/state";
3
3
  type CodeBlockCodeMirrorConfig = Readonly<{
4
4
  language?: string;