@tarojs/plugin-platform-harmony-ets 4.0.0-beta.19 → 4.0.0-beta.20

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 (46) hide show
  1. package/dist/apis/wxml/IntersectionObserver.ts +5 -3
  2. package/dist/components-harmony-ets/button.ets +3 -2
  3. package/dist/components-harmony-ets/checkbox.ets +6 -3
  4. package/dist/components-harmony-ets/form.ets +5 -4
  5. package/dist/components-harmony-ets/icon.ets +8 -4
  6. package/dist/components-harmony-ets/image.ets +2 -0
  7. package/dist/components-harmony-ets/innerHtml.ets +5 -4
  8. package/dist/components-harmony-ets/input.ets +6 -4
  9. package/dist/components-harmony-ets/label.ets +5 -4
  10. package/dist/components-harmony-ets/movableArea.ets +8 -31
  11. package/dist/components-harmony-ets/movableView.ets +8 -31
  12. package/dist/components-harmony-ets/picker.ets +21 -16
  13. package/dist/components-harmony-ets/progress.ets +2 -0
  14. package/dist/components-harmony-ets/pseudo.ets +38 -31
  15. package/dist/components-harmony-ets/radio.ets +6 -3
  16. package/dist/components-harmony-ets/richText.ets +3 -1
  17. package/dist/components-harmony-ets/scrollView.ets +15 -36
  18. package/dist/components-harmony-ets/slider.ets +4 -2
  19. package/dist/components-harmony-ets/style.ets +62 -27
  20. package/dist/components-harmony-ets/swiper.ets +3 -2
  21. package/dist/components-harmony-ets/switch.ets +3 -1
  22. package/dist/components-harmony-ets/text.ets +10 -8
  23. package/dist/components-harmony-ets/textArea.ets +6 -4
  24. package/dist/components-harmony-ets/utils/helper.ets +3 -2
  25. package/dist/components-harmony-ets/utils/styles.ets +25 -93
  26. package/dist/components-harmony-ets/video.ets +2 -0
  27. package/dist/components-harmony-ets/view.ets +11 -32
  28. package/dist/components-harmony-ets/webView.ets +3 -1
  29. package/dist/index.d.ts +2 -0
  30. package/dist/index.js +10 -10
  31. package/dist/index.js.map +1 -1
  32. package/dist/runtime-ets/dom/cssNesting.ts +36 -10
  33. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +15 -40
  34. package/dist/runtime-ets/dom/document.ts +0 -3
  35. package/dist/runtime-ets/dom/element/element.ts +6 -5
  36. package/dist/runtime-ets/dom/stylesheet/covertWeb2Hm.ts +152 -217
  37. package/dist/runtime-ets/dom/stylesheet/index.ts +17 -315
  38. package/dist/runtime-ets/dom/stylesheet/type.ts +6 -2
  39. package/dist/runtime-ets/index.ts +1 -1
  40. package/dist/runtime-ets/utils/index.ts +24 -8
  41. package/dist/runtime-framework/react/native-page.ts +6 -4
  42. package/dist/runtime-utils.js +4 -3
  43. package/dist/runtime-utils.js.map +1 -1
  44. package/dist/runtime.js +4 -3
  45. package/dist/runtime.js.map +1 -1
  46. package/package.json +8 -8
@@ -45,21 +45,37 @@ export function convertNumber2VP (value: number, unit = 'px') {
45
45
  return pxTransformHelper(value, 'vp')
46
46
  }
47
47
 
