@os-design/use-cursor-position 1.0.6 → 1.0.7

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 CHANGED
@@ -4,34 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  var _react = require("react");
9
-
10
8
  var _useEvent = _interopRequireDefault(require("@os-design/use-event"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
-
16
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
-
18
12
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
19
-
20
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
21
-
22
14
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
23
-
24
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
-
26
16
  var useCursorPosition = function useCursorPosition() {
27
17
  var _useState = (0, _react.useState)({
28
- x: 0,
29
- y: 0
30
- }),
31
- _useState2 = _slicedToArray(_useState, 2),
32
- cursorPosition = _useState2[0],
33
- setCursorPosition = _useState2[1];
34
-
18
+ x: 0,
19
+ y: 0
20
+ }),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ cursorPosition = _useState2[0],
23
+ setCursorPosition = _useState2[1];
35
24
  var mouseMoveHandler = (0, _react.useCallback)(function (e) {
36
25
  setCursorPosition({
37
26
  x: e.clientX,
@@ -50,7 +39,6 @@ var useCursorPosition = function useCursorPosition() {
50
39
  (0, _useEvent["default"])(window, 'touchmove', touchMoveHandler);
51
40
  return cursorPosition;
52
41
  };
53
-
54
42
  var _default = useCursorPosition;
55
43
  exports["default"] = _default;
56
44
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["useCursorPosition","useState","x","y","cursorPosition","setCursorPosition","mouseMoveHandler","useCallback","e","clientX","clientY","touchMoveHandler","touches","length","useEvent","window"],"sources":["../../src/index.ts"],"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"],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;;;;;;;;;AAOA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,GAAM;EAC9B,gBAA4C,IAAAC,eAAA,EAAyB;IACnEC,CAAC,EAAE,CADgE;IAEnEC,CAAC,EAAE;EAFgE,CAAzB,CAA5C;EAAA;EAAA,IAAOC,cAAP;EAAA,IAAuBC,iBAAvB;;EAKA,IAAMC,gBAAgB,GAAG,IAAAC,kBAAA,EAAY,UAACC,CAAD,EAAmB;IACtDH,iBAAiB,CAAC;MAAEH,CAAC,EAAEM,CAAC,CAACC,OAAP;MAAgBN,CAAC,EAAEK,CAAC,CAACE;IAArB,CAAD,CAAjB;EACD,CAFwB,EAEtB,EAFsB,CAAzB;EAIA,IAAMC,gBAAgB,GAAG,IAAAJ,kBAAA,EAAY,UAACC,CAAD,EAAmB;IACtD,IAAIA,CAAC,CAACI,OAAF,CAAUC,MAAV,KAAqB,CAAzB,EAA4B;IAC5BR,iBAAiB,CAAC;MAAEH,CAAC,EAAEM,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaH,OAAlB;MAA2BN,CAAC,EAAEK,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaF;IAA3C,CAAD,CAAjB;EACD,CAHwB,EAGtB,EAHsB,CAAzB;EAKA,IAAAI,oBAAA,EAASC,MAAT,EAAiB,WAAjB,EAA8BT,gBAA9B;EACA,IAAAQ,oBAAA,EAASC,MAAT,EAAiB,YAAjB,EAA+BJ,gBAA/B;EACA,IAAAG,oBAAA,EAASC,MAAT,EAAiB,WAAjB,EAA8BJ,gBAA9B;EAEA,OAAOP,cAAP;AACD,CApBD;;eAsBeJ,iB"}
1
+ {"version":3,"file":"index.js","names":["useCursorPosition","useState","x","y","cursorPosition","setCursorPosition","mouseMoveHandler","useCallback","e","clientX","clientY","touchMoveHandler","touches","length","useEvent","window"],"sources":["../../src/index.ts"],"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"],"mappings":";;;;;;AAAA;AACA;AAA4C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO5C,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiB,GAAS;EAC9B,gBAA4C,IAAAC,eAAQ,EAAiB;MACnEC,CAAC,EAAE,CAAC;MACJC,CAAC,EAAE;IACL,CAAC,CAAC;IAAA;IAHKC,cAAc;IAAEC,iBAAiB;EAKxC,IAAMC,gBAAgB,GAAG,IAAAC,kBAAW,EAAC,UAACC,CAAa,EAAK;IACtDH,iBAAiB,CAAC;MAAEH,CAAC,EAAEM,CAAC,CAACC,OAAO;MAAEN,CAAC,EAAEK,CAAC,CAACE;IAAQ,CAAC,CAAC;EACnD,CAAC,EAAE,EAAE,CAAC;EAEN,IAAMC,gBAAgB,GAAG,IAAAJ,kBAAW,EAAC,UAACC,CAAa,EAAK;IACtD,IAAIA,CAAC,CAACI,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;IAC5BR,iBAAiB,CAAC;MAAEH,CAAC,EAAEM,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,CAACH,OAAO;MAAEN,CAAC,EAAEK,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,CAACF;IAAQ,CAAC,CAAC;EACzE,CAAC,EAAE,EAAE,CAAC;EAEN,IAAAI,oBAAQ,EAACC,MAAM,EAAE,WAAW,EAAET,gBAAgB,CAAC;EAC/C,IAAAQ,oBAAQ,EAACC,MAAM,EAAE,YAAY,EAAEJ,gBAAgB,CAAC;EAChD,IAAAG,oBAAQ,EAACC,MAAM,EAAE,WAAW,EAAEJ,gBAAgB,CAAC;EAE/C,OAAOP,cAAc;AACvB,CAAC;AAAC,eAEaJ,iBAAiB;AAAA"}
package/dist/esm/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { useCallback, useState } from 'react';
2
2
  import useEvent from '@os-design/use-event';
3
-
4
3
  const useCursorPosition = () => {
5
4
  const [cursorPosition, setCursorPosition] = useState({
6
5
  x: 0,
@@ -24,6 +23,5 @@ const useCursorPosition = () => {
24
23
  useEvent(window, 'touchmove', touchMoveHandler);
25
24
  return cursorPosition;
26
25
  };
27
-
28
26
  export default useCursorPosition;
29
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["useCallback","useState","useEvent","useCursorPosition","cursorPosition","setCursorPosition","x","y","mouseMoveHandler","e","clientX","clientY","touchMoveHandler","touches","length","window"],"sources":["../../src/index.ts"],"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"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,QAAtB,QAAsC,OAAtC;AACA,OAAOC,QAAP,MAAqB,sBAArB;;AAOA,MAAMC,iBAAiB,GAAG,MAAM;EAC9B,MAAM,CAACC,cAAD,EAAiBC,iBAAjB,IAAsCJ,QAAQ,CAAiB;IACnEK,CAAC,EAAE,CADgE;IAEnEC,CAAC,EAAE;EAFgE,CAAjB,CAApD;EAKA,MAAMC,gBAAgB,GAAGR,WAAW,CAAES,CAAD,IAAmB;IACtDJ,iBAAiB,CAAC;MAAEC,CAAC,EAAEG,CAAC,CAACC,OAAP;MAAgBH,CAAC,EAAEE,CAAC,CAACE;IAArB,CAAD,CAAjB;EACD,CAFmC,EAEjC,EAFiC,CAApC;EAIA,MAAMC,gBAAgB,GAAGZ,WAAW,CAAES,CAAD,IAAmB;IACtD,IAAIA,CAAC,CAACI,OAAF,CAAUC,MAAV,KAAqB,CAAzB,EAA4B;IAC5BT,iBAAiB,CAAC;MAAEC,CAAC,EAAEG,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaH,OAAlB;MAA2BH,CAAC,EAAEE,CAAC,CAACI,OAAF,CAAU,CAAV,EAAaF;IAA3C,CAAD,CAAjB;EACD,CAHmC,EAGjC,EAHiC,CAApC;EAKAT,QAAQ,CAACa,MAAD,EAAS,WAAT,EAAsBP,gBAAtB,CAAR;EACAN,QAAQ,CAACa,MAAD,EAAS,YAAT,EAAuBH,gBAAvB,CAAR;EACAV,QAAQ,CAACa,MAAD,EAAS,WAAT,EAAsBH,gBAAtB,CAAR;EAEA,OAAOR,cAAP;AACD,CApBD;;AAsBA,eAAeD,iBAAf"}
1
+ {"version":3,"file":"index.js","names":["useCallback","useState","useEvent","useCursorPosition","cursorPosition","setCursorPosition","x","y","mouseMoveHandler","e","clientX","clientY","touchMoveHandler","touches","length","window"],"sources":["../../src/index.ts"],"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"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAC7C,OAAOC,QAAQ,MAAM,sBAAsB;AAO3C,MAAMC,iBAAiB,GAAG,MAAM;EAC9B,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAGJ,QAAQ,CAAiB;IACnEK,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE;EACL,CAAC,CAAC;EAEF,MAAMC,gBAAgB,GAAGR,WAAW,CAAES,CAAa,IAAK;IACtDJ,iBAAiB,CAAC;MAAEC,CAAC,EAAEG,CAAC,CAACC,OAAO;MAAEH,CAAC,EAAEE,CAAC,CAACE;IAAQ,CAAC,CAAC;EACnD,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMC,gBAAgB,GAAGZ,WAAW,CAAES,CAAa,IAAK;IACtD,IAAIA,CAAC,CAACI,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;IAC5BT,iBAAiB,CAAC;MAAEC,CAAC,EAAEG,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,CAACH,OAAO;MAAEH,CAAC,EAAEE,CAAC,CAACI,OAAO,CAAC,CAAC,CAAC,CAACF;IAAQ,CAAC,CAAC;EACzE,CAAC,EAAE,EAAE,CAAC;EAENT,QAAQ,CAACa,MAAM,EAAE,WAAW,EAAEP,gBAAgB,CAAC;EAC/CN,QAAQ,CAACa,MAAM,EAAE,YAAY,EAAEH,gBAAgB,CAAC;EAChDV,QAAQ,CAACa,MAAM,EAAE,WAAW,EAAEH,gBAAgB,CAAC;EAE/C,OAAOR,cAAc;AACvB,CAAC;AAED,eAAeD,iBAAiB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@os-design/use-cursor-position",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "license": "UNLICENSED",
5
5
  "repository": "git@gitlab.com:os-team/libs/os-design.git",
6
6
  "main": "dist/cjs/index.js",
@@ -29,10 +29,10 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@os-design/use-event": "^1.0.10"
32
+ "@os-design/use-event": "^1.0.11"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": ">=18"
36
36
  },
37
- "gitHead": "174987fc6c9d55db201be10abde3a4cf5a790573"
37
+ "gitHead": "8cb28f6719d699c014fbce91d832a9ff06abe515"
38
38
  }