rw-elements-tools 1.2.0
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/LICENSE +22 -0
- package/README.md +1333 -0
- package/bin/cli.js +213 -0
- package/build-properties.js +654 -0
- package/build-shared-hooks.js +253 -0
- package/config.js +148 -0
- package/controls/Animations/AnimationEffects.js +111 -0
- package/controls/Animations/AnimationSettings.js +437 -0
- package/controls/Animations/Reveals.js +168 -0
- package/controls/Animations/ScrollAnimation_Opacity.js +15 -0
- package/controls/Animations/ScrollAnimation_Rotate.js +17 -0
- package/controls/Animations/ScrollAnimation_Scale.js +18 -0
- package/controls/Animations/ScrollAnimation_Translate.js +31 -0
- package/controls/Background/Background.js +66 -0
- package/controls/Background/BackgroundButton.js +69 -0
- package/controls/Background/BackgroundColor.js +28 -0
- package/controls/Background/BackgroundContainer.js +73 -0
- package/controls/Background/BackgroundGradient.js +149 -0
- package/controls/Background/BackgroundImage.js +108 -0
- package/controls/Background/BackgroundOnlyColor.js +53 -0
- package/controls/Background/BackgroundTransparent.js +66 -0
- package/controls/Background/BackgroundVideo.js +9 -0
- package/controls/Background/Color.js +52 -0
- package/controls/Background/Gradient.js +263 -0
- package/controls/Background/GradientContainer.js +263 -0
- package/controls/Background/Image.js +269 -0
- package/controls/Background/Image_CMS.js +305 -0
- package/controls/Background/SVG.js +235 -0
- package/controls/Background/Video.js +29 -0
- package/controls/Borders/Border.js +114 -0
- package/controls/Borders/BorderColor.js +25 -0
- package/controls/Borders/BorderRadius.js +19 -0
- package/controls/Borders/BorderStyle.js +26 -0
- package/controls/Borders/BorderWidth.js +20 -0
- package/controls/Borders/Borders.js +69 -0
- package/controls/Borders/BordersContainer.js +90 -0
- package/controls/Borders/BordersInput.js +107 -0
- package/controls/Borders/Outline.js +100 -0
- package/controls/Borders/OutlineColor.js +25 -0
- package/controls/Borders/OutlineOffset.js +13 -0
- package/controls/Borders/OutlineStyle.js +26 -0
- package/controls/Borders/OutlineWidth.js +13 -0
- package/controls/Effects/BackdropBlur.js +11 -0
- package/controls/Effects/Blur.js +11 -0
- package/controls/Effects/BoxShadow.js +15 -0
- package/controls/Effects/Brightness.js +11 -0
- package/controls/Effects/DropShadow.js +14 -0
- package/controls/Effects/Effects.js +71 -0
- package/controls/Effects/Filters.js +114 -0
- package/controls/Effects/Opacity.js +14 -0
- package/controls/Effects/Saturate.js +11 -0
- package/controls/Layout/AspectRatio.js +53 -0
- package/controls/Layout/Container.js +24 -0
- package/controls/Layout/Hidden.js +9 -0
- package/controls/Layout/Inset.js +15 -0
- package/controls/Layout/Isolation.js +25 -0
- package/controls/Layout/Layout.js +38 -0
- package/controls/Layout/Overflow.js +33 -0
- package/controls/Layout/Position.js +37 -0
- package/controls/Layout/TopRightBottomLeft.js +90 -0
- package/controls/Layout/Visibility.js +25 -0
- package/controls/Layout/ZIndex.js +36 -0
- package/controls/Overlay/Color.js +52 -0
- package/controls/Overlay/Gradient.js +298 -0
- package/controls/Overlay/Image.js +226 -0
- package/controls/Overlay/Overlay.js +66 -0
- package/controls/Sizing/Height.js +18 -0
- package/controls/Sizing/MaxHeight.js +17 -0
- package/controls/Sizing/MaxWidth.js +17 -0
- package/controls/Sizing/MinHeight.js +18 -0
- package/controls/Sizing/MinWidth.js +18 -0
- package/controls/Sizing/Sizing.js +66 -0
- package/controls/Sizing/SizingContainer.js +122 -0
- package/controls/Sizing/SizingImage.js +75 -0
- package/controls/Sizing/SizingInput.js +71 -0
- package/controls/Sizing/SizingSVG.js +74 -0
- package/controls/Sizing/Width.js +18 -0
- package/controls/Spacing/Margin.js +17 -0
- package/controls/Spacing/Padding.js +17 -0
- package/controls/Spacing/Spacing.js +23 -0
- package/controls/Spacing/SpacingButton.js +42 -0
- package/controls/Spacing/SpacingContainer.js +32 -0
- package/controls/Spacing/SpacingInput.js +42 -0
- package/controls/Transforms/Rotate.js +13 -0
- package/controls/Transforms/Scale.js +13 -0
- package/controls/Transforms/Skew.js +25 -0
- package/controls/Transforms/TransformOrigin.js +12 -0
- package/controls/Transforms/Transforms.js +98 -0
- package/controls/Transforms/Translate.js +26 -0
- package/controls/Transitions/Delay.js +13 -0
- package/controls/Transitions/Duration.js +13 -0
- package/controls/Transitions/Property.js +42 -0
- package/controls/Transitions/TimingFunction.js +44 -0
- package/controls/Transitions/Transitions.js +20 -0
- package/controls/alignment/AlignContent.js +48 -0
- package/controls/alignment/AlignItems.js +64 -0
- package/controls/alignment/AlignSelf.js +34 -0
- package/controls/alignment/JustifyContent.js +44 -0
- package/controls/alignment/JustifyItems.js +32 -0
- package/controls/alignment/JustifySelf.js +34 -0
- package/controls/core/CSSClasses.js +11 -0
- package/controls/core/ControlType.js +25 -0
- package/controls/core/HTMLTag.js +80 -0
- package/controls/core/HoverGroup.js +38 -0
- package/controls/core/ID.js +12 -0
- package/controls/core/Image.js +95 -0
- package/controls/core/MenuItem.js +187 -0
- package/controls/core/ObjectFit.js +32 -0
- package/controls/core/ObjectPosition.js +65 -0
- package/controls/grid-flex/ActAsGridOrFlexItem.js +54 -0
- package/controls/grid-flex/ColEnd.js +28 -0
- package/controls/grid-flex/ColStart.js +27 -0
- package/controls/grid-flex/Columns.js +38 -0
- package/controls/grid-flex/FlexDirection.js +27 -0
- package/controls/grid-flex/FlexItem.js +106 -0
- package/controls/grid-flex/GridItem.js +41 -0
- package/controls/grid-flex/Order.js +45 -0
- package/controls/grid-flex/RowEnd.js +28 -0
- package/controls/grid-flex/RowStart.js +27 -0
- package/controls/grid-flex/Rows.js +38 -0
- package/controls/index.js +187 -0
- package/controls/interactive/ButtonFontAndTextStyles.js +208 -0
- package/controls/interactive/Filter.js +54 -0
- package/controls/interactive/InputFontAndTextStyles.js +156 -0
- package/controls/interactive/Link.js +13 -0
- package/controls/typography/HeadingColor.js +112 -0
- package/controls/typography/TextColor.js +51 -0
- package/controls/typography/TextDecoration.js +99 -0
- package/controls/typography/TextFontsAndTextStyles.js +243 -0
- package/controls/typography/TextSimple.js +55 -0
- package/controls/typography/TextStyles.js +55 -0
- package/controls/typography/Typography.js +13 -0
- package/index.js +19 -0
- package/package.json +55 -0
- package/properties/BackgroundType.js +18 -0
- package/properties/ButtonSize.js +19 -0
- package/properties/ContainerHeights.js +23 -0
- package/properties/ContainerWidths.js +27 -0
- package/properties/FontWeight.js +16 -0
- package/properties/GradientDirection.js +39 -0
- package/properties/LetterSpacing.js +13 -0
- package/properties/LineHeight.js +13 -0
- package/properties/RevealAnimations.js +12 -0
- package/properties/Slider.js +10 -0
- package/properties/TextAlign.js +23 -0
- package/properties/TransformOrigins.js +43 -0
- package/properties/TransitionNames.js +20 -0
- package/properties/index.js +13 -0
- package/shared-hooks/animations/globalAnimations.js +141 -0
- package/shared-hooks/animations/globalReveal.js +48 -0
- package/shared-hooks/background/globalBackground.js +306 -0
- package/shared-hooks/background/globalBgImageFetchPriority.js +34 -0
- package/shared-hooks/borders/globalBorders.js +85 -0
- package/shared-hooks/borders/globalOutline.js +39 -0
- package/shared-hooks/core/addPrefixToTailwindClasses.js +24 -0
- package/shared-hooks/core/advancedClasses.js +5 -0
- package/shared-hooks/core/classnames.js +92 -0
- package/shared-hooks/core/getHoverPrefix.js +21 -0
- package/shared-hooks/core/globalHTMLTag.js +17 -0
- package/shared-hooks/core/injectPrefixOnDarkModeColors.js +6 -0
- package/shared-hooks/effects/globalEffects.js +45 -0
- package/shared-hooks/effects/globalFilters.js +80 -0
- package/shared-hooks/effects/globalOverlay.js +166 -0
- package/shared-hooks/interactive/globalFilter.js +24 -0
- package/shared-hooks/interactive/globalLink.js +23 -0
- package/shared-hooks/layout/globalActAsGridOrFlexItem.js +66 -0
- package/shared-hooks/layout/globalLayout.js +50 -0
- package/shared-hooks/navigation/globalMenuItem.js +35 -0
- package/shared-hooks/navigation/globalNavItems.js +60 -0
- package/shared-hooks/navigation/globalNavTitle.js +23 -0
- package/shared-hooks/sizing/aspectRatioClasses.js +20 -0
- package/shared-hooks/sizing/globalSizing.js +19 -0
- package/shared-hooks/sizing/globalSizingContainer.js +40 -0
- package/shared-hooks/sizing/objectClasses.js +9 -0
- package/shared-hooks/spacing/globalSpacing.js +13 -0
- package/shared-hooks/spacing/globalSpacingMargin.js +11 -0
- package/shared-hooks/spacing/globalSpacingPadding.js +11 -0
- package/shared-hooks/transforms/globalTransforms.js +78 -0
- package/shared-hooks/transitions/getAlpineTransitionAttributesDesktop.js +111 -0
- package/shared-hooks/transitions/getAlpineTransitionAttributesMobile.js +110 -0
- package/shared-hooks/transitions/globalTransitions.js +48 -0
- package/shared-hooks/typography/globalButtonFontAndTextStyles.js +65 -0
- package/shared-hooks/typography/globalHeadingColor.js +69 -0
- package/shared-hooks/typography/globalInputFontAndTextStyles.js +40 -0
- package/shared-hooks/typography/globalTextFontsAndTextStyles.js +47 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const ContainerHeights = {
|
|
2
|
+
default: "full",
|
|
3
|
+
items: [
|
|
4
|
+
{
|
|
5
|
+
title: "Auto",
|
|
6
|
+
value: "auto"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
title: "Full",
|
|
10
|
+
value: "full"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
title: "Screen",
|
|
14
|
+
value: "screen"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
title: "Custom",
|
|
18
|
+
value: "custom"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default ContainerHeights;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const ContainerWidths = {
|
|
2
|
+
default: "full",
|
|
3
|
+
items: [
|
|
4
|
+
{
|
|
5
|
+
title: "Auto",
|
|
6
|
+
value: "auto"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
title: "Breakpoint",
|
|
10
|
+
value: "breakpoint"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
title: "Full",
|
|
14
|
+
value: "full"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
title: "Screen",
|
|
18
|
+
value: "screen"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
title: "Custom",
|
|
22
|
+
value: "custom"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default ContainerWidths;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const FontWeight = {
|
|
2
|
+
default: "400",
|
|
3
|
+
items: [
|
|
4
|
+
{ value: "100", title: "Thin" },
|
|
5
|
+
{ value: "200", title: "Extra Light" },
|
|
6
|
+
{ value: "300", title: "Light" },
|
|
7
|
+
{ value: "400", title: "Normal" },
|
|
8
|
+
{ value: "500", title: "Medium" },
|
|
9
|
+
{ value: "600", title: "Semi Bold" },
|
|
10
|
+
{ value: "700", title: "Bold" },
|
|
11
|
+
{ value: "800", title: "Extra Bold" },
|
|
12
|
+
{ value: "900", title: "Black" },
|
|
13
|
+
],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default FontWeight;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const GradientDirection = {
|
|
2
|
+
default: "bg-gradient-to-b",
|
|
3
|
+
items: [
|
|
4
|
+
{
|
|
5
|
+
value: "bg-gradient-to-t",
|
|
6
|
+
title: "To Top",
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
value: "bg-gradient-to-tr",
|
|
10
|
+
title: "To Top Right",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "bg-gradient-to-r",
|
|
14
|
+
title: "To Right",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "bg-gradient-to-br",
|
|
18
|
+
title: "To Bottom Right",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "bg-gradient-to-b",
|
|
22
|
+
title: "To Bottom",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "bg-gradient-to-bl",
|
|
26
|
+
title: "To Bottom Left",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: "bg-gradient-to-l",
|
|
30
|
+
title: "To Left",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: "bg-gradient-to-tl",
|
|
34
|
+
title: "To Top Left",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default GradientDirection;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const LetterSpacing = {
|
|
2
|
+
default: "normal",
|
|
3
|
+
items: [
|
|
4
|
+
{ value: "tighter", title: "Tighter" },
|
|
5
|
+
{ value: "tight", title: "Tight" },
|
|
6
|
+
{ value: "normal", title: "Normal" },
|
|
7
|
+
{ value: "wide", title: "Wide" },
|
|
8
|
+
{ value: "wider", title: "Wider" },
|
|
9
|
+
{ value: "widest", title: "Widest" },
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default LetterSpacing;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const LineHeight = {
|
|
2
|
+
default: "normal",
|
|
3
|
+
items: [
|
|
4
|
+
{ value: "none", title: "None" },
|
|
5
|
+
{ value: "tight", title: "Tight" },
|
|
6
|
+
{ value: "snug", title: "Snug" },
|
|
7
|
+
{ value: "normal", title: "Normal" },
|
|
8
|
+
{ value: "relaxed", title: "Relaxed" },
|
|
9
|
+
{ value: "loose", title: "Loose" },
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default LineHeight;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const RevealAnimations = {
|
|
2
|
+
default: "fade",
|
|
3
|
+
items: [
|
|
4
|
+
{ value: "fade", title: "Fade" },
|
|
5
|
+
{ value: "slide", title: "Slide" },
|
|
6
|
+
{ value: "zoom", title: "Zoom" },
|
|
7
|
+
{ value: "lightSpeed", title: "Light Speed" },
|
|
8
|
+
{ value: "rotate", title: "Rotate" },
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default RevealAnimations;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const TextAlign = {
|
|
2
|
+
default: "text-left",
|
|
3
|
+
items: [
|
|
4
|
+
{
|
|
5
|
+
value: "text-left",
|
|
6
|
+
icon: "text.alignleft",
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
value: "text-center",
|
|
10
|
+
icon: "text.aligncenter",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "text-right",
|
|
14
|
+
icon: "text.alignright",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "text-justify",
|
|
18
|
+
icon: "text.justify",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default TextAlign;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const TransformOrigins = {
|
|
2
|
+
default: "center",
|
|
3
|
+
items: [
|
|
4
|
+
{
|
|
5
|
+
value: "center",
|
|
6
|
+
title: "Center",
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
value: "top",
|
|
10
|
+
title: "Top",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "top-right",
|
|
14
|
+
title: "Top Right",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "right",
|
|
18
|
+
title: "Right",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "bottom-right",
|
|
22
|
+
title: "Bottom Right",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "bottom",
|
|
26
|
+
title: "Bottom",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: "bottom-left",
|
|
30
|
+
title: "Bottom Left",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: "left",
|
|
34
|
+
title: "Left",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: "top-left",
|
|
38
|
+
title: "Top Left",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default TransformOrigins;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const TransitionNames = {
|
|
2
|
+
default: "dim",
|
|
3
|
+
items: [
|
|
4
|
+
{
|
|
5
|
+
value: "dim",
|
|
6
|
+
title: "Dim",
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
value: "zoomOut",
|
|
10
|
+
title: "Zoom Out",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "slide",
|
|
14
|
+
title: "Slide",
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default TransitionNames;
|
|
20
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as BackgroundType } from "./BackgroundType.js";
|
|
2
|
+
export { default as ButtonSize } from "./ButtonSize.js";
|
|
3
|
+
export { default as ContainerWidths } from "./ContainerWidths.js";
|
|
4
|
+
export { default as ContainerHeights } from "./ContainerHeights.js";
|
|
5
|
+
export { default as FontWeight } from "./FontWeight.js";
|
|
6
|
+
export { default as GradientDirection } from "./GradientDirection.js";
|
|
7
|
+
export { default as LetterSpacing } from "./LetterSpacing.js";
|
|
8
|
+
export { default as LineHeight } from "./LineHeight.js";
|
|
9
|
+
export { default as RevealAnimations } from "./RevealAnimations.js";
|
|
10
|
+
export { default as Slider } from "./Slider.js";
|
|
11
|
+
export { default as TextAlign } from "./TextAlign.js";
|
|
12
|
+
export { default as TransformOrigins } from "./TransformOrigins.js";
|
|
13
|
+
export { default as TransitionNames } from "./TransitionNames.js";
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
const globalAnimations = (app) => {
|
|
2
|
+
const {
|
|
3
|
+
globalScrollAnimationPreviewInEditor: previewInEditor,
|
|
4
|
+
|
|
5
|
+
globalScrollAnimationTrigger: triggerType, // none, instant, inView, scroll
|
|
6
|
+
|
|
7
|
+
globalScrollAnimationEase: ease,
|
|
8
|
+
globalScrollAnimationEaseCustom: easeCustom,
|
|
9
|
+
globalScrollAnimationEaseSteps: easeSteps,
|
|
10
|
+
globalScrollAnimationOrigin: origin,
|
|
11
|
+
globalScrollAnimationDuration: duration,
|
|
12
|
+
globalScrollAnimationDelay: delay,
|
|
13
|
+
|
|
14
|
+
// inView
|
|
15
|
+
globalScrollAnimationAmount: amount,
|
|
16
|
+
|
|
17
|
+
// spring
|
|
18
|
+
globalScrollAnimationIsSpring: isSpring,
|
|
19
|
+
globalScrollAnimationSpringStrength: springStrength,
|
|
20
|
+
globalScrollAnimationSpringAmplitude: springAmplitude,
|
|
21
|
+
|
|
22
|
+
// trigger positions
|
|
23
|
+
globalScrollAnimationTriggerElementPositionEnter: triggerElementPositionEnter,
|
|
24
|
+
globalScrollAnimationTriggerViewportPositionEnter: triggerViewportPositionEnter,
|
|
25
|
+
globalScrollAnimationTriggerElementPositionExit: triggerElementPositionExit,
|
|
26
|
+
globalScrollAnimationTriggerViewportPositionExit: triggerViewportPositionExit,
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// margin
|
|
30
|
+
globalScrollAnimationMarginTop: marginTop,
|
|
31
|
+
globalScrollAnimationMarginBottom: marginBottom,
|
|
32
|
+
|
|
33
|
+
// repeat
|
|
34
|
+
globalScrollAnimationRepeat: repeat,
|
|
35
|
+
globalScrollAnimationRepeatTimes: repeatTimes,
|
|
36
|
+
globalScrollAnimationRepeatYoyo: repeatYoyo,
|
|
37
|
+
globalScrollAnimationRepeatDelay: repeatDelay,
|
|
38
|
+
|
|
39
|
+
// Effects
|
|
40
|
+
// - start
|
|
41
|
+
globalScrollAnimationEnterState: enterState,
|
|
42
|
+
globalScrollAnimationOpacityEnterStart: opacityEnterStart,
|
|
43
|
+
globalScrollAnimationRotateEnterStart: rotateEnterStart,
|
|
44
|
+
globalScrollAnimationScaleEnterStart: scaleEnterStart,
|
|
45
|
+
globalScrollAnimationTranslateXEnterStart: translateXEnterStart,
|
|
46
|
+
globalScrollAnimationTranslateYEnterStart: translateYEnterStart,
|
|
47
|
+
// - end
|
|
48
|
+
globalScrollAnimationOpacityEnterEnd: opacityEnterEnd,
|
|
49
|
+
globalScrollAnimationRotateEnterEnd: rotateEnterEnd,
|
|
50
|
+
globalScrollAnimationScaleEnterEnd: scaleEnterEnd,
|
|
51
|
+
globalScrollAnimationTranslateXEnterEnd: translateXEnterEnd,
|
|
52
|
+
globalScrollAnimationTranslateYEnterEnd: translateYEnterEnd,
|
|
53
|
+
|
|
54
|
+
// exit
|
|
55
|
+
globalScrollAnimationExitEnabled: exitEnabled,
|
|
56
|
+
globalScrollAnimationOpacityExitEnd: opacityExitEnd,
|
|
57
|
+
globalScrollAnimationRotateExitEnd: rotateExitEnd,
|
|
58
|
+
globalScrollAnimationScaleExitEnd: scaleExitEnd,
|
|
59
|
+
globalScrollAnimationTranslateXExitEnd: translateXExitEnd,
|
|
60
|
+
globalScrollAnimationTranslateYExitEnd: translateYExitEnd,
|
|
61
|
+
} = app.props;
|
|
62
|
+
|
|
63
|
+
const { mode } = app.project;
|
|
64
|
+
const gsapEase = isSpring ? `elastic.out(${springAmplitude}, ${springStrength})` : ease;
|
|
65
|
+
const gsapMargin = (value) => value < 0 ? `-=${Math.abs(value)}` : `+=${value}`;
|
|
66
|
+
const scrollTriggerStart = `${triggerElementPositionEnter}${gsapMargin(marginTop)} ${triggerViewportPositionEnter}${gsapMargin(marginBottom)}`;
|
|
67
|
+
const scrollTriggerEnd = `${triggerElementPositionExit}${gsapMargin(marginTop)} ${triggerViewportPositionExit}${gsapMargin(marginBottom)}`;
|
|
68
|
+
|
|
69
|
+
const wantsRepeat = triggerType == 'instant' && repeat != 'false';
|
|
70
|
+
const gsapRepeat = !wantsRepeat
|
|
71
|
+
? false
|
|
72
|
+
: {
|
|
73
|
+
repeat: repeat == 'infinite' ? -1 : repeatTimes,
|
|
74
|
+
yoyo: repeatYoyo ? true : false,
|
|
75
|
+
repeatDelay: repeatDelay/1000,
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const onEnterFrom = {
|
|
79
|
+
opacity: opacityEnterStart/100,
|
|
80
|
+
rotation: rotateEnterStart,
|
|
81
|
+
scale: scaleEnterStart/100,
|
|
82
|
+
x: `${translateXEnterStart}%`,
|
|
83
|
+
y: `${translateYEnterStart}%`,
|
|
84
|
+
autoAlpha: 0,
|
|
85
|
+
duration: duration/1000,
|
|
86
|
+
ease: gsapEase,
|
|
87
|
+
transformOrigin: origin.replace("-", " "),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const onEnterTo = {
|
|
91
|
+
opacity: opacityEnterEnd/100,
|
|
92
|
+
rotation: rotateEnterEnd,
|
|
93
|
+
scale: scaleEnterEnd/100,
|
|
94
|
+
x: `${translateXEnterEnd}%`,
|
|
95
|
+
y: `${translateYEnterEnd}%`,
|
|
96
|
+
autoAlpha: 1,
|
|
97
|
+
duration: duration/1000,
|
|
98
|
+
ease: gsapEase,
|
|
99
|
+
transformOrigin: origin.replace("-", " "),
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const onLeaveTo = {
|
|
103
|
+
opacity: opacityExitEnd/100,
|
|
104
|
+
rotation: rotateExitEnd,
|
|
105
|
+
scale: scaleExitEnd/100,
|
|
106
|
+
x: `${translateXExitEnd}%`,
|
|
107
|
+
y: `${translateYExitEnd}%`,
|
|
108
|
+
autoAlpha: 0,
|
|
109
|
+
duration: duration/1000,
|
|
110
|
+
ease: gsapEase,
|
|
111
|
+
transformOrigin: origin.replace("-", " "),
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const cssVarsFrom = Object.entries(onEnterFrom).map(([key, value]) => `[--scroll-animation-from-${key}:${value}]`).join(" ");
|
|
115
|
+
const cssVarsTo = Object.entries(onEnterTo).map(([key, value]) => `[--scroll-animation-to-${key}:${value}]`).join(" ");
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
isEnabled: triggerType != "none",
|
|
119
|
+
isScroll: triggerType == "scroll",
|
|
120
|
+
isInView: triggerType == "inView",
|
|
121
|
+
isInstant: triggerType == "instant",
|
|
122
|
+
isExitEnabled: exitEnabled,
|
|
123
|
+
previewInEditor: previewInEditor && mode == "edit",
|
|
124
|
+
editorPreviewCSSVars: {
|
|
125
|
+
from: cssVarsFrom,
|
|
126
|
+
to: cssVarsTo,
|
|
127
|
+
duration: `${duration/1000}s`,
|
|
128
|
+
delay: `${delay/1000}s`,
|
|
129
|
+
},
|
|
130
|
+
data: {
|
|
131
|
+
"data-animation": "true",
|
|
132
|
+
"data-animation-trigger-type": triggerType,
|
|
133
|
+
"data-animation-enter-from": JSON.stringify(onEnterFrom).replace(/"/g, '"'),
|
|
134
|
+
"data-animation-enter-to": JSON.stringify(onEnterTo).replace(/"/g, '"'),
|
|
135
|
+
"data-animation-exit-to": JSON.stringify(onLeaveTo).replace(/"/g, '"'),
|
|
136
|
+
"data-animation-trigger-start": scrollTriggerStart,
|
|
137
|
+
"data-animation-trigger-end": scrollTriggerEnd,
|
|
138
|
+
"data-animation-repeat": gsapRepeat ? JSON.stringify(gsapRepeat).replace(/"/g, '"') : false
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const globalReveal = (rw) => {
|
|
2
|
+
const {
|
|
3
|
+
revealAnimationName: name,
|
|
4
|
+
revealAnimationDirection: direction,
|
|
5
|
+
revealPlay: play,
|
|
6
|
+
revealStart: start,
|
|
7
|
+
revealEnd: end,
|
|
8
|
+
revealDuration: duration,
|
|
9
|
+
revealDelay: delay,
|
|
10
|
+
revealEasing: easing,
|
|
11
|
+
revealDistance: distance,
|
|
12
|
+
revealDegrees: degrees,
|
|
13
|
+
revealScrub: scrub,
|
|
14
|
+
revealDebug: debug,
|
|
15
|
+
} = rw.props;
|
|
16
|
+
|
|
17
|
+
const { title } = rw.node;
|
|
18
|
+
const revealID = `reveal-${title.replace(/\s+/g, '-').toLowerCase()}`;
|
|
19
|
+
|
|
20
|
+
const gsapTriggerPoints = {
|
|
21
|
+
"entering-screen": "top bottom",
|
|
22
|
+
"middle-of-screen": "top center",
|
|
23
|
+
"exiting-screen": "top top",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const animationName = `${name}${direction.charAt(0).toUpperCase() + direction.slice(1)}In`;
|
|
27
|
+
const exitAnimationName = animationName.replace("In", "Out");
|
|
28
|
+
|
|
29
|
+
const data = {
|
|
30
|
+
"data-reveal": "",
|
|
31
|
+
"data-reveal-id": revealID,
|
|
32
|
+
"data-reveal-duration": `${duration/1000}`,
|
|
33
|
+
"data-reveal-delay": `${delay/1000}`,
|
|
34
|
+
"data-reveal-easing": easing,
|
|
35
|
+
"data-reveal-animation": animationName,
|
|
36
|
+
"data-reveal-exit-animation": exitAnimationName,
|
|
37
|
+
"data-reveal-play": play,
|
|
38
|
+
"data-reveal-start": gsapTriggerPoints[start] || gsapTriggerPoints["entering-screen"],
|
|
39
|
+
"data-reveal-end": gsapTriggerPoints[end] || gsapTriggerPoints["exiting-screen"],
|
|
40
|
+
"data-reveal-distance": distance,
|
|
41
|
+
"data-reveal-degrees": degrees,
|
|
42
|
+
"data-reveal-scrub": scrub || false,
|
|
43
|
+
"data-reveal-debug": debug || false,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return data;
|
|
47
|
+
|
|
48
|
+
};
|