@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.
- package/dist/apis/base/system.ts +60 -25
- package/dist/apis/base/weapp/life-cycle.ts +1 -1
- package/dist/apis/canvas/index.ts +10 -1
- package/dist/apis/device/clipboard.ts +23 -8
- package/dist/apis/framework/index.ts +2 -6
- package/dist/apis/index.ts +25 -17
- package/dist/apis/media/image/index.ts +169 -17
- package/dist/apis/route/index.ts +1 -2
- package/dist/apis/storage/index.ts +135 -131
- package/dist/apis/ui/animation/animation.ts +71 -29
- package/dist/apis/ui/background.ts +3 -2
- package/dist/apis/ui/interaction/index.ts +58 -59
- package/dist/apis/ui/navigation-bar/index.ts +2 -2
- package/dist/apis/ui/pull-down-refresh.ts +9 -3
- package/dist/apis/ui/scroll/index.ts +6 -6
- package/dist/apis/ui/tab-bar.ts +4 -5
- package/dist/apis/utils/index.ts +20 -2
- package/dist/apis/utils/permissions.ts +6 -0
- package/dist/apis/wxml/IntersectionObserver.ts +18 -10
- package/dist/apis/wxml/selectorQuery.ts +26 -13
- package/dist/components-harmony-ets/button.ets +36 -9
- package/dist/components-harmony-ets/canvas.ets +51 -0
- package/dist/components-harmony-ets/checkbox.ets +69 -60
- package/dist/components-harmony-ets/form.ets +33 -15
- package/dist/components-harmony-ets/icon.ets +16 -8
- package/dist/components-harmony-ets/image.ets +22 -6
- package/dist/components-harmony-ets/index.ets +39 -0
- package/dist/components-harmony-ets/innerHtml.ets +6 -5
- package/dist/components-harmony-ets/input.ets +63 -37
- package/dist/components-harmony-ets/label.ets +43 -21
- package/dist/components-harmony-ets/listView.ets +32 -0
- package/dist/components-harmony-ets/movableArea.ets +110 -51
- package/dist/components-harmony-ets/movableView.ets +74 -47
- 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 +36 -33
- package/dist/components-harmony-ets/progress.ets +31 -24
- package/dist/components-harmony-ets/pseudo.ets +80 -0
- package/dist/components-harmony-ets/radio.ets +75 -66
- package/dist/components-harmony-ets/richText.ets +4 -25
- package/dist/components-harmony-ets/scrollList.ets +108 -0
- package/dist/components-harmony-ets/scrollView.ets +46 -42
- package/dist/components-harmony-ets/slider.ets +19 -15
- package/dist/components-harmony-ets/stickySection.ets +42 -0
- package/dist/components-harmony-ets/style.ets +386 -129
- package/dist/components-harmony-ets/swiper.ets +42 -5
- package/dist/components-harmony-ets/switch.ets +36 -32
- package/dist/components-harmony-ets/{index.ts → tag.ts} +6 -0
- package/dist/components-harmony-ets/text.ets +102 -46
- package/dist/components-harmony-ets/textArea.ets +49 -34
- package/dist/components-harmony-ets/utils/AttributeManager.ets +2 -2
- package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -2
- package/dist/components-harmony-ets/utils/flexManager.ets +49 -19
- package/dist/components-harmony-ets/utils/helper.ets +20 -8
- 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 +54 -50
- package/dist/components-harmony-ets/utils/styles.ets +169 -91
- package/dist/components-harmony-ets/video.ets +28 -20
- package/dist/components-harmony-ets/view.ets +45 -39
- package/dist/components-harmony-ets/webView.ets +6 -5
- package/dist/index.d.ts +152 -0
- package/dist/index.js +73 -44
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/URL.ts +2 -0
- package/dist/runtime-ets/bom/document.ts +5 -4
- package/dist/runtime-ets/bom/getComputedStyle.ts +2 -3
- package/dist/runtime-ets/bom/history.ts +1 -0
- package/dist/runtime-ets/bom/location.ts +1 -0
- package/dist/runtime-ets/bom/navigator.ts +1 -21
- package/dist/runtime-ets/bom/raf.ts +1 -37
- package/dist/runtime-ets/bom/window.ts +10 -4
- package/dist/runtime-ets/constant.ts +17 -10
- package/dist/runtime-ets/current.ts +5 -2
- package/dist/runtime-ets/dom/bind.ts +28 -12
- package/dist/runtime-ets/dom/class-list.ts +2 -2
- package/dist/runtime-ets/dom/cssNesting.ts +419 -0
- package/dist/runtime-ets/dom/cssStyleDeclaration.ts +28 -42
- package/dist/runtime-ets/dom/document.ts +9 -12
- package/dist/runtime-ets/dom/element/canvas.ts +137 -0
- package/dist/runtime-ets/dom/element/element.ts +379 -55
- package/dist/runtime-ets/dom/element/form.ts +26 -22
- package/dist/runtime-ets/dom/element/index.ts +22 -2
- package/dist/runtime-ets/dom/element/movableArea.ts +0 -1
- package/dist/runtime-ets/dom/element/movableView.ts +238 -2
- package/dist/runtime-ets/dom/element/normal.ts +27 -6
- package/dist/runtime-ets/dom/element/progress.ts +0 -2
- package/dist/runtime-ets/dom/element/text.ts +0 -8
- package/dist/runtime-ets/dom/element/video.ts +4 -4
- package/dist/runtime-ets/dom/element/webView.ts +4 -5
- package/dist/runtime-ets/dom/event-source.ts +1 -0
- package/dist/runtime-ets/dom/event.ts +3 -5
- package/dist/runtime-ets/dom/eventTarget.ts +3 -4
- package/dist/runtime-ets/dom/node.ts +53 -22
- package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +418 -237
- package/dist/runtime-ets/dom/stylesheet/index.ts +29 -311
- package/dist/runtime-ets/dom/stylesheet/type.ts +53 -11
- package/dist/runtime-ets/dom/stylesheet/util.ts +33 -27
- package/dist/runtime-ets/emitter/emitter.ts +1 -0
- package/dist/runtime-ets/env.ts +1 -0
- package/dist/runtime-ets/index.ts +23 -7
- package/dist/runtime-ets/interface/event.ts +1 -1
- package/dist/runtime-ets/interface/index.ts +6 -0
- package/dist/runtime-ets/utils/index.ts +78 -19
- package/dist/runtime-ets/utils/info.ts +2 -2
- package/dist/runtime-ets/utils/router.ts +9 -0
- package/dist/runtime-framework/react/app.ts +15 -11
- package/dist/runtime-framework/react/hooks.ts +1 -2
- package/dist/runtime-framework/react/index.ts +0 -2
- package/dist/runtime-framework/react/native-page.ts +217 -81
- package/dist/runtime-framework/react/page.ts +4 -10
- package/dist/runtime-framework/react/utils/index.ts +3 -3
- package/dist/runtime-framework/solid/app.ts +29 -46
- package/dist/runtime-framework/solid/connect.ts +21 -3
- package/dist/runtime-framework/solid/hooks.ts +16 -11
- package/dist/runtime-framework/solid/index.ts +6 -2
- package/dist/runtime-framework/solid/page.ts +84 -31
- package/dist/runtime-framework/solid/reconciler/props.ts +73 -29
- 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 +3 -5
- package/dist/runtime-utils.d.ts +827 -0
- package/dist/runtime-utils.js +574 -285
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +574 -285
- package/dist/runtime.js.map +1 -1
- package/index.js +3 -1
- package/package.json +14 -15
- package/static/media/cancel.svg +1 -1
- package/static/media/circle.svg +1 -1
- package/static/media/clear.svg +1 -1
- package/static/media/download.svg +1 -1
- package/static/media/info.svg +1 -1
- package/static/media/info_circle.svg +1 -1
- package/static/media/search.svg +1 -1
- package/static/media/success.svg +1 -1
- package/static/media/success_no_circle.svg +1 -1
- package/static/media/warn.svg +1 -1
- package/types/harmony.d.ts +5 -0
- package/types/index.d.ts +4 -0
- package/types/runtime.d.ts +1 -1
- /package/dist/runtime-framework/solid/{contant.ts → constant.ts} +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
2
1
|
import { isUndefined } from '@tarojs/shared'
|
|
3
2
|
|
|
4
3
|
import { Current } from '../current'
|
|
5
4
|
import { findChildNodeWithDFS, getPageScrollerOrNode } from '../utils'
|
|
6
5
|
import { TaroComment } from './comment'
|
|
7
|
-
import { createCSSStyleDeclaration } from './cssStyleDeclaration'
|
|
8
6
|
import { TaroElement } from './element/element'
|
|
7
|
+
import { eventSource } from './event-source'
|
|
9
8
|
import { NodeType, TaroNode, TaroTextNode } from './node'
|
|
10
9
|
|
|
11
10
|
import type { Window } from '../bom/window'
|
|
@@ -36,6 +35,7 @@ class TaroDocument extends TaroNode {
|
|
|
36
35
|
case 'div': tagName = 'view'; break
|
|
37
36
|
case 'p': tagName = 'text'; break
|
|
38
37
|
case 'span': tagName = 'text'; break
|
|
38
|
+
case 'a': tagName = 'text'; break
|
|
39
39
|
}
|
|
40
40
|
// @ts-ignore
|
|
41
41
|
if (Current?.createHarmonyElement) {
|
|
@@ -45,8 +45,6 @@ class TaroDocument extends TaroNode {
|
|
|
45
45
|
node = new TaroElement(tagName)
|
|
46
46
|
}
|
|
47
47
|
node._doc = this
|
|
48
|
-
// Hack: 此 Proxy 不能放在 Element 类内定义,否则响应式更新会失效
|
|
49
|
-
node._style = createCSSStyleDeclaration(node)
|
|
50
48
|
return node
|
|
51
49
|
}
|
|
52
50
|
|
|
@@ -63,7 +61,6 @@ class TaroDocument extends TaroNode {
|
|
|
63
61
|
return new TaroComment(data)
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
|
|
67
64
|
public getElementById<T extends TaroElement> (id: string | undefined | null): T | null {
|
|
68
65
|
const el = eventSource.get(id)
|
|
69
66
|
return isUndefined(el) ? null : el as unknown as T
|
|
@@ -72,20 +69,20 @@ class TaroDocument extends TaroNode {
|
|
|
72
69
|
public querySelector (selectors: string): TaroElement | null {
|
|
73
70
|
const taro = (Current as any).taro
|
|
74
71
|
const page = taro.getCurrentInstance().page
|
|
75
|
-
const element = getPageScrollerOrNode(page
|
|
76
|
-
|
|
77
|
-
if (element
|
|
78
|
-
|
|
72
|
+
const element = getPageScrollerOrNode(page?.node, page)
|
|
73
|
+
|
|
74
|
+
if (!element) return null
|
|
75
|
+
|
|
79
76
|
return findChildNodeWithDFS(element, selectors)
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
public querySelectorAll (selectors: string): TaroElement[] {
|
|
83
80
|
const taro = (Current as any).taro
|
|
84
81
|
const page = taro.getCurrentInstance().page
|
|
85
|
-
const element = getPageScrollerOrNode(page
|
|
86
|
-
|
|
82
|
+
const element = getPageScrollerOrNode(page?.node, page)
|
|
83
|
+
|
|
87
84
|
if (element == null) return []
|
|
88
|
-
|
|
85
|
+
|
|
89
86
|
return findChildNodeWithDFS(element, selectors, true) || []
|
|
90
87
|
}
|
|
91
88
|
// @Todo
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { eventSource } from '../event-source'
|
|
2
|
+
import { TaroNode } from '../node'
|
|
3
|
+
import { TaroElement } from './element'
|
|
4
|
+
|
|
5
|
+
import type { CanvasProps, CanvasTouchEvent } from '@tarojs/components/types'
|
|
6
|
+
import type { TaroAny } from '../../interface'
|
|
7
|
+
|
|
8
|
+
export class CanvasRenderingContext2DWXAdapter extends CanvasRenderingContext2D {
|
|
9
|
+
// constructor(settings?: RenderingContextSetting) {
|
|
10
|
+
// super(settings)
|
|
11
|
+
// }
|
|
12
|
+
|
|
13
|
+
createCircularGradient() {
|
|
14
|
+
// Not supported now
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
draw(cb?: (...args: any[]) => any) {
|
|
18
|
+
typeof cb === 'function' && cb()
|
|
19
|
+
// Not supported now
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
setFillStyle(fillStyle: typeof this.fillStyle) {
|
|
23
|
+
this.fillStyle = fillStyle
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
setFontSize(fontSize: number) {
|
|
27
|
+
const font = this.font.split(' ')
|
|
28
|
+
font[2] = `${fontSize}`
|
|
29
|
+
this.font = font.join(' ')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
setGlobalAlpha(globalAlpha: typeof this.globalAlpha) {
|
|
33
|
+
this.globalAlpha = globalAlpha
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
setLineCap(lineCap: typeof this.lineCap) {
|
|
37
|
+
this.lineCap = lineCap
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
setLineJoin(lineJoin: typeof this.lineJoin) {
|
|
41
|
+
this.lineJoin = lineJoin
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
setLineWidth(lineWidth: typeof this.lineWidth) {
|
|
45
|
+
this.lineWidth = lineWidth
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
setMiterLimit(miterLimit: typeof this.miterLimit) {
|
|
49
|
+
this.miterLimit = miterLimit
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
setShadow(offsetX: number, offsetY: number, blur: number, color: string) {
|
|
53
|
+
this.shadowOffsetX = offsetX
|
|
54
|
+
this.shadowOffsetY = offsetY
|
|
55
|
+
this.shadowBlur = blur
|
|
56
|
+
this.shadowColor = color
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
setStrokeStyle(strokeStyle: typeof this.strokeStyle) {
|
|
60
|
+
this.strokeStyle = strokeStyle
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
setTextAlign(textAlign: typeof this.textAlign) {
|
|
64
|
+
this.textAlign = textAlign
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
setTextBaseline(textBaseline: typeof this.textBaseline) {
|
|
68
|
+
this.textBaseline = textBaseline
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function getContextKey(obj) {
|
|
72
|
+
let currentObj = obj
|
|
73
|
+
let res = []
|
|
74
|
+
while (currentObj) {
|
|
75
|
+
if (currentObj instanceof CanvasRenderingContext2D) {
|
|
76
|
+
res = [...res, ...Object.getOwnPropertyNames(currentObj)]
|
|
77
|
+
}
|
|
78
|
+
currentObj = Object.getPrototypeOf(currentObj)
|
|
79
|
+
}
|
|
80
|
+
return res
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@Observed
|
|
84
|
+
export class TaroCanvasElement extends TaroElement<CanvasProps, CanvasTouchEvent> {
|
|
85
|
+
_drawList: {
|
|
86
|
+
key: string
|
|
87
|
+
value: TaroAny
|
|
88
|
+
}[] = []
|
|
89
|
+
|
|
90
|
+
settings: RenderingContextSettings
|
|
91
|
+
_context: CanvasRenderingContext2D
|
|
92
|
+
_contextProxy: CanvasRenderingContext2D
|
|
93
|
+
|
|
94
|
+
constructor() {
|
|
95
|
+
super('Canvas')
|
|
96
|
+
this.settings = new RenderingContextSettings(true)
|
|
97
|
+
const context = new CanvasRenderingContext2DWXAdapter(this.settings) as CanvasRenderingContext2D
|
|
98
|
+
this._context = context
|
|
99
|
+
|
|
100
|
+
const proxyObj = getContextKey(context).reduce((obj, key) => {
|
|
101
|
+
if (typeof context[key] === 'function') {
|
|
102
|
+
obj[key] = new Proxy(context[key], {
|
|
103
|
+
apply: (target, thisArg, argumentsList) => {
|
|
104
|
+
this._drawList.push({
|
|
105
|
+
key,
|
|
106
|
+
value: argumentsList,
|
|
107
|
+
})
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
} else {
|
|
111
|
+
obj[key] = context[key]
|
|
112
|
+
}
|
|
113
|
+
return obj
|
|
114
|
+
}, {})
|
|
115
|
+
|
|
116
|
+
this._contextProxy = new Proxy(proxyObj, {
|
|
117
|
+
set: (_, property, value) => {
|
|
118
|
+
this._drawList.push({
|
|
119
|
+
key: property,
|
|
120
|
+
value,
|
|
121
|
+
})
|
|
122
|
+
return true
|
|
123
|
+
},
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get context() {
|
|
128
|
+
return this._contextProxy
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
public setAttribute(name: string, value: TaroAny): void {
|
|
132
|
+
if (name === 'canvasId') {
|
|
133
|
+
eventSource.set(`canvasId-${value}`, this as TaroNode)
|
|
134
|
+
}
|
|
135
|
+
super.setAttribute(name, value)
|
|
136
|
+
}
|
|
137
|
+
}
|