@razaman2/reactive-view 0.1.0-beta.2 → 0.1.0-beta.3
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 +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +16 -2
- package/dist/index.mjs +15 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -16,6 +16,12 @@ type SubscriptionItem = {
|
|
|
16
16
|
handler: Function;
|
|
17
17
|
data?: any;
|
|
18
18
|
};
|
|
19
|
+
type PropType = {
|
|
20
|
+
default: any;
|
|
21
|
+
required: boolean;
|
|
22
|
+
validator: ((value: any) => boolean);
|
|
23
|
+
type: any | Array<any>;
|
|
24
|
+
};
|
|
19
25
|
type PropExclusions = Array<string> | string;
|
|
20
26
|
|
|
21
27
|
declare class Subscription {
|
|
@@ -118,6 +124,11 @@ declare function useSubscription(): {
|
|
|
118
124
|
subscriptions: any[];
|
|
119
125
|
subscription: Subscription;
|
|
120
126
|
};
|
|
127
|
+
declare const Props: ({ default: value, type, validator, required }?: Partial<PropType>) => {
|
|
128
|
+
required: boolean | undefined;
|
|
129
|
+
validator: (value: any) => boolean;
|
|
130
|
+
default?: vue.Ref<any, any> | undefined;
|
|
131
|
+
};
|
|
121
132
|
declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
|
|
122
133
|
declare function MergeStyles(...params: any): any;
|
|
123
134
|
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>;
|
|
@@ -134,4 +145,4 @@ declare const getData: (component: any, path: number | string, alternative: any)
|
|
|
134
145
|
declare const setData: (component: any, data: any, path?: string) => any;
|
|
135
146
|
declare const dataPath: (component: any, path: string | number) => any;
|
|
136
147
|
|
|
137
|
-
export { MergeStyles, StyleParser, access, dataPath, _default as default, defineReactiveView, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, showComponent, useSubscription };
|
|
148
|
+
export { MergeStyles, Props, StyleParser, access, dataPath, _default as default, defineReactiveView, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, showComponent, useSubscription };
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,12 @@ type SubscriptionItem = {
|
|
|
16
16
|
handler: Function;
|
|
17
17
|
data?: any;
|
|
18
18
|
};
|
|
19
|
+
type PropType = {
|
|
20
|
+
default: any;
|
|
21
|
+
required: boolean;
|
|
22
|
+
validator: ((value: any) => boolean);
|
|
23
|
+
type: any | Array<any>;
|
|
24
|
+
};
|
|
19
25
|
type PropExclusions = Array<string> | string;
|
|
20
26
|
|
|
21
27
|
declare class Subscription {
|
|
@@ -118,6 +124,11 @@ declare function useSubscription(): {
|
|
|
118
124
|
subscriptions: any[];
|
|
119
125
|
subscription: Subscription;
|
|
120
126
|
};
|
|
127
|
+
declare const Props: ({ default: value, type, validator, required }?: Partial<PropType>) => {
|
|
128
|
+
required: boolean | undefined;
|
|
129
|
+
validator: (value: any) => boolean;
|
|
130
|
+
default?: vue.Ref<any, any> | undefined;
|
|
131
|
+
};
|
|
121
132
|
declare function StyleParser(styles?: Array<string> | Record<string, boolean> | string): {};
|
|
122
133
|
declare function MergeStyles(...params: any): any;
|
|
123
134
|
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>;
|
|
@@ -134,4 +145,4 @@ declare const getData: (component: any, path: number | string, alternative: any)
|
|
|
134
145
|
declare const setData: (component: any, data: any, path?: string) => any;
|
|
135
146
|
declare const dataPath: (component: any, path: string | number) => any;
|
|
136
147
|
|
|
137
|
-
export { MergeStyles, StyleParser, access, dataPath, _default as default, defineReactiveView, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, showComponent, useSubscription };
|
|
148
|
+
export { MergeStyles, Props, StyleParser, access, dataPath, _default as default, defineReactiveView, extendVnode, getData, getDate, getProps, getReactiveViewComponent, safeRequest, setData, setup, showComponent, useSubscription };
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
60
60
|
var index_exports = {};
|
|
61
61
|
__export(index_exports, {
|
|
62
62
|
MergeStyles: () => MergeStyles,
|
|
63
|
+
Props: () => Props,
|
|
63
64
|
StyleParser: () => StyleParser,
|
|
64
65
|
access: () => access,
|
|
65
66
|
dataPath: () => dataPath,
|
|
@@ -177,7 +178,7 @@ var import_vue = require("vue");
|
|
|
177
178
|
|
|
178
179
|
// package.json
|
|
179
180
|
var name = "@razaman2/reactive-view";
|
|
180
|
-
var version = "0.1.0-beta.
|
|
181
|
+
var version = "0.1.0-beta.3";
|
|
181
182
|
|
|
182
183
|
// src/ReactiveView.ts
|
|
183
184
|
var setup = {
|
|
@@ -363,7 +364,7 @@ var ReactiveView_default = {
|
|
|
363
364
|
const diff2 = access(component).diff(import_object_manager.default.on(before), import_object_manager.default.on(after));
|
|
364
365
|
const callback = context.attrs["data:callback"];
|
|
365
366
|
if (props.debug) {
|
|
366
|
-
console.warn(`[${props.modelName}]:data`, { diff: diff2, data, callback, before, after, props, context, isRefData, isReactiveData });
|
|
367
|
+
console.warn(`[${props.modelName}]:data`, { diff: diff2, data, callback, before, after, props, context, component, isRefData, isReactiveData });
|
|
367
368
|
}
|
|
368
369
|
if (typeof callback === "function") {
|
|
369
370
|
model.replaceData((_a4 = await callback(diff2, { component })) != null ? _a4 : after);
|
|
@@ -720,6 +721,18 @@ function useSubscription() {
|
|
|
720
721
|
subscription
|
|
721
722
|
};
|
|
722
723
|
}
|
|
724
|
+
var Props = ({ default: value, type, validator, required } = {}) => {
|
|
725
|
+
const types1 = Array.isArray(type) ? type : [type != null ? type : Array];
|
|
726
|
+
const types2 = types1.includes(Object) ? types1 : types1.concat(Object);
|
|
727
|
+
return __spreadProps(__spreadValues({}, value ? { default: (0, import_vue2.ref)(value) } : {}), {
|
|
728
|
+
required,
|
|
729
|
+
validator: (value2) => {
|
|
730
|
+
return validator ? validator((0, import_vue2.unref)(value2)) : Array.from(new Set(types2.map((type2) => {
|
|
731
|
+
return typeof type2 === "function" ? type2().constructor.name : type2;
|
|
732
|
+
}))).includes((0, import_vue2.unref)(value2).constructor.name);
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
};
|
|
723
736
|
function StyleParser(styles = {}) {
|
|
724
737
|
const transform = (style, status = true) => {
|
|
725
738
|
const remove = style.split(/(-{[^}]+})/);
|
|
@@ -878,6 +891,7 @@ var dataPath = (component, path) => {
|
|
|
878
891
|
// Annotate the CommonJS export names for ESM import in node:
|
|
879
892
|
0 && (module.exports = {
|
|
880
893
|
MergeStyles,
|
|
894
|
+
Props,
|
|
881
895
|
StyleParser,
|
|
882
896
|
access,
|
|
883
897
|
dataPath,
|
package/dist/index.mjs
CHANGED
|
@@ -131,7 +131,7 @@ import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstanc
|
|
|
131
131
|
|
|
132
132
|
// package.json
|
|
133
133
|
var name = "@razaman2/reactive-view";
|
|
134
|
-
var version = "0.1.0-beta.
|
|
134
|
+
var version = "0.1.0-beta.3";
|
|
135
135
|
|
|
136
136
|
// src/ReactiveView.ts
|
|
137
137
|
var setup = {
|
|
@@ -317,7 +317,7 @@ var ReactiveView_default = {
|
|
|
317
317
|
const diff2 = access(component).diff(ObjectManager.on(before), ObjectManager.on(after));
|
|
318
318
|
const callback = context.attrs["data:callback"];
|
|
319
319
|
if (props.debug) {
|
|
320
|
-
console.warn(`[${props.modelName}]:data`, { diff: diff2, data, callback, before, after, props, context, isRefData, isReactiveData });
|
|
320
|
+
console.warn(`[${props.modelName}]:data`, { diff: diff2, data, callback, before, after, props, context, component, isRefData, isReactiveData });
|
|
321
321
|
}
|
|
322
322
|
if (typeof callback === "function") {
|
|
323
323
|
model.replaceData((_a4 = await callback(diff2, { component })) != null ? _a4 : after);
|
|
@@ -674,6 +674,18 @@ function useSubscription() {
|
|
|
674
674
|
subscription
|
|
675
675
|
};
|
|
676
676
|
}
|
|
677
|
+
var Props = ({ default: value, type, validator, required } = {}) => {
|
|
678
|
+
const types1 = Array.isArray(type) ? type : [type != null ? type : Array];
|
|
679
|
+
const types2 = types1.includes(Object) ? types1 : types1.concat(Object);
|
|
680
|
+
return __spreadProps(__spreadValues({}, value ? { default: ref2(value) } : {}), {
|
|
681
|
+
required,
|
|
682
|
+
validator: (value2) => {
|
|
683
|
+
return validator ? validator(unref2(value2)) : Array.from(new Set(types2.map((type2) => {
|
|
684
|
+
return typeof type2 === "function" ? type2().constructor.name : type2;
|
|
685
|
+
}))).includes(unref2(value2).constructor.name);
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
};
|
|
677
689
|
function StyleParser(styles = {}) {
|
|
678
690
|
const transform = (style, status = true) => {
|
|
679
691
|
const remove = style.split(/(-{[^}]+})/);
|
|
@@ -831,6 +843,7 @@ var dataPath = (component, path) => {
|
|
|
831
843
|
};
|
|
832
844
|
export {
|
|
833
845
|
MergeStyles,
|
|
846
|
+
Props,
|
|
834
847
|
StyleParser,
|
|
835
848
|
access,
|
|
836
849
|
dataPath,
|
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.3",
|
|
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",
|