@lovince/motion 0.0.0-stage → 0.1.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.
Files changed (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +254 -2
  3. package/dist/accessibility/focus-management.d.ts +9 -0
  4. package/dist/accessibility/index.d.ts +2 -0
  5. package/dist/accessibility/reduced-motion.d.ts +7 -0
  6. package/dist/core/cleanup.d.ts +10 -0
  7. package/dist/core/config.d.ts +7 -0
  8. package/dist/core/context.d.ts +40 -0
  9. package/dist/core/entrance.d.ts +22 -0
  10. package/dist/core/index.d.ts +7 -0
  11. package/dist/core/preferences.d.ts +6 -0
  12. package/dist/core/targets.d.ts +4 -0
  13. package/dist/core/types.d.ts +20 -0
  14. package/dist/css/dom.d.ts +9 -0
  15. package/dist/css/fade-in.d.ts +25 -0
  16. package/dist/css/index.d.ts +3 -0
  17. package/dist/css/reveal.d.ts +22 -0
  18. package/dist/dom-CK6FnKcV.js +74 -0
  19. package/dist/focus-management-DTJ2C7Pn.js +8 -0
  20. package/dist/gsap/engine.d.ts +17 -0
  21. package/dist/gsap/horizontal-scroll.d.ts +14 -0
  22. package/dist/gsap/index.d.ts +8 -0
  23. package/dist/gsap/parallax.d.ts +14 -0
  24. package/dist/gsap/scroll-reveal.d.ts +18 -0
  25. package/dist/gsap/split-text.d.ts +27 -0
  26. package/dist/gsap/stagger.d.ts +15 -0
  27. package/dist/gsap/timeline.d.ts +23 -0
  28. package/dist/gsap.js +96 -0
  29. package/dist/index.d.ts +4 -0
  30. package/dist/index.js +75 -0
  31. package/dist/presets/entrance.d.ts +20 -0
  32. package/dist/presets/image.d.ts +14 -0
  33. package/dist/presets/index.d.ts +5 -0
  34. package/dist/presets/navigation.d.ts +17 -0
  35. package/dist/presets/page-transition.d.ts +26 -0
  36. package/dist/presets/typography.d.ts +20 -0
  37. package/dist/presets.js +138 -0
  38. package/dist/reveal-By5zvLLc.js +39 -0
  39. package/dist/scroll/create-smooth-scroll.d.ts +37 -0
  40. package/dist/scroll/gsap-integration.d.ts +8 -0
  41. package/dist/scroll/index.d.ts +1 -0
  42. package/dist/scroll.js +89 -0
  43. package/dist/split-text-Cnl9gkUu.js +141 -0
  44. package/dist/targets-x7JiHhWI.js +49 -0
  45. package/dist/timeline-Cg3eq5ft.js +60 -0
  46. package/dist/vue/index.d.ts +27 -0
  47. package/dist/vue.js +33 -0
  48. package/package.json +97 -4
  49. package/styles/motion.css +4 -0
  50. package/styles/presets.css +58 -0
  51. package/styles/tokens.css +23 -0
  52. package/styles/utilities.css +128 -0
package/dist/scroll.js ADDED
@@ -0,0 +1,89 @@
1
+ import { a as e, n as t, r as n, s as r } from "./targets-x7JiHhWI.js";
2
+ import i from "lenis";
3
+ //#region src/scroll/create-smooth-scroll.ts
4
+ var a = /* @__PURE__ */ new Map(), o = (e) => {
5
+ if (typeof window > "u") return null;
6
+ let t = e.lenis?.wrapper;
7
+ return t === void 0 || t === window ? window : t instanceof Element ? t : window;
8
+ }, s = (e, n, r) => {
9
+ let i = r.immediate === !0 ? "auto" : "smooth", a = r.offset ?? 0;
10
+ if (typeof n == "number") {
11
+ e.scrollTo({
12
+ top: n + a,
13
+ behavior: i
14
+ });
15
+ return;
16
+ }
17
+ let o = t(n)[0];
18
+ if (o === void 0) return;
19
+ let s = e instanceof Element ? e.getBoundingClientRect().top - e.scrollTop : -window.scrollY;
20
+ e.scrollTo({
21
+ top: o.getBoundingClientRect().top - s + a,
22
+ behavior: i
23
+ });
24
+ }, c = (c = {}) => {
25
+ let l = o(c);
26
+ if (l === null) return {
27
+ lenis: () => null,
28
+ scrollTo: r,
29
+ stop: r,
30
+ start: r,
31
+ destroy: r
32
+ };
33
+ let u = a.get(l);
34
+ if (u === void 0) {
35
+ let t = c.respectReducedMotion !== !1, o = {
36
+ lenis: null,
37
+ stopDriver: r,
38
+ handles: 0,
39
+ release: r
40
+ }, s = () => {
41
+ if (o.lenis !== null) return;
42
+ let e = new i({
43
+ ...c.lenis,
44
+ autoRaf: c.driver === void 0
45
+ });
46
+ o.lenis = e, o.stopDriver = c.driver?.start(e) ?? r;
47
+ }, d = () => {
48
+ o.stopDriver(), o.stopDriver = r, o.lenis?.destroy(), o.lenis = null;
49
+ };
50
+ (!t || n() === "no-preference") && s();
51
+ let f = t ? e((e) => e === "reduce" ? d() : s()) : r;
52
+ o.release = () => {
53
+ f(), d();
54
+ }, a.set(l, o), u = o;
55
+ }
56
+ let d = u;
57
+ d.handles += 1;
58
+ let f = !1;
59
+ return {
60
+ lenis: () => d.lenis,
61
+ scrollTo: (e, r = {}) => {
62
+ let i = d.lenis;
63
+ if (i === null) {
64
+ s(l, e, {
65
+ ...r,
66
+ immediate: r.immediate === !0 || n() === "reduce"
67
+ });
68
+ return;
69
+ }
70
+ let a = {
71
+ offset: r.offset ?? 0,
72
+ immediate: r.immediate === !0
73
+ };
74
+ if (typeof e == "number") {
75
+ i.scrollTo(e, a);
76
+ return;
77
+ }
78
+ let o = t(e)[0];
79
+ o instanceof HTMLElement && i.scrollTo(o, a);
80
+ },
81
+ stop: () => d.lenis?.stop(),
82
+ start: () => d.lenis?.start(),
83
+ destroy: () => {
84
+ f || (f = !0, --d.handles, !(d.handles > 0) && (d.release(), a.delete(l)));
85
+ }
86
+ };
87
+ };
88
+ //#endregion
89
+ export { c as createSmoothScroll };
@@ -0,0 +1,141 @@
1
+ import { s as e } from "./dom-CK6FnKcV.js";
2
+ //#region src/core/entrance.ts
3
+ var t = (e) => ({
4
+ opacity: 0,
5
+ x: 0,
6
+ y: 0,
7
+ scale: 1,
8
+ clip: !1,
9
+ ...e
10
+ }), n = {
11
+ fade: t({}),
12
+ "fade-up": t({ y: 1 }),
13
+ "fade-down": t({ y: -1 }),
14
+ "slide-left": t({ x: 1 }),
15
+ "slide-right": t({ x: -1 }),
16
+ scale: t({ scale: .94 }),
17
+ clip: t({
18
+ opacity: 1,
19
+ clip: !0
20
+ })
21
+ }, r = "inset(0% 0% 100% 0%)", i = "inset(0% 0% 0% 0%)", a = (t, i = "md") => {
22
+ let a = n[t], o = e(i);
23
+ return {
24
+ opacity: a.opacity,
25
+ x: a.x * o,
26
+ y: a.y * o,
27
+ scale: a.scale,
28
+ clipPath: a.clip ? r : null
29
+ };
30
+ }, o = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0", s = (e) => /^\s+$/u.test(e), c = (e) => typeof Intl < "u" && "Segmenter" in Intl ? Array.from(new Intl.Segmenter(void 0, { granularity: "word" }).segment(e), (e) => ({
31
+ text: e.segment,
32
+ wordLike: e.isWordLike === !0
33
+ })) : e.split(/(\s+)/u).filter((e) => e !== "").map((e) => ({
34
+ text: e,
35
+ wordLike: !s(e)
36
+ })), l = (e) => {
37
+ let t = [], n = "", r = !1, i = () => {
38
+ n !== "" && t.push(n), n = "", r = !1;
39
+ };
40
+ for (let a of c(e)) {
41
+ if (s(a.text)) {
42
+ i(), t.push(a.text);
43
+ continue;
44
+ }
45
+ a.wordLike && r && i(), n += a.text, r ||= a.wordLike;
46
+ }
47
+ return i(), t;
48
+ }, u = (e) => typeof Intl < "u" && "Segmenter" in Intl ? Array.from(new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(e), (e) => e.segment) : Array.from(e), d = (e, t, n) => {
49
+ let r = e.createElement("span");
50
+ return r.setAttribute("data-motion-split", t), r.style.display = t === "line" || t === "line-inner" ? "block" : "inline-block", n !== void 0 && (r.textContent = n), r;
51
+ }, f = (e) => Array.from(e.childNodes).flatMap((e) => e instanceof Text ? e.data === "" ? [] : [e] : f(e)), p = (e) => {
52
+ let t = [], n = null;
53
+ for (let r of e) {
54
+ let e = r.offsetTop;
55
+ (n === null || Math.abs(e - n) > 1) && (t.push([]), n = e), t[t.length - 1]?.push(r);
56
+ }
57
+ return t;
58
+ }, m = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), g = (e, t) => {
59
+ let n = e.ownerDocument, r = t.by ?? "words", i = Array.from(e.childNodes).every((e) => e instanceof Text) ? e.textContent ?? "" : null, a = [], c = [], g = [];
60
+ for (let t of f(e)) {
61
+ let e = l(t.data).map((e) => {
62
+ if (s(e)) return n.createTextNode(e);
63
+ if (r !== "chars") {
64
+ let t = d(n, "word", e);
65
+ return c.push(t), t;
66
+ }
67
+ let t = d(n, "word"), i = n.createElement("span");
68
+ i.setAttribute("style", o), i.textContent = e, t.append(i);
69
+ for (let r of u(e)) {
70
+ let e = d(n, "char", r);
71
+ e.setAttribute("aria-hidden", "true"), g.push(e), t.append(e);
72
+ }
73
+ return c.push(t), t;
74
+ });
75
+ t.replaceWith(...e), a.push({
76
+ node: t,
77
+ parts: e
78
+ });
79
+ }
80
+ let _ = r === "lines" ? p(c) : [], v = [];
81
+ if (r === "lines" && i !== null) {
82
+ let r = _.map((e) => {
83
+ let r = d(n, "line"), i = t.mask === !0 ? d(n, "line-inner") : r;
84
+ return t.mask === !0 && (r.style.overflow = "clip", r.append(i)), e.forEach((e, t) => {
85
+ t > 0 && i.append(n.createTextNode(" ")), i.append(e);
86
+ }), v.push(i), r;
87
+ });
88
+ e.replaceChildren(...r);
89
+ }
90
+ let y = {
91
+ words: c,
92
+ chars: g,
93
+ lines: v,
94
+ lineGroups: _,
95
+ revert: () => {
96
+ if (m.get(e) === y) {
97
+ if (m.delete(e), h.get(e) === y && h.delete(e), i !== null) {
98
+ e.textContent = i;
99
+ return;
100
+ }
101
+ for (let { node: e, parts: t } of a) {
102
+ let n = t[0];
103
+ if (n !== void 0 && n.parentNode !== null) {
104
+ n.parentNode.replaceChild(e, n);
105
+ for (let e of t.slice(1)) e.parentNode?.removeChild(e);
106
+ }
107
+ }
108
+ }
109
+ }
110
+ };
111
+ return m.set(e, y), y;
112
+ }, _ = (e, t = {}) => {
113
+ h.get(e)?.revert();
114
+ let n = g(e, t);
115
+ if (t.by !== "lines" || typeof ResizeObserver > "u") return h.set(e, n), n;
116
+ let r = e.getBoundingClientRect().width, i = new ResizeObserver(() => {
117
+ let i = e.getBoundingClientRect().width;
118
+ Math.abs(i - r) < 1 || (r = i, n.revert(), n = g(e, t), t.onResplit?.(a));
119
+ });
120
+ i.observe(e);
121
+ let a = {
122
+ get words() {
123
+ return n.words;
124
+ },
125
+ get chars() {
126
+ return n.chars;
127
+ },
128
+ get lines() {
129
+ return n.lines;
130
+ },
131
+ get lineGroups() {
132
+ return n.lineGroups;
133
+ },
134
+ revert: () => {
135
+ i.disconnect(), n.revert(), h.get(e) === a && h.delete(e);
136
+ }
137
+ };
138
+ return h.set(e, a), a;
139
+ };
140
+ //#endregion
141
+ export { a, n as i, r as n, i as r, _ as t };
@@ -0,0 +1,49 @@
1
+ //#region src/core/cleanup.ts
2
+ var e = () => void 0, t = (e) => {
3
+ typeof globalThis.reportError == "function" ? globalThis.reportError(e) : queueMicrotask(() => {
4
+ throw e;
5
+ });
6
+ }, n = (e) => {
7
+ try {
8
+ e();
9
+ } catch (e) {
10
+ t(e);
11
+ }
12
+ }, r = () => {
13
+ let t = [], r = !1;
14
+ return {
15
+ add: (i) => {
16
+ if (r) return n(i), e;
17
+ let a = !1, o = () => {
18
+ if (a) return;
19
+ a = !0;
20
+ let e = t.indexOf(o);
21
+ e !== -1 && t.splice(e, 1), n(i);
22
+ };
23
+ return t.push(o), o;
24
+ },
25
+ dispose: () => {
26
+ if (!r) for (r = !0; t.length > 0;) t.pop()?.();
27
+ },
28
+ disposed: () => r
29
+ };
30
+ }, i = "(prefers-reduced-motion: reduce)", a = () => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia(i) : null, o = () => a()?.matches === !0 ? "reduce" : "no-preference", s = () => o() === "reduce", c = (t) => {
31
+ let n = a();
32
+ if (n === null) return e;
33
+ let r = () => t(n.matches ? "reduce" : "no-preference");
34
+ return n.addEventListener("change", r), () => n.removeEventListener("change", r);
35
+ }, l = (e) => typeof Element < "u" && e instanceof Element, u = (e, t) => {
36
+ if (e == null) return [];
37
+ if (typeof e == "string") {
38
+ let n = t ?? (typeof document > "u" ? null : document);
39
+ if (n === null) return [];
40
+ try {
41
+ return Array.from(n.querySelectorAll(e));
42
+ } catch {
43
+ return [];
44
+ }
45
+ }
46
+ return l(e) ? [e] : [...new Set(Array.from(e).filter(l))];
47
+ };
48
+ //#endregion
49
+ export { c as a, s as i, u as n, r as o, o as r, e as s, l as t };
@@ -0,0 +1,60 @@
1
+ import { a as e, t } from "./dom-CK6FnKcV.js";
2
+ import { a as n, r } from "./split-text-Cnl9gkUu.js";
3
+ import { gsap as i } from "gsap";
4
+ import { ScrollTrigger as a } from "gsap/ScrollTrigger";
5
+ //#region src/gsap/engine.ts
6
+ var o = !1, s = () => (o ||= (i.registerPlugin(a), !0), a), c = (e) => e.root instanceof Element ? e.root : void 0, l = (e, t = "md") => {
7
+ let r = n(e, t), i = {
8
+ autoAlpha: r.opacity,
9
+ x: r.x,
10
+ y: r.y,
11
+ scale: r.scale
12
+ };
13
+ return r.clipPath !== null && (i.clipPath = r.clipPath), i;
14
+ }, u = (e) => n(e).clipPath === null ? {
15
+ autoAlpha: 1,
16
+ x: 0,
17
+ y: 0,
18
+ scale: 1
19
+ } : {
20
+ autoAlpha: 1,
21
+ x: 0,
22
+ y: 0,
23
+ scale: 1,
24
+ clipPath: r
25
+ }, d = (e, t, n, r = {}) => e.fromTo(t, l(n, r.distance), {
26
+ ...u(n),
27
+ ...r.vars
28
+ }, r.position), f = (n, r = {}) => {
29
+ let a = t(), o = null, l = 0, u = !1, d = e(r.context, (e) => {
30
+ let t = typeof r.scrollTrigger == "function" ? r.scrollTrigger(e) : r.scrollTrigger;
31
+ t != null && !e.reduced && s();
32
+ let d = i.context(() => {
33
+ let s = i.timeline({
34
+ ...r.vars,
35
+ defaults: {
36
+ duration: e.config.duration,
37
+ ease: e.config.ease,
38
+ lazy: !1,
39
+ ...r.vars?.defaults
40
+ },
41
+ ...t == null || e.reduced ? {} : { scrollTrigger: t }
42
+ });
43
+ n(s, e), e.reduced ? s.progress(1).pause() : l > 0 && s.progress(l), s.then(() => a.settle("finished")), (e.reduced || s.progress() === 1) && a.settle("finished"), o = s;
44
+ }, c(e));
45
+ return u = !0, () => {
46
+ u = !1, l = o?.progress() ?? l, o = null, d.revert(), queueMicrotask(() => {
47
+ u || a.settle("cancelled");
48
+ });
49
+ };
50
+ });
51
+ return {
52
+ timeline: () => o,
53
+ finished: a.promise,
54
+ destroy: () => {
55
+ d(), a.settle("cancelled");
56
+ }
57
+ };
58
+ };
59
+ //#endregion
60
+ export { c as a, u as i, d as n, s as o, l as r, f as t };
@@ -0,0 +1,27 @@
1
+ import { ComputedRef, Directive, Ref, ShallowRef } from 'vue';
2
+ import { MotionContext } from '../core/context';
3
+ import { Cleanup, EntranceName, MotionConfig } from '../core/types';
4
+ import { RevealOptions } from '../css/reveal';
5
+ /** Anything with a teardown: a cleanup function or an object with `destroy`. */
6
+ export type Releasable = Cleanup | {
7
+ readonly destroy: Cleanup;
8
+ };
9
+ export type UseMotionOptions = {
10
+ /** A template ref for the component's root; selectors are scoped to it. */
11
+ readonly root?: Readonly<Ref<Element | null | undefined>>;
12
+ readonly config?: Partial<MotionConfig>;
13
+ };
14
+ /**
15
+ * A motion context owned by the component: created once mounted, so its
16
+ * elements exist, and destroyed on unmount, reverting everything set up in it.
17
+ * Nothing runs during server rendering.
18
+ */
19
+ export declare const useMotion: (setup?: (context: MotionContext) => void, options?: UseMotionOptions) => ShallowRef<MotionContext | null>;
20
+ /**
21
+ * Runs any motion setup for the component's lifetime — a smooth-scroll
22
+ * service, a page transition, a parallax — and releases it on unmount.
23
+ * Engine-agnostic, so this adapter never imports GSAP or Lenis itself.
24
+ */
25
+ export declare const useMotionEffect: <T extends Releasable>(factory: () => T) => ComputedRef<T | null>;
26
+ /** `v-reveal`, `v-reveal="'slide-left'"` or `v-reveal="{ effect: 'scale', once: false }"`. Needs the motion stylesheet. */
27
+ export declare const vReveal: Directive<Element, EntranceName | Omit<RevealOptions, 'context'> | undefined>;
package/dist/vue.js ADDED
@@ -0,0 +1,33 @@
1
+ import { i as e } from "./dom-CK6FnKcV.js";
2
+ import { r as t } from "./reveal-By5zvLLc.js";
3
+ import { computed as n, onBeforeUnmount as r, onMounted as i, shallowRef as a } from "vue";
4
+ //#region src/vue/index.ts
5
+ var o = (e) => typeof e == "function" ? e : e.destroy, s = (t, n = {}) => {
6
+ let o = a(null);
7
+ return i(() => {
8
+ let r = n.root?.value;
9
+ (n.root === void 0 || r != null) && (o.value = e({
10
+ root: r,
11
+ config: n.config
12
+ }), t?.(o.value));
13
+ }), r(() => {
14
+ o.value?.destroy(), o.value = null;
15
+ }), o;
16
+ }, c = (e) => {
17
+ let t = a(0), s = null;
18
+ return i(() => {
19
+ s = e(), t.value += 1;
20
+ }), r(() => {
21
+ s !== null && o(s)(), s = null, t.value += 1;
22
+ }), n(() => t.value >= 0 ? s : null);
23
+ }, l = /* @__PURE__ */ new WeakMap(), u = {
24
+ mounted: (e, n) => {
25
+ let r = n.value;
26
+ l.set(e, t(e, typeof r == "string" ? { effect: r } : r ?? {}));
27
+ },
28
+ beforeUnmount: (e) => {
29
+ l.get(e)?.(), l.delete(e);
30
+ }
31
+ };
32
+ //#endregion
33
+ export { s as useMotion, c as useMotionEffect, u as vReveal };
package/package.json CHANGED
@@ -1,6 +1,99 @@
1
1
  {
2
2
  "name": "@lovince/motion",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "A framework-agnostic motion system: native CSS reveals, managed GSAP timelines and scroll scenes, and Lenis smooth scrolling — with mandatory cleanup and reduced-motion handling.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Lovince Tech",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Mac254/Lovince_product_journey.git",
11
+ "directory": "packages/motion"
12
+ },
13
+ "homepage": "https://github.com/Mac254/Lovince_product_journey#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/Mac254/Lovince_product_journey/issues"
16
+ },
17
+ "keywords": [
18
+ "animation",
19
+ "motion",
20
+ "gsap",
21
+ "scrolltrigger",
22
+ "lenis",
23
+ "smooth-scroll",
24
+ "reduced-motion",
25
+ "accessibility"
26
+ ],
27
+ "files": [
28
+ "dist",
29
+ "styles",
30
+ "README.md",
31
+ "LICENSE"
32
+ ],
33
+ "main": "./dist/index.js",
34
+ "module": "./dist/index.js",
35
+ "types": "./dist/index.d.ts",
36
+ "sideEffects": [
37
+ "*.css"
38
+ ],
39
+ "exports": {
40
+ ".": {
41
+ "types": "./dist/index.d.ts",
42
+ "import": "./dist/index.js"
43
+ },
44
+ "./gsap": {
45
+ "types": "./dist/gsap/index.d.ts",
46
+ "import": "./dist/gsap.js"
47
+ },
48
+ "./scroll": {
49
+ "types": "./dist/scroll/index.d.ts",
50
+ "import": "./dist/scroll.js"
51
+ },
52
+ "./presets": {
53
+ "types": "./dist/presets/index.d.ts",
54
+ "import": "./dist/presets.js"
55
+ },
56
+ "./vue": {
57
+ "types": "./dist/vue/index.d.ts",
58
+ "import": "./dist/vue.js"
59
+ },
60
+ "./styles.css": "./styles/motion.css",
61
+ "./tokens.css": "./styles/tokens.css",
62
+ "./utilities.css": "./styles/utilities.css",
63
+ "./presets.css": "./styles/presets.css",
64
+ "./package.json": "./package.json"
65
+ },
66
+ "scripts": {
67
+ "build": "vite build",
68
+ "typecheck": "tsc --noEmit"
69
+ },
70
+ "dependencies": {
71
+ "@lovince/tokens": "^0.1.0"
72
+ },
73
+ "peerDependencies": {
74
+ "gsap": "",
75
+ "lenis": "",
76
+ "vue": "^3.3.0"
77
+ },
78
+ "peerDependenciesMeta": {
79
+ "gsap": {
80
+ "optional": true
81
+ },
82
+ "lenis": {
83
+ "optional": true
84
+ },
85
+ "vue": {
86
+ "optional": true
87
+ }
88
+ },
89
+ "engines": {
90
+ "node": ">=18"
91
+ },
92
+ "publishConfig": {
93
+ "access": "public"
94
+ },
95
+ "devDependencies": {
96
+ "gsap": "^3.15.0",
97
+ "lenis": "^1.3.27"
98
+ }
99
+ }
@@ -0,0 +1,4 @@
1
+ /* Everything: tokens, utilities and scroll-reveal presets. Import the parts on their own to take less. */
2
+ @import './tokens.css';
3
+ @import './utilities.css';
4
+ @import './presets.css';
@@ -0,0 +1,58 @@
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
+ }
@@ -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
+ }