ivue 1.0.4 → 1.1.1
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/src/ivue.d.ts +3 -1
- package/docs/docs/.vitepress/config.ts +2 -0
- package/docs/docs/.vitepress/dist/404.html +2 -2
- package/docs/docs/.vitepress/dist/api/ivue.html +6 -6
- package/docs/docs/.vitepress/dist/api/propsWithDefaults.html +6 -6
- package/docs/docs/.vitepress/dist/assets/{api_ivue.md.MRwb9Lcb.js → api_ivue.md.CZqok1oO.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{api_ivue.md.MRwb9Lcb.lean.js → api_ivue.md.CZqok1oO.lean.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{api_propsWithDefaults.md.CeE4IC-K.js → api_propsWithDefaults.md.DEcLH0d7.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{api_propsWithDefaults.md.CeE4IC-K.lean.js → api_propsWithDefaults.md.DEcLH0d7.lean.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{app.ConZRsN0.js → app.WgCRndcM.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.DCn8lxXN.js +1 -0
- package/docs/docs/.vitepress/dist/assets/chunks/{Button.vue_vue_type_script_setup_true_lang.P7niV-n8.js → Button.vue_vue_type_script_setup_true_lang.CPdVloYP.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/chunks/{VPLocalSearchBox.C7VDyivS.js → VPLocalSearchBox.uCTLZYVa.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/chunks/{framework.CNtPHGsN.js → framework.DwpdbuZp.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/chunks/index.es.Dhu93bg7.js +1 -0
- package/docs/docs/.vitepress/dist/assets/chunks/{theme.B7n-r1TY.js → theme.GsYz9Cer.js} +2 -2
- package/docs/docs/.vitepress/dist/assets/{index.md.wPLoTLBY.js → index.md.CLB_U8aI.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{index.md.wPLoTLBY.lean.js → index.md.CLB_U8aI.lean.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{pages_advanced-usage.md.BZgX-VP7.js → pages_advanced-usage.md.BdjYKyP7.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{pages_advanced-usage.md.BZgX-VP7.lean.js → pages_advanced-usage.md.BdjYKyP7.lean.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{pages_api.md.C_PvCZns.js → pages_api.md.-RSHq6PR.js} +3 -3
- package/docs/docs/.vitepress/dist/assets/{pages_api.md.C_PvCZns.lean.js → pages_api.md.-RSHq6PR.lean.js} +3 -3
- package/docs/docs/.vitepress/dist/assets/pages_browse-code.md.DMaD5BFC.js +497 -0
- package/docs/docs/.vitepress/dist/assets/pages_browse-code.md.DMaD5BFC.lean.js +1 -0
- package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.CYQzz0L3.js +504 -0
- package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.CYQzz0L3.lean.js +1 -0
- package/docs/docs/.vitepress/dist/assets/{pages_guidelines.md.DddPdPom.lean.js → pages_guidelines.md.DHH7QF5r.js} +12 -7
- package/docs/docs/.vitepress/dist/assets/{pages_guidelines.md.DddPdPom.js → pages_guidelines.md.DHH7QF5r.lean.js} +12 -7
- package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.CL6IkeyZ.js +500 -0
- package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.CL6IkeyZ.lean.js +500 -0
- package/docs/docs/.vitepress/dist/assets/{pages_how-its-made.md.Vv9Z9TEi.js → pages_how-its-made.md.DGeFDBuv.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{pages_how-its-made.md.Vv9Z9TEi.lean.js → pages_how-its-made.md.DGeFDBuv.lean.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{pages_introduction.md.DrDm-R8F.js → pages_introduction.md.BdBoAz6L.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{pages_introduction.md.DrDm-R8F.lean.js → pages_introduction.md.BdBoAz6L.lean.js} +1 -1
- package/docs/docs/.vitepress/dist/assets/{pages_usage.md.zSOVjtFF.js → pages_usage.md.tuKxzlWb.js} +108 -114
- package/docs/docs/.vitepress/dist/assets/{pages_usage.md.zSOVjtFF.lean.js → pages_usage.md.tuKxzlWb.lean.js} +108 -114
- package/docs/docs/.vitepress/dist/hashmap.json +1 -1
- package/docs/docs/.vitepress/dist/index.html +7 -7
- package/docs/docs/.vitepress/dist/pages/advanced-usage.html +6 -6
- package/docs/docs/.vitepress/dist/pages/api.html +7 -7
- package/docs/docs/.vitepress/dist/pages/browse-code.html +502 -6
- package/docs/docs/.vitepress/dist/pages/getting-started.html +503 -7
- package/docs/docs/.vitepress/dist/pages/guidelines.html +18 -13
- package/docs/docs/.vitepress/dist/pages/how-it-works.html +503 -7
- package/docs/docs/.vitepress/dist/pages/how-its-made.html +6 -6
- package/docs/docs/.vitepress/dist/pages/introduction.html +7 -7
- package/docs/docs/.vitepress/dist/pages/usage.html +113 -119
- package/docs/docs/components/Component.vue +1 -1
- package/docs/docs/components/usage/CounterBasic.vue +2 -3
- package/docs/docs/components/usage/CounterComposables.vue +1 -1
- package/docs/docs/components/usage/CounterComposablesDestructuring.vue +3 -4
- package/docs/docs/components/usage/CounterComputeds.vue +2 -3
- package/docs/docs/components/usage/CounterComputedsDisabled.vue +2 -3
- package/docs/docs/components/usage/CounterDefineExposeAdvanced.vue +2 -3
- package/docs/docs/components/usage/CounterDefineExposeClass.ts +2 -2
- package/docs/docs/components/usage/CounterExternalRefs.vue +2 -2
- package/docs/docs/components/usage/CounterInsideComposables.vue +2 -3
- package/docs/docs/components/usage/CounterInternalRefs.vue +4 -5
- package/docs/docs/components/usage/CounterLifecycleHooks.vue +3 -3
- package/docs/docs/components/usage/CounterWatch.vue +10 -7
- package/docs/docs/components/usage/CounterWithProps.vue +2 -3
- package/docs/docs/components/usage/CounterWithPropsAndEmits.vue +3 -4
- package/docs/docs/pages/api.md +10 -2
- package/docs/docs/pages/browse-code.md +2 -2
- package/docs/docs/pages/getting-started.md +2 -2
- package/docs/docs/pages/guidelines.md +10 -5
- package/docs/docs/pages/how-it-works.md +2 -2
- package/docs/package.json +2 -2
- package/package.json +1 -1
- package/src/ivue.ts +5 -3
- package/docs/docs/.vitepress/dist/assets/chunks/@localSearchIndexroot.CGLWArGd.js +0 -1
- package/docs/docs/.vitepress/dist/assets/chunks/index.es.DnWLDAUc.js +0 -1
- package/docs/docs/.vitepress/dist/assets/pages_browse-code.md.CPluoaap.js +0 -1
- package/docs/docs/.vitepress/dist/assets/pages_browse-code.md.CPluoaap.lean.js +0 -1
- package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.knQcOZyP.js +0 -8
- package/docs/docs/.vitepress/dist/assets/pages_getting-started.md.knQcOZyP.lean.js +0 -1
- package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.OJGcGEXF.js +0 -4
- package/docs/docs/.vitepress/dist/assets/pages_how-it-works.md.OJGcGEXF.lean.js +0 -4
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref } from 'vue';
|
|
3
2
|
import { useMouse } from './functions/useMouse';
|
|
4
|
-
import { ivue, type UseComposable } from '
|
|
3
|
+
import { ivue, iuse, iref, type UseComposable } from '../../../../src/ivue';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Use the ivue Utility Type: UseComposable<typeof YourComposableFunctionName>
|
|
@@ -10,7 +9,7 @@ import { ivue, type UseComposable } from '@/ivue';
|
|
|
10
9
|
type UseMouse = UseComposable<typeof useMouse>;
|
|
11
10
|
|
|
12
11
|
class Counter {
|
|
13
|
-
count =
|
|
12
|
+
count = iref(0);
|
|
14
13
|
|
|
15
14
|
increment() {
|
|
16
15
|
this.count++;
|
|
@@ -29,7 +28,7 @@ class Counter {
|
|
|
29
28
|
y: this.y,
|
|
30
29
|
sum: this.sum,
|
|
31
30
|
total: this.total
|
|
32
|
-
} = useMouse()
|
|
31
|
+
} = iuse(useMouse()));
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { ivue } from 'ivue';
|
|
2
|
+
import { ivue, iref } from 'ivue';
|
|
4
3
|
|
|
5
4
|
class Counter {
|
|
6
5
|
/**
|
|
@@ -10,7 +9,7 @@ class Counter {
|
|
|
10
9
|
static ivue = {
|
|
11
10
|
doubleCount: false // doubleCount is a regular getter now
|
|
12
11
|
}
|
|
13
|
-
count =
|
|
12
|
+
count = iref(0);
|
|
14
13
|
increment() {
|
|
15
14
|
this.count++;
|
|
16
15
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ivue } from 'ivue';
|
|
3
|
-
import { ref } from 'vue';
|
|
2
|
+
import { ivue, iref } from 'ivue';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* See that only 'count', 'increment' properties are picked
|
|
@@ -9,7 +8,7 @@ import { ref } from 'vue';
|
|
|
9
8
|
export type CounterExposed = Pick<Counter, 'count' | 'increment'>;
|
|
10
9
|
|
|
11
10
|
class Counter {
|
|
12
|
-
count =
|
|
11
|
+
count = iref(0);
|
|
13
12
|
increment() {
|
|
14
13
|
this.count++;
|
|
15
14
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref } from 'vue';
|
|
3
|
-
import { ivue } from 'ivue';
|
|
3
|
+
import { ivue, iref } from 'ivue';
|
|
4
4
|
|
|
5
5
|
type SpanRef = HTMLElement | null;
|
|
6
6
|
|
|
7
7
|
class Counter {
|
|
8
8
|
constructor(public span: SpanRef) {}
|
|
9
|
-
count =
|
|
9
|
+
count = iref(0);
|
|
10
10
|
increment() {
|
|
11
11
|
this.count++;
|
|
12
12
|
(this.span as HTMLElement).innerHTML = String(this.count + 1);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { ivue } from 'ivue';
|
|
2
|
+
import { ivue, iref } from 'ivue';
|
|
4
3
|
|
|
5
4
|
class Counter {
|
|
6
|
-
count =
|
|
7
|
-
span =
|
|
5
|
+
count = iref(0);
|
|
6
|
+
span = iref<HTMLElement | null>(null);
|
|
8
7
|
increment() {
|
|
9
8
|
this.count++;
|
|
10
9
|
(this.span as HTMLElement).innerHTML = String(this.count + 1);
|
|
@@ -17,7 +16,7 @@ const { span } = counter.toRefs(['span']);
|
|
|
17
16
|
* Or you can use `const { span } = counter.toRefs();`
|
|
18
17
|
* but `const { span } = counter.toRefs(['span']);` is more performant
|
|
19
18
|
* because we are only looping through 1 property instead of all of them.
|
|
20
|
-
*/
|
|
19
|
+
*/
|
|
21
20
|
</script>
|
|
22
21
|
<template>
|
|
23
22
|
<a href="javascript:void(0)" @click="() => counter.increment()">Increment</a>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { onMounted
|
|
3
|
-
import { ivue } from 'ivue';
|
|
2
|
+
import { onMounted } from 'vue';
|
|
3
|
+
import { ivue, iref } from 'ivue';
|
|
4
4
|
|
|
5
5
|
class Counter {
|
|
6
6
|
init() {
|
|
@@ -8,7 +8,7 @@ class Counter {
|
|
|
8
8
|
this.count = 100;
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
count =
|
|
11
|
+
count = iref(0);
|
|
12
12
|
increment() {
|
|
13
13
|
this.count++;
|
|
14
14
|
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { ivue } from 'ivue';
|
|
2
|
+
import { watch } from 'vue';
|
|
3
|
+
import { ivue, iref } from 'ivue';
|
|
4
4
|
|
|
5
5
|
class Counter {
|
|
6
6
|
init() {
|
|
7
7
|
/** Note that we use this.count as a reactive prop in the watch() function */
|
|
8
|
-
watch(
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
watch(
|
|
9
|
+
() => this.count,
|
|
10
|
+
(newCount) => {
|
|
11
|
+
if (newCount === 5) {
|
|
12
|
+
alert('You already clicked 5 times!');
|
|
13
|
+
}
|
|
11
14
|
}
|
|
12
|
-
|
|
15
|
+
);
|
|
13
16
|
}
|
|
14
|
-
count =
|
|
17
|
+
count = iref(0);
|
|
15
18
|
increment() {
|
|
16
19
|
this.count++;
|
|
17
20
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { ivue } from 'ivue';
|
|
2
|
+
import { ivue, iref } from 'ivue';
|
|
4
3
|
|
|
5
4
|
interface CounterProps {
|
|
6
5
|
initialCount: number;
|
|
@@ -11,7 +10,7 @@ class Counter {
|
|
|
11
10
|
constructor(public props: CounterProps) {
|
|
12
11
|
this.count = this.props.initialCount;
|
|
13
12
|
}
|
|
14
|
-
count =
|
|
13
|
+
count = iref(0);
|
|
15
14
|
increment() {
|
|
16
15
|
this.count++;
|
|
17
16
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { ivue } from 'ivue';
|
|
2
|
+
import { ivue, iref } from 'ivue';
|
|
4
3
|
|
|
5
4
|
interface CounterProps {
|
|
6
5
|
initialCount: number;
|
|
@@ -17,7 +16,7 @@ class Counter {
|
|
|
17
16
|
constructor(public props: CounterProps, public emit: CounterEmits) {
|
|
18
17
|
this.count = this.props.initialCount;
|
|
19
18
|
}
|
|
20
|
-
count =
|
|
19
|
+
count = iref(0);
|
|
21
20
|
increment() {
|
|
22
21
|
this.count++;
|
|
23
22
|
this.emit('increment', this.count);
|
|
@@ -25,7 +24,7 @@ class Counter {
|
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
/**
|
|
28
|
-
* NOTICE that: ivue(ClassName, ...args) uses TypeScript to infer
|
|
27
|
+
* NOTICE that: ivue(ClassName, ...args) uses TypeScript to infer
|
|
29
28
|
* the correct argument types that you need to pass to the constructor.
|
|
30
29
|
*/
|
|
31
30
|
const counter = ivue(Counter, props, emit);
|
package/docs/docs/pages/api.md
CHANGED
|
@@ -26,6 +26,14 @@ Core `ivue(className, ...args)` initializer is able to infer and validate the co
|
|
|
26
26
|
|
|
27
27
|
**Returns:** `<IVue<T>>` or `ivue` `reactive()` object of an `AnyClass` class with flattened (de-Refed) `Refs` and `ComputedRefs` as properties.
|
|
28
28
|
|
|
29
|
+
### iref()
|
|
30
|
+
|
|
31
|
+
Create a regular `vue` Ref but cast the type to the internal unreactive type, because properties auto-unwrap in `reactive()` object that is being created by `ivue` upon initialization.
|
|
32
|
+
|
|
33
|
+
### iuse()
|
|
34
|
+
|
|
35
|
+
This function unwraps the type of any composable return to the bare values without `.value`, because properties auto-unwrap in `reactive()` object that is being created by `ivue` upon initialization.
|
|
36
|
+
|
|
29
37
|
### .init()
|
|
30
38
|
|
|
31
39
|
---
|
|
@@ -34,11 +42,11 @@ Core `ivue(className, ...args)` initializer is able to infer and validate the co
|
|
|
34
42
|
`init()` has access to the reactive state of the object via `this`.
|
|
35
43
|
|
|
36
44
|
:::warning NOTICE
|
|
37
|
-
`.init()` method
|
|
45
|
+
`.init()` method has no arguments and you should never need to run this method manually.
|
|
38
46
|
:::
|
|
39
47
|
|
|
40
48
|
:::tip NEED ASYNC/AWAIT?
|
|
41
|
-
|
|
49
|
+
Use `async init()` if you need `await` functionality.
|
|
42
50
|
:::
|
|
43
51
|
|
|
44
52
|
**Returns:** `void | Promise<void>`
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
aside: false
|
|
3
3
|
---
|
|
4
4
|
# Source code
|
|
5
|
-
Or [Browse the source code on GitHub](https://github.com/infinite-system/ivue/blob/main/src/
|
|
5
|
+
Or [Browse the source code on GitHub](https://github.com/infinite-system/ivue/blob/main/src/ivue.ts)
|
|
6
6
|
|
|
7
7
|
## Install by Copying
|
|
8
8
|
|
|
@@ -14,5 +14,5 @@ This installation path is recommended only if you quickly want to tinker with th
|
|
|
14
14
|
:::
|
|
15
15
|
|
|
16
16
|
:::code-group
|
|
17
|
-
<<< ../../../src/
|
|
17
|
+
<<< ../../../src/ivue.ts{ts:line-numbers} [ivue.ts]
|
|
18
18
|
:::
|
|
@@ -23,9 +23,9 @@ pnpm i ivue
|
|
|
23
23
|
:::details Click to expand the latest `ivue` source code to copy
|
|
24
24
|
|
|
25
25
|
:::code-group
|
|
26
|
-
<<< ../../../src/
|
|
26
|
+
<<< ../../../src/ivue.ts{ts:line-numbers} [ivue.ts]
|
|
27
27
|
:::
|
|
28
|
-
Or [Copy from GitHub](https://github.com/infinite-system/ivue/blob/main/src/
|
|
28
|
+
Or [Copy from GitHub](https://github.com/infinite-system/ivue/blob/main/src/ivue.ts)
|
|
29
29
|
|
|
30
30
|
::: tip NOTE
|
|
31
31
|
This installation path is recommended only if you quickly want to tinker with the internals of ivue, as you won't be getting the latest updates. Also note that this code comes from github `main` branch latest which might also be in beta and not fully published to `npm`.
|
|
@@ -15,8 +15,11 @@ class Counter {
|
|
|
15
15
|
/** ✅ Properly declared unwrapped composable. */
|
|
16
16
|
mouse: UseMouse;
|
|
17
17
|
|
|
18
|
+
/** ✅ Properly declared DOM Ref. */
|
|
19
|
+
spanElementRef = iref<HTMLElement | null>(null); // ✅ Custom declared type of HTMLElement or null
|
|
20
|
+
|
|
18
21
|
constructor(public props: CounterProps, public emit: CounterEmit) {
|
|
19
|
-
this.mouse = useMouse()
|
|
22
|
+
this.mouse = iuse(useMouse()); // ✅ Properly declared auto-unwrapped composable.
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
/** ✅ Properly declared init function. */
|
|
@@ -34,16 +37,16 @@ class Counter {
|
|
|
34
37
|
})
|
|
35
38
|
}
|
|
36
39
|
/**
|
|
37
|
-
* Use
|
|
40
|
+
* Use iref() for the property to be auto cast to number
|
|
38
41
|
* because refs auto-unwrap inside reactive().
|
|
39
42
|
*/
|
|
40
|
-
count =
|
|
43
|
+
count = iref(0); // ✅ inferred type -> number
|
|
41
44
|
|
|
42
45
|
/**
|
|
43
|
-
* Use
|
|
46
|
+
* Use iref() for the property to be auto cast to number
|
|
44
47
|
* because refs auto-unwrap inside reactive().
|
|
45
48
|
*/
|
|
46
|
-
timesClicked =
|
|
49
|
+
timesClicked = iref(0); // ✅ inferred type -> number
|
|
47
50
|
|
|
48
51
|
/** ✅ Properly declared function (not arrow function). */
|
|
49
52
|
increment() {
|
|
@@ -66,6 +69,8 @@ class Counter {
|
|
|
66
69
|
return this.count * 2;
|
|
67
70
|
}
|
|
68
71
|
}
|
|
72
|
+
|
|
73
|
+
const counter = ivue(Counter, props, emit);
|
|
69
74
|
```
|
|
70
75
|
|
|
71
76
|
### Use ref() for properties
|
|
@@ -47,9 +47,9 @@ Utility Types help to achieve the rest of `ivue` capabilities
|
|
|
47
47
|
|
|
48
48
|
:::details Click to see the whole latest `ivue` source code from github main branch below:
|
|
49
49
|
:::code-group
|
|
50
|
-
<<< ../../../src/
|
|
50
|
+
<<< ../../../src/ivue.ts{ts:line-numbers} [ivue.ts]
|
|
51
51
|
:::
|
|
52
|
-
Or [See on GitHub](https://github.com/infinite-system/ivue/blob/main/src/
|
|
52
|
+
Or [See on GitHub](https://github.com/infinite-system/ivue/blob/main/src/ivue.ts)
|
|
53
53
|
|
|
54
54
|
## 100% Vue 3 Compatible
|
|
55
55
|
`.toRefs()` allows the object to be converted to Vue 3 native composable structure with full `.value`s, so it can interoperate with native composables if needed. `.toRefs()` is also often used to get refs for `v-bind()` in css styles.
|
package/docs/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"build": "vitepress build docs",
|
|
8
8
|
"serve": "vitepress serve docs",
|
|
9
9
|
"preview": "vitepress build docs && vitepress serve docs",
|
|
10
|
-
"deploy": "node scripts/gh-pages-deploy.js"
|
|
10
|
+
"deploy": "node scripts/gh-pages-deploy.js"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"eslint-plugin-import": "^2.29.1",
|
|
19
19
|
"eslint-plugin-vue": "^9.14.1",
|
|
20
20
|
"execa": "^8.0.0",
|
|
21
|
-
"ivue": "^1.0
|
|
21
|
+
"ivue": "^1.1.0",
|
|
22
22
|
"typescript": "^4.5.4",
|
|
23
23
|
"vite-plugin-dynamic-import": "^1.5.0",
|
|
24
24
|
"vite-tsconfig-paths": "^4.3.2",
|
package/package.json
CHANGED
package/src/ivue.ts
CHANGED
|
@@ -40,9 +40,11 @@ export type IVueRefs<T = any> = {
|
|
|
40
40
|
* Unwraps the returned Refs of composable method T to a reactive type definition.
|
|
41
41
|
*/
|
|
42
42
|
export type UseComposableReturn<T extends Object> = {
|
|
43
|
-
[K in keyof T]: T[K] extends { value: any }
|
|
44
|
-
? T[K]['value'] // Handle Ref
|
|
45
|
-
|
|
43
|
+
[K in keyof T]: T[K] extends { value: any } // Handle Ref
|
|
44
|
+
? T[K]['value'] extends { value: any } // Handle Double Wrapped Ref: Most often a Ref that is inside a Computed Ref
|
|
45
|
+
? T[K]['value']['value'] // Return doubly wrapped internal value
|
|
46
|
+
: T[K]['value'] // Handle Standard Ref or Computed Ref
|
|
47
|
+
: T[K]; // Handle non Ref property or method
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
export type UseComposable<T extends (...args: any[]) => any> =
|