@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/dist/index.d.ts +16 -16
- package/lib/browser/dev.js +99 -39
- package/lib/browser/dev.jsx +108 -26
- package/lib/browser/index.js +98 -39
- package/lib/browser/index.jsx +107 -26
- package/lib/edge/dev.js +99 -39
- package/lib/edge/dev.jsx +108 -26
- package/lib/edge/index.js +98 -39
- package/lib/edge/index.jsx +107 -26
- package/lib/node/dev.js +99 -39
- package/lib/node/dev.jsx +108 -26
- package/lib/node/index.js +98 -39
- package/lib/node/index.jsx +107 -26
- 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
|
|
|
@@ -1108,8 +1108,13 @@ var provideBuilderContext = (block, context) => {
|
|
|
1108
1108
|
|
|
1109
1109
|
// src/constants/device-sizes.ts
|
|
1110
1110
|
var SIZES = {
|
|
1111
|
+
xsmall: {
|
|
1112
|
+
min: 0,
|
|
1113
|
+
default: 160,
|
|
1114
|
+
max: 320
|
|
1115
|
+
},
|
|
1111
1116
|
small: {
|
|
1112
|
-
min:
|
|
1117
|
+
min: 321,
|
|
1113
1118
|
default: 321,
|
|
1114
1119
|
max: 640
|
|
1115
1120
|
},
|
|
@@ -1125,15 +1130,28 @@ var SIZES = {
|
|
|
1125
1130
|
}
|
|
1126
1131
|
};
|
|
1127
1132
|
var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
|
|
1128
|
-
var getSizesForBreakpoints = ({
|
|
1129
|
-
small,
|
|
1130
|
-
medium
|
|
1131
|
-
}) => {
|
|
1133
|
+
var getSizesForBreakpoints = (breakpoints) => {
|
|
1132
1134
|
const newSizes = fastClone(SIZES);
|
|
1135
|
+
if (!breakpoints) {
|
|
1136
|
+
return newSizes;
|
|
1137
|
+
}
|
|
1138
|
+
const {
|
|
1139
|
+
xsmall,
|
|
1140
|
+
small,
|
|
1141
|
+
medium
|
|
1142
|
+
} = breakpoints;
|
|
1143
|
+
if (xsmall) {
|
|
1144
|
+
const xsmallMin = Math.floor(xsmall / 2);
|
|
1145
|
+
newSizes.xsmall = {
|
|
1146
|
+
max: xsmall,
|
|
1147
|
+
min: xsmallMin,
|
|
1148
|
+
default: xsmallMin + 1
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1133
1151
|
if (!small || !medium) {
|
|
1134
1152
|
return newSizes;
|
|
1135
1153
|
}
|
|
1136
|
-
const smallMin = Math.floor(small / 2);
|
|
1154
|
+
const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
|
|
1137
1155
|
newSizes.small = {
|
|
1138
1156
|
max: small,
|
|
1139
1157
|
min: smallMin,
|
|
@@ -1191,9 +1209,11 @@ function BlockStyles(props) {
|
|
|
1191
1209
|
const styles = processedBlock.responsiveStyles;
|
|
1192
1210
|
const content = props.context.content;
|
|
1193
1211
|
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
|
|
1212
|
+
const contentHasXSmallBreakpoint = Boolean(content?.meta?.breakpoints?.xsmall);
|
|
1194
1213
|
const largeStyles = styles?.large;
|
|
1195
1214
|
const mediumStyles = styles?.medium;
|
|
1196
1215
|
const smallStyles = styles?.small;
|
|
1216
|
+
const xsmallStyles = styles?.xsmall;
|
|
1197
1217
|
const className = processedBlock.id;
|
|
1198
1218
|
if (!className) {
|
|
1199
1219
|
return "";
|
|
@@ -1212,6 +1232,11 @@ function BlockStyles(props) {
|
|
|
1212
1232
|
styles: smallStyles,
|
|
1213
1233
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
1214
1234
|
}) : "";
|
|
1235
|
+
const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
|
|
1236
|
+
className,
|
|
1237
|
+
styles: xsmallStyles,
|
|
1238
|
+
mediaQuery: getMaxWidthQueryForSize("xsmall", sizesWithUpdatedBreakpoints)
|
|
1239
|
+
}) : "";
|
|
1215
1240
|
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
1216
1241
|
let hoverStylesClass = "";
|
|
1217
1242
|
if (hoverAnimation) {
|
|
@@ -1225,7 +1250,7 @@ function BlockStyles(props) {
|
|
|
1225
1250
|
}
|
|
1226
1251
|
}) || "";
|
|
1227
1252
|
}
|
|
1228
|
-
return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
|
|
1253
|
+
return [largeStylesClass, mediumStylesClass, smallStylesClass, xsmallStylesClass, hoverStylesClass].join(" ");
|
|
1229
1254
|
});
|
|
1230
1255
|
return createComponent(Show, {
|
|
1231
1256
|
get when() {
|
|
@@ -5197,10 +5222,10 @@ var componentInfo20 = {
|
|
|
5197
5222
|
builderBlock: true
|
|
5198
5223
|
}
|
|
5199
5224
|
};
|
|
5200
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
5201
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
5202
|
-
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>`);
|
|
5203
5227
|
function Video(props) {
|
|
5228
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
5204
5229
|
const videoProps = createMemo(() => {
|
|
5205
5230
|
return {
|
|
5206
5231
|
...props.autoPlay === true ? {
|
|
@@ -5225,12 +5250,42 @@ function Video(props) {
|
|
|
5225
5250
|
...videoProps()
|
|
5226
5251
|
};
|
|
5227
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
|
+
});
|
|
5228
5281
|
return (() => {
|
|
5229
|
-
const _el$ = _tmpl$
|
|
5282
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
5230
5283
|
_el$.style.setProperty("position", "relative");
|
|
5284
|
+
const _ref$ = videoRef;
|
|
5285
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
5231
5286
|
spread(_el$2, mergeProps(spreadProps, {
|
|
5232
5287
|
get preload() {
|
|
5233
|
-
return props.preload || "metadata";
|
|
5288
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
5234
5289
|
},
|
|
5235
5290
|
get style() {
|
|
5236
5291
|
return {
|
|
@@ -5247,29 +5302,21 @@ function Video(props) {
|
|
|
5247
5302
|
} : null
|
|
5248
5303
|
};
|
|
5249
5304
|
},
|
|
5250
|
-
get src() {
|
|
5251
|
-
return props.video || "no-src";
|
|
5252
|
-
},
|
|
5253
5305
|
get poster() {
|
|
5254
5306
|
return props.posterImage;
|
|
5255
5307
|
}
|
|
5256
5308
|
}), false, true);
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
const _el$3 = _tmpl$21();
|
|
5263
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
5264
|
-
return _el$3;
|
|
5265
|
-
}
|
|
5266
|
-
}));
|
|
5309
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
5310
|
+
"data-src": props.video
|
|
5311
|
+
} : {
|
|
5312
|
+
src: props.video
|
|
5313
|
+
}), false, false);
|
|
5267
5314
|
insert(_el$, createComponent(Show, {
|
|
5268
5315
|
get when() {
|
|
5269
5316
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
5270
5317
|
},
|
|
5271
5318
|
get children() {
|
|
5272
|
-
const _el$4 = _tmpl$
|
|
5319
|
+
const _el$4 = _tmpl$21();
|
|
5273
5320
|
_el$4.style.setProperty("width", "100%");
|
|
5274
5321
|
_el$4.style.setProperty("pointer-events", "none");
|
|
5275
5322
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -5282,7 +5329,7 @@ function Video(props) {
|
|
|
5282
5329
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
5283
5330
|
},
|
|
5284
5331
|
get children() {
|
|
5285
|
-
const _el$5 = _tmpl$
|
|
5332
|
+
const _el$5 = _tmpl$21();
|
|
5286
5333
|
_el$5.style.setProperty("display", "flex");
|
|
5287
5334
|
_el$5.style.setProperty("flex-direction", "column");
|
|
5288
5335
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -5295,7 +5342,7 @@ function Video(props) {
|
|
|
5295
5342
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
5296
5343
|
},
|
|
5297
5344
|
get children() {
|
|
5298
|
-
const _el$6 = _tmpl$
|
|
5345
|
+
const _el$6 = _tmpl$21();
|
|
5299
5346
|
_el$6.style.setProperty("pointer-events", "none");
|
|
5300
5347
|
_el$6.style.setProperty("display", "flex");
|
|
5301
5348
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -5452,7 +5499,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5452
5499
|
}
|
|
5453
5500
|
|
|
5454
5501
|
// src/constants/sdk-version.ts
|
|
5455
|
-
var SDK_VERSION = "
|
|
5502
|
+
var SDK_VERSION = "4.0.0";
|
|
5456
5503
|
|
|
5457
5504
|
// src/helpers/sdk-headers.ts
|
|
5458
5505
|
var getSdkHeaders = () => ({
|
|
@@ -6060,7 +6107,7 @@ var registerInsertMenu = () => {
|
|
|
6060
6107
|
});
|
|
6061
6108
|
};
|
|
6062
6109
|
var isSetupForEditing = false;
|
|
6063
|
-
var setupBrowserForEditing = (options
|
|
6110
|
+
var setupBrowserForEditing = (options) => {
|
|
6064
6111
|
if (isSetupForEditing) {
|
|
6065
6112
|
return;
|
|
6066
6113
|
}
|
|
@@ -6076,6 +6123,9 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
6076
6123
|
// scope our '+ add block' button styling
|
|
6077
6124
|
supportsAddBlockScoping: true,
|
|
6078
6125
|
supportsCustomBreakpoints: true,
|
|
6126
|
+
modelName: options.modelName,
|
|
6127
|
+
apiKey: options.apiKey,
|
|
6128
|
+
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
6079
6129
|
blockLevelPersonalization: true
|
|
6080
6130
|
}
|
|
6081
6131
|
}, "*");
|
|
@@ -6180,13 +6230,21 @@ var createEditorListener = ({
|
|
|
6180
6230
|
}
|
|
6181
6231
|
};
|
|
6182
6232
|
};
|
|
6183
|
-
var subscribeToEditor = (
|
|
6233
|
+
var subscribeToEditor = ({
|
|
6234
|
+
model,
|
|
6235
|
+
apiKey,
|
|
6236
|
+
callback,
|
|
6237
|
+
trustedHosts
|
|
6238
|
+
}) => {
|
|
6184
6239
|
if (!isBrowser) {
|
|
6185
6240
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
6186
6241
|
return () => {
|
|
6187
6242
|
};
|
|
6188
6243
|
}
|
|
6189
|
-
setupBrowserForEditing(
|
|
6244
|
+
setupBrowserForEditing({
|
|
6245
|
+
modelName: model,
|
|
6246
|
+
apiKey
|
|
6247
|
+
});
|
|
6190
6248
|
const listener = createEditorListener({
|
|
6191
6249
|
callbacks: {
|
|
6192
6250
|
contentUpdate: callback,
|
|
@@ -6196,7 +6254,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
6196
6254
|
}
|
|
6197
6255
|
},
|
|
6198
6256
|
model,
|
|
6199
|
-
trustedHosts
|
|
6257
|
+
trustedHosts
|
|
6200
6258
|
});
|
|
6201
6259
|
window.addEventListener("message", listener);
|
|
6202
6260
|
return () => {
|
|
@@ -6442,10 +6500,12 @@ function EnableEditor(props) {
|
|
|
6442
6500
|
} : {},
|
|
6443
6501
|
...props.trustedHosts ? {
|
|
6444
6502
|
trustedHosts: props.trustedHosts
|
|
6445
|
-
} : {}
|
|
6503
|
+
} : {},
|
|
6504
|
+
modelName: props.model ?? "",
|
|
6505
|
+
apiKey: props.apiKey
|
|
6446
6506
|
});
|
|
6447
6507
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
6448
|
-
if (!
|
|
6508
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
6449
6509
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
6450
6510
|
window.parent?.postMessage(message, "*");
|
|
6451
6511
|
}
|
|
@@ -6473,7 +6533,7 @@ function EnableEditor(props) {
|
|
|
6473
6533
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
6474
6534
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
6475
6535
|
fetchOneEntry({
|
|
6476
|
-
model: props.model
|
|
6536
|
+
model: props.model,
|
|
6477
6537
|
apiKey: props.apiKey,
|
|
6478
6538
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
6479
6539
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6667,7 +6727,7 @@ function ContentComponent(props) {
|
|
|
6667
6727
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6668
6728
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6669
6729
|
nonce: props.nonce || "",
|
|
6670
|
-
model: props.model
|
|
6730
|
+
model: props.model
|
|
6671
6731
|
});
|
|
6672
6732
|
function contentSetState(newRootState) {
|
|
6673
6733
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -7108,7 +7168,7 @@ function Symbol(props) {
|
|
|
7108
7168
|
return props.builderContext.canTrack;
|
|
7109
7169
|
},
|
|
7110
7170
|
get model() {
|
|
7111
|
-
return props.symbol?.model;
|
|
7171
|
+
return props.symbol?.model ?? "";
|
|
7112
7172
|
},
|
|
7113
7173
|
get content() {
|
|
7114
7174
|
return contentToUse();
|
package/lib/node/dev.jsx
CHANGED
|
@@ -1106,8 +1106,13 @@ import { Show as Show2, createMemo } from "solid-js";
|
|
|
1106
1106
|
|
|
1107
1107
|
// src/constants/device-sizes.ts
|
|
1108
1108
|
var SIZES = {
|
|
1109
|
+
xsmall: {
|
|
1110
|
+
min: 0,
|
|
1111
|
+
default: 160,
|
|
1112
|
+
max: 320
|
|
1113
|
+
},
|
|
1109
1114
|
small: {
|
|
1110
|
-
min:
|
|
1115
|
+
min: 321,
|
|
1111
1116
|
default: 321,
|
|
1112
1117
|
max: 640
|
|
1113
1118
|
},
|
|
@@ -1123,15 +1128,28 @@ var SIZES = {
|
|
|
1123
1128
|
}
|
|
1124
1129
|
};
|
|
1125
1130
|
var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
|
|
1126
|
-
var getSizesForBreakpoints = ({
|
|
1127
|
-
small,
|
|
1128
|
-
medium
|
|
1129
|
-
}) => {
|
|
1131
|
+
var getSizesForBreakpoints = (breakpoints) => {
|
|
1130
1132
|
const newSizes = fastClone(SIZES);
|
|
1133
|
+
if (!breakpoints) {
|
|
1134
|
+
return newSizes;
|
|
1135
|
+
}
|
|
1136
|
+
const {
|
|
1137
|
+
xsmall,
|
|
1138
|
+
small,
|
|
1139
|
+
medium
|
|
1140
|
+
} = breakpoints;
|
|
1141
|
+
if (xsmall) {
|
|
1142
|
+
const xsmallMin = Math.floor(xsmall / 2);
|
|
1143
|
+
newSizes.xsmall = {
|
|
1144
|
+
max: xsmall,
|
|
1145
|
+
min: xsmallMin,
|
|
1146
|
+
default: xsmallMin + 1
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1131
1149
|
if (!small || !medium) {
|
|
1132
1150
|
return newSizes;
|
|
1133
1151
|
}
|
|
1134
|
-
const smallMin = Math.floor(small / 2);
|
|
1152
|
+
const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
|
|
1135
1153
|
newSizes.small = {
|
|
1136
1154
|
max: small,
|
|
1137
1155
|
min: smallMin,
|
|
@@ -1182,9 +1200,13 @@ function BlockStyles(props) {
|
|
|
1182
1200
|
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(
|
|
1183
1201
|
content?.meta?.breakpoints || {}
|
|
1184
1202
|
);
|
|
1203
|
+
const contentHasXSmallBreakpoint = Boolean(
|
|
1204
|
+
content?.meta?.breakpoints?.xsmall
|
|
1205
|
+
);
|
|
1185
1206
|
const largeStyles = styles?.large;
|
|
1186
1207
|
const mediumStyles = styles?.medium;
|
|
1187
1208
|
const smallStyles = styles?.small;
|
|
1209
|
+
const xsmallStyles = styles?.xsmall;
|
|
1188
1210
|
const className = processedBlock.id;
|
|
1189
1211
|
if (!className) {
|
|
1190
1212
|
return "";
|
|
@@ -1209,6 +1231,14 @@ function BlockStyles(props) {
|
|
|
1209
1231
|
sizesWithUpdatedBreakpoints
|
|
1210
1232
|
)
|
|
1211
1233
|
}) : "";
|
|
1234
|
+
const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
|
|
1235
|
+
className,
|
|
1236
|
+
styles: xsmallStyles,
|
|
1237
|
+
mediaQuery: getMaxWidthQueryForSize(
|
|
1238
|
+
"xsmall",
|
|
1239
|
+
sizesWithUpdatedBreakpoints
|
|
1240
|
+
)
|
|
1241
|
+
}) : "";
|
|
1212
1242
|
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
1213
1243
|
let hoverStylesClass = "";
|
|
1214
1244
|
if (hoverAnimation) {
|
|
@@ -1228,6 +1258,7 @@ function BlockStyles(props) {
|
|
|
1228
1258
|
largeStylesClass,
|
|
1229
1259
|
mediumStylesClass,
|
|
1230
1260
|
smallStylesClass,
|
|
1261
|
+
xsmallStylesClass,
|
|
1231
1262
|
hoverStylesClass
|
|
1232
1263
|
].join(" ");
|
|
1233
1264
|
});
|
|
@@ -2056,10 +2087,10 @@ function SectionComponent(props) {
|
|
|
2056
2087
|
var section_default = SectionComponent;
|
|
2057
2088
|
|
|
2058
2089
|
// src/blocks/symbol/symbol.tsx
|
|
2059
|
-
import { onMount as
|
|
2090
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
2060
2091
|
|
|
2061
2092
|
// src/components/content-variants/content-variants.tsx
|
|
2062
|
-
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";
|
|
2063
2094
|
|
|
2064
2095
|
// src/helpers/url.ts
|
|
2065
2096
|
var getTopLevelDomain = (host) => {
|
|
@@ -4705,8 +4736,9 @@ var componentInfo20 = {
|
|
|
4705
4736
|
};
|
|
4706
4737
|
|
|
4707
4738
|
// src/blocks/video/video.tsx
|
|
4708
|
-
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";
|
|
4709
4740
|
function Video(props) {
|
|
4741
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
4710
4742
|
const videoProps = createMemo15(() => {
|
|
4711
4743
|
return {
|
|
4712
4744
|
...props.autoPlay === true ? {
|
|
@@ -4731,6 +4763,36 @@ function Video(props) {
|
|
|
4731
4763
|
...videoProps()
|
|
4732
4764
|
};
|
|
4733
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
|
+
});
|
|
4734
4796
|
return <><div
|
|
4735
4797
|
style={{
|
|
4736
4798
|
position: "relative"
|
|
@@ -4739,7 +4801,8 @@ function Video(props) {
|
|
|
4739
4801
|
<video
|
|
4740
4802
|
class="builder-video"
|
|
4741
4803
|
{...spreadProps()}
|
|
4742
|
-
|
|
4804
|
+
ref={videoRef}
|
|
4805
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
4743
4806
|
style={{
|
|
4744
4807
|
width: "100%",
|
|
4745
4808
|
height: "100%",
|
|
@@ -4753,9 +4816,15 @@ function Video(props) {
|
|
|
4753
4816
|
position: "absolute"
|
|
4754
4817
|
} : null
|
|
4755
4818
|
}}
|
|
4756
|
-
src={props.video || "no-src"}
|
|
4757
4819
|
poster={props.posterImage}
|
|
4758
|
-
><
|
|
4820
|
+
><source
|
|
4821
|
+
type="video/mp4"
|
|
4822
|
+
{...props.lazyLoad ? {
|
|
4823
|
+
"data-src": props.video
|
|
4824
|
+
} : {
|
|
4825
|
+
src: props.video
|
|
4826
|
+
}}
|
|
4827
|
+
/></video>
|
|
4759
4828
|
<Show13
|
|
4760
4829
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4761
4830
|
><div
|
|
@@ -4925,7 +4994,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4925
4994
|
// src/components/content/components/enable-editor.tsx
|
|
4926
4995
|
import {
|
|
4927
4996
|
Show as Show14,
|
|
4928
|
-
onMount as
|
|
4997
|
+
onMount as onMount7,
|
|
4929
4998
|
on as on3,
|
|
4930
4999
|
createEffect as createEffect3,
|
|
4931
5000
|
createMemo as createMemo16,
|
|
@@ -4939,7 +5008,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4939
5008
|
}
|
|
4940
5009
|
|
|
4941
5010
|
// src/constants/sdk-version.ts
|
|
4942
|
-
var SDK_VERSION = "
|
|
5011
|
+
var SDK_VERSION = "4.0.0";
|
|
4943
5012
|
|
|
4944
5013
|
// src/helpers/sdk-headers.ts
|
|
4945
5014
|
var getSdkHeaders = () => ({
|
|
@@ -5547,7 +5616,7 @@ var registerInsertMenu = () => {
|
|
|
5547
5616
|
});
|
|
5548
5617
|
};
|
|
5549
5618
|
var isSetupForEditing = false;
|
|
5550
|
-
var setupBrowserForEditing = (options
|
|
5619
|
+
var setupBrowserForEditing = (options) => {
|
|
5551
5620
|
if (isSetupForEditing) {
|
|
5552
5621
|
return;
|
|
5553
5622
|
}
|
|
@@ -5563,6 +5632,9 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5563
5632
|
// scope our '+ add block' button styling
|
|
5564
5633
|
supportsAddBlockScoping: true,
|
|
5565
5634
|
supportsCustomBreakpoints: true,
|
|
5635
|
+
modelName: options.modelName,
|
|
5636
|
+
apiKey: options.apiKey,
|
|
5637
|
+
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5566
5638
|
blockLevelPersonalization: true
|
|
5567
5639
|
}
|
|
5568
5640
|
}, "*");
|
|
@@ -5667,13 +5739,21 @@ var createEditorListener = ({
|
|
|
5667
5739
|
}
|
|
5668
5740
|
};
|
|
5669
5741
|
};
|
|
5670
|
-
var subscribeToEditor = (
|
|
5742
|
+
var subscribeToEditor = ({
|
|
5743
|
+
model,
|
|
5744
|
+
apiKey,
|
|
5745
|
+
callback,
|
|
5746
|
+
trustedHosts
|
|
5747
|
+
}) => {
|
|
5671
5748
|
if (!isBrowser) {
|
|
5672
5749
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
5673
5750
|
return () => {
|
|
5674
5751
|
};
|
|
5675
5752
|
}
|
|
5676
|
-
setupBrowserForEditing(
|
|
5753
|
+
setupBrowserForEditing({
|
|
5754
|
+
modelName: model,
|
|
5755
|
+
apiKey
|
|
5756
|
+
});
|
|
5677
5757
|
const listener = createEditorListener({
|
|
5678
5758
|
callbacks: {
|
|
5679
5759
|
contentUpdate: callback,
|
|
@@ -5683,7 +5763,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
5683
5763
|
}
|
|
5684
5764
|
},
|
|
5685
5765
|
model,
|
|
5686
|
-
trustedHosts
|
|
5766
|
+
trustedHosts
|
|
5687
5767
|
});
|
|
5688
5768
|
window.addEventListener("message", listener);
|
|
5689
5769
|
return () => {
|
|
@@ -5924,7 +6004,7 @@ function EnableEditor(props) {
|
|
|
5924
6004
|
let elementRef;
|
|
5925
6005
|
runHttpRequests();
|
|
5926
6006
|
emitStateUpdate();
|
|
5927
|
-
|
|
6007
|
+
onMount7(() => {
|
|
5928
6008
|
if (isBrowser()) {
|
|
5929
6009
|
if (isEditing() && !props.isNestedRender) {
|
|
5930
6010
|
window.addEventListener("message", processMessage);
|
|
@@ -5938,12 +6018,14 @@ function EnableEditor(props) {
|
|
|
5938
6018
|
} : {},
|
|
5939
6019
|
...props.trustedHosts ? {
|
|
5940
6020
|
trustedHosts: props.trustedHosts
|
|
5941
|
-
} : {}
|
|
6021
|
+
} : {},
|
|
6022
|
+
modelName: props.model ?? "",
|
|
6023
|
+
apiKey: props.apiKey
|
|
5942
6024
|
});
|
|
5943
6025
|
Object.values(
|
|
5944
6026
|
props.builderContextSignal.componentInfos
|
|
5945
6027
|
).forEach((registeredComponent) => {
|
|
5946
|
-
if (!
|
|
6028
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
5947
6029
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
5948
6030
|
window.parent?.postMessage(message, "*");
|
|
5949
6031
|
}
|
|
@@ -5976,7 +6058,7 @@ function EnableEditor(props) {
|
|
|
5976
6058
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
5977
6059
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
5978
6060
|
fetchOneEntry({
|
|
5979
|
-
model: props.model
|
|
6061
|
+
model: props.model,
|
|
5980
6062
|
apiKey: props.apiKey,
|
|
5981
6063
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
5982
6064
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -6164,7 +6246,7 @@ function ContentComponent(props) {
|
|
|
6164
6246
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
6165
6247
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
6166
6248
|
nonce: props.nonce || "",
|
|
6167
|
-
model: props.model
|
|
6249
|
+
model: props.model
|
|
6168
6250
|
});
|
|
6169
6251
|
function contentSetState(newRootState) {
|
|
6170
6252
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -6269,7 +6351,7 @@ function ContentVariants(props) {
|
|
|
6269
6351
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
6270
6352
|
});
|
|
6271
6353
|
});
|
|
6272
|
-
|
|
6354
|
+
onMount8(() => {
|
|
6273
6355
|
setShouldRenderVariants(false);
|
|
6274
6356
|
});
|
|
6275
6357
|
return <><>
|
|
@@ -6399,7 +6481,7 @@ function Symbol(props) {
|
|
|
6399
6481
|
}
|
|
6400
6482
|
});
|
|
6401
6483
|
}
|
|
6402
|
-
|
|
6484
|
+
onMount9(() => {
|
|
6403
6485
|
});
|
|
6404
6486
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
6405
6487
|
function onUpdateFn_0() {
|
|
@@ -6422,7 +6504,7 @@ function Symbol(props) {
|
|
|
6422
6504
|
...contentToUse()?.data?.state
|
|
6423
6505
|
}}
|
|
6424
6506
|
canTrack={props.builderContext.canTrack}
|
|
6425
|
-
model={props.symbol?.model}
|
|
6507
|
+
model={props.symbol?.model ?? ""}
|
|
6426
6508
|
content={contentToUse()}
|
|
6427
6509
|
linkComponent={props.builderLinkComponent}
|
|
6428
6510
|
blocksWrapper={blocksWrapper()}
|