@builder.io/sdk-qwik 0.14.7 → 0.14.9

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.
@@ -1800,7 +1800,7 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
1800
1800
  children: [
1801
1801
  /* @__PURE__ */ _jsxQ("picture", null, null, [
1802
1802
  webpSrcSet.value ? /* @__PURE__ */ _jsxQ("source", null, {
1803
- srcSet: _fnSignal((p0) => p0.value, [
1803
+ srcset: _fnSignal((p0) => p0.value, [
1804
1804
  webpSrcSet
1805
1805
  ], "p0.value"),
1806
1806
  type: "image/webp"
@@ -1822,7 +1822,7 @@ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
1822
1822
  src: _fnSignal((p0) => p0.image, [
1823
1823
  props
1824
1824
  ], "p0.image"),
1825
- srcSet: _fnSignal((p0) => p0.value, [
1825
+ srcset: _fnSignal((p0) => p0.value, [
1826
1826
  srcSetToUse
1827
1827
  ], "p0.value"),
1828
1828
  style: _fnSignal((p0, p1) => ({
@@ -4392,7 +4392,7 @@ function isFromTrustedHost(trustedHosts, e) {
4392
4392
  const url = new URL(e.origin), hostname = url.hostname;
4393
4393
  return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
4394
4394
  }
4395
- const SDK_VERSION = "0.14.7";
4395
+ const SDK_VERSION = "0.14.9";
4396
4396
  const registry = {};
4397
4397
  function register(type, info) {
4398
4398
  let typeList = registry[type];
@@ -4613,21 +4613,18 @@ const processMessage = function processMessage2(props, state, elementRef, event)
4613
4613
  const { breakpoints, contentId } = messageContent;
4614
4614
  if (!contentId || contentId !== ((_a = props.builderContextSignal.content) == null ? void 0 : _a.id))
4615
4615
  return;
4616
- if (breakpoints) {
4616
+ if (breakpoints)
4617
4617
  mergeNewContent(props, state, elementRef, {
4618
4618
  meta: {
4619
4619
  breakpoints
4620
4620
  }
4621
4621
  });
4622
- state.forceReRenderCount = state.forceReRenderCount + 1;
4623
- }
4624
4622
  },
4625
4623
  animation: (animation) => {
4626
4624
  triggerAnimation(animation);
4627
4625
  },
4628
4626
  contentUpdate: (newContent) => {
4629
4627
  mergeNewContent(props, state, elementRef, newContent);
4630
- state.forceReRenderCount = state.forceReRenderCount + 1;
4631
4628
  }
4632
4629
  }
4633
4630
  })(event);
@@ -4714,23 +4711,17 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
4714
4711
  }));
4715
4712
  };
4716
4713
  const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4717
- var _a, _b, _c, _d, _e;
4718
4714
  _jsxBranch();
4719
4715
  const elementRef = useSignal();
4720
4716
  const state = useStore({
4721
4717
  ContentWrapper: props.contentWrapper || "div",
4722
4718
  clicked: false,
4723
- firstRender: true,
4724
- forceReRenderCount: 0,
4725
- httpReqsData: {},
4726
- lastUpdated: 0,
4727
- shouldSendResetCookie: false
4719
+ httpReqsData: {}
4728
4720
  }, {
4729
4721
  deep: true
4730
4722
  });
4731
4723
  useOn("initeditingbldr", /* @__PURE__ */ inlinedQrl((event, element) => {
4732
4724
  const [elementRef2, props2, state2] = useLexicalScope();
4733
- state2.forceReRenderCount = state2.forceReRenderCount + 1;
4734
4725
  window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
4735
4726
  registerInsertMenu();
4736
4727
  setupBrowserForEditing({
@@ -4745,9 +4736,9 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4745
4736
  } : {}
4746
4737
  });
4747
4738
  Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
4748
- var _a2;
4739
+ var _a;
4749
4740
  const message = createRegisterComponentMessage(registeredComponent);
4750
- (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
4741
+ (_a = window.parent) == null ? void 0 : _a.postMessage(message, "*");
4751
4742
  });
4752
4743
  window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
4753
4744
  }, "EnableEditor_component_useOn_Qs8c0yql2i0", [
@@ -4776,17 +4767,17 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4776
4767
  state
4777
4768
  ]));
4778
4769
  useOn("qvisible", /* @__PURE__ */ inlinedQrl((event, element) => {
4779
- var _a2, _b2, _c2, _d2;
4770
+ var _a, _b, _c, _d;
4780
4771
  if (isBrowser()) {
4781
4772
  if (isEditing()) {
4782
4773
  if (element)
4783
4774
  element.dispatchEvent(new CustomEvent("initeditingbldr"));
4784
4775
  }
4785
- const shouldTrackImpression = ((_a2 = element.attributes.getNamedItem("shouldTrack")) == null ? void 0 : _a2.value) === "true";
4776
+ const shouldTrackImpression = ((_a = element.attributes.getNamedItem("shouldTrack")) == null ? void 0 : _a.value) === "true";
4786
4777
  if (shouldTrackImpression) {
4787
- const variationId = (_b2 = element.attributes.getNamedItem("variationId")) == null ? void 0 : _b2.value;
4788
- const contentId = (_c2 = element.attributes.getNamedItem("contentId")) == null ? void 0 : _c2.value;
4789
- const apiKeyProp = (_d2 = element.attributes.getNamedItem("apiKey")) == null ? void 0 : _d2.value;
4778
+ const variationId = (_b = element.attributes.getNamedItem("variationId")) == null ? void 0 : _b.value;
4779
+ const contentId = (_c = element.attributes.getNamedItem("contentId")) == null ? void 0 : _c.value;
4780
+ const apiKeyProp = (_d = element.attributes.getNamedItem("apiKey")) == null ? void 0 : _d.value;
4790
4781
  _track({
4791
4782
  type: "impression",
4792
4783
  canTrack: true,
@@ -4824,20 +4815,14 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4824
4815
  props,
4825
4816
  state
4826
4817
  ]));
4827
- useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
4828
- const [state2] = useLexicalScope();
4829
- track2(() => state2.shouldSendResetCookie);
4830
- }, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
4831
- state
4832
- ]));
4833
4818
  useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
4834
4819
  const [elementRef2, props2, state2] = useLexicalScope();
4835
4820
  track2(() => {
4836
- var _a2, _b2;
4837
- return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
4821
+ var _a, _b;
4822
+ return (_b = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.jsCode;
4838
4823
  });
4839
4824
  evaluateJsCode(props2);
4840
- }, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
4825
+ }, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
4841
4826
  elementRef,
4842
4827
  props,
4843
4828
  state
@@ -4845,11 +4830,11 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4845
4830
  useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
4846
4831
  const [elementRef2, props2, state2] = useLexicalScope();
4847
4832
  track2(() => {
4848
- var _a2, _b2;
4849
- return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.httpRequests;
4833
+ var _a, _b;
4834
+ return (_b = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests;
4850
4835
  });
4851
4836
  runHttpRequests(props2, state2, elementRef2);
4852
- }, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
4837
+ }, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
4853
4838
  elementRef,
4854
4839
  props,
4855
4840
  state
@@ -4858,7 +4843,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4858
4843
  const [elementRef2, props2, state2] = useLexicalScope();
4859
4844
  track2(() => props2.builderContextSignal.rootState);
4860
4845
  emitStateUpdate(props2);
4861
- }, "EnableEditor_component_useTask_5_24QxS0r0KF8", [
4846
+ }, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
4862
4847
  elementRef,
