@json-layout/core 0.4.0 → 0.6.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": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Compilation and state management utilities for JSON Layout.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "homepage": "https://github.com/json-layout/json-layout#readme",
49
49
  "dependencies": {
50
- "@json-layout/vocabulary": "^0.4.0",
50
+ "@json-layout/vocabulary": "^0.6.0",
51
51
  "@types/markdown-it": "^13.0.1",
52
52
  "ajv": "^8.12.0",
53
53
  "ajv-errors": "^3.0.0",
@@ -27,8 +27,6 @@ const Ajv = /** @type {typeof ajvModule.default} */ (ajvModule)
27
27
  // @ts-ignore
28
28
  const ajvLocalize = /** @type {typeof ajvLocalizeModule.default} */ (ajvLocalizeModule)
29
29
 
30
- const expressionsParams = ['data', 'options', 'context', 'display']
31
-
32
30
  // const exprEvalParser = new ExprEvalParser()
33
31
 
34
32
  /**
@@ -114,6 +112,9 @@ export function compile (_schema, partialOptions = {}) {
114
112
  const expressions = []
115
113
 
116
114
  for (const expression of expressionsDefinitions) {
115
+ const expressionsParams = expression.pure
116
+ ? ['data', 'options', 'context', 'display']
117
+ : ['data', 'options', 'context', 'display', 'parentData', 'rootData']
117
118
  /* if (expression.type === 'expr-eval') {
118
119
  expressions.push(exprEvalParser.parse(expression.expr).toJSFunction(expressionsParams.join(',')))
119
120
  } */
@@ -2,20 +2,6 @@
2
2
  import { normalizeLayoutFragment, isSwitchStruct, isGetItemsExpression, isGetItemsFetch, isItemsLayout } from '@json-layout/vocabulary'
3
3
  import { makeSkeletonTree } from './skeleton-tree.js'
4
4
 
5
- /**
6
- * @param {import('@json-layout/vocabulary').Expression[]} expressions
7
- * @param {import('@json-layout/vocabulary').Expression} expression
8
- */
9
- const pushExpression = (expressions, expression) => {
10
- const index = expressions.findIndex(e => e.type === expression.type && e.expr === expression.expr)
11
- if (index !== -1) {
12
- expression.ref = index
13
- } else {
14
- expression.ref = expressions.length
15
- expressions.push(expression)
16
- }
17
- }
18
-
19
5
  /**
20
6
  * @param {any} schema
21
7
  * @param {import('./index.js').CompileOptions} options
@@ -62,17 +48,35 @@ export function makeSkeletonNode (
62
48
  if (schema.type === 'array') defaultData = []
63
49
  }
64
50
 
51
+ let pure = true
52
+ /**
53
+ * @param {import('@json-layout/vocabulary').Expression[]} expressions
54
+ * @param {import('@json-layout/vocabulary').Expression} expression
55
+ */
56
+ const pushExpression = (expressions, expression) => {
57
+ if (!expression.pure) pure = false
58
+ const index = expressions.findIndex(e => e.type === expression.type && e.expr === expression.expr)
59
+ if (index !== -1) {
60
+ expression.ref = index
61
+ } else {
62
+ expression.ref = expressions.length
63
+ expressions.push(expression)
64
+ }
65
+ }
66
+
65
67
  const compObjects = isSwitchStruct(normalizedLayout) ? normalizedLayout.switch : [normalizedLayout]
66
68
  for (const compObject of compObjects) {
67
69
  if (schema.description && !compObject.help) compObject.help = schema.description
68
70
  if (compObject.if) pushExpression(expressions, compObject.if)
69
71
 
70
- if ('const' in schema) compObject.constData = { type: 'js-eval', expr: JSON.stringify(schema.const) }
72
+ if ('const' in schema) compObject.constData = { type: 'js-eval', expr: JSON.stringify(schema.const), pure: true }
71
73
  if (compObject.constData) pushExpression(expressions, compObject.constData)
72
74
 
73
- if (defaultData && !compObject.defaultData) compObject.defaultData = { type: 'js-eval', expr: JSON.stringify(defaultData) }
75
+ if (defaultData && !compObject.defaultData) compObject.defaultData = { type: 'js-eval', expr: JSON.stringify(defaultData), pure: true }
74
76
  if (compObject.defaultData) pushExpression(expressions, compObject.defaultData)
75
77
 
78
+ if (compObject.transformData) pushExpression(expressions, compObject.transformData)
79
+
76
80
  if (isItemsLayout(compObject) && compObject.getItems) {
77
81
  if (isGetItemsExpression(compObject.getItems)) pushExpression(expressions, compObject.getItems)
78
82
  if (isGetItemsFetch(compObject.getItems)) pushExpression(expressions, compObject.getItems.url)
@@ -85,7 +89,7 @@ export function makeSkeletonNode (
85
89
  }
86
90
 
87
91
  /** @type {import('./types.js').SkeletonNode} */
88
- const node = { key: key ?? '', pointer, parentPointer }
92
+ const node = { key: key ?? '', pointer, parentPointer, pure }
89
93
  if (schema.type === 'object') {
90
94
  if (schema.properties) {
91
95
  node.children = node.children ?? []
@@ -152,7 +156,7 @@ export function makeSkeletonNode (
152
156
  ))
153
157
  }
154
158
  node.children = node.children ?? []
155
- node.children.push({ key: '$oneOf', pointer: `${pointer}/oneOf`, parentPointer: pointer, childrenTrees })
159
+ node.children.push({ key: '$oneOf', pointer: `${pointer}/oneOf`, parentPointer: pointer, childrenTrees, pure: childrenTrees[0].root.pure })
156
160
 
157
161
  schema.errorMessage.oneOf = options.messages.errorOneOf
158
162
  }
@@ -189,5 +193,9 @@ export function makeSkeletonNode (
189
193
  ]
190
194
  }
191
195
  }
196
+
197
+ for (const child of node.children || []) if (!child.pure) node.pure = false
198
+ for (const childTree of node.childrenTrees || []) if (!childTree.root.pure) node.pure = false
199
+
192
200
  return node
193
201
  }
@@ -1,11 +1,11 @@
1
1
  import type ajvModule from 'ajv'
2
2
  import type MarkdownIt from 'markdown-it'
3
- import { type NormalizedLayout, type StateNodeOptions } from '@json-layout/vocabulary'
3
+ import { type NormalizedLayout, type StateNodeOptionsBase } from '@json-layout/vocabulary'
4
4
  import { type ValidateFunction, type SchemaObject, type ErrorObject } from 'ajv'
5
5
  import { type Display } from '../state/utils/display.js'
6
6
  import { type LocaleMessages } from '../i18n/types.js'
7
7
 
8
- export type CompiledExpression = (data: any, options: StateNodeOptions, context: object, display: Display) => any
8
+ export type CompiledExpression = (data: any, options: StateNodeOptionsBase, context: object, display: Display, rootData?: unknown, parentData?: unknown) => any
9
9
 
