source: imaps-frontend/node_modules/@use-gesture/react/dist/use-gesture-react.cjs.prod.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 3.3 KB
Line 
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5var actions = require('@use-gesture/core/actions');
6var React = require('react');
7var core = require('@use-gesture/core');
8var utils = require('@use-gesture/core/utils');
9var types = require('@use-gesture/core/types');
10
11function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
12
13var React__default = /*#__PURE__*/_interopDefault(React);
14
15function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) {
16 const ctrl = React__default["default"].useMemo(() => new core.Controller(handlers), []);
17 ctrl.applyHandlers(handlers, nativeHandlers);
18 ctrl.applyConfig(config, gestureKey);
19 React__default["default"].useEffect(ctrl.effect.bind(ctrl));
20 React__default["default"].useEffect(() => {
21 return ctrl.clean.bind(ctrl);
22 }, []);
23 if (config.target === undefined) {
24 return ctrl.bind.bind(ctrl);
25 }
26 return undefined;
27}
28
29function useDrag(handler, config) {
30 actions.registerAction(actions.dragAction);
31 return useRecognizers({
32 drag: handler
33 }, config || {}, 'drag');
34}
35
36function usePinch(handler, config) {
37 actions.registerAction(actions.pinchAction);
38 return useRecognizers({
39 pinch: handler
40 }, config || {}, 'pinch');
41}
42
43function useWheel(handler, config) {
44 actions.registerAction(actions.wheelAction);
45 return useRecognizers({
46 wheel: handler
47 }, config || {}, 'wheel');
48}
49
50function useScroll(handler, config) {
51 actions.registerAction(actions.scrollAction);
52 return useRecognizers({
53 scroll: handler
54 }, config || {}, 'scroll');
55}
56
57function useMove(handler, config) {
58 actions.registerAction(actions.moveAction);
59 return useRecognizers({
60 move: handler
61 }, config || {}, 'move');
62}
63
64function useHover(handler, config) {
65 actions.registerAction(actions.hoverAction);
66 return useRecognizers({
67 hover: handler
68 }, config || {}, 'hover');
69}
70
71function createUseGesture(actions$1) {
72 actions$1.forEach(actions.registerAction);
73 return function useGesture(_handlers, _config) {
74 const {
75 handlers,
76 nativeHandlers,
77 config
78 } = core.parseMergedHandlers(_handlers, _config || {});
79 return useRecognizers(handlers, config, undefined, nativeHandlers);
80 };
81}
82
83function useGesture(handlers, config) {
84 const hook = createUseGesture([actions.dragAction, actions.pinchAction, actions.scrollAction, actions.wheelAction, actions.moveAction, actions.hoverAction]);
85 return hook(handlers, config || {});
86}
87
88exports.createUseGesture = createUseGesture;
89exports.useDrag = useDrag;
90exports.useGesture = useGesture;
91exports.useHover = useHover;
92exports.useMove = useMove;
93exports.usePinch = usePinch;
94exports.useScroll = useScroll;
95exports.useWheel = useWheel;
96Object.keys(actions).forEach(function (k) {
97 if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
98 enumerable: true,
99 get: function () { return actions[k]; }
100 });
101});
102Object.keys(utils).forEach(function (k) {
103 if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
104 enumerable: true,
105 get: function () { return utils[k]; }
106 });
107});
108Object.keys(types).forEach(function (k) {
109 if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
110 enumerable: true,
111 get: function () { return types[k]; }
112 });
113});
Note: See TracBrowser for help on using the repository browser.