@nativescript/core 9.0.0-alpha.2 → 9.0.0-alpha.20

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 (225) hide show
  1. package/application/application-common.d.ts +1 -0
  2. package/application/application-common.js +45 -3
  3. package/application/application-common.js.map +1 -1
  4. package/application/application.android.js +12 -30
  5. package/application/application.android.js.map +1 -1
  6. package/application/application.ios.js +17 -1
  7. package/application/application.ios.js.map +1 -1
  8. package/application/helpers-common.d.ts +12 -2
  9. package/application/helpers-common.js +37 -3
  10. package/application/helpers-common.js.map +1 -1
  11. package/application/helpers.android.js.map +1 -1
  12. package/application-settings/index.android.js.map +1 -1
  13. package/connectivity/index.android.js.map +1 -1
  14. package/core-types/index.d.ts +2 -1
  15. package/core-types/index.js +1 -0
  16. package/core-types/index.js.map +1 -1
  17. package/css/css-tree-parser.js +2 -2
  18. package/css/css-tree-parser.js.map +1 -1
  19. package/debugger/webinspector-network.android.js.map +1 -1
  20. package/file-system/file-system-access.android.js +31 -31
  21. package/file-system/file-system-access.android.js.map +1 -1
  22. package/file-system/file-system-access.ios.js +3 -4
  23. package/file-system/file-system-access.ios.js.map +1 -1
  24. package/file-system/index.d.ts +2 -2
  25. package/file-system/index.js.map +1 -1
  26. package/fps-meter/fps-native.android.d.ts +1 -2
  27. package/fps-meter/fps-native.android.js.map +1 -1
  28. package/fps-meter/fps-native.ios.d.ts +1 -2
  29. package/fps-meter/fps-native.ios.js.map +1 -1
  30. package/global-types.d.ts +7 -8
  31. package/globals/global-utils.d.ts +27 -0
  32. package/globals/global-utils.js +67 -0
  33. package/globals/global-utils.js.map +1 -0
  34. package/globals/index.d.ts +3 -7
  35. package/globals/index.js +234 -271
  36. package/globals/index.js.map +1 -1
  37. package/http/http-request/index.d.ts +4 -0
  38. package/http/index.d.ts +5 -104
  39. package/http/index.js +1 -1
  40. package/http/index.js.map +1 -1
  41. package/image-asset/index.android.js +3 -3
  42. package/image-asset/index.android.js.map +1 -1
  43. package/index.d.ts +7 -6
  44. package/index.js +1 -0
  45. package/index.js.map +1 -1
  46. package/inspector_modules.d.ts +3 -0
  47. package/inspector_modules.js +142 -3
  48. package/inspector_modules.js.map +1 -1
  49. package/module-name-resolver/index.d.ts +13 -14
  50. package/module-name-resolver/index.js.map +1 -1
  51. package/module-name-resolver/qualifier-matcher/index.d.ts +6 -12
  52. package/module-name-resolver/qualifier-matcher/index.js +5 -5
  53. package/module-name-resolver/qualifier-matcher/index.js.map +1 -1
  54. package/package.json +12 -9
  55. package/platforms/android/widgets-release.aar +0 -0
  56. package/profiling/index.js +0 -4
  57. package/profiling/index.js.map +1 -1
  58. package/timer/index.android.js +15 -7
  59. package/timer/index.android.js.map +1 -1
  60. package/ui/action-bar/index.android.d.ts +0 -4
  61. package/ui/action-bar/index.android.js +1 -1
  62. package/ui/action-bar/index.android.js.map +1 -1
  63. package/ui/action-bar/index.ios.d.ts +1 -11
  64. package/ui/action-bar/index.ios.js +26 -0
  65. package/ui/action-bar/index.ios.js.map +1 -1
  66. package/ui/activity-indicator/index.android.d.ts +0 -3
  67. package/ui/activity-indicator/index.ios.d.ts +0 -3
  68. package/ui/animation/index.ios.js +38 -27
  69. package/ui/animation/index.ios.js.map +1 -1
  70. package/ui/builder/binding-builder.d.ts +12 -15
  71. package/ui/builder/component-builder/index.js +3 -3
  72. package/ui/builder/component-builder/index.js.map +1 -1
  73. package/ui/builder/index.d.ts +179 -59
  74. package/ui/builder/index.js +35 -7
  75. package/ui/builder/index.js.map +1 -1
  76. package/ui/button/index.android.d.ts +0 -6
  77. package/ui/button/index.android.js +2 -0
  78. package/ui/button/index.android.js.map +1 -1
  79. package/ui/button/index.ios.d.ts +0 -11
  80. package/ui/core/properties/index.d.ts +4 -3
  81. package/ui/core/properties/index.js +66 -52
  82. package/ui/core/properties/index.js.map +1 -1
  83. package/ui/core/view/index.android.d.ts +18 -45
  84. package/ui/core/view/index.android.js +489 -112
  85. package/ui/core/view/index.android.js.map +1 -1
  86. package/ui/core/view/index.d.ts +26 -0
  87. package/ui/core/view/index.ios.d.ts +8 -31
  88. package/ui/core/view/index.ios.js +74 -18
  89. package/ui/core/view/index.ios.js.map +1 -1
  90. package/ui/core/view/view-common.d.ts +15 -0
  91. package/ui/core/view/view-common.js +13 -0
  92. package/ui/core/view/view-common.js.map +1 -1
  93. package/ui/core/view/view-helper/index.ios.d.ts +1 -0
  94. package/ui/core/view/view-helper/index.ios.js +20 -0
  95. package/ui/core/view/view-helper/index.ios.js.map +1 -1
  96. package/ui/core/view/view-interfaces.d.ts +19 -0
  97. package/ui/core/view-base/index.d.ts +6 -2
  98. package/ui/core/view-base/index.js +1 -1
  99. package/ui/core/view-base/index.js.map +1 -1
  100. package/ui/date-picker/index.android.d.ts +0 -6
  101. package/ui/date-picker/index.ios.d.ts +0 -12
  102. package/ui/dialogs/index.android.js +8 -7
  103. package/ui/dialogs/index.android.js.map +1 -1
  104. package/ui/dialogs/index.ios.js +4 -2
  105. package/ui/dialogs/index.ios.js.map +1 -1
  106. package/ui/editable-text-base/editable-text-base-common.js +1 -1
  107. package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
  108. package/ui/editable-text-base/index.android.d.ts +1 -12
  109. package/ui/editable-text-base/index.android.js +3 -0
  110. package/ui/editable-text-base/index.android.js.map +1 -1
  111. package/ui/editable-text-base/index.ios.d.ts +1 -6
  112. package/ui/editable-text-base/index.ios.js +3 -0
  113. package/ui/editable-text-base/index.ios.js.map +1 -1
  114. package/ui/embedding/index.android.d.ts +1 -1
  115. package/ui/embedding/index.d.ts +1 -1
  116. package/ui/frame/activity.android.js +3 -0
  117. package/ui/frame/activity.android.js.map +1 -1
  118. package/ui/frame/fragment.transitions.android.d.ts +3 -0
  119. package/ui/frame/fragment.transitions.android.js +53 -10
  120. package/ui/frame/fragment.transitions.android.js.map +1 -1
  121. package/ui/frame/fragment.transitions.d.ts +9 -1
  122. package/ui/frame/frame-common.d.ts +1 -1
  123. package/ui/frame/frame-common.js.map +1 -1
  124. package/ui/frame/frame-helper-for-android.js.map +1 -1
  125. package/ui/frame/frame-interfaces.d.ts +45 -9
  126. package/ui/frame/index.android.d.ts +13 -3
  127. package/ui/frame/index.android.js +63 -62
  128. package/ui/frame/index.android.js.map +1 -1
  129. package/ui/frame/index.d.ts +1 -41
  130. package/ui/frame/index.ios.d.ts +3 -2
  131. package/ui/frame/index.ios.js.map +1 -1
  132. package/ui/html-view/index.android.d.ts +0 -8
  133. package/ui/html-view/index.ios.d.ts +0 -5
  134. package/ui/image/index.android.d.ts +0 -4
  135. package/ui/image/index.ios.d.ts +2 -2
  136. package/ui/image/index.ios.js +0 -1
  137. package/ui/image/index.ios.js.map +1 -1
  138. package/ui/index.d.ts +9 -4
  139. package/ui/index.js +13 -4
  140. package/ui/index.js.map +1 -1
  141. package/ui/layouts/dock-layout/index.android.d.ts +0 -1
  142. package/ui/layouts/flexbox-layout/index.android.d.ts +0 -5
  143. package/ui/layouts/flexbox-layout/index.ios.js +25 -13
  144. package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
  145. package/ui/layouts/index.d.ts +3 -1
  146. package/ui/layouts/index.js.map +1 -1
  147. package/ui/layouts/layout-base.android.d.ts +0 -6
  148. package/ui/layouts/layout-base.ios.d.ts +0 -2
  149. package/ui/list-picker/index.android.d.ts +0 -3
  150. package/ui/list-picker/index.ios.d.ts +0 -3
  151. package/ui/list-view/index.android.d.ts +0 -5
  152. package/ui/list-view/index.ios.d.ts +0 -3
  153. package/ui/page/index.android.d.ts +0 -6
  154. package/ui/page/index.d.ts +0 -8
  155. package/ui/page/index.ios.d.ts +0 -2
  156. package/ui/page/index.ios.js +6 -1
  157. package/ui/page/index.ios.js.map +1 -1
  158. package/ui/page/page-common.d.ts +0 -2
  159. package/ui/page/page-common.js +0 -6
  160. package/ui/page/page-common.js.map +1 -1
  161. package/ui/progress/index.android.d.ts +0 -5
  162. package/ui/progress/index.ios.d.ts +0 -5
  163. package/ui/scroll-view/index.android.d.ts +0 -3
  164. package/ui/scroll-view/index.ios.d.ts +0 -2
  165. package/ui/search-bar/index.android.d.ts +2 -14
  166. package/ui/search-bar/index.android.js +0 -2
  167. package/ui/search-bar/index.android.js.map +1 -1
  168. package/ui/search-bar/index.ios.d.ts +1 -10
  169. package/ui/search-bar/index.ios.js +0 -2
  170. package/ui/search-bar/index.ios.js.map +1 -1
  171. package/ui/segmented-bar/index.android.d.ts +0 -9
  172. package/ui/segmented-bar/index.ios.d.ts +0 -5
  173. package/ui/slider/index.android.d.ts +0 -6
  174. package/ui/slider/index.ios.d.ts +0 -6
  175. package/ui/styling/background.android.js +1 -1
  176. package/ui/styling/background.android.js.map +1 -1
  177. package/ui/styling/css-stroke.js.map +1 -1
  178. package/ui/styling/font.android.js +2 -2
  179. package/ui/styling/font.android.js.map +1 -1
  180. package/ui/styling/style-scope.js +5 -13
  181. package/ui/styling/style-scope.js.map +1 -1
  182. package/ui/switch/index.android.d.ts +0 -5
  183. package/ui/switch/index.ios.d.ts +0 -6
  184. package/ui/switch/index.ios.js +0 -13
  185. package/ui/switch/index.ios.js.map +1 -1
  186. package/ui/tab-view/index.android.d.ts +0 -16
  187. package/ui/tab-view/index.android.js.map +1 -1
  188. package/ui/tab-view/index.ios.d.ts +0 -10
  189. package/ui/text-base/index.android.d.ts +5 -28
  190. package/ui/text-base/index.android.js +12 -16
  191. package/ui/text-base/index.android.js.map +1 -1
  192. package/ui/text-base/index.ios.d.ts +0 -16
  193. package/ui/text-field/index.android.js +3 -0
  194. package/ui/text-field/index.android.js.map +1 -1
  195. package/ui/text-field/index.ios.d.ts +0 -13
  196. package/ui/text-field/index.ios.js +1 -1
  197. package/ui/text-field/index.ios.js.map +1 -1
  198. package/ui/text-view/index.ios.d.ts +0 -15
  199. package/ui/time-picker/index.ios.d.ts +0 -9
  200. package/ui/transition/page-transition.android.d.ts +1 -1
  201. package/ui/transition/page-transition.android.js +19 -5
  202. package/ui/transition/page-transition.android.js.map +1 -1
  203. package/ui/web-view/web-view-common.d.ts +0 -1
  204. package/utils/common.js +1 -1
  205. package/utils/common.js.map +1 -1
  206. package/utils/constants.android.d.ts +1 -0
  207. package/utils/constants.android.js +3 -0
  208. package/utils/constants.android.js.map +1 -1
  209. package/utils/constants.d.ts +1 -0
  210. package/utils/constants.ios.d.ts +1 -0
  211. package/utils/constants.ios.js +3 -0
  212. package/utils/constants.ios.js.map +1 -1
  213. package/utils/debug-source.js +1 -1
  214. package/utils/debug-source.js.map +1 -1
  215. package/utils/index.android.js +7 -7
  216. package/utils/layout-helper/index.android.js +3 -3
  217. package/utils/native-helper-for-android.d.ts +11 -0
  218. package/utils/native-helper-for-android.js +100 -0
  219. package/utils/native-helper-for-android.js.map +1 -1
  220. package/utils/native-helper.android.d.ts +13 -1
  221. package/utils/native-helper.android.js +8 -1
  222. package/utils/native-helper.android.js.map +1 -1
  223. package/utils/native-helper.d.ts +137 -201
  224. package/utils/native-helper.ios.js +0 -3
  225. package/utils/native-helper.ios.js.map +1 -1
