@builder.io/sdk-solid 3.0.6 → 4.0.0

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/lib/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { delegateEvents, createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, Dynamic, memo, use } from 'solid-js/web';
1
+ import { delegateEvents, createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, use, Dynamic, memo } from 'solid-js/web';
2
2
  import { createContext, useContext, Show, For, createMemo, createSignal, onMount, createEffect, on } from 'solid-js';
3
3
  import { createRequire } from 'node:module';
4
4
 
@@ -1099,8 +1099,13 @@ var provideBuilderContext = (block, context) => {
1099
1099
 
1100
1100
  // src/constants/device-sizes.ts
1101
1101
  var SIZES = {
1102
+ xsmall: {
1103
+ min: 0,
1104
+ default: 160,
1105
+ max: 320
1106
+ },
1102
1107
  small: {
1103
- min: 320,
1108
+ min: 321,
1104
1109
  default: 321,
1105
1110
  max: 640
1106
1111
  },
@@ -1116,15 +1121,28 @@ var SIZES = {
1116
1121
  }
1117
1122
  };
1118
1123
  var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
1119
- var getSizesForBreakpoints = ({
1120
- small,
1121
- medium
1122
- }) => {
1124
+ var getSizesForBreakpoints = (breakpoints) => {
1123
1125
  const newSizes = fastClone(SIZES);
1126
+ if (!breakpoints) {
1127
+ return newSizes;
1128
+ }
1129
+ const {
1130
+ xsmall,
1131
+ small,
1132
+ medium
1133
+ } = breakpoints;
1134
+ if (xsmall) {
1135
+ const xsmallMin = Math.floor(xsmall / 2);
1136
+ newSizes.xsmall = {
1137
+ max: xsmall,
1138
+ min: xsmallMin,
1139
+ default: xsmallMin + 1
1140
+ };
1141
+ }
1124
1142
  if (!small || !medium) {
1125
1143
  return newSizes;
1126
1144
  }
1127
- const smallMin = Math.floor(small / 2);
1145
+ const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
1128
1146
  newSizes.small = {
1129
1147
  max: small,
1130
1148
  min: smallMin,
@@ -1182,9 +1200,11 @@ function BlockStyles(props) {
1182
1200
  const styles = processedBlock.responsiveStyles;
1183
1201
  const content = props.context.content;
1184
1202
  const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
1203
+ const contentHasXSmallBreakpoint = Boolean(content?.meta?.breakpoints?.xsmall);
1185
1204
  const largeStyles = styles?.large;
1186
1205
  const mediumStyles = styles?.medium;
1187
1206
  const smallStyles = styles?.small;
1207
+ const xsmallStyles = styles?.xsmall;
1188
1208
  const className = processedBlock.id;
1189
1209
  if (!className) {
1190
1210
  return "";
@@ -1203,6 +1223,11 @@ function BlockStyles(props) {
1203
1223
  styles: smallStyles,
1204
1224
  mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
1205
1225
  }) : "";
1226
+ const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
1227
+ className,
1228
+ styles: xsmallStyles,
1229
+ mediaQuery: getMaxWidthQueryForSize("xsmall", sizesWithUpdatedBreakpoints)
1230
+ }) : "";
1206
1231
  const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
1207
1232
  let hoverStylesClass = "";
1208
1233
  if (hoverAnimation) {
@@ -1216,7 +1241,7 @@ function BlockStyles(props) {
1216
1241
  }
1217
1242
  }) || "";
1218
1243
  }
1219
- return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
1244
+ return [largeStylesClass, mediumStylesClass, smallStylesClass, xsmallStylesClass, hoverStylesClass].join(" ");
1220
1245
  });
