@razaman2/reactive-view 0.0.34-beta.1 → 0.0.34-beta.2

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
@@ -168,7 +168,7 @@ var import_vue = require("vue");
168
168
 
169
169
  // package.json
170
170
  var name = "@razaman2/reactive-view";
171
- var version = "0.0.34-beta.1";
171
+ var version = "0.0.34-beta.2";
172
172
 
173
173
  // src/ReactiveView.ts
174
174
  var setup = {
@@ -212,7 +212,7 @@ var ReactiveView_default = {
212
212
  }
213
213
  },
214
214
  setup(props, context) {
215
- var _a, _b, _c, _d, _e, _f, _g, _h;
215
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
216
216
  const template = (component2, vue2) => {
217
217
  return (0, import_vue.createVNode)(
218
218
  "div",
@@ -229,9 +229,6 @@ var ReactiveView_default = {
229
229
  const isPromiseData = ["Promise"].includes(((_c = props.data) != null ? _c : {}).constructor.name) || isAsyncFunctionData;
230
230
  const defer = (0, import_vue.ref)(typeof props.defer === "function" ? props.defer() : props.defer);
231
231
  const vue = (0, import_vue.getCurrentInstance)();
232
- if (props.debug) {
233
- console.log("[ReactiveView]:", { props, context, vue, defer, data: props.data, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
234
- }
235
232
  if ((isPromiseData || isFunctionData) && !("defaultData" in vue.vnode.props)) {
236
233
  console.error("[ReactiveView]: defaultData is required for promise or async function data.");
237
234
  }
@@ -256,9 +253,11 @@ var ReactiveView_default = {
256
253
  var _a2;
257
254
  const beforeSetData = (_a2 = access(component).beforeSetData) != null ? _a2 : props.beforeSetData;
258
255
  if (typeof beforeSetData === "function") {
259
- const after = import_object_manager.default.on(datatype).set(...params.length ? params : [defaultData]).get();
260
256
  const before = target.getData();
261
- beforeSetData({ before, after }, target);
257
+ const after = (params.length ? import_object_manager.default.on(datatype).set(...params) : import_object_manager.default.on(datatype).set(defaultData)).get();
258
+ if (beforeSetData({ before, after }, target)) {
259
+ target[key](...params);
260
+ }
262
261
  } else {
263
262
  target[key](...params);
264
263
  }
@@ -270,6 +269,9 @@ var ReactiveView_default = {
270
269
  }
271
270
  });
272
271
  const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, model, isValid } });
272
+ if (props.debug) {
273
+ console.log("[ReactiveView]:", { props, context, vue, defer, config, model, component, datatype, defaultData, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
274
+ }
273
275
  const watchDataProp = (dataProp) => {
274
276
  var _a2, _b2, _c2;
275
277
  const config2 = typeof context.attrs["onUpdate:data"] === "function" ? { callback: context.attrs["onUpdate:data"] } : {
@@ -292,8 +294,10 @@ var ReactiveView_default = {
292
294
  if (context.attrs["onUpdate:model"] || context.attrs["update:model"]) {
293
295
  const config2 = typeof context.attrs["onUpdate:model"] === "function" ? {
294
296
  callback: context.attrs["onUpdate:model"],
295
- options: Object.assign(__spreadValues(__spreadValues(__spreadValues({}, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:deep"] ? { deep: context.attrs["model:deep"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((_g = context.attrs["onUpdate:model"]) != null ? _g : {}).options)
296
- } : (_h = context.attrs["onUpdate:model"]) != null ? _h : {};
297
+ options: Object.assign(__spreadValues(__spreadValues({
298
+ deep: (_g = context.attrs["model:deep"]) != null ? _g : true
299
+ }, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((_h = context.attrs["onUpdate:model"]) != null ? _h : {}).options)
300
+ } : (_i = context.attrs["onUpdate:model"]) != null ? _i : {};
297
301
  if (context.attrs["model:log"]) {
298
302
  console.log(`[ReactiveView]:model`, { config: config2 });
299
303
  }
package/dist/index.mjs CHANGED
@@ -125,7 +125,7 @@ import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstanc
125
125
 
126
126
  // package.json
127
127
  var name = "@razaman2/reactive-view";
128
- var version = "0.0.34-beta.1";
128
+ var version = "0.0.34-beta.2";
129
129
 
130
130
  // src/ReactiveView.ts
131
131
  var setup = {
@@ -169,7 +169,7 @@ var ReactiveView_default = {
169
169
  }
170
170
  },
171
171
  setup(props, context) {
172
- var _a, _b, _c, _d, _e, _f, _g, _h;
172
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
173
173
  const template = (component2, vue2) => {
174
174
  return createVNode(
175
175
  "div",
@@ -186,9 +186,6 @@ var ReactiveView_default = {
186
186
  const isPromiseData = ["Promise"].includes(((_c = props.data) != null ? _c : {}).constructor.name) || isAsyncFunctionData;
187
187
  const defer = ref(typeof props.defer === "function" ? props.defer() : props.defer);
188
188
  const vue = getCurrentInstance();
189
- if (props.debug) {
190
- console.log("[ReactiveView]:", { props, context, vue, defer, data: props.data, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
191
- }
192
189
  if ((isPromiseData || isFunctionData) && !("defaultData" in vue.vnode.props)) {
193
190
  console.error("[ReactiveView]: defaultData is required for promise or async function data.");
194
191
  }
@@ -213,9 +210,11 @@ var ReactiveView_default = {
213
210
  var _a2;
214
211
  const beforeSetData = (_a2 = access(component).beforeSetData) != null ? _a2 : props.beforeSetData;
215
212
  if (typeof beforeSetData === "function") {
216
- const after = ObjectManager.on(datatype).set(...params.length ? params : [defaultData]).get();
217
213
  const before = target.getData();
218
- beforeSetData({ before, after }, target);
214
+ const after = (params.length ? ObjectManager.on(datatype).set(...params) : ObjectManager.on(datatype).set(defaultData)).get();
215
+ if (beforeSetData({ before, after }, target)) {
216
+ target[key](...params);
217
+ }
219
218
  } else {
220
219
  target[key](...params);
221
220
  }
@@ -227,6 +226,9 @@ var ReactiveView_default = {
227
226
  }
228
227
  });
229
228
  const component = ref({ parent: { self: vue.proxy }, self: { template, model, isValid } });
229
+ if (props.debug) {
230
+ console.log("[ReactiveView]:", { props, context, vue, defer, config, model, component, datatype, defaultData, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
231
+ }
230
232
  const watchDataProp = (dataProp) => {
231
233
  var _a2, _b2, _c2;
232
234
  const config2 = typeof context.attrs["onUpdate:data"] === "function" ? { callback: context.attrs["onUpdate:data"] } : {
@@ -249,8 +251,10 @@ var ReactiveView_default = {
249
251
  if (context.attrs["onUpdate:model"] || context.attrs["update:model"]) {
250
252
  const config2 = typeof context.attrs["onUpdate:model"] === "function" ? {
251
253
  callback: context.attrs["onUpdate:model"],
252
- options: Object.assign(__spreadValues(__spreadValues(__spreadValues({}, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:deep"] ? { deep: context.attrs["model:deep"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((_g = context.attrs["onUpdate:model"]) != null ? _g : {}).options)
253
- } : (_h = context.attrs["onUpdate:model"]) != null ? _h : {};
254
+ options: Object.assign(__spreadValues(__spreadValues({
255
+ deep: (_g = context.attrs["model:deep"]) != null ? _g : true
256
+ }, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((_h = context.attrs["onUpdate:model"]) != null ? _h : {}).options)
257
+ } : (_i = context.attrs["onUpdate:model"]) != null ? _i : {};
254
258
  if (context.attrs["model:log"]) {
255
259
  console.log(`[ReactiveView]:model`, { config: config2 });
256
260
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razaman2/reactive-view",
3
- "version": "0.0.34-beta.1",
3
+ "version": "0.0.34-beta.2",
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",