@ssgoi/react 2.5.6 → 3.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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(n){return("tick"in n||"css"in n)&&!("springs"in n)}function r(n){return"springs"in n}function s(n){return"css"in n&&typeof n.css=="function"}function a(n){return"tick"in n&&typeof n.tick=="function"}function o(n){if(s(n)&&a(n))throw new Error("SingleSpringConfig cannot have both 'tick' and 'css' defined. Use one or the other.")}function c(n){if(n.tick&&n.css)throw new Error("SpringItem cannot have both 'tick' and 'css' defined. Use one or the other.")}async function f(n){const i=await n;return r(i)?(i.springs.forEach(c),i):(o(i),{prepare:i.prepare,wait:i.wait,onStart:i.onStart,onEnd:i.onEnd,springs:[{spring:i.spring,tick:i.tick,css:i.css}],schedule:"parallel"})}function g(n){const i=n.schedule??"parallel",l=n.springs.map(t=>{let e;switch(i){case"parallel":e=0;break;case"sequential":e=1;break;case"stagger":e=Math.max(0,Math.min(1,t.offset??0));break;default:e=0}return{...t,normalizedOffset:e}}),{schedule:d,...u}=n;return{...u,springs:l}}exports.isCssAnimation=s;exports.isMultiSpring=r;exports.isSingleSpring=p;exports.isTickAnimation=a;exports.normalizeMultiSpringSchedule=g;exports.normalizeToMultiSpring=f;exports.validateAnimationMode=o;exports.validateSpringItem=c;
@@ -0,0 +1,74 @@
1
+ function f(n) {
2
+ return ("tick" in n || "css" in n) && !("springs" in n);
3
+ }
4
+ function a(n) {
5
+ return "springs" in n;
6
+ }
7
+ function o(n) {
8
+ return "css" in n && typeof n.css == "function";
9
+ }
10
+ function c(n) {
11
+ return "tick" in n && typeof n.tick == "function";
12
+ }
13
+ function l(n) {
14
+ if (o(n) && c(n))
15
+ throw new Error(
16
+ "SingleSpringConfig cannot have both 'tick' and 'css' defined. Use one or the other."
17
+ );
18
+ }
19
+ function p(n) {
20
+ if (n.tick && n.css)
21
+ throw new Error(
22
+ "SpringItem cannot have both 'tick' and 'css' defined. Use one or the other."
23
+ );
24
+ }
25
+ async function g(n) {
26
+ const i = await n;
27
+ return a(i) ? (i.springs.forEach(p), i) : (l(i), {
28
+ prepare: i.prepare,
29
+ wait: i.wait,
30
+ onStart: i.onStart,
31
+ onEnd: i.onEnd,
32
+ springs: [
33
+ {
34
+ spring: i.spring,
35
+ tick: i.tick,
36
+ css: i.css
37
+ }
38
+ ],
39
+ schedule: "parallel"
40
+ });
41
+ }
42
+ function h(n) {
43
+ const i = n.schedule ?? "parallel", s = n.springs.map((e) => {
44
+ let t;
45
+ switch (i) {
46
+ case "parallel":
47
+ t = 0;
48
+ break;
49
+ case "sequential":
50
+ t = 1;
51
+ break;
52
+ case "stagger":
53
+ t = Math.max(0, Math.min(1, e.offset ?? 0));
54
+ break;
55
+ default:
56
+ t = 0;
57
+ }
58
+ return { ...e, normalizedOffset: t };
59
+ }), { schedule: u, ...r } = n;
60
+ return {
61
+ ...r,
62
+ springs: s
63
+ };
64
+ }
65
+ export {
66
+ o as isCssAnimation,
67
+ a as isMultiSpring,
68
+ f as isSingleSpring,
69
+ c as isTickAnimation,
70
+ h as normalizeMultiSpringSchedule,
71
+ g as normalizeToMultiSpring,
72
+ l as validateAnimationMode,
73
+ p as validateSpringItem
74
+ };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@ssgoi/core"),i=require("./node_modules/.pnpm/@ssgoi_core@2.5.6/node_modules/@ssgoi/core/dist/types.cjs"),e=require("./packages/react/src/lib/ssgoi.cjs"),s=require("./packages/react/src/lib/ssgoi-transition.cjs");Object.defineProperty(exports,"transition",{enumerable:!0,get:()=>n.transition});exports.isCssAnimation=i.isCssAnimation;exports.isMultiSpring=i.isMultiSpring;exports.isSingleSpring=i.isSingleSpring;exports.isTickAnimation=i.isTickAnimation;exports.validateAnimationMode=i.validateAnimationMode;exports.Ssgoi=e.Ssgoi;exports.SsgoiTransition=s.SsgoiTransition;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@ssgoi/core"),i=require("./core/dist/types.cjs"),e=require("./react/src/lib/ssgoi.cjs"),t=require("./react/src/lib/ssgoi-transition.cjs"),o=require("./react/src/lib/transition-scope.cjs");Object.defineProperty(exports,"transition",{enumerable:!0,get:()=>n.transition});exports.isCssAnimation=i.isCssAnimation;exports.isMultiSpring=i.isMultiSpring;exports.isSingleSpring=i.isSingleSpring;exports.isTickAnimation=i.isTickAnimation;exports.normalizeMultiSpringSchedule=i.normalizeMultiSpringSchedule;exports.normalizeToMultiSpring=i.normalizeToMultiSpring;exports.validateAnimationMode=i.validateAnimationMode;exports.validateSpringItem=i.validateSpringItem;exports.Ssgoi=e.Ssgoi;exports.SsgoiTransition=t.SsgoiTransition;exports.TransitionScope=o.TransitionScope;
package/dist/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export { transition } from './transition';
2
2
  export * from './types';
