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