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
|
@@ -351,7 +351,11 @@
|
|
|
351
351
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
352
352
|
return attributeName;
|
|
353
353
|
}
|
|
354
|
-
|
|
354
|
+
|
|
355
|
+
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
|
|
356
|
+
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
357
|
+
var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
|
|
358
|
+
/** version: 2.7.4 */
|
|
355
359
|
|
|
356
360
|
/*
|
|
357
361
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -360,7 +364,6 @@
|
|
|
360
364
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
361
365
|
*/
|
|
362
366
|
|
|
363
|
-
|
|
364
367
|
function detect(propName) {
|
|
365
368
|
return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;
|
|
366
369
|
}
|
|
@@ -529,7 +532,7 @@
|
|
|
529
532
|
setFeatureFlag(name, value);
|
|
530
533
|
}
|
|
531
534
|
}
|
|
532
|
-
/** version: 2.7.
|
|
535
|
+
/** version: 2.7.4 */
|
|
533
536
|
|
|
534
537
|
/* proxy-compat-disable */
|
|
535
538
|
|
|
@@ -1048,6 +1051,24 @@
|
|
|
1048
1051
|
*/
|
|
1049
1052
|
|
|
1050
1053
|
|
|
1054
|
+
function addErrorComponentStack(vm, error) {
|
|
1055
|
+
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
1056
|
+
var wcStack = getErrorComponentStack(vm);
|
|
1057
|
+
defineProperty(error, 'wcStack', {
|
|
1058
|
+
get: function get() {
|
|
1059
|
+
return wcStack;
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
/*
|
|
1065
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
1066
|
+
* All rights reserved.
|
|
1067
|
+
* SPDX-License-Identifier: MIT
|
|
1068
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1069
|
+
*/
|
|
1070
|
+
|
|
1071
|
+
|
|
1051
1072
|
function log(method, message, vm) {
|
|
1052
1073
|
var msg = "[LWC ".concat(method, "]: ").concat(message);
|
|
1053
1074
|
|
|
@@ -1082,207 +1103,12 @@
|
|
|
1082
1103
|
* SPDX-License-Identifier: MIT
|
|
1083
1104
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1084
1105
|
*/
|
|
1106
|
+
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
1107
|
+
// to inject at runtime.
|
|
1085
1108
|
|
|
1086
1109
|
|
|
1087
|
-
function
|
|
1088
|
-
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
function sameVnode(vnode1, vnode2) {
|
|
1092
|
-
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
function isVNode(vnode) {
|
|
1096
|
-
return vnode != null;
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
1100
|
-
var map = {};
|
|
1101
|
-
var j, key, ch; // TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
1102
|
-
|
|
1103
|
-
for (j = beginIdx; j <= endIdx; ++j) {
|
|
1104
|
-
ch = children[j];
|
|
1105
|
-
|
|
1106
|
-
if (isVNode(ch)) {
|
|
1107
|
-
key = ch.key;
|
|
1108
|
-
|
|
1109
|
-
if (key !== undefined) {
|
|
1110
|
-
map[key] = j;
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
return map;
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
|
|
1119
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
1120
|
-
var ch = vnodes[startIdx];
|
|
1121
|
-
|
|
1122
|
-
if (isVNode(ch)) {
|
|
1123
|
-
ch.hook.create(ch);
|
|
1124
|
-
ch.hook.insert(ch, parentElm, before);
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
1130
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
1131
|
-
var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
1132
|
-
|
|
1133
|
-
if (isVNode(ch)) {
|
|
1134
|
-
ch.hook.remove(ch, parentElm);
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
1140
|
-
var oldStartIdx = 0;
|
|
1141
|
-
var newStartIdx = 0;
|
|
1142
|
-
var oldEndIdx = oldCh.length - 1;
|
|
1143
|
-
var oldStartVnode = oldCh[0];
|
|
1144
|
-
var oldEndVnode = oldCh[oldEndIdx];
|
|
1145
|
-
var newChEnd = newCh.length - 1;
|
|
1146
|
-
var newEndIdx = newChEnd;
|
|
1147
|
-
var newStartVnode = newCh[0];
|
|
1148
|
-
var newEndVnode = newCh[newEndIdx];
|
|
1149
|
-
var oldKeyToIdx;
|
|
1150
|
-
var idxInOld;
|
|
1151
|
-
var elmToMove;
|
|
1152
|
-
var before;
|
|
1153
|
-
|
|
1154
|
-
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
1155
|
-
if (!isVNode(oldStartVnode)) {
|
|
1156
|
-
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
1157
|
-
} else if (!isVNode(oldEndVnode)) {
|
|
1158
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1159
|
-
} else if (!isVNode(newStartVnode)) {
|
|
1160
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1161
|
-
} else if (!isVNode(newEndVnode)) {
|
|
1162
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1163
|
-
} else if (sameVnode(oldStartVnode, newStartVnode)) {
|
|
1164
|
-
patchVnode(oldStartVnode, newStartVnode);
|
|
1165
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
|
1166
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1167
|
-
} else if (sameVnode(oldEndVnode, newEndVnode)) {
|
|
1168
|
-
patchVnode(oldEndVnode, newEndVnode);
|
|
1169
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1170
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1171
|
-
} else if (sameVnode(oldStartVnode, newEndVnode)) {
|
|
1172
|
-
// Vnode moved right
|
|
1173
|
-
patchVnode(oldStartVnode, newEndVnode);
|
|
1174
|
-
newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
|
|
1175
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
|
1176
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1177
|
-
} else if (sameVnode(oldEndVnode, newStartVnode)) {
|
|
1178
|
-
// Vnode moved left
|
|
1179
|
-
patchVnode(oldEndVnode, newStartVnode);
|
|
1180
|
-
newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
|
|
1181
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1182
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1183
|
-
} else {
|
|
1184
|
-
if (oldKeyToIdx === undefined) {
|
|
1185
|
-
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
1189
|
-
|
|
1190
|
-
if (isUndef(idxInOld)) {
|
|
1191
|
-
// New element
|
|
1192
|
-
newStartVnode.hook.create(newStartVnode);
|
|
1193
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
1194
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1195
|
-
} else {
|
|
1196
|
-
elmToMove = oldCh[idxInOld];
|
|
1197
|
-
|
|
1198
|
-
if (isVNode(elmToMove)) {
|
|
1199
|
-
if (elmToMove.sel !== newStartVnode.sel) {
|
|
1200
|
-
// New element
|
|
1201
|
-
newStartVnode.hook.create(newStartVnode);
|
|
1202
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
1203
|
-
} else {
|
|
1204
|
-
patchVnode(elmToMove, newStartVnode);
|
|
1205
|
-
oldCh[idxInOld] = undefined;
|
|
1206
|
-
newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
1216
|
-
if (oldStartIdx > oldEndIdx) {
|
|
1217
|
-
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
1218
|
-
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
1219
|
-
var _i6 = newEndIdx;
|
|
1220
|
-
var n;
|
|
1221
|
-
|
|
1222
|
-
do {
|
|
1223
|
-
n = newCh[++_i6];
|
|
1224
|
-
} while (!isVNode(n) && _i6 < newChEnd);
|
|
1225
|
-
|
|
1226
|
-
before = isVNode(n) ? n.elm : null;
|
|
1227
|
-
addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
|
|
1228
|
-
} else {
|
|
1229
|
-
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
function updateStaticChildren(parentElm, oldCh, newCh) {
|
|
1235
|
-
var oldChLength = oldCh.length;
|
|
1236
|
-
var newChLength = newCh.length;
|
|
1237
|
-
|
|
1238
|
-
if (oldChLength === 0) {
|
|
1239
|
-
// the old list is empty, we can directly insert anything new
|
|
1240
|
-
addVnodes(parentElm, null, newCh, 0, newChLength);
|
|
1241
|
-
return;
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
if (newChLength === 0) {
|
|
1245
|
-
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
1246
|
-
// this is the case in which the dynamic children of an if-directive should be removed
|
|
1247
|
-
removeVnodes(parentElm, oldCh, 0, oldChLength);
|
|
1248
|
-
return;
|
|
1249
|
-
} // if the old list is not empty, the new list MUST have the same
|
|
1250
|
-
// amount of nodes, that's why we call this static children
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
var referenceElm = null;
|
|
1254
|
-
|
|
1255
|
-
for (var _i7 = newChLength - 1; _i7 >= 0; _i7 -= 1) {
|
|
1256
|
-
var vnode = newCh[_i7];
|
|
1257
|
-
var oldVNode = oldCh[_i7];
|
|
1258
|
-
|
|
1259
|
-
if (vnode !== oldVNode) {
|
|
1260
|
-
if (isVNode(oldVNode)) {
|
|
1261
|
-
if (isVNode(vnode)) {
|
|
1262
|
-
// both vnodes must be equivalent, and se just need to patch them
|
|
1263
|
-
patchVnode(oldVNode, vnode);
|
|
1264
|
-
referenceElm = vnode.elm;
|
|
1265
|
-
} else {
|
|
1266
|
-
// removing the old vnode since the new one is null
|
|
1267
|
-
oldVNode.hook.remove(oldVNode, parentElm);
|
|
1268
|
-
}
|
|
1269
|
-
} else if (isVNode(vnode)) {
|
|
1270
|
-
// this condition is unnecessary
|
|
1271
|
-
vnode.hook.create(vnode); // insert the new node one since the old one is null
|
|
1272
|
-
|
|
1273
|
-
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
1274
|
-
referenceElm = vnode.elm;
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
function patchVnode(oldVnode, vnode) {
|
|
1281
|
-
if (oldVnode !== vnode) {
|
|
1282
|
-
vnode.elm = oldVnode.elm;
|
|
1283
|
-
vnode.hook.update(oldVnode, vnode);
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1110
|
+
var HTMLElementConstructor$1 = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
|
|
1111
|
+
var HTMLElementPrototype = HTMLElementConstructor$1.prototype;
|
|
1286
1112
|
/*
|
|
1287
1113
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1288
1114
|
* All rights reserved.
|
|
@@ -1290,7 +1116,6 @@
|
|
|
1290
1116
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1291
1117
|
*/
|
|
1292
1118
|
|
|
1293
|
-
|
|
1294
1119
|
var defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
|
|
1295
1120
|
|
|
1296
1121
|
function offsetPropertyErrorMessage(name) {
|
|
@@ -1409,6 +1234,40 @@
|
|
|
1409
1234
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1410
1235
|
*/
|
|
1411
1236
|
|
|
1237
|
+
/**
|
|
1238
|
+
* This is a descriptor map that contains
|
|
1239
|
+
* all standard properties that a Custom Element can support (including AOM properties), which
|
|
1240
|
+
* determines what kind of capabilities the Base HTML Element and
|
|
1241
|
+
* Base Lightning Element should support.
|
|
1242
|
+
*/
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
var HTMLElementOriginalDescriptors = create(null);
|
|
1246
|
+
forEach.call(keys(AriaPropNameToAttrNameMap), function (propName) {
|
|
1247
|
+
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1248
|
+
// in IE11, some properties are on Element.prototype instead of HTMLElement, just to be sure.
|
|
1249
|
+
var descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1250
|
+
|
|
1251
|
+
if (!isUndefined$1(descriptor)) {
|
|
1252
|
+
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
forEach.call(defaultDefHTMLPropertyNames, function (propName) {
|
|
1256
|
+
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1257
|
+
// in IE11, id property is on Element.prototype instead of HTMLElement, and we suspect that more will fall into
|
|
1258
|
+
// this category, so, better to be sure.
|
|
1259
|
+
var descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1260
|
+
|
|
1261
|
+
if (!isUndefined$1(descriptor)) {
|
|
1262
|
+
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1263
|
+
}
|
|
1264
|
+
});
|
|
1265
|
+
/*
|
|
1266
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
1267
|
+
* All rights reserved.
|
|
1268
|
+
* SPDX-License-Identifier: MIT
|
|
1269
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1270
|
+
*/
|
|
1412
1271
|
|
|
1413
1272
|
function generateDataDescriptor(options) {
|
|
1414
1273
|
return assign({
|
|
@@ -1736,56 +1595,11 @@
|
|
|
1736
1595
|
function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
1737
1596
|
defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
|
|
1738
1597
|
}
|
|
1739
|
-
|
|
1740
|
-
* Copyright (
|
|
1741
|
-
* All rights reserved.
|
|
1742
|
-
* SPDX-License-Identifier: MIT
|
|
1743
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1598
|
+
/**
|
|
1599
|
+
* Copyright (C) 2017 salesforce.com, inc.
|
|
1744
1600
|
*/
|
|
1745
|
-
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
1746
|
-
// to inject at runtime.
|
|
1747
1601
|
|
|
1748
1602
|
|
|
1749
|
-
var HTMLElementConstructor$1 = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
|
|
1750
|
-
var HTMLElementPrototype = HTMLElementConstructor$1.prototype;
|
|
1751
|
-
/*
|
|
1752
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1753
|
-
* All rights reserved.
|
|
1754
|
-
* SPDX-License-Identifier: MIT
|
|
1755
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1756
|
-
*/
|
|
1757
|
-
|
|
1758
|
-
/**
|
|
1759
|
-
* This is a descriptor map that contains
|
|
1760
|
-
* all standard properties that a Custom Element can support (including AOM properties), which
|
|
1761
|
-
* determines what kind of capabilities the Base HTML Element and
|
|
1762
|
-
* Base Lightning Element should support.
|
|
1763
|
-
*/
|
|
1764
|
-
|
|
1765
|
-
var HTMLElementOriginalDescriptors = create(null);
|
|
1766
|
-
forEach.call(keys(AriaPropNameToAttrNameMap), function (propName) {
|
|
1767
|
-
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1768
|
-
// in IE11, some properties are on Element.prototype instead of HTMLElement, just to be sure.
|
|
1769
|
-
var descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1770
|
-
|
|
1771
|
-
if (!isUndefined$1(descriptor)) {
|
|
1772
|
-
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1773
|
-
}
|
|
1774
|
-
});
|
|
1775
|
-
forEach.call(defaultDefHTMLPropertyNames, function (propName) {
|
|
1776
|
-
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1777
|
-
// in IE11, id property is on Element.prototype instead of HTMLElement, and we suspect that more will fall into
|
|
1778
|
-
// this category, so, better to be sure.
|
|
1779
|
-
var descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1780
|
-
|
|
1781
|
-
if (!isUndefined$1(descriptor)) {
|
|
1782
|
-
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1783
|
-
}
|
|
1784
|
-
});
|
|
1785
|
-
/**
|
|
1786
|
-
* Copyright (C) 2017 salesforce.com, inc.
|
|
1787
|
-
*/
|
|
1788
|
-
|
|
1789
1603
|
var isArray = Array.isArray;
|
|
1790
1604
|
var ObjectDotPrototype = Object.prototype,
|
|
1791
1605
|
_getPrototypeOf = Object.getPrototypeOf,
|
|
@@ -2713,7 +2527,9 @@
|
|
|
2713
2527
|
if (vm.renderMode === 1
|
|
2714
2528
|
/* Shadow */
|
|
2715
2529
|
) {
|
|
2716
|
-
doAttachShadow(vm);
|
|
2530
|
+
vm.renderRoot = doAttachShadow(vm);
|
|
2531
|
+
} else {
|
|
2532
|
+
vm.renderRoot = elm;
|
|
2717
2533
|
} // Adding extra guard rails in DEV mode.
|
|
2718
2534
|
|
|
2719
2535
|
|
|
@@ -2732,13 +2548,15 @@
|
|
|
2732
2548
|
mode = vm.mode,
|
|
2733
2549
|
shadowMode = vm.shadowMode,
|
|
2734
2550
|
ctor = vm.def.ctor;
|
|
2735
|
-
var
|
|
2736
|
-
vm.
|
|
2737
|
-
associateVM(
|
|
2551
|
+
var shadowRoot = attachShadow$1(elm, (_attachShadow$ = {}, _defineProperty(_attachShadow$, KEY__SYNTHETIC_MODE, shadowMode === 1), _defineProperty(_attachShadow$, "delegatesFocus", Boolean(ctor.delegatesFocus)), _defineProperty(_attachShadow$, "mode", mode), _attachShadow$));
|
|
2552
|
+
vm.shadowRoot = shadowRoot;
|
|
2553
|
+
associateVM(shadowRoot, vm);
|
|
2738
2554
|
|
|
2739
2555
|
if (process.env.NODE_ENV !== 'production') {
|
|
2740
|
-
patchShadowRootWithRestrictions(
|
|
2556
|
+
patchShadowRootWithRestrictions(shadowRoot);
|
|
2741
2557
|
}
|
|
2558
|
+
|
|
2559
|
+
return shadowRoot;
|
|
2742
2560
|
}
|
|
2743
2561
|
|
|
2744
2562
|
function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
|
@@ -2883,7 +2701,7 @@
|
|
|
2883
2701
|
}
|
|
2884
2702
|
}
|
|
2885
2703
|
|
|
2886
|
-
return vm.
|
|
2704
|
+
return vm.shadowRoot;
|
|
2887
2705
|
},
|
|
2888
2706
|
|
|
2889
2707
|
get shadowRoot() {
|
|
@@ -2931,7 +2749,7 @@
|
|
|
2931
2749
|
|
|
2932
2750
|
|
|
2933
2751
|
var _loop = function _loop() {
|
|
2934
|
-
var childGetter = _childGetters[
|
|
2752
|
+
var childGetter = _childGetters[_i6];
|
|
2935
2753
|
queryAndChildGetterDescriptors[childGetter] = {
|
|
2936
2754
|
get: function get() {
|
|
2937
2755
|
var vm = getAssociatedVM(this);
|
|
@@ -2948,7 +2766,7 @@
|
|
|
2948
2766
|
};
|
|
2949
2767
|
};
|
|
2950
2768
|
|
|
2951
|
-
for (var
|
|
2769
|
+
for (var _i6 = 0, _childGetters = childGetters; _i6 < _childGetters.length; _i6++) {
|
|
2952
2770
|
_loop();
|
|
2953
2771
|
}
|
|
2954
2772
|
|
|
@@ -2972,7 +2790,7 @@
|
|
|
2972
2790
|
|
|
2973
2791
|
|
|
2974
2792
|
var _loop2 = function _loop2() {
|
|
2975
|
-
var queryMethod = _queryMethods[
|
|
2793
|
+
var queryMethod = _queryMethods[_i7];
|
|
2976
2794
|
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2977
2795
|
value: function value(arg) {
|
|
2978
2796
|
var vm = getAssociatedVM(this);
|
|
@@ -2990,7 +2808,7 @@
|
|
|
2990
2808
|
};
|
|
2991
2809
|
};
|
|
2992
2810
|
|
|
2993
|
-
for (var
|
|
2811
|
+
for (var _i7 = 0, _queryMethods = queryMethods; _i7 < _queryMethods.length; _i7++) {
|
|
2994
2812
|
_loop2();
|
|
2995
2813
|
}
|
|
2996
2814
|
|
|
@@ -3513,8 +3331,8 @@
|
|
|
3513
3331
|
}
|
|
3514
3332
|
|
|
3515
3333
|
if (!isUndefined$1(fields)) {
|
|
3516
|
-
for (var
|
|
3517
|
-
var _fieldName2 = fields[
|
|
3334
|
+
for (var _i8 = 0, n = fields.length; _i8 < n; _i8++) {
|
|
3335
|
+
var _fieldName2 = fields[_i8];
|
|
3518
3336
|
descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
|
|
3519
3337
|
|
|
3520
3338
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -3735,8 +3553,8 @@
|
|
|
3735
3553
|
superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
|
|
3736
3554
|
var descriptors = create(null); // expose getters and setters for each public props on the new Element Bridge
|
|
3737
3555
|
|
|
3738
|
-
for (var
|
|
3739
|
-
var _propName2 = props[
|
|
3556
|
+
for (var _i9 = 0, _len3 = props.length; _i9 < _len3; _i9 += 1) {
|
|
3557
|
+
var _propName2 = props[_i9];
|
|
3740
3558
|
attributeToPropMap[htmlPropertyToAttribute(_propName2)] = _propName2;
|
|
3741
3559
|
descriptors[_propName2] = {
|
|
3742
3560
|
get: createGetter(_propName2),
|
|
@@ -3747,8 +3565,8 @@
|
|
|
3747
3565
|
} // expose public methods as props on the new Element Bridge
|
|
3748
3566
|
|
|
3749
3567
|
|
|
3750
|
-
for (var
|
|
3751
|
-
var methodName = methods[
|
|
3568
|
+
for (var _i10 = 0, _len4 = methods.length; _i10 < _len4; _i10 += 1) {
|
|
3569
|
+
var methodName = methods[_i10];
|
|
3752
3570
|
descriptors[methodName] = {
|
|
3753
3571
|
value: createMethodCaller(methodName),
|
|
3754
3572
|
writable: true,
|
|
@@ -4304,6 +4122,11 @@
|
|
|
4304
4122
|
return def;
|
|
4305
4123
|
}
|
|
4306
4124
|
|
|
4125
|
+
function getComponentHtmlPrototype(Ctor) {
|
|
4126
|
+
var def = getComponentInternalDef(Ctor);
|
|
4127
|
+
return def.bridge;
|
|
4128
|
+
}
|
|
4129
|
+
|
|
4307
4130
|
var lightingElementDef = {
|
|
4308
4131
|
ctor: LightningElement,
|
|
4309
4132
|
name: LightningElement.name,
|
|
@@ -4364,6 +4187,75 @@
|
|
|
4364
4187
|
methods: publicMethods
|
|
4365
4188
|
};
|
|
4366
4189
|
}
|
|
4190
|
+
/*
|
|
4191
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
4192
|
+
* All rights reserved.
|
|
4193
|
+
* SPDX-License-Identifier: MIT
|
|
4194
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4195
|
+
*/
|
|
4196
|
+
|
|
4197
|
+
|
|
4198
|
+
function getUpgradableConstructor(tagName) {
|
|
4199
|
+
// Should never get a tag with upper case letter at this point, the compiler should
|
|
4200
|
+
// produce only tags with lowercase letters
|
|
4201
|
+
// But, for backwards compatibility, we will lower case the tagName
|
|
4202
|
+
tagName = tagName.toLowerCase();
|
|
4203
|
+
var CE = getCustomElement$1(tagName);
|
|
4204
|
+
|
|
4205
|
+
if (!isUndefined$1(CE)) {
|
|
4206
|
+
return CE;
|
|
4207
|
+
}
|
|
4208
|
+
/**
|
|
4209
|
+
* LWC Upgradable Element reference to an element that was created
|
|
4210
|
+
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
4211
|
+
*/
|
|
4212
|
+
|
|
4213
|
+
|
|
4214
|
+
CE = /*#__PURE__*/function (_HTMLElementExported$) {
|
|
4215
|
+
_inherits(LWCUpgradableElement, _HTMLElementExported$);
|
|
4216
|
+
|
|
4217
|
+
var _super5 = _createSuper(LWCUpgradableElement);
|
|
4218
|
+
|
|
4219
|
+
function LWCUpgradableElement(upgradeCallback) {
|
|
4220
|
+
var _this4;
|
|
4221
|
+
|
|
4222
|
+
_classCallCheck(this, LWCUpgradableElement);
|
|
4223
|
+
|
|
4224
|
+
_this4 = _super5.call(this);
|
|
4225
|
+
|
|
4226
|
+
if (isFunction$1(upgradeCallback)) {
|
|
4227
|
+
upgradeCallback(_assertThisInitialized(_this4)); // nothing to do with the result for now
|
|
4228
|
+
}
|
|
4229
|
+
|
|
4230
|
+
return _this4;
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
return _createClass(LWCUpgradableElement);
|
|
4234
|
+
}(HTMLElementExported$1);
|
|
4235
|
+
|
|
4236
|
+
defineCustomElement$1(tagName, CE);
|
|
4237
|
+
return CE;
|
|
4238
|
+
}
|
|
4239
|
+
/*
|
|
4240
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4241
|
+
* All rights reserved.
|
|
4242
|
+
* SPDX-License-Identifier: MIT
|
|
4243
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4244
|
+
*/
|
|
4245
|
+
|
|
4246
|
+
|
|
4247
|
+
function isVBaseElement(vnode) {
|
|
4248
|
+
var type = vnode.type;
|
|
4249
|
+
return type === 2
|
|
4250
|
+
/* Element */
|
|
4251
|
+
|| type === 3
|
|
4252
|
+
/* CustomElement */
|
|
4253
|
+
;
|
|
4254
|
+
}
|
|
4255
|
+
|
|
4256
|
+
function isSameVnode(vnode1, vnode2) {
|
|
4257
|
+
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
4258
|
+
}
|
|
4367
4259
|
/*
|
|
4368
4260
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
4369
4261
|
* All rights reserved.
|
|
@@ -4372,8 +4264,6 @@
|
|
|
4372
4264
|
*/
|
|
4373
4265
|
|
|
4374
4266
|
|
|
4375
|
-
var xlinkNS = 'http://www.w3.org/1999/xlink';
|
|
4376
|
-
var xmlNS = 'http://www.w3.org/XML/1998/namespace';
|
|
4377
4267
|
var ColonCharCode = 58;
|
|
4378
4268
|
|
|
4379
4269
|
function patchAttributes(oldVnode, vnode) {
|
|
@@ -4400,10 +4290,10 @@
|
|
|
4400
4290
|
|
|
4401
4291
|
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
4402
4292
|
// Assume xml namespace
|
|
4403
|
-
setAttribute$1(elm, key, cur,
|
|
4293
|
+
setAttribute$1(elm, key, cur, XML_NAMESPACE);
|
|
4404
4294
|
} else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
4405
4295
|
// Assume xlink namespace
|
|
4406
|
-
setAttribute$1(elm, key, cur,
|
|
4296
|
+
setAttribute$1(elm, key, cur, XLINK_NAMESPACE);
|
|
4407
4297
|
} else if (isNull(cur) || isUndefined$1(cur)) {
|
|
4408
4298
|
removeAttribute$1(elm, key);
|
|
4409
4299
|
} else {
|
|
@@ -4620,8 +4510,8 @@
|
|
|
4620
4510
|
return;
|
|
4621
4511
|
}
|
|
4622
4512
|
|
|
4623
|
-
for (var
|
|
4624
|
-
var _styleDecls$_i = _slicedToArray(styleDecls[
|
|
4513
|
+
for (var _i11 = 0; _i11 < styleDecls.length; _i11++) {
|
|
4514
|
+
var _styleDecls$_i = _slicedToArray(styleDecls[_i11], 3),
|
|
4625
4515
|
prop = _styleDecls$_i[0],
|
|
4626
4516
|
value = _styleDecls$_i[1],
|
|
4627
4517
|
important = _styleDecls$_i[2];
|
|
@@ -4637,6 +4527,151 @@
|
|
|
4637
4527
|
*/
|
|
4638
4528
|
|
|
4639
4529
|
|
|
4530
|
+
var TextHook = {
|
|
4531
|
+
create: function create(vnode) {
|
|
4532
|
+
var owner = vnode.owner;
|
|
4533
|
+
var elm = createText$1(vnode.text);
|
|
4534
|
+
linkNodeToShadow(elm, owner);
|
|
4535
|
+
vnode.elm = elm;
|
|
4536
|
+
},
|
|
4537
|
+
update: updateNodeHook,
|
|
4538
|
+
insert: insertNode,
|
|
4539
|
+
move: insertNode,
|
|
4540
|
+
remove: removeNode
|
|
4541
|
+
};
|
|
4542
|
+
var CommentHook = {
|
|
4543
|
+
create: function create(vnode) {
|
|
4544
|
+
var owner = vnode.owner,
|
|
4545
|
+
text = vnode.text;
|
|
4546
|
+
var elm = createComment$1(text);
|
|
4547
|
+
linkNodeToShadow(elm, owner);
|
|
4548
|
+
vnode.elm = elm;
|
|
4549
|
+
},
|
|
4550
|
+
update: updateNodeHook,
|
|
4551
|
+
insert: insertNode,
|
|
4552
|
+
move: insertNode,
|
|
4553
|
+
remove: removeNode
|
|
4554
|
+
}; // insert is called after update, which is used somewhere else (via a module)
|
|
4555
|
+
// to mark the vm as inserted, that means we cannot use update as the main channel
|
|
4556
|
+
// to rehydrate when dirty, because sometimes the element is not inserted just yet,
|
|
4557
|
+
// which breaks some invariants. For that reason, we have the following for any
|
|
4558
|
+
// Custom Element that is inserted via a template.
|
|
4559
|
+
|
|
4560
|
+
var ElementHook = {
|
|
4561
|
+
create: function create(vnode) {
|
|
4562
|
+
var sel = vnode.sel,
|
|
4563
|
+
owner = vnode.owner,
|
|
4564
|
+
svg = vnode.data.svg;
|
|
4565
|
+
var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
4566
|
+
var elm = createElement$2(sel, namespace);
|
|
4567
|
+
linkNodeToShadow(elm, owner);
|
|
4568
|
+
fallbackElmHook(elm, vnode);
|
|
4569
|
+
vnode.elm = elm;
|
|
4570
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
4571
|
+
},
|
|
4572
|
+
update: function update(oldVnode, vnode) {
|
|
4573
|
+
patchElementPropsAndAttrs$1(oldVnode, vnode);
|
|
4574
|
+
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
4575
|
+
},
|
|
4576
|
+
insert: function insert(vnode, parentNode, referenceNode) {
|
|
4577
|
+
insertNode(vnode, parentNode, referenceNode);
|
|
4578
|
+
createChildrenHook(vnode);
|
|
4579
|
+
},
|
|
4580
|
+
move: insertNode,
|
|
4581
|
+
remove: function remove(vnode, parentNode) {
|
|
4582
|
+
removeNode(vnode, parentNode);
|
|
4583
|
+
removeChildren(vnode);
|
|
4584
|
+
}
|
|
4585
|
+
};
|
|
4586
|
+
var CustomElementHook = {
|
|
4587
|
+
create: function create(vnode) {
|
|
4588
|
+
var sel = vnode.sel,
|
|
4589
|
+
owner = vnode.owner;
|
|
4590
|
+
var UpgradableConstructor = getUpgradableConstructor(sel);
|
|
4591
|
+
/**
|
|
4592
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
4593
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
4594
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
4595
|
+
* an upgradable custom element.
|
|
4596
|
+
*/
|
|
4597
|
+
|
|
4598
|
+
var vm;
|
|
4599
|
+
var elm = new UpgradableConstructor(function (elm) {
|
|
4600
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
4601
|
+
vm = createViewModelHook(elm, vnode);
|
|
4602
|
+
});
|
|
4603
|
+
linkNodeToShadow(elm, owner);
|
|
4604
|
+
vnode.elm = elm;
|
|
4605
|
+
|
|
4606
|
+
if (vm) {
|
|
4607
|
+
allocateChildren(vnode, vm);
|
|
4608
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
4609
|
+
throw new TypeError("Incorrect Component Constructor");
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4612
|
+
patchElementPropsAndAttrs$1(null, vnode);
|
|
4613
|
+
},
|
|
4614
|
+
update: function update(oldVnode, vnode) {
|
|
4615
|
+
patchElementPropsAndAttrs$1(oldVnode, vnode);
|
|
4616
|
+
var vm = getAssociatedVMIfPresent(vnode.elm);
|
|
4617
|
+
|
|
4618
|
+
if (vm) {
|
|
4619
|
+
// in fallback mode, the allocation will always set children to
|
|
4620
|
+
// empty and delegate the real allocation to the slot elements
|
|
4621
|
+
allocateChildren(vnode, vm);
|
|
4622
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
4623
|
+
// will happen, but in native, it does allocate the light dom
|
|
4624
|
+
|
|
4625
|
+
|
|
4626
|
+
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
4627
|
+
|
|
4628
|
+
if (vm) {
|
|
4629
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4630
|
+
assert.isTrue(isArray$1(vnode.children), "Invalid vnode for a custom element, it must have children defined.");
|
|
4631
|
+
} // this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
4632
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
4633
|
+
|
|
4634
|
+
|
|
4635
|
+
rerenderVM(vm);
|
|
4636
|
+
}
|
|
4637
|
+
},
|
|
4638
|
+
insert: function insert(vnode, parentNode, referenceNode) {
|
|
4639
|
+
insertNode(vnode, parentNode, referenceNode);
|
|
4640
|
+
var vm = getAssociatedVMIfPresent(vnode.elm);
|
|
4641
|
+
|
|
4642
|
+
if (vm) {
|
|
4643
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4644
|
+
assert.isTrue(vm.state === 0
|
|
4645
|
+
/* created */
|
|
4646
|
+
, "".concat(vm, " cannot be recycled."));
|
|
4647
|
+
}
|
|
4648
|
+
|
|
4649
|
+
runConnectedCallback(vm);
|
|
4650
|
+
}
|
|
4651
|
+
|
|
4652
|
+
createChildrenHook(vnode);
|
|
4653
|
+
|
|
4654
|
+
if (vm) {
|
|
4655
|
+
appendVM(vm);
|
|
4656
|
+
}
|
|
4657
|
+
},
|
|
4658
|
+
move: insertNode,
|
|
4659
|
+
remove: function remove(vnode, parentNode) {
|
|
4660
|
+
removeNode(vnode, parentNode);
|
|
4661
|
+
var vm = getAssociatedVMIfPresent(vnode.elm);
|
|
4662
|
+
|
|
4663
|
+
if (vm) {
|
|
4664
|
+
// for custom elements we don't have to go recursively because the removeVM routine
|
|
4665
|
+
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
4666
|
+
removeVM(vm);
|
|
4667
|
+
}
|
|
4668
|
+
}
|
|
4669
|
+
};
|
|
4670
|
+
|
|
4671
|
+
function isVNode(vnode) {
|
|
4672
|
+
return vnode != null;
|
|
4673
|
+
}
|
|
4674
|
+
|
|
4640
4675
|
function observeElementChildNodes(elm) {
|
|
4641
4676
|
elm.$domManual$ = true;
|
|
4642
4677
|
}
|
|
@@ -4656,6 +4691,22 @@
|
|
|
4656
4691
|
}
|
|
4657
4692
|
}
|
|
4658
4693
|
|
|
4694
|
+
function linkNodeToShadow(elm, owner) {
|
|
4695
|
+
var renderRoot = owner.renderRoot,
|
|
4696
|
+
renderMode = owner.renderMode,
|
|
4697
|
+
shadowMode = owner.shadowMode; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4698
|
+
|
|
4699
|
+
if (isSyntheticShadowDefined$1) {
|
|
4700
|
+
if (shadowMode === 1
|
|
4701
|
+
/* Synthetic */
|
|
4702
|
+
|| renderMode === 0
|
|
4703
|
+
/* Light */
|
|
4704
|
+
) {
|
|
4705
|
+
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
}
|
|
4709
|
+
|
|
4659
4710
|
function updateNodeHook(oldVnode, vnode) {
|
|
4660
4711
|
var elm = vnode.elm,
|
|
4661
4712
|
text = vnode.text;
|
|
@@ -4673,7 +4724,7 @@
|
|
|
4673
4724
|
}
|
|
4674
4725
|
}
|
|
4675
4726
|
|
|
4676
|
-
function
|
|
4727
|
+
function insertNode(vnode, parentNode, referenceNode) {
|
|
4677
4728
|
if (process.env.NODE_ENV !== 'production') {
|
|
4678
4729
|
unlockDomMutation();
|
|
4679
4730
|
}
|
|
@@ -4685,7 +4736,7 @@
|
|
|
4685
4736
|
}
|
|
4686
4737
|
}
|
|
4687
4738
|
|
|
4688
|
-
function
|
|
4739
|
+
function removeNode(vnode, parentNode) {
|
|
4689
4740
|
if (process.env.NODE_ENV !== 'production') {
|
|
4690
4741
|
unlockDomMutation();
|
|
4691
4742
|
}
|
|
@@ -4697,7 +4748,7 @@
|
|
|
4697
4748
|
}
|
|
4698
4749
|
}
|
|
4699
4750
|
|
|
4700
|
-
function patchElementPropsAndAttrs(oldVnode, vnode) {
|
|
4751
|
+
function patchElementPropsAndAttrs$1(oldVnode, vnode) {
|
|
4701
4752
|
if (isNull(oldVnode)) {
|
|
4702
4753
|
applyEventListeners(vnode);
|
|
4703
4754
|
applyStaticClassAttribute(vnode);
|
|
@@ -4712,11 +4763,6 @@
|
|
|
4712
4763
|
patchProps(oldVnode, vnode);
|
|
4713
4764
|
}
|
|
4714
4765
|
|
|
4715
|
-
function hydrateElmHook(vnode) {
|
|
4716
|
-
applyEventListeners(vnode);
|
|
4717
|
-
patchProps(null, vnode);
|
|
4718
|
-
}
|
|
4719
|
-
|
|
4720
4766
|
function fallbackElmHook(elm, vnode) {
|
|
4721
4767
|
var owner = vnode.owner;
|
|
4722
4768
|
setScopeTokenClassIfNecessary(elm, owner);
|
|
@@ -4728,7 +4774,7 @@
|
|
|
4728
4774
|
var stylesheetToken = owner.context.stylesheetToken;
|
|
4729
4775
|
|
|
4730
4776
|
if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
4731
|
-
/*
|
|
4777
|
+
/* Manual */
|
|
4732
4778
|
) {
|
|
4733
4779
|
// this element will now accept any manual content inserted into it
|
|
4734
4780
|
observeElementChildNodes(elm);
|
|
@@ -4742,7 +4788,7 @@
|
|
|
4742
4788
|
if (process.env.NODE_ENV !== 'production') {
|
|
4743
4789
|
var _context = vnode.data.context;
|
|
4744
4790
|
var isPortal = !isUndefined$1(_context) && !isUndefined$1(_context.lwc) && _context.lwc.dom === "manual"
|
|
4745
|
-
/*
|
|
4791
|
+
/* Manual */
|
|
4746
4792
|
;
|
|
4747
4793
|
var isLight = owner.renderMode === 0
|
|
4748
4794
|
/* Light */
|
|
@@ -4762,7 +4808,7 @@
|
|
|
4762
4808
|
}
|
|
4763
4809
|
}
|
|
4764
4810
|
|
|
4765
|
-
function
|
|
4811
|
+
function allocateChildren(vnode, vm) {
|
|
4766
4812
|
// A component with slots will re-render because:
|
|
4767
4813
|
// 1- There is a change of the internal state.
|
|
4768
4814
|
// 2- There is a change on the external api (ex: slots)
|
|
@@ -4793,11 +4839,12 @@
|
|
|
4793
4839
|
}
|
|
4794
4840
|
|
|
4795
4841
|
function createViewModelHook(elm, vnode) {
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4842
|
+
var vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4843
|
+
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
4844
|
+
// called right after invoking `document.createElement`.
|
|
4845
|
+
|
|
4846
|
+
if (!isUndefined$1(vm)) {
|
|
4847
|
+
return vm;
|
|
4801
4848
|
}
|
|
4802
4849
|
|
|
4803
4850
|
var sel = vnode.sel,
|
|
@@ -4815,8 +4862,7 @@
|
|
|
4815
4862
|
setElementShadowToken(elm, stylesheetToken);
|
|
4816
4863
|
}
|
|
4817
4864
|
|
|
4818
|
-
|
|
4819
|
-
createVM(elm, def, {
|
|
4865
|
+
vm = createVM(elm, ctor, {
|
|
4820
4866
|
mode: mode,
|
|
4821
4867
|
owner: owner,
|
|
4822
4868
|
tagName: sel
|
|
@@ -4825,6 +4871,8 @@
|
|
|
4825
4871
|
if (process.env.NODE_ENV !== 'production') {
|
|
4826
4872
|
assert.isTrue(isArray$1(vnode.children), "Invalid vnode for a custom element, it must have children defined.");
|
|
4827
4873
|
}
|
|
4874
|
+
|
|
4875
|
+
return vm;
|
|
4828
4876
|
}
|
|
4829
4877
|
|
|
4830
4878
|
function createChildrenHook(vnode) {
|
|
@@ -4841,177 +4889,12 @@
|
|
|
4841
4889
|
}
|
|
4842
4890
|
}
|
|
4843
4891
|
|
|
4844
|
-
function
|
|
4845
|
-
//
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
var _vnode$data$attrs = vnode.data.attrs,
|
|
4851
|
-
attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs;
|
|
4852
|
-
var nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
4853
|
-
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
4854
|
-
|
|
4855
|
-
for (var _i14 = 0, _Object$entries = Object.entries(attrs); _i14 < _Object$entries.length; _i14++) {
|
|
4856
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i14], 2),
|
|
4857
|
-
attrName = _Object$entries$_i[0],
|
|
4858
|
-
attrValue = _Object$entries$_i[1];
|
|
4859
|
-
|
|
4860
|
-
var elmAttrValue = getAttribute$1(elm, attrName);
|
|
4861
|
-
|
|
4862
|
-
if (String(attrValue) !== elmAttrValue) {
|
|
4863
|
-
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), vnode.owner);
|
|
4864
|
-
nodesAreCompatible = false;
|
|
4865
|
-
}
|
|
4866
|
-
}
|
|
4867
|
-
|
|
4868
|
-
return nodesAreCompatible;
|
|
4869
|
-
}
|
|
4870
|
-
|
|
4871
|
-
function vnodesAndElementHaveCompatibleClass(vnode, elm) {
|
|
4872
|
-
var _vnode$data = vnode.data,
|
|
4873
|
-
className = _vnode$data.className,
|
|
4874
|
-
classMap = _vnode$data.classMap;
|
|
4875
|
-
var nodesAreCompatible = true;
|
|
4876
|
-
var vnodeClassName;
|
|
4877
|
-
|
|
4878
|
-
if (!isUndefined$1(className) && String(className) !== elm.className) {
|
|
4879
|
-
// className is used when class is bound to an expr.
|
|
4880
|
-
nodesAreCompatible = false;
|
|
4881
|
-
vnodeClassName = className;
|
|
4882
|
-
} else if (!isUndefined$1(classMap)) {
|
|
4883
|
-
// classMap is used when class is set to static value.
|
|
4884
|
-
var classList = getClassList$1(elm);
|
|
4885
|
-
var computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
4886
|
-
|
|
4887
|
-
for (var name in classMap) {
|
|
4888
|
-
computedClassName += ' ' + name;
|
|
4889
|
-
|
|
4890
|
-
if (!classList.contains(name)) {
|
|
4891
|
-
nodesAreCompatible = false;
|
|
4892
|
-
}
|
|
4893
|
-
}
|
|
4894
|
-
|
|
4895
|
-
vnodeClassName = computedClassName.trim();
|
|
4896
|
-
|
|
4897
|
-
if (classList.length > keys(classMap).length) {
|
|
4898
|
-
nodesAreCompatible = false;
|
|
4899
|
-
}
|
|
4900
|
-
}
|
|
4901
|
-
|
|
4902
|
-
if (!nodesAreCompatible) {
|
|
4903
|
-
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"class\" has different values, expected \"").concat(vnodeClassName, "\" but found \"").concat(elm.className, "\""), vnode.owner);
|
|
4904
|
-
}
|
|
4905
|
-
|
|
4906
|
-
return nodesAreCompatible;
|
|
4907
|
-
}
|
|
4908
|
-
|
|
4909
|
-
function vnodesAndElementHaveCompatibleStyle(vnode, elm) {
|
|
4910
|
-
var _vnode$data2 = vnode.data,
|
|
4911
|
-
style = _vnode$data2.style,
|
|
4912
|
-
styleDecls = _vnode$data2.styleDecls;
|
|
4913
|
-
var elmStyle = getAttribute$1(elm, 'style') || '';
|
|
4914
|
-
var vnodeStyle;
|
|
4915
|
-
var nodesAreCompatible = true;
|
|
4916
|
-
|
|
4917
|
-
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
4918
|
-
nodesAreCompatible = false;
|
|
4919
|
-
vnodeStyle = style;
|
|
4920
|
-
} else if (!isUndefined$1(styleDecls)) {
|
|
4921
|
-
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
4922
|
-
var expectedStyle = []; // styleMap is used when style is set to static value.
|
|
4923
|
-
|
|
4924
|
-
for (var _i15 = 0, n = styleDecls.length; _i15 < n; _i15++) {
|
|
4925
|
-
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i15], 3),
|
|
4926
|
-
prop = _styleDecls$_i2[0],
|
|
4927
|
-
value = _styleDecls$_i2[1],
|
|
4928
|
-
important = _styleDecls$_i2[2];
|
|
4929
|
-
|
|
4930
|
-
expectedStyle.push("".concat(prop, ": ").concat(value + (important ? ' important!' : '')));
|
|
4931
|
-
var parsedPropValue = parsedVnodeStyle[prop];
|
|
4932
|
-
|
|
4933
|
-
if (isUndefined$1(parsedPropValue)) {
|
|
4934
|
-
nodesAreCompatible = false;
|
|
4935
|
-
} else if (!parsedPropValue.startsWith(value)) {
|
|
4936
|
-
nodesAreCompatible = false;
|
|
4937
|
-
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
4938
|
-
nodesAreCompatible = false;
|
|
4939
|
-
}
|
|
4940
|
-
}
|
|
4941
|
-
|
|
4942
|
-
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
4943
|
-
nodesAreCompatible = false;
|
|
4944
|
-
}
|
|
4945
|
-
|
|
4946
|
-
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
4947
|
-
}
|
|
4948
|
-
|
|
4949
|
-
if (!nodesAreCompatible) {
|
|
4950
|
-
// style is used when class is bound to an expr.
|
|
4951
|
-
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
|
|
4952
|
-
}
|
|
4953
|
-
|
|
4954
|
-
return nodesAreCompatible;
|
|
4955
|
-
}
|
|
4956
|
-
|
|
4957
|
-
function throwHydrationError() {
|
|
4958
|
-
assert.fail('Server rendered elements do not match client side generated elements');
|
|
4959
|
-
}
|
|
4960
|
-
|
|
4961
|
-
function hydrateChildrenHook(elmChildren, children, vm) {
|
|
4962
|
-
var _a, _b;
|
|
4963
|
-
|
|
4964
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4965
|
-
var filteredVNodes = ArrayFilter.call(children, function (vnode) {
|
|
4966
|
-
return !!vnode;
|
|
4967
|
-
});
|
|
4968
|
-
|
|
4969
|
-
if (elmChildren.length !== filteredVNodes.length) {
|
|
4970
|
-
logError("Hydration mismatch: incorrect number of rendered nodes, expected ".concat(filteredVNodes.length, " but found ").concat(elmChildren.length, "."), vm);
|
|
4971
|
-
throwHydrationError();
|
|
4972
|
-
}
|
|
4973
|
-
}
|
|
4974
|
-
|
|
4975
|
-
var elmCurrentChildIdx = 0;
|
|
4976
|
-
|
|
4977
|
-
for (var j = 0, n = children.length; j < n; j++) {
|
|
4978
|
-
var ch = children[j];
|
|
4979
|
-
|
|
4980
|
-
if (ch != null) {
|
|
4981
|
-
var childNode = elmChildren[elmCurrentChildIdx];
|
|
4982
|
-
|
|
4983
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4984
|
-
// VComments and VTexts validation is handled in their hooks
|
|
4985
|
-
if (isElementNode(childNode)) {
|
|
4986
|
-
if (((_a = ch.sel) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== childNode.tagName.toLowerCase()) {
|
|
4987
|
-
logError("Hydration mismatch: expecting element with tag \"".concat((_b = ch.sel) === null || _b === void 0 ? void 0 : _b.toLowerCase(), "\" but found \"").concat(childNode.tagName.toLowerCase(), "\"."), vm);
|
|
4988
|
-
throwHydrationError();
|
|
4989
|
-
} // Note: props are not yet set
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
var hasIncompatibleAttrs = vnodesAndElementHaveCompatibleAttrs(ch, childNode);
|
|
4993
|
-
var hasIncompatibleClass = vnodesAndElementHaveCompatibleClass(ch, childNode);
|
|
4994
|
-
var hasIncompatibleStyle = vnodesAndElementHaveCompatibleStyle(ch, childNode);
|
|
4995
|
-
var isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
4996
|
-
|
|
4997
|
-
if (!isVNodeAndElementCompatible) {
|
|
4998
|
-
throwHydrationError();
|
|
4999
|
-
}
|
|
5000
|
-
}
|
|
5001
|
-
}
|
|
5002
|
-
|
|
5003
|
-
ch.hook.hydrate(ch, childNode);
|
|
5004
|
-
elmCurrentChildIdx++;
|
|
5005
|
-
}
|
|
5006
|
-
}
|
|
5007
|
-
}
|
|
5008
|
-
|
|
5009
|
-
function removeElmHook(vnode) {
|
|
5010
|
-
// this method only needs to search on child vnodes from template
|
|
5011
|
-
// to trigger the remove hook just in case some of those children
|
|
5012
|
-
// are custom elements.
|
|
5013
|
-
var children = vnode.children,
|
|
5014
|
-
elm = vnode.elm;
|
|
4892
|
+
function removeChildren(vnode) {
|
|
4893
|
+
// this method only needs to search on child vnodes from template
|
|
4894
|
+
// to trigger the remove hook just in case some of those children
|
|
4895
|
+
// are custom elements.
|
|
4896
|
+
var children = vnode.children,
|
|
4897
|
+
elm = vnode.elm;
|
|
5015
4898
|
|
|
5016
4899
|
for (var j = 0, _len5 = children.length; j < _len5; ++j) {
|
|
5017
4900
|
var ch = children[j];
|
|
@@ -5023,18 +4906,24 @@
|
|
|
5023
4906
|
}
|
|
5024
4907
|
|
|
5025
4908
|
function allocateInSlot(vm, children) {
|
|
4909
|
+
var _a;
|
|
4910
|
+
|
|
5026
4911
|
var oldSlots = vm.cmpSlots;
|
|
5027
4912
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
5028
4913
|
|
|
5029
|
-
for (var
|
|
5030
|
-
var vnode = children[
|
|
4914
|
+
for (var _i12 = 0, _len6 = children.length; _i12 < _len6; _i12 += 1) {
|
|
4915
|
+
var vnode = children[_i12];
|
|
5031
4916
|
|
|
5032
4917
|
if (isNull(vnode)) {
|
|
5033
4918
|
continue;
|
|
5034
4919
|
}
|
|
5035
4920
|
|
|
5036
|
-
var
|
|
5037
|
-
|
|
4921
|
+
var slotName = '';
|
|
4922
|
+
|
|
4923
|
+
if (isVBaseElement(vnode)) {
|
|
4924
|
+
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';
|
|
4925
|
+
}
|
|
4926
|
+
|
|
5038
4927
|
var vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot
|
|
5039
4928
|
// which might have similar keys. Each vnode will always have a key that
|
|
5040
4929
|
// starts with a numeric character from compiler. In this case, we add a unique
|
|
@@ -5057,8 +4946,8 @@
|
|
|
5057
4946
|
return;
|
|
5058
4947
|
}
|
|
5059
4948
|
|
|
5060
|
-
for (var
|
|
5061
|
-
var key = oldKeys[
|
|
4949
|
+
for (var _i13 = 0, _len7 = oldKeys.length; _i13 < _len7; _i13 += 1) {
|
|
4950
|
+
var key = oldKeys[_i13];
|
|
5062
4951
|
|
|
5063
4952
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
5064
4953
|
markComponentAsDirty(vm);
|
|
@@ -5089,325 +4978,202 @@
|
|
|
5089
4978
|
function hasDynamicChildren(children) {
|
|
5090
4979
|
return FromIteration.has(children);
|
|
5091
4980
|
}
|
|
5092
|
-
/*
|
|
5093
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
5094
|
-
* All rights reserved.
|
|
5095
|
-
* SPDX-License-Identifier: MIT
|
|
5096
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5097
|
-
*/
|
|
5098
|
-
|
|
5099
4981
|
|
|
5100
|
-
function
|
|
5101
|
-
|
|
5102
|
-
// produce only tags with lowercase letters
|
|
5103
|
-
// But, for backwards compatibility, we will lower case the tagName
|
|
5104
|
-
tagName = tagName.toLowerCase();
|
|
5105
|
-
var CE = getCustomElement$1(tagName);
|
|
5106
|
-
|
|
5107
|
-
if (!isUndefined$1(CE)) {
|
|
5108
|
-
return CE;
|
|
5109
|
-
}
|
|
5110
|
-
/**
|
|
5111
|
-
* LWC Upgradable Element reference to an element that was created
|
|
5112
|
-
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
5113
|
-
*/
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
CE = /*#__PURE__*/function (_HTMLElementExported$) {
|
|
5117
|
-
_inherits(LWCUpgradableElement, _HTMLElementExported$);
|
|
5118
|
-
|
|
5119
|
-
var _super5 = _createSuper(LWCUpgradableElement);
|
|
5120
|
-
|
|
5121
|
-
function LWCUpgradableElement(upgradeCallback) {
|
|
5122
|
-
var _this4;
|
|
4982
|
+
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
4983
|
+
var map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
5123
4984
|
|
|
5124
|
-
|
|
4985
|
+
for (var j = beginIdx; j <= endIdx; ++j) {
|
|
4986
|
+
var ch = children[j];
|
|
5125
4987
|
|
|
5126
|
-
|
|
4988
|
+
if (isVNode(ch)) {
|
|
4989
|
+
var key = ch.key;
|
|
5127
4990
|
|
|
5128
|
-
if (
|
|
5129
|
-
|
|
4991
|
+
if (key !== undefined) {
|
|
4992
|
+
map[key] = j;
|
|
5130
4993
|
}
|
|
5131
|
-
|
|
5132
|
-
return _this4;
|
|
5133
4994
|
}
|
|
4995
|
+
}
|
|
5134
4996
|
|
|
5135
|
-
|
|
5136
|
-
}(HTMLElementExported$1);
|
|
5137
|
-
|
|
5138
|
-
defineCustomElement$1(tagName, CE);
|
|
5139
|
-
return CE;
|
|
4997
|
+
return map;
|
|
5140
4998
|
}
|
|
5141
|
-
/*
|
|
5142
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
5143
|
-
* All rights reserved.
|
|
5144
|
-
* SPDX-License-Identifier: MIT
|
|
5145
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5146
|
-
*/
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
5150
|
-
var SymbolIterator = Symbol.iterator;
|
|
5151
|
-
var TextHook = {
|
|
5152
|
-
create: function create(vnode) {
|
|
5153
|
-
var owner = vnode.owner;
|
|
5154
|
-
var elm = createText$1(vnode.text);
|
|
5155
|
-
linkNodeToShadow(elm, owner);
|
|
5156
|
-
vnode.elm = elm;
|
|
5157
|
-
},
|
|
5158
|
-
update: updateNodeHook,
|
|
5159
|
-
insert: insertNodeHook,
|
|
5160
|
-
move: insertNodeHook,
|
|
5161
|
-
remove: removeNodeHook,
|
|
5162
|
-
hydrate: function hydrate(vNode, node) {
|
|
5163
|
-
var _a;
|
|
5164
4999
|
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
logError('Hydration mismatch: incorrect node type received', vNode.owner);
|
|
5169
|
-
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
5170
|
-
}
|
|
5000
|
+
function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
|
|
5001
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
5002
|
+
var ch = vnodes[startIdx];
|
|
5171
5003
|
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
}
|
|
5004
|
+
if (isVNode(ch)) {
|
|
5005
|
+
ch.hook.create(ch);
|
|
5006
|
+
ch.hook.insert(ch, parentElm, before);
|
|
5007
|
+
}
|
|
5008
|
+
}
|
|
5009
|
+
}
|
|
5176
5010
|
|
|
5011
|
+
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
5012
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
5013
|
+
var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
5177
5014
|
|
|
5178
|
-
|
|
5179
|
-
|
|
5015
|
+
if (isVNode(ch)) {
|
|
5016
|
+
ch.hook.remove(ch, parentElm);
|
|
5017
|
+
}
|
|
5180
5018
|
}
|
|
5181
|
-
}
|
|
5182
|
-
var CommentHook = {
|
|
5183
|
-
create: function create(vnode) {
|
|
5184
|
-
var owner = vnode.owner,
|
|
5185
|
-
text = vnode.text;
|
|
5186
|
-
var elm = createComment$1(text);
|
|
5187
|
-
linkNodeToShadow(elm, owner);
|
|
5188
|
-
vnode.elm = elm;
|
|
5189
|
-
},
|
|
5190
|
-
update: updateNodeHook,
|
|
5191
|
-
insert: insertNodeHook,
|
|
5192
|
-
move: insertNodeHook,
|
|
5193
|
-
remove: removeNodeHook,
|
|
5194
|
-
hydrate: function hydrate(vNode, node) {
|
|
5195
|
-
var _a;
|
|
5019
|
+
}
|
|
5196
5020
|
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5021
|
+
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
5022
|
+
var oldStartIdx = 0;
|
|
5023
|
+
var newStartIdx = 0;
|
|
5024
|
+
var oldEndIdx = oldCh.length - 1;
|
|
5025
|
+
var oldStartVnode = oldCh[0];
|
|
5026
|
+
var oldEndVnode = oldCh[oldEndIdx];
|
|
5027
|
+
var newChEnd = newCh.length - 1;
|
|
5028
|
+
var newEndIdx = newChEnd;
|
|
5029
|
+
var newStartVnode = newCh[0];
|
|
5030
|
+
var newEndVnode = newCh[newEndIdx];
|
|
5031
|
+
var oldKeyToIdx;
|
|
5032
|
+
var idxInOld;
|
|
5033
|
+
var elmToMove;
|
|
5034
|
+
var before;
|
|
5203
5035
|
|
|
5204
|
-
|
|
5205
|
-
|
|
5036
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
5037
|
+
if (!isVNode(oldStartVnode)) {
|
|
5038
|
+
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
5039
|
+
} else if (!isVNode(oldEndVnode)) {
|
|
5040
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
5041
|
+
} else if (!isVNode(newStartVnode)) {
|
|
5042
|
+
newStartVnode = newCh[++newStartIdx];
|
|
5043
|
+
} else if (!isVNode(newEndVnode)) {
|
|
5044
|
+
newEndVnode = newCh[--newEndIdx];
|
|
5045
|
+
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
5046
|
+
patchVnode(oldStartVnode, newStartVnode);
|
|
5047
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
5048
|
+
newStartVnode = newCh[++newStartIdx];
|
|
5049
|
+
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
5050
|
+
patchVnode(oldEndVnode, newEndVnode);
|
|
5051
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
5052
|
+
newEndVnode = newCh[--newEndIdx];
|
|
5053
|
+
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
5054
|
+
// Vnode moved right
|
|
5055
|
+
patchVnode(oldStartVnode, newEndVnode);
|
|
5056
|
+
newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
|
|
5057
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
5058
|
+
newEndVnode = newCh[--newEndIdx];
|
|
5059
|
+
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
5060
|
+
// Vnode moved left
|
|
5061
|
+
patchVnode(oldEndVnode, newStartVnode);
|
|
5062
|
+
newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
|
|
5063
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
5064
|
+
newStartVnode = newCh[++newStartIdx];
|
|
5065
|
+
} else {
|
|
5066
|
+
if (oldKeyToIdx === undefined) {
|
|
5067
|
+
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
5206
5068
|
}
|
|
5207
|
-
} // always set the text value to the one from the vnode.
|
|
5208
5069
|
|
|
5070
|
+
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
5209
5071
|
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
// Custom Element that is inserted via a template.
|
|
5072
|
+
if (isUndefined$1(idxInOld)) {
|
|
5073
|
+
// New element
|
|
5074
|
+
newStartVnode.hook.create(newStartVnode);
|
|
5075
|
+
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
5076
|
+
newStartVnode = newCh[++newStartIdx];
|
|
5077
|
+
} else {
|
|
5078
|
+
elmToMove = oldCh[idxInOld];
|
|
5218
5079
|
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
patchElementPropsAndAttrs(null, vnode);
|
|
5230
|
-
},
|
|
5231
|
-
update: function update(oldVnode, vnode) {
|
|
5232
|
-
patchElementPropsAndAttrs(oldVnode, vnode);
|
|
5233
|
-
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
5234
|
-
},
|
|
5235
|
-
insert: function insert(vnode, parentNode, referenceNode) {
|
|
5236
|
-
insertNodeHook(vnode, parentNode, referenceNode);
|
|
5237
|
-
createChildrenHook(vnode);
|
|
5238
|
-
},
|
|
5239
|
-
move: function move(vnode, parentNode, referenceNode) {
|
|
5240
|
-
insertNodeHook(vnode, parentNode, referenceNode);
|
|
5241
|
-
},
|
|
5242
|
-
remove: function remove(vnode, parentNode) {
|
|
5243
|
-
removeNodeHook(vnode, parentNode);
|
|
5244
|
-
removeElmHook(vnode);
|
|
5245
|
-
},
|
|
5246
|
-
hydrate: function hydrate(vnode, node) {
|
|
5247
|
-
var elm = node;
|
|
5248
|
-
vnode.elm = elm;
|
|
5249
|
-
var context = vnode.data.context;
|
|
5250
|
-
var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
5251
|
-
/* manual */
|
|
5252
|
-
);
|
|
5253
|
-
|
|
5254
|
-
if (isDomManual) {
|
|
5255
|
-
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
5256
|
-
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
5257
|
-
var props = vnode.data.props;
|
|
5258
|
-
|
|
5259
|
-
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
5260
|
-
if (elm.innerHTML === props.innerHTML) {
|
|
5261
|
-
delete props.innerHTML;
|
|
5262
|
-
} else {
|
|
5263
|
-
logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
5080
|
+
if (isVNode(elmToMove)) {
|
|
5081
|
+
if (elmToMove.sel !== newStartVnode.sel) {
|
|
5082
|
+
// New element
|
|
5083
|
+
newStartVnode.hook.create(newStartVnode);
|
|
5084
|
+
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
5085
|
+
} else {
|
|
5086
|
+
patchVnode(elmToMove, newStartVnode);
|
|
5087
|
+
oldCh[idxInOld] = undefined;
|
|
5088
|
+
newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
|
|
5089
|
+
}
|
|
5264
5090
|
}
|
|
5265
|
-
}
|
|
5266
|
-
}
|
|
5267
5091
|
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
if (!isDomManual) {
|
|
5271
|
-
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
5092
|
+
newStartVnode = newCh[++newStartIdx];
|
|
5093
|
+
}
|
|
5272
5094
|
}
|
|
5273
5095
|
}
|
|
5274
|
-
};
|
|
5275
|
-
var CustomElementHook = {
|
|
5276
|
-
create: function create(vnode) {
|
|
5277
|
-
var sel = vnode.sel,
|
|
5278
|
-
owner = vnode.owner;
|
|
5279
|
-
var UpgradableConstructor = getUpgradableConstructor(sel);
|
|
5280
|
-
/**
|
|
5281
|
-
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
5282
|
-
* with a callback as the first argument, we could implement a more advanced
|
|
5283
|
-
* mechanism that only passes that argument if the constructor is known to be
|
|
5284
|
-
* an upgradable custom element.
|
|
5285
|
-
*/
|
|
5286
|
-
|
|
5287
|
-
var elm = new UpgradableConstructor(function (elm) {
|
|
5288
|
-
// the custom element from the registry is expecting an upgrade callback
|
|
5289
|
-
createViewModelHook(elm, vnode);
|
|
5290
|
-
});
|
|
5291
|
-
linkNodeToShadow(elm, owner);
|
|
5292
|
-
vnode.elm = elm;
|
|
5293
|
-
var vm = getAssociatedVMIfPresent(elm);
|
|
5294
|
-
|
|
5295
|
-
if (vm) {
|
|
5296
|
-
allocateChildrenHook(vnode, vm);
|
|
5297
|
-
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
5298
|
-
throw new TypeError("Incorrect Component Constructor");
|
|
5299
|
-
}
|
|
5300
5096
|
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
if (vm) {
|
|
5308
|
-
// in fallback mode, the allocation will always set children to
|
|
5309
|
-
// empty and delegate the real allocation to the slot elements
|
|
5310
|
-
allocateChildrenHook(vnode, vm);
|
|
5311
|
-
} // in fallback mode, the children will be always empty, so, nothing
|
|
5312
|
-
// will happen, but in native, it does allocate the light dom
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
5316
|
-
|
|
5317
|
-
if (vm) {
|
|
5318
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
5319
|
-
assert.isTrue(isArray$1(vnode.children), "Invalid vnode for a custom element, it must have children defined.");
|
|
5320
|
-
} // this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
5321
|
-
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
5097
|
+
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
5098
|
+
if (oldStartIdx > oldEndIdx) {
|
|
5099
|
+
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
5100
|
+
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
5101
|
+
var _i14 = newEndIdx;
|
|
5102
|
+
var n;
|
|
5322
5103
|
|
|
5104
|
+
do {
|
|
5105
|
+
n = newCh[++_i14];
|
|
5106
|
+
} while (!isVNode(n) && _i14 < newChEnd);
|
|
5323
5107
|
|
|
5324
|
-
|
|
5108
|
+
before = isVNode(n) ? n.elm : null;
|
|
5109
|
+
addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
|
|
5110
|
+
} else {
|
|
5111
|
+
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
|
5325
5112
|
}
|
|
5326
|
-
}
|
|
5327
|
-
|
|
5328
|
-
insertNodeHook(vnode, parentNode, referenceNode);
|
|
5329
|
-
var vm = getAssociatedVMIfPresent(vnode.elm);
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5330
5115
|
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
/* created */
|
|
5335
|
-
, "".concat(vm, " cannot be recycled."));
|
|
5336
|
-
}
|
|
5116
|
+
function updateStaticChildren(parentElm, oldCh, newCh) {
|
|
5117
|
+
var oldChLength = oldCh.length;
|
|
5118
|
+
var newChLength = newCh.length;
|
|
5337
5119
|
|
|
5338
|
-
|
|
5339
|
-
|
|
5120
|
+
if (oldChLength === 0) {
|
|
5121
|
+
// the old list is empty, we can directly insert anything new
|
|
5122
|
+
addVnodes(parentElm, null, newCh, 0, newChLength);
|
|
5123
|
+
return;
|
|
5124
|
+
}
|
|
5340
5125
|
|
|
5341
|
-
|
|
5126
|
+
if (newChLength === 0) {
|
|
5127
|
+
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
5128
|
+
// this is the case in which the dynamic children of an if-directive should be removed
|
|
5129
|
+
removeVnodes(parentElm, oldCh, 0, oldChLength);
|
|
5130
|
+
return;
|
|
5131
|
+
} // if the old list is not empty, the new list MUST have the same
|
|
5132
|
+
// amount of nodes, that's why we call this static children
|
|
5342
5133
|
|
|
5343
|
-
if (vm) {
|
|
5344
|
-
appendVM(vm);
|
|
5345
|
-
}
|
|
5346
|
-
},
|
|
5347
|
-
move: function move(vnode, parentNode, referenceNode) {
|
|
5348
|
-
insertNodeHook(vnode, parentNode, referenceNode);
|
|
5349
|
-
},
|
|
5350
|
-
remove: function remove(vnode, parentNode) {
|
|
5351
|
-
removeNodeHook(vnode, parentNode);
|
|
5352
|
-
var vm = getAssociatedVMIfPresent(vnode.elm);
|
|
5353
5134
|
|
|
5354
|
-
|
|
5355
|
-
// for custom elements we don't have to go recursively because the removeVM routine
|
|
5356
|
-
// will take care of disconnecting any child VM attached to its shadow as well.
|
|
5357
|
-
removeVM(vm);
|
|
5358
|
-
}
|
|
5359
|
-
},
|
|
5360
|
-
hydrate: function hydrate(vnode, elm) {
|
|
5361
|
-
// the element is created, but the vm is not
|
|
5362
|
-
var sel = vnode.sel,
|
|
5363
|
-
mode = vnode.mode,
|
|
5364
|
-
ctor = vnode.ctor,
|
|
5365
|
-
owner = vnode.owner;
|
|
5366
|
-
var def = getComponentInternalDef(ctor);
|
|
5367
|
-
createVM(elm, def, {
|
|
5368
|
-
mode: mode,
|
|
5369
|
-
owner: owner,
|
|
5370
|
-
tagName: sel
|
|
5371
|
-
});
|
|
5372
|
-
vnode.elm = elm;
|
|
5373
|
-
var vm = getAssociatedVM(elm);
|
|
5374
|
-
allocateChildrenHook(vnode, vm);
|
|
5375
|
-
hydrateElmHook(vnode); // Insert hook section:
|
|
5135
|
+
var referenceElm = null;
|
|
5376
5136
|
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
, "".concat(vm, " cannot be recycled."));
|
|
5381
|
-
}
|
|
5137
|
+
for (var _i15 = newChLength - 1; _i15 >= 0; _i15 -= 1) {
|
|
5138
|
+
var vnode = newCh[_i15];
|
|
5139
|
+
var oldVNode = oldCh[_i15];
|
|
5382
5140
|
|
|
5383
|
-
|
|
5141
|
+
if (vnode !== oldVNode) {
|
|
5142
|
+
if (isVNode(oldVNode)) {
|
|
5143
|
+
if (isVNode(vnode)) {
|
|
5144
|
+
// both vnodes must be equivalent, and se just need to patch them
|
|
5145
|
+
patchVnode(oldVNode, vnode);
|
|
5146
|
+
referenceElm = vnode.elm;
|
|
5147
|
+
} else {
|
|
5148
|
+
// removing the old vnode since the new one is null
|
|
5149
|
+
oldVNode.hook.remove(oldVNode, parentElm);
|
|
5150
|
+
}
|
|
5151
|
+
} else if (isVNode(vnode)) {
|
|
5152
|
+
// this condition is unnecessary
|
|
5153
|
+
vnode.hook.create(vnode); // insert the new node one since the old one is null
|
|
5384
5154
|
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
5389
|
-
// Note: for Light DOM, this is handled while hydrating the VM
|
|
5390
|
-
hydrateChildrenHook(vnode.elm.childNodes, vnode.children, vm);
|
|
5155
|
+
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
5156
|
+
referenceElm = vnode.elm;
|
|
5157
|
+
}
|
|
5391
5158
|
}
|
|
5392
|
-
|
|
5393
|
-
hydrateVM(vm);
|
|
5394
5159
|
}
|
|
5395
|
-
}
|
|
5396
|
-
|
|
5397
|
-
function linkNodeToShadow(elm, owner) {
|
|
5398
|
-
var renderMode = owner.renderMode,
|
|
5399
|
-
shadowMode = owner.shadowMode; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
5160
|
+
}
|
|
5400
5161
|
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
/* Light */
|
|
5406
|
-
) {
|
|
5407
|
-
elm[KEY__SHADOW_RESOLVER] = getRenderRoot(owner)[KEY__SHADOW_RESOLVER];
|
|
5408
|
-
}
|
|
5162
|
+
function patchVnode(oldVnode, vnode) {
|
|
5163
|
+
if (oldVnode !== vnode) {
|
|
5164
|
+
vnode.elm = oldVnode.elm;
|
|
5165
|
+
vnode.hook.update(oldVnode, vnode);
|
|
5409
5166
|
}
|
|
5410
5167
|
}
|
|
5168
|
+
/*
|
|
5169
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
5170
|
+
* All rights reserved.
|
|
5171
|
+
* SPDX-License-Identifier: MIT
|
|
5172
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5173
|
+
*/
|
|
5174
|
+
|
|
5175
|
+
|
|
5176
|
+
var SymbolIterator = Symbol.iterator;
|
|
5411
5177
|
|
|
5412
5178
|
function addVNodeToChildLWC(vnode) {
|
|
5413
5179
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
|
@@ -5432,18 +5198,20 @@
|
|
|
5432
5198
|
|
|
5433
5199
|
forEach.call(children, function (childVnode) {
|
|
5434
5200
|
if (childVnode != null) {
|
|
5435
|
-
assert.isTrue(
|
|
5201
|
+
assert.isTrue('type' in childVnode && 'sel' in childVnode && 'elm' in childVnode && 'key' in childVnode, "".concat(childVnode, " is not a vnode."));
|
|
5436
5202
|
}
|
|
5437
5203
|
});
|
|
5438
5204
|
}
|
|
5439
5205
|
|
|
5440
|
-
var
|
|
5206
|
+
var elm;
|
|
5441
5207
|
var key = data.key;
|
|
5442
5208
|
return {
|
|
5209
|
+
type: 2
|
|
5210
|
+
/* Element */
|
|
5211
|
+
,
|
|
5443
5212
|
sel: sel,
|
|
5444
5213
|
data: data,
|
|
5445
5214
|
children: children,
|
|
5446
|
-
text: text,
|
|
5447
5215
|
elm: elm,
|
|
5448
5216
|
key: key,
|
|
5449
5217
|
hook: ElementHook,
|
|
@@ -5523,19 +5291,21 @@
|
|
|
5523
5291
|
if (arguments.length === 4) {
|
|
5524
5292
|
forEach.call(children, function (childVnode) {
|
|
5525
5293
|
if (childVnode != null) {
|
|
5526
|
-
assert.isTrue(
|
|
5294
|
+
assert.isTrue('type' in childVnode && 'sel' in childVnode && 'elm' in childVnode && 'key' in childVnode, "".concat(childVnode, " is not a vnode."));
|
|
5527
5295
|
}
|
|
5528
5296
|
});
|
|
5529
5297
|
}
|
|
5530
5298
|
}
|
|
5531
5299
|
|
|
5532
5300
|
var key = data.key;
|
|
5533
|
-
var
|
|
5301
|
+
var elm;
|
|
5534
5302
|
var vnode = {
|
|
5303
|
+
type: 3
|
|
5304
|
+
/* CustomElement */
|
|
5305
|
+
,
|
|
5535
5306
|
sel: sel,
|
|
5536
5307
|
data: data,
|
|
5537
5308
|
children: children,
|
|
5538
|
-
text: text,
|
|
5539
5309
|
elm: elm,
|
|
5540
5310
|
key: key,
|
|
5541
5311
|
hook: CustomElementHook,
|
|
@@ -5660,12 +5430,12 @@
|
|
|
5660
5430
|
|
|
5661
5431
|
|
|
5662
5432
|
function t(text) {
|
|
5663
|
-
var
|
|
5664
|
-
var sel, children, key, elm;
|
|
5433
|
+
var sel, key, elm;
|
|
5665
5434
|
return {
|
|
5435
|
+
type: 0
|
|
5436
|
+
/* Text */
|
|
5437
|
+
,
|
|
5666
5438
|
sel: sel,
|
|
5667
|
-
data: data,
|
|
5668
|
-
children: children,
|
|
5669
5439
|
text: text,
|
|
5670
5440
|
elm: elm,
|
|
5671
5441
|
key: key,
|
|
@@ -5676,12 +5446,12 @@
|
|
|
5676
5446
|
|
|
5677
5447
|
|
|
5678
5448
|
function co(text) {
|
|
5679
|
-
var
|
|
5680
|
-
var sel, children, key, elm;
|
|
5449
|
+
var sel, key, elm;
|
|
5681
5450
|
return {
|
|
5451
|
+
type: 1
|
|
5452
|
+
/* Comment */
|
|
5453
|
+
,
|
|
5682
5454
|
sel: sel,
|
|
5683
|
-
data: data,
|
|
5684
|
-
children: children,
|
|
5685
5455
|
text: text,
|
|
5686
5456
|
elm: elm,
|
|
5687
5457
|
key: key,
|
|
@@ -5974,8 +5744,8 @@
|
|
|
5974
5744
|
var content = [];
|
|
5975
5745
|
var root;
|
|
5976
5746
|
|
|
5977
|
-
for (var
|
|
5978
|
-
var stylesheet = stylesheets[
|
|
5747
|
+
for (var _i16 = 0; _i16 < stylesheets.length; _i16++) {
|
|
5748
|
+
var stylesheet = stylesheets[_i16];
|
|
5979
5749
|
|
|
5980
5750
|
if (isArray$1(stylesheet)) {
|
|
5981
5751
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
@@ -6085,8 +5855,8 @@
|
|
|
6085
5855
|
&& shadowMode === 1
|
|
6086
5856
|
/* Synthetic */
|
|
6087
5857
|
) {
|
|
6088
|
-
for (var
|
|
6089
|
-
insertGlobalStylesheet$1(stylesheets[
|
|
5858
|
+
for (var _i17 = 0; _i17 < stylesheets.length; _i17++) {
|
|
5859
|
+
insertGlobalStylesheet$1(stylesheets[_i17]);
|
|
6090
5860
|
}
|
|
6091
5861
|
} else if (ssr$1 || isHydrating$1()) {
|
|
6092
5862
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
@@ -6100,12 +5870,12 @@
|
|
|
6100
5870
|
var root = getNearestNativeShadowComponent(vm);
|
|
6101
5871
|
var isGlobal = isNull(root);
|
|
6102
5872
|
|
|
6103
|
-
for (var
|
|
5873
|
+
for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
|
|
6104
5874
|
if (isGlobal) {
|
|
6105
|
-
insertGlobalStylesheet$1(stylesheets[
|
|
5875
|
+
insertGlobalStylesheet$1(stylesheets[_i18]);
|
|
6106
5876
|
} else {
|
|
6107
5877
|
// local level
|
|
6108
|
-
insertStylesheet$1(stylesheets[
|
|
5878
|
+
insertStylesheet$1(stylesheets[_i18], root.shadowRoot);
|
|
6109
5879
|
}
|
|
6110
5880
|
}
|
|
6111
5881
|
}
|
|
@@ -6382,8 +6152,8 @@
|
|
|
6382
6152
|
var stylesheets = template.stylesheets;
|
|
6383
6153
|
|
|
6384
6154
|
if (!isUndefined$1(stylesheets)) {
|
|
6385
|
-
for (var
|
|
6386
|
-
if (isTrue(stylesheets[
|
|
6155
|
+
for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
|
|
6156
|
+
if (isTrue(stylesheets[_i19][KEY__SCOPED_CSS])) {
|
|
6387
6157
|
return true;
|
|
6388
6158
|
}
|
|
6389
6159
|
}
|
|
@@ -6399,24 +6169,6 @@
|
|
|
6399
6169
|
*/
|
|
6400
6170
|
|
|
6401
6171
|
|
|
6402
|
-
function addErrorComponentStack(vm, error) {
|
|
6403
|
-
if (!isFrozen(error) && isUndefined$1(error.wcStack)) {
|
|
6404
|
-
var wcStack = getErrorComponentStack(vm);
|
|
6405
|
-
defineProperty(error, 'wcStack', {
|
|
6406
|
-
get: function get() {
|
|
6407
|
-
return wcStack;
|
|
6408
|
-
}
|
|
6409
|
-
});
|
|
6410
|
-
}
|
|
6411
|
-
}
|
|
6412
|
-
/*
|
|
6413
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
6414
|
-
* All rights reserved.
|
|
6415
|
-
* SPDX-License-Identifier: MIT
|
|
6416
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6417
|
-
*/
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
6172
|
var isInvokingRender = false;
|
|
6421
6173
|
var vmBeingConstructed = null;
|
|
6422
6174
|
|
|
@@ -6613,8 +6365,8 @@
|
|
|
6613
6365
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
6614
6366
|
}
|
|
6615
6367
|
|
|
6616
|
-
for (var
|
|
6617
|
-
var hookName = hooks[
|
|
6368
|
+
for (var _i20 = 0; _i20 < hooks.length; ++_i20) {
|
|
6369
|
+
var hookName = hooks[_i20];
|
|
6618
6370
|
|
|
6619
6371
|
if (hookName in service) {
|
|
6620
6372
|
var l = Services[hookName];
|
|
@@ -6637,9 +6389,318 @@
|
|
|
6637
6389
|
def = vm.def,
|
|
6638
6390
|
context = vm.context;
|
|
6639
6391
|
|
|
6640
|
-
for (var
|
|
6641
|
-
cbs[
|
|
6392
|
+
for (var _i21 = 0, _len8 = cbs.length; _i21 < _len8; ++_i21) {
|
|
6393
|
+
cbs[_i21].call(undefined, component, {}, def, context);
|
|
6394
|
+
}
|
|
6395
|
+
}
|
|
6396
|
+
/*
|
|
6397
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
6398
|
+
* All rights reserved.
|
|
6399
|
+
* SPDX-License-Identifier: MIT
|
|
6400
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6401
|
+
*/
|
|
6402
|
+
|
|
6403
|
+
|
|
6404
|
+
function hydrate$1(vnode, node) {
|
|
6405
|
+
switch (vnode.type) {
|
|
6406
|
+
case 0
|
|
6407
|
+
/* Text */
|
|
6408
|
+
:
|
|
6409
|
+
hydrateText(vnode, node);
|
|
6410
|
+
break;
|
|
6411
|
+
|
|
6412
|
+
case 1
|
|
6413
|
+
/* Comment */
|
|
6414
|
+
:
|
|
6415
|
+
hydrateComment(vnode, node);
|
|
6416
|
+
break;
|
|
6417
|
+
|
|
6418
|
+
case 2
|
|
6419
|
+
/* Element */
|
|
6420
|
+
:
|
|
6421
|
+
hydrateElement(vnode, node);
|
|
6422
|
+
break;
|
|
6423
|
+
|
|
6424
|
+
case 3
|
|
6425
|
+
/* CustomElement */
|
|
6426
|
+
:
|
|
6427
|
+
hydrateCustomElement(vnode, node);
|
|
6428
|
+
break;
|
|
6429
|
+
}
|
|
6430
|
+
}
|
|
6431
|
+
|
|
6432
|
+
function hydrateText(vnode, node) {
|
|
6433
|
+
var _a;
|
|
6434
|
+
|
|
6435
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6436
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6437
|
+
validateNodeType(vnode, node, Node.TEXT_NODE);
|
|
6438
|
+
|
|
6439
|
+
if (node.nodeValue !== vnode.text && !(node.nodeValue === "\u200D" && vnode.text === '')) {
|
|
6440
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
|
|
6441
|
+
}
|
|
6442
|
+
} // always set the text value to the one from the vnode.
|
|
6443
|
+
|
|
6444
|
+
|
|
6445
|
+
node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;
|
|
6446
|
+
vnode.elm = node;
|
|
6447
|
+
}
|
|
6448
|
+
|
|
6449
|
+
function hydrateComment(vnode, node) {
|
|
6450
|
+
var _a;
|
|
6451
|
+
|
|
6452
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6453
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6454
|
+
validateNodeType(vnode, node, Node.COMMENT_NODE);
|
|
6455
|
+
|
|
6456
|
+
if (node.nodeValue !== vnode.text) {
|
|
6457
|
+
logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
|
|
6458
|
+
}
|
|
6459
|
+
} // always set the text value to the one from the vnode.
|
|
6460
|
+
|
|
6461
|
+
|
|
6462
|
+
node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;
|
|
6463
|
+
vnode.elm = node;
|
|
6464
|
+
}
|
|
6465
|
+
|
|
6466
|
+
function hydrateElement(vnode, node) {
|
|
6467
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6468
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6469
|
+
validateNodeType(vnode, node, Node.ELEMENT_NODE);
|
|
6470
|
+
validateElement(vnode, node);
|
|
6471
|
+
}
|
|
6472
|
+
|
|
6473
|
+
var elm = node;
|
|
6474
|
+
vnode.elm = elm;
|
|
6475
|
+
var context = vnode.data.context;
|
|
6476
|
+
var isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
6477
|
+
/* Manual */
|
|
6478
|
+
);
|
|
6479
|
+
|
|
6480
|
+
if (isDomManual) {
|
|
6481
|
+
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6482
|
+
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6483
|
+
var props = vnode.data.props;
|
|
6484
|
+
|
|
6485
|
+
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6486
|
+
if (elm.innerHTML === props.innerHTML) {
|
|
6487
|
+
delete props.innerHTML;
|
|
6488
|
+
} else {
|
|
6489
|
+
logWarn("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: innerHTML values do not match for element, will recover from the difference"), vnode.owner);
|
|
6490
|
+
}
|
|
6491
|
+
}
|
|
6492
|
+
}
|
|
6493
|
+
|
|
6494
|
+
patchElementPropsAndAttrs(vnode);
|
|
6495
|
+
|
|
6496
|
+
if (!isDomManual) {
|
|
6497
|
+
hydrateChildren(vnode.elm.childNodes, vnode.children, vnode.owner);
|
|
6498
|
+
}
|
|
6499
|
+
}
|
|
6500
|
+
|
|
6501
|
+
function hydrateCustomElement(vnode, node) {
|
|
6502
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6503
|
+
// eslint-disable-next-line lwc-internal/no-global-node
|
|
6504
|
+
validateNodeType(vnode, node, Node.ELEMENT_NODE);
|
|
6505
|
+
validateElement(vnode, node);
|
|
6506
|
+
}
|
|
6507
|
+
|
|
6508
|
+
var elm = node;
|
|
6509
|
+
vnode.elm = elm;
|
|
6510
|
+
var sel = vnode.sel,
|
|
6511
|
+
mode = vnode.mode,
|
|
6512
|
+
ctor = vnode.ctor,
|
|
6513
|
+
owner = vnode.owner;
|
|
6514
|
+
var vm = createVM(elm, ctor, {
|
|
6515
|
+
mode: mode,
|
|
6516
|
+
owner: owner,
|
|
6517
|
+
tagName: sel
|
|
6518
|
+
});
|
|
6519
|
+
allocateChildren(vnode, vm);
|
|
6520
|
+
patchElementPropsAndAttrs(vnode); // Insert hook section:
|
|
6521
|
+
|
|
6522
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6523
|
+
assert.isTrue(vm.state === 0
|
|
6524
|
+
/* created */
|
|
6525
|
+
, "".concat(vm, " cannot be recycled."));
|
|
6526
|
+
}
|
|
6527
|
+
|
|
6528
|
+
runConnectedCallback(vm);
|
|
6529
|
+
|
|
6530
|
+
if (vm.renderMode !== 0
|
|
6531
|
+
/* Light */
|
|
6532
|
+
) {
|
|
6533
|
+
// VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6534
|
+
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6535
|
+
hydrateChildren(vnode.elm.childNodes, vnode.children, vm);
|
|
6536
|
+
}
|
|
6537
|
+
|
|
6538
|
+
hydrateVM(vm);
|
|
6539
|
+
}
|
|
6540
|
+
|
|
6541
|
+
function hydrateChildren(elmChildren, children, vm) {
|
|
6542
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6543
|
+
var filteredVNodes = ArrayFilter.call(children, function (vnode) {
|
|
6544
|
+
return !!vnode;
|
|
6545
|
+
});
|
|
6546
|
+
|
|
6547
|
+
if (elmChildren.length !== filteredVNodes.length) {
|
|
6548
|
+
logError("Hydration mismatch: incorrect number of rendered nodes, expected ".concat(filteredVNodes.length, " but found ").concat(elmChildren.length, "."), vm);
|
|
6549
|
+
throwHydrationError();
|
|
6550
|
+
}
|
|
6551
|
+
}
|
|
6552
|
+
|
|
6553
|
+
var childNodeIndex = 0;
|
|
6554
|
+
|
|
6555
|
+
for (var _i22 = 0; _i22 < children.length; _i22++) {
|
|
6556
|
+
var childVnode = children[_i22];
|
|
6557
|
+
|
|
6558
|
+
if (!isNull(childVnode)) {
|
|
6559
|
+
var childNode = elmChildren[childNodeIndex];
|
|
6560
|
+
hydrate$1(childVnode, childNode);
|
|
6561
|
+
childNodeIndex++;
|
|
6562
|
+
}
|
|
6563
|
+
}
|
|
6564
|
+
}
|
|
6565
|
+
|
|
6566
|
+
function patchElementPropsAndAttrs(vnode) {
|
|
6567
|
+
applyEventListeners(vnode);
|
|
6568
|
+
patchProps(null, vnode);
|
|
6569
|
+
}
|
|
6570
|
+
|
|
6571
|
+
function throwHydrationError() {
|
|
6572
|
+
assert.fail('Server rendered elements do not match client side generated elements');
|
|
6573
|
+
}
|
|
6574
|
+
|
|
6575
|
+
function validateNodeType(vnode, node, nodeType) {
|
|
6576
|
+
if (node.nodeType !== nodeType) {
|
|
6577
|
+
logError('Hydration mismatch: incorrect node type received', vnode.owner);
|
|
6578
|
+
assert.fail('Hydration mismatch: incorrect node type received.');
|
|
6579
|
+
}
|
|
6580
|
+
}
|
|
6581
|
+
|
|
6582
|
+
function validateElement(vnode, elm) {
|
|
6583
|
+
if (vnode.sel.toLowerCase() !== elm.tagName.toLowerCase()) {
|
|
6584
|
+
logError("Hydration mismatch: expecting element with tag \"".concat(vnode.sel.toLowerCase(), "\" but found \"").concat(elm.tagName.toLowerCase(), "\"."), vnode.owner);
|
|
6585
|
+
throwHydrationError();
|
|
6586
|
+
}
|
|
6587
|
+
|
|
6588
|
+
var hasIncompatibleAttrs = validateAttrs(vnode, elm);
|
|
6589
|
+
var hasIncompatibleClass = validateClassAttr(vnode, elm);
|
|
6590
|
+
var hasIncompatibleStyle = validateStyleAttr(vnode, elm);
|
|
6591
|
+
var isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;
|
|
6592
|
+
|
|
6593
|
+
if (!isVNodeAndElementCompatible) {
|
|
6594
|
+
throwHydrationError();
|
|
6595
|
+
}
|
|
6596
|
+
}
|
|
6597
|
+
|
|
6598
|
+
function validateAttrs(vnode, elm) {
|
|
6599
|
+
var _vnode$data$attrs = vnode.data.attrs,
|
|
6600
|
+
attrs = _vnode$data$attrs === void 0 ? {} : _vnode$data$attrs;
|
|
6601
|
+
var nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.
|
|
6602
|
+
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
|
6603
|
+
|
|
6604
|
+
for (var _i23 = 0, _Object$entries = Object.entries(attrs); _i23 < _Object$entries.length; _i23++) {
|
|
6605
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i23], 2),
|
|
6606
|
+
attrName = _Object$entries$_i[0],
|
|
6607
|
+
attrValue = _Object$entries$_i[1];
|
|
6608
|
+
|
|
6609
|
+
var elmAttrValue = getAttribute$1(elm, attrName);
|
|
6610
|
+
|
|
6611
|
+
if (String(attrValue) !== elmAttrValue) {
|
|
6612
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"").concat(attrName, "\" has different values, expected \"").concat(attrValue, "\" but found \"").concat(elmAttrValue, "\""), vnode.owner);
|
|
6613
|
+
nodesAreCompatible = false;
|
|
6614
|
+
}
|
|
6615
|
+
}
|
|
6616
|
+
|
|
6617
|
+
return nodesAreCompatible;
|
|
6618
|
+
}
|
|
6619
|
+
|
|
6620
|
+
function validateClassAttr(vnode, elm) {
|
|
6621
|
+
var _vnode$data = vnode.data,
|
|
6622
|
+
className = _vnode$data.className,
|
|
6623
|
+
classMap = _vnode$data.classMap;
|
|
6624
|
+
var nodesAreCompatible = true;
|
|
6625
|
+
var vnodeClassName;
|
|
6626
|
+
|
|
6627
|
+
if (!isUndefined$1(className) && String(className) !== elm.className) {
|
|
6628
|
+
// className is used when class is bound to an expr.
|
|
6629
|
+
nodesAreCompatible = false;
|
|
6630
|
+
vnodeClassName = className;
|
|
6631
|
+
} else if (!isUndefined$1(classMap)) {
|
|
6632
|
+
// classMap is used when class is set to static value.
|
|
6633
|
+
var classList = getClassList$1(elm);
|
|
6634
|
+
var computedClassName = ''; // all classes from the vnode should be in the element.classList
|
|
6635
|
+
|
|
6636
|
+
for (var name in classMap) {
|
|
6637
|
+
computedClassName += ' ' + name;
|
|
6638
|
+
|
|
6639
|
+
if (!classList.contains(name)) {
|
|
6640
|
+
nodesAreCompatible = false;
|
|
6641
|
+
}
|
|
6642
|
+
}
|
|
6643
|
+
|
|
6644
|
+
vnodeClassName = computedClassName.trim();
|
|
6645
|
+
|
|
6646
|
+
if (classList.length > keys(classMap).length) {
|
|
6647
|
+
nodesAreCompatible = false;
|
|
6648
|
+
}
|
|
6649
|
+
}
|
|
6650
|
+
|
|
6651
|
+
if (!nodesAreCompatible) {
|
|
6652
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"class\" has different values, expected \"").concat(vnodeClassName, "\" but found \"").concat(elm.className, "\""), vnode.owner);
|
|
6653
|
+
}
|
|
6654
|
+
|
|
6655
|
+
return nodesAreCompatible;
|
|
6656
|
+
}
|
|
6657
|
+
|
|
6658
|
+
function validateStyleAttr(vnode, elm) {
|
|
6659
|
+
var _vnode$data2 = vnode.data,
|
|
6660
|
+
style = _vnode$data2.style,
|
|
6661
|
+
styleDecls = _vnode$data2.styleDecls;
|
|
6662
|
+
var elmStyle = getAttribute$1(elm, 'style') || '';
|
|
6663
|
+
var vnodeStyle;
|
|
6664
|
+
var nodesAreCompatible = true;
|
|
6665
|
+
|
|
6666
|
+
if (!isUndefined$1(style) && style !== elmStyle) {
|
|
6667
|
+
nodesAreCompatible = false;
|
|
6668
|
+
vnodeStyle = style;
|
|
6669
|
+
} else if (!isUndefined$1(styleDecls)) {
|
|
6670
|
+
var parsedVnodeStyle = parseStyleText(elmStyle);
|
|
6671
|
+
var expectedStyle = []; // styleMap is used when style is set to static value.
|
|
6672
|
+
|
|
6673
|
+
for (var _i24 = 0, n = styleDecls.length; _i24 < n; _i24++) {
|
|
6674
|
+
var _styleDecls$_i2 = _slicedToArray(styleDecls[_i24], 3),
|
|
6675
|
+
prop = _styleDecls$_i2[0],
|
|
6676
|
+
value = _styleDecls$_i2[1],
|
|
6677
|
+
important = _styleDecls$_i2[2];
|
|
6678
|
+
|
|
6679
|
+
expectedStyle.push("".concat(prop, ": ").concat(value + (important ? ' important!' : '')));
|
|
6680
|
+
var parsedPropValue = parsedVnodeStyle[prop];
|
|
6681
|
+
|
|
6682
|
+
if (isUndefined$1(parsedPropValue)) {
|
|
6683
|
+
nodesAreCompatible = false;
|
|
6684
|
+
} else if (!parsedPropValue.startsWith(value)) {
|
|
6685
|
+
nodesAreCompatible = false;
|
|
6686
|
+
} else if (important && !parsedPropValue.endsWith('!important')) {
|
|
6687
|
+
nodesAreCompatible = false;
|
|
6688
|
+
}
|
|
6689
|
+
}
|
|
6690
|
+
|
|
6691
|
+
if (keys(parsedVnodeStyle).length > styleDecls.length) {
|
|
6692
|
+
nodesAreCompatible = false;
|
|
6693
|
+
}
|
|
6694
|
+
|
|
6695
|
+
vnodeStyle = ArrayJoin.call(expectedStyle, ';');
|
|
6696
|
+
}
|
|
6697
|
+
|
|
6698
|
+
if (!nodesAreCompatible) {
|
|
6699
|
+
// style is used when class is bound to an expr.
|
|
6700
|
+
logError("Mismatch hydrating element <".concat(elm.tagName.toLowerCase(), ">: attribute \"style\" has different values, expected \"").concat(vnodeStyle, "\" but found \"").concat(elmStyle, "\"."), vnode.owner);
|
|
6642
6701
|
}
|
|
6702
|
+
|
|
6703
|
+
return nodesAreCompatible;
|
|
6643
6704
|
}
|
|
6644
6705
|
/*
|
|
6645
6706
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6764,10 +6825,11 @@
|
|
|
6764
6825
|
return ancestor;
|
|
6765
6826
|
}
|
|
6766
6827
|
|
|
6767
|
-
function createVM(elm,
|
|
6828
|
+
function createVM(elm, ctor, options) {
|
|
6768
6829
|
var mode = options.mode,
|
|
6769
6830
|
owner = options.owner,
|
|
6770
6831
|
tagName = options.tagName;
|
|
6832
|
+
var def = getComponentInternalDef(ctor);
|
|
6771
6833
|
var vm = {
|
|
6772
6834
|
elm: elm,
|
|
6773
6835
|
def: def,
|
|
@@ -6789,7 +6851,6 @@
|
|
|
6789
6851
|
oar: create(null),
|
|
6790
6852
|
cmpTemplate: null,
|
|
6791
6853
|
renderMode: def.renderMode,
|
|
6792
|
-
shadowMode: null,
|
|
6793
6854
|
context: {
|
|
6794
6855
|
stylesheetToken: undefined,
|
|
6795
6856
|
hasTokenInClass: undefined,
|
|
@@ -6800,9 +6861,13 @@
|
|
|
6800
6861
|
wiredConnecting: EmptyArray,
|
|
6801
6862
|
wiredDisconnecting: EmptyArray
|
|
6802
6863
|
},
|
|
6864
|
+
// Properties set right after VM creation.
|
|
6803
6865
|
tro: null,
|
|
6866
|
+
shadowMode: null,
|
|
6867
|
+
// Properties set by the LightningElement constructor.
|
|
6804
6868
|
component: null,
|
|
6805
|
-
|
|
6869
|
+
shadowRoot: null,
|
|
6870
|
+
renderRoot: null,
|
|
6806
6871
|
callHook: callHook,
|
|
6807
6872
|
setHook: setHook,
|
|
6808
6873
|
getHook: getHook
|
|
@@ -6888,7 +6953,7 @@
|
|
|
6888
6953
|
}
|
|
6889
6954
|
|
|
6890
6955
|
function assertIsVM(obj) {
|
|
6891
|
-
if (isNull(obj) || !isObject(obj) || !('
|
|
6956
|
+
if (isNull(obj) || !isObject(obj) || !('renderRoot' in obj)) {
|
|
6892
6957
|
throw new TypeError("".concat(obj, " is not a VM."));
|
|
6893
6958
|
}
|
|
6894
6959
|
}
|
|
@@ -6937,13 +7002,14 @@
|
|
|
6937
7002
|
var vmChildren = vm.renderMode === 0
|
|
6938
7003
|
/* Light */
|
|
6939
7004
|
? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;
|
|
6940
|
-
|
|
7005
|
+
hydrateChildren(vmChildren, children, vm);
|
|
6941
7006
|
runRenderedCallback(vm);
|
|
6942
7007
|
}
|
|
6943
7008
|
}
|
|
6944
7009
|
|
|
6945
7010
|
function patchShadowRoot(vm, newCh) {
|
|
6946
|
-
var
|
|
7011
|
+
var renderRoot = vm.renderRoot,
|
|
7012
|
+
oldCh = vm.children; // caching the new children collection
|
|
6947
7013
|
|
|
6948
7014
|
vm.children = newCh;
|
|
6949
7015
|
|
|
@@ -6958,7 +7024,6 @@
|
|
|
6958
7024
|
, vm);
|
|
6959
7025
|
}, function () {
|
|
6960
7026
|
// job
|
|
6961
|
-
var renderRoot = getRenderRoot(vm);
|
|
6962
7027
|
patchChildren(renderRoot, oldCh, newCh);
|
|
6963
7028
|
}, function () {
|
|
6964
7029
|
// post
|
|
@@ -7020,19 +7085,19 @@
|
|
|
7020
7085
|
});
|
|
7021
7086
|
rehydrateQueue = []; // reset to a new queue
|
|
7022
7087
|
|
|
7023
|
-
for (var
|
|
7024
|
-
var vm = vms[
|
|
7088
|
+
for (var _i25 = 0, _len9 = vms.length; _i25 < _len9; _i25 += 1) {
|
|
7089
|
+
var vm = vms[_i25];
|
|
7025
7090
|
|
|
7026
7091
|
try {
|
|
7027
7092
|
rehydrate(vm);
|
|
7028
7093
|
} catch (error) {
|
|
7029
|
-
if (
|
|
7094
|
+
if (_i25 + 1 < _len9) {
|
|
7030
7095
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
7031
7096
|
if (rehydrateQueue.length === 0) {
|
|
7032
7097
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
7033
7098
|
}
|
|
7034
7099
|
|
|
7035
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
7100
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i25 + 1));
|
|
7036
7101
|
} // we need to end the measure before throwing.
|
|
7037
7102
|
|
|
7038
7103
|
|
|
@@ -7136,8 +7201,8 @@
|
|
|
7136
7201
|
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
7137
7202
|
// inserted in reserved order.
|
|
7138
7203
|
|
|
7139
|
-
for (var
|
|
7140
|
-
var elm = vCustomElementCollection[
|
|
7204
|
+
for (var _i26 = vCustomElementCollection.length - 1; _i26 >= 0; _i26 -= 1) {
|
|
7205
|
+
var elm = vCustomElementCollection[_i26].elm; // There are two cases where the element could be undefined:
|
|
7141
7206
|
// * when there is an error during the construction phase, and an error
|
|
7142
7207
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
7143
7208
|
// is not properly initialized, and therefore is should be ignored.
|
|
@@ -7171,17 +7236,25 @@
|
|
|
7171
7236
|
|
|
7172
7237
|
|
|
7173
7238
|
function recursivelyDisconnectChildren(vnodes) {
|
|
7174
|
-
for (var
|
|
7175
|
-
var vnode = vnodes[
|
|
7176
|
-
|
|
7177
|
-
if (!isNull(vnode) &&
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7239
|
+
for (var _i27 = 0, _len10 = vnodes.length; _i27 < _len10; _i27 += 1) {
|
|
7240
|
+
var vnode = vnodes[_i27];
|
|
7241
|
+
|
|
7242
|
+
if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
|
|
7243
|
+
switch (vnode.type) {
|
|
7244
|
+
case 2
|
|
7245
|
+
/* Element */
|
|
7246
|
+
:
|
|
7247
|
+
recursivelyDisconnectChildren(vnode.children);
|
|
7248
|
+
break;
|
|
7249
|
+
|
|
7250
|
+
case 3
|
|
7251
|
+
/* CustomElement */
|
|
7252
|
+
:
|
|
7253
|
+
{
|
|
7254
|
+
var vm = getAssociatedVM(vnode.elm);
|
|
7255
|
+
resetComponentStateWhenRemoved(vm);
|
|
7256
|
+
break;
|
|
7257
|
+
}
|
|
7185
7258
|
}
|
|
7186
7259
|
}
|
|
7187
7260
|
}
|
|
@@ -7192,14 +7265,14 @@
|
|
|
7192
7265
|
|
|
7193
7266
|
|
|
7194
7267
|
function resetComponentRoot(vm) {
|
|
7195
|
-
var children = vm.children
|
|
7196
|
-
|
|
7268
|
+
var children = vm.children,
|
|
7269
|
+
renderRoot = vm.renderRoot;
|
|
7197
7270
|
|
|
7198
|
-
for (var
|
|
7199
|
-
var child = children[
|
|
7271
|
+
for (var _i28 = 0, _len11 = children.length; _i28 < _len11; _i28++) {
|
|
7272
|
+
var child = children[_i28];
|
|
7200
7273
|
|
|
7201
7274
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
7202
|
-
remove$1(child.elm,
|
|
7275
|
+
remove$1(child.elm, renderRoot);
|
|
7203
7276
|
}
|
|
7204
7277
|
}
|
|
7205
7278
|
|
|
@@ -7287,12 +7360,6 @@
|
|
|
7287
7360
|
scheduleRehydration(vm);
|
|
7288
7361
|
}
|
|
7289
7362
|
}
|
|
7290
|
-
|
|
7291
|
-
function getRenderRoot(vm) {
|
|
7292
|
-
return vm.renderMode === 1
|
|
7293
|
-
/* Shadow */
|
|
7294
|
-
? vm.cmpRoot : vm.elm;
|
|
7295
|
-
}
|
|
7296
7363
|
/*
|
|
7297
7364
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
7298
7365
|
* All rights reserved.
|
|
@@ -7576,8 +7643,8 @@
|
|
|
7576
7643
|
function connectWireAdapters(vm) {
|
|
7577
7644
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
7578
7645
|
|
|
7579
|
-
for (var
|
|
7580
|
-
wiredConnecting[
|
|
7646
|
+
for (var _i29 = 0, _len12 = wiredConnecting.length; _i29 < _len12; _i29 += 1) {
|
|
7647
|
+
wiredConnecting[_i29]();
|
|
7581
7648
|
}
|
|
7582
7649
|
}
|
|
7583
7650
|
|
|
@@ -7585,8 +7652,8 @@
|
|
|
7585
7652
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
7586
7653
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
7587
7654
|
// job
|
|
7588
|
-
for (var
|
|
7589
|
-
wiredDisconnecting[
|
|
7655
|
+
for (var _i30 = 0, _len13 = wiredDisconnecting.length; _i30 < _len13; _i30 += 1) {
|
|
7656
|
+
wiredDisconnecting[_i30]();
|
|
7590
7657
|
}
|
|
7591
7658
|
}, noop);
|
|
7592
7659
|
}
|
|
@@ -7676,7 +7743,7 @@
|
|
|
7676
7743
|
hooksAreSet = true;
|
|
7677
7744
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7678
7745
|
}
|
|
7679
|
-
/* version: 2.7.
|
|
7746
|
+
/* version: 2.7.4 */
|
|
7680
7747
|
|
|
7681
7748
|
/*
|
|
7682
7749
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7691,8 +7758,8 @@
|
|
|
7691
7758
|
if (process.env.NODE_ENV === 'development') {
|
|
7692
7759
|
// @ts-ignore
|
|
7693
7760
|
window.__lwcResetGlobalStylesheets = function () {
|
|
7694
|
-
for (var
|
|
7695
|
-
var key = _Object$keys[
|
|
7761
|
+
for (var _i31 = 0, _Object$keys = Object.keys(globalStylesheets); _i31 < _Object$keys.length; _i31++) {
|
|
7762
|
+
var key = _Object$keys[_i31];
|
|
7696
7763
|
delete globalStylesheets[key];
|
|
7697
7764
|
}
|
|
7698
7765
|
};
|
|
@@ -8150,8 +8217,7 @@
|
|
|
8150
8217
|
*/
|
|
8151
8218
|
|
|
8152
8219
|
var element = new UpgradableConstructor(function (elm) {
|
|
8153
|
-
|
|
8154
|
-
createVM(elm, def, {
|
|
8220
|
+
createVM(elm, Ctor, {
|
|
8155
8221
|
tagName: sel,
|
|
8156
8222
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
8157
8223
|
owner: null
|
|
@@ -8191,20 +8257,18 @@
|
|
|
8191
8257
|
throw new TypeError("\"hydrateComponent\" expects an object as the third parameter but instead received ".concat(props, "."));
|
|
8192
8258
|
}
|
|
8193
8259
|
|
|
8194
|
-
var def = getComponentInternalDef(Ctor);
|
|
8195
|
-
|
|
8196
8260
|
try {
|
|
8197
8261
|
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
8198
8262
|
// and uses the same algo to create the stylesheets as in SSR.
|
|
8199
8263
|
setIsHydrating(true);
|
|
8200
|
-
createVM(element,
|
|
8264
|
+
createVM(element, Ctor, {
|
|
8201
8265
|
mode: 'open',
|
|
8202
8266
|
owner: null,
|
|
8203
8267
|
tagName: element.tagName.toLowerCase()
|
|
8204
8268
|
});
|
|
8205
8269
|
|
|
8206
|
-
for (var
|
|
8207
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[
|
|
8270
|
+
for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
|
|
8271
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
|
|
8208
8272
|
key = _Object$entries2$_i[0],
|
|
8209
8273
|
value = _Object$entries2$_i[1];
|
|
8210
8274
|
|
|
@@ -8226,8 +8290,8 @@
|
|
|
8226
8290
|
mode: 'open'
|
|
8227
8291
|
});
|
|
8228
8292
|
|
|
8229
|
-
for (var
|
|
8230
|
-
var _Object$entries3$_i = _slicedToArray(_Object$entries3[
|
|
8293
|
+
for (var _i33 = 0, _Object$entries3 = Object.entries(props); _i33 < _Object$entries3.length; _i33++) {
|
|
8294
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i33], 2),
|
|
8231
8295
|
_key3 = _Object$entries3$_i[0],
|
|
8232
8296
|
_value2 = _Object$entries3$_i[1];
|
|
8233
8297
|
|
|
@@ -8271,9 +8335,9 @@
|
|
|
8271
8335
|
}
|
|
8272
8336
|
|
|
8273
8337
|
function buildCustomElementConstructor(Ctor) {
|
|
8274
|
-
var
|
|
8275
|
-
return /*#__PURE__*/function (
|
|
8276
|
-
_inherits(_class,
|
|
8338
|
+
var HtmlPrototype = getComponentHtmlPrototype(Ctor);
|
|
8339
|
+
return /*#__PURE__*/function (_HtmlPrototype) {
|
|
8340
|
+
_inherits(_class, _HtmlPrototype);
|
|
8277
8341
|
|
|
8278
8342
|
var _super8 = _createSuper(_class);
|
|
8279
8343
|
|
|
@@ -8283,7 +8347,7 @@
|
|
|
8283
8347
|
_classCallCheck(this, _class);
|
|
8284
8348
|
|
|
8285
8349
|
_this6 = _super8.call(this);
|
|
8286
|
-
createVM(_assertThisInitialized(_this6),
|
|
8350
|
+
createVM(_assertThisInitialized(_this6), Ctor, {
|
|
8287
8351
|
mode: 'open',
|
|
8288
8352
|
owner: null,
|
|
8289
8353
|
tagName: _this6.tagName
|
|
@@ -8304,7 +8368,7 @@
|
|
|
8304
8368
|
}]);
|
|
8305
8369
|
|
|
8306
8370
|
return _class;
|
|
8307
|
-
}(
|
|
8371
|
+
}(HtmlPrototype);
|
|
8308
8372
|
}
|
|
8309
8373
|
/*
|
|
8310
8374
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8411,7 +8475,7 @@
|
|
|
8411
8475
|
});
|
|
8412
8476
|
freeze(LightningElement);
|
|
8413
8477
|
seal(LightningElement.prototype);
|
|
8414
|
-
/* version: 2.7.
|
|
8478
|
+
/* version: 2.7.4 */
|
|
8415
8479
|
|
|
8416
8480
|
exports.LightningElement = LightningElement;
|
|
8417
8481
|
exports.__unstable__ProfilerControl = profilerControl;
|