@akylas/nativescript 9.0.25 → 9.1.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 (585) hide show
  1. package/abortcontroller/abortsignal.js.map +1 -1
  2. package/abortcontroller/index.js.map +1 -1
  3. package/accessibility/accessibility-common.js.map +1 -1
  4. package/accessibility/accessibility-css-helper.js.map +1 -1
  5. package/accessibility/accessibility-properties.js.map +1 -1
  6. package/accessibility/accessibility-service-common.js.map +1 -1
  7. package/accessibility/accessibility-service.android.js.map +1 -1
  8. package/accessibility/accessibility-service.ios.js.map +1 -1
  9. package/accessibility/accessibility-types.js.map +1 -1
  10. package/accessibility/font-scale-common.js.map +1 -1
  11. package/accessibility/font-scale.android.js.map +1 -1
  12. package/accessibility/font-scale.ios.js.map +1 -1
  13. package/accessibility/index.android.js.map +1 -1
  14. package/accessibility/index.ios.js.map +1 -1
  15. package/animation-frame/animation-native.android.js.map +1 -1
  16. package/animation-frame/animation-native.ios.js.map +1 -1
  17. package/animation-frame/index.js.map +1 -1
  18. package/application/application-common.d.ts +199 -3
  19. package/application/application-common.js +425 -55
  20. package/application/application-common.js.map +1 -1
  21. package/application/application-interfaces.d.ts +67 -1
  22. package/application/application-interfaces.js.map +1 -1
  23. package/application/application-shims.js.map +1 -1
  24. package/application/application.android.d.ts +39 -0
  25. package/application/application.android.js +242 -17
  26. package/application/application.android.js.map +1 -1
  27. package/application/application.d.ts +161 -54
  28. package/application/application.ios.d.ts +189 -28
  29. package/application/application.ios.js +885 -379
  30. package/application/application.ios.js.map +1 -1
  31. package/application/helpers-common.d.ts +5 -0
  32. package/application/helpers-common.js +23 -1
  33. package/application/helpers-common.js.map +1 -1
  34. package/application/helpers.android.js.map +1 -1
  35. package/application/helpers.ios.js.map +1 -1
  36. package/application/index.android.js.map +1 -1
  37. package/application/index.ios.js.map +1 -1
  38. package/application/scene-delegate-bridge.d.ts +60 -0
  39. package/application/scene-delegate-bridge.js +138 -0
  40. package/application/scene-delegate-bridge.js.map +1 -0
  41. package/application-settings/application-settings-common.js.map +1 -1
  42. package/application-settings/index.android.js.map +1 -1
  43. package/application-settings/index.ios.js.map +1 -1
  44. package/bundle-entry-points.js.map +1 -1
  45. package/cli-hooks/before-checkForChanges.mjs +0 -11
  46. package/color/color-common.js +16 -5
  47. package/color/color-common.js.map +1 -1
  48. package/color/color-types.js.map +1 -1
  49. package/color/color-utils.d.ts +4 -1
  50. package/color/color-utils.js +14 -9
  51. package/color/color-utils.js.map +1 -1
  52. package/color/index.android.js.map +1 -1
  53. package/color/index.ios.js.map +1 -1
  54. package/color/known-colors.js.map +1 -1
  55. package/config/config.interface.d.ts +44 -2
  56. package/config/config.interface.js.map +1 -1
  57. package/config/index.js.map +1 -1
  58. package/connectivity/index.android.js.map +1 -1
  59. package/connectivity/index.ios.js.map +1 -1
  60. package/console/index.js.map +1 -1
  61. package/core-types/animation-types.js.map +1 -1
  62. package/core-types/index.d.ts +25 -2
  63. package/core-types/index.js +23 -0
  64. package/core-types/index.js.map +1 -1
  65. package/core-types/validators.js.map +1 -1
  66. package/css/CSS3Parser.js +3 -2
  67. package/css/CSS3Parser.js.map +1 -1
  68. package/css/CSSNativeScript.js.map +1 -1
  69. package/css/css-tree-parser.js +5 -1
  70. package/css/css-tree-parser.js.map +1 -1
  71. package/css/lib/parse/index.js +5 -1
  72. package/css/lib/parse/index.js.map +1 -1
  73. package/css/parser.js +20 -3
  74. package/css/parser.js.map +1 -1
  75. package/css/reworkcss.js.map +1 -1
  76. package/css/system-classes.d.ts +9 -0
  77. package/css/system-classes.js +23 -0
  78. package/css/system-classes.js.map +1 -1
  79. package/css-mediaquery/index.js +4 -4
  80. package/css-mediaquery/index.js.map +1 -1
  81. package/css-value/reworkcss-value.js.map +1 -1
  82. package/data/observable/index.d.ts +23 -0
  83. package/data/observable/index.js +50 -9
  84. package/data/observable/index.js.map +1 -1
  85. package/data/observable-array/index.js.map +1 -1
  86. package/data/virtual-array/index.js.map +1 -1
  87. package/debugger/InspectorBackendCommands.js.map +1 -1
  88. package/debugger/devtools-elements-interfaces.js.map +1 -1
  89. package/debugger/devtools-elements.common.js.map +1 -1
  90. package/debugger/devtools-elements.js.map +1 -1
  91. package/debugger/dom-types.js +31 -1
  92. package/debugger/dom-types.js.map +1 -1
  93. package/debugger/index.js.map +1 -1
  94. package/debugger/webinspector-css.js.map +1 -1
  95. package/debugger/webinspector-dom.js.map +1 -1
  96. package/debugger/webinspector-network.android.js.map +1 -1
  97. package/debugger/webinspector-network.ios.js.map +1 -1
  98. package/file-system/file-system-access.android.js.map +1 -1
  99. package/file-system/file-system-access.ios.js +21 -13
  100. package/file-system/file-system-access.ios.js.map +1 -1
  101. package/file-system/index.d.ts +3 -3
  102. package/file-system/index.js.map +1 -1
  103. package/fps-meter/fps-native.android.js.map +1 -1
  104. package/fps-meter/fps-native.ios.js.map +1 -1
  105. package/fps-meter/index.js.map +1 -1
  106. package/global-types.d.ts +39 -33
  107. package/globals/global-utils.d.ts +6 -1
  108. package/globals/global-utils.js +10 -5
  109. package/globals/global-utils.js.map +1 -1
  110. package/globals/index.js +18 -5
  111. package/globals/index.js.map +1 -1
  112. package/globals/polyfills/polyfill-xhr.js.map +1 -1
  113. package/globals/polyfills/utils.js +2 -0
  114. package/globals/polyfills/utils.js.map +1 -1
  115. package/http/http-interfaces.js.map +1 -1
  116. package/http/http-request/http-request-common.js.map +1 -1
  117. package/http/http-request/index.android.js.map +1 -1
  118. package/http/http-request/index.ios.js.map +1 -1
  119. package/http/http-request-internal/http-request-internal-common.d.ts +5 -1
  120. package/http/http-request-internal/http-request-internal-common.js +10 -0
  121. package/http/http-request-internal/http-request-internal-common.js.map +1 -1
  122. package/http/http-request-internal/index.android.d.ts +7 -1
  123. package/http/http-request-internal/index.android.js +2 -2
  124. package/http/http-request-internal/index.android.js.map +1 -1
  125. package/http/http-request-internal/index.ios.d.ts +7 -1
  126. package/http/http-request-internal/index.ios.js +2 -2
  127. package/http/http-request-internal/index.ios.js.map +1 -1
  128. package/http/index.js.map +1 -1
  129. package/image-asset/image-asset-common.js.map +1 -1
  130. package/image-asset/index.android.js.map +1 -1
  131. package/image-asset/index.ios.js.map +1 -1
  132. package/image-source/image-source-common.js.map +1 -1
  133. package/image-source/index.android.js.map +1 -1
  134. package/image-source/index.ios.js.map +1 -1
  135. package/index.d.ts +2 -0
  136. package/index.js +1 -0
  137. package/index.js.map +1 -1
  138. package/inspector_modules.js +1 -1
  139. package/inspector_modules.js.map +1 -1
  140. package/matrix/index.js.map +1 -1
  141. package/media-query-list/index.js.map +1 -1
  142. package/module-name-resolver/helpers.js.map +1 -1
  143. package/module-name-resolver/index.js.map +1 -1
  144. package/module-name-resolver/non-bundle-workflow-compat.js.map +1 -1
  145. package/module-name-resolver/qualifier-matcher/index.js.map +1 -1
  146. package/native-window/index.d.ts +426 -0
  147. package/native-window/index.js +4 -0
  148. package/native-window/index.js.map +1 -0
  149. package/native-window/native-window-common.d.ts +153 -0
  150. package/native-window/native-window-common.js +340 -0
  151. package/native-window/native-window-common.js.map +1 -0
  152. package/native-window/native-window-interfaces.d.ts +186 -0
  153. package/native-window/native-window-interfaces.js +90 -0
  154. package/native-window/native-window-interfaces.js.map +1 -0
  155. package/native-window/native-window.android.d.ts +59 -0
  156. package/native-window/native-window.android.js +175 -0
  157. package/native-window/native-window.android.js.map +1 -0
  158. package/native-window/native-window.ios.d.ts +61 -0
  159. package/native-window/native-window.ios.js +220 -0
  160. package/native-window/native-window.ios.js.map +1 -0
  161. package/native-window/window-base.d.ts +111 -0
  162. package/native-window/window-base.js +91 -0
  163. package/native-window/window-base.js.map +1 -0
  164. package/package.json +3 -2
  165. package/platform/common.js.map +1 -1
  166. package/platform/device/index.android.js.map +1 -1
  167. package/platform/device/index.ios.js.map +1 -1
  168. package/platform/index.js.map +1 -1
  169. package/platform/screen/index.android.js.map +1 -1
  170. package/platform/screen/index.ios.d.ts +1 -0
  171. package/platform/screen/index.ios.js +6 -2
  172. package/platform/screen/index.ios.js.map +1 -1
  173. package/platforms/android/java/org/nativescript/widgets/BorderDrawable.java +5 -6
  174. package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +0 -6
  175. package/platforms/android/java/org/nativescript/widgets/CommonLayoutParams.java +56 -0
  176. package/platforms/android/java/org/nativescript/widgets/ContentLayout.java +20 -4
  177. package/platforms/android/java/org/nativescript/widgets/CustomTransition.java +26 -9
  178. package/platforms/android/java/org/nativescript/widgets/FlexLine.java +3 -3
  179. package/platforms/android/java/org/nativescript/widgets/FlexboxLayout.java +194 -731
  180. package/platforms/android/java/org/nativescript/widgets/ImageView.java +2 -2
  181. package/platforms/android/java/org/nativescript/widgets/Utils.java +37 -9
  182. package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +78 -0
  183. package/platforms/android/java/org/nativescript/widgets/image/BitmapOwner.java +1 -4
  184. package/platforms/android/java/org/nativescript/widgets/image/Worker.java +99 -76
  185. package/platforms/android/native-api-usage.json +11 -0
  186. package/platforms/ios/src/NativeScriptMainWindow.swift +72 -39
  187. package/profiling/index.js.map +1 -1
  188. package/references.d.ts +5 -2
  189. package/text/formatted-string.js.map +1 -1
  190. package/text/index.android.js.map +1 -1
  191. package/text/index.ios.js.map +1 -1
  192. package/text/span.js.map +1 -1
  193. package/text/text-common.js +1 -1
  194. package/text/text-common.js.map +1 -1
  195. package/timer/index.android.js.map +1 -1
  196. package/timer/index.ios.js.map +1 -1
  197. package/trace/index.d.ts +2 -2
  198. package/trace/index.js.map +1 -1
  199. package/ui/action-bar/action-bar-common.js.map +1 -1
  200. package/ui/action-bar/index.android.js +2 -7
  201. package/ui/action-bar/index.android.js.map +1 -1
  202. package/ui/action-bar/index.d.ts +13 -1
  203. package/ui/action-bar/index.ios.js +26 -0
  204. package/ui/action-bar/index.ios.js.map +1 -1
  205. package/ui/activity-indicator/activity-indicator-common.js.map +1 -1
  206. package/ui/activity-indicator/index.android.js.map +1 -1
  207. package/ui/activity-indicator/index.ios.js.map +1 -1
  208. package/ui/animation/animation-common.js.map +1 -1
  209. package/ui/animation/animation-interfaces.js.map +1 -1
  210. package/ui/animation/animation-shared.js.map +1 -1
  211. package/ui/animation/animation-types.js.map +1 -1
  212. package/ui/animation/index.android.js.map +1 -1
  213. package/ui/animation/index.ios.js.map +1 -1
  214. package/ui/animation/keyframe-animation.d.ts +3 -1
  215. package/ui/animation/keyframe-animation.js +72 -3
  216. package/ui/animation/keyframe-animation.js.map +1 -1
  217. package/ui/builder/binding-builder.js.map +1 -1
  218. package/ui/builder/component-builder/index.js.map +1 -1
  219. package/ui/builder/index.js +9 -1
  220. package/ui/builder/index.js.map +1 -1
  221. package/ui/button/button-common.js.map +1 -1
  222. package/ui/button/index.android.js.map +1 -1
  223. package/ui/button/index.ios.js.map +1 -1
  224. package/ui/content-view/index.js.map +1 -1
  225. package/ui/core/bindable/bindable-expressions.js.map +1 -1
  226. package/ui/core/bindable/bindable-resources.js.map +1 -1
  227. package/ui/core/bindable/bindable-types.js.map +1 -1
  228. package/ui/core/bindable/index.js +2 -1
  229. package/ui/core/bindable/index.js.map +1 -1
  230. package/ui/core/control-state-change/index.android.js.map +1 -1
  231. package/ui/core/control-state-change/index.ios.js.map +1 -1
  232. package/ui/core/properties/index.d.ts +37 -2
  233. package/ui/core/properties/index.js +205 -29
  234. package/ui/core/properties/index.js.map +1 -1
  235. package/ui/core/properties/property-shared.js +11 -2
  236. package/ui/core/properties/property-shared.js.map +1 -1
  237. package/ui/core/view/index.android.d.ts +5 -0
  238. package/ui/core/view/index.android.js +78 -6
  239. package/ui/core/view/index.android.js.map +1 -1
  240. package/ui/core/view/index.d.ts +58 -1
  241. package/ui/core/view/index.ios.d.ts +1 -0
  242. package/ui/core/view/index.ios.js +48 -11
  243. package/ui/core/view/index.ios.js.map +1 -1
  244. package/ui/core/view/view-common.d.ts +37 -0
  245. package/ui/core/view/view-common.js +81 -0
  246. package/ui/core/view/view-common.js.map +1 -1
  247. package/ui/core/view/view-helper/index.android.d.ts +1 -0
  248. package/ui/core/view/view-helper/index.android.js +8 -0
  249. package/ui/core/view/view-helper/index.android.js.map +1 -1
  250. package/ui/core/view/view-helper/index.d.ts +46 -0
  251. package/ui/core/view/view-helper/index.ios.d.ts +42 -0
  252. package/ui/core/view/view-helper/index.ios.js +170 -5
  253. package/ui/core/view/view-helper/index.ios.js.map +1 -1
  254. package/ui/core/view/view-helper/view-helper-common.js +21 -3
  255. package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
  256. package/ui/core/view/view-helper/view-helper-shared.js.map +1 -1
  257. package/ui/core/view/view-interfaces.js.map +1 -1
  258. package/ui/core/view-base/index.js +75 -36
  259. package/ui/core/view-base/index.js.map +1 -1
  260. package/ui/core/view-base/utils.js.map +1 -1
  261. package/ui/core/weak-event-listener/index.js.map +1 -1
  262. package/ui/date-picker/date-picker-common.js.map +1 -1
  263. package/ui/date-picker/index.android.js.map +1 -1
  264. package/ui/date-picker/index.ios.js.map +1 -1
  265. package/ui/dialogs/dialogs-common.js.map +1 -1
  266. package/ui/dialogs/index.android.js +5 -5
  267. package/ui/dialogs/index.android.js.map +1 -1
  268. package/ui/dialogs/index.ios.js.map +1 -1
  269. package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
  270. package/ui/editable-text-base/index.android.js +2 -1
  271. package/ui/editable-text-base/index.android.js.map +1 -1
  272. package/ui/editable-text-base/index.ios.js.map +1 -1
  273. package/ui/embedding/index.android.js.map +1 -1
  274. package/ui/embedding/index.ios.js.map +1 -1
  275. package/ui/enums/enums.js.map +1 -1
  276. package/ui/enums/index.js.map +1 -1
  277. package/ui/frame/activity.android.js.map +1 -1
  278. package/ui/frame/fragment.android.js.map +1 -1
  279. package/ui/frame/fragment.ios.js.map +1 -1
  280. package/ui/frame/fragment.transitions.android.d.ts +4 -4
  281. package/ui/frame/fragment.transitions.android.js +95 -78
  282. package/ui/frame/fragment.transitions.android.js.map +1 -1
  283. package/ui/frame/fragment.transitions.types.js.map +1 -1
  284. package/ui/frame/frame-common.d.ts +14 -2
  285. package/ui/frame/frame-common.js +51 -24
  286. package/ui/frame/frame-common.js.map +1 -1
  287. package/ui/frame/frame-constants.d.ts +9 -0
  288. package/ui/frame/frame-constants.js +10 -0
  289. package/ui/frame/frame-constants.js.map +1 -0
  290. package/ui/frame/frame-helper-for-android.d.ts +2 -2
  291. package/ui/frame/frame-helper-for-android.js +14 -5
  292. package/ui/frame/frame-helper-for-android.js.map +1 -1
  293. package/ui/frame/frame-helpers.js.map +1 -1
  294. package/ui/frame/frame-interfaces.d.ts +1 -1
  295. package/ui/frame/frame-interfaces.js.map +1 -1
  296. package/ui/frame/frame-stack.d.ts +22 -1
  297. package/ui/frame/frame-stack.js +43 -5
  298. package/ui/frame/frame-stack.js.map +1 -1
  299. package/ui/frame/index.android.d.ts +1 -2
  300. package/ui/frame/index.android.js +152 -53
  301. package/ui/frame/index.android.js.map +1 -1
  302. package/ui/frame/index.d.ts +15 -5
  303. package/ui/frame/index.ios.d.ts +1 -1
  304. package/ui/frame/index.ios.js +86 -26
  305. package/ui/frame/index.ios.js.map +1 -1
  306. package/ui/gestures/gestures-common.js.map +1 -1
  307. package/ui/gestures/gestures-types.d.ts +2 -0
  308. package/ui/gestures/gestures-types.js.map +1 -1
  309. package/ui/gestures/index.android.d.ts +1 -1
  310. package/ui/gestures/index.android.js +159 -124
  311. package/ui/gestures/index.android.js.map +1 -1
  312. package/ui/gestures/index.ios.js +30 -1
  313. package/ui/gestures/index.ios.js.map +1 -1
  314. package/ui/gestures/touch-manager.d.ts +1 -2
  315. package/ui/gestures/touch-manager.js +79 -50
  316. package/ui/gestures/touch-manager.js.map +1 -1
  317. package/ui/html-view/html-view-common.js.map +1 -1
  318. package/ui/html-view/index.android.js.map +1 -1
  319. package/ui/html-view/index.ios.js.map +1 -1
  320. package/ui/image/image-common.js +1 -1
  321. package/ui/image/image-common.js.map +1 -1
  322. package/ui/image/index.android.js +13 -1
  323. package/ui/image/index.android.js.map +1 -1
  324. package/ui/image/index.ios.js.map +1 -1
  325. package/ui/image/symbol-effects-common.js.map +1 -1
  326. package/ui/image/symbol-effects.android.js.map +1 -1
  327. package/ui/image/symbol-effects.ios.js.map +1 -1
  328. package/ui/image-cache/image-cache-common.js.map +1 -1
  329. package/ui/image-cache/index.android.js.map +1 -1
  330. package/ui/image-cache/index.ios.js.map +1 -1
  331. package/ui/index.d.ts +1 -1
  332. package/ui/index.js.map +1 -1
  333. package/ui/label/index.android.js.map +1 -1
  334. package/ui/label/index.ios.js.map +1 -1
  335. package/ui/layouts/absolute-layout/absolute-layout-common.js.map +1 -1
  336. package/ui/layouts/absolute-layout/index.android.js.map +1 -1
  337. package/ui/layouts/absolute-layout/index.ios.js +3 -0
  338. package/ui/layouts/absolute-layout/index.ios.js.map +1 -1
  339. package/ui/layouts/dock-layout/dock-layout-common.js.map +1 -1
  340. package/ui/layouts/dock-layout/index.android.js.map +1 -1
  341. package/ui/layouts/dock-layout/index.ios.js +3 -0
  342. package/ui/layouts/dock-layout/index.ios.js.map +1 -1
  343. package/ui/layouts/flexbox-layout/flexbox-layout-common.d.ts +7 -0
  344. package/ui/layouts/flexbox-layout/flexbox-layout-common.js +18 -0
  345. package/ui/layouts/flexbox-layout/flexbox-layout-common.js.map +1 -1
  346. package/ui/layouts/flexbox-layout/index.android.d.ts +5 -0
  347. package/ui/layouts/flexbox-layout/index.android.js +15 -0
  348. package/ui/layouts/flexbox-layout/index.android.js.map +1 -1
  349. package/ui/layouts/flexbox-layout/index.d.ts +19 -1
  350. package/ui/layouts/flexbox-layout/index.ios.d.ts +2 -0
  351. package/ui/layouts/flexbox-layout/index.ios.js +246 -195
  352. package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
  353. package/ui/layouts/grid-layout/grid-layout-common.js.map +1 -1
  354. package/ui/layouts/grid-layout/index.android.js.map +1 -1
  355. package/ui/layouts/grid-layout/index.ios.js +3 -0
  356. package/ui/layouts/grid-layout/index.ios.js.map +1 -1
  357. package/ui/layouts/index.js.map +1 -1
  358. package/ui/layouts/layout-base-common.d.ts +1 -0
  359. package/ui/layouts/layout-base-common.js +23 -1
  360. package/ui/layouts/layout-base-common.js.map +1 -1
  361. package/ui/layouts/layout-base.android.js.map +1 -1
  362. package/ui/layouts/layout-base.ios.js.map +1 -1
  363. package/ui/layouts/liquid-glass/index.android.js.map +1 -1
  364. package/ui/layouts/liquid-glass/index.ios.d.ts +0 -1
  365. package/ui/layouts/liquid-glass/index.ios.js +2 -43
  366. package/ui/layouts/liquid-glass/index.ios.js.map +1 -1
  367. package/ui/layouts/liquid-glass/liquid-glass-common.js.map +1 -1
  368. package/ui/layouts/liquid-glass-container/index.android.js.map +1 -1
  369. package/ui/layouts/liquid-glass-container/index.ios.d.ts +0 -1
  370. package/ui/layouts/liquid-glass-container/index.ios.js +2 -43
  371. package/ui/layouts/liquid-glass-container/index.ios.js.map +1 -1
  372. package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js.map +1 -1
  373. package/ui/layouts/root-layout/index.android.js.map +1 -1
  374. package/ui/layouts/root-layout/index.ios.js.map +1 -1
  375. package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
  376. package/ui/layouts/root-layout/root-layout-stack.js.map +1 -1
  377. package/ui/layouts/stack-layout/index.android.js.map +1 -1
  378. package/ui/layouts/stack-layout/index.ios.js +3 -0
  379. package/ui/layouts/stack-layout/index.ios.js.map +1 -1
  380. package/ui/layouts/stack-layout/stack-layout-common.js.map +1 -1
  381. package/ui/layouts/wrap-layout/index.android.js.map +1 -1
  382. package/ui/layouts/wrap-layout/index.ios.js +3 -0
  383. package/ui/layouts/wrap-layout/index.ios.js.map +1 -1
  384. package/ui/layouts/wrap-layout/wrap-layout-common.js.map +1 -1
  385. package/ui/list-picker/index.android.js.map +1 -1
  386. package/ui/list-picker/index.ios.js.map +1 -1
  387. package/ui/list-picker/list-picker-common.js.map +1 -1
  388. package/ui/list-view/index.android.js +2 -2
  389. package/ui/list-view/index.android.js.map +1 -1
  390. package/ui/list-view/index.d.ts +47 -3
  391. package/ui/list-view/index.ios.d.ts +13 -3
  392. package/ui/list-view/index.ios.js +132 -41
  393. package/ui/list-view/index.ios.js.map +1 -1
  394. package/ui/list-view/list-view-common.d.ts +19 -0
  395. package/ui/list-view/list-view-common.js +30 -0
  396. package/ui/list-view/list-view-common.js.map +1 -1
  397. package/ui/page/events.js.map +1 -1
  398. package/ui/page/index.android.js.map +1 -1
  399. package/ui/page/index.d.ts +1 -1
  400. package/ui/page/index.ios.d.ts +3 -1
  401. package/ui/page/index.ios.js +26 -17
  402. package/ui/page/index.ios.js.map +1 -1
  403. package/ui/page/page-common.d.ts +5 -1
  404. package/ui/page/page-common.js.map +1 -1
  405. package/ui/placeholder/index.android.js.map +1 -1
  406. package/ui/placeholder/index.js.map +1 -1
  407. package/ui/placeholder/placeholder-common.js.map +1 -1
  408. package/ui/progress/index.android.js.map +1 -1
  409. package/ui/progress/index.ios.js.map +1 -1
  410. package/ui/progress/progress-common.js.map +1 -1
  411. package/ui/proxy-view-container/index.js.map +1 -1
  412. package/ui/repeater/index.d.ts +2 -1
  413. package/ui/repeater/index.js.map +1 -1
  414. package/ui/scroll-view/index.android.d.ts +2 -1
  415. package/ui/scroll-view/index.android.js +4 -1
  416. package/ui/scroll-view/index.android.js.map +1 -1
  417. package/ui/scroll-view/index.d.ts +53 -0
  418. package/ui/scroll-view/index.ios.d.ts +13 -1
  419. package/ui/scroll-view/index.ios.js +100 -20
  420. package/ui/scroll-view/index.ios.js.map +1 -1
  421. package/ui/scroll-view/scroll-view-common.d.ts +13 -0
  422. package/ui/scroll-view/scroll-view-common.js +27 -0
  423. package/ui/scroll-view/scroll-view-common.js.map +1 -1
  424. package/ui/search-bar/index.android.js.map +1 -1
  425. package/ui/search-bar/index.ios.js.map +1 -1
  426. package/ui/search-bar/search-bar-common.js.map +1 -1
  427. package/ui/segmented-bar/index.android.js.map +1 -1
  428. package/ui/segmented-bar/index.ios.js.map +1 -1
  429. package/ui/segmented-bar/segmented-bar-common.d.ts +5 -1
  430. package/ui/segmented-bar/segmented-bar-common.js +6 -1
  431. package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
  432. package/ui/slider/index.android.js.map +1 -1
  433. package/ui/slider/index.ios.js.map +1 -1
  434. package/ui/slider/slider-common.js.map +1 -1
  435. package/ui/split-view/index.android.js.map +1 -1
  436. package/ui/split-view/index.ios.js.map +1 -1
  437. package/ui/split-view/split-view-common.js.map +1 -1
  438. package/ui/styling/background-common.d.ts +2 -0
  439. package/ui/styling/background-common.js +8 -0
  440. package/ui/styling/background-common.js.map +1 -1
  441. package/ui/styling/background.android.d.ts +4 -1
  442. package/ui/styling/background.android.js +5 -2
  443. package/ui/styling/background.android.js.map +1 -1
  444. package/ui/styling/background.d.ts +1 -1
  445. package/ui/styling/background.ios.js +9 -2
  446. package/ui/styling/background.ios.js.map +1 -1
  447. package/ui/styling/box-shadow.js.map +1 -1
  448. package/ui/styling/clip-path-function.js.map +1 -1
  449. package/ui/styling/converters.js.map +1 -1
  450. package/ui/styling/css-animation-parser.js.map +1 -1
  451. package/ui/styling/css-selector.d.ts +60 -13
  452. package/ui/styling/css-selector.js +311 -50
  453. package/ui/styling/css-selector.js.map +1 -1
  454. package/ui/styling/css-shadow.js.map +1 -1
  455. package/ui/styling/css-stroke.js.map +1 -1
  456. package/ui/styling/css-transform.js.map +1 -1
  457. package/ui/styling/css-utils.d.ts +16 -0
  458. package/ui/styling/css-utils.js +121 -7
  459. package/ui/styling/css-utils.js.map +1 -1
  460. package/ui/styling/font-common.js.map +1 -1
  461. package/ui/styling/font-interfaces.js.map +1 -1
  462. package/ui/styling/font.android.js.map +1 -1
  463. package/ui/styling/font.ios.js.map +1 -1
  464. package/ui/styling/length-shared.d.ts +2 -0
  465. package/ui/styling/length-shared.js +29 -2
  466. package/ui/styling/length-shared.js.map +1 -1
  467. package/ui/styling/linear-gradient.js.map +1 -1
  468. package/ui/styling/style/index.d.ts +16 -0
  469. package/ui/styling/style/index.js +1 -0
  470. package/ui/styling/style/index.js.map +1 -1
  471. package/ui/styling/style-properties.d.ts +5 -0
  472. package/ui/styling/style-properties.js +172 -101
  473. package/ui/styling/style-properties.js.map +1 -1
  474. package/ui/styling/style-scope.d.ts +24 -3
  475. package/ui/styling/style-scope.js +455 -63
  476. package/ui/styling/style-scope.js.map +1 -1
  477. package/ui/styling/styling-profile.js.map +1 -1
  478. package/ui/styling/styling-shared.js.map +1 -1
  479. package/ui/switch/index.android.js.map +1 -1
  480. package/ui/switch/index.ios.js +5 -1
  481. package/ui/switch/index.ios.js.map +1 -1
  482. package/ui/switch/switch-common.js.map +1 -1
  483. package/ui/tab-view/index.android.js +4 -1
  484. package/ui/tab-view/index.android.js.map +1 -1
  485. package/ui/tab-view/index.d.ts +5 -3
  486. package/ui/tab-view/index.ios.d.ts +2 -1
  487. package/ui/tab-view/index.ios.js +81 -18
  488. package/ui/tab-view/index.ios.js.map +1 -1
  489. package/ui/tab-view/tab-view-common.d.ts +6 -1
  490. package/ui/tab-view/tab-view-common.js +17 -1
  491. package/ui/tab-view/tab-view-common.js.map +1 -1
  492. package/ui/text-base/formatted-string.js.map +1 -1
  493. package/ui/text-base/index.android.js +5 -8
  494. package/ui/text-base/index.android.js.map +1 -1
  495. package/ui/text-base/index.ios.d.ts +3 -0
  496. package/ui/text-base/index.ios.js +25 -3
  497. package/ui/text-base/index.ios.js.map +1 -1
  498. package/ui/text-base/span.js.map +1 -1
  499. package/ui/text-base/text-base-common.js.map +1 -1
  500. package/ui/text-field/index.android.js.map +1 -1
  501. package/ui/text-field/index.ios.js +13 -5
  502. package/ui/text-field/index.ios.js.map +1 -1
  503. package/ui/text-field/text-field-common.js.map +1 -1
  504. package/ui/text-view/index.android.js.map +1 -1
  505. package/ui/text-view/index.ios.js.map +1 -1
  506. package/ui/text-view/text-view-common.js.map +1 -1
  507. package/ui/time-picker/index.android.js.map +1 -1
  508. package/ui/time-picker/index.ios.js.map +1 -1
  509. package/ui/time-picker/time-picker-common.js.map +1 -1
  510. package/ui/transition/fade-transition.android.js.map +1 -1
  511. package/ui/transition/fade-transition.ios.js.map +1 -1
  512. package/ui/transition/flip-transition.android.js.map +1 -1
  513. package/ui/transition/index.android.js.map +1 -1
  514. package/ui/transition/index.d.ts +2 -1
  515. package/ui/transition/index.ios.js.map +1 -1
  516. package/ui/transition/modal-transition.android.js.map +1 -1
  517. package/ui/transition/modal-transition.ios.js +33 -5
  518. package/ui/transition/modal-transition.ios.js.map +1 -1
  519. package/ui/transition/page-transition.android.d.ts +4 -0
  520. package/ui/transition/page-transition.android.js +174 -45
  521. package/ui/transition/page-transition.android.js.map +1 -1
  522. package/ui/transition/page-transition.ios.d.ts +5 -0
  523. package/ui/transition/page-transition.ios.js +298 -36
  524. package/ui/transition/page-transition.ios.js.map +1 -1
  525. package/ui/transition/shared-transition-helper.android.d.ts +3 -0
  526. package/ui/transition/shared-transition-helper.android.js +9 -0
  527. package/ui/transition/shared-transition-helper.android.js.map +1 -1
  528. package/ui/transition/shared-transition-helper.d.ts +7 -0
  529. package/ui/transition/shared-transition-helper.ios.d.ts +48 -0
  530. package/ui/transition/shared-transition-helper.ios.js +977 -95
  531. package/ui/transition/shared-transition-helper.ios.js.map +1 -1
  532. package/ui/transition/shared-transition.d.ts +134 -0
  533. package/ui/transition/shared-transition.js +90 -2
  534. package/ui/transition/shared-transition.js.map +1 -1
  535. package/ui/transition/slide-transition.android.js.map +1 -1
  536. package/ui/transition/slide-transition.ios.js.map +1 -1
  537. package/ui/utils.android.js.map +1 -1
  538. package/ui/utils.d.ts +2 -0
  539. package/ui/utils.ios.js.map +1 -1
  540. package/ui/web-view/index.android.js.map +1 -1
  541. package/ui/web-view/index.ios.js.map +1 -1
  542. package/ui/web-view/web-view-common.js.map +1 -1
  543. package/ui/web-view/web-view-interfaces.js.map +1 -1
  544. package/utils/animation-helpers.js.map +1 -1
  545. package/utils/common.js.map +1 -1
  546. package/utils/constants.android.js.map +1 -1
  547. package/utils/constants.ios.js.map +1 -1
  548. package/utils/debug-source.js.map +1 -1
  549. package/utils/debug.js.map +1 -1
  550. package/utils/index.android.js.map +1 -1
  551. package/utils/index.ios.js.map +1 -1
  552. package/utils/layout-helper/index.android.js.map +1 -1
  553. package/utils/layout-helper/index.ios.js +11 -3
  554. package/utils/layout-helper/index.ios.js.map +1 -1
  555. package/utils/layout-helper/layout-helper-common.js.map +1 -1
  556. package/utils/layout-helper/layout-helper-shared.js.map +1 -1
  557. package/utils/lazy.js.map +1 -1
  558. package/utils/macrotask-scheduler.js.map +1 -1
  559. package/utils/mainthread-helper.android.js.map +1 -1
  560. package/utils/mainthread-helper.ios.js.map +1 -1
  561. package/utils/module-merge.js.map +1 -1
  562. package/utils/native-helper-for-android.js +6 -2
  563. package/utils/native-helper-for-android.js.map +1 -1
  564. package/utils/native-helper.android.d.ts +66 -2
  565. package/utils/native-helper.android.js.map +1 -1
  566. package/utils/native-helper.d.ts +2 -2
  567. package/utils/native-helper.ios.d.ts +52 -2
  568. package/utils/native-helper.ios.js +35 -5
  569. package/utils/native-helper.ios.js.map +1 -1
  570. package/utils/native-helper.types.d.ts +2 -0
  571. package/utils/number-utils.js.map +1 -1
  572. package/utils/platform-check.d.ts +1 -1
  573. package/utils/platform-check.js.map +1 -1
  574. package/utils/shared.js.map +1 -1
  575. package/utils/types.js.map +1 -1
  576. package/utils/utils-shared.js.map +1 -1
  577. package/wgc/atob.js.map +1 -1
  578. package/wgc/btoa.js.map +1 -1
  579. package/wgc/crypto/SubtleCrypto.js.map +1 -1
  580. package/wgc/crypto/index.d.ts +1 -1
  581. package/wgc/crypto/index.js +12 -8
  582. package/wgc/crypto/index.js.map +1 -1
  583. package/wgc/index.js.map +1 -1
  584. package/xhr/index.js.map +1 -1
  585. package/xml/index.js.map +1 -1
