@akanjs/client 0.9.58-canary.0 → 0.9.58-canary.1
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/cjs/src/csrTypes.js +3 -1
- package/cjs/src/makePageProto.js +2 -2
- package/cjs/src/router.js +8 -8
- package/esm/src/csrTypes.js +3 -1
- package/esm/src/makePageProto.js +2 -2
- package/esm/src/router.js +8 -8
- package/package.json +3 -3
- package/src/csrTypes.d.ts +26 -0
- package/src/makePageProto.d.ts +2 -1
- package/src/useClient.d.ts +7 -7
package/cjs/src/csrTypes.js
CHANGED
|
@@ -37,7 +37,9 @@ const defaultPageState = {
|
|
|
37
37
|
topInset: 0,
|
|
38
38
|
bottomInset: 0,
|
|
39
39
|
gesture: true,
|
|
40
|
-
cache: false
|
|
40
|
+
cache: false,
|
|
41
|
+
topSafeAreaColor: "transparent",
|
|
42
|
+
bottomSafeAreaColor: "transparent"
|
|
41
43
|
};
|
|
42
44
|
const csrContext = (0, import_react.createContext)({});
|
|
43
45
|
const useCsr = () => {
|
package/cjs/src/makePageProto.js
CHANGED
|
@@ -84,7 +84,7 @@ const makePageProto = (cnst) => {
|
|
|
84
84
|
};
|
|
85
85
|
return { path, l, lang };
|
|
86
86
|
},
|
|
87
|
-
fetch: import_base.baseClientEnv.side === "server"
|
|
87
|
+
fetch: import_base.baseClientEnv.side === "server" ? global.builtFetch : global.fetch,
|
|
88
88
|
sig: {},
|
|
89
89
|
registerClient: async (lang) => {
|
|
90
90
|
while (!global.builtFetch) {
|
|
@@ -103,7 +103,7 @@ const makePageProto = (cnst) => {
|
|
|
103
103
|
await (0, import_common.sleep)(3e3);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
return { dictionary: global.dictionary, signals: global.signals };
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
};
|
package/cjs/src/router.js
CHANGED
|
@@ -42,16 +42,16 @@ class Router {
|
|
|
42
42
|
#lang = "en";
|
|
43
43
|
#instance = {
|
|
44
44
|
push: (href) => {
|
|
45
|
-
const { pathname } = this.#getPathInfo(href);
|
|
46
|
-
import_common.Logger.log(`push to:${
|
|
45
|
+
const { pathname, search, hash, href: fullHref } = this.#getPathInfo(href);
|
|
46
|
+
import_common.Logger.log(`push to:${fullHref}`);
|
|
47
47
|
if (import_base.baseClientEnv.side === "server")
|
|
48
|
-
void (0, import_navigation.redirect)(
|
|
48
|
+
void (0, import_navigation.redirect)(fullHref);
|
|
49
49
|
},
|
|
50
50
|
replace: (href) => {
|
|
51
|
-
const { pathname } = this.#getPathInfo(href);
|
|
51
|
+
const { pathname, search, hash, href: fullHref } = this.#getPathInfo(href);
|
|
52
52
|
import_common.Logger.log(`replace to:${pathname}`);
|
|
53
53
|
if (import_base.baseClientEnv.side === "server")
|
|
54
|
-
void (0, import_navigation.redirect)(
|
|
54
|
+
void (0, import_navigation.redirect)(fullHref);
|
|
55
55
|
},
|
|
56
56
|
back: () => {
|
|
57
57
|
throw new Error("back is only available in client");
|
|
@@ -169,9 +169,9 @@ class Router {
|
|
|
169
169
|
const headers = await nextHeaders.headers?.() ?? /* @__PURE__ */ new Map();
|
|
170
170
|
const lang = headers.get("x-locale") ?? this.#lang;
|
|
171
171
|
const basePath = headers.get("x-base-path");
|
|
172
|
-
const { pathname } = getPathInfo(href, lang, basePath ?? "");
|
|
172
|
+
const { pathname, search, href: fullHref, hash } = getPathInfo(href, lang, basePath ?? "");
|
|
173
173
|
import_common.Logger.log(`redirect to:${pathname}`);
|
|
174
|
-
(0, import_navigation.redirect)(
|
|
174
|
+
(0, import_navigation.redirect)(fullHref);
|
|
175
175
|
} else {
|
|
176
176
|
this.#instance.replace(href);
|
|
177
177
|
}
|
|
@@ -190,7 +190,7 @@ class Router {
|
|
|
190
190
|
if (import_base.baseClientEnv.side === "server")
|
|
191
191
|
throw new Error("setLang is only available in client side");
|
|
192
192
|
this.#checkInitialized();
|
|
193
|
-
const { path } = getPathInfo(window.location.pathname, this.#lang, this.#prefix);
|
|
193
|
+
const { path, search, hash, href: fullHref } = getPathInfo(window.location.pathname, this.#lang, this.#prefix);
|
|
194
194
|
this.#lang = lang;
|
|
195
195
|
this.#instance.replace(`/${lang}${path}`);
|
|
196
196
|
return void 0;
|
package/esm/src/csrTypes.js
CHANGED
package/esm/src/makePageProto.js
CHANGED
|
@@ -62,7 +62,7 @@ const makePageProto = (cnst) => {
|
|
|
62
62
|
};
|
|
63
63
|
return { path, l, lang };
|
|
64
64
|
},
|
|
65
|
-
fetch: baseClientEnv.side === "server"
|
|
65
|
+
fetch: baseClientEnv.side === "server" ? global.builtFetch : global.fetch,
|
|
66
66
|
sig: {},
|
|
67
67
|
registerClient: async (lang) => {
|
|
68
68
|
while (!global.builtFetch) {
|
|
@@ -81,7 +81,7 @@ const makePageProto = (cnst) => {
|
|
|
81
81
|
await sleep(3e3);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
return { dictionary: global.dictionary, signals: global.signals };
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
};
|
package/esm/src/router.js
CHANGED
|
@@ -19,16 +19,16 @@ class Router {
|
|
|
19
19
|
#lang = "en";
|
|
20
20
|
#instance = {
|
|
21
21
|
push: (href) => {
|
|
22
|
-
const { pathname } = this.#getPathInfo(href);
|
|
23
|
-
Logger.log(`push to:${
|
|
22
|
+
const { pathname, search, hash, href: fullHref } = this.#getPathInfo(href);
|
|
23
|
+
Logger.log(`push to:${fullHref}`);
|
|
24
24
|
if (baseClientEnv.side === "server")
|
|
25
|
-
void redirect(
|
|
25
|
+
void redirect(fullHref);
|
|
26
26
|
},
|
|
27
27
|
replace: (href) => {
|
|
28
|
-
const { pathname } = this.#getPathInfo(href);
|
|
28
|
+
const { pathname, search, hash, href: fullHref } = this.#getPathInfo(href);
|
|
29
29
|
Logger.log(`replace to:${pathname}`);
|
|
30
30
|
if (baseClientEnv.side === "server")
|
|
31
|
-
void redirect(
|
|
31
|
+
void redirect(fullHref);
|
|
32
32
|
},
|
|
33
33
|
back: () => {
|
|
34
34
|
throw new Error("back is only available in client");
|
|
@@ -146,9 +146,9 @@ class Router {
|
|
|
146
146
|
const headers = await nextHeaders.headers?.() ?? /* @__PURE__ */ new Map();
|
|
147
147
|
const lang = headers.get("x-locale") ?? this.#lang;
|
|
148
148
|
const basePath = headers.get("x-base-path");
|
|
149
|
-
const { pathname } = getPathInfo(href, lang, basePath ?? "");
|
|
149
|
+
const { pathname, search, href: fullHref, hash } = getPathInfo(href, lang, basePath ?? "");
|
|
150
150
|
Logger.log(`redirect to:${pathname}`);
|
|
151
|
-
redirect(
|
|
151
|
+
redirect(fullHref);
|
|
152
152
|
} else {
|
|
153
153
|
this.#instance.replace(href);
|
|
154
154
|
}
|
|
@@ -167,7 +167,7 @@ class Router {
|
|
|
167
167
|
if (baseClientEnv.side === "server")
|
|
168
168
|
throw new Error("setLang is only available in client side");
|
|
169
169
|
this.#checkInitialized();
|
|
170
|
-
const { path } = getPathInfo(window.location.pathname, this.#lang, this.#prefix);
|
|
170
|
+
const { path, search, hash, href: fullHref } = getPathInfo(window.location.pathname, this.#lang, this.#prefix);
|
|
171
171
|
this.#lang = lang;
|
|
172
172
|
this.#instance.replace(`/${lang}${path}`);
|
|
173
173
|
return void 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/client",
|
|
3
|
-
"version": "0.9.58-canary.
|
|
3
|
+
"version": "0.9.58-canary.1",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"clsx": "^2.1.1",
|
|
25
25
|
"js-cookie": "^3.0.5",
|
|
26
26
|
"jwt-decode": "^4.0.0",
|
|
27
|
-
"next": "
|
|
28
|
-
"react": "19.
|
|
27
|
+
"next": "16.0.3",
|
|
28
|
+
"react": "19.2.0",
|
|
29
29
|
"react-device-detect": "^2.2.3"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
package/src/csrTypes.d.ts
CHANGED
|
@@ -13,6 +13,30 @@ export interface CsrConfig {
|
|
|
13
13
|
bottomInset?: boolean | number;
|
|
14
14
|
gesture?: boolean;
|
|
15
15
|
cache?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @default "transparent"
|
|
18
|
+
* @description The color of the top safe area
|
|
19
|
+
* @example "red"
|
|
20
|
+
* @example "rgba(255, 255, 255, 0.5)"
|
|
21
|
+
* @example "transparent"
|
|
22
|
+
* @example "none"
|
|
23
|
+
* @example "inherit"
|
|
24
|
+
* @example "initial"
|
|
25
|
+
* @example "unset"
|
|
26
|
+
*/
|
|
27
|
+
topSafeAreaColor?: string;
|
|
28
|
+
/**
|
|
29
|
+
* @default "transparent"
|
|
30
|
+
* @description The color of the top safe area
|
|
31
|
+
* @example "red"
|
|
32
|
+
* @example "rgba(255, 255, 255, 0.5)"
|
|
33
|
+
* @example "transparent"
|
|
34
|
+
* @example "none"
|
|
35
|
+
* @example "inherit"
|
|
36
|
+
* @example "initial"
|
|
37
|
+
* @example "unset"
|
|
38
|
+
*/
|
|
39
|
+
bottomSafeAreaColor?: string;
|
|
16
40
|
}
|
|
17
41
|
export interface CsrState {
|
|
18
42
|
transition: TransitionType;
|
|
@@ -22,6 +46,8 @@ export interface CsrState {
|
|
|
22
46
|
bottomInset: number;
|
|
23
47
|
gesture: boolean;
|
|
24
48
|
cache: boolean;
|
|
49
|
+
topSafeAreaColor?: string;
|
|
50
|
+
bottomSafeAreaColor?: string;
|
|
25
51
|
}
|
|
26
52
|
export declare const DEFAULT_TOP_INSET = 48;
|
|
27
53
|
export declare const DEFAULT_BOTTOM_INSET = 60;
|
package/src/makePageProto.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AllDictionary } from "@akanjs/dictionary";
|
|
2
|
+
import { SerializedSignal } from "@akanjs/signal";
|
|
2
3
|
import { type ReactNode } from "react";
|
|
3
4
|
export interface TransMessageOption {
|
|
4
5
|
key?: string;
|
|
@@ -45,6 +46,6 @@ export declare const makePageProto: <DictKey extends string, ErrorKey extends st
|
|
|
45
46
|
sig: Sig;
|
|
46
47
|
registerClient: (lang?: string) => Promise<{
|
|
47
48
|
dictionary: AllDictionary;
|
|
48
|
-
signals:
|
|
49
|
+
signals: SerializedSignal[];
|
|
49
50
|
}>;
|
|
50
51
|
};
|
package/src/useClient.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type * as signal from "@akanjs/signal";
|
|
2
2
|
export declare const msg: {
|
|
3
|
-
info: (key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "
|
|
4
|
-
success: (key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "
|
|
5
|
-
error: (key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "
|
|
6
|
-
warning: (key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "
|
|
7
|
-
loading: (key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "
|
|
3
|
+
info: (key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "new" | "ok" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, option?: import("./makePageProto").TransMessageOption) => void;
|
|
4
|
+
success: (key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "new" | "ok" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, option?: import("./makePageProto").TransMessageOption) => void;
|
|
5
|
+
error: (key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "new" | "ok" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, option?: import("./makePageProto").TransMessageOption) => void;
|
|
6
|
+
warning: (key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "new" | "ok" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, option?: import("./makePageProto").TransMessageOption) => void;
|
|
7
|
+
loading: (key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "new" | "ok" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, option?: import("./makePageProto").TransMessageOption) => void;
|
|
8
8
|
}, Revert: {
|
|
9
9
|
new (key: never, data?: any): {
|
|
10
10
|
name: string;
|
|
@@ -17,13 +17,13 @@ export declare const msg: {
|
|
|
17
17
|
}, usePage: () => {
|
|
18
18
|
path: string;
|
|
19
19
|
l: {
|
|
20
|
-
(key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "
|
|
20
|
+
(key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "new" | "ok" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, param?: {
|
|
21
21
|
[key: string]: string | number;
|
|
22
22
|
} | undefined): string;
|
|
23
23
|
_(key: string, param?: {
|
|
24
24
|
[key: string]: string | number;
|
|
25
25
|
} | undefined): string;
|
|
26
|
-
rich(key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "
|
|
26
|
+
rich(key: import("@akanjs/dictionary").ServiceTranslatorKey<"base", signal.BaseEndpoint, "error" | "password" | "save" | "remove" | "new" | "ok" | "somethingWrong" | "connecting" | "connected" | "serverDisconnected" | "refreshing" | "tryReconnecting" | "serverHasProblem" | "checkServerStatus" | "success" | "failed" | "processing" | "processed" | "noData" | "invalidValueError" | "emailInvalidError" | "phoneInvalidError" | "cancel" | "unauthorized" | "confirmClose" | "textTooShortError" | "textTooLongError" | "selectTooShortError" | "selectTooLongError" | "numberTooSmallError" | "numberTooBigError" | "passwordNotMatchError" | "selectDateError" | "priceUnit" | "passwordConfirm" | "noOptions" | "addModel" | "createModel" | "createSuccess" | "updateModel" | "removeModel" | "updateSuccess" | "removeSuccess" | "sureToRemove" | "irreversibleOps" | "typeNameToRemove" | "yesRemove" | "removeMsg" | "confirmMsg" | "perPage" | "actions" | "edit" | "view">, param?: {
|
|
27
27
|
[key: string]: string | number;
|
|
28
28
|
} | undefined): import("react").ReactNode;
|
|
29
29
|
trans<Returns extends import("react").ReactNode>(translation: Record<(string & {}) | "en" | "ko", Returns>): Returns extends string ? string : Returns;
|