@teleporthq/teleport-uidl-validator 0.18.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.
Files changed (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +14 -0
  3. package/__tests__/parser/componennt-with-referenced-styles.json +111 -0
  4. package/__tests__/parser/component-parsing.ts +116 -0
  5. package/__tests__/parser/component-referenced.ts +50 -0
  6. package/__tests__/parser/component-with-primitive-values.json +61 -0
  7. package/__tests__/parser/component-with-proper-values.json +97 -0
  8. package/__tests__/parser/component-with-reusalble-styles.json +117 -0
  9. package/__tests__/validator/component-element-with-empty-name.json +36 -0
  10. package/__tests__/validator/component-invalid-sample.json +184 -0
  11. package/__tests__/validator/component-uidl-with-event-modifier-undefined.json +45 -0
  12. package/__tests__/validator/component-uidl-with-null-undefined.json +24 -0
  13. package/__tests__/validator/index.ts +216 -0
  14. package/__tests__/validator/old-project-invalid-sample.json +317 -0
  15. package/__tests__/validator/project-invalid-sample-no-route.json +667 -0
  16. package/__tests__/validator/project-invalid-sample.json +671 -0
  17. package/__tests__/validator/project-sample.json +667 -0
  18. package/dist/cjs/decoders/component-decoder.d.ts +4 -0
  19. package/dist/cjs/decoders/component-decoder.js +30 -0
  20. package/dist/cjs/decoders/component-decoder.js.map +1 -0
  21. package/dist/cjs/decoders/custom-combinators.d.ts +8 -0
  22. package/dist/cjs/decoders/custom-combinators.js +59 -0
  23. package/dist/cjs/decoders/custom-combinators.js.map +1 -0
  24. package/dist/cjs/decoders/index.d.ts +2 -0
  25. package/dist/cjs/decoders/index.js +9 -0
  26. package/dist/cjs/decoders/index.js.map +1 -0
  27. package/dist/cjs/decoders/project-decoder.d.ts +5 -0
  28. package/dist/cjs/decoders/project-decoder.js +38 -0
  29. package/dist/cjs/decoders/project-decoder.js.map +1 -0
  30. package/dist/cjs/decoders/utils.d.ts +59 -0
  31. package/dist/cjs/decoders/utils.js +305 -0
  32. package/dist/cjs/decoders/utils.js.map +1 -0
  33. package/dist/cjs/index.d.ts +7 -0
  34. package/dist/cjs/index.js +38 -0
  35. package/dist/cjs/index.js.map +1 -0
  36. package/dist/cjs/parser/index.d.ts +10 -0
  37. package/dist/cjs/parser/index.js +156 -0
  38. package/dist/cjs/parser/index.js.map +1 -0
  39. package/dist/cjs/tsconfig.tsbuildinfo +1 -0
  40. package/dist/cjs/validator/index.d.ts +15 -0
  41. package/dist/cjs/validator/index.js +94 -0
  42. package/dist/cjs/validator/index.js.map +1 -0
  43. package/dist/cjs/validator/utils.d.ts +16 -0
  44. package/dist/cjs/validator/utils.js +373 -0
  45. package/dist/cjs/validator/utils.js.map +1 -0
  46. package/dist/esm/decoders/component-decoder.d.ts +4 -0
  47. package/dist/esm/decoders/component-decoder.js +27 -0
  48. package/dist/esm/decoders/component-decoder.js.map +1 -0
  49. package/dist/esm/decoders/custom-combinators.d.ts +8 -0
  50. package/dist/esm/decoders/custom-combinators.js +56 -0
  51. package/dist/esm/decoders/custom-combinators.js.map +1 -0
  52. package/dist/esm/decoders/index.d.ts +2 -0
  53. package/dist/esm/decoders/index.js +3 -0
  54. package/dist/esm/decoders/index.js.map +1 -0
  55. package/dist/esm/decoders/project-decoder.d.ts +5 -0
  56. package/dist/esm/decoders/project-decoder.js +35 -0
  57. package/dist/esm/decoders/project-decoder.js.map +1 -0
  58. package/dist/esm/decoders/utils.d.ts +59 -0
  59. package/dist/esm/decoders/utils.js +301 -0
  60. package/dist/esm/decoders/utils.js.map +1 -0
  61. package/dist/esm/index.d.ts +7 -0
  62. package/dist/esm/index.js +8 -0
  63. package/dist/esm/index.js.map +1 -0
  64. package/dist/esm/parser/index.d.ts +10 -0
  65. package/dist/esm/parser/index.js +151 -0
  66. package/dist/esm/parser/index.js.map +1 -0
  67. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  68. package/dist/esm/validator/index.d.ts +15 -0
  69. package/dist/esm/validator/index.js +73 -0
  70. package/dist/esm/validator/index.js.map +1 -0
  71. package/dist/esm/validator/utils.d.ts +16 -0
  72. package/dist/esm/validator/utils.js +359 -0
  73. package/dist/esm/validator/utils.js.map +1 -0
  74. package/package.json +32 -0
  75. package/src/decoders/component-decoder.ts +48 -0
  76. package/src/decoders/custom-combinators.ts +59 -0
  77. package/src/decoders/index.ts +2 -0
  78. package/src/decoders/project-decoder.ts +40 -0
  79. package/src/decoders/utils.ts +571 -0
  80. package/src/index.ts +9 -0
  81. package/src/parser/index.ts +227 -0
  82. package/src/validator/index.ts +105 -0
  83. package/src/validator/utils.ts +463 -0
  84. package/tsconfig.json +9 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-decoder.js","sourceRoot":"","sources":["../../../src/decoders/component-decoder.ts"],"names":[],"mappings":";;;AAAA,uEAOuC;AAEvC,iCAUgB;AAEH,QAAA,oBAAoB,GAA4B,6BAAM,CAAC;IAClE,IAAI,EAAE,kCAAW,CAAC,aAAa,EAAE,6BAAM,EAAE,CAAC;IAC1C,IAAI,EAAE,0BAAkB;IACxB,gBAAgB,EAAE,+BAAQ,CAAC,2BAAI,CAAC,+BAAuB,CAAC,CAAC;IACzD,eAAe,EAAE,+BAAQ,CAAC,2BAAI,CAAC,8BAAsB,CAAC,CAAC;IACvD,mBAAmB,EAAE,+BAAQ,CAAC,2BAAI,CAAC,iCAAyB,CAAC,CAAC;IAC9D,iBAAiB,EAAE,+BAAQ,CAAC,2BAAI,CAAC,iCAAyB,CAAC,CAAC;IAC5D,aAAa,EAAE,+BAAQ,CAAC,4BAAoB,CAAC;IAC7C,GAAG,EAAE,+BAAQ,CAAC,2BAAmB,CAAC;CACnC,CAAC,CAAA;AAEW,QAAA,wBAAwB,GAAgC,6BAAM,CAAC;IAC1E,IAAI,EAAE,kCAAW,CAAC,KAAK,EAAE,6BAAM,EAAE,CAAC;IAClC,IAAI,EAAE,0BAAkB;IACxB,gBAAgB,EAAE,2BAAI,CAAC,+BAAuB,CAAC;IAC/C,eAAe,EAAE,+BAAQ,CAAC,2BAAI,CAAC,8BAAsB,CAAC,CAAC;IACvD,iBAAiB,EAAE,+BAAQ,CAAC,2BAAI,CAAC,iCAAyB,CAAC,CAAC;IAC5D,eAAe,EAAE,+BAAQ,CAAC,2BAAI,CAAC,6BAAqB,CAAC,CAAC;IACtD,mBAAmB,EAAE,+BAAQ,CAAC,2BAAI,CAAC,iCAAyB,CAAC,CAAC;IAC9D,aAAa,EAAE,+BAAQ,CAAC,4BAAoB,CAAC;IAC7C,GAAG,EAAE,+BAAQ,CAAC,2BAAmB,CAAC;IAClC,cAAc,EAAE,+BAAQ,CACtB,6BAAM,CAAC;QACL,MAAM,EAAE,+BAAQ,CAAC,2BAAmB,CAAC;KACtC,CAAC,CACH;CACF,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ export declare class CustomCombinators<A> {
2
+ private decode;
3
+ private constructor();
4
+ static isValidComponentName(): CustomCombinators<string>;
5
+ static isValidNavLink(): CustomCombinators<string>;
6
+ static isValidFileName(): CustomCombinators<string>;
7
+ static isValidElementName(): CustomCombinators<string>;
8
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomCombinators = void 0;
4
+ /* tslint:disable member-ordering */
5
+ var json_type_validation_1 = require("@mojotech/json-type-validation");
6
+ var CustomCombinators = /** @class */ (function () {
7
+ // @ts-ignore
8
+ function CustomCombinators(decode) {
9
+ this.decode = decode;
10
+ }
11
+ CustomCombinators.isValidComponentName = function () {
12
+ return new CustomCombinators(function (json) {
13
+ var componentNameRegex = new RegExp('^[A-Z]+[a-zA-Z0-9]*$');
14
+ if (json && typeof json === 'string' && componentNameRegex.test(json)) {
15
+ return json_type_validation_1.Result.ok(json);
16
+ }
17
+ else if (json.length === 0) {
18
+ throw new Error("Component Name cannot be empty");
19
+ }
20
+ throw new Error("Invalid Component name, got " + json);
21
+ });
22
+ };
23
+ CustomCombinators.isValidNavLink = function () {
24
+ return new CustomCombinators(function (json) {
25
+ var navLinkRegex = new RegExp('/[a-zA-Z0-9-_]*$');
26
+ if (json && typeof json === 'string' && navLinkRegex.test(json)) {
27
+ return json_type_validation_1.Result.ok(json);
28
+ }
29
+ throw new Error("Invalid link attribute, received " + json);
30
+ });
31
+ };
32
+ CustomCombinators.isValidFileName = function () {
33
+ return new CustomCombinators(function (json) {
34
+ var fileNameRegex = new RegExp('^[a-zA-Z0-9-_.]*$');
35
+ if (json && typeof json === 'string' && fileNameRegex.test(json)) {
36
+ return json_type_validation_1.Result.ok(json);
37
+ }
38
+ else if (json.length === 0) {
39
+ throw new Error("File Name cannot be empty");
40
+ }
41
+ throw new Error("Invalid File name, received " + json);
42
+ });
43
+ };
44
+ CustomCombinators.isValidElementName = function () {
45
+ return new CustomCombinators(function (json) {
46
+ var fileNameRegex = new RegExp('^[a-zA-Z]+[a-zA-Z0-9-_]*$');
47
+ if (json && typeof json === 'string' && fileNameRegex.test(json)) {
48
+ return json_type_validation_1.Result.ok(json);
49
+ }
50
+ else if (json.length === 0) {
51
+ throw new Error("Name attribute cannot be empty");
52
+ }
53
+ throw new Error("Invalid name attribute, received " + json);
54
+ });
55
+ };
56
+ return CustomCombinators;
57
+ }());
58
+ exports.CustomCombinators = CustomCombinators;
59
+ //# sourceMappingURL=custom-combinators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-combinators.js","sourceRoot":"","sources":["../../../src/decoders/custom-combinators.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,uEAAqE;AAQrE;IACE,aAAa;IACb,2BAA4B,MAAyC;QAAzC,WAAM,GAAN,MAAM,CAAmC;IAAG,CAAC;IAElE,sCAAoB,GAA3B;QACE,OAAO,IAAI,iBAAiB,CAAS,UAAC,IAAY;YAChD,IAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAA;YAC7D,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACrE,OAAO,6BAAM,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AA;YAC7D,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBAChE,OAAO,6BAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;aACvB;iBAAM,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC5B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;aAClD;YACD,MAAM,IAAI,KAAK,CAAC,sCAAoC,IAAM,CAAC,CAAA;QAC7D,CAAC,CAAC,CAAA;IACJ,CAAC;IACH,wBAAC;AAAD,CAAC,AAjDD,IAiDC;AAjDY,8CAAiB"}
@@ -0,0 +1,2 @@
1
+ export { componentUIDLDecoder, rootComponentUIDLDecoder } from './component-decoder';
2
+ export { projectUIDLDecoder } from './project-decoder';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.projectUIDLDecoder = exports.rootComponentUIDLDecoder = exports.componentUIDLDecoder = void 0;
4
+ var component_decoder_1 = require("./component-decoder");
5
+ Object.defineProperty(exports, "componentUIDLDecoder", { enumerable: true, get: function () { return component_decoder_1.componentUIDLDecoder; } });
6
+ Object.defineProperty(exports, "rootComponentUIDLDecoder", { enumerable: true, get: function () { return component_decoder_1.rootComponentUIDLDecoder; } });
7
+ var project_decoder_1 = require("./project-decoder");
8
+ Object.defineProperty(exports, "projectUIDLDecoder", { enumerable: true, get: function () { return project_decoder_1.projectUIDLDecoder; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decoders/index.ts"],"names":[],"mappings":";;;AAAA,yDAAoF;AAA3E,yHAAA,oBAAoB,OAAA;AAAE,6HAAA,wBAAwB,OAAA;AACvD,qDAAsD;AAA7C,qHAAA,kBAAkB,OAAA"}
@@ -0,0 +1,5 @@
1
+ import { Decoder } from '@mojotech/json-type-validation';
2
+ import { UIDLGlobalProjectValues, WebManifest, VProjectUIDL } from '@teleporthq/teleport-types';
3
+ export declare const webManifestDecoder: Decoder<WebManifest>;
4
+ export declare const globalProjectValuesDecoder: Decoder<UIDLGlobalProjectValues>;
5
+ export declare const projectUIDLDecoder: Decoder<VProjectUIDL>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.projectUIDLDecoder = exports.globalProjectValuesDecoder = exports.webManifestDecoder = void 0;
4
+ var json_type_validation_1 = require("@mojotech/json-type-validation");
5
+ var utils_1 = require("./utils");
6
+ var component_decoder_1 = require("./component-decoder");
7
+ exports.webManifestDecoder = json_type_validation_1.object({
8
+ short_name: json_type_validation_1.optional(json_type_validation_1.string()),
9
+ name: json_type_validation_1.optional(json_type_validation_1.string()),
10
+ icons: json_type_validation_1.optional(json_type_validation_1.array(json_type_validation_1.object({ src: json_type_validation_1.string(), type: json_type_validation_1.string(), sizes: json_type_validation_1.string() }))),
11
+ start_url: json_type_validation_1.optional(json_type_validation_1.string()),
12
+ background_color: json_type_validation_1.optional(json_type_validation_1.string()),
13
+ display: json_type_validation_1.optional(json_type_validation_1.string()),
14
+ orientation: json_type_validation_1.optional(json_type_validation_1.string()),
15
+ scope: json_type_validation_1.optional(json_type_validation_1.string()),
16
+ theme_color: json_type_validation_1.optional(json_type_validation_1.string()),
17
+ });
18
+ exports.globalProjectValuesDecoder = json_type_validation_1.object({
19
+ settings: json_type_validation_1.object({
20
+ title: json_type_validation_1.string(),
21
+ language: json_type_validation_1.string(),
22
+ }),
23
+ customCode: json_type_validation_1.optional(json_type_validation_1.object({
24
+ head: json_type_validation_1.optional(json_type_validation_1.string()),
25
+ body: json_type_validation_1.optional(json_type_validation_1.string()),
26
+ })),
27
+ meta: json_type_validation_1.array(json_type_validation_1.dict(json_type_validation_1.string())),
28
+ assets: json_type_validation_1.array(utils_1.globalAssetsDecoder),
29
+ manifest: json_type_validation_1.optional(exports.webManifestDecoder),
30
+ variables: json_type_validation_1.optional(json_type_validation_1.dict(json_type_validation_1.string())),
31
+ });
32
+ exports.projectUIDLDecoder = json_type_validation_1.object({
33
+ name: json_type_validation_1.string(),
34
+ globals: exports.globalProjectValuesDecoder,
35
+ root: component_decoder_1.rootComponentUIDLDecoder,
36
+ components: json_type_validation_1.optional(json_type_validation_1.dict(component_decoder_1.componentUIDLDecoder)),
37
+ });
38
+ //# sourceMappingURL=project-decoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-decoder.js","sourceRoot":"","sources":["../../../src/decoders/project-decoder.ts"],"names":[],"mappings":";;;AAAA,uEAA+F;AAE/F,iCAA6C;AAC7C,yDAAoF;AAEvE,QAAA,kBAAkB,GAAyB,6BAAM,CAAC;IAC7D,UAAU,EAAE,+BAAQ,CAAC,6BAAM,EAAE,CAAC;IAC9B,IAAI,EAAE,+BAAQ,CAAC,6BAAM,EAAE,CAAC;IACxB,KAAK,EAAE,+BAAQ,CAAC,4BAAK,CAAC,6BAAM,CAAC,EAAE,GAAG,EAAE,6BAAM,EAAE,EAAE,IAAI,EAAE,6BAAM,EAAE,EAAE,KAAK,EAAE,6BAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IAClF,SAAS,EAAE,+BAAQ,CAAC,6BAAM,EAAE,CAAC;IAC7B,gBAAgB,EAAE,+BAAQ,CAAC,6BAAM,EAAE,CAAC;IACpC,OAAO,EAAE,+BAAQ,CAAC,6BAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,+BAAQ,CAAC,6BAAM,EAAE,CAAC;IAC/B,KAAK,EAAE,+BAAQ,CAAC,6BAAM,EAAE,CAAC;IACzB,WAAW,EAAE,+BAAQ,CAAC,6BAAM,EAAE,CAAC;CAChC,CAAC,CAAA;AAEW,QAAA,0BAA0B,GAAqC,6BAAM,CAAC;IACjF,QAAQ,EAAE,6BAAM,CAAC;QACf,KAAK,EAAE,6BAAM,EAAE;QACf,QAAQ,EAAE,6BAAM,EAAE;KACnB,CAAC;IACF,UAAU,EAAE,+BAAQ,CAClB,6BAAM,CAAC;QACL,IAAI,EAAE,+BAAQ,CAAC,6BAAM,EAAE,CAAC;QACxB,IAAI,EAAE,+BAAQ,CAAC,6BAAM,EAAE,CAAC;KACzB,CAAC,CACH;IACD,IAAI,EAAE,4BAAK,CAAC,2BAAI,CAAC,6BAAM,EAAE,CAAC,CAAC;IAC3B,MAAM,EAAE,4BAAK,CAAC,2BAAmB,CAAC;IAClC,QAAQ,EAAE,+BAAQ,CAAC,0BAAkB,CAAC;IACtC,SAAS,EAAE,+BAAQ,CAAC,2BAAI,CAAC,6BAAM,EAAE,CAAC,CAAC;CACpC,CAAC,CAAA;AAEW,QAAA,kBAAkB,GAA0B,6BAAM,CAAC;IAC9D,IAAI,EAAE,6BAAM,EAAE;IACd,OAAO,EAAE,kCAA0B;IACnC,IAAI,EAAE,4CAAwB;IAC9B,UAAU,EAAE,+BAAQ,CAAC,2BAAI,CAAC,wCAAoB,CAAC,CAAC;CACjD,CAAC,CAAA"}
@@ -0,0 +1,59 @@
1
+ import { Decoder } from '@mojotech/json-type-validation';
2
+ import { UIDLStaticValue, ReferenceType, UIDLDynamicReference, UIDLPropDefinition, UIDLStateDefinition, UIDLStateValueDetails, UIDLPageOptions, UIDLComponentOutputOptions, UIDLDependency, UIDLStyleDefinitions, UIDLStyleValue, UIDLAttributeValue, UIDLEventHandlerStatement, UIDLNavLinkNode, UIDLMailLinkNode, UIDLPhoneLinkNode, UIDLRawValue, UIDLElementStyleStates, UIDLStyleStateCondition, UIDLStyleMediaQueryScreenSizeCondition, UIDLStyleConditions, UIDLElementNodeProjectReferencedStyle, UIDLComponentSEO, UIDLGlobalAsset, UIDLExternalDependency, UIDLLocalDependency, UIDLPeerDependency, UIDLImportReference, UIDLStyleSetTokenReference, VUIDLStyleSetDefnition, VUIDLElement, VUIDLSlotNode, VUIDLConditionalNode, VUIDLRepeatNode, VUIDLElementNode, VUIDLNode, VUIDLElementNodeInlineReferencedStyle, VUIDLSectionLinkNode, VUIDLLinkNode, VUIDLURLLinkNode, VUIDLStyleSetConditions, VUIDLStyleSetMediaCondition, VUIDLStyleSetStateCondition, VUIDLDesignTokens, UIDLPropCallEvent, UIDLStateModifierEvent, UIDLScriptExternalAsset, UIDLScriptInlineAsset, UIDLStyleInlineAsset, UIDLStyleExternalAsset, UIDLFontAsset, UIDLCanonicalAsset, UIDLIconAsset, UIDLAssetBase, VUIDLElementNodeClassReferencedStyle, UIDLCompDynamicReference } from '@teleporthq/teleport-types';
3
+ export declare const referenceTypeDecoder: Decoder<ReferenceType>;
4
+ export declare const dynamicValueDecoder: Decoder<UIDLDynamicReference>;
5
+ export declare const staticValueDecoder: Decoder<UIDLStaticValue>;
6
+ export declare const styleSetMediaConditionDecoder: Decoder<VUIDLStyleSetMediaCondition>;
7
+ export declare const styleSetStateConditionDecoder: Decoder<VUIDLStyleSetStateCondition>;
8
+ export declare const projectStyleConditionsDecoder: Decoder<VUIDLStyleSetConditions>;
9
+ export declare const tokenReferenceDecoder: Decoder<UIDLStyleSetTokenReference>;
10
+ export declare const styleSetDefinitionDecoder: Decoder<VUIDLStyleSetDefnition>;
11
+ export declare const stateOrPropDefinitionDecoder: Decoder<string | number | boolean | Record<string, unknown> | (string | number | Record<string, unknown>)[]>;
12
+ export declare const pageOptionsDecoder: Decoder<UIDLPageOptions>;
13
+ export declare const globalAssetsDecoder: Decoder<UIDLGlobalAsset>;
14
+ export declare const baseAssetDecoder: Decoder<UIDLAssetBase>;
15
+ export declare const inlineScriptAssetDecoder: Decoder<UIDLScriptInlineAsset>;
16
+ export declare const externalScriptAssetDecoder: Decoder<UIDLScriptExternalAsset>;
17
+ export declare const inlineStyletAssetDecoder: Decoder<UIDLStyleInlineAsset>;
18
+ export declare const externalStyleAssetDecoder: Decoder<UIDLStyleExternalAsset>;
19
+ export declare const fontAssetDecoder: Decoder<UIDLFontAsset>;
20
+ export declare const canonicalAssetDecoder: Decoder<UIDLCanonicalAsset>;
21
+ export declare const iconAssetDecoder: Decoder<UIDLIconAsset>;
22
+ export declare const componentSeoDecoder: Decoder<UIDLComponentSEO>;
23
+ export declare const stateValueDetailsDecoder: Decoder<UIDLStateValueDetails>;
24
+ export declare const propDefinitionsDecoder: Decoder<UIDLPropDefinition>;
25
+ export declare const stateDefinitionsDecoder: Decoder<UIDLStateDefinition>;
26
+ export declare const outputOptionsDecoder: Decoder<UIDLComponentOutputOptions>;
27
+ export declare const peerDependencyDecoder: Decoder<UIDLPeerDependency>;
28
+ export declare const externaldependencyDecoder: Decoder<UIDLExternalDependency>;
29
+ export declare const localDependencyDecoder: Decoder<UIDLLocalDependency>;
30
+ export declare const dependencyDecoder: Decoder<UIDLDependency>;
31
+ export declare const importReferenceDecoder: Decoder<UIDLImportReference>;
32
+ export declare const attributeValueDecoder: Decoder<UIDLAttributeValue>;
33
+ export declare const styleValueDecoder: Decoder<UIDLStyleValue>;
34
+ export declare const styleDefinitionsDecoder: Decoder<UIDLStyleDefinitions>;
35
+ export declare const eventHandlerStatementDecoder: Decoder<UIDLEventHandlerStatement>;
36
+ export declare const propCallEventDecoder: Decoder<UIDLPropCallEvent>;
37
+ export declare const stateChangeEventDecoder: Decoder<UIDLStateModifierEvent>;
38
+ export declare const urlLinkNodeDecoder: Decoder<VUIDLURLLinkNode>;
39
+ export declare const sectionLinkNodeDecoder: Decoder<VUIDLSectionLinkNode>;
40
+ export declare const navLinkNodeDecoder: Decoder<UIDLNavLinkNode>;
41
+ export declare const uidlMailLinkNodeDecoder: Decoder<UIDLMailLinkNode>;
42
+ export declare const phoneLinkNodeDecoder: Decoder<UIDLPhoneLinkNode>;
43
+ export declare const uidlLinkNodeDecoder: Decoder<VUIDLLinkNode>;
44
+ export declare const rawValueDecoder: Decoder<UIDLRawValue>;
45
+ export declare const elementStateDecoder: Decoder<UIDLElementStyleStates>;
46
+ export declare const elementStyleWithStateConditionDecoder: Decoder<UIDLStyleStateCondition>;
47
+ export declare const elementStyleWithMediaConditionDecoder: Decoder<UIDLStyleMediaQueryScreenSizeCondition>;
48
+ export declare const styleConditionsDecoder: Decoder<UIDLStyleConditions>;
49
+ export declare const elementProjectReferencedStyle: Decoder<UIDLElementNodeProjectReferencedStyle>;
50
+ export declare const elementInlineReferencedStyle: Decoder<VUIDLElementNodeInlineReferencedStyle>;
51
+ export declare const classDynamicReferenceDecoder: Decoder<UIDLCompDynamicReference>;
52
+ export declare const elementComponentReferencedStyle: Decoder<VUIDLElementNodeClassReferencedStyle>;
53
+ export declare const designTokensDecoder: Decoder<VUIDLDesignTokens>;
54
+ export declare const elementDecoder: Decoder<VUIDLElement>;
55
+ export declare const slotNodeDecoder: Decoder<VUIDLSlotNode>;
56
+ export declare const repeatNodeDecoder: Decoder<VUIDLRepeatNode>;
57
+ export declare const conditionalNodeDecoder: Decoder<VUIDLConditionalNode>;
58
+ export declare const elementNodeDecoder: Decoder<VUIDLElementNode>;
59
+ export declare const uidlNodeDecoder: Decoder<VUIDLNode>;
@@ -0,0 +1,305 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.elementComponentReferencedStyle = exports.classDynamicReferenceDecoder = exports.elementInlineReferencedStyle = exports.elementProjectReferencedStyle = exports.styleConditionsDecoder = exports.elementStyleWithMediaConditionDecoder = exports.elementStyleWithStateConditionDecoder = exports.elementStateDecoder = exports.rawValueDecoder = exports.uidlLinkNodeDecoder = exports.phoneLinkNodeDecoder = exports.uidlMailLinkNodeDecoder = exports.navLinkNodeDecoder = exports.sectionLinkNodeDecoder = exports.urlLinkNodeDecoder = exports.stateChangeEventDecoder = exports.propCallEventDecoder = exports.eventHandlerStatementDecoder = exports.styleDefinitionsDecoder = exports.styleValueDecoder = exports.attributeValueDecoder = exports.importReferenceDecoder = exports.dependencyDecoder = exports.localDependencyDecoder = exports.externaldependencyDecoder = exports.peerDependencyDecoder = exports.outputOptionsDecoder = exports.stateDefinitionsDecoder = exports.propDefinitionsDecoder = exports.stateValueDetailsDecoder = exports.componentSeoDecoder = exports.iconAssetDecoder = exports.canonicalAssetDecoder = exports.fontAssetDecoder = exports.externalStyleAssetDecoder = exports.inlineStyletAssetDecoder = exports.externalScriptAssetDecoder = exports.inlineScriptAssetDecoder = exports.baseAssetDecoder = exports.globalAssetsDecoder = exports.pageOptionsDecoder = exports.stateOrPropDefinitionDecoder = exports.styleSetDefinitionDecoder = exports.tokenReferenceDecoder = exports.projectStyleConditionsDecoder = exports.styleSetStateConditionDecoder = exports.styleSetMediaConditionDecoder = exports.staticValueDecoder = exports.dynamicValueDecoder = exports.referenceTypeDecoder = void 0;
4
+ exports.uidlNodeDecoder = exports.elementNodeDecoder = exports.conditionalNodeDecoder = exports.repeatNodeDecoder = exports.slotNodeDecoder = exports.elementDecoder = exports.designTokensDecoder = void 0;
5
+ var json_type_validation_1 = require("@mojotech/json-type-validation");
6
+ var custom_combinators_1 = require("./custom-combinators");
7
+ var isValidComponentName = custom_combinators_1.CustomCombinators.isValidComponentName, isValidFileName = custom_combinators_1.CustomCombinators.isValidFileName, isValidElementName = custom_combinators_1.CustomCombinators.isValidElementName, isValidNavLink = custom_combinators_1.CustomCombinators.isValidNavLink;
8
+ exports.referenceTypeDecoder = json_type_validation_1.union(json_type_validation_1.constant('prop'), json_type_validation_1.constant('state'), json_type_validation_1.constant('local'), json_type_validation_1.constant('attr'), json_type_validation_1.constant('children'), json_type_validation_1.constant('token'));
9
+ exports.dynamicValueDecoder = json_type_validation_1.object({
10
+ type: json_type_validation_1.constant('dynamic'),
11
+ content: json_type_validation_1.object({
12
+ referenceType: exports.referenceTypeDecoder,
13
+ id: json_type_validation_1.string(),
14
+ }),
15
+ });
16
+ exports.staticValueDecoder = json_type_validation_1.object({
17
+ type: json_type_validation_1.constant('static'),
18
+ content: json_type_validation_1.union(json_type_validation_1.string(), json_type_validation_1.number(), json_type_validation_1.boolean(), json_type_validation_1.array()),
19
+ });
20
+ exports.styleSetMediaConditionDecoder = json_type_validation_1.object({
21
+ type: json_type_validation_1.constant('screen-size'),
22
+ meta: json_type_validation_1.object({
23
+ maxWidth: json_type_validation_1.number(),
24
+ maxHeight: json_type_validation_1.optional(json_type_validation_1.number()),
25
+ minHeight: json_type_validation_1.optional(json_type_validation_1.number()),
26
+ minWidth: json_type_validation_1.optional(json_type_validation_1.number()),
27
+ }),
28
+ content: json_type_validation_1.dict(json_type_validation_1.union(exports.staticValueDecoder, json_type_validation_1.string(), json_type_validation_1.number(), json_type_validation_1.lazy(function () { return exports.tokenReferenceDecoder; }))),
29
+ });
30
+ exports.styleSetStateConditionDecoder = json_type_validation_1.object({
31
+ type: json_type_validation_1.constant('element-state'),
32
+ meta: json_type_validation_1.object({
33
+ state: json_type_validation_1.lazy(function () { return exports.elementStateDecoder; }),
34
+ }),
35
+ content: json_type_validation_1.dict(json_type_validation_1.union(exports.staticValueDecoder, json_type_validation_1.string(), json_type_validation_1.number(), json_type_validation_1.lazy(function () { return exports.tokenReferenceDecoder; }))),
36
+ });
37
+ exports.projectStyleConditionsDecoder = json_type_validation_1.union(exports.styleSetMediaConditionDecoder, exports.styleSetStateConditionDecoder);
38
+ exports.tokenReferenceDecoder = json_type_validation_1.object({
39
+ type: json_type_validation_1.constant('dynamic'),
40
+ content: json_type_validation_1.object({
41
+ referenceType: json_type_validation_1.constant('token'),
42
+ id: json_type_validation_1.string(),
43
+ }),
44
+ });
45
+ exports.styleSetDefinitionDecoder = json_type_validation_1.object({
46
+ type: json_type_validation_1.union(json_type_validation_1.constant('reusable-project-style-map'), json_type_validation_1.constant('reusable-component-style-map')),
47
+ conditions: json_type_validation_1.optional(json_type_validation_1.array(exports.projectStyleConditionsDecoder)),
48
+ content: json_type_validation_1.dict(json_type_validation_1.union(exports.staticValueDecoder, json_type_validation_1.string(), json_type_validation_1.number(), exports.tokenReferenceDecoder)),
49
+ });
50
+ // TODO: Implement decoder for () => void
51
+ exports.stateOrPropDefinitionDecoder = json_type_validation_1.union(json_type_validation_1.string(), json_type_validation_1.number(), json_type_validation_1.boolean(), json_type_validation_1.array(json_type_validation_1.union(json_type_validation_1.string(), json_type_validation_1.number(), json_type_validation_1.object())), json_type_validation_1.object());
52
+ exports.pageOptionsDecoder = json_type_validation_1.object({
53
+ componentName: json_type_validation_1.optional(isValidComponentName()),
54
+ navLink: json_type_validation_1.optional(isValidNavLink()),
55
+ fileName: json_type_validation_1.optional(isValidFileName()),
56
+ });
57
+ exports.globalAssetsDecoder = json_type_validation_1.union(json_type_validation_1.lazy(function () { return exports.inlineScriptAssetDecoder; }), json_type_validation_1.lazy(function () { return exports.externalScriptAssetDecoder; }), json_type_validation_1.lazy(function () { return exports.inlineStyletAssetDecoder; }), json_type_validation_1.lazy(function () { return exports.externalStyleAssetDecoder; }), json_type_validation_1.lazy(function () { return exports.fontAssetDecoder; }), json_type_validation_1.lazy(function () { return exports.canonicalAssetDecoder; }), json_type_validation_1.lazy(function () { return exports.iconAssetDecoder; }));
58
+ exports.baseAssetDecoder = json_type_validation_1.object({
59
+ options: json_type_validation_1.optional(json_type_validation_1.object({
60
+ async: json_type_validation_1.optional(json_type_validation_1.boolean()),
61
+ defer: json_type_validation_1.optional(json_type_validation_1.boolean()),
62
+ target: json_type_validation_1.optional(json_type_validation_1.string()),
63
+ })),
64
+ });
65
+ exports.inlineScriptAssetDecoder = json_type_validation_1.intersection(json_type_validation_1.object({
66
+ type: json_type_validation_1.constant('script'),
67
+ content: json_type_validation_1.string(),
68
+ }), json_type_validation_1.optional(exports.baseAssetDecoder));
69
+ exports.externalScriptAssetDecoder = json_type_validation_1.intersection(json_type_validation_1.object({
70
+ type: json_type_validation_1.constant('script'),
71
+ path: json_type_validation_1.string(),
72
+ }), json_type_validation_1.optional(exports.baseAssetDecoder));
73
+ exports.inlineStyletAssetDecoder = json_type_validation_1.object({
74
+ type: json_type_validation_1.constant('style'),
75
+ content: json_type_validation_1.string(),
76
+ });
77
+ exports.externalStyleAssetDecoder = json_type_validation_1.object({
78
+ type: json_type_validation_1.constant('style'),
79
+ path: json_type_validation_1.string(),
80
+ });
81
+ exports.fontAssetDecoder = json_type_validation_1.object({
82
+ type: json_type_validation_1.constant('font'),
83
+ path: json_type_validation_1.string(),
84
+ });
85
+ exports.canonicalAssetDecoder = json_type_validation_1.object({
86
+ type: json_type_validation_1.constant('canonical'),
87
+ path: json_type_validation_1.string(),
88
+ });
89
+ exports.iconAssetDecoder = json_type_validation_1.object({
90
+ type: json_type_validation_1.constant('icon'),
91
+ path: json_type_validation_1.string(),
92
+ options: json_type_validation_1.optional(json_type_validation_1.object({
93
+ iconType: json_type_validation_1.optional(json_type_validation_1.string()),
94
+ iconSizes: json_type_validation_1.optional(json_type_validation_1.string()),
95
+ })),
96
+ });
97
+ exports.componentSeoDecoder = json_type_validation_1.object({
98
+ title: json_type_validation_1.optional(json_type_validation_1.string()),
99
+ metaTags: json_type_validation_1.optional(json_type_validation_1.array(json_type_validation_1.dict(json_type_validation_1.string()))),
100
+ assets: json_type_validation_1.optional(json_type_validation_1.array(exports.globalAssetsDecoder)),
101
+ });
102
+ exports.stateValueDetailsDecoder = json_type_validation_1.object({
103
+ value: json_type_validation_1.union(json_type_validation_1.string(), json_type_validation_1.number(), json_type_validation_1.boolean()),
104
+ pageOptions: json_type_validation_1.optional(exports.pageOptionsDecoder),
105
+ seo: json_type_validation_1.optional(exports.componentSeoDecoder),
106
+ });
107
+ exports.propDefinitionsDecoder = json_type_validation_1.object({
108
+ type: json_type_validation_1.union(json_type_validation_1.constant('string'), json_type_validation_1.constant('boolean'), json_type_validation_1.constant('number'), json_type_validation_1.constant('array'), json_type_validation_1.constant('func'), json_type_validation_1.constant('object'), json_type_validation_1.constant('children')),
109
+ defaultValue: json_type_validation_1.optional(exports.stateOrPropDefinitionDecoder),
110
+ isRequired: json_type_validation_1.optional(json_type_validation_1.boolean()),
111
+ });
112
+ exports.stateDefinitionsDecoder = json_type_validation_1.object({
113
+ type: json_type_validation_1.union(json_type_validation_1.constant('string'), json_type_validation_1.constant('boolean'), json_type_validation_1.constant('number'), json_type_validation_1.constant('array'), json_type_validation_1.constant('func'), json_type_validation_1.constant('object'), json_type_validation_1.constant('children')),
114
+ defaultValue: exports.stateOrPropDefinitionDecoder,
115
+ values: json_type_validation_1.optional(json_type_validation_1.array(exports.stateValueDetailsDecoder)),
116
+ });
117
+ exports.outputOptionsDecoder = json_type_validation_1.object({
118
+ componentClassName: json_type_validation_1.optional(isValidComponentName()),
119
+ fileName: json_type_validation_1.optional(isValidFileName()),
120
+ styleFileName: json_type_validation_1.optional(isValidFileName()),
121
+ templateFileName: json_type_validation_1.optional(isValidFileName()),
122
+ moduleName: json_type_validation_1.optional(isValidFileName()),
123
+ folderPath: json_type_validation_1.optional(json_type_validation_1.array(isValidFileName())),
124
+ });
125
+ exports.peerDependencyDecoder = json_type_validation_1.object({
126
+ type: json_type_validation_1.constant('package'),
127
+ version: json_type_validation_1.string(),
128
+ path: json_type_validation_1.string(),
129
+ });
130
+ exports.externaldependencyDecoder = json_type_validation_1.object({
131
+ type: json_type_validation_1.union(json_type_validation_1.constant('library'), json_type_validation_1.constant('package')),
132
+ path: json_type_validation_1.string(),
133
+ version: json_type_validation_1.string(),
134
+ meta: json_type_validation_1.optional(json_type_validation_1.object({
135
+ namedImport: json_type_validation_1.optional(json_type_validation_1.boolean()),
136
+ originalName: json_type_validation_1.optional(json_type_validation_1.string()),
137
+ importJustPath: json_type_validation_1.optional(json_type_validation_1.boolean()),
138
+ useAsReference: json_type_validation_1.optional(json_type_validation_1.boolean()),
139
+ })),
140
+ });
141
+ exports.localDependencyDecoder = json_type_validation_1.object({
142
+ type: json_type_validation_1.constant('local'),
143
+ path: json_type_validation_1.optional(json_type_validation_1.string()),
144
+ meta: json_type_validation_1.optional(json_type_validation_1.object({
145
+ namedImport: json_type_validation_1.optional(json_type_validation_1.boolean()),
146
+ originalName: json_type_validation_1.optional(json_type_validation_1.string()),
147
+ importJustPath: json_type_validation_1.optional(json_type_validation_1.boolean()),
148
+ })),
149
+ });
150
+ exports.dependencyDecoder = json_type_validation_1.union(exports.localDependencyDecoder, exports.externaldependencyDecoder);
151
+ exports.importReferenceDecoder = json_type_validation_1.object({
152
+ type: json_type_validation_1.constant('import'),
153
+ content: json_type_validation_1.object({
154
+ id: json_type_validation_1.string(),
155
+ }),
156
+ });
157
+ exports.attributeValueDecoder = json_type_validation_1.union(exports.dynamicValueDecoder, exports.staticValueDecoder, exports.importReferenceDecoder);
158
+ exports.styleValueDecoder = json_type_validation_1.union(exports.staticValueDecoder, exports.dynamicValueDecoder);
159
+ exports.styleDefinitionsDecoder = json_type_validation_1.dict(exports.styleValueDecoder);
160
+ exports.eventHandlerStatementDecoder = json_type_validation_1.union(json_type_validation_1.lazy(function () { return exports.propCallEventDecoder; }), json_type_validation_1.lazy(function () { return exports.stateChangeEventDecoder; }));
161
+ exports.propCallEventDecoder = json_type_validation_1.object({
162
+ type: json_type_validation_1.constant('propCall'),
163
+ calls: json_type_validation_1.string(),
164
+ args: json_type_validation_1.optional(json_type_validation_1.array(json_type_validation_1.union(json_type_validation_1.string(), json_type_validation_1.number(), json_type_validation_1.boolean()))),
165
+ });
166
+ exports.stateChangeEventDecoder = json_type_validation_1.object({
167
+ type: json_type_validation_1.constant('stateChange'),
168
+ modifies: json_type_validation_1.string(),
169
+ newState: json_type_validation_1.union(json_type_validation_1.string(), json_type_validation_1.number(), json_type_validation_1.boolean()),
170
+ });
171
+ exports.urlLinkNodeDecoder = json_type_validation_1.object({
172
+ type: json_type_validation_1.constant('url'),
173
+ content: json_type_validation_1.object({
174
+ url: json_type_validation_1.union(exports.attributeValueDecoder, json_type_validation_1.string()),
175
+ newTab: json_type_validation_1.boolean(),
176
+ }),
177
+ });
178
+ exports.sectionLinkNodeDecoder = json_type_validation_1.object({
179
+ type: json_type_validation_1.constant('section'),
180
+ content: json_type_validation_1.dict(json_type_validation_1.string()),
181
+ });
182
+ exports.navLinkNodeDecoder = json_type_validation_1.object({
183
+ type: json_type_validation_1.constant('navlink'),
184
+ content: json_type_validation_1.object({
185
+ routeName: json_type_validation_1.string(),
186
+ }),
187
+ });
188
+ exports.uidlMailLinkNodeDecoder = json_type_validation_1.object({
189
+ type: json_type_validation_1.constant('mail'),
190
+ content: json_type_validation_1.object({
191
+ mail: json_type_validation_1.optional(json_type_validation_1.string()),
192
+ subject: json_type_validation_1.optional(json_type_validation_1.string()),
193
+ body: json_type_validation_1.optional(json_type_validation_1.string()),
194
+ }),
195
+ });
196
+ exports.phoneLinkNodeDecoder = json_type_validation_1.object({
197
+ type: json_type_validation_1.constant('phone'),
198
+ content: json_type_validation_1.object({
199
+ phone: json_type_validation_1.string(),
200
+ }),
201
+ });
202
+ exports.uidlLinkNodeDecoder = json_type_validation_1.union(exports.urlLinkNodeDecoder, exports.sectionLinkNodeDecoder, exports.navLinkNodeDecoder, exports.uidlMailLinkNodeDecoder, exports.phoneLinkNodeDecoder);
203
+ exports.rawValueDecoder = json_type_validation_1.object({
204
+ type: json_type_validation_1.constant('raw'),
205
+ content: json_type_validation_1.string(),
206
+ });
207
+ exports.elementStateDecoder = json_type_validation_1.oneOf(json_type_validation_1.constant('hover'), json_type_validation_1.constant('active'), json_type_validation_1.constant('focus'), json_type_validation_1.constant('focus-within'), json_type_validation_1.constant('focus-visible'), json_type_validation_1.constant('disabled'), json_type_validation_1.constant('visited'), json_type_validation_1.constant('checked'), json_type_validation_1.constant('link'));
208
+ exports.elementStyleWithStateConditionDecoder = json_type_validation_1.object({
209
+ conditionType: json_type_validation_1.constant('element-state'),
210
+ content: exports.elementStateDecoder,
211
+ });
212
+ exports.elementStyleWithMediaConditionDecoder = json_type_validation_1.object({
213
+ conditionType: json_type_validation_1.constant('screen-size'),
214
+ minHeight: json_type_validation_1.optional(json_type_validation_1.number()),
215
+ maxHeight: json_type_validation_1.optional(json_type_validation_1.number()),
216
+ minWidth: json_type_validation_1.optional(json_type_validation_1.number()),
217
+ maxWidth: json_type_validation_1.number(),
218
+ });
219
+ exports.styleConditionsDecoder = json_type_validation_1.union(exports.elementStyleWithMediaConditionDecoder, exports.elementStyleWithStateConditionDecoder);
220
+ exports.elementProjectReferencedStyle = json_type_validation_1.object({
221
+ type: json_type_validation_1.constant('style-map'),
222
+ content: json_type_validation_1.object({
223
+ mapType: json_type_validation_1.constant('project-referenced'),
224
+ conditions: json_type_validation_1.optional(json_type_validation_1.array(exports.styleConditionsDecoder)),
225
+ referenceId: json_type_validation_1.string(),
226
+ }),
227
+ });
228
+ exports.elementInlineReferencedStyle = json_type_validation_1.object({
229
+ type: json_type_validation_1.constant('style-map'),
230
+ content: json_type_validation_1.object({
231
+ mapType: json_type_validation_1.constant('inlined'),
232
+ conditions: json_type_validation_1.array(exports.styleConditionsDecoder),
233
+ styles: json_type_validation_1.optional(json_type_validation_1.dict(json_type_validation_1.union(exports.attributeValueDecoder, json_type_validation_1.string(), json_type_validation_1.number()))),
234
+ }),
235
+ });
236
+ exports.classDynamicReferenceDecoder = json_type_validation_1.object({
237
+ type: json_type_validation_1.constant('dynamic'),
238
+ content: json_type_validation_1.object({
239
+ referenceType: json_type_validation_1.union(json_type_validation_1.constant('prop'), json_type_validation_1.constant('comp')),
240
+ id: json_type_validation_1.string(),
241
+ }),
242
+ });
243
+ exports.elementComponentReferencedStyle = json_type_validation_1.object({
244
+ type: json_type_validation_1.constant('style-map'),
245
+ content: json_type_validation_1.object({
246
+ mapType: json_type_validation_1.constant('component-referenced'),
247
+ content: json_type_validation_1.union(json_type_validation_1.string(), exports.staticValueDecoder, exports.classDynamicReferenceDecoder),
248
+ }),
249
+ });
250
+ exports.designTokensDecoder = json_type_validation_1.dict(json_type_validation_1.union(exports.staticValueDecoder, json_type_validation_1.string(), json_type_validation_1.number()));
251
+ exports.elementDecoder = json_type_validation_1.object({
252
+ elementType: json_type_validation_1.string(),
253
+ semanticType: json_type_validation_1.optional(json_type_validation_1.string()),
254
+ name: json_type_validation_1.optional(isValidElementName()),
255
+ key: json_type_validation_1.optional(json_type_validation_1.string()),
256
+ dependency: json_type_validation_1.optional(exports.dependencyDecoder),
257
+ style: json_type_validation_1.optional(json_type_validation_1.dict(json_type_validation_1.union(exports.attributeValueDecoder, json_type_validation_1.string(), json_type_validation_1.number()))),
258
+ attrs: json_type_validation_1.optional(json_type_validation_1.dict(json_type_validation_1.union(exports.attributeValueDecoder, json_type_validation_1.string(), json_type_validation_1.number()))),
259
+ events: json_type_validation_1.optional(json_type_validation_1.dict(json_type_validation_1.array(exports.eventHandlerStatementDecoder))),
260
+ abilities: json_type_validation_1.optional(json_type_validation_1.object({
261
+ link: json_type_validation_1.optional(exports.uidlLinkNodeDecoder),
262
+ })),
263
+ children: json_type_validation_1.optional(json_type_validation_1.array(json_type_validation_1.lazy(function () { return exports.uidlNodeDecoder; }))),
264
+ referencedStyles: json_type_validation_1.optional(json_type_validation_1.dict(json_type_validation_1.union(exports.elementInlineReferencedStyle, exports.elementProjectReferencedStyle, exports.elementComponentReferencedStyle))),
265
+ selfClosing: json_type_validation_1.optional(json_type_validation_1.boolean()),
266
+ ignore: json_type_validation_1.optional(json_type_validation_1.boolean()),
267
+ });
268
+ exports.slotNodeDecoder = json_type_validation_1.object({
269
+ type: json_type_validation_1.constant('slot'),
270
+ content: json_type_validation_1.union(json_type_validation_1.object({
271
+ name: json_type_validation_1.optional(json_type_validation_1.string()),
272
+ fallback: json_type_validation_1.optional(json_type_validation_1.union(exports.staticValueDecoder, exports.dynamicValueDecoder, json_type_validation_1.lazy(function () { return exports.elementNodeDecoder; }))),
273
+ }), json_type_validation_1.object({})),
274
+ });
275
+ exports.repeatNodeDecoder = json_type_validation_1.object({
276
+ type: json_type_validation_1.constant('repeat'),
277
+ content: json_type_validation_1.object({
278
+ node: json_type_validation_1.lazy(function () { return exports.elementNodeDecoder; }),
279
+ dataSource: json_type_validation_1.optional(exports.attributeValueDecoder),
280
+ meta: json_type_validation_1.optional(json_type_validation_1.object({
281
+ useIndex: json_type_validation_1.optional(json_type_validation_1.boolean()),
282
+ iteratorName: json_type_validation_1.optional(json_type_validation_1.string()),
283
+ dataSourceIdentifier: json_type_validation_1.optional(json_type_validation_1.string()),
284
+ iteratorKey: json_type_validation_1.optional(json_type_validation_1.string()),
285
+ })),
286
+ }),
287
+ });
288
+ exports.conditionalNodeDecoder = json_type_validation_1.object({
289
+ type: json_type_validation_1.constant('conditional'),
290
+ content: json_type_validation_1.object({
291
+ node: json_type_validation_1.lazy(function () { return exports.uidlNodeDecoder; }),
292
+ reference: exports.dynamicValueDecoder,
293
+ value: json_type_validation_1.union(json_type_validation_1.string(), json_type_validation_1.number(), json_type_validation_1.boolean()),
294
+ condition: json_type_validation_1.optional(json_type_validation_1.object({
295
+ conditions: json_type_validation_1.array(json_type_validation_1.object({ operation: json_type_validation_1.string(), operand: json_type_validation_1.optional(json_type_validation_1.union(json_type_validation_1.string(), json_type_validation_1.number(), json_type_validation_1.boolean())) })),
296
+ matchingCriteria: json_type_validation_1.optional(json_type_validation_1.string()),
297
+ })),
298
+ }),
299
+ });
300
+ exports.elementNodeDecoder = json_type_validation_1.object({
301
+ type: json_type_validation_1.constant('element'),
302
+ content: exports.elementDecoder,
303
+ });
304
+ exports.uidlNodeDecoder = json_type_validation_1.union(exports.elementNodeDecoder, exports.dynamicValueDecoder, exports.staticValueDecoder, exports.rawValueDecoder, exports.conditionalNodeDecoder, exports.repeatNodeDecoder, exports.slotNodeDecoder, json_type_validation_1.string());
305
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/decoders/utils.ts"],"names":[],"mappings":";;;;AAAA,uEAcuC;AA2DvC,2DAAwD;AAEhD,IAAA,oBAAoB,GAC1B,sCAAiB,qBADS,EAAE,eAAe,GAC3C,sCAAiB,gBAD0B,EAAE,kBAAkB,GAC/D,sCAAiB,mBAD8C,EAAE,cAAc,GAC/E,sCAAiB,eAD8D,CAC9D;AAEN,QAAA,oBAAoB,GAA2B,4BAAK,CAC/D,+BAAQ,CAAC,MAAM,CAAC,EAChB,+BAAQ,CAAC,OAAO,CAAC,EACjB,+BAAQ,CAAC,OAAO,CAAC,EACjB,+BAAQ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oders/utils';
3
+ export { default as Validator } from './validator';
4
+ export { Parser, Decoders };
5
+ export * from './decoders/component-decoder';
6
+ export * from './decoders/project-decoder';
7
+ export * from './decoders/utils';
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.Decoders = exports.Parser = exports.Validator = void 0;
29
+ var Parser = __importStar(require("./parser"));
30
+ exports.Parser = Parser;
31
+ var Decoders = __importStar(require("./decoders/utils"));
32
+ exports.Decoders = Decoders;
33
+ var validator_1 = require("./validator");
34
+ Object.defineProperty(exports, "Validator", { enumerable: true, get: function () { return __importDefault(validator_1).default; } });
35
+ __exportStar(require("./decoders/component-decoder"), exports);
36
+ __exportStar(require("./decoders/project-decoder"), exports);
37
+ __exportStar(require("./decoders/utils"), exports);
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAkC;AAIzB,wBAAM;AAHf,yDAA4C;AAG3B,4BAAQ;AADzB,yCAAkD;AAAzC,uHAAA,OAAO,OAAa;AAG7B,+DAA4C;AAC5C,6DAA0C;AAC1C,mDAAgC"}
@@ -0,0 +1,10 @@
1
+ import { ComponentUIDL, ProjectUIDL } from '@teleporthq/teleport-types';
2
+ interface ParseComponentJSONParams {
3
+ noClone?: boolean;
4
+ }
5
+ export declare const parseComponentJSON: (input: Record<string, unknown>, params?: ParseComponentJSONParams) => ComponentUIDL;
6
+ interface ParseProjectJSONParams {
7
+ noClone?: boolean;
8
+ }
9
+ export declare const parseProjectJSON: (input: Record<string, unknown>, params?: ParseProjectJSONParams) => ProjectUIDL;
10
+ export {};