@razaman2/reactive-view 0.0.16 → 0.0.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/LICENSE +21 -21
- package/README.md +1 -1
- package/dist/index.js +46 -46
- package/dist/index.mjs +46 -46
- package/package.json +42 -42
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.js
CHANGED
|
@@ -164,7 +164,7 @@ var import_vue = require("vue");
|
|
|
164
164
|
|
|
165
165
|
// package.json
|
|
166
166
|
var name = "@razaman2/reactive-view";
|
|
167
|
-
var version = "0.0.
|
|
167
|
+
var version = "0.0.18";
|
|
168
168
|
|
|
169
169
|
// src/ReactiveView.ts
|
|
170
170
|
var props = {
|
|
@@ -204,7 +204,7 @@ var setup = {
|
|
|
204
204
|
var ReactiveView_default = {
|
|
205
205
|
props: __spreadValues(__spreadValues({}, setup), props),
|
|
206
206
|
setup(props2, context) {
|
|
207
|
-
var _a, _b, _c, _d, _e;
|
|
207
|
+
var _a, _b, _c, _d, _e, _g, _h;
|
|
208
208
|
const template = (vue, options2) => {
|
|
209
209
|
var _a2, _b2, _c2;
|
|
210
210
|
const vnode = context.slots.default ? (0, import_vue.h)(
|
|
@@ -227,7 +227,8 @@ var ReactiveView_default = {
|
|
|
227
227
|
Array.isArray(props2.state) ? (_b = props2.defaultData) != null ? _b : [] : (_c = props2.defaultData) != null ? _c : {}
|
|
228
228
|
);
|
|
229
229
|
const type = Array.isArray(defaultData) ? [] : {};
|
|
230
|
-
const
|
|
230
|
+
const data = import_object_manager.default.on((_d = props2.state) != null ? _d : type).clone();
|
|
231
|
+
const state = (0, import_vue.reactive)(import_data_manager.default.transform(props2.await ? type : data));
|
|
231
232
|
const config = {
|
|
232
233
|
defaultData,
|
|
233
234
|
data: state,
|
|
@@ -261,50 +262,49 @@ var ReactiveView_default = {
|
|
|
261
262
|
self: { template, getState, isValid }
|
|
262
263
|
};
|
|
263
264
|
const _f = (_e = props2.setup(options)) != null ? _e : options, { parent = {}, self = {} } = _f, rest = __objRest(_f, ["parent", "self"]);
|
|
265
|
+
if (props2.await instanceof Promise) {
|
|
266
|
+
(0, import_vue.nextTick)(async () => {
|
|
267
|
+
getState.replaceData(await props2.await);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
if (props2.defer instanceof Promise) {
|
|
271
|
+
(0, import_vue.nextTick)(async () => {
|
|
272
|
+
var _a2;
|
|
273
|
+
rendered.value = (_a2 = await props2.defer) != null ? _a2 : true;
|
|
274
|
+
});
|
|
275
|
+
} else {
|
|
276
|
+
rendered.value = true;
|
|
277
|
+
}
|
|
278
|
+
if (context.attrs["onUpdate:modelState"]) {
|
|
279
|
+
const config2 = typeof context.attrs["onUpdate:modelState"] === "function" ? {
|
|
280
|
+
callback: context.attrs["onUpdate:modelState"]
|
|
281
|
+
} : (_g = context.attrs["onUpdate:modelState"]) != null ? _g : {};
|
|
282
|
+
(0, import_vue.watch)(() => import_object_manager.default.on(state).clone(), (after, before) => {
|
|
283
|
+
var _a2;
|
|
284
|
+
const diff = { before: import_object_manager.default.on(before).get(), after: import_object_manager.default.on(after).get() };
|
|
285
|
+
const beforeStateUpdate = (_a2 = config2.beforeStateUpdate) != null ? _a2 : access(component).beforeStateUpdate;
|
|
286
|
+
if (sync.value) {
|
|
287
|
+
sync.value = false;
|
|
288
|
+
} else if (typeof config2.callback === "function") {
|
|
289
|
+
config2.callback(beforeStateUpdate ? beforeStateUpdate(diff) : diff, getState);
|
|
290
|
+
}
|
|
291
|
+
}, config2.options);
|
|
292
|
+
}
|
|
293
|
+
if (context.attrs["onUpdate:propsState"] || props2.sync) {
|
|
294
|
+
const config2 = typeof context.attrs["onUpdate:propsState"] === "function" ? {
|
|
295
|
+
callback: context.attrs["onUpdate:propsState"]
|
|
296
|
+
} : (_h = context.attrs["onUpdate:propsState"]) != null ? _h : {};
|
|
297
|
+
(0, import_vue.watch)(() => import_object_manager.default.on(props2.state).clone(), (after, before) => {
|
|
298
|
+
const diff = { before: import_object_manager.default.on(before).get(), after: import_object_manager.default.on(after).get() };
|
|
299
|
+
if (typeof config2.callback === "function") {
|
|
300
|
+
config2.callback(diff, getState);
|
|
301
|
+
} else {
|
|
302
|
+
getState.replaceData(after);
|
|
303
|
+
}
|
|
304
|
+
sync.value = true;
|
|
305
|
+
}, config2.options);
|
|
306
|
+
}
|
|
264
307
|
return ($vue) => {
|
|
265
|
-
var _a2, _b2;
|
|
266
|
-
if (props2.await instanceof Promise) {
|
|
267
|
-
(0, import_vue.nextTick)(async () => {
|
|
268
|
-
getState.replaceData(await props2.await);
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
if (props2.defer instanceof Promise) {
|
|
272
|
-
(0, import_vue.nextTick)(async () => {
|
|
273
|
-
var _a3;
|
|
274
|
-
rendered.value = (_a3 = await props2.defer) != null ? _a3 : true;
|
|
275
|
-
});
|
|
276
|
-
} else {
|
|
277
|
-
rendered.value = true;
|
|
278
|
-
}
|
|
279
|
-
if (context.attrs["onUpdate:modelState"]) {
|
|
280
|
-
const config2 = typeof context.attrs["onUpdate:modelState"] === "function" ? {
|
|
281
|
-
callback: context.attrs["onUpdate:modelState"]
|
|
282
|
-
} : (_a2 = context.attrs["onUpdate:modelState"]) != null ? _a2 : {};
|
|
283
|
-
(0, import_vue.watch)(() => import_object_manager.default.on(state).clone(), (after, before) => {
|
|
284
|
-
var _a3;
|
|
285
|
-
const diff = { before: import_object_manager.default.on(before).get(), after: import_object_manager.default.on(after).get() };
|
|
286
|
-
const beforeStateUpdate = (_a3 = config2.beforeStateUpdate) != null ? _a3 : access({ parent, self }).beforeStateUpdate;
|
|
287
|
-
if (sync.value) {
|
|
288
|
-
sync.value = false;
|
|
289
|
-
} else if (typeof config2.callback === "function") {
|
|
290
|
-
config2.callback(beforeStateUpdate ? beforeStateUpdate(diff) : diff, getState);
|
|
291
|
-
}
|
|
292
|
-
}, config2.options);
|
|
293
|
-
}
|
|
294
|
-
if (context.attrs["onUpdate:propsState"] || props2.sync) {
|
|
295
|
-
const config2 = typeof context.attrs["onUpdate:propsState"] === "function" ? {
|
|
296
|
-
callback: context.attrs["onUpdate:propsState"]
|
|
297
|
-
} : (_b2 = context.attrs["onUpdate:propsState"]) != null ? _b2 : {};
|
|
298
|
-
(0, import_vue.watch)(() => import_object_manager.default.on(props2.state).clone(), (after, before) => {
|
|
299
|
-
const diff = { before: import_object_manager.default.on(before).get(), after: import_object_manager.default.on(after).get() };
|
|
300
|
-
if (props2.sync && typeof config2.callback !== "function") {
|
|
301
|
-
getState.replaceData(after);
|
|
302
|
-
} else if (typeof config2.callback === "function") {
|
|
303
|
-
config2.callback(diff, getState);
|
|
304
|
-
}
|
|
305
|
-
sync.value = true;
|
|
306
|
-
}, config2.options);
|
|
307
|
-
}
|
|
308
308
|
const setup2 = { $vue, options: parent };
|
|
309
309
|
while (setup2.options) {
|
|
310
310
|
Object.defineProperties(setup2.$vue, Object.assign({
|
package/dist/index.mjs
CHANGED
|
@@ -126,7 +126,7 @@ import { h, ref, reactive, watch, nextTick, getCurrentInstance } from "vue";
|
|
|
126
126
|
|
|
127
127
|
// package.json
|
|
128
128
|
var name = "@razaman2/reactive-view";
|
|
129
|
-
var version = "0.0.
|
|
129
|
+
var version = "0.0.18";
|
|
130
130
|
|
|
131
131
|
// src/ReactiveView.ts
|
|
132
132
|
var props = {
|
|
@@ -166,7 +166,7 @@ var setup = {
|
|
|
166
166
|
var ReactiveView_default = {
|
|
167
167
|
props: __spreadValues(__spreadValues({}, setup), props),
|
|
168
168
|
setup(props2, context) {
|
|
169
|
-
var _a, _b, _c, _d, _e;
|
|
169
|
+
var _a, _b, _c, _d, _e, _g, _h;
|
|
170
170
|
const template = (vue, options2) => {
|
|
171
171
|
var _a2, _b2, _c2;
|
|
172
172
|
const vnode = context.slots.default ? h(
|
|
@@ -189,7 +189,8 @@ var ReactiveView_default = {
|
|
|
189
189
|
Array.isArray(props2.state) ? (_b = props2.defaultData) != null ? _b : [] : (_c = props2.defaultData) != null ? _c : {}
|
|
190
190
|
);
|
|
191
191
|
const type = Array.isArray(defaultData) ? [] : {};
|
|
192
|
-
const
|
|
192
|
+
const data = ObjectManager.on((_d = props2.state) != null ? _d : type).clone();
|
|
193
|
+
const state = reactive(DataManager.transform(props2.await ? type : data));
|
|
193
194
|
const config = {
|
|
194
195
|
defaultData,
|
|
195
196
|
data: state,
|
|
@@ -223,50 +224,49 @@ var ReactiveView_default = {
|
|
|
223
224
|
self: { template, getState, isValid }
|
|
224
225
|
};
|
|
225
226
|
const _f = (_e = props2.setup(options)) != null ? _e : options, { parent = {}, self = {} } = _f, rest = __objRest(_f, ["parent", "self"]);
|
|
227
|
+
if (props2.await instanceof Promise) {
|
|
228
|
+
nextTick(async () => {
|
|
229
|
+
getState.replaceData(await props2.await);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
if (props2.defer instanceof Promise) {
|
|
233
|
+
nextTick(async () => {
|
|
234
|
+
var _a2;
|
|
235
|
+
rendered.value = (_a2 = await props2.defer) != null ? _a2 : true;
|
|
236
|
+
});
|
|
237
|
+
} else {
|
|
238
|
+
rendered.value = true;
|
|
239
|
+
}
|
|
240
|
+
if (context.attrs["onUpdate:modelState"]) {
|
|
241
|
+
const config2 = typeof context.attrs["onUpdate:modelState"] === "function" ? {
|
|
242
|
+
callback: context.attrs["onUpdate:modelState"]
|
|
243
|
+
} : (_g = context.attrs["onUpdate:modelState"]) != null ? _g : {};
|
|
244
|
+
watch(() => ObjectManager.on(state).clone(), (after, before) => {
|
|
245
|
+
var _a2;
|
|
246
|
+
const diff = { before: ObjectManager.on(before).get(), after: ObjectManager.on(after).get() };
|
|
247
|
+
const beforeStateUpdate = (_a2 = config2.beforeStateUpdate) != null ? _a2 : access(component).beforeStateUpdate;
|
|
248
|
+
if (sync.value) {
|
|
249
|
+
sync.value = false;
|
|
250
|
+
} else if (typeof config2.callback === "function") {
|
|
251
|
+
config2.callback(beforeStateUpdate ? beforeStateUpdate(diff) : diff, getState);
|
|
252
|
+
}
|
|
253
|
+
}, config2.options);
|
|
254
|
+
}
|
|
255
|
+
if (context.attrs["onUpdate:propsState"] || props2.sync) {
|
|
256
|
+
const config2 = typeof context.attrs["onUpdate:propsState"] === "function" ? {
|
|
257
|
+
callback: context.attrs["onUpdate:propsState"]
|
|
258
|
+
} : (_h = context.attrs["onUpdate:propsState"]) != null ? _h : {};
|
|
259
|
+
watch(() => ObjectManager.on(props2.state).clone(), (after, before) => {
|
|
260
|
+
const diff = { before: ObjectManager.on(before).get(), after: ObjectManager.on(after).get() };
|
|
261
|
+
if (typeof config2.callback === "function") {
|
|
262
|
+
config2.callback(diff, getState);
|
|
263
|
+
} else {
|
|
264
|
+
getState.replaceData(after);
|
|
265
|
+
}
|
|
266
|
+
sync.value = true;
|
|
267
|
+
}, config2.options);
|
|
268
|
+
}
|
|
226
269
|
return ($vue) => {
|
|
227
|
-
var _a2, _b2;
|
|
228
|
-
if (props2.await instanceof Promise) {
|
|
229
|
-
nextTick(async () => {
|
|
230
|
-
getState.replaceData(await props2.await);
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
if (props2.defer instanceof Promise) {
|
|
234
|
-
nextTick(async () => {
|
|
235
|
-
var _a3;
|
|
236
|
-
rendered.value = (_a3 = await props2.defer) != null ? _a3 : true;
|
|
237
|
-
});
|
|
238
|
-
} else {
|
|
239
|
-
rendered.value = true;
|
|
240
|
-
}
|
|
241
|
-
if (context.attrs["onUpdate:modelState"]) {
|
|
242
|
-
const config2 = typeof context.attrs["onUpdate:modelState"] === "function" ? {
|
|
243
|
-
callback: context.attrs["onUpdate:modelState"]
|
|
244
|
-
} : (_a2 = context.attrs["onUpdate:modelState"]) != null ? _a2 : {};
|
|
245
|
-
watch(() => ObjectManager.on(state).clone(), (after, before) => {
|
|
246
|
-
var _a3;
|
|
247
|
-
const diff = { before: ObjectManager.on(before).get(), after: ObjectManager.on(after).get() };
|
|
248
|
-
const beforeStateUpdate = (_a3 = config2.beforeStateUpdate) != null ? _a3 : access({ parent, self }).beforeStateUpdate;
|
|
249
|
-
if (sync.value) {
|
|
250
|
-
sync.value = false;
|
|
251
|
-
} else if (typeof config2.callback === "function") {
|
|
252
|
-
config2.callback(beforeStateUpdate ? beforeStateUpdate(diff) : diff, getState);
|
|
253
|
-
}
|
|
254
|
-
}, config2.options);
|
|
255
|
-
}
|
|
256
|
-
if (context.attrs["onUpdate:propsState"] || props2.sync) {
|
|
257
|
-
const config2 = typeof context.attrs["onUpdate:propsState"] === "function" ? {
|
|
258
|
-
callback: context.attrs["onUpdate:propsState"]
|
|
259
|
-
} : (_b2 = context.attrs["onUpdate:propsState"]) != null ? _b2 : {};
|
|
260
|
-
watch(() => ObjectManager.on(props2.state).clone(), (after, before) => {
|
|
261
|
-
const diff = { before: ObjectManager.on(before).get(), after: ObjectManager.on(after).get() };
|
|
262
|
-
if (props2.sync && typeof config2.callback !== "function") {
|
|
263
|
-
getState.replaceData(after);
|
|
264
|
-
} else if (typeof config2.callback === "function") {
|
|
265
|
-
config2.callback(diff, getState);
|
|
266
|
-
}
|
|
267
|
-
sync.value = true;
|
|
268
|
-
}, config2.options);
|
|
269
|
-
}
|
|
270
270
|
const setup2 = { $vue, options: parent };
|
|
271
271
|
while (setup2.options) {
|
|
272
272
|
Object.defineProperties(setup2.$vue, Object.assign({
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@razaman2/reactive-view",
|
|
3
|
-
"version": "0.0.
|
|
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
|
-
},
|
|
14
|
-
"keywords": [
|
|
15
|
-
"vue",
|
|
16
|
-
"vue-helper",
|
|
17
|
-
"reactive-view",
|
|
18
|
-
"vue-class-component"
|
|
19
|
-
],
|
|
20
|
-
"author": "razaman2",
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@razaman2/data-manager": "^3.2.11",
|
|
24
|
-
"@razaman2/object-manager": "^3.3.9",
|
|
25
|
-
"date-fns": "^4.1.0",
|
|
26
|
-
"date-fns-tz": "^3.2.0",
|
|
27
|
-
"uuid": "^11.0.
|
|
28
|
-
"vue": "^3.5.
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/uuid": "^10.0.0",
|
|
32
|
-
"tsup": "^8.3.5",
|
|
33
|
-
"typescript": "^5.
|
|
34
|
-
"vitest": "^2.1.
|
|
35
|
-
},
|
|
36
|
-
"publishConfig": {
|
|
37
|
-
"access": "public"
|
|
38
|
-
},
|
|
39
|
-
"files": [
|
|
40
|
-
"dist"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@razaman2/reactive-view",
|
|
3
|
+
"version": "0.0.18",
|
|
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
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"vue",
|
|
16
|
+
"vue-helper",
|
|
17
|
+
"reactive-view",
|
|
18
|
+
"vue-class-component"
|
|
19
|
+
],
|
|
20
|
+
"author": "razaman2",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@razaman2/data-manager": "^3.2.11",
|
|
24
|
+
"@razaman2/object-manager": "^3.3.9",
|
|
25
|
+
"date-fns": "^4.1.0",
|
|
26
|
+
"date-fns-tz": "^3.2.0",
|
|
27
|
+
"uuid": "^11.0.3",
|
|
28
|
+
"vue": "^3.5.13"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/uuid": "^10.0.0",
|
|
32
|
+
"tsup": "^8.3.5",
|
|
33
|
+
"typescript": "^5.7.2",
|
|
34
|
+
"vitest": "^2.1.5"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
]
|
|
42
|
+
}
|