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