@ssgoi/react 7.4.0 → 7.4.1

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
@@ -1,6 +1,6 @@
1
1
  # @ssgoi/react
2
2
 
3
- React bindings for SSGOI.
3
+ Native app-like page transitions for React and Next.js. Make a web app, PWA or WebView app (Capacitor, Tauri, Ionic) feel like a native app without replacing your router.
4
4
 
5
5
  [![SSGOI live showcase](https://ssgoi.dev/readme.png)](https://ssgoi.dev)
6
6
 
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),n=require("@ssgoi/core/internal"),s=e.createContext(null),o=()=>n.IDLE_TRANSITION_STATE;function i(){const t=e.useContext(s);if(!t)throw new Error("useSsgoiTransition must be used within <Ssgoi>");return e.useSyncExternalStore(t.subscribe,t.getTransitionState,o)}exports.ssgoiContext=s;exports.useSsgoiTransition=i;
@@ -0,0 +1,16 @@
1
+ import { SsgoiContext } from '@ssgoi/core/internal';
2
+ import { SsgoiTransitionState } from '@ssgoi/core/types';
3
+ /** Provider-scoped dispatcher; `<Ssgoi>` owns the only value. */
4
+ export declare const ssgoiContext: import('react').Context<SsgoiContext | null>;
5
+ /**
6
+ * Reads the provider's transition lifecycle: whether a page transition is
7
+ * preparing or playing, and which routes it joins. Re-renders the caller on
8
+ * every change.
9
+ *
10
+ * Use it to defer work that would fight the animation, such as a
11
+ * programmatic scroll on the arriving page, until the status returns to
12
+ * `"idle"`.
13
+ *
14
+ * Must be called under `<Ssgoi>`.
15
+ */
16
+ export declare function useSsgoiTransition(): SsgoiTransitionState;
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { createContext as o, useContext as e, useSyncExternalStore as s } from "react";
3
+ import { IDLE_TRANSITION_STATE as n } from "@ssgoi/core/internal";
4
+ const r = o(null), i = () => n;
5
+ function a() {
6
+ const t = e(r);
7
+ if (!t)
8
+ throw new Error("useSsgoiTransition must be used within <Ssgoi>");
9
+ return s(
10
+ t.subscribe,
11
+ t.getTransitionState,
12
+ i
13
+ );
14
+ }
15
+ export {
16
+ r as ssgoiContext,
17
+ a as useSsgoiTransition
18
+ };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@ssgoi/core/types"),o=require("./ssgoi.cjs"),i=require("./ssgoi-transition.cjs"),r=require("@ssgoi/core");exports.Ssgoi=o.Ssgoi;exports.SsgoiTransition=i.SsgoiTransition;Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});Object.keys(r).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>r[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@ssgoi/core/types"),o=require("./ssgoi.cjs"),i=require("./context.cjs"),s=require("./ssgoi-transition.cjs"),r=require("@ssgoi/core");exports.Ssgoi=o.Ssgoi;exports.useSsgoiTransition=i.useSsgoiTransition;exports.SsgoiTransition=s.SsgoiTransition;Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});Object.keys(r).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>r[e]})});
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './types';
2
2
  export { Ssgoi } from './ssgoi';
3
+ export { useSsgoiTransition } from './context';
3
4
  export { SsgoiTransition } from './ssgoi-transition';
4
5
  export * from '@ssgoi/core';
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  export * from "@ssgoi/core/types";
2
- import { Ssgoi as e } from "./ssgoi.js";
3
- import { SsgoiTransition as i } from "./ssgoi-transition.js";
2
+ import { Ssgoi as t } from "./ssgoi.js";
3
+ import { useSsgoiTransition as s } from "./context.js";
4
+ import { SsgoiTransition as m } from "./ssgoi-transition.js";
4
5
  export * from "@ssgoi/core";
5
6
  export {
6
- e as Ssgoi,
7
- i as SsgoiTransition
7
+ t as Ssgoi,
8
+ m as SsgoiTransition,
9
+ s as useSsgoiTransition
8
10
  };
package/dist/ssgoi.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),e=require("react"),i=require("@ssgoi/core/internal"),a={display:"contents"},l=e.memo(({config:t,host:o,children:u})=>{const r=e.useRef(null),s=e.useMemo(()=>i.createSggoiTransitionContext(t,{host:o}),[t,o]);return e.useEffect(()=>{const n=r.current;if(n)return i.observeSsgoiTransitions(n,s)},[s]),c.jsx("div",{ref:r,"data-ssgoi-root":"",style:a,children:u})});exports.Ssgoi=l;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),e=require("react"),c=require("@ssgoi/core/internal"),a=require("./context.cjs"),l={display:"contents"},g=e.memo(({config:o,host:r,children:u})=>{const s=e.useRef(null),t=e.useMemo(()=>c.createSggoiTransitionContext(o,{host:r}),[o,r]);return e.useEffect(()=>{const n=s.current;if(n)return c.observeSsgoiTransitions(n,t)},[t]),i.jsx(a.ssgoiContext.Provider,{value:t,children:i.jsx("div",{ref:s,"data-ssgoi-root":"",style:l,children:u})})});exports.Ssgoi=g;
package/dist/ssgoi.js CHANGED
@@ -1,20 +1,21 @@
1
1
  "use client";
2
2
  import { jsx as i } from "react/jsx-runtime";
