@razaman2/reactive-view 0.0.34-beta.16 → 0.0.34-beta.18

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, UnwrapRef } from 'vue';
2
+ import { SetupContext, ComponentPublicInstance, UnwrapRef, defineComponent } from 'vue';
3
3
 
4
4
  type ComponentExtension = {
5
5
  parent?: ComponentExtension;
@@ -120,8 +120,9 @@ declare function useSubscription(): {
120
120
  declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
121
121
  declare function MergeStyles(...params: any): any;
122
122
  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>;
123
+ declare function defineReactiveView(options: Record<string, any>, component: typeof _default, _options: Record<string, any>): ReturnType<typeof defineComponent>;
123
124
  declare const getData: (component: any, path: number | string, alternative: any) => any;
124
125
  declare const setData: (component: any, data: any, path?: string) => any;
125
126
  declare const dataPath: (component: any, path: string | number) => any;
126
127
 
127
- export { MergeStyles, StyleParser, access, dataPath, _default as default, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, useSubscription };
128
+ export { MergeStyles, StyleParser, access, dataPath, _default as default, defineReactiveView, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, useSubscription };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { SetupContext, ComponentPublicInstance, UnwrapRef } from 'vue';
2
+ import { SetupContext, ComponentPublicInstance, UnwrapRef, defineComponent } from 'vue';
3
3
 
4
4
  type ComponentExtension = {
5
5
  parent?: ComponentExtension;
@@ -120,8 +120,9 @@ declare function useSubscription(): {
120
120
  declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
121
121
  declare function MergeStyles(...params: any): any;
122
122
  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>;
123
+ declare function defineReactiveView(options: Record<string, any>, component: typeof _default, _options: Record<string, any>): ReturnType<typeof defineComponent>;
123
124
  declare const getData: (component: any, path: number | string, alternative: any) => any;
124
125
  declare const setData: (component: any, data: any, path?: string) => any;
125
126
  declare const dataPath: (component: any, path: string | number) => any;
126
127
 
127
- export { MergeStyles, StyleParser, access, dataPath, _default as default, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, useSubscription };
128
+ export { MergeStyles, StyleParser, access, dataPath, _default as default, defineReactiveView, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, useSubscription };
package/dist/index.js CHANGED
@@ -61,6 +61,7 @@ __export(index_exports, {
61
61
  access: () => access,
62
62
  dataPath: () => dataPath,
63
63
  default: () => index_default,
64
+ defineReactiveView: () => defineReactiveView,
64
65
  extendVnode: () => extendVnode,
65
66
  getData: () => getData,
66
67
  getDate: () => getDate,
@@ -172,7 +173,7 @@ var import_vue = require("vue");
172
173
 
173
174
  // package.json
174
175
  var name = "@razaman2/reactive-view";
175
- var version = "0.0.34-beta.16";
176
+ var version = "0.0.34-beta.18";
176
177
 
177
178
  // src/ReactiveView.ts
178
179
  var setup = {
@@ -560,14 +561,27 @@ var extendVnode = (component, element) => {
560
561
  const finalProps = Object.assign(rest, functionalProps, { class: finalClasses, style: finalStyles });
561
562
  const finalSlots = slots ? typeof slots === "function" ? slots(vnode.children) : slots : vnode.children;
562
563
  const finalElement = ["undefined"].includes(typeof element) ? vnode.type : element;
563
- return (0, import_vue2.h)(finalElement, finalProps, () => finalSlots);
564
+ return (0, import_vue2.h)(finalElement, finalProps, finalSlots);
564
565
  };
565
566
  }
566
567
  });
567
568
  };
569
+ function defineReactiveView(param1, param2) {
570
+ return (0, import_vue2.defineComponent)({
571
+ props: __spreadValues({ setup }, param1.props),
572
+ setup() {
573
+ const _a = param1, { setup: setup2, props } = _a, rest = __objRest(_a, ["setup", "props"]);
574
+ return (component) => {
575
+ return (0, import_vue2.createVNode)(param2, Object.assign({}, rest, setup2 ? {
576
+ setup: (self, parent) => setup2(self, parent, component)
577
+ } : {}));
578
+ };
579
+ }
580
+ });
581
+ }
568
582
  var getData = (component, path, alternative) => {
569
583
  const vue = access(component);
570
- const data = import_object_manager2.default.on((0, import_vue2.unref)(componentState(vue)));
584
+ const data = import_object_manager2.default.on(componentState(vue));
571
585
  if (path) {
572
586
  return data.get(dataPath(vue, path), alternative);
573
587
  } else {
@@ -577,13 +591,13 @@ var getData = (component, path, alternative) => {
577
591
  var setData = (component, data, path) => {
578
592
  const vue = access(component);
579
593
  const diff = {
580
- before: import_object_manager2.default.on((0, import_vue2.unref)(componentState(vue))).clone(),
594
+ before: import_object_manager2.default.on(componentState(vue)).clone(),
581
595
  after: path ? import_object_manager2.default.on(componentState(vue)).set(dataPath(vue, path), data).get() : import_object_manager2.default.on(componentState(vue)).set(data).get()
582
596
  };
583
597
  return "state" in vue ? diff : vue.$emit("update:state", diff);
584
598
  };
585
599
  var componentState = (component) => {
586
- return "state" in component ? component.state : component.$attrs.state;
600
+ return (0, import_vue2.unref)("state" in component ? component.state : component.$attrs.state);
587
601
  };
588
602
  var dataPath = (component, path) => {
589
603
  return typeof component.$attrs["data:path"] === "function" ? component.$attrs["data:path"](path) : path;
@@ -594,6 +608,7 @@ var dataPath = (component, path) => {
594
608
  StyleParser,
595
609
  access,
596
610
  dataPath,
611
+ defineReactiveView,
597
612
  extendVnode,
598
613
  getData,
599
614
  getDate,
package/dist/index.mjs CHANGED
@@ -128,7 +128,7 @@ import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstanc
128
128
 
129
129
  // package.json
130
130
  var name = "@razaman2/reactive-view";
131
- var version = "0.0.34-beta.16";
131
+ var version = "0.0.34-beta.18";
132
132
 
133
133
  // src/ReactiveView.ts
134
134
  var setup = {
@@ -319,7 +319,7 @@ var ReactiveView_default = {
319
319
  };
320
320
 
321
321
  // src/index.ts
322
- import { h, unref as unref2, toRaw, createVNode as createVNode2 } from "vue";
322
+ import { h, unref as unref2, toRaw, createVNode as createVNode2, defineComponent } from "vue";
323
323
  import { formatInTimeZone } from "date-fns-tz";
324
324
  import { twMerge } from "tailwind-merge";
325
325
  console.log(`%c[ReactiveView]: ${version}`, "background-color: red; color: yellow;");
@@ -516,14 +516,27 @@ var extendVnode = (component, element) => {
516
516
  const finalProps = Object.assign(rest, functionalProps, { class: finalClasses, style: finalStyles });
517
517
  const finalSlots = slots ? typeof slots === "function" ? slots(vnode.children) : slots : vnode.children;
518
518
  const finalElement = ["undefined"].includes(typeof element) ? vnode.type : element;
519
- return h(finalElement, finalProps, () => finalSlots);
519
+ return h(finalElement, finalProps, finalSlots);
520
520
  };
521
521
  }
522
522
  });
523
523
  };
524
+ function defineReactiveView(param1, param2) {
525
+ return defineComponent({
526
+ props: __spreadValues({ setup }, param1.props),
527
+ setup() {
528
+ const _a = param1, { setup: setup2, props } = _a, rest = __objRest(_a, ["setup", "props"]);
529
+ return (component) => {
530
+ return createVNode2(param2, Object.assign({}, rest, setup2 ? {
531
+ setup: (self, parent) => setup2(self, parent, component)
532
+ } : {}));
533
+ };
534
+ }
535
+ });
536
+ }
524
537
  var getData = (component, path, alternative) => {
525
538
  const vue = access(component);
526
- const data = ObjectManager2.on(unref2(componentState(vue)));
539
+ const data = ObjectManager2.on(componentState(vue));
527
540
  if (path) {
528
541
  return data.get(dataPath(vue, path), alternative);
529
542
  } else {
@@ -533,13 +546,13 @@ var getData = (component, path, alternative) => {
533
546
  var setData = (component, data, path) => {
534
547
  const vue = access(component);
535
548
  const diff = {
536
- before: ObjectManager2.on(unref2(componentState(vue))).clone(),
549
+ before: ObjectManager2.on(componentState(vue)).clone(),
537
550
  after: path ? ObjectManager2.on(componentState(vue)).set(dataPath(vue, path), data).get() : ObjectManager2.on(componentState(vue)).set(data).get()
538
551
  };
539
552
  return "state" in vue ? diff : vue.$emit("update:state", diff);
540
553
  };
541
554
  var componentState = (component) => {
542
- return "state" in component ? component.state : component.$attrs.state;
555
+ return unref2("state" in component ? component.state : component.$attrs.state);
543
556
  };
544
557
  var dataPath = (component, path) => {
545
558
  return typeof component.$attrs["data:path"] === "function" ? component.$attrs["data:path"](path) : path;
@@ -550,6 +563,7 @@ export {
550
563
  access,
551
564
  dataPath,
552
565
  index_default as default,
566
+ defineReactiveView,
553
567
  extendVnode,
554
568
  getData,
555
569
  getDate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razaman2/reactive-view",
3
- "version": "0.0.34-beta.16",
3
+ "version": "0.0.34-beta.18",
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",