3
3
  export { Ssgoi } from './ssgoi';
4
4
  export { SsgoiTransition } from './ssgoi-transition';
5
+ export { TransitionScope } from './transition-scope';
package/dist/index.js CHANGED
@@ -1,14 +1,19 @@
1
1
  import { transition as n } from "@ssgoi/core";
2
- import { isCssAnimation as t, isMultiSpring as s, isSingleSpring as a, isTickAnimation as e, validateAnimationMode as m } from "./node_modules/.pnpm/@ssgoi_core@2.5.6/node_modules/@ssgoi/core/dist/types.js";
3
- import { Ssgoi as g } from "./packages/react/src/lib/ssgoi.js";
4
- import { SsgoiTransition as f } from "./packages/react/src/lib/ssgoi-transition.js";
2
+ import { isCssAnimation as t, isMultiSpring as e, isSingleSpring as a, isTickAnimation as m, normalizeMultiSpringSchedule as p, normalizeToMultiSpring as s, validateAnimationMode as S, validateSpringItem as l } from "./core/dist/types.js";
3
+ import { Ssgoi as f } from "./react/src/lib/ssgoi.js";
4
+ import { SsgoiTransition as d } from "./react/src/lib/ssgoi-transition.js";
5
+ import { TransitionScope as M } from "./react/src/lib/transition-scope.js";
5
6
  export {
6
- g as Ssgoi,
7
- f as SsgoiTransition,
7
+ f as Ssgoi,
8
+ d as SsgoiTransition,
9
+ M as TransitionScope,
8
10
  t as isCssAnimation,
9
- s as isMultiSpring,
11
+ e as isMultiSpring,
10
12
  a as isSingleSpring,
11
- e as isTickAnimation,
13
+ m as isTickAnimation,
14
+ p as normalizeMultiSpringSchedule,
15
+ s as normalizeToMultiSpring,
12
16
  n as transition,
13
- m as validateAnimationMode
17
+ S as validateAnimationMode,
18
+ l as validateSpringItem
14
19
  };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),n=require("@ssgoi/core");function r({children:e}){return t.jsx("div",{ref:n.createTransitionScope(),style:{display:"contents"},children:e})}exports.TransitionScope=r;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ import { createTransitionScope as t } from "@ssgoi/core";