4863
4848
  props,
4864
4849
  state
@@ -4868,7 +4853,7 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4868
4853
  track2(() => props2.data);
4869
4854
  if (props2.data)
4870
4855
  mergeNewRootState(props2, state2, elementRef2, props2.data);
4871
- }, "EnableEditor_component_useTask_6_0CaFTUOgv08", [
4856
+ }, "EnableEditor_component_useTask_5_24QxS0r0KF8", [
4872
4857
  elementRef,
4873
4858
  props,
4874
4859
  state
@@ -4880,37 +4865,86 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
4880
4865
  mergeNewRootState(props2, state2, elementRef2, {
4881
4866
  locale: props2.locale
4882
4867
  });
4883
- }, "EnableEditor_component_useTask_7_Zh51H45HHnM", [
4868
+ }, "EnableEditor_component_useTask_6_0CaFTUOgv08", [
4884
4869
  elementRef,
4885
4870
  props,
4886
4871
  state
4887
4872
  ]));
4888
4873
  return /* @__PURE__ */ _jsxC(Fragment, {
4889
- children: props.builderContextSignal.content ? /* @__PURE__ */ createElement(state.ContentWrapper, {
4890
- apiKey: props.apiKey,
4891
- contentId: (_a = props.builderContextSignal.content) == null ? void 0 : _a.id,
4892
- variationId: (_b = props.builderContextSignal.content) == null ? void 0 : _b.testVariationId,
4893
- shouldTrack: String(props.builderContextSignal.content && getDefaultCanTrack(props.canTrack)),
4894
- key: state.forceReRenderCount,
4895
- ref: elementRef,
4874
+ children: props.builderContextSignal.content ? /* @__PURE__ */ _jsxC(state.ContentWrapper, {
4875
+ get apiKey() {
4876
+ return props.apiKey;
4877
+ },
4878
+ get contentId() {
4879
+ var _a;
4880
+ return (_a = props.builderContextSignal.content) == null ? void 0 : _a.id;
4881
+ },
4882
+ get variationId() {
4883
+ var _a;
4884
+ return (_a = props.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
4885
+ },
4896
4886
  onClick$: /* @__PURE__ */ inlinedQrl((event) => {
4897
4887
  const [elementRef2, props2, state2] = useLexicalScope();
4898
4888
  return onClick(props2, state2, elementRef2, event);
4899
- }, "EnableEditor_component__Fragment__createElement_PT7eU9x80Lw", [
4889
+ }, "EnableEditor_component__Fragment_onClick_b4nYT3DrjEk", [
4900
4890
  elementRef,
4901
4891
  props,
4902
4892
  state
4903
4893
  ]),
4904
- "builder-content-id": (_c = props.builderContextSignal.content) == null ? void 0 : _c.id,
4905
- "builder-model": props.model,
4894
+ ref: elementRef,
4895
+ shouldTrack: String(props.builderContextSignal.content && getDefaultCanTrack(props.canTrack)),
4896
+ get "builder-content-id"() {
4897
+ var _a;
4898
+ return (_a = props.builderContextSignal.content) == null ? void 0 : _a.id;
4899
+ },
4900
+ get "builder-model"() {
4901
+ return props.model;
4902
+ },
4906
4903
  ...props.showContent ? {} : {
4907
4904
  hidden: true,
4908
4905
  "aria-hidden": true
4909
4906
  },
4910
4907
  ...props.contentWrapperProps,
4911
- class: `variant-${((_d = props.content) == null ? void 0 : _d.testVariationId) || ((_e = props.content) == null ? void 0 : _e.id)}`
4912
- }, /* @__PURE__ */ _jsxC(Slot$1, null, 3, "06_0")) : null
4913
- }, 1, "06_1");
4908
+ get class() {
4909
+ var _a, _b;
4910
+ return `variant-${((_a = props.content) == null ? void 0 : _a.testVariationId) || ((_b = props.content) == null ? void 0 : _b.id)}`;
4911
+ },
4912
+ children: /* @__PURE__ */ _jsxC(Slot$1, null, 3, "06_0"),
4913
+ [_IMMUTABLE]: {
4914
+ apiKey: _fnSignal((p0) => p0.apiKey, [
4915
+ props
4916
+ ], "p0.apiKey"),
4917
+ "builder-content-id": _fnSignal((p0) => {
4918
+ var _a;
4919
+ return (_a = p0.builderContextSignal.content) == null ? void 0 : _a.id;
4920
+ }, [
4921
+ props
4922
+ ], "p0.builderContextSignal.content?.id"),
4923
+ "builder-model": _fnSignal((p0) => p0.model, [
4924
+ props
4925
+ ], "p0.model"),
4926
+ class: _fnSignal((p0) => {
4927
+ var _a, _b;
4928
+ return `variant-${((_a = p0.content) == null ? void 0 : _a.testVariationId) || ((_b = p0.content) == null ? void 0 : _b.id)}`;
4929
+ }, [
4930
+ props
4931
+ ], "`variant-${p0.content?.testVariationId||p0.content?.id}`"),
4932
+ contentId: _fnSignal((p0) => {
4933
+ var _a;
4934
+ return (_a = p0.builderContextSignal.content) == null ? void 0 : _a.id;
4935
+ }, [
4936
+ props
4937
+ ], "p0.builderContextSignal.content?.id"),
4938
+ ref: _IMMUTABLE,
4939
+ variationId: _fnSignal((p0) => {
4940
+ var _a;
4941
+ return (_a = p0.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
4942
+ }, [
4943
+ props
4944
+ ], "p0.builderContextSignal.content?.testVariationId")
4945
+ }
4946
+ }, 0, "06_1") : null
4947
+ }, 1, "06_2");
4914
4948
  }, "EnableEditor_component_ko1mO8oaj8k"));