@@ -1,4 +1,3 @@
1
- import { CoreTypes } from '../core-types';
2
1
  import { CSSUtils } from '../css/system-classes';
3
2
  import { Device, Screen } from '../platform';
4
3
  import { profile } from '../profiling';
@@ -6,47 +5,75 @@ import { Trace } from '../trace';
6
5
  import { clearResolverCache, prepareAppForModuleResolver, _setResolver } from '../module-name-resolver/helpers';
7
6
  import { Builder } from '../ui/builder';
8
7
  import * as bindableResources from '../ui/core/bindable/bindable-resources';
9
- import { getAppMainEntry, isAppInBackground, setAppInBackground, setAppMainEntry } from './helpers-common';
8
+ import { getActiveWindow, getAppMainEntry, getAutoSystemAppearanceChanged, isAppInBackground, setActiveWindow, setAppInBackground, setAppMainEntry, setAutoSystemAppearanceChanged } from './helpers-common';
10
9
  import { getNativeScriptGlobals } from '../globals/global-utils';
11
10
  import { SDK_VERSION } from '../utils/constants';
12
- // prettier-ignore
13
- const ORIENTATION_CSS_CLASSES = [
14
- `${CSSUtils.CLASS_PREFIX}${CoreTypes.DeviceOrientation.portrait}`,
15
- `${CSSUtils.CLASS_PREFIX}${CoreTypes.DeviceOrientation.landscape}`,
16
- `${CSSUtils.CLASS_PREFIX}${CoreTypes.DeviceOrientation.unknown}`,
17
- ];
18
- // prettier-ignore
19
- const SYSTEM_APPEARANCE_CSS_CLASSES = [
20
- `${CSSUtils.CLASS_PREFIX}${CoreTypes.SystemAppearance.light}`,
21
- `${CSSUtils.CLASS_PREFIX}${CoreTypes.SystemAppearance.dark}`,
22
- ];
23
- // prettier-ignore
24
- const LAYOUT_DIRECTION_CSS_CLASSES = [
25
- `${CSSUtils.CLASS_PREFIX}${CoreTypes.LayoutDirection.ltr}`,
26
- `${CSSUtils.CLASS_PREFIX}${CoreTypes.LayoutDirection.rtl}`,
27
- ];
11
+ import { NativeWindowEvents, WindowEvents } from '../native-window/native-window-interfaces';
12
+ const ORIENTATION_CSS_CLASSES = CSSUtils.ORIENTATION_CSS_CLASSES;
13
+ const SYSTEM_APPEARANCE_CSS_CLASSES = CSSUtils.SYSTEM_APPEARANCE_CSS_CLASSES;
14
+ const LAYOUT_DIRECTION_CSS_CLASSES = CSSUtils.LAYOUT_DIRECTION_CSS_CLASSES;
28
15
  const globalEvents = getNativeScriptGlobals().events;
