@tarojs/runtime 4.0.8-beta.0 → 4.0.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.
package/dist/index.d.ts CHANGED
@@ -29,6 +29,6 @@ export { nextTick } from "./next-tick.js";
29
29
  export { options } from "./options.js";
30
30
  export * from "./perf.js";
31
31
  export * from "./utils/index.js";
32
- export * from "./instance-4c64b022.js";
32
+ export * from "./instance-4007cff2.js";
33
33
  export * from "./index-26658829.js";
34
34
  export * from "./polyfill/index.js";
@@ -609,6 +609,7 @@ declare const FOCUS = "focus";
609
609
  declare const VIEW = "view";
610
610
  declare const STATIC_VIEW = "static-view";
611
611
  declare const PURE_VIEW = "pure-view";
612
+ declare const CLICK_VIEW = "click-view";
612
613
  declare const PROPS = "props";
613
614
  declare const DATASET = "dataset";
614
615
  declare const OBJECT = "object";
@@ -628,7 +629,6 @@ declare const SET_TIMEOUT = "setTimeout";
628
629
  declare const COMPILE_MODE = "compileMode";
629
630
  declare const CATCHMOVE = "catchMove";
630
631
  declare const CATCH_VIEW = "catch-view";
631
- declare const CLICK_VIEW = "click-view";
632
632
  declare const COMMENT = "comment";
633
633
  declare const ON_LOAD = "onLoad";
634
634
  declare const ON_READY = "onReady";
