@razaman2/reactive-view 0.1.0-beta.13 → 0.1.0-beta.14

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
@@ -126,8 +126,8 @@ declare function useSubscription(): {
126
126
  };
127
127
  declare const Prop: ({ default: value, type, validator, required }?: Partial<PropType>) => {
128
128
  required: boolean | undefined;
129
- validator: (value: any) => boolean;
130
- default?: vue.Ref<any, any> | undefined;
129
+ validator: (value: any) => boolean | undefined;
130
+ default?: any;
131
131
  };
132
132
  declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
133
133
  declare function MergeStyles(...params: any): any;
package/dist/index.d.ts CHANGED
@@ -126,8 +126,8 @@ declare function useSubscription(): {
126
126
  };
127
127
  declare const Prop: ({ default: value, type, validator, required }?: Partial<PropType>) => {
128
128
  required: boolean | undefined;
129
- validator: (value: any) => boolean;
130
- default?: vue.Ref<any, any> | undefined;
129
+ validator: (value: any) => boolean | undefined;
130
+ default?: any;
131
131
  };
132
132
  declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
133
133
  declare function MergeStyles(...params: any): any;
package/dist/index.js CHANGED
@@ -177,7 +177,7 @@ var import_data_manager = __toESM(require("@razaman2/data-manager"));
177
177
  var import_vue = require("vue");
178
178
 
179
179
  // package.json
180
- var version = "0.1.0-beta.13";
180
+ var version = "0.1.0-beta.14";
181
181
  var package_default = {
182
182
  name: "@razaman2/reactive-view",
183
183
  version,
@@ -376,9 +376,6 @@ var ReactiveView_default = {
376
376
  };
377
377
  const model = props.model ? typeof props.model === "function" ? props.model(config) : props.model : import_data_manager.default.setConfig({ beforeGetData: (data) => (0, import_vue.isRef)(data) ? (0, import_vue.unref)(data) : data }, config);
378
378
  const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, diff, emit, dataPath: dataPath2, model: proxy(model), isValid } });
379
- if (props.debug) {
380
- console.warn(`[${props.modelName}]:data`, { props, context, component, config, model });
381
- }
382
379
  if (context.attrs["onUpdate:model"] || context.attrs["update:model"]) {
383
380
  const config2 = {
384
381
  callback: typeof context.attrs["onUpdate:model"] === "function" ? context.attrs["onUpdate:model"] : context.attrs["update:model"],
@@ -400,10 +397,7 @@ var ReactiveView_default = {
400
397
  }, config2.options));
401
398
  }
402
399
  const track = (source, options = {}) => {
403
- var _a3, _b2, _c2, _d;
404
- if (props.debug) {
405
- console.log(`log props.data:`, source, options);
406
- }
400
+ var _a3, _b2, _c2, _d, _e;
407
401
  subscriptions.push((0, import_vue.watch)(source, async (after, before) => {
408
402
  const diff2 = access(component).diff(import_object_manager.default.on(before), import_object_manager.default.on(after));
409
403
  const callback = context.attrs["data:callback"];
@@ -414,8 +408,8 @@ var ReactiveView_default = {
414
408
  }
415
409
  }, {
416
410
  immediate: (_b2 = (_a3 = context.attrs["data:immediate"]) != null ? _a3 : options.immediate) != null ? _b2 : true,
417
- deep: (_c2 = context.attrs["data:deep"]) != null ? _c2 : options.deep,
418
- once: (_d = context.attrs["data:once"]) != null ? _d : options.once
411
+ deep: (_d = (_c2 = context.attrs["data:deep"]) != null ? _c2 : options.deep) != null ? _d : true,
412
+ once: (_e = context.attrs["data:once"]) != null ? _e : options.once
419
413
  }));
420
414
  };
421
415
  setTimeout(async () => {
@@ -431,7 +425,7 @@ var ReactiveView_default = {
431
425
  ]) : [props.data];
432
426
  track(typeof data === "function" ? data : (() => data));
433
427
  } else {
434
- track((0, import_vue.isRef)(props.data) || (0, import_vue.isReactive)(props.data) ? props.data : () => props.data, { immediate: false });
428
+ track((0, import_vue.isRef)(props.data) || (0, import_vue.isReactive)(props.data) ? props.data : () => props.data, { immediate: false, deep: false });
435
429
  }
436
430
  }
437
431
  });
