@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/index.js
CHANGED
|
@@ -3574,6 +3574,211 @@ function getProcessedBlock({
|
|
|
3574
3574
|
}
|
|
3575
3575
|
}
|
|
3576
3576
|
|
|
3577
|
+
// src/components/block/animator.ts
|
|
3578
|
+
function throttle(func, wait, options = {}) {
|
|
3579
|
+
let context;
|
|
3580
|
+
let args;
|
|
3581
|
+
let result;
|
|
3582
|
+
let timeout = null;
|
|
3583
|
+
let previous = 0;
|
|
3584
|
+
const later = function() {
|
|
3585
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
3586
|
+
timeout = null;
|
|
3587
|
+
result = func.apply(context, args);
|
|
3588
|
+
if (!timeout)
|
|
3589
|
+
context = args = null;
|
|
3590
|
+
};
|
|
3591
|
+
return function() {
|
|
3592
|
+
const now = Date.now();
|
|
3593
|
+
if (!previous && options.leading === false)
|
|
3594
|
+
previous = now;
|
|
3595
|
+
const remaining = wait - (now - previous);
|
|
3596
|
+
context = this;
|
|
3597
|
+
args = arguments;
|
|
3598
|
+
if (remaining <= 0 || remaining > wait) {
|
|
3599
|
+
if (timeout) {
|
|
3600
|
+
clearTimeout(timeout);
|
|
3601
|
+
timeout = null;
|
|
3602
|
+
}
|
|
3603
|
+
previous = now;
|
|
3604
|
+
result = func.apply(context, args);
|
|
3605
|
+
if (!timeout)
|
|
3606
|
+
context = args = null;
|
|
3607
|
+
} else if (!timeout && options.trailing !== false) {
|
|
3608
|
+
timeout = setTimeout(later, remaining);
|
|
3609
|
+
}
|
|
3610
|
+
return result;
|
|
3611
|
+
};
|
|
3612
|
+
}
|
|
3613
|
+
function assign(target, ..._args) {
|
|
3614
|
+
const to = Object(target);
|
|
3615
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
3616
|
+
const nextSource = arguments[index];
|
|
3617
|
+
if (nextSource != null) {
|
|
3618
|
+
for (const nextKey in nextSource) {
|
|
3619
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
3620
|
+
to[nextKey] = nextSource[nextKey];
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
return to;
|
|
3626
|
+
}
|
|
3627
|
+
var camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : "";
|
|
3628
|
+
function bindAnimations(animations) {
|
|
3629
|
+
for (const animation of animations) {
|
|
3630
|
+
switch (animation.trigger) {
|
|
3631
|
+
case "pageLoad":
|
|
3632
|
+
triggerAnimation(animation);
|
|
3633
|
+
break;
|
|
3634
|
+
case "hover":
|
|
3635
|
+
bindHoverAnimation(animation);
|
|
3636
|
+
break;
|
|
3637
|
+
case "scrollInView":
|
|
3638
|
+
bindScrollInViewAnimation(animation);
|
|
3639
|
+
break;
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
function warnElementNotPresent(id2) {
|
|
3644
|
+
}
|
|
3645
|
+
function augmentAnimation(animation, element) {
|
|
3646
|
+
const stylesUsed = getAllStylesUsed(animation);
|
|
3647
|
+
const computedStyle = getComputedStyle(element);
|
|
3648
|
+
const firstStyles = animation.steps[0].styles;
|
|
3649
|
+
const lastStyles = animation.steps[animation.steps.length - 1].styles;
|
|
3650
|
+
const bothStyles = [firstStyles, lastStyles];
|
|
3651
|
+
for (const styles of bothStyles) {
|
|
3652
|
+
for (const style of stylesUsed) {
|
|
3653
|
+
if (!(style in styles)) {
|
|
3654
|
+
styles[style] = computedStyle[style];
|
|
3655
|
+
}
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3659
|
+
function getAllStylesUsed(animation) {
|
|
3660
|
+
const properties = [];
|
|
3661
|
+
for (const step of animation.steps) {
|
|
3662
|
+
for (const key in step.styles) {
|
|
3663
|
+
if (properties.indexOf(key) === -1) {
|
|
3664
|
+
properties.push(key);
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
return properties;
|
|
3669
|
+
}
|
|
3670
|
+
function triggerAnimation(animation) {
|
|
3671
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3672
|
+
if (!elements.length) {
|
|
3673
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3674
|
+
return;
|
|
3675
|
+
}
|
|
3676
|
+
Array.from(elements).forEach((element) => {
|
|
3677
|
+
augmentAnimation(animation, element);
|
|
3678
|
+
element.style.transition = "none";
|
|
3679
|
+
element.style.transitionDelay = "0";
|
|
3680
|
+
assign(element.style, animation.steps[0].styles);
|
|
3681
|
+
setTimeout(() => {
|
|
3682
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3683
|
+
if (animation.delay) {
|
|
3684
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3685
|
+
}
|
|
3686
|
+
assign(element.style, animation.steps[1].styles);
|
|
3687
|
+
setTimeout(() => {
|
|
3688
|
+
element.style.transition = "";
|
|
3689
|
+
element.style.transitionDelay = "";
|
|
3690
|
+
}, (animation.delay || 0) * 1e3 + animation.duration * 1e3 + 100);
|
|
3691
|
+
});
|
|
3692
|
+
});
|
|
3693
|
+
}
|
|
3694
|
+
function bindHoverAnimation(animation) {
|
|
3695
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3696
|
+
if (!elements.length) {
|
|
3697
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3698
|
+
return;
|
|
3699
|
+
}
|
|
3700
|
+
Array.from(elements).forEach((element) => {
|
|
3701
|
+
augmentAnimation(animation, element);
|
|
3702
|
+
const defaultState = animation.steps[0].styles;
|
|
3703
|
+
const hoverState = animation.steps[1].styles;
|
|
3704
|
+
function attachDefaultState() {
|
|
3705
|
+
assign(element.style, defaultState);
|
|
3706
|
+
}
|
|
3707
|
+
function attachHoverState() {
|
|
3708
|
+
assign(element.style, hoverState);
|
|
3709
|
+
}
|
|
3710
|
+
attachDefaultState();
|
|
3711
|
+
element.addEventListener("mouseenter", attachHoverState);
|
|
3712
|
+
element.addEventListener("mouseleave", attachDefaultState);
|
|
3713
|
+
setTimeout(() => {
|
|
3714
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3715
|
+
if (animation.delay) {
|
|
3716
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3717
|
+
}
|
|
3718
|
+
});
|
|
3719
|
+
});
|
|
3720
|
+
}
|
|
3721
|
+
function bindScrollInViewAnimation(animation) {
|
|
3722
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3723
|
+
if (!elements.length) {
|
|
3724
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3725
|
+
return;
|
|
3726
|
+
}
|
|
3727
|
+
Array.from(elements).forEach((element) => {
|
|
3728
|
+
augmentAnimation(animation, element);
|
|
3729
|
+
let triggered = false;
|
|
3730
|
+
let pendingAnimation = false;
|
|
3731
|
+
function immediateOnScroll() {
|
|
3732
|
+
if (!triggered && isScrolledIntoView(element)) {
|
|
3733
|
+
triggered = true;
|
|
3734
|
+
pendingAnimation = true;
|
|
3735
|
+
setTimeout(() => {
|
|
3736
|
+
assign(element.style, animation.steps[1].styles);
|
|
3737
|
+
if (!animation.repeat) {
|
|
3738
|
+
document.removeEventListener("scroll", onScroll);
|
|
3739
|
+
}
|
|
3740
|
+
setTimeout(() => {
|
|
3741
|
+
pendingAnimation = false;
|
|
3742
|
+
if (!animation.repeat) {
|
|
3743
|
+
element.style.transition = "";
|
|
3744
|
+
element.style.transitionDelay = "";
|
|
3745
|
+
}
|
|
3746
|
+
}, (animation.duration + (animation.delay || 0)) * 1e3 + 100);
|
|
3747
|
+
});
|
|
3748
|
+
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
3749
|
+
triggered = false;
|
|
3750
|
+
assign(element.style, animation.steps[0].styles);
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
const onScroll = throttle(immediateOnScroll, 200, {
|
|
3754
|
+
leading: false
|
|
3755
|
+
});
|
|
3756
|
+
function isScrolledIntoView(elem) {
|
|
3757
|
+
const rect = elem.getBoundingClientRect();
|
|
3758
|
+
const windowHeight = window.innerHeight;
|
|
3759
|
+
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
3760
|
+
const threshold = thresholdPercent * windowHeight;
|
|
3761
|
+
return rect.bottom > threshold && rect.top < windowHeight - threshold;
|
|
3762
|
+
}
|
|
3763
|
+
const defaultState = animation.steps[0].styles;
|
|
3764
|
+
function attachDefaultState() {
|
|
3765
|
+
assign(element.style, defaultState);
|
|
3766
|
+
}
|
|
3767
|
+
attachDefaultState();
|
|
3768
|
+
setTimeout(() => {
|
|
3769
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3770
|
+
if (animation.delay) {
|
|
3771
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3772
|
+
}
|
|
3773
|
+
});
|
|
3774
|
+
document.addEventListener("scroll", onScroll, {
|
|
3775
|
+
capture: true,
|
|
3776
|
+
passive: true
|
|
3777
|
+
});
|
|
3778
|
+
immediateOnScroll();
|
|
3779
|
+
});
|
|
3780
|
+
}
|
|
3781
|
+
|
|
3577
3782
|
// src/components/block/block.helpers.ts
|
|
3578
3783
|
var getComponent = ({
|
|
3579
3784
|
block,
|
|
@@ -4146,6 +4351,16 @@ function Block(props) {
|
|
|
4146
4351
|
isInteractive: !blockComponent()?.isRSC
|
|
4147
4352
|
};
|
|
4148
4353
|
}
|
|
4354
|
+
onMount(() => {
|
|
4355
|
+
const blockId = processedBlock().id;
|
|
4356
|
+
const animations = processedBlock().animations;
|
|
4357
|
+
if (animations && blockId) {
|
|
4358
|
+
bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
|
|
4359
|
+
...animation,
|
|
4360
|
+
elementId: blockId
|
|
4361
|
+
})));
|
|
4362
|
+
}
|
|
4363
|
+
});
|
|
4149
4364
|
return createComponent(Show, {
|
|
4150
4365
|
get when() {
|
|
4151
4366
|
return canShowBlock();
|
|
@@ -6549,7 +6764,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
6549
6764
|
};
|
|
6550
6765
|
|
|
6551
6766
|
// src/constants/sdk-version.ts
|
|
6552
|
-
var SDK_VERSION = "0.12.
|
|
6767
|
+
var SDK_VERSION = "0.12.7";
|
|
6553
6768
|
|
|
6554
6769
|
// src/functions/register.ts
|
|
6555
6770
|
var registry = {};
|
|
@@ -6755,6 +6970,10 @@ function EnableEditor(props) {
|
|
|
6755
6970
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
6756
6971
|
break;
|
|
6757
6972
|
}
|
|
6973
|
+
case "builder.triggerAnimation": {
|
|
6974
|
+
triggerAnimation(data.data);
|
|
6975
|
+
break;
|
|
6976
|
+
}
|
|
6758
6977
|
case "builder.contentUpdate": {
|
|
6759
6978
|
const messageContent = data.data;
|
|
6760
6979
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
package/lib/edge/index.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) {
|
|
@@ -3563,6 +3563,211 @@ function getProcessedBlock({
|
|
|
3563
3563
|
}
|
|
3564
3564
|
}
|
|
3565
3565
|
|
|
3566
|
+
// src/components/block/animator.ts
|
|
3567
|
+
function throttle(func, wait, options = {}) {
|
|
3568
|
+
let context;
|
|
3569
|
+
let args;
|
|
3570
|
+
let result;
|
|
3571
|
+
let timeout = null;
|
|
3572
|
+
let previous = 0;
|
|
3573
|
+
const later = function() {
|
|
3574
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
3575
|
+
timeout = null;
|
|
3576
|
+
result = func.apply(context, args);
|
|
3577
|
+
if (!timeout)
|
|
3578
|
+
context = args = null;
|
|
3579
|
+
};
|
|
3580
|
+
return function() {
|
|
3581
|
+
const now = Date.now();
|
|
3582
|
+
if (!previous && options.leading === false)
|
|
3583
|
+
previous = now;
|
|
3584
|
+
const remaining = wait - (now - previous);
|
|
3585
|
+
context = this;
|
|
3586
|
+
args = arguments;
|
|
3587
|
+
if (remaining <= 0 || remaining > wait) {
|
|
3588
|
+
if (timeout) {
|
|
3589
|
+
clearTimeout(timeout);
|
|
3590
|
+
timeout = null;
|
|
3591
|
+
}
|
|
3592
|
+
previous = now;
|
|
3593
|
+
result = func.apply(context, args);
|
|
3594
|
+
if (!timeout)
|
|
3595
|
+
context = args = null;
|
|
3596
|
+
} else if (!timeout && options.trailing !== false) {
|
|
3597
|
+
timeout = setTimeout(later, remaining);
|
|
3598
|
+
}
|
|
3599
|
+
return result;
|
|
3600
|
+
};
|
|
3601
|
+
}
|
|
3602
|
+
function assign(target, ..._args) {
|
|
3603
|
+
const to = Object(target);
|
|
3604
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
3605
|
+
const nextSource = arguments[index];
|
|
3606
|
+
if (nextSource != null) {
|
|
3607
|
+
for (const nextKey in nextSource) {
|
|
3608
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
3609
|
+
to[nextKey] = nextSource[nextKey];
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
return to;
|
|
3615
|
+
}
|
|
3616
|
+
var camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : "";
|
|
3617
|
+
function bindAnimations(animations) {
|
|
3618
|
+
for (const animation of animations) {
|
|
3619
|
+
switch (animation.trigger) {
|
|
3620
|
+
case "pageLoad":
|
|
3621
|
+
triggerAnimation(animation);
|
|
3622
|
+
break;
|
|
3623
|
+
case "hover":
|
|
3624
|
+
bindHoverAnimation(animation);
|
|
3625
|
+
break;
|
|
3626
|
+
case "scrollInView":
|
|
3627
|
+
bindScrollInViewAnimation(animation);
|
|
3628
|
+
break;
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
function warnElementNotPresent(id2) {
|
|
3633
|
+
}
|
|
3634
|
+
function augmentAnimation(animation, element) {
|
|
3635
|
+
const stylesUsed = getAllStylesUsed(animation);
|
|
3636
|
+
const computedStyle = getComputedStyle(element);
|
|
3637
|
+
const firstStyles = animation.steps[0].styles;
|
|
3638
|
+
const lastStyles = animation.steps[animation.steps.length - 1].styles;
|
|
3639
|
+
const bothStyles = [firstStyles, lastStyles];
|
|
3640
|
+
for (const styles of bothStyles) {
|
|
3641
|
+
for (const style of stylesUsed) {
|
|
3642
|
+
if (!(style in styles)) {
|
|
3643
|
+
styles[style] = computedStyle[style];
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
function getAllStylesUsed(animation) {
|
|
3649
|
+
const properties = [];
|
|
3650
|
+
for (const step of animation.steps) {
|
|
3651
|
+
for (const key in step.styles) {
|
|
3652
|
+
if (properties.indexOf(key) === -1) {
|
|
3653
|
+
properties.push(key);
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
}
|
|
3657
|
+
return properties;
|
|
3658
|
+
}
|
|
3659
|
+
function triggerAnimation(animation) {
|
|
3660
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3661
|
+
if (!elements.length) {
|
|
3662
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3663
|
+
return;
|
|
3664
|
+
}
|
|
3665
|
+
Array.from(elements).forEach((element) => {
|
|
3666
|
+
augmentAnimation(animation, element);
|
|
3667
|
+
element.style.transition = "none";
|
|
3668
|
+
element.style.transitionDelay = "0";
|
|
3669
|
+
assign(element.style, animation.steps[0].styles);
|
|
3670
|
+
setTimeout(() => {
|
|
3671
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3672
|
+
if (animation.delay) {
|
|
3673
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3674
|
+
}
|
|
3675
|
+
assign(element.style, animation.steps[1].styles);
|
|
3676
|
+
setTimeout(() => {
|
|
3677
|
+
element.style.transition = "";
|
|
3678
|
+
element.style.transitionDelay = "";
|
|
3679
|
+
}, (animation.delay || 0) * 1e3 + animation.duration * 1e3 + 100);
|
|
3680
|
+
});
|
|
3681
|
+
});
|
|
3682
|
+
}
|
|
3683
|
+
function bindHoverAnimation(animation) {
|
|
3684
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3685
|
+
if (!elements.length) {
|
|
3686
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3687
|
+
return;
|
|
3688
|
+
}
|
|
3689
|
+
Array.from(elements).forEach((element) => {
|
|
3690
|
+
augmentAnimation(animation, element);
|
|
3691
|
+
const defaultState = animation.steps[0].styles;
|
|
3692
|
+
const hoverState = animation.steps[1].styles;
|
|
3693
|
+
function attachDefaultState() {
|
|
3694
|
+
assign(element.style, defaultState);
|
|
3695
|
+
}
|
|
3696
|
+
function attachHoverState() {
|
|
3697
|
+
assign(element.style, hoverState);
|
|
3698
|
+
}
|
|
3699
|
+
attachDefaultState();
|
|
3700
|
+
element.addEventListener("mouseenter", attachHoverState);
|
|
3701
|
+
element.addEventListener("mouseleave", attachDefaultState);
|
|
3702
|
+
setTimeout(() => {
|
|
3703
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3704
|
+
if (animation.delay) {
|
|
3705
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3706
|
+
}
|
|
3707
|
+
});
|
|
3708
|
+
});
|
|
3709
|
+
}
|
|
3710
|
+
function bindScrollInViewAnimation(animation) {
|
|
3711
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3712
|
+
if (!elements.length) {
|
|
3713
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3714
|
+
return;
|
|
3715
|
+
}
|
|
3716
|
+
Array.from(elements).forEach((element) => {
|
|
3717
|
+
augmentAnimation(animation, element);
|
|
3718
|
+
let triggered = false;
|
|
3719
|
+
let pendingAnimation = false;
|
|
3720
|
+
function immediateOnScroll() {
|
|
3721
|
+
if (!triggered && isScrolledIntoView(element)) {
|
|
3722
|
+
triggered = true;
|
|
3723
|
+
pendingAnimation = true;
|
|
3724
|
+
setTimeout(() => {
|
|
3725
|
+
assign(element.style, animation.steps[1].styles);
|
|
3726
|
+
if (!animation.repeat) {
|
|
3727
|
+
document.removeEventListener("scroll", onScroll);
|
|
3728
|
+
}
|
|
3729
|
+
setTimeout(() => {
|
|
3730
|
+
pendingAnimation = false;
|
|
3731
|
+
if (!animation.repeat) {
|
|
3732
|
+
element.style.transition = "";
|
|
3733
|
+
element.style.transitionDelay = "";
|
|
3734
|
+
}
|
|
3735
|
+
}, (animation.duration + (animation.delay || 0)) * 1e3 + 100);
|
|
3736
|
+
});
|
|
3737
|
+
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
3738
|
+
triggered = false;
|
|
3739
|
+
assign(element.style, animation.steps[0].styles);
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
const onScroll = throttle(immediateOnScroll, 200, {
|
|
3743
|
+
leading: false
|
|
3744
|
+
});
|
|
3745
|
+
function isScrolledIntoView(elem) {
|
|
3746
|
+
const rect = elem.getBoundingClientRect();
|
|
3747
|
+
const windowHeight = window.innerHeight;
|
|
3748
|
+
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
3749
|
+
const threshold = thresholdPercent * windowHeight;
|
|
3750
|
+
return rect.bottom > threshold && rect.top < windowHeight - threshold;
|
|
3751
|
+
}
|
|
3752
|
+
const defaultState = animation.steps[0].styles;
|
|
3753
|
+
function attachDefaultState() {
|
|
3754
|
+
assign(element.style, defaultState);
|
|
3755
|
+
}
|
|
3756
|
+
attachDefaultState();
|
|
3757
|
+
setTimeout(() => {
|
|
3758
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3759
|
+
if (animation.delay) {
|
|
3760
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3761
|
+
}
|
|
3762
|
+
});
|
|
3763
|
+
document.addEventListener("scroll", onScroll, {
|
|
3764
|
+
capture: true,
|
|
3765
|
+
passive: true
|
|
3766
|
+
});
|
|
3767
|
+
immediateOnScroll();
|
|
3768
|
+
});
|
|
3769
|
+
}
|
|
3770
|
+
|
|
3566
3771
|
// src/components/block/block.helpers.ts
|
|
3567
3772
|
var getComponent = ({
|
|
3568
3773
|
block,
|
|
@@ -4082,6 +4287,18 @@ function Block(props) {
|
|
|
4082
4287
|
isInteractive: !blockComponent()?.isRSC
|
|
4083
4288
|
};
|
|
4084
4289
|
}
|
|
4290
|
+
onMount(() => {
|
|
4291
|
+
const blockId = processedBlock().id;
|
|
4292
|
+
const animations = processedBlock().animations;
|
|
4293
|
+
if (animations && blockId) {
|
|
4294
|
+
bindAnimations(
|
|
4295
|
+
animations.filter((item) => item.trigger !== "hover").map((animation) => ({
|
|
4296
|
+
...animation,
|
|
4297
|
+
elementId: blockId
|
|
4298
|
+
}))
|
|
4299
|
+
);
|
|
4300
|
+
}
|
|
4301
|
+
});
|
|
4085
4302
|
return <Show4 when={canShowBlock()}>
|
|
4086
4303
|
<Block_styles_default block={props.block} context={props.context} />
|
|
4087
4304
|
<Show4
|
|
@@ -4529,10 +4746,10 @@ function SectionComponent(props) {
|
|
|
4529
4746
|
var section_default = SectionComponent;
|
|
4530
4747
|
|
|
4531
4748
|
// src/blocks/symbol/symbol.tsx
|
|
4532
|
-
import { onMount as
|
|
4749
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
4533
4750
|
|
|
4534
4751
|
// src/components/content-variants/content-variants.tsx
|
|
4535
|
-
import { Show as Show11, For as For5, onMount as
|
|
4752
|
+
import { Show as Show11, For as For5, onMount as onMount4, createSignal as createSignal13 } from "solid-js";
|
|
4536
4753
|
|
|
4537
4754
|
// src/helpers/url.ts
|
|
4538
4755
|
var getTopLevelDomain = (host) => {
|
|
@@ -5010,12 +5227,12 @@ var componentInfo3 = {
|
|
|
5010
5227
|
};
|
|
5011
5228
|
|
|
5012
5229
|
// src/blocks/custom-code/custom-code.tsx
|
|
5013
|
-
import { onMount, createSignal as createSignal7 } from "solid-js";
|
|
5230
|
+
import { onMount as onMount2, createSignal as createSignal7 } from "solid-js";
|
|
5014
5231
|
function CustomCode(props) {
|
|
5015
5232
|
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
5016
5233
|
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
5017
5234
|
let elementRef;
|
|
5018
|
-
|
|
5235
|
+
onMount2(() => {
|
|
5019
5236
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
5020
5237
|
return;
|
|
5021
5238
|
}
|
|
@@ -5733,7 +5950,7 @@ function InlinedScript(props) {
|
|
|
5733
5950
|
var Inlined_script_default = InlinedScript;
|
|
5734
5951
|
|
|
5735
5952
|
// src/components/content/components/enable-editor.tsx
|
|
5736
|
-
import { Show as Show9, onMount as
|
|
5953
|
+
import { Show as Show9, onMount as onMount3, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
5737
5954
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
5738
5955
|
|
|
5739
5956
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -6223,7 +6440,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
6223
6440
|
};
|
|
6224
6441
|
|
|
6225
6442
|
// src/constants/sdk-version.ts
|
|
6226
|
-
var SDK_VERSION = "0.12.
|
|
6443
|
+
var SDK_VERSION = "0.12.7";
|
|
6227
6444
|
|
|
6228
6445
|
// src/functions/register.ts
|
|
6229
6446
|
var registry = {};
|
|
@@ -6426,6 +6643,10 @@ function EnableEditor(props) {
|
|
|
6426
6643
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
6427
6644
|
break;
|
|
6428
6645
|
}
|
|
6646
|
+
case "builder.triggerAnimation": {
|
|
6647
|
+
triggerAnimation(data.data);
|
|
6648
|
+
break;
|
|
6649
|
+
}
|
|
6429
6650
|
case "builder.contentUpdate": {
|
|
6430
6651
|
const messageContent = data.data;
|
|
6431
6652
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -6522,7 +6743,7 @@ function EnableEditor(props) {
|
|
|
6522
6743
|
}
|
|
6523
6744
|
}
|
|
6524
6745
|
let elementRef;
|
|
6525
|
-
|
|
6746
|
+
onMount3(() => {
|
|
6526
6747
|
if (isBrowser()) {
|
|
6527
6748
|
if (isEditing() && true) {
|
|
6528
6749
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
@@ -6587,7 +6808,7 @@ function EnableEditor(props) {
|
|
|
6587
6808
|
}
|
|
6588
6809
|
}
|
|
6589
6810
|
});
|
|
6590
|
-
|
|
6811
|
+
onMount3(() => {
|
|
6591
6812
|
if (!props.apiKey) {
|
|
6592
6813
|
logger.error(
|
|
6593
6814
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
@@ -6927,7 +7148,7 @@ function ContentVariants(props) {
|
|
|
6927
7148
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
6928
7149
|
});
|
|
6929
7150
|
}
|
|
6930
|
-
|
|
7151
|
+
onMount4(() => {
|
|
6931
7152
|
setShouldRenderVariants(false);
|
|
6932
7153
|
});
|
|
6933
7154
|
return <>
|
|
@@ -7039,7 +7260,7 @@ function Symbol2(props) {
|
|
|
7039
7260
|
}
|
|
7040
7261
|
});
|
|
7041
7262
|
}
|
|
7042
|
-
|
|
7263
|
+
onMount5(() => {
|
|
7043
7264
|
setContent();
|
|
7044
7265
|
});
|
|
7045
7266
|
function onUpdateFn_0() {
|