@builder.io/sdk-solid 0.12.6 → 0.12.7
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 +18 -1
- package/lib/browser/dev.js +221 -1
- package/lib/browser/dev.jsx +233 -11
- package/lib/browser/index.js +220 -1
- package/lib/browser/index.jsx +232 -11
- package/lib/edge/dev.js +221 -1
- package/lib/edge/dev.jsx +233 -11
- package/lib/edge/index.js +220 -1
- package/lib/edge/index.jsx +232 -11
- package/lib/node/dev.js +221 -1
- package/lib/node/dev.jsx +233 -11
- package/lib/node/index.js +220 -1
- package/lib/node/index.jsx +232 -11
- package/package.json +1 -1
package/lib/edge/dev.js
CHANGED
|
@@ -3576,6 +3576,212 @@ function getProcessedBlock({
|
|
|
3576
3576
|
}
|
|
3577
3577
|
}
|
|
3578
3578
|
|
|
3579
|
+
// src/components/block/animator.ts
|
|
3580
|
+
function throttle(func, wait, options = {}) {
|
|
3581
|
+
let context;
|
|
3582
|
+
let args;
|
|
3583
|
+
let result;
|
|
3584
|
+
let timeout = null;
|
|
3585
|
+
let previous = 0;
|
|
3586
|
+
const later = function() {
|
|
3587
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
3588
|
+
timeout = null;
|
|
3589
|
+
result = func.apply(context, args);
|
|
3590
|
+
if (!timeout)
|
|
3591
|
+
context = args = null;
|
|
3592
|
+
};
|
|
3593
|
+
return function() {
|
|
3594
|
+
const now = Date.now();
|
|
3595
|
+
if (!previous && options.leading === false)
|
|
3596
|
+
previous = now;
|
|
3597
|
+
const remaining = wait - (now - previous);
|
|
3598
|
+
context = this;
|
|
3599
|
+
args = arguments;
|
|
3600
|
+
if (remaining <= 0 || remaining > wait) {
|
|
3601
|
+
if (timeout) {
|
|
3602
|
+
clearTimeout(timeout);
|
|
3603
|
+
timeout = null;
|
|
3604
|
+
}
|
|
3605
|
+
previous = now;
|
|
3606
|
+
result = func.apply(context, args);
|
|
3607
|
+
if (!timeout)
|
|
3608
|
+
context = args = null;
|
|
3609
|
+
} else if (!timeout && options.trailing !== false) {
|
|
3610
|
+
timeout = setTimeout(later, remaining);
|
|
3611
|
+
}
|
|
3612
|
+
return result;
|
|
3613
|
+
};
|
|
3614
|
+
}
|
|
3615
|
+
function assign(target, ..._args) {
|
|
3616
|
+
const to = Object(target);
|
|
3617
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
3618
|
+
const nextSource = arguments[index];
|
|
3619
|
+
if (nextSource != null) {
|
|
3620
|
+
for (const nextKey in nextSource) {
|
|
3621
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
3622
|
+
to[nextKey] = nextSource[nextKey];
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
return to;
|
|
3628
|
+
}
|
|
3629
|
+
var camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : "";
|
|
3630
|
+
function bindAnimations(animations) {
|
|
3631
|
+
for (const animation of animations) {
|
|
3632
|
+
switch (animation.trigger) {
|
|
3633
|
+
case "pageLoad":
|
|
3634
|
+
triggerAnimation(animation);
|
|
3635
|
+
break;
|
|
3636
|
+
case "hover":
|
|
3637
|
+
bindHoverAnimation(animation);
|
|
3638
|
+
break;
|
|
3639
|
+
case "scrollInView":
|
|
3640
|
+
bindScrollInViewAnimation(animation);
|
|
3641
|
+
break;
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
function warnElementNotPresent(id2) {
|
|
3646
|
+
console.warn(`Cannot animate element: element with ID ${id2} not found!`);
|
|
3647
|
+
}
|
|
3648
|
+
function augmentAnimation(animation, element) {
|
|
3649
|
+
const stylesUsed = getAllStylesUsed(animation);
|
|
3650
|
+
const computedStyle = getComputedStyle(element);
|
|
3651
|
+
const firstStyles = animation.steps[0].styles;
|
|
3652
|
+
const lastStyles = animation.steps[animation.steps.length - 1].styles;
|
|
3653
|
+
const bothStyles = [firstStyles, lastStyles];
|
|
3654
|
+
for (const styles of bothStyles) {
|
|
3655
|
+
for (const style of stylesUsed) {
|
|
3656
|
+
if (!(style in styles)) {
|
|
3657
|
+
styles[style] = computedStyle[style];
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
function getAllStylesUsed(animation) {
|
|
3663
|
+
const properties = [];
|
|
3664
|
+
for (const step of animation.steps) {
|
|
3665
|
+
for (const key in step.styles) {
|
|
3666
|
+
if (properties.indexOf(key) === -1) {
|
|
3667
|
+
properties.push(key);
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3671
|
+
return properties;
|
|
3672
|
+
}
|
|
3673
|
+
function triggerAnimation(animation) {
|
|
3674
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3675
|
+
if (!elements.length) {
|
|
3676
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3677
|
+
return;
|
|
3678
|
+
}
|
|
3679
|
+
Array.from(elements).forEach((element) => {
|
|
3680
|
+
augmentAnimation(animation, element);
|
|
3681
|
+
element.style.transition = "none";
|
|
3682
|
+
element.style.transitionDelay = "0";
|
|
3683
|
+
assign(element.style, animation.steps[0].styles);
|
|
3684
|
+
setTimeout(() => {
|
|
3685
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3686
|
+
if (animation.delay) {
|
|
3687
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3688
|
+
}
|
|
3689
|
+
assign(element.style, animation.steps[1].styles);
|
|
3690
|
+
setTimeout(() => {
|
|
3691
|
+
element.style.transition = "";
|
|
3692
|
+
element.style.transitionDelay = "";
|
|
3693
|
+
}, (animation.delay || 0) * 1e3 + animation.duration * 1e3 + 100);
|
|
3694
|
+
});
|
|
3695
|
+
});
|
|
3696
|
+
}
|
|
3697
|
+
function bindHoverAnimation(animation) {
|
|
3698
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3699
|
+
if (!elements.length) {
|
|
3700
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3701
|
+
return;
|
|
3702
|
+
}
|
|
3703
|
+
Array.from(elements).forEach((element) => {
|
|
3704
|
+
augmentAnimation(animation, element);
|
|
3705
|
+
const defaultState = animation.steps[0].styles;
|
|
3706
|
+
const hoverState = animation.steps[1].styles;
|
|
3707
|
+
function attachDefaultState() {
|
|
3708
|
+
assign(element.style, defaultState);
|
|
3709
|
+
}
|
|
3710
|
+
function attachHoverState() {
|
|
3711
|
+
assign(element.style, hoverState);
|
|
3712
|
+
}
|
|
3713
|
+
attachDefaultState();
|
|
3714
|
+
element.addEventListener("mouseenter", attachHoverState);
|
|
3715
|
+
element.addEventListener("mouseleave", attachDefaultState);
|
|
3716
|
+
setTimeout(() => {
|
|
3717
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3718
|
+
if (animation.delay) {
|
|
3719
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3720
|
+
}
|
|
3721
|
+
});
|
|
3722
|
+
});
|
|
3723
|
+
}
|
|
3724
|
+
function bindScrollInViewAnimation(animation) {
|
|
3725
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3726
|
+
if (!elements.length) {
|
|
3727
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3728
|
+
return;
|
|
3729
|
+
}
|
|
3730
|
+
Array.from(elements).forEach((element) => {
|
|
3731
|
+
augmentAnimation(animation, element);
|
|
3732
|
+
let triggered = false;
|
|
3733
|
+
let pendingAnimation = false;
|
|
3734
|
+
function immediateOnScroll() {
|
|
3735
|
+
if (!triggered && isScrolledIntoView(element)) {
|
|
3736
|
+
triggered = true;
|
|
3737
|
+
pendingAnimation = true;
|
|
3738
|
+
setTimeout(() => {
|
|
3739
|
+
assign(element.style, animation.steps[1].styles);
|
|
3740
|
+
if (!animation.repeat) {
|
|
3741
|
+
document.removeEventListener("scroll", onScroll);
|
|
3742
|
+
}
|
|
3743
|
+
setTimeout(() => {
|
|
3744
|
+
pendingAnimation = false;
|
|
3745
|
+
if (!animation.repeat) {
|
|
3746
|
+
element.style.transition = "";
|
|
3747
|
+
element.style.transitionDelay = "";
|
|
3748
|
+
}
|
|
3749
|
+
}, (animation.duration + (animation.delay || 0)) * 1e3 + 100);
|
|
3750
|
+
});
|
|
3751
|
+
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
3752
|
+
triggered = false;
|
|
3753
|
+
assign(element.style, animation.steps[0].styles);
|
|
3754
|
+
}
|
|
3755
|
+
}
|
|
3756
|
+
const onScroll = throttle(immediateOnScroll, 200, {
|
|
3757
|
+
leading: false
|
|
3758
|
+
});
|
|
3759
|
+
function isScrolledIntoView(elem) {
|
|
3760
|
+
const rect = elem.getBoundingClientRect();
|
|
3761
|
+
const windowHeight = window.innerHeight;
|
|
3762
|
+
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
3763
|
+
const threshold = thresholdPercent * windowHeight;
|
|
3764
|
+
return rect.bottom > threshold && rect.top < windowHeight - threshold;
|
|
3765
|
+
}
|
|
3766
|
+
const defaultState = animation.steps[0].styles;
|
|
3767
|
+
function attachDefaultState() {
|
|
3768
|
+
assign(element.style, defaultState);
|
|
3769
|
+
}
|
|
3770
|
+
attachDefaultState();
|
|
3771
|
+
setTimeout(() => {
|
|
3772
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3773
|
+
if (animation.delay) {
|
|
3774
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3775
|
+
}
|
|
3776
|
+
});
|
|
3777
|
+
document.addEventListener("scroll", onScroll, {
|
|
3778
|
+
capture: true,
|
|
3779
|
+
passive: true
|
|
3780
|
+
});
|
|
3781
|
+
immediateOnScroll();
|
|
3782
|
+
});
|
|
3783
|
+
}
|
|
3784
|
+
|
|
3579
3785
|
// src/components/block/block.helpers.ts
|
|
3580
3786
|
var getComponent = ({
|
|
3581
3787
|
block,
|
|
@@ -4151,6 +4357,16 @@ function Block(props) {
|
|
|
4151
4357
|
isInteractive: !blockComponent()?.isRSC
|
|
4152
4358
|
};
|
|
4153
4359
|
}
|
|
4360
|
+
onMount(() => {
|
|
4361
|
+
const blockId = processedBlock().id;
|
|
4362
|
+
const animations = processedBlock().animations;
|
|
4363
|
+
if (animations && blockId) {
|
|
4364
|
+
bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
|
|
4365
|
+
...animation,
|
|
4366
|
+
elementId: blockId
|
|
4367
|
+
})));
|
|
4368
|
+
}
|
|
4369
|
+
});
|
|
4154
4370
|
return createComponent(Show, {
|
|
4155
4371
|
get when() {
|
|
4156
4372
|
return canShowBlock();
|
|
@@ -6563,7 +6779,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
6563
6779
|
};
|
|
6564
6780
|
|
|
6565
6781
|
// src/constants/sdk-version.ts
|
|
6566
|
-
var SDK_VERSION = "0.12.
|
|
6782
|
+
var SDK_VERSION = "0.12.7";
|
|
6567
6783
|
|
|
6568
6784
|
// src/functions/register.ts
|
|
6569
6785
|
var registry = {};
|
|
@@ -6770,6 +6986,10 @@ function EnableEditor(props) {
|
|
|
6770
6986
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
6771
6987
|
break;
|
|
6772
6988
|
}
|
|
6989
|
+
case "builder.triggerAnimation": {
|
|
6990
|
+
triggerAnimation(data.data);
|
|
6991
|
+
break;
|
|
6992
|
+
}
|
|
6773
6993
|
case "builder.contentUpdate": {
|
|
6774
6994
|
const messageContent = data.data;
|
|
6775
6995
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
package/lib/edge/dev.jsx
CHANGED
|
@@ -107,7 +107,7 @@ import { createContext as createContext2 } from "solid-js";
|
|
|
107
107
|
var components_context_default = createContext2({ registeredComponents: {} });
|
|
108
108
|
|
|
109
109
|
// src/components/block/block.tsx
|
|
110
|
-
import { Show as Show4, For as For2, createSignal as createSignal4 } from "solid-js";
|
|
110
|
+
import { Show as Show4, For as For2, onMount, createSignal as createSignal4 } from "solid-js";
|
|
111
111
|
|
|
112
112
|
// src/functions/get-block-component-options.ts
|
|
113
113
|
function getBlockComponentOptions(block) {
|
|
@@ -3565,6 +3565,212 @@ function getProcessedBlock({
|
|
|
3565
3565
|
}
|
|
3566
3566
|
}
|
|
3567
3567
|
|
|
3568
|
+
// src/components/block/animator.ts
|
|
3569
|
+
function throttle(func, wait, options = {}) {
|
|
3570
|
+
let context;
|
|
3571
|
+
let args;
|
|
3572
|
+
let result;
|
|
3573
|
+
let timeout = null;
|
|
3574
|
+
let previous = 0;
|
|
3575
|
+
const later = function() {
|
|
3576
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
3577
|
+
timeout = null;
|
|
3578
|
+
result = func.apply(context, args);
|
|
3579
|
+
if (!timeout)
|
|
3580
|
+
context = args = null;
|
|
3581
|
+
};
|
|
3582
|
+
return function() {
|
|
3583
|
+
const now = Date.now();
|
|
3584
|
+
if (!previous && options.leading === false)
|
|
3585
|
+
previous = now;
|
|
3586
|
+
const remaining = wait - (now - previous);
|
|
3587
|
+
context = this;
|
|
3588
|
+
args = arguments;
|
|
3589
|
+
if (remaining <= 0 || remaining > wait) {
|
|
3590
|
+
if (timeout) {
|
|
3591
|
+
clearTimeout(timeout);
|
|
3592
|
+
timeout = null;
|
|
3593
|
+
}
|
|
3594
|
+
previous = now;
|
|
3595
|
+
result = func.apply(context, args);
|
|
3596
|
+
if (!timeout)
|
|
3597
|
+
context = args = null;
|
|
3598
|
+
} else if (!timeout && options.trailing !== false) {
|
|
3599
|
+
timeout = setTimeout(later, remaining);
|
|
3600
|
+
}
|
|
3601
|
+
return result;
|
|
3602
|
+
};
|
|
3603
|
+
}
|
|
3604
|
+
function assign(target, ..._args) {
|
|
3605
|
+
const to = Object(target);
|
|
3606
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
3607
|
+
const nextSource = arguments[index];
|
|
3608
|
+
if (nextSource != null) {
|
|
3609
|
+
for (const nextKey in nextSource) {
|
|
3610
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
3611
|
+
to[nextKey] = nextSource[nextKey];
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
return to;
|
|
3617
|
+
}
|
|
3618
|
+
var camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : "";
|
|
3619
|
+
function bindAnimations(animations) {
|
|
3620
|
+
for (const animation of animations) {
|
|
3621
|
+
switch (animation.trigger) {
|
|
3622
|
+
case "pageLoad":
|
|
3623
|
+
triggerAnimation(animation);
|
|
3624
|
+
break;
|
|
3625
|
+
case "hover":
|
|
3626
|
+
bindHoverAnimation(animation);
|
|
3627
|
+
break;
|
|
3628
|
+
case "scrollInView":
|
|
3629
|
+
bindScrollInViewAnimation(animation);
|
|
3630
|
+
break;
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
function warnElementNotPresent(id2) {
|
|
3635
|
+
console.warn(`Cannot animate element: element with ID ${id2} not found!`);
|
|
3636
|
+
}
|
|
3637
|
+
function augmentAnimation(animation, element) {
|
|
3638
|
+
const stylesUsed = getAllStylesUsed(animation);
|
|
3639
|
+
const computedStyle = getComputedStyle(element);
|
|
3640
|
+
const firstStyles = animation.steps[0].styles;
|
|
3641
|
+
const lastStyles = animation.steps[animation.steps.length - 1].styles;
|
|
3642
|
+
const bothStyles = [firstStyles, lastStyles];
|
|
3643
|
+
for (const styles of bothStyles) {
|
|
3644
|
+
for (const style of stylesUsed) {
|
|
3645
|
+
if (!(style in styles)) {
|
|
3646
|
+
styles[style] = computedStyle[style];
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
function getAllStylesUsed(animation) {
|
|
3652
|
+
const properties = [];
|
|
3653
|
+
for (const step of animation.steps) {
|
|
3654
|
+
for (const key in step.styles) {
|
|
3655
|
+
if (properties.indexOf(key) === -1) {
|
|
3656
|
+
properties.push(key);
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
return properties;
|
|
3661
|
+
}
|
|
3662
|
+
function triggerAnimation(animation) {
|
|
3663
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3664
|
+
if (!elements.length) {
|
|
3665
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3666
|
+
return;
|
|
3667
|
+
}
|
|
3668
|
+
Array.from(elements).forEach((element) => {
|
|
3669
|
+
augmentAnimation(animation, element);
|
|
3670
|
+
element.style.transition = "none";
|
|
3671
|
+
element.style.transitionDelay = "0";
|
|
3672
|
+
assign(element.style, animation.steps[0].styles);
|
|
3673
|
+
setTimeout(() => {
|
|
3674
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3675
|
+
if (animation.delay) {
|
|
3676
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3677
|
+
}
|
|
3678
|
+
assign(element.style, animation.steps[1].styles);
|
|
3679
|
+
setTimeout(() => {
|
|
3680
|
+
element.style.transition = "";
|
|
3681
|
+
element.style.transitionDelay = "";
|
|
3682
|
+
}, (animation.delay || 0) * 1e3 + animation.duration * 1e3 + 100);
|
|
3683
|
+
});
|
|
3684
|
+
});
|
|
3685
|
+
}
|
|
3686
|
+
function bindHoverAnimation(animation) {
|
|
3687
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3688
|
+
if (!elements.length) {
|
|
3689
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3690
|
+
return;
|
|
3691
|
+
}
|
|
3692
|
+
Array.from(elements).forEach((element) => {
|
|
3693
|
+
augmentAnimation(animation, element);
|
|
3694
|
+
const defaultState = animation.steps[0].styles;
|
|
3695
|
+
const hoverState = animation.steps[1].styles;
|
|
3696
|
+
function attachDefaultState() {
|
|
3697
|
+
assign(element.style, defaultState);
|
|
3698
|
+
}
|
|
3699
|
+
function attachHoverState() {
|
|
3700
|
+
assign(element.style, hoverState);
|
|
3701
|
+
}
|
|
3702
|
+
attachDefaultState();
|
|
3703
|
+
element.addEventListener("mouseenter", attachHoverState);
|
|
3704
|
+
element.addEventListener("mouseleave", attachDefaultState);
|
|
3705
|
+
setTimeout(() => {
|
|
3706
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3707
|
+
if (animation.delay) {
|
|
3708
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3709
|
+
}
|
|
3710
|
+
});
|
|
3711
|
+
});
|
|
3712
|
+
}
|
|
3713
|
+
function bindScrollInViewAnimation(animation) {
|
|
3714
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3715
|
+
if (!elements.length) {
|
|
3716
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3717
|
+
return;
|
|
3718
|
+
}
|
|
3719
|
+
Array.from(elements).forEach((element) => {
|
|
3720
|
+
augmentAnimation(animation, element);
|
|
3721
|
+
let triggered = false;
|
|
3722
|
+
let pendingAnimation = false;
|
|
3723
|
+
function immediateOnScroll() {
|
|
3724
|
+
if (!triggered && isScrolledIntoView(element)) {
|
|
3725
|
+
triggered = true;
|
|
3726
|
+
pendingAnimation = true;
|
|
3727
|
+
setTimeout(() => {
|
|
3728
|
+
assign(element.style, animation.steps[1].styles);
|
|
3729
|
+
if (!animation.repeat) {
|
|
3730
|
+
document.removeEventListener("scroll", onScroll);
|
|
3731
|
+
}
|
|
3732
|
+
setTimeout(() => {
|
|
3733
|
+
pendingAnimation = false;
|
|
3734
|
+
if (!animation.repeat) {
|
|
3735
|
+
element.style.transition = "";
|
|
3736
|
+
element.style.transitionDelay = "";
|
|
3737
|
+
}
|
|
3738
|
+
}, (animation.duration + (animation.delay || 0)) * 1e3 + 100);
|
|
3739
|
+
});
|
|
3740
|
+
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
3741
|
+
triggered = false;
|
|
3742
|
+
assign(element.style, animation.steps[0].styles);
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
const onScroll = throttle(immediateOnScroll, 200, {
|
|
3746
|
+
leading: false
|
|
3747
|
+
});
|
|
3748
|
+
function isScrolledIntoView(elem) {
|
|
3749
|
+
const rect = elem.getBoundingClientRect();
|
|
3750
|
+
const windowHeight = window.innerHeight;
|
|
3751
|
+
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
3752
|
+
const threshold = thresholdPercent * windowHeight;
|
|
3753
|
+
return rect.bottom > threshold && rect.top < windowHeight - threshold;
|
|
3754
|
+
}
|
|
3755
|
+
const defaultState = animation.steps[0].styles;
|
|
3756
|
+
function attachDefaultState() {
|
|
3757
|
+
assign(element.style, defaultState);
|
|
3758
|
+
}
|
|
3759
|
+
attachDefaultState();
|
|
3760
|
+
setTimeout(() => {
|
|
3761
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3762
|
+
if (animation.delay) {
|
|
3763
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3764
|
+
}
|
|
3765
|
+
});
|
|
3766
|
+
document.addEventListener("scroll", onScroll, {
|
|
3767
|
+
capture: true,
|
|
3768
|
+
passive: true
|
|
3769
|
+
});
|
|
3770
|
+
immediateOnScroll();
|
|
3771
|
+
});
|
|
3772
|
+
}
|
|
3773
|
+
|
|
3568
3774
|
// src/components/block/block.helpers.ts
|
|
3569
3775
|
var getComponent = ({
|
|
3570
3776
|
block,
|
|
@@ -4087,6 +4293,18 @@ function Block(props) {
|
|
|
4087
4293
|
isInteractive: !blockComponent()?.isRSC
|
|
4088
4294
|
};
|
|
4089
4295
|
}
|
|
4296
|
+
onMount(() => {
|
|
4297
|
+
const blockId = processedBlock().id;
|
|
4298
|
+
const animations = processedBlock().animations;
|
|
4299
|
+
if (animations && blockId) {
|
|
4300
|
+
bindAnimations(
|
|
4301
|
+
animations.filter((item) => item.trigger !== "hover").map((animation) => ({
|
|
4302
|
+
...animation,
|
|
4303
|
+
elementId: blockId
|
|
4304
|
+
}))
|
|
4305
|
+
);
|
|
4306
|
+
}
|
|
4307
|
+
});
|
|
4090
4308
|
return <Show4 when={canShowBlock()}>
|
|
4091
4309
|
<Block_styles_default block={props.block} context={props.context} />
|
|
4092
4310
|
<Show4
|
|
@@ -4535,10 +4753,10 @@ function SectionComponent(props) {
|
|
|
4535
4753
|
var section_default = SectionComponent;
|
|
4536
4754
|
|
|
4537
4755
|
// src/blocks/symbol/symbol.tsx
|
|
4538
|
-
import { onMount as
|
|
4756
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
4539
4757
|
|
|
4540
4758
|
// src/components/content-variants/content-variants.tsx
|
|
4541
|
-
import { Show as Show11, For as For5, onMount as
|
|
4759
|
+
import { Show as Show11, For as For5, onMount as onMount4, createSignal as createSignal13 } from "solid-js";
|
|
4542
4760
|
|
|
4543
4761
|
// src/helpers/url.ts
|
|
4544
4762
|
var getTopLevelDomain = (host) => {
|
|
@@ -5016,12 +5234,12 @@ var componentInfo3 = {
|
|
|
5016
5234
|
};
|
|
5017
5235
|
|
|
5018
5236
|
// src/blocks/custom-code/custom-code.tsx
|
|
5019
|
-
import { onMount, createSignal as createSignal7 } from "solid-js";
|
|
5237
|
+
import { onMount as onMount2, createSignal as createSignal7 } from "solid-js";
|
|
5020
5238
|
function CustomCode(props) {
|
|
5021
5239
|
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
5022
5240
|
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
5023
5241
|
let elementRef;
|
|
5024
|
-
|
|
5242
|
+
onMount2(() => {
|
|
5025
5243
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
5026
5244
|
return;
|
|
5027
5245
|
}
|
|
@@ -5742,7 +5960,7 @@ function InlinedScript(props) {
|
|
|
5742
5960
|
var Inlined_script_default = InlinedScript;
|
|
5743
5961
|
|
|
5744
5962
|
// src/components/content/components/enable-editor.tsx
|
|
5745
|
-
import { Show as Show9, onMount as
|
|
5963
|
+
import { Show as Show9, onMount as onMount3, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
5746
5964
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
5747
5965
|
|
|
5748
5966
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -6237,7 +6455,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
6237
6455
|
};
|
|
6238
6456
|
|
|
6239
6457
|
// src/constants/sdk-version.ts
|
|
6240
|
-
var SDK_VERSION = "0.12.
|
|
6458
|
+
var SDK_VERSION = "0.12.7";
|
|
6241
6459
|
|
|
6242
6460
|
// src/functions/register.ts
|
|
6243
6461
|
var registry = {};
|
|
@@ -6441,6 +6659,10 @@ function EnableEditor(props) {
|
|
|
6441
6659
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
6442
6660
|
break;
|
|
6443
6661
|
}
|
|
6662
|
+
case "builder.triggerAnimation": {
|
|
6663
|
+
triggerAnimation(data.data);
|
|
6664
|
+
break;
|
|
6665
|
+
}
|
|
6444
6666
|
case "builder.contentUpdate": {
|
|
6445
6667
|
const messageContent = data.data;
|
|
6446
6668
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -6538,7 +6760,7 @@ function EnableEditor(props) {
|
|
|
6538
6760
|
}
|
|
6539
6761
|
}
|
|
6540
6762
|
let elementRef;
|
|
6541
|
-
|
|
6763
|
+
onMount3(() => {
|
|
6542
6764
|
if (isBrowser()) {
|
|
6543
6765
|
if (isEditing() && true) {
|
|
6544
6766
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
@@ -6603,7 +6825,7 @@ function EnableEditor(props) {
|
|
|
6603
6825
|
}
|
|
6604
6826
|
}
|
|
6605
6827
|
});
|
|
6606
|
-
|
|
6828
|
+
onMount3(() => {
|
|
6607
6829
|
if (!props.apiKey) {
|
|
6608
6830
|
logger.error(
|
|
6609
6831
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
@@ -6943,7 +7165,7 @@ function ContentVariants(props) {
|
|
|
6943
7165
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
6944
7166
|
});
|
|
6945
7167
|
}
|
|
6946
|
-
|
|
7168
|
+
onMount4(() => {
|
|
6947
7169
|
setShouldRenderVariants(false);
|
|
6948
7170
|
});
|
|
6949
7171
|
return <>
|
|
@@ -7055,7 +7277,7 @@ function Symbol2(props) {
|
|
|
7055
7277
|
}
|
|
7056
7278
|
});
|
|
7057
7279
|
}
|
|
7058
|
-
|
|
7280
|
+
onMount5(() => {
|
|
7059
7281
|
setContent();
|
|
7060
7282
|
});
|
|
7061
7283
|
function onUpdateFn_0() {
|