@razaman2/reactive-view 0.0.16 → 0.0.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/LICENSE +21 -21
- package/README.md +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +62 -47
- package/dist/index.mjs +62 -48
- 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.d.mts
CHANGED
|
@@ -24,6 +24,7 @@ declare class Subscription {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
declare const setup: {
|
|
27
|
+
ReactiveView: boolean;
|
|
27
28
|
setup: {
|
|
28
29
|
type: FunctionConstructor;
|
|
29
30
|
default: (param1?: {}, param2?: {}) => {};
|
|
@@ -53,6 +54,7 @@ declare const _default: {
|
|
|
53
54
|
type: BooleanConstructor;
|
|
54
55
|
default: boolean;
|
|
55
56
|
};
|
|
57
|
+
ReactiveView: boolean;
|
|
56
58
|
setup: {
|
|
57
59
|
type: FunctionConstructor;
|
|
58
60
|
default: (param1?: {}, param2?: {}) => {};
|
|
@@ -116,5 +118,6 @@ declare function getSubscription(): {
|
|
|
116
118
|
subscriptions: any[];
|
|
117
119
|
subscription: Subscription;
|
|
118
120
|
};
|
|
121
|
+
declare function StyleParser(styles: Array<string> | Record<string, any> | string): any;
|
|
119
122
|
|
|
120
|
-
export { type StateUpdate, access, _default as default, getDate, getProps, getReactiveViewComponent, getSubscription, safeRequest, setup };
|
|
123
|
+
export { type StateUpdate, StyleParser, access, _default as default, getDate, getProps, getReactiveViewComponent, getSubscription, safeRequest, setup };
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare class Subscription {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
declare const setup: {
|
|
27
|
+
ReactiveView: boolean;
|
|
27
28
|
setup: {
|
|
28
29
|
type: FunctionConstructor;
|
|
29
30
|
default: (param1?: {}, param2?: {}) => {};
|
|
@@ -53,6 +54,7 @@ declare const _default: {
|
|
|
53
54
|
type: BooleanConstructor;
|
|
54
55
|
default: boolean;
|
|
55
56
|
};
|
|
57
|
+
ReactiveView: boolean;
|
|
56
58
|
setup: {
|
|
57
59
|
type: FunctionConstructor;
|
|
58
60
|
default: (param1?: {}, param2?: {}) => {};
|
|
@@ -116,5 +118,6 @@ declare function getSubscription(): {
|
|
|
116
118
|
subscriptions: any[];
|
|
117
119
|
subscription: Subscription;
|
|
118
120
|
};
|
|
121
|
+
declare function StyleParser(styles: Array<string> | Record<string, any> | string): any;
|
|
119
122
|
|
|
120
|
-
export { type StateUpdate, access, _default as default, getDate, getProps, getReactiveViewComponent, getSubscription, safeRequest, setup };
|
|
123
|
+
export { type StateUpdate, StyleParser, access, _default as default, getDate, getProps, getReactiveViewComponent, getSubscription, safeRequest, setup };
|
package/dist/index.js
CHANGED
|
@@ -56,6 +56,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
56
56
|
// src/index.ts
|
|
57
57
|
var src_exports = {};
|
|
58
58
|
__export(src_exports, {
|
|
59
|
+
StyleParser: () => StyleParser,
|
|
59
60
|
access: () => access,
|
|
60
61
|
default: () => src_default,
|
|
61
62
|
getDate: () => getDate,
|
|
@@ -164,7 +165,7 @@ var import_vue = require("vue");
|
|
|
164
165
|
|
|
165
166
|
// package.json
|
|
166
167
|
var name = "@razaman2/reactive-view";
|
|
167
|
-
var version = "0.0.
|
|
168
|
+
var version = "0.0.19";
|
|
168
169
|
|
|
169
170
|
// src/ReactiveView.ts
|
|
170
171
|
var props = {
|
|
@@ -194,6 +195,7 @@ var props = {
|
|
|
194
195
|
}
|
|
195
196
|
};
|
|
196
197
|
var setup = {
|
|
198
|
+
ReactiveView: true,
|
|
197
199
|
setup: {
|
|
198
200
|
type: Function,
|
|
199
201
|
default: (param1 = {}, param2 = {}) => {
|
|
@@ -204,7 +206,7 @@ var setup = {
|
|
|
204
206
|
var ReactiveView_default = {
|
|
205
207
|
props: __spreadValues(__spreadValues({}, setup), props),
|
|
206
208
|
setup(props2, context) {
|
|
207
|
-
var _a, _b, _c, _d, _e;
|
|
209
|
+
var _a, _b, _c, _d, _e, _g, _h;
|
|
208
210
|
const template = (vue, options2) => {
|
|
209
211
|
var _a2, _b2, _c2;
|
|
210
212
|
const vnode = context.slots.default ? (0, import_vue.h)(
|
|
@@ -227,7 +229,8 @@ var ReactiveView_default = {
|
|
|
227
229
|
Array.isArray(props2.state) ? (_b = props2.defaultData) != null ? _b : [] : (_c = props2.defaultData) != null ? _c : {}
|
|
228
230
|
);
|
|
229
231
|
const type = Array.isArray(defaultData) ? [] : {};
|
|
230
|
-
const
|
|
232
|
+
const data = import_object_manager.default.on((_d = props2.state) != null ? _d : type).clone();
|
|
233
|
+
const state = (0, import_vue.reactive)(import_data_manager.default.transform(props2.await ? type : data));
|
|
231
234
|
const config = {
|
|
232
235
|
defaultData,
|
|
233
236
|
data: state,
|
|
@@ -240,16 +243,15 @@ var ReactiveView_default = {
|
|
|
240
243
|
get(target, property, receiver) {
|
|
241
244
|
if (["setData", "replaceData"].includes(property)) {
|
|
242
245
|
return (...params) => {
|
|
246
|
+
var _a2, _b2;
|
|
243
247
|
const type2 = Array.isArray(defaultData) ? [] : {};
|
|
244
|
-
(0
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
});
|
|
248
|
+
const beforeSetData = (_b2 = (_a2 = context.attrs["onUpdate:modelState"]) == null ? void 0 : _a2.beforeSetData) != null ? _b2 : access(component).beforeSetData;
|
|
249
|
+
if (typeof beforeSetData === "function") {
|
|
250
|
+
beforeSetData(import_object_manager.default.on(type2).set(...params).get(), target);
|
|
251
|
+
} else {
|
|
252
|
+
target[property](...params);
|
|
253
|
+
}
|
|
254
|
+
return target;
|
|
253
255
|
};
|
|
254
256
|
} else {
|
|
255
257
|
return Reflect.get(target, property, receiver);
|
|
@@ -258,53 +260,59 @@ var ReactiveView_default = {
|
|
|
258
260
|
});
|
|
259
261
|
const options = {
|
|
260
262
|
parent: { self: component.value },
|
|
261
|
-
self: { template,
|
|
263
|
+
self: { template, isValid, getState }
|
|
262
264
|
};
|
|
263
265
|
const _f = (_e = props2.setup(options)) != null ? _e : options, { parent = {}, self = {} } = _f, rest = __objRest(_f, ["parent", "self"]);
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
266
|
+
if (typeof context.attrs.debug === "function") {
|
|
267
|
+
context.attrs.debug({ isValid, component, type, data, state, config, options, props: props2, context, setup: __spreadValues({ parent, self }, rest), defaultData, getState });
|
|
268
|
+
}
|
|
269
|
+
if (props2.await instanceof Promise) {
|
|
270
|
+
(0, import_vue.nextTick)(async () => {
|
|
271
|
+
getState.replaceData(await props2.await);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
if (props2.defer instanceof Promise) {
|
|
275
|
+
(0, import_vue.nextTick)(async () => {
|
|
276
|
+
var _a2;
|
|
277
|
+
rendered.value = (_a2 = await props2.defer) != null ? _a2 : true;
|
|
278
|
+
});
|
|
279
|
+
} else {
|
|
280
|
+
rendered.value = true;
|
|
281
|
+
}
|
|
282
|
+
if (context.attrs["onUpdate:modelState"]) {
|
|
283
|
+
const config2 = typeof context.attrs["onUpdate:modelState"] === "function" ? {
|
|
284
|
+
callback: context.attrs["onUpdate:modelState"]
|
|
285
|
+
} : (_g = context.attrs["onUpdate:modelState"]) != null ? _g : {};
|
|
286
|
+
(0, import_vue.onMounted)(() => {
|
|
283
287
|
(0, import_vue.watch)(() => import_object_manager.default.on(state).clone(), (after, before) => {
|
|
284
|
-
var
|
|
288
|
+
var _a2;
|
|
285
289
|
const diff = { before: import_object_manager.default.on(before).get(), after: import_object_manager.default.on(after).get() };
|
|
286
|
-
const beforeStateUpdate = (
|
|
290
|
+
const beforeStateUpdate = (_a2 = config2.beforeStateUpdate) != null ? _a2 : access(component).beforeStateUpdate;
|
|
287
291
|
if (sync.value) {
|
|
288
292
|
sync.value = false;
|
|
289
293
|
} else if (typeof config2.callback === "function") {
|
|
290
294
|
config2.callback(beforeStateUpdate ? beforeStateUpdate(diff) : diff, getState);
|
|
291
295
|
}
|
|
292
296
|
}, config2.options);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
if (context.attrs["onUpdate:propsState"] || props2.sync) {
|
|
300
|
+
const config2 = typeof context.attrs["onUpdate:propsState"] === "function" ? {
|
|
301
|
+
callback: context.attrs["onUpdate:propsState"]
|
|
302
|
+
} : (_h = context.attrs["onUpdate:propsState"]) != null ? _h : {};
|
|
303
|
+
(0, import_vue.onMounted)(() => {
|
|
298
304
|
(0, import_vue.watch)(() => import_object_manager.default.on(props2.state).clone(), (after, before) => {
|
|
299
305
|
const diff = { before: import_object_manager.default.on(before).get(), after: import_object_manager.default.on(after).get() };
|
|
300
|
-
if (
|
|
301
|
-
getState.replaceData(after);
|
|
302
|
-
} else if (typeof config2.callback === "function") {
|
|
306
|
+
if (typeof config2.callback === "function") {
|
|
303
307
|
config2.callback(diff, getState);
|
|
308
|
+
} else {
|
|
309
|
+
getState.replaceData(after);
|
|
304
310
|
}
|
|
305
311
|
sync.value = true;
|
|
306
312
|
}, config2.options);
|
|
307
|
-
}
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
return ($vue) => {
|
|
308
316
|
const setup2 = { $vue, options: parent };
|
|
309
317
|
while (setup2.options) {
|
|
310
318
|
Object.defineProperties(setup2.$vue, Object.assign({
|
|
@@ -401,15 +409,14 @@ function access($vue = {}) {
|
|
|
401
409
|
const proxy = (target) => {
|
|
402
410
|
return new Proxy(target, {
|
|
403
411
|
get(target2, key) {
|
|
404
|
-
var _a2, _b2;
|
|
405
412
|
const component = { $vue: target2 };
|
|
406
413
|
do {
|
|
407
|
-
if (
|
|
414
|
+
if (key in component.$vue) {
|
|
408
415
|
return component.$vue[key];
|
|
409
|
-
} else if (
|
|
416
|
+
} else if ("self" in component.$vue && key in component.$vue.self) {
|
|
410
417
|
return component.$vue.self[key];
|
|
411
418
|
} else {
|
|
412
|
-
component.$vue = component.$vue.parent;
|
|
419
|
+
component.$vue = "parent" in component.$vue && component.$vue.parent;
|
|
413
420
|
}
|
|
414
421
|
} while (component.$vue);
|
|
415
422
|
}
|
|
@@ -452,8 +459,16 @@ function getSubscription() {
|
|
|
452
459
|
subscription
|
|
453
460
|
};
|
|
454
461
|
}
|
|
462
|
+
function StyleParser(styles) {
|
|
463
|
+
var _a;
|
|
464
|
+
const object = (items) => items.reduce((object2, item) => {
|
|
465
|
+
return Object.assign(object2, { [item]: true });
|
|
466
|
+
}, {});
|
|
467
|
+
return (_a = Array.isArray(styles) ? object(styles) : typeof styles === "string" ? object(styles.split(/\s+/)) : styles) != null ? _a : {};
|
|
468
|
+
}
|
|
455
469
|
// Annotate the CommonJS export names for ESM import in node:
|
|
456
470
|
0 && (module.exports = {
|
|
471
|
+
StyleParser,
|
|
457
472
|
access,
|
|
458
473
|
getDate,
|
|
459
474
|
getProps,
|
package/dist/index.mjs
CHANGED
|
@@ -122,11 +122,11 @@ var Subscriptions = _Subscriptions;
|
|
|
122
122
|
// src/ReactiveView.ts
|
|
123
123
|
import ObjectManager from "@razaman2/object-manager";
|
|
124
124
|
import DataManager from "@razaman2/data-manager";
|
|
125
|
-
import { h, ref, reactive, watch, nextTick, getCurrentInstance } from "vue";
|
|
125
|
+
import { h, ref, reactive, watch, nextTick, onMounted, 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.19";
|
|
130
130
|
|
|
131
131
|
// src/ReactiveView.ts
|
|
132
132
|
var props = {
|
|
@@ -156,6 +156,7 @@ var props = {
|
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
var setup = {
|
|
159
|
+
ReactiveView: true,
|
|
159
160
|
setup: {
|
|
160
161
|
type: Function,
|
|
161
162
|
default: (param1 = {}, param2 = {}) => {
|
|
@@ -166,7 +167,7 @@ var setup = {
|
|
|
166
167
|
var ReactiveView_default = {
|
|
167
168
|
props: __spreadValues(__spreadValues({}, setup), props),
|
|
168
169
|
setup(props2, context) {
|
|
169
|
-
var _a, _b, _c, _d, _e;
|
|
170
|
+
var _a, _b, _c, _d, _e, _g, _h;
|
|
170
171
|
const template = (vue, options2) => {
|
|
171
172
|
var _a2, _b2, _c2;
|
|
172
173
|
const vnode = context.slots.default ? h(
|
|
@@ -189,7 +190,8 @@ var ReactiveView_default = {
|
|
|
189
190
|
Array.isArray(props2.state) ? (_b = props2.defaultData) != null ? _b : [] : (_c = props2.defaultData) != null ? _c : {}
|
|
190
191
|
);
|
|
191
192
|
const type = Array.isArray(defaultData) ? [] : {};
|
|
192
|
-
const
|
|
193
|
+
const data = ObjectManager.on((_d = props2.state) != null ? _d : type).clone();
|
|
194
|
+
const state = reactive(DataManager.transform(props2.await ? type : data));
|
|
193
195
|
const config = {
|
|
194
196
|
defaultData,
|
|
195
197
|
data: state,
|
|
@@ -202,16 +204,15 @@ var ReactiveView_default = {
|
|
|
202
204
|
get(target, property, receiver) {
|
|
203
205
|
if (["setData", "replaceData"].includes(property)) {
|
|
204
206
|
return (...params) => {
|
|
207
|
+
var _a2, _b2;
|
|
205
208
|
const type2 = Array.isArray(defaultData) ? [] : {};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
});
|
|
209
|
+
const beforeSetData = (_b2 = (_a2 = context.attrs["onUpdate:modelState"]) == null ? void 0 : _a2.beforeSetData) != null ? _b2 : access(component).beforeSetData;
|
|
210
|
+
if (typeof beforeSetData === "function") {
|
|
211
|
+
beforeSetData(ObjectManager.on(type2).set(...params).get(), target);
|
|
212
|
+
} else {
|
|
213
|
+
target[property](...params);
|
|
214
|
+
}
|
|
215
|
+
return target;
|
|
215
216
|
};
|
|
216
217
|
} else {
|
|
217
218
|
return Reflect.get(target, property, receiver);
|
|
@@ -220,53 +221,59 @@ var ReactiveView_default = {
|
|
|
220
221
|
});
|
|
221
222
|
const options = {
|
|
222
223
|
parent: { self: component.value },
|
|
223
|
-
self: { template,
|
|
224
|
+
self: { template, isValid, getState }
|
|
224
225
|
};
|
|
225
226
|
const _f = (_e = props2.setup(options)) != null ? _e : options, { parent = {}, self = {} } = _f, rest = __objRest(_f, ["parent", "self"]);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
227
|
+
if (typeof context.attrs.debug === "function") {
|
|
228
|
+
context.attrs.debug({ isValid, component, type, data, state, config, options, props: props2, context, setup: __spreadValues({ parent, self }, rest), defaultData, getState });
|
|
229
|
+
}
|
|
230
|
+
if (props2.await instanceof Promise) {
|
|
231
|
+
nextTick(async () => {
|
|
232
|
+
getState.replaceData(await props2.await);
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
if (props2.defer instanceof Promise) {
|
|
236
|
+
nextTick(async () => {
|
|
237
|
+
var _a2;
|
|
238
|
+
rendered.value = (_a2 = await props2.defer) != null ? _a2 : true;
|
|
239
|
+
});
|
|
240
|
+
} else {
|
|
241
|
+
rendered.value = true;
|
|
242
|
+
}
|
|
243
|
+
if (context.attrs["onUpdate:modelState"]) {
|
|
244
|
+
const config2 = typeof context.attrs["onUpdate:modelState"] === "function" ? {
|
|
245
|
+
callback: context.attrs["onUpdate:modelState"]
|
|
246
|
+
} : (_g = context.attrs["onUpdate:modelState"]) != null ? _g : {};
|
|
247
|
+
onMounted(() => {
|
|
245
248
|
watch(() => ObjectManager.on(state).clone(), (after, before) => {
|
|
246
|
-
var
|
|
249
|
+
var _a2;
|
|
247
250
|
const diff = { before: ObjectManager.on(before).get(), after: ObjectManager.on(after).get() };
|
|
248
|
-
const beforeStateUpdate = (
|
|
251
|
+
const beforeStateUpdate = (_a2 = config2.beforeStateUpdate) != null ? _a2 : access(component).beforeStateUpdate;
|
|
249
252
|
if (sync.value) {
|
|
250
253
|
sync.value = false;
|
|
251
254
|
} else if (typeof config2.callback === "function") {
|
|
252
255
|
config2.callback(beforeStateUpdate ? beforeStateUpdate(diff) : diff, getState);
|
|
253
256
|
}
|
|
254
257
|
}, config2.options);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
if (context.attrs["onUpdate:propsState"] || props2.sync) {
|
|
261
|
+
const config2 = typeof context.attrs["onUpdate:propsState"] === "function" ? {
|
|
262
|
+
callback: context.attrs["onUpdate:propsState"]
|
|
263
|
+
} : (_h = context.attrs["onUpdate:propsState"]) != null ? _h : {};
|
|
264
|
+
onMounted(() => {
|
|
260
265
|
watch(() => ObjectManager.on(props2.state).clone(), (after, before) => {
|
|
261
266
|
const diff = { before: ObjectManager.on(before).get(), after: ObjectManager.on(after).get() };
|
|
262
|
-
if (
|
|
263
|
-
getState.replaceData(after);
|
|
264
|
-
} else if (typeof config2.callback === "function") {
|
|
267
|
+
if (typeof config2.callback === "function") {
|
|
265
268
|
config2.callback(diff, getState);
|
|
269
|
+
} else {
|
|
270
|
+
getState.replaceData(after);
|
|
266
271
|
}
|
|
267
272
|
sync.value = true;
|
|
268
273
|
}, config2.options);
|
|
269
|
-
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
return ($vue) => {
|
|
270
277
|
const setup2 = { $vue, options: parent };
|
|
271
278
|
while (setup2.options) {
|
|
272
279
|
Object.defineProperties(setup2.$vue, Object.assign({
|
|
@@ -363,15 +370,14 @@ function access($vue = {}) {
|
|
|
363
370
|
const proxy = (target) => {
|
|
364
371
|
return new Proxy(target, {
|
|
365
372
|
get(target2, key) {
|
|
366
|
-
var _a2, _b2;
|
|
367
373
|
const component = { $vue: target2 };
|
|
368
374
|
do {
|
|
369
|
-
if (
|
|
375
|
+
if (key in component.$vue) {
|
|
370
376
|
return component.$vue[key];
|
|
371
|
-
} else if (
|
|
377
|
+
} else if ("self" in component.$vue && key in component.$vue.self) {
|
|
372
378
|
return component.$vue.self[key];
|
|
373
379
|
} else {
|
|
374
|
-
component.$vue = component.$vue.parent;
|
|
380
|
+
component.$vue = "parent" in component.$vue && component.$vue.parent;
|
|
375
381
|
}
|
|
376
382
|
} while (component.$vue);
|
|
377
383
|
}
|
|
@@ -414,7 +420,15 @@ function getSubscription() {
|
|
|
414
420
|
subscription
|
|
415
421
|
};
|
|
416
422
|
}
|
|
423
|
+
function StyleParser(styles) {
|
|
424
|
+
var _a;
|
|
425
|
+
const object = (items) => items.reduce((object2, item) => {
|
|
426
|
+
return Object.assign(object2, { [item]: true });
|
|
427
|
+
}, {});
|
|
428
|
+
return (_a = Array.isArray(styles) ? object(styles) : typeof styles === "string" ? object(styles.split(/\s+/)) : styles) != null ? _a : {};
|
|
429
|
+
}
|
|
417
430
|
export {
|
|
431
|
+
StyleParser,
|
|
418
432
|
access,
|
|
419
433
|
src_default as default,
|
|
420
434
|
getDate,
|
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.
|
|
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.19",
|
|
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.4.1",
|
|
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.8"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
]
|
|
42
|
+
}
|