@tarojs/runtime 3.6.20 → 3.6.22-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.
@@ -35,6 +35,7 @@ export declare const KEY_CODE = "keyCode";
35
35
  export declare const TOUCHMOVE = "touchmove";
36
36
  export declare const DATE = "Date";
37
37
  export declare const SET_TIMEOUT = "setTimeout";
38
+ export declare const COMPILE_MODE = "compileMode";
38
39
  export declare const CATCHMOVE = "catchMove";
39
40
  export declare const CATCH_VIEW = "catch-view";
40
41
  export declare const COMMENT = "comment";
@@ -21,10 +21,9 @@ export interface MiniElementData {
21
21
  sid: string;
22
22
  [key: string]: unknown;
23
23
  }
24
- interface MiniTextData {
24
+ export interface MiniTextData {
25
25
  [Shortcuts.Text]: string;
26
26
  [Shortcuts.NodeName]: string;
27
27
  }
28
28
  export type MiniData = MiniElementData | MiniTextData;
29
29
  export type HydratedData = () => MiniData | MiniData[];
30
- export {};
@@ -431,7 +431,7 @@ declare const nav: any;
431
431
  declare let now: () => number;
432
432
  // https://gist.github.com/paulirish/1579671
433
433
  // https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
434
- declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timeout);
434
+ declare const _raf: typeof requestAnimationFrame | ((callback: any) => NodeJS.Timer);
435
435
  declare const _caf: typeof cancelAnimationFrame;
436
436
  declare class URLSearchParams {
437
437
  #private;
@@ -626,6 +626,7 @@ declare const KEY_CODE = "keyCode";
626
626
  declare const TOUCHMOVE = "touchmove";
627
627
  declare const DATE = "Date";
628
628
  declare const SET_TIMEOUT = "setTimeout";
629
+ declare const COMPILE_MODE = "compileMode";
629
630
  declare const CATCHMOVE = "catchMove";
630
631
  declare const CATCH_VIEW = "catch-view";
631
632
  declare const COMMENT = "comment";
@@ -778,4 +779,4 @@ declare const options: Options;
778
779
  declare const incrementId: () => () => string;
779
780
  declare function isHasExtractProp(el: TaroElement): boolean;
780
781
  export { hooks } from '@tarojs/shared';
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 };
782
+ 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, 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, 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, MiniTextData, MiniData, HydratedData, UpdatePayloadValue, DataTree, UpdatePayload, Options$0 as Options, Func, Ctx };
@@ -38,6 +38,7 @@ const KEY_CODE = 'keyCode';
38
38
  const TOUCHMOVE = 'touchmove';
39
39
  const DATE = 'Date';
40
40
  const SET_TIMEOUT = 'setTimeout';
41
+ const COMPILE_MODE = 'compileMode';
41
42
  const CATCHMOVE = 'catchMove';
42
43
  const CATCH_VIEW = 'catch-view';
43
44
  const COMMENT = 'comment';
@@ -408,14 +409,10 @@ let componentsAlias;
408
409
  */
409
410
  function hydrate(node) {
410
411
  var _a;
411
- if (!componentsAlias) {
412
- // 初始化 componentsAlias
413
- componentsAlias = getComponentsAlias();
414
- }
415
- if (!SPECIAL_NODES) {
416
- // 初始化 SPECIAL_NODES
417
- SPECIAL_NODES = hooks.call('getSpecialNodes');
418
- }
412
+ // 初始化 componentsAlias
413
+ componentsAlias || (componentsAlias = getComponentsAlias());
414
+ // 初始化 SPECIAL_NODES
415
+ SPECIAL_NODES || (SPECIAL_NODES = hooks.call('getSpecialNodes'));
419
416
  const nodeName = node.nodeName;
420
417
  if (isText(node)) {
421
418
  return {
@@ -444,22 +441,19 @@ function hydrate(node) {
444
441
  prop !== CLASS &&
445
442
  prop !== STYLE &&
446
443
  prop !== ID &&
447
- propInCamelCase !== CATCHMOVE) {
444
+ propInCamelCase !== CATCHMOVE &&
445
+ propInCamelCase !== COMPILE_MODE) {
448
446
  data[propInCamelCase] = props[prop];
449
447
  }
450
448
  if (nodeName === VIEW && propInCamelCase === CATCHMOVE && props[prop] !== false) {
451
449
  data["nn" /* Shortcuts.NodeName */] = CATCH_VIEW;
452
450
  }
451
+ if (propInCamelCase === COMPILE_MODE) {
452
+ data["nn" /* Shortcuts.NodeName */] = props[prop];
453
+ }
453
454
  }
454
- let { childNodes } = node;
455
- // 过滤 comment 节点
456
- childNodes = childNodes.filter(node => !isComment(node));
457
- if (childNodes.length > 0) {
458
- data["cn" /* Shortcuts.Childnodes */] = childNodes.map(hydrate);
459
- }
460
- else {
461
- data["cn" /* Shortcuts.Childnodes */] = [];
462
- }
455
+ // Children
456
+ data["cn" /* Shortcuts.Childnodes */] = node.childNodes.filter(node => !isComment(node)).map(hydrate);
463
457
  if (node.className !== '') {
464
458
  data["cl" /* Shortcuts.Class */] = node.className;
465
459
  }
@@ -1469,7 +1463,10 @@ class TaroElement extends TaroNode {
1469
1463
  event.defaultPrevented = true;
1470
1464
  }
1471
1465
  if (!isUndefined(result) && event.mpEvent) {
1472
- event.mpEvent[EVENT_CALLBACK_RESULT] = result;
1466
+ const res = hooks.call('modifyTaroEventReturn', this, event, result);
1467
+ if (res) {
1468
+ event.mpEvent[EVENT_CALLBACK_RESULT] = result;
1469
+ }
1473
1470
  }
1474
1471
  if (event._end && event._stop) {
1475
1472
  break;
@@ -4249,5 +4246,5 @@ const nextTick = (cb, ctx) => {
4249
4246
  next();
4250
4247
  };
4251
4248
 
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 };
4249
+ export { A, APP, BEHAVIORS, BODY, CATCHMOVE, CATCH_VIEW, CHANGE, CLASS, COMMENT, COMPILE_MODE, 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 };
4253
4250
  //# sourceMappingURL=runtime.esm.js.map