@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
|
@@ -5,9 +5,9 @@ import { ios as iosViewUtils } from '../utils';
|
|
|
5
5
|
import { ImageSource } from '../../image-source';
|
|
6
6
|
import { parse as cssParse } from '../../css-value/reworkcss-value.js';
|
|
7
7
|
export * from './background-common';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const clearCGColor = UIColor.clearColor.CGColor;
|
|
9
|
+
const uriPattern = /url\(('|")(.*?)\1\)/;
|
|
10
|
+
const symbolUrl = Symbol('backgroundImageUrl');
|
|
11
11
|
export var CacheMode;
|
|
12
12
|
(function (CacheMode) {
|
|
13
13
|
CacheMode[CacheMode["none"] = 0] = "none";
|
|
@@ -15,9 +15,8 @@ export var CacheMode;
|
|
|
15
15
|
export var ios;
|
|
16
16
|
(function (ios) {
|
|
17
17
|
function createBackgroundUIColor(view, callback, flip) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var nativeView = view.nativeViewProtected;
|
|
18
|
+
const background = view.style.backgroundInternal;
|
|
19
|
+
const nativeView = view.nativeViewProtected;
|
|
21
20
|
if (!nativeView) {
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
@@ -28,24 +27,22 @@ export var ios;
|
|
|
28
27
|
// Borders, shadows, etc
|
|
29
28
|
drawBackgroundVisualEffects(view);
|
|
30
29
|
if (!background.image) {
|
|
31
|
-
callback(
|
|
30
|
+
callback(background?.color?.ios);
|
|
32
31
|
}
|
|
33
32
|
else {
|
|
34
33
|
if (!(background.image instanceof LinearGradient)) {
|
|
35
|
-
createUIImageFromURI(view, background.image, flip,
|
|
36
|
-
|
|
37
|
-
callback(image ? UIColor.alloc().initWithPatternImage(image) : (_a = background === null || background === void 0 ? void 0 : background.color) === null || _a === void 0 ? void 0 : _a.ios);
|
|
34
|
+
createUIImageFromURI(view, background.image, flip, (image) => {
|
|
35
|
+
callback(image ? UIColor.alloc().initWithPatternImage(image) : background?.color?.ios);
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
ios.createBackgroundUIColor = createBackgroundUIColor;
|
|
43
41
|
function drawBackgroundVisualEffects(view) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var needsLayerAdjustmentOnScroll = false;
|
|
42
|
+
const background = view.style.backgroundInternal;
|
|
43
|
+
const nativeView = view.nativeViewProtected;
|
|
44
|
+
const layer = nativeView.layer;
|
|
45
|
+
let needsLayerAdjustmentOnScroll = false;
|
|
49
46
|
// Add new gradient layer or update existing one
|
|
50
47
|
if (background.image instanceof LinearGradient) {
|
|
51
48
|
if (!nativeView.gradientLayer) {
|
|
@@ -58,8 +55,8 @@ export var ios;
|
|
|
58
55
|
// Initialize clipping mask (usually for clip-path and non-uniform rounded borders)
|
|
59
56
|
maskLayerIfNeeded(nativeView, background);
|
|
60
57
|
if (background.hasUniformBorder()) {
|
|
61
|
-
|
|
62
|
-
layer.borderColor =
|
|
58
|
+
const borderColor = background.getUniformBorderColor();
|
|
59
|
+
layer.borderColor = borderColor?.ios?.CGColor;
|
|
63
60
|
layer.borderWidth = layout.toDeviceIndependentPixels(background.getUniformBorderWidth());
|
|
64
61
|
layer.cornerRadius = getUniformBorderRadius(view, layer.bounds);
|
|
65
62
|
}
|
|
@@ -81,14 +78,14 @@ export var ios;
|
|
|
81
78
|
}
|
|
82
79
|
ios.drawBackgroundVisualEffects = drawBackgroundVisualEffects;
|
|
83
80
|
function clearBackgroundVisualEffects(view) {
|
|
84
|
-
|
|
81
|
+
const nativeView = view.nativeViewProtected;
|
|
85
82
|
if (!nativeView) {
|
|
86
83
|
return;
|
|
87
84
|
}
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
const background = view.style.backgroundInternal;
|
|
86
|
+
const hasGradientBackground = background.image && background.image instanceof LinearGradient;
|
|
90
87
|
// Remove mask if there is no clip path or non-uniform border with radius
|
|
91
|
-
|
|
88
|
+
let needsMask;
|
|
92
89
|
switch (nativeView.maskType) {
|
|
93
90
|
case iosViewUtils.LayerMask.BORDER:
|
|
94
91
|
needsMask = !background.hasUniformBorder() && background.hasBorderRadius();
|
|
@@ -127,68 +124,68 @@ export var ios;
|
|
|
127
124
|
}
|
|
128
125
|
ios.clearBackgroundVisualEffects = clearBackgroundVisualEffects;
|
|
129
126
|
function createUIImageFromURI(view, imageURI, flip, callback) {
|
|
130
|
-
|
|
127
|
+
const nativeView = view.nativeViewProtected;
|
|
131
128
|
if (!nativeView) {
|
|
132
129
|
return;
|
|
133
130
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
const frame = nativeView.frame;
|
|
132
|
+
const boundsWidth = view.scaleX ? frame.size.width / view.scaleX : frame.size.width;
|
|
133
|
+
const boundsHeight = view.scaleY ? frame.size.height / view.scaleY : frame.size.height;
|
|
137
134
|
if (!boundsWidth || !boundsHeight) {
|
|
138
135
|
return undefined;
|
|
139
136
|
}
|
|
140
|
-
|
|
137
|
+
const style = view.style;
|
|
141
138
|
if (imageURI) {
|
|
142
|
-
|
|
139
|
+
const match = imageURI.match(uriPattern);
|
|
143
140
|
if (match && match[2]) {
|
|
144
141
|
imageURI = match[2];
|
|
145
142
|
}
|
|
146
143
|
}
|
|
147
|
-
|
|
144
|
+
let bitmap;
|
|
148
145
|
if (isDataURI(imageURI)) {
|
|
149
|
-
|
|
146
|
+
const base64Data = imageURI.split(',')[1];
|
|
150
147
|
if (base64Data !== undefined) {
|
|
151
|
-
|
|
148
|
+
const imageSource = ImageSource.fromBase64Sync(base64Data);
|
|
152
149
|
bitmap = imageSource && imageSource.ios;
|
|
153
150
|
}
|
|
154
151
|
}
|
|
155
152
|
else if (isFileOrResourcePath(imageURI)) {
|
|
156
|
-
|
|
153
|
+
const imageSource = ImageSource.fromFileOrResourceSync(imageURI);
|
|
157
154
|
bitmap = imageSource && imageSource.ios;
|
|
158
155
|
}
|
|
159
156
|
else if (imageURI.indexOf('http') !== -1) {
|
|
160
157
|
style[symbolUrl] = imageURI;
|
|
161
158
|
ImageSource.fromUrl(imageURI)
|
|
162
|
-
.then(
|
|
159
|
+
.then((r) => {
|
|
163
160
|
if (style && style[symbolUrl] === imageURI) {
|
|
164
161
|
callback(generatePatternImage(r.ios, view, flip));
|
|
165
162
|
}
|
|
166
163
|
})
|
|
167
|
-
.catch(
|
|
164
|
+
.catch(() => { });
|
|
168
165
|
}
|
|
169
166
|
callback(generatePatternImage(bitmap, view, flip));
|
|
170
167
|
}
|
|
171
168
|
ios.createUIImageFromURI = createUIImageFromURI;
|
|
172
169
|
function generateShadowLayerPaths(view, bounds) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
170
|
+
const background = view.style.backgroundInternal;
|
|
171
|
+
const nativeView = view.nativeViewProtected;
|
|
172
|
+
const layer = nativeView.layer;
|
|
173
|
+
const boxShadow = background.getBoxShadow();
|
|
174
|
+
const spreadRadius = layout.toDeviceIndependentPixels(boxShadow.spreadRadius);
|
|
175
|
+
const { width, height } = bounds.size;
|
|
176
|
+
let innerPath, shadowPath;
|
|
180
177
|
// Generate more detailed paths if view has border radius
|
|
181
178
|
if (background.hasBorderRadius()) {
|
|
182
179
|
if (background.hasUniformBorder()) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
180
|
+
const cornerRadius = layer.cornerRadius;
|
|
181
|
+
const cappedRadius = getBorderCapRadius(cornerRadius, width / 2, height / 2);
|
|
182
|
+
const cappedOuterRadii = {
|
|
186
183
|
topLeft: cappedRadius,
|
|
187
184
|
topRight: cappedRadius,
|
|
188
185
|
bottomLeft: cappedRadius,
|
|
189
186
|
bottomRight: cappedRadius,
|
|
190
187
|
};
|
|
191
|
-
|
|
188
|
+
const cappedOuterRadiiWithSpread = {
|
|
192
189
|
topLeft: cappedRadius + spreadRadius,
|
|
193
190
|
topRight: cappedRadius + spreadRadius,
|
|
194
191
|
bottomLeft: cappedRadius + spreadRadius,
|
|
@@ -198,15 +195,15 @@ export var ios;
|
|
|
198
195
|
shadowPath = generateNonUniformBorderOuterClipPath(bounds, cappedOuterRadiiWithSpread, spreadRadius);
|
|
199
196
|
}
|
|
200
197
|
else {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
198
|
+
const outerTopLeftRadius = layout.toDeviceIndependentPixels(background.borderTopLeftRadius);
|
|
199
|
+
const outerTopRightRadius = layout.toDeviceIndependentPixels(background.borderTopRightRadius);
|
|
200
|
+
const outerBottomRightRadius = layout.toDeviceIndependentPixels(background.borderBottomRightRadius);
|
|
201
|
+
const outerBottomLeftRadius = layout.toDeviceIndependentPixels(background.borderBottomLeftRadius);
|
|
202
|
+
const topRadii = outerTopLeftRadius + outerTopRightRadius;
|
|
203
|
+
const rightRadii = outerTopRightRadius + outerBottomRightRadius;
|
|
204
|
+
const bottomRadii = outerBottomRightRadius + outerBottomLeftRadius;
|
|
205
|
+
const leftRadii = outerBottomLeftRadius + outerTopLeftRadius;
|
|
206
|
+
const cappedOuterRadii = {
|
|
210
207
|
topLeft: getBorderCapRadius(outerTopLeftRadius, (outerTopLeftRadius / topRadii) * width, (outerTopLeftRadius / leftRadii) * height),
|
|
211
208
|
topRight: getBorderCapRadius(outerTopRightRadius, (outerTopRightRadius / topRadii) * width, (outerTopRightRadius / rightRadii) * height),
|
|
212
209
|
bottomLeft: getBorderCapRadius(outerBottomLeftRadius, (outerBottomLeftRadius / bottomRadii) * width, (outerBottomLeftRadius / leftRadii) * height),
|
|
@@ -214,7 +211,7 @@ export var ios;
|
|
|
214
211
|
};
|
|
215
212
|
// Add spread radius to corners that actually have radius as shadow has grown larger
|
|
216
213
|
// than view itself and needs to be rounded accordingly
|
|
217
|
-
|
|
214
|
+
const cappedOuterRadiiWithSpread = {
|
|
218
215
|
topLeft: cappedOuterRadii.topLeft > 0 ? cappedOuterRadii.topLeft + spreadRadius : cappedOuterRadii.topLeft,
|
|
219
216
|
topRight: cappedOuterRadii.topRight > 0 ? cappedOuterRadii.topRight + spreadRadius : cappedOuterRadii.topRight,
|
|
220
217
|
bottomLeft: cappedOuterRadii.bottomLeft > 0 ? cappedOuterRadii.bottomLeft + spreadRadius : cappedOuterRadii.bottomLeft,
|
|
@@ -230,14 +227,14 @@ export var ios;
|
|
|
230
227
|
}
|
|
231
228
|
return {
|
|
232
229
|
maskPath: generateShadowMaskPath(bounds, boxShadow, innerPath),
|
|
233
|
-
shadowPath
|
|
230
|
+
shadowPath,
|
|
234
231
|
};
|
|
235
232
|
}
|
|
236
233
|
ios.generateShadowLayerPaths = generateShadowLayerPaths;
|
|
237
234
|
function generateClipPath(view, bounds) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
235
|
+
const background = view.style.backgroundInternal;
|
|
236
|
+
const { origin, size } = bounds;
|
|
237
|
+
const position = {
|
|
241
238
|
left: origin.x,
|
|
242
239
|
top: origin.y,
|
|
243
240
|
bottom: size.height,
|
|
@@ -246,10 +243,10 @@ export var ios;
|
|
|
246
243
|
if (position.right === 0 || position.bottom === 0) {
|
|
247
244
|
return;
|
|
248
245
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
246
|
+
let path;
|
|
247
|
+
const clipPath = background.clipPath;
|
|
248
|
+
const functionName = clipPath.substring(0, clipPath.indexOf('('));
|
|
249
|
+
const value = clipPath.replace(`${functionName}(`, '').replace(')', '');
|
|
253
250
|
switch (functionName) {
|
|
254
251
|
case 'rect':
|
|
255
252
|
path = rectPath(value, position);
|
|
@@ -271,32 +268,32 @@ export var ios;
|
|
|
271
268
|
}
|
|
272
269
|
ios.generateClipPath = generateClipPath;
|
|
273
270
|
function getUniformBorderRadius(view, bounds) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
271
|
+
const background = view.style.backgroundInternal;
|
|
272
|
+
const { width, height } = bounds.size;
|
|
273
|
+
const cornerRadius = layout.toDeviceIndependentPixels(background.getUniformBorderRadius());
|
|
277
274
|
return Math.min(Math.min(width / 2, height / 2), cornerRadius);
|
|
278
275
|
}
|
|
279
276
|
ios.getUniformBorderRadius = getUniformBorderRadius;
|
|
280
277
|
function generateNonUniformBorderInnerClipRoundedPath(view, bounds) {
|
|
281
|
-
|
|
282
|
-
|
|
278
|
+
const background = view.style.backgroundInternal;
|
|
279
|
+
const cappedOuterRadii = calculateNonUniformBorderCappedRadii(bounds, background);
|
|
283
280
|
return generateNonUniformBorderInnerClipPath(bounds, background, cappedOuterRadii);
|
|
284
281
|
}
|
|
285
282
|
ios.generateNonUniformBorderInnerClipRoundedPath = generateNonUniformBorderInnerClipRoundedPath;
|
|
286
283
|
function generateNonUniformBorderOuterClipRoundedPath(view, bounds) {
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
const background = view.style.backgroundInternal;
|
|
285
|
+
const cappedOuterRadii = calculateNonUniformBorderCappedRadii(bounds, background);
|
|
289
286
|
return generateNonUniformBorderOuterClipPath(bounds, cappedOuterRadii);
|
|
290
287
|
}
|
|
291
288
|
ios.generateNonUniformBorderOuterClipRoundedPath = generateNonUniformBorderOuterClipRoundedPath;
|
|
292
289
|
function generateNonUniformMultiColorBorderRoundedPaths(view, bounds) {
|
|
293
|
-
|
|
290
|
+
const background = view.style.backgroundInternal;
|
|
294
291
|
return generateNonUniformMultiColorBorderPaths(bounds, background);
|
|
295
292
|
}
|
|
296
293
|
ios.generateNonUniformMultiColorBorderRoundedPaths = generateNonUniformMultiColorBorderRoundedPaths;
|
|
297
294
|
})(ios || (ios = {}));
|
|
298
295
|
function maskLayerIfNeeded(nativeView, background) {
|
|
299
|
-
|
|
296
|
+
const layer = nativeView.layer;
|
|
300
297
|
// Check if layer should be masked
|
|
301
298
|
if (!(layer.mask instanceof CAShapeLayer)) {
|
|
302
299
|
// Since layers can only accept up to a single mask at a time, clip path is given more priority
|
|
@@ -324,8 +321,8 @@ function clearLayerMask(nativeView) {
|
|
|
324
321
|
nativeView.maskType = null;
|
|
325
322
|
}
|
|
326
323
|
function onBackgroundViewScroll(args) {
|
|
327
|
-
|
|
328
|
-
|
|
324
|
+
const view = args.object;
|
|
325
|
+
const nativeView = view.nativeViewProtected;
|
|
329
326
|
if (nativeView instanceof UIScrollView) {
|
|
330
327
|
adjustLayersForScrollView(nativeView);
|
|
331
328
|
}
|
|
@@ -334,8 +331,8 @@ function adjustLayersForScrollView(nativeView) {
|
|
|
334
331
|
// Compensates with transition for the background layers for scrolling in ScrollView based controls.
|
|
335
332
|
CATransaction.begin();
|
|
336
333
|
CATransaction.setDisableActions(true);
|
|
337
|
-
|
|
338
|
-
|
|
334
|
+
const offset = nativeView.contentOffset;
|
|
335
|
+
const transform = {
|
|
339
336
|
a: 1,
|
|
340
337
|
b: 0,
|
|
341
338
|
c: 0,
|
|
@@ -388,14 +385,14 @@ function clearNonUniformBorders(nativeView) {
|
|
|
388
385
|
nativeView.hasNonUniformBorder = false;
|
|
389
386
|
}
|
|
390
387
|
function parsePosition(pos) {
|
|
391
|
-
|
|
388
|
+
const values = cssParse(pos);
|
|
392
389
|
if (values.length === 2) {
|
|
393
390
|
return { x: values[0], y: values[1] };
|
|
394
391
|
}
|
|
395
392
|
if (values.length === 1) {
|
|
396
|
-
|
|
393
|
+
const center = { type: 'ident', string: 'center' };
|
|
397
394
|
if (values[0].type === 'ident') {
|
|
398
|
-
|
|
395
|
+
const val = values[0].string.toLocaleLowerCase();
|
|
399
396
|
// If you only one keyword is specified, the other value is "center"
|
|
400
397
|
if (val === 'left' || val === 'right') {
|
|
401
398
|
return { x: values[0], y: center };
|
|
@@ -417,7 +414,7 @@ function getDrawParams(image, background, width, height) {
|
|
|
417
414
|
if (!image) {
|
|
418
415
|
return null;
|
|
419
416
|
}
|
|
420
|
-
|
|
417
|
+
const res = {
|
|
421
418
|
repeatX: true,
|
|
422
419
|
repeatY: true,
|
|
423
420
|
posX: 0,
|
|
@@ -438,16 +435,16 @@ function getDrawParams(image, background, width, height) {
|
|
|
438
435
|
break;
|
|
439
436
|
}
|
|
440
437
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
438
|
+
const imageSize = image.size;
|
|
439
|
+
let imageWidth = imageSize.width;
|
|
440
|
+
let imageHeight = imageSize.height;
|
|
444
441
|
// size
|
|
445
|
-
|
|
442
|
+
const size = background.size;
|
|
446
443
|
if (size) {
|
|
447
|
-
|
|
444
|
+
const values = cssParse(size);
|
|
448
445
|
if (values.length === 2) {
|
|
449
|
-
|
|
450
|
-
|
|
446
|
+
const vx = values[0];
|
|
447
|
+
const vy = values[1];
|
|
451
448
|
if (vx.unit === '%' && vy.unit === '%') {
|
|
452
449
|
imageWidth = (width * vx.value) / 100;
|
|
453
450
|
imageHeight = (height * vy.value) / 100;
|
|
@@ -462,7 +459,7 @@ function getDrawParams(image, background, width, height) {
|
|
|
462
459
|
}
|
|
463
460
|
}
|
|
464
461
|
else if (values.length === 1 && values[0].type === 'ident') {
|
|
465
|
-
|
|
462
|
+
let scale = 0;
|
|
466
463
|
if (values[0].string === 'cover') {
|
|
467
464
|
scale = Math.max(width / imageWidth, height / imageHeight);
|
|
468
465
|
}
|
|
@@ -478,12 +475,12 @@ function getDrawParams(image, background, width, height) {
|
|
|
478
475
|
}
|
|
479
476
|
}
|
|
480
477
|
// position
|
|
481
|
-
|
|
478
|
+
const position = background.position;
|
|
482
479
|
if (position) {
|
|
483
|
-
|
|
480
|
+
const v = parsePosition(position);
|
|
484
481
|
if (v) {
|
|
485
|
-
|
|
486
|
-
|
|
482
|
+
const spaceX = width - imageWidth;
|
|
483
|
+
const spaceY = height - imageHeight;
|
|
487
484
|
if (v.x.unit === '%' && v.y.unit === '%') {
|
|
488
485
|
res.posX = (spaceX * v.x.value) / 100;
|
|
489
486
|
res.posY = (spaceY * v.y.value) / 100;
|
|
@@ -525,24 +522,24 @@ function getDrawParams(image, background, width, height) {
|
|
|
525
522
|
return res;
|
|
526
523
|
}
|
|
527
524
|
function generatePatternImage(img, view, flip) {
|
|
528
|
-
|
|
529
|
-
|
|
525
|
+
const background = view.style.backgroundInternal;
|
|
526
|
+
const nativeView = view.nativeViewProtected;
|
|
530
527
|
if (!img || !nativeView) {
|
|
531
528
|
return null;
|
|
532
529
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
530
|
+
const frame = nativeView.frame;
|
|
531
|
+
const boundsWidth = view.scaleX ? frame.size.width / view.scaleX : frame.size.width;
|
|
532
|
+
const boundsHeight = view.scaleY ? frame.size.height / view.scaleY : frame.size.height;
|
|
533
|
+
const params = getDrawParams(img, background, boundsWidth, boundsHeight);
|
|
537
534
|
if (params.sizeX > 0 && params.sizeY > 0) {
|
|
538
|
-
|
|
535
|
+
const resizeRect = CGRectMake(0, 0, params.sizeX, params.sizeY);
|
|
539
536
|
UIGraphicsBeginImageContextWithOptions(resizeRect.size, false, 0.0);
|
|
540
537
|
img.drawInRect(resizeRect);
|
|
541
538
|
img = UIGraphicsGetImageFromCurrentImageContext();
|
|
542
539
|
UIGraphicsEndImageContext();
|
|
543
540
|
}
|
|
544
|
-
UIGraphicsBeginImageContextWithOptions(CGSizeFromString(
|
|
545
|
-
|
|
541
|
+
UIGraphicsBeginImageContextWithOptions(CGSizeFromString(`{${boundsWidth},${boundsHeight}}`), false, 0.0);
|
|
542
|
+
const context = UIGraphicsGetCurrentContext();
|
|
546
543
|
if (background.color && background.color.ios) {
|
|
547
544
|
CGContextSetFillColorWithColor(context, background.color.ios.CGColor);
|
|
548
545
|
CGContextFillRect(context, CGRectMake(0, 0, boundsWidth, boundsHeight));
|
|
@@ -551,15 +548,15 @@ function generatePatternImage(img, view, flip) {
|
|
|
551
548
|
img.drawAtPoint(CGPointMake(params.posX, params.posY));
|
|
552
549
|
}
|
|
553
550
|
else {
|
|
554
|
-
|
|
555
|
-
|
|
551
|
+
const w = params.repeatX ? boundsWidth : img.size.width;
|
|
552
|
+
const h = params.repeatY ? boundsHeight : img.size.height;
|
|
556
553
|
CGContextSetPatternPhase(context, CGSizeMake(params.posX, params.posY));
|
|
557
554
|
params.posX = params.repeatX ? 0 : params.posX;
|
|
558
555
|
params.posY = params.repeatY ? 0 : params.posY;
|
|
559
|
-
|
|
556
|
+
const patternRect = CGRectMake(params.posX, params.posY, w, h);
|
|
560
557
|
img.drawAsPatternInRect(patternRect);
|
|
561
558
|
}
|
|
562
|
-
|
|
559
|
+
const bgImage = UIGraphicsGetImageFromCurrentImageContext();
|
|
563
560
|
UIGraphicsEndImageContext();
|
|
564
561
|
return flip ? _flipImage(bgImage) : bgImage;
|
|
565
562
|
}
|
|
@@ -567,13 +564,13 @@ function generatePatternImage(img, view, flip) {
|
|
|
567
564
|
// https://developer.apple.com/library/ios/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/GraphicsDrawingOverview/GraphicsDrawingOverview.html
|
|
568
565
|
function _flipImage(originalImage) {
|
|
569
566
|
UIGraphicsBeginImageContextWithOptions(originalImage.size, false, 0.0);
|
|
570
|
-
|
|
567
|
+
const context = UIGraphicsGetCurrentContext();
|
|
571
568
|
CGContextSaveGState(context);
|
|
572
569
|
CGContextTranslateCTM(context, 0.0, originalImage.size.height);
|
|
573
570
|
CGContextScaleCTM(context, 1.0, -1.0);
|
|
574
571
|
originalImage.drawInRect(CGRectMake(0, 0, originalImage.size.width, originalImage.size.height));
|
|
575
572
|
CGContextRestoreGState(context);
|
|
576
|
-
|
|
573
|
+
const flippedImage = UIGraphicsGetImageFromCurrentImageContext();
|
|
577
574
|
UIGraphicsEndImageContext();
|
|
578
575
|
return flippedImage;
|
|
579
576
|
}
|
|
@@ -593,17 +590,17 @@ function getBorderCapRadius(a, b, c) {
|
|
|
593
590
|
return a && Math.min(a, Math.min(b, c));
|
|
594
591
|
}
|
|
595
592
|
function calculateNonUniformBorderCappedRadii(bounds, background) {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
593
|
+
const { width, height } = bounds.size;
|
|
594
|
+
const { x, y } = bounds.origin;
|
|
595
|
+
const outerTopLeftRadius = layout.toDeviceIndependentPixels(background.borderTopLeftRadius);
|
|
596
|
+
const outerTopRightRadius = layout.toDeviceIndependentPixels(background.borderTopRightRadius);
|
|
597
|
+
const outerBottomRightRadius = layout.toDeviceIndependentPixels(background.borderBottomRightRadius);
|
|
598
|
+
const outerBottomLeftRadius = layout.toDeviceIndependentPixels(background.borderBottomLeftRadius);
|
|
599
|
+
const topRadii = outerTopLeftRadius + outerTopRightRadius;
|
|
600
|
+
const rightRadii = outerTopRightRadius + outerBottomRightRadius;
|
|
601
|
+
const bottomRadii = outerBottomRightRadius + outerBottomLeftRadius;
|
|
602
|
+
const leftRadii = outerBottomLeftRadius + outerTopLeftRadius;
|
|
603
|
+
const cappedOuterRadii = {
|
|
607
604
|
topLeft: getBorderCapRadius(outerTopLeftRadius, (outerTopLeftRadius / topRadii) * width, (outerTopLeftRadius / leftRadii) * height),
|
|
608
605
|
topRight: getBorderCapRadius(outerTopRightRadius, (outerTopRightRadius / topRadii) * width, (outerTopRightRadius / rightRadii) * height),
|
|
609
606
|
bottomLeft: getBorderCapRadius(outerBottomLeftRadius, (outerBottomLeftRadius / bottomRadii) * width, (outerBottomLeftRadius / leftRadii) * height),
|
|
@@ -612,13 +609,12 @@ function calculateNonUniformBorderCappedRadii(bounds, background) {
|
|
|
612
609
|
return cappedOuterRadii;
|
|
613
610
|
}
|
|
614
611
|
function drawNonUniformBorders(nativeView, background) {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
var layerBounds = layer.bounds;
|
|
612
|
+
const layer = nativeView.layer;
|
|
613
|
+
const layerBounds = layer.bounds;
|
|
618
614
|
layer.borderColor = null;
|
|
619
615
|
layer.borderWidth = 0;
|
|
620
616
|
layer.cornerRadius = 0;
|
|
621
|
-
|
|
617
|
+
const cappedOuterRadii = calculateNonUniformBorderCappedRadii(layerBounds, background);
|
|
622
618
|
if (nativeView.maskType === iosViewUtils.LayerMask.BORDER && layer.mask instanceof CAShapeLayer) {
|
|
623
619
|
layer.mask.path = generateNonUniformBorderOuterClipPath(layerBounds, cappedOuterRadii);
|
|
624
620
|
}
|
|
@@ -633,14 +629,14 @@ function drawNonUniformBorders(nativeView, background) {
|
|
|
633
629
|
// Use anti-aliasing or borders will draw incorrectly at times
|
|
634
630
|
nativeView.borderLayer.shouldRasterize = true;
|
|
635
631
|
nativeView.borderLayer.rasterizationScale = Screen.mainScreen.scale;
|
|
636
|
-
nativeView.borderLayer.fillColor =
|
|
632
|
+
nativeView.borderLayer.fillColor = background.borderTopColor?.ios?.CGColor || UIColor.blackColor.CGColor;
|
|
637
633
|
nativeView.borderLayer.path = generateNonUniformBorderInnerClipPath(layerBounds, background, cappedOuterRadii);
|
|
638
634
|
}
|
|
639
635
|
else {
|
|
640
636
|
// Non-uniform borders need more layers in order to display multiple colors at the same time
|
|
641
|
-
|
|
637
|
+
let borderTopLayer, borderRightLayer, borderBottomLayer, borderLeftLayer;
|
|
642
638
|
if (!nativeView.hasNonUniformBorderColor) {
|
|
643
|
-
|
|
639
|
+
const maskLayer = CAShapeLayer.new();
|
|
644
640
|
maskLayer.fillRule = kCAFillRuleEvenOdd;
|
|
645
641
|
// Use anti-aliasing or borders will draw incorrectly at times
|
|
646
642
|
maskLayer.shouldRasterize = true;
|
|
@@ -662,14 +658,14 @@ function drawNonUniformBorders(nativeView, background) {
|
|
|
662
658
|
borderBottomLayer = nativeView.borderLayer.sublayers[2];
|
|
663
659
|
borderLeftLayer = nativeView.borderLayer.sublayers[3];
|
|
664
660
|
}
|
|
665
|
-
|
|
666
|
-
borderTopLayer.fillColor =
|
|
661
|
+
const paths = generateNonUniformMultiColorBorderPaths(layerBounds, background);
|
|
662
|
+
borderTopLayer.fillColor = background.borderTopColor?.ios?.CGColor || UIColor.blackColor.CGColor;
|
|
667
663
|
borderTopLayer.path = paths[0];
|
|
668
|
-
borderRightLayer.fillColor =
|
|
664
|
+
borderRightLayer.fillColor = background.borderRightColor?.ios?.CGColor || UIColor.blackColor.CGColor;
|
|
669
665
|
borderRightLayer.path = paths[1];
|
|
670
|
-
borderBottomLayer.fillColor =
|
|
666
|
+
borderBottomLayer.fillColor = background.borderBottomColor?.ios?.CGColor || UIColor.blackColor.CGColor;
|
|
671
667
|
borderBottomLayer.path = paths[2];
|
|
672
|
-
borderLeftLayer.fillColor =
|
|
668
|
+
borderLeftLayer.fillColor = background.borderLeftColor?.ios?.CGColor || UIColor.blackColor.CGColor;
|
|
673
669
|
borderLeftLayer.path = paths[3];
|
|
674
670
|
// Clip inner area to create borders
|
|
675
671
|
if (nativeView.borderLayer.mask instanceof CAShapeLayer) {
|
|
@@ -679,9 +675,9 @@ function drawNonUniformBorders(nativeView, background) {
|
|
|
679
675
|
}
|
|
680
676
|
}
|
|
681
677
|
function calculateInnerBorderClipRadius(radius, insetX, insetY) {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
678
|
+
const innerXRadius = Math.max(0, radius - insetX);
|
|
679
|
+
const innerYRadius = Math.max(0, radius - insetY);
|
|
680
|
+
const innerMaxRadius = Math.max(innerXRadius, innerYRadius);
|
|
685
681
|
return {
|
|
686
682
|
xRadius: innerXRadius,
|
|
687
683
|
yRadius: innerYRadius,
|
|
@@ -696,15 +692,14 @@ function calculateInnerBorderClipRadius(radius, insetX, insetY) {
|
|
|
696
692
|
* @param offset
|
|
697
693
|
* @returns
|
|
698
694
|
*/
|
|
699
|
-
function generateNonUniformBorderOuterClipPath(bounds, cappedRadii, offset) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
var clipPath = CGPathCreateMutable();
|
|
695
|
+
function generateNonUniformBorderOuterClipPath(bounds, cappedRadii, offset = 0) {
|
|
696
|
+
const { width, height } = bounds.size;
|
|
697
|
+
const { x, y } = bounds.origin;
|
|
698
|
+
const left = x - offset;
|
|
699
|
+
const top = y - offset;
|
|
700
|
+
const right = x + width + offset;
|
|
701
|
+
const bottom = y + height + offset;
|
|
702
|
+
const clipPath = CGPathCreateMutable();
|
|
708
703
|
CGPathMoveToPoint(clipPath, null, left + cappedRadii.topLeft, top);
|
|
709
704
|
CGPathAddArcToPoint(clipPath, null, right, top, right, top + cappedRadii.topRight, cappedRadii.topRight);
|
|
710
705
|
CGPathAddArcToPoint(clipPath, null, right, bottom, right - cappedRadii.bottomRight, bottom, cappedRadii.bottomRight);
|
|
@@ -722,25 +717,25 @@ function generateNonUniformBorderOuterClipPath(bounds, cappedRadii, offset) {
|
|
|
722
717
|
* @returns
|
|
723
718
|
*/
|
|
724
719
|
function generateNonUniformBorderInnerClipPath(bounds, background, cappedOuterRadii) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
720
|
+
const { width, height } = bounds.size;
|
|
721
|
+
const { x, y } = bounds.origin;
|
|
722
|
+
const position = {
|
|
728
723
|
left: x,
|
|
729
724
|
top: y,
|
|
730
725
|
bottom: y + height,
|
|
731
726
|
right: x + width,
|
|
732
727
|
};
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
728
|
+
const borderTopWidth = Math.max(0, layout.toDeviceIndependentPixels(background.borderTopWidth));
|
|
729
|
+
const borderRightWidth = Math.max(0, layout.toDeviceIndependentPixels(background.borderRightWidth));
|
|
730
|
+
const borderBottomWidth = Math.max(0, layout.toDeviceIndependentPixels(background.borderBottomWidth));
|
|
731
|
+
const borderLeftWidth = Math.max(0, layout.toDeviceIndependentPixels(background.borderLeftWidth));
|
|
732
|
+
const borderVWidth = borderTopWidth + borderBottomWidth;
|
|
733
|
+
const borderHWidth = borderLeftWidth + borderRightWidth;
|
|
734
|
+
const cappedBorderTopWidth = borderTopWidth && borderTopWidth * Math.min(1, height / borderVWidth);
|
|
735
|
+
const cappedBorderRightWidth = borderRightWidth && borderRightWidth * Math.min(1, width / borderHWidth);
|
|
736
|
+
const cappedBorderBottomWidth = borderBottomWidth && borderBottomWidth * Math.min(1, height / borderVWidth);
|
|
737
|
+
const cappedBorderLeftWidth = borderLeftWidth && borderLeftWidth * Math.min(1, width / borderHWidth);
|
|
738
|
+
const clipPath = CGPathCreateMutable();
|
|
744
739
|
CGPathAddRect(clipPath, null, CGRectMake(x, y, width, height));
|
|
745
740
|
// Inner clip paths
|
|
746
741
|
if (cappedBorderTopWidth > 0 || cappedBorderLeftWidth > 0) {
|
|
@@ -750,32 +745,32 @@ function generateNonUniformBorderInnerClipPath(bounds, background, cappedOuterRa
|
|
|
750
745
|
CGPathMoveToPoint(clipPath, null, position.left, position.top);
|
|
751
746
|
}
|
|
752
747
|
if (cappedBorderTopWidth > 0 || cappedBorderRightWidth > 0) {
|
|
753
|
-
|
|
754
|
-
|
|
748
|
+
const { xRadius, yRadius, maxRadius } = calculateInnerBorderClipRadius(cappedOuterRadii.topRight, cappedBorderRightWidth, cappedBorderTopWidth);
|
|
749
|
+
const innerTopRightTransform = CGAffineTransformMake(maxRadius && xRadius / maxRadius, 0, 0, maxRadius && yRadius / maxRadius, position.right - cappedBorderRightWidth - xRadius, position.top + cappedBorderTopWidth + yRadius);
|
|
755
750
|
CGPathAddArc(clipPath, innerTopRightTransform, 0, 0, maxRadius, (Math.PI * 3) / 2, 0, false);
|
|
756
751
|
}
|
|
757
752
|
else {
|
|
758
753
|
CGPathAddLineToPoint(clipPath, null, position.right, position.top);
|
|
759
754
|
}
|
|
760
755
|
if (cappedBorderBottomWidth > 0 || cappedBorderRightWidth > 0) {
|
|
761
|
-
|
|
762
|
-
|
|
756
|
+
const { xRadius, yRadius, maxRadius } = calculateInnerBorderClipRadius(cappedOuterRadii.bottomRight, cappedBorderRightWidth, cappedBorderBottomWidth);
|
|
757
|
+
const innerBottomRightTransform = CGAffineTransformMake(maxRadius && xRadius / maxRadius, 0, 0, maxRadius && yRadius / maxRadius, position.right - cappedBorderRightWidth - xRadius, position.bottom - cappedBorderBottomWidth - yRadius);
|
|
763
758
|
CGPathAddArc(clipPath, innerBottomRightTransform, 0, 0, maxRadius, 0, Math.PI / 2, false);
|
|
764
759
|
}
|
|
765
760
|
else {
|
|
766
761
|
CGPathAddLineToPoint(clipPath, null, position.right, position.bottom);
|
|
767
762
|
}
|
|
768
763
|
if (cappedBorderBottomWidth > 0 || cappedBorderLeftWidth > 0) {
|
|
769
|
-
|
|
770
|
-
|
|
764
|
+
const { xRadius, yRadius, maxRadius } = calculateInnerBorderClipRadius(cappedOuterRadii.bottomLeft, cappedBorderLeftWidth, cappedBorderBottomWidth);
|
|
765
|
+
const innerBottomLeftTransform = CGAffineTransformMake(maxRadius && xRadius / maxRadius, 0, 0, maxRadius && yRadius / maxRadius, position.left + cappedBorderLeftWidth + xRadius, position.bottom - cappedBorderBottomWidth - yRadius);
|
|
771
766
|
CGPathAddArc(clipPath, innerBottomLeftTransform, 0, 0, maxRadius, Math.PI / 2, Math.PI, false);
|
|
772
767
|
}
|
|
773
768
|
else {
|
|
774
769
|
CGPathAddLineToPoint(clipPath, null, position.left, position.bottom);
|
|
775
770
|
}
|
|
776
771
|
if (cappedBorderTopWidth > 0 || cappedBorderLeftWidth > 0) {
|
|
777
|
-
|
|
778
|
-
|
|
772
|
+
const { xRadius, yRadius, maxRadius } = calculateInnerBorderClipRadius(cappedOuterRadii.topLeft, cappedBorderLeftWidth, cappedBorderTopWidth);
|
|
773
|
+
const innerTopLeftTransform = CGAffineTransformMake(maxRadius && xRadius / maxRadius, 0, 0, maxRadius && yRadius / maxRadius, position.left + cappedBorderLeftWidth + xRadius, position.top + cappedBorderTopWidth + yRadius);
|
|
779
774
|
CGPathAddArc(clipPath, innerTopLeftTransform, 0, 0, maxRadius, Math.PI, (Math.PI * 3) / 2, false);
|
|
780
775
|
}
|
|
781
776
|
else {
|
|
@@ -793,16 +788,16 @@ function generateNonUniformBorderInnerClipPath(bounds, background, cappedOuterRa
|
|
|
793
788
|
* @returns
|
|
794
789
|
*/
|
|
795
790
|
function getBorderTriangleWidths(bounds, background) {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
791
|
+
const width = bounds.origin.x + bounds.size.width;
|
|
792
|
+
const height = bounds.origin.y + bounds.size.height;
|
|
793
|
+
const borderTopWidth = Math.max(0, layout.toDeviceIndependentPixels(background.borderTopWidth));
|
|
794
|
+
const borderRightWidth = Math.max(0, layout.toDeviceIndependentPixels(background.borderRightWidth));
|
|
795
|
+
const borderBottomWidth = Math.max(0, layout.toDeviceIndependentPixels(background.borderBottomWidth));
|
|
796
|
+
const borderLeftWidth = Math.max(0, layout.toDeviceIndependentPixels(background.borderLeftWidth));
|
|
797
|
+
const verticalBorderWidth = borderTopWidth + borderBottomWidth;
|
|
798
|
+
const horizontalBorderWidth = borderLeftWidth + borderRightWidth;
|
|
799
|
+
let verticalBorderMultiplier = verticalBorderWidth > 0 ? height / verticalBorderWidth : 0;
|
|
800
|
+
let horizontalBorderMultiplier = horizontalBorderWidth > 0 ? width / horizontalBorderWidth : 0;
|
|
806
801
|
// Both directions should consider each other in order to scale widths properly, as a view might have different width and height
|
|
807
802
|
if (verticalBorderMultiplier > 0 && verticalBorderMultiplier < horizontalBorderMultiplier) {
|
|
808
803
|
horizontalBorderMultiplier -= horizontalBorderMultiplier - verticalBorderMultiplier;
|
|
@@ -827,54 +822,54 @@ function getBorderTriangleWidths(bounds, background) {
|
|
|
827
822
|
* @returns
|
|
828
823
|
*/
|
|
829
824
|
function generateNonUniformMultiColorBorderPaths(bounds, background) {
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
825
|
+
const { width, height } = bounds.size;
|
|
826
|
+
const { x, y } = bounds.origin;
|
|
827
|
+
const position = {
|
|
833
828
|
left: x,
|
|
834
829
|
top: y,
|
|
835
830
|
bottom: y + height,
|
|
836
831
|
right: x + width,
|
|
837
832
|
};
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
833
|
+
const borderWidths = getBorderTriangleWidths(bounds, background);
|
|
834
|
+
const paths = new Array(4);
|
|
835
|
+
const lto = {
|
|
841
836
|
x: position.left,
|
|
842
837
|
y: position.top,
|
|
843
838
|
}; // left-top-outside
|
|
844
|
-
|
|
839
|
+
const lti = {
|
|
845
840
|
x: position.left + borderWidths.left,
|
|
846
841
|
y: position.top + borderWidths.top,
|
|
847
842
|
}; // left-top-inside
|
|
848
|
-
|
|
843
|
+
const rto = {
|
|
849
844
|
x: position.right,
|
|
850
845
|
y: position.top,
|
|
851
846
|
}; // right-top-outside
|
|
852
|
-
|
|
847
|
+
const rti = {
|
|
853
848
|
x: position.right - borderWidths.right,
|
|
854
849
|
y: position.top + borderWidths.top,
|
|
855
850
|
}; // right-top-inside
|
|
856
|
-
|
|
851
|
+
const rbo = {
|
|
857
852
|
x: position.right,
|
|
858
853
|
y: position.bottom,
|
|
859
854
|
}; // right-bottom-outside
|
|
860
|
-
|
|
855
|
+
const rbi = {
|
|
861
856
|
x: position.right - borderWidths.right,
|
|
862
857
|
y: position.bottom - borderWidths.bottom,
|
|
863
858
|
}; // right-bottom-inside
|
|
864
|
-
|
|
859
|
+
const lbo = {
|
|
865
860
|
x: position.left,
|
|
866
861
|
y: position.bottom,
|
|
867
862
|
}; // left-bottom-outside
|
|
868
|
-
|
|
863
|
+
const lbi = {
|
|
869
864
|
x: position.left + borderWidths.left,
|
|
870
865
|
y: position.bottom - borderWidths.bottom,
|
|
871
866
|
}; // left-bottom-inside
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
if (borderWidths.top > 0 &&
|
|
877
|
-
|
|
867
|
+
const borderTopColor = background.borderTopColor;
|
|
868
|
+
const borderRightColor = background.borderRightColor;
|
|
869
|
+
const borderBottomColor = background.borderBottomColor;
|
|
870
|
+
const borderLeftColor = background.borderLeftColor;
|
|
871
|
+
if (borderWidths.top > 0 && borderTopColor?.ios) {
|
|
872
|
+
const topBorderPath = CGPathCreateMutable();
|
|
878
873
|
CGPathMoveToPoint(topBorderPath, null, lto.x, lto.y);
|
|
879
874
|
CGPathAddLineToPoint(topBorderPath, null, rto.x, rto.y);
|
|
880
875
|
CGPathAddLineToPoint(topBorderPath, null, rti.x, rti.y);
|
|
@@ -884,8 +879,8 @@ function generateNonUniformMultiColorBorderPaths(bounds, background) {
|
|
|
884
879
|
CGPathAddLineToPoint(topBorderPath, null, lto.x, lto.y);
|
|
885
880
|
paths[0] = topBorderPath;
|
|
886
881
|
}
|
|
887
|
-
if (borderWidths.right > 0 &&
|
|
888
|
-
|
|
882
|
+
if (borderWidths.right > 0 && borderRightColor?.ios) {
|
|
883
|
+
const rightBorderPath = CGPathCreateMutable();
|
|
889
884
|
CGPathMoveToPoint(rightBorderPath, null, rto.x, rto.y);
|
|
890
885
|
CGPathAddLineToPoint(rightBorderPath, null, rbo.x, rbo.y);
|
|
891
886
|
CGPathAddLineToPoint(rightBorderPath, null, rbi.x, rbi.y);
|
|
@@ -895,8 +890,8 @@ function generateNonUniformMultiColorBorderPaths(bounds, background) {
|
|
|
895
890
|
CGPathAddLineToPoint(rightBorderPath, null, rto.x, rto.y);
|
|
896
891
|
paths[1] = rightBorderPath;
|
|
897
892
|
}
|
|
898
|
-
if (borderWidths.bottom > 0 &&
|
|
899
|
-
|
|
893
|
+
if (borderWidths.bottom > 0 && borderBottomColor?.ios) {
|
|
894
|
+
const bottomBorderPath = CGPathCreateMutable();
|
|
900
895
|
CGPathMoveToPoint(bottomBorderPath, null, rbo.x, rbo.y);
|
|
901
896
|
CGPathAddLineToPoint(bottomBorderPath, null, lbo.x, lbo.y);
|
|
902
897
|
CGPathAddLineToPoint(bottomBorderPath, null, lbi.x, lbi.y);
|
|
@@ -906,8 +901,8 @@ function generateNonUniformMultiColorBorderPaths(bounds, background) {
|
|
|
906
901
|
CGPathAddLineToPoint(bottomBorderPath, null, rbo.x, rbo.y);
|
|
907
902
|
paths[2] = bottomBorderPath;
|
|
908
903
|
}
|
|
909
|
-
if (borderWidths.left > 0 &&
|
|
910
|
-
|
|
904
|
+
if (borderWidths.left > 0 && borderLeftColor?.ios) {
|
|
905
|
+
const leftBorderPath = CGPathCreateMutable();
|
|
911
906
|
CGPathMoveToPoint(leftBorderPath, null, lbo.x, lbo.y);
|
|
912
907
|
CGPathAddLineToPoint(leftBorderPath, null, lto.x, lto.y);
|
|
913
908
|
CGPathAddLineToPoint(leftBorderPath, null, lti.x, lti.y);
|
|
@@ -920,27 +915,26 @@ function generateNonUniformMultiColorBorderPaths(bounds, background) {
|
|
|
920
915
|
return paths;
|
|
921
916
|
}
|
|
922
917
|
function drawBoxShadow(view) {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
var layer = nativeView.layer;
|
|
918
|
+
const background = view.style.backgroundInternal;
|
|
919
|
+
const nativeView = view.nativeViewProtected;
|
|
920
|
+
const layer = nativeView.layer;
|
|
927
921
|
// There is no parent to add shadow to
|
|
928
922
|
if (!layer.superlayer) {
|
|
929
923
|
return;
|
|
930
924
|
}
|
|
931
|
-
|
|
932
|
-
|
|
925
|
+
const bounds = nativeView.bounds;
|
|
926
|
+
const boxShadow = background.getBoxShadow();
|
|
933
927
|
// Initialize outer shadows
|
|
934
|
-
|
|
928
|
+
let outerShadowContainerLayer;
|
|
935
929
|
if (nativeView.outerShadowContainerLayer) {
|
|
936
930
|
outerShadowContainerLayer = nativeView.outerShadowContainerLayer;
|
|
937
931
|
}
|
|
938
932
|
else {
|
|
939
933
|
outerShadowContainerLayer = CALayer.new();
|
|
940
934
|
// TODO: Make this dynamic when views get support for multiple shadows
|
|
941
|
-
|
|
935
|
+
const shadowLayer = CALayer.new();
|
|
942
936
|
// This mask is necessary to maintain transparent background
|
|
943
|
-
|
|
937
|
+
const maskLayer = CAShapeLayer.new();
|
|
944
938
|
maskLayer.fillRule = kCAFillRuleEvenOdd;
|
|
945
939
|
shadowLayer.mask = maskLayer;
|
|
946
940
|
outerShadowContainerLayer.addSublayer(shadowLayer);
|
|
@@ -964,21 +958,21 @@ function drawBoxShadow(view) {
|
|
|
964
958
|
// Inherit view visibility values
|
|
965
959
|
outerShadowContainerLayer.opacity = layer.opacity;
|
|
966
960
|
outerShadowContainerLayer.hidden = layer.hidden;
|
|
967
|
-
|
|
968
|
-
if (outerShadowLayers
|
|
969
|
-
for (
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
961
|
+
const outerShadowLayers = outerShadowContainerLayer.sublayers;
|
|
962
|
+
if (outerShadowLayers?.count) {
|
|
963
|
+
for (let i = 0, count = outerShadowLayers.count; i < count; i++) {
|
|
964
|
+
const shadowLayer = outerShadowLayers[i];
|
|
965
|
+
const shadowRadius = layout.toDeviceIndependentPixels(boxShadow.blurRadius);
|
|
966
|
+
const spreadRadius = layout.toDeviceIndependentPixels(boxShadow.spreadRadius);
|
|
967
|
+
const offsetX = layout.toDeviceIndependentPixels(boxShadow.offsetX);
|
|
968
|
+
const offsetY = layout.toDeviceIndependentPixels(boxShadow.offsetY);
|
|
969
|
+
const { maskPath, shadowPath } = ios.generateShadowLayerPaths(view, bounds);
|
|
976
970
|
shadowLayer.allowsEdgeAntialiasing = true;
|
|
977
971
|
shadowLayer.contentsScale = Screen.mainScreen.scale;
|
|
978
972
|
// Shadow opacity is handled on the shadow's color instance
|
|
979
|
-
shadowLayer.shadowOpacity =
|
|
973
|
+
shadowLayer.shadowOpacity = boxShadow.color?.a ? boxShadow.color.a / 255 : 1;
|
|
980
974
|
shadowLayer.shadowRadius = shadowRadius;
|
|
981
|
-
shadowLayer.shadowColor =
|
|
975
|
+
shadowLayer.shadowColor = boxShadow.color?.ios?.CGColor;
|
|
982
976
|
shadowLayer.shadowOffset = CGSizeMake(offsetX, offsetY);
|
|
983
977
|
// Apply spread radius by expanding shadow layer bounds (this has a nice glow with radii set to 0)
|
|
984
978
|
shadowLayer.shadowPath = shadowPath;
|
|
@@ -1004,33 +998,33 @@ function clearBoxShadow(nativeView) {
|
|
|
1004
998
|
* @returns
|
|
1005
999
|
*/
|
|
1006
1000
|
function generateShadowMaskPath(bounds, boxShadow, innerClipPath) {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1001
|
+
const shadowRadius = layout.toDeviceIndependentPixels(boxShadow.blurRadius);
|
|
1002
|
+
const spreadRadius = layout.toDeviceIndependentPixels(boxShadow.spreadRadius);
|
|
1003
|
+
const offsetX = layout.toDeviceIndependentPixels(boxShadow.offsetX);
|
|
1004
|
+
const offsetY = layout.toDeviceIndependentPixels(boxShadow.offsetY);
|
|
1011
1005
|
// This value has to be large enough to avoid clipping shadow halo effect
|
|
1012
|
-
|
|
1013
|
-
|
|
1006
|
+
const outerRectRadius = shadowRadius * 3 + spreadRadius;
|
|
1007
|
+
const maskPath = CGPathCreateMutable();
|
|
1014
1008
|
// Proper clip position and size
|
|
1015
|
-
|
|
1009
|
+
const outerRect = CGRectOffset(CGRectInset(bounds, -outerRectRadius, -outerRectRadius), offsetX, offsetY);
|
|
1016
1010
|
CGPathAddPath(maskPath, null, innerClipPath);
|
|
1017
1011
|
CGPathAddRect(maskPath, null, outerRect);
|
|
1018
1012
|
return maskPath;
|
|
1019
1013
|
}
|
|
1020
1014
|
function rectPath(value, position) {
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1015
|
+
const arr = value.split(/[\s]+/);
|
|
1016
|
+
const top = cssValueToDeviceIndependentPixels(arr[0], position.top);
|
|
1017
|
+
const right = cssValueToDeviceIndependentPixels(arr[1], position.right);
|
|
1018
|
+
const bottom = cssValueToDeviceIndependentPixels(arr[2], position.bottom);
|
|
1019
|
+
const left = cssValueToDeviceIndependentPixels(arr[3], position.left);
|
|
1026
1020
|
return UIBezierPath.bezierPathWithRect(CGRectMake(left, top, right - left, bottom - top)).CGPath;
|
|
1027
1021
|
}
|
|
1028
1022
|
function insetPath(value, position) {
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1023
|
+
const arr = value.split(/[\s]+/);
|
|
1024
|
+
let topString;
|
|
1025
|
+
let rightString;
|
|
1026
|
+
let bottomString;
|
|
1027
|
+
let leftString;
|
|
1034
1028
|
if (arr.length === 1) {
|
|
1035
1029
|
topString = rightString = bottomString = leftString = arr[0];
|
|
1036
1030
|
}
|
|
@@ -1049,38 +1043,38 @@ function insetPath(value, position) {
|
|
|
1049
1043
|
bottomString = arr[2];
|
|
1050
1044
|
leftString = arr[3];
|
|
1051
1045
|
}
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1046
|
+
const top = cssValueToDeviceIndependentPixels(topString, position.bottom);
|
|
1047
|
+
const right = cssValueToDeviceIndependentPixels('100%', position.right) - cssValueToDeviceIndependentPixels(rightString, position.right);
|
|
1048
|
+
const bottom = cssValueToDeviceIndependentPixels('100%', position.bottom) - cssValueToDeviceIndependentPixels(bottomString, position.bottom);
|
|
1049
|
+
const left = cssValueToDeviceIndependentPixels(leftString, position.right);
|
|
1056
1050
|
return UIBezierPath.bezierPathWithRect(CGRectMake(left, top, right - left, bottom - top)).CGPath;
|
|
1057
1051
|
}
|
|
1058
1052
|
function circlePath(value, position) {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1053
|
+
const arr = value.split(/[\s]+/);
|
|
1054
|
+
const radius = cssValueToDeviceIndependentPixels(arr[0], (position.right > position.bottom ? position.bottom : position.right) / 2);
|
|
1055
|
+
const y = cssValueToDeviceIndependentPixels(arr[2], position.bottom);
|
|
1056
|
+
const x = cssValueToDeviceIndependentPixels(arr[3], position.right);
|
|
1063
1057
|
return UIBezierPath.bezierPathWithArcCenterRadiusStartAngleEndAngleClockwise(CGPointMake(x, y), radius, 0, 360, true).CGPath;
|
|
1064
1058
|
}
|
|
1065
1059
|
function ellipsePath(value, position) {
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1060
|
+
const arr = value.split(/[\s]+/);
|
|
1061
|
+
const rX = cssValueToDeviceIndependentPixels(arr[0], position.right);
|
|
1062
|
+
const rY = cssValueToDeviceIndependentPixels(arr[1], position.bottom);
|
|
1063
|
+
const cX = cssValueToDeviceIndependentPixels(arr[3], position.right);
|
|
1064
|
+
const cY = cssValueToDeviceIndependentPixels(arr[4], position.bottom);
|
|
1065
|
+
const left = cX - rX;
|
|
1066
|
+
const top = cY - rY;
|
|
1067
|
+
const width = rX * 2;
|
|
1068
|
+
const height = rY * 2;
|
|
1075
1069
|
return UIBezierPath.bezierPathWithOvalInRect(CGRectMake(left, top, width, height)).CGPath;
|
|
1076
1070
|
}
|
|
1077
1071
|
function polygonPath(value, position) {
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
for (
|
|
1082
|
-
|
|
1083
|
-
|
|
1072
|
+
const path = CGPathCreateMutable();
|
|
1073
|
+
let firstPoint;
|
|
1074
|
+
const arr = value.split(/[,]+/);
|
|
1075
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1076
|
+
const xy = arr[i].trim().split(/[\s]+/);
|
|
1077
|
+
const point = {
|
|
1084
1078
|
x: cssValueToDeviceIndependentPixels(xy[0], position.right),
|
|
1085
1079
|
y: cssValueToDeviceIndependentPixels(xy[1], position.bottom),
|
|
1086
1080
|
};
|