@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/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, {
|
|
@@ -4120,8 +4120,13 @@ var provideBuilderContext = (block, context) => {
|
|
|
4120
4120
|
|
|
4121
4121
|
// src/constants/device-sizes.ts
|
|
4122
4122
|
var SIZES = {
|
|
4123
|
+
xsmall: {
|
|
4124
|
+
min: 0,
|
|
4125
|
+
default: 160,
|
|
4126
|
+
max: 320
|
|
4127
|
+
},
|
|
4123
4128
|
small: {
|
|
4124
|
-
min:
|
|
4129
|
+
min: 321,
|
|
4125
4130
|
default: 321,
|
|
4126
4131
|
max: 640
|
|
4127
4132
|
},
|
|
@@ -4137,15 +4142,28 @@ var SIZES = {
|
|
|
4137
4142
|
}
|
|
4138
4143
|
};
|
|
4139
4144
|
var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
|
|
4140
|
-
var getSizesForBreakpoints = ({
|
|
4141
|
-
small,
|
|
4142
|
-
medium
|
|
4143
|
-
}) => {
|
|
4145
|
+
var getSizesForBreakpoints = (breakpoints) => {
|
|
4144
4146
|
const newSizes = fastClone(SIZES);
|
|
4147
|
+
if (!breakpoints) {
|
|
4148
|
+
return newSizes;
|
|
4149
|
+
}
|
|
4150
|
+
const {
|
|
4151
|
+
xsmall,
|
|
4152
|
+
small,
|
|
4153
|
+
medium
|
|
4154
|
+
} = breakpoints;
|
|
4155
|
+
if (xsmall) {
|
|
4156
|
+
const xsmallMin = Math.floor(xsmall / 2);
|
|
4157
|
+
newSizes.xsmall = {
|
|
4158
|
+
max: xsmall,
|
|
4159
|
+
min: xsmallMin,
|
|
4160
|
+
default: xsmallMin + 1
|
|
4161
|
+
};
|
|
4162
|
+
}
|
|
4145
4163
|
if (!small || !medium) {
|
|
4146
4164
|
return newSizes;
|
|
4147
4165
|
}
|
|
4148
|
-
const smallMin = Math.floor(small / 2);
|
|
4166
|
+
const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
|
|
4149
4167
|
newSizes.small = {
|
|
4150
4168
|
max: small,
|
|
4151
4169
|
min: smallMin,
|
|
@@ -4203,9 +4221,11 @@ function BlockStyles(props) {
|
|
|
4203
4221
|
const styles = processedBlock.responsiveStyles;
|
|
4204
4222
|
const content = props.context.content;
|
|
4205
4223
|
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
|
|
4224
|
+
const contentHasXSmallBreakpoint = Boolean(content?.meta?.breakpoints?.xsmall);
|
|
4206
4225
|
const largeStyles = styles?.large;
|
|
4207
4226
|
const mediumStyles = styles?.medium;
|
|
4208
4227
|
const smallStyles = styles?.small;
|
|
4228
|
+
const xsmallStyles = styles?.xsmall;
|
|
4209
4229
|
const className = processedBlock.id;
|
|
4210
4230
|
if (!className) {
|
|
4211
4231
|
return "";
|
|
@@ -4224,6 +4244,11 @@ function BlockStyles(props) {
|
|
|
4224
4244
|
styles: smallStyles,
|
|
4225
4245
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
4226
4246
|
}) : "";
|
|
4247
|
+
const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
|
|
4248
|
+
className,
|
|
4249
|
+
styles: xsmallStyles,
|
|
4250
|
+
mediaQuery: getMaxWidthQueryForSize("xsmall", sizesWithUpdatedBreakpoints)
|
|
4251
|
+
}) : "";
|
|
4227
4252
|
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
4228
4253
|
let hoverStylesClass = "";
|
|
4229
4254
|
if (hoverAnimation) {
|
|
@@ -4237,7 +4262,7 @@ function BlockStyles(props) {
|
|
|
4237
4262
|
}
|
|
4238
4263
|
}) || "";
|
|
4239
4264
|
}
|
|
4240
|
-
return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
|
|
4265
|
+
return [largeStylesClass, mediumStylesClass, smallStylesClass, xsmallStylesClass, hoverStylesClass].join(" ");
|
|
4241
4266
|
});
|
|
4242
4267
|
return createComponent(Show, {
|
|
4243
4268
|
get when() {
|
|
@@ -8209,10 +8234,10 @@ var componentInfo20 = {
|
|
|
8209
8234
|
builderBlock: true
|
|
8210
8235
|
}
|
|
8211
8236
|
};
|
|
8212
|
-
var _tmpl$21 = /* @__PURE__ */ template(`<
|
|
8213
|
-
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
8214
|
-
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>`);
|
|
8215
8239
|
function Video(props) {
|
|
8240
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal(void 0);
|
|
8216
8241
|
const videoProps = createMemo(() => {
|
|
8217
8242
|
return {
|
|
8218
8243
|
...props.autoPlay === true ? {
|
|
@@ -8237,12 +8262,42 @@ function Video(props) {
|
|
|
8237
8262
|
...videoProps()
|
|
8238
8263
|
};
|
|
8239
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
|
+
});
|
|
8240
8293
|
return (() => {
|
|
8241
|
-
const _el$ = _tmpl$
|
|
8294
|
+
const _el$ = _tmpl$29(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
8242
8295
|
_el$.style.setProperty("position", "relative");
|
|
8296
|
+
const _ref$ = videoRef;
|
|
8297
|
+
typeof _ref$ === "function" ? use(_ref$, _el$2) : videoRef = _el$2;
|
|
8243
8298
|
spread(_el$2, mergeProps(spreadProps, {
|
|
8244
8299
|
get preload() {
|
|
8245
|
-
return props.preload || "metadata";
|
|
8300
|
+
return props.lazyLoad ? "none" : props.preload || "metadata";
|
|
8246
8301
|
},
|
|
8247
8302
|
get style() {
|
|
8248
8303
|
return {
|
|
@@ -8259,29 +8314,21 @@ function Video(props) {
|
|
|
8259
8314
|
} : null
|
|
8260
8315
|
};
|
|
8261
8316
|
},
|
|
8262
|
-
get src() {
|
|
8263
|
-
return props.video || "no-src";
|
|
8264
|
-
},
|
|
8265
8317
|
get poster() {
|
|
8266
8318
|
return props.posterImage;
|
|
8267
8319
|
}
|
|
8268
8320
|
}), false, true);
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
const _el$3 = _tmpl$21();
|
|
8275
|
-
effect(() => setAttribute(_el$3, "src", props.video));
|
|
8276
|
-
return _el$3;
|
|
8277
|
-
}
|
|
8278
|
-
}));
|
|
8321
|
+
spread(_el$3, mergeProps(() => props.lazyLoad ? {
|
|
8322
|
+
"data-src": props.video
|
|
8323
|
+
} : {
|
|
8324
|
+
src: props.video
|
|
8325
|
+
}), false, false);
|
|
8279
8326
|
insert(_el$, createComponent(Show, {
|
|
8280
8327
|
get when() {
|
|
8281
8328
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
8282
8329
|
},
|
|
8283
8330
|
get children() {
|
|
8284
|
-
const _el$4 = _tmpl$
|
|
8331
|
+
const _el$4 = _tmpl$21();
|
|
8285
8332
|
_el$4.style.setProperty("width", "100%");
|
|
8286
8333
|
_el$4.style.setProperty("pointer-events", "none");
|
|
8287
8334
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -8294,7 +8341,7 @@ function Video(props) {
|
|
|
8294
8341
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
8295
8342
|
},
|
|
8296
8343
|
get children() {
|
|
8297
|
-
const _el$5 = _tmpl$
|
|
8344
|
+
const _el$5 = _tmpl$21();
|
|
8298
8345
|
_el$5.style.setProperty("display", "flex");
|
|
8299
8346
|
_el$5.style.setProperty("flex-direction", "column");
|
|
8300
8347
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -8307,7 +8354,7 @@ function Video(props) {
|
|
|
8307
8354
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
8308
8355
|
},
|
|
8309
8356
|
get children() {
|
|
8310
|
-
const _el$6 = _tmpl$
|
|
8357
|
+
const _el$6 = _tmpl$21();
|
|
8311
8358
|
_el$6.style.setProperty("pointer-events", "none");
|
|
8312
8359
|
_el$6.style.setProperty("display", "flex");
|
|
8313
8360
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -8464,7 +8511,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8464
8511
|
}
|
|
8465
8512
|
|
|
8466
8513
|
// src/constants/sdk-version.ts
|
|
8467
|
-
var SDK_VERSION = "
|
|
8514
|
+
var SDK_VERSION = "4.0.0";
|
|
8468
8515
|
|
|
8469
8516
|
// src/helpers/sdk-headers.ts
|
|
8470
8517
|
var getSdkHeaders = () => ({
|
|
@@ -9072,7 +9119,7 @@ var registerInsertMenu = () => {
|
|
|
9072
9119
|
});
|
|
9073
9120
|
};
|
|
9074
9121
|
var isSetupForEditing = false;
|
|
9075
|
-
var setupBrowserForEditing = (options
|
|
9122
|
+
var setupBrowserForEditing = (options) => {
|
|
9076
9123
|
if (isSetupForEditing) {
|
|
9077
9124
|
return;
|
|
9078
9125
|
}
|
|
@@ -9088,6 +9135,9 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
9088
9135
|
// scope our '+ add block' button styling
|
|
9089
9136
|
supportsAddBlockScoping: true,
|
|
9090
9137
|
supportsCustomBreakpoints: true,
|
|
9138
|
+
modelName: options.modelName,
|
|
9139
|
+
apiKey: options.apiKey,
|
|
9140
|
+
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
9091
9141
|
blockLevelPersonalization: true
|
|
9092
9142
|
}
|
|
9093
9143
|
}, "*");
|
|
@@ -9192,13 +9242,21 @@ var createEditorListener = ({
|
|
|
9192
9242
|
}
|
|
9193
9243
|
};
|
|
9194
9244
|
};
|
|
9195
|
-
var subscribeToEditor = (
|
|
9245
|
+
var subscribeToEditor = ({
|
|
9246
|
+
model,
|
|
9247
|
+
apiKey,
|
|
9248
|
+
callback,
|
|
9249
|
+
trustedHosts
|
|
9250
|
+
}) => {
|
|
9196
9251
|
if (!isBrowser) {
|
|
9197
9252
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
9198
9253
|
return () => {
|
|
9199
9254
|
};
|
|
9200
9255
|
}
|
|
9201
|
-
setupBrowserForEditing(
|
|
9256
|
+
setupBrowserForEditing({
|
|
9257
|
+
modelName: model,
|
|
9258
|
+
apiKey
|
|
9259
|
+
});
|
|
9202
9260
|
const listener = createEditorListener({
|
|
9203
9261
|
callbacks: {
|
|
9204
9262
|
contentUpdate: callback,
|
|
@@ -9208,7 +9266,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
9208
9266
|
}
|
|
9209
9267
|
},
|
|
9210
9268
|
model,
|
|
9211
|
-
trustedHosts
|
|
9269
|
+
trustedHosts
|
|
9212
9270
|
});
|
|
9213
9271
|
window.addEventListener("message", listener);
|
|
9214
9272
|
return () => {
|
|
@@ -9454,10 +9512,12 @@ function EnableEditor(props) {
|
|
|
9454
9512
|
} : {},
|
|
9455
9513
|
...props.trustedHosts ? {
|
|
9456
9514
|
trustedHosts: props.trustedHosts
|
|
9457
|
-
} : {}
|
|
9515
|
+
} : {},
|
|
9516
|
+
modelName: props.model ?? "",
|
|
9517
|
+
apiKey: props.apiKey
|
|
9458
9518
|
});
|
|
9459
9519
|
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
9460
|
-
if (!
|
|
9520
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
9461
9521
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
9462
9522
|
window.parent?.postMessage(message, "*");
|
|
9463
9523
|
}
|
|
@@ -9485,7 +9545,7 @@ function EnableEditor(props) {
|
|
|
9485
9545
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
9486
9546
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
9487
9547
|
fetchOneEntry({
|
|
9488
|
-
model: props.model
|
|
9548
|
+
model: props.model,
|
|
9489
9549
|
apiKey: props.apiKey,
|
|
9490
9550
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
9491
9551
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -9679,7 +9739,7 @@ function ContentComponent(props) {
|
|
|
9679
9739
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
9680
9740
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
9681
9741
|
nonce: props.nonce || "",
|
|
9682
|
-
model: props.model
|
|
9742
|
+
model: props.model
|
|
9683
9743
|
});
|
|
9684
9744
|
function contentSetState(newRootState) {
|
|
9685
9745
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -10120,7 +10180,7 @@ function Symbol2(props) {
|
|
|
10120
10180
|
return props.builderContext.canTrack;
|
|
10121
10181
|
},
|
|
10122
10182
|
get model() {
|
|
10123
|
-
return props.symbol?.model;
|
|
10183
|
+
return props.symbol?.model ?? "";
|
|
10124
10184
|
},
|
|
10125
10185
|
get content() {
|
|
10126
10186
|
return contentToUse();
|
package/lib/edge/dev.jsx
CHANGED
|
@@ -4118,8 +4118,13 @@ import { Show as Show2, createMemo } from "solid-js";
|
|
|
4118
4118
|
|
|
4119
4119
|
// src/constants/device-sizes.ts
|
|
4120
4120
|
var SIZES = {
|
|
4121
|
+
xsmall: {
|
|
4122
|
+
min: 0,
|
|
4123
|
+
default: 160,
|
|
4124
|
+
max: 320
|
|
4125
|
+
},
|
|
4121
4126
|
small: {
|
|
4122
|
-
min:
|
|
4127
|
+
min: 321,
|
|
4123
4128
|
default: 321,
|
|
4124
4129
|
max: 640
|
|
4125
4130
|
},
|
|
@@ -4135,15 +4140,28 @@ var SIZES = {
|
|
|
4135
4140
|
}
|
|
4136
4141
|
};
|
|
4137
4142
|
var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
|
|
4138
|
-
var getSizesForBreakpoints = ({
|
|
4139
|
-
small,
|
|
4140
|
-
medium
|
|
4141
|
-
}) => {
|
|
4143
|
+
var getSizesForBreakpoints = (breakpoints) => {
|
|
4142
4144
|
const newSizes = fastClone(SIZES);
|
|
4145
|
+
if (!breakpoints) {
|
|
4146
|
+
return newSizes;
|
|
4147
|
+
}
|
|
4148
|
+
const {
|
|
4149
|
+
xsmall,
|
|
4150
|
+
small,
|
|
4151
|
+
medium
|
|
4152
|
+
} = breakpoints;
|
|
4153
|
+
if (xsmall) {
|
|
4154
|
+
const xsmallMin = Math.floor(xsmall / 2);
|
|
4155
|
+
newSizes.xsmall = {
|
|
4156
|
+
max: xsmall,
|
|
4157
|
+
min: xsmallMin,
|
|
4158
|
+
default: xsmallMin + 1
|
|
4159
|
+
};
|
|
4160
|
+
}
|
|
4143
4161
|
if (!small || !medium) {
|
|
4144
4162
|
return newSizes;
|
|
4145
4163
|
}
|
|
4146
|
-
const smallMin = Math.floor(small / 2);
|
|
4164
|
+
const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
|
|
4147
4165
|
newSizes.small = {
|
|
4148
4166
|
max: small,
|
|
4149
4167
|
min: smallMin,
|
|
@@ -4194,9 +4212,13 @@ function BlockStyles(props) {
|
|
|
4194
4212
|
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(
|
|
4195
4213
|
content?.meta?.breakpoints || {}
|
|
4196
4214
|
);
|
|
4215
|
+
const contentHasXSmallBreakpoint = Boolean(
|
|
4216
|
+
content?.meta?.breakpoints?.xsmall
|
|
4217
|
+
);
|
|
4197
4218
|
const largeStyles = styles?.large;
|
|
4198
4219
|
const mediumStyles = styles?.medium;
|
|
4199
4220
|
const smallStyles = styles?.small;
|
|
4221
|
+
const xsmallStyles = styles?.xsmall;
|
|
4200
4222
|
const className = processedBlock.id;
|
|
4201
4223
|
if (!className) {
|
|
4202
4224
|
return "";
|
|
@@ -4221,6 +4243,14 @@ function BlockStyles(props) {
|
|
|
4221
4243
|
sizesWithUpdatedBreakpoints
|
|
4222
4244
|
)
|
|
4223
4245
|
}) : "";
|
|
4246
|
+
const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
|
|
4247
|
+
className,
|
|
4248
|
+
styles: xsmallStyles,
|
|
4249
|
+
mediaQuery: getMaxWidthQueryForSize(
|
|
4250
|
+
"xsmall",
|
|
4251
|
+
sizesWithUpdatedBreakpoints
|
|
4252
|
+
)
|
|
4253
|
+
}) : "";
|
|
4224
4254
|
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
4225
4255
|
let hoverStylesClass = "";
|
|
4226
4256
|
if (hoverAnimation) {
|
|
@@ -4240,6 +4270,7 @@ function BlockStyles(props) {
|
|
|
4240
4270
|
largeStylesClass,
|
|
4241
4271
|
mediumStylesClass,
|
|
4242
4272
|
smallStylesClass,
|
|
4273
|
+
xsmallStylesClass,
|
|
4243
4274
|
hoverStylesClass
|
|
4244
4275
|
].join(" ");
|
|
4245
4276
|
});
|
|
@@ -5068,10 +5099,10 @@ function SectionComponent(props) {
|
|
|
5068
5099
|
var section_default = SectionComponent;
|
|
5069
5100
|
|
|
5070
5101
|
// src/blocks/symbol/symbol.tsx
|
|
5071
|
-
import { onMount as
|
|
5102
|
+
import { onMount as onMount9, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
5072
5103
|
|
|
5073
5104
|
// src/components/content-variants/content-variants.tsx
|
|
5074
|
-
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";
|
|
5075
5106
|
|
|
5076
5107
|
// src/helpers/url.ts
|
|
5077
5108
|
var getTopLevelDomain = (host) => {
|
|
@@ -7717,8 +7748,9 @@ var componentInfo20 = {
|
|
|
7717
7748
|
};
|
|
7718
7749
|
|
|
7719
7750
|
// src/blocks/video/video.tsx
|
|
7720
|
-
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";
|
|
7721
7752
|
function Video(props) {
|
|
7753
|
+
const [lazyVideoObserver, setLazyVideoObserver] = createSignal15(void 0);
|
|
7722
7754
|
const videoProps = createMemo15(() => {
|
|
7723
7755
|
return {
|
|
7724
7756
|
...props.autoPlay === true ? {
|
|
@@ -7743,6 +7775,36 @@ function Video(props) {
|
|
|
7743
7775
|
...videoProps()
|
|
7744
7776
|
};
|
|
7745
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
|
+
});
|
|
7746
7808
|
return <><div
|
|
7747
7809
|
style={{
|
|
7748
7810
|
position: "relative"
|
|
@@ -7751,7 +7813,8 @@ function Video(props) {
|
|
|
7751
7813
|
<video
|
|
7752
7814
|
class="builder-video"
|
|
7753
7815
|
{...spreadProps()}
|
|
7754
|
-
|
|
7816
|
+
ref={videoRef}
|
|
7817
|
+
preload={props.lazyLoad ? "none" : props.preload || "metadata"}
|
|
7755
7818
|
style={{
|
|
7756
7819
|
width: "100%",
|
|
7757
7820
|
height: "100%",
|
|
@@ -7765,9 +7828,15 @@ function Video(props) {
|
|
|
7765
7828
|
position: "absolute"
|
|
7766
7829
|
} : null
|
|
7767
7830
|
}}
|
|
7768
|
-
src={props.video || "no-src"}
|
|
7769
7831
|
poster={props.posterImage}
|
|
7770
|
-
><
|
|
7832
|
+
><source
|
|
7833
|
+
type="video/mp4"
|
|
7834
|
+
{...props.lazyLoad ? {
|
|
7835
|
+
"data-src": props.video
|
|
7836
|
+
} : {
|
|
7837
|
+
src: props.video
|
|
7838
|
+
}}
|
|
7839
|
+
/></video>
|
|
7771
7840
|
<Show13
|
|
7772
7841
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
7773
7842
|
><div
|
|
@@ -7937,7 +8006,7 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
7937
8006
|
// src/components/content/components/enable-editor.tsx
|
|
7938
8007
|
import {
|
|
7939
8008
|
Show as Show14,
|
|
7940
|
-
onMount as
|
|
8009
|
+
onMount as onMount7,
|
|
7941
8010
|
on as on3,
|
|
7942
8011
|
createEffect as createEffect3,
|
|
7943
8012
|
createMemo as createMemo16,
|
|
@@ -7951,7 +8020,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7951
8020
|
}
|
|
7952
8021
|
|
|
7953
8022
|
// src/constants/sdk-version.ts
|
|
7954
|
-
var SDK_VERSION = "
|
|
8023
|
+
var SDK_VERSION = "4.0.0";
|
|
7955
8024
|
|
|
7956
8025
|
// src/helpers/sdk-headers.ts
|
|
7957
8026
|
var getSdkHeaders = () => ({
|
|
@@ -8559,7 +8628,7 @@ var registerInsertMenu = () => {
|
|
|
8559
8628
|
});
|
|
8560
8629
|
};
|
|
8561
8630
|
var isSetupForEditing = false;
|
|
8562
|
-
var setupBrowserForEditing = (options
|
|
8631
|
+
var setupBrowserForEditing = (options) => {
|
|
8563
8632
|
if (isSetupForEditing) {
|
|
8564
8633
|
return;
|
|
8565
8634
|
}
|
|
@@ -8575,6 +8644,9 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
8575
8644
|
// scope our '+ add block' button styling
|
|
8576
8645
|
supportsAddBlockScoping: true,
|
|
8577
8646
|
supportsCustomBreakpoints: true,
|
|
8647
|
+
modelName: options.modelName,
|
|
8648
|
+
apiKey: options.apiKey,
|
|
8649
|
+
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
8578
8650
|
blockLevelPersonalization: true
|
|
8579
8651
|
}
|
|
8580
8652
|
}, "*");
|
|
@@ -8679,13 +8751,21 @@ var createEditorListener = ({
|
|
|
8679
8751
|
}
|
|
8680
8752
|
};
|
|
8681
8753
|
};
|
|
8682
|
-
var subscribeToEditor = (
|
|
8754
|
+
var subscribeToEditor = ({
|
|
8755
|
+
model,
|
|
8756
|
+
apiKey,
|
|
8757
|
+
callback,
|
|
8758
|
+
trustedHosts
|
|
8759
|
+
}) => {
|
|
8683
8760
|
if (!isBrowser) {
|
|
8684
8761
|
logger.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server.");
|
|
8685
8762
|
return () => {
|
|
8686
8763
|
};
|
|
8687
8764
|
}
|
|
8688
|
-
setupBrowserForEditing(
|
|
8765
|
+
setupBrowserForEditing({
|
|
8766
|
+
modelName: model,
|
|
8767
|
+
apiKey
|
|
8768
|
+
});
|
|
8689
8769
|
const listener = createEditorListener({
|
|
8690
8770
|
callbacks: {
|
|
8691
8771
|
contentUpdate: callback,
|
|
@@ -8695,7 +8775,7 @@ var subscribeToEditor = (model, callback, options) => {
|
|
|
8695
8775
|
}
|
|
8696
8776
|
},
|
|
8697
8777
|
model,
|
|
8698
|
-
trustedHosts
|
|
8778
|
+
trustedHosts
|
|
8699
8779
|
});
|
|
8700
8780
|
window.addEventListener("message", listener);
|
|
8701
8781
|
return () => {
|
|
@@ -8936,7 +9016,7 @@ function EnableEditor(props) {
|
|
|
8936
9016
|
let elementRef;
|
|
8937
9017
|
runHttpRequests();
|
|
8938
9018
|
emitStateUpdate();
|
|
8939
|
-
|
|
9019
|
+
onMount7(() => {
|
|
8940
9020
|
if (isBrowser()) {
|
|
8941
9021
|
if (isEditing() && !props.isNestedRender) {
|
|
8942
9022
|
window.addEventListener("message", processMessage);
|
|
@@ -8950,12 +9030,14 @@ function EnableEditor(props) {
|
|
|
8950
9030
|
} : {},
|
|
8951
9031
|
...props.trustedHosts ? {
|
|
8952
9032
|
trustedHosts: props.trustedHosts
|
|
8953
|
-
} : {}
|
|
9033
|
+
} : {},
|
|
9034
|
+
modelName: props.model ?? "",
|
|
9035
|
+
apiKey: props.apiKey
|
|
8954
9036
|
});
|
|
8955
9037
|
Object.values(
|
|
8956
9038
|
props.builderContextSignal.componentInfos
|
|
8957
9039
|
).forEach((registeredComponent) => {
|
|
8958
|
-
if (!
|
|
9040
|
+
if (!registeredComponent.models?.length || registeredComponent.models.includes(props.model)) {
|
|
8959
9041
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
8960
9042
|
window.parent?.postMessage(message, "*");
|
|
8961
9043
|
}
|
|
@@ -8988,7 +9070,7 @@ function EnableEditor(props) {
|
|
|
8988
9070
|
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
8989
9071
|
if (searchParamPreviewModel === "BUILDER_STUDIO" || searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id)) {
|
|
8990
9072
|
fetchOneEntry({
|
|
8991
|
-
model: props.model
|
|
9073
|
+
model: props.model,
|
|
8992
9074
|
apiKey: props.apiKey,
|
|
8993
9075
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
8994
9076
|
...searchParamPreviewModel === "BUILDER_STUDIO" && props.context?.symbolId ? {
|
|
@@ -9176,7 +9258,7 @@ function ContentComponent(props) {
|
|
|
9176
9258
|
BlocksWrapper: props.blocksWrapper || "div",
|
|
9177
9259
|
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
9178
9260
|
nonce: props.nonce || "",
|
|
9179
|
-
model: props.model
|
|
9261
|
+
model: props.model
|
|
9180
9262
|
});
|
|
9181
9263
|
function contentSetState(newRootState) {
|
|
9182
9264
|
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
@@ -9281,7 +9363,7 @@ function ContentVariants(props) {
|
|
|
9281
9363
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
9282
9364
|
});
|
|
9283
9365
|
});
|
|
9284
|
-
|
|
9366
|
+
onMount8(() => {
|
|
9285
9367
|
setShouldRenderVariants(false);
|
|
9286
9368
|
});
|
|
9287
9369
|
return <><>
|
|
@@ -9411,7 +9493,7 @@ function Symbol2(props) {
|
|
|
9411
9493
|
}
|
|
9412
9494
|
});
|
|
9413
9495
|
}
|
|
9414
|
-
|
|
9496
|
+
onMount9(() => {
|
|
9415
9497
|
});
|
|
9416
9498
|
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
9417
9499
|
function onUpdateFn_0() {
|
|
@@ -9434,7 +9516,7 @@ function Symbol2(props) {
|
|
|
9434
9516
|
...contentToUse()?.data?.state
|
|
9435
9517
|
}}
|
|
9436
9518
|
canTrack={props.builderContext.canTrack}
|
|
9437
|
-
model={props.symbol?.model}
|
|
9519
|
+
model={props.symbol?.model ?? ""}
|
|
9438
9520
|
content={contentToUse()}
|
|
9439
9521
|
linkComponent={props.builderLinkComponent}
|
|
9440
9522
|
blocksWrapper={blocksWrapper()}
|