platejs 54.0.0-beta.2 → 54.0.0-beta.4

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 (255) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES.md +56 -0
  3. package/dist/{AIChatRequestContext-BMVWhfPV.d.ts → AIChatRequestContext-DrUahdTc.d.ts} +2 -2
  4. package/dist/{BaseSuggestionPlugin-DBl3fqnm.d.ts → BaseSuggestionPlugin-_7Ka6nY3.d.ts} +7 -3
  5. package/dist/{PlateStatic-DhNv2ejp.d.ts → PlateStatic-D3Cb-QwH.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-Dr0OYZIE.d.ts} +2 -2
  14. package/dist/{comparison-types-CYnJ35qU.d.ts → comparison-types-DdwE6mYq-BogsHoUO.d.ts} +10 -2
  15. package/dist/compiler/index.d.ts +2 -2
  16. package/dist/{core-BJG8l_mk.d.ts → core-BqR-fEDp.d.ts} +493 -116
  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 +5 -3
  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/core.md +45 -5
  24. package/dist/docs/api/dom.md +11 -4
  25. package/dist/docs/api/editor-transforms.md +2 -1
  26. package/dist/docs/api/react-hooks.md +45 -13
  27. package/dist/docs/authored-changes.md +9 -4
  28. package/dist/docs/basic-blocks.md +42 -29
  29. package/dist/docs/block-placeholder.md +4 -2
  30. package/dist/docs/blockquote.md +5 -3
  31. package/dist/docs/board.md +118 -10
  32. package/dist/docs/code-block.md +47 -0
  33. package/dist/docs/comment.md +2 -2
  34. package/dist/docs/discussion.md +1 -1
  35. package/dist/docs/document-model.md +15 -3
  36. package/dist/docs/docx.md +1 -1
  37. package/dist/docs/dom-coverage.md +5 -0
  38. package/dist/docs/editor.md +50 -4
  39. package/dist/docs/examples/editable-voids.md +2 -3
  40. package/dist/docs/external-text.md +2 -0
  41. package/dist/docs/field.md +370 -0
  42. package/dist/docs/find.md +9 -6
  43. package/dist/docs/form.md +2 -0
  44. package/dist/docs/heading.md +6 -0
  45. package/dist/docs/installation/manual.md +0 -4
  46. package/dist/docs/link.md +3 -3
  47. package/dist/docs/llms.txt +4 -2
  48. package/dist/docs/markdown.md +270 -14
  49. package/dist/docs/plugin-components.md +13 -10
  50. package/dist/docs/plugin-input-rules.md +66 -15
  51. package/dist/docs/prompt-editor.md +205 -0
  52. package/dist/docs/roots.md +8 -6
  53. package/dist/docs/rtl.md +6 -4
  54. package/dist/docs/selection.md +7 -4
  55. package/dist/docs/suggestion.md +1 -1
  56. package/dist/docs/toolbar.md +26 -30
  57. package/dist/docs/upload.md +106 -17
  58. package/dist/docx/export/index.d.ts +3 -3
  59. package/dist/docx/export/lib/docxStaticComponents.js +12 -2
  60. package/dist/docx/export/lib/exportDocx.js +46 -17
  61. package/dist/docx/export/lib/internal/xml-builder.js +11 -16
  62. package/dist/docx/export/lib/reviewPart.js +1 -1
  63. package/dist/docx/export/lib/reviewProjection.js +52 -10
  64. package/dist/docx/import/index.d.ts +4 -4
  65. package/dist/docx/paste/index.d.ts +4 -4
  66. package/dist/dom/index.d.ts +1 -6
  67. package/dist/dom/plite-dom.internal.js +2 -2
  68. package/dist/excalidraw/index.d.ts +3 -2
  69. package/dist/excalidraw/react/index.d.ts +3 -2
  70. package/dist/facade.js +2 -2
  71. package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +13 -5
  72. package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +32 -10
  73. package/dist/features/board/index.d.ts +2 -2
  74. package/dist/features/board/lib/BaseBoardPlugin.js +14 -1
  75. package/dist/features/board/lib/boardStroke.internal.js +13 -1
  76. package/dist/features/board/lib/boardTypes.internal.js +16 -0
  77. package/dist/features/callout/index.d.ts +3 -2
  78. package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +14 -5
  79. package/dist/features/combobox/index.d.ts +2 -2
  80. package/dist/features/comments/BaseCommentsPlugin.js +33 -17
  81. package/dist/features/comments/index.d.ts +1 -1
  82. package/dist/features/date/index.d.ts +3 -2
  83. package/dist/features/details/index.d.ts +3 -2
  84. package/dist/features/details/lib/BaseDetailsPlugin.js +25 -12
  85. package/dist/features/field/index.d.ts +2 -0
  86. package/dist/features/field/index.js +4 -0
  87. package/dist/features/field/lib/BaseFieldPlugin.js +360 -0
  88. package/dist/features/field/lib/applyFieldValues.js +188 -0
  89. package/dist/features/field/lib/fieldRules.internal.js +204 -0
  90. package/dist/features/find/index.d.ts +3 -2
  91. package/dist/features/footnote/index.d.ts +1 -1
  92. package/dist/features/ink/index.d.ts +1 -1
  93. package/dist/features/ink/lib/BaseInkPlugin.js +126 -103
  94. package/dist/features/ink/lib/inkCodec.internal.js +130 -0
  95. package/dist/features/ink/lib/inkGone.internal.js +229 -48
  96. package/dist/features/ink/lib/inkPlaces.internal.js +534 -64
  97. package/dist/features/layout/index.d.ts +1 -1
  98. package/dist/features/link/lib/BaseLinkPlugin.js +6 -4
  99. package/dist/features/lint/index.d.ts +3 -2
  100. package/dist/features/media/index.d.ts +2 -2
  101. package/dist/features/media/index.js +2 -2
  102. package/dist/features/media/lib/media/parseMediaUrl.js +11 -1
  103. package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +206 -4
  104. package/dist/features/mention/index.d.ts +5 -4
  105. package/dist/features/suggestion/index.d.ts +1 -1
  106. package/dist/features/table/index.d.ts +1 -1
  107. package/dist/features/table/lib/BaseTablePlugin.js +64 -15
  108. package/dist/features/table/lib/internal/selection.js +4 -2
  109. package/dist/features/toc/index.d.ts +1 -1
  110. package/dist/features/upload/index.d.ts +2 -2
  111. package/dist/features/upload/lib/BaseUploadPlugin.js +464 -250
  112. package/dist/history/index.d.ts +2 -2
  113. package/dist/html/index.d.ts +3 -3
  114. package/dist/html/server/index.d.ts +1 -1
  115. package/dist/{htmlTypes-DjeFG3P8.d.ts → htmlTypes-eT2ZGDAj.d.ts} +2 -31
  116. package/dist/hyperscript/index.d.ts +1 -1
  117. package/dist/{index-DzD6BIFJ.d.ts → index-B33E1CRJ.d.ts} +295 -6
  118. package/dist/{index-Cl77E9yr.d.ts → index-B7moSod7.d.ts} +2 -2
  119. package/dist/{index-hsC_sOn2.d.ts → index-B8-5Sr7I.d.ts} +35 -5
  120. package/dist/{index-BiQerPJS.d.ts → index-B8QJDAmG.d.ts} +2 -2
  121. package/dist/{index-BBKGrsG3.d.ts → index-BTx5oK7k.d.ts} +1 -1
  122. package/dist/{index-iaZOhA76.d.ts → index-BWPcE4ac-Cto_IsNs.d.ts} +7 -1
  123. package/dist/{index-BU6k1Aev.d.ts → index-BXjLmx1n-CXk17buG.d.ts} +4781 -4584
  124. package/dist/{index-kLKMc-pI.d.ts → index-BXwU9QH6.d.ts} +2 -2
  125. package/dist/{index-DTgaSxKr.d.ts → index-BkwR-5hH.d.ts} +40 -4
  126. package/dist/{index-Bq3sdm3S.d.ts → index-BsV2McRr.d.ts} +5 -4
  127. package/dist/index-C9Fu-P4E.d.ts +773 -0
  128. package/dist/{index-D5W-p9bS.d.ts → index-Ca48r1ng.d.ts} +49 -4
  129. package/dist/{index-CcZbqPqk.d.ts → index-Cob_iBdu.d.ts} +116 -41
  130. package/dist/{index-Bxfvicyy.d.ts → index-CpY7Xnxw.d.ts} +4 -3
  131. package/dist/{index-BkR7-GLI.d.ts → index-DNQXzU-X.d.ts} +2 -2
  132. package/dist/{index-D1CFXA-i.d.ts → index-DPowErHa.d.ts} +471 -141
  133. package/dist/{index-DaM37gF6.d.ts → index-DShbzec2.d.ts} +38 -23
  134. package/dist/{index-DC_MNGyu.d.ts → index-DYdObeFQ.d.ts} +3 -3
  135. package/dist/{index-Bc2Yg_2j.d.ts → index-Dq3Jlj8O-BJ6NxZm0.d.ts} +2 -2
  136. package/dist/{index-CT7miqQN.d.ts → index-DwWQVwQt.d.ts} +29 -11
  137. package/dist/{index-xdmCBvlT.d.ts → index-JWgwL5l3.d.ts} +5 -2
  138. package/dist/{index-DLA2DUR2.d.ts → index-M781pyx9.d.ts} +4 -3
  139. package/dist/{index-DdIRduDG.d.ts → index-d7io3MzC.d.ts} +3 -2
  140. package/dist/index.d.ts +4 -4
  141. package/dist/{react/internal → internal}/penStroke.internal.js +1 -1
  142. package/dist/internal/plugin/OverridePlugin.js +101 -119
  143. package/dist/internal/plugin/collectPlateNodeMappings.js +5 -1
  144. package/dist/internal/plugin/pastedUploadFiles.js +4 -0
  145. package/dist/internal/plugin/resolvePlugin.js +1 -1
  146. package/dist/internal/plugin/resolvePlugins.js +3 -0
  147. package/dist/internal/plugin/uploadDrafts.js +6 -0
  148. package/dist/internal/utils/mergePlugins.js +1 -0
  149. package/dist/lib/plugins/element-id/ElementIdPlugin.js +14 -18
  150. package/dist/lib/plugins/html/HtmlPlugin.js +9 -0
  151. package/dist/lib/plugins/html/htmlSafety.js +1 -1
  152. package/dist/lib/plugins/input-rules/InputRulesPlugin.js +77 -28
  153. package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +16 -0
  154. package/dist/markdown/index.d.ts +2 -2
  155. package/dist/markdown/index.js +3 -1
  156. package/dist/markdown/lib/MarkdownPlugin.js +14 -11
  157. package/dist/markdown/lib/RawHtmlPlugin.js +26 -0
  158. package/dist/markdown/lib/deserializer/mdastToSlate.js +12 -2
  159. package/dist/markdown/lib/internal/markdownConversion.js +776 -74
  160. package/dist/markdown/lib/internal/markdownDiagnostics.js +18 -7
  161. package/dist/markdown/lib/internal/markdownFootnoteWriter.js +35 -0
  162. package/dist/markdown/lib/internal/markdownFrontmatter.js +102 -0
  163. package/dist/markdown/lib/internal/markdownIntrinsics.js +125 -43
  164. package/dist/markdown/lib/internal/markdownLine.js +5 -3
  165. package/dist/markdown/lib/internal/markdownMappings.js +19 -7
  166. package/dist/markdown/lib/internal/markdownOpenTail.js +381 -0
  167. package/dist/markdown/lib/internal/markdownRawHtml.js +353 -0
  168. package/dist/markdown/lib/internal/markdownSegments.js +57 -48
  169. package/dist/markdown/lib/internal/markdownTags.js +29 -9
  170. package/dist/markdown/lib/serializer/convertNodesSerialize.js +10 -8
  171. package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +226 -0
  172. package/dist/markdown/lib/serializer/listToMdastTree.js +2 -0
  173. package/dist/math/index.d.ts +3 -2
  174. package/dist/math/react/index.d.ts +4 -3
  175. package/dist/migrations/index.d.ts +3 -3
  176. package/dist/migrations/migratePlateV54.js +4 -6
  177. package/dist/migrations/migratePlateV54RetiredMarks.internal.js +23 -8
  178. package/dist/migrations/migratePlateV54Suggestions.internal.js +2 -2
  179. package/dist/migrations/v53-manifest.internal.js +4 -0
  180. package/dist/pagination/index.d.ts +1 -1
  181. package/dist/pagination/react/index.d.ts +4 -4
  182. package/dist/react/components/EditorContentView.internal.js +42 -23
  183. package/dist/react/components/EditorProvider.js +5 -5
  184. package/dist/react/components/Plate.js +102 -128
  185. package/dist/react/components/PlateContainer.js +40 -32
  186. package/dist/react/components/PlateController.js +28 -16
  187. package/dist/react/components/PlateRoot.internal.js +3 -2
  188. package/dist/react/core.js +4 -4
  189. package/dist/react/features/board/BoardSurface.js +116 -87
  190. package/dist/react/features/board/boardClipboard.internal.js +15 -5
  191. package/dist/react/features/board/boardExport.internal.js +470 -0
  192. package/dist/react/features/board/boardGesture.internal.js +6 -3
  193. package/dist/react/features/board/boardIndex.internal.js +7 -18
  194. package/dist/react/features/board/boardPictureStyles.internal.js +415 -0
  195. package/dist/react/features/board/boardPictures.internal.js +19 -13
  196. package/dist/react/features/board/boardView.internal.js +190 -50
  197. package/dist/react/features/board/boardVoice.internal.js +10 -11
  198. package/dist/react/features/board/index.d.ts +108 -18
  199. package/dist/react/features/callout/index.d.ts +3 -2
  200. package/dist/react/features/combobox/index.d.ts +8 -8
  201. package/dist/react/features/comments/index.d.ts +6 -5
  202. package/dist/react/features/date/index.d.ts +4 -3
  203. package/dist/react/features/details/index.d.ts +4 -3
  204. package/dist/react/features/field/FieldPlugin.js +35 -0
  205. package/dist/react/features/field/index.d.ts +315 -0
  206. package/dist/react/features/field/index.js +2 -0
  207. package/dist/react/features/footnote/index.d.ts +7 -6
  208. package/dist/react/features/format-painter/index.d.ts +4 -3
  209. package/dist/react/features/ink/InkContent.js +313 -0
  210. package/dist/react/features/ink/index.d.ts +57 -33
  211. package/dist/react/features/ink/index.js +2 -2
  212. package/dist/react/features/ink/inkCapture.internal.js +39 -17
  213. package/dist/react/features/ink/inkInput.internal.js +1 -1
  214. package/dist/react/features/ink/inkLayout.internal.js +6 -3
  215. package/dist/react/features/ink/inkPaint.internal.js +78 -2
  216. package/dist/react/features/ink/inkPlacement.internal.js +332 -104
  217. package/dist/react/features/ink/inkWatch.internal.js +7 -5
  218. package/dist/react/features/layout/index.d.ts +5 -4
  219. package/dist/react/features/media/index.d.ts +5 -4
  220. package/dist/react/features/mention/index.d.ts +6 -5
  221. package/dist/react/features/resizable/Resizable.js +4 -6
  222. package/dist/react/features/resizable/index.d.ts +5 -5
  223. package/dist/react/features/suggestion/index.d.ts +6 -5
  224. package/dist/react/features/table/TablePlugin.js +4 -11
  225. package/dist/react/features/table/index.d.ts +10 -8
  226. package/dist/react/features/table/useTableResize.js +10 -1
  227. package/dist/react/features/toc/index.d.ts +2 -2
  228. package/dist/react/features/upload/index.d.ts +11 -6
  229. package/dist/react/index.d.ts +6 -6
  230. package/dist/react/index.js +4 -4
  231. package/dist/react/internal/plate-context.js +434 -188
  232. package/dist/react/plite-react.js +2 -2
  233. package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +12 -10
  234. package/dist/react/stores/plate/useEditor.js +32 -14
  235. package/dist/react/stores/plate/useEditorHistory.js +55 -0
  236. package/dist/react/stores/plate/useEditorSelector.js +79 -21
  237. package/dist/react/utils/BlockPlaceholderPlugin.js +5 -2
  238. package/dist/react/utils/pipeRenderElement.internal.js +1 -1
  239. package/dist/react/utils/pluginRenderElement.internal.js +1 -1
  240. package/dist/react/virtualized.d.ts +4 -4
  241. package/dist/{source-CNKy99Th.d.ts → source-BGohy8vH.d.ts} +4 -4
  242. package/dist/static/index.d.ts +18 -18
  243. package/dist/static/internal/renderStaticHtmlWithOverrides.js +2 -2
  244. package/dist/static/internal/staticPresentation.js +4 -4
  245. package/dist/static/internal/writeStaticSelectionClipboardData.js +7 -2
  246. package/dist/tabbable/index.d.ts +1 -1
  247. package/dist/tabbable/react/index.d.ts +3 -3
  248. package/dist/testing/index.d.ts +3 -3
  249. package/dist/yjs/index.d.ts +1 -1
  250. package/dist/yjs/react/index.d.ts +6 -6
  251. package/package.json +20 -2
  252. package/dist/markdown/lib/serializer/convertTextsSerialize.js +0 -163
  253. package/dist/react/components/EditorSelectionView.js +0 -40
  254. package/dist/react/features/ink/InkLayer.js +0 -218
  255. package/dist/react/internal/createPlateTargetScope.js +0 -62
