@tarojs/runtime 3.6.17 → 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,
@@ -419,6 +419,7 @@ function hydrate(node) {
419
419
  const nodeName = node.nodeName;
420
420
  if (isText(node)) {
421
421
  return {
422
+ sid: node.sid,
422
423
  ["v" /* Shortcuts.Text */]: node.nodeValue,
423
424
  ["nn" /* Shortcuts.NodeName */]: ((_a = componentsAlias[nodeName]) === null || _a === void 0 ? void 0 : _a._num) || '8'
424
425
  };
@@ -466,7 +467,7 @@ function hydrate(node) {
466
467
  if (cssText !== '' && nodeName !== 'swiper-item') {
467
468
  data["st" /* Shortcuts.Style */] = cssText;
468
469
  }
469
- hooks.call('modifyHydrateData', data);
470
+ hooks.call('modifyHydrateData', data, node);
470
471
  const nn = data["nn" /* Shortcuts.NodeName */];
471
472
  const componentAlias = componentsAlias[nn];
472
473
  if (componentAlias) {
@@ -478,7 +479,8 @@ function hydrate(node) {
478
479
  }
479
480
  }
480
481
  }
481
- return data;
482
+ const resData = hooks.call('transferHydrateData', data, node, componentAlias);
483
+ return resData || data;
482
484
  }
483
485
 
484
486
  class TaroEventTarget {
@@ -1043,7 +1045,7 @@ function setStyle(newVal, styleKey) {
1043
1045
  if (old === newVal)
1044
1046
  return;
1045
1047
  !this._pending && recordCss(this);
1046
- if (isNull(newVal) || isUndefined(newVal)) {
1048
+ if (isNull(newVal) || isUndefined(newVal) || newVal === '') {
1047
1049
  this._usedStyleProp.delete(styleKey);
1048
1050
  delete this._value[styleKey];
1049
1051
  }
@@ -1489,6 +1491,7 @@ class TaroElement extends TaroNode {
1489
1491
  sideEffect = false;
1490
1492
  delete options.sideEffect;
1491
1493
  }
1494
+ hooks.call('modifyAddEventListener', this, sideEffect, getComponentsAlias);
1492
1495
  if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {
1493
1496
  const componentsAlias = getComponentsAlias();
1494
1497
  const alias = componentsAlias[name]._num;
@@ -1503,6 +1506,7 @@ class TaroElement extends TaroNode {
1503
1506
  super.removeEventListener(type, handler);
1504
1507
  const name = this.nodeName;
1505
1508
  const SPECIAL_NODES = hooks.call('getSpecialNodes');
1509
+ hooks.call('modifyRemoveEventListener', this, sideEffect, getComponentsAlias);
1506
1510
  if (sideEffect !== false && !this.isAnyEventBinded() && SPECIAL_NODES.indexOf(name) > -1) {
1507
1511
  const componentsAlias = getComponentsAlias();
1508
1512
  const value = isHasExtractProp(this) ? `static-${name}` : `pure-${name}`;
@@ -3244,6 +3248,17 @@ class AnchorElement extends TaroElement {
3244
3248
  }
3245
3249
  }
3246
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
+
3247
3262
  class TaroDocument extends TaroElement {
3248
3263
  constructor() {
3249
3264
  super();
@@ -3264,6 +3279,10 @@ class TaroDocument extends TaroElement {
3264
3279
  case nodeName === A:
3265
3280
  element = new AnchorElement();
3266
3281
  break;
3282
+ case nodeName === 'page-meta':
3283
+ case nodeName === 'navigation-bar':
3284
+ element = new TransferElement(toCamelCase(nodeName));
3285
+ break;
3267
3286
  default:
3268
3287
  element = new TaroElement();
3269
3288
  break;
@@ -4230,5 +4249,5 @@ const nextTick = (cb, ctx) => {
4230
4249
  next();
4231
4250
  };
4232
4251
 
4233
- 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 };
4234
4253
  //# sourceMappingURL=runtime.esm.js.map