@pisell/core 1.0.61 → 1.0.63
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/es/app/app.d.ts +2 -0
- package/es/app/app.js +4 -0
- package/es/communicationManager/index.d.ts +59 -0
- package/es/communicationManager/index.js +174 -0
- package/es/history/index.d.ts +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/indexDB/index.d.ts +46 -1
- package/es/indexDB/index.js +715 -335
- package/es/locales/index.js +9 -6
- package/es/locales/ja.d.ts +3 -0
- package/es/locales/ja.js +5 -0
- package/es/locales/pt.d.ts +3 -0
- package/es/locales/pt.js +5 -0
- package/es/routes/index.d.ts +2 -2
- package/es/tasks/index.d.ts +1 -1
- package/lib/app/app.d.ts +2 -0
- package/lib/app/app.js +4 -0
- package/lib/communicationManager/index.d.ts +59 -0
- package/lib/communicationManager/index.js +102 -0
- package/lib/history/index.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/indexDB/index.d.ts +46 -1
- package/lib/indexDB/index.js +226 -0
- package/lib/locales/index.js +9 -6
- package/lib/locales/ja.d.ts +3 -0
- package/lib/locales/ja.js +29 -0
- package/lib/locales/pt.d.ts +3 -0
- package/lib/locales/pt.js +29 -0
- package/lib/routes/index.d.ts +2 -2
- package/lib/tasks/index.d.ts +1 -1
- package/package.json +1 -1
package/lib/locales/index.js
CHANGED
|
@@ -37,20 +37,22 @@ var import_utils = require("@pisell/utils");
|
|
|
37
37
|
var import_en = __toESM(require("./en"));
|
|
38
38
|
var import_zh_CN = __toESM(require("./zh-CN"));
|
|
39
39
|
var import_zh_HK = __toESM(require("./zh-HK"));
|
|
40
|
+
var import_ja = __toESM(require("./ja"));
|
|
41
|
+
var import_pt = __toESM(require("./pt"));
|
|
40
42
|
var import_original = __toESM(require("./original"));
|
|
41
43
|
var Locales = class {
|
|
42
44
|
app;
|
|
43
45
|
// 当前语言 本地语言 > 英文语言包
|
|
44
46
|
locale = import_en.default.locale;
|
|
45
47
|
// 语言包
|
|
46
|
-
library = [import_original.default, import_en.default, import_zh_CN.default, import_zh_HK.default].reduce((pre, cur) => {
|
|
48
|
+
library = [import_original.default, import_en.default, import_zh_CN.default, import_zh_HK.default, import_ja.default, import_pt.default].reduce((pre, cur) => {
|
|
47
49
|
pre[cur.locale] = cur;
|
|
48
50
|
return pre;
|
|
49
51
|
}, {});
|
|
50
52
|
constructor(app, options) {
|
|
51
53
|
this.app = app;
|
|
52
54
|
this.locale = (options == null ? void 0 : options.locale) || this.app.storage.getStorage("locale") || import_en.default.locale;
|
|
53
|
-
this.library = (options == null ? void 0 : options.library) || [import_original.default, import_en.default, import_zh_CN.default, import_zh_HK.default].reduce((pre, cur) => {
|
|
55
|
+
this.library = (options == null ? void 0 : options.library) || [import_original.default, import_en.default, import_zh_CN.default, import_zh_HK.default, import_ja.default, import_pt.default].reduce((pre, cur) => {
|
|
54
56
|
pre[cur.locale] = cur;
|
|
55
57
|
return pre;
|
|
56
58
|
}, {});
|
|
@@ -59,7 +61,8 @@ var Locales = class {
|
|
|
59
61
|
return this.locale;
|
|
60
62
|
};
|
|
61
63
|
getCurrentTexts = (locale) => {
|
|
62
|
-
|
|
64
|
+
var _a, _b;
|
|
65
|
+
return ((_a = this.library[locale || this.locale]) == null ? void 0 : _a.translations) || ((_b = this.library.en) == null ? void 0 : _b.translations) || {};
|
|
63
66
|
};
|
|
64
67
|
setLocale = (locale, reload = false) => {
|
|
65
68
|
this.locale = locale;
|
|
@@ -69,8 +72,8 @@ var Locales = class {
|
|
|
69
72
|
}
|
|
70
73
|
};
|
|
71
74
|
getText = (id, locale) => {
|
|
72
|
-
var _a;
|
|
73
|
-
return ((_a = this.getCurrentTexts(locale)) == null ? void 0 : _a[id]) || id;
|
|
75
|
+
var _a, _b;
|
|
76
|
+
return ((_a = this.getCurrentTexts(locale)) == null ? void 0 : _a[id]) || ((_b = this.getCurrentTexts("en")) == null ? void 0 : _b[id]) || id;
|
|
74
77
|
};
|
|
75
78
|
isCN = () => {
|
|
76
79
|
let locale = this.getLocale();
|
|
@@ -130,7 +133,7 @@ var Locales = class {
|
|
|
130
133
|
if (typeof text === "string") {
|
|
131
134
|
return text;
|
|
132
135
|
}
|
|
133
|
-
return text[primary] || text["original"] || text["en"] || text["zh-CN"] || text["zh-HK"];
|
|
136
|
+
return text[primary] || text["original"] || text["en"] || text["zh-CN"] || text["zh-HK"] || text["ja"] || text["pt"];
|
|
134
137
|
};
|
|
135
138
|
getLibraryByData = (data) => {
|
|
136
139
|
return data.reduce((pre, next) => {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/locales/ja.ts
|
|
20
|
+
var ja_exports = {};
|
|
21
|
+
__export(ja_exports, {
|
|
22
|
+
default: () => ja_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ja_exports);
|
|
25
|
+
var ja_default = {
|
|
26
|
+
"locale": "ja",
|
|
27
|
+
"name": "japanese",
|
|
28
|
+
"translations": {}
|
|
29
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/locales/pt.ts
|
|
20
|
+
var pt_exports = {};
|
|
21
|
+
__export(pt_exports, {
|
|
22
|
+
default: () => pt_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(pt_exports);
|
|
25
|
+
var pt_default = {
|
|
26
|
+
"locale": "pt",
|
|
27
|
+
"name": "portuguese",
|
|
28
|
+
"translations": {}
|
|
29
|
+
};
|
package/lib/routes/index.d.ts
CHANGED
|
@@ -20,9 +20,9 @@ export declare class RouterManager {
|
|
|
20
20
|
get(name: string): RouteType;
|
|
21
21
|
has(name: string): boolean;
|
|
22
22
|
remove(name: string): void;
|
|
23
|
-
renderComponent(item: RouteType, children?: React.ReactNode): string | number | boolean | React.
|
|
23
|
+
renderComponent(item: RouteType, children?: React.ReactNode): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined;
|
|
24
24
|
getPageByRoute(route: string): ApplicationInterface | undefined;
|
|
25
25
|
getRouterComponent({ fallback }: {
|
|
26
26
|
fallback?: React.ReactNode;
|
|
27
|
-
}): JSX.Element[];
|
|
27
|
+
}): React.JSX.Element[];
|
|
28
28
|
}
|
package/lib/tasks/index.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ export declare class TasksManager {
|
|
|
108
108
|
*/
|
|
109
109
|
getQueueStatus(module: string, queueId: string): {
|
|
110
110
|
isRunning: boolean;
|
|
111
|
-
status: "
|
|
111
|
+
status: "completed" | "uncompleted";
|
|
112
112
|
progress: {
|
|
113
113
|
total: number;
|
|
114
114
|
completed: number;
|