refactor: circular deps part 4

This commit is contained in:
Nathan Walker
2025-07-08 07:27:43 -07:00
parent 1fdc933d8f
commit 4285a33d8f
9 changed files with 53 additions and 34 deletions

View File

@ -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 = { var support = {
searchParams: 'URLSearchParams' in g, searchParams: 'URLSearchParams' in g,

View File

@ -1,14 +1,11 @@
import { ButtonBase } from './button-common'; 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 { paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length, zIndexProperty, minWidthProperty, minHeightProperty } from '../styling/style-properties';
import { textAlignmentProperty } from '../text-base'; import { textAlignmentProperty } from '../text-base';
import { CoreTypes } from '../../core-types'; import { CoreTypes } from '../../core-types';
import { profile } from '../../profiling'; import { profile } from '../../profiling';
import { TouchGestureEventData, TouchAction, GestureTypes } from '../gestures'; import { TouchGestureEventData, TouchAction, GestureTypes } from '../gestures';
import { Device } from '../../platform';
import { SDK_VERSION } from '../../utils/constants'; import { SDK_VERSION } from '../../utils/constants';
import type { Background } from '../styling/background';
import { NativeScriptAndroidView } from '../utils';
export * from './button-common'; export * from './button-common';

View File

@ -1,11 +1,7 @@
// Types import type { ViewBase } from '../view-base';
import { ViewBase } from '../view-base'; import type { BindingOptions } from './bindable-types';
import { BindingOptions, ValueConverter } from './bindable-types';
// Requires
import { unsetValue } from '../properties'; import { unsetValue } from '../properties';
import { Observable, PropertyChangeData } from '../../../data/observable'; import { Observable, PropertyChangeData } from '../../../data/observable';
import { fromString as gestureFromString } from '../../../ui/gestures/gestures-common';
import { addWeakEventListener, removeWeakEventListener } from '../weak-event-listener'; import { addWeakEventListener, removeWeakEventListener } from '../weak-event-listener';
import { bindingConstants, parentsRegex } from '../../builder/binding-builder'; import { bindingConstants, parentsRegex } from '../../builder/binding-builder';
import { escapeRegexSymbols } from '../../../utils'; import { escapeRegexSymbols } from '../../../utils';

View File

@ -16,7 +16,8 @@ import { setupAccessibleView } from '../../../accessibility';
import { PercentLength } from '../../styling/style-properties'; 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 { CSSUtils } from '../../../css/system-classes';
import { Builder } from '../../builder'; import { Builder } from '../../builder';

View File

@ -691,7 +691,7 @@ class CustomRotateGestureDetector {
} }
} }
class Pointer implements Pointer { class Pointer {
public android: number; public android: number;
public ios: any = undefined; public ios: any = undefined;
@ -711,7 +711,7 @@ class Pointer implements Pointer {
} }
} }
class TouchGestureEventData implements TouchGestureEventData { export class TouchGestureEventData {
eventName: string = toString(GestureTypes.touch); eventName: string = toString(GestureTypes.touch);
type: GestureTypes = GestureTypes.touch; type: GestureTypes = GestureTypes.touch;
ios: any = undefined; ios: any = undefined;

View File

@ -1,8 +1,9 @@
import type { View } from '../core/view'; import type { View } from '../core/view';
import { GestureEventData, GestureTypes } from './gestures-types';
export * from './gestures-common'; export * from './gestures-common';
export * from './touch-manager'; export * from './touch-manager';
export type { GesturesObserverDefinition } from './gestures-types'; export * from './gestures-types';
/** /**
* Provides options for the GesturesObserver. * Provides options for the GesturesObserver.
@ -50,6 +51,39 @@ export class GesturesObserver {
androidOnTouchEvent: (motionEvent: any /* android.view.MotionEvent */) => void; 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<Pointer>;
getAllPointers(): Array<Pointer>;
getX(): number;
getY(): number;
}
/** /**
* A short-hand function that is used to create a gesture observer for a view and gesture. * 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. * @param target - View which will be watched for originating a specific gesture.

View File

@ -1,15 +1,8 @@
// Definitions. import type { GestureEventData, TapGestureEventData, GestureEventDataWithState, SwipeGestureEventData, PanGestureEventData, RotationGestureEventData, PinchGestureEventData } from './gestures-types';
import { GestureEventData, TapGestureEventData, GestureEventDataWithState, SwipeGestureEventData, PanGestureEventData, RotationGestureEventData, PinchGestureEventData } from '.';
import type { View } from '../core/view'; import type { View } from '../core/view';
import { EventData } from '../../data/observable'; import { EventData } from '../../data/observable';
// Types.
import { GesturesObserverBase, toString, TouchAction, GestureStateTypes, GestureTypes, SwipeDirection, GestureEvents } from './gestures-common'; 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-common';
export * from './gestures-types'; export * from './gestures-types';
export * from './touch-manager'; export * from './touch-manager';
@ -541,7 +534,7 @@ class TouchGestureRecognizer extends UIGestureRecognizer {
} }
} }
class Pointer implements Pointer { class Pointer {
public android: any = undefined; public android: any = undefined;
public ios: UITouch = 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); eventName: string = toString(GestureTypes.touch);
type: GestureTypes = GestureTypes.touch; type: GestureTypes = GestureTypes.touch;
android: any = undefined; android: any = undefined;

View File

@ -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';

View File

@ -2,12 +2,12 @@
* Provides various helpers for adding easy touch handling animations. * Provides various helpers for adding easy touch handling animations.
* Use when needing to implement more interactivity with your UI regarding touch down/up behavior. * Use when needing to implement more interactivity with your UI regarding touch down/up behavior.
*/ */
import type { GestureEventData, GestureEventDataWithState, TouchGestureEventData } from './gestures-types'; import { GestureEventData, GestureEventDataWithState, TouchGestureEventData } from './gestures-types';
import { GestureEvents, GestureStateTypes, GestureTypes } from './gestures-types';
import { Animation } from '../animation'; import { Animation } from '../animation';
import { AnimationDefinition } from '../animation/animation-interfaces'; import { AnimationDefinition } from '../animation/animation-interfaces';
import type { View } from '../core/view'; import type { View } from '../core/view';
import { isObject, isFunction } from '../../utils/types'; import { isObject, isFunction } from '../../utils/types';
import { GestureEvents, GestureStateTypes, GestureTypes } from './gestures-common';
export type TouchAnimationFn = (view: View) => void; export type TouchAnimationFn = (view: View) => void;
export type TouchAnimationOptions = { export type TouchAnimationOptions = {