@elementor/editor-props 3.33.0-99 → 3.35.0-325

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
@@ -3,6 +3,10 @@ import { z as z4 } from "@elementor/schema";
3
3
 
4
4
  // src/utils/create-prop-utils.ts
5
5
  import { z } from "@elementor/schema";
6
+ var SCHEMA_CACHE = /* @__PURE__ */ new Map();
7
+ function getPropSchemaFromCache(key) {
8
+ return SCHEMA_CACHE.get(key);
9
+ }
6
10
  function createPropUtils(key, valueSchema) {
7
11
  const schema = z.strictObject({
8
12
  $$type: z.literal(key),
@@ -37,13 +41,15 @@ function createPropUtils(key, valueSchema) {
37
41
  }
38
42
  return prop.value;
39
43
  }
40
- return {
44
+ const propUtil = {
41
45
  extract,
42
46
  isValid,
43
47
  create,
44
48
  schema,
45
49
  key
46
50
  };
51
+ SCHEMA_CACHE.set(key, propUtil);
52
+ return propUtil;
47
53
  }
48
54
  function createArrayPropUtils(key, valueSchema, overrideKey) {
49
55
  return createPropUtils(overrideKey || `${key}-array`, z.array(valueSchema));
@@ -228,7 +234,6 @@ var linkPropTypeUtil = createPropUtils(
228
234
  "link",
229
235
  z20.strictObject({
230
236
  destination: unknownChildrenSchema,
231
- label: unknownChildrenSchema,
232
237
  isTargetBlank: unknownChildrenSchema
233
238
  })
234
239
  );
@@ -261,6 +266,7 @@ var backgroundPropTypeUtil = createPropUtils(
261
266
  "background",
262
267
  z23.strictObject({
263
268
  color: unknownChildrenSchema,
269
+ clip: unknownChildrenSchema,
264
270
  "background-overlay": unknownChildrenSchema
265
271
  })
266
272
  );
@@ -317,24 +323,48 @@ var gradientColorStopPropTypeUtil = createPropUtils(
317
323
  z27.array(colorStopPropTypeUtil.schema)
318
324
  );
319
325
 
320
- // src/prop-types/position.ts
326
+ // src/prop-types/date-time.ts
321
327
  import { z as z28 } from "@elementor/schema";
328
+ var DateTimePropTypeUtil = createPropUtils(
329
+ "date-time",
330
+ z28.strictObject({
331
+ date: unknownChildrenSchema,
332
+ time: unknownChildrenSchema
333
+ })
334
+ );
335
+
336
+ // src/prop-types/position.ts
337
+ import { z as z29 } from "@elementor/schema";
322
338
  var positionPropTypeUtil = createPropUtils(
323
339
  "object-position",
324
- z28.strictObject({
340
+ z29.strictObject({
325
341
  x: unknownChildrenSchema,
326
342
  y: unknownChildrenSchema
327
343
  })
328
344
  );
329
345
 
346
+ // src/prop-types/query.ts
347
+ import { z as z30 } from "@elementor/schema";
348
+ var queryPropTypeUtil = createPropUtils(
349
+ "query",
350
+ z30.strictObject({
351
+ id: unknownChildrenSchema,
352
+ label: unknownChildrenSchema
353
+ })
354
+ );
355
+
356
+ // src/prop-types/html.ts
357
+ import { z as z31 } from "@elementor/schema";
358
+ var htmlPropTypeUtil = createPropUtils("html", z31.string().nullable());
359
+
330
360
  // src/prop-types/filter-prop-types/filter.ts
331
- import { z as z34 } from "@elementor/schema";
361
+ import { z as z37 } from "@elementor/schema";
332
362
 
333
363
  // src/prop-types/filter-prop-types/drop-shadow-filter.ts
334
- import { z as z29 } from "@elementor/schema";
364
+ import { z as z32 } from "@elementor/schema";
335
365
  var dropShadowFilterPropTypeUtil = createPropUtils(
336
366
  "drop-shadow",
337
- z29.object({
367
+ z32.object({
338
368
  xAxis: unknownChildrenSchema,
339
369
  yAxis: unknownChildrenSchema,
340
370
  blur: unknownChildrenSchema,
@@ -343,37 +373,37 @@ var dropShadowFilterPropTypeUtil = createPropUtils(
343
373
  );
344
374
 
345
375
  // src/prop-types/filter-prop-types/filter-functions/blur-filter.ts
346
- import { z as z30 } from "@elementor/schema";
376
+ import { z as z33 } from "@elementor/schema";
347
377
  var blurFilterPropTypeUtil = createPropUtils(
348
378
  "blur",
349
- z30.strictObject({
379
+ z33.strictObject({
350
380
  size: unknownChildrenSchema
351
381
  })
352
382
  );
353
383
 
354
384
  // src/prop-types/filter-prop-types/filter-functions/color-tone-filter.ts
355
- import { z as z31 } from "@elementor/schema";
385
+ import { z as z34 } from "@elementor/schema";
356
386
  var colorToneFilterPropTypeUtil = createPropUtils(
357
387
  "color-tone",
358
- z31.strictObject({
388
+ z34.strictObject({
359
389
  size: unknownChildrenSchema
360
390
  })
361
391
  );
362
392
 
363
393
  // src/prop-types/filter-prop-types/filter-functions/hue-rotate-filter.ts
364
- import { z as z32 } from "@elementor/schema";
394
+ import { z as z35 } from "@elementor/schema";
365
395
  var hueRotateFilterPropTypeUtil = createPropUtils(
366
396
  "hue-rotate",
367
- z32.strictObject({
397
+ z35.strictObject({
368
398
  size: unknownChildrenSchema
369
399
  })
370
400
  );
371
401
 
372
402
  // src/prop-types/filter-prop-types/filter-functions/intensity-filter.ts
373
- import { z as z33 } from "@elementor/schema";
403
+ import { z as z36 } from "@elementor/schema";
374
404
  var intensityFilterPropTypeUtil = createPropUtils(
375
405
  "intensity",
376
- z33.strictObject({
406
+ z36.strictObject({
377
407
  size: unknownChildrenSchema
378
408
  })
379
409
  );
@@ -381,9 +411,9 @@ var intensityFilterPropTypeUtil = createPropUtils(
381
411
  // src/prop-types/filter-prop-types/filter.ts
382
412
  var cssFilterFunctionPropUtil = createPropUtils(
383
413
  "css-filter-func",
384
- z34.object({
414
+ z37.object({
385
415
  func: stringPropTypeUtil.schema,
386
- args: z34.union([
416
+ args: z37.union([
387
417
  blurFilterPropTypeUtil.schema,
388
418
  intensityFilterPropTypeUtil.schema,
389
419
  colorToneFilterPropTypeUtil.schema,
@@ -392,13 +422,13 @@ var cssFilterFunctionPropUtil = createPropUtils(
392
422
  ])
393
423
  })
394
424
  );
395
- var filterPropTypeUtil = createPropUtils("filter", z34.array(cssFilterFunctionPropUtil.schema));
425
+ var filterPropTypeUtil = createPropUtils("filter", z37.array(cssFilterFunctionPropUtil.schema));
396
426
 
397
427
  // src/prop-types/transform-prop-types/transform.ts
398
- import { z as z35 } from "@elementor/schema";
428
+ import { z as z38 } from "@elementor/schema";
399
429
  var transformPropTypeUtil = createPropUtils(
400
430
  "transform",
401
- z35.strictObject({
431
+ z38.strictObject({
402
432
  "transform-functions": unknownChildrenSchema,
403
433
  "transform-origin": unknownChildrenSchema,
404
434
  perspective: unknownChildrenSchema,
@@ -407,10 +437,10 @@ var transformPropTypeUtil = createPropUtils(
407
437
  );
408
438
 
409
439
  // src/prop-types/transform-prop-types/transform-functions.ts
410
- import { z as z40 } from "@elementor/schema";
440
+ import { z as z43 } from "@elementor/schema";
411
441
 
412
442
  // src/prop-types/transform-prop-types/transform-functions/move-transform.ts
413
- import { z as z36 } from "@elementor/schema";
443
+ import { z as z39 } from "@elementor/schema";
414
444
 
415
445
  // src/prop-types/transform-prop-types/types.ts
416
446
  var TransformFunctionKeys = {
@@ -423,7 +453,7 @@ var TransformFunctionKeys = {
423
453
  // src/prop-types/transform-prop-types/transform-functions/move-transform.ts
424
454
  var moveTransformPropTypeUtil = createPropUtils(
425
455
  TransformFunctionKeys.move,
426
- z36.strictObject({
456
+ z39.strictObject({
427
457
  x: unknownChildrenSchema,
428
458
  y: unknownChildrenSchema,
429
459
  z: unknownChildrenSchema
@@ -431,10 +461,10 @@ var moveTransformPropTypeUtil = createPropUtils(
431
461
  );
432
462
 
433
463
  // src/prop-types/transform-prop-types/transform-functions/rotate-transform.ts
434
- import { z as z37 } from "@elementor/schema";
464
+ import { z as z40 } from "@elementor/schema";
435
465
  var rotateTransformPropTypeUtil = createPropUtils(
436
466
  TransformFunctionKeys.rotate,
437
- z37.strictObject({
467
+ z40.strictObject({
438
468
  x: unknownChildrenSchema,
439
469
  y: unknownChildrenSchema,
440
470
  z: unknownChildrenSchema
@@ -442,10 +472,10 @@ var rotateTransformPropTypeUtil = createPropUtils(
442
472
  );
443
473
 
444
474
  // src/prop-types/transform-prop-types/transform-functions/scale-transform.ts
445
- import { z as z38 } from "@elementor/schema";
475
+ import { z as z41 } from "@elementor/schema";
446
476
  var scaleTransformPropTypeUtil = createPropUtils(
447
477
  TransformFunctionKeys.scale,
448
- z38.strictObject({
478
+ z41.strictObject({
449
479
  x: numberPropTypeUtil.schema.nullable(),
450
480
  y: numberPropTypeUtil.schema.nullable(),
451
481
  z: numberPropTypeUtil.schema.nullable()
@@ -453,10 +483,10 @@ var scaleTransformPropTypeUtil = createPropUtils(
453
483
  );
454
484
 
455
485
  // src/prop-types/transform-prop-types/transform-functions/skew-transform.ts
456
- import { z as z39 } from "@elementor/schema";
486
+ import { z as z42 } from "@elementor/schema";
457
487
  var skewTransformPropTypeUtil = createPropUtils(
458
488
  TransformFunctionKeys.skew,
459
- z39.strictObject({
489
+ z42.strictObject({
460
490
  x: unknownChildrenSchema,
461
491
  y: unknownChildrenSchema
462
492
  })
@@ -464,13 +494,13 @@ var skewTransformPropTypeUtil = createPropUtils(
464
494
 
465
495
  // src/prop-types/transform-prop-types/transform-functions.ts
466
496
  var filterTypes = moveTransformPropTypeUtil.schema.or(scaleTransformPropTypeUtil.schema).or(rotateTransformPropTypeUtil.schema).or(skewTransformPropTypeUtil.schema);
467
- var transformFunctionsPropTypeUtil = createPropUtils("transform-functions", z40.array(filterTypes));
497
+ var transformFunctionsPropTypeUtil = createPropUtils("transform-functions", z43.array(filterTypes));
468
498
 
469
499
  // src/prop-types/transform-prop-types/transform-origin.ts
470
- import { z as z41 } from "@elementor/schema";
500
+ import { z as z44 } from "@elementor/schema";
471
501
  var transformOriginPropTypeUtil = createPropUtils(
472
502
  "transform-origin",
473
- z41.strictObject({
503
+ z44.strictObject({
474
504
  x: unknownChildrenSchema,
475
505
  y: unknownChildrenSchema,
476
506
  z: unknownChildrenSchema
@@ -478,25 +508,345 @@ var transformOriginPropTypeUtil = createPropUtils(
478
508
  );
479
509
 
480
510
  // src/prop-types/transform-prop-types/perspective-origin.ts
481
- import { z as z42 } from "@elementor/schema";
511
+ import { z as z45 } from "@elementor/schema";
482
512
  var perspectiveOriginPropTypeUtil = createPropUtils(
483
513
  "perspective-origin",
484
- z42.strictObject({
514
+ z45.strictObject({
485
515
  x: unknownChildrenSchema,
486
516
  y: unknownChildrenSchema
487
517
  })
488
518
  );
489
519
 
490
520
  // src/prop-types/filter-prop-types/backdrop-filter.ts
491
- import { z as z43 } from "@elementor/schema";
521
+ import { z as z46 } from "@elementor/schema";
492
522
  var backdropFilterPropTypeUtil = createPropUtils(
493
523
  "backdrop-filter",
494
- z43.array(cssFilterFunctionPropUtil.schema)
524
+ z46.array(cssFilterFunctionPropUtil.schema)
495
525
  );
496
526
 
527
+ // src/utils/adjust-llm-prop-value-schema.ts
528
+ var ensureNotNull = (v, fallback) => v === null ? fallback : v;
529
+ var adjustLlmPropValueSchema = (value, forceKey) => {
530
+ const clone = structuredClone(value);
531
+ if (typeof clone === "string") {
532
+ return stringPropTypeUtil.create(clone);
533
+ }
534
+ if (typeof clone === "number") {
535
+ return numberPropTypeUtil.create(clone);
536
+ }
537
+ if (clone && typeof clone === "object") {
538
+ if (Array.isArray(clone)) {
539
+ return clone.map((item) => adjustLlmPropValueSchema(item, forceKey));
540
+ }
541
+ const transformablePropValue = clone;
542
+ if (forceKey) {
543
+ transformablePropValue.$$type = forceKey;
544
+ }
545
+ if (!transformablePropValue.$$type) {
546
+ throw new Error("Missing $$type in property: " + JSON.stringify(transformablePropValue));
547
+ }
548
+ if (!("value" in transformablePropValue)) {
549
+ throw new Error("Missing value property in PropValue: " + JSON.stringify(transformablePropValue));
550
+ }
551
+ switch (transformablePropValue.$$type) {
552
+ case "size": {
553
+ const { value: rawSizePropValue } = transformablePropValue;
554
+ const unit = typeof rawSizePropValue.unit === "string" ? rawSizePropValue.unit : ensureNotNull(stringPropTypeUtil.extract(rawSizePropValue.unit), "px");
555
+ const size = typeof rawSizePropValue.size === "string" || typeof rawSizePropValue.size === "number" ? rawSizePropValue.size : ensureNotNull(
556
+ stringPropTypeUtil.extract(rawSizePropValue.size),
557
+ numberPropTypeUtil.extract(rawSizePropValue.size)
558
+ );
559
+ return {
560
+ $$type: "size",
561
+ value: {
562
+ unit,
563
+ size
564
+ }
565
+ };
566
+ }
567
+ }
568
+ if (typeof transformablePropValue.value === "object") {
569
+ if (Array.isArray(transformablePropValue.value)) {
570
+ transformablePropValue.value = adjustLlmPropValueSchema(
571
+ transformablePropValue.value,
572
+ void 0
573
+ );
574
+ } else {
575
+ const { value: objectValue } = transformablePropValue;
576
+ const clonedObject = clone;
577
+ clonedObject.value = {};
578
+ Object.keys(objectValue).forEach((key) => {
579
+ const childProp = objectValue[key];
580
+ clonedObject.value[key] = adjustLlmPropValueSchema(
581
+ childProp,
582
+ void 0
583
+ );
584
+ });
585
+ }
586
+ }
587
+ }
588
+ return clone;
589
+ };
590
+
591
+ // src/utils/llm-schema-to-props.ts
592
+ function jsonSchemaToPropType(schema, key = schema.key) {
593
+ const meta = {};
594
+ if (schema.description) {
595
+ meta.description = schema.description;
596
+ }
597
+ if (schema.anyOf && Array.isArray(schema.anyOf)) {
598
+ return convertJsonSchemaToUnionPropType(schema, meta);
599
+ }
600
+ if (schema.type === "object" && schema.properties) {
601
+ return convertJsonSchemaToObjectPropType(schema, meta, key);
602
+ }
603
+ if (schema.type === "array" && schema.items) {
604
+ return convertJsonSchemaToArrayPropType(schema, meta, key);
605
+ }
606
+ return convertJsonSchemaToPlainPropType(schema, meta, key);
607
+ }
608
+ function convertJsonSchemaToPlainPropType(schema, meta, key = schema.key) {
609
+ const settings = {};
610
+ let propKey = key || "string";
611
+ if (schema.type === "number") {
612
+ propKey = "number";
613
+ } else if (schema.type === "boolean") {
614
+ propKey = "boolean";
615
+ } else if (schema.type === "string") {
616
+ propKey = "string";
617
+ }
618
+ if (Array.isArray(schema.enum)) {
619
+ settings.enum = schema.enum;
620
+ }
621
+ return {
622
+ kind: "plain",
623
+ key: propKey,
624
+ settings,
625
+ meta
626
+ };
627
+ }
628
+ function convertJsonSchemaToUnionPropType(schema, meta) {
629
+ const propTypes = {};
630
+ if (!schema.anyOf || !Array.isArray(schema.anyOf)) {
631
+ throw new Error("Invalid anyOf schema");
632
+ }
633
+ for (const variantSchema of schema.anyOf) {
634
+ if (variantSchema.type === "object" && variantSchema.properties && variantSchema.properties.$$type && variantSchema.properties.value) {
635
+ const typeProperty = variantSchema.properties.$$type;
636
+ let typeKey;
637
+ if (typeProperty.enum && Array.isArray(typeProperty.enum) && typeProperty.enum.length > 0) {
638
+ typeKey = typeProperty.enum[0];
639
+ } else {
640
+ continue;
641
+ }
642
+ const valuePropType = convertJsonSchemaToPropType(variantSchema.properties.value);
643
+ propTypes[typeKey] = valuePropType;
644
+ }
645
+ }
646
+ return {
647
+ kind: "union",
648
+ prop_types: propTypes,
649
+ settings: {},
650
+ meta
651
+ };
652
+ }
653
+ function convertJsonSchemaToObjectPropType(schema, meta, key = schema.key) {
654
+ const shape = {};
655
+ if (!schema.properties) {
656
+ return {
657
+ kind: "object",
658
+ key,
659
+ shape: {},
660
+ settings: {},
661
+ meta
662
+ };
663
+ }
664
+ const requiredFields = Array.isArray(schema.required) ? schema.required : [];
665
+ for (const [propKey, propSchema] of Object.entries(schema.properties)) {
666
+ const subPropType = convertJsonSchemaToPropType(propSchema, key);
667
+ if (requiredFields.includes(propKey)) {
668
+ subPropType.settings = {
669
+ ...subPropType.settings,
670
+ required: true
671
+ };
672
+ }
673
+ shape[propKey] = subPropType;
674
+ }
675
+ return {
676
+ kind: "object",
677
+ key: key || "object",
678
+ shape,
679
+ settings: {},
680
+ meta
681
+ };
682
+ }
683
+ function convertJsonSchemaToArrayPropType(schema, meta, key = schema.key) {
684
+ if (!schema.items) {
685
+ throw new Error("Array schema must have items property");
686
+ }
687
+ const itemPropType = convertJsonSchemaToPropType(schema.items);
688
+ return {
689
+ kind: "array",
690
+ key: key || "array",
691
+ item_prop_type: itemPropType,
692
+ settings: {},
693
+ meta
694
+ };
695
+ }
696
+ function convertJsonSchemaToPropType(schema, key) {
697
+ return jsonSchemaToPropType(schema, key);
698
+ }
699
+
700
+ // src/utils/props-to-llm-schema.ts
701
+ function propTypeToJsonSchema(propType) {
702
+ const description = propType.meta?.description;
703
+ const schema = {};
704
+ if (description) {
705
+ schema.description = description;
706
+ }
707
+ switch (propType.kind) {
708
+ case "plain":
709
+ return convertPlainPropType(propType, schema);
710
+ case "union":
711
+ return convertUnionPropType(propType, schema);
712
+ case "object":
713
+ return convertObjectPropType(propType, schema);
714
+ case "array":
715
+ return convertArrayPropType(propType, schema);
716
+ default:
717
+ return convertPlainPropType(propType, schema);
718
+ }
719
+ return schema;
720
+ }
721
+ function convertPlainPropType(propType, baseSchema) {
722
+ const schema = { ...baseSchema };
723
+ const key = propType.key.toLowerCase();
724
+ switch (key) {
725
+ case "number":
726
+ schema.type = "number";
727
+ break;
728
+ case "boolean":
729
+ schema.type = "boolean";
730
+ break;
731
+ default:
732
+ schema.type = "string";
733
+ }
734
+ if (Array.isArray(propType.settings?.enum)) {
735
+ schema.enum = propType.settings.enum;
736
+ }
737
+ return schema;
738
+ }
739
+ function convertUnionPropType(propType, baseSchema) {
740
+ const schema = structuredClone(baseSchema);
741
+ const propTypes = propType.prop_types || {};
742
+ const schemas = [];
743
+ for (const [typeKey, subPropType] of Object.entries(propTypes)) {
744
+ const subSchema = convertPropTypeToJsonSchema(subPropType);
745
+ schemas.push({
746
+ type: "object",
747
+ required: ["$$type", "value"],
748
+ properties: {
749
+ $$type: {
750
+ type: "string",
751
+ const: typeKey,
752
+ description: subPropType.meta?.description,
753
+ $comment: `Discriminator for union type variant: ${typeKey}`
754
+ },
755
+ value: subSchema
756
+ }
757
+ });
758
+ }
759
+ if (schemas.length > 0) {
760
+ schema.anyOf = schemas;
761
+ }
762
+ const propTypeDescription = propType.meta?.description;
763
+ if (propTypeDescription) {
764
+ schema.description = propTypeDescription;
765
+ }
766
+ return schema;
767
+ }
768
+ function convertObjectPropType(propType, baseSchema) {
769
+ const schema = structuredClone(baseSchema);
770
+ schema.type = "object";
771
+ schema.properties = {};
772
+ const required = [];
773
+ const shape = propType.shape || {};
774
+ for (const [key, subPropType] of Object.entries(shape)) {
775
+ const propSchema = convertPropTypeToJsonSchema(subPropType);
776
+ if (subPropType.settings?.required === true) {
777
+ required.push(key);
778
+ }
779
+ schema.properties[key] = propSchema;
780
+ }
781
+ if (required.length > 0) {
782
+ schema.required = required;
783
+ }
784
+ return schema;
785
+ }
786
+ function convertArrayPropType(propType, baseSchema) {
787
+ const schema = structuredClone(baseSchema);
788
+ schema.type = "array";
789
+ const itemPropType = propType.item_prop_type;
790
+ if (itemPropType) {
791
+ schema.items = convertPropTypeToJsonSchema(itemPropType);
792
+ }
793
+ return schema;
794
+ }
795
+ function convertPropTypeToJsonSchema(propType) {
796
+ return propTypeToJsonSchema(propType);
797
+ }
798
+ var nonConfigurablePropKeys = ["_cssid", "classes", "attributes"];
799
+ function isPropKeyConfigurable(propKey) {
800
+ return !nonConfigurablePropKeys.includes(propKey);
801
+ }
802
+ function configurableKeys(schema) {
803
+ return Object.keys(schema).filter(isPropKeyConfigurable);
804
+ }
805
+
806
+ // src/utils/is-transformable.ts
807
+ import { z as z47 } from "@elementor/schema";
808
+ var transformableSchema = z47.object({
809
+ $$type: z47.string(),
810
+ value: z47.any(),
811
+ disabled: z47.boolean().optional()
812
+ });
813
+ var isTransformable = (value) => {
814
+ return transformableSchema.safeParse(value).success;
815
+ };
816
+
817
+ // src/utils/filter-empty-values.ts
818
+ var filterEmptyValues = (value) => {
819
+ if (isEmpty(value)) {
820
+ return null;
821
+ }
822
+ if (Array.isArray(value)) {
823
+ return value.map(filterEmptyValues).filter((item) => !isEmpty(item));
824
+ }
825
+ if (typeof value === "object") {
826
+ return Object.fromEntries(
827
+ Object.entries(value).map(([key, val]) => [key, filterEmptyValues(val)]).filter(([, val]) => !isEmpty(val))
828
+ );
829
+ }
830
+ return value;
831
+ };
832
+ var isEmpty = (value) => {
833
+ if (value && isTransformable(value)) {
834
+ return isEmpty(value.value);
835
+ }
836
+ return isNullish(value) || isNullishArray(value) || isNullishObject(value);
837
+ };
838
+ var isNullish = (value) => value === null || value === void 0 || value === "";
839
+ var isNullishArray = (value) => Array.isArray(value) && value.every(isEmpty);
840
+ var isNullishObject = (value) => {
841
+ return typeof value === "object" && isNullishArray(Object.values(value));
842
+ };
843
+
497
844
  // src/utils/merge-props.ts
498
845
  function mergeProps(current, updates) {
499
- const props = structuredClone(current);
846
+ let props = {};
847
+ if (!Array.isArray(current)) {
848
+ props = structuredClone(current);
849
+ }
500
850
  Object.entries(updates).forEach(([key, value]) => {
501
851
  if (value === null || value === void 0) {
502
852
  delete props[key];
@@ -507,27 +857,23 @@ function mergeProps(current, updates) {
507
857
  return props;
508
858
  }
509
859
 
510
- // src/utils/is-transformable.ts
511
- import { z as z44 } from "@elementor/schema";
512
- var transformableSchema = z44.object({
513
- $$type: z44.string(),
514
- value: z44.any(),
515
- disabled: z44.boolean().optional()
516
- });
517
- var isTransformable = (value) => {
518
- return transformableSchema.safeParse(value).success;
519
- };
520
-
521
860
  // src/utils/prop-dependency-utils.ts
522
861
  function isDependencyMet(dependency, values) {
523
862
  if (!dependency?.terms.length) {
524
- return true;
863
+ return { isMet: true };
525
864
  }
526
865
  const { relation, terms } = dependency;
527
866
  const method = getRelationMethod(relation);
528
- return terms[method](
529
- (term) => isDependency(term) ? isDependencyMet(term, values) : evaluateTerm(term, extractValue(term.path, values)?.value)
530
- );
867
+ const failingDependencies = [];
868
+ const isMet = terms[method]((term) => {
869
+ const isNestedDependency = isDependency(term);
870
+ const result = isNestedDependency ? isDependencyMet(term, values).isMet : evaluateTerm(term, extractValue(term.path, values)?.value);
871
+ if (!result && !isNestedDependency) {
872
+ failingDependencies.push(term);
873
+ }
874
+ return result;
875
+ });
876
+ return { isMet, failingDependencies };
531
877
  }
532
878
  function evaluateTerm(term, actualValue) {
533
879
  const { value: valueToCompare, operator } = term;
@@ -590,34 +936,19 @@ function isDependency(term) {
590
936
  return "relation" in term;
591
937
  }
592
938
 
593
- // src/utils/filter-empty-values.ts
594
- var filterEmptyValues = (value) => {
595
- if (isEmpty(value)) {
596
- return null;
597
- }
598
- if (Array.isArray(value)) {
599
- return value.map(filterEmptyValues).filter((item) => !isEmpty(item));
600
- }
601
- if (typeof value === "object") {
602
- return Object.fromEntries(
603
- Object.entries(value).map(([key, val]) => [key, filterEmptyValues(val)]).filter(([, val]) => !isEmpty(val))
604
- );
605
- }
606
- return value;
607
- };
608
- var isEmpty = (value) => {
609
- if (value && isTransformable(value)) {
610
- return isEmpty(value.value);
611
- }
612
- return isNullish(value) || isNullishArray(value) || isNullishObject(value);
613
- };
614
- var isNullish = (value) => value === null || value === void 0 || value === "";
615
- var isNullishArray = (value) => Array.isArray(value) && value.every(isEmpty);
616
- var isNullishObject = (value) => {
617
- return typeof value === "object" && isNullishArray(Object.values(value));
939
+ // src/index.ts
940
+ var Schema = {
941
+ jsonSchemaToPropType,
942
+ propTypeToJsonSchema,
943
+ adjustLlmPropValueSchema,
944
+ isPropKeyConfigurable,
945
+ nonConfigurablePropKeys,
946
+ configurableKeys
618
947
  };
619
948
  export {
620
949
  CLASSES_PROP_KEY,
950
+ DateTimePropTypeUtil,
951
+ Schema,
621
952
  backdropFilterPropTypeUtil,
622
953
  backgroundColorOverlayPropTypeUtil,
623
954
  backgroundGradientOverlayPropTypeUtil,
@@ -646,7 +977,9 @@ export {
646
977
  filterEmptyValues,
647
978
  filterPropTypeUtil,
648
979
  flexPropTypeUtil,
980
+ getPropSchemaFromCache,
649
981
  gradientColorStopPropTypeUtil,
982
+ htmlPropTypeUtil,
650
983
  hueRotateFilterPropTypeUtil,
651
984
  imageAttachmentIdPropType,
652
985
  imagePropTypeUtil,
@@ -664,6 +997,7 @@ export {
664
997
  numberPropTypeUtil,
665
998
  perspectiveOriginPropTypeUtil,
666
999
  positionPropTypeUtil,
1000
+ queryPropTypeUtil,
667
1001
  rotateTransformPropTypeUtil,
668
1002
  scaleTransformPropTypeUtil,
669
1003
  selectionSizePropTypeUtil,