@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.36 → 4.0.0-alpha.37
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/framework/index.ts +1 -1
- package/dist/apis/media/image/index.ts +135 -124
- package/dist/apis/route/index.ts +2 -1
- package/dist/apis/ui/background.ts +1 -1
- package/dist/apis/ui/navigation-bar/index.ts +1 -1
- package/dist/apis/ui/tab-bar.ts +2 -1
- package/dist/components-harmony-ets/button.ets +1 -1
- package/dist/components-harmony-ets/checkbox.ets +2 -1
- package/dist/components-harmony-ets/form.ets +1 -0
- package/dist/components-harmony-ets/index.ets +90 -37
- package/dist/components-harmony-ets/input.ets +2 -2
- package/dist/components-harmony-ets/label.ets +2 -1
- package/dist/components-harmony-ets/listView.ets +1 -1
- 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 +3 -2
- package/dist/components-harmony-ets/scrollList.ets +2 -2
- package/dist/components-harmony-ets/scrollView.ets +1 -1
- package/dist/components-harmony-ets/slider.ets +1 -1
- package/dist/components-harmony-ets/style.ets +6 -7
- 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 +6 -5
- package/dist/components-harmony-ets/video.ets +1 -1
- package/dist/components-harmony-ets/view.ets +2 -1
- package/dist/components-harmony-ets/webView.ets +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime-ets/bom/document.ts +2 -1
- package/dist/runtime-ets/bom/getComputedStyle.ts +2 -1
- package/dist/runtime-ets/bom/navigator.ts +21 -1
- package/dist/runtime-ets/bom/raf.ts +37 -1
- package/dist/runtime-ets/bom/window.ts +5 -4
- package/dist/runtime-ets/constant.ts +10 -17
- package/dist/runtime-ets/current.ts +1 -0
- package/dist/runtime-ets/dom/document.ts +1 -1
- package/dist/runtime-ets/dom/element/canvas.ts +2 -3
- package/dist/runtime-ets/dom/element/element.ts +5 -6
- package/dist/runtime-ets/dom/element/movableView.ts +8 -12
- package/dist/runtime-ets/dom/eventTarget.ts +1 -1
- package/dist/runtime-ets/dom/node.ts +3 -2
- package/dist/runtime-ets/index.ts +7 -21
- package/dist/runtime-ets/interface/index.ts +0 -6
- package/dist/runtime-ets/utils/index.ts +6 -4
- package/dist/runtime-framework/react/app.ts +2 -1
- package/dist/runtime-framework/react/hooks.ts +1 -1
- package/dist/runtime-framework/react/native-page.ts +15 -44
- package/dist/runtime-framework/react/page.ts +2 -1
- package/dist/runtime-framework/solid/app.ts +2 -1
- package/dist/runtime-framework/solid/hooks.ts +1 -1
- package/dist/runtime-framework/solid/page.ts +2 -1
- package/dist/runtime-utils.js +166 -134
- package/dist/runtime-utils.js.map +1 -1
- package/dist/runtime.js +166 -134
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -9
- package/dist/runtime-ets/bom/URL.ts +0 -2
- package/dist/runtime-ets/bom/history.ts +0 -1
- package/dist/runtime-ets/bom/location.ts +0 -1
- package/dist/runtime-ets/dom/event-source.ts +0 -1
- package/dist/runtime-ets/emitter/emitter.ts +0 -1
- package/dist/runtime-ets/env.ts +0 -1
- package/dist/runtime-ets/utils/router.ts +0 -9
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
1
2
|
import { isUndefined } from '@tarojs/shared'
|
|
2
3
|
|
|
3
4
|
import { Current } from '../current'
|
|
4
5
|
import { findChildNodeWithDFS, getPageScrollerOrNode } from '../utils'
|
|
5
6
|
import { TaroComment } from './comment'
|
|
6
7
|
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,9 +1,8 @@
|
|
|
1
|
-
import { eventSource } from '
|
|
2
|
-
|
|
1
|
+
import { eventSource, TaroAny, TaroNode } from '@tarojs/runtime'
|
|
2
|
+
|
|
3
3
|
import { TaroElement } from './element'
|
|
4
4
|
|
|
5
5
|
import type { CanvasProps, CanvasTouchEvent } from '@tarojs/components/types'
|
|
6
|
-
import type { TaroAny } from '../../interface'
|
|
7
6
|
|
|
8
7
|
export class CanvasRenderingContext2DWXAdapter extends CanvasRenderingContext2D {
|
|
9
8
|
// constructor(settings?: RenderingContextSetting) {
|
|
@@ -1,22 +1,20 @@
|
|
|
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'
|
|
3
4
|
import { EMPTY_OBJ, toCamelCase } from '@tarojs/shared'
|
|
4
5
|
|
|
5
6
|
import { ATTRIBUTES_CALLBACK_TRIGGER_MAP, ID } from '../../constant'
|
|
6
7
|
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 { createCSSStyleDeclaration } from '../cssStyleDeclaration'
|
|
13
|
-
import { eventSource } from '../event-source'
|
|
12
|
+
import { type ICSSStyleDeclaration, createCSSStyleDeclaration } from '../cssStyleDeclaration'
|
|
14
13
|
import { NodeType, TaroNode } from '../node'
|
|
15
14
|
import StyleSheet, { HarmonyStyle, TaroStyleType } from '../stylesheet'
|
|
16
15
|
|
|
17
16
|
import type { BaseTouchEvent, ITouchEvent, StandardProps } from '@tarojs/components/types'
|
|
18
|
-
import type { TaroAny } from '../../
|
|
19
|
-
import type { ICSSStyleDeclaration } from '../cssStyleDeclaration'
|
|
17
|
+
import type { TaroAny } from '../../utils'
|
|
20
18
|
|
|
21
19
|
type NamedNodeMap = { name: string, value: string }[]
|
|
22
20
|
|
|
@@ -93,7 +91,7 @@ export class TaroElement<
|
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
public get id(): string {
|
|
96
|
-
return this.getAttribute('id') ||
|
|
94
|
+
return this.getAttribute('id') || this._nid
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
public set className(value: string) {
|
|
@@ -340,6 +338,7 @@ export class TaroElement<
|
|
|
340
338
|
public setLayer (value: number) {
|
|
341
339
|
if (!this.parentNode) return // 没有父节点,不需要设置层级关系
|
|
342
340
|
|
|
341
|
+
|
|
343
342
|
const currentPage = getPageById(this.getAttribute('__fixed'))
|
|
344
343
|
if (currentPage) {
|
|
345
344
|
this._page = currentPage
|
|
@@ -231,18 +231,14 @@ 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
|
-
|
|
242
|
-
})
|
|
243
|
-
} catch (error) {
|
|
244
|
-
console.error(error)
|
|
245
|
-
}
|
|
234
|
+
fn({
|
|
235
|
+
_hmEvent: gestureEvent,
|
|
236
|
+
target: this,
|
|
237
|
+
changedTouches: gestureEvent.fingerList.map(finger => ({
|
|
238
|
+
clientX: finger.globalX,
|
|
239
|
+
clientY: finger.globalY
|
|
240
|
+
}))
|
|
241
|
+
})
|
|
246
242
|
})
|
|
247
243
|
}
|
|
248
244
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
|
|
2
|
+
|
|
1
3
|
import TaroDataSourceElement from './dataSource'
|
|
2
|
-
import { eventSource } from './event-source'
|
|
3
4
|
|
|
4
5
|
import type { StandardProps } from '@tarojs/components/types'
|
|
5
|
-
import type { TaroAny } from '../
|
|
6
|
+
import type { TaroAny } from '../utils'
|
|
6
7
|
import type { TaroDocument } from './document'
|
|
7
8
|
import type { TaroElement } from './element/element'
|
|
8
9
|
|
|
@@ -1,32 +1,18 @@
|
|
|
1
|
-
/* eslint-disable simple-import-sort/exports */
|
|
2
1
|
// Current必须放在前面初始化
|
|
2
|
+
// eslint-disable-next-line simple-import-sort/exports
|
|
3
3
|
export * from './current'
|
|
4
|
-
export { hooks } from '@tarojs/shared'
|
|
5
|
-
// bom
|
|
6
4
|
export * from './bom/document'
|
|
7
5
|
export * from './bom/getComputedStyle'
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export { navigator } from './bom/navigator'
|
|
11
|
-
export { cancelAnimationFrame, now, requestAnimationFrame } from './bom/raf'
|
|
12
|
-
export * from './bom/URL'
|
|
6
|
+
export { nav as navigator } from './bom/navigator'
|
|
7
|
+
export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from './bom/raf'
|
|
13
8
|
export * from './bom/window'
|
|
14
|
-
// dom
|
|
15
9
|
export * from './dom/element'
|
|
16
10
|
export * from './dom/event'
|
|
17
11
|
export * from './dom/node'
|
|
18
12
|
export * from './dom/stylesheet'
|
|
19
13
|
export * from './dom/cssNesting'
|
|
20
|
-
// others
|
|
21
|
-
export * from './env'
|
|
22
|
-
export * from './constant'
|
|
23
|
-
export * from './emitter/emitter'
|
|
24
|
-
export * from './utils'
|
|
25
|
-
// typings
|
|
26
14
|
export * from './interface'
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
AppInstance,
|
|
32
|
-
} from '@tarojs/runtime/dist/runtime.esm'
|
|
15
|
+
export * from './utils'
|
|
16
|
+
export * from './utils/info'
|
|
17
|
+
export { URL, URLSearchParams, eventSource, Events } from '@tarojs/runtime/dist/runtime.esm'
|
|
18
|
+
export { hooks } from '@tarojs/shared'
|
|
@@ -1,7 +1 @@
|
|
|
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: TaroElement[] = []
|
|
165
165
|
while (queue.length) {
|
|
166
|
-
const currentNode = queue.shift()
|
|
166
|
+
const currentNode = queue.shift()
|
|
167
167
|
if (currentNode) {
|
|
168
168
|
if (typeof selector === 'string') {
|
|
169
169
|
if (selector.startsWith('#')) {
|
|
@@ -200,5 +200,7 @@ export function findChildNodeWithDFS<T extends TaroElement = TaroElement> (node:
|
|
|
200
200
|
return null
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
export
|
|
204
|
-
export
|
|
203
|
+
export type TaroAny = any
|
|
204
|
+
export type TaroFunc = (...args: TaroAny[]) => TaroAny
|
|
205
|
+
export type TaroIndent = string | number | boolean | undefined | null
|
|
206
|
+
export type TaroObject = Record<string | number | symbol, TaroAny>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Current, document
|
|
1
|
+
import { Current, document } from '@tarojs/runtime' // eslint-disable-line import/no-duplicates
|
|
2
|
+
import { eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
|
|
2
3
|
|
|
3
4
|
import { setReconciler } from './connect'
|
|
4
5
|
import { injectPageInstance } from './page'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Current, document, requestAnimationFrame, TaroElement, window } from '@tarojs/runtime' // eslint-disable-line import/no-duplicates
|
|
2
|
+
import { addLeadingSlash, CONTEXT_ACTIONS, env, eventCenter, TFunc } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
|
|
2
3
|
import { ensure, hooks, isUndefined } from '@tarojs/shared'
|
|
3
4
|
|
|
4
5
|
import { ReactMeta as reactMeta } from './app'
|
|
@@ -28,11 +29,10 @@ interface InitNativeComponentEntryParams {
|
|
|
28
29
|
cb?: TFunc
|
|
29
30
|
// 是否使用默认的 DOM 入口 - app;默认为true,false的时候,会创建一个新的dom并且把它挂载在 app 下面
|
|
30
31
|
isDefaultEntryDom?: boolean
|
|
31
|
-
isUseReact18?: boolean
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
35
|
-
const { R, ReactDOM, cb, isDefaultEntryDom = true
|
|
35
|
+
const { R, ReactDOM, cb, isDefaultEntryDom = true } = 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(
|
|
64
|
-
console.error(
|
|
63
|
+
console.warn(error)
|
|
64
|
+
console.error(info.componentStack)
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
render () {
|
|
@@ -134,23 +134,14 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
|
134
134
|
}),
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
ReactDOM.flushSync(() => {
|
|
139
|
-
this.setState(
|
|
140
|
-
{
|
|
141
|
-
components: [...this.state.components, item],
|
|
142
|
-
},
|
|
143
|
-
() => cb && cb()
|
|
144
|
-
)
|
|
145
|
-
})
|
|
146
|
-
} else {
|
|
137
|
+
ReactDOM.flushSync(() => {
|
|
147
138
|
this.setState(
|
|
148
139
|
{
|
|
149
140
|
components: [...this.state.components, item],
|
|
150
141
|
},
|
|
151
142
|
() => cb && cb()
|
|
152
143
|
)
|
|
153
|
-
}
|
|
144
|
+
})
|
|
154
145
|
}
|
|
155
146
|
|
|
156
147
|
unmount (compId, cb?) {
|
|
@@ -158,20 +149,7 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
|
158
149
|
const index = components.findIndex((item) => item.compId === compId)
|
|
159
150
|
const next = [...components.slice(0, index), ...components.slice(index + 1)]
|
|
160
151
|
|
|
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 {
|
|
152
|
+
ReactDOM.flushSync(() => {
|
|
175
153
|
this.setState(
|
|
176
154
|
{
|
|
177
155
|
components: next,
|
|
@@ -181,7 +159,7 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
|
181
159
|
cb && cb()
|
|
182
160
|
}
|
|
183
161
|
)
|
|
184
|
-
}
|
|
162
|
+
})
|
|
185
163
|
}
|
|
186
164
|
|
|
187
165
|
render () {
|
|
@@ -202,16 +180,11 @@ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
|
|
|
202
180
|
app = nativeApp
|
|
203
181
|
}
|
|
204
182
|
|
|
205
|
-
|
|
206
|
-
const root = ReactDOM.createRoot(app)
|
|
183
|
+
const root = ReactDOM.createRoot(app)
|
|
207
184
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
} else {
|
|
212
|
-
// eslint-disable-next-line react/no-deprecated
|
|
213
|
-
ReactDOM.render(h(Entry, {}), app)
|
|
214
|
-
}
|
|
185
|
+
ReactDOM.flushSync(() => {
|
|
186
|
+
root.render?.(h(Entry))
|
|
187
|
+
})
|
|
215
188
|
}
|
|
216
189
|
|
|
217
190
|
|
|
@@ -287,7 +260,7 @@ export function createNativePageConfig (
|
|
|
287
260
|
const mountCallback = () => {
|
|
288
261
|
pageElement = document.getElementById($taroPath)
|
|
289
262
|
|
|
290
|
-
ensure(pageElement !== null,
|
|
263
|
+
ensure(pageElement !== null, '没有找到页面实例。')
|
|
291
264
|
|
|
292
265
|
safeExecute($taroPath, ONLOAD, this.$taroParams)
|
|
293
266
|
loadResolver()
|
|
@@ -300,7 +273,6 @@ export function createNativePageConfig (
|
|
|
300
273
|
initNativeComponentEntry({
|
|
301
274
|
R: react,
|
|
302
275
|
ReactDOM,
|
|
303
|
-
isUseReact18: pageConfig?.isUseReact18,
|
|
304
276
|
cb: () => {
|
|
305
277
|
Current.app!.mount!(Component, $taroPath, () => this, mountCallback)
|
|
306
278
|
},
|
|
@@ -425,7 +397,7 @@ export function createNativeComponentConfig (
|
|
|
425
397
|
h = react.createElement
|
|
426
398
|
ReactDOM = reactdom
|
|
427
399
|
setReconciler(ReactDOM)
|
|
428
|
-
const { isNewBlended
|
|
400
|
+
const { isNewBlended } = componentConfig
|
|
429
401
|
|
|
430
402
|
const componentObj: Record<string, any> = {
|
|
431
403
|
options: componentConfig,
|
|
@@ -462,7 +434,6 @@ export function createNativeComponentConfig (
|
|
|
462
434
|
R: react,
|
|
463
435
|
ReactDOM,
|
|
464
436
|
isDefaultEntryDom: !isNewBlended,
|
|
465
|
-
isUseReact18,
|
|
466
437
|
cb: mountComponent,
|
|
467
438
|
})
|
|
468
439
|
} else {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Current, document, requestAnimationFrame, window } from '@tarojs/runtime' // eslint-disable-line import/no-duplicates
|
|
2
|
+
import { addLeadingSlash, CONTEXT_ACTIONS, env, eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
|
|
2
3
|
import { hooks, isArray, isFunction, isUndefined } from '@tarojs/shared'
|
|
3
4
|
|
|
4
5
|
import { ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, ON_UNLOAD } from './constant'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createComponent, h, render } from '@tarojs/plugin-framework-solid/dist/reconciler'
|
|
2
|
-
import { Current, document
|
|
2
|
+
import { Current, document } from '@tarojs/runtime' // eslint-disable-line import/no-duplicates
|
|
3
|
+
import { eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
|
|
3
4
|
import { hooks } from '@tarojs/shared'
|
|
4
5
|
import { batch, createContext, createRoot, createSignal, For } from 'solid-js'
|
|
5
6
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Current, document, requestAnimationFrame, window } from '@tarojs/runtime' // eslint-disable-line import/no-duplicates
|
|
2
|
+
import { addLeadingSlash, CONTEXT_ACTIONS, env, eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
|
|
2
3
|
import { hooks, isArray, isFunction, isUndefined } from '@tarojs/shared'
|
|
3
4
|
|
|
4
5
|
import { ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, ON_UNLOAD } from './constant'
|