@tarojs/plugin-platform-harmony-ets 4.0.0-beta.19 → 4.0.0-beta.20

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 (46) hide show
  1. package/dist/apis/wxml/IntersectionObserver.ts +5 -3
  2. package/dist/components-harmony-ets/button.ets +3 -2
  3. package/dist/components-harmony-ets/checkbox.ets +6 -3
  4. package/dist/components-harmony-ets/form.ets +5 -4
  5. package/dist/components-harmony-ets/icon.ets +8 -4
  6. package/dist/components-harmony-ets/image.ets +2 -0
  7. package/dist/components-harmony-ets/innerHtml.ets +5 -4
  8. package/dist/components-harmony-ets/input.ets +6 -4
  9. package/dist/components-harmony-ets/label.ets +5 -4
  10. package/dist/components-harmony-ets/movableArea.ets +8 -31
  11. package/dist/components-harmony-ets/movableView.ets +8 -31
  12. package/dist/components-harmony-ets/picker.ets +21 -16
  13. package/dist/components-harmony-ets/progress.ets +2 -0
  14. package/dist/components-harmony-ets/pseudo.ets +38 -31
  15. package/dist/components-harmony-ets/radio.ets +6 -3
  16. package/dist/components-harmony-ets/richText.ets +3 -1
  17. package/dist/components-harmony-ets/scrollView.ets +15 -36
  18. package/dist/components-harmony-ets/slider.ets +4 -2
  19. package/dist/components-harmony-ets/style.ets +62 -27
  20. package/dist/components-harmony-ets/swiper.ets +3 -2
  21. package/dist/components-harmony-ets/switch.ets +3 -1
  22. package/dist/components-harmony-ets/text.ets +10 -8
  23. package/dist/components-harmony-ets/textArea.ets +6 -4
  24. package/dist/components-harmony-ets/utils/helper.ets +3 -2
  25. package/dist/components-harmony-ets/utils/styles.ets +25 -93
  26. package/dist/components-harmony-ets/video.ets +2 -0
  27. package/dist/components-harmony-ets/view.ets +11 -32
  28. package/dist/components-harmony-ets/webView.ets +3 -1
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.js +10 -10
  31. package/dist/index.js.map +1 -1
  32. package/dist/runtime-ets/dom/cssNesting.ts +36 -10
  33. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +15 -40
  34. package/dist/runtime-ets/dom/document.ts +0 -3
  35. package/dist/runtime-ets/dom/element/element.ts +6 -5
  36. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +152 -217
  37. package/dist/runtime-ets/dom/stylesheet/index.ts +17 -315
  38. package/dist/runtime-ets/dom/stylesheet/type.ts +6 -2
  39. package/dist/runtime-ets/index.ts +1 -1
  40. package/dist/runtime-ets/utils/index.ts +24 -8
  41. package/dist/runtime-framework/react/native-page.ts +6 -4
  42. package/dist/runtime-utils.js +4 -3
  43. package/dist/runtime-utils.js.map +1 -1
  44. package/dist/runtime.js +4 -3
  45. package/dist/runtime.js.map +1 -1
  46. package/package.json +8 -8
@@ -4,82 +4,6 @@ import { CSSProperties } from 'react'
4
4
 
5
5
  import { BORDER_STYLE_MAP, capitalizeFirstLetter, FlexManager, getNodeMarginOrPaddingData, getUnit } from './util'
6
6
 
