@razaman2/reactive-view 0.0.34-beta.15 → 0.0.34-beta.17
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.js +13 -10
- package/dist/index.mjs +13 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -172,7 +172,7 @@ var import_vue = require("vue");
|
|
|
172
172
|
|
|
173
173
|
// package.json
|
|
174
174
|
var name = "@razaman2/reactive-view";
|
|
175
|
-
var version = "0.0.34-beta.
|
|
175
|
+
var version = "0.0.34-beta.17";
|
|
176
176
|
|
|
177
177
|
// src/ReactiveView.ts
|
|
178
178
|
var setup = {
|
|
@@ -212,7 +212,7 @@ var ReactiveView_default = {
|
|
|
212
212
|
type: Boolean,
|
|
213
213
|
default: false
|
|
214
214
|
},
|
|
215
|
-
state: { default: () => ({}) }
|
|
215
|
+
state: { default: () => (0, import_vue.reactive)({}) }
|
|
216
216
|
},
|
|
217
217
|
setup(props, context) {
|
|
218
218
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -546,12 +546,13 @@ var extendVnode = (component, element) => {
|
|
|
546
546
|
const vnode = getVnode();
|
|
547
547
|
return (props = {}, slots) => {
|
|
548
548
|
var _a;
|
|
549
|
-
const
|
|
550
|
-
const
|
|
549
|
+
const isFunctionClass = typeof props.class === "function";
|
|
550
|
+
const _b = (_a = vnode.props) != null ? _a : {}, { class: classes, style: styles } = _b, rest = __objRest(_b, ["class", "style"]);
|
|
551
|
+
const finalClasses = (0, import_tailwind_merge.twMerge)(isFunctionClass ? "" : classes, MergeStyles(isFunctionClass ? props.class(classes) : props.class).string);
|
|
551
552
|
const finalStyles = MergeStyles(styles, typeof props.style === "function" ? props.style(styles) : props.style);
|
|
552
553
|
const functionalProps = Object.entries(props).reduce((props2, [key2, value]) => {
|
|
553
554
|
var _a2;
|
|
554
|
-
if (!["class", "style"].includes(key2) && typeof value === "function") {
|
|
555
|
+
if (!["class", "style", "setup"].includes(key2) && typeof value === "function") {
|
|
555
556
|
props2[key2] = value((_a2 = vnode.props) == null ? void 0 : _a2[key2]);
|
|
556
557
|
}
|
|
557
558
|
return props2;
|
|
@@ -565,19 +566,21 @@ var extendVnode = (component, element) => {
|
|
|
565
566
|
});
|
|
566
567
|
};
|
|
567
568
|
var getData = (component, path, alternative) => {
|
|
568
|
-
const
|
|
569
|
+
const vue = access(component);
|
|
570
|
+
const data = import_object_manager2.default.on((0, import_vue2.unref)(componentState(vue)));
|
|
569
571
|
if (path) {
|
|
570
|
-
return data.get(dataPath(
|
|
572
|
+
return data.get(dataPath(vue, path), alternative);
|
|
571
573
|
} else {
|
|
572
574
|
return data.get();
|
|
573
575
|
}
|
|
574
576
|
};
|
|
575
577
|
var setData = (component, data, path) => {
|
|
578
|
+
const vue = access(component);
|
|
576
579
|
const diff = {
|
|
577
|
-
before: import_object_manager2.default.on((0, import_vue2.unref)(componentState(
|
|
578
|
-
after: path ? import_object_manager2.default.on(componentState(
|
|
580
|
+
before: import_object_manager2.default.on((0, import_vue2.unref)(componentState(vue))).clone(),
|
|
581
|
+
after: path ? import_object_manager2.default.on(componentState(vue)).set(dataPath(vue, path), data).get() : import_object_manager2.default.on(componentState(vue)).set(data).get()
|
|
579
582
|
};
|
|
580
|
-
return "state" in
|
|
583
|
+
return "state" in vue ? diff : vue.$emit("update:state", diff);
|
|
581
584
|
};
|
|
582
585
|
var componentState = (component) => {
|
|
583
586
|
return "state" in component ? component.state : component.$attrs.state;
|
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.17";
|
|
132
132
|
|
|
133
133
|
// src/ReactiveView.ts
|
|
134
134
|
var setup = {
|
|
@@ -168,7 +168,7 @@ var ReactiveView_default = {
|
|
|
168
168
|
type: Boolean,
|
|
169
169
|
default: false
|
|
170
170
|
},
|
|
171
|
-
state: { default: () => ({}) }
|
|
171
|
+
state: { default: () => reactive({}) }
|
|
172
172
|
},
|
|
173
173
|
setup(props, context) {
|
|
174
174
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -502,12 +502,13 @@ var extendVnode = (component, element) => {
|
|
|
502
502
|
const vnode = getVnode();
|
|
503
503
|
return (props = {}, slots) => {
|
|
504
504
|
var _a;
|
|
505
|
-
const
|
|
506
|
-
const
|
|
505
|
+
const isFunctionClass = typeof props.class === "function";
|
|
506
|
+
const _b = (_a = vnode.props) != null ? _a : {}, { class: classes, style: styles } = _b, rest = __objRest(_b, ["class", "style"]);
|
|
507
|
+
const finalClasses = twMerge(isFunctionClass ? "" : classes, MergeStyles(isFunctionClass ? props.class(classes) : props.class).string);
|
|
507
508
|
const finalStyles = MergeStyles(styles, typeof props.style === "function" ? props.style(styles) : props.style);
|
|
508
509
|
const functionalProps = Object.entries(props).reduce((props2, [key2, value]) => {
|
|
509
510
|
var _a2;
|
|
510
|
-
if (!["class", "style"].includes(key2) && typeof value === "function") {
|
|
511
|
+
if (!["class", "style", "setup"].includes(key2) && typeof value === "function") {
|
|
511
512
|
props2[key2] = value((_a2 = vnode.props) == null ? void 0 : _a2[key2]);
|
|
512
513
|
}
|
|
513
514
|
return props2;
|
|
@@ -521,19 +522,21 @@ var extendVnode = (component, element) => {
|
|
|
521
522
|
});
|
|
522
523
|
};
|
|
523
524
|
var getData = (component, path, alternative) => {
|
|
524
|
-
const
|
|
525
|
+
const vue = access(component);
|
|
526
|
+
const data = ObjectManager2.on(unref2(componentState(vue)));
|
|
525
527
|
if (path) {
|
|
526
|
-
return data.get(dataPath(
|
|
528
|
+
return data.get(dataPath(vue, path), alternative);
|
|
527
529
|
} else {
|
|
528
530
|
return data.get();
|
|
529
531
|
}
|
|
530
532
|
};
|
|
531
533
|
var setData = (component, data, path) => {
|
|
534
|
+
const vue = access(component);
|
|
532
535
|
const diff = {
|
|
533
|
-
before: ObjectManager2.on(unref2(componentState(
|
|
534
|
-
after: path ? ObjectManager2.on(componentState(
|
|
536
|
+
before: ObjectManager2.on(unref2(componentState(vue))).clone(),
|
|
537
|
+
after: path ? ObjectManager2.on(componentState(vue)).set(dataPath(vue, path), data).get() : ObjectManager2.on(componentState(vue)).set(data).get()
|
|
535
538
|
};
|
|
536
|
-
return "state" in
|
|
539
|
+
return "state" in vue ? diff : vue.$emit("update:state", diff);
|
|
537
540
|
};
|
|
538
541
|
var componentState = (component) => {
|
|
539
542
|
return "state" in component ? component.state : component.$attrs.state;
|
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.17",
|
|
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",
|