@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/browser/index.js
CHANGED
|
@@ -421,6 +421,211 @@ function getProcessedBlock({
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
+
// src/components/block/animator.ts
|
|
425
|
+
function throttle(func, wait, options = {}) {
|
|
426
|
+
let context;
|
|
427
|
+
let args;
|
|
428
|
+
let result;
|
|
429
|
+
let timeout = null;
|
|
430
|
+
let previous = 0;
|
|
431
|
+
const later = function() {
|
|
432
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
433
|
+
timeout = null;
|
|
434
|
+
result = func.apply(context, args);
|
|
435
|
+
if (!timeout)
|
|
436
|
+
context = args = null;
|
|
437
|
+
};
|
|
438
|
+
return function() {
|
|
439
|
+
const now = Date.now();
|
|
440
|
+
if (!previous && options.leading === false)
|
|
441
|
+
previous = now;
|
|
442
|
+
const remaining = wait - (now - previous);
|
|
443
|
+
context = this;
|
|
444
|
+
args = arguments;
|
|
445
|
+
if (remaining <= 0 || remaining > wait) {
|
|
446
|
+
if (timeout) {
|
|
447
|
+
clearTimeout(timeout);
|
|
448
|
+
timeout = null;
|
|
449
|
+
}
|
|
450
|
+
previous = now;
|
|
451
|
+
result = func.apply(context, args);
|
|
452
|
+
if (!timeout)
|
|
453
|
+
context = args = null;
|
|
454
|
+
} else if (!timeout && options.trailing !== false) {
|
|
455
|
+
timeout = setTimeout(later, remaining);
|
|
456
|
+
}
|
|
457
|
+
return result;
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
function assign(target, ..._args) {
|
|
461
|
+
const to = Object(target);
|
|
462
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
463
|
+
const nextSource = arguments[index];
|
|
464
|
+
if (nextSource != null) {
|
|
465
|
+
for (const nextKey in nextSource) {
|
|
466
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
467
|
+
to[nextKey] = nextSource[nextKey];
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return to;
|
|
473
|
+
}
|
|
474
|
+
var camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : "";
|
|
475
|
+
function bindAnimations(animations) {
|
|
476
|
+
for (const animation of animations) {
|
|
477
|
+
switch (animation.trigger) {
|
|
478
|
+
case "pageLoad":
|
|
479
|
+
triggerAnimation(animation);
|
|
480
|
+
break;
|
|
481
|
+
case "hover":
|
|
482
|
+
bindHoverAnimation(animation);
|
|
483
|
+
break;
|
|
484
|
+
case "scrollInView":
|
|
485
|
+
bindScrollInViewAnimation(animation);
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
function warnElementNotPresent(id) {
|
|
491
|
+
}
|
|
492
|
+
function augmentAnimation(animation, element) {
|
|
493
|
+
const stylesUsed = getAllStylesUsed(animation);
|
|
494
|
+
const computedStyle = getComputedStyle(element);
|
|
495
|
+
const firstStyles = animation.steps[0].styles;
|
|
496
|
+
const lastStyles = animation.steps[animation.steps.length - 1].styles;
|
|
497
|
+
const bothStyles = [firstStyles, lastStyles];
|
|
498
|
+
for (const styles of bothStyles) {
|
|
499
|
+
for (const style of stylesUsed) {
|
|
500
|
+
if (!(style in styles)) {
|
|
501
|
+
styles[style] = computedStyle[style];
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
function getAllStylesUsed(animation) {
|
|
507
|
+
const properties = [];
|
|
508
|
+
for (const step of animation.steps) {
|
|
509
|
+
for (const key in step.styles) {
|
|
510
|
+
if (properties.indexOf(key) === -1) {
|
|
511
|
+
properties.push(key);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
return properties;
|
|
516
|
+
}
|
|
517
|
+
function triggerAnimation(animation) {
|
|
518
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
519
|
+
if (!elements.length) {
|
|
520
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
Array.from(elements).forEach((element) => {
|
|
524
|
+
augmentAnimation(animation, element);
|
|
525
|
+
element.style.transition = "none";
|
|
526
|
+
element.style.transitionDelay = "0";
|
|
527
|
+
assign(element.style, animation.steps[0].styles);
|
|
528
|
+
setTimeout(() => {
|
|
529
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
530
|
+
if (animation.delay) {
|
|
531
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
532
|
+
}
|
|
533
|
+
assign(element.style, animation.steps[1].styles);
|
|
534
|
+
setTimeout(() => {
|
|
535
|
+
element.style.transition = "";
|
|
536
|
+
element.style.transitionDelay = "";
|
|
537
|
+
}, (animation.delay || 0) * 1e3 + animation.duration * 1e3 + 100);
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
function bindHoverAnimation(animation) {
|
|
542
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
543
|
+
if (!elements.length) {
|
|
544
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
Array.from(elements).forEach((element) => {
|
|
548
|
+
augmentAnimation(animation, element);
|
|
549
|
+
const defaultState = animation.steps[0].styles;
|
|
550
|
+
const hoverState = animation.steps[1].styles;
|
|
551
|
+
function attachDefaultState() {
|
|
552
|
+
assign(element.style, defaultState);
|
|
553
|
+
}
|
|
554
|
+
function attachHoverState() {
|
|
555
|
+
assign(element.style, hoverState);
|
|
556
|
+
}
|
|
557
|
+
attachDefaultState();
|
|
558
|
+
element.addEventListener("mouseenter", attachHoverState);
|
|
559
|
+
element.addEventListener("mouseleave", attachDefaultState);
|
|
560
|
+
setTimeout(() => {
|
|
561
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
562
|
+
if (animation.delay) {
|
|
563
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
function bindScrollInViewAnimation(animation) {
|
|
569
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
570
|
+
if (!elements.length) {
|
|
571
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
Array.from(elements).forEach((element) => {
|
|
575
|
+
augmentAnimation(animation, element);
|
|
576
|
+
let triggered = false;
|
|
577
|
+
let pendingAnimation = false;
|
|
578
|
+
function immediateOnScroll() {
|
|
579
|
+
if (!triggered && isScrolledIntoView(element)) {
|
|
580
|
+
triggered = true;
|
|
581
|
+
pendingAnimation = true;
|
|
582
|
+
setTimeout(() => {
|
|
583
|
+
assign(element.style, animation.steps[1].styles);
|
|
584
|
+
if (!animation.repeat) {
|
|
585
|
+
document.removeEventListener("scroll", onScroll);
|
|
586
|
+
}
|
|
587
|
+
setTimeout(() => {
|
|
588
|
+
pendingAnimation = false;
|
|
589
|
+
if (!animation.repeat) {
|
|
590
|
+
element.style.transition = "";
|
|
591
|
+
element.style.transitionDelay = "";
|
|
592
|
+
}
|
|
593
|
+
}, (animation.duration + (animation.delay || 0)) * 1e3 + 100);
|
|
594
|
+
});
|
|
595
|
+
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
596
|
+
triggered = false;
|
|
597
|
+
assign(element.style, animation.steps[0].styles);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
const onScroll = throttle(immediateOnScroll, 200, {
|
|
601
|
+
leading: false
|
|
602
|
+
});
|
|
603
|
+
function isScrolledIntoView(elem) {
|
|
604
|
+
const rect = elem.getBoundingClientRect();
|
|
605
|
+
const windowHeight = window.innerHeight;
|
|
606
|
+
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
607
|
+
const threshold = thresholdPercent * windowHeight;
|
|
608
|
+
return rect.bottom > threshold && rect.top < windowHeight - threshold;
|
|
609
|
+
}
|
|
610
|
+
const defaultState = animation.steps[0].styles;
|
|
611
|
+
function attachDefaultState() {
|
|
612
|
+
assign(element.style, defaultState);
|
|
613
|
+
}
|
|
614
|
+
attachDefaultState();
|
|
615
|
+
setTimeout(() => {
|
|
616
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
617
|
+
if (animation.delay) {
|
|
618
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
document.addEventListener("scroll", onScroll, {
|
|
622
|
+
capture: true,
|
|
623
|
+
passive: true
|
|
624
|
+
});
|
|
625
|
+
immediateOnScroll();
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
|
|
424
629
|
// src/components/block/block.helpers.ts
|
|
425
630
|
var getComponent = ({
|
|
426
631
|
block,
|
|
@@ -993,6 +1198,16 @@ function Block(props) {
|
|
|
993
1198
|
isInteractive: !blockComponent()?.isRSC
|
|
994
1199
|
};
|
|
995
1200
|
}
|
|
1201
|
+
onMount(() => {
|
|
1202
|
+
const blockId = processedBlock().id;
|
|
1203
|
+
const animations = processedBlock().animations;
|
|
1204
|
+
if (animations && blockId) {
|
|
1205
|
+
bindAnimations(animations.filter((item) => item.trigger !== "hover").map((animation) => ({
|
|
1206
|
+
...animation,
|
|
1207
|
+
elementId: blockId
|
|
1208
|
+
})));
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
996
1211
|
return createComponent(Show, {
|
|
997
1212
|
get when() {
|
|
998
1213
|
return canShowBlock();
|
|
@@ -3396,7 +3611,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3396
3611
|
};
|
|
3397
3612
|
|
|
3398
3613
|
// src/constants/sdk-version.ts
|
|
3399
|
-
var SDK_VERSION = "0.12.
|
|
3614
|
+
var SDK_VERSION = "0.12.7";
|
|
3400
3615
|
|
|
3401
3616
|
// src/functions/register.ts
|
|
3402
3617
|
var registry = {};
|
|
@@ -3602,6 +3817,10 @@ function EnableEditor(props) {
|
|
|
3602
3817
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
3603
3818
|
break;
|
|
3604
3819
|
}
|
|
3820
|
+
case "builder.triggerAnimation": {
|
|
3821
|
+
triggerAnimation(data.data);
|
|
3822
|
+
break;
|
|
3823
|
+
}
|
|
3605
3824
|
case "builder.contentUpdate": {
|
|
3606
3825
|
const messageContent = data.data;
|
|
3607
3826
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
package/lib/browser/index.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) {
|
|
@@ -408,6 +408,211 @@ function getProcessedBlock({
|
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
+
// src/components/block/animator.ts
|
|
412
|
+
function throttle(func, wait, options = {}) {
|
|
413
|
+
let context;
|
|
414
|
+
let args;
|
|
415
|
+
let result;
|
|
416
|
+
let timeout = null;
|
|
417
|
+
let previous = 0;
|
|
418
|
+
const later = function() {
|
|
419
|
+
previous = options.leading === false ? 0 : Date.now();
|
|
420
|
+
timeout = null;
|
|
421
|
+
result = func.apply(context, args);
|
|
422
|
+
if (!timeout)
|
|
423
|
+
context = args = null;
|
|
424
|
+
};
|
|
425
|
+
return function() {
|
|
426
|
+
const now = Date.now();
|
|
427
|
+
if (!previous && options.leading === false)
|
|
428
|
+
previous = now;
|
|
429
|
+
const remaining = wait - (now - previous);
|
|
430
|
+
context = this;
|
|
431
|
+
args = arguments;
|
|
432
|
+
if (remaining <= 0 || remaining > wait) {
|
|
433
|
+
if (timeout) {
|
|
434
|
+
clearTimeout(timeout);
|
|
435
|
+
timeout = null;
|
|
436
|
+
}
|
|
437
|
+
previous = now;
|
|
438
|
+
result = func.apply(context, args);
|
|
439
|
+
if (!timeout)
|
|
440
|
+
context = args = null;
|
|
441
|
+
} else if (!timeout && options.trailing !== false) {
|
|
442
|
+
timeout = setTimeout(later, remaining);
|
|
443
|
+
}
|
|
444
|
+
return result;
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function assign(target, ..._args) {
|
|
448
|
+
const to = Object(target);
|
|
449
|
+
for (let index = 1; index < arguments.length; index++) {
|
|
450
|
+
const nextSource = arguments[index];
|
|
451
|
+
if (nextSource != null) {
|
|
452
|
+
for (const nextKey in nextSource) {
|
|
453
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
454
|
+
to[nextKey] = nextSource[nextKey];
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return to;
|
|
460
|
+
}
|
|
461
|
+
var camelCaseToKebabCase = (str) => str ? str.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`) : "";
|
|
462
|
+
function bindAnimations(animations) {
|
|
463
|
+
for (const animation of animations) {
|
|
464
|
+
switch (animation.trigger) {
|
|
465
|
+
case "pageLoad":
|
|
466
|
+
triggerAnimation(animation);
|
|
467
|
+
break;
|
|
468
|
+
case "hover":
|
|
469
|
+
bindHoverAnimation(animation);
|
|
470
|
+
break;
|
|
471
|
+
case "scrollInView":
|
|
472
|
+
bindScrollInViewAnimation(animation);
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function warnElementNotPresent(id) {
|
|
478
|
+
}
|
|
479
|
+
function augmentAnimation(animation, element) {
|
|
480
|
+
const stylesUsed = getAllStylesUsed(animation);
|
|
481
|
+
const computedStyle = getComputedStyle(element);
|
|
482
|
+
const firstStyles = animation.steps[0].styles;
|
|
483
|
+
const lastStyles = animation.steps[animation.steps.length - 1].styles;
|
|
484
|
+
const bothStyles = [firstStyles, lastStyles];
|
|
485
|
+
for (const styles of bothStyles) {
|
|
486
|
+
for (const style of stylesUsed) {
|
|
487
|
+
if (!(style in styles)) {
|
|
488
|
+
styles[style] = computedStyle[style];
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
function getAllStylesUsed(animation) {
|
|
494
|
+
const properties = [];
|
|
495
|
+
for (const step of animation.steps) {
|
|
496
|
+
for (const key in step.styles) {
|
|
497
|
+
if (properties.indexOf(key) === -1) {
|
|
498
|
+
properties.push(key);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return properties;
|
|
503
|
+
}
|
|
504
|
+
function triggerAnimation(animation) {
|
|
505
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
506
|
+
if (!elements.length) {
|
|
507
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
Array.from(elements).forEach((element) => {
|
|
511
|
+
augmentAnimation(animation, element);
|
|
512
|
+
element.style.transition = "none";
|
|
513
|
+
element.style.transitionDelay = "0";
|
|
514
|
+
assign(element.style, animation.steps[0].styles);
|
|
515
|
+
setTimeout(() => {
|
|
516
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
517
|
+
if (animation.delay) {
|
|
518
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
519
|
+
}
|
|
520
|
+
assign(element.style, animation.steps[1].styles);
|
|
521
|
+
setTimeout(() => {
|
|
522
|
+
element.style.transition = "";
|
|
523
|
+
element.style.transitionDelay = "";
|
|
524
|
+
}, (animation.delay || 0) * 1e3 + animation.duration * 1e3 + 100);
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
function bindHoverAnimation(animation) {
|
|
529
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
530
|
+
if (!elements.length) {
|
|
531
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
Array.from(elements).forEach((element) => {
|
|
535
|
+
augmentAnimation(animation, element);
|
|
536
|
+
const defaultState = animation.steps[0].styles;
|
|
537
|
+
const hoverState = animation.steps[1].styles;
|
|
538
|
+
function attachDefaultState() {
|
|
539
|
+
assign(element.style, defaultState);
|
|
540
|
+
}
|
|
541
|
+
function attachHoverState() {
|
|
542
|
+
assign(element.style, hoverState);
|
|
543
|
+
}
|
|
544
|
+
attachDefaultState();
|
|
545
|
+
element.addEventListener("mouseenter", attachHoverState);
|
|
546
|
+
element.addEventListener("mouseleave", attachDefaultState);
|
|
547
|
+
setTimeout(() => {
|
|
548
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
549
|
+
if (animation.delay) {
|
|
550
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
function bindScrollInViewAnimation(animation) {
|
|
556
|
+
const elements = Array.prototype.slice.call(document.getElementsByClassName(animation.elementId || animation.id || ""));
|
|
557
|
+
if (!elements.length) {
|
|
558
|
+
warnElementNotPresent(animation.elementId || animation.id || "");
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
Array.from(elements).forEach((element) => {
|
|
562
|
+
augmentAnimation(animation, element);
|
|
563
|
+
let triggered = false;
|
|
564
|
+
let pendingAnimation = false;
|
|
565
|
+
function immediateOnScroll() {
|
|
566
|
+
if (!triggered && isScrolledIntoView(element)) {
|
|
567
|
+
triggered = true;
|
|
568
|
+
pendingAnimation = true;
|
|
569
|
+
setTimeout(() => {
|
|
570
|
+
assign(element.style, animation.steps[1].styles);
|
|
571
|
+
if (!animation.repeat) {
|
|
572
|
+
document.removeEventListener("scroll", onScroll);
|
|
573
|
+
}
|
|
574
|
+
setTimeout(() => {
|
|
575
|
+
pendingAnimation = false;
|
|
576
|
+
if (!animation.repeat) {
|
|
577
|
+
element.style.transition = "";
|
|
578
|
+
element.style.transitionDelay = "";
|
|
579
|
+
}
|
|
580
|
+
}, (animation.duration + (animation.delay || 0)) * 1e3 + 100);
|
|
581
|
+
});
|
|
582
|
+
} else if (animation.repeat && triggered && !pendingAnimation && !isScrolledIntoView(element)) {
|
|
583
|
+
triggered = false;
|
|
584
|
+
assign(element.style, animation.steps[0].styles);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
const onScroll = throttle(immediateOnScroll, 200, {
|
|
588
|
+
leading: false
|
|
589
|
+
});
|
|
590
|
+
function isScrolledIntoView(elem) {
|
|
591
|
+
const rect = elem.getBoundingClientRect();
|
|
592
|
+
const windowHeight = window.innerHeight;
|
|
593
|
+
const thresholdPercent = (animation.thresholdPercent || 0) / 100;
|
|
594
|
+
const threshold = thresholdPercent * windowHeight;
|
|
595
|
+
return rect.bottom > threshold && rect.top < windowHeight - threshold;
|
|
596
|
+
}
|
|
597
|
+
const defaultState = animation.steps[0].styles;
|
|
598
|
+
function attachDefaultState() {
|
|
599
|
+
assign(element.style, defaultState);
|
|
600
|
+
}
|
|
601
|
+
attachDefaultState();
|
|
602
|
+
setTimeout(() => {
|
|
603
|
+
element.style.transition = `all ${animation.duration}s ${camelCaseToKebabCase(animation.easing)}`;
|
|
604
|
+
if (animation.delay) {
|
|
605
|
+
element.style.transitionDelay = animation.delay + "s";
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
document.addEventListener("scroll", onScroll, {
|
|
609
|
+
capture: true,
|
|
610
|
+
passive: true
|
|
611
|
+
});
|
|
612
|
+
immediateOnScroll();
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
|
|
411
616
|
// src/components/block/block.helpers.ts
|
|
412
617
|
var getComponent = ({
|
|
413
618
|
block,
|
|
@@ -927,6 +1132,18 @@ function Block(props) {
|
|
|
927
1132
|
isInteractive: !blockComponent()?.isRSC
|
|
928
1133
|
};
|
|
929
1134
|
}
|
|
1135
|
+
onMount(() => {
|
|
1136
|
+
const blockId = processedBlock().id;
|
|
1137
|
+
const animations = processedBlock().animations;
|
|
1138
|
+
if (animations && blockId) {
|
|
1139
|
+
bindAnimations(
|
|
1140
|
+
animations.filter((item) => item.trigger !== "hover").map((animation) => ({
|
|
1141
|
+
...animation,
|
|
1142
|
+
elementId: blockId
|
|
1143
|
+
}))
|
|
1144
|
+
);
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
930
1147
|
return <Show4 when={canShowBlock()}>
|
|
931
1148
|
<Block_styles_default block={props.block} context={props.context} />
|
|
932
1149
|
<Show4
|
|
@@ -1374,10 +1591,10 @@ function SectionComponent(props) {
|
|
|
1374
1591
|
var section_default = SectionComponent;
|
|
1375
1592
|
|
|
1376
1593
|
// src/blocks/symbol/symbol.tsx
|
|
1377
|
-
import { onMount as
|
|
1594
|
+
import { onMount as onMount5, on as on3, createEffect as createEffect3, createSignal as createSignal14 } from "solid-js";
|
|
1378
1595
|
|
|
1379
1596
|
// src/components/content-variants/content-variants.tsx
|
|
1380
|
-
import { Show as Show11, For as For5, onMount as
|
|
1597
|
+
import { Show as Show11, For as For5, onMount as onMount4, createSignal as createSignal13 } from "solid-js";
|
|
1381
1598
|
|
|
1382
1599
|
// src/helpers/url.ts
|
|
1383
1600
|
var getTopLevelDomain = (host) => {
|
|
@@ -1855,12 +2072,12 @@ var componentInfo3 = {
|
|
|
1855
2072
|
};
|
|
1856
2073
|
|
|
1857
2074
|
// src/blocks/custom-code/custom-code.tsx
|
|
1858
|
-
import { onMount, createSignal as createSignal7 } from "solid-js";
|
|
2075
|
+
import { onMount as onMount2, createSignal as createSignal7 } from "solid-js";
|
|
1859
2076
|
function CustomCode(props) {
|
|
1860
2077
|
const [scriptsInserted, setScriptsInserted] = createSignal7([]);
|
|
1861
2078
|
const [scriptsRun, setScriptsRun] = createSignal7([]);
|
|
1862
2079
|
let elementRef;
|
|
1863
|
-
|
|
2080
|
+
onMount2(() => {
|
|
1864
2081
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
1865
2082
|
return;
|
|
1866
2083
|
}
|
|
@@ -2578,7 +2795,7 @@ function InlinedScript(props) {
|
|
|
2578
2795
|
var Inlined_script_default = InlinedScript;
|
|
2579
2796
|
|
|
2580
2797
|
// src/components/content/components/enable-editor.tsx
|
|
2581
|
-
import { Show as Show9, onMount as
|
|
2798
|
+
import { Show as Show9, onMount as onMount3, on as on2, createEffect as createEffect2, createSignal as createSignal10 } from "solid-js";
|
|
2582
2799
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
2583
2800
|
|
|
2584
2801
|
// src/helpers/preview-lru-cache/get.ts
|
|
@@ -3068,7 +3285,7 @@ var getInteractionPropertiesForEvent = (event) => {
|
|
|
3068
3285
|
};
|
|
3069
3286
|
|
|
3070
3287
|
// src/constants/sdk-version.ts
|
|
3071
|
-
var SDK_VERSION = "0.12.
|
|
3288
|
+
var SDK_VERSION = "0.12.7";
|
|
3072
3289
|
|
|
3073
3290
|
// src/functions/register.ts
|
|
3074
3291
|
var registry = {};
|
|
@@ -3271,6 +3488,10 @@ function EnableEditor(props) {
|
|
|
3271
3488
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
3272
3489
|
break;
|
|
3273
3490
|
}
|
|
3491
|
+
case "builder.triggerAnimation": {
|
|
3492
|
+
triggerAnimation(data.data);
|
|
3493
|
+
break;
|
|
3494
|
+
}
|
|
3274
3495
|
case "builder.contentUpdate": {
|
|
3275
3496
|
const messageContent = data.data;
|
|
3276
3497
|
const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
|
|
@@ -3367,7 +3588,7 @@ function EnableEditor(props) {
|
|
|
3367
3588
|
}
|
|
3368
3589
|
}
|
|
3369
3590
|
let elementRef;
|
|
3370
|
-
|
|
3591
|
+
onMount3(() => {
|
|
3371
3592
|
if (isBrowser()) {
|
|
3372
3593
|
if (isEditing() && true) {
|
|
3373
3594
|
setForceReRenderCount(forceReRenderCount() + 1);
|
|
@@ -3432,7 +3653,7 @@ function EnableEditor(props) {
|
|
|
3432
3653
|
}
|
|
3433
3654
|
}
|
|
3434
3655
|
});
|
|
3435
|
-
|
|
3656
|
+
onMount3(() => {
|
|
3436
3657
|
if (!props.apiKey) {
|
|
3437
3658
|
logger.error(
|
|
3438
3659
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
@@ -3772,7 +3993,7 @@ function ContentVariants(props) {
|
|
|
3772
3993
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
3773
3994
|
});
|
|
3774
3995
|
}
|
|
3775
|
-
|
|
3996
|
+
onMount4(() => {
|
|
3776
3997
|
setShouldRenderVariants(false);
|
|
3777
3998
|
});
|
|
3778
3999
|
return <>
|
|
@@ -3884,7 +4105,7 @@ function Symbol(props) {
|
|
|
3884
4105
|
}
|
|
3885
4106
|
});
|
|
3886
4107
|
}
|
|
3887
|
-
|
|
4108
|
+
onMount5(() => {
|
|
3888
4109
|
setContent();
|
|
3889
4110
|
});
|
|
3890
4111
|
function onUpdateFn_0() {
|