@fragmentsx/definition 0.0.3 → 0.2.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 (103) hide show
  1. package/dist/constants/index.d.ts +189 -0
  2. package/dist/constants/index.d.ts.map +1 -0
  3. package/dist/helpers/findSchemaByPath.d.ts +9 -0
  4. package/dist/helpers/findSchemaByPath.d.ts.map +1 -0
  5. package/dist/helpers/getLayerSchema.d.ts +2 -0
  6. package/dist/helpers/getLayerSchema.d.ts.map +1 -0
  7. package/dist/helpers/getNormalizeLayer.d.ts +4 -0
  8. package/dist/helpers/getNormalizeLayer.d.ts.map +1 -0
  9. package/dist/helpers/layerField.d.ts +12 -0
  10. package/dist/helpers/layerField.d.ts.map +1 -0
  11. package/dist/helpers/normalizeLayer.d.ts +10 -0
  12. package/dist/helpers/normalizeLayer.d.ts.map +1 -0
  13. package/dist/helpers/parseLayerField.d.ts +20 -0
  14. package/dist/helpers/parseLayerField.d.ts.map +1 -0
  15. package/dist/index.cjs.js +515 -67
  16. package/dist/index.d.ts +5 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.es.js +515 -67
  19. package/dist/schemas/ChildrenSchema.d.ts +5 -0
  20. package/dist/schemas/ChildrenSchema.d.ts.map +1 -0
  21. package/dist/schemas/CssOverrideSchema.d.ts +5 -0
  22. package/dist/schemas/CssOverrideSchema.d.ts.map +1 -0
  23. package/dist/schemas/GraphFieldSchema.d.ts +6 -0
  24. package/dist/schemas/GraphFieldSchema.d.ts.map +1 -0
  25. package/dist/schemas/InteractionsSchema.d.ts +5 -0
  26. package/dist/schemas/InteractionsSchema.d.ts.map +1 -0
  27. package/dist/schemas/LinkSchema.d.ts +6 -0
  28. package/dist/schemas/LinkSchema.d.ts.map +1 -0
  29. package/dist/schemas/OverridesSchema.d.ts +6 -0
  30. package/dist/schemas/OverridesSchema.d.ts.map +1 -0
  31. package/dist/schemas/helperNodes/BorderSchema.d.ts +12 -0
  32. package/dist/schemas/helperNodes/BorderSchema.d.ts.map +1 -0
  33. package/dist/schemas/helperNodes/ClassnameSchema.d.ts +9 -0
  34. package/dist/schemas/helperNodes/ClassnameSchema.d.ts.map +1 -0
  35. package/dist/schemas/helperNodes/CssChunkSchema.d.ts +9 -0
  36. package/dist/schemas/helperNodes/CssChunkSchema.d.ts.map +1 -0
  37. package/dist/schemas/helperNodes/ImagePaintSchema.d.ts +11 -0
  38. package/dist/schemas/helperNodes/ImagePaintSchema.d.ts.map +1 -0
  39. package/dist/schemas/helperNodes/InteractionSchema.d.ts +9 -0
  40. package/dist/schemas/helperNodes/InteractionSchema.d.ts.map +1 -0
  41. package/dist/schemas/helperNodes/LinearGradientSchema.d.ts +11 -0
  42. package/dist/schemas/helperNodes/LinearGradientSchema.d.ts.map +1 -0
  43. package/dist/schemas/helperNodes/LinkSchema.d.ts +11 -0
  44. package/dist/schemas/helperNodes/LinkSchema.d.ts.map +1 -0
  45. package/dist/schemas/helperNodes/PaintSchema.d.ts +13 -0
  46. package/dist/schemas/helperNodes/PaintSchema.d.ts.map +1 -0
  47. package/dist/schemas/helperNodes/PaintsSchema.d.ts +11 -0
  48. package/dist/schemas/helperNodes/PaintsSchema.d.ts.map +1 -0
  49. package/dist/schemas/helperNodes/StopColorSchema.d.ts +11 -0
  50. package/dist/schemas/helperNodes/StopColorSchema.d.ts.map +1 -0
  51. package/dist/schemas/helperNodes/interactions/MutateEventSchema.d.ts +7 -0
  52. package/dist/schemas/helperNodes/interactions/MutateEventSchema.d.ts.map +1 -0
  53. package/dist/schemas/nodes/CollectionSchema.d.ts +49 -0
  54. package/dist/schemas/nodes/CollectionSchema.d.ts.map +1 -0
  55. package/dist/schemas/nodes/FragmentSchema.d.ts +13 -0
  56. package/dist/schemas/nodes/FragmentSchema.d.ts.map +1 -0
  57. package/dist/schemas/nodes/FrameSchema.d.ts +52 -0
  58. package/dist/schemas/nodes/FrameSchema.d.ts.map +1 -0
  59. package/dist/schemas/nodes/InstanceSchema.d.ts +39 -0
  60. package/dist/schemas/nodes/InstanceSchema.d.ts.map +1 -0
  61. package/dist/schemas/nodes/StopColorSchema.d.ts +8 -0
  62. package/dist/schemas/nodes/StopColorSchema.d.ts.map +1 -0
  63. package/dist/schemas/nodes/TextSchema.d.ts +41 -0
  64. package/dist/schemas/nodes/TextSchema.d.ts.map +1 -0
  65. package/dist/schemas/styles/BorderSchema.d.ts +7 -0
  66. package/dist/schemas/styles/BorderSchema.d.ts.map +1 -0
  67. package/dist/schemas/styles/FillSchema.d.ts +9 -0
  68. package/dist/schemas/styles/FillSchema.d.ts.map +1 -0
  69. package/dist/schemas/styles/LayerSchema.d.ts +11 -0
  70. package/dist/schemas/styles/LayerSchema.d.ts.map +1 -0
  71. package/dist/schemas/styles/PositionSchema.d.ts +11 -0
  72. package/dist/schemas/styles/PositionSchema.d.ts.map +1 -0
  73. package/dist/schemas/styles/SceneSchema.d.ts +9 -0
  74. package/dist/schemas/styles/SceneSchema.d.ts.map +1 -0
  75. package/dist/schemas/styles/SizeSchema.d.ts +17 -0
  76. package/dist/schemas/styles/SizeSchema.d.ts.map +1 -0
  77. package/dist/schemas/styles/fields/BorderRadiusSchema.d.ts +3 -0
  78. package/dist/schemas/styles/fields/BorderRadiusSchema.d.ts.map +1 -0
  79. package/dist/schemas/styles/fields/OverflowSchema.d.ts +3 -0
  80. package/dist/schemas/styles/fields/OverflowSchema.d.ts.map +1 -0
  81. package/dist/schemas/variables/ArrayVariableSchema.d.ts +13 -0
  82. package/dist/schemas/variables/ArrayVariableSchema.d.ts.map +1 -0
  83. package/dist/schemas/variables/BooleanVariableSchema.d.ts +12 -0
  84. package/dist/schemas/variables/BooleanVariableSchema.d.ts.map +1 -0
  85. package/dist/schemas/variables/ColorVariableSchema.d.ts +12 -0
  86. package/dist/schemas/variables/ColorVariableSchema.d.ts.map +1 -0
  87. package/dist/schemas/variables/EnumVariableSchema.d.ts +13 -0
  88. package/dist/schemas/variables/EnumVariableSchema.d.ts.map +1 -0
  89. package/dist/schemas/variables/EventVariableSchema.d.ts +13 -0
  90. package/dist/schemas/variables/EventVariableSchema.d.ts.map +1 -0
  91. package/dist/schemas/variables/ImageVariableSchema.d.ts +12 -0
  92. package/dist/schemas/variables/ImageVariableSchema.d.ts.map +1 -0
  93. package/dist/schemas/variables/LinkVariableSchema.d.ts +12 -0
  94. package/dist/schemas/variables/LinkVariableSchema.d.ts.map +1 -0
  95. package/dist/schemas/variables/NumberVariableSchema.d.ts +16 -0
  96. package/dist/schemas/variables/NumberVariableSchema.d.ts.map +1 -0
  97. package/dist/schemas/variables/ObjectVariableSchema.d.ts +13 -0
  98. package/dist/schemas/variables/ObjectVariableSchema.d.ts.map +1 -0
  99. package/dist/schemas/variables/StringVariableSchema.d.ts +15 -0
  100. package/dist/schemas/variables/StringVariableSchema.d.ts.map +1 -0
  101. package/dist/types/index.d.ts +1 -0
  102. package/dist/types/index.d.ts.map +1 -0
  103. package/package.json +4 -1
