@json-layout/core 1.12.3 → 1.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/package.json +1 -1
  2. package/src/compile/skeleton-node.js +11 -6
  3. package/src/state/index.js +10 -4
  4. package/src/state/state-node.js +30 -10
  5. package/types/compile/index.d.ts +0 -16
  6. package/types/compile/index.d.ts.map +0 -1
  7. package/types/compile/options.d.ts +0 -6
  8. package/types/compile/options.d.ts.map +0 -1
  9. package/types/compile/serialize.d.ts +0 -6
  10. package/types/compile/serialize.d.ts.map +0 -1
  11. package/types/compile/skeleton-node.d.ts +0 -21
  12. package/types/compile/skeleton-node.d.ts.map +0 -1
  13. package/types/compile/skeleton-tree.d.ts +0 -19
  14. package/types/compile/skeleton-tree.d.ts.map +0 -1
  15. package/types/compile/types.d.ts +0 -62
  16. package/types/compile/types.d.ts.map +0 -1
  17. package/types/compile/utils/resolve-refs.d.ts +0 -17
  18. package/types/compile/utils/resolve-refs.d.ts.map +0 -1
  19. package/types/compile/utils/x-i18n.d.ts +0 -2
  20. package/types/compile/utils/x-i18n.d.ts.map +0 -1
  21. package/types/i18n/de.d.ts +0 -41
  22. package/types/i18n/de.d.ts.map +0 -1
  23. package/types/i18n/en.d.ts +0 -41
  24. package/types/i18n/en.d.ts.map +0 -1
  25. package/types/i18n/fr.d.ts +0 -41
  26. package/types/i18n/fr.d.ts.map +0 -1
  27. package/types/i18n/index.d.ts +0 -8
  28. package/types/i18n/index.d.ts.map +0 -1
  29. package/types/i18n/nl.d.ts +0 -41
  30. package/types/i18n/nl.d.ts.map +0 -1
  31. package/types/i18n/types.d.ts +0 -40
  32. package/types/i18n/types.d.ts.map +0 -1
  33. package/types/index.d.ts +0 -5
  34. package/types/index.d.ts.map +0 -1
  35. package/types/state/index.d.ts +0 -285
  36. package/types/state/index.d.ts.map +0 -1
  37. package/types/state/options.d.ts +0 -11
  38. package/types/state/options.d.ts.map +0 -1
  39. package/types/state/state-node.d.ts +0 -39
  40. package/types/state/state-node.d.ts.map +0 -1
  41. package/types/state/state-tree.d.ts +0 -13
  42. package/types/state/state-tree.d.ts.map +0 -1
  43. package/types/state/types.d.ts +0 -191
  44. package/types/state/types.d.ts.map +0 -1
  45. package/types/state/utils/display.d.ts +0 -51
  46. package/types/state/utils/display.d.ts.map +0 -1
  47. package/types/state/utils/immutable.d.ts +0 -21
  48. package/types/state/utils/immutable.d.ts.map +0 -1
  49. package/types/state/utils/regexps.d.ts +0 -6
  50. package/types/state/utils/regexps.d.ts.map +0 -1
  51. package/types/state/utils/urls.d.ts +0 -2
  52. package/types/state/utils/urls.d.ts.map +0 -1
  53. package/types/utils/build.d.ts +0 -5
  54. package/types/utils/build.d.ts.map +0 -1
  55. package/types/utils/clone.d.ts +0 -2
  56. package/types/utils/clone.d.ts.map +0 -1
  57. package/types/utils/doc-options.d.ts +0 -14
  58. package/types/utils/doc-options.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@json-layout/core",
3
- "version": "1.12.3",
3
+ "version": "1.12.5",
4
4
  "description": "Compilation and state management utilities for JSON Layout.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -45,13 +45,20 @@ export function makeSkeletonNode (
45
45
  let schema = rawSchema
46
46
  let refPointer = pointer
47
47
  let refFragment
48
+
49
+ // improve on ajv error messages based on ajv-errors (https://ajv.js.org/packages/ajv-errors.html)
50
+ let errorMessage = rawSchema.errorMessage
51
+
48
52
  rawSchema.__pointer = pointer
