@razaman2/reactive-view 0.0.19 → 0.0.20

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
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { SetupContext, ComponentPublicInstance, WatchOptions, UnwrapRef } from 'vue';
2
+ import { SetupContext, ComponentPublicInstance, UnwrapRef } from 'vue';
3
3
 
4
4
  type SubscriptionItem = {
5
5
  name: string;
@@ -23,6 +23,20 @@ declare class Subscription {
23
23
  get(name: string): SubscriptionItem;
24
24
  }
25
25
 
26
+ type Accessible = {
27
+ parent: {
28
+ self: Record<string | symbol, any>;
29
+ };
30
+ self: Record<string | symbol, any>;
31
+ access?: () => Accessible;
32
+ value?: Accessible;
33
+ };
34
+ type PropOptions = {
35
+ exclude: string | Array<string>;
36
+ include: Record<string, any>;
37
+ };
38
+ type PropExclusions = Array<string> | string;
39
+
26
40
  declare const setup: {
27
41
  ReactiveView: boolean;
28
42
  setup: {
@@ -63,25 +77,6 @@ declare const _default: {
63
77
  setup(props: Record<string, any>, context: SetupContext): ($vue: ComponentPublicInstance & any) => any;
64
78
  };
65
79
 
66
- type StateUpdate = {
67
- callback: Function;
68
- beforeStateUpdate?: Function;
69
- options?: WatchOptions;
70
- };
71
- type Accessible = {
72
- parent: {
73
- self: Record<string | symbol, any>;
74
- };
75
- self: Record<string | symbol, any>;
76
- access?: () => Accessible;
77
- value?: Accessible;
78
- };
79
- type PropOptions = {
80
- exclude: string | Array<string>;
81
- include: Record<string, any>;
82
- };
83
- type PropExclusions = Array<string> | string;
84
-
85
80
  declare function safeRequest(request: {
86
81
  try: () => Promise<any> | any;
87
82
  catch?: ((error: any) => Promise<any> | any) | false;
@@ -108,7 +103,7 @@ declare function getDate(timestamp: {
108
103
  format?: string;
109
104
  timezone?: string;
110
105
  }): string;
111
- declare function access<T extends ComponentPublicInstance & Accessible>($vue?: T | UnwrapRef<any>): Record<string | symbol, any>;
106
+ declare function access<T extends ComponentPublicInstance & Accessible>($vue?: T | UnwrapRef<any>, alternative?: any): Record<string | symbol, any>;
112
107
  declare function getSubscription(): {
113
108
  addSubscription(name: string, handler?: () => boolean, data?: any): void;
114
109
  replaceSubscription(name: string, handler?: () => boolean, data?: any): void;
@@ -120,4 +115,4 @@ declare function getSubscription(): {
120
115
  };
121
116
  declare function StyleParser(styles: Array<string> | Record<string, any> | string): any;
122
117
 
123
- export { type StateUpdate, StyleParser, access, _default as default, getDate, getProps, getReactiveViewComponent, getSubscription, safeRequest, setup };
118
+ export { StyleParser, access, _default as default, getDate, getProps, getReactiveViewComponent, getSubscription, safeRequest, setup };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { SetupContext, ComponentPublicInstance, WatchOptions, UnwrapRef } from 'vue';
2
+ import { SetupContext, ComponentPublicInstance, UnwrapRef } from 'vue';
3
3
 
4
4
  type SubscriptionItem = {
5
5
  name: string;
@@ -23,6 +23,20 @@ declare class Subscription {
23
23
  get(name: string): SubscriptionItem;
24
24
  }
25
25
 
26
+ type Accessible = {
27
+ parent: {
28
+ self: Record<string | symbol, any>;
29
+ };
30
+ self: Record<string | symbol, any>;
31
+ access?: () => Accessible;
32
+ value?: Accessible;
33
+ };
34
+ type PropOptions = {
35
+ exclude: string | Array<string>;
36
+ include: Record<string, any>;
37
+ };
38
+ type PropExclusions = Array<string> | string;
39
+
26
40
  declare const setup: {
27
41
  ReactiveView: boolean;
28
42
  setup: {
@@ -63,25 +77,6 @@ declare const _default: {
63
77
  setup(props: Record<string, any>, context: SetupContext): ($vue: ComponentPublicInstance & any) => any;
64
78
  };
65
79
 
66
- type StateUpdate = {
67
- callback: Function;
68
- beforeStateUpdate?: Function;
69
- options?: WatchOptions;
70
- };
71
- type Accessible = {
72
- parent: {
73
- self: Record<string | symbol, any>;
74
- };
75
- self: Record<string | symbol, any>;
76
- access?: () => Accessible;
77
- value?: Accessible;
78
- };
79
- type PropOptions = {
80
- exclude: string | Array<string>;
81
- include: Record<string, any>;
82
- };
83
- type PropExclusions = Array<string> | string;
84
-
85
80
  declare function safeRequest(request: {
86
81
  try: () => Promise<any> | any;
87
82
  catch?: ((error: any) => Promise<any> | any) | false;
@@ -108,7 +103,7 @@ declare function getDate(timestamp: {
108
103
  format?: string;
109
104
  timezone?: string;
110
105
  }): string;
111
- declare function access<T extends ComponentPublicInstance & Accessible>($vue?: T | UnwrapRef<any>): Record<string | symbol, any>;
106
+ declare function access<T extends ComponentPublicInstance & Accessible>($vue?: T | UnwrapRef<any>, alternative?: any): Record<string | symbol, any>;
112
107
  declare function getSubscription(): {
113
108
  addSubscription(name: string, handler?: () => boolean, data?: any): void;
114
109
  replaceSubscription(name: string, handler?: () => boolean, data?: any): void;
@@ -120,4 +115,4 @@ declare function getSubscription(): {
120
115
  };
121
116
  declare function StyleParser(styles: Array<string> | Record<string, any> | string): any;
122
117
 
123
- export { type StateUpdate, StyleParser, access, _default as default, getDate, getProps, getReactiveViewComponent, getSubscription, safeRequest, setup };
118
+ export { StyleParser, access, _default as default, getDate, getProps, getReactiveViewComponent, getSubscription, safeRequest, setup };
package/dist/index.js CHANGED
@@ -54,11 +54,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
54
54
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
55
55
 
56
56
  // src/index.ts
57
- var src_exports = {};
58
- __export(src_exports, {
57
+ var index_exports = {};
58
+ __export(index_exports, {
59
59
  StyleParser: () => StyleParser,
60
60
  access: () => access,
61
- default: () => src_default,
61
+ default: () => index_default,
62
62
  getDate: () => getDate,
63
63
  getProps: () => getProps,
64
64
  getReactiveViewComponent: () => getReactiveViewComponent,
@@ -66,9 +66,8 @@ __export(src_exports, {
66
66
  safeRequest: () => safeRequest,
67
67
  setup: () => setup
68
68
  });
69
- module.exports = __toCommonJS(src_exports);
69
+ module.exports = __toCommonJS(index_exports);
70
70
  var import_date_fns_tz = require("date-fns-tz");
71
- var import_vue2 = require("vue");
72
71
 
73
72
  // src/Subscription.ts
74
73
  var Subscription = class _Subscription {
@@ -158,6 +157,9 @@ var _Subscriptions = class _Subscriptions extends Subscription {
158
157
  _Subscriptions.subscriptions = _Subscriptions.create();
159
158
  var Subscriptions = _Subscriptions;
160
159
 
160
+ // src/index.ts
161
+ var import_vue2 = require("vue");
162
+
161
163
  // src/ReactiveView.ts
162
164
  var import_object_manager = __toESM(require("@razaman2/object-manager"));
163
165
  var import_data_manager = __toESM(require("@razaman2/data-manager"));
@@ -165,7 +167,7 @@ var import_vue = require("vue");
165
167
 
166
168
  // package.json
167
169
  var name = "@razaman2/reactive-view";
168
- var version = "0.0.19";
170
+ var version = "0.0.20";
169
171
 
170
172
  // src/ReactiveView.ts
171
173
  var props = {
@@ -332,7 +334,7 @@ var ReactiveView_default = {
332
334
  };
333
335
 
334
336
  // src/index.ts
335
- var src_default = ReactiveView_default;
337
+ var index_default = ReactiveView_default;
336
338
  function safeRequest(request) {
337
339
  return new Promise(async (resolve) => {
338
340
  var _a, _b, _c, _d;
@@ -404,31 +406,33 @@ function getDate(param1, param2) {
404
406
  };
405
407
  return (0, import_date_fns_tz.formatInTimeZone)(datetime(), options.timezone, options.format);
406
408
  }
407
- function access($vue = {}) {
409
+ function access($vue = {}, alternative) {
408
410
  var _a, _b;
409
411
  const proxy = (target) => {
410
412
  return new Proxy(target, {
411
413
  get(target2, key) {
412
- const component = { $vue: target2 };
414
+ const component2 = { $vue: target2 };
413
415
  do {
414
- if (key in component.$vue) {
415
- return component.$vue[key];
416
- } else if ("self" in component.$vue && key in component.$vue.self) {
417
- return component.$vue.self[key];
416
+ if (key in component2.$vue) {
417
+ return component2.$vue[key];
418
+ } else if ("self" in component2.$vue && key in component2.$vue.self) {
419
+ return component2.$vue.self[key];
418
420
  } else {
419
- component.$vue = "parent" in component.$vue && component.$vue.parent;
421
+ component2.$vue = "parent" in component2.$vue && component2.$vue.parent;
420
422
  }
421
- } while (component.$vue);
423
+ } while (component2.$vue);
424
+ return alternative;
422
425
  }
423
426
  });
424
427
  };
428
+ const component = typeof $vue === "function" ? $vue() : $vue;
425
429
  try {
426
- return proxy($vue.access());
430
+ return proxy(component.access());
427
431
  } catch (e) {
428
432
  try {
429
- return proxy($vue.value.access());
433
+ return proxy(component.value.access());
430
434
  } catch (e2) {
431
- return proxy((_b = (_a = $vue.value) != null ? _a : $vue) != null ? _b : {});
435
+ return proxy(((_b = (_a = component.value) != null ? _a : component) != null ? _b : {}) || {});
432
436
  }
433
437
  }
434
438
  }
@@ -464,7 +468,12 @@ function StyleParser(styles) {
464
468
  const object = (items) => items.reduce((object2, item) => {
465
469
  return Object.assign(object2, { [item]: true });
466
470
  }, {});
467
- return (_a = Array.isArray(styles) ? object(styles) : typeof styles === "string" ? object(styles.split(/\s+/)) : styles) != null ? _a : {};
471
+ return (_a = Array.isArray(styles) ? object(styles) : typeof styles === "string" ? object(styles.split(/\s+/)) : Object.entries(styles).reduce((acc, [styles2, value]) => {
472
+ styles2.split(/\s+/).forEach((style) => {
473
+ acc[style] = value;
474
+ });
475
+ return acc;
476
+ }, {})) != null ? _a : {};
468
477
  }
469
478
  // Annotate the CommonJS export names for ESM import in node:
470
479
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -29,7 +29,6 @@ var __objRest = (source, exclude) => {
29
29
 
30
30
  // src/index.ts
31
31
  import { formatInTimeZone } from "date-fns-tz";
32
- import { createVNode } from "vue";
33
32
 
34
33
  // src/Subscription.ts
35
34
  var Subscription = class _Subscription {
@@ -119,6 +118,9 @@ var _Subscriptions = class _Subscriptions extends Subscription {
119
118
  _Subscriptions.subscriptions = _Subscriptions.create();
120
119
  var Subscriptions = _Subscriptions;
121
120
 
121
+ // src/index.ts
122
+ import { createVNode } from "vue";
123
+
122
124
  // src/ReactiveView.ts
123
125
  import ObjectManager from "@razaman2/object-manager";
124
126
  import DataManager from "@razaman2/data-manager";
@@ -126,7 +128,7 @@ import { h, ref, reactive, watch, nextTick, onMounted, getCurrentInstance } from
126
128
 
127
129
  // package.json
128
130
  var name = "@razaman2/reactive-view";
129
- var version = "0.0.19";
131
+ var version = "0.0.20";
130
132
 
131
133
  // src/ReactiveView.ts
132
134
  var props = {
@@ -293,7 +295,7 @@ var ReactiveView_default = {
293
295
  };
294
296
 
295
297
  // src/index.ts
296
- var src_default = ReactiveView_default;
298
+ var index_default = ReactiveView_default;
297
299
  function safeRequest(request) {
298
300
  return new Promise(async (resolve) => {
299
301
  var _a, _b, _c, _d;
@@ -365,31 +367,33 @@ function getDate(param1, param2) {
365
367
  };
366
368
  return formatInTimeZone(datetime(), options.timezone, options.format);
367
369
  }
368
- function access($vue = {}) {
370
+ function access($vue = {}, alternative) {
369
371
  var _a, _b;
370
372
  const proxy = (target) => {
371
373
  return new Proxy(target, {
372
374
  get(target2, key) {
373
- const component = { $vue: target2 };
375
+ const component2 = { $vue: target2 };
374
376
  do {
375
- if (key in component.$vue) {
376
- return component.$vue[key];
377
- } else if ("self" in component.$vue && key in component.$vue.self) {
378
- return component.$vue.self[key];
377
+ if (key in component2.$vue) {
378
+ return component2.$vue[key];
379
+ } else if ("self" in component2.$vue && key in component2.$vue.self) {
380
+ return component2.$vue.self[key];
379
381
  } else {
380
- component.$vue = "parent" in component.$vue && component.$vue.parent;
382
+ component2.$vue = "parent" in component2.$vue && component2.$vue.parent;
381
383
  }
382
- } while (component.$vue);
384
+ } while (component2.$vue);
385
+ return alternative;
383
386
  }
384
387
  });
385
388
  };
389
+ const component = typeof $vue === "function" ? $vue() : $vue;
386
390
  try {
387
- return proxy($vue.access());
391
+ return proxy(component.access());
388
392
  } catch (e) {
389
393
  try {
390
- return proxy($vue.value.access());
394
+ return proxy(component.value.access());
391
395
  } catch (e2) {
392
- return proxy((_b = (_a = $vue.value) != null ? _a : $vue) != null ? _b : {});
396
+ return proxy(((_b = (_a = component.value) != null ? _a : component) != null ? _b : {}) || {});
393
397
  }
394
398
  }
395
399
  }
@@ -425,12 +429,17 @@ function StyleParser(styles) {
425
429
  const object = (items) => items.reduce((object2, item) => {
426
430
  return Object.assign(object2, { [item]: true });
427
431
  }, {});
428
- return (_a = Array.isArray(styles) ? object(styles) : typeof styles === "string" ? object(styles.split(/\s+/)) : styles) != null ? _a : {};
432
+ return (_a = Array.isArray(styles) ? object(styles) : typeof styles === "string" ? object(styles.split(/\s+/)) : Object.entries(styles).reduce((acc, [styles2, value]) => {
433
+ styles2.split(/\s+/).forEach((style) => {
434
+ acc[style] = value;
435
+ });
436
+ return acc;
437
+ }, {})) != null ? _a : {};
429
438
  }
430
439
  export {
431
440
  StyleParser,
432
441
  access,
433
- src_default as default,
442
+ index_default as default,
434
443
  getDate,
435
444
  getProps,
436
445
  getReactiveViewComponent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razaman2/reactive-view",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
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",
@@ -21,17 +21,19 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "@razaman2/data-manager": "^3.2.11",
24
- "@razaman2/object-manager": "^3.4.1",
24
+ "@razaman2/object-manager": "^3.4.2",
25
25
  "date-fns": "^4.1.0",
26
26
  "date-fns-tz": "^3.2.0",
27
- "uuid": "^11.0.3",
27
+ "uuid": "^11.1.0"
28
+ },
29
+ "peerDependencies": {
28
30
  "vue": "^3.5.13"
29
31
  },
30
32
  "devDependencies": {
31
33
  "@types/uuid": "^10.0.0",
32
- "tsup": "^8.3.5",
33
- "typescript": "^5.7.2",
34
- "vitest": "^2.1.8"
34
+ "tsup": "^8.4.0",
35
+ "typescript": "^5.8.2",
36
+ "vitest": "^3.0.8"
35
37
  },
36
38
  "publishConfig": {
37
39
  "access": "public"