@tarojs/plugin-platform-harmony-ets 4.0.0-beta.12 → 4.0.0-beta.121

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 (143) hide show
  1. package/dist/apis/base/system.ts +60 -25
  2. package/dist/apis/base/weapp/life-cycle.ts +1 -1
  3. package/dist/apis/canvas/index.ts +10 -1
  4. package/dist/apis/device/clipboard.ts +23 -8
  5. package/dist/apis/framework/index.ts +2 -6
  6. package/dist/apis/index.ts +25 -17
  7. package/dist/apis/media/image/index.ts +169 -17
  8. package/dist/apis/route/index.ts +1 -2
  9. package/dist/apis/storage/index.ts +135 -131
  10. package/dist/apis/ui/animation/animation.ts +71 -29
  11. package/dist/apis/ui/background.ts +3 -2
  12. package/dist/apis/ui/interaction/index.ts +58 -59
  13. package/dist/apis/ui/navigation-bar/index.ts +2 -2
  14. package/dist/apis/ui/pull-down-refresh.ts +9 -3
  15. package/dist/apis/ui/scroll/index.ts +6 -6
  16. package/dist/apis/ui/tab-bar.ts +4 -5
  17. package/dist/apis/utils/index.ts +20 -2
  18. package/dist/apis/utils/permissions.ts +6 -0
  19. package/dist/apis/wxml/IntersectionObserver.ts +18 -10
  20. package/dist/apis/wxml/selectorQuery.ts +26 -13
  21. package/dist/components-harmony-ets/button.ets +36 -9
  22. package/dist/components-harmony-ets/canvas.ets +51 -0
  23. package/dist/components-harmony-ets/checkbox.ets +69 -60
  24. package/dist/components-harmony-ets/form.ets +33 -15
  25. package/dist/components-harmony-ets/icon.ets +16 -8
  26. package/dist/components-harmony-ets/image.ets +22 -6
  27. package/dist/components-harmony-ets/index.ets +39 -0
  28. package/dist/components-harmony-ets/innerHtml.ets +6 -5
  29. package/dist/components-harmony-ets/input.ets +63 -37
  30. package/dist/components-harmony-ets/label.ets +43 -21
  31. package/dist/components-harmony-ets/listView.ets +32 -0
  32. package/dist/components-harmony-ets/movableArea.ets +110 -51
  33. package/dist/components-harmony-ets/movableView.ets +74 -47
  34. package/dist/components-harmony-ets/navigationBar.ets +65 -0
  35. package/dist/components-harmony-ets/pageMeta.ets +94 -0
  36. package/dist/components-harmony-ets/picker.ets +36 -33
  37. package/dist/components-harmony-ets/progress.ets +31 -24
  38. package/dist/components-harmony-ets/pseudo.ets +80 -0
  39. package/dist/components-harmony-ets/radio.ets +75 -66
  40. package/dist/components-harmony-ets/richText.ets +4 -25
  41. package/dist/components-harmony-ets/scrollList.ets +108 -0
  42. package/dist/components-harmony-ets/scrollView.ets +46 -42
  43. package/dist/components-harmony-ets/slider.ets +19 -15
  44. package/dist/components-harmony-ets/stickySection.ets +42 -0
  45. package/dist/components-harmony-ets/style.ets +386 -129
  46. package/dist/components-harmony-ets/swiper.ets +42 -5
  47. package/dist/components-harmony-ets/switch.ets +36 -32
  48. package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
  49. package/dist/components-harmony-ets/text.ets +102 -46
  50. package/dist/components-harmony-ets/textArea.ets +49 -34
  51. package/dist/components-harmony-ets/utils/AttributeManager.ets +2 -2
  52. package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -2
  53. package/dist/components-harmony-ets/utils/flexManager.ets +49 -19
  54. package/dist/components-harmony-ets/utils/helper.ets +20 -8
  55. package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
  56. package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
  57. package/dist/components-harmony-ets/utils/index.ts +54 -50
  58. package/dist/components-harmony-ets/utils/styles.ets +169 -91
  59. package/dist/components-harmony-ets/video.ets +28 -20
  60. package/dist/components-harmony-ets/view.ets +45 -39
  61. package/dist/components-harmony-ets/webView.ets +6 -5
  62. package/dist/index.d.ts +152 -0
  63. package/dist/index.js +73 -44
  64. package/dist/index.js.map +1 -1
  65. package/dist/runtime-ets/bom/URL.ts +2 -0
  66. package/dist/runtime-ets/bom/document.ts +5 -4
  67. package/dist/runtime-ets/bom/getComputedStyle.ts +2 -3
  68. package/dist/runtime-ets/bom/history.ts +1 -0
  69. package/dist/runtime-ets/bom/location.ts +1 -0
  70. package/dist/runtime-ets/bom/navigator.ts +1 -21
  71. package/dist/runtime-ets/bom/raf.ts +1 -37
  72. package/dist/runtime-ets/bom/window.ts +10 -4
  73. package/dist/runtime-ets/constant.ts +17 -10
  74. package/dist/runtime-ets/current.ts +5 -2
  75. package/dist/runtime-ets/dom/bind.ts +28 -12
  76. package/dist/runtime-ets/dom/class-list.ts +2 -2
  77. package/dist/runtime-ets/dom/cssNesting.ts +419 -0
  78. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +28 -42
  79. package/dist/runtime-ets/dom/document.ts +9 -12
  80. package/dist/runtime-ets/dom/element/canvas.ts +137 -0
  81. package/dist/runtime-ets/dom/element/element.ts +379 -55
  82. package/dist/runtime-ets/dom/element/form.ts +26 -22
  83. package/dist/runtime-ets/dom/element/index.ts +22 -2
  84. package/dist/runtime-ets/dom/element/movableArea.ts +0 -1
  85. package/dist/runtime-ets/dom/element/movableView.ts +238 -2
  86. package/dist/runtime-ets/dom/element/normal.ts +27 -6
  87. package/dist/runtime-ets/dom/element/progress.ts +0 -2
  88. package/dist/runtime-ets/dom/element/text.ts +0 -8
  89. package/dist/runtime-ets/dom/element/video.ts +4 -4
  90. package/dist/runtime-ets/dom/element/webView.ts +4 -5
  91. package/dist/runtime-ets/dom/event-source.ts +1 -0
  92. package/dist/runtime-ets/dom/event.ts +3 -5
  93. package/dist/runtime-ets/dom/eventTarget.ts +3 -4
  94. package/dist/runtime-ets/dom/node.ts +53 -22
  95. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +418 -237
  96. package/dist/runtime-ets/dom/stylesheet/index.ts +29 -311
  97. package/dist/runtime-ets/dom/stylesheet/type.ts +53 -11
  98. package/dist/runtime-ets/dom/stylesheet/util.ts +33 -27
  99. package/dist/runtime-ets/emitter/emitter.ts +1 -0
  100. package/dist/runtime-ets/env.ts +1 -0
  101. package/dist/runtime-ets/index.ts +23 -7
  102. package/dist/runtime-ets/interface/event.ts +1 -1
  103. package/dist/runtime-ets/interface/index.ts +6 -0
  104. package/dist/runtime-ets/utils/index.ts +78 -19
  105. package/dist/runtime-ets/utils/info.ts +2 -2
  106. package/dist/runtime-ets/utils/router.ts +9 -0
  107. package/dist/runtime-framework/react/app.ts +15 -11
  108. package/dist/runtime-framework/react/hooks.ts +1 -2
  109. package/dist/runtime-framework/react/index.ts +0 -2
  110. package/dist/runtime-framework/react/native-page.ts +217 -81
  111. package/dist/runtime-framework/react/page.ts +4 -10
  112. package/dist/runtime-framework/react/utils/index.ts +3 -3
  113. package/dist/runtime-framework/solid/app.ts +29 -46
  114. package/dist/runtime-framework/solid/connect.ts +21 -3
  115. package/dist/runtime-framework/solid/hooks.ts +16 -11
  116. package/dist/runtime-framework/solid/index.ts +6 -2
  117. package/dist/runtime-framework/solid/page.ts +84 -31
  118. package/dist/runtime-framework/solid/reconciler/props.ts +73 -29
  119. package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
  120. package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
  121. package/dist/runtime-framework/solid/utils/index.ts +3 -5
  122. package/dist/runtime-utils.d.ts +827 -0
  123. package/dist/runtime-utils.js +574 -285
  124. package/dist/runtime-utils.js.map +1 -1
  125. package/dist/runtime.d.ts +1 -0
  126. package/dist/runtime.js +574 -285
  127. package/dist/runtime.js.map +1 -1
  128. package/index.js +3 -1
  129. package/package.json +14 -15
  130. package/static/media/cancel.svg +1 -1
  131. package/static/media/circle.svg +1 -1
  132. package/static/media/clear.svg +1 -1
  133. package/static/media/download.svg +1 -1
  134. package/static/media/info.svg +1 -1
  135. package/static/media/info_circle.svg +1 -1
  136. package/static/media/search.svg +1 -1
  137. package/static/media/success.svg +1 -1
  138. package/static/media/success_no_circle.svg +1 -1
  139. package/static/media/warn.svg +1 -1
  140. package/types/harmony.d.ts +5 -0
  141. package/types/index.d.ts +4 -0
  142. package/types/runtime.d.ts +1 -1
  143. /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
