@builder.io/sdk-qwik 0.0.8 → 0.0.11

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.
Files changed (106) hide show
  1. package/README.md +65 -2
  2. package/lib/index.qwik.cjs +259 -216
  3. package/lib/index.qwik.mjs +260 -217
  4. package/package.json +4 -4
  5. package/src/blocks/button/button.jsx +22 -0
  6. package/src/blocks/button/component-info.js +41 -0
  7. package/src/blocks/columns/columns.jsx +97 -0
  8. package/src/blocks/columns/component-info.js +242 -0
  9. package/src/blocks/custom-code/component-info.js +31 -0
  10. package/src/blocks/custom-code/custom-code.jsx +71 -0
  11. package/src/blocks/embed/component-info.js +44 -0
  12. package/src/blocks/embed/embed.jsx +63 -0
  13. package/src/blocks/embed/helpers.js +9 -0
  14. package/src/blocks/form/builder-blocks.jsx +11 -0
  15. package/src/blocks/form/component-info.js +262 -0
  16. package/src/blocks/form/form.jsx +303 -0
  17. package/src/blocks/fragment/component-info.js +11 -0
  18. package/src/blocks/fragment/fragment.jsx +11 -0
  19. package/src/blocks/image/component-info.js +151 -0
  20. package/src/blocks/image/image.helpers.js +48 -0
  21. package/src/blocks/image/image.jsx +110 -0
  22. package/src/blocks/img/component-info.js +20 -0
  23. package/src/blocks/img/img.jsx +19 -0
  24. package/src/blocks/input/component-info.js +74 -0
  25. package/src/blocks/input/input.jsx +21 -0
  26. package/src/blocks/raw-text/component-info.js +16 -0
  27. package/src/blocks/raw-text/raw-text.jsx +12 -0
  28. package/src/blocks/section/component-info.js +49 -0
  29. package/src/blocks/section/section.jsx +20 -0
  30. package/src/blocks/select/component-info.js +59 -0
  31. package/src/blocks/select/select.jsx +24 -0
  32. package/src/blocks/submit-button/component-info.js +28 -0
  33. package/src/blocks/submit-button/submit-button.jsx +11 -0
  34. package/src/blocks/symbol/component-info.js +43 -0
  35. package/src/blocks/symbol/symbol.jsx +77 -0
  36. package/src/blocks/text/component-info.js +24 -0
  37. package/src/blocks/text/text.jsx +7 -0
  38. package/src/blocks/textarea/component-info.js +47 -0
  39. package/src/blocks/textarea/textarea.jsx +15 -0
  40. package/src/blocks/util.js +7 -0
  41. package/src/blocks/video/component-info.js +106 -0
  42. package/src/blocks/video/video.jsx +53 -0
  43. package/src/components/render-block/block-styles.jsx +60 -0
  44. package/src/components/render-block/render-block.helpers.js +23 -0
  45. package/src/components/render-block/render-block.jsx +221 -0
  46. package/src/components/render-block/render-component.jsx +34 -0
  47. package/src/components/render-block/render-repeated-block.jsx +37 -0
  48. package/src/components/render-block/types.js +0 -0
  49. package/src/components/render-blocks.jsx +93 -0
  50. package/src/components/render-content/components/render-styles.jsx +76 -0
  51. package/src/components/render-content/index.js +4 -0
  52. package/src/components/render-content/render-content.jsx +351 -0
  53. package/src/components/render-inlined-styles.jsx +25 -0
  54. package/src/constants/builder-registered-components.js +48 -0
  55. package/src/constants/device-sizes.js +21 -0
  56. package/src/constants/target.js +4 -0
  57. package/src/context/builder.context.js +5 -0
  58. package/src/functions/camel-to-kebab-case.js +4 -0
  59. package/src/functions/convert-style-object.js +6 -0
  60. package/src/functions/evaluate.js +28 -0
  61. package/src/functions/event-handler-name.js +7 -0
  62. package/src/functions/get-block-actions.js +23 -0
  63. package/src/functions/get-block-component-options.js +28 -0
  64. package/src/functions/get-block-properties.js +29 -0
  65. package/src/functions/get-block-styles.js +34 -0
  66. package/src/functions/get-block-tag.js +6 -0
  67. package/src/functions/get-builder-search-params/fn.test.js +13 -0
  68. package/src/functions/get-builder-search-params/index.js +33 -0
  69. package/src/functions/get-content/ab-testing.js +38 -0
  70. package/src/functions/get-content/fn.test.js +31 -0
  71. package/src/functions/get-content/index.js +96 -0
  72. package/src/functions/get-content/types.js +0 -0
  73. package/src/functions/get-fetch.js +34 -0
  74. package/src/functions/get-global-this.js +18 -0
  75. package/src/functions/get-processed-block.js +53 -0
  76. package/src/functions/get-processed-block.test.js +32 -0
  77. package/src/functions/if-target.js +15 -0
  78. package/src/functions/is-browser.js +6 -0
  79. package/src/functions/is-editing.js +7 -0
  80. package/src/functions/is-iframe.js +7 -0
  81. package/src/functions/is-previewing.js +14 -0
  82. package/src/functions/on-change.js +27 -0
  83. package/src/functions/on-change.test.js +19 -0
  84. package/src/functions/register-component.js +72 -0
  85. package/src/functions/register.js +29 -0
  86. package/src/functions/sanitize-styles.js +5 -0
  87. package/src/functions/set-editor-settings.js +15 -0
  88. package/src/functions/set.js +11 -0
  89. package/src/functions/set.test.js +16 -0
  90. package/src/functions/track.js +22 -0
  91. package/src/functions/transform-block.js +6 -0
  92. package/src/helpers/css.js +12 -0
  93. package/src/helpers/flatten.js +34 -0
  94. package/src/index-helpers/blocks-exports.js +22 -0
  95. package/src/index-helpers/top-of-file.js +4 -0
  96. package/src/index.js +10 -0
  97. package/src/scripts/init-editing.js +79 -0
  98. package/src/types/builder-block.js +0 -0
  99. package/src/types/builder-content.js +0 -0
  100. package/src/types/components.js +0 -0
  101. package/src/types/deep-partial.js +0 -0
  102. package/src/types/element.js +0 -0
  103. package/src/types/targets.js +0 -0
  104. package/src/types/typescript.js +0 -0
  105. package/types.d.ts +7 -12
  106. package/root.json +0 -1176
