@tarojs/runtime 3.7.0-canary.6 → 4.0.0-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/runtime.cjs.d.ts +19 -1
- package/dist/runtime.cjs.js +35 -26
- package/dist/runtime.esm.d.ts +19 -1
- package/dist/runtime.esm.js +26 -27
- package/dist/runtime.esm.js.map +1 -1
- package/dist/runtime.h5.d.ts +19 -1
- package/dist/runtime.h5.js +31 -22
- package/package.json +2 -2
package/dist/runtime.cjs.d.ts
CHANGED
|
@@ -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";
|
|
@@ -776,6 +777,23 @@ declare function hydrate(node: TaroElement | TaroText): MiniData;
|
|
|
776
777
|
declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
|
|
777
778
|
declare const options: Options;
|
|
778
779
|
declare const incrementId: () => () => string;
|
|
780
|
+
declare function isElement(node: TaroNode): node is TaroElement;
|
|
781
|
+
declare function isText(node: TaroNode): node is TaroText;
|
|
782
|
+
declare function isComment(node: TaroNode): boolean;
|
|
779
783
|
declare function isHasExtractProp(el: TaroElement): boolean;
|
|
784
|
+
/**
|
|
785
|
+
* 往上寻找组件树直到 root,寻找是否有祖先组件绑定了同类型的事件
|
|
786
|
+
* @param node 当前组件
|
|
787
|
+
* @param type 事件类型
|
|
788
|
+
*/
|
|
789
|
+
declare function isParentBinded(node: TaroElement | null, type: string): boolean;
|
|
790
|
+
declare function shortcutAttr(key: string): string;
|
|
791
|
+
declare const customWrapperCache: Map<string, Record<string, any>>;
|
|
792
|
+
interface Ctor {
|
|
793
|
+
new (...args: any[]): any;
|
|
794
|
+
}
|
|
795
|
+
declare function extend(ctor: Ctor, methodName: string, options: Func | Record<string, any>): void;
|
|
796
|
+
declare function getComponentsAlias(): any;
|
|
797
|
+
declare function convertNumber2PX(value: number): string;
|
|
780
798
|
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 };
|
|
799
|
+
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, isElement, isText, isComment, isHasExtractProp, isParentBinded, shortcutAttr, customWrapperCache, extend, getComponentsAlias, convertNumber2PX, 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 };
|
package/dist/runtime.cjs.js
CHANGED
|
@@ -39,6 +39,7 @@ var KEY_CODE = 'keyCode';
|
|
|
39
39
|
var TOUCHMOVE = 'touchmove';
|
|
40
40
|
var DATE = 'Date';
|
|
41
41
|
var SET_TIMEOUT = 'setTimeout';
|
|
42
|
+
var COMPILE_MODE = 'compileMode';
|
|
42
43
|
var CATCHMOVE = 'catchMove';
|
|
43
44
|
var CATCH_VIEW = 'catch-view';
|
|
44
45
|
var COMMENT = 'comment';
|
|
@@ -291,6 +292,9 @@ function getComponentsAlias() {
|
|
|
291
292
|
}
|
|
292
293
|
return componentsAlias$1;
|
|
293
294
|
}
|
|
295
|
+
function convertNumber2PX(value) {
|
|
296
|
+
return value + 'px';
|
|
297
|
+
}
|
|
294
298
|
|
|
295
299
|
var ClassList = function ClassList(className, el) {
|
|
296
300
|
var this$1$1 = this;
|
|
@@ -414,10 +418,10 @@ var EventSource = /*@__PURE__*/(function (Map) {
|
|
|
414
418
|
}(Map));
|
|
415
419
|
var eventSource = new EventSource();
|
|
416
420
|
|
|
417
|
-
var isWeb$
|
|
421
|
+
var isWeb$2 = shared.isWebPlatform();
|
|
418
422
|
var env = {
|
|
419
|
-
window: isWeb$
|
|
420
|
-
document: isWeb$
|
|
423
|
+
window: isWeb$2 ? window : shared.EMPTY_OBJ,
|
|
424
|
+
document: isWeb$2 ? document : shared.EMPTY_OBJ
|
|
421
425
|
};
|
|
422
426
|
|
|
423
427
|
var SPECIAL_NODES;
|
|
@@ -432,14 +436,10 @@ function hydrate(node) {
|
|
|
432
436
|
var obj;
|
|
433
437
|
|
|
434
438
|
var _a;
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (!SPECIAL_NODES) {
|
|
440
|
-
// 初始化 SPECIAL_NODES
|
|
441
|
-
SPECIAL_NODES = shared.hooks.call('getSpecialNodes');
|
|
442
|
-
}
|
|
439
|
+
// 初始化 componentsAlias
|
|
440
|
+
componentsAlias || (componentsAlias = getComponentsAlias());
|
|
441
|
+
// 初始化 SPECIAL_NODES
|
|
442
|
+
SPECIAL_NODES || (SPECIAL_NODES = shared.hooks.call('getSpecialNodes'));
|
|
443
443
|
var nodeName = node.nodeName;
|
|
444
444
|
if (isText(node)) {
|
|
445
445
|
return ( obj = {
|
|
@@ -465,22 +465,19 @@ function hydrate(node) {
|
|
|
465
465
|
prop !== CLASS &&
|
|
466
466
|
prop !== STYLE &&
|
|
467
467
|
prop !== ID &&
|
|
468
|
-
propInCamelCase !== CATCHMOVE
|
|
468
|
+
propInCamelCase !== CATCHMOVE &&
|
|
469
|
+
propInCamelCase !== COMPILE_MODE) {
|
|
469
470
|
data[propInCamelCase] = props[prop];
|
|
470
471
|
}
|
|
471
472
|
if (nodeName === VIEW && propInCamelCase === CATCHMOVE && props[prop] !== false) {
|
|
472
473
|
data["nn" /* Shortcuts.NodeName */] = CATCH_VIEW;
|
|
473
474
|
}
|
|
475
|
+
if (propInCamelCase === COMPILE_MODE) {
|
|
476
|
+
data["nn" /* Shortcuts.NodeName */] = props[prop];
|
|
477
|
+
}
|
|
474
478
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
childNodes = childNodes.filter(function (node) { return !isComment(node); });
|
|
478
|
-
if (childNodes.length > 0) {
|
|
479
|
-
data["cn" /* Shortcuts.Childnodes */] = childNodes.map(hydrate);
|
|
480
|
-
}
|
|
481
|
-
else {
|
|
482
|
-
data["cn" /* Shortcuts.Childnodes */] = [];
|
|
483
|
-
}
|
|
479
|
+
// Children
|
|
480
|
+
data["cn" /* Shortcuts.Childnodes */] = node.childNodes.filter(function (node) { return !isComment(node); }).map(hydrate);
|
|
484
481
|
if (node.className !== '') {
|
|
485
482
|
data["cl" /* Shortcuts.Class */] = node.className;
|
|
486
483
|
}
|
|
@@ -1501,7 +1498,10 @@ var TaroElement = /*@__PURE__*/(function (TaroNode) {
|
|
|
1501
1498
|
event.defaultPrevented = true;
|
|
1502
1499
|
}
|
|
1503
1500
|
if (!shared.isUndefined(result) && event.mpEvent) {
|
|
1504
|
-
|
|
1501
|
+
var res = shared.hooks.call('modifyTaroEventReturn', this, event, result);
|
|
1502
|
+
if (res) {
|
|
1503
|
+
event.mpEvent[EVENT_CALLBACK_RESULT] = result;
|
|
1504
|
+
}
|
|
1505
1505
|
}
|
|
1506
1506
|
if (event._end && event._stop) {
|
|
1507
1507
|
break;
|
|
@@ -1510,9 +1510,6 @@ var TaroElement = /*@__PURE__*/(function (TaroNode) {
|
|
|
1510
1510
|
if (event._stop) {
|
|
1511
1511
|
this._stopPropagation(event);
|
|
1512
1512
|
}
|
|
1513
|
-
else {
|
|
1514
|
-
event._stop = true;
|
|
1515
|
-
}
|
|
1516
1513
|
return listeners != null;
|
|
1517
1514
|
};
|
|
1518
1515
|
TaroElement.prototype.addEventListener = function addEventListener (type, handler, options) {
|
|
@@ -2488,7 +2485,9 @@ function contains(node) {
|
|
|
2488
2485
|
return isContains;
|
|
2489
2486
|
}
|
|
2490
2487
|
|
|
2491
|
-
|
|
2488
|
+
var isWeb$1 = shared.isWebPlatform();
|
|
2489
|
+
var isHarmony = process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony';
|
|
2490
|
+
if (!isWeb$1 && !isHarmony) {
|
|
2492
2491
|
if (ENABLE_INNER_HTML) {
|
|
2493
2492
|
TaroNode.extend('innerHTML', {
|
|
2494
2493
|
set: function set(html) {
|
|
@@ -4527,6 +4526,7 @@ exports.CATCH_VIEW = CATCH_VIEW;
|
|
|
4527
4526
|
exports.CHANGE = CHANGE;
|
|
4528
4527
|
exports.CLASS = CLASS;
|
|
4529
4528
|
exports.COMMENT = COMMENT;
|
|
4529
|
+
exports.COMPILE_MODE = COMPILE_MODE;
|
|
4530
4530
|
exports.CONFIRM = CONFIRM;
|
|
4531
4531
|
exports.CONTAINER = CONTAINER;
|
|
4532
4532
|
exports.CURRENT_TARGET = CURRENT_TARGET;
|
|
@@ -4583,14 +4583,18 @@ exports.VALUE = VALUE;
|
|
|
4583
4583
|
exports.VIEW = VIEW;
|
|
4584
4584
|
exports.addLeadingSlash = addLeadingSlash;
|
|
4585
4585
|
exports.cancelAnimationFrame = _caf;
|
|
4586
|
+
exports.convertNumber2PX = convertNumber2PX;
|
|
4586
4587
|
exports.createComponentConfig = createComponentConfig;
|
|
4587
4588
|
exports.createEvent = createEvent;
|
|
4588
4589
|
exports.createPageConfig = createPageConfig;
|
|
4589
4590
|
exports.createRecursiveComponentConfig = createRecursiveComponentConfig;
|
|
4591
|
+
exports.customWrapperCache = customWrapperCache;
|
|
4590
4592
|
exports.env = env;
|
|
4591
4593
|
exports.eventCenter = eventCenter;
|
|
4592
4594
|
exports.eventHandler = eventHandler;
|
|
4593
4595
|
exports.eventSource = eventSource;
|
|
4596
|
+
exports.extend = extend;
|
|
4597
|
+
exports.getComponentsAlias = getComponentsAlias;
|
|
4594
4598
|
exports.getComputedStyle = getComputedStyle;
|
|
4595
4599
|
exports.getCurrentInstance = getCurrentInstance;
|
|
4596
4600
|
exports.getOnHideEventKey = getOnHideEventKey;
|
|
@@ -4602,7 +4606,11 @@ exports.history = history;
|
|
|
4602
4606
|
exports.hydrate = hydrate;
|
|
4603
4607
|
exports.incrementId = incrementId;
|
|
4604
4608
|
exports.injectPageInstance = injectPageInstance;
|
|
4609
|
+
exports.isComment = isComment;
|
|
4610
|
+
exports.isElement = isElement;
|
|
4605
4611
|
exports.isHasExtractProp = isHasExtractProp;
|
|
4612
|
+
exports.isParentBinded = isParentBinded;
|
|
4613
|
+
exports.isText = isText;
|
|
4606
4614
|
exports.location = location;
|
|
4607
4615
|
exports.navigator = nav;
|
|
4608
4616
|
exports.nextTick = nextTick;
|
|
@@ -4611,4 +4619,5 @@ exports.parseUrl = parseUrl;
|
|
|
4611
4619
|
exports.removePageInstance = removePageInstance;
|
|
4612
4620
|
exports.requestAnimationFrame = _raf;
|
|
4613
4621
|
exports.safeExecute = safeExecute;
|
|
4622
|
+
exports.shortcutAttr = shortcutAttr;
|
|
4614
4623
|
exports.stringify = stringify;
|
package/dist/runtime.esm.d.ts
CHANGED
|
@@ -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";
|
|
@@ -776,6 +777,23 @@ declare function hydrate(node: TaroElement | TaroText): MiniData;
|
|
|
776
777
|
declare const nextTick: (cb: Func, ctx?: Record<string, any>) => void;
|
|
777
778
|
declare const options: Options;
|
|
778
779
|
declare const incrementId: () => () => string;
|
|
780
|
+
declare function isElement(node: TaroNode): node is TaroElement;
|
|
781
|
+
declare function isText(node: TaroNode): node is TaroText;
|
|
782
|
+
declare function isComment(node: TaroNode): boolean;
|
|
779
783
|
declare function isHasExtractProp(el: TaroElement): boolean;
|
|
784
|
+
/**
|
|
785
|
+
* 往上寻找组件树直到 root,寻找是否有祖先组件绑定了同类型的事件
|
|
786
|
+
* @param node 当前组件
|
|
787
|
+
* @param type 事件类型
|
|
788
|
+
*/
|
|
789
|
+
declare function isParentBinded(node: TaroElement | null, type: string): boolean;
|
|
790
|
+
declare function shortcutAttr(key: string): string;
|
|
791
|
+
declare const customWrapperCache: Map<string, Record<string, any>>;
|
|
792
|
+
interface Ctor {
|
|
793
|
+
new (...args: any[]): any;
|
|
794
|
+
}
|
|
795
|
+
declare function extend(ctor: Ctor, methodName: string, options: Func | Record<string, any>): void;
|
|
796
|
+
declare function getComponentsAlias(): any;
|
|
797
|
+
declare function convertNumber2PX(value: number): string;
|
|
780
798
|
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 };
|
|
799
|
+
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, isElement, isText, isComment, isHasExtractProp, isParentBinded, shortcutAttr, customWrapperCache, extend, getComponentsAlias, convertNumber2PX, 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 };
|
package/dist/runtime.esm.js
CHANGED
|
@@ -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';
|
|
@@ -286,6 +287,9 @@ function getComponentsAlias() {
|
|
|
286
287
|
}
|
|
287
288
|
return componentsAlias$1;
|
|
288
289
|
}
|
|
290
|
+
function convertNumber2PX(value) {
|
|
291
|
+
return value + 'px';
|
|
292
|
+
}
|
|
289
293
|
|
|
290
294
|
class ClassList {
|
|
291
295
|
constructor(className, el) {
|
|
@@ -392,10 +396,10 @@ class EventSource extends Map {
|
|
|
392
396
|
}
|
|
393
397
|
const eventSource = new EventSource();
|
|
394
398
|
|
|
395
|
-
const isWeb$
|
|
399
|
+
const isWeb$2 = isWebPlatform();
|
|
396
400
|
const env = {
|
|
397
|
-
window: isWeb$
|
|
398
|
-
document: isWeb$
|
|
401
|
+
window: isWeb$2 ? window : EMPTY_OBJ,
|
|
402
|
+
document: isWeb$2 ? document : EMPTY_OBJ
|
|
399
403
|
};
|
|
400
404
|
|
|
401
405
|
let SPECIAL_NODES;
|
|
@@ -408,14 +412,10 @@ let componentsAlias;
|
|
|
408
412
|
*/
|
|
409
413
|
function hydrate(node) {
|
|
410
414
|
var _a;
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
if (!SPECIAL_NODES) {
|
|
416
|
-
// 初始化 SPECIAL_NODES
|
|
417
|
-
SPECIAL_NODES = hooks.call('getSpecialNodes');
|
|
418
|
-
}
|
|
415
|
+
// 初始化 componentsAlias
|
|
416
|
+
componentsAlias || (componentsAlias = getComponentsAlias());
|
|
417
|
+
// 初始化 SPECIAL_NODES
|
|
418
|
+
SPECIAL_NODES || (SPECIAL_NODES = hooks.call('getSpecialNodes'));
|
|
419
419
|
const nodeName = node.nodeName;
|
|
420
420
|
if (isText(node)) {
|
|
421
421
|
return {
|
|
@@ -444,22 +444,19 @@ function hydrate(node) {
|
|
|
444
444
|
prop !== CLASS &&
|
|
445
445
|
prop !== STYLE &&
|
|
446
446
|
prop !== ID &&
|
|
447
|
-
propInCamelCase !== CATCHMOVE
|
|
447
|
+
propInCamelCase !== CATCHMOVE &&
|
|
448
|
+
propInCamelCase !== COMPILE_MODE) {
|
|
448
449
|
data[propInCamelCase] = props[prop];
|
|
449
450
|
}
|
|
450
451
|
if (nodeName === VIEW && propInCamelCase === CATCHMOVE && props[prop] !== false) {
|
|
451
452
|
data["nn" /* Shortcuts.NodeName */] = CATCH_VIEW;
|
|
452
453
|
}
|
|
454
|
+
if (propInCamelCase === COMPILE_MODE) {
|
|
455
|
+
data["nn" /* Shortcuts.NodeName */] = props[prop];
|
|
456
|
+
}
|
|
453
457
|
}
|
|
454
|
-
|
|
455
|
-
|
|
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
|
-
}
|
|
458
|
+
// Children
|
|
459
|
+
data["cn" /* Shortcuts.Childnodes */] = node.childNodes.filter(node => !isComment(node)).map(hydrate);
|
|
463
460
|
if (node.className !== '') {
|
|
464
461
|
data["cl" /* Shortcuts.Class */] = node.className;
|
|
465
462
|
}
|
|
@@ -1469,7 +1466,10 @@ class TaroElement extends TaroNode {
|
|
|
1469
1466
|
event.defaultPrevented = true;
|
|
1470
1467
|
}
|
|
1471
1468
|
if (!isUndefined(result) && event.mpEvent) {
|
|
1472
|
-
|
|
1469
|
+
const res = hooks.call('modifyTaroEventReturn', this, event, result);
|
|
1470
|
+
if (res) {
|
|
1471
|
+
event.mpEvent[EVENT_CALLBACK_RESULT] = result;
|
|
1472
|
+
}
|
|
1473
1473
|
}
|
|
1474
1474
|
if (event._end && event._stop) {
|
|
1475
1475
|
break;
|
|
@@ -1478,9 +1478,6 @@ class TaroElement extends TaroNode {
|
|
|
1478
1478
|
if (event._stop) {
|
|
1479
1479
|
this._stopPropagation(event);
|
|
1480
1480
|
}
|
|
1481
|
-
else {
|
|
1482
|
-
event._stop = true;
|
|
1483
|
-
}
|
|
1484
1481
|
return listeners != null;
|
|
1485
1482
|
}
|
|
1486
1483
|
addEventListener(type, handler, options) {
|
|
@@ -2413,7 +2410,9 @@ function contains(node) {
|
|
|
2413
2410
|
return isContains;
|
|
2414
2411
|
}
|
|
2415
2412
|
|
|
2416
|
-
|
|
2413
|
+
const isWeb$1 = isWebPlatform();
|
|
2414
|
+
const isHarmony = process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony';
|
|
2415
|
+
if (!isWeb$1 && !isHarmony) {
|
|
2417
2416
|
if (ENABLE_INNER_HTML) {
|
|
2418
2417
|
TaroNode.extend('innerHTML', {
|
|
2419
2418
|
set(html) {
|
|
@@ -4251,5 +4250,5 @@ const nextTick = (cb, ctx) => {
|
|
|
4251
4250
|
next();
|
|
4252
4251
|
};
|
|
4253
4252
|
|
|
4254
|
-
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 };
|
|
4253
|
+
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, convertNumber2PX, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, customWrapperCache, document$1 as document, env, eventCenter, eventHandler, eventSource, extend, getComponentsAlias, getComputedStyle, getCurrentInstance, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPageInstance, getPath, history, hydrate, incrementId, injectPageInstance, isComment, isElement, isHasExtractProp, isParentBinded, isText, location, nav as navigator, nextTick, now, options, parseUrl, removePageInstance, _raf as requestAnimationFrame, safeExecute, shortcutAttr, stringify, window$1 as window };
|
|
4255
4254
|
//# sourceMappingURL=runtime.esm.js.map
|