@tarojs/plugin-platform-harmony-ets 4.0.0-beta.21 → 4.0.0-beta.23

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 (68) hide show
  1. package/dist/apis/base/system.ts +1 -1
  2. package/dist/apis/canvas/index.ts +10 -1
  3. package/dist/apis/index.ts +24 -11
  4. package/dist/apis/ui/animation/animation.ts +2 -1
  5. package/dist/apis/wxml/IntersectionObserver.ts +5 -1
  6. package/dist/components-harmony-ets/button.ets +8 -1
  7. package/dist/components-harmony-ets/canvas.ets +51 -0
  8. package/dist/components-harmony-ets/checkbox.ets +7 -3
  9. package/dist/components-harmony-ets/form.ets +10 -2
  10. package/dist/components-harmony-ets/icon.ets +8 -1
  11. package/dist/components-harmony-ets/image.ets +8 -1
  12. package/dist/components-harmony-ets/index.ets +53 -0
  13. package/dist/components-harmony-ets/input.ets +2 -1
  14. package/dist/components-harmony-ets/label.ets +9 -2
  15. package/dist/components-harmony-ets/movableArea.ets +10 -3
  16. package/dist/components-harmony-ets/movableView.ets +10 -3
  17. package/dist/components-harmony-ets/picker.ets +1 -1
  18. package/dist/components-harmony-ets/progress.ets +8 -1
  19. package/dist/components-harmony-ets/radio.ets +7 -3
  20. package/dist/components-harmony-ets/scrollView.ets +9 -2
  21. package/dist/components-harmony-ets/slider.ets +2 -1
  22. package/dist/components-harmony-ets/style.ets +40 -4
  23. package/dist/components-harmony-ets/swiper.ets +8 -1
  24. package/dist/components-harmony-ets/switch.ets +3 -1
  25. package/dist/components-harmony-ets/text.ets +8 -1
  26. package/dist/components-harmony-ets/textArea.ets +2 -1
  27. package/dist/components-harmony-ets/utils/flexManager.ets +2 -2
  28. package/dist/components-harmony-ets/utils/helper.ets +1 -3
  29. package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
  30. package/dist/components-harmony-ets/utils/index.ts +8 -62
  31. package/dist/components-harmony-ets/video.ets +9 -2
  32. package/dist/components-harmony-ets/view.ets +9 -2
  33. package/dist/index.d.ts +1 -1
  34. package/dist/runtime-ets/bom/window.ts +5 -0
  35. package/dist/runtime-ets/current.ts +1 -0
  36. package/dist/runtime-ets/dom/bind.ts +3 -3
  37. package/dist/runtime-ets/dom/cssNesting.ts +104 -22
  38. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +2 -5
  39. package/dist/runtime-ets/dom/element/canvas.ts +136 -0
  40. package/dist/runtime-ets/dom/element/element.ts +59 -44
  41. package/dist/runtime-ets/dom/element/form.ts +4 -14
  42. package/dist/runtime-ets/dom/element/index.ts +4 -2
  43. package/dist/runtime-ets/dom/element/progress.ts +0 -1
  44. package/dist/runtime-ets/dom/element/text.ts +0 -8
  45. package/dist/runtime-ets/dom/element/video.ts +4 -3
  46. package/dist/runtime-ets/dom/node.ts +15 -14
  47. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +5 -4
  48. package/dist/runtime-ets/dom/stylesheet/util.ts +12 -10
  49. package/dist/runtime-ets/utils/index.ts +20 -2
  50. package/dist/runtime-ets/utils/info.ts +1 -1
  51. package/dist/runtime-framework/react/app.ts +2 -1
  52. package/dist/runtime-framework/react/native-page.ts +3 -2
  53. package/dist/runtime-framework/react/page.ts +1 -0
  54. package/dist/runtime-framework/solid/app.ts +19 -39
  55. package/dist/runtime-framework/solid/connect.ts +20 -2
  56. package/dist/runtime-framework/solid/hooks.ts +16 -11
  57. package/dist/runtime-framework/solid/index.ts +7 -1
  58. package/dist/runtime-framework/solid/page.ts +84 -23
  59. package/dist/runtime-framework/solid/reconciler/props.ts +65 -20
  60. package/dist/runtime-framework/solid/reconciler/render.ts +2 -1
  61. package/dist/runtime-utils.d.ts +3 -1
  62. package/dist/runtime-utils.js +24 -12
  63. package/dist/runtime-utils.js.map +1 -1
  64. package/dist/runtime.js +24 -12
  65. package/dist/runtime.js.map +1 -1
  66. package/package.json +10 -10
  67. /package/dist/components-harmony-ets/{index.ts → tag.ts} +0 -0
  68. /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
