@ssgoi/react 6.2.0 → 6.4.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 +8 -12
- package/dist/lib/ssgoi-transition.cjs +1 -1
- package/dist/lib/ssgoi-transition.d.ts +2 -5
- package/dist/lib/ssgoi-transition.js +8 -21
- package/dist/lib/ssgoi.cjs +1 -1
- package/dist/lib/ssgoi.js +14 -11
- package/package.json +2 -2
- package/dist/lib/context.cjs +0 -2
- package/dist/lib/context.d.ts +0 -3
- package/dist/lib/context.js +0 -11
package/README.md
CHANGED
|
@@ -45,17 +45,15 @@ export default function App() {
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
### 2.
|
|
48
|
+
### 2. Mark your pages
|
|
49
49
|
|
|
50
50
|
```tsx
|
|
51
|
-
import { SsgoiTransition } from "@ssgoi/react";
|
|
52
|
-
|
|
53
51
|
export default function HomePage() {
|
|
54
52
|
return (
|
|
55
|
-
<
|
|
53
|
+
<main data-ssgoi-transition="/">
|
|
56
54
|
<h1>Welcome</h1>
|
|
57
55
|
{/* Page content */}
|
|
58
|
-
</
|
|
56
|
+
</main>
|
|
59
57
|
);
|
|
60
58
|
}
|
|
61
59
|
```
|
|
@@ -246,11 +244,8 @@ export default function RootLayout({ children }) {
|
|
|
246
244
|
);
|
|
247
245
|
}
|
|
248
246
|
|
|
249
|
-
// app/page.tsx
|
|
250
|
-
import { SsgoiTransition } from "@ssgoi/react";
|
|
251
|
-
|
|
252
247
|
export default function Page() {
|
|
253
|
-
return <
|
|
248
|
+
return <main data-ssgoi-transition="/">{/* Your page content */}</main>;
|
|
254
249
|
}
|
|
255
250
|
```
|
|
256
251
|
|
|
@@ -266,12 +261,13 @@ The provider component that manages transition context.
|
|
|
266
261
|
<Ssgoi config={ssgoiConfig}>{children}</Ssgoi>
|
|
267
262
|
```
|
|
268
263
|
|
|
269
|
-
####
|
|
264
|
+
#### `data-ssgoi-transition`
|
|
270
265
|
|
|
271
|
-
|
|
266
|
+
Attribute for pages that should transition. Set it on the page boundary element
|
|
267
|
+
inside `<Ssgoi>`.
|
|
272
268
|
|
|
273
269
|
```tsx
|
|
274
|
-
<
|
|
270
|
+
<main data-ssgoi-transition="/page-id">{children}</main>
|
|
275
271
|
```
|
|
276
272
|
|
|
277
273
|
### Hooks
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=({children:t,id:i,as:n,className:o,...s})=>{const e=n||"div";return r.jsx(e,{"data-ssgoi-transition":i,className:o,...s,children:t})};exports.SsgoiTransition=a;
|
|
@@ -8,11 +8,8 @@ type SsgoiTransitionProps<T extends ElementType = "div"> = {
|
|
|
8
8
|
/**
|
|
9
9
|
* Marks a subtree as a Ssgoi page boundary.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* id, so React doesn't see a fresh ref each commit and won't churn the
|
|
14
|
-
* attach/detach cycle. Unmount is detected internally via the shared
|
|
15
|
-
* MutationObserver in the dispatcher; nothing extra to wire up here.
|
|
11
|
+
* @deprecated Set `data-ssgoi-transition` directly on the page boundary
|
|
12
|
+
* element inside `<Ssgoi>` instead.
|
|
16
13
|
*/
|
|
17
14
|
export declare const SsgoiTransition: <T extends ElementType = "div">({ children, id, as, className, ...rest }: SsgoiTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
18
15
|
export {};
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
className: r,
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
const m = ({
|
|
4
|
+
children: o,
|
|
5
|
+
id: n,
|
|
6
|
+
as: t,
|
|
7
|
+
className: i,
|
|
9
8
|
...s
|
|
10
|
-
}) => {
|
|
11
|
-
const { refFor: i } = m();
|
|
12
|
-
return /* @__PURE__ */ e(
|
|
13
|
-
n || "div",
|
|
14
|
-
{
|
|
15
|
-
ref: i(o),
|
|
16
|
-
"data-ssgoi-transition": o,
|
|
17
|
-
className: r,
|
|
18
|
-
...s,
|
|
19
|
-
children: t
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
};
|
|
9
|
+
}) => /* @__PURE__ */ r(t || "div", { "data-ssgoi-transition": n, className: i, ...s, children: o });
|
|
23
10
|
export {
|
|
24
|
-
|
|
11
|
+
m as SsgoiTransition
|
|
25
12
|
};
|
package/dist/lib/ssgoi.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|
package/dist/lib/ssgoi.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[o, r]
|
|
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]
|
|
11
10
|
);
|
|
12
|
-
return
|
|
11
|
+
return u(() => {
|
|
12
|
+
const s = r.current;
|
|
13
|
+
if (s)
|
|
14
|
+
return g(s, e);
|
|
15
|
+
}, [e]), /* @__PURE__ */ i("div", { ref: r, "data-ssgoi-root": "", style: l, children: n });
|
|
13
16
|
}
|
|
14
17
|
);
|
|
15
18
|
export {
|
|
16
|
-
|
|
19
|
+
x as Ssgoi
|
|
17
20
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ssgoi/react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "React bindings for SSGOI - Native app-like page transitions for React applications",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"unplugin": "^2.3.2",
|
|
68
68
|
"@babel/core": "^7.26.10",
|
|
69
|
-
"@ssgoi/core": "^6.
|
|
69
|
+
"@ssgoi/core": "^6.4.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/babel__core": "^7.20.5",
|
package/dist/lib/context.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),t=o.createContext(null),r=t.Provider,s=()=>{const e=o.useContext(t);if(!e)throw new Error("useSsgoi must be used within Ssgoi provider");return e};exports.SsgoiProvider=r;exports.useSsgoi=s;
|
package/dist/lib/context.d.ts
DELETED
package/dist/lib/context.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { createContext as e, useContext as r } from "react";
|
|
3
|
-
const t = e(null), n = t.Provider, i = () => {
|
|
4
|
-
const o = r(t);
|
|
5
|
-
if (!o) throw new Error("useSsgoi must be used within Ssgoi provider");
|
|
6
|
-
return o;
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
n as SsgoiProvider,
|
|
10
|
-
i as useSsgoi
|
|
11
|
-
};
|