1221
1246
  return createComponent(Show, {
1222
1247
  get when() {
@@ -5184,10 +5209,10 @@ var componentInfo20 = {
5184
5209
  builderBlock: true
5185
5210
  }
5186
5211
  };
5187
- var _tmpl$21 = /* @__PURE__ */ template(`<source type=video/mp4>`);
5188
- var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
5189
- var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
5212
+ var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
5213
+ var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
5190
5214
  function Video(props) {
5215
+ const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
5191
5216
  const videoProps = createMemo(() => {
5192
5217
  return {
5193
5218
  ...props.autoPlay === true ? {
@@ -5212,12 +5237,41 @@ function Video(props) {
5212
5237
  ...videoProps()
5213
5238
  };
5214
5239
  });
5240
+ let videoRef;
5241
+ onMount(() => {
5242
+ if (props.lazyLoad) {
5243
+ const oberver = new IntersectionObserver(function(entries) {
5244
+ entries.forEach(function(entry) {
5245
+ if (!entry.isIntersecting)
5246
+ return;
5247
+ const videoElement = entry.target;
5248
+ try {
5249
+ Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
5250
+ const src = source.dataset.src;
5251
+ if (src) {
5252
+ source.src = src;
5253
+ }
5254
+ });
5255
+ videoElement.load();
5256
+ oberver.unobserve(videoElement);
5257
+ } catch (error2) {
5258
+ }
5259
+ });
5260
+ });
5261
+ if (videoRef) {
5262
+ oberver.observe(videoRef);
5263
+ }
5264
+ setLazyVideoObserver(oberver);
5265
+ }
5266
+ });
5215
5267
  return (() => {
5216
- const _el$ = _tmpl$35(), _el$2 = _el$.firstChild;
5268
+ const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
5217
5269
  _el$.style.setProperty("position", "relative");
5270
+ const _ref$ = videoRef;
5271
+ typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
5218
5272
  spread(_el$2, mergeProps(spreadProps, {
5219
5273
  get preload() {
5220
- return props.preload || "metadata";
5274
+ return props.lazyLoad ? "none" : props.preload || "metadata";
5221
5275
  },
5222
5276
  get style() {
5223
5277
  return {
@@ -5234,29 +5288,21 @@ function Video(props) {
5234
5288
  } : null
5235
5289
  };
5236
5290
  },
5237
- get src() {
5238
- return props.video || "no-src";
5239
- },
5240
5291
  get poster() {
5241
5292
  return props.posterImage;
5242
5293
  }
5243
5294
  }), false, true);
5244
- insert(_el$2, createComponent(Show, {
5245
- get when() {
5246
- return !props.lazyLoad;
5247
- },
5248
- get children() {
5249
- const _el$3 = _tmpl$21();
5250
- effect(() => setAttribute(_el$3, "src", props.video));
5251
- return _el$3;
5252
- }
5253
- }));
5295
+ spread(_el$3, mergeProps(() => props.lazyLoad ? {
5296
+ "data-src": props.video
5297
+ } : {
5298
+ src: props.video
5299
+ }), false, false);
5254
5300
  insert(_el$, createComponent(Show, {
5255
5301
  get when() {
5256
5302
  return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
5257
5303
  },
5258
5304
  get children() {
5259
- const _el$4 = _tmpl$29();
5305
+ const _el$4 = _tmpl$21();
5260
5306
  _el$4.style.setProperty("width", "100%");
5261
5307
  _el$4.style.setProperty("pointer-events", "none");
5262
5308
  _el$4.style.setProperty("font-size", "0px");
@@ -5269,7 +5315,7 @@ function Video(props) {
5269
5315
  return props.builderBlock?.children?.length && props.fitContent;
5270
5316
  },
5271
5317
  get children() {
5272
- const _el$5 = _tmpl$29();
5318
+ const _el$5 = _tmpl$21();
5273
5319
  _el$5.style.setProperty("display", "flex");
5274
5320
  _el$5.style.setProperty("flex-direction", "column");
5275
5321
  _el$5.style.setProperty("align-items", "stretch");
@@ -5282,7 +5328,7 @@ function Video(props) {
5282
5328
  return props.builderBlock?.children?.length && !props.fitContent;
5283
5329
  },
5284
5330
  get children() {
5285
- const _el$6 = _tmpl$29();
5331
+ const _el$6 = _tmpl$21();
5286
5332
  _el$6.style.setProperty("pointer-events", "none");
5287
5333
  _el$6.style.setProperty("display", "flex");
5288
5334
  _el$6.style.setProperty("flex-direction", "column");
@@ -5439,7 +5485,7 @@ function getPreviewContent(_searchParams) {
5439
5485
  }
5440
5486
 
5441
5487
  // src/constants/sdk-version.ts
5442
- var SDK_VERSION = "3.0.6";
5488
+ var SDK_VERSION = "4.0.0";
5443
5489
 
5444
5490
  // src/helpers/sdk-headers.ts
5445
5491
  var getSdkHeaders = () => ({
@@ -6041,7 +6087,7 @@ var registerInsertMenu = () => {
6041
6087
  });
6042
6088
  };
6043
6089
  var isSetupForEditing = false;
6044
- var setupBrowserForEditing = (options = {}) => {
6090
+ var setupBrowserForEditing = (options) => {
6045
6091
  if (isSetupForEditing) {
6046
6092
  return;
6047
6093
  }
@@ -6057,6 +6103,9 @@ var setupBrowserForEditing = (options = {}) => {
6057
6103
  // scope our '+ add block' button styling
6058
6104
  supportsAddBlockScoping: true,
6059
6105
  supportsCustomBreakpoints: true,
6106
+ modelName: options.modelName,
6107
+ apiKey: options.apiKey,
6108
+ supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
6060
6109
  blockLevelPersonalization: true
6061
6110
  }
6062
6111
  }, "*");
@@ -6161,13 +6210,21 @@ var createEditorListener = ({
6161
6210
  }
6162
6211
  };
6163
6212
  };
6164
- var subscribeToEditor = (model, callback, options) => {
6213
+ var subscribeToEditor = ({
6214
+ model,
6215
+ apiKey,
6216
+ callback,
6217
+ trustedHosts
6218
+ }) => {
6165
6219
  if (!isBrowser) {
6166
6220
  logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
6167
6221
  return () => {
6168
6222
  };
6169
6223
  }
6170
- setupBrowserForEditing();
6224
+ setupBrowserForEditing({
6225
+ modelName: model,
6226
+ apiKey
6227
+ });
6171
6228
  const listener = createEditorListener({
6172
6229
  callbacks: {
6173
6230
  contentUpdate: callback,
@@ -6177,7 +6234,7 @@ var subscribeToEditor = (model, callback, options) => {
6177
6234
  }
6178
6235
  },
6179
6236
  model,
6180
- trustedHosts: options?.trustedHosts
6237
+ trustedHosts
6181
6238
  });
6182
6239
  window.addEventListener("message", listener);
6183
6240
  return () => {
@@ -6422,10 +6479,12 @@ function EnableEditor(props) {
6422
6479
  } : {},
6423
6480
  ...props.trustedHosts ? {
6424
6481
  trustedHosts: props.trustedHosts
6425
- } : {}
6482
+ } : {},
6483
+ modelName: props.model ?? "",
6484
+ apiKey: props.apiKey
6426
6485
  });
6427
6486
  Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
6428
- if (!props.model || !registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
6487
+ if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
6429
6488
  const message = createRegisterComponentMessage(registeredComponent);
6430
6489
  window.parent?.postMessage(message, "*");
6431
6490
  }
@@ -6453,7 +6512,7 @@ function EnableEditor(props) {
6453
6512
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
6454
6513
  if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
6455
6514
  fetchOneEntry({
6456
- model: props.model || "",
6515
+ model: props.model,
6457
6516
  apiKey: props.apiKey,
6458
6517
  apiVersion: props.builderContextSignal.apiVersion,
6459
6518
  ...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
@@ -6647,7 +6706,7 @@ function ContentComponent(props) {
6647
6706
  BlocksWrapper: props.blocksWrapper || "div",
6648
6707
  BlocksWrapperProps: props.blocksWrapperProps || {},
6649
6708
  nonce: props.nonce || "",
6650
- model: props.model || ""
6709
+ model: props.model
6651
6710
  });
6652
6711
  function contentSetState(newRootState) {
6653
6712
  setBuilderContextSignal((PREVIOUS_VALUE) => ({
@@ -7088,7 +7147,7 @@ function Symbol(props) {
7088
7147
  return props.builderContext.canTrack;
7089
7148
  },
7090
7149
  get model() {
7091
- return props.symbol?.model;
7150
+ return props.symbol?.model ?? "";
7092
7151
  },
7093
7152
  get content() {
7094
7153
  return contentToUse();
@@ -1099,8 +1099,13 @@ import { Show as Show2, createMemo } from "solid-js";
1099
1099
 
1100
1100
  // src/constants/device-sizes.ts
1101
1101
  var SIZES = {
1102
+ xsmall: {
1103
+ min: 0,
1104
+ default: 160,
1105
+ max: 320
1106
+ },
1102
1107
  small: {
1103
- min: 320,
1108
+ min: 321,
1104
1109
  default: 321,
1105
1110
  max: 640
1106
1111
  },
@@ -1116,15 +1121,28 @@ var SIZES = {
1116
1121
  }
1117
1122
  };
1118
1123
  var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
1119
- var getSizesForBreakpoints = ({
1120
- small,
1121
- medium
1122
- }) => {
1124
+ var getSizesForBreakpoints = (breakpoints) => {
1123
1125
  const newSizes = fastClone(SIZES);
1126
+ if (!breakpoints) {
1127
+ return newSizes;
1128
+ }
1129
+ const {
1130
+ xsmall,
1131
+ small,
1132
+ medium
1133
+ } = breakpoints;
1134
+ if (xsmall) {
1135
+ const xsmallMin = Math.floor(xsmall / 2);
1136
+ newSizes.xsmall = {
1137
+ max: xsmall,
1138
+ min: xsmallMin,
1139
+ default: xsmallMin + 1
1140
+ };
1141
+ }
1124
1142
  if (!small || !medium) {
1125
1143
  return newSizes;
1126
1144
  }
1127
- const smallMin = Math.floor(small / 2);
1145
+ const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
1128
1146
  newSizes.small = {
1129
1147
  max: small,
1130
1148
  min: smallMin,
@@ -1175,9 +1193,13 @@ function BlockStyles(props) {
1175
1193
  const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(
1176
1194
  content?.meta?.breakpoints || {}
1177
1195
  );
1196
+ const contentHasXSmallBreakpoint = Boolean(
1197
+ content?.meta?.breakpoints?.xsmall
1198
+ );
1178
1199
  const largeStyles = styles?.large;
1179
1200
  const mediumStyles = styles?.medium;
1180
1201
  const smallStyles = styles?.small;
1202
+ const xsmallStyles = styles?.xsmall;
1181
1203
  const className = processedBlock.id;
1182
1204
  if (!className) {
1183
1205
  return "";
@@ -1202,6 +1224,14 @@ function BlockStyles(props) {
1202
1224
  sizesWithUpdatedBreakpoints
1203
1225
  )
1204
1226
  }) : "";
1227
+ const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
1228
+ className,
1229
+ styles: xsmallStyles,
1230
+ mediaQuery: getMaxWidthQueryForSize(
1231
+ "xsmall",
1232
+ sizesWithUpdatedBreakpoints
1233
+ )
1234
+ }) : "";
1205
1235
  const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
1206
1236
  let hoverStylesClass = "";
1207
1237
  if (hoverAnimation) {
@@ -1221,6 +1251,7 @@ function BlockStyles(props) {
1221
1251
  largeStylesClass,
1222
1252
  mediumStylesClass,
1223
1253
  smallStylesClass,
1254
+ xsmallStylesClass,
1224
1255
  hoverStylesClass
1225
1256
  ].join(" ");
1226
1257
  });
@@ -2048,10 +2079,10 @@ function SectionComponent(props) {
2048
2079
  var section_default = SectionComponent;
2049
2080
 
2050
2081
  // src/blocks/symbol/symbol.tsx
2051
- import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
2082
+ import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
2052
2083
 
2053
2084
  // src/components/content-variants/content-variants.tsx
2054
- import { Show as Show16, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
2085
+ import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
2055
2086
 
2056
2087
  // src/helpers/url.ts
2057
2088
  var getTopLevelDomain = (host) => {
@@ -4694,8 +4725,9 @@ var componentInfo20 = {
4694
4725
  };
4695
4726
 
4696
4727
  // src/blocks/video/video.tsx
4697
- import { Show as Show13, createMemo as createMemo15 } from "solid-js";
4728
+ import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
4698
4729
  function Video(props) {
4730
+ const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
4699
4731
  const videoProps = createMemo15(() => {
4700
4732
  return {
4701
4733
  ...props.autoPlay === true ? {
@@ -4720,6 +4752,35 @@ function Video(props) {
4720
4752
  ...videoProps()
4721
4753
  };
4722
4754
  });
4755
+ let videoRef;
4756
+ onMount6(() => {
4757
+ if (props.lazyLoad) {
4758
+ const oberver = new IntersectionObserver(function(entries) {
4759
+ entries.forEach(function(entry) {
4760
+ if (!entry.isIntersecting)
4761
+ return;
4762
+ const videoElement = entry.target;
4763
+ try {
4764
+ Array.from(videoElement.children).filter(
4765
+ (child) => child instanceof HTMLElement && child.tagName === "SOURCE"
4766
+ ).forEach((source) => {
4767
+ const src = source.dataset.src;
4768
+ if (src) {
4769
+ source.src = src;
4770
+ }
4771
+ });
4772
+ videoElement.load();
4773
+ oberver.unobserve(videoElement);
4774
+ } catch (error2) {
4775
+ }
4776
+ });
4777
+ });
4778
+ if (videoRef) {
4779
+ oberver.observe(videoRef);
4780
+ }
4781
+ setLazyVideoObserver(oberver);
4782
+ }
4783
+ });
4723
4784
  return <><div
4724
4785
  style={{
4725
4786
  position: "relative"
@@ -4728,7 +4789,8 @@ function Video(props) {
4728
4789
  <video
4729
4790
  class="builder-video"
4730
4791
  {...spreadProps()}
4731
- preload={props.preload || "metadata"}
4792
+ ref={videoRef}
4793
+ preload={props.lazyLoad ? "none" : props.preload || "metadata"}
4732
4794
  style={{
4733
4795
  width: "100%",
4734
4796
  height: "100%",
@@ -4742,9 +4804,15 @@ function Video(props) {
4742
4804
  position: "absolute"
4743
4805
  } : null
4744
4806
  }}
4745
- src={props.video || "no-src"}
4746
4807
  poster={props.posterImage}
4747
- ><Show13 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show13></video>
4808
+ ><source
4809
+ type="video/mp4"
4810
+ {...props.lazyLoad ? {
4811
+ "data-src": props.video
4812
+ } : {
4813
+ src: props.video
4814
+ }}
4815
+ /></video>
4748
4816
  <Show13
4749
4817
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
4750
4818
  ><div
@@ -4914,7 +4982,7 @@ var getUpdateVariantVisibilityScript = ({
4914
4982
  // src/components/content/components/enable-editor.tsx
4915
4983
  import {
4916
4984
  Show as Show14,
4917
- onMount as onMount6,
4985
+ onMount as onMount7,
4918
4986
  on as on3,
4919
4987
  createEffect as createEffect3,
4920
4988
  createMemo as createMemo16,
@@ -4928,7 +4996,7 @@ function getPreviewContent(_searchParams) {
4928
4996
  }
4929
4997
 
4930
4998
  // src/constants/sdk-version.ts
4931
- var SDK_VERSION = "3.0.6";
4999
+ var SDK_VERSION = "4.0.0";
4932
5000
 
4933
5001
  // src/helpers/sdk-headers.ts
4934
5002
  var getSdkHeaders = () => ({
@@ -5530,7 +5598,7 @@ var registerInsertMenu = () => {
5530
5598
  });
5531
5599
  };
5532
5600
  var isSetupForEditing = false;
5533
- var setupBrowserForEditing = (options = {}) => {
5601
+ var setupBrowserForEditing = (options) => {
5534
5602
  if (isSetupForEditing) {
5535
5603
  return;
5536
5604
  }
@@ -5546,6 +5614,9 @@ var setupBrowserForEditing = (options = {}) => {
5546
5614
  // scope our '+ add block' button styling
5547
5615
  supportsAddBlockScoping: true,
5548
5616
  supportsCustomBreakpoints: true,
5617
+ modelName: options.modelName,
5618
+ apiKey: options.apiKey,
5619
+ supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
5549
5620
  blockLevelPersonalization: true
5550
5621
  }
5551
5622
  }, "*");
@@ -5650,13 +5721,21 @@ var createEditorListener = ({
5650
5721
  }
5651
5722
  };
5652
5723
  };
5653
- var subscribeToEditor = (model, callback, options) => {
5724
+ var subscribeToEditor = ({
5725
+ model,
5726
+ apiKey,
5727
+ callback,
5728
+ trustedHosts
5729
+ }) => {
5654
5730
  if (!isBrowser) {
5655
5731
  logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
5656
5732
  return () => {
5657
5733
  };
5658
5734
  }
5659
- setupBrowserForEditing();
5735
+ setupBrowserForEditing({
5736
+ modelName: model,
5737
+ apiKey
5738
+ });
5660
5739
  const listener = createEditorListener({
5661
5740
  callbacks: {
5662
5741
  contentUpdate: callback,
@@ -5666,7 +5745,7 @@ var subscribeToEditor = (model, callback, options) => {
5666
5745
  }
5667
5746
  },
5668
5747
  model,
5669
- trustedHosts: options?.trustedHosts
5748
+ trustedHosts
5670
5749
  });
5671
5750
  window.addEventListener("message", listener);
5672
5751
  return () => {
@@ -5906,7 +5985,7 @@ function EnableEditor(props) {
5906
5985
  let elementRef;
5907
5986
  runHttpRequests();
5908
5987
  emitStateUpdate();
5909
- onMount6(() => {
5988
+ onMount7(() => {
5910
5989
  if (isBrowser()) {
5911
5990
  if (isEditing() && !props.isNestedRender) {
5912
5991
  window.addEventListener("message", processMessage);
@@ -5920,12 +5999,14 @@ function EnableEditor(props) {
5920
5999
  } : {},
5921
6000
  ...props.trustedHosts ? {
5922
6001
  trustedHosts: props.trustedHosts
5923
- } : {}
6002
+ } : {},
6003
+ modelName: props.model ?? "",
6004
+ apiKey: props.apiKey
5924
6005
  });
5925
6006
  Object.values(
5926
6007
  props.builderContextSignal.componentInfos
5927
6008
  ).forEach((registeredComponent) => {
5928
- if (!props.model || !registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
6009
+ if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
5929
6010
  const message = createRegisterComponentMessage(registeredComponent);
5930
6011
  window.parent?.postMessage(message, "*");
5931
6012
  }
@@ -5958,7 +6039,7 @@ function EnableEditor(props) {
5958
6039
  const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
5959
6040
  if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
5960
6041
  fetchOneEntry({
5961
- model: props.model || "",
6042
+ model: props.model,
5962
6043
  apiKey: props.apiKey,
5963
6044
  apiVersion: props.builderContextSignal.apiVersion,
5964
6045
  ...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
@@ -6146,7 +6227,7 @@ function ContentComponent(props) {
6146
6227
  BlocksWrapper: props.blocksWrapper || "div",
6147
6228
  BlocksWrapperProps: props.blocksWrapperProps || {},
6148
6229
  nonce: props.nonce || "",
6149
- model: props.model || ""
6230
+ model: props.model
6150
6231
  });
6151
6232
  function contentSetState(newRootState) {
6152
6233
  setBuilderContextSignal((PREVIOUS_VALUE) => ({
@@ -6251,7 +6332,7 @@ function ContentVariants(props) {
6251
6332
  canTrack: getDefaultCanTrack(props.canTrack)
6252
6333
  });
6253
6334
  });
6254
- onMount7(() => {
6335
+ onMount8(() => {
6255
6336
  setShouldRenderVariants(false);
6256
6337
  });
6257
6338
  return <><>
@@ -6381,7 +6462,7 @@ function Symbol(props) {
6381
6462
  }
6382
6463
  });
6383
6464
  }
6384
- onMount8(() => {
6465
+ onMount9(() => {
6385
6466
  });
6386
6467
  const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
6387
6468
  function onUpdateFn_0() {
@@ -6404,7 +6485,7 @@ function Symbol(props) {
6404
6485
  ...contentToUse()?.data?.state
6405
6486
  }}
6406
6487
  canTrack={props.builderContext.canTrack}
6407
- model={props.symbol?.model}
6488
+ model={props.symbol?.model ?? ""}
6408
6489
  content={contentToUse()}
6409
6490
  linkComponent={props.builderLinkComponent}
6410
6491
  blocksWrapper={blocksWrapper()}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-solid",
3
- "version": "3.0.6",
3
+ "version": "4.0.0",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist",