@akanjs/ui 0.9.57 → 0.9.58-canary.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/System/Client.d.ts +2 -8
- package/System/Common.d.ts +1 -26
- package/cjs/System/CSR.js +8 -29
- package/cjs/System/Client.js +3 -10
- package/cjs/System/Common.js +0 -37
- package/cjs/System/SSR.js +24 -43
- package/esm/System/CSR.js +8 -29
- package/esm/System/Client.js +3 -10
- package/esm/System/Common.js +0 -37
- package/esm/System/SSR.js +24 -43
- package/package.json +1 -1
package/System/Client.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { HTMLAttributes, RefObject } from "react";
|
|
|
5
5
|
export declare const Client: {
|
|
6
6
|
(): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
Wrapper: ({ children, theme, lang, dictionary, signals, reconnect, }: ClientWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
Bridge: ({ env, lang,
|
|
8
|
+
Bridge: ({ env, lang, theme, prefix, gaTrackingId }: ClientBridgeProps) => "" | import("react/jsx-runtime").JSX.Element | undefined;
|
|
9
9
|
Inner: () => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
NextBridge: ({ lang, prefix }: ClientNextBridgeProps) => null;
|
|
11
11
|
};
|
|
@@ -36,17 +36,11 @@ export declare const ClientPathWrapper: ({ className, bind, wrapperRef, pageType
|
|
|
36
36
|
interface ClientBridgeProps {
|
|
37
37
|
env: BaseClientEnv;
|
|
38
38
|
lang?: string;
|
|
39
|
-
mePromise?: Promise<{
|
|
40
|
-
id: string;
|
|
41
|
-
} | null>;
|
|
42
|
-
selfPromise?: Promise<{
|
|
43
|
-
id: string;
|
|
44
|
-
} | null>;
|
|
45
39
|
theme?: string;
|
|
46
40
|
prefix?: string;
|
|
47
41
|
gaTrackingId?: string;
|
|
48
42
|
}
|
|
49
|
-
export declare const ClientBridge: ({ env, lang,
|
|
43
|
+
export declare const ClientBridge: ({ env, lang, theme, prefix, gaTrackingId }: ClientBridgeProps) => "" | import("react/jsx-runtime").JSX.Element | undefined;
|
|
50
44
|
export declare const ClientInner: () => import("react/jsx-runtime").JSX.Element;
|
|
51
45
|
interface ClientNextBridgeProps {
|
|
52
46
|
lang: string;
|
package/System/Common.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "dayjs/locale/ko";
|
|
2
2
|
import { type BaseClientEnv } from "@akanjs/base";
|
|
3
3
|
import { type RootLayoutProps } from "@akanjs/client";
|
|
4
|
-
import { FetchPolicy } from "@akanjs/common";
|
|
5
4
|
import { ReactNode } from "react";
|
|
6
5
|
export interface ProviderProps {
|
|
7
6
|
className?: string;
|
|
@@ -17,28 +16,4 @@ export interface ProviderProps {
|
|
|
17
16
|
reconnect?: boolean;
|
|
18
17
|
of: (props: any) => ReactNode | null;
|
|
19
18
|
}
|
|
20
|
-
export declare const Common:
|
|
21
|
-
(): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
Wrapper: ({ fetch, render, }: WrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
};
|
|
24
|
-
export type InitAuthFetchType = typeof window.fetch & {
|
|
25
|
-
ping: (option?: FetchPolicy) => Promise<any>;
|
|
26
|
-
me?: (props: {
|
|
27
|
-
crystalize: boolean;
|
|
28
|
-
}, option?: FetchPolicy) => Promise<{
|
|
29
|
-
id: string;
|
|
30
|
-
}>;
|
|
31
|
-
getSelf?: (props: {
|
|
32
|
-
crystalize: boolean;
|
|
33
|
-
}, option?: FetchPolicy) => Promise<{
|
|
34
|
-
id: string;
|
|
35
|
-
}>;
|
|
36
|
-
};
|
|
37
|
-
interface WrapperProps {
|
|
38
|
-
fetch: InitAuthFetchType;
|
|
39
|
-
render: (props: {
|
|
40
|
-
mePromise: Promise<any>;
|
|
41
|
-
selfPromise: Promise<any>;
|
|
42
|
-
}) => ReactNode;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
|
19
|
+
export declare const Common: () => import("react/jsx-runtime").JSX.Element;
|
package/cjs/System/CSR.js
CHANGED
|
@@ -23,7 +23,6 @@ __export(CSR_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(CSR_exports);
|
|
25
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
var import_base = require("@akanjs/base");
|
|
27
26
|
var import_client = require("@akanjs/client");
|
|
28
27
|
var import_next = require("@akanjs/next");
|
|
29
28
|
var import_store = require("@akanjs/store");
|
|
@@ -33,7 +32,6 @@ var import_react_dom = require("react-dom");
|
|
|
33
32
|
var import_FontFace = require("../FontFace");
|
|
34
33
|
var import_Load = require("../Load");
|
|
35
34
|
var import_Client = require("./Client");
|
|
36
|
-
var import_Common = require("./Common");
|
|
37
35
|
const CSR = ({ children }) => {
|
|
38
36
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {});
|
|
39
37
|
};
|
|
@@ -58,10 +56,9 @@ const CSRProvider = ({
|
|
|
58
56
|
of,
|
|
59
57
|
loader: async () => {
|
|
60
58
|
const { lang } = await params;
|
|
61
|
-
|
|
62
|
-
return { lang, fetch };
|
|
59
|
+
return { lang };
|
|
63
60
|
},
|
|
64
|
-
render: ({ lang
|
|
61
|
+
render: ({ lang }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
65
62
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.Client.Wrapper, { theme, lang, reconnect, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
63
|
CSRWrapper,
|
|
67
64
|
{
|
|
@@ -75,29 +72,10 @@ const CSRProvider = ({
|
|
|
75
72
|
children
|
|
76
73
|
}
|
|
77
74
|
) }),
|
|
78
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
render: ({ mePromise, selfPromise }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
83
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.Client.Inner, {}),
|
|
84
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CSRInner, {}),
|
|
85
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
-
import_Client.Client.Bridge,
|
|
87
|
-
{
|
|
88
|
-
lang,
|
|
89
|
-
env,
|
|
90
|
-
mePromise,
|
|
91
|
-
selfPromise,
|
|
92
|
-
theme,
|
|
93
|
-
prefix,
|
|
94
|
-
gaTrackingId
|
|
95
|
-
}
|
|
96
|
-
),
|
|
97
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CSRBridge, { lang, prefix })
|
|
98
|
-
] })
|
|
99
|
-
}
|
|
100
|
-
)
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.Client.Inner, {}),
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CSRInner, {}),
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.Client.Bridge, { lang, env, theme, prefix, gaTrackingId }),
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CSRBridge, { lang, prefix })
|
|
101
79
|
] })
|
|
102
80
|
}
|
|
103
81
|
);
|
|
@@ -188,7 +166,8 @@ const CSRWrapper = ({
|
|
|
188
166
|
)
|
|
189
167
|
]
|
|
190
168
|
}
|
|
191
|
-
)
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: "csr-provider-children", className: "hidden", children })
|
|
192
171
|
] });
|
|
193
172
|
};
|
|
194
173
|
CSR.Wrapper = CSRWrapper;
|
package/cjs/System/Client.js
CHANGED
|
@@ -32,7 +32,6 @@ var import_client = require("@akanjs/client");
|
|
|
32
32
|
var import_common = require("@akanjs/common");
|
|
33
33
|
var import_constant = require("@akanjs/constant");
|
|
34
34
|
var import_dictionary = require("@akanjs/dictionary");
|
|
35
|
-
var import_next = require("@akanjs/next");
|
|
36
35
|
var import_signal = require("@akanjs/signal");
|
|
37
36
|
var import_store = require("@akanjs/store");
|
|
38
37
|
var import_ui = require("@akanjs/ui");
|
|
@@ -124,13 +123,11 @@ const ClientPathWrapper = ({
|
|
|
124
123
|
}
|
|
125
124
|
);
|
|
126
125
|
};
|
|
127
|
-
const ClientBridge = ({ env, lang,
|
|
126
|
+
const ClientBridge = ({ env, lang, theme, prefix, gaTrackingId }) => {
|
|
128
127
|
const uiOperation = import_store.st.use.uiOperation();
|
|
129
128
|
const pathname = import_store.st.use.pathname();
|
|
130
129
|
const params = import_store.st.use.params();
|
|
131
130
|
const searchParams = import_store.st.use.searchParams();
|
|
132
|
-
const { fulfilled: meFullfilled, value: me } = (0, import_next.useFetch)(mePromise);
|
|
133
|
-
const { fulfilled: selfFullfilled, value: self } = (0, import_next.useFetch)(selfPromise);
|
|
134
131
|
const language = params.lang ?? lang;
|
|
135
132
|
const path = "/" + pathname.split("/").slice(2).join("/");
|
|
136
133
|
const { setTheme, themes, theme: nextTheme } = (0, import_next_themes.useTheme)();
|
|
@@ -138,8 +135,6 @@ const ClientBridge = ({ env, lang, mePromise, selfPromise, theme, prefix, gaTrac
|
|
|
138
135
|
(0, import_react.useEffect)(() => {
|
|
139
136
|
if (uiOperation !== "sleep")
|
|
140
137
|
return;
|
|
141
|
-
if (!meFullfilled || !selfFullfilled)
|
|
142
|
-
return;
|
|
143
138
|
const initTheme = async () => {
|
|
144
139
|
if (theme) {
|
|
145
140
|
setTheme(theme);
|
|
@@ -159,14 +154,12 @@ const ClientBridge = ({ env, lang, mePromise, selfPromise, theme, prefix, gaTrac
|
|
|
159
154
|
const userCnst = import_constant.constantInfo.getDatabase("user", { allowEmpty: true });
|
|
160
155
|
import_store.st.set({
|
|
161
156
|
prefix,
|
|
162
|
-
uiOperation: "loading"
|
|
163
|
-
...me && adminCnst ? { me: adminCnst.crystalize(me) } : {},
|
|
164
|
-
...self && userCnst ? { self: userCnst.crystalize(self) } : {}
|
|
157
|
+
uiOperation: "loading"
|
|
165
158
|
});
|
|
166
159
|
setTimeout(() => {
|
|
167
160
|
import_store.st.set({ uiOperation: "idle" });
|
|
168
161
|
}, 2e3);
|
|
169
|
-
}, [
|
|
162
|
+
}, []);
|
|
170
163
|
(0, import_react.useEffect)(() => {
|
|
171
164
|
if (theme && storeTheme !== nextTheme)
|
|
172
165
|
setTheme(storeTheme);
|
package/cjs/System/Common.js
CHANGED
|
@@ -22,43 +22,6 @@ __export(Common_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(Common_exports);
|
|
23
23
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
24
|
var import_ko = require("dayjs/locale/ko");
|
|
25
|
-
var import_base = require("@akanjs/base");
|
|
26
|
-
var import_client = require("@akanjs/client");
|
|
27
|
-
var import_Load = require("../Load");
|
|
28
25
|
const Common = () => {
|
|
29
26
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
30
27
|
};
|
|
31
|
-
const CommonWrapper = ({
|
|
32
|
-
fetch = import_base.baseClientEnv.side === "server" && import_base.baseClientEnv.operationMode === "local" ? global.builtFetch : global.fetch,
|
|
33
|
-
render
|
|
34
|
-
}) => {
|
|
35
|
-
const account = (0, import_client.getAccount)();
|
|
36
|
-
const fetchPing = (option) => fetch.ping(option);
|
|
37
|
-
const fetchMe = (props, option) => fetch.me?.(props, option);
|
|
38
|
-
const fetchSelf = (props, option) => fetch.getSelf?.(props, option);
|
|
39
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
|
-
import_Load.Load.Page,
|
|
41
|
-
{
|
|
42
|
-
of: CommonWrapper,
|
|
43
|
-
loader: async () => {
|
|
44
|
-
const mePromise = (async () => {
|
|
45
|
-
try {
|
|
46
|
-
return account.me ? await fetchMe({ crystalize: false }) : null;
|
|
47
|
-
} catch (e) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
})();
|
|
51
|
-
const selfPromise = (async () => {
|
|
52
|
-
try {
|
|
53
|
-
return account.self ? await fetchSelf({ crystalize: false }) : null;
|
|
54
|
-
} catch (e) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
})();
|
|
58
|
-
return Promise.resolve({ mePromise, selfPromise });
|
|
59
|
-
},
|
|
60
|
-
render
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
Common.Wrapper = CommonWrapper;
|
package/cjs/System/SSR.js
CHANGED
|
@@ -22,12 +22,10 @@ __export(SSR_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(SSR_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_base = require("@akanjs/base");
|
|
26
25
|
var import_client = require("@akanjs/client");
|
|
27
26
|
var import_react = require("react");
|
|
28
27
|
var import_Load = require("../Load");
|
|
29
28
|
var import_Client = require("./Client");
|
|
30
|
-
var import_Common = require("./Common");
|
|
31
29
|
const SSR = () => {
|
|
32
30
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
33
31
|
};
|
|
@@ -54,51 +52,34 @@ const SSRProvider = ({
|
|
|
54
52
|
const { lang } = await params;
|
|
55
53
|
if (!import_client.router.isInitialized)
|
|
56
54
|
import_client.router.init({ type: "next", side: "server", lang, prefix });
|
|
57
|
-
|
|
58
|
-
return { lang, fetch };
|
|
55
|
+
return { lang };
|
|
59
56
|
},
|
|
60
|
-
render: ({ lang
|
|
61
|
-
|
|
57
|
+
render: ({ lang }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
+
SSRWrapper,
|
|
62
59
|
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
className,
|
|
61
|
+
appName,
|
|
62
|
+
lang,
|
|
63
|
+
head,
|
|
64
|
+
fonts,
|
|
65
|
+
prefix,
|
|
66
|
+
layoutStyle,
|
|
67
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
68
|
+
import_Client.ClientWrapper,
|
|
66
69
|
{
|
|
67
|
-
|
|
68
|
-
appName,
|
|
70
|
+
theme,
|
|
69
71
|
lang,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
import_Client.
|
|
76
|
-
{
|
|
77
|
-
theme,
|
|
78
|
-
lang,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
reconnect,
|
|
82
|
-
children: [
|
|
83
|
-
children,
|
|
84
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.ClientInner, {}) }),
|
|
85
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Suspense, { fallback: null, children: [
|
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
-
import_Client.ClientBridge,
|
|
88
|
-
{
|
|
89
|
-
env,
|
|
90
|
-
mePromise,
|
|
91
|
-
selfPromise,
|
|
92
|
-
theme,
|
|
93
|
-
prefix,
|
|
94
|
-
gaTrackingId
|
|
95
|
-
}
|
|
96
|
-
),
|
|
97
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.ClientNextBridge, { lang, prefix })
|
|
98
|
-
] })
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
)
|
|
72
|
+
dictionary: global.dictionary[lang],
|
|
73
|
+
signals: global.signals,
|
|
74
|
+
reconnect,
|
|
75
|
+
children: [
|
|
76
|
+
children,
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.ClientInner, {}) }),
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Suspense, { fallback: null, children: [
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.ClientBridge, { env, theme, prefix, gaTrackingId }),
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Client.ClientNextBridge, { lang, prefix })
|
|
81
|
+
] })
|
|
82
|
+
]
|
|
102
83
|
}
|
|
103
84
|
)
|
|
104
85
|
}
|
package/esm/System/CSR.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { baseClientEnv } from "@akanjs/base";
|
|
4
3
|
import { clsx, device, getPathInfo, router, useCsr } from "@akanjs/client";
|
|
5
4
|
import { usePushNoti } from "@akanjs/next";
|
|
6
5
|
import { st } from "@akanjs/store";
|
|
@@ -10,7 +9,6 @@ import { createPortal } from "react-dom";
|
|
|
10
9
|
import { FontFace } from "../FontFace";
|
|
11
10
|
import { Load } from "../Load";
|
|
12
11
|
import { Client, ClientPathWrapper } from "./Client";
|
|
13
|
-
import { Common } from "./Common";
|
|
14
12
|
const CSR = ({ children }) => {
|
|
15
13
|
return /* @__PURE__ */ jsx("div", {});
|
|
16
14
|
};
|
|
@@ -35,10 +33,9 @@ const CSRProvider = ({
|
|
|
35
33
|
of,
|
|
36
34
|
loader: async () => {
|
|
37
35
|
const { lang } = await params;
|
|
38
|
-
|
|
39
|
-
return { lang, fetch };
|
|
36
|
+
return { lang };
|
|
40
37
|
},
|
|
41
|
-
render: ({ lang
|
|
38
|
+
render: ({ lang }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
42
39
|
/* @__PURE__ */ jsx(Client.Wrapper, { theme, lang, reconnect, children: /* @__PURE__ */ jsx(
|
|
43
40
|
CSRWrapper,
|
|
44
41
|
{
|
|
@@ -52,29 +49,10 @@ const CSRProvider = ({
|
|
|
52
49
|
children
|
|
53
50
|
}
|
|
54
51
|
) }),
|
|
55
|
-
/* @__PURE__ */ jsx(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
render: ({ mePromise, selfPromise }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
-
/* @__PURE__ */ jsx(Client.Inner, {}),
|
|
61
|
-
/* @__PURE__ */ jsx(CSRInner, {}),
|
|
62
|
-
/* @__PURE__ */ jsx(
|
|
63
|
-
Client.Bridge,
|
|
64
|
-
{
|
|
65
|
-
lang,
|
|
66
|
-
env,
|
|
67
|
-
mePromise,
|
|
68
|
-
selfPromise,
|
|
69
|
-
theme,
|
|
70
|
-
prefix,
|
|
71
|
-
gaTrackingId
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
/* @__PURE__ */ jsx(CSRBridge, { lang, prefix })
|
|
75
|
-
] })
|
|
76
|
-
}
|
|
77
|
-
)
|
|
52
|
+
/* @__PURE__ */ jsx(Client.Inner, {}),
|
|
53
|
+
/* @__PURE__ */ jsx(CSRInner, {}),
|
|
54
|
+
/* @__PURE__ */ jsx(Client.Bridge, { lang, env, theme, prefix, gaTrackingId }),
|
|
55
|
+
/* @__PURE__ */ jsx(CSRBridge, { lang, prefix })
|
|
78
56
|
] })
|
|
79
57
|
}
|
|
80
58
|
);
|
|
@@ -165,7 +143,8 @@ const CSRWrapper = ({
|
|
|
165
143
|
)
|
|
166
144
|
]
|
|
167
145
|
}
|
|
168
|
-
)
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ jsx("div", { id: "csr-provider-children", className: "hidden", children })
|
|
169
148
|
] });
|
|
170
149
|
};
|
|
171
150
|
CSR.Wrapper = CSRWrapper;
|
package/esm/System/Client.js
CHANGED
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
import { Logger } from "@akanjs/common";
|
|
16
16
|
import { constantInfo } from "@akanjs/constant";
|
|
17
17
|
import { serverTranslator } from "@akanjs/dictionary";
|
|
18
|
-
import { useFetch } from "@akanjs/next";
|
|
19
18
|
import { signalInfo } from "@akanjs/signal";
|
|
20
19
|
import { baseSt, st, storeInfo } from "@akanjs/store";
|
|
21
20
|
import { animated } from "@akanjs/ui";
|
|
@@ -107,13 +106,11 @@ const ClientPathWrapper = ({
|
|
|
107
106
|
}
|
|
108
107
|
);
|
|
109
108
|
};
|
|
110
|
-
const ClientBridge = ({ env, lang,
|
|
109
|
+
const ClientBridge = ({ env, lang, theme, prefix, gaTrackingId }) => {
|
|
111
110
|
const uiOperation = st.use.uiOperation();
|
|
112
111
|
const pathname = st.use.pathname();
|
|
113
112
|
const params = st.use.params();
|
|
114
113
|
const searchParams = st.use.searchParams();
|
|
115
|
-
const { fulfilled: meFullfilled, value: me } = useFetch(mePromise);
|
|
116
|
-
const { fulfilled: selfFullfilled, value: self } = useFetch(selfPromise);
|
|
117
114
|
const language = params.lang ?? lang;
|
|
118
115
|
const path = "/" + pathname.split("/").slice(2).join("/");
|
|
119
116
|
const { setTheme, themes, theme: nextTheme } = useTheme();
|
|
@@ -121,8 +118,6 @@ const ClientBridge = ({ env, lang, mePromise, selfPromise, theme, prefix, gaTrac
|
|
|
121
118
|
useEffect(() => {
|
|
122
119
|
if (uiOperation !== "sleep")
|
|
123
120
|
return;
|
|
124
|
-
if (!meFullfilled || !selfFullfilled)
|
|
125
|
-
return;
|
|
126
121
|
const initTheme = async () => {
|
|
127
122
|
if (theme) {
|
|
128
123
|
setTheme(theme);
|
|
@@ -142,14 +137,12 @@ const ClientBridge = ({ env, lang, mePromise, selfPromise, theme, prefix, gaTrac
|
|
|
142
137
|
const userCnst = constantInfo.getDatabase("user", { allowEmpty: true });
|
|
143
138
|
st.set({
|
|
144
139
|
prefix,
|
|
145
|
-
uiOperation: "loading"
|
|
146
|
-
...me && adminCnst ? { me: adminCnst.crystalize(me) } : {},
|
|
147
|
-
...self && userCnst ? { self: userCnst.crystalize(self) } : {}
|
|
140
|
+
uiOperation: "loading"
|
|
148
141
|
});
|
|
149
142
|
setTimeout(() => {
|
|
150
143
|
st.set({ uiOperation: "idle" });
|
|
151
144
|
}, 2e3);
|
|
152
|
-
}, [
|
|
145
|
+
}, []);
|
|
153
146
|
useEffect(() => {
|
|
154
147
|
if (theme && storeTheme !== nextTheme)
|
|
155
148
|
setTheme(storeTheme);
|
package/esm/System/Common.js
CHANGED
|
@@ -1,45 +1,8 @@
|
|
|
1
1
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import "dayjs/locale/ko";
|
|
3
|
-
import { baseClientEnv } from "@akanjs/base";
|
|
4
|
-
import { getAccount } from "@akanjs/client";
|
|
5
|
-
import { Load } from "../Load";
|
|
6
3
|
const Common = () => {
|
|
7
4
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
8
5
|
};
|
|
9
|
-
const CommonWrapper = ({
|
|
10
|
-
fetch = baseClientEnv.side === "server" && baseClientEnv.operationMode === "local" ? global.builtFetch : global.fetch,
|
|
11
|
-
render
|
|
12
|
-
}) => {
|
|
13
|
-
const account = getAccount();
|
|
14
|
-
const fetchPing = (option) => fetch.ping(option);
|
|
15
|
-
const fetchMe = (props, option) => fetch.me?.(props, option);
|
|
16
|
-
const fetchSelf = (props, option) => fetch.getSelf?.(props, option);
|
|
17
|
-
return /* @__PURE__ */ jsx(
|
|
18
|
-
Load.Page,
|
|
19
|
-
{
|
|
20
|
-
of: CommonWrapper,
|
|
21
|
-
loader: async () => {
|
|
22
|
-
const mePromise = (async () => {
|
|
23
|
-
try {
|
|
24
|
-
return account.me ? await fetchMe({ crystalize: false }) : null;
|
|
25
|
-
} catch (e) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
})();
|
|
29
|
-
const selfPromise = (async () => {
|
|
30
|
-
try {
|
|
31
|
-
return account.self ? await fetchSelf({ crystalize: false }) : null;
|
|
32
|
-
} catch (e) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
})();
|
|
36
|
-
return Promise.resolve({ mePromise, selfPromise });
|
|
37
|
-
},
|
|
38
|
-
render
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
Common.Wrapper = CommonWrapper;
|
|
43
6
|
export {
|
|
44
7
|
Common
|
|
45
8
|
};
|
package/esm/System/SSR.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { baseClientEnv } from "@akanjs/base";
|
|
3
2
|
import { clsx, router } from "@akanjs/client";
|
|
4
3
|
import { Suspense } from "react";
|
|
5
4
|
import { Load } from "../Load";
|
|
6
5
|
import { ClientBridge, ClientInner, ClientNextBridge, ClientPathWrapper, ClientWrapper } from "./Client";
|
|
7
|
-
import { Common } from "./Common";
|
|
8
6
|
const SSR = () => {
|
|
9
7
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
10
8
|
};
|
|
@@ -31,51 +29,34 @@ const SSRProvider = ({
|
|
|
31
29
|
const { lang } = await params;
|
|
32
30
|
if (!router.isInitialized)
|
|
33
31
|
router.init({ type: "next", side: "server", lang, prefix });
|
|
34
|
-
|
|
35
|
-
return { lang, fetch };
|
|
32
|
+
return { lang };
|
|
36
33
|
},
|
|
37
|
-
render: ({ lang
|
|
38
|
-
|
|
34
|
+
render: ({ lang }) => /* @__PURE__ */ jsx(
|
|
35
|
+
SSRWrapper,
|
|
39
36
|
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
className,
|
|
38
|
+
appName,
|
|
39
|
+
lang,
|
|
40
|
+
head,
|
|
41
|
+
fonts,
|
|
42
|
+
prefix,
|
|
43
|
+
layoutStyle,
|
|
44
|
+
children: /* @__PURE__ */ jsxs(
|
|
45
|
+
ClientWrapper,
|
|
43
46
|
{
|
|
44
|
-
|
|
45
|
-
appName,
|
|
47
|
+
theme,
|
|
46
48
|
lang,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
theme,
|
|
55
|
-
lang,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
reconnect,
|
|
59
|
-
children: [
|
|
60
|
-
children,
|
|
61
|
-
/* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ClientInner, {}) }),
|
|
62
|
-
/* @__PURE__ */ jsxs(Suspense, { fallback: null, children: [
|
|
63
|
-
/* @__PURE__ */ jsx(
|
|
64
|
-
ClientBridge,
|
|
65
|
-
{
|
|
66
|
-
env,
|
|
67
|
-
mePromise,
|
|
68
|
-
selfPromise,
|
|
69
|
-
theme,
|
|
70
|
-
prefix,
|
|
71
|
-
gaTrackingId
|
|
72
|
-
}
|
|
73
|
-
),
|
|
74
|
-
/* @__PURE__ */ jsx(ClientNextBridge, { lang, prefix })
|
|
75
|
-
] })
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
)
|
|
49
|
+
dictionary: global.dictionary[lang],
|
|
50
|
+
signals: global.signals,
|
|
51
|
+
reconnect,
|
|
52
|
+
children: [
|
|
53
|
+
children,
|
|
54
|
+
/* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(ClientInner, {}) }),
|
|
55
|
+
/* @__PURE__ */ jsxs(Suspense, { fallback: null, children: [
|
|
56
|
+
/* @__PURE__ */ jsx(ClientBridge, { env, theme, prefix, gaTrackingId }),
|
|
57
|
+
/* @__PURE__ */ jsx(ClientNextBridge, { lang, prefix })
|
|
58
|
+
] })
|
|
59
|
+
]
|
|
79
60
|
}
|
|
80
61
|
)
|
|
81
62
|
}
|