@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.0 → 4.0.0-alpha.2

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 (77) hide show
  1. package/dist/apis/device/memory.ts +10 -3
  2. package/dist/apis/index.ts +2 -0
  3. package/dist/apis/media/video/VideoContext.ts +56 -7
  4. package/dist/apis/media/video/index.ts +3 -2
  5. package/dist/apis/network/request.ts +5 -5
  6. package/dist/apis/route/index.ts +15 -0
  7. package/dist/apis/wxml/index.ts +2 -0
  8. package/dist/components-harmony-ets/button.ets +26 -40
  9. package/dist/components-harmony-ets/checkbox.ets +70 -99
  10. package/dist/components-harmony-ets/form.ets +29 -42
  11. package/dist/components-harmony-ets/icon.ets +6 -34
  12. package/dist/components-harmony-ets/image.ets +2 -32
  13. package/dist/components-harmony-ets/innerHtml.ets +2 -2
  14. package/dist/components-harmony-ets/input.ets +7 -27
  15. package/dist/components-harmony-ets/label.ets +40 -47
  16. package/dist/components-harmony-ets/picker.ets +66 -73
  17. package/dist/components-harmony-ets/radio.ets +72 -101
  18. package/dist/components-harmony-ets/richText.ets +4 -36
  19. package/dist/components-harmony-ets/scrollView.ets +34 -74
  20. package/dist/components-harmony-ets/slider.ets +9 -34
  21. package/dist/components-harmony-ets/style.ets +154 -0
  22. package/dist/components-harmony-ets/swiper.ets +4 -34
  23. package/dist/components-harmony-ets/switch.ets +43 -56
  24. package/dist/components-harmony-ets/text.ets +7 -34
  25. package/dist/components-harmony-ets/textArea.ets +8 -28
  26. package/dist/components-harmony-ets/utils/DynamicCenter.ts +2 -11
  27. package/dist/components-harmony-ets/utils/flexManager.ets +45 -7
  28. package/dist/components-harmony-ets/utils/helper.ets +2 -2
  29. package/dist/components-harmony-ets/utils/styles.ets +58 -20
  30. package/dist/components-harmony-ets/video.ets +4 -34
  31. package/dist/components-harmony-ets/view.ets +25 -67
  32. package/dist/components-harmony-ets/webView.ets +50 -0
  33. package/dist/index.js +103 -5
  34. package/dist/index.js.map +1 -1
  35. package/dist/runtime-ets/bom/window.ts +2 -2
  36. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +30 -6
  37. package/dist/runtime-ets/dom/document.ts +21 -4
  38. package/dist/runtime-ets/dom/element/element.ts +1 -0
  39. package/dist/runtime-ets/dom/element/form.ts +11 -2
  40. package/dist/runtime-ets/dom/element/index.ts +4 -1
  41. package/dist/runtime-ets/dom/element/normal.ts +1 -0
  42. package/dist/runtime-ets/dom/element/webView.ts +61 -0
  43. package/dist/runtime-ets/dom/node.ts +29 -16
  44. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +624 -0
  45. package/dist/runtime-ets/dom/stylesheet/index.ts +216 -354
  46. package/dist/runtime-ets/dom/stylesheet/type.ts +46 -11
  47. package/dist/runtime-ets/dom/stylesheet/util.ts +58 -6
  48. package/dist/runtime-ets/index.ts +1 -2
  49. package/dist/runtime-ets/interface/event.ts +2 -1
  50. package/dist/runtime-ets/utils/index.ts +6 -1
  51. package/dist/runtime-ets/utils/info.ts +3 -1
  52. package/dist/runtime-framework/react/app.ts +12 -22
  53. package/dist/runtime-framework/react/hooks.ts +3 -3
  54. package/dist/runtime-framework/react/index.ts +1 -0
  55. package/dist/runtime-framework/react/native-page.ts +344 -0
  56. package/dist/runtime-framework/react/page.ts +2 -2
  57. package/dist/runtime-framework/solid/hooks.ts +3 -3
  58. package/dist/runtime-utils.js +76 -20
  59. package/dist/runtime-utils.js.map +1 -1
  60. package/dist/runtime.js +76 -20
  61. package/dist/runtime.js.map +1 -1
  62. package/package.json +12 -11
  63. package/static/media/cancel.svg +1 -0
  64. package/static/media/circle.svg +1 -0
  65. package/static/media/clear.svg +1 -0
  66. package/static/media/download.svg +1 -0
  67. package/static/media/info.svg +1 -0
  68. package/static/media/info_circle.svg +1 -0
  69. package/static/media/search.svg +1 -0
  70. package/static/media/success.svg +1 -0
  71. package/static/media/success_no_circle.svg +1 -0
  72. package/static/media/taro_arrow_left.svg +1 -0
  73. package/static/media/taro_home.svg +1 -0
  74. package/static/media/waiting.svg +1 -0
  75. package/static/media/warn.svg +1 -0
  76. package/types/runtime.d.ts +2 -0
  77. package/dist/runtime-ets/utils/bind.ts +0 -24
