@razaman2/reactive-view 0.0.34-beta.7 → 0.0.34-beta.9
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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +27 -12
- package/dist/index.mjs +27 -13
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -74,6 +74,7 @@ declare const _default: {
|
|
|
74
74
|
type: BooleanConstructor;
|
|
75
75
|
default: boolean;
|
|
76
76
|
};
|
|
77
|
+
state: {};
|
|
77
78
|
};
|
|
78
79
|
setup(props: Record<string, any>, context: SetupContext): (vue: ComponentPublicInstance) => any;
|
|
79
80
|
};
|
|
@@ -117,5 +118,8 @@ declare function useSubscription(): {
|
|
|
117
118
|
declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
|
|
118
119
|
declare function MergeStyles(...params: any): any;
|
|
119
120
|
declare const extendVnode: (component: Record<string, any>, element: any) => Record<string, (props?: Record<string, any>, slots?: Record<string, any> | ((slots: Record<string, any>) => Record<string, any>)) => any>;
|
|
121
|
+
declare const getData: (component: any, path: number | string, alternative: any) => any;
|
|
122
|
+
declare const setData: (component: any, data: any) => any;
|
|
123
|
+
declare const dataPath: (component: any, path: string | number) => any;
|
|
120
124
|
|
|
121
|
-
export { MergeStyles, StyleParser, access, _default as default, extendVnode, getDate, getProps, getReactiveViewComponent, safeRequest, setup, useSubscription };
|
|
125
|
+
export { MergeStyles, StyleParser, access, dataPath, _default as default, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, useSubscription };
|
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ declare const _default: {
|
|
|
74
74
|
type: BooleanConstructor;
|
|
75
75
|
default: boolean;
|
|
76
76
|
};
|
|
77
|
+
state: {};
|
|
77
78
|
};
|
|
78
79
|
setup(props: Record<string, any>, context: SetupContext): (vue: ComponentPublicInstance) => any;
|
|
79
80
|
};
|
|
@@ -117,5 +118,8 @@ declare function useSubscription(): {
|
|
|
117
118
|
declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
|
|
118
119
|
declare function MergeStyles(...params: any): any;
|
|
119
120
|
declare const extendVnode: (component: Record<string, any>, element: any) => Record<string, (props?: Record<string, any>, slots?: Record<string, any> | ((slots: Record<string, any>) => Record<string, any>)) => any>;
|
|
121
|
+
declare const getData: (component: any, path: number | string, alternative: any) => any;
|
|
122
|
+
declare const setData: (component: any, data: any) => any;
|
|
123
|
+
declare const dataPath: (component: any, path: string | number) => any;
|
|
120
124
|
|
|
121
|
-
export { MergeStyles, StyleParser, access, _default as default, extendVnode, getDate, getProps, getReactiveViewComponent, safeRequest, setup, useSubscription };
|
|
125
|
+
export { MergeStyles, StyleParser, access, dataPath, _default as default, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, useSubscription };
|
package/dist/index.js
CHANGED
|
@@ -59,16 +59,20 @@ __export(index_exports, {
|
|
|
59
59
|
MergeStyles: () => MergeStyles,
|
|
60
60
|
StyleParser: () => StyleParser,
|
|
61
61
|
access: () => access,
|
|
62
|
+
dataPath: () => dataPath,
|
|
62
63
|
default: () => index_default,
|
|
63
64
|
extendVnode: () => extendVnode,
|
|
65
|
+
getData: () => getData,
|
|
64
66
|
getDate: () => getDate,
|
|
65
67
|
getProps: () => getProps,
|
|
66
68
|
getReactiveViewComponent: () => getReactiveViewComponent,
|
|
67
69
|
safeRequest: () => safeRequest,
|
|
70
|
+
setData: () => setData,
|
|
68
71
|
setup: () => setup,
|
|
69
72
|
useSubscription: () => useSubscription
|
|
70
73
|
});
|
|
71
74
|
module.exports = __toCommonJS(index_exports);
|
|
75
|
+
var import_object_manager2 = __toESM(require("@razaman2/object-manager"));
|
|
72
76
|
|
|
73
77
|
// src/Subscription.ts
|
|
74
78
|
var Subscription = class _Subscription {
|
|
@@ -168,7 +172,7 @@ var import_vue = require("vue");
|
|
|
168
172
|
|
|
169
173
|
// package.json
|
|
170
174
|
var name = "@razaman2/reactive-view";
|
|
171
|
-
var version = "0.0.34-beta.
|
|
175
|
+
var version = "0.0.34-beta.9";
|
|
172
176
|
|
|
173
177
|
// src/ReactiveView.ts
|
|
174
178
|
var setup = {
|
|
@@ -211,7 +215,8 @@ var ReactiveView_default = {
|
|
|
211
215
|
debug: {
|
|
212
216
|
type: Boolean,
|
|
213
217
|
default: false
|
|
214
|
-
}
|
|
218
|
+
},
|
|
219
|
+
state: {}
|
|
215
220
|
},
|
|
216
221
|
setup(props, context) {
|
|
217
222
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -224,7 +229,7 @@ var ReactiveView_default = {
|
|
|
224
229
|
}, import_object_manager.default.on({}));
|
|
225
230
|
return { before: before.get(), after: after.get(), change: change.get() };
|
|
226
231
|
};
|
|
227
|
-
const
|
|
232
|
+
const dataPath2 = (path) => {
|
|
228
233
|
try {
|
|
229
234
|
return context.attrs["data:path"](path);
|
|
230
235
|
} catch (e) {
|
|
@@ -286,7 +291,7 @@ var ReactiveView_default = {
|
|
|
286
291
|
}
|
|
287
292
|
}
|
|
288
293
|
});
|
|
289
|
-
const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, model, dataPath, isValid } });
|
|
294
|
+
const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, model, dataPath: dataPath2, isValid } });
|
|
290
295
|
if (props.debug) {
|
|
291
296
|
console.log("[ReactiveView]:", { props, context, vue, defer, config, model, component, datatype, defaultData, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
|
|
292
297
|
}
|
|
@@ -324,13 +329,11 @@ var ReactiveView_default = {
|
|
|
324
329
|
config2.callback(diff(import_object_manager.default.on(before), import_object_manager.default.on(after)), { component });
|
|
325
330
|
}, config2.options);
|
|
326
331
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
});
|
|
333
|
-
}
|
|
332
|
+
setTimeout(async () => {
|
|
333
|
+
var _a2;
|
|
334
|
+
const [data] = await Promise.all([isAsyncFunctionData ? props.data() : props.data, (_a2 = defer.value) != null ? _a2 : true]);
|
|
335
|
+
watchDataProp(data);
|
|
336
|
+
});
|
|
334
337
|
setTimeout(async () => {
|
|
335
338
|
var _a2;
|
|
336
339
|
isReady.value = (_a2 = await defer.value) != null ? _a2 : true;
|
|
@@ -441,7 +444,7 @@ function getDate(param1, param2) {
|
|
|
441
444
|
}
|
|
442
445
|
function access(view = {}, alternative) {
|
|
443
446
|
const resolve = (target) => {
|
|
444
|
-
return new Proxy(target, {
|
|
447
|
+
return new Proxy((0, import_vue2.toRaw)(target), {
|
|
445
448
|
get(target2, key) {
|
|
446
449
|
const component = { tree: target2 };
|
|
447
450
|
do {
|
|
@@ -564,16 +567,28 @@ var extendVnode = (component, element) => {
|
|
|
564
567
|
}
|
|
565
568
|
});
|
|
566
569
|
};
|
|
570
|
+
var getData = (component, path, alternative) => {
|
|
571
|
+
return import_object_manager2.default.on((0, import_vue2.unref)(component.state)).get(dataPath(component, path), alternative);
|
|
572
|
+
};
|
|
573
|
+
var setData = (component, data) => {
|
|
574
|
+
return component.$emit("update:state", { before: import_object_manager2.default.on((0, import_vue2.unref)(component.state)).clone(), after: data });
|
|
575
|
+
};
|
|
576
|
+
var dataPath = (component, path) => {
|
|
577
|
+
return typeof component.$attrs["data:path"] === "function" ? component.$attrs["data:path"](path) : path;
|
|
578
|
+
};
|
|
567
579
|
// Annotate the CommonJS export names for ESM import in node:
|
|
568
580
|
0 && (module.exports = {
|
|
569
581
|
MergeStyles,
|
|
570
582
|
StyleParser,
|
|
571
583
|
access,
|
|
584
|
+
dataPath,
|
|
572
585
|
extendVnode,
|
|
586
|
+
getData,
|
|
573
587
|
getDate,
|
|
574
588
|
getProps,
|
|
575
589
|
getReactiveViewComponent,
|
|
576
590
|
safeRequest,
|
|
591
|
+
setData,
|
|
577
592
|
setup,
|
|
578
593
|
useSubscription
|
|
579
594
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -27,6 +27,9 @@ var __objRest = (source, exclude) => {
|
|
|
27
27
|
return target;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
// src/index.ts
|
|
31
|
+
import ObjectManager2 from "@razaman2/object-manager";
|
|
32
|
+
|
|
30
33
|
// src/Subscription.ts
|
|
31
34
|
var Subscription = class _Subscription {
|
|
32
35
|
constructor() {
|
|
@@ -125,7 +128,7 @@ import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstanc
|
|
|
125
128
|
|
|
126
129
|
// package.json
|
|
127
130
|
var name = "@razaman2/reactive-view";
|
|
128
|
-
var version = "0.0.34-beta.
|
|
131
|
+
var version = "0.0.34-beta.9";
|
|
129
132
|
|
|
130
133
|
// src/ReactiveView.ts
|
|
131
134
|
var setup = {
|
|
@@ -168,7 +171,8 @@ var ReactiveView_default = {
|
|
|
168
171
|
debug: {
|
|
169
172
|
type: Boolean,
|
|
170
173
|
default: false
|
|
171
|
-
}
|
|
174
|
+
},
|
|
175
|
+
state: {}
|
|
172
176
|
},
|
|
173
177
|
setup(props, context) {
|
|
174
178
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -181,7 +185,7 @@ var ReactiveView_default = {
|
|
|
181
185
|
}, ObjectManager.on({}));
|
|
182
186
|
return { before: before.get(), after: after.get(), change: change.get() };
|
|
183
187
|
};
|
|
184
|
-
const
|
|
188
|
+
const dataPath2 = (path) => {
|
|
185
189
|
try {
|
|
186
190
|
return context.attrs["data:path"](path);
|
|
187
191
|
} catch (e) {
|
|
@@ -243,7 +247,7 @@ var ReactiveView_default = {
|
|
|
243
247
|
}
|
|
244
248
|
}
|
|
245
249
|
});
|
|
246
|
-
const component = ref({ parent: { self: vue.proxy }, self: { template, model, dataPath, isValid } });
|
|
250
|
+
const component = ref({ parent: { self: vue.proxy }, self: { template, model, dataPath: dataPath2, isValid } });
|
|
247
251
|
if (props.debug) {
|
|
248
252
|
console.log("[ReactiveView]:", { props, context, vue, defer, config, model, component, datatype, defaultData, isValid, isReady, isFunctionData, isAsyncFunctionData, isPromiseData });
|
|
249
253
|
}
|
|
@@ -281,13 +285,11 @@ var ReactiveView_default = {
|
|
|
281
285
|
config2.callback(diff(ObjectManager.on(before), ObjectManager.on(after)), { component });
|
|
282
286
|
}, config2.options);
|
|
283
287
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
});
|
|
290
|
-
}
|
|
288
|
+
setTimeout(async () => {
|
|
289
|
+
var _a2;
|
|
290
|
+
const [data] = await Promise.all([isAsyncFunctionData ? props.data() : props.data, (_a2 = defer.value) != null ? _a2 : true]);
|
|
291
|
+
watchDataProp(data);
|
|
292
|
+
});
|
|
291
293
|
setTimeout(async () => {
|
|
292
294
|
var _a2;
|
|
293
295
|
isReady.value = (_a2 = await defer.value) != null ? _a2 : true;
|
|
@@ -321,7 +323,7 @@ var ReactiveView_default = {
|
|
|
321
323
|
};
|
|
322
324
|
|
|
323
325
|
// src/index.ts
|
|
324
|
-
import {
|
|
326
|
+
import { h, unref as unref2, isRef as isRef2, toRaw, createVNode as createVNode2 } from "vue";
|
|
325
327
|
import { formatInTimeZone } from "date-fns-tz";
|
|
326
328
|
import { twMerge } from "tailwind-merge";
|
|
327
329
|
var index_default = ReactiveView_default;
|
|
@@ -398,7 +400,7 @@ function getDate(param1, param2) {
|
|
|
398
400
|
}
|
|
399
401
|
function access(view = {}, alternative) {
|
|
400
402
|
const resolve = (target) => {
|
|
401
|
-
return new Proxy(target, {
|
|
403
|
+
return new Proxy(toRaw(target), {
|
|
402
404
|
get(target2, key) {
|
|
403
405
|
const component = { tree: target2 };
|
|
404
406
|
do {
|
|
@@ -521,16 +523,28 @@ var extendVnode = (component, element) => {
|
|
|
521
523
|
}
|
|
522
524
|
});
|
|
523
525
|
};
|
|
526
|
+
var getData = (component, path, alternative) => {
|
|
527
|
+
return ObjectManager2.on(unref2(component.state)).get(dataPath(component, path), alternative);
|
|
528
|
+
};
|
|
529
|
+
var setData = (component, data) => {
|
|
530
|
+
return component.$emit("update:state", { before: ObjectManager2.on(unref2(component.state)).clone(), after: data });
|
|
531
|
+
};
|
|
532
|
+
var dataPath = (component, path) => {
|
|
533
|
+
return typeof component.$attrs["data:path"] === "function" ? component.$attrs["data:path"](path) : path;
|
|
534
|
+
};
|
|
524
535
|
export {
|
|
525
536
|
MergeStyles,
|
|
526
537
|
StyleParser,
|
|
527
538
|
access,
|
|
539
|
+
dataPath,
|
|
528
540
|
index_default as default,
|
|
529
541
|
extendVnode,
|
|
542
|
+
getData,
|
|
530
543
|
getDate,
|
|
531
544
|
getProps,
|
|
532
545
|
getReactiveViewComponent,
|
|
533
546
|
safeRequest,
|
|
547
|
+
setData,
|
|
534
548
|
setup,
|
|
535
549
|
useSubscription
|
|
536
550
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razaman2/reactive-view",
|
|
3
|
-
"version": "0.0.34-beta.
|
|
3
|
+
"version": "0.0.34-beta.9",
|
|
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",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@razaman2/data-manager": "^3.2.12",
|
|
25
25
|
"@razaman2/event-emitter": "^2.1.1",
|
|
26
|
-
"@razaman2/object-manager": "^3.4.
|
|
26
|
+
"@razaman2/object-manager": "^3.4.5",
|
|
27
27
|
"date-fns": "^4.1.0",
|
|
28
28
|
"date-fns-tz": "^3.2.0",
|
|
29
29
|
"tailwind-merge": "^3.3.1",
|
|
30
30
|
"uuid": "^11.1.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"vue": "^3.5.
|
|
33
|
+
"vue": "^3.5.20"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/uuid": "^10.0.0",
|