@json-layout/core 2.8.0 → 2.8.2

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 (87) hide show
  1. package/package.json +2 -2
  2. package/src/compile/serialize.js +18 -15
  3. package/src/compile/skeleton-node.js +25 -0
  4. package/src/i18n/de.js +1 -0
  5. package/src/i18n/en.js +1 -0
  6. package/src/i18n/fr.js +1 -0
  7. package/src/i18n/nl.js +1 -0
  8. package/src/i18n/types.ts +1 -0
  9. package/src/state/index.js +28 -0
  10. package/src/state/state-node.js +25 -3
  11. package/src/state/types.ts +6 -0
  12. package/types/compile/index.d.ts +16 -0
  13. package/types/compile/index.d.ts.map +1 -0
  14. package/types/compile/options.d.ts +6 -0
  15. package/types/compile/options.d.ts.map +1 -0
  16. package/types/compile/serialize.d.ts +6 -0
  17. package/types/compile/serialize.d.ts.map +1 -0
  18. package/types/compile/skeleton-node.d.ts +21 -0
  19. package/types/compile/skeleton-node.d.ts.map +1 -0
  20. package/types/compile/skeleton-tree.d.ts +19 -0
  21. package/types/compile/skeleton-tree.d.ts.map +1 -0
  22. package/types/compile/types.d.ts +61 -0
  23. package/types/compile/types.d.ts.map +1 -0
  24. package/types/compile/utils/resolve-refs.d.ts +17 -0
  25. package/types/compile/utils/resolve-refs.d.ts.map +1 -0
  26. package/types/compile/utils/x-i18n.d.ts +2 -0
  27. package/types/compile/utils/x-i18n.d.ts.map +1 -0
  28. package/types/i18n/de.d.ts +25 -0
  29. package/types/i18n/de.d.ts.map +1 -0
  30. package/types/i18n/en.d.ts +25 -0
  31. package/types/i18n/en.d.ts.map +1 -0
  32. package/types/i18n/fr.d.ts +25 -0
  33. package/types/i18n/fr.d.ts.map +1 -0
  34. package/types/i18n/index.d.ts +8 -0
  35. package/types/i18n/index.d.ts.map +1 -0
  36. package/types/i18n/nl.d.ts +25 -0
  37. package/types/i18n/nl.d.ts.map +1 -0
  38. package/types/i18n/types.d.ts +24 -0
  39. package/types/i18n/types.d.ts.map +1 -0
  40. package/types/index.d.ts +5 -0
  41. package/types/index.d.ts.map +1 -0
  42. package/types/state/index.d.ts +316 -0
  43. package/types/state/index.d.ts.map +1 -0
  44. package/types/state/options.d.ts +11 -0
  45. package/types/state/options.d.ts.map +1 -0
  46. package/types/state/state-node.d.ts +63 -0
  47. package/types/state/state-node.d.ts.map +1 -0
  48. package/types/state/state-tree.d.ts +13 -0
  49. package/types/state/state-tree.d.ts.map +1 -0
  50. package/types/state/types.d.ts +200 -0
  51. package/types/state/types.d.ts.map +1 -0
  52. package/types/state/utils/display.d.ts +51 -0
  53. package/types/state/utils/display.d.ts.map +1 -0
  54. package/types/state/utils/immutable.d.ts +21 -0
  55. package/types/state/utils/immutable.d.ts.map +1 -0
  56. package/types/state/utils/modified.d.ts +17 -0
  57. package/types/state/utils/modified.d.ts.map +1 -0
  58. package/types/state/utils/regexps.d.ts +6 -0
  59. package/types/state/utils/regexps.d.ts.map +1 -0
  60. package/types/state/utils/urls.d.ts +2 -0
  61. package/types/state/utils/urls.d.ts.map +1 -0
  62. package/types/utils/build.d.ts +5 -0
  63. package/types/utils/build.d.ts.map +1 -0
  64. package/types/utils/clone.d.ts +2 -0
  65. package/types/utils/clone.d.ts.map +1 -0
  66. package/types/utils/doc-options.d.ts +14 -0
  67. package/types/utils/doc-options.d.ts.map +1 -0
  68. package/types/webmcp/index.d.ts +90 -0
  69. package/types/webmcp/index.d.ts.map +1 -0
  70. package/types/webmcp/project.d.ts +111 -0
  71. package/types/webmcp/project.d.ts.map +1 -0
  72. package/types/webmcp/resolve.d.ts +11 -0
  73. package/types/webmcp/resolve.d.ts.map +1 -0
  74. package/types/webmcp/tools/describe-state.d.ts +79 -0
  75. package/types/webmcp/tools/describe-state.d.ts.map +1 -0
  76. package/types/webmcp/tools/edit-array.d.ts +88 -0
  77. package/types/webmcp/tools/edit-array.d.ts.map +1 -0
  78. package/types/webmcp/tools/fill-form-skill.d.ts +24 -0
  79. package/types/webmcp/tools/fill-form-skill.d.ts.map +1 -0
  80. package/types/webmcp/tools/get-data.d.ts +31 -0
  81. package/types/webmcp/tools/get-data.d.ts.map +1 -0
  82. package/types/webmcp/tools/get-field-suggestions.d.ts +66 -0
  83. package/types/webmcp/tools/get-field-suggestions.d.ts.map +1 -0
  84. package/types/webmcp/tools/set-data.d.ts +60 -0
  85. package/types/webmcp/tools/set-data.d.ts.map +1 -0
  86. package/types/webmcp/tools/set-field-value.d.ts +91 -0
  87. package/types/webmcp/tools/set-field-value.d.ts.map +1 -0
