@nativescript/core 8.5.0-dom.2 → 8.5.0-rc.0

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 (300) hide show
  1. package/abortcontroller/abortsignal.js +1 -1
  2. package/abortcontroller/abortsignal.js.map +1 -1
  3. package/accessibility/accessibility-properties.js +5 -13
  4. package/accessibility/accessibility-properties.js.map +1 -1
  5. package/accessibility/index.android.js +11 -10
  6. package/accessibility/index.android.js.map +1 -1
  7. package/accessibility/index.ios.js.map +1 -1
  8. package/animation-frame/animation-native.ios.d.ts +1 -1
  9. package/application/application-common.d.ts +5 -4
  10. package/application/application-common.js.map +1 -1
  11. package/application/index.android.d.ts +12 -12
  12. package/application/index.d.ts +30 -32
  13. package/application/index.ios.d.ts +1 -0
  14. package/application/index.ios.js +24 -29
  15. package/application/index.ios.js.map +1 -1
  16. package/core-types/index.d.ts +277 -752
  17. package/core-types/index.js +3 -0
  18. package/core-types/index.js.map +1 -1
  19. package/css/CSS3Parser.d.ts +3 -3
  20. package/css/parser.d.ts +17 -17
  21. package/css/parser.js +1 -0
  22. package/css/parser.js.map +1 -1
  23. package/data/observable/index.d.ts +47 -102
  24. package/data/observable/index.js +178 -151
  25. package/data/observable/index.js.map +1 -1
  26. package/data/observable-array/index.d.ts +2 -3
  27. package/data/observable-array/index.js +1 -1
  28. package/data/observable-array/index.js.map +1 -1
  29. package/data/virtual-array/index.d.ts +3 -4
  30. package/file-system/file-system-access.android.d.ts +13 -0
  31. package/file-system/file-system-access.android.js +149 -1
  32. package/file-system/file-system-access.android.js.map +1 -1
  33. package/file-system/file-system-access.d.ts +12 -0
  34. package/file-system/file-system-access.ios.d.ts +7 -0
  35. package/file-system/file-system-access.ios.js +56 -0
  36. package/file-system/file-system-access.ios.js.map +1 -1
  37. package/fps-meter/fps-native.android.js.map +1 -1
  38. package/global-types.d.ts +94 -94
  39. package/globals/index.js.map +1 -1
  40. package/image-source/index.android.js +5 -5
  41. package/image-source/index.android.js.map +1 -1
  42. package/image-source/index.ios.js +5 -5
  43. package/image-source/index.ios.js.map +1 -1
  44. package/index.d.ts +4 -2
  45. package/index.js +5 -3
  46. package/index.js.map +1 -1
  47. package/package.json +2 -1
  48. package/platform/index.android.d.ts +2 -2
  49. package/platform/index.ios.d.ts +2 -2
  50. package/platforms/android/widgets-release.aar +0 -0
  51. package/platforms/ios/src/NativeScriptUtils.m +3 -0
  52. package/profiling/index.js +1 -1
  53. package/profiling/index.js.map +1 -1
  54. package/ui/action-bar/action-bar-common.d.ts +1 -1
  55. package/ui/action-bar/action-bar-common.js +7 -7
  56. package/ui/action-bar/action-bar-common.js.map +1 -1
  57. package/ui/action-bar/index.android.js +3 -1
  58. package/ui/action-bar/index.android.js.map +1 -1
  59. package/ui/action-bar/index.d.ts +2 -3
  60. package/ui/animation/animation-interfaces.d.ts +4 -4
  61. package/ui/builder/component-builder/index.js.map +1 -1
  62. package/ui/builder/xml2ui.js +3 -3
  63. package/ui/builder/xml2ui.js.map +1 -1
  64. package/ui/button/index.android.js +1 -1
  65. package/ui/button/index.android.js.map +1 -1
  66. package/ui/button/index.d.ts +2 -3
  67. package/ui/button/index.ios.js +1 -2
  68. package/ui/button/index.ios.js.map +1 -1
  69. package/ui/core/bindable/bindable-expressions.js +9 -9
  70. package/ui/core/bindable/bindable-expressions.js.map +1 -1
  71. package/ui/core/bindable/index.js +1 -1
  72. package/ui/core/bindable/index.js.map +1 -1
  73. package/ui/core/properties/index.js +6 -6
  74. package/ui/core/properties/index.js.map +1 -1
  75. package/ui/core/view/index.android.d.ts +3 -6
  76. package/ui/core/view/index.android.js +28 -51
  77. package/ui/core/view/index.android.js.map +1 -1
  78. package/ui/core/view/index.d.ts +14 -28
  79. package/ui/core/view/index.ios.d.ts +1 -1
  80. package/ui/core/view/index.ios.js +95 -13
  81. package/ui/core/view/index.ios.js.map +1 -1
  82. package/ui/core/view/view-common.d.ts +13 -11
  83. package/ui/core/view/view-common.js +95 -97
  84. package/ui/core/view/view-common.js.map +1 -1
  85. package/ui/core/view/view-helper/index.ios.d.ts +10 -0
  86. package/ui/core/view/view-helper/index.ios.js +99 -40
  87. package/ui/core/view/view-helper/index.ios.js.map +1 -1
  88. package/ui/core/view-base/index.d.ts +454 -519
  89. package/ui/core/view-base/index.js +170 -5
  90. package/ui/core/view-base/index.js.map +1 -1
  91. package/ui/core/weak-event-listener/index.d.ts +2 -4
  92. package/ui/core/weak-event-listener/index.js +4 -4
  93. package/ui/core/weak-event-listener/index.js.map +1 -1
  94. package/ui/date-picker/index.android.js +3 -1
  95. package/ui/date-picker/index.android.js.map +1 -1
  96. package/ui/dialogs/dialogs-common.js +1 -0
  97. package/ui/dialogs/dialogs-common.js.map +1 -1
  98. package/ui/dialogs/index.android.js +7 -9
  99. package/ui/dialogs/index.android.js.map +1 -1
  100. package/ui/editable-text-base/editable-text-base-common.js +1 -2
  101. package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
  102. package/ui/editable-text-base/index.android.js +13 -9
  103. package/ui/editable-text-base/index.android.js.map +1 -1
  104. package/ui/editable-text-base/index.ios.js +13 -3
  105. package/ui/editable-text-base/index.ios.js.map +1 -1
  106. package/ui/frame/fragment.transitions.d.ts +0 -4
  107. package/ui/frame/frame-common.d.ts +9 -3
  108. package/ui/frame/frame-common.js +11 -2
  109. package/ui/frame/frame-common.js.map +1 -1
  110. package/ui/frame/index.android.d.ts +2 -1
  111. package/ui/frame/index.android.js +27 -11
  112. package/ui/frame/index.android.js.map +1 -1
  113. package/ui/frame/index.d.ts +3 -4
  114. package/ui/frame/index.ios.js +77 -14
  115. package/ui/frame/index.ios.js.map +1 -1
  116. package/ui/gestures/gestures-common.d.ts +2 -9
  117. package/ui/gestures/gestures-common.js +19 -11
  118. package/ui/gestures/gestures-common.js.map +1 -1
  119. package/ui/gestures/index.android.d.ts +3 -0
  120. package/ui/gestures/index.android.js +66 -63
  121. package/ui/gestures/index.android.js.map +1 -1
  122. package/ui/gestures/index.d.ts +10 -1
  123. package/ui/gestures/index.ios.d.ts +3 -1
  124. package/ui/gestures/index.ios.js +150 -99
  125. package/ui/gestures/index.ios.js.map +1 -1
  126. package/ui/gestures/touch-manager.d.ts +2 -2
  127. package/ui/image/index.android.js +3 -1
  128. package/ui/image/index.android.js.map +1 -1
  129. package/ui/image/index.ios.js +1 -1
  130. package/ui/image/index.ios.js.map +1 -1
  131. package/ui/image-cache/image-cache-common.d.ts +3 -3
  132. package/ui/image-cache/index.d.ts +3 -4
  133. package/ui/index.d.ts +7 -1
  134. package/ui/index.js +6 -1
  135. package/ui/index.js.map +1 -1
  136. package/ui/label/index.android.js +1 -0
  137. package/ui/label/index.android.js.map +1 -1
  138. package/ui/layouts/flexbox-layout/flexbox-layout-common.d.ts +12 -12
  139. package/ui/layouts/grid-layout/grid-layout-common.d.ts +5 -5
  140. package/ui/layouts/grid-layout/grid-layout-common.js +4 -4
  141. package/ui/layouts/grid-layout/grid-layout-common.js.map +1 -1
  142. package/ui/layouts/root-layout/index.android.js +9 -7
  143. package/ui/layouts/root-layout/index.android.js.map +1 -1
  144. package/ui/layouts/root-layout/root-layout-common.js +45 -36
  145. package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
  146. package/ui/list-picker/index.android.js +6 -2
  147. package/ui/list-picker/index.android.js.map +1 -1
  148. package/ui/list-picker/index.ios.d.ts +0 -2
  149. package/ui/list-picker/index.ios.js +2 -17
  150. package/ui/list-picker/index.ios.js.map +1 -1
  151. package/ui/list-view/index.android.js +6 -2
  152. package/ui/list-view/index.android.js.map +1 -1
  153. package/ui/list-view/index.d.ts +6 -7
  154. package/ui/list-view/list-view-common.d.ts +4 -4
  155. package/ui/list-view/list-view-common.js +8 -2
  156. package/ui/list-view/list-view-common.js.map +1 -1
  157. package/ui/page/index.d.ts +5 -6
  158. package/ui/page/index.ios.d.ts +4 -0
  159. package/ui/page/index.ios.js +89 -56
  160. package/ui/page/index.ios.js.map +1 -1
  161. package/ui/page/page-common.d.ts +72 -39
  162. package/ui/placeholder/index.android.d.ts +2 -2
  163. package/ui/placeholder/index.d.ts +2 -3
  164. package/ui/repeater/index.js +2 -1
  165. package/ui/repeater/index.js.map +1 -1
  166. package/ui/scroll-view/index.android.js +5 -27
  167. package/ui/scroll-view/index.android.js.map +1 -1
  168. package/ui/scroll-view/index.d.ts +2 -3
  169. package/ui/scroll-view/index.ios.d.ts +1 -0
  170. package/ui/scroll-view/index.ios.js +21 -8
  171. package/ui/scroll-view/index.ios.js.map +1 -1
  172. package/ui/scroll-view/scroll-view-common.d.ts +5 -5
  173. package/ui/scroll-view/scroll-view-common.js +6 -6
  174. package/ui/scroll-view/scroll-view-common.js.map +1 -1
  175. package/ui/search-bar/index.android.js +6 -2
  176. package/ui/search-bar/index.android.js.map +1 -1
  177. package/ui/search-bar/index.d.ts +3 -4
  178. package/ui/search-bar/index.ios.d.ts +0 -2
  179. package/ui/search-bar/index.ios.js +1 -8
  180. package/ui/search-bar/index.ios.js.map +1 -1
  181. package/ui/segmented-bar/index.android.js +3 -1
  182. package/ui/segmented-bar/index.android.js.map +1 -1
  183. package/ui/segmented-bar/index.d.ts +2 -3
  184. package/ui/segmented-bar/segmented-bar-common.d.ts +2 -2
  185. package/ui/styling/background.ios.js +15 -4
  186. package/ui/styling/background.ios.js.map +1 -1
  187. package/ui/styling/css-animation-parser.d.ts +12 -7
  188. package/ui/styling/css-animation-parser.js +90 -36
  189. package/ui/styling/css-animation-parser.js.map +1 -1
  190. package/ui/styling/css-selector.d.ts +1 -1
  191. package/ui/styling/css-utils.d.ts +1 -0
  192. package/ui/styling/css-utils.js +12 -0
  193. package/ui/styling/css-utils.js.map +1 -0
  194. package/ui/styling/font-common.js +6 -6
  195. package/ui/styling/font-common.js.map +1 -1
  196. package/ui/styling/font-interfaces.d.ts +3 -3
  197. package/ui/styling/font.ios.js +2 -1
  198. package/ui/styling/font.ios.js.map +1 -1
  199. package/ui/styling/style/index.d.ts +3 -0
  200. package/ui/styling/style/index.js.map +1 -1
  201. package/ui/styling/style-properties.js +6 -13
  202. package/ui/styling/style-properties.js.map +1 -1
  203. package/ui/styling/style-scope.js +7 -5
  204. package/ui/styling/style-scope.js.map +1 -1
  205. package/ui/switch/index.android.js +3 -1
  206. package/ui/switch/index.android.js.map +1 -1
  207. package/ui/tab-view/index.android.js +1 -1
  208. package/ui/tab-view/index.android.js.map +1 -1
  209. package/ui/tab-view/index.d.ts +2 -3
  210. package/ui/tab-view/tab-view-common.d.ts +2 -2
  211. package/ui/text-base/index.ios.js +21 -4
  212. package/ui/text-base/index.ios.js.map +1 -1
  213. package/ui/text-base/span.js +4 -4
  214. package/ui/text-base/span.js.map +1 -1
  215. package/ui/text-field/index.ios.d.ts +0 -2
  216. package/ui/text-field/index.ios.js +6 -17
  217. package/ui/text-field/index.ios.js.map +1 -1
  218. package/ui/text-view/index.ios.d.ts +0 -2
  219. package/ui/text-view/index.ios.js +1 -15
  220. package/ui/text-view/index.ios.js.map +1 -1
  221. package/ui/transition/fade-transition.d.ts +1 -3
  222. package/ui/transition/fade-transition.ios.d.ts +14 -1
  223. package/ui/transition/fade-transition.ios.js +60 -24
  224. package/ui/transition/fade-transition.ios.js.map +1 -1
  225. package/ui/transition/index.android.d.ts +6 -4
  226. package/ui/transition/index.android.js +8 -5
  227. package/ui/transition/index.android.js.map +1 -1
  228. package/ui/transition/index.d.ts +44 -8
  229. package/ui/transition/index.ios.d.ts +6 -4
  230. package/ui/transition/index.ios.js +9 -5
  231. package/ui/transition/index.ios.js.map +1 -1
  232. package/ui/transition/modal-transition.android.d.ts +5 -0
  233. package/ui/transition/modal-transition.android.js +7 -0
  234. package/ui/transition/modal-transition.android.js.map +1 -0
  235. package/ui/transition/modal-transition.d.ts +2 -0
  236. package/ui/transition/modal-transition.ios.d.ts +34 -0
  237. package/ui/transition/modal-transition.ios.js +160 -0
  238. package/ui/transition/modal-transition.ios.js.map +1 -0
  239. package/ui/transition/page-transition.android.d.ts +6 -0
  240. package/ui/transition/page-transition.android.js +182 -0
  241. package/ui/transition/page-transition.android.js.map +1 -0
  242. package/ui/transition/page-transition.d.ts +2 -0
  243. package/ui/transition/page-transition.ios.d.ts +34 -0
  244. package/ui/transition/page-transition.ios.js +181 -0
  245. package/ui/transition/page-transition.ios.js.map +1 -0
  246. package/ui/transition/shared-transition-helper.android.d.ts +5 -0
  247. package/ui/transition/shared-transition-helper.android.js +6 -0
  248. package/ui/transition/shared-transition-helper.android.js.map +1 -0
  249. package/ui/transition/shared-transition-helper.d.ts +10 -0
  250. package/ui/transition/shared-transition-helper.ios.d.ts +14 -0
  251. package/ui/transition/shared-transition-helper.ios.js +471 -0
  252. package/ui/transition/shared-transition-helper.ios.js.map +1 -0
  253. package/ui/transition/shared-transition.d.ts +230 -0
  254. package/ui/transition/shared-transition.js +192 -0
  255. package/ui/transition/shared-transition.js.map +1 -0
  256. package/ui/transition/slide-transition.android.d.ts +1 -1
  257. package/ui/transition/slide-transition.android.js +1 -1
  258. package/ui/transition/slide-transition.android.js.map +1 -1
  259. package/ui/transition/slide-transition.d.ts +1 -1
  260. package/ui/transition/slide-transition.ios.d.ts +15 -2
  261. package/ui/transition/slide-transition.ios.js +86 -50
  262. package/ui/transition/slide-transition.ios.js.map +1 -1
  263. package/ui/web-view/index.android.js +4 -3
  264. package/ui/web-view/index.android.js.map +1 -1
  265. package/ui/web-view/index.d.ts +3 -4
  266. package/ui/web-view/index.ios.d.ts +1 -2
  267. package/ui/web-view/index.ios.js +21 -28
  268. package/ui/web-view/index.ios.js.map +1 -1
  269. package/ui/web-view/web-view-common.d.ts +3 -3
  270. package/ui/web-view/web-view-interfaces.d.ts +1 -1
  271. package/utils/common.d.ts +2 -1
  272. package/utils/common.js +8 -2
  273. package/utils/common.js.map +1 -1
  274. package/utils/index.android.js +2 -2
  275. package/utils/index.android.js.map +1 -1
  276. package/utils/index.d.ts +0 -82
  277. package/utils/mainthread-helper.android.js +2 -2
  278. package/utils/mainthread-helper.android.js.map +1 -1
  279. package/utils/native-helper.android.js +3 -2
  280. package/utils/native-helper.android.js.map +1 -1
  281. package/utils/native-helper.d.ts +35 -0
  282. package/utils/native-helper.ios.d.ts +13 -0
  283. package/utils/native-helper.ios.js +79 -4
  284. package/utils/native-helper.ios.js.map +1 -1
  285. package/utils/number-utils.d.ts +10 -0
  286. package/utils/number-utils.js +12 -0
  287. package/utils/number-utils.js.map +1 -1
  288. package/utils/typescript-utils.d.ts +6 -0
  289. package/xhr/index.js +28 -28
  290. package/xhr/index.js.map +1 -1
  291. package/xml/index.js.map +1 -1
  292. package/data/dom-events/dom-event.d.ts +0 -141
  293. package/data/dom-events/dom-event.js +0 -342
  294. package/data/dom-events/dom-event.js.map +0 -1
  295. package/profiling/jamie.d.ts +0 -9
  296. package/profiling/jamie.js +0 -32
  297. package/profiling/jamie.js.map +0 -1
  298. package/ui/frame/fragment.transitions.ios.d.ts +0 -2
  299. package/ui/frame/fragment.transitions.ios.js +0 -85
  300. package/ui/frame/fragment.transitions.ios.js.map +0 -1
