phecda-vue 4.0.4 → 4.0.6

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.mts CHANGED
@@ -7,7 +7,7 @@ declare class VuePhecda extends WebPhecda {
7
7
  vueApp: App;
8
8
  install(app: App): void;
9
9
  }
10
- declare function createPhecda(): VuePhecda;
10
+ declare function createPhecda(models?: Construct[]): VuePhecda;
11
11
 
12
12
  declare const RawSymbol: unique symbol;
13
13
  type Raw<T> = T & {
@@ -16,11 +16,9 @@ type Raw<T> = T & {
16
16
  type ReplaceInstanceValues<I> = {
17
17
  [P in keyof I]: I[P] extends (...args: any[]) => any ? I[P] : I[P] extends Raw<infer O> ? O : Ref<I[P]>;
18
18
  };
19
- type SchemaToObj<S> = {
20
- [P in keyof S]: S[P] extends object ? SchemaToObj<S[P]> : (S[P] extends string ? any : S[P]);
21
- };
22
19
 
23
20
  declare function useRaw<T extends Construct>(model: T): InstanceType<T>;
21
+ declare function getRaw<T extends Construct>(model: T): InstanceType<T>;
24
22
  declare function usePhecda(): VuePhecda;
25
23
  declare function getPhecda(phecda?: VuePhecda): VuePhecda;
26
24
  declare function useEvent<Key extends keyof Events>(eventName: Key, cb: (event: Events[Key]) => void): {
@@ -38,4 +36,4 @@ declare function WatchEffect(option?: WatchOptions): (proto: any, key: string) =
38
36
  declare function markRaw<T extends object>(value: T): Raw<T>;
39
37
  declare function createSharedReactive<F extends (...args: any) => any>(composable: F): () => ReturnType<F>;
40
38
 
41
- export { type Raw, RawSymbol, type ReplaceInstanceValues, type SchemaToObj, Shallow, VuePhecda, WatchEffect, createPhecda, createSharedReactive, getPhecda, getR, getV, markRaw, phecdaSymbol, useEvent, usePhecda, useR, useRaw, useV };
39
+ export { type Raw, RawSymbol, type ReplaceInstanceValues, Shallow, VuePhecda, WatchEffect, createPhecda, createSharedReactive, getPhecda, getR, getRaw, getV, markRaw, phecdaSymbol, useEvent, usePhecda, useR, useRaw, useV };
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ declare class VuePhecda extends WebPhecda {
7
7
  vueApp: App;
8
8
  install(app: App): void;
9
9
  }
10
- declare function createPhecda(): VuePhecda;
10
+ declare function createPhecda(models?: Construct[]): VuePhecda;
11
11
 
12
12
  declare const RawSymbol: unique symbol;
13
13
  type Raw<T> = T & {
@@ -16,11 +16,9 @@ type Raw<T> = T & {
16
16
  type ReplaceInstanceValues<I> = {
17
17
  [P in keyof I]: I[P] extends (...args: any[]) => any ? I[P] : I[P] extends Raw<infer O> ? O : Ref<I[P]>;
18
18
  };
19
- type SchemaToObj<S> = {
20
- [P in keyof S]: S[P] extends object ? SchemaToObj<S[P]> : (S[P] extends string ? any : S[P]);
21
- };
22
19
 
23
20
  declare function useRaw<T extends Construct>(model: T): InstanceType<T>;
21
+ declare function getRaw<T extends Construct>(model: T): InstanceType<T>;
24
22
  declare function usePhecda(): VuePhecda;
25
23
  declare function getPhecda(phecda?: VuePhecda): VuePhecda;
26
24
  declare function useEvent<Key extends keyof Events>(eventName: Key, cb: (event: Events[Key]) => void): {
@@ -38,4 +36,4 @@ declare function WatchEffect(option?: WatchOptions): (proto: any, key: string) =
38
36
  declare function markRaw<T extends object>(value: T): Raw<T>;
39
37
  declare function createSharedReactive<F extends (...args: any) => any>(composable: F): () => ReturnType<F>;
40
38
 
41
- export { type Raw, RawSymbol, type ReplaceInstanceValues, type SchemaToObj, Shallow, VuePhecda, WatchEffect, createPhecda, createSharedReactive, getPhecda, getR, getV, markRaw, phecdaSymbol, useEvent, usePhecda, useR, useRaw, useV };
39
+ export { type Raw, RawSymbol, type ReplaceInstanceValues, Shallow, VuePhecda, WatchEffect, createPhecda, createSharedReactive, getPhecda, getR, getRaw, getV, markRaw, phecdaSymbol, useEvent, usePhecda, useR, useRaw, useV };
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ __export(src_exports, {
29
29
  createSharedReactive: () => createSharedReactive,
30
30
  getPhecda: () => getPhecda,
31
31
  getR: () => getR,
32
+ getRaw: () => getRaw,
32
33
  getV: () => getV,
33
34
  markRaw: () => markRaw,
34
35
  phecdaSymbol: () => phecdaSymbol,
@@ -303,7 +304,7 @@ var VuePhecda = class extends import_phecda_web.WebPhecda {
303
304
  }
304
305
  }
305
306
  };
306
- function createPhecda() {
307
+ function createPhecda(models) {
307
308
  const phecda = new VuePhecda("vue", (instance) => {
308
309
  return (0, import_phecda_web.bindMethod)((0, import_phecda_web.get)(instance, "shallow") ? (0, import_vue.shallowReactive)(instance) : (0, import_vue.reactive)(instance), USE_DEVTOOLS ? (instance2, key) => {
309
310
  const cb = instance2[key].bind(instance2);
@@ -331,6 +332,7 @@ function createPhecda() {
331
332
  };
332
333
  } : void 0);
333
334
  });
335
+ models?.forEach((model) => phecda.init(model));
334
336
  return phecda;
335
337
  }
336
338
  __name(createPhecda, "createPhecda");
@@ -414,6 +416,10 @@ function useRaw(model) {
414
416
  return (0, import_vue3.toRaw)(useR(model));
415
417
  }
416
418
  __name(useRaw, "useRaw");
419
+ function getRaw(model) {
420
+ return (0, import_vue3.toRaw)(getR(model));
421
+ }
422
+ __name(getRaw, "getRaw");
417
423
  function usePhecda() {
418
424
  if (!(0, import_vue3.hasInjectionContext)()) throw new Error("[phecda-vue]: use hook inside component setup function");
419
425
  const activePhecda = (0, import_vue3.inject)(phecdaSymbol);
@@ -541,6 +547,7 @@ __name(WatchEffect, "WatchEffect");
541
547
  createSharedReactive,
542
548
  getPhecda,
543
549
  getR,
550
+ getRaw,
544
551
  getV,
545
552
  markRaw,
546
553
  phecdaSymbol,
package/dist/index.mjs CHANGED
@@ -266,7 +266,7 @@ var VuePhecda = class extends WebPhecda {
266
266
  }
267
267
  }
268
268
  };
269
- function createPhecda() {
269
+ function createPhecda(models) {
270
270
  const phecda = new VuePhecda("vue", (instance) => {
271
271
  return bindMethod(get(instance, "shallow") ? shallowReactive(instance) : reactive(instance), USE_DEVTOOLS ? (instance2, key) => {
272
272
  const cb = instance2[key].bind(instance2);
@@ -294,6 +294,7 @@ function createPhecda() {
294
294
  };
295
295
  } : void 0);
296
296
  });
297
+ models?.forEach((model) => phecda.init(model));
297
298
  return phecda;
298
299
  }
299
300
  __name(createPhecda, "createPhecda");
@@ -377,6 +378,10 @@ function useRaw(model) {
377
378
  return toRaw2(useR(model));
378
379
  }
379
380
  __name(useRaw, "useRaw");
381
+ function getRaw(model) {
382
+ return toRaw2(getR(model));
383
+ }
384
+ __name(getRaw, "getRaw");
380
385
  function usePhecda() {
381
386
  if (!hasInjectionContext()) throw new Error("[phecda-vue]: use hook inside component setup function");
382
387
  const activePhecda = inject(phecdaSymbol);
@@ -503,6 +508,7 @@ export {
503
508
  createSharedReactive,
504
509
  getPhecda,
505
510
  getR,
511
+ getRaw,
506
512
  getV,
507
513
  markRaw,
508
514
  phecdaSymbol,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-vue",
3
- "version": "4.0.4",
3
+ "version": "4.0.6",
4
4
  "description": "provide phecda function to vue",
5
5
  "author": "fgsreally",
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@vue/devtools-api": "^6.6.3",
20
20
  "vue": "^3.2.45",
21
- "phecda-web": "2.0.4"
21
+ "phecda-web": "2.0.6"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@vue/test-utils": "^2.4.6",