@tarojs/plugin-platform-harmony-ets 3.7.0-alpha.27 → 4.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/dist/apis/apis.ts +6 -2
  2. package/dist/apis/base/crypto.ts +4 -0
  3. package/dist/apis/base/debug.ts +5 -0
  4. package/dist/apis/base/index.ts +9 -1
  5. package/dist/apis/base/performance.ts +8 -0
  6. package/dist/apis/base/system.ts +74 -21
  7. package/dist/apis/base/update.ts +5 -0
  8. package/dist/apis/base/weapp/app-event.ts +75 -0
  9. package/dist/apis/base/weapp/life-cycle.ts +21 -0
  10. package/dist/apis/canvas/index.ts +27 -0
  11. package/dist/apis/data-analysis/index.ts +6 -0
  12. package/dist/apis/device/accelerometer.ts +2 -1
  13. package/dist/apis/device/accessibility.ts +4 -0
  14. package/dist/apis/device/battery.ts +2 -2
  15. package/dist/apis/device/bluetooth-ble.ts +19 -0
  16. package/dist/apis/device/bluetooth-peripheral.ts +6 -0
  17. package/dist/apis/device/bluetooth.ts +16 -0
  18. package/dist/apis/device/calendar.ts +5 -0
  19. package/dist/apis/device/clipboard.ts +17 -9
  20. package/dist/apis/device/compass.ts +21 -0
  21. package/dist/apis/device/contact.ts +5 -0
  22. package/dist/apis/device/crypto.ts +4 -0
  23. package/dist/apis/device/gyroscope.ts +7 -0
  24. package/dist/apis/device/iBeacon.ts +10 -0
  25. package/dist/apis/device/index.ts +15 -0
  26. package/dist/apis/device/keyboard.ts +2 -1
  27. package/dist/apis/device/memory.ts +10 -3
  28. package/dist/apis/device/motion.ts +6 -0
  29. package/dist/apis/device/network.ts +26 -9
  30. package/dist/apis/device/nfc.ts +10 -0
  31. package/dist/apis/device/phone.ts +2 -1
  32. package/dist/apis/device/scan.ts +4 -0
  33. package/dist/apis/device/screen.ts +2 -1
  34. package/dist/apis/device/sms.ts +4 -0
  35. package/dist/apis/device/vibrate.ts +19 -11
  36. package/dist/apis/device/wifi.ts +15 -0
  37. package/dist/apis/ext/index.ts +5 -0
  38. package/dist/apis/files/index.ts +2 -1
  39. package/dist/apis/files/manager.ts +2 -1
  40. package/dist/apis/framework/index.ts +3 -8
  41. package/dist/apis/index.ts +27 -17
  42. package/dist/apis/location/index.ts +61 -68
  43. package/dist/apis/media/EditorContext.ts +32 -0
  44. package/dist/apis/media/audio/index.ts +18 -0
  45. package/dist/apis/media/background-audio/index.ts +16 -0
  46. package/dist/apis/media/camera.ts +16 -0
  47. package/dist/apis/media/common.ts +2 -1
  48. package/dist/apis/media/{image.ts → image/index.ts} +4 -3
  49. package/dist/apis/media/index.ts +10 -0
  50. package/dist/apis/media/live.ts +5 -0
  51. package/dist/apis/media/map.ts +4 -0
  52. package/dist/apis/media/media-recorder.ts +4 -0
  53. package/dist/apis/media/recorder.ts +6 -0
  54. package/dist/apis/media/video/VideoContext.ts +68 -0
  55. package/dist/apis/media/{video.ts → video/index.ts} +13 -2
  56. package/dist/apis/media/video-decoder.ts +4 -0
  57. package/dist/apis/media/video-processing.ts +4 -0
  58. package/dist/apis/media/voip.ts +19 -0
  59. package/dist/apis/network/index.ts +3 -0
  60. package/dist/apis/network/mdns.ts +13 -0
  61. package/dist/apis/network/request.ts +7 -6
  62. package/dist/apis/network/tcp.ts +4 -0
  63. package/dist/apis/network/udp.ts +4 -0
  64. package/dist/apis/network/webSocket.ts +2 -6
  65. package/dist/apis/open-api/account.ts +4 -0
  66. package/dist/apis/open-api/address.ts +4 -0
  67. package/dist/apis/open-api/authorize.ts +5 -0
  68. package/dist/apis/open-api/card.ts +5 -0
  69. package/dist/apis/open-api/channels-live.ts +11 -0
  70. package/dist/apis/open-api/customer-service.ts +4 -0
  71. package/dist/apis/open-api/device-voip.ts +5 -0
  72. package/dist/apis/open-api/facial.ts +7 -0
  73. package/dist/apis/open-api/favorites.ts +5 -0
  74. package/dist/apis/open-api/group.ts +4 -0
  75. package/dist/apis/open-api/index.ts +20 -6
  76. package/dist/apis/open-api/invoice.ts +5 -0
  77. package/dist/apis/open-api/license-plate.ts +4 -0
  78. package/dist/apis/open-api/login.ts +6 -0
  79. package/dist/apis/open-api/my-miniprogram.ts +4 -0
  80. package/dist/apis/open-api/privacy.ts +7 -0
  81. package/dist/apis/open-api/red-package.ts +4 -0
  82. package/dist/apis/open-api/settings.ts +5 -0
  83. package/dist/apis/open-api/soter.ts +6 -0
  84. package/dist/apis/open-api/subscribe-message.ts +6 -0
  85. package/dist/apis/open-api/{user-info/index.ts → user-info.ts} +1 -16
  86. package/dist/apis/open-api/werun.ts +5 -0
  87. package/dist/apis/payment/index.ts +6 -0
  88. package/dist/apis/route/index.ts +19 -28
  89. package/dist/apis/share/index.ts +33 -0
  90. package/dist/apis/storage/background-fetch.ts +7 -0
  91. package/dist/apis/storage/cache-manager.ts +4 -0
  92. package/dist/apis/storage/index.ts +158 -88
  93. package/dist/apis/ui/{animation.ts → animation/animation.ts} +73 -31
  94. package/dist/apis/ui/animation/index.ts +7 -0
  95. package/dist/apis/ui/background.ts +4 -19
  96. package/dist/apis/ui/custom-component.ts +8 -0
  97. package/dist/apis/ui/fonts.ts +4 -0
  98. package/dist/apis/ui/index.ts +8 -10
  99. package/dist/apis/ui/interaction/index.ts +45 -59
  100. package/dist/apis/ui/menu.ts +4 -0
  101. package/dist/apis/ui/navigation-bar/index.ts +60 -21
  102. package/dist/apis/ui/pull-down-refresh.ts +10 -4
  103. package/dist/apis/{page → ui/scroll}/index.ts +32 -27
  104. package/dist/apis/ui/sticky.ts +4 -0
  105. package/dist/apis/{tabbar/index.ts → ui/tab-bar.ts} +6 -8
  106. package/dist/apis/ui/window.ts +20 -0
  107. package/dist/apis/utils/handler.ts +4 -4
  108. package/dist/apis/utils/index.ts +1 -1
  109. package/dist/apis/worker/index.ts +4 -0
  110. package/dist/apis/wxml/IntersectionObserver.ts +24 -25
  111. package/dist/apis/wxml/index.ts +7 -2
  112. package/dist/apis/wxml/nodesRef.ts +2 -2
  113. package/dist/apis/wxml/selectorQuery.ts +29 -17
  114. package/dist/components-harmony-ets/button.ets +106 -80
  115. package/dist/components-harmony-ets/canvas.ets +51 -0
  116. package/dist/components-harmony-ets/checkbox.ets +82 -148
  117. package/dist/components-harmony-ets/form.ets +45 -132
  118. package/dist/components-harmony-ets/icon.ets +66 -69
  119. package/dist/components-harmony-ets/image.ets +26 -61
  120. package/dist/components-harmony-ets/index.ets +92 -0
  121. package/dist/components-harmony-ets/innerHtml.ets +7 -70
  122. package/dist/components-harmony-ets/input.ets +60 -146
  123. package/dist/components-harmony-ets/label.ets +86 -92
  124. package/dist/components-harmony-ets/listView.ets +26 -0
  125. package/dist/components-harmony-ets/movableArea.ets +124 -0
  126. package/dist/components-harmony-ets/movableView.ets +93 -0
  127. package/dist/components-harmony-ets/navigationBar.ets +65 -0
  128. package/dist/components-harmony-ets/pageMeta.ets +94 -0
  129. package/dist/components-harmony-ets/picker.ets +172 -198
  130. package/dist/components-harmony-ets/progress.ets +52 -0
  131. package/dist/components-harmony-ets/pseudo.ets +80 -0
  132. package/dist/components-harmony-ets/radio.ets +85 -155
  133. package/dist/components-harmony-ets/richText.ets +15 -87
  134. package/dist/components-harmony-ets/scrollList.ets +94 -0
  135. package/dist/components-harmony-ets/scrollView.ets +81 -149
  136. package/dist/components-harmony-ets/slider.ets +47 -94
  137. package/dist/components-harmony-ets/stickySection.ets +42 -0
  138. package/dist/components-harmony-ets/style.ets +396 -0
  139. package/dist/components-harmony-ets/swiper.ets +51 -151
  140. package/dist/components-harmony-ets/switch.ets +35 -76
  141. package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
  142. package/dist/components-harmony-ets/text.ets +131 -76
  143. package/dist/components-harmony-ets/textArea.ets +64 -140
  144. package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
  145. package/dist/components-harmony-ets/utils/DynamicCenter.ts +4 -13
  146. package/dist/components-harmony-ets/utils/constant/style.ets +9 -6
  147. package/dist/components-harmony-ets/utils/flexManager.ets +68 -85
  148. package/dist/components-harmony-ets/utils/helper.ets +18 -65
  149. package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
  150. package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
  151. package/dist/components-harmony-ets/utils/index.ts +55 -51
  152. package/dist/components-harmony-ets/utils/styles.ets +177 -65
  153. package/dist/components-harmony-ets/video.ets +70 -116
  154. package/dist/components-harmony-ets/view.ets +58 -64
  155. package/dist/components-harmony-ets/webView.ets +56 -0
  156. package/dist/index.d.ts +152 -0
  157. package/dist/index.js +230 -60
  158. package/dist/index.js.map +1 -1
  159. package/dist/runtime-ets/bom/document.ts +6 -4
  160. package/dist/runtime-ets/bom/getComputedStyle.ts +2 -2
  161. package/dist/runtime-ets/bom/window.ts +9 -2
  162. package/dist/runtime-ets/current.ts +3 -0
  163. package/dist/runtime-ets/dom/bind.ts +96 -0
  164. package/dist/runtime-ets/dom/class-list.ts +4 -6
  165. package/dist/runtime-ets/dom/comment.ts +1 -2
  166. package/dist/runtime-ets/dom/cssNesting.ts +409 -0
  167. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -20
  168. package/dist/runtime-ets/dom/dataSource.ts +64 -0
  169. package/dist/runtime-ets/dom/document.ts +36 -51
  170. package/dist/runtime-ets/dom/element/canvas.ts +136 -0
  171. package/dist/runtime-ets/dom/element/element.ts +439 -0
  172. package/dist/runtime-ets/dom/element/form.ts +403 -0
  173. package/dist/runtime-ets/dom/element/index.ts +120 -0
  174. package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
  175. package/dist/runtime-ets/dom/element/movableView.ts +242 -0
  176. package/dist/runtime-ets/dom/element/normal.ts +103 -0
  177. package/dist/runtime-ets/dom/element/progress.ts +11 -0
  178. package/dist/runtime-ets/dom/element/scrollView.ts +15 -0
  179. package/dist/runtime-ets/dom/element/text.ts +10 -0
  180. package/dist/runtime-ets/dom/element/video.ts +50 -0
  181. package/dist/runtime-ets/dom/element/webView.ts +68 -0
  182. package/dist/runtime-ets/dom/event.ts +26 -5
  183. package/dist/runtime-ets/dom/eventTarget.ts +3 -3
  184. package/dist/runtime-ets/dom/node.ts +114 -49
  185. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +805 -0
  186. package/dist/runtime-ets/dom/stylesheet/index.ts +122 -429
  187. package/dist/runtime-ets/dom/stylesheet/type.ts +93 -17
  188. package/dist/runtime-ets/dom/stylesheet/util.ts +145 -17
  189. package/dist/runtime-ets/index.ts +2 -3
  190. package/dist/runtime-ets/interface/event.ts +3 -2
  191. package/dist/runtime-ets/utils/index.ts +87 -17
  192. package/dist/runtime-ets/utils/info.ts +21 -47
  193. package/dist/runtime-framework/react/app.ts +20 -28
  194. package/dist/runtime-framework/react/hooks.ts +3 -4
  195. package/dist/runtime-framework/react/index.ts +1 -2
  196. package/dist/runtime-framework/react/native-page.ts +421 -0
  197. package/dist/runtime-framework/react/page.ts +5 -17
  198. package/dist/runtime-framework/solid/app.ts +25 -45
  199. package/dist/runtime-framework/solid/connect.ts +21 -3
  200. package/dist/runtime-framework/solid/hooks.ts +17 -12
  201. package/dist/runtime-framework/solid/index.ts +6 -2
  202. package/dist/runtime-framework/solid/page.ts +84 -36
  203. package/dist/runtime-framework/solid/reconciler/props.ts +70 -25
  204. package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
  205. package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
  206. package/dist/runtime-framework/solid/utils/index.ts +0 -2
  207. package/dist/runtime-utils.d.ts +827 -0
  208. package/dist/runtime-utils.js +1633 -549
  209. package/dist/runtime-utils.js.map +1 -1
  210. package/dist/runtime.d.ts +1 -0
  211. package/dist/runtime.js +1633 -549
  212. package/dist/runtime.js.map +1 -1
  213. package/index.js +3 -1
  214. package/package.json +14 -15
  215. package/static/media/cancel.svg +1 -0
  216. package/static/media/circle.svg +1 -0
  217. package/static/media/clear.svg +1 -0
  218. package/static/media/download.svg +1 -0
  219. package/static/media/info.svg +1 -0
  220. package/static/media/info_circle.svg +1 -0
  221. package/static/media/search.svg +1 -0
  222. package/static/media/success.svg +1 -0
  223. package/static/media/success_no_circle.svg +1 -0
  224. package/static/media/taro_arrow_left.svg +1 -0
  225. package/static/media/taro_home.svg +1 -0
  226. package/static/media/waiting.svg +1 -0
  227. package/static/media/warn.svg +1 -0
  228. package/types/harmony.d.ts +4 -0
  229. package/types/index.d.ts +4 -0
  230. package/types/runtime.d.ts +7 -1
  231. package/LICENSE +0 -160
  232. package/dist/components-harmony-ets/base.ets +0 -63
  233. package/dist/components-harmony-ets/element.ets +0 -223
  234. package/dist/components-harmony-ets/utils/constant/icon.ts +0 -19
  235. package/dist/runtime-ets/dom/element.ts +0 -457
  236. package/dist/runtime-ets/dom/text.ts +0 -19
  237. package/dist/runtime-ets/utils/bind.ts +0 -35
  238. package/types/api.d.ts +0 -4
  239. /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