package/dist/index.es.js CHANGED
@@ -8,6 +8,7 @@ const nodes = createConstants(
8
8
  "Fragment",
9
9
  "FragmentInstance",
10
10
  "Instance",
11
+ "Collection",
11
12
  "Breakpoint",
12
13
  "Frame",
13
14
  "Image",
@@ -16,18 +17,28 @@ const nodes = createConstants(
16
17
  "CssLink",
17
18
  "Variable",
18
19
  "ComputedValue",
19
- "TransformValue"
20
+ "TransformValue",
21
+ "StopColor",
22
+ "LinearGradient",
23
+ "CssChunk",
24
+ "Border",
25
+ "Paint",
26
+ "Link",
27
+ "Classname",
28
+ "ImagePaint"
20
29
  );
21
30
  const fragmentGrowingMode = createConstants("auto", "fill");
22
31
  const borderType = createConstants("None", "Solid", "Dashed", "Dotted");
23
- const linkTarget = createConstants("_blank");
24
- const paintMode = createConstants("None", "Solid", "Image");
25
- const imagePaintScaleModes = createConstants(
26
- "Fill",
27
- "Fit",
28
- "Crop",
29
- "Tile"
32
+ const linkTarget = createConstants("_blank", "none");
33
+ const paintMode = createConstants(
34
+ "None",
35
+ "Solid",
36
+ "LinearGradient",
37
+ "RadialGradient",
38
+ "ConicGradient",
39
+ "Image"
30
40
  );
41
+ const imagePaintScaleModes = createConstants("Auto", "Contain", "Cover");
31
42
  const constrain = createConstants(
32
43
  "Min",
33
44
  "Center",
@@ -67,7 +78,9 @@ const effectName = createConstants(
67
78
  "increase"
68
79
  );
69
80
  const variableType = createConstants(
81
+ "Event",
70
82
  "String",
83
+ "Link",
71
84
  "Boolean",
72
85
  "Array",
73
86
  "Color",
@@ -75,6 +88,7 @@ const variableType = createConstants(
75
88
  "Date",
76
89
  "Enum",
77
90
  "Number",
91
+ "Image",
78
92
  "Object"
79
93
  );
80
94
  const whiteSpace = createConstants(
@@ -111,15 +125,28 @@ const variableTransforms = createConstants(
111
125
  );
112
126
  const renderTarget = createConstants("canvas", "document");
113
127
  const renderMode = createConstants("viewport", "parent", "fixed");
128
+ const interactions = createConstants("click", "mouseover", "appear");
129
+ const eventMode = createConstants("goal", "callback", "tracker");
130
+ const scopeTypes = createConstants(
131
+ "AreaScope",
132
+ "InstanceScope",
133
+ "FragmentScope",
134
+ "CollectionScope",
135
+ "CollectionItemScope"
136
+ );
137
+ const cssChunkScopeTypes = createConstants("Global", "Fragment");
114
138
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
115
139
  __proto__: null,
116
140
  borderType,
117
141
  constrain,
118
142
  createConstants,
143
+ cssChunkScopeTypes,
119
144
  effectName,
120
145
  effectType,
146
+ eventMode,
121
147
  fragmentGrowingMode,
122
148
  imagePaintScaleModes,
149
+ interactions,
123
150
  layerAlign,
124
151
  layerDirection,
125
152
  layerDistribute,
@@ -131,6 +158,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
131
158
  positionType,
132
159
  renderMode,
133
160
  renderTarget,
161
+ scopeTypes,
134
162
  sizing,
135
163
  textDecorations,
136
164
  textTransform,
@@ -320,6 +348,20 @@ function minValue(requirement, message) {
320
348
  };
321
349
  }
322
350
  // @__NO_SIDE_EFFECTS__
351
+ function transform(operation) {
352
+ return {
353
+ kind: "transformation",
354
+ type: "transform",
355
+ reference: transform,
356
+ async: false,
357
+ operation,
358
+ "~run"(dataset) {
359
+ dataset.value = this.operation(dataset.value);
360
+ return dataset;
361
+ }
362
+ };
363
+ }
364
+ // @__NO_SIDE_EFFECTS__
323
365
  function getFallback(schema, dataset, config2) {
324
366
  return typeof schema.fallback === "function" ? (
325
367
  // @ts-expect-error
@@ -340,6 +382,23 @@ function getDefault(schema, dataset, config2) {
340
382
  );
341
383
  }
342
384
  // @__NO_SIDE_EFFECTS__
385
+ function any() {
386
+ return {
387
+ kind: "schema",
388
+ type: "any",
389
+ reference: any,
390
+ expects: "any",
391
+ async: false,
392
+ get "~standard"() {
393
+ return /* @__PURE__ */ _getStandardProps(this);
394
+ },
395
+ "~run"(dataset) {
396
+ dataset.typed = true;
397
+ return dataset;
398
+ }
399
+ };
400
+ }
401
+ // @__NO_SIDE_EFFECTS__
343
402
  function array(item, message) {
344
403
  return {
345
404
  kind: "schema",
@@ -473,6 +532,33 @@ function literal(literal_, message) {
473
532
  };
474
533
  }
475
534
  // @__NO_SIDE_EFFECTS__
535
+ function nullable(wrapped, default_) {
536
+ return {
537
+ kind: "schema",
538
+ type: "nullable",
539
+ reference: nullable,
540
+ expects: `(${wrapped.expects} | null)`,
541
+ async: false,
542
+ wrapped,
543
+ default: default_,
544
+ get "~standard"() {
545
+ return /* @__PURE__ */ _getStandardProps(this);
546
+ },
547
+ "~run"(dataset, config2) {
548
+ if (dataset.value === null) {
549
+ if (this.default !== void 0) {
550
+ dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
551
+ }
552
+ if (dataset.value === null) {
553
+ dataset.typed = true;
554
+ return dataset;
555
+ }
556
+ }
557
+ return this.wrapped["~run"](dataset, config2);
558
+ }
559
+ };
560
+ }
561
+ // @__NO_SIDE_EFFECTS__
476
562
  function number(message) {
477
563
  return {
478
564
  kind: "schema",
@@ -862,14 +948,34 @@ const linkValidator = /* @__PURE__ */ check(
862
948
  return !!value && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.length) === 2;
863
949
  }
864
950
  );
951
+ const isLink = (value) => {
952
+ var _a;
953
+ return (_a = /* @__PURE__ */ safeParse(linkValidator, value)) == null ? void 0 : _a.success;
954
+ };
955
+ const isVariableLink = (value) => {
956
+ var _a, _b;
957
+ return isLink(value) && ((_b = (_a = value == null ? void 0 : value.split) == null ? void 0 : _a.call(value, ":")) == null ? void 0 : _b.at(0)) === nodes.Variable;
958
+ };
865
959
  const getMetadata = (schema) => {
866
960
  var _a;
867
961
  const pipelines = (schema == null ? void 0 : schema.pipe) ?? [];
868
962
  return ((_a = pipelines == null ? void 0 : pipelines.find((pipe2) => /* @__PURE__ */ isOfKind("metadata", pipe2))) == null ? void 0 : _a.metadata) ?? null;
869
963
  };
870
964
  const layerField = (schema, meta) => {
871
- const modifiedSchema = (meta == null ? void 0 : meta.variable) ? /* @__PURE__ */ union([schema, /* @__PURE__ */ pipe(/* @__PURE__ */ string(), linkValidator)]) : schema;
872
- return /* @__PURE__ */ pipe(/* @__PURE__ */ optional(modifiedSchema), /* @__PURE__ */ metadata(meta ?? {}));
965
+ const overridable = (meta == null ? void 0 : meta.overridable) ?? true;
966
+ const variable = (meta == null ? void 0 : meta.variable) ?? false;
967
+ const schemaParts = [schema];
968
+ if (variable) {
969
+ schemaParts.push(/* @__PURE__ */ pipe(/* @__PURE__ */ string(), linkValidator));
970
+ }
971
+ if (overridable) {
972
+ schemaParts.push(/* @__PURE__ */ any());
973
+ }
974
+ return /* @__PURE__ */ pipe(
975
+ /* @__PURE__ */ optional(/* @__PURE__ */ union(schemaParts)),
976
+ /* @__PURE__ */ transform((meta == null ? void 0 : meta.transform) ?? ((v2) => v2)),
977
+ /* @__PURE__ */ metadata(meta ?? {})
978
+ );
873
979
  };
874
980
  const ChildrenSchema = /* @__PURE__ */ object({
875
981
  children: layerField(/* @__PURE__ */ array(/* @__PURE__ */ string()), {
@@ -882,14 +988,35 @@ const GraphFieldSchema = /* @__PURE__ */ object({
882
988
  _type: /* @__PURE__ */ picklist(Object.keys(nodes))
883
989
  });
884
990
  const OverridesSchema = /* @__PURE__ */ object({
885
- overrides: layerField(/* @__PURE__ */ array(/* @__PURE__ */ string()), { overridable: false })
991
+ overrides: layerField(/* @__PURE__ */ array(/* @__PURE__ */ string()), { overridable: false }),
992
+ overrideFrom: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false })
886
993
  });
887
994
  const PositionSchema = /* @__PURE__ */ object({
888
995
  position: layerField(/* @__PURE__ */ enum_(Object.keys(positionType)), {
889
996
  fallback: positionType.absolute
890
997
  }),
891
- top: layerField(/* @__PURE__ */ number(), { fallback: 0 }),
892
- left: layerField(/* @__PURE__ */ number(), { fallback: 0 })
998
+ top: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
999
+ fallback: null,
1000
+ transform: (value) => typeof value === "number" ? Math.ceil(value) : value
1001
+ }),
1002
+ left: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
1003
+ fallback: null,
1004
+ transform: (value) => typeof value === "number" ? Math.ceil(value) : value
1005
+ }),
1006
+ right: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
1007
+ fallback: null,
1008
+ transform: (value) => typeof value === "number" ? Math.ceil(value) : value
1009
+ }),
1010
+ bottom: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ number()), {
1011
+ fallback: null,
1012
+ transform: (value) => typeof value === "number" ? Math.ceil(value) : value
1013
+ }),
1014
+ centerAnchorX: layerField(/* @__PURE__ */ number(), {
1015
+ fallback: 0.5
1016
+ }),
1017
+ centerAnchorY: layerField(/* @__PURE__ */ number(), {
1018
+ fallback: 0.5
1019
+ })
893
1020
  });
