diff --git a/packages/core/fetch/index.js b/packages/core/fetch/index.js index dec761aed..63b027e93 100644 --- a/packages/core/fetch/index.js +++ b/packages/core/fetch/index.js @@ -1,4 +1,9 @@ -var g = global; +var g = + (typeof globalThis !== 'undefined' && globalThis) || + (typeof self !== 'undefined' && self) || + // eslint-disable-next-line no-undef + (typeof global !== 'undefined' && global) || + {} var support = { searchParams: 'URLSearchParams' in g, diff --git a/packages/core/ui/button/index.android.ts b/packages/core/ui/button/index.android.ts index 09aa8ba98..890a0bcf9 100644 --- a/packages/core/ui/button/index.android.ts +++ b/packages/core/ui/button/index.android.ts @@ -1,14 +1,11 @@ import { ButtonBase } from './button-common'; -import { AndroidHelper, PseudoClassHandler } from '../core/view'; +import { PseudoClassHandler } from '../core/view'; import { paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length, zIndexProperty, minWidthProperty, minHeightProperty } from '../styling/style-properties'; import { textAlignmentProperty } from '../text-base'; import { CoreTypes } from '../../core-types'; import { profile } from '../../profiling'; import { TouchGestureEventData, TouchAction, GestureTypes } from '../gestures'; -import { Device } from '../../platform'; import { SDK_VERSION } from '../../utils/constants'; -import type { Background } from '../styling/background'; -import { NativeScriptAndroidView } from '../utils'; export * from './button-common'; diff --git a/packages/core/ui/core/bindable/index.ts b/packages/core/ui/core/bindable/index.ts index 7735a4fca..7aef0455d 100644 --- a/packages/core/ui/core/bindable/index.ts +++ b/packages/core/ui/core/bindable/index.ts @@ -1,11 +1,7 @@ -// Types -import { ViewBase } from '../view-base'; -import { BindingOptions, ValueConverter } from './bindable-types'; - -// Requires +import type { ViewBase } from '../view-base'; +import type { BindingOptions } from './bindable-types'; import { unsetValue } from '../properties'; import { Observable, PropertyChangeData } from '../../../data/observable'; -import { fromString as gestureFromString } from '../../../ui/gestures/gestures-common'; import { addWeakEventListener, removeWeakEventListener } from '../weak-event-listener'; import { bindingConstants, parentsRegex } from '../../builder/binding-builder'; import { escapeRegexSymbols } from '../../../utils'; diff --git a/packages/core/ui/core/view/view-common.ts b/packages/core/ui/core/view/view-common.ts index d04edbba9..98285f566 100644 --- a/packages/core/ui/core/view/view-common.ts +++ b/packages/core/ui/core/view/view-common.ts @@ -16,7 +16,8 @@ import { setupAccessibleView } from '../../../accessibility'; import { PercentLength } from '../../styling/style-properties'; -import { observe as gestureObserve, GesturesObserver, GestureTypes, GestureEventData, fromString as gestureFromString, toString as gestureToString, TouchManager, TouchAnimationOptions, VisionHoverOptions } from '../../gestures'; +import { observe as gestureObserve, GesturesObserver, GestureTypes, fromString as gestureFromString, toString as gestureToString, TouchManager, TouchAnimationOptions, VisionHoverOptions } from '../../gestures'; +import type { GestureEventData } from '../../gestures/gestures-types'; import { CSSUtils } from '../../../css/system-classes'; import { Builder } from '../../builder'; diff --git a/packages/core/ui/gestures/index.android.ts b/packages/core/ui/gestures/index.android.ts index d24198212..e998f2ad7 100644 --- a/packages/core/ui/gestures/index.android.ts +++ b/packages/core/ui/gestures/index.android.ts @@ -691,7 +691,7 @@ class CustomRotateGestureDetector { } } -class Pointer implements Pointer { +class Pointer { public android: number; public ios: any = undefined; @@ -711,7 +711,7 @@ class Pointer implements Pointer { } } -class TouchGestureEventData implements TouchGestureEventData { +export class TouchGestureEventData { eventName: string = toString(GestureTypes.touch); type: GestureTypes = GestureTypes.touch; ios: any = undefined; diff --git a/packages/core/ui/gestures/index.d.ts b/packages/core/ui/gestures/index.d.ts index 909915f0f..d043f285f 100644 --- a/packages/core/ui/gestures/index.d.ts +++ b/packages/core/ui/gestures/index.d.ts @@ -1,8 +1,9 @@ import type { View } from '../core/view'; +import { GestureEventData, GestureTypes } from './gestures-types'; export * from './gestures-common'; export * from './touch-manager'; -export type { GesturesObserverDefinition } from './gestures-types'; +export * from './gestures-types'; /** * Provides options for the GesturesObserver. @@ -50,6 +51,39 @@ export class GesturesObserver { androidOnTouchEvent: (motionEvent: any /* android.view.MotionEvent */) => void; } +class Pointer { + android: any; + ios: UITouch; + + get location(); + + getX(): number; + + getY(): number; +} + +export class TouchGestureEventData { + eventName: string; + type: GestureTypes; + ios: any; + action: string; + view: View; + android: android.view.MotionEvent; + object: any; + + prepare(view: View, e: any): void; + + getPointerCount(): number; + + getActivePointers(): Array; + + getAllPointers(): Array; + + getX(): number; + + getY(): number; +} + /** * A short-hand function that is used to create a gesture observer for a view and gesture. * @param target - View which will be watched for originating a specific gesture. diff --git a/packages/core/ui/gestures/index.ios.ts b/packages/core/ui/gestures/index.ios.ts index 454b16e7a..b569ea2f8 100644 --- a/packages/core/ui/gestures/index.ios.ts +++ b/packages/core/ui/gestures/index.ios.ts @@ -1,15 +1,8 @@ -// Definitions. - -import { GestureEventData, TapGestureEventData, GestureEventDataWithState, SwipeGestureEventData, PanGestureEventData, RotationGestureEventData, PinchGestureEventData } from '.'; +import type { GestureEventData, TapGestureEventData, GestureEventDataWithState, SwipeGestureEventData, PanGestureEventData, RotationGestureEventData, PinchGestureEventData } from './gestures-types'; import type { View } from '../core/view'; import { EventData } from '../../data/observable'; - -// Types. import { GesturesObserverBase, toString, TouchAction, GestureStateTypes, GestureTypes, SwipeDirection, GestureEvents } from './gestures-common'; -// Import layout from utils directly to avoid circular references -import { layout } from '../../utils'; - export * from './gestures-common'; export * from './gestures-types'; export * from './touch-manager'; @@ -541,7 +534,7 @@ class TouchGestureRecognizer extends UIGestureRecognizer { } } -class Pointer implements Pointer { +class Pointer { public android: any = undefined; public ios: UITouch = undefined; @@ -571,7 +564,7 @@ class Pointer implements Pointer { } } -class TouchGestureEventData implements TouchGestureEventData { +export class TouchGestureEventData { eventName: string = toString(GestureTypes.touch); type: GestureTypes = GestureTypes.touch; android: any = undefined; diff --git a/packages/core/ui/gestures/index.ts b/packages/core/ui/gestures/index.ts deleted file mode 100644 index e10ab94e3..000000000 --- a/packages/core/ui/gestures/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './index.android'; - -export * from './gestures-common'; -export * from './gestures-types'; -export * from './touch-manager'; -export { GesturesObserver, observe } from './index.android'; -export { TouchManager, TouchAnimationOptions, VisionHoverOptions } from './touch-manager'; diff --git a/packages/core/ui/gestures/touch-manager.ts b/packages/core/ui/gestures/touch-manager.ts index b08734dc2..07e903938 100644 --- a/packages/core/ui/gestures/touch-manager.ts +++ b/packages/core/ui/gestures/touch-manager.ts @@ -2,12 +2,12 @@ * Provides various helpers for adding easy touch handling animations. * Use when needing to implement more interactivity with your UI regarding touch down/up behavior. */ -import type { GestureEventData, GestureEventDataWithState, TouchGestureEventData } from './gestures-types'; -import { GestureEvents, GestureStateTypes, GestureTypes } from './gestures-types'; +import { GestureEventData, GestureEventDataWithState, TouchGestureEventData } from './gestures-types'; import { Animation } from '../animation'; import { AnimationDefinition } from '../animation/animation-interfaces'; import type { View } from '../core/view'; import { isObject, isFunction } from '../../utils/types'; +import { GestureEvents, GestureStateTypes, GestureTypes } from './gestures-common'; export type TouchAnimationFn = (view: View) => void; export type TouchAnimationOptions = {