@enact/ui 4.5.2 → 4.6.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.
Files changed (222) hide show
  1. package/AnnounceDecorator/Announce.js +1 -40
  2. package/AnnounceDecorator/AnnounceDecorator.js +3 -21
  3. package/AnnounceDecorator/tests/Announce-specs.js +2 -7
  4. package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
  5. package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
  6. package/AnnounceDecorator/useAnnounce.js +0 -6
  7. package/BodyText/BodyText.js +8 -28
  8. package/BodyText/tests/BodyText-specs.js +0 -19
  9. package/Button/Button.js +33 -63
  10. package/Button/tests/Button-specs.js +0 -26
  11. package/CHANGELOG.md +45 -0
  12. package/Cancelable/Cancelable.js +8 -47
  13. package/Cancelable/cancelHandler.js +5 -12
  14. package/Cancelable/modalHandler.js +3 -11
  15. package/Cancelable/tests/Cancelable-specs.js +3 -57
  16. package/Changeable/Changeable.js +2 -34
  17. package/Changeable/tests/Changeable-specs.js +20 -66
  18. package/ComponentOverride/ComponentOverride.js +1 -13
  19. package/FloatingLayer/FloatingLayer.js +17 -73
  20. package/FloatingLayer/FloatingLayerContainer.js +0 -15
  21. package/FloatingLayer/FloatingLayerDecorator.js +4 -17
  22. package/FloatingLayer/Scrim.js +9 -53
  23. package/FloatingLayer/index.js +0 -4
  24. package/FloatingLayer/package.json +3 -0
  25. package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
  26. package/FloatingLayer/tests/Scrim-specs.js +0 -9
  27. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
  28. package/FloatingLayer/useFloatingLayer.js +3 -14
  29. package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
  30. package/ForwardRef/ForwardRef.js +1 -10
  31. package/GridListImageItem/GridListImageItem.js +18 -51
  32. package/Group/Group.js +5 -36
  33. package/Group/GroupItem.js +16 -33
  34. package/Group/tests/Group-specs.js +0 -32
  35. package/Heading/Heading.js +8 -36
  36. package/Heading/tests/Heading-specs.js +81 -14
  37. package/Icon/Icon.js +19 -53
  38. package/Icon/tests/Icon-specs.js +0 -22
  39. package/IconButton/IconButton.js +24 -57
  40. package/IconButton/tests/IconButton-specs.js +0 -7
  41. package/Image/Image.js +17 -46
  42. package/Image/tests/Image-specs.js +0 -14
  43. package/ImageItem/ImageItem.js +18 -47
  44. package/ImageItem/tests/ImageItem-specs.js +0 -25
  45. package/Item/Item.js +9 -33
  46. package/Item/tests/Item-specs.js +0 -24
  47. package/LabeledIcon/LabeledIcon.js +22 -53
  48. package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
  49. package/Layout/Cell.js +18 -44
  50. package/Layout/Layout.js +23 -46
  51. package/Layout/tests/Layout-specs.js +10 -39
  52. package/Marquee/MarqueeBase.js +29 -63
  53. package/Marquee/MarqueeController.js +11 -72
  54. package/Marquee/MarqueeDecorator.js +70 -196
  55. package/Marquee/index.js +1 -5
  56. package/Marquee/tests/Marquee-specs.js +295 -87
  57. package/Measurable/Measurable.js +12 -34
  58. package/Measurable/tests/Measurable-specs.js +115 -0
  59. package/Media/Media.js +15 -65
  60. package/Media/tests/Media-specs.js +168 -0
  61. package/Placeholder/PlaceholderControllerDecorator.js +7 -43
  62. package/Placeholder/PlaceholderDecorator.js +7 -38
  63. package/Placeholder/index.js +1 -5
  64. package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
  65. package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
  66. package/ProgressBar/ProgressBar.js +14 -45
  67. package/ProgressBar/tests/ProgressBar-specs.js +0 -17
  68. package/RadioDecorator/RadioControllerDecorator.js +7 -29
  69. package/RadioDecorator/RadioDecorator.js +9 -42
  70. package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
  71. package/Repeater/Repeater.js +9 -33
  72. package/Repeater/tests/Repeater-specs.js +0 -38
  73. package/Resizable/Resizable.js +9 -37
  74. package/Resizable/tests/Resizable-specs.js +34 -0
  75. package/Routable/Link.js +11 -47
  76. package/Routable/Routable.js +12 -35
  77. package/Routable/Route.js +0 -6
  78. package/Routable/Router.js +15 -58
  79. package/Routable/tests/Routable-specs.js +7 -33
  80. package/Routable/tests/Router-specs.js +18 -44
  81. package/Routable/useLink.js +4 -8
  82. package/Routable/util.js +18 -24
  83. package/Scrollable/ScrollAnimator.js +49 -65
  84. package/Scrollable/ScrollThumb.js +2 -13
  85. package/Scrollable/Scrollable.js +180 -387
  86. package/Scrollable/ScrollableNative.js +189 -392
  87. package/Scrollable/Scrollbar.js +30 -102
  88. package/Scroller/Scroller.js +15 -39
  89. package/Scroller/ScrollerBasic.js +34 -89
  90. package/Scroller/UiScrollerBase.js +37 -84
  91. package/Scroller/tests/Scroller-specs.js +56 -0
  92. package/Skinnable/Skinnable.js +11 -38
  93. package/Skinnable/tests/Skinnable-specs.js +3 -74
  94. package/Skinnable/tests/useSkins-specs.js +1 -13
  95. package/Skinnable/tests/util-specs.js +0 -14
  96. package/Skinnable/useSkins.js +8 -15
  97. package/Skinnable/util.js +9 -20
  98. package/Slider/Knob.js +5 -24
  99. package/Slider/PositionDecorator.js +16 -54
  100. package/Slider/Slider.js +29 -67
  101. package/Slider/tests/Slider-specs.js +94 -7
  102. package/Slider/utils.js +0 -2
  103. package/SlotItem/SlotItem.js +23 -45
  104. package/SlotItem/tests/SlotItem-specs.js +0 -5
  105. package/Slottable/Slottable.js +4 -12
  106. package/Slottable/tests/Slottable-specs.js +19 -46
  107. package/Slottable/tests/useSlots-specs.js +27 -65
  108. package/Slottable/useSlots.js +8 -33
  109. package/Spinner/Spinner.js +16 -43
  110. package/Spinner/tests/Spinner-specs.js +0 -15
  111. package/ToggleIcon/ToggleIcon.js +10 -36
  112. package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
  113. package/ToggleItem/ToggleItem.js +24 -57
  114. package/ToggleItem/tests/ToggleItem-specs.js +0 -30
  115. package/Toggleable/Toggle.js +1 -15
  116. package/Toggleable/Toggleable.js +12 -45
  117. package/Toggleable/tests/Toggleable-specs.js +28 -96
  118. package/Toggleable/useToggle.js +3 -19
  119. package/Touchable/ClickAllow.js +5 -14
  120. package/Touchable/Drag.js +16 -54
  121. package/Touchable/Flick.js +11 -42
  122. package/Touchable/Hold.js +21 -68
  123. package/Touchable/Pinch.js +185 -0
  124. package/Touchable/Touch.js +71 -76
  125. package/Touchable/Touchable.js +95 -75
  126. package/Touchable/config.js +27 -24
  127. package/Touchable/tests/Touchable-specs.js +360 -119
  128. package/Touchable/tests/useTouch-specs.js +6 -80
  129. package/Touchable/useTouch.js +57 -65
  130. package/Transition/Transition.js +37 -118
  131. package/Transition/tests/Transition-specs.js +20 -60
  132. package/ViewManager/Arranger.js +10 -22
  133. package/ViewManager/TransitionGroup.js +32 -107
  134. package/ViewManager/View.js +35 -91
  135. package/ViewManager/ViewManager.js +20 -84
  136. package/ViewManager/tests/View-specs.js +0 -17
  137. package/ViewManager/tests/ViewManager-specs.js +236 -305
  138. package/ViewManager/tests/test-utils.js +0 -8
  139. package/VirtualList/UiVirtualListBase.js +265 -409
  140. package/VirtualList/VirtualList.js +29 -69
  141. package/VirtualList/VirtualListBase.js +0 -3
  142. package/VirtualList/VirtualListBasic.js +273 -431
  143. package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
  144. package/VirtualList/tests/VirtualGridList-specs.js +614 -0
  145. package/VirtualList/tests/VirtualList-native-specs.js +152 -0
  146. package/VirtualList/tests/VirtualList-specs.js +423 -95
  147. package/internal/IdProvider/IdProvider.js +7 -21
  148. package/internal/IdProvider/Provider.js +4 -17
  149. package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
  150. package/internal/IdProvider/tests/useId-specs.js +6 -20
  151. package/internal/IdProvider/useId.js +0 -6
  152. package/internal/Pure/Pure.js +3 -30
  153. package/internal/Pure/tests/Pure-specs.js +88 -0
  154. package/internal/localized-fonts/localized-fonts.js +33 -62
  155. package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
  156. package/internal/selection/selection.js +1 -6
  157. package/internal/selection/tests/selection-specs.js +6 -4
  158. package/internal/validators/tests/validators-specs.js +80 -0
  159. package/internal/validators/validators.js +14 -34
  160. package/package.json +9 -3
  161. package/resolution/ResolutionDecorator.js +4 -40
  162. package/resolution/index.js +0 -7
  163. package/resolution/resolution.js +42 -80
  164. package/resolution/tests/ResolutionDecorator-specs.js +4 -11
  165. package/resolution/tests/resolution-specs.js +2 -2
  166. package/useControlledState/tests/useControlledState-specs.js +15 -46
  167. package/useControlledState/useControlledState.js +11 -22
  168. package/useScroll/ScrollAnimator.js +49 -65
  169. package/useScroll/Scrollbar.js +22 -58
  170. package/useScroll/ScrollbarTrack.js +3 -19
  171. package/useScroll/useScroll.js +267 -454
  172. package/useScroll/utilDOM.js +8 -14
  173. package/useScroll/utilEvent.js +0 -4
  174. package/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
  175. package/BodyText/BodyText.d.ts +0 -66
  176. package/Button/Button.d.ts +0 -125
  177. package/Cancelable/Cancelable.d.ts +0 -64
  178. package/Changeable/Changeable.d.ts +0 -54
  179. package/ComponentOverride/ComponentOverride.d.ts +0 -52
  180. package/ForwardRef/ForwardRef.d.ts +0 -22
  181. package/GridListImageItem/GridListImageItem.d.ts +0 -85
  182. package/Group/Group.d.ts +0 -107
  183. package/Heading/Heading.d.ts +0 -90
  184. package/Icon/Icon.d.ts +0 -88
  185. package/IconButton/IconButton.d.ts +0 -115
  186. package/Image/Image.d.ts +0 -113
  187. package/ImageItem/ImageItem.d.ts +0 -83
  188. package/Item/Item.d.ts +0 -64
  189. package/LabeledIcon/LabeledIcon.d.ts +0 -130
  190. package/Layout/Layout.d.ts +0 -247
  191. package/Marquee/index.d.ts +0 -258
  192. package/Measurable/Measurable.d.ts +0 -26
  193. package/Media/Media.d.ts +0 -99
  194. package/Placeholder/index.d.ts +0 -53
  195. package/ProgressBar/ProgressBar.d.ts +0 -92
  196. package/RadioDecorator/RadioDecorator.d.ts +0 -35
  197. package/Repeater/Repeater.d.ts +0 -83
  198. package/Resizable/Resizable.d.ts +0 -31
  199. package/Routable/Routable.d.ts +0 -148
  200. package/Scrollable/Scrollable.d.ts +0 -0
  201. package/Scroller/Scroller.d.ts +0 -276
  202. package/Skinnable/Skinnable.d.ts +0 -94
  203. package/Slider/Slider.d.ts +0 -202
  204. package/SlotItem/SlotItem.d.ts +0 -118
  205. package/Slottable/Slottable.d.ts +0 -22
  206. package/Spinner/Spinner.d.ts +0 -95
  207. package/ToggleIcon/ToggleIcon.d.ts +0 -90
  208. package/ToggleItem/ToggleItem.d.ts +0 -134
  209. package/Toggleable/Toggleable.d.ts +0 -103
  210. package/Touchable/Touchable.d.ts +0 -175
  211. package/Transition/Transition.d.ts +0 -196
  212. package/ViewManager/ViewManager.d.ts +0 -191
  213. package/VirtualList/VirtualList.d.ts +0 -530
  214. package/index.d.ts +0 -0
  215. package/internal/IdProvider/IdProvider.d.ts +0 -0
  216. package/internal/Pure/Pure.d.ts +0 -0
  217. package/internal/localized-fonts/localized-fonts.d.ts +0 -53
  218. package/internal/selection/selection.d.ts +0 -0
  219. package/internal/validators/validators.d.ts +0 -0
  220. package/resolution/index.d.ts +0 -187
  221. package/useControlledState/useControlledState.d.ts +0 -0
  222. package/useScroll/useScroll.d.ts +0 -0