49
53
  if (schema.$ref) {
50
54
  [refFragment, schemaId, refPointer] = getJSONRef(sourceSchemaId, schema.$ref)
51
55
  refFragment.__pointer = refPointer
52
56
  schema = { ...rawSchema, ...refFragment }
57
+ if (errorMessage && refFragment.errorMessage) throw new Error('errorMessage cannot be defined both on ref source and target')
58
+ errorMessage = refFragment.errorMessage = refFragment.errorMessage ?? errorMessage ?? {}
53
59
  delete schema.$ref
54
60
  }
61
+ errorMessage = rawSchema.errorMessage = errorMessage ?? {}
55
62
  const nullableType = mergeNullableSubSchema(schema)
56
63
  if (nullableType) {
57
64
  schema = nullableType
@@ -63,8 +70,6 @@ export function makeSkeletonNode (
63
70
  if (knownType) type = knownType
64
71
  if (nullableType) nullable = true
65
72
 
66
- // improve on ajv error messages based on ajv-errors (https://ajv.js.org/packages/ajv-errors.html)
67
- rawSchema.errorMessage = rawSchema.errorMessage ?? {}
68
73
  if (!normalizedLayouts[pointer]) {
69
74
  const normalizationResult = normalizeLayoutFragment(
70
75
  key,
@@ -192,7 +197,7 @@ export function makeSkeletonNode (
192
197
  }
193
198
 
194
199
  if (schema.oneOf) {
195
- rawSchema.errorMessage.oneOf = options.messages.errorOneOf
200
+ errorMessage.oneOf = options.messages.errorOneOf
196
201
  }
197
202
 
198
203
  if (type === 'object') {
@@ -472,11 +477,11 @@ export function makeSkeletonNode (
472
477
 
473
478
  for (const propertyKey of node.propertyKeys) {
474
479
  if (schema?.required?.includes(propertyKey)) {
475
- rawSchema.errorMessage.required = rawSchema.errorMessage.required ?? {}
476
- rawSchema.errorMessage.required[propertyKey] = options.messages.errorRequired
480
+ errorMessage.required = rawSchema.errorMessage.required ?? {}
481
+ errorMessage.required[propertyKey] = options.messages.errorRequired
477
482
  }
478
483
  if (schema.dependentRequired && Object.keys(schema.dependentRequired).includes(propertyKey)) {
479
- rawSchema.errorMessage.dependentRequired = options.messages.errorRequired
484
+ errorMessage.dependentRequired = options.messages.errorRequired
480
485
  }
481
486
  }
482
487
  }
@@ -305,9 +305,8 @@ export class StatefulLayout {
305
305
  )
306
306
  this._lastCreateStateTreeContext = createStateTreeContext
307
307
  if (!this.validationState.initialized) {
308
- this._validationState = {
308
+ this.validationState = {
309
309
  initialized: true,
310
- validatedForm: this._validationState.validatedForm,
311
310
  validatedChildren: createStateTreeContext.nodes.filter(n => n.validated).map(n => n.fullKey)
312
311
  }
313
312
  }
@@ -330,6 +329,7 @@ export class StatefulLayout {
330
329
  }
331
330
 
332
331
  validate () {
332
+ if (this.validationState.validatedForm) return
333
333
  this.validationState = { validatedForm: true }
334
334
  this.updateState()
335
335
  }
@@ -467,6 +467,11 @@ export class StatefulLayout {
467
467
  input (node, data, activateKey) {
468
468
  logDataBinding('received input event from node', node, data, activateKey)
469
469
 
470
+ if (node.layout.comp === 'list') {
471
+ // a input of the whole list signals potential reordering, deactivate all items otherwise the keys might be mixed up
472
+ this.deactivateItem(node, true)
473
+ }
474
+
470
475
  // debounced data from the same node is cancelled if a new input is received
471
476
  // debounced data from another node is applied immediately
472
477
  if (this.debouncedInput) {
@@ -701,8 +706,9 @@ export class StatefulLayout {
701
706
 
702
707
  /**
703
708
  * @param {StateNode} node
709
+ * @param {boolean} skipUpdateState
704
710
  */
705
- deactivateItem (node) {
711
+ deactivateItem (node, skipUpdateState = false) {
706
712
  logActivatedItems(node.fullKey, 'deactivate item explicitly')
707
713
  // also deactivate children oneOf for example
708
714
  this.activatedItems = produce(this.activatedItems, draft => {
@@ -713,7 +719,7 @@ export class StatefulLayout {
713
719
  }
714
720
  }
715
721
  })
716
- this.updateState()
722
+ if (!skipUpdateState) this.updateState()
717
723
  }
718
724
 
719
725
  handleAutofocus () {
@@ -129,7 +129,7 @@ const produceStateNodeData = produce((draft, parentDataPath, children, additiona
129
129
  }
130
130
  }
131
131
 
132
- if (additionalPropertiesErrors) {
132
+ if (additionalPropertiesErrors?.length) {
133
133
  for (const error of additionalPropertiesErrors) {
134
134
  if (error.instancePath !== parentDataPath) continue
135
135
  if (error.keyword === 'additionalProperties') {
@@ -233,6 +233,17 @@ const matchChildError = (compiledLayout, error, skeleton, dataPath, parentDataPa
233
233
  return false
234
234
  }
235
235
 
236
+ /**
237
+ * should match any error related to the data node not matter the origin in the schema
238
+ * @param {import('ajv').ErrorObject} error
239
+ * @param {string} dataPath
240
+ * @returns {boolean}
241
+ */
242
+ const matchDataPathError = (error, dataPath) => {
243
+ const originalError = error.params?.errors?.[0] ?? error
244
+ return originalError.instancePath.startsWith(dataPath)
245
+ }
246
+
236
247
  /**
237
248
  * should match if an error belongs to a child of the current node but the child was not displayed
238
249
  * @param {import('ajv').ErrorObject} error
@@ -240,13 +251,14 @@ const matchChildError = (compiledLayout, error, skeleton, dataPath, parentDataPa
240
251
  * @param {string} pointer2
241
252
  * @param {string} dataPath
242
253
  * @param {string | null} parentDataPath
254
+ * @param debug
243
255
  * @returns {boolean}
244
256
  */
245
257
  const matchPointerError = (error, pointer1, pointer2, dataPath, parentDataPath) => {
246
258
  const originalError = error.params?.errors?.[0] ?? error
247
259
  if (!originalError.instancePath.startsWith(dataPath)) return false
248
260
  if (originalError.schemaPath === pointer1 ||
249
- originalError.schemaPath.startsWith(pointer2 + '/') ||
261
+ originalError.schemaPath.startsWith(pointer1 + '/') ||
250
262
  originalError.schemaPath === pointer2 ||
251
263
  originalError.schemaPath.startsWith(pointer2 + '/')
252
264
  ) return true
@@ -478,11 +490,12 @@ export function createStateNode (
478
490
  // or the one matching the specified discriminator
479
491
  // or the one that is valid with current data
480
492
  let activeChildTreeIndex = /** @type {number} */context.activatedItems[fullKey]
493
+ const validChildTreeIndex = skeleton.childrenTrees?.findIndex((childTree) => compiledLayout.validates[compiledLayout.skeletonTrees[childTree].refPointer](data))
481
494
  if (activeChildTreeIndex === undefined) {
482
- if (skeleton.discriminator !== undefined) {
495
+ if (skeleton.discriminator !== undefined && validChildTreeIndex === -1) {
483
496
  activeChildTreeIndex = skeleton.childrenTrees?.findIndex((childTree) => skeleton.discriminator !== undefined && data?.[skeleton.discriminator] !== undefined && data[skeleton.discriminator] === compiledLayout.skeletonTrees[childTree].discriminatorValue)
484
497
  } else {
485
- activeChildTreeIndex = skeleton.childrenTrees?.findIndex((childTree) => compiledLayout.validates[compiledLayout.skeletonTrees[childTree].refPointer](data))
498
+ activeChildTreeIndex = validChildTreeIndex
486
499
  }
487
500
  }
488
501
 
@@ -501,16 +514,23 @@ export function createStateNode (
501
514
  }
502
515
  return true
503
516
  })
504
- if (context.additionalPropertiesErrors) {
505
- // remove additional properties errors if the oneOf has no valid children
517
+
518
+ if (context.additionalPropertiesErrors?.length) {
519
+ // exclude the additional properties errors from the other children
506
520
  context.additionalPropertiesErrors = context.additionalPropertiesErrors?.filter(error => {
507
- // also remove the additional errors from other children of the oneOf
508
- if (matchChildError(compiledLayout, error, skeleton, dataPath, parentDataPath) && !matchPointerError(error, activeChildNode.pointer, activeChildNode.refPointer, dataPath, parentDataPath)) {
509
- return false
510
- }
521
+ // keep errors from other parts of the data
522
+ if (!matchDataPathError(error, dataPath)) return true
523
+ // keep errors from the active child's schema
524
+ if (matchPointerError(error, activeChildNode.pointer, activeChildNode.refPointer, dataPath, parentDataPath)) return true
525
+ // remove errors from other children
526
+ if (matchChildError(compiledLayout, error, skeleton, dataPath, parentDataPath) && !matchPointerError(error, activeChildNode.pointer, activeChildNode.refPointer, dataPath, parentDataPath)) return false
527
+ // ignore unevaluatedProperties errors from higher level that can be triggered because the active element is not yet valid
528
+ // TODO: should the last check include comparing with activeChildNode.propertyKeys ?
529
+ if (validChildTreeIndex === -1) return false
511
530
  return true
512
531
  })
513
532
  }
533
+
514
534
  const activeChildKey = `${fullKey}/${activeChildTreeIndex}`
515
535
  if (context.autofocusTarget === fullKey) context.autofocusTarget = activeChildKey
516
536
 
@@ -1,16 +0,0 @@
1
- /**
2
- * @param {object} _schema
3
- * @param {PartialCompileOptions} [partialOptions]
4
- * @returns {CompiledLayout}
5
- */
6
- export function compile(_schema: object, partialOptions?: PartialCompileOptions): CompiledLayout;
7
- export { resolveLocaleRefs } from "./utils/resolve-refs.js";
8
- export { resolveXI18n } from "./utils/x-i18n.js";
9
- export { produceCompileOptions } from "./options.js";
10
- export type SkeletonTree = import("./types.js").SkeletonTree;
11
- export type SkeletonNode = import("./types.js").SkeletonNode;
12
- export type CompiledLayout = import("./types.js").CompiledLayout;
13
- export type CompileOptions = import("./types.js").CompileOptions;
14
- export type PartialCompileOptions = import("./types.js").PartialCompileOptions;
15
- export type CompiledExpression = import("./types.js").CompiledExpression;
16
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compile/index.js"],"names":[],"mappings":"AA4BA;;;;GAIG;AACH,iCAJW,MAAM,mBACN,qBAAqB,GACnB,cAAc,CAkG1B;;;;2BAlHY,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,6 +0,0 @@
1
- export function fillOptions(partialOptions: PartialCompileOptions): CompileOptions;
2
- /** @type {(draft: PartialCompileOptions, newOptions: PartialCompileOptions) => PartialCompileOptions} */
3
- export const produceCompileOptions: (draft: PartialCompileOptions, newOptions: PartialCompileOptions) => PartialCompileOptions;
4
- export type CompileOptions = import("./types.js").CompileOptions;
5
- export type PartialCompileOptions = import("./types.js").PartialCompileOptions;
6
- //# sourceMappingURL=options.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/compile/options.js"],"names":[],"mappings":"AAqBO,4CAHI,qBAAqB,GACnB,cAAc,CA2D1B;AAGD,yGAAyG;AACzG,oCADW,CAAC,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,qBAAqB,KAAK,qBAAqB,CAiBnG;6BAxFW,OAAO,YAAY,EAAE,cAAc;oCACnC,OAAO,YAAY,EAAE,qBAAqB"}
@@ -1,6 +0,0 @@
1
- /**
2
- * @param {import('./index.js').CompiledLayout} compiledLayout
3
- * @returns {string}
4
- */
5
- export function serialize(compiledLayout: import("./index.js").CompiledLayout): string;
6
- //# sourceMappingURL=serialize.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/compile/serialize.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH,0CAHW,OAAO,YAAY,EAAE,cAAc,GACjC,MAAM,CAyElB"}
@@ -1,21 +0,0 @@
1
- /**
2
- * @param {any} rawSchema
3
- * @param {string} sourceSchemaId
4
- * @param {import('./index.js').CompileOptions} options
5
- * @param {(schemaId: string, ref: string) => [any, string, string]} getJSONRef
6
- * @param {Record<string, import('./types.js').SkeletonTree>} skeletonTrees
7
- * @param {Record<string, import('./types.js').SkeletonNode>} skeletonNodes
8
- * @param {string[]} validatePointers
9
- * @param {Record<string, string[]>} validationErrors
10
- * @param {Record<string, import('@json-layout/vocabulary').NormalizedLayout>} normalizedLayouts
11
- * @param {import('@json-layout/vocabulary').Expression[]} expressions
12
- * @param {string | number} key
13
- * @param {string} pointer
14
- * @param {boolean} required
15
- * @param {string} [condition]
16
- * @param {boolean} [dependent]
17
- * @param {string} [knownType]
18
- * @returns {import('./types.js').SkeletonNode}
19
- */
20
- export function makeSkeletonNode(rawSchema: any, sourceSchemaId: string, options: import("./index.js").CompileOptions, getJSONRef: (schemaId: string, ref: string) => [any, string, string], skeletonTrees: Record<string, import("./types.js").SkeletonTree>, skeletonNodes: Record<string, import("./types.js").SkeletonNode>, validatePointers: string[], validationErrors: Record<string, string[]>, normalizedLayouts: Record<string, import("@json-layout/vocabulary").NormalizedLayout>, expressions: import("@json-layout/vocabulary").Expression[], key: string | number, pointer: string, required: boolean, condition?: string, dependent?: boolean, knownType?: string): import("./types.js").SkeletonNode;
21
- //# sourceMappingURL=skeleton-node.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skeleton-node.d.ts","sourceRoot":"","sources":["../../src/compile/skeleton-node.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;GAkBG;AACH,4CAlBW,GAAG,kBACH,MAAM,WACN,OAAO,YAAY,EAAE,cAAc,cACnC,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,iBACxD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,iBACjD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,oBACjD,MAAM,EAAE,oBACR,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,qBACxB,MAAM,CAAC,MAAM,EAAE,OAAO,yBAAyB,EAAE,gBAAgB,CAAC,eAClE,OAAO,yBAAyB,EAAE,UAAU,EAAE,OAC9C,MAAM,GAAG,MAAM,WACf,MAAM,YACN,OAAO,cACP,MAAM,cACN,OAAO,cACP,MAAM,GACJ,OAAO,YAAY,EAAE,YAAY,CAghB7C"}
@@ -1,19 +0,0 @@
1
- /**
2
- * @param {any} schema
3
- * @param {string} schemaId
4
- * @param {import('./index.js').CompileOptions} options
5
- * @param {(schemaId: string, ref: string) => [any, string, string]} getJSONRef
6
- * @param {Record<string, import('./types.js').SkeletonTree>} skeletonTrees
7
- * @param {Record<string, import('./types.js').SkeletonNode>} skeletonNodes
8
- * @param {string[]} validatePointers
9
- * @param {Record<string, string[]>} validationErrors
10
- * @param {Record<string, import('@json-layout/vocabulary').NormalizedLayout>} normalizedLayouts
11
- * @param {import('@json-layout/vocabulary').Expression[]} expressions
12
- * @param {string} pointer
13
- * @param {string} [defaultTitle]
14
- * @param {boolean} [deleteRootNodeTitle]
15
- * @param {string} [discriminator]
16
- * @returns {import('./types.js').SkeletonTree}
17
- */
18
- export function makeSkeletonTree(schema: any, schemaId: string, options: import("./index.js").CompileOptions, getJSONRef: (schemaId: string, ref: string) => [any, string, string], skeletonTrees: Record<string, import("./types.js").SkeletonTree>, skeletonNodes: Record<string, import("./types.js").SkeletonNode>, validatePointers: string[], validationErrors: Record<string, string[]>, normalizedLayouts: Record<string, import("@json-layout/vocabulary").NormalizedLayout>, expressions: import("@json-layout/vocabulary").Expression[], pointer: string, defaultTitle?: string, deleteRootNodeTitle?: boolean, discriminator?: string): import("./types.js").SkeletonTree;
19
- //# sourceMappingURL=skeleton-tree.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skeleton-tree.d.ts","sourceRoot":"","sources":["../../src/compile/skeleton-tree.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;GAgBG;AACH,yCAhBW,GAAG,YACH,MAAM,WACN,OAAO,YAAY,EAAE,cAAc,cACnC,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,iBACxD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,iBACjD,MAAM,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,YAAY,CAAC,oBACjD,MAAM,EAAE,oBACR,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,qBACxB,MAAM,CAAC,MAAM,EAAE,OAAO,yBAAyB,EAAE,gBAAgB,CAAC,eAClE,OAAO,yBAAyB,EAAE,UAAU,EAAE,WAC9C,MAAM,iBACN,MAAM,wBACN,OAAO,kBACP,MAAM,GACJ,OAAO,YAAY,EAAE,YAAY,CAqD7C"}
@@ -1,62 +0,0 @@
1
- import type ajvModule from 'ajv/dist/2019.js';
2
- import type { MarkedOptions } from 'marked';
3
- import { type ComponentInfo, type BaseCompObject, type NormalizedLayout, type StateNodeOptionsBase, type Expression, type NormalizeOptions } from '@json-layout/vocabulary';
4
- import { type ValidateFunction, type SchemaObject } from 'ajv/dist/2019.js';
5
- import { type Display } from '../state/utils/display.js';
6
- import { type LocaleMessages } from '../i18n/types.js';
7
- export interface ParentContextExpression {
8
- data: unknown;
9
- parent: ParentContextExpression | undefined | null;
10
- }
11
- export type CompiledExpression = (data: any, dataAlias: any, options: StateNodeOptionsBase, context: object, display: Display, layout: BaseCompObject, readOnly: boolean, summary: boolean, validates: Record<string, ValidateFunction>, rootData?: unknown, parent?: ParentContextExpression | null) => any;
12
- export type CompileOptions = NormalizeOptions & {
13
- ajv: ajvModule.default;
14
- ajvOptions?: ajvModule.Options;
15
- code: boolean;
16
- markedOptions?: MarkedOptions;
17
- locale: string;
18
- defaultLocale: string;
19
- messages: LocaleMessages;
20
- xI18n: boolean;
21
- };
22
- export type PartialCompileOptions = Partial<Omit<CompileOptions, 'messages'>> & {
23
- messages?: Partial<LocaleMessages>;
24
- components?: Record<string, Omit<ComponentInfo, 'name'>>;
25
- };
26
- export interface CompiledLayout {
27
- options?: CompileOptions;
28
- schema?: SchemaObject;
29
- mainTree: string;
30
- skeletonTrees: Record<string, SkeletonTree>;
31
- skeletonNodes: Record<string, SkeletonNode>;
32
- validates: Record<string, ValidateFunction>;
33
- validationErrors: Record<string, string[]>;
34
- normalizedLayouts: Record<string, NormalizedLayout>;
35
- expressions: CompiledExpression[];
36
- locale: string;
37
- messages: LocaleMessages;
38
- components: Record<string, Omit<ComponentInfo, 'schema'>>;
39
- localizeErrors: (errors: ajvModule.ErrorObject[]) => void;
40
- }
41
- export interface SkeletonTree {
42
- title: string;
43
- root: string;
44
- refPointer: string;
45
- discriminatorValue?: string;
46
- }
47
- export interface SkeletonNode {
48
- title?: string;
49
- key: string | number;
50
- pointer: string;
51
- refPointer: string;
52
- pure: boolean;
53
- propertyKeys: string[];
54
- roPropertyKeys: string[];
55
- condition?: Expression;
56
- children?: string[];
57
- childrenTrees?: string[];
58
- discriminator?: string;
59
- required?: boolean;
60
- nullable?: boolean;
61
- }
62
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compile/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC3K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Q,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
@@ -1,17 +0,0 @@
1
- /**
2
- * mutates a schema by replacing ~$locale~ in all refs
3
- * @param {import('ajv').SchemaObject} schema
4
- * @param {import('ajv/dist/2019.js').default} ajv
5
- * @param {string} [locale]
6
- * @param {string} [defaultLocale]
7
- * @returns {(schemaId: string, ref: string) => [any, string, string]}
8
- */
9
- export function resolveLocaleRefs(schema: import("ajv").SchemaObject, ajv: import("ajv/dist/2019.js").default, locale?: string, defaultLocale?: string): (schemaId: string, ref: string) => [any, string, string];
10
- /**
11
- * partially resolve a schema but not recursively, used for layout normalization
12
- * @param {import('ajv').SchemaObject} schema
13
- * @param {string} schemaId
14
- * @param {(schemaId: string, ref: string) => [any, string, string]} getJSONRef
15
- */
16
- export function partialResolveRefs(schema: import("ajv").SchemaObject, schemaId: string, getJSONRef: (schemaId: string, ref: string) => [any, string, string]): any;
17
- //# sourceMappingURL=resolve-refs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-refs.d.ts","sourceRoot":"","sources":["../../../src/compile/utils/resolve-refs.js"],"names":[],"mappings":"AAyBA;;;;;;;GAOG;AACH,0CANW,OAAO,KAAK,EAAE,YAAY,OAC1B,OAAO,kBAAkB,EAAE,OAAO,WAClC,MAAM,kBACN,MAAM,GACJ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CASpE;AAuCD;;;;;GAKG;AACH,2CAJW,OAAO,KAAK,EAAE,YAAY,YAC1B,MAAM,cACN,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,OA+ClE"}
@@ -1,2 +0,0 @@
1
- export function resolveXI18n(schema: Record<string, any>, locale: string, defaultLocale?: string): void;
2
- //# sourceMappingURL=x-i18n.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"x-i18n.d.ts","sourceRoot":"","sources":["../../../src/compile/utils/x-i18n.js"],"names":[],"mappings":"AAOO,qCAJI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UACnB,MAAM,kBACN,MAAM,QAkBhB"}
@@ -1,41 +0,0 @@
1
- declare const _default: {
2
- errorOneOf: string;
3
- errorRequired: string;
4
- addItem: string;
5
- delete: string;
6
- edit: string;
7
- confirm: string;
8
- close: string;
9
- duplicate: string;
10
- sort: string;
11
- up: string;
12
- down: string;
13
- showHelp: string;
14
- mdeLink1: string;
15
- mdeLink2: string;
16
- mdeImg1: string;
17
- mdeImg2: string;
18
- mdeTable1: string;
19
- mdeTable2: string;
20
- bold: string;
21
- italic: string;
22
- heading: string;
23
- quote: string;
24
- unorderedList: string;
25
- orderedList: string;
26
- createLink: string;
27
- insertImage: string;
28
- createTable: string;
29
- preview: string;
30
- mdeGuide: string;
31
- undo: string;
32
- redo: string;
33
- default: string;
34
- name: string;
35
- examples: string;
36
- deprecated: string;
37
- keyboardDate: string;
38
- keyboardDateTime: string;
39
- };
40
- export default _default;
41
- //# sourceMappingURL=de.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../src/i18n/de.js"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- declare const _default: {
2
- errorOneOf: string;
3
- errorRequired: string;
4
- addItem: string;
5
- delete: string;
6
- edit: string;
7
- confirm: string;
8
- close: string;
9
- duplicate: string;
10
- sort: string;
11
- up: string;
12
- down: string;
13
- showHelp: string;
14
- mdeLink1: string;
15
- mdeLink2: string;
16
- mdeImg1: string;
17
- mdeImg2: string;
18
- mdeTable1: string;
19
- mdeTable2: string;
20
- bold: string;
21
- italic: string;
22
- heading: string;
23
- quote: string;
24
- unorderedList: string;
25
- orderedList: string;
26
- createLink: string;
27
- insertImage: string;
28
- createTable: string;
29
- preview: string;
30
- mdeGuide: string;
31
- undo: string;
32
- redo: string;
33
- default: string;
34
- name: string;
35
- examples: string;
36
- deprecated: string;
37
- keyboardDate: string;
38
- keyboardDateTime: string;
39
- };
40
- export default _default;
41
- //# sourceMappingURL=en.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.js"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- declare const _default: {
2
- errorOneOf: string;
3
- errorRequired: string;
4
- addItem: string;
5
- delete: string;
6
- edit: string;
7
- confirm: string;
8
- close: string;
9
- duplicate: string;
10
- sort: string;
11
- up: string;
12
- down: string;
13
- showHelp: string;
14
- mdeLink1: string;
15
- mdeLink2: string;
16
- mdeImg1: string;
17
- mdeImg2: string;
18
- mdeTable1: string;
19
- mdeTable2: string;
20
- bold: string;
21
- italic: string;
22
- heading: string;
23
- quote: string;
24
- unorderedList: string;
25
- orderedList: string;
26
- createLink: string;
27
- insertImage: string;
28
- createTable: string;
29
- preview: string;
30
- mdeGuide: string;
31
- undo: string;
32
- redo: string;
33
- default: string;
34
- name: string;
35
- examples: string;
36
- deprecated: string;
37
- keyboardDate: string;
38
- keyboardDateTime: string;
39
- };
40
- export default _default;
41
- //# sourceMappingURL=fr.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/i18n/fr.js"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- declare const _default: {
2
- en: import("./types.js").LocaleMessages;
3
- fr: import("./types.js").LocaleMessages;
4
- nl: import("./types.js").LocaleMessages;
5
- de: import("./types.js").LocaleMessages;
6
- };
7
- export default _default;
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.js"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- declare const _default: {
2
- errorOneOf: string;
3
- errorRequired: string;
4
- addItem: string;
5
- delete: string;
6
- confirm: string;
7
- edit: string;
8
- close: string;
9
- duplicate: string;
10
- sort: string;
11
- up: string;
12
- down: string;
13
- showHelp: string;
14
- mdeLink1: string;
15
- mdeLink2: string;
16
- mdeImg1: string;
17
- mdeImg2: string;
18
- mdeTable1: string;
19
- mdeTable2: string;
20
- bold: string;
21
- italic: string;
22
- heading: string;
23
- quote: string;
24
- unorderedList: string;
25
- orderedList: string;
26
- createLink: string;
27
- insertImage: string;
28
- createTable: string;
29
- preview: string;
30
- mdeGuide: string;
31
- undo: string;
32
- redo: string;
33
- default: string;
34
- name: string;
35
- examples: string;
36
- deprecated: string;
37
- keyboardDate: string;
38
- keyboardDateTime: string;
39
- };
40
- export default _default;
41
- //# sourceMappingURL=nl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nl.d.ts","sourceRoot":"","sources":["../../src/i18n/nl.js"],"names":[],"mappings":""}
@@ -1,40 +0,0 @@
1
- import { type NormalizeMessages } from '@json-layout/vocabulary';
2
- export interface CompileOptionsMessages {
3
- errorOneOf: string;
4
- errorRequired: string;
5
- }
6
- export interface StateOptionsMessages {
7
- addItem: string;
8
- delete: string;
9
- confirm: string;
10
- edit: string;
11
- close: string;
12
- duplicate: string;
13
- sort: string;
14
- up: string;
15
- down: string;
16
- showHelp: string;
17
- mdeLink1: string;
18
- mdeLink2: string;
19
- mdeImg1: string;
20
- mdeImg2: string;
21
- mdeTable1: string;
22
- mdeTable2: string;
23
- bold: string;
24
- italic: string;
25
- heading: string;
26
- quote: string;
27
- unorderedList: string;
28
- orderedList: string;
29
- createLink: string;
30
- insertImage: string;
31
- createTable: string;
32
- preview: string;
33
- mdeGuide: string;
34
- undo: string;
35
- redo: string;
36
- keyboardDate: string;
37
- keyboardDateTime: string;
38
- }
39
- export type LocaleMessages = NormalizeMessages & CompileOptionsMessages & StateOptionsMessages;
40
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/i18n/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,sBAAsB,GAAG,oBAAoB,CAAA"}
package/types/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from "./compile/index.js";
2
- export * from "./state/index.js";
3
- export { default as i18n } from "./i18n/index.js";
4
- export { clone } from "@json-layout/vocabulary";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}