@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/dist/index.d.ts
CHANGED
|
@@ -695,7 +695,7 @@ type Search = URLSearchParams | string | QueryObject;
|
|
|
695
695
|
|
|
696
696
|
declare function isEditing(search?: Search): boolean;
|
|
697
697
|
|
|
698
|
-
declare function isPreviewing(
|
|
698
|
+
declare function isPreviewing(_search?: Search): boolean;
|
|
699
699
|
|
|
700
700
|
declare const createRegisterComponentMessage: (info: ComponentInfo) => {
|
|
701
701
|
type: string;
|
package/lib/browser/dev.js
CHANGED
|
@@ -165,7 +165,8 @@ function isIframe() {
|
|
|
165
165
|
|
|
166
166
|
// src/functions/is-editing.ts
|
|
167
167
|
function isEditing(search) {
|
|
168
|
-
return isIframe() && (TARGET === "reactNative" ||
|
|
168
|
+
return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
169
|
+
getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
// src/functions/track/helpers.ts
|
|
@@ -368,7 +369,6 @@ function evaluate({
|
|
|
368
369
|
enableCache
|
|
369
370
|
}) {
|
|
370
371
|
if (code === "") {
|
|
371
|
-
logger.warn("Skipping evaluation of empty code block.");
|
|
372
372
|
return void 0;
|
|
373
373
|
}
|
|
374
374
|
const args = {
|
|
@@ -536,9 +536,6 @@ function bindAnimations(animations) {
|
|
|
536
536
|
case "pageLoad":
|
|
537
537
|
triggerAnimation(animation);
|
|
538
538
|
break;
|
|
539
|
-
case "hover":
|
|
540
|
-
bindHoverAnimation(animation);
|
|
541
|
-
break;
|
|
542
539
|
case "scrollInView":
|
|
543
540
|
bindScrollInViewAnimation(animation);
|
|
544
541
|
break;
|
|
@@ -597,33 +594,6 @@ function triggerAnimation(animation) {
|
|
|
597
594
|
});
|
|
598
595
|
});
|
|
599
596
|
}
|
|
600
|
-
function bindHoverAnimation(animation) {
|
|
601
|
-
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
602
|
-
if (!elements.length) {
|
|
603
|
-
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
Array.from(elements).forEach((element) => {
|
|
607
|
-
augmentAnimation(animation, element);
|
|
608
|
-
const defaultState = animation.steps[0].styles;
|
|
609
|
-
const hoverState = animation.steps[1].styles;
|
|
610
|
-
function attachDefaultState() {
|
|
611
|
-
assign(element.style, defaultState);
|
|
612
|
-
}
|
|
613
|
-
function attachHoverState() {
|
|
614
|
-
assign(element.style, hoverState);
|
|
615
|
-
}
|
|
616
|
-
attachDefaultState();
|
|
617
|
-
element.addEventListener("mouseenter", attachHoverState);
|
|
618
|
-
element.addEventListener("mouseleave", attachDefaultState);
|
|
619
|
-
setTimeout(() => {
|
|
620
|
-
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
621
|
-
if (animation.delay) {
|
|
622
|
-
element.style.transitionDelay = animation.delay + "s";
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
597
|
function bindScrollInViewAnimation(animation) {
|
|
628
598
|
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
629
599
|
if (!elements.length) {
|
|
@@ -934,7 +904,20 @@ function BlockStyles(props) {
|
|
|
934
904
|
styles: smallStyles,
|
|
935
905
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
936
906
|
}) : "";
|
|
937
|
-
|
|
907
|
+
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
908
|
+
let hoverStylesClass = "";
|
|
909
|
+
if (hoverAnimation) {
|
|
910
|
+
const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
|
|
911
|
+
hoverStylesClass = createCssClass({
|
|
912
|
+
className: `${className}:hover`,
|
|
913
|
+
styles: {
|
|
914
|
+
...hoverStyles,
|
|
915
|
+
transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
|
|
916
|
+
transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
|
|
917
|
+
}
|
|
918
|
+
}) || "";
|
|
919
|
+
}
|
|
920
|
+
return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
|
|
938
921
|
});
|
|
939
922
|
return createComponent(Show, {
|
|
940
923
|
get when() {
|
|
@@ -1266,7 +1249,7 @@ function Block(props) {
|
|
|
1266
1249
|
const blockId = processedBlock().id;
|
|
1267
1250
|
const animations = processedBlock().animations;
|
|
1268
1251
|
if (animations && blockId) {
|
|
1269
|
-
bindAnimations(animations.
|
|
1252
|
+
bindAnimations(animations.map((animation) => ({
|
|
1270
1253
|
...animation,
|
|
1271
1254
|
elementId: blockId
|
|
1272
1255
|
})));
|
|
@@ -4192,14 +4175,12 @@ async function fetchEntries(options) {
|
|
|
4192
4175
|
}
|
|
4193
4176
|
|
|
4194
4177
|
// src/functions/is-previewing.ts
|
|
4195
|
-
function isPreviewing(
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
}
|
|
4199
|
-
const normalizedSearch = getSearchString(search || window.location.search);
|
|
4200
|
-
if (isEditing(normalizedSearch)) {
|
|
4178
|
+
function isPreviewing(_search) {
|
|
4179
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
4180
|
+
if (!search) {
|
|
4201
4181
|
return false;
|
|
4202
4182
|
}
|
|
4183
|
+
const normalizedSearch = getSearchString(search);
|
|
4203
4184
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4204
4185
|
}
|
|
4205
4186
|
|
|
@@ -4450,7 +4431,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4450
4431
|
}
|
|
4451
4432
|
|
|
4452
4433
|
// src/constants/sdk-version.ts
|
|
4453
|
-
var SDK_VERSION = "1.0.
|
|
4434
|
+
var SDK_VERSION = "1.0.23";
|
|
4454
4435
|
|
|
4455
4436
|
// src/functions/register.ts
|
|
4456
4437
|
var registry = {};
|
|
@@ -4828,7 +4809,7 @@ function EnableEditor(props) {
|
|
|
4828
4809
|
variationId: variationId !== contentId ? variationId : void 0
|
|
4829
4810
|
});
|
|
4830
4811
|
}
|
|
4831
|
-
if (isPreviewing()) {
|
|
4812
|
+
if (isPreviewing() && !isEditing()) {
|
|
4832
4813
|
const searchParams = new URL(location.href).searchParams;
|
|
4833
4814
|
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
4834
4815
|
const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
|
package/lib/browser/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
|
|
@@ -355,7 +356,6 @@ function evaluate({
|
|
|
355
356
|
enableCache
|
|
356
357
|
}) {
|
|
357
358
|
if (code === "") {
|
|
358
|
-
logger.warn("Skipping evaluation of empty code block.");
|
|
359
359
|
return void 0;
|
|
360
360
|
}
|
|
361
361
|
const args = {
|
|
@@ -523,9 +523,6 @@ function bindAnimations(animations) {
|
|
|
523
523
|
case "pageLoad":
|
|
524
524
|
triggerAnimation(animation);
|
|
525
525
|
break;
|
|
526
|
-
case "hover":
|
|
527
|
-
bindHoverAnimation(animation);
|
|
528
|
-
break;
|
|
529
526
|
case "scrollInView":
|
|
530
527
|
bindScrollInViewAnimation(animation);
|
|
531
528
|
break;
|
|
@@ -584,33 +581,6 @@ function triggerAnimation(animation) {
|
|
|
584
581
|
});
|
|
585
582
|
});
|
|
586
583
|
}
|
|
587
|
-
function bindHoverAnimation(animation) {
|
|
588
|
-
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
589
|
-
if (!elements.length) {
|
|
590
|
-
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
Array.from(elements).forEach((element) => {
|
|
594
|
-
augmentAnimation(animation, element);
|
|
595
|
-
const defaultState = animation.steps[0].styles;
|
|
596
|
-
const hoverState = animation.steps[1].styles;
|
|
597
|
-
function attachDefaultState() {
|
|
598
|
-
assign(element.style, defaultState);
|
|
599
|
-
}
|
|
600
|
-
function attachHoverState() {
|
|
601
|
-
assign(element.style, hoverState);
|
|
602
|
-
}
|
|
603
|
-
attachDefaultState();
|
|
604
|
-
element.addEventListener("mouseenter", attachHoverState);
|
|
605
|
-
element.addEventListener("mouseleave", attachDefaultState);
|
|
606
|
-
setTimeout(() => {
|
|
607
|
-
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
608
|
-
if (animation.delay) {
|
|
609
|
-
element.style.transitionDelay = animation.delay + "s";
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
584
|
function bindScrollInViewAnimation(animation) {
|
|
615
585
|
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
616
586
|
if (!elements.length) {
|
|
@@ -921,7 +891,27 @@ function BlockStyles(props) {
|
|
|
921
891
|
sizesWithUpdatedBreakpoints
|
|
922
892
|
)
|
|
923
893
|
}) : "";
|
|
924
|
-
|
|
894
|
+
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
895
|
+
let hoverStylesClass = "";
|
|
896
|
+
if (hoverAnimation) {
|
|
897
|
+
const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
|
|
898
|
+
hoverStylesClass = createCssClass({
|
|
899
|
+
className: `${className}:hover`,
|
|
900
|
+
styles: {
|
|
901
|
+
...hoverStyles,
|
|
902
|
+
transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(
|
|
903
|
+
hoverAnimation.easing
|
|
904
|
+
)}`,
|
|
905
|
+
transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
|
|
906
|
+
}
|
|
907
|
+
}) || "";
|
|
908
|
+
}
|
|
909
|
+
return [
|
|
910
|
+
largeStylesClass,
|
|
911
|
+
mediumStylesClass,
|
|
912
|
+
smallStylesClass,
|
|
913
|
+
hoverStylesClass
|
|
914
|
+
].join(" ");
|
|
925
915
|
});
|
|
926
916
|
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
|
|
927
917
|
}
|
|
@@ -1200,7 +1190,7 @@ function Block(props) {
|
|
|
1200
1190
|
const animations = processedBlock().animations;
|
|
1201
1191
|
if (animations && blockId) {
|
|
1202
1192
|
bindAnimations(
|
|
1203
|
-
animations.
|
|
1193
|
+
animations.map((animation) => ({
|
|
1204
1194
|
...animation,
|
|
1205
1195
|
elementId: blockId
|
|
1206
1196
|
}))
|
|
@@ -3775,14 +3765,12 @@ async function fetchEntries(options) {
|
|
|
3775
3765
|
}
|
|
3776
3766
|
|
|
3777
3767
|
// src/functions/is-previewing.ts
|
|
3778
|
-
function isPreviewing(
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
}
|
|
3782
|
-
const normalizedSearch = getSearchString(search || window.location.search);
|
|
3783
|
-
if (isEditing(normalizedSearch)) {
|
|
3768
|
+
function isPreviewing(_search) {
|
|
3769
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
3770
|
+
if (!search) {
|
|
3784
3771
|
return false;
|
|
3785
3772
|
}
|
|
3773
|
+
const normalizedSearch = getSearchString(search);
|
|
3786
3774
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3787
3775
|
}
|
|
3788
3776
|
|
|
@@ -4033,7 +4021,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4033
4021
|
}
|
|
4034
4022
|
|
|
4035
4023
|
// src/constants/sdk-version.ts
|
|
4036
|
-
var SDK_VERSION = "1.0.
|
|
4024
|
+
var SDK_VERSION = "1.0.23";
|
|
4037
4025
|
|
|
4038
4026
|
// src/functions/register.ts
|
|
4039
4027
|
var registry = {};
|
|
@@ -4425,7 +4413,7 @@ function EnableEditor(props) {
|
|
|
4425
4413
|
variationId: variationId !== contentId ? variationId : void 0
|
|
4426
4414
|
});
|
|
4427
4415
|
}
|
|
4428
|
-
if (isPreviewing()) {
|
|
4416
|
+
if (isPreviewing() && !isEditing()) {
|
|
4429
4417
|
const searchParams = new URL(location.href).searchParams;
|
|
4430
4418
|
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
4431
4419
|
const searchParamPreviewId = searchParams.get(
|
package/lib/browser/index.js
CHANGED
|
@@ -164,7 +164,8 @@ function isIframe() {
|
|
|
164
164
|
|
|
165
165
|
// src/functions/is-editing.ts
|
|
166
166
|
function isEditing(search) {
|
|
167
|
-
return isIframe() && (TARGET === "reactNative" ||
|
|
167
|
+
return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
168
|
+
getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
// src/functions/track/helpers.ts
|
|
@@ -366,7 +367,6 @@ function evaluate({
|
|
|
366
367
|
enableCache
|
|
367
368
|
}) {
|
|
368
369
|
if (code === "") {
|
|
369
|
-
logger.warn("Skipping evaluation of empty code block.");
|
|
370
370
|
return void 0;
|
|
371
371
|
}
|
|
372
372
|
const args = {
|
|
@@ -534,9 +534,6 @@ function bindAnimations(animations) {
|
|
|
534
534
|
case "pageLoad":
|
|
535
535
|
triggerAnimation(animation);
|
|
536
536
|
break;
|
|
537
|
-
case "hover":
|
|
538
|
-
bindHoverAnimation(animation);
|
|
539
|
-
break;
|
|
540
537
|
case "scrollInView":
|
|
541
538
|
bindScrollInViewAnimation(animation);
|
|
542
539
|
break;
|
|
@@ -594,33 +591,6 @@ function triggerAnimation(animation) {
|
|
|
594
591
|
});
|
|
595
592
|
});
|
|
596
593
|
}
|
|
597
|
-
function bindHoverAnimation(animation) {
|
|
598
|
-
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
599
|
-
if (!elements.length) {
|
|
600
|
-
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
601
|
-
return;
|
|
602
|
-
}
|
|
603
|
-
Array.from(elements).forEach((element) => {
|
|
604
|
-
augmentAnimation(animation, element);
|
|
605
|
-
const defaultState = animation.steps[0].styles;
|
|
606
|
-
const hoverState = animation.steps[1].styles;
|
|
607
|
-
function attachDefaultState() {
|
|
608
|
-
assign(element.style, defaultState);
|
|
609
|
-
}
|
|
610
|
-
function attachHoverState() {
|
|
611
|
-
assign(element.style, hoverState);
|
|
612
|
-
}
|
|
613
|
-
attachDefaultState();
|
|
614
|
-
element.addEventListener("mouseenter", attachHoverState);
|
|
615
|
-
element.addEventListener("mouseleave", attachDefaultState);
|
|
616
|
-
setTimeout(() => {
|
|
617
|
-
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
618
|
-
if (animation.delay) {
|
|
619
|
-
element.style.transitionDelay = animation.delay + "s";
|
|
620
|
-
}
|
|
621
|
-
});
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
594
|
function bindScrollInViewAnimation(animation) {
|
|
625
595
|
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
626
596
|
if (!elements.length) {
|
|
@@ -928,7 +898,20 @@ function BlockStyles(props) {
|
|
|
928
898
|
styles: smallStyles,
|
|
929
899
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
930
900
|
}) : "";
|
|
931
|
-
|
|
901
|
+
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
902
|
+
let hoverStylesClass = "";
|
|
903
|
+
if (hoverAnimation) {
|
|
904
|
+
const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
|
|
905
|
+
hoverStylesClass = createCssClass({
|
|
906
|
+
className: `${className}:hover`,
|
|
907
|
+
styles: {
|
|
908
|
+
...hoverStyles,
|
|
909
|
+
transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
|
|
910
|
+
transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
|
|
911
|
+
}
|
|
912
|
+
}) || "";
|
|
913
|
+
}
|
|
914
|
+
return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
|
|
932
915
|
});
|
|
933
916
|
return createComponent(Show, {
|
|
934
917
|
get when() {
|
|
@@ -1260,7 +1243,7 @@ function Block(props) {
|
|
|
1260
1243
|
const blockId = processedBlock().id;
|
|
1261
1244
|
const animations = processedBlock().animations;
|
|
1262
1245
|
if (animations && blockId) {
|
|
1263
|
-
bindAnimations(animations.
|
|
1246
|
+
bindAnimations(animations.map((animation) => ({
|
|
1264
1247
|
...animation,
|
|
1265
1248
|
elementId: blockId
|
|
1266
1249
|
})));
|
|
@@ -4180,14 +4163,12 @@ async function fetchEntries(options) {
|
|
|
4180
4163
|
}
|
|
4181
4164
|
|
|
4182
4165
|
// src/functions/is-previewing.ts
|
|
4183
|
-
function isPreviewing(
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
}
|
|
4187
|
-
const normalizedSearch = getSearchString(search || window.location.search);
|
|
4188
|
-
if (isEditing(normalizedSearch)) {
|
|
4166
|
+
function isPreviewing(_search) {
|
|
4167
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
4168
|
+
if (!search) {
|
|
4189
4169
|
return false;
|
|
4190
4170
|
}
|
|
4171
|
+
const normalizedSearch = getSearchString(search);
|
|
4191
4172
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4192
4173
|
}
|
|
4193
4174
|
|
|
@@ -4435,7 +4416,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4435
4416
|
}
|
|
4436
4417
|
|
|
4437
4418
|
// src/constants/sdk-version.ts
|
|
4438
|
-
var SDK_VERSION = "1.0.
|
|
4419
|
+
var SDK_VERSION = "1.0.23";
|
|
4439
4420
|
|
|
4440
4421
|
// src/functions/register.ts
|
|
4441
4422
|
var registry = {};
|
|
@@ -4811,7 +4792,7 @@ function EnableEditor(props) {
|
|
|
4811
4792
|
variationId: variationId !== contentId ? variationId : void 0
|
|
4812
4793
|
});
|
|
4813
4794
|
}
|
|
4814
|
-
if (isPreviewing()) {
|
|
4795
|
+
if (isPreviewing() && !isEditing()) {
|
|
4815
4796
|
const searchParams = new URL(location.href).searchParams;
|
|
4816
4797
|
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
4817
4798
|
const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
|
package/lib/browser/index.jsx
CHANGED
|
@@ -151,7 +151,8 @@ function isIframe() {
|
|
|
151
151
|
|
|
152
152
|
// src/functions/is-editing.ts
|
|
153
153
|
function isEditing(search) {
|
|
154
|
-
return isIframe() && (TARGET === "reactNative" ||
|
|
154
|
+
return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
155
|
+
getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
// src/functions/track/helpers.ts
|
|
@@ -353,7 +354,6 @@ function evaluate({
|
|
|
353
354
|
enableCache
|
|
354
355
|
}) {
|
|
355
356
|
if (code === "") {
|
|
356
|
-
logger.warn("Skipping evaluation of empty code block.");
|
|
357
357
|
return void 0;
|
|
358
358
|
}
|
|
359
359
|
const args = {
|
|
@@ -521,9 +521,6 @@ function bindAnimations(animations) {
|
|
|
521
521
|
case "pageLoad":
|
|
522
522
|
triggerAnimation(animation);
|
|
523
523
|
break;
|
|
524
|
-
case "hover":
|
|
525
|
-
bindHoverAnimation(animation);
|
|
526
|
-
break;
|
|
527
524
|
case "scrollInView":
|
|
528
525
|
bindScrollInViewAnimation(animation);
|
|
529
526
|
break;
|
|
@@ -581,33 +578,6 @@ function triggerAnimation(animation) {
|
|
|
581
578
|
});
|
|
582
579
|
});
|
|
583
580
|
}
|
|
584
|
-
function bindHoverAnimation(animation) {
|
|
585
|
-
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
586
|
-
if (!elements.length) {
|
|
587
|
-
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
Array.from(elements).forEach((element) => {
|
|
591
|
-
augmentAnimation(animation, element);
|
|
592
|
-
const defaultState = animation.steps[0].styles;
|
|
593
|
-
const hoverState = animation.steps[1].styles;
|
|
594
|
-
function attachDefaultState() {
|
|
595
|
-
assign(element.style, defaultState);
|
|
596
|
-
}
|
|
597
|
-
function attachHoverState() {
|
|
598
|
-
assign(element.style, hoverState);
|
|
599
|
-
}
|
|
600
|
-
attachDefaultState();
|
|
601
|
-
element.addEventListener("mouseenter", attachHoverState);
|
|
602
|
-
element.addEventListener("mouseleave", attachDefaultState);
|
|
603
|
-
setTimeout(() => {
|
|
604
|
-
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
605
|
-
if (animation.delay) {
|
|
606
|
-
element.style.transitionDelay = animation.delay + "s";
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
581
|
function bindScrollInViewAnimation(animation) {
|
|
612
582
|
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
613
583
|
if (!elements.length) {
|
|
@@ -915,7 +885,27 @@ function BlockStyles(props) {
|
|
|
915
885
|
sizesWithUpdatedBreakpoints
|
|
916
886
|
)
|
|
917
887
|
}) : "";
|
|
918
|
-
|
|
888
|
+
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
889
|
+
let hoverStylesClass = "";
|
|
890
|
+
if (hoverAnimation) {
|
|
891
|
+
const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
|
|
892
|
+
hoverStylesClass = createCssClass({
|
|
893
|
+
className: `${className}:hover`,
|
|
894
|
+
styles: {
|
|
895
|
+
...hoverStyles,
|
|
896
|
+
transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(
|
|
897
|
+
hoverAnimation.easing
|
|
898
|
+
)}`,
|
|
899
|
+
transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
|
|
900
|
+
}
|
|
901
|
+
}) || "";
|
|
902
|
+
}
|
|
903
|
+
return [
|
|
904
|
+
largeStylesClass,
|
|
905
|
+
mediumStylesClass,
|
|
906
|
+
smallStylesClass,
|
|
907
|
+
hoverStylesClass
|
|
908
|
+
].join(" ");
|
|
919
909
|
});
|
|
920
910
|
return <Show2 when={TARGET !== "reactNative" && css5() && canShowBlock()}><Inlined_styles_default id="builderio-block" styles={css5()} /></Show2>;
|
|
921
911
|
}
|
|
@@ -1194,7 +1184,7 @@ function Block(props) {
|
|
|
1194
1184
|
const animations = processedBlock().animations;
|
|
1195
1185
|
if (animations && blockId) {
|
|
1196
1186
|
bindAnimations(
|
|
1197
|
-
animations.
|
|
1187
|
+
animations.map((animation) => ({
|
|
1198
1188
|
...animation,
|
|
1199
1189
|
elementId: blockId
|
|
1200
1190
|
}))
|
|
@@ -3763,14 +3753,12 @@ async function fetchEntries(options) {
|
|
|
3763
3753
|
}
|
|
3764
3754
|
|
|
3765
3755
|
// src/functions/is-previewing.ts
|
|
3766
|
-
function isPreviewing(
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
}
|
|
3770
|
-
const normalizedSearch = getSearchString(search || window.location.search);
|
|
3771
|
-
if (isEditing(normalizedSearch)) {
|
|
3756
|
+
function isPreviewing(_search) {
|
|
3757
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
3758
|
+
if (!search) {
|
|
3772
3759
|
return false;
|
|
3773
3760
|
}
|
|
3761
|
+
const normalizedSearch = getSearchString(search);
|
|
3774
3762
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3775
3763
|
}
|
|
3776
3764
|
|
|
@@ -4018,7 +4006,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
4018
4006
|
}
|
|
4019
4007
|
|
|
4020
4008
|
// src/constants/sdk-version.ts
|
|
4021
|
-
var SDK_VERSION = "1.0.
|
|
4009
|
+
var SDK_VERSION = "1.0.23";
|
|
4022
4010
|
|
|
4023
4011
|
// src/functions/register.ts
|
|
4024
4012
|
var registry = {};
|
|
@@ -4408,7 +4396,7 @@ function EnableEditor(props) {
|
|
|
4408
4396
|
variationId: variationId !== contentId ? variationId : void 0
|
|
4409
4397
|
});
|
|
4410
4398
|
}
|
|
4411
|
-
if (isPreviewing()) {
|
|
4399
|
+
if (isPreviewing() && !isEditing()) {
|
|
4412
4400
|
const searchParams = new URL(location.href).searchParams;
|
|
4413
4401
|
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
4414
4402
|
const searchParamPreviewId = searchParams.get(
|
package/lib/edge/dev.js
CHANGED
|
@@ -171,7 +171,8 @@ function isIframe() {
|
|
|
171
171
|
|
|
172
172
|
// src/functions/is-editing.ts
|
|
173
173
|
function isEditing(search) {
|
|
174
|
-
return isIframe() && (TARGET === "reactNative" ||
|
|
174
|
+
return isIframe() && (TARGET === "reactNative" || // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
175
|
+
getSearchString(search || window.location.search).indexOf("builder.frameEditing=") !== -1);
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
// src/functions/track/helpers.ts
|
|
@@ -3531,7 +3532,6 @@ function evaluate({
|
|
|
3531
3532
|
enableCache
|
|
3532
3533
|
}) {
|
|
3533
3534
|
if (code === "") {
|
|
3534
|
-
logger.warn("Skipping evaluation of empty code block.");
|
|
3535
3535
|
return void 0;
|
|
3536
3536
|
}
|
|
3537
3537
|
const args = {
|
|
@@ -3689,9 +3689,6 @@ function bindAnimations(animations) {
|
|
|
3689
3689
|
case "pageLoad":
|
|
3690
3690
|
triggerAnimation(animation);
|
|
3691
3691
|
break;
|
|
3692
|
-
case "hover":
|
|
3693
|
-
bindHoverAnimation(animation);
|
|
3694
|
-
break;
|
|
3695
3692
|
case "scrollInView":
|
|
3696
3693
|
bindScrollInViewAnimation(animation);
|
|
3697
3694
|
break;
|
|
@@ -3750,33 +3747,6 @@ function triggerAnimation(animation) {
|
|
|
3750
3747
|
});
|
|
3751
3748
|
});
|
|
3752
3749
|
}
|
|
3753
|
-
function bindHoverAnimation(animation) {
|
|
3754
|
-
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3755
|
-
if (!elements.length) {
|
|
3756
|
-
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3757
|
-
return;
|
|
3758
|
-
}
|
|
3759
|
-
Array.from(elements).forEach((element) => {
|
|
3760
|
-
augmentAnimation(animation, element);
|
|
3761
|
-
const defaultState = animation.steps[0].styles;
|
|
3762
|
-
const hoverState = animation.steps[1].styles;
|
|
3763
|
-
function attachDefaultState() {
|
|
3764
|
-
assign(element.style, defaultState);
|
|
3765
|
-
}
|
|
3766
|
-
function attachHoverState() {
|
|
3767
|
-
assign(element.style, hoverState);
|
|
3768
|
-
}
|
|
3769
|
-
attachDefaultState();
|
|
3770
|
-
element.addEventListener("mouseenter", attachHoverState);
|
|
3771
|
-
element.addEventListener("mouseleave", attachDefaultState);
|
|
3772
|
-
setTimeout(() => {
|
|
3773
|
-
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3774
|
-
if (animation.delay) {
|
|
3775
|
-
element.style.transitionDelay = animation.delay + "s";
|
|
3776
|
-
}
|
|
3777
|
-
});
|
|
3778
|
-
});
|
|
3779
|
-
}
|
|
3780
3750
|
function bindScrollInViewAnimation(animation) {
|
|
3781
3751
|
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3782
3752
|
if (!elements.length) {
|
|
@@ -4087,7 +4057,20 @@ function BlockStyles(props) {
|
|
|
4087
4057
|
styles: smallStyles,
|
|
4088
4058
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
4089
4059
|
}) : "";
|
|
4090
|
-
|
|
4060
|
+
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
4061
|
+
let hoverStylesClass = "";
|
|
4062
|
+
if (hoverAnimation) {
|
|
4063
|
+
const hoverStyles = hoverAnimation.steps?.[1]?.styles || {};
|
|
4064
|
+
hoverStylesClass = createCssClass({
|
|
4065
|
+
className: `${className}:hover`,
|
|
4066
|
+
styles: {
|
|
4067
|
+
...hoverStyles,
|
|
4068
|
+
transition: `all ${hoverAnimation.duration}s ${camelCaseToKebabCase(hoverAnimation.easing)}`,
|
|
4069
|
+
transitionDelay: hoverAnimation.delay ? `${hoverAnimation.delay}s` : "0s"
|
|
4070
|
+
}
|
|
4071
|
+
}) || "";
|
|
4072
|
+
}
|
|
4073
|
+
return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
|
|
4091
4074
|
});
|
|
4092
4075
|
return createComponent(Show, {
|
|
4093
4076
|
get when() {
|
|
@@ -4419,7 +4402,7 @@ function Block(props) {
|
|
|
4419
4402
|
const blockId = processedBlock().id;
|
|
4420
4403
|
const animations = processedBlock().animations;
|
|
4421
4404
|
if (animations && blockId) {
|
|
4422
|
-
bindAnimations(animations.
|
|
4405
|
+
bindAnimations(animations.map((animation) => ({
|
|
4423
4406
|
...animation,
|
|
4424
4407
|
elementId: blockId
|
|
4425
4408
|
})));
|
|
@@ -7345,14 +7328,12 @@ async function fetchEntries(options) {
|
|
|
7345
7328
|
}
|
|
7346
7329
|
|
|
7347
7330
|
// src/functions/is-previewing.ts
|
|
7348
|
-
function isPreviewing(
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
}
|
|
7352
|
-
const normalizedSearch = getSearchString(search || window.location.search);
|
|
7353
|
-
if (isEditing(normalizedSearch)) {
|
|
7331
|
+
function isPreviewing(_search) {
|
|
7332
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
7333
|
+
if (!search) {
|
|
7354
7334
|
return false;
|
|
7355
7335
|
}
|
|
7336
|
+
const normalizedSearch = getSearchString(search);
|
|
7356
7337
|
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
7357
7338
|
}
|
|
7358
7339
|
|
|
@@ -7603,7 +7584,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
7603
7584
|
}
|
|
7604
7585
|
|
|
7605
7586
|
// src/constants/sdk-version.ts
|
|
7606
|
-
var SDK_VERSION = "1.0.
|
|
7587
|
+
var SDK_VERSION = "1.0.23";
|
|
7607
7588
|
|
|
7608
7589
|
// src/functions/register.ts
|
|
7609
7590
|
var registry = {};
|
|
@@ -7981,7 +7962,7 @@ function EnableEditor(props) {
|
|
|
7981
7962
|
variationId: variationId !== contentId ? variationId : void 0
|
|
7982
7963
|
});
|
|
7983
7964
|
}
|
|
7984
|
-
if (isPreviewing()) {
|
|
7965
|
+
if (isPreviewing() && !isEditing()) {
|
|
7985
7966
|
const searchParams = new URL(location.href).searchParams;
|
|
7986
7967
|
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
7987
7968
|
const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
|