@@ -4,68 +4,59 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.Touch = void 0;
7
-
8
7
  var _handle = require("@enact/core/handle");
9
-
10
8
  var _dispatcher = require("@enact/core/dispatcher");
11
-
12
9
  var _complement = _interopRequireDefault(require("ramda/src/complement"));
13
-
14
10
  var _platform = _interopRequireDefault(require("@enact/core/platform"));
15
-
16
11
  var _config = require("./config");
17
-
18
12
  var _state = require("./state");
19
-
20
13
  var _ClickAllow = _interopRequireDefault(require("./ClickAllow"));
21
-
22
14
  var _Drag = require("./Drag");
23
-
24
15
  var _Flick = require("./Flick");
25
-
26
16
  var _Hold = require("./Hold");
27
-
17
+ var _Pinch = require("./Pinch");
28
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
-
30
19
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
-
32
20
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
33
-
34
21
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
35
-
36
22
  var getEventCoordinates = function getEventCoordinates(ev) {
37
23
  var x = ev.clientX,
38
- y = ev.clientY,
39
- type = ev.type;
40
-
24
+ y = ev.clientY,
25
+ type = ev.type;
41
26
  if (type.indexOf('touch') === 0) {
42
- x = ev.targetTouches[0].clientX;
43
- y = ev.targetTouches[0].clientY;
27
+ if (ev.targetTouches.length >= 2) {
28
+ return Array.from(ev.targetTouches, function (targetTouch) {
29
+ return {
30
+ x: targetTouch.clientX,
31
+ y: targetTouch.clientY
32
+ };
33
+ });
34
+ } else {
35
+ x = ev.targetTouches[0].clientX;
36
+ y = ev.targetTouches[0].clientY;
37
+ }
44
38
  }
45
-
46
39
  return {
47
40
  x: x,
48
41
  y: y
49
42
  };
50
- }; // Establish a standard payload for onDown/onUp/onTap events and pass it along to a handler
51
-
43
+ };
52
44
 
