@json-layout/core 0.30.0 → 0.31.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.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "Compilation and state management utilities for JSON Layout.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "homepage": "https://github.com/json-layout/json-layout#readme",
61
61
  "dependencies": {
62
- "@json-layout/vocabulary": "^0.22.0",
62
+ "@json-layout/vocabulary": "^0.23.0",
63
63
  "@types/markdown-it": "^13.0.1",
64
64
  "ajv": "^8.12.0",
65
65
  "ajv-errors": "^3.0.0",
@@ -1,5 +1,5 @@
1
1
  // import Debug from 'debug'
2
- import { normalizeLayoutFragment, isSwitchStruct, isGetItemsExpression, isGetItemsFetch, isItemsLayout, getSchemaFragmentType } from '@json-layout/vocabulary'
2
+ import { normalizeLayoutFragment, isSwitchStruct, isGetItemsExpression, isGetItemsFetch, isItemsLayout, getSchemaFragmentType, isCompositeLayout } from '@json-layout/vocabulary'
3
3
  import { makeSkeletonTree } from './skeleton-tree.js'
4
4
  import { partialResolveRefs } from './utils/resolve-refs.js'
5
5
 
@@ -52,12 +52,14 @@ export function makeSkeletonNode (
52
52
  delete schema.$ref
53
53
  }
54
54
  const resolvedSchema = partialResolveRefs(schema, schemaId, getJSONRef)
55
- const { type, nullable } = knownType ? { type: knownType, nullable: false } : getSchemaFragmentType(resolvedSchema)
55
+ let { type, nullable } = getSchemaFragmentType(resolvedSchema)
56
+ if (knownType) type = knownType
56
57
 
57
58
  // improve on ajv error messages based on ajv-errors (https://ajv.js.org/packages/ajv-errors.html)
58
59
  rawSchema.errorMessage = rawSchema.errorMessage ?? {}
59
60
  if (!normalizedLayouts[pointer]) {
60
61
  const normalizationResult = normalizeLayoutFragment(
62
+ key,
61
63
  /** @type {import('@json-layout/vocabulary').SchemaFragment} */(resolvedSchema),
62
64
  pointer,
63
65
  options.components,
@@ -74,14 +76,6 @@ export function makeSkeletonNode (
74
76
  }
75
77
  const normalizedLayout = normalizedLayouts[pointer]
76
78
 
77
- let defaultData
78
- if ('default' in schema) defaultData = schema.default
79
- else if (required) {
80
- if (nullable) defaultData = null
81
- else if (type === 'object') defaultData = {}
82
- else if (type === 'array') defaultData = []
83
- }
84
-
85
79
  let pure = !dependent
86
80
  /**
87
81
  * @param {import('@json-layout/vocabulary').Expression[]} expressions
@@ -106,6 +100,13 @@ export function makeSkeletonNode (
106
100
  if (compObject.constData !== undefined && !compObject.getConstData) compObject.getConstData = { type: 'js-eval', expr: 'layout.constData', pure: true, dataAlias: 'value' }
107
101
  if (compObject.getConstData) pushExpression(expressions, compObject.getConstData)
108
102
 
103
+ let defaultData
104
+ if ('default' in schema) defaultData = schema.default
105
+ else if (required) {
106
+ if (nullable) defaultData = null
107
+ else if (type === 'object' && isCompositeLayout(compObject, options.components)) defaultData = {}
108
+ else if (type === 'array') defaultData = []
109
+ }
109
110
  if (defaultData !== undefined && compObject.defaultData === undefined) compObject.defaultData = defaultData
110
111
  if (compObject.defaultData !== undefined && !compObject.getDefaultData) compObject.getDefaultData = { type: 'js-eval', expr: 'layout.defaultData', pure: true, dataAlias: 'value' }
111
112
  if (compObject.getDefaultData) pushExpression(expressions, compObject.getDefaultData)
@@ -246,6 +247,7 @@ export function makeSkeletonNode (
246
247
  const oneOfPointer = `${pointer}/oneOf`
247
248
  if (!normalizedLayouts[oneOfPointer]) {
248
249
  const normalizationResult = normalizeLayoutFragment(
250
+ '',
249
251
  schema,
250
252
  oneOfPointer,
251
253
  options.components,
@@ -262,7 +264,6 @@ export function makeSkeletonNode (
262
264
  }
263
265
  /** @type {string[]} */
264
266
  const childrenTrees = []
265
- /** @type {string[]} */
266
267
  for (let i = 0; i < schema.oneOf.length; i++) {
267
268
  if (!schema.oneOf[i].type) schema.oneOf[i].type = type
268
269
  const title = schema.oneOf[i].title ?? `option ${i}`
@@ -294,7 +295,7 @@ export function makeSkeletonNode (
294
295
  pointer: oneOfPointer,
295
296
  refPointer: oneOfPointer,
296
297
  childrenTrees,
297
- pure: skeletonNodes[skeletonTrees[childrenTrees[0]]?.root].pure,
298
+ pure: !childrenTrees.some(childTree => !skeletonNodes[skeletonTrees[childTree]?.root].pure),
298
299
  propertyKeys: [],
299
300
  roPropertyKeys: []
300
301
  }
@@ -302,6 +303,71 @@ export function makeSkeletonNode (
302
303
  node.children = node.children ?? []
303
304
  node.children.push(oneOfPointer)
304
305
  }
306
+ if (schema.patternProperties) {
307
+ const patternPropertiesPointer = `${pointer}/patternProperties`
308
+ if (!normalizedLayouts[patternPropertiesPointer]) {
309
+ const normalizationResult = normalizeLayoutFragment(
310
+ '',
311
+ schema,
312
+ patternPropertiesPointer,
313
+ options.components,
314
+ options.markdown,
315
+ options.optionsKeys,
316
+ 'patternProperties',
317
+ type,
318
+ nullable
319
+ )
320
+ normalizedLayouts[patternPropertiesPointer] = normalizationResult.layout
321
+ if (normalizationResult.errors.length) {
322
+ validationErrors[patternPropertiesPointer.replace('_jl#', '/')] = normalizationResult.errors
323
+ }
324
+ }
325
+ /** @type {string[]} */
326
+ const childrenTrees = []
327
+ for (const pattern of Object.keys(schema.patternProperties)) {
328
+ const childTreePointer = `${patternPropertiesPointer}/${pattern}`
329
+ if (!skeletonTrees[childTreePointer]) {
330
+ // @ts-ignore
331
+ skeletonTrees[childTreePointer] = 'recursing'
332
+ skeletonTrees[childTreePointer] = makeSkeletonTree(
333
+ schema.patternProperties[pattern],
334
+ schemaId,
335
+ options,
336
+ getJSONRef,
337
+ skeletonTrees,
338
+ skeletonNodes,
339
+ validates,
340
+ validationErrors,
341
+ normalizedLayouts,
342
+ expressions,
343
+ childTreePointer,
344
+ 'pattern ' + pattern
345
+ )
346
+ const childLayout = normalizedLayouts[skeletonNodes[skeletonTrees[childTreePointer].root].pointer]
347
+ if (isSwitchStruct(childLayout)) {
348
+ for (const switchCase of childLayout.switch) {
349
+ switchCase.nullable = true
350
+ }
351
+ } else {
352
+ childLayout.nullable = true
353
+ }
354
+ }
355
+ childrenTrees.push(childTreePointer)
356
+ }
357
+ if (!skeletonNodes[patternPropertiesPointer]) {
358
+ skeletonNodes[patternPropertiesPointer] = {
359
+ key: '$patternProperties',
360
+ pointer: patternPropertiesPointer,
361
+ refPointer: patternPropertiesPointer,
362
+ childrenTrees,
363
+ pure: !childrenTrees.some(childTree => !skeletonNodes[skeletonTrees[childTree]?.root].pure),
364
+ propertyKeys: [],
365
+ roPropertyKeys: []
366
+ }
367
+ }
368
+ node.children = node.children ?? []
369
+ node.children.push(patternPropertiesPointer)
370
+ }
305
371
  if (schema.if) {
306
372
  validates.push(`${pointer}/if`)
307
373
  if (schema.then) {
@@ -420,6 +486,14 @@ export function makeSkeletonNode (
420
486
  )
421
487
  }
422
488
  node.childrenTrees = [childTreePointer]
489
+ const childLayout = normalizedLayouts[skeletonNodes[skeletonTrees[childTreePointer].root].pointer]
490
+ if (isSwitchStruct(childLayout)) {
491
+ for (const switchCase of childLayout.switch) {
492
+ switchCase.nullable = true
493
+ }
494
+ } else {
495
+ childLayout.nullable = true
496
+ }
423
497
  }
424
498
  }
425
499
 
@@ -8,6 +8,7 @@ import { isGetItemsExpression, isGetItemsFetch, isItemsLayout } from '@json-layo
8
8
  import { shallowProduceArray } from './utils/immutable.js'
9
9
 
10
10
  export { Display } from './utils/display.js'
11
+ export { getRegexp } from './utils/regexps.js'
11
12
 
12
13
  /**
13
14
  * @typedef {import('./types.js').StateNode} StateNode
@@ -1,8 +1,9 @@
1
- import { isSwitchStruct, childIsCompObject, isCompositeLayout, isFocusableLayout, isItemsLayout, isGetItemsExpression, isGetItemsFetch } from '@json-layout/vocabulary'
1
+ import { isSwitchStruct, childIsCompObject, isCompositeLayout, isFocusableLayout, isItemsLayout, isGetItemsExpression, isGetItemsFetch, isListLayout } from '@json-layout/vocabulary'
2
2
  import { produce } from 'immer'
3
3
  import debug from 'debug'
4
4
  import { getChildDisplay } from './utils/display.js'
5
5
  import { shallowEqualArray, shallowProduceArray, shallowProduceObject } from './utils/immutable.js'
6
+ import { getRegexp } from './utils/regexps.js'
6
7
 
7
8
  const logStateNode = debug('jl:state-node')
8
9
 
@@ -114,12 +115,6 @@ const produceStateNodeData = produce((draft, parentDataPath, children, additiona
114
115
  else draft[child.key] = child.data
115
116
  }
116
117
  }
117
- if (Array.isArray(draft)) {
118
- // remove trailing undefined values from tuples
119
- while (draft.length && draft[draft.length - 1] === undefined) {
120
- draft.pop()
121
- }
122
- }
123
118
  }
124
119
 
125
120
  if (additionalPropertiesErrors) {
@@ -135,6 +130,18 @@ const produceStateNodeData = produce((draft, parentDataPath, children, additiona
135
130
  }
136
131
  })
137
132
 
133
+ /** @type {(draft: Record<string, unknown>, parentData: Record<string, unknown>, propertyKeys: string[], patterns: string[]) => Record<string, unknown>} */
134
+ const producePatternPropertiesData = produce((draft, parentData, propertyKeys, patterns) => {
135
+ for (const key of Object.keys(parentData)) {
136
+ if (propertyKeys.includes(key)) continue
137
+ if (!patterns.some(p => !!key.match(getRegexp(p)))) continue
138
+ draft[key] = parentData[key]
139
+ }
140
+ for (const key of Object.keys(draft)) {
141
+ if (!(key in parentData)) delete draft[key]
142
+ }
143
+ })
144
+
138
145
  /** @type {(draft: import('./types.js').StateNodeOptions, parentNodeOptions: import('./types.js').StateNodeOptions, nodeOptions: Partial<import('./types.js').StateNodeOptions> | undefined) => import('./types.js').StateNodeOptions} */
139
146
  const produceNodeOptions = produce((draft, parentNodeOptions, nodeOptions = {}) => {
140
147
  for (const key in parentNodeOptions) {
@@ -364,9 +371,19 @@ export function createStateNode (
364
371
  continue
365
372
  }
366
373
  }
367
- const isSameData = typeof childLayout.key === 'string' && childLayout.key.startsWith('$')
374
+ const isSameDataPath = typeof childLayout.key === 'string' && childLayout.key.startsWith('$')
368
375
  const childFullKey = `${fullKey}/${childLayout.key}`
369
376
  if (focusChild) context.autofocusTarget = childFullKey
377
+ let childData = isSameDataPath ? objectData : objectData[childLayout.key]
378
+ if (childLayout.key === '$patternProperties') {
379
+ const childNormalizedLayout = /** @type {import('@json-layout/vocabulary').List} */(compiledLayout.normalizedLayouts[childSkeleton.pointer])
380
+ childData = producePatternPropertiesData(
381
+ /** @type {Record<string, unknown>} */(reusedNode?.children?.find(c => c.key === '$patternProperties')?.data ?? {}),
382
+ /** @type {Record<string, unknown>} */(objectData),
383
+ skeleton.propertyKeys,
384
+ childNormalizedLayout.indexed ?? []
385
+ )
386
+ }
370
387
  const child = createStateNode(
371
388
  context,
372
389
  childrenOptions,
@@ -374,12 +391,12 @@ export function createStateNode (
374
391
  childLayout.key,
375
392
  childFullKey,
376
393
  fullKey,
377
- isSameData ? dataPath : `${dataPath}/${childLayout.key}`,
394
+ isSameDataPath ? dataPath : `${dataPath}/${childLayout.key}`,
378
395
  dataPath,
379
396
  childSkeleton,
380
397
  childLayout,
381
398
  display,
382
- isSameData ? objectData : objectData[childLayout.key],
399
+ childData,
383
400
  { parent: parentContext, data: objectData },
384
401
  validationState,
385
402
  reusedNode?.children?.find(c => c.fullKey === childFullKey)
@@ -391,8 +408,7 @@ export function createStateNode (
391
408
 
392
409
  if (key === '$oneOf' && skeleton.childrenTrees) {
393
410
  // find the oneOf child that was either previously selected, if none were selected select the child that is valid with current data
394
- /** @type {number} */
395
- const activeChildTreeIndex = fullKey in context.activatedItems ? context.activatedItems[fullKey] : skeleton.childrenTrees?.findIndex((childTree) => compiledLayout.validates[compiledLayout.skeletonTrees[childTree].root](data))
411
+ const activeChildTreeIndex = /** @type {number} */(fullKey in context.activatedItems ? context.activatedItems[fullKey] : skeleton.childrenTrees?.findIndex((childTree) => compiledLayout.validates[compiledLayout.skeletonTrees[childTree].root](data)))
396
412
  if (activeChildTreeIndex !== -1) {
397
413
  context.errors = context.errors?.filter(error => {
398
414
  const originalError = error.params?.errors?.[0] ?? error
@@ -432,35 +448,82 @@ export function createStateNode (
432
448
  }
433
449
  }
434
450
 
435
- if (layout.comp === 'list') {
436
- const arrayData = /** @type {unknown[]} */(data ?? [])
437
- const childSkeleton = /** @type {import('../index.js').SkeletonNode} */(skeleton?.childrenTrees?.[0] && compiledLayout.skeletonNodes[compiledLayout.skeletonTrees[skeleton?.childrenTrees?.[0]]?.root])
438
- const listItemOptions = layout.listEditMode === 'inline' ? options : produceReadonlyArrayItemOptions(options)
439
- children = []
440
- let focusChild = context.autofocusTarget === fullKey
441
- for (let i = 0; i < arrayData.length; i++) {
442
- const itemData = arrayData[i]
443
- const childFullKey = `${fullKey}/${i}`
444
- if (focusChild) context.autofocusTarget = childFullKey
445
- const child = createStateNode(
446
- context,
447
- (layout.listEditMode === 'inline-single' && context.activatedItems[fullKey] === i) ? options : listItemOptions,
448
- compiledLayout,
449
- i,
450
- childFullKey,
451
- fullKey,
452
- `${dataPath}/${i}`,
453
- dataPath,
454
- childSkeleton,
455
- null,
456
- display,
457
- itemData,
458
- { parent: parentContext, data: arrayData },
459
- validationState,
460
- reusedNode?.children?.[i]
461
- )
462
- if (child.autofocus || child.autofocusChild !== undefined) focusChild = false
463
- children.push(child)
451
+ if (isListLayout(layout)) {
452
+ if (layout.indexed) {
453
+ const objectData = /** @type {Record<string, unknown>} */(data ?? [])
454
+ const listItemOptions = layout.listEditMode === 'inline' ? options : produceReadonlyArrayItemOptions(options)
455
+ children = []
456
+ let focusChild = context.autofocusTarget === fullKey
457
+ const childrenKeys = Object.keys(objectData)
458
+ for (let i = 0; i < childrenKeys.length; i++) {
459
+ const childKey = childrenKeys[i]
460
+ let valueChildSkeleton = /** @type {import('../index.js').SkeletonNode | null} */ null
461
+ if (skeleton?.childrenTrees?.length === 1) {
462
+ valueChildSkeleton = compiledLayout.skeletonNodes[compiledLayout.skeletonTrees[skeleton?.childrenTrees[0]]?.root]
463
+ } else {
464
+ for (let p = 0; p < layout.indexed.length; p++) {
465
+ const pattern = layout.indexed[p]
466
+ const childTreeKey = skeleton?.childrenTrees?.[p]
467
+ if (!childTreeKey) throw new Error(`missing skeleton tree for pattern ${pattern}`)
468
+ if (childKey.match(getRegexp(pattern))) {
469
+ valueChildSkeleton = compiledLayout.skeletonNodes[compiledLayout.skeletonTrees[childTreeKey]?.root]
470
+ }
471
+ }
472
+ }
473
+ if (valueChildSkeleton) {
474
+ const childFullKey = `${fullKey}/${childKey}`
475
+ if (focusChild) context.autofocusTarget = childFullKey
476
+ const valueChild = createStateNode(
477
+ context,
478
+ (layout.listEditMode === 'inline-single' && context.activatedItems[fullKey] === i) ? options : listItemOptions,
479
+ compiledLayout,
480
+ childKey,
481
+ childFullKey,
482
+ fullKey,
483
+ `${dataPath}/${childKey}`,
484
+ dataPath,
485
+ valueChildSkeleton,
486
+ null,
487
+ display,
488
+ objectData[childKey],
489
+ { parent: parentContext, data: objectData },
490
+ validationState,
491
+ reusedNode?.children?.find(c => c.key === childKey)
492
+ )
493
+ if (valueChild.autofocus || valueChild.autofocusChild !== undefined) focusChild = false
494
+ children.push(valueChild)
495
+ }
496
+ }
497
+ } else {
498
+ const arrayData = /** @type {unknown[]} */(data ?? [])
499
+ const childSkeleton = /** @type {import('../index.js').SkeletonNode} */(skeleton?.childrenTrees?.[0] && compiledLayout.skeletonNodes[compiledLayout.skeletonTrees[skeleton?.childrenTrees?.[0]]?.root])
500
+ const listItemOptions = layout.listEditMode === 'inline' ? options : produceReadonlyArrayItemOptions(options)
501
+ children = []
502
+ let focusChild = context.autofocusTarget === fullKey
503
+ for (let i = 0; i < arrayData.length; i++) {
504
+ const itemData = arrayData[i]
505
+ const childFullKey = `${fullKey}/${i}`
506
+ if (focusChild) context.autofocusTarget = childFullKey
507
+ const child = createStateNode(
508
+ context,
509
+ (layout.listEditMode === 'inline-single' && context.activatedItems[fullKey] === i) ? options : listItemOptions,
510
+ compiledLayout,
511
+ i,
512
+ childFullKey,
513
+ fullKey,
514
+ `${dataPath}/${i}`,
515
+ dataPath,
516
+ childSkeleton,
517
+ null,
518
+ display,
519
+ itemData,
520
+ { parent: parentContext, data: arrayData },
521
+ validationState,
522
+ reusedNode?.children?.[i]
523
+ )
524
+ if (child.autofocus || child.autofocusChild !== undefined) focusChild = false
525
+ children.push(child)
526
+ }
464
527
  }
465
528
  }
466
529
 
@@ -487,7 +550,7 @@ export function createStateNode (
487
550
  (validationState.initialized === false && options.initialValidation === 'always') ||
488
551
  (validationState.initialized === false && options.initialValidation === 'withData' && !isDataEmpty(nodeData))
489
552
 
490
- if (typeof children?.[0]?.key === 'number' && layout.comp !== 'one-of-select') {
553
+ if (typeof children?.[0]?.key === 'number' && layout.comp !== 'one-of-select' && !layout.indexed) {
491
554
  // case of an array of children nodes
492
555
  nodeData = produceStateNodeDataChildrenArray(
493
556
  /** @type {unknown[]} */(nodeData ?? []),
@@ -506,12 +569,13 @@ export function createStateNode (
506
569
  )
507
570
  } else if ((typeof nodeData === 'object' || (nodeData === undefined && children?.length)) && !(nodeData instanceof File)) {
508
571
  // case of an object base on children nodes or not
572
+ const removeAdditional = [true, 'unknown'].includes(options.removeAdditional) || children?.some(c => c.key === '$patternProperties')
509
573
  nodeData = produceStateNodeData(
510
574
  /** @type {Record<string, unknown>} */(nodeData ?? {}),
511
575
  dataPath,
512
576
  children,
513
577
  context.additionalPropertiesErrors,
514
- [true, 'unknown'].includes(options.removeAdditional) ? skeleton.propertyKeys : undefined,
578
+ removeAdditional ? skeleton.propertyKeys : undefined,
515
579
  options.readOnlyPropertiesMode === 'remove' ? skeleton.roPropertyKeys : undefined
516
580
  )
517
581
  }
@@ -613,6 +677,15 @@ export function createStateNode (
613
677
  export const producePatchedData = produce((draft, node, data) => {
614
678
  if (node.dataPath === node.parentDataPath) {
615
679
  Object.assign(draft, data)
680
+
681
+ // remove properties that previously came from this merged child and were removed
682
+ if (node.data && typeof data === 'object' && data !== null) {
683
+ for (const key of Object.keys(node.data)) {
684
+ if (!(key in data)) {
685
+ delete draft[key]
686
+ }
687
+ }
688
+ }
616
689
  } else {
617
690
  draft[node.key] = data
618
691
  }
@@ -0,0 +1,11 @@
1
+ /** @type {Record<string, RegExp>} */
2
+ const cache = {}
3
+
4
+ /**
5
+ * @param {string} str
6
+ * @returns {RegExp}
7
+ */
8
+ export function getRegexp (str) {
9
+ cache[str] = cache[str] ?? new RegExp(str)
10
+ return cache[str]
11
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"skeleton-node.d.ts","sourceRoot":"","sources":["../../src/compile/skeleton-node.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;GAkBG;AACH,4CAlBW,GAAG,kBACH,MAAM,WACN,OAAO,YAAY,EAAE,cAAc,yBACxB,MAAM,OAAO,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,iBACxD,OAAO,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,iBACjD,OAAO,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,aACjD,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,YACN,OAAO,oGAIL,OAAO,YAAY,EAAE,YAAY,CA4Z7C"}
1
+ {"version":3,"file":"skeleton-node.d.ts","sourceRoot":"","sources":["../../src/compile/skeleton-node.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;GAkBG;AACH,4CAlBW,GAAG,kBACH,MAAM,WACN,OAAO,YAAY,EAAE,cAAc,yBACxB,MAAM,OAAO,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,iBACxD,OAAO,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,iBACjD,OAAO,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,aACjD,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,YACN,OAAO,oGAIL,OAAO,YAAY,EAAE,YAAY,CAse7C"}
@@ -1,4 +1,5 @@
1
1
  export { Display } from "./utils/display.js";
2
+ export { getRegexp } from "./utils/regexps.js";
2
3
  /**
3
4
  * @typedef {import('./types.js').StateNode} StateNode
4
5
  * @typedef {import('./types.js').StateTree} StateTree
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.js"],"names":[],"mappings":";AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;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;IA0HE;;;;;OAKG;IACH,4BALW,OAAO,aAAa,EAAE,cAAc,gBACpC,OAAO,aAAa,EAAE,YAAY,WAClC,QAAQ,qBAAqB,CAAC,SAC9B,OAAO,EAejB;IA5ID;;;;OAIG;IACH,iCAAe;IACf,mEAAqD;IAErD;;;OAGG;IAEH,mBAAU;IACV,gDAA2C;IAE3C;;;OAGG;IACH,uBAFU,OAAO,aAAa,EAAE,YAAY,CAEhC;IAEZ;;;OAGG;IAEH,iBAAQ;IACR,uBAAuC;IAEvC;;;OAGG;IAEH,yBAAgB;IAQhB;;;OAGG;IACH,+DAOC;IAlBD;;OAEG;IACH,4DAEC;IAeD;;;OAGG;IAEH,iBAAQ;IAKR;;OAEG;IACH,6DAGC;IAVD;;OAEG;IACH,0DAAuC;IASvC;;;OAGG;IACH,cAAK;IAEL,uBAIC;IALD,oBAAiC;IAOjC;;;OAGG;IACH,sBAAa;IAEb;;;OAGG;IACH,4BAA2B;IAE3B;;;OAGG;IAEH,oCAA2B;I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B,OAAO,YAAY,EAAE,OAAO;wBArCjB,oBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"state-node.d.ts","sourceRoot":"","sources":["../../src/state/state-node.js"],"names":[],"mappings":"AAyMA;;;;;;;;;;;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,OAAO,MAAM,EAAE,OAAO,KAAK,EAAE,gBAAgB,CAAC,YAC9C,OAAO,iBACP,OAAO,qBAAqB,EAAE,uBAAuB,GAAG,IAAI,GAC1D,GAAG,CAsBf;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,CAwU1C;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":"AAgNA;;;;;;;;;;;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,OAAO,MAAM,EAAE,OAAO,KAAK,EAAE,gBAAgB,CAAC,YAC9C,OAAO,iBACP,OAAO,qBAAqB,EAAE,uBAAuB,GAAG,IAAI,GAC1D,GAAG,CAsBf;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,CAiY1C;AAED,uFAAuF;AACvF,yCADmB,GAAG,QAAQ,OAAO,YAAY,EAAE,SAAS,QAAQ,OAAO,KAAK,GAAG,CAgBjF"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {string} str
3
+ * @returns {RegExp}
4
+ */
5
+ export function getRegexp(str: string): RegExp;
6
+ //# sourceMappingURL=regexps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regexps.d.ts","sourceRoot":"","sources":["../../../src/state/utils/regexps.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,+BAHW,MAAM,GACJ,MAAM,CAKlB"}