ivue 1.2.0 → 1.2.2
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/coverage/clover.xml +181 -174
- package/coverage/coverage-final.json +2 -1
- package/coverage/index.html +33 -18
- package/coverage/index.ts.html +88 -0
- package/coverage/ivue.ts.html +136 -55
- package/dist/index.es.js +40 -40
- package/dist/index.umd.js +1 -1
- package/dist/src/ivue.d.ts +23 -12
- package/docs/docs/.vitepress/dist/404.html +2 -2
- package/docs/docs/.vitepress/dist/api/ivue.html +3 -3
- package/docs/docs/.vitepress/dist/api/propsWithDefaults.html +3 -3
- package/docs/docs/.vitepress/dist/assets/{app.Cnbc-twM.js → app.2nR_jJ6K.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.yrRWVEzw.js +1 -0
- package/docs/docs/.vitepress/dist/assets/chunks/{VPLocalSearchBox.BrRdnkds.js → VPLocalSearchBox.DkPjtbh1.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/chunks/index.es.CUL6WvM-.js +1 -0
- package/docs/docs/.vitepress/dist/assets/chunks/{theme.qh_SBkj1.js → theme.DoTp8yA-.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{pages_browse-code.md.BXwbCBZ0.js → pages_browse-code.md.D-gTrMhG.js} +61 -38
- package/docs/docs/.vitepress/dist/assets/{pages_browse-code.md.BXwbCBZ0.lean.js → pages_browse-code.md.D-gTrMhG.lean.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{pages_getting-started.md.BqHPrEWq.js → pages_getting-started.md.COvbcFGT.js} +61 -38
- package/docs/docs/.vitepress/dist/assets/{pages_guidelines.md.Dkyp5V72.lean.js → pages_guidelines.md.BI1PexCc.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{pages_guidelines.md.Dkyp5V72.js → pages_guidelines.md.BI1PexCc.lean.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{pages_how-it-works.md.Bf_7UZG9.js → pages_how-it-works.md.NImDvDby.js} +61 -38
- package/docs/docs/.vitepress/dist/assets/{pages_how-it-works.md.Bf_7UZG9.lean.js → pages_how-it-works.md.NImDvDby.lean.js} +61 -38
- package/docs/docs/.vitepress/dist/assets/{pages_usage.md.C-dTtOlJ.js → pages_usage.md.DRJXyExt.js} +124 -74
- package/docs/docs/.vitepress/dist/assets/{pages_usage.md.C-dTtOlJ.lean.js → pages_usage.md.DRJXyExt.lean.js} +124 -74
- package/docs/docs/.vitepress/dist/hashmap.json +1 -1
- package/docs/docs/.vitepress/dist/index.html +3 -3
- package/docs/docs/.vitepress/dist/pages/advanced-usage.html +3 -3
- package/docs/docs/.vitepress/dist/pages/api.html +3 -3
- package/docs/docs/.vitepress/dist/pages/browse-code.html +65 -42
- package/docs/docs/.vitepress/dist/pages/getting-started.html +65 -42
- package/docs/docs/.vitepress/dist/pages/guidelines.html +6 -6
- package/docs/docs/.vitepress/dist/pages/how-it-works.html +65 -42
- package/docs/docs/.vitepress/dist/pages/how-its-made.html +3 -3
- package/docs/docs/.vitepress/dist/pages/introduction.html +3 -3
- package/docs/docs/.vitepress/dist/pages/usage.html +128 -78
- package/docs/docs/components/usage/CounterComposables.vue +2 -2
- package/docs/docs/components/usage/CounterComposablesDestructuring.vue +1 -1
- package/docs/docs/components/usage/CounterComposablesIvue.vue +26 -0
- package/docs/docs/components/usage/CounterComposablesIvueDestructuring.vue +7 -6
- package/docs/docs/components/usage/classes/CustomMouse.ts +2 -2
- package/docs/docs/pages/usage.md +38 -13
- package/docs/package.json +1 -1
- package/package.json +1 -1
- package/src/ivue.ts +59 -34
- package/docs/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.DVtkHDuS.js +0 -1
- package/docs/docs/.vitepress/dist/assets/chunks/index.es.BJUrCfJB.js +0 -1
- /package/docs/docs/.vitepress/dist/assets/{pages_getting-started.md.BqHPrEWq.lean.js → pages_getting-started.md.COvbcFGT.lean.js} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CustomMouse } from './classes/CustomMouse';
|
|
3
|
+
|
|
4
|
+
import { ivue, iref } from 'ivue';
|
|
5
|
+
|
|
6
|
+
class Counter {
|
|
7
|
+
count = iref(0);
|
|
8
|
+
|
|
9
|
+
increment() {
|
|
10
|
+
this.count++;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
mouse = ivue(CustomMouse, 5)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const counter = ivue(Counter);
|
|
17
|
+
</script>
|
|
18
|
+
<template>
|
|
19
|
+
<a href="javascript:void(0)" @click="() => counter.increment()">Increment</a>
|
|
20
|
+
Count: {{ counter.count }} <br />
|
|
21
|
+
Mouse X: {{ counter.mouse.x }}, Y: {{ counter.mouse.y }}
|
|
22
|
+
<br />
|
|
23
|
+
Total (computed): {{ counter.mouse.total }}
|
|
24
|
+
<br />
|
|
25
|
+
<button class="button" @click="() => counter.mouse.sum()">Click This Big Sum Button To Total X + Y</button>
|
|
26
|
+
</template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { CustomMouse } from './classes/CustomMouse';
|
|
3
3
|
|
|
4
|
-
import { ivue, iref
|
|
4
|
+
import { ivue, iref } from '../../../../src/ivue';
|
|
5
5
|
|
|
6
6
|
class Counter {
|
|
7
7
|
count = iref(0);
|
|
@@ -10,11 +10,10 @@ class Counter {
|
|
|
10
10
|
this.count++;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
/**
|
|
15
14
|
* 'x', 'y', 'total' are Refs that will be unwrapped to their bare raw types and destructured into the class.
|
|
16
|
-
* Even though unwrapped (de-Refed), they will maintain their behavior as Refs and thus will maintain reactivity
|
|
17
|
-
* and at the same time get destructured into this class root level scope because
|
|
15
|
+
* Even though unwrapped (de-Refed), they will maintain their behavior as Refs and thus will maintain reactivity
|
|
16
|
+
* and at the same time get destructured into this class root level scope because
|
|
18
17
|
* Vue 3's `reactive()` Proxy will be able to resolve those Refs internally.
|
|
19
18
|
*/
|
|
20
19
|
x: CustomMouse['x']; // Unwrapped Ref<number> becomes -> number
|
|
@@ -28,7 +27,7 @@ class Counter {
|
|
|
28
27
|
y: this.y,
|
|
29
28
|
sum: this.sum,
|
|
30
29
|
total: this.total,
|
|
31
|
-
} =
|
|
30
|
+
} = ivue(CustomMouse, 5).toRefs(true));
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
|
|
@@ -41,5 +40,7 @@ const counter = ivue(Counter);
|
|
|
41
40
|
<br />
|
|
42
41
|
Total (computed): {{ counter.total }}
|
|
43
42
|
<br />
|
|
44
|
-
<button class="button" @click="() => counter.sum()">
|
|
43
|
+
<button class="button" @click="() => counter.sum()">
|
|
44
|
+
Click This Big Sum Button To Total X + Y
|
|
45
|
+
</button>
|
|
45
46
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMouse } from '@vueuse/core';
|
|
2
|
-
import { iref, iuse, type UseComposable } from '
|
|
2
|
+
import { iref, iuse, type UseComposable } from 'ivue';
|
|
3
3
|
|
|
4
4
|
type UseMouse = UseComposable<typeof useMouse>;
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ export class CustomMouse {
|
|
|
10
10
|
_sum = iref(0);
|
|
11
11
|
|
|
12
12
|
constructor(public requiredProp: number) {
|
|
13
|
-
({ x: this.x, y: this.y } = iuse(useMouse
|
|
13
|
+
({ x: this.x, y: this.y } = iuse(useMouse));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
sum() {
|
package/docs/docs/pages/usage.md
CHANGED
|
@@ -11,6 +11,7 @@ import CounterInternalRefs from '../components/usage/CounterInternalRefs.vue'
|
|
|
11
11
|
import CounterComposables from '../components/usage/CounterComposables.vue'
|
|
12
12
|
import CounterComposablesDestructuring from '../components/usage/CounterComposablesDestructuring.vue'
|
|
13
13
|
import CounterComposablesIvueDestructuring from '../components/usage/CounterComposablesIvueDestructuring.vue'
|
|
14
|
+
import CounterComposablesIvue from '../components/usage/CounterComposablesIvue.vue'
|
|
14
15
|
import CounterInsideComposables from '../components/usage/CounterInsideComposables.vue'
|
|
15
16
|
import CounterComputeds from '../components/usage/CounterComputeds.vue'
|
|
16
17
|
import CounterComputedsDisabled from '../components/usage/CounterComputedsDisabled.vue'
|
|
@@ -69,7 +70,7 @@ Classic Counter example built with `ivue`
|
|
|
69
70
|
|
|
70
71
|
See the highlighted sections related to props.
|
|
71
72
|
::: code-group
|
|
72
|
-
<<< @/components/usage/CounterWithProps.vue{
|
|
73
|
+
<<< @/components/usage/CounterWithProps.vue{vue:line-numbers}
|
|
73
74
|
:::
|
|
74
75
|
|
|
75
76
|
:::details For this example we initialize the component like this:
|
|
@@ -91,7 +92,7 @@ See the highlighted sections related to props.
|
|
|
91
92
|
See the highlighted sections related to using emits.
|
|
92
93
|
|
|
93
94
|
::: code-group
|
|
94
|
-
<<< @/components/usage/CounterWithPropsAndEmits.vue{
|
|
95
|
+
<<< @/components/usage/CounterWithPropsAndEmits.vue{vue:line-numbers}
|
|
95
96
|
:::
|
|
96
97
|
|
|
97
98
|
:::details For this example we initialize the component like this:
|
|
@@ -118,7 +119,7 @@ function onIncrement(value: number) {
|
|
|
118
119
|
### Refs defined externally in the component outside of the class.
|
|
119
120
|
|
|
120
121
|
::: code-group
|
|
121
|
-
<<< @/components/usage/CounterExternalRefs.vue{
|
|
122
|
+
<<< @/components/usage/CounterExternalRefs.vue{vue:line-numbers}
|
|
122
123
|
:::
|
|
123
124
|
:::details For this example we initialize the component like this:
|
|
124
125
|
|
|
@@ -137,7 +138,7 @@ function onIncrement(value: number) {
|
|
|
137
138
|
### Refs defined internally inside of the class.
|
|
138
139
|
|
|
139
140
|
::: code-group
|
|
140
|
-
<<< @/components/usage/CounterInternalRefs.vue{
|
|
141
|
+
<<< @/components/usage/CounterInternalRefs.vue{vue:line-numbers}
|
|
141
142
|
:::
|
|
142
143
|
|
|
143
144
|
:::details For this example we initialize the component like this:
|
|
@@ -160,7 +161,7 @@ function onIncrement(value: number) {
|
|
|
160
161
|
See the highlighted sections related to `defineExpose`.
|
|
161
162
|
|
|
162
163
|
::: code-group
|
|
163
|
-
<<< @/components/usage/CounterDefineExpose.vue{
|
|
164
|
+
<<< @/components/usage/CounterDefineExpose.vue{vue:line-numbers}
|
|
164
165
|
<<< @/components/usage/CounterDefineExposeClass.ts{ts:line-numbers}
|
|
165
166
|
:::
|
|
166
167
|
|
|
@@ -200,7 +201,7 @@ function decrement() {
|
|
|
200
201
|
### Pick allowed interface properties for `defineExpose()`
|
|
201
202
|
|
|
202
203
|
::: code-group
|
|
203
|
-
<<< @/components/usage/CounterDefineExposeAdvanced.vue{
|
|
204
|
+
<<< @/components/usage/CounterDefineExposeAdvanced.vue{vue:line-numbers}
|
|
204
205
|
:::
|
|
205
206
|
|
|
206
207
|
## Using Composables
|
|
@@ -209,7 +210,7 @@ function decrement() {
|
|
|
209
210
|
|
|
210
211
|
See the highlighted sections related to composable usage.
|
|
211
212
|
::: code-group
|
|
212
|
-
<<< @/components/usage/CounterComposables.vue{
|
|
213
|
+
<<< @/components/usage/CounterComposables.vue{vue:line-numbers}
|
|
213
214
|
:::
|
|
214
215
|
|
|
215
216
|
:::details For this example we initialize the component like this:
|
|
@@ -231,7 +232,7 @@ See the highlighted sections related to composable usage.
|
|
|
231
232
|
See the highlighted sections related to destructuring composable usage.
|
|
232
233
|
|
|
233
234
|
::: code-group
|
|
234
|
-
<<< @/components/usage/CounterComposablesDestructuring.vue{
|
|
235
|
+
<<< @/components/usage/CounterComposablesDestructuring.vue{vue:line-numbers}
|
|
235
236
|
<<< @/components/usage/functions/useCustomMouse.ts{ts:line-numbers} [functions/useCustomMouse.ts]
|
|
236
237
|
:::
|
|
237
238
|
|
|
@@ -249,12 +250,36 @@ See the highlighted sections related to destructuring composable usage.
|
|
|
249
250
|
|
|
250
251
|
<CounterComposablesDestructuring />
|
|
251
252
|
|
|
253
|
+
|
|
254
|
+
### Using `ivue` Composables Directly
|
|
255
|
+
|
|
256
|
+
Using `ivue` based composables assigned to a class property:
|
|
257
|
+
|
|
258
|
+
::: code-group
|
|
259
|
+
<<< @/components/usage/CounterComposablesIvue.vue{vue:line-numbers}
|
|
260
|
+
<<< @/components/usage/classes/CustomMouse.ts{ts:line-numbers} [classes/CustomMouse.ts]
|
|
261
|
+
:::
|
|
262
|
+
|
|
263
|
+
:::details For this example we initialize the component like this:
|
|
264
|
+
|
|
265
|
+
```vue
|
|
266
|
+
<template>
|
|
267
|
+
<CounterComposablesIvue />
|
|
268
|
+
</template>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
:::
|
|
272
|
+
|
|
273
|
+
<div style="font-size: 18px; font-weight: 500;">Result</div>
|
|
274
|
+
|
|
275
|
+
<CounterComposablesIvue />
|
|
276
|
+
|
|
252
277
|
### Using `ivue` Composables With Destructuring
|
|
253
278
|
|
|
254
|
-
See the
|
|
279
|
+
See the sections related to using `ivue` based composables initialized through class destructuring assignment.
|
|
255
280
|
|
|
256
281
|
::: code-group
|
|
257
|
-
<<< @/components/usage/CounterComposablesIvueDestructuring.vue{
|
|
282
|
+
<<< @/components/usage/CounterComposablesIvueDestructuring.vue{vue:line-numbers}
|
|
258
283
|
<<< @/components/usage/classes/CustomMouse.ts{ts:line-numbers} [classes/CustomMouse.ts]
|
|
259
284
|
:::
|
|
260
285
|
|
|
@@ -278,7 +303,7 @@ See the highlighted sections related to using `ivue` based composables.
|
|
|
278
303
|
See the highlighted sections related to using `ivue` inside a composable.
|
|
279
304
|
|
|
280
305
|
::: code-group
|
|
281
|
-
<<< @/components/usage/CounterInsideComposables.vue{
|
|
306
|
+
<<< @/components/usage/CounterInsideComposables.vue{vue:line-numbers}
|
|
282
307
|
:::
|
|
283
308
|
|
|
284
309
|
:::details For this example we initialize the component like this:
|
|
@@ -301,7 +326,7 @@ See the highlighted sections related to using `ivue` inside a composable.
|
|
|
301
326
|
See the highlighted sections related to getters.
|
|
302
327
|
|
|
303
328
|
::: code-group
|
|
304
|
-
<<< @/components/usage/CounterComputeds.vue{
|
|
329
|
+
<<< @/components/usage/CounterComputeds.vue{vue:line-numbers}
|
|
305
330
|
:::
|
|
306
331
|
|
|
307
332
|
:::details For this example we initialize the component like this:
|
|
@@ -319,7 +344,7 @@ See the highlighted sections related to getters.
|
|
|
319
344
|
You can disable computed getters via `static ivue = { getter: false }`, see below:
|
|
320
345
|
|
|
321
346
|
::: code-group
|
|
322
|
-
<<< @/components/usage/CounterComputedsDisabled.vue{
|
|
347
|
+
<<< @/components/usage/CounterComputedsDisabled.vue{vue:line-numbers}
|
|
323
348
|
:::
|
|
324
349
|
|
|
325
350
|
The result of this example is identical to the above.
|
package/docs/package.json
CHANGED
package/package.json
CHANGED
package/src/ivue.ts
CHANGED
|
@@ -18,11 +18,20 @@ export interface ExtendWithToRefs<T extends AnyClass> {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
* Type definition for `.toRefs()` method converts reactive class properties to composable .value properties.
|
|
22
|
+
* But if unwrap = true is specified, the refs will be unwrapped refs available to be merged with the the root class properties.
|
|
23
|
+
*/
|
|
24
|
+
export interface IVueToRefsFn<T extends AnyClass> {
|
|
25
|
+
<P extends keyof InstanceType<T>, B extends boolean>(
|
|
26
|
+
props: P[],
|
|
27
|
+
unwrap?: B
|
|
28
|
+
): B extends true
|
|
29
|
+
? Pick<InstanceType<T>, P>
|
|
30
|
+
: Pick<IVueRefs<InstanceType<T>>, P>;
|
|
31
|
+
(props: true): InstanceType<T>;
|
|
32
|
+
(props: false): IVueRefs<InstanceType<T>>;
|
|
33
|
+
(): IVueRefs<InstanceType<T>>;
|
|
34
|
+
}
|
|
26
35
|
|
|
27
36
|
/**
|
|
28
37
|
* Converts a class properties to a composable .value Refs using ToRef vue type,
|
|
@@ -57,8 +66,9 @@ export type UnwrapComposableReturn<T> = T extends Ref | DemiRef
|
|
|
57
66
|
/**
|
|
58
67
|
* Fully unwraps to bare value types any Vue 3 composable return definition type.
|
|
59
68
|
*/
|
|
60
|
-
export type UseComposable<T extends AnyFn> =
|
|
61
|
-
|
|
69
|
+
export type UseComposable<T extends AnyFn> = UnwrapComposableReturn<
|
|
70
|
+
ReturnType<T>
|
|
71
|
+
>;
|
|
62
72
|
|
|
63
73
|
/**
|
|
64
74
|
* Extracts object defined emit types by converting them to a plain interface
|
|
@@ -139,10 +149,7 @@ export type IFnParameter<
|
|
|
139
149
|
/**
|
|
140
150
|
* Get function arguments Parmeters<F> parameter by key K
|
|
141
151
|
*/
|
|
142
|
-
export type FnParameter<
|
|
143
|
-
F extends AnyFn,
|
|
144
|
-
K extends number
|
|
145
|
-
> = Parameters<F>[K];
|
|
152
|
+
export type FnParameter<F extends AnyFn, K extends number> = Parameters<F>[K];
|
|
146
153
|
|
|
147
154
|
/**
|
|
148
155
|
* Convert Union Type to Intersection Type.
|
|
@@ -317,33 +324,50 @@ export function getAllClassProperties(obj: object): Set<string> {
|
|
|
317
324
|
}
|
|
318
325
|
|
|
319
326
|
/**
|
|
320
|
-
* `iref()` is an alias for Vue ref() function but returns an
|
|
321
|
-
* `iref()` does not alter the behavior of ref(), but simply transforms the type to an
|
|
327
|
+
* `iref()` is an alias for Vue ref() function but returns an unwrap type without the .value
|
|
328
|
+
* `iref()` does not alter the behavior of ref(), but simply transforms the type to an unwrap raw value.
|
|
322
329
|
* @param val T
|
|
323
330
|
* @returns {UnwrapRef<T>}
|
|
324
331
|
*/
|
|
325
|
-
export const iref = ref as <T = any>(value
|
|
332
|
+
export const iref = ref as <T = any>(value?: T) => T;
|
|
326
333
|
|
|
327
334
|
/**
|
|
328
|
-
*
|
|
335
|
+
* Three modes of operation:
|
|
329
336
|
* 1. `iuse(useComposable(arg, arg2, arg3, ...))` converts the return types of a Composable / Ref to pure raw type definition.
|
|
330
|
-
* Returns for all properties of an object an
|
|
337
|
+
* Returns for all properties of an object an unwrap raw type definition,
|
|
331
338
|
* unwraps direct Refs & ComputedRefs as well down to their raw types.
|
|
332
339
|
*
|
|
333
|
-
* 2. `iuse(
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
)
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
:
|
|
340
|
+
* 2. `iuse(useComposable, arg, arg2, arg3, ...)` for cleaner syntax for #1, it does exactly the same thing but
|
|
341
|
+
* here the TypeScript inference works for composable function arguments to assist you with intellisence,
|
|
342
|
+
* like they work for constructor arguments in the cause of `ivue()` core function,
|
|
343
|
+
* making the API cleaner to look at and make it compatible with how this function operates with classes, see #3.
|
|
344
|
+
*
|
|
345
|
+
* 3. `iuse(AnyClass, ...args)` If AnyClass is supplied and that class's arguments into `iuse(AnyClass, ...args)`,
|
|
346
|
+
* it returns an 'ivue(AnyClass, ...args).toRefs()` object for all properties but casts
|
|
347
|
+
* their types as raw (no-Ref) types to fit with reactive() structure of the ivue class context.
|
|
348
|
+
*/
|
|
349
|
+
export function iuse<T extends AnyClass | AnyFn | Object | any>(
|
|
350
|
+
classFunctionObject?: T,
|
|
351
|
+
...args: T extends AnyClass
|
|
352
|
+
? InferredArgs<T>
|
|
353
|
+
: T extends AnyFn
|
|
354
|
+
? Parameters<T extends (...args: any[]) => any ? T : any>
|
|
355
|
+
: any
|
|
356
|
+
): T extends AnyClass
|
|
357
|
+
? InstanceType<T>
|
|
358
|
+
: T extends AnyFn
|
|
359
|
+
? UseComposable<T>
|
|
360
|
+
: UnwrapComposableReturn<T> {
|
|
361
|
+
return typeof classFunctionObject === 'function'
|
|
362
|
+
? isClass(classFunctionObject)
|
|
363
|
+
? ivue(
|
|
364
|
+
classFunctionObject as T extends AnyClass ? T : any,
|
|
365
|
+
...(args as InferredArgs<T extends AnyClass ? T : any>)
|
|
366
|
+
).toRefs()
|
|
367
|
+
: (classFunctionObject as AnyFn)(
|
|
368
|
+
...(args as Parameters<T extends AnyFn ? AnyFn : any>)
|
|
369
|
+
)
|
|
370
|
+
: (classFunctionObject as unknown as UnwrapComposableReturn<T>);
|
|
347
371
|
}
|
|
348
372
|
|
|
349
373
|
/**
|
|
@@ -360,13 +384,14 @@ function ivueToRefs<T extends AnyClass>(
|
|
|
360
384
|
computeds: Computeds
|
|
361
385
|
): ExtendWithToRefs<T>['toRefs'] {
|
|
362
386
|
return function (
|
|
363
|
-
props?: (keyof InstanceType<T>)[]
|
|
364
|
-
|
|
387
|
+
props?: (keyof InstanceType<T>)[] | boolean,
|
|
388
|
+
unwrap?: boolean
|
|
389
|
+
): any /** @see {ReturnType<IVueToRefsFn<T>>} */ {
|
|
365
390
|
/** Resulting refs store. */
|
|
366
391
|
const result: Record<string | number | symbol, any> = {};
|
|
367
392
|
|
|
368
393
|
/** Output specific props only, if props are specified. */
|
|
369
|
-
if (Array.isArray(props)
|
|
394
|
+
if (Array.isArray(props)) {
|
|
370
395
|
for (let i = 0; i < props.length; i++) {
|
|
371
396
|
const prop = props[i] as any;
|
|
372
397
|
/** Handle descriptors. */
|
|
@@ -427,7 +452,7 @@ function ivueToRefs<T extends AnyClass>(
|
|
|
427
452
|
allProps = null;
|
|
428
453
|
}
|
|
429
454
|
|
|
430
|
-
return result as
|
|
455
|
+
return result as any;
|
|
431
456
|
};
|
|
432
457
|
}
|
|
433
458
|
|