@alea-design/motion 0.2.0 → 0.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 CHANGED
@@ -10,4 +10,4 @@
10
10
  import { Reveal, NumberRoll, motionStyle } from '@alea-design/motion';
11
11
  ```
12
12
 
13
- Docs: https://alea.alevasquez.dev/motion · MIT license
13
+ Docs: https://alea.alevasquez.dev/motion?utm_source=npm&utm_medium=readme&utm_campaign=alea-motion · MIT license
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './react';
1
+ export * from './react.js';
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as w, jsxs as A } from "react/jsx-runtime";
3
- import { useState as b, useEffect as v, useRef as g, useCallback as T, createElement as E, isValidElement as S, cloneElement as R, Children as I, useLayoutEffect as z } from "react";
4
- const B = typeof window > "u" ? v : z, V = ["out", "in", "in-out", "standard", "emphasized", "spring"], D = (t) => V.includes(t) ? `var(--alea-motion-${t === "spring" ? "spring" : "ease-" + t})` : t, L = (t, e) => t === "none" ? "none" : `alea-m-${t}-${e}`;
3
+ import { useState as b, useEffect as v, useRef as g, useCallback as T, createElement as E, isValidElement as L, cloneElement as R, Children as I, useLayoutEffect as V } from "react";
4
+ const B = typeof window > "u" ? v : V, z = ["out", "in", "in-out", "standard", "emphasized", "spring"], D = (t) => z.includes(t) ? `var(--alea-motion-${t === "spring" ? "spring" : "ease-" + t})` : t, S = (t, e) => t === "none" ? "none" : `alea-m-${t}-${e}`;
5
5
  function O(t) {
6
6
  if (t === void 0) return;
7
7
  const e = t === !1 ? { enter: "none" } : typeof t == "string" ? { enter: t } : t, n = {};
8
- return e.enter ? (n["--alea-enter"] = L(e.enter, "in"), n["--alea-exit"] = L(e.exit || e.enter, "out")) : e.exit && (n["--alea-exit"] = L(e.exit, "out")), e.duration != null ? (n["--alea-enter-duration"] = `${e.duration}ms`, n["--alea-exit-duration"] = `${e.exitDuration ?? Math.round(e.duration * 0.6)}ms`) : e.exitDuration != null && (n["--alea-exit-duration"] = `${e.exitDuration}ms`), e.easing && (n["--alea-enter-ease"] = D(e.easing)), e.delay != null && (n["--alea-enter-delay"] = `${e.delay}ms`), n;
8
+ return e.enter ? (n["--alea-enter"] = S(e.enter, "in"), n["--alea-exit"] = S(e.exit || e.enter, "out")) : e.exit && (n["--alea-exit"] = S(e.exit, "out")), e.duration != null ? (n["--alea-enter-duration"] = `${e.duration}ms`, n["--alea-exit-duration"] = `${e.exitDuration ?? Math.round(e.duration * 0.6)}ms`) : e.exitDuration != null && (n["--alea-exit-duration"] = `${e.exitDuration}ms`), e.easing && (n["--alea-enter-ease"] = D(e.easing)), e.delay != null && (n["--alea-enter-delay"] = `${e.delay}ms`), n;
9
9
  }
10
10
  function Q(t, e) {
11
11
  const n = O(e);
@@ -148,12 +148,12 @@ function ie({ show: t, exitClassName: e = "alea-dissolve-out", children: n }) {
148
148
  }, [t]), v(() => {
149
149
  var d, u;
150
150
  r && c.current && !((u = (d = c.current).getAnimations) != null && u.call(d).length) && (a(!1), i(!1));
151
- }, [r]), !o || !S(n) ? null : R(n, { ref: c, className: [n.props.className, r && e].filter(Boolean).join(" ") });
151
+ }, [r]), !o || !L(n) ? null : R(n, { ref: c, className: [n.props.className, r && e].filter(Boolean).join(" ") });
152
152
  }
153
153
  function se({ children: t, as: e = "span", className: n, direction: o = "up", variant: a = "blur" }) {
154
154
  const [r, i] = b([{ id: 0, node: t }]), c = g(t), d = g(0), u = (s) => {
155
155
  var l;
156
- return typeof s == "string" || typeof s == "number" ? String(s) : S(s) ? String(s.key ?? "") + JSON.stringify(((l = s.props) == null ? void 0 : l.children) ?? "") : "";
156
+ return typeof s == "string" || typeof s == "number" ? String(s) : L(s) ? String(s.key ?? "") + JSON.stringify(((l = s.props) == null ? void 0 : l.children) ?? "") : "";
157
157
  };
158
158
  return v(() => {
159
159
  if (u(t) === u(c.current)) {
@@ -219,7 +219,7 @@ function fe({ id: t, as: e = "div", duration: n, easing: o, fadeContent: a = !0,
219
219
  if (!l) return;
220
220
  const f = M.get(t), p = j(l);
221
221
  if (f && !s && performance.now() - f.time < 1500 && (f.w !== p.w || f.h !== p.h || f.x !== p.x || f.y !== p.y) && typeof l.animate == "function") {
222
- const $ = n ?? (parseFloat(getComputedStyle(l).getPropertyValue("--alea-motion-duration-slow")) || 480), x = o ?? "cubic-bezier(0.2, 0, 0, 1)", h = f.w / Math.max(1, p.w), P = f.h / Math.max(1, p.h);
222
+ const $ = n ?? (parseFloat(getComputedStyle(l).getPropertyValue("--alea-motion-duration-slow")) || 480), x = o ?? (getComputedStyle(l).getPropertyValue("--alea-motion-ease-standard").trim() || "cubic-bezier(0.2, 0, 0, 1)"), h = f.w / Math.max(1, p.w), P = f.h / Math.max(1, p.h);
223
223
  if (l.animate([
224
224
  { transformOrigin: "0 0", transform: `translate(${f.x - p.x}px, ${f.y - p.y}px) scale(${h}, ${P})`, borderRadius: f.radius },
225
225
  { transformOrigin: "0 0", transform: "none", borderRadius: p.radius }
@@ -272,7 +272,7 @@ function G(t, { on: e = "mount", value: n, delay: o, duration: a, once: r = !0 }
272
272
  }
273
273
  function me({ pattern: t, children: e, ...n }) {
274
274
  const o = G(t, n), a = I.only(e);
275
- if (!S(a)) return e;
275
+ if (!L(a)) return e;
276
276
  const r = a.props.ref, i = (l) => {
277
277
  o.ref.current = l, typeof r == "function" ? r(l) : r && typeof r == "object" && (r.current = l);
278
278
  }, { ref: c, className: d, style: u, ...s } = o;
@@ -333,4 +333,3 @@ export {
333
333
  ne as useScrollDirection,
334
334
  Q as withMotionStyle
335
335
  };
336
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alea-design/motion",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Alea Motion: a motion system for interfaces. Tokens, named patterns, microinteractions and effects in CSS for any stack, plus small React helpers. Reduced motion built in.",
5
5
  "keywords": [
6
6
  "motion",
@@ -12,10 +12,10 @@
12
12
  "css",
13
13
  "design system"
14
14
  ],
15
- "homepage": "https://alea.alevasquez.dev",
15
+ "homepage": "https://alea.alevasquez.dev?utm_source=npm&utm_medium=package&utm_campaign=alea-motion",
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "https://github.com/alevascha/alea-design.git",
18
+ "url": "git+https://github.com/alevascha/alea-design.git",
19
19
  "directory": "packages/motion"
20
20
  },
21
21
  "bugs": {
@@ -49,7 +49,7 @@
49
49
  "access": "public"
50
50
  },
51
51
  "scripts": {
52
- "build": "vite build && tsc -p tsconfig.build.json",
52
+ "build": "vite build && tsc -p tsconfig.build.json && node ../../scripts/fix-dts.mjs dist",
53
53
  "typecheck": "tsc --noEmit",
54
54
  "test": "vitest run --root ../react src/__tests__/motion"
55
55
  },
package/src/motion.css CHANGED
@@ -230,8 +230,12 @@
230
230
  --alea-motion-ease-emphasized: var(--alea-motion-ease-out); --alea-motion-ease-spring: var(--alea-motion-ease-out); --alea-motion-spring: var(--alea-motion-ease-out);
231
231
  --alea-motion-duration-slow: var(--alea-motion-duration-base); --alea-motion-duration-slower: var(--alea-motion-duration-base);
232
232
  }
233
- :root:not([data-alea-reduced='never']) :is(.alea-field[data-invalid] :is(.alea-input-wrap, .alea-select-trigger, .alea-textarea, .alea-date-wrap), [data-alea-loop], .alea-badge[data-pulse] .alea-badge-dot::after, .alea-avatar-status[data-pulse]::after, .alea-status-dot[data-pulse]::after, .alea-indicator[data-processing]::before, .alea-image[data-state='loading'], .alea-orb, .alea-orbs *) { animation: none !important; }
234
- :root:not([data-alea-reduced='never']) .alea-skeleton { animation-duration: 3s; }
233
+ :root:not([data-alea-reduced='never']) :is(.alea-field[data-invalid] :is(.alea-input-wrap, .alea-select-trigger, .alea-textarea, .alea-date-wrap), [data-alea-loop], .alea-image[data-state='loading'], .alea-orb, .alea-orbs *) { animation: none !important; }
234
+ /* decorative loops stop (a pseudo-element cannot sit inside :is(), so these are listed on their own) */
235
+ :root:not([data-alea-reduced='never']) :is(.alea-avatar-status[data-pulse], .alea-status-dot[data-pulse], .alea-indicator[data-processing])::before,
236
+ :root:not([data-alea-reduced='never']) :is(.alea-avatar-status[data-pulse], .alea-status-dot[data-pulse], .alea-indicator[data-processing])::after,
237
+ :root:not([data-alea-reduced='never']) :is(.alea-tl-item .alea-tl-dot, .alea-badge-dot[data-pulse]),
238
+ :root:not([data-alea-reduced='never']) .alea-skeleton { animation: none !important; }
235
239
  /* loading spinners keep turning (they carry meaning), only slower; decorative pulses stop */
236
240
  :root:not([data-alea-reduced='never']) :is(.alea-spinner svg, .alea-dot-loader i, .alea-progress-circle svg[data-indeterminate]) { animation-duration: 2.4s; }
237
241
  :root:not([data-alea-reduced='never']) .alea-gradient-dot[data-pulse] { animation: none !important; }
@@ -248,7 +252,11 @@
248
252
  --alea-motion-ease-emphasized: var(--alea-motion-ease-out); --alea-motion-ease-spring: var(--alea-motion-ease-out); --alea-motion-spring: var(--alea-motion-ease-out);
249
253
  --alea-motion-duration-slow: var(--alea-motion-duration-base); --alea-motion-duration-slower: var(--alea-motion-duration-base);
250
254
  }
251
- :is([data-alea-motion='reduced'], [data-alea-reduced='always']) :is(.alea-field[data-invalid] :is(.alea-input-wrap, .alea-select-trigger, .alea-textarea, .alea-date-wrap), [data-alea-loop], .alea-badge[data-pulse] .alea-badge-dot::after, .alea-avatar-status[data-pulse]::after, .alea-status-dot[data-pulse]::after, .alea-indicator[data-processing]::before, .alea-image[data-state='loading'], .alea-orb, .alea-orbs *) { animation: none !important; }
255
+ :is([data-alea-motion='reduced'], [data-alea-reduced='always']) :is(.alea-field[data-invalid] :is(.alea-input-wrap, .alea-select-trigger, .alea-textarea, .alea-date-wrap), [data-alea-loop], .alea-image[data-state='loading'], .alea-orb, .alea-orbs *) { animation: none !important; }
256
+ :is([data-alea-motion='reduced'], [data-alea-reduced='always']) :is(.alea-avatar-status[data-pulse], .alea-status-dot[data-pulse], .alea-indicator[data-processing])::before,
257
+ :is([data-alea-motion='reduced'], [data-alea-reduced='always']) :is(.alea-avatar-status[data-pulse], .alea-status-dot[data-pulse], .alea-indicator[data-processing])::after,
258
+ :is([data-alea-motion='reduced'], [data-alea-reduced='always']) :is(.alea-tl-item .alea-tl-dot, .alea-badge-dot[data-pulse]),
259
+ :is([data-alea-motion='reduced'], [data-alea-reduced='always']) .alea-skeleton { animation: none !important; }
252
260
  :is([data-alea-motion='reduced'], [data-alea-reduced='always']) :is(.alea-spinner svg, .alea-dot-loader i, .alea-progress-circle svg[data-indeterminate]) { animation-duration: 2.4s; }
253
261
  :is([data-alea-motion='reduced'], [data-alea-reduced='always']) .alea-gradient-dot[data-pulse] { animation: none !important; }
254
262
  /* reveals (bars grow, lines draw, words rise) appear at once, a stroke is already drawn, the ripple is not shown, a morph fades */
package/src/patterns.css CHANGED
@@ -86,7 +86,8 @@
86
86
  .alea-text-shimmer { background: linear-gradient(90deg, var(--alea-text-muted) 0%, var(--alea-text-muted) 40%, var(--alea-text) 50%, var(--alea-text-muted) 60%, var(--alea-text-muted) 100%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: alea-text-shimmer 2s linear infinite; }
87
87
  @keyframes alea-text-shimmer { from { background-position: 125% 0; } to { background-position: -125% 0; } }
88
88
  @media (prefers-reduced-motion: reduce) {
89
- :root:not([data-alea-reduced='never']) :is(.alea-text-shimmer, .alea-stream[data-streaming]::after) { animation: none; }
89
+ :root:not([data-alea-reduced='never']) .alea-text-shimmer,
90
+ :root:not([data-alea-reduced='never']) .alea-stream[data-streaming]::after { animation: none; }
90
91
  :root:not([data-alea-reduced='never']) .alea-text-shimmer { color: var(--alea-text-muted); background: none; }
91
92
  }
92
93
 
@@ -100,7 +101,8 @@
100
101
  @keyframes alea-route-in { from { opacity: 0.01; transform: translateX(calc(var(--alea-motion-distance-lg) * 2)); } }
101
102
  @keyframes alea-route-out { to { opacity: 0.01; transform: translateX(calc(var(--alea-motion-distance-lg) * -2)); } }
102
103
  :is([data-alea-motion='reduced'], [data-alea-reduced='always']) { --alea-hint-distance: 0px; }
103
- :is([data-alea-motion='reduced'], [data-alea-reduced='always']) :is(.alea-text-shimmer, .alea-stream[data-streaming]::after) { animation: none; }
104
+ :is([data-alea-motion='reduced'], [data-alea-reduced='always']) .alea-text-shimmer,
105
+ :is([data-alea-motion='reduced'], [data-alea-reduced='always']) .alea-stream[data-streaming]::after { animation: none; }
104
106
  :is([data-alea-motion='reduced'], [data-alea-reduced='always']) .alea-text-shimmer { color: var(--alea-text-muted); background: none; }
105
107
 
106
108
  /* ------------------------------------------------------------------ more patterns */