@@ -781,12 +775,16 @@ function useSubscription() {
781
775
  var Prop = ({ default: value, type, validator, required } = {}) => {
782
776
  const types1 = Array.isArray(type) ? type : [type != null ? type : Array];
783
777
  const types2 = types1.includes(Object) ? types1 : types1.concat(Object);
784
- return __spreadProps(__spreadValues({}, value ? { default: (0, import_vue2.ref)(value) } : {}), {
778
+ return __spreadProps(__spreadValues({}, value ? { default: (0, import_vue2.isRef)(value) || (0, import_vue2.isReactive)(value) ? value : (0, import_vue2.ref)(value) } : {}), {
785
779
  required,
786
780
  validator: (value2) => {
787
- return validator ? validator((0, import_vue2.unref)(value2)) : Array.from(new Set(types2.map((type2) => {
788
- return typeof type2 === "function" ? type2().constructor.name : type2;
789
- }))).includes((0, import_vue2.unref)(value2).constructor.name);
781
+ try {
782
+ return validator ? validator((0, import_vue2.unref)(value2)) : Array.from(new Set(types2.map((type2) => {
783
+ return typeof type2 === "function" ? type2().constructor.name : type2;
784
+ }))).includes((0, import_vue2.unref)(value2).constructor.name);
785
+ } catch (e) {
786
+ return required;
787
+ }
790
788
  }
791
789
  });
792
790
  };
package/dist/index.mjs CHANGED
@@ -130,7 +130,7 @@ import DataManager from "@razaman2/data-manager";
130
130
  import { ref, reactive, watch, unref, isRef, isReactive, createVNode, getCurrentInstance, onBeforeUnmount } from "vue";
131
131
 
132
132
  // package.json
133
- var version = "0.1.0-beta.13";
133
+ var version = "0.1.0-beta.14";
134
134
  var package_default = {
135
135
  name: "@razaman2/reactive-view",
136
136
  version,
@@ -329,9 +329,6 @@ var ReactiveView_default = {
329
329
  };
330
330
  const model = props.model ? typeof props.model === "function" ? props.model(config) : props.model : DataManager.setConfig({ beforeGetData: (data) => isRef(data) ? unref(data) : data }, config);
331
331
  const component = ref({ parent: { self: vue.proxy }, self: { template, diff, emit, dataPath: dataPath2, model: proxy(model), isValid } });
332
- if (props.debug) {
333
- console.warn(`[${props.modelName}]:data`, { props, context, component, config, model });
334
- }
335
332
  if (context.attrs["onUpdate:model"] || context.attrs["update:model"]) {
336
333
  const config2 = {
337
334
  callback: typeof context.attrs["onUpdate:model"] === "function" ? context.attrs["onUpdate:model"] : context.attrs["update:model"],
@@ -353,10 +350,7 @@ var ReactiveView_default = {
353
350
  }, config2.options));
354
351
  }
355
352
  const track = (source, options = {}) => {
356
- var _a3, _b2, _c2, _d;
357
- if (props.debug) {
358
- console.log(`log props.data:`, source, options);
359
- }
353
+ var _a3, _b2, _c2, _d, _e;
360
354
  subscriptions.push(watch(source, async (after, before) => {
361
355
  const diff2 = access(component).diff(ObjectManager.on(before), ObjectManager.on(after));
362
356
  const callback = context.attrs["data:callback"];
@@ -367,8 +361,8 @@ var ReactiveView_default = {
367
361
  }
368
362
  }, {
369
363
  immediate: (_b2 = (_a3 = context.attrs["data:immediate"]) != null ? _a3 : options.immediate) != null ? _b2 : true,
370
- deep: (_c2 = context.attrs["data:deep"]) != null ? _c2 : options.deep,
371
- once: (_d = context.attrs["data:once"]) != null ? _d : options.once
364
+ deep: (_d = (_c2 = context.attrs["data:deep"]) != null ? _c2 : options.deep) != null ? _d : true,
365
+ once: (_e = context.attrs["data:once"]) != null ? _e : options.once
372
366
  }));
373
367
  };
374
368
  setTimeout(async () => {
@@ -384,7 +378,7 @@ var ReactiveView_default = {
384
378
  ]) : [props.data];
385
379
  track(typeof data === "function" ? data : (() => data));
386
380
  } else {
387
- track(isRef(props.data) || isReactive(props.data) ? props.data : () => props.data, { immediate: false });
381
+ track(isRef(props.data) || isReactive(props.data) ? props.data : () => props.data, { immediate: false, deep: false });
388
382
  }
389
383
  }
390
384
  });
@@ -598,7 +592,7 @@ var ReactiveView_default = {
598
592
  };
599
593
 
600
594
  // src/index.ts
601
- import { h, ref as ref2, unref as unref2, toRaw, createApp, createVNode as createVNode2, defineComponent } from "vue";
595
+ import { h, ref as ref2, unref as unref2, toRaw, isRef as isRef2, isReactive as isReactive2, createApp, createVNode as createVNode2, defineComponent } from "vue";
602
596
  import { formatInTimeZone } from "date-fns-tz";
603
597
  import { twMerge } from "tailwind-merge";
604
598
  console.log(`%c[ReactiveView]: ${version}`, "background-color: red; color: yellow;");
@@ -734,12 +728,16 @@ function useSubscription() {
734
728
  var Prop = ({ default: value, type, validator, required } = {}) => {
735
729
  const types1 = Array.isArray(type) ? type : [type != null ? type : Array];
736
730
  const types2 = types1.includes(Object) ? types1 : types1.concat(Object);
737
- return __spreadProps(__spreadValues({}, value ? { default: ref2(value) } : {}), {
731
+ return __spreadProps(__spreadValues({}, value ? { default: isRef2(value) || isReactive2(value) ? value : ref2(value) } : {}), {
738
732
  required,
739
733
  validator: (value2) => {
740
- return validator ? validator(unref2(value2)) : Array.from(new Set(types2.map((type2) => {
741
- return typeof type2 === "function" ? type2().constructor.name : type2;
742
- }))).includes(unref2(value2).constructor.name);
734
+ try {
735
+ return validator ? validator(unref2(value2)) : Array.from(new Set(types2.map((type2) => {
736
+ return typeof type2 === "function" ? type2().constructor.name : type2;
737
+ }))).includes(unref2(value2).constructor.name);
738
+ } catch (e) {
739
+ return required;
740
+ }
743
741
  }
744
742
  });
745
743
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razaman2/reactive-view",
3
- "version": "0.1.0-beta.13",
3
+ "version": "0.1.0-beta.14",
4
4
  "description": "This library enables you to build vue apps in an object oriented way. It provides a convenient approach to extend and override ui components. It provides a built in eventing system along with component data management.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",