@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/browser/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
|
// src/blocks/button/button.tsx
|
|
@@ -5040,10 +5040,10 @@ var componentInfo20 = {
|
|
|
5040
5040
|
builderBlock: true
|
|
5041
5041
|
}
|
|
5042
5042
|
};
|
|
5043
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
5044
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
5045
|
-
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
5043
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
5044
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
5046
5045
|
function Video(props) {
|
|
5046
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5047
5047
|
const videoProps = createMemo(() => {
|
|
5048
5048
|
return {
|
|
5049
5049
|
...props.autoPlay === true ? {
|
|
@@ -5068,12 +5068,41 @@ function Video(props) {
|
|
|
5068
5068
|
...videoProps()
|
|
5069
5069
|
};
|
|
5070
5070
|
});
|
|
5071
|
+
let videoRef;
|
|
5072
|
+
onMount(() => {
|
|
5073
|
+
if (props.lazyLoad) {
|
|
5074
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
5075
|
+
entries.forEach(function(entry) {
|
|
5076
|
+
if (!entry.isIntersecting)
|
|
5077
|
+
return;
|
|
5078
|
+
const videoElement = entry.target;
|
|
5079
|
+
try {
|
|
5080
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
5081
|
+
const src = source.dataset.src;
|
|
5082
|
+
if (src) {
|
|
5083
|
+
source.src = src;
|
|
5084
|
+
}
|
|
5085
|
+
});
|
|
5086
|
+
videoElement.load();
|
|
5087
|
+
oberver.unobserve(videoElement);
|
|
5088
|
+
} catch (error) {
|
|
5089
|
+
}
|
|
5090
|
+
});
|
|
5091
|
+
});
|
|
5092
|
+
if (videoRef) {
|
|
5093
|
+
oberver.observe(videoRef);
|
|
5094
|
+
}
|
|
5095
|
+
setLazyVideoObserver(oberver);
|
|
5096
|
+
}
|
|
5097
|
+
});
|
|
5071
5098
|
return (() => {
|
|
5072
|
-
const _el$ = _tmpl$
|
|
5099
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5073
5100
|
_el$.style.setProperty("position", "relative");
|
|
5101
|
+
const _ref$ = videoRef;
|
|
5102
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
5074
5103
|
spread(_el$2, mergeProps(spreadProps, {
|
|
5075
5104
|
get preload() {
|
|
5076
|
-
return props.preload || "metadata";
|
|
5105
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
5077
5106
|
},
|
|
5078
5107
|
get style() {
|
|
5079
5108
|
return {
|
|
@@ -5090,29 +5119,21 @@ function Video(props) {
|
|
|
5090
5119
|
} : null
|
|
5091
5120
|
};
|
|
5092
5121
|
},
|
|
5093
|
-
get src() {
|
|
5094
|
-
return props.video || "no-src";
|
|
5095
|
-
},
|
|
5096
5122
|
get poster() {
|
|
5097
5123
|
return props.posterImage;
|
|
5098
5124
|
}
|
|
5099
5125
|
}), false, true);
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
const _el$3 = _tmpl$21();
|
|
5106
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
5107
|
-
return _el$3;
|
|
5108
|
-
}
|
|
5109
|
-
}));
|
|
5126
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
5127
|
+
"data-src": props.video
|
|
5128
|
+
} : {
|
|
5129
|
+
src: props.video
|
|
5130
|
+
}), false, false);
|
|
5110
5131
|
insert(_el$, createComponent(Show, {
|
|
5111
5132
|
get when() {
|
|
5112
5133
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
5113
5134
|
},
|
|
5114
5135
|
get children() {
|
|
5115
|
-
const _el$4 = _tmpl$
|
|
5136
|
+
const _el$4 = _tmpl$21();
|
|
5116
5137
|
_el$4.style.setProperty("width", "100%");
|
|
5117
5138
|
_el$4.style.setProperty("pointer-events", "none");
|
|
5118
5139
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -5125,7 +5146,7 @@ function Video(props) {
|
|
|
5125
5146
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
5126
5147
|
},
|
|
5127
5148
|
get children() {
|
|
5128
|
-
const _el$5 = _tmpl$
|
|
5149
|
+
const _el$5 = _tmpl$21();
|
|
5129
5150
|
_el$5.style.setProperty("display", "flex");
|
|
5130
5151
|
_el$5.style.setProperty("flex-direction", "column");
|
|
5131
5152
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -5138,7 +5159,7 @@ function Video(props) {
|
|
|
5138
5159
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
5139
5160
|
},
|
|
5140
5161
|
get children() {
|
|
5141
|
-
const _el$6 = _tmpl$
|
|
5162
|
+
const _el$6 = _tmpl$21();
|
|
5142
5163
|
_el$6.style.setProperty("pointer-events", "none");
|
|
5143
5164
|
_el$6.style.setProperty("display", "flex");
|
|
5144
5165
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -5295,7 +5316,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5295
5316
|
}
|
|
5296
5317
|
|
|
5297
5318
|
// src/constants/sdk-version.ts
|
|
5298
|
-
var SDK_VERSION = "
|
|
5319
|
+
var SDK_VERSION = "4.0.0";
|
|
5299
5320
|
|
|
5300
5321
|
// src/helpers/sdk-headers.ts
|
|
5301
5322
|
var getSdkHeaders = () => ({
|
|
@@ -5897,7 +5918,7 @@ var registerInsertMenu = () => {
|
|
|
5897
5918
|
});
|
|
5898
5919
|
};
|
|
5899
5920
|
var isSetupForEditing = false;
|
|
5900
|
-
var setupBrowserForEditing = (options
|
|
5921
|
+
var setupBrowserForEditing = (options) => {
|
|
5901
5922
|
if (isSetupForEditing) {
|
|
5902
5923
|
return;
|
|
5903
5924
|
}
|
|
@@ -5913,6 +5934,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5913
5934
|
// scope our '+ add block' button styling
|
|
5914
5935
|
supportsAddBlockScoping: true,
|
|
5915
5936
|
supportsCustomBreakpoints: true,
|
|
5937
|
+
modelName: options.modelName,
|
|
5938
|
+
apiKey: options.apiKey,
|
|
5916
5939
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5917
5940
|
blockLevelPersonalization: true
|
|
5918
5941
|
}
|
|
@@ -6018,13 +6041,21 @@ var createEditorListener = ({
|
|
|
6018
6041
|
}
|
|
6019
6042
|
};
|
|
6020
6043
|
};
|
|
6021
|
-
var subscribeToEditor = (
|
|
6044
|
+
var subscribeToEditor = ({
|
|
6045
|
+
model,
|
|
6046
|
+
apiKey,
|
|
6047
|
+
callback,
|
|
6048
|
+
trustedHosts
|
|
6049
|
+
}) => {
|
|
6022
6050
|
if (!isBrowser) {
|
|
6023
6051
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
6024
6052
|
return () => {
|
|
6025
6053
|
};
|
|
6026
6054
|
}
|
|
6027
|
-
setupBrowserForEditing(
|
|
6055
|
+
setupBrowserForEditing({
|
|
6056
|
+
modelName: model,
|
|
6057
|
+
apiKey
|
|
6058
|
+
});
|
|
6028
6059
|
const listener = createEditorListener({
|
|
6029
6060
|
callbacks: {
|
|
6030
6061
|
contentUpdate: callback,
|
|
@@ -6034,7 +6065,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
6034
6065
|
}
|
|
6035
6066
|
},
|
|
6036
6067
|
model,
|
|
6037
|
-
trustedHosts
|
|
6068
|
+
trustedHosts
|
|
6038
6069
|
});
|
|
6039
6070
|
window.addEventListener("message", listener);
|
|
6040
6071
|
return () => {
|
|
@@ -6279,10 +6310,12 @@ function EnableEditor(props) {
|
|
|
6279
6310
|
} : {},
|
|
6280
6311
|
...props.trustedHosts ? {
|
|
6281
6312
|
trustedHosts: props.trustedHosts
|
|
6282
|
-
} : {}
|
|
6313
|
+
} : {},
|
|
6314
|
+
modelName: props.model ?? "",
|
|
6315
|
+
apiKey: props.apiKey
|
|
6283
6316
|
});
|
|
6284
6317
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
6285
|
-
if (!
|
|
6318
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
6286
6319
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
6287
6320
|
window.parent?.postMessage(message, "*");
|
|
6288
6321
|
}
|
|
@@ -6310,7 +6343,7 @@ function EnableEditor(props) {
|
|
|
6310
6343
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
6311
6344
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
6312
6345
|
fetchOneEntry({
|
|
6313
|
-
model: props.model
|
|
6346
|
+
model: props.model,
|
|
6314
6347
|
apiKey: props.apiKey,
|
|
6315
6348
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
6316
6349
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6504,7 +6537,7 @@ function ContentComponent(props) {
|
|
|
6504
6537
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6505
6538
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6506
6539
|
nonce: props.nonce || "",
|
|
6507
|
-
model: props.model
|
|
6540
|
+
model: props.model
|
|
6508
6541
|
});
|
|
6509
6542
|
function contentSetState(newRootState) {
|
|
6510
6543
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6945,7 +6978,7 @@ function Symbol(props) {
|
|
|
6945
6978
|
return props.builderContext.canTrack;
|
|
6946
6979
|
},
|
|
6947
6980
|
get model() {
|
|
6948
|
-
return props.symbol?.model;
|
|
6981
|
+
return props.symbol?.model ?? "";
|
|
6949
6982
|
},
|
|
6950
6983
|
get content() {
|
|
6951
6984
|
return contentToUse();
|
package/lib/browser/index.jsx
CHANGED
|
@@ -1908,10 +1908,10 @@ function SectionComponent(props) {
|
|
|
1908
1908
|
var section_default = SectionComponent;
|
|
1909
1909
|
|
|
1910
1910
|
// src/blocks/symbol/symbol.tsx
|
|
1911
|
-
import { onMount as
|
|
1911
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
1912
1912
|
|
|
1913
1913
|
// src/components/content-variants/content-variants.tsx
|
|
1914
|
-
import { Show as Show16, For as For9, onMount as
|
|
1914
|
+
import { Show as Show16, For as For9, onMount as onMount8, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
1915
1915
|
|
|
1916
1916
|
// src/helpers/url.ts
|
|
1917
1917
|
var getTopLevelDomain = (host) => {
|
|
@@ -4554,8 +4554,9 @@ var componentInfo20 = {
|
|
|
4554
4554
|
};
|
|
4555
4555
|
|
|
4556
4556
|
// src/blocks/video/video.tsx
|
|
4557
|
-
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
4557
|
+
import { Show as Show13, onMount as onMount6, createSignal as createSignal15, createMemo as createMemo15 } from "solid-js";
|
|
4558
4558
|
function Video(props) {
|
|
4559
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
4559
4560
|
const videoProps = createMemo15(() => {
|
|
4560
4561
|
return {
|
|
4561
4562
|
...props.autoPlay === true ? {
|
|
@@ -4580,6 +4581,35 @@ function Video(props) {
|
|
|
4580
4581
|
...videoProps()
|
|
4581
4582
|
};
|
|
4582
4583
|
});
|
|
4584
|
+
let videoRef;
|
|
4585
|
+
onMount6(() => {
|
|
4586
|
+
if (props.lazyLoad) {
|
|
4587
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
4588
|
+
entries.forEach(function(entry) {
|
|
4589
|
+
if (!entry.isIntersecting)
|
|
4590
|
+
return;
|
|
4591
|
+
const videoElement = entry.target;
|
|
4592
|
+
try {
|
|
4593
|
+
Array.from(videoElement.children).filter(
|
|
4594
|
+
(child) => child instanceof HTMLElement && child.tagName === "SOURCE"
|
|
4595
|
+
).forEach((source) => {
|
|
4596
|
+
const src = source.dataset.src;
|
|
4597
|
+
if (src) {
|
|
4598
|
+
source.src = src;
|
|
4599
|
+
}
|
|
4600
|
+
});
|
|
4601
|
+
videoElement.load();
|
|
4602
|
+
oberver.unobserve(videoElement);
|
|
4603
|
+
} catch (error) {
|
|
4604
|
+
}
|
|
4605
|
+
});
|
|
4606
|
+
});
|
|
4607
|
+
if (videoRef) {
|
|
4608
|
+
oberver.observe(videoRef);
|
|
4609
|
+
}
|
|
4610
|
+
setLazyVideoObserver(oberver);
|
|
4611
|
+
}
|
|
4612
|
+
});
|
|
4583
4613
|
return <><div
|
|
4584
4614
|
style={{
|
|
4585
4615
|
position: "relative"
|
|
@@ -4588,7 +4618,8 @@ function Video(props) {
|
|
|
4588
4618
|
<video
|
|
4589
4619
|
class="builder-video"
|
|
4590
4620
|
{...spreadProps()}
|
|
4591
|
-
|
|
4621
|
+
ref={videoRef}
|
|
4622
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
4592
4623
|
style={{
|
|
4593
4624
|
width: "100%",
|
|
4594
4625
|
height: "100%",
|
|
@@ -4602,9 +4633,15 @@ function Video(props) {
|
|
|
4602
4633
|
position: "absolute"
|
|
4603
4634
|
} : null
|
|
4604
4635
|
}}
|
|
4605
|
-
src={props.video || "no-src"}
|
|
4606
4636
|
poster={props.posterImage}
|
|
4607
|
-
><
|
|
4637
|
+
><source
|
|
4638
|
+
type="video/mp4"
|
|
4639
|
+
{...props.lazyLoad ? {
|
|
4640
|
+
"data-src": props.video
|
|
4641
|
+
} : {
|
|
4642
|
+
src: props.video
|
|
4643
|
+
}}
|
|
4644
|
+
/></video>
|
|
4608
4645
|
<Show13
|
|
4609
4646
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4610
4647
|
><div
|
|
@@ -4774,7 +4811,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4774
4811
|
// src/components/content/components/enable-editor.tsx
|
|
4775
4812
|
import {
|
|
4776
4813
|
Show as Show14,
|
|
4777
|
-
onMount as
|
|
4814
|
+
onMount as onMount7,
|
|
4778
4815
|
on as on3,
|
|
4779
4816
|
createEffect as createEffect3,
|
|
4780
4817
|
createMemo as createMemo16,
|
|
@@ -4788,7 +4825,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4788
4825
|
}
|
|
4789
4826
|
|
|
4790
4827
|
// src/constants/sdk-version.ts
|
|
4791
|
-
var SDK_VERSION = "
|
|
4828
|
+
var SDK_VERSION = "4.0.0";
|
|
4792
4829
|
|
|
4793
4830
|
// src/helpers/sdk-headers.ts
|
|
4794
4831
|
var getSdkHeaders = () => ({
|
|
@@ -5390,7 +5427,7 @@ var registerInsertMenu = () => {
|
|
|
5390
5427
|
});
|
|
5391
5428
|
};
|
|
5392
5429
|
var isSetupForEditing = false;
|
|
5393
|
-
var setupBrowserForEditing = (options
|
|
5430
|
+
var setupBrowserForEditing = (options) => {
|
|
5394
5431
|
if (isSetupForEditing) {
|
|
5395
5432
|
return;
|
|
5396
5433
|
}
|
|
@@ -5406,6 +5443,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5406
5443
|
// scope our '+ add block' button styling
|
|
5407
5444
|
supportsAddBlockScoping: true,
|
|
5408
5445
|
supportsCustomBreakpoints: true,
|
|
5446
|
+
modelName: options.modelName,
|
|
5447
|
+
apiKey: options.apiKey,
|
|
5409
5448
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5410
5449
|
blockLevelPersonalization: true
|
|
5411
5450
|
}
|
|
@@ -5511,13 +5550,21 @@ var createEditorListener = ({
|
|
|
5511
5550
|
}
|
|
5512
5551
|
};
|
|
5513
5552
|
};
|
|
5514
|
-
var subscribeToEditor = (
|
|
5553
|
+
var subscribeToEditor = ({
|
|
5554
|
+
model,
|
|
5555
|
+
apiKey,
|
|
5556
|
+
callback,
|
|
5557
|
+
trustedHosts
|
|
5558
|
+
}) => {
|
|
5515
5559
|
if (!isBrowser) {
|
|
5516
5560
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
5517
5561
|
return () => {
|
|
5518
5562
|
};
|
|
5519
5563
|
}
|
|
5520
|
-
setupBrowserForEditing(
|
|
5564
|
+
setupBrowserForEditing({
|
|
5565
|
+
modelName: model,
|
|
5566
|
+
apiKey
|
|
5567
|
+
});
|
|
5521
5568
|
const listener = createEditorListener({
|
|
5522
5569
|
callbacks: {
|
|
5523
5570
|
contentUpdate: callback,
|
|
@@ -5527,7 +5574,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
5527
5574
|
}
|
|
5528
5575
|
},
|
|
5529
5576
|
model,
|
|
5530
|
-
trustedHosts
|
|
5577
|
+
trustedHosts
|
|
5531
5578
|
});
|
|
5532
5579
|
window.addEventListener("message", listener);
|
|
5533
5580
|
return () => {
|
|
@@ -5767,7 +5814,7 @@ function EnableEditor(props) {
|
|
|
5767
5814
|
let elementRef;
|
|
5768
5815
|
runHttpRequests();
|
|
5769
5816
|
emitStateUpdate();
|
|
5770
|
-
|
|
5817
|
+
onMount7(() => {
|
|
5771
5818
|
if (isBrowser()) {
|
|
5772
5819
|
if (isEditing() && !props.isNestedRender) {
|
|
5773
5820
|
window.addEventListener("message", processMessage);
|
|
@@ -5781,12 +5828,14 @@ function EnableEditor(props) {
|
|
|
5781
5828
|
} : {},
|
|
5782
5829
|
...props.trustedHosts ? {
|
|
5783
5830
|
trustedHosts: props.trustedHosts
|
|
5784
|
-
} : {}
|
|
5831
|
+
} : {},
|
|
5832
|
+
modelName: props.model ?? "",
|
|
5833
|
+
apiKey: props.apiKey
|
|
5785
5834
|
});
|
|
5786
5835
|
Object.values(
|
|
5787
5836
|
props.builderContextSignal.componentInfos
|
|
5788
5837
|
).forEach((registeredComponent) => {
|
|
5789
|
-
if (!
|
|
5838
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
5790
5839
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
5791
5840
|
window.parent?.postMessage(message, "*");
|
|
5792
5841
|
}
|
|
@@ -5819,7 +5868,7 @@ function EnableEditor(props) {
|
|
|
5819
5868
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
5820
5869
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5821
5870
|
fetchOneEntry({
|
|
5822
|
-
model: props.model
|
|
5871
|
+
model: props.model,
|
|
5823
5872
|
apiKey: props.apiKey,
|
|
5824
5873
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
5825
5874
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6007,7 +6056,7 @@ function ContentComponent(props) {
|
|
|
6007
6056
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6008
6057
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6009
6058
|
nonce: props.nonce || "",
|
|
6010
|
-
model: props.model
|
|
6059
|
+
model: props.model
|
|
6011
6060
|
});
|
|
6012
6061
|
function contentSetState(newRootState) {
|
|
6013
6062
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6112,7 +6161,7 @@ function ContentVariants(props) {
|
|
|
6112
6161
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
6113
6162
|
});
|
|
6114
6163
|
});
|
|
6115
|
-
|
|
6164
|
+
onMount8(() => {
|
|
6116
6165
|
setShouldRenderVariants(false);
|
|
6117
6166
|
});
|
|
6118
6167
|
return <><>
|
|
@@ -6242,7 +6291,7 @@ function Symbol(props) {
|
|
|
6242
6291
|
}
|
|
6243
6292
|
});
|
|
6244
6293
|
}
|
|
6245
|
-
|
|
6294
|
+
onMount9(() => {
|
|
6246
6295
|
});
|
|
6247
6296
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
6248
6297
|
function onUpdateFn_0() {
|
|
@@ -6265,7 +6314,7 @@ function Symbol(props) {
|
|
|
6265
6314
|
...contentToUse()?.data?.state
|
|
6266
6315
|
}}
|
|
6267
6316
|
canTrack={props.builderContext.canTrack}
|
|
6268
|
-
model={props.symbol?.model}
|
|
6317
|
+
model={props.symbol?.model ?? ""}
|
|
6269
6318
|
content={contentToUse()}
|
|
6270
6319
|
linkComponent={props.builderLinkComponent}
|
|
6271
6320
|
blocksWrapper={blocksWrapper()}
|
package/lib/edge/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
|
|
|
4
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -8234,10 +8234,10 @@ var componentInfo20 = {
|
|
|
8234
8234
|
builderBlock: true
|
|
8235
8235
|
}
|
|
8236
8236
|
};
|
|
8237
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
8238
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
8239
|
-
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
8237
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<div>`);
|
|
8238
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div><video class=builder-video><source type=video/mp4>`);
|
|
8240
8239
|
function Video(props) {
|
|
8240
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
8241
8241
|
const videoProps = createMemo(() => {
|
|
8242
8242
|
return {
|
|
8243
8243
|
...props.autoPlay === true ? {
|
|
@@ -8262,12 +8262,42 @@ function Video(props) {
|
|
|
8262
8262
|
...videoProps()
|
|
8263
8263
|
};
|
|
8264
8264
|
});
|
|
8265
|
+
let videoRef;
|
|
8266
|
+
onMount(() => {
|
|
8267
|
+
if (props.lazyLoad) {
|
|
8268
|
+
const oberver = new IntersectionObserver(function(entries) {
|
|
8269
|
+
entries.forEach(function(entry) {
|
|
8270
|
+
if (!entry.isIntersecting)
|
|
8271
|
+
return;
|
|
8272
|
+
const videoElement = entry.target;
|
|
8273
|
+
try {
|
|
8274
|
+
Array.from(videoElement.children).filter((child) => child instanceof HTMLElement && child.tagName === "SOURCE").forEach((source) => {
|
|
8275
|
+
const src = source.dataset.src;
|
|
8276
|
+
if (src) {
|
|
8277
|
+
source.src = src;
|
|
8278
|
+
}
|
|
8279
|
+
});
|
|
8280
|
+
videoElement.load();
|
|
8281
|
+
oberver.unobserve(videoElement);
|
|
8282
|
+
} catch (error) {
|
|
8283
|
+
console.error("Error loading lazy video:", error);
|
|
8284
|
+
}
|
|
8285
|
+
});
|
|
8286
|
+
});
|
|
8287
|
+
if (videoRef) {
|
|
8288
|
+
oberver.observe(videoRef);
|
|
8289
|
+
}
|
|
8290
|
+
setLazyVideoObserver(oberver);
|
|
8291
|
+
}
|
|
8292
|
+
});
|
|
8265
8293
|
return (() => {
|
|
8266
|
-
const _el$ = _tmpl$
|
|
8294
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
8267
8295
|
_el$.style.setProperty("position", "relative");
|
|
8296
|
+
const _ref$ = videoRef;
|
|
8297
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
8268
8298
|
spread(_el$2, mergeProps(spreadProps, {
|
|
8269
8299
|
get preload() {
|
|
8270
|
-
return props.preload || "metadata";
|
|
8300
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
8271
8301
|
},
|
|
8272
8302
|
get style() {
|
|
8273
8303
|
return {
|
|
@@ -8284,29 +8314,21 @@ function Video(props) {
|
|
|
8284
8314
|
} : null
|
|
8285
8315
|
};
|
|
8286
8316
|
},
|
|
8287
|
-
get src() {
|
|
8288
|
-
return props.video || "no-src";
|
|
8289
|
-
},
|
|
8290
8317
|
get poster() {
|
|
8291
8318
|
return props.posterImage;
|
|
8292
8319
|
}
|
|
8293
8320
|
}), false, true);
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
const _el$3 = _tmpl$21();
|
|
8300
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
8301
|
-
return _el$3;
|
|
8302
|
-
}
|
|
8303
|
-
}));
|
|
8321
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
8322
|
+
"data-src": props.video
|
|
8323
|
+
} : {
|
|
8324
|
+
src: props.video
|
|
8325
|
+
}), false, false);
|
|
8304
8326
|
insert(_el$, createComponent(Show, {
|
|
8305
8327
|
get when() {
|
|
8306
8328
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
8307
8329
|
},
|
|
8308
8330
|
get children() {
|
|
8309
|
-
const _el$4 = _tmpl$
|
|
8331
|
+
const _el$4 = _tmpl$21();
|
|
8310
8332
|
_el$4.style.setProperty("width", "100%");
|
|
8311
8333
|
_el$4.style.setProperty("pointer-events", "none");
|
|
8312
8334
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -8319,7 +8341,7 @@ function Video(props) {
|
|
|
8319
8341
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
8320
8342
|
},
|
|
8321
8343
|
get children() {
|
|
8322
|
-
const _el$5 = _tmpl$
|
|
8344
|
+
const _el$5 = _tmpl$21();
|
|
8323
8345
|
_el$5.style.setProperty("display", "flex");
|
|
8324
8346
|
_el$5.style.setProperty("flex-direction", "column");
|
|
8325
8347
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -8332,7 +8354,7 @@ function Video(props) {
|
|
|
8332
8354
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
8333
8355
|
},
|
|
8334
8356
|
get children() {
|
|
8335
|
-
const _el$6 = _tmpl$
|
|
8357
|
+
const _el$6 = _tmpl$21();
|
|
8336
8358
|
_el$6.style.setProperty("pointer-events", "none");
|
|
8337
8359
|
_el$6.style.setProperty("display", "flex");
|
|
8338
8360
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -8489,7 +8511,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8489
8511
|
}
|
|
8490
8512
|
|
|
8491
8513
|
// src/constants/sdk-version.ts
|
|
8492
|
-
var SDK_VERSION = "
|
|
8514
|
+
var SDK_VERSION = "4.0.0";
|
|
8493
8515
|
|
|
8494
8516
|
// src/helpers/sdk-headers.ts
|
|
8495
8517
|
var getSdkHeaders = () => ({
|
|
@@ -9097,7 +9119,7 @@ var registerInsertMenu = () => {
|
|
|
9097
9119
|
});
|
|
9098
9120
|
};
|
|
9099
9121
|
var isSetupForEditing = false;
|
|
9100
|
-
var setupBrowserForEditing = (options
|
|
9122
|
+
var setupBrowserForEditing = (options) => {
|
|
9101
9123
|
if (isSetupForEditing) {
|
|
9102
9124
|
return;
|
|
9103
9125
|
}
|
|
@@ -9113,6 +9135,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
9113
9135
|
// scope our '+ add block' button styling
|
|
9114
9136
|
supportsAddBlockScoping: true,
|
|
9115
9137
|
supportsCustomBreakpoints: true,
|
|
9138
|
+
modelName: options.modelName,
|
|
9139
|
+
apiKey: options.apiKey,
|
|
9116
9140
|
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
9117
9141
|
blockLevelPersonalization: true
|
|
9118
9142
|
}
|
|
@@ -9218,13 +9242,21 @@ var createEditorListener = ({
|
|
|
9218
9242
|
}
|
|
9219
9243
|
};
|
|
9220
9244
|
};
|
|
9221
|
-
var subscribeToEditor = (
|
|
9245
|
+
var subscribeToEditor = ({
|
|
9246
|
+
model,
|
|
9247
|
+
apiKey,
|
|
9248
|
+
callback,
|
|
9249
|
+
trustedHosts
|
|
9250
|
+
}) => {
|
|
9222
9251
|
if (!isBrowser) {
|
|
9223
9252
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
9224
9253
|
return () => {
|
|
9225
9254
|
};
|
|
9226
9255
|
}
|
|
9227
|
-
setupBrowserForEditing(
|
|
9256
|
+
setupBrowserForEditing({
|
|
9257
|
+
modelName: model,
|
|
9258
|
+
apiKey
|
|
9259
|
+
});
|
|
9228
9260
|
const listener = createEditorListener({
|
|
9229
9261
|
callbacks: {
|
|
9230
9262
|
contentUpdate: callback,
|
|
@@ -9234,7 +9266,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
9234
9266
|
}
|
|
9235
9267
|
},
|
|
9236
9268
|
model,
|
|
9237
|
-
trustedHosts
|
|
9269
|
+
trustedHosts
|
|
9238
9270
|
});
|
|
9239
9271
|
window.addEventListener("message", listener);
|
|
9240
9272
|
return () => {
|
|
@@ -9480,10 +9512,12 @@ function EnableEditor(props) {
|
|
|
9480
9512
|
} : {},
|
|
9481
9513
|
...props.trustedHosts ? {
|
|
9482
9514
|
trustedHosts: props.trustedHosts
|
|
9483
|
-
} : {}
|
|
9515
|
+
} : {},
|
|
9516
|
+
modelName: props.model ?? "",
|
|
9517
|
+
apiKey: props.apiKey
|
|
9484
9518
|
});
|
|
9485
9519
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
9486
|
-
if (!
|
|
9520
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
9487
9521
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
9488
9522
|
window.parent?.postMessage(message, "*");
|
|
9489
9523
|
}
|
|
@@ -9511,7 +9545,7 @@ function EnableEditor(props) {
|
|
|
9511
9545
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
9512
9546
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
9513
9547
|
fetchOneEntry({
|
|
9514
|
-
model: props.model
|
|
9548
|
+
model: props.model,
|
|
9515
9549
|
apiKey: props.apiKey,
|
|
9516
9550
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
9517
9551
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -9705,7 +9739,7 @@ function ContentComponent(props) {
|
|
|
9705
9739
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
9706
9740
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
9707
9741
|
nonce: props.nonce || "",
|
|
9708
|
-
model: props.model
|
|
9742
|
+
model: props.model
|
|
9709
9743
|
});
|
|
9710
9744
|
function contentSetState(newRootState) {
|
|
9711
9745
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -10146,7 +10180,7 @@ function Symbol2(props) {
|
|
|
10146
10180
|
return props.builderContext.canTrack;
|
|
10147
10181
|
},
|
|
10148
10182
|
get model() {
|
|
10149
|
-
return props.symbol?.model;
|
|
10183
|
+
return props.symbol?.model ?? "";
|
|
10150
10184
|
},
|
|
10151
10185
|
get content() {
|
|
10152
10186
|
return contentToUse();
|