@e7w/easy-model 0.1.5 → 0.1.7
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 +6 -9
- package/dist/index.d.ts +43 -0
- package/dist/index.es.js +316 -280
- package/dist/index.umd.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -388,11 +388,13 @@ class UserModel {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
+
const User = provide(UserModel);
|
|
392
|
+
|
|
391
393
|
class TeamModel {
|
|
392
394
|
members: UserModel[] = [];
|
|
393
395
|
|
|
394
396
|
addMember(userId: string) {
|
|
395
|
-
const user =
|
|
397
|
+
const user = User(userId);
|
|
396
398
|
this.members.push(user);
|
|
397
399
|
}
|
|
398
400
|
|
|
@@ -408,14 +410,14 @@ function TeamManagement() {
|
|
|
408
410
|
<div>
|
|
409
411
|
<h2>团队成员</h2>
|
|
410
412
|
{team.members.map(member => (
|
|
411
|
-
<UserCard key={member.id}
|
|
413
|
+
<UserCard key={member.id} id={member.id} />
|
|
412
414
|
))}
|
|
413
415
|
</div>
|
|
414
416
|
);
|
|
415
417
|
}
|
|
416
418
|
|
|
417
|
-
function UserCard({
|
|
418
|
-
const observedUser =
|
|
419
|
+
function UserCard({ id }: { id: UserModel["id"] }) {
|
|
420
|
+
const observedUser = useModel(User, [id]);
|
|
419
421
|
|
|
420
422
|
return (
|
|
421
423
|
<div>
|
|
@@ -432,16 +434,12 @@ function UserCard({ user }: { user: UserModel }) {
|
|
|
432
434
|
function App() {
|
|
433
435
|
return (
|
|
434
436
|
<div>
|
|
435
|
-
{/* 开发环境配置 */}
|
|
436
437
|
<Container namespace="dev">
|
|
437
438
|
<VInjection schema={configSchema} val={devConfig} />
|
|
438
|
-
<DevTools />
|
|
439
439
|
</Container>
|
|
440
440
|
|
|
441
|
-
{/* 生产环境配置 */}
|
|
442
441
|
<Container namespace="prod">
|
|
443
442
|
<VInjection schema={configSchema} val={prodConfig} />
|
|
444
|
-
<MainApp />
|
|
445
443
|
</Container>
|
|
446
444
|
</div>
|
|
447
445
|
);
|
|
@@ -453,7 +451,6 @@ function App() {
|
|
|
453
451
|
### 1. 模型设计
|
|
454
452
|
|
|
455
453
|
- **单一职责**: 每个模型类应该只负责一个特定的业务领域
|
|
456
|
-
- **不可变更新**: 尽量使用不可变的方式更新状态
|
|
457
454
|
- **类型安全**: 充分利用 TypeScript 的类型系统
|
|
458
455
|
|
|
459
456
|
```tsx
|
package/dist/index.d.ts
CHANGED
|
@@ -31,17 +31,60 @@ declare class MLoader {
|
|
|
31
31
|
get isGlobalLoading(): boolean;
|
|
32
32
|
}
|
|
33
33
|
export declare const loader: MLoader;
|
|
34
|
+
export declare const useLoader: () => {
|
|
35
|
+
isGlobalLoading: boolean;
|
|
36
|
+
isLoading: <T extends AsyncFn>(target: T) => boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* IoC 容器组件,提供依赖注入的上下文环境
|
|
40
|
+
*
|
|
41
|
+
* @param namespace - 命名空间,用于隔离不同的依赖注入环境
|
|
42
|
+
* @param children - 子组件
|
|
43
|
+
*/
|
|
34
44
|
export declare const Container: FC<PropsWithChildren<{
|
|
35
45
|
namespace?: string;
|
|
36
46
|
}>>;
|
|
47
|
+
/**
|
|
48
|
+
* 构造函数注入组件,将构造函数注入到容器中
|
|
49
|
+
*
|
|
50
|
+
* @param schema - Zod schema,用于类型验证和作为依赖标识
|
|
51
|
+
* @param ctor - 要注入的构造函数
|
|
52
|
+
*/
|
|
37
53
|
export declare function CInjection<T extends ZodType, P extends new () => ReturnType<T["parse"]>>({ schema, ctor }: {
|
|
38
54
|
schema: T;
|
|
39
55
|
ctor: P;
|
|
40
56
|
}): ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* 值注入组件,将值注入到容器中
|
|
59
|
+
*
|
|
60
|
+
* @param schema - Zod schema,用于类型验证和作为依赖标识
|
|
61
|
+
* @param val - 要注入的值
|
|
62
|
+
*/
|
|
41
63
|
export declare function VInjection<T extends ZodType>({ schema, val, }: {
|
|
42
64
|
schema: T;
|
|
43
65
|
val: ReturnType<T["parse"]>;
|
|
44
66
|
}): ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* 依赖注入装饰器,从容器中获取实例或值
|
|
69
|
+
*
|
|
70
|
+
* @param schema - Zod schema,用于类型验证和作为依赖标识
|
|
71
|
+
* @param namespace - 命名空间,默认为空字符串
|
|
72
|
+
* @returns 装饰器函数
|
|
73
|
+
*/
|
|
45
74
|
export declare function inject<T extends ZodType>(schema: T, namespace?: string): (_: unknown, { static: isStatic, kind }: ClassFieldDecoratorContext) => <P extends ReturnType<T["parse"]> | undefined>(initVal: P) => P;
|
|
75
|
+
/**
|
|
76
|
+
* 清理指定命名空间的所有依赖
|
|
77
|
+
*
|
|
78
|
+
* @param namespace - 要清理的命名空间
|
|
79
|
+
*/
|
|
80
|
+
export declare function clearNamespace(namespace: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* 检查指定的 schema 是否已在命名空间中注册
|
|
83
|
+
*
|
|
84
|
+
* @param schema - 要检查的 schema
|
|
85
|
+
* @param namespace - 命名空间
|
|
86
|
+
* @returns 是否已注册
|
|
87
|
+
*/
|
|
88
|
+
export declare function isRegistered<T extends ZodType>(schema: T, namespace?: string): boolean;
|
|
46
89
|
|
|
47
90
|
export {};
|
package/dist/index.es.js
CHANGED
|
@@ -1,170 +1,170 @@
|
|
|
1
1
|
var Te = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
let
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
if (
|
|
10
|
-
if (
|
|
11
|
-
const r = {}, n = {},
|
|
12
|
-
get(
|
|
13
|
-
if (o ===
|
|
14
|
-
let s = ue(
|
|
15
|
-
return s || (s = Reflect.get(
|
|
2
|
+
var Pe = (e, r, n) => r in e ? Te(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
|
|
3
|
+
var g = (e, r, n) => Pe(e, typeof r != "symbol" ? r + "" : r, n);
|
|
4
|
+
import Oe, { useReducer as Se, useEffect as je, createContext as xe, useContext as ae } from "react";
|
|
5
|
+
const G = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), ce = Symbol("origin");
|
|
6
|
+
let v = null;
|
|
7
|
+
const U = ["includes", "indexOf", "lastIndexOf"], Ae = [Promise, RegExp, Date, WeakMap, WeakSet, Map, Set];
|
|
8
|
+
function C(e) {
|
|
9
|
+
if (e = _(e), !e || Ae.some((i) => e instanceof i)) return e;
|
|
10
|
+
if (G.has(e)) return G.get(e);
|
|
11
|
+
const r = {}, n = {}, a = new Proxy(e, {
|
|
12
|
+
get(i, o, c) {
|
|
13
|
+
if (o === ce) return i;
|
|
14
|
+
let s = ue(i, o);
|
|
15
|
+
return s || (s = Reflect.get(i, o, c), typeof s == "function" ? (n[o] || (n[o] = s.bind(C(i))), s = n[o]) : typeof s == "object" && s !== null && (r[o] || (r[o] = q(s, re(e, o))), s = C(s)), s);
|
|
16
16
|
},
|
|
17
|
-
set(
|
|
18
|
-
let f = Reflect.get(
|
|
17
|
+
set(i, o, c, s) {
|
|
18
|
+
let f = Reflect.get(i, o, s);
|
|
19
19
|
if (f = _(f), c = _(c), f === c) return !0;
|
|
20
|
-
const l = Reflect.set(
|
|
20
|
+
const l = Reflect.set(i, o, c, s);
|
|
21
21
|
if (l) {
|
|
22
|
-
r[o] && (r[o](), delete r[o]), typeof c == "object" && c !== null && (r[o] = q(c, re(
|
|
23
|
-
const
|
|
24
|
-
|
|
22
|
+
r[o] && (r[o](), delete r[o]), typeof c == "object" && c !== null && (r[o] = q(c, re(e, o))), n[o] && delete n[o];
|
|
23
|
+
const b = v;
|
|
24
|
+
v = /* @__PURE__ */ new WeakSet(), J(i, [o], f, c), v = b;
|
|
25
25
|
}
|
|
26
26
|
return l;
|
|
27
27
|
},
|
|
28
|
-
deleteProperty(
|
|
29
|
-
let c = Reflect.get(
|
|
28
|
+
deleteProperty(i, o) {
|
|
29
|
+
let c = Reflect.get(i, o);
|
|
30
30
|
c = _(c);
|
|
31
|
-
const s = Reflect.deleteProperty(
|
|
32
|
-
return s && (r[o] && (r[o](), delete r[o]), n[o] && delete n[o], J(
|
|
31
|
+
const s = Reflect.deleteProperty(i, o);
|
|
32
|
+
return s && (r[o] && (r[o](), delete r[o]), n[o] && delete n[o], J(i, [o], c, void 0)), s;
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
return
|
|
35
|
+
return G.set(e, a), a;
|
|
36
36
|
}
|
|
37
|
-
function q(
|
|
38
|
-
|
|
39
|
-
const n =
|
|
40
|
-
return n.set(
|
|
41
|
-
n.delete(
|
|
37
|
+
function q(e, r) {
|
|
38
|
+
e = _(e), L.has(e) || L.set(e, /* @__PURE__ */ new Map());
|
|
39
|
+
const n = L.get(e), a = Symbol();
|
|
40
|
+
return n.set(a, r), function() {
|
|
41
|
+
n.delete(a);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function re(
|
|
44
|
+
function re(e, r) {
|
|
45
45
|
return function(...n) {
|
|
46
|
-
const [
|
|
47
|
-
J(
|
|
46
|
+
const [a, ...i] = n;
|
|
47
|
+
J(e, [r, ...a], ...i);
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
function J(
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
const n =
|
|
50
|
+
function J(e, ...r) {
|
|
51
|
+
if (e = _(e), v != null && v.has(e)) return;
|
|
52
|
+
v == null || v.add(e);
|
|
53
|
+
const n = L.get(e);
|
|
54
54
|
if (!n) return;
|
|
55
|
-
[...n.values()].forEach((
|
|
55
|
+
[...n.values()].forEach((i) => {
|
|
56
56
|
const o = new EventTarget(), c = new Event("__trigger__");
|
|
57
57
|
o.addEventListener(c.type, s), o.dispatchEvent(c);
|
|
58
58
|
function s() {
|
|
59
|
-
o.removeEventListener(c.type, s),
|
|
59
|
+
o.removeEventListener(c.type, s), i(...r);
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
function _(
|
|
64
|
-
return typeof
|
|
63
|
+
function _(e) {
|
|
64
|
+
return typeof e != "object" || e === null ? e : e[ce] ?? e;
|
|
65
65
|
}
|
|
66
|
-
function ue(
|
|
67
|
-
if (
|
|
68
|
-
return Reflect.get(
|
|
66
|
+
function ue(e, r) {
|
|
67
|
+
if (e = _(e), ["constructor", "__proto__"].includes(r))
|
|
68
|
+
return Reflect.get(e, r);
|
|
69
69
|
if (r === "hasOwnProperty")
|
|
70
70
|
return function(n) {
|
|
71
71
|
return Object.prototype.hasOwnProperty.call(_(this), n);
|
|
72
72
|
};
|
|
73
|
-
if (Array.isArray(
|
|
73
|
+
if (Array.isArray(e) && U.includes(r))
|
|
74
74
|
return function(...n) {
|
|
75
|
-
const
|
|
76
|
-
return
|
|
75
|
+
const a = U[r].apply(_(this), n);
|
|
76
|
+
return a === -1 || a === !1 ? U[r].apply(_(this), n.map(_)) : a;
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
const
|
|
80
|
-
function W(
|
|
81
|
-
if (ne.has(
|
|
82
|
-
return
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
79
|
+
const T = Symbol("instance"), M = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new WeakSet(), z = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap();
|
|
80
|
+
function W(e) {
|
|
81
|
+
if (ne.has(e))
|
|
82
|
+
return e;
|
|
83
|
+
if (M.has(e))
|
|
84
|
+
return M.get(e);
|
|
85
85
|
const r = {};
|
|
86
86
|
o.prototype = new Proxy(
|
|
87
87
|
{
|
|
88
|
-
constructor:
|
|
89
|
-
__proto__:
|
|
88
|
+
constructor: e,
|
|
89
|
+
__proto__: e.prototype
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
get(c, s, f) {
|
|
93
93
|
let l = ue(c, s);
|
|
94
|
-
return l || (l = Reflect.get(c, s, f), typeof s == "symbol" || ["constructor", "__proto__"].includes(s) || typeof l != "function") ? l : (r[s] || (r[s] = function(...
|
|
95
|
-
return l.apply(
|
|
94
|
+
return l || (l = Reflect.get(c, s, f), typeof s == "symbol" || ["constructor", "__proto__"].includes(s) || typeof l != "function") ? l : (r[s] || (r[s] = function(...b) {
|
|
95
|
+
return l.apply(C(this), b);
|
|
96
96
|
}), r[s]);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
|
-
const n = /* @__PURE__ */ new Map(),
|
|
100
|
+
const n = /* @__PURE__ */ new Map(), a = new FinalizationRegistry(
|
|
101
101
|
({ args: c, token: s }) => {
|
|
102
102
|
var f;
|
|
103
|
-
le(n, c), (f = V.get(s)) == null || f(),
|
|
103
|
+
le(n, c), (f = V.get(s)) == null || f(), a.unregister(s);
|
|
104
104
|
}
|
|
105
|
-
),
|
|
105
|
+
), i = new Proxy(e, {
|
|
106
106
|
apply(c, s, f) {
|
|
107
|
-
var
|
|
107
|
+
var b, h, p, w;
|
|
108
108
|
let l = n;
|
|
109
|
-
for (let
|
|
110
|
-
l.has(f[
|
|
111
|
-
if (!l.has(
|
|
112
|
-
l.set(
|
|
113
|
-
const
|
|
114
|
-
l.set(
|
|
115
|
-
const P = fe(
|
|
116
|
-
|
|
109
|
+
for (let E = 0; E < f.length; E++)
|
|
110
|
+
l.has(f[E]) || l.set(f[E], /* @__PURE__ */ new Map()), l = l.get(f[E]);
|
|
111
|
+
if (!l.has(T) || l.get(T) !== void 0 && !((h = (b = l.get(T)) == null ? void 0 : b.deref) != null && h.call(b))) {
|
|
112
|
+
l.set(T, void 0);
|
|
113
|
+
const E = C(Reflect.construct(c, f, o));
|
|
114
|
+
l.set(T, new WeakRef(E));
|
|
115
|
+
const P = fe(E);
|
|
116
|
+
a.register(E, { args: f, token: P }, P);
|
|
117
117
|
}
|
|
118
|
-
return (w = (
|
|
118
|
+
return (w = (p = l.get(T)) == null ? void 0 : p.deref) == null ? void 0 : w.call(p);
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
|
-
return
|
|
121
|
+
return M.set(e, i), ne.add(i), M.get(e);
|
|
122
122
|
function o() {
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
function le(
|
|
126
|
-
if (r.length === 0) return
|
|
127
|
-
const [n, ...
|
|
128
|
-
if (!(
|
|
129
|
-
return
|
|
125
|
+
function le(e, r) {
|
|
126
|
+
if (r.length === 0) return e.delete(T);
|
|
127
|
+
const [n, ...a] = r, i = e.get(n);
|
|
128
|
+
if (!(i instanceof Map && (le(i, a), i.size > 0)))
|
|
129
|
+
return e.delete(n);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const r =
|
|
131
|
+
function Je(e) {
|
|
132
|
+
const r = C(e), n = fe(r);
|
|
133
133
|
return {
|
|
134
|
-
register(
|
|
135
|
-
n && V.set(n,
|
|
134
|
+
register(a) {
|
|
135
|
+
n && V.set(n, a);
|
|
136
136
|
},
|
|
137
137
|
unregister() {
|
|
138
138
|
n && V.delete(n);
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
function fe(
|
|
143
|
-
return
|
|
142
|
+
function fe(e) {
|
|
143
|
+
return z.has(e) || z.set(e, {}), z.get(e);
|
|
144
144
|
}
|
|
145
|
-
const
|
|
146
|
-
function
|
|
147
|
-
const n = W(
|
|
148
|
-
return
|
|
145
|
+
const Ce = /* @__PURE__ */ Object.create(null);
|
|
146
|
+
function Ve(e, r) {
|
|
147
|
+
const n = W(e), a = r ? n(...r) : Ce;
|
|
148
|
+
return de(a);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
const [, r] =
|
|
152
|
-
return
|
|
150
|
+
function de(e) {
|
|
151
|
+
const [, r] = Se((n) => (n + 1) % 100, 0);
|
|
152
|
+
return je(() => (r(), q(e, () => r())), [e]), e;
|
|
153
153
|
}
|
|
154
|
-
class
|
|
154
|
+
class Me {
|
|
155
155
|
constructor(r, ...n) {
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
g(this, "symbol", Symbol());
|
|
157
|
+
g(this, "args");
|
|
158
158
|
this.target = r, this.args = n;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
const Ne = W(
|
|
161
|
+
const Ne = W(Me);
|
|
162
162
|
class Le {
|
|
163
163
|
constructor() {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
g(this, "loading", {});
|
|
165
|
+
g(this, "globalLoading", 0);
|
|
166
|
+
g(this, "onceTokens", /* @__PURE__ */ new WeakMap());
|
|
167
|
+
g(this, "oncePool", {});
|
|
168
168
|
}
|
|
169
169
|
addGlobalLoading() {
|
|
170
170
|
this.globalLoading++;
|
|
@@ -173,30 +173,30 @@ class Le {
|
|
|
173
173
|
this.globalLoading--;
|
|
174
174
|
}
|
|
175
175
|
load(r = !1) {
|
|
176
|
-
return (n, { name:
|
|
177
|
-
const { loading:
|
|
176
|
+
return (n, { name: a }) => {
|
|
177
|
+
const { loading: i, addGlobalLoading: o, subGlobalLoading: c } = this;
|
|
178
178
|
return async function(...s) {
|
|
179
|
-
const f = Reflect.get(this,
|
|
180
|
-
if (!!
|
|
181
|
-
const { promise: h, resolve:
|
|
182
|
-
|
|
179
|
+
const f = Reflect.get(this, a), l = Ne(f, ...s);
|
|
180
|
+
if (!!i[l.symbol]) return i[l.symbol][1];
|
|
181
|
+
const { promise: h, resolve: p, reject: w } = Promise.withResolvers();
|
|
182
|
+
i[l.symbol] = [f, h], r && o();
|
|
183
183
|
try {
|
|
184
|
-
const
|
|
185
|
-
E
|
|
186
|
-
} catch (
|
|
187
|
-
w(
|
|
184
|
+
const E = await n.apply(this, s);
|
|
185
|
+
p(E);
|
|
186
|
+
} catch (E) {
|
|
187
|
+
w(E);
|
|
188
188
|
}
|
|
189
|
-
return Reflect.deleteProperty(
|
|
189
|
+
return Reflect.deleteProperty(i, l.symbol), r && c(), h;
|
|
190
190
|
};
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
193
|
once(r, { name: n }) {
|
|
194
|
-
const { oncePool:
|
|
194
|
+
const { oncePool: a, onceTokens: i } = this;
|
|
195
195
|
return function(...o) {
|
|
196
196
|
const c = Reflect.get(this, n);
|
|
197
|
-
|
|
198
|
-
const s =
|
|
199
|
-
return !!
|
|
197
|
+
i.has(c) || i.set(c, Symbol());
|
|
198
|
+
const s = i.get(c);
|
|
199
|
+
return !!a[s] || (a[s] = r.apply(this, o).catch((l) => (Reflect.deleteProperty(a, s), Promise.reject(l)))), a[s];
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
isLoading(r) {
|
|
@@ -208,8 +208,11 @@ class Le {
|
|
|
208
208
|
return this.globalLoading > 0;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
const
|
|
212
|
-
|
|
211
|
+
const We = W(Le)(), Xe = () => {
|
|
212
|
+
const { isGlobalLoading: e, isLoading: r } = de(We);
|
|
213
|
+
return { isGlobalLoading: e, isLoading: r };
|
|
214
|
+
};
|
|
215
|
+
var N = { exports: {} }, x = {};
|
|
213
216
|
/**
|
|
214
217
|
* @license React
|
|
215
218
|
* react-jsx-runtime.production.js
|
|
@@ -220,28 +223,28 @@ var M = { exports: {} }, S = {};
|
|
|
220
223
|
* LICENSE file in the root directory of this source tree.
|
|
221
224
|
*/
|
|
222
225
|
var oe;
|
|
223
|
-
function
|
|
224
|
-
if (oe) return
|
|
226
|
+
function Ie() {
|
|
227
|
+
if (oe) return x;
|
|
225
228
|
oe = 1;
|
|
226
|
-
var
|
|
227
|
-
function n(
|
|
229
|
+
var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
|
|
230
|
+
function n(a, i, o) {
|
|
228
231
|
var c = null;
|
|
229
|
-
if (o !== void 0 && (c = "" + o),
|
|
232
|
+
if (o !== void 0 && (c = "" + o), i.key !== void 0 && (c = "" + i.key), "key" in i) {
|
|
230
233
|
o = {};
|
|
231
|
-
for (var s in
|
|
232
|
-
s !== "key" && (o[s] =
|
|
233
|
-
} else o =
|
|
234
|
-
return
|
|
235
|
-
$$typeof:
|
|
236
|
-
type:
|
|
234
|
+
for (var s in i)
|
|
235
|
+
s !== "key" && (o[s] = i[s]);
|
|
236
|
+
} else o = i;
|
|
237
|
+
return i = o.ref, {
|
|
238
|
+
$$typeof: e,
|
|
239
|
+
type: a,
|
|
237
240
|
key: c,
|
|
238
|
-
ref:
|
|
241
|
+
ref: i !== void 0 ? i : null,
|
|
239
242
|
props: o
|
|
240
243
|
};
|
|
241
244
|
}
|
|
242
|
-
return
|
|
245
|
+
return x.Fragment = r, x.jsx = n, x.jsxs = n, x;
|
|
243
246
|
}
|
|
244
|
-
var
|
|
247
|
+
var A = {};
|
|
245
248
|
/**
|
|
246
249
|
* @license React
|
|
247
250
|
* react-jsx-runtime.development.js
|
|
@@ -254,278 +257,311 @@ var j = {};
|
|
|
254
257
|
var se;
|
|
255
258
|
function Ye() {
|
|
256
259
|
return se || (se = 1, process.env.NODE_ENV !== "production" && function() {
|
|
257
|
-
function t
|
|
258
|
-
if (
|
|
259
|
-
if (typeof
|
|
260
|
-
return
|
|
261
|
-
if (typeof
|
|
262
|
-
switch (
|
|
260
|
+
function e(t) {
|
|
261
|
+
if (t == null) return null;
|
|
262
|
+
if (typeof t == "function")
|
|
263
|
+
return t.$$typeof === ke ? null : t.displayName || t.name || null;
|
|
264
|
+
if (typeof t == "string") return t;
|
|
265
|
+
switch (t) {
|
|
263
266
|
case P:
|
|
264
267
|
return "Fragment";
|
|
265
|
-
case
|
|
268
|
+
case me:
|
|
266
269
|
return "Profiler";
|
|
267
|
-
case
|
|
270
|
+
case be:
|
|
268
271
|
return "StrictMode";
|
|
269
|
-
case Ee:
|
|
270
|
-
return "Suspense";
|
|
271
272
|
case _e:
|
|
272
|
-
return "
|
|
273
|
+
return "Suspense";
|
|
273
274
|
case ye:
|
|
275
|
+
return "SuspenseList";
|
|
276
|
+
case he:
|
|
274
277
|
return "Activity";
|
|
275
278
|
}
|
|
276
|
-
if (typeof
|
|
277
|
-
switch (typeof
|
|
279
|
+
if (typeof t == "object")
|
|
280
|
+
switch (typeof t.tag == "number" && console.error(
|
|
278
281
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
279
|
-
),
|
|
280
|
-
case
|
|
282
|
+
), t.$$typeof) {
|
|
283
|
+
case E:
|
|
281
284
|
return "Portal";
|
|
285
|
+
case Ee:
|
|
286
|
+
return (t.displayName || "Context") + ".Provider";
|
|
282
287
|
case Re:
|
|
283
|
-
return (
|
|
284
|
-
case me:
|
|
285
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
288
|
+
return (t._context.displayName || "Context") + ".Consumer";
|
|
286
289
|
case pe:
|
|
287
|
-
var
|
|
288
|
-
return
|
|
290
|
+
var u = t.render;
|
|
291
|
+
return t = t.displayName, t || (t = u.displayName || u.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
289
292
|
case ve:
|
|
290
|
-
return
|
|
293
|
+
return u = t.displayName || null, u !== null ? u : e(t.type) || "Memo";
|
|
291
294
|
case B:
|
|
292
|
-
|
|
295
|
+
u = t._payload, t = t._init;
|
|
293
296
|
try {
|
|
294
|
-
return t(
|
|
297
|
+
return e(t(u));
|
|
295
298
|
} catch {
|
|
296
299
|
}
|
|
297
300
|
}
|
|
298
301
|
return null;
|
|
299
302
|
}
|
|
300
|
-
function r(
|
|
301
|
-
return "" +
|
|
303
|
+
function r(t) {
|
|
304
|
+
return "" + t;
|
|
302
305
|
}
|
|
303
|
-
function n(
|
|
306
|
+
function n(t) {
|
|
304
307
|
try {
|
|
305
|
-
r(
|
|
306
|
-
var
|
|
308
|
+
r(t);
|
|
309
|
+
var u = !1;
|
|
307
310
|
} catch {
|
|
308
|
-
|
|
311
|
+
u = !0;
|
|
309
312
|
}
|
|
310
|
-
if (
|
|
311
|
-
|
|
312
|
-
var d =
|
|
313
|
+
if (u) {
|
|
314
|
+
u = console;
|
|
315
|
+
var d = u.error, m = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
313
316
|
return d.call(
|
|
314
|
-
|
|
317
|
+
u,
|
|
315
318
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
316
|
-
|
|
317
|
-
), r(
|
|
319
|
+
m
|
|
320
|
+
), r(t);
|
|
318
321
|
}
|
|
319
322
|
}
|
|
320
|
-
function
|
|
321
|
-
if (
|
|
322
|
-
if (typeof
|
|
323
|
+
function a(t) {
|
|
324
|
+
if (t === P) return "<>";
|
|
325
|
+
if (typeof t == "object" && t !== null && t.$$typeof === B)
|
|
323
326
|
return "<...>";
|
|
324
327
|
try {
|
|
325
|
-
var
|
|
326
|
-
return
|
|
328
|
+
var u = e(t);
|
|
329
|
+
return u ? "<" + u + ">" : "<...>";
|
|
327
330
|
} catch {
|
|
328
331
|
return "<...>";
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
|
-
function
|
|
332
|
-
var
|
|
333
|
-
return
|
|
334
|
+
function i() {
|
|
335
|
+
var t = I.A;
|
|
336
|
+
return t === null ? null : t.getOwner();
|
|
334
337
|
}
|
|
335
338
|
function o() {
|
|
336
339
|
return Error("react-stack-top-frame");
|
|
337
340
|
}
|
|
338
|
-
function c(
|
|
339
|
-
if (H.call(
|
|
340
|
-
var
|
|
341
|
-
if (
|
|
341
|
+
function c(t) {
|
|
342
|
+
if (H.call(t, "key")) {
|
|
343
|
+
var u = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
344
|
+
if (u && u.isReactWarning) return !1;
|
|
342
345
|
}
|
|
343
|
-
return
|
|
346
|
+
return t.key !== void 0;
|
|
344
347
|
}
|
|
345
|
-
function s(
|
|
348
|
+
function s(t, u) {
|
|
346
349
|
function d() {
|
|
347
350
|
Z || (Z = !0, console.error(
|
|
348
351
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
349
|
-
|
|
352
|
+
u
|
|
350
353
|
));
|
|
351
354
|
}
|
|
352
|
-
d.isReactWarning = !0, Object.defineProperty(
|
|
355
|
+
d.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
353
356
|
get: d,
|
|
354
357
|
configurable: !0
|
|
355
358
|
});
|
|
356
359
|
}
|
|
357
360
|
function f() {
|
|
358
|
-
var
|
|
359
|
-
return Q[
|
|
361
|
+
var t = e(this.type);
|
|
362
|
+
return Q[t] || (Q[t] = !0, console.error(
|
|
360
363
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
361
|
-
)),
|
|
364
|
+
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
362
365
|
}
|
|
363
|
-
function l(
|
|
364
|
-
return d =
|
|
366
|
+
function l(t, u, d, m, k, y, $, F) {
|
|
367
|
+
return d = y.ref, t = {
|
|
365
368
|
$$typeof: w,
|
|
366
|
-
type:
|
|
367
|
-
key:
|
|
368
|
-
props:
|
|
369
|
+
type: t,
|
|
370
|
+
key: u,
|
|
371
|
+
props: y,
|
|
369
372
|
_owner: k
|
|
370
|
-
}, (d !== void 0 ? d : null) !== null ? Object.defineProperty(
|
|
373
|
+
}, (d !== void 0 ? d : null) !== null ? Object.defineProperty(t, "ref", {
|
|
371
374
|
enumerable: !1,
|
|
372
375
|
get: f
|
|
373
|
-
}) : Object.defineProperty(
|
|
376
|
+
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
374
377
|
configurable: !1,
|
|
375
378
|
enumerable: !1,
|
|
376
379
|
writable: !0,
|
|
377
380
|
value: 0
|
|
378
|
-
}), Object.defineProperty(
|
|
381
|
+
}), Object.defineProperty(t, "_debugInfo", {
|
|
379
382
|
configurable: !1,
|
|
380
383
|
enumerable: !1,
|
|
381
384
|
writable: !0,
|
|
382
385
|
value: null
|
|
383
|
-
}), Object.defineProperty(
|
|
386
|
+
}), Object.defineProperty(t, "_debugStack", {
|
|
384
387
|
configurable: !1,
|
|
385
388
|
enumerable: !1,
|
|
386
389
|
writable: !0,
|
|
387
|
-
value:
|
|
388
|
-
}), Object.defineProperty(
|
|
390
|
+
value: $
|
|
391
|
+
}), Object.defineProperty(t, "_debugTask", {
|
|
389
392
|
configurable: !1,
|
|
390
393
|
enumerable: !1,
|
|
391
394
|
writable: !0,
|
|
392
|
-
value:
|
|
393
|
-
}), Object.freeze && (Object.freeze(
|
|
395
|
+
value: F
|
|
396
|
+
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
394
397
|
}
|
|
395
|
-
function
|
|
396
|
-
var
|
|
397
|
-
if (
|
|
398
|
-
if (
|
|
399
|
-
if (
|
|
400
|
-
for (
|
|
401
|
-
h(m
|
|
402
|
-
Object.freeze && Object.freeze(
|
|
398
|
+
function b(t, u, d, m, k, y, $, F) {
|
|
399
|
+
var R = u.children;
|
|
400
|
+
if (R !== void 0)
|
|
401
|
+
if (m)
|
|
402
|
+
if (we(R)) {
|
|
403
|
+
for (m = 0; m < R.length; m++)
|
|
404
|
+
h(R[m]);
|
|
405
|
+
Object.freeze && Object.freeze(R);
|
|
403
406
|
} else
|
|
404
407
|
console.error(
|
|
405
408
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
406
409
|
);
|
|
407
|
-
else h(
|
|
408
|
-
if (H.call(
|
|
409
|
-
|
|
410
|
-
var O = Object.keys(
|
|
411
|
-
return
|
|
410
|
+
else h(R);
|
|
411
|
+
if (H.call(u, "key")) {
|
|
412
|
+
R = e(t);
|
|
413
|
+
var O = Object.keys(u).filter(function(ge) {
|
|
414
|
+
return ge !== "key";
|
|
412
415
|
});
|
|
413
|
-
|
|
416
|
+
m = 0 < O.length ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}", te[R + m] || (O = 0 < O.length ? "{" + O.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
414
417
|
`A props object containing a "key" prop is being spread into JSX:
|
|
415
418
|
let props = %s;
|
|
416
419
|
<%s {...props} />
|
|
417
420
|
React keys must be passed directly to JSX without using spread:
|
|
418
421
|
let props = %s;
|
|
419
422
|
<%s key={someKey} {...props} />`,
|
|
420
|
-
b,
|
|
421
423
|
m,
|
|
424
|
+
R,
|
|
422
425
|
O,
|
|
423
|
-
|
|
424
|
-
), te[
|
|
426
|
+
R
|
|
427
|
+
), te[R + m] = !0);
|
|
425
428
|
}
|
|
426
|
-
if (
|
|
429
|
+
if (R = null, d !== void 0 && (n(d), R = "" + d), c(u) && (n(u.key), R = "" + u.key), "key" in u) {
|
|
427
430
|
d = {};
|
|
428
|
-
for (var D in
|
|
429
|
-
D !== "key" && (d[D] =
|
|
430
|
-
} else d =
|
|
431
|
-
return
|
|
431
|
+
for (var D in u)
|
|
432
|
+
D !== "key" && (d[D] = u[D]);
|
|
433
|
+
} else d = u;
|
|
434
|
+
return R && s(
|
|
432
435
|
d,
|
|
433
|
-
typeof
|
|
436
|
+
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
434
437
|
), l(
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
+
t,
|
|
439
|
+
R,
|
|
440
|
+
y,
|
|
438
441
|
k,
|
|
439
|
-
|
|
442
|
+
i(),
|
|
440
443
|
d,
|
|
441
|
-
|
|
442
|
-
|
|
444
|
+
$,
|
|
445
|
+
F
|
|
443
446
|
);
|
|
444
447
|
}
|
|
445
|
-
function h(
|
|
446
|
-
typeof
|
|
448
|
+
function h(t) {
|
|
449
|
+
typeof t == "object" && t !== null && t.$$typeof === w && t._store && (t._store.validated = 1);
|
|
447
450
|
}
|
|
448
|
-
var
|
|
451
|
+
var p = Oe, w = Symbol.for("react.transitional.element"), E = Symbol.for("react.portal"), P = Symbol.for("react.fragment"), be = Symbol.for("react.strict_mode"), me = Symbol.for("react.profiler"), Re = Symbol.for("react.consumer"), Ee = Symbol.for("react.context"), pe = Symbol.for("react.forward_ref"), _e = Symbol.for("react.suspense"), ye = Symbol.for("react.suspense_list"), ve = Symbol.for("react.memo"), B = Symbol.for("react.lazy"), he = Symbol.for("react.activity"), ke = Symbol.for("react.client.reference"), I = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, H = Object.prototype.hasOwnProperty, we = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
449
452
|
return null;
|
|
450
453
|
};
|
|
451
|
-
|
|
452
|
-
"react-stack-bottom-frame": function(
|
|
453
|
-
return
|
|
454
|
+
p = {
|
|
455
|
+
"react-stack-bottom-frame": function(t) {
|
|
456
|
+
return t();
|
|
454
457
|
}
|
|
455
458
|
};
|
|
456
|
-
var Z, Q = {}, K =
|
|
457
|
-
|
|
459
|
+
var Z, Q = {}, K = p["react-stack-bottom-frame"].bind(
|
|
460
|
+
p,
|
|
458
461
|
o
|
|
459
|
-
)(), ee =
|
|
460
|
-
|
|
461
|
-
var
|
|
462
|
-
return
|
|
463
|
-
|
|
464
|
-
|
|
462
|
+
)(), ee = Y(a(o)), te = {};
|
|
463
|
+
A.Fragment = P, A.jsx = function(t, u, d, m, k) {
|
|
464
|
+
var y = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
465
|
+
return b(
|
|
466
|
+
t,
|
|
467
|
+
u,
|
|
465
468
|
d,
|
|
466
469
|
!1,
|
|
467
|
-
|
|
470
|
+
m,
|
|
468
471
|
k,
|
|
469
|
-
|
|
470
|
-
|
|
472
|
+
y ? Error("react-stack-top-frame") : K,
|
|
473
|
+
y ? Y(a(t)) : ee
|
|
471
474
|
);
|
|
472
|
-
},
|
|
473
|
-
var
|
|
474
|
-
return
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
}, A.jsxs = function(t, u, d, m, k) {
|
|
476
|
+
var y = 1e4 > I.recentlyCreatedOwnerStacks++;
|
|
477
|
+
return b(
|
|
478
|
+
t,
|
|
479
|
+
u,
|
|
477
480
|
d,
|
|
478
481
|
!0,
|
|
479
|
-
|
|
482
|
+
m,
|
|
480
483
|
k,
|
|
481
|
-
|
|
482
|
-
|
|
484
|
+
y ? Error("react-stack-top-frame") : K,
|
|
485
|
+
y ? Y(a(t)) : ee
|
|
483
486
|
);
|
|
484
487
|
};
|
|
485
|
-
}()),
|
|
488
|
+
}()), A;
|
|
489
|
+
}
|
|
490
|
+
var ie;
|
|
491
|
+
function $e() {
|
|
492
|
+
return ie || (ie = 1, process.env.NODE_ENV === "production" ? N.exports = Ie() : N.exports = Ye()), N.exports;
|
|
486
493
|
}
|
|
487
|
-
var
|
|
488
|
-
|
|
489
|
-
|
|
494
|
+
var Fe = $e();
|
|
495
|
+
const S = {}, j = {}, X = xe({ namespace: "" });
|
|
496
|
+
function De(e) {
|
|
497
|
+
return S[e] || (S[e] = /* @__PURE__ */ new Map()), S[e];
|
|
490
498
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
499
|
+
function Ge(e) {
|
|
500
|
+
return j[e] || (j[e] = /* @__PURE__ */ new Map()), j[e];
|
|
501
|
+
}
|
|
502
|
+
const Be = ({
|
|
503
|
+
children: e,
|
|
494
504
|
namespace: r = ""
|
|
495
|
-
}) => /* @__PURE__ */
|
|
496
|
-
function
|
|
497
|
-
const { namespace: n } =
|
|
498
|
-
return
|
|
505
|
+
}) => /* @__PURE__ */ Fe.jsx(X.Provider, { value: { namespace: r }, children: e });
|
|
506
|
+
function He({ schema: e, ctor: r }) {
|
|
507
|
+
const { namespace: n } = ae(X);
|
|
508
|
+
return De(n).set(e, r), null;
|
|
499
509
|
}
|
|
500
|
-
function
|
|
501
|
-
schema:
|
|
510
|
+
function Ze({
|
|
511
|
+
schema: e,
|
|
502
512
|
val: r
|
|
503
513
|
}) {
|
|
504
|
-
const { namespace: n } =
|
|
505
|
-
return
|
|
514
|
+
const { namespace: n } = ae(X);
|
|
515
|
+
return Ge(n).set(e, r), null;
|
|
506
516
|
}
|
|
507
|
-
function
|
|
508
|
-
return (n, { static:
|
|
509
|
-
if (
|
|
510
|
-
|
|
517
|
+
function Qe(e, r = "") {
|
|
518
|
+
return (n, { static: a, kind: i }) => {
|
|
519
|
+
if (i !== "field")
|
|
520
|
+
throw new Error("inject 装饰器只能用于类的属性字段");
|
|
521
|
+
if (a)
|
|
522
|
+
throw new Error("inject 装饰器不能用于静态属性");
|
|
511
523
|
return function(o) {
|
|
524
|
+
var l;
|
|
525
|
+
if (!Ue(e, r))
|
|
526
|
+
return console.error(
|
|
527
|
+
`[IoC] 依赖注入失败 - namespace: "${r}", schema: ${e.description || "unknown"}`,
|
|
528
|
+
"未注册"
|
|
529
|
+
), o;
|
|
512
530
|
let c = o;
|
|
513
|
-
const s =
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
531
|
+
const s = (l = S[r]) == null ? void 0 : l.get(e);
|
|
532
|
+
if (s)
|
|
533
|
+
c = W(s)();
|
|
534
|
+
else {
|
|
535
|
+
const b = j[r];
|
|
536
|
+
b != null && b.has(e) && (c = b.get(e));
|
|
537
|
+
}
|
|
538
|
+
const f = e.safeParse(c);
|
|
539
|
+
return f.success ? c : (console.error(
|
|
540
|
+
`[IoC] 依赖注入失败 - namespace: "${r}", schema: ${e.description || "unknown"}`,
|
|
541
|
+
f.error.issues
|
|
542
|
+
), o);
|
|
517
543
|
};
|
|
518
544
|
};
|
|
519
545
|
}
|
|
546
|
+
function Ke(e) {
|
|
547
|
+
delete S[e], delete j[e];
|
|
548
|
+
}
|
|
549
|
+
function Ue(e, r = "") {
|
|
550
|
+
const n = S[r], a = j[r];
|
|
551
|
+
return (n == null ? void 0 : n.has(e)) || (a == null ? void 0 : a.has(e));
|
|
552
|
+
}
|
|
520
553
|
export {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
554
|
+
He as CInjection,
|
|
555
|
+
Be as Container,
|
|
556
|
+
Ze as VInjection,
|
|
557
|
+
Ke as clearNamespace,
|
|
558
|
+
Je as finalizationRegistry,
|
|
559
|
+
Qe as inject,
|
|
560
|
+
Ue as isRegistered,
|
|
561
|
+
We as loader,
|
|
527
562
|
W as provide,
|
|
528
|
-
|
|
529
|
-
|
|
563
|
+
de as useInstance,
|
|
564
|
+
Xe as useLoader,
|
|
565
|
+
Ve as useModel,
|
|
530
566
|
q as watch
|
|
531
567
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(f,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(f=typeof globalThis<"u"?globalThis:f||self,m(f["@e7w/easy-model"]={},f.React))})(this,function(f,m){"use strict";var Xe=Object.defineProperty;var Be=(f,m,w)=>m in f?Xe(f,m,{enumerable:!0,configurable:!0,writable:!0,value:w}):f[m]=w;var O=(f,m,w)=>Be(f,typeof m!="symbol"?m+"":m,w);const w=new WeakMap,W=new WeakMap,Q=Symbol("origin");let p=null;const z=["includes","indexOf","lastIndexOf"],ye=[Promise,RegExp,Date,WeakMap,WeakSet,Map,Set];function M(e){if(e=_(e),!e||ye.some(i=>e instanceof i))return e;if(w.has(e))return w.get(e);const n={},r={},a=new Proxy(e,{get(i,o,c){if(o===Q)return i;let s=ee(i,o);return s||(s=Reflect.get(i,o,c),typeof s=="function"?(r[o]||(r[o]=s.bind(M(i))),s=r[o]):typeof s=="object"&&s!==null&&(n[o]||(n[o]=Y(s,K(e,o))),s=M(s)),s)},set(i,o,c,s){let d=Reflect.get(i,o,s);if(d=_(d),c=_(c),d===c)return!0;const l=Reflect.set(i,o,c,s);if(l){n[o]&&(n[o](),delete n[o]),typeof c=="object"&&c!==null&&(n[o]=Y(c,K(e,o))),r[o]&&delete r[o];const R=p;p=new WeakSet,G(i,[o],d,c),p=R}return l},deleteProperty(i,o){let c=Reflect.get(i,o);c=_(c);const s=Reflect.deleteProperty(i,o);return s&&(n[o]&&(n[o](),delete n[o]),r[o]&&delete r[o],G(i,[o],c,void 0)),s}});return w.set(e,a),a}function Y(e,n){e=_(e),W.has(e)||W.set(e,new Map);const r=W.get(e),a=Symbol();return r.set(a,n),function(){r.delete(a)}}function K(e,n){return function(...r){const[a,...i]=r;G(e,[n,...a],...i)}}function G(e,...n){if(e=_(e),p!=null&&p.has(e))return;p==null||p.add(e);const r=W.get(e);if(!r)return;[...r.values()].forEach(i=>{const o=new EventTarget,c=new Event("__trigger__");o.addEventListener(c.type,s),o.dispatchEvent(c);function s(){o.removeEventListener(c.type,s),i(...n)}})}function _(e){return typeof e!="object"||e===null?e:e[Q]??e}function ee(e,n){if(e=_(e),["constructor","__proto__"].includes(n))return Reflect.get(e,n);if(n==="hasOwnProperty")return function(r){return Object.prototype.hasOwnProperty.call(_(this),r)};if(Array.isArray(e)&&z.includes(n))return function(...r){const a=z[n].apply(_(this),r);return a===-1||a===!1?z[n].apply(_(this),r.map(_)):a}}const P=Symbol("instance"),F=new WeakMap,te=new WeakSet,U=new WeakMap,J=new WeakMap;function N(e){if(te.has(e))return e;if(F.has(e))return F.get(e);const n={};o.prototype=new Proxy({constructor:e,__proto__:e.prototype},{get(c,s,d){let l=ee(c,s);return l||(l=Reflect.get(c,s,d),typeof s=="symbol"||["constructor","__proto__"].includes(s)||typeof l!="function")?l:(n[s]||(n[s]=function(...R){return l.apply(M(this),R)}),n[s])}});const r=new Map,a=new FinalizationRegistry(({args:c,token:s})=>{var d;ne(r,c),(d=J.get(s))==null||d(),a.unregister(s)}),i=new Proxy(e,{apply(c,s,d){var R,g,v,j;let l=r;for(let h=0;h<d.length;h++)l.has(d[h])||l.set(d[h],new Map),l=l.get(d[h]);if(!l.has(P)||l.get(P)!==void 0&&!((g=(R=l.get(P))==null?void 0:R.deref)!=null&&g.call(R))){l.set(P,void 0);const h=M(Reflect.construct(c,d,o));l.set(P,new WeakRef(h));const C=re(h);a.register(h,{args:d,token:C},C)}return(j=(v=l.get(P))==null?void 0:v.deref)==null?void 0:j.call(v)}});return F.set(e,i),te.add(i),F.get(e);function o(){}}function ne(e,n){if(n.length===0)return e.delete(P);const[r,...a]=n,i=e.get(r);if(!(i instanceof Map&&(ne(i,a),i.size>0)))return e.delete(r)}function Ee(e){const n=M(e),r=re(n);return{register(a){r&&J.set(r,a)},unregister(){r&&J.delete(r)}}}function re(e){return U.has(e)||U.set(e,{}),U.get(e)}const he=Object.create(null);function _e(e,n){const r=N(e),a=n?r(...n):he;return V(a)}function V(e){const[,n]=m.useReducer(r=>(r+1)%100,0);return m.useEffect(()=>(n(),Y(e,()=>n())),[e]),e}class ve{constructor(n,...r){O(this,"symbol",Symbol());O(this,"args");this.target=n,this.args=r}}const ke=N(ve);class pe{constructor(){O(this,"loading",{});O(this,"globalLoading",0);O(this,"onceTokens",new WeakMap);O(this,"oncePool",{})}addGlobalLoading(){this.globalLoading++}subGlobalLoading(){this.globalLoading--}load(n=!1){return(r,{name:a})=>{const{loading:i,addGlobalLoading:o,subGlobalLoading:c}=this;return async function(...s){const d=Reflect.get(this,a),l=ke(d,...s);if(!!i[l.symbol])return i[l.symbol][1];const{promise:g,resolve:v,reject:j}=Promise.withResolvers();i[l.symbol]=[d,g],n&&o();try{const h=await r.apply(this,s);v(h)}catch(h){j(h)}return Reflect.deleteProperty(i,l.symbol),n&&c(),g}}}once(n,{name:r}){const{oncePool:a,onceTokens:i}=this;return function(...o){const c=Reflect.get(this,r);i.has(c)||i.set(c,Symbol());const s=i.get(c);return!!a[s]||(a[s]=n.apply(this,o).catch(l=>(Reflect.deleteProperty(a,s),Promise.reject(l)))),a[s]}}isLoading(n){return Object.getOwnPropertySymbols(this.loading).some(r=>this.loading[r][0]===n)}get isGlobalLoading(){return this.globalLoading>0}}const oe=N(pe)(),we=()=>{const{isGlobalLoading:e,isLoading:n}=V(oe);return{isGlobalLoading:e,isLoading:n}};var D={exports:{}},L={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var se;function ge(){if(se)return L;se=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(a,i,o){var c=null;if(o!==void 0&&(c=""+o),i.key!==void 0&&(c=""+i.key),"key"in i){o={};for(var s in i)s!=="key"&&(o[s]=i[s])}else o=i;return i=o.ref,{$$typeof:e,type:a,key:c,ref:i!==void 0?i:null,props:o}}return L.Fragment=n,L.jsx=r,L.jsxs=r,L}var I={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var ie;function Te(){return ie||(ie=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Je?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case Ie:return"Profiler";case Le:return"StrictMode";case De:return"Suspense";case ze:return"SuspenseList";case Ue:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case h:return"Portal";case Ye:return(t.displayName||"Context")+".Provider";case We:return(t._context.displayName||"Context")+".Consumer";case Fe:var u=t.render;return t=t.displayName,t||(t=u.displayName||u.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ge:return u=t.displayName||null,u!==null?u:e(t.type)||"Memo";case ue:u=t._payload,t=t._init;try{return e(t(u))}catch{}}return null}function n(t){return""+t}function r(t){try{n(t);var u=!1}catch{u=!0}if(u){u=console;var b=u.error,y=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return b.call(u,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",y),n(t)}}function a(t){if(t===C)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===ue)return"<...>";try{var u=e(t);return u?"<"+u+">":"<...>"}catch{return"<...>"}}function i(){var t=X.A;return t===null?null:t.getOwner()}function o(){return Error("react-stack-top-frame")}function c(t){if(le.call(t,"key")){var u=Object.getOwnPropertyDescriptor(t,"key").get;if(u&&u.isReactWarning)return!1}return t.key!==void 0}function s(t,u){function b(){fe||(fe=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",u))}b.isReactWarning=!0,Object.defineProperty(t,"key",{get:b,configurable:!0})}function d(){var t=e(this.type);return de[t]||(de[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function l(t,u,b,y,T,k,q,H){return b=k.ref,t={$$typeof:j,type:t,key:u,props:k,_owner:T},(b!==void 0?b:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:d}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:H}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function R(t,u,b,y,T,k,q,H){var E=u.children;if(E!==void 0)if(y)if(Ve(E)){for(y=0;y<E.length;y++)g(E[y]);Object.freeze&&Object.freeze(E)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(E);if(le.call(u,"key")){E=e(t);var x=Object.keys(u).filter(function($e){return $e!=="key"});y=0<x.length?"{key: someKey, "+x.join(": ..., ")+": ...}":"{key: someKey}",Re[E+y]||(x=0<x.length?"{"+x.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,
|
|
22
|
+
<%s key={someKey} {...props} />`,y,E,x,E),Re[E+y]=!0)}if(E=null,b!==void 0&&(r(b),E=""+b),c(u)&&(r(u.key),E=""+u.key),"key"in u){b={};for(var Z in u)Z!=="key"&&(b[Z]=u[Z])}else b=u;return E&&s(b,typeof t=="function"?t.displayName||t.name||"Unknown":t),l(t,E,k,T,i(),b,q,H)}function g(t){typeof t=="object"&&t!==null&&t.$$typeof===j&&t._store&&(t._store.validated=1)}var v=m,j=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),Le=Symbol.for("react.strict_mode"),Ie=Symbol.for("react.profiler"),We=Symbol.for("react.consumer"),Ye=Symbol.for("react.context"),Fe=Symbol.for("react.forward_ref"),De=Symbol.for("react.suspense"),ze=Symbol.for("react.suspense_list"),Ge=Symbol.for("react.memo"),ue=Symbol.for("react.lazy"),Ue=Symbol.for("react.activity"),Je=Symbol.for("react.client.reference"),X=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=Object.prototype.hasOwnProperty,Ve=Array.isArray,B=console.createTask?console.createTask:function(){return null};v={"react-stack-bottom-frame":function(t){return t()}};var fe,de={},be=v["react-stack-bottom-frame"].bind(v,o)(),me=B(a(o)),Re={};I.Fragment=C,I.jsx=function(t,u,b,y,T){var k=1e4>X.recentlyCreatedOwnerStacks++;return R(t,u,b,!1,y,T,k?Error("react-stack-top-frame"):be,k?B(a(t)):me)},I.jsxs=function(t,u,b,y,T){var k=1e4>X.recentlyCreatedOwnerStacks++;return R(t,u,b,!0,y,T,k?Error("react-stack-top-frame"):be,k?B(a(t)):me)}}()),I}var ae;function Pe(){return ae||(ae=1,process.env.NODE_ENV==="production"?D.exports=ge():D.exports=Te()),D.exports}var je=Pe();const S={},A={},$=m.createContext({namespace:""});function Oe(e){return S[e]||(S[e]=new Map),S[e]}function Se(e){return A[e]||(A[e]=new Map),A[e]}const Ae=({children:e,namespace:n=""})=>je.jsx($.Provider,{value:{namespace:n},children:e});function Ce({schema:e,ctor:n}){const{namespace:r}=m.useContext($);return Oe(r).set(e,n),null}function xe({schema:e,val:n}){const{namespace:r}=m.useContext($);return Se(r).set(e,n),null}function Me(e,n=""){return(r,{static:a,kind:i})=>{if(i!=="field")throw new Error("inject 装饰器只能用于类的属性字段");if(a)throw new Error("inject 装饰器不能用于静态属性");return function(o){var l;if(!ce(e,n))return console.error(`[IoC] 依赖注入失败 - namespace: "${n}", schema: ${e.description||"unknown"}`,"未注册"),o;let c=o;const s=(l=S[n])==null?void 0:l.get(e);if(s)c=N(s)();else{const R=A[n];R!=null&&R.has(e)&&(c=R.get(e))}const d=e.safeParse(c);return d.success?c:(console.error(`[IoC] 依赖注入失败 - namespace: "${n}", schema: ${e.description||"unknown"}`,d.error.issues),o)}}}function Ne(e){delete S[e],delete A[e]}function ce(e,n=""){const r=S[n],a=A[n];return(r==null?void 0:r.has(e))||(a==null?void 0:a.has(e))}f.CInjection=Ce,f.Container=Ae,f.VInjection=xe,f.clearNamespace=Ne,f.finalizationRegistry=Ee,f.inject=Me,f.isRegistered=ce,f.loader=oe,f.provide=N,f.useInstance=V,f.useLoader=we,f.useModel=_e,f.watch=Y,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
|