ivue 1.5.3 → 1.5.4
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.ts +1 -0
- package/dist/index.es.js +89 -0
- package/dist/index.umd.js +1 -0
- package/dist/ivue.d.ts +247 -0
- package/package.json +3 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ivue';
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { reactive as R, computed as b, ref as v, shallowRef as A, toRef as m } from "vue";
|
|
2
|
+
const d = /* @__PURE__ */ new Map();
|
|
3
|
+
function D(e) {
|
|
4
|
+
if (d.has(e))
|
|
5
|
+
return d.get(e);
|
|
6
|
+
const o = /* @__PURE__ */ new Map();
|
|
7
|
+
let t = e.prototype;
|
|
8
|
+
for (; t.constructor !== Object; )
|
|
9
|
+
Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([f, r]) => {
|
|
10
|
+
const i = o.get(f);
|
|
11
|
+
i !== r && (r != null && r.get || r != null && r.set) && (i != null && i.get && (r.get = i == null ? void 0 : i.get), i != null && i.set && (r.set = i == null ? void 0 : i.set), o.set(f, r));
|
|
12
|
+
}), t = Object.getPrototypeOf(t);
|
|
13
|
+
return d.set(e, o), o;
|
|
14
|
+
}
|
|
15
|
+
function E(e, ...o) {
|
|
16
|
+
var i, O;
|
|
17
|
+
const t = D(e), f = t != null && t.size ? {} : null, r = R(new e(...o));
|
|
18
|
+
for (const [n, l] of t)
|
|
19
|
+
((i = e == null ? void 0 : e.ivue) == null ? void 0 : i[n]) !== !1 && Object.defineProperty(r, n, { get: l.get ? () => {
|
|
20
|
+
var a, g;
|
|
21
|
+
return n in f ? f[n] : f[n] = b({ get: (a = l.get) == null ? void 0 : a.bind(r), set: (g = l.set) == null ? void 0 : g.bind(r) });
|
|
22
|
+
} : void 0, set: (O = l.set) == null ? void 0 : O.bind(r), enumerable: !1 });
|
|
23
|
+
return Object.defineProperty(r, "toRefs", { get: () => function(n, l, a) {
|
|
24
|
+
return function(g, S) {
|
|
25
|
+
var w, h;
|
|
26
|
+
const p = {};
|
|
27
|
+
if (Array.isArray(g))
|
|
28
|
+
for (let u = 0; u < g.length; u++) {
|
|
29
|
+
const s = g[u];
|
|
30
|
+
if (l.has(s))
|
|
31
|
+
if (s in a)
|
|
32
|
+
p[s] = a[s];
|
|
33
|
+
else {
|
|
34
|
+
const c = l.get(s);
|
|
35
|
+
p[s] = a[s] = b({ get: (w = c == null ? void 0 : c.get) == null ? void 0 : w.bind(n), set: (h = c == null ? void 0 : c.set) == null ? void 0 : h.bind(n) });
|
|
36
|
+
}
|
|
37
|
+
else
|
|
38
|
+
typeof n[s] == "function" ? p[s] = n[s].bind(n) : p[s] = m(n, s);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
let u = new Set(C(n));
|
|
42
|
+
l.forEach((s, c) => {
|
|
43
|
+
var j, P;
|
|
44
|
+
p[c] = c in a ? a[c] : a[c] = b({ get: (j = s.get) == null ? void 0 : j.bind(n), set: (P = s.set) == null ? void 0 : P.bind(n) }), u == null || u.delete(c);
|
|
45
|
+
}), u.forEach((s) => {
|
|
46
|
+
typeof n[s] == "function" ? p[s] = n[s].bind(n) : p[s] = m(n, s);
|
|
47
|
+
}), u = null;
|
|
48
|
+
}
|
|
49
|
+
return p;
|
|
50
|
+
};
|
|
51
|
+
}(r, t, f), enumerable: !1 }), "init" in r && r.init(), r;
|
|
52
|
+
}
|
|
53
|
+
const y = /* @__PURE__ */ new Map();
|
|
54
|
+
function C(e) {
|
|
55
|
+
if (y.has(e.constructor))
|
|
56
|
+
return y.get(e.constructor);
|
|
57
|
+
const o = e.constructor, t = /* @__PURE__ */ new Set();
|
|
58
|
+
do
|
|
59
|
+
Object.getOwnPropertyNames(e).forEach((f) => {
|
|
60
|
+
["caller", "callee", "arguments", "constructor"].includes(f) || t.add(f);
|
|
61
|
+
}), e = Object.getPrototypeOf(e);
|
|
62
|
+
while (e.constructor !== Object);
|
|
63
|
+
return y.set(o, t), t;
|
|
64
|
+
}
|
|
65
|
+
const z = v, N = A;
|
|
66
|
+
function W(e, ...o) {
|
|
67
|
+
return typeof e == "function" ? M(e) ? E(e, ...o).toRefs(!0) : e(...o) : e;
|
|
68
|
+
}
|
|
69
|
+
function M(e) {
|
|
70
|
+
var o;
|
|
71
|
+
return typeof e == "function" && !!e.prototype && !((o = Object.getOwnPropertyDescriptor(e, "prototype")) != null && o.writable);
|
|
72
|
+
}
|
|
73
|
+
function k(e, o) {
|
|
74
|
+
for (const t in o)
|
|
75
|
+
typeof (e == null ? void 0 : e[t]) == "object" && (e == null ? void 0 : e[t]) !== null || M(e == null ? void 0 : e[t]) ? o[t].default = () => e == null ? void 0 : e[t] : o[t].default = e == null ? void 0 : e[t];
|
|
76
|
+
return o;
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
d as descriptorsMap,
|
|
80
|
+
D as getAllClassDescriptors,
|
|
81
|
+
C as getAllClassProperties,
|
|
82
|
+
z as iref,
|
|
83
|
+
M as isClass,
|
|
84
|
+
N as ishallowRef,
|
|
85
|
+
W as iuse,
|
|
86
|
+
E as ivue,
|
|
87
|
+
y as propsMap,
|
|
88
|
+
k as propsWithDefaults
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(c,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):f((c=typeof globalThis<"u"?globalThis:c||self).ivue={},c.Vue)})(this,function(c,f){"use strict";const y=new Map;function j(t){if(y.has(t))return y.get(t);const r=new Map;let e=t.prototype;for(;e.constructor!==Object;)Object.entries(Object.getOwnPropertyDescriptors(e)).forEach(([l,n])=>{const i=r.get(l);i!==n&&(n!=null&&n.get||n!=null&&n.set)&&(i!=null&&i.get&&(n.get=i==null?void 0:i.get),i!=null&&i.set&&(n.set=i==null?void 0:i.set),r.set(l,n))}),e=Object.getPrototypeOf(e);return y.set(t,r),r}function w(t,...r){var i,P;const e=j(t),l=e!=null&&e.size?{}:null,n=f.reactive(new t(...r));for(const[s,d]of e)((i=t==null?void 0:t.ivue)==null?void 0:i[s])!==!1&&Object.defineProperty(n,s,{get:d.get?()=>{var p,b;return s in l?l[s]:l[s]=f.computed({get:(p=d.get)==null?void 0:p.bind(n),set:(b=d.set)==null?void 0:b.bind(n)})}:void 0,set:(P=d.set)==null?void 0:P.bind(n),enumerable:!1});return Object.defineProperty(n,"toRefs",{get:()=>function(s,d,p){return function(b,S){var v,M;const g={};if(Array.isArray(b))for(let a=0;a<b.length;a++){const o=b[a];if(d.has(o))if(o in p)g[o]=p[o];else{const u=d.get(o);g[o]=p[o]=f.computed({get:(v=u==null?void 0:u.get)==null?void 0:v.bind(s),set:(M=u==null?void 0:u.set)==null?void 0:M.bind(s)})}else typeof s[o]=="function"?g[o]=s[o].bind(s):g[o]=f.toRef(s,o)}else{let a=new Set(m(s));d.forEach((o,u)=>{var R,A;g[u]=u in p?p[u]:p[u]=f.computed({get:(R=o.get)==null?void 0:R.bind(s),set:(A=o.set)==null?void 0:A.bind(s)}),a==null||a.delete(u)}),a.forEach(o=>{typeof s[o]=="function"?g[o]=s[o].bind(s):g[o]=f.toRef(s,o)}),a=null}return g}}(n,e,l),enumerable:!1}),"init"in n&&n.init(),n}const O=new Map;function m(t){if(O.has(t.constructor))return O.get(t.constructor);const r=t.constructor,e=new Set;do Object.getOwnPropertyNames(t).forEach(l=>{["caller","callee","arguments","constructor"].includes(l)||e.add(l)}),t=Object.getPrototypeOf(t);while(t.constructor!==Object);return O.set(r,e),e}const D=f.ref,E=f.shallowRef;function h(t){var r;return typeof t=="function"&&!!t.prototype&&!((r=Object.getOwnPropertyDescriptor(t,"prototype"))!=null&&r.writable)}c.descriptorsMap=y,c.getAllClassDescriptors=j,c.getAllClassProperties=m,c.iref=D,c.isClass=h,c.ishallowRef=E,c.iuse=function(t,...r){return typeof t=="function"?h(t)?w(t,...r).toRefs(!0):t(...r):t},c.ivue=w,c.propsMap=O,c.propsWithDefaults=function(t,r){for(const e in r)typeof(t==null?void 0:t[e])=="object"&&(t==null?void 0:t[e])!==null||h(t==null?void 0:t[e])?r[e].default=()=>t==null?void 0:t[e]:r[e].default=t==null?void 0:t[e];return r},Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
package/dist/ivue.d.ts
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import type { ComputedRef, ExtractPropTypes, Ref, ToRef } from 'vue';
|
|
2
|
+
import type { Ref as DemiRef } from 'vue-demi';
|
|
3
|
+
/** Types */
|
|
4
|
+
/**
|
|
5
|
+
* IVue core reactive instance type with an extended .toRefs() method added.
|
|
6
|
+
*/
|
|
7
|
+
export declare type IVue<T extends AnyClass> = InstanceType<T> & ExtendWithToRefs<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Extend with .toRefs() method, so that a reactive class can be converted to a composable definition.
|
|
10
|
+
*/
|
|
11
|
+
export interface ExtendWithToRefs<T extends AnyClass> {
|
|
12
|
+
toRefs: IVueToRefsFn<T>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Type definition for `.toRefs()` method converts reactive class properties to composable .value properties.
|
|
16
|
+
* But if props = true OR unwrap = true is specified, the refs will be unwrapped refs to be able to be merged with the the root class properties without losing reactivity.
|
|
17
|
+
*/
|
|
18
|
+
export interface IVueToRefsFn<T extends AnyClass> {
|
|
19
|
+
<P extends keyof InstanceType<T>>(props: P[]): Pick<IVueRefs<InstanceType<T>>, P>;
|
|
20
|
+
<P extends keyof InstanceType<T>>(props: P[], unwrap: false): Pick<IVueRefs<InstanceType<T>>, P>;
|
|
21
|
+
<P extends keyof InstanceType<T>>(props: P[], unwrap: true): Pick<InstanceType<T>, P>;
|
|
22
|
+
(props: true): InstanceType<T>;
|
|
23
|
+
(props: false): IVueRefs<InstanceType<T>>;
|
|
24
|
+
(): IVueRefs<InstanceType<T>>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Converts a class properties to a composable .value Refs using ToRef vue type,
|
|
28
|
+
* also knows NOT to convert functions to .value Refs but to leave them as is.
|
|
29
|
+
*/
|
|
30
|
+
export declare type IVueRefs<T = any> = {
|
|
31
|
+
[K in keyof T]: T[K] extends Function ? T[K] : ToRef<T[K]>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Unwraps Ref Recursively, helps resolve fully the bare value types of any type T
|
|
35
|
+
* because sometimes the Refs are returned as they are with `.value` from computeds,
|
|
36
|
+
* thus inferring nested ComputedRef<ComputedRef<ComputedRef<Ref>>> types, which
|
|
37
|
+
* are difficult to fully resolve to bare values without this utility.
|
|
38
|
+
* Also support Vue 3 Demi for vue-use library support.
|
|
39
|
+
*/
|
|
40
|
+
export declare type UnwrapRefRecursively<T = any> = T extends Ref | DemiRef ? UnwrapRefRecursively<T['value']> : T;
|
|
41
|
+
/**
|
|
42
|
+
* Helper type for Use type, unwraps any type of Vue 3 composable down to its bare types.
|
|
43
|
+
*/
|
|
44
|
+
export declare type Unwrap<T> = T extends Ref | DemiRef ? UnwrapRefRecursively<T> : {
|
|
45
|
+
[K in keyof T]: T[K] extends Ref | DemiRef ? UnwrapRefRecursively<T[K]> : T[K];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Fully unwraps to bare value types any Vue 3 composable return definition type.
|
|
49
|
+
*/
|
|
50
|
+
export declare type Use<T = any> = Unwrap<T extends AnyFn ? ReturnType<T> : T>;
|
|
51
|
+
/**
|
|
52
|
+
* Extracts object defined emit types by converting them to a plain interface
|
|
53
|
+
*/
|
|
54
|
+
export declare type ExtractEmitTypes<T extends Record<string, any>> = UnionToIntersection<RecordToUnion<{
|
|
55
|
+
[K in keyof T]: (evt: K, ...args: Parameters<T[K]>) => void;
|
|
56
|
+
}>>;
|
|
57
|
+
/**
|
|
58
|
+
* Extract properties as all assigned properties because they have defaults.
|
|
59
|
+
*/
|
|
60
|
+
export declare type ExtractPropDefaultTypes<O> = {
|
|
61
|
+
[K in keyof O]: ValueOf<ExtractPropTypes<O>, K>;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Extend slots interface T with prefixed 'before--' & 'after--' slots to create fully extensible flexible slots.
|
|
65
|
+
*/
|
|
66
|
+
export declare type ExtendSlots<T> = PrefixKeys<T, 'before--'> & T & PrefixKeys<T, 'after--'>;
|
|
67
|
+
/** Helper Types. */
|
|
68
|
+
/**
|
|
69
|
+
* Any JavaScript function of any type.
|
|
70
|
+
*/
|
|
71
|
+
export declare type AnyFn = (...args: any[]) => any;
|
|
72
|
+
/**
|
|
73
|
+
* Any JavaScript class of any type.
|
|
74
|
+
*/
|
|
75
|
+
export declare type AnyClass = abstract new (...args: any[]) => any;
|
|
76
|
+
/**
|
|
77
|
+
* Descriptors map type.
|
|
78
|
+
*/
|
|
79
|
+
export declare type Descriptors = Map<string, PropertyDescriptor>;
|
|
80
|
+
/**
|
|
81
|
+
* Computeds hash map type.
|
|
82
|
+
*/
|
|
83
|
+
export declare type Computeds = Record<string, ComputedRef>;
|
|
84
|
+
/**
|
|
85
|
+
* Infer paramaters of a constructor function of a Class.
|
|
86
|
+
*/
|
|
87
|
+
export declare type InferredArgs<T> = T extends {
|
|
88
|
+
new (...args: infer P): any;
|
|
89
|
+
} ? P : never[];
|
|
90
|
+
/**
|
|
91
|
+
* Prefix keys of an interface T with a prefix P.
|
|
92
|
+
*/
|
|
93
|
+
export declare type PrefixKeys<T, P extends string | undefined = undefined> = {
|
|
94
|
+
[K in Extract<keyof T, string> as P extends string ? `${P}${K}` : K]: T[K];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Get Interface's property's function arguments Parmeters<F>
|
|
98
|
+
*/
|
|
99
|
+
export declare type IFnParameters<T extends Record<any, any>, K extends string> = Parameters<Required<Pick<T, K>>[K]>;
|
|
100
|
+
/**
|
|
101
|
+
* Get Interface's [T] property's [P] function arguments Parmeters<F> parameter by key [K]
|
|
102
|
+
*/
|
|
103
|
+
export declare type IFnParameter<T extends Record<any, any>, P extends keyof T, K extends number> = FnParameter<ValueOf<T, P>, K>;
|
|
104
|
+
/**
|
|
105
|
+
* Get function arguments Parmeters<F> parameter by key K
|
|
106
|
+
*/
|
|
107
|
+
export declare type FnParameter<F extends AnyFn, K extends number> = Parameters<F>[K];
|
|
108
|
+
/**
|
|
109
|
+
* Convert Union Type to Intersection Type.
|
|
110
|
+
*/
|
|
111
|
+
export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
112
|
+
/**
|
|
113
|
+
* Convert Record to Union Type.
|
|
114
|
+
*/
|
|
115
|
+
export declare type RecordToUnion<T extends Record<string, any>> = T[keyof T];
|
|
116
|
+
/**
|
|
117
|
+
* Gets object T property by key [K].
|
|
118
|
+
*/
|
|
119
|
+
export declare type ValueOf<T extends Record<any, any>, K> = T[K];
|
|
120
|
+
/** Types End. */
|
|
121
|
+
/**
|
|
122
|
+
* Store all descriptors for each class prototype processed by
|
|
123
|
+
* @see {getAllClassDescriptors}
|
|
124
|
+
*/
|
|
125
|
+
export declare const descriptorsMap: Map<any, any>;
|
|
126
|
+
/**
|
|
127
|
+
* Get descriptors of an entire class prototype ancestors chain as a Map.
|
|
128
|
+
* Completely emulates JavaScript class inheritance chain for getters and setters.
|
|
129
|
+
*
|
|
130
|
+
* @param className
|
|
131
|
+
* @return {Descriptors}
|
|
132
|
+
*/
|
|
133
|
+
export declare function getAllClassDescriptors(className: AnyClass): Descriptors;
|
|
134
|
+
/**
|
|
135
|
+
* Infinite Vue (ivue) class reactive initializer.
|
|
136
|
+
*
|
|
137
|
+
* Converts class instance to a reactive object,
|
|
138
|
+
* where descriptors are converted to computeds.
|
|
139
|
+
*
|
|
140
|
+
* You can turn off computed behaviour by adding static
|
|
141
|
+
* ivue object and setting the getter props to false.
|
|
142
|
+
* class ClassName {
|
|
143
|
+
* static ivue = {
|
|
144
|
+
* getter: false
|
|
145
|
+
* }
|
|
146
|
+
* // .getter -> will be a standard JS non-computed getter
|
|
147
|
+
* get getter () { return 'hello world'; }
|
|
148
|
+
* }
|
|
149
|
+
*
|
|
150
|
+
* @param className Any Class
|
|
151
|
+
* @param args Class constructor arguments that you would pass to a `new AnyClass(args...)`
|
|
152
|
+
* @returns {IVue<T>}
|
|
153
|
+
*/
|
|
154
|
+
export declare function ivue<T extends AnyClass>(className: T, ...args: InferredArgs<T>): IVue<T>;
|
|
155
|
+
/**
|
|
156
|
+
* Store all props for each class prototype processed by:
|
|
157
|
+
* @see {getAllClassProperties}
|
|
158
|
+
*/
|
|
159
|
+
export declare const propsMap: Map<object, Set<string> | any>;
|
|
160
|
+
/**
|
|
161
|
+
* Get properties of an entire class prototype ancestors chain as a Map.
|
|
162
|
+
*/
|
|
163
|
+
export declare function getAllClassProperties(obj: object): Set<string>;
|
|
164
|
+
/**
|
|
165
|
+
* `iref()` is an alias for Vue ref() function but returns an unwrapped type without the .value
|
|
166
|
+
* `iref()` does not alter the behavior of ref(), but simply transforms the type to an unwrapped raw value.
|
|
167
|
+
* @param val T
|
|
168
|
+
* @returns {T}
|
|
169
|
+
*/
|
|
170
|
+
export declare const iref: <T = any>(value?: T | undefined) => T;
|
|
171
|
+
/**
|
|
172
|
+
* `ishallowRef()` is an alias for Vue shallowRef() function but returns an unwrapped type without the .value
|
|
173
|
+
* `ishallowRef()` does not alter the behavior of shallowRef(), but simply transforms the type to an unwrapped raw value.
|
|
174
|
+
* @param val T
|
|
175
|
+
* @returns {T}
|
|
176
|
+
*/
|
|
177
|
+
export declare const ishallowRef: <T = any>(value?: T | undefined) => T;
|
|
178
|
+
/**
|
|
179
|
+
* Three modes of operation:
|
|
180
|
+
* 1. `iuse(useComposable(arg, arg2, arg3, ...))` converts the return types of a Composable / Ref to pure raw unwrapped type definition.
|
|
181
|
+
* Returns for all properties of an object an unwrapped raw type definition,
|
|
182
|
+
* unwraps direct Refs & ComputedRefs as well down to their raw types.
|
|
183
|
+
*
|
|
184
|
+
* 2. `iuse(useComposable, arg, arg2, arg3, ...)` for cleaner syntax for #1, it does exactly the same thing but
|
|
185
|
+
* here the TypeScript inference works for composable function arguments to assist you with intellisence,
|
|
186
|
+
* like they work for constructor arguments in the cause of `ivue()` core function,
|
|
187
|
+
* making the API cleaner to look at and make it compatible with how this function operates with classes, see #3.
|
|
188
|
+
*
|
|
189
|
+
* 3. `iuse(AnyClass, ...args)` If AnyClass is supplied and that class's arguments into `iuse(AnyClass, ...args)`,
|
|
190
|
+
* it returns an 'ivue(AnyClass, ...args).toRefs()` object for all properties but casts
|
|
191
|
+
* their types as raw (no-Ref) types to fit with reactive() structure of the ivue class context.
|
|
192
|
+
*/
|
|
193
|
+
export declare function iuse<T extends AnyClass | AnyFn | Object | any>(classFunctionObject?: T, ...args: T extends AnyClass ? InferredArgs<T> : T extends AnyFn ? Parameters<T extends (...args: any[]) => any ? T : any> : any): T extends AnyClass ? InstanceType<T> : Use<T>;
|
|
194
|
+
/**
|
|
195
|
+
* Vue props interface in defineComponent() style.
|
|
196
|
+
*/
|
|
197
|
+
export declare type VuePropsObject = Record<string, {
|
|
198
|
+
type: any;
|
|
199
|
+
default?: any;
|
|
200
|
+
required?: boolean;
|
|
201
|
+
}>;
|
|
202
|
+
/**
|
|
203
|
+
* Vue Props with default properties declared as existing and having values.
|
|
204
|
+
*/
|
|
205
|
+
export declare type VuePropsWithDefaults<T extends VuePropsObject> = {
|
|
206
|
+
[K in keyof T]: {
|
|
207
|
+
type: T[K]['type'];
|
|
208
|
+
default: T[K]['default'];
|
|
209
|
+
required?: boolean;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Determines if the value is a JavaScript Class.
|
|
214
|
+
* Note that class is a class function in JavaScript.
|
|
215
|
+
*
|
|
216
|
+
* @param val Any value
|
|
217
|
+
* @returns boolean If it's a JavaScript Class returns true
|
|
218
|
+
*/
|
|
219
|
+
export declare function isClass(val: any): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Creates props with defaults in defineComponent() style.
|
|
222
|
+
*
|
|
223
|
+
* Merge defaults regular object with Vue types object
|
|
224
|
+
* declared in defineComponent() style.
|
|
225
|
+
*
|
|
226
|
+
* This is made so that the defaults can be declared "as they are"
|
|
227
|
+
* without requiring objects to be function callbacks returning an object.
|
|
228
|
+
*
|
|
229
|
+
* // You don't need to wrap objects in () => ({ nest: { nest :{} } })
|
|
230
|
+
* // You can just delcare them normally.
|
|
231
|
+
* const defaults = {
|
|
232
|
+
* nest: {
|
|
233
|
+
* nest
|
|
234
|
+
* }
|
|
235
|
+
* }
|
|
236
|
+
*
|
|
237
|
+
* This function will create the Vue expected callbacks for Objects, Arrays & Classes
|
|
238
|
+
* but leave primitive properties and functions intact so that
|
|
239
|
+
* the final object is fully defineComponent() style compatible.
|
|
240
|
+
*
|
|
241
|
+
* @param defaults Regular object of default key -> values
|
|
242
|
+
* @param typedProps Props declared in defineComponent() style with type and possibly required declared, but without default
|
|
243
|
+
* @returns Props declared in defineComponent() style with all properties having default property declared.
|
|
244
|
+
*/
|
|
245
|
+
export declare function propsWithDefaults<T extends VuePropsObject>(defaults: Record<string, any>, typedProps: T): VuePropsWithDefaults<T>;
|
|
246
|
+
/** Necessary ivue.ts to be treated as a module. */
|
|
247
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ivue",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "Infinite Vue – Class Based Architecture for Vue 3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -86,7 +86,8 @@
|
|
|
86
86
|
"email": "ekalashnikov@gmail.com"
|
|
87
87
|
},
|
|
88
88
|
"files": [
|
|
89
|
-
"lib"
|
|
89
|
+
"lib",
|
|
90
|
+
"dist"
|
|
90
91
|
],
|
|
91
92
|
"license": "MIT",
|
|
92
93
|
"dependencies": {}
|