@ssgoi/react 7.4.0 → 7.5.0-beta.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 (61) hide show
  1. package/README.md +166 -144
  2. package/dist/context.cjs +2 -0
  3. package/dist/context.d.ts +16 -0
  4. package/dist/context.js +18 -0
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.d.ts +4 -1
  7. package/dist/index.js +8 -4
  8. package/dist/layout-boundary.cjs +2 -0
  9. package/dist/layout-boundary.d.ts +35 -0
  10. package/dist/layout-boundary.js +63 -0
  11. package/dist/legacy/nextjs/index.d.ts +9 -0
  12. package/dist/{routers → legacy}/nextjs/selected-segments-to-path.d.ts +3 -0
  13. package/dist/legacy/nextjs/ssgoi-route-boundary.cjs +2 -0
  14. package/dist/{routers → legacy}/nextjs/ssgoi-route-boundary.d.ts +14 -1
  15. package/dist/legacy/nextjs/ssgoi-route-boundary.js +14 -0
  16. package/dist/legacy/react-router.d.ts +20 -0
  17. package/dist/legacy/remix.d.ts +25 -0
  18. package/dist/legacy/route-boundary.cjs +2 -0
  19. package/dist/legacy/route-boundary.d.ts +33 -0
  20. package/dist/legacy/route-boundary.js +33 -0
  21. package/dist/{ssgoi-transition.d.ts → legacy/ssgoi-transition.d.ts} +1 -2
  22. package/dist/legacy/tanstack-router.d.ts +19 -0
  23. package/dist/legacy/unplugin/esbuild.d.ts +3 -0
  24. package/dist/legacy/unplugin/index.d.ts +17 -0
  25. package/dist/legacy/unplugin/rollup.d.ts +3 -0
  26. package/dist/legacy/unplugin/vite.d.ts +3 -0
  27. package/dist/legacy/unplugin/webpack.d.ts +3 -0
  28. package/dist/nextjs.cjs +1 -1
  29. package/dist/nextjs.d.ts +1 -1
  30. package/dist/nextjs.js +2 -2
  31. package/dist/react-router.cjs +1 -1
  32. package/dist/react-router.d.ts +1 -1
  33. package/dist/react-router.js +7 -10
  34. package/dist/remix.cjs +1 -1
  35. package/dist/remix.d.ts +1 -1
  36. package/dist/remix.js +7 -10
  37. package/dist/ssgoi.cjs +1 -1
  38. package/dist/ssgoi.d.ts +6 -0
  39. package/dist/ssgoi.js +23 -14
  40. package/dist/tanstack-router.cjs +1 -1
  41. package/dist/tanstack-router.d.ts +1 -1
  42. package/dist/tanstack-router.js +13 -12
  43. package/dist/unplugin/esbuild.d.ts +4 -2
  44. package/dist/unplugin/index.d.ts +6 -14
  45. package/dist/unplugin/rollup.d.ts +4 -2
  46. package/dist/unplugin/vite.d.ts +4 -2
  47. package/dist/unplugin/webpack.d.ts +4 -2
  48. package/package.json +34 -22
  49. package/dist/routers/nextjs/index.d.ts +0 -4
  50. package/dist/routers/nextjs/ssgoi-route-boundary.cjs +0 -2
  51. package/dist/routers/nextjs/ssgoi-route-boundary.js +0 -24
  52. package/dist/routers/react-router.d.ts +0 -7
  53. package/dist/routers/remix.d.ts +0 -8
  54. package/dist/routers/route-boundary.cjs +0 -2
  55. package/dist/routers/route-boundary.d.ts +0 -22
  56. package/dist/routers/route-boundary.js +0 -22
  57. package/dist/routers/tanstack-router.d.ts +0 -6
  58. /package/dist/{routers → legacy}/nextjs/selected-segments-to-path.cjs +0 -0
  59. /package/dist/{routers → legacy}/nextjs/selected-segments-to-path.js +0 -0
  60. /package/dist/{ssgoi-transition.cjs → legacy/ssgoi-transition.cjs} +0 -0
  61. /package/dist/{ssgoi-transition.js → legacy/ssgoi-transition.js} +0 -0
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ import { usePathname as u, useSelectedLayoutSegments as r } from "next/navigation";
4
+ import { SuspendedRouteBoundary as s } from "../route-boundary.js";
5
+ const m = ({ parallelRoutesKey: e = "children" }) => {
6
+ const t = u(), o = r(e) ?? [];
7
+ return t == null ? null : { pathname: t, selectedSegments: o };
8
+ };
9
+ function l(e) {
10
+ return /* @__PURE__ */ n(s, { ...e, useRoute: m });
11
+ }
12
+ export {
13
+ l as SsgoiRouteBoundary
14
+ };
@@ -0,0 +1,20 @@
1
+ import { ElementType } from 'react';
2
+ import { Location } from 'react-router';
3
+ import { RouteBoundaryProps, RouteBoundaryState as RootRouteBoundaryState } from './route-boundary';
4
+ /**
5
+ * @deprecated Will be removed in 8.0.0. Use `SsgoiLayoutBoundary` from
6
+ * "@ssgoi/react" with `<Ssgoi framework={...}>` instead.
7
+ */
8
+ export type SsgoiRouteBoundaryProps<T extends ElementType = "div"> = RouteBoundaryProps<Location, T>;
9
+ /**
10
+ * @experimental React Router integration. The API may change.
11
+ *
12
+ * @deprecated Will be removed in 8.0.0. Use `SsgoiLayoutBoundary` from
13
+ * "@ssgoi/react" with `<Ssgoi framework={...}>` instead.
14
+ */
15
+ export declare function SsgoiRouteBoundary<T extends ElementType = "div">(props: SsgoiRouteBoundaryProps<T>): import("react/jsx-runtime").JSX.Element;
16
+ /**
17
+ * @deprecated Will be removed in 8.0.0. Use `SsgoiLayoutBoundary` from
18
+ * "@ssgoi/react" with `<Ssgoi framework={...}>` instead.
19
+ */
20
+ export type RouteBoundaryState = RootRouteBoundaryState;
@@ -0,0 +1,25 @@
1
+ import { ElementType } from 'react';
2
+ import { useLocation } from '@remix-run/react';
3
+ import { RouteBoundaryProps, RouteBoundaryState as RootRouteBoundaryState } from './route-boundary';
4
+ /**
5
+ * @deprecated Will be removed in 8.0.0. Use `SsgoiLayoutBoundary` from
6
+ * "@ssgoi/react" with `<Ssgoi framework={...}>` instead.
7
+ */
8
+ export type RemixRouteLocation = ReturnType<typeof useLocation>;
9
+ /**
10
+ * @deprecated Will be removed in 8.0.0. Use `SsgoiLayoutBoundary` from
11
+ * "@ssgoi/react" with `<Ssgoi framework={...}>` instead.
12
+ */
13
+ export type SsgoiRouteBoundaryProps<T extends ElementType = "div"> = RouteBoundaryProps<RemixRouteLocation, T>;
14
+ /**
15
+ * @experimental Remix 2 integration. The API may change.
16
+ *
17
+ * @deprecated Will be removed in 8.0.0. Use `SsgoiLayoutBoundary` from
18
+ * "@ssgoi/react" with `<Ssgoi framework={...}>` instead.
19
+ */
20
+ export declare function SsgoiRouteBoundary<T extends ElementType = "div">(props: SsgoiRouteBoundaryProps<T>): import("react/jsx-runtime").JSX.Element;
21
+ /**
22
+ * @deprecated Will be removed in 8.0.0. Use `SsgoiLayoutBoundary` from
23
+ * "@ssgoi/react" with `<Ssgoi framework={...}>` instead.
24
+ */
25
+ export type RouteBoundaryState = RootRouteBoundaryState;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),o=require("react");function R(e){return u.jsx(o.Suspense,{fallback:e.fallback??null,children:u.jsx(r,{...e})})}function r({useRoute:e,resolve:a,routeKey:d,parallelRoutesKey:i,fallback:s,as:l,children:c,...y}){const n=e({parallelRoutesKey:i});if(n==null)return s??null;const t=a?.(n)??{id:n.pathname},f=l??"div";return o.createElement(f,{...y,key:d??t.key??t.id,"data-ssgoi-transition":t.id},c)}exports.RouteBoundary=r;exports.SuspendedRouteBoundary=R;
@@ -0,0 +1,33 @@
1
+ import { ComponentPropsWithoutRef, ElementType, HTMLAttributes, ReactNode } from 'react';
2
+ export interface RouteBoundaryState {
3
+ id: string;
4
+ /** Defaults to id. Keep this stable while a nested layout owns navigation. */
5
+ key?: string | number;
6
+ }
7
+ export interface RouteLocation {
8
+ pathname: string;
9
+ }
10
+ export type RouteBoundaryProps<Location extends RouteLocation = RouteLocation, T extends ElementType = "div"> = {
11
+ children?: ReactNode;
12
+ as?: T;
13
+ /** A stable lifetime for a boundary inside a persistent route layout. */
14
+ routeKey?: string | number;
15
+ /** Resolve the logical route and its lifetime together during render. */
16
+ resolve?: (location: Location) => RouteBoundaryState;
17
+ } & Omit<ComponentPropsWithoutRef<T>, "as" | "children" | "resolve" | "routeKey">;
18
+ /** Reads the route with the subpath's own router hooks; `null` while not ready. */
19
+ export type UseRoute = (options: {
20
+ parallelRoutesKey?: string;
21
+ }) => RouteLocation | null;
22
+ type LegacyBoundaryProps = HTMLAttributes<HTMLElement> & {
23
+ useRoute: UseRoute;
24
+ as?: ElementType;
25
+ routeKey?: string | number;
26
+ resolve?: (location: never) => RouteBoundaryState;
27
+ parallelRoutesKey?: string;
28
+ fallback?: ReactNode;
29
+ };
30
+ /** Catches URL suspension outside the hooks that throw it. */
31
+ export declare function SuspendedRouteBoundary(props: LegacyBoundaryProps): import("react/jsx-runtime").JSX.Element;
32
+ export declare function RouteBoundary({ useRoute, resolve, routeKey, parallelRoutesKey, fallback, as, children, ...rest }: LegacyBoundaryProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
33
+ export {};
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { jsx as o } from "react/jsx-runtime";
3
+ import { Suspense as s, createElement as m } from "react";
4
+ function b(n) {
5
+ return /* @__PURE__ */ o(s, { fallback: n.fallback ?? null, children: /* @__PURE__ */ o(f, { ...n }) });
6
+ }
7
+ function f({
8
+ useRoute: n,
9
+ resolve: r,
10
+ routeKey: u,
11
+ parallelRoutesKey: a,
12
+ fallback: i,
13
+ as: l,
14
+ children: d,
15
+ ...c
16
+ }) {
17
+ const t = n({ parallelRoutesKey: a });
18
+ if (t == null) return i ?? null;
19
+ const e = r?.(t) ?? { id: t.pathname };
20
+ return /* @__PURE__ */ m(
21
+ l ?? "div",
22
+ {
23
+ ...c,
24
+ key: u ?? e.key ?? e.id,
25
+ "data-ssgoi-transition": e.id
26
+ },
27
+ d
28
+ );
29
+ }
30
+ export {
31
+ f as RouteBoundary,
32
+ b as SuspendedRouteBoundary
33
+ };
@@ -8,8 +8,7 @@ type SsgoiTransitionProps<T extends ElementType = "div"> = {
8
8
  /**
9
9
  * Marks a subtree as a Ssgoi page boundary.
10
10
  *
11
- * @deprecated Set `data-ssgoi-transition` directly on the page boundary
12
- * element inside `<Ssgoi>` instead.
11
+ * @deprecated Will be removed in 8.0.0.
13
12
  */
14
13
  export declare const SsgoiTransition: <T extends ElementType = "div">({ children, id, as, className, ...rest }: SsgoiTransitionProps<T>) => import("react/jsx-runtime").JSX.Element;
15
14
  export {};
@@ -0,0 +1,19 @@
1
+ import { ElementType } from 'react';
2
+ import { RouteBoundaryProps, RouteBoundaryState as RootRouteBoundaryState, RouteLocation } from './route-boundary';
3
+ /**
4
+ * @deprecated Will be removed in 8.0.0. Use `SsgoiLayoutBoundary` from
5
+ * "@ssgoi/react" with `<Ssgoi framework={...}>` instead.
6
+ */
7
+ export type SsgoiRouteBoundaryProps<T extends ElementType = "div"> = RouteBoundaryProps<RouteLocation, T>;
8
+ /**
9
+ * @experimental TanStack Router integration. The API may change.
10
+ *
11
+ * @deprecated Will be removed in 8.0.0. Use `SsgoiLayoutBoundary` from
12
+ * "@ssgoi/react" with `<Ssgoi framework={...}>` instead.
13
+ */
14
+ export declare function SsgoiRouteBoundary<T extends ElementType = "div">(props: SsgoiRouteBoundaryProps<T>): import("react/jsx-runtime").JSX.Element;
15
+ /**
16
+ * @deprecated Will be removed in 8.0.0. Use `SsgoiLayoutBoundary` from
17
+ * "@ssgoi/react" with `<Ssgoi framework={...}>` instead.
18
+ */
19
+ export type RouteBoundaryState = RootRouteBoundaryState;
@@ -0,0 +1,3 @@
1
+ /** @deprecated Will be removed in 8.0.0. */
2
+ declare const _default: (options?: import('./index').SsgoiAutoKeyOptions | undefined) => import('esbuild').Plugin;
3
+ export default _default;
@@ -0,0 +1,17 @@
1
+ /** @deprecated Will be removed in 8.0.0. */
2
+ export interface SsgoiAutoKeyOptions {
3
+ /**
4
+ * File extensions to process
5
+ * @default ['.tsx', '.jsx']
6
+ */
7
+ include?: string[];
8
+ /**
9
+ * File patterns to exclude
10
+ * @default [/node_modules/]
11
+ */
12
+ exclude?: (string | RegExp)[];
13
+ }
14
+ /** @deprecated Will be removed in 8.0.0. */
15
+ export declare const unplugin: import('unplugin').UnpluginInstance<SsgoiAutoKeyOptions | undefined, boolean>;
16
+ /** @deprecated Will be removed in 8.0.0. */
17
+ export default unplugin;
@@ -0,0 +1,3 @@
1
+ /** @deprecated Will be removed in 8.0.0. */
2
+ declare const _default: (options?: import('./index').SsgoiAutoKeyOptions | undefined) => import('rollup').Plugin<any> | import('rollup').Plugin<any>[];
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ /** @deprecated Will be removed in 8.0.0. */
2
+ declare const _default: (options?: import('./index').SsgoiAutoKeyOptions | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ /** @deprecated Will be removed in 8.0.0. */
2
+ declare const _default: (options?: import('./index').SsgoiAutoKeyOptions | undefined) => import('webpack').WebpackPluginInstance;
3
+ export default _default;
package/dist/nextjs.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./routers/nextjs/ssgoi-route-boundary.cjs"),t=require("./routers/nextjs/selected-segments-to-path.cjs");exports.SsgoiRouteBoundary=e.SsgoiRouteBoundary;exports.selectedSegmentsToPath=t.selectedSegmentsToPath;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./legacy/nextjs/ssgoi-route-boundary.cjs"),t=require("./legacy/nextjs/selected-segments-to-path.cjs");exports.SsgoiRouteBoundary=e.SsgoiRouteBoundary;exports.selectedSegmentsToPath=t.selectedSegmentsToPath;
package/dist/nextjs.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './routers/nextjs/index'
1
+ export * from './legacy/nextjs/index'
2
2
  export {}
package/dist/nextjs.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { SsgoiRouteBoundary as t } from "./routers/nextjs/ssgoi-route-boundary.js";
3
- import { selectedSegmentsToPath as m } from "./routers/nextjs/selected-segments-to-path.js";
2
+ import { SsgoiRouteBoundary as t } from "./legacy/nextjs/ssgoi-route-boundary.js";
3
+ import { selectedSegmentsToPath as m } from "./legacy/nextjs/selected-segments-to-path.js";
4
4
  export {
5
5
  t as SsgoiRouteBoundary,
6
6
  m as selectedSegmentsToPath
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("react-router"),i=require("./routers/route-boundary.cjs");function a({resolve:e,...t}){const o=n.useLocation(),r=e?.(o)??{id:o.pathname};return u.jsx(i.RouteBoundary,{...t,boundary:r})}exports.SsgoiRouteBoundary=a;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("react-router"),u=require("./legacy/route-boundary.cjs"),r=()=>t.useLocation();function n(e){return o.jsx(u.RouteBoundary,{...e,useRoute:r})}exports.SsgoiRouteBoundary=n;
@@ -1,2 +1,2 @@
1
- export * from './routers/react-router'
1
+ export * from './legacy/react-router'
2
2
  export {}
@@ -1,14 +1,11 @@
1
1
  "use client";
2
- import { jsx as i } from "react/jsx-runtime";
3
- import { useLocation as u } from "react-router";
4
- import { RouteBoundary as a } from "./routers/route-boundary.js";
5
- function p({
6
- resolve: t,
7
- ...r
8
- }) {
9
- const o = u(), n = t?.(o) ?? { id: o.pathname };
10
- return /* @__PURE__ */ i(a, { ...r, boundary: n });
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ import { useLocation as t } from "react-router";
4
+ import { RouteBoundary as u } from "./legacy/route-boundary.js";
5
+ const e = () => t();
6
+ function s(o) {
7
+ return /* @__PURE__ */ r(u, { ...o, useRoute: e });
11
8
  }
12
9
  export {
13
- p as SsgoiRouteBoundary
10
+ s as SsgoiRouteBoundary
14
11
  };
package/dist/remix.cjs CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),u=require("@remix-run/react"),i=require("./routers/route-boundary.cjs");function a({resolve:e,...t}){const o=u.useLocation(),n=e?.(o)??{id:o.pathname};return r.jsx(i.RouteBoundary,{...t,boundary:n})}exports.SsgoiRouteBoundary=a;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("@remix-run/react"),u=require("./legacy/route-boundary.cjs"),r=()=>t.useLocation();function n(e){return o.jsx(u.RouteBoundary,{...e,useRoute:r})}exports.SsgoiRouteBoundary=n;
package/dist/remix.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './routers/remix'
1
+ export * from './legacy/remix'
2
2
  export {}
package/dist/remix.js CHANGED
@@ -1,14 +1,11 @@
1
1
  "use client";
2
- import { jsx as i } from "react/jsx-runtime";
3
- import { useLocation as u } from "@remix-run/react";
4
- import { RouteBoundary as a } from "./routers/route-boundary.js";
5
- function p({
6
- resolve: t,
7
- ...r
8
- }) {
9
- const o = u(), n = t?.(o) ?? { id: o.pathname };
10
- return /* @__PURE__ */ i(a, { ...r, boundary: n });
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ import { useLocation as t } from "@remix-run/react";
4
+ import { RouteBoundary as u } from "./legacy/route-boundary.js";
5
+ const e = () => t();
6
+ function s(o) {
7
+ return /* @__PURE__ */ r(u, { ...o, useRoute: e });
11
8
  }
12
9
  export {
13
- p as SsgoiRouteBoundary
10
+ s as SsgoiRouteBoundary
14
11
  };
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 r=require("react/jsx-runtime"),e=require("react"),u=require("@ssgoi/core/internal"),l=require("./context.cjs"),d=require("./layout-boundary.cjs"),g={display:"contents"},y=e.memo(({config:t,host:s,framework:c,children:a})=>{const n=e.useRef(null),o=e.useMemo(()=>u.createSggoiTransitionContext(t,{host:s}),[t,s]);return e.useEffect(()=>{const i=n.current;if(i)return u.observeSsgoiTransitions(i,o)},[o]),r.jsx(l.ssgoiContext.Provider,{value:o,children:r.jsx("div",{ref:n,"data-ssgoi-root":"",style:g,children:r.jsx(d.SsgoiFrameworkProvider,{framework:c,layouts:t.layouts,children:a})})})});exports.Ssgoi=y;
package/dist/ssgoi.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { default as React, ReactNode } from 'react';
2
2
  import { SsgoiConfig } from '@ssgoi/core/types';
3
3
  import { HostAnimation } from '@ssgoi/core/internal';
4
+ import { SsgoiFramework } from './layout-boundary';
4
5
  interface SsgoiProps {
5
6
  config: SsgoiConfig;
6
7
  /**
@@ -9,6 +10,11 @@ interface SsgoiProps {
9
10
  * outside the tree.
10
11
  */
11
12
  host?: HostAnimation;
13
+ /**
14
+ * How to read the router for `SsgoiLayoutBoundary`. The first boundary reads
15
+ * the route and keys it against `config.layouts`. Keep the object stable.
16
+ */
17
+ framework?: SsgoiFramework;
12
18
  children: ReactNode;
13
19
  }
14
20
  export declare const Ssgoi: React.FC<SsgoiProps>;
package/dist/ssgoi.js CHANGED
@@ -1,20 +1,29 @@
1
1
  "use client";
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]
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import a, { useRef as u, useMemo as c, useEffect as l } from "react";
4
+ import { createSggoiTransitionContext as f, observeSsgoiTransitions as d } from "@ssgoi/core/internal";
5
+ import { ssgoiContext as p } from "./context.js";
6
+ import { SsgoiFrameworkProvider as g } from "./layout-boundary.js";
7
+ const v = { display: "contents" }, P = a.memo(
8
+ ({ config: o, host: e, framework: n, children: m }) => {
9
+ const s = u(null), r = c(
10
+ () => f(o, { host: e }),
11
+ [o, e]
10
12
  );
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
+ return l(() => {
14
+ const i = s.current;
15
+ if (i)
16
+ return d(i, r);
17
+ }, [r]), /* @__PURE__ */ t(p.Provider, { value: r, children: /* @__PURE__ */ t("div", { ref: s, "data-ssgoi-root": "", style: v, children: /* @__PURE__ */ t(
18
+ g,
19
+ {
20
+ framework: n,
21
+ layouts: o.layouts,
22
+ children: m
23
+ }
24
+ ) }) });
16
25
  }
17
26
  );
18
27
  export {
19
- x as Ssgoi
28
+ P as Ssgoi
20
29
  };
@@ -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 o=require("react/jsx-runtime"),r=require("@tanstack/react-router"),u=require("./legacy/route-boundary.cjs"),a=()=>({pathname:r.useRouterState({select:c})});function s(e){return o.jsx(u.RouteBoundary,{...e,useRoute:a})}function c(e){const n=e.location.pathname,t=e.matches?.[e.matches.length-1]?.pathname;return t?t.length>1&&t.endsWith("/")&&!n.endsWith("/")?t.slice(0,-1):t:n}exports.SsgoiRouteBoundary=s;
@@ -1,2 +1,2 @@
1
- export * from './routers/tanstack-router'
1
+ export * from './legacy/tanstack-router'
2
2
  export {}
@@ -1,16 +1,17 @@
1
1
  "use client";
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
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 });
2
+ import { jsx as o } from "react/jsx-runtime";
3
+ import { useRouterState as r } from "@tanstack/react-router";
4
+ import { RouteBoundary as a } from "./legacy/route-boundary.js";
5
+ const u = () => ({
6
+ pathname: r({ select: i })
7
+ });
8
+ function h(t) {
9
+ return /* @__PURE__ */ o(a, { ...t, useRoute: u });
10
+ }
11
+ function i(t) {
12
+ const n = t.location.pathname, e = t.matches?.[t.matches.length - 1]?.pathname;
13
+ return e ? e.length > 1 && e.endsWith("/") && !n.endsWith("/") ? e.slice(0, -1) : e : n;
13
14
  }
14
15
  export {
15
- d as SsgoiRouteBoundary
16
+ h as SsgoiRouteBoundary
16
17
  };
@@ -1,2 +1,4 @@
1
- declare const _default: (options?: import('./index').SsgoiAutoKeyOptions | undefined) => import('esbuild').Plugin;
2
- export default _default;
1
+ export {}
2
+ import _default from '../legacy/unplugin/esbuild'
3
+ export default _default
4
+ export {}
@@ -1,14 +1,6 @@
1
- export interface SsgoiAutoKeyOptions {
2
- /**
3
- * File extensions to process
4
- * @default ['.tsx', '.jsx']
5
- */
6
- include?: string[];
7
- /**
8
- * File patterns to exclude
9
- * @default [/node_modules/]
10
- */
11
- exclude?: (string | RegExp)[];
12
- }
13
- export declare const unplugin: import('unplugin').UnpluginInstance<SsgoiAutoKeyOptions | undefined, boolean>;
14
- export default unplugin;
1
+ export * from '../legacy/unplugin/index'
2
+ export {}
3
+ import _default from '../legacy/unplugin/index'
4
+ export default _default
5
+ export * from '../legacy/unplugin/index'
6
+ export {}
@@ -1,2 +1,4 @@
1
- declare const _default: (options?: import('./index').SsgoiAutoKeyOptions | undefined) => import('rollup').Plugin<any> | import('rollup').Plugin<any>[];
2
- export default _default;
1
+ export {}
2
+ import _default from '../legacy/unplugin/rollup'
3
+ export default _default
4
+ export {}
@@ -1,2 +1,4 @@
1
- declare const _default: (options?: import('./index').SsgoiAutoKeyOptions | undefined) => import('vite').Plugin<any> | import('vite').Plugin<any>[];
2
- export default _default;
1
+ export {}
2
+ import _default from '../legacy/unplugin/vite'
3
+ export default _default
4
+ export {}
@@ -1,2 +1,4 @@
1
- declare const _default: (options?: import('./index').SsgoiAutoKeyOptions | undefined) => import('webpack').WebpackPluginInstance;
2
- export default _default;
1
+ export {}
2
+ import _default from '../legacy/unplugin/webpack'
3
+ export default _default
4
+ export {}
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.5.0-beta.0",
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": [
@@ -33,55 +33,55 @@
33
33
  "default": "./dist/view-transitions.js"
34
34
  },
