@dou-ui/form-builder 0.0.0-stage → 0.1.0-alpha.0

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 (182) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -2
  3. package/dist/builder/canvas.js +695 -0
  4. package/dist/builder/canvas.js.map +1 -0
  5. package/dist/builder/completion.js +49 -0
  6. package/dist/builder/completion.js.map +1 -0
  7. package/dist/builder/condition-editor.js +6 -0
  8. package/dist/builder/condition-editor.js.map +1 -0
  9. package/dist/builder/condition-editor.vue_vue_type_script_setup_true_lang.js +410 -0
  10. package/dist/builder/condition-editor.vue_vue_type_script_setup_true_lang.js.map +1 -0
  11. package/dist/builder/condition.js +159 -0
  12. package/dist/builder/condition.js.map +1 -0
  13. package/dist/builder/context.js +477 -0
  14. package/dist/builder/context.js.map +1 -0
  15. package/dist/builder/core/commands.js +373 -0
  16. package/dist/builder/core/commands.js.map +1 -0
  17. package/dist/builder/core/history.js +76 -0
  18. package/dist/builder/core/history.js.map +1 -0
  19. package/dist/builder/core/transaction.js +298 -0
  20. package/dist/builder/core/transaction.js.map +1 -0
  21. package/dist/builder/drag.js +466 -0
  22. package/dist/builder/drag.js.map +1 -0
  23. package/dist/builder/expression-box.js +19 -0
  24. package/dist/builder/expression-box.js.map +1 -0
  25. package/dist/builder/expression-input.js +6 -0
  26. package/dist/builder/expression-input.js.map +1 -0
  27. package/dist/builder/expression-input.vue_vue_type_script_setup_true_lang.js +117 -0
  28. package/dist/builder/expression-input.vue_vue_type_script_setup_true_lang.js.map +1 -0
  29. package/dist/builder/extension.js +47 -0
  30. package/dist/builder/extension.js.map +1 -0
  31. package/dist/builder/form-builder.js +6 -0
  32. package/dist/builder/form-builder.js.map +1 -0
  33. package/dist/builder/form-builder.vue_vue_type_script_setup_true_lang.js +450 -0
  34. package/dist/builder/form-builder.vue_vue_type_script_setup_true_lang.js.map +1 -0
  35. package/dist/builder/index.js +22 -0
  36. package/dist/builder/index.js.map +1 -0
  37. package/dist/builder/inspector.js +6 -0
  38. package/dist/builder/inspector.js.map +1 -0
  39. package/dist/builder/inspector.vue_vue_type_script_setup_true_lang.js +442 -0
  40. package/dist/builder/inspector.vue_vue_type_script_setup_true_lang.js.map +1 -0
  41. package/dist/builder/json-dialog.js +6 -0
  42. package/dist/builder/json-dialog.js.map +1 -0
  43. package/dist/builder/json-dialog.vue_vue_type_script_setup_true_lang.js +281 -0
  44. package/dist/builder/json-dialog.vue_vue_type_script_setup_true_lang.js.map +1 -0
  45. package/dist/builder/locale.js +1271 -0
  46. package/dist/builder/locale.js.map +1 -0
  47. package/dist/builder/logic-fields.js +18 -0
  48. package/dist/builder/logic-fields.js.map +1 -0
  49. package/dist/builder/logic.js +332 -0
  50. package/dist/builder/logic.js.map +1 -0
  51. package/dist/builder/menu.js +92 -0
  52. package/dist/builder/menu.js.map +1 -0
  53. package/dist/builder/outline-row.js +6 -0
  54. package/dist/builder/outline-row.js.map +1 -0
  55. package/dist/builder/outline-row.vue_vue_type_script_setup_true_lang.js +88 -0
  56. package/dist/builder/outline-row.vue_vue_type_script_setup_true_lang.js.map +1 -0
  57. package/dist/builder/outline.js +6 -0
  58. package/dist/builder/outline.js.map +1 -0
  59. package/dist/builder/outline.vue_vue_type_script_setup_true_lang.js +111 -0
  60. package/dist/builder/outline.vue_vue_type_script_setup_true_lang.js.map +1 -0
  61. package/dist/builder/palette.js +6 -0
  62. package/dist/builder/palette.js.map +1 -0
  63. package/dist/builder/palette.vue_vue_type_script_setup_true_lang.js +96 -0
  64. package/dist/builder/palette.vue_vue_type_script_setup_true_lang.js.map +1 -0
  65. package/dist/builder/preview.js +6 -0
  66. package/dist/builder/preview.js.map +1 -0
  67. package/dist/builder/preview.vue_vue_type_script_setup_true_lang.js +111 -0
  68. package/dist/builder/preview.vue_vue_type_script_setup_true_lang.js.map +1 -0
  69. package/dist/builder/settings-binding.js +57 -0
  70. package/dist/builder/settings-binding.js.map +1 -0
  71. package/dist/builder/settings.js +487 -0
  72. package/dist/builder/settings.js.map +1 -0
  73. package/dist/builder/span-field.js +104 -0
  74. package/dist/builder/span-field.js.map +1 -0
  75. package/dist/code/expression-input.js +6 -0
  76. package/dist/code/expression-input.js.map +1 -0
  77. package/dist/code/expression-input.vue_vue_type_script_setup_true_lang.js +88 -0
  78. package/dist/code/expression-input.vue_vue_type_script_setup_true_lang.js.map +1 -0
  79. package/dist/code/extension.js +202 -0
  80. package/dist/code/extension.js.map +1 -0
  81. package/dist/code/index.js +19 -0
  82. package/dist/code/index.js.map +1 -0
  83. package/dist/code/language.js +43 -0
  84. package/dist/code/language.js.map +1 -0
  85. package/dist/collaboration/index.js +382 -0
  86. package/dist/collaboration/index.js.map +1 -0
  87. package/dist/collaboration/order.js +88 -0
  88. package/dist/collaboration/order.js.map +1 -0
  89. package/dist/core/check.js +314 -0
  90. package/dist/core/check.js.map +1 -0
  91. package/dist/core/document.js +112 -0
  92. package/dist/core/document.js.map +1 -0
  93. package/dist/core/expression.js +854 -0
  94. package/dist/core/expression.js.map +1 -0
  95. package/dist/core/formulas.js +242 -0
  96. package/dist/core/formulas.js.map +1 -0
  97. package/dist/core/rules.js +83 -0
  98. package/dist/core/rules.js.map +1 -0
  99. package/dist/core/values.js +80 -0
  100. package/dist/core/values.js.map +1 -0
  101. package/dist/fields/builtin.js +167 -0
  102. package/dist/fields/builtin.js.map +1 -0
  103. package/dist/fields/components.js +155 -0
  104. package/dist/fields/components.js.map +1 -0
  105. package/dist/fields/define.js +44 -0
  106. package/dist/fields/define.js.map +1 -0
  107. package/dist/fields/format.js +125 -0
  108. package/dist/fields/format.js.map +1 -0
  109. package/dist/fields/options.js +54 -0
  110. package/dist/fields/options.js.map +1 -0
  111. package/dist/index.js +20 -0
  112. package/dist/locale.js +161 -0
  113. package/dist/locale.js.map +1 -0
  114. package/dist/renderer/containers.js +430 -0
  115. package/dist/renderer/containers.js.map +1 -0
  116. package/dist/renderer/context.js +21 -0
  117. package/dist/renderer/context.js.map +1 -0
  118. package/dist/renderer/form-renderer.js +6 -0
  119. package/dist/renderer/form-renderer.js.map +1 -0
  120. package/dist/renderer/form-renderer.vue_vue_type_script_setup_true_lang.js +272 -0
  121. package/dist/renderer/form-renderer.vue_vue_type_script_setup_true_lang.js.map +1 -0
  122. package/dist/renderer/index.js +19 -0
  123. package/dist/renderer/index.js.map +1 -0
  124. package/dist/renderer/node-view.js +385 -0
  125. package/dist/renderer/node-view.js.map +1 -0
  126. package/dist/style.css +1 -0
  127. package/dist/style.d.ts +1 -0
  128. package/dist/style.js +27 -0
  129. package/dist/types/builder/canvas.d.ts +5 -0
  130. package/dist/types/builder/completion.d.ts +35 -0
  131. package/dist/types/builder/condition-editor.vue.d.ts +17 -0
  132. package/dist/types/builder/condition.d.ts +37 -0
  133. package/dist/types/builder/context.d.ts +149 -0
  134. package/dist/types/builder/core/commands.d.ts +74 -0
  135. package/dist/types/builder/core/history.d.ts +23 -0
  136. package/dist/types/builder/core/transaction.d.ts +108 -0
  137. package/dist/types/builder/drag.d.ts +52 -0
  138. package/dist/types/builder/expression-box.d.ts +8 -0
  139. package/dist/types/builder/expression-input.vue.d.ts +29 -0
  140. package/dist/types/builder/extension.d.ts +149 -0
  141. package/dist/types/builder/form-builder.vue.d.ts +24 -0
  142. package/dist/types/builder/index.d.ts +76 -0
  143. package/dist/types/builder/inspector.vue.d.ts +3 -0
  144. package/dist/types/builder/json-dialog.vue.d.ts +10 -0
  145. package/dist/types/builder/locale.d.ts +195 -0
  146. package/dist/types/builder/logic-fields.d.ts +2 -0
  147. package/dist/types/builder/logic.d.ts +57 -0
  148. package/dist/types/builder/menu.d.ts +23 -0
  149. package/dist/types/builder/outline-row.vue.d.ts +19 -0
  150. package/dist/types/builder/outline.vue.d.ts +3 -0
  151. package/dist/types/builder/palette.vue.d.ts +3 -0
  152. package/dist/types/builder/preview.vue.d.ts +3 -0
  153. package/dist/types/builder/settings-binding.d.ts +23 -0
  154. package/dist/types/builder/settings.d.ts +49 -0
  155. package/dist/types/builder/span-field.d.ts +4 -0
  156. package/dist/types/builder/types.d.ts +59 -0
  157. package/dist/types/code/expression-input.vue.d.ts +23 -0
  158. package/dist/types/code/extension.d.ts +45 -0
  159. package/dist/types/code/index.d.ts +12 -0
  160. package/dist/types/code/language.d.ts +6 -0
  161. package/dist/types/collaboration/index.d.ts +64 -0
  162. package/dist/types/collaboration/order.d.ts +20 -0
  163. package/dist/types/core/check.d.ts +68 -0
  164. package/dist/types/core/document.d.ts +36 -0
  165. package/dist/types/core/expression.d.ts +175 -0
  166. package/dist/types/core/formulas.d.ts +44 -0
  167. package/dist/types/core/rules.d.ts +23 -0
  168. package/dist/types/core/types.d.ts +211 -0
  169. package/dist/types/core/values.d.ts +22 -0
  170. package/dist/types/fields/builtin.d.ts +9 -0
  171. package/dist/types/fields/components.d.ts +177 -0
  172. package/dist/types/fields/define.d.ts +93 -0
  173. package/dist/types/fields/format.d.ts +76 -0
  174. package/dist/types/fields/options.d.ts +11 -0
  175. package/dist/types/index.d.ts +3 -0
  176. package/dist/types/locale.d.ts +45 -0
  177. package/dist/types/renderer/containers.d.ts +20 -0
  178. package/dist/types/renderer/context.d.ts +186 -0
  179. package/dist/types/renderer/form-renderer.vue.d.ts +25 -0
  180. package/dist/types/renderer/index.d.ts +81 -0
  181. package/dist/types/renderer/node-view.d.ts +56 -0
  182. package/package.json +88 -4
