phecda-core 1.3.1 → 1.4.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 +3 -2
- package/dist/index.global.js +20 -3
- package/dist/index.js +22 -4
- package/dist/index.mjs +20 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -75,9 +75,10 @@ declare function Rule(rule: RegExp | string | Function | number, info: string, m
|
|
|
75
75
|
declare function Ignore(target: any, key: PropertyKey): void;
|
|
76
76
|
declare function Clear(target: any, key: PropertyKey): void;
|
|
77
77
|
declare function Err<Fn extends (...args: any) => any>(cb: Fn): (target: any, key: PropertyKey) => void;
|
|
78
|
-
declare function
|
|
78
|
+
declare function Expose(target: any, key: PropertyKey): void;
|
|
79
79
|
declare function Pipe(v: ReturnType<typeof to>): (obj: any, key: PropertyKey) => void;
|
|
80
80
|
declare function Tag(tag: string): (target: any) => void;
|
|
81
|
+
declare function Assign(cb: (instance?: any) => any): (target: any) => void;
|
|
81
82
|
declare function Global(target: any): void;
|
|
82
83
|
|
|
83
84
|
declare function validate(p: RegExp | string | Function | Object | Number, v: any): Promise<any>;
|
|
@@ -110,4 +111,4 @@ declare function Watcher(eventName: keyof Events, options?: {
|
|
|
110
111
|
}): (obj: any, key: string) => void;
|
|
111
112
|
declare function Storage(storeKey?: string): (target: any, key?: PropertyKey) => void;
|
|
112
113
|
|
|
113
|
-
export { ClassValue, Clear, Err, Events, Global, Ignore, Init, NameSpace,
|
|
114
|
+
export { Assign, ClassValue, Clear, Err, Events, Expose, Global, Ignore, Init, NameSpace, 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
|
@@ -22,12 +22,13 @@ var Phecda = (() => {
|
|
|
22
22
|
// src/index.ts
|
|
23
23
|
var src_exports = {};
|
|
24
24
|
__export(src_exports, {
|
|
25
|
+
Assign: () => Assign,
|
|
25
26
|
Clear: () => Clear,
|
|
26
27
|
Err: () => Err,
|
|
28
|
+
Expose: () => Expose,
|
|
27
29
|
Global: () => Global,
|
|
28
30
|
Ignore: () => Ignore,
|
|
29
31
|
Init: () => Init,
|
|
30
|
-
P: () => P,
|
|
31
32
|
Pipe: () => Pipe,
|
|
32
33
|
Rule: () => Rule,
|
|
33
34
|
Storage: () => Storage,
|
|
@@ -259,10 +260,10 @@ var Phecda = (() => {
|
|
|
259
260
|
};
|
|
260
261
|
}
|
|
261
262
|
__name(Err, "Err");
|
|
262
|
-
function
|
|
263
|
+
function Expose(target, key) {
|
|
263
264
|
setExposeKey(target, key);
|
|
264
265
|
}
|
|
265
|
-
__name(
|
|
266
|
+
__name(Expose, "Expose");
|
|
266
267
|
function Pipe(v) {
|
|
267
268
|
return (obj, key) => {
|
|
268
269
|
setModalVar(obj, key);
|
|
@@ -282,6 +283,22 @@ var Phecda = (() => {
|
|
|
282
283
|
};
|
|
283
284
|
}
|
|
284
285
|
__name(Tag, "Tag");
|
|
286
|
+
function Assign(cb) {
|
|
287
|
+
return (target) => {
|
|
288
|
+
init(target.prototype);
|
|
289
|
+
setModalVar(target.prototype, "__CLASS");
|
|
290
|
+
regisHandler(target.prototype, "__CLASS", {
|
|
291
|
+
init: async (instance) => {
|
|
292
|
+
const value = await cb(instance);
|
|
293
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
294
|
+
for (const i in value)
|
|
295
|
+
instance[i] = value[i];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
__name(Assign, "Assign");
|
|
285
302
|
function Global(target) {
|
|
286
303
|
if (!globalThis.__PHECDA__)
|
|
287
304
|
globalThis.__PHECDA__ = {};
|
package/dist/index.js
CHANGED
|
@@ -21,12 +21,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
var src_exports = {};
|
|
23
23
|
__export(src_exports, {
|
|
24
|
+
Assign: () => Assign,
|
|
24
25
|
Clear: () => Clear,
|
|
25
26
|
Err: () => Err,
|
|
27
|
+
Expose: () => Expose,
|
|
26
28
|
Global: () => Global,
|
|
27
29
|
Ignore: () => Ignore,
|
|
28
30
|
Init: () => Init,
|
|
29
|
-
P: () => P,
|
|
30
31
|
Pipe: () => Pipe,
|
|
31
32
|
Rule: () => Rule,
|
|
32
33
|
Storage: () => Storage,
|
|
@@ -259,10 +260,10 @@ function Err(cb) {
|
|
|
259
260
|
};
|
|
260
261
|
}
|
|
261
262
|
__name(Err, "Err");
|
|
262
|
-
function
|
|
263
|
+
function Expose(target, key) {
|
|
263
264
|
setExposeKey(target, key);
|
|
264
265
|
}
|
|
265
|
-
__name(
|
|
266
|
+
__name(Expose, "Expose");
|
|
266
267
|
function Pipe(v) {
|
|
267
268
|
return (obj, key) => {
|
|
268
269
|
setModalVar(obj, key);
|
|
@@ -282,6 +283,22 @@ function Tag(tag) {
|
|
|
282
283
|
};
|
|
283
284
|
}
|
|
284
285
|
__name(Tag, "Tag");
|
|
286
|
+
function Assign(cb) {
|
|
287
|
+
return (target) => {
|
|
288
|
+
init(target.prototype);
|
|
289
|
+
setModalVar(target.prototype, "__CLASS");
|
|
290
|
+
regisHandler(target.prototype, "__CLASS", {
|
|
291
|
+
init: async (instance) => {
|
|
292
|
+
const value = await cb(instance);
|
|
293
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
294
|
+
for (const i in value)
|
|
295
|
+
instance[i] = value[i];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
__name(Assign, "Assign");
|
|
285
302
|
function Global(target) {
|
|
286
303
|
if (!globalThis.__PHECDA__)
|
|
287
304
|
globalThis.__PHECDA__ = {};
|
|
@@ -432,12 +449,13 @@ function Storage(storeKey) {
|
|
|
432
449
|
__name(Storage, "Storage");
|
|
433
450
|
// Annotate the CommonJS export names for ESM import in node:
|
|
434
451
|
0 && (module.exports = {
|
|
452
|
+
Assign,
|
|
435
453
|
Clear,
|
|
436
454
|
Err,
|
|
455
|
+
Expose,
|
|
437
456
|
Global,
|
|
438
457
|
Ignore,
|
|
439
458
|
Init,
|
|
440
|
-
P,
|
|
441
459
|
Pipe,
|
|
442
460
|
Rule,
|
|
443
461
|
Storage,
|
package/dist/index.mjs
CHANGED
|
@@ -198,10 +198,10 @@ function Err(cb) {
|
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
200
|
__name(Err, "Err");
|
|
201
|
-
function
|
|
201
|
+
function Expose(target, key) {
|
|
202
202
|
setExposeKey(target, key);
|
|
203
203
|
}
|
|
204
|
-
__name(
|
|
204
|
+
__name(Expose, "Expose");
|
|
205
205
|
function Pipe(v) {
|
|
206
206
|
return (obj, key) => {
|
|
207
207
|
setModalVar(obj, key);
|
|
@@ -221,6 +221,22 @@ function Tag(tag) {
|
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
223
|
__name(Tag, "Tag");
|
|
224
|
+
function Assign(cb) {
|
|
225
|
+
return (target) => {
|
|
226
|
+
init(target.prototype);
|
|
227
|
+
setModalVar(target.prototype, "__CLASS");
|
|
228
|
+
regisHandler(target.prototype, "__CLASS", {
|
|
229
|
+
init: async (instance) => {
|
|
230
|
+
const value = await cb(instance);
|
|
231
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
232
|
+
for (const i in value)
|
|
233
|
+
instance[i] = value[i];
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
__name(Assign, "Assign");
|
|
224
240
|
function Global(target) {
|
|
225
241
|
if (!globalThis.__PHECDA__)
|
|
226
242
|
globalThis.__PHECDA__ = {};
|
|
@@ -370,12 +386,13 @@ function Storage(storeKey) {
|
|
|
370
386
|
}
|
|
371
387
|
__name(Storage, "Storage");
|
|
372
388
|
export {
|
|
389
|
+
Assign,
|
|
373
390
|
Clear,
|
|
374
391
|
Err,
|
|
392
|
+
Expose,
|
|
375
393
|
Global,
|
|
376
394
|
Ignore,
|
|
377
395
|
Init,
|
|
378
|
-
P,
|
|
379
396
|
Pipe,
|
|
380
397
|
Rule,
|
|
381
398
|
Storage,
|