@vitus-labs/hooks 1.2.1 → 1.2.3-alpha.56

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Vit Bokisch
3
+ Copyright (c) 2023-present Vit Bokisch
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @vitus-labs/hooks
2
+
3
+ Lightweight React hooks for common UI interactions.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@vitus-labs/hooks)](https://www.npmjs.com/package/@vitus-labs/hooks)
6
+ [![license](https://img.shields.io/npm/l/@vitus-labs/hooks)](https://github.com/vitus-labs/ui-system/blob/main/LICENSE)
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @vitus-labs/hooks
12
+ ```
13
+
14
+ ## Hooks
15
+
16
+ ### useHover
17
+
18
+ Tracks hover state with stable callback references.
19
+
20
+ ```tsx
21
+ import { useHover } from '@vitus-labs/hooks'
22
+
23
+ const MyComponent = () => {
24
+ const { hover, onMouseEnter, onMouseLeave } = useHover()
25
+
26
+ return (
27
+ <div
28
+ onMouseEnter={onMouseEnter}
29
+ onMouseLeave={onMouseLeave}
30
+ style={{ background: hover ? '#f0f0f0' : '#fff' }}
31
+ >
32
+ {hover ? 'Hovered' : 'Hover me'}
33
+ </div>
34
+ )
35
+ }
36
+ ```
37
+
38
+ **Parameters:**
39
+
40
+ | Param | Type | Default | Description |
41
+ | ----- | ---- | ------- | ----------- |
42
+ | initialValue | `boolean` | `false` | Initial hover state |
43
+
44
+ **Returns:** `{ hover: boolean, onMouseEnter: () => void, onMouseLeave: () => void }`
45
+
46
+ ### useWindowResize
47
+
48
+ Tracks viewport dimensions with throttled updates.
49
+
50
+ ```tsx
51
+ import { useWindowResize } from '@vitus-labs/hooks'
52
+
53
+ const Layout = () => {
54
+ const { width, height } = useWindowResize({
55
+ throttleDelay: 300,
56
+ onChange: ({ width }) => console.log('Width:', width),
57
+ })
58
+
59
+ return <div>Viewport: {width} x {height}</div>
60
+ }
61
+ ```
62
+
63
+ **Parameters:**
64
+
65
+ | Param | Type | Default | Description |
66
+ | ----- | ---- | ------- | ----------- |
67
+ | params.throttleDelay | `number` | `200` | Milliseconds between resize handler calls |
68
+ | params.onChange | `(sizes) => void` | — | Callback fired on each resize |
69
+ | initialValues.width | `number` | `0` | Initial width (useful for SSR) |
70
+ | initialValues.height | `number` | `0` | Initial height (useful for SSR) |
71
+
72
+ **Returns:** `{ width: number, height: number }`
73
+
74
+ ## Peer Dependencies
75
+
76
+ | Package | Version |
77
+ | ------- | ------- |
78
+ | react | >= 19 |
79
+ | @vitus-labs/core | * |
80
+
81
+ ## License
82
+
83
+ MIT
@@ -5386,7 +5386,7 @@ var drawChart = (function (exports) {
5386
5386
  </script>
5387
5387
  <script>
5388
5388
  /*<!--*/
5389
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"c659e169-1","name":"useHover.ts"},{"uid":"c659e169-3","name":"useWindowResize.ts"},{"uid":"c659e169-5","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"c659e169-1":{"renderedLength":324,"gzipLength":176,"brotliLength":0,"metaUid":"c659e169-0"},"c659e169-3":{"renderedLength":803,"gzipLength":330,"brotliLength":0,"metaUid":"c659e169-2"},"c659e169-5":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"c659e169-4"}},"nodeMetas":{"c659e169-0":{"id":"/src/useHover.ts","moduleParts":{"index.js":"c659e169-1"},"imported":[{"uid":"c659e169-6"}],"importedBy":[{"uid":"c659e169-4"}]},"c659e169-2":{"id":"/src/useWindowResize.ts","moduleParts":{"index.js":"c659e169-3"},"imported":[{"uid":"c659e169-6"},{"uid":"c659e169-7"}],"importedBy":[{"uid":"c659e169-4"}]},"c659e169-4":{"id":"/src/index.ts","moduleParts":{"index.js":"c659e169-5"},"imported":[{"uid":"c659e169-0"},{"uid":"c659e169-2"}],"importedBy":[],"isEntry":true},"c659e169-6":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"c659e169-0"},{"uid":"c659e169-2"}],"isExternal":true},"c659e169-7":{"id":"@vitus-labs/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"c659e169-2"}],"isExternal":true}},"env":{"rollup":"4.35.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
5389
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"1a8c7527-1","name":"useHover.ts"},{"uid":"1a8c7527-3","name":"useWindowResize.ts"},{"uid":"1a8c7527-5","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"1a8c7527-1":{"renderedLength":412,"gzipLength":260,"brotliLength":0,"metaUid":"1a8c7527-0"},"1a8c7527-3":{"renderedLength":1158,"gzipLength":543,"brotliLength":0,"metaUid":"1a8c7527-2"},"1a8c7527-5":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"1a8c7527-4"}},"nodeMetas":{"1a8c7527-0":{"id":"/src/useHover.ts","moduleParts":{"index.js":"1a8c7527-1"},"imported":[{"uid":"1a8c7527-6"}],"importedBy":[{"uid":"1a8c7527-4"}]},"1a8c7527-2":{"id":"/src/useWindowResize.ts","moduleParts":{"index.js":"1a8c7527-3"},"imported":[{"uid":"1a8c7527-7"},{"uid":"1a8c7527-6"}],"importedBy":[{"uid":"1a8c7527-4"}]},"1a8c7527-4":{"id":"/src/index.ts","moduleParts":{"index.js":"1a8c7527-5"},"imported":[{"uid":"1a8c7527-0"},{"uid":"1a8c7527-2"}],"importedBy":[],"isEntry":true},"1a8c7527-6":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"1a8c7527-0"},{"uid":"1a8c7527-2"}]},"1a8c7527-7":{"id":"@vitus-labs/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"1a8c7527-2"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
5390
5390
 
5391
5391
  const run = () => {
5392
5392
  const width = window.innerWidth;
package/lib/index.d.ts CHANGED
@@ -1,21 +1,31 @@
1
- declare type Sizes = {
2
- width: number;
3
- height: number;
4
- };
5
-
6
- export declare type UseHover = (initialValue?: boolean) => {
7
- hover: boolean;
8
- onMouseEnter: () => void;
9
- onMouseLeave: () => void;
10
- };
11
-
12
- export declare const useHover: UseHover;
13
-
14
- export declare type UseWindowResize = (params?: Partial<{
15
- throttleDelay: number;
16
- onChange: (params: Sizes) => void;
17
- }>, initialValues?: Partial<Sizes>) => Sizes;
18
-
19
- export declare const useWindowResize: UseWindowResize;
20
-
21
- export { }
1
+ //#region src/useHover.d.ts
2
+ type UseHover = (initialValue?: boolean) => {
3
+ hover: boolean;
4
+ onMouseEnter: () => void;
5
+ onMouseLeave: () => void;
6
+ };
7
+ /**
8
+ * Simple hover-state hook that returns a boolean plus stable
9
+ * `onMouseEnter`/`onMouseLeave` handlers ready to spread onto an element.
10
+ */
11
+ declare const useHover: UseHover;
12
+ //#endregion
13
+ //#region src/useWindowResize.d.ts
14
+ type Sizes = {
15
+ width: number;
16
+ height: number;
17
+ };
18
+ type UseWindowResize = (params?: Partial<{
19
+ throttleDelay: number;
20
+ onChange: (params: Sizes) => void;
21
+ }>, initialValues?: Partial<Sizes>) => Sizes;
22
+ /**
23
+ * Tracks the browser viewport size, throttled to avoid excessive re-renders.
24
+ * Reads `window.innerWidth`/`innerHeight` on mount and on every resize event.
25
+ * An optional `onChange` callback fires alongside state updates.
26
+ * Cleans up both the event listener and any pending throttled call on unmount.
27
+ */
28
+ declare const useWindowResize: UseWindowResize;
29
+ //#endregion
30
+ export { type UseHover, type UseWindowResize, useHover, useWindowResize };
31
+ //# sourceMappingURL=index.d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.d.ts","names":[],"sources":["../src/useHover.ts","../src/useWindowResize.ts"],"sourcesContent":[],"mappings":";KAEY,QAAA;EAAA,KAAA,EAAA,OAAQ;EAUd,YAWL,EAAA,GAAA,GAAA,IAXe;;;;;ACJhB;;cDIM,QCDiB,EDCP,QCDO;;;KARlB,KAAA;EDDO,KAAA,EAAA,MAAQ;EAUd,MAAA,EAAA,MAWL;;KCfW,eAAA,UAAZ,GACW;;EANN,QAAK,EAAA,CAAA,MAAA,EAQa,KARb,EAAA,GAAA,IAAA;AAKV,CAAA,CAAA,EAAY,aAAe,CAAf,EAKM,OALS,CAKD,KALC,CAAA,EAAA,GAMtB,KANsB;;;;;;;cAcrB,eARI,EAQa,eARb"}
package/lib/index.js CHANGED
@@ -1,40 +1,57 @@
1
- import { useState, useCallback, useEffect } from 'react';
2
- import { throttle } from '@vitus-labs/core';
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
+ import { throttle } from "@vitus-labs/core";
3
3
 
4
+ //#region src/useHover.ts
5
+ /**
6
+ * Simple hover-state hook that returns a boolean plus stable
7
+ * `onMouseEnter`/`onMouseLeave` handlers ready to spread onto an element.
8
+ */
4
9
  const useHover = (initial = false) => {
5
- const [hover, handleHover] = useState(initial);
6
- const setHover = useCallback(() => handleHover(true), []);
7
- const unsetHover = useCallback(() => handleHover(false), []);
8
- return {
9
- hover,
10
- onMouseEnter: setHover,
11
- onMouseLeave: unsetHover,
12
- };
10
+ const [hover, handleHover] = useState(initial);
11
+ return {
12
+ hover,
13
+ onMouseEnter: useCallback(() => handleHover(true), []),
14
+ onMouseLeave: useCallback(() => handleHover(false), [])
15
+ };
13
16
  };
14
17
 
18
+ //#endregion
19
+ //#region src/useWindowResize.ts
20
+ /**
21
+ * Tracks the browser viewport size, throttled to avoid excessive re-renders.
22
+ * Reads `window.innerWidth`/`innerHeight` on mount and on every resize event.
23
+ * An optional `onChange` callback fires alongside state updates.
24
+ * Cleans up both the event listener and any pending throttled call on unmount.
25
+ */
15
26
  const useWindowResize = ({ throttleDelay = 200, onChange } = {}, { width = 0, height = 0 } = {}) => {
16
- const [windowSize, setWindowSize] = useState({ width, height });
17
- const updateSizes = useCallback(() => {
18
- const sizes = {
19
- width: window.innerWidth,
20
- height: window.innerHeight,
21
- };
22
- setWindowSize(sizes);
23
- if (onChange)
24
- onChange(sizes);
25
- }, [onChange]);
26
- const handleResize = useCallback(throttle(updateSizes, throttleDelay), [
27
- onChange,
28
- ]);
29
- useEffect(() => {
30
- updateSizes();
31
- }, []);
32
- useEffect(() => {
33
- window.addEventListener('resize', handleResize, false);
34
- return () => window.removeEventListener('resize', handleResize, false);
35
- }, [updateSizes]);
36
- return windowSize;
27
+ const [windowSize, setWindowSize] = useState({
28
+ width,
29
+ height
30
+ });
31
+ const onChangeRef = useRef(onChange);
32
+ onChangeRef.current = onChange;
33
+ const updateSizes = useCallback(() => {
34
+ const sizes = {
35
+ width: window.innerWidth,
36
+ height: window.innerHeight
37
+ };
38
+ setWindowSize(sizes);
39
+ if (onChangeRef.current) onChangeRef.current(sizes);
40
+ }, []);
41
+ useEffect(() => {
42
+ updateSizes();
43
+ }, [updateSizes]);
44
+ useEffect(() => {
45
+ const throttled = throttle(updateSizes, throttleDelay);
46
+ window.addEventListener("resize", throttled, false);
47
+ return () => {
48
+ window.removeEventListener("resize", throttled, false);
49
+ throttled.cancel();
50
+ };
51
+ }, [updateSizes, throttleDelay]);
52
+ return windowSize;
37
53
  };
38
54
 
55
+ //#endregion
39
56
  export { useHover, useWindowResize };
40
- //# sourceMappingURL=index.js.map
57
+ //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.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, useCallback } from 'react'\nimport { throttle } from '@vitus-labs/core'\n\ntype Sizes = {\n width: number\n height: number\n}\n\nexport type UseWindowResize = (\n params?: Partial<{\n throttleDelay: number\n onChange: (params: Sizes) => void\n }>,\n initialValues?: Partial<Sizes>,\n) => Sizes\n\nconst useWindowResize: UseWindowResize = (\n { throttleDelay = 200, onChange } = {},\n { width = 0, height = 0 } = {},\n) => {\n const [windowSize, setWindowSize] = useState({ width, height })\n\n const updateSizes = useCallback(() => {\n const sizes = {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n\n setWindowSize(sizes)\n if (onChange) onChange(sizes)\n }, [onChange])\n\n const handleResize = useCallback(throttle(updateSizes, throttleDelay), [\n onChange,\n ])\n\n useEffect(() => {\n updateSizes()\n }, [])\n\n useEffect(() => {\n window.addEventListener('resize', handleResize, false)\n\n return () => window.removeEventListener('resize', handleResize, false)\n }, [updateSizes])\n\n return windowSize\n}\n\nexport default useWindowResize\n"],"names":[],"mappings":";;;AAQA,MAAM,QAAQ,GAAa,CAAC,OAAO,GAAG,KAAK,KAAI;IAC7C,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC;AAE9C,IAAA,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;AACzD,IAAA,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IAE5D,OAAO;QACL,KAAK;AACL,QAAA,YAAY,EAAE,QAAQ;AACtB,QAAA,YAAY,EAAE,UAAU;KACzB;AACH;;ACHM,MAAA,eAAe,GAAoB,CACvC,EAAE,aAAa,GAAG,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,EACtC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,KAC5B;AACF,IAAA,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAE/D,IAAA,MAAM,WAAW,GAAG,WAAW,CAAC,MAAK;AACnC,QAAA,MAAM,KAAK,GAAG;YACZ,KAAK,EAAE,MAAM,CAAC,UAAU;YACxB,MAAM,EAAE,MAAM,CAAC,WAAW;SAC3B;QAED,aAAa,CAAC,KAAK,CAAC;AACpB,QAAA,IAAI,QAAQ;YAAE,QAAQ,CAAC,KAAK,CAAC;AAC/B,KAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;IAEd,MAAM,YAAY,GAAG,WAAW,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,EAAE;QACrE,QAAQ;AACT,KAAA,CAAC;IAEF,SAAS,CAAC,MAAK;AACb,QAAA,WAAW,EAAE;KACd,EAAE,EAAE,CAAC;IAEN,SAAS,CAAC,MAAK;QACb,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC;AAEtD,QAAA,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC;AACxE,KAAC,EAAE,CAAC,WAAW,CAAC,CAAC;AAEjB,IAAA,OAAO,UAAU;AACnB;;;;"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/useHover.ts","../src/useWindowResize.ts"],"sourcesContent":["import { useCallback, useState } from 'react'\n\nexport type UseHover = (initialValue?: boolean) => {\n hover: boolean\n onMouseEnter: () => void\n onMouseLeave: () => void\n}\n\n/**\n * Simple hover-state hook that returns a boolean plus stable\n * `onMouseEnter`/`onMouseLeave` handlers ready to spread onto an element.\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 { throttle } from '@vitus-labs/core'\nimport { useCallback, useEffect, useRef, useState } from 'react'\n\ntype Sizes = {\n width: number\n height: number\n}\n\nexport type UseWindowResize = (\n params?: Partial<{\n throttleDelay: number\n onChange: (params: Sizes) => void\n }>,\n initialValues?: Partial<Sizes>,\n) => Sizes\n\n/**\n * Tracks the browser viewport size, throttled to avoid excessive re-renders.\n * Reads `window.innerWidth`/`innerHeight` on mount and on every resize event.\n * An optional `onChange` callback fires alongside state updates.\n * Cleans up both the event listener and any pending throttled call on unmount.\n */\nconst useWindowResize: UseWindowResize = (\n { throttleDelay = 200, onChange } = {},\n { width = 0, height = 0 } = {},\n) => {\n const [windowSize, setWindowSize] = useState({ width, height })\n const onChangeRef = useRef(onChange)\n onChangeRef.current = onChange\n\n const updateSizes = useCallback(() => {\n const sizes = {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n\n setWindowSize(sizes)\n if (onChangeRef.current) onChangeRef.current(sizes)\n }, [])\n\n useEffect(() => {\n updateSizes()\n }, [updateSizes])\n\n useEffect(() => {\n const throttled = throttle(updateSizes, throttleDelay)\n window.addEventListener('resize', throttled, false)\n\n return () => {\n window.removeEventListener('resize', throttled, false)\n throttled.cancel()\n }\n }, [updateSizes, throttleDelay])\n\n return windowSize\n}\n\nexport default useWindowResize\n"],"mappings":";;;;;;;;AAYA,MAAM,YAAsB,UAAU,UAAU;CAC9C,MAAM,CAAC,OAAO,eAAe,SAAS,QAAQ;AAK9C,QAAO;EACL;EACA,cALe,kBAAkB,YAAY,KAAK,EAAE,EAAE,CAAC;EAMvD,cALiB,kBAAkB,YAAY,MAAM,EAAE,EAAE,CAAC;EAM3D;;;;;;;;;;;ACAH,MAAM,mBACJ,EAAE,gBAAgB,KAAK,aAAa,EAAE,EACtC,EAAE,QAAQ,GAAG,SAAS,MAAM,EAAE,KAC3B;CACH,MAAM,CAAC,YAAY,iBAAiB,SAAS;EAAE;EAAO;EAAQ,CAAC;CAC/D,MAAM,cAAc,OAAO,SAAS;AACpC,aAAY,UAAU;CAEtB,MAAM,cAAc,kBAAkB;EACpC,MAAM,QAAQ;GACZ,OAAO,OAAO;GACd,QAAQ,OAAO;GAChB;AAED,gBAAc,MAAM;AACpB,MAAI,YAAY,QAAS,aAAY,QAAQ,MAAM;IAClD,EAAE,CAAC;AAEN,iBAAgB;AACd,eAAa;IACZ,CAAC,YAAY,CAAC;AAEjB,iBAAgB;EACd,MAAM,YAAY,SAAS,aAAa,cAAc;AACtD,SAAO,iBAAiB,UAAU,WAAW,MAAM;AAEnD,eAAa;AACX,UAAO,oBAAoB,UAAU,WAAW,MAAM;AACtD,aAAU,QAAQ;;IAEnB,CAAC,aAAa,cAAc,CAAC;AAEhC,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitus-labs/hooks",
3
- "version": "1.2.1",
3
+ "version": "1.2.3-alpha.56+ebabe78",
4
4
  "license": "MIT",
5
5
  "author": "Vit Bokisch <vit@bokisch.cz>",
6
6
  "maintainers": [
@@ -18,38 +18,37 @@
18
18
  "homepage": "https://github.com/vitus-labs/ui-system/tree/master/packages/hooks",
19
19
  "description": "Universal styles",
20
20
  "scripts": {
21
- "dev": "yarn vl_stories",
22
- "prepublish": "yarn build",
23
- "build": "yarn vl_build",
24
- "build:watch": "yarn vl_build-watch",
25
- "lint:css": "stylelint src/*.ts src/*.tsx",
26
- "lint:ts": "eslint src/*",
27
- "lint": "yarn lint:css && yarn lint:ts",
28
- "test": "jest --runInBand",
29
- "test:coverage": "jest --runInBand --coverage",
30
- "test:watch": "jest --runInBand --watch",
31
- "cover": "coveralls < .coverage/lcov.info"
21
+ "dev": "bun run vl_stories",
22
+ "prepublish": "bun run build",
23
+ "build": "bun run vl_rolldown_build",
24
+ "build:watch": "bun run vl_rolldown_build-watch",
25
+ "lint": "biome check src/",
26
+ "test": "vitest run",
27
+ "test:coverage": "vitest run --coverage",
28
+ "test:watch": "vitest",
29
+ "cover": "coveralls < .coverage/lcov.info",
30
+ "typecheck": "tsc --noEmit"
32
31
  },
33
32
  "publishConfig": {
34
33
  "access": "public"
35
34
  },
36
35
  "repository": {
37
36
  "type": "git",
38
- "url": "git+https://github.com/vitus-labs/ui-system.git"
37
+ "url": "https://github.com/vitus-labs/ui-system",
38
+ "directory": "packages/hooks"
39
39
  },
40
40
  "bugs": {
41
41
  "url": "https://github.com/vitus-labs/ui-system/issues"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@vitus-labs/core": "*",
45
- "react": ">= 18"
45
+ "react": ">= 19"
46
46
  },
47
47
  "devDependencies": {
48
- "@vitus-labs/core": "1.2.1",
49
- "@vitus-labs/tools-babel": "^1.5.0-alpha.0",
50
- "@vitus-labs/tools-rollup": "^1.5.0-alpha.0",
51
- "@vitus-labs/tools-storybook": "^1.5.0-alpha.0",
52
- "@vitus-labs/tools-typescript": "^1.5.0-alpha.0"
48
+ "@vitus-labs/core": "1.2.3-alpha.56+ebabe78",
49
+ "@vitus-labs/tools-rolldown": "^1.5.2-alpha.1",
50
+ "@vitus-labs/tools-storybook": "^1.5.2-alpha.1",
51
+ "@vitus-labs/tools-typescript": "^1.5.2-alpha.1"
53
52
  },
54
- "gitHead": "0db619fef40033074f442cac995938627e5ae8cf"
53
+ "gitHead": "ebabe785e9e7b488bbe13d0772b1a3c74a886e2d"
55
54
  }
@@ -1,7 +0,0 @@
1
- import useHover from './useHover';
2
- import useWindowResize from './useWindowResize';
3
- import type { UseHover } from './useHover';
4
- import type { UseWindowResize } from './useWindowResize';
5
- export type { UseHover, UseWindowResize };
6
- export { useHover, useWindowResize };
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAA;AAEzC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAA"}
@@ -1,8 +0,0 @@
1
- export type UseHover = (initialValue?: boolean) => {
2
- hover: boolean;
3
- onMouseEnter: () => void;
4
- onMouseLeave: () => void;
5
- };
6
- declare const useHover: UseHover;
7
- export default useHover;
8
- //# sourceMappingURL=useHover.d.ts.map
@@ -1 +0,0 @@
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,11 +0,0 @@
1
- type Sizes = {
2
- width: number;
3
- height: number;
4
- };
5
- export type UseWindowResize = (params?: Partial<{
6
- throttleDelay: number;
7
- onChange: (params: Sizes) => void;
8
- }>, initialValues?: Partial<Sizes>) => Sizes;
9
- declare const useWindowResize: UseWindowResize;
10
- export default useWindowResize;
11
- //# sourceMappingURL=useWindowResize.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useWindowResize.d.ts","sourceRoot":"","sources":["../../src/useWindowResize.ts"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,KAAK,IAAI,CAAA;CAClC,CAAC,EACF,aAAa,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,KAC3B,KAAK,CAAA;AAEV,QAAA,MAAM,eAAe,EAAE,eA+BtB,CAAA;AAED,eAAe,eAAe,CAAA"}