@os-design/use-cursor-position 1.0.0 → 1.0.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/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -46,6 +46,7 @@ var useCursorPosition = function useCursorPosition() {
|
|
|
46
46
|
});
|
|
47
47
|
}, []);
|
|
48
48
|
(0, _useEvent["default"])(window, 'mousemove', mouseMoveHandler);
|
|
49
|
+
(0, _useEvent["default"])(window, 'touchstart', touchMoveHandler);
|
|
49
50
|
(0, _useEvent["default"])(window, 'touchmove', touchMoveHandler);
|
|
50
51
|
return cursorPosition;
|
|
51
52
|
};
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":["useCursorPosition","x","y","cursorPosition","setCursorPosition","mouseMoveHandler","e","clientX","clientY","touchMoveHandler","touches","length","window"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;;;;;;;;;AAOA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,GAAM;AAC9B,kBAA4C,qBAAyB;AACnEC,IAAAA,CAAC,EAAE,CADgE;AAEnEC,IAAAA,CAAC,EAAE;AAFgE,GAAzB,CAA5C;AAAA;AAAA,MAAOC,cAAP;AAAA,MAAuBC,iBAAvB;;AAKA,MAAMC,gBAAgB,GAAG,wBAAY,UAACC,CAAD,EAAmB;AACtDF,IAAAA,iBAAiB,CAAC;AAAEH,MAAAA,CAAC,EAAEK,CAAC,CAACC,OAAP;AAAgBL,MAAAA,CAAC,EAAEI,CAAC,CAACE;AAArB,KAAD,CAAjB;AACD,GAFwB,EAEtB,EAFsB,CAAzB;AAIA,MAAMC,gBAAgB,GAAG,wBAAY,UAACH,CAAD,EAAmB;AACtD,QAAIA,CAAC,CAACI,OAAF,CAAUC,MAAV,KAAqB,CAAzB,EAA4B;AAC5BP,IAAAA,iBAAiB,CAAC;AAAEH,MAAAA,CAAC,EAAEK,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaH,OAAlB;AAA2BL,MAAAA,CAAC,EAAEI,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaF;AAA3C,KAAD,CAAjB;AACD,GAHwB,EAGtB,EAHsB,CAAzB;AAKA,4BAASI,MAAT,EAAiB,WAAjB,EAA8BP,gBAA9B;AACA,4BAASO,MAAT,EAAiB,WAAjB,EAA8BH,gBAA9B;AAEA,SAAON,cAAP;AACD,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":["useCursorPosition","x","y","cursorPosition","setCursorPosition","mouseMoveHandler","e","clientX","clientY","touchMoveHandler","touches","length","window"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;;;;;;;;;AAOA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,GAAM;AAC9B,kBAA4C,qBAAyB;AACnEC,IAAAA,CAAC,EAAE,CADgE;AAEnEC,IAAAA,CAAC,EAAE;AAFgE,GAAzB,CAA5C;AAAA;AAAA,MAAOC,cAAP;AAAA,MAAuBC,iBAAvB;;AAKA,MAAMC,gBAAgB,GAAG,wBAAY,UAACC,CAAD,EAAmB;AACtDF,IAAAA,iBAAiB,CAAC;AAAEH,MAAAA,CAAC,EAAEK,CAAC,CAACC,OAAP;AAAgBL,MAAAA,CAAC,EAAEI,CAAC,CAACE;AAArB,KAAD,CAAjB;AACD,GAFwB,EAEtB,EAFsB,CAAzB;AAIA,MAAMC,gBAAgB,GAAG,wBAAY,UAACH,CAAD,EAAmB;AACtD,QAAIA,CAAC,CAACI,OAAF,CAAUC,MAAV,KAAqB,CAAzB,EAA4B;AAC5BP,IAAAA,iBAAiB,CAAC;AAAEH,MAAAA,CAAC,EAAEK,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaH,OAAlB;AAA2BL,MAAAA,CAAC,EAAEI,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaF;AAA3C,KAAD,CAAjB;AACD,GAHwB,EAGtB,EAHsB,CAAzB;AAKA,4BAASI,MAAT,EAAiB,WAAjB,EAA8BP,gBAA9B;AACA,4BAASO,MAAT,EAAiB,YAAjB,EAA+BH,gBAA/B;AACA,4BAASG,MAAT,EAAiB,WAAjB,EAA8BH,gBAA9B;AAEA,SAAON,cAAP;AACD,CApBD;;eAsBeH,iB","sourcesContent":["import { useCallback, useState } from 'react';\nimport useEvent from '@os-design/use-event';\n\nexport interface CursorPosition {\n x: number;\n y: number;\n}\n\nconst useCursorPosition = () => {\n const [cursorPosition, setCursorPosition] = useState<CursorPosition>({\n x: 0,\n y: 0,\n });\n\n const mouseMoveHandler = useCallback((e: MouseEvent) => {\n setCursorPosition({ x: e.clientX, y: e.clientY });\n }, []);\n\n const touchMoveHandler = useCallback((e: TouchEvent) => {\n if (e.touches.length === 0) return;\n setCursorPosition({ x: e.touches[0].clientX, y: e.touches[0].clientY });\n }, []);\n\n useEvent(window, 'mousemove', mouseMoveHandler);\n useEvent(window, 'touchstart', touchMoveHandler);\n useEvent(window, 'touchmove', touchMoveHandler);\n\n return cursorPosition;\n};\n\nexport default useCursorPosition;\n"],"file":"index.js"}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"names":["useCallback","useState","useEvent","useCursorPosition","cursorPosition","setCursorPosition","x","y","mouseMoveHandler","e","clientX","clientY","touchMoveHandler","touches","length","window"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,QAAtB,QAAsC,OAAtC;AACA,OAAOC,QAAP,MAAqB,sBAArB;;AAOA,MAAMC,iBAAiB,GAAG,MAAM;AAC9B,QAAM,CAACC,cAAD,EAAiBC,iBAAjB,IAAsCJ,QAAQ,CAAiB;AACnEK,IAAAA,CAAC,EAAE,CADgE;AAEnEC,IAAAA,CAAC,EAAE;AAFgE,GAAjB,CAApD;AAKA,QAAMC,gBAAgB,GAAGR,WAAW,CAAES,CAAD,IAAmB;AACtDJ,IAAAA,iBAAiB,CAAC;AAAEC,MAAAA,CAAC,EAAEG,CAAC,CAACC,OAAP;AAAgBH,MAAAA,CAAC,EAAEE,CAAC,CAACE;AAArB,KAAD,CAAjB;AACD,GAFmC,EAEjC,EAFiC,CAApC;AAIA,QAAMC,gBAAgB,GAAGZ,WAAW,CAAES,CAAD,IAAmB;AACtD,QAAIA,CAAC,CAACI,OAAF,CAAUC,MAAV,KAAqB,CAAzB,EAA4B;AAC5BT,IAAAA,iBAAiB,CAAC;AAAEC,MAAAA,CAAC,EAAEG,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaH,OAAlB;AAA2BH,MAAAA,CAAC,EAAEE,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaF;AAA3C,KAAD,CAAjB;AACD,GAHmC,EAGjC,EAHiC,CAApC;AAKAT,EAAAA,QAAQ,CAACa,MAAD,EAAS,WAAT,EAAsBP,gBAAtB,CAAR;AACAN,EAAAA,QAAQ,CAACa,MAAD,EAAS,WAAT,EAAsBH,gBAAtB,CAAR;AAEA,SAAOR,cAAP;AACD,
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"names":["useCallback","useState","useEvent","useCursorPosition","cursorPosition","setCursorPosition","x","y","mouseMoveHandler","e","clientX","clientY","touchMoveHandler","touches","length","window"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,QAAtB,QAAsC,OAAtC;AACA,OAAOC,QAAP,MAAqB,sBAArB;;AAOA,MAAMC,iBAAiB,GAAG,MAAM;AAC9B,QAAM,CAACC,cAAD,EAAiBC,iBAAjB,IAAsCJ,QAAQ,CAAiB;AACnEK,IAAAA,CAAC,EAAE,CADgE;AAEnEC,IAAAA,CAAC,EAAE;AAFgE,GAAjB,CAApD;AAKA,QAAMC,gBAAgB,GAAGR,WAAW,CAAES,CAAD,IAAmB;AACtDJ,IAAAA,iBAAiB,CAAC;AAAEC,MAAAA,CAAC,EAAEG,CAAC,CAACC,OAAP;AAAgBH,MAAAA,CAAC,EAAEE,CAAC,CAACE;AAArB,KAAD,CAAjB;AACD,GAFmC,EAEjC,EAFiC,CAApC;AAIA,QAAMC,gBAAgB,GAAGZ,WAAW,CAAES,CAAD,IAAmB;AACtD,QAAIA,CAAC,CAACI,OAAF,CAAUC,MAAV,KAAqB,CAAzB,EAA4B;AAC5BT,IAAAA,iBAAiB,CAAC;AAAEC,MAAAA,CAAC,EAAEG,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaH,OAAlB;AAA2BH,MAAAA,CAAC,EAAEE,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaF;AAA3C,KAAD,CAAjB;AACD,GAHmC,EAGjC,EAHiC,CAApC;AAKAT,EAAAA,QAAQ,CAACa,MAAD,EAAS,WAAT,EAAsBP,gBAAtB,CAAR;AACAN,EAAAA,QAAQ,CAACa,MAAD,EAAS,YAAT,EAAuBH,gBAAvB,CAAR;AACAV,EAAAA,QAAQ,CAACa,MAAD,EAAS,WAAT,EAAsBH,gBAAtB,CAAR;AAEA,SAAOR,cAAP;AACD,CApBD;;AAsBA,eAAeD,iBAAf","sourcesContent":["import { useCallback, useState } from 'react';\nimport useEvent from '@os-design/use-event';\n\nexport interface CursorPosition {\n x: number;\n y: number;\n}\n\nconst useCursorPosition = () => {\n const [cursorPosition, setCursorPosition] = useState<CursorPosition>({\n x: 0,\n y: 0,\n });\n\n const mouseMoveHandler = useCallback((e: MouseEvent) => {\n setCursorPosition({ x: e.clientX, y: e.clientY });\n }, []);\n\n const touchMoveHandler = useCallback((e: TouchEvent) => {\n if (e.touches.length === 0) return;\n setCursorPosition({ x: e.touches[0].clientX, y: e.touches[0].clientY });\n }, []);\n\n useEvent(window, 'mousemove', mouseMoveHandler);\n useEvent(window, 'touchstart', touchMoveHandler);\n useEvent(window, 'touchmove', touchMoveHandler);\n\n return cursorPosition;\n};\n\nexport default useCursorPosition;\n"],"file":"index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,QAAA,MAAM,iBAAiB,sBAoBtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@os-design/use-cursor-position",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": "git@gitlab.com:os-team/libs/os-design.git",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=17"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "218555e8ae76d6ff1a6013672f3192a516b24cb4"
|
|
37
37
|
}
|