@@ -1,15 +1,9 @@
1
- import { createContext, componentQrl, inlinedQrl, useContextProvider, useStore, useStylesScopedQrl, useContext, Host, useLexicalScope, Slot, Fragment as Fragment$2, useRef, useWatchQrl, useHostElement, useClientEffectQrl, _useMutableProps, useCleanupQrl } from "@builder.io/qwik";
1
+ import { createContext, componentQrl, inlinedQrl, useContextProvider, useStore, useStylesScopedQrl, useContext, useLexicalScope, Slot, Fragment as Fragment$2, useRef, useWatchQrl, useClientEffectQrl, _useMutableProps, useCleanupQrl } from "@builder.io/qwik";
2
2
  import { jsx, Fragment as Fragment$1, jsxs } from "@builder.io/qwik/jsx-runtime";
3
3
  const TARGET = "qwik";
4
4
  function isBrowser() {
5
5
  return typeof window !== "undefined" && typeof document !== "undefined";
6
6
  }
7
- function isIframe() {
8
- return isBrowser() && window.self !== window.top;
9
- }
10
- function isEditing() {
11
- return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
12
- }
13
7
  const registry = {};
14
8
  function register(type, info) {
15
9
  let typeList = registry[type];
@@ -33,7 +27,106 @@ function register(type, info) {
33
27
  }
34
28
  }
35
29
  }
30
+ const registerInsertMenu = () => {
31
+ register("insertMenu", {
32
+ name: "_default",
33
+ default: true,
34
+ items: [
35
+ {
36
+ name: "Box"
37
+ },
38
+ {
39
+ name: "Text"
40
+ },
41
+ {
42
+ name: "Image"
43
+ },
44
+ {
45
+ name: "Columns"
46
+ },
47
+ ...TARGET === "reactNative" ? [] : [
48
+ {
49
+ name: "Core:Section"
50
+ },
51
+ {
52
+ name: "Core:Button"
53
+ },
54
+ {
55
+ name: "Embed"
56
+ },
57
+ {
58
+ name: "Custom Code"
59
+ }
60
+ ]
61
+ ]
62
+ });
63
+ };
64
+ const setupBrowserForEditing = () => {
65
+ var _a;
66
+ if (isBrowser()) {
67
+ (_a = window.parent) == null || _a.postMessage({
68
+ type: "builder.sdkInfo",
69
+ data: {
70
+ target: TARGET,
71
+ supportsPatchUpdates: false
72
+ }
73
+ }, "*");
74
+ window.addEventListener("message", ({ data }) => {
75
+ var _a2, _b;
76
+ if (data)
77
+ switch (data.type) {
78
+ case "builder.evaluate": {
79
+ const text = data.data.text;
80
+ const args = data.data.arguments || [];
81
+ const id = data.data.id;
82
+ const fn = new Function(text);
83
+ let result;
84
+ let error = null;
85
+ try {
86
+ result = fn.apply(null, args);
87
+ } catch (err) {
88
+ error = err;
89
+ }
90
+ if (error)
91
+ (_a2 = window.parent) == null || _a2.postMessage({
92
+ type: "builder.evaluateError",
93
+ data: {
94
+ id,
95
+ error: error.message
96
+ }
97
+ }, "*");
98
+ else if (result && typeof result.then === "function")
99
+ result.then((finalResult) => {
100
+ var _a3;
101
+ (_a3 = window.parent) == null || _a3.postMessage({
102
+ type: "builder.evaluateResult",
103
+ data: {
104
+ id,
105
+ result: finalResult
106
+ }
107
+ }, "*");
108
+ }).catch(console.error);
109
+ else
110
+ (_b = window.parent) == null || _b.postMessage({
111
+ type: "builder.evaluateResult",
112
+ data: {
113
+ result,
114
+ id
115
+ }
116
+ }, "*");
117
+ break;
118
+ }
119
+ }
120
+ });
121
+ }
122
+ };
36
123
  var stdin_default = createContext("Builder");
