@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/node/dev.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
|
import { createRequire } from 'node:module';
|
|
4
4
|
|
|
@@ -5222,10 +5222,10 @@ var componentInfo20 = {
|
|
|
5222
5222
|
builderBlock: true
|
|
5223
5223
|
}
|
|
5224
5224
|
};
|
|
5225
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
5226
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
5227
|
-
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
5225
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
5226
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
5228
5227
|
function Video(props) {
|
|
5228
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5229
5229
|
const videoProps = createMemo(() => {
|
|
5230
5230
|
return {
|
|
5231
5231
|
...props.autoPlay === true ? {
|
|
@@ -5250,12 +5250,42 @@ function Video(props) {
|
|
|
5250
5250
|
...videoProps()
|
|
5251
5251
|
};
|
|
5252
5252
|
});
|
|
5253
|
+
let videoRef;
|
|
5254
|
+
onMount(() => {
|
|
5255
|
+
if (props.lazyLoad) {
|
|
5256
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
5257
|
+
entries.forEach(function(entry) {
|
|
5258
|
+
if (!entry.isIntersecting)
|
|
5259
|
+
return;
|
|
5260
|
+
const videoElement = entry.target;
|
|
5261
|
+
try {
|
|
5262
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
5263
|
+
const src = source.dataset.src;
|
|
5264
|
+
if (src) {
|
|
5265
|
+
source.src = src;
|
|
5266
|
+
}
|
|
5267
|
+
});
|
|
5268
|
+
videoElement.load();
|
|
5269
|
+
oberver.unobserve(videoElement);
|
|
5270
|
+
} catch (error2) {
|
|
5271
|
+
console.error("Error loading lazy video:", error2);
|
|
5272
|
+
}
|
|
5273
|
+
});
|
|
5274
|
+
});
|
|
5275
|
+
if (videoRef) {
|
|
5276
|
+
oberver.observe(videoRef);
|
|
5277
|
+
}
|
|
5278
|
+
setLazyVideoObserver(oberver);
|
|
5279
|
+
}
|
|
5280
|
+
});
|
|
5253
5281
|
return (() => {
|
|
5254
|
-
const _el$ = _tmpl$
|
|
5282
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5255
5283
|
_el$.style.setProperty("position", "relative");
|
|
5284
|
+
const _ref$ = videoRef;
|
|
5285
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
5256
5286
|
spread(_el$2, mergeProps(spreadProps, {
|
|
5257
5287
|
get preload() {
|
|
5258
|
-
return props.preload || "metadata";
|
|
5288
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
5259
5289
|
},
|
|
5260
5290
|
get style() {
|
|
5261
5291
|
return {
|
|
@@ -5272,29 +5302,21 @@ function Video(props) {
|
|
|
5272
5302
|
} : null
|
|
5273
5303
|
};
|
|
5274
5304
|
},
|
|
5275
|
-
get src() {
|
|
5276
|
-
return props.video || "no-src";
|
|
5277
|
-
},
|
|
5278
5305
|
get poster() {
|
|
5279
5306
|
return props.posterImage;
|
|
5280
5307
|
}
|
|
5281
5308
|
}), false, true);
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
const _el$3 = _tmpl$21();
|
|
5288
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
5289
|
-
return _el$3;
|
|
5290
|
-
}
|
|
5291
|
-
}));
|
|
5309
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
5310
|
+
"data-src": props.video
|
|
5311
|
+
} : {
|
|
5312
|
+
src: props.video
|
|
5313
|
+
}), false, false);
|
|
5292
5314
|
insert(_el$, createComponent(Show, {
|
|
5293
5315
|
get when() {
|
|
5294
5316
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
5295
5317
|
},
|
|
5296
5318
|
get children() {
|
|
5297
|
-
const _el$4 = _tmpl$
|
|
5319
|
+
const _el$4 = _tmpl$21();
|
|
5298
5320
|
_el$4.style.setProperty("width", "100%");
|
|
5299
5321
|
_el$4.style.setProperty("pointer-events", "none");
|
|
5300
5322
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -5307,7 +5329,7 @@ function Video(props) {
|
|
|
5307
5329
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
5308
5330
|
},
|
|
5309
5331
|
get children() {
|
|
5310
|
-
const _el$5 = _tmpl$
|
|
5332
|
+
const _el$5 = _tmpl$21();
|
|
5311
5333
|
_el$5.style.setProperty("display", "flex");
|
|
5312
5334
|
_el$5.style.setProperty("flex-direction", "column");
|
|
5313
5335
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -5320,7 +5342,7 @@ function Video(props) {
|
|
|
5320
5342
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
5321
5343
|
},
|
|
5322
5344
|
get children() {
|
|
5323
|
-
const _el$6 = _tmpl$
|
|
5345
|
+
const _el$6 = _tmpl$21();
|
|
5324
5346
|
_el$6.style.setProperty("pointer-events", "none");
|
|
5325
5347
|
_el$6.style.setProperty("display", "flex");
|
|
5326
5348
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -5477,7 +5499,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5477
5499
|
}
|
|
5478
5500
|
|
|
5479
5501
|
// src/constants/sdk-version.ts
|
|
5480
|
-
var SDK_VERSION = "
|
|
5502
|
+
var SDK_VERSION = "4.0.0";
|
|
5481
5503
|
|
|
5482
5504
|
// src/helpers/sdk-headers.ts
|
|
5483
5505
|
var getSdkHeaders = () => ({
|
|
@@ -6085,7 +6107,7 @@ var registerInsertMenu = () => {
|
|
|
6085
6107
|
});
|
|
6086
6108
|
};
|
|
6087
6109
|
var isSetupForEditing = false;
|
|
6088
|
-
var setupBrowserForEditing = (options
|
|
6110
|
+
var setupBrowserForEditing = (options) => {
|
|
6089
6111
|
if (isSetupForEditing) {
|
|
6090
6112
|
return;
|
|
6091
6113
|
}
|
|
@@ -6101,6 +6123,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
6101
6123
|
// scope our '+ add block' button styling
|
|
6102
6124
|
supportsAddBlockScoping: true,
|
|
6103
6125
|
supportsCustomBreakpoints: true,
|
|
6126
|
+
modelName: options.modelName,
|
|
6127
|
+
apiKey: options.apiKey,
|
|
6104
6128
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
6105
6129
|
blockLevelPersonalization: true
|
|
6106
6130
|
}
|
|
@@ -6206,13 +6230,21 @@ var createEditorListener = ({
|
|
|
6206
6230
|
}
|
|
6207
6231
|
};
|
|
6208
6232
|
};
|
|
6209
|
-
var subscribeToEditor = (
|
|
6233
|
+
var subscribeToEditor = ({
|
|
6234
|
+
model,
|
|
6235
|
+
apiKey,
|
|
6236
|
+
callback,
|
|
6237
|
+
trustedHosts
|
|
6238
|
+
}) => {
|
|
6210
6239
|
if (!isBrowser) {
|
|
6211
6240
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
6212
6241
|
return () => {
|
|
6213
6242
|
};
|
|
6214
6243
|
}
|
|
6215
|
-
setupBrowserForEditing(
|
|
6244
|
+
setupBrowserForEditing({
|
|
6245
|
+
modelName: model,
|
|
6246
|
+
apiKey
|
|
6247
|
+
});
|
|
6216
6248
|
const listener = createEditorListener({
|
|
6217
6249
|
callbacks: {
|
|
6218
6250
|
contentUpdate: callback,
|
|
@@ -6222,7 +6254,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
6222
6254
|
}
|
|
6223
6255
|
},
|
|
6224
6256
|
model,
|
|
6225
|
-
trustedHosts
|
|
6257
|
+
trustedHosts
|
|
6226
6258
|
});
|
|
6227
6259
|
window.addEventListener("message", listener);
|
|
6228
6260
|
return () => {
|
|
@@ -6468,10 +6500,12 @@ function EnableEditor(props) {
|
|
|
6468
6500
|
} : {},
|
|
6469
6501
|
...props.trustedHosts ? {
|
|
6470
6502
|
trustedHosts: props.trustedHosts
|
|
6471
|
-
} : {}
|
|
6503
|
+
} : {},
|
|
6504
|
+
modelName: props.model ?? "",
|
|
6505
|
+
apiKey: props.apiKey
|
|
6472
6506
|
});
|
|
6473
6507
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
6474
|
-
if (!
|
|
6508
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
6475
6509
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
6476
6510
|
window.parent?.postMessage(message, "*");
|
|
6477
6511
|
}
|
|
@@ -6499,7 +6533,7 @@ function EnableEditor(props) {
|
|
|
6499
6533
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
6500
6534
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
6501
6535
|
fetchOneEntry({
|
|
6502
|
-
model: props.model
|
|
6536
|
+
model: props.model,
|
|
6503
6537
|
apiKey: props.apiKey,
|
|
6504
6538
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
6505
6539
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6693,7 +6727,7 @@ function ContentComponent(props) {
|
|
|
6693
6727
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6694
6728
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6695
6729
|
nonce: props.nonce || "",
|
|
6696
|
-
model: props.model
|
|
6730
|
+
model: props.model
|
|
6697
6731
|
});
|
|
6698
6732
|
function contentSetState(newRootState) {
|
|
6699
6733
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -7134,7 +7168,7 @@ function Symbol(props) {
|
|
|
7134
7168
|
return props.builderContext.canTrack;
|
|
7135
7169
|
},
|
|
7136
7170
|
get model() {
|
|
7137
|
-
return props.symbol?.model;
|
|
7171
|
+
return props.symbol?.model ?? "";
|
|
7138
7172
|
},
|
|
7139
7173
|
get content() {
|
|
7140
7174
|
return contentToUse();
|
package/lib/node/dev.jsx
CHANGED
|
@@ -2087,10 +2087,10 @@ function SectionComponent(props) {
|
|
|
2087
2087
|
var section_default = SectionComponent;
|
|
2088
2088
|
|
|
2089
2089
|
// src/blocks/symbol/symbol.tsx
|
|
2090
|
-
import { onMount as
|
|
2090
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
2091
2091
|
|
|
2092
2092
|
// src/components/content-variants/content-variants.tsx
|
|
2093
|
-
import { Show as Show16, For as For9, onMount as
|
|
2093
|
+
import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
2094
2094
|
|
|
2095
2095
|
// src/helpers/url.ts
|
|
2096
2096
|
var getTopLevelDomain = (host) => {
|
|
@@ -4736,8 +4736,9 @@ var componentInfo20 = {
|
|
|
4736
4736
|
};
|
|
4737
4737
|
|
|
4738
4738
|
// src/blocks/video/video.tsx
|
|
4739
|
-
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
4739
|
+
import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
4740
4740
|
function Video(props) {
|
|
4741
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
4741
4742
|
const videoProps = createMemo15(() => {
|
|
4742
4743
|
return {
|
|
4743
4744
|
...props.autoPlay === true ? {
|
|
@@ -4762,6 +4763,36 @@ function Video(props) {
|
|
|
4762
4763
|
...videoProps()
|
|
4763
4764
|
};
|
|
4764
4765
|
});
|
|
4766
|
+
let videoRef;
|
|
4767
|
+
onMount6(() => {
|
|
4768
|
+
if (props.lazyLoad) {
|
|
4769
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
4770
|
+
entries.forEach(function(entry) {
|
|
4771
|
+
if (!entry.isIntersecting)
|
|
4772
|
+
return;
|
|
4773
|
+
const videoElement = entry.target;
|
|
4774
|
+
try {
|
|
4775
|
+
Array.from(videoElement.children).filter(
|
|
4776
|
+
(child) => child instanceof HTMLElement && child.tagName === "SOURCE"
|
|
4777
|
+
).forEach((source) => {
|
|
4778
|
+
const src = source.dataset.src;
|
|
4779
|
+
if (src) {
|
|
4780
|
+
source.src = src;
|
|
4781
|
+
}
|
|
4782
|
+
});
|
|
4783
|
+
videoElement.load();
|
|
4784
|
+
oberver.unobserve(videoElement);
|
|
4785
|
+
} catch (error2) {
|
|
4786
|
+
console.error("Error loading lazy video:", error2);
|
|
4787
|
+
}
|
|
4788
|
+
});
|
|
4789
|
+
});
|
|
4790
|
+
if (videoRef) {
|
|
4791
|
+
oberver.observe(videoRef);
|
|
4792
|
+
}
|
|
4793
|
+
setLazyVideoObserver(oberver);
|
|
4794
|
+
}
|
|
4795
|
+
});
|
|
4765
4796
|
return <><div
|
|
4766
4797
|
style={{
|
|
4767
4798
|
position: "relative"
|
|
@@ -4770,7 +4801,8 @@ function Video(props) {
|
|
|
4770
4801
|
<video
|
|
4771
4802
|
class="builder-video"
|
|
4772
4803
|
{...spreadProps()}
|
|
4773
|
-
|
|
4804
|
+
ref={videoRef}
|
|
4805
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
4774
4806
|
style={{
|
|
4775
4807
|
width: "100%",
|
|
4776
4808
|
height: "100%",
|
|
@@ -4784,9 +4816,15 @@ function Video(props) {
|
|
|
4784
4816
|
position: "absolute"
|
|
4785
4817
|
} : null
|
|
4786
4818
|
}}
|
|
4787
|
-
src={props.video || "no-src"}
|
|
4788
4819
|
poster={props.posterImage}
|
|
4789
|
-
><
|
|
4820
|
+
><source
|
|
4821
|
+
type="video/mp4"
|
|
4822
|
+
{...props.lazyLoad ? {
|
|
4823
|
+
"data-src": props.video
|
|
4824
|
+
} : {
|
|
4825
|
+
src: props.video
|
|
4826
|
+
}}
|
|
4827
|
+
/></video>
|
|
4790
4828
|
<Show13
|
|
4791
4829
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4792
4830
|
><div
|
|
@@ -4956,7 +4994,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4956
4994
|
// src/components/content/components/enable-editor.tsx
|
|
4957
4995
|
import {
|
|
4958
4996
|
Show as Show14,
|
|
4959
|
-
onMount as
|
|
4997
|
+
onMount as onMount7,
|
|
4960
4998
|
on as on3,
|
|
4961
4999
|
createEffect as createEffect3,
|
|
4962
5000
|
createMemo as createMemo16,
|
|
@@ -4970,7 +5008,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4970
5008
|
}
|
|
4971
5009
|
|
|
4972
5010
|
// src/constants/sdk-version.ts
|
|
4973
|
-
var SDK_VERSION = "
|
|
5011
|
+
var SDK_VERSION = "4.0.0";
|
|
4974
5012
|
|
|
4975
5013
|
// src/helpers/sdk-headers.ts
|
|
4976
5014
|
var getSdkHeaders = () => ({
|
|
@@ -5578,7 +5616,7 @@ var registerInsertMenu = () => {
|
|
|
5578
5616
|
});
|
|
5579
5617
|
};
|
|
5580
5618
|
var isSetupForEditing = false;
|
|
5581
|
-
var setupBrowserForEditing = (options
|
|
5619
|
+
var setupBrowserForEditing = (options) => {
|
|
5582
5620
|
if (isSetupForEditing) {
|
|
5583
5621
|
return;
|
|
5584
5622
|
}
|
|
@@ -5594,6 +5632,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5594
5632
|
// scope our '+ add block' button styling
|
|
5595
5633
|
supportsAddBlockScoping: true,
|
|
5596
5634
|
supportsCustomBreakpoints: true,
|
|
5635
|
+
modelName: options.modelName,
|
|
5636
|
+
apiKey: options.apiKey,
|
|
5597
5637
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5598
5638
|
blockLevelPersonalization: true
|
|
5599
5639
|
}
|
|
@@ -5699,13 +5739,21 @@ var createEditorListener = ({
|
|
|
5699
5739
|
}
|
|
5700
5740
|
};
|
|
5701
5741
|
};
|
|
5702
|
-
var subscribeToEditor = (
|
|
5742
|
+
var subscribeToEditor = ({
|
|
5743
|
+
model,
|
|
5744
|
+
apiKey,
|
|
5745
|
+
callback,
|
|
5746
|
+
trustedHosts
|
|
5747
|
+
}) => {
|
|
5703
5748
|
if (!isBrowser) {
|
|
5704
5749
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
5705
5750
|
return () => {
|
|
5706
5751
|
};
|
|
5707
5752
|
}
|
|
5708
|
-
setupBrowserForEditing(
|
|
5753
|
+
setupBrowserForEditing({
|
|
5754
|
+
modelName: model,
|
|
5755
|
+
apiKey
|
|
5756
|
+
});
|
|
5709
5757
|
const listener = createEditorListener({
|
|
5710
5758
|
callbacks: {
|
|
5711
5759
|
contentUpdate: callback,
|
|
@@ -5715,7 +5763,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
5715
5763
|
}
|
|
5716
5764
|
},
|
|
5717
5765
|
model,
|
|
5718
|
-
trustedHosts
|
|
5766
|
+
trustedHosts
|
|
5719
5767
|
});
|
|
5720
5768
|
window.addEventListener("message", listener);
|
|
5721
5769
|
return () => {
|
|
@@ -5956,7 +6004,7 @@ function EnableEditor(props) {
|
|
|
5956
6004
|
let elementRef;
|
|
5957
6005
|
runHttpRequests();
|
|
5958
6006
|
emitStateUpdate();
|
|
5959
|
-
|
|
6007
|
+
onMount7(() => {
|
|
5960
6008
|
if (isBrowser()) {
|
|
5961
6009
|
if (isEditing() && !props.isNestedRender) {
|
|
5962
6010
|
window.addEventListener("message", processMessage);
|
|
@@ -5970,12 +6018,14 @@ function EnableEditor(props) {
|
|
|
5970
6018
|
} : {},
|
|
5971
6019
|
...props.trustedHosts ? {
|
|
5972
6020
|
trustedHosts: props.trustedHosts
|
|
5973
|
-
} : {}
|
|
6021
|
+
} : {},
|
|
6022
|
+
modelName: props.model ?? "",
|
|
6023
|
+
apiKey: props.apiKey
|
|
5974
6024
|
});
|
|
5975
6025
|
Object.values(
|
|
5976
6026
|
props.builderContextSignal.componentInfos
|
|
5977
6027
|
).forEach((registeredComponent) => {
|
|
5978
|
-
if (!
|
|
6028
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
5979
6029
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
5980
6030
|
window.parent?.postMessage(message, "*");
|
|
5981
6031
|
}
|
|
@@ -6008,7 +6058,7 @@ function EnableEditor(props) {
|
|
|
6008
6058
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
6009
6059
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
6010
6060
|
fetchOneEntry({
|
|
6011
|
-
model: props.model
|
|
6061
|
+
model: props.model,
|
|
6012
6062
|
apiKey: props.apiKey,
|
|
6013
6063
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
6014
6064
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6196,7 +6246,7 @@ function ContentComponent(props) {
|
|
|
6196
6246
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6197
6247
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6198
6248
|
nonce: props.nonce || "",
|
|
6199
|
-
model: props.model
|
|
6249
|
+
model: props.model
|
|
6200
6250
|
});
|
|
6201
6251
|
function contentSetState(newRootState) {
|
|
6202
6252
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6301,7 +6351,7 @@ function ContentVariants(props) {
|
|
|
6301
6351
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
6302
6352
|
});
|
|
6303
6353
|
});
|
|
6304
|
-
|
|
6354
|
+
onMount8(() => {
|
|
6305
6355
|
setShouldRenderVariants(false);
|
|
6306
6356
|
});
|
|
6307
6357
|
return <><>
|
|
@@ -6431,7 +6481,7 @@ function Symbol(props) {
|
|
|
6431
6481
|
}
|
|
6432
6482
|
});
|
|
6433
6483
|
}
|
|
6434
|
-
|
|
6484
|
+
onMount9(() => {
|
|
6435
6485
|
});
|
|
6436
6486
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
6437
6487
|
function onUpdateFn_0() {
|
|
@@ -6454,7 +6504,7 @@ function Symbol(props) {
|
|
|
6454
6504
|
...contentToUse()?.data?.state
|
|
6455
6505
|
}}
|
|
6456
6506
|
canTrack={props.builderContext.canTrack}
|
|
6457
|
-
model={props.symbol?.model}
|
|
6507
|
+
model={props.symbol?.model ?? ""}
|
|
6458
6508
|
content={contentToUse()}
|
|
6459
6509
|
linkComponent={props.builderLinkComponent}
|
|
6460
6510
|
blocksWrapper={blocksWrapper()}
|
package/lib/node/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
|
import { createRequire } from 'node:module';
|
|
4
4
|
|
|
@@ -5209,10 +5209,10 @@ var componentInfo20 = {
|
|
|
5209
5209
|
builderBlock: true
|
|
5210
5210
|
}
|
|
5211
5211
|
};
|
|
5212
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
5213
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
5214
|
-
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>`);
|
|
5215
5214
|
function Video(props) {
|
|
5215
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5216
5216
|
const videoProps = createMemo(() => {
|
|
5217
5217
|
return {
|
|
5218
5218
|
...props.autoPlay === true ? {
|
|
@@ -5237,12 +5237,41 @@ function Video(props) {
|
|
|
5237
5237
|
...videoProps()
|
|
5238
5238
|
};
|
|
5239
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
|
+
});
|
|
5240
5267
|
return (() => {
|
|
5241
|
-
const _el$ = _tmpl$
|
|
5268
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5242
5269
|
_el$.style.setProperty("position", "relative");
|
|
5270
|
+
const _ref$ = videoRef;
|
|
5271
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
5243
5272
|
spread(_el$2, mergeProps(spreadProps, {
|
|
5244
5273
|
get preload() {
|
|
5245
|
-
return props.preload || "metadata";
|
|
5274
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
5246
5275
|
},
|
|
5247
5276
|
get style() {
|
|
5248
5277
|
return {
|
|
@@ -5259,29 +5288,21 @@ function Video(props) {
|
|
|
5259
5288
|
} : null
|
|
5260
5289
|
};
|
|
5261
5290
|
},
|
|
5262
|
-
get src() {
|
|
5263
|
-
return props.video || "no-src";
|
|
5264
|
-
},
|
|
5265
5291
|
get poster() {
|
|
5266
5292
|
return props.posterImage;
|
|
5267
5293
|
}
|
|
5268
5294
|
}), false, true);
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
const _el$3 = _tmpl$21();
|
|
5275
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
5276
|
-
return _el$3;
|
|
5277
|
-
}
|
|
5278
|
-
}));
|
|
5295
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
5296
|
+
"data-src": props.video
|
|
5297
|
+
} : {
|
|
5298
|
+
src: props.video
|
|
5299
|
+
}), false, false);
|
|
5279
5300
|
insert(_el$, createComponent(Show, {
|
|
5280
5301
|
get when() {
|
|
5281
5302
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
5282
5303
|
},
|
|
5283
5304
|
get children() {
|
|
5284
|
-
const _el$4 = _tmpl$
|
|
5305
|
+
const _el$4 = _tmpl$21();
|
|
5285
5306
|
_el$4.style.setProperty("width", "100%");
|
|
5286
5307
|
_el$4.style.setProperty("pointer-events", "none");
|
|
5287
5308
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -5294,7 +5315,7 @@ function Video(props) {
|
|
|
5294
5315
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
5295
5316
|
},
|
|
5296
5317
|
get children() {
|
|
5297
|
-
const _el$5 = _tmpl$
|
|
5318
|
+
const _el$5 = _tmpl$21();
|
|
5298
5319
|
_el$5.style.setProperty("display", "flex");
|
|
5299
5320
|
_el$5.style.setProperty("flex-direction", "column");
|
|
5300
5321
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -5307,7 +5328,7 @@ function Video(props) {
|
|
|
5307
5328
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
5308
5329
|
},
|
|
5309
5330
|
get children() {
|
|
5310
|
-
const _el$6 = _tmpl$
|
|
5331
|
+
const _el$6 = _tmpl$21();
|
|
5311
5332
|
_el$6.style.setProperty("pointer-events", "none");
|
|
5312
5333
|
_el$6.style.setProperty("display", "flex");
|
|
5313
5334
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -5464,7 +5485,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5464
5485
|
}
|
|
5465
5486
|
|
|
5466
5487
|
// src/constants/sdk-version.ts
|
|
5467
|
-
var SDK_VERSION = "
|
|
5488
|
+
var SDK_VERSION = "4.0.0";
|
|
5468
5489
|
|
|
5469
5490
|
// src/helpers/sdk-headers.ts
|
|
5470
5491
|
var getSdkHeaders = () => ({
|
|
@@ -6066,7 +6087,7 @@ var registerInsertMenu = () => {
|
|
|
6066
6087
|
});
|
|
6067
6088
|
};
|
|
6068
6089
|
var isSetupForEditing = false;
|
|
6069
|
-
var setupBrowserForEditing = (options
|
|
6090
|
+
var setupBrowserForEditing = (options) => {
|
|
6070
6091
|
if (isSetupForEditing) {
|
|
6071
6092
|
return;
|
|
6072
6093
|
}
|
|
@@ -6082,6 +6103,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
6082
6103
|
// scope our '+ add block' button styling
|
|
6083
6104
|
supportsAddBlockScoping: true,
|
|
6084
6105
|
supportsCustomBreakpoints: true,
|
|
6106
|
+
modelName: options.modelName,
|
|
6107
|
+
apiKey: options.apiKey,
|
|
6085
6108
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
6086
6109
|
blockLevelPersonalization: true
|
|
6087
6110
|
}
|
|
@@ -6187,13 +6210,21 @@ var createEditorListener = ({
|
|
|
6187
6210
|
}
|
|
6188
6211
|
};
|
|
6189
6212
|
};
|
|
6190
|
-
var subscribeToEditor = (
|
|
6213
|
+
var subscribeToEditor = ({
|
|
6214
|
+
model,
|
|
6215
|
+
apiKey,
|
|
6216
|
+
callback,
|
|
6217
|
+
trustedHosts
|
|
6218
|
+
}) => {
|
|
6191
6219
|
if (!isBrowser) {
|
|
6192
6220
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
6193
6221
|
return () => {
|
|
6194
6222
|
};
|
|
6195
6223
|
}
|
|
6196
|
-
setupBrowserForEditing(
|
|
6224
|
+
setupBrowserForEditing({
|
|
6225
|
+
modelName: model,
|
|
6226
|
+
apiKey
|
|
6227
|
+
});
|
|
6197
6228
|
const listener = createEditorListener({
|
|
6198
6229
|
callbacks: {
|
|
6199
6230
|
contentUpdate: callback,
|
|
@@ -6203,7 +6234,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
6203
6234
|
}
|
|
6204
6235
|
},
|
|
6205
6236
|
model,
|
|
6206
|
-
trustedHosts
|
|
6237
|
+
trustedHosts
|
|
6207
6238
|
});
|
|
6208
6239
|
window.addEventListener("message", listener);
|
|
6209
6240
|
return () => {
|
|
@@ -6448,10 +6479,12 @@ function EnableEditor(props) {
|
|
|
6448
6479
|
} : {},
|
|
6449
6480
|
...props.trustedHosts ? {
|
|
6450
6481
|
trustedHosts: props.trustedHosts
|
|
6451
|
-
} : {}
|
|
6482
|
+
} : {},
|
|
6483
|
+
modelName: props.model ?? "",
|
|
6484
|
+
apiKey: props.apiKey
|
|
6452
6485
|
});
|
|
6453
6486
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
6454
|
-
if (!
|
|
6487
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
6455
6488
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
6456
6489
|
window.parent?.postMessage(message, "*");
|
|
6457
6490
|
}
|
|
@@ -6479,7 +6512,7 @@ function EnableEditor(props) {
|
|
|
6479
6512
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
6480
6513
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
6481
6514
|
fetchOneEntry({
|
|
6482
|
-
model: props.model
|
|
6515
|
+
model: props.model,
|
|
6483
6516
|
apiKey: props.apiKey,
|
|
6484
6517
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
6485
6518
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6673,7 +6706,7 @@ function ContentComponent(props) {
|
|
|
6673
6706
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6674
6707
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6675
6708
|
nonce: props.nonce || "",
|
|
6676
|
-
model: props.model
|
|
6709
|
+
model: props.model
|
|
6677
6710
|
});
|
|
6678
6711
|
function contentSetState(newRootState) {
|
|
6679
6712
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -7114,7 +7147,7 @@ function Symbol(props) {
|
|
|
7114
7147
|
return props.builderContext.canTrack;
|
|
7115
7148
|
},
|
|
7116
7149
|
get model() {
|
|
7117
|
-
return props.symbol?.model;
|
|
7150
|
+
return props.symbol?.model ?? "";
|
|
7118
7151
|
},
|
|
7119
7152
|
get content() {
|
|
7120
7153
|
return contentToUse();
|