@@ -0,0 +1,24 @@
1
+ import { type NormalizeMessages } from '@json-layout/vocabulary';
2
+ export interface CompileOptionsMessages {
3
+ errorOneOf: string;
4
+ errorRequired: string;
5
+ }
6
+ export interface StateOptionsMessages {
7
+ addItem: string;
8
+ delete: string;
9
+ confirm: string;
10
+ edit: string;
11
+ close: string;
12
+ duplicate: string;
13
+ insertAfter: string;
14
+ copy: string;
15
+ paste: string;
16
+ sort: string;
17
+ up: string;
18
+ down: string;
19
+ showHelp: string;
20
+ keyboardDate: string;
21
+ keyboardDateTime: string;
22
+ }
23
+ export type LocaleMessages = NormalizeMessages & CompileOptionsMessages & StateOptionsMessages;
24
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i18n/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,sBAAsB,GAAG,oBAAoB,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from "./compile/index.js";
2
+ export * from "./state/index.js";
3
+ export { default as i18n } from "./i18n/index.js";
4
+ export { clone } from "@json-layout/vocabulary";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,316 @@
1
+ export { Display } from "./utils/display.js";
2
+ export { getRegexp } from "./utils/regexps.js";
3
+ /**
4
+ * @typedef {import('./types.js').StateNode} StateNode
5
+ * @typedef {import('./types.js').StateTree} StateTree
6
+ * @typedef {import('./types.js').StatefulLayoutOptions} StatefulLayoutOptions
7
+ * @typedef {import('./types.js').CreateStateTreeContext} CreateStateTreeContext
8
+ * @typedef {import('./types.js').TextFieldNode} TextFieldNode
9
+ * @typedef {import('./types.js').TextareaNode} TextareaNode
10
+ * @typedef {import('./types.js').NumberFieldNode} NumberFieldNode
11
+ * @typedef {import('./types.js').SliderNode} SliderNode
12
+ * @typedef {import('./types.js').SectionNode} SectionNode
13
+ * @typedef {import('./types.js').SelectNode} SelectNode
14
+ * @typedef {import('./types.js').AutocompleteNode} AutocompleteNode
15
+ * @typedef {import('./types.js').RadioGroupNode} RadioGroupNode
16
+ * @typedef {import('./types.js').CheckboxGroupNode} CheckboxGroupNode
17
+ * @typedef {import('./types.js').SwitchGroupNode} SwitchGroupNode
18
+ * @typedef {import('./types.js').ComboboxNode} ComboboxNode
19
+ * @typedef {import('./types.js').CheckboxNode} CheckboxNode
20
+ * @typedef {import('./types.js').SwitchNode} SwitchNode
21
+ * @typedef {import('./types.js').ColorPickerNode} ColorPickerNode
22
+ * @typedef {import('./types.js').DatePickerNode} DatePickerNode
23
+ * @typedef {import('./types.js').DateTimePickerNode} DateTimePickerNode
24
+ * @typedef {import('./types.js').TimePickerNode} TimePickerNode
25
+ * @typedef {import('./types.js').ExpansionPanelsNode} ExpansionPanelsNode
26
+ * @typedef {import('./types.js').TabsNode} TabsNode
27
+ * @typedef {import('./types.js').VerticalTabsNode} VerticalTabsNode
28
+ * @typedef {import('./types.js').StepperNode} StepperNode
29
+ * @typedef {import('./types.js').OneOfSelectNode} OneOfSelectNode
30
+ * @typedef {import('./types.js').ListNode} ListNode
31
+ * @typedef {import('./types.js').FileInputNode} FileInputNode
32
+ * @typedef {import('./types.js').CardNode} CardNode
33
+ * @typedef {import('./types.js').FileRef} FileRef
34
+ */
35
+ /** @type {(node: StateNode | undefined) => node is SectionNode} */
36
+ export const isSection: (node: StateNode | undefined) => node is SectionNode;
37
+ /** @type {(node: StateNode | undefined, components: Record<string, import('@json-layout/vocabulary').ComponentInfo>) => node is SelectNode | ComboboxNode | AutocompleteNode} */
38
+ export const isItemsNode: (node: StateNode | undefined, components: Record<string, import("@json-layout/vocabulary").ComponentInfo>) => node is SelectNode | ComboboxNode | AutocompleteNode;
39
+ export class StatefulLayout {
40
+ /**
41
+ * @param {import("../index.js").CompiledLayout} compiledLayout
42
+ * @param {import("../index.js").SkeletonTree} skeletonTree
43
+ * @param {Partial<StatefulLayoutOptions>} options
44
+ * @param {unknown} [data]
45
+ * @param {unknown} [savedData]
46
+ */
47
+ constructor(compiledLayout: import("../index.js").CompiledLayout, skeletonTree: import("../index.js").SkeletonTree, options: Partial<StatefulLayoutOptions>, data?: unknown, savedData?: unknown);
48
+ /**
49
+ * @private
50
+ * @readonly
51
+ * @type {import('../index.js').CompiledLayout}
52
+ */
53
+ private readonly _compiledLayout;
54
+ get compiledLayout(): import("../compile/types.js").CompiledLayout;
55
+ /**
56
+ * @private
57
+ * @type {StateTree}
58
+ */
59
+ private _stateTree;
60
+ get stateTree(): import("./types.js").StateTree;
61
+ /**
62
+ * @readonly
63
+ * @type {import('../index.js').SkeletonTree}
64
+ */
65
+ readonly skeletonTree: import("../index.js").SkeletonTree;
66
+ /**
67
+ * @private
68
+ * @type {Display}
69
+ */
70
+ private _display;
71
+ get display(): Display;
72
+ /**
73
+ * @private
74
+ * @type {import('./types.js').ValidationState}
75
+ */
76
+ private _validationState;
77
+ /**
78
+ * @private
79
+ * @param {Partial<import('./types.js').ValidationState>} validationState
80
+ */
81
+ set validationState(validationState: Partial<import("./types.js").ValidationState>);
82
+ /**
83
+ * @returns {import('./types.js').ValidationState}
84
+ */
85
+ get validationState(): import("./types.js").ValidationState;
86
+ /**
87
+ * @private
88
+ * @type {StatefulLayoutOptions}
89
+ */
90
+ private _options;
91
+ /**
92
+ * @param {Partial<StatefulLayoutOptions>} options
93
+ */
94
+ set options(options: Partial<StatefulLayoutOptions>);
95
+ /**
96
+ * @returns {StatefulLayoutOptions}
97
+ */
98
+ get options(): StatefulLayoutOptions;
99
+ /**
100
+ * @private
101
+ * @type {unknown}
102
+ */
103
+ private _data;
104
+ set data(data: unknown);
105
+ get data(): unknown;
106
+ /**
107
+ * true after data was replaced from outside, consumed by the next state tree creation
108
+ * @private
109
+ * @type {boolean}
110
+ */
111
+ private _reResolveActivatedItems;
112
+ /**
113
+ * @private
114
+ * @type {unknown}
115
+ */
116
+ private _previousData;
117
+ /**
118
+ * @private
119
+ * @type {boolean}
120
+ */
121
+ private _dataWaitingForBlur;
122
+ /**
123
+ * @private
124
+ * @type {string | null}
125
+ */
126
+ private _currentInput;
127
+ /**
128
+ * @private
129
+ * @type {CreateStateTreeContext}
130
+ */
131
+ private _lastCreateStateTreeContext;
132
+ /**
133
+ * @private
134
+ * @type {string | null}
135
+ */
136
+ private _autofocusTarget;
137
+ /**
138
+ * @private
139
+ * @type {string | null}
140
+ */
141
+ private _previousAutofocusTarget;
142
+ /**
143
+ * @type {FileRef[]}
144
+ */
145
+ files: FileRef[];
146
+ /**
147
+ * @private
148
+ * @type {unknown}
149
+ */
150
+ private _savedData;
151
+ /**
152
+ * @type {Record<string, number | string>}
153
+ */
154
+ activatedItems: Record<string, number | string>;
155
+ /**
156
+ * @private
157
+ * @param {Partial<StatefulLayoutOptions>} options
158
+ */
159
+ private prepareOptions;
160
+ /**
161
+ * @private
162
+ */
163
+ private initValidationState;
164
+ /**
165
+ * @private
166
+ */
167
+ private updateState;
168
+ /**
169
+ * @private
170
+ */
171
+ private emitData;
172
+ /**
173
+ * @private
174
+ * @param {boolean} rehydrate
175
+ */
176
+ private createStateTree;
177
+ validate(): void;
178
+ resetValidation(): void;
179
+ /**
180
+ * @returns {boolean}
181
+ */
182
+ get valid(): boolean;
183
+ /**
184
+ * @returns {string[]}
185
+ */
186
+ get errors(): string[];
187
+ /**
188
+ * @returns {boolean}
189
+ */
190
+ get hasHiddenError(): boolean;
191
+ /**
192
+ * @returns {boolean}
193
+ */
194
+ get modified(): boolean;
195
+ /** @param {unknown} savedData */
196
+ set savedData(savedData: unknown);
197
+ get savedData(): unknown;
198
+ /**
199
+ * @private
200
+ * @param {StateNode} node
201
+ * @returns {import('../compile/types.js').ParentContextExpression | null}
202
+ */
203
+ private getParentContextExpression;
204
+ /**
205
+ * @param {StateNode} node
206
+ * @param {import('@json-layout/vocabulary').Expression} expression
207
+ * @param {any} data
208
+ * @returns {any}
209
+ */
210
+ evalNodeExpression(node: StateNode, expression: import("@json-layout/vocabulary").Expression, data: any): any;
211
+ /**
212
+ * @private
213
+ * @param {StateNode} node
214
+ * @param {unknown} data
215
+ * @param {boolean} [validated]
216
+ * @param {number} [activateKey]
217
+ */
218
+ private applyInput;
219
+ /**
220
+ * @private
221
+ * @type {null | [StateNode, unknown, boolean, number | undefined, ReturnType<typeof setTimeout>]}
222
+ */
223
+ private debouncedInput;
224
+ applyDebouncedInput(): void;
225
+ /**
226
+ * @param {StateNode} node
227
+ * @param {unknown} data
228
+ * @param {number} [activateKey]
229
+ */
230
+ input(node: StateNode, data: unknown, activateKey?: number): void;
231
+ /**
232
+ * @param {StateNode} node
233
+ */
234
+ blur(node: StateNode): void;
235
+ /**
236
+ * @param {StateNode} node
237
+ */
238
+ validateNodeRecurse(node: StateNode): void;
239
+ /**
240
+ * @private
241
+ * @type {Record<string, {key: any, appliedQ: boolean, items: import('@json-layout/vocabulary').SelectItems}>}
242
+ */
243
+ private _itemsCache;
244
+ /**
245
+ * @private
246
+ * @param {StateNode} node
247
+ * @param {string} q
248
+ * @returns {Promise<{appliedQ: boolean, items: import('@json-layout/vocabulary').SelectItems}>}
249
+ */
250
+ private getItemsWithoutCache;
251
+ /**
252
+ * @param {StateNode} node
253
+ * @param {string} q
254
+ * @returns {Promise<import('@json-layout/vocabulary').SelectItems>}
255
+ */
256
+ getItems(node: StateNode, q?: string): Promise<import("@json-layout/vocabulary").SelectItems>;
257
+ /**
258
+ * @param {StateNode} node
259
+ * @param {any} rawItem
260
+ * @returns {import('@json-layout/vocabulary').SelectItem}
261
+ */
262
+ prepareSelectItem(node: StateNode, rawItem: any): import("@json-layout/vocabulary").SelectItem;
263
+ /**
264
+ * keys of activatedItems that were explicitly selected by the user,
265
+ * as opposed to auto-activated from the data
266
+ * @private
267
+ * @type {Set<string>}
268
+ */
269
+ private _explicitActivatedItems;
270
+ /**
271
+ * @param {StateNode} node
272
+ * @param {number | string} key
273
+ */
274
+ activateItem(node: StateNode, key: number | string): void;
275
+ /**
276
+ * @param {string} fullKey
277
+ */
278
+ focusNode(fullKey: string): void;
279
+ /**
280
+ * @param {StateNode} node
281
+ * @param {boolean} skipUpdateState
282
+ */
283
+ deactivateItem(node: StateNode, skipUpdateState?: boolean): void;
284
+ handleAutofocus(): void;
285
+ }
286
+ export type StateNode = import("./types.js").StateNode;
287
+ export type StateTree = import("./types.js").StateTree;
288
+ export type StatefulLayoutOptions = import("./types.js").StatefulLayoutOptions;
289
+ export type CreateStateTreeContext = import("./types.js").CreateStateTreeContext;
290
+ export type TextFieldNode = import("./types.js").TextFieldNode;
291
+ export type TextareaNode = import("./types.js").TextareaNode;
292
+ export type NumberFieldNode = import("./types.js").NumberFieldNode;
293
+ export type SliderNode = import("./types.js").SliderNode;
294
+ export type SectionNode = import("./types.js").SectionNode;
295
+ export type SelectNode = import("./types.js").SelectNode;
296
+ export type AutocompleteNode = import("./types.js").AutocompleteNode;
297
+ export type RadioGroupNode = import("./types.js").RadioGroupNode;
298
+ export type CheckboxGroupNode = import("./types.js").CheckboxGroupNode;
299
+ export type SwitchGroupNode = import("./types.js").SwitchGroupNode;
300
+ export type ComboboxNode = import("./types.js").ComboboxNode;
301
+ export type CheckboxNode = import("./types.js").CheckboxNode;
302
+ export type SwitchNode = import("./types.js").SwitchNode;
303
+ export type ColorPickerNode = import("./types.js").ColorPickerNode;
304
+ export type DatePickerNode = import("./types.js").DatePickerNode;
305
+ export type DateTimePickerNode = import("./types.js").DateTimePickerNode;
306
+ export type TimePickerNode = import("./types.js").TimePickerNode;
307
+ export type ExpansionPanelsNode = import("./types.js").ExpansionPanelsNode;
308
+ export type TabsNode = import("./types.js").TabsNode;
309
+ export type VerticalTabsNode = import("./types.js").VerticalTabsNode;
310
+ export type StepperNode = import("./types.js").StepperNode;
311
+ export type OneOfSelectNode = import("./types.js").OneOfSelectNode;
312
+ export type ListNode = import("./types.js").ListNode;
313
+ export type FileInputNode = import("./types.js").FileInputNode;
314
+ export type CardNode = import("./types.js").CardNode;
315
+ export type FileRef = import("./types.js").FileRef;
316
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.js"],"names":[],"mappings":";;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,mEAAmE;AACnE,wBADW,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,IAA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AY,EAAE,qBAAqB;qCAC1C,OAAO,YAAY,EAAE,sBAAsB;4BAC3C,OAAO,YAAY,EAAE,aAAa;2BAClC,OAAO,YAAY,EAAE,YAAY;8BACjC,OAAO,YAAY,EAAE,eAAe;yBACpC,OAAO,YAAY,EAAE,UAAU;0BAC/B,OAAO,YAAY,EAAE,WAAW;yBAChC,OAAO,YAAY,EAAE,UAAU;+BAC/B,OAAO,YAAY,EAAE,gBAAgB;6BACrC,OAAO,YAAY,EAAE,cAAc;gCACnC,OAAO,YAAY,EAAE,iBAAiB;8BACtC,OAAO,YAAY,EAAE,eAAe;2BACpC,OAAO,YAAY,EAAE,YAAY;2BACjC,OAAO,YAAY,EAAE,YAAY;yBACjC,OAAO,YAAY,EAAE,UAAU;8BAC/B,OAAO,YAAY,EAAE,eAAe;6BACpC,OAAO,YAAY,EAAE,cAAc;iCACnC,OAAO,YAAY,EAAE,kBAAkB;6BACvC,OAAO,YAAY,EAAE,cAAc;kCACnC,OAAO,YAAY,EAAE,mBAAmB;uBACxC,OAAO,YAAY,EAAE,QAAQ;+BAC7B,OAAO,YAAY,EAAE,gBAAgB;0BACrC,OAAO,YAAY,EAAE,WAAW;8BAChC,OAAO,YAAY,EAAE,eAAe;uBACpC,OAAO,YAAY,EAAE,QAAQ;4BAC7B,OAAO,YAAY,EAAE,aAAa;uBAClC,OAAO,YAAY,EAAE,QAAQ;sBAC7B,OAAO,YAAY,EAAE,OAAO"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @typedef {import('./types.js').StatefulLayoutOptions} StatefulLayoutOptions
3
+ */
4
+ /**
5
+ * @param {Partial<StatefulLayoutOptions>} partialOptions
6
+ * @param {import('../index.js').CompiledLayout} compiledLayout
7
+ * @returns {StatefulLayoutOptions}
8
+ */
9
+ export function fillOptions(partialOptions: Partial<StatefulLayoutOptions>, compiledLayout: import("../index.js").CompiledLayout): StatefulLayoutOptions;
10
+ export type StatefulLayoutOptions = import("./types.js").StatefulLayoutOptions;
11
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/state/options.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,4CAJW,OAAO,CAAC,qBAAqB,CAAC,kBAC9B,OAAO,aAAa,EAAE,cAAc,GAClC,qBAAqB,CAiCjC;oCAvCY,OAAO,YAAY,EAAE,qBAAqB"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @param {import('../index.js').CompiledExpression[]} expressions
3
+ * @param {import('@json-layout/vocabulary').Expression} expression
4
+ * @param {any} data
5
+ * @param {import('./types.js').StateNodeOptions} options
6
+ * @param {import('./utils/display.js').Display} display
7
+ * @param {import('@json-layout/vocabulary').BaseCompObject} layout
8
+ * @param {Record<string, import('ajv').ValidateFunction>} validates
9
+ * @param {unknown} rootData
10
+ * @param {import('../compile/types.js').ParentContextExpression | null} parentContext
11
+ * @returns {any}
12
+ */
13
+ export function evalExpression(expressions: import("../index.js").CompiledExpression[], expression: import("@json-layout/vocabulary").Expression, data: any, options: import("./types.js").StateNodeOptions, display: import("./utils/display.js").Display, layout: import("@json-layout/vocabulary").BaseCompObject, validates: Record<string, import("ajv").ValidateFunction>, rootData: unknown, parentContext: import("../compile/types.js").ParentContextExpression | null): any;
14
+ /**
15
+ *
16
+ * @param {import('./types.js').CreateStateTreeContext} context
17
+ * @param {import('./types.js').StateNodeOptions} parentOptions
18
+ * @param {import('../index.js').CompiledLayout} compiledLayout
19
+ * @param {string | number} key
20
+ * @param {string} fullKey
21
+ * @param {string | null} parentFullKey
22
+ * @param {string} dataPath
23
+ * @param {string | null} parentDataPath
24
+ * @param {import('../index.js').SkeletonNode} skeleton
25
+ * @param {import('@json-layout/vocabulary').Child | null} childDefinition
26
+ * @param {import('./utils/display.js').Display} parentDisplay
27
+ * @param {any} data
28
+ * @param {import('../compile/types.js').ParentContextExpression | null} parentContext
29
+ * @param {import('./types.js').ValidationState} validationState
30
+ * @param {number} titleDepth
31
+ * @param {import('./types.js').StateNode} [reusedNode]
32
+ * @returns {import('./types.js').StateNode}
33
+ */
34
+ export function createStateNode(context: import("./types.js").CreateStateTreeContext, parentOptions: import("./types.js").StateNodeOptions, compiledLayout: import("../index.js").CompiledLayout, key: string | number, fullKey: string, parentFullKey: string | null, dataPath: string, parentDataPath: string | null, skeleton: import("../index.js").SkeletonNode, childDefinition: import("@json-layout/vocabulary").Child | null, parentDisplay: import("./utils/display.js").Display, data: any, parentContext: import("../compile/types.js").ParentContextExpression | null, validationState: import("./types.js").ValidationState, titleDepth: number, reusedNode?: import("./types.js").StateNode): import("./types.js").StateNode;
35
+ export function useDefaultData(data: unknown, layout: import("@json-layout/vocabulary").BaseCompObject, options: import("./types.js").StateNodeOptions): boolean;
36
+ /** @type {(draft: any, node: import('./types.js').StateNode, data: unknown) => any} */
37
+ export const producePatchedData: (draft: any, node: import("./types.js").StateNode, data: unknown) => any;
38
+ /**
39
+ * Merge a fresh getItems result into the list's current data.
40
+ *
41
+ * For every item in newItems, matched by key against existingItems:
42
+ * - matching key: the existing data entry is preserved (local edits win,
43
+ * the new item.value is discarded);
44
+ * - new key: the new item.value is used;
45
+ * - existing keys absent from newItems: dropped.
46
+ *
47
+ * When preserveOrder is true (used when listActions includes 'sort'):
48
+ * - the user's current order is kept for items that are still present;
49
+ * - items new in newItems are appended at the end, in newItems order;
50
+ * - items dropped from newItems are still removed.
51
+ *
52
+ * When preserveOrder is false (default), the order from newItems is used.
53
+ *
54
+ * When replaceData is true (used when items are not editable locally — i.e.
55
+ * listActions does not include 'edit' and listEditMode is not 'inline'):
56
+ * - on a matching key, the new item.value replaces the existing data
57
+ * entry (server is the source of truth for non-editable items).
58
+ *
59
+ * When replaceData is false (default), local data is preserved on match.
60
+ * @type {(existingData: any[], existingItems: import('@json-layout/vocabulary').SelectItems, newItems: import('@json-layout/vocabulary').SelectItems, preserveOrder?: boolean, replaceData?: boolean) => any}
61
+ */
62
+ export const produceListData: (existingData: any[], existingItems: import("@json-layout/vocabulary").SelectItems, newItems: import("@json-layout/vocabulary").SelectItems, preserveOrder?: boolean, replaceData?: boolean) => any;
63
+ //# sourceMappingURL=state-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-node.d.ts","sourceRoot":"","sources":["../../src/state/state-node.js"],"names":[],"mappings":"AAkRA;;;;;;;;;;;GAWG;AACH,4CAXW,OAAO,aAAa,EAAE,kBAAkB,EAAE,cAC1C,OAAO,yBAAyB,EAAE,UAAU,QAC5C,GAAG,WACH,OAAO,YAAY,EAAE,gBAAgB,WACrC,OAAO,oBAAoB,EAAE,OAAO,UACpC,OAAO,yBAAyB,EAAE,cAAc,aAChD,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,EAAE,gBAAgB,CAAC,YAC9C,OAAO,iBACP,OAAO,qBAAqB,EAAE,uBAAuB,GAAG,IAAI,GAC1D,GAAG,CAsBf;AAiCD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,yCAlBW,OAAO,YAAY,EAAE,sBAAsB,iBAC3C,OAAO,YAAY,EAAE,gBAAgB,kBACrC,OAAO,aAAa,EAAE,cAAc,OACpC,MAAM,GAAG,MAAM,WACf,MAAM,iBACN,MAAM,GAAG,IAAI,YACb,MAAM,kBACN,MAAM,GAAG,IAAI,YACb,OAAO,aAAa,EAAE,YAAY,mBAClC,OAAO,yBAAyB,EAAE,KAAK,GAAG,IAAI,iBAC9C,OAAO,oBAAoB,EAAE,OAAO,QACpC,GAAG,iBACH,OAAO,qBAAqB,EAAE,uBAAuB,GAAG,IAAI,mBAC5D,OAAO,YAAY,EAAE,eAAe,cACpC,MAAM,eACN,OAAO,YAAY,EAAE,SAAS,GAC5B,OAAO,YAAY,EAAE,SAAS,CAipB1C;AAx9BM,qCALI,OAAO,UACP,OAAO,yBAAyB,EAAE,cAAc,WAChD,OAAO,YAAY,EAAE,gBAAgB,GACnC,OAAO,CAMnB;AAs9BD,uFAAuF;AACvF,iCADW,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,KAAK,GAAG,CAgBjF;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,8BAFU,CAAC,YAAY,EAAE,GAAG,EAAE,EAAE,aAAa,EAAE,OAAO,yBAAyB,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,yBAAyB,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO,KAAK,GAAG,CAkC5M"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @param {import('./types.js').CreateStateTreeContext} context
3
+ * @param {import('./types.js').StatefulLayoutOptions} options
4
+ * @param {import('../index.js').CompiledLayout} compiledLayout
5
+ * @param {import('../index.js').SkeletonTree} skeleton
6
+ * @param {import('./utils/display.js').Display} display
7
+ * @param {unknown} data
8
+ * @param {import('./types.js').ValidationState} validationState
9
+ * @param {import('./types.js').StateTree} [reusedStateTree]
10
+ * @returns {import('./types.js').StateTree}
11
+ */
12
+ export function createStateTree(context: import("./types.js").CreateStateTreeContext, options: import("./types.js").StatefulLayoutOptions, compiledLayout: import("../index.js").CompiledLayout, skeleton: import("../index.js").SkeletonTree, display: import("./utils/display.js").Display, data: unknown, validationState: import("./types.js").ValidationState, reusedStateTree?: import("./types.js").StateTree): import("./types.js").StateTree;
13
+ //# sourceMappingURL=state-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-tree.d.ts","sourceRoot":"","sources":["../../src/state/state-tree.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;GAUG;AACH,yCAVW,OAAO,YAAY,EAAE,sBAAsB,WAC3C,OAAO,YAAY,EAAE,qBAAqB,kBAC1C,OAAO,aAAa,EAAE,cAAc,YACpC,OAAO,aAAa,EAAE,YAAY,WAClC,OAAO,oBAAoB,EAAE,OAAO,QACpC,OAAO,mBACP,OAAO,YAAY,EAAE,eAAe,oBACpC,OAAO,YAAY,EAAE,SAAS,GAC5B,OAAO,YAAY,EAAE,SAAS,CAoF1C"}
@@ -0,0 +1,200 @@
1
+ import { type ErrorObject } from 'ajv/dist/2019.js';
2
+ import { type BaseCompObject, type Cols, type StateNodeOptionsBase, type TextField, type Textarea, type NumberField, type Slider, type Checkbox, type Switch, type DatePicker, type DateTimePicker, type TimePicker, type ColorPicker, type Section, type OneOfSelect, type Select, type Autocomplete, type Tabs, type VerticalTabs, type ExpansionPanels, type Stepper, type List, type Combobox, type FileInput, type Card, type Child, type StateNodePropsLib, type Slots } from '@json-layout/vocabulary';
3
+ import { type SkeletonTree, type SkeletonNode, type StatefulLayout, type CompiledLayout } from '../index.js';
4
+ import { type LocaleMessages } from '../i18n/types.js';
5
+ export interface StateNode {
6
+ key: string | number;
7
+ fullKey: string;
8
+ parentFullKey: string | null;
9
+ dataPath: string;
10
+ parentDataPath: string | null;
11
+ skeleton: SkeletonNode;
12
+ layout: BaseCompObject;
13
+ cols: Cols;
14
+ data: unknown;
15
+ error: string | undefined;
16
+ childError: boolean | undefined;
17
+ modified: boolean | undefined;
18
+ childModified: boolean | undefined;
19
+ validated: boolean;
20
+ width: number;
21
+ options: StateNodeOptions;
22
+ titleDepth: number;
23
+ messages: LocaleMessages;
24
+ autofocus?: boolean;
25
+ loading?: boolean;
26
+ autofocusChild?: string | number;
27
+ props?: StateNodePropsLib;
28
+ slots?: Slots;
29
+ itemsCacheKey: any;
30
+ children?: StateNode[];
31
+ }
32
+ export interface StateTree {
33
+ root: StateNode;
34
+ valid: boolean;
35
+ }
36
+ export interface CreateStateTreeContext {
37
+ allErrors?: ErrorObject[];
38
+ errors?: ErrorObject[];
39
+ rehydrateErrors?: ErrorObject[];
40
+ additionalPropertiesErrors?: ErrorObject[];
41
+ files: FileRef[];
42
+ activatedItems: Record<string, number | string>;
43
+ explicitActivatedItems: Set<string>;
44
+ reResolveActivatedItems: boolean;
45
+ autoActivatedItems: Record<string, number | number>;
46
+ autofocusTarget: string | null;
47
+ currentInput: string | null;
48
+ initial: boolean;
49
+ rehydrate: boolean;
50
+ cacheKeys: Record<string, StateNodeCacheKey>;
51
+ rootData: unknown;
52
+ savedData: unknown;
53
+ nodes: StateNode[];
54
+ nodesMap: Map<string, StateNode>;
55
+ getItemsDataRequests: StateNode[];
56
+ }
57
+ export interface FileRef {
58
+ file: File;
59
+ dataPath: string;
60
+ }
61
+ export type StateNodeCacheKey = [
62
+ StateNode | undefined,
63
+ StateNodeOptions,
64
+ CompiledLayout,
65
+ string,
66
+ boolean,
67
+ SkeletonNode,
68
+ Child | null,
69
+ number,
70
+ boolean,
71
+ Record<string, number | string>,
72
+ boolean,
73
+ number,
74
+ unknown,
75
+ number,
76
+ unknown
77
+ ];
78
+ export interface ValidationState {
79
+ initialized: boolean;
80
+ validatedForm: boolean;
81
+ validatedChildren: Set<string>;
82
+ }
83
+ export type StateNodeOptions = Required<StateNodeOptionsBase & {
84
+ context: Record<string, any>;
85
+ messages: LocaleMessages;
86
+ fetchBaseURL: string;
87
+ fetchOptions: Omit<RequestInit, 'body'> | ((url: URL) => Omit<RequestInit, 'body'>);
88
+ fetch: ((url: string, fetchOptions: RequestInit) => any);
89
+ onData: (data: any) => void;
90
+ onUpdate: (statefulLayout: StatefulLayout) => void;
91
+ onAutofocus: (key: string) => void;
92
+ noStateCache: boolean;
93
+ }>;
94
+ export type StatefulLayoutOptions = StateNodeOptions & {
95
+ width: number;
96
+ };
97
+ export type TextFieldNode = Omit<StateNode, 'children'> & {
98
+ layout: TextField;
99
+ data: string | undefined | null;
100
+ };
101
+ export type TextareaNode = Omit<StateNode, 'children'> & {
102
+ layout: Textarea;
103
+ data: string | undefined | null;
104
+ };
105
+ export type NumberFieldNode = Omit<StateNode, 'children'> & {
106
+ layout: NumberField;
107
+ data: number | undefined | null;
108
+ };
109
+ export type SliderNode = Omit<StateNode, 'children'> & {
110
+ layout: Slider;
111
+ data: number | undefined | null;
112
+ };
113
+ export type CheckboxNode = Omit<StateNode, 'children'> & {
114
+ layout: Checkbox;
115
+ data: boolean | undefined | null;
116
+ };
117
+ export type SwitchNode = Omit<StateNode, 'children'> & {
118
+ layout: Switch;
119
+ data: boolean | undefined | null;
120
+ };
121
+ export type DatePickerNode = Omit<StateNode, 'children'> & {
122
+ layout: DatePicker;
123
+ data: string | undefined | null;
124
+ };
125
+ export type DateTimePickerNode = Omit<StateNode, 'children'> & {
126
+ layout: DateTimePicker;
127
+ data: string | undefined | null;
128
+ };
129
+ export type TimePickerNode = Omit<StateNode, 'children'> & {
130
+ layout: TimePicker;
131
+ data: string | undefined | null;
132
+ };
133
+ export type ColorPickerNode = Omit<StateNode, 'children'> & {
134
+ layout: ColorPicker;
135
+ data: string | undefined | null;
136
+ };
137
+ export type SectionNode = StateNode & {
138
+ layout: Section;
139
+ children: StateNode[];
140
+ };
141
+ export type OneOfSelectNode = StateNode & {
142
+ layout: OneOfSelect;
143
+ data: Record<string, unknown>;
144
+ childrenTrees: SkeletonTree[];
145
+ };
146
+ export type SelectNode = Omit<StateNode, 'children'> & {
147
+ layout: Select;
148
+ data: any;
149
+ };
150
+ export type AutocompleteNode = Omit<StateNode, 'children'> & {
151
+ layout: Autocomplete;
152
+ data: any;
153
+ };
154
+ export type RadioGroupNode = Omit<StateNode, 'children'> & {
155
+ layout: Select;
156
+ data: any;
157
+ };
158
+ export type CheckboxGroupNode = Omit<StateNode, 'children'> & {
159
+ layout: Select;
160
+ data: any;
161
+ };
162
+ export type SwitchGroupNode = Omit<StateNode, 'children'> & {
163
+ layout: Select;
164
+ data: any;
165
+ };
166
+ export type TabsNode = StateNode & {
167
+ layout: Tabs;
168
+ children: StateNode[];
169
+ };
170
+ export type VerticalTabsNode = StateNode & {
171
+ layout: VerticalTabs;
172
+ children: StateNode[];
173
+ };
174
+ export type ExpansionPanelsNode = StateNode & {
175
+ layout: ExpansionPanels;
176
+ children: StateNode[];
177
+ };
178
+ export type StepperNode = StateNode & {
179
+ layout: Stepper;
180
+ children: StateNode[];
181
+ };
182
+ export type ListNode = StateNode & {
183
+ layout: List;
184
+ data: any[];
185
+ children: StateNode[];
186
+ childrenTrees: SkeletonTree[];
187
+ };
188
+ export type ComboboxNode = Omit<StateNode, 'children'> & {
189
+ layout: Combobox;
190
+ data: any[];
191
+ };
192
+ export type FileInputNode = Omit<StateNode, 'children'> & {
193
+ layout: FileInput;
194
+ data: object | undefined | null;
195
+ };
196
+ export type CardNode = StateNode & {
197
+ layout: Card;
198
+ children: StateNode[];
199
+ };
200
+ //# sourceMappingURL=types.d.ts.map