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
|
@@ -299,9 +299,9 @@ function htmlPropertyToAttribute(propName) {
|
|
|
299
299
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
300
300
|
*/
|
|
301
301
|
// Increment whenever the LWC template compiler changes
|
|
302
|
-
const LWC_VERSION = "2.
|
|
302
|
+
const LWC_VERSION = "2.25.0";
|
|
303
303
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
304
|
-
/** version: 2.
|
|
304
|
+
/** version: 2.25.0 */
|
|
305
305
|
|
|
306
306
|
/**
|
|
307
307
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -383,7 +383,7 @@ for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1)
|
|
|
383
383
|
patch$1(propName);
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
/** version: 2.
|
|
386
|
+
/** version: 2.25.0 */
|
|
387
387
|
|
|
388
388
|
/**
|
|
389
389
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -462,7 +462,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
462
462
|
setFeatureFlag(name, value);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
/** version: 2.
|
|
465
|
+
/** version: 2.25.0 */
|
|
466
466
|
|
|
467
467
|
/*
|
|
468
468
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -596,6 +596,20 @@ function flattenStylesheets(stylesheets) {
|
|
|
596
596
|
}
|
|
597
597
|
return list;
|
|
598
598
|
}
|
|
599
|
+
// Set a ref (lwc:ref) on a VM, from a template API
|
|
600
|
+
function setRefVNode(vm, ref, vnode) {
|
|
601
|
+
if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
|
|
602
|
+
throw new Error('refVNodes must be defined when setting a ref');
|
|
603
|
+
}
|
|
604
|
+
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
605
|
+
// If not, then something went wrong and we threw an error above.
|
|
606
|
+
const refVNodes = vm.refVNodes;
|
|
607
|
+
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
608
|
+
// in depth-first traversal order.
|
|
609
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
610
|
+
refVNodes[ref] = vnode;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
599
613
|
|
|
600
614
|
/*
|
|
601
615
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -1912,6 +1926,8 @@ function createBridgeToElementDescriptor(propName, descriptor) {
|
|
|
1912
1926
|
},
|
|
1913
1927
|
};
|
|
1914
1928
|
}
|
|
1929
|
+
const EMPTY_REFS = freeze(create(null));
|
|
1930
|
+
const refsCache = new WeakMap();
|
|
1915
1931
|
/**
|
|
1916
1932
|
* This class is the base class for any LWC element.
|
|
1917
1933
|
* Some elements directly extends this class, others implement it via inheritance.
|
|
@@ -2091,6 +2107,70 @@ LightningElement.prototype = {
|
|
|
2091
2107
|
}
|
|
2092
2108
|
return vm.shadowRoot;
|
|
2093
2109
|
},
|
|
2110
|
+
get refs() {
|
|
2111
|
+
const vm = getAssociatedVM(this);
|
|
2112
|
+
if (isUpdatingTemplate) {
|
|
2113
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2114
|
+
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().`);
|
|
2115
|
+
}
|
|
2116
|
+
// If the template is in the process of being updated, then we don't want to go through the normal
|
|
2117
|
+
// process of returning the refs and caching them, because the state of the refs is unstable.
|
|
2118
|
+
// This can happen if e.g. a template contains `<div class={foo}></div>` and `foo` is computed
|
|
2119
|
+
// based on `this.refs.bar`.
|
|
2120
|
+
return;
|
|
2121
|
+
}
|
|
2122
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2123
|
+
warnIfInvokedDuringConstruction(vm, 'refs');
|
|
2124
|
+
}
|
|
2125
|
+
const { refVNodes, hasRefVNodes, cmpTemplate } = vm;
|
|
2126
|
+
// If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
|
|
2127
|
+
// if `this.refs` is called during the `connectedCallback` phase. The DOM elements have not been rendered yet,
|
|
2128
|
+
// so log a warning. Note we also check `isBeingConstructed()` to avoid a double warning (due to
|
|
2129
|
+
// `warnIfInvokedDuringConstruction` above).
|
|
2130
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
2131
|
+
isNull(cmpTemplate) &&
|
|
2132
|
+
!isBeingConstructed(vm)) {
|
|
2133
|
+
logError(`this.refs is undefined for ${getComponentTag(vm)}. This is either because the attached template has no "lwc:ref" directive, or this.refs was ` +
|
|
2134
|
+
`invoked before renderedCallback(). Use this.refs only when the referenced HTML elements have ` +
|
|
2135
|
+
`been rendered to the DOM, such as within renderedCallback() or disconnectedCallback().`);
|
|
2136
|
+
}
|
|
2137
|
+
// For backwards compatibility with component written before template refs
|
|
2138
|
+
// were introduced, we return undefined if the template has no refs defined
|
|
2139
|
+
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
2140
|
+
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
2141
|
+
// Note it is not sufficient to just check if `refVNodes` is null or empty,
|
|
2142
|
+
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
2143
|
+
if (!hasRefVNodes) {
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
2147
|
+
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
2148
|
+
if (isNull(refVNodes)) {
|
|
2149
|
+
return EMPTY_REFS;
|
|
2150
|
+
}
|
|
2151
|
+
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
2152
|
+
// are recreated from scratch every time the template is rendered.
|
|
2153
|
+
// This happens with `vm.refVNodes = null` in `template.ts` in `@lwc/engine-core`.
|
|
2154
|
+
let refs = refsCache.get(refVNodes);
|
|
2155
|
+
if (isUndefined$1(refs)) {
|
|
2156
|
+
refs = create(null);
|
|
2157
|
+
for (const key of keys(refVNodes)) {
|
|
2158
|
+
refs[key] = refVNodes[key].elm;
|
|
2159
|
+
}
|
|
2160
|
+
freeze(refs);
|
|
2161
|
+
refsCache.set(refVNodes, refs);
|
|
2162
|
+
}
|
|
2163
|
+
return refs;
|
|
2164
|
+
},
|
|
2165
|
+
// For backwards compat, we allow component authors to set `refs` as an expando
|
|
2166
|
+
set refs(value) {
|
|
2167
|
+
defineProperty(this, 'refs', {
|
|
2168
|
+
configurable: true,
|
|
2169
|
+
enumerable: true,
|
|
2170
|
+
writable: true,
|
|
2171
|
+
value,
|
|
2172
|
+
});
|
|
2173
|
+
},
|
|
2094
2174
|
get shadowRoot() {
|
|
2095
2175
|
// From within the component instance, the shadowRoot is always reported as "closed".
|
|
2096
2176
|
// Authors should rely on this.template instead.
|
|
@@ -3507,6 +3587,14 @@ function getScopeTokenClass(owner) {
|
|
|
3507
3587
|
const { cmpTemplate, context } = owner;
|
|
3508
3588
|
return (context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken)) || null;
|
|
3509
3589
|
}
|
|
3590
|
+
/**
|
|
3591
|
+
* This function returns the host style token for a custom element if it
|
|
3592
|
+
* exists. Otherwise it returns null.
|
|
3593
|
+
*/
|
|
3594
|
+
function getStylesheetTokenHost(vnode) {
|
|
3595
|
+
const { template: { stylesheetToken }, } = getComponentInternalDef(vnode.ctor);
|
|
3596
|
+
return !isUndefined$1(stylesheetToken) ? makeHostToken(stylesheetToken) : null;
|
|
3597
|
+
}
|
|
3510
3598
|
function getNearestNativeShadowComponent(vm) {
|
|
3511
3599
|
const owner = getNearestShadowComponent(vm);
|
|
3512
3600
|
if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
@@ -3624,6 +3712,9 @@ function isVBaseElement(vnode) {
|
|
|
3624
3712
|
function isSameVnode(vnode1, vnode2) {
|
|
3625
3713
|
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
3626
3714
|
}
|
|
3715
|
+
function isVCustomElement(vnode) {
|
|
3716
|
+
return vnode.type === 3 /* VNodeType.CustomElement */;
|
|
3717
|
+
}
|
|
3627
3718
|
|
|
3628
3719
|
/*
|
|
3629
3720
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3679,13 +3770,27 @@ function isLiveBindingProp(sel, key) {
|
|
|
3679
3770
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3680
3771
|
}
|
|
3681
3772
|
function patchProps(oldVnode, vnode, renderer) {
|
|
3682
|
-
|
|
3683
|
-
|
|
3773
|
+
let { props } = vnode.data;
|
|
3774
|
+
const { spread } = vnode.data;
|
|
3775
|
+
if (isUndefined$1(props) && isUndefined$1(spread)) {
|
|
3684
3776
|
return;
|
|
3685
3777
|
}
|
|
3686
|
-
|
|
3687
|
-
if (
|
|
3688
|
-
|
|
3778
|
+
let oldProps;
|
|
3779
|
+
if (!isNull(oldVnode)) {
|
|
3780
|
+
oldProps = oldVnode.data.props;
|
|
3781
|
+
const oldSpread = oldVnode.data.spread;
|
|
3782
|
+
if (oldProps === props && oldSpread === spread) {
|
|
3783
|
+
return;
|
|
3784
|
+
}
|
|
3785
|
+
if (isUndefined$1(oldProps)) {
|
|
3786
|
+
oldProps = EmptyObject;
|
|
3787
|
+
}
|
|
3788
|
+
if (!isUndefined$1(oldSpread)) {
|
|
3789
|
+
oldProps = assign({}, oldProps, oldSpread);
|
|
3790
|
+
}
|
|
3791
|
+
}
|
|
3792
|
+
if (!isUndefined$1(spread)) {
|
|
3793
|
+
props = assign({}, props, spread);
|
|
3689
3794
|
}
|
|
3690
3795
|
const isFirstPatch = isNull(oldVnode);
|
|
3691
3796
|
const { elm, sel } = vnode;
|
|
@@ -3695,7 +3800,9 @@ function patchProps(oldVnode, vnode, renderer) {
|
|
|
3695
3800
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3696
3801
|
// different than the one previously set.
|
|
3697
3802
|
if (isFirstPatch ||
|
|
3698
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])
|
|
3803
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key]) ||
|
|
3804
|
+
!(key in oldProps) // this is required because the above case will pass when `cur` is `undefined` and key is missing in `oldProps`
|
|
3805
|
+
) {
|
|
3699
3806
|
// Additional verification if properties are supported by the element
|
|
3700
3807
|
// Validation relies on html properties and public properties being defined on the element,
|
|
3701
3808
|
// SSR has its own custom validation.
|
|
@@ -4755,17 +4862,20 @@ function h(sel, data, children = EmptyArray) {
|
|
|
4755
4862
|
}
|
|
4756
4863
|
});
|
|
4757
4864
|
}
|
|
4758
|
-
|
|
4759
|
-
const
|
|
4760
|
-
return {
|
|
4865
|
+
const { key, ref } = data;
|
|
4866
|
+
const vnode = {
|
|
4761
4867
|
type: 2 /* VNodeType.Element */,
|
|
4762
4868
|
sel,
|
|
4763
4869
|
data,
|
|
4764
4870
|
children,
|
|
4765
|
-
elm,
|
|
4871
|
+
elm: undefined,
|
|
4766
4872
|
key,
|
|
4767
4873
|
owner: vmBeingRendered,
|
|
4768
4874
|
};
|
|
4875
|
+
if (!isUndefined$1(ref)) {
|
|
4876
|
+
setRefVNode(vmBeingRendered, ref, vnode);
|
|
4877
|
+
}
|
|
4878
|
+
return vnode;
|
|
4769
4879
|
}
|
|
4770
4880
|
// [t]ab[i]ndex function
|
|
4771
4881
|
function ti(value) {
|
|
@@ -4830,7 +4940,7 @@ function c(sel, Ctor, data, children = EmptyArray) {
|
|
|
4830
4940
|
});
|
|
4831
4941
|
}
|
|
4832
4942
|
}
|
|
4833
|
-
const { key } = data;
|
|
4943
|
+
const { key, ref } = data;
|
|
4834
4944
|
let elm, aChildren, vm;
|
|
4835
4945
|
const vnode = {
|
|
4836
4946
|
type: 3 /* VNodeType.CustomElement */,
|
|
@@ -4846,6 +4956,9 @@ function c(sel, Ctor, data, children = EmptyArray) {
|
|
|
4846
4956
|
vm,
|
|
4847
4957
|
};
|
|
4848
4958
|
addVNodeToChildLWC(vnode);
|
|
4959
|
+
if (!isUndefined$1(ref)) {
|
|
4960
|
+
setRefVNode(vmBeingRendered, ref, vnode);
|
|
4961
|
+
}
|
|
4849
4962
|
return vnode;
|
|
4850
4963
|
}
|
|
4851
4964
|
// [i]terable node
|
|
@@ -5374,6 +5487,10 @@ function evaluateTemplate(vm, html) {
|
|
|
5374
5487
|
// add the VM to the list of host VMs that can be re-rendered if html is swapped
|
|
5375
5488
|
setActiveVM(vm);
|
|
5376
5489
|
}
|
|
5490
|
+
// reset the refs; they will be set during the tmpl() instantiation
|
|
5491
|
+
const hasRefVNodes = Boolean(html.hasRefs);
|
|
5492
|
+
vm.hasRefVNodes = hasRefVNodes;
|
|
5493
|
+
vm.refVNodes = hasRefVNodes ? create(null) : null;
|
|
5377
5494
|
// right before producing the vnodes, we clear up all internal references
|
|
5378
5495
|
// to custom elements from the template.
|
|
5379
5496
|
vm.velements = [];
|
|
@@ -5732,6 +5849,8 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5732
5849
|
tagName,
|
|
5733
5850
|
mode,
|
|
5734
5851
|
owner,
|
|
5852
|
+
refVNodes: null,
|
|
5853
|
+
hasRefVNodes: false,
|
|
5735
5854
|
children: EmptyArray,
|
|
5736
5855
|
aChildren: EmptyArray,
|
|
5737
5856
|
velements: EmptyArray,
|
|
@@ -6881,6 +7000,7 @@ function validateClassAttr(vnode, elm, renderer) {
|
|
|
6881
7000
|
let { className, classMap } = data;
|
|
6882
7001
|
const { getProperty, getClassList } = renderer;
|
|
6883
7002
|
const scopedToken = getScopeTokenClass(owner);
|
|
7003
|
+
const stylesheetTokenHost = isVCustomElement(vnode) ? getStylesheetTokenHost(vnode) : null;
|
|
6884
7004
|
// Classnames for scoped CSS are added directly to the DOM during rendering,
|
|
6885
7005
|
// or to the VDOM on the server in the case of SSR. As such, these classnames
|
|
6886
7006
|
// are never present in VDOM nodes in the browser.
|
|
@@ -6889,10 +7009,17 @@ function validateClassAttr(vnode, elm, renderer) {
|
|
|
6889
7009
|
// are rendered during SSR. This needs to be accounted for when validating.
|
|
6890
7010
|
if (scopedToken) {
|
|
6891
7011
|
if (!isUndefined$1(className)) {
|
|
6892
|
-
className =
|
|
7012
|
+
className = isNull(stylesheetTokenHost)
|
|
7013
|
+
? `${scopedToken} ${className}`
|
|
7014
|
+
: `${scopedToken} ${className} ${stylesheetTokenHost}`;
|
|
6893
7015
|
}
|
|
6894
7016
|
else if (!isUndefined$1(classMap)) {
|
|
6895
|
-
classMap = Object.assign(Object.assign({}, classMap), { [scopedToken]: true });
|
|
7017
|
+
classMap = Object.assign(Object.assign(Object.assign({}, classMap), { [scopedToken]: true }), (isNull(stylesheetTokenHost) ? {} : { [stylesheetTokenHost]: true }));
|
|
7018
|
+
}
|
|
7019
|
+
else {
|
|
7020
|
+
className = isNull(stylesheetTokenHost)
|
|
7021
|
+
? `${scopedToken}`
|
|
7022
|
+
: `${scopedToken} ${stylesheetTokenHost}`;
|
|
6896
7023
|
}
|
|
6897
7024
|
}
|
|
6898
7025
|
let nodesAreCompatible = true;
|
|
@@ -7134,7 +7261,7 @@ function getComponentConstructor(elm) {
|
|
|
7134
7261
|
}
|
|
7135
7262
|
return ctor;
|
|
7136
7263
|
}
|
|
7137
|
-
/* version: 2.
|
|
7264
|
+
/* version: 2.25.0 */
|
|
7138
7265
|
|
|
7139
7266
|
/*
|
|
7140
7267
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7338,7 +7465,7 @@ function rendererFactory(baseRenderer) {
|
|
|
7338
7465
|
function isNull(obj) {
|
|
7339
7466
|
return obj === null;
|
|
7340
7467
|
}
|
|
7341
|
-
/** version: 2.
|
|
7468
|
+
/** version: 2.25.0 */
|
|
7342
7469
|
|
|
7343
7470
|
/*
|
|
7344
7471
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7957,6 +8084,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
|
7957
8084
|
});
|
|
7958
8085
|
freeze(LightningElement);
|
|
7959
8086
|
seal(LightningElement.prototype);
|
|
7960
|
-
/* version: 2.
|
|
8087
|
+
/* version: 2.25.0 */
|
|
7961
8088
|
|
|
7962
8089
|
export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, rendererFactory, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
|
|
@@ -302,9 +302,9 @@ var LWC = (function (exports) {
|
|
|
302
302
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
303
303
|
*/
|
|
304
304
|
// Increment whenever the LWC template compiler changes
|
|
305
|
-
const LWC_VERSION = "2.
|
|
305
|
+
const LWC_VERSION = "2.25.0";
|
|
306
306
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
307
|
-
/** version: 2.
|
|
307
|
+
/** version: 2.25.0 */
|
|
308
308
|
|
|
309
309
|
/**
|
|
310
310
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -386,7 +386,7 @@ var LWC = (function (exports) {
|
|
|
386
386
|
patch$1(propName);
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
/** version: 2.
|
|
389
|
+
/** version: 2.25.0 */
|
|
390
390
|
|
|
391
391
|
/**
|
|
392
392
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -465,7 +465,7 @@ var LWC = (function (exports) {
|
|
|
465
465
|
setFeatureFlag(name, value);
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
/** version: 2.
|
|
468
|
+
/** version: 2.25.0 */
|
|
469
469
|
|
|
470
470
|
/*
|
|
471
471
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -599,6 +599,20 @@ var LWC = (function (exports) {
|
|
|
599
599
|
}
|
|
600
600
|
return list;
|
|
601
601
|
}
|
|
602
|
+
// Set a ref (lwc:ref) on a VM, from a template API
|
|
603
|
+
function setRefVNode(vm, ref, vnode) {
|
|
604
|
+
if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
|
|
605
|
+
throw new Error('refVNodes must be defined when setting a ref');
|
|
606
|
+
}
|
|
607
|
+
// If this method is called, then vm.refVNodes is set as the template has refs.
|
|
608
|
+
// If not, then something went wrong and we threw an error above.
|
|
609
|
+
const refVNodes = vm.refVNodes;
|
|
610
|
+
// In cases of conflict (two elements with the same ref), prefer, the last one,
|
|
611
|
+
// in depth-first traversal order.
|
|
612
|
+
if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
|
|
613
|
+
refVNodes[ref] = vnode;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
602
616
|
|
|
603
617
|
/*
|
|
604
618
|
* Copyright (c) 2019, salesforce.com, inc.
|
|
@@ -1915,6 +1929,8 @@ var LWC = (function (exports) {
|
|
|
1915
1929
|
},
|
|
1916
1930
|
};
|
|
1917
1931
|
}
|
|
1932
|
+
const EMPTY_REFS = freeze(create(null));
|
|
1933
|
+
const refsCache = new WeakMap();
|
|
1918
1934
|
/**
|
|
1919
1935
|
* This class is the base class for any LWC element.
|
|
1920
1936
|
* Some elements directly extends this class, others implement it via inheritance.
|
|
@@ -2094,6 +2110,70 @@ var LWC = (function (exports) {
|
|
|
2094
2110
|
}
|
|
2095
2111
|
return vm.shadowRoot;
|
|
2096
2112
|
},
|
|
2113
|
+
get refs() {
|
|
2114
|
+
const vm = getAssociatedVM(this);
|
|
2115
|
+
if (isUpdatingTemplate) {
|
|
2116
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2117
|
+
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().`);
|
|
2118
|
+
}
|
|
2119
|
+
// If the template is in the process of being updated, then we don't want to go through the normal
|
|
2120
|
+
// process of returning the refs and caching them, because the state of the refs is unstable.
|
|
2121
|
+
// This can happen if e.g. a template contains `<div class={foo}></div>` and `foo` is computed
|
|
2122
|
+
// based on `this.refs.bar`.
|
|
2123
|
+
return;
|
|
2124
|
+
}
|
|
2125
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2126
|
+
warnIfInvokedDuringConstruction(vm, 'refs');
|
|
2127
|
+
}
|
|
2128
|
+
const { refVNodes, hasRefVNodes, cmpTemplate } = vm;
|
|
2129
|
+
// If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
|
|
2130
|
+
// if `this.refs` is called during the `connectedCallback` phase. The DOM elements have not been rendered yet,
|
|
2131
|
+
// so log a warning. Note we also check `isBeingConstructed()` to avoid a double warning (due to
|
|
2132
|
+
// `warnIfInvokedDuringConstruction` above).
|
|
2133
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
2134
|
+
isNull(cmpTemplate) &&
|
|
2135
|
+
!isBeingConstructed(vm)) {
|
|
2136
|
+
logError(`this.refs is undefined for ${getComponentTag(vm)}. This is either because the attached template has no "lwc:ref" directive, or this.refs was ` +
|
|
2137
|
+
`invoked before renderedCallback(). Use this.refs only when the referenced HTML elements have ` +
|
|
2138
|
+
`been rendered to the DOM, such as within renderedCallback() or disconnectedCallback().`);
|
|
2139
|
+
}
|
|
2140
|
+
// For backwards compatibility with component written before template refs
|
|
2141
|
+
// were introduced, we return undefined if the template has no refs defined
|
|
2142
|
+
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
2143
|
+
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
2144
|
+
// Note it is not sufficient to just check if `refVNodes` is null or empty,
|
|
2145
|
+
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
2146
|
+
if (!hasRefVNodes) {
|
|
2147
|
+
return;
|
|
2148
|
+
}
|
|
2149
|
+
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
2150
|
+
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
2151
|
+
if (isNull(refVNodes)) {
|
|
2152
|
+
return EMPTY_REFS;
|
|
2153
|
+
}
|
|
2154
|
+
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
2155
|
+
// are recreated from scratch every time the template is rendered.
|
|
2156
|
+
// This happens with `vm.refVNodes = null` in `template.ts` in `@lwc/engine-core`.
|
|
2157
|
+
let refs = refsCache.get(refVNodes);
|
|
2158
|
+
if (isUndefined$1(refs)) {
|
|
2159
|
+
refs = create(null);
|
|
2160
|
+
for (const key of keys(refVNodes)) {
|
|
2161
|
+
refs[key] = refVNodes[key].elm;
|
|
2162
|
+
}
|
|
2163
|
+
freeze(refs);
|
|
2164
|
+
refsCache.set(refVNodes, refs);
|
|
2165
|
+
}
|
|
2166
|
+
return refs;
|
|
2167
|
+
},
|
|
2168
|
+
// For backwards compat, we allow component authors to set `refs` as an expando
|
|
2169
|
+
set refs(value) {
|
|
2170
|
+
defineProperty(this, 'refs', {
|
|
2171
|
+
configurable: true,
|
|
2172
|
+
enumerable: true,
|
|
2173
|
+
writable: true,
|
|
2174
|
+
value,
|
|
2175
|
+
});
|
|
2176
|
+
},
|
|
2097
2177
|
get shadowRoot() {
|
|
2098
2178
|
// From within the component instance, the shadowRoot is always reported as "closed".
|
|
2099
2179
|
// Authors should rely on this.template instead.
|
|
@@ -3510,6 +3590,14 @@ var LWC = (function (exports) {
|
|
|
3510
3590
|
const { cmpTemplate, context } = owner;
|
|
3511
3591
|
return (context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken)) || null;
|
|
3512
3592
|
}
|
|
3593
|
+
/**
|
|
3594
|
+
* This function returns the host style token for a custom element if it
|
|
3595
|
+
* exists. Otherwise it returns null.
|
|
3596
|
+
*/
|
|
3597
|
+
function getStylesheetTokenHost(vnode) {
|
|
3598
|
+
const { template: { stylesheetToken }, } = getComponentInternalDef(vnode.ctor);
|
|
3599
|
+
return !isUndefined$1(stylesheetToken) ? makeHostToken(stylesheetToken) : null;
|
|
3600
|
+
}
|
|
3513
3601
|
function getNearestNativeShadowComponent(vm) {
|
|
3514
3602
|
const owner = getNearestShadowComponent(vm);
|
|
3515
3603
|
if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
@@ -3627,6 +3715,9 @@ var LWC = (function (exports) {
|
|
|
3627
3715
|
function isSameVnode(vnode1, vnode2) {
|
|
3628
3716
|
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
3629
3717
|
}
|
|
3718
|
+
function isVCustomElement(vnode) {
|
|
3719
|
+
return vnode.type === 3 /* VNodeType.CustomElement */;
|
|
3720
|
+
}
|
|
3630
3721
|
|
|
3631
3722
|
/*
|
|
3632
3723
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -3682,13 +3773,27 @@ var LWC = (function (exports) {
|
|
|
3682
3773
|
return sel === 'input' && (key === 'value' || key === 'checked');
|
|
3683
3774
|
}
|
|
3684
3775
|
function patchProps(oldVnode, vnode, renderer) {
|
|
3685
|
-
|
|
3686
|
-
|
|
3776
|
+
let { props } = vnode.data;
|
|
3777
|
+
const { spread } = vnode.data;
|
|
3778
|
+
if (isUndefined$1(props) && isUndefined$1(spread)) {
|
|
3687
3779
|
return;
|
|
3688
3780
|
}
|
|
3689
|
-
|
|
3690
|
-
if (
|
|
3691
|
-
|
|
3781
|
+
let oldProps;
|
|
3782
|
+
if (!isNull(oldVnode)) {
|
|
3783
|
+
oldProps = oldVnode.data.props;
|
|
3784
|
+
const oldSpread = oldVnode.data.spread;
|
|
3785
|
+
if (oldProps === props && oldSpread === spread) {
|
|
3786
|
+
return;
|
|
3787
|
+
}
|
|
3788
|
+
if (isUndefined$1(oldProps)) {
|
|
3789
|
+
oldProps = EmptyObject;
|
|
3790
|
+
}
|
|
3791
|
+
if (!isUndefined$1(oldSpread)) {
|
|
3792
|
+
oldProps = assign({}, oldProps, oldSpread);
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
if (!isUndefined$1(spread)) {
|
|
3796
|
+
props = assign({}, props, spread);
|
|
3692
3797
|
}
|
|
3693
3798
|
const isFirstPatch = isNull(oldVnode);
|
|
3694
3799
|
const { elm, sel } = vnode;
|
|
@@ -3698,7 +3803,9 @@ var LWC = (function (exports) {
|
|
|
3698
3803
|
// Set the property if it's the first time is is patched or if the previous property is
|
|
3699
3804
|
// different than the one previously set.
|
|
3700
3805
|
if (isFirstPatch ||
|
|
3701
|
-
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])
|
|
3806
|
+
cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key]) ||
|
|
3807
|
+
!(key in oldProps) // this is required because the above case will pass when `cur` is `undefined` and key is missing in `oldProps`
|
|
3808
|
+
) {
|
|
3702
3809
|
// Additional verification if properties are supported by the element
|
|
3703
3810
|
// Validation relies on html properties and public properties being defined on the element,
|
|
3704
3811
|
// SSR has its own custom validation.
|
|
@@ -4758,17 +4865,20 @@ var LWC = (function (exports) {
|
|
|
4758
4865
|
}
|
|
4759
4866
|
});
|
|
4760
4867
|
}
|
|
4761
|
-
|
|
4762
|
-
const
|
|
4763
|
-
return {
|
|
4868
|
+
const { key, ref } = data;
|
|
4869
|
+
const vnode = {
|
|
4764
4870
|
type: 2 /* VNodeType.Element */,
|
|
4765
4871
|
sel,
|
|
4766
4872
|
data,
|
|
4767
4873
|
children,
|
|
4768
|
-
elm,
|
|
4874
|
+
elm: undefined,
|
|
4769
4875
|
key,
|
|
4770
4876
|
owner: vmBeingRendered,
|
|
4771
4877
|
};
|
|
4878
|
+
if (!isUndefined$1(ref)) {
|
|
4879
|
+
setRefVNode(vmBeingRendered, ref, vnode);
|
|
4880
|
+
}
|
|
4881
|
+
return vnode;
|
|
4772
4882
|
}
|
|
4773
4883
|
// [t]ab[i]ndex function
|
|
4774
4884
|
function ti(value) {
|
|
@@ -4833,7 +4943,7 @@ var LWC = (function (exports) {
|
|
|
4833
4943
|
});
|
|
4834
4944
|
}
|
|
4835
4945
|
}
|
|
4836
|
-
const { key } = data;
|
|
4946
|
+
const { key, ref } = data;
|
|
4837
4947
|
let elm, aChildren, vm;
|
|
4838
4948
|
const vnode = {
|
|
4839
4949
|
type: 3 /* VNodeType.CustomElement */,
|
|
@@ -4849,6 +4959,9 @@ var LWC = (function (exports) {
|
|
|
4849
4959
|
vm,
|
|
4850
4960
|
};
|
|
4851
4961
|
addVNodeToChildLWC(vnode);
|
|
4962
|
+
if (!isUndefined$1(ref)) {
|
|
4963
|
+
setRefVNode(vmBeingRendered, ref, vnode);
|
|
4964
|
+
}
|
|
4852
4965
|
return vnode;
|
|
4853
4966
|
}
|
|
4854
4967
|
// [i]terable node
|
|
@@ -5377,6 +5490,10 @@ var LWC = (function (exports) {
|
|
|
5377
5490
|
// add the VM to the list of host VMs that can be re-rendered if html is swapped
|
|
5378
5491
|
setActiveVM(vm);
|
|
5379
5492
|
}
|
|
5493
|
+
// reset the refs; they will be set during the tmpl() instantiation
|
|
5494
|
+
const hasRefVNodes = Boolean(html.hasRefs);
|
|
5495
|
+
vm.hasRefVNodes = hasRefVNodes;
|
|
5496
|
+
vm.refVNodes = hasRefVNodes ? create(null) : null;
|
|
5380
5497
|
// right before producing the vnodes, we clear up all internal references
|
|
5381
5498
|
// to custom elements from the template.
|
|
5382
5499
|
vm.velements = [];
|
|
@@ -5735,6 +5852,8 @@ var LWC = (function (exports) {
|
|
|
5735
5852
|
tagName,
|
|
5736
5853
|
mode,
|
|
5737
5854
|
owner,
|
|
5855
|
+
refVNodes: null,
|
|
5856
|
+
hasRefVNodes: false,
|
|
5738
5857
|
children: EmptyArray,
|
|
5739
5858
|
aChildren: EmptyArray,
|
|
5740
5859
|
velements: EmptyArray,
|
|
@@ -6884,6 +7003,7 @@ var LWC = (function (exports) {
|
|
|
6884
7003
|
let { className, classMap } = data;
|
|
6885
7004
|
const { getProperty, getClassList } = renderer;
|
|
6886
7005
|
const scopedToken = getScopeTokenClass(owner);
|
|
7006
|
+
const stylesheetTokenHost = isVCustomElement(vnode) ? getStylesheetTokenHost(vnode) : null;
|
|
6887
7007
|
// Classnames for scoped CSS are added directly to the DOM during rendering,
|
|
6888
7008
|
// or to the VDOM on the server in the case of SSR. As such, these classnames
|
|
6889
7009
|
// are never present in VDOM nodes in the browser.
|
|
@@ -6892,10 +7012,17 @@ var LWC = (function (exports) {
|
|
|
6892
7012
|
// are rendered during SSR. This needs to be accounted for when validating.
|
|
6893
7013
|
if (scopedToken) {
|
|
6894
7014
|
if (!isUndefined$1(className)) {
|
|
6895
|
-
className =
|
|
7015
|
+
className = isNull(stylesheetTokenHost)
|
|
7016
|
+
? `${scopedToken} ${className}`
|
|
7017
|
+
: `${scopedToken} ${className} ${stylesheetTokenHost}`;
|
|
6896
7018
|
}
|
|
6897
7019
|
else if (!isUndefined$1(classMap)) {
|
|
6898
|
-
classMap = Object.assign(Object.assign({}, classMap), { [scopedToken]: true });
|
|
7020
|
+
classMap = Object.assign(Object.assign(Object.assign({}, classMap), { [scopedToken]: true }), (isNull(stylesheetTokenHost) ? {} : { [stylesheetTokenHost]: true }));
|
|
7021
|
+
}
|
|
7022
|
+
else {
|
|
7023
|
+
className = isNull(stylesheetTokenHost)
|
|
7024
|
+
? `${scopedToken}`
|
|
7025
|
+
: `${scopedToken} ${stylesheetTokenHost}`;
|
|
6899
7026
|
}
|
|
6900
7027
|
}
|
|
6901
7028
|
let nodesAreCompatible = true;
|
|
@@ -7137,7 +7264,7 @@ var LWC = (function (exports) {
|
|
|
7137
7264
|
}
|
|
7138
7265
|
return ctor;
|
|
7139
7266
|
}
|
|
7140
|
-
/* version: 2.
|
|
7267
|
+
/* version: 2.25.0 */
|
|
7141
7268
|
|
|
7142
7269
|
/*
|
|
7143
7270
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7341,7 +7468,7 @@ var LWC = (function (exports) {
|
|
|
7341
7468
|
function isNull(obj) {
|
|
7342
7469
|
return obj === null;
|
|
7343
7470
|
}
|
|
7344
|
-
/** version: 2.
|
|
7471
|
+
/** version: 2.25.0 */
|
|
7345
7472
|
|
|
7346
7473
|
/*
|
|
7347
7474
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7960,7 +8087,7 @@ var LWC = (function (exports) {
|
|
|
7960
8087
|
});
|
|
7961
8088
|
freeze(LightningElement);
|
|
7962
8089
|
seal(LightningElement.prototype);
|
|
7963
|
-
/* version: 2.
|
|
8090
|
+
/* version: 2.25.0 */
|
|
7964
8091
|
|
|
7965
8092
|
exports.LightningElement = LightningElement;
|
|
7966
8093
|
exports.__unstable__ProfilerControl = profilerControl;
|