@0xchain/providers 1.1.0-beta.11 → 1.1.0-beta.113
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/dist/TopProgressBarProvider.js +30 -22
- package/dist/app-shell.d.ts +17 -0
- package/dist/app-shell.d.ts.map +1 -0
- package/dist/app-shell.js +26 -0
- package/dist/theme.js +14 -14
- package/package.json +27 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs
|
|
3
|
-
import { createContext
|
|
4
|
-
import { usePathname
|
|
5
|
-
import { twMerge
|
|
6
|
-
const
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useState, useEffect } from "react";
|
|
4
|
+
import { usePathname } from "next/navigation";
|
|
5
|
+
import { twMerge } from "tailwind-merge";
|
|
6
|
+
const ProgressContext = createContext({
|
|
7
7
|
start: () => {
|
|
8
8
|
console.log("start");
|
|
9
9
|
},
|
|
@@ -11,33 +11,41 @@ const r = p({
|
|
|
11
11
|
console.log("done");
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
function
|
|
15
|
-
return
|
|
14
|
+
function useProgressBar() {
|
|
15
|
+
return useContext(ProgressContext);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
function TopProgressBarProvider({ children }) {
|
|
18
|
+
const [loading, setLoading] = useState(false);
|
|
19
|
+
const [complete, setComplete] = useState(false);
|
|
20
|
+
const pathname = usePathname();
|
|
21
|
+
const start = () => {
|
|
22
|
+
setComplete(false);
|
|
23
|
+
setLoading(true);
|
|
24
|
+
};
|
|
25
|
+
const done = () => {
|
|
26
|
+
setComplete(true);
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
setLoading(false);
|
|
29
|
+
setComplete(false);
|
|
23
30
|
}, 300);
|
|
24
31
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, [
|
|
28
|
-
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
done();
|
|
34
|
+
}, [pathname]);
|
|
35
|
+
return /* @__PURE__ */ jsxs(ProgressContext.Provider, { value: { start, done }, children: [
|
|
36
|
+
loading && /* @__PURE__ */ jsx(
|
|
29
37
|
"div",
|
|
30
38
|
{
|
|
31
|
-
className:
|
|
39
|
+
className: twMerge(
|
|
32
40
|
"fixed top-0 left-0 z-9999 h-[3px] bg-blue-500 transition-all",
|
|
33
|
-
|
|
41
|
+
complete ? "animate-progress-complete" : "animate-progress-grow"
|
|
34
42
|
)
|
|
35
43
|
}
|
|
36
44
|
),
|
|
37
|
-
|
|
45
|
+
children
|
|
38
46
|
] });
|
|
39
47
|
}
|
|
40
48
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
TopProgressBarProvider,
|
|
50
|
+
useProgressBar
|
|
43
51
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AbstractIntlMessages } from '../packages/i18n/src/react.ts';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type ChainAppProvidersProps = {
|
|
4
|
+
locale: string;
|
|
5
|
+
messages: AbstractIntlMessages;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** 是否挂载登录弹层(Chaindigg 等站点可关闭) */
|
|
8
|
+
login?: boolean;
|
|
9
|
+
themeStorageKey?: string;
|
|
10
|
+
themeCookieDomain?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* 官方 Provider 顺序:Intl → Theme → Login(可选)→ children
|
|
14
|
+
* 与 explorer-web / ai-web / learn-web 现有结构一致,可渐进替换手写拼装。
|
|
15
|
+
*/
|
|
16
|
+
export declare function ChainAppProviders({ locale, messages, children, login, themeStorageKey, themeCookieDomain, }: ChainAppProvidersProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=app-shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../src/app-shell.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,iCAAiC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAY,EACZ,eAAe,EACf,iBAAiB,GAClB,EAAE,sBAAsB,2CAiBxB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { NextIntlClientProvider } from "@0xchain/i18n/react";
|
|
4
|
+
import { LoginProvider } from "@0xchain/with-login";
|
|
5
|
+
import ThemeProviderWrapper from "./theme.js";
|
|
6
|
+
function ChainAppProviders({
|
|
7
|
+
locale,
|
|
8
|
+
messages,
|
|
9
|
+
children,
|
|
10
|
+
login = true,
|
|
11
|
+
themeStorageKey,
|
|
12
|
+
themeCookieDomain
|
|
13
|
+
}) {
|
|
14
|
+
const content = login ? /* @__PURE__ */ jsx(LoginProvider, { locale, children }) : children;
|
|
15
|
+
return /* @__PURE__ */ jsx(NextIntlClientProvider, { locale, messages, children: /* @__PURE__ */ jsx(
|
|
16
|
+
ThemeProviderWrapper,
|
|
17
|
+
{
|
|
18
|
+
storageKey: themeStorageKey,
|
|
19
|
+
cookieOptions: themeCookieDomain ? { domain: themeCookieDomain } : void 0,
|
|
20
|
+
children: content
|
|
21
|
+
}
|
|
22
|
+
) });
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
ChainAppProviders
|
|
26
|
+
};
|
package/dist/theme.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx
|
|
3
|
-
import { ThemeProvider
|
|
4
|
-
function
|
|
5
|
-
children
|
|
6
|
-
cookieOptions
|
|
7
|
-
storageKey
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ThemeProvider } from "@0xchain/next-themes";
|
|
4
|
+
function ThemeProviderWrapper({
|
|
5
|
+
children,
|
|
6
|
+
cookieOptions = { domain: ".ichatgo.ai" },
|
|
7
|
+
storageKey = "ichatgo-theme"
|
|
8
8
|
}) {
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
ThemeProvider,
|
|
11
11
|
{
|
|
12
12
|
attribute: "class",
|
|
13
|
-
enableSystem:
|
|
14
|
-
disableTransitionOnChange:
|
|
15
|
-
storageKey
|
|
13
|
+
enableSystem: true,
|
|
14
|
+
disableTransitionOnChange: true,
|
|
15
|
+
storageKey,
|
|
16
16
|
themes: ["light", "dark"],
|
|
17
|
-
cookieOptions
|
|
18
|
-
children
|
|
17
|
+
cookieOptions,
|
|
18
|
+
children
|
|
19
19
|
}
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
ThemeProviderWrapper as default
|
|
24
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xchain/providers",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.113",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -21,22 +21,43 @@
|
|
|
21
21
|
"types": "./dist/theme.d.ts",
|
|
22
22
|
"import": "./dist/theme.js",
|
|
23
23
|
"default": "./dist/theme.js"
|
|
24
|
+
},
|
|
25
|
+
"./app-shell": {
|
|
26
|
+
"types": "./dist/app-shell.d.ts",
|
|
27
|
+
"import": "./dist/app-shell.js",
|
|
28
|
+
"default": "./dist/app-shell.js"
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"files": [
|
|
27
32
|
"dist",
|
|
28
33
|
"!**/*.tsbuildinfo"
|
|
29
34
|
],
|
|
30
|
-
"
|
|
31
|
-
"
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@0xchain/i18n": "1.1.0-beta.113",
|
|
37
|
+
"@0xchain/with-login": "1.1.0-beta.113",
|
|
38
|
+
"next": "16.1.6",
|
|
39
|
+
"next-intl": "4.13.0",
|
|
40
|
+
"react": "19.1.1",
|
|
41
|
+
"tailwind-merge": "3.3.1"
|
|
32
42
|
},
|
|
33
|
-
"
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@0xchain/i18n": "1.1.0-beta.113",
|
|
45
|
+
"@0xchain/with-login": "1.1.0-beta.113",
|
|
34
46
|
"next": "16.1.6",
|
|
35
|
-
"@0xchain/next-themes": "1.0.0",
|
|
36
47
|
"react": "19.1.1",
|
|
48
|
+
"rollup-plugin-preserve-use-client": "3.0.1",
|
|
37
49
|
"tailwind-merge": "3.3.1"
|
|
38
50
|
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@0xchain/i18n": "1.1.0-beta.113",
|
|
53
|
+
"@0xchain/next-themes": "1.0.0"
|
|
54
|
+
},
|
|
55
|
+
"nx": {
|
|
56
|
+
"tags": [
|
|
57
|
+
"type:ui"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
39
60
|
"publishConfig": {
|
|
40
61
|
"access": "public"
|
|
41
62
|
}
|
|
42
|
-
}
|
|
63
|
+
}
|