phecda-vue 3.0.0-beta.16 → 3.0.0-beta.18

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 CHANGED
@@ -50,17 +50,17 @@ declare function isObject(o: any): boolean;
50
50
  declare function mergeReactiveObjects<T extends Record<any, unknown> | Map<unknown, unknown> | Set<unknown>>(target: T, patchToApply: DeepPartial<T>): T;
51
51
  declare function createSharedReactive<F extends (...args: any) => any>(composable: F): () => ReturnType<F>;
52
52
 
53
- declare function useO<T extends Construct>(module: T): UnwrapNestedRefs<InstanceType<T>>;
54
- declare function useRaw<T extends Construct>(module: T): InstanceType<T>;
55
- declare function usePatch<T extends Construct>(module: T, Data: DeepPartial<InstanceType<T>>): void;
56
- declare function useR<T extends Construct>(module: T): UnwrapNestedRefs<InstanceType<T>>;
57
- declare function useV<T extends Construct>(module: T): ReplaceInstanceValues<InstanceType<T>>;
53
+ declare function useO<T extends Construct>(model: T): UnwrapNestedRefs<InstanceType<T>>;
54
+ declare function useRaw<T extends Construct>(model: T): InstanceType<T>;
55
+ declare function usePatch<T extends Construct>(model: T, Data: DeepPartial<InstanceType<T>>): void;
56
+ declare function useR<T extends Construct>(model: T): UnwrapNestedRefs<InstanceType<T>>;
57
+ declare function useV<T extends Construct>(model: T): ReplaceInstanceValues<InstanceType<T>>;
58
58
  declare function useEvent<Key extends keyof Events>(eventName: Key, cb: (event: Events[Key]) => void): {
59
59
  emit: (arg: Events[Key]) => void;
60
60
  cancel: () => void;
61
61
  };
62
- declare function initialize<M extends Construct>(module: M, deleteOtherProperty?: boolean): InstanceType<M> | void;
62
+ declare function initialize<M extends Construct>(model: M, deleteOtherProperty?: boolean): InstanceType<M> | void;
63
63
 
64
- declare function Shallow(module: any): void;
64
+ declare function Shallow(model: any): void;
65
65
 
66
66
  export { DeepPartial, RE, Raw, RawSymbol, ReplaceInstanceValues, SchemaToObj, Shallow, createFilter, createPhecda, createSharedReactive, initialize, isObject, markRaw, mergeReactiveObjects, phecdaSymbol, useEvent, useO, usePatch, useR, useRaw, useV };
package/dist/index.js CHANGED
@@ -222,40 +222,40 @@ __name(createSharedReactive, "createSharedReactive");
222
222
 
223
223
  // src/composable.ts
224
224
  var REF_SYMBOL = Symbol("ref");
