ivue 1.1.6 → 1.1.7
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.
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useMouse } from './functions/useMouse';
|
|
3
|
+
|
|
4
|
+
import { useDark } from '@vueuse/core';
|
|
3
5
|
import { ivue, iuse, iref, type UseComposable } from 'ivue';
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -29,6 +31,8 @@ class Counter {
|
|
|
29
31
|
sum: this.sum,
|
|
30
32
|
total: this.total
|
|
31
33
|
} = iuse(useMouse()));
|
|
34
|
+
const dark = iuse(useDark());
|
|
35
|
+
dark.value
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
38
|
|
package/docs/package.json
CHANGED
package/package.json
CHANGED
package/src/ivue.ts
CHANGED
|
@@ -41,13 +41,16 @@ export type IVueRefs<T = any> = {
|
|
|
41
41
|
/**
|
|
42
42
|
* Unwraps the returned Refs of composable method T to a reactive type definition.
|
|
43
43
|
*/
|
|
44
|
-
export type UseComposableReturn<T extends Record<string, Ref | any>> =
|
|
45
|
-
|
|
46
|
-
? T[
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
export type UseComposableReturn<T extends Record<string, Ref | any>> =
|
|
45
|
+
T extends Ref | DemiRef
|
|
46
|
+
? T['value']
|
|
47
|
+
: {
|
|
48
|
+
[K in keyof T]: T[K] extends Ref | DemiRef // Handle Ref
|
|
49
|
+
? T[K]['value'] extends Ref | DemiRef // Handle Double Wrapped Ref: Most often a Ref that is inside a Computed Ref
|
|
50
|
+
? T[K]['value']['value'] // Return doubly wrapped internal value
|
|
51
|
+
: T[K]['value'] // Handle Standard Ref or Computed Ref
|
|
52
|
+
: T[K]; // Handle non Ref property or method
|
|
53
|
+
};
|
|
51
54
|
|
|
52
55
|
export type UseComposable<T extends (...args: any[]) => any> =
|
|
53
56
|
UseComposableReturn<ReturnType<T>>;
|