@builder.io/sdk-solid 1.0.20 → 1.0.22
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 +4 -4
- package/lib/browser/dev.js +23 -41
- package/lib/browser/dev.jsx +30 -41
- package/lib/browser/index.js +23 -41
- package/lib/browser/index.jsx +30 -41
- package/lib/edge/dev.js +23 -41
- package/lib/edge/dev.jsx +30 -41
- package/lib/edge/index.js +23 -41
- package/lib/edge/index.jsx +30 -41
- package/lib/node/dev.js +45 -43
- package/lib/node/dev.jsx +52 -43
- package/lib/node/index.js +46 -43
- package/lib/node/index.jsx +53 -43
- package/package.json +1 -1
package/lib/node/dev.jsx
CHANGED
|
@@ -152,7 +152,8 @@ function isIframe() {
|
|
|
152
152
|
|
|
153
153
|
// src/functions/is-editing.ts
|
|
154
154
|
function isEditing(search) {
|
|
155
|
-
return isIframe() && (TARGET === "reactNative" ||
|
|
155
|
+
return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
156
|
+
getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
// src/functions/track/helpers.ts
|
|
@@ -370,8 +371,28 @@ if (typeof output === 'object' && output !== null) {
|
|
|
370
371
|
output;
|
|
371
372
|
`;
|
|
372
373
|
};
|
|
374
|
+
var IVM_INSTANCE = null;
|
|
375
|
+
var getIvm = () => {
|
|
376
|
+
try {
|
|
377
|
+
if (IVM_INSTANCE)
|
|
378
|
+
return IVM_INSTANCE;
|
|
379
|
+
const dynRequiredIvm = safeDynamicRequire("isolated-vm");
|
|
380
|
+
if (dynRequiredIvm)
|
|
381
|
+
return dynRequiredIvm;
|
|
382
|
+
} catch (error2) {
|
|
383
|
+
logger.error("isolated-vm import error.", error2);
|
|
384
|
+
}
|
|
385
|
+
throw new Error(`${MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on Node server.
|
|
386
|
+
|
|
387
|
+
In certain Node environments, the SDK requires additional initialization steps. This can be achieved by
|
|
388
|
+
importing and calling \`initializeNodeRuntime()\` from "@builder.io/sdk-react/node/init". This must be done in
|
|
389
|
+
a server-only execution path within your application.
|
|
390
|
+
|
|
391
|
+
Please see the documentation for more information: https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments
|
|
392
|
+
`);
|
|
393
|
+
};
|
|
373
394
|
var getIsolateContext = () => {
|
|
374
|
-
const ivm =
|
|
395
|
+
const ivm = getIvm();
|
|
375
396
|
const isolate = new ivm.Isolate({
|
|
376
397
|
memoryLimit: 128
|
|
377
398
|
});
|
|
@@ -386,7 +407,7 @@ var runInNode = ({
|
|
|
386
407
|
rootSetState,
|
|
387
408
|
rootState
|
|
388
409
|
}) => {
|
|
389
|
-
const ivm =
|
|
410
|
+
const ivm = getIvm();
|
|
390
411
|
const state = fastClone({
|
|
391
412
|
...rootState,
|
|
392
413
|
...localState
|
|
@@ -650,9 +671,6 @@ function bindAnimations(animations) {
|
|
|
650
671
|
case "pageLoad":
|
|
651
672
|
triggerAnimation(animation);
|
|
652
673
|
break;
|
|
653
|
-
case "hover":
|
|
654
|
-
bindHoverAnimation(animation);
|
|
655
|
-
break;
|
|
656
674
|
case "scrollInView":
|
|
657
675
|
bindScrollInViewAnimation(animation);
|
|
658
676
|
break;
|
|
@@ -711,33 +729,6 @@ function triggerAnimation(animation) {
|
|
|
711
729
|
});
|
|
712
730
|
});
|
|
713
731
|
}
|
|
714
|
-
function bindHoverAnimation(animation) {
|
|
715
|
-
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
716
|
-
if (!elements.length) {
|
|
717
|
-
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
Array.from(elements).forEach((element) => {
|
|
721
|
-
augmentAnimation(animation, element);
|
|
722
|
-
const defaultState = animation.steps[0].styles;
|
|
723
|
-
const hoverState = animation.steps[1].styles;
|
|
724
|
-
function attachDefaultState() {
|
|
725
|
-
assign(element.style, defaultState);
|
|
726
|
-
}
|
|
727
|
-
function attachHoverState() {
|
|
728
|
-
assign(element.style, hoverState);
|
|
729
|
-
}
|
|
730
|
-
attachDefaultState();
|
|
731
|
-
element.addEventListener("mouseenter", attachHoverState);
|
|
732
|
-
element.addEventListener("mouseleave", attachDefaultState);
|
|
733
|
-
setTimeout(() => {
|
|
734
|
-
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
735
|
-
if (animation.delay) {
|
|
736
|
-
element.style.transitionDelay = animation.delay + "s";
|
|
737
|
-
}
|
|
738
|
-
});
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
732
|
function bindScrollInViewAnimation(animation) {
|
|
742
733
|
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
743
734
|
if (!elements.length) {
|
|
@@ -1048,7 +1039,27 @@ function BlockStyles(props) {
|
|
|
1048
1039
|
sizesWithUpdatedBreakpoints
|
|
1049
1040
|
)
|
|
1050
1041
|
}) : "";
|
|
1051
|
-
|
|
1042
|
+
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
1043
|
+
let hoverStylesClass = "";
|
|
1044
|
+
if (hoverAnimation) {
|
|
1045
|
+
const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
|
|
1046
|
+
hoverStylesClass = createCssClass({
|
|
1047
|
+
className: `${className}:hover`,
|
|
1048
|
+
styles: {
|
|
1049
|
+
...hoverStyles,
|
|
1050
|
+
transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(
|
|
1051
|
+
hoverAnimation.easing
|
|
1052
|
+
)}`,
|
|
1053
|
+
transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
|
|
1054
|
+
}
|
|
1055
|
+
}) || "";
|
|
1056
|
+
}
|
|
1057
|
+
return [
|
|
1058
|
+
largeStylesClass,
|
|
1059
|
+
mediumStylesClass,
|
|
1060
|
+
smallStylesClass,
|
|
1061
|
+
hoverStylesClass
|
|
1062
|
+
].join(" ");
|
|
1052
1063
|
});
|
|
1053
1064
|
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
|
|
1054
1065
|
}
|
|
@@ -1327,7 +1338,7 @@ function Block(props) {
|
|
|
1327
1338
|
const animations = processedBlock().animations;
|
|
1328
1339
|
if (animations && blockId) {
|
|
1329
1340
|
bindAnimations(
|
|
1330
|
-
animations.
|
|
1341
|
+
animations.map((animation) => ({
|
|
1331
1342
|
...animation,
|
|
1332
1343
|
elementId: blockId
|
|
1333
1344
|
}))
|
|
@@ -3902,14 +3913,12 @@ async function fetchEntries(options) {
|
|
|
3902
3913
|
}
|
|
3903
3914
|
|
|
3904
3915
|
// src/functions/is-previewing.ts
|
|
3905
|
-
function isPreviewing(
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
}
|
|
3909
|
-
const normalizedSearch = getSearchString(search || window.location.search);
|
|
3910
|
-
if (isEditing(normalizedSearch)) {
|
|
3916
|
+
function isPreviewing(_search) {
|
|
3917
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
3918
|
+
if (!search) {
|
|
3911
3919
|
return false;
|
|
3912
3920
|
}
|
|
3921
|
+
const normalizedSearch = getSearchString(search);
|
|
3913
3922
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3914
3923
|
}
|
|
3915
3924
|
|
|
@@ -4160,7 +4169,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4160
4169
|
}
|
|
4161
4170
|
|
|
4162
4171
|
// src/constants/sdk-version.ts
|
|
4163
|
-
var SDK_VERSION = "1.0.
|
|
4172
|
+
var SDK_VERSION = "1.0.22";
|
|
4164
4173
|
|
|
4165
4174
|
// src/functions/register.ts
|
|
4166
4175
|
var registry = {};
|
|
@@ -4552,7 +4561,7 @@ function EnableEditor(props) {
|
|
|
4552
4561
|
variationId: variationId !== contentId ? variationId : void 0
|
|
4553
4562
|
});
|
|
4554
4563
|
}
|
|
4555
|
-
if (isPreviewing()) {
|
|
4564
|
+
if (isPreviewing() && !isEditing()) {
|
|
4556
4565
|
const searchParams = new URL(location.href).searchParams;
|
|
4557
4566
|
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
4558
4567
|
const searchParamPreviewId = searchParams.get(
|
package/lib/node/index.js
CHANGED
|
@@ -128,6 +128,7 @@ function getBlockComponentOptions(block) {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// src/helpers/logger.ts
|
|
131
|
+
var MSG_PREFIX = "[Builder.io]: ";
|
|
131
132
|
var logger = {
|
|
132
133
|
log: (...message) => void 0,
|
|
133
134
|
error: (...message) => void 0,
|
|
@@ -165,7 +166,8 @@ function isIframe() {
|
|
|
165
166
|
|
|
166
167
|
// src/functions/is-editing.ts
|
|
167
168
|
function isEditing(search) {
|
|
168
|
-
return isIframe() && (TARGET === "reactNative" ||
|
|
169
|
+
return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
170
|
+
getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
// src/functions/track/helpers.ts
|
|
@@ -379,8 +381,28 @@ if (typeof output === 'object' && output !== null) {
|
|
|
379
381
|
output;
|
|
380
382
|
`;
|
|
381
383
|
};
|
|
384
|
+
var IVM_INSTANCE = null;
|
|
385
|
+
var getIvm = () => {
|
|
386
|
+
try {
|
|
387
|
+
if (IVM_INSTANCE)
|
|
388
|
+
return IVM_INSTANCE;
|
|
389
|
+
const dynRequiredIvm = safeDynamicRequire("isolated-vm");
|
|
390
|
+
if (dynRequiredIvm)
|
|
391
|
+
return dynRequiredIvm;
|
|
392
|
+
} catch (error2) {
|
|
393
|
+
logger.error("isolated-vm import error.", error2);
|
|
394
|
+
}
|
|
395
|
+
throw new Error(`${MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on Node server.
|
|
396
|
+
|
|
397
|
+
In certain Node environments, the SDK requires additional initialization steps. This can be achieved by
|
|
398
|
+
importing and calling \`initializeNodeRuntime()\` from "@builder.io/sdk-react/node/init". This must be done in
|
|
399
|
+
a server-only execution path within your application.
|
|
400
|
+
|
|
401
|
+
Please see the documentation for more information: https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments
|
|
402
|
+
`);
|
|
403
|
+
};
|
|
382
404
|
var getIsolateContext = () => {
|
|
383
|
-
const ivm =
|
|
405
|
+
const ivm = getIvm();
|
|
384
406
|
const isolate = new ivm.Isolate({
|
|
385
407
|
memoryLimit: 128
|
|
386
408
|
});
|
|
@@ -395,7 +417,7 @@ var runInNode = ({
|
|
|
395
417
|
rootSetState,
|
|
396
418
|
rootState
|
|
397
419
|
}) => {
|
|
398
|
-
const ivm =
|
|
420
|
+
const ivm = getIvm();
|
|
399
421
|
const state = fastClone({
|
|
400
422
|
...rootState,
|
|
401
423
|
...localState
|
|
@@ -658,9 +680,6 @@ function bindAnimations(animations) {
|
|
|
658
680
|
case "pageLoad":
|
|
659
681
|
triggerAnimation(animation);
|
|
660
682
|
break;
|
|
661
|
-
case "hover":
|
|
662
|
-
bindHoverAnimation(animation);
|
|
663
|
-
break;
|
|
664
683
|
case "scrollInView":
|
|
665
684
|
bindScrollInViewAnimation(animation);
|
|
666
685
|
break;
|
|
@@ -718,33 +737,6 @@ function triggerAnimation(animation) {
|
|
|
718
737
|
});
|
|
719
738
|
});
|
|
720
739
|
}
|
|
721
|
-
function bindHoverAnimation(animation) {
|
|
722
|
-
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
723
|
-
if (!elements.length) {
|
|
724
|
-
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
Array.from(elements).forEach((element) => {
|
|
728
|
-
augmentAnimation(animation, element);
|
|
729
|
-
const defaultState = animation.steps[0].styles;
|
|
730
|
-
const hoverState = animation.steps[1].styles;
|
|
731
|
-
function attachDefaultState() {
|
|
732
|
-
assign(element.style, defaultState);
|
|
733
|
-
}
|
|
734
|
-
function attachHoverState() {
|
|
735
|
-
assign(element.style, hoverState);
|
|
736
|
-
}
|
|
737
|
-
attachDefaultState();
|
|
738
|
-
element.addEventListener("mouseenter", attachHoverState);
|
|
739
|
-
element.addEventListener("mouseleave", attachDefaultState);
|
|
740
|
-
setTimeout(() => {
|
|
741
|
-
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
742
|
-
if (animation.delay) {
|
|
743
|
-
element.style.transitionDelay = animation.delay + "s";
|
|
744
|
-
}
|
|
745
|
-
});
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
740
|
function bindScrollInViewAnimation(animation) {
|
|
749
741
|
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
750
742
|
if (!elements.length) {
|
|
@@ -1052,7 +1044,20 @@ function BlockStyles(props) {
|
|
|
1052
1044
|
styles: smallStyles,
|
|
1053
1045
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
1054
1046
|
}) : "";
|
|
1055
|
-
|
|
1047
|
+
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
1048
|
+
let hoverStylesClass = "";
|
|
1049
|
+
if (hoverAnimation) {
|
|
1050
|
+
const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
|
|
1051
|
+
hoverStylesClass = createCssClass({
|
|
1052
|
+
className: `${className}:hover`,
|
|
1053
|
+
styles: {
|
|
1054
|
+
...hoverStyles,
|
|
1055
|
+
transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
|
|
1056
|
+
transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
|
|
1057
|
+
}
|
|
1058
|
+
}) || "";
|
|
1059
|
+
}
|
|
1060
|
+
return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
|
|
1056
1061
|
});
|
|
1057
1062
|
return createComponent(Show, {
|
|
1058
1063
|
get when() {
|
|
@@ -1384,7 +1389,7 @@ function Block(props) {
|
|
|
1384
1389
|
const blockId = processedBlock().id;
|
|
1385
1390
|
const animations = processedBlock().animations;
|
|
1386
1391
|
if (animations && blockId) {
|
|
1387
|
-
bindAnimations(animations.
|
|
1392
|
+
bindAnimations(animations.map((animation) => ({
|
|
1388
1393
|
...animation,
|
|
1389
1394
|
elementId: blockId
|
|
1390
1395
|
})));
|
|
@@ -4304,14 +4309,12 @@ async function fetchEntries(options) {
|
|
|
4304
4309
|
}
|
|
4305
4310
|
|
|
4306
4311
|
// src/functions/is-previewing.ts
|
|
4307
|
-
function isPreviewing(
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
}
|
|
4311
|
-
const normalizedSearch = getSearchString(search || window.location.search);
|
|
4312
|
-
if (isEditing(normalizedSearch)) {
|
|
4312
|
+
function isPreviewing(_search) {
|
|
4313
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
4314
|
+
if (!search) {
|
|
4313
4315
|
return false;
|
|
4314
4316
|
}
|
|
4317
|
+
const normalizedSearch = getSearchString(search);
|
|
4315
4318
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4316
4319
|
}
|
|
4317
4320
|
|
|
@@ -4559,7 +4562,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4559
4562
|
}
|
|
4560
4563
|
|
|
4561
4564
|
// src/constants/sdk-version.ts
|
|
4562
|
-
var SDK_VERSION = "1.0.
|
|
4565
|
+
var SDK_VERSION = "1.0.22";
|
|
4563
4566
|
|
|
4564
4567
|
// src/functions/register.ts
|
|
4565
4568
|
var registry = {};
|
|
@@ -4935,7 +4938,7 @@ function EnableEditor(props) {
|
|
|
4935
4938
|
variationId: variationId !== contentId ? variationId : void 0
|
|
4936
4939
|
});
|
|
4937
4940
|
}
|
|
4938
|
-
if (isPreviewing()) {
|
|
4941
|
+
if (isPreviewing() && !isEditing()) {
|
|
4939
4942
|
const searchParams = new URL(location.href).searchParams;
|
|
4940
4943
|
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
4941
4944
|
const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
|
package/lib/node/index.jsx
CHANGED
|
@@ -114,6 +114,7 @@ function getBlockComponentOptions(block) {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// src/helpers/logger.ts
|
|
117
|
+
var MSG_PREFIX = "[Builder.io]: ";
|
|
117
118
|
var logger = {
|
|
118
119
|
log: (...message) => void 0,
|
|
119
120
|
error: (...message) => void 0,
|
|
@@ -151,7 +152,8 @@ function isIframe() {
|
|
|
151
152
|
|
|
152
153
|
// src/functions/is-editing.ts
|
|
153
154
|
function isEditing(search) {
|
|
154
|
-
return isIframe() && (TARGET === "reactNative" ||
|
|
155
|
+
return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
156
|
+
getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
// src/functions/track/helpers.ts
|
|
@@ -368,8 +370,28 @@ if (typeof output === 'object' && output !== null) {
|
|
|
368
370
|
output;
|
|
369
371
|
`;
|
|
370
372
|
};
|
|
373
|
+
var IVM_INSTANCE = null;
|
|
374
|
+
var getIvm = () => {
|
|
375
|
+
try {
|
|
376
|
+
if (IVM_INSTANCE)
|
|
377
|
+
return IVM_INSTANCE;
|
|
378
|
+
const dynRequiredIvm = safeDynamicRequire("isolated-vm");
|
|
379
|
+
if (dynRequiredIvm)
|
|
380
|
+
return dynRequiredIvm;
|
|
381
|
+
} catch (error2) {
|
|
382
|
+
logger.error("isolated-vm import error.", error2);
|
|
383
|
+
}
|
|
384
|
+
throw new Error(`${MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on Node server.
|
|
385
|
+
|
|
386
|
+
In certain Node environments, the SDK requires additional initialization steps. This can be achieved by
|
|
387
|
+
importing and calling \`initializeNodeRuntime()\` from "@builder.io/sdk-react/node/init". This must be done in
|
|
388
|
+
a server-only execution path within your application.
|
|
389
|
+
|
|
390
|
+
Please see the documentation for more information: https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments
|
|
391
|
+
`);
|
|
392
|
+
};
|
|
371
393
|
var getIsolateContext = () => {
|
|
372
|
-
const ivm =
|
|
394
|
+
const ivm = getIvm();
|
|
373
395
|
const isolate = new ivm.Isolate({
|
|
374
396
|
memoryLimit: 128
|
|
375
397
|
});
|
|
@@ -384,7 +406,7 @@ var runInNode = ({
|
|
|
384
406
|
rootSetState,
|
|
385
407
|
rootState
|
|
386
408
|
}) => {
|
|
387
|
-
const ivm =
|
|
409
|
+
const ivm = getIvm();
|
|
388
410
|
const state = fastClone({
|
|
389
411
|
...rootState,
|
|
390
412
|
...localState
|
|
@@ -647,9 +669,6 @@ function bindAnimations(animations) {
|
|
|
647
669
|
case "pageLoad":
|
|
648
670
|
triggerAnimation(animation);
|
|
649
671
|
break;
|
|
650
|
-
case "hover":
|
|
651
|
-
bindHoverAnimation(animation);
|
|
652
|
-
break;
|
|
653
672
|
case "scrollInView":
|
|
654
673
|
bindScrollInViewAnimation(animation);
|
|
655
674
|
break;
|
|
@@ -707,33 +726,6 @@ function triggerAnimation(animation) {
|
|
|
707
726
|
});
|
|
708
727
|
});
|
|
709
728
|
}
|
|
710
|
-
function bindHoverAnimation(animation) {
|
|
711
|
-
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
712
|
-
if (!elements.length) {
|
|
713
|
-
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
714
|
-
return;
|
|
715
|
-
}
|
|
716
|
-
Array.from(elements).forEach((element) => {
|
|
717
|
-
augmentAnimation(animation, element);
|
|
718
|
-
const defaultState = animation.steps[0].styles;
|
|
719
|
-
const hoverState = animation.steps[1].styles;
|
|
720
|
-
function attachDefaultState() {
|
|
721
|
-
assign(element.style, defaultState);
|
|
722
|
-
}
|
|
723
|
-
function attachHoverState() {
|
|
724
|
-
assign(element.style, hoverState);
|
|
725
|
-
}
|
|
726
|
-
attachDefaultState();
|
|
727
|
-
element.addEventListener("mouseenter", attachHoverState);
|
|
728
|
-
element.addEventListener("mouseleave", attachDefaultState);
|
|
729
|
-
setTimeout(() => {
|
|
730
|
-
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
731
|
-
if (animation.delay) {
|
|
732
|
-
element.style.transitionDelay = animation.delay + "s";
|
|
733
|
-
}
|
|
734
|
-
});
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
729
|
function bindScrollInViewAnimation(animation) {
|
|
738
730
|
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
739
731
|
if (!elements.length) {
|
|
@@ -1041,7 +1033,27 @@ function BlockStyles(props) {
|
|
|
1041
1033
|
sizesWithUpdatedBreakpoints
|
|
1042
1034
|
)
|
|
1043
1035
|
}) : "";
|
|
1044
|
-
|
|
1036
|
+
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
1037
|
+
let hoverStylesClass = "";
|
|
1038
|
+
if (hoverAnimation) {
|
|
1039
|
+
const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
|
|
1040
|
+
hoverStylesClass = createCssClass({
|
|
1041
|
+
className: `${className}:hover`,
|
|
1042
|
+
styles: {
|
|
1043
|
+
...hoverStyles,
|
|
1044
|
+
transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(
|
|
1045
|
+
hoverAnimation.easing
|
|
1046
|
+
)}`,
|
|
1047
|
+
transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
|
|
1048
|
+
}
|
|
1049
|
+
}) || "";
|
|
1050
|
+
}
|
|
1051
|
+
return [
|
|
1052
|
+
largeStylesClass,
|
|
1053
|
+
mediumStylesClass,
|
|
1054
|
+
smallStylesClass,
|
|
1055
|
+
hoverStylesClass
|
|
1056
|
+
].join(" ");
|
|
1045
1057
|
});
|
|
1046
1058
|
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
|
|
1047
1059
|
}
|
|
@@ -1320,7 +1332,7 @@ function Block(props) {
|
|
|
1320
1332
|
const animations = processedBlock().animations;
|
|
1321
1333
|
if (animations && blockId) {
|
|
1322
1334
|
bindAnimations(
|
|
1323
|
-
animations.
|
|
1335
|
+
animations.map((animation) => ({
|
|
1324
1336
|
...animation,
|
|
1325
1337
|
elementId: blockId
|
|
1326
1338
|
}))
|
|
@@ -3889,14 +3901,12 @@ async function fetchEntries(options) {
|
|
|
3889
3901
|
}
|
|
3890
3902
|
|
|
3891
3903
|
// src/functions/is-previewing.ts
|
|
3892
|
-
function isPreviewing(
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
}
|
|
3896
|
-
const normalizedSearch = getSearchString(search || window.location.search);
|
|
3897
|
-
if (isEditing(normalizedSearch)) {
|
|
3904
|
+
function isPreviewing(_search) {
|
|
3905
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
3906
|
+
if (!search) {
|
|
3898
3907
|
return false;
|
|
3899
3908
|
}
|
|
3909
|
+
const normalizedSearch = getSearchString(search);
|
|
3900
3910
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3901
3911
|
}
|
|
3902
3912
|
|
|
@@ -4144,7 +4154,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4144
4154
|
}
|
|
4145
4155
|
|
|
4146
4156
|
// src/constants/sdk-version.ts
|
|
4147
|
-
var SDK_VERSION = "1.0.
|
|
4157
|
+
var SDK_VERSION = "1.0.22";
|
|
4148
4158
|
|
|
4149
4159
|
// src/functions/register.ts
|
|
4150
4160
|
var registry = {};
|
|
@@ -4534,7 +4544,7 @@ function EnableEditor(props) {
|
|
|
4534
4544
|
variationId: variationId !== contentId ? variationId : void 0
|
|
4535
4545
|
});
|
|
4536
4546
|
}
|
|
4537
|
-
if (isPreviewing()) {
|
|
4547
|
+
if (isPreviewing() && !isEditing()) {
|
|
4538
4548
|
const searchParams = new URL(location.href).searchParams;
|
|
4539
4549
|
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
4540
4550
|
const searchParamPreviewId = searchParams.get(
|