@nativescript/core 9.1.0-alpha.8 → 9.1.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/animation-frame/animation-native.windows.d.ts +1 -0
- package/animation-frame/animation-native.windows.js +4 -0
- package/animation-frame/animation-native.windows.js.map +1 -0
- package/application/application-common.d.ts +2 -1
- package/application/application-common.js +4 -0
- package/application/application-common.js.map +1 -1
- package/application/application.android.d.ts +0 -16
- package/application/application.android.js +1 -6
- package/application/application.android.js.map +1 -1
- package/application/application.d.ts +9 -0
- package/application/application.ios.d.ts +1 -2
- package/application/application.ios.js +3 -50
- package/application/application.ios.js.map +1 -1
- package/application/application.windows.d.ts +27 -0
- package/application/application.windows.js +331 -0
- package/application/application.windows.js.map +1 -0
- package/application/helpers.windows.d.ts +8 -0
- package/application/helpers.windows.js +12 -0
- package/application/helpers.windows.js.map +1 -0
- package/application/index.windows.d.ts +2 -0
- package/application/index.windows.js +3 -0
- package/application/index.windows.js.map +1 -0
- package/application/window-helper.windows.d.ts +29 -0
- package/application/window-helper.windows.js +159 -0
- package/application/window-helper.windows.js.map +1 -0
- package/application-settings/index.windows.d.ts +11 -0
- package/application-settings/index.windows.js +93 -0
- package/application-settings/index.windows.js.map +1 -0
- package/color/index.d.ts +5 -0
- package/color/index.windows.d.ts +8 -0
- package/color/index.windows.js +19 -0
- package/color/index.windows.js.map +1 -0
- package/connectivity/index.windows.d.ts +11 -0
- package/connectivity/index.windows.js +50 -0
- package/connectivity/index.windows.js.map +1 -0
- package/debugger/webinspector-network.windows.d.ts +79 -0
- package/debugger/webinspector-network.windows.js +307 -0
- package/debugger/webinspector-network.windows.js.map +1 -0
- package/file-system/file-system-access.windows.d.ts +76 -0
- package/file-system/file-system-access.windows.js +476 -0
- package/file-system/file-system-access.windows.js.map +1 -0
- package/fps-meter/fps-native.windows.d.ts +8 -0
- package/fps-meter/fps-native.windows.js +40 -0
- package/fps-meter/fps-native.windows.js.map +1 -0
- package/global-types.d.ts +1 -0
- package/globals/index.js +1 -4
- package/globals/index.js.map +1 -1
- package/http/http-request/index.android.js.map +1 -1
- package/http/http-request/index.ios.js.map +1 -1
- package/http/http-request/index.windows.d.ts +2 -0
- package/http/http-request/index.windows.js +41 -0
- package/http/http-request/index.windows.js.map +1 -0
- package/http/http-request-internal/index.android.d.ts +1 -7
- package/http/http-request-internal/index.android.js.map +1 -1
- package/http/http-request-internal/index.ios.d.ts +1 -7
- package/http/http-request-internal/index.ios.js.map +1 -1
- package/http/http-request-internal/index.windows.d.ts +4 -0
- package/http/http-request-internal/index.windows.js +134 -0
- package/http/http-request-internal/index.windows.js.map +1 -0
- package/image-asset/index.windows.d.ts +9 -0
- package/image-asset/index.windows.js +34 -0
- package/image-asset/index.windows.js.map +1 -0
- package/image-source/index.android.d.ts +1 -0
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.d.ts +5 -0
- package/image-source/index.ios.d.ts +1 -0
- package/image-source/index.ios.js.map +1 -1
- package/image-source/index.windows.d.ts +52 -0
- package/image-source/index.windows.js +498 -0
- package/image-source/index.windows.js.map +1 -0
- package/package.json +6 -2
- package/platform/common.d.ts +2 -0
- package/platform/common.js +2 -0
- package/platform/common.js.map +1 -1
- package/platform/device/index.windows.d.ts +18 -0
- package/platform/device/index.windows.js +94 -0
- package/platform/device/index.windows.js.map +1 -0
- package/platform/screen/index.windows.d.ts +13 -0
- package/platform/screen/index.windows.js +25 -0
- package/platform/screen/index.windows.js.map +1 -0
- package/platforms/windows/arm64/NativeScript.Widgets.dll +0 -0
- package/platforms/windows/arm64/NativeScript.Widgets.winmd +0 -0
- package/platforms/windows/x64/NativeScript.Widgets.dll +0 -0
- package/platforms/windows/x64/NativeScript.Widgets.winmd +0 -0
- package/plugin.props +12 -0
- package/plugin.targets +71 -0
- package/references.d.ts +4 -0
- package/text/index.windows.d.ts +9 -0
- package/text/index.windows.js +12 -0
- package/text/index.windows.js.map +1 -0
- package/timer/index.windows.d.ts +4 -0
- package/timer/index.windows.js +14 -0
- package/timer/index.windows.js.map +1 -0
- package/ui/action-bar/index.ios.js +1 -0
- package/ui/action-bar/index.ios.js.map +1 -1
- package/ui/action-bar/index.windows.d.ts +12 -0
- package/ui/action-bar/index.windows.js +36 -0
- package/ui/action-bar/index.windows.js.map +1 -0
- package/ui/activity-indicator/index.windows.d.ts +15 -0
- package/ui/activity-indicator/index.windows.js +65 -0
- package/ui/activity-indicator/index.windows.js.map +1 -0
- package/ui/animation/index.windows.d.ts +19 -0
- package/ui/animation/index.windows.js +603 -0
- package/ui/animation/index.windows.js.map +1 -0
- package/ui/builder/index.d.ts +1 -0
- package/ui/builder/index.js +2 -1
- package/ui/builder/index.js.map +1 -1
- package/ui/button/index.android.d.ts +9 -2
- package/ui/button/index.android.js +24 -7
- package/ui/button/index.android.js.map +1 -1
- package/ui/button/index.ios.d.ts +9 -2
- package/ui/button/index.ios.js +72 -17
- package/ui/button/index.ios.js.map +1 -1
- package/ui/button/index.windows.d.ts +13 -0
- package/ui/button/index.windows.js +73 -0
- package/ui/button/index.windows.js.map +1 -0
- package/ui/core/bindable/index.js +1 -2
- package/ui/core/bindable/index.js.map +1 -1
- package/ui/core/control-state-change/index.windows.d.ts +4 -0
- package/ui/core/control-state-change/index.windows.js +6 -0
- package/ui/core/control-state-change/index.windows.js.map +1 -0
- package/ui/core/view/index.android.d.ts +0 -1
- package/ui/core/view/index.android.js +8 -17
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.ios.d.ts +0 -1
- package/ui/core/view/index.ios.js +4 -17
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/index.windows.d.ts +120 -0
- package/ui/core/view/index.windows.js +2178 -0
- package/ui/core/view/index.windows.js.map +1 -0
- package/ui/core/view/view-common.d.ts +2 -0
- package/ui/core/view/view-common.js +6 -1
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.d.ts +0 -1
- package/ui/core/view/view-helper/index.ios.d.ts +0 -24
- package/ui/core/view/view-helper/index.ios.js +5 -54
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view/view-helper/index.windows.d.ts +3 -0
- package/ui/core/view/view-helper/index.windows.js +4 -0
- package/ui/core/view/view-helper/index.windows.js.map +1 -0
- package/ui/core/view-base/index.d.ts +10 -24
- package/ui/core/view-base/index.js +32 -50
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/date-picker/index.windows.d.ts +22 -0
- package/ui/date-picker/index.windows.js +97 -0
- package/ui/date-picker/index.windows.js.map +1 -0
- package/ui/dialogs/index.windows.d.ts +17 -0
- package/ui/dialogs/index.windows.js +471 -0
- package/ui/dialogs/index.windows.js.map +1 -0
- package/ui/editable-text-base/index.windows.d.ts +27 -0
- package/ui/editable-text-base/index.windows.js +165 -0
- package/ui/editable-text-base/index.windows.js.map +1 -0
- package/ui/embedding/index.windows.d.ts +1 -0
- package/ui/embedding/index.windows.js +4 -0
- package/ui/embedding/index.windows.js.map +1 -0
- package/ui/frame/fragment.transitions.android.d.ts +13 -13
- package/ui/frame/fragment.transitions.android.js.map +1 -1
- package/ui/frame/frame-common.d.ts +1 -2
- package/ui/frame/frame-common.js +0 -10
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/frame-helper-for-android.d.ts +4 -4
- package/ui/frame/frame-helper-for-android.js +8 -17
- package/ui/frame/frame-helper-for-android.js.map +1 -1
- package/ui/frame/index.android.d.ts +11 -6
- package/ui/frame/index.android.js +59 -18
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.d.ts +21 -12
- package/ui/frame/index.ios.d.ts +2 -2
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/frame/index.windows.d.ts +52 -0
- package/ui/frame/index.windows.js +778 -0
- package/ui/frame/index.windows.js.map +1 -0
- package/ui/gestures/index.windows.d.ts +35 -0
- package/ui/gestures/index.windows.js +483 -0
- package/ui/gestures/index.windows.js.map +1 -0
- package/ui/html-view/index.windows.d.ts +18 -0
- package/ui/html-view/index.windows.js +191 -0
- package/ui/html-view/index.windows.js.map +1 -0
- package/ui/image/index.windows.d.ts +17 -0
- package/ui/image/index.windows.js +132 -0
- package/ui/image/index.windows.js.map +1 -0
- package/ui/image/symbol-effects.windows.d.ts +5 -0
- package/ui/image/symbol-effects.windows.js +8 -0
- package/ui/image/symbol-effects.windows.js.map +1 -0
- package/ui/image-cache/index.windows.d.ts +11 -0
- package/ui/image-cache/index.windows.js +48 -0
- package/ui/image-cache/index.windows.js.map +1 -0
- package/ui/label/index.ios.d.ts +5 -2
- package/ui/label/index.ios.js +44 -12
- package/ui/label/index.ios.js.map +1 -1
- package/ui/label/index.windows.d.ts +15 -0
- package/ui/label/index.windows.js +66 -0
- package/ui/label/index.windows.js.map +1 -0
- package/ui/layouts/absolute-layout/index.ios.js +1 -5
- package/ui/layouts/absolute-layout/index.ios.js.map +1 -1
- package/ui/layouts/absolute-layout/index.windows.d.ts +8 -0
- package/ui/layouts/absolute-layout/index.windows.js +47 -0
- package/ui/layouts/absolute-layout/index.windows.js.map +1 -0
- package/ui/layouts/dock-layout/index.ios.js +1 -5
- package/ui/layouts/dock-layout/index.ios.js.map +1 -1
- package/ui/layouts/dock-layout/index.windows.d.ts +19 -0
- package/ui/layouts/dock-layout/index.windows.js +202 -0
- package/ui/layouts/dock-layout/index.windows.js.map +1 -0
- package/ui/layouts/flexbox-layout/flexbox-layout-common.d.ts +17 -2
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js +73 -2
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.ios.js +1 -5
- package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.windows.d.ts +27 -0
- package/ui/layouts/flexbox-layout/index.windows.js +188 -0
- package/ui/layouts/flexbox-layout/index.windows.js.map +1 -0
- package/ui/layouts/grid-layout/index.ios.js +1 -5
- package/ui/layouts/grid-layout/index.ios.js.map +1 -1
- package/ui/layouts/grid-layout/index.windows.d.ts +20 -0
- package/ui/layouts/grid-layout/index.windows.js +130 -0
- package/ui/layouts/grid-layout/index.windows.js.map +1 -0
- package/ui/layouts/layout-base.android.d.ts +10 -3
- package/ui/layouts/layout-base.android.js +24 -7
- package/ui/layouts/layout-base.android.js.map +1 -1
- package/ui/layouts/layout-base.ios.js.map +1 -1
- package/ui/layouts/layout-base.windows.d.ts +4 -0
- package/ui/layouts/layout-base.windows.js +5 -0
- package/ui/layouts/layout-base.windows.js.map +1 -0
- package/ui/layouts/liquid-glass/index.windows.d.ts +4 -0
- package/ui/layouts/liquid-glass/index.windows.js +5 -0
- package/ui/layouts/liquid-glass/index.windows.js.map +1 -0
- package/ui/layouts/liquid-glass-container/index.windows.d.ts +4 -0
- package/ui/layouts/liquid-glass-container/index.windows.js +5 -0
- package/ui/layouts/liquid-glass-container/index.windows.js.map +1 -0
- package/ui/layouts/root-layout/index.windows.d.ts +13 -0
- package/ui/layouts/root-layout/index.windows.js +160 -0
- package/ui/layouts/root-layout/index.windows.js.map +1 -0
- package/ui/layouts/stack-layout/index.ios.js +1 -5
- package/ui/layouts/stack-layout/index.ios.js.map +1 -1
- package/ui/layouts/stack-layout/index.windows.d.ts +13 -0
- package/ui/layouts/stack-layout/index.windows.js +63 -0
- package/ui/layouts/stack-layout/index.windows.js.map +1 -0
- package/ui/layouts/wrap-layout/index.ios.js +1 -5
- package/ui/layouts/wrap-layout/index.ios.js.map +1 -1
- package/ui/layouts/wrap-layout/index.windows.d.ts +20 -0
- package/ui/layouts/wrap-layout/index.windows.js +182 -0
- package/ui/layouts/wrap-layout/index.windows.js.map +1 -0
- package/ui/list-picker/index.windows.d.ts +19 -0
- package/ui/list-picker/index.windows.js +75 -0
- package/ui/list-picker/index.windows.js.map +1 -0
- package/ui/list-view/index.d.ts +1 -13
- package/ui/list-view/index.ios.d.ts +1 -3
- package/ui/list-view/index.ios.js +10 -48
- package/ui/list-view/index.ios.js.map +1 -1
- package/ui/list-view/index.windows.d.ts +60 -0
- package/ui/list-view/index.windows.js +842 -0
- package/ui/list-view/index.windows.js.map +1 -0
- package/ui/list-view/list-view-common.d.ts +0 -14
- package/ui/list-view/list-view-common.js +0 -4
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/index.d.ts +1 -1
- package/ui/page/index.ios.d.ts +0 -1
- package/ui/page/index.ios.js +1 -15
- package/ui/page/index.ios.js.map +1 -1
- package/ui/page/index.windows.d.ts +12 -0
- package/ui/page/index.windows.js +42 -0
- package/ui/page/index.windows.js.map +1 -0
- package/ui/page/page-common.d.ts +2 -5
- package/ui/page/page-common.js.map +1 -1
- package/ui/progress/index.windows.d.ts +20 -0
- package/ui/progress/index.windows.js +65 -0
- package/ui/progress/index.windows.js.map +1 -0
- package/ui/repeater/index.d.ts +1 -2
- package/ui/repeater/index.js.map +1 -1
- package/ui/scroll-view/index.d.ts +0 -13
- package/ui/scroll-view/index.ios.js +7 -21
- package/ui/scroll-view/index.ios.js.map +1 -1
- package/ui/scroll-view/index.windows.d.ts +29 -0
- package/ui/scroll-view/index.windows.js +192 -0
- package/ui/scroll-view/index.windows.js.map +1 -0
- package/ui/scroll-view/scroll-view-common.d.ts +0 -6
- package/ui/scroll-view/scroll-view-common.js +0 -8
- package/ui/scroll-view/scroll-view-common.js.map +1 -1
- package/ui/search-bar/index.windows.d.ts +19 -0
- package/ui/search-bar/index.windows.js +91 -0
- package/ui/search-bar/index.windows.js.map +1 -0
- package/ui/segmented-bar/index.windows.d.ts +23 -0
- package/ui/segmented-bar/index.windows.js +117 -0
- package/ui/segmented-bar/index.windows.js.map +1 -0
- package/ui/segmented-bar/segmented-bar-common.d.ts +1 -5
- package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
- package/ui/slider/index.windows.d.ts +25 -0
- package/ui/slider/index.windows.js +134 -0
- package/ui/slider/index.windows.js.map +1 -0
- package/ui/split-view/index.windows.d.ts +49 -0
- package/ui/split-view/index.windows.js +549 -0
- package/ui/split-view/index.windows.js.map +1 -0
- package/ui/styling/background.windows.d.ts +2 -0
- package/ui/styling/background.windows.js +2 -0
- package/ui/styling/background.windows.js.map +1 -0
- package/ui/styling/font.d.ts +4 -0
- package/ui/styling/font.windows.d.ts +25 -0
- package/ui/styling/font.windows.js +213 -0
- package/ui/styling/font.windows.js.map +1 -0
- package/ui/styling/style/index.d.ts +0 -1
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.d.ts +0 -1
- package/ui/styling/style-properties.js +32 -41
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.js +9 -1
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/switch/index.windows.d.ts +20 -0
- package/ui/switch/index.windows.js +97 -0
- package/ui/switch/index.windows.js.map +1 -0
- package/ui/tab-view/index.ios.d.ts +1 -10
- package/ui/tab-view/index.ios.js +4 -21
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/index.windows.d.ts +29 -0
- package/ui/tab-view/index.windows.js +268 -0
- package/ui/tab-view/index.windows.js.map +1 -0
- package/ui/tab-view/tab-view-common.d.ts +1 -5
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/index.android.d.ts +9 -2
- package/ui/text-base/index.android.js +24 -7
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.windows.d.ts +47 -0
- package/ui/text-base/index.windows.js +639 -0
- package/ui/text-base/index.windows.js.map +1 -0
- package/ui/text-field/index.ios.d.ts +9 -2
- package/ui/text-field/index.ios.js +23 -2
- package/ui/text-field/index.ios.js.map +1 -1
- package/ui/text-field/index.windows.d.ts +23 -0
- package/ui/text-field/index.windows.js +186 -0
- package/ui/text-field/index.windows.js.map +1 -0
- package/ui/text-view/index.ios.d.ts +9 -2
- package/ui/text-view/index.ios.js +72 -20
- package/ui/text-view/index.ios.js.map +1 -1
- package/ui/text-view/index.windows.d.ts +12 -0
- package/ui/text-view/index.windows.js +47 -0
- package/ui/text-view/index.windows.js.map +1 -0
- package/ui/time-picker/index.windows.d.ts +18 -0
- package/ui/time-picker/index.windows.js +77 -0
- package/ui/time-picker/index.windows.js.map +1 -0
- package/ui/transition/fade-transition.windows.d.ts +3 -0
- package/ui/transition/fade-transition.windows.js +4 -0
- package/ui/transition/fade-transition.windows.js.map +1 -0
- package/ui/transition/index.d.ts +1 -2
- package/ui/transition/index.windows.d.ts +20 -0
- package/ui/transition/index.windows.js +30 -0
- package/ui/transition/index.windows.js.map +1 -0
- package/ui/transition/modal-transition.ios.js +5 -33
- package/ui/transition/modal-transition.ios.js.map +1 -1
- package/ui/transition/modal-transition.windows.d.ts +3 -0
- package/ui/transition/modal-transition.windows.js +4 -0
- package/ui/transition/modal-transition.windows.js.map +1 -0
- package/ui/transition/page-transition.ios.d.ts +0 -5
- package/ui/transition/page-transition.ios.js +33 -296
- package/ui/transition/page-transition.ios.js.map +1 -1
- package/ui/transition/page-transition.windows.d.ts +3 -0
- package/ui/transition/page-transition.windows.js +4 -0
- package/ui/transition/page-transition.windows.js.map +1 -0
- package/ui/transition/shared-transition-helper.android.d.ts +0 -3
- package/ui/transition/shared-transition-helper.android.js +0 -9
- package/ui/transition/shared-transition-helper.android.js.map +1 -1
- package/ui/transition/shared-transition-helper.d.ts +0 -7
- package/ui/transition/shared-transition-helper.ios.d.ts +0 -36
- package/ui/transition/shared-transition-helper.ios.js +89 -765
- package/ui/transition/shared-transition-helper.ios.js.map +1 -1
- package/ui/transition/shared-transition-helper.windows.d.ts +30 -0
- package/ui/transition/shared-transition-helper.windows.js +155 -0
- package/ui/transition/shared-transition-helper.windows.js.map +1 -0
- package/ui/transition/shared-transition.d.ts +0 -66
- package/ui/transition/shared-transition.js +2 -57
- package/ui/transition/shared-transition.js.map +1 -1
- package/ui/transition/slide-transition.windows.d.ts +3 -0
- package/ui/transition/slide-transition.windows.js +4 -0
- package/ui/transition/slide-transition.windows.js.map +1 -0
- package/ui/utils.windows.d.ts +9 -0
- package/ui/utils.windows.js +21 -0
- package/ui/utils.windows.js.map +1 -0
- package/ui/web-view/index.windows.d.ts +23 -0
- package/ui/web-view/index.windows.js +115 -0
- package/ui/web-view/index.windows.js.map +1 -0
- package/utils/constants.windows.d.ts +2 -0
- package/utils/constants.windows.js +5 -0
- package/utils/constants.windows.js.map +1 -0
- package/utils/debug-source.js +3 -0
- package/utils/debug-source.js.map +1 -1
- package/utils/index.windows.d.ts +20 -0
- package/utils/index.windows.js +94 -0
- package/utils/index.windows.js.map +1 -0
- package/utils/layout-helper/index.windows.d.ts +25 -0
- package/utils/layout-helper/index.windows.js +74 -0
- package/utils/layout-helper/index.windows.js.map +1 -0
- package/utils/mainthread-helper.windows.d.ts +3 -0
- package/utils/mainthread-helper.windows.js +18 -0
- package/utils/mainthread-helper.windows.js.map +1 -0
- package/utils/native-helper.android.d.ts +2 -66
- package/utils/native-helper.android.js.map +1 -1
- package/utils/native-helper.ios.d.ts +2 -105
- package/utils/native-helper.ios.js +4 -15
- package/utils/native-helper.ios.js.map +1 -1
- package/utils/native-helper.windows.d.ts +8 -0
- package/utils/native-helper.windows.js +101 -0
- package/utils/native-helper.windows.js.map +1 -0
- package/utils/platform-check.d.ts +1 -1
- package/utils/platform-check.js.map +1 -1
- package/utils/native-helper.types.d.ts +0 -2
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
import { FrameBase, NavigationType } from './frame-common';
|
|
2
|
+
import { profile } from '../../profiling';
|
|
3
|
+
import { SharedTransition } from '../transition/shared-transition';
|
|
4
|
+
import { SharedTransitionHelper } from '../transition/shared-transition-helper';
|
|
5
|
+
import { ImageSource } from '../../image-source';
|
|
6
|
+
import { isFontIconURI } from '../../utils';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import { getFontFamilyCached } from '../styling/font';
|
|
9
|
+
export * from './frame-common';
|
|
10
|
+
// GC guard: hold running Storyboards until Completed fires (an unheld local sb can be collected,
|
|
11
|
+
// dropping the Completed callback that restores the final transform/opacity).
|
|
12
|
+
const _activeTransitions = new Set();
|
|
13
|
+
export class Frame extends FrameBase {
|
|
14
|
+
// Backward-compat alias so _navigateCore and _goBackCore work unchanged.
|
|
15
|
+
get _windows() { return this._pageHost; }
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
// Plain Grid (not CommandBar) — CommandBar constrains its Content to the left side via its
|
|
19
|
+
// template's ContentPresenter, preventing the title's Star column from actually filling the bar.
|
|
20
|
+
this._topBar = null;
|
|
21
|
+
this._backButton = null;
|
|
22
|
+
this._titleBlock = null;
|
|
23
|
+
// Grid container for the title area. We swap its single child between _titleBlock (string
|
|
24
|
+
// title) and the titleView's nativeViewProtected (custom View child of ActionBar).
|
|
25
|
+
this._titleArea = null;
|
|
26
|
+
// The native element currently shown in _titleArea (null when showing _titleBlock).
|
|
27
|
+
this._titleViewNative = null;
|
|
28
|
+
// StackPanel in column 2 of _topBar; holds Button elements for ActionItems.
|
|
29
|
+
this._actionArea = null;
|
|
30
|
+
this._backButtonDelegate = null;
|
|
31
|
+
// GC guard: delegates held only by btn.Click can be collected before the user taps.
|
|
32
|
+
this._actionItemDelegates = [];
|
|
33
|
+
// ActionBar `color` brush for the current page; applied to title, back button and action items.
|
|
34
|
+
this._abFgBrush = null;
|
|
35
|
+
// LRU native-view cache. Keeps the last N pages' XAML trees alive so navigating
|
|
36
|
+
// back — or forward — to a previously-visited page skips the entire view-creation +
|
|
37
|
+
// applyAllNativeSetters pipeline. This mirrors what iOS UINavigationController and
|
|
38
|
+
// Android FragmentManager provide natively: visited pages stay in memory until evicted.
|
|
39
|
+
// Map insertion order = arrival order; oldest entry is keys().next().value (LRU eviction).
|
|
40
|
+
this._nativePageCache = new Map(); // moduleName → Page
|
|
41
|
+
this._backAccelHandlers = [];
|
|
42
|
+
this._pageHost = new Microsoft.UI.Xaml.Controls.Grid();
|
|
43
|
+
}
|
|
44
|
+
createNativeView() {
|
|
45
|
+
this._buildTopBar();
|
|
46
|
+
return this._buildContainer();
|
|
47
|
+
}
|
|
48
|
+
_buildTopBar() {
|
|
49
|
+
// WinRT collection mutations can throw; on failure _topBar stays null.
|
|
50
|
+
try {
|
|
51
|
+
// Plain Grid instead of CommandBar: CommandBar's template ContentPresenter is left-aligned,
|
|
52
|
+
// so setting Content = grid doesn't let the Star column expand to fill the bar width.
|
|
53
|
+
// A bare Grid gives us full-width layout control directly.
|
|
54
|
+
this._topBar = new Microsoft.UI.Xaml.Controls.Grid();
|
|
55
|
+
this._topBar.HorizontalAlignment = 3; // Stretch
|
|
56
|
+
this._topBar.Height = 48;
|
|
57
|
+
const colBack = new Microsoft.UI.Xaml.Controls.ColumnDefinition();
|
|
58
|
+
colBack.Width = Microsoft.UI.Xaml.GridLengthHelper.FromValueAndType(1, Microsoft.UI.Xaml.GridUnitType.Auto);
|
|
59
|
+
const colTitle = new Microsoft.UI.Xaml.Controls.ColumnDefinition();
|
|
60
|
+
colTitle.Width = Microsoft.UI.Xaml.GridLengthHelper.FromValueAndType(1, Microsoft.UI.Xaml.GridUnitType.Star);
|
|
61
|
+
const colActions = new Microsoft.UI.Xaml.Controls.ColumnDefinition();
|
|
62
|
+
colActions.Width = Microsoft.UI.Xaml.GridLengthHelper.FromValueAndType(1, Microsoft.UI.Xaml.GridUnitType.Auto);
|
|
63
|
+
this._topBar.ColumnDefinitions.Append(colBack);
|
|
64
|
+
this._topBar.ColumnDefinitions.Append(colTitle);
|
|
65
|
+
this._topBar.ColumnDefinitions.Append(colActions);
|
|
66
|
+
this._backButton = new Microsoft.UI.Xaml.Controls.Button();
|
|
67
|
+
this._backButton.Content = '←';
|
|
68
|
+
Microsoft.UI.Xaml.Controls.Grid.SetColumn(this._backButton, 0);
|
|
69
|
+
this._topBar.Children.Append(this._backButton);
|
|
70
|
+
this._titleBlock = new Microsoft.UI.Xaml.Controls.TextBlock();
|
|
71
|
+
this._titleBlock.VerticalAlignment = 1; // Center
|
|
72
|
+
this._titleArea = new Microsoft.UI.Xaml.Controls.Grid();
|
|
73
|
+
this._titleArea.VerticalAlignment = 1; // Center
|
|
74
|
+
this._titleArea.Children.Append(this._titleBlock);
|
|
75
|
+
Microsoft.UI.Xaml.Controls.Grid.SetColumn(this._titleArea, 1);
|
|
76
|
+
this._topBar.Children.Append(this._titleArea);
|
|
77
|
+
this._actionArea = new Microsoft.UI.Xaml.Controls.StackPanel();
|
|
78
|
+
this._actionArea.Orientation = Microsoft.UI.Xaml.Controls.Orientation.Horizontal;
|
|
79
|
+
this._actionArea.VerticalAlignment = 1; // Center
|
|
80
|
+
Microsoft.UI.Xaml.Controls.Grid.SetColumn(this._actionArea, 2);
|
|
81
|
+
this._topBar.Children.Append(this._actionArea);
|
|
82
|
+
this._topBar.Visibility = 1; // Collapsed
|
|
83
|
+
}
|
|
84
|
+
catch (_e) {
|
|
85
|
+
this._topBar = null;
|
|
86
|
+
this._titleArea = null;
|
|
87
|
+
this._actionArea = null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
_buildContainer() {
|
|
91
|
+
if (!this._topBar) {
|
|
92
|
+
return this._pageHost;
|
|
93
|
+
}
|
|
94
|
+
// Two-row Grid: row 0 (Auto) for CommandBar, row 1 (*) for page content.
|
|
95
|
+
// WinRT collection mutations can throw; on failure fall back to the bare page host.
|
|
96
|
+
try {
|
|
97
|
+
const outerGrid = new Microsoft.UI.Xaml.Controls.Grid();
|
|
98
|
+
const autoRow = new Microsoft.UI.Xaml.Controls.RowDefinition();
|
|
99
|
+
autoRow.Height = Microsoft.UI.Xaml.GridLengthHelper.FromValueAndType(1, Microsoft.UI.Xaml.GridUnitType.Auto);
|
|
100
|
+
const starRow = new Microsoft.UI.Xaml.Controls.RowDefinition();
|
|
101
|
+
starRow.Height = Microsoft.UI.Xaml.GridLengthHelper.FromValueAndType(1, Microsoft.UI.Xaml.GridUnitType.Star);
|
|
102
|
+
outerGrid.RowDefinitions.Append(autoRow);
|
|
103
|
+
outerGrid.RowDefinitions.Append(starRow);
|
|
104
|
+
this._topBar.HorizontalAlignment = 3; // Stretch
|
|
105
|
+
Microsoft.UI.Xaml.Controls.Grid.SetRow(this._topBar, 0);
|
|
106
|
+
outerGrid.Children.Append(this._topBar);
|
|
107
|
+
this._pageHost.HorizontalAlignment = 3; // Stretch
|
|
108
|
+
Microsoft.UI.Xaml.Controls.Grid.SetRow(this._pageHost, 1);
|
|
109
|
+
outerGrid.Children.Append(this._pageHost);
|
|
110
|
+
return outerGrid;
|
|
111
|
+
}
|
|
112
|
+
catch (_e) {
|
|
113
|
+
return this._pageHost;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
get windows() {
|
|
117
|
+
return this._pageHost;
|
|
118
|
+
}
|
|
119
|
+
initNativeView() {
|
|
120
|
+
super.initNativeView();
|
|
121
|
+
this._setupTransitions();
|
|
122
|
+
this._setupBackButton();
|
|
123
|
+
this._setupBackNavigationShortcuts();
|
|
124
|
+
}
|
|
125
|
+
// On Windows desktop there is no hardware/gesture back, so a page with `actionBarHidden` (no action
|
|
126
|
+
// bar → no back button) traps the user. Register the standard desktop back shortcuts (Alt+Left and the
|
|
127
|
+
// browser Back key) on the frame root so back navigation always works regardless of the action bar.
|
|
128
|
+
_setupBackNavigationShortcuts() {
|
|
129
|
+
const root = this.nativeViewProtected;
|
|
130
|
+
if (!root || !root.KeyboardAccelerators)
|
|
131
|
+
return;
|
|
132
|
+
// Suppress the WinUI3 "Alt+←" accelerator tooltip bubble that shows on hover.
|
|
133
|
+
// KeyboardAcceleratorPlacementMode.Hidden = 1.
|
|
134
|
+
try {
|
|
135
|
+
root.KeyboardAcceleratorPlacementMode = 1;
|
|
136
|
+
}
|
|
137
|
+
catch (_e) { }
|
|
138
|
+
const that = new WeakRef(this);
|
|
139
|
+
const addAccel = (key, modifiers) => {
|
|
140
|
+
try {
|
|
141
|
+
const accel = new Microsoft.UI.Xaml.Input.KeyboardAccelerator();
|
|
142
|
+
accel.Key = key;
|
|
143
|
+
accel.Modifiers = modifiers;
|
|
144
|
+
const handler = NSWinRT.asDelegate('Windows.Foundation.TypedEventHandler`2<Microsoft.UI.Xaml.Input.KeyboardAccelerator,Microsoft.UI.Xaml.Input.KeyboardAcceleratorInvokedEventArgs>', (_s, e) => {
|
|
145
|
+
const owner = that.deref();
|
|
146
|
+
if (owner?.canGoBack()) {
|
|
147
|
+
owner.goBack();
|
|
148
|
+
try {
|
|
149
|
+
e.Handled = true;
|
|
150
|
+
}
|
|
151
|
+
catch (_e) { }
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
accel.Invoked = handler;
|
|
155
|
+
this._backAccelHandlers.push(handler);
|
|
156
|
+
root.KeyboardAccelerators.Append(accel);
|
|
157
|
+
}
|
|
158
|
+
catch (_e) { }
|
|
159
|
+
};
|
|
160
|
+
// VirtualKey: Left = 37, GoBack (browser back) = 166. VirtualKeyModifiers: None = 0, Menu (Alt) = 2.
|
|
161
|
+
addAccel(37, 2); // Alt+Left
|
|
162
|
+
addAccel(166, 0); // browser Back key / mouse back button
|
|
163
|
+
}
|
|
164
|
+
_setupBackButton() {
|
|
165
|
+
if (!this._backButton)
|
|
166
|
+
return;
|
|
167
|
+
const that = new WeakRef(this);
|
|
168
|
+
this._backButtonDelegate = NSWinRT.asDelegate('Microsoft.UI.Xaml.RoutedEventHandler', () => {
|
|
169
|
+
const owner = that.deref();
|
|
170
|
+
if (owner?.canGoBack())
|
|
171
|
+
owner.goBack();
|
|
172
|
+
});
|
|
173
|
+
this._backButton.Click = this._backButtonDelegate;
|
|
174
|
+
}
|
|
175
|
+
_setupTransitions() {
|
|
176
|
+
// ContentControl doesn't support ContentTransitions — transitions skipped.
|
|
177
|
+
}
|
|
178
|
+
// Override frame-common._removeEntry to cache module-based pages instead of tearing
|
|
179
|
+
// them down. The default path calls frame._removeView(page) → _removeViewCore →
|
|
180
|
+
// _tearDownUI, which nulls nativeViewProtected and _context. Cached pages skip
|
|
181
|
+
// _tearDownUI entirely — their native views remain alive in memory so re-navigating
|
|
182
|
+
// to the same module path is instant (no view creation, no applyAllNativeSetters).
|
|
183
|
+
_removeEntry(removed) {
|
|
184
|
+
const page = removed?.resolvedPage;
|
|
185
|
+
if (page) {
|
|
186
|
+
const moduleName = removed?.entry?.moduleName;
|
|
187
|
+
if (moduleName && page._context && page.frame === this) {
|
|
188
|
+
// Cacheable: preserve native views, fire JS lifecycle only.
|
|
189
|
+
this._cacheNativePage(moduleName, page);
|
|
190
|
+
}
|
|
191
|
+
else if (page._context) {
|
|
192
|
+
// Non-cacheable (create()-fn page or different frame): deferred teardown.
|
|
193
|
+
const frame = page.frame;
|
|
194
|
+
if (frame && typeof frame._removeView === 'function') {
|
|
195
|
+
frame._removeView(page);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
setTimeout(() => {
|
|
199
|
+
try {
|
|
200
|
+
if (page._context)
|
|
201
|
+
page._tearDownUI?.();
|
|
202
|
+
}
|
|
203
|
+
catch (_e) { }
|
|
204
|
+
}, 0);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// else: already torn down — nothing to do.
|
|
208
|
+
}
|
|
209
|
+
if (removed)
|
|
210
|
+
removed.resolvedPage = null;
|
|
211
|
+
}
|
|
212
|
+
_cacheNativePage(moduleName, page) {
|
|
213
|
+
// LRU eviction: oldest entry (first key) is deferred-torn-down and removed.
|
|
214
|
+
if (this._nativePageCache.size >= Frame._PAGE_CACHE_LIMIT) {
|
|
215
|
+
const oldestKey = this._nativePageCache.keys().next().value;
|
|
216
|
+
const evicted = this._nativePageCache.get(oldestKey);
|
|
217
|
+
this._nativePageCache.delete(oldestKey);
|
|
218
|
+
if (evicted) {
|
|
219
|
+
setTimeout(() => {
|
|
220
|
+
try {
|
|
221
|
+
if (evicted._context)
|
|
222
|
+
evicted._tearDownUI?.();
|
|
223
|
+
}
|
|
224
|
+
catch (_e) { }
|
|
225
|
+
}, 0);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
this._nativePageCache.set(moduleName, page);
|
|
229
|
+
// Fire JS unloaded lifecycle (CSS transitions + observers need this).
|
|
230
|
+
// _tearDownUI is deliberately NOT called — native views stay alive.
|
|
231
|
+
try {
|
|
232
|
+
page.callUnloaded?.();
|
|
233
|
+
}
|
|
234
|
+
catch (_e) { }
|
|
235
|
+
}
|
|
236
|
+
//@ts-ignore
|
|
237
|
+
setCurrent(entry, navigationType) {
|
|
238
|
+
const current = this._currentEntry;
|
|
239
|
+
const currentEntryChanged = current !== entry;
|
|
240
|
+
if (entry?.resolvedPage && currentEntryChanged) {
|
|
241
|
+
// If a navigatedTo handler throws, the base never clears _executingContext, permanently
|
|
242
|
+
// jamming the navigation queue. Guard so a faulty handler can't wedge navigation.
|
|
243
|
+
try {
|
|
244
|
+
this._updateBackstack(entry, navigationType);
|
|
245
|
+
super.setCurrent(entry, navigationType);
|
|
246
|
+
}
|
|
247
|
+
catch (err) {
|
|
248
|
+
console.error('[Frame.Windows] setCurrent failed; recovering navigation:', err, err?.stack);
|
|
249
|
+
this._executingContext = null;
|
|
250
|
+
// Restore previous page visually so the user isn't left on a blank screen.
|
|
251
|
+
if (current?.resolvedPage?.nativeViewProtected) {
|
|
252
|
+
try {
|
|
253
|
+
this._setPageContent(current.resolvedPage.nativeViewProtected);
|
|
254
|
+
}
|
|
255
|
+
catch (_e) { }
|
|
256
|
+
this._currentEntry = current;
|
|
257
|
+
this._updateActionBar(current.resolvedPage);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
this._processNavigationQueue(entry.resolvedPage);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
// No resolved page (module failed to load) or page already current.
|
|
264
|
+
// _executingContext was set by performNavigation — must clear it unconditionally or
|
|
265
|
+
// all future navigations are permanently blocked.
|
|
266
|
+
this._executingContext = null;
|
|
267
|
+
const queue = this._navigationQueue;
|
|
268
|
+
if (queue?.length > 0 && queue[0]?.entry === entry)
|
|
269
|
+
queue.shift();
|
|
270
|
+
this._processNextNavigationEntry?.();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
_navigateCore(backstackEntry) {
|
|
274
|
+
// Restore cached native page before frame-common resolves to a freshly-created one.
|
|
275
|
+
// performNavigation sets backstackEntry.resolvedPage via _resolvePageFromEntry (pure JS,
|
|
276
|
+
// no WinRT), then calls _navigateCore — we replace the just-created page with the cached
|
|
277
|
+
// one here. The cached page's _context is intact, so setCurrent → _addView → _setupUI
|
|
278
|
+
// returns early (page.frame === this), keeping all native views alive with zero WinRT cost.
|
|
279
|
+
const moduleName = backstackEntry?.entry?.moduleName;
|
|
280
|
+
if (moduleName) {
|
|
281
|
+
const cached = this._nativePageCache.get(moduleName);
|
|
282
|
+
if (cached && cached._context) {
|
|
283
|
+
this._nativePageCache.delete(moduleName);
|
|
284
|
+
backstackEntry.resolvedPage = cached;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
const fromPage = this.currentPage; // capture before setCurrent swaps it
|
|
288
|
+
// Capture pending queue depth before setCurrent drains it. If taps arrived faster than
|
|
289
|
+
// animations finish, queue.length > 1 here — animate only the final destination.
|
|
290
|
+
const pendingAhead = (this._navigationQueue?.length ?? 1) - 1;
|
|
291
|
+
super._navigateCore(backstackEntry);
|
|
292
|
+
const navigationType = this._executingContext?.navigationType ?? NavigationType.forward;
|
|
293
|
+
this.setCurrent(backstackEntry, navigationType);
|
|
294
|
+
const page = backstackEntry.resolvedPage;
|
|
295
|
+
if (!this._pageHost || !page?.nativeViewProtected)
|
|
296
|
+
return;
|
|
297
|
+
// Back-nav doesn't re-fire `loaded` on the restored page's subtree; views stay unloaded with
|
|
298
|
+
// _suspendNativeUpdatesCount set, queuing every setNative (visibility, etc.) indefinitely.
|
|
299
|
+
this._ensureLoaded(page);
|
|
300
|
+
const isForward = navigationType !== NavigationType.back;
|
|
301
|
+
const navTransition = this._getNavigationTransition?.(backstackEntry.entry);
|
|
302
|
+
const transitionInst = navTransition?.instance;
|
|
303
|
+
const durMs = (transitionInst?.getDuration?.() ?? 0) * 1000 || 180;
|
|
304
|
+
const transName = transitionInst?.constructor?.name ?? '';
|
|
305
|
+
// Shared-element morph; returns false when not applicable (falls through to slide/fade).
|
|
306
|
+
if (this._runSharedTransition(fromPage, page, transitionInst, durMs)) {
|
|
307
|
+
this._updateActionBar(page);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
this._setPageContent(page.nativeViewProtected);
|
|
311
|
+
// Skip animation for intermediate navigations — stacking 250ms Storyboards causes
|
|
312
|
+
// the app to appear frozen while the queue drains.
|
|
313
|
+
const effectiveDur = pendingAhead > 0 ? 0 : durMs;
|
|
314
|
+
// Default to slide; fade only when explicitly requested.
|
|
315
|
+
if (transName.toLowerCase().includes('fade')) {
|
|
316
|
+
this._fadeIn(page.nativeViewProtected, effectiveDur);
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
this._slideIn(page.nativeViewProtected, isForward, effectiveDur);
|
|
320
|
+
}
|
|
321
|
+
this._updateActionBar(page);
|
|
322
|
+
}
|
|
323
|
+
// Captures each FROM-element's rect before the page swap, then does a normal _setPageContent swap
|
|
324
|
+
// and animates only the incoming elements' transforms. Does NOT keep both pages mounted — that
|
|
325
|
+
// earlier approach collided with frame page management and froze later navigation.
|
|
326
|
+
_runSharedTransition(fromPage, toPage, transitionInst, durMs) {
|
|
327
|
+
try {
|
|
328
|
+
if (!transitionInst || !fromPage || !toPage)
|
|
329
|
+
return false;
|
|
330
|
+
const state = SharedTransition.getState(transitionInst.id);
|
|
331
|
+
if (!state)
|
|
332
|
+
return false;
|
|
333
|
+
const toNative = toPage.nativeViewProtected;
|
|
334
|
+
if (!toNative)
|
|
335
|
+
return false;
|
|
336
|
+
state.page = fromPage;
|
|
337
|
+
state.toPage = toPage;
|
|
338
|
+
const { sharedElements, presented } = SharedTransition.getSharedElements(fromPage, toPage);
|
|
339
|
+
if (!sharedElements || sharedElements.length === 0)
|
|
340
|
+
return false;
|
|
341
|
+
const host = this._pageHost;
|
|
342
|
+
// Capture FROM-element rects (host coords) BEFORE the page swap removes them.
|
|
343
|
+
const pairs = [];
|
|
344
|
+
for (const fromView of sharedElements) {
|
|
345
|
+
const tag = fromView.sharedTransitionTag;
|
|
346
|
+
const toView = presented.find((v) => v.sharedTransitionTag === tag);
|
|
347
|
+
const fromNative = fromView.nativeViewProtected;
|
|
348
|
+
const toEl = toView && toView.nativeViewProtected;
|
|
349
|
+
if (!fromNative || !toEl)
|
|
350
|
+
continue;
|
|
351
|
+
const r = this._rectInHost(fromNative, host);
|
|
352
|
+
if (!r || r.w <= 0 || r.h <= 0)
|
|
353
|
+
continue;
|
|
354
|
+
pairs.push({ toNative: toEl, fromRect: r, tag });
|
|
355
|
+
}
|
|
356
|
+
if (pairs.length === 0)
|
|
357
|
+
return false;
|
|
358
|
+
// Normal page swap — frame keeps full control of the host.
|
|
359
|
+
this._setPageContent(toNative);
|
|
360
|
+
try {
|
|
361
|
+
host.UpdateLayout();
|
|
362
|
+
}
|
|
363
|
+
catch (_e) { }
|
|
364
|
+
SharedTransitionHelper.animate(state, { host, pairs, durationMs: durMs }, 'page');
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
catch (_e) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
_rectInHost(nativeEl, host) {
|
|
372
|
+
try {
|
|
373
|
+
const gt = nativeEl.TransformToVisual(host);
|
|
374
|
+
const p = gt.TransformPoint(new Windows.Foundation.Point(0, 0));
|
|
375
|
+
return { x: p.X, y: p.Y, w: nativeEl.ActualWidth || 0, h: nativeEl.ActualHeight || 0 };
|
|
376
|
+
}
|
|
377
|
+
catch (_e) {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
// Override _removeViewCore to decouple the JS lifecycle from the native teardown.
|
|
382
|
+
// ViewBase._removeViewCore calls both unloadView (JS) and _tearDownUI (native) synchronously.
|
|
383
|
+
// _tearDownUI on a 40-view page fires ~100 WinRT calls (disposeNativeView + Children.RemoveAt
|
|
384
|
+
// per child) while the page is still on screen — this blocks the animation start by 10-20ms.
|
|
385
|
+
// Fix: fire callUnloaded() synchronously (CSS animations + observers depend on it), but defer
|
|
386
|
+
// _tearDownUI to a setTimeout(0). By then _setPageContent has already removed the root from
|
|
387
|
+
// _pageHost, so the WinRT calls operate on a detached subtree with no XAML layout cascade.
|
|
388
|
+
_removeViewCore(view) {
|
|
389
|
+
try {
|
|
390
|
+
view.callUnloaded?.();
|
|
391
|
+
}
|
|
392
|
+
catch (_e) { }
|
|
393
|
+
if (view._context) {
|
|
394
|
+
setTimeout(() => {
|
|
395
|
+
try {
|
|
396
|
+
if (view._context)
|
|
397
|
+
view._tearDownUI?.();
|
|
398
|
+
}
|
|
399
|
+
catch (_e) { }
|
|
400
|
+
}, 0);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// Windows back-nav restores a cached page without re-firing the `loaded` lifecycle, leaving the
|
|
404
|
+
// subtree with _suspendNativeUpdatesCount set (every setNative queued, never applied). callLoaded()
|
|
405
|
+
// flips isLoaded and flushes the queued setNatives via _resumeNativeUpdates.
|
|
406
|
+
// Early-exit: if a view is already loaded, NativeScript guarantees its entire subtree is also
|
|
407
|
+
// loaded — skip the O(N) recursion entirely. This is the common case on back navigation.
|
|
408
|
+
_ensureLoaded(view) {
|
|
409
|
+
if (!view || view.isLoaded)
|
|
410
|
+
return;
|
|
411
|
+
try {
|
|
412
|
+
if (typeof view.callLoaded === 'function')
|
|
413
|
+
view.callLoaded();
|
|
414
|
+
}
|
|
415
|
+
catch (_e) { }
|
|
416
|
+
try {
|
|
417
|
+
if (typeof view.eachChildView === 'function') {
|
|
418
|
+
view.eachChildView((c) => { this._ensureLoaded(c); return true; });
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
catch (_e) { }
|
|
422
|
+
}
|
|
423
|
+
_setPageContent(nativePageView) {
|
|
424
|
+
const children = this._pageHost.Children;
|
|
425
|
+
if (!children)
|
|
426
|
+
return;
|
|
427
|
+
const count = children.Size ?? 0;
|
|
428
|
+
for (let i = count - 1; i >= 0; i--) {
|
|
429
|
+
try {
|
|
430
|
+
children.RemoveAt(i);
|
|
431
|
+
}
|
|
432
|
+
catch (_e) { }
|
|
433
|
+
}
|
|
434
|
+
try {
|
|
435
|
+
children.Append(nativePageView);
|
|
436
|
+
}
|
|
437
|
+
catch (_e) { }
|
|
438
|
+
}
|
|
439
|
+
// WinUI Duration: { TimeSpan: { Duration: <100ns ticks> }, Type: 1 (DurationType.TimeSpan) }.
|
|
440
|
+
// The runtime now marshals nested structs correctly; plain object replaces the old ArrayBuffer hack.
|
|
441
|
+
_duration(ms) {
|
|
442
|
+
return { TimeSpan: { Duration: Math.max(1, Math.round(ms)) * 10000 }, Type: 1 };
|
|
443
|
+
}
|
|
444
|
+
// Page transitions run as native Storyboards (compositor-driven). The previous
|
|
445
|
+
// requestAnimationFrame/setTimeout interpolation was effectively instant in this host.
|
|
446
|
+
_runStoryboard(sb, onDone) {
|
|
447
|
+
_activeTransitions.add(sb);
|
|
448
|
+
let done = false;
|
|
449
|
+
const finish = () => {
|
|
450
|
+
if (done)
|
|
451
|
+
return;
|
|
452
|
+
done = true;
|
|
453
|
+
_activeTransitions.delete(sb);
|
|
454
|
+
try {
|
|
455
|
+
onDone();
|
|
456
|
+
}
|
|
457
|
+
catch (_e) { }
|
|
458
|
+
};
|
|
459
|
+
try {
|
|
460
|
+
sb.Completed = (() => finish());
|
|
461
|
+
}
|
|
462
|
+
catch (_e) { }
|
|
463
|
+
try {
|
|
464
|
+
sb.Begin();
|
|
465
|
+
}
|
|
466
|
+
catch (_e) {
|
|
467
|
+
finish();
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
// Safety timeout: final state must land even if Completed never fires (element detached, etc.).
|
|
471
|
+
setTimeout(finish, 400);
|
|
472
|
+
}
|
|
473
|
+
_fadeIn(native, durationMs) {
|
|
474
|
+
if (durationMs <= 0) {
|
|
475
|
+
try {
|
|
476
|
+
native.Opacity = 1;
|
|
477
|
+
}
|
|
478
|
+
catch (_e) { }
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
try {
|
|
482
|
+
native.Opacity = 0;
|
|
483
|
+
const sb = new Microsoft.UI.Xaml.Media.Animation.Storyboard();
|
|
484
|
+
const da = new Microsoft.UI.Xaml.Media.Animation.DoubleAnimation();
|
|
485
|
+
da.From = 0;
|
|
486
|
+
da.To = 1;
|
|
487
|
+
da.Duration = this._duration(durationMs);
|
|
488
|
+
Microsoft.UI.Xaml.Media.Animation.Storyboard.SetTarget(da, native);
|
|
489
|
+
Microsoft.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(da, 'Opacity');
|
|
490
|
+
sb.Children.Append(da);
|
|
491
|
+
this._runStoryboard(sb, () => { native.Opacity = 1; });
|
|
492
|
+
}
|
|
493
|
+
catch (_e) {
|
|
494
|
+
native.Opacity = 1;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
// Slides in from right (forward) or left (back). Uses TranslateTransform.X — CompositeTransform.TranslateX
|
|
498
|
+
// did not animate reliably in this host.
|
|
499
|
+
_slideIn(native, fromRight, durationMs) {
|
|
500
|
+
if (durationMs <= 0) {
|
|
501
|
+
try {
|
|
502
|
+
native.Opacity = 1;
|
|
503
|
+
}
|
|
504
|
+
catch (_e) { }
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
try {
|
|
508
|
+
const startX = fromRight ? 380 : -380;
|
|
509
|
+
const tt = new Microsoft.UI.Xaml.Media.TranslateTransform();
|
|
510
|
+
tt.X = startX;
|
|
511
|
+
native.RenderTransform = tt;
|
|
512
|
+
native.Opacity = 0;
|
|
513
|
+
const sb = new Microsoft.UI.Xaml.Media.Animation.Storyboard();
|
|
514
|
+
const slide = new Microsoft.UI.Xaml.Media.Animation.DoubleAnimation();
|
|
515
|
+
slide.From = startX;
|
|
516
|
+
slide.To = 0;
|
|
517
|
+
slide.Duration = this._duration(durationMs);
|
|
518
|
+
const ease = new Microsoft.UI.Xaml.Media.Animation.CubicEase();
|
|
519
|
+
ease.EasingMode = Microsoft.UI.Xaml.Media.Animation.EasingMode.EaseOut;
|
|
520
|
+
slide.EasingFunction = ease;
|
|
521
|
+
Microsoft.UI.Xaml.Media.Animation.Storyboard.SetTarget(slide, tt);
|
|
522
|
+
Microsoft.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(slide, 'X');
|
|
523
|
+
sb.Children.Append(slide);
|
|
524
|
+
// Fade in alongside the slide to avoid a flash at the gap.
|
|
525
|
+
const fade = new Microsoft.UI.Xaml.Media.Animation.DoubleAnimation();
|
|
526
|
+
fade.From = 0;
|
|
527
|
+
fade.To = 1;
|
|
528
|
+
fade.Duration = this._duration(Math.min(durationMs, 160));
|
|
529
|
+
Microsoft.UI.Xaml.Media.Animation.Storyboard.SetTarget(fade, native);
|
|
530
|
+
Microsoft.UI.Xaml.Media.Animation.Storyboard.SetTargetProperty(fade, 'Opacity');
|
|
531
|
+
sb.Children.Append(fade);
|
|
532
|
+
this._runStoryboard(sb, () => { try {
|
|
533
|
+
tt.X = 0;
|
|
534
|
+
}
|
|
535
|
+
catch (_e) { } native.Opacity = 1; });
|
|
536
|
+
}
|
|
537
|
+
catch (_e) {
|
|
538
|
+
this._fadeIn(native, durationMs);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
_goBackCore(backstackEntry) {
|
|
542
|
+
const fromPage = this.currentPage; // capture before setCurrent swaps it
|
|
543
|
+
const pendingAhead = (this._navigationQueue?.length ?? 1) - 1;
|
|
544
|
+
super._goBackCore(backstackEntry);
|
|
545
|
+
this.setCurrent(backstackEntry, NavigationType.back);
|
|
546
|
+
const page = backstackEntry.resolvedPage;
|
|
547
|
+
if (!this._pageHost || !page?.nativeViewProtected)
|
|
548
|
+
return;
|
|
549
|
+
// Re-load the restored page's subtree (see _navigateCore).
|
|
550
|
+
this._ensureLoaded(page);
|
|
551
|
+
const navTransition = this._getNavigationTransition?.(backstackEntry.entry);
|
|
552
|
+
const transitionInst = navTransition?.instance;
|
|
553
|
+
const durMs = (transitionInst?.getDuration?.() ?? 0) * 1000 || 180;
|
|
554
|
+
const transName = transitionInst?.constructor?.name ?? '';
|
|
555
|
+
// Reverse shared-element morph on back; falls back to slide/fade if not applicable.
|
|
556
|
+
if (this._runSharedTransition(fromPage, page, transitionInst, durMs)) {
|
|
557
|
+
this._updateActionBar(page);
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
this._setPageContent(page.nativeViewProtected);
|
|
561
|
+
const effectiveDur = pendingAhead > 0 ? 0 : durMs;
|
|
562
|
+
// Default to slide; fade only when explicitly requested.
|
|
563
|
+
if (transName.toLowerCase().includes('fade')) {
|
|
564
|
+
this._fadeIn(page.nativeViewProtected, effectiveDur);
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
this._slideIn(page.nativeViewProtected, false, effectiveDur);
|
|
568
|
+
}
|
|
569
|
+
this._updateActionBar(page);
|
|
570
|
+
}
|
|
571
|
+
_updateActionBar(page) {
|
|
572
|
+
super._updateActionBar(page);
|
|
573
|
+
if (!this._topBar)
|
|
574
|
+
return;
|
|
575
|
+
page = page ?? this.currentPage;
|
|
576
|
+
if (!page)
|
|
577
|
+
return;
|
|
578
|
+
const visible = this._isNavBarVisible(page);
|
|
579
|
+
this._topBar.Visibility = visible ? 0 : 1;
|
|
580
|
+
if (!visible)
|
|
581
|
+
return;
|
|
582
|
+
// ActionBar style → native bar: background-color fills the bar Grid, color becomes the
|
|
583
|
+
// foreground brush for title/back/action items. The bar is shared across pages, so an
|
|
584
|
+
// unset style must RESET to defaults (ClearValue), not keep the previous page's colors.
|
|
585
|
+
const pageActionBar = page.actionBar;
|
|
586
|
+
try {
|
|
587
|
+
const bg = pageActionBar?.style?.backgroundColor;
|
|
588
|
+
this._topBar.Background = bg?.windows ? new Microsoft.UI.Xaml.Media.SolidColorBrush(bg.windows) : null;
|
|
589
|
+
}
|
|
590
|
+
catch (_e) { }
|
|
591
|
+
try {
|
|
592
|
+
const fg = pageActionBar?.style?.color;
|
|
593
|
+
this._abFgBrush = fg?.windows ? new Microsoft.UI.Xaml.Media.SolidColorBrush(fg.windows) : null;
|
|
594
|
+
if (this._titleBlock) {
|
|
595
|
+
if (this._abFgBrush)
|
|
596
|
+
this._titleBlock.Foreground = this._abFgBrush;
|
|
597
|
+
else
|
|
598
|
+
this._titleBlock.ClearValue(Microsoft.UI.Xaml.Controls.TextBlock.ForegroundProperty);
|
|
599
|
+
}
|
|
600
|
+
if (this._backButton) {
|
|
601
|
+
if (this._abFgBrush)
|
|
602
|
+
this._backButton.Foreground = this._abFgBrush;
|
|
603
|
+
else
|
|
604
|
+
this._backButton.ClearValue(Microsoft.UI.Xaml.Controls.Control.ForegroundProperty);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
catch (_e) { }
|
|
608
|
+
if (this._backButton) {
|
|
609
|
+
const navBtn = page.actionBar?.navigationButton;
|
|
610
|
+
const navIconSrc = navBtn?.windows?.icon ?? navBtn?.icon ?? '';
|
|
611
|
+
const navIcon = navIconSrc ? this._createActionItemIcon(navIconSrc, navBtn) : null;
|
|
612
|
+
this._backButton.Content = (navIcon ?? navBtn?.text ?? '←');
|
|
613
|
+
this._backButton.Visibility = this.canGoBack() ? 0 : 1;
|
|
614
|
+
}
|
|
615
|
+
if (this._titleArea) {
|
|
616
|
+
const actionBar = page.actionBar;
|
|
617
|
+
const titleView = actionBar?.titleView;
|
|
618
|
+
const newNative = titleView?.nativeViewProtected ?? null;
|
|
619
|
+
if (newNative !== this._titleViewNative) {
|
|
620
|
+
// Swap the child in the title Grid: remove the old one, add the new one.
|
|
621
|
+
try {
|
|
622
|
+
const children = this._titleArea.Children;
|
|
623
|
+
const count = children.Size ?? 0;
|
|
624
|
+
for (let i = count - 1; i >= 0; i--) {
|
|
625
|
+
try {
|
|
626
|
+
children.RemoveAt(i);
|
|
627
|
+
}
|
|
628
|
+
catch (_e) { }
|
|
629
|
+
}
|
|
630
|
+
if (newNative) {
|
|
631
|
+
children.Append(newNative);
|
|
632
|
+
}
|
|
633
|
+
else if (this._titleBlock) {
|
|
634
|
+
children.Append(this._titleBlock);
|
|
635
|
+
}
|
|
636
|
+
this._titleViewNative = newNative;
|
|
637
|
+
}
|
|
638
|
+
catch (_e) { }
|
|
639
|
+
}
|
|
640
|
+
if (!newNative && this._titleBlock) {
|
|
641
|
+
this._titleBlock.Text = actionBar?.title ?? '';
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
this._rebuildActionItems(page);
|
|
645
|
+
}
|
|
646
|
+
disposeNativeView() {
|
|
647
|
+
this._flushPageCache();
|
|
648
|
+
this._titleArea = null;
|
|
649
|
+
this._titleViewNative = null;
|
|
650
|
+
this._titleBlock = null;
|
|
651
|
+
this._actionArea = null;
|
|
652
|
+
this._actionItemDelegates.length = 0;
|
|
653
|
+
super.disposeNativeView?.();
|
|
654
|
+
}
|
|
655
|
+
_flushPageCache() {
|
|
656
|
+
for (const [, page] of this._nativePageCache) {
|
|
657
|
+
try {
|
|
658
|
+
if (page._context)
|
|
659
|
+
page._tearDownUI?.();
|
|
660
|
+
}
|
|
661
|
+
catch (_e) { }
|
|
662
|
+
}
|
|
663
|
+
this._nativePageCache.clear();
|
|
664
|
+
}
|
|
665
|
+
_isNavBarVisible(page) {
|
|
666
|
+
if (this.actionBarVisibility === 'always')
|
|
667
|
+
return true;
|
|
668
|
+
if (this.actionBarVisibility === 'never')
|
|
669
|
+
return false;
|
|
670
|
+
if (page.actionBarHidden)
|
|
671
|
+
return false;
|
|
672
|
+
return !page.actionBar?._isEmpty() || this.canGoBack();
|
|
673
|
+
}
|
|
674
|
+
_rebuildActionItems(page) {
|
|
675
|
+
const area = this._actionArea;
|
|
676
|
+
if (!area)
|
|
677
|
+
return;
|
|
678
|
+
// Clear existing buttons and release old delegate GC-guards.
|
|
679
|
+
this._actionItemDelegates.length = 0;
|
|
680
|
+
const children = area.Children;
|
|
681
|
+
const size = children.Size ?? 0;
|
|
682
|
+
for (let i = size - 1; i >= 0; i--) {
|
|
683
|
+
try {
|
|
684
|
+
children.RemoveAt(i);
|
|
685
|
+
}
|
|
686
|
+
catch (_e) { }
|
|
687
|
+
}
|
|
688
|
+
const items = page.actionBar?.actionItems?.getVisibleItems() ?? [];
|
|
689
|
+
for (const item of items) {
|
|
690
|
+
try {
|
|
691
|
+
const btn = new Microsoft.UI.Xaml.Controls.Button();
|
|
692
|
+
const del = NSWinRT.asDelegate('Microsoft.UI.Xaml.RoutedEventHandler', () => item._raiseTap());
|
|
693
|
+
this._actionItemDelegates.push(del); // keep alive until next rebuild
|
|
694
|
+
btn.Click = del;
|
|
695
|
+
if (this._abFgBrush) {
|
|
696
|
+
btn.Foreground = this._abFgBrush;
|
|
697
|
+
}
|
|
698
|
+
if (item.actionView?.nativeViewProtected) {
|
|
699
|
+
btn.Content = item.actionView.nativeViewProtected;
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
const label = item.text ?? '';
|
|
703
|
+
const iconSrc = item.windows?.icon ?? item.icon ?? '';
|
|
704
|
+
// Icon takes priority over text when it resolves (matches iOS loadActionIcon).
|
|
705
|
+
const iconContent = iconSrc ? this._createActionItemIcon(iconSrc, item) : null;
|
|
706
|
+
if (iconContent) {
|
|
707
|
+
btn.Content = iconContent;
|
|
708
|
+
}
|
|
709
|
+
else if (label) {
|
|
710
|
+
btn.Content = label;
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
// No text and no usable icon (ios.systemIcon / android.systemIcon are ignored on Windows).
|
|
714
|
+
// Show a generic visible marker so the button is tappable.
|
|
715
|
+
btn.Content = '▶';
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
children.Append(btn);
|
|
719
|
+
}
|
|
720
|
+
catch (_e) { }
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
// Resolves an ActionItem icon URI to a XAML element: font:// → glyph TextBlock, res://|~/|file →
|
|
724
|
+
// Image. Returns null if unresolved (caller falls back to text/marker).
|
|
725
|
+
_createActionItemIcon(iconSrc, item) {
|
|
726
|
+
try {
|
|
727
|
+
if (isFontIconURI(iconSrc)) {
|
|
728
|
+
const glyph = iconSrc.split('//')[1];
|
|
729
|
+
if (!glyph)
|
|
730
|
+
return null;
|
|
731
|
+
const tb = new Microsoft.UI.Xaml.Controls.TextBlock();
|
|
732
|
+
tb.Text = glyph;
|
|
733
|
+
tb.VerticalAlignment = 1; // Center
|
|
734
|
+
const itemStyle = item.style;
|
|
735
|
+
const font = itemStyle?.fontInternal;
|
|
736
|
+
if (font?.fontFamily) {
|
|
737
|
+
const ff = getFontFamilyCached(font.fontFamily);
|
|
738
|
+
if (ff)
|
|
739
|
+
tb.FontFamily = ff;
|
|
740
|
+
}
|
|
741
|
+
if (font?.fontSize)
|
|
742
|
+
tb.FontSize = font.fontSize;
|
|
743
|
+
const color = itemStyle?.color;
|
|
744
|
+
if (color?.windows)
|
|
745
|
+
tb.Foreground = new Microsoft.UI.Xaml.Media.SolidColorBrush(color.windows);
|
|
746
|
+
else if (this._abFgBrush)
|
|
747
|
+
tb.Foreground = this._abFgBrush;
|
|
748
|
+
return tb;
|
|
749
|
+
}
|
|
750
|
+
const is = ImageSource.fromFileOrResourceSync(iconSrc);
|
|
751
|
+
const bmp = is?.windows;
|
|
752
|
+
if (bmp && !(bmp instanceof ArrayBuffer) && !(bmp instanceof Uint8Array)) {
|
|
753
|
+
const img = new Microsoft.UI.Xaml.Controls.Image();
|
|
754
|
+
img.Width = 24;
|
|
755
|
+
img.Height = 24;
|
|
756
|
+
img.Stretch = 2; // Uniform
|
|
757
|
+
img.Source = bmp;
|
|
758
|
+
return img;
|
|
759
|
+
}
|
|
760
|
+
return null;
|
|
761
|
+
}
|
|
762
|
+
catch (_e) {
|
|
763
|
+
return null;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
Frame._PAGE_CACHE_LIMIT = 5;
|
|
768
|
+
__decorate([
|
|
769
|
+
profile,
|
|
770
|
+
__metadata("design:type", Function),
|
|
771
|
+
__metadata("design:paramtypes", [Object]),
|
|
772
|
+
__metadata("design:returntype", void 0)
|
|
773
|
+
], Frame.prototype, "_navigateCore", null);
|
|
774
|
+
// attach on global, so it can be overwritten in NativeScript Angular
|
|
775
|
+
global.__onLiveSyncCore = Frame.reloadPage;
|
|
776
|
+
export function setActivityCallbacks(_callbacks) { }
|
|
777
|
+
export function setWindowContent(_view) { }
|
|
778
|
+
//# sourceMappingURL=index.windows.js.map
|