@@ -1,9 +1,9 @@
1
- import { $i as NodeKey, $u as EditorJsonValue, Cl as PropertyValueOptions, Ec as Element, Kl as SchemaElementPropertyDefinition, Os as Descendant, Qo as TxDeclaredMethod, _u as SchemaPropertySplitPolicy, bl as PropertyValueDescriptor, dl as PropertyEnumDescriptor, fl as PropertyJsonDescriptor, gu as SchemaPropertyRole, ml as PropertyNumberDescriptor, mu as SchemaPropertyLandingPolicy, su as SchemaPropertyCopyPolicy, vl as PropertyStringDescriptor, vu as SchemaPropertyTypeChangePolicy, xl as PropertyValueKind, y as ContentSlice } from "../../../index-BU6k1Aev.js";
2
- import "../../../htmlTypes-DjeFG3P8.js";
3
- import { _ as BasePlugin, ct as BlockInsertOptions } from "../../../core-BJG8l_mk.js";
4
- import { At as Plugin, tn as EditorElementProps } from "../../../index-D1CFXA-i.js";
5
- import { B as isStackingKey, C as BoardArrowEnds, F as BoardRestackDirection, H as BOARD_STROKE_STYLES, I as BoardShapeInsertProps, L as BoardSize, M as isBoardFramePlace, N as isBoardShapePlace, O as BoardMemberEntry, P as BoardPlace, S as BoardArrowEnd, T as isBoardArrowEnd, U as BoardStyleProperties, V as BOARD_ARROW_STYLES, W as BoardStyles, b as BoardArrowEndInput, c as isBoardStrokePoints, j as BoardShapePlace, m as BoardGeo, o as BoardInkPoint, s as BoardStrokePoints, w as BoardArrowSide, x as BoardArrowAnchor, z as isBoardSize } from "../../../index-D5W-p9bS.js";
6
- import * as React$1 from "react";
1
+ import { Ca as NodeKey, Ci as Element, H as Descendant, Ht as EditorJsonValue, bc as SchemaPropertyTypeChangePolicy, es as PropertyEnumDescriptor, fs as PropertyValueOptions, gc as SchemaPropertyLandingPolicy, iu as TxDeclaredMethod, j as ContentSlice, lc as SchemaPropertyCopyPolicy, ls as PropertyValueDescriptor, qs as SchemaElementPropertyDefinition, rs as PropertyNumberDescriptor, ss as PropertyStringDescriptor, ts as PropertyJsonDescriptor, us as PropertyValueKind, vc as SchemaPropertyRole, yc as SchemaPropertySplitPolicy } from "../../../index-BXjLmx1n-CXk17buG.js";
2
+ import "../../../htmlTypes-eT2ZGDAj.js";
3
+ import { _ as BasePlugin, ct as BlockInsertOptions, st as BasePluginInput } from "../../../core-BqR-fEDp.js";
4
+ import { At as Plugin, tn as EditorElementProps } from "../../../index-DPowErHa.js";
5
+ import { B as isBoardSize, C as BoardArrowEnd, E as isBoardArrowEnd, F as BoardPlace, G as BoardStyles, H as BOARD_ARROW_STYLES, I as BoardRestackDirection, L as BoardShapeInsertProps, M as BoardShapePlace, N as isBoardFramePlace, P as isBoardShapePlace, R as BoardSize, S as BoardArrowAnchor, T as BoardArrowSide, U as BOARD_STROKE_STYLES, V as isStackingKey, W as BoardStyleProperties, c as BoardStrokePoints, h as BoardGeo, k as BoardMemberEntry, l as isBoardStrokePoints, o as BoardInkPoint, s as BoardStrokePath, w as BoardArrowEnds, x as BoardArrowEndInput } from "../../../index-Ca48r1ng.js";
6
+ import * as React from "react";
7
7
  import "rbush";