45
+ // Establish a standard payload for onDown/onUp/onTap events and pass it along to a handler
53
46
  var makeTouchableEvent = function makeTouchableEvent(type) {
54
47
  return function (ev) {
55
48
  var target = ev.target,
56
- currentTarget = ev.currentTarget;
49
+ currentTarget = ev.currentTarget;
57
50
  var clientX = ev.clientX,
58
- clientY = ev.clientY,
59
- pageX = ev.pageX,
60
- pageY = ev.pageY;
61
-
51
+ clientY = ev.clientY,
52
+ pageX = ev.pageX,
53
+ pageY = ev.pageY;
62
54
  if (ev.changedTouches) {
63
55
  clientX = ev.changedTouches[0].clientX;
64
56
  clientY = ev.changedTouches[0].clientY;
65
57
  pageX = ev.changedTouches[0].pageX;
66
58
  pageY = ev.changedTouches[0].pageY;
67
59
  }
68
-
69
60
  return {
70
61
  type: type,
71
62
  target: target,
@@ -77,45 +68,48 @@ var makeTouchableEvent = function makeTouchableEvent(type) {
77
68
  };
78
69
  };
79
70
  };
80
-
81
71
  var isEnabled = (0, _handle.forProp)('disabled', false);
82
72
  var handleDown = (0, _handle.handle)(isEnabled, (0, _handle.adaptEvent)(makeTouchableEvent('onDown'), (0, _handle.forwardWithPrevent)('onDown')), (0, _handle.call)('activate'), (0, _handle.call)('startGesture')).named('handleDown');
83
73
  var handleUp = (0, _handle.handle)(isEnabled, (0, _handle.call)('endGesture'), (0, _handle.call)('isTracking'), (0, _handle.adaptEvent)(makeTouchableEvent('onUp'), (0, _handle.forwardWithPrevent)('onUp')), (0, _handle.adaptEvent)(makeTouchableEvent('onTap'), (0, _handle.forward)('onTap')))["finally"]((0, _handle.call)('deactivate')).named('handleUp');
84
74
  var handleEnter = (0, _handle.handle)(isEnabled, (0, _handle.forProp)('noResume', false), (0, _handle.call)('enterGesture'), (0, _handle.call)('isPaused'), (0, _handle.call)('activate')).named('handleEnter');
85
- var handleLeave = (0, _handle.handle)(isEnabled, (0, _handle.call)('leaveGesture'), (0, _handle.oneOf)([(0, _handle.forProp)('noResume', false), (0, _handle.call)('pause')], [_handle.returnsTrue, (0, _handle.call)('deactivate')])).named('handleLeave'); // Mouse event handlers
75
+ var handleLeave = (0, _handle.handle)(isEnabled, (0, _handle.call)('leaveGesture'), (0, _handle.oneOf)([(0, _handle.forProp)('noResume', false), (0, _handle.call)('pause')], [_handle.returnsTrue, (0, _handle.call)('deactivate')])).named('handleLeave');
76
+
77
+ // Mouse event handlers
86
78
 
87
79
  var handleMouseDown = (0, _handle.handle)((0, _handle.forward)('onMouseDown'), (0, _handle.call)('shouldAllowMouseEvent'), handleDown);
88
80
  var handleMouseEnter = (0, _handle.handle)((0, _handle.forward)('onMouseEnter'), handleEnter);
89
81
  var handleMouseMove = (0, _handle.handle)((0, _handle.forward)('onMouseMove'), (0, _handle.call)('moveGesture'));
90
82
  var handleMouseLeave = (0, _handle.handle)((0, _handle.forward)('onMouseLeave'), handleLeave);
91
83
  var handleMouseUp = (0, _handle.handle)((0, _handle.returnsTrue)((0, _handle.call)('setLastMouseUp')), (0, _handle.forward)('onMouseUp'), handleUp);
92
- var handleClick = (0, _handle.handle)(isEnabled, // wrapping another handler to always forward onClick but, if onTap should occur, it should
84
+ var handleClick = (0, _handle.handle)(isEnabled,
85
+ // wrapping another handler to always forward onClick but, if onTap should occur, it should
93
86
  // occur first to keep in sync with the up handler which emits onTap first
94
- (0, _handle.handle)((0, _handle.call)('shouldAllowTap'), (0, _handle.call)('activate'), handleUp)["finally"]((0, _handle.forward)('onClick'))); // Touch event handlers
87
+ (0, _handle.handle)((0, _handle.call)('shouldAllowTap'), (0, _handle.call)('activate'), handleUp)["finally"]((0, _handle.forward)('onClick')));
88
+
89
+ // Touch event handlers
95
90
 
96
91
  var handleTouchStart = (0, _handle.handle)((0, _handle.forward)('onTouchStart'), (0, _handle.call)('startTouch'), handleDown);
97
- var handleTouchMove = (0, _handle.handle)((0, _handle.forward)('onTouchMove'), (0, _handle.call)('isTracking'), // we don't receive enter/leave events during a touch so we have to simulate them by
92
+ var handleTouchMove = (0, _handle.handle)((0, _handle.forward)('onTouchMove'), (0, _handle.call)('isTracking'),
93
+ // we don't receive enter/leave events during a touch so we have to simulate them by
98
94
  // detecting when the touch leaves the boundary. oneOf returns the value of whichever
99
95
  // branch it follows so we append moveHold to either to handle moves that aren't
100
96
  // entering or leaving
101
97
  (0, _handle.adaptEvent)(makeTouchableEvent('onMove'), (0, _handle.forward)('onMove')), (0, _handle.oneOf)([(0, _handle.call)('hasTouchLeftTarget'), handleLeave], [_handle.returnsTrue, handleEnter])["finally"]((0, _handle.call)('moveGesture')));
102
- var handleTouchEnd = (0, _handle.handle)((0, _handle.forward)('onTouchEnd'), // block the next mousedown to prevent duplicate touchable events
103
- (0, _handle.returnsTrue)((0, _handle.call)('setLastTouchEnd')), (0, _handle.call)('isTracking'), (0, _complement["default"])((0, _handle.call)('hasTouchLeftTarget')), (0, _handle.returnsTrue)((0, _handle.call)('endTouch')), handleUp); // Global touchend/mouseup event handler to deactivate the component
98
+ var handleTouchEnd = (0, _handle.handle)((0, _handle.forward)('onTouchEnd'),
99
+ // block the next mousedown to prevent duplicate touchable events
100
+ (0, _handle.returnsTrue)((0, _handle.call)('setLastTouchEnd')), (0, _handle.call)('isTracking'), (0, _complement["default"])((0, _handle.call)('hasTouchLeftTarget')), (0, _handle.returnsTrue)((0, _handle.call)('endTouch')), handleUp);
104
101
 
102
+ // Global touchend/mouseup event handler to deactivate the component
105
103
  var handleGlobalUp = (0, _handle.handle)((0, _handle.call)('isTracking'), (0, _handle.call)('deactivate'))["finally"]((0, _handle.call)('endGesture'));
106
104
  var handleGlobalMove = (0, _handle.handle)((0, _handle.call)('isTracking'), (0, _handle.call)('containsCurrentTarget'), (0, _handle.call)('moveGesture'));
107
105
  var handleBlur = (0, _handle.handle)((0, _handle.forward)('onBlur'), (0, _handle.call)('hasFocus'), (0, _handle.call)('blurGesture'));
108
-
109
106
  var Touch = /*#__PURE__*/function () {
110
107
  function Touch() {
111
108
  var _this = this;
112
-
113
109
  _classCallCheck(this, Touch);
114
-
115
110
  this.getHandlers = function () {
116
111
  return _this.handlers;
117
112
  };
118
-
119
113
  this.context = {};
120
114
  this.target = null;
121
115
  this.targetHadFocus = false;
@@ -123,6 +117,7 @@ var Touch = /*#__PURE__*/function () {
123
117
  this.drag = new _Drag.Drag();
124
118
  this.flick = new _Flick.Flick();
125
119
  this.hold = new _Hold.Hold();
120
+ this.pinch = new _Pinch.Pinch();
126
121
  this.clickAllow = new _ClickAllow["default"]();
127
122
  this.handlers = {
128
123
  onClick: handleClick.bindAs(this, 'handleClick'),
@@ -133,7 +128,6 @@ var Touch = /*#__PURE__*/function () {
133
128
  onMouseLeave: handleMouseLeave.bindAs(this, 'handleMouseLeave'),
134
129
  onMouseUp: handleMouseUp.bindAs(this, 'handleMouseUp')
135
130
  };
136
-
137
131
  if (_platform["default"].touch) {
138
132
  Object.assign(this.handlers, {
139
133
  onTouchStart: handleTouchStart.bindAs(this, 'handleTouchStart'),
@@ -141,11 +135,9 @@ var Touch = /*#__PURE__*/function () {
141
135
  onTouchEnd: handleTouchEnd.bindAs(this, 'handleTouchEnd')
142
136
  });
143
137
  }
144
-
145
138
  handleGlobalUp.bindAs(this, 'handleGlobalUp');
146
139
  handleGlobalMove.bindAs(this, 'handleGlobalMove');
147
140
  }
148
-
149
141
  _createClass(Touch, [{
150
142
  key: "setPropsAndContext",
151
143
  value: function setPropsAndContext(config, state, setState) {
@@ -156,11 +148,12 @@ var Touch = /*#__PURE__*/function () {
156
148
  }
157
149
  }, {
158
150
  key: "updateGestureConfig",
159
- value: function updateGestureConfig(dragConfig, flickConfig, holdConfig) {
151
+ value: function updateGestureConfig(dragConfig, flickConfig, holdConfig, pinchConfig) {
160
152
  this.config = (0, _config.mergeConfig)({
161
153
  drag: dragConfig,
162
154
  flick: flickConfig,
163
- hold: holdConfig
155
+ hold: holdConfig,
156
+ pinch: pinchConfig
164
157
  });
165
158
  }
166
159
  }, {
@@ -170,7 +163,6 @@ var Touch = /*#__PURE__*/function () {
170
163
  if (_platform["default"].touch) {
171
164
  (0, _dispatcher.on)('touchend', this.handleGlobalUp, document);
172
165
  }
173
-
174
166
  (0, _dispatcher.on)('mouseup', this.handleGlobalUp, document);
175
167
  (0, _dispatcher.on)('mousemove', this.handleGlobalMove, document);
176
168
  }
@@ -180,11 +172,11 @@ var Touch = /*#__PURE__*/function () {
180
172
  if (_platform["default"].touch) {
181
173
  (0, _dispatcher.off)('touchend', this.handleGlobalUp, document);
182
174
  }
183
-
184
175
  (0, _dispatcher.off)('mouseup', this.handleGlobalUp, document);
185
176
  (0, _dispatcher.off)('mousemove', this.handleGlobalMove, document);
186
- } // State Management
177
+ }
187
178
 
179
+ // State Management
188
180
  }, {
189
181
  key: "setTarget",
190
182
  value: function setTarget(target) {
@@ -199,22 +191,18 @@ var Touch = /*#__PURE__*/function () {
199
191
  key: "activate",
200
192
  value: function activate(ev) {
201
193
  this.setTarget(ev.currentTarget);
202
-
203
194
  if (this.props.getActive) {
204
195
  this.context.setState(_state.States.Active);
205
196
  }
206
-
207
197
  return true;
208
198
  }
209
199
  }, {
210
200
  key: "deactivate",
211
201
  value: function deactivate() {
212
202
  this.clearTarget();
213
-
214
203
  if (this.props.getActive) {
215
204
  this.context.setState(_state.States.Inactive);
216
205
  }
217
-
218
206
  return true;
219
207
  }
220
208
  }, {
@@ -223,7 +211,6 @@ var Touch = /*#__PURE__*/function () {
223
211
  if (this.props.getActive && this.context.state === _state.States.Active) {
224
212
  this.context.setState(_state.States.Paused);
225
213
  }
226
-
227
214
  return true;
228
215
  }
229
216
  }, {
@@ -235,24 +222,24 @@ var Touch = /*#__PURE__*/function () {
235
222
  }, {
236
223
  key: "updateProps",
237
224
  value: function updateProps(props) {
238
- // Update the props onHoldStart, onHold, and onHoldEnd on any gesture (hold, flick, drag).
225
+ // Update the props onHoldStart, onHold, and onHoldEnd on any gesture (pinch, hold, flick, drag).
226
+ this.pinch.updateProps(props);
239
227
  this.hold.updateProps(props);
240
228
  this.flick.updateProps(props);
241
229
  this.drag.updateProps(props);
242
- } // Gesture Support
230
+ }
243
231
 
232
+ // Gesture Support
244
233
  }, {
245
234
  key: "startTouch",
246
235
  value: function startTouch(_ref) {
247
236
  var target = _ref.target,
248
- currentTarget = _ref.currentTarget;
249
-
237
+ currentTarget = _ref.currentTarget;
250
238
  if (currentTarget.contains(target)) {
251
239
  (0, _dispatcher.on)('contextmenu', _handle.preventDefault);
252
240
  this.targetBounds = currentTarget.getBoundingClientRect();
253
241
  return true;
254
242
  }
255
-
256
243
  return false;
257
244
  }
258
245
  }, {
@@ -266,12 +253,17 @@ var Touch = /*#__PURE__*/function () {
266
253
  value: function startGesture(ev, props) {
267
254
  var coords = getEventCoordinates(ev);
268
255
  var _this$config = this.config,
269
- hold = _this$config.hold,
270
- flick = _this$config.flick,
271
- drag = _this$config.drag;
272
- this.hold.begin(hold, props, coords);
273
- this.flick.begin(flick, props, coords);
274
- this.drag.begin(drag, props, coords, this.target);
256
+ pinch = _this$config.pinch,
257
+ hold = _this$config.hold,
258
+ flick = _this$config.flick,
259
+ drag = _this$config.drag;
260
+ if (Array.isArray(coords)) {
261
+ this.pinch.begin(pinch, props, coords, this.target);
262
+ } else {
263
+ this.hold.begin(hold, props, coords);
264
+ this.flick.begin(flick, props, coords);
265
+ this.drag.begin(drag, props, coords, this.target);
266
+ }
275
267
  this.targetHadFocus = this.target === document.activeElement;
276
268
  return true;
277
269
  }
@@ -279,9 +271,13 @@ var Touch = /*#__PURE__*/function () {
279
271
  key: "moveGesture",
280
272
  value: function moveGesture(ev) {
281
273
  var coords = getEventCoordinates(ev);
282
- this.hold.move(coords);
283
- this.flick.move(coords);
284
- this.drag.move(coords);
274
+ if (Array.isArray(coords)) {
275
+ this.pinch.move(coords);
276
+ } else {
277
+ this.hold.move(coords);
278
+ this.flick.move(coords);
279
+ this.drag.move(coords);
280
+ }
285
281
  return true;
286
282
  }
287
283
  }, {
@@ -311,12 +307,14 @@ var Touch = /*#__PURE__*/function () {
311
307
  key: "endGesture",
312
308
  value: function endGesture() {
313
309
  this.targetHadFocus = false;
310
+ this.pinch.end();
314
311
  this.hold.end();
315
312
  this.flick.end();
316
313
  this.drag.end();
317
314
  return true;
318
- } // Event handler utilities
315
+ }
319
316
 
317
+ // Event handler utilities
320
318
  }, {
321
319
  key: "isTracking",
322
320
  value: function isTracking() {
@@ -337,15 +335,14 @@ var Touch = /*#__PURE__*/function () {
337
335
  key: "hasTouchLeftTarget",
338
336
  value: function hasTouchLeftTarget(ev) {
339
337
  var _this2 = this;
340
-
341
338
  return Array.from(ev.changedTouches).reduce(function (hasLeft, _ref2) {
342
339
  var pageX = _ref2.pageX,
343
- pageY = _ref2.pageY;
340
+ pageY = _ref2.pageY;
344
341
  var _this2$targetBounds = _this2.targetBounds,
345
- left = _this2$targetBounds.left,
346
- right = _this2$targetBounds.right,
347
- top = _this2$targetBounds.top,
348
- bottom = _this2$targetBounds.bottom;
342
+ left = _this2$targetBounds.left,
343
+ right = _this2$targetBounds.right,
344
+ top = _this2$targetBounds.top,
345
+ bottom = _this2$targetBounds.bottom;
349
346
  return hasLeft && left > pageX || right < pageX || top > pageY || bottom < pageY;
350
347
  }, true);
351
348
  }
@@ -376,10 +373,8 @@ var Touch = /*#__PURE__*/function () {
376
373
  this.clickAllow.setLastTouchEnd(ev);
377
374
  }
378
375
  }]);
379
-
380
376
  return Touch;
381
377
  }();
382
-
383
378
  exports.Touch = Touch;
384
379
  var _default = Touch;
385
380
  exports["default"] = _default;