@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.
- package/dist/apis/apis.ts +6 -2
- package/dist/apis/base/crypto.ts +4 -0
- package/dist/apis/base/debug.ts +5 -0
- package/dist/apis/base/index.ts +9 -1
- package/dist/apis/base/performance.ts +8 -0
- package/dist/apis/base/system.ts +74 -21
- package/dist/apis/base/update.ts +5 -0
- package/dist/apis/base/weapp/app-event.ts +75 -0
- package/dist/apis/base/weapp/life-cycle.ts +21 -0
- package/dist/apis/canvas/index.ts +27 -0
- package/dist/apis/data-analysis/index.ts +6 -0
- package/dist/apis/device/accelerometer.ts +2 -1
- package/dist/apis/device/accessibility.ts +4 -0
- package/dist/apis/device/battery.ts +2 -2
- package/dist/apis/device/bluetooth-ble.ts +19 -0
- package/dist/apis/device/bluetooth-peripheral.ts +6 -0
- package/dist/apis/device/bluetooth.ts +16 -0
- package/dist/apis/device/calendar.ts +5 -0
- package/dist/apis/device/clipboard.ts +17 -9
- package/dist/apis/device/compass.ts +21 -0
- package/dist/apis/device/contact.ts +5 -0
- package/dist/apis/device/crypto.ts +4 -0
- package/dist/apis/device/gyroscope.ts +7 -0
- package/dist/apis/device/iBeacon.ts +10 -0
- package/dist/apis/device/index.ts +15 -0
- package/dist/apis/device/keyboard.ts +2 -1
- package/dist/apis/device/memory.ts +10 -3
- package/dist/apis/device/motion.ts +6 -0
- package/dist/apis/device/network.ts +26 -9
- package/dist/apis/device/nfc.ts +10 -0
- package/dist/apis/device/phone.ts +2 -1
- package/dist/apis/device/scan.ts +4 -0
- package/dist/apis/device/screen.ts +2 -1
- package/dist/apis/device/sms.ts +4 -0
- package/dist/apis/device/vibrate.ts +19 -11
- package/dist/apis/device/wifi.ts +15 -0
- package/dist/apis/ext/index.ts +5 -0
- package/dist/apis/files/index.ts +2 -1
- package/dist/apis/files/manager.ts +2 -1
- package/dist/apis/framework/index.ts +3 -8
- package/dist/apis/index.ts +27 -17
- package/dist/apis/location/index.ts +61 -68
- package/dist/apis/media/EditorContext.ts +32 -0
- package/dist/apis/media/audio/index.ts +18 -0
- package/dist/apis/media/background-audio/index.ts +16 -0
- package/dist/apis/media/camera.ts +16 -0
- package/dist/apis/media/common.ts +2 -1
- package/dist/apis/media/{image.ts → image/index.ts} +4 -3
- package/dist/apis/media/index.ts +10 -0
- package/dist/apis/media/live.ts +5 -0
- package/dist/apis/media/map.ts +4 -0
- package/dist/apis/media/media-recorder.ts +4 -0
- package/dist/apis/media/recorder.ts +6 -0
- package/dist/apis/media/video/VideoContext.ts +68 -0
- package/dist/apis/media/{video.ts → video/index.ts} +13 -2
- package/dist/apis/media/video-decoder.ts +4 -0
- package/dist/apis/media/video-processing.ts +4 -0
- package/dist/apis/media/voip.ts +19 -0
- package/dist/apis/network/index.ts +3 -0
- package/dist/apis/network/mdns.ts +13 -0
- package/dist/apis/network/request.ts +7 -6
- package/dist/apis/network/tcp.ts +4 -0
- package/dist/apis/network/udp.ts +4 -0
- package/dist/apis/network/webSocket.ts +2 -6
- package/dist/apis/open-api/account.ts +4 -0
- package/dist/apis/open-api/address.ts +4 -0
- package/dist/apis/open-api/authorize.ts +5 -0
- package/dist/apis/open-api/card.ts +5 -0
- package/dist/apis/open-api/channels-live.ts +11 -0
- package/dist/apis/open-api/customer-service.ts +4 -0
- package/dist/apis/open-api/device-voip.ts +5 -0
- package/dist/apis/open-api/facial.ts +7 -0
- package/dist/apis/open-api/favorites.ts +5 -0
- package/dist/apis/open-api/group.ts +4 -0
- package/dist/apis/open-api/index.ts +20 -6
- package/dist/apis/open-api/invoice.ts +5 -0
- package/dist/apis/open-api/license-plate.ts +4 -0
- package/dist/apis/open-api/login.ts +6 -0
- package/dist/apis/open-api/my-miniprogram.ts +4 -0
- package/dist/apis/open-api/privacy.ts +7 -0
- package/dist/apis/open-api/red-package.ts +4 -0
- package/dist/apis/open-api/settings.ts +5 -0
- package/dist/apis/open-api/soter.ts +6 -0
- package/dist/apis/open-api/subscribe-message.ts +6 -0
- package/dist/apis/open-api/{user-info/index.ts → user-info.ts} +1 -16
- package/dist/apis/open-api/werun.ts +5 -0
- package/dist/apis/payment/index.ts +6 -0
- package/dist/apis/route/index.ts +19 -28
- package/dist/apis/share/index.ts +33 -0
- package/dist/apis/storage/background-fetch.ts +7 -0
- package/dist/apis/storage/cache-manager.ts +4 -0
- package/dist/apis/storage/index.ts +158 -88
- package/dist/apis/ui/{animation.ts → animation/animation.ts} +73 -31
- package/dist/apis/ui/animation/index.ts +7 -0
- package/dist/apis/ui/background.ts +4 -19
- package/dist/apis/ui/custom-component.ts +8 -0
- package/dist/apis/ui/fonts.ts +4 -0
- package/dist/apis/ui/index.ts +8 -10
- package/dist/apis/ui/interaction/index.ts +45 -59
- package/dist/apis/ui/menu.ts +4 -0
- package/dist/apis/ui/navigation-bar/index.ts +60 -21
- package/dist/apis/ui/pull-down-refresh.ts +10 -4
- package/dist/apis/{page → ui/scroll}/index.ts +32 -27
- package/dist/apis/ui/sticky.ts +4 -0
- package/dist/apis/{tabbar/index.ts → ui/tab-bar.ts} +6 -8
- package/dist/apis/ui/window.ts +20 -0
- package/dist/apis/utils/handler.ts +4 -4
- package/dist/apis/utils/index.ts +1 -1
- package/dist/apis/worker/index.ts +4 -0
- package/dist/apis/wxml/IntersectionObserver.ts +24 -25
- package/dist/apis/wxml/index.ts +7 -2
- package/dist/apis/wxml/nodesRef.ts +2 -2
- package/dist/apis/wxml/selectorQuery.ts +29 -17
- package/dist/components-harmony-ets/button.ets +106 -80
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +82 -148
- package/dist/components-harmony-ets/form.ets +45 -132
- package/dist/components-harmony-ets/icon.ets +66 -69
- package/dist/components-harmony-ets/image.ets +26 -61
- package/dist/components-harmony-ets/index.ets +92 -0
- package/dist/components-harmony-ets/innerHtml.ets +7 -70
- package/dist/components-harmony-ets/input.ets +60 -146
- package/dist/components-harmony-ets/label.ets +86 -92
- package/dist/components-harmony-ets/listView.ets +26 -0
- package/dist/components-harmony-ets/movableArea.ets +124 -0
- package/dist/components-harmony-ets/movableView.ets +93 -0
- package/dist/components-harmony-ets/navigationBar.ets +65 -0
- package/dist/components-harmony-ets/pageMeta.ets +94 -0
- package/dist/components-harmony-ets/picker.ets +172 -198
- package/dist/components-harmony-ets/progress.ets +52 -0
- package/dist/components-harmony-ets/pseudo.ets +80 -0
- package/dist/components-harmony-ets/radio.ets +85 -155
- package/dist/components-harmony-ets/richText.ets +15 -87
- package/dist/components-harmony-ets/scrollList.ets +94 -0
- package/dist/components-harmony-ets/scrollView.ets +81 -149
- package/dist/components-harmony-ets/slider.ets +47 -94
- package/dist/components-harmony-ets/stickySection.ets +42 -0
- package/dist/components-harmony-ets/style.ets +396 -0
- package/dist/components-harmony-ets/swiper.ets +51 -151
- package/dist/components-harmony-ets/switch.ets +35 -76
- package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
- package/dist/components-harmony-ets/text.ets +131 -76
- package/dist/components-harmony-ets/textArea.ets +64 -140
- package/dist/components-harmony-ets/utils/AttributeManager.ets +1 -1
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +4 -13
- package/dist/components-harmony-ets/utils/constant/style.ets +9 -6
- package/dist/components-harmony-ets/utils/flexManager.ets +68 -85
- package/dist/components-harmony-ets/utils/helper.ets +18 -65
- package/dist/components-harmony-ets/utils/htmlParser/HarmonyHTMLParser.ts +1 -2
- package/dist/components-harmony-ets/utils/htmlParser/index.ts +1 -1
- package/dist/components-harmony-ets/utils/index.ts +55 -51
- package/dist/components-harmony-ets/utils/styles.ets +177 -65
- package/dist/components-harmony-ets/video.ets +70 -116
- package/dist/components-harmony-ets/view.ets +58 -64
- package/dist/components-harmony-ets/webView.ets +56 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.js +230 -60
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/document.ts +6 -4
- package/dist/runtime-ets/bom/getComputedStyle.ts +2 -2
- package/dist/runtime-ets/bom/window.ts +9 -2
- package/dist/runtime-ets/current.ts +3 -0
- package/dist/runtime-ets/dom/bind.ts +96 -0
- package/dist/runtime-ets/dom/class-list.ts +4 -6
- package/dist/runtime-ets/dom/comment.ts +1 -2
- package/dist/runtime-ets/dom/cssNesting.ts +409 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -20
- package/dist/runtime-ets/dom/dataSource.ts +64 -0
- package/dist/runtime-ets/dom/document.ts +36 -51
- package/dist/runtime-ets/dom/element/canvas.ts +136 -0
- package/dist/runtime-ets/dom/element/element.ts +439 -0
- package/dist/runtime-ets/dom/element/form.ts +403 -0
- package/dist/runtime-ets/dom/element/index.ts +120 -0
- package/dist/runtime-ets/dom/element/movableArea.ts +11 -0
- package/dist/runtime-ets/dom/element/movableView.ts +242 -0
- package/dist/runtime-ets/dom/element/normal.ts +103 -0
- package/dist/runtime-ets/dom/element/progress.ts +11 -0
- package/dist/runtime-ets/dom/element/scrollView.ts +15 -0
- package/dist/runtime-ets/dom/element/text.ts +10 -0
- package/dist/runtime-ets/dom/element/video.ts +50 -0
- package/dist/runtime-ets/dom/element/webView.ts +68 -0
- package/dist/runtime-ets/dom/event.ts +26 -5
- package/dist/runtime-ets/dom/eventTarget.ts +3 -3
- package/dist/runtime-ets/dom/node.ts +114 -49
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +805 -0
- package/dist/runtime-ets/dom/stylesheet/index.ts +122 -429
- package/dist/runtime-ets/dom/stylesheet/type.ts +93 -17
- package/dist/runtime-ets/dom/stylesheet/util.ts +145 -17
- package/dist/runtime-ets/index.ts +2 -3
- package/dist/runtime-ets/interface/event.ts +3 -2
- package/dist/runtime-ets/utils/index.ts +87 -17
- package/dist/runtime-ets/utils/info.ts +21 -47
- package/dist/runtime-framework/react/app.ts +20 -28
- package/dist/runtime-framework/react/hooks.ts +3 -4
- package/dist/runtime-framework/react/index.ts +1 -2
- package/dist/runtime-framework/react/native-page.ts +421 -0
- package/dist/runtime-framework/react/page.ts +5 -17
- package/dist/runtime-framework/solid/app.ts +25 -45
- package/dist/runtime-framework/solid/connect.ts +21 -3
- package/dist/runtime-framework/solid/hooks.ts +17 -12
- package/dist/runtime-framework/solid/index.ts +6 -2
- package/dist/runtime-framework/solid/page.ts +84 -36
- package/dist/runtime-framework/solid/reconciler/props.ts +70 -25
- package/dist/runtime-framework/solid/reconciler/render.ts +16 -6
- package/dist/runtime-framework/solid/reconciler/use.ts +0 -1
- package/dist/runtime-framework/solid/utils/index.ts +0 -2
- package/dist/runtime-utils.d.ts +827 -0
- package/dist/runtime-utils.js +1633 -549
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +1633 -549
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +14 -15
- package/static/media/cancel.svg +1 -0
- package/static/media/circle.svg +1 -0
- package/static/media/clear.svg +1 -0
- package/static/media/download.svg +1 -0
- package/static/media/info.svg +1 -0
- package/static/media/info_circle.svg +1 -0
- package/static/media/search.svg +1 -0
- package/static/media/success.svg +1 -0
- package/static/media/success_no_circle.svg +1 -0
- package/static/media/taro_arrow_left.svg +1 -0
- package/static/media/taro_home.svg +1 -0
- package/static/media/waiting.svg +1 -0
- package/static/media/warn.svg +1 -0
- package/types/harmony.d.ts +4 -0
- package/types/index.d.ts +4 -0
- package/types/runtime.d.ts +7 -1
- package/LICENSE +0 -160
- package/dist/components-harmony-ets/base.ets +0 -63
- package/dist/components-harmony-ets/element.ets +0 -223
- package/dist/components-harmony-ets/utils/constant/icon.ts +0 -19
- package/dist/runtime-ets/dom/element.ts +0 -457
- package/dist/runtime-ets/dom/text.ts +0 -19
- package/dist/runtime-ets/utils/bind.ts +0 -35
- package/types/api.d.ts +0 -4
- /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
|
@@ -3,131 +3,201 @@
|
|
|
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
|
|
7
|
-
import hilog from '@ohos.hilog'
|
|
6
|
+
import distributedKVStore from '@ohos.data.distributedKVStore'
|
|
8
7
|
import { Current } from '@tarojs/runtime'
|
|
9
8
|
|
|
10
|
-
import {
|
|
9
|
+
import { temporarilyNotSupport, validateParams } from '../utils'
|
|
10
|
+
import { MethodHandler } from '../utils/handler'
|
|
11
11
|
|
|
12
|
-
import type
|
|
12
|
+
import type Taro from '@tarojs/taro/types'
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
key: string
|
|
19
|
-
data: number | string | boolean
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface IRemoveStorageParams extends IAsyncParams {
|
|
23
|
-
key: string
|
|
24
|
-
}
|
|
14
|
+
let context
|
|
15
|
+
let kvManager: distributedKVStore.KVManager
|
|
16
|
+
let kvStore: distributedKVStore.SingleKVStore
|
|
17
|
+
let kvStorePromise: Promise<void>
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.getPreferences(context, `${data.appInfo.uid}Store`)
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
.catch((error) => {
|
|
36
|
-
hilog.error(0x0000, 'TaroFailedTag', 'Failed to load the storage. Cause: %{public}s', error.code ? JSON.stringify(error) : error.message || error)
|
|
37
|
-
})
|
|
19
|
+
(Current as any).contextPromise.then((ctx) => {
|
|
20
|
+
context = ctx
|
|
21
|
+
const kvManagerConfig: distributedKVStore.KVManagerConfig = {
|
|
22
|
+
context: context,
|
|
23
|
+
bundleName: 'com.example.taro'
|
|
24
|
+
}
|
|
38
25
|
|
|
39
|
-
async function getItem (key: string): Promise<{ result: boolean, data?: number | string | boolean }> {
|
|
40
26
|
try {
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
39
|
+
}
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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}`)
|
|
47
55
|
}
|
|
48
|
-
|
|
56
|
+
|
|
57
|
+
return context
|
|
58
|
+
})
|
|
49
59
|
|
|
50
60
|
const storageSchema = {
|
|
51
61
|
key: 'String'
|
|
52
62
|
}
|
|
53
63
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
getItem(options.key).then(({ result, data }) => {
|
|
63
|
-
const res: Record<string, any> = { errMsg: 'getStorage:ok' }
|
|
64
|
-
|
|
65
|
-
if (result) {
|
|
66
|
-
res.data = data
|
|
67
|
-
callAsyncSuccess(resolve, res, options)
|
|
68
|
-
} else {
|
|
69
|
-
res.errMsg = 'getStorage:fail data not found'
|
|
70
|
-
callAsyncFail(reject, res, options)
|
|
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
71
|
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
}
|
|
72
|
+
} else {
|
|
73
|
+
console.warn(message)
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
validateParams('setStorage', options, storageSchema)
|
|
80
|
-
} catch (error) {
|
|
81
|
-
const res = { errMsg: error.message }
|
|
82
|
-
return callAsyncFail(reject, res, options)
|
|
75
|
+
return {
|
|
76
|
+
isExist: false,
|
|
77
|
+
}
|
|
83
78
|
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
isExist: true,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function getStorage<T = any> (options: Taro.getStorage.Option<T>) {
|
|
87
|
+
const name = 'getStorage'
|
|
88
|
+
const { isExist, error } = checkContextExist(name, true)
|
|
84
89
|
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
if (!isExist) {
|
|
91
|
+
return error
|
|
92
|
+
}
|
|
87
93
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
await preferences.flush()
|
|
94
|
+
const { key, success, fail, complete } = options || {}
|
|
95
|
+
const handle = new MethodHandler<{data: any}>({ name, success, fail, complete })
|
|
91
96
|
|
|
92
|
-
|
|
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
|
+
})
|
|
93
115
|
})
|
|
94
116
|
})
|
|
95
117
|
}
|
|
96
118
|
|
|
97
|
-
export function
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
validateParams('removeStorage', options, storageSchema)
|
|
101
|
-
} catch (error) {
|
|
102
|
-
const res = { errMsg: error.message }
|
|
103
|
-
return callAsyncFail(reject, res, options)
|
|
104
|
-
}
|
|
119
|
+
export function setStorage (options: Taro.setStorage.Option) {
|
|
120
|
+
const name = 'setStorage'
|
|
121
|
+
const { isExist, error } = checkContextExist(name, true)
|
|
105
122
|
|
|
106
|
-
|
|
123
|
+
if (!isExist) {
|
|
124
|
+
return error
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const { key, data, success, fail, complete } = options || {}
|
|
128
|
+
const handle = new MethodHandler({ name, success, fail, complete })
|
|
129
|
+
|
|
130
|
+
return new Promise((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
|
+
}
|
|
107
138
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
+
}
|
|
111
145
|
|
|
112
|
-
|
|
113
|
-
|
|
146
|
+
handle.success({}, { resolve, reject })
|
|
147
|
+
})
|
|
114
148
|
})
|
|
115
149
|
})
|
|
116
150
|
}
|
|
117
151
|
|
|
118
|
-
export function
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
await preferences.clear()
|
|
122
|
-
await preferences.flush()
|
|
152
|
+
export function removeStorage (options: Taro.removeStorage.Option) {
|
|
153
|
+
const name = 'removeStorage'
|
|
154
|
+
const { isExist, error } = checkContextExist(name, true)
|
|
123
155
|
|
|
124
|
-
|
|
125
|
-
|
|
156
|
+
if (!isExist) {
|
|
157
|
+
return error
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const { key, success, fail, complete } = options || {}
|
|
161
|
+
const handle = new MethodHandler({ name, success, fail, complete })
|
|
162
|
+
|
|
163
|
+
return new Promise((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
|
+
})
|
|
126
181
|
})
|
|
127
182
|
})
|
|
128
183
|
}
|
|
129
184
|
|
|
185
|
+
export const getStorageInfoSync = temporarilyNotSupport('getStorageInfoSync')
|
|
186
|
+
export const getStorageInfo = temporarilyNotSupport('getStorageInfo')
|
|
187
|
+
|
|
188
|
+
export const createBufferURL = /* @__PURE__ */ temporarilyNotSupport('createBufferURL')
|
|
189
|
+
export const revokeBufferURL = /* @__PURE__ */ temporarilyNotSupport('revokeBufferURL')
|
|
190
|
+
|
|
191
|
+
export const batchSetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchSetStorageSync')
|
|
192
|
+
export const batchSetStorage = /* @__PURE__ */ temporarilyNotSupport('batchSetStorage')
|
|
193
|
+
export const batchGetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchGetStorageSync')
|
|
194
|
+
export const batchGetStorage = /* @__PURE__ */ temporarilyNotSupport('batchGetStorage')
|
|
195
|
+
|
|
196
|
+
export const clearStorage = temporarilyNotSupport('clearStorage')
|
|
130
197
|
export const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage')
|
|
131
198
|
export const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage')
|
|
132
199
|
export const clearStorageSync = temporarilyNotSupport('clearStorageSync', 'clearStorage')
|
|
133
200
|
export const removeStorageSync = temporarilyNotSupport('removeStorageSync', 'removeStorage')
|
|
201
|
+
|
|
202
|
+
export * from './background-fetch'
|
|
203
|
+
export * from './cache-manager'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import matrix4 from '@ohos.matrix4'
|
|
2
|
+
import { isUndefined } from '@tarojs/shared'
|
|
2
3
|
|
|
3
|
-
import { temporarilyNotSupport } from '
|
|
4
|
+
import { temporarilyNotSupport } from '../../utils'
|
|
4
5
|
|
|
5
|
-
import type Taro from '@tarojs/
|
|
6
|
+
import type Taro from '@tarojs/taro/types'
|
|
6
7
|
|
|
7
8
|
interface IAnimationAttr {
|
|
8
9
|
duration: number
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
171
|
+
temporarilyNotSupport('animation.skew:' + `${ax}, ${ay}`)(ax, ay)
|
|
139
172
|
return this
|
|
140
173
|
}
|
|
141
174
|
|
|
142
175
|
skewX (angle: number): Taro.Animation {
|
|
143
|
-
|
|
176
|
+
temporarilyNotSupport('animation.skewX:' + angle)(angle)
|
|
144
177
|
return this
|
|
145
178
|
}
|
|
146
179
|
|
|
147
180
|
skewY (angle: number): Taro.Animation {
|
|
148
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
256
|
+
this.rule.top = value
|
|
215
257
|
return this
|
|
216
258
|
}
|
|
217
259
|
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
// import window from '@ohos.window'
|
|
2
|
-
// import { Current } from '@tarojs/runtime'
|
|
3
1
|
import { eventCenter } from '@tarojs/runtime/dist/runtime.esm'
|
|
4
2
|
|
|
3
|
+
import { temporarilyNotSupport } from '../utils'
|
|
5
4
|
import { MethodHandler } from '../utils/handler'
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// const windowClassPromise = (Current as any).contextPromise
|
|
11
|
-
// .then(context => {
|
|
12
|
-
// return window.getTopWindow(context)
|
|
13
|
-
// })
|
|
6
|
+
export const setBackgroundTextStyle = /* @__PURE__ */ temporarilyNotSupport('setBackgroundTextStyle')
|
|
14
7
|
|
|
15
8
|
export function setBackgroundColor(options: Taro.setBackgroundColor.Option) {
|
|
16
9
|
const { success, fail, complete } = options || {}
|
|
@@ -18,18 +11,10 @@ export function setBackgroundColor(options: Taro.setBackgroundColor.Option) {
|
|
|
18
11
|
|
|
19
12
|
return new Promise((resolve, reject) => {
|
|
20
13
|
eventCenter.trigger('__taroPageStyle', {
|
|
21
|
-
backgroundColor: options.
|
|
14
|
+
backgroundColor: options.backgroundColorBottom || options.backgroundColor,
|
|
15
|
+
backgroundColorContext: options.backgroundColorTop || options.backgroundColor
|
|
22
16
|
})
|
|
23
17
|
|
|
24
18
|
return handle.success({}, { resolve, reject })
|
|
25
|
-
// windowClassPromise.then(windowClass => {
|
|
26
|
-
// windowClass.setBackgroundColor(color).then(() => {
|
|
27
|
-
// const res = { errMsg: 'setBackgroundColor:ok' }
|
|
28
|
-
// callAsyncSuccess(resolve, res, options)
|
|
29
|
-
// }, (error) => {
|
|
30
|
-
// const res = { errMsg: 'setBackgroundColor:fail' + error }
|
|
31
|
-
// callAsyncFail(reject, res, options)
|
|
32
|
-
// })
|
|
33
|
-
// })
|
|
34
19
|
})
|
|
35
20
|
}
|
package/dist/apis/ui/index.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import { Animation } from './animation'
|
|
3
|
-
|
|
4
|
-
import type Taro from '@tarojs/api'
|
|
5
|
-
|
|
6
|
-
export const createAnimation = (option: Taro.createAnimation.Option) => {
|
|
7
|
-
return new Animation(option)
|
|
8
|
-
}
|
|
9
|
-
export const getMenuButtonBoundingClientRect = temporarilyNotSupport('getMenuButtonBoundingClientRect')
|
|
10
|
-
|
|
1
|
+
export * from './animation'
|
|
11
2
|
export * from './background'
|
|
3
|
+
export * from './custom-component'
|
|
4
|
+
export * from './fonts'
|
|
12
5
|
export * from './interaction'
|
|
6
|
+
export * from './menu'
|
|
13
7
|
export * from './navigation-bar'
|
|
14
8
|
export * from './pull-down-refresh'
|
|
9
|
+
export * from './scroll'
|
|
10
|
+
export * from './sticky'
|
|
11
|
+
export * from './tab-bar'
|
|
12
|
+
export * from './window'
|