894
1021
  const SceneSchema = /* @__PURE__ */ object({
895
1022
  opacity: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0), /* @__PURE__ */ maxValue(1)), {
@@ -897,24 +1024,9 @@ const SceneSchema = /* @__PURE__ */ object({
897
1024
  variable: true
898
1025
  }),
899
1026
  visible: layerField(/* @__PURE__ */ boolean(), { fallback: true, variable: true }),
900
- zIndex: layerField(/* @__PURE__ */ number(), { fallback: -1 }),
901
- borderRadius: layerField(/* @__PURE__ */ string(), { fallback: "0px" }),
902
- overflow: layerField(/* @__PURE__ */ picklist(Object.keys(overflow)), {
903
- fallback: overflow.hidden
904
- })
905
- });
906
- const FillSchema = /* @__PURE__ */ object({
907
- fillType: layerField(/* @__PURE__ */ picklist(Object.keys(paintMode)), {
908
- fallback: paintMode.None
909
- }),
910
- solidFill: layerField(/* @__PURE__ */ string(), { fallback: "#fff" })
911
- });
912
- const BorderSchema = /* @__PURE__ */ object({
913
- borderType: layerField(/* @__PURE__ */ picklist(Object.keys(borderType)), {
914
- fallback: borderType.None
915
- }),
916
- borderWidth: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0)), { fallback: 0 }),
917
- borderColor: layerField(/* @__PURE__ */ string(), { fallback: "#fff" })
1027
+ rotate: layerField(/* @__PURE__ */ number(), { fallback: null }),
1028
+ zIndex: layerField(/* @__PURE__ */ number(), { fallback: null }),
1029
+ classnames: layerField(/* @__PURE__ */ array(linkValidator), { fallback: [] })
918
1030
  });
