@elementor/editor-props 4.0.0-552 → 4.0.0-573
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.d.mts +324 -24
- package/dist/index.d.ts +324 -24
- package/dist/index.js +145 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/prop-types/email.ts +22 -0
- package/src/prop-types/html-v2.ts +30 -0
- package/src/prop-types/index.ts +2 -0
- package/src/prop-types/string-array.ts +4 -3
- package/src/types.ts +1 -0
- package/src/utils/parse-html-children.ts +82 -0
- package/src/utils/prop-dependency-utils.ts +5 -1
package/dist/index.mjs
CHANGED
|
@@ -205,44 +205,61 @@ import { z as z16 } from "@elementor/schema";
|
|
|
205
205
|
var stringPropTypeUtil = createPropUtils("string", z16.string().nullable());
|
|
206
206
|
|
|
207
207
|
// src/prop-types/string-array.ts
|
|
208
|
-
|
|
209
|
-
var stringArrayPropTypeUtil = createPropUtils("string-array", z17.array(z17.string()));
|
|
208
|
+
var stringArrayPropTypeUtil = createArrayPropUtils(stringPropTypeUtil.key, stringPropTypeUtil.schema);
|
|
210
209
|
|
|
211
210
|
// src/prop-types/stroke.ts
|
|
212
|
-
import { z as
|
|
211
|
+
import { z as z17 } from "@elementor/schema";
|
|
213
212
|
var strokePropTypeUtil = createPropUtils(
|
|
214
213
|
"stroke",
|
|
215
|
-
|
|
214
|
+
z17.strictObject({
|
|
216
215
|
color: unknownChildrenSchema,
|
|
217
216
|
width: unknownChildrenSchema
|
|
218
217
|
})
|
|
219
218
|
);
|
|
220
219
|
|
|
221
220
|
// src/prop-types/url.ts
|
|
222
|
-
import { z as
|
|
223
|
-
var urlPropTypeUtil = createPropUtils("url",
|
|
221
|
+
import { z as z18 } from "@elementor/schema";
|
|
222
|
+
var urlPropTypeUtil = createPropUtils("url", z18.string().nullable());
|
|
224
223
|
|
|
225
224
|
// src/prop-types/layout-direction.ts
|
|
226
|
-
import { z as
|
|
225
|
+
import { z as z19 } from "@elementor/schema";
|
|
227
226
|
var layoutDirectionPropTypeUtil = createPropUtils(
|
|
228
227
|
"layout-direction",
|
|
229
|
-
|
|
230
|
-
row:
|
|
231
|
-
column:
|
|
228
|
+
z19.object({
|
|
229
|
+
row: z19.any(),
|
|
230
|
+
column: z19.any()
|
|
232
231
|
})
|
|
233
232
|
);
|
|
234
233
|
|
|
235
234
|
// src/prop-types/link.ts
|
|
236
|
-
import { z as
|
|
235
|
+
import { z as z20 } from "@elementor/schema";
|
|
237
236
|
var linkPropTypeUtil = createPropUtils(
|
|
238
237
|
"link",
|
|
239
|
-
|
|
238
|
+
z20.strictObject({
|
|
240
239
|
destination: unknownChildrenSchema,
|
|
241
240
|
isTargetBlank: unknownChildrenSchema,
|
|
242
241
|
tag: unknownChildrenSchema
|
|
243
242
|
})
|
|
244
243
|
);
|
|
245
244
|
|
|
245
|
+
// src/prop-types/email.ts
|
|
246
|
+
import { z as z21 } from "@elementor/schema";
|
|
247
|
+
var emailPropTypeUtil = createPropUtils(
|
|
248
|
+
"email",
|
|
249
|
+
z21.strictObject({
|
|
250
|
+
to: unknownChildrenSchema,
|
|
251
|
+
subject: unknownChildrenSchema,
|
|
252
|
+
message: unknownChildrenSchema,
|
|
253
|
+
from: unknownChildrenSchema,
|
|
254
|
+
"meta-data": unknownChildrenSchema,
|
|
255
|
+
"send-as": unknownChildrenSchema,
|
|
256
|
+
"from-name": unknownChildrenSchema,
|
|
257
|
+
"reply-to": unknownChildrenSchema,
|
|
258
|
+
cc: unknownChildrenSchema,
|
|
259
|
+
bcc: unknownChildrenSchema
|
|
260
|
+
})
|
|
261
|
+
);
|
|
262
|
+
|
|
246
263
|
// src/prop-types/selection-size.ts
|
|
247
264
|
import { z as z23 } from "@elementor/schema";
|
|
248
265
|
|
|
@@ -362,14 +379,30 @@ var queryPropTypeUtil = createPropUtils(
|
|
|
362
379
|
import { z as z32 } from "@elementor/schema";
|
|
363
380
|
var htmlPropTypeUtil = createPropUtils("html", z32.string().nullable());
|
|
364
381
|
|
|
382
|
+
// src/prop-types/html-v2.ts
|
|
383
|
+
import { z as z33 } from "@elementor/schema";
|
|
384
|
+
var childElementSchema = z33.lazy(
|
|
385
|
+
() => z33.object({
|
|
386
|
+
id: z33.string(),
|
|
387
|
+
type: z33.string(),
|
|
388
|
+
content: z33.string().optional(),
|
|
389
|
+
children: z33.array(childElementSchema).optional()
|
|
390
|
+
})
|
|
391
|
+
);
|
|
392
|
+
var htmlV2ValueSchema = z33.object({
|
|
393
|
+
content: z33.string().nullable(),
|
|
394
|
+
children: z33.array(childElementSchema)
|
|
395
|
+
});
|
|
396
|
+
var htmlV2PropTypeUtil = createPropUtils("html-v2", htmlV2ValueSchema);
|
|
397
|
+
|
|
365
398
|
// src/prop-types/filter-prop-types/filter.ts
|
|
366
|
-
import { z as
|
|
399
|
+
import { z as z39 } from "@elementor/schema";
|
|
367
400
|
|
|
368
401
|
// src/prop-types/filter-prop-types/drop-shadow-filter.ts
|
|
369
|
-
import { z as
|
|
402
|
+
import { z as z34 } from "@elementor/schema";
|
|
370
403
|
var dropShadowFilterPropTypeUtil = createPropUtils(
|
|
371
404
|
"drop-shadow",
|
|
372
|
-
|
|
405
|
+
z34.object({
|
|
373
406
|
xAxis: unknownChildrenSchema,
|
|
374
407
|
yAxis: unknownChildrenSchema,
|
|
375
408
|
blur: unknownChildrenSchema,
|
|
@@ -378,37 +411,37 @@ var dropShadowFilterPropTypeUtil = createPropUtils(
|
|
|
378
411
|
);
|
|
379
412
|
|
|
380
413
|
// src/prop-types/filter-prop-types/filter-functions/blur-filter.ts
|
|
381
|
-
import { z as
|
|
414
|
+
import { z as z35 } from "@elementor/schema";
|
|
382
415
|
var blurFilterPropTypeUtil = createPropUtils(
|
|
383
416
|
"blur",
|
|
384
|
-
|
|
417
|
+
z35.strictObject({
|
|
385
418
|
size: unknownChildrenSchema
|
|
386
419
|
})
|
|
387
420
|
);
|
|
388
421
|
|
|
389
422
|
// src/prop-types/filter-prop-types/filter-functions/color-tone-filter.ts
|
|
390
|
-
import { z as
|
|
423
|
+
import { z as z36 } from "@elementor/schema";
|
|
391
424
|
var colorToneFilterPropTypeUtil = createPropUtils(
|
|
392
425
|
"color-tone",
|
|
393
|
-
|
|
426
|
+
z36.strictObject({
|
|
394
427
|
size: unknownChildrenSchema
|
|
395
428
|
})
|
|
396
429
|
);
|
|
397
430
|
|
|
398
431
|
// src/prop-types/filter-prop-types/filter-functions/hue-rotate-filter.ts
|
|
399
|
-
import { z as
|
|
432
|
+
import { z as z37 } from "@elementor/schema";
|
|
400
433
|
var hueRotateFilterPropTypeUtil = createPropUtils(
|
|
401
434
|
"hue-rotate",
|
|
402
|
-
|
|
435
|
+
z37.strictObject({
|
|
403
436
|
size: unknownChildrenSchema
|
|
404
437
|
})
|
|
405
438
|
);
|
|
406
439
|
|
|
407
440
|
// src/prop-types/filter-prop-types/filter-functions/intensity-filter.ts
|
|
408
|
-
import { z as
|
|
441
|
+
import { z as z38 } from "@elementor/schema";
|
|
409
442
|
var intensityFilterPropTypeUtil = createPropUtils(
|
|
410
443
|
"intensity",
|
|
411
|
-
|
|
444
|
+
z38.strictObject({
|
|
412
445
|
size: unknownChildrenSchema
|
|
413
446
|
})
|
|
414
447
|
);
|
|
@@ -416,9 +449,9 @@ var intensityFilterPropTypeUtil = createPropUtils(
|
|
|
416
449
|
// src/prop-types/filter-prop-types/filter.ts
|
|
417
450
|
var cssFilterFunctionPropUtil = createPropUtils(
|
|
418
451
|
"css-filter-func",
|
|
419
|
-
|
|
452
|
+
z39.object({
|
|
420
453
|
func: stringPropTypeUtil.schema,
|
|
421
|
-
args:
|
|
454
|
+
args: z39.union([
|
|
422
455
|
blurFilterPropTypeUtil.schema,
|
|
423
456
|
intensityFilterPropTypeUtil.schema,
|
|
424
457
|
colorToneFilterPropTypeUtil.schema,
|
|
@@ -427,13 +460,13 @@ var cssFilterFunctionPropUtil = createPropUtils(
|
|
|
427
460
|
])
|
|
428
461
|
})
|
|
429
462
|
);
|
|
430
|
-
var filterPropTypeUtil = createPropUtils("filter",
|
|
463
|
+
var filterPropTypeUtil = createPropUtils("filter", z39.array(cssFilterFunctionPropUtil.schema));
|
|
431
464
|
|
|
432
465
|
// src/prop-types/transform-prop-types/transform.ts
|
|
433
|
-
import { z as
|
|
466
|
+
import { z as z40 } from "@elementor/schema";
|
|
434
467
|
var transformPropTypeUtil = createPropUtils(
|
|
435
468
|
"transform",
|
|
436
|
-
|
|
469
|
+
z40.strictObject({
|
|
437
470
|
"transform-functions": unknownChildrenSchema,
|
|
438
471
|
"transform-origin": unknownChildrenSchema,
|
|
439
472
|
perspective: unknownChildrenSchema,
|
|
@@ -442,10 +475,10 @@ var transformPropTypeUtil = createPropUtils(
|
|
|
442
475
|
);
|
|
443
476
|
|
|
444
477
|
// src/prop-types/transform-prop-types/transform-functions.ts
|
|
445
|
-
import { z as
|
|
478
|
+
import { z as z45 } from "@elementor/schema";
|
|
446
479
|
|
|
447
480
|
// src/prop-types/transform-prop-types/transform-functions/move-transform.ts
|
|
448
|
-
import { z as
|
|
481
|
+
import { z as z41 } from "@elementor/schema";
|
|
449
482
|
|
|
450
483
|
// src/prop-types/transform-prop-types/types.ts
|
|
451
484
|
var TransformFunctionKeys = {
|
|
@@ -458,7 +491,7 @@ var TransformFunctionKeys = {
|
|
|
458
491
|
// src/prop-types/transform-prop-types/transform-functions/move-transform.ts
|
|
459
492
|
var moveTransformPropTypeUtil = createPropUtils(
|
|
460
493
|
TransformFunctionKeys.move,
|
|
461
|
-
|
|
494
|
+
z41.strictObject({
|
|
462
495
|
x: unknownChildrenSchema,
|
|
463
496
|
y: unknownChildrenSchema,
|
|
464
497
|
z: unknownChildrenSchema
|
|
@@ -466,10 +499,10 @@ var moveTransformPropTypeUtil = createPropUtils(
|
|
|
466
499
|
);
|
|
467
500
|
|
|
468
501
|
// src/prop-types/transform-prop-types/transform-functions/rotate-transform.ts
|
|
469
|
-
import { z as
|
|
502
|
+
import { z as z42 } from "@elementor/schema";
|
|
470
503
|
var rotateTransformPropTypeUtil = createPropUtils(
|
|
471
504
|
TransformFunctionKeys.rotate,
|
|
472
|
-
|
|
505
|
+
z42.strictObject({
|
|
473
506
|
x: unknownChildrenSchema,
|
|
474
507
|
y: unknownChildrenSchema,
|
|
475
508
|
z: unknownChildrenSchema
|
|
@@ -477,10 +510,10 @@ var rotateTransformPropTypeUtil = createPropUtils(
|
|
|
477
510
|
);
|
|
478
511
|
|
|
479
512
|
// src/prop-types/transform-prop-types/transform-functions/scale-transform.ts
|
|
480
|
-
import { z as
|
|
513
|
+
import { z as z43 } from "@elementor/schema";
|
|
481
514
|
var scaleTransformPropTypeUtil = createPropUtils(
|
|
482
515
|
TransformFunctionKeys.scale,
|
|
483
|
-
|
|
516
|
+
z43.strictObject({
|
|
484
517
|
x: numberPropTypeUtil.schema.nullable(),
|
|
485
518
|
y: numberPropTypeUtil.schema.nullable(),
|
|
486
519
|
z: numberPropTypeUtil.schema.nullable()
|
|
@@ -488,10 +521,10 @@ var scaleTransformPropTypeUtil = createPropUtils(
|
|
|
488
521
|
);
|
|
489
522
|
|
|
490
523
|
// src/prop-types/transform-prop-types/transform-functions/skew-transform.ts
|
|
491
|
-
import { z as
|
|
524
|
+
import { z as z44 } from "@elementor/schema";
|
|
492
525
|
var skewTransformPropTypeUtil = createPropUtils(
|
|
493
526
|
TransformFunctionKeys.skew,
|
|
494
|
-
|
|
527
|
+
z44.strictObject({
|
|
495
528
|
x: unknownChildrenSchema,
|
|
496
529
|
y: unknownChildrenSchema
|
|
497
530
|
})
|
|
@@ -499,13 +532,13 @@ var skewTransformPropTypeUtil = createPropUtils(
|
|
|
499
532
|
|
|
500
533
|
// src/prop-types/transform-prop-types/transform-functions.ts
|
|
501
534
|
var filterTypes = moveTransformPropTypeUtil.schema.or(scaleTransformPropTypeUtil.schema).or(rotateTransformPropTypeUtil.schema).or(skewTransformPropTypeUtil.schema);
|
|
502
|
-
var transformFunctionsPropTypeUtil = createPropUtils("transform-functions",
|
|
535
|
+
var transformFunctionsPropTypeUtil = createPropUtils("transform-functions", z45.array(filterTypes));
|
|
503
536
|
|
|
504
537
|
// src/prop-types/transform-prop-types/transform-origin.ts
|
|
505
|
-
import { z as
|
|
538
|
+
import { z as z46 } from "@elementor/schema";
|
|
506
539
|
var transformOriginPropTypeUtil = createPropUtils(
|
|
507
540
|
"transform-origin",
|
|
508
|
-
|
|
541
|
+
z46.strictObject({
|
|
509
542
|
x: unknownChildrenSchema,
|
|
510
543
|
y: unknownChildrenSchema,
|
|
511
544
|
z: unknownChildrenSchema
|
|
@@ -513,20 +546,20 @@ var transformOriginPropTypeUtil = createPropUtils(
|
|
|
513
546
|
);
|
|
514
547
|
|
|
515
548
|
// src/prop-types/transform-prop-types/perspective-origin.ts
|
|
516
|
-
import { z as
|
|
549
|
+
import { z as z47 } from "@elementor/schema";
|
|
517
550
|
var perspectiveOriginPropTypeUtil = createPropUtils(
|
|
518
551
|
"perspective-origin",
|
|
519
|
-
|
|
552
|
+
z47.strictObject({
|
|
520
553
|
x: unknownChildrenSchema,
|
|
521
554
|
y: unknownChildrenSchema
|
|
522
555
|
})
|
|
523
556
|
);
|
|
524
557
|
|
|
525
558
|
// src/prop-types/filter-prop-types/backdrop-filter.ts
|
|
526
|
-
import { z as
|
|
559
|
+
import { z as z48 } from "@elementor/schema";
|
|
527
560
|
var backdropFilterPropTypeUtil = createPropUtils(
|
|
528
561
|
"backdrop-filter",
|
|
529
|
-
|
|
562
|
+
z48.array(cssFilterFunctionPropUtil.schema)
|
|
530
563
|
);
|
|
531
564
|
|
|
532
565
|
// src/utils/adjust-llm-prop-value-schema.ts
|
|
@@ -941,11 +974,11 @@ var validatePropValue = (schema, value) => {
|
|
|
941
974
|
};
|
|
942
975
|
|
|
943
976
|
// src/utils/is-transformable.ts
|
|
944
|
-
import { z as
|
|
945
|
-
var transformableSchema =
|
|
946
|
-
$$type:
|
|
947
|
-
value:
|
|
948
|
-
disabled:
|
|
977
|
+
import { z as z49 } from "@elementor/schema";
|
|
978
|
+
var transformableSchema = z49.object({
|
|
979
|
+
$$type: z49.string(),
|
|
980
|
+
value: z49.any(),
|
|
981
|
+
disabled: z49.boolean().optional()
|
|
949
982
|
});
|
|
950
983
|
var isTransformable = (value) => {
|
|
951
984
|
return transformableSchema.safeParse(value).success;
|
|
@@ -1041,7 +1074,8 @@ function evaluateTerm(term, actualValue) {
|
|
|
1041
1074
|
if (("string" !== typeof actualValue || "string" !== typeof valueToCompare) && !Array.isArray(actualValue)) {
|
|
1042
1075
|
return false;
|
|
1043
1076
|
}
|
|
1044
|
-
|
|
1077
|
+
const transformedValue = Array.isArray(actualValue) ? actualValue.map((item) => isTransformable(item) ? item.value : item) : actualValue;
|
|
1078
|
+
return "contains" === operator === transformedValue.includes(valueToCompare);
|
|
1045
1079
|
case "exists":
|
|
1046
1080
|
case "not_exist":
|
|
1047
1081
|
const evaluation = !!actualValue || 0 === actualValue || false === actualValue;
|
|
@@ -1084,6 +1118,61 @@ function isDependency(term) {
|
|
|
1084
1118
|
return "terms" in term;
|
|
1085
1119
|
}
|
|
1086
1120
|
|
|
1121
|
+
// src/utils/parse-html-children.ts
|
|
1122
|
+
var INLINE_ELEMENTS = /* @__PURE__ */ new Set(["span", "b", "strong", "i", "em", "u", "a", "del", "sup", "sub", "s"]);
|
|
1123
|
+
function generateElementId() {
|
|
1124
|
+
const timestamp = Date.now().toString(36);
|
|
1125
|
+
const randomPart = Math.random().toString(36).substring(2, 9);
|
|
1126
|
+
return `e-${timestamp}-${randomPart}`;
|
|
1127
|
+
}
|
|
1128
|
+
function traverseChildren(node) {
|
|
1129
|
+
const result = [];
|
|
1130
|
+
for (const child of Array.from(node.children)) {
|
|
1131
|
+
const tagName = child.tagName.toLowerCase();
|
|
1132
|
+
if (!INLINE_ELEMENTS.has(tagName)) {
|
|
1133
|
+
result.push(...traverseChildren(child));
|
|
1134
|
+
continue;
|
|
1135
|
+
}
|
|
1136
|
+
let id = child.getAttribute("id");
|
|
1137
|
+
if (!id) {
|
|
1138
|
+
id = generateElementId();
|
|
1139
|
+
child.setAttribute("id", id);
|
|
1140
|
+
}
|
|
1141
|
+
const childElement = {
|
|
1142
|
+
id,
|
|
1143
|
+
type: tagName
|
|
1144
|
+
};
|
|
1145
|
+
const textContent = child.textContent?.trim();
|
|
1146
|
+
if (textContent) {
|
|
1147
|
+
childElement.content = textContent;
|
|
1148
|
+
}
|
|
1149
|
+
const nestedChildren = traverseChildren(child);
|
|
1150
|
+
if (nestedChildren.length > 0) {
|
|
1151
|
+
childElement.children = nestedChildren;
|
|
1152
|
+
}
|
|
1153
|
+
result.push(childElement);
|
|
1154
|
+
}
|
|
1155
|
+
return result;
|
|
1156
|
+
}
|
|
1157
|
+
function parseHtmlChildren(html) {
|
|
1158
|
+
if (!html) {
|
|
1159
|
+
return { content: html, children: [] };
|
|
1160
|
+
}
|
|
1161
|
+
const parser = new DOMParser();
|
|
1162
|
+
const doc = parser.parseFromString(`<body>${html}</body>`, "text/html");
|
|
1163
|
+
const parserError = doc.querySelector("parsererror");
|
|
1164
|
+
if (parserError) {
|
|
1165
|
+
console.warn("HTML parsing error, returning original content:", parserError.textContent);
|
|
1166
|
+
return { content: html, children: [] };
|
|
1167
|
+
}
|
|
1168
|
+
const body = doc.body;
|
|
1169
|
+
const children = traverseChildren(body);
|
|
1170
|
+
return {
|
|
1171
|
+
content: body.innerHTML,
|
|
1172
|
+
children
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1087
1176
|
// src/index.ts
|
|
1088
1177
|
var Schema = {
|
|
1089
1178
|
jsonSchemaToPropType,
|
|
@@ -1123,6 +1212,7 @@ export {
|
|
|
1123
1212
|
cssFilterFunctionPropUtil,
|
|
1124
1213
|
dimensionsPropTypeUtil,
|
|
1125
1214
|
dropShadowFilterPropTypeUtil,
|
|
1215
|
+
emailPropTypeUtil,
|
|
1126
1216
|
evaluateTerm,
|
|
1127
1217
|
extractValue,
|
|
1128
1218
|
filterEmptyValues,
|
|
@@ -1131,6 +1221,7 @@ export {
|
|
|
1131
1221
|
getPropSchemaFromCache,
|
|
1132
1222
|
gradientColorStopPropTypeUtil,
|
|
1133
1223
|
htmlPropTypeUtil,
|
|
1224
|
+
htmlV2PropTypeUtil,
|
|
1134
1225
|
hueRotateFilterPropTypeUtil,
|
|
1135
1226
|
imageAttachmentIdPropType,
|
|
1136
1227
|
imagePropTypeUtil,
|
|
@@ -1146,6 +1237,7 @@ export {
|
|
|
1146
1237
|
mergeProps,
|
|
1147
1238
|
moveTransformPropTypeUtil,
|
|
1148
1239
|
numberPropTypeUtil,
|
|
1240
|
+
parseHtmlChildren,
|
|
1149
1241
|
perspectiveOriginPropTypeUtil,
|
|
1150
1242
|
positionPropTypeUtil,
|
|
1151
1243
|
queryPropTypeUtil,
|