4915
4949
  const getCssFromFont = (font) => {
4916
4950
  var _a;
@@ -4956,17 +4990,7 @@ const getCss = ({ cssCode, contentId }) => {
4956
4990
  return cssCode;
4957
4991
  return (cssCode == null ? void 0 : cssCode.replace(/&/g, `div[builder-content-id="${contentId}"]`)) || "";
4958
4992
  };
4959
- const ContentStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4960
- const state = useStore({
4961
- injectedStyles: `
4962
- ${getCss({
4963
- cssCode: props.cssCode,
4964
- contentId: props.contentId
4965
- })}
4966
- ${getFontCss({
4967
- customFonts: props.customFonts
4968
- })}
4969
-
4993
+ const DEFAULT_STYLES = `
4970
4994
  .builder-button {
4971
4995
  all: unset;
4972
4996
  }
@@ -4983,6 +5007,21 @@ ${getFontCss({
4983
5007
  text-align: inherit;
4984
5008
  font-family: inherit;
4985
5009
  }
5010
+ `;
5011
+ const getDefaultStyles = (isNested) => {
5012
+ return !isNested ? DEFAULT_STYLES : "";
5013
+ };
5014
+ const ContentStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
5015
+ const state = useStore({
5016
+ injectedStyles: `
5017
+ ${getCss({
5018
+ cssCode: props.cssCode,
5019
+ contentId: props.contentId
5020
+ })}
5021
+ ${getFontCss({
5022
+ customFonts: props.customFonts
5023
+ })}
5024
+ ${getDefaultStyles(props.isNestedRender)}
4986
5025
  `.trim()
4987
5026
  });
4988
5027
  return /* @__PURE__ */ _jsxC(InlinedStyles, {
@@ -5130,6 +5169,9 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
5130
5169
  }
5131
5170
  }, 3, "LQ_0") : null,
5132
5171
  /* @__PURE__ */ _jsxC(ContentStyles, {
5172
+ get isNestedRender() {
5173
+ return props.isNestedRender;
5174
+ },
5133
5175
  get contentId() {
5134
5176
  var _a2;
5135
5177
  return (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.id;
@@ -5160,7 +5202,10 @@ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl
5160
5202
  return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.customFonts;
5161
5203
  }, [
5162
5204
  state
5163
- ], "p0.builderContextSignal.content?.data?.customFonts")
5205
+ ], "p0.builderContextSignal.content?.data?.customFonts"),
5206
+ isNestedRender: _fnSignal((p0) => p0.isNestedRender, [
5207
+ props
5208
+ ], "p0.isNestedRender")
5164
5209
  }
5165
5210
  }, 3, "LQ_1"),
5166
5211
  /* @__PURE__ */ _jsxC(Blocks, {
@@ -5282,7 +5327,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
5282
5327
  ]));
5283
5328
  return /* @__PURE__ */ _jsxC(Fragment$1, {
5284
5329
  children: [
5285
- !props.__isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(InlinedScript, {
5330
+ !props.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(InlinedScript, {
5286
5331
  get scriptStr() {
5287
5332
  return getScriptString();
5288
5333
  },
@@ -5324,6 +5369,9 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
5324
5369
  }, 3, "XM_2"),
5325
5370
  (getVariants(props.content) || []).map((variant) => {
5326
5371
  return /* @__PURE__ */ _jsxC(ContentComponent, {
5372
+ get isNestedRender() {
5373
+ return props.isNestedRender;
5374
+ },
5327
5375
  content: variant,
5328
5376
  showContent: false,
5329
5377
  get model() {
@@ -5408,6 +5456,9 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
5408
5456
  enrich: _fnSignal((p0) => p0.enrich, [
5409
5457
  props
5410
5458
  ], "p0.enrich"),
5459
+ isNestedRender: _fnSignal((p0) => p0.isNestedRender, [
5460
+ props
5461
+ ], "p0.isNestedRender"),
5411
5462
  isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
5412
5463
  state
5413
5464
  ], "p0.shouldRenderVariants"),
@@ -5430,6 +5481,9 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
5430
5481
  ]
5431
5482
  }, 1, "XM_3") : null,
5432
5483
  /* @__PURE__ */ _jsxC(ContentComponent, {
5484
+ get isNestedRender() {
5485
+ return props.isNestedRender;
5486
+ },
5433
5487
  get content() {
5434
5488
  return defaultContent.value;
5435
5489
  },
@@ -5519,6 +5573,9 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
5519
5573
  enrich: _fnSignal((p0) => p0.enrich, [
5520
5574
  props
5521
5575
  ], "p0.enrich"),
5576
+ isNestedRender: _fnSignal((p0) => p0.isNestedRender, [
5577
+ props
5578
+ ], "p0.isNestedRender"),
5522
5579
  isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
5523
5580
  state
5524
5581
  ], "p0.shouldRenderVariants"),
@@ -5597,6 +5654,7 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
5597
5654
  return /* @__PURE__ */ _jsxS("div", {
5598
5655
  ...props.attributes,
5599
5656
  children: /* @__PURE__ */ _jsxC(ContentVariants, {
5657
+ isNestedRender: true,
5600
5658
  get apiVersion() {
5601
5659
  return props.builderContext.apiVersion;
5602
5660
  },
@@ -5668,6 +5726,7 @@ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
5668
5726
  props,
5669
5727
  state
5670
5728
  ], "{...p0.symbol?.data,...p0.builderContext.localState,...p1.contentToUse?.data?.state}"),
5729
+ isNestedRender: _IMMUTABLE,
5671
5730
  linkComponent: _fnSignal((p0) => p0.builderLinkComponent, [
5672
5731
  props
5673
5732
  ], "p0.builderLinkComponent"),