@@ -1,342 +0,0 @@
1
- // This file contains some of Core's hot paths, so attention has been taken to
2
- // optimise it. Where specified, optimisations made have been informed based on
3
- // profiles taken on an Apple M1 Max in a debug build on @nativescript/ios@8.3.3
4
- // on an iOS Simulator.
5
- const timeOrigin = Date.now();
6
- /**
7
- * Purely a performance utility. We fall back to an empty array on various
8
- * optional accesses, so reusing the same one and treating it as immutable
9
- * avoids unnecessary allocations on a relatively hot path of the library.
10
- */
11
- const emptyArray = [];
12
- var EventPropagationState;
13
- (function (EventPropagationState) {
14
- EventPropagationState[EventPropagationState["resume"] = 0] = "resume";
15
- EventPropagationState[EventPropagationState["stop"] = 1] = "stop";
16
- EventPropagationState[EventPropagationState["stopImmediate"] = 2] = "stopImmediate";
17
- })(EventPropagationState || (EventPropagationState = {}));
18
- export class DOMEvent {
19
- constructor(
20
- /**
21
- * Returns the type of event, e.g. "click", "hashchange", or "submit".
22
- */
23
- type, options) {
24
- this.type = type;
25
- /**
26
- * Recycling the event path array rather than allocating a new one each time
27
- * saves about 210 nanoseconds per dispatchTo() call (and avoids memory pressure
28
- * and GC).
29
- */
30
- this.recycledEventPath = [];
31
- /**
32
- * Returns the event's timestamp as the number of milliseconds measured
33
- * relative to the time origin.
34
- */
35
- this.timeStamp = timeOrigin - Date.now();
36
- // Avoid destructuring the options object (might save some nanoseconds).
37
- this.bubbles = options?.bubbles ?? false;
38
- this.cancelable = options?.cancelable ?? false;
39
- this.composed = options?.composed ?? false;
40
- this.detail = options?.detail ?? null;
41
- }
42
- /** @deprecated Use defaultPrevented instead. */
43
- get returnValue() {
44
- return !this.defaultPrevented;
45
- }
46
- /** @deprecated */
47
- get srcElement() {
48
- return this.target;
49
- }
50
- /**
51
- * Returns the invocation target objects of event's path (objects on which
52
- * listeners will be invoked), except for any nodes in shadow trees of which
53
- * the shadow root's mode is "closed" that are not reachable from event's
54
- * currentTarget.
55
- */
56
- composedPath() {
57
- if (!this.target) {
58
- return [];
59
- }
60
- // Walk up the target's parents if it has parents (is a ViewBase or
61
- // subclass of ViewBase) or not (is an Observable).
62
- return [...this.getEventPath(this.target, 'bubble')];
63
- }
64
- /**
65
- * Returns the event path by walking up the target's parents.
66
- *
67
- * - 'capture' paths are ordered from root to target.
68
- * - 'bubble' paths are ordered from target to root.
69
- * @example
70
- * [Page, StackLayout, Button] // 'capture'
71
- * @example
72
- * [Button, StackLayout, Page] // 'bubble'
73
- */
74
- getEventPath(responder, path) {
75
- this.recycledEventPath.splice(0, this.recycledEventPath.length, responder);
76
- if (!responder.isViewBase()) {
77
- return this.recycledEventPath;
78
- }
79
- // Determining the function up-front (rather than inside the loop) saves
80
- // 50 nanoseconds per dispatchTo() call.
81
- const insert = path === 'capture' ? this.recycledEventPath.unshift.bind(this.recycledEventPath) : this.recycledEventPath.push.bind(this.recycledEventPath);
82
- let nextResponder = responder.parent;
83
- while (nextResponder) {
84
- insert(nextResponder);
85
- // TODO: decide whether to walk up from Page to Frame, and whether
86
- // to then walk from Frame to Application or something.
87
- nextResponder = nextResponder?.parent;
88
- }
89
- return this.recycledEventPath;
90
- }
91
- /** @deprecated */
92
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
93
- initEvent(type, bubbles, cancelable) {
94
- // This would be trivial to implement, but we'd have to remove the
95
- // readonly modifier from `bubbles` and `cancelable`, which would be a
96
- // shame just for the sake of supporting a deprecated method.
97
- throw new Error('Deprecated; use Event() instead.');
98
- }
99
- /**
100
- * If invoked when the cancelable attribute value is true, and while
101
- * executing a listener for the event with passive set to false, signals to
102
- * the operation that caused event to be dispatched that it needs to be
103
- * canceled.
104
- */
105
- preventDefault() {
106
- if (!this.cancelable) {
107
- return;
108
- }
109
- this.defaultPrevented = true;
110
- }
111
- /**
112
- * Invoking this method prevents event from reaching any registered event
113
- * listeners after the current one finishes running and, when dispatched in
114
- * a tree, also prevents event from reaching any other objects.
115
- */
116
- stopImmediatePropagation() {
117
- this.propagationState = EventPropagationState.stopImmediate;
118
- }
119
- /**
120
- * When dispatched in a tree, invoking this method prevents event from
121
- * reaching any objects other than the current object.
122
- */
123
- stopPropagation() {
124
- this.propagationState = EventPropagationState.stop;
125
- }
126
- /**
127
- * Dispatches a synthetic event event to target and returns true if either
128
- * event's cancelable attribute value is false or its preventDefault()
129
- * method was not invoked, and false otherwise.
130
- */
131
- // Taking multiple params rather than a single property bag saves about 100
132
- // nanoseconds per call.
133
- dispatchTo(target, data, getGlobalEventHandlers) {
134
- if (this.eventPhase !== DOMEvent.NONE) {
135
- throw new Error('Tried to dispatch a dispatching event');
136
- }
137
- this.eventPhase = DOMEvent.CAPTURING_PHASE;
138
- this.target = target;
139
- this.defaultPrevented = false;
140
- // `Observable.removeEventListener` would likely suffice, but grabbing
141
- // the static method named `removeEventListener` on the target's class
142
- // allows us to be robust to the possiblity of the case of the target
143
- // overriding it (however unlikely).
144
- //
145
- // Rather than eagerly binding the context to the function right here,
146
- // we pass the function along with its context to handleEvent() to allow
147
- // binding only once needed - doing this for each of the
148
- // removeEventListener callbacks saves 100 nanoseconds per dispatchTo()
149
- // call.
150
- const removeGlobalEventListener = target.constructor.removeEventListener;
151
- // Global event handlers are a NativeScript-only concept, so we'll not
152
- // try to add new formal event phases for them (as that could break DOM
153
- // libraries expecting strictly four phases).
154
- //
155
- // Instead, events handled by global event handlers will exhibit the
156
- // following values:
157
- // - For 'pre-handling phase' global event handlers:
158
- // - eventPhase: CAPTURING_PHASE
159
- // - currentTarget: null
160
- // - For 'post-handling phase' global event handlers:
161
- // - eventPhase: BUBBLING_PHASE
162
- // - currentTarget: The value of currentTarget following the capturing
163
- // and bubbling phases.
164
- // So effectively, we don't make any changes when handling a global
165
- // event. This keeps behaviour as consistent with DOM Events as
166
- // possible.
167
- this.handleEvent(data, true, () => getGlobalEventHandlers?.(data, 'First') ?? emptyArray, DOMEvent.CAPTURING_PHASE, removeGlobalEventListener, target.constructor);
168
- const eventPath = this.getEventPath(target, 'capture');
169
- // Capturing phase, e.g. [Page, StackLayout, Button]
170
- // This traditional C loop runs 150 nanoseconds faster than a for...of
171
- // loop.
172
- for (let i = 0; i < eventPath.length; i++) {
173
- const currentTarget = eventPath[i];
174
- this.currentTarget = currentTarget;
175
- this.eventPhase = this.target === this.currentTarget ? DOMEvent.AT_TARGET : DOMEvent.CAPTURING_PHASE;
176
- this.handleEvent(data, false, () => currentTarget.getEventList(this.type) ?? emptyArray, DOMEvent.CAPTURING_PHASE, currentTarget.removeEventListener, currentTarget);
177
- if (this.propagationState !== EventPropagationState.resume) {
178
- this.resetForRedispatch();
179
- return !this.defaultPrevented;
180
- }
181
- }
182
- // Bubbling phase, e.g. [Button, StackLayout, Page]
183
- // It's correct to dispatch the event to the target during both phases.
184
- for (let i = eventPath.length - 1; i >= 0; i--) {
185
- const currentTarget = eventPath[i];
186
- this.currentTarget = currentTarget;
187
- this.eventPhase = this.target === this.currentTarget ? DOMEvent.AT_TARGET : DOMEvent.BUBBLING_PHASE;
188
- this.handleEvent(data, false, () => currentTarget.getEventList(this.type) ?? emptyArray, DOMEvent.BUBBLING_PHASE, currentTarget.removeEventListener, currentTarget);
189
- if (this.propagationState !== EventPropagationState.resume) {
190
- this.resetForRedispatch();
191
- return !this.defaultPrevented;
192
- }
193
- // If the event doesn't bubble, then, having dispatched it at the
194
- // target (the first iteration of this loop) we don't let it
195
- // propagate any further.
196
- if (!this.bubbles) {
197
- this.resetForRedispatch();
198
- break;
199
- }
200
- // Restore event phase in case it changed to AT_TARGET during
201
- // this.handleEvent().
202
- this.eventPhase = DOMEvent.BUBBLING_PHASE;
203
- }
204
- this.handleEvent(data, true, () => getGlobalEventHandlers?.(data, '') ?? emptyArray, DOMEvent.BUBBLING_PHASE, removeGlobalEventListener, target.constructor);
205
- this.resetForRedispatch();
206
- return !this.defaultPrevented;
207
- }
208
- // Taking multiple params instead of a single property bag saves 250
209
- // nanoseconds per dispatchTo() call.
210
- handleEvent(data, isGlobal, getListeners, phase, removeEventListener, removeEventListenerContext) {
211
- // Clone the array just before any mutations. I tried swapping this out
212
- // for a copy-on-write array, but as it had to maintain its own array of
213
- // listeners for any write actions, it actually ran significantly
214
- // slower.
215
- //
216
- // There's no clear observable difference between array spread and slice
217
- // here, but I think slice has reason to run faster.
218
- const listeners = getListeners().slice();
219
- for (let i = listeners.length - 1; i >= 0; i--) {
220
- const listener = listeners[i];
221
- // Assigning variables this old-fashioned way is up to 50
222
- // nanoseconds faster per run than ESM destructuring syntax.
223
- const capture = listener.capture;
224
- // Handle only the events appropriate to the phase. Global events
225
- // (a NativeScript-only concept) are allowed to be handled
226
- // regardless of phase, for backwards-compatibility.
227
- if (!isGlobal && ((phase === DOMEvent.CAPTURING_PHASE && !capture) || (phase === DOMEvent.BUBBLING_PHASE && capture))) {
228
- continue;
229
- }
230
- // The event listener may have been removed since we took a copy of
231
- // the array, so bail out if so.
232
- //
233
- // We simply use a strict equality check here because we trust that
234
- // the listeners provider will never allow two deeply-equal
235
- // listeners into the array.
236
- //
237
- // This check costs 150 ns per dispatchTo(). I experimented with
238
- // optimising this by building a Set of ListenerEntries that got
239
- // removed during this handleEvent() (by introducing a method to
240
- // MutationSensitiveArray called afterRemoval, similar to
241
- // beforeMutation) to allow O(1) lookup, but it went 1000 ns slower
242
- // in practice, so it stays!
243
- if (!getListeners().includes(listener)) {
244
- continue;
245
- }
246
- const callback = listener.callback;
247
- const thisArg = listener.thisArg;
248
- if (listener.once) {
249
- // Calling with the context (rather than eagerly pre-binding it)
250
- // saves about 100 nanoseconds per dispatchTo() call.
251
- removeEventListener.call(removeEventListenerContext, this.type, callback, thisArg, capture);
252
- }
253
- // Internal API to facilitate testing - to be removed once we've
254
- // completed the breaking changes to migrate fully to DOMEvents.
255
- //
256
- // We update DOMEvent.unstable_currentEvent just before each call to
257
- // the callback. Doing it only in dispatchTo() would seem more
258
- // efficient, but it wouldn't technically be correct as it's
259
- // possible for a callback itself to dispatch another event. Because
260
- // we handle events synchronously rather than using a queue, it
261
- // would mean that DOMEvent.unstable_currentEvent would correctly
262
- // point at the sub-event, but subsequently fail to update to point
263
- // at the initial event.
264
- //
265
- // Note that this will fail to set itself back to null if the
266
- // callback throws an error, but that's unlikely to break anything
267
- // in practice as it's only intended be valid when accessed
268
- // during the callback anyway. We reset it mainly just to stop
269
- // retaining the event.
270
- DOMEvent.unstable_currentEvent = this;
271
- // Consistent with the original implementation, we only apply
272
- // context to the function if thisArg is truthy.
273
- //
274
- // We prefer Function.call() over Function.apply() as it avoids
275
- // having to allocate an array just to hold the args (saves 30
276
- // nanoseconds per dispatchTo() call).
277
- const returnValue = callback.call(thisArg || undefined, data);
278
- DOMEvent.unstable_currentEvent = null;
279
- // This ensures that errors thrown inside asynchronous functions do
280
- // not get swallowed.
281
- //
282
- // This check costs only 25 nanoseconds per dispatchTo(), so is not
283
- // a huge deal.
284
- if (returnValue instanceof Promise) {
285
- returnValue.catch(console.error);
286
- }
287
- if (listener.passive && this.defaultPrevented) {
288
- console.warn('Unexpected call to event.preventDefault() in passive event listener.');
289
- }
290
- if (this.propagationState === EventPropagationState.stopImmediate) {
291
- break;
292
- }
293
- }
294
- // Make sure we clear the callback before we exit the function,
295
- // otherwise we may wastefully clone the array on future mutations.
296
- }
297
- /**
298
- * Resets any internal state to allow the event to be redispatched. Call
299
- * this before returning from dispatchTo().
300
- */
301
- // Declaring this on the prototype rather than as an arrow function saves
302
- // 190 nanoseconds per dispatchTo().
303
- resetForRedispatch() {
304
- this.currentTarget = null;
305
- this.target = null;
306
- this.eventPhase = DOMEvent.NONE;
307
- this.propagationState = EventPropagationState.resume;
308
- }
309
- }
310
- /**
311
- * @private
312
- * Internal API to facilitate testing - to be removed once we've completed
313
- * the breaking changes to migrate fully to DOMEvents.
314
- *
315
- * Gets the last event to be dispatched, allowing you to access the DOM
316
- * Event that corresponds to the currently-running callback.
317
- */
318
- DOMEvent.unstable_currentEvent = null;
319
- // Assigning properties directly to the prototype where possible avoids
320
- // wasted work in the constructor on each instance construction.
321
- DOMEvent.NONE = 0;
322
- DOMEvent.CAPTURING_PHASE = 1;
323
- DOMEvent.AT_TARGET = 2;
324
- DOMEvent.BUBBLING_PHASE = 3;
325
- // Assigning initial property values directly on the prototype where
326
- // possible avoids wasted work in the constructor on each instance
327
- // construction. It's ugly, but saves about 100 nanoseconds per
328
- // construction.
329
- (() => {
330
- Object.defineProperty(DOMEvent.prototype, 'NONE', { value: DOMEvent.NONE });
331
- Object.defineProperty(DOMEvent.prototype, 'CAPTURING_PHASE', { value: DOMEvent.CAPTURING_PHASE });
332
- Object.defineProperty(DOMEvent.prototype, 'AT_TARGET', { value: DOMEvent.AT_TARGET });
333
- Object.defineProperty(DOMEvent.prototype, 'BUBBLING_PHASE', { value: DOMEvent.BUBBLING_PHASE });
334
- Object.defineProperty(DOMEvent.prototype, 'cancelBubble', { value: false, writable: true });
335
- Object.defineProperty(DOMEvent.prototype, 'defaultPrevented', { value: false, writable: true });
336
- Object.defineProperty(DOMEvent.prototype, 'isTrusted', { value: false, writable: true, enumerable: true });
337
- Object.defineProperty(DOMEvent.prototype, 'eventPhase', { value: DOMEvent.NONE, writable: true });
338
- Object.defineProperty(DOMEvent.prototype, 'currentTarget', { value: null, writable: true });
339
- Object.defineProperty(DOMEvent.prototype, 'target', { value: null, writable: true });
340
- Object.defineProperty(DOMEvent.prototype, 'propagationState', { value: EventPropagationState.resume, writable: true });
341
- })();
342
- //# sourceMappingURL=dom-event.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom-event.js","sourceRoot":"","sources":["../../../../../packages/core/data/dom-events/dom-event.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,+EAA+E;AAC/E,gFAAgF;AAChF,uBAAuB;AAEvB,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAE9B;;;;GAIG;AACH,MAAM,UAAU,GAAoB,EAAE,CAAC;AAEvC,IAAK,qBAIJ;AAJD,WAAK,qBAAqB;IACzB,qEAAM,CAAA;IACN,iEAAI,CAAA;IACJ,mFAAa,CAAA;AACd,CAAC,EAJI,qBAAqB,KAArB,qBAAqB,QAIzB;AAED,MAAM,OAAO,QAAQ;IAyIpB;IACC;;OAEG;IACI,IAAY,EACnB,OAAyB;QADlB,SAAI,GAAJ,IAAI,CAAQ;QAjBpB;;;;WAIG;QACc,sBAAiB,GAAiB,EAAE,CAAC;QAEtD;;;WAGG;QACM,cAAS,GAAwB,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QASjE,wEAAwE;QACxE,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,KAAK,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,KAAK,CAAC;QAC/C,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,KAAK,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,IAAI,CAAC;IACvC,CAAC;IA5ED,gDAAgD;IAChD,IAAI,WAAW;QACd,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED,kBAAkB;IAClB,IAAI,UAAU;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AAS,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5F,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACrF,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,KAAK,EAAE,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACxH,CAAC,GAAA,CAAA"}
@@ -1,9 +0,0 @@
1
- declare class Profiler {
2
- private map;
3
- profile<T>(key: string, action: () => T): T;
4
- flush(): Record<string, number>;
5
- get(key: string): number;
6
- report(map?: Record<string, number>): [string, number][];
7
- }
8
- export declare const jamieProfiler: Profiler;
9
- export {};
@@ -1,32 +0,0 @@
1
- class Profiler {
2
- constructor() {
3
- this.map = {};
4
- }
5
- profile(key, action) {
6
- const start = global.isIOS ? global.performance.now() : __time();
7
- const returnValue = action();
8
- const stop = global.isIOS ? global.performance.now() : __time();
9
- const period = stop - start;
10
- this.map[key] = (this.map[key] || 0) + period;
11
- // console.log(`[PROFILE] ${key}: ${stop - start} ms`);
12
- return returnValue;
13
- }
14
- flush() {
15
- const map = this.map;
16
- this.map = {};
17
- return map;
18
- }
19
- get(key) {
20
- return this.map[key];
21
- }
22
- report(map = this.map) {
23
- return Object.entries(map).sort(([, valueA], [, valueB]) => {
24
- return sortDescending(valueA, valueB);
25
- });
26
- }
27
- }
28
- function sortDescending(a, b) {
29
- return a < b ? 1 : a > b ? -1 : 0;
30
- }
31
- export const jamieProfiler = new Profiler();
32
- //# sourceMappingURL=jamie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jamie.js","sourceRoot":"","sources":["../../../../packages/core/profiling/jamie.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ;IAAd;QAC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CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,QAAQ,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- import { NavigationTransition } from '.';
2
- export declare function _createIOSAnimatedTransitioning(navigationTransition: NavigationTransition, nativeCurve: UIViewAnimationCurve, operation: UINavigationControllerOperation, fromVC: UIViewController, toVC: UIViewController): UIViewControllerAnimatedTransitioning;
@@ -1,85 +0,0 @@
1
- import { SlideTransition } from '../transition/slide-transition';
2
- import { FadeTransition } from '../transition/fade-transition';
3
- import { Trace } from '../../trace';
4
- var UIViewControllerAnimatedTransitioningMethods;
5
- (function (UIViewControllerAnimatedTransitioningMethods) {
6
- const methodSignature = NSMethodSignature.signatureWithObjCTypes('v@:c');
7
- const invocation = NSInvocation.invocationWithMethodSignature(methodSignature);
8
- invocation.selector = 'completeTransition:';
9
- function completeTransition(didComplete) {
10
- const didCompleteReference = new interop.Reference(interop.types.bool, didComplete);
11
- invocation.setArgumentAtIndex(didCompleteReference, 2);
12
- invocation.invokeWithTarget(this);
13
- }
14
- UIViewControllerAnimatedTransitioningMethods.completeTransition = completeTransition;
15
- })(UIViewControllerAnimatedTransitioningMethods || (UIViewControllerAnimatedTransitioningMethods = {}));
16
- var AnimatedTransitioning = /** @class */ (function (_super) {
17
- __extends(AnimatedTransitioning, _super);
18
- function AnimatedTransitioning() {
19
- return _super !== null && _super.apply(this, arguments) || this;
20
- }
21
- AnimatedTransitioning.init = function (transition, operation, fromVC, toVC) {
22
- var impl = AnimatedTransitioning.new();
23
- impl._transition = transition;
24
- impl._operation = operation;
25
- impl._fromVC = fromVC;
26
- impl._toVC = toVC;
27
- return impl;
28
- };
29
- AnimatedTransitioning.prototype.animateTransition = function (transitionContext) {
30
- var containerView = transitionContext.valueForKey('containerView');
31
- var completion = UIViewControllerAnimatedTransitioningMethods.completeTransition.bind(transitionContext);
32
- switch (this._operation) {
33
- case UINavigationControllerOperation.Push:
34
- this._transitionType = 'push';
35
- break;
36
- case UINavigationControllerOperation.Pop:
37
- this._transitionType = 'pop';
38
- break;
39
- case UINavigationControllerOperation.None:
40
- this._transitionType = 'none';
41
- break;
42
- }
43
- if (Trace.isEnabled()) {
44
- Trace.write("START ".concat(this._transition, " ").concat(this._transitionType), Trace.categories.Transition);
45
- }
46
- this._transition.animateIOSTransition(containerView, this._fromVC.view, this._toVC.view, this._operation, completion);
47
- };
48
- AnimatedTransitioning.prototype.transitionDuration = function (transitionContext) {
49
- return this._transition.getDuration();
50
- };
51
- AnimatedTransitioning.prototype.animationEnded = function (transitionCompleted) {
52
- if (transitionCompleted) {
53
- if (Trace.isEnabled()) {
54
- Trace.write("END ".concat(this._transition, " ").concat(this._transitionType), Trace.categories.Transition);
55
- }
56
- }
57
- else {
58
- if (Trace.isEnabled()) {
59
- Trace.write("CANCEL ".concat(this._transition, " ").concat(this._transitionType), Trace.categories.Transition);
60
- }
61
- }
62
- };
63
- AnimatedTransitioning.ObjCProtocols = [UIViewControllerAnimatedTransitioning];
64
- return AnimatedTransitioning;
65
- }(NSObject));
66
- export function _createIOSAnimatedTransitioning(navigationTransition, nativeCurve, operation, fromVC, toVC) {
67
- const instance = navigationTransition.instance;
68
- let transition;
69
- if (instance) {
70
- // Instance transition should take precedence even if the given name match existing transition.
71
- transition = instance;
72
- }
73
- else if (navigationTransition.name) {
74
- const name = navigationTransition.name.toLowerCase();
75
- if (name.indexOf('slide') === 0) {
76
- const direction = name.substr('slide'.length) || 'left'; //Extract the direction from the string
77
- transition = new SlideTransition(direction, navigationTransition.duration, nativeCurve);
78
- }
79
- else if (name === 'fade') {
80
- transition = new FadeTransition(navigationTransition.duration, nativeCurve);
81
- }
82
- }
83
- return transition ? AnimatedTransitioning.init(transition, operation, fromVC, toVC) : undefined;
84
- }
85
- //# sourceMappingURL=fragment.transitions.ios.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frag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