48
- export function calcDynamicStyle (styleSheet: Record<string, CSSProperties>, classNames: string, style: CSSProperties): CSSProperties {
48
+ // 合并静态样式,从样式表里面找到对应的样式
49
+ export function calcStaticStyle (styleSheet: Record<string, CSSProperties>, classNames: string, style: CSSProperties): CSSProperties {
49
50
  const obj: CSSProperties[] = []
50
51
  const classes = typeof classNames === 'string' ? classNames.split(' ') : []
51
- for (let i = 0; i < classes.length; i++) {
52
- const className = classes[i]
53
- if (styleSheet[className]) {
54
- obj.push(styleSheet[className])
52
+ if (classes.length === 1) {
53
+ if (style) {
54
+ return Object.assign({}, styleSheet[classNames], style)
55
+ } else {
56
+ // 同一个引用
57
+ return styleSheet[classNames]
55
58
  }
59
+ } else {
60
+ for (let i = 0; i < classes.length; i++) {
61
+ const className = classes[i]
62
+ if (styleSheet[className]) {
63
+ obj.push(styleSheet[className])
64
+ }
65
+ }
66
+ if (style) {
67
+ obj.push(style)
68
+ }
69
+ return Object.assign.apply(null, [{}].concat(obj))
56
70
  }
71
+ }
57
72
 
73
+ // 动态样式计算,需要经过web2harmony进行反转
74
+ export function calcDynamicStyle (style: CSSProperties): CSSProperties {
58
75
  if (style) {
59
- obj.push(convertWebStyle2HmStyle(style))
76
+ return convertWebStyle2HmStyle(style)
60
77
  }
61
-
62
- return Object.assign.apply(null, [{}].concat(obj))
78
+ return {}
63
79
  }
64
80
 
65
81
  export function getPageScrollerOrNode (scrollerOrNode: any, page: any) {
@@ -257,7 +257,7 @@ export function createNativePageConfig (Component, pageName: string, react: type
257
257
  window.trigger(CONTEXT_ACTIONS.DESTORY, $taroPath)
258
258
  // 触发onUnload生命周期
259
259
  safeExecute($taroPath, ONUNLOAD)
260
- resetCurrent()
260
+ resetCurrent.call(this)
261
261
  unmounting = true
262
262
  Current.app!.unmount!($taroPath, () => {
263
263
  unmounting = false
@@ -310,9 +310,11 @@ export function createNativePageConfig (Component, pageName: string, react: type
310
310
  }
311
311
 
312
312
  function resetCurrent () {
313
- // 小程序插件页面卸载之后返回到宿主页面时,需重置Current页面和路由。否则引发插件组件二次加载异常 fix:#11991
314
- Current.page = null
315
- Current.router = null
313
+ if (Current.page === this) {
314
+ // 小程序插件页面卸载之后返回到宿主页面时,需重置Current页面和路由。否则引发插件组件二次加载异常 fix:#11991
315
+ Current.page = null
316
+ Current.router = null
317
+ }
316
318
  }
317
319
 
318
320
  LIFECYCLES.forEach((lifecycle) => {
@@ -3999,13 +3999,12 @@ class IntersectionObserver {
3999
3999
  };
4000
4000
  const taro = Current.taro;
4001
4001
  const page = taro.getCurrentInstance().page;
4002
- const currentPage = getPageScrollerOrNode(page.node, page);
4003
- this._component = component || currentPage;
4002
+ this._component = component || getPageScrollerOrNode(page === null || page === void 0 ? void 0 : page.node, page);
4004
4003
  Object.assign(this._options, options);
4005
4004
  }
4006
4005
  disconnect() {
4007
4006
  var _a;
4008
- if (this._observerNodes) {
4007
+ if (this._observerNodes && this._component) {
4009
4008
  if (this._observerNodes instanceof Array) {
4010
4009
  this._observerNodes.forEach((n) => {
4011
4010
  var _a;
@@ -4026,6 +4025,8 @@ class IntersectionObserver {
4026
4025
  }
4027
4026
  observe(targetSelector, callback) {
4028
4027
  var _a;
4028
+ if (!this._component)
4029
+ return;
4029
4030
  const { observeAll, thresholds } = this._options;
4030
4031
  const node = findChildNodeWithDFS(this._component, targetSelector, observeAll);
4031
4032
  this._observerNodes = node;