@@ -3,8 +3,7 @@
3
3
  * https://developer.harmonyos.com/cn/docs/documentation/doc-references-V3/js-apis-data-preferences-0000001427745052-V3
4
4
  */
5
5
  import bundleManager from '@ohos.bundle.bundleManager'
6
- import dataPreferences from '@ohos.data.preferences'
7
- import hilog from '@ohos.hilog'
6
+ import distributedKVStore from '@ohos.data.distributedKVStore'
8
7
  import { Current } from '@tarojs/runtime'
9
8
 
10
9
  import { temporarilyNotSupport, validateParams } from '../utils'
@@ -13,177 +12,176 @@ import { MethodHandler } from '../utils/handler'
13
12
  import type Taro from '@tarojs/taro/types'
14
13
 
15
14
  let context
16
- let preferences: any
15
+ let kvManager: distributedKVStore.KVManager
16
+ let kvStore: distributedKVStore.SingleKVStore
17
+ let kvStorePromise: Promise<void>
17
18
 
18
19
  (Current as any).contextPromise.then((ctx) => {
19
20
  context = ctx
20
- return context
21
- })
21
+ const kvManagerConfig: distributedKVStore.KVManagerConfig = {
22
+ context: context,
23
+ bundleName: 'com.example.taro'
24
+ }
22
25
 
