@akylas/nativescript 9.0.24 → 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.
- package/abortcontroller/abortsignal.js.map +1 -1
- package/abortcontroller/index.js.map +1 -1
- package/accessibility/accessibility-common.js.map +1 -1
- package/accessibility/accessibility-css-helper.js.map +1 -1
- package/accessibility/accessibility-properties.js.map +1 -1
- package/accessibility/accessibility-service-common.js.map +1 -1
- package/accessibility/accessibility-service.android.js.map +1 -1
- package/accessibility/accessibility-service.ios.js.map +1 -1
- package/accessibility/accessibility-types.js.map +1 -1
- package/accessibility/font-scale-common.js.map +1 -1
- package/accessibility/font-scale.android.js.map +1 -1
- package/accessibility/font-scale.ios.js.map +1 -1
- package/accessibility/index.android.js.map +1 -1
- package/accessibility/index.ios.js.map +1 -1
- package/animation-frame/animation-native.android.js.map +1 -1
- package/animation-frame/animation-native.ios.js.map +1 -1
- package/animation-frame/index.js.map +1 -1
- package/application/application-common.d.ts +199 -3
- package/application/application-common.js +425 -55
- package/application/application-common.js.map +1 -1
- package/application/application-interfaces.d.ts +67 -1
- package/application/application-interfaces.js.map +1 -1
- package/application/application-shims.js.map +1 -1
- package/application/application.android.d.ts +39 -0
- package/application/application.android.js +242 -17
- package/application/application.android.js.map +1 -1
- package/application/application.d.ts +161 -54
- package/application/application.ios.d.ts +189 -28
- package/application/application.ios.js +885 -379
- package/application/application.ios.js.map +1 -1
- package/application/helpers-common.d.ts +5 -0
- package/application/helpers-common.js +23 -1
- package/application/helpers-common.js.map +1 -1
- package/application/helpers.android.js.map +1 -1
- package/application/helpers.ios.js.map +1 -1
- package/application/index.android.js.map +1 -1
- package/application/index.ios.js.map +1 -1
- package/application/scene-delegate-bridge.d.ts +60 -0
- package/application/scene-delegate-bridge.js +138 -0
- package/application/scene-delegate-bridge.js.map +1 -0
- package/application-settings/application-settings-common.js.map +1 -1
- package/application-settings/index.android.js.map +1 -1
- package/application-settings/index.ios.js.map +1 -1
- package/bundle-entry-points.js.map +1 -1
- package/cli-hooks/before-checkForChanges.mjs +0 -11
- package/color/color-common.js +16 -5
- package/color/color-common.js.map +1 -1
- package/color/color-types.js.map +1 -1
- package/color/color-utils.d.ts +4 -1
- package/color/color-utils.js +14 -9
- package/color/color-utils.js.map +1 -1
- package/color/index.android.js.map +1 -1
- package/color/index.ios.js.map +1 -1
- package/color/known-colors.js.map +1 -1
- package/config/config.interface.d.ts +44 -2
- package/config/config.interface.js.map +1 -1
- package/config/index.js.map +1 -1
- package/connectivity/index.android.js.map +1 -1
- package/connectivity/index.ios.js.map +1 -1
- package/console/index.js.map +1 -1
- package/core-types/animation-types.js.map +1 -1
- package/core-types/index.d.ts +25 -2
- package/core-types/index.js +23 -0
- package/core-types/index.js.map +1 -1
- package/core-types/validators.js.map +1 -1
- package/css/CSS3Parser.js +3 -2
- package/css/CSS3Parser.js.map +1 -1
- package/css/CSSNativeScript.js.map +1 -1
- package/css/css-tree-parser.js +5 -1
- package/css/css-tree-parser.js.map +1 -1
- package/css/lib/parse/index.js +5 -1
- package/css/lib/parse/index.js.map +1 -1
- package/css/parser.js +20 -3
- package/css/parser.js.map +1 -1
- package/css/reworkcss.js.map +1 -1
- package/css/system-classes.d.ts +9 -0
- package/css/system-classes.js +23 -0
- package/css/system-classes.js.map +1 -1
- package/css-mediaquery/index.js +4 -4
- package/css-mediaquery/index.js.map +1 -1
- package/css-value/reworkcss-value.js.map +1 -1
- package/data/observable/index.d.ts +23 -0
- package/data/observable/index.js +50 -9
- package/data/observable/index.js.map +1 -1
- package/data/observable-array/index.js.map +1 -1
- package/data/virtual-array/index.js.map +1 -1
- package/debugger/InspectorBackendCommands.js.map +1 -1
- package/debugger/devtools-elements-interfaces.js.map +1 -1
- package/debugger/devtools-elements.common.js.map +1 -1
- package/debugger/devtools-elements.js.map +1 -1
- package/debugger/dom-types.js +31 -1
- package/debugger/dom-types.js.map +1 -1
- package/debugger/index.js.map +1 -1
- package/debugger/webinspector-css.js.map +1 -1
- package/debugger/webinspector-dom.js.map +1 -1
- package/debugger/webinspector-network.android.js.map +1 -1
- package/debugger/webinspector-network.ios.js.map +1 -1
- package/file-system/file-system-access.android.js.map +1 -1
- package/file-system/file-system-access.ios.js +21 -13
- package/file-system/file-system-access.ios.js.map +1 -1
- package/file-system/index.d.ts +3 -3
- package/file-system/index.js.map +1 -1
- package/fps-meter/fps-native.android.js.map +1 -1
- package/fps-meter/fps-native.ios.js.map +1 -1
- package/fps-meter/index.js.map +1 -1
- package/global-types.d.ts +39 -33
- package/globals/global-utils.d.ts +6 -1
- package/globals/global-utils.js +10 -5
- package/globals/global-utils.js.map +1 -1
- package/globals/index.js +18 -5
- package/globals/index.js.map +1 -1
- package/globals/polyfills/polyfill-xhr.js.map +1 -1
- package/globals/polyfills/utils.js +2 -0
- package/globals/polyfills/utils.js.map +1 -1
- package/http/http-interfaces.js.map +1 -1
- package/http/http-request/http-request-common.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-internal/http-request-internal-common.d.ts +5 -1
- package/http/http-request-internal/http-request-internal-common.js +10 -0
- package/http/http-request-internal/http-request-internal-common.js.map +1 -1
- package/http/http-request-internal/index.android.d.ts +7 -1
- package/http/http-request-internal/index.android.js +2 -2
- package/http/http-request-internal/index.android.js.map +1 -1
- package/http/http-request-internal/index.ios.d.ts +7 -1
- package/http/http-request-internal/index.ios.js +2 -2
- package/http/http-request-internal/index.ios.js.map +1 -1
- package/http/index.js.map +1 -1
- package/image-asset/image-asset-common.js.map +1 -1
- package/image-asset/index.android.js.map +1 -1
- package/image-asset/index.ios.js.map +1 -1
- package/image-source/image-source-common.js.map +1 -1
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.ios.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/inspector_modules.js +1 -1
- package/inspector_modules.js.map +1 -1
- package/matrix/index.js.map +1 -1
- package/media-query-list/index.js.map +1 -1
- package/module-name-resolver/helpers.js.map +1 -1
- package/module-name-resolver/index.js.map +1 -1
- package/module-name-resolver/non-bundle-workflow-compat.js.map +1 -1
- package/module-name-resolver/qualifier-matcher/index.js.map +1 -1
- package/native-window/index.d.ts +426 -0
- package/native-window/index.js +4 -0
- package/native-window/index.js.map +1 -0
- package/native-window/native-window-common.d.ts +153 -0
- package/native-window/native-window-common.js +340 -0
- package/native-window/native-window-common.js.map +1 -0
- package/native-window/native-window-interfaces.d.ts +186 -0
- package/native-window/native-window-interfaces.js +90 -0
- package/native-window/native-window-interfaces.js.map +1 -0
- package/native-window/native-window.android.d.ts +59 -0
- package/native-window/native-window.android.js +175 -0
- package/native-window/native-window.android.js.map +1 -0
- package/native-window/native-window.ios.d.ts +61 -0
- package/native-window/native-window.ios.js +220 -0
- package/native-window/native-window.ios.js.map +1 -0
- package/native-window/window-base.d.ts +111 -0
- package/native-window/window-base.js +91 -0
- package/native-window/window-base.js.map +1 -0
- package/package.json +3 -2
- package/platform/common.js.map +1 -1
- package/platform/device/index.android.js.map +1 -1
- package/platform/device/index.ios.js.map +1 -1
- package/platform/index.js.map +1 -1
- package/platform/screen/index.android.js.map +1 -1
- package/platform/screen/index.ios.d.ts +1 -0
- package/platform/screen/index.ios.js +6 -2
- package/platform/screen/index.ios.js.map +1 -1
- package/platforms/android/java/org/nativescript/widgets/BorderDrawable.java +5 -6
- package/platforms/android/java/org/nativescript/widgets/BoxShadowDrawable.java +0 -6
- package/platforms/android/java/org/nativescript/widgets/CommonLayoutParams.java +56 -0
- package/platforms/android/java/org/nativescript/widgets/ContentLayout.java +20 -4
- package/platforms/android/java/org/nativescript/widgets/CustomTransition.java +26 -9
- package/platforms/android/java/org/nativescript/widgets/FlexLine.java +3 -3
- package/platforms/android/java/org/nativescript/widgets/FlexboxLayout.java +194 -731
- package/platforms/android/java/org/nativescript/widgets/ImageView.java +2 -2
- package/platforms/android/java/org/nativescript/widgets/Utils.java +37 -9
- package/platforms/android/java/org/nativescript/widgets/ViewHelper.java +78 -0
- package/platforms/android/java/org/nativescript/widgets/image/BitmapOwner.java +1 -4
- package/platforms/android/java/org/nativescript/widgets/image/Worker.java +99 -76
- package/platforms/android/native-api-usage.json +11 -0
- package/platforms/ios/src/NativeScriptMainWindow.swift +72 -39
- package/profiling/index.js.map +1 -1
- package/references.d.ts +5 -2
- package/text/formatted-string.js.map +1 -1
- package/text/index.android.js.map +1 -1
- package/text/index.ios.js.map +1 -1
- package/text/span.js.map +1 -1
- package/text/text-common.js +1 -1
- package/text/text-common.js.map +1 -1
- package/timer/index.android.js.map +1 -1
- package/timer/index.ios.js.map +1 -1
- package/trace/index.d.ts +2 -2
- package/trace/index.js.map +1 -1
- package/ui/action-bar/action-bar-common.js.map +1 -1
- package/ui/action-bar/index.android.js +2 -7
- package/ui/action-bar/index.android.js.map +1 -1
- package/ui/action-bar/index.d.ts +13 -1
- package/ui/action-bar/index.ios.js +26 -0
- package/ui/action-bar/index.ios.js.map +1 -1
- package/ui/activity-indicator/activity-indicator-common.js.map +1 -1
- package/ui/activity-indicator/index.android.js.map +1 -1
- package/ui/activity-indicator/index.ios.js.map +1 -1
- package/ui/animation/animation-common.js.map +1 -1
- package/ui/animation/animation-interfaces.js.map +1 -1
- package/ui/animation/animation-shared.js.map +1 -1
- package/ui/animation/animation-types.js.map +1 -1
- package/ui/animation/index.android.js.map +1 -1
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/animation/keyframe-animation.d.ts +3 -1
- package/ui/animation/keyframe-animation.js +72 -3
- package/ui/animation/keyframe-animation.js.map +1 -1
- package/ui/builder/binding-builder.js.map +1 -1
- package/ui/builder/component-builder/index.js.map +1 -1
- package/ui/builder/index.js +9 -1
- package/ui/builder/index.js.map +1 -1
- package/ui/button/button-common.js.map +1 -1
- package/ui/button/index.android.js.map +1 -1
- package/ui/button/index.ios.js.map +1 -1
- package/ui/content-view/index.js.map +1 -1
- package/ui/core/bindable/bindable-expressions.js.map +1 -1
- package/ui/core/bindable/bindable-resources.js.map +1 -1
- package/ui/core/bindable/bindable-types.js.map +1 -1
- package/ui/core/bindable/index.js +2 -1
- package/ui/core/bindable/index.js.map +1 -1
- package/ui/core/control-state-change/index.android.js.map +1 -1
- package/ui/core/control-state-change/index.ios.js.map +1 -1
- package/ui/core/properties/index.d.ts +37 -2
- package/ui/core/properties/index.js +209 -32
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/properties/property-shared.js +11 -2
- package/ui/core/properties/property-shared.js.map +1 -1
- package/ui/core/view/index.android.d.ts +5 -0
- package/ui/core/view/index.android.js +78 -6
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.d.ts +58 -1
- package/ui/core/view/index.ios.d.ts +1 -0
- package/ui/core/view/index.ios.js +48 -11
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.d.ts +37 -0
- package/ui/core/view/view-common.js +81 -0
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.android.d.ts +1 -0
- package/ui/core/view/view-helper/index.android.js +8 -0
- package/ui/core/view/view-helper/index.android.js.map +1 -1
- package/ui/core/view/view-helper/index.d.ts +46 -0
- package/ui/core/view/view-helper/index.ios.d.ts +42 -0
- package/ui/core/view/view-helper/index.ios.js +170 -5
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-common.js +21 -3
- package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-shared.js.map +1 -1
- package/ui/core/view/view-interfaces.js.map +1 -1
- package/ui/core/view-base/index.js +80 -36
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/core/view-base/utils.js.map +1 -1
- package/ui/core/weak-event-listener/index.js.map +1 -1
- package/ui/date-picker/date-picker-common.js.map +1 -1
- package/ui/date-picker/index.android.js.map +1 -1
- package/ui/date-picker/index.ios.js.map +1 -1
- package/ui/dialogs/dialogs-common.js.map +1 -1
- package/ui/dialogs/index.android.js +5 -5
- package/ui/dialogs/index.android.js.map +1 -1
- package/ui/dialogs/index.ios.js.map +1 -1
- package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
- package/ui/editable-text-base/index.android.js +2 -1
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/editable-text-base/index.ios.js.map +1 -1
- package/ui/embedding/index.android.js.map +1 -1
- package/ui/embedding/index.ios.js.map +1 -1
- package/ui/enums/enums.js.map +1 -1
- package/ui/enums/index.js.map +1 -1
- package/ui/frame/activity.android.js.map +1 -1
- package/ui/frame/fragment.android.js.map +1 -1
- package/ui/frame/fragment.ios.js.map +1 -1
- package/ui/frame/fragment.transitions.android.d.ts +4 -4
- package/ui/frame/fragment.transitions.android.js +95 -78
- package/ui/frame/fragment.transitions.android.js.map +1 -1
- package/ui/frame/fragment.transitions.types.js.map +1 -1
- package/ui/frame/frame-common.d.ts +14 -2
- package/ui/frame/frame-common.js +51 -24
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/frame-constants.d.ts +9 -0
- package/ui/frame/frame-constants.js +10 -0
- package/ui/frame/frame-constants.js.map +1 -0
- package/ui/frame/frame-helper-for-android.d.ts +2 -2
- package/ui/frame/frame-helper-for-android.js +14 -5
- package/ui/frame/frame-helper-for-android.js.map +1 -1
- package/ui/frame/frame-helpers.js.map +1 -1
- package/ui/frame/frame-interfaces.d.ts +1 -1
- package/ui/frame/frame-interfaces.js.map +1 -1
- package/ui/frame/frame-stack.d.ts +22 -1
- package/ui/frame/frame-stack.js +43 -5
- package/ui/frame/frame-stack.js.map +1 -1
- package/ui/frame/index.android.d.ts +1 -2
- package/ui/frame/index.android.js +152 -53
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.d.ts +15 -5
- package/ui/frame/index.ios.d.ts +1 -1
- package/ui/frame/index.ios.js +86 -26
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/gestures/gestures-common.js.map +1 -1
- package/ui/gestures/gestures-types.d.ts +2 -0
- package/ui/gestures/gestures-types.js.map +1 -1
- package/ui/gestures/index.android.d.ts +1 -1
- package/ui/gestures/index.android.js +159 -124
- package/ui/gestures/index.android.js.map +1 -1
- package/ui/gestures/index.ios.js +30 -1
- package/ui/gestures/index.ios.js.map +1 -1
- package/ui/gestures/touch-manager.d.ts +1 -2
- package/ui/gestures/touch-manager.js +79 -50
- package/ui/gestures/touch-manager.js.map +1 -1
- package/ui/html-view/html-view-common.js.map +1 -1
- package/ui/html-view/index.android.js.map +1 -1
- package/ui/html-view/index.ios.js.map +1 -1
- package/ui/image/image-common.js +1 -1
- package/ui/image/image-common.js.map +1 -1
- package/ui/image/index.android.js +13 -1
- package/ui/image/index.android.js.map +1 -1
- package/ui/image/index.ios.js.map +1 -1
- package/ui/image/symbol-effects-common.js.map +1 -1
- package/ui/image/symbol-effects.android.js.map +1 -1
- package/ui/image/symbol-effects.ios.js.map +1 -1
- package/ui/image-cache/image-cache-common.js.map +1 -1
- package/ui/image-cache/index.android.js.map +1 -1
- package/ui/image-cache/index.ios.js.map +1 -1
- package/ui/index.d.ts +1 -1
- package/ui/index.js.map +1 -1
- package/ui/label/index.android.js.map +1 -1
- package/ui/label/index.ios.js.map +1 -1
- package/ui/layouts/absolute-layout/absolute-layout-common.js.map +1 -1
- package/ui/layouts/absolute-layout/index.android.js.map +1 -1
- package/ui/layouts/absolute-layout/index.ios.js +3 -0
- package/ui/layouts/absolute-layout/index.ios.js.map +1 -1
- package/ui/layouts/dock-layout/dock-layout-common.js.map +1 -1
- package/ui/layouts/dock-layout/index.android.js.map +1 -1
- package/ui/layouts/dock-layout/index.ios.js +3 -0
- package/ui/layouts/dock-layout/index.ios.js.map +1 -1
- package/ui/layouts/flexbox-layout/flexbox-layout-common.d.ts +7 -0
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js +18 -0
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.android.d.ts +5 -0
- package/ui/layouts/flexbox-layout/index.android.js +15 -0
- package/ui/layouts/flexbox-layout/index.android.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.d.ts +19 -1
- package/ui/layouts/flexbox-layout/index.ios.d.ts +2 -0
- package/ui/layouts/flexbox-layout/index.ios.js +246 -195
- package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
- package/ui/layouts/grid-layout/grid-layout-common.js.map +1 -1
- package/ui/layouts/grid-layout/index.android.js.map +1 -1
- package/ui/layouts/grid-layout/index.ios.js +3 -0
- package/ui/layouts/grid-layout/index.ios.js.map +1 -1
- package/ui/layouts/index.js.map +1 -1
- package/ui/layouts/layout-base-common.d.ts +1 -0
- package/ui/layouts/layout-base-common.js +23 -1
- package/ui/layouts/layout-base-common.js.map +1 -1
- package/ui/layouts/layout-base.android.js.map +1 -1
- package/ui/layouts/layout-base.ios.js.map +1 -1
- package/ui/layouts/liquid-glass/index.android.js.map +1 -1
- package/ui/layouts/liquid-glass/index.ios.d.ts +0 -1
- package/ui/layouts/liquid-glass/index.ios.js +2 -43
- package/ui/layouts/liquid-glass/index.ios.js.map +1 -1
- package/ui/layouts/liquid-glass/liquid-glass-common.js.map +1 -1
- package/ui/layouts/liquid-glass-container/index.android.js.map +1 -1
- package/ui/layouts/liquid-glass-container/index.ios.d.ts +0 -1
- package/ui/layouts/liquid-glass-container/index.ios.js +2 -43
- package/ui/layouts/liquid-glass-container/index.ios.js.map +1 -1
- package/ui/layouts/liquid-glass-container/liquid-glass-container-common.js.map +1 -1
- package/ui/layouts/root-layout/index.android.js.map +1 -1
- package/ui/layouts/root-layout/index.ios.js.map +1 -1
- package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
- package/ui/layouts/root-layout/root-layout-stack.js.map +1 -1
- package/ui/layouts/stack-layout/index.android.js.map +1 -1
- package/ui/layouts/stack-layout/index.ios.js +3 -0
- package/ui/layouts/stack-layout/index.ios.js.map +1 -1
- package/ui/layouts/stack-layout/stack-layout-common.js.map +1 -1
- package/ui/layouts/wrap-layout/index.android.js.map +1 -1
- package/ui/layouts/wrap-layout/index.ios.js +3 -0
- package/ui/layouts/wrap-layout/index.ios.js.map +1 -1
- package/ui/layouts/wrap-layout/wrap-layout-common.js.map +1 -1
- package/ui/list-picker/index.android.js.map +1 -1
- package/ui/list-picker/index.ios.js.map +1 -1
- package/ui/list-picker/list-picker-common.js.map +1 -1
- package/ui/list-view/index.android.js +2 -2
- package/ui/list-view/index.android.js.map +1 -1
- package/ui/list-view/index.d.ts +47 -3
- package/ui/list-view/index.ios.d.ts +13 -3
- package/ui/list-view/index.ios.js +132 -41
- package/ui/list-view/index.ios.js.map +1 -1
- package/ui/list-view/list-view-common.d.ts +19 -0
- package/ui/list-view/list-view-common.js +30 -0
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/events.js.map +1 -1
- package/ui/page/index.android.js.map +1 -1
- package/ui/page/index.d.ts +1 -1
- package/ui/page/index.ios.d.ts +3 -1
- package/ui/page/index.ios.js +26 -17
- package/ui/page/index.ios.js.map +1 -1
- package/ui/page/page-common.d.ts +5 -1
- package/ui/page/page-common.js.map +1 -1
- package/ui/placeholder/index.android.js.map +1 -1
- package/ui/placeholder/index.js.map +1 -1
- package/ui/placeholder/placeholder-common.js.map +1 -1
- package/ui/progress/index.android.js.map +1 -1
- package/ui/progress/index.ios.js.map +1 -1
- package/ui/progress/progress-common.js.map +1 -1
- package/ui/proxy-view-container/index.js.map +1 -1
- package/ui/repeater/index.d.ts +2 -1
- package/ui/repeater/index.js.map +1 -1
- package/ui/scroll-view/index.android.d.ts +2 -1
- package/ui/scroll-view/index.android.js +4 -1
- package/ui/scroll-view/index.android.js.map +1 -1
- package/ui/scroll-view/index.d.ts +53 -0
- package/ui/scroll-view/index.ios.d.ts +13 -1
- package/ui/scroll-view/index.ios.js +100 -20
- package/ui/scroll-view/index.ios.js.map +1 -1
- package/ui/scroll-view/scroll-view-common.d.ts +13 -0
- package/ui/scroll-view/scroll-view-common.js +27 -0
- package/ui/scroll-view/scroll-view-common.js.map +1 -1
- package/ui/search-bar/index.android.js.map +1 -1
- package/ui/search-bar/index.ios.js.map +1 -1
- package/ui/search-bar/search-bar-common.js.map +1 -1
- package/ui/segmented-bar/index.android.js.map +1 -1
- package/ui/segmented-bar/index.ios.js.map +1 -1
- package/ui/segmented-bar/segmented-bar-common.d.ts +5 -1
- package/ui/segmented-bar/segmented-bar-common.js +6 -1
- package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
- package/ui/slider/index.android.js.map +1 -1
- package/ui/slider/index.ios.js.map +1 -1
- package/ui/slider/slider-common.js.map +1 -1
- package/ui/split-view/index.android.js.map +1 -1
- package/ui/split-view/index.ios.js.map +1 -1
- package/ui/split-view/split-view-common.js.map +1 -1
- package/ui/styling/background-common.d.ts +2 -0
- package/ui/styling/background-common.js +8 -0
- package/ui/styling/background-common.js.map +1 -1
- package/ui/styling/background.android.d.ts +4 -1
- package/ui/styling/background.android.js +5 -2
- package/ui/styling/background.android.js.map +1 -1
- package/ui/styling/background.d.ts +1 -1
- package/ui/styling/background.ios.js +9 -2
- package/ui/styling/background.ios.js.map +1 -1
- package/ui/styling/box-shadow.js.map +1 -1
- package/ui/styling/clip-path-function.js.map +1 -1
- package/ui/styling/converters.js.map +1 -1
- package/ui/styling/css-animation-parser.js.map +1 -1
- package/ui/styling/css-selector.d.ts +60 -13
- package/ui/styling/css-selector.js +311 -50
- package/ui/styling/css-selector.js.map +1 -1
- package/ui/styling/css-shadow.js.map +1 -1
- package/ui/styling/css-stroke.js.map +1 -1
- package/ui/styling/css-transform.js.map +1 -1
- package/ui/styling/css-utils.d.ts +16 -0
- package/ui/styling/css-utils.js +121 -7
- package/ui/styling/css-utils.js.map +1 -1
- package/ui/styling/font-common.js.map +1 -1
- package/ui/styling/font-interfaces.js.map +1 -1
- package/ui/styling/font.android.js.map +1 -1
- package/ui/styling/font.ios.js.map +1 -1
- package/ui/styling/length-shared.d.ts +2 -0
- package/ui/styling/length-shared.js +29 -2
- package/ui/styling/length-shared.js.map +1 -1
- package/ui/styling/linear-gradient.js.map +1 -1
- package/ui/styling/style/index.d.ts +16 -0
- package/ui/styling/style/index.js +1 -0
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.d.ts +5 -0
- package/ui/styling/style-properties.js +172 -101
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.d.ts +24 -3
- package/ui/styling/style-scope.js +455 -63
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/styling/styling-profile.js.map +1 -1
- package/ui/styling/styling-shared.js.map +1 -1
- package/ui/switch/index.android.js.map +1 -1
- package/ui/switch/index.ios.js +5 -1
- package/ui/switch/index.ios.js.map +1 -1
- package/ui/switch/switch-common.js.map +1 -1
- package/ui/tab-view/index.android.js +4 -1
- package/ui/tab-view/index.android.js.map +1 -1
- package/ui/tab-view/index.d.ts +5 -3
- package/ui/tab-view/index.ios.d.ts +2 -1
- package/ui/tab-view/index.ios.js +81 -18
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/tab-view-common.d.ts +6 -1
- package/ui/tab-view/tab-view-common.js +17 -1
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/formatted-string.js.map +1 -1
- package/ui/text-base/index.android.js +5 -8
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.ios.d.ts +3 -0
- package/ui/text-base/index.ios.js +25 -3
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/span.js.map +1 -1
- package/ui/text-base/text-base-common.js.map +1 -1
- package/ui/text-field/index.android.js.map +1 -1
- package/ui/text-field/index.ios.js +13 -5
- package/ui/text-field/index.ios.js.map +1 -1
- package/ui/text-field/text-field-common.js.map +1 -1
- package/ui/text-view/index.android.js.map +1 -1
- package/ui/text-view/index.ios.js.map +1 -1
- package/ui/text-view/text-view-common.js.map +1 -1
- package/ui/time-picker/index.android.js.map +1 -1
- package/ui/time-picker/index.ios.js.map +1 -1
- package/ui/time-picker/time-picker-common.js.map +1 -1
- package/ui/transition/fade-transition.android.js.map +1 -1
- package/ui/transition/fade-transition.ios.js.map +1 -1
- package/ui/transition/flip-transition.android.js.map +1 -1
- package/ui/transition/index.android.js.map +1 -1
- package/ui/transition/index.d.ts +2 -1
- package/ui/transition/index.ios.js.map +1 -1
- package/ui/transition/modal-transition.android.js.map +1 -1
- package/ui/transition/modal-transition.ios.js +33 -5
- package/ui/transition/modal-transition.ios.js.map +1 -1
- package/ui/transition/page-transition.android.d.ts +4 -0
- package/ui/transition/page-transition.android.js +174 -45
- package/ui/transition/page-transition.android.js.map +1 -1
- package/ui/transition/page-transition.ios.d.ts +5 -0
- package/ui/transition/page-transition.ios.js +298 -36
- package/ui/transition/page-transition.ios.js.map +1 -1
- package/ui/transition/shared-transition-helper.android.d.ts +3 -0
- package/ui/transition/shared-transition-helper.android.js +9 -0
- package/ui/transition/shared-transition-helper.android.js.map +1 -1
- package/ui/transition/shared-transition-helper.d.ts +7 -0
- package/ui/transition/shared-transition-helper.ios.d.ts +48 -0
- package/ui/transition/shared-transition-helper.ios.js +977 -95
- package/ui/transition/shared-transition-helper.ios.js.map +1 -1
- package/ui/transition/shared-transition.d.ts +134 -0
- package/ui/transition/shared-transition.js +90 -2
- package/ui/transition/shared-transition.js.map +1 -1
- package/ui/transition/slide-transition.android.js.map +1 -1
- package/ui/transition/slide-transition.ios.js.map +1 -1
- package/ui/utils.android.js.map +1 -1
- package/ui/utils.d.ts +2 -0
- package/ui/utils.ios.js.map +1 -1
- package/ui/web-view/index.android.js.map +1 -1
- package/ui/web-view/index.ios.js.map +1 -1
- package/ui/web-view/web-view-common.js.map +1 -1
- package/ui/web-view/web-view-interfaces.js.map +1 -1
- package/utils/animation-helpers.js.map +1 -1
- package/utils/common.js.map +1 -1
- package/utils/constants.android.js.map +1 -1
- package/utils/constants.ios.js.map +1 -1
- package/utils/debug-source.js.map +1 -1
- package/utils/debug.js.map +1 -1
- package/utils/index.android.js.map +1 -1
- package/utils/index.ios.js.map +1 -1
- package/utils/layout-helper/index.android.js.map +1 -1
- package/utils/layout-helper/index.ios.js +11 -3
- package/utils/layout-helper/index.ios.js.map +1 -1
- package/utils/layout-helper/layout-helper-common.js.map +1 -1
- package/utils/layout-helper/layout-helper-shared.js.map +1 -1
- package/utils/lazy.js.map +1 -1
- package/utils/macrotask-scheduler.js.map +1 -1
- package/utils/mainthread-helper.android.js.map +1 -1
- package/utils/mainthread-helper.ios.js.map +1 -1
- package/utils/module-merge.js.map +1 -1
- package/utils/native-helper-for-android.js +6 -2
- package/utils/native-helper-for-android.js.map +1 -1
- package/utils/native-helper.android.d.ts +66 -2
- package/utils/native-helper.android.js.map +1 -1
- package/utils/native-helper.d.ts +2 -2
- package/utils/native-helper.ios.d.ts +52 -2
- package/utils/native-helper.ios.js +35 -5
- package/utils/native-helper.ios.js.map +1 -1
- package/utils/native-helper.types.d.ts +2 -0
- package/utils/number-utils.js.map +1 -1
- package/utils/platform-check.d.ts +1 -1
- package/utils/platform-check.js.map +1 -1
- package/utils/shared.js.map +1 -1
- package/utils/types.js.map +1 -1
- package/utils/utils-shared.js.map +1 -1
- package/wgc/atob.js.map +1 -1
- package/wgc/btoa.js.map +1 -1
- package/wgc/crypto/SubtleCrypto.js.map +1 -1
- package/wgc/crypto/index.d.ts +1 -1
- package/wgc/crypto/index.js +12 -8
- package/wgc/crypto/index.js.map +1 -1
- package/wgc/index.js.map +1 -1
- package/xhr/index.js.map +1 -1
- package/xml/index.js.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getNativeScriptGlobals } from '../../globals/global-utils';
|
|
2
|
-
import { CssAnimationProperty, _evaluateCssVariableExpression, _evaluateCssCalcExpression, isCssVariable, isCssVariableExpression, isCssCalcExpression } from '../core/properties';
|
|
2
|
+
import { CssAnimationProperty, _evaluateCssVariableExpression, _evaluateCssCalcExpression, _expandCssShorthand, _isCssPendingSubstitution, _isCssValueStillApplied, isCssVariable, isCssVariableExpression, isCssCalcExpression } from '../core/properties';
|
|
3
3
|
import { unsetValue } from '../core/properties/property-shared';
|
|
4
|
-
import { StyleSheetSelectorScope, fromAstNode,
|
|
4
|
+
import { StyleSheetSelectorScope, fromAstNode, matchMediaQueryString, matchSelectorCandidates } from './css-selector';
|
|
5
5
|
import { Trace } from './styling-shared';
|
|
6
6
|
import { File, knownFolders, path } from '../../file-system';
|
|
7
7
|
import { Application } from '../../application';
|
|
@@ -10,7 +10,6 @@ import { KeyframeAnimationInfo, KeyframeAnimation } from '../animation/keyframe-
|
|
|
10
10
|
import { CssAnimationParser } from './css-animation-parser';
|
|
11
11
|
import { sanitizeModuleName } from '../../utils/common';
|
|
12
12
|
import { resolveModuleName } from '../../module-name-resolver';
|
|
13
|
-
import { cleanupImportantFlags } from './css-utils';
|
|
14
13
|
// @ts-ignore apps resolve this at runtime with path alias in project bundlers
|
|
15
14
|
import appConfig from '~/package.json';
|
|
16
15
|
let parser = 'css-tree';
|
|
@@ -30,15 +29,73 @@ catch (e) {
|
|
|
30
29
|
let mergedApplicationCssSelectors = [];
|
|
31
30
|
let applicationCssSelectors = [];
|
|
32
31
|
const applicationAdditionalSelectors = [];
|
|
32
|
+
let mergedApplicationCssSelectorsInvalid = false;
|
|
33
33
|
let mergedApplicationCssKeyframes = [];
|
|
34
34
|
let applicationCssKeyframes = [];
|
|
35
35
|
const applicationAdditionalKeyframes = [];
|
|
36
|
+
let mergedApplicationCssKeyframesInvalid = false;
|
|
36
37
|
let applicationCssSelectorVersion = 0;
|
|
38
|
+
/**
|
|
39
|
+
* Shared index over the application stylesheets, built once for all style scopes.
|
|
40
|
+
* Tagged rules stay in it and are filtered out at match time - see `matchSelectorCandidates`.
|
|
41
|
+
*/
|
|
42
|
+
let applicationSelectorScope = null;
|
|
43
|
+
let applicationSelectorScopeVersion = -1;
|
|
44
|
+
let applicationSelectorScopeRuleCount = 0;
|
|
45
|
+
let applicationSelectorsHaveScopedTags = false;
|
|
46
|
+
/** Bumped when the application rules change in a way an append cannot express. */
|
|
47
|
+
let applicationSelectorsResetVersion = 0;
|
|
48
|
+
let applicationSelectorScopeResetVersion = -1;
|
|
37
49
|
const tagToScopeTag = new Map();
|
|
38
50
|
let currentScopeTag = null;
|
|
39
51
|
const animationsSymbol = Symbol('animations');
|
|
52
|
+
const animationVariablesSymbol = Symbol('animationVariables');
|
|
53
|
+
const keyframeVariablesSymbol = Symbol('keyframeVariables');
|
|
54
|
+
function isAnimationDeclaration(declaration) {
|
|
55
|
+
return declaration.property.startsWith('animation');
|
|
56
|
+
}
|
|
57
|
+
function keyframesUseVariables(keyframes) {
|
|
58
|
+
return keyframes.keyframes.some((keyframe) => keyframe.declarations.some((declaration) => typeof declaration.value === 'string' && isCssVariableExpression(declaration.value)));
|
|
59
|
+
}
|
|
60
|
+
function keyframesArrayFromCSS(keyframes, view) {
|
|
61
|
+
let unparsed = keyframes.keyframes;
|
|
62
|
+
if (view) {
|
|
63
|
+
unparsed = unparsed.map((keyframe) => ({
|
|
64
|
+
values: keyframe.values,
|
|
65
|
+
declarations: keyframe.declarations.map(({ property, value }) => ({ property, value: _evaluateCssVariableExpression(view, property, value) })),
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
return CssAnimationParser.keyframesArrayFromCSS(unparsed);
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
Trace.write(`Failed to parse keyframes [${keyframes.name}]${view ? ` for ${view}` : ''}. ${e}`, Trace.categories.Animation, Trace.messageType.warn);
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
40
76
|
const kebabCasePattern = /-([a-z])/g;
|
|
77
|
+
const kebabCaseReplacementFunc = (g) => g[1].toUpperCase();
|
|
41
78
|
const pattern = /('|")(.*?)\1/;
|
|
79
|
+
/**
|
|
80
|
+
* Parse a pending-substitution shorthand once its expression has been evaluated
|
|
81
|
+
* against the view; a value that does not survive evaluation leaves its longhands unset.
|
|
82
|
+
*/
|
|
83
|
+
function resolvePendingSubstitution(view, pending) {
|
|
84
|
+
const value = evaluateCssExpressions(view, pending.shorthand, pending.value);
|
|
85
|
+
if (value === unsetValue) {
|
|
86
|
+
return CssState.emptyPropertyBag;
|
|
87
|
+
}
|
|
88
|
+
const expanded = _expandCssShorthand(pending.shorthand, value);
|
|
89
|
+
if (!expanded) {
|
|
90
|
+
Trace.write(`Failed to expand shorthand [${pending.shorthand}] resolved to [${value}] for ${view}.`, Trace.categories.Style, Trace.messageType.warn);
|
|
91
|
+
return CssState.emptyPropertyBag;
|
|
92
|
+
}
|
|
93
|
+
const resolved = {};
|
|
94
|
+
for (let i = 0, length = expanded.length; i < length; i++) {
|
|
95
|
+
resolved[expanded[i][0]] = expanded[i][1];
|
|
96
|
+
}
|
|
97
|
+
return resolved;
|
|
98
|
+
}
|
|
42
99
|
/**
|
|
43
100
|
* Evaluate css-variable and css-calc expressions
|
|
44
101
|
*/
|
|
@@ -57,13 +114,115 @@ function evaluateCssExpressions(view, property, value) {
|
|
|
57
114
|
}
|
|
58
115
|
return value;
|
|
59
116
|
}
|
|
117
|
+
function evaluateCssVariable(view, name, value) {
|
|
118
|
+
const evaluated = evaluateCssExpressions(view, name, value);
|
|
119
|
+
return evaluated === unsetValue ? null : evaluated;
|
|
120
|
+
}
|
|
121
|
+
function settleCssVariables(view, cssExpsProperties) {
|
|
122
|
+
let names;
|
|
123
|
+
for (const property in cssExpsProperties) {
|
|
124
|
+
if (isCssVariable(property)) {
|
|
125
|
+
if (!names) {
|
|
126
|
+
names = [];
|
|
127
|
+
}
|
|
128
|
+
names.push(property);
|
|
129
|
+
view.style.setScopedCssVariable(property, evaluateCssVariable(view, property, cssExpsProperties[property]));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (!names || names.length < 2 || !hasForwardCssVariableReference(names, cssExpsProperties)) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
for (let pass = 1; pass < names.length; pass++) {
|
|
136
|
+
let changed = false;
|
|
137
|
+
for (const name of names) {
|
|
138
|
+
const value = evaluateCssVariable(view, name, cssExpsProperties[name]);
|
|
139
|
+
if (value !== view.style.getCssVariable(name)) {
|
|
140
|
+
view.style.setScopedCssVariable(name, value);
|
|
141
|
+
changed = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (!changed) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function hasForwardCssVariableReference(names, values) {
|
|
150
|
+
for (let i = 0; i < names.length; i++) {
|
|
151
|
+
const value = values[names[i]];
|
|
152
|
+
for (let j = i + 1; j < names.length; j++) {
|
|
153
|
+
const ref = `var(${names[j]}`;
|
|
154
|
+
let at = value.indexOf(ref);
|
|
155
|
+
while (at !== -1) {
|
|
156
|
+
const next = value[at + ref.length];
|
|
157
|
+
if (next === ')' || next === ',' || next === ' ' || next === undefined) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
at = value.indexOf(ref, at + 1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Only marks the merged list dirty - it is rebuilt on next read, since frameworks
|
|
168
|
+
* register stylesheets one call at a time.
|
|
169
|
+
*/
|
|
60
170
|
export function mergeCssSelectors() {
|
|
61
|
-
|
|
62
|
-
mergedApplicationCssSelectors.push(...applicationAdditionalSelectors);
|
|
171
|
+
mergedApplicationCssSelectorsInvalid = true;
|
|
63
172
|
}
|
|
64
173
|
export function mergeCssKeyframes() {
|
|
65
|
-
|
|
66
|
-
|
|
174
|
+
mergedApplicationCssKeyframesInvalid = true;
|
|
175
|
+
}
|
|
176
|
+
function getMergedApplicationCssSelectors() {
|
|
177
|
+
if (mergedApplicationCssSelectorsInvalid) {
|
|
178
|
+
mergedApplicationCssSelectorsInvalid = false;
|
|
179
|
+
mergedApplicationCssSelectors = concatRuleSets(applicationCssSelectors, applicationAdditionalSelectors);
|
|
180
|
+
}
|
|
181
|
+
return mergedApplicationCssSelectors;
|
|
182
|
+
}
|
|
183
|
+
function getMergedApplicationCssKeyframes() {
|
|
184
|
+
if (mergedApplicationCssKeyframesInvalid) {
|
|
185
|
+
mergedApplicationCssKeyframesInvalid = false;
|
|
186
|
+
mergedApplicationCssKeyframes = concatRuleSets(applicationCssKeyframes, applicationAdditionalKeyframes);
|
|
187
|
+
}
|
|
188
|
+
return mergedApplicationCssKeyframes;
|
|
189
|
+
}
|
|
190
|
+
function getApplicationSelectorScope() {
|
|
191
|
+
if (applicationSelectorScopeVersion === applicationCssSelectorVersion) {
|
|
192
|
+
return applicationSelectorScope;
|
|
193
|
+
}
|
|
194
|
+
const rulesets = getMergedApplicationCssSelectors();
|
|
195
|
+
const canAppend = applicationSelectorScope && applicationSelectorScopeResetVersion === applicationSelectorsResetVersion && rulesets.length >= applicationSelectorScopeRuleCount;
|
|
196
|
+
if (canAppend) {
|
|
197
|
+
applicationSelectorScope.appendRulesets(rulesets, applicationSelectorScopeRuleCount);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
applicationSelectorScope = rulesets.length > 0 ? new StyleSheetSelectorScope(rulesets, 0 /* SelectorTier.Application */) : null;
|
|
201
|
+
applicationSelectorsHaveScopedTags = false;
|
|
202
|
+
applicationSelectorScopeRuleCount = 0;
|
|
203
|
+
}
|
|
204
|
+
for (let i = applicationSelectorScopeRuleCount, length = rulesets.length; i < length; i++) {
|
|
205
|
+
if (rulesets[i].scopedTag) {
|
|
206
|
+
applicationSelectorsHaveScopedTags = true;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
applicationSelectorScopeRuleCount = rulesets.length;
|
|
211
|
+
applicationSelectorScopeVersion = applicationCssSelectorVersion;
|
|
212
|
+
applicationSelectorScopeResetVersion = applicationSelectorsResetVersion;
|
|
213
|
+
return applicationSelectorScope;
|
|
214
|
+
}
|
|
215
|
+
/** Avoids `push(...arr)`, which blows the stack past the engine's argument limit. */
|
|
216
|
+
function concatRuleSets(base, additional) {
|
|
217
|
+
const baseLength = base.length;
|
|
218
|
+
const merged = new Array(baseLength + additional.length);
|
|
219
|
+
for (let i = 0; i < baseLength; i++) {
|
|
220
|
+
merged[i] = base[i];
|
|
221
|
+
}
|
|
222
|
+
for (let i = 0, length = additional.length; i < length; i++) {
|
|
223
|
+
merged[baseLength + i] = additional[i];
|
|
224
|
+
}
|
|
225
|
+
return merged;
|
|
67
226
|
}
|
|
68
227
|
class CSSSource {
|
|
69
228
|
constructor(_ast, _url, _file, _source) {
|
|
@@ -214,6 +373,9 @@ class CSSSource {
|
|
|
214
373
|
if (rulesets && rulesets.length) {
|
|
215
374
|
rulesets.forEach((rule) => {
|
|
216
375
|
rule[animationsSymbol] = CssAnimationParser.keyframeAnimationsFromCSSDeclarations(rule.declarations);
|
|
376
|
+
if (rule[animationsSymbol] && rule.declarations.some((declaration) => isAnimationDeclaration(declaration) && isCssVariableExpression(declaration.value))) {
|
|
377
|
+
rule[animationVariablesSymbol] = true;
|
|
378
|
+
}
|
|
217
379
|
});
|
|
218
380
|
}
|
|
219
381
|
this._selectors = rulesets;
|
|
@@ -277,8 +439,20 @@ export function _populateRules(nodes, rulesets, keyframes, mediaQueryString) {
|
|
|
277
439
|
keyframes.push(keyframeRule);
|
|
278
440
|
}
|
|
279
441
|
else if (isMedia(node)) {
|
|
280
|
-
// Media query
|
|
281
|
-
|
|
442
|
+
// Media query can be an array of strings in case of nested queries
|
|
443
|
+
let compositeMediaQuery;
|
|
444
|
+
if (mediaQueryString) {
|
|
445
|
+
if (typeof mediaQueryString === 'string') {
|
|
446
|
+
compositeMediaQuery = [mediaQueryString, node.media];
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
mediaQueryString.push(node.media);
|
|
450
|
+
compositeMediaQuery = mediaQueryString;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
compositeMediaQuery = node.media;
|
|
455
|
+
}
|
|
282
456
|
_populateRules(node.rules, rulesets, keyframes, compositeMediaQuery);
|
|
283
457
|
}
|
|
284
458
|
else if (isRule(node)) {
|
|
@@ -307,6 +481,8 @@ export function removeTaggedAdditionalCSS(tag) {
|
|
|
307
481
|
}
|
|
308
482
|
}
|
|
309
483
|
if (selectorsChanged) {
|
|
484
|
+
// Rules were dropped from the middle of the list, so the index has to be rebuilt.
|
|
485
|
+
applicationSelectorsResetVersion++;
|
|
310
486
|
mergeCssSelectors();
|
|
311
487
|
updated = true;
|
|
312
488
|
}
|
|
@@ -394,6 +570,8 @@ const loadCss = profile(`"style-scope".loadCss`, (cssModule) => {
|
|
|
394
570
|
let updated = false;
|
|
395
571
|
// Check for existing application css selectors too in case the app is undergoing a live-sync
|
|
396
572
|
if (selectors.length > 0 || applicationCssSelectors.length > 0) {
|
|
573
|
+
// The base stylesheet is replaced rather than appended to.
|
|
574
|
+
applicationSelectorsResetVersion++;
|
|
397
575
|
applicationCssSelectors = selectors;
|
|
398
576
|
mergeCssSelectors();
|
|
399
577
|
updated = true;
|
|
@@ -429,10 +607,41 @@ if (Application.hasLaunched()) {
|
|
|
429
607
|
else {
|
|
430
608
|
getNativeScriptGlobals().events.on('loadAppCss', loadAppCSS);
|
|
431
609
|
}
|
|
610
|
+
function trackedNamesEqual(a, b) {
|
|
611
|
+
if (a === b) {
|
|
612
|
+
return true;
|
|
613
|
+
}
|
|
614
|
+
if (!a || !b || a.size !== b.size) {
|
|
615
|
+
return false;
|
|
616
|
+
}
|
|
617
|
+
for (const name of a) {
|
|
618
|
+
if (!b.has(name)) {
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
return true;
|
|
623
|
+
}
|
|
624
|
+
/** Two empty maps compare equal even when they are different objects. */
|
|
625
|
+
function changeMapsEqual(applied, current) {
|
|
626
|
+
if (applied === current) {
|
|
627
|
+
return true;
|
|
628
|
+
}
|
|
629
|
+
if (applied.size !== current.size) {
|
|
630
|
+
return false;
|
|
631
|
+
}
|
|
632
|
+
for (const [view, changes] of applied) {
|
|
633
|
+
const currentChanges = current.get(view);
|
|
634
|
+
if (!currentChanges || !trackedNamesEqual(changes.attributes, currentChanges.attributes) || !trackedNamesEqual(changes.pseudoClasses, currentChanges.pseudoClasses)) {
|
|
635
|
+
return false;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return true;
|
|
639
|
+
}
|
|
432
640
|
export class CssState {
|
|
433
641
|
constructor(viewRef) {
|
|
434
642
|
this.viewRef = viewRef;
|
|
435
643
|
this._appliedPropertyValues = CssState.emptyPropertyBag;
|
|
644
|
+
this._appliedLocalValueVersion = -1;
|
|
436
645
|
this._onDynamicStateChangeHandler = () => this.updateDynamicState();
|
|
437
646
|
}
|
|
438
647
|
/**
|
|
@@ -442,9 +651,13 @@ export class CssState {
|
|
|
442
651
|
onChange(force = false) {
|
|
443
652
|
const view = this.viewRef.get();
|
|
444
653
|
if (view && (force || view.isLoaded)) {
|
|
445
|
-
|
|
654
|
+
// Matching does not read the subscriptions, so re-subscribe only when the
|
|
655
|
+
// dependencies actually changed - they are usually identical.
|
|
446
656
|
this.updateMatch();
|
|
447
|
-
this.
|
|
657
|
+
if (!changeMapsEqual(this._appliedChangeMap, this._match.changeMap)) {
|
|
658
|
+
this.unsubscribeFromDynamicUpdates();
|
|
659
|
+
this.subscribeForDynamicUpdates();
|
|
660
|
+
}
|
|
448
661
|
this.updateDynamicState();
|
|
449
662
|
}
|
|
450
663
|
else {
|
|
@@ -462,6 +675,13 @@ export class CssState {
|
|
|
462
675
|
}
|
|
463
676
|
return this.viewRef.get()._styleScope.getSelectorsVersion() === this._appliedSelectorsVersion;
|
|
464
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* The value the cascade last resolved for a longhand, `undefined` if it resolved none.
|
|
680
|
+
* Recorded even while a local value suppresses the write.
|
|
681
|
+
*/
|
|
682
|
+
_getAppliedPropertyValue(property) {
|
|
683
|
+
return this._appliedPropertyValues[property];
|
|
684
|
+
}
|
|
465
685
|
onLoaded() {
|
|
466
686
|
if (this._matchInvalid) {
|
|
467
687
|
this.updateMatch();
|
|
@@ -490,7 +710,14 @@ export class CssState {
|
|
|
490
710
|
Trace.write(`updateDynamicState not executed to view because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
491
711
|
return;
|
|
492
712
|
}
|
|
493
|
-
const
|
|
713
|
+
const selectors = this._match.selectors;
|
|
714
|
+
const matchingSelectors = [];
|
|
715
|
+
for (let i = 0, length = selectors.length; i < length; i++) {
|
|
716
|
+
const sel = selectors[i];
|
|
717
|
+
if (!sel.dynamic || sel.match(view)) {
|
|
718
|
+
matchingSelectors.push(sel);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
494
721
|
// Ideally we should return here if there are no matching selectors, however
|
|
495
722
|
// if there are property removals, returning here would not remove them
|
|
496
723
|
// this is seen in STYLE test in automated.
|
|
@@ -506,9 +733,16 @@ export class CssState {
|
|
|
506
733
|
playKeyframeAnimations(matchingSelectors) {
|
|
507
734
|
const animations = [];
|
|
508
735
|
matchingSelectors.forEach((selector) => {
|
|
509
|
-
const
|
|
736
|
+
const ruleset = selector.ruleset;
|
|
737
|
+
let ruleAnimations = ruleset?.[animationsSymbol];
|
|
738
|
+
if (ruleAnimations && ruleset[animationVariablesSymbol]) {
|
|
739
|
+
ruleAnimations = this.resolveAnimationVariables(ruleset);
|
|
740
|
+
}
|
|
510
741
|
if (ruleAnimations) {
|
|
511
|
-
for (
|
|
742
|
+
for (let animationInfo of ruleAnimations) {
|
|
743
|
+
if (animationInfo[keyframeVariablesSymbol]) {
|
|
744
|
+
animationInfo = this.resolveKeyframeVariables(animationInfo);
|
|
745
|
+
}
|
|
512
746
|
const animation = KeyframeAnimation.keyframeAnimationFromInfo(animationInfo);
|
|
513
747
|
if (animation) {
|
|
514
748
|
animations.push(animation);
|
|
@@ -527,6 +761,27 @@ export class CssState {
|
|
|
527
761
|
this._appliedAnimations = animations;
|
|
528
762
|
}
|
|
529
763
|
}
|
|
764
|
+
resolveAnimationVariables(ruleset) {
|
|
765
|
+
const view = this.viewRef.get();
|
|
766
|
+
const scope = view?._styleScope;
|
|
767
|
+
if (!scope) {
|
|
768
|
+
return null;
|
|
769
|
+
}
|
|
770
|
+
const declarations = ruleset.declarations.filter(isAnimationDeclaration).map(({ property, value }) => ({ property, value: _evaluateCssVariableExpression(view, property, value) }));
|
|
771
|
+
const animations = CssAnimationParser.keyframeAnimationsFromCSSDeclarations(declarations);
|
|
772
|
+
if (animations) {
|
|
773
|
+
for (const animation of animations) {
|
|
774
|
+
scope._applyKeyframes(animation);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return animations;
|
|
778
|
+
}
|
|
779
|
+
resolveKeyframeVariables(animation) {
|
|
780
|
+
const view = this.viewRef.get();
|
|
781
|
+
const resolved = Object.assign(new KeyframeAnimationInfo(), animation);
|
|
782
|
+
resolved.keyframes = view ? keyframesArrayFromCSS(animation[keyframeVariablesSymbol], view) : null;
|
|
783
|
+
return resolved;
|
|
784
|
+
}
|
|
530
785
|
stopKeyframeAnimations() {
|
|
531
786
|
if (!this._playsKeyframeAnimations) {
|
|
532
787
|
return;
|
|
@@ -557,77 +812,168 @@ export class CssState {
|
|
|
557
812
|
return;
|
|
558
813
|
}
|
|
559
814
|
const newPropertyValues = new view.style.PropertyBag();
|
|
560
|
-
|
|
815
|
+
for (let i = 0, length = matchingSelectors.length; i < length; i++) {
|
|
816
|
+
const ruleset = matchingSelectors[i].ruleset;
|
|
817
|
+
ruleset.expandLateShorthands();
|
|
818
|
+
const declarations = ruleset.declarations;
|
|
819
|
+
for (let j = 0, count = declarations.length; j < count; j++) {
|
|
820
|
+
newPropertyValues[declarations[j].property] = declarations[j].value;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
561
823
|
const oldProperties = this._appliedPropertyValues;
|
|
824
|
+
// A local write is the only thing that can drop a value the cascade already
|
|
825
|
+
// applied, so the recorded values only have to be verified after one.
|
|
826
|
+
const localValueVersion = view.style._localValueVersion;
|
|
827
|
+
const verifyApplied = localValueVersion !== this._appliedLocalValueVersion;
|
|
562
828
|
// Update values for the scope's css-variables
|
|
563
829
|
view.style.resetScopedCssVariables();
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
830
|
+
let valuesToApply;
|
|
831
|
+
let cssExpsProperties;
|
|
832
|
+
let pendingProperties;
|
|
567
833
|
for (const property in newPropertyValues) {
|
|
568
|
-
const value =
|
|
569
|
-
|
|
834
|
+
const value = newPropertyValues[property];
|
|
835
|
+
if (_isCssPendingSubstitution(value)) {
|
|
836
|
+
// Resolvable only after the css variables below are up to date.
|
|
837
|
+
if (!pendingProperties) {
|
|
838
|
+
pendingProperties = {};
|
|
839
|
+
}
|
|
840
|
+
pendingProperties[property] = value;
|
|
841
|
+
continue;
|
|
842
|
+
}
|
|
843
|
+
// Expanded shorthand values are already converted and may not be strings.
|
|
844
|
+
const isCssExp = typeof value === 'string' && (isCssVariableExpression(value) || isCssCalcExpression(value));
|
|
570
845
|
if (isCssExp) {
|
|
571
846
|
// we handle css exp separately because css vars must be evaluated first
|
|
847
|
+
if (!cssExpsProperties) {
|
|
848
|
+
cssExpsProperties = {};
|
|
849
|
+
}
|
|
572
850
|
cssExpsProperties[property] = value;
|
|
573
851
|
continue;
|
|
574
852
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
853
|
+
// Whatever is left in oldProperties after these loops was removed and gets unset.
|
|
854
|
+
const hadOldValue = property in oldProperties;
|
|
855
|
+
const unchanged = hadOldValue && oldProperties[property] === value && (!verifyApplied || _isCssValueStillApplied(view.style, property, value));
|
|
856
|
+
if (hadOldValue) {
|
|
857
|
+
delete oldProperties[property];
|
|
579
858
|
}
|
|
580
859
|
if (isCssVariable(property)) {
|
|
860
|
+
// The scoped css-variables were just reset, so they always have to be re-registered.
|
|
581
861
|
view.style.setScopedCssVariable(property, value);
|
|
582
862
|
delete newPropertyValues[property];
|
|
583
863
|
continue;
|
|
584
864
|
}
|
|
865
|
+
if (unchanged) {
|
|
866
|
+
continue;
|
|
867
|
+
}
|
|
868
|
+
if (!valuesToApply) {
|
|
869
|
+
valuesToApply = {};
|
|
870
|
+
}
|
|
585
871
|
valuesToApply[property] = value;
|
|
586
872
|
}
|
|
587
873
|
//we need to parse CSS vars first before evaluating css expressions
|
|
874
|
+
if (cssExpsProperties) {
|
|
875
|
+
settleCssVariables(view, cssExpsProperties);
|
|
876
|
+
}
|
|
588
877
|
for (const property in cssExpsProperties) {
|
|
589
|
-
|
|
590
|
-
const
|
|
591
|
-
if (
|
|
592
|
-
|
|
878
|
+
const hadOldValue = property in oldProperties;
|
|
879
|
+
const oldValue = hadOldValue ? oldProperties[property] : undefined;
|
|
880
|
+
if (hadOldValue) {
|
|
881
|
+
delete oldProperties[property];
|
|
882
|
+
}
|
|
883
|
+
if (isCssVariable(property)) {
|
|
884
|
+
delete newPropertyValues[property];
|
|
593
885
|
continue;
|
|
594
886
|
}
|
|
887
|
+
const value = evaluateCssExpressions(view, property, cssExpsProperties[property]);
|
|
595
888
|
if (value === unsetValue) {
|
|
596
889
|
delete newPropertyValues[property];
|
|
597
890
|
}
|
|
598
|
-
|
|
599
|
-
|
|
891
|
+
else {
|
|
892
|
+
// Record the evaluated value - the next diff compares against it.
|
|
893
|
+
newPropertyValues[property] = value;
|
|
894
|
+
}
|
|
895
|
+
if (hadOldValue && oldValue === value && (!verifyApplied || _isCssValueStillApplied(view.style, property, value))) {
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
898
|
+
if (!valuesToApply) {
|
|
899
|
+
valuesToApply = {};
|
|
900
|
+
}
|
|
901
|
+
valuesToApply[property] = value;
|
|
902
|
+
}
|
|
903
|
+
// Each shorthand is resolved once, however many longhands point at it.
|
|
904
|
+
let resolvedShorthands;
|
|
905
|
+
for (const property in pendingProperties) {
|
|
906
|
+
const pending = pendingProperties[property];
|
|
907
|
+
if (!resolvedShorthands) {
|
|
908
|
+
resolvedShorthands = new Map();
|
|
909
|
+
}
|
|
910
|
+
let resolved = resolvedShorthands.get(pending);
|
|
911
|
+
if (!resolved) {
|
|
912
|
+
resolved = resolvePendingSubstitution(view, pending);
|
|
913
|
+
resolvedShorthands.set(pending, resolved);
|
|
914
|
+
}
|
|
915
|
+
const value = property in resolved ? resolved[property] : unsetValue;
|
|
916
|
+
const hadOldValue = property in oldProperties;
|
|
917
|
+
const oldValue = hadOldValue ? oldProperties[property] : undefined;
|
|
918
|
+
if (hadOldValue) {
|
|
919
|
+
delete oldProperties[property];
|
|
920
|
+
}
|
|
921
|
+
if (value === unsetValue) {
|
|
600
922
|
delete newPropertyValues[property];
|
|
601
923
|
}
|
|
924
|
+
else {
|
|
925
|
+
newPropertyValues[property] = value;
|
|
926
|
+
}
|
|
927
|
+
if (hadOldValue && oldValue === value && (!verifyApplied || _isCssValueStillApplied(view.style, property, value))) {
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
if (!valuesToApply) {
|
|
931
|
+
valuesToApply = {};
|
|
932
|
+
}
|
|
602
933
|
valuesToApply[property] = value;
|
|
603
934
|
}
|
|
604
|
-
// Unset removed values
|
|
935
|
+
// Unset removed values - the bag is keyed by longhands only, so unsetting
|
|
936
|
+
// one entry cannot clear a value another one set.
|
|
605
937
|
for (const property in oldProperties) {
|
|
606
938
|
if (property in view.style) {
|
|
607
939
|
view.style[`css:${property}`] = unsetValue;
|
|
608
940
|
}
|
|
609
941
|
else {
|
|
610
|
-
const camelCasedProperty = property.replace(kebabCasePattern,
|
|
942
|
+
const camelCasedProperty = property.replace(kebabCasePattern, kebabCaseReplacementFunc);
|
|
611
943
|
view[camelCasedProperty] = unsetValue;
|
|
612
944
|
}
|
|
613
945
|
}
|
|
614
946
|
// Set new values to the style
|
|
615
947
|
for (const property in valuesToApply) {
|
|
616
948
|
const value = valuesToApply[property];
|
|
949
|
+
const inStyle = property in view.style;
|
|
950
|
+
const camelCasedProperty = inStyle ? undefined : property.replace(kebabCasePattern, kebabCaseReplacementFunc);
|
|
617
951
|
try {
|
|
618
|
-
if (
|
|
952
|
+
if (inStyle) {
|
|
619
953
|
view.style[`css:${property}`] = value;
|
|
620
954
|
}
|
|
621
955
|
else {
|
|
622
|
-
const camelCasedProperty = property.replace(kebabCasePattern, replacementFunc);
|
|
623
956
|
view[camelCasedProperty] = value;
|
|
624
957
|
}
|
|
625
958
|
}
|
|
626
959
|
catch (e) {
|
|
627
960
|
Trace.write(`Failed to apply property [${property}] with value [${value}] to ${view}. ${e.stack}`, Trace.categories.Error, Trace.messageType.error);
|
|
961
|
+
delete newPropertyValues[property];
|
|
962
|
+
try {
|
|
963
|
+
if (inStyle) {
|
|
964
|
+
view.style[`css:${property}`] = unsetValue;
|
|
965
|
+
}
|
|
966
|
+
else {
|
|
967
|
+
view[camelCasedProperty] = unsetValue;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
catch (e) {
|
|
971
|
+
Trace.write(`Failed to unset property [${property}] on ${view}. ${e.stack}`, Trace.categories.Error, Trace.messageType.error);
|
|
972
|
+
}
|
|
628
973
|
}
|
|
629
974
|
}
|
|
630
975
|
this._appliedPropertyValues = newPropertyValues;
|
|
976
|
+
this._appliedLocalValueVersion = view.style._localValueVersion;
|
|
631
977
|
}
|
|
632
978
|
subscribeForDynamicUpdates() {
|
|
633
979
|
const changeMap = this._match.changeMap;
|
|
@@ -702,12 +1048,13 @@ CssState.prototype._matchInvalid = true;
|
|
|
702
1048
|
export class StyleScope {
|
|
703
1049
|
constructor() {
|
|
704
1050
|
this._css = '';
|
|
1051
|
+
this._hasSelectors = false;
|
|
705
1052
|
this._localCssSelectors = [];
|
|
706
1053
|
this._localCssKeyframes = [];
|
|
707
1054
|
this._localCssSelectorVersion = 0;
|
|
708
1055
|
this._localCssSelectorsAppliedVersion = 0;
|
|
709
1056
|
this._applicationCssSelectorsAppliedVersion = 0;
|
|
710
|
-
this._cssFiles =
|
|
1057
|
+
this._cssFiles = new Set();
|
|
711
1058
|
}
|
|
712
1059
|
get css() {
|
|
713
1060
|
return this._css;
|
|
@@ -725,7 +1072,7 @@ export class StyleScope {
|
|
|
725
1072
|
if (!cssFileName) {
|
|
726
1073
|
return;
|
|
727
1074
|
}
|
|
728
|
-
this._cssFiles.
|
|
1075
|
+
this._cssFiles.add(cssFileName);
|
|
729
1076
|
currentScopeTag = cssFileName;
|
|
730
1077
|
const cssFile = CSSSource.fromURI(cssFileName);
|
|
731
1078
|
currentScopeTag = null;
|
|
@@ -748,7 +1095,7 @@ export class StyleScope {
|
|
|
748
1095
|
return;
|
|
749
1096
|
}
|
|
750
1097
|
if (cssFileName) {
|
|
751
|
-
this._cssFiles.
|
|
1098
|
+
this._cssFiles.add(cssFileName);
|
|
752
1099
|
currentScopeTag = cssFileName;
|
|
753
1100
|
}
|
|
754
1101
|
const cssFile = cssString ? CSSSource.fromSource(cssString, cssFileName) : CSSSource.fromURI(cssFileName);
|
|
@@ -765,15 +1112,29 @@ export class StyleScope {
|
|
|
765
1112
|
}
|
|
766
1113
|
const keyframeRule = this.findKeyframeRule(animationName);
|
|
767
1114
|
const animation = new KeyframeAnimationInfo();
|
|
768
|
-
animation.keyframes = keyframeRule ?
|
|
1115
|
+
animation.keyframes = keyframeRule ? keyframesArrayFromCSS(keyframeRule) : null;
|
|
769
1116
|
return animation;
|
|
770
1117
|
}
|
|
771
1118
|
ensureSelectors() {
|
|
772
|
-
if (!this.isApplicationCssSelectorsLatestVersionApplied() || !this.isLocalCssSelectorsLatestVersionApplied()
|
|
1119
|
+
if (!this.isApplicationCssSelectorsLatestVersionApplied() || !this.isLocalCssSelectorsLatestVersionApplied()) {
|
|
773
1120
|
this._createSelectors();
|
|
774
1121
|
}
|
|
775
1122
|
return this.getSelectorsVersion();
|
|
776
1123
|
}
|
|
1124
|
+
/**
|
|
1125
|
+
* True when any selector in the scope contains an adjacent sibling ('+') combinator.
|
|
1126
|
+
*/
|
|
1127
|
+
get hasAdjacentCombinatorSelectors() {
|
|
1128
|
+
this.ensureSelectors();
|
|
1129
|
+
return !!applicationSelectorScope?.hasAdjacentCombinatorSelectors || !!this._localSelectorScope?.hasAdjacentCombinatorSelectors;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* True when any selector in the scope contains a general sibling ('~') combinator.
|
|
1133
|
+
*/
|
|
1134
|
+
get hasSiblingCombinatorSelectors() {
|
|
1135
|
+
this.ensureSelectors();
|
|
1136
|
+
return !!applicationSelectorScope?.hasSiblingCombinatorSelectors || !!this._localSelectorScope?.hasSiblingCombinatorSelectors;
|
|
1137
|
+
}
|
|
777
1138
|
/**
|
|
778
1139
|
* Increase the application CSS selector version.
|
|
779
1140
|
*/
|
|
@@ -787,38 +1148,43 @@ export class StyleScope {
|
|
|
787
1148
|
return this._localCssSelectorsAppliedVersion === this._localCssSelectorVersion;
|
|
788
1149
|
}
|
|
789
1150
|
_createSelectors() {
|
|
790
|
-
const
|
|
791
|
-
const
|
|
792
|
-
toMerge.push(...mergedApplicationCssSelectors.filter((v) => !v.scopedTag || this._cssFiles.indexOf(v.scopedTag) >= 0));
|
|
793
|
-
toMergeKeyframes.push(...mergedApplicationCssKeyframes.filter((v) => !v.scopedTag || this._cssFiles.indexOf(v.scopedTag) >= 0));
|
|
1151
|
+
const cssFiles = this._cssFiles;
|
|
1152
|
+
const applicationScope = getApplicationSelectorScope();
|
|
794
1153
|
this._applicationCssSelectorsAppliedVersion = applicationCssSelectorVersion;
|
|
795
|
-
|
|
796
|
-
|
|
1154
|
+
if (!this.isLocalCssSelectorsLatestVersionApplied() || (!this._localSelectorScope && this._localCssSelectors.length > 0)) {
|
|
1155
|
+
this._localSelectorScope = this._localCssSelectors.length > 0 ? new StyleSheetSelectorScope(this._localCssSelectors, 1 /* SelectorTier.Local */) : null;
|
|
1156
|
+
}
|
|
797
1157
|
this._localCssSelectorsAppliedVersion = this._localCssSelectorVersion;
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
1158
|
+
this._hasSelectors = !!applicationScope || !!this._localSelectorScope;
|
|
1159
|
+
const toMergeKeyframes = [];
|
|
1160
|
+
const applicationKeyframes = getMergedApplicationCssKeyframes();
|
|
1161
|
+
for (let i = 0, length = applicationKeyframes.length; i < length; i++) {
|
|
1162
|
+
const keyframe = applicationKeyframes[i];
|
|
1163
|
+
if (!keyframe.scopedTag || cssFiles.has(keyframe.scopedTag)) {
|
|
1164
|
+
toMergeKeyframes.push(keyframe);
|
|
1165
|
+
}
|
|
801
1166
|
}
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
1167
|
+
const localKeyframes = this._localCssKeyframes;
|
|
1168
|
+
for (let i = 0, length = localKeyframes.length; i < length; i++) {
|
|
1169
|
+
toMergeKeyframes.push(localKeyframes[i]);
|
|
805
1170
|
}
|
|
806
1171
|
this._mergedCssKeyframes = toMergeKeyframes.length > 0 ? toMergeKeyframes : null;
|
|
807
1172
|
}
|
|
808
1173
|
// HACK: This @profile decorator creates a circular dependency
|
|
809
1174
|
// HACK: because the function parameter type is evaluated with 'typeof'
|
|
810
1175
|
matchSelectors(view) {
|
|
811
|
-
let match;
|
|
812
1176
|
// should be (view: ViewBase): SelectorsMatch<ViewBase>
|
|
813
1177
|
this.ensureSelectors();
|
|
814
|
-
if (this.
|
|
815
|
-
|
|
816
|
-
// Make sure to re-apply keyframes to matching selectors as a media query keyframe might be applicable at this point
|
|
817
|
-
this._applyKeyframesToSelectors(match.selectors);
|
|
818
|
-
}
|
|
819
|
-
else {
|
|
820
|
-
match = null;
|
|
1178
|
+
if (!this._hasSelectors) {
|
|
1179
|
+
return null;
|
|
821
1180
|
}
|
|
1181
|
+
// The cascade has to see the application and local candidates as a single ordered set.
|
|
1182
|
+
const candidates = [];
|
|
1183
|
+
applicationSelectorScope?.collectCandidates(view, candidates);
|
|
1184
|
+
this._localSelectorScope?.collectCandidates(view, candidates);
|
|
1185
|
+
const match = matchSelectorCandidates(view, candidates, applicationSelectorsHaveScopedTags ? this._cssFiles : undefined);
|
|
1186
|
+
// Make sure to re-apply keyframes to matching selectors as a media query keyframe might be applicable at this point
|
|
1187
|
+
this._applyKeyframesToSelectors(match.selectors);
|
|
822
1188
|
return match;
|
|
823
1189
|
}
|
|
824
1190
|
query(node) {
|
|
@@ -840,12 +1206,22 @@ export class StyleScope {
|
|
|
840
1206
|
const animations = ruleset[animationsSymbol];
|
|
841
1207
|
if (animations != null && animations.length) {
|
|
842
1208
|
for (const animation of animations) {
|
|
843
|
-
|
|
844
|
-
animation.keyframes = keyframeRule ? CssAnimationParser.keyframesArrayFromCSS(keyframeRule.keyframes) : null;
|
|
1209
|
+
this._applyKeyframes(animation);
|
|
845
1210
|
}
|
|
846
1211
|
}
|
|
847
1212
|
}
|
|
848
1213
|
}
|
|
1214
|
+
_applyKeyframes(animation) {
|
|
1215
|
+
const keyframeRule = this.findKeyframeRule(animation.name);
|
|
1216
|
+
if (keyframeRule && keyframesUseVariables(keyframeRule)) {
|
|
1217
|
+
animation[keyframeVariablesSymbol] = keyframeRule;
|
|
1218
|
+
animation.keyframes = null;
|
|
1219
|
+
}
|
|
1220
|
+
else {
|
|
1221
|
+
animation[keyframeVariablesSymbol] = undefined;
|
|
1222
|
+
animation.keyframes = keyframeRule ? keyframesArrayFromCSS(keyframeRule) : null;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
849
1225
|
getAnimations(ruleset) {
|
|
850
1226
|
return ruleset[animationsSymbol];
|
|
851
1227
|
}
|
|
@@ -926,7 +1302,7 @@ function resolveFilePathFromImport(importSource, fileName) {
|
|
|
926
1302
|
fileNameParts.forEach((p) => (isParentDirectory(p) ? importSourceParts.pop() : importSourceParts.push(p)));
|
|
927
1303
|
return importSourceParts.join(path.separator);
|
|
928
1304
|
}
|
|
929
|
-
export const applyInlineStyle = profile(function applyInlineStyle(view, styleStr) {
|
|
1305
|
+
export const applyInlineStyle = profile('applyInlineStyle', function applyInlineStyle(view, styleStr) {
|
|
930
1306
|
const localStyle = `local { ${styleStr} }`;
|
|
931
1307
|
const inlineRuleSet = CSSSource.fromSource(localStyle).selectors;
|
|
932
1308
|
const oldInlineRuleSet = view['oldInlineStyle'] ? CSSSource.fromSource(`local { ${view['oldInlineStyle']} }`).selectors : null;
|
|
@@ -950,12 +1326,28 @@ export const applyInlineStyle = profile(function applyInlineStyle(view, styleStr
|
|
|
950
1326
|
}
|
|
951
1327
|
}
|
|
952
1328
|
}
|
|
1329
|
+
// Pending-substitution longhands share one placeholder - resolve it once.
|
|
1330
|
+
let resolvedShorthands;
|
|
953
1331
|
for (let index = declarations.length - 1; index >= 0; index--) {
|
|
954
1332
|
const d = declarations[index];
|
|
955
1333
|
// Use the actual property name so that a local value is set.
|
|
956
1334
|
const property = d.property;
|
|
957
1335
|
try {
|
|
958
|
-
|
|
1336
|
+
let value;
|
|
1337
|
+
if (_isCssPendingSubstitution(d.value)) {
|
|
1338
|
+
if (!resolvedShorthands) {
|
|
1339
|
+
resolvedShorthands = new Map();
|
|
1340
|
+
}
|
|
1341
|
+
let resolved = resolvedShorthands.get(d.value);
|
|
1342
|
+
if (!resolved) {
|
|
1343
|
+
resolved = resolvePendingSubstitution(view, d.value);
|
|
1344
|
+
resolvedShorthands.set(d.value, resolved);
|
|
1345
|
+
}
|
|
1346
|
+
value = property in resolved ? resolved[property] : unsetValue;
|
|
1347
|
+
}
|
|
1348
|
+
else {
|
|
1349
|
+
value = evaluateCssExpressions(view, property, d.value);
|
|
1350
|
+
}
|
|
959
1351
|
if (property in view.style) {
|
|
960
1352
|
view.style[property] = value;
|
|
961
1353
|
}
|