@tarojs/plugin-platform-harmony-ets 4.0.3-alpha.3 → 4.0.3-alpha.5

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 (76) hide show
  1. package/dist/apis/base/weapp/life-cycle.ts +1 -1
  2. package/dist/apis/framework/index.ts +1 -1
  3. package/dist/apis/network/downloadFile.ts +3 -1
  4. package/dist/apis/network/uploadFile.ts +3 -1
  5. package/dist/apis/route/index.ts +1 -2
  6. package/dist/apis/ui/background.ts +1 -1
  7. package/dist/apis/ui/navigation-bar/index.ts +1 -1
  8. package/dist/apis/ui/tab-bar.ts +1 -2
  9. package/dist/apis/utils/handler.ts +2 -1
  10. package/dist/apis/utils/index.ts +1 -2
  11. package/dist/components-harmony-ets/button.ets +1 -1
  12. package/dist/components-harmony-ets/checkbox.ets +1 -2
  13. package/dist/components-harmony-ets/form.ets +0 -1
  14. package/dist/components-harmony-ets/index.ets +37 -90
  15. package/dist/components-harmony-ets/input.ets +11 -7
  16. package/dist/components-harmony-ets/label.ets +1 -2
  17. package/dist/components-harmony-ets/listView.ets +3 -2
  18. package/dist/components-harmony-ets/movableArea.ets +3 -3
  19. package/dist/components-harmony-ets/navigationBar.ets +1 -1
  20. package/dist/components-harmony-ets/pageMeta.ets +1 -1
  21. package/dist/components-harmony-ets/pseudo.ets +1 -1
  22. package/dist/components-harmony-ets/radio.ets +2 -3
  23. package/dist/components-harmony-ets/scrollList.ets +2 -2
  24. package/dist/components-harmony-ets/scrollView.ets +8 -3
  25. package/dist/components-harmony-ets/slider.ets +1 -1
  26. package/dist/components-harmony-ets/stickySection.ets +2 -2
  27. package/dist/components-harmony-ets/style.ets +8 -7
  28. package/dist/components-harmony-ets/swiper.ets +1 -1
  29. package/dist/components-harmony-ets/switch.ets +1 -1
  30. package/dist/components-harmony-ets/text.ets +2 -2
  31. package/dist/components-harmony-ets/utils/helper.ets +2 -2
  32. package/dist/components-harmony-ets/utils/styles.ets +5 -6
  33. package/dist/components-harmony-ets/video.ets +1 -1
  34. package/dist/components-harmony-ets/view.ets +1 -2
  35. package/dist/components-harmony-ets/webView.ets +1 -1
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.js +3 -0
  38. package/dist/index.js.map +1 -1
  39. package/dist/runtime-ets/bom/URL.ts +2 -0
  40. package/dist/runtime-ets/bom/document.ts +1 -2
  41. package/dist/runtime-ets/bom/getComputedStyle.ts +1 -2
  42. package/dist/runtime-ets/bom/history.ts +1 -0
  43. package/dist/runtime-ets/bom/location.ts +1 -0
  44. package/dist/runtime-ets/bom/navigator.ts +1 -21
  45. package/dist/runtime-ets/bom/raf.ts +1 -37
  46. package/dist/runtime-ets/bom/window.ts +4 -5
  47. package/dist/runtime-ets/constant.ts +17 -10
  48. package/dist/runtime-ets/current.ts +24 -2
  49. package/dist/runtime-ets/dom/document.ts +1 -1
  50. package/dist/runtime-ets/dom/element/canvas.ts +3 -2
  51. package/dist/runtime-ets/dom/element/element.ts +6 -5
  52. package/dist/runtime-ets/dom/element/form.ts +6 -0
  53. package/dist/runtime-ets/dom/event-source.ts +1 -0
  54. package/dist/runtime-ets/dom/eventTarget.ts +1 -1
  55. package/dist/runtime-ets/dom/node.ts +3 -4
  56. package/dist/runtime-ets/emitter/emitter.ts +1 -0
  57. package/dist/runtime-ets/env.ts +1 -0
  58. package/dist/runtime-ets/index.ts +22 -7
  59. package/dist/runtime-ets/interface/index.ts +6 -0
  60. package/dist/runtime-ets/utils/index.ts +4 -6
  61. package/dist/runtime-ets/utils/router.ts +9 -0
  62. package/dist/runtime-framework/react/app.ts +1 -2
  63. package/dist/runtime-framework/react/hooks.ts +1 -1
  64. package/dist/runtime-framework/react/native-page.ts +1 -2
  65. package/dist/runtime-framework/react/page.ts +1 -2
  66. package/dist/runtime-framework/solid/app.ts +1 -2
  67. package/dist/runtime-framework/solid/hooks.ts +1 -1
  68. package/dist/runtime-framework/solid/page.ts +1 -2
  69. package/dist/runtime-framework/solid/reconciler/props.ts +9 -10
  70. package/dist/runtime-utils.d.ts +4 -5
  71. package/dist/runtime-utils.js +1 -2
  72. package/dist/runtime-utils.js.map +1 -1
  73. package/dist/runtime.js +1 -2
  74. package/dist/runtime.js.map +1 -1
  75. package/package.json +9 -9
  76. package/types/runtime.d.ts +7 -0
