@razaman2/reactive-view 0.0.34-beta.22 → 0.0.34-beta.24

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
@@ -128,7 +128,7 @@ declare function showComponent(component: any, options?: {
128
128
  container?: string;
129
129
  key?: string;
130
130
  router?: any;
131
- }): void;
131
+ }): ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}, {}, {}, string, vue.ComponentProvideOptions>, {}, {}, "", {}, any> | undefined;
132
132
  declare const getData: (component: any, path: number | string, alternative: any) => any;
133
133
  declare const setData: (component: any, data: any, path?: string) => any;
134
134
  declare const dataPath: (component: any, path: string | number) => any;
package/dist/index.d.ts CHANGED
@@ -128,7 +128,7 @@ declare function showComponent(component: any, options?: {
128
128
  container?: string;
129
129
  key?: string;
130
130
  router?: any;
131
- }): void;
131
+ }): ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}, {}, {}, string, vue.ComponentProvideOptions>, {}, {}, "", {}, any> | undefined;
132
132
  declare const getData: (component: any, path: number | string, alternative: any) => any;
133
133
  declare const setData: (component: any, data: any, path?: string) => any;
134
134
  declare const dataPath: (component: any, path: string | number) => any;
package/dist/index.js CHANGED
@@ -174,7 +174,7 @@ var import_vue = require("vue");
174
174
 
175
175
  // package.json
176
176
  var name = "@razaman2/reactive-view";
177
- var version = "0.0.34-beta.22";
177
+ var version = "0.0.34-beta.24";
178
178
 
179
179
  // src/ReactiveView.ts