8
8
  declare const BoardPlugin: Plugin<Readonly<{
9
9
  readonly __pluginWritableProperties: Readonly<{
@@ -164,12 +164,34 @@ declare const BoardPlugin: Plugin<Readonly<{
164
164
  }>>, Readonly<{
165
165
  kind: 'types';
166
166
  types: string[];
167
+ }>, Readonly<{
168
+ key: string;
169
+ map: (value: Readonly<{
170
+ x: number;
171
+ y: number;
172
+ }> | Readonly<{
173
+ frame: string;
174
+ frameOrigin: BoardPlace;
175
+ x: number;
176
+ y: number;
177
+ }>, renamed: (name: string) => string | undefined) => Readonly<{
178
+ x: number;
179
+ y: number;
180
+ }> | Readonly<{
181
+ frame: string;
182
+ frameOrigin: BoardPlace;
183
+ x: number;
184
+ y: number;
185
+ }>;
167
186
  }>>;
168
187
  readonly shapeId: SchemaElementPropertyDefinition<PropertyStringDescriptor<{
169
188
  readonly generate: typeof import("nanoid").nanoid;
170
189
  }>, Readonly<{
171
190
  kind: 'types';
172
191
  types: readonly string[];
192
+ }>, Readonly<{
193
+ key: string;
194
+ map: (value: string, renamed: (name: string) => string | undefined) => string;
173
195
  }>>;
174
196
  readonly size: SchemaElementPropertyDefinition<PropertyJsonDescriptor<Readonly<{
175
197
  height: number;
@@ -198,6 +220,15 @@ declare const BoardPlugin: Plugin<Readonly<{
198
220
  }>>, Readonly<{
199
221
  kind: 'types';
200
222
  types: string[];
223
+ }>, Readonly<{
224
+ key: string;
225
+ map: (value: Readonly<{
226
+ height: number;
227
+ width: number;
228
+ }>, renamed: (name: string) => string | undefined) => Readonly<{
229
+ height: number;
230
+ width: number;
231
+ }>;
201
232
  }>>;
202
233
  readonly zIndex: SchemaElementPropertyDefinition<PropertyStringDescriptor<{
203
234
  readonly required: true;
@@ -206,6 +237,9 @@ declare const BoardPlugin: Plugin<Readonly<{
206
237
  }>, Readonly<{
207
238
  kind: 'types';
208
239
  types: readonly string[];
240
+ }>, Readonly<{
241
+ key: string;
242
+ map: (value: string, renamed: (name: string) => string | undefined) => string;
209
243
  }>>;
210
244
  readonly framePlace?: Readonly<{
211
245
  copy: SchemaPropertyCopyPolicy;
@@ -975,6 +1009,7 @@ declare const BoardPlugin: Plugin<Readonly<{
975
1009
  readonly shape: (id: string) => BoardMemberEntry | null;
976
1010
  readonly slice: (ids: readonly string[]) => ContentSlice | null;
977
1011
  readonly shapes: (board: NodeKey) => BoardMemberEntry[];
1012
+ readonly strokePath: (id: string) => BoardStrokePath | null;
978
1013
  };
979
1014
  readonly readMiddleware: true;
980
1015
  readonly update: {
@@ -1704,12 +1739,6 @@ declare const BoardImagePlugin: Plugin<Readonly<{
1704
1739
  }>) => string | undefined>;
1705
1740
  };
1706
1741
  }>>;
1707
- /** Where a stroke draws: an SVG path over a box of `width` by `height`. */
1708
- type BoardStrokePath = Readonly<{
1709
- height: number;
1710
- path: string;
1711
- width: number;
1712
- }>;
1713
1742
  /** Where an arrow draws: its two ends in board coordinates and the path between them. */
1714
1743
  type BoardArrowPath = BoardArrowEnds & Readonly<{
1715
1744
  path: string;
@@ -1967,6 +1996,12 @@ type BoardViewState = Readonly<{
1967
1996
  * changes.
1968
1997
  */
1969
1998
  selectedShapes: readonly BoardMemberEntry[];
1999
+ /**
2000
+ * Whether the board lands picture files from `upload`, a paste or a drop,
2001
+ * which needs a view that can write, the upload plugin, and an image shape
2002
+ * that holds both the upload draft and the image element.
2003
+ */
2004
+ takesPictureFiles: boolean;
1970
2005
  tool: BoardTool;
1971
2006
  /**
1972
2007
  * Whether the note, shape, frame and arrow tools stay picked after they add
@@ -1977,7 +2012,51 @@ type BoardViewState = Readonly<{
1977
2012
  /** Whether the view can write: false when it is read-only or a preview. */
1978
2013
  writable: boolean;
1979
2014
  }>;
2015
+ /** How `exportPicture` draws the board. */
2016
+ type BoardPictureOptions = Readonly<{
2017
+ /** `png` draws pixels, and `svg` keeps the shapes as markup. */
2018
+ format: 'png' | 'svg';
2019
+ /**
2020
+ * The static plugins that draw each shape and its content, as
2021
+ * `renderStaticHtml`'s `presentation` takes them, or a promise of them, such
2022
+ * as a dynamic import. The export reads the selection before it waits for
2023
+ * the promise.
2024
+ */
2025
+ kit: Promise<readonly BasePluginInput[]> | readonly BasePluginInput[];
2026
+ }>;
2027
+ /**
2028
+ * Something the picture shows differently from the board. `content-undrawn`
2029
+ * means the kit has no static drawing for some content, `downscaled` that the
2030
+ * PNG is the SVG drawn at less than twice its size, and `font-missing` that a
2031
+ * font the text uses could not be read. `image-unreadable` means an image in
2032
+ * `shapeId` could not be read and draws as a gray box, or stays a web link in
2033
+ * an SVG, and `shape-undrawn` that the kit draws no shape for `shapeId`, so a
2034
+ * gray box stands in for it.
2035
+ */
2036
+ type BoardPictureWarning = Readonly<{
2037
+ code: 'content-undrawn' | 'downscaled' | 'font-missing';
2038
+ }> | Readonly<{
2039
+ code: 'image-unreadable' | 'shape-undrawn';
2040
+ shapeId: string;
2041
+ }>;
2042
+ /** A picture of the board, with its size in pixels and what it could not show. */
2043
+ type BoardPicture = Readonly<{
2044
+ blob: Blob;
2045
+ height: number;
2046
+ warnings: readonly BoardPictureWarning[];
2047
+ width: number;
2048
+ }>;
1980
2049
  type BoardViewActions = Readonly<{
2050
+ /**
2051
+ * Draw the board as a picture with `kit`. With shapes selected when it is
2052
+ * called, it draws only those and the members of each selected frame. The
2053
+ * PNG is the SVG drawn at twice its size, or smaller when that passes 16,384
2054
+ * px a side or 16,777,216 px in all. It resolves null when there is nothing
2055
+ * to draw, such as on an empty board. It rejects when the board surface is
2056
+ * not on the page, or leaves it before the picture is drawn. It loads its
2057
+ * drawing code on the first call.
2058
+ */
2059
+ exportPicture: (options: BoardPictureOptions) => Promise<BoardPicture | null>;
1981
2060
  /** Move the camera so every shape is in view, at most at full size, and clear of the toolbar when the board has room. A focused board says the new zoom when it changes. */
1982
2061
  fit: () => void;
1983
2062
  /** Move focus to the board and keep its selection, such as after a toolbar menu closes. A shape whose text is being edited ends its edit and stays selected. */
@@ -2001,6 +2080,17 @@ type BoardViewActions = Readonly<{
2001
2080
  * the selection, and the focused view says `toolLock` when it changes.
2002
2081
  */
2003
2082
  setToolLocked: (locked: boolean) => void;
2083
+ /**
2084
+ * Upload each of `files` as an image shape, in a row centered on the view,
2085
+ * as one undo step, and select the shapes. The shapes land once the
2086
+ * pictures load. A landing that still waits lands nothing after another
2087
+ * landing starts, a key or press on the board, any paste, a document or
2088
+ * selection change, focus leaving the board, or the view turning read-only.
2089
+ * The upload plugin reports a file that is not a picture, and the pictures
2090
+ * beside it still land. An empty list changes nothing, and neither does a
2091
+ * view whose `takesPictureFiles` is false.
2092
+ */
2093
+ upload: (files: readonly File[]) => void;
2004
2094
  /** Zoom in to the next of 10, 25, 50, 100, 200, 400 and 800 percent around the view's center, as `+` does, and do nothing at 800. A focused board says the new zoom. */
2005
2095
  zoomIn: () => void;
2006
2096
  /** Zoom out to the next lower of 10, 25, 50, 100, 200, 400 and 800 percent around the view's center, as `-` does, and do nothing at 10. A focused board says the new zoom. */
@@ -2021,8 +2111,8 @@ type BoardViewActions = Readonly<{
2021
2111
  */
2022
2112
  declare function BoardShape({ className, style, ...props }: EditorElementProps<typeof BoardArrowPlugin | typeof BoardFramePlugin | typeof BoardGeoPlugin | typeof BoardImagePlugin | typeof BoardNotePlugin | typeof BoardStrokePlugin> & {
2023
2113
  className?: string;
2024
- style?: React$1.CSSProperties;
2025
- }): React$1.JSX.Element;
2114
+ style?: React.CSSProperties;
2115
+ }): React.JSX.Element;
2026
2116
  /**
2027
2117
  * Where the board arrow `element` draws: its two ends in board coordinates,
2028
2118
  * each bound end stopped at its shape's outline, and the path between them.
@@ -2083,12 +2173,12 @@ declare const useStrokePath: (element: Element) => BoardStrokePath | undefined;
2083
2173
  * `height`; it never changes the document.
2084
2174
  */
2085
2175
  declare function BoardSurface({ height, messages, toolbar, ...props }: EditorElementProps<typeof BoardPlugin> & {
2086
- height?: React$1.CSSProperties['height'];
2176
+ height?: React.CSSProperties['height'];
2087
2177
  messages: BoardMessages;
2088
- toolbar?: React$1.ReactNode;
2089
- }): React$1.JSX.Element;
2178
+ toolbar?: React.ReactNode;
2179
+ }): React.JSX.Element;
2090
2180
  /** Read the surrounding board view's state, such as its tool. */
2091
2181
  declare const useBoardView: <T>(selector: (view: BoardViewState) => T) => T;
2092
2182
  /** Change the surrounding board view's tool, next style and camera. */
2093
2183
  declare const useBoardActions: () => BoardViewActions;
2094
- export { type BoardArrowPath, BoardArrowPlugin, type BoardCamera, type BoardCorner, BoardFramePlugin, BoardGeoPlugin, BoardImagePlugin, type BoardMessages, BoardNotePlugin, type BoardPickState, BoardPlugin, BoardShape, type BoardShapeDescription, type BoardStrokePath, BoardStrokePlugin, type BoardStyle, BoardSurface, type BoardTool, type BoardViewActions, type BoardViewState, useArrowPath, useBoardActions, useBoardView, useStrokePath };
2184
+ export { type BoardArrowPath, BoardArrowPlugin, type BoardCamera, type BoardCorner, BoardFramePlugin, BoardGeoPlugin, BoardImagePlugin, type BoardMessages, BoardNotePlugin, type BoardPickState, type BoardPicture, type BoardPictureOptions, type BoardPictureWarning, BoardPlugin, BoardShape, type BoardShapeDescription, BoardStrokePlugin, type BoardStyle, BoardSurface, type BoardTool, type BoardViewActions, type BoardViewState, useArrowPath, useBoardActions, useBoardView, useStrokePath };
@@ -1,5 +1,6 @@
1
- import { $u as EditorJsonValue, Cl as PropertyValueOptions, vl as PropertyStringDescriptor } from "../../../index-BU6k1Aev.js";
2
- import { At as Plugin } from "../../../index-D1CFXA-i.js";
1
+ import { Ht as EditorJsonValue, fs as PropertyValueOptions, ss as PropertyStringDescriptor } from "../../../index-BXjLmx1n-CXk17buG.js";
2
+ import "../../../htmlTypes-eT2ZGDAj.js";
3
+ import { At as Plugin } from "../../../index-DPowErHa.js";
3
4
  declare const CalloutPlugin: Plugin<Readonly<{
4
5
  formats: true;
5
6
  rules: true;
@@ -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 { ps as Range } from "../../../index-BXjLmx1n-CXk17buG.js";
2
+ import "../../../htmlTypes-eT2ZGDAj.js";
3
+ import { Co as PluginReference, Ct as PluginTransaction, qa as DefinitionOf, so as InferPluginStoreState } from "../../../core-BqR-fEDp.js";
4
+ import "../../../index-DPowErHa.js";
5
+ import { n as ComboboxState } from "../../../combobox-Dr0OYZIE.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 { Ji as Location, ps as Range, su as Value, x as BaseRange } from "../../../index-BXjLmx1n-CXk17buG.js";
2
+ import "../../../htmlTypes-eT2ZGDAj.js";
3
+ import "../../../core-BqR-fEDp.js";
4
+ import { r as AnnotationChange } from "../../../index-BWPcE4ac-Cto_IsNs.js";
5
+ import { At as Plugin, xt as InternalPluginAuthorExtension } from "../../../index-DPowErHa.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-CpY7Xnxw.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 { iu as TxDeclaredMethod, ss as PropertyStringDescriptor } from "../../../index-BXjLmx1n-CXk17buG.js";
2
+ import "../../../htmlTypes-eT2ZGDAj.js";
3
+ import { _t as NodeInsertOptions } from "../../../core-BqR-fEDp.js";
4
+ import { At as Plugin } from "../../../index-DPowErHa.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 { As as SchemaContentPrefixSlot, Ca as NodeKey, Ds as SchemaContentDefault, Ht as EditorJsonValue, Ia as NodeSelection, Ji as Location, Ls as SchemaContentRule, iu as TxDeclaredMethod, ts as PropertyJsonDescriptor } from "../../../index-BXjLmx1n-CXk17buG.js";
2
+ import "../../../htmlTypes-eT2ZGDAj.js";
3
+ import { Co as PluginReference, Qn as HeadingLevel, _ as BasePlugin, ct as BlockInsertOptions, lt as BlockUpsertOptions, xo as PluginDependency } from "../../../core-BqR-fEDp.js";
4
+ import { At as Plugin } from "../../../index-DPowErHa.js";
4
5
  declare const DetailsSummaryPlugin: Plugin<Readonly<{
5
6
  formats: true;
6
7
  }> & Readonly<{
@@ -0,0 +1,35 @@
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.applies === b.applies && a.problems.length === b.problems.length && a.problems.every((problem, index) => problem === b.problems[index]);
10
+ /**
11
+ * Read the field with this id, its problems and whether it applies. A commit
12
+ * that changes an element rereads it, and the caller renders again only when
13
+ * the field, its problems or whether it applies changed, such as when the
14
+ * field its condition names is deleted or answered.
15
+ */
16
+ const useFieldRead = (fieldId) => {
17
+ const $ = c(3);
18
+ let t0;
19
+ if ($[0] !== fieldId) {
20
+ t0 = (editor) => editor.plugin(BaseFieldPlugin).read.field(fieldId);
21
+ $[0] = fieldId;
22
+ $[1] = t0;
23
+ } else t0 = $[1];
24
+ let t1;
25
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
26
+ t1 = {
27
+ equalityFn: sameRead,
28
+ shouldUpdate: elementsChanged
29
+ };
30
+ $[2] = t1;
31
+ } else t1 = $[2];
32
+ return useEditorSelector(t0, t1);
33
+ };
34
+ //#endregion
35
+ export { FieldPlugin, useFieldRead };
@@ -0,0 +1,315 @@
1
+ import { Qo as PropertyBooleanDescriptor, es as PropertyEnumDescriptor, fs as PropertyValueOptions, iu as TxDeclaredMethod, qs as SchemaElementPropertyDefinition, ss as PropertyStringDescriptor, ts as PropertyJsonDescriptor } from "../../../index-BXjLmx1n-CXk17buG.js";
2
+ import "../../../htmlTypes-eT2ZGDAj.js";
3
+ import { _t as NodeInsertOptions } from "../../../core-BqR-fEDp.js";
4
+ import { At as Plugin } from "../../../index-DPowErHa.js";
5
+ import { b as isFieldValue, d as FieldRead, f as FieldSettings, h as FieldValue, l as FieldPatch, m as FieldTest, o as FieldElement, p as FieldSubmission, u as FieldProblem, v as isFieldCondition, y as isFieldOptions } from "../../../index-C9Fu-P4E.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: typeof isFieldCondition;
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: typeof isFieldValue;
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: typeof isFieldOptions;
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: typeof isFieldValue;
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: typeof isFieldValue;
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: typeof isFieldOptions;
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: typeof isFieldValue;
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: typeof isFieldCondition;
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
+ readonly submission: (role: string) => FieldSubmission;
297
+ };
298
+ readonly update: {
299
+ readonly insert: TxDeclaredMethod<(settings: FieldSettings, options?: NodeInsertOptions) => string>;
300
+ readonly update: TxDeclaredMethod<(fieldId: string, patch: FieldPatch) => void>;
301
+ };
302
+ }>>;
303
+ /**
304
+ * Read the field with this id, its problems and whether it applies. A commit
305
+ * that changes an element rereads it, and the caller renders again only when
306
+ * the field, its problems or whether it applies changed, such as when the
307
+ * field its condition names is deleted or answered.
308
+ */
309
+ declare const useFieldRead: (fieldId: string) => Readonly<{
310
+ applies: boolean | null;
311
+ fieldId: string;
312
+ node: FieldElement;
313
+ problems: readonly FieldProblem[];
314
+ }> | null;
315
+ export { FieldPlugin, useFieldRead };
@@ -0,0 +1,2 @@
1
+ import { FieldPlugin, useFieldRead } from "./FieldPlugin.js";
2
+ export { FieldPlugin, useFieldRead };