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
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
302
302
|
return attributeName;
|
|
303
303
|
}
|
|
304
|
-
/** version: 2.7.
|
|
304
|
+
/** version: 2.7.3 */
|
|
305
305
|
|
|
306
306
|
/*
|
|
307
307
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -471,7 +471,7 @@
|
|
|
471
471
|
|
|
472
472
|
function setFeatureFlagForTest(name, value) {
|
|
473
473
|
}
|
|
474
|
-
/** version: 2.7.
|
|
474
|
+
/** version: 2.7.3 */
|
|
475
475
|
|
|
476
476
|
/* proxy-compat-disable */
|
|
477
477
|
|
|
@@ -957,62 +957,205 @@
|
|
|
957
957
|
*/
|
|
958
958
|
|
|
959
959
|
|
|
960
|
-
function
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
960
|
+
function isUndef(s) {
|
|
961
|
+
return s === undefined;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
function sameVnode(vnode1, vnode2) {
|
|
965
|
+
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
function isVNode(vnode) {
|
|
969
|
+
return vnode != null;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
973
|
+
const map = {};
|
|
974
|
+
let j, key, ch; // TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
975
|
+
|
|
976
|
+
for (j = beginIdx; j <= endIdx; ++j) {
|
|
977
|
+
ch = children[j];
|
|
970
978
|
|
|
971
|
-
|
|
972
|
-
|
|
979
|
+
if (isVNode(ch)) {
|
|
980
|
+
key = ch.key;
|
|
981
|
+
|
|
982
|
+
if (key !== undefined) {
|
|
983
|
+
map[key] = j;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
973
986
|
}
|
|
987
|
+
|
|
988
|
+
return map;
|
|
974
989
|
}
|
|
975
990
|
|
|
976
|
-
function
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
991
|
+
function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
|
|
992
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
993
|
+
const ch = vnodes[startIdx];
|
|
994
|
+
|
|
995
|
+
if (isVNode(ch)) {
|
|
996
|
+
ch.hook.create(ch);
|
|
997
|
+
ch.hook.insert(ch, parentElm, before);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
980
1000
|
}
|
|
981
1001
|
|
|
982
|
-
function
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1002
|
+
function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
|
|
1003
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
1004
|
+
const ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
1005
|
+
|
|
1006
|
+
if (isVNode(ch)) {
|
|
1007
|
+
ch.hook.remove(ch, parentElm);
|
|
1008
|
+
}
|
|
988
1009
|
}
|
|
989
1010
|
}
|
|
990
1011
|
|
|
991
|
-
function
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1012
|
+
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
1013
|
+
let oldStartIdx = 0;
|
|
1014
|
+
let newStartIdx = 0;
|
|
1015
|
+
let oldEndIdx = oldCh.length - 1;
|
|
1016
|
+
let oldStartVnode = oldCh[0];
|
|
1017
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
|
1018
|
+
const newChEnd = newCh.length - 1;
|
|
1019
|
+
let newEndIdx = newChEnd;
|
|
1020
|
+
let newStartVnode = newCh[0];
|
|
1021
|
+
let newEndVnode = newCh[newEndIdx];
|
|
1022
|
+
let oldKeyToIdx;
|
|
1023
|
+
let idxInOld;
|
|
1024
|
+
let elmToMove;
|
|
1025
|
+
let before;
|
|
1026
|
+
|
|
1027
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
1028
|
+
if (!isVNode(oldStartVnode)) {
|
|
1029
|
+
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
1030
|
+
} else if (!isVNode(oldEndVnode)) {
|
|
1031
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
1032
|
+
} else if (!isVNode(newStartVnode)) {
|
|
1033
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1034
|
+
} else if (!isVNode(newEndVnode)) {
|
|
1035
|
+
newEndVnode = newCh[--newEndIdx];
|
|
1036
|
+
} else if (sameVnode(oldStartVnode, newStartVnode)) {
|
|
1037
|
+
patchVnode(oldStartVnode, newStartVnode);
|
|
1038
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
1039
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1040
|
+
} else if (sameVnode(oldEndVnode, newEndVnode)) {
|
|
1041
|
+
patchVnode(oldEndVnode, newEndVnode);
|
|
1042
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
1043
|
+
newEndVnode = newCh[--newEndIdx];
|
|
1044
|
+
} else if (sameVnode(oldStartVnode, newEndVnode)) {
|
|
1045
|
+
// Vnode moved right
|
|
1046
|
+
patchVnode(oldStartVnode, newEndVnode);
|
|
1047
|
+
newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
|
|
1048
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
1049
|
+
newEndVnode = newCh[--newEndIdx];
|
|
1050
|
+
} else if (sameVnode(oldEndVnode, newStartVnode)) {
|
|
1051
|
+
// Vnode moved left
|
|
1052
|
+
patchVnode(oldEndVnode, newStartVnode);
|
|
1053
|
+
newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
|
|
1054
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
1055
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1056
|
+
} else {
|
|
1057
|
+
if (oldKeyToIdx === undefined) {
|
|
1058
|
+
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
1062
|
+
|
|
1063
|
+
if (isUndef(idxInOld)) {
|
|
1064
|
+
// New element
|
|
1065
|
+
newStartVnode.hook.create(newStartVnode);
|
|
1066
|
+
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
1067
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1068
|
+
} else {
|
|
1069
|
+
elmToMove = oldCh[idxInOld];
|
|
1070
|
+
|
|
1071
|
+
if (isVNode(elmToMove)) {
|
|
1072
|
+
if (elmToMove.sel !== newStartVnode.sel) {
|
|
1073
|
+
// New element
|
|
1074
|
+
newStartVnode.hook.create(newStartVnode);
|
|
1075
|
+
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
1076
|
+
} else {
|
|
1077
|
+
patchVnode(elmToMove, newStartVnode);
|
|
1078
|
+
oldCh[idxInOld] = undefined;
|
|
1079
|
+
newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
newStartVnode = newCh[++newStartIdx];
|
|
1084
|
+
}
|
|
996
1085
|
}
|
|
997
|
-
}
|
|
1086
|
+
}
|
|
998
1087
|
|
|
999
|
-
if (
|
|
1088
|
+
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
1089
|
+
if (oldStartIdx > oldEndIdx) {
|
|
1090
|
+
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
1091
|
+
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
1092
|
+
let i = newEndIdx;
|
|
1093
|
+
let n;
|
|
1094
|
+
|
|
1095
|
+
do {
|
|
1096
|
+
n = newCh[++i];
|
|
1097
|
+
} while (!isVNode(n) && i < newChEnd);
|
|
1098
|
+
|
|
1099
|
+
before = isVNode(n) ? n.elm : null;
|
|
1100
|
+
addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
|
|
1101
|
+
} else {
|
|
1102
|
+
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
function updateStaticChildren(parentElm, oldCh, newCh) {
|
|
1108
|
+
const oldChLength = oldCh.length;
|
|
1109
|
+
const newChLength = newCh.length;
|
|
1110
|
+
|
|
1111
|
+
if (oldChLength === 0) {
|
|
1112
|
+
// the old list is empty, we can directly insert anything new
|
|
1113
|
+
addVnodes(parentElm, null, newCh, 0, newChLength);
|
|
1000
1114
|
return;
|
|
1001
1115
|
}
|
|
1002
1116
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1117
|
+
if (newChLength === 0) {
|
|
1118
|
+
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
1119
|
+
// this is the case in which the dynamic children of an if-directive should be removed
|
|
1120
|
+
removeVnodes(parentElm, oldCh, 0, oldChLength);
|
|
1121
|
+
return;
|
|
1122
|
+
} // if the old list is not empty, the new list MUST have the same
|
|
1123
|
+
// amount of nodes, that's why we call this static children
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
let referenceElm = null;
|
|
1127
|
+
|
|
1128
|
+
for (let i = newChLength - 1; i >= 0; i -= 1) {
|
|
1129
|
+
const vnode = newCh[i];
|
|
1130
|
+
const oldVNode = oldCh[i];
|
|
1131
|
+
|
|
1132
|
+
if (vnode !== oldVNode) {
|
|
1133
|
+
if (isVNode(oldVNode)) {
|
|
1134
|
+
if (isVNode(vnode)) {
|
|
1135
|
+
// both vnodes must be equivalent, and se just need to patch them
|
|
1136
|
+
patchVnode(oldVNode, vnode);
|
|
1137
|
+
referenceElm = vnode.elm;
|
|
1138
|
+
} else {
|
|
1139
|
+
// removing the old vnode since the new one is null
|
|
1140
|
+
oldVNode.hook.remove(oldVNode, parentElm);
|
|
1141
|
+
}
|
|
1142
|
+
} else if (isVNode(vnode)) {
|
|
1143
|
+
// this condition is unnecessary
|
|
1144
|
+
vnode.hook.create(vnode); // insert the new node one since the old one is null
|
|
1006
1145
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1146
|
+
vnode.hook.insert(vnode, parentElm, referenceElm);
|
|
1147
|
+
referenceElm = vnode.elm;
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1009
1150
|
}
|
|
1010
1151
|
}
|
|
1011
1152
|
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1153
|
+
function patchVnode(oldVnode, vnode) {
|
|
1154
|
+
if (oldVnode !== vnode) {
|
|
1155
|
+
vnode.elm = oldVnode.elm;
|
|
1156
|
+
vnode.hook.update(oldVnode, vnode);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1016
1159
|
/*
|
|
1017
1160
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1018
1161
|
* All rights reserved.
|
|
@@ -1020,6 +1163,7 @@
|
|
|
1020
1163
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1021
1164
|
*/
|
|
1022
1165
|
|
|
1166
|
+
|
|
1023
1167
|
const defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
|
|
1024
1168
|
|
|
1025
1169
|
function offsetPropertyErrorMessage(name) {
|
|
@@ -1137,70 +1281,12 @@
|
|
|
1137
1281
|
* SPDX-License-Identifier: MIT
|
|
1138
1282
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1139
1283
|
*/
|
|
1284
|
+
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
1285
|
+
// to inject at runtime.
|
|
1140
1286
|
|
|
1141
1287
|
|
|
1142
|
-
const
|
|
1143
|
-
const
|
|
1144
|
-
const ColonCharCode = 58;
|
|
1145
|
-
|
|
1146
|
-
function updateAttrs(oldVnode, vnode) {
|
|
1147
|
-
const {
|
|
1148
|
-
data: {
|
|
1149
|
-
attrs
|
|
1150
|
-
}
|
|
1151
|
-
} = vnode;
|
|
1152
|
-
|
|
1153
|
-
if (isUndefined$1(attrs)) {
|
|
1154
|
-
return;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
let {
|
|
1158
|
-
data: {
|
|
1159
|
-
attrs: oldAttrs
|
|
1160
|
-
}
|
|
1161
|
-
} = oldVnode;
|
|
1162
|
-
|
|
1163
|
-
if (oldAttrs === attrs) {
|
|
1164
|
-
return;
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
const elm = vnode.elm;
|
|
1168
|
-
let key;
|
|
1169
|
-
oldAttrs = isUndefined$1(oldAttrs) ? EmptyObject : oldAttrs; // update modified attributes, add new attributes
|
|
1170
|
-
// this routine is only useful for data-* attributes in all kind of elements
|
|
1171
|
-
// and aria-* in standard elements (custom elements will use props for these)
|
|
1172
|
-
|
|
1173
|
-
for (key in attrs) {
|
|
1174
|
-
const cur = attrs[key];
|
|
1175
|
-
const old = oldAttrs[key];
|
|
1176
|
-
|
|
1177
|
-
if (old !== cur) {
|
|
1178
|
-
unlockAttribute(elm, key);
|
|
1179
|
-
|
|
1180
|
-
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
1181
|
-
// Assume xml namespace
|
|
1182
|
-
setAttribute$1(elm, key, cur, xmlNS);
|
|
1183
|
-
} else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
1184
|
-
// Assume xlink namespace
|
|
1185
|
-
setAttribute$1(elm, key, cur, xlinkNS);
|
|
1186
|
-
} else if (isNull(cur) || isUndefined$1(cur)) {
|
|
1187
|
-
removeAttribute$1(elm, key);
|
|
1188
|
-
} else {
|
|
1189
|
-
setAttribute$1(elm, key, cur);
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
lockAttribute();
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
const emptyVNode$3 = {
|
|
1198
|
-
data: {}
|
|
1199
|
-
};
|
|
1200
|
-
var modAttrs = {
|
|
1201
|
-
create: vnode => updateAttrs(emptyVNode$3, vnode),
|
|
1202
|
-
update: updateAttrs
|
|
1203
|
-
};
|
|
1288
|
+
const HTMLElementConstructor$1 = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
|
|
1289
|
+
const HTMLElementPrototype = HTMLElementConstructor$1.prototype;
|
|
1204
1290
|
/*
|
|
1205
1291
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1206
1292
|
* All rights reserved.
|
|
@@ -1208,723 +1294,469 @@
|
|
|
1208
1294
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1209
1295
|
*/
|
|
1210
1296
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
function update(oldVnode, vnode) {
|
|
1218
|
-
const props = vnode.data.props;
|
|
1219
|
-
|
|
1220
|
-
if (isUndefined$1(props)) {
|
|
1221
|
-
return;
|
|
1222
|
-
}
|
|
1297
|
+
/**
|
|
1298
|
+
* This is a descriptor map that contains
|
|
1299
|
+
* all standard properties that a Custom Element can support (including AOM properties), which
|
|
1300
|
+
* determines what kind of capabilities the Base HTML Element and
|
|
1301
|
+
* Base Lightning Element should support.
|
|
1302
|
+
*/
|
|
1223
1303
|
|
|
1224
|
-
|
|
1304
|
+
const HTMLElementOriginalDescriptors = create(null);
|
|
1305
|
+
forEach.call(keys(AriaPropNameToAttrNameMap), propName => {
|
|
1306
|
+
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1307
|
+
// in IE11, some properties are on Element.prototype instead of HTMLElement, just to be sure.
|
|
1308
|
+
const descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1225
1309
|
|
|
1226
|
-
if (
|
|
1227
|
-
|
|
1310
|
+
if (!isUndefined$1(descriptor)) {
|
|
1311
|
+
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1228
1312
|
}
|
|
1313
|
+
});
|
|
1314
|
+
forEach.call(defaultDefHTMLPropertyNames, propName => {
|
|
1315
|
+
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1316
|
+
// in IE11, id property is on Element.prototype instead of HTMLElement, and we suspect that more will fall into
|
|
1317
|
+
// this category, so, better to be sure.
|
|
1318
|
+
const descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1229
1319
|
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1320
|
+
if (!isUndefined$1(descriptor)) {
|
|
1321
|
+
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1322
|
+
}
|
|
1323
|
+
});
|
|
1324
|
+
/**
|
|
1325
|
+
* Copyright (C) 2017 salesforce.com, inc.
|
|
1326
|
+
*/
|
|
1235
1327
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1328
|
+
const {
|
|
1329
|
+
isArray
|
|
1330
|
+
} = Array;
|
|
1331
|
+
const {
|
|
1332
|
+
prototype: ObjectDotPrototype,
|
|
1333
|
+
getPrototypeOf,
|
|
1334
|
+
create: ObjectCreate,
|
|
1335
|
+
defineProperty: ObjectDefineProperty,
|
|
1336
|
+
isExtensible,
|
|
1337
|
+
getOwnPropertyDescriptor,
|
|
1338
|
+
getOwnPropertyNames,
|
|
1339
|
+
getOwnPropertySymbols,
|
|
1340
|
+
preventExtensions,
|
|
1341
|
+
hasOwnProperty
|
|
1342
|
+
} = Object;
|
|
1343
|
+
const {
|
|
1344
|
+
push: ArrayPush,
|
|
1345
|
+
concat: ArrayConcat
|
|
1346
|
+
} = Array.prototype;
|
|
1238
1347
|
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1348
|
+
function isUndefined(obj) {
|
|
1349
|
+
return obj === undefined;
|
|
1243
1350
|
}
|
|
1244
1351
|
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
}
|
|
1248
|
-
var modProps = {
|
|
1249
|
-
create: vnode => update(emptyVNode$2, vnode),
|
|
1250
|
-
update
|
|
1251
|
-
};
|
|
1252
|
-
/*
|
|
1253
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1254
|
-
* All rights reserved.
|
|
1255
|
-
* SPDX-License-Identifier: MIT
|
|
1256
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1257
|
-
*/
|
|
1352
|
+
function isFunction(obj) {
|
|
1353
|
+
return typeof obj === 'function';
|
|
1354
|
+
}
|
|
1258
1355
|
|
|
1259
|
-
const
|
|
1356
|
+
const proxyToValueMap = new WeakMap();
|
|
1260
1357
|
|
|
1261
|
-
function
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
return EmptyObject;
|
|
1265
|
-
} // computed class names must be string
|
|
1358
|
+
function registerProxy(proxy, value) {
|
|
1359
|
+
proxyToValueMap.set(proxy, value);
|
|
1360
|
+
}
|
|
1266
1361
|
|
|
1362
|
+
const unwrap$1 = replicaOrAny => proxyToValueMap.get(replicaOrAny) || replicaOrAny;
|
|
1267
1363
|
|
|
1268
|
-
|
|
1269
|
-
|
|
1364
|
+
class BaseProxyHandler {
|
|
1365
|
+
constructor(membrane, value) {
|
|
1366
|
+
this.originalTarget = value;
|
|
1367
|
+
this.membrane = membrane;
|
|
1368
|
+
} // Shared utility methods
|
|
1270
1369
|
|
|
1271
|
-
if (map) {
|
|
1272
|
-
return map;
|
|
1273
|
-
}
|
|
1274
1370
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1371
|
+
wrapDescriptor(descriptor) {
|
|
1372
|
+
if (hasOwnProperty.call(descriptor, 'value')) {
|
|
1373
|
+
descriptor.value = this.wrapValue(descriptor.value);
|
|
1374
|
+
} else {
|
|
1375
|
+
const {
|
|
1376
|
+
set: originalSet,
|
|
1377
|
+
get: originalGet
|
|
1378
|
+
} = descriptor;
|
|
1279
1379
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
if (o > start) {
|
|
1283
|
-
map[StringSlice.call(className, start, o)] = true;
|
|
1380
|
+
if (!isUndefined(originalGet)) {
|
|
1381
|
+
descriptor.get = this.wrapGetter(originalGet);
|
|
1284
1382
|
}
|
|
1285
1383
|
|
|
1286
|
-
|
|
1384
|
+
if (!isUndefined(originalSet)) {
|
|
1385
|
+
descriptor.set = this.wrapSetter(originalSet);
|
|
1386
|
+
}
|
|
1287
1387
|
}
|
|
1288
|
-
}
|
|
1289
1388
|
|
|
1290
|
-
|
|
1291
|
-
map[StringSlice.call(className, start, o)] = true;
|
|
1389
|
+
return descriptor;
|
|
1292
1390
|
}
|
|
1293
1391
|
|
|
1294
|
-
|
|
1392
|
+
copyDescriptorIntoShadowTarget(shadowTarget, key) {
|
|
1393
|
+
const {
|
|
1394
|
+
originalTarget
|
|
1395
|
+
} = this; // Note: a property might get defined multiple times in the shadowTarget
|
|
1396
|
+
// but it will always be compatible with the previous descriptor
|
|
1397
|
+
// to preserve the object invariants, which makes these lines safe.
|
|
1295
1398
|
|
|
1296
|
-
|
|
1297
|
-
}
|
|
1399
|
+
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
|
|
1298
1400
|
|
|
1299
|
-
|
|
1300
|
-
const {
|
|
1301
|
-
elm,
|
|
1302
|
-
data: {
|
|
1303
|
-
className: newClass
|
|
1304
|
-
}
|
|
1305
|
-
} = vnode;
|
|
1306
|
-
const {
|
|
1307
|
-
data: {
|
|
1308
|
-
className: oldClass
|
|
1309
|
-
}
|
|
1310
|
-
} = oldVnode;
|
|
1401
|
+
/* istanbul ignore else */
|
|
1311
1402
|
|
|
1312
|
-
|
|
1313
|
-
|
|
1403
|
+
if (!isUndefined(originalDescriptor)) {
|
|
1404
|
+
const wrappedDesc = this.wrapDescriptor(originalDescriptor);
|
|
1405
|
+
ObjectDefineProperty(shadowTarget, key, wrappedDesc);
|
|
1406
|
+
}
|
|
1314
1407
|
}
|
|
1315
1408
|
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1409
|
+
lockShadowTarget(shadowTarget) {
|
|
1410
|
+
const {
|
|
1411
|
+
originalTarget
|
|
1412
|
+
} = this;
|
|
1413
|
+
const targetKeys = ArrayConcat.call(getOwnPropertyNames(originalTarget), getOwnPropertySymbols(originalTarget));
|
|
1414
|
+
targetKeys.forEach(key => {
|
|
1415
|
+
this.copyDescriptorIntoShadowTarget(shadowTarget, key);
|
|
1416
|
+
});
|
|
1417
|
+
const {
|
|
1418
|
+
membrane: {
|
|
1419
|
+
tagPropertyKey
|
|
1420
|
+
}
|
|
1421
|
+
} = this;
|
|
1320
1422
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
if (isUndefined$1(newClassMap[name])) {
|
|
1324
|
-
classList.remove(name);
|
|
1423
|
+
if (!isUndefined(tagPropertyKey) && !hasOwnProperty.call(shadowTarget, tagPropertyKey)) {
|
|
1424
|
+
ObjectDefineProperty(shadowTarget, tagPropertyKey, ObjectCreate(null));
|
|
1325
1425
|
}
|
|
1326
|
-
}
|
|
1327
1426
|
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
}
|
|
1427
|
+
preventExtensions(shadowTarget);
|
|
1428
|
+
} // Shared Traps
|
|
1429
|
+
// TODO: apply() is never called
|
|
1334
1430
|
|
|
1335
|
-
|
|
1336
|
-
data: {}
|
|
1337
|
-
};
|
|
1338
|
-
var modComputedClassName = {
|
|
1339
|
-
create: vnode => updateClassAttribute(emptyVNode$1, vnode),
|
|
1340
|
-
update: updateClassAttribute
|
|
1341
|
-
};
|
|
1342
|
-
/*
|
|
1343
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1344
|
-
* All rights reserved.
|
|
1345
|
-
* SPDX-License-Identifier: MIT
|
|
1346
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1347
|
-
*/
|
|
1431
|
+
/* istanbul ignore next */
|
|
1348
1432
|
|
|
1349
|
-
function updateStyleAttribute(oldVnode, vnode) {
|
|
1350
|
-
const {
|
|
1351
|
-
elm,
|
|
1352
|
-
data: {
|
|
1353
|
-
style: newStyle
|
|
1354
|
-
}
|
|
1355
|
-
} = vnode;
|
|
1356
1433
|
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
}
|
|
1434
|
+
apply(shadowTarget, thisArg, argArray) {
|
|
1435
|
+
/* No op */
|
|
1436
|
+
} // TODO: construct() is never called
|
|
1360
1437
|
|
|
1361
|
-
|
|
1362
|
-
removeAttribute$1(elm, 'style');
|
|
1363
|
-
} else {
|
|
1364
|
-
setAttribute$1(elm, 'style', newStyle);
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1438
|
+
/* istanbul ignore next */
|
|
1367
1439
|
|
|
1368
|
-
const emptyVNode = {
|
|
1369
|
-
data: {}
|
|
1370
|
-
};
|
|
1371
|
-
var modComputedStyle = {
|
|
1372
|
-
create: vnode => updateStyleAttribute(emptyVNode, vnode),
|
|
1373
|
-
update: updateStyleAttribute
|
|
1374
|
-
};
|
|
1375
|
-
/*
|
|
1376
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1377
|
-
* All rights reserved.
|
|
1378
|
-
* SPDX-License-Identifier: MIT
|
|
1379
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1380
|
-
*/
|
|
1381
|
-
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
1382
|
-
// different classnames properties individually instead of via a string.
|
|
1383
1440
|
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
data: {
|
|
1388
|
-
classMap
|
|
1389
|
-
}
|
|
1390
|
-
} = vnode;
|
|
1441
|
+
construct(shadowTarget, argArray, newTarget) {
|
|
1442
|
+
/* No op */
|
|
1443
|
+
}
|
|
1391
1444
|
|
|
1392
|
-
|
|
1393
|
-
|
|
1445
|
+
get(shadowTarget, key) {
|
|
1446
|
+
const {
|
|
1447
|
+
originalTarget,
|
|
1448
|
+
membrane: {
|
|
1449
|
+
valueObserved
|
|
1450
|
+
}
|
|
1451
|
+
} = this;
|
|
1452
|
+
const value = originalTarget[key];
|
|
1453
|
+
valueObserved(originalTarget, key);
|
|
1454
|
+
return this.wrapValue(value);
|
|
1394
1455
|
}
|
|
1395
1456
|
|
|
1396
|
-
|
|
1457
|
+
has(shadowTarget, key) {
|
|
1458
|
+
const {
|
|
1459
|
+
originalTarget,
|
|
1460
|
+
membrane: {
|
|
1461
|
+
tagPropertyKey,
|
|
1462
|
+
valueObserved
|
|
1463
|
+
}
|
|
1464
|
+
} = this;
|
|
1465
|
+
valueObserved(originalTarget, key); // since key is never going to be undefined, and tagPropertyKey might be undefined
|
|
1466
|
+
// we can simply compare them as the second part of the condition.
|
|
1397
1467
|
|
|
1398
|
-
|
|
1399
|
-
classList.add(name);
|
|
1468
|
+
return key in originalTarget || key === tagPropertyKey;
|
|
1400
1469
|
}
|
|
1401
|
-
}
|
|
1402
1470
|
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1411
|
-
*/
|
|
1412
|
-
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
1413
|
-
// different style properties individually instead of via a string.
|
|
1471
|
+
ownKeys(shadowTarget) {
|
|
1472
|
+
const {
|
|
1473
|
+
originalTarget,
|
|
1474
|
+
membrane: {
|
|
1475
|
+
tagPropertyKey
|
|
1476
|
+
}
|
|
1477
|
+
} = this; // if the membrane tag key exists and it is not in the original target, we add it to the keys.
|
|
1414
1478
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1479
|
+
const keys = isUndefined(tagPropertyKey) || hasOwnProperty.call(originalTarget, tagPropertyKey) ? [] : [tagPropertyKey]; // small perf optimization using push instead of concat to avoid creating an extra array
|
|
1480
|
+
|
|
1481
|
+
ArrayPush.apply(keys, getOwnPropertyNames(originalTarget));
|
|
1482
|
+
ArrayPush.apply(keys, getOwnPropertySymbols(originalTarget));
|
|
1483
|
+
return keys;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
isExtensible(shadowTarget) {
|
|
1487
|
+
const {
|
|
1488
|
+
originalTarget
|
|
1489
|
+
} = this; // optimization to avoid attempting to lock down the shadowTarget multiple times
|
|
1490
|
+
|
|
1491
|
+
if (!isExtensible(shadowTarget)) {
|
|
1492
|
+
return false; // was already locked down
|
|
1420
1493
|
}
|
|
1421
|
-
} = vnode;
|
|
1422
1494
|
|
|
1423
|
-
|
|
1424
|
-
|
|
1495
|
+
if (!isExtensible(originalTarget)) {
|
|
1496
|
+
this.lockShadowTarget(shadowTarget);
|
|
1497
|
+
return false;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
return true;
|
|
1425
1501
|
}
|
|
1426
1502
|
|
|
1427
|
-
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1503
|
+
getPrototypeOf(shadowTarget) {
|
|
1504
|
+
const {
|
|
1505
|
+
originalTarget
|
|
1506
|
+
} = this;
|
|
1507
|
+
return getPrototypeOf(originalTarget);
|
|
1430
1508
|
}
|
|
1431
|
-
}
|
|
1432
1509
|
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
*/
|
|
1510
|
+
getOwnPropertyDescriptor(shadowTarget, key) {
|
|
1511
|
+
const {
|
|
1512
|
+
originalTarget,
|
|
1513
|
+
membrane: {
|
|
1514
|
+
valueObserved,
|
|
1515
|
+
tagPropertyKey
|
|
1516
|
+
}
|
|
1517
|
+
} = this; // keys looked up via getOwnPropertyDescriptor need to be reactive
|
|
1442
1518
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
}
|
|
1519
|
+
valueObserved(originalTarget, key);
|
|
1520
|
+
let desc = getOwnPropertyDescriptor(originalTarget, key);
|
|
1446
1521
|
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1522
|
+
if (isUndefined(desc)) {
|
|
1523
|
+
if (key !== tagPropertyKey) {
|
|
1524
|
+
return undefined;
|
|
1525
|
+
} // if the key is the membrane tag key, and is not in the original target,
|
|
1526
|
+
// we produce a synthetic descriptor and install it on the shadow target
|
|
1450
1527
|
|
|
1451
|
-
function isVNode(vnode) {
|
|
1452
|
-
return vnode != null;
|
|
1453
|
-
}
|
|
1454
1528
|
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1529
|
+
desc = {
|
|
1530
|
+
value: undefined,
|
|
1531
|
+
writable: false,
|
|
1532
|
+
configurable: false,
|
|
1533
|
+
enumerable: false
|
|
1534
|
+
};
|
|
1535
|
+
ObjectDefineProperty(shadowTarget, tagPropertyKey, desc);
|
|
1536
|
+
return desc;
|
|
1537
|
+
}
|
|
1458
1538
|
|
|
1459
|
-
|
|
1460
|
-
|
|
1539
|
+
if (desc.configurable === false) {
|
|
1540
|
+
// updating the descriptor to non-configurable on the shadow
|
|
1541
|
+
this.copyDescriptorIntoShadowTarget(shadowTarget, key);
|
|
1542
|
+
} // Note: by accessing the descriptor, the key is marked as observed
|
|
1543
|
+
// but access to the value, setter or getter (if available) cannot observe
|
|
1544
|
+
// mutations, just like regular methods, in which case we just do nothing.
|
|
1461
1545
|
|
|
1462
|
-
if (isVNode(ch)) {
|
|
1463
|
-
key = ch.key;
|
|
1464
1546
|
|
|
1465
|
-
|
|
1466
|
-
map[key] = j;
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1547
|
+
return this.wrapDescriptor(desc);
|
|
1469
1548
|
}
|
|
1470
1549
|
|
|
1471
|
-
return map;
|
|
1472
1550
|
}
|
|
1473
1551
|
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1552
|
+
const getterMap$1 = new WeakMap();
|
|
1553
|
+
const setterMap$1 = new WeakMap();
|
|
1554
|
+
const reverseGetterMap = new WeakMap();
|
|
1555
|
+
const reverseSetterMap = new WeakMap();
|
|
1477
1556
|
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
}
|
|
1557
|
+
class ReactiveProxyHandler extends BaseProxyHandler {
|
|
1558
|
+
wrapValue(value) {
|
|
1559
|
+
return this.membrane.getProxy(value);
|
|
1482
1560
|
}
|
|
1483
|
-
}
|
|
1484
1561
|
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
const ch = vnodes[startIdx]; // text nodes do not have logic associated to them
|
|
1562
|
+
wrapGetter(originalGet) {
|
|
1563
|
+
const wrappedGetter = getterMap$1.get(originalGet);
|
|
1488
1564
|
|
|
1489
|
-
if (
|
|
1490
|
-
|
|
1565
|
+
if (!isUndefined(wrappedGetter)) {
|
|
1566
|
+
return wrappedGetter;
|
|
1491
1567
|
}
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
function updateDynamicChildren(parentElm, oldCh, newCh) {
|
|
1496
|
-
let oldStartIdx = 0;
|
|
1497
|
-
let newStartIdx = 0;
|
|
1498
|
-
let oldEndIdx = oldCh.length - 1;
|
|
1499
|
-
let oldStartVnode = oldCh[0];
|
|
1500
|
-
let oldEndVnode = oldCh[oldEndIdx];
|
|
1501
|
-
const newChEnd = newCh.length - 1;
|
|
1502
|
-
let newEndIdx = newChEnd;
|
|
1503
|
-
let newStartVnode = newCh[0];
|
|
1504
|
-
let newEndVnode = newCh[newEndIdx];
|
|
1505
|
-
let oldKeyToIdx;
|
|
1506
|
-
let idxInOld;
|
|
1507
|
-
let elmToMove;
|
|
1508
|
-
let before;
|
|
1509
1568
|
|
|
1510
|
-
|
|
1511
|
-
if (!isVNode(oldStartVnode)) {
|
|
1512
|
-
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
1513
|
-
} else if (!isVNode(oldEndVnode)) {
|
|
1514
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1515
|
-
} else if (!isVNode(newStartVnode)) {
|
|
1516
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1517
|
-
} else if (!isVNode(newEndVnode)) {
|
|
1518
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1519
|
-
} else if (sameVnode(oldStartVnode, newStartVnode)) {
|
|
1520
|
-
patchVnode(oldStartVnode, newStartVnode);
|
|
1521
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
|
1522
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1523
|
-
} else if (sameVnode(oldEndVnode, newEndVnode)) {
|
|
1524
|
-
patchVnode(oldEndVnode, newEndVnode);
|
|
1525
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1526
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1527
|
-
} else if (sameVnode(oldStartVnode, newEndVnode)) {
|
|
1528
|
-
// Vnode moved right
|
|
1529
|
-
patchVnode(oldStartVnode, newEndVnode);
|
|
1530
|
-
newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));
|
|
1531
|
-
oldStartVnode = oldCh[++oldStartIdx];
|
|
1532
|
-
newEndVnode = newCh[--newEndIdx];
|
|
1533
|
-
} else if (sameVnode(oldEndVnode, newStartVnode)) {
|
|
1534
|
-
// Vnode moved left
|
|
1535
|
-
patchVnode(oldEndVnode, newStartVnode);
|
|
1536
|
-
newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
|
|
1537
|
-
oldEndVnode = oldCh[--oldEndIdx];
|
|
1538
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1539
|
-
} else {
|
|
1540
|
-
if (oldKeyToIdx === undefined) {
|
|
1541
|
-
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
1542
|
-
}
|
|
1569
|
+
const handler = this;
|
|
1543
1570
|
|
|
1544
|
-
|
|
1571
|
+
const get = function () {
|
|
1572
|
+
// invoking the original getter with the original target
|
|
1573
|
+
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
1574
|
+
};
|
|
1545
1575
|
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
newStartVnode = newCh[++newStartIdx];
|
|
1551
|
-
} else {
|
|
1552
|
-
elmToMove = oldCh[idxInOld];
|
|
1576
|
+
getterMap$1.set(originalGet, get);
|
|
1577
|
+
reverseGetterMap.set(get, originalGet);
|
|
1578
|
+
return get;
|
|
1579
|
+
}
|
|
1553
1580
|
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
// New element
|
|
1557
|
-
newStartVnode.hook.create(newStartVnode);
|
|
1558
|
-
newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
|
|
1559
|
-
} else {
|
|
1560
|
-
patchVnode(elmToMove, newStartVnode);
|
|
1561
|
-
oldCh[idxInOld] = undefined;
|
|
1562
|
-
newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1581
|
+
wrapSetter(originalSet) {
|
|
1582
|
+
const wrappedSetter = setterMap$1.get(originalSet);
|
|
1565
1583
|
|
|
1566
|
-
|
|
1567
|
-
|
|
1584
|
+
if (!isUndefined(wrappedSetter)) {
|
|
1585
|
+
return wrappedSetter;
|
|
1568
1586
|
}
|
|
1569
|
-
}
|
|
1570
1587
|
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
let i = newEndIdx;
|
|
1576
|
-
let n;
|
|
1588
|
+
const set = function (v) {
|
|
1589
|
+
// invoking the original setter with the original target
|
|
1590
|
+
originalSet.call(unwrap$1(this), unwrap$1(v));
|
|
1591
|
+
};
|
|
1577
1592
|
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1593
|
+
setterMap$1.set(originalSet, set);
|
|
1594
|
+
reverseSetterMap.set(set, originalSet);
|
|
1595
|
+
return set;
|
|
1596
|
+
}
|
|
1581
1597
|
|
|
1582
|
-
|
|
1583
|
-
|
|
1598
|
+
unwrapDescriptor(descriptor) {
|
|
1599
|
+
if (hasOwnProperty.call(descriptor, 'value')) {
|
|
1600
|
+
// dealing with a data descriptor
|
|
1601
|
+
descriptor.value = unwrap$1(descriptor.value);
|
|
1584
1602
|
} else {
|
|
1585
|
-
|
|
1603
|
+
const {
|
|
1604
|
+
set,
|
|
1605
|
+
get
|
|
1606
|
+
} = descriptor;
|
|
1607
|
+
|
|
1608
|
+
if (!isUndefined(get)) {
|
|
1609
|
+
descriptor.get = this.unwrapGetter(get);
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
if (!isUndefined(set)) {
|
|
1613
|
+
descriptor.set = this.unwrapSetter(set);
|
|
1614
|
+
}
|
|
1586
1615
|
}
|
|
1616
|
+
|
|
1617
|
+
return descriptor;
|
|
1587
1618
|
}
|
|
1588
|
-
}
|
|
1589
1619
|
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
const newChLength = newCh.length;
|
|
1593
|
-
|
|
1594
|
-
if (oldChLength === 0) {
|
|
1595
|
-
// the old list is empty, we can directly insert anything new
|
|
1596
|
-
addVnodes(parentElm, null, newCh, 0, newChLength);
|
|
1597
|
-
return;
|
|
1598
|
-
}
|
|
1620
|
+
unwrapGetter(redGet) {
|
|
1621
|
+
const reverseGetter = reverseGetterMap.get(redGet);
|
|
1599
1622
|
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
removeVnodes(parentElm, oldCh, 0, oldChLength);
|
|
1604
|
-
return;
|
|
1605
|
-
} // if the old list is not empty, the new list MUST have the same
|
|
1606
|
-
// amount of nodes, that's why we call this static children
|
|
1623
|
+
if (!isUndefined(reverseGetter)) {
|
|
1624
|
+
return reverseGetter;
|
|
1625
|
+
}
|
|
1607
1626
|
|
|
1627
|
+
const handler = this;
|
|
1608
1628
|
|
|
1609
|
-
|
|
1629
|
+
const get = function () {
|
|
1630
|
+
// invoking the red getter with the proxy of this
|
|
1631
|
+
return unwrap$1(redGet.call(handler.wrapValue(this)));
|
|
1632
|
+
};
|
|
1610
1633
|
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1634
|
+
getterMap$1.set(get, redGet);
|
|
1635
|
+
reverseGetterMap.set(redGet, get);
|
|
1636
|
+
return get;
|
|
1637
|
+
}
|
|
1614
1638
|
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
if (isVNode(vnode)) {
|
|
1618
|
-
// both vnodes must be equivalent, and se just need to patch them
|
|
1619
|
-
patchVnode(oldVNode, vnode);
|
|
1620
|
-
referenceElm = vnode.elm;
|
|
1621
|
-
} else {
|
|
1622
|
-
// removing the old vnode since the new one is null
|
|
1623
|
-
oldVNode.hook.remove(oldVNode, parentElm);
|
|
1624
|
-
}
|
|
1625
|
-
} else if (isVNode(vnode)) {
|
|
1626
|
-
// this condition is unnecessary
|
|
1627
|
-
vnode.hook.create(vnode); // insert the new node one since the old one is null
|
|
1639
|
+
unwrapSetter(redSet) {
|
|
1640
|
+
const reverseSetter = reverseSetterMap.get(redSet);
|
|
1628
1641
|
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
}
|
|
1642
|
+
if (!isUndefined(reverseSetter)) {
|
|
1643
|
+
return reverseSetter;
|
|
1632
1644
|
}
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
1645
|
|
|
1636
|
-
|
|
1637
|
-
if (oldVnode !== vnode) {
|
|
1638
|
-
vnode.elm = oldVnode.elm;
|
|
1639
|
-
vnode.hook.update(oldVnode, vnode);
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
/*
|
|
1643
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
1644
|
-
* All rights reserved.
|
|
1645
|
-
* SPDX-License-Identifier: MIT
|
|
1646
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1647
|
-
*/
|
|
1648
|
-
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
1649
|
-
// to inject at runtime.
|
|
1646
|
+
const handler = this;
|
|
1650
1647
|
|
|
1648
|
+
const set = function (v) {
|
|
1649
|
+
// invoking the red setter with the proxy of this
|
|
1650
|
+
redSet.call(handler.wrapValue(this), handler.wrapValue(v));
|
|
1651
|
+
};
|
|
1651
1652
|
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
* All rights reserved.
|
|
1657
|
-
* SPDX-License-Identifier: MIT
|
|
1658
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1659
|
-
*/
|
|
1653
|
+
setterMap$1.set(set, redSet);
|
|
1654
|
+
reverseSetterMap.set(redSet, set);
|
|
1655
|
+
return set;
|
|
1656
|
+
}
|
|
1660
1657
|
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1658
|
+
set(shadowTarget, key, value) {
|
|
1659
|
+
const {
|
|
1660
|
+
originalTarget,
|
|
1661
|
+
membrane: {
|
|
1662
|
+
valueMutated
|
|
1663
|
+
}
|
|
1664
|
+
} = this;
|
|
1665
|
+
const oldValue = originalTarget[key];
|
|
1667
1666
|
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1667
|
+
if (oldValue !== value) {
|
|
1668
|
+
originalTarget[key] = value;
|
|
1669
|
+
valueMutated(originalTarget, key);
|
|
1670
|
+
} else if (key === 'length' && isArray(originalTarget)) {
|
|
1671
|
+
// fix for issue #236: push will add the new index, and by the time length
|
|
1672
|
+
// is updated, the internal length is already equal to the new length value
|
|
1673
|
+
// therefore, the oldValue is equal to the value. This is the forking logic
|
|
1674
|
+
// to support this use case.
|
|
1675
|
+
valueMutated(originalTarget, key);
|
|
1676
|
+
}
|
|
1673
1677
|
|
|
1674
|
-
|
|
1675
|
-
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1678
|
+
return true;
|
|
1676
1679
|
}
|
|
1677
|
-
});
|
|
1678
|
-
forEach.call(defaultDefHTMLPropertyNames, propName => {
|
|
1679
|
-
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
|
|
1680
|
-
// in IE11, id property is on Element.prototype instead of HTMLElement, and we suspect that more will fall into
|
|
1681
|
-
// this category, so, better to be sure.
|
|
1682
|
-
const descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
|
|
1683
1680
|
|
|
1684
|
-
|
|
1685
|
-
|
|
1681
|
+
deleteProperty(shadowTarget, key) {
|
|
1682
|
+
const {
|
|
1683
|
+
originalTarget,
|
|
1684
|
+
membrane: {
|
|
1685
|
+
valueMutated
|
|
1686
|
+
}
|
|
1687
|
+
} = this;
|
|
1688
|
+
delete originalTarget[key];
|
|
1689
|
+
valueMutated(originalTarget, key);
|
|
1690
|
+
return true;
|
|
1686
1691
|
}
|
|
1687
|
-
});
|
|
1688
|
-
/**
|
|
1689
|
-
* Copyright (C) 2017 salesforce.com, inc.
|
|
1690
|
-
*/
|
|
1691
|
-
|
|
1692
|
-
const {
|
|
1693
|
-
isArray
|
|
1694
|
-
} = Array;
|
|
1695
|
-
const {
|
|
1696
|
-
prototype: ObjectDotPrototype,
|
|
1697
|
-
getPrototypeOf,
|
|
1698
|
-
create: ObjectCreate,
|
|
1699
|
-
defineProperty: ObjectDefineProperty,
|
|
1700
|
-
isExtensible,
|
|
1701
|
-
getOwnPropertyDescriptor,
|
|
1702
|
-
getOwnPropertyNames,
|
|
1703
|
-
getOwnPropertySymbols,
|
|
1704
|
-
preventExtensions,
|
|
1705
|
-
hasOwnProperty
|
|
1706
|
-
} = Object;
|
|
1707
|
-
const {
|
|
1708
|
-
push: ArrayPush,
|
|
1709
|
-
concat: ArrayConcat
|
|
1710
|
-
} = Array.prototype;
|
|
1711
|
-
|
|
1712
|
-
function isUndefined(obj) {
|
|
1713
|
-
return obj === undefined;
|
|
1714
|
-
}
|
|
1715
|
-
|
|
1716
|
-
function isFunction(obj) {
|
|
1717
|
-
return typeof obj === 'function';
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
const proxyToValueMap = new WeakMap();
|
|
1721
|
-
|
|
1722
|
-
function registerProxy(proxy, value) {
|
|
1723
|
-
proxyToValueMap.set(proxy, value);
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
const unwrap$1 = replicaOrAny => proxyToValueMap.get(replicaOrAny) || replicaOrAny;
|
|
1727
|
-
|
|
1728
|
-
class BaseProxyHandler {
|
|
1729
|
-
constructor(membrane, value) {
|
|
1730
|
-
this.originalTarget = value;
|
|
1731
|
-
this.membrane = membrane;
|
|
1732
|
-
} // Shared utility methods
|
|
1733
1692
|
|
|
1693
|
+
setPrototypeOf(shadowTarget, prototype) {
|
|
1694
|
+
}
|
|
1734
1695
|
|
|
1735
|
-
|
|
1736
|
-
if (
|
|
1737
|
-
descriptor.value = this.wrapValue(descriptor.value);
|
|
1738
|
-
} else {
|
|
1696
|
+
preventExtensions(shadowTarget) {
|
|
1697
|
+
if (isExtensible(shadowTarget)) {
|
|
1739
1698
|
const {
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1699
|
+
originalTarget
|
|
1700
|
+
} = this;
|
|
1701
|
+
preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
|
|
1702
|
+
// the preventExtension call, in which case we should not attempt to lock down
|
|
1703
|
+
// the shadow target.
|
|
1704
|
+
// TODO: It should not actually be possible to reach this `if` statement.
|
|
1705
|
+
// If a proxy rejects extensions, then calling preventExtensions will throw an error:
|
|
1706
|
+
// https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
|
|
1743
1707
|
|
|
1744
|
-
if
|
|
1745
|
-
descriptor.get = this.wrapGetter(originalGet);
|
|
1746
|
-
}
|
|
1708
|
+
/* istanbul ignore if */
|
|
1747
1709
|
|
|
1748
|
-
if (
|
|
1749
|
-
|
|
1710
|
+
if (isExtensible(originalTarget)) {
|
|
1711
|
+
return false;
|
|
1750
1712
|
}
|
|
1751
|
-
}
|
|
1752
|
-
|
|
1753
|
-
return descriptor;
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
copyDescriptorIntoShadowTarget(shadowTarget, key) {
|
|
1757
|
-
const {
|
|
1758
|
-
originalTarget
|
|
1759
|
-
} = this; // Note: a property might get defined multiple times in the shadowTarget
|
|
1760
|
-
// but it will always be compatible with the previous descriptor
|
|
1761
|
-
// to preserve the object invariants, which makes these lines safe.
|
|
1762
|
-
|
|
1763
|
-
const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed
|
|
1764
|
-
|
|
1765
|
-
/* istanbul ignore else */
|
|
1766
1713
|
|
|
1767
|
-
|
|
1768
|
-
const wrappedDesc = this.wrapDescriptor(originalDescriptor);
|
|
1769
|
-
ObjectDefineProperty(shadowTarget, key, wrappedDesc);
|
|
1714
|
+
this.lockShadowTarget(shadowTarget);
|
|
1770
1715
|
}
|
|
1716
|
+
|
|
1717
|
+
return true;
|
|
1771
1718
|
}
|
|
1772
1719
|
|
|
1773
|
-
|
|
1774
|
-
const {
|
|
1775
|
-
originalTarget
|
|
1776
|
-
} = this;
|
|
1777
|
-
const targetKeys = ArrayConcat.call(getOwnPropertyNames(originalTarget), getOwnPropertySymbols(originalTarget));
|
|
1778
|
-
targetKeys.forEach(key => {
|
|
1779
|
-
this.copyDescriptorIntoShadowTarget(shadowTarget, key);
|
|
1780
|
-
});
|
|
1720
|
+
defineProperty(shadowTarget, key, descriptor) {
|
|
1781
1721
|
const {
|
|
1722
|
+
originalTarget,
|
|
1782
1723
|
membrane: {
|
|
1724
|
+
valueMutated,
|
|
1783
1725
|
tagPropertyKey
|
|
1784
1726
|
}
|
|
1785
1727
|
} = this;
|
|
1786
1728
|
|
|
1787
|
-
if (
|
|
1788
|
-
|
|
1729
|
+
if (key === tagPropertyKey && !hasOwnProperty.call(originalTarget, key)) {
|
|
1730
|
+
// To avoid leaking the membrane tag property into the original target, we must
|
|
1731
|
+
// be sure that the original target doesn't have yet.
|
|
1732
|
+
// NOTE: we do not return false here because Object.freeze and equivalent operations
|
|
1733
|
+
// will attempt to set the descriptor to the same value, and expect no to throw. This
|
|
1734
|
+
// is an small compromise for the sake of not having to diff the descriptors.
|
|
1735
|
+
return true;
|
|
1789
1736
|
}
|
|
1790
1737
|
|
|
1791
|
-
|
|
1792
|
-
} // Shared Traps
|
|
1793
|
-
// TODO: apply() is never called
|
|
1794
|
-
|
|
1795
|
-
/* istanbul ignore next */
|
|
1796
|
-
|
|
1738
|
+
ObjectDefineProperty(originalTarget, key, this.unwrapDescriptor(descriptor)); // intentionally testing if false since it could be undefined as well
|
|
1797
1739
|
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
} // TODO: construct() is never called
|
|
1801
|
-
|
|
1802
|
-
/* istanbul ignore next */
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
construct(shadowTarget, argArray, newTarget) {
|
|
1806
|
-
/* No op */
|
|
1807
|
-
}
|
|
1808
|
-
|
|
1809
|
-
get(shadowTarget, key) {
|
|
1810
|
-
const {
|
|
1811
|
-
originalTarget,
|
|
1812
|
-
membrane: {
|
|
1813
|
-
valueObserved
|
|
1814
|
-
}
|
|
1815
|
-
} = this;
|
|
1816
|
-
const value = originalTarget[key];
|
|
1817
|
-
valueObserved(originalTarget, key);
|
|
1818
|
-
return this.wrapValue(value);
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
has(shadowTarget, key) {
|
|
1822
|
-
const {
|
|
1823
|
-
originalTarget,
|
|
1824
|
-
membrane: {
|
|
1825
|
-
tagPropertyKey,
|
|
1826
|
-
valueObserved
|
|
1827
|
-
}
|
|
1828
|
-
} = this;
|
|
1829
|
-
valueObserved(originalTarget, key); // since key is never going to be undefined, and tagPropertyKey might be undefined
|
|
1830
|
-
// we can simply compare them as the second part of the condition.
|
|
1831
|
-
|
|
1832
|
-
return key in originalTarget || key === tagPropertyKey;
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
ownKeys(shadowTarget) {
|
|
1836
|
-
const {
|
|
1837
|
-
originalTarget,
|
|
1838
|
-
membrane: {
|
|
1839
|
-
tagPropertyKey
|
|
1840
|
-
}
|
|
1841
|
-
} = this; // if the membrane tag key exists and it is not in the original target, we add it to the keys.
|
|
1842
|
-
|
|
1843
|
-
const keys = isUndefined(tagPropertyKey) || hasOwnProperty.call(originalTarget, tagPropertyKey) ? [] : [tagPropertyKey]; // small perf optimization using push instead of concat to avoid creating an extra array
|
|
1844
|
-
|
|
1845
|
-
ArrayPush.apply(keys, getOwnPropertyNames(originalTarget));
|
|
1846
|
-
ArrayPush.apply(keys, getOwnPropertySymbols(originalTarget));
|
|
1847
|
-
return keys;
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
isExtensible(shadowTarget) {
|
|
1851
|
-
const {
|
|
1852
|
-
originalTarget
|
|
1853
|
-
} = this; // optimization to avoid attempting to lock down the shadowTarget multiple times
|
|
1854
|
-
|
|
1855
|
-
if (!isExtensible(shadowTarget)) {
|
|
1856
|
-
return false; // was already locked down
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1859
|
-
if (!isExtensible(originalTarget)) {
|
|
1860
|
-
this.lockShadowTarget(shadowTarget);
|
|
1861
|
-
return false;
|
|
1740
|
+
if (descriptor.configurable === false) {
|
|
1741
|
+
this.copyDescriptorIntoShadowTarget(shadowTarget, key);
|
|
1862
1742
|
}
|
|
1863
1743
|
|
|
1744
|
+
valueMutated(originalTarget, key);
|
|
1864
1745
|
return true;
|
|
1865
1746
|
}
|
|
1866
1747
|
|
|
1867
|
-
getPrototypeOf(shadowTarget) {
|
|
1868
|
-
const {
|
|
1869
|
-
originalTarget
|
|
1870
|
-
} = this;
|
|
1871
|
-
return getPrototypeOf(originalTarget);
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
|
-
getOwnPropertyDescriptor(shadowTarget, key) {
|
|
1875
|
-
const {
|
|
1876
|
-
originalTarget,
|
|
1877
|
-
membrane: {
|
|
1878
|
-
valueObserved,
|
|
1879
|
-
tagPropertyKey
|
|
1880
|
-
}
|
|
1881
|
-
} = this; // keys looked up via getOwnPropertyDescriptor need to be reactive
|
|
1882
|
-
|
|
1883
|
-
valueObserved(originalTarget, key);
|
|
1884
|
-
let desc = getOwnPropertyDescriptor(originalTarget, key);
|
|
1885
|
-
|
|
1886
|
-
if (isUndefined(desc)) {
|
|
1887
|
-
if (key !== tagPropertyKey) {
|
|
1888
|
-
return undefined;
|
|
1889
|
-
} // if the key is the membrane tag key, and is not in the original target,
|
|
1890
|
-
// we produce a synthetic descriptor and install it on the shadow target
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
desc = {
|
|
1894
|
-
value: undefined,
|
|
1895
|
-
writable: false,
|
|
1896
|
-
configurable: false,
|
|
1897
|
-
enumerable: false
|
|
1898
|
-
};
|
|
1899
|
-
ObjectDefineProperty(shadowTarget, tagPropertyKey, desc);
|
|
1900
|
-
return desc;
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
if (desc.configurable === false) {
|
|
1904
|
-
// updating the descriptor to non-configurable on the shadow
|
|
1905
|
-
this.copyDescriptorIntoShadowTarget(shadowTarget, key);
|
|
1906
|
-
} // Note: by accessing the descriptor, the key is marked as observed
|
|
1907
|
-
// but access to the value, setter or getter (if available) cannot observe
|
|
1908
|
-
// mutations, just like regular methods, in which case we just do nothing.
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
return this.wrapDescriptor(desc);
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
1748
|
}
|
|
1915
1749
|
|
|
1916
|
-
const getterMap
|
|
1917
|
-
const setterMap
|
|
1918
|
-
const reverseGetterMap = new WeakMap();
|
|
1919
|
-
const reverseSetterMap = new WeakMap();
|
|
1750
|
+
const getterMap = new WeakMap();
|
|
1751
|
+
const setterMap = new WeakMap();
|
|
1920
1752
|
|
|
1921
|
-
class
|
|
1753
|
+
class ReadOnlyHandler extends BaseProxyHandler {
|
|
1922
1754
|
wrapValue(value) {
|
|
1923
|
-
return this.membrane.
|
|
1755
|
+
return this.membrane.getReadOnlyProxy(value);
|
|
1924
1756
|
}
|
|
1925
1757
|
|
|
1926
1758
|
wrapGetter(originalGet) {
|
|
1927
|
-
const wrappedGetter = getterMap
|
|
1759
|
+
const wrappedGetter = getterMap.get(originalGet);
|
|
1928
1760
|
|
|
1929
1761
|
if (!isUndefined(wrappedGetter)) {
|
|
1930
1762
|
return wrappedGetter;
|
|
@@ -1937,275 +1769,79 @@
|
|
|
1937
1769
|
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
1938
1770
|
};
|
|
1939
1771
|
|
|
1940
|
-
getterMap
|
|
1941
|
-
reverseGetterMap.set(get, originalGet);
|
|
1772
|
+
getterMap.set(originalGet, get);
|
|
1942
1773
|
return get;
|
|
1943
1774
|
}
|
|
1944
1775
|
|
|
1945
1776
|
wrapSetter(originalSet) {
|
|
1946
|
-
const wrappedSetter = setterMap
|
|
1777
|
+
const wrappedSetter = setterMap.get(originalSet);
|
|
1947
1778
|
|
|
1948
1779
|
if (!isUndefined(wrappedSetter)) {
|
|
1949
1780
|
return wrappedSetter;
|
|
1950
1781
|
}
|
|
1951
1782
|
|
|
1952
1783
|
const set = function (v) {
|
|
1953
|
-
// invoking the original setter with the original target
|
|
1954
|
-
originalSet.call(unwrap$1(this), unwrap$1(v));
|
|
1955
1784
|
};
|
|
1956
1785
|
|
|
1957
|
-
setterMap
|
|
1958
|
-
reverseSetterMap.set(set, originalSet);
|
|
1786
|
+
setterMap.set(originalSet, set);
|
|
1959
1787
|
return set;
|
|
1960
1788
|
}
|
|
1961
1789
|
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
// dealing with a data descriptor
|
|
1965
|
-
descriptor.value = unwrap$1(descriptor.value);
|
|
1966
|
-
} else {
|
|
1967
|
-
const {
|
|
1968
|
-
set,
|
|
1969
|
-
get
|
|
1970
|
-
} = descriptor;
|
|
1971
|
-
|
|
1972
|
-
if (!isUndefined(get)) {
|
|
1973
|
-
descriptor.get = this.unwrapGetter(get);
|
|
1974
|
-
}
|
|
1790
|
+
set(shadowTarget, key, value) {
|
|
1791
|
+
/* istanbul ignore next */
|
|
1975
1792
|
|
|
1976
|
-
if (!isUndefined(set)) {
|
|
1977
|
-
descriptor.set = this.unwrapSetter(set);
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
1793
|
|
|
1981
|
-
return
|
|
1794
|
+
return false;
|
|
1982
1795
|
}
|
|
1983
1796
|
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
if (!isUndefined(reverseGetter)) {
|
|
1988
|
-
return reverseGetter;
|
|
1989
|
-
}
|
|
1797
|
+
deleteProperty(shadowTarget, key) {
|
|
1798
|
+
/* istanbul ignore next */
|
|
1990
1799
|
|
|
1991
|
-
const handler = this;
|
|
1992
1800
|
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
return unwrap$1(redGet.call(handler.wrapValue(this)));
|
|
1996
|
-
};
|
|
1801
|
+
return false;
|
|
1802
|
+
}
|
|
1997
1803
|
|
|
1998
|
-
|
|
1999
|
-
reverseGetterMap.set(redGet, get);
|
|
2000
|
-
return get;
|
|
1804
|
+
setPrototypeOf(shadowTarget, prototype) {
|
|
2001
1805
|
}
|
|
2002
1806
|
|
|
2003
|
-
|
|
2004
|
-
|
|
1807
|
+
preventExtensions(shadowTarget) {
|
|
1808
|
+
/* istanbul ignore next */
|
|
2005
1809
|
|
|
2006
|
-
if (!isUndefined(reverseSetter)) {
|
|
2007
|
-
return reverseSetter;
|
|
2008
|
-
}
|
|
2009
1810
|
|
|
2010
|
-
|
|
1811
|
+
return false;
|
|
1812
|
+
}
|
|
2011
1813
|
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
redSet.call(handler.wrapValue(this), handler.wrapValue(v));
|
|
2015
|
-
};
|
|
1814
|
+
defineProperty(shadowTarget, key, descriptor) {
|
|
1815
|
+
/* istanbul ignore next */
|
|
2016
1816
|
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
return set;
|
|
1817
|
+
|
|
1818
|
+
return false;
|
|
2020
1819
|
}
|
|
2021
1820
|
|
|
2022
|
-
|
|
2023
|
-
const {
|
|
2024
|
-
originalTarget,
|
|
2025
|
-
membrane: {
|
|
2026
|
-
valueMutated
|
|
2027
|
-
}
|
|
2028
|
-
} = this;
|
|
2029
|
-
const oldValue = originalTarget[key];
|
|
1821
|
+
}
|
|
2030
1822
|
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
// is updated, the internal length is already equal to the new length value
|
|
2037
|
-
// therefore, the oldValue is equal to the value. This is the forking logic
|
|
2038
|
-
// to support this use case.
|
|
2039
|
-
valueMutated(originalTarget, key);
|
|
2040
|
-
}
|
|
1823
|
+
function defaultValueIsObservable(value) {
|
|
1824
|
+
// intentionally checking for null
|
|
1825
|
+
if (value === null) {
|
|
1826
|
+
return false;
|
|
1827
|
+
} // treat all non-object types, including undefined, as non-observable values
|
|
2041
1828
|
|
|
2042
|
-
return true;
|
|
2043
|
-
}
|
|
2044
1829
|
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
originalTarget,
|
|
2048
|
-
membrane: {
|
|
2049
|
-
valueMutated
|
|
2050
|
-
}
|
|
2051
|
-
} = this;
|
|
2052
|
-
delete originalTarget[key];
|
|
2053
|
-
valueMutated(originalTarget, key);
|
|
2054
|
-
return true;
|
|
1830
|
+
if (typeof value !== 'object') {
|
|
1831
|
+
return false;
|
|
2055
1832
|
}
|
|
2056
1833
|
|
|
2057
|
-
|
|
1834
|
+
if (isArray(value)) {
|
|
1835
|
+
return true;
|
|
2058
1836
|
}
|
|
2059
1837
|
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
originalTarget
|
|
2064
|
-
} = this;
|
|
2065
|
-
preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
|
|
2066
|
-
// the preventExtension call, in which case we should not attempt to lock down
|
|
2067
|
-
// the shadow target.
|
|
2068
|
-
// TODO: It should not actually be possible to reach this `if` statement.
|
|
2069
|
-
// If a proxy rejects extensions, then calling preventExtensions will throw an error:
|
|
2070
|
-
// https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY
|
|
1838
|
+
const proto = getPrototypeOf(value);
|
|
1839
|
+
return proto === ObjectDotPrototype || proto === null || getPrototypeOf(proto) === null;
|
|
1840
|
+
}
|
|
2071
1841
|
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
return false;
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
this.lockShadowTarget(shadowTarget);
|
|
2079
|
-
}
|
|
2080
|
-
|
|
2081
|
-
return true;
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
|
-
defineProperty(shadowTarget, key, descriptor) {
|
|
2085
|
-
const {
|
|
2086
|
-
originalTarget,
|
|
2087
|
-
membrane: {
|
|
2088
|
-
valueMutated,
|
|
2089
|
-
tagPropertyKey
|
|
2090
|
-
}
|
|
2091
|
-
} = this;
|
|
2092
|
-
|
|
2093
|
-
if (key === tagPropertyKey && !hasOwnProperty.call(originalTarget, key)) {
|
|
2094
|
-
// To avoid leaking the membrane tag property into the original target, we must
|
|
2095
|
-
// be sure that the original target doesn't have yet.
|
|
2096
|
-
// NOTE: we do not return false here because Object.freeze and equivalent operations
|
|
2097
|
-
// will attempt to set the descriptor to the same value, and expect no to throw. This
|
|
2098
|
-
// is an small compromise for the sake of not having to diff the descriptors.
|
|
2099
|
-
return true;
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
ObjectDefineProperty(originalTarget, key, this.unwrapDescriptor(descriptor)); // intentionally testing if false since it could be undefined as well
|
|
2103
|
-
|
|
2104
|
-
if (descriptor.configurable === false) {
|
|
2105
|
-
this.copyDescriptorIntoShadowTarget(shadowTarget, key);
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
valueMutated(originalTarget, key);
|
|
2109
|
-
return true;
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
|
-
}
|
|
2113
|
-
|
|
2114
|
-
const getterMap = new WeakMap();
|
|
2115
|
-
const setterMap = new WeakMap();
|
|
2116
|
-
|
|
2117
|
-
class ReadOnlyHandler extends BaseProxyHandler {
|
|
2118
|
-
wrapValue(value) {
|
|
2119
|
-
return this.membrane.getReadOnlyProxy(value);
|
|
2120
|
-
}
|
|
2121
|
-
|
|
2122
|
-
wrapGetter(originalGet) {
|
|
2123
|
-
const wrappedGetter = getterMap.get(originalGet);
|
|
2124
|
-
|
|
2125
|
-
if (!isUndefined(wrappedGetter)) {
|
|
2126
|
-
return wrappedGetter;
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
const handler = this;
|
|
2130
|
-
|
|
2131
|
-
const get = function () {
|
|
2132
|
-
// invoking the original getter with the original target
|
|
2133
|
-
return handler.wrapValue(originalGet.call(unwrap$1(this)));
|
|
2134
|
-
};
|
|
2135
|
-
|
|
2136
|
-
getterMap.set(originalGet, get);
|
|
2137
|
-
return get;
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2140
|
-
wrapSetter(originalSet) {
|
|
2141
|
-
const wrappedSetter = setterMap.get(originalSet);
|
|
2142
|
-
|
|
2143
|
-
if (!isUndefined(wrappedSetter)) {
|
|
2144
|
-
return wrappedSetter;
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
const set = function (v) {
|
|
2148
|
-
};
|
|
2149
|
-
|
|
2150
|
-
setterMap.set(originalSet, set);
|
|
2151
|
-
return set;
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
set(shadowTarget, key, value) {
|
|
2155
|
-
/* istanbul ignore next */
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
return false;
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
deleteProperty(shadowTarget, key) {
|
|
2162
|
-
/* istanbul ignore next */
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
return false;
|
|
2166
|
-
}
|
|
2167
|
-
|
|
2168
|
-
setPrototypeOf(shadowTarget, prototype) {
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2171
|
-
preventExtensions(shadowTarget) {
|
|
2172
|
-
/* istanbul ignore next */
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
return false;
|
|
2176
|
-
}
|
|
2177
|
-
|
|
2178
|
-
defineProperty(shadowTarget, key, descriptor) {
|
|
2179
|
-
/* istanbul ignore next */
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
return false;
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
}
|
|
2186
|
-
|
|
2187
|
-
function defaultValueIsObservable(value) {
|
|
2188
|
-
// intentionally checking for null
|
|
2189
|
-
if (value === null) {
|
|
2190
|
-
return false;
|
|
2191
|
-
} // treat all non-object types, including undefined, as non-observable values
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
if (typeof value !== 'object') {
|
|
2195
|
-
return false;
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
|
-
if (isArray(value)) {
|
|
2199
|
-
return true;
|
|
2200
|
-
}
|
|
2201
|
-
|
|
2202
|
-
const proto = getPrototypeOf(value);
|
|
2203
|
-
return proto === ObjectDotPrototype || proto === null || getPrototypeOf(proto) === null;
|
|
2204
|
-
}
|
|
2205
|
-
|
|
2206
|
-
const defaultValueObserved = (obj, key) => {
|
|
2207
|
-
/* do nothing */
|
|
2208
|
-
};
|
|
1842
|
+
const defaultValueObserved = (obj, key) => {
|
|
1843
|
+
/* do nothing */
|
|
1844
|
+
};
|
|
2209
1845
|
|
|
2210
1846
|
const defaultValueMutated = (obj, key) => {
|
|
2211
1847
|
/* do nothing */
|
|
@@ -3281,67 +2917,400 @@
|
|
|
3281
2917
|
}; // Specify attributes for which we want to reflect changes back to their corresponding
|
|
3282
2918
|
// properties via attributeChangedCallback.
|
|
3283
2919
|
|
|
3284
|
-
defineProperty(HTMLBridgeElement, 'observedAttributes', {
|
|
3285
|
-
get() {
|
|
3286
|
-
return [...superObservedAttributes, ...keys(attributeToPropMap)];
|
|
3287
|
-
}
|
|
2920
|
+
defineProperty(HTMLBridgeElement, 'observedAttributes', {
|
|
2921
|
+
get() {
|
|
2922
|
+
return [...superObservedAttributes, ...keys(attributeToPropMap)];
|
|
2923
|
+
}
|
|
2924
|
+
|
|
2925
|
+
});
|
|
2926
|
+
defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
2927
|
+
return HTMLBridgeElement;
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
|
|
2931
|
+
freeze(BaseBridgeElement);
|
|
2932
|
+
seal(BaseBridgeElement.prototype);
|
|
2933
|
+
/*
|
|
2934
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
|
2935
|
+
* All rights reserved.
|
|
2936
|
+
* SPDX-License-Identifier: MIT
|
|
2937
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2938
|
+
*/
|
|
2939
|
+
|
|
2940
|
+
function resolveCircularModuleDependency(fn) {
|
|
2941
|
+
const module = fn();
|
|
2942
|
+
return (module === null || module === void 0 ? void 0 : module.__esModule) ? module.default : module;
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
function isCircularModuleDependency(obj) {
|
|
2946
|
+
return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
function setActiveVM(vm) {
|
|
2950
|
+
{
|
|
2951
|
+
// this method should never leak to prod
|
|
2952
|
+
throw new ReferenceError();
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
function swapTemplate(oldTpl, newTpl) {
|
|
2957
|
+
|
|
2958
|
+
if (!runtimeFlags.ENABLE_HMR) {
|
|
2959
|
+
throw new Error('HMR is not enabled');
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
return false;
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
function swapComponent(oldComponent, newComponent) {
|
|
2966
|
+
|
|
2967
|
+
if (!runtimeFlags.ENABLE_HMR) {
|
|
2968
|
+
throw new Error('HMR is not enabled');
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2971
|
+
return false;
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
function swapStyle(oldStyle, newStyle) {
|
|
2975
|
+
|
|
2976
|
+
if (!runtimeFlags.ENABLE_HMR) {
|
|
2977
|
+
throw new Error('HMR is not enabled');
|
|
2978
|
+
}
|
|
2979
|
+
|
|
2980
|
+
return false;
|
|
2981
|
+
}
|
|
2982
|
+
/*
|
|
2983
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
2984
|
+
* All rights reserved.
|
|
2985
|
+
* SPDX-License-Identifier: MIT
|
|
2986
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2987
|
+
*/
|
|
2988
|
+
|
|
2989
|
+
|
|
2990
|
+
const CtorToDefMap = new WeakMap();
|
|
2991
|
+
|
|
2992
|
+
function getCtorProto(Ctor) {
|
|
2993
|
+
let proto = getPrototypeOf$1(Ctor);
|
|
2994
|
+
|
|
2995
|
+
if (isNull(proto)) {
|
|
2996
|
+
throw new ReferenceError(`Invalid prototype chain for ${Ctor.name}, you must extend LightningElement.`);
|
|
2997
|
+
} // covering the cases where the ref is circular in AMD
|
|
2998
|
+
|
|
2999
|
+
|
|
3000
|
+
if (isCircularModuleDependency(proto)) {
|
|
3001
|
+
const p = resolveCircularModuleDependency(proto);
|
|
3002
|
+
// of our Base class without having to leak it to user-land. If the circular function returns
|
|
3003
|
+
// itself, that's the signal that we have hit the end of the proto chain, which must always
|
|
3004
|
+
// be base.
|
|
3005
|
+
|
|
3006
|
+
|
|
3007
|
+
proto = p === proto ? LightningElement : p;
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
return proto;
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
function createComponentDef(Ctor) {
|
|
3014
|
+
const {
|
|
3015
|
+
shadowSupportMode: ctorShadowSupportMode,
|
|
3016
|
+
renderMode: ctorRenderMode
|
|
3017
|
+
} = Ctor;
|
|
3018
|
+
|
|
3019
|
+
const decoratorsMeta = getDecoratorsMeta(Ctor);
|
|
3020
|
+
const {
|
|
3021
|
+
apiFields,
|
|
3022
|
+
apiFieldsConfig,
|
|
3023
|
+
apiMethods,
|
|
3024
|
+
wiredFields,
|
|
3025
|
+
wiredMethods,
|
|
3026
|
+
observedFields
|
|
3027
|
+
} = decoratorsMeta;
|
|
3028
|
+
const proto = Ctor.prototype;
|
|
3029
|
+
let {
|
|
3030
|
+
connectedCallback,
|
|
3031
|
+
disconnectedCallback,
|
|
3032
|
+
renderedCallback,
|
|
3033
|
+
errorCallback,
|
|
3034
|
+
render
|
|
3035
|
+
} = proto;
|
|
3036
|
+
const superProto = getCtorProto(Ctor);
|
|
3037
|
+
const superDef = superProto !== LightningElement ? getComponentInternalDef(superProto) : lightingElementDef;
|
|
3038
|
+
const bridge = HTMLBridgeElementFactory(superDef.bridge, keys(apiFields), keys(apiMethods));
|
|
3039
|
+
const props = assign(create(null), superDef.props, apiFields);
|
|
3040
|
+
const propsConfig = assign(create(null), superDef.propsConfig, apiFieldsConfig);
|
|
3041
|
+
const methods = assign(create(null), superDef.methods, apiMethods);
|
|
3042
|
+
const wire = assign(create(null), superDef.wire, wiredFields, wiredMethods);
|
|
3043
|
+
connectedCallback = connectedCallback || superDef.connectedCallback;
|
|
3044
|
+
disconnectedCallback = disconnectedCallback || superDef.disconnectedCallback;
|
|
3045
|
+
renderedCallback = renderedCallback || superDef.renderedCallback;
|
|
3046
|
+
errorCallback = errorCallback || superDef.errorCallback;
|
|
3047
|
+
render = render || superDef.render;
|
|
3048
|
+
let shadowSupportMode = superDef.shadowSupportMode;
|
|
3049
|
+
|
|
3050
|
+
if (!isUndefined$1(ctorShadowSupportMode)) {
|
|
3051
|
+
shadowSupportMode = ctorShadowSupportMode;
|
|
3052
|
+
}
|
|
3053
|
+
|
|
3054
|
+
let renderMode = superDef.renderMode;
|
|
3055
|
+
|
|
3056
|
+
if (!isUndefined$1(ctorRenderMode)) {
|
|
3057
|
+
renderMode = ctorRenderMode === 'light' ? 0
|
|
3058
|
+
/* Light */
|
|
3059
|
+
: 1
|
|
3060
|
+
/* Shadow */
|
|
3061
|
+
;
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
const template = getComponentRegisteredTemplate(Ctor) || superDef.template;
|
|
3065
|
+
const name = Ctor.name || superDef.name; // installing observed fields into the prototype.
|
|
3066
|
+
|
|
3067
|
+
defineProperties(proto, observedFields);
|
|
3068
|
+
const def = {
|
|
3069
|
+
ctor: Ctor,
|
|
3070
|
+
name,
|
|
3071
|
+
wire,
|
|
3072
|
+
props,
|
|
3073
|
+
propsConfig,
|
|
3074
|
+
methods,
|
|
3075
|
+
bridge,
|
|
3076
|
+
template,
|
|
3077
|
+
renderMode,
|
|
3078
|
+
shadowSupportMode,
|
|
3079
|
+
connectedCallback,
|
|
3080
|
+
disconnectedCallback,
|
|
3081
|
+
renderedCallback,
|
|
3082
|
+
errorCallback,
|
|
3083
|
+
render
|
|
3084
|
+
};
|
|
3085
|
+
|
|
3086
|
+
return def;
|
|
3087
|
+
}
|
|
3088
|
+
/**
|
|
3089
|
+
* EXPERIMENTAL: This function allows for the identification of LWC constructors. This API is
|
|
3090
|
+
* subject to change or being removed.
|
|
3091
|
+
*/
|
|
3092
|
+
|
|
3093
|
+
|
|
3094
|
+
function isComponentConstructor(ctor) {
|
|
3095
|
+
if (!isFunction$1(ctor)) {
|
|
3096
|
+
return false;
|
|
3097
|
+
} // Fast path: LightningElement is part of the prototype chain of the constructor.
|
|
3098
|
+
|
|
3099
|
+
|
|
3100
|
+
if (ctor.prototype instanceof LightningElement) {
|
|
3101
|
+
return true;
|
|
3102
|
+
} // Slow path: LightningElement is not part of the prototype chain of the constructor, we need
|
|
3103
|
+
// climb up the constructor prototype chain to check in case there are circular dependencies
|
|
3104
|
+
// to resolve.
|
|
3105
|
+
|
|
3106
|
+
|
|
3107
|
+
let current = ctor;
|
|
3108
|
+
|
|
3109
|
+
do {
|
|
3110
|
+
if (isCircularModuleDependency(current)) {
|
|
3111
|
+
const circularResolved = resolveCircularModuleDependency(current); // If the circular function returns itself, that's the signal that we have hit the end
|
|
3112
|
+
// of the proto chain, which must always be a valid base constructor.
|
|
3113
|
+
|
|
3114
|
+
if (circularResolved === current) {
|
|
3115
|
+
return true;
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
current = circularResolved;
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
if (current === LightningElement) {
|
|
3122
|
+
return true;
|
|
3123
|
+
}
|
|
3124
|
+
} while (!isNull(current) && (current = getPrototypeOf$1(current))); // Finally return false if the LightningElement is not part of the prototype chain.
|
|
3125
|
+
|
|
3126
|
+
|
|
3127
|
+
return false;
|
|
3128
|
+
}
|
|
3129
|
+
|
|
3130
|
+
function getComponentInternalDef(Ctor) {
|
|
3131
|
+
|
|
3132
|
+
let def = CtorToDefMap.get(Ctor);
|
|
3133
|
+
|
|
3134
|
+
if (isUndefined$1(def)) {
|
|
3135
|
+
if (isCircularModuleDependency(Ctor)) {
|
|
3136
|
+
const resolvedCtor = resolveCircularModuleDependency(Ctor);
|
|
3137
|
+
def = getComponentInternalDef(resolvedCtor); // Cache the unresolved component ctor too. The next time if the same unresolved ctor is used,
|
|
3138
|
+
// look up the definition in cache instead of re-resolving and recreating the def.
|
|
3139
|
+
|
|
3140
|
+
CtorToDefMap.set(Ctor, def);
|
|
3141
|
+
return def;
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
if (!isComponentConstructor(Ctor)) {
|
|
3145
|
+
throw new TypeError(`${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.`);
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
def = createComponentDef(Ctor);
|
|
3149
|
+
CtorToDefMap.set(Ctor, def);
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
return def;
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
const lightingElementDef = {
|
|
3156
|
+
ctor: LightningElement,
|
|
3157
|
+
name: LightningElement.name,
|
|
3158
|
+
props: lightningBasedDescriptors,
|
|
3159
|
+
propsConfig: EmptyObject,
|
|
3160
|
+
methods: EmptyObject,
|
|
3161
|
+
renderMode: 1
|
|
3162
|
+
/* Shadow */
|
|
3163
|
+
,
|
|
3164
|
+
shadowSupportMode: "reset"
|
|
3165
|
+
/* Default */
|
|
3166
|
+
,
|
|
3167
|
+
wire: EmptyObject,
|
|
3168
|
+
bridge: BaseBridgeElement,
|
|
3169
|
+
template: defaultEmptyTemplate,
|
|
3170
|
+
render: LightningElement.prototype.render
|
|
3171
|
+
};
|
|
3172
|
+
/**
|
|
3173
|
+
* EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
|
|
3174
|
+
* subject to change or being removed.
|
|
3175
|
+
*/
|
|
3176
|
+
|
|
3177
|
+
function getComponentDef(Ctor) {
|
|
3178
|
+
const def = getComponentInternalDef(Ctor); // From the internal def object, we need to extract the info that is useful
|
|
3179
|
+
// for some external services, e.g.: Locker Service, usually, all they care
|
|
3180
|
+
// is about the shape of the constructor, the internals of it are not relevant
|
|
3181
|
+
// because they don't have a way to mess with that.
|
|
3182
|
+
|
|
3183
|
+
const {
|
|
3184
|
+
ctor,
|
|
3185
|
+
name,
|
|
3186
|
+
props,
|
|
3187
|
+
propsConfig,
|
|
3188
|
+
methods
|
|
3189
|
+
} = def;
|
|
3190
|
+
const publicProps = {};
|
|
3191
|
+
|
|
3192
|
+
for (const key in props) {
|
|
3193
|
+
// avoid leaking the reference to the public props descriptors
|
|
3194
|
+
publicProps[key] = {
|
|
3195
|
+
config: propsConfig[key] || 0,
|
|
3196
|
+
type: "any"
|
|
3197
|
+
/* any */
|
|
3198
|
+
,
|
|
3199
|
+
attr: htmlPropertyToAttribute(key)
|
|
3200
|
+
};
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
const publicMethods = {};
|
|
3204
|
+
|
|
3205
|
+
for (const key in methods) {
|
|
3206
|
+
// avoid leaking the reference to the public method descriptors
|
|
3207
|
+
publicMethods[key] = methods[key].value;
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
return {
|
|
3211
|
+
ctor,
|
|
3212
|
+
name,
|
|
3213
|
+
props: publicProps,
|
|
3214
|
+
methods: publicMethods
|
|
3215
|
+
};
|
|
3216
|
+
}
|
|
3217
|
+
/*
|
|
3218
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3219
|
+
* All rights reserved.
|
|
3220
|
+
* SPDX-License-Identifier: MIT
|
|
3221
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3222
|
+
*/
|
|
3223
|
+
|
|
3224
|
+
|
|
3225
|
+
const xlinkNS = 'http://www.w3.org/1999/xlink';
|
|
3226
|
+
const xmlNS = 'http://www.w3.org/XML/1998/namespace';
|
|
3227
|
+
const ColonCharCode = 58;
|
|
3228
|
+
|
|
3229
|
+
function patchAttributes(oldVnode, vnode) {
|
|
3230
|
+
const {
|
|
3231
|
+
attrs
|
|
3232
|
+
} = vnode.data;
|
|
3233
|
+
|
|
3234
|
+
if (isUndefined$1(attrs)) {
|
|
3235
|
+
return;
|
|
3236
|
+
}
|
|
3237
|
+
|
|
3238
|
+
const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
|
|
3239
|
+
|
|
3240
|
+
if (oldAttrs === attrs) {
|
|
3241
|
+
return;
|
|
3242
|
+
}
|
|
3243
|
+
|
|
3244
|
+
const {
|
|
3245
|
+
elm
|
|
3246
|
+
} = vnode;
|
|
3247
|
+
|
|
3248
|
+
for (const key in attrs) {
|
|
3249
|
+
const cur = attrs[key];
|
|
3250
|
+
const old = oldAttrs[key];
|
|
3251
|
+
|
|
3252
|
+
if (old !== cur) {
|
|
3253
|
+
unlockAttribute(elm, key);
|
|
3254
|
+
|
|
3255
|
+
if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
|
|
3256
|
+
// Assume xml namespace
|
|
3257
|
+
setAttribute$1(elm, key, cur, xmlNS);
|
|
3258
|
+
} else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
|
|
3259
|
+
// Assume xlink namespace
|
|
3260
|
+
setAttribute$1(elm, key, cur, xlinkNS);
|
|
3261
|
+
} else if (isNull(cur) || isUndefined$1(cur)) {
|
|
3262
|
+
removeAttribute$1(elm, key);
|
|
3263
|
+
} else {
|
|
3264
|
+
setAttribute$1(elm, key, cur);
|
|
3265
|
+
}
|
|
3288
3266
|
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3267
|
+
lockAttribute();
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3292
3270
|
}
|
|
3293
|
-
|
|
3294
|
-
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
|
|
3295
|
-
freeze(BaseBridgeElement);
|
|
3296
|
-
seal(BaseBridgeElement.prototype);
|
|
3297
3271
|
/*
|
|
3298
|
-
* Copyright (c)
|
|
3272
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3299
3273
|
* All rights reserved.
|
|
3300
3274
|
* SPDX-License-Identifier: MIT
|
|
3301
3275
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3302
3276
|
*/
|
|
3303
3277
|
|
|
3304
|
-
function resolveCircularModuleDependency(fn) {
|
|
3305
|
-
const module = fn();
|
|
3306
|
-
return (module === null || module === void 0 ? void 0 : module.__esModule) ? module.default : module;
|
|
3307
|
-
}
|
|
3308
|
-
|
|
3309
|
-
function isCircularModuleDependency(obj) {
|
|
3310
|
-
return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
|
|
3311
|
-
}
|
|
3312
3278
|
|
|
3313
|
-
function
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
}
|
|
3279
|
+
function isLiveBindingProp(sel, key) {
|
|
3280
|
+
// For properties with live bindings, we read values from the DOM element
|
|
3281
|
+
// instead of relying on internally tracked values.
|
|
3282
|
+
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3318
3283
|
}
|
|
3319
3284
|
|
|
3320
|
-
function
|
|
3285
|
+
function patchProps(oldVnode, vnode) {
|
|
3286
|
+
const {
|
|
3287
|
+
props
|
|
3288
|
+
} = vnode.data;
|
|
3321
3289
|
|
|
3322
|
-
if (
|
|
3323
|
-
|
|
3290
|
+
if (isUndefined$1(props)) {
|
|
3291
|
+
return;
|
|
3324
3292
|
}
|
|
3325
3293
|
|
|
3326
|
-
|
|
3327
|
-
}
|
|
3328
|
-
|
|
3329
|
-
function swapComponent(oldComponent, newComponent) {
|
|
3294
|
+
const oldProps = isNull(oldVnode) ? EmptyObject : oldVnode.data.props;
|
|
3330
3295
|
|
|
3331
|
-
if (
|
|
3332
|
-
|
|
3296
|
+
if (oldProps === props) {
|
|
3297
|
+
return;
|
|
3333
3298
|
}
|
|
3334
3299
|
|
|
3335
|
-
|
|
3336
|
-
|
|
3300
|
+
const isFirstPatch = isNull(oldVnode);
|
|
3301
|
+
const {
|
|
3302
|
+
elm,
|
|
3303
|
+
sel
|
|
3304
|
+
} = vnode;
|
|
3337
3305
|
|
|
3338
|
-
|
|
3306
|
+
for (const key in props) {
|
|
3307
|
+
const cur = props[key]; // Set the property if it's the first time is is patched or if the previous property is
|
|
3308
|
+
// different than the one previously set.
|
|
3339
3309
|
|
|
3340
|
-
|
|
3341
|
-
|
|
3310
|
+
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty$1(elm, key) : oldProps[key])) {
|
|
3311
|
+
setProperty$1(elm, key, cur);
|
|
3312
|
+
}
|
|
3342
3313
|
}
|
|
3343
|
-
|
|
3344
|
-
return false;
|
|
3345
3314
|
}
|
|
3346
3315
|
/*
|
|
3347
3316
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3351,232 +3320,183 @@
|
|
|
3351
3320
|
*/
|
|
3352
3321
|
|
|
3353
3322
|
|
|
3354
|
-
const
|
|
3323
|
+
const classNameToClassMap = create(null);
|
|
3355
3324
|
|
|
3356
|
-
function
|
|
3357
|
-
|
|
3325
|
+
function getMapFromClassName(className) {
|
|
3326
|
+
// Intentionally using == to match undefined and null values from computed style attribute
|
|
3327
|
+
if (className == null) {
|
|
3328
|
+
return EmptyObject;
|
|
3329
|
+
} // computed class names must be string
|
|
3358
3330
|
|
|
3359
|
-
if (isNull(proto)) {
|
|
3360
|
-
throw new ReferenceError(`Invalid prototype chain for ${Ctor.name}, you must extend LightningElement.`);
|
|
3361
|
-
} // covering the cases where the ref is circular in AMD
|
|
3362
3331
|
|
|
3332
|
+
className = isString(className) ? className : className + '';
|
|
3333
|
+
let map = classNameToClassMap[className];
|
|
3363
3334
|
|
|
3364
|
-
if (
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
// itself, that's the signal that we have hit the end of the proto chain, which must always
|
|
3368
|
-
// be base.
|
|
3335
|
+
if (map) {
|
|
3336
|
+
return map;
|
|
3337
|
+
}
|
|
3369
3338
|
|
|
3339
|
+
map = create(null);
|
|
3340
|
+
let start = 0;
|
|
3341
|
+
let o;
|
|
3342
|
+
const len = className.length;
|
|
3370
3343
|
|
|
3371
|
-
|
|
3344
|
+
for (o = 0; o < len; o++) {
|
|
3345
|
+
if (StringCharCodeAt.call(className, o) === SPACE_CHAR) {
|
|
3346
|
+
if (o > start) {
|
|
3347
|
+
map[StringSlice.call(className, start, o)] = true;
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3350
|
+
start = o + 1;
|
|
3351
|
+
}
|
|
3372
3352
|
}
|
|
3373
3353
|
|
|
3374
|
-
|
|
3375
|
-
|
|
3354
|
+
if (o > start) {
|
|
3355
|
+
map[StringSlice.call(className, start, o)] = true;
|
|
3356
|
+
}
|
|
3376
3357
|
|
|
3377
|
-
|
|
3378
|
-
const {
|
|
3379
|
-
shadowSupportMode: ctorShadowSupportMode,
|
|
3380
|
-
renderMode: ctorRenderMode
|
|
3381
|
-
} = Ctor;
|
|
3358
|
+
classNameToClassMap[className] = map;
|
|
3382
3359
|
|
|
3383
|
-
|
|
3360
|
+
return map;
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
function patchClassAttribute(oldVnode, vnode) {
|
|
3384
3364
|
const {
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
} = decoratorsMeta;
|
|
3392
|
-
const proto = Ctor.prototype;
|
|
3393
|
-
let {
|
|
3394
|
-
connectedCallback,
|
|
3395
|
-
disconnectedCallback,
|
|
3396
|
-
renderedCallback,
|
|
3397
|
-
errorCallback,
|
|
3398
|
-
render
|
|
3399
|
-
} = proto;
|
|
3400
|
-
const superProto = getCtorProto(Ctor);
|
|
3401
|
-
const superDef = superProto !== LightningElement ? getComponentInternalDef(superProto) : lightingElementDef;
|
|
3402
|
-
const bridge = HTMLBridgeElementFactory(superDef.bridge, keys(apiFields), keys(apiMethods));
|
|
3403
|
-
const props = assign(create(null), superDef.props, apiFields);
|
|
3404
|
-
const propsConfig = assign(create(null), superDef.propsConfig, apiFieldsConfig);
|
|
3405
|
-
const methods = assign(create(null), superDef.methods, apiMethods);
|
|
3406
|
-
const wire = assign(create(null), superDef.wire, wiredFields, wiredMethods);
|
|
3407
|
-
connectedCallback = connectedCallback || superDef.connectedCallback;
|
|
3408
|
-
disconnectedCallback = disconnectedCallback || superDef.disconnectedCallback;
|
|
3409
|
-
renderedCallback = renderedCallback || superDef.renderedCallback;
|
|
3410
|
-
errorCallback = errorCallback || superDef.errorCallback;
|
|
3411
|
-
render = render || superDef.render;
|
|
3412
|
-
let shadowSupportMode = superDef.shadowSupportMode;
|
|
3365
|
+
elm,
|
|
3366
|
+
data: {
|
|
3367
|
+
className: newClass
|
|
3368
|
+
}
|
|
3369
|
+
} = vnode;
|
|
3370
|
+
const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;
|
|
3413
3371
|
|
|
3414
|
-
if (
|
|
3415
|
-
|
|
3372
|
+
if (oldClass === newClass) {
|
|
3373
|
+
return;
|
|
3416
3374
|
}
|
|
3417
3375
|
|
|
3418
|
-
|
|
3376
|
+
const classList = getClassList$1(elm);
|
|
3377
|
+
const newClassMap = getMapFromClassName(newClass);
|
|
3378
|
+
const oldClassMap = getMapFromClassName(oldClass);
|
|
3379
|
+
let name;
|
|
3419
3380
|
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
;
|
|
3381
|
+
for (name in oldClassMap) {
|
|
3382
|
+
// remove only if it is not in the new class collection and it is not set from within the instance
|
|
3383
|
+
if (isUndefined$1(newClassMap[name])) {
|
|
3384
|
+
classList.remove(name);
|
|
3385
|
+
}
|
|
3426
3386
|
}
|
|
3427
3387
|
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
ctor: Ctor,
|
|
3434
|
-
name,
|
|
3435
|
-
wire,
|
|
3436
|
-
props,
|
|
3437
|
-
propsConfig,
|
|
3438
|
-
methods,
|
|
3439
|
-
bridge,
|
|
3440
|
-
template,
|
|
3441
|
-
renderMode,
|
|
3442
|
-
shadowSupportMode,
|
|
3443
|
-
connectedCallback,
|
|
3444
|
-
disconnectedCallback,
|
|
3445
|
-
renderedCallback,
|
|
3446
|
-
errorCallback,
|
|
3447
|
-
render
|
|
3448
|
-
};
|
|
3449
|
-
|
|
3450
|
-
return def;
|
|
3388
|
+
for (name in newClassMap) {
|
|
3389
|
+
if (isUndefined$1(oldClassMap[name])) {
|
|
3390
|
+
classList.add(name);
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3451
3393
|
}
|
|
3452
|
-
|
|
3453
|
-
*
|
|
3454
|
-
*
|
|
3394
|
+
/*
|
|
3395
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3396
|
+
* All rights reserved.
|
|
3397
|
+
* SPDX-License-Identifier: MIT
|
|
3398
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3455
3399
|
*/
|
|
3456
3400
|
|
|
3457
3401
|
|
|
3458
|
-
function
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
} // Slow path: LightningElement is not part of the prototype chain of the constructor, we need
|
|
3467
|
-
// climb up the constructor prototype chain to check in case there are circular dependencies
|
|
3468
|
-
// to resolve.
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
let current = ctor;
|
|
3402
|
+
function patchStyleAttribute(oldVnode, vnode) {
|
|
3403
|
+
const {
|
|
3404
|
+
elm,
|
|
3405
|
+
data: {
|
|
3406
|
+
style: newStyle
|
|
3407
|
+
}
|
|
3408
|
+
} = vnode;
|
|
3409
|
+
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
|
3472
3410
|
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
// of the proto chain, which must always be a valid base constructor.
|
|
3411
|
+
if (oldStyle === newStyle) {
|
|
3412
|
+
return;
|
|
3413
|
+
}
|
|
3477
3414
|
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3415
|
+
if (!isString(newStyle) || newStyle === '') {
|
|
3416
|
+
removeAttribute$1(elm, 'style');
|
|
3417
|
+
} else {
|
|
3418
|
+
setAttribute$1(elm, 'style', newStyle);
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
/*
|
|
3422
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3423
|
+
* All rights reserved.
|
|
3424
|
+
* SPDX-License-Identifier: MIT
|
|
3425
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3426
|
+
*/
|
|
3481
3427
|
|
|
3482
|
-
current = circularResolved;
|
|
3483
|
-
}
|
|
3484
3428
|
|
|
3485
|
-
|
|
3486
|
-
|
|
3429
|
+
function applyEventListeners(vnode) {
|
|
3430
|
+
const {
|
|
3431
|
+
elm,
|
|
3432
|
+
data: {
|
|
3433
|
+
on
|
|
3487
3434
|
}
|
|
3488
|
-
}
|
|
3435
|
+
} = vnode;
|
|
3489
3436
|
|
|
3437
|
+
if (isUndefined$1(on)) {
|
|
3438
|
+
return;
|
|
3439
|
+
}
|
|
3490
3440
|
|
|
3491
|
-
|
|
3441
|
+
for (const name in on) {
|
|
3442
|
+
const handler = on[name];
|
|
3443
|
+
addEventListener$1(elm, name, handler);
|
|
3444
|
+
}
|
|
3492
3445
|
}
|
|
3446
|
+
/*
|
|
3447
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3448
|
+
* All rights reserved.
|
|
3449
|
+
* SPDX-License-Identifier: MIT
|
|
3450
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3451
|
+
*/
|
|
3452
|
+
// The compiler takes care of transforming the inline classnames into an object. It's faster to set the
|
|
3453
|
+
// different classnames properties individually instead of via a string.
|
|
3493
3454
|
|
|
3494
|
-
function getComponentInternalDef(Ctor) {
|
|
3495
|
-
|
|
3496
|
-
let def = CtorToDefMap.get(Ctor);
|
|
3497
|
-
|
|
3498
|
-
if (isUndefined$1(def)) {
|
|
3499
|
-
if (isCircularModuleDependency(Ctor)) {
|
|
3500
|
-
const resolvedCtor = resolveCircularModuleDependency(Ctor);
|
|
3501
|
-
def = getComponentInternalDef(resolvedCtor); // Cache the unresolved component ctor too. The next time if the same unresolved ctor is used,
|
|
3502
|
-
// look up the definition in cache instead of re-resolving and recreating the def.
|
|
3503
|
-
|
|
3504
|
-
CtorToDefMap.set(Ctor, def);
|
|
3505
|
-
return def;
|
|
3506
|
-
}
|
|
3507
3455
|
|
|
3508
|
-
|
|
3509
|
-
|
|
3456
|
+
function applyStaticClassAttribute(vnode) {
|
|
3457
|
+
const {
|
|
3458
|
+
elm,
|
|
3459
|
+
data: {
|
|
3460
|
+
classMap
|
|
3510
3461
|
}
|
|
3462
|
+
} = vnode;
|
|
3511
3463
|
|
|
3512
|
-
|
|
3513
|
-
|
|
3464
|
+
if (isUndefined$1(classMap)) {
|
|
3465
|
+
return;
|
|
3514
3466
|
}
|
|
3515
3467
|
|
|
3516
|
-
|
|
3517
|
-
}
|
|
3468
|
+
const classList = getClassList$1(elm);
|
|
3518
3469
|
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
shadowSupportMode: "reset"
|
|
3529
|
-
/* Default */
|
|
3530
|
-
,
|
|
3531
|
-
wire: EmptyObject,
|
|
3532
|
-
bridge: BaseBridgeElement,
|
|
3533
|
-
template: defaultEmptyTemplate,
|
|
3534
|
-
render: LightningElement.prototype.render
|
|
3535
|
-
};
|
|
3536
|
-
/**
|
|
3537
|
-
* EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
|
|
3538
|
-
* subject to change or being removed.
|
|
3470
|
+
for (const name in classMap) {
|
|
3471
|
+
classList.add(name);
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
/*
|
|
3475
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
3476
|
+
* All rights reserved.
|
|
3477
|
+
* SPDX-License-Identifier: MIT
|
|
3478
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
3539
3479
|
*/
|
|
3480
|
+
// The compiler takes care of transforming the inline style into an object. It's faster to set the
|
|
3481
|
+
// different style properties individually instead of via a string.
|
|
3540
3482
|
|
|
3541
|
-
function getComponentDef(Ctor) {
|
|
3542
|
-
const def = getComponentInternalDef(Ctor); // From the internal def object, we need to extract the info that is useful
|
|
3543
|
-
// for some external services, e.g.: Locker Service, usually, all they care
|
|
3544
|
-
// is about the shape of the constructor, the internals of it are not relevant
|
|
3545
|
-
// because they don't have a way to mess with that.
|
|
3546
3483
|
|
|
3484
|
+
function applyStaticStyleAttribute(vnode) {
|
|
3547
3485
|
const {
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
} = def;
|
|
3554
|
-
const publicProps = {};
|
|
3486
|
+
elm,
|
|
3487
|
+
data: {
|
|
3488
|
+
styleDecls
|
|
3489
|
+
}
|
|
3490
|
+
} = vnode;
|
|
3555
3491
|
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
publicProps[key] = {
|
|
3559
|
-
config: propsConfig[key] || 0,
|
|
3560
|
-
type: "any"
|
|
3561
|
-
/* any */
|
|
3562
|
-
,
|
|
3563
|
-
attr: htmlPropertyToAttribute(key)
|
|
3564
|
-
};
|
|
3492
|
+
if (isUndefined$1(styleDecls)) {
|
|
3493
|
+
return;
|
|
3565
3494
|
}
|
|
3566
3495
|
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
// avoid leaking the reference to the public method descriptors
|
|
3571
|
-
publicMethods[key] = methods[key].value;
|
|
3496
|
+
for (let i = 0; i < styleDecls.length; i++) {
|
|
3497
|
+
const [prop, value, important] = styleDecls[i];
|
|
3498
|
+
setCSSStyleProperty$1(elm, prop, value, important);
|
|
3572
3499
|
}
|
|
3573
|
-
|
|
3574
|
-
return {
|
|
3575
|
-
ctor,
|
|
3576
|
-
name,
|
|
3577
|
-
props: publicProps,
|
|
3578
|
-
methods: publicMethods
|
|
3579
|
-
};
|
|
3580
3500
|
}
|
|
3581
3501
|
/*
|
|
3582
3502
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3629,28 +3549,24 @@
|
|
|
3629
3549
|
remove$1(vnode.elm, parentNode);
|
|
3630
3550
|
}
|
|
3631
3551
|
|
|
3632
|
-
function
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3552
|
+
function patchElementPropsAndAttrs(oldVnode, vnode) {
|
|
3553
|
+
if (isNull(oldVnode)) {
|
|
3554
|
+
applyEventListeners(vnode);
|
|
3555
|
+
applyStaticClassAttribute(vnode);
|
|
3556
|
+
applyStaticStyleAttribute(vnode);
|
|
3557
|
+
} // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
3558
|
+
// value is set before type=radio.
|
|
3636
3559
|
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
modComputedStyle.create(vnode);
|
|
3560
|
+
|
|
3561
|
+
patchClassAttribute(oldVnode, vnode);
|
|
3562
|
+
patchStyleAttribute(oldVnode, vnode);
|
|
3563
|
+
patchAttributes(oldVnode, vnode);
|
|
3564
|
+
patchProps(oldVnode, vnode);
|
|
3643
3565
|
}
|
|
3644
3566
|
|
|
3645
3567
|
function hydrateElmHook(vnode) {
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
modProps.create(vnode); // Already set.
|
|
3650
|
-
// modStaticClassName.create(vnode);
|
|
3651
|
-
// modStaticStyle.create(vnode);
|
|
3652
|
-
// modComputedClassName.create(vnode);
|
|
3653
|
-
// modComputedStyle.create(vnode);
|
|
3568
|
+
applyEventListeners(vnode);
|
|
3569
|
+
patchProps(null, vnode);
|
|
3654
3570
|
}
|
|
3655
3571
|
|
|
3656
3572
|
function fallbackElmHook(elm, vnode) {
|
|
@@ -3684,26 +3600,11 @@
|
|
|
3684
3600
|
}
|
|
3685
3601
|
}
|
|
3686
3602
|
|
|
3687
|
-
function
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
// is set before type=radio.
|
|
3691
|
-
modAttrs.update(oldVnode, vnode);
|
|
3692
|
-
modProps.update(oldVnode, vnode);
|
|
3693
|
-
modComputedClassName.update(oldVnode, vnode);
|
|
3694
|
-
modComputedStyle.update(oldVnode, vnode);
|
|
3695
|
-
}
|
|
3696
|
-
|
|
3697
|
-
function updateChildrenHook(oldVnode, vnode) {
|
|
3698
|
-
const {
|
|
3699
|
-
elm,
|
|
3700
|
-
children
|
|
3701
|
-
} = vnode;
|
|
3702
|
-
|
|
3703
|
-
if (hasDynamicChildren(children)) {
|
|
3704
|
-
updateDynamicChildren(elm, oldVnode.children, children);
|
|
3603
|
+
function patchChildren(parent, oldCh, newCh) {
|
|
3604
|
+
if (hasDynamicChildren(newCh)) {
|
|
3605
|
+
updateDynamicChildren(parent, oldCh, newCh);
|
|
3705
3606
|
} else {
|
|
3706
|
-
updateStaticChildren(
|
|
3607
|
+
updateStaticChildren(parent, oldCh, newCh);
|
|
3707
3608
|
}
|
|
3708
3609
|
}
|
|
3709
3610
|
|
|
@@ -3774,19 +3675,6 @@
|
|
|
3774
3675
|
});
|
|
3775
3676
|
}
|
|
3776
3677
|
|
|
3777
|
-
function createCustomElmHook(vnode) {
|
|
3778
|
-
modEvents.create(vnode); // Attrs need to be applied to element before props
|
|
3779
|
-
// IE11 will wipe out value on radio inputs if value
|
|
3780
|
-
// is set before type=radio.
|
|
3781
|
-
|
|
3782
|
-
modAttrs.create(vnode);
|
|
3783
|
-
modProps.create(vnode);
|
|
3784
|
-
modStaticClassName.create(vnode);
|
|
3785
|
-
modStaticStyle.create(vnode);
|
|
3786
|
-
modComputedClassName.create(vnode);
|
|
3787
|
-
modComputedStyle.create(vnode);
|
|
3788
|
-
}
|
|
3789
|
-
|
|
3790
3678
|
function createChildrenHook(vnode) {
|
|
3791
3679
|
const {
|
|
3792
3680
|
elm,
|
|
@@ -3819,16 +3707,6 @@
|
|
|
3819
3707
|
}
|
|
3820
3708
|
}
|
|
3821
3709
|
|
|
3822
|
-
function updateCustomElmHook(oldVnode, vnode) {
|
|
3823
|
-
// Attrs need to be applied to element before props
|
|
3824
|
-
// IE11 will wipe out value on radio inputs if value
|
|
3825
|
-
// is set before type=radio.
|
|
3826
|
-
modAttrs.update(oldVnode, vnode);
|
|
3827
|
-
modProps.update(oldVnode, vnode);
|
|
3828
|
-
modComputedClassName.update(oldVnode, vnode);
|
|
3829
|
-
modComputedStyle.update(oldVnode, vnode);
|
|
3830
|
-
}
|
|
3831
|
-
|
|
3832
3710
|
function removeElmHook(vnode) {
|
|
3833
3711
|
// this method only needs to search on child vnodes from template
|
|
3834
3712
|
// to trigger the remove hook just in case some of those children
|
|
@@ -3845,6 +3723,66 @@
|
|
|
3845
3723
|
ch.hook.remove(ch, elm);
|
|
3846
3724
|
}
|
|
3847
3725
|
}
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3728
|
+
function allocateInSlot(vm, children) {
|
|
3729
|
+
const {
|
|
3730
|
+
cmpSlots: oldSlots
|
|
3731
|
+
} = vm;
|
|
3732
|
+
const cmpSlots = vm.cmpSlots = create(null);
|
|
3733
|
+
|
|
3734
|
+
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
3735
|
+
const vnode = children[i];
|
|
3736
|
+
|
|
3737
|
+
if (isNull(vnode)) {
|
|
3738
|
+
continue;
|
|
3739
|
+
}
|
|
3740
|
+
|
|
3741
|
+
const {
|
|
3742
|
+
data
|
|
3743
|
+
} = vnode;
|
|
3744
|
+
const slotName = data.attrs && data.attrs.slot || '';
|
|
3745
|
+
const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot
|
|
3746
|
+
// which might have similar keys. Each vnode will always have a key that
|
|
3747
|
+
// starts with a numeric character from compiler. In this case, we add a unique
|
|
3748
|
+
// notation for slotted vnodes keys, e.g.: `@foo:1:1`
|
|
3749
|
+
|
|
3750
|
+
if (!isUndefined$1(vnode.key)) {
|
|
3751
|
+
vnode.key = `@${slotName}:${vnode.key}`;
|
|
3752
|
+
}
|
|
3753
|
+
|
|
3754
|
+
ArrayPush$1.call(vnodes, vnode);
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3757
|
+
if (isFalse(vm.isDirty)) {
|
|
3758
|
+
// We need to determine if the old allocation is really different from the new one
|
|
3759
|
+
// and mark the vm as dirty
|
|
3760
|
+
const oldKeys = keys(oldSlots);
|
|
3761
|
+
|
|
3762
|
+
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
3763
|
+
markComponentAsDirty(vm);
|
|
3764
|
+
return;
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3767
|
+
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
3768
|
+
const key = oldKeys[i];
|
|
3769
|
+
|
|
3770
|
+
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
3771
|
+
markComponentAsDirty(vm);
|
|
3772
|
+
return;
|
|
3773
|
+
}
|
|
3774
|
+
|
|
3775
|
+
const oldVNodes = oldSlots[key];
|
|
3776
|
+
const vnodes = cmpSlots[key];
|
|
3777
|
+
|
|
3778
|
+
for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
3779
|
+
if (oldVNodes[j] !== vnodes[j]) {
|
|
3780
|
+
markComponentAsDirty(vm);
|
|
3781
|
+
return;
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3848
3786
|
} // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
3849
3787
|
|
|
3850
3788
|
|
|
@@ -3967,11 +3905,11 @@
|
|
|
3967
3905
|
linkNodeToShadow(elm, owner);
|
|
3968
3906
|
fallbackElmHook(elm, vnode);
|
|
3969
3907
|
vnode.elm = elm;
|
|
3970
|
-
|
|
3908
|
+
patchElementPropsAndAttrs(null, vnode);
|
|
3971
3909
|
},
|
|
3972
3910
|
update: (oldVnode, vnode) => {
|
|
3973
|
-
|
|
3974
|
-
|
|
3911
|
+
patchElementPropsAndAttrs(oldVnode, vnode);
|
|
3912
|
+
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
3975
3913
|
},
|
|
3976
3914
|
insert: (vnode, parentNode, referenceNode) => {
|
|
3977
3915
|
insertNodeHook(vnode, parentNode, referenceNode);
|
|
@@ -4045,10 +3983,10 @@
|
|
|
4045
3983
|
throw new TypeError(`Incorrect Component Constructor`);
|
|
4046
3984
|
}
|
|
4047
3985
|
|
|
4048
|
-
|
|
3986
|
+
patchElementPropsAndAttrs(null, vnode);
|
|
4049
3987
|
},
|
|
4050
3988
|
update: (oldVnode, vnode) => {
|
|
4051
|
-
|
|
3989
|
+
patchElementPropsAndAttrs(oldVnode, vnode);
|
|
4052
3990
|
const vm = getAssociatedVMIfPresent(vnode.elm);
|
|
4053
3991
|
|
|
4054
3992
|
if (vm) {
|
|
@@ -4059,7 +3997,7 @@
|
|
|
4059
3997
|
// will happen, but in native, it does allocate the light dom
|
|
4060
3998
|
|
|
4061
3999
|
|
|
4062
|
-
|
|
4000
|
+
patchChildren(vnode.elm, oldVnode.children, vnode.children);
|
|
4063
4001
|
|
|
4064
4002
|
if (vm) {
|
|
4065
4003
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
@@ -5450,7 +5388,6 @@
|
|
|
5450
5388
|
// patch function mutates vnodes by adding the element reference,
|
|
5451
5389
|
// however, if patching fails it contains partial changes.
|
|
5452
5390
|
if (oldCh !== newCh) {
|
|
5453
|
-
const fn = hasDynamicChildren(newCh) ? updateDynamicChildren : updateStaticChildren;
|
|
5454
5391
|
runWithBoundaryProtection(vm, vm, () => {
|
|
5455
5392
|
// pre
|
|
5456
5393
|
logOperationStart(2
|
|
@@ -5458,8 +5395,8 @@
|
|
|
5458
5395
|
, vm);
|
|
5459
5396
|
}, () => {
|
|
5460
5397
|
// job
|
|
5461
|
-
const
|
|
5462
|
-
|
|
5398
|
+
const renderRoot = getRenderRoot(vm);
|
|
5399
|
+
patchChildren(renderRoot, oldCh, newCh);
|
|
5463
5400
|
}, () => {
|
|
5464
5401
|
// post
|
|
5465
5402
|
logOperationEnd(2
|
|
@@ -5745,69 +5682,6 @@
|
|
|
5745
5682
|
|
|
5746
5683
|
currentVm = currentVm.owner;
|
|
5747
5684
|
}
|
|
5748
|
-
} // slow path routine
|
|
5749
|
-
// NOTE: we should probably more this routine to the synthetic shadow folder
|
|
5750
|
-
// and get the allocation to be cached by in the elm instead of in the VM
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
function allocateInSlot(vm, children) {
|
|
5754
|
-
const {
|
|
5755
|
-
cmpSlots: oldSlots
|
|
5756
|
-
} = vm;
|
|
5757
|
-
const cmpSlots = vm.cmpSlots = create(null);
|
|
5758
|
-
|
|
5759
|
-
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
5760
|
-
const vnode = children[i];
|
|
5761
|
-
|
|
5762
|
-
if (isNull(vnode)) {
|
|
5763
|
-
continue;
|
|
5764
|
-
}
|
|
5765
|
-
|
|
5766
|
-
const {
|
|
5767
|
-
data
|
|
5768
|
-
} = vnode;
|
|
5769
|
-
const slotName = data.attrs && data.attrs.slot || '';
|
|
5770
|
-
const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot
|
|
5771
|
-
// which might have similar keys. Each vnode will always have a key that
|
|
5772
|
-
// starts with a numeric character from compiler. In this case, we add a unique
|
|
5773
|
-
// notation for slotted vnodes keys, e.g.: `@foo:1:1`
|
|
5774
|
-
|
|
5775
|
-
if (!isUndefined$1(vnode.key)) {
|
|
5776
|
-
vnode.key = `@${slotName}:${vnode.key}`;
|
|
5777
|
-
}
|
|
5778
|
-
|
|
5779
|
-
ArrayPush$1.call(vnodes, vnode);
|
|
5780
|
-
}
|
|
5781
|
-
|
|
5782
|
-
if (isFalse(vm.isDirty)) {
|
|
5783
|
-
// We need to determine if the old allocation is really different from the new one
|
|
5784
|
-
// and mark the vm as dirty
|
|
5785
|
-
const oldKeys = keys(oldSlots);
|
|
5786
|
-
|
|
5787
|
-
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
5788
|
-
markComponentAsDirty(vm);
|
|
5789
|
-
return;
|
|
5790
|
-
}
|
|
5791
|
-
|
|
5792
|
-
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
5793
|
-
const key = oldKeys[i];
|
|
5794
|
-
|
|
5795
|
-
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
5796
|
-
markComponentAsDirty(vm);
|
|
5797
|
-
return;
|
|
5798
|
-
}
|
|
5799
|
-
|
|
5800
|
-
const oldVNodes = oldSlots[key];
|
|
5801
|
-
const vnodes = cmpSlots[key];
|
|
5802
|
-
|
|
5803
|
-
for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
5804
|
-
if (oldVNodes[j] !== vnodes[j]) {
|
|
5805
|
-
markComponentAsDirty(vm);
|
|
5806
|
-
return;
|
|
5807
|
-
}
|
|
5808
|
-
}
|
|
5809
|
-
}
|
|
5810
|
-
}
|
|
5811
5685
|
}
|
|
5812
5686
|
|
|
5813
5687
|
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
@@ -6230,7 +6104,7 @@
|
|
|
6230
6104
|
hooksAreSet = true;
|
|
6231
6105
|
setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);
|
|
6232
6106
|
}
|
|
6233
|
-
/* version: 2.7.
|
|
6107
|
+
/* version: 2.7.3 */
|
|
6234
6108
|
|
|
6235
6109
|
/*
|
|
6236
6110
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6898,7 +6772,7 @@
|
|
|
6898
6772
|
});
|
|
6899
6773
|
freeze(LightningElement);
|
|
6900
6774
|
seal(LightningElement.prototype);
|
|
6901
|
-
/* version: 2.7.
|
|
6775
|
+
/* version: 2.7.3 */
|
|
6902
6776
|
|
|
6903
6777
|
exports.LightningElement = LightningElement;
|
|
6904
6778
|
exports.__unstable__ProfilerControl = profilerControl;
|