@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/node/dev.js
CHANGED
|
@@ -547,6 +547,212 @@ function getProcessedBlock({
|
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
+
// src/components/block/animator.ts
|
|
551
|
+
function throttle(func, wait, options = {}) {
|
|
552
|
+
let context;
|
|
553
|
+
let args;
|
|
554
|
+
let result;
|
|
555
|
+
let timeout = null;
|
|
556
|
+
let previous = 0;
|
|
557
|
+
const later = function() {
|
|
558
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
559
|
+
timeout = null;
|
|
560
|
+
result = func.apply(context, args);
|
|
561
|
+
if (!timeout)
|
|
562
|
+
context = args = null;
|
|
563
|
+
};
|
|
564
|
+
return function() {
|
|
565
|
+
const now = Date.now();
|
|
566
|
+
if (!previous && options.leading === false)
|
|
567
|
+
previous = now;
|
|
568
|
+
const remaining = wait - (now - previous);
|
|
569
|
+
context = this;
|
|
570
|
+
args = arguments;
|
|
571
|
+
if (remaining <= 0 || remaining > wait) {
|
|
572
|
+
if (timeout) {
|
|
573
|
+
clearTimeout(timeout);
|
|
574
|
+
timeout = null;
|
|
575
|
+
}
|
|
576
|
+
previous = now;
|
|
577
|
+
result = func.apply(context, args);
|
|
578
|
+
if (!timeout)
|
|
579
|
+
context = args = null;
|
|
580
|
+
} else if (!timeout && options.trailing !== false) {
|
|
581
|
+
timeout = setTimeout(later, remaining);
|
|
582
|
+
}
|
|
583
|
+
return result;
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
function assign(target, ..._args) {
|
|
587
|
+
const to = Object(target);
|
|
588
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
589
|
+
const nextSource = arguments[index];
|
|
590
|
+
if (nextSource != null) {
|
|
591
|
+
for (const nextKey in nextSource) {
|
|
592
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
593
|
+
to[nextKey] = nextSource[nextKey];
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return to;
|
|
599
|
+
}
|
|
600
|
+
var camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : "";
|
|
601
|
+
function bindAnimations(animations) {
|
|
602
|
+
for (const animation of animations) {
|
|
603
|
+
switch (animation.trigger) {
|
|
604
|
+
case "pageLoad":
|
|
605
|
+
triggerAnimation(animation);
|
|
606
|
+
break;
|
|
607
|
+
case "hover":
|
|
608
|
+
bindHoverAnimation(animation);
|
|
609
|
+
break;
|
|
610
|
+
case "scrollInView":
|
|
611
|
+
bindScrollInViewAnimation(animation);
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
function warnElementNotPresent(id) {
|
|
617
|
+
console.warn(`Cannot animate element: element with ID ${id} not found!`);
|
|
618
|
+
}
|
|
619
|
+
function augmentAnimation(animation, element) {
|
|
620
|
+
const stylesUsed = getAllStylesUsed(animation);
|
|
621
|
+
const computedStyle = getComputedStyle(element);
|
|
622
|
+
const firstStyles = animation.steps[0].styles;
|
|
623
|
+
const lastStyles = animation.steps[animation.steps.length - 1].styles;
|
|
624
|
+
const bothStyles = [firstStyles, lastStyles];
|
|
625
|
+
for (const styles of bothStyles) {
|
|
626
|
+
for (const style of stylesUsed) {
|
|
627
|
+
if (!(style in styles)) {
|
|
628
|
+
styles[style] = computedStyle[style];
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
function getAllStylesUsed(animation) {
|
|
634
|
+
const properties = [];
|
|
635
|
+
for (const step of animation.steps) {
|
|
636
|
+
for (const key in step.styles) {
|
|
637
|
+
if (properties.indexOf(key) === -1) {
|
|
638
|
+
properties.push(key);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return properties;
|
|
643
|
+
}
|
|
644
|
+
function triggerAnimation(animation) {
|
|
645
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
646
|
+
if (!elements.length) {
|
|
647
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
Array.from(elements).forEach((element) => {
|
|
651
|
+
augmentAnimation(animation, element);
|
|
652
|
+
element.style.transition = "none";
|
|
653
|
+
element.style.transitionDelay = "0";
|
|
654
|
+
assign(element.style, animation.steps[0].styles);
|
|
655
|
+
setTimeout(() => {
|
|
656
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
657
|
+
if (animation.delay) {
|
|
658
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
659
|
+
}
|
|
660
|
+
assign(element.style, animation.steps[1].styles);
|
|
661
|
+
setTimeout(() => {
|
|
662
|
+
element.style.transition = "";
|
|
663
|
+
element.style.transitionDelay = "";
|
|
664
|
+
}, (animation.delay || 0) * 1e3 + animation.duration * 1e3 + 100);
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
function bindHoverAnimation(animation) {
|
|
669
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
670
|
+
if (!elements.length) {
|
|
671
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
Array.from(elements).forEach((element) => {
|
|
675
|
+
augmentAnimation(animation, element);
|
|
676
|
+
const defaultState = animation.steps[0].styles;
|
|
677
|
+
const hoverState = animation.steps[1].styles;
|
|
678
|
+
function attachDefaultState() {
|
|
679
|
+
assign(element.style, defaultState);
|
|
680
|
+
}
|
|
681
|
+
function attachHoverState() {
|
|
682
|
+
assign(element.style, hoverState);
|
|
683
|
+
}
|
|
684
|
+
attachDefaultState();
|
|
685
|
+
element.addEventListener("mouseenter", attachHoverState);
|
|
686
|
+
element.addEventListener("mouseleave", attachDefaultState);
|
|
687
|
+
setTimeout(() => {
|
|
688
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
689
|
+
if (animation.delay) {
|
|
690
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
function bindScrollInViewAnimation(animation) {
|
|
696
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
697
|
+
if (!elements.length) {
|
|
698
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
Array.from(elements).forEach((element) => {
|
|
702
|
+
augmentAnimation(animation, element);
|
|
703
|
+
let triggered = false;
|
|
704
|
+
let pendingAnimation = false;
|
|
705
|
+
function immediateOnScroll() {
|
|
706
|
+
if (!triggered && isScrolledIntoView(element)) {
|
|
707
|
+
triggered = true;
|
|
708
|
+
pendingAnimation = true;
|
|
709
|
+
setTimeout(() => {
|
|
710
|
+
assign(element.style, animation.steps[1].styles);
|
|
711
|
+
if (!animation.repeat) {
|
|
712
|
+
document.removeEventListener("scroll", onScroll);
|
|
713
|
+
}
|
|
714
|
+
setTimeout(() => {
|
|
715
|
+
pendingAnimation = false;
|
|
716
|
+
if (!animation.repeat) {
|
|
717
|
+
element.style.transition = "";
|
|
718
|
+
element.style.transitionDelay = "";
|
|
719
|
+
}
|
|
720
|
+
}, (animation.duration + (animation.delay || 0)) * 1e3 + 100);
|
|
721
|
+
});
|
|
722
|
+
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
723
|
+
triggered = false;
|
|
724
|
+
assign(element.style, animation.steps[0].styles);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
const onScroll = throttle(immediateOnScroll, 200, {
|
|
728
|
+
leading: false
|
|
729
|
+
});
|
|
730
|
+
function isScrolledIntoView(elem) {
|
|
731
|
+
const rect = elem.getBoundingClientRect();
|
|
732
|
+
const windowHeight = window.innerHeight;
|
|
733
|
+
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
734
|
+
const threshold = thresholdPercent * windowHeight;
|
|
735
|
+
return rect.bottom > threshold && rect.top < windowHeight - threshold;
|
|
736
|
+
}
|
|
737
|
+
const defaultState = animation.steps[0].styles;
|
|
738
|
+
function attachDefaultState() {
|
|
739
|
+
assign(element.style, defaultState);
|
|
740
|
+
}
|
|
741
|
+
attachDefaultState();
|
|
742
|
+
setTimeout(() => {
|
|
743
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
744
|
+
if (animation.delay) {
|
|
745
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
document.addEventListener("scroll", onScroll, {
|
|
749
|
+
capture: true,
|
|
750
|
+
passive: true
|
|
751
|
+
});
|
|
752
|
+
immediateOnScroll();
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
|
|
550
756
|
// src/components/block/block.helpers.ts
|
|
551
757
|
var getComponent = ({
|
|
552
758
|
block,
|
|
@@ -1122,6 +1328,16 @@ function Block(props) {
|
|
|
1122
1328
|
isInteractive: !blockComponent()?.isRSC
|
|
1123
1329
|
};
|
|
1124
1330
|
}
|
|
1331
|
+
onMount(() => {
|
|
1332
|
+
const blockId = processedBlock().id;
|
|
1333
|
+
const animations = processedBlock().animations;
|
|
1334
|
+
if (animations && blockId) {
|
|
1335
|
+
bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
|
|
1336
|
+
...animation,
|
|
1337
|
+
elementId: blockId
|
|
1338
|
+
})));
|
|
1339
|
+
}
|
|
1340
|
+
});
|
|
1125
1341
|
return createComponent(Show, {
|
|
1126
1342
|
get when() {
|
|
1127
1343
|
return canShowBlock();
|
|
@@ -3534,7 +3750,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3534
3750
|
};
|
|
3535
3751
|
|
|
3536
3752
|
// src/constants/sdk-version.ts
|
|
3537
|
-
var SDK_VERSION = "0.12.
|
|
3753
|
+
var SDK_VERSION = "0.12.7";
|
|
3538
3754
|
|
|
3539
3755
|
// src/functions/register.ts
|
|
3540
3756
|
var registry = {};
|
|
@@ -3741,6 +3957,10 @@ function EnableEditor(props) {
|
|
|
3741
3957
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
3742
3958
|
break;
|
|
3743
3959
|
}
|
|
3960
|
+
case "builder.triggerAnimation": {
|
|
3961
|
+
triggerAnimation(data.data);
|
|
3962
|
+
break;
|
|
3963
|
+
}
|
|
3744
3964
|
case "builder.contentUpdate": {
|
|
3745
3965
|
const messageContent = data.data;
|
|
3746
3966
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
package/lib/node/dev.jsx
CHANGED
|
@@ -99,7 +99,7 @@ import { createContext as createContext2 } from "solid-js";
|
|
|
99
99
|
var components_context_default = createContext2({ registeredComponents: {} });
|
|
100
100
|
|
|
101
101
|
// src/components/block/block.tsx
|
|
102
|
-
import { Show as Show4, For as For2, createSignal as createSignal4 } from "solid-js";
|
|
102
|
+
import { Show as Show4, For as For2, onMount, createSignal as createSignal4 } from "solid-js";
|
|
103
103
|
|
|
104
104
|
// src/functions/get-block-component-options.ts
|
|
105
105
|
function getBlockComponentOptions(block) {
|
|
@@ -536,6 +536,212 @@ function getProcessedBlock({
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
+
// src/components/block/animator.ts
|
|
540
|
+
function throttle(func, wait, options = {}) {
|
|
541
|
+
let context;
|
|
542
|
+
let args;
|
|
543
|
+
let result;
|
|
544
|
+
let timeout = null;
|
|
545
|
+
let previous = 0;
|
|
546
|
+
const later = function() {
|
|
547
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
548
|
+
timeout = null;
|
|
549
|
+
result = func.apply(context, args);
|
|
550
|
+
if (!timeout)
|
|
551
|
+
context = args = null;
|
|
552
|
+
};
|
|
553
|
+
return function() {
|
|
554
|
+
const now = Date.now();
|
|
555
|
+
if (!previous && options.leading === false)
|
|
556
|
+
previous = now;
|
|
557
|
+
const remaining = wait - (now - previous);
|
|
558
|
+
context = this;
|
|
559
|
+
args = arguments;
|
|
560
|
+
if (remaining <= 0 || remaining > wait) {
|
|
561
|
+
if (timeout) {
|
|
562
|
+
clearTimeout(timeout);
|
|
563
|
+
timeout = null;
|
|
564
|
+
}
|
|
565
|
+
previous = now;
|
|
566
|
+
result = func.apply(context, args);
|
|
567
|
+
if (!timeout)
|
|
568
|
+
context = args = null;
|
|
569
|
+
} else if (!timeout && options.trailing !== false) {
|
|
570
|
+
timeout = setTimeout(later, remaining);
|
|
571
|
+
}
|
|
572
|
+
return result;
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
function assign(target, ..._args) {
|
|
576
|
+
const to = Object(target);
|
|
577
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
578
|
+
const nextSource = arguments[index];
|
|
579
|
+
if (nextSource != null) {
|
|
580
|
+
for (const nextKey in nextSource) {
|
|
581
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
582
|
+
to[nextKey] = nextSource[nextKey];
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return to;
|
|
588
|
+
}
|
|
589
|
+
var camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : "";
|
|
590
|
+
function bindAnimations(animations) {
|
|
591
|
+
for (const animation of animations) {
|
|
592
|
+
switch (animation.trigger) {
|
|
593
|
+
case "pageLoad":
|
|
594
|
+
triggerAnimation(animation);
|
|
595
|
+
break;
|
|
596
|
+
case "hover":
|
|
597
|
+
bindHoverAnimation(animation);
|
|
598
|
+
break;
|
|
599
|
+
case "scrollInView":
|
|
600
|
+
bindScrollInViewAnimation(animation);
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
function warnElementNotPresent(id) {
|
|
606
|
+
console.warn(`Cannot animate element: element with ID ${id} not found!`);
|
|
607
|
+
}
|
|
608
|
+
function augmentAnimation(animation, element) {
|
|
609
|
+
const stylesUsed = getAllStylesUsed(animation);
|
|
610
|
+
const computedStyle = getComputedStyle(element);
|
|
611
|
+
const firstStyles = animation.steps[0].styles;
|
|
612
|
+
const lastStyles = animation.steps[animation.steps.length - 1].styles;
|
|
613
|
+
const bothStyles = [firstStyles, lastStyles];
|
|
614
|
+
for (const styles of bothStyles) {
|
|
615
|
+
for (const style of stylesUsed) {
|
|
616
|
+
if (!(style in styles)) {
|
|
617
|
+
styles[style] = computedStyle[style];
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
function getAllStylesUsed(animation) {
|
|
623
|
+
const properties = [];
|
|
624
|
+
for (const step of animation.steps) {
|
|
625
|
+
for (const key in step.styles) {
|
|
626
|
+
if (properties.indexOf(key) === -1) {
|
|
627
|
+
properties.push(key);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return properties;
|
|
632
|
+
}
|
|
633
|
+
function triggerAnimation(animation) {
|
|
634
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
635
|
+
if (!elements.length) {
|
|
636
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
Array.from(elements).forEach((element) => {
|
|
640
|
+
augmentAnimation(animation, element);
|
|
641
|
+
element.style.transition = "none";
|
|
642
|
+
element.style.transitionDelay = "0";
|
|
643
|
+
assign(element.style, animation.steps[0].styles);
|
|
644
|
+
setTimeout(() => {
|
|
645
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
646
|
+
if (animation.delay) {
|
|
647
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
648
|
+
}
|
|
649
|
+
assign(element.style, animation.steps[1].styles);
|
|
650
|
+
setTimeout(() => {
|
|
651
|
+
element.style.transition = "";
|
|
652
|
+
element.style.transitionDelay = "";
|
|
653
|
+
}, (animation.delay || 0) * 1e3 + animation.duration * 1e3 + 100);
|
|
654
|
+
});
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
function bindHoverAnimation(animation) {
|
|
658
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
659
|
+
if (!elements.length) {
|
|
660
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
Array.from(elements).forEach((element) => {
|
|
664
|
+
augmentAnimation(animation, element);
|
|
665
|
+
const defaultState = animation.steps[0].styles;
|
|
666
|
+
const hoverState = animation.steps[1].styles;
|
|
667
|
+
function attachDefaultState() {
|
|
668
|
+
assign(element.style, defaultState);
|
|
669
|
+
}
|
|
670
|
+
function attachHoverState() {
|
|
671
|
+
assign(element.style, hoverState);
|
|
672
|
+
}
|
|
673
|
+
attachDefaultState();
|
|
674
|
+
element.addEventListener("mouseenter", attachHoverState);
|
|
675
|
+
element.addEventListener("mouseleave", attachDefaultState);
|
|
676
|
+
setTimeout(() => {
|
|
677
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
678
|
+
if (animation.delay) {
|
|
679
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
function bindScrollInViewAnimation(animation) {
|
|
685
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
686
|
+
if (!elements.length) {
|
|
687
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
Array.from(elements).forEach((element) => {
|
|
691
|
+
augmentAnimation(animation, element);
|
|
692
|
+
let triggered = false;
|
|
693
|
+
let pendingAnimation = false;
|
|
694
|
+
function immediateOnScroll() {
|
|
695
|
+
if (!triggered && isScrolledIntoView(element)) {
|
|
696
|
+
triggered = true;
|
|
697
|
+
pendingAnimation = true;
|
|
698
|
+
setTimeout(() => {
|
|
699
|
+
assign(element.style, animation.steps[1].styles);
|
|
700
|
+
if (!animation.repeat) {
|
|
701
|
+
document.removeEventListener("scroll", onScroll);
|
|
702
|
+
}
|
|
703
|
+
setTimeout(() => {
|
|
704
|
+
pendingAnimation = false;
|
|
705
|
+
if (!animation.repeat) {
|
|
706
|
+
element.style.transition = "";
|
|
707
|
+
element.style.transitionDelay = "";
|
|
708
|
+
}
|
|
709
|
+
}, (animation.duration + (animation.delay || 0)) * 1e3 + 100);
|
|
710
|
+
});
|
|
711
|
+
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
712
|
+
triggered = false;
|
|
713
|
+
assign(element.style, animation.steps[0].styles);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
const onScroll = throttle(immediateOnScroll, 200, {
|
|
717
|
+
leading: false
|
|
718
|
+
});
|
|
719
|
+
function isScrolledIntoView(elem) {
|
|
720
|
+
const rect = elem.getBoundingClientRect();
|
|
721
|
+
const windowHeight = window.innerHeight;
|
|
722
|
+
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
723
|
+
const threshold = thresholdPercent * windowHeight;
|
|
724
|
+
return rect.bottom > threshold && rect.top < windowHeight - threshold;
|
|
725
|
+
}
|
|
726
|
+
const defaultState = animation.steps[0].styles;
|
|
727
|
+
function attachDefaultState() {
|
|
728
|
+
assign(element.style, defaultState);
|
|
729
|
+
}
|
|
730
|
+
attachDefaultState();
|
|
731
|
+
setTimeout(() => {
|
|
732
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
733
|
+
if (animation.delay) {
|
|
734
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
document.addEventListener("scroll", onScroll, {
|
|
738
|
+
capture: true,
|
|
739
|
+
passive: true
|
|
740
|
+
});
|
|
741
|
+
immediateOnScroll();
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
|
|
539
745
|
// src/components/block/block.helpers.ts
|
|
540
746
|
var getComponent = ({
|
|
541
747
|
block,
|
|
@@ -1058,6 +1264,18 @@ function Block(props) {
|
|
|
1058
1264
|
isInteractive: !blockComponent()?.isRSC
|
|
1059
1265
|
};
|
|
1060
1266
|
}
|
|
1267
|
+
onMount(() => {
|
|
1268
|
+
const blockId = processedBlock().id;
|
|
1269
|
+
const animations = processedBlock().animations;
|
|
1270
|
+
if (animations && blockId) {
|
|
1271
|
+
bindAnimations(
|
|
1272
|
+
animations.filter((item) => item.trigger !== "hover").map((animation) => ({
|
|
1273
|
+
...animation,
|
|
1274
|
+
elementId: blockId
|
|
1275
|
+
}))
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
});
|
|
1061
1279
|
return <Show4 when={canShowBlock()}>
|
|
1062
1280
|
<Block_styles_default block={props.block} context={props.context} />
|
|
1063
1281
|
<Show4
|
|
@@ -1506,10 +1724,10 @@ function SectionComponent(props) {
|
|
|
1506
1724
|
var section_default = SectionComponent;
|
|
1507
1725
|
|
|
1508
1726
|
// src/blocks/symbol/symbol.tsx
|
|
1509
|
-
import { onMount as
|
|
1727
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
1510
1728
|
|
|
1511
1729
|
// src/components/content-variants/content-variants.tsx
|
|
1512
|
-
import { Show as Show11, For as For5, onMount as
|
|
1730
|
+
import { Show as Show11, For as For5, onMount as onMount4, createSignal as createSignal13 } from "solid-js";
|
|
1513
1731
|
|
|
1514
1732
|
// src/helpers/url.ts
|
|
1515
1733
|
var getTopLevelDomain = (host) => {
|
|
@@ -1987,12 +2205,12 @@ var componentInfo3 = {
|
|
|
1987
2205
|
};
|
|
1988
2206
|
|
|
1989
2207
|
// src/blocks/custom-code/custom-code.tsx
|
|
1990
|
-
import { onMount, createSignal as createSignal7 } from "solid-js";
|
|
2208
|
+
import { onMount as onMount2, createSignal as createSignal7 } from "solid-js";
|
|
1991
2209
|
function CustomCode(props) {
|
|
1992
2210
|
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
1993
2211
|
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
1994
2212
|
let elementRef;
|
|
1995
|
-
|
|
2213
|
+
onMount2(() => {
|
|
1996
2214
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
1997
2215
|
return;
|
|
1998
2216
|
}
|
|
@@ -2713,7 +2931,7 @@ function InlinedScript(props) {
|
|
|
2713
2931
|
var Inlined_script_default = InlinedScript;
|
|
2714
2932
|
|
|
2715
2933
|
// src/components/content/components/enable-editor.tsx
|
|
2716
|
-
import { Show as Show9, onMount as
|
|
2934
|
+
import { Show as Show9, onMount as onMount3, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
2717
2935
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
2718
2936
|
|
|
2719
2937
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -3208,7 +3426,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3208
3426
|
};
|
|
3209
3427
|
|
|
3210
3428
|
// src/constants/sdk-version.ts
|
|
3211
|
-
var SDK_VERSION = "0.12.
|
|
3429
|
+
var SDK_VERSION = "0.12.7";
|
|
3212
3430
|
|
|
3213
3431
|
// src/functions/register.ts
|
|
3214
3432
|
var registry = {};
|
|
@@ -3412,6 +3630,10 @@ function EnableEditor(props) {
|
|
|
3412
3630
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
3413
3631
|
break;
|
|
3414
3632
|
}
|
|
3633
|
+
case "builder.triggerAnimation": {
|
|
3634
|
+
triggerAnimation(data.data);
|
|
3635
|
+
break;
|
|
3636
|
+
}
|
|
3415
3637
|
case "builder.contentUpdate": {
|
|
3416
3638
|
const messageContent = data.data;
|
|
3417
3639
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -3509,7 +3731,7 @@ function EnableEditor(props) {
|
|
|
3509
3731
|
}
|
|
3510
3732
|
}
|
|
3511
3733
|
let elementRef;
|
|
3512
|
-
|
|
3734
|
+
onMount3(() => {
|
|
3513
3735
|
if (isBrowser()) {
|
|
3514
3736
|
if (isEditing() && true) {
|
|
3515
3737
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
@@ -3574,7 +3796,7 @@ function EnableEditor(props) {
|
|
|
3574
3796
|
}
|
|
3575
3797
|
}
|
|
3576
3798
|
});
|
|
3577
|
-
|
|
3799
|
+
onMount3(() => {
|
|
3578
3800
|
if (!props.apiKey) {
|
|
3579
3801
|
logger.error(
|
|
3580
3802
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
@@ -3914,7 +4136,7 @@ function ContentVariants(props) {
|
|
|
3914
4136
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
3915
4137
|
});
|
|
3916
4138
|
}
|
|
3917
|
-
|
|
4139
|
+
onMount4(() => {
|
|
3918
4140
|
setShouldRenderVariants(false);
|
|
3919
4141
|
});
|
|
3920
4142
|
return <>
|
|
@@ -4026,7 +4248,7 @@ function Symbol(props) {
|
|
|
4026
4248
|
}
|
|
4027
4249
|
});
|
|
4028
4250
|
}
|
|
4029
|
-
|
|
4251
|
+
onMount5(() => {
|
|
4030
4252
|
setContent();
|
|
4031
4253
|
});
|
|
4032
4254
|
function onUpdateFn_0() {
|