124
+ function isIframe() {
125
+ return isBrowser() && window.self !== window.top;
126
+ }
127
+ function isEditing() {
128
+ return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
129
+ }
37
130
  const SIZES = {
38
131
  small: {
39
132
  min: 320,
@@ -74,10 +167,7 @@ const set = (obj, _path, value) => {
74
167
  if (Object(obj) !== obj)
75
168
  return obj;
76
169
  const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
77
- path.slice(0, -1).reduce(
78
- (a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {},
79
- obj
80
- )[path[path.length - 1]] = value;
170
+ path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
81
171
  return obj;
82
172
  };
83
173
  function transformBlock(block) {
@@ -442,7 +532,8 @@ const renderComponentProps = function renderComponentProps2(props, state) {
442
532
  return {
443
533
  blockChildren: children(props),
444
534
  componentRef: componentRef(props),
445
- componentOptions: componentOptions(props)
535
+ componentOptions: componentOptions(props),
536
+ context: props.context
446
537
  };
447
538
  };
448
539
  const children = function children2(props, state) {
@@ -465,21 +556,19 @@ const repeatItemData = function repeatItemData2(props, state) {
465
556
  return void 0;
466
557
  const collectionName = repeat.collection.split(".").pop();
467
558
  const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
468
- const repeatArray = itemsArray.map(
469
- (item, index) => ({
470
- context: {
471
- ...props.context,
472
- state: {
473
- ...props.context.state,
474
- $index: index,
475
- $item: item,
476
- [itemNameToUse]: item,
477
- [`$${itemNameToUse}Index`]: index
478
- }
479
- },
480
- block: blockWithoutRepeat
481
- })
482
- );
559
+ const repeatArray = itemsArray.map((item, index) => ({
560
+ context: {
561
+ ...props.context,
562
+ state: {
563
+ ...props.context.state,
564
+ $index: index,
565
+ $item: item,
566
+ [itemNameToUse]: item,
567
+ [`$${itemNameToUse}Index`]: index
568
+ }
569
+ },
570
+ block: blockWithoutRepeat
571
+ }));
483
572
  return repeatArray;
484
573
  };
485
574
  const RenderBlock = (props) => {
@@ -492,7 +581,8 @@ const RenderBlock = (props) => {
492
581
  repeatItemData(props) ? (repeatItemData(props) || []).map((data, index) => {
493
582
  return /* @__PURE__ */ jsx(RenderRepeatedBlock$1, {
494
583
  repeatContext: data.context,
495
- block: data.block
584
+ block: data.block,
585
+ context: props.context
496
586
  }, index);
497
587
  }) : null,
498
588
  !repeatItemData(props) ? /* @__PURE__ */ jsx(RenderComponent$1, {
@@ -547,7 +637,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
547
637
  useStylesScopedQrl(inlinedQrl(STYLES$2, "RenderBlocks_component_useStylesScoped_QNti2s7juQc"));
548
638
  const builderContext = useContext(stdin_default);
549
639
  const state = {};
550
- return /* @__PURE__ */ jsx(Host, {
640
+ return /* @__PURE__ */ jsxs("div", {
551
641
  class: className(props) + " div-RenderBlocks",
552
642
  "builder-path": props.path,
553
643
  "builder-parent-id": props.parent,
@@ -557,7 +647,7 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
557
647
  onClick$: inlinedQrl((event) => {
558
648
  const [builderContext2, props2, state2] = useLexicalScope();
559
649
  return onClick$1(props2);
560
- }, "RenderBlocks_component_Host_onClick_81ErKSpyspw", [
650
+ }, "RenderBlocks_component_div_onClick_IHSfVTIKyxE", [
561
651
  builderContext,
562
652
  props,
563
653
  state
@@ -565,31 +655,27 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
565
655
  onMouseEnter$: inlinedQrl((event) => {
566
656
  const [builderContext2, props2, state2] = useLexicalScope();
567
657
  return onMouseEnter(props2);
568
- }, "RenderBlocks_component_Host_onMouseEnter_h6rWG6KLkHE", [
658
+ }, "RenderBlocks_component_div_onMouseEnter_qLiEh4n9ugw", [
569
659
  builderContext,
570
660
  props,
571
661
  state
572
662
  ]),
573
- children: /* @__PURE__ */ jsxs(Fragment$1, {
574
- children: [
575
- props.blocks ? (props.blocks || []).map((block) => {
576
- return /* @__PURE__ */ jsx(RenderBlock$1, {
577
- block,
578
- context: builderContext
579
- }, "render-block-" + block.id);
580
- }) : null,
581
- props.blocks ? (props.blocks || []).map((block) => {
582
- return /* @__PURE__ */ jsx(BlockStyles$1, {
583
- block,
584
- context: builderContext
585
- }, "block-style-" + block.id);
586
- }) : null
587
- ]
588
- })
663
+ children: [
664
+ props.blocks ? (props.blocks || []).map((block) => {
665
+ return /* @__PURE__ */ jsx(RenderBlock$1, {
666
+ block,
667
+ context: builderContext
668
+ }, "render-block-" + block.id);
669
+ }) : null,
670
+ props.blocks ? (props.blocks || []).map((block) => {
671
+ return /* @__PURE__ */ jsx(BlockStyles$1, {
672
+ block,
673
+ context: builderContext
674
+ }, "block-style-" + block.id);
675
+ }) : null
676
+ ]
589
677
  });
590
- }, "RenderBlocks_component_SXGwmVyEM0s"), {
591
- tagName: "div"
592
- });
678
+ }, "RenderBlocks_component_SXGwmVyEM0s"));
593
679
  const RenderBlocks$1 = RenderBlocks;
594
680
  const STYLES$2 = `.div-RenderBlocks {
595
681
  display: flex;
@@ -635,7 +721,7 @@ const columnCssVars = function columnCssVars2(props, state) {
635
721
  const Columns = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
636
722
  useStylesScopedQrl(inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_704fWXyHORo"));
637
723
  const state = {};
638
- return /* @__PURE__ */ jsx(Host, {
724
+ return /* @__PURE__ */ jsx("div", {
639
725
  class: "builder-columns div-Columns",
640
726
  style: columnsCssVars(props, state),
641
727
  children: (props.columns || []).map((column, index) => {
@@ -652,9 +738,7 @@ const Columns = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
652
738
  }, index);
653
739
  })
654
740
  });
655
- }, "Columns_component_0PeVQGTMczc"), {
656
- tagName: "div"
657
- });
741
+ }, "Columns_component_0PeVQGTMczc"));
658
742
  const Columns$1 = Columns;
659
743
  const STYLES$1 = `.div-Columns {
660
744
  display: flex;
@@ -708,25 +792,15 @@ function getSrcSet(url) {
708
792
  const widthInSrc = Number(url.split("?width=")[1]);
709
793
  if (!isNaN(widthInSrc))
710
794
  srcUrl = `${srcUrl} ${widthInSrc}w`;
711
- return sizes.filter(
712
- (size) => size !== widthInSrc
713
- ).map(
714
- (size) => `${updateQueryParam(url, "width", size)} ${size}w`
715
- ).concat([
795
+ return sizes.filter((size) => size !== widthInSrc).map((size) => `${updateQueryParam(url, "width", size)} ${size}w`).concat([
716
796
  srcUrl
717
797
  ]).join(", ");
718
798
  }
719
799
  if (url.match(/cdn\.shopify\.com/))
720
- return sizes.map(
721
- (size) => [
722
- getShopifyImageUrl(url, `${size}x${size}`),
723
- size
724
- ]
725
- ).filter(
726
- ([sizeUrl]) => !!sizeUrl
727
- ).map(
728
- ([sizeUrl, size]) => `${sizeUrl} ${size}w`
729
- ).concat([
800
+ return sizes.map((size) => [
801
+ getShopifyImageUrl(url, `${size}x${size}`),
802
+ size
803
+ ]).filter(([sizeUrl]) => !!sizeUrl).map(([sizeUrl, size]) => `${sizeUrl} ${size}w`).concat([
730
804
  url
731
805
  ]).join(", ");
732
806
  return url;
@@ -753,51 +827,47 @@ const webpSrcSet = function webpSrcSet2(props, state) {
753
827
  };
754
828
  const Image = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
755
829
  useStylesScopedQrl(inlinedQrl(STYLES, "Image_component_useStylesScoped_gRbO7w7SeZA"));
756
- return /* @__PURE__ */ jsx(Host, {
830
+ return /* @__PURE__ */ jsxs("div", {
757
831
  class: "div-Image",
758
- children: /* @__PURE__ */ jsxs(Fragment$1, {
759
- children: [
760
- /* @__PURE__ */ jsxs("picture", {
761
- children: [
762
- webpSrcSet(props) ? /* @__PURE__ */ jsx("source", {
763
- type: "image/webp",
764
- srcset: webpSrcSet(props)
765
- }) : null,
766
- /* @__PURE__ */ jsx("img", {
767
- loading: "lazy",
768
- alt: props.altText,
769
- role: props.altText ? "presentation" : void 0,
770
- style: {
771
- objectPosition: props.backgroundSize || "center",
772
- objectFit: props.backgroundSize || "cover"
773
- },
774
- class: "builder-image" + (props.className ? " " + props.className : "") + " img-Image",
775
- src: props.image,
776
- srcset: srcSetToUse(props),
777
- sizes: props.sizes
778
- }),
779
- /* @__PURE__ */ jsx("source", {
780
- srcset: srcSetToUse(props)
781
- })
782
- ]
783
- }),
784
- props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length) ? /* @__PURE__ */ jsx("div", {
785
- class: "builder-image-sizer div-Image-2",
786
- style: {
787
- paddingTop: props.aspectRatio * 100 + "%"
788
- }
789
- }) : null,
790
- props.builderBlock?.children?.length && props.fitContent ? /* @__PURE__ */ jsx(Slot, {}) : null,
791
- !props.fitContent ? /* @__PURE__ */ jsx("div", {
792
- class: "div-Image-3",
793
- children: /* @__PURE__ */ jsx(Slot, {})
794
- }) : null
795
- ]
796
- })
832
+ children: [
833
+ /* @__PURE__ */ jsxs("picture", {
834
+ children: [
835
+ webpSrcSet(props) ? /* @__PURE__ */ jsx("source", {
836
+ type: "image/webp",
837
+ srcset: webpSrcSet(props)
838
+ }) : null,
839
+ /* @__PURE__ */ jsx("img", {
840
+ loading: "lazy",
841
+ alt: props.altText,
842
+ role: props.altText ? "presentation" : void 0,
843
+ style: {
844
+ objectPosition: props.backgroundSize || "center",
845
+ objectFit: props.backgroundSize || "cover"
846
+ },
847
+ class: "builder-image" + (props.className ? " " + props.className : "") + " img-Image",
848
+ src: props.image,
849
+ srcset: srcSetToUse(props),
850
+ sizes: props.sizes
851
+ }),
852
+ /* @__PURE__ */ jsx("source", {
853
+ srcset: srcSetToUse(props)
854
+ })
855
+ ]
856
+ }),
857
+ props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length) ? /* @__PURE__ */ jsx("div", {
858
+ class: "builder-image-sizer div-Image-2",
859
+ style: {
860
+ paddingTop: props.aspectRatio * 100 + "%"
861
+ }
862
+ }) : null,
863
+ props.builderBlock?.children?.length && props.fitContent ? /* @__PURE__ */ jsx(Slot, {}) : null,
864
+ !props.fitContent ? /* @__PURE__ */ jsx("div", {
865
+ class: "div-Image-3",
866
+ children: /* @__PURE__ */ jsx(Slot, {})
867
+ }) : null
868
+ ]
797
869
  });
798
- }, "Image_component_y3S3Zox9wEo"), {
799
- tagName: "div"
800
- });
870
+ }, "Image_component_y3S3Zox9wEo"));
801
871
  const Image$1 = Image;
802
872
  const STYLES = `.div-Image {
803
873
  position: relative; }.img-Image {
@@ -820,13 +890,11 @@ left: 0;
820
890
  width: 100%;
821
891
  height: 100%; }`;
822
892
  const Text = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
823
- return /* @__PURE__ */ jsx(Host, {
893
+ return /* @__PURE__ */ jsx("div", {
824
894
  class: "builder-text",
825
895
  dangerouslySetInnerHTML: props.text
826
896
  });
827
- }, "Text_component_ci0NVEdoK0Q"), {
828
- tagName: "div"
829
- });
897
+ }, "Text_component_ci0NVEdoK0Q"));
830
898
  const Text$1 = Text;
831
899
  const videoProps = function videoProps2(props, state) {
832
900
  return {
@@ -848,7 +916,7 @@ const videoProps = function videoProps2(props, state) {
848
916
  };
849
917
  };
850
918
  const Video = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
851
- return /* @__PURE__ */ jsx(Host, {
919
+ return /* @__PURE__ */ jsx("video", {
852
920
  ...videoProps(props),
853
921
  style: {
854
922
  width: "100%",
@@ -861,9 +929,7 @@ const Video = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
861
929
  src: props.video || "no-src",
862
930
  poster: props.posterImage
863
931
  });
864
- }, "Video_component_O5sPuWlrTvk"), {
865
- tagName: "video"
866
- });
932
+ }, "Video_component_O5sPuWlrTvk"));
867
933
  const Video$1 = Video;