@@ -0,0 +1,344 @@
1
+ import { Current, document, requestAnimationFrame, TaroElement, window } from '@tarojs/runtime' // eslint-disable-line import/no-duplicates
2
+ import { CONTEXT_ACTIONS, env, eventCenter, TFunc } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
3
+ import { ensure, hooks, isUndefined } from '@tarojs/shared'
4
+
5
+ import { ReactMeta as reactMeta } from './app'
6
+ import { setReconciler } from './connect'
7
+ import { ON_HIDE, ON_READY, ON_SHOW } from './constant'
8
+ import {
9
+ addLeadingSlash,
10
+ getOnHideEventKey,
11
+ getOnReadyEventKey,
12
+ getOnShowEventKey,
13
+ getPath,
14
+ injectPageInstance,
15
+ removePageInstance,
16
+ safeExecute
17
+ } from './page'
18
+ import { EMPTY_OBJ, incrementId, isClassComponent } from './utils'
19
+
20
+ import type { AppInstance } from '@tarojs/taro'
21
+ import type * as React from 'react'
22
+
23
+ const getNativeCompId = incrementId()
24
+ let h: typeof React.createElement
25
+ let ReactDOM
26
+ let nativeComponentApp: AppInstance
27
+ interface InitNativeComponentEntryParams {
28
+ R: typeof React
29
+ ReactDOM: typeof ReactDOM
30
+ cb?: TFunc
31
+ // 是否使用默认的 DOM 入口 - app;默认为true,false的时候,会创建一个新的dom并且把它挂载在 app 下面
32
+ isDefaultEntryDom?: boolean
33
+ }
34
+
35
+ function initNativeComponentEntry (params: InitNativeComponentEntryParams) {
36
+ const { R, ReactDOM, cb, isDefaultEntryDom = true } = params
37
+ interface IEntryState {
38
+ components: {
39
+ compId: string
40
+ element: React.ReactElement
41
+ }[]
42
+ }
43
+
44
+ interface IWrapperProps {
45
+ compId: string
46
+ getCtx: () => any
47
+ renderComponent: (ctx: any) => React.ReactElement
48
+ }
49
+
50
+ class NativeComponentWrapper extends R.Component<IWrapperProps, Record<any, any>> {
51
+ root = R.createRef<TaroElement>()
52
+ ctx = this.props.getCtx()
53
+
54
+ componentDidMount () {
55
+ this.ctx.component = this
56
+ const rootElement = this.root.current!
57
+ rootElement.ctx = this.ctx
58
+ // TODO: performUpdate
59
+ // rootElement.performUpdate(true)
60
+ }
61
+
62
+ render () {
63
+ return (
64
+ h(
65
+ 'view',
66
+ {
67
+ ref: this.root,
68
+ id: this.props.compId
69
+ },
70
+ this.props.renderComponent(this.ctx)
71
+ )
72
+ )
73
+ }
74
+ }
75
+
76
+ class Entry extends R.Component<Record<any, any>, IEntryState> {
77
+ state: IEntryState = {
78
+ components: []
79
+ }
80
+
81
+ componentDidMount () {
82
+ if (isDefaultEntryDom) {
83
+ Current.app = this
84
+ } else {
85
+ nativeComponentApp = this
86
+ }
87
+ cb && cb()
88
+ }
89
+
90
+ mount (Component, compId, getCtx, cb?) {
91
+ const isReactComponent = isClassComponent(R, Component)
92
+ const inject = (node?: any) => node && injectPageInstance(node, compId)
93
+ const refs = isReactComponent ? { ref: inject } : {
94
+ forwardedRef: inject,
95
+ reactReduxForwardedRef: inject
96
+ }
97
+ if (reactMeta.PageContext === EMPTY_OBJ) {
98
+ reactMeta.PageContext = R.createContext('')
99
+ }
100
+ const item = {
101
+ compId,
102
+ element: h(NativeComponentWrapper, {
103
+ key: compId,
104
+ compId,
105
+ getCtx,
106
+ renderComponent (ctx) {
107
+ return h(
108
+ reactMeta.PageContext.Provider,
109
+ { value: compId },
110
+ h(
111
+ Component,
112
+ {
113
+ // TODO: 传递 Props
114
+ ...(ctx.props || {}),
115
+ ...refs,
116
+ $scope: ctx
117
+ }
118
+ )
119
+ )
120
+ }
121
+ })
122
+ }
123
+ this.setState({
124
+ components: [...this.state.components, item]
125
+ }, () => cb && cb())
126
+ }
127
+
128
+ unmount (compId, cb?) {
129
+ const components = this.state.components
130
+ const index = components.findIndex(item => item.compId === compId)
131
+ const next = [...components.slice(0, index), ...components.slice(index + 1)]
132
+ this.setState({
133
+ components: next
134
+ }, () => {
135
+ removePageInstance(compId)
136
+ cb && cb()
137
+ })
138
+ }
139
+
140
+ render () {
141
+ const components = this.state.components
142
+
143
+ return (
144
+ components.map(({ element }) => element)
145
+ )
146
+ }
147
+ }
148
+
149
+ setReconciler(ReactDOM)
150
+
151
+ let app = document.getElementById('app')
152
+ if (!isDefaultEntryDom && !nativeComponentApp) {
153
+ // create
154
+ const nativeApp = document.createElement('nativeComponent')
155
+ // insert
156
+ app.appendChild(nativeApp)
157
+ app = nativeApp
158
+ }
159
+ // eslint-disable-next-line react/no-deprecated
160
+ ReactDOM.render(
161
+ h(Entry, {}),
162
+ app
163
+ )
164
+ }
165
+
166
+ export function createNativePageConfig (Component, pageName: string, react: typeof React, reactDOM: typeof ReactDOM, pageConfig) {
167
+ reactMeta.R = react
168
+ h = react.createElement
169
+ ReactDOM = reactDOM
170
+ setReconciler(ReactDOM)
171
+ const [
172
+ ONLOAD,
173
+ ONUNLOAD,
174
+ ONREADY,
175
+ ONSHOW,
176
+ ONHIDE,
177
+ LIFECYCLES,
178
+ SIDE_EFFECT_LIFECYCLES
179
+ ] = hooks.call('getMiniLifecycleImpl')!.page
180
+ let unmounting = false
181
+ let prepareMountList: (() => void)[] = []
182
+ let pageElement: TaroElement | null = null
183
+ let loadResolver: (...args: unknown[]) => void
184
+ let hasLoaded: Promise<void>
185
+ const id = pageName ?? `taro_page_${getNativeCompId()}`
186
+ function setCurrentRouter (page) {
187
+ const router = page.route || page.__route__ || page.$taroPath
188
+ Current.router = {
189
+ params: page.$taroParams!,
190
+ path: addLeadingSlash(router),
191
+ $taroPath: page.$taroPath,
192
+ onReady: getOnReadyEventKey(id),
193
+ onShow: getOnShowEventKey(id),
194
+ onHide: getOnHideEventKey(id)
195
+ }
196
+ if (!isUndefined(page.exitState)) {
197
+ Current.router.exitState = page.exitState
198
+ }
199
+ }
200
+
201
+ const pageObj: Record<string, any> = {
202
+ options: pageConfig,
203
+ [ONLOAD] (options: Readonly<Record<string, unknown>> = {}, cb?: TFunc) {
204
+ hasLoaded = new Promise(resolve => { loadResolver = resolve })
205
+ Current.page = this as any
206
+ this.config = pageConfig || {}
207
+ // this.$taroPath 是页面唯一标识
208
+ const uniqueOptions = Object.assign({}, options, { $taroTimestamp: Date.now() })
209
+ const $taroPath = this.$taroPath = getPath(id, uniqueOptions)
210
+
211
+ // this.$taroParams 作为暴露给开发者的页面参数对象,可以被随意修改
212
+ if (this.$taroParams == null) {
213
+ this.$taroParams = uniqueOptions
214
+ }
215
+
216
+ setCurrentRouter(this)
217
+ window.trigger(CONTEXT_ACTIONS.INIT, $taroPath)
218
+
219
+ const mountCallback = () => {
220
+ pageElement = document.getElementById($taroPath)
221
+
222
+ ensure(pageElement !== null, '没有找到页面实例。')
223
+
224
+ safeExecute($taroPath, ONLOAD, this.$taroParams)
225
+ loadResolver()
226
+ cb && cb(pageElement)
227
+ pageElement.ctx = this
228
+ }
229
+
230
+ const mount = () => {
231
+ if (!Current.app) {
232
+ initNativeComponentEntry({
233
+ R: react,
234
+ ReactDOM,
235
+ cb: () => {
236
+ Current.app!.mount!(Component, $taroPath, () => this, mountCallback)
237
+ }
238
+ })
239
+ } else {
240
+ Current.app!.mount!(Component, $taroPath, () => this, mountCallback)
241
+ }
242
+ }
243
+
244
+ if (unmounting) {
245
+ prepareMountList.push(mount)
246
+ } else {
247
+ mount()
248
+ }
249
+ },
250
+ [ONUNLOAD] () {
251
+ const $taroPath = this.$taroPath
252
+ // 销毁当前页面的上下文信息
253
+ window.trigger(CONTEXT_ACTIONS.DESTORY, $taroPath)
254
+ // 触发onUnload生命周期
255
+ safeExecute($taroPath, ONUNLOAD)
256
+ resetCurrent()
257
+ unmounting = true
258
+ Current.app!.unmount!($taroPath, () => {
259
+ unmounting = false
260
+ removePageInstance($taroPath)
261
+ if (pageElement) {
262
+ pageElement.ctx = null
263
+ pageElement = null
264
+ }
265
+ if (prepareMountList.length) {
266
+ prepareMountList.forEach(fn => fn())
267
+ prepareMountList = []
268
+ }
269
+ })
270
+ },
271
+ [ONREADY] () {
272
+ hasLoaded.then(() => {
273
+ // 触发生命周期
274
+ safeExecute(this.$taroPath, ON_READY)
275
+ // 通过事件触发子组件的生命周期
276
+ requestAnimationFrame(() => eventCenter.trigger(getOnReadyEventKey(id)))
277
+ this.onReady.called = true
278
+ })
279
+ },
280
+ [ONSHOW] (options = {}) {
281
+ hasLoaded.then(() => {
282
+ // 设置 Current 的 page 和 router
283
+ Current.page = this as any
284
+ setCurrentRouter(this)
285
+ // 恢复上下文信息
286
+ window.trigger(CONTEXT_ACTIONS.RECOVER, this.$taroPath)
287
+ // 触发生命周期
288
+ safeExecute(this.$taroPath, ON_SHOW, options)
289
+ // 通过事件触发子组件的生命周期
290
+ requestAnimationFrame(() => eventCenter.trigger(getOnShowEventKey(id)))
291
+ })
292
+ },
293
+ [ONHIDE] () {
294
+ // 缓存当前页面上下文信息
295
+ window.trigger(CONTEXT_ACTIONS.RESTORE, this.$taroPath)
296
+ // 设置 Current 的 page 和 router
297
+ if (Current.page === this) {
298
+ Current.page = null
299
+ Current.router = null
300
+ }
301
+ // 触发生命周期
302
+ safeExecute(this.$taroPath, ON_HIDE)
303
+ // 通过事件触发子组件的生命周期
304
+ eventCenter.trigger(getOnHideEventKey(id))
305
+ },
306
+ }
307
+
308
+ function resetCurrent () {
309
+ // 小程序插件页面卸载之后返回到宿主页面时,需重置Current页面和路由。否则引发插件组件二次加载异常 fix:#11991
310
+ Current.page = null
311
+ Current.router = null
312
+ }
313
+
314
+
315
+ LIFECYCLES.forEach((lifecycle) => {
316
+ pageObj[lifecycle] = function () {
317
+ return safeExecute(this.$taroPath, lifecycle, ...arguments)
318
+ }
319
+ })
320
+
321
+ // onShareAppMessage 和 onShareTimeline 一样,会影响小程序右上方按钮的选项,因此不能默认注册。
322
+ SIDE_EFFECT_LIFECYCLES.forEach(lifecycle => {
323
+ if (Component[lifecycle] ||
324
+ Component.prototype?.[lifecycle] ||
325
+ Component[lifecycle.replace(/^on/, 'enable')]
326
+ ) {
327
+ pageObj[lifecycle] = function (...args) {
328
+ const target = args[0]?.target
329
+ if (target?.id) {
330
+ const id = target.id
331
+ const element = env.document.getElementById(id)
332
+ if (element) {
333
+ target.dataset = element.dataset
334
+ }
335
+ }
336
+ return safeExecute(this.$taroPath, lifecycle, ...args)
337
+ }
338
+ }
339
+ })
340
+
341
+ hooks.call('modifyPageObject', pageObj)
342
+
343
+ return pageObj
344
+ }
@@ -136,7 +136,8 @@ export function createPageConfig (component: any, pageName?: string, pageConfig?
136
136
  window.trigger(CONTEXT_ACTIONS.INIT, $taroPath)
137
137
 
138
138
  const mount = () => {
139
- Current.app!.mount!(component, $taroPath, () => {
139
+ // @ts-ignore
140
+ Current.app!.mount!(component, $taroPath, null, () => {
140
141
  pageElement = document.getElementById($taroPath)
141
142
 
142
143
  if (!pageElement) {
@@ -183,7 +184,6 @@ export function createPageConfig (component: any, pageName?: string, pageConfig?
183
184
  safeExecute(this.$taroPath, ON_READY)
184
185
  // 通过事件触发子组件的生命周期
185
186
  requestAnimationFrame(() => eventCenter.trigger(getOnReadyEventKey(id)))
186
- this.onReady.called = true
187
187
  })
188
188
  },
189
189
  [ONSHOW] (options = {}) {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  AppInstance,
3
3
  Current,
4
- Func,
5
- PageLifeCycle
4
+ PageLifeCycle,
5
+ TFunc
6
6
  } from '@tarojs/runtime'
7
7
  import { isArray, isFunction } from '@tarojs/shared'
8
8
  import {
@@ -16,7 +16,7 @@ import { getPageInstance, injectPageInstance } from './page'
16
16
  import { HOOKS_APP_ID } from './utils'
17
17
 
18
18
  const createTaroHook = (lifecycle: keyof PageLifeCycle | keyof AppInstance) => {
19
- return (fn: Func) => {
19
+ return (fn: TFunc) => {
20
20
  const id = ReactMeta.PageContext || HOOKS_APP_ID
21
21
 
22
22
  createRenderEffect(() => {
@@ -1,6 +1,6 @@
1
1
  import { isFunction, isString, isArray, isObject, isNull, isNumber, isUndefined, queryToJson, PLATFORM_TYPE, singleQuote, internalComponents } from '@tarojs/shared';
2
2
  import _display from '@ohos.display';
3
- import { Current, window, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, hooks } from '@tarojs/runtime';
3
+ import { Current, window, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME } from '@tarojs/runtime';
4
4
  import { eventCenter, Events, History } from '@tarojs/runtime/dist/runtime.esm';
5
5
  import deviceInfo from '@ohos.deviceInfo';
6
6
  import i18n from '@ohos.i18n';
@@ -509,7 +509,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
509
509
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
510
510
  PERFORMANCE OF THIS SOFTWARE.
511
511
  ***************************************************************************** */
512
- /* global Reflect, Promise */
512
+ /* global Reflect, Promise, SuppressedError, Symbol */
513
513
 
514
514
 
515
515
  function __awaiter(thisArg, _arguments, P, generator) {
@@ -520,7 +520,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
520
520
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
521
521
  step((generator = generator.apply(thisArg, _arguments || [])).next());
522
522
  });
523
- }
523
+ }
524
+
525
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
526
+ var e = new Error(message);
527
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
528
+ };
524
529
 
525
530
  // 电量
526
531
  const getBatteryInfoSync = () => ({
@@ -731,8 +736,14 @@ const hideKeyboard = function (options) {
731
736
  };
732
737
  const getSelectedTextRange = /* @__PURE__ */ temporarilyNotSupport('getSelectedTextRange');
733
738
 
734
- const onMemoryWarning = temporarilyNotSupport('onMemoryWarning');
735
- const offMemoryWarning = temporarilyNotSupport('offMemoryWarning');
739
+ const onMemoryWarning = (listener) => {
740
+ hooks.tap('getMemoryLevel', (res) => {
741
+ listener(res);
742
+ });
743
+ };
744
+ const offMemoryWarning = (listener) => {
745
+ hooks.off('getMemoryLevel', listener);
746
+ };
736
747
 
737
748
  const stopDeviceMotionListening = temporarilyNotSupport('stopDeviceMotionListening');
738
749
  const startDeviceMotionListening = temporarilyNotSupport('startDeviceMotionListening');
@@ -2306,21 +2317,51 @@ const stopRecord = /* @__PURE__ */ temporarilyNotSupport('stopRecord');
2306
2317
  const startRecord = /* @__PURE__ */ temporarilyNotSupport('startRecord');
2307
2318
  const getRecorderManager = /* @__PURE__ */ temporarilyNotSupport('getRecorderManager');
2308
2319
 
2320
+ // @ts-nocheck
2309
2321
  class VideoContext {
2310
- constructor() {
2322
+ constructor(id) {
2323
+ this.requestBackgroundPlayback = temporarilyNotSupport('VideoContext.requestBackgroundPlayback');
2311
2324
  this.exitBackgroundPlayback = temporarilyNotSupport('VideoContext.exitBackgroundPlayback');
2312
- this.exitFullScreen = temporarilyNotSupport('VideoContext.exitFullScreen');
2313
2325
  this.exitPictureInPicture = temporarilyNotSupport('VideoContext.exitPictureInPicture');
2314
2326
  this.hideStatusBar = temporarilyNotSupport('VideoContext.hideStatusBar');
2315
- this.pause = temporarilyNotSupport('VideoContext.pause');
2316
- this.play = temporarilyNotSupport('VideoContext.play');
2317
2327
  this.playbackRate = temporarilyNotSupport('VideoContext.playbackRate');
2318
- this.requestBackgroundPlayback = temporarilyNotSupport('VideoContext.requestBackgroundPlayback');
2319
- this.requestFullScreen = temporarilyNotSupport('VideoContext.requestFullScreen');
2320
- this.seek = temporarilyNotSupport('VideoContext.seek');
2321
2328
  this.sendDanmu = temporarilyNotSupport('VideoContext.sendDanmu');
2322
2329
  this.showStatusBar = temporarilyNotSupport('VideoContext.showStatusBar');
2323
- this.stop = temporarilyNotSupport('VideoContext.stop');
2330
+ this.id = id;
2331
+ this.video = document$1.getElementById(id);
2332
+ if (this.video) {
2333
+ this.controller = this.video.controller;
2334
+ }
2335
+ }
2336
+ play() {
2337
+ if (!this.controller)
2338
+ return;
2339
+ this.controller.play();
2340
+ }
2341
+ pause() {
2342
+ if (!this.controller)
2343
+ return;
2344
+ this.controller.pause();
2345
+ }
2346
+ stop() {
2347
+ if (!this.controller)
2348
+ return;
2349
+ this.controller.stop();
2350
+ }
2351
+ seek(position) {
2352
+ if (!this.controller)
2353
+ return;
2354
+ this.controller.setCurrentTime(position);
2355
+ }
2356
+ requestFullScreen() {
2357
+ if (!this.controller)
2358
+ return;
2359
+ this.controller.requestFullscreen(true);
2360
+ }
2361
+ exitFullScreen() {
2362
+ if (!this.controller)
2363
+ return;
2364
+ this.controller.exitFullscreen();
2324
2365
  }
2325
2366
  }
2326
2367
 
@@ -2349,8 +2390,8 @@ class VideoContext {
2349
2390
  const saveVideoToPhotosAlbumSchema = {
2350
2391
  filePath: 'String'
2351
2392
  };
2352
- const createVideoContext = () => {
2353
- return new VideoContext();
2393
+ const createVideoContext = (id, _) => {
2394
+ return new VideoContext(id);
2354
2395
  };
2355
2396
  // TODO: 1.返回属性补全
2356
2397
  // TODO: 2.只支持从相册选择,补充摄像头拍摄功能,需要HarmonyOS提供选择组件
@@ -2570,10 +2611,10 @@ const request = function (options) {
2570
2611
  header['Content-Type'] = 'application/json';
2571
2612
  }
2572
2613
  // 检查 Header 是否有 Referer
2573
- if (isUndefined(header.Referer)) {
2574
- const error = { errMsg: 'request fail parameter error: the header doesn‘t support Referer property' };
2575
- callAsyncFail(reject, error, options);
2576
- }
2614
+ // if (isUndefined(header.Referer)) {
2615
+ // const error = { errMsg: 'request fail parameter error: the header doesn‘t support Referer property' }
2616
+ // callAsyncFail(reject, error, options)
2617
+ // }
2577
2618
  // 检查 method 是否正确
2578
2619
  if (method) {
2579
2620
  if (!METHOD.includes(method)) {
@@ -3019,6 +3060,19 @@ function parseURL(raw = '') {
3019
3060
  const [urlStr, queryStr = ''] = raw.split('?');
3020
3061
  const query = queryToJson(queryStr);
3021
3062
  let url = urlStr.replace(/^\//, '');
3063
+ // 处理相对路径
3064
+ if (url.indexOf('.') === 0) {
3065
+ const page = router.getState();
3066
+ const parts = page.path.split('/');
3067
+ parts.pop();
3068
+ url.split('/').forEach((item) => {
3069
+ if (item === '.') {
3070
+ return;
3071
+ }
3072
+ item === '..' ? parts.pop() : parts.push(item);
3073
+ });
3074
+ url = parts.join('/');
3075
+ }
3022
3076
  if (isTabPage(url)) {
3023
3077
  query.$page = url;
3024
3078
  url = TARO_TABBAR_PAGE_PATH;
@@ -4239,6 +4293,7 @@ var apis = /*#__PURE__*/Object.freeze({
4239
4293
  ENV_TYPE: ENV_TYPE,
4240
4294
  Events: Events,
4241
4295
  History: History,
4296
+ IntersectionObserver: IntersectionObserver,
4242
4297
  addCard: addCard,
4243
4298
  addFileToFavorites: addFileToFavorites,
4244
4299
  addPhoneCalendar: addPhoneCalendar,
@@ -4628,7 +4683,7 @@ var apis = /*#__PURE__*/Object.freeze({
4628
4683
  writeBLECharacteristicValue: writeBLECharacteristicValue
4629
4684
  });
4630
4685
 
4631
- Object.assign({}, apis);
4686
+ const taro = Object.assign({}, apis);
4632
4687
  const requirePlugin = /* @__PURE__ */ permanentlyNotSupport('requirePlugin');
4633
4688
  function initNativeApi(taro) {
4634
4689
  Current.taro = taro;
@@ -4692,6 +4747,7 @@ function getAppInfo() {
4692
4747
  designWidth: config === null || config === void 0 ? void 0 : config.designWidth,
4693
4748
  };
4694
4749
  }
4750
+ initNativeApi(taro);
4695
4751
 
4696
4752
  const components = {
4697
4753
  Checkbox: {