225
- function useO(module2) {
225
+ function useO(model) {
226
226
  const { state, origin } = (0, import_phecda_web2.getActiveInstance)();
227
- const proxyFn = (0, import_phecda_web2.get)(module2.prototype, "shallow") ? import_vue4.shallowReactive : import_vue4.reactive;
228
- if ((0, import_phecda_web2.get)(module2.prototype, "isolate")) {
229
- const instance = proxyFn(new module2());
227
+ const proxyFn = (0, import_phecda_web2.get)(model.prototype, "shallow") ? import_vue4.shallowReactive : import_vue4.reactive;
228
+ if ((0, import_phecda_web2.get)(model.prototype, "isolate")) {
229
+ const instance = proxyFn(new model());
230
230
  instance._promise = (0, import_phecda_web2.invokeHandler)("init", instance);
231
231
  return instance;
232
232
  }
233
- const tag = (0, import_phecda_web2.getTag)(module2);
233
+ const tag = (0, import_phecda_web2.getTag)(model);
234
234
  if (!(tag in state)) {
235
- const instance = proxyFn(new module2());
235
+ const instance = proxyFn(new model());
236
236
  instance._promise = (0, import_phecda_web2.invokeHandler)("init", instance);
237
237
  state[tag] = instance;
238
- origin.set(instance, module2);
238
+ origin.set(instance, model);
239
239
  }
240
240
  return state[tag];
241
241
  }
242
242
  __name(useO, "useO");
243
- function useRaw(module2) {
244
- return (0, import_vue4.toRaw)(useO(module2));
243
+ function useRaw(model) {
244
+ return (0, import_vue4.toRaw)(useO(model));
245
245
  }
246
246
  __name(useRaw, "useRaw");
247
- function usePatch(module2, Data) {
248
- const instance = useO(module2);
247
+ function usePatch(model, Data) {
248
+ const instance = useO(model);
249
249
  mergeReactiveObjects(instance, Data);
250
250
  }
251
251
  __name(usePatch, "usePatch");
252
- function useR(module2) {
253
- return useO(module2);
252
+ function useR(model) {
253
+ return useO(model);
254
254
  }
255
255
  __name(useR, "useR");
256
- function useV(module2) {
256
+ function useV(model) {
257
257
  const { cache: cacheMap } = (0, import_phecda_web2.getActiveInstance)();
258
- const instance = useO(module2);
258
+ const instance = useO(model);
259
259
  const cache = cacheMap.get(instance) || {};
260
260
  if (cache[REF_SYMBOL])
261
261
  return cache[REF_SYMBOL];
@@ -263,7 +263,7 @@ function useV(module2) {
263
263
  get(target, key) {
264
264
  if (typeof target[key] === "function") {
265
265
  if (!cache[key])
266
- cache[key] = target[key].bind(this);
266
+ cache[key] = target[key].bind(target);
267
267
  return cache[key];
268
268
  }
269
269
  if (target[key]?.__v_skip)
@@ -297,9 +297,9 @@ function useEvent(eventName, cb) {
297
297
  };
298
298
  }
299
299
  __name(useEvent, "useEvent");
300
- function initialize(module2, deleteOtherProperty = true) {
301
- const instance = useO(module2);
302
- const newInstance = new module2();
300
+ function initialize(model, deleteOtherProperty = true) {
301
+ const instance = useO(model);
302
+ const newInstance = new model();
303
303
  Object.assign(instance, newInstance);
304
304
  if (deleteOtherProperty) {
305
305
  for (const key in instance) {
@@ -312,8 +312,8 @@ __name(initialize, "initialize");
312
312
 
313
313
  // src/decorator.ts
314
314
  var import_phecda_web3 = require("phecda-web");
315
- function Shallow(module2) {
316
- (0, import_phecda_web3.set)(module2.prototype, "shallow", true);
315
+ function Shallow(model) {
316
+ (0, import_phecda_web3.set)(model.prototype, "shallow", true);
317
317
  }
318
318
  __name(Shallow, "Shallow");
319
319
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -182,40 +182,40 @@ __name(createSharedReactive, "createSharedReactive");
182
182
 
183
183
  // src/composable.ts
184
184
  var REF_SYMBOL = Symbol("ref");
185
- function useO(module) {
185
+ function useO(model) {
186
186
  const { state, origin } = getActiveInstance2();
187
- const proxyFn = get(module.prototype, "shallow") ? shallowReactive : reactive;
188
- if (get(module.prototype, "isolate")) {
189
- const instance = proxyFn(new module());
187
+ const proxyFn = get(model.prototype, "shallow") ? shallowReactive : reactive;
188
+ if (get(model.prototype, "isolate")) {
189
+ const instance = proxyFn(new model());
190
190
  instance._promise = invokeHandler2("init", instance);
191
191
  return instance;
192
192
  }
193
- const tag = getTag(module);
193
+ const tag = getTag(model);
194
194
  if (!(tag in state)) {
195
- const instance = proxyFn(new module());
195
+ const instance = proxyFn(new model());
196
196
  instance._promise = invokeHandler2("init", instance);
197
197
  state[tag] = instance;
198
- origin.set(instance, module);
198
+ origin.set(instance, model);
199
199
  }
200
200
  return state[tag];
201
201
  }
202
202
  __name(useO, "useO");
203
- function useRaw(module) {
204
- return toRaw(useO(module));
203
+ function useRaw(model) {
204
+ return toRaw(useO(model));
205
205
  }
206
206
  __name(useRaw, "useRaw");
207
- function usePatch(module, Data) {
208
- const instance = useO(module);
207
+ function usePatch(model, Data) {
208
+ const instance = useO(model);
209
209
  mergeReactiveObjects(instance, Data);
210
210
  }
211
211
  __name(usePatch, "usePatch");
212
- function useR(module) {
213
- return useO(module);
212
+ function useR(model) {
213
+ return useO(model);
214
214
  }
215
215
  __name(useR, "useR");
216
- function useV(module) {
216
+ function useV(model) {
217
217
  const { cache: cacheMap } = getActiveInstance2();
218
- const instance = useO(module);
218
+ const instance = useO(model);
219
219
  const cache = cacheMap.get(instance) || {};
220
220
  if (cache[REF_SYMBOL])
221
221
  return cache[REF_SYMBOL];
@@ -223,7 +223,7 @@ function useV(module) {
223
223
  get(target, key) {
224
224
  if (typeof target[key] === "function") {
225
225
  if (!cache[key])
226
- cache[key] = target[key].bind(this);
226
+ cache[key] = target[key].bind(target);
227
227
  return cache[key];
228
228
  }
229
229
  if (target[key]?.__v_skip)
@@ -257,9 +257,9 @@ function useEvent(eventName, cb) {
257
257
  };
258
258
  }
259
259
  __name(useEvent, "useEvent");
260
- function initialize(module, deleteOtherProperty = true) {
261
- const instance = useO(module);
262
- const newInstance = new module();
260
+ function initialize(model, deleteOtherProperty = true) {
261
+ const instance = useO(model);
262
+ const newInstance = new model();
263
263
  Object.assign(instance, newInstance);
264
264
  if (deleteOtherProperty) {
265
265
  for (const key in instance) {
@@ -272,8 +272,8 @@ __name(initialize, "initialize");
272
272
 
273
273
  // src/decorator.ts
274
274
  import { set } from "phecda-web";
275
- function Shallow(module) {
276
- set(module.prototype, "shallow", true);
275
+ function Shallow(model) {
276
+ set(model.prototype, "shallow", true);
277
277
  }
278
278
  __name(Shallow, "Shallow");
279
279
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-vue",
3
- "version": "3.0.0-beta.16",
3
+ "version": "3.0.0-beta.18",
4
4
  "description": "provide phecda function to vue",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -13,7 +13,7 @@
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
15
  "vue": "^3.2.45",
16
- "phecda-web": "1.0.1-beta.10"
16
+ "phecda-web": "1.0.1-beta.11"
17
17
  },
18
18
  "devDependencies": {
19
19
  "tsup": "^6.5.0"