@tarojs/runtime 3.6.18 → 3.6.19

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.
@@ -0,0 +1,7 @@
1
+ import { TaroElement } from './element';
2
+ export declare class TransferElement extends TaroElement {
3
+ dataName: string;
4
+ isTransferElement: boolean;
5
+ constructor(dataName: string);
6
+ get _path(): string;
7
+ }
package/dist/index.d.ts CHANGED
@@ -28,6 +28,6 @@ export * from './emitter/emitter';
28
28
  export { hydrate } from './hydrate';
29
29
  export { nextTick } from './next-tick';
30
30
  export { options } from './options';
31
- export { incrementId } from './utils';
31
+ export { incrementId, isHasExtractProp } from './utils';
32
32
  export * from './dsl/instance';
33
33
  export * from './interface';
@@ -776,5 +776,6 @@ declare function hydrate(node: TaroElement | TaroText): MiniData;
776
776
  declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
777
777
  declare const options: Options;
778
778
  declare const incrementId: () => () => string;
779
+ declare function isHasExtractProp(el: TaroElement): boolean;
779
780
  export { hooks } from '@tarojs/shared';
780
- export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, 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, 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, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$0 as Options, Func, Ctx };
781
+ export { document, getComputedStyle, History, Location, nav as navigator, _caf as cancelAnimationFrame, now, _raf as requestAnimationFrame, parseUrl, URL, URLSearchParams, history, location, 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, 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, addLeadingSlash, createComponentConfig, createPageConfig, createRecursiveComponentConfig, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, injectPageInstance, removePageInstance, safeExecute, stringify, EventsType, eventCenter, Events, hydrate, nextTick, options, incrementId, isHasExtractProp, Instance, VueAppInstance, VueInstance, PageProps, ReactPageComponent, ReactPageInstance, ReactAppInstance, PageLifeCycle, PageInstance, AppInstance, Attributes, EventOptions, MpEvent, EventListenerOptions, AddEventListenerOptions, EventHandler, MpInstance, MiniElementData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$0 as Options, Func, Ctx };
@@ -174,7 +174,7 @@ class MutationObserver {
174
174
  }
175
175
  else {
176
176
  if (process.env.NODE_ENV !== 'production') {
177
- console.warn('[Taro Warning] 若要使用 MutationObserver,请在 Taro 编译配置中设置 \'mini.enableMutationObserver: true\'');
177
+ console.warn('[Taro Warning] 若要使用 MutationObserver,请在 Taro 编译配置中设置 \'mini.runtime.enableMutationObserver: true\'');
178
178
  }
179
179
  this.core = {
180
180
  observe: noop,
@@ -467,7 +467,7 @@ function hydrate(node) {
467
467
  if (cssText !== '' && nodeName !== 'swiper-item') {
468
468
  data["st" /* Shortcuts.Style */] = cssText;
469
469
  }
470
- hooks.call('modifyHydrateData', data);
470
+ hooks.call('modifyHydrateData', data, node);
471
471
  const nn = data["nn" /* Shortcuts.NodeName */];
472
472
  const componentAlias = componentsAlias[nn];
473
473
  if (componentAlias) {
@@ -479,7 +479,8 @@ function hydrate(node) {
479
479
  }
480
480
  }
481
481
  }
482
- return data;
482
+ const resData = hooks.call('transferHydrateData', data, node, componentAlias);
483
+ return resData || data;
483
484
  }
484
485
 
485
486
  class TaroEventTarget {
@@ -1490,6 +1491,7 @@ class TaroElement extends TaroNode {
1490
1491
  sideEffect = false;
1491
1492
  delete options.sideEffect;
1492
1493
  }
1494
+ hooks.call('modifyAddEventListener', this, sideEffect, getComponentsAlias);
1493
1495
  if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {
1494
1496
  const componentsAlias = getComponentsAlias();
1495
1497
  const alias = componentsAlias[name]._num;
@@ -1504,6 +1506,7 @@ class TaroElement extends TaroNode {
1504
1506
  super.removeEventListener(type, handler);
1505
1507
  const name = this.nodeName;
1506
1508
  const SPECIAL_NODES = hooks.call('getSpecialNodes');
1509
+ hooks.call('modifyRemoveEventListener', this, sideEffect, getComponentsAlias);
1507
1510
  if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {
1508
1511
  const componentsAlias = getComponentsAlias();
1509
1512
  const value = isHasExtractProp(this) ? `static-${name}` : `pure-${name}`;
@@ -3245,6 +3248,17 @@ class AnchorElement extends TaroElement {
3245
3248
  }
3246
3249
  }
3247
3250
 
3251
+ class TransferElement extends TaroElement {
3252
+ constructor(dataName) {
3253
+ super();
3254
+ this.dataName = dataName;
3255
+ this.isTransferElement = true;
3256
+ }
3257
+ get _path() {
3258
+ return this.dataName;
3259
+ }
3260
+ }
3261
+
3248
3262
  class TaroDocument extends TaroElement {
3249
3263
  constructor() {
3250
3264
  super();
@@ -3265,6 +3279,10 @@ class TaroDocument extends TaroElement {
3265
3279
  case nodeName === A:
3266
3280
  element = new AnchorElement();
3267
3281
  break;
3282
+ case nodeName === 'page-meta':
3283
+ case nodeName === 'navigation-bar':
3284
+ element = new TransferElement(toCamelCase(nodeName));
3285
+ break;
3268
3286
  default:
3269
3287
  element = new TaroElement();
3270
3288
  break;
@@ -4231,5 +4249,5 @@ const nextTick = (cb, ctx) => {
4231
4249
  next();
4232
4250
  };
4233
4251
 
4234
- export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, COMMENT, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, Current, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, FormElement, HEAD, HOOKS_APP_ID, HTML, History, ID, INPUT, KEY_CODE, Location, MutationObserver, OBJECT, ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, OPTIONS, PAGE_INIT, PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR, SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE, SVGElement, Style, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, UID, URL, URLSearchParams, VALUE, VIEW, addLeadingSlash, _caf as cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document$1 as document, env, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, history, hydrate, incrementId, injectPageInstance, location, nav as navigator, nextTick, now, options, parseUrl, removePageInstance, _raf as requestAnimationFrame, safeExecute, stringify, window$1 as window };
4252
+ export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, COMMENT, CONFIRM, CONTAINER, CONTEXT_ACTIONS, CURRENT_TARGET, CUSTOM_WRAPPER, Current, DATASET, DATE, DOCUMENT_ELEMENT_NAME, DOCUMENT_FRAGMENT, EVENT_CALLBACK_RESULT, EXTERNAL_CLASSES, FOCUS, FormElement, HEAD, HOOKS_APP_ID, HTML, History, ID, INPUT, KEY_CODE, Location, MutationObserver, OBJECT, ON_HIDE, ON_LOAD, ON_READY, ON_SHOW, OPTIONS, PAGE_INIT, PROPERTY_THRESHOLD, PROPS, PURE_VIEW, ROOT_STR, SET_DATA, SET_TIMEOUT, STATIC_VIEW, STYLE, SVGElement, Style, TARGET, TARO_RUNTIME, TIME_STAMP, TOUCHMOVE, TYPE, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, UID, URL, URLSearchParams, VALUE, VIEW, addLeadingSlash, _caf as cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document$1 as document, env, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, history, hydrate, incrementId, injectPageInstance, isHasExtractProp, location, nav as navigator, nextTick, now, options, parseUrl, removePageInstance, _raf as requestAnimationFrame, safeExecute, stringify, window$1 as window };
4235
4253
  //# sourceMappingURL=runtime.esm.js.map