@builder.io/sdk-solid 1.0.21 → 1.0.23
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 +1 -1
- package/lib/browser/dev.js +23 -42
- package/lib/browser/dev.jsx +30 -42
- package/lib/browser/index.js +23 -42
- package/lib/browser/index.jsx +30 -42
- package/lib/edge/dev.js +23 -42
- package/lib/edge/dev.jsx +30 -42
- package/lib/edge/index.js +23 -42
- package/lib/edge/index.jsx +30 -42
- package/lib/node/dev.js +23 -42
- package/lib/node/dev.jsx +30 -42
- package/lib/node/index.js +23 -42
- package/lib/node/index.jsx +30 -42
- package/package.json +1 -1
package/lib/node/index.js
CHANGED
|
@@ -166,7 +166,8 @@ function isIframe() {
|
|
|
166
166
|
|
|
167
167
|
// src/functions/is-editing.ts
|
|
168
168
|
function isEditing(search) {
|
|
169
|
-
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);
|
|
170
171
|
}
|
|
171
172
|
|
|
172
173
|
// src/functions/track/helpers.ts
|
|
@@ -524,7 +525,6 @@ function evaluate({
|
|
|
524
525
|
enableCache
|
|
525
526
|
}) {
|
|
526
527
|
if (code === "") {
|
|
527
|
-
logger.warn("Skipping evaluation of empty code block.");
|
|
528
528
|
return void 0;
|
|
529
529
|
}
|
|
530
530
|
const args = {
|
|
@@ -679,9 +679,6 @@ function bindAnimations(animations) {
|
|
|
679
679
|
case "pageLoad":
|
|
680
680
|
triggerAnimation(animation);
|
|
681
681
|
break;
|
|
682
|
-
case "hover":
|
|
683
|
-
bindHoverAnimation(animation);
|
|
684
|
-
break;
|
|
685
682
|
case "scrollInView":
|
|
686
683
|
bindScrollInViewAnimation(animation);
|
|
687
684
|
break;
|
|
@@ -739,33 +736,6 @@ function triggerAnimation(animation) {
|
|
|
739
736
|
});
|
|
740
737
|
});
|
|
741
738
|
}
|
|
742
|
-
function bindHoverAnimation(animation) {
|
|
743
|
-
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
744
|
-
if (!elements.length) {
|
|
745
|
-
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
Array.from(elements).forEach((element) => {
|
|
749
|
-
augmentAnimation(animation, element);
|
|
750
|
-
const defaultState = animation.steps[0].styles;
|
|
751
|
-
const hoverState = animation.steps[1].styles;
|
|
752
|
-
function attachDefaultState() {
|
|
753
|
-
assign(element.style, defaultState);
|
|
754
|
-
}
|
|
755
|
-
function attachHoverState() {
|
|
756
|
-
assign(element.style, hoverState);
|
|
757
|
-
}
|
|
758
|
-
attachDefaultState();
|
|
759
|
-
element.addEventListener("mouseenter", attachHoverState);
|
|
760
|
-
element.addEventListener("mouseleave", attachDefaultState);
|
|
761
|
-
setTimeout(() => {
|
|
762
|
-
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
763
|
-
if (animation.delay) {
|
|
764
|
-
element.style.transitionDelay = animation.delay + "s";
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
739
|
function bindScrollInViewAnimation(animation) {
|
|
770
740
|
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
771
741
|
if (!elements.length) {
|
|
@@ -1073,7 +1043,20 @@ function BlockStyles(props) {
|
|
|
1073
1043
|
styles: smallStyles,
|
|
1074
1044
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
1075
1045
|
}) : "";
|
|
1076
|
-
|
|
1046
|
+
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
1047
|
+
let hoverStylesClass = "";
|
|
1048
|
+
if (hoverAnimation) {
|
|
1049
|
+
const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
|
|
1050
|
+
hoverStylesClass = createCssClass({
|
|
1051
|
+
className: `${className}:hover`,
|
|
1052
|
+
styles: {
|
|
1053
|
+
...hoverStyles,
|
|
1054
|
+
transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
|
|
1055
|
+
transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
|
|
1056
|
+
}
|
|
1057
|
+
}) || "";
|
|
1058
|
+
}
|
|
1059
|
+
return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
|
|
1077
1060
|
});
|
|
1078
1061
|
return createComponent(Show, {
|
|
1079
1062
|
get when() {
|
|
@@ -1405,7 +1388,7 @@ function Block(props) {
|
|
|
1405
1388
|
const blockId = processedBlock().id;
|
|
1406
1389
|
const animations = processedBlock().animations;
|
|
1407
1390
|
if (animations && blockId) {
|
|
1408
|
-
bindAnimations(animations.
|
|
1391
|
+
bindAnimations(animations.map((animation) => ({
|
|
1409
1392
|
...animation,
|
|
1410
1393
|
elementId: blockId
|
|
1411
1394
|
})));
|
|
@@ -4325,14 +4308,12 @@ async function fetchEntries(options) {
|
|
|
4325
4308
|
}
|
|
4326
4309
|
|
|
4327
4310
|
// src/functions/is-previewing.ts
|
|
4328
|
-
function isPreviewing(
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
}
|
|
4332
|
-
const normalizedSearch = getSearchString(search || window.location.search);
|
|
4333
|
-
if (isEditing(normalizedSearch)) {
|
|
4311
|
+
function isPreviewing(_search) {
|
|
4312
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
4313
|
+
if (!search) {
|
|
4334
4314
|
return false;
|
|
4335
4315
|
}
|
|
4316
|
+
const normalizedSearch = getSearchString(search);
|
|
4336
4317
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4337
4318
|
}
|
|
4338
4319
|
|
|
@@ -4580,7 +4561,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4580
4561
|
}
|
|
4581
4562
|
|
|
4582
4563
|
// src/constants/sdk-version.ts
|
|
4583
|
-
var SDK_VERSION = "1.0.
|
|
4564
|
+
var SDK_VERSION = "1.0.23";
|
|
4584
4565
|
|
|
4585
4566
|
// src/functions/register.ts
|
|
4586
4567
|
var registry = {};
|
|
@@ -4956,7 +4937,7 @@ function EnableEditor(props) {
|
|
|
4956
4937
|
variationId: variationId !== contentId ? variationId : void 0
|
|
4957
4938
|
});
|
|
4958
4939
|
}
|
|
4959
|
-
if (isPreviewing()) {
|
|
4940
|
+
if (isPreviewing() && !isEditing()) {
|
|
4960
4941
|
const searchParams = new URL(location.href).searchParams;
|
|
4961
4942
|
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
4962
4943
|
const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
|
package/lib/node/index.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
|
|
@@ -513,7 +514,6 @@ function evaluate({
|
|
|
513
514
|
enableCache
|
|
514
515
|
}) {
|
|
515
516
|
if (code === "") {
|
|
516
|
-
logger.warn("Skipping evaluation of empty code block.");
|
|
517
517
|
return void 0;
|
|
518
518
|
}
|
|
519
519
|
const args = {
|
|
@@ -668,9 +668,6 @@ function bindAnimations(animations) {
|
|
|
668
668
|
case "pageLoad":
|
|
669
669
|
triggerAnimation(animation);
|
|
670
670
|
break;
|
|
671
|
-
case "hover":
|
|
672
|
-
bindHoverAnimation(animation);
|
|
673
|
-
break;
|
|
674
671
|
case "scrollInView":
|
|
675
672
|
bindScrollInViewAnimation(animation);
|
|
676
673
|
break;
|
|
@@ -728,33 +725,6 @@ function triggerAnimation(animation) {
|
|
|
728
725
|
});
|
|
729
726
|
});
|
|
730
727
|
}
|
|
731
|
-
function bindHoverAnimation(animation) {
|
|
732
|
-
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
733
|
-
if (!elements.length) {
|
|
734
|
-
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
735
|
-
return;
|
|
736
|
-
}
|
|
737
|
-
Array.from(elements).forEach((element) => {
|
|
738
|
-
augmentAnimation(animation, element);
|
|
739
|
-
const defaultState = animation.steps[0].styles;
|
|
740
|
-
const hoverState = animation.steps[1].styles;
|
|
741
|
-
function attachDefaultState() {
|
|
742
|
-
assign(element.style, defaultState);
|
|
743
|
-
}
|
|
744
|
-
function attachHoverState() {
|
|
745
|
-
assign(element.style, hoverState);
|
|
746
|
-
}
|
|
747
|
-
attachDefaultState();
|
|
748
|
-
element.addEventListener("mouseenter", attachHoverState);
|
|
749
|
-
element.addEventListener("mouseleave", attachDefaultState);
|
|
750
|
-
setTimeout(() => {
|
|
751
|
-
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
752
|
-
if (animation.delay) {
|
|
753
|
-
element.style.transitionDelay = animation.delay + "s";
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
728
|
function bindScrollInViewAnimation(animation) {
|
|
759
729
|
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
760
730
|
if (!elements.length) {
|
|
@@ -1062,7 +1032,27 @@ function BlockStyles(props) {
|
|
|
1062
1032
|
sizesWithUpdatedBreakpoints
|
|
1063
1033
|
)
|
|
1064
1034
|
}) : "";
|
|
1065
|
-
|
|
1035
|
+
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
1036
|
+
let hoverStylesClass = "";
|
|
1037
|
+
if (hoverAnimation) {
|
|
1038
|
+
const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
|
|
1039
|
+
hoverStylesClass = createCssClass({
|
|
1040
|
+
className: `${className}:hover`,
|
|
1041
|
+
styles: {
|
|
1042
|
+
...hoverStyles,
|
|
1043
|
+
transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(
|
|
1044
|
+
hoverAnimation.easing
|
|
1045
|
+
)}`,
|
|
1046
|
+
transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
|
|
1047
|
+
}
|
|
1048
|
+
}) || "";
|
|
1049
|
+
}
|
|
1050
|
+
return [
|
|
1051
|
+
largeStylesClass,
|
|
1052
|
+
mediumStylesClass,
|
|
1053
|
+
smallStylesClass,
|
|
1054
|
+
hoverStylesClass
|
|
1055
|
+
].join(" ");
|
|
1066
1056
|
});
|
|
1067
1057
|
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
|
|
1068
1058
|
}
|
|
@@ -1341,7 +1331,7 @@ function Block(props) {
|
|
|
1341
1331
|
const animations = processedBlock().animations;
|
|
1342
1332
|
if (animations && blockId) {
|
|
1343
1333
|
bindAnimations(
|
|
1344
|
-
animations.
|
|
1334
|
+
animations.map((animation) => ({
|
|
1345
1335
|
...animation,
|
|
1346
1336
|
elementId: blockId
|
|
1347
1337
|
}))
|
|
@@ -3910,14 +3900,12 @@ async function fetchEntries(options) {
|
|
|
3910
3900
|
}
|
|
3911
3901
|
|
|
3912
3902
|
// src/functions/is-previewing.ts
|
|
3913
|
-
function isPreviewing(
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
}
|
|
3917
|
-
const normalizedSearch = getSearchString(search || window.location.search);
|
|
3918
|
-
if (isEditing(normalizedSearch)) {
|
|
3903
|
+
function isPreviewing(_search) {
|
|
3904
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
3905
|
+
if (!search) {
|
|
3919
3906
|
return false;
|
|
3920
3907
|
}
|
|
3908
|
+
const normalizedSearch = getSearchString(search);
|
|
3921
3909
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3922
3910
|
}
|
|
3923
3911
|
|
|
@@ -4165,7 +4153,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4165
4153
|
}
|
|
4166
4154
|
|
|
4167
4155
|
// src/constants/sdk-version.ts
|
|
4168
|
-
var SDK_VERSION = "1.0.
|
|
4156
|
+
var SDK_VERSION = "1.0.23";
|
|
4169
4157
|
|
|
4170
4158
|
// src/functions/register.ts
|
|
4171
4159
|
var registry = {};
|
|
@@ -4555,7 +4543,7 @@ function EnableEditor(props) {
|
|
|
4555
4543
|
variationId: variationId !== contentId ? variationId : void 0
|
|
4556
4544
|
});
|
|
4557
4545
|
}
|
|
4558
|
-
if (isPreviewing()) {
|
|
4546
|
+
if (isPreviewing() && !isEditing()) {
|
|
4559
4547
|
const searchParams = new URL(location.href).searchParams;
|
|
4560
4548
|
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
4561
4549
|
const searchParamPreviewId = searchParams.get(
|