@@ -1,347 +1,154 @@
1
1
  /* eslint-disable accessor-pairs */
2
2
  // @ts-nocheck
3
- import matrix4 from '@ohos.matrix4'
4
-
5
- import { ObjectAssign, TaroAny } from '../../'
6
- import { FlexManager, getNodeMarginOrPaddingData, getUnit } from './util'
3
+ import { BORDER_STYLE_MAP, FlexManager } from './util'
7
4
 
8
5
  import type { HarmonyStyle, HarmonyType, TaroStyleType, TaroTextStyleType } from './type'
9
6
 
10
7
  export { HarmonyStyle, HarmonyType, TaroStyleType, TaroTextStyleType }
11
8
 
12
9
  export default class StyleSheet {
13
-
14
10
  public hmStyle: HarmonyStyle = {}
15
11
 
16
12
  get display () {
17
13
  return this.hmStyle.display
18
14
  }
19
15
 
20
- set display (value: string) {
21
- this.hmStyle.display = value
22
- }
23
-
24
16
  get position () {
25
17
  return this.hmStyle.position
26
18
  }
27
19
 
28
- set position (value: string) {
29
- this.hmStyle.position = value
30
- }
31
-
32
20
  get padding () {
33
- const { top = 0, right = 0, bottom = 0, left = 0 } = this.hmStyle.padding || {}
34
- return `${top} ${right} ${bottom} ${left}`
35
- }
36
-
37
- set padding (value: string) {
38
- this.hmStyle.padding = getNodeMarginOrPaddingData(value)
39
- }
40
-
41
- set _padding (value: Margin) {
42
- this.hmStyle.padding = value
21
+ return `${this.hmStyle.paddingTop} ${this.hmStyle.paddingRight} ${this.hmStyle.paddingBottom} ${this.hmStyle.paddingLeft}`
43
22
  }
44
23
 
45
24
  get paddingTop () {
46
- return this.hmStyle.padding?.top
47
- }
48
-
49
- set paddingTop (value: string) {
50
- this.hmStyle.padding = ObjectAssign({}, this.hmStyle.padding, { top: getUnit(value) })
25
+ return this.hmStyle.paddingTop
51
26
  }
52
27
 
53
28
  get paddingBottom () {
54
- return this.hmStyle.padding?.bottom
55
- }
56
-
57
- set paddingBottom (value: string) {
58
- this.hmStyle.padding = ObjectAssign({}, this.hmStyle.padding, { bottom: getUnit(value) })
59
- }
60
-
61
- get paddingRight () {
62
- return this.hmStyle.padding?.right
63
- }
64
-
65
- set paddingRight (value: string) {
66
- this.hmStyle.padding = ObjectAssign({}, this.hmStyle.padding, { right: getUnit(value) })
29
+ return this.hmStyle.paddingBottom
67
30
  }
68
31
 
69
32
  get paddingLeft () {
70
- return this.hmStyle.padding?.left
33
+ return this.hmStyle.paddingLeft
71
34
  }
72
35
 
73
- set paddingLeft (value: string) {
74
- this.hmStyle.padding = ObjectAssign({}, this.hmStyle.padding, { left: getUnit(value) })
36
+ get paddingRight () {
37
+ return this.hmStyle.paddingRight
75
38
  }
76
39
 
77
40
  get margin () {
78
- const { top = 0, right = 0, bottom = 0, left = 0 } = this.hmStyle.margin || {}
79
- return `${top} ${right} ${bottom} ${left}`
80
- }
81
-
82
- set margin (value: string) {
83
- this.hmStyle.margin = getNodeMarginOrPaddingData(value)
84
- }
85
-
86
- set _margin (value: Margin) {
87
- this.hmStyle.margin = value
41
+ return `${this.hmStyle.marginTop} ${this.hmStyle.marginRight} ${this.hmStyle.marginBottom} ${this.hmStyle.marginLeft}`
88
42
  }
89
43
 
90
44
  get marginTop () {
91
- return this.hmStyle.margin?.top
92
- }
93
-
94
- set marginTop (value: string) {
95
- this.hmStyle.margin = ObjectAssign({}, this.hmStyle.margin, { top: getUnit(value) })
45
+ return this.hmStyle.marginTop
96
46
  }
97
47
 
98
48
  get marginBottom () {
99
- return this.hmStyle.margin?.bottom
100
- }
101
-
102
- set marginBottom (value: string) {
103
- this.hmStyle.margin = ObjectAssign({}, this.hmStyle.margin, { bottom: getUnit(value) })
104
- }
105
-
106
- get marginRight () {
107
- return this.hmStyle.margin?.right
108
- }
109
-
110
- set marginRight (value: string) {
111
- this.hmStyle.margin = ObjectAssign({}, this.hmStyle.margin, { right: getUnit(value) })
49
+ return this.hmStyle.marginBottom
112
50
  }
113
51
 
114
52
  get marginLeft () {
115
- return this.hmStyle.margin?.left
53
+ return this.hmStyle.marginLeft
116
54
  }
117
55
 
118
- set marginLeft (value: string) {
119
- this.hmStyle.margin = ObjectAssign({}, this.hmStyle.margin, { left: getUnit(value) })
56
+ get marginRight () {
57
+ return this.hmStyle.marginRight
120
58
  }
121
59
 
122
60
  get top () {
123
61
  return this.hmStyle.top
124
62
  }
125
63
 
126
- set top (value: string | number) {
127
- this.hmStyle.top = getUnit(value)
128
- }
129
-
130
- set _top (value: Length) {
131
- this.hmStyle.top = value
132
- }
133
-
134
64
  get left () {
135
65
  return this.hmStyle.left
136
66
  }
137
67
 
138
- set left (value: string | number) {
139
- this.hmStyle.left = getUnit(value)
68
+ get right () {
69
+ return this.hmStyle.right
140
70
  }
141
71
 
142
- set _left (value: Length) {
143
- this.hmStyle.left = value
72
+ get bottom () {
73
+ return this.hmStyle.bottom
144
74
  }
145
75
 
146
- get flexBasis () {
147
- return this.hmStyle.flexBasis
76
+ get flex () {
77
+ return `${this.hmStyle.flexGrow} ${this.hmStyle.flexShrink} ${this.hmStyle.flexBasis}`
148
78
  }
149
79
 
150
- set flexBasis (value: string) {
151
- this.hmStyle.flexBasis = getUnit(value)
152
- }
153
-
154
- set _flexBasis (value: number | string) {
155
- this.hmStyle.flexBasis = value
80
+ get flexBasis () {
81
+ return this.hmStyle.flexBasis
156
82
  }
157
83
 
158
84
  get flexGrow () {
159
85
  return Number(this.hmStyle.flexGrow)
160
86
  }
161
87
 
162
- set flexGrow (value: number | string) {
163
- this.hmStyle.flexGrow = Number(value)
164
- }
165
-
166
- set _flexGrow (value: number) {
167
- this.hmStyle.flexGrow = value
168
- }
169
-
170
88
  get flexShrink () {
171
89
  return Number(this.hmStyle.flexShrink)
172
90
  }
173
91
 
174
- set flexShrink (value: number | string) {
175
- this.hmStyle.flexShrink = Number(value)
176
- }
177
-
178
- set _flexShrink (value: number) {
179
- this.hmStyle.flexShrink = value
180
- }
181
-
182
92
  get alignSelf () {
183
93
  return FlexManager.reverseItemAlign(this.hmStyle.alignSelf)
184
94
  }
185
95
 
186
- set alignSelf (value: string | number) {
187
- this.hmStyle.alignSelf = FlexManager.itemAlign(value)
188
- }
189
-
190
- set _alignSelf (value: ItemAlign) {
191
- this.hmStyle.alignSelf = value
192
- }
193
-
194
- set _flexOptions (value) {
195
- if (typeof value.direction !== 'undefined') {
196
- this.hmStyle.direction = value.direction
197
- }
198
- if (typeof value.justifyContent !== 'undefined') {
199
- this.hmStyle.justifyContent = value.justifyContent
200
- }
201
- if (typeof value.alignItems !== 'undefined') {
202
- this.hmStyle.alignItems = value.alignItems
203
- }
204
- }
205
-
206
96
  get flexDirection () {
207
- return FlexManager.reverseDirection(this.hmStyle.direction)
208
- }
209
-
210
- set flexDirection (value: string) {
211
- this.hmStyle.direction = FlexManager.direction(value)
212
- }
213
-
214
- set _direction (value: FlexDirection) {
215
- this.hmStyle.direction = value
97
+ return FlexManager.reverseDirection(this.hmStyle.flexDirection)
216
98
  }
217
99
 
218
100
  get justifyContent () {
219
101
  return FlexManager.reverseFlexAlign(this.hmStyle.justifyContent)
220
102
  }
221
103
 
222
- set justifyContent (value: string) {
223
- this.hmStyle.justifyContent = FlexManager.flexAlign(value)
224
- }
225
-
226
- set _justifyContent (value: FlexAlign) {
227
- this.hmStyle.justifyContent = value
228
- }
229
-
230
104
  get alignItems () {
231
105
  return FlexManager.reverseItemAlign(this.hmStyle.alignItems)
232
106
  }
233
107
 
234
- set alignItems (value: string) {
235
- this.hmStyle.alignItems = FlexManager.itemAlign(value)
108
+ get alignContent () {
109
+ return FlexManager.reverseFlexAlign(this.hmStyle.alignContent)
236
110
  }
237
111
 
238
- set _alignItems (value: ItemAlign) {
239
- this.hmStyle.alignItems = value
112
+ get flexWrap () {
113
+ return FlexManager.reverseFlexWrap(this.hmStyle.flexWrap)
240
114
  }
241
115
 
242
116
  get width () {
243
117
  return this.hmStyle.width
244
118
  }
245
119
 
246
- set width (value: string | number) {
247
- this.hmStyle.width = getUnit(value)
248
- }
249
-
250
- set _width (value: Length) {
251
- this.hmStyle.width = value
252
- }
253
-
254
120
  get height () {
255
121
  return this.hmStyle.height
256
122
  }
257
123
 
258
- set height (value: string | number) {
259
- this.hmStyle.height = getUnit(value)
260
- }
261
-
262
- set _height (value: Length) {
263
- this.hmStyle.height = value
264
- }
265
-
266
- set _constraintSize(value: ConstraintSizeOptions) {
267
- this.hmStyle.constraintSize = value
268
- }
269
-
270
124
  get minHeight () {
271
- return this.hmStyle.constraintSize?.minHeight
272
- }
273
-
274
- set minHeight (value: string | number) {
275
- this._minHeight = getUnit(value)
125
+ return this.hmStyle.minHeight
276
126
  }
277
127
 
278
128
  get maxHeight () {
279
- return this.hmStyle.constraintSize?.maxHeight
280
- }
281
-
282
- set maxHeight (value: string | number) {
283
- this._maxHeight = getUnit(value)
129
+ return this.hmStyle.maxHeight
284
130
  }
285
131
 
286
132
  get minWidth () {
287
- return this.hmStyle.constraintSize?.minWidth
288
- }
289
-
290
- set minWidth (value: string | number) {
291
- this._minWidth = getUnit(value)
133
+ return this.hmStyle.minWidth
292
134
  }
293
135
 
294
136
  get maxWidth () {
295
- return this.hmStyle.constraintSize?.maxWidth
296
- }
297
-
298
- set maxWidth (value: string | number) {
299
- this._maxWidth = getUnit(value)
137
+ return this.hmStyle.maxWidth
300
138
  }
301
139
 
302
140
  get background () {
303
141
  return `${this.backgroundColor} ${this.backgroundImage} ${this.backgroundRepeat} ${this.backgroundSize}`.trim()
304
142
  }
305
143
 
306
- // TODO: 未实现
307
- set background (value: string) {
308
-
309
- }
310
-
311
- set _background (value: TaroAny) {
312
- const _backgroundImage: HarmonyType.Background.backgroundImage = value?.image?.[0]
313
- if (_backgroundImage) {
314
- this.hmStyle.backgroundImage = _backgroundImage.src
315
- if (_backgroundImage.repeat) {
316
- this.hmStyle.backgroundRepeat = _backgroundImage.repeat
317
- }
318
- }
319
- this.hmStyle.backgroundImageSize = value?.size?.[0]
320
- this.hmStyle.backgroundColor = this.hmStyle.backgroundImage ? null : value?.color
321
- }
322
-
323
144
  get backgroundColor () {
324
145
  return this.hmStyle.backgroundColor
325
146
  }
326
147
 
327
- set backgroundColor (value: string) {
328
- this.hmStyle.backgroundColor = value
329
- }
330
-
331
148
  get backgroundImage () {
332
149
  return this.hmStyle.backgroundImage && `url(${this.hmStyle.backgroundImage})`
333
150
  }
334
151
 
335
- set backgroundImage (value: string) {
336
- if (typeof value === 'string' && value.indexOf('url(') !== -1 && value.indexOf(')') !== -1) {
337
- // 如果包含 url(),则说明是 background-image 属性
338
- const match = value.match(new RegExp('url\\([\'"]?(.*?)[\'"]?\\)'))
339
- if (match) {
340
- this.hmStyle.backgroundImage = match[1]
341
- }
342
- }
343
- }
344
-
345
152
  get backgroundRepeat () {
346
153
  if (this.hmStyle.backgroundRepeat) {
347
154
  switch (this.hmStyle.backgroundRepeat) {
@@ -349,34 +156,33 @@ export default class StyleSheet {
349
156
  case ImageRepeat.Y: return 'repeat-y'; break
350
157
  case ImageRepeat.XY: return 'repeat'; break
351
158
  case ImageRepeat.NoRepeat: return 'no-repeat'; break
352
- }
353
- }
354
- }
355
-
356
- set backgroundRepeat (value: string) {
357
- if (typeof value === 'string') {
358
- switch (value) {
359
- case 'repeat-x': this.hmStyle.backgroundRepeat = ImageRepeat.X; break
360
- case 'repeat-y': this.hmStyle.backgroundRepeat = ImageRepeat.Y; break
361
- case 'no-repeat': this.hmStyle.backgroundRepeat = ImageRepeat.NoRepeat; break
362
- default: this.hmStyle.backgroundRepeat = ImageRepeat.XY; break
363
159
  }
364
160
  }
365
161
  }
366
162
 
367
163
  get backgroundSize () {
368
164
  if (this.hmStyle.backgroundImage) {
369
- return [this.hmStyle.backgroundImageSize.width, this.hmStyle.backgroundImageSize.height].join(' ')
165
+ return [this.hmStyle.backgroundSize.width, this.hmStyle.backgroundSize.height].join(' ')
370
166
  }
371
167
  }
372
168
 
373
- set backgroundSize (value: string) {
374
- if (typeof value === 'string') {
375
- const sizes = value.split(' ')
376
- if (sizes.length === 1) {
377
- this.hmStyle.backgroundImageSize = { width: getUnit(sizes[0]) }
378
- } else if (sizes.length === 2) {
379
- this.hmStyle.backgroundImageSize = { width: getUnit(sizes[0]), height: getUnit(sizes[1]) }
169
+ get backgroundPosition () {
170
+ if (this.hmStyle.backgroundPosition) {
171
+ switch (this.hmStyle.backgroundPosition) {
172
+ case Alignment.TopStart: return 'left top'; break
173
+ case Alignment.Top: return 'center top'; break
174
+ case Alignment.TopEnd: return 'right top'; break
175
+ case Alignment.Start: return 'left center'; break
176
+ case Alignment.Center: return 'center center'; break
177
+ case Alignment.End: return 'right center'; break
178
+ case Alignment.BottomStart: return 'left bottom'; break
179
+ case Alignment.Bottom: return 'center bottom'; break
180
+ case Alignment.BottomEnd: return 'right bottom'; break
181
+ default: {
182
+ if (this.hmStyle.backgroundPosition) {
183
+ return [this.hmStyle.backgroundPosition, this.hmStyle.backgroundPosition.y].join(' ')
184
+ }
185
+ }
380
186
  }
381
187
  }
382
188
  }
@@ -385,99 +191,100 @@ export default class StyleSheet {
385
191
  return [this.borderWidth, this.borderStyle, this.bordercolor].join(' ')
386
192
  }
387
193
 
388
- set border (value: string) {
389
- const [width, style, color] = value.split(' ')
390
- this.hmStyle.borderWidth = getUnit(width)
391
- this.hmStyle.borderStyle = BORDERhmStyleYLE_MAP.get(style)
392
- this.hmStyle.borderColor = color
393
- }
394
-
395
194
  get borderWidth () {
396
195
  return this.hmStyle.borderWidth
397
196
  }
398
197
 
399
- set borderWidth (value: string) {
400
- this.hmStyle.borderWidth = getUnit(value)
198
+ get borderLeftWidth () {
199
+ return this.hmStyle.borderLeftWidth
401
200
  }
402
201
 
403
- set _borderWidth (value: Length | EdgeWidths) {
404
- this.hmStyle.borderWidth = value
202
+ get borderRightWidth () {
203
+ return this.hmStyle.borderRightWidth
204
+ }
205
+
206
+ get borderTopWidth () {
207
+ return this.hmStyle.borderTopWidth
208
+ }
209
+
210
+ get borderBottomWidth () {
211
+ return this.hmStyle.borderBottomWidth
405
212
  }
406
213
 
407
214
  get borderColor () {
408
215
  return this.hmStyle.borderColor
409
216
  }
410
217
 
411
- set borderColor (value: string) {
412
- this.hmStyle.borderColor = value
218
+ get borderLeftColor () {
219
+ return this.hmStyle.borderLeftColor
413
220
  }
414
221
 
415
- set _borderColor (value: ResourceColor | EdgeColors) {
416
- this.hmStyle.borderColor = value
222
+ get borderRightColor () {
223
+ return this.hmStyle.borderRightColor
417
224
  }
418
225
 
419
- get borderStyle () {
420
- return BORDERhmStyleYLE_MAP.reverse(this.hmStyle.borderStyle)
226
+ get borderTopColor () {
227
+ return this.hmStyle.borderTopColor
421
228
  }
422
229
 
423
- set borderStyle (value: string) {
424
- this.hmStyle.borderStyle = BORDERhmStyleYLE_MAP.get(value)
230
+ get borderBottomColor () {
231
+ return this.hmStyle.borderBottomColor
425
232
  }
426
233
 
427
- set _borderStyle (value: BorderStyle | EdgeStyles) {
428
- this.hmStyle.borderStyle = value
234
+ get borderStyle () {
235
+ return BORDER_STYLE_MAP.reverse(this.hmStyle.borderStyle)
429
236
  }
430
-
431
- get borderRadius () {
432
- return this.hmStyle.borderRadius
237
+
238
+ get borderLeftStyle () {
239
+ return BORDER_STYLE_MAP.reverse(this.hmStyle.borderLeftStyle)
433
240
  }
434
241
 
435
- set borderRadius (value: string) {
436
- this.hmStyle.borderRadius = getUnit(value)
242
+ get borderRightStyle () {
243
+ return BORDER_STYLE_MAP.reverse(this.hmStyle.borderRightStyle)
437
244
  }
438
245
 
439
- set _borderRadius (value: Length | BorderRadiuses) {
440
- this.hmStyle.borderRadius = value
246
+ get borderTopStyle () {
247
+ return BORDER_STYLE_MAP.reverse(this.hmStyle.borderTopStyle)
441
248
  }
442
249
 
443
- get zIndex (): number {
444
- return Number(this.hmStyle.zIndex)
250
+ get borderBottomStyle () {
251
+ return BORDER_STYLE_MAP.reverse(this.hmStyle.borderBottomStyle)
445
252
  }
446
253
 
447
- set zIndex (value: string) {
448
- this.hmStyle.zIndex = Number(value)
254
+ get borderRadius () {
255
+ return this.hmStyle.borderRadius
449
256
  }
450
257
 
451
- get opacity () {
452
- return this.hmStyle.opacity
258
+ get borderTopLeftRadius () {
259
+ return this.hmStyle.borderTopLeftRadius
453
260
  }
454
261
 
455
- set opacity (value: string) {
456
- this.hmStyle.opacity = Number(value)
262
+ get borderTopRightRadius () {
263
+ return this.hmStyle.borderTopRightRadius
457
264
  }
458
265
 
459
- get overflow () {
460
- return this.hmStyle.clip ? 'hidden' : 'visible'
266
+ get borderBottomLeftRadius () {
267
+ return this.hmStyle.borderBottomLeftRadius
461
268
  }
462
269
 
463
- set overflow (value: string) {
464
- this.hmStyle.clip = value === 'hidden'
270
+ get borderBottomRightRadius () {
271
+ return this.hmStyle.borderBottomRightRadius
465
272
  }
466
273
 
467
- set _overflow (value: boolean) {
468
- this.hmStyle.clip = value
274
+ get zIndex () {
275
+ return this.hmStyle.zIndex
469
276
  }
470
277
 
471
- get focus () {
472
- return !!this.hmStyle.focus
278
+ get opacity () {
279
+ return this.hmStyle.opacity
473
280
  }
474
281
 
475
- set focus (value: boolean) {
476
- this.hmStyle.focus = value
282
+ get overflow () {
283
+ return this.hmStyle.overflow ? 'hidden' : 'visible'
477
284
  }
478
285
 
479
- set _focus (value: boolean) {
480
- this.hmStyle.focus = value
286
+ get focus () {
287
+ return !!this.hmStyle.focus
481
288
  }
482
289
 
483
290
  // 文本相关
@@ -485,50 +292,26 @@ export default class StyleSheet {
485
292
  return this.hmStyle.color
486
293
  }
487
294
 
488
- set color (value: string) {
489
- this.hmStyle.color = value
490
- }
491
-
492
- set _color (value: ResourceColor) {
493
- this.hmStyle.color = value
494
- }
495
-
496
295
  get fontSize () {
497
296
  return this.hmStyle.fontSize
498
297
  }
499
298
 
500
- set fontSize (value: string) {
501
- this.hmStyle.fontSize = getUnit(value)
502
- }
503
-
504
- set _fontSize (value: number | string | Resource) {
505
- this.hmStyle.fontSize = value
506
- }
507
-
508
299
  get fontWeight () {
509
300
  return this.hmStyle.fontWeight
510
301
  }
511
302
 
512
- set fontWeight (value: string) {
513
- this.hmStyle.fontWeight = value
514
- }
515
-
516
- set _fontWeight (value: number | FontWeight | string) {
517
- this.hmStyle.fontWeight = value
303
+ get fontStyle () {
304
+ switch (this.hmStyle.fontStyle) {
305
+ case FontStyle.Italic: return 'italic'; break
306
+ case FontStyle.Normal: return 'normal'; break
307
+ default: return ''
308
+ }
518
309
  }
519
310
 
520
311
  get fontFamily () {
521
312
  return this.hmStyle.fontFamily
522
313
  }
523
314
 
524
- set fontFamily (value: string) {
525
- this.hmStyle.fontFamily = value
526
- }
527
-
528
- set _fontFamily (value: string | Resource) {
529
- this.hmStyle.fontFamily = value
530
- }
531
-
532
315
  get textAlign () {
533
316
  switch (this.hmStyle.textAlign) {
534
317
  case TextAlign.End: return 'right'; break
@@ -538,68 +321,34 @@ export default class StyleSheet {
538
321
  }
539
322
  }
540
323
 
541
- set textAlign (value: string) {
542
- switch (value) {
543
- case 'right':
544
- return TextAlign.End
545
- case 'center':
546
- return TextAlign.Center
547
- default:
548
- return TextAlign.Start
324
+ get verticalAlign() {
325
+ switch (this.hmStyle.verticalAlign) {
326
+ case Alignment.Center: return 'middle'; break
327
+ case Alignment.Top: return 'top'; break
328
+ case Alignment.Bottom: return 'bottom'; break
329
+ default: return ''
549
330
  }
550
331
  }
551
332
 
552
- set _textAlign (value: TextAlign) {
553
- this.hmStyle.textAlign = value
554
- }
555
-
556
333
  get lineHeight () {
557
334
  return this.hmStyle.lineHeight
558
335
  }
559
336
 
560
- set lineHeight (value: string) {
561
- this.hmStyle.lineHeight = getUnit(value)
562
- }
563
-
564
- set _lineHeight (value: string | number | Resource) {
565
- this.hmStyle.lineHeight = value
566
- }
567
-
568
337
  get letterSpacing () {
569
338
  return this.hmStyle.letterSpacing
570
339
  }
571
340
 
572
- set letterSpacing (value: string) {
573
- this.hmStyle.letterSpacing = getUnit(value)
574
- }
575
-
576
- set _letterSpacing (value: number | string) {
577
- this.hmStyle.letterSpacing = value
578
- }
579
-
580
341
  get textDecoration () {
581
- switch (this.hmStyle.decoration) {
582
- case TextDecorationType.Underline: return 'underline'; break
583
- case TextDecorationType.Overline: return 'overline'; break
584
- case TextDecorationType.LineThrough: return 'line-through'; break
585
- case TextDecorationType.None: return 'none'; break
586
- default: return ''
587
- }
588
- }
589
-
590
- set textDecoration (value: string) {
591
- if (typeof value === 'string') {
592
- switch (value) {
593
- case 'underline': this.hmStyle.decoration = TextDecorationType.Underline; break
594
- case 'overline': this.hmStyle.decoration = TextDecorationType.Overline; break
595
- case 'line-through': this.hmStyle.decoration = TextDecorationType.LineThrough; break
596
- default: this.hmStyle.decoration = TextDecorationType.None; break
342
+ if (this.hmStyle.textDecoration) {
343
+ switch (this.hmStyle.textDecoration.type) {
344
+ case TextDecorationType.Underline: return 'underline'; break
345
+ case TextDecorationType.Overline: return 'overline'; break
346
+ case TextDecorationType.LineThrough: return 'line-through'; break
347
+ case TextDecorationType.None: return 'none'; break
348
+ default: return ''
597
349
  }
598
350
  }
599
- }
600
-
601
- set _textDecoration (value: TextDecorationType) {
602
- this.hmStyle.decoration = value
351
+ return ''
603
352
  }
604
353
 
605
354
  get textOverflow () {
@@ -613,75 +362,19 @@ export default class StyleSheet {
613
362
  }
614
363
  }
615
364
 
616
- set textOverflow (value: string) {
617
- if (typeof value === 'string') {
618
- let overflow = TextOverflow.None
619
- switch (value) {
620
- case 'clip': overflow = TextOverflow.Clip; break
621
- case 'ellipsis': overflow = TextOverflow.Ellipsis; break
622
- case 'marquee': overflow = TextOverflow.MARQUEE; break
623
- }
624
- this.hmStyle.textOverflow = {
625
- overflow
626
- }
627
- }
628
- }
629
-
630
- set _textOverflow (value: TextOverflow) {
631
- this.hmStyle.textOverflow = value
632
- }
633
-
634
365
  get WebkitLineClamp () {
635
- return Number(this.hmStyle.maxLines)
636
- }
637
-
638
- set WebkitLineClamp (value: string | number) {
639
- this.hmStyle.maxLines = Number(value)
640
- }
641
-
642
- set _WebkitLineClamp (value: number) {
643
- this.hmStyle.maxLines = value
366
+ return Number(this.hmStyle.WebkitLineClamp)
644
367
  }
645
368
 
646
- // TODO: 未实现转换为w3c
647
- get linearGradient (): HarmonyType.LinearGradient {
648
- return this.hmStyle.linearGradient
649
- }
650
-
651
- set _linearGradient (value: HarmonyType.LinearGradient[]) {
652
- this.hmStyle.linearGradient = value?.[0]
653
- }
654
-
655
369
  get transform () {
656
370
  return this.hmStyle.transform
657
371
  }
658
372
 
659
- set _tranform (value: HarmonyType.Transform.Transform) {
660
- this.hmStyle.transform = value
373
+ get transformOrigin () {
374
+ return this.hmStyle.transformOrigin
661
375
  }
662
- }
663
-
664
-
665
- class BORDERhmStyleYLE_MAP {
666
- static solid = BorderStyle.Solid
667
- static dotted = BorderStyle.Dotted
668
- static dashed = BorderStyle.Dashed
669
376
 
670
- static get(type: string): BorderStyle {
671
- switch (type) {
672
- case 'dotted': return BorderStyle.Dotted
673
- case 'dashed': return BorderStyle.Dashed
674
- default: return BorderStyle.Solid
675
- }
676
- }
677
-
678
- static reverse(type: BorderStyle): string {
679
- switch (type) {
680
- case BorderStyle.Dotted: return 'dotted'
681
- case BorderStyle.Dashed: return 'dashed'
682
- case BorderStyle.Solid: return 'solid'
683
- default: return ''
684
- }
685
-
377
+ get content () {
378
+ return this.hmStyle._content
686
379
  }
687
380
  }