@lovince/motion 0.0.0-stage → 0.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 +21 -0
- package/README.md +254 -2
- package/dist/accessibility/focus-management.d.ts +9 -0
- package/dist/accessibility/index.d.ts +2 -0
- package/dist/accessibility/reduced-motion.d.ts +7 -0
- package/dist/core/cleanup.d.ts +10 -0
- package/dist/core/config.d.ts +7 -0
- package/dist/core/context.d.ts +40 -0
- package/dist/core/entrance.d.ts +22 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/preferences.d.ts +6 -0
- package/dist/core/targets.d.ts +4 -0
- package/dist/core/types.d.ts +20 -0
- package/dist/css/dom.d.ts +9 -0
- package/dist/css/fade-in.d.ts +25 -0
- package/dist/css/index.d.ts +3 -0
- package/dist/css/reveal.d.ts +22 -0
- package/dist/dom-CK6FnKcV.js +74 -0
- package/dist/focus-management-DTJ2C7Pn.js +8 -0
- package/dist/gsap/engine.d.ts +17 -0
- package/dist/gsap/horizontal-scroll.d.ts +14 -0
- package/dist/gsap/index.d.ts +8 -0
- package/dist/gsap/parallax.d.ts +14 -0
- package/dist/gsap/scroll-reveal.d.ts +18 -0
- package/dist/gsap/split-text.d.ts +27 -0
- package/dist/gsap/stagger.d.ts +15 -0
- package/dist/gsap/timeline.d.ts +23 -0
- package/dist/gsap.js +96 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +75 -0
- package/dist/presets/entrance.d.ts +20 -0
- package/dist/presets/image.d.ts +14 -0
- package/dist/presets/index.d.ts +5 -0
- package/dist/presets/navigation.d.ts +17 -0
- package/dist/presets/page-transition.d.ts +26 -0
- package/dist/presets/typography.d.ts +20 -0
- package/dist/presets.js +138 -0
- package/dist/reveal-By5zvLLc.js +39 -0
- package/dist/scroll/create-smooth-scroll.d.ts +37 -0
- package/dist/scroll/gsap-integration.d.ts +8 -0
- package/dist/scroll/index.d.ts +1 -0
- package/dist/scroll.js +89 -0
- package/dist/split-text-Cnl9gkUu.js +141 -0
- package/dist/targets-x7JiHhWI.js +49 -0
- package/dist/timeline-Cg3eq5ft.js +60 -0
- package/dist/vue/index.d.ts +27 -0
- package/dist/vue.js +33 -0
- package/package.json +97 -4
- package/styles/motion.css +4 -0
- package/styles/presets.css +218 -0
- package/styles/tokens.css +23 -0
- package/styles/utilities.css +128 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Scroll reveals for `revealOnScroll` / `v-reveal`. An element is hidden only
|
|
3
|
+
* while `data-motion-state="hidden"` is set, which only the script does, so
|
|
4
|
+
* without JavaScript, or after cleanup, content is simply visible.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
[data-motion-reveal] {
|
|
8
|
+
transition-property: opacity, transform, clip-path;
|
|
9
|
+
transition-duration: var(--motion-duration-slow);
|
|
10
|
+
transition-timing-function: var(--motion-ease-emphasized);
|
|
11
|
+
transition-delay: var(--motion-delay, 0s);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[data-motion-reveal][data-motion-state='hidden'] {
|
|
15
|
+
opacity: 0;
|
|
16
|
+
transition-delay: 0s;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
[data-motion-reveal='fade-up'][data-motion-state='hidden'] {
|
|
20
|
+
transform: translate3d(0, var(--motion-distance-md), 0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
[data-motion-reveal='fade-down'][data-motion-state='hidden'] {
|
|
24
|
+
transform: translate3d(0, calc(var(--motion-distance-md) * -1), 0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
[data-motion-reveal='slide-left'][data-motion-state='hidden'] {
|
|
28
|
+
transform: translate3d(var(--motion-distance-md), 0, 0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
[data-motion-reveal='slide-right'][data-motion-state='hidden'] {
|
|
32
|
+
transform: translate3d(calc(var(--motion-distance-md) * -1), 0, 0);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
[data-motion-reveal='scale'][data-motion-state='hidden'] {
|
|
36
|
+
transform: scale(0.94);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[data-motion-reveal='clip'][data-motion-state='hidden'] {
|
|
40
|
+
opacity: 1;
|
|
41
|
+
clip-path: inset(0% 0% 100% 0%);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[data-motion-reveal='clip'][data-motion-state='visible'] {
|
|
45
|
+
clip-path: inset(0% 0% 0% 0%);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@media (prefers-reduced-motion: reduce) {
|
|
49
|
+
[data-motion-reveal] {
|
|
50
|
+
transition: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
[data-motion-reveal][data-motion-state='hidden'] {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
transform: none;
|
|
56
|
+
clip-path: none;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* Stage carousel for `CarouselRoot mode="stage"`: slides stacked in the
|
|
62
|
+
* viewport, one in front and its neighbours peeking out dimmed behind it.
|
|
63
|
+
* Mark an image with `data-carousel-media` and a caption with
|
|
64
|
+
* `data-carousel-copy` to get their motion too.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
[data-mode='stage'][data-carousel-viewport] {
|
|
68
|
+
--lovince-carousel-duration: calc(var(--motion-duration-scene) * 1.5);
|
|
69
|
+
--lovince-carousel-ease: var(--motion-ease-emphasized);
|
|
70
|
+
--lovince-carousel-peek: 22.5%;
|
|
71
|
+
--lovince-carousel-active-size: 60%;
|
|
72
|
+
--lovince-carousel-side-size: 91.5%;
|
|
73
|
+
--lovince-carousel-side-height: 72%;
|
|
74
|
+
--lovince-carousel-side-opacity: 0.7;
|
|
75
|
+
--lovince-carousel-side-dim: 0.62;
|
|
76
|
+
position: relative;
|
|
77
|
+
isolation: isolate;
|
|
78
|
+
aspect-ratio: var(--lovince-carousel-ratio, 2.7);
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
outline-offset: var(--lovince-space-1);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[data-mode='stage'][data-carousel-viewport] > [data-carousel-slide] {
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: 50%;
|
|
86
|
+
left: 50%;
|
|
87
|
+
width: var(--lovince-carousel-active-size);
|
|
88
|
+
height: 81%;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
border-radius: var(--lovince-radius-md);
|
|
91
|
+
transform: translate(-50%, -50%);
|
|
92
|
+
opacity: 0;
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
z-index: 0;
|
|
95
|
+
transition:
|
|
96
|
+
transform var(--lovince-carousel-duration) var(--lovince-carousel-ease),
|
|
97
|
+
width var(--lovince-carousel-duration) var(--lovince-carousel-ease),
|
|
98
|
+
height var(--lovince-carousel-duration) var(--lovince-carousel-ease),
|
|
99
|
+
opacity calc(var(--lovince-carousel-duration) * 0.82) var(--lovince-carousel-ease),
|
|
100
|
+
filter var(--lovince-carousel-duration) var(--lovince-carousel-ease),
|
|
101
|
+
box-shadow var(--lovince-carousel-duration) var(--lovince-carousel-ease);
|
|
102
|
+
will-change: transform, opacity;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='active'] {
|
|
106
|
+
height: 100%;
|
|
107
|
+
opacity: 1;
|
|
108
|
+
z-index: 3;
|
|
109
|
+
pointer-events: auto;
|
|
110
|
+
box-shadow: var(--lovince-shadow-lg);
|
|
111
|
+
transform: translate(calc(-50% + var(--lovince-carousel-drag, 0px)), -50%);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='previous'],
|
|
115
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='next'] {
|
|
116
|
+
width: var(--lovince-carousel-side-size);
|
|
117
|
+
height: var(--lovince-carousel-side-height);
|
|
118
|
+
opacity: var(--lovince-carousel-side-opacity);
|
|
119
|
+
z-index: 2;
|
|
120
|
+
filter: brightness(var(--lovince-carousel-side-dim));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='previous'] {
|
|
124
|
+
transform: translate(calc(-50% - var(--lovince-carousel-peek) + var(--lovince-carousel-drag, 0px)), -50%);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='next'] {
|
|
128
|
+
transform: translate(calc(-50% + var(--lovince-carousel-peek) + var(--lovince-carousel-drag, 0px)), -50%);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='far'] {
|
|
132
|
+
transform: translate(-50%, -45%) scale(0.94);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
[data-mode='stage'][data-swiping] > [data-carousel-slide] {
|
|
136
|
+
transition: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
[data-mode='stage'][data-orientation='vertical'] {
|
|
140
|
+
aspect-ratio: var(--lovince-carousel-ratio, 0.75);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-carousel-slide] {
|
|
144
|
+
width: 81%;
|
|
145
|
+
height: var(--lovince-carousel-active-size);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='active'] {
|
|
149
|
+
width: 100%;
|
|
150
|
+
transform: translate(-50%, calc(-50% + var(--lovince-carousel-drag, 0px)));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='previous'],
|
|
154
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='next'] {
|
|
155
|
+
width: var(--lovince-carousel-side-height);
|
|
156
|
+
height: var(--lovince-carousel-side-size);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='previous'] {
|
|
160
|
+
transform: translate(-50%, calc(-50% - var(--lovince-carousel-peek) + var(--lovince-carousel-drag, 0px)));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='next'] {
|
|
164
|
+
transform: translate(-50%, calc(-50% + var(--lovince-carousel-peek) + var(--lovince-carousel-drag, 0px)));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='far'] {
|
|
168
|
+
transform: translate(-45%, -50%) scale(0.94);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[data-mode='stage'] [data-carousel-media] {
|
|
172
|
+
display: block;
|
|
173
|
+
width: 100%;
|
|
174
|
+
height: 100%;
|
|
175
|
+
object-fit: cover;
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
transition: transform calc(var(--lovince-carousel-duration) * 1.64) var(--lovince-carousel-ease);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='active'] [data-carousel-media] {
|
|
181
|
+
transform: scale(1.015);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
[data-mode='stage'] [data-carousel-copy] {
|
|
185
|
+
opacity: 0;
|
|
186
|
+
transform: translate3d(0, var(--motion-distance-sm), 0);
|
|
187
|
+
transition:
|
|
188
|
+
opacity calc(var(--lovince-carousel-duration) * 0.6) var(--lovince-carousel-ease),
|
|
189
|
+
transform calc(var(--lovince-carousel-duration) * 0.72) var(--lovince-carousel-ease);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='active'] [data-carousel-copy] {
|
|
193
|
+
opacity: 1;
|
|
194
|
+
transform: none;
|
|
195
|
+
transition-delay: var(--motion-duration-normal);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@media (max-width: 43.75rem) {
|
|
199
|
+
[data-mode='stage'][data-carousel-viewport]:not([data-orientation='vertical']) {
|
|
200
|
+
--lovince-carousel-peek: 31%;
|
|
201
|
+
--lovince-carousel-active-size: 76%;
|
|
202
|
+
--lovince-carousel-side-opacity: 0.55;
|
|
203
|
+
aspect-ratio: var(--lovince-carousel-ratio, 1.47);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@media (prefers-reduced-motion: reduce) {
|
|
208
|
+
[data-mode='stage'][data-carousel-viewport] > [data-carousel-slide],
|
|
209
|
+
[data-mode='stage'] [data-carousel-media],
|
|
210
|
+
[data-mode='stage'] [data-carousel-copy] {
|
|
211
|
+
transition-duration: 0s;
|
|
212
|
+
transition-delay: 0s;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='active'] [data-carousel-media] {
|
|
216
|
+
transform: none;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Motion tokens: the spec's vocabulary, mapped onto the Lovince scales so CSS
|
|
3
|
+
* and JS motion share one source. JS reads the same values from
|
|
4
|
+
* @lovince/tokens (`defaultMotionConfig`, `motionDistance`).
|
|
5
|
+
*/
|
|
6
|
+
@import '@lovince/tokens/tokens.css';
|
|
7
|
+
|
|
8
|
+
:root {
|
|
9
|
+
--motion-duration-instant: var(--lovince-duration-press);
|
|
10
|
+
--motion-duration-fast: var(--lovince-duration-fast);
|
|
11
|
+
--motion-duration-normal: var(--lovince-duration-state);
|
|
12
|
+
--motion-duration-slow: var(--lovince-duration-overlay);
|
|
13
|
+
--motion-duration-scene: var(--lovince-duration-travel);
|
|
14
|
+
|
|
15
|
+
--motion-ease-standard: var(--lovince-ease-standard);
|
|
16
|
+
--motion-ease-emphasized: var(--lovince-ease-emphasized);
|
|
17
|
+
--motion-ease-exit: var(--lovince-ease-in);
|
|
18
|
+
--motion-ease-reversible: var(--lovince-ease-in-out);
|
|
19
|
+
|
|
20
|
+
--motion-distance-sm: var(--lovince-space-3);
|
|
21
|
+
--motion-distance-md: var(--lovince-space-6);
|
|
22
|
+
--motion-distance-lg: var(--lovince-space-12);
|
|
23
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Opt-in utilities. Every rule sits behind a `motion-*` class, so nothing
|
|
3
|
+
* here touches an element that did not ask for it. No JavaScript needed.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.motion-link {
|
|
7
|
+
position: relative;
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.motion-link::after {
|
|
12
|
+
content: '';
|
|
13
|
+
position: absolute;
|
|
14
|
+
inset-inline: 0;
|
|
15
|
+
bottom: -0.2em;
|
|
16
|
+
height: 1px;
|
|
17
|
+
background: currentColor;
|
|
18
|
+
transform: scaleX(0);
|
|
19
|
+
transform-origin: right;
|
|
20
|
+
transition: transform var(--motion-duration-normal) var(--motion-ease-standard);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.motion-link:hover::after,
|
|
24
|
+
.motion-link:focus-visible::after {
|
|
25
|
+
transform: scaleX(1);
|
|
26
|
+
transform-origin: left;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.motion-lift {
|
|
30
|
+
transition: transform var(--motion-duration-fast) var(--motion-ease-standard);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.motion-lift:hover,
|
|
34
|
+
.motion-lift:focus-visible {
|
|
35
|
+
transform: translate3d(0, calc(var(--motion-distance-sm) / -3), 0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.motion-press {
|
|
39
|
+
transition: transform var(--motion-duration-instant) var(--motion-ease-standard);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.motion-press:active {
|
|
43
|
+
transform: scale(0.97);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@keyframes motion-fade-up {
|
|
47
|
+
from {
|
|
48
|
+
opacity: 0;
|
|
49
|
+
transform: translate3d(0, var(--motion-distance-md), 0);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes motion-fade-in {
|
|
54
|
+
from {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@keyframes motion-scale-in {
|
|
60
|
+
from {
|
|
61
|
+
opacity: 0;
|
|
62
|
+
transform: scale(0.94);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@keyframes motion-spin {
|
|
67
|
+
to {
|
|
68
|
+
transform: rotate(1turn);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@keyframes motion-pulse {
|
|
73
|
+
50% {
|
|
74
|
+
opacity: 0.5;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* One-shot entrances on load; `--motion-delay` staggers them by hand. */
|
|
79
|
+
.motion-fade-up,
|
|
80
|
+
.motion-fade-in,
|
|
81
|
+
.motion-scale-in {
|
|
82
|
+
animation-duration: var(--motion-duration-slow);
|
|
83
|
+
animation-timing-function: var(--motion-ease-emphasized);
|
|
84
|
+
animation-delay: var(--motion-delay, 0s);
|
|
85
|
+
animation-fill-mode: both;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.motion-fade-up {
|
|
89
|
+
animation-name: motion-fade-up;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.motion-fade-in {
|
|
93
|
+
animation-name: motion-fade-in;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.motion-scale-in {
|
|
97
|
+
animation-name: motion-scale-in;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.motion-spin {
|
|
101
|
+
animation: motion-spin calc(var(--motion-duration-scene) * 1.5) linear infinite;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.motion-pulse {
|
|
105
|
+
animation: motion-pulse calc(var(--motion-duration-scene) * 2) var(--motion-ease-reversible) infinite;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@media (prefers-reduced-motion: reduce) {
|
|
109
|
+
.motion-link::after,
|
|
110
|
+
.motion-lift,
|
|
111
|
+
.motion-press {
|
|
112
|
+
transition: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.motion-lift:hover,
|
|
116
|
+
.motion-lift:focus-visible,
|
|
117
|
+
.motion-press:active {
|
|
118
|
+
transform: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.motion-fade-up,
|
|
122
|
+
.motion-fade-in,
|
|
123
|
+
.motion-scale-in,
|
|
124
|
+
.motion-spin,
|
|
125
|
+
.motion-pulse {
|
|
126
|
+
animation: none;
|
|
127
|
+
}
|
|
128
|
+
}
|