@elementor/editor-props 0.16.0 → 3.32.0-20
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/CHANGELOG.md +11 -0
- package/dist/index.d.mts +10109 -1407
- package/dist/index.d.ts +10109 -1407
- package/dist/index.js +218 -111
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +207 -108
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -1
- package/src/prop-types/filter-prop-types/backdrop-filter.ts +13 -0
- package/src/prop-types/filter-prop-types/drop-shadow-filter.ts +17 -0
- package/src/prop-types/filter-prop-types/filter.ts +13 -5
- package/src/prop-types/flex.ts +15 -0
- package/src/prop-types/index.ts +8 -2
- package/src/prop-types/selection-size.ts +16 -0
- package/src/prop-types/size.ts +12 -0
- package/src/prop-types/transform-prop-types/move-transform.ts +2 -1
- package/src/prop-types/transform-prop-types/rotate-transform.ts +16 -0
- package/src/prop-types/transform-prop-types/scale-transform.ts +8 -5
- package/src/prop-types/transform-prop-types/skew-transform.ts +15 -0
- package/src/prop-types/transform-prop-types/transform.ts +8 -1
- package/src/prop-types/transform-prop-types/types.ts +8 -0
- package/src/types.ts +1 -4
- package/src/utils/create-prop-utils.ts +3 -2
- package/src/utils/prop-dependency-utils.ts +35 -24
- package/src/prop-types/filter-prop-types/blur-filter.ts +0 -8
- package/src/prop-types/filter-prop-types/brightness-filter.ts +0 -8
package/dist/index.mjs
CHANGED
|
@@ -45,8 +45,8 @@ function createPropUtils(key, valueSchema) {
|
|
|
45
45
|
key
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function createArrayPropUtils(key, valueSchema) {
|
|
49
|
-
return createPropUtils(`${key}-array`, z.array(valueSchema));
|
|
48
|
+
function createArrayPropUtils(key, valueSchema, overrideKey) {
|
|
49
|
+
return createPropUtils(overrideKey || `${key}-array`, z.array(valueSchema));
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// src/prop-types/shadow.ts
|
|
@@ -108,40 +108,51 @@ var classesPropTypeUtil = createPropUtils(
|
|
|
108
108
|
import { z as z8 } from "@elementor/schema";
|
|
109
109
|
var colorPropTypeUtil = createPropUtils("color", z8.string());
|
|
110
110
|
|
|
111
|
-
// src/prop-types/
|
|
111
|
+
// src/prop-types/flex.ts
|
|
112
112
|
import { z as z9 } from "@elementor/schema";
|
|
113
|
+
var flexPropTypeUtil = createPropUtils(
|
|
114
|
+
"flex",
|
|
115
|
+
z9.strictObject({
|
|
116
|
+
flexGrow: unknownChildrenSchema,
|
|
117
|
+
flexShrink: unknownChildrenSchema,
|
|
118
|
+
flexBasis: unknownChildrenSchema
|
|
119
|
+
})
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
// src/prop-types/image.ts
|
|
123
|
+
import { z as z10 } from "@elementor/schema";
|
|
113
124
|
var imagePropTypeUtil = createPropUtils(
|
|
114
125
|
"image",
|
|
115
|
-
|
|
126
|
+
z10.strictObject({
|
|
116
127
|
src: unknownChildrenSchema,
|
|
117
128
|
size: unknownChildrenSchema
|
|
118
129
|
})
|
|
119
130
|
);
|
|
120
131
|
|
|
121
132
|
// src/prop-types/image-attachment-id.ts
|
|
122
|
-
import { z as
|
|
123
|
-
var imageAttachmentIdPropType = createPropUtils("image-attachment-id",
|
|
133
|
+
import { z as z11 } from "@elementor/schema";
|
|
134
|
+
var imageAttachmentIdPropType = createPropUtils("image-attachment-id", z11.number());
|
|
124
135
|
|
|
125
136
|
// src/prop-types/image-src.ts
|
|
126
|
-
import { z as
|
|
137
|
+
import { z as z12 } from "@elementor/schema";
|
|
127
138
|
var imageSrcPropTypeUtil = createPropUtils(
|
|
128
139
|
"image-src",
|
|
129
|
-
|
|
140
|
+
z12.strictObject({
|
|
130
141
|
id: unknownChildrenSchema,
|
|
131
|
-
url:
|
|
142
|
+
url: z12.null()
|
|
132
143
|
}).or(
|
|
133
|
-
|
|
134
|
-
id:
|
|
144
|
+
z12.strictObject({
|
|
145
|
+
id: z12.null(),
|
|
135
146
|
url: unknownChildrenSchema
|
|
136
147
|
})
|
|
137
148
|
)
|
|
138
149
|
);
|
|
139
150
|
|
|
140
151
|
// src/prop-types/dimensions.ts
|
|
141
|
-
import { z as
|
|
152
|
+
import { z as z13 } from "@elementor/schema";
|
|
142
153
|
var dimensionsPropTypeUtil = createPropUtils(
|
|
143
154
|
"dimensions",
|
|
144
|
-
|
|
155
|
+
z13.strictObject({
|
|
145
156
|
"block-start": unknownChildrenSchema,
|
|
146
157
|
"block-end": unknownChildrenSchema,
|
|
147
158
|
"inline-start": unknownChildrenSchema,
|
|
@@ -150,80 +161,112 @@ var dimensionsPropTypeUtil = createPropUtils(
|
|
|
150
161
|
);
|
|
151
162
|
|
|
152
163
|
// src/prop-types/number.ts
|
|
153
|
-
import { z as
|
|
154
|
-
var numberPropTypeUtil = createPropUtils("number",
|
|
164
|
+
import { z as z14 } from "@elementor/schema";
|
|
165
|
+
var numberPropTypeUtil = createPropUtils("number", z14.number().nullable());
|
|
155
166
|
|
|
156
167
|
// src/prop-types/size.ts
|
|
157
|
-
import { z as
|
|
168
|
+
import { z as z15 } from "@elementor/schema";
|
|
158
169
|
var sizePropTypeUtil = createPropUtils(
|
|
159
170
|
"size",
|
|
160
|
-
|
|
161
|
-
unit:
|
|
162
|
-
size:
|
|
171
|
+
z15.strictObject({
|
|
172
|
+
unit: z15.enum(["px", "em", "rem", "%", "vw", "vh"]),
|
|
173
|
+
size: z15.number()
|
|
163
174
|
}).or(
|
|
164
|
-
|
|
165
|
-
unit:
|
|
166
|
-
size:
|
|
175
|
+
z15.strictObject({
|
|
176
|
+
unit: z15.enum(["deg", "rad", "grad", "turn"]),
|
|
177
|
+
size: z15.number()
|
|
178
|
+
})
|
|
179
|
+
).or(
|
|
180
|
+
z15.strictObject({
|
|
181
|
+
unit: z15.enum(["s", "ms"]),
|
|
182
|
+
size: z15.number()
|
|
183
|
+
})
|
|
184
|
+
).or(
|
|
185
|
+
z15.strictObject({
|
|
186
|
+
unit: z15.literal("auto"),
|
|
187
|
+
size: z15.literal("")
|
|
167
188
|
})
|
|
168
189
|
).or(
|
|
169
|
-
|
|
170
|
-
unit:
|
|
171
|
-
size:
|
|
190
|
+
z15.strictObject({
|
|
191
|
+
unit: z15.literal("custom"),
|
|
192
|
+
size: z15.string()
|
|
172
193
|
})
|
|
173
194
|
)
|
|
174
195
|
);
|
|
175
196
|
|
|
176
197
|
// src/prop-types/string.ts
|
|
177
|
-
import { z as
|
|
178
|
-
var stringPropTypeUtil = createPropUtils("string",
|
|
198
|
+
import { z as z16 } from "@elementor/schema";
|
|
199
|
+
var stringPropTypeUtil = createPropUtils("string", z16.string().nullable());
|
|
179
200
|
|
|
180
201
|
// src/prop-types/stroke.ts
|
|
181
|
-
import { z as
|
|
202
|
+
import { z as z17 } from "@elementor/schema";
|
|
182
203
|
var strokePropTypeUtil = createPropUtils(
|
|
183
204
|
"stroke",
|
|
184
|
-
|
|
205
|
+
z17.strictObject({
|
|
185
206
|
color: unknownChildrenSchema,
|
|
186
207
|
width: unknownChildrenSchema
|
|
187
208
|
})
|
|
188
209
|
);
|
|
189
210
|
|
|
190
211
|
// src/prop-types/url.ts
|
|
191
|
-
import { z as
|
|
192
|
-
var urlPropTypeUtil = createPropUtils("url",
|
|
212
|
+
import { z as z18 } from "@elementor/schema";
|
|
213
|
+
var urlPropTypeUtil = createPropUtils("url", z18.string().nullable());
|
|
193
214
|
|
|
194
215
|
// src/prop-types/layout-direction.ts
|
|
195
|
-
import { z as
|
|
216
|
+
import { z as z19 } from "@elementor/schema";
|
|
196
217
|
var layoutDirectionPropTypeUtil = createPropUtils(
|
|
197
218
|
"layout-direction",
|
|
198
|
-
|
|
199
|
-
row:
|
|
200
|
-
column:
|
|
219
|
+
z19.object({
|
|
220
|
+
row: z19.any(),
|
|
221
|
+
column: z19.any()
|
|
201
222
|
})
|
|
202
223
|
);
|
|
203
224
|
|
|
204
225
|
// src/prop-types/link.ts
|
|
205
|
-
import { z as
|
|
226
|
+
import { z as z20 } from "@elementor/schema";
|
|
206
227
|
var linkPropTypeUtil = createPropUtils(
|
|
207
228
|
"link",
|
|
208
|
-
|
|
229
|
+
z20.strictObject({
|
|
209
230
|
destination: unknownChildrenSchema,
|
|
210
231
|
label: unknownChildrenSchema,
|
|
211
232
|
isTargetBlank: unknownChildrenSchema
|
|
212
233
|
})
|
|
213
234
|
);
|
|
214
235
|
|
|
236
|
+
// src/prop-types/selection-size.ts
|
|
237
|
+
import { z as z22 } from "@elementor/schema";
|
|
238
|
+
|
|
239
|
+
// src/prop-types/key-value.ts
|
|
240
|
+
import { z as z21 } from "@elementor/schema";
|
|
241
|
+
var keyValuePropTypeUtil = createPropUtils(
|
|
242
|
+
"key-value",
|
|
243
|
+
z21.strictObject({
|
|
244
|
+
key: unknownChildrenSchema,
|
|
245
|
+
value: unknownChildrenSchema
|
|
246
|
+
})
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
// src/prop-types/selection-size.ts
|
|
250
|
+
var selectionSizePropTypeUtil = createPropUtils(
|
|
251
|
+
"selection-size",
|
|
252
|
+
z22.strictObject({
|
|
253
|
+
selection: z22.union([keyValuePropTypeUtil.schema, stringPropTypeUtil.schema]),
|
|
254
|
+
size: sizePropTypeUtil.schema
|
|
255
|
+
})
|
|
256
|
+
);
|
|
257
|
+
|
|
215
258
|
// src/prop-types/background-prop-types/background.ts
|
|
216
|
-
import { z as
|
|
259
|
+
import { z as z23 } from "@elementor/schema";
|
|
217
260
|
var backgroundPropTypeUtil = createPropUtils(
|
|
218
261
|
"background",
|
|
219
|
-
|
|
262
|
+
z23.strictObject({
|
|
220
263
|
color: unknownChildrenSchema,
|
|
221
264
|
"background-overlay": unknownChildrenSchema
|
|
222
265
|
})
|
|
223
266
|
);
|
|
224
267
|
|
|
225
268
|
// src/prop-types/background-prop-types/background-overlay.ts
|
|
226
|
-
import { z as
|
|
269
|
+
import { z as z24 } from "@elementor/schema";
|
|
227
270
|
|
|
228
271
|
// src/prop-types/background-prop-types/background-color-overlay.ts
|
|
229
272
|
var backgroundColorOverlayPropTypeUtil = createPropUtils("background-color-overlay", unknownChildrenSchema);
|
|
@@ -239,7 +282,7 @@ var backgroundImageOverlayPropTypeUtil = createPropUtils("background-image-overl
|
|
|
239
282
|
|
|
240
283
|
// src/prop-types/background-prop-types/background-overlay.ts
|
|
241
284
|
var backgroundOverlayItem = backgroundColorOverlayPropTypeUtil.schema.or(backgroundGradientOverlayPropTypeUtil.schema).or(backgroundImageOverlayPropTypeUtil.schema);
|
|
242
|
-
var backgroundOverlayPropTypeUtil = createPropUtils("background-overlay",
|
|
285
|
+
var backgroundOverlayPropTypeUtil = createPropUtils("background-overlay", z24.array(backgroundOverlayItem));
|
|
243
286
|
|
|
244
287
|
// src/prop-types/background-prop-types/background-image-position-offset.ts
|
|
245
288
|
var backgroundImagePositionOffsetPropTypeUtil = createPropUtils(
|
|
@@ -254,87 +297,132 @@ var backgroundImageSizeScalePropTypeUtil = createPropUtils(
|
|
|
254
297
|
);
|
|
255
298
|
|
|
256
299
|
// src/prop-types/boolean.ts
|
|
257
|
-
import { z as
|
|
258
|
-
var booleanPropTypeUtil = createPropUtils("boolean",
|
|
300
|
+
import { z as z25 } from "@elementor/schema";
|
|
301
|
+
var booleanPropTypeUtil = createPropUtils("boolean", z25.boolean().nullable());
|
|
259
302
|
|
|
260
303
|
// src/prop-types/color-stop.ts
|
|
261
|
-
import { z as
|
|
304
|
+
import { z as z26 } from "@elementor/schema";
|
|
262
305
|
var colorStopPropTypeUtil = createPropUtils(
|
|
263
306
|
"color-stop",
|
|
264
|
-
|
|
307
|
+
z26.strictObject({
|
|
265
308
|
color: unknownChildrenSchema,
|
|
266
309
|
offset: unknownChildrenSchema
|
|
267
310
|
})
|
|
268
311
|
);
|
|
269
312
|
|
|
270
313
|
// src/prop-types/gradient-color-stop.ts
|
|
271
|
-
import { z as
|
|
314
|
+
import { z as z27 } from "@elementor/schema";
|
|
272
315
|
var gradientColorStopPropTypeUtil = createPropUtils(
|
|
273
316
|
"gradient-color-stop",
|
|
274
|
-
|
|
275
|
-
);
|
|
276
|
-
|
|
277
|
-
// src/prop-types/key-value.ts
|
|
278
|
-
import { z as z25 } from "@elementor/schema";
|
|
279
|
-
var keyValuePropTypeUtil = createPropUtils(
|
|
280
|
-
"key-value",
|
|
281
|
-
z25.strictObject({
|
|
282
|
-
key: unknownChildrenSchema,
|
|
283
|
-
value: unknownChildrenSchema
|
|
284
|
-
})
|
|
317
|
+
z27.array(colorStopPropTypeUtil.schema)
|
|
285
318
|
);
|
|
286
319
|
|
|
287
320
|
// src/prop-types/position.ts
|
|
288
|
-
import { z as
|
|
321
|
+
import { z as z28 } from "@elementor/schema";
|
|
289
322
|
var positionPropTypeUtil = createPropUtils(
|
|
290
323
|
"object-position",
|
|
291
|
-
|
|
324
|
+
z28.strictObject({
|
|
292
325
|
x: sizePropTypeUtil.schema.nullable(),
|
|
293
326
|
y: sizePropTypeUtil.schema.nullable()
|
|
294
327
|
})
|
|
295
328
|
);
|
|
296
329
|
|
|
297
330
|
// src/prop-types/filter-prop-types/filter.ts
|
|
298
|
-
import { z as
|
|
299
|
-
|
|
300
|
-
// src/prop-types/filter-prop-types/blur-filter.ts
|
|
301
|
-
var blurFilterPropTypeUtil = createPropUtils("blur", unknownChildrenSchema);
|
|
331
|
+
import { z as z30 } from "@elementor/schema";
|
|
302
332
|
|
|
303
|
-
// src/prop-types/filter-prop-types/
|
|
304
|
-
|
|
333
|
+
// src/prop-types/filter-prop-types/drop-shadow-filter.ts
|
|
334
|
+
import { z as z29 } from "@elementor/schema";
|
|
335
|
+
var dropShadowFilterPropTypeUtil = createPropUtils(
|
|
336
|
+
"drop-shadow",
|
|
337
|
+
z29.object({
|
|
338
|
+
xAxis: sizePropTypeUtil.schema,
|
|
339
|
+
yAxis: sizePropTypeUtil.schema,
|
|
340
|
+
blur: sizePropTypeUtil.schema,
|
|
341
|
+
color: unknownChildrenSchema
|
|
342
|
+
})
|
|
343
|
+
);
|
|
305
344
|
|
|
306
345
|
// src/prop-types/filter-prop-types/filter.ts
|
|
307
|
-
var
|
|
308
|
-
|
|
346
|
+
var cssFilterFunctionPropUtil = createPropUtils(
|
|
347
|
+
"css-filter-func",
|
|
348
|
+
z30.object({
|
|
349
|
+
func: stringPropTypeUtil.schema,
|
|
350
|
+
args: z30.union([sizePropTypeUtil.schema, dropShadowFilterPropTypeUtil.schema])
|
|
351
|
+
})
|
|
352
|
+
);
|
|
353
|
+
var filterPropTypeUtil = createPropUtils("filter", z30.array(cssFilterFunctionPropUtil.schema));
|
|
309
354
|
|
|
310
355
|
// src/prop-types/transform-prop-types/transform.ts
|
|
311
|
-
import { z as
|
|
356
|
+
import { z as z35 } from "@elementor/schema";
|
|
357
|
+
|
|
358
|
+
// src/prop-types/transform-prop-types/move-transform.ts
|
|
359
|
+
import { z as z31 } from "@elementor/schema";
|
|
360
|
+
|
|
361
|
+
// src/prop-types/transform-prop-types/types.ts
|
|
362
|
+
var TransformFunctionKeys = {
|
|
363
|
+
move: "transform-move",
|
|
364
|
+
scale: "transform-scale",
|
|
365
|
+
rotate: "transform-rotate",
|
|
366
|
+
skew: "transform-skew"
|
|
367
|
+
};
|
|
312
368
|
|
|
313
369
|
// src/prop-types/transform-prop-types/move-transform.ts
|
|
314
|
-
import { z as z28 } from "@elementor/schema";
|
|
315
370
|
var moveTransformPropTypeUtil = createPropUtils(
|
|
316
|
-
|
|
317
|
-
|
|
371
|
+
TransformFunctionKeys.move,
|
|
372
|
+
z31.strictObject({
|
|
318
373
|
x: sizePropTypeUtil.schema.nullable(),
|
|
319
374
|
y: sizePropTypeUtil.schema.nullable(),
|
|
320
375
|
z: sizePropTypeUtil.schema.nullable()
|
|
321
376
|
})
|
|
322
377
|
);
|
|
323
378
|
|
|
324
|
-
// src/prop-types/transform-prop-types/
|
|
325
|
-
import { z as
|
|
326
|
-
var
|
|
327
|
-
|
|
328
|
-
|
|
379
|
+
// src/prop-types/transform-prop-types/rotate-transform.ts
|
|
380
|
+
import { z as z32 } from "@elementor/schema";
|
|
381
|
+
var rotateTransformPropTypeUtil = createPropUtils(
|
|
382
|
+
TransformFunctionKeys.rotate,
|
|
383
|
+
z32.strictObject({
|
|
329
384
|
x: sizePropTypeUtil.schema.nullable(),
|
|
330
385
|
y: sizePropTypeUtil.schema.nullable(),
|
|
331
386
|
z: sizePropTypeUtil.schema.nullable()
|
|
332
387
|
})
|
|
333
388
|
);
|
|
334
389
|
|
|
390
|
+
// src/prop-types/transform-prop-types/scale-transform.ts
|
|
391
|
+
import { z as z33 } from "@elementor/schema";
|
|
392
|
+
var scaleTransformPropTypeUtil = createPropUtils(
|
|
393
|
+
TransformFunctionKeys.scale,
|
|
394
|
+
z33.strictObject({
|
|
395
|
+
x: numberPropTypeUtil.schema.nullable(),
|
|
396
|
+
y: numberPropTypeUtil.schema.nullable(),
|
|
397
|
+
z: numberPropTypeUtil.schema.nullable()
|
|
398
|
+
})
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
// src/prop-types/transform-prop-types/skew-transform.ts
|
|
402
|
+
import { z as z34 } from "@elementor/schema";
|
|
403
|
+
var skewTransformPropTypeUtil = createPropUtils(
|
|
404
|
+
TransformFunctionKeys.skew,
|
|
405
|
+
z34.strictObject({
|
|
406
|
+
x: sizePropTypeUtil.schema.nullable(),
|
|
407
|
+
y: sizePropTypeUtil.schema.nullable()
|
|
408
|
+
})
|
|
409
|
+
);
|
|
410
|
+
|
|
335
411
|
// src/prop-types/transform-prop-types/transform.ts
|
|
336
|
-
var
|
|
337
|
-
|
|
412
|
+
var filterTypes = z35.union([
|
|
413
|
+
moveTransformPropTypeUtil.schema,
|
|
414
|
+
scaleTransformPropTypeUtil.schema,
|
|
415
|
+
rotateTransformPropTypeUtil.schema,
|
|
416
|
+
skewTransformPropTypeUtil.schema
|
|
417
|
+
]);
|
|
418
|
+
var transformPropTypeUtil = createPropUtils("transform", z35.array(filterTypes));
|
|
419
|
+
|
|
420
|
+
// src/prop-types/filter-prop-types/backdrop-filter.ts
|
|
421
|
+
import { z as z36 } from "@elementor/schema";
|
|
422
|
+
var backdropFilterPropTypeUtil = createPropUtils(
|
|
423
|
+
"backdrop-filter",
|
|
424
|
+
z36.array(cssFilterFunctionPropUtil.schema)
|
|
425
|
+
);
|
|
338
426
|
|
|
339
427
|
// src/utils/merge-props.ts
|
|
340
428
|
function mergeProps(current, updates) {
|
|
@@ -349,14 +437,26 @@ function mergeProps(current, updates) {
|
|
|
349
437
|
return props;
|
|
350
438
|
}
|
|
351
439
|
|
|
440
|
+
// src/utils/is-transformable.ts
|
|
441
|
+
import { z as z37 } from "@elementor/schema";
|
|
442
|
+
var transformableSchema = z37.object({
|
|
443
|
+
$$type: z37.string(),
|
|
444
|
+
value: z37.any(),
|
|
445
|
+
disabled: z37.boolean().optional()
|
|
446
|
+
});
|
|
447
|
+
var isTransformable = (value) => {
|
|
448
|
+
return transformableSchema.safeParse(value).success;
|
|
449
|
+
};
|
|
450
|
+
|
|
352
451
|
// src/utils/prop-dependency-utils.ts
|
|
353
|
-
function
|
|
354
|
-
if (!terms.length) {
|
|
355
|
-
return
|
|
452
|
+
function isDependencyMet(dependency, values) {
|
|
453
|
+
if (!dependency?.terms.length) {
|
|
454
|
+
return true;
|
|
356
455
|
}
|
|
456
|
+
const { relation, terms } = dependency;
|
|
357
457
|
const method = getRelationMethod(relation);
|
|
358
458
|
return terms[method](
|
|
359
|
-
(term) => isDependency(term) ?
|
|
459
|
+
(term) => isDependency(term) ? isDependencyMet(term, values) : evaluateTerm(term, extractValue(term.path, values)?.value)
|
|
360
460
|
);
|
|
361
461
|
}
|
|
362
462
|
function evaluateTerm(term, actualValue) {
|
|
@@ -367,28 +467,26 @@ function evaluateTerm(term, actualValue) {
|
|
|
367
467
|
return actualValue === valueToCompare === ("eq" === operator);
|
|
368
468
|
case "gt":
|
|
369
469
|
case "lte":
|
|
370
|
-
if (
|
|
371
|
-
|
|
470
|
+
if (!isNumber(actualValue) || !isNumber(valueToCompare)) {
|
|
471
|
+
return false;
|
|
372
472
|
}
|
|
373
473
|
return Number(actualValue) > Number(valueToCompare) === ("gt" === operator);
|
|
374
474
|
case "lt":
|
|
375
475
|
case "gte":
|
|
376
|
-
if (
|
|
377
|
-
|
|
476
|
+
if (!isNumber(actualValue) || !isNumber(valueToCompare)) {
|
|
477
|
+
return false;
|
|
378
478
|
}
|
|
379
479
|
return Number(actualValue) < Number(valueToCompare) === ("lt" === operator);
|
|
380
480
|
case "in":
|
|
381
481
|
case "nin":
|
|
382
482
|
if (!Array.isArray(valueToCompare)) {
|
|
383
|
-
|
|
483
|
+
return false;
|
|
384
484
|
}
|
|
385
485
|
return valueToCompare.includes(actualValue) === ("in" === operator);
|
|
386
486
|
case "contains":
|
|
387
487
|
case "ncontains":
|
|
388
488
|
if (("string" !== typeof actualValue || "string" !== typeof valueToCompare) && !Array.isArray(actualValue)) {
|
|
389
|
-
|
|
390
|
-
'The "contains" and "ncontains" operators require a string or an array for comparison.'
|
|
391
|
-
);
|
|
489
|
+
return false;
|
|
392
490
|
}
|
|
393
491
|
return "contains" === operator === actualValue.includes(valueToCompare);
|
|
394
492
|
case "exists":
|
|
@@ -396,9 +494,12 @@ function evaluateTerm(term, actualValue) {
|
|
|
396
494
|
const evaluation = !!actualValue || 0 === actualValue || false === actualValue;
|
|
397
495
|
return "exists" === operator === evaluation;
|
|
398
496
|
default:
|
|
399
|
-
return
|
|
497
|
+
return true;
|
|
400
498
|
}
|
|
401
499
|
}
|
|
500
|
+
function isNumber(value) {
|
|
501
|
+
return typeof value === "number" && !isNaN(value);
|
|
502
|
+
}
|
|
402
503
|
function getRelationMethod(relation) {
|
|
403
504
|
switch (relation) {
|
|
404
505
|
case "or":
|
|
@@ -409,26 +510,16 @@ function getRelationMethod(relation) {
|
|
|
409
510
|
throw new Error(`Relation not supported ${relation}`);
|
|
410
511
|
}
|
|
411
512
|
}
|
|
412
|
-
function
|
|
413
|
-
return path.reduce((acc, key) => {
|
|
414
|
-
|
|
513
|
+
function extractValue(path, elementValues) {
|
|
514
|
+
return path.reduce((acc, key, index) => {
|
|
515
|
+
const value = acc?.[key];
|
|
516
|
+
return index !== path.length - 1 && isTransformable(value) ? value.value ?? null : value;
|
|
415
517
|
}, elementValues);
|
|
416
518
|
}
|
|
417
519
|
function isDependency(term) {
|
|
418
520
|
return "relation" in term;
|
|
419
521
|
}
|
|
420
522
|
|
|
421
|
-
// src/utils/is-transformable.ts
|
|
422
|
-
import { z as z31 } from "@elementor/schema";
|
|
423
|
-
var transformableSchema = z31.object({
|
|
424
|
-
$$type: z31.string(),
|
|
425
|
-
value: z31.any(),
|
|
426
|
-
disabled: z31.boolean().optional()
|
|
427
|
-
});
|
|
428
|
-
var isTransformable = (value) => {
|
|
429
|
-
return transformableSchema.safeParse(value).success;
|
|
430
|
-
};
|
|
431
|
-
|
|
432
523
|
// src/utils/filter-empty-values.ts
|
|
433
524
|
var filterEmptyValues = (value) => {
|
|
434
525
|
if (isEmpty(value)) {
|
|
@@ -457,6 +548,7 @@ var isNullishObject = (value) => {
|
|
|
457
548
|
};
|
|
458
549
|
export {
|
|
459
550
|
CLASSES_PROP_KEY,
|
|
551
|
+
backdropFilterPropTypeUtil,
|
|
460
552
|
backgroundColorOverlayPropTypeUtil,
|
|
461
553
|
backgroundGradientOverlayPropTypeUtil,
|
|
462
554
|
backgroundImageOverlayPropTypeUtil,
|
|
@@ -464,25 +556,29 @@ export {
|
|
|
464
556
|
backgroundImageSizeScalePropTypeUtil,
|
|
465
557
|
backgroundOverlayPropTypeUtil,
|
|
466
558
|
backgroundPropTypeUtil,
|
|
467
|
-
blurFilterPropTypeUtil,
|
|
468
559
|
booleanPropTypeUtil,
|
|
469
560
|
borderRadiusPropTypeUtil,
|
|
470
561
|
borderWidthPropTypeUtil,
|
|
471
562
|
boxShadowPropTypeUtil,
|
|
472
|
-
brightnessFilterPropTypeUtil,
|
|
473
563
|
classesPropTypeUtil,
|
|
474
564
|
colorPropTypeUtil,
|
|
475
565
|
colorStopPropTypeUtil,
|
|
476
566
|
createArrayPropUtils,
|
|
477
567
|
createPropUtils,
|
|
568
|
+
cssFilterFunctionPropUtil,
|
|
478
569
|
dimensionsPropTypeUtil,
|
|
570
|
+
dropShadowFilterPropTypeUtil,
|
|
479
571
|
evaluateTerm,
|
|
572
|
+
extractValue,
|
|
480
573
|
filterEmptyValues,
|
|
481
574
|
filterPropTypeUtil,
|
|
575
|
+
flexPropTypeUtil,
|
|
482
576
|
gradientColorStopPropTypeUtil,
|
|
483
577
|
imageAttachmentIdPropType,
|
|
484
578
|
imagePropTypeUtil,
|
|
485
579
|
imageSrcPropTypeUtil,
|
|
580
|
+
isDependency,
|
|
581
|
+
isDependencyMet,
|
|
486
582
|
isEmpty,
|
|
487
583
|
isTransformable,
|
|
488
584
|
keyValuePropTypeUtil,
|
|
@@ -492,9 +588,12 @@ export {
|
|
|
492
588
|
moveTransformPropTypeUtil,
|
|
493
589
|
numberPropTypeUtil,
|
|
494
590
|
positionPropTypeUtil,
|
|
591
|
+
rotateTransformPropTypeUtil,
|
|
592
|
+
scaleTransformPropTypeUtil,
|
|
593
|
+
selectionSizePropTypeUtil,
|
|
495
594
|
shadowPropTypeUtil,
|
|
496
|
-
shouldApplyEffect,
|
|
497
595
|
sizePropTypeUtil,
|
|
596
|
+
skewTransformPropTypeUtil,
|
|
498
597
|
stringPropTypeUtil,
|
|
499
598
|
strokePropTypeUtil,
|
|
500
599
|
transformPropTypeUtil,
|