@elementor/editor-props 0.4.0 → 0.5.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.js CHANGED
@@ -18,9 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  backgroundImagePropTypeUtil: () => backgroundImagePropTypeUtil,
24
+ backgroundOverlayPropTypeUtil: () => backgroundOverlayPropTypeUtil,
24
25
  borderRadiusPropTypeUtil: () => borderRadiusPropTypeUtil,
25
26
  borderWidthPropTypeUtil: () => borderWidthPropTypeUtil,
26
27
  boxShadowPropTypeUtil: () => boxShadowPropTypeUtil,
@@ -28,6 +29,7 @@ __export(src_exports, {
28
29
  colorGradientPropTypeUtil: () => colorGradientPropTypeUtil,
29
30
  colorPropTypeUtil: () => colorPropTypeUtil,
30
31
  createPropUtils: () => createPropUtils,
32
+ gapPropTypeUtil: () => gapPropTypeUtil,
31
33
  imageAttachmentIdPropType: () => imageAttachmentIdPropType,
32
34
  imagePropTypeUtil: () => imagePropTypeUtil,
33
35
  imageSrcPropTypeUtil: () => imageSrcPropTypeUtil,
@@ -41,10 +43,10 @@ __export(src_exports, {
41
43
  strokePropTypeUtil: () => strokePropTypeUtil,
42
44
  urlPropTypeUtil: () => urlPropTypeUtil
43
45
  });
44
- module.exports = __toCommonJS(src_exports);
46
+ module.exports = __toCommonJS(index_exports);
45
47
 
46
- // src/prop-types/box-shadow.ts
47
- var import_schema4 = require("@elementor/schema");
48
+ // src/prop-types/background-overlay.ts
49
+ var import_schema3 = require("@elementor/schema");
48
50
 
49
51
  // src/utils/create-prop-utils.ts
50
52
  var import_schema = require("@elementor/schema");
@@ -86,22 +88,30 @@ function createPropUtils(key, valueSchema) {
86
88
  extract,
87
89
  isValid,
88
90
  create,
89
- // this type fails in build due to zod issue that does not recognize the schema as a ZodType.
90
91
  schema
91
92
  };
92
93
  }
93
94
 
94
- // src/prop-types/shadow.ts
95
- var import_schema3 = require("@elementor/schema");
96
-
97
95
  // src/prop-types/utils.ts
98
96
  var import_schema2 = require("@elementor/schema");
99
97
  var unknownChildrenSchema = import_schema2.z.any().nullable();
100
98
 
99
+ // src/prop-types/background-overlay.ts
100
+ var backgroundOverlayPropTypeUtil = createPropUtils(
101
+ "background-overlay",
102
+ import_schema3.z.strictObject({
103
+ color: unknownChildrenSchema
104
+ })
105
+ );
106
+
107
+ // src/prop-types/box-shadow.ts
108
+ var import_schema5 = require("@elementor/schema");
109
+
101
110
  // src/prop-types/shadow.ts
111
+ var import_schema4 = require("@elementor/schema");
102
112
  var shadowPropTypeUtil = createPropUtils(
103
113
  "shadow",
104
- import_schema3.z.strictObject({
114
+ import_schema4.z.strictObject({
105
115
  position: unknownChildrenSchema,
106
116
  hOffset: unknownChildrenSchema,
107
117
  vOffset: unknownChildrenSchema,
@@ -112,13 +122,13 @@ var shadowPropTypeUtil = createPropUtils(
112
122
  );
113
123
 
114
124
  // src/prop-types/box-shadow.ts
115
- var boxShadowPropTypeUtil = createPropUtils("box-shadow", import_schema4.z.array(shadowPropTypeUtil.schema));
125
+ var boxShadowPropTypeUtil = createPropUtils("box-shadow", import_schema5.z.array(shadowPropTypeUtil.schema));
116
126
 
117
127
  // src/prop-types/border-radius.ts
118
- var import_schema5 = require("@elementor/schema");
128
+ var import_schema6 = require("@elementor/schema");
119
129
  var borderRadiusPropTypeUtil = createPropUtils(
120
130
  "border-radius",
121
- import_schema5.z.strictObject({
131
+ import_schema6.z.strictObject({
122
132
  "top-left": unknownChildrenSchema,
123
133
  "top-right": unknownChildrenSchema,
124
134
  "bottom-right": unknownChildrenSchema,
@@ -127,10 +137,10 @@ var borderRadiusPropTypeUtil = createPropUtils(
127
137
  );
128
138
 
129
139
  // src/prop-types/border-width.ts
130
- var import_schema6 = require("@elementor/schema");
140
+ var import_schema7 = require("@elementor/schema");
131
141
  var borderWidthPropTypeUtil = createPropUtils(
132
142
  "border-width",
133
- import_schema6.z.strictObject({
143
+ import_schema7.z.strictObject({
134
144
  top: unknownChildrenSchema,
135
145
  right: unknownChildrenSchema,
136
146
  bottom: unknownChildrenSchema,
@@ -139,47 +149,47 @@ var borderWidthPropTypeUtil = createPropUtils(
139
149
  );
140
150
 
141
151
  // src/prop-types/classes.ts
142
- var import_schema7 = require("@elementor/schema");
143
- var classesPropTypeUtil = createPropUtils("classes", import_schema7.z.array(import_schema7.z.string().regex(/^[a-z][a-z-_0-9]*$/i)));
152
+ var import_schema8 = require("@elementor/schema");
153
+ var classesPropTypeUtil = createPropUtils("classes", import_schema8.z.array(import_schema8.z.string().regex(/^[a-z][a-z-_0-9]*$/i)));
144
154
 
145
155
  // src/prop-types/color.ts
146
- var import_schema8 = require("@elementor/schema");
147
- var colorPropTypeUtil = createPropUtils("color", import_schema8.z.string());
156
+ var import_schema9 = require("@elementor/schema");
157
+ var colorPropTypeUtil = createPropUtils("color", import_schema9.z.string());
148
158
 
149
159
  // src/prop-types/image.ts
150
- var import_schema9 = require("@elementor/schema");
160
+ var import_schema10 = require("@elementor/schema");
151
161
  var imagePropTypeUtil = createPropUtils(
152
162
  "image",
153
- import_schema9.z.strictObject({
163
+ import_schema10.z.strictObject({
154
164
  src: unknownChildrenSchema,
155
165
  size: unknownChildrenSchema
156
166
  })
157
167
  );
158
168
 
159
169
  // src/prop-types/image-attachment-id.ts
160
- var import_schema10 = require("@elementor/schema");
161
- var imageAttachmentIdPropType = createPropUtils("image-attachment-id", import_schema10.z.number());
170
+ var import_schema11 = require("@elementor/schema");
171
+ var imageAttachmentIdPropType = createPropUtils("image-attachment-id", import_schema11.z.number());
162
172
 
163
173
  // src/prop-types/image-src.ts
164
- var import_schema11 = require("@elementor/schema");
174
+ var import_schema12 = require("@elementor/schema");
165
175
  var imageSrcPropTypeUtil = createPropUtils(
166
176
  "image-src",
167
- import_schema11.z.strictObject({
177
+ import_schema12.z.strictObject({
168
178
  id: unknownChildrenSchema,
169
- url: import_schema11.z.null()
179
+ url: import_schema12.z.null()
170
180
  }).or(
171
- import_schema11.z.strictObject({
172
- id: import_schema11.z.null(),
181
+ import_schema12.z.strictObject({
182
+ id: import_schema12.z.null(),
173
183
  url: unknownChildrenSchema
174
184
  })
175
185
  )
176
186
  );
177
187
 
178
188
  // src/prop-types/linked-dimensions.ts
179
- var import_schema12 = require("@elementor/schema");
189
+ var import_schema13 = require("@elementor/schema");
180
190
  var linkedDimensionsPropTypeUtil = createPropUtils(
181
191
  "linked-dimensions",
182
- import_schema12.z.strictObject({
192
+ import_schema13.z.strictObject({
183
193
  isLinked: unknownChildrenSchema,
184
194
  top: unknownChildrenSchema,
185
195
  right: unknownChildrenSchema,
@@ -189,69 +199,81 @@ var linkedDimensionsPropTypeUtil = createPropUtils(
189
199
  );
190
200
 
191
201
  // src/prop-types/number.ts
192
- var import_schema13 = require("@elementor/schema");
193
- var numberPropTypeUtil = createPropUtils("number", import_schema13.z.number());
202
+ var import_schema14 = require("@elementor/schema");
203
+ var numberPropTypeUtil = createPropUtils("number", import_schema14.z.number());
194
204
 
195
205
  // src/prop-types/size.ts
196
- var import_schema14 = require("@elementor/schema");
206
+ var import_schema15 = require("@elementor/schema");
197
207
  var sizePropTypeUtil = createPropUtils(
198
208
  "size",
199
- import_schema14.z.strictObject({
200
- unit: import_schema14.z.enum(["px", "em", "rem", "%", "vw", "vh"]),
201
- size: import_schema14.z.number()
209
+ import_schema15.z.strictObject({
210
+ unit: import_schema15.z.enum(["px", "em", "rem", "%", "vw", "vh"]),
211
+ size: import_schema15.z.number()
202
212
  })
203
213
  );
204
214
 
205
215
  // src/prop-types/string.ts
206
- var import_schema15 = require("@elementor/schema");
207
- var stringPropTypeUtil = createPropUtils("string", import_schema15.z.string().nullable());
216
+ var import_schema16 = require("@elementor/schema");
217
+ var stringPropTypeUtil = createPropUtils("string", import_schema16.z.string().nullable());
208
218
 
209
219
  // src/prop-types/stroke.ts
210
- var import_schema16 = require("@elementor/schema");
220
+ var import_schema17 = require("@elementor/schema");
211
221
  var strokePropTypeUtil = createPropUtils(
212
222
  "stroke",
213
- import_schema16.z.strictObject({
223
+ import_schema17.z.strictObject({
214
224
  color: unknownChildrenSchema,
215
225
  width: unknownChildrenSchema
216
226
  })
217
227
  );
218
228
 
219
229
  // src/prop-types/url.ts
220
- var import_schema17 = require("@elementor/schema");
221
- var urlPropTypeUtil = createPropUtils("url", import_schema17.z.string().url().nullable());
230
+ var import_schema18 = require("@elementor/schema");
231
+ var urlPropTypeUtil = createPropUtils("url", import_schema18.z.string().url().nullable());
222
232
 
223
233
  // src/prop-types/color-gradient.ts
224
- var import_schema18 = require("@elementor/schema");
234
+ var import_schema19 = require("@elementor/schema");
225
235
  var colorGradientPropTypeUtil = createPropUtils(
226
236
  "background-overlay",
227
- import_schema18.z.strictObject({
237
+ import_schema19.z.strictObject({
228
238
  color: unknownChildrenSchema
229
239
  })
230
240
  );
231
241
 
232
242
  // src/prop-types/background-image.ts
233
- var import_schema19 = require("@elementor/schema");
243
+ var import_schema20 = require("@elementor/schema");
234
244
  var backgroundImagePropTypeUtil = createPropUtils(
235
245
  "background-image",
236
- import_schema19.z.array(colorGradientPropTypeUtil.schema)
246
+ import_schema20.z.array(colorGradientPropTypeUtil.schema)
237
247
  );
238
248
 
239
249
  // src/prop-types/link.ts
240
- var import_schema20 = require("@elementor/schema");
250
+ var import_schema21 = require("@elementor/schema");
241
251
  var linkPropTypeUtil = createPropUtils(
242
252
  "link",
243
- import_schema20.z.strictObject({
244
- enabled: import_schema20.z.boolean(),
253
+ import_schema21.z.strictObject({
254
+ enabled: import_schema21.z.boolean(),
245
255
  href: urlPropTypeUtil.schema,
246
- isTargetBlank: import_schema20.z.boolean()
256
+ isTargetBlank: import_schema21.z.boolean()
257
+ })
258
+ );
259
+
260
+ // src/prop-types/gaps.ts
261
+ var import_schema22 = require("@elementor/schema");
262
+ var gapPropTypeUtil = createPropUtils(
263
+ "gap",
264
+ import_schema22.z.object({
265
+ isLinked: import_schema22.z.boolean(),
266
+ row: import_schema22.z.any(),
267
+ column: import_schema22.z.any()
247
268
  })
248
269
  );
249
270
 
250
271
  // src/utils/is-transformable.ts
251
- var import_schema21 = require("@elementor/schema");
252
- var transformableSchema = import_schema21.z.object({
253
- $$type: import_schema21.z.string(),
254
- value: import_schema21.z.any()
272
+ var import_schema23 = require("@elementor/schema");
273
+ var transformableSchema = import_schema23.z.object({
274
+ $$type: import_schema23.z.string(),
275
+ value: import_schema23.z.any(),
276
+ disabled: import_schema23.z.boolean().optional()
255
277
  });
256
278
  var isTransformable = (value) => {
257
279
  return transformableSchema.safeParse(value).success;
@@ -259,6 +281,7 @@ var isTransformable = (value) => {
259
281
  // Annotate the CommonJS export names for ESM import in node:
260
282
  0 && (module.exports = {
261
283
  backgroundImagePropTypeUtil,
284
+ backgroundOverlayPropTypeUtil,
262
285
  borderRadiusPropTypeUtil,
263
286
  borderWidthPropTypeUtil,
264
287
  boxShadowPropTypeUtil,
@@ -266,6 +289,7 @@ var isTransformable = (value) => {
266
289
  colorGradientPropTypeUtil,
267
290
  colorPropTypeUtil,
268
291
  createPropUtils,
292
+ gapPropTypeUtil,
269
293
  imageAttachmentIdPropType,
270
294
  imagePropTypeUtil,
271
295
  imageSrcPropTypeUtil,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../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/color-gradient.ts","../src/prop-types/background-image.ts","../src/prop-types/link.ts","../src/utils/is-transformable.ts"],"sourcesContent":["// types\nexport * from './types';\nexport { type PropTypeUtil, type CreateOptions } from './utils/create-prop-utils';\n\n// prop types\nexport * from './prop-types';\n\n// utils\nexport { createPropUtils } from './utils/create-prop-utils';\nexport { isTransformable } from './utils/is-transformable';\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, type ZodType, type ZodTypeAny } from '@elementor/schema';\n\nimport { type PropValue } from '../types';\n\ntype Updater< T > = ( prev?: T ) => T;\n\nexport type CreateOptions = {\n\tbase?: unknown;\n\tdisabled?: boolean;\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 type PropTypeUtil< TKey extends string, TValue extends PropValue > = ReturnType<\n\ttypeof createPropUtils< TKey, ZodType< TValue > >\n>;\n\nexport function createPropUtils< TKey extends string, TValue extends ZodTypeAny >( key: TKey, valueSchema: TValue ) {\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 = z.infer< typeof schema >;\n\n\ttype TPropValue = z.infer< typeof valueSchema >;\n\n\tfunction isValid( prop: unknown ): prop is Prop {\n\t\treturn schema.safeParse( prop ).success;\n\t}\n\n\tfunction create( value: TPropValue ): Prop;\n\tfunction create( value: TPropValue, createOptions?: CreateOptions ): Prop;\n\tfunction create( value: Updater< TPropValue >, createOptions: CreateOptions ): Prop;\n\tfunction create( value: TPropValue | Updater< TPropValue >, createOptions?: CreateOptions ): Prop {\n\t\tconst fn = ( typeof value === 'function' ? value : () => value ) as Updater< TPropValue >;\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} as Prop;\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} as Prop;\n\t}\n\n\tfunction extract( prop: unknown ): TPropValue | 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\t// this type fails in build due to zod issue that does not recognize the schema as a ZodType.\n\t\tschema: schema as ZodType< Prop >,\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() );\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\nconst transformableSchema = z.object( {\n\t$$type: z.string(),\n\tvalue: z.any(),\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,iBAAkB;;;ACAlB,oBAAiD;AA8B1C,SAAS,gBAAmE,KAAW,aAAsB;AACnH,QAAM,SAAS,gBAAE,aAAc;AAAA,IAC9B,QAAQ,gBAAE,QAAS,GAAI;AAAA,IACvB,OAAO;AAAA,IACP,UAAU,gBAAE,QAAQ,EAAE,SAAS;AAAA,EAChC,CAAE;AAMF,WAAS,QAAS,MAA8B;AAC/C,WAAO,OAAO,UAAW,IAAK,EAAE;AAAA,EACjC;AAKA,WAAS,OAAQ,OAA2C,eAAsC;AACjG,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,IAC3F;AAEA,WAAO;AAAA,MACN,QAAQ;AAAA,MACR,OAAO,GAAI,KAAK,KAAM;AAAA,MACtB,GAAK,YAAY,EAAE,SAAS;AAAA,IAC7B;AAAA,EACD;AAEA,WAAS,QAAS,MAAmC;AACpD,QAAK,CAAE,QAAS,IAAK,GAAI;AACxB,aAAO;AAAA,IACR;AAEA,WAAO,KAAK;AAAA,EACb;AAEA,SAAO;AAAA,IACN;A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A,IAAAC,kBAAkB;AAKX,IAAM,mBAAmB;AAAA,EAC/B;AAAA,EACA,kBAAE,aAAc;AAAA,IACf,SAAS,kBAAE,QAAQ;AAAA,IACnB,MAAM,gBAAgB;AAAA,IACtB,eAAe,kBAAE,QAAQ;AAAA,EAC1B,CAAE;AACH;;;ACZA,IAAAC,kBAAkB;AAElB,IAAM,sBAAsB,kBAAE,OAAQ;AAAA,EACrC,QAAQ,kBAAE,OAAO;AAAA,EACjB,OAAO,kBAAE,IAAI;AACd,CAAE;AAIK,IAAM,kBAAkB,CAAE,UAAqD;AACrF,SAAO,oBAAoB,UAAW,KAAM,EAAE;AAC/C;","names":["import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema"]}
1
+ {"version":3,"sources":["../src/index.ts","../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":["// types\nexport * from './types';\nexport { type PropTypeUtil, type CreateOptions } from './utils/create-prop-utils';\n\n// prop types\nexport * from './prop-types';\n\n// utils\nexport { createPropUtils } from './utils/create-prop-utils';\nexport { isTransformable } from './utils/is-transformable';\n","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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,iBAAkB;;;ACAlB,oBAAgC;AA8BzB,SAAS,gBACf,KACA,aACC;AACD,QAAM,SAAS,gBAAE,aAAc;AAAA,IAC9B,QAAQ,gBAAE,QAAS,GAAI;AAAA,IACvB,OAAO;AAAA,IACP,UAAU,gBAAE,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,IAC3F;AAEA,WAAO;AAAA,MACN,QAAQ;AAAA,MACR,OAAO,GAAI,KAAK,KAAM;AAAA,MACtB,GAAK,YAAY,EAAE,SAAS;AAAA,IAC7B;AAAA,EACD;AAEA,WAAS,QAAS,MAA+B;AAChD,QAAK,CAAE,QAAS,IAAK,GAAI;AACx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;AAAA,EACxC;AAAA,EACA,kBAAE,aAAc;AAAA,IACf,OAAO;AAAA,EACR,CAAE;AACH;;;ACVA,IAAAC,kBAAkB;AAKX,IAAM,8BAA8B;AAAA,EAC1C;AAAA,EACA,kBAAE,MAAO,0BAA0B,MAAO;AAC3C;;;ACRA,IAAAC,kBAAkB;AAKX,IAAM,mBAAmB;AAAA,EAC/B;AAAA,EACA,kBAAE,aAAc;AAAA,IACf,SAAS,kBAAE,QAAQ;AAAA,IACnB,MAAM,gBAAgB;AAAA,IACtB,eAAe,kBAAE,QAAQ;AAAA,EAC1B,CAAE;AACH;;;ACZA,IAAAC,kBAAkB;AAIX,IAAM,kBAAkB;AAAA,EAC9B;AAAA,EACA,kBAAE,OAAQ;AAAA,IACT,UAAU,kBAAE,QAAQ;AAAA,IACpB,KAAK,kBAAE,IAAI;AAAA,IACX,QAAQ,kBAAE,IAAI;AAAA,EACf,CAAE;AACH;;;ACXA,IAAAC,kBAAkB;AAElB,IAAM,sBAAsB,kBAAE,OAAQ;AAAA,EACrC,QAAQ,kBAAE,OAAO;AAAA,EACjB,OAAO,kBAAE,IAAI;AAAA,EACb,UAAU,kBAAE,QAAQ,EAAE,SAAS;AAChC,CAAE;AAIK,IAAM,kBAAkB,CAAE,UAAqD;AACrF,SAAO,oBAAoB,UAAW,KAAM,EAAE;AAC/C;","names":["import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema","import_schema"]}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- // src/prop-types/box-shadow.ts
2
- import { z as z4 } from "@elementor/schema";
1
+ // src/prop-types/background-overlay.ts
2
+ import { z as z3 } from "@elementor/schema";
3
3
 
4
4
  // src/utils/create-prop-utils.ts
5
5
  import { z } from "@elementor/schema";
@@ -41,22 +41,30 @@ function createPropUtils(key, valueSchema) {
41
41
  extract,
42
42
  isValid,
43
43
  create,
44
- // this type fails in build due to zod issue that does not recognize the schema as a ZodType.
45
44
  schema
46
45
  };
47
46
  }
48
47
 
49
- // src/prop-types/shadow.ts
50
- import { z as z3 } from "@elementor/schema";
51
-
52
48
  // src/prop-types/utils.ts
53
49
  import { z as z2 } from "@elementor/schema";
54
50
  var unknownChildrenSchema = z2.any().nullable();
55
51
 
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
+
56
63
  // src/prop-types/shadow.ts
64
+ import { z as z4 } from "@elementor/schema";
57
65
  var shadowPropTypeUtil = createPropUtils(
58
66
  "shadow",
59
- z3.strictObject({
67
+ z4.strictObject({
60
68
  position: unknownChildrenSchema,
61
69
  hOffset: unknownChildrenSchema,
62
70
  vOffset: unknownChildrenSchema,
@@ -67,13 +75,13 @@ var shadowPropTypeUtil = createPropUtils(
67
75
  );
68
76
 
69
77
  // src/prop-types/box-shadow.ts
70
- var boxShadowPropTypeUtil = createPropUtils("box-shadow", z4.array(shadowPropTypeUtil.schema));
78
+ var boxShadowPropTypeUtil = createPropUtils("box-shadow", z5.array(shadowPropTypeUtil.schema));
71
79
 
72
80
  // src/prop-types/border-radius.ts
73
- import { z as z5 } from "@elementor/schema";
81
+ import { z as z6 } from "@elementor/schema";
74
82
  var borderRadiusPropTypeUtil = createPropUtils(
75
83
  "border-radius",
76
- z5.strictObject({
84
+ z6.strictObject({
77
85
  "top-left": unknownChildrenSchema,
78
86
  "top-right": unknownChildrenSchema,
79
87
  "bottom-right": unknownChildrenSchema,
@@ -82,10 +90,10 @@ var borderRadiusPropTypeUtil = createPropUtils(
82
90
  );
83
91
 
84
92
  // src/prop-types/border-width.ts
85
- import { z as z6 } from "@elementor/schema";
93
+ import { z as z7 } from "@elementor/schema";
86
94
  var borderWidthPropTypeUtil = createPropUtils(
87
95
  "border-width",
88
- z6.strictObject({
96
+ z7.strictObject({
89
97
  top: unknownChildrenSchema,
90
98
  right: unknownChildrenSchema,
91
99
  bottom: unknownChildrenSchema,
@@ -94,47 +102,47 @@ var borderWidthPropTypeUtil = createPropUtils(
94
102
  );
95
103
 
96
104
  // src/prop-types/classes.ts
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)));
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)));
99
107
 
100
108
  // src/prop-types/color.ts
101
- import { z as z8 } from "@elementor/schema";
102
- var colorPropTypeUtil = createPropUtils("color", z8.string());
109
+ import { z as z9 } from "@elementor/schema";
110
+ var colorPropTypeUtil = createPropUtils("color", z9.string());
103
111
 
104
112
  // src/prop-types/image.ts
105
- import { z as z9 } from "@elementor/schema";
113
+ import { z as z10 } from "@elementor/schema";
106
114
  var imagePropTypeUtil = createPropUtils(
107
115
  "image",
108
- z9.strictObject({
116
+ z10.strictObject({
109
117
  src: unknownChildrenSchema,
110
118
  size: unknownChildrenSchema
111
119
  })
112
120
  );
113
121
 
114
122
  // src/prop-types/image-attachment-id.ts
115
- import { z as z10 } from "@elementor/schema";
116
- var imageAttachmentIdPropType = createPropUtils("image-attachment-id", z10.number());
123
+ import { z as z11 } from "@elementor/schema";
124
+ var imageAttachmentIdPropType = createPropUtils("image-attachment-id", z11.number());
117
125
 
118
126
  // src/prop-types/image-src.ts
119
- import { z as z11 } from "@elementor/schema";
127
+ import { z as z12 } from "@elementor/schema";
120
128
  var imageSrcPropTypeUtil = createPropUtils(
121
129
  "image-src",
122
- z11.strictObject({
130
+ z12.strictObject({
123
131
  id: unknownChildrenSchema,
124
- url: z11.null()
132
+ url: z12.null()
125
133
  }).or(
126
- z11.strictObject({
127
- id: z11.null(),
134
+ z12.strictObject({
135
+ id: z12.null(),
128
136
  url: unknownChildrenSchema
129
137
  })
130
138
  )
131
139
  );
132
140
 
133
141
  // src/prop-types/linked-dimensions.ts
134
- import { z as z12 } from "@elementor/schema";
142
+ import { z as z13 } from "@elementor/schema";
135
143
  var linkedDimensionsPropTypeUtil = createPropUtils(
136
144
  "linked-dimensions",
137
- z12.strictObject({
145
+ z13.strictObject({
138
146
  isLinked: unknownChildrenSchema,
139
147
  top: unknownChildrenSchema,
140
148
  right: unknownChildrenSchema,
@@ -144,75 +152,88 @@ var linkedDimensionsPropTypeUtil = createPropUtils(
144
152
  );
145
153
 
146
154
  // src/prop-types/number.ts
147
- import { z as z13 } from "@elementor/schema";
148
- var numberPropTypeUtil = createPropUtils("number", z13.number());
155
+ import { z as z14 } from "@elementor/schema";
156
+ var numberPropTypeUtil = createPropUtils("number", z14.number());
149
157
 
150
158
  // src/prop-types/size.ts
151
- import { z as z14 } from "@elementor/schema";
159
+ import { z as z15 } from "@elementor/schema";
152
160
  var sizePropTypeUtil = createPropUtils(
153
161
  "size",
154
- z14.strictObject({
155
- unit: z14.enum(["px", "em", "rem", "%", "vw", "vh"]),
156
- size: z14.number()
162
+ z15.strictObject({
163
+ unit: z15.enum(["px", "em", "rem", "%", "vw", "vh"]),
164
+ size: z15.number()
157
165
  })
158
166
  );
159
167
 
160
168
  // src/prop-types/string.ts
161
- import { z as z15 } from "@elementor/schema";
162
- var stringPropTypeUtil = createPropUtils("string", z15.string().nullable());
169
+ import { z as z16 } from "@elementor/schema";
170
+ var stringPropTypeUtil = createPropUtils("string", z16.string().nullable());
163
171
 
164
172
  // src/prop-types/stroke.ts
165
- import { z as z16 } from "@elementor/schema";
173
+ import { z as z17 } from "@elementor/schema";
166
174
  var strokePropTypeUtil = createPropUtils(
167
175
  "stroke",
168
- z16.strictObject({
176
+ z17.strictObject({
169
177
  color: unknownChildrenSchema,
170
178
  width: unknownChildrenSchema
171
179
  })
172
180
  );
173
181
 
174
182
  // src/prop-types/url.ts
175
- import { z as z17 } from "@elementor/schema";
176
- var urlPropTypeUtil = createPropUtils("url", z17.string().url().nullable());
183
+ import { z as z18 } from "@elementor/schema";
184
+ var urlPropTypeUtil = createPropUtils("url", z18.string().url().nullable());
177
185
 
178
186
  // src/prop-types/color-gradient.ts
179
- import { z as z18 } from "@elementor/schema";
187
+ import { z as z19 } from "@elementor/schema";
180
188
  var colorGradientPropTypeUtil = createPropUtils(
181
189
  "background-overlay",
182
- z18.strictObject({
190
+ z19.strictObject({
183
191
  color: unknownChildrenSchema
184
192
  })
185
193
  );
186
194
 
187
195
  // src/prop-types/background-image.ts
188
- import { z as z19 } from "@elementor/schema";
196
+ import { z as z20 } from "@elementor/schema";
189
197
  var backgroundImagePropTypeUtil = createPropUtils(
190
198
  "background-image",
191
- z19.array(colorGradientPropTypeUtil.schema)
199
+ z20.array(colorGradientPropTypeUtil.schema)
192
200
  );
193
201
 
194
202
  // src/prop-types/link.ts
195
- import { z as z20 } from "@elementor/schema";
203
+ import { z as z21 } from "@elementor/schema";
196
204
  var linkPropTypeUtil = createPropUtils(
197
205
  "link",
198
- z20.strictObject({
199
- enabled: z20.boolean(),
206
+ z21.strictObject({
207
+ enabled: z21.boolean(),
200
208
  href: urlPropTypeUtil.schema,
201
- isTargetBlank: z20.boolean()
209
+ isTargetBlank: z21.boolean()
210
+ })
211
+ );
212
+
213
+ // src/prop-types/gaps.ts
214
+ import { z as z22 } from "@elementor/schema";
215
+ var gapPropTypeUtil = createPropUtils(
216
+ "gap",
217
+ z22.object({
218
+ isLinked: z22.boolean(),
219
+ row: z22.any(),
220
+ column: z22.any()
202
221
  })
203
222
  );
204
223
 
205
224
  // src/utils/is-transformable.ts
206
- import { z as z21 } from "@elementor/schema";
207
- var transformableSchema = z21.object({
208
- $$type: z21.string(),
209
- value: z21.any()
225
+ import { z as z23 } from "@elementor/schema";
226
+ var transformableSchema = z23.object({
227
+ $$type: z23.string(),
228
+ value: z23.any(),
229
+ disabled: z23.boolean().optional()
210
230
  });
211
231
  var isTransformable = (value) => {
212
232
  return transformableSchema.safeParse(value).success;
213
233
  };
214
234
  export {
215
235
  backgroundImagePropTypeUtil,
236
+ backgroundOverlayPropTypeUtil,
216
237
  borderRadiusPropTypeUtil,
217
238
  borderWidthPropTypeUtil,
218
239
  boxShadowPropTypeUtil,
@@ -220,6 +241,7 @@ export {
220
241
  colorGradientPropTypeUtil,
221
242
  colorPropTypeUtil,
222
243
  createPropUtils,
244
+ gapPropTypeUtil,
223
245
  imageAttachmentIdPropType,
224
246
  imagePropTypeUtil,
225
247
  imageSrcPropTypeUtil,