platejs 54.0.0-beta.2 → 54.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.md +56 -0
  3. package/dist/{AIChatRequestContext-BMVWhfPV.d.ts → AIChatRequestContext-DY104TqL.d.ts} +2 -2
  4. package/dist/{BaseSuggestionPlugin-DBl3fqnm.d.ts → BaseSuggestionPlugin-Deo6n6Fs.d.ts} +7 -3
  5. package/dist/{PlateStatic-DhNv2ejp.d.ts → PlateStatic-CJX5bKuv.d.ts} +7 -7
  6. package/dist/ai/index.d.ts +1 -1
  7. package/dist/ai/react/AIChatPlugin.js +113 -78
  8. package/dist/ai/react/CopilotPlugin.js +1 -1
  9. package/dist/ai/react/index.d.ts +23 -16
  10. package/dist/authored/index.d.ts +4 -4
  11. package/dist/code-block/codemirror/createCodeMirrorAdapter.js +12 -9
  12. package/dist/code-block/codemirror/index.d.ts +1 -1
  13. package/dist/{combobox-DkBGgyd3.d.ts → combobox-DAOYWuvC.d.ts} +2 -2
  14. package/dist/{comparison-types-CYnJ35qU.d.ts → comparison-types-Dt-unJZY-DCddmbSD.d.ts} +10 -2
  15. package/dist/compiler/index.d.ts +2 -2
  16. package/dist/{core-BJG8l_mk.d.ts → core-ClHasORr.d.ts} +433 -95
  17. package/dist/diff/index.d.ts +2 -2
  18. package/dist/docs/ai.md +4 -3
  19. package/dist/docs/api/core/plate-components.md +0 -19
  20. package/dist/docs/api/core/plate-controller.md +4 -2
  21. package/dist/docs/api/core/plate-plugin.md +3 -0
  22. package/dist/docs/api/core/plate-store.md +3 -3
  23. package/dist/docs/api/dom.md +14 -4
  24. package/dist/docs/api/editor-transforms.md +2 -1
  25. package/dist/docs/api/react-hooks.md +25 -11
  26. package/dist/docs/authored-changes.md +5 -2
  27. package/dist/docs/basic-blocks.md +42 -29
  28. package/dist/docs/blockquote.md +5 -3
  29. package/dist/docs/board.md +63 -8
  30. package/dist/docs/code-block.md +47 -0
  31. package/dist/docs/discussion.md +1 -1
  32. package/dist/docs/docx.md +1 -1
  33. package/dist/docs/dom-coverage.md +5 -0
  34. package/dist/docs/examples/editable-voids.md +2 -3
  35. package/dist/docs/external-text.md +2 -0
  36. package/dist/docs/field.md +370 -0
  37. package/dist/docs/find.md +9 -6
  38. package/dist/docs/form.md +2 -0
  39. package/dist/docs/heading.md +6 -0
  40. package/dist/docs/installation/manual.md +0 -4
  41. package/dist/docs/link.md +3 -3
  42. package/dist/docs/llms.txt +4 -2
  43. package/dist/docs/markdown.md +176 -8
  44. package/dist/docs/plugin-components.md +13 -10
  45. package/dist/docs/plugin-input-rules.md +4 -12
  46. package/dist/docs/prompt-editor.md +205 -0
  47. package/dist/docs/roots.md +8 -6
  48. package/dist/docs/rtl.md +6 -4
  49. package/dist/docs/selection.md +7 -4
  50. package/dist/docs/suggestion.md +1 -1
  51. package/dist/docs/toolbar.md +26 -30
  52. package/dist/docs/upload.md +106 -17
  53. package/dist/docx/export/index.d.ts +3 -3
  54. package/dist/docx/export/lib/docxStaticComponents.js +12 -2
  55. package/dist/docx/export/lib/exportDocx.js +29 -5
  56. package/dist/docx/export/lib/reviewPart.js +1 -1
  57. package/dist/docx/export/lib/reviewProjection.js +10 -8
  58. package/dist/docx/import/index.d.ts +4 -4
  59. package/dist/docx/paste/index.d.ts +4 -4
  60. package/dist/dom/index.d.ts +1 -6
  61. package/dist/dom/plite-dom.internal.js +2 -2
  62. package/dist/excalidraw/index.d.ts +3 -2
  63. package/dist/excalidraw/react/index.d.ts +3 -2
  64. package/dist/facade.js +2 -2
  65. package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +13 -5
  66. package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +32 -10
  67. package/dist/features/board/index.d.ts +2 -2
  68. package/dist/features/board/lib/BaseBoardPlugin.js +14 -1
  69. package/dist/features/board/lib/boardStroke.internal.js +13 -1
  70. package/dist/features/board/lib/boardTypes.internal.js +16 -0
  71. package/dist/features/callout/index.d.ts +3 -2
  72. package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +14 -5
  73. package/dist/features/combobox/index.d.ts +2 -2
  74. package/dist/features/comments/index.d.ts +1 -1
  75. package/dist/features/date/index.d.ts +3 -2
  76. package/dist/features/details/index.d.ts +3 -2
  77. package/dist/features/details/lib/BaseDetailsPlugin.js +10 -10
  78. package/dist/features/field/index.d.ts +2 -0
  79. package/dist/features/field/index.js +2 -0
  80. package/dist/features/field/lib/BaseFieldPlugin.js +414 -0
  81. package/dist/features/field/lib/fieldRules.internal.js +42 -0
  82. package/dist/features/find/index.d.ts +3 -2
  83. package/dist/features/footnote/index.d.ts +1 -1
  84. package/dist/features/ink/index.d.ts +1 -1
  85. package/dist/features/ink/lib/BaseInkPlugin.js +126 -103
  86. package/dist/features/ink/lib/inkCodec.internal.js +130 -0
  87. package/dist/features/ink/lib/inkGone.internal.js +229 -48
  88. package/dist/features/ink/lib/inkPlaces.internal.js +533 -62
  89. package/dist/features/layout/index.d.ts +1 -1
  90. package/dist/features/link/lib/BaseLinkPlugin.js +6 -4
  91. package/dist/features/lint/index.d.ts +3 -2
  92. package/dist/features/media/index.d.ts +1 -1
  93. package/dist/features/media/lib/media/parseMediaUrl.js +11 -1
  94. package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +6 -2
  95. package/dist/features/mention/index.d.ts +5 -4
  96. package/dist/features/suggestion/index.d.ts +1 -1
  97. package/dist/features/table/index.d.ts +1 -1
  98. package/dist/features/table/lib/BaseTablePlugin.js +14 -8
  99. package/dist/features/table/lib/internal/selection.js +4 -2
  100. package/dist/features/toc/index.d.ts +1 -1
  101. package/dist/features/upload/index.d.ts +2 -2
  102. package/dist/features/upload/lib/BaseUploadPlugin.js +464 -250
  103. package/dist/history/index.d.ts +2 -2
  104. package/dist/html/index.d.ts +3 -3
  105. package/dist/html/server/index.d.ts +1 -1
  106. package/dist/{htmlTypes-DjeFG3P8.d.ts → htmlTypes-cg_cWsaN.d.ts} +2 -31
  107. package/dist/hyperscript/index.d.ts +1 -1
  108. package/dist/{index-D1CFXA-i.d.ts → index-8WO2vI0U.d.ts} +475 -143
  109. package/dist/{index-DaM37gF6.d.ts → index-B5mYEawV.d.ts} +37 -21
  110. package/dist/{index-Bq3sdm3S.d.ts → index-BZWFoUXt.d.ts} +5 -4
  111. package/dist/{index-DdIRduDG.d.ts → index-C0POz7rg.d.ts} +3 -2
  112. package/dist/{index-Bxfvicyy.d.ts → index-C1_JIhL4.d.ts} +4 -3
  113. package/dist/{index-DC_MNGyu.d.ts → index-C35V_hj0.d.ts} +3 -3
  114. package/dist/{index-kLKMc-pI.d.ts → index-C6ql9pKw.d.ts} +2 -2
  115. package/dist/{index-hsC_sOn2.d.ts → index-C9DiGDVj.d.ts} +35 -5
  116. package/dist/{index-DTgaSxKr.d.ts → index-CLsEe3LY.d.ts} +40 -4
  117. package/dist/{index-CT7miqQN.d.ts → index-CdOLsPaW.d.ts} +29 -9
  118. package/dist/{index-DLA2DUR2.d.ts → index-CktYvOgk.d.ts} +4 -3
  119. package/dist/{index-BBKGrsG3.d.ts → index-Cmuluh6f.d.ts} +1 -1
  120. package/dist/{index-BiQerPJS.d.ts → index-CzLwBZpY.d.ts} +2 -2
  121. package/dist/{index-DzD6BIFJ.d.ts → index-D3-2iM1b.d.ts} +7 -5
  122. package/dist/{index-Cl77E9yr.d.ts → index-DKOFvteF.d.ts} +2 -2
  123. package/dist/{index-iaZOhA76.d.ts → index-DPWyk3lG-DOYwohXO.d.ts} +1 -1
  124. package/dist/index-DQnjqtQa.d.ts +678 -0
  125. package/dist/{index-CcZbqPqk.d.ts → index-Do9pj1GK.d.ts} +73 -39
  126. package/dist/{index-BU6k1Aev.d.ts → index-DpltOCot-A2b3p3Eb.d.ts} +4735 -4586
  127. package/dist/{index-Bc2Yg_2j.d.ts → index-HPYawTae-BCUQLEWF.d.ts} +2 -2
  128. package/dist/{index-BkR7-GLI.d.ts → index-baQOK89E.d.ts} +2 -2
  129. package/dist/{index-D5W-p9bS.d.ts → index-oIJAZxc2.d.ts} +49 -4
  130. package/dist/{index-xdmCBvlT.d.ts → index-r7yb77Wy.d.ts} +3 -2
  131. package/dist/index.d.ts +4 -4
  132. package/dist/{react/internal → internal}/penStroke.internal.js +1 -1
  133. package/dist/internal/plugin/OverridePlugin.js +101 -119
  134. package/dist/internal/plugin/collectPlateNodeMappings.js +5 -1
  135. package/dist/internal/plugin/pastedUploadFiles.js +4 -0
  136. package/dist/internal/plugin/resolvePlugin.js +1 -1
  137. package/dist/internal/plugin/resolvePlugins.js +3 -0
  138. package/dist/internal/plugin/uploadDrafts.js +6 -0
  139. package/dist/internal/utils/mergePlugins.js +1 -0
  140. package/dist/lib/plugins/element-id/ElementIdPlugin.js +8 -2
  141. package/dist/lib/plugins/html/HtmlPlugin.js +9 -0
  142. package/dist/lib/plugins/html/htmlSafety.js +1 -1
  143. package/dist/lib/plugins/input-rules/InputRulesPlugin.js +5 -15
  144. package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +16 -0
  145. package/dist/markdown/index.d.ts +2 -2
  146. package/dist/markdown/index.js +2 -1
  147. package/dist/markdown/lib/MarkdownPlugin.js +16 -9
  148. package/dist/markdown/lib/RawHtmlPlugin.js +24 -0
  149. package/dist/markdown/lib/deserializer/mdastToSlate.js +12 -2
  150. package/dist/markdown/lib/internal/markdownConversion.js +773 -74
  151. package/dist/markdown/lib/internal/markdownDiagnostics.js +18 -7
  152. package/dist/markdown/lib/internal/markdownFrontmatter.js +102 -0
  153. package/dist/markdown/lib/internal/markdownIntrinsics.js +125 -43
  154. package/dist/markdown/lib/internal/markdownLine.js +5 -3
  155. package/dist/markdown/lib/internal/markdownMappings.js +19 -7
  156. package/dist/markdown/lib/internal/markdownOpenTail.js +381 -0
  157. package/dist/markdown/lib/internal/markdownRawHtml.js +314 -0
  158. package/dist/markdown/lib/internal/markdownSegments.js +57 -48
  159. package/dist/markdown/lib/internal/markdownTags.js +22 -8
  160. package/dist/markdown/lib/serializer/convertNodesSerialize.js +10 -8
  161. package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +226 -0
  162. package/dist/markdown/lib/serializer/listToMdastTree.js +2 -0
  163. package/dist/math/index.d.ts +3 -2
  164. package/dist/math/react/index.d.ts +4 -3
  165. package/dist/migrations/index.d.ts +3 -3
  166. package/dist/pagination/index.d.ts +1 -1
  167. package/dist/pagination/react/index.d.ts +4 -4
  168. package/dist/react/components/EditorContentView.internal.js +17 -8
  169. package/dist/react/components/EditorProvider.js +5 -5
  170. package/dist/react/components/Plate.js +103 -122
  171. package/dist/react/components/PlateContainer.js +40 -32
  172. package/dist/react/components/PlateController.js +28 -16
  173. package/dist/react/components/PlateRoot.internal.js +3 -2
  174. package/dist/react/core.js +4 -4
  175. package/dist/react/features/board/BoardSurface.js +116 -87
  176. package/dist/react/features/board/boardClipboard.internal.js +15 -5
  177. package/dist/react/features/board/boardGesture.internal.js +6 -3
  178. package/dist/react/features/board/boardIndex.internal.js +7 -18
  179. package/dist/react/features/board/boardPictures.internal.js +19 -13
  180. package/dist/react/features/board/boardView.internal.js +184 -49
  181. package/dist/react/features/board/boardVoice.internal.js +10 -11
  182. package/dist/react/features/board/index.d.ts +64 -18
  183. package/dist/react/features/callout/index.d.ts +3 -2
  184. package/dist/react/features/combobox/index.d.ts +8 -8
  185. package/dist/react/features/comments/index.d.ts +6 -5
  186. package/dist/react/features/date/index.d.ts +4 -3
  187. package/dist/react/features/details/index.d.ts +4 -3
  188. package/dist/react/features/field/FieldPlugin.js +34 -0
  189. package/dist/react/features/field/index.d.ts +312 -0
  190. package/dist/react/features/field/index.js +2 -0
  191. package/dist/react/features/footnote/index.d.ts +7 -6
  192. package/dist/react/features/format-painter/index.d.ts +4 -3
  193. package/dist/react/features/ink/InkContent.js +313 -0
  194. package/dist/react/features/ink/index.d.ts +57 -29
  195. package/dist/react/features/ink/index.js +2 -2
  196. package/dist/react/features/ink/inkCapture.internal.js +39 -17
  197. package/dist/react/features/ink/inkInput.internal.js +1 -1
  198. package/dist/react/features/ink/inkLayout.internal.js +6 -3
  199. package/dist/react/features/ink/inkPaint.internal.js +78 -2
  200. package/dist/react/features/ink/inkPlacement.internal.js +331 -104
  201. package/dist/react/features/ink/inkWatch.internal.js +7 -5
  202. package/dist/react/features/layout/index.d.ts +5 -4
  203. package/dist/react/features/media/index.d.ts +5 -4
  204. package/dist/react/features/mention/index.d.ts +6 -5
  205. package/dist/react/features/resizable/Resizable.js +4 -6
  206. package/dist/react/features/resizable/index.d.ts +5 -5
  207. package/dist/react/features/suggestion/index.d.ts +6 -5
  208. package/dist/react/features/table/TablePlugin.js +4 -11
  209. package/dist/react/features/table/index.d.ts +8 -7
  210. package/dist/react/features/toc/index.d.ts +2 -2
  211. package/dist/react/features/upload/index.d.ts +11 -6
  212. package/dist/react/index.d.ts +6 -6
  213. package/dist/react/index.js +4 -4
  214. package/dist/react/internal/plate-context.js +425 -188
  215. package/dist/react/plite-react.js +2 -2
  216. package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +12 -10
  217. package/dist/react/stores/plate/useEditor.js +32 -14
  218. package/dist/react/stores/plate/useEditorHistory.js +55 -0
  219. package/dist/react/stores/plate/useEditorSelector.js +66 -21
  220. package/dist/react/utils/pipeRenderElement.internal.js +1 -1
  221. package/dist/react/utils/pluginRenderElement.internal.js +1 -1
  222. package/dist/react/virtualized.d.ts +4 -4
  223. package/dist/{source-CNKy99Th.d.ts → source-aUwpNnAw.d.ts} +4 -4
  224. package/dist/static/index.d.ts +18 -18
  225. package/dist/static/internal/renderStaticHtmlWithOverrides.js +2 -2
  226. package/dist/static/internal/staticPresentation.js +4 -4
  227. package/dist/static/internal/writeStaticSelectionClipboardData.js +7 -2
  228. package/dist/tabbable/index.d.ts +1 -1
  229. package/dist/tabbable/react/index.d.ts +3 -3
  230. package/dist/testing/index.d.ts +3 -3
  231. package/dist/yjs/index.d.ts +1 -1
  232. package/dist/yjs/react/index.d.ts +6 -6
  233. package/package.json +20 -2
  234. package/dist/markdown/lib/serializer/convertTextsSerialize.js +0 -163
  235. package/dist/react/components/EditorSelectionView.js +0 -40
  236. package/dist/react/features/ink/InkLayer.js +0 -218
  237. package/dist/react/internal/createPlateTargetScope.js +0 -62
