karin-plugin-mys-core 1.0.11 → 1.0.12
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/README.md +1 -1
- package/lib/apps/MiHoYoLogin.js +6 -38
- package/lib/apps/MysDevice.js +5 -37
- package/lib/apps/UIDManage.js +6 -38
- package/lib/{chunk-BBJ4U2IY.js → chunk-A5FZEOIN.js} +75 -4
- package/lib/{chunk-4BTKE3LO.js → chunk-HTL64YH2.js} +300 -178
- package/lib/chunk-IASM5MM5.js +639 -0
- package/lib/{chunk-5DXIT7UB.js → chunk-RX4VMVAI.js} +0 -5
- package/lib/{chunk-AFLOM3CG.js → chunk-SZHK7OGF.js} +6 -10
- package/lib/chunk-UIPRZFST.js +184 -0
- package/lib/exports/config/index.d.ts +56 -1
- package/lib/exports/config/index.js +3 -9
- package/lib/exports/database/index.d.ts +78 -12
- package/lib/exports/database/index.js +12 -40
- package/lib/exports/mys/index.d.ts +379 -14
- package/lib/exports/mys/index.js +9 -43
- package/lib/exports/render/index.d.ts +36 -3
- package/lib/exports/render/index.js +3 -8
- package/lib/exports/utils/index.d.ts +45 -2
- package/lib/exports/utils/index.js +1 -4
- package/lib/{exports/database/types/dbs/base.d.ts → mysUserInfo-BsyEENbc.d.ts} +60 -1
- package/package.json +1 -1
- package/resources/image/frame-logo.webp +0 -0
- package/resources/image/launcher-icon//345/216/237/347/245/236.webp +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/2173.webp +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.webp +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/345/233/240/347/274/230/347/262/276/347/201/265.webp +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/346/230/237/347/251/271/351/223/201/351/201/223.webp +0 -0
- package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.webp +0 -0
- package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.webp +0 -0
- package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.webp +0 -0
- package/resources/image/mys-core-logo.webp +0 -0
- package/resources/image/mys-logo.webp +0 -0
- package/lib/chunk-2BVJS5VE.js +0 -49
- package/lib/chunk-3ERB3ILC.js +0 -0
- package/lib/chunk-3JN5WYUN.js +0 -135
- package/lib/chunk-7KEG6SDX.js +0 -0
- package/lib/chunk-7VAWV6ZE.js +0 -0
- package/lib/chunk-ARLTXJFJ.js +0 -0
- package/lib/chunk-CFS2WFOO.js +0 -0
- package/lib/chunk-DMJ5OQR6.js +0 -73
- package/lib/chunk-EDNBKOMS.js +0 -30
- package/lib/chunk-FBWSEBAW.js +0 -0
- package/lib/chunk-FOAQZIZ2.js +0 -0
- package/lib/chunk-G5W5WAY5.js +0 -64
- package/lib/chunk-G7TMVDGP.js +0 -68
- package/lib/chunk-HJ6HX5HB.js +0 -29
- package/lib/chunk-I7XZONDN.js +0 -13
- package/lib/chunk-JRH4JC43.js +0 -0
- package/lib/chunk-JVJQKRJ4.js +0 -89
- package/lib/chunk-K5U2O3HH.js +0 -0
- package/lib/chunk-KQVWWGRH.js +0 -31
- package/lib/chunk-LBLGKL3W.js +0 -77
- package/lib/chunk-LJSDSOY6.js +0 -0
- package/lib/chunk-LYTNREAI.js +0 -0
- package/lib/chunk-MPZP23EX.js +0 -219
- package/lib/chunk-MWYDWDR4.js +0 -0
- package/lib/chunk-PMFOX5HA.js +0 -80
- package/lib/chunk-PYTECG57.js +0 -0
- package/lib/chunk-SEWEEPJN.js +0 -0
- package/lib/chunk-SHW6FHIB.js +0 -10
- package/lib/chunk-T7W4DXRM.js +0 -0
- package/lib/chunk-TTN7NFCA.js +0 -109
- package/lib/chunk-W4DBT7AD.js +0 -0
- package/lib/chunk-WCX7WZAQ.js +0 -0
- package/lib/chunk-Z5I6A73Y.js +0 -0
- package/lib/chunk-ZTOR2DXG.js +0 -38
- package/lib/common-BlI5Gsw_.d.ts +0 -35
- package/lib/define-B9r20dK6.d.ts +0 -130
- package/lib/exports/config/array.d.ts +0 -1
- package/lib/exports/config/array.js +0 -7
- package/lib/exports/config/config.d.ts +0 -56
- package/lib/exports/config/config.js +0 -12
- package/lib/exports/database/database.d.ts +0 -30
- package/lib/exports/database/database.js +0 -22
- package/lib/exports/database/dbs/base.d.ts +0 -25
- package/lib/exports/database/dbs/base.js +0 -19
- package/lib/exports/database/dbs/index.d.ts +0 -4
- package/lib/exports/database/dbs/index.js +0 -29
- package/lib/exports/database/dbs/sqlite3.d.ts +0 -27
- package/lib/exports/database/dbs/sqlite3.js +0 -23
- package/lib/exports/database/dbs/table.d.ts +0 -20
- package/lib/exports/database/dbs/table.js +0 -25
- package/lib/exports/database/tables/index.d.ts +0 -9
- package/lib/exports/database/tables/index.js +0 -40
- package/lib/exports/database/tables/mysAccountInfo.d.ts +0 -9
- package/lib/exports/database/tables/mysAccountInfo.js +0 -27
- package/lib/exports/database/tables/mysDeviceInfo.d.ts +0 -9
- package/lib/exports/database/tables/mysDeviceInfo.js +0 -27
- package/lib/exports/database/tables/mysUserInfo.d.ts +0 -9
- package/lib/exports/database/tables/mysUserInfo.js +0 -27
- package/lib/exports/database/types/database.d.ts +0 -6
- package/lib/exports/database/types/database.js +0 -1
- package/lib/exports/database/types/dbs/base.js +0 -11
- package/lib/exports/database/types/dbs/index.d.ts +0 -2
- package/lib/exports/database/types/dbs/index.js +0 -12
- package/lib/exports/database/types/index.d.ts +0 -6
- package/lib/exports/database/types/index.js +0 -24
- package/lib/exports/database/types/tables/index.d.ts +0 -5
- package/lib/exports/database/types/tables/index.js +0 -13
- package/lib/exports/database/types/tables/mysAccountInfo.d.ts +0 -14
- package/lib/exports/database/types/tables/mysAccountInfo.js +0 -7
- package/lib/exports/database/types/tables/mysDeviceInfo.d.ts +0 -19
- package/lib/exports/database/types/tables/mysDeviceInfo.js +0 -1
- package/lib/exports/database/types/tables/mysUserInfo.d.ts +0 -32
- package/lib/exports/database/types/tables/mysUserInfo.js +0 -7
- package/lib/exports/mys/api/apis.d.ts +0 -82
- package/lib/exports/mys/api/apis.js +0 -56
- package/lib/exports/mys/api/app.d.ts +0 -60
- package/lib/exports/mys/api/app.js +0 -32
- package/lib/exports/mys/api/define.d.ts +0 -6
- package/lib/exports/mys/api/define.js +0 -42
- package/lib/exports/mys/api/index.d.ts +0 -11
- package/lib/exports/mys/api/index.js +0 -63
- package/lib/exports/mys/types/api/define.d.ts +0 -6
- package/lib/exports/mys/types/api/define.js +0 -1
- package/lib/exports/mys/types/api/index.d.ts +0 -6
- package/lib/exports/mys/types/api/index.js +0 -2
- package/lib/exports/mys/types/index.d.ts +0 -12
- package/lib/exports/mys/types/index.js +0 -6
- package/lib/exports/mys/types/user/game.d.ts +0 -23
- package/lib/exports/mys/types/user/game.js +0 -1
- package/lib/exports/mys/types/user/index.d.ts +0 -12
- package/lib/exports/mys/types/user/index.js +0 -3
- package/lib/exports/mys/types/user/userInfo.d.ts +0 -43
- package/lib/exports/mys/types/user/userInfo.js +0 -1
- package/lib/exports/mys/user/deviceInfo.d.ts +0 -11
- package/lib/exports/mys/user/deviceInfo.js +0 -30
- package/lib/exports/mys/user/game.d.ts +0 -40
- package/lib/exports/mys/user/game.js +0 -9
- package/lib/exports/mys/user/index.d.ts +0 -14
- package/lib/exports/mys/user/index.js +0 -52
- package/lib/exports/mys/user/userInfo.d.ts +0 -53
- package/lib/exports/mys/user/userInfo.js +0 -44
- package/lib/exports/render/render.d.ts +0 -38
- package/lib/exports/render/render.js +0 -12
- package/lib/exports/utils/common.d.ts +0 -1
- package/lib/exports/utils/common.js +0 -15
- package/lib/exports/utils/types/common.d.ts +0 -11
- package/lib/exports/utils/types/common.js +0 -1
- package/lib/exports/utils/types/index.d.ts +0 -1
- package/lib/exports/utils/types/index.js +0 -2
- package/resources/image/frame-logo.png +0 -0
- package/resources/image/launcher-icon//345/216/237/347/245/236.png +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/2173.png +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.png +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/345/233/240/347/274/230/347/262/276/347/201/265.png +0 -0
- package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/346/230/237/347/251/271/351/223/201/351/201/223.png +0 -0
- package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.png +0 -0
- package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.png +0 -0
- package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.png +0 -0
- package/resources/image/mys-core-logo.png +0 -0
- package/resources/image/mys-logo.png +0 -0
package/README.md
CHANGED
|
@@ -878,7 +878,7 @@ const UserCard: React.FC<UserCardProps> = ({ username, level, avatar }) => {
|
|
|
878
878
|
<p>等级: {level}</p>
|
|
879
879
|
<p>主题: {plugin.theme}</p>
|
|
880
880
|
{/* 使用插件资源 */}
|
|
881
|
-
<img src={`${plugin.resources.default}/image/icon.
|
|
881
|
+
<img src={`${plugin.resources.default}/image/icon.webp`} />
|
|
882
882
|
</div>
|
|
883
883
|
)
|
|
884
884
|
}
|
package/lib/apps/MiHoYoLogin.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShowBindAccountCmdFunc
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-LBLGKL3W.js";
|
|
3
|
+
} from "../chunk-SZHK7OGF.js";
|
|
4
|
+
import "../chunk-A5FZEOIN.js";
|
|
6
5
|
import {
|
|
7
6
|
UserInfo,
|
|
8
7
|
fetchQRcode,
|
|
@@ -10,44 +9,13 @@ import {
|
|
|
10
9
|
getTokenByGameToken,
|
|
11
10
|
getUserFullInfo,
|
|
12
11
|
queryQRcode
|
|
13
|
-
} from "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-G5W5WAY5.js";
|
|
16
|
-
import "../chunk-7VAWV6ZE.js";
|
|
17
|
-
import "../chunk-LJSDSOY6.js";
|
|
18
|
-
import "../chunk-CFS2WFOO.js";
|
|
19
|
-
import "../chunk-MWYDWDR4.js";
|
|
20
|
-
import "../chunk-FOAQZIZ2.js";
|
|
21
|
-
import "../chunk-WCX7WZAQ.js";
|
|
22
|
-
import "../chunk-KQVWWGRH.js";
|
|
23
|
-
import "../chunk-3ERB3ILC.js";
|
|
24
|
-
import "../chunk-W4DBT7AD.js";
|
|
25
|
-
import "../chunk-Z5I6A73Y.js";
|
|
26
|
-
import "../chunk-EDNBKOMS.js";
|
|
27
|
-
import "../chunk-ZTOR2DXG.js";
|
|
28
|
-
import "../chunk-HJ6HX5HB.js";
|
|
29
|
-
import "../chunk-SEWEEPJN.js";
|
|
30
|
-
import "../chunk-G7TMVDGP.js";
|
|
31
|
-
import "../chunk-DMJ5OQR6.js";
|
|
32
|
-
import "../chunk-MPZP23EX.js";
|
|
33
|
-
import "../chunk-3JN5WYUN.js";
|
|
34
|
-
import "../chunk-7KEG6SDX.js";
|
|
35
|
-
import "../chunk-FBWSEBAW.js";
|
|
36
|
-
import "../chunk-JVJQKRJ4.js";
|
|
37
|
-
import "../chunk-LYTNREAI.js";
|
|
38
|
-
import "../chunk-SHW6FHIB.js";
|
|
39
|
-
import "../chunk-K5U2O3HH.js";
|
|
40
|
-
import "../chunk-I7XZONDN.js";
|
|
41
|
-
import "../chunk-JRH4JC43.js";
|
|
12
|
+
} from "../chunk-HTL64YH2.js";
|
|
13
|
+
import "../chunk-IASM5MM5.js";
|
|
42
14
|
import "../chunk-SHLPPEAY.js";
|
|
43
|
-
import "../chunk-
|
|
44
|
-
import "../chunk-ARLTXJFJ.js";
|
|
45
|
-
import "../chunk-PYTECG57.js";
|
|
46
|
-
import "../chunk-T7W4DXRM.js";
|
|
15
|
+
import "../chunk-UIPRZFST.js";
|
|
47
16
|
import {
|
|
48
17
|
common_exports
|
|
49
|
-
} from "../chunk-
|
|
50
|
-
import "../chunk-PMFOX5HA.js";
|
|
18
|
+
} from "../chunk-RX4VMVAI.js";
|
|
51
19
|
import "../chunk-MLKGABMK.js";
|
|
52
20
|
|
|
53
21
|
// src/apps/MiHoYoLogin.ts
|
package/lib/apps/MysDevice.js
CHANGED
|
@@ -1,43 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DeviceInfo,
|
|
2
3
|
UserInfo
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-G5W5WAY5.js";
|
|
6
|
-
import "../chunk-7VAWV6ZE.js";
|
|
7
|
-
import "../chunk-LJSDSOY6.js";
|
|
8
|
-
import "../chunk-CFS2WFOO.js";
|
|
9
|
-
import "../chunk-MWYDWDR4.js";
|
|
10
|
-
import "../chunk-FOAQZIZ2.js";
|
|
11
|
-
import "../chunk-WCX7WZAQ.js";
|
|
12
|
-
import {
|
|
13
|
-
DeviceInfo
|
|
14
|
-
} from "../chunk-KQVWWGRH.js";
|
|
15
|
-
import "../chunk-3ERB3ILC.js";
|
|
16
|
-
import "../chunk-W4DBT7AD.js";
|
|
17
|
-
import "../chunk-Z5I6A73Y.js";
|
|
18
|
-
import "../chunk-EDNBKOMS.js";
|
|
19
|
-
import "../chunk-ZTOR2DXG.js";
|
|
20
|
-
import "../chunk-HJ6HX5HB.js";
|
|
21
|
-
import "../chunk-SEWEEPJN.js";
|
|
22
|
-
import "../chunk-G7TMVDGP.js";
|
|
23
|
-
import "../chunk-DMJ5OQR6.js";
|
|
24
|
-
import "../chunk-MPZP23EX.js";
|
|
25
|
-
import "../chunk-3JN5WYUN.js";
|
|
26
|
-
import "../chunk-7KEG6SDX.js";
|
|
27
|
-
import "../chunk-FBWSEBAW.js";
|
|
28
|
-
import "../chunk-JVJQKRJ4.js";
|
|
29
|
-
import "../chunk-LYTNREAI.js";
|
|
30
|
-
import "../chunk-SHW6FHIB.js";
|
|
31
|
-
import "../chunk-K5U2O3HH.js";
|
|
32
|
-
import "../chunk-I7XZONDN.js";
|
|
33
|
-
import "../chunk-JRH4JC43.js";
|
|
4
|
+
} from "../chunk-HTL64YH2.js";
|
|
5
|
+
import "../chunk-IASM5MM5.js";
|
|
34
6
|
import "../chunk-SHLPPEAY.js";
|
|
35
|
-
import "../chunk-
|
|
36
|
-
import "../chunk-
|
|
37
|
-
import "../chunk-PYTECG57.js";
|
|
38
|
-
import "../chunk-T7W4DXRM.js";
|
|
39
|
-
import "../chunk-5DXIT7UB.js";
|
|
40
|
-
import "../chunk-PMFOX5HA.js";
|
|
7
|
+
import "../chunk-UIPRZFST.js";
|
|
8
|
+
import "../chunk-RX4VMVAI.js";
|
|
41
9
|
import "../chunk-MLKGABMK.js";
|
|
42
10
|
|
|
43
11
|
// src/apps/MysDevice.ts
|
package/lib/apps/UIDManage.js
CHANGED
|
@@ -4,45 +4,13 @@ import {
|
|
|
4
4
|
ShowBindAccountCmdFunc,
|
|
5
5
|
UnbindAccount,
|
|
6
6
|
UnbindUID
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-2BVJS5VE.js";
|
|
12
|
-
import "../chunk-G5W5WAY5.js";
|
|
13
|
-
import "../chunk-7VAWV6ZE.js";
|
|
14
|
-
import "../chunk-LJSDSOY6.js";
|
|
15
|
-
import "../chunk-CFS2WFOO.js";
|
|
16
|
-
import "../chunk-MWYDWDR4.js";
|
|
17
|
-
import "../chunk-FOAQZIZ2.js";
|
|
18
|
-
import "../chunk-WCX7WZAQ.js";
|
|
19
|
-
import "../chunk-KQVWWGRH.js";
|
|
20
|
-
import "../chunk-3ERB3ILC.js";
|
|
21
|
-
import "../chunk-W4DBT7AD.js";
|
|
22
|
-
import "../chunk-Z5I6A73Y.js";
|
|
23
|
-
import "../chunk-EDNBKOMS.js";
|
|
24
|
-
import "../chunk-ZTOR2DXG.js";
|
|
25
|
-
import "../chunk-HJ6HX5HB.js";
|
|
26
|
-
import "../chunk-SEWEEPJN.js";
|
|
27
|
-
import "../chunk-G7TMVDGP.js";
|
|
28
|
-
import "../chunk-DMJ5OQR6.js";
|
|
29
|
-
import "../chunk-MPZP23EX.js";
|
|
30
|
-
import "../chunk-3JN5WYUN.js";
|
|
31
|
-
import "../chunk-7KEG6SDX.js";
|
|
32
|
-
import "../chunk-FBWSEBAW.js";
|
|
33
|
-
import "../chunk-JVJQKRJ4.js";
|
|
34
|
-
import "../chunk-LYTNREAI.js";
|
|
35
|
-
import "../chunk-SHW6FHIB.js";
|
|
36
|
-
import "../chunk-K5U2O3HH.js";
|
|
37
|
-
import "../chunk-I7XZONDN.js";
|
|
38
|
-
import "../chunk-JRH4JC43.js";
|
|
7
|
+
} from "../chunk-SZHK7OGF.js";
|
|
8
|
+
import "../chunk-A5FZEOIN.js";
|
|
9
|
+
import "../chunk-HTL64YH2.js";
|
|
10
|
+
import "../chunk-IASM5MM5.js";
|
|
39
11
|
import "../chunk-SHLPPEAY.js";
|
|
40
|
-
import "../chunk-
|
|
41
|
-
import "../chunk-
|
|
42
|
-
import "../chunk-PYTECG57.js";
|
|
43
|
-
import "../chunk-T7W4DXRM.js";
|
|
44
|
-
import "../chunk-5DXIT7UB.js";
|
|
45
|
-
import "../chunk-PMFOX5HA.js";
|
|
12
|
+
import "../chunk-UIPRZFST.js";
|
|
13
|
+
import "../chunk-RX4VMVAI.js";
|
|
46
14
|
import "../chunk-MLKGABMK.js";
|
|
47
15
|
export {
|
|
48
16
|
BindUID,
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
dir
|
|
3
3
|
} from "./chunk-SHLPPEAY.js";
|
|
4
|
+
import {
|
|
5
|
+
common_exports
|
|
6
|
+
} from "./chunk-RX4VMVAI.js";
|
|
4
7
|
|
|
5
8
|
// src/exports/render/index.ts
|
|
6
|
-
import
|
|
9
|
+
import React3 from "react";
|
|
7
10
|
|
|
8
11
|
// src/exports/render/layout/DefaultLayout.tsx
|
|
9
12
|
import { config } from "node-karin";
|
|
@@ -32,14 +35,14 @@ var DefaultLayoutComponent = ({
|
|
|
32
35
|
), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "KARIN-MYS-PLUGIN"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-0.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, mysPlugin.name), /* @__PURE__ */ React.createElement("strong", { className: "text-xs font-bold text-[#f2c06f]" }, "v", mysPlugin.version)))), /* @__PURE__ */ React.createElement("div", { className: "h-8 w-px bg-gray-600" })), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
|
|
33
36
|
"img",
|
|
34
37
|
{
|
|
35
|
-
src: `${dir.pluginDir}/resources/image/mys-core-logo.
|
|
38
|
+
src: `${dir.pluginDir}/resources/image/mys-core-logo.webp`,
|
|
36
39
|
alt: "MysCore Logo",
|
|
37
40
|
className: "h-6 w-6 rounded-sm"
|
|
38
41
|
}
|
|
39
42
|
), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "KARIN-PLUGIN"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-0.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, "MysCore"), /* @__PURE__ */ React.createElement("strong", { className: "text-xs font-bold text-[#f2c06f]" }, "v", dir.version)))), /* @__PURE__ */ React.createElement("div", { className: "h-8 w-px bg-gray-600" }), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
|
|
40
43
|
"img",
|
|
41
44
|
{
|
|
42
|
-
src: `${dir.pluginDir}/resources/image/frame-logo.
|
|
45
|
+
src: `${dir.pluginDir}/resources/image/frame-logo.webp`,
|
|
43
46
|
alt: "Karin Logo",
|
|
44
47
|
className: "h-6 w-6 rounded-sm"
|
|
45
48
|
}
|
|
@@ -47,7 +50,75 @@ var DefaultLayoutComponent = ({
|
|
|
47
50
|
);
|
|
48
51
|
};
|
|
49
52
|
|
|
53
|
+
// src/exports/render/render.ts
|
|
54
|
+
import karin, { absPath, config as config2, existToMkdirSync, karinPathBase } from "node-karin";
|
|
55
|
+
import fs from "fs";
|
|
56
|
+
import path from "path";
|
|
57
|
+
import React2 from "react";
|
|
58
|
+
import { renderToString } from "react-dom/server";
|
|
59
|
+
var ReactRender = class {
|
|
60
|
+
#renderCfg;
|
|
61
|
+
#pluginOptions;
|
|
62
|
+
constructor(cfg, pluginOptions = {}) {
|
|
63
|
+
this.#renderCfg = cfg;
|
|
64
|
+
this.#pluginOptions = pluginOptions;
|
|
65
|
+
}
|
|
66
|
+
get plugin() {
|
|
67
|
+
return {
|
|
68
|
+
...this.#pluginOptions,
|
|
69
|
+
name: this.#renderCfg.name,
|
|
70
|
+
version: this.#renderCfg.version,
|
|
71
|
+
resources: {
|
|
72
|
+
default: absPath(path.join(this.#renderCfg.pluginDir, "resources")),
|
|
73
|
+
download: absPath(this.#renderCfg.ResourcesDir)
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
get karin() {
|
|
78
|
+
return {
|
|
79
|
+
version: config2.pkg().version
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async template(template, component, props, options = {}) {
|
|
83
|
+
const element = React2.createElement(component, props);
|
|
84
|
+
const appHtml = renderToString(element);
|
|
85
|
+
const coreCssPath = absPath(path.join(dir.pluginDir, "resources", "styles", `${dir.name}.css`));
|
|
86
|
+
const cssPath = this.#renderCfg.name !== dir.name ? absPath(path.join(this.plugin.resources.default, "styles", `${this.#renderCfg.name}.css`)) : "";
|
|
87
|
+
const Html = `
|
|
88
|
+
<!DOCTYPE html>
|
|
89
|
+
<html lang="zh-CN">
|
|
90
|
+
<head>
|
|
91
|
+
<meta charset="UTF-8">
|
|
92
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
93
|
+
<link rel="stylesheet" href="${coreCssPath}">
|
|
94
|
+
<link rel="stylesheet" href="${cssPath}">
|
|
95
|
+
</head>
|
|
96
|
+
<body>
|
|
97
|
+
${appHtml}
|
|
98
|
+
</body>
|
|
99
|
+
</html>
|
|
100
|
+
`;
|
|
101
|
+
const saveDir = path.join(karinPathBase, "temp", "html", this.#renderCfg.name, template);
|
|
102
|
+
existToMkdirSync(saveDir);
|
|
103
|
+
const savePath = path.join(saveDir, `${options.render?.name || template}-${common_exports.randomString(8, "Lower")}.html`);
|
|
104
|
+
fs.writeFileSync(savePath, Html, "utf-8");
|
|
105
|
+
const image = await karin.render({
|
|
106
|
+
type: options.type || "jpeg",
|
|
107
|
+
omitBackground: options.type === "png",
|
|
108
|
+
selector: "container",
|
|
109
|
+
setViewport: {
|
|
110
|
+
deviceScaleFactor: 3
|
|
111
|
+
},
|
|
112
|
+
...options.render || {},
|
|
113
|
+
file: absPath(savePath)
|
|
114
|
+
});
|
|
115
|
+
if (!image) return null;
|
|
116
|
+
return "base64://" + image;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
50
120
|
export {
|
|
51
121
|
DefaultLayoutComponent,
|
|
52
|
-
|
|
122
|
+
ReactRender,
|
|
123
|
+
React3 as React
|
|
53
124
|
};
|