@nativescript/core 8.9.0-napi-es5.0 → 8.9.0-napi.1
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 +16 -23
- package/abortcontroller/abortsignal.js.map +1 -1
- package/abortcontroller/index.js +14 -20
- package/abortcontroller/index.js.map +1 -1
- package/accessibility/accessibility-common.js +8 -8
- package/accessibility/accessibility-common.js.map +1 -1
- package/accessibility/accessibility-css-helper.js +27 -27
- package/accessibility/accessibility-css-helper.js.map +1 -1
- package/accessibility/accessibility-properties.js +22 -23
- package/accessibility/accessibility-properties.js.map +1 -1
- package/accessibility/accessibility-service-common.js +12 -22
- package/accessibility/accessibility-service-common.js.map +1 -1
- package/accessibility/accessibility-service.android.js +27 -39
- package/accessibility/accessibility-service.android.js.map +1 -1
- package/accessibility/accessibility-service.ios.js +14 -17
- package/accessibility/accessibility-service.ios.js.map +1 -1
- package/accessibility/font-scale-common.js +2 -2
- package/accessibility/font-scale-common.js.map +1 -1
- package/accessibility/font-scale.android.js +7 -8
- package/accessibility/font-scale.android.js.map +1 -1
- package/accessibility/font-scale.ios.js +9 -10
- package/accessibility/font-scale.ios.js.map +1 -1
- package/accessibility/index.android.js +77 -83
- package/accessibility/index.android.js.map +1 -1
- package/accessibility/index.ios.js +34 -36
- package/accessibility/index.ios.js.map +1 -1
- package/animation-frame/animation-native.ios.js +1 -1
- package/animation-frame/animation-native.ios.js.map +1 -1
- package/animation-frame/index.js +16 -16
- package/animation-frame/index.js.map +1 -1
- package/application/application-common.js +196 -214
- package/application/application-common.js.map +1 -1
- package/application/application-shims.js +39 -39
- package/application/application-shims.js.map +1 -1
- package/application/application.android.js +110 -149
- package/application/application.android.js.map +1 -1
- package/application/application.ios.js +162 -197
- package/application/application.ios.js.map +1 -1
- package/application-settings/index.android.js +11 -11
- package/application-settings/index.android.js.map +1 -1
- package/application-settings/index.ios.js +1 -1
- package/application-settings/index.ios.js.map +1 -1
- package/bundle-entry-points.js +1 -1
- package/bundle-entry-points.js.map +1 -1
- package/color/color-common.js +157 -200
- package/color/color-common.js.map +1 -1
- package/color/index.android.js +4 -14
- package/color/index.android.js.map +1 -1
- package/color/index.ios.js +14 -24
- package/color/index.ios.js.map +1 -1
- package/color/known-colors.js +144 -144
- package/color/known-colors.js.map +1 -1
- package/connectivity/index.android.js +23 -23
- package/connectivity/index.android.js.map +1 -1
- package/connectivity/index.ios.js +25 -25
- package/connectivity/index.ios.js.map +1 -1
- package/console/index.js +20 -24
- package/console/index.js.map +1 -1
- package/core-types/index.js +38 -38
- package/core-types/index.js.map +1 -1
- package/css/CSS3Parser.js +104 -106
- package/css/CSS3Parser.js.map +1 -1
- package/css/CSSNativeScript.js +29 -34
- package/css/CSSNativeScript.js.map +1 -1
- package/css/css-tree-parser.js.map +1 -1
- package/css/parser.js +158 -178
- package/css/parser.js.map +1 -1
- package/css/system-classes.js +9 -9
- package/css/system-classes.js.map +1 -1
- package/css-mediaquery/index.js +27 -29
- package/css-mediaquery/index.js.map +1 -1
- package/data/observable/index.js +115 -124
- package/data/observable/index.js.map +1 -1
- package/data/observable-array/index.js +119 -176
- package/data/observable-array/index.js.map +1 -1
- package/data/virtual-array/index.js +61 -74
- package/data/virtual-array/index.js.map +1 -1
- package/debugger/InspectorBackendCommands.js +137 -161
- package/debugger/InspectorBackendCommands.js.map +1 -1
- package/debugger/devtools-elements.common.js +20 -20
- package/debugger/devtools-elements.common.js.map +1 -1
- package/debugger/devtools-elements.js +2 -2
- package/debugger/devtools-elements.js.map +1 -1
- package/debugger/dom-node.js +61 -73
- package/debugger/dom-node.js.map +1 -1
- package/debugger/index.js +19 -19
- package/debugger/index.js.map +1 -1
- package/debugger/webinspector-css.js +25 -30
- package/debugger/webinspector-css.js.map +1 -1
- package/debugger/webinspector-dom.js +38 -43
- package/debugger/webinspector-dom.js.map +1 -1
- package/debugger/webinspector-network.android.js +103 -132
- package/debugger/webinspector-network.android.js.map +1 -1
- package/debugger/webinspector-network.ios.js +100 -128
- package/debugger/webinspector-network.ios.js.map +1 -1
- package/file-system/file-system-access.android.js +414 -421
- package/file-system/file-system-access.android.js.map +1 -1
- package/file-system/file-system-access.ios.js +203 -213
- package/file-system/file-system-access.ios.js.map +1 -1
- package/file-system/index.js +294 -372
- package/file-system/index.js.map +1 -1
- package/fps-meter/fps-native.android.js +15 -18
- package/fps-meter/fps-native.android.js.map +1 -1
- package/fps-meter/fps-native.ios.js +9 -11
- package/fps-meter/fps-native.ios.js.map +1 -1
- package/fps-meter/index.js +11 -11
- package/fps-meter/index.js.map +1 -1
- package/globals/index.js +88 -112
- package/globals/index.js.map +1 -1
- package/http/http-request/http-request-common.js +5 -5
- package/http/http-request/http-request-common.js.map +1 -1
- package/http/http-request/index.android.js +53 -54
- package/http/http-request/index.android.js.map +1 -1
- package/http/http-request/index.ios.js +56 -58
- package/http/http-request/index.ios.js.map +1 -1
- package/http/index.js +19 -19
- package/http/index.js.map +1 -1
- package/image-asset/image-asset-common.js +25 -37
- package/image-asset/image-asset-common.js.map +1 -1
- package/image-asset/index.android.js +17 -25
- package/image-asset/index.android.js.map +1 -1
- package/image-asset/index.ios.js +25 -35
- package/image-asset/index.ios.js.map +1 -1
- package/image-source/image-source-common.js +2 -2
- package/image-source/image-source-common.js.map +1 -1
- package/image-source/index.android.js +152 -178
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.ios.js +177 -203
- package/image-source/index.ios.js.map +1 -1
- package/index.js +4 -8
- package/index.js.map +1 -1
- package/matrix/index.js +17 -27
- package/matrix/index.js.map +1 -1
- package/media-query-list/index.js +61 -87
- package/media-query-list/index.js.map +1 -1
- package/module-name-resolver/index.js +21 -24
- package/module-name-resolver/index.js.map +1 -1
- package/module-name-resolver/non-bundle-workflow-compat.js +24 -24
- package/module-name-resolver/non-bundle-workflow-compat.js.map +1 -1
- package/module-name-resolver/qualifier-matcher/index.js +46 -46
- package/module-name-resolver/qualifier-matcher/index.js.map +1 -1
- package/package.json +1 -1
- package/platform/common.js +5 -5
- package/platform/common.js.map +1 -1
- package/platform/device/index.android.js +68 -107
- package/platform/device/index.android.js.map +1 -1
- package/platform/device/index.ios.js +62 -101
- package/platform/device/index.ios.js.map +1 -1
- package/platform/screen/index.android.js +32 -63
- package/platform/screen/index.android.js.map +1 -1
- package/platform/screen/index.ios.js +29 -60
- package/platform/screen/index.ios.js.map +1 -1
- package/profiling/index.js +40 -47
- package/profiling/index.js.map +1 -1
- package/text/text-common.js +36 -49
- package/text/text-common.js.map +1 -1
- package/timer/index.android.js +20 -30
- package/timer/index.android.js.map +1 -1
- package/timer/index.ios.js +12 -22
- package/timer/index.ios.js.map +1 -1
- package/trace/index.js +26 -36
- package/trace/index.js.map +1 -1
- package/ui/action-bar/action-bar-common.js +193 -252
- package/ui/action-bar/action-bar-common.js.map +1 -1
- package/ui/action-bar/index.android.js +170 -212
- package/ui/action-bar/index.android.js.map +1 -1
- package/ui/action-bar/index.ios.js +208 -251
- package/ui/action-bar/index.ios.js.map +1 -1
- package/ui/activity-indicator/activity-indicator-common.js +6 -11
- package/ui/activity-indicator/activity-indicator-common.js.map +1 -1
- package/ui/activity-indicator/index.android.js +20 -26
- package/ui/activity-indicator/index.android.js.map +1 -1
- package/ui/activity-indicator/index.ios.js +23 -31
- package/ui/activity-indicator/index.ios.js.map +1 -1
- package/ui/animation/animation-common.js +43 -50
- package/ui/animation/animation-common.js.map +1 -1
- package/ui/animation/animation-interfaces.js +3 -5
- package/ui/animation/animation-interfaces.js.map +1 -1
- package/ui/animation/index.android.js +90 -94
- package/ui/animation/index.android.js.map +1 -1
- package/ui/animation/index.ios.js +225 -191
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/animation/keyframe-animation.js +67 -89
- package/ui/animation/keyframe-animation.js.map +1 -1
- package/ui/builder/binding-builder.js +31 -31
- package/ui/builder/binding-builder.js.map +1 -1
- package/ui/builder/component-builder/index.js +37 -37
- package/ui/builder/component-builder/index.js.map +1 -1
- package/ui/builder/index.js +54 -59
- package/ui/builder/index.js.map +1 -1
- package/ui/builder/xml2ui.js +128 -158
- package/ui/builder/xml2ui.js.map +1 -1
- package/ui/button/button-common.js +18 -25
- package/ui/button/button-common.js.map +1 -1
- package/ui/button/index.android.js +69 -80
- package/ui/button/index.android.js.map +1 -1
- package/ui/button/index.ios.js +103 -114
- package/ui/button/index.ios.js.map +1 -1
- package/ui/content-view/index.js +60 -78
- package/ui/content-view/index.js.map +1 -1
- package/ui/core/bindable/bindable-expressions.js +93 -101
- package/ui/core/bindable/bindable-expressions.js.map +1 -1
- package/ui/core/bindable/bindable-resources.js +1 -1
- package/ui/core/bindable/index.js +136 -141
- package/ui/core/bindable/index.js.map +1 -1
- package/ui/core/control-state-change/index.android.js +5 -7
- package/ui/core/control-state-change/index.android.js.map +1 -1
- package/ui/core/control-state-change/index.ios.js +9 -13
- package/ui/core/control-state-change/index.ios.js.map +1 -1
- package/ui/core/properties/index.js +440 -489
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/view/index.android.js +348 -384
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.ios.js +364 -400
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.js +655 -944
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.android.js +15 -19
- package/ui/core/view/view-helper/index.android.js.map +1 -1
- package/ui/core/view/view-helper/index.ios.js +81 -85
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-common.js +44 -49
- package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
- package/ui/core/view-base/index.js +371 -426
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/core/weak-event-listener/index.js +25 -26
- package/ui/core/weak-event-listener/index.js.map +1 -1
- package/ui/date-picker/date-picker-common.js +30 -35
- package/ui/date-picker/date-picker-common.js.map +1 -1
- package/ui/date-picker/index.android.js +43 -51
- package/ui/date-picker/index.android.js.map +1 -1
- package/ui/date-picker/index.ios.js +51 -61
- package/ui/date-picker/index.ios.js.map +1 -1
- package/ui/dialogs/dialogs-common.js +18 -18
- package/ui/dialogs/dialogs-common.js.map +1 -1
- package/ui/dialogs/index.android.js +86 -98
- package/ui/dialogs/index.android.js.map +1 -1
- package/ui/dialogs/index.ios.js +67 -80
- package/ui/dialogs/index.ios.js.map +1 -1
- package/ui/editable-text-base/editable-text-base-common.js +29 -35
- package/ui/editable-text-base/editable-text-base-common.js.map +1 -1
- package/ui/editable-text-base/index.android.js +106 -112
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/editable-text-base/index.ios.js +47 -53
- package/ui/editable-text-base/index.ios.js.map +1 -1
- package/ui/embedding/index.android.js +2 -3
- package/ui/embedding/index.android.js.map +1 -1
- package/ui/frame/activity.android.js +44 -44
- package/ui/frame/activity.android.js.map +1 -1
- package/ui/frame/callbacks/activity-callbacks.js +118 -123
- package/ui/frame/callbacks/activity-callbacks.js.map +1 -1
- package/ui/frame/callbacks/fragment-callbacks.js +139 -141
- package/ui/frame/callbacks/fragment-callbacks.js.map +1 -1
- package/ui/frame/fragment.android.js +21 -21
- package/ui/frame/fragment.android.js.map +1 -1
- package/ui/frame/fragment.ios.js +1 -1
- package/ui/frame/fragment.transitions.android.js +105 -114
- package/ui/frame/fragment.transitions.android.js.map +1 -1
- package/ui/frame/frame-common.d.ts +1 -1
- package/ui/frame/frame-common.js +249 -285
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/frame-helpers.js +1 -1
- package/ui/frame/frame-helpers.js.map +1 -1
- package/ui/frame/frame-stack.js +4 -4
- package/ui/frame/frame-stack.js.map +1 -1
- package/ui/frame/index.android.js +239 -291
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.ios.js +133 -167
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/gestures/gestures-common.js +15 -29
- package/ui/gestures/gestures-common.js.map +1 -1
- package/ui/gestures/index.android.js +108 -124
- package/ui/gestures/index.android.js.map +1 -1
- package/ui/gestures/index.ios.js +108 -121
- package/ui/gestures/index.ios.js.map +1 -1
- package/ui/gestures/touch-manager.js +42 -48
- package/ui/gestures/touch-manager.js.map +1 -1
- package/ui/html-view/html-view-common.js +9 -14
- package/ui/html-view/html-view-common.js.map +1 -1
- package/ui/html-view/index.android.js +37 -43
- package/ui/html-view/index.android.js.map +1 -1
- package/ui/html-view/index.ios.js +62 -73
- package/ui/html-view/index.ios.js.map +1 -1
- package/ui/image/image-common.js +47 -57
- package/ui/image/image-common.js.map +1 -1
- package/ui/image/index.android.js +54 -59
- package/ui/image/index.android.js.map +1 -1
- package/ui/image/index.ios.js +65 -72
- package/ui/image/index.ios.js.map +1 -1
- package/ui/image/symbol-effects-common.js +2 -6
- package/ui/image/symbol-effects-common.js.map +1 -1
- package/ui/image/symbol-effects.android.js +4 -10
- package/ui/image/symbol-effects.android.js.map +1 -1
- package/ui/image/symbol-effects.ios.js +7 -11
- package/ui/image/symbol-effects.ios.js.map +1 -1
- package/ui/image-cache/image-cache-common.js +57 -61
- package/ui/image-cache/image-cache-common.js.map +1 -1
- package/ui/image-cache/index.android.js +23 -27
- package/ui/image-cache/index.android.js.map +1 -1
- package/ui/image-cache/index.ios.js +24 -29
- package/ui/image-cache/index.ios.js.map +1 -1
- package/ui/label/index.android.js +29 -38
- package/ui/label/index.android.js.map +1 -1
- package/ui/label/index.ios.js +89 -102
- package/ui/label/index.ios.js.map +1 -1
- package/ui/layouts/absolute-layout/absolute-layout-common.js +25 -30
- package/ui/layouts/absolute-layout/absolute-layout-common.js.map +1 -1
- package/ui/layouts/absolute-layout/index.android.js +6 -12
- package/ui/layouts/absolute-layout/index.android.js.map +1 -1
- package/ui/layouts/absolute-layout/index.ios.js +32 -40
- package/ui/layouts/absolute-layout/index.ios.js.map +1 -1
- package/ui/layouts/dock-layout/dock-layout-common.js +16 -21
- package/ui/layouts/dock-layout/dock-layout-common.js.map +1 -1
- package/ui/layouts/dock-layout/index.android.js +11 -17
- package/ui/layouts/dock-layout/index.android.js.map +1 -1
- package/ui/layouts/dock-layout/index.ios.js +45 -53
- package/ui/layouts/dock-layout/index.ios.js.map +1 -1
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js +90 -115
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.android.js +92 -97
- package/ui/layouts/flexbox-layout/index.android.js.map +1 -1
- package/ui/layouts/flexbox-layout/index.ios.js +366 -427
- package/ui/layouts/flexbox-layout/index.ios.js.map +1 -1
- package/ui/layouts/grid-layout/grid-layout-common.js +159 -211
- package/ui/layouts/grid-layout/grid-layout-common.js.map +1 -1
- package/ui/layouts/grid-layout/index.android.js +49 -55
- package/ui/layouts/grid-layout/index.android.js.map +1 -1
- package/ui/layouts/grid-layout/index.ios.js +340 -348
- package/ui/layouts/grid-layout/index.ios.js.map +1 -1
- package/ui/layouts/layout-base-common.js +78 -106
- package/ui/layouts/layout-base-common.js.map +1 -1
- package/ui/layouts/layout-base.android.js +25 -31
- package/ui/layouts/layout-base.android.js.map +1 -1
- package/ui/layouts/layout-base.ios.js +21 -27
- package/ui/layouts/layout-base.ios.js.map +1 -1
- package/ui/layouts/root-layout/index.android.js +47 -46
- package/ui/layouts/root-layout/index.android.js.map +1 -1
- package/ui/layouts/root-layout/index.ios.js +54 -53
- package/ui/layouts/root-layout/index.ios.js.map +1 -1
- package/ui/layouts/root-layout/root-layout-common.js +186 -190
- package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
- package/ui/layouts/stack-layout/index.android.js +6 -12
- package/ui/layouts/stack-layout/index.android.js.map +1 -1
- package/ui/layouts/stack-layout/index.ios.js +62 -69
- package/ui/layouts/stack-layout/index.ios.js.map +1 -1
- package/ui/layouts/stack-layout/stack-layout-common.js +7 -12
- package/ui/layouts/stack-layout/stack-layout-common.js.map +1 -1
- package/ui/layouts/wrap-layout/index.android.js +10 -16
- package/ui/layouts/wrap-layout/index.android.js.map +1 -1
- package/ui/layouts/wrap-layout/index.ios.js +70 -76
- package/ui/layouts/wrap-layout/index.ios.js.map +1 -1
- package/ui/layouts/wrap-layout/wrap-layout-common.js +13 -18
- package/ui/layouts/wrap-layout/wrap-layout-common.js.map +1 -1
- package/ui/list-picker/index.android.js +42 -48
- package/ui/list-picker/index.android.js.map +1 -1
- package/ui/list-picker/index.ios.js +26 -36
- package/ui/list-picker/index.ios.js.map +1 -1
- package/ui/list-picker/list-picker-common.js +27 -32
- package/ui/list-picker/list-picker-common.js.map +1 -1
- package/ui/list-view/index.android.js +98 -110
- package/ui/list-view/index.android.js.map +1 -1
- package/ui/list-view/index.ios.js +121 -137
- package/ui/list-view/index.ios.js.map +1 -1
- package/ui/list-view/list-view-common.js +100 -116
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/index.android.js +57 -65
- package/ui/page/index.android.js.map +1 -1
- package/ui/page/index.ios.js +98 -107
- package/ui/page/index.ios.js.map +1 -1
- package/ui/page/page-common.js +113 -145
- package/ui/page/page-common.js.map +1 -1
- package/ui/placeholder/index.android.js +10 -16
- package/ui/placeholder/index.android.js.map +1 -1
- package/ui/placeholder/index.js +6 -12
- package/ui/placeholder/index.js.map +1 -1
- package/ui/progress/index.android.js +28 -34
- package/ui/progress/index.android.js.map +1 -1
- package/ui/progress/index.ios.js +29 -39
- package/ui/progress/index.ios.js.map +1 -1
- package/ui/progress/progress-common.js +11 -16
- package/ui/progress/progress-common.js.map +1 -1
- package/ui/proxy-view-container/index.js +90 -111
- package/ui/proxy-view-container/index.js.map +1 -1
- package/ui/repeater/index.js +100 -112
- package/ui/repeater/index.js.map +1 -1
- package/ui/scroll-view/index.android.d.ts +1 -1
- package/ui/scroll-view/index.android.js +75 -95
- package/ui/scroll-view/index.android.js.map +1 -1
- package/ui/scroll-view/index.ios.js +72 -92
- package/ui/scroll-view/index.ios.js.map +1 -1
- package/ui/scroll-view/scroll-view-common.js +45 -65
- package/ui/scroll-view/scroll-view-common.js.map +1 -1
- package/ui/search-bar/index.android.js +88 -94
- package/ui/search-bar/index.android.js.map +1 -1
- package/ui/search-bar/index.ios.js +74 -88
- package/ui/search-bar/index.ios.js.map +1 -1
- package/ui/search-bar/search-bar-common.js +13 -18
- package/ui/search-bar/search-bar-common.js.map +1 -1
- package/ui/segmented-bar/index.android.js +98 -112
- package/ui/segmented-bar/index.android.js.map +1 -1
- package/ui/segmented-bar/index.ios.js +63 -80
- package/ui/segmented-bar/index.ios.js.map +1 -1
- package/ui/segmented-bar/segmented-bar-common.js +61 -81
- package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
- package/ui/slider/index.android.js +43 -49
- package/ui/slider/index.android.js.map +1 -1
- package/ui/slider/index.ios.js +49 -59
- package/ui/slider/index.ios.js.map +1 -1
- package/ui/slider/slider-common.js +28 -35
- package/ui/slider/slider-common.js.map +1 -1
- package/ui/styling/background-common.js +98 -100
- package/ui/styling/background-common.js.map +1 -1
- package/ui/styling/background.android.js +35 -38
- package/ui/styling/background.android.js.map +1 -1
- package/ui/styling/background.ios.js +252 -258
- package/ui/styling/background.ios.js.map +1 -1
- package/ui/styling/box-shadow.js +2 -6
- package/ui/styling/box-shadow.js.map +1 -1
- package/ui/styling/converters.js +7 -7
- package/ui/styling/converters.js.map +1 -1
- package/ui/styling/css-animation-parser.js +56 -69
- package/ui/styling/css-animation-parser.js.map +1 -1
- package/ui/styling/css-selector.js +425 -522
- package/ui/styling/css-selector.js.map +1 -1
- package/ui/styling/css-shadow.js +2 -2
- package/ui/styling/css-shadow.js.map +1 -1
- package/ui/styling/css-stroke.js +3 -3
- package/ui/styling/css-stroke.js.map +1 -1
- package/ui/styling/css-utils.js +22 -22
- package/ui/styling/css-utils.js.map +1 -1
- package/ui/styling/font-common.js +44 -59
- package/ui/styling/font-common.js.map +1 -1
- package/ui/styling/font.android.js +34 -42
- package/ui/styling/font.android.js.map +1 -1
- package/ui/styling/font.ios.js +49 -54
- package/ui/styling/font.ios.js.map +1 -1
- package/ui/styling/linear-gradient.js +13 -17
- package/ui/styling/linear-gradient.js.map +1 -1
- package/ui/styling/style/index.js +36 -47
- package/ui/styling/style/index.js.map +1 -1
- package/ui/styling/style-properties.js +291 -306
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.js +377 -416
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/switch/index.android.js +41 -47
- package/ui/switch/index.android.js.map +1 -1
- package/ui/switch/index.ios.js +57 -66
- package/ui/switch/index.ios.js.map +1 -1
- package/ui/switch/switch-common.js +11 -16
- package/ui/switch/switch-common.js.map +1 -1
- package/ui/tab-view/index.android.js +187 -206
- package/ui/tab-view/index.android.js.map +1 -1
- package/ui/tab-view/index.ios.js +161 -177
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/tab-view-common.js +143 -197
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/formatted-string.js +105 -158
- package/ui/text-base/formatted-string.js.map +1 -1
- package/ui/text-base/index.android.js +130 -136
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.ios.js +112 -120
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/span.js +102 -158
- package/ui/text-base/span.js.map +1 -1
- package/ui/text-base/text-base-common.js +181 -268
- package/ui/text-base/text-base-common.js.map +1 -1
- package/ui/text-field/index.android.js +18 -24
- package/ui/text-field/index.android.js.map +1 -1
- package/ui/text-field/index.ios.js +70 -80
- package/ui/text-field/index.ios.js.map +1 -1
- package/ui/text-field/text-field-common.js +8 -13
- package/ui/text-field/text-field-common.js.map +1 -1
- package/ui/text-view/index.android.js +13 -19
- package/ui/text-view/index.android.js.map +1 -1
- package/ui/text-view/index.ios.js +116 -124
- package/ui/text-view/index.ios.js.map +1 -1
- package/ui/text-view/text-view-common.js +3 -9
- package/ui/text-view/text-view-common.js.map +1 -1
- package/ui/time-picker/index.android.js +18 -24
- package/ui/time-picker/index.android.js.map +1 -1
- package/ui/time-picker/index.ios.js +61 -69
- package/ui/time-picker/index.ios.js.map +1 -1
- package/ui/time-picker/time-picker-common.js +37 -42
- package/ui/time-picker/time-picker-common.js.map +1 -1
- package/ui/transition/fade-transition.android.js +8 -14
- package/ui/transition/fade-transition.android.js.map +1 -1
- package/ui/transition/fade-transition.ios.js +4 -10
- package/ui/transition/fade-transition.ios.js.map +1 -1
- package/ui/transition/flip-transition.android.js +14 -18
- package/ui/transition/flip-transition.android.js.map +1 -1
- package/ui/transition/index.android.js +24 -27
- package/ui/transition/index.android.js.map +1 -1
- package/ui/transition/index.ios.js +18 -22
- package/ui/transition/index.ios.js.map +1 -1
- package/ui/transition/modal-transition.android.js +4 -10
- package/ui/transition/modal-transition.android.js.map +1 -1
- package/ui/transition/modal-transition.ios.js +18 -25
- package/ui/transition/modal-transition.ios.js.map +1 -1
- package/ui/transition/page-transition.android.js +57 -71
- package/ui/transition/page-transition.android.js.map +1 -1
- package/ui/transition/page-transition.ios.js +19 -27
- package/ui/transition/page-transition.ios.js.map +1 -1
- package/ui/transition/shared-transition-helper.android.js +8 -12
- package/ui/transition/shared-transition-helper.android.js.map +1 -1
- package/ui/transition/shared-transition-helper.ios.js +442 -539
- package/ui/transition/shared-transition-helper.ios.js.map +1 -1
- package/ui/transition/shared-transition.js +77 -76
- package/ui/transition/shared-transition.js.map +1 -1
- package/ui/transition/slide-transition.android.js +17 -22
- package/ui/transition/slide-transition.android.js.map +1 -1
- package/ui/transition/slide-transition.ios.js +7 -11
- package/ui/transition/slide-transition.ios.js.map +1 -1
- package/ui/utils.ios.js +13 -13
- package/ui/utils.ios.js.map +1 -1
- package/ui/web-view/index.android.js +50 -64
- package/ui/web-view/index.android.js.map +1 -1
- package/ui/web-view/index.ios.js +50 -73
- package/ui/web-view/index.ios.js.map +1 -1
- package/ui/web-view/web-view-common.js +29 -43
- package/ui/web-view/web-view-common.js.map +1 -1
- package/utils/android/index.js +26 -27
- package/utils/android/index.js.map +1 -1
- package/utils/common.js +49 -65
- package/utils/common.js.map +1 -1
- package/utils/constants.android.js +1 -1
- package/utils/constants.android.js.map +1 -1
- package/utils/constants.ios.js +1 -1
- package/utils/constants.ios.js.map +1 -1
- package/utils/debug.js +32 -54
- package/utils/debug.js.map +1 -1
- package/utils/index.android.js +40 -36
- package/utils/index.android.js.map +1 -1
- package/utils/index.ios.js +9 -9
- package/utils/index.ios.js.map +1 -1
- package/utils/ios/index.js +45 -42
- package/utils/ios/index.js.map +1 -1
- package/utils/layout-helper/index.android.js +4 -4
- package/utils/layout-helper/index.android.js.map +1 -1
- package/utils/layout-helper/index.ios.js +2 -2
- package/utils/layout-helper/index.ios.js.map +1 -1
- package/utils/layout-helper/layout-helper-common.js +13 -13
- package/utils/layout-helper/layout-helper-common.js.map +1 -1
- package/utils/lazy.js +2 -2
- package/utils/lazy.js.map +1 -1
- package/utils/macrotask-scheduler.js +6 -6
- package/utils/macrotask-scheduler.js.map +1 -1
- package/utils/mainthread-helper.android.js +4 -4
- package/utils/mainthread-helper.android.js.map +1 -1
- package/utils/mainthread-helper.ios.js +1 -1
- package/utils/mainthread-helper.ios.js.map +1 -1
- package/utils/module-merge.js +1 -1
- package/utils/module-merge.js.map +1 -1
- package/utils/native-helper.android.js +19 -19
- package/utils/native-helper.android.js.map +1 -1
- package/utils/native-helper.ios.js +16 -23
- package/utils/native-helper.ios.js.map +1 -1
- package/utils/number-utils.js +3 -3
- package/utils/number-utils.js.map +1 -1
- package/utils/platform-check.js +6 -6
- package/utils/platform-check.js.map +1 -1
- package/utils/types.js +33 -43
- package/utils/types.js.map +1 -1
- package/wgc/crypto/SubtleCrypto.js +132 -167
- package/wgc/crypto/SubtleCrypto.js.map +1 -1
- package/wgc/crypto/index.d.ts +1 -1
- package/wgc/crypto/index.js +10 -18
- package/wgc/crypto/index.js.map +1 -1
- package/xhr/index.js +226 -308
- package/xhr/index.js.map +1 -1
- package/xml/index.js +78 -118
- package/xml/index.js.map +1 -1
|
@@ -4,7 +4,7 @@ import { Trace } from '../../trace';
|
|
|
4
4
|
import { File, knownFolders, path } from '../../file-system';
|
|
5
5
|
import { Application } from '../../application';
|
|
6
6
|
import { profile } from '../../profiling';
|
|
7
|
-
|
|
7
|
+
let keyframeAnimationModule;
|
|
8
8
|
function ensureKeyframeAnimationModule() {
|
|
9
9
|
if (!keyframeAnimationModule) {
|
|
10
10
|
keyframeAnimationModule = require('../animation/keyframe-animation');
|
|
@@ -13,15 +13,15 @@ function ensureKeyframeAnimationModule() {
|
|
|
13
13
|
import { sanitizeModuleName } from '../../utils/common';
|
|
14
14
|
import { resolveModuleName } from '../../module-name-resolver';
|
|
15
15
|
import { cleanupImportantFlags } from './css-utils';
|
|
16
|
-
|
|
16
|
+
let cssAnimationParserModule;
|
|
17
17
|
function ensureCssAnimationParserModule() {
|
|
18
18
|
if (!cssAnimationParserModule) {
|
|
19
19
|
cssAnimationParserModule = require('./css-animation-parser');
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
let parser = 'css-tree';
|
|
23
23
|
try {
|
|
24
|
-
|
|
24
|
+
const appConfig = require('~/package.json');
|
|
25
25
|
if (appConfig) {
|
|
26
26
|
if (appConfig.cssParser === 'rework') {
|
|
27
27
|
parser = 'rework';
|
|
@@ -34,23 +34,23 @@ try {
|
|
|
34
34
|
catch (e) {
|
|
35
35
|
//
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
let mergedApplicationCssSelectors = [];
|
|
38
|
+
let applicationCssSelectors = [];
|
|
39
|
+
const applicationAdditionalSelectors = [];
|
|
40
|
+
let mergedApplicationCssKeyframes = [];
|
|
41
|
+
let applicationCssKeyframes = [];
|
|
42
|
+
const applicationAdditionalKeyframes = [];
|
|
43
|
+
let applicationCssSelectorVersion = 0;
|
|
44
|
+
const tagToScopeTag = new Map();
|
|
45
|
+
let currentScopeTag = null;
|
|
46
|
+
const animationsSymbol = Symbol('animations');
|
|
47
|
+
const kebabCasePattern = /-([a-z])/g;
|
|
48
|
+
const pattern = /('|")(.*?)\1/;
|
|
49
49
|
/**
|
|
50
50
|
* Evaluate css-variable and css-calc expressions
|
|
51
51
|
*/
|
|
52
52
|
function evaluateCssExpressions(view, property, value) {
|
|
53
|
-
|
|
53
|
+
const newValue = _evaluateCssVariableExpression(view, property, value);
|
|
54
54
|
if (newValue === 'unset') {
|
|
55
55
|
return unsetValue;
|
|
56
56
|
}
|
|
@@ -59,21 +59,21 @@ function evaluateCssExpressions(view, property, value) {
|
|
|
59
59
|
value = _evaluateCssCalcExpression(value);
|
|
60
60
|
}
|
|
61
61
|
catch (e) {
|
|
62
|
-
Trace.write(
|
|
62
|
+
Trace.write(`Failed to evaluate css-calc for property [${property}] for expression [${value}] to ${view}. ${e.stack}`, Trace.categories.Error, Trace.messageType.error);
|
|
63
63
|
return unsetValue;
|
|
64
64
|
}
|
|
65
65
|
return value;
|
|
66
66
|
}
|
|
67
67
|
export function mergeCssSelectors() {
|
|
68
68
|
mergedApplicationCssSelectors = applicationCssSelectors.slice();
|
|
69
|
-
mergedApplicationCssSelectors.push
|
|
69
|
+
mergedApplicationCssSelectors.push(...applicationAdditionalSelectors);
|
|
70
70
|
}
|
|
71
71
|
export function mergeCssKeyframes() {
|
|
72
72
|
mergedApplicationCssKeyframes = applicationCssKeyframes.slice();
|
|
73
|
-
mergedApplicationCssKeyframes.push
|
|
73
|
+
mergedApplicationCssKeyframes.push(...applicationAdditionalKeyframes);
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
class CSSSource {
|
|
76
|
+
constructor(_ast, _url, _file, _source) {
|
|
77
77
|
this._ast = _ast;
|
|
78
78
|
this._url = _url;
|
|
79
79
|
this._file = _file;
|
|
@@ -82,7 +82,7 @@ var CSSSource = /** @class */ (function () {
|
|
|
82
82
|
this._keyframes = [];
|
|
83
83
|
this.parse();
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
static fromDetect(cssOrAst, fileName) {
|
|
86
86
|
if (typeof cssOrAst === 'string') {
|
|
87
87
|
// raw-loader
|
|
88
88
|
return CSSSource.fromSource(cssOrAst, fileName);
|
|
@@ -98,90 +98,78 @@ var CSSSource = /** @class */ (function () {
|
|
|
98
98
|
}
|
|
99
99
|
// css2json-loader
|
|
100
100
|
return CSSSource.fromSource(cssOrAst.toString(), fileName);
|
|
101
|
-
}
|
|
102
|
-
|
|
101
|
+
}
|
|
102
|
+
static fromURI(uri) {
|
|
103
103
|
// webpack modules require all file paths to be relative to /app folder
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
const appRelativeUri = CSSSource.pathRelativeToApp(uri);
|
|
105
|
+
const sanitizedModuleName = sanitizeModuleName(appRelativeUri);
|
|
106
|
+
const resolvedModuleName = resolveModuleName(sanitizedModuleName, 'css');
|
|
107
107
|
try {
|
|
108
|
-
|
|
108
|
+
const cssOrAst = global.loadModule(resolvedModuleName, true);
|
|
109
109
|
if (cssOrAst) {
|
|
110
110
|
return CSSSource.fromDetect(cssOrAst, resolvedModuleName);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
catch (e) {
|
|
114
114
|
if (Trace.isEnabled()) {
|
|
115
|
-
Trace.write(
|
|
115
|
+
Trace.write(`Could not load CSS from ${uri}: ${e}`, Trace.categories.Error, Trace.messageType.warn);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
return CSSSource.fromFile(appRelativeUri);
|
|
119
|
-
}
|
|
120
|
-
|
|
119
|
+
}
|
|
120
|
+
static pathRelativeToApp(uri) {
|
|
121
121
|
if (!uri.startsWith('/')) {
|
|
122
122
|
return uri;
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
const appPath = knownFolders.currentApp().path;
|
|
125
125
|
if (!uri.startsWith(appPath)) {
|
|
126
|
-
Trace.write(
|
|
126
|
+
Trace.write(`${uri} does not start with ${appPath}`, Trace.categories.Error, Trace.messageType.error);
|
|
127
127
|
return uri;
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
const relativeUri = `.${uri.substring(appPath.length)}`;
|
|
130
130
|
return relativeUri;
|
|
131
|
-
}
|
|
132
|
-
|
|
131
|
+
}
|
|
132
|
+
static fromFile(url) {
|
|
133
133
|
// .scss, .sass, etc. css files in vanilla app are usually compiled to .css so we will try to load a compiled file first.
|
|
134
|
-
|
|
134
|
+
const cssFileUrl = url.replace(/\..\w+$/, '.css');
|
|
135
135
|
if (cssFileUrl !== url) {
|
|
136
|
-
|
|
136
|
+
const cssFile = CSSSource.resolveCSSPathFromURL(cssFileUrl);
|
|
137
137
|
if (cssFile) {
|
|
138
138
|
return new CSSSource(undefined, url, cssFile, undefined);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
const file = CSSSource.resolveCSSPathFromURL(url);
|
|
142
142
|
return new CSSSource(undefined, url, file, undefined);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
}
|
|
144
|
+
static fromFileImport(url, importSource) {
|
|
145
|
+
const file = CSSSource.resolveCSSPathFromURL(url, importSource);
|
|
146
146
|
return new CSSSource(undefined, url, file, undefined);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
}
|
|
148
|
+
static resolveCSSPathFromURL(url, importSource) {
|
|
149
|
+
const app = knownFolders.currentApp().path;
|
|
150
|
+
const file = resolveFileNameFromUrl(url, app, File.exists, importSource);
|
|
151
151
|
return file;
|
|
152
|
-
}
|
|
153
|
-
|
|
152
|
+
}
|
|
153
|
+
static fromSource(source, url) {
|
|
154
154
|
return new CSSSource(undefined, url, undefined, source);
|
|
155
|
-
}
|
|
156
|
-
|
|
155
|
+
}
|
|
156
|
+
static fromAST(ast, url) {
|
|
157
157
|
return new CSSSource(ast, url, undefined, undefined);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
enumerable: false,
|
|
171
|
-
configurable: true
|
|
172
|
-
});
|
|
173
|
-
Object.defineProperty(CSSSource.prototype, "source", {
|
|
174
|
-
get: function () {
|
|
175
|
-
return this._source;
|
|
176
|
-
},
|
|
177
|
-
enumerable: false,
|
|
178
|
-
configurable: true
|
|
179
|
-
});
|
|
180
|
-
CSSSource.prototype.load = function () {
|
|
181
|
-
var file = File.fromPath(this._file);
|
|
158
|
+
}
|
|
159
|
+
get selectors() {
|
|
160
|
+
return this._selectors;
|
|
161
|
+
}
|
|
162
|
+
get keyframes() {
|
|
163
|
+
return this._keyframes;
|
|
164
|
+
}
|
|
165
|
+
get source() {
|
|
166
|
+
return this._source;
|
|
167
|
+
}
|
|
168
|
+
load() {
|
|
169
|
+
const file = File.fromPath(this._file);
|
|
182
170
|
this._source = file.readTextSync();
|
|
183
|
-
}
|
|
184
|
-
|
|
171
|
+
}
|
|
172
|
+
parse() {
|
|
185
173
|
try {
|
|
186
174
|
if (!this._ast) {
|
|
187
175
|
if (!this._source && this._file) {
|
|
@@ -205,119 +193,110 @@ var CSSSource = /** @class */ (function () {
|
|
|
205
193
|
}
|
|
206
194
|
this._selectors = [];
|
|
207
195
|
}
|
|
208
|
-
}
|
|
209
|
-
|
|
196
|
+
}
|
|
197
|
+
parseCSSAst() {
|
|
210
198
|
if (this._source) {
|
|
211
199
|
if (__CSS_PARSER__ === 'css-tree') {
|
|
212
|
-
|
|
200
|
+
const cssTreeParse = require('../../css/css-tree-parser').cssTreeParse;
|
|
213
201
|
this._ast = cssTreeParse(this._source, this._file);
|
|
214
202
|
}
|
|
215
203
|
else if (__CSS_PARSER__ === 'nativescript') {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
204
|
+
const CSS3Parser = require('../../css/CSS3Parser').CSS3Parser;
|
|
205
|
+
const CSSNativeScript = require('../../css/CSSNativeScript').CSSNativeScript;
|
|
206
|
+
const cssparser = new CSS3Parser(this._source);
|
|
207
|
+
const stylesheet = cssparser.parseAStylesheet();
|
|
208
|
+
const cssNS = new CSSNativeScript();
|
|
221
209
|
this._ast = cssNS.parseStylesheet(stylesheet);
|
|
222
210
|
}
|
|
223
211
|
else if (__CSS_PARSER__ === 'rework') {
|
|
224
|
-
|
|
212
|
+
const parseCss = require('../../css').parse;
|
|
225
213
|
this._ast = parseCss(this._source, { source: this._file });
|
|
226
214
|
}
|
|
227
215
|
}
|
|
228
|
-
}
|
|
229
|
-
|
|
216
|
+
}
|
|
217
|
+
createSelectorsAndKeyframes() {
|
|
230
218
|
if (this._ast) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
219
|
+
const nodes = this._ast.stylesheet.rules;
|
|
220
|
+
const rulesets = [];
|
|
221
|
+
const keyframes = [];
|
|
234
222
|
// When css2json-loader is enabled, imports are handled there and removed from AST rules
|
|
235
223
|
populateRulesFromImports(nodes, rulesets, keyframes);
|
|
236
224
|
_populateRules(nodes, rulesets, keyframes);
|
|
237
225
|
if (rulesets && rulesets.length) {
|
|
238
226
|
ensureCssAnimationParserModule();
|
|
239
|
-
rulesets.forEach(
|
|
227
|
+
rulesets.forEach((rule) => {
|
|
240
228
|
rule[animationsSymbol] = cssAnimationParserModule.CssAnimationParser.keyframeAnimationsFromCSSDeclarations(rule.declarations);
|
|
241
229
|
});
|
|
242
230
|
}
|
|
243
231
|
this._selectors = rulesets;
|
|
244
232
|
this._keyframes = keyframes;
|
|
245
233
|
}
|
|
246
|
-
}
|
|
247
|
-
|
|
234
|
+
}
|
|
235
|
+
toString() {
|
|
248
236
|
return this._file || this._url || '(in-memory)';
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}());
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
__decorate([
|
|
240
|
+
profile,
|
|
241
|
+
__metadata("design:type", Function),
|
|
242
|
+
__metadata("design:paramtypes", []),
|
|
243
|
+
__metadata("design:returntype", void 0)
|
|
244
|
+
], CSSSource.prototype, "load", null);
|
|
245
|
+
__decorate([
|
|
246
|
+
profile,
|
|
247
|
+
__metadata("design:type", Function),
|
|
248
|
+
__metadata("design:paramtypes", []),
|
|
249
|
+
__metadata("design:returntype", void 0)
|
|
250
|
+
], CSSSource.prototype, "parse", null);
|
|
251
|
+
__decorate([
|
|
252
|
+
profile,
|
|
253
|
+
__metadata("design:type", Function),
|
|
254
|
+
__metadata("design:paramtypes", []),
|
|
255
|
+
__metadata("design:returntype", void 0)
|
|
256
|
+
], CSSSource.prototype, "parseCSSAst", null);
|
|
257
|
+
__decorate([
|
|
258
|
+
profile,
|
|
259
|
+
__metadata("design:type", Function),
|
|
260
|
+
__metadata("design:paramtypes", []),
|
|
261
|
+
__metadata("design:returntype", void 0)
|
|
262
|
+
], CSSSource.prototype, "createSelectorsAndKeyframes", null);
|
|
263
|
+
__decorate([
|
|
264
|
+
profile,
|
|
265
|
+
__metadata("design:type", Function),
|
|
266
|
+
__metadata("design:paramtypes", [String, String]),
|
|
267
|
+
__metadata("design:returntype", String)
|
|
268
|
+
], CSSSource, "resolveCSSPathFromURL", null);
|
|
282
269
|
function populateRulesFromImports(nodes, rulesets, keyframes) {
|
|
283
|
-
|
|
270
|
+
const imports = nodes.filter((r) => r.type === 'import');
|
|
284
271
|
if (!imports.length) {
|
|
285
272
|
return;
|
|
286
273
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
274
|
+
const urlFromImportObject = (importObject) => {
|
|
275
|
+
const importItem = importObject['import'];
|
|
276
|
+
const urlMatch = importItem && importItem.match(pattern);
|
|
290
277
|
return urlMatch && urlMatch[2];
|
|
291
278
|
};
|
|
292
|
-
|
|
293
|
-
|
|
279
|
+
const sourceFromImportObject = (importObject) => importObject['position'] && importObject['position']['source'];
|
|
280
|
+
const toUrlSourcePair = (importObject) => ({
|
|
294
281
|
url: urlFromImportObject(importObject),
|
|
295
282
|
source: sourceFromImportObject(importObject),
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return (source ? CSSSource.fromFileImport(url, source) : CSSSource.fromURI(url));
|
|
300
|
-
};
|
|
301
|
-
var cssFiles = imports
|
|
283
|
+
});
|
|
284
|
+
const getCssFile = ({ url, source }) => (source ? CSSSource.fromFileImport(url, source) : CSSSource.fromURI(url));
|
|
285
|
+
const cssFiles = imports
|
|
302
286
|
.map(toUrlSourcePair)
|
|
303
|
-
.filter(
|
|
304
|
-
var url = _a.url;
|
|
305
|
-
return !!url;
|
|
306
|
-
})
|
|
287
|
+
.filter(({ url }) => !!url)
|
|
307
288
|
.map(getCssFile);
|
|
308
|
-
for (
|
|
309
|
-
var cssFile = cssFiles_1[_i];
|
|
289
|
+
for (const cssFile of cssFiles) {
|
|
310
290
|
if (cssFile) {
|
|
311
|
-
rulesets.push
|
|
312
|
-
keyframes.push
|
|
291
|
+
rulesets.push(...cssFile.selectors);
|
|
292
|
+
keyframes.push(...cssFile.keyframes);
|
|
313
293
|
}
|
|
314
294
|
}
|
|
315
295
|
}
|
|
316
296
|
export function _populateRules(nodes, rulesets, keyframes, mediaQueryString) {
|
|
317
|
-
for (
|
|
318
|
-
var node = nodes_1[_i];
|
|
297
|
+
for (const node of nodes) {
|
|
319
298
|
if (isKeyframe(node)) {
|
|
320
|
-
|
|
299
|
+
const keyframeRule = {
|
|
321
300
|
name: node.name,
|
|
322
301
|
keyframes: node.keyframes,
|
|
323
302
|
mediaQueryString: mediaQueryString,
|
|
@@ -326,28 +305,28 @@ export function _populateRules(nodes, rulesets, keyframes, mediaQueryString) {
|
|
|
326
305
|
}
|
|
327
306
|
else if (isMedia(node)) {
|
|
328
307
|
// Media query is composite in the case of nested media queries
|
|
329
|
-
|
|
308
|
+
const compositeMediaQuery = mediaQueryString ? mediaQueryString + MEDIA_QUERY_SEPARATOR + node.media : node.media;
|
|
330
309
|
_populateRules(node.rules, rulesets, keyframes, compositeMediaQuery);
|
|
331
310
|
}
|
|
332
311
|
else if (isRule(node)) {
|
|
333
|
-
|
|
312
|
+
const ruleset = fromAstNode(node);
|
|
334
313
|
ruleset.mediaQueryString = mediaQueryString;
|
|
335
314
|
rulesets.push(ruleset);
|
|
336
315
|
}
|
|
337
316
|
}
|
|
338
317
|
}
|
|
339
318
|
export function removeTaggedAdditionalCSS(tag) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
for (
|
|
319
|
+
let selectorsChanged = false;
|
|
320
|
+
let keyframesChanged = false;
|
|
321
|
+
let updated = false;
|
|
322
|
+
for (let i = 0; i < applicationAdditionalSelectors.length; i++) {
|
|
344
323
|
if (applicationAdditionalSelectors[i].tag === tag) {
|
|
345
324
|
applicationAdditionalSelectors.splice(i, 1);
|
|
346
325
|
i--;
|
|
347
326
|
selectorsChanged = true;
|
|
348
327
|
}
|
|
349
328
|
}
|
|
350
|
-
for (
|
|
329
|
+
for (let i = 0; i < applicationAdditionalKeyframes.length; i++) {
|
|
351
330
|
if (applicationAdditionalKeyframes[i].tag === tag) {
|
|
352
331
|
applicationAdditionalKeyframes.splice(i, 1);
|
|
353
332
|
i--;
|
|
@@ -368,35 +347,35 @@ export function removeTaggedAdditionalCSS(tag) {
|
|
|
368
347
|
return updated;
|
|
369
348
|
}
|
|
370
349
|
export function addTaggedAdditionalCSS(cssText, tag) {
|
|
371
|
-
|
|
372
|
-
|
|
350
|
+
const { selectors, keyframes } = CSSSource.fromDetect(cssText, undefined);
|
|
351
|
+
const tagScope = currentScopeTag || (tag && tagToScopeTag.has(tag) && tagToScopeTag.get(tag)) || null;
|
|
373
352
|
if (tagScope && tag) {
|
|
374
353
|
tagToScopeTag.set(tag, tagScope);
|
|
375
354
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
355
|
+
let selectorsChanged = false;
|
|
356
|
+
let keyframesChanged = false;
|
|
357
|
+
let updated = false;
|
|
379
358
|
if (selectors && selectors.length) {
|
|
380
359
|
selectorsChanged = true;
|
|
381
360
|
if (tag != null || tagScope != null) {
|
|
382
|
-
for (
|
|
361
|
+
for (let i = 0, length = selectors.length; i < length; i++) {
|
|
383
362
|
selectors[i].tag = tag;
|
|
384
363
|
selectors[i].scopedTag = tagScope;
|
|
385
364
|
}
|
|
386
365
|
}
|
|
387
|
-
applicationAdditionalSelectors.push
|
|
366
|
+
applicationAdditionalSelectors.push(...selectors);
|
|
388
367
|
mergeCssSelectors();
|
|
389
368
|
updated = true;
|
|
390
369
|
}
|
|
391
370
|
if (keyframes && keyframes.length) {
|
|
392
371
|
keyframesChanged = true;
|
|
393
372
|
if (tag != null || tagScope != null) {
|
|
394
|
-
for (
|
|
373
|
+
for (let i = 0, length = keyframes.length; i < length; i++) {
|
|
395
374
|
keyframes[i].tag = tag;
|
|
396
375
|
keyframes[i].scopedTag = tagScope;
|
|
397
376
|
}
|
|
398
377
|
}
|
|
399
|
-
applicationAdditionalKeyframes.push
|
|
378
|
+
applicationAdditionalKeyframes.push(...keyframes);
|
|
400
379
|
mergeCssKeyframes();
|
|
401
380
|
updated = true;
|
|
402
381
|
}
|
|
@@ -405,17 +384,17 @@ export function addTaggedAdditionalCSS(cssText, tag) {
|
|
|
405
384
|
}
|
|
406
385
|
return updated;
|
|
407
386
|
}
|
|
408
|
-
|
|
387
|
+
const onCssChanged = profile('"style-scope".onCssChanged', (args) => {
|
|
409
388
|
if (args.cssText) {
|
|
410
|
-
|
|
411
|
-
|
|
389
|
+
const { selectors, keyframes } = CSSSource.fromSource(args.cssText, args.cssFile);
|
|
390
|
+
let updated = false;
|
|
412
391
|
if (selectors) {
|
|
413
|
-
applicationAdditionalSelectors.push
|
|
392
|
+
applicationAdditionalSelectors.push(...selectors);
|
|
414
393
|
mergeCssSelectors();
|
|
415
394
|
updated = true;
|
|
416
395
|
}
|
|
417
396
|
if (keyframes) {
|
|
418
|
-
applicationAdditionalKeyframes.push
|
|
397
|
+
applicationAdditionalKeyframes.push(...keyframes);
|
|
419
398
|
mergeCssKeyframes();
|
|
420
399
|
updated = true;
|
|
421
400
|
}
|
|
@@ -430,7 +409,7 @@ var onCssChanged = profile('"style-scope".onCssChanged', function (args) {
|
|
|
430
409
|
function onLiveSync(args) {
|
|
431
410
|
loadCss(Application.getCssFileName(), null, null);
|
|
432
411
|
}
|
|
433
|
-
|
|
412
|
+
const loadCss = profile(`"style-scope".loadCss`, (cssModule) => {
|
|
434
413
|
if (!cssModule) {
|
|
435
414
|
return;
|
|
436
415
|
}
|
|
@@ -438,8 +417,8 @@ var loadCss = profile("\"style-scope\".loadCss", function (cssModule) {
|
|
|
438
417
|
if (cssModule.startsWith('./')) {
|
|
439
418
|
cssModule = cssModule.substring(2);
|
|
440
419
|
}
|
|
441
|
-
|
|
442
|
-
|
|
420
|
+
const { selectors, keyframes } = CSSSource.fromURI(cssModule);
|
|
421
|
+
let updated = false;
|
|
443
422
|
// Check for existing application css selectors too in case the app is undergoing a live-sync
|
|
444
423
|
if (selectors.length > 0 || applicationCssSelectors.length > 0) {
|
|
445
424
|
applicationCssSelectors = selectors;
|
|
@@ -463,7 +442,7 @@ global.NativeScriptGlobals.events.on('livesync', onLiveSync);
|
|
|
463
442
|
// - with-snapshot - code injected in snapshot bundle by [NativeScriptSnapshotPlugin](https://github.com/NativeScript/nativescript-dev-webpack/blob/48b26f412fd70c19dc0b9c7763e08e9505a0ae11/plugins/NativeScriptSnapshotPlugin/index.js#L48-L56)
|
|
464
443
|
// Having the app.css loaded in snapshot provides significant boost in startup (when using the ns-theme ~150 ms). However, because app.css is resolved at build-time,
|
|
465
444
|
// when the snapshot is created - there is no way to use file qualifiers or change the name of on app.css
|
|
466
|
-
export
|
|
445
|
+
export const loadAppCSS = profile('"style-scope".loadAppCSS', (args) => {
|
|
467
446
|
loadCss(args.cssFile, null, null);
|
|
468
447
|
global.NativeScriptGlobals.events.off('loadAppCss', loadAppCSS);
|
|
469
448
|
});
|
|
@@ -477,19 +456,18 @@ if (Application.hasLaunched()) {
|
|
|
477
456
|
else {
|
|
478
457
|
global.NativeScriptGlobals.events.on('loadAppCss', loadAppCSS);
|
|
479
458
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
var _this = this;
|
|
459
|
+
export class CssState {
|
|
460
|
+
constructor(viewRef) {
|
|
483
461
|
this.viewRef = viewRef;
|
|
484
462
|
this._appliedPropertyValues = CssState.emptyPropertyBag;
|
|
485
|
-
this._onDynamicStateChangeHandler =
|
|
463
|
+
this._onDynamicStateChangeHandler = () => this.updateDynamicState();
|
|
486
464
|
}
|
|
487
465
|
/**
|
|
488
466
|
* Called when a change had occurred that may invalidate the statically matching selectors (class, id, ancestor selectors).
|
|
489
467
|
* As a result, at some point in time, the selectors matched have to be requerried from the style scope and applied to the view.
|
|
490
468
|
*/
|
|
491
|
-
|
|
492
|
-
|
|
469
|
+
onChange() {
|
|
470
|
+
const view = this.viewRef.get();
|
|
493
471
|
if (view && view.isLoaded) {
|
|
494
472
|
this.unsubscribeFromDynamicUpdates();
|
|
495
473
|
this.updateMatch();
|
|
@@ -499,68 +477,64 @@ var CssState = /** @class */ (function () {
|
|
|
499
477
|
else {
|
|
500
478
|
this._matchInvalid = true;
|
|
501
479
|
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
|
|
480
|
+
}
|
|
481
|
+
isSelectorsLatestVersionApplied() {
|
|
482
|
+
const view = this.viewRef.get();
|
|
505
483
|
if (!view) {
|
|
506
|
-
Trace.write(
|
|
484
|
+
Trace.write(`isSelectorsLatestVersionApplied returns default value "false" because "this.viewRef" cleared.`, Trace.categories.Style, Trace.messageType.warn);
|
|
507
485
|
return false;
|
|
508
486
|
}
|
|
509
487
|
return this.viewRef.get()._styleScope.getSelectorsVersion() === this._appliedSelectorsVersion;
|
|
510
|
-
}
|
|
511
|
-
|
|
488
|
+
}
|
|
489
|
+
onLoaded() {
|
|
512
490
|
if (this._matchInvalid) {
|
|
513
491
|
this.updateMatch();
|
|
514
492
|
}
|
|
515
493
|
this.subscribeForDynamicUpdates();
|
|
516
494
|
this.updateDynamicState();
|
|
517
|
-
}
|
|
518
|
-
|
|
495
|
+
}
|
|
496
|
+
onUnloaded() {
|
|
519
497
|
this.unsubscribeFromDynamicUpdates();
|
|
520
498
|
this.stopKeyframeAnimations();
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
var view = this.viewRef.get();
|
|
499
|
+
}
|
|
500
|
+
updateMatch() {
|
|
501
|
+
const view = this.viewRef.get();
|
|
525
502
|
if (view && view._styleScope) {
|
|
526
|
-
this._match =
|
|
503
|
+
this._match = view._styleScope.matchSelectors(view) ?? CssState.emptyMatch;
|
|
527
504
|
this._appliedSelectorsVersion = view._styleScope.getSelectorsVersion();
|
|
528
505
|
}
|
|
529
506
|
else {
|
|
530
507
|
this._match = CssState.emptyMatch;
|
|
531
508
|
}
|
|
532
509
|
this._matchInvalid = false;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
var view = this.viewRef.get();
|
|
510
|
+
}
|
|
511
|
+
updateDynamicState() {
|
|
512
|
+
const view = this.viewRef.get();
|
|
537
513
|
if (!view) {
|
|
538
|
-
Trace.write(
|
|
514
|
+
Trace.write(`updateDynamicState not executed to view because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
539
515
|
return;
|
|
540
516
|
}
|
|
541
|
-
|
|
517
|
+
const matchingSelectors = this._match.selectors.filter((sel) => (sel.dynamic ? sel.match(view) : true));
|
|
542
518
|
// Ideally we should return here if there are no matching selectors, however
|
|
543
519
|
// if there are property removals, returning here would not remove them
|
|
544
520
|
// this is seen in STYLE test in automated.
|
|
545
521
|
// if (!matchingSelectors || matchingSelectors.length === 0) {
|
|
546
522
|
// return;
|
|
547
523
|
// }
|
|
548
|
-
view._batchUpdate(
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
524
|
+
view._batchUpdate(() => {
|
|
525
|
+
this.stopKeyframeAnimations();
|
|
526
|
+
this.setPropertyValues(matchingSelectors);
|
|
527
|
+
this.playKeyframeAnimations(matchingSelectors);
|
|
552
528
|
});
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
matchingSelectors.forEach(
|
|
557
|
-
|
|
558
|
-
var ruleAnimations = (_a = selector.ruleset) === null || _a === void 0 ? void 0 : _a[animationsSymbol];
|
|
529
|
+
}
|
|
530
|
+
playKeyframeAnimations(matchingSelectors) {
|
|
531
|
+
const animations = [];
|
|
532
|
+
matchingSelectors.forEach((selector) => {
|
|
533
|
+
const ruleAnimations = selector.ruleset?.[animationsSymbol];
|
|
559
534
|
if (ruleAnimations) {
|
|
560
535
|
ensureKeyframeAnimationModule();
|
|
561
|
-
for (
|
|
562
|
-
|
|
563
|
-
var animation = keyframeAnimationModule.KeyframeAnimation.keyframeAnimationFromInfo(animationInfo);
|
|
536
|
+
for (const animationInfo of ruleAnimations) {
|
|
537
|
+
const animation = keyframeAnimationModule.KeyframeAnimation.keyframeAnimationFromInfo(animationInfo);
|
|
564
538
|
if (animation) {
|
|
565
539
|
animations.push(animation);
|
|
566
540
|
}
|
|
@@ -568,23 +542,23 @@ var CssState = /** @class */ (function () {
|
|
|
568
542
|
}
|
|
569
543
|
});
|
|
570
544
|
if ((this._playsKeyframeAnimations = animations.length > 0)) {
|
|
571
|
-
|
|
572
|
-
if (!
|
|
573
|
-
Trace.write(
|
|
545
|
+
const view = this.viewRef.get();
|
|
546
|
+
if (!view) {
|
|
547
|
+
Trace.write(`KeyframeAnimations cannot play because ".viewRef" is cleared`, Trace.categories.Animation, Trace.messageType.warn);
|
|
574
548
|
return;
|
|
575
549
|
}
|
|
576
|
-
animations.map(
|
|
550
|
+
animations.map((animation) => animation.play(view));
|
|
577
551
|
Object.freeze(animations);
|
|
578
552
|
this._appliedAnimations = animations;
|
|
579
553
|
}
|
|
580
|
-
}
|
|
581
|
-
|
|
554
|
+
}
|
|
555
|
+
stopKeyframeAnimations() {
|
|
582
556
|
if (!this._playsKeyframeAnimations) {
|
|
583
557
|
return;
|
|
584
558
|
}
|
|
585
|
-
this._appliedAnimations.filter(
|
|
559
|
+
this._appliedAnimations.filter((animation) => animation.isPlaying).forEach((animation) => animation.cancel());
|
|
586
560
|
this._appliedAnimations = CssState.emptyAnimationArray;
|
|
587
|
-
|
|
561
|
+
const view = this.viewRef.get();
|
|
588
562
|
if (view) {
|
|
589
563
|
view.style['keyframe:rotate'] = unsetValue;
|
|
590
564
|
view.style['keyframe:rotateX'] = unsetValue;
|
|
@@ -597,33 +571,33 @@ var CssState = /** @class */ (function () {
|
|
|
597
571
|
view.style['keyframe:opacity'] = unsetValue;
|
|
598
572
|
}
|
|
599
573
|
else {
|
|
600
|
-
Trace.write(
|
|
574
|
+
Trace.write(`KeyframeAnimations cannot be stopped because ".viewRef" is cleared`, Trace.categories.Animation, Trace.messageType.warn);
|
|
601
575
|
}
|
|
602
576
|
this._playsKeyframeAnimations = false;
|
|
603
|
-
}
|
|
577
|
+
}
|
|
604
578
|
/**
|
|
605
579
|
* Calculate the difference between the previously applied property values,
|
|
606
580
|
* and the new set of property values that have to be applied for the provided selectors.
|
|
607
581
|
* Apply the values and ensure each property setter is called at most once to avoid excessive change notifications.
|
|
608
582
|
* @param matchingSelectors
|
|
609
583
|
*/
|
|
610
|
-
|
|
611
|
-
|
|
584
|
+
setPropertyValues(matchingSelectors) {
|
|
585
|
+
const view = this.viewRef.get();
|
|
612
586
|
if (!view) {
|
|
613
|
-
Trace.write(
|
|
587
|
+
Trace.write(`${matchingSelectors} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
614
588
|
return;
|
|
615
589
|
}
|
|
616
|
-
|
|
617
|
-
matchingSelectors.forEach(
|
|
618
|
-
|
|
590
|
+
const newPropertyValues = new view.style.PropertyBag();
|
|
591
|
+
matchingSelectors.forEach((selector) => selector.ruleset.declarations.forEach((declaration) => (newPropertyValues[declaration.property] = declaration.value)));
|
|
592
|
+
const oldProperties = this._appliedPropertyValues;
|
|
619
593
|
// Update values for the scope's css-variables
|
|
620
594
|
view.style.resetScopedCssVariables();
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
for (
|
|
625
|
-
|
|
626
|
-
|
|
595
|
+
const valuesToApply = {};
|
|
596
|
+
const cssExpsProperties = {};
|
|
597
|
+
const replacementFunc = (g) => g[1].toUpperCase();
|
|
598
|
+
for (const property in newPropertyValues) {
|
|
599
|
+
const value = cleanupImportantFlags(newPropertyValues[property], property);
|
|
600
|
+
const isCssExp = isCssVariableExpression(value) || isCssCalcExpression(value);
|
|
627
601
|
if (isCssExp) {
|
|
628
602
|
// we handle css exp separately because css vars must be evaluated first
|
|
629
603
|
cssExpsProperties[property] = value;
|
|
@@ -642,9 +616,9 @@ var CssState = /** @class */ (function () {
|
|
|
642
616
|
valuesToApply[property] = value;
|
|
643
617
|
}
|
|
644
618
|
//we need to parse CSS vars first before evaluating css expressions
|
|
645
|
-
for (
|
|
619
|
+
for (const property in cssExpsProperties) {
|
|
646
620
|
delete oldProperties[property];
|
|
647
|
-
|
|
621
|
+
const value = evaluateCssExpressions(view, property, cssExpsProperties[property]);
|
|
648
622
|
if (property in oldProperties && oldProperties[property] === value) {
|
|
649
623
|
// Skip unchanged values
|
|
650
624
|
continue;
|
|
@@ -659,46 +633,45 @@ var CssState = /** @class */ (function () {
|
|
|
659
633
|
valuesToApply[property] = value;
|
|
660
634
|
}
|
|
661
635
|
// Unset removed values
|
|
662
|
-
for (
|
|
636
|
+
for (const property in oldProperties) {
|
|
663
637
|
if (property in view.style) {
|
|
664
|
-
view.style[
|
|
638
|
+
view.style[`css:${property}`] = unsetValue;
|
|
665
639
|
}
|
|
666
640
|
else {
|
|
667
|
-
|
|
641
|
+
const camelCasedProperty = property.replace(kebabCasePattern, replacementFunc);
|
|
668
642
|
view[camelCasedProperty] = unsetValue;
|
|
669
643
|
}
|
|
670
644
|
}
|
|
671
645
|
// Set new values to the style
|
|
672
|
-
for (
|
|
673
|
-
|
|
646
|
+
for (const property in valuesToApply) {
|
|
647
|
+
const value = valuesToApply[property];
|
|
674
648
|
try {
|
|
675
649
|
if (property in view.style) {
|
|
676
|
-
view.style[
|
|
650
|
+
view.style[`css:${property}`] = value;
|
|
677
651
|
}
|
|
678
652
|
else {
|
|
679
|
-
|
|
653
|
+
const camelCasedProperty = property.replace(kebabCasePattern, replacementFunc);
|
|
680
654
|
view[camelCasedProperty] = value;
|
|
681
655
|
}
|
|
682
656
|
}
|
|
683
657
|
catch (e) {
|
|
684
|
-
Trace.write(
|
|
658
|
+
Trace.write(`Failed to apply property [${property}] with value [${value}] to ${view}. ${e.stack}`, Trace.categories.Error, Trace.messageType.error);
|
|
685
659
|
}
|
|
686
660
|
}
|
|
687
661
|
this._appliedPropertyValues = newPropertyValues;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
changeMap.forEach(function (changes, view) {
|
|
662
|
+
}
|
|
663
|
+
subscribeForDynamicUpdates() {
|
|
664
|
+
const changeMap = this._match.changeMap;
|
|
665
|
+
changeMap.forEach((changes, view) => {
|
|
693
666
|
if (changes.attributes) {
|
|
694
|
-
changes.attributes.forEach(
|
|
695
|
-
view.addEventListener(attribute + 'Change',
|
|
667
|
+
changes.attributes.forEach((attribute) => {
|
|
668
|
+
view.addEventListener(attribute + 'Change', this._onDynamicStateChangeHandler);
|
|
696
669
|
});
|
|
697
670
|
}
|
|
698
671
|
if (changes.pseudoClasses) {
|
|
699
|
-
changes.pseudoClasses.forEach(
|
|
700
|
-
|
|
701
|
-
view.addEventListener(':' + pseudoClass,
|
|
672
|
+
changes.pseudoClasses.forEach((pseudoClass) => {
|
|
673
|
+
const eventName = ':' + pseudoClass;
|
|
674
|
+
view.addEventListener(':' + pseudoClass, this._onDynamicStateChangeHandler);
|
|
702
675
|
if (view[eventName]) {
|
|
703
676
|
view[eventName](+1);
|
|
704
677
|
}
|
|
@@ -706,19 +679,18 @@ var CssState = /** @class */ (function () {
|
|
|
706
679
|
}
|
|
707
680
|
});
|
|
708
681
|
this._appliedChangeMap = changeMap;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
this._appliedChangeMap.forEach(function (changes, view) {
|
|
682
|
+
}
|
|
683
|
+
unsubscribeFromDynamicUpdates() {
|
|
684
|
+
this._appliedChangeMap.forEach((changes, view) => {
|
|
713
685
|
if (changes.attributes) {
|
|
714
|
-
changes.attributes.forEach(
|
|
715
|
-
view.removeEventListener(attribute + 'Change',
|
|
686
|
+
changes.attributes.forEach((attribute) => {
|
|
687
|
+
view.removeEventListener(attribute + 'Change', this._onDynamicStateChangeHandler);
|
|
716
688
|
});
|
|
717
689
|
}
|
|
718
690
|
if (changes.pseudoClasses) {
|
|
719
|
-
changes.pseudoClasses.forEach(
|
|
720
|
-
|
|
721
|
-
view.removeEventListener(eventName,
|
|
691
|
+
changes.pseudoClasses.forEach((pseudoClass) => {
|
|
692
|
+
const eventName = ':' + pseudoClass;
|
|
693
|
+
view.removeEventListener(eventName, this._onDynamicStateChangeHandler);
|
|
722
694
|
if (view[eventName]) {
|
|
723
695
|
view[eventName](-1);
|
|
724
696
|
}
|
|
@@ -726,45 +698,43 @@ var CssState = /** @class */ (function () {
|
|
|
726
698
|
}
|
|
727
699
|
});
|
|
728
700
|
this._appliedChangeMap = CssState.emptyChangeMap;
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
|
|
701
|
+
}
|
|
702
|
+
toString() {
|
|
703
|
+
const view = this.viewRef.get();
|
|
732
704
|
if (!view) {
|
|
733
|
-
Trace.write(
|
|
705
|
+
Trace.write(`toString() of CssState cannot execute correctly because ".viewRef" is cleared`, Trace.categories.Animation, Trace.messageType.warn);
|
|
734
706
|
return '';
|
|
735
707
|
}
|
|
736
|
-
return
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}());
|
|
762
|
-
export { CssState };
|
|
708
|
+
return `${view}._cssState`;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
CssState.emptyChangeMap = Object.freeze(new Map());
|
|
712
|
+
CssState.emptyPropertyBag = {};
|
|
713
|
+
CssState.emptyAnimationArray = Object.freeze([]);
|
|
714
|
+
CssState.emptyMatch = {
|
|
715
|
+
selectors: [],
|
|
716
|
+
changeMap: new Map(),
|
|
717
|
+
addAttribute: () => { },
|
|
718
|
+
addPseudoClass: () => { },
|
|
719
|
+
properties: null,
|
|
720
|
+
};
|
|
721
|
+
__decorate([
|
|
722
|
+
profile,
|
|
723
|
+
__metadata("design:type", Function),
|
|
724
|
+
__metadata("design:paramtypes", []),
|
|
725
|
+
__metadata("design:returntype", void 0)
|
|
726
|
+
], CssState.prototype, "updateMatch", null);
|
|
727
|
+
__decorate([
|
|
728
|
+
profile,
|
|
729
|
+
__metadata("design:type", Function),
|
|
730
|
+
__metadata("design:paramtypes", []),
|
|
731
|
+
__metadata("design:returntype", void 0)
|
|
732
|
+
], CssState.prototype, "updateDynamicState", null);
|
|
763
733
|
CssState.prototype._appliedChangeMap = CssState.emptyChangeMap;
|
|
764
734
|
CssState.prototype._appliedAnimations = CssState.emptyAnimationArray;
|
|
765
735
|
CssState.prototype._matchInvalid = true;
|
|
766
|
-
|
|
767
|
-
|
|
736
|
+
export class StyleScope {
|
|
737
|
+
constructor() {
|
|
768
738
|
this._css = '';
|
|
769
739
|
this._localCssSelectors = [];
|
|
770
740
|
this._localCssKeyframes = [];
|
|
@@ -773,46 +743,41 @@ var StyleScope = /** @class */ (function () {
|
|
|
773
743
|
this._applicationCssSelectorsAppliedVersion = 0;
|
|
774
744
|
this._cssFiles = [];
|
|
775
745
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
enumerable: false,
|
|
784
|
-
configurable: true
|
|
785
|
-
});
|
|
786
|
-
StyleScope.prototype.addCss = function (cssString, cssFileName) {
|
|
746
|
+
get css() {
|
|
747
|
+
return this._css;
|
|
748
|
+
}
|
|
749
|
+
set css(value) {
|
|
750
|
+
this.setCss(value);
|
|
751
|
+
}
|
|
752
|
+
addCss(cssString, cssFileName) {
|
|
787
753
|
this.appendCss(cssString, cssFileName);
|
|
788
|
-
}
|
|
789
|
-
|
|
754
|
+
}
|
|
755
|
+
addCssFile(cssFileName) {
|
|
790
756
|
this.appendCss(null, cssFileName);
|
|
791
|
-
}
|
|
792
|
-
|
|
757
|
+
}
|
|
758
|
+
changeCssFile(cssFileName) {
|
|
793
759
|
if (!cssFileName) {
|
|
794
760
|
return;
|
|
795
761
|
}
|
|
796
762
|
this._cssFiles.push(cssFileName);
|
|
797
763
|
currentScopeTag = cssFileName;
|
|
798
|
-
|
|
764
|
+
const cssFile = CSSSource.fromURI(cssFileName);
|
|
799
765
|
currentScopeTag = null;
|
|
800
766
|
this._css = cssFile.source;
|
|
801
767
|
this._localCssSelectors = cssFile.selectors;
|
|
802
768
|
this._localCssKeyframes = cssFile.keyframes;
|
|
803
769
|
this._localCssSelectorVersion++;
|
|
804
770
|
this.ensureSelectors();
|
|
805
|
-
}
|
|
806
|
-
|
|
771
|
+
}
|
|
772
|
+
setCss(cssString, cssFileName) {
|
|
807
773
|
this._css = cssString;
|
|
808
|
-
|
|
774
|
+
const cssFile = CSSSource.fromSource(cssString, cssFileName);
|
|
809
775
|
this._localCssSelectors = cssFile.selectors;
|
|
810
776
|
this._localCssKeyframes = cssFile.keyframes;
|
|
811
777
|
this._localCssSelectorVersion++;
|
|
812
778
|
this.ensureSelectors();
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
var _a, _b;
|
|
779
|
+
}
|
|
780
|
+
appendCss(cssString, cssFileName) {
|
|
816
781
|
if (!cssString && !cssFileName) {
|
|
817
782
|
return;
|
|
818
783
|
}
|
|
@@ -820,49 +785,48 @@ var StyleScope = /** @class */ (function () {
|
|
|
820
785
|
this._cssFiles.push(cssFileName);
|
|
821
786
|
currentScopeTag = cssFileName;
|
|
822
787
|
}
|
|
823
|
-
|
|
788
|
+
const cssFile = cssString ? CSSSource.fromSource(cssString, cssFileName) : CSSSource.fromURI(cssFileName);
|
|
824
789
|
currentScopeTag = null;
|
|
825
790
|
this._css = this._css + cssFile.source;
|
|
826
|
-
|
|
827
|
-
|
|
791
|
+
this._localCssSelectors.push(...cssFile.selectors);
|
|
792
|
+
this._localCssKeyframes.push(...cssFile.keyframes);
|
|
828
793
|
this._localCssSelectorVersion++;
|
|
829
794
|
this.ensureSelectors();
|
|
830
|
-
}
|
|
831
|
-
|
|
795
|
+
}
|
|
796
|
+
getKeyframeAnimationWithName(animationName) {
|
|
832
797
|
if (!this._mergedCssKeyframes) {
|
|
833
798
|
return null;
|
|
834
799
|
}
|
|
835
|
-
|
|
800
|
+
const keyframeRule = this.findKeyframeRule(animationName);
|
|
836
801
|
ensureKeyframeAnimationModule();
|
|
837
|
-
|
|
802
|
+
const animation = new keyframeAnimationModule.KeyframeAnimationInfo();
|
|
838
803
|
ensureCssAnimationParserModule();
|
|
839
804
|
animation.keyframes = keyframeRule ? cssAnimationParserModule.CssAnimationParser.keyframesArrayFromCSS(keyframeRule.keyframes) : null;
|
|
840
805
|
return animation;
|
|
841
|
-
}
|
|
842
|
-
|
|
806
|
+
}
|
|
807
|
+
ensureSelectors() {
|
|
843
808
|
if (!this.isApplicationCssSelectorsLatestVersionApplied() || !this.isLocalCssSelectorsLatestVersionApplied() || !this._mergedCssSelectors) {
|
|
844
809
|
this._createSelectors();
|
|
845
810
|
}
|
|
846
811
|
return this.getSelectorsVersion();
|
|
847
|
-
}
|
|
848
|
-
|
|
812
|
+
}
|
|
813
|
+
_increaseApplicationCssSelectorVersion() {
|
|
849
814
|
applicationCssSelectorVersion++;
|
|
850
|
-
}
|
|
851
|
-
|
|
815
|
+
}
|
|
816
|
+
isApplicationCssSelectorsLatestVersionApplied() {
|
|
852
817
|
return this._applicationCssSelectorsAppliedVersion === applicationCssSelectorVersion;
|
|
853
|
-
}
|
|
854
|
-
|
|
818
|
+
}
|
|
819
|
+
isLocalCssSelectorsLatestVersionApplied() {
|
|
855
820
|
return this._localCssSelectorsAppliedVersion === this._localCssSelectorVersion;
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
toMergeKeyframes.push.apply(toMergeKeyframes, mergedApplicationCssKeyframes.filter(function (v) { return !v.scopedTag || _this._cssFiles.indexOf(v.scopedTag) >= 0; }));
|
|
821
|
+
}
|
|
822
|
+
_createSelectors() {
|
|
823
|
+
const toMerge = [];
|
|
824
|
+
const toMergeKeyframes = [];
|
|
825
|
+
toMerge.push(...mergedApplicationCssSelectors.filter((v) => !v.scopedTag || this._cssFiles.indexOf(v.scopedTag) >= 0));
|
|
826
|
+
toMergeKeyframes.push(...mergedApplicationCssKeyframes.filter((v) => !v.scopedTag || this._cssFiles.indexOf(v.scopedTag) >= 0));
|
|
863
827
|
this._applicationCssSelectorsAppliedVersion = applicationCssSelectorVersion;
|
|
864
|
-
toMerge.push
|
|
865
|
-
toMergeKeyframes.push
|
|
828
|
+
toMerge.push(...this._localCssSelectors);
|
|
829
|
+
toMergeKeyframes.push(...this._localCssKeyframes);
|
|
866
830
|
this._localCssSelectorsAppliedVersion = this._localCssSelectorVersion;
|
|
867
831
|
if (toMerge.length > 0) {
|
|
868
832
|
this._mergedCssSelectors = toMerge;
|
|
@@ -873,11 +837,11 @@ var StyleScope = /** @class */ (function () {
|
|
|
873
837
|
this._selectorScope = null;
|
|
874
838
|
}
|
|
875
839
|
this._mergedCssKeyframes = toMergeKeyframes.length > 0 ? toMergeKeyframes : null;
|
|
876
|
-
}
|
|
840
|
+
}
|
|
877
841
|
// HACK: This @profile decorator creates a circular dependency
|
|
878
842
|
// HACK: because the function parameter type is evaluated with 'typeof'
|
|
879
|
-
|
|
880
|
-
|
|
843
|
+
matchSelectors(view) {
|
|
844
|
+
let match;
|
|
881
845
|
// should be (view: ViewBase): SelectorsMatch<ViewBase>
|
|
882
846
|
this.ensureSelectors();
|
|
883
847
|
if (this._selectorScope) {
|
|
@@ -889,46 +853,45 @@ var StyleScope = /** @class */ (function () {
|
|
|
889
853
|
match = null;
|
|
890
854
|
}
|
|
891
855
|
return match;
|
|
892
|
-
}
|
|
893
|
-
|
|
856
|
+
}
|
|
857
|
+
query(node) {
|
|
894
858
|
this.ensureSelectors();
|
|
895
|
-
|
|
859
|
+
const match = this.matchSelectors(node);
|
|
896
860
|
return match ? match.selectors : [];
|
|
897
|
-
}
|
|
898
|
-
|
|
861
|
+
}
|
|
862
|
+
getSelectorsVersion() {
|
|
899
863
|
// The counters can only go up. So we can return just appVersion + localVersion
|
|
900
864
|
// The 100000 * appVersion is just for easier debugging
|
|
901
865
|
return 100000 * this._applicationCssSelectorsAppliedVersion + this._localCssSelectorsAppliedVersion;
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
if (!
|
|
866
|
+
}
|
|
867
|
+
_applyKeyframesToSelectors(selectors) {
|
|
868
|
+
if (!selectors?.length) {
|
|
905
869
|
return;
|
|
906
870
|
}
|
|
907
|
-
for (
|
|
908
|
-
|
|
909
|
-
|
|
871
|
+
for (let i = selectors.length - 1; i >= 0; i--) {
|
|
872
|
+
const ruleset = selectors[i].ruleset;
|
|
873
|
+
const animations = ruleset[animationsSymbol];
|
|
910
874
|
if (animations != null && animations.length) {
|
|
911
875
|
ensureCssAnimationParserModule();
|
|
912
|
-
for (
|
|
913
|
-
|
|
914
|
-
var keyframeRule = this.findKeyframeRule(animation.name);
|
|
876
|
+
for (const animation of animations) {
|
|
877
|
+
const keyframeRule = this.findKeyframeRule(animation.name);
|
|
915
878
|
animation.keyframes = keyframeRule ? cssAnimationParserModule.CssAnimationParser.keyframesArrayFromCSS(keyframeRule.keyframes) : null;
|
|
916
879
|
}
|
|
917
880
|
}
|
|
918
881
|
}
|
|
919
|
-
}
|
|
920
|
-
|
|
882
|
+
}
|
|
883
|
+
getAnimations(ruleset) {
|
|
921
884
|
return ruleset[animationsSymbol];
|
|
922
|
-
}
|
|
923
|
-
|
|
885
|
+
}
|
|
886
|
+
findKeyframeRule(animationName) {
|
|
924
887
|
if (!this._mergedCssKeyframes) {
|
|
925
888
|
return null;
|
|
926
889
|
}
|
|
927
890
|
// Cache media query results to avoid validations of other identical queries
|
|
928
|
-
|
|
891
|
+
let validatedMediaQueries;
|
|
929
892
|
// Iterate in reverse order as the last usable keyframe rule matters the most
|
|
930
|
-
for (
|
|
931
|
-
|
|
893
|
+
for (let i = this._mergedCssKeyframes.length - 1; i >= 0; i--) {
|
|
894
|
+
const rule = this._mergedCssKeyframes[i];
|
|
932
895
|
if (rule.name !== animationName) {
|
|
933
896
|
continue;
|
|
934
897
|
}
|
|
@@ -938,47 +901,45 @@ var StyleScope = /** @class */ (function () {
|
|
|
938
901
|
if (!validatedMediaQueries) {
|
|
939
902
|
validatedMediaQueries = [];
|
|
940
903
|
}
|
|
941
|
-
|
|
904
|
+
const isMatchingAllQueries = matchMediaQueryString(rule.mediaQueryString, validatedMediaQueries);
|
|
942
905
|
if (isMatchingAllQueries) {
|
|
943
906
|
return rule;
|
|
944
907
|
}
|
|
945
908
|
}
|
|
946
909
|
return null;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
}());
|
|
974
|
-
export { StyleScope };
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
__decorate([
|
|
913
|
+
profile,
|
|
914
|
+
__metadata("design:type", Function),
|
|
915
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
916
|
+
__metadata("design:returntype", void 0)
|
|
917
|
+
], StyleScope.prototype, "setCss", null);
|
|
918
|
+
__decorate([
|
|
919
|
+
profile,
|
|
920
|
+
__metadata("design:type", Function),
|
|
921
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
922
|
+
__metadata("design:returntype", void 0)
|
|
923
|
+
], StyleScope.prototype, "appendCss", null);
|
|
924
|
+
__decorate([
|
|
925
|
+
profile,
|
|
926
|
+
__metadata("design:type", Function),
|
|
927
|
+
__metadata("design:paramtypes", []),
|
|
928
|
+
__metadata("design:returntype", void 0)
|
|
929
|
+
], StyleScope.prototype, "_createSelectors", null);
|
|
930
|
+
__decorate([
|
|
931
|
+
profile,
|
|
932
|
+
__metadata("design:type", Function),
|
|
933
|
+
__metadata("design:paramtypes", [Object]),
|
|
934
|
+
__metadata("design:returntype", SelectorsMatch)
|
|
935
|
+
], StyleScope.prototype, "matchSelectors", null);
|
|
975
936
|
export function resolveFileNameFromUrl(url, appDirectory, fileExists, importSource) {
|
|
976
|
-
|
|
937
|
+
let fileName = typeof url === 'string' ? url.trim() : '';
|
|
977
938
|
if (fileName.indexOf('~/') === 0) {
|
|
978
939
|
fileName = fileName.replace('~/', '');
|
|
979
940
|
}
|
|
980
|
-
|
|
981
|
-
|
|
941
|
+
const isAbsolutePath = fileName.indexOf('/') === 0;
|
|
942
|
+
const absolutePath = isAbsolutePath ? fileName : path.join(appDirectory, fileName);
|
|
982
943
|
if (fileExists(absolutePath)) {
|
|
983
944
|
return absolutePath;
|
|
984
945
|
}
|
|
@@ -987,52 +948,52 @@ export function resolveFileNameFromUrl(url, appDirectory, fileExists, importSour
|
|
|
987
948
|
fileName = fileName.substring(1);
|
|
988
949
|
}
|
|
989
950
|
if (importSource) {
|
|
990
|
-
|
|
951
|
+
const importFile = resolveFilePathFromImport(importSource, fileName);
|
|
991
952
|
if (fileExists(importFile)) {
|
|
992
953
|
return importFile;
|
|
993
954
|
}
|
|
994
955
|
}
|
|
995
|
-
|
|
996
|
-
if (fileExists(
|
|
997
|
-
return
|
|
956
|
+
const external = path.join(appDirectory, 'tns_modules', fileName);
|
|
957
|
+
if (fileExists(external)) {
|
|
958
|
+
return external;
|
|
998
959
|
}
|
|
999
960
|
}
|
|
1000
961
|
return null;
|
|
1001
962
|
}
|
|
1002
963
|
function resolveFilePathFromImport(importSource, fileName) {
|
|
1003
|
-
|
|
1004
|
-
|
|
964
|
+
const importSourceParts = importSource.split(path.separator);
|
|
965
|
+
const fileNameParts = fileName
|
|
1005
966
|
.split(path.separator)
|
|
1006
967
|
// exclude the dot-segment for current directory
|
|
1007
|
-
.filter(
|
|
968
|
+
.filter((p) => !isCurrentDirectory(p));
|
|
1008
969
|
// remove current file name
|
|
1009
970
|
importSourceParts.pop();
|
|
1010
971
|
// remove element in case of dot-segment for parent directory or add file name
|
|
1011
|
-
fileNameParts.forEach(
|
|
972
|
+
fileNameParts.forEach((p) => (isParentDirectory(p) ? importSourceParts.pop() : importSourceParts.push(p)));
|
|
1012
973
|
return importSourceParts.join(path.separator);
|
|
1013
974
|
}
|
|
1014
|
-
export
|
|
1015
|
-
|
|
1016
|
-
|
|
975
|
+
export const applyInlineStyle = profile(function applyInlineStyle(view, styleStr) {
|
|
976
|
+
const localStyle = `local { ${styleStr} }`;
|
|
977
|
+
const inlineRuleSet = CSSSource.fromSource(localStyle).selectors;
|
|
1017
978
|
// Reset unscoped css-variables
|
|
1018
979
|
view.style.resetUnscopedCssVariables();
|
|
1019
980
|
// Set all the css-variables first, so we can be sure they are up-to-date
|
|
1020
|
-
inlineRuleSet[0].declarations.forEach(
|
|
981
|
+
inlineRuleSet[0].declarations.forEach((d) => {
|
|
1021
982
|
// Use the actual property name so that a local value is set.
|
|
1022
|
-
|
|
983
|
+
const property = d.property;
|
|
1023
984
|
if (isCssVariable(property)) {
|
|
1024
985
|
view.style.setUnscopedCssVariable(property, d.value);
|
|
1025
986
|
}
|
|
1026
987
|
});
|
|
1027
|
-
inlineRuleSet[0].declarations.forEach(
|
|
988
|
+
inlineRuleSet[0].declarations.forEach((d) => {
|
|
1028
989
|
// Use the actual property name so that a local value is set.
|
|
1029
|
-
|
|
990
|
+
const property = d.property;
|
|
1030
991
|
try {
|
|
1031
992
|
if (isCssVariable(property)) {
|
|
1032
993
|
// Skip css-variables, they have been handled
|
|
1033
994
|
return;
|
|
1034
995
|
}
|
|
1035
|
-
|
|
996
|
+
const value = evaluateCssExpressions(view, property, d.value);
|
|
1036
997
|
if (property in view.style) {
|
|
1037
998
|
view.style[property] = value;
|
|
1038
999
|
}
|
|
@@ -1041,7 +1002,7 @@ export var applyInlineStyle = profile(function applyInlineStyle(view, styleStr)
|
|
|
1041
1002
|
}
|
|
1042
1003
|
}
|
|
1043
1004
|
catch (e) {
|
|
1044
|
-
Trace.write(
|
|
1005
|
+
Trace.write(`Failed to apply property [${d.property}] with value [${d.value}] to ${view}. ${e}`, Trace.categories.Error, Trace.messageType.error);
|
|
1045
1006
|
}
|
|
1046
1007
|
});
|
|
1047
1008
|
// This is needed in case of changes to css-variable or css-calc expressions.
|