29
16
  // Scene lifecycle event names
17
+ /**
18
+ * @deprecated Use `NativeWindowEvents` from `@nativescript/core/native-window` instead.
19
+ */
30
20
  export const SceneEvents = {
21
+ /** @deprecated Use `NativeWindowEvents.sceneWillConnect` instead. */
31
22
  sceneWillConnect: 'sceneWillConnect',
23
+ /** @deprecated Use `NativeWindowEvents.sceneDidActivate` instead. */
32
24
  sceneDidActivate: 'sceneDidActivate',
25
+ /** @deprecated Use `NativeWindowEvents.sceneWillResignActive` instead. */
33
26
  sceneWillResignActive: 'sceneWillResignActive',
27
+ /** @deprecated Use `NativeWindowEvents.sceneWillEnterForeground` instead. */
34
28
  sceneWillEnterForeground: 'sceneWillEnterForeground',
29
+ /** @deprecated Use `NativeWindowEvents.sceneDidEnterBackground` instead. */
35
30
  sceneDidEnterBackground: 'sceneDidEnterBackground',
31
+ /** @deprecated Use `NativeWindowEvents.sceneDidDisconnect` instead. */
36
32
  sceneDidDisconnect: 'sceneDidDisconnect',
33
+ /** @deprecated Use the Application 'windowOpen' event and NativeWindow.setContent() instead. */
37
34
  sceneContentSetup: 'sceneContentSetup',
38
35
  };
