phecda-core 1.2.1 → 1.3.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/dist/index.d.ts +4 -5
- package/dist/index.global.js +5 -7
- package/dist/index.js +5 -7
- package/dist/index.mjs +5 -7
- package/dist/preset/index.global.js +0 -1
- package/dist/preset/index.js +0 -1
- package/dist/preset/index.mjs +0 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface NameSpace {
|
|
2
2
|
[name: string]: Phecda;
|
|
3
3
|
}
|
|
4
4
|
interface UsePipeOptions {
|
|
@@ -10,7 +10,6 @@ interface PhecdaHandler {
|
|
|
10
10
|
}
|
|
11
11
|
interface Phecda {
|
|
12
12
|
_namespace: {
|
|
13
|
-
__TAG__: string;
|
|
14
13
|
__INIT_EVENT__: Set<PropertyKey>;
|
|
15
14
|
__EXPOSE_VAR__: Set<PropertyKey>;
|
|
16
15
|
__IGNORE_VAR__: Set<PropertyKey>;
|
|
@@ -22,7 +21,7 @@ interface Phecda {
|
|
|
22
21
|
type ClassValue<I> = {
|
|
23
22
|
[P in keyof I]: I[P] extends Function ? undefined : I[P];
|
|
24
23
|
};
|
|
25
|
-
interface
|
|
24
|
+
interface Events {
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
declare function plainToClass<M extends new (...args: any) => any, Data extends Record<PropertyKey, any>>(Model: M, input: Data, options?: UsePipeOptions): Promise<{
|
|
@@ -106,9 +105,9 @@ declare const activeInstance: Record<string, any>;
|
|
|
106
105
|
declare function injectProperty(key: string, value: any): Record<string, any>;
|
|
107
106
|
declare function getProperty(key: string): any;
|
|
108
107
|
|
|
109
|
-
declare function Watcher(eventName: keyof
|
|
108
|
+
declare function Watcher(eventName: keyof Events, options?: {
|
|
110
109
|
once: boolean;
|
|
111
110
|
}): (obj: any, key: string) => void;
|
|
112
111
|
declare function Storage(storeKey?: string): (target: any, key?: PropertyKey) => void;
|
|
113
112
|
|
|
114
|
-
export { ClassValue, Clear, Err, Global, Ignore, Init, P, Phecda,
|
|
113
|
+
export { ClassValue, Clear, Err, Events, Global, Ignore, Init, NameSpace, P, Phecda, PhecdaHandler, Pipe, Rule, Storage, Tag, UsePipeOptions, Watcher, activeInstance, addDecoToClass, classToValue, getExposeKey, getHandler, getIgnoreKey, getInitEvent, getModelState, getProperty, getState, getTag, init, injectProperty, isPhecda, mergeOptions, mergeState, plainToClass, regisHandler, regisInitEvent, register, registerAsync, setExposeKey, setIgnoreKey, setModalVar, snapShot, to, validate };
|
package/dist/index.global.js
CHANGED
|
@@ -76,7 +76,7 @@ var Phecda = (() => {
|
|
|
76
76
|
}
|
|
77
77
|
__name(validate, "validate");
|
|
78
78
|
function getTag(Model) {
|
|
79
|
-
return Model.prototype?.
|
|
79
|
+
return Model.prototype?.__TAG__;
|
|
80
80
|
}
|
|
81
81
|
__name(getTag, "getTag");
|
|
82
82
|
function mergeOptions(obj1, obj2) {
|
|
@@ -109,7 +109,6 @@ var Phecda = (() => {
|
|
|
109
109
|
function init(target) {
|
|
110
110
|
if (!target._namespace) {
|
|
111
111
|
target._namespace = {
|
|
112
|
-
__TAG__: "",
|
|
113
112
|
__INIT_EVENT__: /* @__PURE__ */ new Set(),
|
|
114
113
|
__EXPOSE_VAR__: /* @__PURE__ */ new Set(),
|
|
115
114
|
__IGNORE_VAR__: /* @__PURE__ */ new Set(),
|
|
@@ -279,15 +278,14 @@ var Phecda = (() => {
|
|
|
279
278
|
__name(Pipe, "Pipe");
|
|
280
279
|
function Tag(tag) {
|
|
281
280
|
return (target) => {
|
|
282
|
-
|
|
283
|
-
target.prototype._namespace.__TAG__ = tag;
|
|
281
|
+
target.prototype.__TAG__ = tag;
|
|
284
282
|
};
|
|
285
283
|
}
|
|
286
284
|
__name(Tag, "Tag");
|
|
287
285
|
function Global(target) {
|
|
288
286
|
if (!globalThis.__PHECDA__)
|
|
289
287
|
globalThis.__PHECDA__ = {};
|
|
290
|
-
const tag = target.prototype.
|
|
288
|
+
const tag = target.prototype.__TAG__;
|
|
291
289
|
if (tag)
|
|
292
290
|
globalThis.__PHECDA__[tag] = target;
|
|
293
291
|
}
|
|
@@ -402,7 +400,7 @@ var Phecda = (() => {
|
|
|
402
400
|
let tag;
|
|
403
401
|
if (key) {
|
|
404
402
|
init(target);
|
|
405
|
-
tag = storeKey || target.
|
|
403
|
+
tag = storeKey || target.__TAG__;
|
|
406
404
|
const uniTag = Symbol(tag);
|
|
407
405
|
setModalVar(target, uniTag);
|
|
408
406
|
regisHandler(target, uniTag, {
|
|
@@ -416,7 +414,7 @@ var Phecda = (() => {
|
|
|
416
414
|
});
|
|
417
415
|
} else {
|
|
418
416
|
init(target.prototype);
|
|
419
|
-
tag = storeKey || `${target.prototype.
|
|
417
|
+
tag = storeKey || `${target.prototype.__TAG__}_${key}`;
|
|
420
418
|
const uniTag = Symbol(tag);
|
|
421
419
|
setModalVar(target.prototype, uniTag);
|
|
422
420
|
regisHandler(target.prototype, uniTag, {
|
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ async function validate(p, v) {
|
|
|
76
76
|
}
|
|
77
77
|
__name(validate, "validate");
|
|
78
78
|
function getTag(Model) {
|
|
79
|
-
return Model.prototype?.
|
|
79
|
+
return Model.prototype?.__TAG__;
|
|
80
80
|
}
|
|
81
81
|
__name(getTag, "getTag");
|
|
82
82
|
function mergeOptions(obj1, obj2) {
|
|
@@ -109,7 +109,6 @@ __name(isPhecda, "isPhecda");
|
|
|
109
109
|
function init(target) {
|
|
110
110
|
if (!target._namespace) {
|
|
111
111
|
target._namespace = {
|
|
112
|
-
__TAG__: "",
|
|
113
112
|
__INIT_EVENT__: /* @__PURE__ */ new Set(),
|
|
114
113
|
__EXPOSE_VAR__: /* @__PURE__ */ new Set(),
|
|
115
114
|
__IGNORE_VAR__: /* @__PURE__ */ new Set(),
|
|
@@ -279,15 +278,14 @@ function Pipe(v) {
|
|
|
279
278
|
__name(Pipe, "Pipe");
|
|
280
279
|
function Tag(tag) {
|
|
281
280
|
return (target) => {
|
|
282
|
-
|
|
283
|
-
target.prototype._namespace.__TAG__ = tag;
|
|
281
|
+
target.prototype.__TAG__ = tag;
|
|
284
282
|
};
|
|
285
283
|
}
|
|
286
284
|
__name(Tag, "Tag");
|
|
287
285
|
function Global(target) {
|
|
288
286
|
if (!globalThis.__PHECDA__)
|
|
289
287
|
globalThis.__PHECDA__ = {};
|
|
290
|
-
const tag = target.prototype.
|
|
288
|
+
const tag = target.prototype.__TAG__;
|
|
291
289
|
if (tag)
|
|
292
290
|
globalThis.__PHECDA__[tag] = target;
|
|
293
291
|
}
|
|
@@ -402,7 +400,7 @@ function Storage(storeKey) {
|
|
|
402
400
|
let tag;
|
|
403
401
|
if (key) {
|
|
404
402
|
init(target);
|
|
405
|
-
tag = storeKey || target.
|
|
403
|
+
tag = storeKey || target.__TAG__;
|
|
406
404
|
const uniTag = Symbol(tag);
|
|
407
405
|
setModalVar(target, uniTag);
|
|
408
406
|
regisHandler(target, uniTag, {
|
|
@@ -416,7 +414,7 @@ function Storage(storeKey) {
|
|
|
416
414
|
});
|
|
417
415
|
} else {
|
|
418
416
|
init(target.prototype);
|
|
419
|
-
tag = storeKey || `${target.prototype.
|
|
417
|
+
tag = storeKey || `${target.prototype.__TAG__}_${key}`;
|
|
420
418
|
const uniTag = Symbol(tag);
|
|
421
419
|
setModalVar(target.prototype, uniTag);
|
|
422
420
|
regisHandler(target.prototype, uniTag, {
|
package/dist/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ async function validate(p, v) {
|
|
|
15
15
|
}
|
|
16
16
|
__name(validate, "validate");
|
|
17
17
|
function getTag(Model) {
|
|
18
|
-
return Model.prototype?.
|
|
18
|
+
return Model.prototype?.__TAG__;
|
|
19
19
|
}
|
|
20
20
|
__name(getTag, "getTag");
|
|
21
21
|
function mergeOptions(obj1, obj2) {
|
|
@@ -48,7 +48,6 @@ __name(isPhecda, "isPhecda");
|
|
|
48
48
|
function init(target) {
|
|
49
49
|
if (!target._namespace) {
|
|
50
50
|
target._namespace = {
|
|
51
|
-
__TAG__: "",
|
|
52
51
|
__INIT_EVENT__: /* @__PURE__ */ new Set(),
|
|
53
52
|
__EXPOSE_VAR__: /* @__PURE__ */ new Set(),
|
|
54
53
|
__IGNORE_VAR__: /* @__PURE__ */ new Set(),
|
|
@@ -218,15 +217,14 @@ function Pipe(v) {
|
|
|
218
217
|
__name(Pipe, "Pipe");
|
|
219
218
|
function Tag(tag) {
|
|
220
219
|
return (target) => {
|
|
221
|
-
|
|
222
|
-
target.prototype._namespace.__TAG__ = tag;
|
|
220
|
+
target.prototype.__TAG__ = tag;
|
|
223
221
|
};
|
|
224
222
|
}
|
|
225
223
|
__name(Tag, "Tag");
|
|
226
224
|
function Global(target) {
|
|
227
225
|
if (!globalThis.__PHECDA__)
|
|
228
226
|
globalThis.__PHECDA__ = {};
|
|
229
|
-
const tag = target.prototype.
|
|
227
|
+
const tag = target.prototype.__TAG__;
|
|
230
228
|
if (tag)
|
|
231
229
|
globalThis.__PHECDA__[tag] = target;
|
|
232
230
|
}
|
|
@@ -341,7 +339,7 @@ function Storage(storeKey) {
|
|
|
341
339
|
let tag;
|
|
342
340
|
if (key) {
|
|
343
341
|
init(target);
|
|
344
|
-
tag = storeKey || target.
|
|
342
|
+
tag = storeKey || target.__TAG__;
|
|
345
343
|
const uniTag = Symbol(tag);
|
|
346
344
|
setModalVar(target, uniTag);
|
|
347
345
|
regisHandler(target, uniTag, {
|
|
@@ -355,7 +353,7 @@ function Storage(storeKey) {
|
|
|
355
353
|
});
|
|
356
354
|
} else {
|
|
357
355
|
init(target.prototype);
|
|
358
|
-
tag = storeKey || `${target.prototype.
|
|
356
|
+
tag = storeKey || `${target.prototype.__TAG__}_${key}`;
|
|
359
357
|
const uniTag = Symbol(tag);
|
|
360
358
|
setModalVar(target.prototype, uniTag);
|
|
361
359
|
regisHandler(target.prototype, uniTag, {
|
package/dist/preset/index.js
CHANGED
|
@@ -45,7 +45,6 @@ module.exports = __toCommonJS(preset_exports);
|
|
|
45
45
|
function init(target) {
|
|
46
46
|
if (!target._namespace) {
|
|
47
47
|
target._namespace = {
|
|
48
|
-
__TAG__: "",
|
|
49
48
|
__INIT_EVENT__: /* @__PURE__ */ new Set(),
|
|
50
49
|
__EXPOSE_VAR__: /* @__PURE__ */ new Set(),
|
|
51
50
|
__IGNORE_VAR__: /* @__PURE__ */ new Set(),
|
package/dist/preset/index.mjs
CHANGED
|
@@ -5,7 +5,6 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
5
5
|
function init(target) {
|
|
6
6
|
if (!target._namespace) {
|
|
7
7
|
target._namespace = {
|
|
8
|
-
__TAG__: "",
|
|
9
8
|
__INIT_EVENT__: /* @__PURE__ */ new Set(),
|
|
10
9
|
__EXPOSE_VAR__: /* @__PURE__ */ new Set(),
|
|
11
10
|
__IGNORE_VAR__: /* @__PURE__ */ new Set(),
|