@nativescript/core 9.1.0-next.3 → 9.1.0-next.4

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 (79) hide show
  1. package/accessibility/accessibility-common.d.ts +8 -0
  2. package/accessibility/accessibility-common.js +28 -0
  3. package/accessibility/accessibility-common.js.map +1 -1
  4. package/application/application-common.d.ts +187 -3
  5. package/application/application-common.js +397 -54
  6. package/application/application-common.js.map +1 -1
  7. package/application/application-interfaces.d.ts +59 -1
  8. package/application/application.android.d.ts +21 -0
  9. package/application/application.android.js +189 -7
  10. package/application/application.android.js.map +1 -1
  11. package/application/application.d.ts +121 -66
  12. package/application/application.ios.d.ts +88 -26
  13. package/application/application.ios.js +474 -351
  14. package/application/application.ios.js.map +1 -1
  15. package/application/helpers-common.d.ts +5 -0
  16. package/application/helpers-common.js +23 -1
  17. package/application/helpers-common.js.map +1 -1
  18. package/application/scene-delegate-bridge.d.ts +55 -0
  19. package/application/scene-delegate-bridge.js +122 -0
  20. package/application/scene-delegate-bridge.js.map +1 -0
  21. package/config/config.interface.d.ts +38 -2
  22. package/css/system-classes.d.ts +9 -0
  23. package/css/system-classes.js +23 -0
  24. package/css/system-classes.js.map +1 -1
  25. package/data/observable/index.d.ts +5 -0
  26. package/data/observable/index.js +9 -0
  27. package/data/observable/index.js.map +1 -1
  28. package/global-types.d.ts +39 -33
  29. package/globals/global-utils.d.ts +6 -1
  30. package/globals/global-utils.js +10 -5
  31. package/globals/global-utils.js.map +1 -1
  32. package/index.d.ts +1 -0
  33. package/index.js +1 -0
  34. package/index.js.map +1 -1
  35. package/native-window/index.d.ts +426 -0
  36. package/native-window/index.js +4 -0
  37. package/native-window/index.js.map +1 -0
  38. package/native-window/native-window-common.d.ts +153 -0
  39. package/native-window/native-window-common.js +340 -0
  40. package/native-window/native-window-common.js.map +1 -0
  41. package/native-window/native-window-interfaces.d.ts +186 -0
  42. package/native-window/native-window-interfaces.js +90 -0
  43. package/native-window/native-window-interfaces.js.map +1 -0
  44. package/native-window/native-window.android.d.ts +59 -0
  45. package/native-window/native-window.android.js +175 -0
  46. package/native-window/native-window.android.js.map +1 -0
  47. package/native-window/native-window.ios.d.ts +57 -0
  48. package/native-window/native-window.ios.js +208 -0
  49. package/native-window/native-window.ios.js.map +1 -0
  50. package/native-window/window-base.d.ts +103 -0
  51. package/native-window/window-base.js +78 -0
  52. package/native-window/window-base.js.map +1 -0
  53. package/package.json +1 -1
  54. package/ui/core/view/index.android.js +3 -1
  55. package/ui/core/view/index.android.js.map +1 -1
  56. package/ui/core/view/index.d.ts +25 -0
  57. package/ui/core/view/view-common.d.ts +19 -0
  58. package/ui/core/view/view-common.js +34 -0
  59. package/ui/core/view/view-common.js.map +1 -1
  60. package/ui/core/view-base/index.js +6 -0
  61. package/ui/core/view-base/index.js.map +1 -1
  62. package/ui/frame/frame-common.d.ts +14 -2
  63. package/ui/frame/frame-common.js +17 -5
  64. package/ui/frame/frame-common.js.map +1 -1
  65. package/ui/frame/frame-constants.d.ts +9 -0
  66. package/ui/frame/frame-constants.js +10 -0
  67. package/ui/frame/frame-constants.js.map +1 -0
  68. package/ui/frame/frame-helper-for-android.d.ts +2 -2
  69. package/ui/frame/frame-helper-for-android.js +2 -2
  70. package/ui/frame/frame-helper-for-android.js.map +1 -1
  71. package/ui/frame/frame-interfaces.d.ts +1 -1
  72. package/ui/frame/frame-stack.d.ts +17 -1
  73. package/ui/frame/frame-stack.js +32 -5
  74. package/ui/frame/frame-stack.js.map +1 -1
  75. package/ui/frame/index.android.d.ts +1 -1
  76. package/ui/frame/index.android.js +111 -38
  77. package/ui/frame/index.android.js.map +1 -1
  78. package/ui/frame/index.d.ts +15 -5
  79. package/utils/native-helper.d.ts +2 -2