23
- function getPreferences () {
24
26
  try {
25
- if (!preferences) {
26
- const data = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
27
- preferences = dataPreferences.getPreferencesSync(context, { name: `${data.appInfo.uid}Store` })
27
+ // 创建KVManager实例
28
+ kvManager = distributedKVStore.createKVManager(kvManagerConfig)
29
+ // 继续创建获取数据库
30
+ const options: distributedKVStore.Options = {
31
+ createIfMissing: true,
32
+ encrypt: false,
33
+ backup: false,
34
+ autoSync: false,
35
+ // kvStoreType不填时,默认创建多设备协同数据库
36
+ kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION,
37
+ // 多设备协同数据库:kvStoreType: distributedKVStore.KVStoreType.DEVICE_COLLABORATION,
38
+ securityLevel: distributedKVStore.SecurityLevel.S1
28
39
  }
29
- } catch (error) {
30
- hilog.error(0x0000, 'TaroFailedTag', 'Failed to load the storage. Cause: %{public}s', error.code ? JSON.stringify(error) : error.message || error)
40
+
41
+ const data = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
42
+ kvStorePromise = new Promise(resolve => {
43
+ kvManager.getKVStore<distributedKVStore.SingleKVStore>(`${data.appInfo.uid}Store`, options, (err, store: distributedKVStore.SingleKVStore) => {
44
+ if (err) {
45
+ console.error(`Failed to get KVStore: Code:${err.code},message:${err.message}`)
46
+ return
47
+ }
48
+ kvStore = store
49
+ // 请确保获取到键值数据库实例后,再进行相关数据操作
50
+ resolve()
51
+ })
52
+ })
53
+ } catch (e) {
54
+ console.error(`Failed to create KVManager. Code:${e.code},message:${e.message}`)
31
55
  }
32
56
 
33
- return preferences
34
- }
57
+ return context
58
+ })
35
59
 