7
- export const WEB_STYLE_MAP = {
8
- padding: ['_paddingTop', '_paddingRight', '_paddingBottom', '_paddingLeft'],
9
- paddingTop: ['_paddingTop'],
10
- paddingRight: ['_paddingRight'],
11
- paddingBottom: ['_paddingBottom'],
12
- paddingLeft: ['_paddingLeft'],
13
- margin: ['_marginTop', '_marginRight', '_marginBottom', '_marginLeft'],
14
- marginTop: ['_marginTop'],
15
- marginRight: ['_marginRight'],
16
- marginBottom: ['_marginBottom'],
17
- marginLeft: ['_marginLeft'],
18
- position: ['_position'],
19
- top: ['_top'],
20
- left: ['_left'],
21
- flex: ['_flexGrow', '_flexShrink', '_flexBasis'],
22
- flexGrow: ['_flexGrow'],
23
- flexShrink: ['_flexShrink'],
24
- flexBasis: ['_flexBasis'],
25
- alignSelf: ['_alignSelf'],
26
- flexDirection: ['_flexDirection'],
27
- justifyContent: ['_justifyContent'],
28
- alignItems: ['_alignItems'],
29
- alignContent: ['_alignContent'],
30
- flexWrap: ['_flexWrap'],
31
- width: ['_width'],
32
- height: ['_height'],
33
- minWidth: ['_minWidth'],
34
- minHeight: ['_minHeight'],
35
- maxWidth: ['_maxWidth'],
36
- maxHeight: ['_maxHeight'],
37
- background: ['_backgroundColor', '_backgroundImage', '_backgroundRepeat', '_backgroundSize', '_backgroundPosition'],
38
- backgroundColor: ['_backgroundColor'],
39
- backgroundImage: ['_backgroundImage'],
40
- backgroundRepeat: ['_backgroundRepeat'],
41
- backgroundSize: ['_backgroundSize'],
42
- backgroundPosition: ['_backgroundPosition'],
43
- border: ['_borderTopWidth', '_borderRightWidth', '_borderBottomWidth', '_borderLeftWidth', '_borderTopStyle', '_borderRightStyle', '_borderBottomStyle', '_borderLeftStyle', '_borderTopColor', '_borderRightColor', '_borderBottomColor', '_borderLeftColor'],
44
- borderTop: ['_borderTopWidth', '_borderTopStyle', '_borderTopColor'],
45
- borderRight: ['_borderRightWidth', '_borderRightStyle', '_borderRightColor'],
46
- borderBottom: ['_borderBottomWidth', '_borderBottomStyle', '_borderBottomColor'],
47
- borderLeft: ['_borderLeftWidth', '_borderLeftStyle', '_borderLeftColor'],
48
- borderWidth: ['_borderTopWidth', '_borderRightWidth', '_borderBottomWidth', '_borderLeftWidth'],
49
- borderLeftWidth: ['_borderLeftWidth'],
50
- borderRightWidth: ['_borderRightWidth'],
51
- borderTopWidth: ['_borderTopWidth'],
52
- borderBottomWidth: ['_borderBottomWidth'],
53
- borderStyle: ['_borderTopStyle', '_borderRightStyle', '_borderBottomStyle', '_borderLeftStyle'],
54
- borderLeftStyle: ['_borderLeftStyle'],
55
- borderRightStyle: ['_borderRightStyle'],
56
- borderTopStyle: ['_borderTopStyle'],
57
- borderBottomStyle: ['_borderBottomStyle'],
58
- borderColor: ['_borderTopColor', '_borderRightColor', '_borderBottomColor', '_borderLeftColor'],
59
- borderLeftColor: ['_borderLeftColor'],
60
- borderRightColor: ['_borderRightColor'],
61
- borderTopColor: ['_borderTopColor'],
62
- borderBottomColor: ['_borderBottomColor'],
63
- borderRadius: ['_borderTopLeftRadius', '_borderTopRightRadius', '_borderBottomLeftRadius', '_borderBottomRightRadius'],
64
- borderTopLeftRadius: ['_borderTopLeftRadius'],
65
- borderTopRightRadius: ['_borderTopRightRadius'],
66
- borderBottomLeftRadius: ['_borderBottomLeftRadius'],
67
- borderBottomRightRadius: ['_borderBottomRightRadius'],
68
- color: ['_color'],
69
- fontSize: ['_fontSize'],
70
- fontWeight: ['_fontWeight'],
71
- fontStyle: ['_fontStyle'],
72
- textAlign: ['_textAlign'],
73
- verticalAlign: ['_align'],
74
- lineHeight: ['_lineHeight'],
75
- letterSpacing: ['_letterSpacing'],
76
- textDecoration: ['_textDecoration'],
77
- textOverflow: ['_textOverflow'],
78
- WebkitLineClamp: ['_WebkitLineClamp'],
79
- transform: ['_transform'],
80
- display: ['_display']
81
- }
82
-
83
7
  // 将web端的style转换为hm端的style
