@vitus-labs/hooks 0.66.0 → 0.67.0
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/LICENSE +1 -1
- package/lib/analysis/vitus-labs-hooks.browser.js.html +1 -1
- package/lib/analysis/vitus-labs-hooks.js.html +1 -1
- package/lib/analysis/vitus-labs-hooks.module.js.html +1 -1
- package/lib/analysis/vitus-labs-hooks.native.js.html +1 -1
- package/lib/index.d.ts +9 -7
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/useHover.d.ts +2 -1
- package/lib/types/useHover.d.ts.map +1 -0
- package/lib/types/useWindowResize.d.ts +2 -1
- package/lib/types/useWindowResize.d.ts.map +1 -0
- package/lib/vitus-labs-hooks.js +0 -2
- package/lib/vitus-labs-hooks.js.map +1 -1
- package/package.json +8 -8
package/LICENSE
CHANGED
|
@@ -6618,7 +6618,7 @@ var drawChart = (function (exports) {
|
|
|
6618
6618
|
</script>
|
|
6619
6619
|
<script>
|
|
6620
6620
|
/*<!--*/
|
|
6621
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-hooks.browser.js","children":[{"name":"src","children":[{"uid":"
|
|
6621
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-hooks.browser.js","children":[{"name":"src","children":[{"uid":"34c7-25","name":"useHover.ts"},{"uid":"34c7-27","name":"useWindowResize.ts"},{"uid":"34c7-29","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"34c7-25":{"renderedLength":333,"gzipLength":179,"brotliLength":0,"metaUid":"34c7-24"},"34c7-27":{"renderedLength":651,"gzipLength":282,"brotliLength":0,"metaUid":"34c7-26"},"34c7-29":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"34c7-28"}},"nodeMetas":{"34c7-24":{"id":"/src/useHover.ts","moduleParts":{"vitus-labs-hooks.browser.js":"34c7-25"},"imported":[{"uid":"34c7-30"}],"importedBy":[{"uid":"34c7-28"}]},"34c7-26":{"id":"/src/useWindowResize.ts","moduleParts":{"vitus-labs-hooks.browser.js":"34c7-27"},"imported":[{"uid":"34c7-30"},{"uid":"34c7-31"}],"importedBy":[{"uid":"34c7-28"}]},"34c7-28":{"id":"/src/index.ts","moduleParts":{"vitus-labs-hooks.browser.js":"34c7-29"},"imported":[{"uid":"34c7-24"},{"uid":"34c7-26"}],"importedBy":[],"isEntry":true},"34c7-30":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"34c7-24"},{"uid":"34c7-26"}],"isExternal":true},"34c7-31":{"id":"@vitus-labs/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"34c7-26"}],"isExternal":true}},"env":{"rollup":"3.9.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
6622
6622
|
|
|
6623
6623
|
const run = () => {
|
|
6624
6624
|
const width = window.innerWidth;
|
|
@@ -6618,7 +6618,7 @@ var drawChart = (function (exports) {
|
|
|
6618
6618
|
</script>
|
|
6619
6619
|
<script>
|
|
6620
6620
|
/*<!--*/
|
|
6621
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-hooks.js","children":[{"name":"src","children":[{"uid":"
|
|
6621
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-hooks.js","children":[{"name":"src","children":[{"uid":"34c7-1","name":"useHover.ts"},{"uid":"34c7-3","name":"useWindowResize.ts"},{"uid":"34c7-5","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"34c7-1":{"renderedLength":351,"gzipLength":184,"brotliLength":0,"metaUid":"34c7-0"},"34c7-3":{"renderedLength":668,"gzipLength":290,"brotliLength":0,"metaUid":"34c7-2"},"34c7-5":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"34c7-4"}},"nodeMetas":{"34c7-0":{"id":"/src/useHover.ts","moduleParts":{"vitus-labs-hooks.js":"34c7-1"},"imported":[{"uid":"34c7-6"}],"importedBy":[{"uid":"34c7-4"}]},"34c7-2":{"id":"/src/useWindowResize.ts","moduleParts":{"vitus-labs-hooks.js":"34c7-3"},"imported":[{"uid":"34c7-6"},{"uid":"34c7-7"}],"importedBy":[{"uid":"34c7-4"}]},"34c7-4":{"id":"/src/index.ts","moduleParts":{"vitus-labs-hooks.js":"34c7-5"},"imported":[{"uid":"34c7-0"},{"uid":"34c7-2"}],"importedBy":[],"isEntry":true},"34c7-6":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"34c7-0"},{"uid":"34c7-2"}],"isExternal":true},"34c7-7":{"id":"@vitus-labs/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"34c7-2"}],"isExternal":true}},"env":{"rollup":"3.9.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
6622
6622
|
|
|
6623
6623
|
const run = () => {
|
|
6624
6624
|
const width = window.innerWidth;
|
|
@@ -6618,7 +6618,7 @@ var drawChart = (function (exports) {
|
|
|
6618
6618
|
</script>
|
|
6619
6619
|
<script>
|
|
6620
6620
|
/*<!--*/
|
|
6621
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-hooks.module.js","children":[{"name":"src","children":[{"uid":"
|
|
6621
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-hooks.module.js","children":[{"name":"src","children":[{"uid":"34c7-9","name":"useHover.ts"},{"uid":"34c7-11","name":"useWindowResize.ts"},{"uid":"34c7-13","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"34c7-9":{"renderedLength":333,"gzipLength":179,"brotliLength":0,"metaUid":"34c7-8"},"34c7-11":{"renderedLength":651,"gzipLength":282,"brotliLength":0,"metaUid":"34c7-10"},"34c7-13":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"34c7-12"}},"nodeMetas":{"34c7-8":{"id":"/src/useHover.ts","moduleParts":{"vitus-labs-hooks.module.js":"34c7-9"},"imported":[{"uid":"34c7-14"}],"importedBy":[{"uid":"34c7-12"}]},"34c7-10":{"id":"/src/useWindowResize.ts","moduleParts":{"vitus-labs-hooks.module.js":"34c7-11"},"imported":[{"uid":"34c7-14"},{"uid":"34c7-15"}],"importedBy":[{"uid":"34c7-12"}]},"34c7-12":{"id":"/src/index.ts","moduleParts":{"vitus-labs-hooks.module.js":"34c7-13"},"imported":[{"uid":"34c7-8"},{"uid":"34c7-10"}],"importedBy":[],"isEntry":true},"34c7-14":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"34c7-8"},{"uid":"34c7-10"}],"isExternal":true},"34c7-15":{"id":"@vitus-labs/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"34c7-10"}],"isExternal":true}},"env":{"rollup":"3.9.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
6622
6622
|
|
|
6623
6623
|
const run = () => {
|
|
6624
6624
|
const width = window.innerWidth;
|
|
@@ -6618,7 +6618,7 @@ var drawChart = (function (exports) {
|
|
|
6618
6618
|
</script>
|
|
6619
6619
|
<script>
|
|
6620
6620
|
/*<!--*/
|
|
6621
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-hooks.native.js","children":[{"name":"src","children":[{"uid":"
|
|
6621
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-hooks.native.js","children":[{"name":"src","children":[{"uid":"34c7-17","name":"useHover.ts"},{"uid":"34c7-19","name":"useWindowResize.ts"},{"uid":"34c7-21","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"34c7-17":{"renderedLength":333,"gzipLength":179,"brotliLength":0,"metaUid":"34c7-16"},"34c7-19":{"renderedLength":651,"gzipLength":282,"brotliLength":0,"metaUid":"34c7-18"},"34c7-21":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"34c7-20"}},"nodeMetas":{"34c7-16":{"id":"/src/useHover.ts","moduleParts":{"vitus-labs-hooks.native.js":"34c7-17"},"imported":[{"uid":"34c7-22"}],"importedBy":[{"uid":"34c7-20"}]},"34c7-18":{"id":"/src/useWindowResize.ts","moduleParts":{"vitus-labs-hooks.native.js":"34c7-19"},"imported":[{"uid":"34c7-22"},{"uid":"34c7-23"}],"importedBy":[{"uid":"34c7-20"}]},"34c7-20":{"id":"/src/index.ts","moduleParts":{"vitus-labs-hooks.native.js":"34c7-21"},"imported":[{"uid":"34c7-16"},{"uid":"34c7-18"}],"importedBy":[],"isEntry":true},"34c7-22":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"34c7-16"},{"uid":"34c7-18"}],"isExternal":true},"34c7-23":{"id":"@vitus-labs/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"34c7-18"}],"isExternal":true}},"env":{"rollup":"3.9.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
6622
6622
|
|
|
6623
6623
|
const run = () => {
|
|
6624
6624
|
const width = window.innerWidth;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
declare type UseHover = (initialValue?: boolean) => {
|
|
1
|
+
export declare type UseHover = (initialValue?: boolean) => {
|
|
2
2
|
hover: boolean;
|
|
3
3
|
onMouseEnter: () => void;
|
|
4
4
|
onMouseLeave: () => void;
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
export declare const useHover: UseHover;
|
|
8
|
+
|
|
9
|
+
export declare type UseWindowResize = (throttleDelay?: number, initialValues?: Partial<{
|
|
9
10
|
width: number;
|
|
10
11
|
height: number;
|
|
11
12
|
}>) => {
|
|
12
13
|
width: number;
|
|
13
14
|
height: number;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
export declare const useWindowResize: UseWindowResize;
|
|
18
|
+
|
|
19
|
+
export { }
|
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,eAAe,EAAE,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEpE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAA;AAEzC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAA"}
|
package/lib/types/useHover.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type UseHover = (initialValue?: boolean) => {
|
|
2
2
|
hover: boolean;
|
|
3
3
|
onMouseEnter: () => void;
|
|
4
4
|
onMouseLeave: () => void;
|
|
5
5
|
};
|
|
6
6
|
declare const useHover: UseHover;
|
|
7
7
|
export default useHover;
|
|
8
|
+
//# sourceMappingURL=useHover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHover.d.ts","sourceRoot":"","sources":["../../src/useHover.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK;IACjD,KAAK,EAAE,OAAO,CAAA;IACd,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,YAAY,EAAE,MAAM,IAAI,CAAA;CACzB,CAAA;AAED,QAAA,MAAM,QAAQ,EAAE,QAWf,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type UseWindowResize = (throttleDelay?: number, initialValues?: Partial<{
|
|
2
2
|
width: number;
|
|
3
3
|
height: number;
|
|
4
4
|
}>) => {
|
|
@@ -7,3 +7,4 @@ export declare type UseWindowResize = (throttleDelay?: number, initialValues?: P
|
|
|
7
7
|
};
|
|
8
8
|
declare const useWindowResize: UseWindowResize;
|
|
9
9
|
export default useWindowResize;
|
|
10
|
+
//# sourceMappingURL=useWindowResize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWindowResize.d.ts","sourceRoot":"","sources":["../../src/useWindowResize.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GAAG,CAC5B,aAAa,CAAC,EAAE,MAAM,EACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAC,KACC;IACH,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,QAAA,MAAM,eAAe,EAAE,eAwBtB,CAAA;AAED,eAAe,eAAe,CAAA"}
|
package/lib/vitus-labs-hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitus-labs-hooks.js","sources":["../src/useHover.ts","../src/useWindowResize.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport type UseHover = (initialValue?: boolean) => {\n hover: boolean\n onMouseEnter: () => void\n onMouseLeave: () => void\n}\n\nconst useHover: UseHover = (initial = false) => {\n const [hover, handleHover] = useState(initial)\n\n const setHover = useCallback(() => handleHover(true), [])\n const unsetHover = useCallback(() => handleHover(false), [])\n\n return {\n hover,\n onMouseEnter: setHover,\n onMouseLeave: unsetHover,\n }\n}\n\nexport default useHover\n","import { useState, useEffect } from 'react'\nimport { throttle } from '@vitus-labs/core'\n\nexport type UseWindowResize = (\n throttleDelay?: number,\n initialValues?: Partial<{\n width: number\n height: number\n }>\n) => {\n width: number\n height: number\n}\n\nconst useWindowResize: UseWindowResize = (\n throttleDelay = 200,\n { width = 0, height = 0 } = {}\n) => {\n const [windowSize, setWindowSize] = useState({ width, height })\n\n useEffect(() => {\n const getSize = () => ({\n width: window.innerWidth,\n height: window.innerHeight,\n })\n\n setWindowSize(getSize())\n\n const handleResize = throttle(() => {\n setWindowSize(getSize())\n }, throttleDelay)\n\n window.addEventListener('resize', handleResize, false)\n\n return () => window.removeEventListener('resize', handleResize, false)\n }, [throttleDelay])\n\n return windowSize\n}\n\nexport default useWindowResize\n"],"names":["useState","useCallback","useEffect","throttle"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vitus-labs-hooks.js","sources":["../src/useHover.ts","../src/useWindowResize.ts"],"sourcesContent":["import { useState, useCallback } from 'react'\n\nexport type UseHover = (initialValue?: boolean) => {\n hover: boolean\n onMouseEnter: () => void\n onMouseLeave: () => void\n}\n\nconst useHover: UseHover = (initial = false) => {\n const [hover, handleHover] = useState(initial)\n\n const setHover = useCallback(() => handleHover(true), [])\n const unsetHover = useCallback(() => handleHover(false), [])\n\n return {\n hover,\n onMouseEnter: setHover,\n onMouseLeave: unsetHover,\n }\n}\n\nexport default useHover\n","import { useState, useEffect } from 'react'\nimport { throttle } from '@vitus-labs/core'\n\nexport type UseWindowResize = (\n throttleDelay?: number,\n initialValues?: Partial<{\n width: number\n height: number\n }>\n) => {\n width: number\n height: number\n}\n\nconst useWindowResize: UseWindowResize = (\n throttleDelay = 200,\n { width = 0, height = 0 } = {}\n) => {\n const [windowSize, setWindowSize] = useState({ width, height })\n\n useEffect(() => {\n const getSize = () => ({\n width: window.innerWidth,\n height: window.innerHeight,\n })\n\n setWindowSize(getSize())\n\n const handleResize = throttle(() => {\n setWindowSize(getSize())\n }, throttleDelay)\n\n window.addEventListener('resize', handleResize, false)\n\n return () => window.removeEventListener('resize', handleResize, false)\n }, [throttleDelay])\n\n return windowSize\n}\n\nexport default useWindowResize\n"],"names":["useState","useCallback","useEffect","throttle"],"mappings":";;;;;AAQA,MAAM,QAAQ,GAAa,CAAC,OAAO,GAAG,KAAK,KAAI;IAC7C,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,GAAGA,cAAQ,CAAC,OAAO,CAAC,CAAA;AAE9C,IAAA,MAAM,QAAQ,GAAGC,iBAAW,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;AACzD,IAAA,MAAM,UAAU,GAAGA,iBAAW,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,E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itus-labs-hooks.module.js": "./lib/vitus-labs-hooks.browser.js"
|
|
14
14
|
},
|
|
15
15
|
"react-native": "lib/vitus-labs-hooks.native.js",
|
|
16
|
-
"
|
|
16
|
+
"types": "lib/index.d.ts",
|
|
17
17
|
"files": [
|
|
18
18
|
"lib/"
|
|
19
19
|
],
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"react": ">= 16.8"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@vitus-labs/core": "^0.
|
|
51
|
-
"@vitus-labs/tools-babel": "^0.
|
|
52
|
-
"@vitus-labs/tools-rollup": "^0.
|
|
53
|
-
"@vitus-labs/tools-storybook": "^0.
|
|
54
|
-
"@vitus-labs/tools-typescript": "^0.
|
|
50
|
+
"@vitus-labs/core": "^0.67.0",
|
|
51
|
+
"@vitus-labs/tools-babel": "^0.40.0",
|
|
52
|
+
"@vitus-labs/tools-rollup": "^0.40.0",
|
|
53
|
+
"@vitus-labs/tools-storybook": "^0.40.0",
|
|
54
|
+
"@vitus-labs/tools-typescript": "^0.40.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "ed15994876bd59638d12ab0e671958df4f4b4e56"
|
|
57
57
|
}
|