@@ -810,4 +810,4 @@ declare const getHomePage: (path?: string, basename?: string, customRoutes?: Rec
810
810
  declare const getCurrentPage: (routerMode?: string, basename?: string) => string;
811
811
  declare function handlePolyfill(): void;
812
812
  export { hooks } from '@tarojs/shared';
813
- export { taroDocumentProvider as document, taroGetComputedStyleProvider as getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, TaroURLProvider as URL, URLSearchParams, taroHistoryProvider as history, taroLocationProvider as location, taroWindowProvider as window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, CLICK_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, perf, incrementId, isElement, isText, isComment, isHasExtractProp, isParentBinded, shortcutAttr, customWrapperCache, extend, getComponentsAlias, convertNumber2PX, throttle, debounce, addLeadingSlash, hasBasename, stripBasename, stripTrailing, stripSuffix, getHomePage, getCurrentPage, Instance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniTextData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$1 as Options, TFunc, PageConfig, handlePolyfill };
813
+ export { taroDocumentProvider as document, taroGetComputedStyleProvider as getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, TaroURLProvider as URL, URLSearchParams, taroHistoryProvider as history, taroLocationProvider as location, taroWindowProvider as window, TaroElement, createEvent, eventHandler, TaroEvent, FormElement, TaroNode, TaroRootElement, Style, SVGElement, TaroText, MutationObserver, env, PROPERTY_THRESHOLD, TARO_RUNTIME, HOOKS_APP_ID, SET_DATA, PAGE_INIT, ROOT_STR, HTML, HEAD, BODY, APP, CONTAINER, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, ID, UID, CLASS, STYLE, FOCUS, VIEW, STATIC_VIEW, PURE_VIEW, CLICK_VIEW, PROPS, DATASET, OBJECT, VALUE, INPUT, CHANGE, CUSTOM_WRAPPER, TARGET, CURRENT_TARGET, TYPE, CONFIRM, TIME_STAMP, KEY_CODE, TOUCHMOVE, DATE, SET_TIMEOUT, COMPILE_MODE, CATCHMOVE, CATCH_VIEW, COMMENT, ON_LOAD, ON_READY, ON_SHOW, ON_HIDE, OPTIONS, EXTERNAL_CLASSES, EVENT_CALLBACK_RESULT, BEHAVIORS, A, CONTEXT_ACTIONS, Current, getCurrentInstance, eventSource, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, perf, incrementId, isElement, isText, isComment, isHasExtractProp, isParentBinded, shortcutAttr, customWrapperCache, extend, getComponentsAlias, convertNumber2PX, throttle, debounce, addLeadingSlash, hasBasename, stripBasename, stripTrailing, stripSuffix, getHomePage, getCurrentPage, Instance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniTextData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$1 as Options, TFunc, PageConfig, handlePolyfill };
@@ -23,6 +23,7 @@ const FOCUS = 'focus';
23
23
  const VIEW = 'view';
24
24
  const STATIC_VIEW = 'static-view';
25
25
  const PURE_VIEW = 'pure-view';
26
+ const CLICK_VIEW = 'click-view';
26
27
  const PROPS = 'props';
27
28
  const DATASET = 'dataset';
28
29
  const OBJECT = 'object';
@@ -42,7 +43,6 @@ const SET_TIMEOUT = 'setTimeout';
42
43
  const COMPILE_MODE = 'compileMode';
43
44
  const CATCHMOVE = 'catchMove';
44
45
  const CATCH_VIEW = 'catch-view';
45
- const CLICK_VIEW = 'click-view';
46
46
  const COMMENT = 'comment';
47
47
  const ON_LOAD = 'onLoad';
48
48
  const ON_READY = 'onReady';
@@ -1335,14 +1335,16 @@ function hydrate(node) {
1335
1335
  if (node.uid !== node.sid) {
1336
1336
  data.uid = node.uid;
1337
1337
  }
1338
- if (!node.isAnyEventBinded() && SPECIAL_NODES.indexOf(nodeName) > -1) {
1339
- data["nn" /* Shortcuts.NodeName */] = `static-${nodeName}`;
1340
- if (nodeName === VIEW && !isHasExtractProp(node)) {
1341
- data["nn" /* Shortcuts.NodeName */] = PURE_VIEW;
1338
+ if (SPECIAL_NODES.indexOf(nodeName) > -1) {
1339
+ if (!node.isAnyEventBinded()) {
1340
+ data["nn" /* Shortcuts.NodeName */] = `static-${nodeName}`;
1341
+ if (nodeName === VIEW && !isHasExtractProp(node)) {
1342
+ data["nn" /* Shortcuts.NodeName */] = PURE_VIEW;
1343
+ }
1344
+ }
1345
+ if (nodeName === VIEW && node.isOnlyClickBinded()) {
1346
+ data["nn" /* Shortcuts.NodeName */] = CLICK_VIEW;
1342
1347
  }
1343
- }
1344
- if (nodeName === VIEW && node.isOnlyClickBinded()) {
1345
- data["nn" /* Shortcuts.NodeName */] = CLICK_VIEW;
1346
1348
  }
1347
1349
  const { props } = node;
1348
1350
  for (const prop in props) {
@@ -2256,6 +2258,7 @@ class TaroElement extends TaroNode {
2256
2258
  const componentsAlias = getComponentsAlias();
2257
2259
  const _alias = componentsAlias[this.nodeName];
2258
2260
  const viewAlias = componentsAlias[VIEW]._num;
2261
+ const clickViewAlias = componentsAlias[CLICK_VIEW]._num;
2259
2262
  const staticViewAlias = componentsAlias[STATIC_VIEW]._num;
2260
2263
  const catchViewAlias = componentsAlias[CATCH_VIEW]._num;
2261
2264
  const _path = this._path;
@@ -2274,10 +2277,10 @@ class TaroElement extends TaroNode {
2274
2277
  if (this.nodeName === VIEW) {
2275
2278
  if (qualifiedNameInCamelCase === CATCHMOVE) {
2276
2279
  // catchMove = true: catch-view
2277
- // catchMove = false: view or static-view
2280
+ // catchMove = false: view or click-view or static-view
2278
2281
  this.enqueueUpdate({
2279
2282
  path: `${_path}.${"nn" /* Shortcuts.NodeName */}`,
2280
- value: value ? catchViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias)
2283
+ value: value ? catchViewAlias : (this.isOnlyClickBinded() ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias))
2281
2284
  });
2282
2285
  }
2283
2286
  else if (isPureView && isHasExtractProp(this)) {
@@ -2318,6 +2321,7 @@ class TaroElement extends TaroNode {
2318
2321
  const viewAlias = componentsAlias[VIEW]._num;
2319
2322
  const staticViewAlias = componentsAlias[STATIC_VIEW]._num;
2320
2323
  const pureViewAlias = componentsAlias[PURE_VIEW]._num;
2324
+ const clickViewAlias = componentsAlias[CLICK_VIEW]._num;
2321
2325
  const _path = this._path;
2322
2326
  qualifiedName = shortcutAttr(qualifiedName);
2323
2327
  const qualifiedNameInCamelCase = toCamelCase(qualifiedName);
@@ -2333,10 +2337,10 @@ class TaroElement extends TaroNode {
2333
2337
  this.enqueueUpdate(payload);
2334
2338
  if (this.nodeName === VIEW) {
2335
2339
  if (qualifiedNameInCamelCase === CATCHMOVE) {
2336
- // catch-view => view or static-view or pure-view
2340
+ // catch-view => view or click-view or static-view or pure-view
2337
2341
  this.enqueueUpdate({
2338
2342
  path: `${_path}.${"nn" /* Shortcuts.NodeName */}`,
2339
- value: this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias)
2343
+ value: this.isOnlyClickBinded() ? clickViewAlias : (this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias))
2340
2344
  });
2341
2345
  }
2342
2346
  else if (isStaticView && !isHasExtractProp(this)) {
@@ -3629,18 +3633,8 @@ class TaroRootElement extends TaroElement {
3629
3633
  return this;
3630
3634
  }
3631
3635
  scheduleTask(fn) {
3632
- if (isFunction(Promise)) {
3633
- Promise.resolve()
3634
- .then(fn)
3635
- .catch((error) => {
3636
- setTimeout(() => {
3637
- throw error;
3638
- });
3639
- });
3640
- }
3641
- else {
3642
- setTimeout(fn);
3643
- }
3636
+ // 这里若使用微任务可略微提前setData的执行时机,但在部分场景下可能会出现连续setData两次,造成更大的性能问题
3637
+ setTimeout(fn);
3644
3638
  }
3645
3639
  enqueueUpdate(payload) {
3646
3640
  this.updatePayloads.push(payload);
@@ -4269,7 +4263,6 @@ function createRecursiveComponentConfig(componentName) {
4269
4263
  value: ''
4270
4264
  }
4271
4265
  }, options: {
4272
- addGlobalClass: true,
4273
4266
  virtualHost: !isCustomWrapper
4274
4267
  }, methods: {
4275
4268
  eh: eventHandler