@elementor/editor-props 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- // src/prop-types/background-overlay.ts
2
- import { z as z3 } from "@elementor/schema";
1
+ // src/prop-types/box-shadow.ts
2
+ import { z as z4 } from "@elementor/schema";
3
3
 
4
4
  // src/utils/create-prop-utils.ts
5
5
  import { z } from "@elementor/schema";
@@ -41,30 +41,22 @@ function createPropUtils(key, valueSchema) {
41
41
  extract,
42
42
  isValid,
43
43
  create,
44
- schema
44
+ schema,
45
+ key
45
46
  };
46
47
  }
47
48
 
49
+ // src/prop-types/shadow.ts
50
+ import { z as z3 } from "@elementor/schema";
51
+
48
52
  // src/prop-types/utils.ts
49
53
  import { z as z2 } from "@elementor/schema";
50
54
  var unknownChildrenSchema = z2.any().nullable();
51
55
 
52
- // src/prop-types/background-overlay.ts
53
- var backgroundOverlayPropTypeUtil = createPropUtils(
54
- "background-overlay",
55
- z3.strictObject({
56
- color: unknownChildrenSchema
57
- })
58
- );
59
-
60
- // src/prop-types/box-shadow.ts
61
- import { z as z5 } from "@elementor/schema";
62
-
63
56
  // src/prop-types/shadow.ts