@@ -1,15 +1,22 @@
1
1
  import { isNumber } from '@tarojs/shared'
2
2
 
3
- export const TYPE = 'type'
4
- export const VALUE = 'value'
5
- export const INPUT = 'input'
6
- export const CHANGE = 'change'
7
- export const TARGET = 'target'
8
- export const CONFIRM = 'confirm'
9
- export const KEY_CODE = 'keyCode'
10
- export const TIME_STAMP = 'timeStamp'
11
- export const CURRENT_TARGET = 'currentTarget'
12
- export const ID = 'id'
3
+ export {
4
+ A, APP, BEHAVIORS, BODY,
5
+ CATCH_VIEW, CATCHMOVE, CHANGE,
6
+ CLASS, COMMENT, COMPILE_MODE,
7
+ CONFIRM, CONTAINER, CONTEXT_ACTIONS,
8
+ CURRENT_TARGET, CUSTOM_WRAPPER,
9
+ DATASET, DATE, DOCUMENT_ELEMENT_NAME,
10
+ DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT,
11
+ EXTERNAL_CLASSES, FOCUS, HEAD,
12
+ HOOKS_APP_ID, HTML, ID, INPUT,
13
+ KEY_CODE, OBJECT, ON_HIDE, ON_LOAD,
14
+ ON_READY, ON_SHOW, OPTIONS, PAGE_INIT,
15
+ PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR,
16
+ SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE,
17
+ TARGET, TARO_RUNTIME, TIME_STAMP,
18
+ TOUCHMOVE, TYPE, UID, VALUE, VIEW
19
+ } from '@tarojs/runtime/dist/runtime.esm'
13
20
 
14
21
  export const ATTRIBUTES_CALLBACK_TRIGGER_MAP = {
15
22
  scrollTop: {
@@ -3,16 +3,38 @@ export const context: any = {
3
3
  value: null
4
4
  }
5
5
 
6
- // @ts-nocheck
6
+ export const uiContext: any = {
7
+ resolver: null,
8
+ value: null
9
+ }
10
+
7
11
  export const Current: any = {
8
12
  app: null,
9
- uiContext: null,
13
+ get uiContext () {
14
+ return uiContext.value
15
+ },
16
+ set uiContext (e) {
17
+ uiContext.resolver(e)
18
+ },
10
19
  router: {},
11
20
  taro: {},
12
21
  contextPromise: new Promise(resolve => {
13
22
  context.resolver = resolve
14
23
 
15
24
  return resolve
25
+ }).then(e => {
26
+ context.value = e
27
+
28
+ return e
29
+ }),
30
+ uiContextPromise: new Promise(resolve => {
31
+ uiContext.resolver = resolve
32
+
33
+ return resolve
34
+ }).then((e) => {
35
+ uiContext.value = e
36
+
37
+ return e
16
38
  }),
17
39
  createHarmonyElement: null
18
40
  }
@@ -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, TaroAny, TaroNode } from '@tarojs/runtime'
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 { type ICSSStyleDeclaration, createCSSStyleDeclaration } from '../cssStyleDeclaration'
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 '../../utils'
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
  }
@@ -0,0 +1 @@
1
+ export { eventSource } from '@tarojs/runtime/dist/runtime.esm'
@@ -1,6 +1,6 @@
1
- import { Events } from '@tarojs/runtime/dist/runtime.esm'
2
1
  import { isArray } from '@tarojs/shared'
3
2
 
3
+ import { Events } from '../emitter/emitter'
4
4
  import { TaroEvent } from './event'
5
5
 
6
6
  import type { EventHandler } from '../interface'
@@ -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 '../utils'
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 { nav as navigator } from './bom/navigator'
7
- export { caf as cancelAnimationFrame, now, raf as requestAnimationFrame } from './bom/raf'
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
- export * from './interface'
21
+ // others
22
+ export * from './env'
23
+ export * from './constant'
24
+ export * from './emitter/emitter'
15
25
  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'
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: TaroElement[] = []
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 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>
203
+ export * from './info'
204
+ export * from './router'
@@ -0,0 +1,9 @@
1
+ export {
2
+ addLeadingSlash,
3
+ getCurrentPage,
4
+ getHomePage,
5
+ hasBasename,
6
+ stripBasename,
7
+ stripSuffix,
8
+ stripTrailing
9
+ } from '@tarojs/runtime/dist/runtime.esm'
@@ -1,5 +1,4 @@
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
1
+ import { Current, document, eventCenter } from '@tarojs/runtime'
3
2
 
