lwc 2.23.6 → 2.25.0
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 +147 -20
- package/dist/engine-dom/iife/es2017/engine-dom.js +147 -20
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +125 -18
- package/dist/engine-dom/iife/es5/engine-dom.js +202 -41
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +171 -27
- package/dist/engine-dom/umd/es2017/engine-dom.js +147 -20
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +125 -18
- package/dist/engine-dom/umd/es5/engine-dom.js +202 -41
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +171 -27
- package/dist/engine-server/commonjs/es2017/engine-server.js +125 -17
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +125 -17
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +205 -168
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +205 -168
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +195 -158
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +25 -11
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +25 -11
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +205 -168
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +195 -158
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +25 -11
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +25 -11
- 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 +7 -7
|
@@ -346,7 +346,7 @@ var LWC = (function (exports) {
|
|
|
346
346
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
347
347
|
return attributeName;
|
|
348
348
|
}
|
|
349
|
-
/** version: 2.
|
|
349
|
+
/** version: 2.25.0 */
|
|
350
350
|
|
|
351
351
|
/**
|
|
352
352
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -440,7 +440,7 @@ var LWC = (function (exports) {
|
|
|
440
440
|
patch$1(propName);
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
/** version: 2.
|
|
443
|
+
/** version: 2.25.0 */
|
|
444
444
|
|
|
445
445
|
/**
|
|
446
446
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -615,6 +615,19 @@ var LWC = (function (exports) {
|
|
|
615
615
|
|
|
616
616
|
return result;
|
|
617
617
|
}
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
function setRefVNode(vm, ref, vnode) {
|
|
621
|
+
// If not, then something went wrong and we threw an error above.
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
var refVNodes = vm.refVNodes; // In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
625
|
+
// in depth-first traversal order.
|
|
626
|
+
|
|
627
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
628
|
+
refVNodes[ref] = vnode;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
618
631
|
/*
|
|
619
632
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
620
633
|
* All rights reserved.
|
|
@@ -1768,13 +1781,15 @@ var LWC = (function (exports) {
|
|
|
1768
1781
|
}
|
|
1769
1782
|
};
|
|
1770
1783
|
}
|
|
1784
|
+
|
|
1785
|
+
var EMPTY_REFS = freeze(create(null));
|
|
1786
|
+
var refsCache = new WeakMap();
|
|
1771
1787
|
/**
|
|
1772
1788
|
* This class is the base class for any LWC element.
|
|
1773
1789
|
* Some elements directly extends this class, others implement it via inheritance.
|
|
1774
1790
|
**/
|
|
1775
1791
|
// @ts-ignore
|
|
1776
1792
|
|
|
1777
|
-
|
|
1778
1793
|
var LightningElement = function LightningElement() {
|
|
1779
1794
|
// This should be as performant as possible, while any initialization should be done lazily
|
|
1780
1795
|
if (isNull(vmBeingConstructed)) {
|
|
@@ -1946,6 +1961,77 @@ var LWC = (function (exports) {
|
|
|
1946
1961
|
return vm.shadowRoot;
|
|
1947
1962
|
},
|
|
1948
1963
|
|
|
1964
|
+
get refs() {
|
|
1965
|
+
var vm = getAssociatedVM(this);
|
|
1966
|
+
|
|
1967
|
+
if (isUpdatingTemplate) {
|
|
1968
|
+
// process of returning the refs and caching them, because the state of the refs is unstable.
|
|
1969
|
+
// This can happen if e.g. a template contains `<div class={foo}></div>` and `foo` is computed
|
|
1970
|
+
// based on `this.refs.bar`.
|
|
1971
|
+
|
|
1972
|
+
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
var refVNodes = vm.refVNodes,
|
|
1977
|
+
hasRefVNodes = vm.hasRefVNodes;
|
|
1978
|
+
vm.cmpTemplate; // If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
|
|
1979
|
+
// were introduced, we return undefined if the template has no refs defined
|
|
1980
|
+
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
1981
|
+
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
1982
|
+
// Note it is not sufficient to just check if `refVNodes` is null or empty,
|
|
1983
|
+
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
1984
|
+
|
|
1985
|
+
|
|
1986
|
+
if (!hasRefVNodes) {
|
|
1987
|
+
return;
|
|
1988
|
+
} // For templates that are using `lwc:ref`, if there are no refs currently available
|
|
1989
|
+
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
1990
|
+
|
|
1991
|
+
|
|
1992
|
+
if (isNull(refVNodes)) {
|
|
1993
|
+
return EMPTY_REFS;
|
|
1994
|
+
} // The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
1995
|
+
// are recreated from scratch every time the template is rendered.
|
|
1996
|
+
// This happens with `vm.refVNodes = null` in `template.ts` in `@lwc/engine-core`.
|
|
1997
|
+
|
|
1998
|
+
|
|
1999
|
+
var refs = refsCache.get(refVNodes);
|
|
2000
|
+
|
|
2001
|
+
if (isUndefined$1(refs)) {
|
|
2002
|
+
refs = create(null);
|
|
2003
|
+
|
|
2004
|
+
var _iterator3 = _createForOfIteratorHelper(keys(refVNodes)),
|
|
2005
|
+
_step3;
|
|
2006
|
+
|
|
2007
|
+
try {
|
|
2008
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
2009
|
+
var key = _step3.value;
|
|
2010
|
+
refs[key] = refVNodes[key].elm;
|
|
2011
|
+
}
|
|
2012
|
+
} catch (err) {
|
|
2013
|
+
_iterator3.e(err);
|
|
2014
|
+
} finally {
|
|
2015
|
+
_iterator3.f();
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
freeze(refs);
|
|
2019
|
+
refsCache.set(refVNodes, refs);
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
return refs;
|
|
2023
|
+
},
|
|
2024
|
+
|
|
2025
|
+
// For backwards compat, we allow component authors to set `refs` as an expando
|
|
2026
|
+
set refs(value) {
|
|
2027
|
+
defineProperty(this, 'refs', {
|
|
2028
|
+
configurable: true,
|
|
2029
|
+
enumerable: true,
|
|
2030
|
+
writable: true,
|
|
2031
|
+
value: value
|
|
2032
|
+
});
|
|
2033
|
+
},
|
|
2034
|
+
|
|
1949
2035
|
get shadowRoot() {
|
|
1950
2036
|
// From within the component instance, the shadowRoot is always reported as "closed".
|
|
1951
2037
|
// Authors should rely on this.template instead.
|
|
@@ -3118,6 +3204,18 @@ var LWC = (function (exports) {
|
|
|
3118
3204
|
context = owner.context;
|
|
3119
3205
|
return context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken) || null;
|
|
3120
3206
|
}
|
|
3207
|
+
/**
|
|
3208
|
+
* This function returns the host style token for a custom element if it
|
|
3209
|
+
* exists. Otherwise it returns null.
|
|
3210
|
+
*/
|
|
3211
|
+
|
|
3212
|
+
|
|
3213
|
+
function getStylesheetTokenHost(vnode) {
|
|
3214
|
+
var _getComponentInternal = getComponentInternalDef(vnode.ctor),
|
|
3215
|
+
stylesheetToken = _getComponentInternal.template.stylesheetToken;
|
|
3216
|
+
|
|
3217
|
+
return !isUndefined$1(stylesheetToken) ? makeHostToken(stylesheetToken) : null;
|
|
3218
|
+
}
|
|
3121
3219
|
|
|
3122
3220
|
function getNearestNativeShadowComponent(vm) {
|
|
3123
3221
|
var owner = getNearestShadowComponent(vm);
|
|
@@ -3257,6 +3355,12 @@ var LWC = (function (exports) {
|
|
|
3257
3355
|
function isSameVnode(vnode1, vnode2) {
|
|
3258
3356
|
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
3259
3357
|
}
|
|
3358
|
+
|
|
3359
|
+
function isVCustomElement(vnode) {
|
|
3360
|
+
return vnode.type === 3
|
|
3361
|
+
/* VNodeType.CustomElement */
|
|
3362
|
+
;
|
|
3363
|
+
}
|
|
3260
3364
|
/*
|
|
3261
3365
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
3262
3366
|
* All rights reserved.
|
|
@@ -3323,15 +3427,33 @@ var LWC = (function (exports) {
|
|
|
3323
3427
|
|
|
3324
3428
|
function patchProps(oldVnode, vnode, renderer) {
|
|
3325
3429
|
var props = vnode.data.props;
|
|
3430
|
+
var spread = vnode.data.spread;
|
|
3326
3431
|
|
|
3327
|
-
if (isUndefined$1(props)) {
|
|
3432
|
+
if (isUndefined$1(props) && isUndefined$1(spread)) {
|
|
3328
3433
|
return;
|
|
3329
3434
|
}
|
|
3330
3435
|
|
|
3331
|
-
var oldProps
|
|
3436
|
+
var oldProps;
|
|
3332
3437
|
|
|
3333
|
-
if (
|
|
3334
|
-
|
|
3438
|
+
if (!isNull(oldVnode)) {
|
|
3439
|
+
oldProps = oldVnode.data.props;
|
|
3440
|
+
var oldSpread = oldVnode.data.spread;
|
|
3441
|
+
|
|
3442
|
+
if (oldProps === props && oldSpread === spread) {
|
|
3443
|
+
return;
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3446
|
+
if (isUndefined$1(oldProps)) {
|
|
3447
|
+
oldProps = EmptyObject;
|
|
3448
|
+
}
|
|
3449
|
+
|
|
3450
|
+
if (!isUndefined$1(oldSpread)) {
|
|
3451
|
+
oldProps = assign({}, oldProps, oldSpread);
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3455
|
+
if (!isUndefined$1(spread)) {
|
|
3456
|
+
props = assign({}, props, spread);
|
|
3335
3457
|
}
|
|
3336
3458
|
|
|
3337
3459
|
var isFirstPatch = isNull(oldVnode);
|
|
@@ -3344,7 +3466,8 @@ var LWC = (function (exports) {
|
|
|
3344
3466
|
var cur = props[key]; // Set the property if it's the first time is is patched or if the previous property is
|
|
3345
3467
|
// different than the one previously set.
|
|
3346
3468
|
|
|
3347
|
-
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key]))
|
|
3469
|
+
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key]) || !(key in oldProps) // this is required because the above case will pass when `cur` is `undefined` and key is missing in `oldProps`
|
|
3470
|
+
) {
|
|
3348
3471
|
|
|
3349
3472
|
setProperty(elm, key, cur);
|
|
3350
3473
|
}
|
|
@@ -4313,19 +4436,25 @@ var LWC = (function (exports) {
|
|
|
4313
4436
|
var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : EmptyArray;
|
|
4314
4437
|
var vmBeingRendered = getVMBeingRendered();
|
|
4315
4438
|
|
|
4316
|
-
var
|
|
4317
|
-
|
|
4318
|
-
|
|
4439
|
+
var key = data.key,
|
|
4440
|
+
ref = data.ref;
|
|
4441
|
+
var vnode = {
|
|
4319
4442
|
type: 2
|
|
4320
4443
|
/* VNodeType.Element */
|
|
4321
4444
|
,
|
|
4322
4445
|
sel: sel,
|
|
4323
4446
|
data: data,
|
|
4324
4447
|
children: children,
|
|
4325
|
-
elm:
|
|
4448
|
+
elm: undefined,
|
|
4326
4449
|
key: key,
|
|
4327
4450
|
owner: vmBeingRendered
|
|
4328
4451
|
};
|
|
4452
|
+
|
|
4453
|
+
if (!isUndefined$1(ref)) {
|
|
4454
|
+
setRefVNode(vmBeingRendered, ref, vnode);
|
|
4455
|
+
}
|
|
4456
|
+
|
|
4457
|
+
return vnode;
|
|
4329
4458
|
} // [t]ab[i]ndex function
|
|
4330
4459
|
|
|
4331
4460
|
|
|
@@ -4371,7 +4500,8 @@ var LWC = (function (exports) {
|
|
|
4371
4500
|
var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
|
|
4372
4501
|
var vmBeingRendered = getVMBeingRendered();
|
|
4373
4502
|
|
|
4374
|
-
var key = data.key
|
|
4503
|
+
var key = data.key,
|
|
4504
|
+
ref = data.ref;
|
|
4375
4505
|
var elm, aChildren, vm;
|
|
4376
4506
|
var vnode = {
|
|
4377
4507
|
type: 3
|
|
@@ -4389,6 +4519,11 @@ var LWC = (function (exports) {
|
|
|
4389
4519
|
vm: vm
|
|
4390
4520
|
};
|
|
4391
4521
|
addVNodeToChildLWC(vnode);
|
|
4522
|
+
|
|
4523
|
+
if (!isUndefined$1(ref)) {
|
|
4524
|
+
setRefVNode(vmBeingRendered, ref, vnode);
|
|
4525
|
+
}
|
|
4526
|
+
|
|
4392
4527
|
return vnode;
|
|
4393
4528
|
} // [i]terable node
|
|
4394
4529
|
|
|
@@ -4888,9 +5023,13 @@ var LWC = (function (exports) {
|
|
|
4888
5023
|
context.styleVNodes = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);
|
|
4889
5024
|
}
|
|
4890
5025
|
|
|
4891
|
-
if ("production" !== 'production') ; //
|
|
4892
|
-
|
|
5026
|
+
if ("production" !== 'production') ; // reset the refs; they will be set during the tmpl() instantiation
|
|
5027
|
+
|
|
4893
5028
|
|
|
5029
|
+
var hasRefVNodes = Boolean(html.hasRefs);
|
|
5030
|
+
vm.hasRefVNodes = hasRefVNodes;
|
|
5031
|
+
vm.refVNodes = hasRefVNodes ? create(null) : null; // right before producing the vnodes, we clear up all internal references
|
|
5032
|
+
// to custom elements from the template.
|
|
4894
5033
|
|
|
4895
5034
|
vm.velements = []; // Set the global flag that template is being updated
|
|
4896
5035
|
|
|
@@ -5253,6 +5392,8 @@ var LWC = (function (exports) {
|
|
|
5253
5392
|
tagName: tagName,
|
|
5254
5393
|
mode: mode,
|
|
5255
5394
|
owner: owner,
|
|
5395
|
+
refVNodes: null,
|
|
5396
|
+
hasRefVNodes: false,
|
|
5256
5397
|
children: EmptyArray,
|
|
5257
5398
|
aChildren: EmptyArray,
|
|
5258
5399
|
velements: EmptyArray,
|
|
@@ -6375,7 +6516,8 @@ var LWC = (function (exports) {
|
|
|
6375
6516
|
classMap = data.classMap;
|
|
6376
6517
|
var getProperty = renderer.getProperty,
|
|
6377
6518
|
getClassList = renderer.getClassList;
|
|
6378
|
-
var scopedToken = getScopeTokenClass(owner);
|
|
6519
|
+
var scopedToken = getScopeTokenClass(owner);
|
|
6520
|
+
var stylesheetTokenHost = isVCustomElement(vnode) ? getStylesheetTokenHost(vnode) : null; // Classnames for scoped CSS are added directly to the DOM during rendering,
|
|
6379
6521
|
// or to the VDOM on the server in the case of SSR. As such, these classnames
|
|
6380
6522
|
// are never present in VDOM nodes in the browser.
|
|
6381
6523
|
//
|
|
@@ -6384,9 +6526,11 @@ var LWC = (function (exports) {
|
|
|
6384
6526
|
|
|
6385
6527
|
if (scopedToken) {
|
|
6386
6528
|
if (!isUndefined$1(className)) {
|
|
6387
|
-
className = "".concat(scopedToken, " ").concat(className);
|
|
6529
|
+
className = isNull(stylesheetTokenHost) ? "".concat(scopedToken, " ").concat(className) : "".concat(scopedToken, " ").concat(className, " ").concat(stylesheetTokenHost);
|
|
6388
6530
|
} else if (!isUndefined$1(classMap)) {
|
|
6389
|
-
classMap = Object.assign(Object.assign({}, classMap), _defineProperty({}, scopedToken, true));
|
|
6531
|
+
classMap = Object.assign(Object.assign(Object.assign({}, classMap), _defineProperty({}, scopedToken, true)), isNull(stylesheetTokenHost) ? {} : _defineProperty({}, stylesheetTokenHost, true));
|
|
6532
|
+
} else {
|
|
6533
|
+
className = isNull(stylesheetTokenHost) ? "".concat(scopedToken) : "".concat(scopedToken, " ").concat(stylesheetTokenHost);
|
|
6390
6534
|
}
|
|
6391
6535
|
}
|
|
6392
6536
|
|
|
@@ -6557,7 +6701,7 @@ var LWC = (function (exports) {
|
|
|
6557
6701
|
|
|
6558
6702
|
return ctor;
|
|
6559
6703
|
}
|
|
6560
|
-
/* version: 2.
|
|
6704
|
+
/* version: 2.25.0 */
|
|
6561
6705
|
|
|
6562
6706
|
/*
|
|
6563
6707
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6776,7 +6920,7 @@ var LWC = (function (exports) {
|
|
|
6776
6920
|
function isNull(obj) {
|
|
6777
6921
|
return obj === null;
|
|
6778
6922
|
}
|
|
6779
|
-
/** version: 2.
|
|
6923
|
+
/** version: 2.25.0 */
|
|
6780
6924
|
|
|
6781
6925
|
/*
|
|
6782
6926
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6925,18 +7069,18 @@ var LWC = (function (exports) {
|
|
|
6925
7069
|
var wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
6926
7070
|
|
|
6927
7071
|
if (!isUndefined(wrapperTags)) {
|
|
6928
|
-
var
|
|
6929
|
-
|
|
7072
|
+
var _iterator6 = _createForOfIteratorHelper(wrapperTags),
|
|
7073
|
+
_step6;
|
|
6930
7074
|
|
|
6931
7075
|
try {
|
|
6932
|
-
for (
|
|
6933
|
-
var wrapperTag =
|
|
7076
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
7077
|
+
var wrapperTag = _step6.value;
|
|
6934
7078
|
html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
|
|
6935
7079
|
}
|
|
6936
7080
|
} catch (err) {
|
|
6937
|
-
|
|
7081
|
+
_iterator6.e(err);
|
|
6938
7082
|
} finally {
|
|
6939
|
-
|
|
7083
|
+
_iterator6.f();
|
|
6940
7084
|
}
|
|
6941
7085
|
} // For IE11, the document title must not be undefined, but it can be an empty string
|
|
6942
7086
|
// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
|
|
@@ -7499,7 +7643,7 @@ var LWC = (function (exports) {
|
|
|
7499
7643
|
});
|
|
7500
7644
|
freeze(LightningElement);
|
|
7501
7645
|
seal(LightningElement.prototype);
|
|
7502
|
-
/* version: 2.
|
|
7646
|
+
/* version: 2.25.0 */
|
|
7503
7647
|
|
|
7504
7648
|
exports.LightningElement = LightningElement;
|
|
7505
7649
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -305,9 +305,9 @@
|
|
|
305
305
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
306
306
|
*/
|
|
307
307
|
// Increment whenever the LWC template compiler changes
|
|
308
|
-
const LWC_VERSION = "2.
|
|
308
|
+
const LWC_VERSION = "2.25.0";
|
|
309
309
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
310
|
-
/** version: 2.
|
|
310
|
+
/** version: 2.25.0 */
|
|
311
311
|
|
|
312
312
|
/**
|
|
313
313
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -389,7 +389,7 @@
|
|
|
389
389
|
patch$1(propName);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
/** version: 2.
|
|
392
|
+
/** version: 2.25.0 */
|
|
393
393
|
|
|
394
394
|
/**
|
|
395
395
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -468,7 +468,7 @@
|
|
|
468
468
|
setFeatureFlag(name, value);
|
|
469
469
|
}
|
|
470
470
|
}
|
|
471
|
-
/** version: 2.
|
|
471
|
+
/** version: 2.25.0 */
|
|
472
472
|
|
|
473
473
|
/*
|
|
474
474
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -602,6 +602,20 @@
|
|
|
602
602
|
}
|
|
603
603
|
return list;
|
|
604
604
|
}
|
|
605
|
+
// Set a ref (lwc:ref) on a VM, from a template API
|
|
606
|
+
function setRefVNode(vm, ref, vnode) {
|
|
607
|
+
if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
|
|
608
|
+
throw new Error('refVNodes must be defined when setting a ref');
|
|
609
|
+
}
|
|
610
|
+
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
611
|
+
// If not, then something went wrong and we threw an error above.
|
|
612
|
+
const refVNodes = vm.refVNodes;
|
|
613
|
+
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
614
|
+
// in depth-first traversal order.
|
|
615
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
616
|
+
refVNodes[ref] = vnode;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
605
619
|
|
|
606
620
|
/*
|
|
607
621
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -1918,6 +1932,8 @@
|
|
|
1918
1932
|
},
|
|
1919
1933
|
};
|
|
1920
1934
|
}
|
|
1935
|
+
const EMPTY_REFS = freeze(create(null));
|
|
1936
|
+
const refsCache = new WeakMap();
|
|
1921
1937
|
/**
|
|
1922
1938
|
* This class is the base class for any LWC element.
|
|
1923
1939
|
* Some elements directly extends this class, others implement it via inheritance.
|
|
@@ -2097,6 +2113,70 @@
|
|
|
2097
2113
|
}
|
|
2098
2114
|
return vm.shadowRoot;
|
|
2099
2115
|
},
|
|
2116
|
+
get refs() {
|
|
2117
|
+
const vm = getAssociatedVM(this);
|
|
2118
|
+
if (isUpdatingTemplate) {
|
|
2119
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2120
|
+
logError(`this.refs should not be called while ${getComponentTag(vm)} is rendering. Use this.refs only when the DOM is stable, e.g. in renderedCallback().`);
|
|
2121
|
+
}
|
|
2122
|
+
// If the template is in the process of being updated, then we don't want to go through the normal
|
|
2123
|
+
// process of returning the refs and caching them, because the state of the refs is unstable.
|
|
2124
|
+
// This can happen if e.g. a template contains `<div class={foo}></div>` and `foo` is computed
|
|
2125
|
+
// based on `this.refs.bar`.
|
|
2126
|
+
return;
|
|
2127
|
+
}
|
|
2128
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2129
|
+
warnIfInvokedDuringConstruction(vm, 'refs');
|
|
2130
|
+
}
|
|
2131
|
+
const { refVNodes, hasRefVNodes, cmpTemplate } = vm;
|
|
2132
|
+
// If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
|
|
2133
|
+
// if `this.refs` is called during the `connectedCallback` phase. The DOM elements have not been rendered yet,
|
|
2134
|
+
// so log a warning. Note we also check `isBeingConstructed()` to avoid a double warning (due to
|
|
2135
|
+
// `warnIfInvokedDuringConstruction` above).
|
|
2136
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
2137
|
+
isNull(cmpTemplate) &&
|
|
2138
|
+
!isBeingConstructed(vm)) {
|
|
2139
|
+
logError(`this.refs is undefined for ${getComponentTag(vm)}. This is either because the attached template has no "lwc:ref" directive, or this.refs was ` +
|
|
2140
|
+
`invoked before renderedCallback(). Use this.refs only when the referenced HTML elements have ` +
|
|
2141
|
+
`been rendered to the DOM, such as within renderedCallback() or disconnectedCallback().`);
|
|
2142
|
+
}
|
|
2143
|
+
// For backwards compatibility with component written before template refs
|
|
2144
|
+
// were introduced, we return undefined if the template has no refs defined
|
|
2145
|
+
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
2146
|
+
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
2147
|
+
// Note it is not sufficient to just check if `refVNodes` is null or empty,
|
|
2148
|
+
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
2149
|
+
if (!hasRefVNodes) {
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
2153
|
+
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
2154
|
+
if (isNull(refVNodes)) {
|
|
2155
|
+
return EMPTY_REFS;
|
|
2156
|
+
}
|
|
2157
|
+
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
2158
|
+
// are recreated from scratch every time the template is rendered.
|
|
2159
|
+
// This happens with `vm.refVNodes = null` in `template.ts` in `@lwc/engine-core`.
|
|
2160
|
+
let refs = refsCache.get(refVNodes);
|
|
2161
|
+
if (isUndefined$1(refs)) {
|
|
2162
|
+
refs = create(null);
|
|
2163
|
+
for (const key of keys(refVNodes)) {
|
|
2164
|
+
refs[key] = refVNodes[key].elm;
|
|
2165
|
+
}
|
|
2166
|
+
freeze(refs);
|
|
2167
|
+
refsCache.set(refVNodes, refs);
|
|
2168
|
+
}
|
|
2169
|
+
return refs;
|
|
2170
|
+
},
|
|
2171
|
+
// For backwards compat, we allow component authors to set `refs` as an expando
|
|
2172
|
+
set refs(value) {
|
|
2173
|
+
defineProperty(this, 'refs', {
|
|
2174
|
+
configurable: true,
|
|
2175
|
+
enumerable: true,
|
|
2176
|
+
writable: true,
|
|
2177
|
+
value,
|
|
2178
|
+
});
|
|
2179
|
+
},
|
|
2100
2180
|
get shadowRoot() {
|
|
2101
2181
|
// From within the component instance, the shadowRoot is always reported as "closed".
|
|
2102
2182
|
// Authors should rely on this.template instead.
|
|
@@ -3513,6 +3593,14 @@
|
|
|
3513
3593
|
const { cmpTemplate, context } = owner;
|
|
3514
3594
|
return (context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken)) || null;
|
|
3515
3595
|
}
|
|
3596
|
+
/**
|
|
3597
|
+
* This function returns the host style token for a custom element if it
|
|
3598
|
+
* exists. Otherwise it returns null.
|
|
3599
|
+
*/
|
|
3600
|
+
function getStylesheetTokenHost(vnode) {
|
|
3601
|
+
const { template: { stylesheetToken }, } = getComponentInternalDef(vnode.ctor);
|
|
3602
|
+
return !isUndefined$1(stylesheetToken) ? makeHostToken(stylesheetToken) : null;
|
|
3603
|
+
}
|
|
3516
3604
|
function getNearestNativeShadowComponent(vm) {
|
|
3517
3605
|
const owner = getNearestShadowComponent(vm);
|
|
3518
3606
|
if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
@@ -3630,6 +3718,9 @@
|
|
|
3630
3718
|
function isSameVnode(vnode1, vnode2) {
|
|
3631
3719
|
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
3632
3720
|
}
|
|
3721
|
+
function isVCustomElement(vnode) {
|
|
3722
|
+
return vnode.type === 3 /* VNodeType.CustomElement */;
|
|
3723
|
+
}
|
|
3633
3724
|
|
|
3634
3725
|
/*
|
|
3635
3726
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3685,13 +3776,27 @@
|
|
|
3685
3776
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3686
3777
|
}
|
|
3687
3778
|
function patchProps(oldVnode, vnode, renderer) {
|
|
3688
|
-
|
|
3689
|
-
|
|
3779
|
+
let { props } = vnode.data;
|
|
3780
|
+
const { spread } = vnode.data;
|
|
3781
|
+
if (isUndefined$1(props) && isUndefined$1(spread)) {
|
|
3690
3782
|
return;
|
|
3691
3783
|
}
|
|
3692
|
-
|
|
3693
|
-
if (
|
|
3694
|
-
|
|
3784
|
+
let oldProps;
|
|
3785
|
+
if (!isNull(oldVnode)) {
|
|
3786
|
+
oldProps = oldVnode.data.props;
|
|
3787
|
+
const oldSpread = oldVnode.data.spread;
|
|
3788
|
+
if (oldProps === props && oldSpread === spread) {
|
|
3789
|
+
return;
|
|
3790
|
+
}
|
|
3791
|
+
if (isUndefined$1(oldProps)) {
|
|
3792
|
+
oldProps = EmptyObject;
|
|
3793
|
+
}
|
|
3794
|
+
if (!isUndefined$1(oldSpread)) {
|
|
3795
|
+
oldProps = assign({}, oldProps, oldSpread);
|
|
3796
|
+
}
|
|
3797
|
+
}
|
|
3798
|
+
if (!isUndefined$1(spread)) {
|
|
3799
|
+
props = assign({}, props, spread);
|
|
3695
3800
|
}
|
|
3696
3801
|
const isFirstPatch = isNull(oldVnode);
|
|
3697
3802
|
const { elm, sel } = vnode;
|
|
@@ -3701,7 +3806,9 @@
|
|
|
3701
3806
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3702
3807
|
// different than the one previously set.
|
|
3703
3808
|
if (isFirstPatch ||
|
|
3704
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])
|
|
3809
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key]) ||
|
|
3810
|
+
!(key in oldProps) // this is required because the above case will pass when `cur` is `undefined` and key is missing in `oldProps`
|
|
3811
|
+
) {
|
|
3705
3812
|
// Additional verification if properties are supported by the element
|
|
3706
3813
|
// Validation relies on html properties and public properties being defined on the element,
|
|
3707
3814
|
// SSR has its own custom validation.
|
|
@@ -4761,17 +4868,20 @@
|
|
|
4761
4868
|
}
|
|
4762
4869
|
});
|
|
4763
4870
|
}
|
|
4764
|
-
|
|
4765
|
-
const
|
|
4766
|
-
return {
|
|
4871
|
+
const { key, ref } = data;
|
|
4872
|
+
const vnode = {
|
|
4767
4873
|
type: 2 /* VNodeType.Element */,
|
|
4768
4874
|
sel,
|
|
4769
4875
|
data,
|
|
4770
4876
|
children,
|
|
4771
|
-
elm,
|
|
4877
|
+
elm: undefined,
|
|
4772
4878
|
key,
|
|
4773
4879
|
owner: vmBeingRendered,
|
|
4774
4880
|
};
|
|
4881
|
+
if (!isUndefined$1(ref)) {
|
|
4882
|
+
setRefVNode(vmBeingRendered, ref, vnode);
|
|
4883
|
+
}
|
|
4884
|
+
return vnode;
|
|
4775
4885
|
}
|
|
4776
4886
|
// [t]ab[i]ndex function
|
|
4777
4887
|
function ti(value) {
|
|
@@ -4836,7 +4946,7 @@
|
|
|
4836
4946
|
});
|
|
4837
4947
|
}
|
|
4838
4948
|
}
|
|
4839
|
-
const { key } = data;
|
|
4949
|
+
const { key, ref } = data;
|
|
4840
4950
|
let elm, aChildren, vm;
|
|
4841
4951
|
const vnode = {
|
|
4842
4952
|
type: 3 /* VNodeType.CustomElement */,
|
|
@@ -4852,6 +4962,9 @@
|
|
|
4852
4962
|
vm,
|
|
4853
4963
|
};
|
|
4854
4964
|
addVNodeToChildLWC(vnode);
|
|
4965
|
+
if (!isUndefined$1(ref)) {
|
|
4966
|
+
setRefVNode(vmBeingRendered, ref, vnode);
|
|
4967
|
+
}
|
|
4855
4968
|
return vnode;
|
|
4856
4969
|
}
|
|
4857
4970
|
// [i]terable node
|
|
@@ -5380,6 +5493,10 @@
|
|
|
5380
5493
|
// add the VM to the list of host VMs that can be re-rendered if html is swapped
|
|
5381
5494
|
setActiveVM(vm);
|
|
5382
5495
|
}
|
|
5496
|
+
// reset the refs; they will be set during the tmpl() instantiation
|
|
5497
|
+
const hasRefVNodes = Boolean(html.hasRefs);
|
|
5498
|
+
vm.hasRefVNodes = hasRefVNodes;
|
|
5499
|
+
vm.refVNodes = hasRefVNodes ? create(null) : null;
|
|
5383
5500
|
// right before producing the vnodes, we clear up all internal references
|
|
5384
5501
|
// to custom elements from the template.
|
|
5385
5502
|
vm.velements = [];
|
|
@@ -5738,6 +5855,8 @@
|
|
|
5738
5855
|
tagName,
|
|
5739
5856
|
mode,
|
|
5740
5857
|
owner,
|
|
5858
|
+
refVNodes: null,
|
|
5859
|
+
hasRefVNodes: false,
|
|
5741
5860
|
children: EmptyArray,
|
|
5742
5861
|
aChildren: EmptyArray,
|
|
5743
5862
|
velements: EmptyArray,
|
|
@@ -6887,6 +7006,7 @@
|
|
|
6887
7006
|
let { className, classMap } = data;
|
|
6888
7007
|
const { getProperty, getClassList } = renderer;
|
|
6889
7008
|
const scopedToken = getScopeTokenClass(owner);
|
|
7009
|
+
const stylesheetTokenHost = isVCustomElement(vnode) ? getStylesheetTokenHost(vnode) : null;
|
|
6890
7010
|
// Classnames for scoped CSS are added directly to the DOM during rendering,
|
|
6891
7011
|
// or to the VDOM on the server in the case of SSR. As such, these classnames
|
|
6892
7012
|
// are never present in VDOM nodes in the browser.
|
|
@@ -6895,10 +7015,17 @@
|
|
|
6895
7015
|
// are rendered during SSR. This needs to be accounted for when validating.
|
|
6896
7016
|
if (scopedToken) {
|
|
6897
7017
|
if (!isUndefined$1(className)) {
|
|
6898
|
-
className =
|
|
7018
|
+
className = isNull(stylesheetTokenHost)
|
|
7019
|
+
? `${scopedToken} ${className}`
|
|
7020
|
+
: `${scopedToken} ${className} ${stylesheetTokenHost}`;
|
|
6899
7021
|
}
|
|
6900
7022
|
else if (!isUndefined$1(classMap)) {
|
|
6901
|
-
classMap = Object.assign(Object.assign({}, classMap), { [scopedToken]: true });
|
|
7023
|
+
classMap = Object.assign(Object.assign(Object.assign({}, classMap), { [scopedToken]: true }), (isNull(stylesheetTokenHost) ? {} : { [stylesheetTokenHost]: true }));
|
|
7024
|
+
}
|
|
7025
|
+
else {
|
|
7026
|
+
className = isNull(stylesheetTokenHost)
|
|
7027
|
+
? `${scopedToken}`
|
|
7028
|
+
: `${scopedToken} ${stylesheetTokenHost}`;
|
|
6902
7029
|
}
|
|
6903
7030
|
}
|
|
6904
7031
|
let nodesAreCompatible = true;
|
|
@@ -7140,7 +7267,7 @@
|
|
|
7140
7267
|
}
|
|
7141
7268
|
return ctor;
|
|
7142
7269
|
}
|
|
7143
|
-
/* version: 2.
|
|
7270
|
+
/* version: 2.25.0 */
|
|
7144
7271
|
|
|
7145
7272
|
/*
|
|
7146
7273
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7344,7 +7471,7 @@
|
|
|
7344
7471
|
function isNull(obj) {
|
|
7345
7472
|
return obj === null;
|
|
7346
7473
|
}
|
|
7347
|
-
/** version: 2.
|
|
7474
|
+
/** version: 2.25.0 */
|
|
7348
7475
|
|
|
7349
7476
|
/*
|
|
7350
7477
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7963,7 +8090,7 @@
|
|
|
7963
8090
|
});
|
|
7964
8091
|
freeze(LightningElement);
|
|
7965
8092
|
seal(LightningElement.prototype);
|
|
7966
|
-
/* version: 2.
|
|
8093
|
+
/* version: 2.25.0 */
|
|
7967
8094
|
|
|
7968
8095
|
exports.LightningElement = LightningElement;
|
|
7969
8096
|
exports.__unstable__ProfilerControl = profilerControl;
|