@razaman2/reactive-view 0.0.34-beta.17 → 0.0.34-beta.19

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;
@@ -43,6 +43,7 @@ declare const setup: {
43
43
  declare const _default: {
44
44
  props: {
45
45
  setup: {};
46
+ beta: BooleanConstructor;
46
47
  ReactiveView: {
47
48
  type: BooleanConstructor;
48
49
  default: boolean;
@@ -120,8 +121,14 @@ declare function useSubscription(): {
120
121
  declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
121
122
  declare function MergeStyles(...params: any): any;
122
123
  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>;
124
+ declare function defineReactiveView(options: Record<string, any>, component: typeof _default, _options: Record<string, any>): ReturnType<typeof defineComponent>;
125
+ declare function showComponent(component: any, options?: {
126
+ container?: string;
127
+ key?: string;
128
+ router?: any;
129
+ }): void;
123
130
  declare const getData: (component: any, path: number | string, alternative: any) => any;
124
131
  declare const setData: (component: any, data: any, path?: string) => any;
125
132
  declare const dataPath: (component: any, path: string | number) => any;
126
133
 
127
- export { MergeStyles, StyleParser, access, dataPath, _default as default, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, useSubscription };
134
+ export { MergeStyles, StyleParser, access, dataPath, _default as default, defineReactiveView, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, showComponent, 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;
@@ -43,6 +43,7 @@ declare const setup: {
43
43
  declare const _default: {
44
44
  props: {
45
45
  setup: {};
46
+ beta: BooleanConstructor;
46
47
  ReactiveView: {
47
48
  type: BooleanConstructor;
48
49
  default: boolean;
@@ -120,8 +121,14 @@ declare function useSubscription(): {
120
121
  declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
121
122
  declare function MergeStyles(...params: any): any;
122
123
  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>;
124
+ declare function defineReactiveView(options: Record<string, any>, component: typeof _default, _options: Record<string, any>): ReturnType<typeof defineComponent>;
125
+ declare function showComponent(component: any, options?: {
126
+ container?: string;
127
+ key?: string;
128
+ router?: any;
129
+ }): void;
123
130
  declare const getData: (component: any, path: number | string, alternative: any) => any;
124
131
  declare const setData: (component: any, data: any, path?: string) => any;
125
132
  declare const dataPath: (component: any, path: string | number) => any;
126
133
 
127
- export { MergeStyles, StyleParser, access, dataPath, _default as default, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, useSubscription };
134
+ export { MergeStyles, StyleParser, access, dataPath, _default as default, defineReactiveView, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, showComponent, 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,
@@ -69,6 +70,7 @@ __export(index_exports, {
69
70
  safeRequest: () => safeRequest,
70
71
  setData: () => setData,
71
72
  setup: () => setup,
73
+ showComponent: () => showComponent,
72
74
  useSubscription: () => useSubscription
73
75
  });
74
76
  module.exports = __toCommonJS(index_exports);
@@ -172,7 +174,7 @@ var import_vue = require("vue");
172
174
 
173
175
  // package.json
174
176
  var name = "@razaman2/reactive-view";
175
- var version = "0.0.34-beta.17";
177
+ var version = "0.0.34-beta.19";
176
178
 
177
179
  // src/ReactiveView.ts
178
180
  var setup = {
@@ -183,6 +185,7 @@ var setup = {
183
185
  var ReactiveView_default = {
184
186
  props: {
185
187
  setup: {},
188
+ beta: Boolean,
186
189
  ReactiveView: {
187
190
  type: Boolean,
188
191
  default: true
@@ -215,7 +218,7 @@ var ReactiveView_default = {
215
218
  state: { default: () => (0, import_vue.reactive)({}) }
216
219
  },
217
220
  setup(props, context) {
218
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
221
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
219
222
  const diff = (before, after) => {
220
223
  const change = after.paths().reduce((change2, path) => {
221
224
  if (before.get(path) !== after.get(path)) {
@@ -248,16 +251,46 @@ var ReactiveView_default = {
248
251
  const isPromiseData = ["Promise"].includes((_c = props.data) == null ? void 0 : _c.constructor.name) || isAsyncFunctionData;
249
252
  const defer = (0, import_vue.ref)(typeof props.defer === "function" ? props.defer() : props.defer);
250
253
  const vue = (0, import_vue.getCurrentInstance)();
251
- if ((isPromiseData || isFunctionData) && !("defaultData" in vue.vnode.props)) {
254
+ if ((isFunctionData || isPromiseData) && !("defaultData" in vue.vnode.props)) {
252
255
  console.error("[ReactiveView]: defaultData is required for promise or async function data.");
253
256
  }
254
257
  const defaultData = props.getDefaultData(
255
258
  ((_d = vue.vnode.props) == null ? void 0 : _d.hasOwnProperty("defaultData")) ? vue.vnode.props.defaultData : ((_e = vue.vnode.props) == null ? void 0 : _e.hasOwnProperty("data")) ? Array.isArray(vue.vnode.props.data) ? [] : {} : {}
256
259
  );
257
260
  const datatype = Array.isArray(defaultData) ? [] : {};
261
+ const normalize = (data) => {
262
+ var _a2, _b2, _c2;
263
+ console.warn(`[ReactiveView]: using beta props data in [${props.modelName}] component`, data, defaultData);
264
+ if ((0, import_vue.isReactive)(data)) {
265
+ return data;
266
+ } else if ((0, import_vue.isRef)(data)) {
267
+ try {
268
+ if (["Array", "Object"].includes((0, import_vue.unref)(data).constructor.name)) {
269
+ return (0, import_vue.unref)(data);
270
+ } else {
271
+ return (0, import_vue.reactive)({ "": (0, import_vue.unref)(data) });
272
+ }
273
+ } catch (e) {
274
+ return (0, import_vue.reactive)({ "": (0, import_vue.unref)(data) });
275
+ }
276
+ } else {
277
+ if (isFunctionData || isPromiseData) {
278
+ } else {
279
+ try {
280
+ if (["Array", "Object"].includes(data.constructor.name)) {
281
+ return (0, import_vue.reactive)(((_a2 = vue.vnode.props) == null ? void 0 : _a2.hasOwnProperty("data")) ? data : defaultData);
282
+ } else {
283
+ return (0, import_vue.reactive)({ "": ((_b2 = vue.vnode.props) == null ? void 0 : _b2.hasOwnProperty("data")) ? data : defaultData });
284
+ }
285
+ } catch (e) {
286
+ return (0, import_vue.reactive)({ "": ((_c2 = vue.vnode.props) == null ? void 0 : _c2.hasOwnProperty("data")) ? data : defaultData });
287
+ }
288
+ }
289
+ }
290
+ };
258
291
  const config = {
259
- data: (0, import_vue.reactive)(import_object_manager.default.on(
260
- isPromiseData || isFunctionData || (0, import_vue.isRef)(props.data) || (0, import_vue.isReactive)(props.data) ? datatype : ((_f = vue.vnode.props) == null ? void 0 : _f.hasOwnProperty("data")) ? props.data : datatype
292
+ data: props.beta ? normalize((_f = vue.vnode.props) == null ? void 0 : _f.data) : (0, import_vue.reactive)(import_object_manager.default.on(
293
+ isPromiseData || isFunctionData || (0, import_vue.isRef)(props.data) || (0, import_vue.isReactive)(props.data) ? datatype : ((_g = vue.vnode.props) == null ? void 0 : _g.hasOwnProperty("data")) ? props.data : datatype
261
294
  ).clone()),
262
295
  defaultData: import_object_manager.default.on(defaultData).clone(),
263
296
  notifications: props.notifications,
@@ -315,9 +348,9 @@ var ReactiveView_default = {
315
348
  const config2 = typeof context.attrs["onUpdate:model"] === "function" ? {
316
349
  callback: context.attrs["onUpdate:model"],
317
350
  options: Object.assign(__spreadValues(__spreadValues({
318
- deep: (_g = context.attrs["model:deep"]) != null ? _g : true
319
- }, 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)
320
- } : (_i = context.attrs["onUpdate:model"]) != null ? _i : {};
351
+ deep: (_h = context.attrs["model:deep"]) != null ? _h : true
352
+ }, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((_i = context.attrs["onUpdate:model"]) != null ? _i : {}).options)
353
+ } : (_j = context.attrs["onUpdate:model"]) != null ? _j : {};
321
354
  if (context.attrs["model:log"]) {
322
355
  console.log(`[ReactiveView]:model`, { config: config2 });
323
356
  }
@@ -325,11 +358,13 @@ var ReactiveView_default = {
325
358
  config2.callback(diff(import_object_manager.default.on(before), import_object_manager.default.on(after)), { component });
326
359
  }, config2.options);
327
360
  }
328
- setTimeout(async () => {
329
- var _a2;
330
- const [data] = await Promise.all([isAsyncFunctionData ? props.data() : props.data, (_a2 = defer.value) != null ? _a2 : true]);
331
- watchDataProp(data);
332
- });
361
+ if (!props.beta) {
362
+ setTimeout(async () => {
363
+ var _a2;
364
+ const [data] = await Promise.all([isAsyncFunctionData ? props.data() : props.data, (_a2 = defer.value) != null ? _a2 : true]);
365
+ watchDataProp(data);
366
+ });
367
+ }
333
368
  setTimeout(async () => {
334
369
  var _a2;
335
370
  isReady.value = (_a2 = await defer.value) != null ? _a2 : true;
@@ -565,9 +600,56 @@ var extendVnode = (component, element) => {
565
600
  }
566
601
  });
567
602
  };
603
+ function defineReactiveView(param1, param2) {
604
+ console.log(`log params:`, { param1, param2 });
605
+ return (0, import_vue2.defineComponent)({
606
+ props: __spreadValues({ setup }, param1.props),
607
+ setup() {
608
+ const _a = param1, { setup: setup2, props } = _a, rest = __objRest(_a, ["setup", "props"]);
609
+ return (component) => {
610
+ return (0, import_vue2.createVNode)(param2 != null ? param2 : ReactiveView_default, Object.assign({}, rest, setup2 ? {
611
+ setup: (self, parent) => setup2(self, parent, component)
612
+ // @ts-ignore
613
+ } : {}), typeof param1.slots === "function" ? param1.slots(component) : param1.slots);
614
+ };
615
+ }
616
+ });
617
+ }
618
+ function showComponent(component, options = {}) {
619
+ var _a;
620
+ if (!options.key || !document.getElementById(options.key)) {
621
+ const container = options.container || "app-modal";
622
+ const dialogs = document.getElementById(container) || document.createElement("div");
623
+ if (!dialogs.hasAttribute("id")) {
624
+ dialogs.setAttribute("id", container);
625
+ document.body.appendChild(dialogs);
626
+ }
627
+ const dialog = document.createElement("div");
628
+ const id = (_a = options.key) != null ? _a : `dialog_${dialogs.children.length + 1}`;
629
+ dialog.setAttribute("id", id);
630
+ dialogs.appendChild(dialog);
631
+ const app = (0, import_vue2.createApp)(
632
+ {
633
+ setup() {
634
+ return () => component;
635
+ }
636
+ },
637
+ {
638
+ __cleanup__: () => {
639
+ document.querySelectorAll(`#${id}`).forEach((element) => element.remove());
640
+ }
641
+ }
642
+ );
643
+ if (options.router) {
644
+ app.use(options.router).mount(`#${id}`);
645
+ } else {
646
+ app.mount(`#${id}`);
647
+ }
648
+ }
649
+ }
568
650
  var getData = (component, path, alternative) => {
569
651
  const vue = access(component);
570
- const data = import_object_manager2.default.on((0, import_vue2.unref)(componentState(vue)));
652
+ const data = import_object_manager2.default.on(componentState(vue));
571
653
  if (path) {
572
654
  return data.get(dataPath(vue, path), alternative);
573
655
  } else {
@@ -577,13 +659,13 @@ var getData = (component, path, alternative) => {
577
659
  var setData = (component, data, path) => {
578
660
  const vue = access(component);
579
661
  const diff = {
580
- before: import_object_manager2.default.on((0, import_vue2.unref)(componentState(vue))).clone(),
662
+ before: import_object_manager2.default.on(componentState(vue)).clone(),
581
663
  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
664
  };
583
665
  return "state" in vue ? diff : vue.$emit("update:state", diff);
584
666
  };
585
667
  var componentState = (component) => {
586
- return "state" in component ? component.state : component.$attrs.state;
668
+ return (0, import_vue2.unref)("state" in component ? component.state : component.$attrs.state);
587
669
  };
588
670
  var dataPath = (component, path) => {
589
671
  return typeof component.$attrs["data:path"] === "function" ? component.$attrs["data:path"](path) : path;
@@ -594,6 +676,7 @@ var dataPath = (component, path) => {
594
676
  StyleParser,
595
677
  access,
596
678
  dataPath,
679
+ defineReactiveView,
597
680
  extendVnode,
598
681
  getData,
599
682
  getDate,
@@ -602,5 +685,6 @@ var dataPath = (component, path) => {
602
685
  safeRequest,
603
686
  setData,
604
687
  setup,
688
+ showComponent,
605
689
  useSubscription
606
690
  });
package/dist/index.mjs CHANGED
@@ -124,11 +124,11 @@ var Subscriptions = _Subscriptions;
124
124
  // src/ReactiveView.ts
125
125
  import ObjectManager from "@razaman2/object-manager";
126
126
  import DataManager from "@razaman2/data-manager";
127
- import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstance } from "vue";
127
+ import { ref, reactive, watch, unref, isRef, isReactive, createVNode, getCurrentInstance } from "vue";
128
128
 
129
129
  // package.json
130
130
  var name = "@razaman2/reactive-view";
131
- var version = "0.0.34-beta.17";
131
+ var version = "0.0.34-beta.19";
132
132
 
133
133
  // src/ReactiveView.ts
134
134
  var setup = {
@@ -139,6 +139,7 @@ var setup = {
139
139
  var ReactiveView_default = {
140
140
  props: {
141
141
  setup: {},
142
+ beta: Boolean,
142
143
  ReactiveView: {
143
144
  type: Boolean,
144
145
  default: true
@@ -171,7 +172,7 @@ var ReactiveView_default = {
171
172
  state: { default: () => reactive({}) }
172
173
  },
173
174
  setup(props, context) {
174
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
175
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
175
176
  const diff = (before, after) => {
176
177
  const change = after.paths().reduce((change2, path) => {
177
178
  if (before.get(path) !== after.get(path)) {
@@ -204,16 +205,46 @@ var ReactiveView_default = {
204
205
  const isPromiseData = ["Promise"].includes((_c = props.data) == null ? void 0 : _c.constructor.name) || isAsyncFunctionData;
205
206
  const defer = ref(typeof props.defer === "function" ? props.defer() : props.defer);
206
207
  const vue = getCurrentInstance();
207
- if ((isPromiseData || isFunctionData) && !("defaultData" in vue.vnode.props)) {
208
+ if ((isFunctionData || isPromiseData) && !("defaultData" in vue.vnode.props)) {
208
209
  console.error("[ReactiveView]: defaultData is required for promise or async function data.");
209
210
  }
210
211
  const defaultData = props.getDefaultData(
211
212
  ((_d = vue.vnode.props) == null ? void 0 : _d.hasOwnProperty("defaultData")) ? vue.vnode.props.defaultData : ((_e = vue.vnode.props) == null ? void 0 : _e.hasOwnProperty("data")) ? Array.isArray(vue.vnode.props.data) ? [] : {} : {}
212
213
  );
213
214
  const datatype = Array.isArray(defaultData) ? [] : {};
215
+ const normalize = (data) => {
216
+ var _a2, _b2, _c2;
217
+ console.warn(`[ReactiveView]: using beta props data in [${props.modelName}] component`, data, defaultData);
218
+ if (isReactive(data)) {
219
+ return data;
220
+ } else if (isRef(data)) {
221
+ try {
222
+ if (["Array", "Object"].includes(unref(data).constructor.name)) {
223
+ return unref(data);
224
+ } else {
225
+ return reactive({ "": unref(data) });
226
+ }
227
+ } catch (e) {
228
+ return reactive({ "": unref(data) });
229
+ }
230
+ } else {
231
+ if (isFunctionData || isPromiseData) {
232
+ } else {
233
+ try {
234
+ if (["Array", "Object"].includes(data.constructor.name)) {
235
+ return reactive(((_a2 = vue.vnode.props) == null ? void 0 : _a2.hasOwnProperty("data")) ? data : defaultData);
236
+ } else {
237
+ return reactive({ "": ((_b2 = vue.vnode.props) == null ? void 0 : _b2.hasOwnProperty("data")) ? data : defaultData });
238
+ }
239
+ } catch (e) {
240
+ return reactive({ "": ((_c2 = vue.vnode.props) == null ? void 0 : _c2.hasOwnProperty("data")) ? data : defaultData });
241
+ }
242
+ }
243
+ }
244
+ };
214
245
  const config = {
215
- data: reactive(ObjectManager.on(
216
- isPromiseData || isFunctionData || isRef(props.data) || isReactive(props.data) ? datatype : ((_f = vue.vnode.props) == null ? void 0 : _f.hasOwnProperty("data")) ? props.data : datatype
246
+ data: props.beta ? normalize((_f = vue.vnode.props) == null ? void 0 : _f.data) : reactive(ObjectManager.on(
247
+ isPromiseData || isFunctionData || isRef(props.data) || isReactive(props.data) ? datatype : ((_g = vue.vnode.props) == null ? void 0 : _g.hasOwnProperty("data")) ? props.data : datatype
217
248
  ).clone()),
218
249
  defaultData: ObjectManager.on(defaultData).clone(),
219
250
  notifications: props.notifications,
@@ -271,9 +302,9 @@ var ReactiveView_default = {
271
302
  const config2 = typeof context.attrs["onUpdate:model"] === "function" ? {
272
303
  callback: context.attrs["onUpdate:model"],
273
304
  options: Object.assign(__spreadValues(__spreadValues({
274
- deep: (_g = context.attrs["model:deep"]) != null ? _g : true
275
- }, 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)
276
- } : (_i = context.attrs["onUpdate:model"]) != null ? _i : {};
305
+ deep: (_h = context.attrs["model:deep"]) != null ? _h : true
306
+ }, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((_i = context.attrs["onUpdate:model"]) != null ? _i : {}).options)
307
+ } : (_j = context.attrs["onUpdate:model"]) != null ? _j : {};
277
308
  if (context.attrs["model:log"]) {
278
309
  console.log(`[ReactiveView]:model`, { config: config2 });
279
310
  }
@@ -281,11 +312,13 @@ var ReactiveView_default = {
281
312
  config2.callback(diff(ObjectManager.on(before), ObjectManager.on(after)), { component });
282
313
  }, config2.options);
283
314
  }
284
- setTimeout(async () => {
285
- var _a2;
286
- const [data] = await Promise.all([isAsyncFunctionData ? props.data() : props.data, (_a2 = defer.value) != null ? _a2 : true]);
287
- watchDataProp(data);
288
- });
315
+ if (!props.beta) {
316
+ setTimeout(async () => {
317
+ var _a2;
318
+ const [data] = await Promise.all([isAsyncFunctionData ? props.data() : props.data, (_a2 = defer.value) != null ? _a2 : true]);
319
+ watchDataProp(data);
320
+ });
321
+ }
289
322
  setTimeout(async () => {
290
323
  var _a2;
291
324
  isReady.value = (_a2 = await defer.value) != null ? _a2 : true;
@@ -319,7 +352,7 @@ var ReactiveView_default = {
319
352
  };
320
353
 
321
354
  // src/index.ts
322
- import { h, unref as unref2, toRaw, createVNode as createVNode2 } from "vue";
355
+ import { h, unref as unref2, toRaw, createApp, createVNode as createVNode2, defineComponent } from "vue";
323
356
  import { formatInTimeZone } from "date-fns-tz";
324
357
  import { twMerge } from "tailwind-merge";
325
358
  console.log(`%c[ReactiveView]: ${version}`, "background-color: red; color: yellow;");
@@ -521,9 +554,56 @@ var extendVnode = (component, element) => {
521
554
  }
522
555
  });
523
556
  };
557
+ function defineReactiveView(param1, param2) {
558
+ console.log(`log params:`, { param1, param2 });
559
+ return defineComponent({
560
+ props: __spreadValues({ setup }, param1.props),
561
+ setup() {
562
+ const _a = param1, { setup: setup2, props } = _a, rest = __objRest(_a, ["setup", "props"]);
563
+ return (component) => {
564
+ return createVNode2(param2 != null ? param2 : ReactiveView_default, Object.assign({}, rest, setup2 ? {
565
+ setup: (self, parent) => setup2(self, parent, component)
566
+ // @ts-ignore
567
+ } : {}), typeof param1.slots === "function" ? param1.slots(component) : param1.slots);
568
+ };
569
+ }
570
+ });
571
+ }
572
+ function showComponent(component, options = {}) {
573
+ var _a;
574
+ if (!options.key || !document.getElementById(options.key)) {
575
+ const container = options.container || "app-modal";
576
+ const dialogs = document.getElementById(container) || document.createElement("div");
577
+ if (!dialogs.hasAttribute("id")) {
578
+ dialogs.setAttribute("id", container);
579
+ document.body.appendChild(dialogs);
580
+ }
581
+ const dialog = document.createElement("div");
582
+ const id = (_a = options.key) != null ? _a : `dialog_${dialogs.children.length + 1}`;
583
+ dialog.setAttribute("id", id);
584
+ dialogs.appendChild(dialog);
585
+ const app = createApp(
586
+ {
587
+ setup() {
588
+ return () => component;
589
+ }
590
+ },
591
+ {
592
+ __cleanup__: () => {
593
+ document.querySelectorAll(`#${id}`).forEach((element) => element.remove());
594
+ }
595
+ }
596
+ );
597
+ if (options.router) {
598
+ app.use(options.router).mount(`#${id}`);
599
+ } else {
600
+ app.mount(`#${id}`);
601
+ }
602
+ }
603
+ }
524
604
  var getData = (component, path, alternative) => {
525
605
  const vue = access(component);
526
- const data = ObjectManager2.on(unref2(componentState(vue)));
606
+ const data = ObjectManager2.on(componentState(vue));
527
607
  if (path) {
528
608
  return data.get(dataPath(vue, path), alternative);
529
609
  } else {
@@ -533,13 +613,13 @@ var getData = (component, path, alternative) => {
533
613
  var setData = (component, data, path) => {
534
614
  const vue = access(component);
535
615
  const diff = {
536
- before: ObjectManager2.on(unref2(componentState(vue))).clone(),
616
+ before: ObjectManager2.on(componentState(vue)).clone(),
537
617
  after: path ? ObjectManager2.on(componentState(vue)).set(dataPath(vue, path), data).get() : ObjectManager2.on(componentState(vue)).set(data).get()
538
618
  };
539
619
  return "state" in vue ? diff : vue.$emit("update:state", diff);
540
620
  };
541
621
  var componentState = (component) => {
542
- return "state" in component ? component.state : component.$attrs.state;
622
+ return unref2("state" in component ? component.state : component.$attrs.state);
543
623
  };
544
624
  var dataPath = (component, path) => {
545
625
  return typeof component.$attrs["data:path"] === "function" ? component.$attrs["data:path"](path) : path;
@@ -550,6 +630,7 @@ export {
550
630
  access,
551
631
  dataPath,
552
632
  index_default as default,
633
+ defineReactiveView,
553
634
  extendVnode,
554
635
  getData,
555
636
  getDate,
@@ -558,5 +639,6 @@ export {
558
639
  safeRequest,
559
640
  setData,
560
641
  setup,
642
+ showComponent,
561
643
  useSubscription
562
644
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razaman2/reactive-view",
3
- "version": "0.0.34-beta.17",
3
+ "version": "0.0.34-beta.19",
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",