@nativescript/core 8.5.0-alpha.0 → 8.5.0-alpha.10
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.
- package/abortcontroller/abortsignal.js +5 -5
- package/abortcontroller/abortsignal.js.map +1 -1
- package/accessibility/accessibility-common.d.ts +1 -1
- package/accessibility/accessibility-common.js.map +1 -1
- package/accessibility/accessibility-properties.js +5 -13
- package/accessibility/accessibility-properties.js.map +1 -1
- package/accessibility/font-scale.android.js.map +1 -1
- package/accessibility/index.android.d.ts +2 -2
- package/accessibility/index.android.js.map +1 -1
- package/accessibility/index.d.ts +1 -2
- package/accessibility/index.ios.d.ts +1 -2
- package/accessibility/index.ios.js.map +1 -1
- package/animation-frame/animation-native.ios.d.ts +1 -1
- package/application/application-common.d.ts +5 -4
- package/application/application-common.js +5 -5
- package/application/application-common.js.map +1 -1
- package/application/application-interfaces.d.ts +27 -5
- package/application/index.android.d.ts +12 -12
- package/application/index.android.js.map +1 -1
- package/application/index.d.ts +30 -35
- package/application/index.ios.d.ts +1 -0
- package/application/index.ios.js +23 -28
- package/application/index.ios.js.map +1 -1
- package/core-types/index.d.ts +10 -10
- package/css/CSS3Parser.d.ts +3 -3
- package/css/parser.d.ts +17 -17
- package/data/observable/index.d.ts +140 -165
- package/data/observable/index.js +102 -6
- package/data/observable/index.js.map +1 -1
- package/file-system/file-system-access.android.d.ts +13 -0
- package/file-system/file-system-access.android.js +149 -1
- package/file-system/file-system-access.android.js.map +1 -1
- package/file-system/file-system-access.d.ts +12 -0
- package/file-system/file-system-access.ios.d.ts +7 -0
- package/file-system/file-system-access.ios.js +56 -0
- package/file-system/file-system-access.ios.js.map +1 -1
- package/fps-meter/fps-native.android.js.map +1 -1
- package/global-types.d.ts +94 -104
- package/globals/index.js.map +1 -1
- package/image-source/index.android.js +5 -5
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.ios.js +5 -5
- package/image-source/index.ios.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/platform/index.android.d.ts +2 -2
- package/platform/index.ios.d.ts +2 -2
- package/platforms/android/widgets-release.aar +0 -0
- package/profiling/index.js +1 -1
- package/profiling/index.js.map +1 -1
- package/ui/action-bar/action-bar-common.js +4 -4
- package/ui/action-bar/action-bar-common.js.map +1 -1
- package/ui/action-bar/index.d.ts +2 -2
- package/ui/animation/animation-interfaces.d.ts +4 -4
- package/ui/builder/component-builder/index.js.map +1 -1
- package/ui/builder/xml2ui.js +3 -3
- package/ui/builder/xml2ui.js.map +1 -1
- package/ui/button/index.d.ts +2 -2
- package/ui/core/properties/index.js +6 -6
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/view/index.android.d.ts +1 -1
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.ios.js +39 -23
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.d.ts +5 -1
- package/ui/core/view/view-common.js +33 -12
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.d.ts +9 -9
- package/ui/core/view/view-helper/index.ios.d.ts +10 -0
- package/ui/core/view/view-helper/index.ios.js +99 -40
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view-base/index.d.ts +454 -532
- package/ui/core/view-base/index.js +168 -5
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/core/weak-event-listener/index.js.map +1 -1
- package/ui/dialogs/dialogs-common.js +1 -0
- package/ui/dialogs/dialogs-common.js.map +1 -1
- package/ui/dialogs/index.android.js +7 -9
- package/ui/dialogs/index.android.js.map +1 -1
- package/ui/editable-text-base/editable-text-base-common.js +1 -2
- package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
- package/ui/editable-text-base/index.android.js +2 -7
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/frame/fragment.transitions.d.ts +0 -4
- package/ui/frame/frame-common.d.ts +8 -2
- package/ui/frame/frame-common.js +11 -2
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/index.android.d.ts +2 -1
- package/ui/frame/index.android.js +26 -10
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.d.ts +3 -3
- package/ui/frame/index.ios.js +58 -8
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/gestures/gestures-common.js +5 -5
- package/ui/gestures/gestures-common.js.map +1 -1
- package/ui/gestures/index.android.js +3 -3
- package/ui/gestures/index.android.js.map +1 -1
- package/ui/gestures/index.d.ts +2 -2
- package/ui/gestures/index.ios.js +6 -6
- package/ui/gestures/index.ios.js.map +1 -1
- package/ui/gestures/touch-manager.d.ts +2 -2
- package/ui/image-cache/image-cache-common.d.ts +5 -5
- package/ui/image-cache/image-cache-common.js +2 -2
- package/ui/image-cache/image-cache-common.js.map +1 -1
- package/ui/image-cache/index.d.ts +3 -3
- package/ui/index.d.ts +8 -2
- package/ui/index.js +7 -2
- package/ui/index.js.map +1 -1
- package/ui/label/index.android.js +1 -0
- package/ui/label/index.android.js.map +1 -1
- package/ui/layouts/flexbox-layout/flexbox-layout-common.d.ts +12 -12
- package/ui/layouts/grid-layout/grid-layout-common.d.ts +1 -1
- package/ui/layouts/root-layout/root-layout-common.js +45 -36
- package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
- package/ui/list-view/index.d.ts +6 -6
- package/ui/list-view/list-view-common.js +8 -2
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/index.ios.d.ts +4 -1
- package/ui/page/index.ios.js +84 -58
- package/ui/page/index.ios.js.map +1 -1
- package/ui/page/page-common.d.ts +72 -39
- package/ui/placeholder/index.android.d.ts +2 -2
- package/ui/placeholder/index.d.ts +2 -2
- package/ui/repeater/index.js +2 -1
- package/ui/repeater/index.js.map +1 -1
- package/ui/scroll-view/scroll-view-common.d.ts +4 -4
- package/ui/scroll-view/scroll-view-common.js.map +1 -1
- package/ui/search-bar/index.d.ts +3 -3
- package/ui/segmented-bar/index.d.ts +2 -2
- package/ui/segmented-bar/segmented-bar-common.d.ts +2 -2
- package/ui/styling/background.ios.js +3 -0
- package/ui/styling/background.ios.js.map +1 -1
- package/ui/styling/css-animation-parser.d.ts +12 -7
- package/ui/styling/css-animation-parser.js +90 -36
- package/ui/styling/css-animation-parser.js.map +1 -1
- package/ui/styling/css-selector.d.ts +1 -1
- package/ui/styling/css-utils.d.ts +1 -0
- package/ui/styling/css-utils.js +12 -0
- package/ui/styling/css-utils.js.map +1 -0
- package/ui/styling/font-common.js +6 -6
- package/ui/styling/font-common.js.map +1 -1
- package/ui/styling/font-interfaces.d.ts +3 -3
- package/ui/styling/font.ios.js +2 -1
- package/ui/styling/font.ios.js.map +1 -1
- package/ui/styling/style/index.d.ts +3 -0
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.js +5 -13
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.js +7 -5
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/tab-view/index.d.ts +2 -2
- package/ui/tab-view/tab-view-common.d.ts +2 -2
- package/ui/text-base/index.ios.js +21 -4
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/span.js.map +1 -1
- package/ui/transition/fade-transition.d.ts +1 -3
- package/ui/transition/fade-transition.ios.d.ts +14 -1
- package/ui/transition/fade-transition.ios.js +60 -26
- package/ui/transition/fade-transition.ios.js.map +1 -1
- package/ui/transition/index.android.d.ts +5 -5
- package/ui/transition/index.android.js +7 -6
- package/ui/transition/index.android.js.map +1 -1
- package/ui/transition/index.d.ts +38 -14
- package/ui/transition/index.ios.d.ts +5 -10
- package/ui/transition/index.ios.js +8 -22
- package/ui/transition/index.ios.js.map +1 -1
- package/ui/transition/modal-transition.android.d.ts +5 -0
- package/ui/transition/modal-transition.android.js +7 -0
- package/ui/transition/modal-transition.android.js.map +1 -0
- package/ui/transition/modal-transition.d.ts +2 -0
- package/ui/transition/modal-transition.ios.d.ts +34 -0
- package/ui/transition/modal-transition.ios.js +160 -0
- package/ui/transition/modal-transition.ios.js.map +1 -0
- package/ui/transition/page-transition.android.d.ts +6 -0
- package/ui/transition/page-transition.android.js +182 -0
- package/ui/transition/page-transition.android.js.map +1 -0
- package/ui/transition/page-transition.d.ts +2 -0
- package/ui/transition/page-transition.ios.d.ts +34 -0
- package/ui/transition/page-transition.ios.js +181 -0
- package/ui/transition/page-transition.ios.js.map +1 -0
- package/ui/transition/shared-transition-helper.android.d.ts +5 -0
- package/ui/transition/shared-transition-helper.android.js +6 -0
- package/ui/transition/shared-transition-helper.android.js.map +1 -0
- package/ui/transition/shared-transition-helper.d.ts +10 -0
- package/ui/transition/shared-transition-helper.ios.d.ts +14 -0
- package/ui/transition/shared-transition-helper.ios.js +471 -0
- package/ui/transition/shared-transition-helper.ios.js.map +1 -0
- package/ui/transition/shared-transition.d.ts +230 -0
- package/ui/transition/shared-transition.js +192 -0
- package/ui/transition/shared-transition.js.map +1 -0
- package/ui/transition/slide-transition.android.d.ts +1 -1
- package/ui/transition/slide-transition.android.js +1 -1
- package/ui/transition/slide-transition.android.js.map +1 -1
- package/ui/transition/slide-transition.d.ts +1 -1
- package/ui/transition/slide-transition.ios.d.ts +15 -2
- package/ui/transition/slide-transition.ios.js +86 -52
- package/ui/transition/slide-transition.ios.js.map +1 -1
- package/ui/web-view/index.d.ts +3 -3
- package/ui/web-view/web-view-interfaces.d.ts +1 -1
- package/utils/index.d.ts +0 -82
- package/utils/mainthread-helper.android.js +2 -2
- package/utils/mainthread-helper.android.js.map +1 -1
- package/utils/native-helper.d.ts +35 -0
- package/utils/native-helper.ios.d.ts +13 -0
- package/utils/native-helper.ios.js +73 -0
- package/utils/native-helper.ios.js.map +1 -1
- package/utils/number-utils.d.ts +10 -0
- package/utils/number-utils.js +12 -0
- package/utils/number-utils.js.map +1 -1
- package/utils/typescript-utils.d.ts +6 -0
- package/xhr/index.js +28 -28
- package/xhr/index.js.map +1 -1
- package/xml/index.js.map +1 -1
- package/ui/frame/fragment.transitions.ios.d.ts +0 -2
- package/ui/frame/fragment.transitions.ios.js +0 -71
- package/ui/frame/fragment.transitions.ios.js.map +0 -1
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import type { Transition, TransitionNavigationType } from '.';
|
|
2
|
+
import { Observable } from '../../data/observable';
|
|
3
|
+
import { ViewBase } from '../core/view-base';
|
|
4
|
+
import type { View } from '../core/view';
|
|
5
|
+
import type { PanGestureEventData } from '../gestures';
|
|
6
|
+
export declare const DEFAULT_DURATION = 0.35;
|
|
7
|
+
export declare const DEFAULT_SPRING: {
|
|
8
|
+
tension: number;
|
|
9
|
+
friction: number;
|
|
10
|
+
mass: number;
|
|
11
|
+
velocity: number;
|
|
12
|
+
delay: number;
|
|
13
|
+
};
|
|
14
|
+
export declare enum SharedTransitionAnimationType {
|
|
15
|
+
present = 0,
|
|
16
|
+
dismiss = 1
|
|
17
|
+
}
|
|
18
|
+
type SharedTransitionEventAction = 'present' | 'dismiss' | 'interactiveStart' | 'interactiveFinish';
|
|
19
|
+
export type SharedTransitionEventData = {
|
|
20
|
+
eventName: string;
|
|
21
|
+
data: {
|
|
22
|
+
id: number;
|
|
23
|
+
type: TransitionNavigationType;
|
|
24
|
+
action?: SharedTransitionEventAction;
|
|
25
|
+
percent?: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type SharedRect = {
|
|
29
|
+
x?: number;
|
|
30
|
+
y?: number;
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
};
|
|
34
|
+
export type SharedProperties = SharedRect & {
|
|
35
|
+
opacity?: number;
|
|
36
|
+
scale?: {
|
|
37
|
+
x?: number;
|
|
38
|
+
y?: number;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export type SharedSpringProperties = {
|
|
42
|
+
tension?: number;
|
|
43
|
+
friction?: number;
|
|
44
|
+
mass?: number;
|
|
45
|
+
delay?: number;
|
|
46
|
+
velocity?: number;
|
|
47
|
+
animateOptions?: any;
|
|
48
|
+
};
|
|
49
|
+
type SharedTransitionPageProperties = SharedProperties & {
|
|
50
|
+
/**
|
|
51
|
+
* (iOS Only) Allow "independent" elements found only on one of the screens to take part in the animation.
|
|
52
|
+
* Note: This feature will be brought to Android in a future release.
|
|
53
|
+
*/
|
|
54
|
+
sharedTransitionTags?: {
|
|
55
|
+
[key: string]: SharedProperties;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Spring animation settings.
|
|
59
|
+
* Defaults to 140 tension with 10 friction.
|
|
60
|
+
*/
|
|
61
|
+
spring?: SharedSpringProperties;
|
|
62
|
+
};
|
|
63
|
+
type SharedTransitionPageWithDurationProperties = SharedTransitionPageProperties & {
|
|
64
|
+
/**
|
|
65
|
+
* Linear duration in milliseconds
|
|
66
|
+
* Note: When this is defined, it will override spring options and use only linear animation.
|
|
67
|
+
*/
|
|
68
|
+
duration?: number | undefined | null;
|
|
69
|
+
};
|
|
70
|
+
export interface SharedTransitionInteractiveOptions {
|
|
71
|
+
/**
|
|
72
|
+
* When the pan exceeds this percentage and you let go, finish the transition.
|
|
73
|
+
* Default 0.5
|
|
74
|
+
*/
|
|
75
|
+
finishThreshold?: number;
|
|
76
|
+
/**
|
|
77
|
+
* You can create your own percent formula used for determing the interactive value.
|
|
78
|
+
* By default, we handle this via a formula like this for an interactive page back transition:
|
|
79
|
+
* - return eventData.deltaX / (eventData.ios.view.bounds.size.width / 2);
|
|
80
|
+
* @param eventData PanGestureEventData
|
|
81
|
+
* @returns The percentage value to be used as the finish/cancel threshold
|
|
82
|
+
*/
|
|
83
|
+
percentFormula?: (eventData: PanGestureEventData) => number;
|
|
84
|
+
}
|
|
85
|
+
export interface SharedTransitionConfig {
|
|
86
|
+
/**
|
|
87
|
+
* Interactive transition settings. (iOS only at the moment)
|
|
88
|
+
*/
|
|
89
|
+
interactive?: {
|
|
90
|
+
/**
|
|
91
|
+
* Whether you want to allow interactive dismissal.
|
|
92
|
+
* Defaults to using 'pan' gesture for dismissal however you can customize your own.
|
|
93
|
+
*/
|
|
94
|
+
dismiss?: SharedTransitionInteractiveOptions;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* View settings to start your transition with.
|
|
98
|
+
*/
|
|
99
|
+
pageStart?: SharedTransitionPageProperties;
|
|
100
|
+
/**
|
|
101
|
+
* View settings to end your transition with.
|
|
102
|
+
*/
|
|
103
|
+
pageEnd?: SharedTransitionPageWithDurationProperties;
|
|
104
|
+
/**
|
|
105
|
+
* View settings to return to the original page with.
|
|
106
|
+
*/
|
|
107
|
+
pageReturn?: SharedTransitionPageWithDurationProperties;
|
|
108
|
+
}
|
|
109
|
+
export interface SharedTransitionState extends SharedTransitionConfig {
|
|
110
|
+
/**
|
|
111
|
+
* (Internally used) Preconfigured transition or your own custom configured one.
|
|
112
|
+
*/
|
|
113
|
+
instance?: Transition;
|
|
114
|
+
/**
|
|
115
|
+
* Page which will start the transition.
|
|
116
|
+
*/
|
|
117
|
+
page?: ViewBase;
|
|
118
|
+
activeType?: SharedTransitionAnimationType;
|
|
119
|
+
toPage?: ViewBase;
|
|
120
|
+
/**
|
|
121
|
+
* Whether interactive transition has began.
|
|
122
|
+
*/
|
|
123
|
+
interactiveBegan?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Whether interactive transition was cancelled.
|
|
126
|
+
*/
|
|
127
|
+
interactiveCancelled?: boolean;
|
|
128
|
+
}
|
|
129
|
+
declare class SharedTransitionObservable extends Observable {
|
|
130
|
+
on(eventNames: string, callback: (data: SharedTransitionEventData) => void, thisArg?: any): void;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Shared Element Transitions (preview)
|
|
134
|
+
* Allows you to auto animate between shared elements on two different screesn to create smooth navigational experiences.
|
|
135
|
+
* View components can define sharedTransitionTag="name" alone with a transition through this API.
|
|
136
|
+
*/
|
|
137
|
+
export declare class SharedTransition {
|
|
138
|
+
/**
|
|
139
|
+
* Configure a custom transition with presentation/dismissal options.
|
|
140
|
+
* @param transition The custom Transition instance.
|
|
141
|
+
* @param options
|
|
142
|
+
* @returns a configured SharedTransition instance for use with navigational APIs.
|
|
143
|
+
*/
|
|
144
|
+
static custom(transition: Transition, options?: SharedTransitionConfig): {
|
|
145
|
+
instance: Transition;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Listen to various shared element transition events.
|
|
149
|
+
* @returns Observable
|
|
150
|
+
*/
|
|
151
|
+
static events(): SharedTransitionObservable;
|
|
152
|
+
/**
|
|
153
|
+
* When the transition starts.
|
|
154
|
+
*/
|
|
155
|
+
static startedEvent: string;
|
|
156
|
+
/**
|
|
157
|
+
* When the transition finishes.
|
|
158
|
+
*/
|
|
159
|
+
static finishedEvent: string;
|
|
160
|
+
/**
|
|
161
|
+
* When the interactive transition cancels.
|
|
162
|
+
*/
|
|
163
|
+
static interactiveCancelledEvent: string;
|
|
164
|
+
/**
|
|
165
|
+
* When the interactive transition updates with the percent value.
|
|
166
|
+
*/
|
|
167
|
+
static interactiveUpdateEvent: string;
|
|
168
|
+
/**
|
|
169
|
+
* Enable to see various console logging output of Shared Element Transition behavior.
|
|
170
|
+
*/
|
|
171
|
+
static DEBUG: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Update transition state.
|
|
174
|
+
* @param id Transition instance id
|
|
175
|
+
* @param state SharedTransitionState
|
|
176
|
+
*/
|
|
177
|
+
static updateState(id: number, state: SharedTransitionState): void;
|
|
178
|
+
/**
|
|
179
|
+
* Get current state for any transition.
|
|
180
|
+
* @param id Transition instance id
|
|
181
|
+
*/
|
|
182
|
+
static getState(id: number): SharedTransitionState;
|
|
183
|
+
/**
|
|
184
|
+
* Finish transition state.
|
|
185
|
+
* @param id Transition instance id
|
|
186
|
+
*/
|
|
187
|
+
static finishState(id: number): void;
|
|
188
|
+
/**
|
|
189
|
+
* Gather view collections based on sharedTransitionTag details.
|
|
190
|
+
* @param fromPage Page moving away from
|
|
191
|
+
* @param toPage Page moving to
|
|
192
|
+
* @returns Collections of views pertaining to shared elements or particular pages
|
|
193
|
+
*/
|
|
194
|
+
static getSharedElements(fromPage: ViewBase, toPage: ViewBase): {
|
|
195
|
+
sharedElements: Array<View>;
|
|
196
|
+
presented: Array<View>;
|
|
197
|
+
presenting: Array<View>;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Get dimensional rectangle (x,y,width,height) from properties with fallbacks for any undefined values.
|
|
202
|
+
* @param props combination of properties conformed to SharedTransitionPageProperties
|
|
203
|
+
* @param defaults fallback properties when props doesn't contain a value for it
|
|
204
|
+
* @returns { x,y,width,height }
|
|
205
|
+
*/
|
|
206
|
+
export declare function getRectFromProps(props: SharedTransitionPageProperties, defaults?: SharedRect): SharedRect;
|
|
207
|
+
/**
|
|
208
|
+
* Get spring properties with default fallbacks for any undefined values.
|
|
209
|
+
* @param props various spring related properties conforming to SharedSpringProperties
|
|
210
|
+
* @returns
|
|
211
|
+
*/
|
|
212
|
+
export declare function getSpringFromProps(props: SharedSpringProperties): {
|
|
213
|
+
tension: number;
|
|
214
|
+
friction: number;
|
|
215
|
+
mass: number;
|
|
216
|
+
velocity: number;
|
|
217
|
+
delay: number;
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Page starting defaults for provided type.
|
|
221
|
+
* @param type TransitionNavigationType
|
|
222
|
+
* @returns { x,y,width,height }
|
|
223
|
+
*/
|
|
224
|
+
export declare function getPageStartDefaultsForType(type: TransitionNavigationType): {
|
|
225
|
+
x: number;
|
|
226
|
+
y: number;
|
|
227
|
+
width: number;
|
|
228
|
+
height: number;
|
|
229
|
+
};
|
|
230
|
+
export {};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { Observable } from '../../data/observable';
|
|
2
|
+
import { Screen } from '../../platform';
|
|
3
|
+
import { isNumber } from '../../utils/types';
|
|
4
|
+
import { querySelectorAll } from '../core/view-base';
|
|
5
|
+
export const DEFAULT_DURATION = 0.35;
|
|
6
|
+
export const DEFAULT_SPRING = {
|
|
7
|
+
tension: 140,
|
|
8
|
+
friction: 10,
|
|
9
|
+
mass: 1,
|
|
10
|
+
velocity: 0,
|
|
11
|
+
delay: 0,
|
|
12
|
+
};
|
|
13
|
+
// always increment when adding new transitions to be able to track their state
|
|
14
|
+
export var SharedTransitionAnimationType;
|
|
15
|
+
(function (SharedTransitionAnimationType) {
|
|
16
|
+
SharedTransitionAnimationType[SharedTransitionAnimationType["present"] = 0] = "present";
|
|
17
|
+
SharedTransitionAnimationType[SharedTransitionAnimationType["dismiss"] = 1] = "dismiss";
|
|
18
|
+
})(SharedTransitionAnimationType || (SharedTransitionAnimationType = {}));
|
|
19
|
+
class SharedTransitionObservable extends Observable {
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
on(eventNames, callback, thisArg) {
|
|
22
|
+
super.on(eventNames, callback, thisArg);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
let sharedTransitionEvents;
|
|
26
|
+
let currentStack;
|
|
27
|
+
/**
|
|
28
|
+
* Shared Element Transitions (preview)
|
|
29
|
+
* Allows you to auto animate between shared elements on two different screesn to create smooth navigational experiences.
|
|
30
|
+
* View components can define sharedTransitionTag="name" alone with a transition through this API.
|
|
31
|
+
*/
|
|
32
|
+
export class SharedTransition {
|
|
33
|
+
/**
|
|
34
|
+
* Configure a custom transition with presentation/dismissal options.
|
|
35
|
+
* @param transition The custom Transition instance.
|
|
36
|
+
* @param options
|
|
37
|
+
* @returns a configured SharedTransition instance for use with navigational APIs.
|
|
38
|
+
*/
|
|
39
|
+
static custom(transition, options) {
|
|
40
|
+
SharedTransition.updateState(transition.id, {
|
|
41
|
+
...(options || {}),
|
|
42
|
+
instance: transition,
|
|
43
|
+
activeType: SharedTransitionAnimationType.present,
|
|
44
|
+
});
|
|
45
|
+
const pageEnd = options?.pageEnd;
|
|
46
|
+
if (isNumber(pageEnd?.duration)) {
|
|
47
|
+
transition.setDuration(pageEnd?.duration);
|
|
48
|
+
}
|
|
49
|
+
return { instance: transition };
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Listen to various shared element transition events.
|
|
53
|
+
* @returns Observable
|
|
54
|
+
*/
|
|
55
|
+
static events() {
|
|
56
|
+
if (!sharedTransitionEvents) {
|
|
57
|
+
sharedTransitionEvents = new SharedTransitionObservable();
|
|
58
|
+
}
|
|
59
|
+
return sharedTransitionEvents;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Update transition state.
|
|
63
|
+
* @param id Transition instance id
|
|
64
|
+
* @param state SharedTransitionState
|
|
65
|
+
*/
|
|
66
|
+
static updateState(id, state) {
|
|
67
|
+
if (!currentStack) {
|
|
68
|
+
currentStack = [];
|
|
69
|
+
}
|
|
70
|
+
const existingTransition = SharedTransition.getState(id);
|
|
71
|
+
if (existingTransition) {
|
|
72
|
+
// updating existing
|
|
73
|
+
for (const key in state) {
|
|
74
|
+
existingTransition[key] = state[key];
|
|
75
|
+
// console.log(' ... updating state: ', key, state[key])
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
currentStack.push(state);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get current state for any transition.
|
|
84
|
+
* @param id Transition instance id
|
|
85
|
+
*/
|
|
86
|
+
static getState(id) {
|
|
87
|
+
return currentStack?.find((t) => t.instance?.id === id);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Finish transition state.
|
|
91
|
+
* @param id Transition instance id
|
|
92
|
+
*/
|
|
93
|
+
static finishState(id) {
|
|
94
|
+
const index = currentStack?.findIndex((t) => t.instance?.id === id);
|
|
95
|
+
if (index > -1) {
|
|
96
|
+
currentStack.splice(index, 1);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Gather view collections based on sharedTransitionTag details.
|
|
101
|
+
* @param fromPage Page moving away from
|
|
102
|
+
* @param toPage Page moving to
|
|
103
|
+
* @returns Collections of views pertaining to shared elements or particular pages
|
|
104
|
+
*/
|
|
105
|
+
static getSharedElements(fromPage, toPage) {
|
|
106
|
+
// 1. Presented view: gather all sharedTransitionTag views
|
|
107
|
+
const presentedSharedElements = querySelectorAll(toPage, 'sharedTransitionTag').filter((v) => !v.sharedTransitionIgnore);
|
|
108
|
+
// console.log('presented sharedTransitionTag total:', presentedSharedElements.length);
|
|
109
|
+
// 2. Presenting view: gather all sharedTransitionTag views
|
|
110
|
+
const presentingSharedElements = querySelectorAll(fromPage, 'sharedTransitionTag').filter((v) => !v.sharedTransitionIgnore);
|
|
111
|
+
// console.log(
|
|
112
|
+
// 'presenting sharedTransitionTags:',
|
|
113
|
+
// presentingSharedElements.map((v) => v.sharedTransitionTag)
|
|
114
|
+
// );
|
|
115
|
+
// 3. only handle sharedTransitionTag on presenting which match presented
|
|
116
|
+
const presentedTags = presentedSharedElements.map((v) => v.sharedTransitionTag);
|
|
117
|
+
return {
|
|
118
|
+
sharedElements: presentingSharedElements.filter((v) => presentedTags.includes(v.sharedTransitionTag)),
|
|
119
|
+
presented: presentedSharedElements,
|
|
120
|
+
presenting: presentingSharedElements,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* When the transition starts.
|
|
126
|
+
*/
|
|
127
|
+
SharedTransition.startedEvent = 'SharedTransitionStartedEvent';
|
|
128
|
+
/**
|
|
129
|
+
* When the transition finishes.
|
|
130
|
+
*/
|
|
131
|
+
SharedTransition.finishedEvent = 'SharedTransitionFinishedEvent';
|
|
132
|
+
/**
|
|
133
|
+
* When the interactive transition cancels.
|
|
134
|
+
*/
|
|
135
|
+
SharedTransition.interactiveCancelledEvent = 'SharedTransitionInteractiveCancelledEvent';
|
|
136
|
+
/**
|
|
137
|
+
* When the interactive transition updates with the percent value.
|
|
138
|
+
*/
|
|
139
|
+
SharedTransition.interactiveUpdateEvent = 'SharedTransitionInteractiveUpdateEvent';
|
|
140
|
+
/**
|
|
141
|
+
* Enable to see various console logging output of Shared Element Transition behavior.
|
|
142
|
+
*/
|
|
143
|
+
SharedTransition.DEBUG = false;
|
|
144
|
+
/**
|
|
145
|
+
* Get dimensional rectangle (x,y,width,height) from properties with fallbacks for any undefined values.
|
|
146
|
+
* @param props combination of properties conformed to SharedTransitionPageProperties
|
|
147
|
+
* @param defaults fallback properties when props doesn't contain a value for it
|
|
148
|
+
* @returns { x,y,width,height }
|
|
149
|
+
*/
|
|
150
|
+
export function getRectFromProps(props, defaults) {
|
|
151
|
+
defaults = {
|
|
152
|
+
x: 0,
|
|
153
|
+
y: 0,
|
|
154
|
+
width: Screen.mainScreen.widthDIPs,
|
|
155
|
+
height: Screen.mainScreen.heightDIPs,
|
|
156
|
+
...(defaults || {}),
|
|
157
|
+
};
|
|
158
|
+
return {
|
|
159
|
+
x: isNumber(props?.x) ? props?.x : defaults.x,
|
|
160
|
+
y: isNumber(props?.y) ? props?.y : defaults.y,
|
|
161
|
+
width: isNumber(props?.width) ? props?.width : defaults.width,
|
|
162
|
+
height: isNumber(props?.height) ? props?.height : defaults.height,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get spring properties with default fallbacks for any undefined values.
|
|
167
|
+
* @param props various spring related properties conforming to SharedSpringProperties
|
|
168
|
+
* @returns
|
|
169
|
+
*/
|
|
170
|
+
export function getSpringFromProps(props) {
|
|
171
|
+
return {
|
|
172
|
+
tension: isNumber(props?.tension) ? props?.tension : DEFAULT_SPRING.tension,
|
|
173
|
+
friction: isNumber(props?.friction) ? props?.friction : DEFAULT_SPRING.friction,
|
|
174
|
+
mass: isNumber(props?.mass) ? props?.mass : DEFAULT_SPRING.mass,
|
|
175
|
+
velocity: isNumber(props?.velocity) ? props?.velocity : DEFAULT_SPRING.velocity,
|
|
176
|
+
delay: isNumber(props?.delay) ? props?.delay : DEFAULT_SPRING.delay,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Page starting defaults for provided type.
|
|
181
|
+
* @param type TransitionNavigationType
|
|
182
|
+
* @returns { x,y,width,height }
|
|
183
|
+
*/
|
|
184
|
+
export function getPageStartDefaultsForType(type) {
|
|
185
|
+
return {
|
|
186
|
+
x: type === 'page' ? Screen.mainScreen.widthDIPs : 0,
|
|
187
|
+
y: type === 'page' ? 0 : Screen.mainScreen.heightDIPs,
|
|
188
|
+
width: Screen.mainScreen.widthDIPs,
|
|
189
|
+
height: Screen.mainScreen.heightDIPs,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=shared-transition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-transition.js","sourceRoot":"","sources":["../../../../../packages/core/ui/transition/shared-transition.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAY,MAAM,mBAAmB,CAAC;AAI/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;IACX,KAAK,EAAE,CAAC;CACR,CAAC;AACF,+EAA+E;AAC/E,MAAM,CAAN,IAAY,6BAGX;AAHD,WAAY,6BAA6B;IACxC,uFAAO,CAAA;IACP,uFAAO,CAAA;AACR,CAAC,EAHW,6BAA6B,KAA7B,6BAA6B,QAGxC;AA2FD,MAAM,0BAA2B,SAAQ,UAAU;IAClD,aAAa;IACb,EAAE,CAAC,UAAkB,EAAE,QAAmD,EAAE,OAAa;QACxF,KAAK,CAAC,EAAE,CAAC,UAAU,EAAO,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACD;AACD,IAAI,sBAAkD,CAAC;AACvD,IAA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CAAC,CAAC,CAAC,cAAc,CAAC,OAAO;QAC3E,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ;QAC/E,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI;QAC/D,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ;QAC/E,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK;KACnE,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAA8B;IACzE,OAAO;QACN,CAAC,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU;QACrD,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS;QAClC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU;KACpC,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Transition } from '.';
|
|
2
2
|
export declare class SlideTransition extends Transition {
|
|
3
3
|
private _direction;
|
|
4
|
-
constructor(direction: string, duration
|
|
4
|
+
constructor(direction: string, duration?: number, curve?: any);
|
|
5
5
|
createAndroidAnimator(transitionType: string): android.animation.Animator;
|
|
6
6
|
toString(): string;
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ import lazy from '../../utils/lazy';
|
|
|
4
4
|
const screenWidth = lazy(() => Screen.mainScreen.widthPixels);
|
|
5
5
|
const screenHeight = lazy(() => Screen.mainScreen.heightPixels);
|
|
6
6
|
export class SlideTransition extends Transition {
|
|
7
|
-
constructor(direction, duration, curve) {
|
|
7
|
+
constructor(direction, duration = 350, curve) {
|
|
8
8
|
super(duration, curve);
|
|
9
9
|
this._direction = direction;
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide-transition.android.js","sourceRoot":"","sources":["../../../../../packages/core/ui/transition/slide-transition.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAEpC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAC9D,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAEhE,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAG9C,YAAY,SAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"slide-transition.android.js","sourceRoot":"","sources":["../../../../../packages/core/ui/transition/slide-transition.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAEpC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAC9D,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,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AAW,EAAE,CAAC;QACpC,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3B,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;SAC/B;QACD,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE1C,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;QACxD,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,OAAO,WAAW,CAAC;IACpB,CAAC;IAEM,QAAQ;QACd,OAAO,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;IACjD,CAAC;CACD"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { Transition } from '.';
|
|
2
2
|
export declare class SlideTransition extends Transition {
|
|
3
|
-
|
|
3
|
+
transitionController: SlideTransitionController;
|
|
4
|
+
presented: UIViewController;
|
|
5
|
+
presenting: UIViewController;
|
|
6
|
+
operation: number;
|
|
7
|
+
direction: string;
|
|
4
8
|
constructor(direction: string, duration: number, curve: any);
|
|
5
|
-
|
|
9
|
+
iosNavigatedController(navigationController: UINavigationController, operation: number, fromVC: UIViewController, toVC: UIViewController): UIViewControllerAnimatedTransitioning;
|
|
10
|
+
}
|
|
11
|
+
export declare class SlideTransitionController extends NSObject implements UIViewControllerAnimatedTransitioning {
|
|
12
|
+
static ObjCProtocols: {
|
|
13
|
+
prototype: UIViewControllerAnimatedTransitioning;
|
|
14
|
+
}[];
|
|
15
|
+
owner: WeakRef<SlideTransition>;
|
|
16
|
+
static initWithOwner(owner: WeakRef<SlideTransition>): SlideTransitionController;
|
|
17
|
+
transitionDuration(transitionContext: UIViewControllerContextTransitioning): number;
|
|
18
|
+
animateTransition(transitionContext: UIViewControllerContextTransitioning): void;
|
|
6
19
|
}
|
|
@@ -1,61 +1,95 @@
|
|
|
1
1
|
import { Transition } from '.';
|
|
2
2
|
import { Screen } from '../../platform';
|
|
3
|
-
|
|
4
|
-
const rightEdge = CGAffineTransformMakeTranslation(Screen.mainScreen.widthDIPs, 0);
|
|
5
|
-
const topEdge = CGAffineTransformMakeTranslation(0, -Screen.mainScreen.heightDIPs);
|
|
6
|
-
const bottomEdge = CGAffineTransformMakeTranslation(0, Screen.mainScreen.heightDIPs);
|
|
3
|
+
import { DEFAULT_DURATION } from './shared-transition';
|
|
7
4
|
export class SlideTransition extends Transition {
|
|
8
5
|
constructor(direction, duration, curve) {
|
|
9
6
|
super(duration, curve);
|
|
10
|
-
this.
|
|
7
|
+
this.direction = direction;
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const push = operation === 1 /* UINavigationControllerOperation.Push */;
|
|
20
|
-
switch (this._direction) {
|
|
21
|
-
case 'left':
|
|
22
|
-
toViewBeginTransform = push ? rightEdge : leftEdge;
|
|
23
|
-
fromViewEndTransform = push ? leftEdge : rightEdge;
|
|
24
|
-
break;
|
|
25
|
-
case 'right':
|
|
26
|
-
toViewBeginTransform = push ? leftEdge : rightEdge;
|
|
27
|
-
fromViewEndTransform = push ? rightEdge : leftEdge;
|
|
28
|
-
break;
|
|
29
|
-
case 'top':
|
|
30
|
-
toViewBeginTransform = push ? bottomEdge : topEdge;
|
|
31
|
-
fromViewEndTransform = push ? topEdge : bottomEdge;
|
|
32
|
-
break;
|
|
33
|
-
case 'bottom':
|
|
34
|
-
toViewBeginTransform = push ? topEdge : bottomEdge;
|
|
35
|
-
fromViewEndTransform = push ? bottomEdge : topEdge;
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
toView.transform = toViewBeginTransform;
|
|
39
|
-
fromView.transform = CGAffineTransformIdentity;
|
|
40
|
-
switch (operation) {
|
|
41
|
-
case 1 /* UINavigationControllerOperation.Push */:
|
|
42
|
-
transitionContext.containerView.insertSubviewAboveSubview(toView, fromView);
|
|
43
|
-
break;
|
|
44
|
-
case 2 /* UINavigationControllerOperation.Pop */:
|
|
45
|
-
transitionContext.containerView.insertSubviewBelowSubview(toView, fromView);
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
const duration = this.getDuration();
|
|
49
|
-
const curve = this.getCurve();
|
|
50
|
-
UIView.animateWithDurationAnimationsCompletion(duration, () => {
|
|
51
|
-
UIView.setAnimationCurve(curve);
|
|
52
|
-
toView.transform = CGAffineTransformIdentity;
|
|
53
|
-
fromView.transform = fromViewEndTransform;
|
|
54
|
-
}, (finished) => {
|
|
55
|
-
toView.transform = originalToViewTransform;
|
|
56
|
-
fromView.transform = originalFromViewTransform;
|
|
57
|
-
transitionContext.completeTransition(finished);
|
|
58
|
-
});
|
|
9
|
+
iosNavigatedController(navigationController, operation, fromVC, toVC) {
|
|
10
|
+
this.transitionController = SlideTransitionController.initWithOwner(new WeakRef(this));
|
|
11
|
+
this.presented = toVC;
|
|
12
|
+
this.presenting = fromVC;
|
|
13
|
+
this.operation = operation;
|
|
14
|
+
// console.log('presenting:', presenting)
|
|
15
|
+
return this.transitionController;
|
|
59
16
|
}
|
|
60
17
|
}
|
|
18
|
+
var SlideTransitionController = /** @class */ (function (_super) {
|
|
19
|
+
__extends(SlideTransitionController, _super);
|
|
20
|
+
function SlideTransitionController() {
|
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
22
|
+
}
|
|
23
|
+
SlideTransitionController.initWithOwner = function (owner) {
|
|
24
|
+
var ctrl = SlideTransitionController.new();
|
|
25
|
+
ctrl.owner = owner;
|
|
26
|
+
return ctrl;
|
|
27
|
+
};
|
|
28
|
+
SlideTransitionController.prototype.transitionDuration = function (transitionContext) {
|
|
29
|
+
var owner = this.owner.deref();
|
|
30
|
+
if (owner) {
|
|
31
|
+
return owner.getDuration();
|
|
32
|
+
}
|
|
33
|
+
return DEFAULT_DURATION;
|
|
34
|
+
};
|
|
35
|
+
SlideTransitionController.prototype.animateTransition = function (transitionContext) {
|
|
36
|
+
// console.log('SlideTransitionController animateTransition');
|
|
37
|
+
var owner = this.owner.deref();
|
|
38
|
+
if (owner) {
|
|
39
|
+
var toView_1 = owner.presented.view;
|
|
40
|
+
var originalToViewTransform_1 = toView_1.transform;
|
|
41
|
+
var fromView_1 = owner.presenting.view;
|
|
42
|
+
var originalFromViewTransform_1 = fromView_1.transform;
|
|
43
|
+
var fromViewEndTransform_1;
|
|
44
|
+
var toViewBeginTransform = void 0;
|
|
45
|
+
var push = owner.operation === UINavigationControllerOperation.Push;
|
|
46
|
+
var leftEdge = CGAffineTransformMakeTranslation(-Screen.mainScreen.widthDIPs, 0);
|
|
47
|
+
var rightEdge = CGAffineTransformMakeTranslation(Screen.mainScreen.widthDIPs, 0);
|
|
48
|
+
var topEdge = CGAffineTransformMakeTranslation(0, -Screen.mainScreen.heightDIPs);
|
|
49
|
+
var bottomEdge = CGAffineTransformMakeTranslation(0, Screen.mainScreen.heightDIPs);
|
|
50
|
+
switch (owner.direction) {
|
|
51
|
+
case 'left':
|
|
52
|
+
toViewBeginTransform = push ? rightEdge : leftEdge;
|
|
53
|
+
fromViewEndTransform_1 = push ? leftEdge : rightEdge;
|
|
54
|
+
break;
|
|
55
|
+
case 'right':
|
|
56
|
+
toViewBeginTransform = push ? leftEdge : rightEdge;
|
|
57
|
+
fromViewEndTransform_1 = push ? rightEdge : leftEdge;
|
|
58
|
+
break;
|
|
59
|
+
case 'top':
|
|
60
|
+
toViewBeginTransform = push ? bottomEdge : topEdge;
|
|
61
|
+
fromViewEndTransform_1 = push ? topEdge : bottomEdge;
|
|
62
|
+
break;
|
|
63
|
+
case 'bottom':
|
|
64
|
+
toViewBeginTransform = push ? topEdge : bottomEdge;
|
|
65
|
+
fromViewEndTransform_1 = push ? bottomEdge : topEdge;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
toView_1.transform = toViewBeginTransform;
|
|
69
|
+
fromView_1.transform = CGAffineTransformIdentity;
|
|
70
|
+
switch (owner.operation) {
|
|
71
|
+
case UINavigationControllerOperation.Push:
|
|
72
|
+
transitionContext.containerView.insertSubviewAboveSubview(toView_1, fromView_1);
|
|
73
|
+
break;
|
|
74
|
+
case UINavigationControllerOperation.Pop:
|
|
75
|
+
transitionContext.containerView.insertSubviewBelowSubview(toView_1, fromView_1);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
var duration = owner.getDuration();
|
|
79
|
+
var curve_1 = owner.getCurve();
|
|
80
|
+
UIView.animateWithDurationAnimationsCompletion(duration, function () {
|
|
81
|
+
UIView.setAnimationCurve(curve_1);
|
|
82
|
+
toView_1.transform = CGAffineTransformIdentity;
|
|
83
|
+
fromView_1.transform = fromViewEndTransform_1;
|
|
84
|
+
}, function (finished) {
|
|
85
|
+
toView_1.transform = originalToViewTransform_1;
|
|
86
|
+
fromView_1.transform = originalFromViewTransform_1;
|
|
87
|
+
transitionContext.completeTransition(finished);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
SlideTransitionController.ObjCProtocols = [UIViewControllerAnimatedTransitioning];
|
|
92
|
+
return SlideTransitionController;
|
|
93
|
+
}(NSObject));
|
|
94
|
+
export { SlideTransitionController };
|
|
61
95
|
//# sourceMappingURL=slide-transition.ios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slide-transition.ios.js","sourceRoot":"","sources":["../../../../../packages/core/ui/transition/slide-transition.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"slide-transition.ios.js","sourceRoot":"","sources":["../../../../../packages/core/ui/transition/slide-transition.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAO9C,YAAY,SAAiB,EAAE,QAAgB,EAAE,KAAU;QAC1D,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED,sBAAsB,CAAC,oBAA4C,EAAE,SAAiB,EAAE,MAAwB,EAAE,IAAsB;QACvI,IAAI,CAAC,oBAAoB,GAAG,yBAAyB,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,yCAAyC;QACzC,OAAO,IAAI,CAAC,oBAAoB,CAAC;IAClC,CAAC;CACD"}
|