84
8
  export default function convertWebStyle2HmStyle(webStyle: CSSProperties) {
85
9
  const hmStyle: Record<string, any> = {}
@@ -88,58 +12,66 @@ export default function convertWebStyle2HmStyle(webStyle: CSSProperties) {
88
12
  switch (key) {
89
13
  case 'padding': {
90
14
  const { top, bottom, left, right } = getNodeMarginOrPaddingData(value)
91
- hmStyle._paddingTop = top
92
- hmStyle._paddingBottom = bottom
93
- hmStyle._paddingLeft = left
94
- hmStyle._paddingRight = right
15
+ hmStyle.paddingTop = top
16
+ hmStyle.paddingBottom = bottom
17
+ hmStyle.paddingLeft = left
18
+ hmStyle.paddingRight = right
95
19
  break
96
20
  }
97
21
  case 'paddingTop': {
98
- hmStyle._paddingTop = getUnit(value)
22
+ hmStyle.paddingTop = getUnit(value)
99
23
  break
100
24
  }
101
25
  case 'paddingBottom': {
102
- hmStyle._paddingBottom = getUnit(value)
26
+ hmStyle.paddingBottom = getUnit(value)
103
27
  break
104
28
  }
105
29
  case 'paddingLeft': {
106
- hmStyle._paddingLeft = getUnit(value)
30
+ hmStyle.paddingLeft = getUnit(value)
107
31
  break
108
32
  }
109
33
  case 'paddingRight': {
110
- hmStyle._paddingRight = getUnit(value)
34
+ hmStyle.paddingRight = getUnit(value)
111
35
  break
112
36
  }
113
37
  case 'margin': {
114
38
  const { top, bottom, left, right } = getNodeMarginOrPaddingData(value)
115
- hmStyle._marginTop = top
116
- hmStyle._marginBottom = bottom
117
- hmStyle._marginLeft = left
118
- hmStyle._marginRight = right
39
+ hmStyle.marginTop = top
40
+ hmStyle.marginBottom = bottom
41
+ hmStyle.marginLeft = left
42
+ hmStyle.marginRight = right
119
43
  break
120
44
  }
121
45
  case 'marginTop': {
122
- hmStyle._marginTop = getUnit(value)
46
+ hmStyle.marginTop = getUnit(value)
123
47
  break
124
48
  }
125
49
  case 'marginBottom': {
126
- hmStyle._marginBottom = getUnit(value)
50
+ hmStyle.marginBottom = getUnit(value)
127
51
  break
128
52
  }
129
53
  case 'marginLeft': {
130
- hmStyle._marginLeft = getUnit(value)
54
+ hmStyle.marginLeft = getUnit(value)
131
55
  break
132
56
  }
133
57
  case 'marginRight': {
134
- hmStyle._marginRight = getUnit(value)
58
+ hmStyle.marginRight = getUnit(value)
135
59
  break
136
60
  }
137
61
  case 'top': {
138
- hmStyle._top = getUnit(value)
62
+ hmStyle.top = getUnit(value)
139
63
  break
140
64
  }
141
65
  case 'left': {
142
- hmStyle._left = getUnit(value)
66
+ hmStyle.left = getUnit(value)
67
+ break
68
+ }
69
+ case 'right': {
70
+ hmStyle.right = getUnit(value)
71
+ break
72
+ }
73
+ case 'bottom': {
74
+ hmStyle.bottom = getUnit(value)
143
75
  break
144
76
  }
145
77
  case 'flex': {
@@ -156,69 +88,69 @@ export default function convertWebStyle2HmStyle(webStyle: CSSProperties) {
156
88
  res[index] = index < 2 ? Number(item) : item
157
89
  })
158
90
  }
159
- hmStyle._flexGrow = getUnit(res[0])
160
- hmStyle._flexShrink = Number(res[1])
161
- hmStyle._flexBasis = Number(res[2])
91
+ hmStyle.flexGrow = getUnit(res[0])
92
+ hmStyle.flexShrink = Number(res[1])
93
+ hmStyle.flexBasis = Number(res[2])
162
94
  break
163
95
  }
164
96
  case 'flexGrow': {
165
- hmStyle._flexGrow = getUnit(value)
97
+ hmStyle.flexGrow = getUnit(value)
166
98
  break
167
99
  }
168
100
  case 'flexShrink': {
169
- hmStyle._flexShrink = Number(value)
101
+ hmStyle.flexShrink = Number(value)
170
102
  break
171
103
  }
172
104
  case 'flexBasis': {
173
- hmStyle._flexBasis = Number(value)
105
+ hmStyle.flexBasis = Number(value)
174
106
  break
175
107
  }
176
108
  case 'alignSelf': {
177
- hmStyle._alignSelf = FlexManager.itemAlign(value)
109
+ hmStyle.alignSelf = FlexManager.itemAlign(value)
178
110
  break
179
111
  }
180
112
  case 'flexDirection': {
181
- hmStyle._flexDirection = FlexManager.direction(value)
113
+ hmStyle.flexDirection = FlexManager.direction(value)
182
114
  break
183
115
  }
184
116
  case 'justifyContent': {
185
- hmStyle._justifyContent = FlexManager.flexAlign(value)
117
+ hmStyle.justifyContent = FlexManager.flexAlign(value)
186
118
  break
187
119
  }
188
120
  case 'alignItems': {
189
- hmStyle._alignItems = FlexManager.itemAlign(value)
121
+ hmStyle.alignItems = FlexManager.itemAlign(value)
190
122
  break
191
123
  }
192
124
  case 'alignContent': {
193
- hmStyle._alignContent = FlexManager.flexAlign(value)
125
+ hmStyle.alignContent = FlexManager.flexAlign(value)
194
126
  break
195
127
  }
196
128
  case 'flexWrap': {
197
- hmStyle._flexWrap = FlexManager.flexWrap(value)
129
+ hmStyle.flexWrap = FlexManager.flexWrap(value)
198
130
  break
199
131
  }
200
132
  case 'width': {
201
- hmStyle._width = getUnit(value)
133
+ hmStyle.width = getUnit(value)
202
134
  break
203
135
  }
204
136
  case 'height': {
205
- hmStyle._height = getUnit(value)
137
+ hmStyle.height = getUnit(value)
206
138
  break
207
139
  }
208
140
  case 'minWidth': {
209
- hmStyle._minWidth = getUnit(value)
141
+ hmStyle.minWidth = getUnit(value)
210
142
  break
211
143
  }
212
144
  case 'minHeight': {
213
- hmStyle._minHeight = getUnit(value)
145
+ hmStyle.minHeight = getUnit(value)
214
146
  break
215
147
  }
216
148
  case 'maxWidth': {
217
- hmStyle._maxWidth = getUnit(value)
149
+ hmStyle.maxWidth = getUnit(value)
218
150
  break
219
151
  }
220
152
  case 'maxHeight': {
221
- hmStyle._maxHeight = getUnit(value)
153
+ hmStyle.maxHeight = getUnit(value)
222
154
  break
223
155
  }
224
156
  case 'background': {
@@ -226,7 +158,7 @@ export default function convertWebStyle2HmStyle(webStyle: CSSProperties) {
226
158
  break
227
159
  }
228
160
  case 'backgroundColor': {
229
- hmStyle._backgroundColor = value
161
+ hmStyle.backgroundColor = value
230
162
  break
231
163
  }
232
164
  case 'backgroundImage': {
@@ -247,146 +179,146 @@ export default function convertWebStyle2HmStyle(webStyle: CSSProperties) {
247
179
  }
248
180
  case 'border': {
249
181
  const [width, style, color] = value.split(' ')
250
- hmStyle._borderTopWidth = getUnit(width)
251
- hmStyle._borderRightWidth = getUnit(width)
252
- hmStyle._borderBottomWidth = getUnit(width)
253
- hmStyle._borderLeftWidth = getUnit(width)
254
- hmStyle._borderTopStyle = BORDER_STYLE_MAP.get(style)
255
- hmStyle._borderRightStyle = BORDER_STYLE_MAP.get(style)
256
- hmStyle._borderBottomStyle = BORDER_STYLE_MAP.get(style)
257
- hmStyle._borderLeftStyle = BORDER_STYLE_MAP.get(style)
258
- hmStyle._borderTopColor = color
259
- hmStyle._borderRightColor = color
260
- hmStyle._borderBottomColor = color
261
- hmStyle._borderLeftColor = color
182
+ hmStyle.borderTopWidth = getUnit(width)
183
+ hmStyle.borderRightWidth = getUnit(width)
184
+ hmStyle.borderBottomWidth = getUnit(width)
185
+ hmStyle.borderLeftWidth = getUnit(width)
186
+ hmStyle.borderTopStyle = BORDER_STYLE_MAP.get(style)
187
+ hmStyle.borderRightStyle = BORDER_STYLE_MAP.get(style)
188
+ hmStyle.borderBottomStyle = BORDER_STYLE_MAP.get(style)
189
+ hmStyle.borderLeftStyle = BORDER_STYLE_MAP.get(style)
190
+ hmStyle.borderTopColor = color
191
+ hmStyle.borderRightColor = color
192
+ hmStyle.borderBottomColor = color
193
+ hmStyle.borderLeftColor = color
262
194
  break
263
195
  }
264
196
  case 'borderTop': {
265
197
  const [width, style, color] = value.split(' ')
266
- hmStyle._borderTopWidth = getUnit(width)
267
- hmStyle._borderTopStyle = BORDER_STYLE_MAP.get(style)
268
- hmStyle._borderTopColor = color
198
+ hmStyle.borderTopWidth = getUnit(width)
199
+ hmStyle.borderTopStyle = BORDER_STYLE_MAP.get(style)
200
+ hmStyle.borderTopColor = color
269
201
  break
270
202
  }
271
203
  case 'borderRight': {
272
204
  const [width, style, color] = value.split(' ')
273
- hmStyle._borderRightWidth = getUnit(width)
274
- hmStyle._borderRightStyle = BORDER_STYLE_MAP.get(style)
275
- hmStyle._borderRightColor = color
205
+ hmStyle.borderRightWidth = getUnit(width)
206
+ hmStyle.borderRightStyle = BORDER_STYLE_MAP.get(style)
207
+ hmStyle.borderRightColor = color
276
208
  break
277
209
  }
278
210
  case 'borderBottom': {
279
211
  const [width, style, color] = value.split(' ')
280
- hmStyle._borderBottomWidth = getUnit(width)
281
- hmStyle._borderBottomStyle = BORDER_STYLE_MAP.get(style)
282
- hmStyle._borderBottomColor = color
212
+ hmStyle.borderBottomWidth = getUnit(width)
213
+ hmStyle.borderBottomStyle = BORDER_STYLE_MAP.get(style)
214
+ hmStyle.borderBottomColor = color
283
215
  break
284
216
  }
285
217
  case 'borderLeft': {
286
218
  const [width, style, color] = value.split(' ')
287
- hmStyle._borderLeftWidth = getUnit(width)
288
- hmStyle._borderLeftStyle = BORDER_STYLE_MAP.get(style)
289
- hmStyle._borderLeftColor = color
219
+ hmStyle.borderLeftWidth = getUnit(width)
220
+ hmStyle.borderLeftStyle = BORDER_STYLE_MAP.get(style)
221
+ hmStyle.borderLeftColor = color
290
222
  break
291
223
  }
292
224
  case 'borderWidth': {
293
- hmStyle._borderTopWidth = getUnit(value)
294
- hmStyle._borderRightWidth = getUnit(value)
295
- hmStyle._borderBottomWidth = getUnit(value)
296
- hmStyle._borderLeftWidth = getUnit(value)
225
+ hmStyle.borderTopWidth = getUnit(value)
226
+ hmStyle.borderRightWidth = getUnit(value)
227
+ hmStyle.borderBottomWidth = getUnit(value)
228
+ hmStyle.borderLeftWidth = getUnit(value)
297
229
  break
298
230
  }
299
231
  case 'borderLeftWidth': {
300
- hmStyle._borderLeftWidth = getUnit(value)
232
+ hmStyle.borderLeftWidth = getUnit(value)
301
233
  break
302
234
  }
303
235
  case 'borderRightWidth': {
304
- hmStyle._borderRightWidth = getUnit(value)
236
+ hmStyle.borderRightWidth = getUnit(value)
305
237
  break
306
238
  }
307
239
  case 'borderTopWidth': {
308
- hmStyle._borderTopWidth = getUnit(value)
240
+ hmStyle.borderTopWidth = getUnit(value)
309
241
  break
310
242
  }
311
243
  case 'borderBottomWidth': {
312
- hmStyle._borderBottomWidth = getUnit(value)
244
+ hmStyle.borderBottomWidth = getUnit(value)
313
245
  break
314
246
  }
315
247
  case 'borderStyle': {
316
- hmStyle._borderTopStyle = BORDER_STYLE_MAP.get(value)
317
- hmStyle._borderRightStyle = BORDER_STYLE_MAP.get(value)
318
- hmStyle._borderBottomStyle = BORDER_STYLE_MAP.get(value)
319
- hmStyle._borderLeftStyle = BORDER_STYLE_MAP.get(value)
248
+ hmStyle.borderTopStyle = BORDER_STYLE_MAP.get(value)
249
+ hmStyle.borderRightStyle = BORDER_STYLE_MAP.get(value)
250
+ hmStyle.borderBottomStyle = BORDER_STYLE_MAP.get(value)
251
+ hmStyle.borderLeftStyle = BORDER_STYLE_MAP.get(value)
320
252
  break
321
253
  }
322
254
  case 'borderLeftStyle': {
323
- hmStyle._borderLeftStyle = BORDER_STYLE_MAP.get(value)
255
+ hmStyle.borderLeftStyle = BORDER_STYLE_MAP.get(value)
324
256
  break
325
257
  }
326
258
  case 'borderRightStyle': {
327
- hmStyle._borderRightStyle = BORDER_STYLE_MAP.get(value)
259
+ hmStyle.borderRightStyle = BORDER_STYLE_MAP.get(value)
328
260
  break
329
261
  }
330
262
  case 'borderTopStyle': {
331
- hmStyle._borderTopStyle = BORDER_STYLE_MAP.get(value)
263
+ hmStyle.borderTopStyle = BORDER_STYLE_MAP.get(value)
332
264
  break
333
265
  }
334
266
  case 'borderBottomStyle': {
335
- hmStyle._borderBottomStyle = BORDER_STYLE_MAP.get(value)
267
+ hmStyle.borderBottomStyle = BORDER_STYLE_MAP.get(value)
336
268
  break
337
269
  }
338
270
  case 'borderColor': {
339
- hmStyle._borderTopColor = value
340
- hmStyle._borderRightColor = value
341
- hmStyle._borderBottomColor = value
342
- hmStyle._borderLeftColor = value
271
+ hmStyle.borderTopColor = value
272
+ hmStyle.borderRightColor = value
273
+ hmStyle.borderBottomColor = value
274
+ hmStyle.borderLeftColor = value
343
275
  break
344
276
  }
345
277
  case 'borderLeftColor': {
346
- hmStyle._borderLeftColor = value
278
+ hmStyle.borderLeftColor = value
347
279
  break
348
280
  }
349
281
  case 'borderRightColor': {
350
- hmStyle._borderRightColor = value
282
+ hmStyle.borderRightColor = value
351
283
  break
352
284
  }
353
285
  case 'borderTopColor': {
354
- hmStyle._borderTopColor = value
286
+ hmStyle.borderTopColor = value
355
287
  break
356
288
  }
357
289
  case 'borderBottomColor': {
358
- hmStyle._borderBottomColor = value
290
+ hmStyle.borderBottomColor = value
359
291
  break
360
292
  }
361
293
  case 'borderRadius': {
362
- hmStyle._borderTopLeftRadius = getUnit(value)
363
- hmStyle._borderTopRightRadius = getUnit(value)
364
- hmStyle._borderBottomLeftRadius = getUnit(value)
365
- hmStyle._borderBottomRightRadius = getUnit(value)
294
+ hmStyle.borderTopLeftRadius = getUnit(value)
295
+ hmStyle.borderTopRightRadius = getUnit(value)
296
+ hmStyle.borderBottomLeftRadius = getUnit(value)
297
+ hmStyle.borderBottomRightRadius = getUnit(value)
366
298
  break
367
299
  }
368
300
  case 'borderTopLeftRadius': {
369
- hmStyle._borderTopLeftRadius = getUnit(value)
301
+ hmStyle.borderTopLeftRadius = getUnit(value)
370
302
  break
371
303
  }
372
304
  case 'borderTopRightRadius': {
373
- hmStyle._borderTopRightRadius = getUnit(value)
305
+ hmStyle.borderTopRightRadius = getUnit(value)
374
306
  break
375
307
  }
376
308
  case 'borderBottomLeftRadius': {
377
- hmStyle._borderBottomLeftRadius = getUnit(value)
309
+ hmStyle.borderBottomLeftRadius = getUnit(value)
378
310
  break
379
311
  }
380
312
  case 'borderBottomRightRadius': {
381
- hmStyle._borderBottomRightRadius = getUnit(value)
313
+ hmStyle.borderBottomRightRadius = getUnit(value)
382
314
  break
383
315
  }
384
316
  case 'color': {
385
- hmStyle._color = value
317
+ hmStyle.color = value
386
318
  break
387
319
  }
388
320
  case 'fontSize': {
389
- hmStyle._fontSize = getUnit(value)
321
+ hmStyle.fontSize = getUnit(value)
390
322
  break
391
323
  }
392
324
  case 'fontWeight': {
@@ -396,26 +328,26 @@ export default function convertWebStyle2HmStyle(webStyle: CSSProperties) {
396
328
  case 'fontStyle': {
397
329
  switch (value) {
398
330
  case 'italic':
399
- hmStyle._fontStyle = FontStyle.Italic
331
+ hmStyle.fontStyle = FontStyle.Italic
400
332
  break
401
333
  default:
402
- hmStyle._fontStyle = FontStyle.Normal
334
+ hmStyle.fontStyle = FontStyle.Normal
403
335
  }
404
336
  break
405
337
  }
406
338
  case 'textAlign': {
407
339
  switch (value) {
408
340
  case 'left':
409
- hmStyle._textAlign = TextAlign.Start
341
+ hmStyle.textAlign = TextAlign.Start
410
342
  break
411
343
  case 'center':
412
- hmStyle._textAlign = TextAlign.Center
344
+ hmStyle.textAlign = TextAlign.Center
413
345
  break
414
346
  case 'right':
415
- hmStyle._textAlign = TextAlign.End
347
+ hmStyle.textAlign = TextAlign.End
416
348
  break
417
349
  default:
418
- hmStyle._textAlign = TextAlign.Start
350
+ hmStyle.textAlign = TextAlign.Start
419
351
  break
420
352
  }
421
353
  break
@@ -425,34 +357,34 @@ export default function convertWebStyle2HmStyle(webStyle: CSSProperties) {
425
357
  case 'supper':
426
358
  case 'top':
427
359
  case 'text-top':
428
- hmStyle._align = Alignment.Top
360
+ hmStyle.verticalAlign = Alignment.Top
429
361
  break
430
362
  case 'middle':
431
- hmStyle._align = Alignment.Center
363
+ hmStyle.verticalAlign = Alignment.Center
432
364
  break
433
365
  case 'sub':
434
366
  case 'text-bottom':
435
367
  case 'bottom':
436
- hmStyle._align = Alignment.Bottom
368
+ hmStyle.verticalAlign = Alignment.Bottom
437
369
  break
438
370
  }
439
371
  break
440
372
  }
441
373
  case 'lineHeight': {
442
- hmStyle._lineHeight = getUnit(value)
374
+ hmStyle.lineHeight = getUnit(value)
443
375
  break
444
376
  }
445
377
  case 'letterSpacing': {
446
- hmStyle._letterSpacing = getUnit(value)
378
+ hmStyle.letterSpacing = getUnit(value)
447
379
  break
448
380
  }
449
381
  case 'textDecoration': {
450
382
  if (typeof value === 'string') {
451
383
  switch (value) {
452
- case 'underline': hmStyle._textDecoration = TextDecorationType.Underline; break
453
- case 'overline': hmStyle._textDecoration = TextDecorationType.Overline; break
454
- case 'line-through': hmStyle._textDecoration = TextDecorationType.LineThrough; break
455
- default: hmStyle._textDecoration = TextDecorationType.None; break
384
+ case 'underline': hmStyle.textDecoration = TextDecorationType.Underline; break
385
+ case 'overline': hmStyle.textDecoration = TextDecorationType.Overline; break
386
+ case 'line-through': hmStyle.textDecoration = TextDecorationType.LineThrough; break
387
+ default: hmStyle.textDecoration = TextDecorationType.None; break
456
388
  }
457
389
  }
458
390
  break
@@ -465,39 +397,40 @@ export default function convertWebStyle2HmStyle(webStyle: CSSProperties) {
465
397
  case 'ellipsis': overflow = TextOverflow.Ellipsis; break
466
398
  case 'marquee': overflow = TextOverflow.MARQUEE; break
467
399
  }
468
- hmStyle._textOverflow = {
400
+ hmStyle.textOverflow = {
469
401
  overflow
470
402
  }
471
403
  }
472
404
  break
473
405
  }
474
406
  case 'WebkitLineClamp': {
475
- hmStyle._WebkitLineClamp = Number(value)
407
+ hmStyle.WebkitLineClamp = Number(value)
476
408
  break
477
409
  }
478
410
  case 'transform': {
479
- hmStyle._transform = parseTransform(value)
411
+ // todo: 需要更新
412
+ // hmStyle.transform = parseTransform(value)
480
413
  break
481
414
  }
482
415
  case 'position': {
483
- hmStyle._position = value
416
+ hmStyle.position = value
484
417
  break
485
418
  }
486
419
  case 'display': {
487
- hmStyle._display = value
420
+ hmStyle.display = value
488
421
  break
489
422
  }
490
423
  case 'zIndex': {
491
- hmStyle._zIndex = Number(value)
424
+ hmStyle.zIndex = Number(value)
492
425
  break
493
426
  }
494
427
  case 'opacity': {
495
428
  const val = Number(value)
496
- hmStyle._opacity = Number.isNaN(val) ? 1 : val
429
+ hmStyle.opacity = Number.isNaN(val) ? 1 : val
497
430
  break
498
431
  }
499
432
  case 'overflow': {
500
- hmStyle._overflow = value === 'hidden'
433
+ hmStyle.overflow = value
501
434
  break
502
435
  }
503
436
  default: {
@@ -514,20 +447,21 @@ function setBackgroundImage(hmStyle, value) {
514
447
  // 如果包含 url(),则说明是 background-image 属性
515
448
  const match = value.match(new RegExp('url\\([\'"]?(.*?)[\'"]?\\)'))
516
449
  if (match) {
517
- hmStyle._backgroundImage = {
450
+ hmStyle.backgroundImage = {
518
451
  src: match[1]
519
452
  }
520
453
  }
521
454
  }
455
+ // todo 渐变需要处理
522
456
  }
523
457
 
524
458
  function setBackgroundRepeat(hmStyle, value) {
525
459
  if (typeof value === 'string') {
526
460
  switch (value) {
527
- case 'repeat-x': hmStyle._backgroundRepeat = ImageRepeat.X; break
528
- case 'repeat-y': hmStyle._backgroundRepeat = ImageRepeat.Y; break
529
- case 'no-repeat': hmStyle._backgroundRepeat = ImageRepeat.NoRepeat; break
530
- default: hmStyle._backgroundRepeat = ImageRepeat.XY; break
461
+ case 'repeat-x': hmStyle.backgroundRepeat = ImageRepeat.X; break
462
+ case 'repeat-y': hmStyle.backgroundRepeat = ImageRepeat.Y; break
463
+ case 'no-repeat': hmStyle.backgroundRepeat = ImageRepeat.NoRepeat; break
464
+ default: hmStyle.backgroundRepeat = ImageRepeat.XY; break
531
465
  }
532
466
  }
533
467
  }
@@ -536,9 +470,9 @@ function setBackgroundSize(hmStyle, value) {
536
470
  if (typeof value === 'string') {
537
471
  const sizes = value.split(' ')
538
472
  if (sizes.length === 1) {
539
- hmStyle._backgroundSize = { width: getUnit(sizes[0]) }
473
+ hmStyle.backgroundSize = { width: getUnit(sizes[0]) }
540
474
  } else if (sizes.length === 2) {
541
- hmStyle._backgroundSize = { width: getUnit(sizes[0]), height: getUnit(sizes[1]) }
475
+ hmStyle.backgroundSize = { width: getUnit(sizes[0]), height: getUnit(sizes[1]) }
542
476
  }
543
477
  }
544
478
  }
@@ -550,28 +484,28 @@ function setBackgroundPosistion (hmStyle, value) {
550
484
  const vertical = positions[1].toLowerCase() || 'top'
551
485
 
552
486
  if (horizontal === 'left' && vertical === 'top') {
553
- hmStyle._backgroundPosition = Alignment.TopStart
487
+ hmStyle.backgroundPosition = Alignment.TopStart
554
488
  } else if (horizontal === 'center' && vertical === 'top') {
555
- hmStyle._backgroundPosition = Alignment.Top
489
+ hmStyle.backgroundPosition = Alignment.Top
556
490
  } else if (horizontal === 'right' && vertical === 'top') {
557
- hmStyle._backgroundPosition = Alignment.TopEnd
491
+ hmStyle.backgroundPosition = Alignment.TopEnd
558
492
  } else if (horizontal === 'left' && vertical === 'center') {
559
- hmStyle._backgroundPosition = Alignment.Start
493
+ hmStyle.backgroundPosition = Alignment.Start
560
494
  } else if (horizontal === 'center' && vertical === 'center') {
561
- hmStyle._backgroundPosition = Alignment.Center
495
+ hmStyle.backgroundPosition = Alignment.Center
562
496
  } else if (horizontal === 'right' && vertical === 'center') {
563
- hmStyle._backgroundPosition = Alignment.End
497
+ hmStyle.backgroundPosition = Alignment.End
564
498
  } else if (horizontal === 'left' && vertical === 'bottom') {
565
- hmStyle._backgroundPosition = Alignment.BottomStart
499
+ hmStyle.backgroundPosition = Alignment.BottomStart
566
500
  } else if (horizontal === 'center' && vertical === 'bottom') {
567
- hmStyle._backgroundPosition = Alignment.Bottom
501
+ hmStyle.backgroundPosition = Alignment.Bottom
568
502
  } else if (horizontal === 'right' && vertical === 'bottom') {
569
- hmStyle._backgroundPosition = Alignment.BottomEnd
503
+ hmStyle.backgroundPosition = Alignment.BottomEnd
570
504
  } else {
571
505
  if (/^\d+(\.\d+)?(px|%|vw|vh)$/.test(horizontal)) {
572
- hmStyle._backgroundPosition = { x: getUnit(horizontal) }
506
+ hmStyle.backgroundPosition = { x: getUnit(horizontal) }
573
507
  if (/^\d+(\.\d+)?(px|%|vw|vh)$/.test(vertical)) {
574
- hmStyle._backgroundPosition = { x: getUnit(horizontal), y: getUnit(vertical) }
508
+ hmStyle.backgroundPosition = { x: getUnit(horizontal), y: getUnit(vertical) }
575
509
  }
576
510
  }
577
511
  }
@@ -580,14 +514,15 @@ function setBackgroundPosistion (hmStyle, value) {
580
514
 
581
515
  function setFontWeight (hmStyle, value) {
582
516
  switch (value) {
583
- case 'normal': hmStyle._fontWeight = FontWeight.Normal; break
584
- case 'bold': hmStyle._fontWeight = FontWeight.Bold; break
585
- case 'bolder': hmStyle._fontWeight = FontWeight.Bolder; break
586
- case 'lighter': hmStyle._fontWeight = FontWeight.Lighter; break
587
- default: hmStyle._fontWeight = Number(value); break
517
+ case 'normal': hmStyle.fontWeight = FontWeight.Normal; break
518
+ case 'bold': hmStyle.fontWeight = FontWeight.Bold; break
519
+ case 'bolder': hmStyle.fontWeight = FontWeight.Bolder; break
520
+ case 'lighter': hmStyle.fontWeight = FontWeight.Lighter; break
521
+ default: hmStyle.fontWeight = Number(value); break
588
522
  }
589
523
  }
590
524
 
525
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
591
526
  function parseTransform(transformString) {
592
527
  const transformRegex = /(\w+)\(([^)]+)\)/g
593
528
  const transforms = []