4
+ function n({ children: o }) {
5
+ return /* @__PURE__ */ r("div", { ref: t(), style: { display: "contents" }, children: o });
6
+ }
7
+ export {
8
+ n as TransitionScope
9
+ };
@@ -0,0 +1,28 @@
1
+ import { ReactNode } from 'react';
2
+ type TransitionScopeProps = {
3
+ children: ReactNode;
4
+ };
5
+ /**
6
+ * TransitionScope creates a boundary for local-scoped transitions.
7
+ *
8
+ * Child elements with `scope: 'local'` will:
9
+ * - Skip IN animation when mounted simultaneously with the scope
10
+ * - Skip OUT animation when unmounted simultaneously with the scope
11
+ *
12
+ * This is useful for:
13
+ * - Page transitions where child elements shouldn't animate individually
14
+ * - Modal/dialog content that appears/disappears with the container
15
+ * - List items that shouldn't animate when the entire list mounts/unmounts
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <TransitionScope>
20
+ * <div ref={transition(fadeIn(), { scope: 'local' })}>
21
+ * This will only animate when added/removed independently,
22
+ * not when the entire scope mounts/unmounts.
23
+ * </div>
24
+ * </TransitionScope>
25
+ * ```
26
+ */
27
+ export declare function TransitionScope({ children }: TransitionScopeProps): import("react/jsx-runtime").JSX.Element;
28
+ export {};
package/dist/types.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./node_modules/.pnpm/@ssgoi_core@2.5.6/node_modules/@ssgoi/core/dist/types.cjs");exports.isCssAnimation=i.isCssAnimation;exports.isMultiSpring=i.isMultiSpring;exports.isSingleSpring=i.isSingleSpring;exports.isTickAnimation=i.isTickAnimation;exports.validateAnimationMode=i.validateAnimationMode;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./core/dist/types.cjs");exports.isCssAnimation=i.isCssAnimation;exports.isMultiSpring=i.isMultiSpring;exports.isSingleSpring=i.isSingleSpring;exports.isTickAnimation=i.isTickAnimation;exports.normalizeMultiSpringSchedule=i.normalizeMultiSpringSchedule;exports.normalizeToMultiSpring=i.normalizeToMultiSpring;exports.validateAnimationMode=i.validateAnimationMode;exports.validateSpringItem=i.validateSpringItem;
package/dist/types.js CHANGED
@@ -1,8 +1,11 @@
1
- import { isCssAnimation as o, isMultiSpring as s, isSingleSpring as t, isTickAnimation as a, validateAnimationMode as e } from "./node_modules/.pnpm/@ssgoi_core@2.5.6/node_modules/@ssgoi/core/dist/types.js";
1
+ import { isCssAnimation as e, isMultiSpring as t, isSingleSpring as a, isTickAnimation as l, normalizeMultiSpringSchedule as o, normalizeToMultiSpring as r, validateAnimationMode as m, validateSpringItem as S } from "./core/dist/types.js";
2
2
  export {
3
- o as isCssAnimation,
4
- s as isMultiSpring,
5
- t as isSingleSpring,
6
- a as isTickAnimation,
7
- e as validateAnimationMode
3
+ e as isCssAnimation,
4
+ t as isMultiSpring,
5
+ a as isSingleSpring,
6
+ l as isTickAnimation,
7
+ o as normalizeMultiSpringSchedule,
8
+ r as normalizeToMultiSpring,
9
+ m as validateAnimationMode,
10
+ S as validateSpringItem
8
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssgoi/react",
3
- "version": "2.5.6",
3
+ "version": "3.1.0",
4
4
  "description": "React bindings for SSGOI - Native app-like page transitions for React applications",
5
5
  "private": false,
6
6
  "type": "module",
@@ -45,7 +45,7 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@ssgoi/core": "^2.5.6"
48
+ "@ssgoi/core": "^3.1.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": "^19.0.0",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(i){return("tick"in i||"css"in i)&&!("springs"in i)}function o(i){return"springs"in i}function n(i){return"css"in i&&typeof i.css=="function"}function t(i){return"tick"in i&&typeof i.tick=="function"}function r(i){if(n(i)&&t(i))throw new Error("SingleSpringConfig cannot have both 'tick' and 'css' defined. Use one or the other.")}exports.isCssAnimation=n;exports.isMultiSpring=o;exports.isSingleSpring=e;exports.isTickAnimation=t;exports.validateAnimationMode=r;
@@ -1,25 +0,0 @@
1
- function s(i) {
2
- return ("tick" in i || "css" in i) && !("springs" in i);
3
- }
4
- function o(i) {
5
- return "springs" in i;
6
- }
7
- function n(i) {
8
- return "css" in i && typeof i.css == "function";
9
- }
10
- function t(i) {
11
- return "tick" in i && typeof i.tick == "function";
12
- }
13
- function r(i) {
14
- if (n(i) && t(i))
15
- throw new Error(
16
- "SingleSpringConfig cannot have both 'tick' and 'css' defined. Use one or the other."
17
- );
18
- }
19
- export {
20
- n as isCssAnimation,
21
- o as isMultiSpring,
22
- s as isSingleSpring,
23
- t as isTickAnimation,
24
- r as validateAnimationMode
25
- };
File without changes