35
35
  "./unplugin": {
36
- "types": "./dist/unplugin/index.d.ts",
36
+ "types": "./dist/legacy/unplugin/index.d.ts",
37
37
  "import": "./dist/unplugin/index.js",
38
38
  "require": "./dist/unplugin/index.cjs",
39
39
  "default": "./dist/unplugin/index.js"
40
40
  },
41
41
  "./unplugin/webpack": {
42
- "types": "./dist/unplugin/webpack.d.ts",
42
+ "types": "./dist/legacy/unplugin/webpack.d.ts",
43
43
  "import": "./dist/unplugin/webpack.js",
44
44
  "require": "./dist/unplugin/webpack.cjs",
45
45
  "default": "./dist/unplugin/webpack.js"
46
46
  },
47
47
  "./unplugin/vite": {
48
- "types": "./dist/unplugin/vite.d.ts",
48
+ "types": "./dist/legacy/unplugin/vite.d.ts",
49
49
  "import": "./dist/unplugin/vite.js",
50
50
  "require": "./dist/unplugin/vite.cjs",
51
51
  "default": "./dist/unplugin/vite.js"
52
52
  },
53
53
  "./unplugin/rollup": {
54
- "types": "./dist/unplugin/rollup.d.ts",
54
+ "types": "./dist/legacy/unplugin/rollup.d.ts",
55
55
  "import": "./dist/unplugin/rollup.js",
56
56
  "require": "./dist/unplugin/rollup.cjs",
57
57
  "default": "./dist/unplugin/rollup.js"
58
58
  },
