@builder.io/sdk-solid 3.0.7 → 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/dist/index.d.ts +15 -15
- package/lib/browser/dev.js +66 -32
- package/lib/browser/dev.jsx +70 -20
- package/lib/browser/index.js +65 -32
- package/lib/browser/index.jsx +69 -20
- package/lib/edge/dev.js +66 -32
- package/lib/edge/dev.jsx +70 -20
- package/lib/edge/index.js +65 -32
- package/lib/edge/index.jsx +69 -20
- package/lib/node/dev.js +66 -32
- package/lib/node/dev.jsx +70 -20
- package/lib/node/index.js +65 -32
- package/lib/node/index.jsx +69 -20
- package/package.json +1 -1
package/lib/edge/dev.jsx
CHANGED
|
@@ -5099,10 +5099,10 @@ function SectionComponent(props) {
|
|
|
5099
5099
|
var section_default = SectionComponent;
|
|
5100
5100
|
|
|
5101
5101
|
// src/blocks/symbol/symbol.tsx
|
|
5102
|
-
import { onMount as
|
|
5102
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
5103
5103
|
|
|
5104
5104
|
// src/components/content-variants/content-variants.tsx
|
|
5105
|
-
import { Show as Show16, For as For9, onMount as
|
|
5105
|
+
import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
5106
5106
|
|
|
5107
5107
|
// src/helpers/url.ts
|
|
5108
5108
|
var getTopLevelDomain = (host) => {
|
|
@@ -7748,8 +7748,9 @@ var componentInfo20 = {
|
|
|
7748
7748
|
};
|
|
7749
7749
|
|
|
7750
7750
|
// src/blocks/video/video.tsx
|
|
7751
|
-
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
7751
|
+
import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
7752
7752
|
function Video(props) {
|
|
7753
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
7753
7754
|
const videoProps = createMemo15(() => {
|
|
7754
7755
|
return {
|
|
7755
7756
|
...props.autoPlay === true ? {
|
|
@@ -7774,6 +7775,36 @@ function Video(props) {
|
|
|
7774
7775
|
...videoProps()
|
|
7775
7776
|
};
|
|
7776
7777
|
});
|
|
7778
|
+
let videoRef;
|
|
7779
|
+
onMount6(() => {
|
|
7780
|
+
if (props.lazyLoad) {
|
|
7781
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
7782
|
+
entries.forEach(function(entry) {
|
|
7783
|
+
if (!entry.isIntersecting)
|
|
7784
|
+
return;
|
|
7785
|
+
const videoElement = entry.target;
|
|
7786
|
+
try {
|
|
7787
|
+
Array.from(videoElement.children).filter(
|
|
7788
|
+
(child) => child instanceof HTMLElement && child.tagName === "SOURCE"
|
|
7789
|
+
).forEach((source) => {
|
|
7790
|
+
const src = source.dataset.src;
|
|
7791
|
+
if (src) {
|
|
7792
|
+
source.src = src;
|
|
7793
|
+
}
|
|
7794
|
+
});
|
|
7795
|
+
videoElement.load();
|
|
7796
|
+
oberver.unobserve(videoElement);
|
|
7797
|
+
} catch (error) {
|
|
7798
|
+
console.error("Error loading lazy video:", error);
|
|
7799
|
+
}
|
|
7800
|
+
});
|
|
7801
|
+
});
|
|
7802
|
+
if (videoRef) {
|
|
7803
|
+
oberver.observe(videoRef);
|
|
7804
|
+
}
|
|
7805
|
+
setLazyVideoObserver(oberver);
|
|
7806
|
+
}
|
|
7807
|
+
});
|
|
7777
7808
|
return <><div
|
|
7778
7809
|
style={{
|
|
7779
7810
|
position: "relative"
|
|
@@ -7782,7 +7813,8 @@ function Video(props) {
|
|
|
7782
7813
|
<video
|
|
7783
7814
|
class="builder-video"
|
|
7784
7815
|
{...spreadProps()}
|
|
7785
|
-
|
|
7816
|
+
ref={videoRef}
|
|
7817
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
7786
7818
|
style={{
|
|
7787
7819
|
width: "100%",
|
|
7788
7820
|
height: "100%",
|
|
@@ -7796,9 +7828,15 @@ function Video(props) {
|
|
|
7796
7828
|
position: "absolute"
|
|
7797
7829
|
} : null
|
|
7798
7830
|
}}
|
|
7799
|
-
src={props.video || "no-src"}
|
|
7800
7831
|
poster={props.posterImage}
|
|
7801
|
-
><
|
|
7832
|
+
><source
|
|
7833
|
+
type="video/mp4"
|
|
7834
|
+
{...props.lazyLoad ? {
|
|
7835
|
+
"data-src": props.video
|
|
7836
|
+
} : {
|
|
7837
|
+
src: props.video
|
|
7838
|
+
}}
|
|
7839
|
+
/></video>
|
|
7802
7840
|
<Show13
|
|
7803
7841
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
7804
7842
|
><div
|
|
@@ -7968,7 +8006,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
7968
8006
|
// src/components/content/components/enable-editor.tsx
|
|
7969
8007
|
import {
|
|
7970
8008
|
Show as Show14,
|
|
7971
|
-
onMount as
|
|
8009
|
+
onMount as onMount7,
|
|
7972
8010
|
on as on3,
|
|
7973
8011
|
createEffect as createEffect3,
|
|
7974
8012
|
createMemo as createMemo16,
|
|
@@ -7982,7 +8020,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7982
8020
|
}
|
|
7983
8021
|
|
|
7984
8022
|
// src/constants/sdk-version.ts
|
|
7985
|
-
var SDK_VERSION = "
|
|
8023
|
+
var SDK_VERSION = "4.0.0";
|
|
7986
8024
|
|
|
7987
8025
|
// src/helpers/sdk-headers.ts
|
|
7988
8026
|
var getSdkHeaders = () => ({
|
|
@@ -8590,7 +8628,7 @@ var registerInsertMenu = () => {
|
|
|
8590
8628
|
});
|
|
8591
8629
|
};
|
|
8592
8630
|
var isSetupForEditing = false;
|
|
8593
|
-
var setupBrowserForEditing = (options
|
|
8631
|
+
var setupBrowserForEditing = (options) => {
|
|
8594
8632
|
if (isSetupForEditing) {
|
|
8595
8633
|
return;
|
|
8596
8634
|
}
|
|
@@ -8606,6 +8644,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
8606
8644
|
// scope our '+ add block' button styling
|
|
8607
8645
|
supportsAddBlockScoping: true,
|
|
8608
8646
|
supportsCustomBreakpoints: true,
|
|
8647
|
+
modelName: options.modelName,
|
|
8648
|
+
apiKey: options.apiKey,
|
|
8609
8649
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
8610
8650
|
blockLevelPersonalization: true
|
|
8611
8651
|
}
|
|
@@ -8711,13 +8751,21 @@ var createEditorListener = ({
|
|
|
8711
8751
|
}
|
|
8712
8752
|
};
|
|
8713
8753
|
};
|
|
8714
|
-
var subscribeToEditor = (
|
|
8754
|
+
var subscribeToEditor = ({
|
|
8755
|
+
model,
|
|
8756
|
+
apiKey,
|
|
8757
|
+
callback,
|
|
8758
|
+
trustedHosts
|
|
8759
|
+
}) => {
|
|
8715
8760
|
if (!isBrowser) {
|
|
8716
8761
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
8717
8762
|
return () => {
|
|
8718
8763
|
};
|
|
8719
8764
|
}
|
|
8720
|
-
setupBrowserForEditing(
|
|
8765
|
+
setupBrowserForEditing({
|
|
8766
|
+
modelName: model,
|
|
8767
|
+
apiKey
|
|
8768
|
+
});
|
|
8721
8769
|
const listener = createEditorListener({
|
|
8722
8770
|
callbacks: {
|
|
8723
8771
|
contentUpdate: callback,
|
|
@@ -8727,7 +8775,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
8727
8775
|
}
|
|
8728
8776
|
},
|
|
8729
8777
|
model,
|
|
8730
|
-
trustedHosts
|
|
8778
|
+
trustedHosts
|
|
8731
8779
|
});
|
|
8732
8780
|
window.addEventListener("message", listener);
|
|
8733
8781
|
return () => {
|
|
@@ -8968,7 +9016,7 @@ function EnableEditor(props) {
|
|
|
8968
9016
|
let elementRef;
|
|
8969
9017
|
runHttpRequests();
|
|
8970
9018
|
emitStateUpdate();
|
|
8971
|
-
|
|
9019
|
+
onMount7(() => {
|
|
8972
9020
|
if (isBrowser()) {
|
|
8973
9021
|
if (isEditing() && !props.isNestedRender) {
|
|
8974
9022
|
window.addEventListener("message", processMessage);
|
|
@@ -8982,12 +9030,14 @@ function EnableEditor(props) {
|
|
|
8982
9030
|
} : {},
|
|
8983
9031
|
...props.trustedHosts ? {
|
|
8984
9032
|
trustedHosts: props.trustedHosts
|
|
8985
|
-
} : {}
|
|
9033
|
+
} : {},
|
|
9034
|
+
modelName: props.model ?? "",
|
|
9035
|
+
apiKey: props.apiKey
|
|
8986
9036
|
});
|
|
8987
9037
|
Object.values(
|
|
8988
9038
|
props.builderContextSignal.componentInfos
|
|
8989
9039
|
).forEach((registeredComponent) => {
|
|
8990
|
-
if (!
|
|
9040
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
8991
9041
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
8992
9042
|
window.parent?.postMessage(message, "*");
|
|
8993
9043
|
}
|
|
@@ -9020,7 +9070,7 @@ function EnableEditor(props) {
|
|
|
9020
9070
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
9021
9071
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
9022
9072
|
fetchOneEntry({
|
|
9023
|
-
model: props.model
|
|
9073
|
+
model: props.model,
|
|
9024
9074
|
apiKey: props.apiKey,
|
|
9025
9075
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
9026
9076
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -9208,7 +9258,7 @@ function ContentComponent(props) {
|
|
|
9208
9258
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
9209
9259
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
9210
9260
|
nonce: props.nonce || "",
|
|
9211
|
-
model: props.model
|
|
9261
|
+
model: props.model
|
|
9212
9262
|
});
|
|
9213
9263
|
function contentSetState(newRootState) {
|
|
9214
9264
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -9313,7 +9363,7 @@ function ContentVariants(props) {
|
|
|
9313
9363
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
9314
9364
|
});
|
|
9315
9365
|
});
|
|
9316
|
-
|
|
9366
|
+
onMount8(() => {
|
|
9317
9367
|
setShouldRenderVariants(false);
|
|
9318
9368
|
});
|
|
9319
9369
|
return <><>
|
|
@@ -9443,7 +9493,7 @@ function Symbol2(props) {
|
|
|
9443
9493
|
}
|
|
9444
9494
|
});
|
|
9445
9495
|
}
|
|
9446
|
-
|
|
9496
|
+
onMount9(() => {
|
|
9447
9497
|
});
|
|
9448
9498
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
9449
9499
|
function onUpdateFn_0() {
|
|
@@ -9466,7 +9516,7 @@ function Symbol2(props) {
|
|
|
9466
9516
|
...contentToUse()?.data?.state
|
|
9467
9517
|
}}
|
|
9468
9518
|
canTrack={props.builderContext.canTrack}
|
|
9469
|
-
model={props.symbol?.model}
|
|
9519
|
+
model={props.symbol?.model ?? ""}
|
|
9470
9520
|
content={contentToUse()}
|
|
9471
9521
|
linkComponent={props.builderLinkComponent}
|
|
9472
9522
|
blocksWrapper={blocksWrapper()}
|
package/lib/edge/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { delegateEvents, createComponent, spread, mergeProps, insert, effect, setAttribute, className, style, template, Dynamic, memo
|
|
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
|
|
|
4
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -8221,10 +8221,10 @@ var componentInfo20 = {
|
|
|
8221
8221
|
builderBlock: true
|
|
8222
8222
|
}
|
|
8223
8223
|
};
|
|
8224
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
8225
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
8226
|
-
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
8224
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
8225
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
8227
8226
|
function Video(props) {
|
|
8227
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
8228
8228
|
const videoProps = createMemo(() => {
|
|
8229
8229
|
return {
|
|
8230
8230
|
...props.autoPlay === true ? {
|
|
@@ -8249,12 +8249,41 @@ function Video(props) {
|
|
|
8249
8249
|
...videoProps()
|
|
8250
8250
|
};
|
|
8251
8251
|
});
|
|
8252
|
+
let videoRef;
|
|
8253
|
+
onMount(() => {
|
|
8254
|
+
if (props.lazyLoad) {
|
|
8255
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
8256
|
+
entries.forEach(function(entry) {
|
|
8257
|
+
if (!entry.isIntersecting)
|
|
8258
|
+
return;
|
|
8259
|
+
const videoElement = entry.target;
|
|
8260
|
+
try {
|
|
8261
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
8262
|
+
const src = source.dataset.src;
|
|
8263
|
+
if (src) {
|
|
8264
|
+
source.src = src;
|
|
8265
|
+
}
|
|
8266
|
+
});
|
|
8267
|
+
videoElement.load();
|
|
8268
|
+
oberver.unobserve(videoElement);
|
|
8269
|
+
} catch (error) {
|
|
8270
|
+
}
|
|
8271
|
+
});
|
|
8272
|
+
});
|
|
8273
|
+
if (videoRef) {
|
|
8274
|
+
oberver.observe(videoRef);
|
|
8275
|
+
}
|
|
8276
|
+
setLazyVideoObserver(oberver);
|
|
8277
|
+
}
|
|
8278
|
+
});
|
|
8252
8279
|
return (() => {
|
|
8253
|
-
const _el$ = _tmpl$
|
|
8280
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
8254
8281
|
_el$.style.setProperty("position", "relative");
|
|
8282
|
+
const _ref$ = videoRef;
|
|
8283
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
8255
8284
|
spread(_el$2, mergeProps(spreadProps, {
|
|
8256
8285
|
get preload() {
|
|
8257
|
-
return props.preload || "metadata";
|
|
8286
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
8258
8287
|
},
|
|
8259
8288
|
get style() {
|
|
8260
8289
|
return {
|
|
@@ -8271,29 +8300,21 @@ function Video(props) {
|
|
|
8271
8300
|
} : null
|
|
8272
8301
|
};
|
|
8273
8302
|
},
|
|
8274
|
-
get src() {
|
|
8275
|
-
return props.video || "no-src";
|
|
8276
|
-
},
|
|
8277
8303
|
get poster() {
|
|
8278
8304
|
return props.posterImage;
|
|
8279
8305
|
}
|
|
8280
8306
|
}), false, true);
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
const _el$3 = _tmpl$21();
|
|
8287
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
8288
|
-
return _el$3;
|
|
8289
|
-
}
|
|
8290
|
-
}));
|
|
8307
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
8308
|
+
"data-src": props.video
|
|
8309
|
+
} : {
|
|
8310
|
+
src: props.video
|
|
8311
|
+
}), false, false);
|
|
8291
8312
|
insert(_el$, createComponent(Show, {
|
|
8292
8313
|
get when() {
|
|
8293
8314
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
8294
8315
|
},
|
|
8295
8316
|
get children() {
|
|
8296
|
-
const _el$4 = _tmpl$
|
|
8317
|
+
const _el$4 = _tmpl$21();
|
|
8297
8318
|
_el$4.style.setProperty("width", "100%");
|
|
8298
8319
|
_el$4.style.setProperty("pointer-events", "none");
|
|
8299
8320
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -8306,7 +8327,7 @@ function Video(props) {
|
|
|
8306
8327
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
8307
8328
|
},
|
|
8308
8329
|
get children() {
|
|
8309
|
-
const _el$5 = _tmpl$
|
|
8330
|
+
const _el$5 = _tmpl$21();
|
|
8310
8331
|
_el$5.style.setProperty("display", "flex");
|
|
8311
8332
|
_el$5.style.setProperty("flex-direction", "column");
|
|
8312
8333
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -8319,7 +8340,7 @@ function Video(props) {
|
|
|
8319
8340
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
8320
8341
|
},
|
|
8321
8342
|
get children() {
|
|
8322
|
-
const _el$6 = _tmpl$
|
|
8343
|
+
const _el$6 = _tmpl$21();
|
|
8323
8344
|
_el$6.style.setProperty("pointer-events", "none");
|
|
8324
8345
|
_el$6.style.setProperty("display", "flex");
|
|
8325
8346
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -8476,7 +8497,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8476
8497
|
}
|
|
8477
8498
|
|
|
8478
8499
|
// src/constants/sdk-version.ts
|
|
8479
|
-
var SDK_VERSION = "
|
|
8500
|
+
var SDK_VERSION = "4.0.0";
|
|
8480
8501
|
|
|
8481
8502
|
// src/helpers/sdk-headers.ts
|
|
8482
8503
|
var getSdkHeaders = () => ({
|
|
@@ -9078,7 +9099,7 @@ var registerInsertMenu = () => {
|
|
|
9078
9099
|
});
|
|
9079
9100
|
};
|
|
9080
9101
|
var isSetupForEditing = false;
|
|
9081
|
-
var setupBrowserForEditing = (options
|
|
9102
|
+
var setupBrowserForEditing = (options) => {
|
|
9082
9103
|
if (isSetupForEditing) {
|
|
9083
9104
|
return;
|
|
9084
9105
|
}
|
|
@@ -9094,6 +9115,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
9094
9115
|
// scope our '+ add block' button styling
|
|
9095
9116
|
supportsAddBlockScoping: true,
|
|
9096
9117
|
supportsCustomBreakpoints: true,
|
|
9118
|
+
modelName: options.modelName,
|
|
9119
|
+
apiKey: options.apiKey,
|
|
9097
9120
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
9098
9121
|
blockLevelPersonalization: true
|
|
9099
9122
|
}
|
|
@@ -9199,13 +9222,21 @@ var createEditorListener = ({
|
|
|
9199
9222
|
}
|
|
9200
9223
|
};
|
|
9201
9224
|
};
|
|
9202
|
-
var subscribeToEditor = (
|
|
9225
|
+
var subscribeToEditor = ({
|
|
9226
|
+
model,
|
|
9227
|
+
apiKey,
|
|
9228
|
+
callback,
|
|
9229
|
+
trustedHosts
|
|
9230
|
+
}) => {
|
|
9203
9231
|
if (!isBrowser) {
|
|
9204
9232
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
9205
9233
|
return () => {
|
|
9206
9234
|
};
|
|
9207
9235
|
}
|
|
9208
|
-
setupBrowserForEditing(
|
|
9236
|
+
setupBrowserForEditing({
|
|
9237
|
+
modelName: model,
|
|
9238
|
+
apiKey
|
|
9239
|
+
});
|
|
9209
9240
|
const listener = createEditorListener({
|
|
9210
9241
|
callbacks: {
|
|
9211
9242
|
contentUpdate: callback,
|
|
@@ -9215,7 +9246,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
9215
9246
|
}
|
|
9216
9247
|
},
|
|
9217
9248
|
model,
|
|
9218
|
-
trustedHosts
|
|
9249
|
+
trustedHosts
|
|
9219
9250
|
});
|
|
9220
9251
|
window.addEventListener("message", listener);
|
|
9221
9252
|
return () => {
|
|
@@ -9460,10 +9491,12 @@ function EnableEditor(props) {
|
|
|
9460
9491
|
} : {},
|
|
9461
9492
|
...props.trustedHosts ? {
|
|
9462
9493
|
trustedHosts: props.trustedHosts
|
|
9463
|
-
} : {}
|
|
9494
|
+
} : {},
|
|
9495
|
+
modelName: props.model ?? "",
|
|
9496
|
+
apiKey: props.apiKey
|
|
9464
9497
|
});
|
|
9465
9498
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
9466
|
-
if (!
|
|
9499
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
9467
9500
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
9468
9501
|
window.parent?.postMessage(message, "*");
|
|
9469
9502
|
}
|
|
@@ -9491,7 +9524,7 @@ function EnableEditor(props) {
|
|
|
9491
9524
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
9492
9525
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
9493
9526
|
fetchOneEntry({
|
|
9494
|
-
model: props.model
|
|
9527
|
+
model: props.model,
|
|
9495
9528
|
apiKey: props.apiKey,
|
|
9496
9529
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
9497
9530
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -9685,7 +9718,7 @@ function ContentComponent(props) {
|
|
|
9685
9718
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
9686
9719
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
9687
9720
|
nonce: props.nonce || "",
|
|
9688
|
-
model: props.model
|
|
9721
|
+
model: props.model
|
|
9689
9722
|
});
|
|
9690
9723
|
function contentSetState(newRootState) {
|
|
9691
9724
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -10126,7 +10159,7 @@ function Symbol2(props) {
|
|
|
10126
10159
|
return props.builderContext.canTrack;
|
|
10127
10160
|
},
|
|
10128
10161
|
get model() {
|
|
10129
|
-
return props.symbol?.model;
|
|
10162
|
+
return props.symbol?.model ?? "";
|
|
10130
10163
|
},
|
|
10131
10164
|
get content() {
|
|
10132
10165
|
return contentToUse();
|
package/lib/edge/index.jsx
CHANGED
|
@@ -5091,10 +5091,10 @@ function SectionComponent(props) {
|
|
|
5091
5091
|
var section_default = SectionComponent;
|
|
5092
5092
|
|
|
5093
5093
|
// src/blocks/symbol/symbol.tsx
|
|
5094
|
-
import { onMount as
|
|
5094
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
5095
5095
|
|
|
5096
5096
|
// src/components/content-variants/content-variants.tsx
|
|
5097
|
-
import { Show as Show16, For as For9, onMount as
|
|
5097
|
+
import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
5098
5098
|
|
|
5099
5099
|
// src/helpers/url.ts
|
|
5100
5100
|
var getTopLevelDomain = (host) => {
|
|
@@ -7737,8 +7737,9 @@ var componentInfo20 = {
|
|
|
7737
7737
|
};
|
|
7738
7738
|
|
|
7739
7739
|
// src/blocks/video/video.tsx
|
|
7740
|
-
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
7740
|
+
import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
7741
7741
|
function Video(props) {
|
|
7742
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
7742
7743
|
const videoProps = createMemo15(() => {
|
|
7743
7744
|
return {
|
|
7744
7745
|
...props.autoPlay === true ? {
|
|
@@ -7763,6 +7764,35 @@ function Video(props) {
|
|
|
7763
7764
|
...videoProps()
|
|
7764
7765
|
};
|
|
7765
7766
|
});
|
|
7767
|
+
let videoRef;
|
|
7768
|
+
onMount6(() => {
|
|
7769
|
+
if (props.lazyLoad) {
|
|
7770
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
7771
|
+
entries.forEach(function(entry) {
|
|
7772
|
+
if (!entry.isIntersecting)
|
|
7773
|
+
return;
|
|
7774
|
+
const videoElement = entry.target;
|
|
7775
|
+
try {
|
|
7776
|
+
Array.from(videoElement.children).filter(
|
|
7777
|
+
(child) => child instanceof HTMLElement && child.tagName === "SOURCE"
|
|
7778
|
+
).forEach((source) => {
|
|
7779
|
+
const src = source.dataset.src;
|
|
7780
|
+
if (src) {
|
|
7781
|
+
source.src = src;
|
|
7782
|
+
}
|
|
7783
|
+
});
|
|
7784
|
+
videoElement.load();
|
|
7785
|
+
oberver.unobserve(videoElement);
|
|
7786
|
+
} catch (error) {
|
|
7787
|
+
}
|
|
7788
|
+
});
|
|
7789
|
+
});
|
|
7790
|
+
if (videoRef) {
|
|
7791
|
+
oberver.observe(videoRef);
|
|
7792
|
+
}
|
|
7793
|
+
setLazyVideoObserver(oberver);
|
|
7794
|
+
}
|
|
7795
|
+
});
|
|
7766
7796
|
return <><div
|
|
7767
7797
|
style={{
|
|
7768
7798
|
position: "relative"
|
|
@@ -7771,7 +7801,8 @@ function Video(props) {
|
|
|
7771
7801
|
<video
|
|
7772
7802
|
class="builder-video"
|
|
7773
7803
|
{...spreadProps()}
|
|
7774
|
-
|
|
7804
|
+
ref={videoRef}
|
|
7805
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
7775
7806
|
style={{
|
|
7776
7807
|
width: "100%",
|
|
7777
7808
|
height: "100%",
|
|
@@ -7785,9 +7816,15 @@ function Video(props) {
|
|
|
7785
7816
|
position: "absolute"
|
|
7786
7817
|
} : null
|
|
7787
7818
|
}}
|
|
7788
|
-
src={props.video || "no-src"}
|
|
7789
7819
|
poster={props.posterImage}
|
|
7790
|
-
><
|
|
7820
|
+
><source
|
|
7821
|
+
type="video/mp4"
|
|
7822
|
+
{...props.lazyLoad ? {
|
|
7823
|
+
"data-src": props.video
|
|
7824
|
+
} : {
|
|
7825
|
+
src: props.video
|
|
7826
|
+
}}
|
|
7827
|
+
/></video>
|
|
7791
7828
|
<Show13
|
|
7792
7829
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
7793
7830
|
><div
|
|
@@ -7957,7 +7994,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
7957
7994
|
// src/components/content/components/enable-editor.tsx
|
|
7958
7995
|
import {
|
|
7959
7996
|
Show as Show14,
|
|
7960
|
-
onMount as
|
|
7997
|
+
onMount as onMount7,
|
|
7961
7998
|
on as on3,
|
|
7962
7999
|
createEffect as createEffect3,
|
|
7963
8000
|
createMemo as createMemo16,
|
|
@@ -7971,7 +8008,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7971
8008
|
}
|
|
7972
8009
|
|
|
7973
8010
|
// src/constants/sdk-version.ts
|
|
7974
|
-
var SDK_VERSION = "
|
|
8011
|
+
var SDK_VERSION = "4.0.0";
|
|
7975
8012
|
|
|
7976
8013
|
// src/helpers/sdk-headers.ts
|
|
7977
8014
|
var getSdkHeaders = () => ({
|
|
@@ -8573,7 +8610,7 @@ var registerInsertMenu = () => {
|
|
|
8573
8610
|
});
|
|
8574
8611
|
};
|
|
8575
8612
|
var isSetupForEditing = false;
|
|
8576
|
-
var setupBrowserForEditing = (options
|
|
8613
|
+
var setupBrowserForEditing = (options) => {
|
|
8577
8614
|
if (isSetupForEditing) {
|
|
8578
8615
|
return;
|
|
8579
8616
|
}
|
|
@@ -8589,6 +8626,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
8589
8626
|
// scope our '+ add block' button styling
|
|
8590
8627
|
supportsAddBlockScoping: true,
|
|
8591
8628
|
supportsCustomBreakpoints: true,
|
|
8629
|
+
modelName: options.modelName,
|
|
8630
|
+
apiKey: options.apiKey,
|
|
8592
8631
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
8593
8632
|
blockLevelPersonalization: true
|
|
8594
8633
|
}
|
|
@@ -8694,13 +8733,21 @@ var createEditorListener = ({
|
|
|
8694
8733
|
}
|
|
8695
8734
|
};
|
|
8696
8735
|
};
|
|
8697
|
-
var subscribeToEditor = (
|
|
8736
|
+
var subscribeToEditor = ({
|
|
8737
|
+
model,
|
|
8738
|
+
apiKey,
|
|
8739
|
+
callback,
|
|
8740
|
+
trustedHosts
|
|
8741
|
+
}) => {
|
|
8698
8742
|
if (!isBrowser) {
|
|
8699
8743
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
8700
8744
|
return () => {
|
|
8701
8745
|
};
|
|
8702
8746
|
}
|
|
8703
|
-
setupBrowserForEditing(
|
|
8747
|
+
setupBrowserForEditing({
|
|
8748
|
+
modelName: model,
|
|
8749
|
+
apiKey
|
|
8750
|
+
});
|
|
8704
8751
|
const listener = createEditorListener({
|
|
8705
8752
|
callbacks: {
|
|
8706
8753
|
contentUpdate: callback,
|
|
@@ -8710,7 +8757,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
8710
8757
|
}
|
|
8711
8758
|
},
|
|
8712
8759
|
model,
|
|
8713
|
-
trustedHosts
|
|
8760
|
+
trustedHosts
|
|
8714
8761
|
});
|
|
8715
8762
|
window.addEventListener("message", listener);
|
|
8716
8763
|
return () => {
|
|
@@ -8950,7 +8997,7 @@ function EnableEditor(props) {
|
|
|
8950
8997
|
let elementRef;
|
|
8951
8998
|
runHttpRequests();
|
|
8952
8999
|
emitStateUpdate();
|
|
8953
|
-
|
|
9000
|
+
onMount7(() => {
|
|
8954
9001
|
if (isBrowser()) {
|
|
8955
9002
|
if (isEditing() && !props.isNestedRender) {
|
|
8956
9003
|
window.addEventListener("message", processMessage);
|
|
@@ -8964,12 +9011,14 @@ function EnableEditor(props) {
|
|
|
8964
9011
|
} : {},
|
|
8965
9012
|
...props.trustedHosts ? {
|
|
8966
9013
|
trustedHosts: props.trustedHosts
|
|
8967
|
-
} : {}
|
|
9014
|
+
} : {},
|
|
9015
|
+
modelName: props.model ?? "",
|
|
9016
|
+
apiKey: props.apiKey
|
|
8968
9017
|
});
|
|
8969
9018
|
Object.values(
|
|
8970
9019
|
props.builderContextSignal.componentInfos
|
|
8971
9020
|
).forEach((registeredComponent) => {
|
|
8972
|
-
if (!
|
|
9021
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
8973
9022
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
8974
9023
|
window.parent?.postMessage(message, "*");
|
|
8975
9024
|
}
|
|
@@ -9002,7 +9051,7 @@ function EnableEditor(props) {
|
|
|
9002
9051
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
9003
9052
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
9004
9053
|
fetchOneEntry({
|
|
9005
|
-
model: props.model
|
|
9054
|
+
model: props.model,
|
|
9006
9055
|
apiKey: props.apiKey,
|
|
9007
9056
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
9008
9057
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -9190,7 +9239,7 @@ function ContentComponent(props) {
|
|
|
9190
9239
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
9191
9240
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
9192
9241
|
nonce: props.nonce || "",
|
|
9193
|
-
model: props.model
|
|
9242
|
+
model: props.model
|
|
9194
9243
|
});
|
|
9195
9244
|
function contentSetState(newRootState) {
|
|
9196
9245
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -9295,7 +9344,7 @@ function ContentVariants(props) {
|
|
|
9295
9344
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
9296
9345
|
});
|
|
9297
9346
|
});
|
|
9298
|
-
|
|
9347
|
+
onMount8(() => {
|
|
9299
9348
|
setShouldRenderVariants(false);
|
|
9300
9349
|
});
|
|
9301
9350
|
return <><>
|
|
@@ -9425,7 +9474,7 @@ function Symbol2(props) {
|
|
|
9425
9474
|
}
|
|
9426
9475
|
});
|
|
9427
9476
|
}
|
|
9428
|
-
|
|
9477
|
+
onMount9(() => {
|
|
9429
9478
|
});
|
|
9430
9479
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
9431
9480
|
function onUpdateFn_0() {
|
|
@@ -9448,7 +9497,7 @@ function Symbol2(props) {
|
|
|
9448
9497
|
...contentToUse()?.data?.state
|
|
9449
9498
|
}}
|
|
9450
9499
|
canTrack={props.builderContext.canTrack}
|
|
9451
|
-
model={props.symbol?.model}
|
|
9500
|
+
model={props.symbol?.model ?? ""}
|
|
9452
9501
|
content={contentToUse()}
|
|
9453
9502
|
linkComponent={props.builderLinkComponent}
|
|
9454
9503
|
blocksWrapper={blocksWrapper()}
|