868
934
  const Button = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
869
935
  return /* @__PURE__ */ jsx(Fragment$2, {
@@ -1118,13 +1184,9 @@ const componentInfo$7 = {
1118
1184
  }
1119
1185
  const columns = options.get("columns");
1120
1186
  if (Array.isArray(columns)) {
1121
- const containsColumnWithWidth = !!columns.find(
1122
- (col) => col.get("width")
1123
- );
1187
+ const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
1124
1188
  if (containsColumnWithWidth) {
1125
- const containsColumnWithoutWidth = !!columns.find(
1126
- (col) => !col.get("width")
1127
- );
1189
+ const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
1128
1190
  if (containsColumnWithoutWidth)
1129
1191
  clearWidths();
1130
1192
  else {
@@ -1176,12 +1238,10 @@ const componentInfo$6 = {
1176
1238
  noWrap: true
1177
1239
  };
1178
1240
  const FragmentComponent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
1179
- return /* @__PURE__ */ jsx(Host, {
1241
+ return /* @__PURE__ */ jsx("span", {
1180
1242
  children: /* @__PURE__ */ jsx(Slot, {})
1181
1243
  });
1182
- }, "FragmentComponent_component_FJmqlA66Rjg"), {
1183
- tagName: "span"
1184
- });
1244
+ }, "FragmentComponent_component_FJmqlA66Rjg"));
1185
1245
  const Fragment = FragmentComponent;
1186
1246
  const componentInfo$5 = {
1187
1247
  name: "Image",
@@ -1236,9 +1296,7 @@ const componentInfo$5 = {
1236
1296
  }
1237
1297
  const value = options.get("image");
1238
1298
  const aspectRatio = options.get("aspectRatio");
1239
- fetch(value).then(
1240
- (res) => res.blob()
1241
- ).then((blob) => {
1299
+ fetch(value).then((res) => res.blob()).then((blob) => {
1242
1300
  if (blob.type.includes("svg"))
1243
1301
  options.set("noWebp", true);
1244
1302
  });
@@ -1381,16 +1439,14 @@ const componentInfo$4 = {
1381
1439
  ]
1382
1440
  };
1383
1441
  const SectionComponent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
1384
- return /* @__PURE__ */ jsx(Host, {
1442
+ return /* @__PURE__ */ jsx("section", {
1385
1443
  ...props.attributes,
1386
1444
  style: (() => {
1387
1445
  props.maxWidth && typeof props.maxWidth === "number" ? props.maxWidth : void 0;
1388
1446
  })(),
1389
1447
  children: /* @__PURE__ */ jsx(Slot, {})
1390
1448
  });
1391
- }, "SectionComponent_component_m1CcjCwgHug"), {
1392
- tagName: "section"
1393
- });
1449
+ }, "SectionComponent_component_m1CcjCwgHug"));
1394
1450
  const Section = SectionComponent;
1395
1451
  const componentInfo$3 = {
1396
1452
  name: "Symbol",
@@ -1582,9 +1638,7 @@ const componentInfo2 = {
1582
1638
  if (url) {
1583
1639
  options.set("content", "Loading...");
1584
1640
  const apiKey = "ae0e60e78201a3f2b0de4b";
1585
- return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then(
1586
- (res) => res.json()
1587
- ).then((data) => {
1641
+ return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
1588
1642
  if (options.get("url") === url) {
1589
1643
  if (data.html)
1590
1644
  options.set("content", data.html);
@@ -1650,14 +1704,12 @@ const Embed = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
1650
1704
  props,
1651
1705
  state
1652
1706
  ]));
1653
- return /* @__PURE__ */ jsx(Host, {
1707
+ return /* @__PURE__ */ jsx("div", {
1654
1708
  class: "builder-embed",
1655
1709
  ref: elem,
1656
1710
  dangerouslySetInnerHTML: props.content
1657
1711
  });
1658
- }, "Embed_component_CP6B8Y76ylw"), {
1659
- tagName: "div"
1660
- });
1712
+ }, "Embed_component_CP6B8Y76ylw"));
1661
1713
  const embed = Embed;
1662
1714
  var __defProp$3 = Object.defineProperty;
1663
1715
  var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