39
36
  export class ApplicationCommon {
37
+ /**
38
+ * Boolean to enable/disable systemAppearanceChanged
39
+ */
40
+ get autoSystemAppearanceChanged() {
41
+ return getAutoSystemAppearanceChanged();
42
+ }
43
+ set autoSystemAppearanceChanged(value) {
44
+ setAutoSystemAppearanceChanged(value);
45
+ }
40
46
  /**
41
47
  * @internal - should not be constructed by the user.
42
48
  */
43
49
  constructor() {
50
+ /**
51
+ * @deprecated Use the 'ready' event for application initialization and Application.setWindowContentResolver() to provide window UI. 'launch' continues to fire before the first window's content is created, and its 'root' property is still honored, for backwards compatibility. It never fires for additional windows. In a scene-based app it fires with the first window's content, so a background launch that connects no scene does not raise it.
52
+ */
44
53
  this.launchEvent = 'launch';
54
+ /**
55
+ * Raised once per JS context, as soon as the context is initialized. It is never deferred,
56
+ * so it also fires on a background launch where no window is created.
57
+ *
58
+ * Guaranteed ordering: `ready` -> `windowOpen` -> raw connect/create events -> content
59
+ * resolution (the legacy `launch` bridge runs here, for the first window only) ->
60
+ * `contentLoaded` -> `activate`/`displayed`.
61
+ */
62
+ this.readyEvent = 'ready';
63
+ /**
64
+ * Reflects whole-app state: with multiple windows it is raised once the app itself is
65
+ * no longer in the foreground, not when an individual window backgrounds. Listen on a
66
+ * NativeWindow for per-window state.
67
+ */
45
68
  this.suspendEvent = 'suspend';
46
69
  this.displayedEvent = 'displayed';
47
70
  this.backgroundEvent = 'background';
48
71
  this.foregroundEvent = 'foreground';
49
72
  this.resumeEvent = 'resume';
73
+ /**
74
+ * On Android, raised when the last window closes; the process may stay alive.
75
+ * On iOS, raised when the process itself terminates.
76
+ */
50
77
  this.exitEvent = 'exit';
51
78
  this.lowMemoryEvent = 'lowMemory';
52
79
  this.uncaughtErrorEvent = 'uncaughtError';
@@ -59,6 +86,9 @@ export class ApplicationCommon {
59
86
  this.loadAppCssEvent = 'loadAppCss';
60
87
  this.cssChangedEvent = 'cssChanged';
61
88
  this.initRootViewEvent = 'initRootView';
89
+ this.windowOpenEvent = WindowEvents.windowOpen;
90
+ this.windowCloseEvent = WindowEvents.windowClose;
91
+ this.primaryWindowChangedEvent = WindowEvents.primaryWindowChanged;
62
92
  // Application events go through the global events.
63
93
  this.on = globalEvents.on.bind(globalEvents);
64
94
  this.off = globalEvents.off.bind(globalEvents);
@@ -68,11 +98,15 @@ export class ApplicationCommon {
68
98
  this._inBackground = false;
69
99
  this._suspended = false;
70
100
  this._cssFile = './app.css';
101
+ this._readyNotified = false;
102
+ this._appCssLoaded = false;
103
+ this._launchBridgeConsumed = false;
104
+ this._windowContentResolver = null;
71
105
  this.started = false;
72
- /**
73
- * Boolean to enable/disable systemAppearanceChanged
74
- */
75
- this.autoSystemAppearanceChanged = true;
106
+ // --- NativeWindow registry ---
107
+ this._windows = [];
108
+ // --- Primary window traits ---
109
+ this._traitsWindow = null;
76
110
  getNativeScriptGlobals().appInstanceReady = true;
77
111
  global.__onUncaughtError = (error) => {
78
112
  this.notify({
@@ -150,18 +184,37 @@ export class ApplicationCommon {
150
184
  CSSUtils.removeSystemCssClass(cssClass);
151
185
  rootView.cssClasses.delete(cssClass);
152
186
  }
187
+ /**
188
+ * Same as {@link applyCssClass}, minus the system class list: window-scoped classes
189
+ * must not leak into it, because it seeds every window's root view.
190
+ */
191
+ applyWindowScopedCssClass(rootView, cssClasses, newCssClass) {
192
+ if (rootView.cssClasses.has(newCssClass)) {
193
+ return;
194
+ }
195
+ cssClasses.forEach((cssClass) => rootView.cssClasses.delete(cssClass));
196
+ rootView.cssClasses.add(newCssClass);
197
+ this.increaseStyleScopeApplicationCssSelectorVersion(rootView);
198
+ }
199
+ /**
200
+ * The modal registry is process-wide, so only the modals presented over this root
201
+ * view may follow its window-scoped classes.
202
+ */
203
+ getOwnedModalViews(rootView) {
204
+ return rootView._getRootModalViews().filter((modalView) => modalView._getRootModalHost() === rootView);
205
+ }
153
206
  increaseStyleScopeApplicationCssSelectorVersion(rootView) {
154
207
  const styleScope = rootView._styleScope ?? rootView?.currentPage?._styleScope;
155
208
  if (styleScope) {
156
209
  styleScope._increaseApplicationCssSelectorVersion();
157
210
  }
158
211
  }
159
- setRootViewCSSClasses(rootView) {
212
+ setRootViewCSSClasses(rootView, window) {
160
213
  const platform = Device.os.toLowerCase();
161
214
  const deviceType = Device.deviceType.toLowerCase();
162
- const orientation = this.orientation();
163
- const systemAppearance = this.systemAppearance();
164
- const layoutDirection = this.layoutDirection();
215
+ const orientation = window ? window.orientation() : this.orientation();
216
+ const systemAppearance = window ? window.systemAppearance() : this.systemAppearance();
217
+ const layoutDirection = window ? window.layoutDirection() : this.layoutDirection();
165
218
  if (platform) {
166
219
  CSSUtils.pushToSystemCssClasses(`${CSSUtils.CLASS_PREFIX}${platform}`);
167
220
  // SDK Version CSS classes
@@ -173,18 +226,20 @@ export class ApplicationCommon {
173
226
  if (deviceType) {
174
227
  CSSUtils.pushToSystemCssClasses(`${CSSUtils.CLASS_PREFIX}${deviceType}`);
175
228
  }
229
+ rootView.cssClasses.add(CSSUtils.ROOT_VIEW_CSS_CLASS);
230
+ const rootViewCssClasses = CSSUtils.getSystemCssClasses();
231
+ rootViewCssClasses.forEach((c) => rootView.cssClasses.add(c));
232
+ // Two windows can disagree on these, so they never reach the process-wide
233
+ // system class list — see CSSUtils.WINDOW_SCOPED_CSS_CLASSES.
176
234
  if (orientation) {
177
- CSSUtils.pushToSystemCssClasses(`${CSSUtils.CLASS_PREFIX}${orientation}`);
235
+ rootView.cssClasses.add(`${CSSUtils.CLASS_PREFIX}${orientation}`);
178
236
  }
179
237
  if (systemAppearance) {
180
- CSSUtils.pushToSystemCssClasses(`${CSSUtils.CLASS_PREFIX}${systemAppearance}`);
238
+ rootView.cssClasses.add(`${CSSUtils.CLASS_PREFIX}${systemAppearance}`);
181
239
  }
182
240
  if (layoutDirection) {
183
- CSSUtils.pushToSystemCssClasses(`${CSSUtils.CLASS_PREFIX}${layoutDirection}`);
241
+ rootView.cssClasses.add(`${CSSUtils.CLASS_PREFIX}${layoutDirection}`);
184
242
  }
185
- rootView.cssClasses.add(CSSUtils.ROOT_VIEW_CSS_CLASS);
186
- const rootViewCssClasses = CSSUtils.getSystemCssClasses();
187
- rootViewCssClasses.forEach((c) => rootView.cssClasses.add(c));
188
243
  this.increaseStyleScopeApplicationCssSelectorVersion(rootView);
189
244
  rootView._onCssStateChange();
190
245
  if (Trace.isEnabled()) {
@@ -214,7 +269,314 @@ export class ApplicationCommon {
214
269
  getMainEntry() {
215
270
  return getAppMainEntry();
216
271
  }
272
+ /**
273
+ * Sets the callback that supplies the UI for windows that need content.
274
+ * Pass `null` to remove a previously set resolver.
275
+ */
276
+ setWindowContentResolver(resolver) {
277
+ this._windowContentResolver = resolver ?? null;
278
+ }
279
+ /**
280
+ * @returns The callback currently supplying window content, if any.
281
+ */
282
+ getWindowContentResolver() {
283
+ return this._windowContentResolver;
284
+ }
285
+ /**
286
+ * Get the primary NativeWindow.
287
+ */
288
+ get primaryWindow() {
289
+ return this._windows.find((nw) => nw.isPrimary);
290
+ }
291
+ /**
292
+ * Get the NativeWindow the user is currently interacting with - the one that activated most
293
+ * recently and is still attached. Falls back to the primary window while no window holds
294
+ * activation, which is the case before the first window activates and on a platform that
295
+ * never raises `activate`.
296
+ */
297
+ get activeWindow() {
298
+ const active = getActiveWindow();
299
+ if (active && active.state === 'attached' && this._windows.indexOf(active) !== -1) {
300
+ return active;
301
+ }
302
+ return this.primaryWindow;
303
+ }
304
+ getWindows(role) {
305
+ if (role === 'all') {
306
+ return [...this._windows];
307
+ }
308
+ const roles = role ? (Array.isArray(role) ? role : [role]) : ['application', 'embedded'];
309
+ return this._windows.filter((nw) => roles.indexOf(nw.role) !== -1);
310
+ }
311
+ /**
312
+ * Get a registered NativeWindow by its id.
313
+ */
314
+ getWindowById(id) {
315
+ return this._windows.find((nw) => nw.id === id);
316
+ }
317
+ /**
318
+ * Opens a new window.
319
+ *
320
+ * @param options Options for the new window, including data to hand to it.
321
+ */
322
+ openWindow(options) {
323
+ throw new Error('openWindow() is not supported on this platform.');
324
+ }
325
+ /**
326
+ * @internal - Get all registered NativeWindows, whatever their role.
327
+ */
328
+ _getWindows() {
329
+ return [...this._windows];
330
+ }
331
+ /**
332
+ * @internal - Register a NativeWindow created by the platform lifecycle.
333
+ */
334
+ _registerWindow(nativeWindow) {
335
+ this._windows.push(nativeWindow);
336
+ // A closing window drops its own listeners, so this is never explicitly removed.
337
+ nativeWindow.on(NativeWindowEvents.activate, this.onWindowActivated, this);
338
+ if (nativeWindow.isPrimary) {
339
+ this.trackPrimaryWindowTraits(nativeWindow);
340
+ }
341
+ this._onWindowRegistered(nativeWindow);
342
+ this.notify({
343
+ eventName: this.windowOpenEvent,
344
+ object: this,
345
+ window: nativeWindow,
346
+ });
347
+ }
348
+ /**
349
+ * @internal - retire the windows behind discarded window-session ids.
350
+ *
351
+ * A session id can only stand in for a window whose native surface is already gone.
352
+ * iOS reports sessions discarded while the app was not running on the next launch,
353
+ * and such an id can name the session driving the app now, so an id match alone is
354
+ * no evidence that the window is finished with. Retiring an attached window tears
355
+ * down the UI in use - its root view unloads and nothing ever reloads it - so only
356
+ * detached windows are retired. Ids matching no window are ignored: they routinely
357
+ * belong to windows this JS context has never seen.
358
+ */
359
+ _retireDiscardedWindows(ids) {
360
+ for (const id of ids) {
361
+ const nativeWindow = id ? this.getWindowById(id) : undefined;
362
+ if (!nativeWindow) {
363
+ continue;
364
+ }
365
+ if (nativeWindow.state === 'attached') {
366
+ Trace.write(`Ignoring a discarded session for window '${id}': its surface is still attached.`, Trace.categories.NativeLifecycle, Trace.messageType.warn);
367
+ continue;
368
+ }
369
+ nativeWindow._notifyEvent(NativeWindowEvents.close);
370
+ this._unregisterWindow(nativeWindow);
371
+ }
372
+ }
373
+ /**
374
+ * @internal - Unregister a NativeWindow when its native surface is gone for good.
375
+ */
376
+ _unregisterWindow(nativeWindow) {
377
+ if (!nativeWindow._surfaceGone) {
378
+ Trace.write(`Unregistering window '${nativeWindow.id}' while its native surface is still live. A window may only be retired once the platform has reported the surface gone.`, Trace.categories.NativeLifecycle, Trace.messageType.error);
379
+ }
380
+ const idx = this._windows.indexOf(nativeWindow);
381
+ if (idx >= 0) {
382
+ this._windows.splice(idx, 1);
383
+ }
384
+ if (getActiveWindow() === nativeWindow) {
385
+ setActiveWindow(undefined);
386
+ }
387
+ this.notify({
388
+ eventName: this.windowCloseEvent,
389
+ object: this,
390
+ window: nativeWindow,
391
+ });
392
+ // If primary was removed, promote the next window that can actually host content
393
+ if (nativeWindow.isPrimary) {
394
+ nativeWindow._setIsPrimary(false);
395
+ const promoted = this.getWindows().find((nw) => nw.state === 'attached');
396
+ this.trackPrimaryWindowTraits(promoted);
397
+ if (promoted) {
398
+ promoted._setIsPrimary(true);
399
+ this._onPrimaryWindowPromoted(promoted);
400
+ this.notify({
401
+ eventName: this.primaryWindowChangedEvent,
402
+ object: this,
403
+ window: promoted,
404
+ });
405
+ }
406
+ }
407
+ nativeWindow._destroy();
408
+ }
409
+ /**
410
+ * Hook for platform-specific bookkeeping right after a window joins the registry,
411
+ * before `windowOpen` is raised.
412
+ */
413
+ _onWindowRegistered(nativeWindow) {
414
+ // noop
415
+ }
416
+ /**
417
+ * Hook for platform-specific bookkeeping right after a window takes over the primary
418
+ * role, before `primaryWindowChanged` is raised.
419
+ */
420
+ _onPrimaryWindowPromoted(nativeWindow) {
421
+ // noop
422
+ }
423
+ /**
424
+ * Points the application-level orientation, appearance and layout direction at the
425
+ * primary window, which owns those values now that each window has its own.
426
+ */
427
+ trackPrimaryWindowTraits(nativeWindow) {
428
+ const target = nativeWindow ?? null;
429
+ if (this._traitsWindow === target) {
430
+ return;
431
+ }
432
+ const previous = this._traitsWindow;
433
+ if (previous) {
434
+ previous.off(NativeWindowEvents.orientationChanged, this.onWindowOrientationChanged, this);
435
+ previous.off(NativeWindowEvents.systemAppearanceChanged, this.onWindowSystemAppearanceChanged, this);
436
+ previous.off(NativeWindowEvents.layoutDirectionChanged, this.onWindowLayoutDirectionChanged, this);
437
+ }
438
+ this._traitsWindow = target;
439
+ if (!target) {
440
+ return;
441
+ }
442
+ target.on(NativeWindowEvents.orientationChanged, this.onWindowOrientationChanged, this);
443
+ target.on(NativeWindowEvents.systemAppearanceChanged, this.onWindowSystemAppearanceChanged, this);
444
+ target.on(NativeWindowEvents.layoutDirectionChanged, this.onWindowLayoutDirectionChanged, this);
445
+ this.syncTraitsFromWindow(target);
446
+ }
447
+ /**
448
+ * Adopts the window's values. The very first window seeds them quietly — there is no
449
+ * previous application state for it to differ from — while a later promotion raises
450
+ * the change events, because app code observed the outgoing window's values.
451
+ */
452
+ syncTraitsFromWindow(nativeWindow) {
453
+ const orientation = nativeWindow.orientation();
454
+ if (orientation) {
455
+ if (this._orientation === undefined) {
456
+ this._orientation = orientation;
457
+ }
458
+ else {
459
+ this.setOrientation(orientation);
460
+ }
461
+ }
462
+ const systemAppearance = nativeWindow.systemAppearance();
463
+ if (systemAppearance) {
464
+ if (this._systemAppearance === undefined) {
465
+ this._systemAppearance = systemAppearance;
466
+ }
467
+ else {
468
+ this.setSystemAppearance(systemAppearance);
469
+ }
470
+ }
471
+ const layoutDirection = nativeWindow.layoutDirection();
472
+ if (layoutDirection) {
473
+ if (this._layoutDirection === undefined) {
474
+ this._layoutDirection = layoutDirection;
475
+ }
476
+ else {
477
+ this.setLayoutDirection(layoutDirection);
478
+ }
479
+ }
480
+ }
481
+ onWindowActivated(data) {
482
+ setActiveWindow(data.window);
483
+ }
484
+ onWindowOrientationChanged(data) {
485
+ this.setOrientation(data.newValue);
486
+ }
487
+ onWindowSystemAppearanceChanged(data) {
488
+ this.setSystemAppearance(data.newValue);
489
+ }
490
+ onWindowLayoutDirectionChanged(data) {
491
+ this.setLayoutDirection(data.newValue);
492
+ }
493
+ /**
494
+ * @internal - raises `ready` at most once per JS context.
495
+ */
496
+ notifyReady() {
497
+ if (this._readyNotified) {
498
+ return;
499
+ }
500
+ this._readyNotified = true;
501
+ getNativeScriptGlobals().setLaunched();
502
+ this.notify({
503
+ eventName: this.readyEvent,
504
+ object: this,
505
+ ios: this.ios,
506
+ android: this.android,
507
+ });
508
+ }
509
+ /**
510
+ * @internal - produces the content for a window that has none.
511
+ *
512
+ * Resolution order: the window content resolver, then the legacy `launch` event
513
+ * (offered to the first window that asks for content and to no other), then the
514
+ * application main entry. A resolver or a `launch` handler returning `null` takes
515
+ * ownership of the content, so nothing else is tried. A missing main entry leaves
516
+ * the window empty instead of throwing, because content can still arrive later
517
+ * through `run()`/`resetRootView()`.
518
+ *
519
+ * @param options.install `false` returns the resolved view instead of applying it,
520
+ * for platform pipelines that install the root view on the native surface themselves.
521
+ * @param options.launchData platform payload merged into the legacy `launch` event args.
522
+ * @returns The resolved view, or `null` when no content was produced.
523
+ */
524
+ _resolveWindowContent(window, request, options) {
525
+ const content = this.resolveWindowContent(request, options?.launchData);
526
+ if (content == null) {
527
+ return null;
528
+ }
529
+ if (options?.install === false) {
530
+ return this.buildContentView(content);
531
+ }
532
+ window.setContent(content);
533
+ return window.rootView;
534
+ }
535
+ resolveWindowContent(request, launchData) {
536
+ const launchBridgeAvailable = !this._launchBridgeConsumed;
537
+ this._launchBridgeConsumed = true;
538
+ const resolver = this._windowContentResolver;
539
+ if (resolver) {
540
+ const resolved = resolver(request);
541
+ // `null` means the resolver supplies the content itself; only `undefined` falls through.
542
+ if (resolved !== undefined) {
543
+ this._ensureAppCssLoaded();
544
+ return resolved;
545
+ }
546
+ }
547
+ if (launchBridgeAvailable) {
548
+ const root = this.notifyLaunch(launchData);
549
+ if (root === null) {
550
+ return null;
551
+ }
552
+ if (root) {
553
+ return root;
554
+ }
555
+ }
556
+ this._ensureAppCssLoaded();
557
+ const mainEntry = getAppMainEntry();
558
+ return mainEntry ? Builder.createViewFromEntry(mainEntry) : undefined;
559
+ }
560
+ buildContentView(content) {
561
+ if (typeof content === 'string') {
562
+ return Builder.createViewFromEntry({ moduleName: content });
563
+ }
564
+ const entry = content;
565
+ return entry.moduleName || entry.create ? Builder.createViewFromEntry(entry) : content;
566
+ }
567
+ /**
568
+ * Loads the app CSS once per JS context. On the legacy `launch` path this has to run
569
+ * after the handlers, which are allowed to call `setCssFileName()`.
570
+ */
571
+ _ensureAppCssLoaded() {
572
+ if (this._appCssLoaded) {
573
+ return;
574
+ }
575
+ this._appCssLoaded = true;
576
+ this.loadAppCss();
577
+ }
217
578
  notifyLaunch(additionalLanchEventData) {
579
+ this._launchBridgeConsumed = true;
218
580
  const launchArgs = {
219
581
  eventName: this.launchEvent,
220
582
  object: this,
@@ -223,7 +585,7 @@ export class ApplicationCommon {
223
585
  ...additionalLanchEventData,
224
586
  };
225
587
  this.notify(launchArgs);
226
- this.loadAppCss();
588
+ this._ensureAppCssLoaded();
227
589
  return launchArgs.root;
228
590
  }
229
591
  createRootView(view, fireLaunchEvent = false, additionalLanchEventData) {
@@ -253,8 +615,12 @@ export class ApplicationCommon {
253
615
  setAppMainEntry(typeof entry === 'string' ? { moduleName: entry } : entry);
254
616
  // rest of implementation is platform specific
255
617
  }
256
- initRootView(rootView) {
257
- this.setRootViewCSSClasses(rootView);
618
+ /**
619
+ * @param window the window the root view belongs to. Supplies the window-scoped CSS
620
+ * classes; without it they come from the primary window.
621
+ */
622
+ initRootView(rootView, window) {
623
+ this.setRootViewCSSClasses(rootView, window);
258
624
  // ensure css is "loaded" on the rootview so that user rootview can access css variables right away
259
625
  rootView._onCssStateChange(true);
260
626
  this.notify({ eventName: this.initRootViewEvent, rootView });
@@ -348,18 +714,20 @@ export class ApplicationCommon {
348
714
  object: this,
349
715
  });
350
716
  }
717
+ /**
718
+ * @deprecated Use Application.primaryWindow?.orientation() - or the NativeWindow of the relevant view - instead. Continues to reflect the primary window.
719
+ */
351
720
  orientation() {
352
- return (this._orientation ?? (this._orientation = this.getOrientation()));
721
+ return this.primaryWindow?.orientation() ?? (this._orientation ?? (this._orientation = this.getOrientation()));
353
722
  }
354
723
  orientationChanged(rootView, newOrientation) {
355
724
  if (!rootView) {
356
725
  return;
357
726
  }
358
727
  const newOrientationCssClass = `${CSSUtils.CLASS_PREFIX}${newOrientation}`;
359
- this.applyCssClass(rootView, ORIENTATION_CSS_CLASSES, newOrientationCssClass, true);
360
- const rootModalViews = rootView._getRootModalViews();
361
- rootModalViews.forEach((rootModalView) => {
362
- this.applyCssClass(rootModalView, ORIENTATION_CSS_CLASSES, newOrientationCssClass, true);
728
+ this.applyWindowScopedCssClass(rootView, ORIENTATION_CSS_CLASSES, newOrientationCssClass);
729
+ this.getOwnedModalViews(rootView).forEach((rootModalView) => {
730
+ this.applyWindowScopedCssClass(rootModalView, ORIENTATION_CSS_CLASSES, newOrientationCssClass);
363
731
  // Trigger state change for root modal view classes and media queries
364
732
  rootModalView._onCssStateChange();
365
733
  });
@@ -391,19 +759,21 @@ export class ApplicationCommon {
391
759
  object: this,
392
760
  };
393
761
  this.notify(args);
394
- if (args.cancel === false) {
762
+ if (args.cancel === false && this.autoSystemAppearanceChanged) {
395
763
  this.systemAppearanceChanged(this.getRootView(), value);
396
764
  }
397
765
  }
766
+ /**
767
+ * @deprecated Use Application.primaryWindow?.systemAppearance() - or the NativeWindow of the relevant view - instead. Continues to reflect the primary window.
768
+ */
398
769
  systemAppearance() {
399
- // return cached value, or get it from the platform specific override
400
- return (this._systemAppearance ?? (this._systemAppearance = this.getSystemAppearance()));
770
+ return this.primaryWindow?.systemAppearance() ?? (this._systemAppearance ?? (this._systemAppearance = this.getSystemAppearance()));
401
771
  }
402
772
  /**
403
773
  * enable/disable systemAppearanceChanged
404
774
  */
405
775
  setAutoSystemAppearanceChanged(value) {
406
- this.autoSystemAppearanceChanged = value;
776
+ setAutoSystemAppearanceChanged(value);
407
777
  }
408
778
  /**
409
779
  * Updates root view classes including those of modals
@@ -411,14 +781,13 @@ export class ApplicationCommon {
411
781
  * @param newSystemAppearance the new appearance change
412
782
  */
413
783
  systemAppearanceChanged(rootView, newSystemAppearance) {
414
- if (!rootView || !this.autoSystemAppearanceChanged) {
784
+ if (!rootView) {
415
785
  return;
416
786
  }
417
787
  const newSystemAppearanceCssClass = `${CSSUtils.CLASS_PREFIX}${newSystemAppearance}`;
418
- this.applyCssClass(rootView, SYSTEM_APPEARANCE_CSS_CLASSES, newSystemAppearanceCssClass, true);
419
- const rootModalViews = rootView._getRootModalViews();
420
- rootModalViews.forEach((rootModalView) => {
421
- this.applyCssClass(rootModalView, SYSTEM_APPEARANCE_CSS_CLASSES, newSystemAppearanceCssClass, true);
788
+ this.applyWindowScopedCssClass(rootView, SYSTEM_APPEARANCE_CSS_CLASSES, newSystemAppearanceCssClass);
789
+ this.getOwnedModalViews(rootView).forEach((rootModalView) => {
790
+ this.applyWindowScopedCssClass(rootModalView, SYSTEM_APPEARANCE_CSS_CLASSES, newSystemAppearanceCssClass);
422
791
  // Trigger state change for root modal view classes and media queries
423
792
  rootModalView._onCssStateChange();
424
793
  });
@@ -443,9 +812,11 @@ export class ApplicationCommon {
443
812
  object: this,
444
813
  });
445
814
  }
815
+ /**
816
+ * @deprecated Use Application.primaryWindow?.layoutDirection() - or the NativeWindow of the relevant view - instead. Continues to reflect the primary window.
817
+ */
446
818
  layoutDirection() {
447
- // return cached value, or get it from the platform specific override
448
- return (this._layoutDirection ?? (this._layoutDirection = this.getLayoutDirection()));
819
+ return this.primaryWindow?.layoutDirection() ?? (this._layoutDirection ?? (this._layoutDirection = this.getLayoutDirection()));
449
820
  }
450
821
  /**
451
822
  * Updates root view classes including those of modals
@@ -457,10 +828,9 @@ export class ApplicationCommon {
457
828
  return;
458
829
  }
459
830
  const newLayoutDirectionCssClass = `${CSSUtils.CLASS_PREFIX}${newLayoutDirection}`;
460
- this.applyCssClass(rootView, LAYOUT_DIRECTION_CSS_CLASSES, newLayoutDirectionCssClass, true);
461
- const rootModalViews = rootView._getRootModalViews();
462
- rootModalViews.forEach((rootModalView) => {
463
- this.applyCssClass(rootModalView, LAYOUT_DIRECTION_CSS_CLASSES, newLayoutDirectionCssClass, true);
831
+ this.applyWindowScopedCssClass(rootView, LAYOUT_DIRECTION_CSS_CLASSES, newLayoutDirectionCssClass);
832
+ this.getOwnedModalViews(rootView).forEach((rootModalView) => {
833
+ this.applyWindowScopedCssClass(rootModalView, LAYOUT_DIRECTION_CSS_CLASSES, newLayoutDirectionCssClass);
464
834
  // Trigger state change for root modal view classes and media queries
465
835
  rootModalView._onCssStateChange();
466
836
  });