vue-to-reactive 1.0.2 → 1.0.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/README.github.md +53 -0
- package/README.npm.md +53 -0
- package/banner.svg +8 -12
- package/package.json +4 -3
package/README.github.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="banner.svg" alt="vue-to-reactive" width="100%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">vue-to-reactive</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">A Vue 3 composition API utility that converts a ref into a reactive proxy object, enabling direct property access without .value while maintaining full reactivity.</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/vue-to-reactive"><img src="https://img.shields.io/npm/v/vue-to-reactive.svg" alt="npm version" /></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/vue-to-reactive"><img src="https://img.shields.io/npm/dm/vue-to-reactive.svg" alt="npm downloads" /></a>
|
|
12
|
+
<a href="https://github.com/vuefrag/vue-to-reactive/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/vue-to-reactive.svg" alt="license" /></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install vue-to-reactive
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { toReactive } from 'vue-to-reactive';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Converts ref to reactive. Also made possible to create a "swapable" reactive object.
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { toReactive } from 'vue-to-reactive'
|
|
32
|
+
import { ref } from 'vue'
|
|
33
|
+
|
|
34
|
+
const refState = ref({ foo: 'bar' })
|
|
35
|
+
|
|
36
|
+
console.log(refState.value.foo) // => 'bar'
|
|
37
|
+
|
|
38
|
+
const state = toReactive(refState) // <--
|
|
39
|
+
|
|
40
|
+
console.log(state.foo) // => 'bar'
|
|
41
|
+
|
|
42
|
+
refState.value = { bar: 'foo' }
|
|
43
|
+
|
|
44
|
+
console.log(state.foo) // => undefined
|
|
45
|
+
console.log(state.bar) // => 'foo'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
> Extracted from [VueUse](https://vueuse.org/) for standalone use.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT
|
package/README.npm.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="logo.svg" alt="vue-to-reactive" width="180" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">vue-to-reactive</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">A Vue 3 composition API utility that converts a ref into a reactive proxy object, enabling direct property access without .value while maintaining full reactivity.</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://www.npmjs.com/package/vue-to-reactive"><img src="https://img.shields.io/npm/v/vue-to-reactive.svg" alt="npm version" /></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/vue-to-reactive"><img src="https://img.shields.io/npm/dm/vue-to-reactive.svg" alt="npm downloads" /></a>
|
|
12
|
+
<a href="https://github.com/vuefrag/vue-to-reactive/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/vue-to-reactive.svg" alt="license" /></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install vue-to-reactive
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { toReactive } from 'vue-to-reactive';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Converts ref to reactive. Also made possible to create a "swapable" reactive object.
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { toReactive } from 'vue-to-reactive'
|
|
32
|
+
import { ref } from 'vue'
|
|
33
|
+
|
|
34
|
+
const refState = ref({ foo: 'bar' })
|
|
35
|
+
|
|
36
|
+
console.log(refState.value.foo) // => 'bar'
|
|
37
|
+
|
|
38
|
+
const state = toReactive(refState) // <--
|
|
39
|
+
|
|
40
|
+
console.log(state.foo) // => 'bar'
|
|
41
|
+
|
|
42
|
+
refState.value = { bar: 'foo' }
|
|
43
|
+
|
|
44
|
+
console.log(state.foo) // => undefined
|
|
45
|
+
console.log(state.bar) // => 'foo'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
> Extracted from [VueUse](https://vueuse.org/) for standalone use.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT
|
package/banner.svg
CHANGED
|
@@ -10,16 +10,16 @@
|
|
|
10
10
|
<rect width="1280" height="640" fill="url(#banner-bg)"/>
|
|
11
11
|
|
|
12
12
|
<!-- Decorative elements -->
|
|
13
|
-
<circle cx="
|
|
14
|
-
<circle cx="
|
|
13
|
+
<circle cx="200" cy="150" r="120" fill="#42b883" opacity="0.06"/>
|
|
14
|
+
<circle cx="1150" cy="500" r="100" fill="#42b883" opacity="0.06"/>
|
|
15
15
|
|
|
16
16
|
<!-- Top accent bar -->
|
|
17
17
|
<rect x="0" y="0" width="1280" height="8" fill="#42b883"/>
|
|
18
18
|
|
|
19
|
-
<!--
|
|
19
|
+
<!-- Vuefrag badge -->
|
|
20
20
|
<g transform="translate(80, 80)">
|
|
21
21
|
<rect width="140" height="50" rx="8" fill="#42b883"/>
|
|
22
|
-
<text x="70" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="22" font-weight="700" fill="white">
|
|
22
|
+
<text x="70" y="33" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="22" font-weight="700" fill="white">Vuefrag</text>
|
|
23
23
|
</g>
|
|
24
24
|
|
|
25
25
|
<!-- Package name -->
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
<!-- Install command -->
|
|
32
32
|
<g transform="translate(80, 420)">
|
|
33
|
-
<rect width="
|
|
33
|
+
<rect width="456" height="60" rx="8" fill="#0f172a"/>
|
|
34
34
|
<text x="20" y="40" font-family="ui-monospace, monospace" font-size="24" fill="#94a3b8">npm install</text>
|
|
35
35
|
<text x="200" y="40" font-family="ui-monospace, monospace" font-size="24" fill="#42b883">vue-to-reactive</text>
|
|
36
36
|
</g>
|
|
@@ -41,12 +41,8 @@
|
|
|
41
41
|
<text x="86" y="27" text-anchor="middle" font-family="system-ui, -apple-system, sans-serif" font-size="18" fill="#42b883">Reactivity</text>
|
|
42
42
|
</g>
|
|
43
43
|
|
|
44
|
-
<!--
|
|
45
|
-
<g
|
|
46
|
-
<
|
|
47
|
-
<polygon points="100,40 125,90 75,90" fill="#42b883" opacity="0.5"/>
|
|
44
|
+
<!-- Category icon (top right corner) -->
|
|
45
|
+
<g>
|
|
46
|
+
<circle cx="1080" cy="150" r="60" fill="none" stroke="#42b883" stroke-width="15"/><circle cx="1080" cy="150" r="25" fill="#42b883"/><path d="M1000 150h-20M1160 150h20M1080 70v-20M1080 230v20" stroke="#42b883" stroke-width="10" stroke-linecap="round"/>
|
|
48
47
|
</g>
|
|
49
|
-
|
|
50
|
-
<!-- Bottom text -->
|
|
51
|
-
<text x="1200" y="600" text-anchor="end" font-family="system-ui, -apple-system, sans-serif" font-size="18" fill="#64748b">Standalone VueUse function</text>
|
|
52
48
|
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-to-reactive",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Vue 3 utility converting ref to reactive proxy object",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "unbuild",
|
|
22
|
-
"prepublishOnly": "npm run build"
|
|
22
|
+
"prepublishOnly": "cp README.npm.md README.md && npm run build",
|
|
23
|
+
"postpublish": "cp README.github.md README.md"
|
|
23
24
|
},
|
|
24
25
|
"keywords": [
|
|
25
26
|
"vue",
|
|
@@ -58,4 +59,4 @@
|
|
|
58
59
|
"typescript": "^5.0.0",
|
|
59
60
|
"vue": "^3.4.0"
|
|
60
61
|
}
|
|
61
|
-
}
|
|
62
|
+
}
|