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
@@ -0,0 +1,773 @@
1
+ import { $a as Path, Qo as PropertyBooleanDescriptor, Tt as EditorDocumentValue, es as PropertyEnumDescriptor, fs as PropertyValueOptions, iu as TxDeclaredMethod, ji as ElementOf, qs as SchemaElementPropertyDefinition, ss as PropertyStringDescriptor, su as Value, ts as PropertyJsonDescriptor } from "./index-BXjLmx1n-CXk17buG.js";
2
+ import "./htmlTypes-eT2ZGDAj.js";
3
+ import { _ as BasePlugin, _t as NodeInsertOptions } from "./core-BqR-fEDp.js";
4
+ import { nanoid } from "nanoid";
5
+ type FieldShape = Pick<FieldSettings, 'defaultValue' | 'kind' | 'options' | 'value'>;
6
+ declare const FIELD_KINDS: readonly ['checkbox', 'choice', 'date', 'number', 'signature', 'text'];
7
+ /**
8
+ * The tests a condition may use on a field of each kind. `insert` and `update`
9
+ * refuse any other test, and a read reports it as `unsupported-test`.
10
+ */
11
+ declare const FIELD_TESTS: Readonly<Record<FieldKind, readonly FieldTest[]>>;
12
+ declare const isFieldValue: (value: unknown) => value is FieldValue;
13
+ declare const isFieldOptions: (value: unknown) => value is readonly FieldOption[];
14
+ declare const isFieldCondition: (value: unknown) => value is FieldCondition;
15
+ /**
16
+ * Whether a value fits a field's kind: a boolean for a checkbox, one of its
17
+ * options' values for a choice, an ISO date string for a date, a finite number
18
+ * other than -0 for a number, a string with no line break for a text field,
19
+ * and a string for a signature field.
20
+ */
21
+ declare const fitsField: ({ kind, options }: FieldShape, value: unknown) => value is FieldValue;
22
+ /** What a field collects, which fixes the shape of its value. */
23
+ type FieldKind = (typeof FIELD_KINDS)[number];
24
+ /** A value a field stores: a string, a finite number or a boolean. */
25
+ type FieldValue = boolean | number | string;
26
+ /** One answer a `choice` field offers. A choice stores the `value`. */
27
+ type FieldOption = Readonly<{
28
+ label: string;
29
+ value: string;
30
+ }>;
31
+ /** How a condition judges the value of the field it names. */
32
+ type FieldTest = 'above' | 'below' | 'blank' | 'equals' | 'filled' | 'not-equals';
33
+ /**
34
+ * When a field applies: the field whose `fieldId` is `ref` passes `test`.
35
+ * Every test but `filled` and `blank` compares against `value`.
36
+ */
37
+ type FieldCondition = Readonly<{
38
+ ref: string;
39
+ test: FieldTest;
40
+ value?: FieldValue;
41
+ }>;
42
+ /**
43
+ * What a read finds wrong with a field. `missing-target`: no field holds the
44
+ * id its condition names. `unsupported-test`: the target's kind does not take
45
+ * the condition's test. `invalid-value`: its value, default or options do not
46
+ * fit its kind, or its condition's value does not fit its test or the
47
+ * target's kind. `condition-loop`: its condition names a field whose chain of
48
+ * conditions leads back to it.
49
+ */
50
+ type FieldProblem = 'condition-loop' | 'invalid-value' | 'missing-target' | 'unsupported-test';
51
+ declare const fieldSchemaPlugin: BasePlugin<Readonly<{
52
+ formats: true;
53
+ }> & Readonly<{
54
+ name: "field";
55
+ }> & Readonly<Record<never, never>> & Readonly<{
56
+ initialState: {
57
+ readonly fillRole: string | null;
58
+ };
59
+ }> & Readonly<{
60
+ __pluginWritableProperties: Readonly<{
61
+ descriptor: PropertyJsonDescriptor<Readonly<{
62
+ ref: string;
63
+ test: FieldTest;
64
+ value?: FieldValue;
65
+ }>, {
66
+ readonly validate: typeof isFieldCondition;
67
+ readonly validationVersion: 1;
68
+ } & Readonly<{
69
+ default?: Readonly<{
70
+ ref: string;
71
+ test: FieldTest;
72
+ value?: FieldValue;
73
+ }> | undefined;
74
+ generate?: (() => Readonly<{
75
+ ref: string;
76
+ test: FieldTest;
77
+ value?: FieldValue;
78
+ }>) | undefined;
79
+ omitDefault?: boolean;
80
+ required?: boolean;
81
+ }> & Readonly<{
82
+ validate: (value: unknown) => value is Readonly<{
83
+ ref: string;
84
+ test: FieldTest;
85
+ value?: FieldValue;
86
+ }>;
87
+ validationVersion: number;
88
+ }>>;
89
+ key: "condition";
90
+ localId: "condition";
91
+ ownerName: "field";
92
+ placement: "element";
93
+ unaliased: true;
94
+ value: Readonly<{
95
+ ref: string;
96
+ test: FieldTest;
97
+ value?: FieldValue;
98
+ }>;
99
+ }> | Readonly<{
100
+ descriptor: PropertyJsonDescriptor<FieldValue, {
101
+ readonly validate: typeof isFieldValue;
102
+ readonly validationVersion: 1;
103
+ } & Readonly<{
104
+ default?: FieldValue | undefined;
105
+ generate?: (() => FieldValue) | undefined;
106
+ omitDefault?: boolean;
107
+ required?: boolean;
108
+ }> & Readonly<{
109
+ validate: (value: unknown) => value is FieldValue;
110
+ validationVersion: number;
111
+ }>>;
112
+ key: "defaultValue";
113
+ localId: "defaultValue";
114
+ ownerName: "field";
115
+ placement: "element";
116
+ unaliased: true;
117
+ value: string | number | boolean;
118
+ }> | Readonly<{
119
+ descriptor: PropertyStringDescriptor<{
120
+ readonly generate: typeof nanoid;
121
+ }>;
122
+ key: "fieldId";
123
+ localId: "fieldId";
124
+ ownerName: "field";
125
+ placement: "element";
126
+ unaliased: true;
127
+ value: string;
128
+ }> | Readonly<{
129
+ descriptor: PropertyEnumDescriptor<readonly ["checkbox", "choice", "date", "number", "signature", "text"], {
130
+ readonly required: true;
131
+ }>;
132
+ key: "kind";
133
+ localId: "kind";
134
+ ownerName: "field";
135
+ placement: "element";
136
+ unaliased: true;
137
+ value: "checkbox" | "choice" | "date" | "number" | "signature" | "text";
138
+ }> | Readonly<{
139
+ descriptor: PropertyStringDescriptor<{
140
+ readonly required: true;
141
+ }>;
142
+ key: "label";
143
+ localId: "label";
144
+ ownerName: "field";
145
+ placement: "element";
146
+ unaliased: true;
147
+ value: string;
148
+ }> | Readonly<{
149
+ descriptor: PropertyJsonDescriptor<readonly Readonly<{
150
+ label: string;
151
+ value: string;
152
+ }>[], {
153
+ readonly validate: typeof isFieldOptions;
154
+ readonly validationVersion: 1;
155
+ } & Readonly<{
156
+ default?: readonly Readonly<{
157
+ label: string;
158
+ value: string;
159
+ }>[] | undefined;
160
+ generate?: (() => readonly Readonly<{
161
+ label: string;
162
+ value: string;
163
+ }>[]) | undefined;
164
+ omitDefault?: boolean;
165
+ required?: boolean;
166
+ }> & Readonly<{
167
+ validate: (value: unknown) => value is readonly Readonly<{
168
+ label: string;
169
+ value: string;
170
+ }>[];
171
+ validationVersion: number;
172
+ }>>;
173
+ key: "options";
174
+ localId: "options";
175
+ ownerName: "field";
176
+ placement: "element";
177
+ unaliased: true;
178
+ value: readonly Readonly<{
179
+ label: string;
180
+ value: string;
181
+ }>[];
182
+ }> | Readonly<{
183
+ descriptor: PropertyBooleanDescriptor<PropertyValueOptions<boolean>>;
184
+ key: "required";
185
+ localId: "required";
186
+ ownerName: "field";
187
+ placement: "element";
188
+ unaliased: true;
189
+ value: boolean;
190
+ }> | Readonly<{
191
+ descriptor: PropertyStringDescriptor<{
192
+ readonly required: true;
193
+ }>;
194
+ key: "role";
195
+ localId: "role";
196
+ ownerName: "field";
197
+ placement: "element";
198
+ unaliased: true;
199
+ value: string;
200
+ }> | Readonly<{
201
+ descriptor: PropertyJsonDescriptor<FieldValue, {
202
+ readonly validate: typeof isFieldValue;
203
+ readonly validationVersion: 1;
204
+ } & Readonly<{
205
+ default?: FieldValue | undefined;
206
+ generate?: (() => FieldValue) | undefined;
207
+ omitDefault?: boolean;
208
+ required?: boolean;
209
+ }> & Readonly<{
210
+ validate: (value: unknown) => value is FieldValue;
211
+ validationVersion: number;
212
+ }>>;
213
+ key: "value";
214
+ localId: "value";
215
+ ownerName: "field";
216
+ placement: "element";
217
+ unaliased: true;
218
+ value: string | number | boolean;
219
+ }>;
220
+ schema: {
221
+ readonly element: {
222
+ readonly properties: {
223
+ defaultValue: PropertyJsonDescriptor<FieldValue, {
224
+ readonly validate: typeof isFieldValue;
225
+ readonly validationVersion: 1;
226
+ } & Readonly<{
227
+ default?: FieldValue | undefined;
228
+ generate?: (() => FieldValue) | undefined;
229
+ omitDefault?: boolean;
230
+ required?: boolean;
231
+ }> & Readonly<{
232
+ validate: (value: unknown) => value is FieldValue;
233
+ validationVersion: number;
234
+ }>>;
235
+ kind: PropertyEnumDescriptor<readonly ["checkbox", "choice", "date", "number", "signature", "text"], {
236
+ readonly required: true;
237
+ }>;
238
+ label: PropertyStringDescriptor<{
239
+ readonly required: true;
240
+ }>;
241
+ options: PropertyJsonDescriptor<readonly Readonly<{
242
+ label: string;
243
+ value: string;
244
+ }>[], {
245
+ readonly validate: typeof isFieldOptions;
246
+ readonly validationVersion: 1;
247
+ } & Readonly<{
248
+ default?: readonly Readonly<{
249
+ label: string;
250
+ value: string;
251
+ }>[] | undefined;
252
+ generate?: (() => readonly Readonly<{
253
+ label: string;
254
+ value: string;
255
+ }>[]) | undefined;
256
+ omitDefault?: boolean;
257
+ required?: boolean;
258
+ }> & Readonly<{
259
+ validate: (value: unknown) => value is readonly Readonly<{
260
+ label: string;
261
+ value: string;
262
+ }>[];
263
+ validationVersion: number;
264
+ }>>;
265
+ required: PropertyBooleanDescriptor<PropertyValueOptions<boolean>>;
266
+ role: PropertyStringDescriptor<{
267
+ readonly required: true;
268
+ }>;
269
+ value: PropertyJsonDescriptor<FieldValue, {
270
+ readonly validate: typeof isFieldValue;
271
+ readonly validationVersion: 1;
272
+ } & Readonly<{
273
+ default?: FieldValue | undefined;
274
+ generate?: (() => FieldValue) | undefined;
275
+ omitDefault?: boolean;
276
+ required?: boolean;
277
+ }> & Readonly<{
278
+ validate: (value: unknown) => value is FieldValue;
279
+ validationVersion: number;
280
+ }>>;
281
+ };
282
+ readonly void: "inline";
283
+ };
284
+ readonly properties: {
285
+ condition: SchemaElementPropertyDefinition<PropertyJsonDescriptor<Readonly<{
286
+ ref: string;
287
+ test: FieldTest;
288
+ value?: FieldValue;
289
+ }>, {
290
+ readonly validate: typeof isFieldCondition;
291
+ readonly validationVersion: 1;
292
+ } & Readonly<{
293
+ default?: Readonly<{
294
+ ref: string;
295
+ test: FieldTest;
296
+ value?: FieldValue;
297
+ }> | undefined;
298
+ generate?: (() => Readonly<{
299
+ ref: string;
300
+ test: FieldTest;
301
+ value?: FieldValue;
302
+ }>) | undefined;
303
+ omitDefault?: boolean;
304
+ required?: boolean;
305
+ }> & Readonly<{
306
+ validate: (value: unknown) => value is Readonly<{
307
+ ref: string;
308
+ test: FieldTest;
309
+ value?: FieldValue;
310
+ }>;
311
+ validationVersion: number;
312
+ }>>, Readonly<{
313
+ kind: 'types';
314
+ types: readonly ["field"];
315
+ }>, Readonly<{
316
+ key: string;
317
+ map: (value: Readonly<{
318
+ ref: string;
319
+ test: FieldTest;
320
+ value?: FieldValue;
321
+ }>, renamed: (name: string) => string | undefined) => Readonly<{
322
+ ref: string;
323
+ test: FieldTest;
324
+ value?: FieldValue;
325
+ }>;
326
+ }>>;
327
+ fieldId: SchemaElementPropertyDefinition<PropertyStringDescriptor<{
328
+ readonly generate: typeof nanoid;
329
+ }>, Readonly<{
330
+ kind: 'types';
331
+ types: readonly ["field"];
332
+ }>, Readonly<{
333
+ key: string;
334
+ map: (value: string, renamed: (name: string) => string | undefined) => string;
335
+ }>>;
336
+ };
337
+ };
338
+ }>>;
339
+ /** A field: an inline void that collects one value of its `kind`. */
340
+ type FieldElement = ElementOf<typeof fieldSchemaPlugin>;
341
+ /** What `insert` takes: a field's kind, role and label, with its settings. */
342
+ type FieldSettings = Omit<FieldElement, 'children' | 'fieldId' | 'type'>;
343
+ /**
344
+ * What `update` changes. An optional setting given as `undefined` is removed.
345
+ */
346
+ type FieldPatch = Partial<FieldSettings>;
347
+ /**
348
+ * A field as the plugin reads it, with what the read finds wrong with it.
349
+ * `applies` says whether the field applies under its condition, as the field's
350
+ * own role sees the answers the document holds. It is `null` while that
351
+ * depends on an answer another role has not given yet, and `true` for a field
352
+ * with no condition or with a condition that has a problem or is in a loop. A
353
+ * condition whose target does not apply tests it as having no answer, an
354
+ * answer that does not fit its field's kind counts as none, and an unanswered
355
+ * checkbox of the field's own role reads as `false` while it applies.
356
+ */
357
+ type FieldRead = Readonly<{
358
+ applies: boolean | null;
359
+ fieldId: string;
360
+ node: FieldElement;
361
+ problems: readonly FieldProblem[];
362
+ }>;
363
+ /** One role's field values, keyed by `fieldId`. */
364
+ type FieldSubmission = Readonly<{
365
+ role: string;
366
+ values: Readonly<Record<string, FieldValue>>;
367
+ }>;
368
+ /**
369
+ * Fields: inline voids that each collect one value of a kind and hold a
370
+ * document-wide unique `fieldId`. A field's `condition` names another field
371
+ * by that id, so a paste that copies both names the copy.
372
+ */
373
+ declare const BaseFieldPlugin: BasePlugin<Readonly<{
374
+ readonly __pluginWritableProperties: Readonly<{
375
+ descriptor: PropertyJsonDescriptor<Readonly<{
376
+ ref: string;
377
+ test: FieldTest;
378
+ value?: FieldValue;
379
+ }>, {
380
+ readonly validate: typeof isFieldCondition;
381
+ readonly validationVersion: 1;
382
+ } & Readonly<{
383
+ default?: Readonly<{
384
+ ref: string;
385
+ test: FieldTest;
386
+ value?: FieldValue;
387
+ }> | undefined;
388
+ generate?: (() => Readonly<{
389
+ ref: string;
390
+ test: FieldTest;
391
+ value?: FieldValue;
392
+ }>) | undefined;
393
+ omitDefault?: boolean;
394
+ required?: boolean;
395
+ }> & Readonly<{
396
+ validate: (value: unknown) => value is Readonly<{
397
+ ref: string;
398
+ test: FieldTest;
399
+ value?: FieldValue;
400
+ }>;
401
+ validationVersion: number;
402
+ }>>;
403
+ key: "condition";
404
+ localId: "condition";
405
+ ownerName: "field";
406
+ placement: "element";
407
+ unaliased: true;
408
+ value: Readonly<{
409
+ ref: string;
410
+ test: FieldTest;
411
+ value?: FieldValue;
412
+ }>;
413
+ }> | Readonly<{
414
+ descriptor: PropertyJsonDescriptor<FieldValue, {
415
+ readonly validate: typeof isFieldValue;
416
+ readonly validationVersion: 1;
417
+ } & Readonly<{
418
+ default?: FieldValue | undefined;
419
+ generate?: (() => FieldValue) | undefined;
420
+ omitDefault?: boolean;
421
+ required?: boolean;
422
+ }> & Readonly<{
423
+ validate: (value: unknown) => value is FieldValue;
424
+ validationVersion: number;
425
+ }>>;
426
+ key: "defaultValue";
427
+ localId: "defaultValue";
428
+ ownerName: "field";
429
+ placement: "element";
430
+ unaliased: true;
431
+ value: string | number | boolean;
432
+ }> | Readonly<{
433
+ descriptor: PropertyStringDescriptor<{
434
+ readonly generate: typeof nanoid;
435
+ }>;
436
+ key: "fieldId";
437
+ localId: "fieldId";
438
+ ownerName: "field";
439
+ placement: "element";
440
+ unaliased: true;
441
+ value: string;
442
+ }> | Readonly<{
443
+ descriptor: PropertyEnumDescriptor<readonly ["checkbox", "choice", "date", "number", "signature", "text"], {
444
+ readonly required: true;
445
+ }>;
446
+ key: "kind";
447
+ localId: "kind";
448
+ ownerName: "field";
449
+ placement: "element";
450
+ unaliased: true;
451
+ value: "checkbox" | "choice" | "date" | "number" | "signature" | "text";
452
+ }> | Readonly<{
453
+ descriptor: PropertyStringDescriptor<{
454
+ readonly required: true;
455
+ }>;
456
+ key: "label";
457
+ localId: "label";
458
+ ownerName: "field";
459
+ placement: "element";
460
+ unaliased: true;
461
+ value: string;
462
+ }> | Readonly<{
463
+ descriptor: PropertyJsonDescriptor<readonly Readonly<{
464
+ label: string;
465
+ value: string;
466
+ }>[], {
467
+ readonly validate: typeof isFieldOptions;
468
+ readonly validationVersion: 1;
469
+ } & Readonly<{
470
+ default?: readonly Readonly<{
471
+ label: string;
472
+ value: string;
473
+ }>[] | undefined;
474
+ generate?: (() => readonly Readonly<{
475
+ label: string;
476
+ value: string;
477
+ }>[]) | undefined;
478
+ omitDefault?: boolean;
479
+ required?: boolean;
480
+ }> & Readonly<{
481
+ validate: (value: unknown) => value is readonly Readonly<{
482
+ label: string;
483
+ value: string;
484
+ }>[];
485
+ validationVersion: number;
486
+ }>>;
487
+ key: "options";
488
+ localId: "options";
489
+ ownerName: "field";
490
+ placement: "element";
491
+ unaliased: true;
492
+ value: readonly Readonly<{
493
+ label: string;
494
+ value: string;
495
+ }>[];
496
+ }> | Readonly<{
497
+ descriptor: PropertyBooleanDescriptor<PropertyValueOptions<boolean>>;
498
+ key: "required";
499
+ localId: "required";
500
+ ownerName: "field";
501
+ placement: "element";
502
+ unaliased: true;
503
+ value: boolean;
504
+ }> | Readonly<{
505
+ descriptor: PropertyStringDescriptor<{
506
+ readonly required: true;
507
+ }>;
508
+ key: "role";
509
+ localId: "role";
510
+ ownerName: "field";
511
+ placement: "element";
512
+ unaliased: true;
513
+ value: string;
514
+ }> | Readonly<{
515
+ descriptor: PropertyJsonDescriptor<FieldValue, {
516
+ readonly validate: typeof isFieldValue;
517
+ readonly validationVersion: 1;
518
+ } & Readonly<{
519
+ default?: FieldValue | undefined;
520
+ generate?: (() => FieldValue) | undefined;
521
+ omitDefault?: boolean;
522
+ required?: boolean;
523
+ }> & Readonly<{
524
+ validate: (value: unknown) => value is FieldValue;
525
+ validationVersion: number;
526
+ }>>;
527
+ key: "value";
528
+ localId: "value";
529
+ ownerName: "field";
530
+ placement: "element";
531
+ unaliased: true;
532
+ value: string | number | boolean;
533
+ }>;
534
+ readonly schema: {
535
+ readonly element: {
536
+ readonly properties: {
537
+ defaultValue: PropertyJsonDescriptor<FieldValue, {
538
+ readonly validate: typeof isFieldValue;
539
+ readonly validationVersion: 1;
540
+ } & Readonly<{
541
+ default?: FieldValue | undefined;
542
+ generate?: (() => FieldValue) | undefined;
543
+ omitDefault?: boolean;
544
+ required?: boolean;
545
+ }> & Readonly<{
546
+ validate: (value: unknown) => value is FieldValue;
547
+ validationVersion: number;
548
+ }>>;
549
+ kind: PropertyEnumDescriptor<readonly ["checkbox", "choice", "date", "number", "signature", "text"], {
550
+ readonly required: true;
551
+ }>;
552
+ label: PropertyStringDescriptor<{
553
+ readonly required: true;
554
+ }>;
555
+ options: PropertyJsonDescriptor<readonly Readonly<{
556
+ label: string;
557
+ value: string;
558
+ }>[], {
559
+ readonly validate: typeof isFieldOptions;
560
+ readonly validationVersion: 1;
561
+ } & Readonly<{
562
+ default?: readonly Readonly<{
563
+ label: string;
564
+ value: string;
565
+ }>[] | undefined;
566
+ generate?: (() => readonly Readonly<{
567
+ label: string;
568
+ value: string;
569
+ }>[]) | undefined;
570
+ omitDefault?: boolean;
571
+ required?: boolean;
572
+ }> & Readonly<{
573
+ validate: (value: unknown) => value is readonly Readonly<{
574
+ label: string;
575
+ value: string;
576
+ }>[];
577
+ validationVersion: number;
578
+ }>>;
579
+ required: PropertyBooleanDescriptor<PropertyValueOptions<boolean>>;
580
+ role: PropertyStringDescriptor<{
581
+ readonly required: true;
582
+ }>;
583
+ value: PropertyJsonDescriptor<FieldValue, {
584
+ readonly validate: typeof isFieldValue;
585
+ readonly validationVersion: 1;
586
+ } & Readonly<{
587
+ default?: FieldValue | undefined;
588
+ generate?: (() => FieldValue) | undefined;
589
+ omitDefault?: boolean;
590
+ required?: boolean;
591
+ }> & Readonly<{
592
+ validate: (value: unknown) => value is FieldValue;
593
+ validationVersion: number;
594
+ }>>;
595
+ };
596
+ readonly void: "inline";
597
+ };
598
+ readonly properties: {
599
+ condition: SchemaElementPropertyDefinition<PropertyJsonDescriptor<Readonly<{
600
+ ref: string;
601
+ test: FieldTest;
602
+ value?: FieldValue;
603
+ }>, {
604
+ readonly validate: typeof isFieldCondition;
605
+ readonly validationVersion: 1;
606
+ } & Readonly<{
607
+ default?: Readonly<{
608
+ ref: string;
609
+ test: FieldTest;
610
+ value?: FieldValue;
611
+ }> | undefined;
612
+ generate?: (() => Readonly<{
613
+ ref: string;
614
+ test: FieldTest;
615
+ value?: FieldValue;
616
+ }>) | undefined;
617
+ omitDefault?: boolean;
618
+ required?: boolean;
619
+ }> & Readonly<{
620
+ validate: (value: unknown) => value is Readonly<{
621
+ ref: string;
622
+ test: FieldTest;
623
+ value?: FieldValue;
624
+ }>;
625
+ validationVersion: number;
626
+ }>>, Readonly<{
627
+ kind: 'types';
628
+ types: readonly ["field"];
629
+ }>, Readonly<{
630
+ key: string;
631
+ map: (value: Readonly<{
632
+ ref: string;
633
+ test: FieldTest;
634
+ value?: FieldValue;
635
+ }>, renamed: (name: string) => string | undefined) => Readonly<{
636
+ ref: string;
637
+ test: FieldTest;
638
+ value?: FieldValue;
639
+ }>;
640
+ }>>;
641
+ fieldId: SchemaElementPropertyDefinition<PropertyStringDescriptor<{
642
+ readonly generate: typeof nanoid;
643
+ }>, Readonly<{
644
+ kind: 'types';
645
+ types: readonly ["field"];
646
+ }>, Readonly<{
647
+ key: string;
648
+ map: (value: string, renamed: (name: string) => string | undefined) => string;
649
+ }>>;
650
+ };
651
+ };
652
+ readonly name: "field";
653
+ readonly activate: true;
654
+ readonly corrections: true;
655
+ readonly formats: true;
656
+ readonly initialState: {
657
+ readonly fillRole: string | null;
658
+ };
659
+ readonly read: {
660
+ /**
661
+ * The field whose `fieldId` is `fieldId`, in any root, or null when
662
+ * no field holds it. Looks up the field, then one field for each
663
+ * condition it follows along the chain.
664
+ */
665
+ readonly field: (fieldId: string) => FieldRead | null;
666
+ /** Every field of the document, in reading order. */
667
+ readonly fields: () => FieldRead[];
668
+ /**
669
+ * The `value` of each field of `role` that holds one, keyed by
670
+ * `fieldId` and read from the field that id names, to pass to
671
+ * `applyFieldValues`.
672
+ */
673
+ readonly submission: (role: string) => FieldSubmission;
674
+ };
675
+ readonly update: {
676
+ /**
677
+ * Insert a field and return its new `fieldId`. Throws when a value,
678
+ * default or options do not fit `kind`, or the condition names no
679
+ * field, or a test or value the named field's kind does not take,
680
+ * or the settings name a `fieldId`.
681
+ */
682
+ readonly insert: TxDeclaredMethod<(settings: FieldSettings, options?: NodeInsertOptions) => string>;
683
+ /**
684
+ * Change the settings or value of the field whose `fieldId` is
685
+ * `fieldId`. A new kind or new options drop each value, default or
686
+ * options the patch leaves out and the field no longer fits. Throws,
687
+ * and changes nothing, when no field holds `fieldId`, a setting the
688
+ * patch names does not fit the field's kind, the patch removes `kind`,
689
+ * `role` or `label` or names `fieldId`, or its condition names no
690
+ * field, a test or value the named field's kind does not take, or a
691
+ * field it did not name before whose chain of conditions leads back
692
+ * to this one. While a fill role is set, a missing field or a
693
+ * setting that does not fit refuses the whole update instead, which
694
+ * then returns `undefined`.
695
+ */
696
+ readonly update: TxDeclaredMethod<(fieldId: string, patch: FieldPatch) => void>;
697
+ };
698
+ }>> & Readonly<Record<never, never>>;
699
+ /** Why `applyFieldValues` refused a template or a submission. */
700
+ type FieldRefusal = Readonly<{
701
+ code: 'duplicate-role';
702
+ role: string;
703
+ }> | Readonly<{
704
+ code: 'invalid-template';
705
+ fieldId?: string;
706
+ path: Path;
707
+ problem: FieldProblem | 'answered' | 'duplicate-id' | 'malformed';
708
+ root?: string;
709
+ }> | Readonly<{
710
+ code: 'invalid-submission';
711
+ index: number;
712
+ }> | Readonly<{
713
+ code: 'invalid-value';
714
+ fieldId: string;
715
+ role: string;
716
+ }> | Readonly<{
717
+ code: 'missing-required';
718
+ fieldId: string;
719
+ role: string;
720
+ }> | Readonly<{
721
+ code: 'skipped';
722
+ fieldId: string;
723
+ role: string;
724
+ }> | Readonly<{
725
+ code: 'unknown-field';
726
+ fieldId: string;
727
+ role: string;
728
+ }> | Readonly<{
729
+ code: 'unknown-role';
730
+ role: string;
731
+ }> | Readonly<{
732
+ code: 'waiting';
733
+ fieldId: string;
734
+ role: string;
735
+ waitsOn: string;
736
+ }> | Readonly<{
737
+ code: 'wrong-role';
738
+ fieldId: string;
739
+ role: string;
740
+ }>;
741
+ /**
742
+ * The filled document, or the refusals. `pending` lists each role that has not
743
+ * submitted and holds a required field that applies or waits, and the role
744
+ * whose answer each such waiting field needs next.
745
+ */
746
+ type FieldApplyResult<D extends EditorDocumentValue | Value> = Readonly<{
747
+ document: D;
748
+ ok: true;
749
+ pending: readonly string[];
750
+ }> | Readonly<{
751
+ ok: false;
752
+ refusals: readonly [FieldRefusal, ...FieldRefusal[]];
753
+ }>;
754
+ /**
755
+ * Check each role's answers against a frozen template and build the filled
756
+ * document from the answers alone. `type` names the field element's type when
757
+ * the app renamed it with `schema.override`. `submissions` are in the order
758
+ * the roles submitted, and each is checked against the roles before it plus
759
+ * its own answers. A submitted role's checkbox with no answer reads as `false`
760
+ * while it applies.
761
+ *
762
+ * Refuses a template whose fields hold an answer, lack or repeat a `fieldId`,
763
+ * break the schema or have a problem a read reports, a condition loop
764
+ * included. Then refuses, at the first submission that has any: a malformed
765
+ * submission, a role that submitted before or owns no field, an answer for a
766
+ * field that is missing, of another role or does not fit it, a field of the
767
+ * role that waits on another role, a filled answer on a skipped field, and a
768
+ * required field that applies without a filled answer.
769
+ */
770
+ declare function applyFieldValues<D extends EditorDocumentValue | Value>(template: D, submissions: readonly FieldSubmission[], options?: Readonly<{
771
+ type?: string;
772
+ }>): FieldApplyResult<D extends Value ? Value : EditorDocumentValue>;
773
+ export { fitsField as _, FieldCondition as a, isFieldValue as b, FieldOption as c, FieldRead as d, FieldSettings as f, FIELD_TESTS as g, FieldValue as h, BaseFieldPlugin as i, FieldPatch as l, FieldTest as m, FieldRefusal as n, FieldElement as o, FieldSubmission as p, applyFieldValues as r, FieldKind as s, FieldApplyResult as t, FieldProblem as u, isFieldCondition as v, isFieldOptions as y };