919
1031
  const SizeSchema = /* @__PURE__ */ object({
920
1032
  widthType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
@@ -923,9 +1035,43 @@ const SizeSchema = /* @__PURE__ */ object({
923
1035
  heightType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
924
1036
  fallback: sizing.Fixed
925
1037
  }),
926
- width: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0)), { fallback: 0 }),
927
- height: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0)), { fallback: 0 }),
928
- aspectRatio: layerField(/* @__PURE__ */ number(), { fallback: -1 })
1038
+ width: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0)), {
1039
+ fallback: 0,
1040
+ transform: Math.ceil
1041
+ }),
1042
+ height: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0)), {
1043
+ fallback: 0,
1044
+ transform: Math.ceil
1045
+ }),
1046
+ aspectRatio: layerField(/* @__PURE__ */ number(), { fallback: -1 }),
1047
+ minWidth: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(-1))), {
1048
+ fallback: -1,
1049
+ transform: Math.ceil
1050
+ }),
1051
+ minWidthType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
1052
+ fallback: sizing.Fixed
1053
+ }),
1054
+ maxWidth: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(-1))), {
1055
+ fallback: -1,
1056
+ transform: Math.ceil
1057
+ }),
1058
+ maxWidthType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
1059
+ fallback: sizing.Fixed
1060
+ }),
1061
+ minHeight: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(-1))), {
1062
+ fallback: -1,
1063
+ transform: Math.ceil
1064
+ }),
1065
+ minHeightType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
1066
+ fallback: sizing.Fixed
1067
+ }),
1068
+ maxHeight: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(-1))), {
1069
+ fallback: -1,
1070
+ transform: Math.ceil
1071
+ }),
1072
+ maxHeightType: layerField(/* @__PURE__ */ picklist(Object.keys(sizing)), {
1073
+ fallback: sizing.Fixed
1074
+ })
929
1075
  });
930
1076
  const LayerSchema = /* @__PURE__ */ object({
931
1077
  layerMode: layerField(/* @__PURE__ */ picklist(Object.keys(layerMode)), {
@@ -944,6 +1090,24 @@ const LayerSchema = /* @__PURE__ */ object({
944
1090
  layerGap: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0)), { fallback: 0 }),
945
1091
  padding: layerField(/* @__PURE__ */ string(), { fallback: "0px" })
946
1092
  });
1093
+ const OverflowSchema = layerField(/* @__PURE__ */ picklist(Object.keys(overflow)), {
1094
+ fallback: overflow.hidden
1095
+ });
1096
+ const BorderRadiusSchema = layerField(/* @__PURE__ */ string(), { fallback: "0px" });
1097
+ const InteractionsSchema = /* @__PURE__ */ object({
1098
+ interactions: layerField(
1099
+ /* @__PURE__ */ array(
1100
+ /* @__PURE__ */ object({
1101
+ on: /* @__PURE__ */ enum_(Object.keys(interactions)),
1102
+ event: /* @__PURE__ */ nullable(linkValidator)
1103
+ })
1104
+ ),
1105
+ { fallback: [] }
1106
+ )
1107
+ });
1108
+ const CssOverrideSchema = /* @__PURE__ */ object({
1109
+ cssOverride: layerField(/* @__PURE__ */ string(), { fallback: "" })
1110
+ });
947
1111
  const FrameSchema = /* @__PURE__ */ pipe(
948
1112
  /* @__PURE__ */ object({
949
1113
  name: layerField(/* @__PURE__ */ string(), { fallback: "Frame", overridable: false }),
@@ -952,19 +1116,21 @@ const FrameSchema = /* @__PURE__ */ pipe(
952
1116
  overridable: false
953
1117
  }),
954
1118
  isPrimary: layerField(/* @__PURE__ */ boolean(), { fallback: false, overridable: false }),
955
- threshold: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ minValue(0)), {
956
- fallback: 320,
957
- overridable: false
958
- }),
1119
+ border: layerField(linkValidator),
1120
+ paint: layerField(linkValidator),
1121
+ link: layerField(linkValidator),
959
1122
  ...ChildrenSchema.entries,
960
1123
  ...GraphFieldSchema.entries,
961
1124
  ...OverridesSchema.entries,
1125
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
962
1126
  ...PositionSchema.entries,
963
1127
  ...SceneSchema.entries,
964
- ...FillSchema.entries,
965
- ...BorderSchema.entries,
966
1128
  ...SizeSchema.entries,
967
- ...LayerSchema.entries
1129
+ ...LayerSchema.entries,
1130
+ ...InteractionsSchema.entries,
1131
+ ...CssOverrideSchema.entries,
1132
+ overflow: OverflowSchema,
1133
+ borderRadius: BorderRadiusSchema
968
1134
  })
