@builder.io/sdk-qwik 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/lib/browser/index.qwik.cjs +211 -1
- package/lib/browser/index.qwik.mjs +212 -2
- package/lib/edge/index.qwik.cjs +211 -1
- package/lib/edge/index.qwik.mjs +212 -2
- package/lib/node/index.qwik.cjs +211 -1
- package/lib/node/index.qwik.mjs +212 -2
- package/package.json +1 -1
- package/types/src/components/block/animator.d.ts +5 -0
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/types/builder-block.d.ts +18 -1
package/lib/edge/index.qwik.cjs
CHANGED
|
@@ -3544,6 +3544,201 @@ function getProcessedBlock({ block, context, shouldEvaluateBindings, localState,
|
|
|
3544
3544
|
else
|
|
3545
3545
|
return transformedBlock;
|
|
3546
3546
|
}
|
|
3547
|
+
function throttle(func, wait, options = {}) {
|
|
3548
|
+
let context;
|
|
3549
|
+
let args;
|
|
3550
|
+
let result;
|
|
3551
|
+
let timeout = null;
|
|
3552
|
+
let previous = 0;
|
|
3553
|
+
const later = function() {
|
|
3554
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
3555
|
+
timeout = null;
|
|
3556
|
+
result = func.apply(context, args);
|
|
3557
|
+
if (!timeout)
|
|
3558
|
+
context = args = null;
|
|
3559
|
+
};
|
|
3560
|
+
return function() {
|
|
3561
|
+
const now = Date.now();
|
|
3562
|
+
if (!previous && options.leading === false)
|
|
3563
|
+
previous = now;
|
|
3564
|
+
const remaining = wait - (now - previous);
|
|
3565
|
+
context = this;
|
|
3566
|
+
args = arguments;
|
|
3567
|
+
if (remaining <= 0 || remaining > wait) {
|
|
3568
|
+
if (timeout) {
|
|
3569
|
+
clearTimeout(timeout);
|
|
3570
|
+
timeout = null;
|
|
3571
|
+
}
|
|
3572
|
+
previous = now;
|
|
3573
|
+
result = func.apply(context, args);
|
|
3574
|
+
if (!timeout)
|
|
3575
|
+
context = args = null;
|
|
3576
|
+
} else if (!timeout && options.trailing !== false)
|
|
3577
|
+
timeout = setTimeout(later, remaining);
|
|
3578
|
+
return result;
|
|
3579
|
+
};
|
|
3580
|
+
}
|
|
3581
|
+
function assign(target, ..._args) {
|
|
3582
|
+
const to = Object(target);
|
|
3583
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
3584
|
+
const nextSource = arguments[index];
|
|
3585
|
+
if (nextSource != null) {
|
|
3586
|
+
for (const nextKey in nextSource)
|
|
3587
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey))
|
|
3588
|
+
to[nextKey] = nextSource[nextKey];
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
return to;
|
|
3592
|
+
}
|
|
3593
|
+
const camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : "";
|
|
3594
|
+
function bindAnimations(animations) {
|
|
3595
|
+
for (const animation of animations)
|
|
3596
|
+
switch (animation.trigger) {
|
|
3597
|
+
case "pageLoad":
|
|
3598
|
+
triggerAnimation(animation);
|
|
3599
|
+
break;
|
|
3600
|
+
case "hover":
|
|
3601
|
+
bindHoverAnimation(animation);
|
|
3602
|
+
break;
|
|
3603
|
+
case "scrollInView":
|
|
3604
|
+
bindScrollInViewAnimation(animation);
|
|
3605
|
+
break;
|
|
3606
|
+
}
|
|
3607
|
+
}
|
|
3608
|
+
function warnElementNotPresent(id2) {
|
|
3609
|
+
console.warn(`Cannot animate element: element with ID ${id2} not found!`);
|
|
3610
|
+
}
|
|
3611
|
+
function augmentAnimation(animation, element) {
|
|
3612
|
+
const stylesUsed = getAllStylesUsed(animation);
|
|
3613
|
+
const computedStyle = getComputedStyle(element);
|
|
3614
|
+
const firstStyles = animation.steps[0].styles;
|
|
3615
|
+
const lastStyles = animation.steps[animation.steps.length - 1].styles;
|
|
3616
|
+
const bothStyles = [
|
|
3617
|
+
firstStyles,
|
|
3618
|
+
lastStyles
|
|
3619
|
+
];
|
|
3620
|
+
for (const styles of bothStyles) {
|
|
3621
|
+
for (const style of stylesUsed)
|
|
3622
|
+
if (!(style in styles))
|
|
3623
|
+
styles[style] = computedStyle[style];
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
function getAllStylesUsed(animation) {
|
|
3627
|
+
const properties = [];
|
|
3628
|
+
for (const step of animation.steps) {
|
|
3629
|
+
for (const key in step.styles)
|
|
3630
|
+
if (properties.indexOf(key) === -1)
|
|
3631
|
+
properties.push(key);
|
|
3632
|
+
}
|
|
3633
|
+
return properties;
|
|
3634
|
+
}
|
|
3635
|
+
function triggerAnimation(animation) {
|
|
3636
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3637
|
+
if (!elements.length) {
|
|
3638
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3639
|
+
return;
|
|
3640
|
+
}
|
|
3641
|
+
Array.from(elements).forEach((element) => {
|
|
3642
|
+
augmentAnimation(animation, element);
|
|
3643
|
+
element.style.transition = "none";
|
|
3644
|
+
element.style.transitionDelay = "0";
|
|
3645
|
+
assign(element.style, animation.steps[0].styles);
|
|
3646
|
+
setTimeout(() => {
|
|
3647
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3648
|
+
if (animation.delay)
|
|
3649
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3650
|
+
assign(element.style, animation.steps[1].styles);
|
|
3651
|
+
setTimeout(() => {
|
|
3652
|
+
element.style.transition = "";
|
|
3653
|
+
element.style.transitionDelay = "";
|
|
3654
|
+
}, (animation.delay || 0) * 1e3 + animation.duration * 1e3 + 100);
|
|
3655
|
+
});
|
|
3656
|
+
});
|
|
3657
|
+
}
|
|
3658
|
+
function bindHoverAnimation(animation) {
|
|
3659
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3660
|
+
if (!elements.length) {
|
|
3661
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3662
|
+
return;
|
|
3663
|
+
}
|
|
3664
|
+
Array.from(elements).forEach((element) => {
|
|
3665
|
+
augmentAnimation(animation, element);
|
|
3666
|
+
const defaultState = animation.steps[0].styles;
|
|
3667
|
+
const hoverState = animation.steps[1].styles;
|
|
3668
|
+
function attachDefaultState() {
|
|
3669
|
+
assign(element.style, defaultState);
|
|
3670
|
+
}
|
|
3671
|
+
function attachHoverState() {
|
|
3672
|
+
assign(element.style, hoverState);
|
|
3673
|
+
}
|
|
3674
|
+
attachDefaultState();
|
|
3675
|
+
element.addEventListener("mouseenter", attachHoverState);
|
|
3676
|
+
element.addEventListener("mouseleave", attachDefaultState);
|
|
3677
|
+
setTimeout(() => {
|
|
3678
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3679
|
+
if (animation.delay)
|
|
3680
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3681
|
+
});
|
|
3682
|
+
});
|
|
3683
|
+
}
|
|
3684
|
+
function bindScrollInViewAnimation(animation) {
|
|
3685
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3686
|
+
if (!elements.length) {
|
|
3687
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3688
|
+
return;
|
|
3689
|
+
}
|
|
3690
|
+
Array.from(elements).forEach((element) => {
|
|
3691
|
+
augmentAnimation(animation, element);
|
|
3692
|
+
let triggered = false;
|
|
3693
|
+
let pendingAnimation = false;
|
|
3694
|
+
function immediateOnScroll() {
|
|
3695
|
+
if (!triggered && isScrolledIntoView(element)) {
|
|
3696
|
+
triggered = true;
|
|
3697
|
+
pendingAnimation = true;
|
|
3698
|
+
setTimeout(() => {
|
|
3699
|
+
assign(element.style, animation.steps[1].styles);
|
|
3700
|
+
if (!animation.repeat)
|
|
3701
|
+
document.removeEventListener("scroll", onScroll);
|
|
3702
|
+
setTimeout(() => {
|
|
3703
|
+
pendingAnimation = false;
|
|
3704
|
+
if (!animation.repeat) {
|
|
3705
|
+
element.style.transition = "";
|
|
3706
|
+
element.style.transitionDelay = "";
|
|
3707
|
+
}
|
|
3708
|
+
}, (animation.duration + (animation.delay || 0)) * 1e3 + 100);
|
|
3709
|
+
});
|
|
3710
|
+
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
3711
|
+
triggered = false;
|
|
3712
|
+
assign(element.style, animation.steps[0].styles);
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
const onScroll = throttle(immediateOnScroll, 200, {
|
|
3716
|
+
leading: false
|
|
3717
|
+
});
|
|
3718
|
+
function isScrolledIntoView(elem) {
|
|
3719
|
+
const rect = elem.getBoundingClientRect();
|
|
3720
|
+
const windowHeight = window.innerHeight;
|
|
3721
|
+
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
3722
|
+
const threshold = thresholdPercent * windowHeight;
|
|
3723
|
+
return rect.bottom > threshold && rect.top < windowHeight - threshold;
|
|
3724
|
+
}
|
|
3725
|
+
const defaultState = animation.steps[0].styles;
|
|
3726
|
+
function attachDefaultState() {
|
|
3727
|
+
assign(element.style, defaultState);
|
|
3728
|
+
}
|
|
3729
|
+
attachDefaultState();
|
|
3730
|
+
setTimeout(() => {
|
|
3731
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3732
|
+
if (animation.delay)
|
|
3733
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3734
|
+
});
|
|
3735
|
+
document.addEventListener("scroll", onScroll, {
|
|
3736
|
+
capture: true,
|
|
3737
|
+
passive: true
|
|
3738
|
+
});
|
|
3739
|
+
immediateOnScroll();
|
|
3740
|
+
});
|
|
3741
|
+
}
|
|
3547
3742
|
const getComponent = ({ block, context, registeredComponents }) => {
|
|
3548
3743
|
var _a;
|
|
3549
3744
|
const componentName = (_a = getProcessedBlock({
|
|
@@ -4090,6 +4285,18 @@ const Block = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl(
|
|
|
4090
4285
|
props,
|
|
4091
4286
|
state
|
|
4092
4287
|
]));
|
|
4288
|
+
qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
4289
|
+
const [processedBlock2] = qwik.useLexicalScope();
|
|
4290
|
+
const blockId = processedBlock2.value.id;
|
|
4291
|
+
const animations = processedBlock2.value.animations;
|
|
4292
|
+
if (animations && blockId)
|
|
4293
|
+
bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
|
|
4294
|
+
...animation,
|
|
4295
|
+
elementId: blockId
|
|
4296
|
+
})));
|
|
4297
|
+
}, "Block_component_useVisibleTask_hrTYvqw0Tbs", [
|
|
4298
|
+
processedBlock
|
|
4299
|
+
]));
|
|
4093
4300
|
return /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
4094
4301
|
children: canShowBlock.value ? /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
4095
4302
|
children: [
|
|
@@ -6586,7 +6793,7 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
6586
6793
|
}
|
|
6587
6794
|
};
|
|
6588
6795
|
};
|
|
6589
|
-
const SDK_VERSION = "0.12.
|
|
6796
|
+
const SDK_VERSION = "0.12.7";
|
|
6590
6797
|
const registry = {};
|
|
6591
6798
|
function register(type, info) {
|
|
6592
6799
|
let typeList = registry[type];
|
|
@@ -6771,6 +6978,9 @@ const processMessage = function processMessage2(props, state, elementRef, event)
|
|
|
6771
6978
|
state.forceReRenderCount = state.forceReRenderCount + 1;
|
|
6772
6979
|
break;
|
|
6773
6980
|
}
|
|
6981
|
+
case "builder.triggerAnimation":
|
|
6982
|
+
triggerAnimation(data.data);
|
|
6983
|
+
break;
|
|
6774
6984
|
case "builder.contentUpdate": {
|
|
6775
6985
|
const messageContent = data.data;
|
|
6776
6986
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
package/lib/edge/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, _jsxBranch, _jsxC, Slot as Slot$1, _fnSignal, _IMMUTABLE, createContextId, _jsxQ, useComputedQrl, useLexicalScope, useStore, useContextProvider, _wrapProp, useStylesScopedQrl, useContext, Fragment as Fragment$1, _jsxS, useSignal, useOn, useTaskQrl, createElement } from "@builder.io/qwik";
|
|
1
|
+
import { componentQrl, inlinedQrl, _jsxBranch, _jsxC, Slot as Slot$1, _fnSignal, _IMMUTABLE, createContextId, _jsxQ, useComputedQrl, useLexicalScope, useStore, useContextProvider, useVisibleTaskQrl, _wrapProp, useStylesScopedQrl, useContext, Fragment as Fragment$1, _jsxS, useSignal, useOn, useTaskQrl, createElement } from "@builder.io/qwik";
|
|
2
2
|
import { Fragment } from "@builder.io/qwik/jsx-runtime";
|
|
3
3
|
import { isBrowser as isBrowser$1 } from "@builder.io/qwik/build";
|
|
4
4
|
const EMPTY_HTML_ELEMENTS = /* @__PURE__ */ new Set([
|
|
@@ -3542,6 +3542,201 @@ function getProcessedBlock({ block, context, shouldEvaluateBindings, localState,
|
|
|
3542
3542
|
else
|
|
3543
3543
|
return transformedBlock;
|
|
3544
3544
|
}
|
|
3545
|
+
function throttle(func, wait, options = {}) {
|
|
3546
|
+
let context;
|
|
3547
|
+
let args;
|
|
3548
|
+
let result;
|
|
3549
|
+
let timeout = null;
|
|
3550
|
+
let previous = 0;
|
|
3551
|
+
const later = function() {
|
|
3552
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
3553
|
+
timeout = null;
|
|
3554
|
+
result = func.apply(context, args);
|
|
3555
|
+
if (!timeout)
|
|
3556
|
+
context = args = null;
|
|
3557
|
+
};
|
|
3558
|
+
return function() {
|
|
3559
|
+
const now = Date.now();
|
|
3560
|
+
if (!previous && options.leading === false)
|
|
3561
|
+
previous = now;
|
|
3562
|
+
const remaining = wait - (now - previous);
|
|
3563
|
+
context = this;
|
|
3564
|
+
args = arguments;
|
|
3565
|
+
if (remaining <= 0 || remaining > wait) {
|
|
3566
|
+
if (timeout) {
|
|
3567
|
+
clearTimeout(timeout);
|
|
3568
|
+
timeout = null;
|
|
3569
|
+
}
|
|
3570
|
+
previous = now;
|
|
3571
|
+
result = func.apply(context, args);
|
|
3572
|
+
if (!timeout)
|
|
3573
|
+
context = args = null;
|
|
3574
|
+
} else if (!timeout && options.trailing !== false)
|
|
3575
|
+
timeout = setTimeout(later, remaining);
|
|
3576
|
+
return result;
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
function assign(target, ..._args) {
|
|
3580
|
+
const to = Object(target);
|
|
3581
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
3582
|
+
const nextSource = arguments[index];
|
|
3583
|
+
if (nextSource != null) {
|
|
3584
|
+
for (const nextKey in nextSource)
|
|
3585
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey))
|
|
3586
|
+
to[nextKey] = nextSource[nextKey];
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
return to;
|
|
3590
|
+
}
|
|
3591
|
+
const camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : "";
|
|
3592
|
+
function bindAnimations(animations) {
|
|
3593
|
+
for (const animation of animations)
|
|
3594
|
+
switch (animation.trigger) {
|
|
3595
|
+
case "pageLoad":
|
|
3596
|
+
triggerAnimation(animation);
|
|
3597
|
+
break;
|
|
3598
|
+
case "hover":
|
|
3599
|
+
bindHoverAnimation(animation);
|
|
3600
|
+
break;
|
|
3601
|
+
case "scrollInView":
|
|
3602
|
+
bindScrollInViewAnimation(animation);
|
|
3603
|
+
break;
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
3606
|
+
function warnElementNotPresent(id2) {
|
|
3607
|
+
console.warn(`Cannot animate element: element with ID ${id2} not found!`);
|
|
3608
|
+
}
|
|
3609
|
+
function augmentAnimation(animation, element) {
|
|
3610
|
+
const stylesUsed = getAllStylesUsed(animation);
|
|
3611
|
+
const computedStyle = getComputedStyle(element);
|
|
3612
|
+
const firstStyles = animation.steps[0].styles;
|
|
3613
|
+
const lastStyles = animation.steps[animation.steps.length - 1].styles;
|
|
3614
|
+
const bothStyles = [
|
|
3615
|
+
firstStyles,
|
|
3616
|
+
lastStyles
|
|
3617
|
+
];
|
|
3618
|
+
for (const styles of bothStyles) {
|
|
3619
|
+
for (const style of stylesUsed)
|
|
3620
|
+
if (!(style in styles))
|
|
3621
|
+
styles[style] = computedStyle[style];
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
function getAllStylesUsed(animation) {
|
|
3625
|
+
const properties = [];
|
|
3626
|
+
for (const step of animation.steps) {
|
|
3627
|
+
for (const key in step.styles)
|
|
3628
|
+
if (properties.indexOf(key) === -1)
|
|
3629
|
+
properties.push(key);
|
|
3630
|
+
}
|
|
3631
|
+
return properties;
|
|
3632
|
+
}
|
|
3633
|
+
function triggerAnimation(animation) {
|
|
3634
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3635
|
+
if (!elements.length) {
|
|
3636
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3637
|
+
return;
|
|
3638
|
+
}
|
|
3639
|
+
Array.from(elements).forEach((element) => {
|
|
3640
|
+
augmentAnimation(animation, element);
|
|
3641
|
+
element.style.transition = "none";
|
|
3642
|
+
element.style.transitionDelay = "0";
|
|
3643
|
+
assign(element.style, animation.steps[0].styles);
|
|
3644
|
+
setTimeout(() => {
|
|
3645
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3646
|
+
if (animation.delay)
|
|
3647
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3648
|
+
assign(element.style, animation.steps[1].styles);
|
|
3649
|
+
setTimeout(() => {
|
|
3650
|
+
element.style.transition = "";
|
|
3651
|
+
element.style.transitionDelay = "";
|
|
3652
|
+
}, (animation.delay || 0) * 1e3 + animation.duration * 1e3 + 100);
|
|
3653
|
+
});
|
|
3654
|
+
});
|
|
3655
|
+
}
|
|
3656
|
+
function bindHoverAnimation(animation) {
|
|
3657
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3658
|
+
if (!elements.length) {
|
|
3659
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3660
|
+
return;
|
|
3661
|
+
}
|
|
3662
|
+
Array.from(elements).forEach((element) => {
|
|
3663
|
+
augmentAnimation(animation, element);
|
|
3664
|
+
const defaultState = animation.steps[0].styles;
|
|
3665
|
+
const hoverState = animation.steps[1].styles;
|
|
3666
|
+
function attachDefaultState() {
|
|
3667
|
+
assign(element.style, defaultState);
|
|
3668
|
+
}
|
|
3669
|
+
function attachHoverState() {
|
|
3670
|
+
assign(element.style, hoverState);
|
|
3671
|
+
}
|
|
3672
|
+
attachDefaultState();
|
|
3673
|
+
element.addEventListener("mouseenter", attachHoverState);
|
|
3674
|
+
element.addEventListener("mouseleave", attachDefaultState);
|
|
3675
|
+
setTimeout(() => {
|
|
3676
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3677
|
+
if (animation.delay)
|
|
3678
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3679
|
+
});
|
|
3680
|
+
});
|
|
3681
|
+
}
|
|
3682
|
+
function bindScrollInViewAnimation(animation) {
|
|
3683
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
3684
|
+
if (!elements.length) {
|
|
3685
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
3686
|
+
return;
|
|
3687
|
+
}
|
|
3688
|
+
Array.from(elements).forEach((element) => {
|
|
3689
|
+
augmentAnimation(animation, element);
|
|
3690
|
+
let triggered = false;
|
|
3691
|
+
let pendingAnimation = false;
|
|
3692
|
+
function immediateOnScroll() {
|
|
3693
|
+
if (!triggered && isScrolledIntoView(element)) {
|
|
3694
|
+
triggered = true;
|
|
3695
|
+
pendingAnimation = true;
|
|
3696
|
+
setTimeout(() => {
|
|
3697
|
+
assign(element.style, animation.steps[1].styles);
|
|
3698
|
+
if (!animation.repeat)
|
|
3699
|
+
document.removeEventListener("scroll", onScroll);
|
|
3700
|
+
setTimeout(() => {
|
|
3701
|
+
pendingAnimation = false;
|
|
3702
|
+
if (!animation.repeat) {
|
|
3703
|
+
element.style.transition = "";
|
|
3704
|
+
element.style.transitionDelay = "";
|
|
3705
|
+
}
|
|
3706
|
+
}, (animation.duration + (animation.delay || 0)) * 1e3 + 100);
|
|
3707
|
+
});
|
|
3708
|
+
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
3709
|
+
triggered = false;
|
|
3710
|
+
assign(element.style, animation.steps[0].styles);
|
|
3711
|
+
}
|
|
3712
|
+
}
|
|
3713
|
+
const onScroll = throttle(immediateOnScroll, 200, {
|
|
3714
|
+
leading: false
|
|
3715
|
+
});
|
|
3716
|
+
function isScrolledIntoView(elem) {
|
|
3717
|
+
const rect = elem.getBoundingClientRect();
|
|
3718
|
+
const windowHeight = window.innerHeight;
|
|
3719
|
+
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
3720
|
+
const threshold = thresholdPercent * windowHeight;
|
|
3721
|
+
return rect.bottom > threshold && rect.top < windowHeight - threshold;
|
|
3722
|
+
}
|
|
3723
|
+
const defaultState = animation.steps[0].styles;
|
|
3724
|
+
function attachDefaultState() {
|
|
3725
|
+
assign(element.style, defaultState);
|
|
3726
|
+
}
|
|
3727
|
+
attachDefaultState();
|
|
3728
|
+
setTimeout(() => {
|
|
3729
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
3730
|
+
if (animation.delay)
|
|
3731
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
3732
|
+
});
|
|
3733
|
+
document.addEventListener("scroll", onScroll, {
|
|
3734
|
+
capture: true,
|
|
3735
|
+
passive: true
|
|
3736
|
+
});
|
|
3737
|
+
immediateOnScroll();
|
|
3738
|
+
});
|
|
3739
|
+
}
|
|
3545
3740
|
const getComponent = ({ block, context, registeredComponents }) => {
|
|
3546
3741
|
var _a;
|
|
3547
3742
|
const componentName = (_a = getProcessedBlock({
|
|
@@ -4088,6 +4283,18 @@ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
4088
4283
|
props,
|
|
4089
4284
|
state
|
|
4090
4285
|
]));
|
|
4286
|
+
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
4287
|
+
const [processedBlock2] = useLexicalScope();
|
|
4288
|
+
const blockId = processedBlock2.value.id;
|
|
4289
|
+
const animations = processedBlock2.value.animations;
|
|
4290
|
+
if (animations && blockId)
|
|
4291
|
+
bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
|
|
4292
|
+
...animation,
|
|
4293
|
+
elementId: blockId
|
|
4294
|
+
})));
|
|
4295
|
+
}, "Block_component_useVisibleTask_hrTYvqw0Tbs", [
|
|
4296
|
+
processedBlock
|
|
4297
|
+
]));
|
|
4091
4298
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
4092
4299
|
children: canShowBlock.value ? /* @__PURE__ */ _jsxC(Fragment, {
|
|
4093
4300
|
children: [
|
|
@@ -6584,7 +6791,7 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
6584
6791
|
}
|
|
6585
6792
|
};
|
|
6586
6793
|
};
|
|
6587
|
-
const SDK_VERSION = "0.12.
|
|
6794
|
+
const SDK_VERSION = "0.12.7";
|
|
6588
6795
|
const registry = {};
|
|
6589
6796
|
function register(type, info) {
|
|
6590
6797
|
let typeList = registry[type];
|
|
@@ -6769,6 +6976,9 @@ const processMessage = function processMessage2(props, state, elementRef, event)
|
|
|
6769
6976
|
state.forceReRenderCount = state.forceReRenderCount + 1;
|
|
6770
6977
|
break;
|
|
6771
6978
|
}
|
|
6979
|
+
case "builder.triggerAnimation":
|
|
6980
|
+
triggerAnimation(data.data);
|
|
6981
|
+
break;
|
|
6772
6982
|
case "builder.contentUpdate": {
|
|
6773
6983
|
const messageContent = data.data;
|
|
6774
6984
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|