3
- import c, { useRef as m, useMemo as f, useEffect as u } from "react";
4
- import { createSggoiTransitionContext as a, observeSsgoiTransitions as g } from "@ssgoi/core/internal";
5
- const l = { display: "contents" }, x = c.memo(
6
- ({ config: o, host: t, children: n }) => {
7
- const r = m(null), e = f(
8
- () => a(o, { host: t }),
9
- [o, t]
3
+ import m, { useRef as c, useMemo as f, useEffect as u } from "react";
4
+ import { createSggoiTransitionContext as a, observeSsgoiTransitions as l } from "@ssgoi/core/internal";
5
+ import { ssgoiContext as g } from "./context.js";
6
+ const p = { display: "contents" }, y = m.memo(
7
+ ({ config: t, host: r, children: n }) => {
8
+ const e = c(null), o = f(
9
+ () => a(t, { host: r }),
10
+ [t, r]
10
11
  );
11
12
  return u(() => {
12
- const s = r.current;
13
+ const s = e.current;
13
14
  if (s)
14
- return g(s, e);
15
- }, [e]), /* @__PURE__ */ i("div", { ref: r, "data-ssgoi-root": "", style: l, children: n });
15
+ return l(s, o);
16
+ }, [o]), /* @__PURE__ */ i(g.Provider, { value: o, children: /* @__PURE__ */ i("div", { ref: e, "data-ssgoi-root": "", style: p, children: n }) });
16
17
  }
17
18
  );
18
19
  export {
19
- x as Ssgoi
20
+ y as Ssgoi
20
21
  };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),a=require("@tanstack/react-router"),s=require("./routers/route-boundary.cjs");function c({resolve:e,...o}){const t={pathname:a.useRouterState({select:r=>r.location.pathname})},n=e?.(t)??{id:t.pathname};return u.jsx(s.RouteBoundary,{...o,boundary:n})}exports.SsgoiRouteBoundary=c;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),u=require("@tanstack/react-router"),c=require("./routers/route-boundary.cjs");function i({resolve:t,...n}){const o={pathname:u.useRouterState({select:s})},r=t?.(o)??{id:o.pathname};return a.jsx(c.RouteBoundary,{...n,boundary:r})}function s(t){const n=t.location.pathname,e=t.matches?.[t.matches.length-1]?.pathname;return e?e.length>1&&e.endsWith("/")&&!n.endsWith("/")?e.slice(0,-1):e:n}exports.SsgoiRouteBoundary=i;
@@ -1,16 +1,18 @@
1
1
  "use client";
2
2
  import { jsx as r } from "react/jsx-runtime";
3
- import { useRouterState as m } from "@tanstack/react-router";
4
- import { RouteBoundary as u } from "./routers/route-boundary.js";
5
- function d({
6
- resolve: t,
7
- ...n
3
+ import { useRouterState as c } from "@tanstack/react-router";
4
+ import { RouteBoundary as i } from "./routers/route-boundary.js";
5
+ function p({
6
+ resolve: n,
7
+ ...o
8
8
  }) {
9
- const o = { pathname: m({
10
- select: (e) => e.location.pathname
11
- }) }, a = t?.(o) ?? { id: o.pathname };
12
- return /* @__PURE__ */ r(u, { ...n, boundary: a });
9
+ const e = { pathname: c({ select: m }) }, a = n?.(e) ?? { id: e.pathname };
10
+ return /* @__PURE__ */ r(i, { ...o, boundary: a });
11
+ }
12
+ function m(n) {
13
+ const o = n.location.pathname, t = n.matches?.[n.matches.length - 1]?.pathname;
14
+ return t ? t.length > 1 && t.endsWith("/") && !o.endsWith("/") ? t.slice(0, -1) : t : o;
13
15
  }
14
16
  export {
15
- d as SsgoiRouteBoundary
17
+ p as SsgoiRouteBoundary
16
18
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ssgoi/react",
3
- "version": "7.4.0",
4
- "description": "React bindings for SSGOI - Native app-like page transitions for React applications",
3
+ "version": "7.4.1",
4
+ "description": "Native app-like page transitions for React and Next.js. Make a web app, PWA or WebView app feel native, with Remix, React Router and TanStack Router support.",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "files": [
@@ -90,7 +90,7 @@
90
90
  "dependencies": {
91
91
  "unplugin": "^2.3.2",
92
92
  "@babel/core": "^7.26.10",
93
- "@ssgoi/core": "^7.4.0"
93
+ "@ssgoi/core": "^7.4.1"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@babel/traverse": "7.28.5",
@@ -121,21 +121,33 @@
121
121
  },
122
122
  "keywords": [
123
123
  "react",
124
+ "nextjs",
125
+ "next-js",
126
+ "next.js",
127
+ "remix",
128
+ "react-router",
129
+ "tanstack-router",
130
+ "drill-transition",
124
131
  "page-transition",
125
132
  "page-transitions",
133
+ "route-transition",
134
+ "navigation-animation",
135
+ "native-app",
136
+ "app-like",
137
+ "mobile-web",
138
+ "webview",
139
+ "pwa",
140
+ "capacitor",
141
+ "react-native-webview",
142
+ "hybrid-app",
126
143
  "view-transitions",
127
144
  "view-transition-api-alternative",
128
- "animation",
129
- "ssgoi",
130
- "spring-physics",
131
- "nextjs",
132
- "next-js",
133
- "cross-browser",
134
- "navigation-animation",
135
- "hero-transition",
136
145
  "shared-element-transition",
137
- "route-transition",
138
- "drill-transition"
146
+ "hero-transition",
147
+ "spring-physics",
148
+ "web-animations",
149
+ "animation",
150
+ "ssgoi"
139
151
  ],
140
152
  "author": "MeurSyphus <tmdeoans@snu.ac.kr>",
141
153
  "license": "MIT",