10
10
  export interface CompileOptions {
11
11
  ajv: ajvModule.default
@@ -44,6 +44,7 @@ export interface SkeletonNode {
44
44
  key: string | number
45
45
  pointer: string
46
46
  parentPointer: string | null
47
+ pure: boolean
47
48
  children?: SkeletonNode[] // optional children in the case of arrays and object nodes
48
49
  childrenTrees?: SkeletonTree[] // other trees that can be instantiated with separate validation (for example in the case of new array items of oneOfs, etc)
49
50
  }
@@ -1,10 +1,12 @@
1
1
  // eslint-disable-next-line import/no-named-default
2
2
  import mittModule from 'mitt'
3
3
  import debug from 'debug'
4
+ import { produce } from 'immer'
4
5
  import { evalExpression, producePatchedData } from './state-node.js'
5
6
  import { createStateTree } from './state-tree.js'
6
7
  import { Display } from './utils/display.js'
7
- import { isGetItemsExpression, isGetItemsFetch, isItemsLayout } from '@json-layout/vocabulary'
8
+ import { isFileLayout, isGetItemsExpression, isGetItemsFetch, isItemsLayout } from '@json-layout/vocabulary'
9
+ import { shallowProduceArray } from './utils/immutable.js'
8
10
 
9
11
  export { Display } from './utils/display.js'
10
12
 
@@ -34,6 +36,7 @@ export { Display } from './utils/display.js'
34
36
  * @typedef {import('./types.js').StepperNode} StepperNode
35
37
  * @typedef {import('./types.js').OneOfSelectNode} OneOfSelectNode
36
38
  * @typedef {import('./types.js').ListNode} ListNode
39
+ * @typedef {import('./types.js').FileRef} FileRef
37
40
  */
38
41
 
39
42
  /** @type {(node: StateNode | undefined) => node is SectionNode} */
@@ -182,6 +185,11 @@ export class StatefulLayout {
182
185
  */
183
186
  _previousAutofocusTarget
184
187
 
188
+ /**
189
+ * @type {FileRef[]}
190
+ */
191
+ files = []
192
+
185
193
  /**
186
194
  * @param {import("../index.js").CompiledLayout} compiledLayout
187
195
  * @param {import("../index.js").SkeletonTree} skeletonTree
@@ -246,10 +254,13 @@ export class StatefulLayout {
246
254
  createStateTree () {
247
255
  /** @type {CreateStateTreeContext} */
248
256
  const createStateTreeContext = {
249
- nodes: [],
250
257
  activeItems: this.activeItems,
251
258
  autofocusTarget: this._autofocusTarget,
252
- initial: !this._lastCreateStateTreeContext
259
+ initial: !this._lastCreateStateTreeContext,
260
+ cacheKeys: this._lastCreateStateTreeContext?.cacheKeys ?? {},
261
+ rootData: this._data,
262
+ files: [],
263
+ nodes: []
253
264
  }
254
265
  this._stateTree = createStateTree(
255
266
  createStateTreeContext,
@@ -269,6 +280,8 @@ export class StatefulLayout {
269
280
  validatedChildren: createStateTreeContext.nodes.filter(n => n.validated).map(n => n.fullKey)
270
281
  }
271
282
  }
283
+ this.activeItems = createStateTreeContext.activeItems
284
+ this.files = shallowProduceArray(this.files, createStateTreeContext.files)
272
285
  }
273
286
 
274
287
  validate () {
@@ -301,6 +314,20 @@ export class StatefulLayout {
301
314
  return this._lastCreateStateTreeContext.nodes.findIndex(node => node.error && !node.validated) !== -1
302
315
  }
303
316
 
317
+ /**
318
+ * @private
319
+ * @param {StateNode} node
320
+ * @param {import('@json-layout/vocabulary').Expression} expression
321
+ * @param {any} data
322
+ * @returns {any}
323
+ */
324
+ evalNodeExpression = (node, expression, data) => {
325
+ // const parentNode = this._stateTree.traverseNode(this._stateTree.root).find(n => n.fullKey === node.parentFullKey)
326
+ const parentNode = this._lastCreateStateTreeContext.nodes.find(n => n.fullKey === node.parentFullKey)
327
+ const parentData = parentNode ? parentNode.data : null
328
+ return evalExpression(this.compiledLayout.expressions, expression, data, node.options, new Display(node.width), parentData, this._data)
329
+ }
330
+
304
331
  /**
305
332
  * @param {StateNode} node
306
333
  * @param {unknown} data
@@ -308,11 +335,33 @@ export class StatefulLayout {
308
335
  */
309
336
  input (node, data, activateKey) {
310
337
  logDataBinding('received input event from node', node, data)
338
+
339
+ const transformedData = node.layout.transformData && this.evalNodeExpression(node, node.layout.transformData, data)
340
+
341
+ if (isFileLayout(node.layout)) {
342
+ if (transformedData) {
343
+ // @ts-ignore
344
+ data.toJSON = () => transformedData
345
+ } else if (data instanceof File) {
346
+ const fileJSON = { name: data.name, size: data.size, type: data.type }
347
+ // @ts-ignore
348
+ data.toJSON = () => fileJSON
349
+ } else if (Array.isArray(data)) {
350
+ for (const file of data) {
351
+ const fileJSON = { name: file.name, size: file.size, type: file.type }
352
+ // @ts-ignore
353
+ file.toJSON = () => fileJSON
354
+ }
355
+ }
356
+ } else if (transformedData) {
357
+ data = transformedData
358
+ }
359
+
311
360
  if (node.options.validateOn === 'input' && !this.validationState.validatedChildren.includes(node.fullKey)) {
312
361
  this.validationState = { validatedChildren: this.validationState.validatedChildren.concat([node.fullKey]) }
313
362
  }
314
363
  if (activateKey !== undefined) {
315
- this.activeItems[node.fullKey] = activateKey
364
+ this.activeItems = produce(this.activeItems, draft => { draft[node.fullKey] = activateKey })
316
365
  this._autofocusTarget = node.fullKey + '/' + activateKey
317
366
  }
318
367
  if (node.parentFullKey === null) {
@@ -366,19 +415,14 @@ export class StatefulLayout {
366
415
 
367
416
  if (node.layout.items) return [node.layout.items, false]
368
417
 
369
- /** @type {(expression: import('@json-layout/vocabulary').Expression, data: any) => any} */
370
- const evalSelectExpression = (expression, data) => {
371
- return evalExpression(this.compiledLayout.expressions, expression, data, node.options, new Display(node.options.width))
372
- }
373
-
374
418
  let rawItems
375
419
  let appliedQ = false
376
420
  if (node.layout.getItems && isGetItemsExpression(node.layout.getItems)) {
377
- rawItems = evalSelectExpression(node.layout.getItems, null)
421
+ rawItems = this.evalNodeExpression(node, node.layout.getItems, null)
378
422
  if (!Array.isArray(rawItems)) throw new Error('getItems expression didn\'t return an array')
379
423
  }
380
424
  if (node.layout.getItems && isGetItemsFetch(node.layout.getItems)) {
381
- const url = new URL(evalSelectExpression(node.layout.getItems.url, null))
425
+ const url = new URL(this.evalNodeExpression(node, node.layout.getItems.url, null))
382
426
  let qSearchParam = node.layout.getItems.qSearchParam
383
427
  if (!qSearchParam) {
384
428
  for (const searchParam of url.searchParams.entries()) {
@@ -395,26 +439,26 @@ export class StatefulLayout {
395
439
 
396
440
  if (rawItems) {
397
441
  if (node.layout.getItems?.itemsResults) {
398
- rawItems = evalSelectExpression(node.layout.getItems.itemsResults, rawItems)
442
+ rawItems = this.evalNodeExpression(node, node.layout.getItems.itemsResults, rawItems)
399
443
  }
400
444
  /** @type {import('@json-layout/vocabulary').SelectItems} */
401
445
  const items = rawItems.map((/** @type {any} */ rawItem) => {
402
446
  /** @type {Partial<import('@json-layout/vocabulary').SelectItem>} */
403
447
  const item = {}
404
448
  if (typeof rawItem === 'object') {
405
- item.value = node.layout.getItems?.itemValue ? evalSelectExpression(node.layout.getItems.itemValue, rawItem) : (node.layout.getItems?.returnObjects ? rawItem : rawItem.value)
406
- item.key = node.layout.getItems?.itemKey ? evalSelectExpression(node.layout.getItems.itemKey, rawItem) : rawItem.key
407
- item.title = node.layout.getItems?.itemTitle ? evalSelectExpression(node.layout.getItems.itemTitle, rawItem) : rawItem.title
449
+ item.value = node.layout.getItems?.itemValue ? this.evalNodeExpression(node, node.layout.getItems.itemValue, rawItem) : (node.layout.getItems?.returnObjects ? rawItem : rawItem.value)
450
+ item.key = node.layout.getItems?.itemKey ? this.evalNodeExpression(node, node.layout.getItems.itemKey, rawItem) : rawItem.key
451
+ item.title = node.layout.getItems?.itemTitle ? this.evalNodeExpression(node, node.layout.getItems.itemTitle, rawItem) : rawItem.title
408
452
  item.value = item.value ?? item.key
409
453
  item.key = item.key ?? item.value + ''
410
454
  item.title = item.title ?? item.key
411
455
  if (!item.icon && rawItem.icon) item.icon = rawItem.icon
412
456
  } else {
413
- item.value = node.layout.getItems?.itemValue ? evalSelectExpression(node.layout.getItems.itemValue, rawItem) : rawItem
414
- item.key = node.layout.getItems?.itemKey ? evalSelectExpression(node.layout.getItems.itemKey, rawItem) : item.value
415
- item.title = node.layout.getItems?.itemTitle ? evalSelectExpression(node.layout.getItems.itemTitle, rawItem) : item.value
457
+ item.value = node.layout.getItems?.itemValue ? this.evalNodeExpression(node, node.layout.getItems.itemValue, rawItem) : rawItem
458
+ item.key = node.layout.getItems?.itemKey ? this.evalNodeExpression(node, node.layout.getItems.itemKey, rawItem) : item.value
459
+ item.title = node.layout.getItems?.itemTitle ? this.evalNodeExpression(node, node.layout.getItems.itemTitle, rawItem) : item.value
416
460
  }
417
- if (node.layout.getItems?.itemIcon) item.icon = evalSelectExpression(node.layout.getItems?.itemIcon, rawItem)
461
+ if (node.layout.getItems?.itemIcon) item.icon = this.evalNodeExpression(node, node.layout.getItems?.itemIcon, rawItem)
418
462
  return item
419
463
  })
420
464
  return [items, appliedQ]
@@ -443,7 +487,7 @@ export class StatefulLayout {
443
487
  * @param {number} key
444
488
  */
445
489
  activateItem (node, key) {
446
- this.activeItems[node.fullKey] = key
490
+ this.activeItems = produce(this.activeItems, draft => { draft[node.fullKey] = key })
447
491
  this._autofocusTarget = node.fullKey + '/' + key
448
492
  if (node.key === '$oneOf') {
449
493
  this.input(node, undefined)
@@ -457,7 +501,7 @@ export class StatefulLayout {
457
501
  * @param {StateNode} node
458
502
  */
459
503
  deactivateItem (node) {
460
- delete this.activeItems[node.fullKey]
504
+ this.activeItems = produce(this.activeItems, draft => { delete draft[node.fullKey] })
461
505
  this.updateState()
462
506
  }
463
507
 
@@ -1,7 +1,7 @@
1
1
  import { isSwitchStruct, childIsCompObject, isCompositeLayout, isFocusableLayout } from '@json-layout/vocabulary'
2
2
  import { produce } from 'immer'
3
3
  import { getChildDisplay } from './utils/display.js'
4
- import { shallowCompareArrays } from './utils/immutable.js'
4
+ import { shallowEqualArray, shallowProduceArray } from './utils/immutable.js'
5
5
 
6
6
  /**
7
7
  * @param {unknown} data
@@ -17,7 +17,7 @@ const isDataEmpty = (data) => {
17
17
  /**
18
18
  * @param {unknown} data
19
19
  * @param {import('@json-layout/vocabulary').CompObject} layout
20
- * @param {import('./types.js').StatefulLayoutOptions} options
20
+ * @param {import('./types.js').StateNodeOptions} options
21
21
  * @returns {boolean}
22
22
  */
23
23
  const useDefaultData = (data, layout, options) => {
@@ -27,8 +27,8 @@ const useDefaultData = (data, layout, options) => {
27
27
  }
28
28
 
29
29
  // use Immer for efficient updating with immutability and no-op detection
30
- /** @type {(draft: import('./types.js').StateNode, key: string | number, fullKey: string, parentFullKey: string | null, dataPath: string, parentDataPath: string | null, skeleton: import('../index.js').SkeletonNode, layout: import('@json-layout/vocabulary').CompObject, cols: number, data: unknown, error: string | undefined, validated: boolean, options: import('./types.js').StatefulLayoutOptions, autofocus: boolean, children: import('../index.js').StateNode[] | undefined) => import('../index.js').StateNode} */
31
- const produceStateNode = produce((draft, key, fullKey, parentFullKey, dataPath, parentDataPath, skeleton, layout, cols, data, error, validated, options, autofocus, children) => {
30
+ /** @type {(draft: import('./types.js').StateNode, key: string | number, fullKey: string, parentFullKey: string | null, dataPath: string, parentDataPath: string | null, skeleton: import('../index.js').SkeletonNode, layout: import('@json-layout/vocabulary').CompObject, width: number, cols: number, data: unknown, error: string | undefined, validated: boolean, options: import('./types.js').StateNodeOptions, autofocus: boolean, children: import('../index.js').StateNode[] | undefined) => import('../index.js').StateNode} */
31
+ const produceStateNode = produce((draft, key, fullKey, parentFullKey, dataPath, parentDataPath, skeleton, layout, width, cols, data, error, validated, options, autofocus, children) => {
32
32
  draft.messages = layout.messages ? produceStateNodeMessages(draft.messages || {}, layout.messages, options) : options.messages
33
33
 
34
34
  draft.key = key
@@ -38,6 +38,7 @@ const produceStateNode = produce((draft, key, fullKey, parentFullKey, dataPath,
38
38
  draft.parentDataPath = parentDataPath
39
39
  draft.skeleton = skeleton
40
40
  draft.layout = layout
41
+ draft.width = width
41
42
  draft.options = options
42
43
  draft.cols = cols
43
44
  draft.data = data
@@ -57,7 +58,7 @@ const produceStateNode = produce((draft, key, fullKey, parentFullKey, dataPath,
57
58
  draft.children = children
58
59
  })
59
60
 
60
- /** @type {(draft: import('../i18n/types.js').LocaleMessages, layoutMessages: Partial<import('../i18n/types.js').LocaleMessages>, options: import('./types.js').StatefulLayoutOptions) => import('../i18n/types.js').LocaleMessages} */
61
+ /** @type {(draft: import('../i18n/types.js').LocaleMessages, layoutMessages: Partial<import('../i18n/types.js').LocaleMessages>, options: import('./types.js').StateNodeOptions) => import('../i18n/types.js').LocaleMessages} */
61
62
  const produceStateNodeMessages = produce((draft, layoutMessages, options) => {
62
63
  Object.assign(draft, options.messages, layoutMessages)
63
64
  })
@@ -76,10 +77,10 @@ const produceStateNodeData = produce((draft, parentDataPath, children) => {
76
77
  }
77
78
  })
78
79
 
79
- /** @type {(draft: import('./types.js').StatefulLayoutOptions, parentNodeOptions: import('./types.js').StatefulLayoutOptions, nodeOptions: import('@json-layout/vocabulary').StateNodeOptions | undefined, width: number) => import('./types.js').StatefulLayoutOptions} */
80
- const produceNodeOptions = produce((draft, parentNodeOptions, nodeOptions = {}, width) => {
80
+ /** @type {(draft: import('./types.js').StateNodeOptions, parentNodeOptions: import('./types.js').StateNodeOptions, nodeOptions: Partial<import('./types.js').StateNodeOptions> | undefined) => import('./types.js').StateNodeOptions} */
81
+ const produceNodeOptions = produce((draft, parentNodeOptions, nodeOptions = {}) => {
81
82
  for (const key in parentNodeOptions) {
82
- draft[key] = parentNodeOptions[key]
83
+ draft[key] = nodeOptions[key] ?? parentNodeOptions[key]
83
84
  }
84
85
  for (const key in nodeOptions) {
85
86
  draft[key] = nodeOptions[key]
@@ -90,16 +91,15 @@ const produceNodeOptions = produce((draft, parentNodeOptions, nodeOptions = {},
90
91
  delete draft[key]
91
92
  }
92
93
  }
93
- draft.width = width
94
94
  })
95
95
 
96
- /** @type {(draft: import('./types.js').StatefulLayoutOptions) => import('./types.js').StatefulLayoutOptions} */
96
+ /** @type {(draft: import('./types.js').StateNodeOptions) => import('./types.js').StateNodeOptions} */
97
97
  const produceReadonlyArrayItemOptions = produce((draft) => {
98
98
  draft.readOnly = true
99
99
  draft.summary = true
100
100
  })
101
101
 
102
- /** @type {(draft: import('./types.js').StatefulLayoutOptions, section: import('@json-layout/vocabulary').CompositeCompObject) => import('./types.js').StatefulLayoutOptions} */
102
+ /** @type {(draft: import('./types.js').StateNodeOptions, section: import('@json-layout/vocabulary').CompositeCompObject) => import('./types.js').StateNodeOptions} */
103
103
  const produceCompositeChildrenOptions = produce((draft, section) => {
104
104
  // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
105
105
  if (section.title && draft.titleDepth < 6) draft.titleDepth += 1
@@ -134,42 +134,51 @@ const matchChildError = (error, skeleton, dataPath) => {
134
134
  * @param {import('../index.js').CompiledExpression[]} expressions
135
135
  * @param {import('@json-layout/vocabulary').Expression} expression
136
136
  * @param {any} data
137
- * @param {import('./types.js').StatefulLayoutOptions} options
137
+ * @param {import('./types.js').StateNodeOptions} options
138
138
  * @param {import('./utils/display.js').Display} display
139
+ * @param {unknown} rootData
140
+ * @param {unknown} parentData
139
141
  * @returns {any}
140
142
  */
141
- export function evalExpression (expressions, expression, data, options, display) {
143
+ export function evalExpression (expressions, expression, data, options, display, rootData, parentData) {
142
144
  if (expression.ref === undefined) throw new Error('expression was not compiled : ' + JSON.stringify(expression))
143
145
  const compiledExpression = expressions[expression.ref]
144
- // console.log(expression.expr, context, mode, display)
145
- return compiledExpression(data, options, options.context, display)
146
+ return expression.pure ? compiledExpression(data, options, options.context, display) : compiledExpression(data, options, options.context, display, rootData, parentData)
146
147
  }
147
148
 
148
149
  /**
149
150
  * @param {import('@json-layout/vocabulary').NormalizedLayout} normalizedLayout
150
- * @param {import('./types.js').StatefulLayoutOptions} options
151
+ * @param {import('./types.js').StateNodeOptions} options
151
152
  * @param {import('../index.js').CompiledLayout} compiledLayout
152
153
  * @param {import('./utils/display.js').Display} display
153
154
  * @param {unknown} data
155
+ * @param {unknown} rootData
156
+ * @param {unknown} parentData
154
157
  * @returns {import('@json-layout/vocabulary').CompObject}
155
158
  */
156
- const getCompObject = (normalizedLayout, options, compiledLayout, display, data) => {
159
+ const getCompObject = (normalizedLayout, options, compiledLayout, display, data, rootData, parentData) => {
157
160
  if (isSwitchStruct(normalizedLayout)) {
158
161
  for (const compObject of normalizedLayout.switch) {
159
- if (!compObject.if || !!evalExpression(compiledLayout.expressions, compObject.if, data, options, display)) {
162
+ if (!compObject.if || !!evalExpression(compiledLayout.expressions, compObject.if, data, options, display, parentData, rootData)) {
160
163
  return compObject
161
164
  }
162
165
  }
163
166
  } else {
164
- return normalizedLayout
167
+ if (normalizedLayout.if) {
168
+ if (evalExpression(compiledLayout.expressions, normalizedLayout.if, data, options, display, parentData, rootData)) {
169
+ return normalizedLayout
170
+ }
171
+ } else {
172
+ return normalizedLayout
173
+ }
165
174
  }
166
- throw new Error('no layout matched for node')
175
+ return { comp: 'none' }
167
176
  }
168
177
 
169
178
  /**
170
179
  *
171
180
  * @param {import('./types.js').CreateStateTreeContext} context
172
- * @param {import('./types.js').StatefulLayoutOptions} parentOptions
181
+ * @param {import('./types.js').StateNodeOptions} parentOptions
173
182
  * @param {import('../index.js').CompiledLayout} compiledLayout
174
183
  * @param {string | number} key
175
184
  * @param {string} fullKey
@@ -180,6 +189,7 @@ const getCompObject = (normalizedLayout, options, compiledLayout, display, data)
180
189
  * @param {import('@json-layout/vocabulary').Child | null} childDefinition
181
190
  * @param {import('./utils/display.js').Display} parentDisplay
182
191
  * @param {unknown} data
192
+ * @param {unknown} parentData
183
193
  * @param {import('./types.js').ValidationState} validationState
184
194
  * @param {import('./types.js').StateNode} [reusedNode]
185
195
  * @returns {import('./types.js').StateNode}
@@ -197,23 +207,32 @@ export function createStateNode (
197
207
  childDefinition,
198
208
  parentDisplay,
199
209
  data,
210
+ parentData,
200
211
  validationState,
201
212
  reusedNode
202
213
  ) {
214
+ /** @type {import('./types.js').StateNodeCacheKey | null} */
215
+ let cacheKey = null
216
+ if (skeleton.pure && reusedNode) {
217
+ cacheKey = [parentOptions, compiledLayout, fullKey, skeleton, childDefinition, parentDisplay.width, validationState, context.activeItems, context.initial, data]
218
+ if (context.cacheKeys[fullKey] && shallowEqualArray(context.cacheKeys[fullKey], cacheKey)) return reusedNode
219
+ }
220
+
203
221
  const normalizedLayout = childDefinition && childIsCompObject(childDefinition)
204
222
  ? childDefinition
205
223
  : compiledLayout.normalizedLayouts[skeleton.pointer]
206
- const layout = getCompObject(normalizedLayout, parentOptions, compiledLayout, parentDisplay, data)
224
+ const layout = getCompObject(normalizedLayout, parentOptions, compiledLayout, parentDisplay, data, context.rootData, parentData)
207
225
  const [display, cols] = getChildDisplay(parentDisplay, childDefinition?.cols ?? layout.cols)
208
226
 
209
- const options = produceNodeOptions(
210
- reusedNode?.options ?? /** @type {import('./types.js').StatefulLayoutOptions} */({}),
211
- parentOptions,
212
- layout.options,
213
- display.width
214
- )
227
+ const options = layout.options
228
+ ? produceNodeOptions(
229
+ reusedNode?.options ?? /** @type {import('./types.js').StateNodeOptions} */({}),
230
+ parentOptions,
231
+ layout.options
232
+ )
233
+ : parentOptions
215
234
 
216
- if (context.initial && parentOptions.autofocus && layout.autofocus) {
235
+ if (context.initial && parentOptions.autofocus && layout.autofocus && layout.comp !== 'none') {
217
236
  context.autofocusTarget = fullKey
218
237
  }
219
238
 
@@ -244,6 +263,7 @@ export function createStateNode (
244
263
  childLayout,
245
264
  display,
246
265
  isSameData ? objectData : objectData[childLayout.key],
266
+ objectData,
247
267
  validationState,
248
268
  reusedNode?.children?.[i]
249
269
  )
@@ -257,7 +277,7 @@ export function createStateNode (
257
277
  /** @type {number} */
258
278
  const activeChildTreeIndex = fullKey in context.activeItems ? context.activeItems[fullKey] : skeleton.childrenTrees?.findIndex((childTree) => compiledLayout.validates[childTree.root.pointer](data))
259
279
  if (activeChildTreeIndex !== -1) {
260
- context.activeItems[fullKey] = activeChildTreeIndex
280
+ context.activeItems = produce(context.activeItems, draft => { draft[fullKey] = activeChildTreeIndex })
261
281
  const activeChildKey = `${fullKey}/${activeChildTreeIndex}`
262
282
  if (context.autofocusTarget === fullKey) context.autofocusTarget = activeChildKey
263
283
  const activeChildTree = skeleton.childrenTrees[activeChildTreeIndex]
@@ -275,6 +295,7 @@ export function createStateNode (
275
295
  null,
276
296
  display,
277
297
  data,
298
+ data,
278
299
  validationState,
279
300
  reusedNode?.children?.[0]
280
301
  )
@@ -305,6 +326,7 @@ export function createStateNode (
305
326
  null,
306
327
  display,
307
328
  itemData,
329
+ arrayData,
308
330
  validationState,
309
331
  reusedNode?.children?.[0]
310
332
  )
@@ -325,10 +347,10 @@ export function createStateNode (
325
347
 
326
348
  let nodeData = children ? produceStateNodeData(/** @type {Record<string, unknown>} */(data ?? {}), dataPath, children) : data
327
349
  if (layout.constData) {
328
- nodeData = evalExpression(compiledLayout.expressions, layout.constData, nodeData, options, display)
350
+ nodeData = evalExpression(compiledLayout.expressions, layout.constData, nodeData, options, display, context.rootData, parentData)
329
351
  } else {
330
352
  if (layout.defaultData && useDefaultData(nodeData, layout, options)) {
331
- nodeData = evalExpression(compiledLayout.expressions, layout.defaultData, nodeData, options, display)
353
+ nodeData = evalExpression(compiledLayout.expressions, layout.defaultData, nodeData, options, display, context.rootData, parentData)
332
354
  } else {
333
355
  if (isDataEmpty(nodeData)) {
334
356
  if (layout.nullable) {
@@ -355,15 +377,18 @@ export function createStateNode (
355
377
  parentDataPath,
356
378
  skeleton,
357
379
  layout,
380
+ display.width,
358
381
  cols,
359
382
  nodeData,
360
383
  error?.message,
361
384
  validated,
362
385
  options,
363
386
  autofocus,
364
- children && shallowCompareArrays(reusedNode?.children, children)
387
+ children && shallowProduceArray(reusedNode?.children, children)
365
388
  )
366
- context.nodes.push(node)
389
+
390
+ if (cacheKey) context.cacheKeys[fullKey] = cacheKey
391
+
367
392
  return node
368
393
  }
369
394
 
@@ -9,6 +9,21 @@ const produceStateTree = produce(
9
9
  }
10
10
  )
11
11
 
12
+ /**
13
+ * @generator
14
+ * @param {import('./types.js').StateNode} node
15
+ * @yields {import('./types.js').StateNode}
16
+ * @returns {Generator<import('./types.js').StateNode>}
17
+ */
18
+ function * traverseNodes (node) {
19
+ yield node
20
+ if (node.children) {
21
+ for (const child of node.children) {
22
+ yield * traverseNodes(child)
23
+ }
24
+ }
25
+ }
26
+
12
27
  /**
13
28
  * @param {import('./types.js').CreateStateTreeContext} context
14
29
  * @param {import('./types.js').StatefulLayoutOptions} options
@@ -51,9 +66,19 @@ export function createStateTree (
51
66
  null,
52
67
  display,
53
68
  data,
69
+ null,
54
70
  validationState,
55
71
  reusedStateTree?.root
56
72
  )
57
73
 
74
+ context.nodes = []
75
+ context.files = []
76
+ for (const node of traverseNodes(root)) {
77
+ context.nodes.push(node)
78
+ if (node.data instanceof File) {
79
+ context.files.push({ dataPath: node.dataPath, file: node.data })
80
+ }
81
+ }
82
+
58
83
  return produceStateTree(reusedStateTree ?? /** @type {import('./types.js').StateTree} */({}), root, valid)
59
84
  }
@@ -2,7 +2,7 @@ import { type ErrorObject } from 'ajv'
2
2
  import {
3
3
  type CompObject,
4
4
  type Cols,
5
- type StateNodeOptions,
5
+ type StateNodeOptionsBase,
6
6
  type TextField,
7
7
  type Textarea,
8
8
  type NumberField,
@@ -22,9 +22,10 @@ import {
22
22
  type ExpansionPanels,
23
23
  type Stepper,
24
24
  type List,
25
- type Combobox
25
+ type Combobox,
26
+ type Child
26
27
  } from '@json-layout/vocabulary'
27
- import { type SkeletonTree, type SkeletonNode, type StatefulLayout } from '../index.js'
28
+ import { type SkeletonTree, type SkeletonNode, type StatefulLayout, type CompiledLayout } from '../index.js'
28
29
  import { type LocaleMessages } from '../i18n/types.js'
29
30
 
30
31
  export interface StateNode {
@@ -40,7 +41,8 @@ export interface StateNode {
40
41
  error: string | undefined
41
42
  childError: boolean | undefined
42
43
  validated: boolean
43
- options: StatefulLayoutOptions
44
+ width: number
45
+ options: StateNodeOptions
44
46
  messages: LocaleMessages
45
47
  autofocus?: boolean
46
48
  autofocusChild?: string | number
@@ -50,17 +52,38 @@ export interface StateNode {
50
52
  export interface StateTree {
51
53
  root: StateNode
52
54
  valid: boolean
53
- title: string
54
55
  }
55
56
 
56
57
  export interface CreateStateTreeContext {
57
58
  errors?: ErrorObject[]
58
- nodes: StateNode[]
59
+ files: FileRef[]
59
60
  activeItems: Record<string, number>
60
61
  autofocusTarget: string | null
61
62
  initial: boolean
63
+ cacheKeys: Record<string, StateNodeCacheKey>
64
+ rootData: unknown
65
+ nodes: StateNode[]
66
+ }
67
+
68
+ export interface FileRef {
69
+ file: File
70
+ dataPath: string
62
71
  }
63
72
 
73
+ // [parentOptions, compiledLayout, fullKey, skeleton, childDefinition, parentWidth, validationState, activeItems, initial, data]
74
+ export type StateNodeCacheKey = [
75
+ StateNodeOptions,
76
+ CompiledLayout,
77
+ string,
78
+ SkeletonNode,
79
+ Child | null,
80
+ number,
81
+ ValidationState,
82
+ Record<string, number>,
83
+ boolean,
84
+ unknown
85
+ ]
86
+
64
87
  export interface ValidationState {
65
88
  initialized: boolean
66
89
  validatedForm: boolean
@@ -75,14 +98,17 @@ export type StatefulLayoutEvents = {
75
98
  autofocus: string
76
99
  }
77
100
 
78
- export type StatefulLayoutOptions = Required<StateNodeOptions> & {
101
+ export type StateNodeOptions = Required<StateNodeOptionsBase & {
79
102
  context: Record<string, any>
80
- width: number
81
103
  validateOn: 'input' | 'blur' | 'submit'
82
104
  initialValidation: 'never' | 'always' | 'withData'
83
105
  defaultOn: 'missing' | 'empty' | 'never'
84
106
  messages: LocaleMessages
85
107
  autofocus: boolean
108
+ }>
109
+
110
+ export type StatefulLayoutOptions = StateNodeOptions & {
111
+ width: number
86
112
  }
87
113
 
88
114
  export type TextFieldNode = Omit<StateNode, 'children'> & { layout: TextField, data: string | undefined | null }
@@ -1,11 +1,23 @@
1
1
  /**
2
2
  * @template ItemType
3
- * @param {ItemType[]} a1
4
- * @param {ItemType[]} a2
3
+ * @param {ItemType[]} previousArray
4
+ * @param {ItemType[]} newArray
5
5
  * @returns {ItemType[]}
6
6
  */
7
- export function shallowCompareArrays (a1 = [], a2 = []) {
8
- if (!a1 || !a2 || a1.length !== a2.length) return a2
9
- for (let i = 0; i < a1.length; i++) { if (a1[i] !== a2[i]) return a2 }
10
- return a1
7
+ export function shallowProduceArray (previousArray = [], newArray = []) {
8
+ if (!previousArray || !newArray || previousArray.length !== newArray.length) return newArray
9
+ for (let i = 0; i < previousArray.length; i++) { if (previousArray[i] !== newArray[i]) return newArray }
10
+ return previousArray
11
+ }
12
+
13
+ /**
14
+ * @template ItemType
15
+ * @param {any[]} a1
16
+ * @param {any[]} a2
17
+ * @returns {boolean}
18
+ */
19
+ export function shallowEqualArray (a1 = [], a2 = []) {
20
+ if (a1.length !== a2.length) return false
21
+ for (let i = 0; i < a1.length; i++) { if (a1[i] !== a2[i]) return false }
22
+ return true
11
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compile/index.js"],"names":[],"mappings":"AAqEA;;;;GAIG;AACH,iCAJW,MAAM,4EAEJ,cAAc,CA0E1B;;2BAlIY,OAAO,YAAY,EAAE,YAAY;2BACjC,OAAO,YAAY,EAAE,YAAY;6BACjC,OAAO,YAAY,EAAE,cAAc;6BACnC,OAAO,YAAY,EAAE,cAAc;oCACnC,OAAO,YAAY,EAAE,qBAAqB;iCAC1C,OAAO,YAAY,EAAE,kBAAkB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compile/index.js"],"names":[],"mappings":"AAmEA;;;;GAIG;AACH,iCAJW,MAAM,4EAEJ,cAAc,CA6E1B;;2BAnIY,OAAO,YAAY,EAAE,YAAY;2BACjC,OAAO,YAAY,EAAE,YAAY;6BACjC,OAAO,YAAY,EAAE,cAAc;6BACnC,OAAO,YAAY,EAAE,cAAc;oCACnC,OAAO,YAAY,EAAE,qBAAqB;iCAC1C,OAAO,YAAY,EAAE,kBAAkB"}
@@ -1 +1 @@
1
- {"version":3,"file":"skeleton-node.d.ts","sourceRoot":"","sources":["../../src/compile/skeleton-node.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;GAYG;AACH,yCAZW,GAAG,WACH,OAAO,YAAY,EAAE,cAAc,aACnC,MAAM,EAAE,oBACR,OAAO,MAAM,EAAE,MAAM,EAAE,CAAC,qBACxB,OAAO,MAAM,EAAE,OAAO,yBAAyB,EAAE,gBAAgB,CAAC,eAClE,OAAO,yBAAyB,EAAE,UAAU,EAAE,OAC9C,MAAM,GAAG,MAAM,WACf,MAAM,iBACN,MAAM,GAAG,IAAI,YACb,OAAO,GACL,OAAO,YAAY,EAAE,YAAY,CAmK7C"}
1
+ {"version":3,"file":"skeleton-node.d.ts","sourceRoot":"","sources":["../../src/compile/skeleton-node.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,yCAZW,GAAG,WACH,OAAO,YAAY,EAAE,cAAc,aACnC,MAAM,EAAE,oBACR,OAAO,MAAM,EAAE,MAAM,EAAE,CAAC,qBACxB,OAAO,MAAM,EAAE,OAAO,yBAAyB,EAAE,gBAAgB,CAAC,eAClE,OAAO,yBAAyB,EAAE,UAAU,EAAE,OAC9C,MAAM,GAAG,MAAM,WACf,MAAM,iBACN,MAAM,GAAG,IAAI,YACb,OAAO,GACL,OAAO,YAAY,EAAE,YAAY,CAyL7C"}
@@ -1,10 +1,10 @@
1
1
  import type ajvModule from 'ajv';
2
2
  import type MarkdownIt from 'markdown-it';
3
- import { type NormalizedLayout, type StateNodeOptions } from '@json-layout/vocabulary';
3
+ import { type NormalizedLayout, type StateNodeOptionsBase } from '@json-layout/vocabulary';
4
4
  import { type ValidateFunction, type SchemaObject } from 'ajv';
5
5
  import { type Display } from '../state/utils/display.js';
6
6
  import { type LocaleMessages } from '../i18n/types.js';
7
- export type CompiledExpression = (data: any, options: StateNodeOptions, context: object, display: Display) => any;
7
+ export type CompiledExpression = (data: any, options: StateNodeOptionsBase, context: object, display: Display, rootData?: unknown, parentData?: unknown) => any;
8
8
  export interface CompileOptions {
9
9
  ajv: ajvModule.default;
10
10
  code: boolean;
@@ -36,6 +36,7 @@ export interface SkeletonNode {
36
36
  key: string | number;
37
37
  pointer: string;
38
38
  parentPointer: string | null;
39
+ pure: boolean;
39
40
  children?: SkeletonNode[];
40
41
  childrenTrees?: SkeletonTree[];
41
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compile/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,KAAK,CAAA;AAChC,OAAO,KAAK,UAAU,MAAM,aAAa,CAAA;AACzC,OAAO,EA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types.js').OneOfSelectNode} OneOfSelectNode
27
27
  * @typedef {import('./types.js').ListNode} ListNode
28
+ * @typedef {import('./types.js').FileRef} FileRef
28
29
  */
29
30
  /** @type {(node: StateNode | undefined) => node is SectionNode} */
30
31
  export const isSection: (node: StateNode | undefined) => node is import("./types.js").SectionNode;
@@ -116,6 +117,10 @@ export class StatefulLayout {
116
117
  * @type {string | null}
117
118
  */
118
119
  private _previousAutofocusTarget;
120
+ /**
121
+ * @type {FileRef[]}
122
+ */
123
+ files: FileRef[];
119
124
  /**
120
125
  * @type {Record<string, number>}
121
126
  */
@@ -151,6 +156,14 @@ export class StatefulLayout {
151
156
  * @returns {boolean}
152
157
  */
153
158
  get hasHiddenError(): boolean;
159
+ /**
160
+ * @private
161
+ * @param {StateNode} node
162
+ * @param {import('@json-layout/vocabulary').Expression} expression
163
+ * @param {any} data
164
+ * @returns {any}
165
+ */
166
+ private evalNodeExpression;
154
167
  /**
155
168
  * @param {StateNode} node
156
169
  * @param {unknown} data
@@ -214,5 +227,6 @@ export type VerticalTabsNode = import('./types.js').VerticalTabsNode;
214
227
  export type StepperNode = import('./types.js').StepperNode;
215
228
  export type OneOfSelectNode = import('./types.js').OneOfSelectNode;
216
229
  export type ListNode = import('./types.js').ListNode;
230
+ export type FileRef = import('./types.js').FileRef;
217
231
  import { Display } from './utils/display.js';
218
232
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.js"],"names":[],"mappings":";AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,mEAAmE;AACnE,+BADkB,SAAS,GAAG,SAAS,8CACoC;AAE3E,oGAAoG;AACpG,iCADkB,SAAS,GAAG,SAAS,yHACkC;AA+BzE;IA+GE;;;;;OAKG;IACH,4BALW,OAAO,aAAa,EAAE,cAAc,gBACpC,OAAO,aAAa,EAAE,YAAY,WAClC,QAAQ,qBAAqB,CAAC,SAC9B,OAAO,EAejB;I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,EAAE,qBAAqB;mCAC1C,OAAO,YAAY,EAAE,oBAAoB;qCACzC,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;2BACrC,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;sBAC7B,OAAO,YAAY,EAAE,OAAO;wBAhCjB,oBAAoB"}
@@ -2,15 +2,17 @@
2
2
  * @param {import('../index.js').CompiledExpression[]} expressions
3
3
  * @param {import('@json-layout/vocabulary').Expression} expression
4
4
  * @param {any} data
5
- * @param {import('./types.js').StatefulLayoutOptions} options
5
+ * @param {import('./types.js').StateNodeOptions} options
6
6
  * @param {import('./utils/display.js').Display} display
7
+ * @param {unknown} rootData
8
+ * @param {unknown} parentData
7
9
  * @returns {any}
8
10
  */
9
- export function evalExpression(expressions: import('../index.js').CompiledExpression[], expression: import('@json-layout/vocabulary').Expression, data: any, options: import('./types.js').StatefulLayoutOptions, display: import('./utils/display.js').Display): any;
11
+ 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, rootData: unknown, parentData: unknown): any;
10
12
  /**
11
13
  *
12
14
  * @param {import('./types.js').CreateStateTreeContext} context
13
- * @param {import('./types.js').StatefulLayoutOptions} parentOptions
15
+ * @param {import('./types.js').StateNodeOptions} parentOptions
14
16
  * @param {import('../index.js').CompiledLayout} compiledLayout
15
17
  * @param {string | number} key
16
18
  * @param {string} fullKey
@@ -21,11 +23,12 @@ export function evalExpression(expressions: import('../index.js').CompiledExpres
21
23
  * @param {import('@json-layout/vocabulary').Child | null} childDefinition
22
24
  * @param {import('./utils/display.js').Display} parentDisplay
23
25
  * @param {unknown} data
26
+ * @param {unknown} parentData
24
27
  * @param {import('./types.js').ValidationState} validationState
25
28
  * @param {import('./types.js').StateNode} [reusedNode]
26
29
  * @returns {import('./types.js').StateNode}
27
30
  */
28
- export function createStateNode(context: import('./types.js').CreateStateTreeContext, parentOptions: import('./types.js').StatefulLayoutOptions, 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, validationState: import('./types.js').ValidationState, reusedNode?: import("./types.js").StateNode | undefined): import('./types.js').StateNode;
31
+ 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, parentData: unknown, validationState: import('./types.js').ValidationState, reusedNode?: import("./types.js").StateNode | undefined): import('./types.js').StateNode;
29
32
  /** @type {(draft: any, node: import('./types.js').StateNode, data: unknown) => any} */
30
33
  export const producePatchedData: (draft: any, node: import('./types.js').StateNode, data: unknown) => any;
31
34
  //# sourceMappingURL=state-node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state-node.d.ts","sourceRoot":"","sources":["../../src/state/state-node.js"],"names":[],"mappings":"AAoIA;;;;;;;GAOG;AACH,4CAPW,OAAO,aAAa,EAAE,kBAAkB,EAAE,cAC1C,OAAO,yBAAyB,EAAE,UAAU,QAC5C,GAAG,WACH,OAAO,YAAY,EAAE,qBAAqB,WAC1C,OAAO,oBAAoB,EAAE,OAAO,GAClC,GAAG,CAOf;AAuBD;;;;;;;;;;;;;;;;;GAiBG;AACH,yCAhBW,OAAO,YAAY,EAAE,sBAAsB,iBAC3C,OAAO,YAAY,EAAE,qBAAqB,kBAC1C,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,OAAO,mBACP,OAAO,YAAY,EAAE,eAAe,4DAElC,OAAO,YAAY,EAAE,SAAS,CAuL1C;AAED,uFAAuF;AACvF,yCADmB,GAAG,QAAQ,OAAO,YAAY,EAAE,SAAS,QAAQ,OAAO,KAAK,GAAG,CAOjF"}
1
+ {"version":3,"file":"state-node.d.ts","sourceRoot":"","sources":["../../src/state/state-node.js"],"names":[],"mappings":"AAoIA;;;;;;;;;GASG;AACH,4CATW,OAAO,aAAa,EAAE,kBAAkB,EAAE,cAC1C,OAAO,yBAAyB,EAAE,UAAU,QAC5C,GAAG,WACH,OAAO,YAAY,EAAE,gBAAgB,WACrC,OAAO,oBAAoB,EAAE,OAAO,YACpC,OAAO,cACP,OAAO,GACL,GAAG,CAMf;AA+BD;;;;;;;;;;;;;;;;;;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,yBAAyB,EAAE,KAAK,GAAG,IAAI,iBAC9C,OAAO,oBAAoB,EAAE,OAAO,QACpC,OAAO,cACP,OAAO,mBACP,OAAO,YAAY,EAAE,eAAe,4DAElC,OAAO,YAAY,EAAE,SAAS,CAsM1C;AAED,uFAAuF;AACvF,yCADmB,GAAG,QAAQ,OAAO,YAAY,EAAE,SAAS,QAAQ,OAAO,KAAK,GAAG,CAOjF"}
@@ -1 +1 @@
1
- {"version":3,"file":"state-tree.d.ts","sourceRoot":"","sources":["../../src/state/state-tree.js"],"names":[],"mappings":"AAWA;;;;;;;;;;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,iEAElC,OAAO,YAAY,EAAE,SAAS,CAsC1C"}
1
+ {"version":3,"file":"state-tree.d.ts","sourceRoot":"","sources":["../../src/state/state-tree.js"],"names":[],"mappings":"AA0BA;;;;;;;;;;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,iEAElC,OAAO,YAAY,EAAE,SAAS,CAgD1C"}
@@ -1,6 +1,6 @@
1
1
  import { type ErrorObject } from 'ajv';
2
- import { type CompObject, type Cols, type StateNodeOptions, 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 } from '@json-layout/vocabulary';
3
- import { type SkeletonTree, type SkeletonNode, type StatefulLayout } from '../index.js';
2
+ import { type CompObject, 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 Child } from '@json-layout/vocabulary';
3
+ import { type SkeletonTree, type SkeletonNode, type StatefulLayout, type CompiledLayout } from '../index.js';
4
4
  import { type LocaleMessages } from '../i18n/types.js';
5
5
  export interface StateNode {
6
6
  key: string | number;
@@ -15,7 +15,8 @@ export interface StateNode {
15
15
  error: string | undefined;
16
16
  childError: boolean | undefined;
17
17
  validated: boolean;
18
- options: StatefulLayoutOptions;
18
+ width: number;
19
+ options: StateNodeOptions;
19
20
  messages: LocaleMessages;
20
21
  autofocus?: boolean;
21
22
  autofocusChild?: string | number;
@@ -24,15 +25,33 @@ export interface StateNode {
24
25
  export interface StateTree {
25
26
  root: StateNode;
26
27
  valid: boolean;
27
- title: string;
28
28
  }
29
29
  export interface CreateStateTreeContext {
30
30
  errors?: ErrorObject[];
31
- nodes: StateNode[];
31
+ files: FileRef[];
32
32
  activeItems: Record<string, number>;
33
33
  autofocusTarget: string | null;
34
34
  initial: boolean;
35
+ cacheKeys: Record<string, StateNodeCacheKey>;
36
+ rootData: unknown;
37
+ nodes: StateNode[];
35
38
  }
39
+ export interface FileRef {
40
+ file: File;
41
+ dataPath: string;
42
+ }
43
+ export type StateNodeCacheKey = [
44
+ StateNodeOptions,
45
+ CompiledLayout,
46
+ string,
47
+ SkeletonNode,
48
+ Child | null,
49
+ number,
50
+ ValidationState,
51
+ Record<string, number>,
52
+ boolean,
53
+ unknown
54
+ ];
36
55
  export interface ValidationState {
37
56
  initialized: boolean;
38
57
  validatedForm: boolean;
@@ -43,14 +62,16 @@ export type StatefulLayoutEvents = {
43
62
  'update': StatefulLayout;
44
63
  autofocus: string;
45
64
  };
46
- export type StatefulLayoutOptions = Required<StateNodeOptions> & {
65
+ export type StateNodeOptions = Required<StateNodeOptionsBase & {
47
66
  context: Record<string, any>;
48
- width: number;
49
67
  validateOn: 'input' | 'blur' | 'submit';
50
68
  initialValidation: 'never' | 'always' | 'withData';
51
69
  defaultOn: 'missing' | 'empty' | 'never';
52
70
  messages: LocaleMessages;
53
71
  autofocus: boolean;
72
+ }>;
73
+ export type StatefulLayoutOptions = StateNodeOptions & {
74
+ width: number;
54
75
  };
55
76
  export type TextFieldNode = Omit<StateNode, 'children'> & {
56
77
  layout: TextField;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAA;AACtC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,QAAQ,EACd,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AACvF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,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A;CAAE,CAAA;AAEpF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,CAAA;AAEhG,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,SAAS,EAAE,CAAA;CAAE,CAAA;AAE1E,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,SAAS,EAAE,CAAA;CAAE,CAAA;AAE1F,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG;IAAE,MAAM,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,SAAS,EAAE,CAAA;CAAE,CAAA;AAEhG,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,SAAS,EAAE,CAAA;CAAE,CAAA;AAEhF,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,GAAG,EAAE,CAAC;IAAC,QAAQ,EAAE,SAAS,EAAE,CAAC;IAAC,aAAa,EAAE,YAAY,EAAE,CAAA;CAAE,CAAA;AAEtH,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,CAAA"}
@@ -1,8 +1,15 @@
1
1
  /**
2
2
  * @template ItemType
3
- * @param {ItemType[]} a1
4
- * @param {ItemType[]} a2
3
+ * @param {ItemType[]} previousArray
4
+ * @param {ItemType[]} newArray
5
5
  * @returns {ItemType[]}
6
6
  */
7
- export function shallowCompareArrays<ItemType>(a1?: ItemType[], a2?: ItemType[]): ItemType[];
7
+ export function shallowProduceArray<ItemType>(previousArray?: ItemType[], newArray?: ItemType[]): ItemType[];
8
+ /**
9
+ * @template ItemType
10
+ * @param {any[]} a1
11
+ * @param {any[]} a2
12
+ * @returns {boolean}
13
+ */
14
+ export function shallowEqualArray<ItemType>(a1?: any[], a2?: any[]): boolean;
8
15
  //# sourceMappingURL=immutable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"immutable.d.ts","sourceRoot":"","sources":["../../../src/state/utils/immutable.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,6FAIC"}
1
+ {"version":3,"file":"immutable.d.ts","sourceRoot":"","sources":["../../../src/state/utils/immutable.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,6GAIC;AAED;;;;;GAKG;AACH,iDAJW,GAAG,EAAE,OACL,GAAG,EAAE,GACH,OAAO,CAMnB"}