@razaman2/reactive-view 0.0.34-beta.27 → 0.0.34-beta.28
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 +16 -9
- package/dist/index.mjs +16 -9
- 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
|
@@ -174,7 +174,7 @@ var import_vue = require("vue");
|
|
|
174
174
|
|
|
175
175
|
// package.json
|
|
176
176
|
var name = "@razaman2/reactive-view";
|
|
177
|
-
var version = "0.0.34-beta.
|
|
177
|
+
var version = "0.0.34-beta.28";
|
|
178
178
|
|
|
179
179
|
// src/ReactiveView.ts
|
|
180
180
|
var setup = {
|
|
@@ -194,7 +194,7 @@ var ReactiveView_default = {
|
|
|
194
194
|
notifications: Object,
|
|
195
195
|
subscriptions: Object,
|
|
196
196
|
beforeSetData: Function,
|
|
197
|
-
data: { default: () => ({}) },
|
|
197
|
+
data: { default: () => (0, import_vue.reactive)({}) },
|
|
198
198
|
defaultData: {},
|
|
199
199
|
getDefaultData: {
|
|
200
200
|
type: Function,
|
|
@@ -262,10 +262,10 @@ var ReactiveView_default = {
|
|
|
262
262
|
if (props.debug) {
|
|
263
263
|
console.warn(`[ReactiveView]: using beta props data in [${props.modelName}] component`, { vue, data, defaultData, ref: (0, import_vue.isRef)(data), reactive: (0, import_vue.isReactive)(data) });
|
|
264
264
|
}
|
|
265
|
-
if ((0, import_vue.
|
|
265
|
+
if ((0, import_vue.isReactive)(data)) {
|
|
266
266
|
return data;
|
|
267
267
|
} else {
|
|
268
|
-
if (isFunctionData || isPromiseData) {
|
|
268
|
+
if ((0, import_vue.isRef)(data) || isFunctionData || isPromiseData) {
|
|
269
269
|
return (0, import_vue.reactive)(datatype);
|
|
270
270
|
} else {
|
|
271
271
|
const props2 = "data" in vue.vnode.props;
|
|
@@ -352,14 +352,15 @@ var ReactiveView_default = {
|
|
|
352
352
|
}, config2.options);
|
|
353
353
|
}
|
|
354
354
|
if (props.beta) {
|
|
355
|
-
|
|
355
|
+
const isRefData = (0, import_vue.isRef)(props.data);
|
|
356
|
+
if (isRefData || isFunctionData || isPromiseData) {
|
|
356
357
|
setTimeout(async () => {
|
|
357
|
-
var _a2, _b2;
|
|
358
|
+
var _a2, _b2, _c2;
|
|
358
359
|
const [data] = isPromiseData ? await Promise.all([
|
|
359
360
|
isAsyncFunctionData ? props.data() : props.data,
|
|
360
361
|
(_a2 = defer.value) != null ? _a2 : true
|
|
361
362
|
]) : [props.data];
|
|
362
|
-
(0, import_vue.watch)(isFunctionData ? data : typeof data === "function" ? data : () => data, (after, before) => {
|
|
363
|
+
(0, import_vue.watch)(isRefData ? data : isFunctionData ? data : typeof data === "function" ? data : () => data, (after, before) => {
|
|
363
364
|
var _a3;
|
|
364
365
|
const callback = context.attrs["data:callback"];
|
|
365
366
|
if (typeof callback === "function") {
|
|
@@ -369,7 +370,7 @@ var ReactiveView_default = {
|
|
|
369
370
|
}
|
|
370
371
|
}, {
|
|
371
372
|
immediate: (_b2 = context.attrs["data:immediate"]) != null ? _b2 : true,
|
|
372
|
-
deep: context.attrs["data:deep"],
|
|
373
|
+
deep: (_c2 = context.attrs["data:deep"]) != null ? _c2 : true,
|
|
373
374
|
once: context.attrs["data:once"]
|
|
374
375
|
});
|
|
375
376
|
});
|
|
@@ -622,7 +623,6 @@ var extendVnode = (component, element) => {
|
|
|
622
623
|
});
|
|
623
624
|
};
|
|
624
625
|
function defineReactiveView(param1, param2) {
|
|
625
|
-
console.log(`log params:`, { param1, param2 });
|
|
626
626
|
return (0, import_vue2.defineComponent)({
|
|
627
627
|
name: param1 == null ? void 0 : param1.modelName,
|
|
628
628
|
props: __spreadValues({ setup }, param1 ? param1.props : {}),
|
|
@@ -642,6 +642,9 @@ function defineReactiveView(param1, param2) {
|
|
|
642
642
|
}
|
|
643
643
|
function showComponent(component, options = {}) {
|
|
644
644
|
var _a;
|
|
645
|
+
if (options.router) {
|
|
646
|
+
console.warn("[ReactiveView]: Deprecated {router} option used with {showComponent()}. \nUse {plugins} option instead.");
|
|
647
|
+
}
|
|
645
648
|
if (!options.key || !document.getElementById(options.key)) {
|
|
646
649
|
const container = options.container || "app-dialogs";
|
|
647
650
|
const dialogs = document.getElementById(container) || document.createElement("div");
|
|
@@ -668,6 +671,10 @@ function showComponent(component, options = {}) {
|
|
|
668
671
|
);
|
|
669
672
|
if (options.router) {
|
|
670
673
|
return app.use(options.router).mount(`#${id}`);
|
|
674
|
+
} else if (options.plugins) {
|
|
675
|
+
return options.plugins.reduce((app2, plugin) => {
|
|
676
|
+
return app2.use(...Array.isArray(plugin) ? plugin : [plugin]);
|
|
677
|
+
}, app).mount(`#${id}`);
|
|
671
678
|
} else {
|
|
672
679
|
return app.mount(`#${id}`);
|
|
673
680
|
}
|
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.
|
|
131
|
+
var version = "0.0.34-beta.28";
|
|
132
132
|
|
|
133
133
|
// src/ReactiveView.ts
|
|
134
134
|
var setup = {
|
|
@@ -148,7 +148,7 @@ var ReactiveView_default = {
|
|
|
148
148
|
notifications: Object,
|
|
149
149
|
subscriptions: Object,
|
|
150
150
|
beforeSetData: Function,
|
|
151
|
-
data: { default: () => ({}) },
|
|
151
|
+
data: { default: () => reactive({}) },
|
|
152
152
|
defaultData: {},
|
|
153
153
|
getDefaultData: {
|
|
154
154
|
type: Function,
|
|
@@ -216,10 +216,10 @@ var ReactiveView_default = {
|
|
|
216
216
|
if (props.debug) {
|
|
217
217
|
console.warn(`[ReactiveView]: using beta props data in [${props.modelName}] component`, { vue, data, defaultData, ref: isRef(data), reactive: isReactive(data) });
|
|
218
218
|
}
|
|
219
|
-
if (
|
|
219
|
+
if (isReactive(data)) {
|
|
220
220
|
return data;
|
|
221
221
|
} else {
|
|
222
|
-
if (isFunctionData || isPromiseData) {
|
|
222
|
+
if (isRef(data) || isFunctionData || isPromiseData) {
|
|
223
223
|
return reactive(datatype);
|
|
224
224
|
} else {
|
|
225
225
|
const props2 = "data" in vue.vnode.props;
|
|
@@ -306,14 +306,15 @@ var ReactiveView_default = {
|
|
|
306
306
|
}, config2.options);
|
|
307
307
|
}
|
|
308
308
|
if (props.beta) {
|
|
309
|
-
|
|
309
|
+
const isRefData = isRef(props.data);
|
|
310
|
+
if (isRefData || isFunctionData || isPromiseData) {
|
|
310
311
|
setTimeout(async () => {
|
|
311
|
-
var _a2, _b2;
|
|
312
|
+
var _a2, _b2, _c2;
|
|
312
313
|
const [data] = isPromiseData ? await Promise.all([
|
|
313
314
|
isAsyncFunctionData ? props.data() : props.data,
|
|
314
315
|
(_a2 = defer.value) != null ? _a2 : true
|
|
315
316
|
]) : [props.data];
|
|
316
|
-
watch(isFunctionData ? data : typeof data === "function" ? data : () => data, (after, before) => {
|
|
317
|
+
watch(isRefData ? data : isFunctionData ? data : typeof data === "function" ? data : () => data, (after, before) => {
|
|
317
318
|
var _a3;
|
|
318
319
|
const callback = context.attrs["data:callback"];
|
|
319
320
|
if (typeof callback === "function") {
|
|
@@ -323,7 +324,7 @@ var ReactiveView_default = {
|
|
|
323
324
|
}
|
|
324
325
|
}, {
|
|
325
326
|
immediate: (_b2 = context.attrs["data:immediate"]) != null ? _b2 : true,
|
|
326
|
-
deep: context.attrs["data:deep"],
|
|
327
|
+
deep: (_c2 = context.attrs["data:deep"]) != null ? _c2 : true,
|
|
327
328
|
once: context.attrs["data:once"]
|
|
328
329
|
});
|
|
329
330
|
});
|
|
@@ -576,7 +577,6 @@ var extendVnode = (component, element) => {
|
|
|
576
577
|
});
|
|
577
578
|
};
|
|
578
579
|
function defineReactiveView(param1, param2) {
|
|
579
|
-
console.log(`log params:`, { param1, param2 });
|
|
580
580
|
return defineComponent({
|
|
581
581
|
name: param1 == null ? void 0 : param1.modelName,
|
|
582
582
|
props: __spreadValues({ setup }, param1 ? param1.props : {}),
|
|
@@ -596,6 +596,9 @@ function defineReactiveView(param1, param2) {
|
|
|
596
596
|
}
|
|
597
597
|
function showComponent(component, options = {}) {
|
|
598
598
|
var _a;
|
|
599
|
+
if (options.router) {
|
|
600
|
+
console.warn("[ReactiveView]: Deprecated {router} option used with {showComponent()}. \nUse {plugins} option instead.");
|
|
601
|
+
}
|
|
599
602
|
if (!options.key || !document.getElementById(options.key)) {
|
|
600
603
|
const container = options.container || "app-dialogs";
|
|
601
604
|
const dialogs = document.getElementById(container) || document.createElement("div");
|
|
@@ -622,6 +625,10 @@ function showComponent(component, options = {}) {
|
|
|
622
625
|
);
|
|
623
626
|
if (options.router) {
|
|
624
627
|
return app.use(options.router).mount(`#${id}`);
|
|
628
|
+
} else if (options.plugins) {
|
|
629
|
+
return options.plugins.reduce((app2, plugin) => {
|
|
630
|
+
return app2.use(...Array.isArray(plugin) ? plugin : [plugin]);
|
|
631
|
+
}, app).mount(`#${id}`);
|
|
625
632
|
} else {
|
|
626
633
|
return app.mount(`#${id}`);
|
|
627
634
|
}
|
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.28",
|
|
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
|
+
}
|