@razaman2/reactive-view 0.1.0-beta.12 → 0.1.0-beta.14
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -8
- package/dist/index.mjs +10 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -126,8 +126,8 @@ declare function useSubscription(): {
|
|
|
126
126
|
};
|
|
127
127
|
declare const Prop: ({ default: value, type, validator, required }?: Partial<PropType>) => {
|
|
128
128
|
required: boolean | undefined;
|
|
129
|
-
validator: (value: any) => boolean;
|
|
130
|
-
default?:
|
|
129
|
+
validator: (value: any) => boolean | undefined;
|
|
130
|
+
default?: any;
|
|
131
131
|
};
|
|
132
132
|
declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
|
|
133
133
|
declare function MergeStyles(...params: any): any;
|
package/dist/index.d.ts
CHANGED
|
@@ -126,8 +126,8 @@ declare function useSubscription(): {
|
|
|
126
126
|
};
|
|
127
127
|
declare const Prop: ({ default: value, type, validator, required }?: Partial<PropType>) => {
|
|
128
128
|
required: boolean | undefined;
|
|
129
|
-
validator: (value: any) => boolean;
|
|
130
|
-
default?:
|
|
129
|
+
validator: (value: any) => boolean | undefined;
|
|
130
|
+
default?: any;
|
|
131
131
|
};
|
|
132
132
|
declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
|
|
133
133
|
declare function MergeStyles(...params: any): any;
|
package/dist/index.js
CHANGED
|
@@ -177,7 +177,7 @@ var import_data_manager = __toESM(require("@razaman2/data-manager"));
|
|
|
177
177
|
var import_vue = require("vue");
|
|
178
178
|
|
|
179
179
|
// package.json
|
|
180
|
-
var version = "0.1.0-beta.
|
|
180
|
+
var version = "0.1.0-beta.14";
|
|
181
181
|
var package_default = {
|
|
182
182
|
name: "@razaman2/reactive-view",
|
|
183
183
|
version,
|
|
@@ -376,9 +376,6 @@ var ReactiveView_default = {
|
|
|
376
376
|
};
|
|
377
377
|
const model = props.model ? typeof props.model === "function" ? props.model(config) : props.model : import_data_manager.default.setConfig({ beforeGetData: (data) => (0, import_vue.isRef)(data) ? (0, import_vue.unref)(data) : data }, config);
|
|
378
378
|
const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, diff, emit, dataPath: dataPath2, model: proxy(model), isValid } });
|
|
379
|
-
if (props.debug) {
|
|
380
|
-
console.warn(`[${props.modelName}]:data`, { props, context, component, config, model });
|
|
381
|
-
}
|
|
382
379
|
if (context.attrs["onUpdate:model"] || context.attrs["update:model"]) {
|
|
383
380
|
const config2 = {
|
|
384
381
|
callback: typeof context.attrs["onUpdate:model"] === "function" ? context.attrs["onUpdate:model"] : context.attrs["update:model"],
|
|
@@ -778,12 +775,16 @@ function useSubscription() {
|
|
|
778
775
|
var Prop = ({ default: value, type, validator, required } = {}) => {
|
|
779
776
|
const types1 = Array.isArray(type) ? type : [type != null ? type : Array];
|
|
780
777
|
const types2 = types1.includes(Object) ? types1 : types1.concat(Object);
|
|
781
|
-
return __spreadProps(__spreadValues({}, value ? { default: (0, import_vue2.ref)(value) } : {}), {
|
|
778
|
+
return __spreadProps(__spreadValues({}, value ? { default: (0, import_vue2.isRef)(value) || (0, import_vue2.isReactive)(value) ? value : (0, import_vue2.ref)(value) } : {}), {
|
|
782
779
|
required,
|
|
783
780
|
validator: (value2) => {
|
|
784
|
-
|
|
785
|
-
return
|
|
786
|
-
|
|
781
|
+
try {
|
|
782
|
+
return validator ? validator((0, import_vue2.unref)(value2)) : Array.from(new Set(types2.map((type2) => {
|
|
783
|
+
return typeof type2 === "function" ? type2().constructor.name : type2;
|
|
784
|
+
}))).includes((0, import_vue2.unref)(value2).constructor.name);
|
|
785
|
+
} catch (e) {
|
|
786
|
+
return required;
|
|
787
|
+
}
|
|
787
788
|
}
|
|
788
789
|
});
|
|
789
790
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -130,7 +130,7 @@ import DataManager from "@razaman2/data-manager";
|
|
|
130
130
|
import { ref, reactive, watch, unref, isRef, isReactive, createVNode, getCurrentInstance, onBeforeUnmount } from "vue";
|
|
131
131
|
|
|
132
132
|
// package.json
|
|
133
|
-
var version = "0.1.0-beta.
|
|
133
|
+
var version = "0.1.0-beta.14";
|
|
134
134
|
var package_default = {
|
|
135
135
|
name: "@razaman2/reactive-view",
|
|
136
136
|
version,
|
|
@@ -329,9 +329,6 @@ var ReactiveView_default = {
|
|
|
329
329
|
};
|
|
330
330
|
const model = props.model ? typeof props.model === "function" ? props.model(config) : props.model : DataManager.setConfig({ beforeGetData: (data) => isRef(data) ? unref(data) : data }, config);
|
|
331
331
|
const component = ref({ parent: { self: vue.proxy }, self: { template, diff, emit, dataPath: dataPath2, model: proxy(model), isValid } });
|
|
332
|
-
if (props.debug) {
|
|
333
|
-
console.warn(`[${props.modelName}]:data`, { props, context, component, config, model });
|
|
334
|
-
}
|
|
335
332
|
if (context.attrs["onUpdate:model"] || context.attrs["update:model"]) {
|
|
336
333
|
const config2 = {
|
|
337
334
|
callback: typeof context.attrs["onUpdate:model"] === "function" ? context.attrs["onUpdate:model"] : context.attrs["update:model"],
|
|
@@ -595,7 +592,7 @@ var ReactiveView_default = {
|
|
|
595
592
|
};
|
|
596
593
|
|
|
597
594
|
// src/index.ts
|
|
598
|
-
import { h, ref as ref2, unref as unref2, toRaw, createApp, createVNode as createVNode2, defineComponent } from "vue";
|
|
595
|
+
import { h, ref as ref2, unref as unref2, toRaw, isRef as isRef2, isReactive as isReactive2, createApp, createVNode as createVNode2, defineComponent } from "vue";
|
|
599
596
|
import { formatInTimeZone } from "date-fns-tz";
|
|
600
597
|
import { twMerge } from "tailwind-merge";
|
|
601
598
|
console.log(`%c[ReactiveView]: ${version}`, "background-color: red; color: yellow;");
|
|
@@ -731,12 +728,16 @@ function useSubscription() {
|
|
|
731
728
|
var Prop = ({ default: value, type, validator, required } = {}) => {
|
|
732
729
|
const types1 = Array.isArray(type) ? type : [type != null ? type : Array];
|
|
733
730
|
const types2 = types1.includes(Object) ? types1 : types1.concat(Object);
|
|
734
|
-
return __spreadProps(__spreadValues({}, value ? { default: ref2(value) } : {}), {
|
|
731
|
+
return __spreadProps(__spreadValues({}, value ? { default: isRef2(value) || isReactive2(value) ? value : ref2(value) } : {}), {
|
|
735
732
|
required,
|
|
736
733
|
validator: (value2) => {
|
|
737
|
-
|
|
738
|
-
return
|
|
739
|
-
|
|
734
|
+
try {
|
|
735
|
+
return validator ? validator(unref2(value2)) : Array.from(new Set(types2.map((type2) => {
|
|
736
|
+
return typeof type2 === "function" ? type2().constructor.name : type2;
|
|
737
|
+
}))).includes(unref2(value2).constructor.name);
|
|
738
|
+
} catch (e) {
|
|
739
|
+
return required;
|
|
740
|
+
}
|
|
740
741
|
}
|
|
741
742
|
});
|
|
742
743
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razaman2/reactive-view",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.14",
|
|
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",
|