@akanjs/ui 0.0.149 → 0.0.151
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/BottomSheet.d.ts +13 -0
- package/Button.d.ts +9 -0
- package/ClientSide.d.ts +6 -0
- package/Copy.d.ts +6 -0
- package/CsrImage.d.ts +11 -0
- package/Data/CardList.d.ts +36 -0
- package/Data/Dashboard.d.ts +15 -0
- package/Data/Insight.d.ts +8 -0
- package/Data/Item.d.ts +74 -0
- package/Data/ListContainer.d.ts +38 -0
- package/Data/Pagination.d.ts +6 -0
- package/Data/QueryMaker.d.ts +9 -0
- package/Data/TableList.d.ts +26 -0
- package/Data/index.d.ts +10 -0
- package/Data/index_.d.ts +8 -0
- package/DatePicker.d.ts +38 -0
- package/Dialog/Action.d.ts +5 -0
- package/Dialog/Close.d.ts +5 -0
- package/Dialog/Content.d.ts +6 -0
- package/Dialog/Modal.d.ts +8 -0
- package/Dialog/Provider.d.ts +7 -0
- package/Dialog/Title.d.ts +5 -0
- package/Dialog/Trigger.d.ts +5 -0
- package/Dialog/context.d.ts +10 -0
- package/Dialog/index.d.ts +9 -0
- package/DragAction.d.ts +24 -0
- package/DraggableList.d.ts +25 -0
- package/Dropdown.d.ts +10 -0
- package/Empty.d.ts +9 -0
- package/Field.d.ts +404 -0
- package/FontFace.d.ts +6 -0
- package/Image.d.ts +17 -0
- package/InfiniteScroll.d.ts +10 -0
- package/Input.d.ts +85 -0
- package/KeyboardAvoiding.d.ts +7 -0
- package/Layout/BottomAction.d.ts +5 -0
- package/Layout/BottomInset.d.ts +6 -0
- package/Layout/BottomTab.d.ts +14 -0
- package/Layout/Header.d.ts +7 -0
- package/Layout/LeftSider.d.ts +8 -0
- package/Layout/Navbar.d.ts +11 -0
- package/Layout/RightSider.d.ts +9 -0
- package/Layout/Sider.d.ts +6 -0
- package/Layout/Template.d.ts +5 -0
- package/Layout/TopLeftAction.d.ts +5 -0
- package/Layout/Unit.d.ts +6 -0
- package/Layout/View.d.ts +5 -0
- package/Layout/Zone.d.ts +5 -0
- package/Layout/index.d.ts +14 -0
- package/Link/Back.d.ts +6 -0
- package/Link/Close.d.ts +6 -0
- package/Link/CsrLink.d.ts +2 -0
- package/Link/NextLink.d.ts +2 -0
- package/Link/index.d.ts +8 -0
- package/Link/types.d.ts +22 -0
- package/Load/Edit.d.ts +4 -0
- package/Load/Edit_Client.d.ts +25 -0
- package/Load/Page.d.ts +10 -0
- package/Load/PageCSR.d.ts +11 -0
- package/Load/Pagination.d.ts +8 -0
- package/Load/Units.d.ts +34 -0
- package/Load/View.d.ts +17 -0
- package/Load/index.d.ts +8 -0
- package/Load/index_.d.ts +3 -0
- package/Loading/Area.d.ts +1 -0
- package/Loading/Button.d.ts +7 -0
- package/Loading/Input.d.ts +7 -0
- package/Loading/ProgressBar.d.ts +6 -0
- package/Loading/Skeleton.d.ts +7 -0
- package/Loading/Spin.d.ts +7 -0
- package/Loading/index.d.ts +8 -0
- package/Menu.d.ts +26 -0
- package/Modal.d.ts +23 -0
- package/Model/Edit.d.ts +15 -0
- package/Model/EditModal.d.ts +33 -0
- package/Model/EditWrapper.d.ts +11 -0
- package/Model/LoadInit.d.ts +10 -0
- package/Model/New.d.ts +15 -0
- package/Model/NewWrapper.d.ts +12 -0
- package/Model/NewWrapper_Client.d.ts +12 -0
- package/Model/Remove.d.ts +10 -0
- package/Model/RemoveWrapper.d.ts +11 -0
- package/Model/SureToRemove.d.ts +10 -0
- package/Model/View.d.ts +19 -0
- package/Model/ViewEditModal.d.ts +11 -0
- package/Model/ViewModal.d.ts +13 -0
- package/Model/ViewWrapper.d.ts +11 -0
- package/Model/index.d.ts +15 -0
- package/Model/index_.d.ts +13 -0
- package/More.d.ts +12 -0
- package/ObjectId.d.ts +5 -0
- package/Pagination.d.ts +14 -0
- package/Popconfirm.d.ts +18 -0
- package/Portal.d.ts +6 -0
- package/Radio.d.ts +19 -0
- package/RecentTime.d.ts +7 -0
- package/Refresh.d.ts +7 -0
- package/ScreenNavigator.d.ts +18 -0
- package/Select.d.ts +29 -0
- package/Signal/Arg.d.ts +75 -0
- package/Signal/Doc.d.ts +19 -0
- package/Signal/GraphQL.d.ts +32 -0
- package/Signal/Listener.d.ts +9 -0
- package/Signal/Message.d.ts +27 -0
- package/Signal/Object.d.ts +19 -0
- package/Signal/PubSub.d.ts +26 -0
- package/Signal/Request.d.ts +8 -0
- package/Signal/Response.d.ts +16 -0
- package/Signal/RestApi.d.ts +40 -0
- package/Signal/WebSocket.d.ts +9 -0
- package/Signal/index.d.ts +20 -0
- package/System/CSR.d.ts +31 -0
- package/System/Client.d.ts +48 -0
- package/System/Common.d.ts +66 -0
- package/System/DevModeToggle.d.ts +1 -0
- package/System/Gtag.d.ts +3 -0
- package/System/HealthCheck.d.ts +5 -0
- package/System/Messages.d.ts +1 -0
- package/System/Reconnect.d.ts +6 -0
- package/System/Root.d.ts +5 -0
- package/System/SSR.d.ts +26 -0
- package/System/SelectLanguage.d.ts +5 -0
- package/System/ThemeToggle.d.ts +1 -0
- package/System/index.d.ts +11 -0
- package/Tab/Menu.d.ts +11 -0
- package/Tab/Menus.d.ts +5 -0
- package/Tab/Panel.d.ts +7 -0
- package/Tab/Provider.d.ts +6 -0
- package/Tab/context.d.ts +9 -0
- package/Tab/index.d.ts +7 -0
- package/Table.d.ts +26 -0
- package/ToggleSelect.d.ts +31 -0
- package/Unauthorized.d.ts +9 -0
- package/cjs/BottomSheet.js +113 -0
- package/cjs/Button.js +69 -0
- package/cjs/ClientSide.js +26 -0
- package/cjs/Copy.js +37 -0
- package/cjs/CsrImage.js +50 -0
- package/cjs/Data/CardList.js +119 -0
- package/cjs/Data/Dashboard.js +54 -0
- package/cjs/Data/Insight.js +38 -0
- package/cjs/Data/Item.js +204 -0
- package/cjs/Data/ListContainer.js +251 -0
- package/cjs/Data/Pagination.js +64 -0
- package/cjs/Data/QueryMaker.js +304 -0
- package/cjs/Data/TableList.js +139 -0
- package/cjs/Data/index.js +33 -0
- package/cjs/Data/index_.js +49 -0
- package/cjs/DatePicker.js +173 -0
- package/cjs/Dialog/Action.js +32 -0
- package/cjs/Dialog/Close.js +38 -0
- package/cjs/Dialog/Content.js +27 -0
- package/cjs/Dialog/Modal.js +155 -0
- package/cjs/Dialog/Provider.js +46 -0
- package/cjs/Dialog/Title.js +32 -0
- package/cjs/Dialog/Trigger.js +38 -0
- package/cjs/Dialog/context.js +32 -0
- package/cjs/Dialog/index.js +36 -0
- package/cjs/DragAction.js +111 -0
- package/cjs/DraggableList.js +141 -0
- package/cjs/Dropdown.js +64 -0
- package/cjs/Empty.js +50 -0
- package/cjs/Field.js +1109 -0
- package/cjs/FontFace.js +77 -0
- package/cjs/Image.js +61 -0
- package/cjs/InfiniteScroll.js +65 -0
- package/cjs/Input.js +440 -0
- package/cjs/KeyboardAvoiding.js +65 -0
- package/cjs/Layout/BottomAction.js +26 -0
- package/cjs/Layout/BottomInset.js +53 -0
- package/cjs/Layout/BottomTab.js +56 -0
- package/cjs/Layout/Header.js +52 -0
- package/cjs/Layout/LeftSider.js +49 -0
- package/cjs/Layout/Navbar.js +51 -0
- package/cjs/Layout/RightSider.js +52 -0
- package/cjs/Layout/Sider.js +39 -0
- package/cjs/Layout/Template.js +26 -0
- package/cjs/Layout/TopLeftAction.js +39 -0
- package/cjs/Layout/Unit.js +27 -0
- package/cjs/Layout/View.js +26 -0
- package/cjs/Layout/Zone.js +26 -0
- package/cjs/Layout/index.js +48 -0
- package/cjs/Link/Back.js +27 -0
- package/cjs/Link/Close.js +36 -0
- package/cjs/Link/CsrLink.js +49 -0
- package/cjs/Link/NextLink.js +71 -0
- package/cjs/Link/index.js +47 -0
- package/cjs/Link/types.js +15 -0
- package/cjs/Load/Edit.js +42 -0
- package/cjs/Load/Edit_Client.js +93 -0
- package/cjs/Load/Page.js +35 -0
- package/cjs/Load/PageCSR.js +67 -0
- package/cjs/Load/Pagination.js +89 -0
- package/cjs/Load/Units.js +232 -0
- package/cjs/Load/View.js +88 -0
- package/cjs/Load/index.js +42 -0
- package/cjs/Load/index_.js +39 -0
- package/cjs/Loading/Area.js +25 -0
- package/cjs/Loading/Button.js +33 -0
- package/cjs/Loading/Input.js +33 -0
- package/cjs/Loading/ProgressBar.js +29 -0
- package/cjs/Loading/Skeleton.js +27 -0
- package/cjs/Loading/Spin.js +27 -0
- package/cjs/Loading/index.js +29 -0
- package/cjs/Menu.js +215 -0
- package/cjs/Modal.js +75 -0
- package/cjs/Model/Edit.js +61 -0
- package/cjs/Model/EditModal.js +255 -0
- package/cjs/Model/EditWrapper.js +48 -0
- package/cjs/Model/LoadInit.js +27 -0
- package/cjs/Model/New.js +61 -0
- package/cjs/Model/NewWrapper.js +28 -0
- package/cjs/Model/NewWrapper_Client.js +66 -0
- package/cjs/Model/Remove.js +86 -0
- package/cjs/Model/RemoveWrapper.js +48 -0
- package/cjs/Model/SureToRemove.js +109 -0
- package/cjs/Model/View.js +44 -0
- package/cjs/Model/ViewEditModal.js +118 -0
- package/cjs/Model/ViewModal.js +92 -0
- package/cjs/Model/ViewWrapper.js +48 -0
- package/cjs/Model/index.js +38 -0
- package/cjs/Model/index_.js +58 -0
- package/cjs/More.js +67 -0
- package/cjs/ObjectId.js +37 -0
- package/cjs/Pagination.js +110 -0
- package/cjs/Popconfirm.js +116 -0
- package/cjs/Portal.js +27 -0
- package/cjs/Radio.js +53 -0
- package/cjs/RecentTime.js +86 -0
- package/cjs/Refresh.js +45 -0
- package/cjs/ScreenNavigator.js +121 -0
- package/cjs/Select.js +262 -0
- package/cjs/Signal/Arg.js +237 -0
- package/cjs/Signal/Doc.js +181 -0
- package/cjs/Signal/GraphQL.js +177 -0
- package/cjs/Signal/Listener.js +59 -0
- package/cjs/Signal/Message.js +190 -0
- package/cjs/Signal/Object.js +95 -0
- package/cjs/Signal/PubSub.js +191 -0
- package/cjs/Signal/Request.js +38 -0
- package/cjs/Signal/Response.js +53 -0
- package/cjs/Signal/RestApi.js +255 -0
- package/cjs/Signal/WebSocket.js +68 -0
- package/cjs/Signal/index.js +42 -0
- package/cjs/System/CSR.js +376 -0
- package/cjs/System/Client.js +200 -0
- package/cjs/System/Common.js +64 -0
- package/cjs/System/DevModeToggle.js +38 -0
- package/cjs/System/Gtag.js +67 -0
- package/cjs/System/HealthCheck.js +60 -0
- package/cjs/System/Messages.js +170 -0
- package/cjs/System/Reconnect.js +64 -0
- package/cjs/System/Root.js +30 -0
- package/cjs/System/SSR.js +144 -0
- package/cjs/System/SelectLanguage.js +58 -0
- package/cjs/System/ThemeToggle.js +40 -0
- package/cjs/System/index.js +55 -0
- package/cjs/Tab/Menu.js +70 -0
- package/cjs/{src/index.js → Tab/Menus.js} +8 -5
- package/cjs/Tab/Panel.js +42 -0
- package/cjs/Tab/Provider.js +31 -0
- package/cjs/Tab/context.js +30 -0
- package/cjs/Tab/index.js +32 -0
- package/cjs/Table.js +85 -0
- package/cjs/ToggleSelect.js +118 -0
- package/cjs/Unauthorized.js +50 -0
- package/cjs/index.js +88 -2
- package/esm/BottomSheet.js +84 -0
- package/esm/Button.js +40 -0
- package/esm/ClientSide.js +7 -0
- package/esm/Copy.js +18 -0
- package/esm/CsrImage.js +31 -0
- package/esm/Data/CardList.js +90 -0
- package/esm/Data/Dashboard.js +35 -0
- package/esm/Data/Insight.js +19 -0
- package/esm/Data/Item.js +175 -0
- package/esm/Data/ListContainer.js +228 -0
- package/esm/Data/Pagination.js +45 -0
- package/esm/Data/QueryMaker.js +293 -0
- package/esm/Data/TableList.js +110 -0
- package/esm/Data/index.js +14 -0
- package/esm/Data/index_.js +20 -0
- package/esm/DatePicker.js +144 -0
- package/esm/Dialog/Action.js +13 -0
- package/esm/Dialog/Close.js +19 -0
- package/esm/Dialog/Content.js +8 -0
- package/esm/Dialog/Modal.js +126 -0
- package/esm/Dialog/Provider.js +17 -0
- package/esm/Dialog/Title.js +13 -0
- package/esm/Dialog/Trigger.js +19 -0
- package/esm/Dialog/context.js +13 -0
- package/esm/Dialog/index.js +17 -0
- package/esm/DragAction.js +92 -0
- package/esm/DraggableList.js +112 -0
- package/esm/Dropdown.js +45 -0
- package/esm/Empty.js +21 -0
- package/esm/Field.js +1090 -0
- package/esm/FontFace.js +58 -0
- package/esm/Image.js +32 -0
- package/esm/InfiniteScroll.js +46 -0
- package/esm/Input.js +415 -0
- package/esm/KeyboardAvoiding.js +46 -0
- package/esm/Layout/BottomAction.js +7 -0
- package/esm/Layout/BottomInset.js +34 -0
- package/esm/Layout/BottomTab.js +37 -0
- package/esm/Layout/Header.js +33 -0
- package/esm/Layout/LeftSider.js +30 -0
- package/esm/Layout/Navbar.js +22 -0
- package/esm/Layout/RightSider.js +33 -0
- package/esm/Layout/Sider.js +20 -0
- package/esm/Layout/Template.js +7 -0
- package/esm/Layout/TopLeftAction.js +20 -0
- package/esm/Layout/Unit.js +8 -0
- package/esm/Layout/View.js +7 -0
- package/esm/Layout/Zone.js +7 -0
- package/esm/Layout/index.js +29 -0
- package/esm/Link/Back.js +8 -0
- package/esm/Link/Close.js +17 -0
- package/esm/Link/CsrLink.js +30 -0
- package/esm/Link/NextLink.js +42 -0
- package/esm/Link/index.js +18 -0
- package/esm/Link/types.js +0 -0
- package/esm/Load/Edit.js +13 -0
- package/esm/Load/Edit_Client.js +74 -0
- package/esm/Load/Page.js +16 -0
- package/esm/Load/PageCSR.js +48 -0
- package/esm/Load/Pagination.js +70 -0
- package/esm/Load/Units.js +213 -0
- package/esm/Load/View.js +69 -0
- package/esm/Load/index.js +13 -0
- package/esm/Load/index_.js +10 -0
- package/esm/Loading/Area.js +6 -0
- package/esm/Loading/Button.js +14 -0
- package/esm/Loading/Input.js +14 -0
- package/esm/Loading/ProgressBar.js +10 -0
- package/esm/Loading/Skeleton.js +8 -0
- package/esm/Loading/Spin.js +8 -0
- package/esm/Loading/index.js +10 -0
- package/esm/Menu.js +196 -0
- package/esm/Modal.js +46 -0
- package/esm/Model/Edit.js +32 -0
- package/esm/Model/EditModal.js +226 -0
- package/esm/Model/EditWrapper.js +29 -0
- package/esm/Model/LoadInit.js +8 -0
- package/esm/Model/New.js +32 -0
- package/esm/Model/NewWrapper.js +9 -0
- package/esm/Model/NewWrapper_Client.js +47 -0
- package/esm/Model/Remove.js +67 -0
- package/esm/Model/RemoveWrapper.js +29 -0
- package/esm/Model/SureToRemove.js +90 -0
- package/esm/Model/View.js +25 -0
- package/esm/Model/ViewEditModal.js +89 -0
- package/esm/Model/ViewModal.js +63 -0
- package/esm/Model/ViewWrapper.js +29 -0
- package/esm/Model/index.js +33 -0
- package/esm/Model/index_.js +29 -0
- package/esm/More.js +38 -0
- package/esm/ObjectId.js +18 -0
- package/esm/Pagination.js +91 -0
- package/esm/Popconfirm.js +87 -0
- package/esm/Portal.js +8 -0
- package/esm/Radio.js +34 -0
- package/esm/RecentTime.js +57 -0
- package/esm/Refresh.js +16 -0
- package/esm/ScreenNavigator.js +102 -0
- package/esm/Select.js +243 -0
- package/esm/Signal/Arg.js +208 -0
- package/esm/Signal/Doc.js +152 -0
- package/esm/Signal/GraphQL.js +156 -0
- package/esm/Signal/Listener.js +40 -0
- package/esm/Signal/Message.js +161 -0
- package/esm/Signal/Object.js +76 -0
- package/esm/Signal/PubSub.js +162 -0
- package/esm/Signal/Request.js +19 -0
- package/esm/Signal/Response.js +34 -0
- package/esm/Signal/RestApi.js +234 -0
- package/esm/Signal/WebSocket.js +39 -0
- package/esm/Signal/index.js +13 -0
- package/esm/System/CSR.js +357 -0
- package/esm/System/Client.js +191 -0
- package/esm/System/Common.js +45 -0
- package/esm/System/DevModeToggle.js +19 -0
- package/esm/System/Gtag.js +48 -0
- package/esm/System/HealthCheck.js +41 -0
- package/esm/System/Messages.js +156 -0
- package/esm/System/Reconnect.js +45 -0
- package/esm/System/Root.js +11 -0
- package/esm/System/SSR.js +125 -0
- package/esm/System/SelectLanguage.js +39 -0
- package/esm/System/ThemeToggle.js +21 -0
- package/esm/System/index.js +26 -0
- package/esm/Tab/Menu.js +51 -0
- package/esm/Tab/Menus.js +7 -0
- package/esm/Tab/Panel.js +23 -0
- package/esm/Tab/Provider.js +12 -0
- package/esm/Tab/context.js +11 -0
- package/esm/Tab/index.js +13 -0
- package/esm/Table.js +56 -0
- package/esm/ToggleSelect.js +99 -0
- package/esm/Unauthorized.js +21 -0
- package/esm/index.js +84 -1
- package/index.d.ts +41 -1
- package/package.json +23 -2
- package/esm/src/index.js +0 -4
- package/src/index.d.ts +0 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { dayjs, logo } from "@akanjs/base";
|
|
3
|
+
import {
|
|
4
|
+
clsx,
|
|
5
|
+
defaultPageState,
|
|
6
|
+
device,
|
|
7
|
+
getPathInfo,
|
|
8
|
+
initAuth,
|
|
9
|
+
pathContext,
|
|
10
|
+
router,
|
|
11
|
+
setCookie,
|
|
12
|
+
storage
|
|
13
|
+
} from "@akanjs/client";
|
|
14
|
+
import { Logger } from "@akanjs/common";
|
|
15
|
+
import { useFetch } from "@akanjs/next";
|
|
16
|
+
import { fetch } from "@akanjs/signal";
|
|
17
|
+
import { st } from "@akanjs/store";
|
|
18
|
+
import { a } from "@react-spring/web";
|
|
19
|
+
import { useParams, usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
20
|
+
import { ThemeProvider, useTheme } from "next-themes";
|
|
21
|
+
import { useEffect, useState } from "react";
|
|
22
|
+
import { Gtag } from "./Gtag";
|
|
23
|
+
import { Messages } from "./Messages";
|
|
24
|
+
const Client = () => {
|
|
25
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
26
|
+
};
|
|
27
|
+
const ClientWrapper = ({ children, theme }) => {
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
Logger.rawLog(logo);
|
|
30
|
+
}, []);
|
|
31
|
+
return /* @__PURE__ */ React.createElement(ThemeProvider, { defaultTheme: theme }, children);
|
|
32
|
+
};
|
|
33
|
+
Client.Wrapper = ClientWrapper;
|
|
34
|
+
const ClientPathWrapper = ({
|
|
35
|
+
bind,
|
|
36
|
+
wrapperRef,
|
|
37
|
+
pageType = "current",
|
|
38
|
+
location,
|
|
39
|
+
prefix = "",
|
|
40
|
+
children,
|
|
41
|
+
layoutStyle = "web",
|
|
42
|
+
...props
|
|
43
|
+
}) => {
|
|
44
|
+
const pathname = location?.pathname ?? usePathname();
|
|
45
|
+
const params = location?.params ?? useParams();
|
|
46
|
+
const searchParams = location?.searchParams ?? Object.fromEntries(useSearchParams());
|
|
47
|
+
const search = location?.search ?? (typeof window !== "undefined" ? window.location.search : "");
|
|
48
|
+
const lang = params.lang;
|
|
49
|
+
const firstPath = pathname.split("/")[2];
|
|
50
|
+
const pathRoute = location?.pathRoute ?? {
|
|
51
|
+
path: "/" + pathname.split("/").slice(2).join("/"),
|
|
52
|
+
pathSegments: pathname.split("/").slice(2),
|
|
53
|
+
Page: () => /* @__PURE__ */ React.createElement(React.Fragment, null),
|
|
54
|
+
pageState: defaultPageState,
|
|
55
|
+
RootLayouts: [],
|
|
56
|
+
Layouts: []
|
|
57
|
+
};
|
|
58
|
+
const [gestureEnabled, setGestureEnabled] = useState(true);
|
|
59
|
+
return /* @__PURE__ */ React.createElement(
|
|
60
|
+
pathContext.Provider,
|
|
61
|
+
{
|
|
62
|
+
value: {
|
|
63
|
+
pageType,
|
|
64
|
+
location: { pathname, params, searchParams, search, pathRoute },
|
|
65
|
+
gestureEnabled,
|
|
66
|
+
setGestureEnabled
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
/* @__PURE__ */ React.createElement(
|
|
70
|
+
a.div,
|
|
71
|
+
{
|
|
72
|
+
...bind && pathRoute.pageState.gesture && gestureEnabled ? bind() : {},
|
|
73
|
+
className: clsx("group/path size-full"),
|
|
74
|
+
ref: wrapperRef,
|
|
75
|
+
...props,
|
|
76
|
+
"data-lang": lang,
|
|
77
|
+
"data-basepath": prefix,
|
|
78
|
+
"data-firstpath": firstPath
|
|
79
|
+
},
|
|
80
|
+
children
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
const ClientBridge = ({ env, lang, mePromise, selfPromise, theme, prefix, gaTrackingId }) => {
|
|
85
|
+
const uiOperation = st.use.uiOperation();
|
|
86
|
+
const pathname = st.use.pathname();
|
|
87
|
+
const params = st.use.params();
|
|
88
|
+
const searchParams = st.use.searchParams();
|
|
89
|
+
const { fulfilled: meFullfilled, value: me } = useFetch(mePromise);
|
|
90
|
+
const { fulfilled: selfFullfilled, value: self } = useFetch(selfPromise);
|
|
91
|
+
const language = params.lang ?? lang;
|
|
92
|
+
const path = "/" + pathname.split("/").slice(2).join("/");
|
|
93
|
+
const { setTheme, themes, theme: nextTheme } = useTheme();
|
|
94
|
+
const storeTheme = st.use.theme();
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (uiOperation !== "sleep")
|
|
97
|
+
return;
|
|
98
|
+
if (!meFullfilled || !selfFullfilled)
|
|
99
|
+
return;
|
|
100
|
+
const initTheme = async () => {
|
|
101
|
+
if (theme) {
|
|
102
|
+
setTheme(theme);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const localTheme = await storage.getItem("theme");
|
|
106
|
+
if (typeof localTheme === "string" && themes.includes(localTheme)) {
|
|
107
|
+
setTheme(localTheme);
|
|
108
|
+
} else
|
|
109
|
+
setTheme("system");
|
|
110
|
+
};
|
|
111
|
+
void initTheme();
|
|
112
|
+
setCookie("siteurl", window.location.origin);
|
|
113
|
+
dayjs.locale(language);
|
|
114
|
+
initAuth({ jwt: searchParams.jwt });
|
|
115
|
+
st.set({
|
|
116
|
+
prefix,
|
|
117
|
+
uiOperation: "loading",
|
|
118
|
+
...me ? { me: fetch.crystalizeAdmin?.(me) } : {},
|
|
119
|
+
...self ? { self: fetch.crystalizeUser?.(self) } : {}
|
|
120
|
+
});
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
st.set({ uiOperation: "idle" });
|
|
123
|
+
}, 2e3);
|
|
124
|
+
}, [meFullfilled, selfFullfilled]);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (theme && storeTheme !== nextTheme)
|
|
127
|
+
setTheme(storeTheme);
|
|
128
|
+
}, [storeTheme]);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (nextTheme && storeTheme !== nextTheme)
|
|
131
|
+
st.do.setTheme(nextTheme);
|
|
132
|
+
}, []);
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
const devMode = localStorage.getItem("devMode");
|
|
135
|
+
if (devMode)
|
|
136
|
+
st.do.setDevMode(devMode === "true");
|
|
137
|
+
}, []);
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (uiOperation !== "sleep")
|
|
140
|
+
return;
|
|
141
|
+
const handleResize = () => {
|
|
142
|
+
st.do.setWindowSize();
|
|
143
|
+
};
|
|
144
|
+
handleResize();
|
|
145
|
+
window.addEventListener("resize", handleResize);
|
|
146
|
+
return () => {
|
|
147
|
+
window.removeEventListener("resize", handleResize);
|
|
148
|
+
};
|
|
149
|
+
}, []);
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
setCookie("path", path);
|
|
152
|
+
Logger.log(`pathChange-finished:${path}`);
|
|
153
|
+
}, [pathname]);
|
|
154
|
+
return gaTrackingId && /* @__PURE__ */ React.createElement(Gtag, { trackingId: gaTrackingId });
|
|
155
|
+
};
|
|
156
|
+
Client.Bridge = ClientBridge;
|
|
157
|
+
const ClientInner = () => {
|
|
158
|
+
const uiOperation = st.use.uiOperation();
|
|
159
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { id: "modal-root" }), uiOperation === "idle" ? /* @__PURE__ */ React.createElement(Messages, null) : null);
|
|
160
|
+
};
|
|
161
|
+
Client.Inner = ClientInner;
|
|
162
|
+
const ClientNextBridge = ({ lang, prefix = "" }) => {
|
|
163
|
+
const pathname = usePathname();
|
|
164
|
+
const searchParams = useSearchParams();
|
|
165
|
+
const params = useParams();
|
|
166
|
+
const nextRouter = useRouter();
|
|
167
|
+
useEffect(() => {
|
|
168
|
+
router.init({ type: "next", side: "client", router: nextRouter, lang, prefix });
|
|
169
|
+
void device.init({ lang });
|
|
170
|
+
}, []);
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
const { path } = getPathInfo(pathname, lang, prefix);
|
|
173
|
+
st.set({ pathname, path });
|
|
174
|
+
}, [pathname]);
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
st.set({ params });
|
|
177
|
+
}, [params]);
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
st.set({ searchParams: Object.fromEntries(searchParams) });
|
|
180
|
+
}, [searchParams]);
|
|
181
|
+
return null;
|
|
182
|
+
};
|
|
183
|
+
Client.NextBridge = ClientNextBridge;
|
|
184
|
+
export {
|
|
185
|
+
Client,
|
|
186
|
+
ClientBridge,
|
|
187
|
+
ClientInner,
|
|
188
|
+
ClientNextBridge,
|
|
189
|
+
ClientPathWrapper,
|
|
190
|
+
ClientWrapper
|
|
191
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import "dayjs/locale/ko";
|
|
2
|
+
import { getAccount } from "@akanjs/client";
|
|
3
|
+
import { Load } from "../Load";
|
|
4
|
+
import { HealthCheck } from "./HealthCheck";
|
|
5
|
+
const Common = () => {
|
|
6
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
7
|
+
};
|
|
8
|
+
const CommonWrapper = ({
|
|
9
|
+
fetch,
|
|
10
|
+
environment,
|
|
11
|
+
render,
|
|
12
|
+
fetchPing,
|
|
13
|
+
fetchMe = fetch.me,
|
|
14
|
+
fetchSelf = fetch.getSelf
|
|
15
|
+
}) => {
|
|
16
|
+
const account = getAccount();
|
|
17
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(HealthCheck, { fetchPing }), /* @__PURE__ */ React.createElement(
|
|
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
|
+
export {
|
|
44
|
+
Common
|
|
45
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { st } from "@akanjs/store";
|
|
3
|
+
const DevModeToggle = () => {
|
|
4
|
+
const devMode = st.use.devMode();
|
|
5
|
+
return /* @__PURE__ */ React.createElement("div", { className: "form-control" }, /* @__PURE__ */ React.createElement("label", { className: "label cursor-pointer" }, /* @__PURE__ */ React.createElement("span", { className: "label-text mr-2 text-sm whitespace-nowrap" }, "Dev Mode"), /* @__PURE__ */ React.createElement(
|
|
6
|
+
"input",
|
|
7
|
+
{
|
|
8
|
+
type: "checkbox",
|
|
9
|
+
className: "toggle",
|
|
10
|
+
checked: devMode,
|
|
11
|
+
onChange: (e) => {
|
|
12
|
+
st.do.setDevMode(e.target.checked);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
)));
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
DevModeToggle
|
|
19
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { st } from "@akanjs/store";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
const Gtag = ({ trackingId }) => {
|
|
5
|
+
const pathname = st.use.pathname();
|
|
6
|
+
const searchParams = st.use.searchParams();
|
|
7
|
+
const pageview = (url) => {
|
|
8
|
+
window.gtag?.("config", trackingId, { page_path: url });
|
|
9
|
+
};
|
|
10
|
+
const event = ({
|
|
11
|
+
action,
|
|
12
|
+
category,
|
|
13
|
+
label,
|
|
14
|
+
value
|
|
15
|
+
}) => {
|
|
16
|
+
window.gtag?.("event", action, {
|
|
17
|
+
event_category: category,
|
|
18
|
+
event_label: label,
|
|
19
|
+
value
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const handleRouteChange = (url) => {
|
|
24
|
+
pageview(url);
|
|
25
|
+
};
|
|
26
|
+
handleRouteChange(
|
|
27
|
+
pathname + (Object.keys(searchParams).length ? new URLSearchParams(searchParams).toString() : "")
|
|
28
|
+
);
|
|
29
|
+
}, [pathname, searchParams]);
|
|
30
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("script", { async: true, src: `https://www.googletagmanager.com/gtag/js?id=${trackingId}` }), /* @__PURE__ */ React.createElement(
|
|
31
|
+
"script",
|
|
32
|
+
{
|
|
33
|
+
dangerouslySetInnerHTML: {
|
|
34
|
+
__html: `
|
|
35
|
+
window.dataLayer = window.dataLayer || [];
|
|
36
|
+
function gtag(){dataLayer.push(arguments);}
|
|
37
|
+
gtag('js', new Date());
|
|
38
|
+
gtag('config', '${trackingId}', {
|
|
39
|
+
page_path: window.location.pathname,
|
|
40
|
+
});
|
|
41
|
+
`
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
));
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
Gtag
|
|
48
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { router } from "@akanjs/client";
|
|
3
|
+
import { useInterval } from "@akanjs/next";
|
|
4
|
+
import { fetch } from "@akanjs/signal";
|
|
5
|
+
import { st } from "@akanjs/store";
|
|
6
|
+
import { useEffect } from "react";
|
|
7
|
+
const HealthCheck = ({ fetchPing = () => fetch.ping() }) => {
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
void (async () => {
|
|
10
|
+
const fullPath = router.getFullPath(false);
|
|
11
|
+
try {
|
|
12
|
+
await fetchPing();
|
|
13
|
+
st.do.setConnectStatus("connected");
|
|
14
|
+
if (window.location.href.includes("/unknown")) {
|
|
15
|
+
router.back();
|
|
16
|
+
}
|
|
17
|
+
} catch (e) {
|
|
18
|
+
st.do.setConnectStatus("disconnected");
|
|
19
|
+
router.replace(`/unknown?p=${encodeURIComponent(fullPath)}`);
|
|
20
|
+
}
|
|
21
|
+
})();
|
|
22
|
+
}, []);
|
|
23
|
+
const pingCheck = async function() {
|
|
24
|
+
try {
|
|
25
|
+
await fetchPing();
|
|
26
|
+
} catch (e) {
|
|
27
|
+
st.do.setConnectStatus("disconnected");
|
|
28
|
+
const fullPath = router.getFullPath(false);
|
|
29
|
+
router.replace(`/unknown?p=${encodeURIComponent(fullPath)}`);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
useInterval(async () => {
|
|
33
|
+
if (window.location.href.includes("/unknown"))
|
|
34
|
+
return;
|
|
35
|
+
await pingCheck();
|
|
36
|
+
}, 1e4);
|
|
37
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
HealthCheck
|
|
41
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx } from "@akanjs/client";
|
|
3
|
+
import { msg } from "@akanjs/dictionary";
|
|
4
|
+
import { usePage } from "@akanjs/next";
|
|
5
|
+
import { st } from "@akanjs/store";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import {
|
|
8
|
+
AiOutlineCheckCircle,
|
|
9
|
+
AiOutlineInfoCircle,
|
|
10
|
+
AiOutlineLoading3Quarters,
|
|
11
|
+
AiOutlineQuestionCircle
|
|
12
|
+
} from "react-icons/ai";
|
|
13
|
+
import { BsExclamationCircleFill } from "react-icons/bs";
|
|
14
|
+
let timeOuts = [];
|
|
15
|
+
const Message = ({ content, type = "info", duration, keyForMessage }) => {
|
|
16
|
+
const pageState = st.use.pageState();
|
|
17
|
+
const [preBlind, setPreBlind] = useState(false);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!content)
|
|
20
|
+
return;
|
|
21
|
+
const existingTimeOut = timeOuts.find((item) => item.key === keyForMessage);
|
|
22
|
+
if (existingTimeOut) {
|
|
23
|
+
clearTimeout(existingTimeOut.timeoutId);
|
|
24
|
+
removeTimeOut(keyForMessage);
|
|
25
|
+
}
|
|
26
|
+
const timeoutId = setTimeout(() => {
|
|
27
|
+
setPreBlind(true);
|
|
28
|
+
}, duration * 1e3);
|
|
29
|
+
addTimeOut(keyForMessage, timeoutId);
|
|
30
|
+
return () => {
|
|
31
|
+
clearTimeout(timeoutId);
|
|
32
|
+
};
|
|
33
|
+
}, [content, keyForMessage, type]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!preBlind)
|
|
36
|
+
return;
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
st.do.hideMessage(keyForMessage);
|
|
39
|
+
removeTimeOut(keyForMessage);
|
|
40
|
+
}, 100);
|
|
41
|
+
}, [preBlind]);
|
|
42
|
+
const addTimeOut = (key, timeoutId) => {
|
|
43
|
+
const filteredTimeOuts = timeOuts.filter((item) => item.key !== key);
|
|
44
|
+
timeOuts = [...filteredTimeOuts, { key, timeoutId }];
|
|
45
|
+
};
|
|
46
|
+
const removeTimeOut = (key) => {
|
|
47
|
+
timeOuts = timeOuts.filter((item) => item.key !== key);
|
|
48
|
+
};
|
|
49
|
+
const iconClassName = type === "loading" ? "text-info" : `text-${type}`;
|
|
50
|
+
const getIcon = (type2) => {
|
|
51
|
+
const icons = {
|
|
52
|
+
info: /* @__PURE__ */ React.createElement(AiOutlineInfoCircle, { className: clsx("text-2xl", iconClassName) }),
|
|
53
|
+
success: /* @__PURE__ */ React.createElement(AiOutlineCheckCircle, { className: clsx("text-2xl", iconClassName) }),
|
|
54
|
+
error: /* @__PURE__ */ React.createElement(BsExclamationCircleFill, { className: clsx("text-2xl", iconClassName) }),
|
|
55
|
+
warning: /* @__PURE__ */ React.createElement(AiOutlineQuestionCircle, { className: clsx("text-2xl", iconClassName) }),
|
|
56
|
+
loading: /* @__PURE__ */ React.createElement(AiOutlineLoading3Quarters, { className: clsx("animate-spin text-2xl", iconClassName) })
|
|
57
|
+
};
|
|
58
|
+
return icons[type2];
|
|
59
|
+
};
|
|
60
|
+
return /* @__PURE__ */ React.createElement(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
"data-state": preBlind,
|
|
64
|
+
className: "animate-zoomIn data-[state=true]:animate-smaller group w-screen px-6 duration-300 md:max-w-[60%]",
|
|
65
|
+
style: {
|
|
66
|
+
paddingTop: pageState.topSafeArea
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
/* @__PURE__ */ React.createElement(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
className: clsx(
|
|
73
|
+
"typo-body1 text-base-content flex w-full items-center gap-2 rounded-[4px] border px-4 py-2 drop-shadow-lg",
|
|
74
|
+
{
|
|
75
|
+
"stroke-base-content bg-primary-content border-[#EEEEEE]": type === "loading" || type === "info",
|
|
76
|
+
"stroke-success bg-success/80 border-success-border": type === "success",
|
|
77
|
+
"stroke-error bg-error/80 border-error-border": type === "error",
|
|
78
|
+
"stroke-warning bg-warning/80 border-warning-border": type === "warning"
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
},
|
|
82
|
+
/* @__PURE__ */ React.createElement("div", { className: "bg-base-100 flex size-6 items-center justify-center rounded-full" }, getIcon(type)),
|
|
83
|
+
/* @__PURE__ */ React.createElement("span", { className: "text-base-100 truncate whitespace-nowrap" }, content)
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
const Messages = () => {
|
|
88
|
+
const messages = st.use.messages();
|
|
89
|
+
const { l } = usePage();
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
Object.assign(msg, {
|
|
92
|
+
info: (msgKey, option = {}) => {
|
|
93
|
+
st.do.showMessage({
|
|
94
|
+
type: "info",
|
|
95
|
+
key: option.key,
|
|
96
|
+
duration: option.duration ?? 3,
|
|
97
|
+
content: l(msgKey, option.data)
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
success: (msgKey, option = {}) => {
|
|
101
|
+
st.do.showMessage({
|
|
102
|
+
type: "success",
|
|
103
|
+
key: option.key,
|
|
104
|
+
duration: option.duration ?? 3,
|
|
105
|
+
content: l(msgKey, option.data)
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
error: (msgKey, option = {}) => {
|
|
109
|
+
st.do.showMessage({
|
|
110
|
+
type: "error",
|
|
111
|
+
key: option.key,
|
|
112
|
+
duration: option.duration ?? 3,
|
|
113
|
+
content: l(msgKey, option.data)
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
warning: (msgKey, option = {}) => {
|
|
117
|
+
st.do.showMessage({
|
|
118
|
+
type: "warning",
|
|
119
|
+
key: option.key,
|
|
120
|
+
duration: option.duration ?? 3,
|
|
121
|
+
content: l(msgKey, option.data)
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
loading: (msgKey, option = {}) => {
|
|
125
|
+
st.do.showMessage({
|
|
126
|
+
type: "loading",
|
|
127
|
+
key: option.key,
|
|
128
|
+
duration: option.duration ?? 3,
|
|
129
|
+
content: l(msgKey, option.data)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}, []);
|
|
134
|
+
if (!messages.length)
|
|
135
|
+
return null;
|
|
136
|
+
return /* @__PURE__ */ React.createElement(
|
|
137
|
+
"div",
|
|
138
|
+
{
|
|
139
|
+
id: "toast",
|
|
140
|
+
className: "fixed top-0 left-0 z-[100] mt-[var(--safe-area-top)] flex h-fit w-screen flex-col items-center justify-start gap-2 pt-2"
|
|
141
|
+
},
|
|
142
|
+
messages.map((message) => /* @__PURE__ */ React.createElement(
|
|
143
|
+
Message,
|
|
144
|
+
{
|
|
145
|
+
content: message.content,
|
|
146
|
+
type: message.type,
|
|
147
|
+
duration: message.duration,
|
|
148
|
+
key: message.key,
|
|
149
|
+
keyForMessage: message.key
|
|
150
|
+
}
|
|
151
|
+
))
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
export {
|
|
155
|
+
Messages
|
|
156
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { router } from "@akanjs/client";
|
|
3
|
+
import { useInterval } from "@akanjs/next";
|
|
4
|
+
import { fetch } from "@akanjs/signal";
|
|
5
|
+
import { st } from "@akanjs/store";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { TbPlugConnected, TbPlugConnectedX } from "react-icons/tb";
|
|
8
|
+
import { Image } from "../Image";
|
|
9
|
+
const Reconnect = ({
|
|
10
|
+
path,
|
|
11
|
+
dev = false,
|
|
12
|
+
fetchPing = fetch.ping
|
|
13
|
+
}) => {
|
|
14
|
+
const DOTS_LENGTH = 4;
|
|
15
|
+
const [dots, setDots] = useState(0);
|
|
16
|
+
const connectStatus = st.use.connectStatus();
|
|
17
|
+
useInterval(() => {
|
|
18
|
+
setDots((prev) => (prev + 1) % DOTS_LENGTH);
|
|
19
|
+
}, 500);
|
|
20
|
+
const reconnect = async () => {
|
|
21
|
+
try {
|
|
22
|
+
st.do.setConnectStatus("connecting");
|
|
23
|
+
await fetchPing?.();
|
|
24
|
+
st.do.setConnectStatus("connected");
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
router.replace(`/${path}`);
|
|
27
|
+
}, 500);
|
|
28
|
+
} catch (e) {
|
|
29
|
+
st.do.setConnectStatus("disconnected");
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
useInterval(async () => {
|
|
33
|
+
if (!window.location.href.includes("/unknown"))
|
|
34
|
+
return;
|
|
35
|
+
if (connectStatus === "connected")
|
|
36
|
+
return;
|
|
37
|
+
await reconnect();
|
|
38
|
+
}, 5e3);
|
|
39
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, dev ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex h-screen flex-col items-center justify-center" }, /* @__PURE__ */ React.createElement("div", { className: "bg-base-300 flex w-4/5 flex-col items-center justify-center rounded-md p-5 md:w-1/3" }, /* @__PURE__ */ React.createElement("div", { className: "text-3xl font-bold" }, "Something's wrong!"), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col items-center justify-center pt-5" }, /* @__PURE__ */ React.createElement("div", { className: "py-5" }, connectStatus === "disconnected" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "text-[100px] text-gray-500" }, /* @__PURE__ */ React.createElement(TbPlugConnectedX, null))) : connectStatus === "connecting" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "animate-pulse text-[100px] text-gray-500" }, /* @__PURE__ */ React.createElement(TbPlugConnectedX, null))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "animate-pop text-[100px] text-white" }, /* @__PURE__ */ React.createElement(TbPlugConnected, null)))), connectStatus === "connected" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", null, "Connected!"), /* @__PURE__ */ React.createElement("div", { className: "animate-pop" }), /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement("span", { className: "text-sm text-gray-500" }, "Redirecting to the previous page in some seconds."))) : connectStatus === "connecting" ? /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-center" }, /* @__PURE__ */ React.createElement("div", null, "Try reconnecting to the server"), /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, Array.from({ length: DOTS_LENGTH }).map(
|
|
40
|
+
(_, index) => dots >= index ? /* @__PURE__ */ React.createElement("div", { key: index, className: "visible" }, ".") : /* @__PURE__ */ React.createElement("div", { key: index, className: "invisible" }, ".")
|
|
41
|
+
))) : /* @__PURE__ */ React.createElement("div", null, "Server disconnected."))), /* @__PURE__ */ React.createElement("span", { className: "text-center text-sm text-gray-500" }, "*Please check your server status."))) : /* @__PURE__ */ React.createElement("div", { className: "flex h-screen items-center justify-center" }, /* @__PURE__ */ React.createElement("div", { className: "bg-base-300 flex w-4/5 flex-col items-center justify-center rounded-md py-5 md:w-1/3" }, /* @__PURE__ */ React.createElement("div", { className: "text-3xl font-bold" }, "\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC5B4\uC694!"), /* @__PURE__ */ React.createElement(Image, { className: "mt-5", src: "/deadBot.svg", alt: "deadBot", color: "gray", width: 120, height: 120 }), /* @__PURE__ */ React.createElement("div", { className: "text-lg" }, "\uC11C\uBC84\uC5D0 \uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4."), /* @__PURE__ */ React.createElement("div", { className: "text-lg" }, "\uC11C\uBC84\uC5D0 \uC5F0\uACB0\uC744 \uC7AC\uC2DC\uB3C4\uD558\uACE0 \uC788\uC5B4\uC694..."))));
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
Reconnect
|
|
45
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { baseEnv } from "@akanjs/base";
|
|
3
|
+
import { checkDictCoverage } from "@akanjs/dictionary";
|
|
4
|
+
const Root = ({ children, st }) => {
|
|
5
|
+
if (baseEnv.operationMode === "local")
|
|
6
|
+
checkDictCoverage();
|
|
7
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
Root
|
|
11
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { clsx, router } from "@akanjs/client";
|
|
2
|
+
import { Suspense } from "react";
|
|
3
|
+
import { Load } from "../Load";
|
|
4
|
+
import { ClientBridge, ClientInner, ClientNextBridge, ClientPathWrapper, ClientWrapper } from "./Client";
|
|
5
|
+
import { Common } from "./Common";
|
|
6
|
+
const SSR = () => {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null);
|
|
8
|
+
};
|
|
9
|
+
const SSRProvider = ({
|
|
10
|
+
className,
|
|
11
|
+
appName,
|
|
12
|
+
params,
|
|
13
|
+
head,
|
|
14
|
+
env,
|
|
15
|
+
gaTrackingId,
|
|
16
|
+
fetch,
|
|
17
|
+
children,
|
|
18
|
+
theme,
|
|
19
|
+
prefix,
|
|
20
|
+
fonts,
|
|
21
|
+
layoutStyle = "web",
|
|
22
|
+
of,
|
|
23
|
+
fetchPing,
|
|
24
|
+
fetchMe,
|
|
25
|
+
fetchSelf
|
|
26
|
+
}) => {
|
|
27
|
+
return /* @__PURE__ */ React.createElement(
|
|
28
|
+
Load.Page,
|
|
29
|
+
{
|
|
30
|
+
of,
|
|
31
|
+
loader: async () => {
|
|
32
|
+
const { lang } = await params;
|
|
33
|
+
if (!router.isInitialized)
|
|
34
|
+
router.init({ type: "next", side: "server", lang, prefix });
|
|
35
|
+
return { lang };
|
|
36
|
+
},
|
|
37
|
+
render: ({ lang }) => /* @__PURE__ */ React.createElement(
|
|
38
|
+
Common.Wrapper,
|
|
39
|
+
{
|
|
40
|
+
fetch,
|
|
41
|
+
environment: env.environment,
|
|
42
|
+
fetchPing,
|
|
43
|
+
fetchMe,
|
|
44
|
+
fetchSelf,
|
|
45
|
+
render: ({ mePromise, selfPromise }) => /* @__PURE__ */ React.createElement(
|
|
46
|
+
SSRWrapper,
|
|
47
|
+
{
|
|
48
|
+
className,
|
|
49
|
+
appName,
|
|
50
|
+
lang,
|
|
51
|
+
head,
|
|
52
|
+
fonts,
|
|
53
|
+
prefix,
|
|
54
|
+
layoutStyle
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ React.createElement(ClientWrapper, { theme }, children, /* @__PURE__ */ React.createElement(Suspense, { fallback: null }, /* @__PURE__ */ React.createElement(ClientInner, null)), /* @__PURE__ */ React.createElement(Suspense, { fallback: null }, /* @__PURE__ */ React.createElement(
|
|
57
|
+
ClientBridge,
|
|
58
|
+
{
|
|
59
|
+
env,
|
|
60
|
+
mePromise,
|
|
61
|
+
selfPromise,
|
|
62
|
+
theme,
|
|
63
|
+
prefix,
|
|
64
|
+
gaTrackingId
|
|
65
|
+
}
|
|
66
|
+
), /* @__PURE__ */ React.createElement(ClientNextBridge, { lang, prefix })))
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
SSR.Provider = SSRProvider;
|
|
74
|
+
const SSRWrapper = ({
|
|
75
|
+
children,
|
|
76
|
+
lang,
|
|
77
|
+
head,
|
|
78
|
+
fonts = [],
|
|
79
|
+
appName,
|
|
80
|
+
className,
|
|
81
|
+
prefix,
|
|
82
|
+
layoutStyle = "web"
|
|
83
|
+
}) => /* @__PURE__ */ React.createElement("html", { lang, className: `${fonts.map((font) => font.variable).join(" ")} ${className}`, suppressHydrationWarning: true }, /* @__PURE__ */ React.createElement("head", null, head), /* @__PURE__ */ React.createElement("body", { className: "app" }, /* @__PURE__ */ React.createElement("div", { id: "frameRoot", className }, /* @__PURE__ */ React.createElement(ClientPathWrapper, { layoutStyle, prefix }, /* @__PURE__ */ React.createElement("div", { id: "topSafeArea", className: clsx("bg-base-100 fixed inset-x-0 top-0") }), /* @__PURE__ */ React.createElement("div", { id: "pageContainers", className: clsx("isolate") }, /* @__PURE__ */ React.createElement("div", { id: "pageContainer" }, /* @__PURE__ */ React.createElement(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
id: "pageContent",
|
|
87
|
+
className: clsx("bg-base-100 relative isolate", {
|
|
88
|
+
"w-screen": layoutStyle === "web",
|
|
89
|
+
"left-1/2 h-screen w-[600px] -translate-x-1/2": layoutStyle === "mobile"
|
|
90
|
+
})
|
|
91
|
+
},
|
|
92
|
+
children
|
|
93
|
+
))), /* @__PURE__ */ React.createElement(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
id: "topInsetContainer",
|
|
97
|
+
className: clsx("bg-base-100 fixed inset-x-0 top-0 isolate", {
|
|
98
|
+
"left-1/2 w-[600px] -translate-x-1/2": layoutStyle === "mobile",
|
|
99
|
+
"w-screen": layoutStyle === "web"
|
|
100
|
+
})
|
|
101
|
+
},
|
|
102
|
+
/* @__PURE__ */ React.createElement("div", { id: "topInsetContent", className: clsx("relative isolate size-full") })
|
|
103
|
+
), /* @__PURE__ */ React.createElement(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
id: "topLeftActionContainer",
|
|
107
|
+
className: "aspect-1 absolute top-0 left-0 isolate flex items-center justify-center"
|
|
108
|
+
}
|
|
109
|
+
), /* @__PURE__ */ React.createElement(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
id: "bottomInsetContainer",
|
|
113
|
+
className: clsx("fixed inset-x-0 bottom-0 isolate", {
|
|
114
|
+
"left-1/2 w-[600px] -translate-x-1/2": layoutStyle === "mobile",
|
|
115
|
+
"w-screen": layoutStyle === "web"
|
|
116
|
+
})
|
|
117
|
+
},
|
|
118
|
+
/* @__PURE__ */ React.createElement("div", { id: "bottomInsetContent", className: "isolate size-full" })
|
|
119
|
+
), /* @__PURE__ */ React.createElement("div", { id: "bottomSafeArea", className: "bg-base-100 fixed inset-x-0" })))));
|
|
120
|
+
SSR.Wrapper = SSRWrapper;
|
|
121
|
+
var SSR_default = SSRProvider;
|
|
122
|
+
export {
|
|
123
|
+
SSR,
|
|
124
|
+
SSR_default as default
|
|
125
|
+
};
|