karin-plugin-mys-core 1.0.19 → 1.0.21

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ShowBindAccountCmdFunc
3
- } from "../chunk-I3VGZG6L.js";
4
- import "../chunk-S3ALDDWH.js";
3
+ } from "../chunk-SEKKAPRU.js";
4
+ import "../chunk-C2ZR7X67.js";
5
5
  import {
6
6
  UserInfo,
7
7
  fetchQRcode,
@@ -9,10 +9,10 @@ import {
9
9
  getTokenByGameToken,
10
10
  getUserFullInfo,
11
11
  queryQRcode
12
- } from "../chunk-JYQZZKAO.js";
12
+ } from "../chunk-32QZ2PSX.js";
13
13
  import "../chunk-5LRGHP36.js";
14
- import "../chunk-PX6NFB3F.js";
15
- import "../chunk-F7ZAG53H.js";
14
+ import "../chunk-HI6OZTI2.js";
15
+ import "../chunk-BLE3V6QR.js";
16
16
  import "../chunk-ER4WMJJ6.js";
17
17
  import {
18
18
  common_exports
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DeviceInfo,
3
3
  UserInfo
4
- } from "../chunk-JYQZZKAO.js";
4
+ } from "../chunk-32QZ2PSX.js";
5
5
  import "../chunk-5LRGHP36.js";
6
- import "../chunk-PX6NFB3F.js";
7
- import "../chunk-F7ZAG53H.js";
6
+ import "../chunk-HI6OZTI2.js";
7
+ import "../chunk-BLE3V6QR.js";
8
8
  import "../chunk-ER4WMJJ6.js";
9
9
  import "../chunk-RX4VMVAI.js";
10
10
  import "../chunk-SHLPPEAY.js";
@@ -5,12 +5,12 @@ import {
5
5
  ShowBindAccountCmdFunc,
6
6
  UnbindAccount,
7
7
  UnbindUID
8
- } from "../chunk-I3VGZG6L.js";
9
- import "../chunk-S3ALDDWH.js";
10
- import "../chunk-JYQZZKAO.js";
8
+ } from "../chunk-SEKKAPRU.js";
9
+ import "../chunk-C2ZR7X67.js";
10
+ import "../chunk-32QZ2PSX.js";
11
11
  import "../chunk-5LRGHP36.js";
12
- import "../chunk-PX6NFB3F.js";
13
- import "../chunk-F7ZAG53H.js";
12
+ import "../chunk-HI6OZTI2.js";
13
+ import "../chunk-BLE3V6QR.js";
14
14
  import "../chunk-ER4WMJJ6.js";
15
15
  import "../chunk-RX4VMVAI.js";
16
16
  import "../chunk-SHLPPEAY.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DeviceCfg