180
180
  var setup = {
@@ -305,9 +305,9 @@ var ReactiveView_default = {
305
305
  var _a2;
306
306
  const beforeSetData = (_a2 = access(component).beforeSetData) != null ? _a2 : props.beforeSetData;
307
307
  if (typeof beforeSetData === "function") {
308
- const before = target.getData();
308
+ const before = import_object_manager.default.on(target.getData()).clone();
309
309
  const after = params.length ? import_object_manager.default.on(datatype).set(...params) : import_object_manager.default.on(datatype).set(defaultData);
310
- if (beforeSetData(diff(import_object_manager.default.on(before), after), target)) {
310
+ if (beforeSetData(access(component).diff(before, after), target)) {
311
311
  target[key](...params);
312
312
  }
313
313
  } else {
@@ -320,7 +320,7 @@ var ReactiveView_default = {
320
320
  }
321
321
  }
322
322
  });
323
- const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, model, dataPath: dataPath2, isValid } });
323
+ const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, model, diff, dataPath: dataPath2, isValid } });
324
324
  if (props.debug) {
325
325
  console.log("[ReactiveView]:", { props, context, vue, defer, config, model, component, datatype, defaultData, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
326
326
  }
@@ -338,7 +338,7 @@ var ReactiveView_default = {
338
338
  (0, import_vue.watch)(isFunctionData || (0, import_vue.isRef)(dataProp) || (0, import_vue.isReactive)(dataProp) ? dataProp : () => dataProp, (after, before) => {
339
339
  var _a3;
340
340
  if (typeof config2.callback === "function") {
341
- model.replaceData((_a3 = config2.callback(diff(import_object_manager.default.on(before), import_object_manager.default.on(after)), { component })) != null ? _a3 : after);
341
+ model.replaceData((_a3 = config2.callback(access(component).diff(import_object_manager.default.on(before), import_object_manager.default.on(after)), { component })) != null ? _a3 : after);
342
342
  } else {
343
343
  model.replaceData(after);
344
344
  }
@@ -354,8 +354,8 @@ var ReactiveView_default = {
354
354
  if (context.attrs["model:log"]) {
355
355
  console.log(`[ReactiveView]:model`, { config: config2 });
356
356
  }
357
- (0, import_vue.watch)(() => model.getData(), (after, before) => {
358
- config2.callback(diff(import_object_manager.default.on(before), import_object_manager.default.on(after)), { component });
357
+ (0, import_vue.watch)(() => import_object_manager.default.on(model.getData()).clone(), (after, before) => {
358
+ config2.callback(access(component).diff(import_object_manager.default.on(before), import_object_manager.default.on(after)), { component });
359
359
  }, config2.options);
360
360
  }
361
361
  if (!props.beta) {
@@ -588,9 +588,10 @@ var extendVnode = (component, element) => {
588
588
  return (props = {}, slots) => {
589
589
  var _a;
590
590
  const isFunctionClass = typeof props.class === "function";
591
+ const isFunctionStyle = typeof props.style === "function";
591
592
  const _b = (_a = vnode.props) != null ? _a : {}, { class: classes, style: styles } = _b, rest = __objRest(_b, ["class", "style"]);
592
593
  const finalClasses = (0, import_tailwind_merge.twMerge)(isFunctionClass ? "" : classes, MergeStyles(isFunctionClass ? props.class(classes) : props.class).string);
593
- const finalStyles = MergeStyles(styles, typeof props.style === "function" ? props.style(styles) : props.style);
594
+ const finalStyles = MergeStyles(styles, isFunctionStyle ? props.style(styles) : props.style);
594
595
  const functionalProps = Object.entries(props).reduce((props2, [key2, value]) => {
595
596
  var _a2;
596
597
  if (!["class", "style", "setup"].includes(key2) && typeof value === "function") {
@@ -647,13 +648,14 @@ function showComponent(component, options = {}) {
647
648
  {
648
649
  __cleanup__: () => {
649
650
  document.querySelectorAll(`#${id}`).forEach((element) => element.remove());
651
+ app.unmount();
650
652
  }
651
653
  }
652
654
  );
653
655
  if (options.router) {
654
- app.use(options.router).mount(`#${id}`);
656
+ return app.use(options.router).mount(`#${id}`);
655
657
  } else {
656
- app.mount(`#${id}`);
658
+ return app.mount(`#${id}`);
657
659
  }
658
660
  }
659
661
  }
package/dist/index.mjs CHANGED
@@ -128,7 +128,7 @@ import { ref, reactive, watch, unref, toRaw, isRef, isReactive, createVNode, get
128
128
 
129
129
  // package.json
130
130
  var name = "@razaman2/reactive-view";
131
- var version = "0.0.34-beta.22";
131
+ var version = "0.0.34-beta.24";
132
132
 
133
133
  // src/ReactiveView.ts
134
134
  var setup = {
@@ -259,9 +259,9 @@ var ReactiveView_default = {
259
259
  var _a2;
260
260
  const beforeSetData = (_a2 = access(component).beforeSetData) != null ? _a2 : props.beforeSetData;
261
261
  if (typeof beforeSetData === "function") {
262
- const before = target.getData();
262
+ const before = ObjectManager.on(target.getData()).clone();
263
263
  const after = params.length ? ObjectManager.on(datatype).set(...params) : ObjectManager.on(datatype).set(defaultData);
264
- if (beforeSetData(diff(ObjectManager.on(before), after), target)) {
264
+ if (beforeSetData(access(component).diff(before, after), target)) {
265
265
  target[key](...params);
266
266
  }
267
267
  } else {
@@ -274,7 +274,7 @@ var ReactiveView_default = {
274
274
  }
275
275
  }
276
276
  });
277
- const component = ref({ parent: { self: vue.proxy }, self: { template, model, dataPath: dataPath2, isValid } });
277
+ const component = ref({ parent: { self: vue.proxy }, self: { template, model, diff, dataPath: dataPath2, isValid } });
278
278
  if (props.debug) {
279
279
  console.log("[ReactiveView]:", { props, context, vue, defer, config, model, component, datatype, defaultData, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
280
280
  }
@@ -292,7 +292,7 @@ var ReactiveView_default = {
292
292
  watch(isFunctionData || isRef(dataProp) || isReactive(dataProp) ? dataProp : () => dataProp, (after, before) => {
293
293
  var _a3;
294
294
  if (typeof config2.callback === "function") {
295
- model.replaceData((_a3 = config2.callback(diff(ObjectManager.on(before), ObjectManager.on(after)), { component })) != null ? _a3 : after);
295
+ model.replaceData((_a3 = config2.callback(access(component).diff(ObjectManager.on(before), ObjectManager.on(after)), { component })) != null ? _a3 : after);
296
296
  } else {
297
297
  model.replaceData(after);
298
298
  }
@@ -308,8 +308,8 @@ var ReactiveView_default = {
308
308
  if (context.attrs["model:log"]) {
309
309
  console.log(`[ReactiveView]:model`, { config: config2 });
310
310
  }
311
- watch(() => model.getData(), (after, before) => {
312
- config2.callback(diff(ObjectManager.on(before), ObjectManager.on(after)), { component });
311
+ watch(() => ObjectManager.on(model.getData()).clone(), (after, before) => {
312
+ config2.callback(access(component).diff(ObjectManager.on(before), ObjectManager.on(after)), { component });
313
313
  }, config2.options);
314
314
  }
315
315
  if (!props.beta) {
@@ -542,9 +542,10 @@ var extendVnode = (component, element) => {
542
542
  return (props = {}, slots) => {
543
543
  var _a;
544
544
  const isFunctionClass = typeof props.class === "function";
545
+ const isFunctionStyle = typeof props.style === "function";
545
546
  const _b = (_a = vnode.props) != null ? _a : {}, { class: classes, style: styles } = _b, rest = __objRest(_b, ["class", "style"]);
546
547
  const finalClasses = twMerge(isFunctionClass ? "" : classes, MergeStyles(isFunctionClass ? props.class(classes) : props.class).string);
547
- const finalStyles = MergeStyles(styles, typeof props.style === "function" ? props.style(styles) : props.style);
548
+ const finalStyles = MergeStyles(styles, isFunctionStyle ? props.style(styles) : props.style);
548
549
  const functionalProps = Object.entries(props).reduce((props2, [key2, value]) => {
549
550
  var _a2;
550
551
  if (!["class", "style", "setup"].includes(key2) && typeof value === "function") {
@@ -601,13 +602,14 @@ function showComponent(component, options = {}) {
601
602
  {
602
603
  __cleanup__: () => {
603
604
  document.querySelectorAll(`#${id}`).forEach((element) => element.remove());
605
+ app.unmount();
604
606
  }
605
607
  }
606
608
  );
607
609
  if (options.router) {
608
- app.use(options.router).mount(`#${id}`);
610
+ return app.use(options.router).mount(`#${id}`);
609
611
  } else {
610
- app.mount(`#${id}`);
612
+ return app.mount(`#${id}`);
611
613
  }
612
614
  }
613
615
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razaman2/reactive-view",
3
- "version": "0.0.34-beta.22",
3
+ "version": "0.0.34-beta.24",
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",
@@ -9,7 +9,8 @@
9
9
  "prepublishOnly": "npm run build",
10
10
  "build": "tsup src/index.ts --format cjs,esm --dts",
11
11
  "lint": "tsc",
12
- "test": "cd tests/vue-ts && npm run dev"
12
+ "test": "cd tests/vue-ts && npm run dev",
13
+ "pr": "sh pr.sh"
13
14
  },
14
15
  "keywords": [
15
16
  "vue",