@@ -75,7 +75,7 @@ export const getSystemInfoSync: typeof Taro.getSystemInfoSync = function () {
75
75
  res.notificationSoundAuthorized = false // 通知带有声音的开关(仅 iOS 有效)boolean
76
76
  res.phoneCalendarAuthorized = null // 使用日历的开关 boolean
77
77
  res.wifiEnabled = false // Wi-Fi 的系统开关 boolean
78
- res.pixelRatio = display && (Math.round(display.xDPI / display.width * 100) / 100) // 设备像素比,number
78
+ res.pixelRatio = display && display.densityPixels // 设备像素比,number
79
79
  res.platform = 'harmony' // 客户端平台 string
80
80
  res.safeArea = safeArea // 在竖屏正方向下的安全区域 General.SafeAreaResult
81
81
  res.screenHeight = display?.height // 屏幕高度,单位px number
@@ -1,12 +1,21 @@
1
+ import { eventSource } from '@tarojs/runtime'
2
+
1
3
  import { temporarilyNotSupport } from '../utils'
2
4
 
5
+ // @ts-ignore
6
+ import type { TaroCanvasElement } from '@tarojs/runtime'
3
7
  // 画布
4
8
 
5
9
  /** 创建离屏 canvas 实例 */
6
10
  export const createOffscreenCanvas = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')
7
11
 
8
12
  /** 创建 canvas 的绘图上下文 CanvasContext 对象 */
9
- export const createCanvasContext = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')
13
+ // export const createCanvasContext = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')
14
+ export const createCanvasContext = (canvasId: string) => {
15
+ const dom = eventSource.get(`canvasId-${canvasId}`)
16
+ // return dom as TaroCanvasElement
17
+ if (dom) return (dom as unknown as TaroCanvasElement).context
18
+ }
10
19
 
11
20
  /** 把当前画布指定区域的内容导出生成指定大小的图片 */
12
21
  export const canvasToTempFilePath = /* @__PURE__ */ temporarilyNotSupport('createOffscreenCanvas')
@@ -58,20 +58,30 @@ export function initPxTransform ({
58
58
 
59
59
  const display = _display.getDefaultDisplaySync()
60
60
 
61
+ let displayWidth = display.width
62
+ let ratioCache: number | false = false
61
63
  let designWidthFunc: (input: number) => number
64
+ let designWidth = defaultDesignWidth
65
+ let deviceRatio = defaultDesignRatio
62
66
  function getRatio (value: number) {
63
- const config = (Current as any).taro?.config || {}
64
- if (!isFunction(designWidthFunc)) {
65
- designWidthFunc = isFunction(config.designWidth)
66
- ? config.designWidth
67
- : () => config.designWidth
68
- }
69
- const designWidth = designWidthFunc(value) || defaultDesignWidth
70
- const deviceRatio = config.deviceRatio || defaultDesignRatio
71
- if (!(designWidth in deviceRatio)) {
72
- throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`)
67
+ // Note: 提前调用 display 可能无法获取正确值
68
+ if (ratioCache === false || displayWidth !== display.width) {
69
+ const config = (Current as any).taro?.config || {}
70
+ if (!isFunction(designWidthFunc)) {
71
+ designWidthFunc = isFunction(config.designWidth)
72
+ ? config.designWidth
73
+ : () => config.designWidth
74
+ designWidth = designWidthFunc(value) || defaultDesignWidth
75
+ deviceRatio = config.deviceRatio || defaultDesignRatio
76
+ if (!(designWidth in deviceRatio)) {
77
+ throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`)
78
+ }
79
+ }
80
+ displayWidth = display.width
81
+ ratioCache = Math.min(display.width, display.height) / designWidth / deviceRatio[designWidth]
73
82
  }
74
- return Math.min(display.width, display.height) / designWidth / deviceRatio[designWidth]
83
+
84
+ return ratioCache
75
85
  }
76
86
 
77
87
  // Note: 设置为 style 单位时会自动完成设计稿转换,设计开发者调用 API 时也许抹平差异,例如 pageScrollTo[option.offsetTop]