59
59
  "./unplugin/esbuild": {
60
- "types": "./dist/unplugin/esbuild.d.ts",
60
+ "types": "./dist/legacy/unplugin/esbuild.d.ts",
61
61
  "import": "./dist/unplugin/esbuild.js",
62
62
  "require": "./dist/unplugin/esbuild.cjs",
63
63
  "default": "./dist/unplugin/esbuild.js"
64
64
  },
65
65
  "./nextjs": {
66
- "types": "./dist/routers/nextjs/index.d.ts",
66
+ "types": "./dist/legacy/nextjs/index.d.ts",
67
67
  "import": "./dist/nextjs.js",
68
68
  "require": "./dist/nextjs.cjs",
69
69
  "default": "./dist/nextjs.js"
70
70
  },
71
71
  "./react-router": {
72
- "types": "./dist/routers/react-router.d.ts",
72
+ "types": "./dist/legacy/react-router.d.ts",
73
73
  "import": "./dist/react-router.js",
74
74
  "require": "./dist/react-router.cjs",
75
75
  "default": "./dist/react-router.js"
76
76
  },
77
77
  "./tanstack-router": {
78
- "types": "./dist/routers/tanstack-router.d.ts",
78
+ "types": "./dist/legacy/tanstack-router.d.ts",
79
79
  "import": "./dist/tanstack-router.js",
80
80
  "require": "./dist/tanstack-router.cjs",
81
81
  "default": "./dist/tanstack-router.js"
82
82
  },