@@ -1,9 +1,9 @@
1
- import { zu as Range } from "../../../index-BU6k1Aev.js";
2
- import "../../../htmlTypes-DjeFG3P8.js";
3
- import { Ct as PluginTransaction, Wa as DefinitionOf, bo as PluginReference, io as InferPluginStoreState } from "../../../core-BJG8l_mk.js";
4
- import "../../../index-D1CFXA-i.js";
5
- import { n as ComboboxState } from "../../../combobox-DkBGgyd3.js";
6
- import React from "react";
1
+ import { us as Range } from "../../../index-DpltOCot-A2b3p3Eb.js";
2
+ import "../../../htmlTypes-cg_cWsaN.js";
3
+ import { Ct as PluginTransaction, Ga as DefinitionOf, ao as InferPluginStoreState, xo as PluginReference } from "../../../core-ClHasORr.js";
4
+ import "../../../index-8WO2vI0U.js";
5
+ import { n as ComboboxState } from "../../../combobox-DAOYWuvC.js";
6
+ import React$1 from "react";
7
7
  /** The open query an autocomplete popup offers options for. */
8
8
  type ComboboxMatch = Readonly<{
9
9
  /** True while an IME composes; `query` then previews the visible preedit. */
@@ -19,7 +19,7 @@ type ComboboxCompletion = (tx: PluginTransaction) => boolean | void;
19
19
  type RequireComboboxState<P> = InferPluginStoreState<DefinitionOf<P>> extends ComboboxState ? unknown : never;
20
20
  type UseComboboxOptions<P extends PluginReference = PluginReference> = {
21
21
  /** The Editable this popup serves, as passed to an `afterEditable` slot. */
22
- editableRef: React.RefObject<HTMLDivElement | null>;
22
+ editableRef: React$1.RefObject<HTMLDivElement | null>;
23
23
  /** The feature whose state holds a `ComboboxState` trigger policy. */
24
24
  plugin: P & RequireComboboxState<P>;
25
25
  /** The listbox's active option id, mirrored as `aria-activedescendant`. */
@@ -35,7 +35,7 @@ type UseComboboxOptions<P extends PluginReference = PluginReference> = {
35
35
  * Handle Enter, Tab, ArrowUp, ArrowDown or Escape while this popup shows.
36
36
  * Return true when handled; unhandled Escape dismisses the popup.
37
37
  */
38
- onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => boolean;
38
+ onKeyDown?: (event: React$1.KeyboardEvent<HTMLDivElement>) => boolean;
39
39
  };
40
40
  type UseComboboxReturn = {
41
41
  /**
@@ -1,8 +1,9 @@
1
- import { Mu as Location, Ru as BaseRange, eo as Value, zu as Range } from "../../../index-BU6k1Aev.js";
2
- import "../../../core-BJG8l_mk.js";
3
- import { r as AnnotationChange } from "../../../index-iaZOhA76.js";
4
- import { At as Plugin, xt as InternalPluginAuthorExtension } from "../../../index-D1CFXA-i.js";
5
- import { S as SavedComments, _ as CommentsLoadIssue, a as CommentDataValue, b as CreateCommentThreadInput, c as CommentMutationRequest, d as CommentRanges, f as CommentResolution, g as CommentsChange, l as CommentMutationResult, m as CommentThread, n as CommentAttachment, o as CommentMessage, p as CommentTarget, r as CommentData, s as CommentMutationDecision, x as PendingComment } from "../../../index-Bxfvicyy.js";
1
+ import { Ki as Location, ru as Value, us as Range, x as BaseRange } from "../../../index-DpltOCot-A2b3p3Eb.js";
2
+ import "../../../htmlTypes-cg_cWsaN.js";
3
+ import "../../../core-ClHasORr.js";
4
+ import { r as AnnotationChange } from "../../../index-DPWyk3lG-DOYwohXO.js";
5
+ import { At as Plugin, xt as InternalPluginAuthorExtension } from "../../../index-8WO2vI0U.js";
6
+ import { S as SavedComments, _ as CommentsLoadIssue, a as CommentDataValue, b as CreateCommentThreadInput, c as CommentMutationRequest, d as CommentRanges, f as CommentResolution, g as CommentsChange, l as CommentMutationResult, m as CommentThread, n as CommentAttachment, o as CommentMessage, p as CommentTarget, r as CommentData, s as CommentMutationDecision, x as PendingComment } from "../../../index-C1_JIhL4.js";
6
7
  /** Comment data and mapped ranges with interaction for the exact mounted view. */
7
8
  declare const CommentsPlugin: InternalPluginAuthorExtension<Plugin<Readonly<{
8
9
  readonly name: "comments";
@@ -1,6 +1,7 @@
1
- import { Qo as TxDeclaredMethod, vl as PropertyStringDescriptor } from "../../../index-BU6k1Aev.js";
2
- import { _t as NodeInsertOptions } from "../../../core-BJG8l_mk.js";
3
- import { At as Plugin } from "../../../index-D1CFXA-i.js";
1
+ import { eu as TxDeclaredMethod, is as PropertyStringDescriptor } from "../../../index-DpltOCot-A2b3p3Eb.js";
2
+ import "../../../htmlTypes-cg_cWsaN.js";
3
+ import { _t as NodeInsertOptions } from "../../../core-ClHasORr.js";
4
+ import { At as Plugin } from "../../../index-8WO2vI0U.js";
4
5
  declare const DatePlugin: Plugin<Readonly<{
5
6
  readonly __pluginWritableProperties: Readonly<{
6
7
  descriptor: PropertyStringDescriptor<{
@@ -1,6 +1,7 @@
1
- import { $i as NodeKey, $u as EditorJsonValue, El as SchemaContentDefault, Il as SchemaContentRule, Mu as Location, Qo as TxDeclaredMethod, fl as PropertyJsonDescriptor, kl as SchemaContentPrefixSlot, ms as NodeSelection } from "../../../index-BU6k1Aev.js";
2
- import { Qn as HeadingLevel, _ as BasePlugin, bo as PluginReference, ct as BlockInsertOptions, lt as BlockUpsertOptions, vo as PluginDependency } from "../../../core-BJG8l_mk.js";
3
- import { At as Plugin } from "../../../index-D1CFXA-i.js";
1
+ import { Ds as SchemaContentPrefixSlot, Ki as Location, Pa as NodeSelection, Ps as SchemaContentRule, Qo as PropertyJsonDescriptor, Vt as EditorJsonValue, eu as TxDeclaredMethod, ws as SchemaContentDefault, xa as NodeKey } from "../../../index-DpltOCot-A2b3p3Eb.js";
2
+ import "../../../htmlTypes-cg_cWsaN.js";
3
+ import { Qn as HeadingLevel, _ as BasePlugin, ct as BlockInsertOptions, lt as BlockUpsertOptions, xo as PluginReference, yo as PluginDependency } from "../../../core-ClHasORr.js";
4
+ import { At as Plugin } from "../../../index-8WO2vI0U.js";
4
5
  declare const DetailsSummaryPlugin: Plugin<Readonly<{
5
6
  formats: true;
6
7
  }> & Readonly<{
@@ -0,0 +1,34 @@
1
+ import { useEditorSelector } from "../../stores/plate/useEditorSelector.js";
2
+ import { toReactPlugin } from "../../plugin/toReactPlugin.js";
3
+ import { BaseFieldPlugin } from "../../../features/field/lib/BaseFieldPlugin.js";
4
+ import { c } from "react/compiler-runtime";
5
+ //#region src/react/features/field/FieldPlugin.tsx
6
+ /** The field plugin for a React editor. */
7
+ const FieldPlugin = toReactPlugin(BaseFieldPlugin);
8
+ const elementsChanged = (commit) => !commit || commit.changed.hasAny("properties") || commit.changed.hasAny("structure");
9
+ const sameRead = (a, b) => a === b || a !== null && b !== null && a.node === b.node && a.problems.length === b.problems.length && a.problems.every((problem, index) => problem === b.problems[index]);
10
+ /**
11
+ * Read the field with this id and its problems. A commit that changes an
12
+ * element rereads it, and the caller renders again only when the field or its
13
+ * problems changed, such as when the field its condition names is deleted.
14
+ */
15
+ const useFieldRead = (fieldId) => {
16
+ const $ = c(3);
17
+ let t0;
18
+ if ($[0] !== fieldId) {
19
+ t0 = (editor) => editor.plugin(BaseFieldPlugin).read.field(fieldId);
20
+ $[0] = fieldId;
21
+ $[1] = t0;
22
+ } else t0 = $[1];
23
+ let t1;
24
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
25
+ t1 = {
26
+ equalityFn: sameRead,
27
+ shouldUpdate: elementsChanged
28
+ };
29
+ $[2] = t1;
30
+ } else t1 = $[2];
31
+ return useEditorSelector(t0, t1);
32
+ };
33
+ //#endregion
34
+ export { FieldPlugin, useFieldRead };
@@ -0,0 +1,312 @@
1
+ import { Qo as PropertyJsonDescriptor, Ws as SchemaElementPropertyDefinition, Yo as PropertyBooleanDescriptor, Zo as PropertyEnumDescriptor, eu as TxDeclaredMethod, is as PropertyStringDescriptor, ls as PropertyValueOptions } from "../../../index-DpltOCot-A2b3p3Eb.js";
2
+ import "../../../htmlTypes-cg_cWsaN.js";
3
+ import { _t as NodeInsertOptions } from "../../../core-ClHasORr.js";
4
+ import { At as Plugin } from "../../../index-8WO2vI0U.js";
5
+ import { c as FieldProblem, d as FieldTest, f as FieldValue, i as FieldElement, l as FieldRead, o as FieldOption, r as FieldCondition, s as FieldPatch, u as FieldSettings } from "../../../index-DQnjqtQa.js";
6
+ /** The field plugin for a React editor. */
7
+ declare const FieldPlugin: Plugin<Readonly<{
8
+ readonly __pluginWritableProperties: Readonly<{
9
+ descriptor: PropertyJsonDescriptor<Readonly<{
10
+ ref: string;
11
+ test: FieldTest;
12
+ value?: FieldValue;
13
+ }>, {
14
+ readonly validate: (value: unknown) => value is FieldCondition;
15
+ readonly validationVersion: 1;
16
+ } & Readonly<{
17
+ default?: Readonly<{
18
+ ref: string;
19
+ test: FieldTest;
20
+ value?: FieldValue;
21
+ }> | undefined;
22
+ generate?: (() => Readonly<{
23
+ ref: string;
24
+ test: FieldTest;
25
+ value?: FieldValue;
26
+ }>) | undefined;
27
+ omitDefault?: boolean;
28
+ required?: boolean;
29
+ }> & Readonly<{
30
+ validate: (value: unknown) => value is Readonly<{
31
+ ref: string;
32
+ test: FieldTest;
33
+ value?: FieldValue;
34
+ }>;
35
+ validationVersion: number;
36
+ }>>;
37
+ key: "condition";
38
+ localId: "condition";
39
+ ownerName: "field";
40
+ placement: "element";
41
+ unaliased: true;
42
+ value: Readonly<{
43
+ ref: string;
44
+ test: FieldTest;
45
+ value?: FieldValue;
46
+ }>;
47
+ }> | Readonly<{
48
+ descriptor: PropertyJsonDescriptor<FieldValue, {
49
+ readonly validate: (value: unknown) => value is FieldValue;
50
+ readonly validationVersion: 1;
51
+ } & Readonly<{
52
+ default?: FieldValue | undefined;
53
+ generate?: (() => FieldValue) | undefined;
54
+ omitDefault?: boolean;
55
+ required?: boolean;
56
+ }> & Readonly<{
57
+ validate: (value: unknown) => value is FieldValue;
58
+ validationVersion: number;
59
+ }>>;
60
+ key: "defaultValue";
61
+ localId: "defaultValue";
62
+ ownerName: "field";
63
+ placement: "element";
64
+ unaliased: true;
65
+ value: string | number | boolean;
66
+ }> | Readonly<{
67
+ descriptor: PropertyStringDescriptor<{
68
+ readonly generate: typeof import("nanoid").nanoid;
69
+ }>;
70
+ key: "fieldId";
71
+ localId: "fieldId";
72
+ ownerName: "field";
73
+ placement: "element";
74
+ unaliased: true;
75
+ value: string;
76
+ }> | Readonly<{
77
+ descriptor: PropertyEnumDescriptor<readonly ["checkbox", "choice", "date", "number", "signature", "text"], {
78
+ readonly required: true;
79
+ }>;
80
+ key: "kind";
81
+ localId: "kind";
82
+ ownerName: "field";
83
+ placement: "element";
84
+ unaliased: true;
85
+ value: "checkbox" | "choice" | "date" | "number" | "signature" | "text";
86
+ }> | Readonly<{
87
+ descriptor: PropertyStringDescriptor<{
88
+ readonly required: true;
89
+ }>;
90
+ key: "label";
91
+ localId: "label";
92
+ ownerName: "field";
93
+ placement: "element";
94
+ unaliased: true;
95
+ value: string;
96
+ }> | Readonly<{
97
+ descriptor: PropertyJsonDescriptor<readonly Readonly<{
98
+ label: string;
99
+ value: string;
100
+ }>[], {
101
+ readonly validate: (value: unknown) => value is readonly FieldOption[];
102
+ readonly validationVersion: 1;
103
+ } & Readonly<{
104
+ default?: readonly Readonly<{
105
+ label: string;
106
+ value: string;
107
+ }>[] | undefined;
108
+ generate?: (() => readonly Readonly<{
109
+ label: string;
110
+ value: string;
111
+ }>[]) | undefined;
112
+ omitDefault?: boolean;
113
+ required?: boolean;
114
+ }> & Readonly<{
115
+ validate: (value: unknown) => value is readonly Readonly<{
116
+ label: string;
117
+ value: string;
118
+ }>[];
119
+ validationVersion: number;
120
+ }>>;
121
+ key: "options";
122
+ localId: "options";
123
+ ownerName: "field";
124
+ placement: "element";
125
+ unaliased: true;
126
+ value: readonly Readonly<{
127
+ label: string;
128
+ value: string;
129
+ }>[];
130
+ }> | Readonly<{
131
+ descriptor: PropertyBooleanDescriptor<PropertyValueOptions<boolean>>;
132
+ key: "required";
133
+ localId: "required";
134
+ ownerName: "field";
135
+ placement: "element";
136
+ unaliased: true;
137
+ value: boolean;
138
+ }> | Readonly<{
139
+ descriptor: PropertyStringDescriptor<{
140
+ readonly required: true;
141
+ }>;
142
+ key: "role";
143
+ localId: "role";
144
+ ownerName: "field";
145
+ placement: "element";
146
+ unaliased: true;
147
+ value: string;
148
+ }> | Readonly<{
149
+ descriptor: PropertyJsonDescriptor<FieldValue, {
150
+ readonly validate: (value: unknown) => value is FieldValue;
151
+ readonly validationVersion: 1;
152
+ } & Readonly<{
153
+ default?: FieldValue | undefined;
154
+ generate?: (() => FieldValue) | undefined;
155
+ omitDefault?: boolean;
156
+ required?: boolean;
157
+ }> & Readonly<{
158
+ validate: (value: unknown) => value is FieldValue;
159
+ validationVersion: number;
160
+ }>>;
161
+ key: "value";
162
+ localId: "value";
163
+ ownerName: "field";
164
+ placement: "element";
165
+ unaliased: true;
166
+ value: string | number | boolean;
167
+ }>;
168
+ readonly schema: {
169
+ readonly element: {
170
+ readonly properties: {
171
+ defaultValue: PropertyJsonDescriptor<FieldValue, {
172
+ readonly validate: (value: unknown) => value is FieldValue;
173
+ readonly validationVersion: 1;
174
+ } & Readonly<{
175
+ default?: FieldValue | undefined;
176
+ generate?: (() => FieldValue) | undefined;
177
+ omitDefault?: boolean;
178
+ required?: boolean;
179
+ }> & Readonly<{
180
+ validate: (value: unknown) => value is FieldValue;
181
+ validationVersion: number;
182
+ }>>;
183
+ kind: PropertyEnumDescriptor<readonly ["checkbox", "choice", "date", "number", "signature", "text"], {
184
+ readonly required: true;
185
+ }>;
186
+ label: PropertyStringDescriptor<{
187
+ readonly required: true;
188
+ }>;
189
+ options: PropertyJsonDescriptor<readonly Readonly<{
190
+ label: string;
191
+ value: string;
192
+ }>[], {
193
+ readonly validate: (value: unknown) => value is readonly FieldOption[];
194
+ readonly validationVersion: 1;
195
+ } & Readonly<{
196
+ default?: readonly Readonly<{
197
+ label: string;
198
+ value: string;
199
+ }>[] | undefined;
200
+ generate?: (() => readonly Readonly<{
201
+ label: string;
202
+ value: string;
203
+ }>[]) | undefined;
204
+ omitDefault?: boolean;
205
+ required?: boolean;
206
+ }> & Readonly<{
207
+ validate: (value: unknown) => value is readonly Readonly<{
208
+ label: string;
209
+ value: string;
210
+ }>[];
211
+ validationVersion: number;
212
+ }>>;
213
+ required: PropertyBooleanDescriptor<PropertyValueOptions<boolean>>;
214
+ role: PropertyStringDescriptor<{
215
+ readonly required: true;
216
+ }>;
217
+ value: PropertyJsonDescriptor<FieldValue, {
218
+ readonly validate: (value: unknown) => value is FieldValue;
219
+ readonly validationVersion: 1;
220
+ } & Readonly<{
221
+ default?: FieldValue | undefined;
222
+ generate?: (() => FieldValue) | undefined;
223
+ omitDefault?: boolean;
224
+ required?: boolean;
225
+ }> & Readonly<{
226
+ validate: (value: unknown) => value is FieldValue;
227
+ validationVersion: number;
228
+ }>>;
229
+ };
230
+ readonly void: "inline";
231
+ };
232
+ readonly properties: {
233
+ condition: SchemaElementPropertyDefinition<PropertyJsonDescriptor<Readonly<{
234
+ ref: string;
235
+ test: FieldTest;
236
+ value?: FieldValue;
237
+ }>, {
238
+ readonly validate: (value: unknown) => value is FieldCondition;
239
+ readonly validationVersion: 1;
240
+ } & Readonly<{
241
+ default?: Readonly<{
242
+ ref: string;
243
+ test: FieldTest;
244
+ value?: FieldValue;
245
+ }> | undefined;
246
+ generate?: (() => Readonly<{
247
+ ref: string;
248
+ test: FieldTest;
249
+ value?: FieldValue;
250
+ }>) | undefined;
251
+ omitDefault?: boolean;
252
+ required?: boolean;
253
+ }> & Readonly<{
254
+ validate: (value: unknown) => value is Readonly<{
255
+ ref: string;
256
+ test: FieldTest;
257
+ value?: FieldValue;
258
+ }>;
259
+ validationVersion: number;
260
+ }>>, Readonly<{
261
+ kind: 'types';
262
+ types: readonly ["field"];
263
+ }>, Readonly<{
264
+ key: string;
265
+ map: (value: Readonly<{
266
+ ref: string;
267
+ test: FieldTest;
268
+ value?: FieldValue;
269
+ }>, renamed: (name: string) => string | undefined) => Readonly<{
270
+ ref: string;
271
+ test: FieldTest;
272
+ value?: FieldValue;
273
+ }>;
274
+ }>>;
275
+ fieldId: SchemaElementPropertyDefinition<PropertyStringDescriptor<{
276
+ readonly generate: typeof import("nanoid").nanoid;
277
+ }>, Readonly<{
278
+ kind: 'types';
279
+ types: readonly ["field"];
280
+ }>, Readonly<{
281
+ key: string;
282
+ map: (value: string, renamed: (name: string) => string | undefined) => string;
283
+ }>>;
284
+ };
285
+ };
286
+ readonly name: "field";
287
+ readonly activate: true;
288
+ readonly corrections: true;
289
+ readonly formats: true;
290
+ readonly initialState: {
291
+ readonly fillRole: string | null;
292
+ };
293
+ readonly read: {
294
+ readonly field: (fieldId: string) => FieldRead | null;
295
+ readonly fields: () => FieldRead[];
296
+ };
297
+ readonly update: {
298
+ readonly insert: TxDeclaredMethod<(settings: FieldSettings, options?: NodeInsertOptions) => string>;
299
+ readonly update: TxDeclaredMethod<(fieldId: string, patch: FieldPatch) => void>;
300
+ };
301
+ }>>;
302
+ /**
303
+ * Read the field with this id and its problems. A commit that changes an
304
+ * element rereads it, and the caller renders again only when the field or its
305
+ * problems changed, such as when the field its condition names is deleted.
306
+ */
307
+ declare const useFieldRead: (fieldId: string) => Readonly<{
308
+ fieldId: string;
309
+ node: FieldElement;
310
+ problems: readonly FieldProblem[];
311
+ }> | null;
312
+ export { FieldPlugin, useFieldRead };
@@ -0,0 +1,2 @@
1
+ import { FieldPlugin, useFieldRead } from "./FieldPlugin.js";
2
+ export { FieldPlugin, useFieldRead };
@@ -1,9 +1,10 @@
1
- import { $u as EditorJsonValue, El as SchemaContentDefault, Hs as NodeEntry, Il as SchemaContentRule, Ju as Path, Qo as TxDeclaredMethod, Tc as BaseElement, Wu as Point, vl as PropertyStringDescriptor } from "../../../index-BU6k1Aev.js";
2
- import { _t as NodeInsertOptions } from "../../../core-BJG8l_mk.js";
3
- import { At as Plugin, xt as InternalPluginAuthorExtension } from "../../../index-D1CFXA-i.js";
4
- import { t as ComboboxEditor } from "../../../combobox-DkBGgyd3.js";
5
- import "../../../index-BBKGrsG3.js";
6
- import { i as FootnoteAnchor, r as CreateFootnoteDefinitionOptions } from "../../../index-Bq3sdm3S.js";
1
+ import { Ps as SchemaContentRule, Vt as EditorJsonValue, Wo as Point, Za as Path, da as NodeEntry, eu as TxDeclaredMethod, is as PropertyStringDescriptor, v as BaseElement, ws as SchemaContentDefault } from "../../../index-DpltOCot-A2b3p3Eb.js";
2
+ import "../../../htmlTypes-cg_cWsaN.js";
3
+ import { _t as NodeInsertOptions } from "../../../core-ClHasORr.js";
4
+ import { At as Plugin, xt as InternalPluginAuthorExtension } from "../../../index-8WO2vI0U.js";
5
+ import { t as ComboboxEditor } from "../../../combobox-DAOYWuvC.js";
6
+ import "../../../index-Cmuluh6f.js";
7
+ import { i as FootnoteAnchor, r as CreateFootnoteDefinitionOptions } from "../../../index-BZWFoUXt.js";
7
8
  declare const FootnoteDefinitionPlugin: Plugin<Readonly<{
8
9
  readonly __pluginWritableProperties: Readonly<{
9
10
  descriptor: PropertyStringDescriptor<{
@@ -1,6 +1,7 @@
1
- import { Qo as TxDeclaredMethod, Zt as Anchor, zu as Range } from "../../../index-BU6k1Aev.js";
2
- import { An as CapturedFormat, _ as BasePlugin, bo as PluginReference, vo as PluginDependency } from "../../../core-BJG8l_mk.js";
3
- import { At as Plugin, xt as InternalPluginAuthorExtension } from "../../../index-D1CFXA-i.js";
1
+ import { eu as TxDeclaredMethod, s as Anchor, us as Range } from "../../../index-DpltOCot-A2b3p3Eb.js";
2
+ import "../../../htmlTypes-cg_cWsaN.js";
3
+ import { An as CapturedFormat, _ as BasePlugin, xo as PluginReference, yo as PluginDependency } from "../../../core-ClHasORr.js";
4
+ import { At as Plugin, xt as InternalPluginAuthorExtension } from "../../../index-8WO2vI0U.js";
4
5
  /**
5
6
  * One view's format painter. An armed brush always holds the look it copied
6
7
  * and an anchor on the range it copied from; `once` puts the brush down after