@razaman2/reactive-view 0.0.34-beta.27 → 0.0.34-beta.29
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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +38 -22
- package/dist/index.mjs +42 -26
- package/package.json +48 -48
package/dist/index.d.mts
CHANGED
|
@@ -128,7 +128,8 @@ declare function showComponent(component: any, options?: {
|
|
|
128
128
|
container?: string;
|
|
129
129
|
key?: string;
|
|
130
130
|
router?: any;
|
|
131
|
-
|
|
131
|
+
plugins?: Array<any>;
|
|
132
|
+
}): any;
|
|
132
133
|
declare const getData: (component: any, path: number | string, alternative: any) => any;
|
|
133
134
|
declare const setData: (component: any, data: any, path?: string) => any;
|
|
134
135
|
declare const dataPath: (component: any, path: string | number) => any;
|
package/dist/index.d.ts
CHANGED
|
@@ -128,7 +128,8 @@ declare function showComponent(component: any, options?: {
|
|
|
128
128
|
container?: string;
|
|
129
129
|
key?: string;
|
|
130
130
|
router?: any;
|
|
131
|
-
|
|
131
|
+
plugins?: Array<any>;
|
|
132
|
+
}): any;
|
|
132
133
|
declare const getData: (component: any, path: number | string, alternative: any) => any;
|
|
133
134
|
declare const setData: (component: any, data: any, path?: string) => any;
|
|
134
135
|
declare const dataPath: (component: any, path: string | number) => any;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -19,6 +21,7 @@ var __spreadValues = (a, b) => {
|
|
|
19
21
|
}
|
|
20
22
|
return a;
|
|
21
23
|
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
25
|
var __objRest = (source, exclude) => {
|
|
23
26
|
var target = {};
|
|
24
27
|
for (var prop in source)
|
|
@@ -174,7 +177,7 @@ var import_vue = require("vue");
|
|
|
174
177
|
|
|
175
178
|
// package.json
|
|
176
179
|
var name = "@razaman2/reactive-view";
|
|
177
|
-
var version = "0.0.34-beta.
|
|
180
|
+
var version = "0.0.34-beta.29";
|
|
178
181
|
|
|
179
182
|
// src/ReactiveView.ts
|
|
180
183
|
var setup = {
|
|
@@ -194,7 +197,7 @@ var ReactiveView_default = {
|
|
|
194
197
|
notifications: Object,
|
|
195
198
|
subscriptions: Object,
|
|
196
199
|
beforeSetData: Function,
|
|
197
|
-
data: { default: () => ({}) },
|
|
200
|
+
data: { default: () => (0, import_vue.reactive)({}) },
|
|
198
201
|
defaultData: {},
|
|
199
202
|
getDefaultData: {
|
|
200
203
|
type: Function,
|
|
@@ -255,17 +258,17 @@ var ReactiveView_default = {
|
|
|
255
258
|
console.error("[ReactiveView]: defaultData is required for promise or async function data.");
|
|
256
259
|
}
|
|
257
260
|
const defaultData = props.getDefaultData(
|
|
258
|
-
"defaultData" in vue.vnode.props ? vue.vnode.props.defaultData : "data" in vue.vnode.props ? Array.isArray(vue.vnode.props.data) ? [] : {} : {}
|
|
261
|
+
"defaultData" in vue.vnode.props ? vue.vnode.props.defaultData : "data" in vue.vnode.props ? Array.isArray((0, import_vue.isRef)(vue.vnode.props.data) ? (0, import_vue.unref)(vue.vnode.props.data) : vue.vnode.props.data) ? [] : {} : {}
|
|
259
262
|
);
|
|
260
263
|
const datatype = Array.isArray(defaultData) ? [] : {};
|
|
261
264
|
const normalize = (data) => {
|
|
262
265
|
if (props.debug) {
|
|
263
|
-
console.warn(`[ReactiveView]: using beta props data in [${props.modelName}] component`, { vue, data, defaultData,
|
|
266
|
+
console.warn(`[ReactiveView]: using beta props data in [${props.modelName}] component`, { vue, data, defaultData, isRef: (0, import_vue.isRef)(data), isReactive: (0, import_vue.isReactive)(data) });
|
|
264
267
|
}
|
|
265
|
-
if ((0, import_vue.
|
|
268
|
+
if ((0, import_vue.isReactive)(data)) {
|
|
266
269
|
return data;
|
|
267
270
|
} else {
|
|
268
|
-
if (isFunctionData || isPromiseData) {
|
|
271
|
+
if ((0, import_vue.isRef)(data) || isFunctionData || isPromiseData) {
|
|
269
272
|
return (0, import_vue.reactive)(datatype);
|
|
270
273
|
} else {
|
|
271
274
|
const props2 = "data" in vue.vnode.props;
|
|
@@ -315,7 +318,7 @@ var ReactiveView_default = {
|
|
|
315
318
|
});
|
|
316
319
|
const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, model, diff, dataPath: dataPath2, isValid } });
|
|
317
320
|
if (props.debug) {
|
|
318
|
-
console.
|
|
321
|
+
console.warn("[ReactiveView]:", { props, context, vue, defer, config, model, component, datatype, defaultData, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
|
|
319
322
|
}
|
|
320
323
|
const watchDataProp = (dataProp) => {
|
|
321
324
|
var _a2, _b2, _c2, _d2;
|
|
@@ -326,7 +329,7 @@ var ReactiveView_default = {
|
|
|
326
329
|
}, context.attrs["data:immediate"] ? { immediate: context.attrs["data:immediate"] } : {}), context.attrs["data:once"] ? { once: context.attrs["data:once"] } : {}), ((_d2 = context.attrs["onUpdate:data"]) != null ? _d2 : {}).options)
|
|
327
330
|
};
|
|
328
331
|
if (context.attrs["data:log"]) {
|
|
329
|
-
console.
|
|
332
|
+
console.warn(`[ReactiveView]:data`, { config: config2, dataProp });
|
|
330
333
|
}
|
|
331
334
|
(0, import_vue.watch)(isFunctionData || (0, import_vue.isRef)(dataProp) || (0, import_vue.isReactive)(dataProp) ? dataProp : () => dataProp, (after, before) => {
|
|
332
335
|
var _a3;
|
|
@@ -345,31 +348,35 @@ var ReactiveView_default = {
|
|
|
345
348
|
}, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((_f = context.attrs["onUpdate:model"]) != null ? _f : {}).options)
|
|
346
349
|
} : (_g = context.attrs["onUpdate:model"]) != null ? _g : {};
|
|
347
350
|
if (context.attrs["model:log"]) {
|
|
348
|
-
console.
|
|
351
|
+
console.warn(`[ReactiveView]:model`, { config: config2 });
|
|
349
352
|
}
|
|
350
353
|
(0, import_vue.watch)(() => import_object_manager.default.on(model.getData()).clone(), (after, before) => {
|
|
351
354
|
config2.callback(access(component).diff(import_object_manager.default.on(before), import_object_manager.default.on(after)), { component });
|
|
352
355
|
}, config2.options);
|
|
353
356
|
}
|
|
354
357
|
if (props.beta) {
|
|
355
|
-
|
|
358
|
+
const isRefData = (0, import_vue.isRef)(props.data);
|
|
359
|
+
if (isRefData || isFunctionData || isPromiseData) {
|
|
356
360
|
setTimeout(async () => {
|
|
357
|
-
var _a2, _b2;
|
|
361
|
+
var _a2, _b2, _c2;
|
|
358
362
|
const [data] = isPromiseData ? await Promise.all([
|
|
359
363
|
isAsyncFunctionData ? props.data() : props.data,
|
|
360
364
|
(_a2 = defer.value) != null ? _a2 : true
|
|
361
365
|
]) : [props.data];
|
|
362
|
-
(0, import_vue.watch)(isFunctionData ? data : typeof data === "function" ? data : () => data, (after, before) => {
|
|
366
|
+
(0, import_vue.watch)(isRefData ? data : isFunctionData ? data : typeof data === "function" ? data : () => data, (after, before) => {
|
|
363
367
|
var _a3;
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
368
|
+
if (before !== void 0 || after !== void 0) {
|
|
369
|
+
const callback = context.attrs["data:callback"];
|
|
370
|
+
if (typeof callback === "function") {
|
|
371
|
+
const diff2 = access(component).diff(import_object_manager.default.on(before), import_object_manager.default.on(after));
|
|
372
|
+
model.replaceData((_a3 = callback(diff2, { component })) != null ? _a3 : after);
|
|
373
|
+
} else {
|
|
374
|
+
model.replaceData(after);
|
|
375
|
+
}
|
|
369
376
|
}
|
|
370
377
|
}, {
|
|
371
378
|
immediate: (_b2 = context.attrs["data:immediate"]) != null ? _b2 : true,
|
|
372
|
-
deep: context.attrs["data:deep"],
|
|
379
|
+
deep: (_c2 = context.attrs["data:deep"]) != null ? _c2 : true,
|
|
373
380
|
once: context.attrs["data:once"]
|
|
374
381
|
});
|
|
375
382
|
});
|
|
@@ -622,7 +629,7 @@ var extendVnode = (component, element) => {
|
|
|
622
629
|
});
|
|
623
630
|
};
|
|
624
631
|
function defineReactiveView(param1, param2) {
|
|
625
|
-
|
|
632
|
+
const instance = (0, import_vue2.ref)();
|
|
626
633
|
return (0, import_vue2.defineComponent)({
|
|
627
634
|
name: param1 == null ? void 0 : param1.modelName,
|
|
628
635
|
props: __spreadValues({ setup }, param1 ? param1.props : {}),
|
|
@@ -630,18 +637,23 @@ function defineReactiveView(param1, param2) {
|
|
|
630
637
|
const _a = param1 != null ? param1 : {}, { setup: setup2, props } = _a, rest = __objRest(_a, ["setup", "props"]);
|
|
631
638
|
return (component) => {
|
|
632
639
|
const props2 = Object.entries(rest).reduce((props3, [key, val]) => {
|
|
633
|
-
return Object.assign(props3, { [key]: typeof val === "function" ? val(component) : val });
|
|
640
|
+
return Object.assign(props3, { [key]: typeof val === "function" ? val(component, instance) : val });
|
|
634
641
|
}, {});
|
|
635
642
|
const slots = typeof (param1 == null ? void 0 : param1.slots) === "function" ? param1.slots(component) : Array.isArray(param1 == null ? void 0 : param1.slots) ? () => param1.slots : param1 == null ? void 0 : param1.slots;
|
|
636
|
-
return (0, import_vue2.createVNode)(param2 != null ? param2 : ReactiveView_default, __spreadValues(__spreadValues({}, props2), Object.assign({}, props2, typeof setup2 === "function" ? {
|
|
643
|
+
return (0, import_vue2.createVNode)(param2 != null ? param2 : ReactiveView_default, __spreadProps(__spreadValues(__spreadValues({}, props2), Object.assign({}, props2, typeof setup2 === "function" ? {
|
|
637
644
|
setup: (self, parent) => setup2(self, parent, component)
|
|
638
|
-
} : {})),
|
|
645
|
+
} : {})), {
|
|
646
|
+
instance
|
|
647
|
+
}), slots);
|
|
639
648
|
};
|
|
640
649
|
}
|
|
641
650
|
});
|
|
642
651
|
}
|
|
643
652
|
function showComponent(component, options = {}) {
|
|
644
653
|
var _a;
|
|
654
|
+
if (options.router) {
|
|
655
|
+
console.warn("[ReactiveView]: Deprecated {router} option used with {showComponent()}. \nUse {plugins} option instead.");
|
|
656
|
+
}
|
|
645
657
|
if (!options.key || !document.getElementById(options.key)) {
|
|
646
658
|
const container = options.container || "app-dialogs";
|
|
647
659
|
const dialogs = document.getElementById(container) || document.createElement("div");
|
|
@@ -668,6 +680,10 @@ function showComponent(component, options = {}) {
|
|
|
668
680
|
);
|
|
669
681
|
if (options.router) {
|
|
670
682
|
return app.use(options.router).mount(`#${id}`);
|
|
683
|
+
} else if (options.plugins) {
|
|
684
|
+
return options.plugins.reduce((app2, plugin) => {
|
|
685
|
+
return app2.use(...Array.isArray(plugin) ? plugin : [plugin]);
|
|
686
|
+
}, app).mount(`#${id}`);
|
|
671
687
|
} else {
|
|
672
688
|
return app.mount(`#${id}`);
|
|
673
689
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -14,6 +16,7 @@ var __spreadValues = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
17
20
|
var __objRest = (source, exclude) => {
|
|
18
21
|
var target = {};
|
|
19
22
|
for (var prop in source)
|
|
@@ -124,11 +127,11 @@ var Subscriptions = _Subscriptions;
|
|
|
124
127
|
// src/ReactiveView.ts
|
|
125
128
|
import ObjectManager from "@razaman2/object-manager";
|
|
126
129
|
import DataManager from "@razaman2/data-manager";
|
|
127
|
-
import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstance } from "vue";
|
|
130
|
+
import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstance, unref } from "vue";
|
|
128
131
|
|
|
129
132
|
// package.json
|
|
130
133
|
var name = "@razaman2/reactive-view";
|
|
131
|
-
var version = "0.0.34-beta.
|
|
134
|
+
var version = "0.0.34-beta.29";
|
|
132
135
|
|
|
133
136
|
// src/ReactiveView.ts
|
|
134
137
|
var setup = {
|
|
@@ -148,7 +151,7 @@ var ReactiveView_default = {
|
|
|
148
151
|
notifications: Object,
|
|
149
152
|
subscriptions: Object,
|
|
150
153
|
beforeSetData: Function,
|
|
151
|
-
data: { default: () => ({}) },
|
|
154
|
+
data: { default: () => reactive({}) },
|
|
152
155
|
defaultData: {},
|
|
153
156
|
getDefaultData: {
|
|
154
157
|
type: Function,
|
|
@@ -209,17 +212,17 @@ var ReactiveView_default = {
|
|
|
209
212
|
console.error("[ReactiveView]: defaultData is required for promise or async function data.");
|
|
210
213
|
}
|
|
211
214
|
const defaultData = props.getDefaultData(
|
|
212
|
-
"defaultData" in vue.vnode.props ? vue.vnode.props.defaultData : "data" in vue.vnode.props ? Array.isArray(vue.vnode.props.data) ? [] : {} : {}
|
|
215
|
+
"defaultData" in vue.vnode.props ? vue.vnode.props.defaultData : "data" in vue.vnode.props ? Array.isArray(isRef(vue.vnode.props.data) ? unref(vue.vnode.props.data) : vue.vnode.props.data) ? [] : {} : {}
|
|
213
216
|
);
|
|
214
217
|
const datatype = Array.isArray(defaultData) ? [] : {};
|
|
215
218
|
const normalize = (data) => {
|
|
216
219
|
if (props.debug) {
|
|
217
|
-
console.warn(`[ReactiveView]: using beta props data in [${props.modelName}] component`, { vue, data, defaultData,
|
|
220
|
+
console.warn(`[ReactiveView]: using beta props data in [${props.modelName}] component`, { vue, data, defaultData, isRef: isRef(data), isReactive: isReactive(data) });
|
|
218
221
|
}
|
|
219
|
-
if (
|
|
222
|
+
if (isReactive(data)) {
|
|
220
223
|
return data;
|
|
221
224
|
} else {
|
|
222
|
-
if (isFunctionData || isPromiseData) {
|
|
225
|
+
if (isRef(data) || isFunctionData || isPromiseData) {
|
|
223
226
|
return reactive(datatype);
|
|
224
227
|
} else {
|
|
225
228
|
const props2 = "data" in vue.vnode.props;
|
|
@@ -269,7 +272,7 @@ var ReactiveView_default = {
|
|
|
269
272
|
});
|
|
270
273
|
const component = ref({ parent: { self: vue.proxy }, self: { template, model, diff, dataPath: dataPath2, isValid } });
|
|
271
274
|
if (props.debug) {
|
|
272
|
-
console.
|
|
275
|
+
console.warn("[ReactiveView]:", { props, context, vue, defer, config, model, component, datatype, defaultData, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
|
|
273
276
|
}
|
|
274
277
|
const watchDataProp = (dataProp) => {
|
|
275
278
|
var _a2, _b2, _c2, _d2;
|
|
@@ -280,7 +283,7 @@ var ReactiveView_default = {
|
|
|
280
283
|
}, context.attrs["data:immediate"] ? { immediate: context.attrs["data:immediate"] } : {}), context.attrs["data:once"] ? { once: context.attrs["data:once"] } : {}), ((_d2 = context.attrs["onUpdate:data"]) != null ? _d2 : {}).options)
|
|
281
284
|
};
|
|
282
285
|
if (context.attrs["data:log"]) {
|
|
283
|
-
console.
|
|
286
|
+
console.warn(`[ReactiveView]:data`, { config: config2, dataProp });
|
|
284
287
|
}
|
|
285
288
|
watch(isFunctionData || isRef(dataProp) || isReactive(dataProp) ? dataProp : () => dataProp, (after, before) => {
|
|
286
289
|
var _a3;
|
|
@@ -299,31 +302,35 @@ var ReactiveView_default = {
|
|
|
299
302
|
}, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((_f = context.attrs["onUpdate:model"]) != null ? _f : {}).options)
|
|
300
303
|
} : (_g = context.attrs["onUpdate:model"]) != null ? _g : {};
|
|
301
304
|
if (context.attrs["model:log"]) {
|
|
302
|
-
console.
|
|
305
|
+
console.warn(`[ReactiveView]:model`, { config: config2 });
|
|
303
306
|
}
|
|
304
307
|
watch(() => ObjectManager.on(model.getData()).clone(), (after, before) => {
|
|
305
308
|
config2.callback(access(component).diff(ObjectManager.on(before), ObjectManager.on(after)), { component });
|
|
306
309
|
}, config2.options);
|
|
307
310
|
}
|
|
308
311
|
if (props.beta) {
|
|
309
|
-
|
|
312
|
+
const isRefData = isRef(props.data);
|
|
313
|
+
if (isRefData || isFunctionData || isPromiseData) {
|
|
310
314
|
setTimeout(async () => {
|
|
311
|
-
var _a2, _b2;
|
|
315
|
+
var _a2, _b2, _c2;
|
|
312
316
|
const [data] = isPromiseData ? await Promise.all([
|
|
313
317
|
isAsyncFunctionData ? props.data() : props.data,
|
|
314
318
|
(_a2 = defer.value) != null ? _a2 : true
|
|
315
319
|
]) : [props.data];
|
|
316
|
-
watch(isFunctionData ? data : typeof data === "function" ? data : () => data, (after, before) => {
|
|
320
|
+
watch(isRefData ? data : isFunctionData ? data : typeof data === "function" ? data : () => data, (after, before) => {
|
|
317
321
|
var _a3;
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
322
|
+
if (before !== void 0 || after !== void 0) {
|
|
323
|
+
const callback = context.attrs["data:callback"];
|
|
324
|
+
if (typeof callback === "function") {
|
|
325
|
+
const diff2 = access(component).diff(ObjectManager.on(before), ObjectManager.on(after));
|
|
326
|
+
model.replaceData((_a3 = callback(diff2, { component })) != null ? _a3 : after);
|
|
327
|
+
} else {
|
|
328
|
+
model.replaceData(after);
|
|
329
|
+
}
|
|
323
330
|
}
|
|
324
331
|
}, {
|
|
325
332
|
immediate: (_b2 = context.attrs["data:immediate"]) != null ? _b2 : true,
|
|
326
|
-
deep: context.attrs["data:deep"],
|
|
333
|
+
deep: (_c2 = context.attrs["data:deep"]) != null ? _c2 : true,
|
|
327
334
|
once: context.attrs["data:once"]
|
|
328
335
|
});
|
|
329
336
|
});
|
|
@@ -371,7 +378,7 @@ var ReactiveView_default = {
|
|
|
371
378
|
};
|
|
372
379
|
|
|
373
380
|
// src/index.ts
|
|
374
|
-
import { h, unref, toRaw, createApp, createVNode as createVNode2, defineComponent } from "vue";
|
|
381
|
+
import { h, ref as ref2, unref as unref2, toRaw, createApp, createVNode as createVNode2, defineComponent } from "vue";
|
|
375
382
|
import { formatInTimeZone } from "date-fns-tz";
|
|
376
383
|
import { twMerge } from "tailwind-merge";
|
|
377
384
|
console.log(`%c[ReactiveView]: ${version}`, "background-color: red; color: yellow;");
|
|
@@ -471,7 +478,7 @@ function access(view = {}, alternative) {
|
|
|
471
478
|
});
|
|
472
479
|
};
|
|
473
480
|
try {
|
|
474
|
-
const component = (_a =
|
|
481
|
+
const component = (_a = unref2(typeof view === "function" ? view() : view)) != null ? _a : {};
|
|
475
482
|
return resolve("instance" in component ? component.instance : component);
|
|
476
483
|
} catch (e) {
|
|
477
484
|
return resolve(view);
|
|
@@ -576,7 +583,7 @@ var extendVnode = (component, element) => {
|
|
|
576
583
|
});
|
|
577
584
|
};
|
|
578
585
|
function defineReactiveView(param1, param2) {
|
|
579
|
-
|
|
586
|
+
const instance = ref2();
|
|
580
587
|
return defineComponent({
|
|
581
588
|
name: param1 == null ? void 0 : param1.modelName,
|
|
582
589
|
props: __spreadValues({ setup }, param1 ? param1.props : {}),
|
|
@@ -584,18 +591,23 @@ function defineReactiveView(param1, param2) {
|
|
|
584
591
|
const _a = param1 != null ? param1 : {}, { setup: setup2, props } = _a, rest = __objRest(_a, ["setup", "props"]);
|
|
585
592
|
return (component) => {
|
|
586
593
|
const props2 = Object.entries(rest).reduce((props3, [key, val]) => {
|
|
587
|
-
return Object.assign(props3, { [key]: typeof val === "function" ? val(component) : val });
|
|
594
|
+
return Object.assign(props3, { [key]: typeof val === "function" ? val(component, instance) : val });
|
|
588
595
|
}, {});
|
|
589
596
|
const slots = typeof (param1 == null ? void 0 : param1.slots) === "function" ? param1.slots(component) : Array.isArray(param1 == null ? void 0 : param1.slots) ? () => param1.slots : param1 == null ? void 0 : param1.slots;
|
|
590
|
-
return createVNode2(param2 != null ? param2 : ReactiveView_default, __spreadValues(__spreadValues({}, props2), Object.assign({}, props2, typeof setup2 === "function" ? {
|
|
597
|
+
return createVNode2(param2 != null ? param2 : ReactiveView_default, __spreadProps(__spreadValues(__spreadValues({}, props2), Object.assign({}, props2, typeof setup2 === "function" ? {
|
|
591
598
|
setup: (self, parent) => setup2(self, parent, component)
|
|
592
|
-
} : {})),
|
|
599
|
+
} : {})), {
|
|
600
|
+
instance
|
|
601
|
+
}), slots);
|
|
593
602
|
};
|
|
594
603
|
}
|
|
595
604
|
});
|
|
596
605
|
}
|
|
597
606
|
function showComponent(component, options = {}) {
|
|
598
607
|
var _a;
|
|
608
|
+
if (options.router) {
|
|
609
|
+
console.warn("[ReactiveView]: Deprecated {router} option used with {showComponent()}. \nUse {plugins} option instead.");
|
|
610
|
+
}
|
|
599
611
|
if (!options.key || !document.getElementById(options.key)) {
|
|
600
612
|
const container = options.container || "app-dialogs";
|
|
601
613
|
const dialogs = document.getElementById(container) || document.createElement("div");
|
|
@@ -622,6 +634,10 @@ function showComponent(component, options = {}) {
|
|
|
622
634
|
);
|
|
623
635
|
if (options.router) {
|
|
624
636
|
return app.use(options.router).mount(`#${id}`);
|
|
637
|
+
} else if (options.plugins) {
|
|
638
|
+
return options.plugins.reduce((app2, plugin) => {
|
|
639
|
+
return app2.use(...Array.isArray(plugin) ? plugin : [plugin]);
|
|
640
|
+
}, app).mount(`#${id}`);
|
|
625
641
|
} else {
|
|
626
642
|
return app.mount(`#${id}`);
|
|
627
643
|
}
|
|
@@ -645,7 +661,7 @@ var setData = (component, data, path) => {
|
|
|
645
661
|
return "state" in vue ? diff : vue.$emit("update:state", diff);
|
|
646
662
|
};
|
|
647
663
|
var componentState = (component) => {
|
|
648
|
-
return
|
|
664
|
+
return unref2("state" in component ? component.state : component.$attrs.state);
|
|
649
665
|
};
|
|
650
666
|
var dataPath = (component, path) => {
|
|
651
667
|
return typeof component.$attrs["data:path"] === "function" ? component.$attrs["data:path"](path) : path;
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@razaman2/reactive-view",
|
|
3
|
-
"version": "0.0.34-beta.
|
|
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
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"prepublishOnly": "npm run build",
|
|
10
|
-
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
11
|
-
"lint": "tsc",
|
|
12
|
-
"test": "cd tests/vue-ts && npm run dev",
|
|
13
|
-
"pr": "sh pr.sh"
|
|
14
|
-
},
|
|
15
|
-
"keywords": [
|
|
16
|
-
"vue",
|
|
17
|
-
"vue-helper",
|
|
18
|
-
"reactive-view",
|
|
19
|
-
"vue-class-component",
|
|
20
|
-
"reactive-ui"
|
|
21
|
-
],
|
|
22
|
-
"author": "razaman2",
|
|
23
|
-
"license": "MIT",
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@razaman2/data-manager": "^3.2.12",
|
|
26
|
-
"@razaman2/event-emitter": "^2.1.1",
|
|
27
|
-
"@razaman2/object-manager": "^3.4.7",
|
|
28
|
-
"date-fns": "^4.1.0",
|
|
29
|
-
"date-fns-tz": "^3.2.0",
|
|
30
|
-
"tailwind-merge": "^3.3.1",
|
|
31
|
-
"uuid": "^13.0.0"
|
|
32
|
-
},
|
|
33
|
-
"peerDependencies": {
|
|
34
|
-
"vue": ">=3.0.0"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@types/uuid": "^11.0.0",
|
|
38
|
-
"tsup": "^8.5.0",
|
|
39
|
-
"typescript": "^5.9.3",
|
|
40
|
-
"vitest": "^4.0.5"
|
|
41
|
-
},
|
|
42
|
-
"publishConfig": {
|
|
43
|
-
"access": "public"
|
|
44
|
-
},
|
|
45
|
-
"files": [
|
|
46
|
-
"dist"
|
|
47
|
-
]
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@razaman2/reactive-view",
|
|
3
|
+
"version": "0.0.34-beta.29",
|
|
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
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"prepublishOnly": "npm run build",
|
|
10
|
+
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
11
|
+
"lint": "tsc",
|
|
12
|
+
"test": "cd tests/vue-ts && npm run dev",
|
|
13
|
+
"pr": "sh pr.sh"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"vue",
|
|
17
|
+
"vue-helper",
|
|
18
|
+
"reactive-view",
|
|
19
|
+
"vue-class-component",
|
|
20
|
+
"reactive-ui"
|
|
21
|
+
],
|
|
22
|
+
"author": "razaman2",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@razaman2/data-manager": "^3.2.12",
|
|
26
|
+
"@razaman2/event-emitter": "^2.1.1",
|
|
27
|
+
"@razaman2/object-manager": "^3.4.7",
|
|
28
|
+
"date-fns": "^4.1.0",
|
|
29
|
+
"date-fns-tz": "^3.2.0",
|
|
30
|
+
"tailwind-merge": "^3.3.1",
|
|
31
|
+
"uuid": "^13.0.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"vue": ">=3.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/uuid": "^11.0.0",
|
|
38
|
+
"tsup": "^8.5.0",
|
|
39
|
+
"typescript": "^5.9.3",
|
|
40
|
+
"vitest": "^4.0.5"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist"
|
|
47
|
+
]
|
|
48
|
+
}
|