4
3
  import { setReconciler } from './connect'
5
4
  import { injectPageInstance } from './page'
@@ -11,7 +11,7 @@ import type {
11
11
  PageLifeCycle,
12
12
  PageProps,
13
13
  TFunc
14
- } from '@tarojs/runtime/dist/runtime.esm'
14
+ } from '@tarojs/runtime'
15
15
 
16
16
  const createTaroHook = (lifecycle: keyof PageLifeCycle | keyof AppInstance) => {
17
17
  return (fn: TFunc) => {
@@ -1,5 +1,4 @@
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
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'
@@ -1,5 +1,4 @@
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
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' // eslint-disable-line import/no-duplicates
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
 
@@ -14,7 +14,7 @@ import type {
14
14
  AppInstance,
15
15
  PageLifeCycle,
16
16
  TFunc
17
- } from '@tarojs/runtime/dist/runtime.esm'
17
+ } from '@tarojs/runtime'
18
18
 
19
19
  const createTaroHook = (lifecycle: keyof PageLifeCycle | keyof AppInstance) => {
20
20
  return (fn: TFunc) => {
@@ -1,5 +1,4 @@
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
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' && !isHarmony && compName in internalComponents) {
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, !isHarmony ? false : undefined)
74
- dom.addEventListener(eventName, value, !isHarmony ? { isCapture, sideEffect: false } : undefined)
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, !isHarmony ? isCapture : undefined)
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] === '-' && !isHarmony) {
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 (isHarmony && key.startsWith('_')) {
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 (isHarmony && (i === '::after' || i === '::before')) {
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 (isHarmony && (i === '::after' || i === '::before')) {
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]
@@ -1,11 +1,10 @@
1
+ import { TFunc } from "@tarojs/runtime";
1
2
  import Taro from "@tarojs/taro/types";
2
- import Taro$0 from "@tarojs/taro";
3
3
  declare namespace apis {
4
4
  interface ICallbackResult {
5
5
  /** 错误信息 */
6
6
  errMsg: string;
7
7
  }
8
- type TFunc = (...args: any[]) => any;
9
8
  type TCallback<T = Partial<ICallbackResult>> = (res: T) => Promise<void> | void;
10
9
  interface IMethodParam<T = Partial<ICallbackResult>> {
11
10
  name: string;
@@ -380,7 +379,7 @@ declare namespace apis {
380
379
  const navigateBackMiniProgram: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
381
380
  const exitMiniProgram: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
382
381
  const openBusinessView: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
383
- const downloadFile: typeof Taro$0.downloadFile;
382
+ const downloadFile: typeof Taro.downloadFile;
384
383
  const stopLocalServiceDiscovery: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
385
384
  const startLocalServiceDiscovery: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
386
385
  const onLocalServiceResolveFail: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
@@ -397,7 +396,7 @@ declare namespace apis {
397
396
  const createUDPSocket: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
398
397
  // wx 只支持 HTTP POST 请求,OHOS 支持 POST 和 PUT 请求
399
398
  // OHOS 不支持 wx 的 timeout,但是支持 file 文件列表上传,wx 是单文件上传
400
- const uploadFile: typeof Taro$0.uploadFile;
399
+ const uploadFile: typeof Taro.uploadFile;
401
400
  const connectSocket: typeof Taro.connectSocket;
402
401
  const getAccountInfoSync: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
403
402
  const chooseAddress: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
@@ -581,7 +580,7 @@ declare namespace apis {
581
580
  }
582
581
  const createAnimation: (option: Taro.createAnimation.Option) => Animation;
583
582
  const setBackgroundTextStyle: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
584
- function setBackgroundColor(options: Taro$0.setBackgroundColor.Option): Promise<unknown>;
583
+ function setBackgroundColor(options: Taro.setBackgroundColor.Option): Promise<unknown>;
585
584
  // 自定义组件
586
585
  const nextTick: typeof Taro.nextTick;
587
586
  const loadFontFace: (option?: {}, ...args: any[]) => Promise<Partial<ICallbackResult> & Record<string, unknown> & ICallbackResult>;
@@ -1,8 +1,7 @@
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, eventSource, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, getCurrentInstance } from '@tarojs/runtime';
3
+ import { eventCenter, Current, window, eventSource, hooks, document as document$1, getPageScrollerOrNode, findChildNodeWithDFS, setNodeEventCallbackAndTriggerComponentUpdate, AREA_CHANGE_EVENT_NAME, disconnectEvent, VISIBLE_CHANGE_EVENT_NAME, Events, History, getCurrentInstance } from '@tarojs/runtime';
4
4
  import '@ohos.abilityAccessCtrl';
5
- import { eventCenter, Events, History } from '@tarojs/runtime/dist/runtime.esm';
6
5
  import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
7
6
  import deviceInfo from '@ohos.deviceInfo';
8
7
  import i18n from '@ohos.i18n';