@pistachiojs/vue 0.1.1-dev.0 → 0.2.0-dev.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/index.d.ts +9 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
1
|
+
import { Ref, ShallowRef } from 'vue';
|
|
2
2
|
|
|
3
3
|
interface UseCounterOptions {
|
|
4
4
|
min?: number;
|
|
@@ -19,5 +19,12 @@ interface UseCounterReturn {
|
|
|
19
19
|
*/
|
|
20
20
|
declare function useCounter(initialValue?: number, options?: UseCounterOptions): UseCounterReturn;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Vue composable to track previous value of a state or prop.
|
|
24
|
+
* @param value - Value to track.
|
|
25
|
+
* @returns Previous value.
|
|
26
|
+
*/
|
|
27
|
+
declare function usePrevious<T>(value: Ref<T> | T): ShallowRef<T | undefined>;
|
|
28
|
+
|
|
29
|
+
export { useCounter, usePrevious };
|
|
23
30
|
export type { UseCounterOptions, UseCounterReturn };
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as
|
|
1
|
+
import{ref as s,shallowRef as c,isRef as l,watch as i}from"vue";function a(e,r,n){return Math.min(Math.max(e,r),n)}function v(e=0,r={}){const{min:n=-1/0,max:t=1/0}=r,u=s(a(e,n,t));return{count:u,increment:()=>{u.value=a(u.value+1,n,t)},decrement:()=>{u.value=a(u.value-1,n,t)},set:o=>{u.value=a(o,n,t)},reset:()=>{u.value=a(e,n,t)}}}function f(e){const r=c(void 0);let n=l(e)?e.value:e;return i(l(e)?e:()=>e,t=>{r.value=n,n=t},{flush:"sync"}),r}export{v as useCounter,f as usePrevious};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=require("vue");function a(e,r,u){return Math.min(Math.max(e,r),u)}function v(e=0,r={}){const{min:u=-1/0,max:n=1/0}=r,t=s.ref(a(e,u,n));return{count:t,increment:()=>{t.value=a(t.value+1,u,n)},decrement:()=>{t.value=a(t.value-1,u,n)},set:i=>{t.value=a(i,u,n)},reset:()=>{t.value=a(e,u,n)}}}function l(e){const r=s.shallowRef(void 0);let u=s.isRef(e)?e.value:e;return s.watch(s.isRef(e)?e:()=>e,n=>{r.value=u,u=n},{flush:"sync"}),r}exports.useCounter=v,exports.usePrevious=l;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pistachiojs/vue",
|
|
3
3
|
"description": "Vue composables built on top of @pistachiojs/core for reactive programming tasks",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0-dev.1",
|
|
5
5
|
"author": "Dirga Prakesha <dirga.prakesha@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|