@@ -79,6 +89,9 @@ export function pxTransformHelper (size: number, unit?: string, isNumber = false
79
89
  const config = (Current as any).taro?.config || {}
80
90
  const targetUnit = unit || config.targetUnit || defaultTargetUnit
81
91
 
92
+ if (targetUnit === 'PX') {
93
+ return px2vp(size * display.scaledDensity) + 'vp'
94
+ }
82
95
  const ratio = getRatio(size)
83
96
  let val = size * ratio
84
97
 
@@ -1,4 +1,5 @@
1
1
  import matrix4 from '@ohos.matrix4'
2
+ import { isUndefined } from '@tarojs/shared'
2
3
 
3
4
  import { temporarilyNotSupport } from '../../utils'
4
5
 
@@ -110,7 +111,7 @@ export class Animation implements Taro.Animation {
110
111
  }
111
112
 
112
113
  scale (sx: number, sy?: number | undefined): Taro.Animation {
113
- this.rule.scale = { x: sx, y: sy }
114
+ this.rule.scale = { x: sx, y: isUndefined(sy) ? sx : sy }
114
115
  return this
115
116
  }
116
117
 
@@ -45,7 +45,7 @@ export class IntersectionObserver implements Taro.IntersectionObserver {
45
45
 
46
46
  public observe (targetSelector: string, callback: Taro.IntersectionObserver.ObserveCallback): void {
47
47
  if (!this._component) return
48
-
48
+
49
49
  const { observeAll, thresholds } = this._options
50
50
  const node = findChildNodeWithDFS(this._component, targetSelector, observeAll)
51
51
  this._observerNodes = node
@@ -68,6 +68,10 @@ export class IntersectionObserver implements Taro.IntersectionObserver {
68
68
  callback(this.handleResult(isVisible, currentRatio))
69
69
  })
70
70
  }
71
+ } else {
72
+ callback({
73
+ errMsg: 'IntersectionObserver.observe:fail cannot find the node for selector.'
74
+ })
71
75
  }
72
76
  }
73
77
 
