@razaman2/reactive-view 0.1.0-beta.7 → 0.1.0-beta.9

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.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.7";
180
+ var version = "0.1.0-beta.9";
181
181
  var package_default = {
182
182
  name: "@razaman2/reactive-view",
183
183
  version,
@@ -396,33 +396,40 @@ var ReactiveView_default = {
396
396
  }
397
397
  }, config2.options));
398
398
  }
399
- setTimeout(async () => {
400
- var _a3, _b2, _c2;
401
- if (props.model !== false && (isFunctionData || isAsyncData)) {
402
- if (!("defaultData" in vue.vnode.props)) {
403
- console.warn(`${props.modelName}: defaultData is required for promise or function data.`, props.data);
399
+ const track = (source, options = {}) => {
400
+ var _a3, _b2, _c2, _d, _e;
401
+ subscriptions.push((0, import_vue.watch)(source, async (after, before) => {
402
+ const diff2 = access(component).diff(import_object_manager.default.on(before), import_object_manager.default.on(after));
403
+ const callback = context.attrs["data:callback"];
404
+ if (props.debug) {
405
+ console.warn(`[${props.modelName}]:data`, { diff: diff2, callback, before, after, props, context, component });
404
406
  }
405
- const [data] = isAsyncData ? await Promise.all([
406
- isAsyncFunctionData ? props.data() : props.data,
407
- (_a3 = defer.value) != null ? _a3 : true
408
- ]) : [props.data];
409
- const source = typeof data === "function" ? data : (() => data);
410
- subscriptions.push((0, import_vue.watch)(source, async (after, before) => {
411
- const diff2 = access(component).diff(import_object_manager.default.on(before), import_object_manager.default.on(after));
412
- const callback = context.attrs["data:callback"];
413
- if (props.debug) {
414
- console.warn(`[${props.modelName}]:data`, { diff: diff2, data, callback, before, after, props, context, component });
415
- }
416
- if (typeof callback === "function") {
417
- callback(diff2, { component });
418
- } else {
419
- model.replaceData(after);
407
+ if (typeof callback === "function") {
408
+ callback(diff2, { component });
409
+ } else {
410
+ model.replaceData(after);
411
+ }
412
+ }, {
413
+ immediate: (_b2 = (_a3 = context.attrs["data:immediate"]) != null ? _a3 : options.immediate) != null ? _b2 : true,
414
+ deep: (_d = (_c2 = context.attrs["data:deep"]) != null ? _c2 : options.deep) != null ? _d : true,
415
+ once: (_e = context.attrs["data:once"]) != null ? _e : options.once
416
+ }));
417
+ };
418
+ setTimeout(async () => {
419
+ var _a3;
420
+ if (props.model !== false) {
421
+ if (isFunctionData || isAsyncData) {
422
+ if (!("defaultData" in vue.vnode.props)) {
423
+ console.warn(`${props.modelName}: defaultData is required for promise or function data.`, props.data);
420
424
  }
421
- }, {
422
- immediate: (_b2 = context.attrs["data:immediate"]) != null ? _b2 : true,
423
- deep: (_c2 = context.attrs["data:deep"]) != null ? _c2 : true,
424
- once: context.attrs["data:once"]
425
- }));
425
+ const [data] = isAsyncData ? await Promise.all([
426
+ isAsyncFunctionData ? props.data() : props.data,
427
+ (_a3 = defer.value) != null ? _a3 : true
428
+ ]) : [props.data];
429
+ track(typeof data === "function" ? data : (() => data));
430
+ } else {
431
+ track((0, import_vue.isRef)(props.data) || (0, import_vue.isReactive)(props.data) ? props.data : () => props.data, { immediate: false, deep: false });
432
+ }
426
433
  }
427
434
  });
428
435
  setTimeout(async () => {
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.7";
133
+ var version = "0.1.0-beta.9";
134
134
  var package_default = {
135
135
  name: "@razaman2/reactive-view",
136
136
  version,
@@ -349,33 +349,40 @@ var ReactiveView_default = {
349
349
  }
350
350
  }, config2.options));
351
351
  }
352
- setTimeout(async () => {
353
- var _a3, _b2, _c2;
354
- if (props.model !== false && (isFunctionData || isAsyncData)) {
355
- if (!("defaultData" in vue.vnode.props)) {
356
- console.warn(`${props.modelName}: defaultData is required for promise or function data.`, props.data);
352
+ const track = (source, options = {}) => {
353
+ var _a3, _b2, _c2, _d, _e;
354
+ subscriptions.push(watch(source, async (after, before) => {
355
+ const diff2 = access(component).diff(ObjectManager.on(before), ObjectManager.on(after));
356
+ const callback = context.attrs["data:callback"];
357
+ if (props.debug) {
358
+ console.warn(`[${props.modelName}]:data`, { diff: diff2, callback, before, after, props, context, component });
357
359
  }
358
- const [data] = isAsyncData ? await Promise.all([
359
- isAsyncFunctionData ? props.data() : props.data,
360
- (_a3 = defer.value) != null ? _a3 : true
361
- ]) : [props.data];
362
- const source = typeof data === "function" ? data : (() => data);
363
- subscriptions.push(watch(source, async (after, before) => {
364
- const diff2 = access(component).diff(ObjectManager.on(before), ObjectManager.on(after));
365
- const callback = context.attrs["data:callback"];
366
- if (props.debug) {
367
- console.warn(`[${props.modelName}]:data`, { diff: diff2, data, callback, before, after, props, context, component });
368
- }
369
- if (typeof callback === "function") {
370
- callback(diff2, { component });
371
- } else {
372
- model.replaceData(after);
360
+ if (typeof callback === "function") {
361
+ callback(diff2, { component });
362
+ } else {
363
+ model.replaceData(after);
364
+ }
365
+ }, {
366
+ immediate: (_b2 = (_a3 = context.attrs["data:immediate"]) != null ? _a3 : options.immediate) != null ? _b2 : true,
367
+ deep: (_d = (_c2 = context.attrs["data:deep"]) != null ? _c2 : options.deep) != null ? _d : true,
368
+ once: (_e = context.attrs["data:once"]) != null ? _e : options.once
369
+ }));
370
+ };
371
+ setTimeout(async () => {
372
+ var _a3;
373
+ if (props.model !== false) {
374
+ if (isFunctionData || isAsyncData) {
375
+ if (!("defaultData" in vue.vnode.props)) {
376
+ console.warn(`${props.modelName}: defaultData is required for promise or function data.`, props.data);
373
377
  }
374
- }, {
375
- immediate: (_b2 = context.attrs["data:immediate"]) != null ? _b2 : true,
376
- deep: (_c2 = context.attrs["data:deep"]) != null ? _c2 : true,
377
- once: context.attrs["data:once"]
378
- }));
378
+ const [data] = isAsyncData ? await Promise.all([
379
+ isAsyncFunctionData ? props.data() : props.data,
380
+ (_a3 = defer.value) != null ? _a3 : true
381
+ ]) : [props.data];
382
+ track(typeof data === "function" ? data : (() => data));
383
+ } else {
384
+ track(isRef(props.data) || isReactive(props.data) ? props.data : () => props.data, { immediate: false, deep: false });
385
+ }
379
386
  }
380
387
  });
381
388
  setTimeout(async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razaman2/reactive-view",
3
- "version": "0.1.0-beta.7",
3
+ "version": "0.1.0-beta.9",
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",