@@ -1810,9 +1862,7 @@ function getFetch() {
1810
1862
  return __async$1(this, null, function* () {
1811
1863
  const globalFetch = getGlobalThis().fetch;
1812
1864
  if (typeof globalFetch === "undefined" && typeof global !== "undefined") {
1813
- const nodeFetch = import("./index.97024df8.js").then(
1814
- (d) => d.default
1815
- );
1865
+ const nodeFetch = import("./index.97024df8.js").then((d) => d.default);
1816
1866
  return nodeFetch.default || nodeFetch;
1817
1867
  }
1818
1868
  return globalFetch.default || globalFetch;
@@ -1917,8 +1967,8 @@ const generateContentUrl = (options) => {
1917
1967
  const flattened2 = flatten({
1918
1968
  query
1919
1969
  });
1920
- for (const key in flattened2)
1921
- url.searchParams.set(key, JSON.stringify(flattened2[key]));
1970
+ for (const key1 in flattened2)
1971
+ url.searchParams.set(key1, JSON.stringify(flattened2[key1]));
1922
1972
  }
1923
1973
  return url;
1924
1974
  };
@@ -1926,9 +1976,7 @@ function getAllContent(options) {
1926
1976
  return __async(this, null, function* () {
1927
1977
  const url = generateContentUrl(options);
1928
1978
  const fetch2 = yield fetch$;
1929
- const content = yield fetch2(url.href).then(
1930
- (res) => res.json()
1931
- );
1979
+ const content = yield fetch2(url.href).then((res) => res.json());
1932
1980
  if (options.testGroups)
1933
1981
  for (const item of content.results)
1934
1982
  handleABTesting(item, options.testGroups);
@@ -2007,14 +2055,9 @@ const prepareComponentInfoToSend = (_c) => {
2007
2055
  "inputs"
2008
2056
  ]);
2009
2057
  return __spreadProps(__spreadValues({}, fastClone(info)), {
2010
- inputs: inputs == null ? void 0 : inputs.map(
2011
- (input) => Object.entries(input).reduce(
2012
- (acc, [key, value]) => __spreadProps(__spreadValues({}, acc), {
2013
- [key]: serializeValue(value)
2014
- }),
2015
- {}
2016
- )
2017
- )
2058
+ inputs: inputs == null ? void 0 : inputs.map((input) => Object.entries(input).reduce((acc, [key, value]) => __spreadProps(__spreadValues({}, acc), {
2059
+ [key]: serializeValue(value)
2060
+ }), {}))
2018
2061
  });
2019
2062
  };
2020
2063
  function track(event, properties) {
@@ -2071,9 +2114,7 @@ const getCssFromFont = function getCssFromFont2(props, state, font) {
2071
2114
  return str;
2072
2115
  };
2073
2116
  const getFontCss = function getFontCss2(props, state, { customFonts }) {
2074
- return customFonts?.map(
2075
- (font) => getCssFromFont(props, state, font)
2076
- )?.join(" ") || "";
2117
+ return customFonts?.map((font) => getCssFromFont(props, state, font))?.join(" ") || "";
2077
2118
  };
2078
2119
  const injectedStyles = function injectedStyles2(props, state) {
2079
2120
  return `
@@ -2089,7 +2130,7 @@ const RenderContentStyles = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2089
2130
  });
2090
2131
  }, "RenderContentStyles_component_32XAr483K2o"));
2091
2132
  const RenderContentStyles$1 = RenderContentStyles;
2092
- const useContent = function useContent2(props, state) {
2133
+ const useContent = function useContent2(props, state, elementRef) {
2093
2134
  const mergedContent = {
2094
2135
  ...props.content,
2095
2136
  ...state.overrideContent,
@@ -2101,32 +2142,29 @@ const useContent = function useContent2(props, state) {
2101
2142
  };
2102
2143
  return mergedContent;
2103
2144
  };
2104
- const contentState = function contentState2(props, state) {
2145
+ const contentState = function contentState2(props, state, elementRef) {
2105
2146
  return {
2106
2147
  ...props.content?.data?.state,
2107
2148
  ...props.data,
2108
2149
  ...state.overrideState
2109
2150
  };
2110
2151
  };
2111
- const contextContext = function contextContext2(props, state) {
2152
+ const contextContext = function contextContext2(props, state, elementRef) {
2112
2153
  return props.context || {};
2113
2154
  };
2114
- const allRegisteredComponents = function allRegisteredComponents2(props, state) {
2155
+ const allRegisteredComponents = function allRegisteredComponents2(props, state, elementRef) {
2115
2156
  const allComponentsArray = [
2116
2157
  ...getDefaultRegisteredComponents(),
2117
2158
  ...components,
2118
2159
  ...props.customComponents || []
2119
2160
  ];
2120
- const allComponents = allComponentsArray.reduce(
2121
- (acc, curr) => ({
2122
- ...acc,
2123
- [curr.name]: curr
2124
- }),
2125
- {}
2126
- );
2161
+ const allComponents = allComponentsArray.reduce((acc, curr) => ({
2162
+ ...acc,
2163
+ [curr.name]: curr
2164
+ }), {});
2127
2165
  return allComponents;
2128
2166
  };
2129
- const processMessage = function processMessage2(props, state, event) {
2167
+ const processMessage = function processMessage2(props, state, elementRef, event) {
2130
2168
  const { data } = event;
2131
2169
  if (data)
2132
2170
  switch (data.type) {
@@ -2140,7 +2178,7 @@ const processMessage = function processMessage2(props, state, event) {
2140
2178
  }
2141
2179
  }
2142
2180
  };
2143
- const evaluateJsCode = function evaluateJsCode2(props, state) {
2181
+ const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
2144
2182
  const jsCode = useContent(props, state)?.data?.jsCode;
2145
2183
  if (jsCode)
2146
2184
  evaluate({
@@ -2149,26 +2187,23 @@ const evaluateJsCode = function evaluateJsCode2(props, state) {
2149
2187
  state: contentState(props, state)
2150
2188
  });
2151
2189
  };
2152
- const httpReqsData = function httpReqsData2(props, state) {
2190
+ const httpReqsData = function httpReqsData2(props, state, elementRef) {
2153
2191
  return {};
2154
2192
  };
2155
- const onClick2 = function onClick3(props, state, _event) {
2193
+ const onClick2 = function onClick3(props, state, elementRef, _event) {
2156
2194
  if (useContent(props, state) && props.canTrack !== false)
2157
2195
  track("click", {
2158
2196
  contentId: useContent(props, state).id
2159
2197
  });
2160
2198
  };
2161
- const evalExpression = function evalExpression2(props, state, expression) {
2162
- return expression.replace(
2163
- /{{([^}]+)}}/g,
2164
- (_match, group) => evaluate({
2165
- code: group,
2166
- context: contextContext(props),
2167
- state: contentState(props, state)
2168
- })
2169
- );
2199
+ const evalExpression = function evalExpression2(props, state, elementRef, expression) {
2200
+ return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
2201
+ code: group,
2202
+ context: contextContext(props),
2203
+ state: contentState(props, state)
2204
+ }));
2170
2205
  };
2171
- const handleRequest = function handleRequest2(props, state, { url, key }) {
2206
+ const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
2172
2207
  const fetchAndSetState = async () => {
2173
2208
  const fetch2 = await getFetch();
2174
2209
  const response = await fetch2(url);
@@ -2181,19 +2216,19 @@ const handleRequest = function handleRequest2(props, state, { url, key }) {
2181
2216
  };
2182
2217
  fetchAndSetState();
2183
2218
  };
2184
- const runHttpRequests = function runHttpRequests2(props, state) {
2219
+ const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
2185
2220
  const requests = useContent(props, state)?.data?.httpRequests ?? {};
2186
2221
  Object.entries(requests).forEach(([key, url]) => {
2187
2222
  if (url && (!httpReqsData()[key] || isEditing())) {
2188
- const evaluatedUrl = evalExpression(props, state, url);
2189
- handleRequest(props, state, {
2223
+ const evaluatedUrl = evalExpression(props, state, elementRef, url);
2224
+ handleRequest(props, state, elementRef, {
2190
2225
  url: evaluatedUrl,
2191
2226
  key
2192
2227
  });
2193
2228
  }
2194
2229
  });
2195
2230
  };
2196
- const emitStateUpdate = function emitStateUpdate2(props, state) {
2231
+ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
2197
2232
  if (isEditing())
2198
2233
  window.dispatchEvent(new CustomEvent("builder:component:stateChange", {
2199
2234
  detail: {
@@ -2204,12 +2239,13 @@ const emitStateUpdate = function emitStateUpdate2(props, state) {
2204
2239
  }
2205
2240
  }));
2206
2241
  };
2207
- const shouldRenderContentStyles = function shouldRenderContentStyles2(props, state) {
2242
+ const shouldRenderContentStyles = function shouldRenderContentStyles2(props, state, elementRef) {
2208
2243
  return Boolean((useContent(props, state)?.data?.cssCode || useContent(props, state)?.data?.customFonts?.length) && TARGET !== "reactNative");
2209
2244
  };
2210
2245
  const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2211
- const hostElement = useHostElement();
2246
+ const elementRef = useRef();
2212
2247
  const state = useStore({
2248
+ forceReRenderCount: 0,
2213
2249
  overrideContent: null,
2214
2250
  update: 0,
2215
2251
  overrideState: {}
@@ -2232,16 +2268,19 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2232
2268
  })()
2233
2269
  }));
2234
2270
  useClientEffectQrl(inlinedQrl(() => {
2235
- const [hostElement2, props2, state2] = useLexicalScope();
2271
+ const [elementRef2, props2, state2] = useLexicalScope();
2236
2272
  if (isBrowser()) {
2237
2273
  if (isEditing()) {
2238
- _useMutableProps(hostElement2, true);
2274
+ state2.forceReRenderCount++;
2275
+ _useMutableProps(elementRef2.current, true);
2276
+ registerInsertMenu();
2277
+ setupBrowserForEditing();
2239
2278
  Object.values(allRegisteredComponents(props2)).forEach((registeredComponent) => {
2240
2279
  const message = createRegisterComponentMessage(registeredComponent);
2241
2280
  window.parent?.postMessage(message, "*");
2242
2281
  });
2243
- window.addEventListener("message", processMessage.bind(null, props2, state2));
2244
- window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2));
2282
+ window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
2283
+ window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
2245
2284
  }
2246
2285
  if (useContent(props2, state2) && props2.canTrack !== false)
2247
2286
  track("impression", {
@@ -2262,54 +2301,60 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2262
2301
  }
2263
2302
  }
2264
2303
  evaluateJsCode(props2, state2);
2265
- runHttpRequests(props2, state2);
2304
+ runHttpRequests(props2, state2, elementRef2);
2266
2305
  emitStateUpdate(props2, state2);
2267
2306
  }
2268
2307
  }, "RenderContent_component_useClientEffect_ntruwSC9lSo", [
2269
- hostElement,
2308
+ elementRef,
2270
2309
  props,
2271
2310
  state
2272
2311
  ]));
2273
- useWatchQrl(inlinedQrl(({ track: track1 }) => {
2274
- const [props2, state2] = useLexicalScope();
2275
- state2.useContent?.data && track1(state2.useContent?.data, "jsCode");
2312
+ useWatchQrl(inlinedQrl(({ track: track2 }) => {
2313
+ const [elementRef2, props2, state2] = useLexicalScope();
2314
+ state2.useContent?.data && track2(state2.useContent?.data, "jsCode");
2276
2315
  evaluateJsCode(props2, state2);
2277
2316
  }, "RenderContent_component_useWatch_1P0ujLQOmzc", [
2317
+ elementRef,
2278
2318
  props,
2279
2319
  state
2280
2320
  ]));
2281
2321
  useWatchQrl(inlinedQrl(({ track: track2 }) => {
2282
- const [props2, state2] = useLexicalScope();
2322
+ const [elementRef2, props2, state2] = useLexicalScope();
2283
2323
  state2.useContent?.data && track2(state2.useContent?.data, "httpRequests");
2284
- runHttpRequests(props2, state2);
2324
+ runHttpRequests(props2, state2, elementRef2);
2285
2325
  }, "RenderContent_component_useWatch_1_0hAcn4V2AZw", [
2326
+ elementRef,
2286
2327
  props,
2287
2328
  state
2288
2329
  ]));
2289
- useWatchQrl(inlinedQrl(({ track: track3 }) => {
2290
- const [props2, state2] = useLexicalScope();
2291
- state2 && track3(state2, "contentState");
2330
+ useWatchQrl(inlinedQrl(({ track: track2 }) => {
2331
+ const [elementRef2, props2, state2] = useLexicalScope();
2332
+ state2 && track2(state2, "contentState");
2292
2333
  emitStateUpdate(props2, state2);
2293
2334
  }, "RenderContent_component_useWatch_2_t2n8zpl4mRs", [
2335
+ elementRef,
2294
2336
  props,
2295
2337
  state
2296
2338
  ]));
2297
2339
  useCleanupQrl(inlinedQrl(() => {
2298
- const [props2, state2] = useLexicalScope();
2340
+ const [elementRef2, props2, state2] = useLexicalScope();
2299
2341
  if (isBrowser()) {
2300
- window.removeEventListener("message", processMessage.bind(null, props2, state2));
2301
- window.removeEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2));
2342
+ window.removeEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
2343
+ window.removeEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
2302
2344
  }
2303
2345
  }, "RenderContent_component_useCleanup_sGf1npb03WA", [
2346
+ elementRef,
2304
2347
  props,
2305
2348
  state
2306
2349
  ]));
2307
2350
  return /* @__PURE__ */ jsx(Fragment$1, {
2308
2351
  children: useContent(props, state) ? /* @__PURE__ */ jsxs("div", {
2352
+ ref: elementRef,
2309
2353
  onClick$: inlinedQrl((event) => {
2310
- const [props2, state2] = useLexicalScope();
2354
+ const [elementRef2, props2, state2] = useLexicalScope();
2311
2355
  return onClick2(props2, state2);
2312
2356
  }, "RenderContent_component__Fragment_div_onClick_76e3rL00UYE", [
2357
+ elementRef,
2313
2358
  props,
2314
2359
  state
2315
2360
  ]),
@@ -2321,7 +2366,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2321
2366
  }) : null,
2322
2367
  /* @__PURE__ */ jsx(RenderBlocks$1, {
2323
2368
  blocks: useContent(props, state)?.data?.blocks
2324
- })
2369
+ }, state.forceReRenderCount)
2325
2370
  ]
2326
2371
  }) : null
2327
2372
  });
@@ -2362,7 +2407,7 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2362
2407
  props,
2363
2408
  state
2364
2409
  ]));
2365
- return /* @__PURE__ */ jsx(Host, {
2410
+ return /* @__PURE__ */ jsx("div", {
2366
2411
  ...props.attributes,
2367
2412
  dataSet: {
2368
2413
  class: state.className
@@ -2381,9 +2426,7 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(inlinedQrl((props) => {
2381
2426
  content: state.content
2382
2427
  })
2383
2428
  });
2384
- }, "Symbol_component_Dn8mGpai87I"), {
2385
- tagName: "div"
2386
- });
2429
+ }, "Symbol_component_Dn8mGpai87I"));
2387
2430
  const Symbol$2 = Symbol$1;
2388
2431
  const settings = {};
2389
2432
  function setEditorSettings(newSettings) {