@@ -0,0 +1,24 @@
1
+ import type { FormBuilderMode } from './context';
2
+ import type { FormBuilderProps, FormBuilderSlots } from './types';
3
+ type __VLS_Slots = FormBuilderSlots;
4
+ declare const __VLS_base: import("vue").DefineComponent<FormBuilderProps, import("./context").FormBuilderContext, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ change: (tr: import(".").FormBuilderTransaction) => any;
6
+ "update:modelValue": (document: import("..").FormDocument) => any;
7
+ "update:selection": (ids: string[]) => any;
8
+ "update:mode": (mode: FormBuilderMode) => any;
9
+ }, string, import("vue").PublicProps, Readonly<FormBuilderProps> & Readonly<{
10
+ onChange?: ((tr: import(".").FormBuilderTransaction) => any) | undefined;
11
+ "onUpdate:modelValue"?: ((document: import("..").FormDocument) => any) | undefined;
12
+ "onUpdate:selection"?: ((ids: string[]) => any) | undefined;
13
+ "onUpdate:mode"?: ((mode: FormBuilderMode) => any) | undefined;
14
+ }>, {
15
+ readonly: boolean;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
@@ -0,0 +1,76 @@
1
+ import FormBuilder from './form-builder.vue';
2
+ export declare const DouFormBuilder: import("dou-ui").WithInstall<{
3
+ new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./types").FormBuilderProps> & Readonly<{
4
+ onChange?: ((tr: import("./index.js").FormBuilderTransaction) => any) | undefined;
5
+ "onUpdate:modelValue"?: ((document: import("../index.js").FormDocument) => any) | undefined;
6
+ "onUpdate:selection"?: ((ids: string[]) => any) | undefined;
7
+ "onUpdate:mode"?: ((mode: import("./context").FormBuilderMode) => any) | undefined;
8
+ }>, import("./context").FormBuilderContext, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ change: (tr: import("./index.js").FormBuilderTransaction) => any;
10
+ "update:modelValue": (document: import("../index.js").FormDocument) => any;
11
+ "update:selection": (ids: string[]) => any;
12
+ "update:mode": (mode: import("./context").FormBuilderMode) => any;
13
+ }, import("vue").PublicProps, {
14
+ readonly: boolean;
15
+ }, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
16
+ P: {};
17
+ B: {};
18
+ D: {};
19
+ C: {};
20
+ M: {};
21
+ Defaults: {};
22
+ }, Readonly<import("./types").FormBuilderProps> & Readonly<{
23
+ onChange?: ((tr: import("./index.js").FormBuilderTransaction) => any) | undefined;
24
+ "onUpdate:modelValue"?: ((document: import("../index.js").FormDocument) => any) | undefined;
25
+ "onUpdate:selection"?: ((ids: string[]) => any) | undefined;
26
+ "onUpdate:mode"?: ((mode: import("./context").FormBuilderMode) => any) | undefined;
27
+ }>, import("./context").FormBuilderContext, {}, {}, {}, {
28
+ readonly: boolean;
29
+ }>;
30
+ __isFragment?: never;
31
+ __isTeleport?: never;
32
+ __isSuspense?: never;
33
+ } & import("vue").ComponentOptionsBase<Readonly<import("./types").FormBuilderProps> & Readonly<{
34
+ onChange?: ((tr: import("./index.js").FormBuilderTransaction) => any) | undefined;
35
+ "onUpdate:modelValue"?: ((document: import("../index.js").FormDocument) => any) | undefined;
36
+ "onUpdate:selection"?: ((ids: string[]) => any) | undefined;
37
+ "onUpdate:mode"?: ((mode: import("./context").FormBuilderMode) => any) | undefined;
38
+ }>, import("./context").FormBuilderContext, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
39
+ change: (tr: import("./index.js").FormBuilderTransaction) => any;
40
+ "update:modelValue": (document: import("../index.js").FormDocument) => any;
41
+ "update:selection": (ids: string[]) => any;
42
+ "update:mode": (mode: import("./context").FormBuilderMode) => any;
43
+ }, string, {
44
+ readonly: boolean;
45
+ }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
46
+ $slots: import("./types").FormBuilderSlots;
47
+ }), import("vue").HTMLAttributes>;
48
+ export declare const DouFormBuilderPalette: import("dou-ui").WithInstall<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, import("vue").HTMLAttributes>;
49
+ export declare const DouFormBuilderInspector: import("dou-ui").WithInstall<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, import("vue").HTMLAttributes>;
50
+ export declare const DouFormBuilderOutline: import("dou-ui").WithInstall<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, import("vue").HTMLAttributes>;
51
+ export declare const DouFormBuilderCanvas: import("dou-ui").WithInstall<import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
52
+ [key: string]: any;
53
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, import("vue").HTMLAttributes>;
54
+ export declare const DouFormBuilderPreview: import("dou-ui").WithInstall<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, import("vue").HTMLAttributes>;
55
+ export type { FormBuilderEmits, FormBuilderExpose, FormBuilderProps, FormBuilderSlots, } from './types';
56
+ export { useFormBuilder } from './context';
57
+ export type { FormBuilderContext, FormBuilderDispatchOptions, FormBuilderMode, FormBuilderSelectMode, } from './context';
58
+ export { defineFormBuilderExtension, resolveFormBuilderExtensions, resolveFormBuilderFields, } from './extension';
59
+ export type { FormBuilderExtension, FormBuilderExtensionContext, FormBuilderInspectorSection, FormBuilderKeyHandler, FormBuilderMenuItem, FormBuilderToolbarItem, ResolvedFormBuilderExtensions, } from './extension';
60
+ export { applyFormSteps, canContainFormNode, compactFormSteps, FormBuilderTransaction, formNodePlaces, } from './core/transaction';
61
+ export type { FormBuilderStep, FormBuilderTransactionMeta, FormDocumentPatch, FormNodePatch, FormNodePlace, } from './core/transaction';
62
+ export { FormBuilderHistory } from './core/history';
63
+ export type { FormBuilderInsertPlace } from './core/commands';
64
+ export { formBuilderLocales, useFormBuilderMessages } from './locale';
65
+ export type { FormBuilderMessages, FormBuilderMessagesOverride } from './locale';
66
+ export type FormBuilderInstance = InstanceType<typeof FormBuilder>;
67
+ declare module 'vue' {
68
+ interface GlobalComponents {
69
+ DouFormBuilder: typeof DouFormBuilder;
70
+ DouFormBuilderPalette: typeof DouFormBuilderPalette;
71
+ DouFormBuilderInspector: typeof DouFormBuilderInspector;
72
+ DouFormBuilderOutline: typeof DouFormBuilderOutline;
73
+ DouFormBuilderCanvas: typeof DouFormBuilderCanvas;
74
+ DouFormBuilderPreview: typeof DouFormBuilderPreview;
75
+ }
76
+ }
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,10 @@
1
+ type __VLS_ModelProps = {
2
+ 'open'?: boolean;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ "update:open": (value: boolean) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
7
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,195 @@
1
+ import type { MaybeRefOrGetter } from 'vue';
2
+ /** The texts of the builder: its panels, actions, announcements and the settings of the built-in types. */
3
+ export interface FormBuilderMessages {
4
+ /** Names of the built-in field types and of the containers, by type. */
5
+ types: Record<string, string>;
6
+ /** Names of the palette's groups, by the `group` of a field type. */
7
+ groups: Record<string, string>;
8
+ palette: {
9
+ /** The palette's search box, read out and shown when empty. */
10
+ search: string;
11
+ /** Shown when no type matches the search. */
12
+ empty: string;
13
+ /** Read out on a type: `{label}`. */
14
+ add: string;
15
+ };
16
+ outline: {
17
+ label: string;
18
+ expand: string;
19
+ collapse: string;
20
+ };
21
+ canvas: {
22
+ /** Names the canvas for screen readers. */
23
+ label: string;
24
+ /** Shown on an empty form or container. */
25
+ empty: string;
26
+ /** Shown on an empty form or container of a `readonly` builder. */
27
+ readonlyEmpty: string;
28
+ };
29
+ /** The tabs of the side panel. */
30
+ /** `side` names the pane, or the button that opens it, holding the fields and the outline. */
31
+ panels: {
32
+ side: string;
33
+ fields: string;
34
+ outline: string;
35
+ settings: string;
36
+ };
37
+ actions: {
38
+ parent: string;
39
+ up: string;
40
+ down: string;
41
+ duplicate: string;
42
+ remove: string;
43
+ /** The button that holds the other actions when a node is too narrow to show them. */
44
+ more: string;
45
+ /** On phones: taps add nodes to the selection instead of replacing it. */
46
+ selectMany: string;
47
+ wrap: string;
48
+ addPage: string;
49
+ undo: string;
50
+ redo: string;
51
+ };
52
+ inspector: {
53
+ /** Heading when nothing is selected: the form's own settings. */
54
+ form: string;
55
+ /** Heading of several selected nodes: `{count}`. */
56
+ multiple: string;
57
+ /** Heading over the settings of the field type. */
58
+ type: string;
59
+ /** Headings over the checks, and over when the node shows, is disabled or required. */
60
+ rules: string;
61
+ logic: string;
62
+ };
63
+ /** Read out after a change. */
64
+ announce: {
65
+ inserted: string;
66
+ removed: string;
67
+ duplicated: string;
68
+ moved: string;
69
+ /** After a drag or `moveTo`: `{where}` is the container, `{count}` how many nodes moved. */
70
+ movedTo: string;
71
+ movedManyTo: string;
72
+ wrapped: string;
73
+ undone: string;
74
+ redone: string;
75
+ /** After the whole form was replaced, e.g. by imported JSON. */
76
+ replaced: string;
77
+ };
78
+ /** The condition editor: rows of "field, how, value". */
79
+ condition: {
80
+ /** A line of the canvas mark's tooltip: a setting and its expression. `{label}`, `{text}`. */
81
+ summary: string;
82
+ /** Names a row for screen readers, followed by its number. */
83
+ row: string;
84
+ field: string;
85
+ operator: string;
86
+ value: string;
87
+ add: string;
88
+ remove: string;
89
+ /** How the rows combine. */
90
+ all: string;
91
+ any: string;
92
+ /** Switch to writing the expression, and back. */
93
+ toText: string;
94
+ toRows: string;
95
+ /** Why the expression cannot be shown as rows. */
96
+ notRows: string;
97
+ yes: string;
98
+ no: string;
99
+ /** Groups of the field list inside a list: the item's fields and the form's. */
100
+ itemGroup: string;
101
+ formGroup: string;
102
+ operators: Record<string, string>;
103
+ /** Names of the comparisons of dates, where they differ. */
104
+ dateOperators: Record<string, string>;
105
+ };
106
+ /** Expression text: what the completions mean, and the problems by their code. `{text}` is the text at fault. */
107
+ expression: {
108
+ values: string;
109
+ item: string;
110
+ value: string;
111
+ problems: Record<string, string>;
112
+ /** What the built-in functions take and do, for hover text and parameter hints. */
113
+ functions: Record<string, {
114
+ signature: string;
115
+ info: string;
116
+ }>;
117
+ /** Shown beside `true`, `false`, `null` and `in` in completions. */
118
+ keyword: string;
119
+ };
120
+ preview: {
121
+ /** The button that shows the preview. */
122
+ toggle: string;
123
+ label: string;
124
+ device: string;
125
+ devices: {
126
+ desktop: string;
127
+ tablet: string;
128
+ phone: string;
129
+ };
130
+ submit: string;
131
+ reset: string;
132
+ /** Over the values a submit would send. */
133
+ passed: string;
134
+ };
135
+ /** The JSON of the form. */
136
+ json: {
137
+ title: string;
138
+ /** Lays the text out again, two spaces a level. */
139
+ format: string;
140
+ file: string;
141
+ download: string;
142
+ copy: string;
143
+ copied: string;
144
+ cancel: string;
145
+ apply: string;
146
+ /** Closes the dialog of a `readonly` builder, which cannot apply anything. */
147
+ close: string;
148
+ syntax: string;
149
+ /** `{line}`, `{column}`. */
150
+ syntaxAt: string;
151
+ fine: string;
152
+ /** `{count}` problems not listed. */
153
+ more: string;
154
+ /** A value of the wrong kind, by what it should be, and `required` for one that is missing. */
155
+ shape: Record<string, string>;
156
+ /** The problems of `checkDocument`, by code. */
157
+ problems: Record<string, string>;
158
+ };
159
+ /** Moving nodes by dragging, or with the keyboard after `Space`. `{index}` counts from 1. */
160
+ drag: {
161
+ /** Read out before the first place, so it ends with its own stop. */
162
+ picked: string;
163
+ place: string;
164
+ /** The top of the form, as `{where}` in `place`. */
165
+ top: string;
166
+ cancelled: string;
167
+ /** The handle on a node's edge that changes its width. */
168
+ resize: string;
169
+ };
170
+ /** What new nodes are called. `{index}` counts from 1. */
171
+ created: {
172
+ option: string;
173
+ page: string;
174
+ step: string;
175
+ text: string;
176
+ alert: string;
177
+ };
178
+ /** Labels of the settings, by key. */
179
+ settings: Record<string, string>;
180
+ /** Choices of the settings, by setting and value. */
181
+ choices: Record<string, Record<string, string>>;
182
+ errors: {
183
+ /** A field holding a value needs a name. */
184
+ name: string;
185
+ /** `{text}`: the name. */
186
+ taken: string;
187
+ };
188
+ }
189
+ export declare const formBuilderLocales: Record<string, FormBuilderMessages>;
190
+ /** Texts to change; each group is merged, so only the texts given are replaced. */
191
+ export type FormBuilderMessagesOverride = {
192
+ [K in keyof FormBuilderMessages]?: K extends 'choices' ? Record<string, Record<string, string>> : Partial<FormBuilderMessages[K]>;
193
+ };
194
+ /** The builder's texts, picked by the name of DouUI's current locale. */
195
+ export declare function useFormBuilderMessages(override?: MaybeRefOrGetter<FormBuilderMessagesOverride | undefined>): import("vue").ComputedRef<FormBuilderMessages>;
@@ -0,0 +1,2 @@
1
+ export declare const expressionField: import("..").FormFieldType<import("..").FormFieldProps>;
2
+ export declare const conditionField: import("..").FormFieldType<import("..").FormFieldProps>;
@@ -0,0 +1,57 @@
1
+ import type { FormDocument, FormNode, FormRuleSpec } from '../core/types';
2
+ import type { FormFieldType } from '../fields/define';
3
+ import type { ConditionLiteral, ConditionOperator } from './condition';
4
+ import type { FormBuilderMessages } from './locale';
5
+ /** What a value is like, for the operators and the value input a condition row offers. */
6
+ export type TargetKind = 'text' | 'number' | 'date' | 'boolean' | 'choice' | 'choices' | 'list';
7
+ /** A field a condition or an expression can read. */
8
+ export interface LogicTarget {
9
+ scope: 'values' | 'item';
10
+ path: string;
11
+ label: string;
12
+ kind: TargetKind;
13
+ /** The field's own options, for `choice` and `choices`. */
14
+ options?: {
15
+ label: string;
16
+ value: ConditionLiteral;
17
+ }[];
18
+ }
19
+ export declare const operatorsOf: Record<TargetKind, ConditionOperator[]>;
20
+ /** What the logic of a node can read: the form's fields, and those of the list item around it. */
21
+ export interface LogicScope {
22
+ targets: LogicTarget[];
23
+ /** The names `values` can read. */
24
+ names: string[];
25
+ /** The names `item` can read; `undefined` outside lists. */
26
+ itemNames: string[] | undefined;
27
+ }
28
+ export declare function logicScope(document: FormDocument, id: string | undefined, fields: ReadonlyMap<string, FormFieldType>, messages: FormBuilderMessages): LogicScope;
29
+ /** Whether two scopes hold the same targets, so settings forms built on the first are kept. */
30
+ export declare function sameLogicScope(a: LogicScope, b: LogicScope): boolean;
31
+ export interface LogicSettingsContext {
32
+ messages: FormBuilderMessages;
33
+ /** What the node's expressions can read. */
34
+ scope: LogicScope;
35
+ /** The node's type, for a field. */
36
+ type?: FormFieldType;
37
+ /**
38
+ * The names of the validators given to the builder, offered by a
39
+ * `validator` rule; left out, any name can be typed.
40
+ */
41
+ validators?: readonly string[];
42
+ }
43
+ /** When a node shows, is disabled or required, and the value a field works out. */
44
+ export declare function logicSettings(node: FormNode, context: LogicSettingsContext): FormNode[];
45
+ /** The kinds of check the rules editor offers, each writing its own keys of a rule. */
46
+ export declare const ruleKinds: readonly ["type", "range", "pattern", "check", "validator"];
47
+ export type RuleKind = (typeof ruleKinds)[number];
48
+ /** The checks of a field or a list, as a list of rules. */
49
+ export declare function ruleSettings(context: LogicSettingsContext): FormNode[];
50
+ type RuleItem = Record<string, unknown> & {
51
+ kind?: RuleKind;
52
+ };
53
+ /** A rule as a row of the rules editor: its keys, and which kind of check it is. */
54
+ export declare function ruleToItem(rule: FormRuleSpec): RuleItem;
55
+ /** A row of the rules editor as a rule: only the keys of its kind, and the message and trigger. */
56
+ export declare function itemToRule(item: RuleItem): FormRuleSpec;
57
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { Component, VNode } from 'vue';
2
+ import type { BuilderState } from './context';
3
+ /** An item of a node's menu, built in or from an extension. */
4
+ export interface NodeMenuEntry {
5
+ key: string;
6
+ label: string;
7
+ icon?: Component;
8
+ run: () => void;
9
+ disabled?: boolean;
10
+ tone?: 'neutral' | 'danger';
11
+ /** The key that does the same, shown at the end of the item. */
12
+ shortcut?: string;
13
+ /** A line above it, between the built-in items and an extension's. */
14
+ divided?: boolean;
15
+ }
16
+ /**
17
+ * The menu of some nodes: move, copy, group and delete them, then the
18
+ * extensions' items. A read-only builder keeps only going to the parent
19
+ * and the extensions' items.
20
+ */
21
+ export declare function nodeMenu(state: BuilderState, ids: readonly string[]): NodeMenuEntry[];
22
+ /** The entries as items of a dropdown or a context menu. */
23
+ export declare function menuItems(entries: readonly NodeMenuEntry[]): VNode[];
@@ -0,0 +1,19 @@
1
+ import type { FormNode } from '../core/types';
2
+ type __VLS_Props = {
3
+ node: FormNode;
4
+ level: number;
5
+ position: number;
6
+ size: number;
7
+ container: boolean;
8
+ open: boolean;
9
+ selected: boolean;
10
+ };
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ toggle: () => any;
13
+ press: (event: MouseEvent) => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ onToggle?: (() => any) | undefined;
16
+ onPress?: ((event: MouseEvent) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,23 @@
1
+ import type { Ref } from 'vue';
2
+ import type { FormDocument } from '../core/types';
3
+ import type { FormFieldType } from '../fields/define';
4
+ type Data = Record<string, unknown>;
5
+ /**
6
+ * Edit an object (a node, its `props`, or the document's settings)
7
+ * through a settings form. The form's values start as a copy of the
8
+ * object; when one changes, the keys it touches are handed to `apply`
9
+ * as a patch. A setting set back to what leaving it out means (its
10
+ * `default`, or empty) is left out of the object again.
11
+ */
12
+ export declare function useSettingsBinding(options: {
13
+ source: () => Data | undefined;
14
+ /** What the object belongs to, e.g. the node's id: a new key shows a new copy even if the object is the same. */
15
+ key?: () => unknown;
16
+ form: () => FormDocument;
17
+ fields: () => Map<string, FormFieldType>;
18
+ /** Prepare a copy of the object for the form, e.g. turn plain options into objects. */
19
+ prepare?: (data: Data) => Data;
20
+ /** Write the patch; returns the object as it now is. */
21
+ apply: (patch: Data) => Data | undefined;
22
+ }): Ref<Data>;
23
+ export {};
@@ -0,0 +1,49 @@
1
+ import type { Component } from 'vue';
2
+ import type { FormDocument, FormNode } from '../core/types';
3
+ import type { FormFieldType } from '../fields/define';
4
+ import type { FormBuilderMessages } from './locale';
5
+ /** The palette groups in the order they are listed; groups of other names follow. */
6
+ export declare const paletteGroups: string[];
7
+ /** The containers the palette offers, after the field types. */
8
+ export declare const containerTypes: string[];
9
+ /** A type's icon: its own, else the built-in one, else a plain box. */
10
+ export declare function iconOf(type: string, spec?: FormFieldType): Component;
11
+ export declare function groupOf(type: string, spec?: FormFieldType): string;
12
+ /** A type's name for people: its own `label`, else the locale's. */
13
+ export declare function labelOf(type: string, spec: FormFieldType | undefined, messages: FormBuilderMessages): string;
14
+ /** What a node is called in the outline and the inspector's heading. */
15
+ export declare function nodeTitle(node: FormNode, fields: ReadonlyMap<string, FormFieldType>, messages: FormBuilderMessages): string;
16
+ type Setting = Record<string, unknown>;
17
+ export declare const field: (type: string, name: string, label: string, extra?: Setting) => FormNode;
18
+ export declare const text: (name: string, label: string, extra?: Setting) => FormNode;
19
+ export declare const number: (name: string, label: string, props?: Setting, extra?: Setting) => FormNode;
20
+ export declare function choices(messages: FormBuilderMessages, key: string, values: readonly (string | boolean)[]): {
21
+ value: string | boolean;
22
+ label: string;
23
+ }[];
24
+ export declare const segmented: (messages: FormBuilderMessages, name: string, values: readonly string[], fallback: string, extra?: Setting, key?: string) => FormNode;
25
+ /** Settings of the built-in types, edited in a node's `props`. */
26
+ export declare function builtinSettings(type: string, messages: FormBuilderMessages): FormNode[];
27
+ /** What the node-level settings of a node depend on. */
28
+ export interface NodeSettingsContext {
29
+ messages: FormBuilderMessages;
30
+ /** Columns of the grid the node sits on. */
31
+ columns: number;
32
+ /** Whether the node sits in a list item, so its name is a key of the item. */
33
+ inItem: boolean;
34
+ /** The node's type, for a field. */
35
+ type?: FormFieldType;
36
+ }
37
+ /** The builder's own type for a node's width: a number of columns, or one per breakpoint. */
38
+ export declare const SPAN_TYPE = "dou-builder-span";
39
+ /** The builder's own type for expression text, with completions and problems. */
40
+ export declare const EXPRESSION_TYPE = "dou-builder-expression";
41
+ /** The builder's own type for a condition, edited as rows or as text. */
42
+ export declare const CONDITION_TYPE = "dou-builder-condition";
43
+ /** The settings of a node itself, besides its type's: name, label, width and so on. */
44
+ export declare function nodeSettings(node: FormNode, context: NodeSettingsContext): FormNode[];
45
+ /** The settings of the document itself. */
46
+ export declare function documentSettings(messages: FormBuilderMessages): FormNode[];
47
+ /** A settings form: the nodes in a vertical, compact document. */
48
+ export declare function settingsDocument(nodes: FormNode[]): FormDocument;
49
+ export {};
@@ -0,0 +1,4 @@
1
+ /** The width setting of the inspector, a field type of the builder's own. */
2
+ export declare const spanField: import("..").FormFieldType<{
3
+ columns?: number;
4
+ }>;
@@ -0,0 +1,59 @@
1
+ import type { FormFunction } from '../core/expression';
2
+ import type { FormDocument, FormValidator } from '../core/types';
3
+ import type { FormFieldType } from '../fields/define';
4
+ import type { FormOptionsLoader } from '../renderer/context';
5
+ import type { FormBuilderMessagesOverride } from './locale';
6
+ import type { FormBuilderContext, FormBuilderMode } from './context';
7
+ import type { FormBuilderExtension } from './extension';
8
+ import type { FormBuilderTransaction } from './core/transaction';
9
+ export interface FormBuilderProps {
10
+ /** The form being built, bound with `v-model`. Each change hands over a new document. */
11
+ modelValue: FormDocument;
12
+ /** The ids of the selected nodes, bound with `v-model:selection`. */
13
+ selection?: string[];
14
+ /** Field types besides the built-in ones, the same list the renderer gets. */
15
+ fields?: FormFieldType<any>[];
16
+ /** Show the canvas (`design`, the default) or the form to fill in (`preview`), bound with `v-model:mode`. */
17
+ mode?: FormBuilderMode;
18
+ /**
19
+ * Functions the expressions can call, the same as the renderer's: the
20
+ * preview runs them, and the inspector completes and checks their names.
21
+ */
22
+ functions?: Record<string, FormFunction>;
23
+ /** Where options come from, the same as the renderer's, for the preview. */
24
+ sources?: Record<string, FormOptionsLoader>;
25
+ /**
26
+ * Checks that need code, the same as the renderer's: the preview runs
27
+ * them, and the rules editor offers their names.
28
+ */
29
+ validators?: Record<string, FormValidator>;
30
+ /**
31
+ * Show the form without letting it change: nodes can be selected, their
32
+ * settings read and the form previewed, but nothing can be added, moved,
33
+ * removed or edited.
34
+ */
35
+ readonly?: boolean;
36
+ /** Pieces of the builder: field types, keys, buttons, menu items, inspector parts. */
37
+ extensions?: (FormBuilderExtension | readonly FormBuilderExtension[])[];
38
+ /** Replaces texts of the builder. */
39
+ messages?: FormBuilderMessagesOverride;
40
+ }
41
+ export interface FormBuilderEmits {
42
+ 'update:modelValue': [document: FormDocument];
43
+ 'update:selection': [ids: string[]];
44
+ 'update:mode': [mode: FormBuilderMode];
45
+ /** A change was made: the transaction, with its steps and `meta`. Also for undo and redo. */
46
+ change: [tr: FormBuilderTransaction];
47
+ }
48
+ export interface FormBuilderSlots {
49
+ /**
50
+ * Replaces the layout: place `DouFormBuilderPalette`, `DouFormBuilderCanvas`,
51
+ * `DouFormBuilderInspector`, `DouFormBuilderOutline` and
52
+ * `DouFormBuilderPreview` as you like.
53
+ */
54
+ default?: () => unknown;
55
+ /** Buttons after undo and redo, over the canvas. */
56
+ toolbar?: () => unknown;
57
+ }
58
+ /** What a builder's ref gives, the same as `useFormBuilder()` inside it. */
59
+ export type FormBuilderExpose = FormBuilderContext;
@@ -0,0 +1,23 @@
1
+ import type { ExpressionName } from './extension';
2
+ type __VLS_Props = {
3
+ modelValue?: string | null;
4
+ names?: ExpressionName[];
5
+ itemNames?: ExpressionName[];
6
+ readsValue?: boolean;
7
+ placeholder?: string;
8
+ disabled?: boolean;
9
+ /** Shown and selectable, but not changed; also when the form around is read-only. */
10
+ readonly?: boolean;
11
+ };
12
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
+ "update:modelValue": (value: string) => any;
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
16
+ }>, {
17
+ modelValue: string | null;
18
+ placeholder: string;
19
+ names: ExpressionName[];
20
+ itemNames: ExpressionName[];
21
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;
@@ -0,0 +1,45 @@
1
+ import type { CodeExtension } from '@dou-ui/code';
2
+ import type { ExpressionProblem } from '../core/expression';
3
+ /** A path an expression can read, with what to show beside it. */
4
+ export interface ExpressionName {
5
+ path: string;
6
+ label?: string;
7
+ }
8
+ /** What a function takes and does, for hover text and parameter hints. */
9
+ export interface ExpressionFunctionInfo {
10
+ /** As it is called, e.g. `round(value, digits?)`. */
11
+ signature: string;
12
+ info?: string;
13
+ }
14
+ type Getter<T> = T | (() => T);
15
+ export interface ExpressionCodeOptions {
16
+ /** The paths `values` can read. */
17
+ names?: Getter<readonly ExpressionName[]>;
18
+ /** The paths `item` can read; left out where there is no list item. */
19
+ itemNames?: Getter<readonly ExpressionName[] | undefined>;
20
+ /** Whether `value` (the field's own value) can be read, as in a check. */
21
+ readsValue?: Getter<boolean>;
22
+ /** Functions besides the built-in ones. */
23
+ functions?: Getter<readonly string[]>;
24
+ /** What each function takes and does, by name. */
25
+ functionInfo?: Getter<Readonly<Record<string, ExpressionFunctionInfo>>>;
26
+ /** Shown beside `values`, `item`, `value` and the keywords in completions. */
27
+ labels?: Getter<{
28
+ values?: string;
29
+ item?: string;
30
+ value?: string;
31
+ keyword?: string;
32
+ }>;
33
+ /** The words for a problem; the English description by default. */
34
+ problemMessage?: (problem: ExpressionProblem) => string;
35
+ /** Finds problems as the expression is typed. On by default. */
36
+ lint?: boolean;
37
+ }
38
+ /**
39
+ * Completions, hover text, parameter hints and problems for form
40
+ * expressions in a `DouCodeEditor` or `DouCodeInput`: field paths after
41
+ * `values.` and `item.`, functions as snippets, and the problems of
42
+ * `checkExpression` underlined where they are.
43
+ */
44
+ export declare function expressionCodeExtension(options?: ExpressionCodeOptions): CodeExtension;
45
+ export {};