rei-kit 2.2.0 → 2.3.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/README.md +39 -5
- package/dist/format-BEvBK1SJ.js +80 -0
- package/dist/format-BEvBK1SJ.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -53
- package/dist/index.js.map +1 -1
- package/dist/mobile.css +1 -0
- package/dist/motion/BaseMarquee.vue.d.ts +37 -0
- package/dist/motion/BaseReveal.vue.d.ts +34 -0
- package/dist/motion/CountUp.vue.d.ts +28 -0
- package/dist/motion/NumberTicker.vue.d.ts +33 -0
- package/dist/motion/TextRotate.vue.d.ts +24 -0
- package/dist/motion/TypeWriter.vue.d.ts +30 -0
- package/dist/motion/environment.d.ts +21 -0
- package/dist/motion/index.d.ts +15 -0
- package/dist/motion.css +119 -0
- package/dist/motion.js +434 -0
- package/dist/motion.js.map +1 -0
- package/dist/styles.css +154 -0
- package/dist/utils/format.d.ts +16 -0
- package/dist/web.css +1 -0
- package/package.json +7 -2
package/dist/mobile.css
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A row that scrolls sideways without end: logos, testimonials, a ticker.
|
|
3
|
+
*
|
|
4
|
+
* The content is rendered twice and the track moves by exactly one copy, so
|
|
5
|
+
* the loop has no seam and no measuring. The second copy is `inert` and
|
|
6
|
+
* hidden from assistive tech — a keyboard or screen-reader user meets each
|
|
7
|
+
* item once.
|
|
8
|
+
*
|
|
9
|
+
* It stops while hovered or focused, and on `paused`. For a reader who asked
|
|
10
|
+
* for less motion it does not move at all: it becomes a row that scrolls by
|
|
11
|
+
* hand, so nothing in it is out of reach.
|
|
12
|
+
*/
|
|
13
|
+
type __VLS_Props = {
|
|
14
|
+
/** Seconds for one full pass. Longer is slower; the speed does not change with the content's length. */
|
|
15
|
+
duration?: number | undefined;
|
|
16
|
+
/** Move left to right instead. */
|
|
17
|
+
reverse?: boolean | undefined;
|
|
18
|
+
/** Holds it still. */
|
|
19
|
+
paused?: boolean | undefined;
|
|
20
|
+
/** Fade the content out at both edges instead of cutting it. */
|
|
21
|
+
fade?: boolean | undefined;
|
|
22
|
+
/** Space between items, and between the end of one pass and the start of the next. Any CSS length. */
|
|
23
|
+
gap?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
type __VLS_Slots = {
|
|
26
|
+
/** The items. Rendered twice, the second copy inert. */
|
|
27
|
+
default: () => unknown;
|
|
28
|
+
};
|
|
29
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
31
|
+
declare const _default: typeof __VLS_export;
|
|
32
|
+
export default _default;
|
|
33
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
34
|
+
new (): {
|
|
35
|
+
$slots: S;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content that fades or rises into place as it scrolls into view.
|
|
3
|
+
*
|
|
4
|
+
* Visible by default and hidden only once it has mounted and found itself
|
|
5
|
+
* below the fold, so a page rendered on a server, or read without
|
|
6
|
+
* JavaScript, never has content stuck at zero opacity. For a reader who
|
|
7
|
+
* asked for less motion it is never hidden at all.
|
|
8
|
+
*
|
|
9
|
+
* For a staggered list, give each item a growing `delay`:
|
|
10
|
+
* `:delay="index * 60"`.
|
|
11
|
+
*/
|
|
12
|
+
type __VLS_Props = {
|
|
13
|
+
/** How it arrives: fading in, rising a little as it does, or growing to size. */
|
|
14
|
+
effect?: 'fade' | 'rise' | 'scale' | undefined;
|
|
15
|
+
/** Milliseconds to wait once it is in view — the stagger in a list. */
|
|
16
|
+
delay?: number | undefined;
|
|
17
|
+
/** Reveal once and stay. Off, it hides again each time it leaves the screen. */
|
|
18
|
+
once?: boolean | undefined;
|
|
19
|
+
/** The element to render. */
|
|
20
|
+
as?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
type __VLS_Slots = {
|
|
23
|
+
/** What is revealed. */
|
|
24
|
+
default: () => unknown;
|
|
25
|
+
};
|
|
26
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A number that counts up to its value once it scrolls into view.
|
|
3
|
+
*
|
|
4
|
+
* Where `NumberTicker` rolls digits, this passes through every value on the
|
|
5
|
+
* way — the right choice for a statistic a reader should watch grow, and for
|
|
6
|
+
* decimals, where rolling columns would spin without meaning anything.
|
|
7
|
+
*
|
|
8
|
+
* It waits until it is on screen, so a count below the fold is not over
|
|
9
|
+
* before anyone sees it. It eases out: fast at first, settling on the value,
|
|
10
|
+
* which reads as arriving rather than stopping. A screen reader hears the
|
|
11
|
+
* final value only. On a server, and for a reader who asked for less motion,
|
|
12
|
+
* it is the value from the start.
|
|
13
|
+
*/
|
|
14
|
+
type __VLS_Props = {
|
|
15
|
+
/** The number to count to. Change it and it counts on from where it is. */
|
|
16
|
+
value: number;
|
|
17
|
+
/** Where the first count starts. */
|
|
18
|
+
from?: number | undefined;
|
|
19
|
+
/** How long a count takes, in milliseconds. */
|
|
20
|
+
duration?: number | undefined;
|
|
21
|
+
/** Passed to `Intl.NumberFormat`. Set `maximumFractionDigits` to count in decimals. */
|
|
22
|
+
format?: Intl.NumberFormatOptions | undefined;
|
|
23
|
+
/** A BCP 47 tag. Unset, the kit's active formatting locale. */
|
|
24
|
+
locale?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const _default: typeof __VLS_export;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A number whose digits roll to their new value, like an odometer or a note
|
|
3
|
+
* counter.
|
|
4
|
+
*
|
|
5
|
+
* Each digit is a column of 0–9 moved into place, so going from 19 to 20
|
|
6
|
+
* turns the tens over rather than redrawing the whole number — the eye
|
|
7
|
+
* follows what changed. Positions are counted from the right, which keeps the
|
|
8
|
+
* units column the units column when the number grows a digit, and keeps a
|
|
9
|
+
* thousands separator where it was.
|
|
10
|
+
*
|
|
11
|
+
* Formatting is `Intl.NumberFormat`, so currency, percent, grouping and
|
|
12
|
+
* decimals are the locale's, and change with it. A screen reader hears the
|
|
13
|
+
* value once, as formatted text; the rolling columns are hidden from it.
|
|
14
|
+
*
|
|
15
|
+
* On a server, and for a reader who asked for less motion, it is the number
|
|
16
|
+
* and nothing else.
|
|
17
|
+
*/
|
|
18
|
+
type __VLS_Props = {
|
|
19
|
+
/** The number to show. Change it and the digits roll to the new one. */
|
|
20
|
+
value: number;
|
|
21
|
+
/**
|
|
22
|
+
* Where the digits start when the component mounts, so a count can roll up
|
|
23
|
+
* as the page opens. Unset, the first frame is already the value.
|
|
24
|
+
*/
|
|
25
|
+
from?: number | undefined;
|
|
26
|
+
/** Passed to `Intl.NumberFormat`: `{ style: 'currency', currency: 'TRY' }`, decimals, grouping. */
|
|
27
|
+
format?: Intl.NumberFormatOptions | undefined;
|
|
28
|
+
/** A BCP 47 tag. Unset, the kit's active formatting locale. */
|
|
29
|
+
locale?: string | undefined;
|
|
30
|
+
};
|
|
31
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
declare const _default: typeof __VLS_export;
|
|
33
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One word in a sentence that changes on its own: "Build it *glass*",
|
|
3
|
+
* then *brutal*, then *soft*.
|
|
4
|
+
*
|
|
5
|
+
* It stops while the pointer rests on it or it holds focus, and an app can
|
|
6
|
+
* stop it with `paused`. That is not a courtesy: content that moves on its
|
|
7
|
+
* own for more than five seconds needs a way to stop it, and hovering is
|
|
8
|
+
* where a reader's attention already is.
|
|
9
|
+
*
|
|
10
|
+
* For a reader who asked for less motion it does not rotate at all — the
|
|
11
|
+
* first word stands, which is a complete sentence. On a server it is the
|
|
12
|
+
* first word too.
|
|
13
|
+
*/
|
|
14
|
+
type __VLS_Props = {
|
|
15
|
+
/** The words, in order. The first is the one a server and a still page show. */
|
|
16
|
+
words: readonly string[];
|
|
17
|
+
/** How long each word stays, in milliseconds. */
|
|
18
|
+
interval?: number | undefined;
|
|
19
|
+
/** Holds the current word. For a pause button, or a section out of view. */
|
|
20
|
+
paused?: boolean | undefined;
|
|
21
|
+
};
|
|
22
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text that types itself out, and — given several lines — deletes each one
|
|
3
|
+
* and types the next.
|
|
4
|
+
*
|
|
5
|
+
* A screen reader hears the whole line, never a half-typed word: the typing
|
|
6
|
+
* is hidden from it and the full text sits beside it. The server and a
|
|
7
|
+
* reader who asked for less motion get the first line, complete.
|
|
8
|
+
*
|
|
9
|
+
* It stops while hovered or focused, and on `paused`, for the same reason
|
|
10
|
+
* `TextRotate` does.
|
|
11
|
+
*/
|
|
12
|
+
type __VLS_Props = {
|
|
13
|
+
/** One line to type, or several to type in turn. */
|
|
14
|
+
text: string | readonly string[];
|
|
15
|
+
/** Milliseconds per character typed. */
|
|
16
|
+
speed?: number | undefined;
|
|
17
|
+
/** Milliseconds per character deleted. */
|
|
18
|
+
deleteSpeed?: number | undefined;
|
|
19
|
+
/** How long a finished line stays before it is deleted, in milliseconds. */
|
|
20
|
+
hold?: number | undefined;
|
|
21
|
+
/** With several lines, start again after the last. With one, it is typed once. */
|
|
22
|
+
loop?: boolean | undefined;
|
|
23
|
+
/** Show a blinking caret after the text. */
|
|
24
|
+
cursor?: boolean | undefined;
|
|
25
|
+
/** Stops where it is. */
|
|
26
|
+
paused?: boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What every moving part asks before it moves.
|
|
3
|
+
*
|
|
4
|
+
* Kept in one place so the answers cannot drift apart: a counter that honoured
|
|
5
|
+
* reduced motion beside a marquee that did not would be worse than neither.
|
|
6
|
+
* Each is safe to call on a server, where the answer is "do not move" — the
|
|
7
|
+
* server renders the final state, and that is what a reader without
|
|
8
|
+
* JavaScript should see.
|
|
9
|
+
*/
|
|
10
|
+
/** Whether the reader has asked the operating system for less motion. */
|
|
11
|
+
export declare function prefersReducedMotion(): boolean;
|
|
12
|
+
/** One frame from now, or the nearest thing to it where frames do not exist. */
|
|
13
|
+
export declare function nextFrame(callback: () => void): () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Calls `callback` with whether `element` is on screen, each time that
|
|
16
|
+
* changes. Returns the function that stops watching.
|
|
17
|
+
*
|
|
18
|
+
* Without `IntersectionObserver` the element counts as visible straight away:
|
|
19
|
+
* an animation that never starts is a missing number, not a missing flourish.
|
|
20
|
+
*/
|
|
21
|
+
export declare function watchVisibility(element: Element, callback: (visible: boolean) => void, threshold?: number): () => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rei-kit/motion — numbers that count, words that change, content that
|
|
3
|
+
* arrives.
|
|
4
|
+
*
|
|
5
|
+
* Every part here renders its final state on a server and for a reader who
|
|
6
|
+
* asked for less motion, keeps assistive tech to the finished value, and
|
|
7
|
+
* stops when hovered or focused if it moves on its own. The utilities that go
|
|
8
|
+
* with them are in `rei-kit/motion.css`, which both presets include.
|
|
9
|
+
*/
|
|
10
|
+
export { default as NumberTicker } from './NumberTicker.vue';
|
|
11
|
+
export { default as CountUp } from './CountUp.vue';
|
|
12
|
+
export { default as TextRotate } from './TextRotate.vue';
|
|
13
|
+
export { default as TypeWriter } from './TypeWriter.vue';
|
|
14
|
+
export { default as BaseReveal } from './BaseReveal.vue';
|
|
15
|
+
export { default as BaseMarquee } from './BaseMarquee.vue';
|
package/dist/motion.css
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* rei-kit — motion utilities.
|
|
2
|
+
*
|
|
3
|
+
* Small loops and entrances for the things a page wants to draw the eye to:
|
|
4
|
+
*
|
|
5
|
+
* animate-float drifts up and down — a badge, an illustration
|
|
6
|
+
* animate-pulse-soft breathes — a live indicator, a call to action
|
|
7
|
+
* animate-glow a ring that swells and fades, in the primary colour
|
|
8
|
+
* animate-wiggle a small shake — "look here", once in a while
|
|
9
|
+
* animate-pop grows into place once — something that just arrived
|
|
10
|
+
* text-shimmer light passing across text, in the palette's colours
|
|
11
|
+
*
|
|
12
|
+
* Declared as theme animations, so Tailwind emits a keyframe only for the
|
|
13
|
+
* utilities an app actually uses. Colours come from the roles, so every one
|
|
14
|
+
* follows the palette. All of them stop for a reader who asked for less
|
|
15
|
+
* motion — here, once, rather than left to each app to remember
|
|
16
|
+
* `motion-safe:`. */
|
|
17
|
+
@theme {
|
|
18
|
+
--animate-float: rk-float 3.2s ease-in-out infinite;
|
|
19
|
+
--animate-pulse-soft: rk-pulse-soft 2.4s ease-in-out infinite;
|
|
20
|
+
--animate-glow: rk-glow 2.4s ease-out infinite;
|
|
21
|
+
--animate-wiggle: rk-wiggle 2.8s ease-in-out infinite;
|
|
22
|
+
--animate-pop: rk-pop 340ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
|
|
23
|
+
|
|
24
|
+
@keyframes rk-float {
|
|
25
|
+
0%,
|
|
26
|
+
100% {
|
|
27
|
+
transform: translateY(0);
|
|
28
|
+
}
|
|
29
|
+
50% {
|
|
30
|
+
transform: translateY(-6px);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@keyframes rk-pulse-soft {
|
|
35
|
+
0%,
|
|
36
|
+
100% {
|
|
37
|
+
opacity: 1;
|
|
38
|
+
transform: scale(1);
|
|
39
|
+
}
|
|
40
|
+
50% {
|
|
41
|
+
opacity: 0.72;
|
|
42
|
+
transform: scale(0.97);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@keyframes rk-glow {
|
|
47
|
+
0% {
|
|
48
|
+
box-shadow: 0 0 0 0 color-mix(in oklab, var(--color-primary) 45%, transparent);
|
|
49
|
+
}
|
|
50
|
+
100% {
|
|
51
|
+
box-shadow: 0 0 0 12px color-mix(in oklab, var(--color-primary) 0%, transparent);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Still for most of the loop: a wiggle that never stops is noise. */
|
|
56
|
+
@keyframes rk-wiggle {
|
|
57
|
+
0%,
|
|
58
|
+
80%,
|
|
59
|
+
100% {
|
|
60
|
+
transform: rotate(0);
|
|
61
|
+
}
|
|
62
|
+
84% {
|
|
63
|
+
transform: rotate(-6deg);
|
|
64
|
+
}
|
|
65
|
+
88% {
|
|
66
|
+
transform: rotate(5deg);
|
|
67
|
+
}
|
|
68
|
+
92% {
|
|
69
|
+
transform: rotate(-3deg);
|
|
70
|
+
}
|
|
71
|
+
96% {
|
|
72
|
+
transform: rotate(2deg);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@keyframes rk-pop {
|
|
77
|
+
from {
|
|
78
|
+
opacity: 0;
|
|
79
|
+
transform: scale(0.85);
|
|
80
|
+
}
|
|
81
|
+
to {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
transform: scale(1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@keyframes rk-shimmer {
|
|
88
|
+
to {
|
|
89
|
+
background-position: -200% 0;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Text painted with a band of light moving across it. The ink stays readable
|
|
95
|
+
the whole way: the band is the primary colour, not white. */
|
|
96
|
+
@utility text-shimmer {
|
|
97
|
+
background: linear-gradient(
|
|
98
|
+
100deg,
|
|
99
|
+
var(--color-ink) 40%,
|
|
100
|
+
var(--color-primary) 50%,
|
|
101
|
+
var(--color-ink) 60%
|
|
102
|
+
)
|
|
103
|
+
0 0 / 200% 100%;
|
|
104
|
+
-webkit-background-clip: text;
|
|
105
|
+
background-clip: text;
|
|
106
|
+
color: transparent;
|
|
107
|
+
animation: rk-shimmer 2.8s linear infinite;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@media (prefers-reduced-motion: reduce) {
|
|
111
|
+
.animate-float,
|
|
112
|
+
.animate-pulse-soft,
|
|
113
|
+
.animate-glow,
|
|
114
|
+
.animate-wiggle,
|
|
115
|
+
.animate-pop,
|
|
116
|
+
.text-shimmer {
|
|
117
|
+
animation: none;
|
|
118
|
+
}
|
|
119
|
+
}
|