@razaman2/reactive-view 0.0.34-beta.8 → 0.0.34-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.d.mts CHANGED
@@ -74,6 +74,7 @@ declare const _default: {
74
74
  type: BooleanConstructor;
75
75
  default: boolean;
76
76
  };
77
+ state: {};
77
78
  };
78
79
  setup(props: Record<string, any>, context: SetupContext): (vue: ComponentPublicInstance) => any;
79
80
  };
@@ -117,5 +118,8 @@ declare function useSubscription(): {
117
118
  declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
118
119
  declare function MergeStyles(...params: any): any;
119
120
  declare const extendVnode: (component: Record<string, any>, element: any) => Record<string, (props?: Record<string, any>, slots?: Record<string, any> | ((slots: Record<string, any>) => Record<string, any>)) => any>;
121
+ declare const getData: (component: any, path: number | string, alternative: any) => any;
122
+ declare const setData: (component: any, data: any) => any;
123
+ declare const dataPath: (component: any, path: string | number) => any;
120
124
 
121
- export { MergeStyles, StyleParser, access, _default as default, extendVnode, getDate, getProps, getReactiveViewComponent, safeRequest, setup, useSubscription };
125
+ export { MergeStyles, StyleParser, access, dataPath, _default as default, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, useSubscription };
package/dist/index.d.ts CHANGED
@@ -74,6 +74,7 @@ declare const _default: {
74
74
  type: BooleanConstructor;
75
75
  default: boolean;
76
76
  };
77
+ state: {};
77
78
  };
78
79
  setup(props: Record<string, any>, context: SetupContext): (vue: ComponentPublicInstance) => any;
79
80
  };
