@razaman2/reactive-view 0.0.9 → 0.0.11
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/LICENSE +21 -21
- package/README.md +1 -1
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +15 -3
- package/dist/index.mjs +15 -3
- package/package.json +12 -15
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 razamvmt
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 razamvmt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# reactive-view
|
|
1
|
+
# reactive-view
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SetupContext, ComponentPublicInstance, UnwrapRef } from 'vue';
|
|
1
|
+
import { SetupContext, ComponentPublicInstance, WatchOptions, UnwrapRef } from 'vue';
|
|
2
2
|
|
|
3
3
|
type SubscriptionItem = {
|
|
4
4
|
name: string;
|
|
@@ -36,6 +36,7 @@ declare const _default: {
|
|
|
36
36
|
model: {};
|
|
37
37
|
state: {};
|
|
38
38
|
await: {};
|
|
39
|
+
defer: {};
|
|
39
40
|
getDefaultData: {
|
|
40
41
|
type: FunctionConstructor;
|
|
41
42
|
default: (data?: {}) => {};
|
|
@@ -59,6 +60,11 @@ declare const _default: {
|
|
|
59
60
|
setup(props: Record<string, any>, context: SetupContext): ($vue: ComponentPublicInstance & any) => any;
|
|
60
61
|
};
|
|
61
62
|
|
|
63
|
+
type StateUpdate = {
|
|
64
|
+
callback: Function;
|
|
65
|
+
beforeStateUpdate?: Function;
|
|
66
|
+
options?: WatchOptions;
|
|
67
|
+
};
|
|
62
68
|
type Accessible = {
|
|
63
69
|
parent: {
|
|
64
70
|
self: Record<string | symbol, any>;
|
|
@@ -72,6 +78,7 @@ type PropOptions = {
|
|
|
72
78
|
include: Record<string, any>;
|
|
73
79
|
};
|
|
74
80
|
type PropExclusions = Array<string> | string;
|
|
81
|
+
|
|
75
82
|
declare function safeRequest(request: {
|
|
76
83
|
try: () => Promise<any> | any;
|
|
77
84
|
catch?: ((error: any) => Promise<any> | any) | false;
|
|
@@ -106,4 +113,4 @@ declare function getSubscription(): {
|
|
|
106
113
|
subscription: Subscription;
|
|
107
114
|
};
|
|
108
115
|
|
|
109
|
-
export { access, _default as default, getDate, getProps, getSubscription, safeRequest, setup };
|
|
116
|
+
export { type StateUpdate, access, _default as default, getDate, getProps, getSubscription, safeRequest, setup };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SetupContext, ComponentPublicInstance, UnwrapRef } from 'vue';
|
|
1
|
+
import { SetupContext, ComponentPublicInstance, WatchOptions, UnwrapRef } from 'vue';
|
|
2
2
|
|
|
3
3
|
type SubscriptionItem = {
|
|
4
4
|
name: string;
|
|
@@ -36,6 +36,7 @@ declare const _default: {
|
|
|
36
36
|
model: {};
|
|
37
37
|
state: {};
|
|
38
38
|
await: {};
|
|
39
|
+
defer: {};
|
|
39
40
|
getDefaultData: {
|
|
40
41
|
type: FunctionConstructor;
|
|
41
42
|
default: (data?: {}) => {};
|
|
@@ -59,6 +60,11 @@ declare const _default: {
|
|
|
59
60
|
setup(props: Record<string, any>, context: SetupContext): ($vue: ComponentPublicInstance & any) => any;
|
|
60
61
|
};
|
|
61
62
|
|
|
63
|
+
type StateUpdate = {
|
|
64
|
+
callback: Function;
|
|
65
|
+
beforeStateUpdate?: Function;
|
|
66
|
+
options?: WatchOptions;
|
|
67
|
+
};
|
|
62
68
|
type Accessible = {
|
|
63
69
|
parent: {
|
|
64
70
|
self: Record<string | symbol, any>;
|
|
@@ -72,6 +78,7 @@ type PropOptions = {
|
|
|
72
78
|
include: Record<string, any>;
|
|
73
79
|
};
|
|
74
80
|
type PropExclusions = Array<string> | string;
|
|
81
|
+
|
|
75
82
|
declare function safeRequest(request: {
|
|
76
83
|
try: () => Promise<any> | any;
|
|
77
84
|
catch?: ((error: any) => Promise<any> | any) | false;
|
|
@@ -106,4 +113,4 @@ declare function getSubscription(): {
|
|
|
106
113
|
subscription: Subscription;
|
|
107
114
|
};
|
|
108
115
|
|
|
109
|
-
export { access, _default as default, getDate, getProps, getSubscription, safeRequest, setup };
|
|
116
|
+
export { type StateUpdate, access, _default as default, getDate, getProps, getSubscription, safeRequest, setup };
|
package/dist/index.js
CHANGED
|
@@ -158,13 +158,13 @@ var Subscriptions = _Subscriptions;
|
|
|
158
158
|
// src/ReactiveView.ts
|
|
159
159
|
var import_object_manager = __toESM(require("@razaman2/object-manager"));
|
|
160
160
|
var import_data_manager = __toESM(require("@razaman2/data-manager"));
|
|
161
|
+
var import_vue = require("vue");
|
|
161
162
|
|
|
162
163
|
// package.json
|
|
163
164
|
var name = "@razaman2/reactive-view";
|
|
164
|
-
var version = "0.0.
|
|
165
|
+
var version = "0.0.11";
|
|
165
166
|
|
|
166
167
|
// src/ReactiveView.ts
|
|
167
|
-
var import_vue = require("vue");
|
|
168
168
|
var props = {
|
|
169
169
|
notifications: Object,
|
|
170
170
|
subscriptions: Object,
|
|
@@ -172,6 +172,7 @@ var props = {
|
|
|
172
172
|
model: {},
|
|
173
173
|
state: {},
|
|
174
174
|
await: {},
|
|
175
|
+
defer: {},
|
|
175
176
|
getDefaultData: {
|
|
176
177
|
type: Function,
|
|
177
178
|
default: (data = {}) => data
|
|
@@ -217,6 +218,7 @@ var ReactiveView_default = {
|
|
|
217
218
|
return (_c2 = (_b2 = (_a2 = context.slots).template) == null ? void 0 : _b2.call(_a2, { $vue: vue, vnode })) != null ? _c2 : vnode;
|
|
218
219
|
};
|
|
219
220
|
const isValid = (0, import_vue.ref)(false);
|
|
221
|
+
const isRendered = (0, import_vue.ref)(false);
|
|
220
222
|
const defaultData = props2.getDefaultData(
|
|
221
223
|
Array.isArray(props2.state) ? (_a = props2.defaultData) != null ? _a : [] : (_b = props2.defaultData) != null ? _b : {}
|
|
222
224
|
);
|
|
@@ -242,6 +244,14 @@ var ReactiveView_default = {
|
|
|
242
244
|
getState.replaceData(await props2.await);
|
|
243
245
|
});
|
|
244
246
|
}
|
|
247
|
+
if (props2.defer instanceof Promise) {
|
|
248
|
+
(0, import_vue.nextTick)(async () => {
|
|
249
|
+
var _a2;
|
|
250
|
+
isRendered.value = (_a2 = await props2.defer) != null ? _a2 : true;
|
|
251
|
+
});
|
|
252
|
+
} else {
|
|
253
|
+
isRendered.value = true;
|
|
254
|
+
}
|
|
245
255
|
if (context.attrs["onUpdate:modelState"]) {
|
|
246
256
|
const config2 = typeof context.attrs["onUpdate:modelState"] === "function" ? { callback: context.attrs["onUpdate:modelState"] } : context.attrs["onUpdate:modelState"];
|
|
247
257
|
(0, import_vue.onMounted)(() => {
|
|
@@ -282,7 +292,9 @@ var ReactiveView_default = {
|
|
|
282
292
|
setup2.options = setup2.options.parent;
|
|
283
293
|
setup2.$vue = setup2.$vue.$parent;
|
|
284
294
|
}
|
|
285
|
-
|
|
295
|
+
if (isRendered.value) {
|
|
296
|
+
return access($vue).template($vue, { parent, self });
|
|
297
|
+
}
|
|
286
298
|
};
|
|
287
299
|
}
|
|
288
300
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -121,13 +121,13 @@ var Subscriptions = _Subscriptions;
|
|
|
121
121
|
// src/ReactiveView.ts
|
|
122
122
|
import ObjectManager from "@razaman2/object-manager";
|
|
123
123
|
import DataManager from "@razaman2/data-manager";
|
|
124
|
+
import { h, ref, reactive, watch, nextTick, getCurrentInstance, onMounted } from "vue";
|
|
124
125
|
|
|
125
126
|
// package.json
|
|
126
127
|
var name = "@razaman2/reactive-view";
|
|
127
|
-
var version = "0.0.
|
|
128
|
+
var version = "0.0.11";
|
|
128
129
|
|
|
129
130
|
// src/ReactiveView.ts
|
|
130
|
-
import { h, ref, reactive, watch, nextTick, getCurrentInstance, onMounted } from "vue";
|
|
131
131
|
var props = {
|
|
132
132
|
notifications: Object,
|
|
133
133
|
subscriptions: Object,
|
|
@@ -135,6 +135,7 @@ var props = {
|
|
|
135
135
|
model: {},
|
|
136
136
|
state: {},
|
|
137
137
|
await: {},
|
|
138
|
+
defer: {},
|
|
138
139
|
getDefaultData: {
|
|
139
140
|
type: Function,
|
|
140
141
|
default: (data = {}) => data
|
|
@@ -180,6 +181,7 @@ var ReactiveView_default = {
|
|
|
180
181
|
return (_c2 = (_b2 = (_a2 = context.slots).template) == null ? void 0 : _b2.call(_a2, { $vue: vue, vnode })) != null ? _c2 : vnode;
|
|
181
182
|
};
|
|
182
183
|
const isValid = ref(false);
|
|
184
|
+
const isRendered = ref(false);
|
|
183
185
|
const defaultData = props2.getDefaultData(
|
|
184
186
|
Array.isArray(props2.state) ? (_a = props2.defaultData) != null ? _a : [] : (_b = props2.defaultData) != null ? _b : {}
|
|
185
187
|
);
|
|
@@ -205,6 +207,14 @@ var ReactiveView_default = {
|
|
|
205
207
|
getState.replaceData(await props2.await);
|
|
206
208
|
});
|
|
207
209
|
}
|
|
210
|
+
if (props2.defer instanceof Promise) {
|
|
211
|
+
nextTick(async () => {
|
|
212
|
+
var _a2;
|
|
213
|
+
isRendered.value = (_a2 = await props2.defer) != null ? _a2 : true;
|
|
214
|
+
});
|
|
215
|
+
} else {
|
|
216
|
+
isRendered.value = true;
|
|
217
|
+
}
|
|
208
218
|
if (context.attrs["onUpdate:modelState"]) {
|
|
209
219
|
const config2 = typeof context.attrs["onUpdate:modelState"] === "function" ? { callback: context.attrs["onUpdate:modelState"] } : context.attrs["onUpdate:modelState"];
|
|
210
220
|
onMounted(() => {
|
|
@@ -245,7 +255,9 @@ var ReactiveView_default = {
|
|
|
245
255
|
setup2.options = setup2.options.parent;
|
|
246
256
|
setup2.$vue = setup2.$vue.$parent;
|
|
247
257
|
}
|
|
248
|
-
|
|
258
|
+
if (isRendered.value) {
|
|
259
|
+
return access($vue).template($vue, { parent, self });
|
|
260
|
+
}
|
|
249
261
|
};
|
|
250
262
|
}
|
|
251
263
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razaman2/reactive-view",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
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",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"prepublishOnly": "npm run build",
|
|
10
10
|
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
11
|
-
"lint": "tsc"
|
|
11
|
+
"lint": "tsc",
|
|
12
|
+
"test": "cd tests/vue-ts && npm run dev"
|
|
12
13
|
},
|
|
13
14
|
"keywords": [
|
|
14
15
|
"vue",
|
|
@@ -19,28 +20,24 @@
|
|
|
19
20
|
"author": "razaman2",
|
|
20
21
|
"license": "MIT",
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@razaman2/collection-proxy": "^0.0.
|
|
23
|
-
"@razaman2/data-manager": "^3.2.
|
|
23
|
+
"@razaman2/collection-proxy": "^0.0.29",
|
|
24
|
+
"@razaman2/data-manager": "^3.2.9",
|
|
24
25
|
"@razaman2/object-manager": "^3.3.9",
|
|
25
26
|
"date-fns": "^3.6.0",
|
|
26
27
|
"date-fns-tz": "^3.1.3",
|
|
27
|
-
"uuid": "^
|
|
28
|
-
"vue": "^3.
|
|
28
|
+
"uuid": "^10.0.0",
|
|
29
|
+
"vue": "^3.5.3"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@types/uuid": "^
|
|
32
|
-
"tsup": "^8.
|
|
33
|
-
"typescript": "^5.4
|
|
34
|
-
"vitest": "^
|
|
32
|
+
"@types/uuid": "^10.0.0",
|
|
33
|
+
"tsup": "^8.2.4",
|
|
34
|
+
"typescript": "^5.5.4",
|
|
35
|
+
"vitest": "^2.0.5"
|
|
35
36
|
},
|
|
36
37
|
"publishConfig": {
|
|
37
38
|
"access": "public"
|
|
38
39
|
},
|
|
39
40
|
"files": [
|
|
40
41
|
"dist"
|
|
41
|
-
]
|
|
42
|
-
"repository": {
|
|
43
|
-
"type": "git",
|
|
44
|
-
"url": "https://github.com/razaman2/reactive-view.git"
|
|
45
|
-
}
|
|
42
|
+
]
|
|
46
43
|
}
|