@json-layout/core 0.16.3 → 0.17.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 +1 -1
- package/src/compile/index.js +1 -1
- package/src/compile/types.ts +6 -1
- package/src/state/index.js +16 -5
- package/src/state/state-node.js +29 -26
- package/types/compile/types.d.ts +5 -1
- package/types/compile/types.d.ts.map +1 -1
- package/types/state/index.d.ts +6 -0
- package/types/state/index.d.ts.map +1 -1
- package/types/state/state-node.d.ts +4 -4
- package/types/state/state-node.d.ts.map +1 -1
package/package.json
CHANGED
package/src/compile/index.js
CHANGED
|
@@ -143,7 +143,7 @@ export function compile (_schema, partialOptions = {}) {
|
|
|
143
143
|
for (const expression of expressionsDefinitions) {
|
|
144
144
|
const expressionsParams = expression.pure
|
|
145
145
|
? ['data', 'options', 'context', 'display', 'layout']
|
|
146
|
-
: ['data', 'options', 'context', 'display', 'layout', '
|
|
146
|
+
: ['data', 'options', 'context', 'display', 'layout', 'rootData', 'parent']
|
|
147
147
|
/* if (expression.type === 'expr-eval') {
|
|
148
148
|
expressions.push(exprEvalParser.parse(expression.expr).toJSFunction(expressionsParams.join(',')))
|
|
149
149
|
} */
|
package/src/compile/types.ts
CHANGED
|
@@ -5,6 +5,11 @@ 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 interface ParentContextExpression {
|
|
9
|
+
data: unknown
|
|
10
|
+
parent: ParentContextExpression | undefined | null
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
export type CompiledExpression = (
|
|
9
14
|
data: any,
|
|
10
15
|
options: StateNodeOptionsBase,
|
|
@@ -12,7 +17,7 @@ export type CompiledExpression = (
|
|
|
12
17
|
display: Display,
|
|
13
18
|
layout: BaseCompObject,
|
|
14
19
|
rootData?: unknown,
|
|
15
|
-
|
|
20
|
+
parent?: ParentContextExpression | null
|
|
16
21
|
) => any
|
|
17
22
|
|
|
18
23
|
export interface CompileOptions {
|
package/src/state/index.js
CHANGED
|
@@ -353,6 +353,20 @@ export class StatefulLayout {
|
|
|
353
353
|
return this._lastCreateStateTreeContext.nodes.findIndex(node => node.error && !node.validated) !== -1
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
/**
|
|
357
|
+
* @private
|
|
358
|
+
* @param {StateNode} node
|
|
359
|
+
* @returns {import('../compile/types.js').ParentContextExpression | null}
|
|
360
|
+
*/
|
|
361
|
+
getParentContextExpression (node) {
|
|
362
|
+
const parentNode = this._lastCreateStateTreeContext.nodes.find(n => n.fullKey === node.parentFullKey)
|
|
363
|
+
if (!parentNode) return null
|
|
364
|
+
return {
|
|
365
|
+
parent: this.getParentContextExpression(parentNode),
|
|
366
|
+
data: parentNode.data
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
356
370
|
/**
|
|
357
371
|
* @private
|
|
358
372
|
* @param {StateNode} node
|
|
@@ -360,11 +374,8 @@ export class StatefulLayout {
|
|
|
360
374
|
* @param {any} data
|
|
361
375
|
* @returns {any}
|
|
362
376
|
*/
|
|
363
|
-
evalNodeExpression
|
|
364
|
-
|
|
365
|
-
const parentNode = this._lastCreateStateTreeContext.nodes.find(n => n.fullKey === node.parentFullKey)
|
|
366
|
-
const parentData = parentNode ? parentNode.data : null
|
|
367
|
-
return evalExpression(this.compiledLayout.expressions, expression, data, node.options, new Display(node.width), node.layout, parentData, this._data)
|
|
377
|
+
evalNodeExpression (node, expression, data) {
|
|
378
|
+
return evalExpression(this.compiledLayout.expressions, expression, data, node.options, new Display(node.width), node.layout, this._data, this.getParentContextExpression(node))
|
|
368
379
|
}
|
|
369
380
|
|
|
370
381
|
/**
|
package/src/state/state-node.js
CHANGED
|
@@ -85,13 +85,12 @@ const produceStateNodeData = produce((draft, parentDataPath, children, additiona
|
|
|
85
85
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
86
86
|
if (child.data === undefined) delete draft[child.key]
|
|
87
87
|
else draft[child.key] = child.data
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (Array.isArray(draft)) {
|
|
91
|
+
// remove trailing undefined values from tuples
|
|
92
|
+
while (draft.length && draft[draft.length - 1] === undefined) {
|
|
93
|
+
draft.pop()
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
}
|
|
@@ -172,13 +171,15 @@ const matchChildError = (error, skeleton, dataPath, parentDataPath) => {
|
|
|
172
171
|
* @param {import('./utils/display.js').Display} display
|
|
173
172
|
* @param {import('@json-layout/vocabulary').BaseCompObject} layout
|
|
174
173
|
* @param {unknown} rootData
|
|
175
|
-
* @param {
|
|
174
|
+
* @param {import('../compile/types.js').ParentContextExpression | null} parentContext
|
|
176
175
|
* @returns {any}
|
|
177
176
|
*/
|
|
178
|
-
export function evalExpression (expressions, expression, data, options, display, layout, rootData,
|
|
177
|
+
export function evalExpression (expressions, expression, data, options, display, layout, rootData, parentContext) {
|
|
179
178
|
if (expression.ref === undefined) throw new Error('expression was not compiled : ' + JSON.stringify(expression))
|
|
180
179
|
const compiledExpression = expressions[expression.ref]
|
|
181
|
-
return expression.pure
|
|
180
|
+
return expression.pure
|
|
181
|
+
? compiledExpression(data, options, options.context, display, layout)
|
|
182
|
+
: compiledExpression(data, options, options.context, display, layout, rootData, parentContext)
|
|
182
183
|
}
|
|
183
184
|
|
|
184
185
|
/**
|
|
@@ -188,19 +189,19 @@ export function evalExpression (expressions, expression, data, options, display,
|
|
|
188
189
|
* @param {import('./utils/display.js').Display} display
|
|
189
190
|
* @param {unknown} data
|
|
190
191
|
* @param {unknown} rootData
|
|
191
|
-
* @param {
|
|
192
|
+
* @param {import('../compile/types.js').ParentContextExpression | null} parentContext
|
|
192
193
|
* @returns {import('@json-layout/vocabulary').BaseCompObject}
|
|
193
194
|
*/
|
|
194
|
-
const getCompObject = (normalizedLayout, options, compiledLayout, display, data, rootData,
|
|
195
|
+
const getCompObject = (normalizedLayout, options, compiledLayout, display, data, rootData, parentContext) => {
|
|
195
196
|
if (isSwitchStruct(normalizedLayout)) {
|
|
196
197
|
for (const compObject of normalizedLayout.switch) {
|
|
197
|
-
if (!compObject.if || !!evalExpression(compiledLayout.expressions, compObject.if, data, options, display, compObject,
|
|
198
|
+
if (!compObject.if || !!evalExpression(compiledLayout.expressions, compObject.if, data, options, display, compObject, rootData, parentContext)) {
|
|
198
199
|
return compObject
|
|
199
200
|
}
|
|
200
201
|
}
|
|
201
202
|
} else {
|
|
202
203
|
if (normalizedLayout.if) {
|
|
203
|
-
if (evalExpression(compiledLayout.expressions, normalizedLayout.if, data, options, display, normalizedLayout,
|
|
204
|
+
if (evalExpression(compiledLayout.expressions, normalizedLayout.if, data, options, display, normalizedLayout, rootData, parentContext)) {
|
|
204
205
|
return normalizedLayout
|
|
205
206
|
}
|
|
206
207
|
} else {
|
|
@@ -224,7 +225,7 @@ const getCompObject = (normalizedLayout, options, compiledLayout, display, data,
|
|
|
224
225
|
* @param {import('@json-layout/vocabulary').Child | null} childDefinition
|
|
225
226
|
* @param {import('./utils/display.js').Display} parentDisplay
|
|
226
227
|
* @param {unknown} data
|
|
227
|
-
* @param {
|
|
228
|
+
* @param {import('../compile/types.js').ParentContextExpression | null} parentContext
|
|
228
229
|
* @param {import('./types.js').ValidationState} validationState
|
|
229
230
|
* @param {import('./types.js').StateNode} [reusedNode]
|
|
230
231
|
* @returns {import('./types.js').StateNode}
|
|
@@ -242,7 +243,7 @@ export function createStateNode (
|
|
|
242
243
|
childDefinition,
|
|
243
244
|
parentDisplay,
|
|
244
245
|
data,
|
|
245
|
-
|
|
246
|
+
parentContext,
|
|
246
247
|
validationState,
|
|
247
248
|
reusedNode
|
|
248
249
|
) {
|
|
@@ -253,20 +254,22 @@ export function createStateNode (
|
|
|
253
254
|
// TODO: implement a cleaner way to filter context.errors while being able to reuse nodes with errors
|
|
254
255
|
if (skeleton.pure && reusedNode && !reusedNode.error && !reusedNode.childError) {
|
|
255
256
|
cacheKey = [parentOptions, compiledLayout, fullKey, skeleton, childDefinition, parentDisplay.width, validationState, context.activeItems, context.initial, data]
|
|
256
|
-
if (context.cacheKeys[fullKey] && shallowEqualArray(context.cacheKeys[fullKey], cacheKey))
|
|
257
|
+
if (context.cacheKeys[fullKey] && shallowEqualArray(context.cacheKeys[fullKey], cacheKey)) {
|
|
258
|
+
return reusedNode
|
|
259
|
+
}
|
|
257
260
|
}
|
|
258
261
|
|
|
259
262
|
const normalizedLayout = childDefinition && childIsCompObject(childDefinition)
|
|
260
263
|
? childDefinition
|
|
261
264
|
: compiledLayout.normalizedLayouts[skeleton.pointer]
|
|
262
|
-
const layout = getCompObject(normalizedLayout, parentOptions, compiledLayout, parentDisplay, data, context.rootData,
|
|
265
|
+
const layout = getCompObject(normalizedLayout, parentOptions, compiledLayout, parentDisplay, data, context.rootData, parentContext)
|
|
263
266
|
const [display, cols] = getChildDisplay(parentDisplay, childDefinition?.cols ?? layout.cols)
|
|
264
267
|
|
|
265
268
|
const options = layout.getOptions
|
|
266
269
|
? produceNodeOptions(
|
|
267
270
|
reusedNode?.options ?? /** @type {import('./types.js').StateNodeOptions} */({}),
|
|
268
271
|
parentOptions,
|
|
269
|
-
evalExpression(compiledLayout.expressions, layout.getOptions, data, parentOptions, display, layout, context.rootData,
|
|
272
|
+
evalExpression(compiledLayout.expressions, layout.getOptions, data, parentOptions, display, layout, context.rootData, parentContext)
|
|
270
273
|
)
|
|
271
274
|
: parentOptions
|
|
272
275
|
|
|
@@ -305,7 +308,7 @@ export function createStateNode (
|
|
|
305
308
|
childLayout,
|
|
306
309
|
display,
|
|
307
310
|
isSameData ? objectData : objectData[childLayout.key],
|
|
308
|
-
objectData,
|
|
311
|
+
{ parent: parentContext, data: objectData },
|
|
309
312
|
validationState,
|
|
310
313
|
reusedNode?.children?.[i]
|
|
311
314
|
)
|
|
@@ -345,7 +348,7 @@ export function createStateNode (
|
|
|
345
348
|
null,
|
|
346
349
|
display,
|
|
347
350
|
data,
|
|
348
|
-
data,
|
|
351
|
+
{ parent: parentContext, data },
|
|
349
352
|
validationState,
|
|
350
353
|
reusedNode?.children?.[0]
|
|
351
354
|
)
|
|
@@ -376,9 +379,9 @@ export function createStateNode (
|
|
|
376
379
|
null,
|
|
377
380
|
display,
|
|
378
381
|
itemData,
|
|
379
|
-
arrayData,
|
|
382
|
+
{ parent: parentContext, data: arrayData },
|
|
380
383
|
validationState,
|
|
381
|
-
reusedNode?.children?.[
|
|
384
|
+
reusedNode?.children?.[i]
|
|
382
385
|
)
|
|
383
386
|
if (child.autofocus || child.autofocusChild !== undefined) focusChild = false
|
|
384
387
|
children.push(child)
|
|
@@ -424,12 +427,12 @@ export function createStateNode (
|
|
|
424
427
|
|
|
425
428
|
if (layout.getConstData) {
|
|
426
429
|
if (!context.rehydrate) {
|
|
427
|
-
nodeData = evalExpression(compiledLayout.expressions, layout.getConstData, nodeData, options, display, layout, context.rootData,
|
|
430
|
+
nodeData = evalExpression(compiledLayout.expressions, layout.getConstData, nodeData, options, display, layout, context.rootData, parentContext)
|
|
428
431
|
}
|
|
429
432
|
} else {
|
|
430
433
|
if (layout.getDefaultData && useDefaultData(nodeData, layout, options)) {
|
|
431
434
|
if (!context.rehydrate) {
|
|
432
|
-
nodeData = evalExpression(compiledLayout.expressions, layout.getDefaultData, nodeData, options, display, layout, context.rootData,
|
|
435
|
+
nodeData = evalExpression(compiledLayout.expressions, layout.getDefaultData, nodeData, options, display, layout, context.rootData, parentContext)
|
|
433
436
|
}
|
|
434
437
|
} else {
|
|
435
438
|
if (isDataEmpty(nodeData)) {
|
|
@@ -449,7 +452,7 @@ export function createStateNode (
|
|
|
449
452
|
|
|
450
453
|
let props
|
|
451
454
|
if (layout.getProps) {
|
|
452
|
-
props = evalExpression(compiledLayout.expressions, layout.getProps, nodeData, options, display, layout, context.rootData,
|
|
455
|
+
props = evalExpression(compiledLayout.expressions, layout.getProps, nodeData, options, display, layout, context.rootData, parentContext)
|
|
453
456
|
}
|
|
454
457
|
|
|
455
458
|
const autofocus = isFocusableLayout(layout, compiledLayout.components) && !options.readOnly && !options.summary && context.autofocusTarget === fullKey
|
package/types/compile/types.d.ts
CHANGED
|
@@ -4,7 +4,11 @@ import { type ComponentInfo, type BaseCompObject, type NormalizedLayout, type St
|
|
|
4
4
|
import { type ValidateFunction, type SchemaObject } from 'ajv/dist/2019.js';
|
|
5
5
|
import { type Display } from '../state/utils/display.js';
|
|
6
6
|
import { type LocaleMessages } from '../i18n/types.js';
|
|
7
|
-
export
|
|
7
|
+
export interface ParentContextExpression {
|
|
8
|
+
data: unknown;
|
|
9
|
+
parent: ParentContextExpression | undefined | null;
|
|
10
|
+
}
|
|
11
|
+
export type CompiledExpression = (data: any, options: StateNodeOptionsBase, context: object, display: Display, layout: BaseCompObject, rootData?: unknown, parent?: ParentContextExpression | null) => any;
|
|
8
12
|
export interface CompileOptions {
|
|
9
13
|
ajv: ajvModule.default;
|
|
10
14
|
ajvOptions?: ajvModule.Options;
|
|
@@ -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,UAAU,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AACnI,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAoB,MAAM,kBAAkB,CAAA;AAC7F,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,MAAM,MAA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AAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAA;IACzB,aAAa,CAAC,EAAE,YAAY,EAAE,CAAA;CAC/B"}
|
package/types/state/index.d.ts
CHANGED
|
@@ -172,6 +172,12 @@ export class StatefulLayout {
|
|
|
172
172
|
* @returns {boolean}
|
|
173
173
|
*/
|
|
174
174
|
get hasHiddenError(): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* @private
|
|
177
|
+
* @param {StateNode} node
|
|
178
|
+
* @returns {import('../compile/types.js').ParentContextExpression | null}
|
|
179
|
+
*/
|
|
180
|
+
private getParentContextExpression;
|
|
175
181
|
/**
|
|
176
182
|
* @private
|
|
177
183
|
* @param {StateNode} node
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.js"],"names":[],"mappings":";AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,mEAAmE;AACnE,+BADkB,SAAS,GAAG,SAAS,8CACoC;AAE3E,iLAAiL;AACjL,iCADkB,SAAS,GAAG,SAAS,cAAc,OAAO,MAAM,EAAE,OAAO,yBAAyB,EAAE,aAAa,CAAC,yHACnB;AAoCjG;IAgIE;;;;;OAKG;IACH,4BALW,OAAO,aAAa,EAAE,cAAc,gBACpC,OAAO,aAAa,EAAE,YAAY,WAClC,QAAQ,qBAAqB,CAAC,SAC9B,OAAO,EAejB;IAlJD;;;OAGG;IACH,iBAFU,OAAO,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAEhD;IAEN;;;;OAIG;IACH,iCAAe;IACf,mEAAqD;IAErD;;;OAGG;IAEH,mBAAU;IACV,gDAA2C;IAE3C;;;OAGG;IACH,uBAFU,OAAO,aAA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AAY,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;4BAC7B,OAAO,YAAY,EAAE,aAAa;sBAClC,OAAO,YAAY,EAAE,OAAO;wBAjCjB,oBAAoB"}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* @param {import('./utils/display.js').Display} display
|
|
7
7
|
* @param {import('@json-layout/vocabulary').BaseCompObject} layout
|
|
8
8
|
* @param {unknown} rootData
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {import('../compile/types.js').ParentContextExpression | null} parentContext
|
|
10
10
|
* @returns {any}
|
|
11
11
|
*/
|
|
12
|
-
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, rootData: unknown,
|
|
12
|
+
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, rootData: unknown, parentContext: import('../compile/types.js').ParentContextExpression | null): any;
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
15
15
|
* @param {import('./types.js').CreateStateTreeContext} context
|
|
@@ -24,12 +24,12 @@ export function evalExpression(expressions: import('../index.js').CompiledExpres
|
|
|
24
24
|
* @param {import('@json-layout/vocabulary').Child | null} childDefinition
|
|
25
25
|
* @param {import('./utils/display.js').Display} parentDisplay
|
|
26
26
|
* @param {unknown} data
|
|
27
|
-
* @param {
|
|
27
|
+
* @param {import('../compile/types.js').ParentContextExpression | null} parentContext
|
|
28
28
|
* @param {import('./types.js').ValidationState} validationState
|
|
29
29
|
* @param {import('./types.js').StateNode} [reusedNode]
|
|
30
30
|
* @returns {import('./types.js').StateNode}
|
|
31
31
|
*/
|
|
32
|
-
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,
|
|
32
|
+
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 | undefined): import('./types.js').StateNode;
|
|
33
33
|
/** @type {(draft: any, node: import('./types.js').StateNode, data: unknown) => any} */
|
|
34
34
|
export const producePatchedData: (draft: any, node: import('./types.js').StateNode, data: unknown) => any;
|
|
35
35
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"state-node.d.ts","sourceRoot":"","sources":["../../src/state/state-node.js"],"names":[],"mappings":"AAqKA;;;;;;;;;;GAUG;AACH,4CAVW,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,YAChD,OAAO,iBACP,OAAO,qBAAqB,EAAE,uBAAuB,GAAG,IAAI,GAC1D,GAAG,CAQf;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,iBACP,OAAO,qBAAqB,EAAE,uBAAuB,GAAG,IAAI,mBAC5D,OAAO,YAAY,EAAE,eAAe,4DAElC,OAAO,YAAY,EAAE,SAAS,CA2P1C;AAED,uFAAuF;AACvF,yCADmB,GAAG,QAAQ,OAAO,YAAY,EAAE,SAAS,QAAQ,OAAO,KAAK,GAAG,CAOjF"}
|