@ssgoi/react 0.0.7 → 2.0.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 +12 -0
- package/dist/context.cjs +2 -0
- package/dist/context.js +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +6 -772
- package/dist/presets/index.cjs +1 -0
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/index.js +1 -0
- package/dist/ssgoi-transition.cjs +2 -0
- package/dist/ssgoi-transition.js +14 -0
- package/dist/ssgoi.cjs +2 -0
- package/dist/ssgoi.js +15 -0
- package/dist/transition.d.ts +1 -2
- package/dist/transitions/index.cjs +1 -1
- package/dist/transitions/index.js +1 -173
- package/dist/view-transitions/index.cjs +1 -1
- package/dist/view-transitions/index.js +1 -305
- package/package.json +38 -3
- package/dist/utils-DR41YsAh-CN_CfgYX.cjs +0 -1
- package/dist/utils-DR41YsAh-mLT5vDuI.js +0 -16
- package/src/assets/react.svg +0 -1
- package/src/lib/context.tsx +0 -14
- package/src/lib/index.ts +0 -4
- package/src/lib/ssgoi-transition.tsx +0 -21
- package/src/lib/ssgoi.tsx +0 -20
- package/src/lib/transition.ts +0 -3
- package/src/lib/transitions/index.ts +0 -1
- package/src/lib/types.ts +0 -1
- package/src/lib/view-transitions/index.ts +0 -1
- package/src/vite-env.d.ts +0 -1
package/src/lib/context.tsx
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from "react";
|
|
2
|
-
import type { SsgoiContext } from "./types";
|
|
3
|
-
|
|
4
|
-
const SsgoiContextInstance = createContext<SsgoiContext | null>(null);
|
|
5
|
-
|
|
6
|
-
export const SsgoiProvider = SsgoiContextInstance.Provider;
|
|
7
|
-
|
|
8
|
-
export const useSsgoi = () => {
|
|
9
|
-
const context = useContext(SsgoiContextInstance);
|
|
10
|
-
if (!context) {
|
|
11
|
-
throw new Error("useSsgoi must be used within SsgoiProvider");
|
|
12
|
-
}
|
|
13
|
-
return context;
|
|
14
|
-
};
|
package/src/lib/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { ReactNode } from "react";
|
|
4
|
-
import { transition } from "./transition";
|
|
5
|
-
import { useSsgoi } from "./context";
|
|
6
|
-
|
|
7
|
-
export const SsgoiTransition = ({
|
|
8
|
-
children,
|
|
9
|
-
id,
|
|
10
|
-
}: {
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
id: string;
|
|
13
|
-
}) => {
|
|
14
|
-
const getTransition = useSsgoi();
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div ref={transition(getTransition(id))} data-ssgoi-transition={id}>
|
|
18
|
-
{children}
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
};
|
package/src/lib/ssgoi.tsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { useMemo } from "react";
|
|
3
|
-
import type { ReactNode } from "react";
|
|
4
|
-
import type { SsgoiConfig, SsgoiContext } from "./types";
|
|
5
|
-
import { SsgoiProvider } from "./context";
|
|
6
|
-
import { createSggoiTransitionContext } from "@ssgoi/core";
|
|
7
|
-
|
|
8
|
-
interface SsgoiProps {
|
|
9
|
-
config: SsgoiConfig;
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const Ssgoi: React.FC<SsgoiProps> = ({ config, children }) => {
|
|
14
|
-
const contextValue = useMemo<SsgoiContext>(
|
|
15
|
-
() => createSggoiTransitionContext(config),
|
|
16
|
-
[config]
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
return <SsgoiProvider value={contextValue}>{children}</SsgoiProvider>;
|
|
20
|
-
};
|
package/src/lib/transition.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@ssgoi/core/transitions';
|
package/src/lib/types.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@ssgoi/core/types";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@ssgoi/core/view-transitions';
|
package/src/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|