@json-layout/core 1.10.10 → 1.11.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-layout/core",
3
- "version": "1.10.10",
3
+ "version": "1.11.0",
4
4
  "description": "Compilation and state management utilities for JSON Layout.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -76,7 +76,7 @@
76
76
  },
77
77
  "homepage": "https://github.com/json-layout/json-layout#readme",
78
78
  "peerDependencies": {
79
- "@json-layout/vocabulary": "^2.3.1"
79
+ "@json-layout/vocabulary": "^2.4.0"
80
80
  },
81
81
  "dependencies": {
82
82
  "ajv": "^8.17.1",
@@ -286,6 +286,9 @@ export function makeSkeletonNode (
286
286
  }
287
287
  }
288
288
  if (schema.oneOf) {
289
+ /** @type {string | undefined} */
290
+ let discriminator
291
+ if (schema.discriminator?.propertyName) discriminator = schema.discriminator?.propertyName
289
292
  const oneOfPointer = `${refPointer}/oneOf`
290
293
  if (!normalizedLayouts[oneOfPointer]) {
291
294
  const normalizationResult = normalizeLayoutFragment(
@@ -323,7 +326,8 @@ export function makeSkeletonNode (
323
326
  expressions,
324
327
  childTreePointer,
325
328
  `option ${i + 1}`,
326
- true
329
+ true,
330
+ discriminator
327
331
  )
328
332
  }
329
333
  childrenTrees.push(childTreePointer)
@@ -334,7 +338,8 @@ export function makeSkeletonNode (
334
338
  pointer: oneOfPointer,
335
339
  refPointer: oneOfPointer,
336
340
  childrenTrees,
337
- pure: !childrenTrees.some(childTree => !skeletonNodes[skeletonTrees[childTree]?.root].pure),
341
+ discriminator,
342
+ pure: !childrenTrees.some(childTree => !skeletonNodes[skeletonTrees[childTree]?.root]?.pure),
338
343
  propertyKeys: [],
339
344
  roPropertyKeys: []
340
345
  }
@@ -397,7 +402,7 @@ export function makeSkeletonNode (
397
402
  pointer: patternPropertiesPointer,
398
403
  refPointer: patternPropertiesPointer,
399
404
  childrenTrees,
400
- pure: !childrenTrees.some(childTree => !skeletonNodes[skeletonTrees[childTree]?.root].pure),
405
+ pure: !childrenTrees.some(childTree => !skeletonNodes[skeletonTrees[childTree]?.root]?.pure),
401
406
  propertyKeys: [],
402
407
  roPropertyKeys: []
403
408
  }
@@ -17,6 +17,7 @@ import { makeSkeletonNode } from './skeleton-node.js'
17
17
  * @param {string} pointer
18
18
  * @param {string} [defaultTitle]
19
19
  * @param {boolean} [deleteRootNodeTitle]
20
+ * @param {string} [discriminator]
20
21
  * @returns {import('./types.js').SkeletonTree}
21
22
  */
22
23
  export function makeSkeletonTree (
@@ -32,7 +33,8 @@ export function makeSkeletonTree (
32
33
  expressions,
33
34
  pointer,
34
35
  defaultTitle,
35
- deleteRootNodeTitle
36
+ deleteRootNodeTitle,
37
+ discriminator
36
38
  ) {
37
39
  /** @type {string | undefined} */
38
40
  let rootNodeTitle
@@ -58,5 +60,15 @@ export function makeSkeletonTree (
58
60
  if (deleteRootNodeTitle) delete skeletonNodes[pointer].title
59
61
  validatePointers.push(skeletonNodes[pointer].refPointer)
60
62
  }
61
- return { title: rootNodeTitle ?? defaultTitle ?? '', root: pointer, refPointer: skeletonNodes[pointer].refPointer }
63
+ let discriminatorValue
64
+ if (discriminator) {
65
+ if (schema.$ref) {
66
+ const [refFragment] = getJSONRef(schemaId, schema.$ref)
67
+ discriminatorValue = refFragment.properties?.[discriminator]?.const
68
+ } else {
69
+ discriminatorValue = schema.properties?.[discriminator]?.const
70
+ }
71
+ if (discriminatorValue === undefined) throw new Error(`const discriminator ${discriminator} missing in oneOf item ${pointer}`)
72
+ }
73
+ return { title: rootNodeTitle ?? defaultTitle ?? '', root: pointer, refPointer: skeletonNodes[pointer].refPointer, discriminatorValue }
62
74
  }
@@ -62,6 +62,7 @@ export interface SkeletonTree {
62
62
  title: string
63
63
  root: string
64
64
  refPointer: string
65
+ discriminatorValue?: string
65
66
  }
66
67
 
67
68
  // a skeleton node is a light recursive structure
@@ -77,6 +78,7 @@ export interface SkeletonNode {
77
78
  condition?: Expression
78
79
  children?: string[] // optional children in the case of arrays and object nodes
79
80
  childrenTrees?: string[] // other trees that can be instantiated with separate validation (for example in the case of new array items of oneOfs, etc)
81
+ discriminator?: string
80
82
  required?: boolean
81
83
  nullable?: boolean
82
84
  }
@@ -187,7 +187,7 @@ const produceCompositeChildrenOptions = produce((draft, section) => {
187
187
  * @param {string | null} parentDataPath
188
188
  * @returns {boolean}
189
189
  */
190
- const matchError = (error, skeleton, dataPath, parentDataPath) => {
190
+ const matchLocalError = (error, skeleton, dataPath, parentDataPath) => {
191
191
  const originalError = error.params?.errors?.[0] ?? error
192
192
  if (parentDataPath === originalError.instancePath && originalError.params?.missingProperty === skeleton.key) {
193
193
  return true
@@ -204,22 +204,51 @@ const matchError = (error, skeleton, dataPath, parentDataPath) => {
204
204
 
205
205
  /**
206
206
  * should match if an error belongs to a child of the current node but the child was not displayed
207
+ * @param {import('../index.js').CompiledLayout} compiledLayout
207
208
  * @param {import('ajv').ErrorObject} error
208
209
  * @param {import('../index.js').SkeletonNode} skeleton
209
210
  * @param {string} dataPath
210
211
  * @param {string | null} parentDataPath
211
212
  * @returns {boolean}
212
213
  */
213
- const matchChildError = (error, skeleton, dataPath, parentDataPath) => {
214
+ const matchChildError = (compiledLayout, error, skeleton, dataPath, parentDataPath) => {
214
215
  const originalError = error.params?.errors?.[0] ?? error
215
- if (!(
216
- originalError.schemaPath === skeleton.pointer ||
217
- originalError.schemaPath.startsWith(skeleton.pointer + '/')
218
- ) && !(
219
- originalError.schemaPath === skeleton.refPointer ||
220
- originalError.schemaPath.startsWith(skeleton.refPointer + '/')
221
- )) return false
222
- if (originalError.instancePath.startsWith(dataPath)) return true
216
+ if (!originalError.instancePath.startsWith(dataPath)) return false
217
+ if (originalError.schemaPath === skeleton.pointer || originalError.schemaPath.startsWith(skeleton.pointer + '/') || originalError.schemaPath === skeleton.refPointer || originalError.schemaPath.startsWith(skeleton.refPointer + '/')) return true
218
+ if (skeleton.children) {
219
+ for (const c of skeleton.children) {
220
+ const childSkeleton = compiledLayout.skeletonNodes[c]
221
+ if (!childSkeleton) continue
222
+ if (matchPointerError(error, childSkeleton.pointer, childSkeleton.refPointer, dataPath, parentDataPath)) return true
223
+ }
224
+ }
225
+ if (skeleton.childrenTrees) {
226
+ for (const c of skeleton.childrenTrees) {
227
+ const childTree = compiledLayout.skeletonTrees[c]
228
+ if (!childTree) continue
229
+ if (matchPointerError(error, childTree.root, childTree.refPointer, dataPath, parentDataPath)) return true
230
+ }
231
+ }
232
+ return false
233
+ }
234
+
235
+ /**
236
+ * should match if an error belongs to a child of the current node but the child was not displayed
237
+ * @param {import('ajv').ErrorObject} error
238
+ * @param {string} pointer1
239
+ * @param {string} pointer2
240
+ * @param {string} dataPath
241
+ * @param {string | null} parentDataPath
242
+ * @returns {boolean}
243
+ */
244
+ const matchPointerError = (error, pointer1, pointer2, dataPath, parentDataPath) => {
245
+ const originalError = error.params?.errors?.[0] ?? error
246
+ if (!originalError.instancePath.startsWith(dataPath)) return false
247
+ if (originalError.schemaPath === pointer1 ||
248
+ originalError.schemaPath.startsWith(pointer2 + '/') ||
249
+ originalError.schemaPath === pointer2 ||
250
+ originalError.schemaPath.startsWith(pointer2 + '/')
251
+ ) return true
223
252
  return false
224
253
  }
225
254
 
@@ -301,7 +330,7 @@ const getCompObject = (normalizedLayout, childDefinition, options, compiledLayou
301
330
  * @param {import('../index.js').SkeletonNode} skeleton
302
331
  * @param {import('@json-layout/vocabulary').Child | null} childDefinition
303
332
  * @param {import('./utils/display.js').Display} parentDisplay
304
- * @param {unknown} data
333
+ * @param {any} data
305
334
  * @param {import('../compile/types.js').ParentContextExpression | null} parentContext
306
335
  * @param {import('./types.js').ValidationState} validationState
307
336
  * @param {import('./types.js').StateNode} [reusedNode]
@@ -441,33 +470,46 @@ export function createStateNode (
441
470
  }
442
471
 
443
472
  if (key === '$oneOf' && skeleton.childrenTrees) {
444
- // find the oneOf child that was either previously selected, if none were selected select the child that is valid with current data
445
- const validChildTreeIndex = skeleton.childrenTrees?.findIndex((childTree) => compiledLayout.validates[compiledLayout.skeletonTrees[childTree].refPointer](data))
446
- const activeChildTreeIndex = /** @type {number} */(fullKey in context.activatedItems ? context.activatedItems[fullKey] : validChildTreeIndex)
473
+ // find the oneOf child that was either previously selected
474
+ // or the one matching the specified discriminator
475
+ // or the one that is valid with current data
476
+ let activeChildTreeIndex = /** @type {number} */context.activatedItems[fullKey]
477
+ if (activeChildTreeIndex === undefined) {
478
+ if (skeleton.discriminator !== undefined) {
479
+ activeChildTreeIndex = skeleton.childrenTrees?.findIndex((childTree) => skeleton.discriminator !== undefined && data?.[skeleton.discriminator] !== undefined && data[skeleton.discriminator] === compiledLayout.skeletonTrees[childTree].discriminatorValue)
480
+ } else {
481
+ activeChildTreeIndex = skeleton.childrenTrees?.findIndex((childTree) => compiledLayout.validates[compiledLayout.skeletonTrees[childTree].refPointer](data))
482
+ }
483
+ }
484
+
447
485
  if (activeChildTreeIndex !== -1) {
486
+ const activeChildTree = compiledLayout.skeletonTrees[skeleton.childrenTrees[activeChildTreeIndex]]
487
+ const activeChildNode = compiledLayout.skeletonNodes[activeChildTree.root]
448
488
  if (!(fullKey in context.activatedItems)) context.autoActivatedItems[fullKey] = activeChildTreeIndex
449
489
  context.errors = context.errors?.filter(error => {
450
- const originalError = error.params?.errors?.[0] ?? error
451
490
  // if an item was selected, remove the oneOf error
452
- if (matchError(error, skeleton, dataPath, parentDataPath)) return false
491
+ if (matchLocalError(error, skeleton, dataPath, parentDataPath)) {
492
+ return false
493
+ }
453
494
  // also remove the errors from other children of the oneOf
454
- if (matchChildError(error, skeleton, dataPath, parentDataPath)) {
455
- if (originalError.schemaPath.startsWith(skeleton.pointer) && !originalError.schemaPath.startsWith(skeleton.pointer + '/' + activeChildTreeIndex)) return false
456
- if (originalError.schemaPath.startsWith(skeleton.refPointer) && !originalError.schemaPath.startsWith(skeleton.refPointer + '/' + activeChildTreeIndex)) return false
495
+ if (matchChildError(compiledLayout, error, skeleton, dataPath, parentDataPath) && !matchPointerError(error, activeChildNode.pointer, activeChildNode.refPointer, dataPath, parentDataPath)) {
496
+ return false
457
497
  }
458
498
  return true
459
499
  })
460
- if (context.additionalPropertiesErrors && validChildTreeIndex === -1) {
500
+ if (context.additionalPropertiesErrors) {
461
501
  // remove additional properties errors if the oneOf has no valid children
462
502
  context.additionalPropertiesErrors = context.additionalPropertiesErrors?.filter(error => {
463
- const originalError = error.params?.errors?.[0] ?? error
464
- if (originalError.instancePath === parentDataPath) return false
503
+ // also remove the additional errors from other children of the oneOf
504
+ if (matchChildError(compiledLayout, error, skeleton, dataPath, parentDataPath) && !matchPointerError(error, activeChildNode.pointer, activeChildNode.refPointer, dataPath, parentDataPath)) {
505
+ return false
506
+ }
465
507
  return true
466
508
  })
467
509
  }
468
510
  const activeChildKey = `${fullKey}/${activeChildTreeIndex}`
469
511
  if (context.autofocusTarget === fullKey) context.autofocusTarget = activeChildKey
470
- const activeChildTree = compiledLayout.skeletonTrees[skeleton.childrenTrees[activeChildTreeIndex]]
512
+
471
513
  children = [
472
514
  createStateNode(
473
515
  context,
@@ -478,7 +520,7 @@ export function createStateNode (
478
520
  fullKey,
479
521
  dataPath,
480
522
  dataPath,
481
- compiledLayout.skeletonNodes[activeChildTree.root],
523
+ activeChildNode,
482
524
  null,
483
525
  display,
484
526
  data,
@@ -569,14 +611,14 @@ export function createStateNode (
569
611
  }
570
612
  }
571
613
 
572
- let error = context.errors?.find(e => matchError(e, skeleton, dataPath, parentDataPath))
614
+ let error = context.errors?.find(e => matchLocalError(e, skeleton, dataPath, parentDataPath))
573
615
 
574
616
  // findLast in following lines is important because we want to keep the error of the highest child (deepest errors are listed first)
575
617
  if (!error && !isCompositeLayout(layout, compiledLayout.components) && layout.comp !== 'slot') {
576
- error = context.errors?.findLast(e => matchChildError(e, skeleton, dataPath, parentDataPath))
618
+ error = context.errors?.findLast(e => matchChildError(compiledLayout, e, skeleton, dataPath, parentDataPath))
577
619
  }
578
620
  if (!error && context.rehydrate && context.rehydrateErrors) {
579
- error = context.rehydrateErrors?.findLast(e => matchChildError(e, skeleton, dataPath, parentDataPath))
621
+ error = context.rehydrateErrors?.findLast(e => matchChildError(compiledLayout, e, skeleton, dataPath, parentDataPath))
580
622
  }
581
623
 
582
624
  // capture errors so that they are not repeated in parent nodes
@@ -585,10 +627,10 @@ export function createStateNode (
585
627
  logValidation(`${fullKey} capture validation error on node`, error)
586
628
  context.errors = context.errors?.filter(e => error !== e)
587
629
  if (!isCompositeLayout(layout, compiledLayout.components) && layout.comp !== 'slot') {
588
- context.errors = context.errors?.filter(e => !matchChildError(e, skeleton, dataPath, parentDataPath))
630
+ context.errors = context.errors?.filter(e => !matchChildError(compiledLayout, e, skeleton, dataPath, parentDataPath))
589
631
  }
590
632
  if (context.rehydrate && context.rehydrateErrors) {
591
- context.rehydrateErrors = context.rehydrateErrors?.filter(e => !matchChildError(e, skeleton, dataPath, parentDataPath))
633
+ context.rehydrateErrors = context.rehydrateErrors?.filter(e => !matchChildError(compiledLayout, e, skeleton, dataPath, parentDataPath))
592
634
  }
593
635
  }
594
636
  }
@@ -1 +1 @@
1
- {"version":3,"file":"skeleton-node.d.ts","sourceRoot":"","sources":["../../src/compile/skeleton-node.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;GAkBG;AACH,4CAlBW,GAAG,kBACH,MAAM,WACN,OAAO,YAAY,EAAE,cAAc,cACnC,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,iBACxD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,iBACjD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,oBACjD,MAAM,EAAE,oBACR,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,qBACxB,MAAM,CAAC,MAAM,EAAE,OAAO,yBAAyB,EAAE,gBAAgB,CAAC,eAClE,OAAO,yBAAyB,EAAE,UAAU,EAAE,OAC9C,MAAM,GAAG,MAAM,WACf,MAAM,YACN,OAAO,cACP,MAAM,cACN,OAAO,cACP,MAAM,GACJ,OAAO,YAAY,EAAE,YAAY,CAygB7C"}
1
+ {"version":3,"file":"skeleton-node.d.ts","sourceRoot":"","sources":["../../src/compile/skeleton-node.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;GAkBG;AACH,4CAlBW,GAAG,kBACH,MAAM,WACN,OAAO,YAAY,EAAE,cAAc,cACnC,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,iBACxD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,iBACjD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,oBACjD,MAAM,EAAE,oBACR,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,qBACxB,MAAM,CAAC,MAAM,EAAE,OAAO,yBAAyB,EAAE,gBAAgB,CAAC,eAClE,OAAO,yBAAyB,EAAE,UAAU,EAAE,OAC9C,MAAM,GAAG,MAAM,WACf,MAAM,YACN,OAAO,cACP,MAAM,cACN,OAAO,cACP,MAAM,GACJ,OAAO,YAAY,EAAE,YAAY,CA8gB7C"}
@@ -12,7 +12,8 @@
12
12
  * @param {string} pointer
13
13
  * @param {string} [defaultTitle]
14
14
  * @param {boolean} [deleteRootNodeTitle]
15
+ * @param {string} [discriminator]
15
16
  * @returns {import('./types.js').SkeletonTree}
16
17
  */
17
- export function makeSkeletonTree(schema: any, schemaId: string, options: import("./index.js").CompileOptions, getJSONRef: (schemaId: string, ref: string) => [any, string, string], skeletonTrees: Record<string, import("./types.js").SkeletonTree>, skeletonNodes: Record<string, import("./types.js").SkeletonNode>, validatePointers: string[], validationErrors: Record<string, string[]>, normalizedLayouts: Record<string, import("@json-layout/vocabulary").NormalizedLayout>, expressions: import("@json-layout/vocabulary").Expression[], pointer: string, defaultTitle?: string, deleteRootNodeTitle?: boolean): import("./types.js").SkeletonTree;
18
+ export function makeSkeletonTree(schema: any, schemaId: string, options: import("./index.js").CompileOptions, getJSONRef: (schemaId: string, ref: string) => [any, string, string], skeletonTrees: Record<string, import("./types.js").SkeletonTree>, skeletonNodes: Record<string, import("./types.js").SkeletonNode>, validatePointers: string[], validationErrors: Record<string, string[]>, normalizedLayouts: Record<string, import("@json-layout/vocabulary").NormalizedLayout>, expressions: import("@json-layout/vocabulary").Expression[], pointer: string, defaultTitle?: string, deleteRootNodeTitle?: boolean, discriminator?: string): import("./types.js").SkeletonTree;
18
19
  //# sourceMappingURL=skeleton-tree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skeleton-tree.d.ts","sourceRoot":"","sources":["../../src/compile/skeleton-tree.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH,yCAfW,GAAG,YACH,MAAM,WACN,OAAO,YAAY,EAAE,cAAc,cACnC,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,iBACxD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,iBACjD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,oBACjD,MAAM,EAAE,oBACR,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,qBACxB,MAAM,CAAC,MAAM,EAAE,OAAO,yBAAyB,EAAE,gBAAgB,CAAC,eAClE,OAAO,yBAAyB,EAAE,UAAU,EAAE,WAC9C,MAAM,iBACN,MAAM,wBACN,OAAO,GACL,OAAO,YAAY,EAAE,YAAY,CA0C7C"}
1
+ {"version":3,"file":"skeleton-tree.d.ts","sourceRoot":"","sources":["../../src/compile/skeleton-tree.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;GAgBG;AACH,yCAhBW,GAAG,YACH,MAAM,WACN,OAAO,YAAY,EAAE,cAAc,cACnC,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,iBACxD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,iBACjD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,oBACjD,MAAM,EAAE,oBACR,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,qBACxB,MAAM,CAAC,MAAM,EAAE,OAAO,yBAAyB,EAAE,gBAAgB,CAAC,eAClE,OAAO,yBAAyB,EAAE,UAAU,EAAE,WAC9C,MAAM,iBACN,MAAM,wBACN,OAAO,kBACP,MAAM,GACJ,OAAO,YAAY,EAAE,YAAY,CAqD7C"}
@@ -42,6 +42,7 @@ export interface SkeletonTree {
42
42
  title: string;
43
43
  root: string;
44
44
  refPointer: string;
45
+ discriminatorValue?: string;
45
46
  }
46
47
  export interface SkeletonNode {
47
48
  title?: string;
@@ -54,6 +55,7 @@ export interface SkeletonNode {
54
55
  condition?: Expression;
55
56
  children?: string[];
56
57
  childrenTrees?: string[];
58
+ discriminator?: string;
57
59
  required?: boolean;
58
60
  nullable?: boolean;
59
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compile/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC3K,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAoB,M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E,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAID,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
@@ -24,13 +24,13 @@ export function evalExpression(expressions: import("../index.js").CompiledExpres
24
24
  * @param {import('../index.js').SkeletonNode} skeleton
25
25
  * @param {import('@json-layout/vocabulary').Child | null} childDefinition
26
26
  * @param {import('./utils/display.js').Display} parentDisplay
27
- * @param {unknown} data
27
+ * @param {any} data
28
28
  * @param {import('../compile/types.js').ParentContextExpression | null} parentContext
29
29
  * @param {import('./types.js').ValidationState} validationState
30
30
  * @param {import('./types.js').StateNode} [reusedNode]
31
31
  * @returns {import('./types.js').StateNode}
32
32
  */
33
- 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: unknown, parentContext: import("../compile/types.js").ParentContextExpression | null, validationState: import("./types.js").ValidationState, reusedNode?: import("./types.js").StateNode): import("./types.js").StateNode;
33
+ 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, reusedNode?: import("./types.js").StateNode): import("./types.js").StateNode;
34
34
  export function useDefaultData(data: unknown, layout: import("@json-layout/vocabulary").BaseCompObject, options: import("./types.js").StateNodeOptions): boolean;
35
35
  /** @type {(draft: any, node: import('./types.js').StateNode, data: unknown) => any} */
36
36
  export const producePatchedData: (draft: any, node: import("./types.js").StateNode, data: unknown) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"state-node.d.ts","sourceRoot":"","sources":["../../src/state/state-node.js"],"names":[],"mappings":"AAiOA;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;GAkBG;AACH,yCAjBW,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,y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