@@ -98,6 +98,13 @@ export default struct TaroButton {
98
98
  @Builder customBuilder() {}
99
99
  @BuilderParam createLazyChildren: (node: TaroButtonElement) => void = this.customBuilder
100
100
  @ObjectLink node: TaroButtonElement
101
+ @State overwriteStyle: Record<string, TaroAny> = {}
102
+
103
+ aboutToAppear(): void {
104
+ if (this.node) {
105
+ this.node._instance = this
106
+ }
107
+ }
101
108
 
102
109
  build() {
103
110
  if (this.node?.hmStyle?.display !== 'none') {
@@ -112,7 +119,7 @@ export default struct TaroButton {
112
119
  }
113
120
  }
114
121
  .themeStyles(getThemeAttributes(this.node))
115
- .attributeModifier(commonStyleModify.setNode(this.node))
122
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
116
123
  .constraintSize({
117
124
  minWidth: this.node.hmStyle?.minWidth || getButtonMinWidth(this.node),
118
125
  minHeight: this.node.hmStyle?.minHeight || getButtonMinHeight(this.node),
@@ -0,0 +1,51 @@
1
+ import type { TaroAny, TaroCanvasElement } from '@tarojs/runtime'
2
+ import { cancelAnimationFrame, requestAnimationFrame } from '@tarojs/runtime'
3
+ import commonStyleModify from './style'
4
+
5
+ @Component
6
+ export default struct TaroCanvas {
7
+ @ObjectLink node: TaroCanvasElement
8
+ rafId: number = 0
9
+ @State overwriteStyle: Record<string, TaroAny> = {}
10
+
11
+ aboutToAppear(): void {
12
+ if (this.node) {
13
+ this.node._instance = this
14
+ }
15
+ }
16
+
17
+ aboutToDisappear() {
18
+ if(this.rafId) {
19
+ cancelAnimationFrame(this.rafId)
20
+ }
21
+ }
22
+
23
+ build() {
24
+ Canvas(this.node._context)
25
+ .attributeModifier(commonStyleModify.setNode(this.node as TaroAny, {
26
+ width: '100%',
27
+ height: '100%',
28
+ backgroundColor: '#ffff00'
29
+ }).setAnimationStyle(this.overwriteStyle))
30
+ .onReady(() => {
31
+ const context = this.node._context
32
+
33
+ const draw = () => {
34
+ if (this.node._drawList.length) {
35
+ while (this.node._drawList.length) {
36
+ const item = this.node._drawList.shift()
37
+ if (item) {
38
+ if (typeof context[item.key] === 'function') {
39
+ context[item.key](...[].concat(item.value))
40
+ } else {
41
+ context[item.key] = item.value
42
+ }
43
+ }
44
+ }
45
+ }
46
+ this.rafId = requestAnimationFrame(draw)
47
+ }
48
+ draw()
49
+ })
50
+ }
51
+ }
@@ -38,10 +38,12 @@ export struct TaroCheckbox {
38
38
  @Builder customBuilder() {}
39
39
  @BuilderParam createLazyChildren: (node: TaroCheckboxElement) => void = this.customBuilder
40
40
  @ObjectLink node: TaroCheckboxElement
41
+ @State overwriteStyle: Record<string, TaroAny> = {}
41
42
 
42
43
  aboutToAppear () {
43
44
  if (this.node && !this.node._isInit) {
44
45
  this.node._isInit = true
46
+ this.node._instance = this
45
47
  this.node._reset = this.node.checked || false
46
48
  }
47
49
  }
@@ -51,7 +53,7 @@ export struct TaroCheckbox {
51
53
  Stack() {
52
54
  Row() {
53
55
  Checkbox(getOptions(this.node))
54
- .attributeModifier(commonStyleModify.setNode(this.node))
56
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
55
57
  .checkboxAttr(getAttributes(this.node))
56
58
  .opacity(!!this.node._attrs.disabled ? 0.4 : 1)
57
59
  .select(this.node.checked)
@@ -99,6 +101,7 @@ export struct TaroCheckboxGroup {
99
101
  @Builder customBuilder() {}
100
102
  @BuilderParam createLazyChildren: (node: TaroCheckboxGroupElement) => void = this.customBuilder
101
103
  @ObjectLink node: TaroCheckboxGroupElement
104
+ @State overwriteStyle: Record<string, TaroAny> = {}
102
105
 
103
106
  @Styles visibleChangeEvent () {
104
107
  .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
@@ -106,6 +109,7 @@ export struct TaroCheckboxGroup {
106
109
 
107
110
  aboutToAppear () {
108
111
  if (this.node) {
112
+ this.node._instance = this
109
113
  // 阻止事件冒泡传递上去
110
114
  this.node.addEventListener('change', (e: TaroEvent<ChangeEventDetail>) => {
111
115
  e.stopPropagation()
@@ -129,7 +133,7 @@ export struct TaroCheckboxGroup {
129
133
  Row() {
130
134
  this.createLazyChildren(this.node)
131
135
  }
132
- .attributeModifier(commonStyleModify.setNode(this.node))
136
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
133
137
  .defaultEvent()
134
138
  .visibleChangeEvent()
135
139
  .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
@@ -138,7 +142,7 @@ export struct TaroCheckboxGroup {
138
142
  Column() {
139
143
  this.createLazyChildren(this.node)
140
144
  }
141
- .attributeModifier(commonStyleModify.setNode(this.node))
145
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
142
146
  .defaultEvent()
143
147
  .visibleChangeEvent()
144
148
  .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
@@ -13,13 +13,21 @@ export default struct TaroForm {
13
13
  @BuilderParam createLazyChildren: (node: TaroFormElement) => void = this.customBuilder
14
14
  @ObjectLink node: TaroFormElement
15
15
 
16
+ @State overwriteStyle: Record<string, TaroAny> = {}
17
+
18
+ aboutToAppear(): void {
19
+ if (this.node) {
20
+ this.node._instance = this
21
+ }
22
+ }
23
+
16
24
  build() {
17
25
  if (this.node?.hmStyle?.display !== 'none') {
18
26
  if (FlexManager.isFlexNode(this.node) && FlexManager.flexOptions(this.node).direction !== FlexDirection.Column) {
19
27
  Row() {
20
28
  this.createLazyChildren(this.node)
21
29
  }
22
- .attributeModifier(commonStyleModify.setNode(this.node))
30
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
23
31
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
24
32
  .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
25
33
  .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
@@ -32,7 +40,7 @@ export default struct TaroForm {
32
40
  Column() {
33
41
  this.createLazyChildren(this.node)
34
42
  }
35
- .attributeModifier(commonStyleModify.setNode(this.node))
43
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
36
44
  .onClick(shouldBindEvent((e: ClickEvent) => eventHandler(e, 'click', this.node), this.node, ['click']))
37
45
  .onTouch(shouldBindEvent((e: TouchEvent) => eventHandler(e, TOUCH_EVENT_MAP.get(e.type), this.node), this.node, TOUCH_EVENT_MAP.values()))
38
46
  .onAreaChange(getComponentEventCallback(this.node, AREA_CHANGE_EVENT_NAME, (res: TaroAny) => {
@@ -53,6 +53,13 @@ export default struct TaroIcon {
53
53
  @Builder customBuilder() {}
54
54
  @BuilderParam createLazyChildren: (node: TaroIconElement) => void = this.customBuilder
55
55
  @ObjectLink node: TaroIconElement
56
+ @State overwriteStyle: Record<string, TaroAny> = {}
57
+
58
+ aboutToAppear(): void {
59
+ if (this.node) {
60
+ this.node._instance = this
61
+ }
62
+ }
56
63
 
57
64
  build() {
58
65
  if (this.node?.hmStyle?.display !== 'none') {
@@ -62,7 +69,7 @@ export default struct TaroIcon {
62
69
  .attributeModifier(commonStyleModify.setNode(this.node, {
63
70
  width: convertNumber2PX(23),
64
71
  height: convertNumber2PX(23)
65
- }))
72
+ }).setAnimationStyle(this.overwriteStyle))
66
73
  .size({
67
74
  width: convertNumber2VP(Number(this.node._attrs.size) || 23),
68
75
  height: convertNumber2VP(Number(this.node._attrs.size) || 23),
@@ -21,6 +21,13 @@ export default struct TaroImage {
21
21
  @Builder customBuilder() {}
22
22
  @BuilderParam createLazyChildren: (node: TaroImageElement) => void = this.customBuilder
23
23
  @ObjectLink node: TaroImageElement
24
+ @State overwriteStyle: Record<string, TaroAny> = {}
25
+
26
+ aboutToAppear(): void {
27
+ if (this.node) {
28
+ this.node._instance = this
29
+ }
30
+ }
24
31
 
25
32
  build() {
26
33
  if (this.node?.hmStyle?.display !== 'none') {
@@ -30,7 +37,7 @@ export default struct TaroImage {
30
37
  this.node._nodeInfo.areaInfo = res[1]
31
38
  }))
32
39
  .objectFit(getImageMode(this.node.getAttribute('mode')))
33
- .attributeModifier(commonStyleModify.setNode(this.node))
40
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
34
41
  .onComplete(e => eventHandler(e, 'complete', this.node))
35
42
  .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
36
43
  }
@@ -0,0 +1,53 @@
1
+ import TaroImage from './image'
2
+ import TaroText from './text'
3
+ import TaroView from './view'
4
+ import TaroIcon from './icon'
5
+ import TaroForm from './form'
6
+ import TaroLabel from './label'
7
+ import TaroInput from './input'
8
+ import TaroVideo from './video'
9
+ import TaroCanvas from './canvas'
10
+ import TaroButton from './button'
11
+ import TaroPicker from './picker'
12
+ import TaroSlider from './slider'
13
+ import TaroSwitch from './switch'
14
+ import TaroSwiper from './swiper'
15
+ import TaroWebView from './webView'
16
+ import TaroTextArea from './textArea'
17
+ import TaroRichText from './richText'
18
+ import TaroProgress from './progress'
19
+ import TaroInnerHtml from './innerHtml'
20
+ import TaroScrollView from './scrollView'
21
+ import TaroMovableArea from './movableArea'
22
+ import TaroMovableView from './movableView'
23
+ import { TaroRadio, TaroRadioGroup } from './radio'
24
+ import { TaroCheckboxGroup, TaroCheckbox } from './checkbox'
25
+
26
+ export {
27
+ TaroImage,
28
+ TaroCanvas,
29
+ TaroText,
30
+ TaroView,
31
+ TaroIcon,
32
+ TaroForm,
33
+ TaroLabel,
34
+ TaroInput,
35
+ TaroVideo,
36
+ TaroButton,
37
+ TaroPicker,
38
+ TaroSlider,
39
+ TaroSwitch,
40
+ TaroSwiper,
41
+ TaroWebView,
42
+ TaroTextArea,
43
+ TaroRichText,
44
+ TaroProgress,
45
+ TaroInnerHtml,
46
+ TaroScrollView,
47
+ TaroMovableArea,
48
+ TaroMovableView,
49
+ TaroRadio,
50
+ TaroRadioGroup,
51
+ TaroCheckboxGroup,
52
+ TaroCheckbox
53
+ }
@@ -51,6 +51,7 @@ export default struct TaroInput {
51
51
  @Builder customBuilder() {}
52
52
  @BuilderParam createLazyChildren: (node: TaroInputElement) => void = this.customBuilder
53
53
  @ObjectLink node: TaroInputElement
54
+ @State overwriteStyle: Record<string, TaroAny> = {}
54
55
 
55
56
  aboutToAppear () {
56
57
  if (this.node) {
@@ -72,7 +73,7 @@ export default struct TaroInput {
72
73
  .maxLength(Number(this.node._attrs?.maxlength) || null)
73
74
  .placeholderColor(getPlaceholderColor(this.node))
74
75
  .enterKeyType(INPUT_CONFIRM_MAP.get(this.node._attrs?.confirmType) || EnterKeyType.Done)
75
- .attributeModifier(commonStyleModify.setNode(this.node))
76
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
76
77
  .styles(this.node?.hmStyle)
77
78
  .attrs(getAttributes(this.node))
78
79
  .onChange((value: string) => {
@@ -39,6 +39,13 @@ export default struct TaroLabel {
39
39
  @Builder customBuilder() {}
40
40
  @BuilderParam createLazyChildren: (node:TaroLabelElement) => void = this.customBuilder
41
41
  @ObjectLink node:TaroLabelElement
42
+ @State overwriteStyle: Record<string, TaroAny> = {}
43
+
44
+ aboutToAppear(): void {
45
+ if (this.node) {
46
+ this.node._instance = this
47
+ }
48
+ }
42
49
 
43
50
  build() {
44
51
  if (this.node?.hmStyle?.display !== 'none') {
@@ -46,7 +53,7 @@ export default struct TaroLabel {
46
53
  Row() {
47
54
  this.createLazyChildren(this.node)
48
55
  }
49
- .attributeModifier(commonStyleModify.setNode(this.node))
56
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
50
57
  .onClick((e: ClickEvent) => {
51
58
  const firstChild: TaroElement | null = this.node.childNodes[0] as TaroElement | null
52
59
  const id: string = this.node._attrs.for || firstChild?._attrs.id || firstChild?._nid || ''
@@ -65,7 +72,7 @@ export default struct TaroLabel {
65
72
  Column() {
66
73
  this.createLazyChildren(this.node)
67
74
  }
68
- .attributeModifier(commonStyleModify.setNode(this.node))
75
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
69
76
  .onClick((e: ClickEvent) => {
70
77
  const firstChild: TaroElement | null = this.node.childNodes[0] as TaroElement | null
71
78
  const id: string = this.node._attrs.for || firstChild?._attrs.id || firstChild?._nid || ''
@@ -1,4 +1,4 @@
1
- import type { TaroMovableAreaElement, TaroMovableViewElement} from '@tarojs/runtime'
1
+ import type { TaroAny, TaroMovableAreaElement, TaroMovableViewElement } from '@tarojs/runtime'
2
2
  import { rowModify, columnModify } from './style'
3
3
 
4
4
  import { FlexManager } from './utils/flexManager'
@@ -8,6 +8,13 @@ export default struct TaroMovableArea {
8
8
  @Builder customBuilder() {}
9
9
  @BuilderParam createLazyChildren: (node: TaroMovableAreaElement) => void = this.customBuilder
10
10
  @ObjectLink node: TaroMovableAreaElement
11
+ @State overwriteStyle: Record<string, TaroAny> = {}
12
+
13
+ aboutToAppear(): void {
14
+ if (this.node) {
15
+ this.node._instance = this
16
+ }
17
+ }
11
18
 
12
19
  build() {
13
20
  if (this.node && this.node.hmStyle?.display !== 'none') {
@@ -15,7 +22,7 @@ export default struct TaroMovableArea {
15
22
  Row() {
16
23
  this.createLazyChildren(this.node)
17
24
  }
18
- .attributeModifier(rowModify.setNode(this.node))
25
+ .attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
19
26
  .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
20
27
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
21
28
  .clip(true)
@@ -51,7 +58,7 @@ export default struct TaroMovableArea {
51
58
  Column() {
52
59
  this.createLazyChildren(this.node)
53
60
  }
54
- .attributeModifier(columnModify.setNode(this.node))
61
+ .attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
55
62
  .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
56
63
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
57
64
  .clip(true)
@@ -1,4 +1,4 @@
1
- import type { TaroMovableViewElement } from '@tarojs/runtime'
1
+ import type { TaroAny, TaroMovableViewElement } from '@tarojs/runtime'
2
2
 
3
3
  import { rowModify, columnModify } from './style'
4
4
 
@@ -9,6 +9,13 @@ export default struct TaroMovableView {
9
9
  @Builder customBuilder() {}
10
10
  @BuilderParam createLazyChildren: (node: TaroMovableViewElement) => void = this.customBuilder
11
11
  @ObjectLink node: TaroMovableViewElement
12
+ @State overwriteStyle: Record<string, TaroAny> = {}
13
+
14
+ aboutToAppear(): void {
15
+ if (this.node) {
16
+ this.node._instance = this
17
+ }
18
+ }
12
19
 
13
20
  build() {
14
21
  if (this.node && this.node.hmStyle?.display !== 'none') {
@@ -18,14 +25,14 @@ export default struct TaroMovableView {
18
25
  Row() {
19
26
  this.createLazyChildren(this.node)
20
27
  }
21
- .attributeModifier(rowModify.setNode(this.node))
28
+ .attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
22
29
  .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
23
30
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
24
31
  } else {
25
32
  Column() {
26
33
  this.createLazyChildren(this.node)
27
34
  }
28
- .attributeModifier(columnModify.setNode(this.node))
35
+ .attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
29
36
  .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
30
37
  .justifyContent(FlexManager.flexOptions(this.node).justifyContent)
31
38
  }
@@ -7,7 +7,7 @@ import { shouldBindEvent, getNodeThresholds } from './utils/helper'
7
7
 
8
8
  import type { TaroAny, TaroEvent } from '@tarojs/runtime'
9
9
 
10
- import { PickerDateProps, PickerMultiSelectorProps, PickerSelectorProps, PickerTimeProps } from './types'
10
+ import { PickerDateProps, PickerMultiSelectorProps, PickerSelectorProps, PickerTimeProps } from '@tarojs/components/types'
11
11
 
12
12
  interface TimeRange {
13
13
  startHH: number
@@ -12,6 +12,13 @@ export default struct TaroProgress {
12
12
  @Builder customBuilder() {}
13
13
  @BuilderParam createLazyChildren: (node: TaroProgressElement) => void = this.customBuilder
14
14
  @ObjectLink node: TaroProgressElement
15
+ @State overwriteStyle: Record<string, TaroAny> = {}
16
+
17
+ aboutToAppear(): void {
18
+ if (this.node) {
19
+ this.node._instance = this
20
+ }
21
+ }
15
22
 
16
23
  build() {
17
24
  if (this.node && this.node.hmStyle?.display !== 'none') {
@@ -20,7 +27,7 @@ export default struct TaroProgress {
20
27
  value: parseFloat(this.node.getAttribute('percent')),
21
28
  type: ProgressType.Linear
22
29
  })
23
- .attributeModifier(commonStyleModify.setNode(this.node))
30
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
24
31
  .color(this.node.getAttribute('activeColor') ?? PROGRESS_ACTIVECOLOR)
25
32
  .backgroundColor(this.node.getAttribute('backgroundColor') ?? PROGRESS_BACKGROUNDCOLOR)
26
33
  .style({
@@ -37,10 +37,12 @@ export struct TaroRadio {
37
37
  @Builder customBuilder() {}
38
38
  @BuilderParam createLazyChildren: (node: TaroRadioElement) => void = this.customBuilder
39
39
  @ObjectLink node: TaroRadioElement
40
+ @State overwriteStyle: Record<string, TaroAny> = {}
40
41
 
41
42
  aboutToAppear () {
42
43
  if (this.node && !this.node._isInit) {
43
44
  this.node._isInit = true
45
+ this.node._instance = this
44
46
  this.node._reset = this.node.checked || false
45
47
  }
46
48
  }
@@ -54,7 +56,7 @@ export struct TaroRadio {
54
56
  value: this.node.value || '',
55
57
  })
56
58
  .checked(this.node.checked)
57
- .attributeModifier(commonStyleModify.setNode(this.node))
59
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
58
60
  .radioAttr(getAttributes(this.node))
59
61
  .onChange((value: boolean) => {
60
62
  if (this.node) {
@@ -99,6 +101,7 @@ export struct TaroRadioGroup {
99
101
  @Builder customBuilder() {}
100
102
  @BuilderParam createLazyChildren: (node: TaroRadioGroupElement) => void = this.customBuilder
101
103
  @ObjectLink node: TaroRadioGroupElement
104
+ @State overwriteStyle: Record<string, TaroAny> = {}
102
105
 
103
106
  @Styles visibleChangeEvent () {
104
107
  .onVisibleAreaChange(getNodeThresholds(this.node) || [0.0, 1.0], getComponentEventCallback(this.node, VISIBLE_CHANGE_EVENT_NAME))
@@ -106,6 +109,7 @@ export struct TaroRadioGroup {
106
109
 
107
110
  aboutToAppear () {
108
111
  if (this.node) {
112
+ this.node._instance = this
109
113
  const childList = this.node.getElementsByTagName<TaroRadioElement>('RADIO')
110
114
  childList.forEach(element => {
111
115
  element.group = this.node?._attrs.name || this.node?._nid
@@ -131,7 +135,7 @@ export struct TaroRadioGroup {
131
135
  Row() {
132
136
  this.createLazyChildren(this.node)
133
137
  }
134
- .attributeModifier(commonStyleModify.setNode(this.node))
138
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
135
139
  .defaultEvent()
136
140
  .visibleChangeEvent()
137
141
  .alignItems(FlexManager.flexOptions(this.node).alignItems as VerticalAlign)
@@ -140,7 +144,7 @@ export struct TaroRadioGroup {
140
144
  Column() {
141
145
  this.createLazyChildren(this.node)
142
146
  }
143
- .attributeModifier(commonStyleModify.setNode(this.node))
147
+ .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
144
148
  .defaultEvent()
145
149
  .visibleChangeEvent()
146
150
  .alignItems(FlexManager.flexOptions(this.node).alignItems as HorizontalAlign)
@@ -62,6 +62,13 @@ export default struct TaroScrollView {
62
62
  @Builder customBuilder() {}
63
63
  @BuilderParam createLazyChildren: (node: TaroScrollViewElement) => void = this.customBuilder
64
64
  @ObjectLink node: TaroScrollViewElement
65
+ @State overwriteStyle: Record<string, TaroAny> = {}
66
+
67
+ aboutToAppear(): void {
68
+ if (this.node) {
69
+ this.node._instance = this
70
+ }
71
+ }
65
72
 
66
73
  build () {
67
74
  if (this.node.hmStyle?.display !== 'none') {
@@ -74,7 +81,7 @@ export default struct TaroScrollView {
74
81
  this.createLazyChildren(this.node)
75
82
  }
76
83
  }
77
- .attributeModifier(rowModify.setNode(this.node))
84
+ .attributeModifier(rowModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
78
85
  .width(null)
79
86
  .onAreaChange(shouldBindEvent((_: Area, areaResult: Area) => {
80
87
  this.node._nodeInfo._scroll = areaResult
@@ -90,7 +97,7 @@ export default struct TaroScrollView {
90
97
  this.createLazyChildren(this.node)
91
98
  }
92
99
  }
93
- .attributeModifier(columnModify.setNode(this.node))
100
+ .attributeModifier(columnModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
94
101
  .height(null)
95
102
  .alignItems(HorizontalAlign.Start)
96
103
  .onAreaChange(shouldBindEvent((_: Area, areaResult: Area) => {
@@ -42,6 +42,7 @@ export default struct TaroSlider {
42
42
  @ObjectLink node: TaroSliderElement
43
43
 
44
44
  @State value: number = 0
45
+ @State overwriteStyle: Record<string, TaroAny> = {}
45
46
 
46
47
  aboutToAppear () {
47
48
  if (this.node) {
@@ -64,7 +65,7 @@ export default struct TaroSlider {
64
65
  style: SliderStyle.OutSet,
65
66
  direction: Axis.Horizontal
66
67
  })
67
- .attributeModifier(commonStyleModify.setNode(node))
68
+ .attributeModifier(commonStyleModify.setNode(node).setAnimationStyle(this.overwriteStyle))
68
69
  .attrs(getAttributes(node))
69
70
  .width(!!node._attrs.showValue ? '90%' : '100%')
70
71
  .themeStyles(!!node._attrs.disabled)