36
60
  const storageSchema = {
37
61
  key: 'String'
38
62
  }
39
63
 
40
- export function getStorage<T = any> (options: Taro.getStorage.Option<T>) {
41
- const { key, success, fail, complete } = options || {}
42
- const handle = new MethodHandler<{data: any}>({ name: 'getStorage', success, fail, complete })
43
-
44
- return new Promise((resolve, reject) => {
45
- try {
46
- validateParams('getStorage', options, storageSchema)
47
- } catch (error) {
48
- const res = { errMsg: error.message }
49
- return handle.fail(res, { resolve, reject })
50
- }
51
-
52
- const preferences = getPreferences()
53
-
54
- if (!preferences) return handle.fail({}, { resolve, reject })
55
-
56
- const data = preferences.getSync(key, null)
57
- if (data) {
58
- return handle.success({ data }, { resolve, reject })
64
+ function checkContextExist (api: string, isAsync = false) {
65
+ if (!context) {
66
+ const message = `${api} 调用失败,Taro 不支持过早地调用 ${api},请确保页面已经渲染完成再调用此 API`
67
+ if (isAsync) {
68
+ return {
69
+ isExist: false,
70
+ error: Promise.reject(new Error(message))
71
+ }
59
72
  } else {
60
- return handle.success({ errMsg: 'data not found' }, { resolve, reject })
61
- }
62
- })
63
- }
73
+ console.warn(message)
64
74
 
65
- export function getStorageSync (key: string) {
66
- if (!key) {
67
- throw new Error('getStorageSync:fail parameter error: parameter should be String')
68
- }
69
-
70
- const preferences = getPreferences()
71
-
72
- if (!preferences) {
73
- throw new Error('getStorageSync:fail:preferences is null')
75
+ return {
76
+ isExist: false,
77
+ }
78
+ }
74
79
  }
75
80
 
76
- const data = preferences.getSync(key, null)
77
- if (data) {
78
- return data
79
- } else {
80
- throw new Error('data not found')
81
+ return {
82
+ isExist: true,
81
83
  }
82
84
  }
83
85
 
84
- export function setStorage (options: Taro.setStorage.Option) {
85
- const { key, data, success, fail, complete } = options || {}
86
- const handle = new MethodHandler({ name: 'setStorage', success, fail, complete })
87
-
88
- return new Promise((resolve, reject) => {
89
- try {
90
- validateParams('setStorage', options, storageSchema)
91
- } catch (error) {
92
- const res = { errMsg: error.message }
93
- return handle.fail(res, { resolve, reject })
94
- }
95
-
96
- const preferences = getPreferences()
86
+ export function getStorage<T = any> (options: Taro.getStorage.Option<T>) {
87
+ const name = 'getStorage'
88
+ const { isExist, error } = checkContextExist(name, true)
97
89
 
98
- if (!preferences) return handle.fail({}, { resolve, reject })
90
+ if (!isExist) {
91
+ return error
92
+ }
99
93
 
100
- preferences.putSync(key, data)
101
- preferences.flush()
94
+ const { key, success, fail, complete } = options || {}
95
+ const handle = new MethodHandler<{data: any}>({ name, success, fail, complete })
102
96
 
103
- return handle.success({}, { resolve, reject })
97
+ return new Promise((resolve, reject) => {
98
+ kvStorePromise.then(() => {
99
+ try {
100
+ validateParams(name, options, storageSchema)
101
+ } catch (error) {
102
+ const res = { errMsg: error.message }
103
+ return handle.fail(res, { resolve, reject })
104
+ }
105
+
106
+ kvStore = kvStore as distributedKVStore.SingleKVStore
107
+ kvStore.get(key, (err, data) => {
108
+ if (err) {
109
+ handle.fail({ errMsg: `Failed to get data. Code:${err.code},message:${err.message}` }, { resolve, reject })
110
+ return
111
+ }
112
+
113
+ handle.success({ data }, { resolve, reject })
114
+ })
115
+ })
104
116
  })
105
117
  }
106
118
 
107
- export function setStorageSync (key: string, data: any) {
108
- if (!key) {
109
- throw new Error('setStorageSync:fail key error: key should be String')
110
- }
119
+ export function setStorage (options: Taro.setStorage.Option) {
120
+ const name = 'setStorage'
121
+ const { isExist, error } = checkContextExist(name, true)
111
122
 
112
- const preferences = getPreferences()
113
-
114
- if (!preferences) {
115
- throw new Error('setStorageSync:fail:preferences is null')
123
+ if (!isExist) {
124
+ return error
116
125
  }
117
126
 
118
- preferences.putSync(key, data)
119
- preferences.flush()
120
- }
121
-
122
- export function removeStorage (options: Taro.removeStorage.Option) {
123
- const { key, success, fail, complete } = options || {}
124
- const handle = new MethodHandler({ name: 'removeStorage', success, fail, complete })
127
+ const { key, data, success, fail, complete } = options || {}
128
+ const handle = new MethodHandler({ name, success, fail, complete })
125
129
 
126
130
  return new Promise((resolve, reject) => {
127
- try {
128
- validateParams('removeStorage', options, storageSchema)
129
- } catch (error) {
130
- const res = { errMsg: error.message }
131
- return handle.fail(res, { resolve, reject })
132
- }
133
-
134
- const preferences = getPreferences()
135
-
136
- if (!preferences) return handle.fail({}, { resolve, reject })
137
-
138
- preferences.deleteSync(key)
139
- preferences.flush()
140
-
141
- return handle.success({}, { resolve, reject })
131
+ kvStorePromise.then(() => {
132
+ try {
133
+ validateParams(name, options, storageSchema)
134
+ } catch (error) {
135
+ const res = { errMsg: error.message }
136
+ return handle.fail(res, { resolve, reject })
137
+ }
138
+
139
+ kvStore = kvStore as distributedKVStore.SingleKVStore
140
+ kvStore.put(key, data, (err) => {
141
+ if (err) {
142
+ handle.fail({ errMsg: `Failed to put data. Code:${err.code},message:${err.message}` }, { resolve, reject })
143
+ return
144
+ }
145
+
146
+ handle.success({}, { resolve, reject })
147
+ })
148
+ })
142
149
  })
143
150
  }
144
151
 
145
- export function removeStorageSync (key: string) {
146
- if (!key) {
147
- throw new Error('removeStorageSync:fail key error: key should be String')
148
- }
152
+ export function removeStorage (options: Taro.removeStorage.Option) {
153
+ const name = 'removeStorage'
154
+ const { isExist, error } = checkContextExist(name, true)
149
155
 
150
- const preferences = getPreferences()
151
-
152
- if (!preferences) {
153
- throw new Error('removeStorageSync:fail:preferences is null')
156
+ if (!isExist) {
157
+ return error
154
158
  }
155
159
 
156
- preferences.deleteSync(key)
157
- preferences.flush()
158
- }
159
-
160
- export function clearStorage (options: Taro.clearStorage.Option) {
161
- const { success, fail, complete } = options || {}
162
- const handle = new MethodHandler({ name: 'clearStorage', success, fail, complete })
160
+ const { key, success, fail, complete } = options || {}
161
+ const handle = new MethodHandler({ name, success, fail, complete })
163
162
 
164
163
  return new Promise((resolve, reject) => {
165
- const preferences = getPreferences()
166
-
167
- if (!preferences) return handle.fail({}, { resolve, reject })
168
-
169
- preferences.clearSync()
170
- preferences.flush()
171
-
172
- return handle.success({}, { resolve, reject })
164
+ kvStorePromise.then(() => {
165
+ try {
166
+ validateParams(name, options, storageSchema)
167
+ } catch (error) {
168
+ const res = { errMsg: error.message }
169
+ return handle.fail(res, { resolve, reject })
170
+ }
171
+
172
+ kvStore = kvStore as distributedKVStore.SingleKVStore
173
+ kvStore.delete(key, (err) => {
174
+ if (err) {
175
+ handle.fail({ errMsg: `Failed to delete data. Code:${err.code},message:${err.message}` }, { resolve, reject })
176
+ return
177
+ }
178
+
179
+ handle.success({}, { resolve, reject })
180
+ })
181
+ })
173
182
  })
174
183
  }
175
184
 
176
- export function clearStorageSync () {
177
- const preferences = getPreferences()
178
-
179
- if (!preferences) {
180
- throw new Error('clearStorageSync:fail:preferences is null')
181
- }
182
-
183
- preferences.clearSync()
184
- preferences.flush()
185
- }
186
-
187
185
  export const getStorageInfoSync = temporarilyNotSupport('getStorageInfoSync')
188
186
  export const getStorageInfo = temporarilyNotSupport('getStorageInfo')
189
187
 
@@ -195,5 +193,11 @@ export const batchSetStorage = /* @__PURE__ */ temporarilyNotSupport('batchSetSt
195
193
  export const batchGetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchGetStorageSync')
196
194
  export const batchGetStorage = /* @__PURE__ */ temporarilyNotSupport('batchGetStorage')
197
195
 
196
+ export const clearStorage = temporarilyNotSupport('clearStorage')
197
+ export const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage')
198
+ export const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage')
199
+ export const clearStorageSync = temporarilyNotSupport('clearStorageSync', 'clearStorage')
200
+ export const removeStorageSync = temporarilyNotSupport('removeStorageSync', 'removeStorage')
201
+
198
202
  export * from './background-fetch'
199
203
  export * from './cache-manager'
@@ -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
 
@@ -22,7 +23,6 @@ type TStep = {
22
23
  type TRule = Record<string, any>
23
24
 
24
25
  export class Animation implements Taro.Animation {
25
-
26
26
  unit: string
27
27
  DEFAULT: IAnimationAttr
28
28
 
@@ -71,6 +71,9 @@ export class Animation implements Taro.Animation {
71
71
  transformOrigin,
72
72
  rule: Object.assign({}, this.rule)
73
73
  })
74
+ if (this.rule.transform) {
75
+ this.rule.transform = Object.assign({}, this.rule.transform)
76
+ }
74
77
  return this
75
78
  }
76
79
 
@@ -85,92 +88,137 @@ export class Animation implements Taro.Animation {
85
88
  }
86
89
 
87
90
  rotate (angle: number): Taro.Animation {
88
- this.rule.rotate = { x: 0, y: 0, z: 1, angle }
91
+ if (!this.rule.transform) {
92
+ this.rule.transform = {}
93
+ }
94
+ this.rule.transform.Rotate = { x: 0, y: 0, z: 1, angle }
89
95
  return this
90
96
  }
91
97
 
92
98
  rotate3d (x: number, y?: number | undefined, z?: number | undefined, angle?: number | undefined): Taro.Animation {
93
- this.rule.rotate = { x, y, z, angle }
99
+ if (!this.rule.transform) {
100
+ this.rule.transform = {}
101
+ }
102
+ this.rule.transform.Rotate = { x, y, z, angle }
94
103
  return this
95
104
  }
96
105
 
97
106
  rotateX (angle: number): Taro.Animation {
98
- this.rule.rotate = { x: 1, y: 0, z: 0, angle }
107
+ if (!this.rule.transform) {
108
+ this.rule.transform = {}
109
+ }
110
+ this.rule.transform.Rotate = { x: 1, y: 0, z: 0, angle }
99
111
  return this
100
112
  }
101
113
 
102
114
  rotateY (angle: number): Taro.Animation {
103
- this.rule.rotate = { x: 0, y: 1, z: 0, angle }
115
+ if (!this.rule.transform) {
116
+ this.rule.transform = {}
117
+ }
118
+ this.rule.transform.Rotate = { x: 0, y: 1, z: 0, angle }
104
119
  return this
105
120
  }
106
121
 
107
122
  rotateZ (angle: number): Taro.Animation {
108
- this.rule.rotate = { x: 0, y: 0, z: 1, angle }
123
+ if (!this.rule.transform) {
124
+ this.rule.transform = {}
125
+ }
126
+ this.rule.transform.Rotate = { x: 0, y: 0, z: 1, angle }
109
127
  return this
110
128
  }
111
129
 
112
130
  scale (sx: number, sy?: number | undefined): Taro.Animation {
113
- this.rule.scale = { x: sx, y: sy }
131
+ if (!this.rule.transform) {
132
+ this.rule.transform = {}
133
+ }
134
+ this.rule.transform.Scale = { x: sx, y: isUndefined(sy) ? sx : sy }
114
135
  return this
115
136
  }
116
137
 
117
138
  scale3d (sx: number, sy: number, sz: number): Taro.Animation {
118
- this.rule.scale = { x: sx, y: sy, z: sz }
139
+ if (!this.rule.transform) {
140
+ this.rule.transform = {}
141
+ }
142
+ this.rule.transform.Scale = { x: sx, y: sy, z: sz }
119
143
  return this
120
144
  }
121
145
 
122
146
  scaleX (scale: number): Taro.Animation {
123
- this.rule.scale = { x: scale }
147
+ if (!this.rule.transform) {
148
+ this.rule.transform = {}
149
+ }
150
+ this.rule.transform.Scale = { x: scale }
124
151
  return this
125
152
  }
126
153
 
127
154
  scaleY (scale: number): Taro.Animation {
128
- this.rule.scale = { y: scale }
155
+ if (!this.rule.transform) {
156
+ this.rule.transform = {}
157
+ }
158
+ this.rule.transform.Scale = { y: scale }
129
159
  return this
130
160
  }
131
161
 
132
162
  scaleZ (scale: number): Taro.Animation {
133
- this.rule.scale = { z: scale }
163
+ if (!this.rule.transform) {
164
+ this.rule.transform = {}
165
+ }
166
+ this.rule.transform.Scale = { z: scale }
134
167
  return this
135
168
  }
136
169
 
137
170
  skew (ax: number, ay: number): Taro.Animation {
138
- this.rule.skew = { x: ax, y: ay }
171
+ temporarilyNotSupport('animation.skew:' + `${ax}, ${ay}`)(ax, ay)
139
172
  return this
140
173
  }
141
174
 
142
175
  skewX (angle: number): Taro.Animation {
143
- this.rule.skew = { x: angle }
176
+ temporarilyNotSupport('animation.skewX:' + angle)(angle)
144
177
  return this
145
178
  }
146
179
 
147
180
  skewY (angle: number): Taro.Animation {
148
- this.rule.skew = { y: angle }
181
+ temporarilyNotSupport('animation.skewY:' + angle)(angle)
149
182
  return this
150
183
  }
151
184
 
152
185
  translate (tx?: number | undefined, ty?: number | undefined): Taro.Animation {
153
- this.rule.translate = { x: tx, y: ty }
186
+ if (!this.rule.transform) {
187
+ this.rule.transform = {}
188
+ }
189
+ this.rule.transform.Translate = { x: tx, y: ty }
154
190
  return this
155
191
  }
156
192
 
157
193
  translate3d (tx?: number | undefined, ty?: number | undefined, tz?: number | undefined): Taro.Animation {
158
- this.rule.translate = { x: tx, y: ty, z: tz }
194
+ if (!this.rule.transform) {
195
+ this.rule.transform = {}
196
+ }
197
+ this.rule.transform.Translate = { x: tx, y: ty, z: tz }
159
198
  return this
160
199
  }
161
200
 
162
201
  translateX (translation: number): Taro.Animation {
163
- this.rule.translate = { x: translation }
202
+ if (!this.rule.transform) {
203
+ this.rule.transform = {}
204
+ }
205
+ this.rule.transform.Translate = { x: translation }
164
206
  return this
165
207
  }
166
208
 
167
209
  translateY (translation: number): Taro.Animation {
168
- this.rule.translate = { y: translation }
210
+ if (!this.rule.transform) {
211
+ this.rule.transform = {}
212
+ }
213
+ this.rule.transform.Translate = { y: translation }
169
214
  return this
170
215
  }
171
216
 
172
217
  translateZ (translation: number): Taro.Animation {
173
- this.rule.translate = { z: translation }
218
+ if (!this.rule.transform) {
219
+ this.rule.transform = {}
220
+ }
221
+ this.rule.transform.Translate = { z: translation }
174
222
  return this
175
223
  }
176
224
 
@@ -185,23 +233,17 @@ export class Animation implements Taro.Animation {
185
233
  }
186
234
 
187
235
  width (value: string | number): Taro.Animation {
188
- this.rule.size = {
189
- ...this.rule.size,
190
- width: value
191
- }
236
+ this.rule.width = value
192
237
  return this
193
238
  }
194
239
 
195
240
  height (value: string | number): Taro.Animation {
196
- this.rule.size = {
197
- ...this.rule.size,
198
- height: value
199
- }
241
+ this.rule.height = value
200
242
  return this
201
243
  }
202
244
 
203
245
  left (value: string | number): Taro.Animation {
204
- temporarilyNotSupport('animation.left:' + value)(value)
246
+ this.rule.left = value
205
247
  return this
206
248
  }
207
249
 
@@ -211,7 +253,7 @@ export class Animation implements Taro.Animation {
211
253
  }
212
254
 
213
255
  top (value: string | number): Taro.Animation {
214
- temporarilyNotSupport('animation.top:' + value)(value)
256
+ this.rule.top = value
215
257
  return this
216
258
  }
217
259
 
@@ -1,4 +1,4 @@
1
- import { eventCenter } from '@tarojs/runtime/dist/runtime.esm'
1
+ import { eventCenter } from '@tarojs/runtime'
2
2
 
3
3
  import { temporarilyNotSupport } from '../utils'
4
4
  import { MethodHandler } from '../utils/handler'
@@ -11,7 +11,8 @@ export function setBackgroundColor(options: Taro.setBackgroundColor.Option) {
11
11
 
12
12
  return new Promise((resolve, reject) => {
13
13
  eventCenter.trigger('__taroPageStyle', {
14
- backgroundColor: options.backgroundColor || options.backgroundColorTop || options.backgroundColorBottom,
14
+ backgroundColor: options.backgroundColorBottom || options.backgroundColor,
15
+ backgroundColorContext: options.backgroundColorTop || options.backgroundColor
15
16
  })
16
17
 
17
18
  return handle.success({}, { resolve, reject })