@@ -117,5 +118,8 @@ declare function useSubscription(): {
117
118
  declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
118
119
  declare function MergeStyles(...params: any): any;
119
120
  declare const extendVnode: (component: Record<string, any>, element: any) => Record<string, (props?: Record<string, any>, slots?: Record<string, any> | ((slots: Record<string, any>) => Record<string, any>)) => any>;
121
+ declare const getData: (component: any, path: number | string, alternative: any) => any;
122
+ declare const setData: (component: any, data: any) => any;
123
+ declare const dataPath: (component: any, path: string | number) => any;
120
124
 
121
- export { MergeStyles, StyleParser, access, _default as default, extendVnode, getDate, getProps, getReactiveViewComponent, safeRequest, setup, useSubscription };
125
+ export { MergeStyles, StyleParser, access, dataPath, _default as default, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, useSubscription };
package/dist/index.js CHANGED
@@ -59,16 +59,20 @@ __export(index_exports, {
59
59
  MergeStyles: () => MergeStyles,
60
60
  StyleParser: () => StyleParser,
61
61
  access: () => access,
62
+ dataPath: () => dataPath,
62
63
  default: () => index_default,
63
64
  extendVnode: () => extendVnode,
65
+ getData: () => getData,
64
66
  getDate: () => getDate,
65
67
  getProps: () => getProps,
66
68
  getReactiveViewComponent: () => getReactiveViewComponent,
67
69
  safeRequest: () => safeRequest,
70
+ setData: () => setData,
68
71
  setup: () => setup,
69
72
  useSubscription: () => useSubscription
70
73
  });
71
74
  module.exports = __toCommonJS(index_exports);
75
+ var import_object_manager2 = __toESM(require("@razaman2/object-manager"));
72
76
 
73
77
  // src/Subscription.ts
74
78
  var Subscription = class _Subscription {
@@ -168,7 +172,7 @@ var import_vue = require("vue");
168
172
 
169
173
  // package.json
170
174
  var name = "@razaman2/reactive-view";
171
- var version = "0.0.34-beta.8";
175
+ var version = "0.0.34-beta.9";
172
176
 
173
177
  // src/ReactiveView.ts
174
178
  var setup = {
@@ -211,7 +215,8 @@ var ReactiveView_default = {
211
215
  debug: {
212
216
  type: Boolean,
213
217
  default: false
214
- }
218
+ },
219
+ state: {}
215
220
  },
216
221
  setup(props, context) {
217
222
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -224,7 +229,7 @@ var ReactiveView_default = {
224
229
  }, import_object_manager.default.on({}));
225
230
  return { before: before.get(), after: after.get(), change: change.get() };
226
231
  };
227
- const dataPath = (path) => {
232
+ const dataPath2 = (path) => {
228
233
  try {
229
234
  return context.attrs["data:path"](path);
230
235
  } catch (e) {
@@ -286,7 +291,7 @@ var ReactiveView_default = {
286
291
  }
287
292
  }
288
293
  });
289
- const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, model, dataPath, isValid } });
294
+ const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, model, dataPath: dataPath2, isValid } });
290
295
  if (props.debug) {
291
296
  console.log("[ReactiveView]:", { props, context, vue, defer, config, model, component, datatype, defaultData, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
292
297
  }
@@ -439,7 +444,7 @@ function getDate(param1, param2) {
439
444
  }
440
445
  function access(view = {}, alternative) {
441
446
  const resolve = (target) => {
442
- return new Proxy(target, {
447
+ return new Proxy((0, import_vue2.toRaw)(target), {
443
448
  get(target2, key) {
444
449
  const component = { tree: target2 };
445
450
  do {
@@ -562,16 +567,28 @@ var extendVnode = (component, element) => {
562
567
  }
563
568
  });
564
569
  };
570
+ var getData = (component, path, alternative) => {
571
+ return import_object_manager2.default.on((0, import_vue2.unref)(component.state)).get(dataPath(component, path), alternative);
572
+ };
573
+ var setData = (component, data) => {
574
+ return component.$emit("update:state", { before: import_object_manager2.default.on((0, import_vue2.unref)(component.state)).clone(), after: data });
575
+ };
576
+ var dataPath = (component, path) => {
577
+ return typeof component.$attrs["data:path"] === "function" ? component.$attrs["data:path"](path) : path;
578
+ };
565
579
  // Annotate the CommonJS export names for ESM import in node:
566
580
  0 && (module.exports = {
567
581
  MergeStyles,
568
582
  StyleParser,
569
583
  access,
584
+ dataPath,
570
585
  extendVnode,
586
+ getData,
571
587
  getDate,
572
588
  getProps,
573
589
  getReactiveViewComponent,
574
590
  safeRequest,
591
+ setData,
575
592
  setup,
576
593
  useSubscription
577
594
  });
package/dist/index.mjs CHANGED
@@ -27,6 +27,9 @@ var __objRest = (source, exclude) => {
27
27
  return target;
28
28
  };
29
29
 
30
+ // src/index.ts
31
+ import ObjectManager2 from "@razaman2/object-manager";
32
+
30
33
  // src/Subscription.ts
31
34
  var Subscription = class _Subscription {
32
35
  constructor() {
@@ -125,7 +128,7 @@ import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstanc
125
128
 
126
129
  // package.json
127
130
  var name = "@razaman2/reactive-view";
128
- var version = "0.0.34-beta.8";
131
+ var version = "0.0.34-beta.9";
129
132
 
130
133
  // src/ReactiveView.ts
131
134
  var setup = {
@@ -168,7 +171,8 @@ var ReactiveView_default = {
168
171
  debug: {
169
172
  type: Boolean,
170
173
  default: false
171
- }
174
+ },
175
+ state: {}
172
176
  },
173
177
  setup(props, context) {
174
178
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -181,7 +185,7 @@ var ReactiveView_default = {
181
185
  }, ObjectManager.on({}));
182
186
  return { before: before.get(), after: after.get(), change: change.get() };
183
187
  };
184
- const dataPath = (path) => {
188
+ const dataPath2 = (path) => {
185
189
  try {
186
190
  return context.attrs["data:path"](path);
187
191
  } catch (e) {
@@ -243,7 +247,7 @@ var ReactiveView_default = {
243
247
  }
244
248
  }
245
249
  });
246
- const component = ref({ parent: { self: vue.proxy }, self: { template, model, dataPath, isValid } });
250
+ const component = ref({ parent: { self: vue.proxy }, self: { template, model, dataPath: dataPath2, isValid } });
247
251
  if (props.debug) {
248
252
  console.log("[ReactiveView]:", { props, context, vue, defer, config, model, component, datatype, defaultData, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
249
253
  }
@@ -319,7 +323,7 @@ var ReactiveView_default = {
319
323
  };
320
324
 
321
325
  // src/index.ts
322
- import { createVNode as createVNode2, isRef as isRef2, h } from "vue";
326
+ import { h, unref as unref2, isRef as isRef2, toRaw, createVNode as createVNode2 } from "vue";
323
327
  import { formatInTimeZone } from "date-fns-tz";
324
328
  import { twMerge } from "tailwind-merge";
325
329
  var index_default = ReactiveView_default;
@@ -396,7 +400,7 @@ function getDate(param1, param2) {
396
400
  }
397
401
  function access(view = {}, alternative) {
398
402
  const resolve = (target) => {
399
- return new Proxy(target, {
403
+ return new Proxy(toRaw(target), {
400
404
  get(target2, key) {
401
405
  const component = { tree: target2 };
402
406
  do {
@@ -519,16 +523,28 @@ var extendVnode = (component, element) => {
519
523
  }
520
524
  });
521
525
  };
526
+ var getData = (component, path, alternative) => {
527
+ return ObjectManager2.on(unref2(component.state)).get(dataPath(component, path), alternative);
528
+ };
529
+ var setData = (component, data) => {
530
+ return component.$emit("update:state", { before: ObjectManager2.on(unref2(component.state)).clone(), after: data });
531
+ };
532
+ var dataPath = (component, path) => {
533
+ return typeof component.$attrs["data:path"] === "function" ? component.$attrs["data:path"](path) : path;
534
+ };
522
535
  export {
523
536
  MergeStyles,
524
537
  StyleParser,
525
538
  access,
539
+ dataPath,
526
540
  index_default as default,
527
541
  extendVnode,
542
+ getData,
528
543
  getDate,
529
544
  getProps,
530
545
  getReactiveViewComponent,
531
546
  safeRequest,
547
+ setData,
532
548
  setup,
533
549
  useSubscription
534
550
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razaman2/reactive-view",
3
- "version": "0.0.34-beta.8",
3
+ "version": "0.0.34-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",
@@ -23,14 +23,14 @@
23
23
  "dependencies": {
24
24
  "@razaman2/data-manager": "^3.2.12",
25
25
  "@razaman2/event-emitter": "^2.1.1",
26
- "@razaman2/object-manager": "^3.4.2",
26
+ "@razaman2/object-manager": "^3.4.5",
27
27
  "date-fns": "^4.1.0",
28
28
  "date-fns-tz": "^3.2.0",
29
29
  "tailwind-merge": "^3.3.1",
30
30
  "uuid": "^11.1.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "vue": "^3.5.19"
33
+ "vue": "^3.5.20"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/uuid": "^10.0.0",