83
83
  "./remix": {
84
- "types": "./dist/routers/remix.d.ts",
84
+ "types": "./dist/legacy/remix.d.ts",
85
85
  "import": "./dist/remix.js",
86
86
  "require": "./dist/remix.cjs",
87
87
  "default": "./dist/remix.js"
@@ -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.5.0-beta.0"
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",
@@ -1,4 +0,0 @@
1
- export { SsgoiRouteBoundary } from './ssgoi-route-boundary';
2
- export type { SsgoiRouteBoundaryProps, NextjsRouteLocation, } from './ssgoi-route-boundary';
3
- export type { RouteBoundaryState } from '../route-boundary';
4
- export { selectedSegmentsToPath } from './selected-segments-to-path';
@@ -1,2 +0,0 @@
1
- "use client";
2
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("react"),u=require("next/navigation"),l=require("../route-boundary.cjs");function d(e){return t.jsx(i.Suspense,{fallback:e.fallback??null,children:t.jsx(y,{...e})})}function y({resolve:e,parallelRoutesKey:o="children",fallback:r,...s}){const n=u.usePathname(),a=u.useSelectedLayoutSegments(o)??[];if(n==null)return r??null;const c=e?.({pathname:n,selectedSegments:a})??{id:n};return t.jsx(l.RouteBoundary,{...s,boundary:c})}exports.SsgoiRouteBoundary=d;