lwc 2.7.3 → 2.7.4
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/engine-dom/esm/es2017/engine-dom.js +866 -800
- package/dist/engine-dom/iife/es2017/engine-dom.js +866 -800
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +654 -587
- package/dist/engine-dom/iife/es5/engine-dom.js +912 -848
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +698 -633
- package/dist/engine-dom/umd/es2017/engine-dom.js +866 -800
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +654 -587
- package/dist/engine-dom/umd/es5/engine-dom.js +912 -848
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +698 -633
- package/dist/engine-server/commonjs/es2017/engine-server.js +606 -903
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +606 -903
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +8 -8
|
@@ -339,7 +339,11 @@ function htmlPropertyToAttribute(propName) {
|
|
|
339
339
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
340
340
|
return attributeName;
|
|
341
341
|
}
|
|
342
|
-
|
|
342
|
+
|
|
343
|
+
const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
344
|
+
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
345
|
+
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
346
|
+
/** version: 2.7.4 */
|
|
343
347
|
|
|
344
348
|
/*
|
|
345
349
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -356,7 +360,6 @@ function htmlPropertyToAttribute(propName) {
|
|
|
356
360
|
* polyfilled separately.
|
|
357
361
|
*/
|
|
358
362
|
|
|
359
|
-
|
|
360
363
|
if (typeof Event !== 'function') {
|
|
361
364
|
class Event {}
|
|
362
365
|
|
|
@@ -461,7 +464,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
461
464
|
setFeatureFlag(name, value);
|
|
462
465
|
}
|
|
463
466
|
}
|
|
464
|
-
/** version: 2.7.
|
|
467
|
+
/** version: 2.7.4 */
|
|
465
468
|
|
|
466
469
|
/* proxy-compat-disable */
|
|
467
470
|
|
|
@@ -514,28 +517,7 @@ function guid() {
|
|
|
514
517
|
|
|
515
518
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
516
519
|
} // Borrowed from Vue template compiler.
|
|
517
|
-
//
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
521
|
-
const PROPERTY_DELIMITER = /:(.+)/;
|
|
522
|
-
|
|
523
|
-
function parseStyleText(cssText) {
|
|
524
|
-
const styleMap = {};
|
|
525
|
-
const declarations = cssText.split(DECLARATION_DELIMITER);
|
|
526
|
-
|
|
527
|
-
for (const declaration of declarations) {
|
|
528
|
-
if (declaration) {
|
|
529
|
-
const [prop, value] = declaration.split(PROPERTY_DELIMITER);
|
|
530
|
-
|
|
531
|
-
if (prop !== undefined && value !== undefined) {
|
|
532
|
-
styleMap[prop.trim()] = value.trim();
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
return styleMap;
|
|
538
|
-
} //
|
|
520
|
+
//
|
|
539
521
|
// Primitives
|
|
540
522
|
//
|
|
541
523
|
|
|
@@ -959,6 +941,25 @@ function getErrorComponentStack(vm) {
|
|
|
959
941
|
*/
|
|
960
942
|
|
|
961
943
|
|
|
944
|
+
function addErrorComponentStack(vm, error) {
|
|
945
|
+
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
946
|
+
const wcStack = getErrorComponentStack(vm);
|
|
947
|
+
defineProperty(error, 'wcStack', {
|
|
948
|
+
get() {
|
|
949
|
+
return wcStack;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
/*
|
|
956
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
957
|
+
* All rights reserved.
|
|
958
|
+
* SPDX-License-Identifier: MIT
|
|
959
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
960
|
+
*/
|
|
961
|
+
|
|
962
|
+
|
|
962
963
|
function log(method, message, vm) {
|
|
963
964
|
let msg = `[LWC ${method}]: ${message}`;
|
|
964
965
|
|
|
@@ -983,217 +984,18 @@ function log(method, message, vm) {
|
|
|
983
984
|
function logError(message, vm) {
|
|
984
985
|
log('error', message, vm);
|
|
985
986
|
}
|
|
986
|
-
|
|
987
|
-
function logWarn(message, vm) {
|
|
988
|
-
log('warn', message, vm);
|
|
989
|
-
}
|
|
990
987
|
/*
|
|
991
988
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
992
989
|
* All rights reserved.
|
|
993
990
|
* SPDX-License-Identifier: MIT
|
|
994
991
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
995
992
|
*/
|
|
993
|
+
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
994
|
+
// to inject at runtime.
|
|
996
995
|
|
|
997
996
|
|
|
998
|
-
function
|
|
999
|
-
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
function sameVnode(vnode1, vnode2) {
|
|
1003
|
-
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
function isVNode(vnode) {
|
|
1007
|
-
return vnode != null;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
1011
|
-
const map = {};
|
|
1012
|
-
let j, key, ch; // TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
1013
|
-
|
|
1014
|
-
for (j = beginIdx; j <= endIdx; ++j) {
|
|
1015
|
-
ch = children[j];
|
|
1016
|
-
|
|
1017
|
-
if (isVNode(ch)) {
|
|
1018
|
-
key = ch.key;
|
|
1019
|
-
|
|
1020
|
-
if (key !== undefined) {
|
|
1021
|
-
map[key] = j;
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
return map;
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
|
|
1030
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
1031
|
-
const ch = vnodes[startIdx];
|
|
1032
|
-
|
|
1033
|
-
if (isVNode(ch)) {
|
|
1034
|
-
ch.hook.create(ch);
|
|
1035
|
-
ch.hook.insert(ch, parentElm, before);
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
1041
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
1042
|
-
const ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
1043
|
-
|
|
1044
|
-
if (isVNode(ch)) {
|
|
1045
|
-
ch.hook.remove(ch, parentElm);
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
1051
|
-
let oldStartIdx = 0;
|
|
1052
|
-
let newStartIdx = 0;
|
|
1053
|
-
let oldEndIdx = oldCh.length - 1;
|
|
1054
|
-
let oldStartVnode = oldCh[0];
|
|
1055
|
-
let oldEndVnode = oldCh[oldEndIdx];
|
|
1056
|
-
const newChEnd = newCh.length - 1;
|
|
1057
|
-
let newEndIdx = newChEnd;
|
|
1058
|
-
let newStartVnode = newCh[0];
|
|
1059
|
-
let newEndVnode = newCh[newEndIdx];
|
|
1060
|
-
let oldKeyToIdx;
|
|
1061
|
-
let idxInOld;
|
|
1062
|
-
let elmToMove;
|
|
1063
|
-
let before;
|
|
1064
|
-
|
|
1065
|
-
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
1066
|
-
if (!isVNode(oldStartVnode)) {
|
|
1067
|
-
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
1068
|
-
} else if (!isVNode(oldEndVnode)) {
|
|
1069
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1070
|
-
} else if (!isVNode(newStartVnode)) {
|
|
1071
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1072
|
-
} else if (!isVNode(newEndVnode)) {
|
|
1073
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1074
|
-
} else if (sameVnode(oldStartVnode, newStartVnode)) {
|
|
1075
|
-
patchVnode(oldStartVnode, newStartVnode);
|
|
1076
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
|
1077
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1078
|
-
} else if (sameVnode(oldEndVnode, newEndVnode)) {
|
|
1079
|
-
patchVnode(oldEndVnode, newEndVnode);
|
|
1080
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1081
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1082
|
-
} else if (sameVnode(oldStartVnode, newEndVnode)) {
|
|
1083
|
-
// Vnode moved right
|
|
1084
|
-
patchVnode(oldStartVnode, newEndVnode);
|
|
1085
|
-
newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
|
|
1086
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
|
1087
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1088
|
-
} else if (sameVnode(oldEndVnode, newStartVnode)) {
|
|
1089
|
-
// Vnode moved left
|
|
1090
|
-
patchVnode(oldEndVnode, newStartVnode);
|
|
1091
|
-
newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
|
|
1092
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1093
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1094
|
-
} else {
|
|
1095
|
-
if (oldKeyToIdx === undefined) {
|
|
1096
|
-
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
1100
|
-
|
|
1101
|
-
if (isUndef(idxInOld)) {
|
|
1102
|
-
// New element
|
|
1103
|
-
newStartVnode.hook.create(newStartVnode);
|
|
1104
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
1105
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1106
|
-
} else {
|
|
1107
|
-
elmToMove = oldCh[idxInOld];
|
|
1108
|
-
|
|
1109
|
-
if (isVNode(elmToMove)) {
|
|
1110
|
-
if (elmToMove.sel !== newStartVnode.sel) {
|
|
1111
|
-
// New element
|
|
1112
|
-
newStartVnode.hook.create(newStartVnode);
|
|
1113
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
1114
|
-
} else {
|
|
1115
|
-
patchVnode(elmToMove, newStartVnode);
|
|
1116
|
-
oldCh[idxInOld] = undefined;
|
|
1117
|
-
newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
1127
|
-
if (oldStartIdx > oldEndIdx) {
|
|
1128
|
-
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
1129
|
-
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
1130
|
-
let i = newEndIdx;
|
|
1131
|
-
let n;
|
|
1132
|
-
|
|
1133
|
-
do {
|
|
1134
|
-
n = newCh[++i];
|
|
1135
|
-
} while (!isVNode(n) && i < newChEnd);
|
|
1136
|
-
|
|
1137
|
-
before = isVNode(n) ? n.elm : null;
|
|
1138
|
-
addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
|
|
1139
|
-
} else {
|
|
1140
|
-
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
function updateStaticChildren(parentElm, oldCh, newCh) {
|
|
1146
|
-
const oldChLength = oldCh.length;
|
|
1147
|
-
const newChLength = newCh.length;
|
|
1148
|
-
|
|
1149
|
-
if (oldChLength === 0) {
|
|
1150
|
-
// the old list is empty, we can directly insert anything new
|
|
1151
|
-
addVnodes(parentElm, null, newCh, 0, newChLength);
|
|
1152
|
-
return;
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
if (newChLength === 0) {
|
|
1156
|
-
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
1157
|
-
// this is the case in which the dynamic children of an if-directive should be removed
|
|
1158
|
-
removeVnodes(parentElm, oldCh, 0, oldChLength);
|
|
1159
|
-
return;
|
|
1160
|
-
} // if the old list is not empty, the new list MUST have the same
|
|
1161
|
-
// amount of nodes, that's why we call this static children
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
let referenceElm = null;
|
|
1165
|
-
|
|
1166
|
-
for (let i = newChLength - 1; i >= 0; i -= 1) {
|
|
1167
|
-
const vnode = newCh[i];
|
|
1168
|
-
const oldVNode = oldCh[i];
|
|
1169
|
-
|
|
1170
|
-
if (vnode !== oldVNode) {
|
|
1171
|
-
if (isVNode(oldVNode)) {
|
|
1172
|
-
if (isVNode(vnode)) {
|
|
1173
|
-
// both vnodes must be equivalent, and se just need to patch them
|
|
1174
|
-
patchVnode(oldVNode, vnode);
|
|
1175
|
-
referenceElm = vnode.elm;
|
|
1176
|
-
} else {
|
|
1177
|
-
// removing the old vnode since the new one is null
|
|
1178
|
-
oldVNode.hook.remove(oldVNode, parentElm);
|
|
1179
|
-
}
|
|
1180
|
-
} else if (isVNode(vnode)) {
|
|
1181
|
-
// this condition is unnecessary
|
|
1182
|
-
vnode.hook.create(vnode); // insert the new node one since the old one is null
|
|
1183
|
-
|
|
1184
|
-
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
1185
|
-
referenceElm = vnode.elm;
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
function patchVnode(oldVnode, vnode) {
|
|
1192
|
-
if (oldVnode !== vnode) {
|
|
1193
|
-
vnode.elm = oldVnode.elm;
|
|
1194
|
-
vnode.hook.update(oldVnode, vnode);
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
997
|
+
const HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
|
|
998
|
+
const HTMLElementPrototype = HTMLElementConstructor.prototype;
|
|
1197
999
|
/*
|
|
1198
1000
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1199
1001
|
* All rights reserved.
|
|
@@ -1201,7 +1003,6 @@ function patchVnode(oldVnode, vnode) {
|
|
|
1201
1003
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1202
1004
|
*/
|
|
1203
1005
|
|
|
1204
|
-
|
|
1205
1006
|
const defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
|
|
1206
1007
|
|
|
1207
1008
|
function offsetPropertyErrorMessage(name) {
|
|
@@ -1320,29 +1121,63 @@ function unlockAttribute(elm, key) {
|
|
|
1320
1121
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1321
1122
|
*/
|
|
1322
1123
|
|
|
1124
|
+
/**
|
|
1125
|
+
* This is a descriptor map that contains
|
|
1126
|
+
* all standard properties that a Custom Element can support (including AOM properties), which
|
|
1127
|
+
* determines what kind of capabilities the Base HTML Element and
|
|
1128
|
+
* Base Lightning Element should support.
|
|
1129
|
+
*/
|
|
1323
1130
|
|
|
1324
|
-
function generateDataDescriptor(options) {
|
|
1325
|
-
return assign({
|
|
1326
|
-
configurable: true,
|
|
1327
|
-
enumerable: true,
|
|
1328
|
-
writable: true
|
|
1329
|
-
}, options);
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
function generateAccessorDescriptor(options) {
|
|
1333
|
-
return assign({
|
|
1334
|
-
configurable: true,
|
|
1335
|
-
enumerable: true
|
|
1336
|
-
}, options);
|
|
1337
|
-
}
|
|
1338
1131
|
|
|
1339
|
-
|
|
1132
|
+
const HTMLElementOriginalDescriptors = create(null);
|
|
1133
|
+
forEach.call(keys(AriaPropNameToAttrNameMap), propName => {
|
|
1134
|
+
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1135
|
+
// in IE11, some properties are on Element.prototype instead of HTMLElement, just to be sure.
|
|
1136
|
+
const descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1340
1137
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1138
|
+
if (!isUndefined$1(descriptor)) {
|
|
1139
|
+
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
forEach.call(defaultDefHTMLPropertyNames, propName => {
|
|
1143
|
+
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1144
|
+
// in IE11, id property is on Element.prototype instead of HTMLElement, and we suspect that more will fall into
|
|
1145
|
+
// this category, so, better to be sure.
|
|
1146
|
+
const descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1147
|
+
|
|
1148
|
+
if (!isUndefined$1(descriptor)) {
|
|
1149
|
+
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1152
|
+
/*
|
|
1153
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
1154
|
+
* All rights reserved.
|
|
1155
|
+
* SPDX-License-Identifier: MIT
|
|
1156
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1157
|
+
*/
|
|
1158
|
+
|
|
1159
|
+
function generateDataDescriptor(options) {
|
|
1160
|
+
return assign({
|
|
1161
|
+
configurable: true,
|
|
1162
|
+
enumerable: true,
|
|
1163
|
+
writable: true
|
|
1164
|
+
}, options);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
function generateAccessorDescriptor(options) {
|
|
1168
|
+
return assign({
|
|
1169
|
+
configurable: true,
|
|
1170
|
+
enumerable: true
|
|
1171
|
+
}, options);
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
let isDomMutationAllowed = false;
|
|
1175
|
+
|
|
1176
|
+
function unlockDomMutation() {
|
|
1177
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1178
|
+
// this method should never leak to prod
|
|
1179
|
+
throw new ReferenceError();
|
|
1180
|
+
}
|
|
1346
1181
|
|
|
1347
1182
|
isDomMutationAllowed = true;
|
|
1348
1183
|
}
|
|
@@ -1682,56 +1517,11 @@ function patchComponentWithRestrictions(cmp) {
|
|
|
1682
1517
|
function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
1683
1518
|
defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
|
|
1684
1519
|
}
|
|
1685
|
-
/*
|
|
1686
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1687
|
-
* All rights reserved.
|
|
1688
|
-
* SPDX-License-Identifier: MIT
|
|
1689
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1690
|
-
*/
|
|
1691
|
-
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
1692
|
-
// to inject at runtime.
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
const HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
|
|
1696
|
-
const HTMLElementPrototype = HTMLElementConstructor.prototype;
|
|
1697
|
-
/*
|
|
1698
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1699
|
-
* All rights reserved.
|
|
1700
|
-
* SPDX-License-Identifier: MIT
|
|
1701
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1702
|
-
*/
|
|
1703
|
-
|
|
1704
|
-
/**
|
|
1705
|
-
* This is a descriptor map that contains
|
|
1706
|
-
* all standard properties that a Custom Element can support (including AOM properties), which
|
|
1707
|
-
* determines what kind of capabilities the Base HTML Element and
|
|
1708
|
-
* Base Lightning Element should support.
|
|
1709
|
-
*/
|
|
1710
|
-
|
|
1711
|
-
const HTMLElementOriginalDescriptors = create(null);
|
|
1712
|
-
forEach.call(keys(AriaPropNameToAttrNameMap), propName => {
|
|
1713
|
-
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1714
|
-
// in IE11, some properties are on Element.prototype instead of HTMLElement, just to be sure.
|
|
1715
|
-
const descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1716
|
-
|
|
1717
|
-
if (!isUndefined$1(descriptor)) {
|
|
1718
|
-
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1719
|
-
}
|
|
1720
|
-
});
|
|
1721
|
-
forEach.call(defaultDefHTMLPropertyNames, propName => {
|
|
1722
|
-
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1723
|
-
// in IE11, id property is on Element.prototype instead of HTMLElement, and we suspect that more will fall into
|
|
1724
|
-
// this category, so, better to be sure.
|
|
1725
|
-
const descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1726
|
-
|
|
1727
|
-
if (!isUndefined$1(descriptor)) {
|
|
1728
|
-
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1729
|
-
}
|
|
1730
|
-
});
|
|
1731
1520
|
/**
|
|
1732
1521
|
* Copyright (C) 2017 salesforce.com, inc.
|
|
1733
1522
|
*/
|
|
1734
1523
|
|
|
1524
|
+
|
|
1735
1525
|
const {
|
|
1736
1526
|
isArray
|
|
1737
1527
|
} = Array;
|
|
@@ -2648,7 +2438,9 @@ const LightningElement = function () {
|
|
|
2648
2438
|
if (vm.renderMode === 1
|
|
2649
2439
|
/* Shadow */
|
|
2650
2440
|
) {
|
|
2651
|
-
doAttachShadow(vm);
|
|
2441
|
+
vm.renderRoot = doAttachShadow(vm);
|
|
2442
|
+
} else {
|
|
2443
|
+
vm.renderRoot = elm;
|
|
2652
2444
|
} // Adding extra guard rails in DEV mode.
|
|
2653
2445
|
|
|
2654
2446
|
|
|
@@ -2669,19 +2461,21 @@ function doAttachShadow(vm) {
|
|
|
2669
2461
|
ctor
|
|
2670
2462
|
}
|
|
2671
2463
|
} = vm;
|
|
2672
|
-
const
|
|
2464
|
+
const shadowRoot = attachShadow$1(elm, {
|
|
2673
2465
|
[KEY__SYNTHETIC_MODE]: shadowMode === 1
|
|
2674
2466
|
/* Synthetic */
|
|
2675
2467
|
,
|
|
2676
2468
|
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
2677
2469
|
mode
|
|
2678
2470
|
});
|
|
2679
|
-
vm.
|
|
2680
|
-
associateVM(
|
|
2471
|
+
vm.shadowRoot = shadowRoot;
|
|
2472
|
+
associateVM(shadowRoot, vm);
|
|
2681
2473
|
|
|
2682
2474
|
if (process.env.NODE_ENV !== 'production') {
|
|
2683
|
-
patchShadowRootWithRestrictions(
|
|
2475
|
+
patchShadowRootWithRestrictions(shadowRoot);
|
|
2684
2476
|
}
|
|
2477
|
+
|
|
2478
|
+
return shadowRoot;
|
|
2685
2479
|
}
|
|
2686
2480
|
|
|
2687
2481
|
function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
|
@@ -2849,7 +2643,7 @@ LightningElement.prototype = {
|
|
|
2849
2643
|
}
|
|
2850
2644
|
}
|
|
2851
2645
|
|
|
2852
|
-
return vm.
|
|
2646
|
+
return vm.shadowRoot;
|
|
2853
2647
|
},
|
|
2854
2648
|
|
|
2855
2649
|
get shadowRoot() {
|
|
@@ -4203,6 +3997,65 @@ function getComponentDef(Ctor) {
|
|
|
4203
3997
|
methods: publicMethods
|
|
4204
3998
|
};
|
|
4205
3999
|
}
|
|
4000
|
+
/*
|
|
4001
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4002
|
+
* All rights reserved.
|
|
4003
|
+
* SPDX-License-Identifier: MIT
|
|
4004
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4005
|
+
*/
|
|
4006
|
+
|
|
4007
|
+
|
|
4008
|
+
function getUpgradableConstructor(tagName) {
|
|
4009
|
+
// Should never get a tag with upper case letter at this point, the compiler should
|
|
4010
|
+
// produce only tags with lowercase letters
|
|
4011
|
+
// But, for backwards compatibility, we will lower case the tagName
|
|
4012
|
+
tagName = tagName.toLowerCase();
|
|
4013
|
+
let CE = getCustomElement$1(tagName);
|
|
4014
|
+
|
|
4015
|
+
if (!isUndefined$1(CE)) {
|
|
4016
|
+
return CE;
|
|
4017
|
+
}
|
|
4018
|
+
/**
|
|
4019
|
+
* LWC Upgradable Element reference to an element that was created
|
|
4020
|
+
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
4021
|
+
*/
|
|
4022
|
+
|
|
4023
|
+
|
|
4024
|
+
CE = class LWCUpgradableElement extends HTMLElementExported$1 {
|
|
4025
|
+
constructor(upgradeCallback) {
|
|
4026
|
+
super();
|
|
4027
|
+
|
|
4028
|
+
if (isFunction$1(upgradeCallback)) {
|
|
4029
|
+
upgradeCallback(this); // nothing to do with the result for now
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
|
|
4033
|
+
};
|
|
4034
|
+
defineCustomElement$1(tagName, CE);
|
|
4035
|
+
return CE;
|
|
4036
|
+
}
|
|
4037
|
+
/*
|
|
4038
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4039
|
+
* All rights reserved.
|
|
4040
|
+
* SPDX-License-Identifier: MIT
|
|
4041
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4042
|
+
*/
|
|
4043
|
+
|
|
4044
|
+
|
|
4045
|
+
function isVBaseElement(vnode) {
|
|
4046
|
+
const {
|
|
4047
|
+
type
|
|
4048
|
+
} = vnode;
|
|
4049
|
+
return type === 2
|
|
4050
|
+
/* Element */
|
|
4051
|
+
|| type === 3
|
|
4052
|
+
/* CustomElement */
|
|
4053
|
+
;
|
|
4054
|
+
}
|
|
4055
|
+
|
|
4056
|
+
function isSameVnode(vnode1, vnode2) {
|
|
4057
|
+
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
4058
|
+
}
|
|
4206
4059
|
/*
|
|
4207
4060
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4208
4061
|
* All rights reserved.
|
|
@@ -4211,8 +4064,6 @@ function getComponentDef(Ctor) {
|
|
|
4211
4064
|
*/
|
|
4212
4065
|
|
|
4213
4066
|
|
|
4214
|
-
const xlinkNS = 'http://www.w3.org/1999/xlink';
|
|
4215
|
-
const xmlNS = 'http://www.w3.org/XML/1998/namespace';
|
|
4216
4067
|
const ColonCharCode = 58;
|
|
4217
4068
|
|
|
4218
4069
|
function patchAttributes(oldVnode, vnode) {
|
|
@@ -4243,10 +4094,10 @@ function patchAttributes(oldVnode, vnode) {
|
|
|
4243
4094
|
|
|
4244
4095
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
4245
4096
|
// Assume xml namespace
|
|
4246
|
-
setAttribute$1(elm, key, cur,
|
|
4097
|
+
setAttribute$1(elm, key, cur, XML_NAMESPACE);
|
|
4247
4098
|
} else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
4248
4099
|
// Assume xlink namespace
|
|
4249
|
-
setAttribute$1(elm, key, cur,
|
|
4100
|
+
setAttribute$1(elm, key, cur, XLINK_NAMESPACE);
|
|
4250
4101
|
} else if (isNull(cur) || isUndefined$1(cur)) {
|
|
4251
4102
|
removeAttribute$1(elm, key);
|
|
4252
4103
|
} else {
|
|
@@ -4500,48 +4351,221 @@ function applyStaticStyleAttribute(vnode) {
|
|
|
4500
4351
|
*/
|
|
4501
4352
|
|
|
4502
4353
|
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4354
|
+
const TextHook = {
|
|
4355
|
+
create: vnode => {
|
|
4356
|
+
const {
|
|
4357
|
+
owner
|
|
4358
|
+
} = vnode;
|
|
4359
|
+
const elm = createText$1(vnode.text);
|
|
4360
|
+
linkNodeToShadow(elm, owner);
|
|
4361
|
+
vnode.elm = elm;
|
|
4362
|
+
},
|
|
4363
|
+
update: updateNodeHook,
|
|
4364
|
+
insert: insertNode,
|
|
4365
|
+
move: insertNode,
|
|
4366
|
+
remove: removeNode
|
|
4367
|
+
};
|
|
4368
|
+
const CommentHook = {
|
|
4369
|
+
create: vnode => {
|
|
4370
|
+
const {
|
|
4371
|
+
owner,
|
|
4372
|
+
text
|
|
4373
|
+
} = vnode;
|
|
4374
|
+
const elm = createComment$1(text);
|
|
4375
|
+
linkNodeToShadow(elm, owner);
|
|
4376
|
+
vnode.elm = elm;
|
|
4377
|
+
},
|
|
4378
|
+
update: updateNodeHook,
|
|
4379
|
+
insert: insertNode,
|
|
4380
|
+
move: insertNode,
|
|
4381
|
+
remove: removeNode
|
|
4382
|
+
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4383
|
+
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4384
|
+
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
4385
|
+
// which breaks some invariants. For that reason, we have the following for any
|
|
4386
|
+
// Custom Element that is inserted via a template.
|
|
4518
4387
|
|
|
4519
|
-
|
|
4520
|
-
|
|
4388
|
+
const ElementHook = {
|
|
4389
|
+
create: vnode => {
|
|
4390
|
+
const {
|
|
4391
|
+
sel,
|
|
4392
|
+
owner,
|
|
4393
|
+
data: {
|
|
4394
|
+
svg
|
|
4395
|
+
}
|
|
4396
|
+
} = vnode;
|
|
4397
|
+
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4398
|
+
const elm = createElement$1(sel, namespace);
|
|
4399
|
+
linkNodeToShadow(elm, owner);
|
|
4400
|
+
fallbackElmHook(elm, vnode);
|
|
4401
|
+
vnode.elm = elm;
|
|
4402
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
4403
|
+
},
|
|
4404
|
+
update: (oldVnode, vnode) => {
|
|
4405
|
+
patchElementPropsAndAttrs$1(oldVnode, vnode);
|
|
4406
|
+
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
4407
|
+
},
|
|
4408
|
+
insert: (vnode, parentNode, referenceNode) => {
|
|
4409
|
+
insertNode(vnode, parentNode, referenceNode);
|
|
4410
|
+
createChildrenHook(vnode);
|
|
4411
|
+
},
|
|
4412
|
+
move: insertNode,
|
|
4413
|
+
remove: (vnode, parentNode) => {
|
|
4414
|
+
removeNode(vnode, parentNode);
|
|
4415
|
+
removeChildren(vnode);
|
|
4521
4416
|
}
|
|
4522
|
-
}
|
|
4417
|
+
};
|
|
4418
|
+
const CustomElementHook = {
|
|
4419
|
+
create: vnode => {
|
|
4420
|
+
const {
|
|
4421
|
+
sel,
|
|
4422
|
+
owner
|
|
4423
|
+
} = vnode;
|
|
4424
|
+
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4425
|
+
/**
|
|
4426
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4427
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
4428
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
4429
|
+
* an upgradable custom element.
|
|
4430
|
+
*/
|
|
4523
4431
|
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4432
|
+
let vm;
|
|
4433
|
+
const elm = new UpgradableConstructor(elm => {
|
|
4434
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
4435
|
+
vm = createViewModelHook(elm, vnode);
|
|
4436
|
+
});
|
|
4437
|
+
linkNodeToShadow(elm, owner);
|
|
4438
|
+
vnode.elm = elm;
|
|
4529
4439
|
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4440
|
+
if (vm) {
|
|
4441
|
+
allocateChildren(vnode, vm);
|
|
4442
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
4443
|
+
throw new TypeError(`Incorrect Component Constructor`);
|
|
4533
4444
|
}
|
|
4534
4445
|
|
|
4535
|
-
|
|
4446
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
4447
|
+
},
|
|
4448
|
+
update: (oldVnode, vnode) => {
|
|
4449
|
+
patchElementPropsAndAttrs$1(oldVnode, vnode);
|
|
4450
|
+
const vm = getAssociatedVMIfPresent(vnode.elm);
|
|
4536
4451
|
|
|
4537
|
-
if (
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
}
|
|
4452
|
+
if (vm) {
|
|
4453
|
+
// in fallback mode, the allocation will always set children to
|
|
4454
|
+
// empty and delegate the real allocation to the slot elements
|
|
4455
|
+
allocateChildren(vnode, vm);
|
|
4456
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
4457
|
+
// will happen, but in native, it does allocate the light dom
|
|
4542
4458
|
|
|
4543
|
-
|
|
4544
|
-
|
|
4459
|
+
|
|
4460
|
+
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
4461
|
+
|
|
4462
|
+
if (vm) {
|
|
4463
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4464
|
+
assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
|
|
4465
|
+
} // this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
4466
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
4467
|
+
|
|
4468
|
+
|
|
4469
|
+
rerenderVM(vm);
|
|
4470
|
+
}
|
|
4471
|
+
},
|
|
4472
|
+
insert: (vnode, parentNode, referenceNode) => {
|
|
4473
|
+
insertNode(vnode, parentNode, referenceNode);
|
|
4474
|
+
const vm = getAssociatedVMIfPresent(vnode.elm);
|
|
4475
|
+
|
|
4476
|
+
if (vm) {
|
|
4477
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4478
|
+
assert.isTrue(vm.state === 0
|
|
4479
|
+
/* created */
|
|
4480
|
+
, `${vm} cannot be recycled.`);
|
|
4481
|
+
}
|
|
4482
|
+
|
|
4483
|
+
runConnectedCallback(vm);
|
|
4484
|
+
}
|
|
4485
|
+
|
|
4486
|
+
createChildrenHook(vnode);
|
|
4487
|
+
|
|
4488
|
+
if (vm) {
|
|
4489
|
+
appendVM(vm);
|
|
4490
|
+
}
|
|
4491
|
+
},
|
|
4492
|
+
move: insertNode,
|
|
4493
|
+
remove: (vnode, parentNode) => {
|
|
4494
|
+
removeNode(vnode, parentNode);
|
|
4495
|
+
const vm = getAssociatedVMIfPresent(vnode.elm);
|
|
4496
|
+
|
|
4497
|
+
if (vm) {
|
|
4498
|
+
// for custom elements we don't have to go recursively because the removeVM routine
|
|
4499
|
+
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4500
|
+
removeVM(vm);
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4503
|
+
};
|
|
4504
|
+
|
|
4505
|
+
function isVNode(vnode) {
|
|
4506
|
+
return vnode != null;
|
|
4507
|
+
}
|
|
4508
|
+
|
|
4509
|
+
function observeElementChildNodes(elm) {
|
|
4510
|
+
elm.$domManual$ = true;
|
|
4511
|
+
}
|
|
4512
|
+
|
|
4513
|
+
function setElementShadowToken(elm, token) {
|
|
4514
|
+
elm.$shadowToken$ = token;
|
|
4515
|
+
} // Set the scope token class for *.scoped.css styles
|
|
4516
|
+
|
|
4517
|
+
|
|
4518
|
+
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
4519
|
+
const {
|
|
4520
|
+
cmpTemplate,
|
|
4521
|
+
context
|
|
4522
|
+
} = owner;
|
|
4523
|
+
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
4524
|
+
|
|
4525
|
+
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
4526
|
+
getClassList$1(elm).add(token);
|
|
4527
|
+
}
|
|
4528
|
+
}
|
|
4529
|
+
|
|
4530
|
+
function linkNodeToShadow(elm, owner) {
|
|
4531
|
+
const {
|
|
4532
|
+
renderRoot,
|
|
4533
|
+
renderMode,
|
|
4534
|
+
shadowMode
|
|
4535
|
+
} = owner; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4536
|
+
|
|
4537
|
+
if (isSyntheticShadowDefined$1) {
|
|
4538
|
+
if (shadowMode === 1
|
|
4539
|
+
/* Synthetic */
|
|
4540
|
+
|| renderMode === 0
|
|
4541
|
+
/* Light */
|
|
4542
|
+
) {
|
|
4543
|
+
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
}
|
|
4547
|
+
|
|
4548
|
+
function updateNodeHook(oldVnode, vnode) {
|
|
4549
|
+
const {
|
|
4550
|
+
elm,
|
|
4551
|
+
text
|
|
4552
|
+
} = vnode;
|
|
4553
|
+
|
|
4554
|
+
if (oldVnode.text !== text) {
|
|
4555
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4556
|
+
unlockDomMutation();
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4559
|
+
setText$1(elm, text);
|
|
4560
|
+
|
|
4561
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4562
|
+
lockDomMutation();
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4565
|
+
}
|
|
4566
|
+
|
|
4567
|
+
function insertNode(vnode, parentNode, referenceNode) {
|
|
4568
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4545
4569
|
unlockDomMutation();
|
|
4546
4570
|
}
|
|
4547
4571
|
|
|
@@ -4552,7 +4576,7 @@ function insertNodeHook(vnode, parentNode, referenceNode) {
|
|
|
4552
4576
|
}
|
|
4553
4577
|
}
|
|
4554
4578
|
|
|
4555
|
-
function
|
|
4579
|
+
function removeNode(vnode, parentNode) {
|
|
4556
4580
|
if (process.env.NODE_ENV !== 'production') {
|
|
4557
4581
|
unlockDomMutation();
|
|
4558
4582
|
}
|
|
@@ -4564,7 +4588,7 @@ function removeNodeHook(vnode, parentNode) {
|
|
|
4564
4588
|
}
|
|
4565
4589
|
}
|
|
4566
4590
|
|
|
4567
|
-
function patchElementPropsAndAttrs(oldVnode, vnode) {
|
|
4591
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
4568
4592
|
if (isNull(oldVnode)) {
|
|
4569
4593
|
applyEventListeners(vnode);
|
|
4570
4594
|
applyStaticClassAttribute(vnode);
|
|
@@ -4579,11 +4603,6 @@ function patchElementPropsAndAttrs(oldVnode, vnode) {
|
|
|
4579
4603
|
patchProps(oldVnode, vnode);
|
|
4580
4604
|
}
|
|
4581
4605
|
|
|
4582
|
-
function hydrateElmHook(vnode) {
|
|
4583
|
-
applyEventListeners(vnode);
|
|
4584
|
-
patchProps(null, vnode);
|
|
4585
|
-
}
|
|
4586
|
-
|
|
4587
4606
|
function fallbackElmHook(elm, vnode) {
|
|
4588
4607
|
const {
|
|
4589
4608
|
owner
|
|
@@ -4603,7 +4622,7 @@ function fallbackElmHook(elm, vnode) {
|
|
|
4603
4622
|
} = owner.context;
|
|
4604
4623
|
|
|
4605
4624
|
if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
4606
|
-
/*
|
|
4625
|
+
/* Manual */
|
|
4607
4626
|
) {
|
|
4608
4627
|
// this element will now accept any manual content inserted into it
|
|
4609
4628
|
observeElementChildNodes(elm);
|
|
@@ -4621,7 +4640,7 @@ function fallbackElmHook(elm, vnode) {
|
|
|
4621
4640
|
}
|
|
4622
4641
|
} = vnode;
|
|
4623
4642
|
const isPortal = !isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
4624
|
-
/*
|
|
4643
|
+
/* Manual */
|
|
4625
4644
|
;
|
|
4626
4645
|
const isLight = owner.renderMode === 0
|
|
4627
4646
|
/* Light */
|
|
@@ -4641,7 +4660,7 @@ function patchChildren(parent, oldCh, newCh) {
|
|
|
4641
4660
|
}
|
|
4642
4661
|
}
|
|
4643
4662
|
|
|
4644
|
-
function
|
|
4663
|
+
function allocateChildren(vnode, vm) {
|
|
4645
4664
|
// A component with slots will re-render because:
|
|
4646
4665
|
// 1- There is a change of the internal state.
|
|
4647
4666
|
// 2- There is a change on the external api (ex: slots)
|
|
@@ -4674,11 +4693,12 @@ function allocateChildrenHook(vnode, vm) {
|
|
|
4674
4693
|
}
|
|
4675
4694
|
|
|
4676
4695
|
function createViewModelHook(elm, vnode) {
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4696
|
+
let vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4697
|
+
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
4698
|
+
// called right after invoking `document.createElement`.
|
|
4699
|
+
|
|
4700
|
+
if (!isUndefined$1(vm)) {
|
|
4701
|
+
return vm;
|
|
4682
4702
|
}
|
|
4683
4703
|
|
|
4684
4704
|
const {
|
|
@@ -4700,8 +4720,7 @@ function createViewModelHook(elm, vnode) {
|
|
|
4700
4720
|
setElementShadowToken(elm, stylesheetToken);
|
|
4701
4721
|
}
|
|
4702
4722
|
|
|
4703
|
-
|
|
4704
|
-
createVM(elm, def, {
|
|
4723
|
+
vm = createVM(elm, ctor, {
|
|
4705
4724
|
mode,
|
|
4706
4725
|
owner,
|
|
4707
4726
|
tagName: sel
|
|
@@ -4710,6 +4729,8 @@ function createViewModelHook(elm, vnode) {
|
|
|
4710
4729
|
if (process.env.NODE_ENV !== 'production') {
|
|
4711
4730
|
assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
|
|
4712
4731
|
}
|
|
4732
|
+
|
|
4733
|
+
return vm;
|
|
4713
4734
|
}
|
|
4714
4735
|
|
|
4715
4736
|
function createChildrenHook(vnode) {
|
|
@@ -4728,171 +4749,7 @@ function createChildrenHook(vnode) {
|
|
|
4728
4749
|
}
|
|
4729
4750
|
}
|
|
4730
4751
|
|
|
4731
|
-
function
|
|
4732
|
-
// eslint-disable-next-line lwc-internal/no-global-node
|
|
4733
|
-
return node.nodeType === Node.ELEMENT_NODE;
|
|
4734
|
-
}
|
|
4735
|
-
|
|
4736
|
-
function vnodesAndElementHaveCompatibleAttrs(vnode, elm) {
|
|
4737
|
-
const {
|
|
4738
|
-
data: {
|
|
4739
|
-
attrs = {}
|
|
4740
|
-
}
|
|
4741
|
-
} = vnode;
|
|
4742
|
-
let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4743
|
-
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4744
|
-
|
|
4745
|
-
for (const [attrName, attrValue] of Object.entries(attrs)) {
|
|
4746
|
-
const elmAttrValue = getAttribute$1(elm, attrName);
|
|
4747
|
-
|
|
4748
|
-
if (String(attrValue) !== elmAttrValue) {
|
|
4749
|
-
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, vnode.owner);
|
|
4750
|
-
nodesAreCompatible = false;
|
|
4751
|
-
}
|
|
4752
|
-
}
|
|
4753
|
-
|
|
4754
|
-
return nodesAreCompatible;
|
|
4755
|
-
}
|
|
4756
|
-
|
|
4757
|
-
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4758
|
-
const {
|
|
4759
|
-
data: {
|
|
4760
|
-
className,
|
|
4761
|
-
classMap
|
|
4762
|
-
}
|
|
4763
|
-
} = vnode;
|
|
4764
|
-
let nodesAreCompatible = true;
|
|
4765
|
-
let vnodeClassName;
|
|
4766
|
-
|
|
4767
|
-
if (!isUndefined$1(className) && String(className) !== elm.className) {
|
|
4768
|
-
// className is used when class is bound to an expr.
|
|
4769
|
-
nodesAreCompatible = false;
|
|
4770
|
-
vnodeClassName = className;
|
|
4771
|
-
} else if (!isUndefined$1(classMap)) {
|
|
4772
|
-
// classMap is used when class is set to static value.
|
|
4773
|
-
const classList = getClassList$1(elm);
|
|
4774
|
-
let computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4775
|
-
|
|
4776
|
-
for (const name in classMap) {
|
|
4777
|
-
computedClassName += ' ' + name;
|
|
4778
|
-
|
|
4779
|
-
if (!classList.contains(name)) {
|
|
4780
|
-
nodesAreCompatible = false;
|
|
4781
|
-
}
|
|
4782
|
-
}
|
|
4783
|
-
|
|
4784
|
-
vnodeClassName = computedClassName.trim();
|
|
4785
|
-
|
|
4786
|
-
if (classList.length > keys(classMap).length) {
|
|
4787
|
-
nodesAreCompatible = false;
|
|
4788
|
-
}
|
|
4789
|
-
}
|
|
4790
|
-
|
|
4791
|
-
if (!nodesAreCompatible) {
|
|
4792
|
-
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${elm.className}"`, vnode.owner);
|
|
4793
|
-
}
|
|
4794
|
-
|
|
4795
|
-
return nodesAreCompatible;
|
|
4796
|
-
}
|
|
4797
|
-
|
|
4798
|
-
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4799
|
-
const {
|
|
4800
|
-
data: {
|
|
4801
|
-
style,
|
|
4802
|
-
styleDecls
|
|
4803
|
-
}
|
|
4804
|
-
} = vnode;
|
|
4805
|
-
const elmStyle = getAttribute$1(elm, 'style') || '';
|
|
4806
|
-
let vnodeStyle;
|
|
4807
|
-
let nodesAreCompatible = true;
|
|
4808
|
-
|
|
4809
|
-
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4810
|
-
nodesAreCompatible = false;
|
|
4811
|
-
vnodeStyle = style;
|
|
4812
|
-
} else if (!isUndefined$1(styleDecls)) {
|
|
4813
|
-
const parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4814
|
-
const expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4815
|
-
|
|
4816
|
-
for (let i = 0, n = styleDecls.length; i < n; i++) {
|
|
4817
|
-
const [prop, value, important] = styleDecls[i];
|
|
4818
|
-
expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);
|
|
4819
|
-
const parsedPropValue = parsedVnodeStyle[prop];
|
|
4820
|
-
|
|
4821
|
-
if (isUndefined$1(parsedPropValue)) {
|
|
4822
|
-
nodesAreCompatible = false;
|
|
4823
|
-
} else if (!parsedPropValue.startsWith(value)) {
|
|
4824
|
-
nodesAreCompatible = false;
|
|
4825
|
-
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4826
|
-
nodesAreCompatible = false;
|
|
4827
|
-
}
|
|
4828
|
-
}
|
|
4829
|
-
|
|
4830
|
-
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4831
|
-
nodesAreCompatible = false;
|
|
4832
|
-
}
|
|
4833
|
-
|
|
4834
|
-
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4835
|
-
}
|
|
4836
|
-
|
|
4837
|
-
if (!nodesAreCompatible) {
|
|
4838
|
-
// style is used when class is bound to an expr.
|
|
4839
|
-
logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
|
|
4840
|
-
}
|
|
4841
|
-
|
|
4842
|
-
return nodesAreCompatible;
|
|
4843
|
-
}
|
|
4844
|
-
|
|
4845
|
-
function throwHydrationError() {
|
|
4846
|
-
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4847
|
-
}
|
|
4848
|
-
|
|
4849
|
-
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4850
|
-
var _a, _b;
|
|
4851
|
-
|
|
4852
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4853
|
-
const filteredVNodes = ArrayFilter.call(children, vnode => !!vnode);
|
|
4854
|
-
|
|
4855
|
-
if (elmChildren.length !== filteredVNodes.length) {
|
|
4856
|
-
logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);
|
|
4857
|
-
throwHydrationError();
|
|
4858
|
-
}
|
|
4859
|
-
}
|
|
4860
|
-
|
|
4861
|
-
let elmCurrentChildIdx = 0;
|
|
4862
|
-
|
|
4863
|
-
for (let j = 0, n = children.length; j < n; j++) {
|
|
4864
|
-
const ch = children[j];
|
|
4865
|
-
|
|
4866
|
-
if (ch != null) {
|
|
4867
|
-
const childNode = elmChildren[elmCurrentChildIdx];
|
|
4868
|
-
|
|
4869
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4870
|
-
// VComments and VTexts validation is handled in their hooks
|
|
4871
|
-
if (isElementNode(childNode)) {
|
|
4872
|
-
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4873
|
-
logError(`Hydration mismatch: expecting element with tag "${(_b = ch.sel) === null || _b === void 0 ? void 0 : _b.toLowerCase()}" but found "${childNode.tagName.toLowerCase()}".`, vm);
|
|
4874
|
-
throwHydrationError();
|
|
4875
|
-
} // Note: props are not yet set
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
const hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4879
|
-
const hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4880
|
-
const hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4881
|
-
const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4882
|
-
|
|
4883
|
-
if (!isVNodeAndElementCompatible) {
|
|
4884
|
-
throwHydrationError();
|
|
4885
|
-
}
|
|
4886
|
-
}
|
|
4887
|
-
}
|
|
4888
|
-
|
|
4889
|
-
ch.hook.hydrate(ch, childNode);
|
|
4890
|
-
elmCurrentChildIdx++;
|
|
4891
|
-
}
|
|
4892
|
-
}
|
|
4893
|
-
}
|
|
4894
|
-
|
|
4895
|
-
function removeElmHook(vnode) {
|
|
4752
|
+
function removeChildren(vnode) {
|
|
4896
4753
|
// this method only needs to search on child vnodes from template
|
|
4897
4754
|
// to trigger the remove hook just in case some of those children
|
|
4898
4755
|
// are custom elements.
|
|
@@ -4911,6 +4768,8 @@ function removeElmHook(vnode) {
|
|
|
4911
4768
|
}
|
|
4912
4769
|
|
|
4913
4770
|
function allocateInSlot(vm, children) {
|
|
4771
|
+
var _a;
|
|
4772
|
+
|
|
4914
4773
|
const {
|
|
4915
4774
|
cmpSlots: oldSlots
|
|
4916
4775
|
} = vm;
|
|
@@ -4923,10 +4782,12 @@ function allocateInSlot(vm, children) {
|
|
|
4923
4782
|
continue;
|
|
4924
4783
|
}
|
|
4925
4784
|
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4785
|
+
let slotName = '';
|
|
4786
|
+
|
|
4787
|
+
if (isVBaseElement(vnode)) {
|
|
4788
|
+
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';
|
|
4789
|
+
}
|
|
4790
|
+
|
|
4930
4791
|
const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot
|
|
4931
4792
|
// which might have similar keys. Each vnode will always have a key that
|
|
4932
4793
|
// starts with a numeric character from compiler. In this case, we add a unique
|
|
@@ -4981,332 +4842,205 @@ function markAsDynamicChildren(children) {
|
|
|
4981
4842
|
function hasDynamicChildren(children) {
|
|
4982
4843
|
return FromIteration.has(children);
|
|
4983
4844
|
}
|
|
4984
|
-
/*
|
|
4985
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4986
|
-
* All rights reserved.
|
|
4987
|
-
* SPDX-License-Identifier: MIT
|
|
4988
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4989
|
-
*/
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
function getUpgradableConstructor(tagName) {
|
|
4993
|
-
// Should never get a tag with upper case letter at this point, the compiler should
|
|
4994
|
-
// produce only tags with lowercase letters
|
|
4995
|
-
// But, for backwards compatibility, we will lower case the tagName
|
|
4996
|
-
tagName = tagName.toLowerCase();
|
|
4997
|
-
let CE = getCustomElement$1(tagName);
|
|
4998
|
-
|
|
4999
|
-
if (!isUndefined$1(CE)) {
|
|
5000
|
-
return CE;
|
|
5001
|
-
}
|
|
5002
|
-
/**
|
|
5003
|
-
* LWC Upgradable Element reference to an element that was created
|
|
5004
|
-
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
5005
|
-
*/
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
CE = class LWCUpgradableElement extends HTMLElementExported$1 {
|
|
5009
|
-
constructor(upgradeCallback) {
|
|
5010
|
-
super();
|
|
5011
|
-
|
|
5012
|
-
if (isFunction$1(upgradeCallback)) {
|
|
5013
|
-
upgradeCallback(this); // nothing to do with the result for now
|
|
5014
|
-
}
|
|
5015
|
-
}
|
|
5016
|
-
|
|
5017
|
-
};
|
|
5018
|
-
defineCustomElement$1(tagName, CE);
|
|
5019
|
-
return CE;
|
|
5020
|
-
}
|
|
5021
|
-
/*
|
|
5022
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
5023
|
-
* All rights reserved.
|
|
5024
|
-
* SPDX-License-Identifier: MIT
|
|
5025
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5026
|
-
*/
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
5030
|
-
const SymbolIterator = Symbol.iterator;
|
|
5031
|
-
const TextHook = {
|
|
5032
|
-
create: vnode => {
|
|
5033
|
-
const {
|
|
5034
|
-
owner
|
|
5035
|
-
} = vnode;
|
|
5036
|
-
const elm = createText$1(vnode.text);
|
|
5037
|
-
linkNodeToShadow(elm, owner);
|
|
5038
|
-
vnode.elm = elm;
|
|
5039
|
-
},
|
|
5040
|
-
update: updateNodeHook,
|
|
5041
|
-
insert: insertNodeHook,
|
|
5042
|
-
move: insertNodeHook,
|
|
5043
|
-
remove: removeNodeHook,
|
|
5044
|
-
hydrate: (vNode, node) => {
|
|
5045
|
-
var _a;
|
|
5046
|
-
|
|
5047
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5048
|
-
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5049
|
-
if (node.nodeType !== Node.TEXT_NODE) {
|
|
5050
|
-
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5051
|
-
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5052
|
-
}
|
|
5053
|
-
|
|
5054
|
-
if (node.nodeValue !== vNode.text) {
|
|
5055
|
-
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vNode.owner);
|
|
5056
|
-
}
|
|
5057
|
-
} // always set the text value to the one from the vnode.
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
node.nodeValue = (_a = vNode.text) !== null && _a !== void 0 ? _a : null;
|
|
5061
|
-
vNode.elm = node;
|
|
5062
|
-
}
|
|
5063
|
-
};
|
|
5064
|
-
const CommentHook = {
|
|
5065
|
-
create: vnode => {
|
|
5066
|
-
const {
|
|
5067
|
-
owner,
|
|
5068
|
-
text
|
|
5069
|
-
} = vnode;
|
|
5070
|
-
const elm = createComment$1(text);
|
|
5071
|
-
linkNodeToShadow(elm, owner);
|
|
5072
|
-
vnode.elm = elm;
|
|
5073
|
-
},
|
|
5074
|
-
update: updateNodeHook,
|
|
5075
|
-
insert: insertNodeHook,
|
|
5076
|
-
move: insertNodeHook,
|
|
5077
|
-
remove: removeNodeHook,
|
|
5078
|
-
hydrate: (vNode, node) => {
|
|
5079
|
-
var _a;
|
|
5080
|
-
|
|
5081
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5082
|
-
// eslint-disable-next-line lwc-internal/no-global-node
|
|
5083
|
-
if (node.nodeType !== Node.COMMENT_NODE) {
|
|
5084
|
-
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5085
|
-
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5086
|
-
}
|
|
5087
|
-
|
|
5088
|
-
if (node.nodeValue !== vNode.text) {
|
|
5089
|
-
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vNode.owner);
|
|
5090
|
-
}
|
|
5091
|
-
} // always set the text value to the one from the vnode.
|
|
5092
4845
|
|
|
4846
|
+
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
4847
|
+
const map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
5093
4848
|
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
}
|
|
5097
|
-
}; // insert is called after update, which is used somewhere else (via a module)
|
|
5098
|
-
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
5099
|
-
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
5100
|
-
// which breaks some invariants. For that reason, we have the following for any
|
|
5101
|
-
// Custom Element that is inserted via a template.
|
|
4849
|
+
for (let j = beginIdx; j <= endIdx; ++j) {
|
|
4850
|
+
const ch = children[j];
|
|
5102
4851
|
|
|
5103
|
-
|
|
5104
|
-
create: vnode => {
|
|
5105
|
-
const {
|
|
5106
|
-
sel,
|
|
5107
|
-
owner,
|
|
5108
|
-
data: {
|
|
5109
|
-
svg
|
|
5110
|
-
}
|
|
5111
|
-
} = vnode;
|
|
5112
|
-
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
5113
|
-
const elm = createElement$1(sel, namespace);
|
|
5114
|
-
linkNodeToShadow(elm, owner);
|
|
5115
|
-
fallbackElmHook(elm, vnode);
|
|
5116
|
-
vnode.elm = elm;
|
|
5117
|
-
patchElementPropsAndAttrs(null, vnode);
|
|
5118
|
-
},
|
|
5119
|
-
update: (oldVnode, vnode) => {
|
|
5120
|
-
patchElementPropsAndAttrs(oldVnode, vnode);
|
|
5121
|
-
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
5122
|
-
},
|
|
5123
|
-
insert: (vnode, parentNode, referenceNode) => {
|
|
5124
|
-
insertNodeHook(vnode, parentNode, referenceNode);
|
|
5125
|
-
createChildrenHook(vnode);
|
|
5126
|
-
},
|
|
5127
|
-
move: (vnode, parentNode, referenceNode) => {
|
|
5128
|
-
insertNodeHook(vnode, parentNode, referenceNode);
|
|
5129
|
-
},
|
|
5130
|
-
remove: (vnode, parentNode) => {
|
|
5131
|
-
removeNodeHook(vnode, parentNode);
|
|
5132
|
-
removeElmHook(vnode);
|
|
5133
|
-
},
|
|
5134
|
-
hydrate: (vnode, node) => {
|
|
5135
|
-
const elm = node;
|
|
5136
|
-
vnode.elm = elm;
|
|
5137
|
-
const {
|
|
5138
|
-
context
|
|
5139
|
-
} = vnode.data;
|
|
5140
|
-
const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5141
|
-
/* manual */
|
|
5142
|
-
);
|
|
5143
|
-
|
|
5144
|
-
if (isDomManual) {
|
|
5145
|
-
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5146
|
-
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
4852
|
+
if (isVNode(ch)) {
|
|
5147
4853
|
const {
|
|
5148
|
-
|
|
5149
|
-
} =
|
|
4854
|
+
key
|
|
4855
|
+
} = ch;
|
|
5150
4856
|
|
|
5151
|
-
if (
|
|
5152
|
-
|
|
5153
|
-
delete props.innerHTML;
|
|
5154
|
-
} else {
|
|
5155
|
-
logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);
|
|
5156
|
-
}
|
|
4857
|
+
if (key !== undefined) {
|
|
4858
|
+
map[key] = j;
|
|
5157
4859
|
}
|
|
5158
|
-
}
|
|
5159
|
-
|
|
5160
|
-
hydrateElmHook(vnode);
|
|
5161
|
-
|
|
5162
|
-
if (!isDomManual) {
|
|
5163
|
-
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5164
|
-
}
|
|
5165
|
-
}
|
|
5166
|
-
};
|
|
5167
|
-
const CustomElementHook = {
|
|
5168
|
-
create: vnode => {
|
|
5169
|
-
const {
|
|
5170
|
-
sel,
|
|
5171
|
-
owner
|
|
5172
|
-
} = vnode;
|
|
5173
|
-
const UpgradableConstructor = getUpgradableConstructor(sel);
|
|
5174
|
-
/**
|
|
5175
|
-
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
5176
|
-
* with a callback as the first argument, we could implement a more advanced
|
|
5177
|
-
* mechanism that only passes that argument if the constructor is known to be
|
|
5178
|
-
* an upgradable custom element.
|
|
5179
|
-
*/
|
|
5180
|
-
|
|
5181
|
-
const elm = new UpgradableConstructor(elm => {
|
|
5182
|
-
// the custom element from the registry is expecting an upgrade callback
|
|
5183
|
-
createViewModelHook(elm, vnode);
|
|
5184
|
-
});
|
|
5185
|
-
linkNodeToShadow(elm, owner);
|
|
5186
|
-
vnode.elm = elm;
|
|
5187
|
-
const vm = getAssociatedVMIfPresent(elm);
|
|
5188
|
-
|
|
5189
|
-
if (vm) {
|
|
5190
|
-
allocateChildrenHook(vnode, vm);
|
|
5191
|
-
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
5192
|
-
throw new TypeError(`Incorrect Component Constructor`);
|
|
5193
|
-
}
|
|
5194
|
-
|
|
5195
|
-
patchElementPropsAndAttrs(null, vnode);
|
|
5196
|
-
},
|
|
5197
|
-
update: (oldVnode, vnode) => {
|
|
5198
|
-
patchElementPropsAndAttrs(oldVnode, vnode);
|
|
5199
|
-
const vm = getAssociatedVMIfPresent(vnode.elm);
|
|
5200
|
-
|
|
5201
|
-
if (vm) {
|
|
5202
|
-
// in fallback mode, the allocation will always set children to
|
|
5203
|
-
// empty and delegate the real allocation to the slot elements
|
|
5204
|
-
allocateChildrenHook(vnode, vm);
|
|
5205
|
-
} // in fallback mode, the children will be always empty, so, nothing
|
|
5206
|
-
// will happen, but in native, it does allocate the light dom
|
|
4860
|
+
}
|
|
4861
|
+
}
|
|
5207
4862
|
|
|
4863
|
+
return map;
|
|
4864
|
+
}
|
|
5208
4865
|
|
|
5209
|
-
|
|
4866
|
+
function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
|
|
4867
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
4868
|
+
const ch = vnodes[startIdx];
|
|
5210
4869
|
|
|
5211
|
-
if (
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
4870
|
+
if (isVNode(ch)) {
|
|
4871
|
+
ch.hook.create(ch);
|
|
4872
|
+
ch.hook.insert(ch, parentElm, before);
|
|
4873
|
+
}
|
|
4874
|
+
}
|
|
4875
|
+
}
|
|
5216
4876
|
|
|
4877
|
+
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
4878
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
4879
|
+
const ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
5217
4880
|
|
|
5218
|
-
|
|
4881
|
+
if (isVNode(ch)) {
|
|
4882
|
+
ch.hook.remove(ch, parentElm);
|
|
5219
4883
|
}
|
|
5220
|
-
}
|
|
5221
|
-
|
|
5222
|
-
insertNodeHook(vnode, parentNode, referenceNode);
|
|
5223
|
-
const vm = getAssociatedVMIfPresent(vnode.elm);
|
|
4884
|
+
}
|
|
4885
|
+
}
|
|
5224
4886
|
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
4887
|
+
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
4888
|
+
let oldStartIdx = 0;
|
|
4889
|
+
let newStartIdx = 0;
|
|
4890
|
+
let oldEndIdx = oldCh.length - 1;
|
|
4891
|
+
let oldStartVnode = oldCh[0];
|
|
4892
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
|
4893
|
+
const newChEnd = newCh.length - 1;
|
|
4894
|
+
let newEndIdx = newChEnd;
|
|
4895
|
+
let newStartVnode = newCh[0];
|
|
4896
|
+
let newEndVnode = newCh[newEndIdx];
|
|
4897
|
+
let oldKeyToIdx;
|
|
4898
|
+
let idxInOld;
|
|
4899
|
+
let elmToMove;
|
|
4900
|
+
let before;
|
|
4901
|
+
|
|
4902
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
4903
|
+
if (!isVNode(oldStartVnode)) {
|
|
4904
|
+
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
4905
|
+
} else if (!isVNode(oldEndVnode)) {
|
|
4906
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4907
|
+
} else if (!isVNode(newStartVnode)) {
|
|
4908
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4909
|
+
} else if (!isVNode(newEndVnode)) {
|
|
4910
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4911
|
+
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4912
|
+
patchVnode(oldStartVnode, newStartVnode);
|
|
4913
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
4914
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4915
|
+
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4916
|
+
patchVnode(oldEndVnode, newEndVnode);
|
|
4917
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4918
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4919
|
+
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4920
|
+
// Vnode moved right
|
|
4921
|
+
patchVnode(oldStartVnode, newEndVnode);
|
|
4922
|
+
newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
|
|
4923
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
4924
|
+
newEndVnode = newCh[--newEndIdx];
|
|
4925
|
+
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4926
|
+
// Vnode moved left
|
|
4927
|
+
patchVnode(oldEndVnode, newStartVnode);
|
|
4928
|
+
newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
|
|
4929
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
4930
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4931
|
+
} else {
|
|
4932
|
+
if (oldKeyToIdx === undefined) {
|
|
4933
|
+
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
5230
4934
|
}
|
|
5231
4935
|
|
|
5232
|
-
|
|
5233
|
-
}
|
|
4936
|
+
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
5234
4937
|
|
|
5235
|
-
|
|
4938
|
+
if (isUndefined$1(idxInOld)) {
|
|
4939
|
+
// New element
|
|
4940
|
+
newStartVnode.hook.create(newStartVnode);
|
|
4941
|
+
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
4942
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4943
|
+
} else {
|
|
4944
|
+
elmToMove = oldCh[idxInOld];
|
|
5236
4945
|
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
4946
|
+
if (isVNode(elmToMove)) {
|
|
4947
|
+
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4948
|
+
// New element
|
|
4949
|
+
newStartVnode.hook.create(newStartVnode);
|
|
4950
|
+
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
4951
|
+
} else {
|
|
4952
|
+
patchVnode(elmToMove, newStartVnode);
|
|
4953
|
+
oldCh[idxInOld] = undefined;
|
|
4954
|
+
newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
|
|
4955
|
+
}
|
|
4956
|
+
}
|
|
5247
4957
|
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
5251
|
-
removeVM(vm);
|
|
4958
|
+
newStartVnode = newCh[++newStartIdx];
|
|
4959
|
+
}
|
|
5252
4960
|
}
|
|
5253
|
-
}
|
|
5254
|
-
hydrate: (vnode, elm) => {
|
|
5255
|
-
// the element is created, but the vm is not
|
|
5256
|
-
const {
|
|
5257
|
-
sel,
|
|
5258
|
-
mode,
|
|
5259
|
-
ctor,
|
|
5260
|
-
owner
|
|
5261
|
-
} = vnode;
|
|
5262
|
-
const def = getComponentInternalDef(ctor);
|
|
5263
|
-
createVM(elm, def, {
|
|
5264
|
-
mode,
|
|
5265
|
-
owner,
|
|
5266
|
-
tagName: sel
|
|
5267
|
-
});
|
|
5268
|
-
vnode.elm = elm;
|
|
5269
|
-
const vm = getAssociatedVM(elm);
|
|
5270
|
-
allocateChildrenHook(vnode, vm);
|
|
5271
|
-
hydrateElmHook(vnode); // Insert hook section:
|
|
4961
|
+
}
|
|
5272
4962
|
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
,
|
|
5277
|
-
|
|
4963
|
+
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
4964
|
+
if (oldStartIdx > oldEndIdx) {
|
|
4965
|
+
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
4966
|
+
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
4967
|
+
let i = newEndIdx;
|
|
4968
|
+
let n;
|
|
5278
4969
|
|
|
5279
|
-
|
|
4970
|
+
do {
|
|
4971
|
+
n = newCh[++i];
|
|
4972
|
+
} while (!isVNode(n) && i < newChEnd);
|
|
5280
4973
|
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5286
|
-
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
4974
|
+
before = isVNode(n) ? n.elm : null;
|
|
4975
|
+
addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
|
|
4976
|
+
} else {
|
|
4977
|
+
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
|
5287
4978
|
}
|
|
4979
|
+
}
|
|
4980
|
+
}
|
|
4981
|
+
|
|
4982
|
+
function updateStaticChildren(parentElm, oldCh, newCh) {
|
|
4983
|
+
const oldChLength = oldCh.length;
|
|
4984
|
+
const newChLength = newCh.length;
|
|
5288
4985
|
|
|
5289
|
-
|
|
4986
|
+
if (oldChLength === 0) {
|
|
4987
|
+
// the old list is empty, we can directly insert anything new
|
|
4988
|
+
addVnodes(parentElm, null, newCh, 0, newChLength);
|
|
4989
|
+
return;
|
|
5290
4990
|
}
|
|
5291
|
-
};
|
|
5292
4991
|
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
4992
|
+
if (newChLength === 0) {
|
|
4993
|
+
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4994
|
+
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4995
|
+
removeVnodes(parentElm, oldCh, 0, oldChLength);
|
|
4996
|
+
return;
|
|
4997
|
+
} // if the old list is not empty, the new list MUST have the same
|
|
4998
|
+
// amount of nodes, that's why we call this static children
|
|
5298
4999
|
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5000
|
+
|
|
5001
|
+
let referenceElm = null;
|
|
5002
|
+
|
|
5003
|
+
for (let i = newChLength - 1; i >= 0; i -= 1) {
|
|
5004
|
+
const vnode = newCh[i];
|
|
5005
|
+
const oldVNode = oldCh[i];
|
|
5006
|
+
|
|
5007
|
+
if (vnode !== oldVNode) {
|
|
5008
|
+
if (isVNode(oldVNode)) {
|
|
5009
|
+
if (isVNode(vnode)) {
|
|
5010
|
+
// both vnodes must be equivalent, and se just need to patch them
|
|
5011
|
+
patchVnode(oldVNode, vnode);
|
|
5012
|
+
referenceElm = vnode.elm;
|
|
5013
|
+
} else {
|
|
5014
|
+
// removing the old vnode since the new one is null
|
|
5015
|
+
oldVNode.hook.remove(oldVNode, parentElm);
|
|
5016
|
+
}
|
|
5017
|
+
} else if (isVNode(vnode)) {
|
|
5018
|
+
// this condition is unnecessary
|
|
5019
|
+
vnode.hook.create(vnode); // insert the new node one since the old one is null
|
|
5020
|
+
|
|
5021
|
+
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
5022
|
+
referenceElm = vnode.elm;
|
|
5023
|
+
}
|
|
5306
5024
|
}
|
|
5307
5025
|
}
|
|
5308
5026
|
}
|
|
5309
5027
|
|
|
5028
|
+
function patchVnode(oldVnode, vnode) {
|
|
5029
|
+
if (oldVnode !== vnode) {
|
|
5030
|
+
vnode.elm = oldVnode.elm;
|
|
5031
|
+
vnode.hook.update(oldVnode, vnode);
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
/*
|
|
5035
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
5036
|
+
* All rights reserved.
|
|
5037
|
+
* SPDX-License-Identifier: MIT
|
|
5038
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5039
|
+
*/
|
|
5040
|
+
|
|
5041
|
+
|
|
5042
|
+
const SymbolIterator = Symbol.iterator;
|
|
5043
|
+
|
|
5310
5044
|
function addVNodeToChildLWC(vnode) {
|
|
5311
5045
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
5312
5046
|
} // [h]tml node
|
|
@@ -5330,20 +5064,22 @@ function h(sel, data, children) {
|
|
|
5330
5064
|
|
|
5331
5065
|
forEach.call(children, childVnode => {
|
|
5332
5066
|
if (childVnode != null) {
|
|
5333
|
-
assert.isTrue(
|
|
5067
|
+
assert.isTrue('type' in childVnode && 'sel' in childVnode && 'elm' in childVnode && 'key' in childVnode, `${childVnode} is not a vnode.`);
|
|
5334
5068
|
}
|
|
5335
5069
|
});
|
|
5336
5070
|
}
|
|
5337
5071
|
|
|
5338
|
-
let
|
|
5072
|
+
let elm;
|
|
5339
5073
|
const {
|
|
5340
5074
|
key
|
|
5341
5075
|
} = data;
|
|
5342
5076
|
return {
|
|
5077
|
+
type: 2
|
|
5078
|
+
/* Element */
|
|
5079
|
+
,
|
|
5343
5080
|
sel,
|
|
5344
5081
|
data,
|
|
5345
5082
|
children,
|
|
5346
|
-
text,
|
|
5347
5083
|
elm,
|
|
5348
5084
|
key,
|
|
5349
5085
|
hook: ElementHook,
|
|
@@ -5424,7 +5160,7 @@ function c(sel, Ctor, data, children = EmptyArray) {
|
|
|
5424
5160
|
if (arguments.length === 4) {
|
|
5425
5161
|
forEach.call(children, childVnode => {
|
|
5426
5162
|
if (childVnode != null) {
|
|
5427
|
-
assert.isTrue(
|
|
5163
|
+
assert.isTrue('type' in childVnode && 'sel' in childVnode && 'elm' in childVnode && 'key' in childVnode, `${childVnode} is not a vnode.`);
|
|
5428
5164
|
}
|
|
5429
5165
|
});
|
|
5430
5166
|
}
|
|
@@ -5433,12 +5169,14 @@ function c(sel, Ctor, data, children = EmptyArray) {
|
|
|
5433
5169
|
const {
|
|
5434
5170
|
key
|
|
5435
5171
|
} = data;
|
|
5436
|
-
let
|
|
5172
|
+
let elm;
|
|
5437
5173
|
const vnode = {
|
|
5174
|
+
type: 3
|
|
5175
|
+
/* CustomElement */
|
|
5176
|
+
,
|
|
5438
5177
|
sel,
|
|
5439
5178
|
data,
|
|
5440
5179
|
children,
|
|
5441
|
-
text,
|
|
5442
5180
|
elm,
|
|
5443
5181
|
key,
|
|
5444
5182
|
hook: CustomElementHook,
|
|
@@ -5566,12 +5304,12 @@ function f(items) {
|
|
|
5566
5304
|
|
|
5567
5305
|
|
|
5568
5306
|
function t(text) {
|
|
5569
|
-
|
|
5570
|
-
let sel, children, key, elm;
|
|
5307
|
+
let sel, key, elm;
|
|
5571
5308
|
return {
|
|
5309
|
+
type: 0
|
|
5310
|
+
/* Text */
|
|
5311
|
+
,
|
|
5572
5312
|
sel,
|
|
5573
|
-
data,
|
|
5574
|
-
children,
|
|
5575
5313
|
text,
|
|
5576
5314
|
elm,
|
|
5577
5315
|
key,
|
|
@@ -5582,12 +5320,12 @@ function t(text) {
|
|
|
5582
5320
|
|
|
5583
5321
|
|
|
5584
5322
|
function co(text) {
|
|
5585
|
-
|
|
5586
|
-
let sel, children, key, elm;
|
|
5323
|
+
let sel, key, elm;
|
|
5587
5324
|
return {
|
|
5325
|
+
type: 1
|
|
5326
|
+
/* Comment */
|
|
5327
|
+
,
|
|
5588
5328
|
sel,
|
|
5589
|
-
data,
|
|
5590
|
-
children,
|
|
5591
5329
|
text,
|
|
5592
5330
|
elm,
|
|
5593
5331
|
key,
|
|
@@ -6025,7 +5763,7 @@ function createStylesheet(vm, stylesheets) {
|
|
|
6025
5763
|
insertGlobalStylesheet$1(stylesheets[i]);
|
|
6026
5764
|
} else {
|
|
6027
5765
|
// local level
|
|
6028
|
-
insertStylesheet$1(stylesheets[i], root.
|
|
5766
|
+
insertStylesheet$1(stylesheets[i], root.shadowRoot);
|
|
6029
5767
|
}
|
|
6030
5768
|
}
|
|
6031
5769
|
}
|
|
@@ -6280,25 +6018,6 @@ function computeHasScopedStyles(template) {
|
|
|
6280
6018
|
*/
|
|
6281
6019
|
|
|
6282
6020
|
|
|
6283
|
-
function addErrorComponentStack(vm, error) {
|
|
6284
|
-
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
6285
|
-
const wcStack = getErrorComponentStack(vm);
|
|
6286
|
-
defineProperty(error, 'wcStack', {
|
|
6287
|
-
get() {
|
|
6288
|
-
return wcStack;
|
|
6289
|
-
}
|
|
6290
|
-
|
|
6291
|
-
});
|
|
6292
|
-
}
|
|
6293
|
-
}
|
|
6294
|
-
/*
|
|
6295
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6296
|
-
* All rights reserved.
|
|
6297
|
-
* SPDX-License-Identifier: MIT
|
|
6298
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6299
|
-
*/
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
6021
|
let isInvokingRender = false;
|
|
6303
6022
|
let vmBeingConstructed = null;
|
|
6304
6023
|
|
|
@@ -6591,12 +6310,7 @@ function disconnectRootElement(elm) {
|
|
|
6591
6310
|
|
|
6592
6311
|
function appendVM(vm) {
|
|
6593
6312
|
rehydrate(vm);
|
|
6594
|
-
}
|
|
6595
|
-
|
|
6596
|
-
function hydrateVM(vm) {
|
|
6597
|
-
hydrate(vm);
|
|
6598
|
-
} // just in case the component comes back, with this we guarantee re-rendering it
|
|
6599
|
-
// while preventing any attempt to rehydration until after reinsertion.
|
|
6313
|
+
} // while preventing any attempt to rehydration until after reinsertion.
|
|
6600
6314
|
|
|
6601
6315
|
|
|
6602
6316
|
function resetComponentStateWhenRemoved(vm) {
|
|
@@ -6655,12 +6369,13 @@ function getNearestShadowAncestor(vm) {
|
|
|
6655
6369
|
return ancestor;
|
|
6656
6370
|
}
|
|
6657
6371
|
|
|
6658
|
-
function createVM(elm,
|
|
6372
|
+
function createVM(elm, ctor, options) {
|
|
6659
6373
|
const {
|
|
6660
6374
|
mode,
|
|
6661
6375
|
owner,
|
|
6662
6376
|
tagName
|
|
6663
6377
|
} = options;
|
|
6378
|
+
const def = getComponentInternalDef(ctor);
|
|
6664
6379
|
const vm = {
|
|
6665
6380
|
elm,
|
|
6666
6381
|
def,
|
|
@@ -6682,7 +6397,6 @@ function createVM(elm, def, options) {
|
|
|
6682
6397
|
oar: create(null),
|
|
6683
6398
|
cmpTemplate: null,
|
|
6684
6399
|
renderMode: def.renderMode,
|
|
6685
|
-
shadowMode: null,
|
|
6686
6400
|
context: {
|
|
6687
6401
|
stylesheetToken: undefined,
|
|
6688
6402
|
hasTokenInClass: undefined,
|
|
@@ -6693,9 +6407,13 @@ function createVM(elm, def, options) {
|
|
|
6693
6407
|
wiredConnecting: EmptyArray,
|
|
6694
6408
|
wiredDisconnecting: EmptyArray
|
|
6695
6409
|
},
|
|
6410
|
+
// Properties set right after VM creation.
|
|
6696
6411
|
tro: null,
|
|
6412
|
+
shadowMode: null,
|
|
6413
|
+
// Properties set by the LightningElement constructor.
|
|
6697
6414
|
component: null,
|
|
6698
|
-
|
|
6415
|
+
shadowRoot: null,
|
|
6416
|
+
renderRoot: null,
|
|
6699
6417
|
callHook,
|
|
6700
6418
|
setHook,
|
|
6701
6419
|
getHook
|
|
@@ -6783,7 +6501,7 @@ function computeShadowMode(vm) {
|
|
|
6783
6501
|
}
|
|
6784
6502
|
|
|
6785
6503
|
function assertIsVM(obj) {
|
|
6786
|
-
if (isNull(obj) || !isObject(obj) || !('
|
|
6504
|
+
if (isNull(obj) || !isObject(obj) || !('renderRoot' in obj)) {
|
|
6787
6505
|
throw new TypeError(`${obj} is not a VM.`);
|
|
6788
6506
|
}
|
|
6789
6507
|
}
|
|
@@ -6821,24 +6539,9 @@ function rehydrate(vm) {
|
|
|
6821
6539
|
}
|
|
6822
6540
|
}
|
|
6823
6541
|
|
|
6824
|
-
function hydrate(vm) {
|
|
6825
|
-
if (isTrue(vm.isDirty)) {
|
|
6826
|
-
// manually diffing/patching here.
|
|
6827
|
-
// This routine is:
|
|
6828
|
-
// patchShadowRoot(vm, children);
|
|
6829
|
-
// -> addVnodes.
|
|
6830
|
-
const children = renderComponent$1(vm);
|
|
6831
|
-
vm.children = children;
|
|
6832
|
-
const vmChildren = vm.renderMode === 0
|
|
6833
|
-
/* Light */
|
|
6834
|
-
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6835
|
-
hydrateChildrenHook(vmChildren, children, vm);
|
|
6836
|
-
runRenderedCallback(vm);
|
|
6837
|
-
}
|
|
6838
|
-
}
|
|
6839
|
-
|
|
6840
6542
|
function patchShadowRoot(vm, newCh) {
|
|
6841
6543
|
const {
|
|
6544
|
+
renderRoot,
|
|
6842
6545
|
children: oldCh
|
|
6843
6546
|
} = vm; // caching the new children collection
|
|
6844
6547
|
|
|
@@ -6855,7 +6558,6 @@ function patchShadowRoot(vm, newCh) {
|
|
|
6855
6558
|
, vm);
|
|
6856
6559
|
}, () => {
|
|
6857
6560
|
// job
|
|
6858
|
-
const renderRoot = getRenderRoot(vm);
|
|
6859
6561
|
patchChildren(renderRoot, oldCh, newCh);
|
|
6860
6562
|
}, () => {
|
|
6861
6563
|
// post
|
|
@@ -7091,14 +6793,22 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
7091
6793
|
for (let i = 0, len = vnodes.length; i < len; i += 1) {
|
|
7092
6794
|
const vnode = vnodes[i];
|
|
7093
6795
|
|
|
7094
|
-
if (!isNull(vnode) &&
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
6796
|
+
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
6797
|
+
switch (vnode.type) {
|
|
6798
|
+
case 2
|
|
6799
|
+
/* Element */
|
|
6800
|
+
:
|
|
6801
|
+
recursivelyDisconnectChildren(vnode.children);
|
|
6802
|
+
break;
|
|
6803
|
+
|
|
6804
|
+
case 3
|
|
6805
|
+
/* CustomElement */
|
|
6806
|
+
:
|
|
6807
|
+
{
|
|
6808
|
+
const vm = getAssociatedVM(vnode.elm);
|
|
6809
|
+
resetComponentStateWhenRemoved(vm);
|
|
6810
|
+
break;
|
|
6811
|
+
}
|
|
7102
6812
|
}
|
|
7103
6813
|
}
|
|
7104
6814
|
}
|
|
@@ -7110,15 +6820,15 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
7110
6820
|
|
|
7111
6821
|
function resetComponentRoot(vm) {
|
|
7112
6822
|
const {
|
|
7113
|
-
children
|
|
6823
|
+
children,
|
|
6824
|
+
renderRoot
|
|
7114
6825
|
} = vm;
|
|
7115
|
-
const rootNode = getRenderRoot(vm);
|
|
7116
6826
|
|
|
7117
6827
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
7118
6828
|
const child = children[i];
|
|
7119
6829
|
|
|
7120
6830
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
7121
|
-
remove$1(child.elm,
|
|
6831
|
+
remove$1(child.elm, renderRoot);
|
|
7122
6832
|
}
|
|
7123
6833
|
}
|
|
7124
6834
|
|
|
@@ -7186,12 +6896,6 @@ function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
|
7186
6896
|
}
|
|
7187
6897
|
}
|
|
7188
6898
|
}
|
|
7189
|
-
|
|
7190
|
-
function getRenderRoot(vm) {
|
|
7191
|
-
return vm.renderMode === 1
|
|
7192
|
-
/* Shadow */
|
|
7193
|
-
? vm.cmpRoot : vm.elm;
|
|
7194
|
-
}
|
|
7195
6899
|
/*
|
|
7196
6900
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
7197
6901
|
* All rights reserved.
|
|
@@ -7583,7 +7287,7 @@ function setHooks(hooks) {
|
|
|
7583
7287
|
hooksAreSet = true;
|
|
7584
7288
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7585
7289
|
}
|
|
7586
|
-
/* version: 2.7.
|
|
7290
|
+
/* version: 2.7.4 */
|
|
7587
7291
|
|
|
7588
7292
|
/*
|
|
7589
7293
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -8022,7 +7726,7 @@ function serializeChildNodes(children) {
|
|
|
8022
7726
|
return children.map(child => {
|
|
8023
7727
|
switch (child.type) {
|
|
8024
7728
|
case HostNodeType.Text:
|
|
8025
|
-
return htmlEscape(child.value);
|
|
7729
|
+
return child.value === '' ? '\u200D' : htmlEscape(child.value);
|
|
8026
7730
|
|
|
8027
7731
|
case HostNodeType.Comment:
|
|
8028
7732
|
return `<!--${htmlEscape(child.value)}-->`;
|
|
@@ -8099,8 +7803,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
8099
7803
|
}
|
|
8100
7804
|
|
|
8101
7805
|
const element = createElement(tagName);
|
|
8102
|
-
|
|
8103
|
-
createVM(element, def, {
|
|
7806
|
+
createVM(element, Ctor, {
|
|
8104
7807
|
mode: 'open',
|
|
8105
7808
|
owner: null,
|
|
8106
7809
|
tagName
|
|
@@ -8124,7 +7827,7 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
8124
7827
|
|
|
8125
7828
|
freeze(LightningElement);
|
|
8126
7829
|
seal(LightningElement.prototype);
|
|
8127
|
-
/* version: 2.7.
|
|
7830
|
+
/* version: 2.7.4 */
|
|
8128
7831
|
|
|
8129
7832
|
exports.LightningElement = LightningElement;
|
|
8130
7833
|
exports.api = api$1;
|