3
- } from "./chunk-PX6NFB3F.js";
3
+ } from "./chunk-HI6OZTI2.js";
4
4
  import {
5
5
  MysAccountInfoDB,
6
6
  MysDeviceInfoDB,
@@ -134,7 +134,7 @@ var Config = class {
134
134
  }
135
135
  getDef(path2) {
136
136
  const defConfig = JSON.parse(JSON.stringify(this.#DefaultConfig));
137
- return lodash2.get(defConfig, path2);
137
+ return path2 ? lodash2.get(defConfig, path2) : defConfig;
138
138
  }
139
139
  get(path2, isArray = false, def) {
140
140
  const conf = JSON.parse(JSON.stringify(this.#ConfigCache));
@@ -13,15 +13,15 @@ import { config } from "node-karin";
13
13
  import React from "react";
14
14
  var DefaultLayoutComponent = ({
15
15
  children,
16
- bg,
17
- width,
16
+ bgStyle,
18
17
  mysPlugin
19
18
  }) => {
20
19
  const karinVersion = config.pkg().version;
21
20
  return /* @__PURE__ */ React.createElement(
22
21
  "div",
23
22
  {
24
- className: `relative flex ${width} flex-col pb-10 font-hywh text-black ${bg}`,
23
+ className: "relative flex flex-col pb-10 font-hywh text-black",
24
+ style: bgStyle,
25
25
  id: "container"
26
26
  },
27
27
  children,
@@ -29,21 +29,18 @@ var DefaultLayoutComponent = ({
29
29
  "img",
30
30
  {
31
31
  src: `${mysPlugin.logoPath}`,
32
- alt: "Mys Plugin Logo",
33
32
  className: "h-6 w-6 rounde"
34
33
  }
35
34
  ), /* @__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(
36
35
  "img",
37
36
  {
38
37
  src: `${dir.pluginDir}/resources/image/mys-core-logo.webp`,
39
- alt: "MysCore Logo",
40
38
  className: "h-6 w-6 rounded-sm"
41
39
  }
42
40
  ), /* @__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(
43
41
  "img",
44
42
  {
45
43
  src: `${dir.pluginDir}/resources/image/frame-logo.webp`,
46
- alt: "Karin Logo",
47
44
  className: "h-6 w-6 rounded-sm"
48
45
  }
49
46
  ), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "IS DRIVEN BY"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-1.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, "Karin"), /* @__PURE__ */ React.createElement("strong", { className: "text-[10px] font-bold text-[#f2c06f]" }, "v", karinVersion)))))
@@ -51,7 +48,7 @@ var DefaultLayoutComponent = ({
51
48
  };
52
49
 
53
50
  // src/exports/render/render.ts
54
- import karin, { absPath, config as config2, existToMkdirSync, karinPathBase } from "node-karin";
51
+ import karin, { absPath, existToMkdirSync, karinPathBase } from "node-karin";
55
52
  import fs from "fs";
56
53
  import path from "path";
57
54
  import React2 from "react";
@@ -74,11 +71,6 @@ var ReactRender = class {
74
71
  }
75
72
  };
76
73
  }
77
- get karin() {
78
- return {
79
- version: config2.pkg().version
80
- };
81
- }
82
74
  async template(template, component, props, options = {}) {
83
75
  const element = React2.createElement(component, props);
84
76
  const appHtml = renderToString(element);
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  Config
3
- } from "./chunk-F7ZAG53H.js";
3
+ } from "./chunk-BLE3V6QR.js";
4
4
  import {
5
5
  dir
6
6
  } from "./chunk-SHLPPEAY.js";
7
7
 
8
8
  // src/core/config/config.ts
9
- var defaultConfig = {
9
+ var defaultCoreConfig = {
10
10
  proxy: {
11
11
  github: "https://gh-proxy.org",
12
12
  ["hoyolab" /* os */]: ""
13
13
  }
14
14
  };
15
15
  var defaultConfigDefine = {};
16
- var CoreCfg = new Config(`${dir.name}:config`, dir.ConfigDir, defaultConfig, defaultConfigDefine).watch();
16
+ var CoreCfg = new Config(`${dir.name}:config`, dir.ConfigDir, defaultCoreConfig, defaultConfigDefine).watch();
17
17
 
18
18
  // src/core/config/device.ts
19
19
  var DefaultDevice = {
@@ -2,11 +2,11 @@ import {
2
2
  DefaultLayoutComponent,
3
3
  React,
4
4
  ReactRender
5
- } from "./chunk-S3ALDDWH.js";
5
+ } from "./chunk-C2ZR7X67.js";
6
6
  import {
7
7
  MysGame,
8
8
  UserInfo
9
- } from "./chunk-JYQZZKAO.js";
9
+ } from "./chunk-32QZ2PSX.js";
10
10
  import {
11
11
  dir
12
12
  } from "./chunk-SHLPPEAY.js";
@@ -17,7 +17,7 @@ var ShowBindAccountComponent = ({
17
17
  AccountList
18
18
  }) => {
19
19
  const plugin = Render.plugin;
20
- return /* @__PURE__ */ React.createElement(DefaultLayoutComponent, { bg: "bg-[#f6f0e6]", width: "w-[600px]" }, /* @__PURE__ */ React.createElement("div", { className: "w-full px-[18px] pb-9 pt-5" }, /* @__PURE__ */ React.createElement(
20
+ return /* @__PURE__ */ React.createElement(DefaultLayoutComponent, { bgStyle: { backgroundColor: "#f6f0e6", width: 600 } }, /* @__PURE__ */ React.createElement("div", { className: "w-full px-[18px] pb-9 pt-5" }, /* @__PURE__ */ React.createElement(
21
21
  "div",
22
22
  {
23
23
  className: "absolute -top-2.5 right-0 z-[5] h-[72px] w-[150px] bg-contain bg-center bg-no-repeat opacity-50",
package/lib/core/index.js CHANGED
@@ -2,8 +2,8 @@ import "../chunk-5LRGHP36.js";
2
2
  import {
3
3
  CoreCfg,
4
4
  DeviceCfg
5
- } from "../chunk-PX6NFB3F.js";
6
- import "../chunk-F7ZAG53H.js";
5
+ } from "../chunk-HI6OZTI2.js";
6
+ import "../chunk-BLE3V6QR.js";
7
7
  import "../chunk-ER4WMJJ6.js";
8
8
  import "../chunk-RX4VMVAI.js";
9
9
  import "../chunk-SHLPPEAY.js";
@@ -1,6 +1,9 @@
1
- type PathImpl<T, Key extends keyof T> = Key extends string ? T[Key] extends Record<string, any> ? T[Key] extends ArrayLike<any> ? Key | `${Key}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>>}` : Key | `${Key}.${PathImpl<T[Key], keyof T[Key]>}` : Key : never;
1
+ type ToString<T> = T extends string | number ? `${T}` : never;
2
+ type PathImpl<T, Key extends keyof T> = Key extends string | number ? T[Key] extends Record<string, any> ? T[Key] extends ArrayLike<any> ? ToString<Key> | `${ToString<Key>}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>>}` : ToString<Key> | `${ToString<Key>}.${PathImpl<T[Key], keyof T[Key]>}` : ToString<Key> : never;
2
3
  type Path<T> = PathImpl<T, keyof T> | keyof T;
3
- type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? Rest extends Path<T[Key]> ? PathValue<T[Key], Rest> : never : never : P extends keyof T ? T[P] : never;
4
+ type PathValue<T, P> = P extends keyof T ? T[P] : P extends `${infer K}.${infer Rest}` ? K extends keyof T ? PathValue<T[K], Rest> : {
5
+ [Key in keyof T]: ToString<Key> extends K ? PathValue<T[Key], Rest> : never;
6
+ }[keyof T] : never;
4
7
  declare class Config<C extends {
5
8
  [key: string]: any;
6
9
  }> {
@@ -15,11 +18,13 @@ declare class Config<C extends {
15
18
  mergeWithDefaults(userConfig: C, defaultConfig: C, DefineConfig: Record<string, any>): C;
16
19
  /**
17
20
  * @description 获取配置路径对应的默认配置
21
+ * @param path 配置路径,支持任意深度的嵌套路径,传入空字符串''可获取整个配置对象
18
22
  */
19
23
  getDef(path: ''): C;
24
+ getDef<P extends Path<C>>(path: P): PathValue<C, P>;
20
25
  /**
21
26
  * @description 获取配置路径对应的配置
22
- * @param path 配置路径,支持任意深度的嵌套路径,返回值类型会根据路径自动推断
27
+ * @param path 配置路径,支持任意深度的嵌套路径,传入空字符串''可获取整个配置对象
23
28
  * @param isArray 是否返回 EnhancedArray 类型
24
29
  * @param def 默认值
25
30
  */
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Config,
3
3
  EnhancedArray
4
- } from "../../chunk-F7ZAG53H.js";
4
+ } from "../../chunk-BLE3V6QR.js";
5
5
  import "../../chunk-RX4VMVAI.js";
6
6
  import "../../chunk-MLKGABMK.js";
7
7
  export {
@@ -15,10 +15,10 @@ import {
15
15
  getUserFullInfo,
16
16
  getUserGameRolesByCookie,
17
17
  queryQRcode
18
- } from "../../chunk-JYQZZKAO.js";
18
+ } from "../../chunk-32QZ2PSX.js";
19
19
  import "../../chunk-5LRGHP36.js";
20
- import "../../chunk-PX6NFB3F.js";
21
- import "../../chunk-F7ZAG53H.js";
20
+ import "../../chunk-HI6OZTI2.js";
21
+ import "../../chunk-BLE3V6QR.js";
22
22
  import "../../chunk-ER4WMJJ6.js";
23
23
  import "../../chunk-RX4VMVAI.js";
24
24
  import "../../chunk-SHLPPEAY.js";
@@ -4,8 +4,10 @@ import { Options } from 'node-karin';
4
4
 
5
5
  interface DefaultLayoutProps {
6
6
  children: React.ReactNode;
7
- bg: string;
8
- width: string;
7
+ bgStyle: React.CSSProperties & {
8
+ backgroundColor: React.CSSProperties['backgroundColor'];
9
+ width: React.CSSProperties['width'];
10
+ };
9
11
  mysPlugin?: {
10
12
  name: string;
11
13
  version: string;
@@ -38,9 +40,6 @@ declare class ReactRender<P extends Record<string, any>, K extends string> {
38
40
  #private;
39
41
  constructor(cfg: RenderCfg, pluginOptions?: Omit<P, 'name' | 'version' | 'resources'>);
40
42
  get plugin(): Omit<P, 'name' | 'version' | 'resources'> & DefaultRenderPluginOptionsType;
41
- get karin(): {
42
- version: string;
43
- };
44
43
  template<C extends React.ComponentType<any>>(template: K, component: C, props: React.ComponentProps<C>, options?: {
45
44
  type?: 'png' | 'jpeg' | 'webp';
46
45
  plugin?: Record<string, any>;
@@ -2,7 +2,7 @@ import {
2
2
  DefaultLayoutComponent,
3
3
  React,
4
4
  ReactRender
5
- } from "../../chunk-S3ALDDWH.js";
5
+ } from "../../chunk-C2ZR7X67.js";
6
6
  import "../../chunk-RX4VMVAI.js";
7
7
  import "../../chunk-SHLPPEAY.js";
8
8
  import "../../chunk-MLKGABMK.js";
package/lib/web.config.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  CoreCfg,
3
3
  DeviceCfg
4
- } from "./chunk-PX6NFB3F.js";
5
- import "./chunk-F7ZAG53H.js";
4
+ } from "./chunk-HI6OZTI2.js";
5
+ import "./chunk-BLE3V6QR.js";
6
6
  import "./chunk-ER4WMJJ6.js";
7
7
  import "./chunk-RX4VMVAI.js";
8
8
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karin-plugin-mys-core",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "author": "babanbang",
5
5
  "type": "module",
6
6
  "description": "karin-plugin-mys-core",
@@ -665,10 +665,6 @@ video {
665
665
  width: 150px;
666
666
  }
667
667
 
668
- .w-\[600px\] {
669
- width: 600px;
670
- }
671
-
672
668
  .w-full {
673
669
  width: 100%;
674
670
  }
@@ -781,11 +777,6 @@ video {
781
777
  border-color: rgb(0 0 0 / 0.06);
782
778
  }
783
779
 
784
- .bg-\[\#f6f0e6\] {
785
- --tw-bg-opacity: 1;
786
- background-color: rgb(246 240 230 / var(--tw-bg-opacity, 1));
787
- }
788
-
789
780
  .bg-black\/\[0\.06\] {
790
781
  background-color: rgb(0 0 0 / 0.06);
791
782
  }