969
1135
  );
970
1136
  const TextSchema = /* @__PURE__ */ object({
@@ -972,25 +1138,25 @@ const TextSchema = /* @__PURE__ */ object({
972
1138
  content: layerField(/* @__PURE__ */ string(), {
973
1139
  fallback: ""
974
1140
  }),
975
- variableContent: layerField(/* @__PURE__ */ string(), { fallback: null, variable: true }),
976
- attributes: layerField(
977
- /* @__PURE__ */ object({
978
- fontSize: layerField(/* @__PURE__ */ string(), { fallback: "14px" }),
979
- color: layerField(/* @__PURE__ */ string(), { fallback: "#000" }),
980
- lineHeight: layerField(/* @__PURE__ */ string(), { fallback: "14px" })
981
- }),
982
- { fallback: {} }
983
- ),
1141
+ whiteSpace: layerField(/* @__PURE__ */ enum_(Object.keys(whiteSpace)), {
1142
+ fallback: whiteSpace.pre
1143
+ }),
1144
+ textAlign: layerField(/* @__PURE__ */ string(), { fallback: "left" }),
1145
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1146
+ link: layerField(linkValidator),
984
1147
  ...GraphFieldSchema.entries,
985
1148
  ...OverridesSchema.entries,
1149
+ ...CssOverrideSchema.entries,
986
1150
  ...PositionSchema.entries,
987
1151
  ...SceneSchema.entries,
988
- ...SizeSchema.entries
1152
+ ...SizeSchema.entries,
1153
+ ...InteractionsSchema.entries
989
1154
  });
990
1155
  const FragmentSchema = /* @__PURE__ */ object({
991
1156
  name: layerField(/* @__PURE__ */ string(), { fallback: "Fragment", overridable: false }),
1157
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
992
1158
  horizontalGrow: layerField(/* @__PURE__ */ enum_(Object.keys(fragmentGrowingMode)), {
993
- fallback: fragmentGrowingMode.auto,
1159
+ fallback: fragmentGrowingMode.fill,
994
1160
  overridable: false
995
1161
  }),
996
1162
  verticalGrow: layerField(/* @__PURE__ */ enum_(Object.keys(fragmentGrowingMode)), {
@@ -1001,29 +1167,50 @@ const FragmentSchema = /* @__PURE__ */ object({
1001
1167
  fallback: [],
1002
1168
  overridable: false
1003
1169
  }),
1170
+ cssChunks: layerField(/* @__PURE__ */ array(linkValidator), {
1171
+ fallback: [],
1172
+ overridable: false
1173
+ }),
1004
1174
  ...GraphFieldSchema.entries,
1005
1175
  ...ChildrenSchema.entries
1006
1176
  });
1007
1177
  const InstanceSchema = /* @__PURE__ */ object({
1008
1178
  name: layerField(/* @__PURE__ */ string(), { fallback: "Instance", overridable: false }),
1009
- fragment: layerField(/* @__PURE__ */ string()),
1179
+ fragment: layerField(/* @__PURE__ */ number()),
1180
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1010
1181
  props: layerField(
1011
- /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ number(), /* @__PURE__ */ boolean()])),
1182
+ /* @__PURE__ */ record(
1183
+ /* @__PURE__ */ string(),
1184
+ /* @__PURE__ */ union([
1185
+ /* @__PURE__ */ string(),
1186
+ /* @__PURE__ */ number(),
1187
+ /* @__PURE__ */ boolean(),
1188
+ // For goals
1189
+ /* @__PURE__ */ object({
1190
+ code: /* @__PURE__ */ string(),
1191
+ name: /* @__PURE__ */ string()
1192
+ })
1193
+ ])
1194
+ ),
1012
1195
  {
1013
1196
  fallback: {}
1014
1197
  }
1015
1198
  ),
1199
+ link: layerField(linkValidator),
1016
1200
  ...GraphFieldSchema.entries,
1017
1201
  ...OverridesSchema.entries,
1018
1202
  ...PositionSchema.entries,
1019
1203
  ...SizeSchema.entries,
1020
- ...SceneSchema.entries
1204
+ ...SceneSchema.entries,
1205
+ ...InteractionsSchema.entries
1021
1206
  });
1022
1207
  const NumberVariableSchema = /* @__PURE__ */ object({
1208
+ nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
1023
1209
  name: layerField(/* @__PURE__ */ string(), {
1024
1210
  fallback: "Number",
1025
1211
  overridable: false
1026
1212
  }),
1213
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1027
1214
  type: layerField(/* @__PURE__ */ literal(variableType.Number), {
1028
1215
  fallback: variableType.Number
1029
1216
  }),
@@ -1036,10 +1223,12 @@ const NumberVariableSchema = /* @__PURE__ */ object({
1036
1223
  ...GraphFieldSchema.entries
1037
1224
  });
1038
1225
  const BooleanVariableSchema = /* @__PURE__ */ object({
1226
+ nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
1039
1227
  name: layerField(/* @__PURE__ */ string(), {
1040
1228
  fallback: "Boolean",
1041
1229
  overridable: false
1042
1230
  }),
1231
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1043
1232
  type: layerField(/* @__PURE__ */ literal(variableType.Boolean), {
1044
1233
  fallback: variableType.Boolean
1045
1234
  }),
@@ -1048,10 +1237,12 @@ const BooleanVariableSchema = /* @__PURE__ */ object({
1048
1237
  ...GraphFieldSchema.entries
1049
1238
  });
1050
1239
  const ColorVariableSchema = /* @__PURE__ */ object({
1240
+ nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
1051
1241
  name: layerField(/* @__PURE__ */ string(), {
1052
1242
  fallback: "String",
1053
1243
  overridable: false
1054
1244
  }),
1245
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1055
1246
  type: layerField(/* @__PURE__ */ literal(variableType.Color), {
1056
1247
  fallback: variableType.Color
1057
1248
  }),
@@ -1061,6 +1252,7 @@ const ColorVariableSchema = /* @__PURE__ */ object({
1061
1252
  ...GraphFieldSchema.entries
1062
1253
  });
1063
1254
  const StringVariableSchema = /* @__PURE__ */ object({
1255
+ nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
1064
1256
  name: layerField(/* @__PURE__ */ string(), {
1065
1257
  fallback: "String",
1066
1258
  overridable: false
@@ -1068,10 +1260,221 @@ const StringVariableSchema = /* @__PURE__ */ object({
1068
1260
  type: layerField(/* @__PURE__ */ literal(variableType.String), {
1069
1261
  fallback: variableType.String
1070
1262
  }),
1263
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1071
1264
  defaultValue: layerField(/* @__PURE__ */ string(), { fallback: "" }),
1072
1265
  required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
1073
1266
  placeholder: layerField(/* @__PURE__ */ string(), { fallback: "" }),
1074
1267
  isTextarea: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
1268
+ isRich: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
1269
+ ...GraphFieldSchema.entries
1270
+ });
1271
+ const EventVariableSchema = /* @__PURE__ */ object({
1272
+ nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
1273
+ name: layerField(/* @__PURE__ */ string(), {
1274
+ fallback: "Event",
1275
+ overridable: false
1276
+ }),
1277
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1278
+ type: layerField(/* @__PURE__ */ literal(variableType.Event), {
1279
+ fallback: variableType.Event
1280
+ }),
1281
+ mode: layerField(/* @__PURE__ */ picklist(Object.keys(eventMode)), {
1282
+ fallback: eventMode.callback
1283
+ }),
1284
+ defaultValue: layerField(/* @__PURE__ */ any()),
1285
+ required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
1286
+ ...GraphFieldSchema.entries
1287
+ });
1288
+ const LinkVariableSchema = /* @__PURE__ */ object({
1289
+ nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
1290
+ name: layerField(/* @__PURE__ */ string(), {
1291
+ fallback: "Link",
1292
+ overridable: false
1293
+ }),
1294
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1295
+ type: layerField(/* @__PURE__ */ literal(variableType.Link), {
1296
+ fallback: variableType.Link
1297
+ }),
1298
+ defaultValue: layerField(/* @__PURE__ */ string(), { fallback: "" }),
1299
+ required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
1300
+ ...GraphFieldSchema.entries
1301
+ });
1302
+ const EnumVariableSchema = /* @__PURE__ */ object({
1303
+ nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
1304
+ name: layerField(/* @__PURE__ */ string(), {
1305
+ fallback: "Option",
1306
+ overridable: false
1307
+ }),
1308
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1309
+ type: layerField(/* @__PURE__ */ literal(variableType.Enum), {
1310
+ fallback: variableType.Enum
1311
+ }),
1312
+ defaultValue: layerField(/* @__PURE__ */ string(), { fallback: "" }),
1313
+ required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
1314
+ cases: layerField(
1315
+ /* @__PURE__ */ array(
1316
+ /* @__PURE__ */ object({
1317
+ id: /* @__PURE__ */ string(),
1318
+ name: /* @__PURE__ */ string()
1319
+ })
1320
+ ),
1321
+ { fallback: [] }
1322
+ ),
1323
+ ...GraphFieldSchema.entries
1324
+ });
1325
+ const ObjectVariableSchema = /* @__PURE__ */ object({
1326
+ nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
1327
+ name: layerField(/* @__PURE__ */ string(), {
1328
+ fallback: "Object",
1329
+ overridable: false
1330
+ }),
1331
+ type: layerField(/* @__PURE__ */ literal(variableType.Object), {
1332
+ fallback: variableType.Object
1333
+ }),
1334
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1335
+ defaultValue: layerField(/* @__PURE__ */ object({}), { fallback: {} }),
1336
+ fields: layerField(/* @__PURE__ */ record(/* @__PURE__ */ string(), linkValidator), { fallback: {} }),
1337
+ required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
1338
+ ...GraphFieldSchema.entries
1339
+ });
1340
+ const ImageVariableSchema = /* @__PURE__ */ object({
1341
+ nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
1342
+ name: layerField(/* @__PURE__ */ string(), {
1343
+ fallback: "Image",
1344
+ overridable: false
1345
+ }),
1346
+ type: layerField(/* @__PURE__ */ literal(variableType.Image), {
1347
+ fallback: variableType.Image
1348
+ }),
1349
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1350
+ defaultValue: layerField(/* @__PURE__ */ string(), { fallback: null }),
1351
+ required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
1352
+ ...GraphFieldSchema.entries
1353
+ });
1354
+ const CollectionSchema = /* @__PURE__ */ pipe(
1355
+ /* @__PURE__ */ object({
1356
+ name: layerField(/* @__PURE__ */ string(), {
1357
+ fallback: "Collection",
1358
+ overridable: false
1359
+ }),
1360
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1361
+ source: layerField(linkValidator, {}),
1362
+ border: layerField(linkValidator),
1363
+ paint: layerField(linkValidator),
1364
+ link: layerField(linkValidator),
1365
+ ...ChildrenSchema.entries,
1366
+ ...GraphFieldSchema.entries,
1367
+ ...OverridesSchema.entries,
1368
+ ...PositionSchema.entries,
1369
+ ...SceneSchema.entries,
1370
+ ...SizeSchema.entries,
1371
+ ...LayerSchema.entries,
1372
+ ...InteractionsSchema.entries,
1373
+ ...CssOverrideSchema.entries
1374
+ })
1375
+ );
1376
+ const ArrayVariableSchema = /* @__PURE__ */ object({
1377
+ nodePropertyControlReference: layerField(/* @__PURE__ */ string(), { fallback: null }),
1378
+ name: layerField(/* @__PURE__ */ string(), {
1379
+ fallback: "Collection",
1380
+ overridable: false
1381
+ }),
1382
+ type: layerField(/* @__PURE__ */ literal(variableType.Array), {
1383
+ fallback: variableType.Array
1384
+ }),
1385
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1386
+ defaultValue: layerField(/* @__PURE__ */ array(/* @__PURE__ */ any()), { fallback: [] }),
1387
+ definition: layerField(linkValidator, { fallback: null }),
1388
+ required: layerField(/* @__PURE__ */ boolean(), { fallback: false }),
1389
+ ...GraphFieldSchema.entries
1390
+ });
1391
+ const StopColorSchema = /* @__PURE__ */ object({
1392
+ ...OverridesSchema.entries,
1393
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1394
+ position: layerField(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ maxValue(1), /* @__PURE__ */ minValue(0)), {
1395
+ fallback: 0
1396
+ }),
1397
+ value: layerField(/* @__PURE__ */ string(), { fallback: "#000", variable: true }),
1398
+ ...GraphFieldSchema.entries
1399
+ });
1400
+ const LinearGradientSchema = /* @__PURE__ */ object({
1401
+ ...OverridesSchema.entries,
1402
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1403
+ angle: layerField(/* @__PURE__ */ number(), {
1404
+ fallback: 0
1405
+ }),
1406
+ stops: layerField(/* @__PURE__ */ array(linkValidator), { fallback: [] }),
1407
+ ...GraphFieldSchema.entries
1408
+ });
1409
+ const CssChunkSchema = /* @__PURE__ */ object({
1410
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1411
+ chunkId: layerField(/* @__PURE__ */ number()),
1412
+ // content: layerField(v.string(), {
1413
+ // fallback: "",
1414
+ // }),
1415
+ // scope: layerField(v.picklist(Object.keys(definition.cssChunkScopeTypes)), {
1416
+ // fallback: definition.cssChunkScopeTypes.Fragment,
1417
+ // }),
1418
+ enabled: layerField(/* @__PURE__ */ boolean(), {
1419
+ fallback: true,
1420
+ variable: true
1421
+ }),
1422
+ ...GraphFieldSchema.entries
1423
+ });
1424
+ const BorderSchema = /* @__PURE__ */ object({
1425
+ ...OverridesSchema.entries,
1426
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1427
+ type: layerField(/* @__PURE__ */ picklist(Object.keys(borderType)), {
1428
+ fallback: borderType.None
1429
+ }),
1430
+ width: layerField(/* @__PURE__ */ string(), {
1431
+ fallback: "1px",
1432
+ transform: (value) => {
1433
+ if (typeof value === "number") {
1434
+ return `${value}px`;
1435
+ }
1436
+ return value;
1437
+ }
1438
+ }),
1439
+ paint: layerField(linkValidator),
1440
+ ...GraphFieldSchema.entries
1441
+ });
1442
+ const PaintSchema = /* @__PURE__ */ object({
1443
+ ...OverridesSchema.entries,
1444
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1445
+ type: layerField(/* @__PURE__ */ picklist(Object.keys(paintMode)), {
1446
+ fallback: paintMode.None
1447
+ }),
1448
+ solid: layerField(/* @__PURE__ */ string(), { fallback: "#fff" }),
1449
+ linearGradient: layerField(linkValidator),
1450
+ image: layerField(linkValidator),
1451
+ ...GraphFieldSchema.entries
1452
+ });
1453
+ const ImagePaintSchema = /* @__PURE__ */ object({
1454
+ ...GraphFieldSchema.entries,
1455
+ ...OverridesSchema.entries,
1456
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1457
+ src: layerField(/* @__PURE__ */ string()),
1458
+ scale: layerField(/* @__PURE__ */ picklist(Object.keys(imagePaintScaleModes)), {
1459
+ fallback: imagePaintScaleModes.Auto
1460
+ })
1461
+ });
1462
+ const LinkSchema = /* @__PURE__ */ object({
1463
+ ...OverridesSchema.entries,
1464
+ ...GraphFieldSchema.entries,
1465
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1466
+ href: layerField(/* @__PURE__ */ string(), { fallback: null }),
1467
+ isNewTab: layerField(/* @__PURE__ */ boolean(), {
1468
+ fallback: true
1469
+ })
1470
+ });
1471
+ const ClassnameSchema = /* @__PURE__ */ object({
1472
+ parent: layerField(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), { overridable: false }),
1473
+ value: layerField(/* @__PURE__ */ string(), { fallback: "" }),
1474
+ enabled: layerField(/* @__PURE__ */ boolean(), {
1475
+ fallback: true,
1476
+ variable: true
1477
+ }),
1075
1478
  ...GraphFieldSchema.entries
1076
1479
  });
1077
1480
  const getLayerSchema = (layer) => {
@@ -1080,21 +1483,37 @@ const getLayerSchema = (layer) => {
1080
1483
  if ((layer == null ? void 0 : layer._type) === nodes.Text) return TextSchema;
1081
1484
  if ((layer == null ? void 0 : layer._type) === nodes.Fragment) return FragmentSchema;
1082
1485
  if ((layer == null ? void 0 : layer._type) === nodes.Instance) return InstanceSchema;
1486
+ if ((layer == null ? void 0 : layer._type) === nodes.Collection) return CollectionSchema;
1487
+ if ((layer == null ? void 0 : layer._type) === nodes.StopColor) return StopColorSchema;
1488
+ if ((layer == null ? void 0 : layer._type) === nodes.LinearGradient) return LinearGradientSchema;
1489
+ if ((layer == null ? void 0 : layer._type) === nodes.CssChunk) return CssChunkSchema;
1490
+ if ((layer == null ? void 0 : layer._type) === nodes.Border) return BorderSchema;
1491
+ if ((layer == null ? void 0 : layer._type) === nodes.Paint) return PaintSchema;
1492
+ if ((layer == null ? void 0 : layer._type) === nodes.ImagePaint) return ImagePaintSchema;
1493
+ if ((layer == null ? void 0 : layer._type) === nodes.Link) return LinkSchema;
1494
+ if ((layer == null ? void 0 : layer._type) === nodes.Classname) return ClassnameSchema;
1083
1495
  if (layer._type === nodes.Variable) {
1084
1496
  const types = {
1085
1497
  [variableType.Number]: NumberVariableSchema,
1086
1498
  [variableType.Boolean]: BooleanVariableSchema,
1087
1499
  [variableType.String]: StringVariableSchema,
1088
- [variableType.Color]: ColorVariableSchema
1500
+ [variableType.Color]: ColorVariableSchema,
1501
+ [variableType.Event]: EventVariableSchema,
1502
+ [variableType.Link]: LinkVariableSchema,
1503
+ [variableType.Enum]: EnumVariableSchema,
1504
+ [variableType.Object]: ObjectVariableSchema,
1505
+ [variableType.Image]: ImageVariableSchema,
1506
+ [variableType.Array]: ArrayVariableSchema
1089
1507
  };
1090
1508
  if (layer.type in types) {
1091
1509
  return types[layer.type];
1092
1510
  }
1093
1511
  }
1094
1512
  };
1513
+ const isObject = (x) => !!x && typeof x === "object" && !Array.isArray(x);
1095
1514
  const normalizeLayer = (schema, rawLayer, options) => {
1096
1515
  try {
1097
- if (!rawLayer) return null;
1516
+ if (!rawLayer || !schema.entries) return null;
1098
1517
  const withFallback = (options == null ? void 0 : options.withFallback) ?? true;
1099
1518
  const overrideTarget = options == null ? void 0 : options.overrideTarget;
1100
1519
  const parsedLayer = parse(schema, rawLayer);
@@ -1103,7 +1522,19 @@ const normalizeLayer = (schema, rawLayer, options) => {
1103
1522
  const schemaMeta = getMetadata(schemaEntity);
1104
1523
  const fallback = withFallback ? schemaMeta == null ? void 0 : schemaMeta.fallback : null;
1105
1524
  const overrideValue = (schemaMeta == null ? void 0 : schemaMeta.overridable) !== false && overrideTarget ? overrideTarget == null ? void 0 : overrideTarget[key] : null;
1106
- return [key, parsedLayer[key] ?? overrideValue ?? fallback];
1525
+ let layerValue = parsedLayer[key];
1526
+ if (isObject(layerValue) && isObject(overrideValue)) {
1527
+ layerValue = { ...overrideValue, ...layerValue };
1528
+ }
1529
+ if (schemaEntity && "wrapped" in schemaEntity && "entries" in schemaEntity.wrapped && isObject(schemaEntity.wrapped.entries)) {
1530
+ layerValue = normalizeLayer(
1531
+ schemaEntity.wrapped,
1532
+ layerValue,
1533
+ options
1534
+ );
1535
+ }
1536
+ const resultValue = layerValue ?? overrideValue ?? fallback;
1537
+ return [key, resultValue];
1107
1538
  })
1108
1539
  );
1109
1540
  } catch (e) {
@@ -1111,25 +1542,42 @@ const normalizeLayer = (schema, rawLayer, options) => {
1111
1542
  return null;
1112
1543
  }
1113
1544
  };
1114
- const getNormalizeLayer = (layer, overrider) => {
1545
+ const getNormalizeLayer = (layer, overrider, withFallback) => {
1115
1546
  if (!layer) return null;
1116
1547
  const schema = getLayerSchema(layer);
1117
1548
  if (!schema) return null;
1118
1549
  return normalizeLayer(schema, layer, {
1119
- overrideTarget: overrider
1550
+ overrideTarget: overrider,
1551
+ withFallback
1120
1552
  });
1121
1553
  };
1122
- const isValidLayerField = (layer, field, value) => {
1123
- var _a, _b;
1554
+ function findSchemaByPath(schema, path) {
1555
+ if (!path) return void 0;
1556
+ const parts = path.split(".");
1557
+ let current = schema;
1558
+ for (const part of parts) {
1559
+ if (!current || typeof current !== "object") return void 0;
1560
+ if ("entries" in current) {
1561
+ if (!(part in current.entries)) return void 0;
1562
+ current = current.entries[part];
1563
+ } else if ("wrapped" in current && "entries" in current.wrapped) {
1564
+ current = current.wrapped.entries[part];
1565
+ }
1566
+ }
1567
+ return current;
1568
+ }
1569
+ const parseLayerField = (layer, field, value) => {
1124
1570
  const schema = getLayerSchema(layer);
1125
- if (schema && ((_a = schema == null ? void 0 : schema.entries) == null ? void 0 : _a[field])) {
1126
- const { success } = /* @__PURE__ */ safeParse((_b = schema.entries) == null ? void 0 : _b[field], value);
1127
- return success;
1571
+ const fieldSchema = findSchemaByPath(schema, field);
1572
+ if (fieldSchema) {
1573
+ return /* @__PURE__ */ safeParse(fieldSchema, value);
1128
1574
  }
1129
- return false;
1575
+ return { success: false, output: value };
1130
1576
  };
1131
1577
  export {
1132
1578
  index as definition,
1133
1579
  getNormalizeLayer,
1134
- isValidLayerField
1580
+ isLink,
1581
+ isVariableLink,
1582
+ parseLayerField
1135
1583
  };