@tarojs/plugin-platform-harmony-ets 4.0.0-beta.32 → 4.0.0-beta.34

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.
@@ -194,22 +194,31 @@ function queryBat (queue, cb) {
194
194
 
195
195
  arr = []
196
196
  traversalDFSDom(element)
197
- queue.forEach(item => {
197
+ queue.forEach((item) => {
198
198
  const { selector, single, fields } = item
199
- const nodeList = querySelector(selector, !single)
200
-
201
- result.push(nodeList.map(dom => {
199
+
200
+ if (single) {
201
+ const dom = querySelector(selector, !single)[0]
202
202
  // eslint-disable-next-line no-async-promise-executor
203
- return new Promise(async resolve => {
203
+ result.push(new Promise(async resolve => {
204
204
  await setNodeEventCallbackAndTriggerComponentUpdate(dom, AREA_CHANGE_EVENT_NAME, null, true)
205
-
206
205
  resolve(filter(fields, dom))
207
- })
208
- }))
206
+ }))
207
+ } else {
208
+ const nodeList = querySelector(selector, !single)
209
+ result.push(nodeList.map(dom => {
210
+ // eslint-disable-next-line no-async-promise-executor
211
+ return new Promise(async resolve => {
212
+ await setNodeEventCallbackAndTriggerComponentUpdate(dom, AREA_CHANGE_EVENT_NAME, null, true)
213
+
214
+ resolve(filter(fields, dom))
215
+ })
216
+ }))
217
+ }
209
218
  })
210
219
 
211
220
  Promise.all(result.map(item => {
212
- return Promise.all(item)
221
+ return item instanceof Array ? Promise.all(item) : item
213
222
  })).then(data => {
214
223
  cb(data)
215
224
  })
@@ -65,13 +65,13 @@ function getThemeAttributes (node: TaroButtonElement): TaroStyleType {
65
65
  }
66
66
  }
67
67
 
68
- function getButtonWidth (node: TaroButtonElement) {
68
+ function getButtonWidth (node: TaroButtonElement): string | number {
69
69
  const isMini = node._attrs.size === 'mini'
70
70
 
71
71
  return isMini ? convertNumber2VP(120) : '100%'
72
72
  }
73
73
 
74
- function getButtonHeight (node: TaroButtonElement) {
74
+ function getButtonHeight (node: TaroButtonElement): string | number {
75
75
  const isMini = node._attrs.size === 'mini'
76
76
 
77
77
  return isMini ? convertNumber2VP(60) : convertNumber2VP(92)
@@ -23,6 +23,27 @@ import TaroMovableView from './movableView'
23
23
  import { TaroRadio, TaroRadioGroup } from './radio'
24
24
  import { TaroCheckboxGroup, TaroCheckbox } from './checkbox'
25
25
 
26
+ import commonStyleModify from './style'
27
+ import { getButtonColor } from './button'
28
+ import { FlexManager } from './utils/flexManager'
29
+ import { DynamicCenter } from './utils/DynamicCenter'
30
+ import { TOUCH_EVENT_MAP } from './utils/constant/event'
31
+ import { BUTTON_THEME_COLOR } from './utils/constant/style'
32
+ import { shouldBindEvent, getNodeThresholds, getNormalAttributes, getFontAttributes } from './utils/helper'
33
+
34
+ export {
35
+ FlexManager,
36
+ DynamicCenter,
37
+ getButtonColor,
38
+ TOUCH_EVENT_MAP,
39
+ shouldBindEvent,
40
+ getFontAttributes,
41
+ commonStyleModify,
42
+ getNodeThresholds,
43
+ BUTTON_THEME_COLOR,
44
+ getNormalAttributes,
45
+ }
46
+
26
47
  export {
27
48
  TaroImage,
28
49
  TaroCanvas,
@@ -168,7 +168,11 @@ function setNormalAttributeIntoInstance(instance: CommonAttribute, style: TaroSt
168
168
  instance.backgroundColor(style.backgroundColor)
169
169
  }
170
170
  if (!isUndefined(style.backgroundImage)) {
171
- if (style.backgroundImage.colors) {
171
+ if (style.backgroundImage.center) {
172
+ // radialGradient
173
+ instance.radialGradient(style.backgroundImage)
174
+ } else if (style.backgroundImage.colors) {
175
+ // linearGradient
172
176
  instance.linearGradient(style.backgroundImage)
173
177
  } else {
174
178
  instance.backgroundImage(style.backgroundImage?.src, style.backgroundRepeat)
@@ -220,9 +224,6 @@ function setNormalAttributeIntoInstance(instance: CommonAttribute, style: TaroSt
220
224
  bottomRight: style.borderBottomRightRadius
221
225
  })
222
226
  }
223
- if (!isUndefined(style.zIndex)) {
224
- instance.zIndex(style.zIndex)
225
- }
226
227
  if (!isUndefined(style.opacity)) {
227
228
  instance.opacity(style.opacity)
228
229
  }
@@ -267,12 +268,20 @@ function setNormalAttributeIntoInstance(instance: CommonAttribute, style: TaroSt
267
268
  x: style.left || 0,
268
269
  y: style.top || 0,
269
270
  })
271
+ // 绝对定位和固定定位在web上都会脱离文档流,因此需要设置zIndex让它相比正常流的元素更上层
272
+ instance.zIndex(1)
270
273
  }
271
274
  if (style.position === 'relative') {
272
275
  instance.offset({
273
276
  x: style.left || 0,
274
277
  y: style.top || 0,
275
278
  })
279
+ // 绝对定位和固定定位在web上都会脱离文档流,因此需要设置zIndex让它相比正常流的元素更上层
280
+ instance.zIndex(1)
281
+ }
282
+ if (!isUndefined(style.zIndex)) {
283
+ // 为了适应position不设置z-index也能高于同层级组件,估且让设置了z-index的会更高一级
284
+ instance.zIndex(style.zIndex + 1)
276
285
  }
277
286
  }
278
287
 
@@ -34,7 +34,7 @@ function textSpecialFontStyle(attr: TaroTextStyleType) {
34
34
  .lineHeight(attr.lineHeight)
35
35
  }
36
36
 
37
- function getButtonFontSize (node: TaroButtonElement) {
37
+ function getButtonFontSize (node: TaroButtonElement): string | number {
38
38
  const isMini = node._attrs.size === 'mini'
39
39
 
40
40
  return isMini ? convertNumber2VP(26) : convertNumber2VP(36)
package/dist/index.d.ts CHANGED
@@ -49,6 +49,7 @@ declare class Harmony extends TaroPlatformHarmony {
49
49
  useJSON5: boolean;
50
50
  runtimePath: string[] | string;
51
51
  taroComponentsPath: string;
52
+ apiEntryList: RegExp[];
52
53
  constructor(ctx: IPluginContext, config: TConfig);
53
54
  get framework(): "solid" | "vue3" | "react" | "preact" | "nerv" | "vue";
54
55
  get aliasFramework(): string;
package/dist/index.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var helper = require('@tarojs/helper');
6
6
  var path = require('node:path');
7
- var runnerUtils = require('@tarojs/runner-utils');
8
7
  var service = require('@tarojs/service');
9
8
  var _package = require('@tarojs/service/dist/utils/package');
10
9
  var shared = require('@tarojs/shared');
@@ -303,6 +302,9 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
303
302
  this.useJSON5 = true;
304
303
  this.runtimePath = [];
305
304
  this.taroComponentsPath = `${PACKAGE_NAME}/dist/components-harmony-ets`;
305
+ this.apiEntryList = [
306
+ /(@tarojs[\\/]plugin-platform-harmony-ets|taro-platform-harmony)[\\/]dist[\\/]apis[\\/]index\.ts/,
307
+ ];
306
308
  _Harmony_defineConstants.set(this, {});
307
309
  this.extensions = ['.js', '.jsx', '.ts', '.tsx', '.cjs', '.mjs', '.mts', '.vue', '.ets', '.d.ts'];
308
310
  this.excludeLibraries = [];
@@ -339,9 +341,7 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
339
341
  return path__namespace.resolve(__dirname, './apis');
340
342
  }
341
343
  get apiEntry() {
342
- return [
343
- /(@tarojs[\\/]plugin-platform-harmony-ets|taro-platform-harmony)[\\/]dist[\\/]apis[\\/]index\.ts/,
344
- ];
344
+ return this.apiEntryList;
345
345
  }
346
346
  get componentLibrary() {
347
347
  return path__namespace.resolve(__dirname, './components-harmony-ets');
@@ -500,7 +500,9 @@ let Harmony$1 = class Harmony extends TaroPlatformHarmony {
500
500
  }
501
501
  return src;
502
502
  });
503
- const define = Object.assign({}, this.defineConstants);
503
+ const define = Object.assign(Object.assign({}, this.defineConstants), {
504
+ // Note: React 开发环境可能调用 stack 可能导致 appWrapper 实例变更
505
+ 'ReactDebugCurrentFrame.getCurrentStack': 'ReactDebugCurrentFrame.getCurrentStack$' });
504
506
  if ([/(@tarojs[\\/]runtime|taro-runtime)[\\/]dist/].some(e => e.test(lib))) {
505
507
  define.global = 'globalThis';
506
508
  }
@@ -637,12 +639,11 @@ declare global {
637
639
  }
638
640
  function injectLoaderMeta() {
639
641
  return {
640
- name: 'taro:vite-h5-loader-meta',
642
+ name: 'taro:vite-loader-meta',
641
643
  buildStart() {
642
644
  return __awaiter(this, void 0, void 0, function* () {
643
- yield this.load({ id: runnerUtils.VITE_COMPILER_LABEL });
644
- const info = this.getModuleInfo(runnerUtils.VITE_COMPILER_LABEL);
645
- const compiler = info === null || info === void 0 ? void 0 : info.meta.viteCompilerContext;
645
+ const { getViteHarmonyCompilerContext } = that.ctx.runnerUtils;
646
+ const compiler = getViteHarmonyCompilerContext(this);
646
647
  if (compiler) {
647
648
  switch (that.framework) {
648
649
  // @ts-ignore