@tarojs/plugin-platform-harmony-ets 4.0.0-beta.7 → 4.0.0-beta.8

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.
@@ -120,5 +120,7 @@ export function getAppInfo () {
120
120
  }
121
121
  }
122
122
 
123
+ initNativeApi(taro)
124
+
123
125
  export * from './apis'
124
126
  export default taro
@@ -13,3 +13,5 @@ export const createIntersectionObserver: typeof Taro.createIntersectionObserver
13
13
  }
14
14
 
15
15
  export const createMediaQueryObserver = /* @__PURE__ */ temporarilyNotSupport('createMediaQueryObserver')
16
+
17
+ export { IntersectionObserver }
@@ -2,11 +2,11 @@ import { eventSource } from '@tarojs/runtime/dist/runtime.esm'
2
2
  import { isUndefined } from '@tarojs/shared'
3
3
 
4
4
  import { Current } from '../current'
5
+ import { findChildNodeWithDFS, getPageScrollerOrNode } from '../utils'
5
6
  import { TaroComment } from './comment'
6
7
  import { createCSSStyleDeclaration } from './cssStyleDeclaration'
7
8
  import { TaroElement } from './element/element'
8
- import { NodeType, TaroNode } from './node'
9
- import { TaroTextNode } from './text'
9
+ import { NodeType, TaroNode, TaroTextNode } from './node'
10
10
 
11
11
  import type { Window } from '../bom/window'
12
12
 
@@ -69,10 +69,27 @@ class TaroDocument extends TaroNode {
69
69
  return isUndefined(el) ? null : el as unknown as T
70
70
  }
71
71
 
72
+ public querySelector (selectors: string): TaroElement | null {
73
+ const taro = (Current as any).taro
74
+ const page = taro.getCurrentInstance().page
75
+ const element = getPageScrollerOrNode(page.node, page)
76
+
77
+ if (element == null) return null
78
+
79
+ return findChildNodeWithDFS(element, selectors)
80
+ }
81
+
82
+ public querySelectorAll (selectors: string): TaroElement[] {
83
+ const taro = (Current as any).taro
84
+ const page = taro.getCurrentInstance().page
85
+ const element = getPageScrollerOrNode(page.node, page)
86
+
87
+ if (element == null) return []
88
+
89
+ return findChildNodeWithDFS(element, selectors, true) || []
90
+ }
72
91
  // @Todo
73
92
  // public getElementsByClassName (names: string): TaroElement[]
74
- // public querySelector (selectors: string): TaroElement | null
75
- // public querySelectorAll (selectors: string): TaroElement[]
76
93
  // public createElementNS
77
94
  }
78
95
 
@@ -4280,6 +4280,7 @@ var apis = /*#__PURE__*/Object.freeze({
4280
4280
  ENV_TYPE: ENV_TYPE,
4281
4281
  Events: Events,
4282
4282
  History: History,
4283
+ IntersectionObserver: IntersectionObserver,
4283
4284
  addCard: addCard,
4284
4285
  addFileToFavorites: addFileToFavorites,
4285
4286
  addPhoneCalendar: addPhoneCalendar,
@@ -4669,7 +4670,7 @@ var apis = /*#__PURE__*/Object.freeze({
4669
4670
  writeBLECharacteristicValue: writeBLECharacteristicValue
4670
4671
  });
4671
4672
 
4672
- Object.assign({}, apis);
4673
+ const taro = Object.assign({}, apis);
4673
4674
  const requirePlugin = /* @__PURE__ */ permanentlyNotSupport('requirePlugin');
4674
4675
  function initNativeApi(taro) {
4675
4676
  Current.taro = taro;
@@ -4733,6 +4734,7 @@ function getAppInfo() {
4733
4734
  designWidth: config === null || config === void 0 ? void 0 : config.designWidth,
4734
4735
  };
4735
4736
  }
4737
+ initNativeApi(taro);
4736
4738
 
4737
4739
  const components = {
4738
4740
  Checkbox: {