@tarojs/runtime 4.0.7 → 4.0.8-alpha.0

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.
package/dist/index.cjs.js CHANGED
@@ -24,6 +24,7 @@ const FOCUS = 'focus';
24
24
  const VIEW = 'view';
25
25
  const STATIC_VIEW = 'static-view';
26
26
  const PURE_VIEW = 'pure-view';
27
+ const CLICK_VIEW = 'click-view';
27
28
  const PROPS = 'props';
28
29
  const DATASET = 'dataset';
29
30
  const OBJECT = 'object';
@@ -43,7 +44,6 @@ const SET_TIMEOUT = 'setTimeout';
43
44
  const COMPILE_MODE = 'compileMode';
44
45
  const CATCHMOVE = 'catchMove';
45
46
  const CATCH_VIEW = 'catch-view';
46
- const CLICK_VIEW = 'click-view';
47
47
  const COMMENT = 'comment';
48
48
  const ON_LOAD = 'onLoad';
49
49
  const ON_READY = 'onReady';
@@ -1336,14 +1336,16 @@ function hydrate(node) {
1336
1336
  if (node.uid !== node.sid) {
1337
1337
  data.uid = node.uid;
1338
1338
  }
1339
- if (!node.isAnyEventBinded() && SPECIAL_NODES.indexOf(nodeName) > -1) {
1340
- data["nn" /* Shortcuts.NodeName */] = `static-${nodeName}`;
1341
- if (nodeName === VIEW && !isHasExtractProp(node)) {
1342
- data["nn" /* Shortcuts.NodeName */] = PURE_VIEW;
1339
+ if (SPECIAL_NODES.indexOf(nodeName) > -1) {
1340
+ if (!node.isAnyEventBinded()) {
1341
+ data["nn" /* Shortcuts.NodeName */] = `static-${nodeName}`;
1342
+ if (nodeName === VIEW && !isHasExtractProp(node)) {
1343
+ data["nn" /* Shortcuts.NodeName */] = PURE_VIEW;
1344
+ }
1345
+ }
1346
+ if (nodeName === VIEW && node.isOnlyClickBinded()) {
1347
+ data["nn" /* Shortcuts.NodeName */] = CLICK_VIEW;
1343
1348
  }
1344
- }
1345
- if (nodeName === VIEW && node.isOnlyClickBinded()) {
1346
- data["nn" /* Shortcuts.NodeName */] = CLICK_VIEW;
1347
1349
  }
1348
1350
  const { props } = node;
1349
1351
  for (const prop in props) {
@@ -2257,6 +2259,7 @@ class TaroElement extends TaroNode {
2257
2259
  const componentsAlias = getComponentsAlias();
2258
2260
  const _alias = componentsAlias[this.nodeName];
2259
2261
  const viewAlias = componentsAlias[VIEW]._num;
2262
+ const clickViewAlias = componentsAlias[CLICK_VIEW]._num;
2260
2263
  const staticViewAlias = componentsAlias[STATIC_VIEW]._num;
2261
2264
  const catchViewAlias = componentsAlias[CATCH_VIEW]._num;
2262
2265
  const _path = this._path;
@@ -2275,10 +2278,10 @@ class TaroElement extends TaroNode {
2275
2278
  if (this.nodeName === VIEW) {
2276
2279
  if (qualifiedNameInCamelCase === CATCHMOVE) {
2277
2280
  // catchMove = true: catch-view
2278
- // catchMove = false: view or static-view
2281
+ // catchMove = false: view or click-view or static-view
2279
2282
  this.enqueueUpdate({
2280
2283
  path: `${_path}.${"nn" /* Shortcuts.NodeName */}`,
2281
- value: value ? catchViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias)
2284
+ value: value ? catchViewAlias : (this.isOnlyClickBinded() ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias))
2282
2285
  });
2283
2286
  }
2284
2287
  else if (isPureView && isHasExtractProp(this)) {
@@ -2319,6 +2322,7 @@ class TaroElement extends TaroNode {
2319
2322
  const viewAlias = componentsAlias[VIEW]._num;
2320
2323
  const staticViewAlias = componentsAlias[STATIC_VIEW]._num;
2321
2324
  const pureViewAlias = componentsAlias[PURE_VIEW]._num;
2325
+ const clickViewAlias = componentsAlias[CLICK_VIEW]._num;
2322
2326
  const _path = this._path;
2323
2327
  qualifiedName = shortcutAttr(qualifiedName);
2324
2328
  const qualifiedNameInCamelCase = shared.toCamelCase(qualifiedName);
@@ -2334,10 +2338,10 @@ class TaroElement extends TaroNode {
2334
2338
  this.enqueueUpdate(payload);
2335
2339
  if (this.nodeName === VIEW) {
2336
2340
  if (qualifiedNameInCamelCase === CATCHMOVE) {
2337
- // catch-view => view or static-view or pure-view
2341
+ // catch-view => view or click-view or static-view or pure-view
2338
2342
  this.enqueueUpdate({
2339
2343
  path: `${_path}.${"nn" /* Shortcuts.NodeName */}`,
2340
- value: this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias)
2344
+ value: this.isOnlyClickBinded() ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias))
2341
2345
  });
2342
2346
  }
2343
2347
  else if (isStaticView && !isHasExtractProp(this)) {
@@ -3630,18 +3634,8 @@ class TaroRootElement extends TaroElement {
3630
3634
  return this;
3631
3635
  }
3632
3636
  scheduleTask(fn) {
3633
- if (shared.isFunction(Promise)) {
3634
- Promise.resolve()
3635
- .then(fn)
3636
- .catch((error) => {
3637
- setTimeout(() => {
3638
- throw error;
3639
- });
3640
- });
3641
- }
3642
- else {
3643
- setTimeout(fn);
3644
- }
3637
+ // 这里若使用微任务可略微提前setData的执行时机,但在部分场景下可能会出现连续setData两次,造成更大的性能问题
3638
+ setTimeout(fn);
3645
3639
  }
3646
3640
  enqueueUpdate(payload) {
3647
3641
  this.updatePayloads.push(payload);
@@ -4270,7 +4264,6 @@ function createRecursiveComponentConfig(componentName) {
4270
4264
  value: ''
4271
4265
  }
4272
4266
  }, options: {
4273
- addGlobalClass: true,
4274
4267
  virtualHost: !isCustomWrapper
4275
4268
  }, methods: {
4276
4269
  eh: eventHandler