lwc 2.7.2 → 2.7.3
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 +1970 -2104
- package/dist/engine-dom/iife/es2017/engine-dom.js +1970 -2104
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +1157 -1283
- package/dist/engine-dom/iife/es5/engine-dom.js +1677 -1805
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +1949 -2069
- package/dist/engine-dom/umd/es2017/engine-dom.js +1970 -2104
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +1157 -1283
- package/dist/engine-dom/umd/es5/engine-dom.js +1677 -1805
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +1949 -2069
- package/dist/engine-server/commonjs/es2017/engine-server.js +1322 -1456
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +1322 -1456
- 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,7 @@
|
|
|
351
351
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
352
352
|
return attributeName;
|
|
353
353
|
}
|
|
354
|
-
/** version: 2.7.
|
|
354
|
+
/** version: 2.7.3 */
|
|
355
355
|
|
|
356
356
|
/*
|
|
357
357
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -529,7 +529,7 @@
|
|
|
529
529
|
setFeatureFlag(name, value);
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
/** version: 2.7.
|
|
532
|
+
/** version: 2.7.3 */
|
|
533
533
|
|
|
534
534
|
/* proxy-compat-disable */
|
|
535
535
|
|
|
@@ -1084,52 +1084,205 @@
|
|
|
1084
1084
|
*/
|
|
1085
1085
|
|
|
1086
1086
|
|
|
1087
|
-
function
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1087
|
+
function isUndef(s) {
|
|
1088
|
+
return s === undefined;
|
|
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;
|
|
1091
1108
|
|
|
1092
|
-
|
|
1093
|
-
|
|
1109
|
+
if (key !== undefined) {
|
|
1110
|
+
map[key] = j;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1094
1113
|
}
|
|
1114
|
+
|
|
1115
|
+
return map;
|
|
1095
1116
|
}
|
|
1096
1117
|
|
|
1097
|
-
function
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
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
|
+
}
|
|
1101
1127
|
}
|
|
1102
1128
|
|
|
1103
|
-
function
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
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
|
+
}
|
|
1109
1136
|
}
|
|
1110
1137
|
}
|
|
1111
1138
|
|
|
1112
|
-
function
|
|
1113
|
-
var
|
|
1114
|
-
|
|
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;
|
|
1115
1153
|
|
|
1116
|
-
|
|
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);
|
|
1117
1241
|
return;
|
|
1118
1242
|
}
|
|
1119
1243
|
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
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
|
|
1123
1272
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1273
|
+
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
1274
|
+
referenceElm = vnode.elm;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1126
1277
|
}
|
|
1127
1278
|
}
|
|
1128
1279
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1280
|
+
function patchVnode(oldVnode, vnode) {
|
|
1281
|
+
if (oldVnode !== vnode) {
|
|
1282
|
+
vnode.elm = oldVnode.elm;
|
|
1283
|
+
vnode.hook.update(oldVnode, vnode);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1133
1286
|
/*
|
|
1134
1287
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1135
1288
|
* All rights reserved.
|
|
@@ -1137,6 +1290,7 @@
|
|
|
1137
1290
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1138
1291
|
*/
|
|
1139
1292
|
|
|
1293
|
+
|
|
1140
1294
|
var defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
|
|
1141
1295
|
|
|
1142
1296
|
function offsetPropertyErrorMessage(name) {
|
|
@@ -1256,565 +1410,62 @@
|
|
|
1256
1410
|
*/
|
|
1257
1411
|
|
|
1258
1412
|
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1413
|
+
function generateDataDescriptor(options) {
|
|
1414
|
+
return assign({
|
|
1415
|
+
configurable: true,
|
|
1416
|
+
enumerable: true,
|
|
1417
|
+
writable: true
|
|
1418
|
+
}, options);
|
|
1419
|
+
}
|
|
1265
1420
|
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1421
|
+
function generateAccessorDescriptor(options) {
|
|
1422
|
+
return assign({
|
|
1423
|
+
configurable: true,
|
|
1424
|
+
enumerable: true
|
|
1425
|
+
}, options);
|
|
1426
|
+
}
|
|
1269
1427
|
|
|
1270
|
-
|
|
1428
|
+
var isDomMutationAllowed = false;
|
|
1271
1429
|
|
|
1272
|
-
|
|
1273
|
-
|
|
1430
|
+
function unlockDomMutation() {
|
|
1431
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1432
|
+
// this method should never leak to prod
|
|
1433
|
+
throw new ReferenceError();
|
|
1274
1434
|
}
|
|
1275
1435
|
|
|
1276
|
-
|
|
1277
|
-
|
|
1436
|
+
isDomMutationAllowed = true;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
function lockDomMutation() {
|
|
1440
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1441
|
+
// this method should never leak to prod
|
|
1442
|
+
throw new ReferenceError();
|
|
1278
1443
|
}
|
|
1279
1444
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
oldAttrs = isUndefined$1(oldAttrs) ? EmptyObject : oldAttrs; // update modified attributes, add new attributes
|
|
1283
|
-
// this routine is only useful for data-* attributes in all kind of elements
|
|
1284
|
-
// and aria-* in standard elements (custom elements will use props for these)
|
|
1445
|
+
isDomMutationAllowed = false;
|
|
1446
|
+
}
|
|
1285
1447
|
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1448
|
+
function logMissingPortalError(name, type) {
|
|
1449
|
+
return logError("The `".concat(name, "` ").concat(type, " is available only on elements that use the `lwc:dom=\"manual\"` directive."));
|
|
1450
|
+
}
|
|
1289
1451
|
|
|
1290
|
-
|
|
1291
|
-
|
|
1452
|
+
function patchElementWithRestrictions(elm, options) {
|
|
1453
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1454
|
+
// this method should never leak to prod
|
|
1455
|
+
throw new ReferenceError();
|
|
1456
|
+
}
|
|
1292
1457
|
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
} else {
|
|
1302
|
-
setAttribute$1(elm, key, cur);
|
|
1458
|
+
var originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
|
|
1459
|
+
var descriptors = {
|
|
1460
|
+
outerHTML: generateAccessorDescriptor({
|
|
1461
|
+
get: function get() {
|
|
1462
|
+
return originalOuterHTMLDescriptor.get.call(this);
|
|
1463
|
+
},
|
|
1464
|
+
set: function set(_value) {
|
|
1465
|
+
throw new TypeError("Invalid attempt to set outerHTML on Element.");
|
|
1303
1466
|
}
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
var emptyVNode$3 = {
|
|
1311
|
-
data: {}
|
|
1312
|
-
};
|
|
1313
|
-
var modAttrs = {
|
|
1314
|
-
create: function create(vnode) {
|
|
1315
|
-
return updateAttrs(emptyVNode$3, vnode);
|
|
1316
|
-
},
|
|
1317
|
-
update: updateAttrs
|
|
1318
|
-
};
|
|
1319
|
-
/*
|
|
1320
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1321
|
-
* All rights reserved.
|
|
1322
|
-
* SPDX-License-Identifier: MIT
|
|
1323
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1324
|
-
*/
|
|
1325
|
-
|
|
1326
|
-
function isLiveBindingProp(sel, key) {
|
|
1327
|
-
// For properties with live bindings, we read values from the DOM element
|
|
1328
|
-
// instead of relying on internally tracked values.
|
|
1329
|
-
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
function update(oldVnode, vnode) {
|
|
1333
|
-
var props = vnode.data.props;
|
|
1334
|
-
|
|
1335
|
-
if (isUndefined$1(props)) {
|
|
1336
|
-
return;
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
var oldProps = oldVnode.data.props;
|
|
1340
|
-
|
|
1341
|
-
if (oldProps === props) {
|
|
1342
|
-
return;
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1346
|
-
assert.invariant(isUndefined$1(oldProps) || keys(oldProps).join(',') === keys(props).join(','), 'vnode.data.props cannot change shape.');
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
var isFirstPatch = isUndefined$1(oldProps);
|
|
1350
|
-
var elm = vnode.elm,
|
|
1351
|
-
sel = vnode.sel;
|
|
1352
|
-
|
|
1353
|
-
for (var key in props) {
|
|
1354
|
-
var cur = props[key]; // if it is the first time this element is patched, or the current value is different to the previous value...
|
|
1355
|
-
|
|
1356
|
-
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty$1(elm, key) : oldProps[key])) {
|
|
1357
|
-
setProperty$1(elm, key, cur);
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
var emptyVNode$2 = {
|
|
1363
|
-
data: {}
|
|
1364
|
-
};
|
|
1365
|
-
var modProps = {
|
|
1366
|
-
create: function create(vnode) {
|
|
1367
|
-
return update(emptyVNode$2, vnode);
|
|
1368
|
-
},
|
|
1369
|
-
update: update
|
|
1370
|
-
};
|
|
1371
|
-
/*
|
|
1372
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1373
|
-
* All rights reserved.
|
|
1374
|
-
* SPDX-License-Identifier: MIT
|
|
1375
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1376
|
-
*/
|
|
1377
|
-
|
|
1378
|
-
var classNameToClassMap = create(null);
|
|
1379
|
-
|
|
1380
|
-
function getMapFromClassName(className) {
|
|
1381
|
-
// Intentionally using == to match undefined and null values from computed style attribute
|
|
1382
|
-
if (className == null) {
|
|
1383
|
-
return EmptyObject;
|
|
1384
|
-
} // computed class names must be string
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
className = isString(className) ? className : className + '';
|
|
1388
|
-
var map = classNameToClassMap[className];
|
|
1389
|
-
|
|
1390
|
-
if (map) {
|
|
1391
|
-
return map;
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
map = create(null);
|
|
1395
|
-
var start = 0;
|
|
1396
|
-
var o;
|
|
1397
|
-
var len = className.length;
|
|
1398
|
-
|
|
1399
|
-
for (o = 0; o < len; o++) {
|
|
1400
|
-
if (StringCharCodeAt.call(className, o) === SPACE_CHAR) {
|
|
1401
|
-
if (o > start) {
|
|
1402
|
-
map[StringSlice.call(className, start, o)] = true;
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
start = o + 1;
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
if (o > start) {
|
|
1410
|
-
map[StringSlice.call(className, start, o)] = true;
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
|
-
classNameToClassMap[className] = map;
|
|
1414
|
-
|
|
1415
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1416
|
-
// just to make sure that this object never changes as part of the diffing algo
|
|
1417
|
-
freeze(map);
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
return map;
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
function updateClassAttribute(oldVnode, vnode) {
|
|
1424
|
-
var elm = vnode.elm,
|
|
1425
|
-
newClass = vnode.data.className;
|
|
1426
|
-
var oldClass = oldVnode.data.className;
|
|
1427
|
-
|
|
1428
|
-
if (oldClass === newClass) {
|
|
1429
|
-
return;
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
var classList = getClassList$1(elm);
|
|
1433
|
-
var newClassMap = getMapFromClassName(newClass);
|
|
1434
|
-
var oldClassMap = getMapFromClassName(oldClass);
|
|
1435
|
-
var name;
|
|
1436
|
-
|
|
1437
|
-
for (name in oldClassMap) {
|
|
1438
|
-
// remove only if it is not in the new class collection and it is not set from within the instance
|
|
1439
|
-
if (isUndefined$1(newClassMap[name])) {
|
|
1440
|
-
classList.remove(name);
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
for (name in newClassMap) {
|
|
1445
|
-
if (isUndefined$1(oldClassMap[name])) {
|
|
1446
|
-
classList.add(name);
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
var emptyVNode$1 = {
|
|
1452
|
-
data: {}
|
|
1453
|
-
};
|
|
1454
|
-
var modComputedClassName = {
|
|
1455
|
-
create: function create(vnode) {
|
|
1456
|
-
return updateClassAttribute(emptyVNode$1, vnode);
|
|
1457
|
-
},
|
|
1458
|
-
update: updateClassAttribute
|
|
1459
|
-
};
|
|
1460
|
-
/*
|
|
1461
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1462
|
-
* All rights reserved.
|
|
1463
|
-
* SPDX-License-Identifier: MIT
|
|
1464
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1465
|
-
*/
|
|
1466
|
-
|
|
1467
|
-
function updateStyleAttribute(oldVnode, vnode) {
|
|
1468
|
-
var elm = vnode.elm,
|
|
1469
|
-
newStyle = vnode.data.style;
|
|
1470
|
-
|
|
1471
|
-
if (oldVnode.data.style === newStyle) {
|
|
1472
|
-
return;
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
if (!isString(newStyle) || newStyle === '') {
|
|
1476
|
-
removeAttribute$1(elm, 'style');
|
|
1477
|
-
} else {
|
|
1478
|
-
setAttribute$1(elm, 'style', newStyle);
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
var emptyVNode = {
|
|
1483
|
-
data: {}
|
|
1484
|
-
};
|
|
1485
|
-
var modComputedStyle = {
|
|
1486
|
-
create: function create(vnode) {
|
|
1487
|
-
return updateStyleAttribute(emptyVNode, vnode);
|
|
1488
|
-
},
|
|
1489
|
-
update: updateStyleAttribute
|
|
1490
|
-
};
|
|
1491
|
-
/*
|
|
1492
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1493
|
-
* All rights reserved.
|
|
1494
|
-
* SPDX-License-Identifier: MIT
|
|
1495
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1496
|
-
*/
|
|
1497
|
-
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
1498
|
-
// different classnames properties individually instead of via a string.
|
|
1499
|
-
|
|
1500
|
-
function createClassAttribute(vnode) {
|
|
1501
|
-
var elm = vnode.elm,
|
|
1502
|
-
classMap = vnode.data.classMap;
|
|
1503
|
-
|
|
1504
|
-
if (isUndefined$1(classMap)) {
|
|
1505
|
-
return;
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
var classList = getClassList$1(elm);
|
|
1509
|
-
|
|
1510
|
-
for (var name in classMap) {
|
|
1511
|
-
classList.add(name);
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
var modStaticClassName = {
|
|
1516
|
-
create: createClassAttribute
|
|
1517
|
-
};
|
|
1518
|
-
/*
|
|
1519
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1520
|
-
* All rights reserved.
|
|
1521
|
-
* SPDX-License-Identifier: MIT
|
|
1522
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1523
|
-
*/
|
|
1524
|
-
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
1525
|
-
// different style properties individually instead of via a string.
|
|
1526
|
-
|
|
1527
|
-
function createStyleAttribute(vnode) {
|
|
1528
|
-
var elm = vnode.elm,
|
|
1529
|
-
styleDecls = vnode.data.styleDecls;
|
|
1530
|
-
|
|
1531
|
-
if (isUndefined$1(styleDecls)) {
|
|
1532
|
-
return;
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
for (var _i6 = 0; _i6 < styleDecls.length; _i6++) {
|
|
1536
|
-
var _styleDecls$_i = _slicedToArray(styleDecls[_i6], 3),
|
|
1537
|
-
prop = _styleDecls$_i[0],
|
|
1538
|
-
value = _styleDecls$_i[1],
|
|
1539
|
-
important = _styleDecls$_i[2];
|
|
1540
|
-
|
|
1541
|
-
setCSSStyleProperty$1(elm, prop, value, important);
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
var modStaticStyle = {
|
|
1546
|
-
create: createStyleAttribute
|
|
1547
|
-
};
|
|
1548
|
-
/*
|
|
1549
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1550
|
-
* All rights reserved.
|
|
1551
|
-
* SPDX-License-Identifier: MIT
|
|
1552
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1553
|
-
*/
|
|
1554
|
-
|
|
1555
|
-
function isUndef(s) {
|
|
1556
|
-
return s === undefined;
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
function sameVnode(vnode1, vnode2) {
|
|
1560
|
-
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
function isVNode(vnode) {
|
|
1564
|
-
return vnode != null;
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
1568
|
-
var map = {};
|
|
1569
|
-
var j, key, ch; // TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
1570
|
-
|
|
1571
|
-
for (j = beginIdx; j <= endIdx; ++j) {
|
|
1572
|
-
ch = children[j];
|
|
1573
|
-
|
|
1574
|
-
if (isVNode(ch)) {
|
|
1575
|
-
key = ch.key;
|
|
1576
|
-
|
|
1577
|
-
if (key !== undefined) {
|
|
1578
|
-
map[key] = j;
|
|
1579
|
-
}
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
return map;
|
|
1584
|
-
}
|
|
1585
|
-
|
|
1586
|
-
function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
|
|
1587
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
1588
|
-
var ch = vnodes[startIdx];
|
|
1589
|
-
|
|
1590
|
-
if (isVNode(ch)) {
|
|
1591
|
-
ch.hook.create(ch);
|
|
1592
|
-
ch.hook.insert(ch, parentElm, before);
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
1598
|
-
for (; startIdx <= endIdx; ++startIdx) {
|
|
1599
|
-
var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
1600
|
-
|
|
1601
|
-
if (isVNode(ch)) {
|
|
1602
|
-
ch.hook.remove(ch, parentElm);
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
1608
|
-
var oldStartIdx = 0;
|
|
1609
|
-
var newStartIdx = 0;
|
|
1610
|
-
var oldEndIdx = oldCh.length - 1;
|
|
1611
|
-
var oldStartVnode = oldCh[0];
|
|
1612
|
-
var oldEndVnode = oldCh[oldEndIdx];
|
|
1613
|
-
var newChEnd = newCh.length - 1;
|
|
1614
|
-
var newEndIdx = newChEnd;
|
|
1615
|
-
var newStartVnode = newCh[0];
|
|
1616
|
-
var newEndVnode = newCh[newEndIdx];
|
|
1617
|
-
var oldKeyToIdx;
|
|
1618
|
-
var idxInOld;
|
|
1619
|
-
var elmToMove;
|
|
1620
|
-
var before;
|
|
1621
|
-
|
|
1622
|
-
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
1623
|
-
if (!isVNode(oldStartVnode)) {
|
|
1624
|
-
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
1625
|
-
} else if (!isVNode(oldEndVnode)) {
|
|
1626
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1627
|
-
} else if (!isVNode(newStartVnode)) {
|
|
1628
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1629
|
-
} else if (!isVNode(newEndVnode)) {
|
|
1630
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1631
|
-
} else if (sameVnode(oldStartVnode, newStartVnode)) {
|
|
1632
|
-
patchVnode(oldStartVnode, newStartVnode);
|
|
1633
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
|
1634
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1635
|
-
} else if (sameVnode(oldEndVnode, newEndVnode)) {
|
|
1636
|
-
patchVnode(oldEndVnode, newEndVnode);
|
|
1637
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1638
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1639
|
-
} else if (sameVnode(oldStartVnode, newEndVnode)) {
|
|
1640
|
-
// Vnode moved right
|
|
1641
|
-
patchVnode(oldStartVnode, newEndVnode);
|
|
1642
|
-
newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
|
|
1643
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
|
1644
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1645
|
-
} else if (sameVnode(oldEndVnode, newStartVnode)) {
|
|
1646
|
-
// Vnode moved left
|
|
1647
|
-
patchVnode(oldEndVnode, newStartVnode);
|
|
1648
|
-
newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
|
|
1649
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1650
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1651
|
-
} else {
|
|
1652
|
-
if (oldKeyToIdx === undefined) {
|
|
1653
|
-
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
1657
|
-
|
|
1658
|
-
if (isUndef(idxInOld)) {
|
|
1659
|
-
// New element
|
|
1660
|
-
newStartVnode.hook.create(newStartVnode);
|
|
1661
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
1662
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1663
|
-
} else {
|
|
1664
|
-
elmToMove = oldCh[idxInOld];
|
|
1665
|
-
|
|
1666
|
-
if (isVNode(elmToMove)) {
|
|
1667
|
-
if (elmToMove.sel !== newStartVnode.sel) {
|
|
1668
|
-
// New element
|
|
1669
|
-
newStartVnode.hook.create(newStartVnode);
|
|
1670
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
1671
|
-
} else {
|
|
1672
|
-
patchVnode(elmToMove, newStartVnode);
|
|
1673
|
-
oldCh[idxInOld] = undefined;
|
|
1674
|
-
newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
1684
|
-
if (oldStartIdx > oldEndIdx) {
|
|
1685
|
-
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
1686
|
-
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
1687
|
-
var _i7 = newEndIdx;
|
|
1688
|
-
var n;
|
|
1689
|
-
|
|
1690
|
-
do {
|
|
1691
|
-
n = newCh[++_i7];
|
|
1692
|
-
} while (!isVNode(n) && _i7 < newChEnd);
|
|
1693
|
-
|
|
1694
|
-
before = isVNode(n) ? n.elm : null;
|
|
1695
|
-
addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
|
|
1696
|
-
} else {
|
|
1697
|
-
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
function updateStaticChildren(parentElm, oldCh, newCh) {
|
|
1703
|
-
var oldChLength = oldCh.length;
|
|
1704
|
-
var newChLength = newCh.length;
|
|
1705
|
-
|
|
1706
|
-
if (oldChLength === 0) {
|
|
1707
|
-
// the old list is empty, we can directly insert anything new
|
|
1708
|
-
addVnodes(parentElm, null, newCh, 0, newChLength);
|
|
1709
|
-
return;
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
if (newChLength === 0) {
|
|
1713
|
-
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
1714
|
-
// this is the case in which the dynamic children of an if-directive should be removed
|
|
1715
|
-
removeVnodes(parentElm, oldCh, 0, oldChLength);
|
|
1716
|
-
return;
|
|
1717
|
-
} // if the old list is not empty, the new list MUST have the same
|
|
1718
|
-
// amount of nodes, that's why we call this static children
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
var referenceElm = null;
|
|
1722
|
-
|
|
1723
|
-
for (var _i8 = newChLength - 1; _i8 >= 0; _i8 -= 1) {
|
|
1724
|
-
var vnode = newCh[_i8];
|
|
1725
|
-
var oldVNode = oldCh[_i8];
|
|
1726
|
-
|
|
1727
|
-
if (vnode !== oldVNode) {
|
|
1728
|
-
if (isVNode(oldVNode)) {
|
|
1729
|
-
if (isVNode(vnode)) {
|
|
1730
|
-
// both vnodes must be equivalent, and se just need to patch them
|
|
1731
|
-
patchVnode(oldVNode, vnode);
|
|
1732
|
-
referenceElm = vnode.elm;
|
|
1733
|
-
} else {
|
|
1734
|
-
// removing the old vnode since the new one is null
|
|
1735
|
-
oldVNode.hook.remove(oldVNode, parentElm);
|
|
1736
|
-
}
|
|
1737
|
-
} else if (isVNode(vnode)) {
|
|
1738
|
-
// this condition is unnecessary
|
|
1739
|
-
vnode.hook.create(vnode); // insert the new node one since the old one is null
|
|
1740
|
-
|
|
1741
|
-
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
1742
|
-
referenceElm = vnode.elm;
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
function patchVnode(oldVnode, vnode) {
|
|
1749
|
-
if (oldVnode !== vnode) {
|
|
1750
|
-
vnode.elm = oldVnode.elm;
|
|
1751
|
-
vnode.hook.update(oldVnode, vnode);
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
/*
|
|
1755
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1756
|
-
* All rights reserved.
|
|
1757
|
-
* SPDX-License-Identifier: MIT
|
|
1758
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1759
|
-
*/
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
function generateDataDescriptor(options) {
|
|
1763
|
-
return assign({
|
|
1764
|
-
configurable: true,
|
|
1765
|
-
enumerable: true,
|
|
1766
|
-
writable: true
|
|
1767
|
-
}, options);
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
function generateAccessorDescriptor(options) {
|
|
1771
|
-
return assign({
|
|
1772
|
-
configurable: true,
|
|
1773
|
-
enumerable: true
|
|
1774
|
-
}, options);
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
var isDomMutationAllowed = false;
|
|
1778
|
-
|
|
1779
|
-
function unlockDomMutation() {
|
|
1780
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1781
|
-
// this method should never leak to prod
|
|
1782
|
-
throw new ReferenceError();
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
isDomMutationAllowed = true;
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
function lockDomMutation() {
|
|
1789
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1790
|
-
// this method should never leak to prod
|
|
1791
|
-
throw new ReferenceError();
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
isDomMutationAllowed = false;
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
function logMissingPortalError(name, type) {
|
|
1798
|
-
return logError("The `".concat(name, "` ").concat(type, " is available only on elements that use the `lwc:dom=\"manual\"` directive."));
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
function patchElementWithRestrictions(elm, options) {
|
|
1802
|
-
if (process.env.NODE_ENV === 'production') {
|
|
1803
|
-
// this method should never leak to prod
|
|
1804
|
-
throw new ReferenceError();
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
|
-
var originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');
|
|
1808
|
-
var descriptors = {
|
|
1809
|
-
outerHTML: generateAccessorDescriptor({
|
|
1810
|
-
get: function get() {
|
|
1811
|
-
return originalOuterHTMLDescriptor.get.call(this);
|
|
1812
|
-
},
|
|
1813
|
-
set: function set(_value) {
|
|
1814
|
-
throw new TypeError("Invalid attempt to set outerHTML on Element.");
|
|
1815
|
-
}
|
|
1816
|
-
})
|
|
1817
|
-
}; // Apply extra restriction related to DOM manipulation if the element is not a portal.
|
|
1467
|
+
})
|
|
1468
|
+
}; // Apply extra restriction related to DOM manipulation if the element is not a portal.
|
|
1818
1469
|
|
|
1819
1470
|
if (!options.isLight && !options.isPortal) {
|
|
1820
1471
|
var _appendChild = elm.appendChild,
|
|
@@ -3276,132 +2927,369 @@
|
|
|
3276
2927
|
case 'lastElementChild':
|
|
3277
2928
|
return getLastElementChild$1;
|
|
3278
2929
|
}
|
|
3279
|
-
} // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2930
|
+
} // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs
|
|
2931
|
+
|
|
2932
|
+
|
|
2933
|
+
var _loop = function _loop() {
|
|
2934
|
+
var childGetter = _childGetters[_i8];
|
|
2935
|
+
queryAndChildGetterDescriptors[childGetter] = {
|
|
2936
|
+
get: function get() {
|
|
2937
|
+
var vm = getAssociatedVM(this);
|
|
2938
|
+
var elm = vm.elm;
|
|
2939
|
+
|
|
2940
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2941
|
+
warnIfInvokedDuringConstruction(vm, childGetter);
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
return getChildGetter(childGetter)(elm);
|
|
2945
|
+
},
|
|
2946
|
+
configurable: true,
|
|
2947
|
+
enumerable: true
|
|
2948
|
+
};
|
|
2949
|
+
};
|
|
2950
|
+
|
|
2951
|
+
for (var _i8 = 0, _childGetters = childGetters; _i8 < _childGetters.length; _i8++) {
|
|
2952
|
+
_loop();
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2955
|
+
var queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
2956
|
+
|
|
2957
|
+
function getQueryMethod(methodName) {
|
|
2958
|
+
switch (methodName) {
|
|
2959
|
+
case 'getElementsByClassName':
|
|
2960
|
+
return getElementsByClassName$1;
|
|
2961
|
+
|
|
2962
|
+
case 'getElementsByTagName':
|
|
2963
|
+
return getElementsByTagName$1;
|
|
2964
|
+
|
|
2965
|
+
case 'querySelector':
|
|
2966
|
+
return querySelector$1;
|
|
2967
|
+
|
|
2968
|
+
case 'querySelectorAll':
|
|
2969
|
+
return querySelectorAll$1;
|
|
2970
|
+
}
|
|
2971
|
+
} // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2972
|
+
|
|
2973
|
+
|
|
2974
|
+
var _loop2 = function _loop2() {
|
|
2975
|
+
var queryMethod = _queryMethods[_i9];
|
|
2976
|
+
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2977
|
+
value: function value(arg) {
|
|
2978
|
+
var vm = getAssociatedVM(this);
|
|
2979
|
+
var elm = vm.elm;
|
|
2980
|
+
|
|
2981
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2982
|
+
warnIfInvokedDuringConstruction(vm, "".concat(queryMethod, "()"));
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
return getQueryMethod(queryMethod)(elm, arg);
|
|
2986
|
+
},
|
|
2987
|
+
configurable: true,
|
|
2988
|
+
enumerable: true,
|
|
2989
|
+
writable: true
|
|
2990
|
+
};
|
|
2991
|
+
};
|
|
2992
|
+
|
|
2993
|
+
for (var _i9 = 0, _queryMethods = queryMethods; _i9 < _queryMethods.length; _i9++) {
|
|
2994
|
+
_loop2();
|
|
2995
|
+
}
|
|
2996
|
+
|
|
2997
|
+
defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
|
|
2998
|
+
var lightningBasedDescriptors = create(null);
|
|
2999
|
+
|
|
3000
|
+
for (var _propName in HTMLElementOriginalDescriptors) {
|
|
3001
|
+
lightningBasedDescriptors[_propName] = createBridgeToElementDescriptor(_propName, HTMLElementOriginalDescriptors[_propName]);
|
|
3002
|
+
}
|
|
3003
|
+
|
|
3004
|
+
defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
|
3005
|
+
defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
3006
|
+
get: function get() {
|
|
3007
|
+
// If required, a runtime-specific implementation must be defined.
|
|
3008
|
+
throw new ReferenceError('The current runtime does not support CustomElementConstructor.');
|
|
3009
|
+
},
|
|
3010
|
+
configurable: true
|
|
3011
|
+
});
|
|
3012
|
+
|
|
3013
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3014
|
+
patchLightningElementPrototypeWithRestrictions(LightningElement.prototype);
|
|
3015
|
+
}
|
|
3016
|
+
/*
|
|
3017
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3018
|
+
* All rights reserved.
|
|
3019
|
+
* SPDX-License-Identifier: MIT
|
|
3020
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3021
|
+
*/
|
|
3022
|
+
|
|
3023
|
+
/**
|
|
3024
|
+
* @wire decorator to wire fields and methods to a wire adapter in
|
|
3025
|
+
* LWC Components. This function implements the internals of this
|
|
3026
|
+
* decorator.
|
|
3027
|
+
*/
|
|
3028
|
+
|
|
3029
|
+
|
|
3030
|
+
function wire(_adapter, _config) {
|
|
3031
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3032
|
+
assert.fail('@wire(adapter, config?) may only be used as a decorator.');
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
throw new Error();
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
function internalWireFieldDecorator(key) {
|
|
3039
|
+
return {
|
|
3040
|
+
get: function get() {
|
|
3041
|
+
var vm = getAssociatedVM(this);
|
|
3042
|
+
componentValueObserved(vm, key);
|
|
3043
|
+
return vm.cmpFields[key];
|
|
3044
|
+
},
|
|
3045
|
+
set: function set(value) {
|
|
3046
|
+
var vm = getAssociatedVM(this);
|
|
3047
|
+
/**
|
|
3048
|
+
* Reactivity for wired fields is provided in wiring.
|
|
3049
|
+
* We intentionally add reactivity here since this is just
|
|
3050
|
+
* letting the author to do the wrong thing, but it will keep our
|
|
3051
|
+
* system to be backward compatible.
|
|
3052
|
+
*/
|
|
3053
|
+
|
|
3054
|
+
if (value !== vm.cmpFields[key]) {
|
|
3055
|
+
vm.cmpFields[key] = value;
|
|
3056
|
+
componentValueMutated(vm, key);
|
|
3057
|
+
}
|
|
3058
|
+
},
|
|
3059
|
+
enumerable: true,
|
|
3060
|
+
configurable: true
|
|
3061
|
+
};
|
|
3062
|
+
}
|
|
3063
|
+
/*
|
|
3064
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3065
|
+
* All rights reserved.
|
|
3066
|
+
* SPDX-License-Identifier: MIT
|
|
3067
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3068
|
+
*/
|
|
3069
|
+
|
|
3070
|
+
|
|
3071
|
+
function track(target) {
|
|
3072
|
+
if (arguments.length === 1) {
|
|
3073
|
+
return reactiveMembrane.getProxy(target);
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3076
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3077
|
+
assert.fail("@track decorator can only be used with one argument to return a trackable object, or as a decorator function.");
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
throw new Error();
|
|
3081
|
+
}
|
|
3082
|
+
|
|
3083
|
+
function internalTrackDecorator(key) {
|
|
3084
|
+
return {
|
|
3085
|
+
get: function get() {
|
|
3086
|
+
var vm = getAssociatedVM(this);
|
|
3087
|
+
componentValueObserved(vm, key);
|
|
3088
|
+
return vm.cmpFields[key];
|
|
3089
|
+
},
|
|
3090
|
+
set: function set(newValue) {
|
|
3091
|
+
var vm = getAssociatedVM(this);
|
|
3092
|
+
|
|
3093
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3094
|
+
var _vmBeingRendered3 = getVMBeingRendered();
|
|
3095
|
+
|
|
3096
|
+
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
3097
|
+
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3100
|
+
var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
|
|
3101
|
+
|
|
3102
|
+
if (reactiveOrAnyValue !== vm.cmpFields[key]) {
|
|
3103
|
+
vm.cmpFields[key] = reactiveOrAnyValue;
|
|
3104
|
+
componentValueMutated(vm, key);
|
|
3105
|
+
}
|
|
3106
|
+
},
|
|
3107
|
+
enumerable: true,
|
|
3108
|
+
configurable: true
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3111
|
+
/*
|
|
3112
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3113
|
+
* All rights reserved.
|
|
3114
|
+
* SPDX-License-Identifier: MIT
|
|
3115
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3116
|
+
*/
|
|
3117
|
+
|
|
3118
|
+
|
|
3119
|
+
function api$1() {
|
|
3120
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3121
|
+
assert.fail("@api decorator can only be used as a decorator function.");
|
|
3122
|
+
}
|
|
3280
3123
|
|
|
3124
|
+
throw new Error();
|
|
3125
|
+
}
|
|
3281
3126
|
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
queryAndChildGetterDescriptors[childGetter] = {
|
|
3127
|
+
function createPublicPropertyDescriptor(key) {
|
|
3128
|
+
return {
|
|
3285
3129
|
get: function get() {
|
|
3286
3130
|
var vm = getAssociatedVM(this);
|
|
3287
|
-
|
|
3131
|
+
|
|
3132
|
+
if (isBeingConstructed(vm)) {
|
|
3133
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3134
|
+
logError("Can\u2019t read the value of property `".concat(toString$1(key), "` from the constructor because the owner component hasn\u2019t set the value yet. Instead, use the constructor to set a default value for the property."), vm);
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
return;
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
componentValueObserved(vm, key);
|
|
3141
|
+
return vm.cmpProps[key];
|
|
3142
|
+
},
|
|
3143
|
+
set: function set(newValue) {
|
|
3144
|
+
var vm = getAssociatedVM(this);
|
|
3288
3145
|
|
|
3289
3146
|
if (process.env.NODE_ENV !== 'production') {
|
|
3290
|
-
|
|
3147
|
+
var _vmBeingRendered4 = getVMBeingRendered();
|
|
3148
|
+
|
|
3149
|
+
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered4, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
3150
|
+
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered4, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
3291
3151
|
}
|
|
3292
3152
|
|
|
3293
|
-
|
|
3153
|
+
vm.cmpProps[key] = newValue;
|
|
3154
|
+
componentValueMutated(vm, key);
|
|
3294
3155
|
},
|
|
3295
|
-
|
|
3296
|
-
|
|
3156
|
+
enumerable: true,
|
|
3157
|
+
configurable: true
|
|
3297
3158
|
};
|
|
3298
|
-
};
|
|
3299
|
-
|
|
3300
|
-
for (var _i9 = 0, _childGetters = childGetters; _i9 < _childGetters.length; _i9++) {
|
|
3301
|
-
_loop();
|
|
3302
3159
|
}
|
|
3303
3160
|
|
|
3304
|
-
var
|
|
3161
|
+
var AccessorReactiveObserver = /*#__PURE__*/function (_ReactiveObserver) {
|
|
3162
|
+
_inherits(AccessorReactiveObserver, _ReactiveObserver);
|
|
3305
3163
|
|
|
3306
|
-
|
|
3307
|
-
switch (methodName) {
|
|
3308
|
-
case 'getElementsByClassName':
|
|
3309
|
-
return getElementsByClassName$1;
|
|
3164
|
+
var _super3 = _createSuper(AccessorReactiveObserver);
|
|
3310
3165
|
|
|
3311
|
-
|
|
3312
|
-
|
|
3166
|
+
function AccessorReactiveObserver(vm, set) {
|
|
3167
|
+
var _this2;
|
|
3313
3168
|
|
|
3314
|
-
|
|
3315
|
-
return querySelector$1;
|
|
3169
|
+
_classCallCheck(this, AccessorReactiveObserver);
|
|
3316
3170
|
|
|
3317
|
-
|
|
3318
|
-
|
|
3171
|
+
_this2 = _super3.call(this, function () {
|
|
3172
|
+
if (isFalse(_this2.debouncing)) {
|
|
3173
|
+
_this2.debouncing = true;
|
|
3174
|
+
addCallbackToNextTick(function () {
|
|
3175
|
+
if (isTrue(_this2.debouncing)) {
|
|
3176
|
+
var _assertThisInitialize = _assertThisInitialized(_this2),
|
|
3177
|
+
value = _assertThisInitialize.value;
|
|
3178
|
+
|
|
3179
|
+
var dirtyStateBeforeSetterCall = vm.isDirty,
|
|
3180
|
+
component = vm.component,
|
|
3181
|
+
_idx = vm.idx;
|
|
3182
|
+
set.call(component, value); // de-bouncing after the call to the original setter to prevent
|
|
3183
|
+
// infinity loop if the setter itself is mutating things that
|
|
3184
|
+
// were accessed during the previous invocation.
|
|
3185
|
+
|
|
3186
|
+
_this2.debouncing = false;
|
|
3187
|
+
|
|
3188
|
+
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && _idx > 0) {
|
|
3189
|
+
// immediate rehydration due to a setter driven mutation, otherwise
|
|
3190
|
+
// the component will get rendered on the second tick, which it is not
|
|
3191
|
+
// desirable.
|
|
3192
|
+
rerenderVM(vm);
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
});
|
|
3196
|
+
}
|
|
3197
|
+
});
|
|
3198
|
+
_this2.debouncing = false;
|
|
3199
|
+
return _this2;
|
|
3319
3200
|
}
|
|
3320
|
-
} // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
3321
3201
|
|
|
3202
|
+
_createClass(AccessorReactiveObserver, [{
|
|
3203
|
+
key: "reset",
|
|
3204
|
+
value: function reset(value) {
|
|
3205
|
+
_get2(_getPrototypeOf2(AccessorReactiveObserver.prototype), "reset", this).call(this);
|
|
3322
3206
|
|
|
3323
|
-
|
|
3324
|
-
var queryMethod = _queryMethods[_i10];
|
|
3325
|
-
queryAndChildGetterDescriptors[queryMethod] = {
|
|
3326
|
-
value: function value(arg) {
|
|
3327
|
-
var vm = getAssociatedVM(this);
|
|
3328
|
-
var elm = vm.elm;
|
|
3207
|
+
this.debouncing = false;
|
|
3329
3208
|
|
|
3330
|
-
if (
|
|
3331
|
-
|
|
3209
|
+
if (arguments.length > 0) {
|
|
3210
|
+
this.value = value;
|
|
3332
3211
|
}
|
|
3212
|
+
}
|
|
3213
|
+
}]);
|
|
3333
3214
|
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
configurable: true,
|
|
3337
|
-
enumerable: true,
|
|
3338
|
-
writable: true
|
|
3339
|
-
};
|
|
3340
|
-
};
|
|
3215
|
+
return AccessorReactiveObserver;
|
|
3216
|
+
}(ReactiveObserver);
|
|
3341
3217
|
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3218
|
+
function createPublicAccessorDescriptor(key, descriptor) {
|
|
3219
|
+
var _get3 = descriptor.get,
|
|
3220
|
+
_set2 = descriptor.set,
|
|
3221
|
+
enumerable = descriptor.enumerable,
|
|
3222
|
+
configurable = descriptor.configurable;
|
|
3345
3223
|
|
|
3346
|
-
|
|
3347
|
-
|
|
3224
|
+
if (!isFunction$1(_get3)) {
|
|
3225
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3226
|
+
assert.invariant(isFunction$1(_get3), "Invalid compiler output for public accessor ".concat(toString$1(key), " decorated with @api"));
|
|
3227
|
+
}
|
|
3348
3228
|
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
}
|
|
3229
|
+
throw new Error();
|
|
3230
|
+
}
|
|
3352
3231
|
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
configurable: true
|
|
3360
|
-
});
|
|
3232
|
+
return {
|
|
3233
|
+
get: function get() {
|
|
3234
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3235
|
+
// Assert that the this value is an actual Component with an associated VM.
|
|
3236
|
+
getAssociatedVM(this);
|
|
3237
|
+
}
|
|
3361
3238
|
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
3367
|
-
* All rights reserved.
|
|
3368
|
-
* SPDX-License-Identifier: MIT
|
|
3369
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3370
|
-
*/
|
|
3239
|
+
return _get3.call(this);
|
|
3240
|
+
},
|
|
3241
|
+
set: function set(newValue) {
|
|
3242
|
+
var _this3 = this;
|
|
3371
3243
|
|
|
3372
|
-
|
|
3373
|
-
* @wire decorator to wire fields and methods to a wire adapter in
|
|
3374
|
-
* LWC Components. This function implements the internals of this
|
|
3375
|
-
* decorator.
|
|
3376
|
-
*/
|
|
3244
|
+
var vm = getAssociatedVM(this);
|
|
3377
3245
|
|
|
3246
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3247
|
+
var _vmBeingRendered5 = getVMBeingRendered();
|
|
3378
3248
|
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
}
|
|
3249
|
+
assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered5, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
3250
|
+
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered5, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
3251
|
+
}
|
|
3383
3252
|
|
|
3384
|
-
|
|
3253
|
+
if (_set2) {
|
|
3254
|
+
if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
3255
|
+
var ro = vm.oar[key];
|
|
3256
|
+
|
|
3257
|
+
if (isUndefined$1(ro)) {
|
|
3258
|
+
ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
|
|
3259
|
+
} // every time we invoke this setter from outside (through this wrapper setter)
|
|
3260
|
+
// we should reset the value and then debounce just in case there is a pending
|
|
3261
|
+
// invocation the next tick that is not longer relevant since the value is changing
|
|
3262
|
+
// from outside.
|
|
3263
|
+
|
|
3264
|
+
|
|
3265
|
+
ro.reset(newValue);
|
|
3266
|
+
ro.observe(function () {
|
|
3267
|
+
_set2.call(_this3, newValue);
|
|
3268
|
+
});
|
|
3269
|
+
} else {
|
|
3270
|
+
_set2.call(this, newValue);
|
|
3271
|
+
}
|
|
3272
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
3273
|
+
assert.fail("Invalid attempt to set a new value for property ".concat(toString$1(key), " of ").concat(vm, " that does not has a setter decorated with @api."));
|
|
3274
|
+
}
|
|
3275
|
+
},
|
|
3276
|
+
enumerable: enumerable,
|
|
3277
|
+
configurable: configurable
|
|
3278
|
+
};
|
|
3385
3279
|
}
|
|
3386
3280
|
|
|
3387
|
-
function
|
|
3281
|
+
function createObservedFieldPropertyDescriptor(key) {
|
|
3388
3282
|
return {
|
|
3389
3283
|
get: function get() {
|
|
3390
3284
|
var vm = getAssociatedVM(this);
|
|
3391
3285
|
componentValueObserved(vm, key);
|
|
3392
3286
|
return vm.cmpFields[key];
|
|
3393
3287
|
},
|
|
3394
|
-
set: function set(
|
|
3288
|
+
set: function set(newValue) {
|
|
3395
3289
|
var vm = getAssociatedVM(this);
|
|
3396
|
-
/**
|
|
3397
|
-
* Reactivity for wired fields is provided in wiring.
|
|
3398
|
-
* We intentionally add reactivity here since this is just
|
|
3399
|
-
* letting the author to do the wrong thing, but it will keep our
|
|
3400
|
-
* system to be backward compatible.
|
|
3401
|
-
*/
|
|
3402
3290
|
|
|
3403
|
-
if (
|
|
3404
|
-
vm.cmpFields[key] =
|
|
3291
|
+
if (newValue !== vm.cmpFields[key]) {
|
|
3292
|
+
vm.cmpFields[key] = newValue;
|
|
3405
3293
|
componentValueMutated(vm, key);
|
|
3406
3294
|
}
|
|
3407
3295
|
},
|
|
@@ -3417,234 +3305,297 @@
|
|
|
3417
3305
|
*/
|
|
3418
3306
|
|
|
3419
3307
|
|
|
3420
|
-
function
|
|
3421
|
-
if (
|
|
3422
|
-
return
|
|
3308
|
+
function getClassDescriptorType(descriptor) {
|
|
3309
|
+
if (isFunction$1(descriptor.value)) {
|
|
3310
|
+
return "method"
|
|
3311
|
+
/* Method */
|
|
3312
|
+
;
|
|
3313
|
+
} else if (isFunction$1(descriptor.set) || isFunction$1(descriptor.get)) {
|
|
3314
|
+
return "accessor"
|
|
3315
|
+
/* Accessor */
|
|
3316
|
+
;
|
|
3317
|
+
} else {
|
|
3318
|
+
return "field"
|
|
3319
|
+
/* Field */
|
|
3320
|
+
;
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
function validateObservedField(Ctor, fieldName, descriptor) {
|
|
3325
|
+
if (!isUndefined$1(descriptor)) {
|
|
3326
|
+
var type = getClassDescriptorType(descriptor);
|
|
3327
|
+
var message = "Invalid observed ".concat(fieldName, " field. Found a duplicate ").concat(type, " with the same name."); // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.
|
|
3328
|
+
// This branch is only here for backward compatibility reasons.
|
|
3329
|
+
|
|
3330
|
+
if (type === "accessor"
|
|
3331
|
+
/* Accessor */
|
|
3332
|
+
) {
|
|
3333
|
+
logError(message);
|
|
3334
|
+
} else {
|
|
3335
|
+
assert.fail(message);
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
function validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {
|
|
3341
|
+
if (!isUndefined$1(descriptor)) {
|
|
3342
|
+
var type = getClassDescriptorType(descriptor);
|
|
3343
|
+
assert.fail("Invalid @track ".concat(fieldName, " field. Found a duplicate ").concat(type, " with the same name."));
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
function validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {
|
|
3348
|
+
if (!isUndefined$1(descriptor)) {
|
|
3349
|
+
var type = getClassDescriptorType(descriptor);
|
|
3350
|
+
assert.fail("Invalid @wire ".concat(fieldName, " field. Found a duplicate ").concat(type, " with the same name."));
|
|
3423
3351
|
}
|
|
3352
|
+
}
|
|
3424
3353
|
|
|
3425
|
-
|
|
3426
|
-
|
|
3354
|
+
function validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {
|
|
3355
|
+
if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
|
|
3356
|
+
assert.fail("Invalid @wire ".concat(methodName, " method."));
|
|
3427
3357
|
}
|
|
3428
|
-
|
|
3429
|
-
throw new Error();
|
|
3430
3358
|
}
|
|
3431
3359
|
|
|
3432
|
-
function
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
return vm.cmpFields[key];
|
|
3438
|
-
},
|
|
3439
|
-
set: function set(newValue) {
|
|
3440
|
-
var vm = getAssociatedVM(this);
|
|
3441
|
-
|
|
3442
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3443
|
-
var _vmBeingRendered3 = getVMBeingRendered();
|
|
3360
|
+
function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
|
|
3361
|
+
if (!isUndefined$1(descriptor)) {
|
|
3362
|
+
var type = getClassDescriptorType(descriptor);
|
|
3363
|
+
var message = "Invalid @api ".concat(fieldName, " field. Found a duplicate ").concat(type, " with the same name."); // [W-9927596] Ideally we always throw an error when detecting duplicate public properties.
|
|
3364
|
+
// This branch is only here for backward compatibility reasons.
|
|
3444
3365
|
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3366
|
+
if (type === "accessor"
|
|
3367
|
+
/* Accessor */
|
|
3368
|
+
) {
|
|
3369
|
+
logError(message);
|
|
3370
|
+
} else {
|
|
3371
|
+
assert.fail(message);
|
|
3372
|
+
}
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3448
3375
|
|
|
3449
|
-
|
|
3376
|
+
function validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor) {
|
|
3377
|
+
if (isUndefined$1(descriptor)) {
|
|
3378
|
+
assert.fail("Invalid @api get ".concat(fieldName, " accessor."));
|
|
3379
|
+
} else if (isFunction$1(descriptor.set)) {
|
|
3380
|
+
assert.isTrue(isFunction$1(descriptor.get), "Missing getter for property ".concat(fieldName, " decorated with @api in ").concat(Ctor, ". You cannot have a setter without the corresponding getter."));
|
|
3381
|
+
} else if (!isFunction$1(descriptor.get)) {
|
|
3382
|
+
assert.fail("Missing @api get ".concat(fieldName, " accessor."));
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3450
3385
|
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
},
|
|
3456
|
-
enumerable: true,
|
|
3457
|
-
configurable: true
|
|
3458
|
-
};
|
|
3386
|
+
function validateMethodDecoratedWithApi(Ctor, methodName, descriptor) {
|
|
3387
|
+
if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {
|
|
3388
|
+
assert.fail("Invalid @api ".concat(methodName, " method."));
|
|
3389
|
+
}
|
|
3459
3390
|
}
|
|
3460
|
-
|
|
3461
|
-
*
|
|
3462
|
-
*
|
|
3463
|
-
* SPDX-License-Identifier: MIT
|
|
3464
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3391
|
+
/**
|
|
3392
|
+
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3393
|
+
* will prevent this function from being imported by user-land code.
|
|
3465
3394
|
*/
|
|
3466
3395
|
|
|
3467
3396
|
|
|
3468
|
-
function
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3397
|
+
function registerDecorators(Ctor, meta) {
|
|
3398
|
+
var proto = Ctor.prototype;
|
|
3399
|
+
var publicProps = meta.publicProps,
|
|
3400
|
+
publicMethods = meta.publicMethods,
|
|
3401
|
+
wire = meta.wire,
|
|
3402
|
+
track = meta.track,
|
|
3403
|
+
fields = meta.fields;
|
|
3404
|
+
var apiMethods = create(null);
|
|
3405
|
+
var apiFields = create(null);
|
|
3406
|
+
var wiredMethods = create(null);
|
|
3407
|
+
var wiredFields = create(null);
|
|
3408
|
+
var observedFields = create(null);
|
|
3409
|
+
var apiFieldsConfig = create(null);
|
|
3410
|
+
var descriptor;
|
|
3475
3411
|
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3412
|
+
if (!isUndefined$1(publicProps)) {
|
|
3413
|
+
for (var fieldName in publicProps) {
|
|
3414
|
+
var propConfig = publicProps[fieldName];
|
|
3415
|
+
apiFieldsConfig[fieldName] = propConfig.config;
|
|
3416
|
+
descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
|
|
3480
3417
|
|
|
3481
|
-
if (
|
|
3418
|
+
if (propConfig.config > 0) {
|
|
3419
|
+
// accessor declaration
|
|
3482
3420
|
if (process.env.NODE_ENV !== 'production') {
|
|
3483
|
-
|
|
3421
|
+
validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor);
|
|
3484
3422
|
}
|
|
3485
3423
|
|
|
3486
|
-
|
|
3424
|
+
if (isUndefined$1(descriptor)) {
|
|
3425
|
+
throw new Error();
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
|
|
3429
|
+
} else {
|
|
3430
|
+
// field declaration
|
|
3431
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3432
|
+
validateFieldDecoratedWithApi(Ctor, fieldName, descriptor);
|
|
3433
|
+
} // [W-9927596] If a component has both a public property and a private setter/getter
|
|
3434
|
+
// with the same name, the property is defined as a public accessor. This branch is
|
|
3435
|
+
// only here for backward compatibility reasons.
|
|
3436
|
+
|
|
3437
|
+
|
|
3438
|
+
if (!isUndefined$1(descriptor) && !isUndefined$1(descriptor.get)) {
|
|
3439
|
+
descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
|
|
3440
|
+
} else {
|
|
3441
|
+
descriptor = createPublicPropertyDescriptor(fieldName);
|
|
3442
|
+
}
|
|
3487
3443
|
}
|
|
3488
3444
|
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
}
|
|
3492
|
-
|
|
3493
|
-
var vm = getAssociatedVM(this);
|
|
3445
|
+
apiFields[fieldName] = descriptor;
|
|
3446
|
+
defineProperty(proto, fieldName, descriptor);
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3494
3449
|
|
|
3495
|
-
|
|
3496
|
-
|
|
3450
|
+
if (!isUndefined$1(publicMethods)) {
|
|
3451
|
+
forEach.call(publicMethods, function (methodName) {
|
|
3452
|
+
descriptor = getOwnPropertyDescriptor$1(proto, methodName);
|
|
3497
3453
|
|
|
3498
|
-
|
|
3499
|
-
|
|
3454
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3455
|
+
validateMethodDecoratedWithApi(Ctor, methodName, descriptor);
|
|
3500
3456
|
}
|
|
3501
3457
|
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
enumerable: true,
|
|
3506
|
-
configurable: true
|
|
3507
|
-
};
|
|
3508
|
-
}
|
|
3458
|
+
if (isUndefined$1(descriptor)) {
|
|
3459
|
+
throw new Error();
|
|
3460
|
+
}
|
|
3509
3461
|
|
|
3510
|
-
|
|
3511
|
-
|
|
3462
|
+
apiMethods[methodName] = descriptor;
|
|
3463
|
+
});
|
|
3464
|
+
}
|
|
3512
3465
|
|
|
3513
|
-
|
|
3466
|
+
if (!isUndefined$1(wire)) {
|
|
3467
|
+
for (var fieldOrMethodName in wire) {
|
|
3468
|
+
var _wire$fieldOrMethodNa = wire[fieldOrMethodName],
|
|
3469
|
+
adapter = _wire$fieldOrMethodNa.adapter,
|
|
3470
|
+
method = _wire$fieldOrMethodNa.method,
|
|
3471
|
+
configCallback = _wire$fieldOrMethodNa.config,
|
|
3472
|
+
_wire$fieldOrMethodNa2 = _wire$fieldOrMethodNa.dynamic,
|
|
3473
|
+
dynamic = _wire$fieldOrMethodNa2 === void 0 ? [] : _wire$fieldOrMethodNa2;
|
|
3474
|
+
descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
|
|
3514
3475
|
|
|
3515
|
-
|
|
3516
|
-
|
|
3476
|
+
if (method === 1) {
|
|
3477
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3478
|
+
assert.isTrue(adapter, "@wire on method \"".concat(fieldOrMethodName, "\": adapter id must be truthy."));
|
|
3479
|
+
validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
|
|
3480
|
+
}
|
|
3517
3481
|
|
|
3518
|
-
|
|
3482
|
+
if (isUndefined$1(descriptor)) {
|
|
3483
|
+
throw new Error();
|
|
3484
|
+
}
|
|
3519
3485
|
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3486
|
+
wiredMethods[fieldOrMethodName] = descriptor;
|
|
3487
|
+
storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic);
|
|
3488
|
+
} else {
|
|
3489
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3490
|
+
assert.isTrue(adapter, "@wire on field \"".concat(fieldOrMethodName, "\": adapter id must be truthy."));
|
|
3491
|
+
validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);
|
|
3492
|
+
}
|
|
3527
3493
|
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3494
|
+
descriptor = internalWireFieldDecorator(fieldOrMethodName);
|
|
3495
|
+
wiredFields[fieldOrMethodName] = descriptor;
|
|
3496
|
+
storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic);
|
|
3497
|
+
defineProperty(proto, fieldOrMethodName, descriptor);
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3534
3501
|
|
|
3535
|
-
|
|
3502
|
+
if (!isUndefined$1(track)) {
|
|
3503
|
+
for (var _fieldName in track) {
|
|
3504
|
+
descriptor = getOwnPropertyDescriptor$1(proto, _fieldName);
|
|
3536
3505
|
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
// the component will get rendered on the second tick, which it is not
|
|
3540
|
-
// desirable.
|
|
3541
|
-
rerenderVM(vm);
|
|
3542
|
-
}
|
|
3543
|
-
}
|
|
3544
|
-
});
|
|
3506
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3507
|
+
validateFieldDecoratedWithTrack(Ctor, _fieldName, descriptor);
|
|
3545
3508
|
}
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3509
|
+
|
|
3510
|
+
descriptor = internalTrackDecorator(_fieldName);
|
|
3511
|
+
defineProperty(proto, _fieldName, descriptor);
|
|
3512
|
+
}
|
|
3549
3513
|
}
|
|
3550
3514
|
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3515
|
+
if (!isUndefined$1(fields)) {
|
|
3516
|
+
for (var _i10 = 0, n = fields.length; _i10 < n; _i10++) {
|
|
3517
|
+
var _fieldName2 = fields[_i10];
|
|
3518
|
+
descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
|
|
3555
3519
|
|
|
3556
|
-
|
|
3520
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3521
|
+
validateObservedField(Ctor, _fieldName2, descriptor);
|
|
3522
|
+
} // [W-9927596] Only mark a field as observed whenever it isn't a duplicated public nor
|
|
3523
|
+
// tracked property. This is only here for backward compatibility purposes.
|
|
3557
3524
|
|
|
3558
|
-
|
|
3559
|
-
|
|
3525
|
+
|
|
3526
|
+
var isDuplicatePublicProp = !isUndefined$1(publicProps) && _fieldName2 in publicProps;
|
|
3527
|
+
var isDuplicateTrackedProp = !isUndefined$1(track) && _fieldName2 in track;
|
|
3528
|
+
|
|
3529
|
+
if (!isDuplicatePublicProp && !isDuplicateTrackedProp) {
|
|
3530
|
+
observedFields[_fieldName2] = createObservedFieldPropertyDescriptor(_fieldName2);
|
|
3560
3531
|
}
|
|
3561
3532
|
}
|
|
3562
|
-
}
|
|
3563
|
-
|
|
3564
|
-
return AccessorReactiveObserver;
|
|
3565
|
-
}(ReactiveObserver);
|
|
3533
|
+
}
|
|
3566
3534
|
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3535
|
+
setDecoratorsMeta(Ctor, {
|
|
3536
|
+
apiMethods: apiMethods,
|
|
3537
|
+
apiFields: apiFields,
|
|
3538
|
+
apiFieldsConfig: apiFieldsConfig,
|
|
3539
|
+
wiredMethods: wiredMethods,
|
|
3540
|
+
wiredFields: wiredFields,
|
|
3541
|
+
observedFields: observedFields
|
|
3542
|
+
});
|
|
3543
|
+
return Ctor;
|
|
3544
|
+
}
|
|
3572
3545
|
|
|
3573
|
-
|
|
3574
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3575
|
-
assert.invariant(isFunction$1(_get3), "Invalid compiler output for public accessor ".concat(toString$1(key), " decorated with @api"));
|
|
3576
|
-
}
|
|
3546
|
+
var signedDecoratorToMetaMap = new Map();
|
|
3577
3547
|
|
|
3578
|
-
|
|
3579
|
-
|
|
3548
|
+
function setDecoratorsMeta(Ctor, meta) {
|
|
3549
|
+
signedDecoratorToMetaMap.set(Ctor, meta);
|
|
3550
|
+
}
|
|
3580
3551
|
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3552
|
+
var defaultMeta = {
|
|
3553
|
+
apiMethods: EmptyObject,
|
|
3554
|
+
apiFields: EmptyObject,
|
|
3555
|
+
apiFieldsConfig: EmptyObject,
|
|
3556
|
+
wiredMethods: EmptyObject,
|
|
3557
|
+
wiredFields: EmptyObject,
|
|
3558
|
+
observedFields: EmptyObject
|
|
3559
|
+
};
|
|
3587
3560
|
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3561
|
+
function getDecoratorsMeta(Ctor) {
|
|
3562
|
+
var meta = signedDecoratorToMetaMap.get(Ctor);
|
|
3563
|
+
return isUndefined$1(meta) ? defaultMeta : meta;
|
|
3564
|
+
}
|
|
3592
3565
|
|
|
3593
|
-
|
|
3566
|
+
var signedTemplateSet = new Set();
|
|
3594
3567
|
|
|
3595
|
-
|
|
3596
|
-
|
|
3568
|
+
function defaultEmptyTemplate() {
|
|
3569
|
+
return [];
|
|
3570
|
+
}
|
|
3597
3571
|
|
|
3598
|
-
|
|
3599
|
-
assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered5, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
|
|
3600
|
-
}
|
|
3572
|
+
signedTemplateSet.add(defaultEmptyTemplate);
|
|
3601
3573
|
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3574
|
+
function isTemplateRegistered(tpl) {
|
|
3575
|
+
return signedTemplateSet.has(tpl);
|
|
3576
|
+
}
|
|
3577
|
+
/**
|
|
3578
|
+
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3579
|
+
* will prevent this function from being imported by userland code.
|
|
3580
|
+
*/
|
|
3605
3581
|
|
|
3606
|
-
if (isUndefined$1(ro)) {
|
|
3607
|
-
ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
|
|
3608
|
-
} // every time we invoke this setter from outside (through this wrapper setter)
|
|
3609
|
-
// we should reset the value and then debounce just in case there is a pending
|
|
3610
|
-
// invocation the next tick that is not longer relevant since the value is changing
|
|
3611
|
-
// from outside.
|
|
3612
3582
|
|
|
3583
|
+
function registerTemplate(tpl) {
|
|
3584
|
+
signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
|
|
3585
|
+
// assignment of templates easily, without too much transformation
|
|
3613
3586
|
|
|
3614
|
-
|
|
3615
|
-
ro.observe(function () {
|
|
3616
|
-
_set2.call(_this3, newValue);
|
|
3617
|
-
});
|
|
3618
|
-
} else {
|
|
3619
|
-
_set2.call(this, newValue);
|
|
3620
|
-
}
|
|
3621
|
-
} else if (process.env.NODE_ENV !== 'production') {
|
|
3622
|
-
assert.fail("Invalid attempt to set a new value for property ".concat(toString$1(key), " of ").concat(vm, " that does not has a setter decorated with @api."));
|
|
3623
|
-
}
|
|
3624
|
-
},
|
|
3625
|
-
enumerable: enumerable,
|
|
3626
|
-
configurable: configurable
|
|
3627
|
-
};
|
|
3587
|
+
return tpl;
|
|
3628
3588
|
}
|
|
3589
|
+
/**
|
|
3590
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
3591
|
+
* libraries to sanitize vulnerable attributes.
|
|
3592
|
+
*/
|
|
3629
3593
|
|
|
3630
|
-
function createObservedFieldPropertyDescriptor(key) {
|
|
3631
|
-
return {
|
|
3632
|
-
get: function get() {
|
|
3633
|
-
var vm = getAssociatedVM(this);
|
|
3634
|
-
componentValueObserved(vm, key);
|
|
3635
|
-
return vm.cmpFields[key];
|
|
3636
|
-
},
|
|
3637
|
-
set: function set(newValue) {
|
|
3638
|
-
var vm = getAssociatedVM(this);
|
|
3639
3594
|
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
},
|
|
3645
|
-
enumerable: true,
|
|
3646
|
-
configurable: true
|
|
3647
|
-
};
|
|
3595
|
+
function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
|
|
3596
|
+
// locker-service patches this function during runtime to sanitize vulnerable attributes. When
|
|
3597
|
+
// ran off-core this function becomes a noop and returns the user authored value.
|
|
3598
|
+
return attrValue;
|
|
3648
3599
|
}
|
|
3649
3600
|
/*
|
|
3650
3601
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3652,807 +3603,816 @@
|
|
|
3652
3603
|
* SPDX-License-Identifier: MIT
|
|
3653
3604
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3654
3605
|
*/
|
|
3606
|
+
// from the element instance, and get the value or set a new value on the component.
|
|
3607
|
+
// This means that across different elements, similar names can get the exact same
|
|
3608
|
+
// descriptor, so we can cache them:
|
|
3655
3609
|
|
|
3656
3610
|
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
return "method"
|
|
3660
|
-
/* Method */
|
|
3661
|
-
;
|
|
3662
|
-
} else if (isFunction$1(descriptor.set) || isFunction$1(descriptor.get)) {
|
|
3663
|
-
return "accessor"
|
|
3664
|
-
/* Accessor */
|
|
3665
|
-
;
|
|
3666
|
-
} else {
|
|
3667
|
-
return "field"
|
|
3668
|
-
/* Field */
|
|
3669
|
-
;
|
|
3670
|
-
}
|
|
3671
|
-
}
|
|
3611
|
+
var cachedGetterByKey = create(null);
|
|
3612
|
+
var cachedSetterByKey = create(null);
|
|
3672
3613
|
|
|
3673
|
-
function
|
|
3674
|
-
|
|
3675
|
-
var type = getClassDescriptorType(descriptor);
|
|
3676
|
-
var message = "Invalid observed ".concat(fieldName, " field. Found a duplicate ").concat(type, " with the same name."); // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.
|
|
3677
|
-
// This branch is only here for backward compatibility reasons.
|
|
3614
|
+
function createGetter(key) {
|
|
3615
|
+
var fn = cachedGetterByKey[key];
|
|
3678
3616
|
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
}
|
|
3617
|
+
if (isUndefined$1(fn)) {
|
|
3618
|
+
fn = cachedGetterByKey[key] = function () {
|
|
3619
|
+
var vm = getAssociatedVM(this);
|
|
3620
|
+
var getHook = vm.getHook;
|
|
3621
|
+
return getHook(vm.component, key);
|
|
3622
|
+
};
|
|
3686
3623
|
}
|
|
3687
|
-
}
|
|
3688
3624
|
|
|
3689
|
-
|
|
3690
|
-
if (!isUndefined$1(descriptor)) {
|
|
3691
|
-
var type = getClassDescriptorType(descriptor);
|
|
3692
|
-
assert.fail("Invalid @track ".concat(fieldName, " field. Found a duplicate ").concat(type, " with the same name."));
|
|
3693
|
-
}
|
|
3625
|
+
return fn;
|
|
3694
3626
|
}
|
|
3695
3627
|
|
|
3696
|
-
function
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3628
|
+
function createSetter(key) {
|
|
3629
|
+
var fn = cachedSetterByKey[key];
|
|
3630
|
+
|
|
3631
|
+
if (isUndefined$1(fn)) {
|
|
3632
|
+
fn = cachedSetterByKey[key] = function (newValue) {
|
|
3633
|
+
var vm = getAssociatedVM(this);
|
|
3634
|
+
var setHook = vm.setHook;
|
|
3635
|
+
newValue = reactiveMembrane.getReadOnlyProxy(newValue);
|
|
3636
|
+
setHook(vm.component, key, newValue);
|
|
3637
|
+
};
|
|
3700
3638
|
}
|
|
3639
|
+
|
|
3640
|
+
return fn;
|
|
3701
3641
|
}
|
|
3702
3642
|
|
|
3703
|
-
function
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3643
|
+
function createMethodCaller(methodName) {
|
|
3644
|
+
return function () {
|
|
3645
|
+
var vm = getAssociatedVM(this);
|
|
3646
|
+
var callHook = vm.callHook,
|
|
3647
|
+
component = vm.component;
|
|
3648
|
+
var fn = component[methodName];
|
|
3649
|
+
return callHook(vm.component, fn, ArraySlice.call(arguments));
|
|
3650
|
+
};
|
|
3707
3651
|
}
|
|
3708
3652
|
|
|
3709
|
-
function
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3653
|
+
function createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback) {
|
|
3654
|
+
return function attributeChangedCallback(attrName, oldValue, newValue) {
|
|
3655
|
+
if (oldValue === newValue) {
|
|
3656
|
+
// Ignore same values.
|
|
3657
|
+
return;
|
|
3658
|
+
}
|
|
3714
3659
|
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
) {
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3660
|
+
var propName = attributeToPropMap[attrName];
|
|
3661
|
+
|
|
3662
|
+
if (isUndefined$1(propName)) {
|
|
3663
|
+
if (!isUndefined$1(superAttributeChangedCallback)) {
|
|
3664
|
+
// delegate unknown attributes to the super.
|
|
3665
|
+
// Typescript does not like it when you treat the `arguments` object as an array
|
|
3666
|
+
// @ts-ignore type-mismatch
|
|
3667
|
+
superAttributeChangedCallback.apply(this, arguments);
|
|
3668
|
+
}
|
|
3669
|
+
|
|
3670
|
+
return;
|
|
3721
3671
|
}
|
|
3722
|
-
}
|
|
3723
|
-
}
|
|
3724
3672
|
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
}
|
|
3673
|
+
if (!isAttributeLocked(this, attrName)) {
|
|
3674
|
+
// Ignore changes triggered by the engine itself during:
|
|
3675
|
+
// * diffing when public props are attempting to reflect to the DOM
|
|
3676
|
+
// * component via `this.setAttribute()`, should never update the prop
|
|
3677
|
+
// Both cases, the setAttribute call is always wrapped by the unlocking of the
|
|
3678
|
+
// attribute to be changed
|
|
3679
|
+
return;
|
|
3680
|
+
} // Reflect attribute change to the corresponding property when changed from outside.
|
|
3734
3681
|
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
}
|
|
3682
|
+
|
|
3683
|
+
this[propName] = newValue;
|
|
3684
|
+
};
|
|
3739
3685
|
}
|
|
3740
|
-
/**
|
|
3741
|
-
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3742
|
-
* will prevent this function from being imported by user-land code.
|
|
3743
|
-
*/
|
|
3744
3686
|
|
|
3687
|
+
function HTMLBridgeElementFactory(SuperClass, props, methods) {
|
|
3688
|
+
var HTMLBridgeElement;
|
|
3689
|
+
/**
|
|
3690
|
+
* Modern browsers will have all Native Constructors as regular Classes
|
|
3691
|
+
* and must be instantiated with the new keyword. In older browsers,
|
|
3692
|
+
* specifically IE11, those are objects with a prototype property defined,
|
|
3693
|
+
* since they are not supposed to be extended or instantiated with the
|
|
3694
|
+
* new keyword. This forking logic supports both cases, specifically because
|
|
3695
|
+
* wc.ts relies on the construction path of the bridges to create new
|
|
3696
|
+
* fully qualifying web components.
|
|
3697
|
+
*/
|
|
3698
|
+
|
|
3699
|
+
if (isFunction$1(SuperClass)) {
|
|
3700
|
+
HTMLBridgeElement = /*#__PURE__*/function (_SuperClass) {
|
|
3701
|
+
_inherits(HTMLBridgeElement, _SuperClass);
|
|
3702
|
+
|
|
3703
|
+
var _super4 = _createSuper(HTMLBridgeElement);
|
|
3745
3704
|
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
var publicProps = meta.publicProps,
|
|
3749
|
-
publicMethods = meta.publicMethods,
|
|
3750
|
-
wire = meta.wire,
|
|
3751
|
-
track = meta.track,
|
|
3752
|
-
fields = meta.fields;
|
|
3753
|
-
var apiMethods = create(null);
|
|
3754
|
-
var apiFields = create(null);
|
|
3755
|
-
var wiredMethods = create(null);
|
|
3756
|
-
var wiredFields = create(null);
|
|
3757
|
-
var observedFields = create(null);
|
|
3758
|
-
var apiFieldsConfig = create(null);
|
|
3759
|
-
var descriptor;
|
|
3705
|
+
function HTMLBridgeElement() {
|
|
3706
|
+
_classCallCheck(this, HTMLBridgeElement);
|
|
3760
3707
|
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
var propConfig = publicProps[fieldName];
|
|
3764
|
-
apiFieldsConfig[fieldName] = propConfig.config;
|
|
3765
|
-
descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
|
|
3708
|
+
return _super4.apply(this, arguments);
|
|
3709
|
+
}
|
|
3766
3710
|
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3711
|
+
return _createClass(HTMLBridgeElement);
|
|
3712
|
+
}(SuperClass);
|
|
3713
|
+
} else {
|
|
3714
|
+
HTMLBridgeElement = function HTMLBridgeElement() {
|
|
3715
|
+
// Bridge classes are not supposed to be instantiated directly in
|
|
3716
|
+
// browsers that do not support web components.
|
|
3717
|
+
throw new TypeError('Illegal constructor');
|
|
3718
|
+
}; // prototype inheritance dance
|
|
3772
3719
|
|
|
3773
|
-
if (isUndefined$1(descriptor)) {
|
|
3774
|
-
throw new Error();
|
|
3775
|
-
}
|
|
3776
3720
|
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3721
|
+
setPrototypeOf(HTMLBridgeElement, SuperClass);
|
|
3722
|
+
setPrototypeOf(HTMLBridgeElement.prototype, SuperClass.prototype);
|
|
3723
|
+
defineProperty(HTMLBridgeElement.prototype, 'constructor', {
|
|
3724
|
+
writable: true,
|
|
3725
|
+
configurable: true,
|
|
3726
|
+
value: HTMLBridgeElement
|
|
3727
|
+
});
|
|
3728
|
+
} // generating the hash table for attributes to avoid duplicate fields and facilitate validation
|
|
3729
|
+
// and false positives in case of inheritance.
|
|
3785
3730
|
|
|
3786
3731
|
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
}
|
|
3732
|
+
var attributeToPropMap = create(null);
|
|
3733
|
+
var superAttributeChangedCallback = SuperClass.prototype.attributeChangedCallback;
|
|
3734
|
+
var _SuperClass$observedA = SuperClass.observedAttributes,
|
|
3735
|
+
superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
|
|
3736
|
+
var descriptors = create(null); // expose getters and setters for each public props on the new Element Bridge
|
|
3793
3737
|
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3738
|
+
for (var _i11 = 0, _len3 = props.length; _i11 < _len3; _i11 += 1) {
|
|
3739
|
+
var _propName2 = props[_i11];
|
|
3740
|
+
attributeToPropMap[htmlPropertyToAttribute(_propName2)] = _propName2;
|
|
3741
|
+
descriptors[_propName2] = {
|
|
3742
|
+
get: createGetter(_propName2),
|
|
3743
|
+
set: createSetter(_propName2),
|
|
3744
|
+
enumerable: true,
|
|
3745
|
+
configurable: true
|
|
3746
|
+
};
|
|
3747
|
+
} // expose public methods as props on the new Element Bridge
|
|
3798
3748
|
|
|
3799
|
-
if (!isUndefined$1(publicMethods)) {
|
|
3800
|
-
forEach.call(publicMethods, function (methodName) {
|
|
3801
|
-
descriptor = getOwnPropertyDescriptor$1(proto, methodName);
|
|
3802
3749
|
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3750
|
+
for (var _i12 = 0, _len4 = methods.length; _i12 < _len4; _i12 += 1) {
|
|
3751
|
+
var methodName = methods[_i12];
|
|
3752
|
+
descriptors[methodName] = {
|
|
3753
|
+
value: createMethodCaller(methodName),
|
|
3754
|
+
writable: true,
|
|
3755
|
+
configurable: true
|
|
3756
|
+
};
|
|
3757
|
+
} // creating a new attributeChangedCallback per bridge because they are bound to the corresponding
|
|
3758
|
+
// map of attributes to props. We do this after all other props and methods to avoid the possibility
|
|
3759
|
+
// of getting overrule by a class declaration in user-land, and we make it non-writable, non-configurable
|
|
3760
|
+
// to preserve this definition.
|
|
3806
3761
|
|
|
3807
|
-
if (isUndefined$1(descriptor)) {
|
|
3808
|
-
throw new Error();
|
|
3809
|
-
}
|
|
3810
3762
|
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
}
|
|
3763
|
+
descriptors.attributeChangedCallback = {
|
|
3764
|
+
value: createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback)
|
|
3765
|
+
}; // Specify attributes for which we want to reflect changes back to their corresponding
|
|
3766
|
+
// properties via attributeChangedCallback.
|
|
3814
3767
|
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
|
|
3768
|
+
defineProperty(HTMLBridgeElement, 'observedAttributes', {
|
|
3769
|
+
get: function get() {
|
|
3770
|
+
return [].concat(_toConsumableArray(superObservedAttributes), _toConsumableArray(keys(attributeToPropMap)));
|
|
3771
|
+
}
|
|
3772
|
+
});
|
|
3773
|
+
defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
3774
|
+
return HTMLBridgeElement;
|
|
3775
|
+
}
|
|
3824
3776
|
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3777
|
+
var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
|
|
3778
|
+
freeze(BaseBridgeElement);
|
|
3779
|
+
seal(BaseBridgeElement.prototype);
|
|
3780
|
+
/*
|
|
3781
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
3782
|
+
* All rights reserved.
|
|
3783
|
+
* SPDX-License-Identifier: MIT
|
|
3784
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3785
|
+
*/
|
|
3830
3786
|
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3787
|
+
function resolveCircularModuleDependency(fn) {
|
|
3788
|
+
var module = fn();
|
|
3789
|
+
return (module === null || module === void 0 ? void 0 : module.__esModule) ? module.default : module;
|
|
3790
|
+
}
|
|
3834
3791
|
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3792
|
+
function isCircularModuleDependency(obj) {
|
|
3793
|
+
return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
|
|
3794
|
+
}
|
|
3795
|
+
/*
|
|
3796
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
3797
|
+
* All rights reserved.
|
|
3798
|
+
* SPDX-License-Identifier: MIT
|
|
3799
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3800
|
+
*/
|
|
3842
3801
|
|
|
3843
|
-
descriptor = internalWireFieldDecorator(fieldOrMethodName);
|
|
3844
|
-
wiredFields[fieldOrMethodName] = descriptor;
|
|
3845
|
-
storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic);
|
|
3846
|
-
defineProperty(proto, fieldOrMethodName, descriptor);
|
|
3847
|
-
}
|
|
3848
|
-
}
|
|
3849
|
-
}
|
|
3850
3802
|
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3803
|
+
var swappedTemplateMap = new WeakMap();
|
|
3804
|
+
var swappedComponentMap = new WeakMap();
|
|
3805
|
+
var swappedStyleMap = new WeakMap();
|
|
3806
|
+
var activeTemplates = new WeakMap();
|
|
3807
|
+
var activeComponents = new WeakMap();
|
|
3808
|
+
var activeStyles = new WeakMap();
|
|
3854
3809
|
|
|
3855
|
-
|
|
3856
|
-
|
|
3810
|
+
function rehydrateHotTemplate(tpl) {
|
|
3811
|
+
var list = activeTemplates.get(tpl);
|
|
3812
|
+
|
|
3813
|
+
if (!isUndefined$1(list)) {
|
|
3814
|
+
list.forEach(function (vm) {
|
|
3815
|
+
if (isFalse(vm.isDirty)) {
|
|
3816
|
+
// forcing the vm to rehydrate in the micro-task:
|
|
3817
|
+
markComponentAsDirty(vm);
|
|
3818
|
+
scheduleRehydration(vm);
|
|
3857
3819
|
}
|
|
3820
|
+
}); // resetting the Set to release the memory of those vm references
|
|
3821
|
+
// since they are not longer related to this template, instead
|
|
3822
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3858
3823
|
|
|
3859
|
-
|
|
3860
|
-
defineProperty(proto, _fieldName, descriptor);
|
|
3861
|
-
}
|
|
3824
|
+
list.clear();
|
|
3862
3825
|
}
|
|
3863
3826
|
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
var _fieldName2 = fields[_i11];
|
|
3867
|
-
descriptor = getOwnPropertyDescriptor$1(proto, _fieldName2);
|
|
3868
|
-
|
|
3869
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3870
|
-
validateObservedField(Ctor, _fieldName2, descriptor);
|
|
3871
|
-
} // [W-9927596] Only mark a field as observed whenever it isn't a duplicated public nor
|
|
3872
|
-
// tracked property. This is only here for backward compatibility purposes.
|
|
3827
|
+
return true;
|
|
3828
|
+
}
|
|
3873
3829
|
|
|
3830
|
+
function rehydrateHotStyle(style) {
|
|
3831
|
+
var list = activeStyles.get(style);
|
|
3874
3832
|
|
|
3875
|
-
|
|
3876
|
-
|
|
3833
|
+
if (!isUndefined$1(list)) {
|
|
3834
|
+
list.forEach(function (vm) {
|
|
3835
|
+
// if a style definition is swapped, we must reset
|
|
3836
|
+
// vm's template content in the next micro-task:
|
|
3837
|
+
forceRehydration(vm);
|
|
3838
|
+
}); // resetting the Set to release the memory of those vm references
|
|
3839
|
+
// since they are not longer related to this style, instead
|
|
3840
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3877
3841
|
|
|
3878
|
-
|
|
3879
|
-
observedFields[_fieldName2] = createObservedFieldPropertyDescriptor(_fieldName2);
|
|
3880
|
-
}
|
|
3881
|
-
}
|
|
3842
|
+
list.clear();
|
|
3882
3843
|
}
|
|
3883
3844
|
|
|
3884
|
-
|
|
3885
|
-
apiMethods: apiMethods,
|
|
3886
|
-
apiFields: apiFields,
|
|
3887
|
-
apiFieldsConfig: apiFieldsConfig,
|
|
3888
|
-
wiredMethods: wiredMethods,
|
|
3889
|
-
wiredFields: wiredFields,
|
|
3890
|
-
observedFields: observedFields
|
|
3891
|
-
});
|
|
3892
|
-
return Ctor;
|
|
3845
|
+
return true;
|
|
3893
3846
|
}
|
|
3894
3847
|
|
|
3895
|
-
|
|
3848
|
+
function rehydrateHotComponent(Ctor) {
|
|
3849
|
+
var list = activeComponents.get(Ctor);
|
|
3850
|
+
var canRefreshAllInstances = true;
|
|
3851
|
+
|
|
3852
|
+
if (!isUndefined$1(list)) {
|
|
3853
|
+
list.forEach(function (vm) {
|
|
3854
|
+
var owner = vm.owner;
|
|
3855
|
+
|
|
3856
|
+
if (!isNull(owner)) {
|
|
3857
|
+
// if a component class definition is swapped, we must reset
|
|
3858
|
+
// owner's template content in the next micro-task:
|
|
3859
|
+
forceRehydration(owner);
|
|
3860
|
+
} else {
|
|
3861
|
+
// the hot swapping for components only work for instances of components
|
|
3862
|
+
// created from a template, root elements can't be swapped because we
|
|
3863
|
+
// don't have a way to force the creation of the element with the same state
|
|
3864
|
+
// of the current element.
|
|
3865
|
+
// Instead, we can report the problem to the caller so it can take action,
|
|
3866
|
+
// for example: reload the entire page.
|
|
3867
|
+
canRefreshAllInstances = false;
|
|
3868
|
+
}
|
|
3869
|
+
}); // resetting the Set to release the memory of those vm references
|
|
3870
|
+
// since they are not longer related to this constructor, instead
|
|
3871
|
+
// they will get re-associated once these instances are rehydrated.
|
|
3872
|
+
|
|
3873
|
+
list.clear();
|
|
3874
|
+
}
|
|
3896
3875
|
|
|
3897
|
-
|
|
3898
|
-
signedDecoratorToMetaMap.set(Ctor, meta);
|
|
3876
|
+
return canRefreshAllInstances;
|
|
3899
3877
|
}
|
|
3900
3878
|
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
apiFields: EmptyObject,
|
|
3904
|
-
apiFieldsConfig: EmptyObject,
|
|
3905
|
-
wiredMethods: EmptyObject,
|
|
3906
|
-
wiredFields: EmptyObject,
|
|
3907
|
-
observedFields: EmptyObject
|
|
3908
|
-
};
|
|
3909
|
-
|
|
3910
|
-
function getDecoratorsMeta(Ctor) {
|
|
3911
|
-
var meta = signedDecoratorToMetaMap.get(Ctor);
|
|
3912
|
-
return isUndefined$1(meta) ? defaultMeta : meta;
|
|
3913
|
-
}
|
|
3879
|
+
function flattenStylesheets(stylesheets) {
|
|
3880
|
+
var list = [];
|
|
3914
3881
|
|
|
3915
|
-
|
|
3882
|
+
var _iterator2 = _createForOfIteratorHelper(stylesheets),
|
|
3883
|
+
_step2;
|
|
3916
3884
|
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3885
|
+
try {
|
|
3886
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3887
|
+
var stylesheet = _step2.value;
|
|
3920
3888
|
|
|
3921
|
-
|
|
3889
|
+
if (!Array.isArray(stylesheet)) {
|
|
3890
|
+
list.push(stylesheet);
|
|
3891
|
+
} else {
|
|
3892
|
+
list.push.apply(list, _toConsumableArray(flattenStylesheets(stylesheet)));
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
} catch (err) {
|
|
3896
|
+
_iterator2.e(err);
|
|
3897
|
+
} finally {
|
|
3898
|
+
_iterator2.f();
|
|
3899
|
+
}
|
|
3922
3900
|
|
|
3923
|
-
|
|
3924
|
-
return signedTemplateSet.has(tpl);
|
|
3901
|
+
return list;
|
|
3925
3902
|
}
|
|
3926
|
-
/**
|
|
3927
|
-
* INTERNAL: This function can only be invoked by compiled code. The compiler
|
|
3928
|
-
* will prevent this function from being imported by userland code.
|
|
3929
|
-
*/
|
|
3930
3903
|
|
|
3904
|
+
function getTemplateOrSwappedTemplate(tpl) {
|
|
3905
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3906
|
+
// this method should never leak to prod
|
|
3907
|
+
throw new ReferenceError();
|
|
3908
|
+
}
|
|
3931
3909
|
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3910
|
+
if (runtimeFlags.ENABLE_HMR) {
|
|
3911
|
+
var visited = new Set();
|
|
3912
|
+
|
|
3913
|
+
while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
|
|
3914
|
+
visited.add(tpl);
|
|
3915
|
+
tpl = swappedTemplateMap.get(tpl);
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3935
3918
|
|
|
3936
3919
|
return tpl;
|
|
3937
3920
|
}
|
|
3938
|
-
/**
|
|
3939
|
-
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
|
3940
|
-
* libraries to sanitize vulnerable attributes.
|
|
3941
|
-
*/
|
|
3942
3921
|
|
|
3922
|
+
function getComponentOrSwappedComponent(Ctor) {
|
|
3923
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3924
|
+
// this method should never leak to prod
|
|
3925
|
+
throw new ReferenceError();
|
|
3926
|
+
}
|
|
3943
3927
|
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
* SPDX-License-Identifier: MIT
|
|
3953
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3954
|
-
*/
|
|
3955
|
-
// from the element instance, and get the value or set a new value on the component.
|
|
3956
|
-
// This means that across different elements, similar names can get the exact same
|
|
3957
|
-
// descriptor, so we can cache them:
|
|
3928
|
+
if (runtimeFlags.ENABLE_HMR) {
|
|
3929
|
+
var visited = new Set();
|
|
3930
|
+
|
|
3931
|
+
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
3932
|
+
visited.add(Ctor);
|
|
3933
|
+
Ctor = swappedComponentMap.get(Ctor);
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3958
3936
|
|
|
3937
|
+
return Ctor;
|
|
3938
|
+
}
|
|
3959
3939
|
|
|
3960
|
-
|
|
3961
|
-
|
|
3940
|
+
function getStyleOrSwappedStyle(style) {
|
|
3941
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3942
|
+
// this method should never leak to prod
|
|
3943
|
+
throw new ReferenceError();
|
|
3944
|
+
}
|
|
3962
3945
|
|
|
3963
|
-
|
|
3964
|
-
|
|
3946
|
+
if (runtimeFlags.ENABLE_HMR) {
|
|
3947
|
+
var visited = new Set();
|
|
3965
3948
|
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
return getHook(vm.component, key);
|
|
3971
|
-
};
|
|
3949
|
+
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
3950
|
+
visited.add(style);
|
|
3951
|
+
style = swappedStyleMap.get(style);
|
|
3952
|
+
}
|
|
3972
3953
|
}
|
|
3973
3954
|
|
|
3974
|
-
return
|
|
3955
|
+
return style;
|
|
3975
3956
|
}
|
|
3976
3957
|
|
|
3977
|
-
function
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
fn = cachedSetterByKey[key] = function (newValue) {
|
|
3982
|
-
var vm = getAssociatedVM(this);
|
|
3983
|
-
var setHook = vm.setHook;
|
|
3984
|
-
newValue = reactiveMembrane.getReadOnlyProxy(newValue);
|
|
3985
|
-
setHook(vm.component, key, newValue);
|
|
3986
|
-
};
|
|
3958
|
+
function setActiveVM(vm) {
|
|
3959
|
+
if (process.env.NODE_ENV === 'production') {
|
|
3960
|
+
// this method should never leak to prod
|
|
3961
|
+
throw new ReferenceError();
|
|
3987
3962
|
}
|
|
3988
3963
|
|
|
3989
|
-
|
|
3990
|
-
|
|
3964
|
+
if (runtimeFlags.ENABLE_HMR) {
|
|
3965
|
+
// tracking active component
|
|
3966
|
+
var Ctor = vm.def.ctor;
|
|
3967
|
+
var componentVMs = activeComponents.get(Ctor);
|
|
3991
3968
|
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
component = vm.component;
|
|
3997
|
-
var fn = component[methodName];
|
|
3998
|
-
return callHook(vm.component, fn, ArraySlice.call(arguments));
|
|
3999
|
-
};
|
|
4000
|
-
}
|
|
3969
|
+
if (isUndefined$1(componentVMs)) {
|
|
3970
|
+
componentVMs = new Set();
|
|
3971
|
+
activeComponents.set(Ctor, componentVMs);
|
|
3972
|
+
} // this will allow us to keep track of the hot components
|
|
4001
3973
|
|
|
4002
|
-
function createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback) {
|
|
4003
|
-
return function attributeChangedCallback(attrName, oldValue, newValue) {
|
|
4004
|
-
if (oldValue === newValue) {
|
|
4005
|
-
// Ignore same values.
|
|
4006
|
-
return;
|
|
4007
|
-
}
|
|
4008
3974
|
|
|
4009
|
-
|
|
3975
|
+
componentVMs.add(vm); // tracking active template
|
|
4010
3976
|
|
|
4011
|
-
|
|
4012
|
-
if (!isUndefined$1(superAttributeChangedCallback)) {
|
|
4013
|
-
// delegate unknown attributes to the super.
|
|
4014
|
-
// Typescript does not like it when you treat the `arguments` object as an array
|
|
4015
|
-
// @ts-ignore type-mismatch
|
|
4016
|
-
superAttributeChangedCallback.apply(this, arguments);
|
|
4017
|
-
}
|
|
3977
|
+
var tpl = vm.cmpTemplate;
|
|
4018
3978
|
|
|
4019
|
-
|
|
4020
|
-
|
|
3979
|
+
if (tpl) {
|
|
3980
|
+
var templateVMs = activeTemplates.get(tpl);
|
|
4021
3981
|
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
//
|
|
4026
|
-
//
|
|
4027
|
-
// attribute to be changed
|
|
4028
|
-
return;
|
|
4029
|
-
} // Reflect attribute change to the corresponding property when changed from outside.
|
|
3982
|
+
if (isUndefined$1(templateVMs)) {
|
|
3983
|
+
templateVMs = new Set();
|
|
3984
|
+
activeTemplates.set(tpl, templateVMs);
|
|
3985
|
+
} // this will allow us to keep track of the templates that are
|
|
3986
|
+
// being used by a hot component
|
|
4030
3987
|
|
|
4031
3988
|
|
|
4032
|
-
|
|
4033
|
-
};
|
|
4034
|
-
}
|
|
3989
|
+
templateVMs.add(vm); // tracking active styles associated to template
|
|
4035
3990
|
|
|
4036
|
-
|
|
4037
|
-
var HTMLBridgeElement;
|
|
4038
|
-
/**
|
|
4039
|
-
* Modern browsers will have all Native Constructors as regular Classes
|
|
4040
|
-
* and must be instantiated with the new keyword. In older browsers,
|
|
4041
|
-
* specifically IE11, those are objects with a prototype property defined,
|
|
4042
|
-
* since they are not supposed to be extended or instantiated with the
|
|
4043
|
-
* new keyword. This forking logic supports both cases, specifically because
|
|
4044
|
-
* wc.ts relies on the construction path of the bridges to create new
|
|
4045
|
-
* fully qualifying web components.
|
|
4046
|
-
*/
|
|
3991
|
+
var stylesheets = tpl.stylesheets;
|
|
4047
3992
|
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
3993
|
+
if (!isUndefined$1(stylesheets)) {
|
|
3994
|
+
flattenStylesheets(stylesheets).forEach(function (stylesheet) {
|
|
3995
|
+
// this is necessary because we don't hold the list of styles
|
|
3996
|
+
// in the vm, we only hold the selected (already swapped template)
|
|
3997
|
+
// but the styles attached to the template might not be the actual
|
|
3998
|
+
// active ones, but the swapped versions of those.
|
|
3999
|
+
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
4000
|
+
var stylesheetVMs = activeStyles.get(stylesheet);
|
|
4051
4001
|
|
|
4052
|
-
|
|
4002
|
+
if (isUndefined$1(stylesheetVMs)) {
|
|
4003
|
+
stylesheetVMs = new Set();
|
|
4004
|
+
activeStyles.set(stylesheet, stylesheetVMs);
|
|
4005
|
+
} // this will allow us to keep track of the stylesheet that are
|
|
4006
|
+
// being used by a hot component
|
|
4053
4007
|
|
|
4054
|
-
function HTMLBridgeElement() {
|
|
4055
|
-
_classCallCheck(this, HTMLBridgeElement);
|
|
4056
4008
|
|
|
4057
|
-
|
|
4009
|
+
stylesheetVMs.add(vm);
|
|
4010
|
+
});
|
|
4058
4011
|
}
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4059
4015
|
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
// browsers that do not support web components.
|
|
4066
|
-
throw new TypeError('Illegal constructor');
|
|
4067
|
-
}; // prototype inheritance dance
|
|
4068
|
-
|
|
4016
|
+
function removeActiveVM(vm) {
|
|
4017
|
+
if (process.env.NODE_ENV === 'production') {
|
|
4018
|
+
// this method should never leak to prod
|
|
4019
|
+
throw new ReferenceError();
|
|
4020
|
+
}
|
|
4069
4021
|
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
configurable: true,
|
|
4075
|
-
value: HTMLBridgeElement
|
|
4076
|
-
});
|
|
4077
|
-
} // generating the hash table for attributes to avoid duplicate fields and facilitate validation
|
|
4078
|
-
// and false positives in case of inheritance.
|
|
4022
|
+
if (runtimeFlags.ENABLE_HMR) {
|
|
4023
|
+
// tracking inactive component
|
|
4024
|
+
var Ctor = vm.def.ctor;
|
|
4025
|
+
var list = activeComponents.get(Ctor);
|
|
4079
4026
|
|
|
4027
|
+
if (!isUndefined$1(list)) {
|
|
4028
|
+
// deleting the vm from the set to avoid leaking memory
|
|
4029
|
+
list.delete(vm);
|
|
4030
|
+
} // removing inactive template
|
|
4080
4031
|
|
|
4081
|
-
var attributeToPropMap = create(null);
|
|
4082
|
-
var superAttributeChangedCallback = SuperClass.prototype.attributeChangedCallback;
|
|
4083
|
-
var _SuperClass$observedA = SuperClass.observedAttributes,
|
|
4084
|
-
superObservedAttributes = _SuperClass$observedA === void 0 ? [] : _SuperClass$observedA;
|
|
4085
|
-
var descriptors = create(null); // expose getters and setters for each public props on the new Element Bridge
|
|
4086
4032
|
|
|
4087
|
-
|
|
4088
|
-
var _propName2 = props[_i12];
|
|
4089
|
-
attributeToPropMap[htmlPropertyToAttribute(_propName2)] = _propName2;
|
|
4090
|
-
descriptors[_propName2] = {
|
|
4091
|
-
get: createGetter(_propName2),
|
|
4092
|
-
set: createSetter(_propName2),
|
|
4093
|
-
enumerable: true,
|
|
4094
|
-
configurable: true
|
|
4095
|
-
};
|
|
4096
|
-
} // expose public methods as props on the new Element Bridge
|
|
4033
|
+
var tpl = vm.cmpTemplate;
|
|
4097
4034
|
|
|
4035
|
+
if (tpl) {
|
|
4036
|
+
list = activeTemplates.get(tpl);
|
|
4098
4037
|
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
writable: true,
|
|
4104
|
-
configurable: true
|
|
4105
|
-
};
|
|
4106
|
-
} // creating a new attributeChangedCallback per bridge because they are bound to the corresponding
|
|
4107
|
-
// map of attributes to props. We do this after all other props and methods to avoid the possibility
|
|
4108
|
-
// of getting overrule by a class declaration in user-land, and we make it non-writable, non-configurable
|
|
4109
|
-
// to preserve this definition.
|
|
4038
|
+
if (!isUndefined$1(list)) {
|
|
4039
|
+
// deleting the vm from the set to avoid leaking memory
|
|
4040
|
+
list.delete(vm);
|
|
4041
|
+
} // removing active styles associated to template
|
|
4110
4042
|
|
|
4111
4043
|
|
|
4112
|
-
|
|
4113
|
-
value: createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback)
|
|
4114
|
-
}; // Specify attributes for which we want to reflect changes back to their corresponding
|
|
4115
|
-
// properties via attributeChangedCallback.
|
|
4044
|
+
var styles = tpl.stylesheets;
|
|
4116
4045
|
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4046
|
+
if (!isUndefined$1(styles)) {
|
|
4047
|
+
flattenStylesheets(styles).forEach(function (style) {
|
|
4048
|
+
list = activeStyles.get(style);
|
|
4049
|
+
|
|
4050
|
+
if (!isUndefined$1(list)) {
|
|
4051
|
+
// deleting the vm from the set to avoid leaking memory
|
|
4052
|
+
list.delete(vm);
|
|
4053
|
+
}
|
|
4054
|
+
});
|
|
4055
|
+
}
|
|
4120
4056
|
}
|
|
4121
|
-
}
|
|
4122
|
-
defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
4123
|
-
return HTMLBridgeElement;
|
|
4057
|
+
}
|
|
4124
4058
|
}
|
|
4125
4059
|
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4060
|
+
function swapTemplate(oldTpl, newTpl) {
|
|
4061
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4062
|
+
if (isTemplateRegistered(oldTpl) && isTemplateRegistered(newTpl)) {
|
|
4063
|
+
swappedTemplateMap.set(oldTpl, newTpl);
|
|
4064
|
+
return rehydrateHotTemplate(oldTpl);
|
|
4065
|
+
} else {
|
|
4066
|
+
throw new TypeError("Invalid Template");
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4135
4069
|
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
}
|
|
4070
|
+
if (!runtimeFlags.ENABLE_HMR) {
|
|
4071
|
+
throw new Error('HMR is not enabled');
|
|
4072
|
+
}
|
|
4140
4073
|
|
|
4141
|
-
|
|
4142
|
-
return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
|
|
4074
|
+
return false;
|
|
4143
4075
|
}
|
|
4144
|
-
/*
|
|
4145
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4146
|
-
* All rights reserved.
|
|
4147
|
-
* SPDX-License-Identifier: MIT
|
|
4148
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4149
|
-
*/
|
|
4150
4076
|
|
|
4077
|
+
function swapComponent(oldComponent, newComponent) {
|
|
4078
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4079
|
+
if (isComponentConstructor(oldComponent) && isComponentConstructor(newComponent)) {
|
|
4080
|
+
swappedComponentMap.set(oldComponent, newComponent);
|
|
4081
|
+
return rehydrateHotComponent(oldComponent);
|
|
4082
|
+
} else {
|
|
4083
|
+
throw new TypeError("Invalid Component");
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4151
4086
|
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
var activeTemplates = new WeakMap();
|
|
4156
|
-
var activeComponents = new WeakMap();
|
|
4157
|
-
var activeStyles = new WeakMap();
|
|
4087
|
+
if (!runtimeFlags.ENABLE_HMR) {
|
|
4088
|
+
throw new Error('HMR is not enabled');
|
|
4089
|
+
}
|
|
4158
4090
|
|
|
4159
|
-
|
|
4160
|
-
|
|
4091
|
+
return false;
|
|
4092
|
+
}
|
|
4161
4093
|
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
}); // resetting the Set to release the memory of those vm references
|
|
4170
|
-
// since they are not longer related to this template, instead
|
|
4171
|
-
// they will get re-associated once these instances are rehydrated.
|
|
4094
|
+
function swapStyle(oldStyle, newStyle) {
|
|
4095
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4096
|
+
// TODO [#1887]: once the support for registering styles is implemented
|
|
4097
|
+
// we can add the validation of both styles around this block.
|
|
4098
|
+
swappedStyleMap.set(oldStyle, newStyle);
|
|
4099
|
+
return rehydrateHotStyle(oldStyle);
|
|
4100
|
+
}
|
|
4172
4101
|
|
|
4173
|
-
|
|
4102
|
+
if (!runtimeFlags.ENABLE_HMR) {
|
|
4103
|
+
throw new Error('HMR is not enabled');
|
|
4174
4104
|
}
|
|
4175
4105
|
|
|
4176
|
-
return
|
|
4106
|
+
return false;
|
|
4177
4107
|
}
|
|
4108
|
+
/*
|
|
4109
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4110
|
+
* All rights reserved.
|
|
4111
|
+
* SPDX-License-Identifier: MIT
|
|
4112
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4113
|
+
*/
|
|
4178
4114
|
|
|
4179
|
-
function rehydrateHotStyle(style) {
|
|
4180
|
-
var list = activeStyles.get(style);
|
|
4181
4115
|
|
|
4182
|
-
|
|
4183
|
-
list.forEach(function (vm) {
|
|
4184
|
-
// if a style definition is swapped, we must reset
|
|
4185
|
-
// vm's template content in the next micro-task:
|
|
4186
|
-
forceRehydration(vm);
|
|
4187
|
-
}); // resetting the Set to release the memory of those vm references
|
|
4188
|
-
// since they are not longer related to this style, instead
|
|
4189
|
-
// they will get re-associated once these instances are rehydrated.
|
|
4116
|
+
var CtorToDefMap = new WeakMap();
|
|
4190
4117
|
|
|
4191
|
-
|
|
4192
|
-
|
|
4118
|
+
function getCtorProto(Ctor) {
|
|
4119
|
+
var proto = getPrototypeOf$1(Ctor);
|
|
4193
4120
|
|
|
4194
|
-
|
|
4195
|
-
|
|
4121
|
+
if (isNull(proto)) {
|
|
4122
|
+
throw new ReferenceError("Invalid prototype chain for ".concat(Ctor.name, ", you must extend LightningElement."));
|
|
4123
|
+
} // covering the cases where the ref is circular in AMD
|
|
4196
4124
|
|
|
4197
|
-
function rehydrateHotComponent(Ctor) {
|
|
4198
|
-
var list = activeComponents.get(Ctor);
|
|
4199
|
-
var canRefreshAllInstances = true;
|
|
4200
4125
|
|
|
4201
|
-
if (
|
|
4202
|
-
|
|
4203
|
-
var owner = vm.owner;
|
|
4126
|
+
if (isCircularModuleDependency(proto)) {
|
|
4127
|
+
var p = resolveCircularModuleDependency(proto);
|
|
4204
4128
|
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
forceRehydration(owner);
|
|
4209
|
-
} else {
|
|
4210
|
-
// the hot swapping for components only work for instances of components
|
|
4211
|
-
// created from a template, root elements can't be swapped because we
|
|
4212
|
-
// don't have a way to force the creation of the element with the same state
|
|
4213
|
-
// of the current element.
|
|
4214
|
-
// Instead, we can report the problem to the caller so it can take action,
|
|
4215
|
-
// for example: reload the entire page.
|
|
4216
|
-
canRefreshAllInstances = false;
|
|
4129
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4130
|
+
if (isNull(p)) {
|
|
4131
|
+
throw new ReferenceError("Circular module dependency for ".concat(Ctor.name, ", must resolve to a constructor that extends LightningElement."));
|
|
4217
4132
|
}
|
|
4218
|
-
}
|
|
4219
|
-
//
|
|
4220
|
-
//
|
|
4133
|
+
} // escape hatch for Locker and other abstractions to provide their own base class instead
|
|
4134
|
+
// of our Base class without having to leak it to user-land. If the circular function returns
|
|
4135
|
+
// itself, that's the signal that we have hit the end of the proto chain, which must always
|
|
4136
|
+
// be base.
|
|
4221
4137
|
|
|
4222
|
-
|
|
4138
|
+
|
|
4139
|
+
proto = p === proto ? LightningElement : p;
|
|
4223
4140
|
}
|
|
4224
4141
|
|
|
4225
|
-
return
|
|
4142
|
+
return proto;
|
|
4226
4143
|
}
|
|
4227
4144
|
|
|
4228
|
-
function
|
|
4229
|
-
var
|
|
4145
|
+
function createComponentDef(Ctor) {
|
|
4146
|
+
var ctorShadowSupportMode = Ctor.shadowSupportMode,
|
|
4147
|
+
ctorRenderMode = Ctor.renderMode;
|
|
4230
4148
|
|
|
4231
|
-
|
|
4232
|
-
|
|
4149
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4150
|
+
var ctorName = Ctor.name; // Removing the following assert until https://bugs.webkit.org/show_bug.cgi?id=190140 is fixed.
|
|
4151
|
+
// assert.isTrue(ctorName && isString(ctorName), `${toString(Ctor)} should have a "name" property with string value, but found ${ctorName}.`);
|
|
4233
4152
|
|
|
4234
|
-
|
|
4235
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
4236
|
-
var stylesheet = _step2.value;
|
|
4153
|
+
assert.isTrue(Ctor.constructor, "Missing ".concat(ctorName, ".constructor, ").concat(ctorName, " should have a \"constructor\" property."));
|
|
4237
4154
|
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4155
|
+
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4156
|
+
assert.invariant(ctorShadowSupportMode === "any"
|
|
4157
|
+
/* Any */
|
|
4158
|
+
|| ctorShadowSupportMode === "reset"
|
|
4159
|
+
/* Default */
|
|
4160
|
+
, "Invalid value for static property shadowSupportMode: '".concat(ctorShadowSupportMode, "'"));
|
|
4243
4161
|
}
|
|
4244
|
-
} catch (err) {
|
|
4245
|
-
_iterator2.e(err);
|
|
4246
|
-
} finally {
|
|
4247
|
-
_iterator2.f();
|
|
4248
|
-
}
|
|
4249
4162
|
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
function getTemplateOrSwappedTemplate(tpl) {
|
|
4254
|
-
if (process.env.NODE_ENV === 'production') {
|
|
4255
|
-
// this method should never leak to prod
|
|
4256
|
-
throw new ReferenceError();
|
|
4163
|
+
if (!isUndefined$1(ctorRenderMode)) {
|
|
4164
|
+
assert.invariant(ctorRenderMode === 'light' || ctorRenderMode === 'shadow', "Invalid value for static property renderMode: '".concat(ctorRenderMode, "'. renderMode must be either 'light' or 'shadow'."));
|
|
4165
|
+
}
|
|
4257
4166
|
}
|
|
4258
4167
|
|
|
4259
|
-
|
|
4260
|
-
|
|
4168
|
+
var decoratorsMeta = getDecoratorsMeta(Ctor);
|
|
4169
|
+
var apiFields = decoratorsMeta.apiFields,
|
|
4170
|
+
apiFieldsConfig = decoratorsMeta.apiFieldsConfig,
|
|
4171
|
+
apiMethods = decoratorsMeta.apiMethods,
|
|
4172
|
+
wiredFields = decoratorsMeta.wiredFields,
|
|
4173
|
+
wiredMethods = decoratorsMeta.wiredMethods,
|
|
4174
|
+
observedFields = decoratorsMeta.observedFields;
|
|
4175
|
+
var proto = Ctor.prototype;
|
|
4176
|
+
var connectedCallback = proto.connectedCallback,
|
|
4177
|
+
disconnectedCallback = proto.disconnectedCallback,
|
|
4178
|
+
renderedCallback = proto.renderedCallback,
|
|
4179
|
+
errorCallback = proto.errorCallback,
|
|
4180
|
+
render = proto.render;
|
|
4181
|
+
var superProto = getCtorProto(Ctor);
|
|
4182
|
+
var superDef = superProto !== LightningElement ? getComponentInternalDef(superProto) : lightingElementDef;
|
|
4183
|
+
var bridge = HTMLBridgeElementFactory(superDef.bridge, keys(apiFields), keys(apiMethods));
|
|
4184
|
+
var props = assign(create(null), superDef.props, apiFields);
|
|
4185
|
+
var propsConfig = assign(create(null), superDef.propsConfig, apiFieldsConfig);
|
|
4186
|
+
var methods = assign(create(null), superDef.methods, apiMethods);
|
|
4187
|
+
var wire = assign(create(null), superDef.wire, wiredFields, wiredMethods);
|
|
4188
|
+
connectedCallback = connectedCallback || superDef.connectedCallback;
|
|
4189
|
+
disconnectedCallback = disconnectedCallback || superDef.disconnectedCallback;
|
|
4190
|
+
renderedCallback = renderedCallback || superDef.renderedCallback;
|
|
4191
|
+
errorCallback = errorCallback || superDef.errorCallback;
|
|
4192
|
+
render = render || superDef.render;
|
|
4193
|
+
var shadowSupportMode = superDef.shadowSupportMode;
|
|
4261
4194
|
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
tpl = swappedTemplateMap.get(tpl);
|
|
4265
|
-
}
|
|
4195
|
+
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
4196
|
+
shadowSupportMode = ctorShadowSupportMode;
|
|
4266
4197
|
}
|
|
4267
4198
|
|
|
4268
|
-
|
|
4269
|
-
}
|
|
4199
|
+
var renderMode = superDef.renderMode;
|
|
4270
4200
|
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4201
|
+
if (!isUndefined$1(ctorRenderMode)) {
|
|
4202
|
+
renderMode = ctorRenderMode === 'light' ? 0
|
|
4203
|
+
/* Light */
|
|
4204
|
+
: 1
|
|
4205
|
+
/* Shadow */
|
|
4206
|
+
;
|
|
4275
4207
|
}
|
|
4276
4208
|
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
|
|
4281
|
-
visited.add(Ctor);
|
|
4282
|
-
Ctor = swappedComponentMap.get(Ctor);
|
|
4283
|
-
}
|
|
4284
|
-
}
|
|
4209
|
+
var template = getComponentRegisteredTemplate(Ctor) || superDef.template;
|
|
4210
|
+
var name = Ctor.name || superDef.name; // installing observed fields into the prototype.
|
|
4285
4211
|
|
|
4286
|
-
|
|
4287
|
-
|
|
4212
|
+
defineProperties(proto, observedFields);
|
|
4213
|
+
var def = {
|
|
4214
|
+
ctor: Ctor,
|
|
4215
|
+
name: name,
|
|
4216
|
+
wire: wire,
|
|
4217
|
+
props: props,
|
|
4218
|
+
propsConfig: propsConfig,
|
|
4219
|
+
methods: methods,
|
|
4220
|
+
bridge: bridge,
|
|
4221
|
+
template: template,
|
|
4222
|
+
renderMode: renderMode,
|
|
4223
|
+
shadowSupportMode: shadowSupportMode,
|
|
4224
|
+
connectedCallback: connectedCallback,
|
|
4225
|
+
disconnectedCallback: disconnectedCallback,
|
|
4226
|
+
renderedCallback: renderedCallback,
|
|
4227
|
+
errorCallback: errorCallback,
|
|
4228
|
+
render: render
|
|
4229
|
+
};
|
|
4288
4230
|
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
// this method should never leak to prod
|
|
4292
|
-
throw new ReferenceError();
|
|
4231
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4232
|
+
freeze(Ctor.prototype);
|
|
4293
4233
|
}
|
|
4294
4234
|
|
|
4295
|
-
|
|
4296
|
-
|
|
4235
|
+
return def;
|
|
4236
|
+
}
|
|
4237
|
+
/**
|
|
4238
|
+
* EXPERIMENTAL: This function allows for the identification of LWC constructors. This API is
|
|
4239
|
+
* subject to change or being removed.
|
|
4240
|
+
*/
|
|
4297
4241
|
|
|
4298
|
-
while (swappedStyleMap.has(style) && !visited.has(style)) {
|
|
4299
|
-
visited.add(style);
|
|
4300
|
-
style = swappedStyleMap.get(style);
|
|
4301
|
-
}
|
|
4302
|
-
}
|
|
4303
4242
|
|
|
4304
|
-
|
|
4305
|
-
|
|
4243
|
+
function isComponentConstructor(ctor) {
|
|
4244
|
+
if (!isFunction$1(ctor)) {
|
|
4245
|
+
return false;
|
|
4246
|
+
} // Fast path: LightningElement is part of the prototype chain of the constructor.
|
|
4306
4247
|
|
|
4307
|
-
function setActiveVM(vm) {
|
|
4308
|
-
if (process.env.NODE_ENV === 'production') {
|
|
4309
|
-
// this method should never leak to prod
|
|
4310
|
-
throw new ReferenceError();
|
|
4311
|
-
}
|
|
4312
4248
|
|
|
4313
|
-
if (
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4249
|
+
if (ctor.prototype instanceof LightningElement) {
|
|
4250
|
+
return true;
|
|
4251
|
+
} // Slow path: LightningElement is not part of the prototype chain of the constructor, we need
|
|
4252
|
+
// climb up the constructor prototype chain to check in case there are circular dependencies
|
|
4253
|
+
// to resolve.
|
|
4317
4254
|
|
|
4318
|
-
if (isUndefined$1(componentVMs)) {
|
|
4319
|
-
componentVMs = new Set();
|
|
4320
|
-
activeComponents.set(Ctor, componentVMs);
|
|
4321
|
-
} // this will allow us to keep track of the hot components
|
|
4322
4255
|
|
|
4256
|
+
var current = ctor;
|
|
4323
4257
|
|
|
4324
|
-
|
|
4258
|
+
do {
|
|
4259
|
+
if (isCircularModuleDependency(current)) {
|
|
4260
|
+
var circularResolved = resolveCircularModuleDependency(current); // If the circular function returns itself, that's the signal that we have hit the end
|
|
4261
|
+
// of the proto chain, which must always be a valid base constructor.
|
|
4325
4262
|
|
|
4326
|
-
|
|
4263
|
+
if (circularResolved === current) {
|
|
4264
|
+
return true;
|
|
4265
|
+
}
|
|
4327
4266
|
|
|
4328
|
-
|
|
4329
|
-
|
|
4267
|
+
current = circularResolved;
|
|
4268
|
+
}
|
|
4330
4269
|
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
// being used by a hot component
|
|
4270
|
+
if (current === LightningElement) {
|
|
4271
|
+
return true;
|
|
4272
|
+
}
|
|
4273
|
+
} while (!isNull(current) && (current = getPrototypeOf$1(current))); // Finally return false if the LightningElement is not part of the prototype chain.
|
|
4336
4274
|
|
|
4337
4275
|
|
|
4338
|
-
|
|
4276
|
+
return false;
|
|
4277
|
+
}
|
|
4339
4278
|
|
|
4340
|
-
|
|
4279
|
+
function getComponentInternalDef(Ctor) {
|
|
4280
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4281
|
+
Ctor = getComponentOrSwappedComponent(Ctor);
|
|
4282
|
+
}
|
|
4341
4283
|
|
|
4342
|
-
|
|
4343
|
-
flattenStylesheets(stylesheets).forEach(function (stylesheet) {
|
|
4344
|
-
// this is necessary because we don't hold the list of styles
|
|
4345
|
-
// in the vm, we only hold the selected (already swapped template)
|
|
4346
|
-
// but the styles attached to the template might not be the actual
|
|
4347
|
-
// active ones, but the swapped versions of those.
|
|
4348
|
-
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
4349
|
-
var stylesheetVMs = activeStyles.get(stylesheet);
|
|
4284
|
+
var def = CtorToDefMap.get(Ctor);
|
|
4350
4285
|
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4286
|
+
if (isUndefined$1(def)) {
|
|
4287
|
+
if (isCircularModuleDependency(Ctor)) {
|
|
4288
|
+
var resolvedCtor = resolveCircularModuleDependency(Ctor);
|
|
4289
|
+
def = getComponentInternalDef(resolvedCtor); // Cache the unresolved component ctor too. The next time if the same unresolved ctor is used,
|
|
4290
|
+
// look up the definition in cache instead of re-resolving and recreating the def.
|
|
4356
4291
|
|
|
4292
|
+
CtorToDefMap.set(Ctor, def);
|
|
4293
|
+
return def;
|
|
4294
|
+
}
|
|
4357
4295
|
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
}
|
|
4296
|
+
if (!isComponentConstructor(Ctor)) {
|
|
4297
|
+
throw new TypeError("".concat(Ctor, " is not a valid component, or does not extends LightningElement from \"lwc\". You probably forgot to add the extend clause on the class declaration."));
|
|
4361
4298
|
}
|
|
4362
|
-
}
|
|
4363
|
-
}
|
|
4364
4299
|
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
// this method should never leak to prod
|
|
4368
|
-
throw new ReferenceError();
|
|
4300
|
+
def = createComponentDef(Ctor);
|
|
4301
|
+
CtorToDefMap.set(Ctor, def);
|
|
4369
4302
|
}
|
|
4370
4303
|
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
var Ctor = vm.def.ctor;
|
|
4374
|
-
var list = activeComponents.get(Ctor);
|
|
4304
|
+
return def;
|
|
4305
|
+
}
|
|
4375
4306
|
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4307
|
+
var lightingElementDef = {
|
|
4308
|
+
ctor: LightningElement,
|
|
4309
|
+
name: LightningElement.name,
|
|
4310
|
+
props: lightningBasedDescriptors,
|
|
4311
|
+
propsConfig: EmptyObject,
|
|
4312
|
+
methods: EmptyObject,
|
|
4313
|
+
renderMode: 1
|
|
4314
|
+
/* Shadow */
|
|
4315
|
+
,
|
|
4316
|
+
shadowSupportMode: "reset"
|
|
4317
|
+
/* Default */
|
|
4318
|
+
,
|
|
4319
|
+
wire: EmptyObject,
|
|
4320
|
+
bridge: BaseBridgeElement,
|
|
4321
|
+
template: defaultEmptyTemplate,
|
|
4322
|
+
render: LightningElement.prototype.render
|
|
4323
|
+
};
|
|
4324
|
+
/**
|
|
4325
|
+
* EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
|
|
4326
|
+
* subject to change or being removed.
|
|
4327
|
+
*/
|
|
4380
4328
|
|
|
4329
|
+
function getComponentDef(Ctor) {
|
|
4330
|
+
var def = getComponentInternalDef(Ctor); // From the internal def object, we need to extract the info that is useful
|
|
4331
|
+
// for some external services, e.g.: Locker Service, usually, all they care
|
|
4332
|
+
// is about the shape of the constructor, the internals of it are not relevant
|
|
4333
|
+
// because they don't have a way to mess with that.
|
|
4381
4334
|
|
|
4382
|
-
|
|
4335
|
+
var ctor = def.ctor,
|
|
4336
|
+
name = def.name,
|
|
4337
|
+
props = def.props,
|
|
4338
|
+
propsConfig = def.propsConfig,
|
|
4339
|
+
methods = def.methods;
|
|
4340
|
+
var publicProps = {};
|
|
4383
4341
|
|
|
4384
|
-
|
|
4385
|
-
|
|
4342
|
+
for (var key in props) {
|
|
4343
|
+
// avoid leaking the reference to the public props descriptors
|
|
4344
|
+
publicProps[key] = {
|
|
4345
|
+
config: propsConfig[key] || 0,
|
|
4346
|
+
type: "any"
|
|
4347
|
+
/* any */
|
|
4348
|
+
,
|
|
4349
|
+
attr: htmlPropertyToAttribute(key)
|
|
4350
|
+
};
|
|
4351
|
+
}
|
|
4386
4352
|
|
|
4387
|
-
|
|
4388
|
-
// deleting the vm from the set to avoid leaking memory
|
|
4389
|
-
list.delete(vm);
|
|
4390
|
-
} // removing active styles associated to template
|
|
4353
|
+
var publicMethods = {};
|
|
4391
4354
|
|
|
4355
|
+
for (var _key2 in methods) {
|
|
4356
|
+
// avoid leaking the reference to the public method descriptors
|
|
4357
|
+
publicMethods[_key2] = methods[_key2].value;
|
|
4358
|
+
}
|
|
4392
4359
|
|
|
4393
|
-
|
|
4360
|
+
return {
|
|
4361
|
+
ctor: ctor,
|
|
4362
|
+
name: name,
|
|
4363
|
+
props: publicProps,
|
|
4364
|
+
methods: publicMethods
|
|
4365
|
+
};
|
|
4366
|
+
}
|
|
4367
|
+
/*
|
|
4368
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4369
|
+
* All rights reserved.
|
|
4370
|
+
* SPDX-License-Identifier: MIT
|
|
4371
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4372
|
+
*/
|
|
4394
4373
|
|
|
4395
|
-
if (!isUndefined$1(styles)) {
|
|
4396
|
-
flattenStylesheets(styles).forEach(function (style) {
|
|
4397
|
-
list = activeStyles.get(style);
|
|
4398
4374
|
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
}
|
|
4403
|
-
});
|
|
4404
|
-
}
|
|
4405
|
-
}
|
|
4406
|
-
}
|
|
4407
|
-
}
|
|
4375
|
+
var xlinkNS = 'http://www.w3.org/1999/xlink';
|
|
4376
|
+
var xmlNS = 'http://www.w3.org/XML/1998/namespace';
|
|
4377
|
+
var ColonCharCode = 58;
|
|
4408
4378
|
|
|
4409
|
-
function
|
|
4410
|
-
|
|
4411
|
-
if (isTemplateRegistered(oldTpl) && isTemplateRegistered(newTpl)) {
|
|
4412
|
-
swappedTemplateMap.set(oldTpl, newTpl);
|
|
4413
|
-
return rehydrateHotTemplate(oldTpl);
|
|
4414
|
-
} else {
|
|
4415
|
-
throw new TypeError("Invalid Template");
|
|
4416
|
-
}
|
|
4417
|
-
}
|
|
4379
|
+
function patchAttributes(oldVnode, vnode) {
|
|
4380
|
+
var attrs = vnode.data.attrs;
|
|
4418
4381
|
|
|
4419
|
-
if (
|
|
4420
|
-
|
|
4382
|
+
if (isUndefined$1(attrs)) {
|
|
4383
|
+
return;
|
|
4421
4384
|
}
|
|
4422
4385
|
|
|
4423
|
-
|
|
4424
|
-
}
|
|
4386
|
+
var oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
|
|
4425
4387
|
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
if (isComponentConstructor(oldComponent) && isComponentConstructor(newComponent)) {
|
|
4429
|
-
swappedComponentMap.set(oldComponent, newComponent);
|
|
4430
|
-
return rehydrateHotComponent(oldComponent);
|
|
4431
|
-
} else {
|
|
4432
|
-
throw new TypeError("Invalid Component");
|
|
4433
|
-
}
|
|
4388
|
+
if (oldAttrs === attrs) {
|
|
4389
|
+
return;
|
|
4434
4390
|
}
|
|
4435
4391
|
|
|
4436
|
-
|
|
4437
|
-
throw new Error('HMR is not enabled');
|
|
4438
|
-
}
|
|
4392
|
+
var elm = vnode.elm;
|
|
4439
4393
|
|
|
4440
|
-
|
|
4441
|
-
|
|
4394
|
+
for (var key in attrs) {
|
|
4395
|
+
var cur = attrs[key];
|
|
4396
|
+
var old = oldAttrs[key];
|
|
4442
4397
|
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
// TODO [#1887]: once the support for registering styles is implemented
|
|
4446
|
-
// we can add the validation of both styles around this block.
|
|
4447
|
-
swappedStyleMap.set(oldStyle, newStyle);
|
|
4448
|
-
return rehydrateHotStyle(oldStyle);
|
|
4449
|
-
}
|
|
4398
|
+
if (old !== cur) {
|
|
4399
|
+
unlockAttribute(elm, key);
|
|
4450
4400
|
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4401
|
+
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
4402
|
+
// Assume xml namespace
|
|
4403
|
+
setAttribute$1(elm, key, cur, xmlNS);
|
|
4404
|
+
} else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
4405
|
+
// Assume xlink namespace
|
|
4406
|
+
setAttribute$1(elm, key, cur, xlinkNS);
|
|
4407
|
+
} else if (isNull(cur) || isUndefined$1(cur)) {
|
|
4408
|
+
removeAttribute$1(elm, key);
|
|
4409
|
+
} else {
|
|
4410
|
+
setAttribute$1(elm, key, cur);
|
|
4411
|
+
}
|
|
4454
4412
|
|
|
4455
|
-
|
|
4413
|
+
lockAttribute();
|
|
4414
|
+
}
|
|
4415
|
+
}
|
|
4456
4416
|
}
|
|
4457
4417
|
/*
|
|
4458
4418
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4462,256 +4422,212 @@
|
|
|
4462
4422
|
*/
|
|
4463
4423
|
|
|
4464
4424
|
|
|
4465
|
-
|
|
4425
|
+
function isLiveBindingProp(sel, key) {
|
|
4426
|
+
// For properties with live bindings, we read values from the DOM element
|
|
4427
|
+
// instead of relying on internally tracked values.
|
|
4428
|
+
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
4429
|
+
}
|
|
4466
4430
|
|
|
4467
|
-
function
|
|
4468
|
-
var
|
|
4431
|
+
function patchProps(oldVnode, vnode) {
|
|
4432
|
+
var props = vnode.data.props;
|
|
4469
4433
|
|
|
4470
|
-
if (
|
|
4471
|
-
|
|
4472
|
-
}
|
|
4434
|
+
if (isUndefined$1(props)) {
|
|
4435
|
+
return;
|
|
4436
|
+
}
|
|
4473
4437
|
|
|
4438
|
+
var oldProps = isNull(oldVnode) ? EmptyObject : oldVnode.data.props;
|
|
4474
4439
|
|
|
4475
|
-
if (
|
|
4476
|
-
|
|
4440
|
+
if (oldProps === props) {
|
|
4441
|
+
return;
|
|
4442
|
+
}
|
|
4477
4443
|
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
}
|
|
4482
|
-
} // escape hatch for Locker and other abstractions to provide their own base class instead
|
|
4483
|
-
// of our Base class without having to leak it to user-land. If the circular function returns
|
|
4484
|
-
// itself, that's the signal that we have hit the end of the proto chain, which must always
|
|
4485
|
-
// be base.
|
|
4444
|
+
var isFirstPatch = isNull(oldVnode);
|
|
4445
|
+
var elm = vnode.elm,
|
|
4446
|
+
sel = vnode.sel;
|
|
4486
4447
|
|
|
4448
|
+
for (var key in props) {
|
|
4449
|
+
var cur = props[key]; // Set the property if it's the first time is is patched or if the previous property is
|
|
4450
|
+
// different than the one previously set.
|
|
4487
4451
|
|
|
4488
|
-
|
|
4452
|
+
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty$1(elm, key) : oldProps[key])) {
|
|
4453
|
+
setProperty$1(elm, key, cur);
|
|
4454
|
+
}
|
|
4489
4455
|
}
|
|
4490
|
-
|
|
4491
|
-
return proto;
|
|
4492
4456
|
}
|
|
4457
|
+
/*
|
|
4458
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4459
|
+
* All rights reserved.
|
|
4460
|
+
* SPDX-License-Identifier: MIT
|
|
4461
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4462
|
+
*/
|
|
4493
4463
|
|
|
4494
|
-
function createComponentDef(Ctor) {
|
|
4495
|
-
var ctorShadowSupportMode = Ctor.shadowSupportMode,
|
|
4496
|
-
ctorRenderMode = Ctor.renderMode;
|
|
4497
|
-
|
|
4498
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4499
|
-
var ctorName = Ctor.name; // Removing the following assert until https://bugs.webkit.org/show_bug.cgi?id=190140 is fixed.
|
|
4500
|
-
// assert.isTrue(ctorName && isString(ctorName), `${toString(Ctor)} should have a "name" property with string value, but found ${ctorName}.`);
|
|
4501
4464
|
|
|
4502
|
-
|
|
4465
|
+
var classNameToClassMap = create(null);
|
|
4503
4466
|
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
, "Invalid value for static property shadowSupportMode: '".concat(ctorShadowSupportMode, "'"));
|
|
4510
|
-
}
|
|
4467
|
+
function getMapFromClassName(className) {
|
|
4468
|
+
// Intentionally using == to match undefined and null values from computed style attribute
|
|
4469
|
+
if (className == null) {
|
|
4470
|
+
return EmptyObject;
|
|
4471
|
+
} // computed class names must be string
|
|
4511
4472
|
|
|
4512
|
-
if (!isUndefined$1(ctorRenderMode)) {
|
|
4513
|
-
assert.invariant(ctorRenderMode === 'light' || ctorRenderMode === 'shadow', "Invalid value for static property renderMode: '".concat(ctorRenderMode, "'. renderMode must be either 'light' or 'shadow'."));
|
|
4514
|
-
}
|
|
4515
|
-
}
|
|
4516
4473
|
|
|
4517
|
-
|
|
4518
|
-
var
|
|
4519
|
-
apiFieldsConfig = decoratorsMeta.apiFieldsConfig,
|
|
4520
|
-
apiMethods = decoratorsMeta.apiMethods,
|
|
4521
|
-
wiredFields = decoratorsMeta.wiredFields,
|
|
4522
|
-
wiredMethods = decoratorsMeta.wiredMethods,
|
|
4523
|
-
observedFields = decoratorsMeta.observedFields;
|
|
4524
|
-
var proto = Ctor.prototype;
|
|
4525
|
-
var connectedCallback = proto.connectedCallback,
|
|
4526
|
-
disconnectedCallback = proto.disconnectedCallback,
|
|
4527
|
-
renderedCallback = proto.renderedCallback,
|
|
4528
|
-
errorCallback = proto.errorCallback,
|
|
4529
|
-
render = proto.render;
|
|
4530
|
-
var superProto = getCtorProto(Ctor);
|
|
4531
|
-
var superDef = superProto !== LightningElement ? getComponentInternalDef(superProto) : lightingElementDef;
|
|
4532
|
-
var bridge = HTMLBridgeElementFactory(superDef.bridge, keys(apiFields), keys(apiMethods));
|
|
4533
|
-
var props = assign(create(null), superDef.props, apiFields);
|
|
4534
|
-
var propsConfig = assign(create(null), superDef.propsConfig, apiFieldsConfig);
|
|
4535
|
-
var methods = assign(create(null), superDef.methods, apiMethods);
|
|
4536
|
-
var wire = assign(create(null), superDef.wire, wiredFields, wiredMethods);
|
|
4537
|
-
connectedCallback = connectedCallback || superDef.connectedCallback;
|
|
4538
|
-
disconnectedCallback = disconnectedCallback || superDef.disconnectedCallback;
|
|
4539
|
-
renderedCallback = renderedCallback || superDef.renderedCallback;
|
|
4540
|
-
errorCallback = errorCallback || superDef.errorCallback;
|
|
4541
|
-
render = render || superDef.render;
|
|
4542
|
-
var shadowSupportMode = superDef.shadowSupportMode;
|
|
4474
|
+
className = isString(className) ? className : className + '';
|
|
4475
|
+
var map = classNameToClassMap[className];
|
|
4543
4476
|
|
|
4544
|
-
if (
|
|
4545
|
-
|
|
4477
|
+
if (map) {
|
|
4478
|
+
return map;
|
|
4546
4479
|
}
|
|
4547
4480
|
|
|
4548
|
-
|
|
4481
|
+
map = create(null);
|
|
4482
|
+
var start = 0;
|
|
4483
|
+
var o;
|
|
4484
|
+
var len = className.length;
|
|
4549
4485
|
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4486
|
+
for (o = 0; o < len; o++) {
|
|
4487
|
+
if (StringCharCodeAt.call(className, o) === SPACE_CHAR) {
|
|
4488
|
+
if (o > start) {
|
|
4489
|
+
map[StringSlice.call(className, start, o)] = true;
|
|
4490
|
+
}
|
|
4491
|
+
|
|
4492
|
+
start = o + 1;
|
|
4493
|
+
}
|
|
4556
4494
|
}
|
|
4557
4495
|
|
|
4558
|
-
|
|
4559
|
-
|
|
4496
|
+
if (o > start) {
|
|
4497
|
+
map[StringSlice.call(className, start, o)] = true;
|
|
4498
|
+
}
|
|
4560
4499
|
|
|
4561
|
-
|
|
4562
|
-
var def = {
|
|
4563
|
-
ctor: Ctor,
|
|
4564
|
-
name: name,
|
|
4565
|
-
wire: wire,
|
|
4566
|
-
props: props,
|
|
4567
|
-
propsConfig: propsConfig,
|
|
4568
|
-
methods: methods,
|
|
4569
|
-
bridge: bridge,
|
|
4570
|
-
template: template,
|
|
4571
|
-
renderMode: renderMode,
|
|
4572
|
-
shadowSupportMode: shadowSupportMode,
|
|
4573
|
-
connectedCallback: connectedCallback,
|
|
4574
|
-
disconnectedCallback: disconnectedCallback,
|
|
4575
|
-
renderedCallback: renderedCallback,
|
|
4576
|
-
errorCallback: errorCallback,
|
|
4577
|
-
render: render
|
|
4578
|
-
};
|
|
4500
|
+
classNameToClassMap[className] = map;
|
|
4579
4501
|
|
|
4580
4502
|
if (process.env.NODE_ENV !== 'production') {
|
|
4581
|
-
|
|
4503
|
+
// just to make sure that this object never changes as part of the diffing algo
|
|
4504
|
+
freeze(map);
|
|
4582
4505
|
}
|
|
4583
4506
|
|
|
4584
|
-
return
|
|
4507
|
+
return map;
|
|
4585
4508
|
}
|
|
4586
|
-
/**
|
|
4587
|
-
* EXPERIMENTAL: This function allows for the identification of LWC constructors. This API is
|
|
4588
|
-
* subject to change or being removed.
|
|
4589
|
-
*/
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
function isComponentConstructor(ctor) {
|
|
4593
|
-
if (!isFunction$1(ctor)) {
|
|
4594
|
-
return false;
|
|
4595
|
-
} // Fast path: LightningElement is part of the prototype chain of the constructor.
|
|
4596
4509
|
|
|
4510
|
+
function patchClassAttribute(oldVnode, vnode) {
|
|
4511
|
+
var elm = vnode.elm,
|
|
4512
|
+
newClass = vnode.data.className;
|
|
4513
|
+
var oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
4597
4514
|
|
|
4598
|
-
if (
|
|
4599
|
-
return
|
|
4600
|
-
}
|
|
4601
|
-
// climb up the constructor prototype chain to check in case there are circular dependencies
|
|
4602
|
-
// to resolve.
|
|
4603
|
-
|
|
4515
|
+
if (oldClass === newClass) {
|
|
4516
|
+
return;
|
|
4517
|
+
}
|
|
4604
4518
|
|
|
4605
|
-
var
|
|
4519
|
+
var classList = getClassList$1(elm);
|
|
4520
|
+
var newClassMap = getMapFromClassName(newClass);
|
|
4521
|
+
var oldClassMap = getMapFromClassName(oldClass);
|
|
4522
|
+
var name;
|
|
4606
4523
|
|
|
4607
|
-
|
|
4608
|
-
if
|
|
4609
|
-
|
|
4610
|
-
|
|
4524
|
+
for (name in oldClassMap) {
|
|
4525
|
+
// remove only if it is not in the new class collection and it is not set from within the instance
|
|
4526
|
+
if (isUndefined$1(newClassMap[name])) {
|
|
4527
|
+
classList.remove(name);
|
|
4528
|
+
}
|
|
4529
|
+
}
|
|
4611
4530
|
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4531
|
+
for (name in newClassMap) {
|
|
4532
|
+
if (isUndefined$1(oldClassMap[name])) {
|
|
4533
|
+
classList.add(name);
|
|
4534
|
+
}
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
/*
|
|
4538
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4539
|
+
* All rights reserved.
|
|
4540
|
+
* SPDX-License-Identifier: MIT
|
|
4541
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4542
|
+
*/
|
|
4615
4543
|
|
|
4616
|
-
current = circularResolved;
|
|
4617
|
-
}
|
|
4618
4544
|
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4545
|
+
function patchStyleAttribute(oldVnode, vnode) {
|
|
4546
|
+
var elm = vnode.elm,
|
|
4547
|
+
newStyle = vnode.data.style;
|
|
4548
|
+
var oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
4623
4549
|
|
|
4550
|
+
if (oldStyle === newStyle) {
|
|
4551
|
+
return;
|
|
4552
|
+
}
|
|
4624
4553
|
|
|
4625
|
-
|
|
4554
|
+
if (!isString(newStyle) || newStyle === '') {
|
|
4555
|
+
removeAttribute$1(elm, 'style');
|
|
4556
|
+
} else {
|
|
4557
|
+
setAttribute$1(elm, 'style', newStyle);
|
|
4558
|
+
}
|
|
4626
4559
|
}
|
|
4560
|
+
/*
|
|
4561
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4562
|
+
* All rights reserved.
|
|
4563
|
+
* SPDX-License-Identifier: MIT
|
|
4564
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4565
|
+
*/
|
|
4627
4566
|
|
|
4628
|
-
function getComponentInternalDef(Ctor) {
|
|
4629
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
4630
|
-
Ctor = getComponentOrSwappedComponent(Ctor);
|
|
4631
|
-
}
|
|
4632
4567
|
|
|
4633
|
-
|
|
4568
|
+
function applyEventListeners(vnode) {
|
|
4569
|
+
var elm = vnode.elm,
|
|
4570
|
+
on = vnode.data.on;
|
|
4634
4571
|
|
|
4635
|
-
if (isUndefined$1(
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
def = getComponentInternalDef(resolvedCtor); // Cache the unresolved component ctor too. The next time if the same unresolved ctor is used,
|
|
4639
|
-
// look up the definition in cache instead of re-resolving and recreating the def.
|
|
4572
|
+
if (isUndefined$1(on)) {
|
|
4573
|
+
return;
|
|
4574
|
+
}
|
|
4640
4575
|
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4576
|
+
for (var name in on) {
|
|
4577
|
+
var handler = on[name];
|
|
4578
|
+
addEventListener$1(elm, name, handler);
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
/*
|
|
4582
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4583
|
+
* All rights reserved.
|
|
4584
|
+
* SPDX-License-Identifier: MIT
|
|
4585
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4586
|
+
*/
|
|
4587
|
+
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
4588
|
+
// different classnames properties individually instead of via a string.
|
|
4644
4589
|
|
|
4645
|
-
if (!isComponentConstructor(Ctor)) {
|
|
4646
|
-
throw new TypeError("".concat(Ctor, " is not a valid component, or does not extends LightningElement from \"lwc\". You probably forgot to add the extend clause on the class declaration."));
|
|
4647
|
-
}
|
|
4648
4590
|
|
|
4649
|
-
|
|
4650
|
-
|
|
4591
|
+
function applyStaticClassAttribute(vnode) {
|
|
4592
|
+
var elm = vnode.elm,
|
|
4593
|
+
classMap = vnode.data.classMap;
|
|
4594
|
+
|
|
4595
|
+
if (isUndefined$1(classMap)) {
|
|
4596
|
+
return;
|
|
4651
4597
|
}
|
|
4652
4598
|
|
|
4653
|
-
|
|
4654
|
-
}
|
|
4599
|
+
var classList = getClassList$1(elm);
|
|
4655
4600
|
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
shadowSupportMode: "reset"
|
|
4666
|
-
/* Default */
|
|
4667
|
-
,
|
|
4668
|
-
wire: EmptyObject,
|
|
4669
|
-
bridge: BaseBridgeElement,
|
|
4670
|
-
template: defaultEmptyTemplate,
|
|
4671
|
-
render: LightningElement.prototype.render
|
|
4672
|
-
};
|
|
4673
|
-
/**
|
|
4674
|
-
* EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
|
|
4675
|
-
* subject to change or being removed.
|
|
4601
|
+
for (var name in classMap) {
|
|
4602
|
+
classList.add(name);
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
/*
|
|
4606
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
4607
|
+
* All rights reserved.
|
|
4608
|
+
* SPDX-License-Identifier: MIT
|
|
4609
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
4676
4610
|
*/
|
|
4611
|
+
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
4612
|
+
// different style properties individually instead of via a string.
|
|
4677
4613
|
|
|
4678
|
-
function getComponentDef(Ctor) {
|
|
4679
|
-
var def = getComponentInternalDef(Ctor); // From the internal def object, we need to extract the info that is useful
|
|
4680
|
-
// for some external services, e.g.: Locker Service, usually, all they care
|
|
4681
|
-
// is about the shape of the constructor, the internals of it are not relevant
|
|
4682
|
-
// because they don't have a way to mess with that.
|
|
4683
4614
|
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
propsConfig = def.propsConfig,
|
|
4688
|
-
methods = def.methods;
|
|
4689
|
-
var publicProps = {};
|
|
4615
|
+
function applyStaticStyleAttribute(vnode) {
|
|
4616
|
+
var elm = vnode.elm,
|
|
4617
|
+
styleDecls = vnode.data.styleDecls;
|
|
4690
4618
|
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
publicProps[key] = {
|
|
4694
|
-
config: propsConfig[key] || 0,
|
|
4695
|
-
type: "any"
|
|
4696
|
-
/* any */
|
|
4697
|
-
,
|
|
4698
|
-
attr: htmlPropertyToAttribute(key)
|
|
4699
|
-
};
|
|
4619
|
+
if (isUndefined$1(styleDecls)) {
|
|
4620
|
+
return;
|
|
4700
4621
|
}
|
|
4701
4622
|
|
|
4702
|
-
var
|
|
4623
|
+
for (var _i13 = 0; _i13 < styleDecls.length; _i13++) {
|
|
4624
|
+
var _styleDecls$_i = _slicedToArray(styleDecls[_i13], 3),
|
|
4625
|
+
prop = _styleDecls$_i[0],
|
|
4626
|
+
value = _styleDecls$_i[1],
|
|
4627
|
+
important = _styleDecls$_i[2];
|
|
4703
4628
|
|
|
4704
|
-
|
|
4705
|
-
// avoid leaking the reference to the public method descriptors
|
|
4706
|
-
publicMethods[_key2] = methods[_key2].value;
|
|
4629
|
+
setCSSStyleProperty$1(elm, prop, value, important);
|
|
4707
4630
|
}
|
|
4708
|
-
|
|
4709
|
-
return {
|
|
4710
|
-
ctor: ctor,
|
|
4711
|
-
name: name,
|
|
4712
|
-
props: publicProps,
|
|
4713
|
-
methods: publicMethods
|
|
4714
|
-
};
|
|
4715
4631
|
}
|
|
4716
4632
|
/*
|
|
4717
4633
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4781,28 +4697,24 @@
|
|
|
4781
4697
|
}
|
|
4782
4698
|
}
|
|
4783
4699
|
|
|
4784
|
-
function
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4700
|
+
function patchElementPropsAndAttrs(oldVnode, vnode) {
|
|
4701
|
+
if (isNull(oldVnode)) {
|
|
4702
|
+
applyEventListeners(vnode);
|
|
4703
|
+
applyStaticClassAttribute(vnode);
|
|
4704
|
+
applyStaticStyleAttribute(vnode);
|
|
4705
|
+
} // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
4706
|
+
// value is set before type=radio.
|
|
4788
4707
|
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
modComputedStyle.create(vnode);
|
|
4708
|
+
|
|
4709
|
+
patchClassAttribute(oldVnode, vnode);
|
|
4710
|
+
patchStyleAttribute(oldVnode, vnode);
|
|
4711
|
+
patchAttributes(oldVnode, vnode);
|
|
4712
|
+
patchProps(oldVnode, vnode);
|
|
4795
4713
|
}
|
|
4796
4714
|
|
|
4797
4715
|
function hydrateElmHook(vnode) {
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
modProps.create(vnode); // Already set.
|
|
4802
|
-
// modStaticClassName.create(vnode);
|
|
4803
|
-
// modStaticStyle.create(vnode);
|
|
4804
|
-
// modComputedClassName.create(vnode);
|
|
4805
|
-
// modComputedStyle.create(vnode);
|
|
4716
|
+
applyEventListeners(vnode);
|
|
4717
|
+
patchProps(null, vnode);
|
|
4806
4718
|
}
|
|
4807
4719
|
|
|
4808
4720
|
function fallbackElmHook(elm, vnode) {
|
|
@@ -4842,24 +4754,11 @@
|
|
|
4842
4754
|
}
|
|
4843
4755
|
}
|
|
4844
4756
|
|
|
4845
|
-
function
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
// is set before type=radio.
|
|
4849
|
-
modAttrs.update(oldVnode, vnode);
|
|
4850
|
-
modProps.update(oldVnode, vnode);
|
|
4851
|
-
modComputedClassName.update(oldVnode, vnode);
|
|
4852
|
-
modComputedStyle.update(oldVnode, vnode);
|
|
4853
|
-
}
|
|
4854
|
-
|
|
4855
|
-
function updateChildrenHook(oldVnode, vnode) {
|
|
4856
|
-
var elm = vnode.elm,
|
|
4857
|
-
children = vnode.children;
|
|
4858
|
-
|
|
4859
|
-
if (hasDynamicChildren(children)) {
|
|
4860
|
-
updateDynamicChildren(elm, oldVnode.children, children);
|
|
4757
|
+
function patchChildren(parent, oldCh, newCh) {
|
|
4758
|
+
if (hasDynamicChildren(newCh)) {
|
|
4759
|
+
updateDynamicChildren(parent, oldCh, newCh);
|
|
4861
4760
|
} else {
|
|
4862
|
-
updateStaticChildren(
|
|
4761
|
+
updateStaticChildren(parent, oldCh, newCh);
|
|
4863
4762
|
}
|
|
4864
4763
|
}
|
|
4865
4764
|
|
|
@@ -4928,19 +4827,6 @@
|
|
|
4928
4827
|
}
|
|
4929
4828
|
}
|
|
4930
4829
|
|
|
4931
|
-
function createCustomElmHook(vnode) {
|
|
4932
|
-
modEvents.create(vnode); // Attrs need to be applied to element before props
|
|
4933
|
-
// IE11 will wipe out value on radio inputs if value
|
|
4934
|
-
// is set before type=radio.
|
|
4935
|
-
|
|
4936
|
-
modAttrs.create(vnode);
|
|
4937
|
-
modProps.create(vnode);
|
|
4938
|
-
modStaticClassName.create(vnode);
|
|
4939
|
-
modStaticStyle.create(vnode);
|
|
4940
|
-
modComputedClassName.create(vnode);
|
|
4941
|
-
modComputedStyle.create(vnode);
|
|
4942
|
-
}
|
|
4943
|
-
|
|
4944
4830
|
function createChildrenHook(vnode) {
|
|
4945
4831
|
var elm = vnode.elm,
|
|
4946
4832
|
children = vnode.children;
|
|
@@ -5120,16 +5006,6 @@
|
|
|
5120
5006
|
}
|
|
5121
5007
|
}
|
|
5122
5008
|
|
|
5123
|
-
function updateCustomElmHook(oldVnode, vnode) {
|
|
5124
|
-
// Attrs need to be applied to element before props
|
|
5125
|
-
// IE11 will wipe out value on radio inputs if value
|
|
5126
|
-
// is set before type=radio.
|
|
5127
|
-
modAttrs.update(oldVnode, vnode);
|
|
5128
|
-
modProps.update(oldVnode, vnode);
|
|
5129
|
-
modComputedClassName.update(oldVnode, vnode);
|
|
5130
|
-
modComputedStyle.update(oldVnode, vnode);
|
|
5131
|
-
}
|
|
5132
|
-
|
|
5133
5009
|
function removeElmHook(vnode) {
|
|
5134
5010
|
// this method only needs to search on child vnodes from template
|
|
5135
5011
|
// to trigger the remove hook just in case some of those children
|
|
@@ -5144,6 +5020,62 @@
|
|
|
5144
5020
|
ch.hook.remove(ch, elm);
|
|
5145
5021
|
}
|
|
5146
5022
|
}
|
|
5023
|
+
}
|
|
5024
|
+
|
|
5025
|
+
function allocateInSlot(vm, children) {
|
|
5026
|
+
var oldSlots = vm.cmpSlots;
|
|
5027
|
+
var cmpSlots = vm.cmpSlots = create(null);
|
|
5028
|
+
|
|
5029
|
+
for (var _i16 = 0, _len6 = children.length; _i16 < _len6; _i16 += 1) {
|
|
5030
|
+
var vnode = children[_i16];
|
|
5031
|
+
|
|
5032
|
+
if (isNull(vnode)) {
|
|
5033
|
+
continue;
|
|
5034
|
+
}
|
|
5035
|
+
|
|
5036
|
+
var data = vnode.data;
|
|
5037
|
+
var slotName = data.attrs && data.attrs.slot || '';
|
|
5038
|
+
var vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot
|
|
5039
|
+
// which might have similar keys. Each vnode will always have a key that
|
|
5040
|
+
// starts with a numeric character from compiler. In this case, we add a unique
|
|
5041
|
+
// notation for slotted vnodes keys, e.g.: `@foo:1:1`
|
|
5042
|
+
|
|
5043
|
+
if (!isUndefined$1(vnode.key)) {
|
|
5044
|
+
vnode.key = "@".concat(slotName, ":").concat(vnode.key);
|
|
5045
|
+
}
|
|
5046
|
+
|
|
5047
|
+
ArrayPush$1.call(vnodes, vnode);
|
|
5048
|
+
}
|
|
5049
|
+
|
|
5050
|
+
if (isFalse(vm.isDirty)) {
|
|
5051
|
+
// We need to determine if the old allocation is really different from the new one
|
|
5052
|
+
// and mark the vm as dirty
|
|
5053
|
+
var oldKeys = keys(oldSlots);
|
|
5054
|
+
|
|
5055
|
+
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
5056
|
+
markComponentAsDirty(vm);
|
|
5057
|
+
return;
|
|
5058
|
+
}
|
|
5059
|
+
|
|
5060
|
+
for (var _i17 = 0, _len7 = oldKeys.length; _i17 < _len7; _i17 += 1) {
|
|
5061
|
+
var key = oldKeys[_i17];
|
|
5062
|
+
|
|
5063
|
+
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
5064
|
+
markComponentAsDirty(vm);
|
|
5065
|
+
return;
|
|
5066
|
+
}
|
|
5067
|
+
|
|
5068
|
+
var oldVNodes = oldSlots[key];
|
|
5069
|
+
var _vnodes = cmpSlots[key];
|
|
5070
|
+
|
|
5071
|
+
for (var j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
5072
|
+
if (oldVNodes[j] !== _vnodes[j]) {
|
|
5073
|
+
markComponentAsDirty(vm);
|
|
5074
|
+
return;
|
|
5075
|
+
}
|
|
5076
|
+
}
|
|
5077
|
+
}
|
|
5078
|
+
}
|
|
5147
5079
|
} // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
5148
5080
|
|
|
5149
5081
|
|
|
@@ -5294,11 +5226,11 @@
|
|
|
5294
5226
|
linkNodeToShadow(elm, owner);
|
|
5295
5227
|
fallbackElmHook(elm, vnode);
|
|
5296
5228
|
vnode.elm = elm;
|
|
5297
|
-
|
|
5229
|
+
patchElementPropsAndAttrs(null, vnode);
|
|
5298
5230
|
},
|
|
5299
5231
|
update: function update(oldVnode, vnode) {
|
|
5300
|
-
|
|
5301
|
-
|
|
5232
|
+
patchElementPropsAndAttrs(oldVnode, vnode);
|
|
5233
|
+
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
5302
5234
|
},
|
|
5303
5235
|
insert: function insert(vnode, parentNode, referenceNode) {
|
|
5304
5236
|
insertNodeHook(vnode, parentNode, referenceNode);
|
|
@@ -5366,10 +5298,10 @@
|
|
|
5366
5298
|
throw new TypeError("Incorrect Component Constructor");
|
|
5367
5299
|
}
|
|
5368
5300
|
|
|
5369
|
-
|
|
5301
|
+
patchElementPropsAndAttrs(null, vnode);
|
|
5370
5302
|
},
|
|
5371
5303
|
update: function update(oldVnode, vnode) {
|
|
5372
|
-
|
|
5304
|
+
patchElementPropsAndAttrs(oldVnode, vnode);
|
|
5373
5305
|
var vm = getAssociatedVMIfPresent(vnode.elm);
|
|
5374
5306
|
|
|
5375
5307
|
if (vm) {
|
|
@@ -5380,7 +5312,7 @@
|
|
|
5380
5312
|
// will happen, but in native, it does allocate the light dom
|
|
5381
5313
|
|
|
5382
5314
|
|
|
5383
|
-
|
|
5315
|
+
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
5384
5316
|
|
|
5385
5317
|
if (vm) {
|
|
5386
5318
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -6042,8 +5974,8 @@
|
|
|
6042
5974
|
var content = [];
|
|
6043
5975
|
var root;
|
|
6044
5976
|
|
|
6045
|
-
for (var
|
|
6046
|
-
var stylesheet = stylesheets[
|
|
5977
|
+
for (var _i18 = 0; _i18 < stylesheets.length; _i18++) {
|
|
5978
|
+
var stylesheet = stylesheets[_i18];
|
|
6047
5979
|
|
|
6048
5980
|
if (isArray$1(stylesheet)) {
|
|
6049
5981
|
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
@@ -6153,8 +6085,8 @@
|
|
|
6153
6085
|
&& shadowMode === 1
|
|
6154
6086
|
/* Synthetic */
|
|
6155
6087
|
) {
|
|
6156
|
-
for (var
|
|
6157
|
-
insertGlobalStylesheet$1(stylesheets[
|
|
6088
|
+
for (var _i19 = 0; _i19 < stylesheets.length; _i19++) {
|
|
6089
|
+
insertGlobalStylesheet$1(stylesheets[_i19]);
|
|
6158
6090
|
}
|
|
6159
6091
|
} else if (ssr$1 || isHydrating$1()) {
|
|
6160
6092
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
@@ -6168,12 +6100,12 @@
|
|
|
6168
6100
|
var root = getNearestNativeShadowComponent(vm);
|
|
6169
6101
|
var isGlobal = isNull(root);
|
|
6170
6102
|
|
|
6171
|
-
for (var
|
|
6103
|
+
for (var _i20 = 0; _i20 < stylesheets.length; _i20++) {
|
|
6172
6104
|
if (isGlobal) {
|
|
6173
|
-
insertGlobalStylesheet$1(stylesheets[
|
|
6105
|
+
insertGlobalStylesheet$1(stylesheets[_i20]);
|
|
6174
6106
|
} else {
|
|
6175
6107
|
// local level
|
|
6176
|
-
insertStylesheet$1(stylesheets[
|
|
6108
|
+
insertStylesheet$1(stylesheets[_i20], root.cmpRoot);
|
|
6177
6109
|
}
|
|
6178
6110
|
}
|
|
6179
6111
|
}
|
|
@@ -6450,8 +6382,8 @@
|
|
|
6450
6382
|
var stylesheets = template.stylesheets;
|
|
6451
6383
|
|
|
6452
6384
|
if (!isUndefined$1(stylesheets)) {
|
|
6453
|
-
for (var
|
|
6454
|
-
if (isTrue(stylesheets[
|
|
6385
|
+
for (var _i21 = 0; _i21 < stylesheets.length; _i21++) {
|
|
6386
|
+
if (isTrue(stylesheets[_i21][KEY__SCOPED_CSS])) {
|
|
6455
6387
|
return true;
|
|
6456
6388
|
}
|
|
6457
6389
|
}
|
|
@@ -6681,8 +6613,8 @@
|
|
|
6681
6613
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
6682
6614
|
}
|
|
6683
6615
|
|
|
6684
|
-
for (var
|
|
6685
|
-
var hookName = hooks[
|
|
6616
|
+
for (var _i22 = 0; _i22 < hooks.length; ++_i22) {
|
|
6617
|
+
var hookName = hooks[_i22];
|
|
6686
6618
|
|
|
6687
6619
|
if (hookName in service) {
|
|
6688
6620
|
var l = Services[hookName];
|
|
@@ -6705,8 +6637,8 @@
|
|
|
6705
6637
|
def = vm.def,
|
|
6706
6638
|
context = vm.context;
|
|
6707
6639
|
|
|
6708
|
-
for (var
|
|
6709
|
-
cbs[
|
|
6640
|
+
for (var _i23 = 0, _len8 = cbs.length; _i23 < _len8; ++_i23) {
|
|
6641
|
+
cbs[_i23].call(undefined, component, {}, def, context);
|
|
6710
6642
|
}
|
|
6711
6643
|
}
|
|
6712
6644
|
/*
|
|
@@ -7019,7 +6951,6 @@
|
|
|
7019
6951
|
// patch function mutates vnodes by adding the element reference,
|
|
7020
6952
|
// however, if patching fails it contains partial changes.
|
|
7021
6953
|
if (oldCh !== newCh) {
|
|
7022
|
-
var fn = hasDynamicChildren(newCh) ? updateDynamicChildren : updateStaticChildren;
|
|
7023
6954
|
runWithBoundaryProtection(vm, vm, function () {
|
|
7024
6955
|
// pre
|
|
7025
6956
|
logOperationStart(2
|
|
@@ -7027,8 +6958,8 @@
|
|
|
7027
6958
|
, vm);
|
|
7028
6959
|
}, function () {
|
|
7029
6960
|
// job
|
|
7030
|
-
var
|
|
7031
|
-
|
|
6961
|
+
var renderRoot = getRenderRoot(vm);
|
|
6962
|
+
patchChildren(renderRoot, oldCh, newCh);
|
|
7032
6963
|
}, function () {
|
|
7033
6964
|
// post
|
|
7034
6965
|
logOperationEnd(2
|
|
@@ -7089,19 +7020,19 @@
|
|
|
7089
7020
|
});
|
|
7090
7021
|
rehydrateQueue = []; // reset to a new queue
|
|
7091
7022
|
|
|
7092
|
-
for (var
|
|
7093
|
-
var vm = vms[
|
|
7023
|
+
for (var _i24 = 0, _len9 = vms.length; _i24 < _len9; _i24 += 1) {
|
|
7024
|
+
var vm = vms[_i24];
|
|
7094
7025
|
|
|
7095
7026
|
try {
|
|
7096
7027
|
rehydrate(vm);
|
|
7097
7028
|
} catch (error) {
|
|
7098
|
-
if (
|
|
7029
|
+
if (_i24 + 1 < _len9) {
|
|
7099
7030
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
7100
7031
|
if (rehydrateQueue.length === 0) {
|
|
7101
7032
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
7102
7033
|
}
|
|
7103
7034
|
|
|
7104
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
7035
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i24 + 1));
|
|
7105
7036
|
} // we need to end the measure before throwing.
|
|
7106
7037
|
|
|
7107
7038
|
|
|
@@ -7205,8 +7136,8 @@
|
|
|
7205
7136
|
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
7206
7137
|
// inserted in reserved order.
|
|
7207
7138
|
|
|
7208
|
-
for (var
|
|
7209
|
-
var elm = vCustomElementCollection[
|
|
7139
|
+
for (var _i25 = vCustomElementCollection.length - 1; _i25 >= 0; _i25 -= 1) {
|
|
7140
|
+
var elm = vCustomElementCollection[_i25].elm; // There are two cases where the element could be undefined:
|
|
7210
7141
|
// * when there is an error during the construction phase, and an error
|
|
7211
7142
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
7212
7143
|
// is not properly initialized, and therefore is should be ignored.
|
|
@@ -7240,8 +7171,8 @@
|
|
|
7240
7171
|
|
|
7241
7172
|
|
|
7242
7173
|
function recursivelyDisconnectChildren(vnodes) {
|
|
7243
|
-
for (var
|
|
7244
|
-
var vnode = vnodes[
|
|
7174
|
+
for (var _i26 = 0, _len10 = vnodes.length; _i26 < _len10; _i26 += 1) {
|
|
7175
|
+
var vnode = vnodes[_i26];
|
|
7245
7176
|
|
|
7246
7177
|
if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
|
|
7247
7178
|
// vnode is a VElement with children
|
|
@@ -7264,8 +7195,8 @@
|
|
|
7264
7195
|
var children = vm.children;
|
|
7265
7196
|
var rootNode = getRenderRoot(vm);
|
|
7266
7197
|
|
|
7267
|
-
for (var
|
|
7268
|
-
var child = children[
|
|
7198
|
+
for (var _i27 = 0, _len11 = children.length; _i27 < _len11; _i27++) {
|
|
7199
|
+
var child = children[_i27];
|
|
7269
7200
|
|
|
7270
7201
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
7271
7202
|
remove$1(child.elm, rootNode);
|
|
@@ -7301,65 +7232,6 @@
|
|
|
7301
7232
|
|
|
7302
7233
|
currentVm = currentVm.owner;
|
|
7303
7234
|
}
|
|
7304
|
-
} // slow path routine
|
|
7305
|
-
// NOTE: we should probably more this routine to the synthetic shadow folder
|
|
7306
|
-
// and get the allocation to be cached by in the elm instead of in the VM
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
function allocateInSlot(vm, children) {
|
|
7310
|
-
var oldSlots = vm.cmpSlots;
|
|
7311
|
-
var cmpSlots = vm.cmpSlots = create(null);
|
|
7312
|
-
|
|
7313
|
-
for (var _i26 = 0, _len10 = children.length; _i26 < _len10; _i26 += 1) {
|
|
7314
|
-
var vnode = children[_i26];
|
|
7315
|
-
|
|
7316
|
-
if (isNull(vnode)) {
|
|
7317
|
-
continue;
|
|
7318
|
-
}
|
|
7319
|
-
|
|
7320
|
-
var data = vnode.data;
|
|
7321
|
-
var slotName = data.attrs && data.attrs.slot || '';
|
|
7322
|
-
var vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot
|
|
7323
|
-
// which might have similar keys. Each vnode will always have a key that
|
|
7324
|
-
// starts with a numeric character from compiler. In this case, we add a unique
|
|
7325
|
-
// notation for slotted vnodes keys, e.g.: `@foo:1:1`
|
|
7326
|
-
|
|
7327
|
-
if (!isUndefined$1(vnode.key)) {
|
|
7328
|
-
vnode.key = "@".concat(slotName, ":").concat(vnode.key);
|
|
7329
|
-
}
|
|
7330
|
-
|
|
7331
|
-
ArrayPush$1.call(vnodes, vnode);
|
|
7332
|
-
}
|
|
7333
|
-
|
|
7334
|
-
if (isFalse(vm.isDirty)) {
|
|
7335
|
-
// We need to determine if the old allocation is really different from the new one
|
|
7336
|
-
// and mark the vm as dirty
|
|
7337
|
-
var oldKeys = keys(oldSlots);
|
|
7338
|
-
|
|
7339
|
-
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
7340
|
-
markComponentAsDirty(vm);
|
|
7341
|
-
return;
|
|
7342
|
-
}
|
|
7343
|
-
|
|
7344
|
-
for (var _i27 = 0, _len11 = oldKeys.length; _i27 < _len11; _i27 += 1) {
|
|
7345
|
-
var key = oldKeys[_i27];
|
|
7346
|
-
|
|
7347
|
-
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
7348
|
-
markComponentAsDirty(vm);
|
|
7349
|
-
return;
|
|
7350
|
-
}
|
|
7351
|
-
|
|
7352
|
-
var oldVNodes = oldSlots[key];
|
|
7353
|
-
var _vnodes = cmpSlots[key];
|
|
7354
|
-
|
|
7355
|
-
for (var j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
7356
|
-
if (oldVNodes[j] !== _vnodes[j]) {
|
|
7357
|
-
markComponentAsDirty(vm);
|
|
7358
|
-
return;
|
|
7359
|
-
}
|
|
7360
|
-
}
|
|
7361
|
-
}
|
|
7362
|
-
}
|
|
7363
7235
|
}
|
|
7364
7236
|
|
|
7365
7237
|
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
@@ -7804,7 +7676,7 @@
|
|
|
7804
7676
|
hooksAreSet = true;
|
|
7805
7677
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
7806
7678
|
}
|
|
7807
|
-
/* version: 2.7.
|
|
7679
|
+
/* version: 2.7.3 */
|
|
7808
7680
|
|
|
7809
7681
|
/*
|
|
7810
7682
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8539,7 +8411,7 @@
|
|
|
8539
8411
|
});
|
|
8540
8412
|
freeze(LightningElement);
|
|
8541
8413
|
seal(LightningElement.prototype);
|
|
8542
|
-
/* version: 2.7.
|
|
8414
|
+
/* version: 2.7.3 */
|
|
8543
8415
|
|
|
8544
8416
|
exports.LightningElement = LightningElement;
|
|
8545
8417
|
exports.__unstable__ProfilerControl = profilerControl;
|