@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.43 → 4.0.0-alpha.45
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/weapp/life-cycle.ts +1 -1
- package/dist/apis/device/clipboard.ts +9 -2
- package/dist/apis/framework/index.ts +1 -1
- package/dist/apis/media/image/index.ts +124 -135
- package/dist/apis/route/index.ts +1 -2
- package/dist/apis/ui/background.ts +1 -1
- package/dist/apis/ui/interaction/index.ts +20 -4
- package/dist/apis/ui/navigation-bar/index.ts +1 -1
- package/dist/apis/ui/scroll/index.ts +1 -1
- package/dist/apis/ui/tab-bar.ts +1 -2
- package/dist/components-harmony-ets/button.ets +1 -1
- package/dist/components-harmony-ets/checkbox.ets +1 -2
- package/dist/components-harmony-ets/form.ets +0 -1
- package/dist/components-harmony-ets/index.ets +37 -90
- package/dist/components-harmony-ets/input.ets +11 -7
- package/dist/components-harmony-ets/label.ets +1 -2
- package/dist/components-harmony-ets/listView.ets +3 -2
- package/dist/components-harmony-ets/movableArea.ets +3 -3
- package/dist/components-harmony-ets/navigationBar.ets +1 -1
- package/dist/components-harmony-ets/pageMeta.ets +1 -1
- package/dist/components-harmony-ets/pseudo.ets +1 -1
- package/dist/components-harmony-ets/radio.ets +2 -3
- package/dist/components-harmony-ets/scrollList.ets +7 -2
- package/dist/components-harmony-ets/scrollView.ets +6 -1
- package/dist/components-harmony-ets/slider.ets +1 -1
- package/dist/components-harmony-ets/stickySection.ets +2 -2
- package/dist/components-harmony-ets/style.ets +7 -6
- package/dist/components-harmony-ets/swiper.ets +1 -1
- package/dist/components-harmony-ets/switch.ets +1 -1
- package/dist/components-harmony-ets/text.ets +2 -2
- package/dist/components-harmony-ets/utils/helper.ets +2 -2
- package/dist/components-harmony-ets/utils/styles.ets +5 -6
- package/dist/components-harmony-ets/video.ets +1 -1
- package/dist/components-harmony-ets/view.ets +1 -2
- package/dist/components-harmony-ets/webView.ets +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/URL.ts +2 -0
- package/dist/runtime-ets/bom/document.ts +1 -2
- package/dist/runtime-ets/bom/getComputedStyle.ts +1 -2
- 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 +4 -5
- package/dist/runtime-ets/constant.ts +17 -10
- package/dist/runtime-ets/current.ts +0 -1
- package/dist/runtime-ets/dom/document.ts +1 -1
- package/dist/runtime-ets/dom/element/canvas.ts +3 -2
- package/dist/runtime-ets/dom/element/element.ts +6 -5
- package/dist/runtime-ets/dom/element/form.ts +6 -0
- package/dist/runtime-ets/dom/element/movableView.ts +12 -8
- package/dist/runtime-ets/dom/event-source.ts +1 -0
- package/dist/runtime-ets/dom/eventTarget.ts +1 -1
- package/dist/runtime-ets/dom/node.ts +3 -4
- package/dist/runtime-ets/emitter/emitter.ts +1 -0
- package/dist/runtime-ets/env.ts +1 -0
- package/dist/runtime-ets/index.ts +22 -7
- package/dist/runtime-ets/interface/index.ts +6 -0
- package/dist/runtime-ets/utils/index.ts +4 -6
- package/dist/runtime-ets/utils/router.ts +9 -0
- package/dist/runtime-framework/react/app.ts +1 -2
- package/dist/runtime-framework/react/hooks.ts +1 -1
- package/dist/runtime-framework/react/native-page.ts +44 -15
- package/dist/runtime-framework/react/page.ts +1 -2
- package/dist/runtime-framework/solid/app.ts +1 -2
- package/dist/runtime-framework/solid/hooks.ts +1 -1
- package/dist/runtime-framework/solid/page.ts +1 -2
- package/dist/runtime-framework/solid/reconciler/props.ts +9 -10
- package/dist/runtime-utils.js +160 -173
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +160 -173
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
|
@@ -1,10 +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
6
|
import { TaroElement } from './element/element'
|
|
7
|
+
import { eventSource } from './event-source'
|
|
8
8
|
import { NodeType, TaroNode, TaroTextNode } from './node'
|
|
9
9
|
|
|
10
10
|
import type { Window } from '../bom/window'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { eventSource
|
|
2
|
-
|
|
1
|
+
import { eventSource } from '../event-source'
|
|
2
|
+
import { TaroNode } from '../node'
|
|
3
3
|
import { TaroElement } from './element'
|
|
4
4
|
|
|
5
5
|
import type { CanvasProps, CanvasTouchEvent } from '@tarojs/components/types'
|
|
6
|
+
import type { TaroAny } from '../../interface'
|
|
6
7
|
|
|
7
8
|
export class CanvasRenderingContext2DWXAdapter extends CanvasRenderingContext2D {
|
|
8
9
|
// constructor(settings?: RenderingContextSetting) {
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
2
|
import { getPageById } from '@tarojs/plugin-framework-react/dist/runtime'
|
|
3
|
-
import { eventCenter, eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
4
3
|
import { EMPTY_OBJ, toCamelCase } from '@tarojs/shared'
|
|
5
4
|
|
|
6
5
|
import { ATTRIBUTES_CALLBACK_TRIGGER_MAP, ID } from '../../constant'
|
|
7
6
|
import { Current } from '../../current'
|
|
7
|
+
import { eventCenter } from '../../emitter/emitter'
|
|
8
8
|
import { findChildNodeWithDFS } from '../../utils'
|
|
9
9
|
import { initComponentNodeInfo, triggerAttributesCallback } from '../../utils/info'
|
|
10
10
|
import { bindAnimation } from '../bind'
|
|
11
11
|
import { ClassList } from '../class-list'
|
|
12
|
-
import {
|
|
12
|
+
import { createCSSStyleDeclaration } from '../cssStyleDeclaration'
|
|
13
|
+
import { eventSource } from '../event-source'
|
|
13
14
|
import { NodeType, TaroNode } from '../node'
|
|
14
15
|
import StyleSheet, { HarmonyStyle, TaroStyleType } from '../stylesheet'
|
|
15
16
|
|
|
16
17
|
import type { BaseTouchEvent, ITouchEvent, StandardProps } from '@tarojs/components/types'
|
|
17
|
-
import type { TaroAny } from '../../
|
|
18
|
+
import type { TaroAny } from '../../interface'
|
|
19
|
+
import type { ICSSStyleDeclaration } from '../cssStyleDeclaration'
|
|
18
20
|
|
|
19
21
|
type NamedNodeMap = { name: string, value: string }[]
|
|
20
22
|
|
|
@@ -91,7 +93,7 @@ export class TaroElement<
|
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
public get id(): string {
|
|
94
|
-
return this.getAttribute('id') || this._nid
|
|
96
|
+
return this.getAttribute('id') || `${this._nid}`
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
public set className(value: string) {
|
|
@@ -338,7 +340,6 @@ export class TaroElement<
|
|
|
338
340
|
public setLayer (value: number) {
|
|
339
341
|
if (!this.parentNode) return // 没有父节点,不需要设置层级关系
|
|
340
342
|
|
|
341
|
-
|
|
342
343
|
const currentPage = getPageById(this.getAttribute('__fixed'))
|
|
343
344
|
if (currentPage) {
|
|
344
345
|
this._page = currentPage
|
|
@@ -56,6 +56,12 @@ class TaroFormWidgetElement<T extends FormWidgetProps = FormWidgetProps> extends
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
public removeAttribute(name: string): void {
|
|
60
|
+
if (name === 'value') {
|
|
61
|
+
this.value = ''
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
59
65
|
public get name () {
|
|
60
66
|
return this._attrs.name || ''
|
|
61
67
|
}
|
|
@@ -231,14 +231,18 @@ export class TaroMovableViewElement extends TaroElement<MovableViewProps & { ani
|
|
|
231
231
|
public callTouchEventFnFromGesture(eventName: string, gestureEvent: GestureEvent) {
|
|
232
232
|
const touchFns = (this?.__listeners?.[eventName] || []) as Function[]
|
|
233
233
|
touchFns.forEach(fn => {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
234
|
+
try {
|
|
235
|
+
fn({
|
|
236
|
+
_hmEvent: gestureEvent,
|
|
237
|
+
target: this,
|
|
238
|
+
changedTouches: gestureEvent.fingerList.map(finger => ({
|
|
239
|
+
clientX: finger.globalX,
|
|
240
|
+
clientY: finger.globalY
|
|
241
|
+
}))
|
|
242
|
+
})
|
|
243
|
+
} catch (error) {
|
|
244
|
+
console.error(error)
|
|
245
|
+
}
|
|
242
246
|
})
|
|
243
247
|
}
|
|
244
248
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
2
|
-
|
|
3
1
|
import TaroDataSourceElement from './dataSource'
|
|
2
|
+
import { eventSource } from './event-source'
|
|
4
3
|
|
|
5
4
|
import type { StandardProps } from '@tarojs/components/types'
|
|
6
|
-
import type { TaroAny } from '../
|
|
5
|
+
import type { TaroAny } from '../interface'
|
|
7
6
|
import type { TaroDocument } from './document'
|
|
8
7
|
import type { TaroElement } from './element/element'
|
|
9
8
|
|
|
@@ -99,7 +98,7 @@ export class TaroNode extends TaroDataSourceElement {
|
|
|
99
98
|
|
|
100
99
|
// 提供唯一标识,方便与小程序一致,能根据uid获取到对应的节点
|
|
101
100
|
public get uid (): string {
|
|
102
|
-
return this._nid
|
|
101
|
+
return `${this._nid}`
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
public get firstChild (): TaroNode | null {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { eventCenter, Events, EventsType } from '@tarojs/runtime/dist/runtime.esm'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { env } from '@tarojs/runtime/dist/runtime.esm'
|
|
@@ -1,18 +1,33 @@
|
|
|
1
|
+
/* eslint-disable simple-import-sort/exports */
|
|
1
2
|
// Current必须放在前面初始化
|
|
2
|
-
// eslint-disable-next-line simple-import-sort/exports
|
|
3
3
|
export * from './current'
|
|
4
|
+
export { hooks } from '@tarojs/shared'
|
|
5
|
+
// bom
|
|
4
6
|
export * from './bom/document'
|
|
5
7
|
export * from './bom/getComputedStyle'
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
+
export * from './bom/history'
|
|
9
|
+
export * from './bom/location'
|
|
10
|
+
export * from './bom/navigator'
|
|
11
|
+
export * from './bom/raf'
|
|
12
|
+
export * from './bom/URL'
|
|
8
13
|
export * from './bom/window'
|
|
14
|
+
// dom
|
|
9
15
|
export * from './dom/element'
|
|
10
16
|
export * from './dom/event'
|
|
17
|
+
export * from './dom/event-source'
|
|
11
18
|
export * from './dom/node'
|
|
12
19
|
export * from './dom/stylesheet'
|
|
13
20
|
export * from './dom/cssNesting'
|
|
14
|
-
|
|
21
|
+
// others
|
|
22
|
+
export * from './env'
|
|
23
|
+
export * from './constant'
|
|
24
|
+
export * from './emitter/emitter'
|
|
15
25
|
export * from './utils'
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
export {
|
|
26
|
+
// typings
|
|
27
|
+
export * from './interface'
|
|
28
|
+
export {
|
|
29
|
+
Instance, PageProps,
|
|
30
|
+
ReactPageComponent, ReactPageInstance, ReactAppInstance,
|
|
31
|
+
PageLifeCycle, PageInstance,
|
|
32
|
+
AppInstance,
|
|
33
|
+
} from '@tarojs/runtime/dist/runtime.esm'
|
|
@@ -1 +1,7 @@
|
|
|
1
1
|
export * from './event'
|
|
2
|
+
export { PageConfig, TFunc } from '@tarojs/runtime/dist/runtime.esm'
|
|
3
|
+
|
|
4
|
+
export type TaroAny = any
|
|
5
|
+
export type TaroFunc = (...args: TaroAny[]) => TaroAny
|
|
6
|
+
export type TaroIndent = string | number | boolean | undefined | null
|
|
7
|
+
export type TaroObject = Record<string | number | symbol, TaroAny>
|
|
@@ -161,9 +161,9 @@ export function findChildNodeWithDFS<T extends TaroElement = TaroElement> (node:
|
|
|
161
161
|
export function findChildNodeWithDFS<T extends TaroElement = TaroElement> (node: TaroElement, selector: string | ((ele: T) => boolean), selectAll): T[] | T | null {
|
|
162
162
|
const queue = [node]
|
|
163
163
|
|
|
164
|
-
const nodeList:
|
|
164
|
+
const nodeList: T[] = []
|
|
165
165
|
while (queue.length) {
|
|
166
|
-
const currentNode = queue.shift()
|
|
166
|
+
const currentNode = queue.shift() as T
|
|
167
167
|
if (currentNode) {
|
|
168
168
|
if (typeof selector === 'string') {
|
|
169
169
|
if (selector.startsWith('#')) {
|
|
@@ -200,7 +200,5 @@ export function findChildNodeWithDFS<T extends TaroElement = TaroElement> (node:
|
|
|
200
200
|
return null
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
export
|
|
204
|
-
export
|
|
205
|
-
export type TaroIndent = string | number | boolean | undefined | null
|
|
206
|
-
export type TaroObject = Record<string | number | symbol, TaroAny>
|
|
203
|
+
export * from './info'
|
|
204
|
+
export * from './router'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Current, document } from '@tarojs/runtime'
|
|
2
|
-
import { eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
|
|
1
|
+
import { Current, document, eventCenter } from '@tarojs/runtime'
|
|
3
2
|
|
|
4
3
|
import { setReconciler } from './connect'
|
|
5
4
|
import { injectPageInstance } from './page'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Current, document, requestAnimationFrame, TaroElement, window } from '@tarojs/runtime'
|
|
2
|
-
import { addLeadingSlash, CONTEXT_ACTIONS, env, eventCenter, TFunc } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
|
|
1
|
+
import { addLeadingSlash, CONTEXT_ACTIONS, Current, document, env, eventCenter, requestAnimationFrame, TaroElement, TFunc, window } from '@tarojs/runtime'
|
|
3
2
|
import { ensure, hooks, isUndefined } from '@tarojs/shared'
|
|
4
3
|
|
|
5
4
|
import { ReactMeta as reactMeta } from './app'
|
|
@@ -29,10 +28,11 @@ interface InitNativeComponentEntryParams {
|
|
|
29
28
|
cb?: TFunc
|
|
30
29
|
// 是否使用默认的 DOM 入口 - app;默认为true,false的时候,会创建一个新的dom并且把它挂载在 app 下面
|
|
31
30
|
isDefaultEntryDom?: boolean
|
|
31
|
+
isUseReact18?: boolean
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
35
|
-
const { R, ReactDOM, cb, isDefaultEntryDom = true } = params
|
|
35
|
+
const { R, ReactDOM, cb, isDefaultEntryDom = true, isUseReact18 = false } = params
|
|
36
36
|
interface IEntryState {
|
|
37
37
|
components: {
|
|
38
38
|
compId: string
|
|
@@ -60,8 +60,8 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
|
60
60
|
// React 16 uncaught error 会导致整个应用 crash,
|
|
61
61
|
// 目前把错误缩小到页面
|
|
62
62
|
componentDidCatch (error, info: React.ErrorInfo) {
|
|
63
|
-
console.warn(error)
|
|
64
|
-
console.error(info.componentStack)
|
|
63
|
+
console.warn(`Taro Error Page 报错信息:${error}`)
|
|
64
|
+
console.error(`Taro Error Page 报错堆栈:${info.componentStack}`)
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
render () {
|
|
@@ -134,14 +134,23 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
|
134
134
|
}),
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
if (isUseReact18) {
|
|
138
|
+
ReactDOM.flushSync(() => {
|
|
139
|
+
this.setState(
|
|
140
|
+
{
|
|
141
|
+
components: [...this.state.components, item],
|
|
142
|
+
},
|
|
143
|
+
() => cb && cb()
|
|
144
|
+
)
|
|
145
|
+
})
|
|
146
|
+
} else {
|
|
138
147
|
this.setState(
|
|
139
148
|
{
|
|
140
149
|
components: [...this.state.components, item],
|
|
141
150
|
},
|
|
142
151
|
() => cb && cb()
|
|
143
152
|
)
|
|
144
|
-
}
|
|
153
|
+
}
|
|
145
154
|
}
|
|
146
155
|
|
|
147
156
|
unmount (compId, cb?) {
|
|
@@ -149,7 +158,20 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
|
149
158
|
const index = components.findIndex((item) => item.compId === compId)
|
|
150
159
|
const next = [...components.slice(0, index), ...components.slice(index + 1)]
|
|
151
160
|
|
|
152
|
-
|
|
161
|
+
|
|
162
|
+
if (isUseReact18) {
|
|
163
|
+
ReactDOM.flushSync(() => {
|
|
164
|
+
this.setState(
|
|
165
|
+
{
|
|
166
|
+
components: next,
|
|
167
|
+
},
|
|
168
|
+
() => {
|
|
169
|
+
removePageInstance(compId)
|
|
170
|
+
cb && cb()
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
})
|
|
174
|
+
} else {
|
|
153
175
|
this.setState(
|
|
154
176
|
{
|
|
155
177
|
components: next,
|
|
@@ -159,7 +181,7 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
|
159
181
|
cb && cb()
|
|
160
182
|
}
|
|
161
183
|
)
|
|
162
|
-
}
|
|
184
|
+
}
|
|
163
185
|
}
|
|
164
186
|
|
|
165
187
|
render () {
|
|
@@ -180,11 +202,16 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
|
180
202
|
app = nativeApp
|
|
181
203
|
}
|
|
182
204
|
|
|
183
|
-
|
|
205
|
+
if (isUseReact18) {
|
|
206
|
+
const root = ReactDOM.createRoot(app)
|
|
184
207
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
208
|
+
ReactDOM.flushSync(() => {
|
|
209
|
+
root.render?.(h(Entry))
|
|
210
|
+
})
|
|
211
|
+
} else {
|
|
212
|
+
// eslint-disable-next-line react/no-deprecated
|
|
213
|
+
ReactDOM.render(h(Entry, {}), app)
|
|
214
|
+
}
|
|
188
215
|
}
|
|
189
216
|
|
|
190
217
|
|
|
@@ -260,7 +287,7 @@ export function createNativePageConfig (
|
|
|
260
287
|
const mountCallback = () => {
|
|
261
288
|
pageElement = document.getElementById($taroPath)
|
|
262
289
|
|
|
263
|
-
ensure(pageElement !== null,
|
|
290
|
+
ensure(pageElement !== null, `Taro Error Page: ${$taroPath}, 该页面执行时出现了报错,导致没有找到页面实例。`)
|
|
264
291
|
|
|
265
292
|
safeExecute($taroPath, ONLOAD, this.$taroParams)
|
|
266
293
|
loadResolver()
|
|
@@ -273,6 +300,7 @@ export function createNativePageConfig (
|
|
|
273
300
|
initNativeComponentEntry({
|
|
274
301
|
R: react,
|
|
275
302
|
ReactDOM,
|
|
303
|
+
isUseReact18: pageConfig?.isUseReact18,
|
|
276
304
|
cb: () => {
|
|
277
305
|
Current.app!.mount!(Component, $taroPath, () => this, mountCallback)
|
|
278
306
|
},
|
|
@@ -397,7 +425,7 @@ export function createNativeComponentConfig (
|
|
|
397
425
|
h = react.createElement
|
|
398
426
|
ReactDOM = reactdom
|
|
399
427
|
setReconciler(ReactDOM)
|
|
400
|
-
const { isNewBlended } = componentConfig
|
|
428
|
+
const { isNewBlended, isUseReact18 } = componentConfig
|
|
401
429
|
|
|
402
430
|
const componentObj: Record<string, any> = {
|
|
403
431
|
options: componentConfig,
|
|
@@ -434,6 +462,7 @@ export function createNativeComponentConfig (
|
|
|
434
462
|
R: react,
|
|
435
463
|
ReactDOM,
|
|
436
464
|
isDefaultEntryDom: !isNewBlended,
|
|
465
|
+
isUseReact18,
|
|
437
466
|
cb: mountComponent,
|
|
438
467
|
})
|
|
439
468
|
} else {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Current, document, requestAnimationFrame, window } from '@tarojs/runtime'
|
|
2
|
-
import { addLeadingSlash, CONTEXT_ACTIONS, env, eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
|
|
1
|
+
import { addLeadingSlash, CONTEXT_ACTIONS, Current, document, env, eventCenter, requestAnimationFrame, window } from '@tarojs/runtime'
|
|
3
2
|
import { hooks, isArray, isFunction, isUndefined } from '@tarojs/shared'
|
|
4
3
|
|
|
5
4
|
import { ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, ON_UNLOAD } from './constant'
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createComponent, h, render } from '@tarojs/plugin-framework-solid/dist/reconciler'
|
|
2
|
-
import { Current, document } from '@tarojs/runtime'
|
|
3
|
-
import { eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
|
|
2
|
+
import { Current, document, eventCenter } from '@tarojs/runtime'
|
|
4
3
|
import { hooks } from '@tarojs/shared'
|
|
5
4
|
import { batch, createContext, createRoot, createSignal, For } from 'solid-js'
|
|
6
5
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Current, document, requestAnimationFrame, window } from '@tarojs/runtime'
|
|
2
|
-
import { addLeadingSlash, CONTEXT_ACTIONS, env, eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
|
|
1
|
+
import { addLeadingSlash, CONTEXT_ACTIONS, Current, document, env, eventCenter, requestAnimationFrame, window } from '@tarojs/runtime'
|
|
3
2
|
import { hooks, isArray, isFunction, isUndefined } from '@tarojs/shared'
|
|
4
3
|
|
|
5
4
|
import { ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, ON_UNLOAD } from './constant'
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { convertNumber2PX, FormElement } from '@tarojs/runtime'
|
|
2
|
-
import { capitalize, internalComponents, isFunction, isNumber, isObject, isString, toCamelCase } from '@tarojs/shared'
|
|
2
|
+
import { capitalize, internalComponents, isFunction, isNumber, isObject, isString, PLATFORM_TYPE, toCamelCase } from '@tarojs/shared'
|
|
3
3
|
|
|
4
4
|
import type { Style, TaroElement } from '@tarojs/runtime'
|
|
5
5
|
|
|
6
6
|
export type Props = Record<string, unknown>
|
|
7
7
|
|
|
8
|
-
const isHarmony = process.env.TARO_PLATFORM === 'harmony'
|
|
9
8
|
const IS_NON_DIMENSIONAL = /max|aspect|acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i
|
|
10
9
|
|
|
11
10
|
function isEventName (s: string) {
|
|
@@ -64,16 +63,16 @@ function setEvent (dom: TaroElement, name: string, value: unknown, oldValue?: un
|
|
|
64
63
|
|
|
65
64
|
const compName = capitalize(toCamelCase(dom.tagName.toLowerCase()))
|
|
66
65
|
|
|
67
|
-
if (eventName === 'click' &&
|
|
66
|
+
if (eventName === 'click' && process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY && compName in internalComponents) {
|
|
68
67
|
eventName = 'tap'
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
if (isFunction(value)) {
|
|
72
71
|
if (oldValue) {
|
|
73
|
-
dom.removeEventListener(eventName, oldValue as any,
|
|
74
|
-
dom.addEventListener(eventName, value,
|
|
72
|
+
dom.removeEventListener(eventName, oldValue as any, process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY ? false : undefined)
|
|
73
|
+
dom.addEventListener(eventName, value, process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY ? { isCapture, sideEffect: false } : undefined)
|
|
75
74
|
} else {
|
|
76
|
-
dom.addEventListener(eventName, value,
|
|
75
|
+
dom.addEventListener(eventName, value, process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY ? isCapture : undefined)
|
|
77
76
|
}
|
|
78
77
|
} else {
|
|
79
78
|
dom.removeEventListener(eventName, oldValue as any)
|
|
@@ -81,13 +80,13 @@ function setEvent (dom: TaroElement, name: string, value: unknown, oldValue?: un
|
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
function setStyle (style: Style, key: string, value: unknown) {
|
|
84
|
-
if (key[0] === '-' &&
|
|
83
|
+
if (key[0] === '-' && process.env.TARO_PLATFORM !== PLATFORM_TYPE.HARMONY) {
|
|
85
84
|
// css variables need not further judgment
|
|
86
85
|
style.setProperty(key, (value as string).toString())
|
|
87
86
|
return
|
|
88
87
|
}
|
|
89
88
|
|
|
90
|
-
if (
|
|
89
|
+
if (process.env.TARO_PLATFORM === PLATFORM_TYPE.HARMONY && key.startsWith('_')) {
|
|
91
90
|
// harmony样式已处理
|
|
92
91
|
style[key] = value == null ? '' : value
|
|
93
92
|
} else {
|
|
@@ -145,7 +144,7 @@ export function setProperty (dom: TaroElement, name: string, value: unknown, old
|
|
|
145
144
|
for (const i in oldValue) {
|
|
146
145
|
if (!(value && i in (value as StyleValue))) {
|
|
147
146
|
// 鸿蒙伪类特殊处理
|
|
148
|
-
if (
|
|
147
|
+
if (process.env.TARO_PLATFORM === PLATFORM_TYPE.HARMONY && (i === '::after' || i === '::before')) {
|
|
149
148
|
setPseudo(dom, i, null)
|
|
150
149
|
} else {
|
|
151
150
|
style[i] = ''
|
|
@@ -157,7 +156,7 @@ export function setProperty (dom: TaroElement, name: string, value: unknown, old
|
|
|
157
156
|
for (const i in value) {
|
|
158
157
|
if (!oldValue || !isEqual(value[i], (oldValue as StyleValue)[i])) {
|
|
159
158
|
// 鸿蒙伪类特殊处理
|
|
160
|
-
if (
|
|
159
|
+
if (process.env.TARO_PLATFORM === PLATFORM_TYPE.HARMONY && (i === '::after' || i === '::before')) {
|
|
161
160
|
setPseudo(dom, i, value[i] as unknown as StyleValue)
|
|
162
161
|
} else {
|
|
163
162
|
style[i] = value[i]
|