@tarojs/runtime 3.5.0-theta.1 → 3.5.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/bom/document.d.ts +2 -0
- package/dist/bom/getComputedStyle.d.ts +3 -0
- package/dist/bom/navigator.d.ts +1 -0
- package/dist/bom/raf.d.ts +5 -0
- package/dist/bom/window.d.ts +2 -0
- package/dist/constants/index.d.ts +47 -0
- package/dist/current.d.ts +19 -0
- package/dist/dom/class-list.d.ts +14 -0
- package/dist/dom/document.d.ts +20 -0
- package/dist/dom/element.d.ts +38 -0
- package/dist/dom/event-source.d.ts +7 -0
- package/dist/dom/event-target.d.ts +7 -0
- package/dist/dom/event.d.ts +22 -0
- package/dist/dom/form.d.ts +7 -0
- package/dist/dom/node.d.ts +75 -0
- package/dist/dom/node_types.d.ts +10 -0
- package/dist/dom/root.d.ts +15 -0
- package/dist/dom/style.d.ts +14 -0
- package/dist/dom/style_properties.d.ts +3 -0
- package/dist/dom/svg.d.ts +3 -0
- package/dist/dom/text.d.ts +14 -0
- package/dist/dom/tree.d.ts +4 -0
- package/dist/dom-external/element.d.ts +3 -0
- package/dist/dom-external/index.d.ts +1 -0
- package/dist/dom-external/inner-html/html.d.ts +2 -0
- package/dist/dom-external/inner-html/parser.d.ts +25 -0
- package/dist/dom-external/inner-html/scaner.d.ts +30 -0
- package/dist/dom-external/inner-html/style.d.ts +27 -0
- package/dist/dom-external/inner-html/tags.d.ts +8 -0
- package/dist/dom-external/inner-html/utils.d.ts +1 -0
- package/dist/dom-external/mutation-observer/implements.d.ts +52 -0
- package/dist/dom-external/mutation-observer/index.d.ts +13 -0
- package/dist/dom-external/mutation-observer/record.d.ts +24 -0
- package/dist/dom-external/node.d.ts +11 -0
- package/dist/dsl/common.d.ts +15 -0
- package/dist/dsl/instance.d.ts +85 -0
- package/dist/emitter/emitter.d.ts +4 -0
- package/dist/env.d.ts +7 -0
- package/dist/hydrate.d.ts +10 -0
- package/dist/index.d.ts +26 -0
- package/dist/interface/element.d.ts +4 -0
- package/dist/interface/event-target.d.ts +10 -0
- package/dist/interface/event.d.ts +15 -0
- package/dist/interface/hydrate.d.ts +30 -0
- package/dist/interface/index.d.ts +7 -0
- package/dist/interface/node.d.ts +7 -0
- package/dist/interface/options.d.ts +16 -0
- package/dist/interface/utils.d.ts +2 -0
- package/dist/next-tick.d.ts +2 -0
- package/dist/options.d.ts +2 -0
- package/dist/perf.d.ts +7 -0
- package/dist/runtime.esm.d.ts +28 -28
- package/dist/runtime.esm.js +87 -70
- package/dist/runtime.esm.js.map +1 -1
- package/dist/utils/index.d.ts +23 -0
- package/package.json +6 -6
package/dist/runtime.esm.js
CHANGED
|
@@ -101,21 +101,21 @@ const sidMatches = (observerTarget, target) => {
|
|
|
101
101
|
const isConcerned = (record, options) => {
|
|
102
102
|
const { characterData, characterDataOldValue, attributes, attributeOldValue, childList } = options;
|
|
103
103
|
switch (record.type) {
|
|
104
|
-
case "characterData" /* CHARACTER_DATA */:
|
|
104
|
+
case "characterData" /* MutationRecordType.CHARACTER_DATA */:
|
|
105
105
|
if (characterData) {
|
|
106
106
|
if (!characterDataOldValue)
|
|
107
107
|
record.oldValue = null;
|
|
108
108
|
return true;
|
|
109
109
|
}
|
|
110
110
|
return false;
|
|
111
|
-
case "attributes" /* ATTRIBUTES */:
|
|
111
|
+
case "attributes" /* MutationRecordType.ATTRIBUTES */:
|
|
112
112
|
if (attributes) {
|
|
113
113
|
if (!attributeOldValue)
|
|
114
114
|
record.oldValue = null;
|
|
115
115
|
return true;
|
|
116
116
|
}
|
|
117
117
|
return false;
|
|
118
|
-
case "childList" /* CHILD_LIST */:
|
|
118
|
+
case "childList" /* MutationRecordType.CHILD_LIST */:
|
|
119
119
|
if (childList) {
|
|
120
120
|
return true;
|
|
121
121
|
}
|
|
@@ -211,10 +211,10 @@ const incrementId = () => {
|
|
|
211
211
|
};
|
|
212
212
|
};
|
|
213
213
|
function isElement(node) {
|
|
214
|
-
return node.nodeType === 1 /* ELEMENT_NODE */;
|
|
214
|
+
return node.nodeType === 1 /* NodeType.ELEMENT_NODE */;
|
|
215
215
|
}
|
|
216
216
|
function isText(node) {
|
|
217
|
-
return node.nodeType === 3 /* TEXT_NODE */;
|
|
217
|
+
return node.nodeType === 3 /* NodeType.TEXT_NODE */;
|
|
218
218
|
}
|
|
219
219
|
function isComment(node) {
|
|
220
220
|
return node.nodeName === COMMENT;
|
|
@@ -245,11 +245,11 @@ function isParentBinded(node, type) {
|
|
|
245
245
|
function shortcutAttr(key) {
|
|
246
246
|
switch (key) {
|
|
247
247
|
case STYLE:
|
|
248
|
-
return "st" /* Style */;
|
|
248
|
+
return "st" /* Shortcuts.Style */;
|
|
249
249
|
case ID:
|
|
250
250
|
return UID;
|
|
251
251
|
case CLASS:
|
|
252
|
-
return "cl" /* Class */;
|
|
252
|
+
return "cl" /* Shortcuts.Class */;
|
|
253
253
|
default:
|
|
254
254
|
return key;
|
|
255
255
|
}
|
|
@@ -357,21 +357,21 @@ function hydrate(node) {
|
|
|
357
357
|
const nodeName = node.nodeName;
|
|
358
358
|
if (isText(node)) {
|
|
359
359
|
return {
|
|
360
|
-
["v" /* Text */]: node.nodeValue,
|
|
361
|
-
["nn" /* NodeName */]: componentsAlias[nodeName]._num
|
|
360
|
+
["v" /* Shortcuts.Text */]: node.nodeValue,
|
|
361
|
+
["nn" /* Shortcuts.NodeName */]: componentsAlias[nodeName]._num
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
364
|
const data = {
|
|
365
|
-
["nn" /* NodeName */]: nodeName,
|
|
365
|
+
["nn" /* Shortcuts.NodeName */]: nodeName,
|
|
366
366
|
sid: node.sid
|
|
367
367
|
};
|
|
368
368
|
if (node.uid !== node.sid) {
|
|
369
369
|
data.uid = node.uid;
|
|
370
370
|
}
|
|
371
371
|
if (!node.isAnyEventBinded() && SPECIAL_NODES.indexOf(nodeName) > -1) {
|
|
372
|
-
data["nn" /* NodeName */] = `static-${nodeName}`;
|
|
372
|
+
data["nn" /* Shortcuts.NodeName */] = `static-${nodeName}`;
|
|
373
373
|
if (nodeName === VIEW && !isHasExtractProp(node)) {
|
|
374
|
-
data["nn" /* NodeName */] = PURE_VIEW;
|
|
374
|
+
data["nn" /* Shortcuts.NodeName */] = PURE_VIEW;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
const { props } = node;
|
|
@@ -385,30 +385,30 @@ function hydrate(node) {
|
|
|
385
385
|
data[propInCamelCase] = props[prop];
|
|
386
386
|
}
|
|
387
387
|
if (nodeName === VIEW && propInCamelCase === CATCHMOVE && props[prop] !== false) {
|
|
388
|
-
data["nn" /* NodeName */] = CATCH_VIEW;
|
|
388
|
+
data["nn" /* Shortcuts.NodeName */] = CATCH_VIEW;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
let { childNodes } = node;
|
|
392
392
|
// 过滤 comment 节点
|
|
393
393
|
childNodes = childNodes.filter(node => !isComment(node));
|
|
394
394
|
if (childNodes.length > 0) {
|
|
395
|
-
data["cn" /* Childnodes */] = childNodes.map(hydrate);
|
|
395
|
+
data["cn" /* Shortcuts.Childnodes */] = childNodes.map(hydrate);
|
|
396
396
|
}
|
|
397
397
|
else {
|
|
398
|
-
data["cn" /* Childnodes */] = [];
|
|
398
|
+
data["cn" /* Shortcuts.Childnodes */] = [];
|
|
399
399
|
}
|
|
400
400
|
if (node.className !== '') {
|
|
401
|
-
data["cl" /* Class */] = node.className;
|
|
401
|
+
data["cl" /* Shortcuts.Class */] = node.className;
|
|
402
402
|
}
|
|
403
403
|
const cssText = node.cssText;
|
|
404
404
|
if (cssText !== '' && nodeName !== 'swiper-item') {
|
|
405
|
-
data["st" /* Style */] = cssText;
|
|
405
|
+
data["st" /* Shortcuts.Style */] = cssText;
|
|
406
406
|
}
|
|
407
407
|
hooks.call('modifyHydrateData', data);
|
|
408
|
-
const nn = data["nn" /* NodeName */];
|
|
408
|
+
const nn = data["nn" /* Shortcuts.NodeName */];
|
|
409
409
|
const componentAlias = componentsAlias[nn];
|
|
410
410
|
if (componentAlias) {
|
|
411
|
-
data["nn" /* NodeName */] = componentAlias._num;
|
|
411
|
+
data["nn" /* Shortcuts.NodeName */] = componentAlias._num;
|
|
412
412
|
for (const prop in data) {
|
|
413
413
|
if (prop in componentAlias) {
|
|
414
414
|
data[componentAlias[prop]] = data[prop];
|
|
@@ -493,7 +493,7 @@ class TaroEventTarget {
|
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
-
const CHILDNODES = "cn" /* Childnodes */;
|
|
496
|
+
const CHILDNODES = "cn" /* Shortcuts.Childnodes */;
|
|
497
497
|
const nodeId = incrementId();
|
|
498
498
|
class TaroNode extends TaroEventTarget {
|
|
499
499
|
constructor() {
|
|
@@ -546,7 +546,7 @@ class TaroNode extends TaroEventTarget {
|
|
|
546
546
|
}
|
|
547
547
|
get parentElement() {
|
|
548
548
|
const parentNode = this.parentNode;
|
|
549
|
-
if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeType) === 1 /* ELEMENT_NODE */) {
|
|
549
|
+
if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeType) === 1 /* NodeType.ELEMENT_NODE */) {
|
|
550
550
|
return parentNode;
|
|
551
551
|
}
|
|
552
552
|
return null;
|
|
@@ -581,7 +581,7 @@ class TaroNode extends TaroEventTarget {
|
|
|
581
581
|
}
|
|
582
582
|
// @Todo: appendChild 会多触发一次
|
|
583
583
|
MutationObserver.record({
|
|
584
|
-
type: "childList" /* CHILD_LIST */,
|
|
584
|
+
type: "childList" /* MutationRecordType.CHILD_LIST */,
|
|
585
585
|
target: this,
|
|
586
586
|
removedNodes,
|
|
587
587
|
addedNodes
|
|
@@ -646,7 +646,7 @@ class TaroNode extends TaroEventTarget {
|
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
MutationObserver.record({
|
|
649
|
-
type: "childList" /* CHILD_LIST */,
|
|
649
|
+
type: "childList" /* MutationRecordType.CHILD_LIST */,
|
|
650
650
|
target: this,
|
|
651
651
|
addedNodes: [newChild],
|
|
652
652
|
removedNodes: isReplace
|
|
@@ -702,7 +702,7 @@ class TaroNode extends TaroEventTarget {
|
|
|
702
702
|
// appendChild/replaceChild/insertBefore 不应该触发
|
|
703
703
|
// @Todo: 但其实如果 newChild 的父节点是另一颗子树的节点,应该是要触发的
|
|
704
704
|
MutationObserver.record({
|
|
705
|
-
type: "childList" /* CHILD_LIST */,
|
|
705
|
+
type: "childList" /* MutationRecordType.CHILD_LIST */,
|
|
706
706
|
target: this,
|
|
707
707
|
removedNodes: [child],
|
|
708
708
|
nextSibling: child.nextSibling,
|
|
@@ -927,7 +927,7 @@ combine(WEBKIT, ['LineClamp', 'BoxOrient', 'TextFillColor', 'TextStroke', 'TextS
|
|
|
927
927
|
|
|
928
928
|
function recordCss(obj) {
|
|
929
929
|
MutationObserver.record({
|
|
930
|
-
type: "attributes" /* ATTRIBUTES */,
|
|
930
|
+
type: "attributes" /* MutationRecordType.ATTRIBUTES */,
|
|
931
931
|
target: obj._element,
|
|
932
932
|
attributeName: 'style',
|
|
933
933
|
oldValue: obj.cssText
|
|
@@ -937,7 +937,7 @@ function enqueueUpdate(obj) {
|
|
|
937
937
|
const element = obj._element;
|
|
938
938
|
if (element._root) {
|
|
939
939
|
element.enqueueUpdate({
|
|
940
|
-
path: `${element._path}.${"st" /* Style */}`,
|
|
940
|
+
path: `${element._path}.${"st" /* Shortcuts.Style */}`,
|
|
941
941
|
value: obj.cssText
|
|
942
942
|
});
|
|
943
943
|
}
|
|
@@ -1082,7 +1082,7 @@ function treeToArray(root, predict) {
|
|
|
1082
1082
|
const filter = predict !== null && predict !== void 0 ? predict : returnTrue;
|
|
1083
1083
|
let object = root;
|
|
1084
1084
|
while (object) {
|
|
1085
|
-
if (object.nodeType === 1 /* ELEMENT_NODE */ && filter(object)) {
|
|
1085
|
+
if (object.nodeType === 1 /* NodeType.ELEMENT_NODE */ && filter(object)) {
|
|
1086
1086
|
array.push(object);
|
|
1087
1087
|
}
|
|
1088
1088
|
object = following(object, root);
|
|
@@ -1113,7 +1113,7 @@ class TaroElement extends TaroNode {
|
|
|
1113
1113
|
super();
|
|
1114
1114
|
this.props = {};
|
|
1115
1115
|
this.dataset = EMPTY_OBJ;
|
|
1116
|
-
this.nodeType = 1 /* ELEMENT_NODE */;
|
|
1116
|
+
this.nodeType = 1 /* NodeType.ELEMENT_NODE */;
|
|
1117
1117
|
this.style = new Style(this);
|
|
1118
1118
|
hooks.call('patchElement', this);
|
|
1119
1119
|
}
|
|
@@ -1195,7 +1195,7 @@ class TaroElement extends TaroNode {
|
|
|
1195
1195
|
if (qualifiedName !== STYLE) {
|
|
1196
1196
|
MutationObserver.record({
|
|
1197
1197
|
target: this,
|
|
1198
|
-
type: "attributes" /* ATTRIBUTES */,
|
|
1198
|
+
type: "attributes" /* MutationRecordType.ATTRIBUTES */,
|
|
1199
1199
|
attributeName: qualifiedName,
|
|
1200
1200
|
oldValue: this.getAttribute(qualifiedName)
|
|
1201
1201
|
});
|
|
@@ -1249,14 +1249,14 @@ class TaroElement extends TaroNode {
|
|
|
1249
1249
|
// catchMove = true: catch-view
|
|
1250
1250
|
// catchMove = false: view or static-view
|
|
1251
1251
|
this.enqueueUpdate({
|
|
1252
|
-
path: `${_path}.${"nn" /* NodeName */}`,
|
|
1252
|
+
path: `${_path}.${"nn" /* Shortcuts.NodeName */}`,
|
|
1253
1253
|
value: value ? catchViewAlias : (this.isAnyEventBinded() ? viewAlias : staticViewAlias)
|
|
1254
1254
|
});
|
|
1255
1255
|
}
|
|
1256
1256
|
else if (isPureView && isHasExtractProp(this)) {
|
|
1257
1257
|
// pure-view => static-view
|
|
1258
1258
|
this.enqueueUpdate({
|
|
1259
|
-
path: `${_path}.${"nn" /* NodeName */}`,
|
|
1259
|
+
path: `${_path}.${"nn" /* Shortcuts.NodeName */}`,
|
|
1260
1260
|
value: staticViewAlias
|
|
1261
1261
|
});
|
|
1262
1262
|
}
|
|
@@ -1266,7 +1266,7 @@ class TaroElement extends TaroNode {
|
|
|
1266
1266
|
const isStaticView = this.nodeName === VIEW && isHasExtractProp(this) && !this.isAnyEventBinded();
|
|
1267
1267
|
MutationObserver.record({
|
|
1268
1268
|
target: this,
|
|
1269
|
-
type: "attributes" /* ATTRIBUTES */,
|
|
1269
|
+
type: "attributes" /* MutationRecordType.ATTRIBUTES */,
|
|
1270
1270
|
attributeName: qualifiedName,
|
|
1271
1271
|
oldValue: this.getAttribute(qualifiedName)
|
|
1272
1272
|
});
|
|
@@ -1307,14 +1307,14 @@ class TaroElement extends TaroNode {
|
|
|
1307
1307
|
if (toCamelCase(qualifiedName) === CATCHMOVE) {
|
|
1308
1308
|
// catch-view => view or static-view or pure-view
|
|
1309
1309
|
this.enqueueUpdate({
|
|
1310
|
-
path: `${_path}.${"nn" /* NodeName */}`,
|
|
1310
|
+
path: `${_path}.${"nn" /* Shortcuts.NodeName */}`,
|
|
1311
1311
|
value: this.isAnyEventBinded() ? viewAlias : (isHasExtractProp(this) ? staticViewAlias : pureViewAlias)
|
|
1312
1312
|
});
|
|
1313
1313
|
}
|
|
1314
1314
|
else if (isStaticView && !isHasExtractProp(this)) {
|
|
1315
1315
|
// static-view => pure-view
|
|
1316
1316
|
this.enqueueUpdate({
|
|
1317
|
-
path: `${_path}.${"nn" /* NodeName */}`,
|
|
1317
|
+
path: `${_path}.${"nn" /* Shortcuts.NodeName */}`,
|
|
1318
1318
|
value: pureViewAlias
|
|
1319
1319
|
});
|
|
1320
1320
|
}
|
|
@@ -1379,7 +1379,7 @@ class TaroElement extends TaroNode {
|
|
|
1379
1379
|
const componentsAlias = getComponentsAlias();
|
|
1380
1380
|
const alias = componentsAlias[name]._num;
|
|
1381
1381
|
this.enqueueUpdate({
|
|
1382
|
-
path: `${this._path}.${"nn" /* NodeName */}`,
|
|
1382
|
+
path: `${this._path}.${"nn" /* Shortcuts.NodeName */}`,
|
|
1383
1383
|
value: alias
|
|
1384
1384
|
});
|
|
1385
1385
|
}
|
|
@@ -1394,7 +1394,7 @@ class TaroElement extends TaroNode {
|
|
|
1394
1394
|
const value = isHasExtractProp(this) ? `static-${name}` : `pure-${name}`;
|
|
1395
1395
|
const valueAlias = componentsAlias[value]._num;
|
|
1396
1396
|
this.enqueueUpdate({
|
|
1397
|
-
path: `${this._path}.${"nn" /* NodeName */}`,
|
|
1397
|
+
path: `${this._path}.${"nn" /* Shortcuts.NodeName */}`,
|
|
1398
1398
|
value: valueAlias
|
|
1399
1399
|
});
|
|
1400
1400
|
}
|
|
@@ -1915,7 +1915,7 @@ function getPreviousElement(el) {
|
|
|
1915
1915
|
const prev = el.previousSibling;
|
|
1916
1916
|
if (!prev)
|
|
1917
1917
|
return null;
|
|
1918
|
-
if (prev.nodeType === 1 /* ELEMENT_NODE */) {
|
|
1918
|
+
if (prev.nodeType === 1 /* NodeType.ELEMENT_NODE */) {
|
|
1919
1919
|
return prev;
|
|
1920
1920
|
}
|
|
1921
1921
|
else {
|
|
@@ -2259,10 +2259,10 @@ function insertAdjacentHTML(position, html) {
|
|
|
2259
2259
|
function cloneNode(isDeep = false) {
|
|
2260
2260
|
const document = this.ownerDocument;
|
|
2261
2261
|
let newNode;
|
|
2262
|
-
if (this.nodeType === 1 /* ELEMENT_NODE */) {
|
|
2262
|
+
if (this.nodeType === 1 /* NodeType.ELEMENT_NODE */) {
|
|
2263
2263
|
newNode = document.createElement(this.nodeName);
|
|
2264
2264
|
}
|
|
2265
|
-
else if (this.nodeType === 3 /* TEXT_NODE */) {
|
|
2265
|
+
else if (this.nodeType === 3 /* NodeType.TEXT_NODE */) {
|
|
2266
2266
|
newNode = document.createTextNode('');
|
|
2267
2267
|
}
|
|
2268
2268
|
for (const key in this) {
|
|
@@ -2352,26 +2352,43 @@ class TaroEvent {
|
|
|
2352
2352
|
}
|
|
2353
2353
|
get target() {
|
|
2354
2354
|
var _a, _b;
|
|
2355
|
-
const
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
target
|
|
2355
|
+
const cacheTarget = this.cacheTarget;
|
|
2356
|
+
if (!cacheTarget) {
|
|
2357
|
+
const target = Object.create(((_a = this.mpEvent) === null || _a === void 0 ? void 0 : _a.target) || null);
|
|
2358
|
+
const element = env.document.getElementById(target.id);
|
|
2359
|
+
target.dataset = element !== null ? element.dataset : EMPTY_OBJ;
|
|
2360
|
+
for (const key in (_b = this.mpEvent) === null || _b === void 0 ? void 0 : _b.detail) {
|
|
2361
|
+
target[key] = this.mpEvent.detail[key];
|
|
2362
|
+
}
|
|
2363
|
+
this.cacheTarget = target;
|
|
2364
|
+
return target;
|
|
2365
|
+
}
|
|
2366
|
+
else {
|
|
2367
|
+
return cacheTarget;
|
|
2360
2368
|
}
|
|
2361
|
-
return target;
|
|
2362
2369
|
}
|
|
2363
2370
|
get currentTarget() {
|
|
2364
|
-
var _a, _b;
|
|
2365
|
-
const
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2371
|
+
var _a, _b, _c, _d;
|
|
2372
|
+
const cacheCurrentTarget = this.cacheCurrentTarget;
|
|
2373
|
+
if (!cacheCurrentTarget) {
|
|
2374
|
+
const doc = env.document;
|
|
2375
|
+
const currentTarget = Object.create(((_a = this.mpEvent) === null || _a === void 0 ? void 0 : _a.currentTarget) || null);
|
|
2376
|
+
const element = doc.getElementById(currentTarget.id);
|
|
2377
|
+
const targetElement = doc.getElementById(((_c = (_b = this.mpEvent) === null || _b === void 0 ? void 0 : _b.target) === null || _c === void 0 ? void 0 : _c.id) || null);
|
|
2378
|
+
if (element === null || (element && element === targetElement)) {
|
|
2379
|
+
this.cacheCurrentTarget = this.target;
|
|
2380
|
+
return this.target;
|
|
2381
|
+
}
|
|
2382
|
+
currentTarget.dataset = element.dataset;
|
|
2383
|
+
for (const key in (_d = this.mpEvent) === null || _d === void 0 ? void 0 : _d.detail) {
|
|
2384
|
+
currentTarget[key] = this.mpEvent.detail[key];
|
|
2385
|
+
}
|
|
2386
|
+
this.cacheCurrentTarget = currentTarget;
|
|
2387
|
+
return currentTarget;
|
|
2369
2388
|
}
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
currentTarget[key] = this.mpEvent.detail[key];
|
|
2389
|
+
else {
|
|
2390
|
+
return cacheCurrentTarget;
|
|
2373
2391
|
}
|
|
2374
|
-
return currentTarget;
|
|
2375
2392
|
}
|
|
2376
2393
|
}
|
|
2377
2394
|
function createEvent(event, node) {
|
|
@@ -2546,7 +2563,7 @@ class TaroRootElement extends TaroElement {
|
|
|
2546
2563
|
: []);
|
|
2547
2564
|
while (this.updatePayloads.length > 0) {
|
|
2548
2565
|
const { path, value } = this.updatePayloads.shift();
|
|
2549
|
-
if (path.endsWith("cn" /* Childnodes */)) {
|
|
2566
|
+
if (path.endsWith("cn" /* Shortcuts.Childnodes */)) {
|
|
2550
2567
|
resetPaths.add(path);
|
|
2551
2568
|
}
|
|
2552
2569
|
data[path] = value;
|
|
@@ -2642,19 +2659,19 @@ class TaroRootElement extends TaroElement {
|
|
|
2642
2659
|
class TaroText extends TaroNode {
|
|
2643
2660
|
constructor(value) {
|
|
2644
2661
|
super();
|
|
2645
|
-
this.nodeType = 3 /* TEXT_NODE */;
|
|
2662
|
+
this.nodeType = 3 /* NodeType.TEXT_NODE */;
|
|
2646
2663
|
this.nodeName = '#text';
|
|
2647
2664
|
this._value = value;
|
|
2648
2665
|
}
|
|
2649
2666
|
set textContent(text) {
|
|
2650
2667
|
MutationObserver.record({
|
|
2651
2668
|
target: this,
|
|
2652
|
-
type: "characterData" /* CHARACTER_DATA */,
|
|
2669
|
+
type: "characterData" /* MutationRecordType.CHARACTER_DATA */,
|
|
2653
2670
|
oldValue: this._value
|
|
2654
2671
|
});
|
|
2655
2672
|
this._value = text;
|
|
2656
2673
|
this.enqueueUpdate({
|
|
2657
|
-
path: `${this._path}.${"v" /* Text */}`,
|
|
2674
|
+
path: `${this._path}.${"v" /* Shortcuts.Text */}`,
|
|
2658
2675
|
value: text
|
|
2659
2676
|
});
|
|
2660
2677
|
}
|
|
@@ -2679,7 +2696,7 @@ class TaroDocument extends TaroElement {
|
|
|
2679
2696
|
constructor() {
|
|
2680
2697
|
super();
|
|
2681
2698
|
this.createEvent = createEvent;
|
|
2682
|
-
this.nodeType = 9 /* DOCUMENT_NODE */;
|
|
2699
|
+
this.nodeType = 9 /* NodeType.DOCUMENT_NODE */;
|
|
2683
2700
|
this.nodeName = DOCUMENT_ELEMENT_NAME;
|
|
2684
2701
|
}
|
|
2685
2702
|
createElement(type) {
|
|
@@ -2775,7 +2792,7 @@ const machine = 'Macintosh';
|
|
|
2775
2792
|
const arch = 'Intel Mac OS X 10_14_5';
|
|
2776
2793
|
const engine = 'AppleWebKit/534.36 (KHTML, like Gecko) NodeJS/v4.1.0 Chrome/76.0.3809.132 Safari/534.36';
|
|
2777
2794
|
const msg = '(' + machine + '; ' + arch + ') ' + engine;
|
|
2778
|
-
const
|
|
2795
|
+
const nav = process.env.TARO_ENV === 'h5' ? env.window.navigator : {
|
|
2779
2796
|
appCodeName: 'Mozilla',
|
|
2780
2797
|
appName: 'Netscape',
|
|
2781
2798
|
appVersion: '5.0 ' + msg,
|
|
@@ -2810,12 +2827,12 @@ let now;
|
|
|
2810
2827
|
let lastTime = 0;
|
|
2811
2828
|
// https://gist.github.com/paulirish/1579671
|
|
2812
2829
|
// https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
|
|
2813
|
-
const
|
|
2830
|
+
const _raf = typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame !== null ? requestAnimationFrame : function (callback) {
|
|
2814
2831
|
const _now = now();
|
|
2815
2832
|
const nextTime = Math.max(lastTime + 16, _now); // First time will execute it immediately but barely noticeable and performance is gained.
|
|
2816
2833
|
return setTimeout(function () { callback(lastTime = nextTime); }, nextTime - _now);
|
|
2817
2834
|
};
|
|
2818
|
-
const
|
|
2835
|
+
const _caf = typeof cancelAnimationFrame !== 'undefined' && cancelAnimationFrame !== null
|
|
2819
2836
|
? cancelAnimationFrame
|
|
2820
2837
|
: function (seed) {
|
|
2821
2838
|
// fix https://github.com/NervJS/taro/issues/7749
|
|
@@ -2829,9 +2846,9 @@ if (process.env.TARO_ENV && process.env.TARO_ENV !== 'h5') {
|
|
|
2829
2846
|
class Window extends Events {
|
|
2830
2847
|
constructor() {
|
|
2831
2848
|
super();
|
|
2832
|
-
this.navigator =
|
|
2833
|
-
this.requestAnimationFrame =
|
|
2834
|
-
this.cancelAnimationFrame =
|
|
2849
|
+
this.navigator = nav;
|
|
2850
|
+
this.requestAnimationFrame = _raf;
|
|
2851
|
+
this.cancelAnimationFrame = _caf;
|
|
2835
2852
|
this.getComputedStyle = getComputedStyle;
|
|
2836
2853
|
const globalProperties = [
|
|
2837
2854
|
...Object.getOwnPropertyNames(global || {}),
|
|
@@ -3026,7 +3043,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
3026
3043
|
// 触发生命周期
|
|
3027
3044
|
safeExecute(this.$taroPath, ON_READY);
|
|
3028
3045
|
// 通过事件触发子组件的生命周期
|
|
3029
|
-
|
|
3046
|
+
_raf(() => eventCenter.trigger(getOnReadyEventKey(id)));
|
|
3030
3047
|
this.onReady.called = true;
|
|
3031
3048
|
},
|
|
3032
3049
|
[ONSHOW](options = {}) {
|
|
@@ -3037,7 +3054,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
3037
3054
|
// 触发生命周期
|
|
3038
3055
|
safeExecute(this.$taroPath, ON_SHOW, options);
|
|
3039
3056
|
// 通过事件触发子组件的生命周期
|
|
3040
|
-
|
|
3057
|
+
_raf(() => eventCenter.trigger(getOnShowEventKey(id)));
|
|
3041
3058
|
});
|
|
3042
3059
|
},
|
|
3043
3060
|
[ONHIDE]() {
|
|
@@ -3065,7 +3082,7 @@ function createPageConfig(component, pageName, data, pageConfig) {
|
|
|
3065
3082
|
const target = options === null || options === void 0 ? void 0 : options.target;
|
|
3066
3083
|
if (target) {
|
|
3067
3084
|
const id = target.id;
|
|
3068
|
-
const element = document.getElementById(id);
|
|
3085
|
+
const element = env.document.getElementById(id);
|
|
3069
3086
|
if (element) {
|
|
3070
3087
|
target.dataset = element.dataset;
|
|
3071
3088
|
}
|
|
@@ -3152,7 +3169,7 @@ function createRecursiveComponentConfig(componentName) {
|
|
|
3152
3169
|
i: {
|
|
3153
3170
|
type: Object,
|
|
3154
3171
|
value: {
|
|
3155
|
-
["nn" /* NodeName */]: VIEW
|
|
3172
|
+
["nn" /* Shortcuts.NodeName */]: VIEW
|
|
3156
3173
|
}
|
|
3157
3174
|
},
|
|
3158
3175
|
l: {
|
|
@@ -3199,5 +3216,5 @@ const nextTick = (cb, ctx) => {
|
|
|
3199
3216
|
}
|
|
3200
3217
|
};
|
|
3201
3218
|
|
|
3202
|
-
export { Current, FormElement, MutationObserver, SVGElement, Style, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, addLeadingSlash,
|
|
3219
|
+
export { Current, FormElement, MutationObserver, SVGElement, Style, TaroElement, TaroEvent, TaroNode, TaroRootElement, TaroText, addLeadingSlash, _caf as cancelAnimationFrame, createComponentConfig, createEvent, createPageConfig, createRecursiveComponentConfig, document$1 as document, eventCenter, eventHandler, eventSource, getComputedStyle, getCurrentInstance, getPageInstance, hydrate, incrementId, injectPageInstance, nav as navigator, nextTick, now, options, _raf as requestAnimationFrame, safeExecute, stringify, window$1 as window };
|
|
3203
3220
|
//# sourceMappingURL=runtime.esm.js.map
|