64
- import { z as z4 } from "@elementor/schema";
65
57
  var shadowPropTypeUtil = createPropUtils(
66
58
  "shadow",
67
- z4.strictObject({
59
+ z3.strictObject({
68
60
  position: unknownChildrenSchema,
69
61
  hOffset: unknownChildrenSchema,
70
62
  vOffset: unknownChildrenSchema,
@@ -75,13 +67,13 @@ var shadowPropTypeUtil = createPropUtils(
75
67
  );
76
68
 
77
69
  // src/prop-types/box-shadow.ts
78
- var boxShadowPropTypeUtil = createPropUtils("box-shadow", z5.array(shadowPropTypeUtil.schema));
70
+ var boxShadowPropTypeUtil = createPropUtils("box-shadow", z4.array(shadowPropTypeUtil.schema));
79
71
 
80
72
  // src/prop-types/border-radius.ts
81
- import { z as z6 } from "@elementor/schema";
73
+ import { z as z5 } from "@elementor/schema";
82
74
  var borderRadiusPropTypeUtil = createPropUtils(
83
75
  "border-radius",
84
- z6.strictObject({
76
+ z5.strictObject({
85
77
  "top-left": unknownChildrenSchema,
86
78
  "top-right": unknownChildrenSchema,
87
79
  "bottom-right": unknownChildrenSchema,
@@ -90,10 +82,10 @@ var borderRadiusPropTypeUtil = createPropUtils(
90
82
  );
91
83
 
92
84
  // src/prop-types/border-width.ts
93
- import { z as z7 } from "@elementor/schema";
85
+ import { z as z6 } from "@elementor/schema";
94
86
  var borderWidthPropTypeUtil = createPropUtils(
95
87
  "border-width",
96
- z7.strictObject({
88
+ z6.strictObject({
97
89
  top: unknownChildrenSchema,
98
90
  right: unknownChildrenSchema,
99
91
  bottom: unknownChildrenSchema,
@@ -102,47 +94,47 @@ var borderWidthPropTypeUtil = createPropUtils(
102
94
  );
103
95
 
104
96
  // src/prop-types/classes.ts
105
- import { z as z8 } from "@elementor/schema";
106
- var classesPropTypeUtil = createPropUtils("classes", z8.array(z8.string().regex(/^[a-z][a-z-_0-9]*$/i)));
97
+ import { z as z7 } from "@elementor/schema";
98
+ var classesPropTypeUtil = createPropUtils("classes", z7.array(z7.string().regex(/^[a-z][a-z-_0-9]*$/i)));
107
99
 
108
100
  // src/prop-types/color.ts
109
- import { z as z9 } from "@elementor/schema";
110
- var colorPropTypeUtil = createPropUtils("color", z9.string());
101
+ import { z as z8 } from "@elementor/schema";
102
+ var colorPropTypeUtil = createPropUtils("color", z8.string());
111
103
 
112
104
  // src/prop-types/image.ts
113
- import { z as z10 } from "@elementor/schema";
105
+ import { z as z9 } from "@elementor/schema";
114
106
  var imagePropTypeUtil = createPropUtils(
115
107
  "image",
116
- z10.strictObject({
108
+ z9.strictObject({
117
109
  src: unknownChildrenSchema,
118
110
  size: unknownChildrenSchema
119
111
  })
120
112
  );
121
113
 
122
114
  // src/prop-types/image-attachment-id.ts
123
- import { z as z11 } from "@elementor/schema";
124
- var imageAttachmentIdPropType = createPropUtils("image-attachment-id", z11.number());
115
+ import { z as z10 } from "@elementor/schema";
116
+ var imageAttachmentIdPropType = createPropUtils("image-attachment-id", z10.number());
125
117
 
126
118
  // src/prop-types/image-src.ts
127
- import { z as z12 } from "@elementor/schema";
119
+ import { z as z11 } from "@elementor/schema";
128
120
  var imageSrcPropTypeUtil = createPropUtils(
129
121
  "image-src",
130
- z12.strictObject({
122
+ z11.strictObject({
131
123
  id: unknownChildrenSchema,
132
- url: z12.null()
124
+ url: z11.null()
133
125
  }).or(
134
- z12.strictObject({
135
- id: z12.null(),
126
+ z11.strictObject({
127
+ id: z11.null(),
136
128
  url: unknownChildrenSchema
137
129
  })
138
130
  )
139
131
  );
140
132
 
141
133
  // src/prop-types/linked-dimensions.ts
142
- import { z as z13 } from "@elementor/schema";
134
+ import { z as z12 } from "@elementor/schema";
143
135
  var linkedDimensionsPropTypeUtil = createPropUtils(
144
136
  "linked-dimensions",
145
- z13.strictObject({
137
+ z12.strictObject({
146
138
  isLinked: unknownChildrenSchema,
147
139
  top: unknownChildrenSchema,
148
140
  right: unknownChildrenSchema,
@@ -152,75 +144,89 @@ var linkedDimensionsPropTypeUtil = createPropUtils(
152
144
  );
153
145
 
154
146
  // src/prop-types/number.ts
155
- import { z as z14 } from "@elementor/schema";
156
- var numberPropTypeUtil = createPropUtils("number", z14.number());
147
+ import { z as z13 } from "@elementor/schema";
148
+ var numberPropTypeUtil = createPropUtils("number", z13.number().nullable());
157
149
 
158
150
  // src/prop-types/size.ts
159
- import { z as z15 } from "@elementor/schema";
151
+ import { z as z14 } from "@elementor/schema";
160
152
  var sizePropTypeUtil = createPropUtils(
161
153
  "size",
162
- z15.strictObject({
163
- unit: z15.enum(["px", "em", "rem", "%", "vw", "vh"]),
164
- size: z15.number()
154
+ z14.strictObject({
155
+ unit: z14.enum(["px", "em", "rem", "%", "vw", "vh"]),
156
+ size: z14.number()
165
157
  })
166
158
  );
167
159
 
168
160
  // src/prop-types/string.ts
169
- import { z as z16 } from "@elementor/schema";
170
- var stringPropTypeUtil = createPropUtils("string", z16.string().nullable());
161
+ import { z as z15 } from "@elementor/schema";
162
+ var stringPropTypeUtil = createPropUtils("string", z15.string().nullable());
171
163
 
172
164
  // src/prop-types/stroke.ts
173
- import { z as z17 } from "@elementor/schema";
165
+ import { z as z16 } from "@elementor/schema";
174
166
  var strokePropTypeUtil = createPropUtils(
175
167
  "stroke",
176
- z17.strictObject({
168
+ z16.strictObject({
177
169
  color: unknownChildrenSchema,
178
170
  width: unknownChildrenSchema
179
171
  })
180
172
  );
181
173
 
182
174
  // src/prop-types/url.ts
183
- import { z as z18 } from "@elementor/schema";
184
- var urlPropTypeUtil = createPropUtils("url", z18.string().url().nullable());
185
-
186
- // src/prop-types/color-gradient.ts
187
- import { z as z19 } from "@elementor/schema";
188
- var colorGradientPropTypeUtil = createPropUtils(
189
- "background-overlay",
190
- z19.strictObject({
191
- color: unknownChildrenSchema
192
- })
193
- );
194
-
195
- // src/prop-types/background-image.ts
196
- import { z as z20 } from "@elementor/schema";
197
- var backgroundImagePropTypeUtil = createPropUtils(
198
- "background-image",
199
- z20.array(colorGradientPropTypeUtil.schema)
200
- );
175
+ import { z as z17 } from "@elementor/schema";
176
+ var urlPropTypeUtil = createPropUtils("url", z17.string().url().nullable());
201
177
 
202
178
  // src/prop-types/link.ts
203
- import { z as z21 } from "@elementor/schema";
179
+ import { z as z18 } from "@elementor/schema";
204
180
  var linkPropTypeUtil = createPropUtils(
205
181
  "link",
206
- z21.strictObject({
207
- enabled: z21.boolean(),
208
- href: urlPropTypeUtil.schema,
209
- isTargetBlank: z21.boolean()
182
+ z18.strictObject({
183
+ enabled: unknownChildrenSchema,
184
+ href: unknownChildrenSchema,
185
+ isTargetBlank: unknownChildrenSchema
210
186
  })
211
187
  );
212
188
 
213
189
  // src/prop-types/gaps.ts
214
- import { z as z22 } from "@elementor/schema";
190
+ import { z as z19 } from "@elementor/schema";
215
191
  var gapPropTypeUtil = createPropUtils(
216
192
  "gap",
217
- z22.object({
218
- isLinked: z22.boolean(),
219
- row: z22.any(),
220
- column: z22.any()
193
+ z19.object({
194
+ isLinked: z19.boolean(),
195
+ row: z19.any(),
196
+ column: z19.any()
197
+ })
198
+ );
199
+
200
+ // src/prop-types/background-prop-types/background.ts
201
+ import { z as z20 } from "@elementor/schema";
202
+ var backgroundPropTypeUtil = createPropUtils(
203
+ "background",
204
+ z20.strictObject({
205
+ color: unknownChildrenSchema,
206
+ "background-overlay": unknownChildrenSchema
221
207
  })
222
208
  );
223
209
 
210
+ // src/prop-types/background-prop-types/background-overlay.ts
211
+ import { z as z22 } from "@elementor/schema";
212
+
213
+ // src/prop-types/background-prop-types/background-color-overlay.ts
214
+ import { z as z21 } from "@elementor/schema";
215
+ var backgroundColorOverlayPropTypeUtil = createPropUtils("background-color-overlay", z21.string());
216
+
217
+ // src/prop-types/background-prop-types/background-gradient-overlay.ts
218
+ var backgroundGradientOverlayPropTypeUtil = createPropUtils(
219
+ "background-gradient-overlay",
220
+ unknownChildrenSchema
221
+ );
222
+
223
+ // src/prop-types/background-prop-types/background-image-overlay.ts
224
+ var backgroundImageOverlayPropTypeUtil = createPropUtils("background-image-overlay", unknownChildrenSchema);
225
+
226
+ // src/prop-types/background-prop-types/background-overlay.ts
227
+ var backgroundOverlayItem = backgroundColorOverlayPropTypeUtil.schema.or(backgroundGradientOverlayPropTypeUtil.schema).or(backgroundImageOverlayPropTypeUtil.schema);
228
+ var backgroundOverlayPropTypeUtil = createPropUtils("background-overlay", z22.array(backgroundOverlayItem));
229
+
224
230
  // src/utils/is-transformable.ts
225
231
  import { z as z23 } from "@elementor/schema";
226
232
  var transformableSchema = z23.object({
@@ -232,13 +238,13 @@ var isTransformable = (value) => {
232
238
  return transformableSchema.safeParse(value).success;
233
239
  };
234
240
  export {
235
- backgroundImagePropTypeUtil,
241
+ backgroundColorOverlayPropTypeUtil,
236
242
  backgroundOverlayPropTypeUtil,
243
+ backgroundPropTypeUtil,
237
244
  borderRadiusPropTypeUtil,
238
245
  borderWidthPropTypeUtil,
239
246
  boxShadowPropTypeUtil,
240
247
  classesPropTypeUtil,
241
- colorGradientPropTypeUtil,
242
248
  colorPropTypeUtil,
243
249
  createPropUtils,
244
250
  gapPropTypeUtil,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/prop-types/background-overlay.ts","../src/utils/create-prop-utils.ts","../src/prop-types/utils.ts","../src/prop-types/box-shadow.ts","../src/prop-types/shadow.ts","../src/prop-types/border-radius.ts","../src/prop-types/border-width.ts","../src/prop-types/classes.ts","../src/prop-types/color.ts","../src/prop-types/image.ts","../src/prop-types/image-attachment-id.ts","../src/prop-types/image-src.ts","../src/prop-types/linked-dimensions.ts","../src/prop-types/number.ts","../src/prop-types/size.ts","../src/prop-types/string.ts","../src/prop-types/stroke.ts","../src/prop-types/url.ts","../src/prop-types/color-gradient.ts","../src/prop-types/background-image.ts","../src/prop-types/link.ts","../src/prop-types/gaps.ts","../src/utils/is-transformable.ts"],"sourcesContent":["import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const backgroundOverlayPropTypeUtil = createPropUtils(\n\t'background-overlay',\n\tz.strictObject( {\n\t\tcolor: unknownChildrenSchema,\n\t} )\n);\n\nexport type BackgroundOverlayPropTypeUtil = z.infer< typeof backgroundOverlayPropTypeUtil.schema >;\n","import { z, type ZodType } from '@elementor/schema';\n\nimport { type PropValue, type TransformablePropValue } from '../types';\n\ntype Updater< T > = ( prev?: T ) => T;\n\nexport type CreateOptions = {\n\tbase?: unknown;\n\tdisabled?: boolean;\n};\n\nexport type PropTypeUtil< TKey extends string, TValue extends PropValue > = ReturnType<\n\ttypeof createPropUtils< TKey, TValue >\n>;\n\n/**\n * Usage example:\n *\n * ```ts\n * const elementsPropUtils = createPropUtils( 'elements', z.array( z.string() ) );\n *\n * elementsPropUtils.isValid( element.props?.children );\n * elementsPropUtils.create( [ 'a', 'b' ] );\n * elementsPropUtils.create( ( prev = [] ) => [ ...prev, 'c' ], { base: element.props?.children } );\n * elementsPropUtils.create( ( prev = [] ) => [ ...prev, 'c' ], { disabled: true } );\n * elementsPropUtils.extract( element.props?.children );\n *\n * ```\n */\n\nexport function createPropUtils< TKey extends string, TValue extends PropValue >(\n\tkey: TKey,\n\tvalueSchema: ZodType< TValue >\n) {\n\tconst schema = z.strictObject( {\n\t\t$$type: z.literal( key ),\n\t\tvalue: valueSchema,\n\t\tdisabled: z.boolean().optional(),\n\t} );\n\n\ttype Prop = TransformablePropValue< TKey, TValue >;\n\n\tfunction isValid( prop: unknown ): prop is Prop {\n\t\treturn schema.safeParse( prop ).success;\n\t}\n\n\tfunction create( value: TValue ): Prop;\n\tfunction create( value: TValue, createOptions?: CreateOptions ): Prop;\n\tfunction create( value: Updater< TValue >, createOptions: CreateOptions ): Prop;\n\tfunction create( value: TValue | Updater< TValue >, createOptions?: CreateOptions ): Prop {\n\t\tconst fn = ( typeof value === 'function' ? value : () => value ) as Updater< TValue >;\n\n\t\tconst { base, disabled } = createOptions || {};\n\n\t\tif ( ! base ) {\n\t\t\treturn {\n\t\t\t\t$$type: key,\n\t\t\t\tvalue: fn(),\n\t\t\t\t...( disabled && { disabled } ),\n\t\t\t};\n\t\t}\n\n\t\tif ( ! isValid( base ) ) {\n\t\t\tthrow new Error( `Cannot create prop based on invalid value: ${ JSON.stringify( base ) }` );\n\t\t}\n\n\t\treturn {\n\t\t\t$$type: key,\n\t\t\tvalue: fn( base.value ),\n\t\t\t...( disabled && { disabled } ),\n\t\t};\n\t}\n\n\tfunction extract( prop: unknown ): TValue | null {\n\t\tif ( ! isValid( prop ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn prop.value;\n\t}\n\n\treturn {\n\t\textract,\n\t\tisValid,\n\t\tcreate,\n\t\tschema,\n\t};\n}\n","import { z } from '@elementor/schema';\n\nexport const unknownChildrenSchema = z.any().nullable();\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { shadowPropTypeUtil } from './shadow';\n\nexport const boxShadowPropTypeUtil = createPropUtils( 'box-shadow', z.array( shadowPropTypeUtil.schema ) );\n\nexport type BoxShadowPropValue = z.infer< typeof boxShadowPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const shadowPropTypeUtil = createPropUtils(\n\t'shadow',\n\tz.strictObject( {\n\t\tposition: unknownChildrenSchema,\n\t\thOffset: unknownChildrenSchema,\n\t\tvOffset: unknownChildrenSchema,\n\t\tblur: unknownChildrenSchema,\n\t\tspread: unknownChildrenSchema,\n\t\tcolor: unknownChildrenSchema,\n\t} )\n);\n\nexport type ShadowPropValue = z.infer< typeof shadowPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const borderRadiusPropTypeUtil = createPropUtils(\n\t'border-radius',\n\tz.strictObject( {\n\t\t'top-left': unknownChildrenSchema,\n\t\t'top-right': unknownChildrenSchema,\n\t\t'bottom-right': unknownChildrenSchema,\n\t\t'bottom-left': unknownChildrenSchema,\n\t} )\n);\n\nexport type BorderRadiusPropValue = z.infer< typeof borderRadiusPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const borderWidthPropTypeUtil = createPropUtils(\n\t'border-width',\n\tz.strictObject( {\n\t\ttop: unknownChildrenSchema,\n\t\tright: unknownChildrenSchema,\n\t\tbottom: unknownChildrenSchema,\n\t\tleft: unknownChildrenSchema,\n\t} )\n);\n\nexport type BorderWidthPropValue = z.infer< typeof borderWidthPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const classesPropTypeUtil = createPropUtils( 'classes', z.array( z.string().regex( /^[a-z][a-z-_0-9]*$/i ) ) );\n\nexport type ClassesPropValue = z.infer< typeof classesPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const colorPropTypeUtil = createPropUtils( 'color', z.string() );\n\nexport type ColorPropValue = z.infer< typeof colorPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const imagePropTypeUtil = createPropUtils(\n\t'image',\n\tz.strictObject( {\n\t\tsrc: unknownChildrenSchema,\n\t\tsize: unknownChildrenSchema,\n\t} )\n);\n\nexport type ImagePropValue = z.infer< typeof imagePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const imageAttachmentIdPropType = createPropUtils( 'image-attachment-id', z.number() );\n\nexport type ImageAttachmentIdPropValue = z.infer< typeof imageAttachmentIdPropType.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const imageSrcPropTypeUtil = createPropUtils(\n\t'image-src',\n\tz\n\t\t.strictObject( {\n\t\t\tid: unknownChildrenSchema,\n\t\t\turl: z.null(),\n\t\t} )\n\t\t.or(\n\t\t\tz.strictObject( {\n\t\t\t\tid: z.null(),\n\t\t\t\turl: unknownChildrenSchema,\n\t\t\t} )\n\t\t)\n);\n\nexport type ImageSrcPropValue = z.infer< typeof imageSrcPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const linkedDimensionsPropTypeUtil = createPropUtils(\n\t'linked-dimensions',\n\tz.strictObject( {\n\t\tisLinked: unknownChildrenSchema,\n\t\ttop: unknownChildrenSchema,\n\t\tright: unknownChildrenSchema,\n\t\tbottom: unknownChildrenSchema,\n\t\tleft: unknownChildrenSchema,\n\t} )\n);\n\nexport type LinkedDimensionsPropValue = z.infer< typeof linkedDimensionsPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const numberPropTypeUtil = createPropUtils( 'number', z.number() );\n\nexport type NumberPropValue = z.infer< typeof numberPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const sizePropTypeUtil = createPropUtils(\n\t'size',\n\tz.strictObject( {\n\t\tunit: z.enum( [ 'px', 'em', 'rem', '%', 'vw', 'vh' ] ),\n\t\tsize: z.number(),\n\t} )\n);\n\nexport type SizePropValue = z.infer< typeof sizePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const stringPropTypeUtil = createPropUtils( 'string', z.string().nullable() );\n\nexport type StringPropValue = z.infer< typeof stringPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const strokePropTypeUtil = createPropUtils(\n\t'stroke',\n\tz.strictObject( {\n\t\tcolor: unknownChildrenSchema,\n\t\twidth: unknownChildrenSchema,\n\t} )\n);\n\nexport type StrokePropValue = z.infer< typeof strokePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const urlPropTypeUtil = createPropUtils( 'url', z.string().url().nullable() );\n\nexport type UrlPropValue = z.infer< typeof urlPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const colorGradientPropTypeUtil = createPropUtils(\n\t'background-overlay',\n\tz.strictObject( {\n\t\tcolor: unknownChildrenSchema,\n\t} )\n);\n\nexport type ColorGradientPropValue = z.infer< typeof colorGradientPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { colorGradientPropTypeUtil } from './color-gradient';\n\nexport const backgroundImagePropTypeUtil = createPropUtils(\n\t'background-image',\n\tz.array( colorGradientPropTypeUtil.schema )\n);\n\nexport type backgroundImageTypePropValue = z.infer< typeof backgroundImagePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { urlPropTypeUtil } from './url';\n\nexport const linkPropTypeUtil = createPropUtils(\n\t'link',\n\tz.strictObject( {\n\t\tenabled: z.boolean(),\n\t\thref: urlPropTypeUtil.schema,\n\t\tisTargetBlank: z.boolean(),\n\t} )\n);\n\nexport type LinkPropValue = z.infer< typeof linkPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const gapPropTypeUtil = createPropUtils(\n\t'gap',\n\tz.object( {\n\t\tisLinked: z.boolean(),\n\t\trow: z.any(),\n\t\tcolumn: z.any(),\n\t} )\n);\n\nexport type GapPropValue = z.infer< typeof gapPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nconst transformableSchema = z.object( {\n\t$$type: z.string(),\n\tvalue: z.any(),\n\tdisabled: z.boolean().optional(),\n} );\n\ntype TransformablePropValue = z.infer< typeof transformableSchema >;\n\nexport const isTransformable = ( value: unknown ): value is TransformablePropValue => {\n\treturn transformableSchema.safeParse( value ).success;\n};\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAuB;AA8BzB,SAAS,gBACf,KACA,aACC;AACD,QAAM,SAAS,EAAE,aAAc;AAAA,IAC9B,QAAQ,EAAE,QAAS,GAAI;AAAA,IACvB,OAAO;AAAA,IACP,UAAU,EAAE,QAAQ,EAAE,SAAS;AAAA,EAChC,CAAE;AAIF,WAAS,QAAS,MAA8B;AAC/C,WAAO,OAAO,UAAW,IAAK,EAAE;AAAA,EACjC;AAKA,WAAS,OAAQ,OAAmC,eAAsC;AACzF,UAAM,KAAO,OAAO,UA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AQA,IAAE,OAAO;AAAA,EACjB,OAAOA,IAAE,IAAI;AAAA,EACb,UAAUA,IAAE,QAAQ,EAAE,SAAS;AAChC,CAAE;AAIK,IAAM,kBAAkB,CAAE,UAAqD;AACrF,SAAO,oBAAoB,UAAW,KAAM,EAAE;AAC/C;","names":["z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z"]}
1
+ {"version":3,"sources":["../src/prop-types/box-shadow.ts","../src/utils/create-prop-utils.ts","../src/prop-types/shadow.ts","../src/prop-types/utils.ts","../src/prop-types/border-radius.ts","../src/prop-types/border-width.ts","../src/prop-types/classes.ts","../src/prop-types/color.ts","../src/prop-types/image.ts","../src/prop-types/image-attachment-id.ts","../src/prop-types/image-src.ts","../src/prop-types/linked-dimensions.ts","../src/prop-types/number.ts","../src/prop-types/size.ts","../src/prop-types/string.ts","../src/prop-types/stroke.ts","../src/prop-types/url.ts","../src/prop-types/link.ts","../src/prop-types/gaps.ts","../src/prop-types/background-prop-types/background.ts","../src/prop-types/background-prop-types/background-overlay.ts","../src/prop-types/background-prop-types/background-color-overlay.ts","../src/prop-types/background-prop-types/background-gradient-overlay.ts","../src/prop-types/background-prop-types/background-image-overlay.ts","../src/utils/is-transformable.ts"],"sourcesContent":["import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { shadowPropTypeUtil } from './shadow';\n\nexport const boxShadowPropTypeUtil = createPropUtils( 'box-shadow', z.array( shadowPropTypeUtil.schema ) );\n\nexport type BoxShadowPropValue = z.infer< typeof boxShadowPropTypeUtil.schema >;\n","import { z, type ZodType } from '@elementor/schema';\n\nimport { type PropValue, type TransformablePropValue } from '../types';\n\ntype Updater< T > = ( prev?: T ) => T;\n\nexport type CreateOptions = {\n\tbase?: unknown;\n\tdisabled?: boolean;\n};\n\nexport type PropTypeUtil< TKey extends string, TValue extends PropValue > = ReturnType<\n\ttypeof createPropUtils< TKey, TValue >\n>;\n\n/**\n * Usage example:\n *\n * ```ts\n * const elementsPropUtils = createPropUtils( 'elements', z.array( z.string() ) );\n *\n * elementsPropUtils.isValid( element.props?.children );\n * elementsPropUtils.create( [ 'a', 'b' ] );\n * elementsPropUtils.create( ( prev = [] ) => [ ...prev, 'c' ], { base: element.props?.children } );\n * elementsPropUtils.create( ( prev = [] ) => [ ...prev, 'c' ], { disabled: true } );\n * elementsPropUtils.extract( element.props?.children );\n *\n * ```\n */\n\nexport function createPropUtils< TKey extends string, TValue extends PropValue >(\n\tkey: TKey,\n\tvalueSchema: ZodType< TValue >\n) {\n\tconst schema = z.strictObject( {\n\t\t$$type: z.literal( key ),\n\t\tvalue: valueSchema,\n\t\tdisabled: z.boolean().optional(),\n\t} );\n\n\ttype Prop = TransformablePropValue< TKey, TValue >;\n\n\tfunction isValid( prop: unknown ): prop is Prop {\n\t\treturn schema.safeParse( prop ).success;\n\t}\n\n\tfunction create( value: TValue ): Prop;\n\tfunction create( value: TValue, createOptions?: CreateOptions ): Prop;\n\tfunction create( value: Updater< TValue >, createOptions: CreateOptions ): Prop;\n\tfunction create( value: TValue | Updater< TValue >, createOptions?: CreateOptions ): Prop {\n\t\tconst fn = ( typeof value === 'function' ? value : () => value ) as Updater< TValue >;\n\n\t\tconst { base, disabled } = createOptions || {};\n\n\t\tif ( ! base ) {\n\t\t\treturn {\n\t\t\t\t$$type: key,\n\t\t\t\tvalue: fn(),\n\t\t\t\t...( disabled && { disabled } ),\n\t\t\t};\n\t\t}\n\n\t\tif ( ! isValid( base ) ) {\n\t\t\tthrow new Error( `Cannot create prop based on invalid value: ${ JSON.stringify( base ) }` );\n\t\t}\n\n\t\treturn {\n\t\t\t$$type: key,\n\t\t\tvalue: fn( base.value ),\n\t\t\t...( disabled && { disabled } ),\n\t\t};\n\t}\n\n\tfunction extract( prop: unknown ): TValue | null {\n\t\tif ( ! isValid( prop ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn prop.value;\n\t}\n\n\treturn {\n\t\textract,\n\t\tisValid,\n\t\tcreate,\n\t\tschema,\n\t\tkey: key as TKey,\n\t};\n}\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const shadowPropTypeUtil = createPropUtils(\n\t'shadow',\n\tz.strictObject( {\n\t\tposition: unknownChildrenSchema,\n\t\thOffset: unknownChildrenSchema,\n\t\tvOffset: unknownChildrenSchema,\n\t\tblur: unknownChildrenSchema,\n\t\tspread: unknownChildrenSchema,\n\t\tcolor: unknownChildrenSchema,\n\t} )\n);\n\nexport type ShadowPropValue = z.infer< typeof shadowPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nexport const unknownChildrenSchema = z.any().nullable();\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const borderRadiusPropTypeUtil = createPropUtils(\n\t'border-radius',\n\tz.strictObject( {\n\t\t'top-left': unknownChildrenSchema,\n\t\t'top-right': unknownChildrenSchema,\n\t\t'bottom-right': unknownChildrenSchema,\n\t\t'bottom-left': unknownChildrenSchema,\n\t} )\n);\n\nexport type BorderRadiusPropValue = z.infer< typeof borderRadiusPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const borderWidthPropTypeUtil = createPropUtils(\n\t'border-width',\n\tz.strictObject( {\n\t\ttop: unknownChildrenSchema,\n\t\tright: unknownChildrenSchema,\n\t\tbottom: unknownChildrenSchema,\n\t\tleft: unknownChildrenSchema,\n\t} )\n);\n\nexport type BorderWidthPropValue = z.infer< typeof borderWidthPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const classesPropTypeUtil = createPropUtils( 'classes', z.array( z.string().regex( /^[a-z][a-z-_0-9]*$/i ) ) );\n\nexport type ClassesPropValue = z.infer< typeof classesPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const colorPropTypeUtil = createPropUtils( 'color', z.string() );\n\nexport type ColorPropValue = z.infer< typeof colorPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const imagePropTypeUtil = createPropUtils(\n\t'image',\n\tz.strictObject( {\n\t\tsrc: unknownChildrenSchema,\n\t\tsize: unknownChildrenSchema,\n\t} )\n);\n\nexport type ImagePropValue = z.infer< typeof imagePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const imageAttachmentIdPropType = createPropUtils( 'image-attachment-id', z.number() );\n\nexport type ImageAttachmentIdPropValue = z.infer< typeof imageAttachmentIdPropType.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const imageSrcPropTypeUtil = createPropUtils(\n\t'image-src',\n\tz\n\t\t.strictObject( {\n\t\t\tid: unknownChildrenSchema,\n\t\t\turl: z.null(),\n\t\t} )\n\t\t.or(\n\t\t\tz.strictObject( {\n\t\t\t\tid: z.null(),\n\t\t\t\turl: unknownChildrenSchema,\n\t\t\t} )\n\t\t)\n);\n\nexport type ImageSrcPropValue = z.infer< typeof imageSrcPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const linkedDimensionsPropTypeUtil = createPropUtils(\n\t'linked-dimensions',\n\tz.strictObject( {\n\t\tisLinked: unknownChildrenSchema,\n\t\ttop: unknownChildrenSchema,\n\t\tright: unknownChildrenSchema,\n\t\tbottom: unknownChildrenSchema,\n\t\tleft: unknownChildrenSchema,\n\t} )\n);\n\nexport type LinkedDimensionsPropValue = z.infer< typeof linkedDimensionsPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const numberPropTypeUtil = createPropUtils( 'number', z.number().nullable() );\n\nexport type NumberPropValue = z.infer< typeof numberPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const sizePropTypeUtil = createPropUtils(\n\t'size',\n\tz.strictObject( {\n\t\tunit: z.enum( [ 'px', 'em', 'rem', '%', 'vw', 'vh' ] ),\n\t\tsize: z.number(),\n\t} )\n);\n\nexport type SizePropValue = z.infer< typeof sizePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const stringPropTypeUtil = createPropUtils( 'string', z.string().nullable() );\n\nexport type StringPropValue = z.infer< typeof stringPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const strokePropTypeUtil = createPropUtils(\n\t'stroke',\n\tz.strictObject( {\n\t\tcolor: unknownChildrenSchema,\n\t\twidth: unknownChildrenSchema,\n\t} )\n);\n\nexport type StrokePropValue = z.infer< typeof strokePropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const urlPropTypeUtil = createPropUtils( 'url', z.string().url().nullable() );\n\nexport type UrlPropValue = z.infer< typeof urlPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\nimport { unknownChildrenSchema } from './utils';\n\nexport const linkPropTypeUtil = createPropUtils(\n\t'link',\n\tz.strictObject( {\n\t\tenabled: unknownChildrenSchema,\n\t\thref: unknownChildrenSchema,\n\t\tisTargetBlank: unknownChildrenSchema,\n\t} )\n);\n\nexport type LinkPropValue = z.infer< typeof linkPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../utils/create-prop-utils';\n\nexport const gapPropTypeUtil = createPropUtils(\n\t'gap',\n\tz.object( {\n\t\tisLinked: z.boolean(),\n\t\trow: z.any(),\n\t\tcolumn: z.any(),\n\t} )\n);\n\nexport type GapPropValue = z.infer< typeof gapPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../../utils/create-prop-utils';\nimport { unknownChildrenSchema } from '../utils';\n\nexport const backgroundPropTypeUtil = createPropUtils(\n\t'background',\n\tz.strictObject( {\n\t\tcolor: unknownChildrenSchema,\n\t\t'background-overlay': unknownChildrenSchema,\n\t} )\n);\n\nexport type BackgroundPropValue = z.infer< typeof backgroundPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../../utils/create-prop-utils';\nimport { backgroundColorOverlayPropTypeUtil } from './background-color-overlay';\nimport { backgroundGradientOverlayPropTypeUtil } from './background-gradient-overlay';\nimport { backgroundImageOverlayPropTypeUtil } from './background-image-overlay';\n\nconst backgroundOverlayItem = backgroundColorOverlayPropTypeUtil.schema\n\t.or( backgroundGradientOverlayPropTypeUtil.schema )\n\t.or( backgroundImageOverlayPropTypeUtil.schema );\n\nexport const backgroundOverlayPropTypeUtil = createPropUtils( 'background-overlay', z.array( backgroundOverlayItem ) );\n\nexport type BackgroundOverlayPropValue = z.infer< typeof backgroundOverlayPropTypeUtil.schema >;\nexport type BackgroundOverlayItemPropValue = z.infer< typeof backgroundOverlayItem >;\n","import { z } from '@elementor/schema';\n\nimport { createPropUtils } from '../../utils/create-prop-utils';\n\nexport const backgroundColorOverlayPropTypeUtil = createPropUtils( 'background-color-overlay', z.string() );\n\nexport type BackgroundColorOverlayPropValue = z.infer< typeof backgroundColorOverlayPropTypeUtil.schema >;\n","import { type z } from '@elementor/schema';\n\nimport { createPropUtils } from '../../utils/create-prop-utils';\nimport { unknownChildrenSchema } from '../utils';\n\nexport const backgroundGradientOverlayPropTypeUtil = createPropUtils(\n\t'background-gradient-overlay',\n\tunknownChildrenSchema\n);\n\nexport type BackgroundGradientOverlayPropValue = z.infer< typeof backgroundGradientOverlayPropTypeUtil.schema >;\n","import { type z } from '@elementor/schema';\n\nimport { createPropUtils } from '../../utils/create-prop-utils';\nimport { unknownChildrenSchema } from '../utils';\n\nexport const backgroundImageOverlayPropTypeUtil = createPropUtils( 'background-image-overlay', unknownChildrenSchema );\n\nexport type BackgroundImageOverlayPropValue = z.infer< typeof backgroundImageOverlayPropTypeUtil.schema >;\n","import { z } from '@elementor/schema';\n\nconst transformableSchema = z.object( {\n\t$$type: z.string(),\n\tvalue: z.any(),\n\tdisabled: z.boolean().optional(),\n} );\n\ntype TransformablePropValue = z.infer< typeof transformableSchema >;\n\nexport const isTransformable = ( value: unknown ): value is TransformablePropValue => {\n\treturn transformableSchema.safeParse( value ).success;\n};\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACAlB,SAAS,SAAuB;AA8BzB,SAAS,gBACf,KACA,aACC;AACD,QAAM,SAAS,EAAE,aAAc;AAAA,IAC9B,QAAQ,EAAE,QAAS,GAAI;AAAA,IACvB,OAAO;AAAA,IACP,UAAU,EAAE,QAAQ,EAAE,SAAS;AAAA,EAChC,CAAE;AAIF,WAAS,QAAS,MAA8B;AAC/C,WAAO,OAAO,UAAW,IAAK,EAAE;AAAA,EACjC;AAKA,WAAS,OAAQ,OAAmC,eAAsC;AACzF,UAAM,KAAO,OAAO,UAAU,aAAa,QAAQ,MAAM;AAEzD,UAAM,EAAE,MAAM,SAAS,IAAI,iBAAiB,CAAC;AAE7C,QAAK,CAAE,MAAO;AACb,aAAO;AAAA,QACN,QAAQ;AAAA,QACR,OAAO,GAAG;AAAA,QACV,GAAK,YAAY,EAAE,SAAS;AAAA,MAC7B;AAAA,IACD;AAEA,QAAK,CAAE,QAAS,IAAK,GAAI;AACxB,YAAM,IAAI,MAAO,8CAA+C,KAAK,UAAW,IAAK,CAAE,EAAG;AAAA,I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C/C;","names":["z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z","z"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-props",
3
3
  "description": "This package contains the props model for the Elementor editor",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -0,0 +1,7 @@
1
+ import { z } from '@elementor/schema';
2
+
3
+ import { createPropUtils } from '../../utils/create-prop-utils';
4
+
5
+ export const backgroundColorOverlayPropTypeUtil = createPropUtils( 'background-color-overlay', z.string() );
6
+
7
+ export type BackgroundColorOverlayPropValue = z.infer< typeof backgroundColorOverlayPropTypeUtil.schema >;
@@ -0,0 +1,11 @@
1
+ import { type z } from '@elementor/schema';
2
+
3
+ import { createPropUtils } from '../../utils/create-prop-utils';
4
+ import { unknownChildrenSchema } from '../utils';
5
+
6
+ export const backgroundGradientOverlayPropTypeUtil = createPropUtils(
7
+ 'background-gradient-overlay',
8
+ unknownChildrenSchema
9
+ );
10
+
11
+ export type BackgroundGradientOverlayPropValue = z.infer< typeof backgroundGradientOverlayPropTypeUtil.schema >;
@@ -0,0 +1,8 @@
1
+ import { type z } from '@elementor/schema';
2
+
3
+ import { createPropUtils } from '../../utils/create-prop-utils';
4
+ import { unknownChildrenSchema } from '../utils';
5
+
6
+ export const backgroundImageOverlayPropTypeUtil = createPropUtils( 'background-image-overlay', unknownChildrenSchema );
7
+
8
+ export type BackgroundImageOverlayPropValue = z.infer< typeof backgroundImageOverlayPropTypeUtil.schema >;
@@ -0,0 +1,15 @@
1
+ import { z } from '@elementor/schema';
2
+
3
+ import { createPropUtils } from '../../utils/create-prop-utils';
4
+ import { backgroundColorOverlayPropTypeUtil } from './background-color-overlay';
5
+ import { backgroundGradientOverlayPropTypeUtil } from './background-gradient-overlay';
6
+ import { backgroundImageOverlayPropTypeUtil } from './background-image-overlay';
7
+
8
+ const backgroundOverlayItem = backgroundColorOverlayPropTypeUtil.schema
9
+ .or( backgroundGradientOverlayPropTypeUtil.schema )
10
+ .or( backgroundImageOverlayPropTypeUtil.schema );
11
+
12
+ export const backgroundOverlayPropTypeUtil = createPropUtils( 'background-overlay', z.array( backgroundOverlayItem ) );
13
+
14
+ export type BackgroundOverlayPropValue = z.infer< typeof backgroundOverlayPropTypeUtil.schema >;
15
+ export type BackgroundOverlayItemPropValue = z.infer< typeof backgroundOverlayItem >;
@@ -0,0 +1,14 @@
1
+ import { z } from '@elementor/schema';
2
+
3
+ import { createPropUtils } from '../../utils/create-prop-utils';
4
+ import { unknownChildrenSchema } from '../utils';
5
+
6
+ export const backgroundPropTypeUtil = createPropUtils(
7
+ 'background',
8
+ z.strictObject( {
9
+ color: unknownChildrenSchema,
10
+ 'background-overlay': unknownChildrenSchema,
11
+ } )
12
+ );
13
+
14
+ export type BackgroundPropValue = z.infer< typeof backgroundPropTypeUtil.schema >;
@@ -1,4 +1,3 @@
1
- export * from './background-overlay';
2
1
  export * from './box-shadow';
3
2
  export * from './border-radius';
4
3
  export * from './border-width';
@@ -14,7 +13,8 @@ export * from './size';
14
13
  export * from './string';
15
14
  export * from './stroke';
16
15
  export * from './url';
17
- export * from './color-gradient';
18
- export * from './background-image';
19
16
  export * from './link';
20
17
  export * from './gaps';
18
+ export * from './background-prop-types/background';
19
+ export * from './background-prop-types/background-overlay';
20
+ export * from './background-prop-types/background-color-overlay';
@@ -1,14 +1,14 @@
1
1
  import { z } from '@elementor/schema';
2
2
 
3
3
  import { createPropUtils } from '../utils/create-prop-utils';
4
- import { urlPropTypeUtil } from './url';
4
+ import { unknownChildrenSchema } from './utils';
5
5
 
6
6
  export const linkPropTypeUtil = createPropUtils(
7
7
  'link',
8
8
  z.strictObject( {
9
- enabled: z.boolean(),
10
- href: urlPropTypeUtil.schema,
11
- isTargetBlank: z.boolean(),
9
+ enabled: unknownChildrenSchema,
10
+ href: unknownChildrenSchema,
11
+ isTargetBlank: unknownChildrenSchema,
12
12
  } )
13
13
  );
14
14
 
@@ -2,6 +2,6 @@ import { z } from '@elementor/schema';
2
2
 
3
3
  import { createPropUtils } from '../utils/create-prop-utils';
4
4
 
5
- export const numberPropTypeUtil = createPropUtils( 'number', z.number() );
5
+ export const numberPropTypeUtil = createPropUtils( 'number', z.number().nullable() );
6
6
 
7
7
  export type NumberPropValue = z.infer< typeof numberPropTypeUtil.schema >;
package/src/types.ts CHANGED
@@ -1,23 +1,23 @@
1
1
  type PropTypeKey = string;
2
2
 
3
- type BasePropType = {
4
- default: PropValue;
3
+ type BasePropType< TValue > = {
4
+ default?: TValue | null;
5
5
  settings: Record< string, unknown >;
6
6
  meta: Record< string, unknown >;
7
7
  };
8
8
 
9
- export type PlainPropType = BasePropType & {
9
+ export type PlainPropType = BasePropType< PlainPropValue > & {
10
10
  kind: 'plain';
11
11
  key: PropTypeKey;
12
12
  };
13
13
 
14
- export type ArrayPropType = BasePropType & {
14
+ export type ArrayPropType = BasePropType< ArrayPropValue > & {
15
15
  kind: 'array';
16
16
  key: PropTypeKey;
17
17
  item_prop_type: PropType;
18
18
  };
19
19
 
20
- export type ObjectPropType = BasePropType & {
20
+ export type ObjectPropType = BasePropType< ObjectPropValue > & {
21
21
  kind: 'object';
22
22
  key: PropTypeKey;
23
23
  shape: Record< string, PropType >;
@@ -25,13 +25,15 @@ export type ObjectPropType = BasePropType & {
25
25
 
26
26
  export type TransformablePropType = PlainPropType | ArrayPropType | ObjectPropType;
27
27
 
28
- export type UnionPropType = BasePropType & {
28
+ export type UnionPropType = BasePropType< PropValue > & {
29
29
  kind: 'union';
30
30
  prop_types: Record< string, TransformablePropType >;
31
31
  };
32
32
 
33
33
  export type PropType = TransformablePropType | UnionPropType;
34
34
 
35
+ export type PropsSchema = Record< string, PropType >;
36
+
35
37
  type MaybeArray< T > = T | T[];
36
38
 
37
39
  export type TransformablePropValue< Type extends string, Value = unknown > = {
@@ -40,6 +42,10 @@ export type TransformablePropValue< Type extends string, Value = unknown > = {
40
42
  disabled?: boolean;
41
43
  };
42
44
 
45
+ export type ArrayPropValue = TransformablePropValue< string, PropValue[] >;
46
+
47
+ export type ObjectPropValue = TransformablePropValue< string, Record< string, PropValue > >;
48
+
43
49
  export type PlainPropValue = MaybeArray< string | number | boolean | object | null | undefined >;
44
50
 
45
51
  export type PropValue = PlainPropValue | TransformablePropValue< string >;
@@ -84,5 +84,6 @@ export function createPropUtils< TKey extends string, TValue extends PropValue >
84
84
  isValid,
85
85
  create,
86
86
  schema,
87
+ key: key as TKey,
87
88
  };
88
89
  }
@@ -1,11 +0,0 @@
1
- import { z } from '@elementor/schema';
2
-
3
- import { createPropUtils } from '../utils/create-prop-utils';
4
- import { colorGradientPropTypeUtil } from './color-gradient';
5
-
6
- export const backgroundImagePropTypeUtil = createPropUtils(
7
- 'background-image',
8
- z.array( colorGradientPropTypeUtil.schema )
9
- );
10
-
11
- export type backgroundImageTypePropValue = z.infer< typeof backgroundImagePropTypeUtil.schema >;
@@ -1,13 +0,0 @@
1
- import { z } from '@elementor/schema';
2
-
3
- import { createPropUtils } from '../utils/create-prop-utils';
4
- import { unknownChildrenSchema } from './utils';
5
-
6
- export const backgroundOverlayPropTypeUtil = createPropUtils(
7
- 'background-overlay',
8
- z.strictObject( {
9
- color: unknownChildrenSchema,
10
- } )
11
- );
12
-
13
- export type BackgroundOverlayPropTypeUtil = z.infer< typeof backgroundOverlayPropTypeUtil.schema >;
@@ -1,13 +0,0 @@
1
- import { z } from '@elementor/schema';
2
-
3
- import { createPropUtils } from '../utils/create-prop-utils';
4
- import { unknownChildrenSchema } from './utils';
5
-
6
- export const colorGradientPropTypeUtil = createPropUtils(
7
- 'background-overlay',
8
- z.strictObject( {
9
- color: unknownChildrenSchema,
10
- } )
11
- );
12
-
13
- export type ColorGradientPropValue = z.infer< typeof colorGradientPropTypeUtil.schema >;