@@ -0,0 +1,426 @@
1
+ import { Observable } from '../data/observable';
2
+ import type { CoreTypes } from '../core-types';
3
+ import type { View } from '../ui/core/view';
4
+ import type { NavigationEntry } from '../ui/frame/frame-interfaces';
5
+ import type { AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityResultEventData, AndroidActivityBackPressedEventData, AndroidActivityNewIntentEventData, AndroidActivityRequestPermissionsEventData, SceneEventData, SceneOpenURLContextsEventData, SceneContinueUserActivityEventData, ScenePerformActionForShortcutItemEventData } from '../application/application-interfaces';
6
+ import type { NativeWindowEventData, WindowBaseEventData, WindowLayoutDirectionChangedEventData, WindowOrientationChangedEventData, WindowSystemAppearanceChangedEventData } from './native-window-interfaces';
7
+
8
+ export * from './native-window-interfaces';
9
+
10
+ /**
11
+ * The purpose a window surface serves.
12
+ *
13
+ * - `application` – a regular app window (iOS application scene, Android activity).
14
+ * - `embedded` – a window hosted inside another app or container.
15
+ * - `carplay` – a CarPlay template scene.
16
+ * - `externalDisplay` – an external/secondary display scene.
17
+ */
18
+ export type WindowRole = 'application' | 'embedded' | 'carplay' | 'externalDisplay';
19
+
20
+ /**
21
+ * The lifecycle state of a window surface.
22
+ *
23
+ * - `attached` – connected to a live native surface.
24
+ * - `detached` – the native surface went away but the window may be reconnected.
25
+ * - `closed` – permanently torn down.
26
+ */
27
+ export type WindowState = 'attached' | 'detached' | 'closed';
28
+
29
+ /**
30
+ * Cross-platform base for any window surface.
31
+ *
32
+ * Carries identity, role, state, lifecycle events and the native accessors.
33
+ * Surfaces that host a NativeScript view tree are {@link NativeWindow} instances.
34
+ */
35
+ export abstract class WindowBase extends Observable {
36
+ /**
37
+ * Stable identifier of this window, unique for the lifetime of the JS context.
38
+ * Survives a detach/re-attach, so it can be used to correlate a window across
39
+ * an iOS scene reconnect or an Android activity recreation.
40
+ */
41
+ readonly id: string;
42
+
43
+ /**
44
+ * The purpose this window surface serves.
45
+ */
46
+ readonly role: WindowRole;
47
+
48
+ /**
49
+ * Where this window currently sits in its lifecycle.
50
+ */
51
+ readonly state: WindowState;
52
+
53
+ /**
54
+ * Whether this is the application's primary window.
55
+ *
56
+ * At most one window is primary at a time. When the primary window closes another
57
+ * attached window is promoted and `primaryWindowChanged` is raised on the Application.
58
+ */
59
+ readonly isPrimary: boolean;
60
+
61
+ /**
62
+ * The iOS surface backing this window, or `undefined` when not running on iOS.
63
+ * `scene` is absent for apps still on the pre-scene (window-only) lifecycle.
64
+ */
65
+ readonly ios?: { readonly scene?: UIWindowScene; readonly uiWindow: UIWindow };
66
+
67
+ /**
68
+ * The Android surface backing this window, or `undefined` when not running on Android
69
+ * or when the activity is already gone.
70
+ */
71
+ readonly android?: { readonly activity: androidx.appcompat.app.AppCompatActivity };
72
+
73
+ /**
74
+ * Closes this window.
75
+ *
76
+ * Ends the window session: the native surface is dismissed, `close` is raised and the
77
+ * window is dropped from the Application registry.
78
+ */
79
+ abstract close(): void;
80
+
81
+ /**
82
+ * Raised when the window becomes the active/focused window.
83
+ */
84
+ on(event: 'activate', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
85
+
86
+ /**
87
+ * Raised when the window loses focus.
88
+ */
89
+ on(event: 'deactivate', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
90
+
91
+ /**
92
+ * Raised when the window enters the background.
93
+ */
94
+ on(event: 'background', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
95
+
96
+ /**
97
+ * Raised when the window enters the foreground.
98
+ */
99
+ on(event: 'foreground', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
100
+
101
+ /**
102
+ * Raised when a native surface is bound to the window - both on the first connect and
103
+ * on every re-attach after a `detached`.
104
+ */
105
+ on(event: 'attached', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
106
+
107
+ /**
108
+ * Raised when the native surface goes away while the window session stays alive
109
+ * (iOS scene disconnect, Android activity recreation).
110
+ *
111
+ * The window stays registered on the Application and keeps its listeners, so the same
112
+ * instance is handed back when a surface re-attaches and handlers registered before the
113
+ * detach keep working afterwards.
114
+ */
115
+ on(event: 'detached', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
116
+
117
+ /**
118
+ * Raised when the window session ends for good.
119
+ *
120
+ * Fires exactly once per window. Listeners stay registered for the whole teardown, so a
121
+ * handler added at any earlier point still observes it; immediately after it is
122
+ * dispatched the framework drops every listener on the instance, so nothing registered
123
+ * on a window outlives the window.
124
+ */
125
+ on(event: 'close', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
126
+
127
+ /**
128
+ * Raised after the window content has been displayed for the first time.
129
+ */
130
+ on(event: 'displayed', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
131
+
132
+ /**
133
+ * Raised when the orientation of this window changes.
134
+ */
135
+ on(event: 'orientationChanged', callback: (data: WindowOrientationChangedEventData) => void, thisArg?: any): void;
136
+
137
+ /**
138
+ * Raised when the system appearance of this window changes between light and dark.
139
+ */
140
+ on(event: 'systemAppearanceChanged', callback: (data: WindowSystemAppearanceChangedEventData) => void, thisArg?: any): void;
141
+
142
+ /**
143
+ * Raised when the layout direction of this window changes between ltr and rtl.
144
+ */
145
+ on(event: 'layoutDirectionChanged', callback: (data: WindowLayoutDirectionChangedEventData) => void, thisArg?: any): void;
146
+
147
+ on(event: 'activityCreated', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
148
+ on(event: 'activityDestroyed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
149
+ on(event: 'activityStarted', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
150
+ on(event: 'activityPaused', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
151
+ on(event: 'activityResumed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
152
+ on(event: 'activityStopped', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
153
+ on(event: 'saveActivityState', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
154
+ on(event: 'activityResult', callback: (args: AndroidActivityResultEventData) => void, thisArg?: any): void;
155
+ on(event: 'activityBackPressed', callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any): void;
156
+ on(event: 'activityNewIntent', callback: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any): void;
157
+ on(event: 'activityRequestPermissions', callback: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any): void;
158
+ on(event: 'sceneWillConnect', callback: (args: SceneEventData) => void, thisArg?: any): void;
159
+ on(event: 'sceneDidActivate', callback: (args: SceneEventData) => void, thisArg?: any): void;
160
+ on(event: 'sceneWillResignActive', callback: (args: SceneEventData) => void, thisArg?: any): void;
161
+ on(event: 'sceneWillEnterForeground', callback: (args: SceneEventData) => void, thisArg?: any): void;
162
+ on(event: 'sceneDidEnterBackground', callback: (args: SceneEventData) => void, thisArg?: any): void;
163
+ on(event: 'sceneDidDisconnect', callback: (args: SceneEventData) => void, thisArg?: any): void;
164
+ on(event: 'sceneOpenURLContexts', callback: (args: SceneOpenURLContextsEventData) => void, thisArg?: any): void;
165
+ on(event: 'sceneContinueUserActivity', callback: (args: SceneContinueUserActivityEventData) => void, thisArg?: any): void;
166
+ on(event: 'scenePerformActionForShortcutItem', callback: (args: ScenePerformActionForShortcutItemEventData) => void, thisArg?: any): void;
167
+
168
+ /**
169
+ * Adds a listener for the specified event name.
170
+ *
171
+ * @param eventName The name of the event.
172
+ * @param callback The event listener to add. Will be called when an event of
173
+ * the given name is raised.
174
+ * @param thisArg An optional parameter which, when set, will be bound as the
175
+ * `this` context when the callback is called. Falsy values will be not be
176
+ * bound.
177
+ */
178
+ on(eventName: string, callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
179
+
180
+ once(event: 'activate', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
181
+ once(event: 'deactivate', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
182
+ once(event: 'background', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
183
+ once(event: 'foreground', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
184
+ once(event: 'attached', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
185
+ once(event: 'detached', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
186
+ once(event: 'close', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
187
+ once(event: 'displayed', callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
188
+ once(event: 'orientationChanged', callback: (data: WindowOrientationChangedEventData) => void, thisArg?: any): void;
189
+ once(event: 'systemAppearanceChanged', callback: (data: WindowSystemAppearanceChangedEventData) => void, thisArg?: any): void;
190
+ once(event: 'layoutDirectionChanged', callback: (data: WindowLayoutDirectionChangedEventData) => void, thisArg?: any): void;
191
+ once(event: 'activityCreated', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
192
+ once(event: 'activityDestroyed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
193
+ once(event: 'activityStarted', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
194
+ once(event: 'activityPaused', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
195
+ once(event: 'activityResumed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
196
+ once(event: 'activityStopped', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
197
+ once(event: 'saveActivityState', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
198
+ once(event: 'activityResult', callback: (args: AndroidActivityResultEventData) => void, thisArg?: any): void;
199
+ once(event: 'activityBackPressed', callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any): void;
200
+ once(event: 'activityNewIntent', callback: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any): void;
201
+ once(event: 'activityRequestPermissions', callback: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any): void;
202
+ once(event: 'sceneWillConnect', callback: (args: SceneEventData) => void, thisArg?: any): void;
203
+ once(event: 'sceneDidActivate', callback: (args: SceneEventData) => void, thisArg?: any): void;
204
+ once(event: 'sceneWillResignActive', callback: (args: SceneEventData) => void, thisArg?: any): void;
205
+ once(event: 'sceneWillEnterForeground', callback: (args: SceneEventData) => void, thisArg?: any): void;
206
+ once(event: 'sceneDidEnterBackground', callback: (args: SceneEventData) => void, thisArg?: any): void;
207
+ once(event: 'sceneDidDisconnect', callback: (args: SceneEventData) => void, thisArg?: any): void;
208
+ once(event: 'sceneOpenURLContexts', callback: (args: SceneOpenURLContextsEventData) => void, thisArg?: any): void;
209
+ once(event: 'sceneContinueUserActivity', callback: (args: SceneContinueUserActivityEventData) => void, thisArg?: any): void;
210
+ once(event: 'scenePerformActionForShortcutItem', callback: (args: ScenePerformActionForShortcutItemEventData) => void, thisArg?: any): void;
211
+
212
+ /**
213
+ * Adds a listener for the specified event name that is removed as soon as it is raised
214
+ * once.
215
+ */
216
+ once(eventName: string, callback: (data: WindowBaseEventData) => void, thisArg?: any): void;
217
+
218
+ off(event: 'activate', callback?: (data: WindowBaseEventData) => void, thisArg?: any): void;
219
+ off(event: 'deactivate', callback?: (data: WindowBaseEventData) => void, thisArg?: any): void;
220
+ off(event: 'background', callback?: (data: WindowBaseEventData) => void, thisArg?: any): void;
221
+ off(event: 'foreground', callback?: (data: WindowBaseEventData) => void, thisArg?: any): void;
222
+ off(event: 'attached', callback?: (data: WindowBaseEventData) => void, thisArg?: any): void;
223
+ off(event: 'detached', callback?: (data: WindowBaseEventData) => void, thisArg?: any): void;
224
+ off(event: 'close', callback?: (data: WindowBaseEventData) => void, thisArg?: any): void;
225
+ off(event: 'displayed', callback?: (data: WindowBaseEventData) => void, thisArg?: any): void;
226
+ off(event: 'orientationChanged', callback?: (data: WindowOrientationChangedEventData) => void, thisArg?: any): void;
227
+ off(event: 'systemAppearanceChanged', callback?: (data: WindowSystemAppearanceChangedEventData) => void, thisArg?: any): void;
228
+ off(event: 'layoutDirectionChanged', callback?: (data: WindowLayoutDirectionChangedEventData) => void, thisArg?: any): void;
229
+ off(event: 'activityCreated', callback?: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
230
+ off(event: 'activityDestroyed', callback?: (args: AndroidActivityEventData) => void, thisArg?: any): void;
231
+ off(event: 'activityStarted', callback?: (args: AndroidActivityEventData) => void, thisArg?: any): void;
232
+ off(event: 'activityPaused', callback?: (args: AndroidActivityEventData) => void, thisArg?: any): void;
233
+ off(event: 'activityResumed', callback?: (args: AndroidActivityEventData) => void, thisArg?: any): void;
234
+ off(event: 'activityStopped', callback?: (args: AndroidActivityEventData) => void, thisArg?: any): void;
235
+ off(event: 'saveActivityState', callback?: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
236
+ off(event: 'activityResult', callback?: (args: AndroidActivityResultEventData) => void, thisArg?: any): void;
237
+ off(event: 'activityBackPressed', callback?: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any): void;
238
+ off(event: 'activityNewIntent', callback?: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any): void;
239
+ off(event: 'activityRequestPermissions', callback?: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any): void;
240
+ off(event: 'sceneWillConnect', callback?: (args: SceneEventData) => void, thisArg?: any): void;
241
+ off(event: 'sceneDidActivate', callback?: (args: SceneEventData) => void, thisArg?: any): void;
242
+ off(event: 'sceneWillResignActive', callback?: (args: SceneEventData) => void, thisArg?: any): void;
243
+ off(event: 'sceneWillEnterForeground', callback?: (args: SceneEventData) => void, thisArg?: any): void;
244
+ off(event: 'sceneDidEnterBackground', callback?: (args: SceneEventData) => void, thisArg?: any): void;
245
+ off(event: 'sceneDidDisconnect', callback?: (args: SceneEventData) => void, thisArg?: any): void;
246
+ off(event: 'sceneOpenURLContexts', callback?: (args: SceneOpenURLContextsEventData) => void, thisArg?: any): void;
247
+ off(event: 'sceneContinueUserActivity', callback?: (args: SceneContinueUserActivityEventData) => void, thisArg?: any): void;
248
+ off(event: 'scenePerformActionForShortcutItem', callback?: (args: ScenePerformActionForShortcutItemEventData) => void, thisArg?: any): void;
249
+
250
+ /**
251
+ * Removes a listener for the specified event name. Omitting the callback removes every
252
+ * listener registered for that event on this window.
253
+ */
254
+ off(eventName: string, callback?: (data: WindowBaseEventData) => void, thisArg?: any): void;
255
+ }
256
+
257
+ /**
258
+ * A window surface that hosts a NativeScript view tree.
259
+ *
260
+ * Wraps a platform window (iOS UIWindowScene + UIWindow, Android Activity) and owns the
261
+ * per-window root view, its CSS classes and its lifecycle events. Instances are created by
262
+ * the framework as the platform connects surfaces; reach them through
263
+ * `Application.activeWindow`, `Application.primaryWindow`, `Application.getWindows()` or
264
+ * `Application.getWindowById()`, and use `ios` / `android` to get at the native objects.
265
+ */
266
+ export abstract class NativeWindow extends WindowBase {
267
+ /**
268
+ * The root view currently hosted by this window, if any.
269
+ */
270
+ readonly rootView: View;
271
+
272
+ /**
273
+ * Sets the content of this window.
274
+ *
275
+ * Replaces any content set earlier, tears the previous root view down and raises
276
+ * `contentLoaded`.
277
+ *
278
+ * A view that is already the root of another window is released from it first — that
279
+ * window's `rootView` becomes null — while the view itself is left intact.
280
+ *
281
+ * @param content A View, a NavigationEntry, or the name of a module to load.
282
+ */
283
+ setContent(content: View | NavigationEntry | string): void;
284
+
285
+ /**
286
+ * The current orientation of this window.
287
+ *
288
+ * Read from the native surface while the window is attached; a detached window reports
289
+ * the last value it saw. A read that catches a change the platform has not reported yet
290
+ * also raises `orientationChanged`, so a change is never swallowed by the reading.
291
+ */
292
+ orientation(): 'portrait' | 'landscape' | 'unknown';
293
+
294
+ /**
295
+ * The current system appearance of this window.
296
+ *
297
+ * Read from the native surface while the window is attached; a detached window reports
298
+ * the last value it saw. A read that catches a change the platform has not reported yet
299
+ * also raises `systemAppearanceChanged`, so a change is never swallowed by the reading.
300
+ */
301
+ systemAppearance(): 'light' | 'dark' | null;
302
+
303
+ /**
304
+ * The current layout direction of this window.
305
+ *
306
+ * Read from the native surface while the window is attached; a detached window reports
307
+ * the last value it saw. A read that catches a change the platform has not reported yet
308
+ * also raises `layoutDirectionChanged`, so a change is never swallowed by the reading.
309
+ */
310
+ layoutDirection(): CoreTypes.LayoutDirectionType | null;
311
+
312
+ /**
313
+ * Raised when the root view content of this window is set or changed.
314
+ *
315
+ * Bringing a window up follows a fixed order that app code can rely on:
316
+ * Application `ready` -> Application `windowOpen` -> the raw platform connect/create
317
+ * event (`sceneWillConnect` / `activityCreated`) -> content resolution (the window
318
+ * content resolver, or the legacy `launch` bridge for the first window) ->
319
+ * `contentLoaded` -> `activate` and `displayed`.
320
+ */
321
+ on(event: 'contentLoaded', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
322
+
323
+ // The whole inherited set is repeated below: an override only covers the overloads it
324
+ // lists, so declaring `contentLoaded` alone would hide every WindowBase event. See
325
+ // WindowBase for what each of them means.
326
+ on(event: 'activate', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
327
+ on(event: 'deactivate', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
328
+ on(event: 'background', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
329
+ on(event: 'foreground', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
330
+ on(event: 'attached', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
331
+ on(event: 'detached', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
332
+ on(event: 'close', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
333
+ on(event: 'displayed', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
334
+ on(event: 'orientationChanged', callback: (data: WindowOrientationChangedEventData) => void, thisArg?: any): void;
335
+ on(event: 'systemAppearanceChanged', callback: (data: WindowSystemAppearanceChangedEventData) => void, thisArg?: any): void;
336
+ on(event: 'layoutDirectionChanged', callback: (data: WindowLayoutDirectionChangedEventData) => void, thisArg?: any): void;
337
+ on(event: 'activityCreated', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
338
+ on(event: 'activityDestroyed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
339
+ on(event: 'activityStarted', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
340
+ on(event: 'activityPaused', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
341
+ on(event: 'activityResumed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
342
+ on(event: 'activityStopped', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
343
+ on(event: 'saveActivityState', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
344
+ on(event: 'activityResult', callback: (args: AndroidActivityResultEventData) => void, thisArg?: any): void;
345
+ on(event: 'activityBackPressed', callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any): void;
346
+ on(event: 'activityNewIntent', callback: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any): void;
347
+ on(event: 'activityRequestPermissions', callback: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any): void;
348
+ on(event: 'sceneWillConnect', callback: (args: SceneEventData) => void, thisArg?: any): void;
349
+ on(event: 'sceneDidActivate', callback: (args: SceneEventData) => void, thisArg?: any): void;
350
+ on(event: 'sceneWillResignActive', callback: (args: SceneEventData) => void, thisArg?: any): void;
351
+ on(event: 'sceneWillEnterForeground', callback: (args: SceneEventData) => void, thisArg?: any): void;
352
+ on(event: 'sceneDidEnterBackground', callback: (args: SceneEventData) => void, thisArg?: any): void;
353
+ on(event: 'sceneDidDisconnect', callback: (args: SceneEventData) => void, thisArg?: any): void;
354
+ on(event: 'sceneOpenURLContexts', callback: (args: SceneOpenURLContextsEventData) => void, thisArg?: any): void;
355
+ on(event: 'sceneContinueUserActivity', callback: (args: SceneContinueUserActivityEventData) => void, thisArg?: any): void;
356
+ on(event: 'scenePerformActionForShortcutItem', callback: (args: ScenePerformActionForShortcutItemEventData) => void, thisArg?: any): void;
357
+ on(eventName: string, callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
358
+
359
+ once(event: 'contentLoaded', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
360
+ once(event: 'activate', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
361
+ once(event: 'deactivate', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
362
+ once(event: 'background', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
363
+ once(event: 'foreground', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
364
+ once(event: 'attached', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
365
+ once(event: 'detached', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
366
+ once(event: 'close', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
367
+ once(event: 'displayed', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
368
+ once(event: 'orientationChanged', callback: (data: WindowOrientationChangedEventData) => void, thisArg?: any): void;
369
+ once(event: 'systemAppearanceChanged', callback: (data: WindowSystemAppearanceChangedEventData) => void, thisArg?: any): void;
370
+ once(event: 'layoutDirectionChanged', callback: (data: WindowLayoutDirectionChangedEventData) => void, thisArg?: any): void;
371
+ once(event: 'activityCreated', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
372
+ once(event: 'activityDestroyed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
373
+ once(event: 'activityStarted', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
374
+ once(event: 'activityPaused', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
375
+ once(event: 'activityResumed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
376
+ once(event: 'activityStopped', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
377
+ once(event: 'saveActivityState', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
378
+ once(event: 'activityResult', callback: (args: AndroidActivityResultEventData) => void, thisArg?: any): void;
379
+ once(event: 'activityBackPressed', callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any): void;
380
+ once(event: 'activityNewIntent', callback: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any): void;
381
+ once(event: 'activityRequestPermissions', callback: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any): void;
382
+ once(event: 'sceneWillConnect', callback: (args: SceneEventData) => void, thisArg?: any): void;
383
+ once(event: 'sceneDidActivate', callback: (args: SceneEventData) => void, thisArg?: any): void;
384
+ once(event: 'sceneWillResignActive', callback: (args: SceneEventData) => void, thisArg?: any): void;
385
+ once(event: 'sceneWillEnterForeground', callback: (args: SceneEventData) => void, thisArg?: any): void;
386
+ once(event: 'sceneDidEnterBackground', callback: (args: SceneEventData) => void, thisArg?: any): void;
387
+ once(event: 'sceneDidDisconnect', callback: (args: SceneEventData) => void, thisArg?: any): void;
388
+ once(event: 'sceneOpenURLContexts', callback: (args: SceneOpenURLContextsEventData) => void, thisArg?: any): void;
389
+ once(event: 'sceneContinueUserActivity', callback: (args: SceneContinueUserActivityEventData) => void, thisArg?: any): void;
390
+ once(event: 'scenePerformActionForShortcutItem', callback: (args: ScenePerformActionForShortcutItemEventData) => void, thisArg?: any): void;
391
+ once(eventName: string, callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
392
+
393
+ off(event: 'contentLoaded', callback?: (data: NativeWindowEventData) => void, thisArg?: any): void;
394
+ off(event: 'activate', callback?: (data: NativeWindowEventData) => void, thisArg?: any): void;
395
+ off(event: 'deactivate', callback?: (data: NativeWindowEventData) => void, thisArg?: any): void;
396
+ off(event: 'background', callback?: (data: NativeWindowEventData) => void, thisArg?: any): void;
397
+ off(event: 'foreground', callback?: (data: NativeWindowEventData) => void, thisArg?: any): void;
398
+ off(event: 'attached', callback?: (data: NativeWindowEventData) => void, thisArg?: any): void;
399
+ off(event: 'detached', callback?: (data: NativeWindowEventData) => void, thisArg?: any): void;
400
+ off(event: 'close', callback?: (data: NativeWindowEventData) => void, thisArg?: any): void;
401
+ off(event: 'displayed', callback?: (data: NativeWindowEventData) => void, thisArg?: any): void;
402
+ off(event: 'orientationChanged', callback?: (data: WindowOrientationChangedEventData) => void, thisArg?: any): void;
403
+ off(event: 'systemAppearanceChanged', callback?: (data: WindowSystemAppearanceChangedEventData) => void, thisArg?: any): void;
404
+ off(event: 'layoutDirectionChanged', callback?: (data: WindowLayoutDirectionChangedEventData) => void, thisArg?: any): void;
405
+ off(event: 'activityCreated', callback?: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
406
+ off(event: 'activityDestroyed', callback?: (args: AndroidActivityEventData) => void, thisArg?: any): void;
407
+ off(event: 'activityStarted', callback?: (args: AndroidActivityEventData) => void, thisArg?: any): void;
408
+ off(event: 'activityPaused', callback?: (args: AndroidActivityEventData) => void, thisArg?: any): void;
409
+ off(event: 'activityResumed', callback?: (args: AndroidActivityEventData) => void, thisArg?: any): void;
410
+ off(event: 'activityStopped', callback?: (args: AndroidActivityEventData) => void, thisArg?: any): void;
411
+ off(event: 'saveActivityState', callback?: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
412
+ off(event: 'activityResult', callback?: (args: AndroidActivityResultEventData) => void, thisArg?: any): void;
413
+ off(event: 'activityBackPressed', callback?: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any): void;
414
+ off(event: 'activityNewIntent', callback?: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any): void;
415
+ off(event: 'activityRequestPermissions', callback?: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any): void;
416
+ off(event: 'sceneWillConnect', callback?: (args: SceneEventData) => void, thisArg?: any): void;
417
+ off(event: 'sceneDidActivate', callback?: (args: SceneEventData) => void, thisArg?: any): void;
418
+ off(event: 'sceneWillResignActive', callback?: (args: SceneEventData) => void, thisArg?: any): void;
419
+ off(event: 'sceneWillEnterForeground', callback?: (args: SceneEventData) => void, thisArg?: any): void;
420
+ off(event: 'sceneDidEnterBackground', callback?: (args: SceneEventData) => void, thisArg?: any): void;
421
+ off(event: 'sceneDidDisconnect', callback?: (args: SceneEventData) => void, thisArg?: any): void;
422
+ off(event: 'sceneOpenURLContexts', callback?: (args: SceneOpenURLContextsEventData) => void, thisArg?: any): void;
423
+ off(event: 'sceneContinueUserActivity', callback?: (args: SceneContinueUserActivityEventData) => void, thisArg?: any): void;
424
+ off(event: 'scenePerformActionForShortcutItem', callback?: (args: ScenePerformActionForShortcutItemEventData) => void, thisArg?: any): void;
425
+ off(eventName: string, callback?: (data: NativeWindowEventData) => void, thisArg?: any): void;
426
+ }
@@ -0,0 +1,4 @@
1
+ export * from './native-window-interfaces';
2
+ export * from './window-base';
3
+ export * from './native-window-common';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/native-window/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,153 @@
1
+ import { CoreTypes } from '../core-types';
2
+ import type { View } from '../ui/core/view';
3
+ import type { NavigationEntry } from '../ui/frame/frame-interfaces';
4
+ import type { NativeWindowEventData, WindowLayoutDirectionChangedEventData, WindowOrientationChangedEventData, WindowSystemAppearanceChangedEventData } from './native-window-interfaces';
5
+ import type { AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityResultEventData, AndroidActivityBackPressedEventData, AndroidActivityNewIntentEventData, AndroidActivityRequestPermissionsEventData, SceneEventData, SceneOpenURLContextsEventData, SceneContinueUserActivityEventData, ScenePerformActionForShortcutItemEventData } from '../application/application-interfaces';
6
+ import type { WindowRole } from './window-base';
7
+ import { WindowBase } from './window-base';
8
+ /**
9
+ * Cross-platform NativeWindow base class.
10
+ *
11
+ * Wraps a platform window surface (iOS UIWindowScene+UIWindow, Android Activity)
12
+ * and manages per-window root view lifecycle, CSS classes, and events.
13
+ *
14
+ * Platform-specific subclasses implement the abstract methods.
15
+ */
16
+ export declare abstract class NativeWindow extends WindowBase {
17
+ protected _rootView: View;
18
+ protected _orientation: 'portrait' | 'landscape' | 'unknown';
19
+ protected _systemAppearance: 'dark' | 'light' | null;
20
+ protected _layoutDirection: CoreTypes.LayoutDirectionType | null;
21
+ constructor(id?: string, isPrimary?: boolean, role?: WindowRole);
22
+ get rootView(): View;
23
+ /**
24
+ * Set the content of this window.
25
+ * Accepts a View, a NavigationEntry, or a module name string.
26
+ */
27
+ setContent(content: View | NavigationEntry | string): void;
28
+ /**
29
+ * @internal – take ownership of a root view the platform pipeline built and attached itself.
30
+ *
31
+ * The pipeline already ran `_setupAsRootView` and `Application.initRootView` on this view and
32
+ * installed it on the native surface, so neither `_applyRootViewSettings` nor `_setNativeContent`
33
+ * may run here — both would redo that work.
34
+ */
35
+ _adoptRootView(view: View): void;
36
+ /**
37
+ * @internal – give up the root view without tearing it down.
38
+ *
39
+ * Called when another window takes the view over: the view is being moved, not
40
+ * destroyed, so — unlike {@link _onDestroy} — nothing here unloads, resets or tears
41
+ * down the view. It stays loaded and usable in its new window.
42
+ */
43
+ _releaseRootView(): void;
44
+ /**
45
+ * Platform hook: unhook the released view from the native surface. The view itself
46
+ * must survive — it is on its way into another window.
47
+ */
48
+ protected _onReleaseRootView(rootView: View): void;
49
+ /**
50
+ * Becomes the owner of `view`, releasing it from whichever window held it before.
51
+ */
52
+ private _takeRootView;
53
+ /**
54
+ * Platform-specific: apply the view to the native window surface.
55
+ */
56
+ protected abstract _setNativeContent(view: View): void;
57
+ /**
58
+ * Get the current orientation of this window.
59
+ *
60
+ * Read from the native surface while the window is attached; a detached window
61
+ * reports the last value it saw.
62
+ *
63
+ * A read that catches a change the platform has not reported yet goes through
64
+ * {@link _setOrientation}, so the change is never swallowed by the reading.
65
+ */
66
+ orientation(): 'portrait' | 'landscape' | 'unknown';
67
+ /**
68
+ * Get the current system appearance of this window.
69
+ *
70
+ * Read from the native surface while the window is attached; a detached window
71
+ * reports the last value it saw.
72
+ *
73
+ * A read that catches a change the platform has not reported yet goes through
74
+ * {@link _setSystemAppearance}, so the change is never swallowed by the reading.
75
+ */
76
+ systemAppearance(): 'light' | 'dark' | null;
77
+ /**
78
+ * Get the current layout direction of this window.
79
+ *
80
+ * Read from the native surface while the window is attached; a detached window
81
+ * reports the last value it saw.
82
+ *
83
+ * A read that catches a change the platform has not reported yet goes through
84
+ * {@link _setLayoutDirection}, so the change is never swallowed by the reading.
85
+ */
86
+ layoutDirection(): CoreTypes.LayoutDirectionType | null;
87
+ on(event: 'contentLoaded', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
88
+ on(event: 'activate', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
89
+ on(event: 'deactivate', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
90
+ on(event: 'background', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
91
+ on(event: 'foreground', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
92
+ on(event: 'close', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
93
+ on(event: 'attached', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
94
+ on(event: 'detached', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
95
+ on(event: 'displayed', callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
96
+ on(event: 'orientationChanged', callback: (data: WindowOrientationChangedEventData) => void, thisArg?: any): void;
97
+ on(event: 'systemAppearanceChanged', callback: (data: WindowSystemAppearanceChangedEventData) => void, thisArg?: any): void;
98
+ on(event: 'layoutDirectionChanged', callback: (data: WindowLayoutDirectionChangedEventData) => void, thisArg?: any): void;
99
+ on(event: 'activityCreated', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
100
+ on(event: 'activityDestroyed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
101
+ on(event: 'activityStarted', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
102
+ on(event: 'activityPaused', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
103
+ on(event: 'activityResumed', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
104
+ on(event: 'activityStopped', callback: (args: AndroidActivityEventData) => void, thisArg?: any): void;
105
+ on(event: 'saveActivityState', callback: (args: AndroidActivityBundleEventData) => void, thisArg?: any): void;
106
+ on(event: 'activityResult', callback: (args: AndroidActivityResultEventData) => void, thisArg?: any): void;
107
+ on(event: 'activityBackPressed', callback: (args: AndroidActivityBackPressedEventData) => void, thisArg?: any): void;
108
+ on(event: 'activityNewIntent', callback: (args: AndroidActivityNewIntentEventData) => void, thisArg?: any): void;
109
+ on(event: 'activityRequestPermissions', callback: (args: AndroidActivityRequestPermissionsEventData) => void, thisArg?: any): void;
110
+ on(event: 'sceneWillConnect', callback: (args: SceneEventData) => void, thisArg?: any): void;
111
+ on(event: 'sceneDidActivate', callback: (args: SceneEventData) => void, thisArg?: any): void;
112
+ on(event: 'sceneWillResignActive', callback: (args: SceneEventData) => void, thisArg?: any): void;
113
+ on(event: 'sceneWillEnterForeground', callback: (args: SceneEventData) => void, thisArg?: any): void;
114
+ on(event: 'sceneDidEnterBackground', callback: (args: SceneEventData) => void, thisArg?: any): void;
115
+ on(event: 'sceneDidDisconnect', callback: (args: SceneEventData) => void, thisArg?: any): void;
116
+ on(event: 'sceneOpenURLContexts', callback: (args: SceneOpenURLContextsEventData) => void, thisArg?: any): void;
117
+ on(event: 'sceneContinueUserActivity', callback: (args: SceneContinueUserActivityEventData) => void, thisArg?: any): void;
118
+ on(event: 'scenePerformActionForShortcutItem', callback: (args: ScenePerformActionForShortcutItemEventData) => void, thisArg?: any): void;
119
+ on(eventName: string, callback: (data: NativeWindowEventData) => void, thisArg?: any): void;
120
+ protected abstract _getOrientation(): 'portrait' | 'landscape' | 'unknown';
121
+ protected abstract _getSystemAppearance(): 'light' | 'dark' | null;
122
+ protected abstract _getLayoutDirection(): CoreTypes.LayoutDirectionType | null;
123
+ /**
124
+ * Applies platform, orientation, appearance, and layout direction CSS classes
125
+ * to the root view.
126
+ */
127
+ protected _applyRootViewSettings(rootView: View): void;
128
+ private _setRootViewCSSClasses;
129
+ /**
130
+ * @internal – called by platform when orientation changes for this window.
131
+ */
132
+ _setOrientation(value: 'portrait' | 'landscape' | 'unknown'): void;
133
+ /**
134
+ * @internal – called by platform when system appearance changes for this window.
135
+ */
136
+ _setSystemAppearance(value: 'dark' | 'light'): void;
137
+ /**
138
+ * @internal – called by platform when layout direction changes for this window.
139
+ */
140
+ _setLayoutDirection(value: CoreTypes.LayoutDirectionType): void;
141
+ private _notifyValueChanged;
142
+ private _applyCssClass;
143
+ private _increaseStyleScopeVersion;
144
+ /**
145
+ * @internal – the native surface went away but the window session lives on.
146
+ *
147
+ * The window stays registered and keeps its listeners, so app code that subscribed
148
+ * to it keeps working once a surface re-attaches. The root view keeps pointing back at
149
+ * this window for the same reason — it is still this window's content.
150
+ */
151
+ _detach(): void;
152
+ protected _onDestroy(): void;
153
+ }