@@ -1,3 +1,4 @@
1
+ import { getNativeScriptGlobals } from '../../../globals/global-utils';
1
2
  import { ViewCommon, isEnabledProperty, originXProperty, originYProperty, isUserInteractionEnabledProperty, testIDProperty, AndroidHelper } from './view-common';
2
3
  import { paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty } from '../../styling/style-properties';
3
4
  import { Length } from '../../styling/length-shared';
@@ -96,7 +97,7 @@ function initializeDialogFragment() {
96
97
  cancel: false,
97
98
  };
98
99
  // Fist fire application.android global event
99
- global.NativeScriptGlobals.events.notify(args);
100
+ getNativeScriptGlobals().events.notify(args);
100
101
  if (args.cancel) {
101
102
  return;
102
103
  }
@@ -241,7 +242,103 @@ function removeModal(domId) {
241
242
  function getModalOptions(domId) {
242
243
  return modalMap.get(domId);
243
244
  }
245
+ const INSET_LEFT = 0;
246
+ const INSET_TOP = 4;
247
+ const INSET_RIGHT = 8;
248
+ const INSET_BOTTOM = 12;
249
+ const INSET_LEFT_CONSUMED = 16;
250
+ const INSET_TOP_CONSUMED = 20;
251
+ const INSET_RIGHT_CONSUMED = 24;
252
+ const INSET_BOTTOM_CONSUMED = 28;
253
+ const OverflowEdgeNone = 0;
254
+ const OverflowEdgeLeft = 1;
255
+ const OverflowEdgeTop = 1 << 1;
256
+ const OverflowEdgeRight = 1 << 2;
257
+ const OverflowEdgeBottom = 1 << 3;
258
+ const OverflowEdgeDontApply = 1 << 4;
259
+ const OverflowEdgeLeftDontConsume = 1 << 5;
260
+ const OverflowEdgeTopDontConsume = 1 << 6;
261
+ const OverflowEdgeRightDontConsume = 1 << 7;
262
+ const OverflowEdgeBottomDontConsume = 1 << 8;
263
+ const OverflowEdgeAllButLeft = 1 << 9;
264
+ const OverflowEdgeAllButTop = 1 << 10;
265
+ const OverflowEdgeAllButRight = 1 << 11;
266
+ const OverflowEdgeAllButBottom = 1 << 12;
267
+ class Inset {
268
+ constructor(data) {
269
+ this.data = ArrayBuffer.from(data);
270
+ this.view = new DataView(this.data);
271
+ }
272
+ get left() {
273
+ return this.view.getInt32(INSET_LEFT, true);
274
+ }
275
+ set left(value) {
276
+ this.view.setInt32(INSET_LEFT, value, true);
277
+ }
278
+ get top() {
279
+ return this.view.getInt32(INSET_TOP, true);
280
+ }
281
+ set top(value) {
282
+ this.view.setInt32(INSET_TOP, value, true);
283
+ }
284
+ get right() {
285
+ return this.view.getInt32(INSET_RIGHT, true);
286
+ }
287
+ set right(value) {
288
+ this.view.setInt32(INSET_RIGHT, value, true);
289
+ }
290
+ get bottom() {
291
+ return this.view.getInt32(INSET_BOTTOM, true);
292
+ }
293
+ set bottom(value) {
294
+ this.view.setInt32(INSET_BOTTOM, value, true);
295
+ }
296
+ get leftConsumed() {
297
+ return this.view.getInt32(INSET_LEFT_CONSUMED, true) > 0;
298
+ }
299
+ set leftConsumed(value) {
300
+ this.view.setInt32(INSET_LEFT_CONSUMED, value ? 1 : 0, true);
301
+ }
302
+ get topConsumed() {
303
+ return this.view.getInt32(INSET_TOP_CONSUMED, true) > 0;
304
+ }
305
+ set topConsumed(value) {
306
+ this.view.setInt32(INSET_TOP_CONSUMED, value ? 1 : 0, true);
307
+ }
308
+ get rightConsumed() {
309
+ return this.view.getInt32(INSET_RIGHT_CONSUMED, true) > 0;
310
+ }
311
+ set rightConsumed(value) {
312
+ this.view.setInt32(INSET_RIGHT_CONSUMED, value ? 1 : 0, true);
313
+ }
314
+ get bottomConsumed() {
315
+ return this.view.getInt32(INSET_BOTTOM_CONSUMED, true) > 0;
316
+ }
317
+ set bottomConsumed(value) {
318
+ this.view.setInt32(INSET_BOTTOM_CONSUMED, value ? 1 : 0, true);
319
+ }
320
+ toString() {
321
+ return `Inset: left=${this.left}, top=${this.top}, right=${this.right}, bottom=${this.bottom}, ` + `leftConsumed=${this.leftConsumed}, topConsumed=${this.topConsumed}, ` + `rightConsumed=${this.rightConsumed}, bottomConsumed=${this.bottomConsumed}`;
322
+ }
323
+ toJSON() {
324
+ return {
325
+ left: this.left,
326
+ top: this.top,
327
+ right: this.right,
328
+ bottom: this.bottom,
329
+ leftConsumed: this.leftConsumed,
330
+ topConsumed: this.topConsumed,
331
+ rightConsumed: this.rightConsumed,
332
+ bottomConsumed: this.bottomConsumed,
333
+ };
334
+ }
335
+ }
244
336
  export class View extends ViewCommon {
337
+ constructor() {
338
+ super(...arguments);
339
+ this._defaultOverflowEdge = OverflowEdgeNone;
340
+ this._defaultOverflowEdgeValue = 'none';
341
+ }
245
342
  // TODO: Implement unobserve that detach the touchListener.
246
343
  _observe(type, callback, thisArg) {
247
344
  super._observe(type, callback, thisArg);
@@ -255,6 +352,11 @@ export class View extends ViewCommon {
255
352
  if (this.isLoaded && !this.layoutChangeListenerIsSet && isLayoutEvent) {
256
353
  this.setOnLayoutChangeListener();
257
354
  }
355
+ const isInsetEvent = typeof eventNames === 'string' ? eventNames.indexOf(ViewCommon.androidOverflowInsetEvent) !== -1 : false;
356
+ // only avaiable on LayoutBase
357
+ if (!this.insetListenerIsSet && isInsetEvent) {
358
+ this.setInsetListener();
359
+ }
258
360
  }
259
361
  removeEventListener(eventNames, callback, thisArg) {
260
362
  super.removeEventListener(eventNames, callback, thisArg);
@@ -264,6 +366,38 @@ export class View extends ViewCommon {
264
366
  this.nativeViewProtected.removeOnLayoutChangeListener(this.layoutChangeListener);
265
367
  this.layoutChangeListenerIsSet = false;
266
368
  }
369
+ const isInsetEvent = typeof eventNames === 'string' ? eventNames.indexOf(ViewCommon.androidOverflowInsetEvent) !== -1 : false;
370
+ if (this.insetListenerIsSet && isInsetEvent && this.nativeViewProtected && this.nativeViewProtected.setInsetListener) {
371
+ this.nativeViewProtected.setInsetListener(null);
372
+ this.insetListenerIsSet = false;
373
+ }
374
+ }
375
+ setInsetListener() {
376
+ if (this.nativeViewProtected) {
377
+ if (this.nativeViewProtected.setInsetListener) {
378
+ const ref = new WeakRef(this);
379
+ this.nativeViewProtected.setInsetListener(new org.nativescript.widgets.LayoutBase.WindowInsetListener({
380
+ onApplyWindowInsets(param0) {
381
+ const owner = ref.get();
382
+ if (!owner) {
383
+ return;
384
+ }
385
+ const inset = new Inset(param0);
386
+ const args = {
387
+ eventName: ViewCommon.androidOverflowInsetEvent,
388
+ object: this,
389
+ inset,
390
+ };
391
+ owner.notify(args);
392
+ },
393
+ }));
394
+ this.insetListenerIsSet = true;
395
+ }
396
+ this.needsInsetListener = false;
397
+ }
398
+ else {
399
+ this.needsInsetListener = true;
400
+ }
267
401
  }
268
402
  _getChildFragmentManager() {
269
403
  return null;
@@ -312,6 +446,129 @@ export class View extends ViewCommon {
312
446
  }
313
447
  return manager;
314
448
  }
449
+ // @ts-ignore
450
+ set androidOverflowEdge(value) {
451
+ if (typeof value !== 'string') {
452
+ return;
453
+ }
454
+ const nativeView = this.nativeViewProtected;
455
+ if (nativeView && nativeView.setOverflowEdge) {
456
+ if (value === 'none') {
457
+ nativeView.setOverflowEdge(OverflowEdgeNone);
458
+ }
459
+ else {
460
+ const newValue = parseEdges(value);
461
+ if (newValue !== null) {
462
+ nativeView.setOverflowEdge(newValue);
463
+ }
464
+ }
465
+ }
466
+ else {
467
+ const edge = parseEdges(value);
468
+ if (edge === null) {
469
+ return;
470
+ }
471
+ this._defaultOverflowEdgeValue = value;
472
+ this._defaultOverflowEdge = edge;
473
+ }
474
+ }
475
+ get androidOverflowEdge() {
476
+ const nativeView = this.nativeViewProtected;
477
+ if (nativeView && nativeView.getOverflowEdge) {
478
+ const overflowEdge = nativeView.getOverflowEdge();
479
+ switch (overflowEdge) {
480
+ case OverflowEdgeNone:
481
+ return 'none';
482
+ case OverflowEdgeLeft:
483
+ return 'left';
484
+ case OverflowEdgeTop:
485
+ return 'top';
486
+ case OverflowEdgeRight:
487
+ return 'right';
488
+ case OverflowEdgeBottom:
489
+ return 'bottom';
490
+ case OverflowEdgeDontApply:
491
+ return 'dont-apply';
492
+ case OverflowEdgeLeftDontConsume:
493
+ return 'left-dont-consume';
494
+ case OverflowEdgeTopDontConsume:
495
+ return 'top-dont-consume';
496
+ case OverflowEdgeRightDontConsume:
497
+ return 'right-dont-consume';
498
+ case OverflowEdgeBottomDontConsume:
499
+ return 'bottom-dont-consume';
500
+ case OverflowEdgeAllButLeft:
501
+ return 'all-but-left';
502
+ case OverflowEdgeAllButTop:
503
+ return 'all-but-top';
504
+ case OverflowEdgeAllButRight:
505
+ return 'all-but-right';
506
+ case OverflowEdgeAllButBottom:
507
+ return 'all-but-bottom';
508
+ default:
509
+ {
510
+ let value = '';
511
+ const overflowLeftConsume = (overflowEdge & OverflowEdgeLeft) == OverflowEdgeLeft;
512
+ const overflowTopConsume = (overflowEdge & OverflowEdgeTop) == OverflowEdgeTop;
513
+ const overflowRightConsume = (overflowEdge & OverflowEdgeRight) == OverflowEdgeRight;
514
+ const overflowBottomConsume = (overflowEdge & OverflowEdgeBottom) == OverflowEdgeBottom;
515
+ const overflowLeft = (overflowEdge & OverflowEdgeLeftDontConsume) == OverflowEdgeLeftDontConsume;
516
+ const overflowTop = (overflowEdge & OverflowEdgeTopDontConsume) == OverflowEdgeTopDontConsume;
517
+ const overflowRight = (overflowEdge & OverflowEdgeRightDontConsume) == OverflowEdgeRightDontConsume;
518
+ const overflowBottom = (overflowEdge & OverflowEdgeBottomDontConsume) == OverflowEdgeBottomDontConsume;
519
+ if (overflowLeftConsume) {
520
+ value += 'left';
521
+ }
522
+ if (overflowTopConsume) {
523
+ if (value.length > 0) {
524
+ value += ',';
525
+ }
526
+ value += 'top';
527
+ }
528
+ if (overflowRightConsume) {
529
+ if (value.length > 0) {
530
+ value += ',';
531
+ }
532
+ value += 'right';
533
+ }
534
+ if (overflowBottomConsume) {
535
+ if (value.length > 0) {
536
+ value += ',';
537
+ }
538
+ value += 'bottom';
539
+ }
540
+ if (overflowLeft) {
541
+ value += 'left-dont-consume';
542
+ }
543
+ if (overflowTop) {
544
+ if (value.length > 0) {
545
+ value += ',';
546
+ }
547
+ value += 'top-dont-consume';
548
+ }
549
+ if (overflowRight) {
550
+ if (value.length > 0) {
551
+ value += ',';
552
+ }
553
+ value += 'right-dont-consume';
554
+ }
555
+ if (overflowBottom) {
556
+ if (value.length > 0) {
557
+ value += ',';
558
+ }
559
+ value += 'bottom-dont-consume';
560
+ }
561
+ }
562
+ break;
563
+ }
564
+ }
565
+ else {
566
+ if (this._defaultOverflowEdgeValue) {
567
+ return this._defaultOverflowEdgeValue;
568
+ }
569
+ }
570
+ return 'none';
571
+ }
315
572
  onLoaded() {
316
573
  this._manager = null;
317
574
  this._rootManager = null;
@@ -351,6 +608,15 @@ export class View extends ViewCommon {
351
608
  if (this.needsOnLayoutChangeListener()) {
352
609
  this.setOnLayoutChangeListener();
353
610
  }
611
+ if (!this.insetListenerIsSet && this.needsInsetListener) {
612
+ this.setInsetListener();
613
+ }
614
+ const nativeView = this.nativeViewProtected;
615
+ if (typeof this._defaultOverflowEdge === 'number') {
616
+ if (nativeView && nativeView.setOverflowEdge) {
617
+ nativeView.setOverflowEdge(this._defaultOverflowEdge);
618
+ }
619
+ }
354
620
  }
355
621
  needsOnLayoutChangeListener() {
356
622
  return this.hasListeners(ViewCommon.layoutChangedEvent);
@@ -640,28 +906,6 @@ export class View extends ViewCommon {
640
906
  [opacityProperty.setNative](value) {
641
907
  this.nativeViewProtected.setAlpha(float(value));
642
908
  }
643
- [testIDProperty.setNative](value) {
644
- this.setAccessibilityIdentifier(this.nativeViewProtected, value);
645
- }
646
- setAccessibilityIdentifier(view, value) {
647
- const id = Utils.android.resources.getId(':id/nativescript_accessibility_id');
648
- if (id) {
649
- view.setTag(id, value);
650
- view.setTag(value);
651
- }
652
- if (this.testID && this.testID !== value)
653
- this.testID = value;
654
- if (this.accessibilityIdentifier !== value)
655
- this.accessibilityIdentifier = value;
656
- }
657
- [accessibilityEnabledProperty.setNative](value) {
658
- this.nativeViewProtected.setFocusable(!!value);
659
- updateA11yPropertiesCallback(this);
660
- }
661
- [accessibilityIdentifierProperty.setNative](value) {
662
- this.setAccessibilityIdentifier(this.nativeViewProtected, value);
663
- }
664
- // @ts-expect-error
665
909
  [accessibilityRoleProperty.setNative](value) {
666
910
  this.accessibilityRole = value;
667
911
  updateA11yPropertiesCallback(this);
@@ -669,27 +913,6 @@ export class View extends ViewCommon {
669
913
  this.nativeViewProtected?.setAccessibilityHeading(value === AccessibilityRole.Header);
670
914
  }
671
915
  }
672
- [accessibilityValueProperty.setNative]() {
673
- this._androidContentDescriptionUpdated = true;
674
- updateContentDescription(this);
675
- }
676
- [accessibilityLabelProperty.setNative]() {
677
- this._androidContentDescriptionUpdated = true;
678
- updateContentDescription(this);
679
- }
680
- [accessibilityHintProperty.setNative]() {
681
- this._androidContentDescriptionUpdated = true;
682
- updateContentDescription(this);
683
- }
684
- [accessibilityHiddenProperty.setNative](value) {
685
- if (value) {
686
- this.nativeViewProtected.setImportantForAccessibility(android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
687
- }
688
- else {
689
- this.nativeViewProtected.setImportantForAccessibility(android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES);
690
- }
691
- }
692
- // @ts-expect-error
693
916
  [accessibilityLiveRegionProperty.setNative](value) {
694
917
  switch (value) {
695
918
  case AccessibilityLiveRegion.Assertive: {
@@ -706,80 +929,13 @@ export class View extends ViewCommon {
706
929
  }
707
930
  }
708
931
  }
709
- // @ts-expect-error
710
932
  [accessibilityStateProperty.setNative](value) {
711
933
  this.accessibilityState = value;
712
934
  updateA11yPropertiesCallback(this);
713
935
  }
714
- [accessibilityMediaSessionProperty.setNative]() {
715
- updateA11yPropertiesCallback(this);
716
- }
717
- [androidElevationProperty.getDefault]() {
718
- return this.getDefaultElevation();
719
- }
720
- [androidElevationProperty.setNative](value) {
721
- if (SDK_VERSION < 21) {
722
- return;
723
- }
724
- this.refreshStateListAnimator();
725
- }
726
- [androidDynamicElevationOffsetProperty.getDefault]() {
727
- return this.getDefaultDynamicElevationOffset();
728
- }
729
- [androidDynamicElevationOffsetProperty.setNative](value) {
730
- if (SDK_VERSION < 21) {
731
- return;
732
- }
733
- this.refreshStateListAnimator();
734
- }
735
- getDefaultElevation() {
736
- if (SDK_VERSION < 21) {
737
- return 0;
738
- }
739
- // NOTE: overriden in Button implementation as for widgets with StateListAnimator (Button)
740
- // nativeView.getElevation() returns 0 at the time of the getDefault() query
741
- return layout.toDeviceIndependentPixels(this.nativeViewProtected.getElevation());
742
- }
743
- getDefaultDynamicElevationOffset() {
744
- // NOTE: overriden in Button implementation
745
- return 0;
746
- }
747
- refreshStateListAnimator() {
748
- const nativeView = this.nativeViewProtected;
749
- const ObjectAnimator = android.animation.ObjectAnimator;
750
- const AnimatorSet = android.animation.AnimatorSet;
751
- const duration = nativeView.getContext().getResources().getInteger(shortAnimTime) / 2;
752
- let elevation = this.androidElevation;
753
- if (typeof elevation === 'undefined' || elevation === null) {
754
- elevation = this.getDefaultElevation();
755
- }
756
- elevation = layout.toDevicePixels(elevation);
757
- const z = layout.toDevicePixels(0);
758
- let pressedZ = this.androidDynamicElevationOffset;
759
- if (typeof pressedZ === 'undefined' || pressedZ === null) {
760
- pressedZ = this.getDefaultDynamicElevationOffset();
761
- }
762
- pressedZ = layout.toDevicePixels(pressedZ);
763
- const pressedSet = new AnimatorSet();
764
- pressedSet.playTogether(java.util.Arrays.asList([ObjectAnimator.ofFloat(nativeView, 'translationZ', [pressedZ]).setDuration(duration), ObjectAnimator.ofFloat(nativeView, 'elevation', [elevation]).setDuration(0)]));
765
- const notPressedSet = new AnimatorSet();
766
- notPressedSet.playTogether(java.util.Arrays.asList([ObjectAnimator.ofFloat(nativeView, 'translationZ', [z]).setDuration(duration), ObjectAnimator.ofFloat(nativeView, 'elevation', [elevation]).setDuration(0)]));
767
- const defaultSet = new AnimatorSet();
768
- defaultSet.playTogether(java.util.Arrays.asList([ObjectAnimator.ofFloat(nativeView, 'translationZ', [0]).setDuration(0), ObjectAnimator.ofFloat(nativeView, 'elevation', [0]).setDuration(0)]));
769
- const stateListAnimator = new android.animation.StateListAnimator();
770
- stateListAnimator.addState([statePressed, stateEnabled], pressedSet);
771
- stateListAnimator.addState([stateEnabled], notPressedSet);
772
- stateListAnimator.addState([], defaultSet);
773
- const currentAnimator = nativeView.getStateListAnimator();
774
- if (currentAnimator) {
775
- currentAnimator.jumpToCurrentState();
776
- }
777
- nativeView.setStateListAnimator(stateListAnimator);
778
- }
779
936
  [horizontalAlignmentProperty.getDefault]() {
780
937
  return org.nativescript.widgets.ViewHelper.getHorizontalAlignment(this.nativeViewProtected);
781
938
  }
782
- // @ts-expect-error
783
939
  [horizontalAlignmentProperty.setNative](value) {
784
940
  const nativeView = this.nativeViewProtected;
785
941
  const lp = nativeView.getLayoutParams() || new org.nativescript.widgets.CommonLayoutParams();
@@ -819,7 +975,6 @@ export class View extends ViewCommon {
819
975
  [verticalAlignmentProperty.getDefault]() {
820
976
  return org.nativescript.widgets.ViewHelper.getVerticalAlignment(this.nativeViewProtected);
821
977
  }
822
- // @ts-expect-error
823
978
  [verticalAlignmentProperty.setNative](value) {
824
979
  const nativeView = this.nativeViewProtected;
825
980
  const lp = nativeView.getLayoutParams() || new org.nativescript.widgets.CommonLayoutParams();
@@ -856,6 +1011,112 @@ export class View extends ViewCommon {
856
1011
  nativeView.setLayoutParams(lp);
857
1012
  }
858
1013
  }
1014
+ [testIDProperty.setNative](value) {
1015
+ this.setAccessibilityIdentifier(this.nativeViewProtected, value);
1016
+ }
1017
+ setAccessibilityIdentifier(view, value) {
1018
+ const id = Utils.android.resources.getId(':id/nativescript_accessibility_id');
1019
+ if (id) {
1020
+ view.setTag(id, value);
1021
+ view.setTag(value);
1022
+ }
1023
+ if (this.testID && this.testID !== value)
1024
+ this.testID = value;
1025
+ if (this.accessibilityIdentifier !== value)
1026
+ this.accessibilityIdentifier = value;
1027
+ }
1028
+ [accessibilityEnabledProperty.setNative](value) {
1029
+ this.nativeViewProtected.setFocusable(!!value);
1030
+ updateA11yPropertiesCallback(this);
1031
+ }
1032
+ [accessibilityIdentifierProperty.setNative](value) {
1033
+ this.setAccessibilityIdentifier(this.nativeViewProtected, value);
1034
+ }
1035
+ [accessibilityValueProperty.setNative](value) {
1036
+ this._androidContentDescriptionUpdated = true;
1037
+ updateContentDescription(this);
1038
+ }
1039
+ [accessibilityLabelProperty.setNative](value) {
1040
+ this._androidContentDescriptionUpdated = true;
1041
+ updateContentDescription(this);
1042
+ }
1043
+ [accessibilityHintProperty.setNative](value) {
1044
+ this._androidContentDescriptionUpdated = true;
1045
+ updateContentDescription(this);
1046
+ }
1047
+ [accessibilityHiddenProperty.setNative](value) {
1048
+ if (value) {
1049
+ this.nativeViewProtected.setImportantForAccessibility(android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
1050
+ }
1051
+ else {
1052
+ this.nativeViewProtected.setImportantForAccessibility(android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES);
1053
+ }
1054
+ }
1055
+ [accessibilityMediaSessionProperty.setNative](value) {
1056
+ updateA11yPropertiesCallback(this);
1057
+ }
1058
+ [androidElevationProperty.getDefault]() {
1059
+ return this.getDefaultElevation();
1060
+ }
1061
+ [androidElevationProperty.setNative](value) {
1062
+ if (SDK_VERSION < 21) {
1063
+ return;
1064
+ }
1065
+ this.refreshStateListAnimator();
1066
+ }
1067
+ [androidDynamicElevationOffsetProperty.getDefault]() {
1068
+ return this.getDefaultDynamicElevationOffset();
1069
+ }
1070
+ [androidDynamicElevationOffsetProperty.setNative](value) {
1071
+ if (SDK_VERSION < 21) {
1072
+ return;
1073
+ }
1074
+ this.refreshStateListAnimator();
1075
+ }
1076
+ getDefaultElevation() {
1077
+ if (SDK_VERSION < 21) {
1078
+ return 0;
1079
+ }
1080
+ // NOTE: overriden in Button implementation as for widgets with StateListAnimator (Button)
1081
+ // nativeView.getElevation() returns 0 at the time of the getDefault() query
1082
+ return layout.toDeviceIndependentPixels(this.nativeViewProtected.getElevation());
1083
+ }
1084
+ getDefaultDynamicElevationOffset() {
1085
+ // NOTE: overriden in Button implementation
1086
+ return 0;
1087
+ }
1088
+ refreshStateListAnimator() {
1089
+ const nativeView = this.nativeViewProtected;
1090
+ const ObjectAnimator = android.animation.ObjectAnimator;
1091
+ const AnimatorSet = android.animation.AnimatorSet;
1092
+ const duration = nativeView.getContext().getResources().getInteger(shortAnimTime) / 2;
1093
+ let elevation = this.androidElevation;
1094
+ if (typeof elevation === 'undefined' || elevation === null) {
1095
+ elevation = this.getDefaultElevation();
1096
+ }
1097
+ elevation = layout.toDevicePixels(elevation);
1098
+ const z = layout.toDevicePixels(0);
1099
+ let pressedZ = this.androidDynamicElevationOffset;
1100
+ if (typeof pressedZ === 'undefined' || pressedZ === null) {
1101
+ pressedZ = this.getDefaultDynamicElevationOffset();
1102
+ }
1103
+ pressedZ = layout.toDevicePixels(pressedZ);
1104
+ const pressedSet = new AnimatorSet();
1105
+ pressedSet.playTogether(java.util.Arrays.asList([ObjectAnimator.ofFloat(nativeView, 'translationZ', [pressedZ]).setDuration(duration), ObjectAnimator.ofFloat(nativeView, 'elevation', [elevation]).setDuration(0)]));
1106
+ const notPressedSet = new AnimatorSet();
1107
+ notPressedSet.playTogether(java.util.Arrays.asList([ObjectAnimator.ofFloat(nativeView, 'translationZ', [z]).setDuration(duration), ObjectAnimator.ofFloat(nativeView, 'elevation', [elevation]).setDuration(0)]));
1108
+ const defaultSet = new AnimatorSet();
1109
+ defaultSet.playTogether(java.util.Arrays.asList([ObjectAnimator.ofFloat(nativeView, 'translationZ', [0]).setDuration(0), ObjectAnimator.ofFloat(nativeView, 'elevation', [0]).setDuration(0)]));
1110
+ const stateListAnimator = new android.animation.StateListAnimator();
1111
+ stateListAnimator.addState([statePressed, stateEnabled], pressedSet);
1112
+ stateListAnimator.addState([stateEnabled], notPressedSet);
1113
+ stateListAnimator.addState([], defaultSet);
1114
+ const currentAnimator = nativeView.getStateListAnimator();
1115
+ if (currentAnimator) {
1116
+ currentAnimator.jumpToCurrentState();
1117
+ }
1118
+ nativeView.setStateListAnimator(stateListAnimator);
1119
+ }
859
1120
  [rotateProperty.setNative](value) {
860
1121
  org.nativescript.widgets.ViewHelper.setRotate(this.nativeViewProtected, float(value));
861
1122
  }
@@ -1066,6 +1327,122 @@ __decorate([
1066
1327
  __metadata("design:paramtypes", []),
1067
1328
  __metadata("design:returntype", void 0)
1068
1329
  ], View.prototype, "requestLayout", null);
1330
+ function parseEdges(edges) {
1331
+ const values = edges.trim().split(',');
1332
+ let newValue = -1;
1333
+ for (let value of values) {
1334
+ const trimmedValue = value.trim();
1335
+ switch (trimmedValue) {
1336
+ case 'none':
1337
+ if (newValue === -1) {
1338
+ newValue = OverflowEdgeNone;
1339
+ }
1340
+ else {
1341
+ newValue |= OverflowEdgeNone;
1342
+ }
1343
+ break;
1344
+ case 'left':
1345
+ if (newValue === -1) {
1346
+ newValue = OverflowEdgeLeft;
1347
+ }
1348
+ else {
1349
+ newValue |= OverflowEdgeLeft;
1350
+ }
1351
+ break;
1352
+ case 'top':
1353
+ if (newValue === -1) {
1354
+ newValue = OverflowEdgeTop;
1355
+ }
1356
+ else {
1357
+ newValue |= OverflowEdgeTop;
1358
+ }
1359
+ break;
1360
+ case 'right':
1361
+ if (newValue === -1) {
1362
+ newValue = OverflowEdgeRight;
1363
+ }
1364
+ else {
1365
+ newValue |= OverflowEdgeRight;
1366
+ }
1367
+ break;
1368
+ case 'bottom':
1369
+ if (newValue === -1) {
1370
+ newValue = OverflowEdgeBottom;
1371
+ }
1372
+ else {
1373
+ newValue |= OverflowEdgeBottom;
1374
+ }
1375
+ break;
1376
+ case 'dont-apply':
1377
+ newValue = OverflowEdgeDontApply;
1378
+ break;
1379
+ case 'left-dont-consume':
1380
+ if (newValue === -1) {
1381
+ newValue = OverflowEdgeLeftDontConsume;
1382
+ }
1383
+ else {
1384
+ newValue |= OverflowEdgeLeftDontConsume;
1385
+ }
1386
+ break;
1387
+ case 'top-dont-consume':
1388
+ if (newValue === -1) {
1389
+ newValue = OverflowEdgeTopDontConsume;
1390
+ }
1391
+ else {
1392
+ newValue |= OverflowEdgeTopDontConsume;
1393
+ }
1394
+ break;
1395
+ case 'right-dont-consume':
1396
+ if (newValue === -1) {
1397
+ newValue = OverflowEdgeRightDontConsume;
1398
+ }
1399
+ else {
1400
+ newValue |= OverflowEdgeRightDontConsume;
1401
+ }
1402
+ break;
1403
+ case 'bottom-dont-consume':
1404
+ if (newValue === -1) {
1405
+ newValue = OverflowEdgeBottomDontConsume;
1406
+ }
1407
+ else {
1408
+ newValue |= OverflowEdgeBottomDontConsume;
1409
+ }
1410
+ case 'all-but-left':
1411
+ if (newValue === -1) {
1412
+ newValue = OverflowEdgeAllButLeft;
1413
+ }
1414
+ else {
1415
+ newValue |= OverflowEdgeAllButLeft;
1416
+ }
1417
+ case 'all-but-top':
1418
+ if (newValue === -1) {
1419
+ newValue = OverflowEdgeAllButTop;
1420
+ }
1421
+ else {
1422
+ newValue |= OverflowEdgeAllButTop;
1423
+ }
1424
+ case 'all-but-right':
1425
+ if (newValue === -1) {
1426
+ newValue = OverflowEdgeAllButRight;
1427
+ }
1428
+ else {
1429
+ newValue |= OverflowEdgeAllButRight;
1430
+ }
1431
+ case 'all-but-bottom':
1432
+ if (newValue === -1) {
1433
+ newValue = OverflowEdgeAllButBottom;
1434
+ }
1435
+ else {
1436
+ newValue |= OverflowEdgeAllButBottom;
1437
+ }
1438
+ break;
1439
+ }
1440
+ }
1441
+ if (newValue === -1) {
1442
+ return null;
1443
+ }
1444
+ return newValue;
1445
+ }
1069
1446
  export class ContainerView extends View {
1070
1447
  }
1071
1448
  export class CustomLayoutView extends ContainerView {