lwc 2.35.1 → 2.36.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 +258 -102
- package/dist/engine-dom/iife/es2017/engine-dom.js +258 -102
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +286 -58
- package/dist/engine-dom/iife/es5/engine-dom.js +365 -202
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +412 -131
- package/dist/engine-dom/umd/es2017/engine-dom.js +258 -102
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +286 -58
- package/dist/engine-dom/umd/es5/engine-dom.js +365 -202
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +412 -131
- package/dist/engine-server/commonjs/es2017/engine-server.js +126 -79
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +126 -79
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +5 -5
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +5 -5
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +9 -9
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +7 -7
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +5 -5
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +9 -9
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +7 -7
- 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
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
|
|
36
36
|
var assert = /*#__PURE__*/Object.freeze({
|
|
37
37
|
__proto__: null,
|
|
38
|
+
fail: fail,
|
|
38
39
|
invariant: invariant,
|
|
39
|
-
isTrue: isTrue$1,
|
|
40
40
|
isFalse: isFalse$1,
|
|
41
|
-
|
|
41
|
+
isTrue: isTrue$1
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
/*
|
|
@@ -335,9 +335,9 @@
|
|
|
335
335
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
336
336
|
*/
|
|
337
337
|
// Increment whenever the LWC template compiler changes
|
|
338
|
-
const LWC_VERSION = "2.
|
|
338
|
+
const LWC_VERSION = "2.36.0";
|
|
339
339
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
340
|
-
/** version: 2.
|
|
340
|
+
/** version: 2.36.0 */
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
343
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -416,7 +416,7 @@
|
|
|
416
416
|
setFeatureFlag(name, value);
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
/** version: 2.
|
|
419
|
+
/** version: 2.36.0 */
|
|
420
420
|
|
|
421
421
|
/**
|
|
422
422
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -480,7 +480,7 @@
|
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
/** version: 2.
|
|
483
|
+
/** version: 2.36.0 */
|
|
484
484
|
|
|
485
485
|
/*
|
|
486
486
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -546,7 +546,6 @@
|
|
|
546
546
|
* SPDX-License-Identifier: MIT
|
|
547
547
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
548
548
|
*/
|
|
549
|
-
/** Callbacks to invoke when reporting is enabled **/
|
|
550
549
|
const onReportingEnabledCallbacks = [];
|
|
551
550
|
/** The currently assigned reporting dispatcher. */
|
|
552
551
|
let currentDispatcher$1 = noop;
|
|
@@ -604,11 +603,11 @@
|
|
|
604
603
|
/**
|
|
605
604
|
* Report to the current dispatcher, if there is one.
|
|
606
605
|
* @param reportingEventId
|
|
607
|
-
* @param
|
|
606
|
+
* @param payload - data to report
|
|
608
607
|
*/
|
|
609
|
-
function report(reportingEventId,
|
|
608
|
+
function report(reportingEventId, payload) {
|
|
610
609
|
if (enabled$1) {
|
|
611
|
-
currentDispatcher$1(reportingEventId,
|
|
610
|
+
currentDispatcher$1(reportingEventId, payload);
|
|
612
611
|
}
|
|
613
612
|
}
|
|
614
613
|
|
|
@@ -883,7 +882,7 @@
|
|
|
883
882
|
// Make a shallow copy of an object but omit the given key
|
|
884
883
|
function cloneAndOmitKey(object, keyToOmit) {
|
|
885
884
|
const result = {};
|
|
886
|
-
for (const key of
|
|
885
|
+
for (const key of keys(object)) {
|
|
887
886
|
if (key !== keyToOmit) {
|
|
888
887
|
result[key] = object[key];
|
|
889
888
|
}
|
|
@@ -893,7 +892,7 @@
|
|
|
893
892
|
function flattenStylesheets(stylesheets) {
|
|
894
893
|
const list = [];
|
|
895
894
|
for (const stylesheet of stylesheets) {
|
|
896
|
-
if (!
|
|
895
|
+
if (!isArray$1(stylesheet)) {
|
|
897
896
|
list.push(stylesheet);
|
|
898
897
|
}
|
|
899
898
|
else {
|
|
@@ -3170,6 +3169,10 @@
|
|
|
3170
3169
|
// stylesheets and templates do not have user-meaningful names, but components do
|
|
3171
3170
|
const friendlyName = type === 'component' ? `${type} ${func.name}` : type;
|
|
3172
3171
|
logError(`LWC WARNING: current engine is v${LWC_VERSION}, but ${friendlyName} was compiled with v${version}.\nPlease update your compiled code or LWC engine so that the versions match.\nNo further warnings will appear.`);
|
|
3172
|
+
report(1 /* ReportingEventId.CompilerRuntimeVersionMismatch */, {
|
|
3173
|
+
compilerVersion: version,
|
|
3174
|
+
runtimeVersion: LWC_VERSION,
|
|
3175
|
+
});
|
|
3173
3176
|
}
|
|
3174
3177
|
}
|
|
3175
3178
|
}
|
|
@@ -4905,7 +4908,12 @@
|
|
|
4905
4908
|
} else if (isVScopedSlotFragment(vnode)) {
|
|
4906
4909
|
slotName = vnode.slotName;
|
|
4907
4910
|
}
|
|
4908
|
-
|
|
4911
|
+
// Can't use toString here because Symbol(1).toString() is 'Symbol(1)'
|
|
4912
|
+
// but elm.setAttribute('slot', Symbol(1)) is an error.
|
|
4913
|
+
// the following line also throws same error for symbols
|
|
4914
|
+
// Similar for Object.create(null)
|
|
4915
|
+
const normalizedSlotName = '' + slotName;
|
|
4916
|
+
const vnodes = cmpSlotsMapping[normalizedSlotName] = cmpSlotsMapping[normalizedSlotName] || [];
|
|
4909
4917
|
ArrayPush$1.call(vnodes, vnode);
|
|
4910
4918
|
}
|
|
4911
4919
|
vm.cmpSlots = {
|
|
@@ -5971,6 +5979,8 @@
|
|
|
5971
5979
|
Ctor, { tmpl }) {
|
|
5972
5980
|
if (isFunction$1(Ctor)) {
|
|
5973
5981
|
if (process.env.NODE_ENV !== 'production') {
|
|
5982
|
+
// There is no point in running this in production, because the version mismatch check relies
|
|
5983
|
+
// on code comments which are stripped out in production by minifiers
|
|
5974
5984
|
checkVersionMismatch(Ctor, 'component');
|
|
5975
5985
|
}
|
|
5976
5986
|
signedTemplateMap.set(Ctor, tmpl);
|
|
@@ -6236,6 +6246,7 @@
|
|
|
6236
6246
|
// Validate and flatten any stylesheets defined as `static stylesheets`
|
|
6237
6247
|
function computeStylesheets(vm, ctor) {
|
|
6238
6248
|
if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
|
|
6249
|
+
warnOnStylesheetsMutation(ctor);
|
|
6239
6250
|
const {
|
|
6240
6251
|
stylesheets
|
|
6241
6252
|
} = ctor;
|
|
@@ -6250,6 +6261,24 @@
|
|
|
6250
6261
|
}
|
|
6251
6262
|
return null;
|
|
6252
6263
|
}
|
|
6264
|
+
function warnOnStylesheetsMutation(ctor) {
|
|
6265
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6266
|
+
let {
|
|
6267
|
+
stylesheets
|
|
6268
|
+
} = ctor;
|
|
6269
|
+
defineProperty(ctor, 'stylesheets', {
|
|
6270
|
+
enumerable: true,
|
|
6271
|
+
configurable: true,
|
|
6272
|
+
get() {
|
|
6273
|
+
return stylesheets;
|
|
6274
|
+
},
|
|
6275
|
+
set(newValue) {
|
|
6276
|
+
logWarnOnce(`Dynamically setting the "stylesheets" static property on ${ctor.name} ` + 'will not affect the stylesheets injected.');
|
|
6277
|
+
stylesheets = newValue;
|
|
6278
|
+
}
|
|
6279
|
+
});
|
|
6280
|
+
}
|
|
6281
|
+
}
|
|
6253
6282
|
function computeShadowMode(vm, renderer) {
|
|
6254
6283
|
const {
|
|
6255
6284
|
def
|
|
@@ -6629,7 +6658,7 @@
|
|
|
6629
6658
|
function isSyntheticShadowRootInstance(rootNode) {
|
|
6630
6659
|
return rootNode !== document && isTrue(rootNode.synthetic);
|
|
6631
6660
|
}
|
|
6632
|
-
function reportViolation(source, target, attrName) {
|
|
6661
|
+
function reportViolation$1(source, target, attrName) {
|
|
6633
6662
|
// The vm is either for the source, the target, or both. Either one or both must be using synthetic
|
|
6634
6663
|
// shadow for a violation to be detected.
|
|
6635
6664
|
let vm = getAssociatedVMIfPresent(source.getRootNode().host);
|
|
@@ -6640,7 +6669,10 @@
|
|
|
6640
6669
|
// vm should never be undefined here, but just to be safe, bail out and don't report
|
|
6641
6670
|
return;
|
|
6642
6671
|
}
|
|
6643
|
-
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */,
|
|
6672
|
+
report(0 /* ReportingEventId.CrossRootAriaInSyntheticShadow */, {
|
|
6673
|
+
tagName: vm.tagName,
|
|
6674
|
+
attributeName: attrName,
|
|
6675
|
+
});
|
|
6644
6676
|
if (process.env.NODE_ENV !== 'production') {
|
|
6645
6677
|
// Avoid excessively logging to the console in the case of duplicates.
|
|
6646
6678
|
logWarnOnce(`Element <${source.tagName.toLowerCase()}> uses attribute "${attrName}" to reference element ` +
|
|
@@ -6672,7 +6704,7 @@
|
|
|
6672
6704
|
const sourceElement = sourceElements[i];
|
|
6673
6705
|
const sourceRoot = sourceElement.getRootNode();
|
|
6674
6706
|
if (sourceRoot !== root) {
|
|
6675
|
-
reportViolation(sourceElement, elm, idRefAttrName);
|
|
6707
|
+
reportViolation$1(sourceElement, elm, idRefAttrName);
|
|
6676
6708
|
break;
|
|
6677
6709
|
}
|
|
6678
6710
|
}
|
|
@@ -6687,7 +6719,7 @@
|
|
|
6687
6719
|
const targetRoot = target.getRootNode();
|
|
6688
6720
|
if (targetRoot !== root) {
|
|
6689
6721
|
// target element's shadow root is not the same as ours
|
|
6690
|
-
reportViolation(elm, target, attrName);
|
|
6722
|
+
reportViolation$1(elm, target, attrName);
|
|
6691
6723
|
}
|
|
6692
6724
|
}
|
|
6693
6725
|
}
|
|
@@ -6696,7 +6728,7 @@
|
|
|
6696
6728
|
let enabled = false;
|
|
6697
6729
|
// We want to avoid patching globals whenever possible, so this should be tree-shaken out in prod-mode and if
|
|
6698
6730
|
// reporting is not enabled. It should also only run once
|
|
6699
|
-
function enableDetection() {
|
|
6731
|
+
function enableDetection$1() {
|
|
6700
6732
|
if (enabled) {
|
|
6701
6733
|
return; // don't double-apply the patches
|
|
6702
6734
|
}
|
|
@@ -6748,14 +6780,112 @@
|
|
|
6748
6780
|
if (supportsCssEscape() && isSyntheticShadowLoaded()) {
|
|
6749
6781
|
// Always run detection in dev mode, so we can at least print to the console
|
|
6750
6782
|
if (process.env.NODE_ENV !== 'production') {
|
|
6751
|
-
enableDetection();
|
|
6783
|
+
enableDetection$1();
|
|
6752
6784
|
}
|
|
6753
6785
|
else {
|
|
6754
6786
|
// In prod mode, only enable detection if reporting is enabled
|
|
6755
|
-
onReportingEnabled(enableDetection);
|
|
6787
|
+
onReportingEnabled(enableDetection$1);
|
|
6756
6788
|
}
|
|
6757
6789
|
}
|
|
6758
6790
|
|
|
6791
|
+
/*
|
|
6792
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
6793
|
+
* All rights reserved.
|
|
6794
|
+
* SPDX-License-Identifier: MIT
|
|
6795
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6796
|
+
*/
|
|
6797
|
+
//
|
|
6798
|
+
// The goal of this code is to detect usages of non-standard reflected ARIA properties. These are caused by
|
|
6799
|
+
// legacy non-standard Element.prototype extensions added by the @lwc/aria-reflection package.
|
|
6800
|
+
//
|
|
6801
|
+
// See the README for @lwc/aria-reflection
|
|
6802
|
+
const NON_STANDARD_ARIA_PROPS = ['ariaActiveDescendant', 'ariaControls', 'ariaDescribedBy', 'ariaDetails', 'ariaErrorMessage', 'ariaFlowTo', 'ariaLabelledBy', 'ariaOwns'];
|
|
6803
|
+
function isLightningElement(elm) {
|
|
6804
|
+
// The former case is for `this.prop` (inside component) and the latter is for `element.prop` (outside component).
|
|
6805
|
+
// In both cases, we apply the non-standard prop even when the global polyfill is disabled, so this is kosher.
|
|
6806
|
+
return elm instanceof LightningElement || elm instanceof BaseBridgeElement;
|
|
6807
|
+
}
|
|
6808
|
+
function findVM(elm) {
|
|
6809
|
+
// If it's a shadow DOM component, then it has a host
|
|
6810
|
+
const {
|
|
6811
|
+
host
|
|
6812
|
+
} = elm.getRootNode();
|
|
6813
|
+
const vm = isUndefined$1(host) ? undefined : getAssociatedVMIfPresent(host);
|
|
6814
|
+
if (!isUndefined$1(vm)) {
|
|
6815
|
+
return vm;
|
|
6816
|
+
}
|
|
6817
|
+
// Else it might be a light DOM component. Walk up the tree trying to find the owner
|
|
6818
|
+
let parentElement = elm;
|
|
6819
|
+
while (!isNull(parentElement = parentElement.parentElement)) {
|
|
6820
|
+
if (isLightningElement(parentElement)) {
|
|
6821
|
+
const vm = getAssociatedVMIfPresent(parentElement);
|
|
6822
|
+
if (!isUndefined$1(vm)) {
|
|
6823
|
+
return vm;
|
|
6824
|
+
}
|
|
6825
|
+
}
|
|
6826
|
+
}
|
|
6827
|
+
// If we return undefined, it's because the element was rendered wholly outside a LightningElement
|
|
6828
|
+
}
|
|
6829
|
+
|
|
6830
|
+
function checkAndReportViolation(elm, prop) {
|
|
6831
|
+
if (!isLightningElement(elm)) {
|
|
6832
|
+
const vm = findVM(elm);
|
|
6833
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6834
|
+
logWarnOnce(`Element <${elm.tagName.toLowerCase()}> ` + (isUndefined$1(vm) ? '' : `owned by <${vm.elm.tagName.toLowerCase()}> `) + `uses non-standard property "${prop}". This will be removed in a future version of LWC. ` + `See https://lwc.dev/guide/accessibility#deprecated-aria-reflected-properties`);
|
|
6835
|
+
}
|
|
6836
|
+
report(2 /* ReportingEventId.NonStandardAriaReflection */, {
|
|
6837
|
+
tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
|
|
6838
|
+
propertyName: prop
|
|
6839
|
+
});
|
|
6840
|
+
}
|
|
6841
|
+
}
|
|
6842
|
+
function enableDetection() {
|
|
6843
|
+
const {
|
|
6844
|
+
prototype
|
|
6845
|
+
} = Element;
|
|
6846
|
+
for (const prop of NON_STANDARD_ARIA_PROPS) {
|
|
6847
|
+
const descriptor = getOwnPropertyDescriptor$1(prototype, prop);
|
|
6848
|
+
// The descriptor should exist because the @lwc/aria-reflection polyfill has run by now.
|
|
6849
|
+
// This happens automatically because of the ordering of imports.
|
|
6850
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6851
|
+
/* istanbul ignore if */
|
|
6852
|
+
if (isUndefined$1(descriptor) || isUndefined$1(descriptor.get) || isUndefined$1(descriptor.set)) {
|
|
6853
|
+
// should never happen
|
|
6854
|
+
throw new Error('detect-non-standard-aria.ts loaded before @lwc/aria-reflection');
|
|
6855
|
+
}
|
|
6856
|
+
}
|
|
6857
|
+
// @ts-ignore
|
|
6858
|
+
const {
|
|
6859
|
+
get,
|
|
6860
|
+
set
|
|
6861
|
+
} = descriptor;
|
|
6862
|
+
defineProperty(prototype, prop, {
|
|
6863
|
+
get() {
|
|
6864
|
+
checkAndReportViolation(this, prop);
|
|
6865
|
+
return get.call(this);
|
|
6866
|
+
},
|
|
6867
|
+
set(val) {
|
|
6868
|
+
checkAndReportViolation(this, prop);
|
|
6869
|
+
return set.call(this, val);
|
|
6870
|
+
},
|
|
6871
|
+
configurable: true,
|
|
6872
|
+
enumerable: true
|
|
6873
|
+
});
|
|
6874
|
+
}
|
|
6875
|
+
}
|
|
6876
|
+
// No point in running this code if we're not in a browser, or if the global polyfill is not loaded
|
|
6877
|
+
{
|
|
6878
|
+
if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
6879
|
+
// Always run detection in dev mode, so we can at least print to the console
|
|
6880
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6881
|
+
enableDetection();
|
|
6882
|
+
} else {
|
|
6883
|
+
// In prod mode, only enable detection if reporting is enabled
|
|
6884
|
+
onReportingEnabled(enableDetection);
|
|
6885
|
+
}
|
|
6886
|
+
}
|
|
6887
|
+
}
|
|
6888
|
+
|
|
6759
6889
|
/*
|
|
6760
6890
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
6761
6891
|
* All rights reserved.
|
|
@@ -7240,12 +7370,13 @@
|
|
|
7240
7370
|
*/
|
|
7241
7371
|
// See @lwc/engine-core/src/framework/template.ts
|
|
7242
7372
|
const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
7243
|
-
// Via https://www.npmjs.com/package/object-observer
|
|
7244
|
-
const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
7245
7373
|
// Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
|
|
7246
|
-
const
|
|
7374
|
+
const STYLESHEET_PROPS = [
|
|
7247
7375
|
// SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
|
|
7248
7376
|
'$scoped$'];
|
|
7377
|
+
// Via https://www.npmjs.com/package/object-observer
|
|
7378
|
+
const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
7379
|
+
let mutationTrackingDisabled = false;
|
|
7249
7380
|
function getOriginalArrayMethod(prop) {
|
|
7250
7381
|
switch (prop) {
|
|
7251
7382
|
case 'pop':
|
|
@@ -7268,7 +7399,20 @@
|
|
|
7268
7399
|
return ArrayCopyWithin;
|
|
7269
7400
|
}
|
|
7270
7401
|
}
|
|
7271
|
-
|
|
7402
|
+
function reportViolation(type, eventId, prop) {
|
|
7403
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
7404
|
+
logWarnOnce(`Mutating the "${prop}" property on a ${type} ` + `is deprecated and will be removed in a future version of LWC. ` + `See: https://lwc.dev/guide/css#deprecated-template-mutation`);
|
|
7405
|
+
}
|
|
7406
|
+
report(eventId, {
|
|
7407
|
+
propertyName: prop
|
|
7408
|
+
});
|
|
7409
|
+
}
|
|
7410
|
+
function reportTemplateViolation(prop) {
|
|
7411
|
+
reportViolation('template', 3 /* ReportingEventId.TemplateMutation */, prop);
|
|
7412
|
+
}
|
|
7413
|
+
function reportStylesheetViolation(prop) {
|
|
7414
|
+
reportViolation('stylesheet', 4 /* ReportingEventId.StylesheetMutation */, prop);
|
|
7415
|
+
}
|
|
7272
7416
|
// Warn if the user tries to mutate a stylesheets array, e.g.:
|
|
7273
7417
|
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
7274
7418
|
function warnOnArrayMutation(stylesheets) {
|
|
@@ -7277,7 +7421,7 @@
|
|
|
7277
7421
|
for (const prop of ARRAY_MUTATION_METHODS) {
|
|
7278
7422
|
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
7279
7423
|
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
7280
|
-
|
|
7424
|
+
reportTemplateViolation('stylesheets');
|
|
7281
7425
|
// @ts-ignore
|
|
7282
7426
|
return originalArrayMethod.apply(this, arguments);
|
|
7283
7427
|
};
|
|
@@ -7286,8 +7430,7 @@
|
|
|
7286
7430
|
// Warn if the user tries to mutate a stylesheet factory function, e.g.:
|
|
7287
7431
|
// `stylesheet.$scoped$ = true`
|
|
7288
7432
|
function warnOnStylesheetFunctionMutation(stylesheet) {
|
|
7289
|
-
|
|
7290
|
-
for (const prop of STYLESHEET_FUNCTION_EXPANDOS) {
|
|
7433
|
+
for (const prop of STYLESHEET_PROPS) {
|
|
7291
7434
|
let value = stylesheet[prop];
|
|
7292
7435
|
defineProperty(stylesheet, prop, {
|
|
7293
7436
|
enumerable: true,
|
|
@@ -7296,14 +7439,14 @@
|
|
|
7296
7439
|
return value;
|
|
7297
7440
|
},
|
|
7298
7441
|
set(newValue) {
|
|
7299
|
-
|
|
7442
|
+
reportStylesheetViolation(prop);
|
|
7300
7443
|
value = newValue;
|
|
7301
7444
|
}
|
|
7302
7445
|
});
|
|
7303
7446
|
}
|
|
7304
7447
|
}
|
|
7305
7448
|
// Warn on either array or stylesheet (function) mutation, in a deeply-nested array
|
|
7306
|
-
function
|
|
7449
|
+
function trackStylesheetsMutation(stylesheets) {
|
|
7307
7450
|
traverseStylesheets(stylesheets, subStylesheets => {
|
|
7308
7451
|
if (isArray$1(subStylesheets)) {
|
|
7309
7452
|
warnOnArrayMutation(subStylesheets);
|
|
@@ -7330,7 +7473,70 @@
|
|
|
7330
7473
|
}
|
|
7331
7474
|
}
|
|
7332
7475
|
}
|
|
7476
|
+
function trackMutations(tmpl) {
|
|
7477
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
7478
|
+
trackStylesheetsMutation(tmpl.stylesheets);
|
|
7479
|
+
}
|
|
7480
|
+
for (const prop of TEMPLATE_PROPS) {
|
|
7481
|
+
let value = tmpl[prop];
|
|
7482
|
+
defineProperty(tmpl, prop, {
|
|
7483
|
+
enumerable: true,
|
|
7484
|
+
configurable: true,
|
|
7485
|
+
get() {
|
|
7486
|
+
return value;
|
|
7487
|
+
},
|
|
7488
|
+
set(newValue) {
|
|
7489
|
+
if (!mutationTrackingDisabled) {
|
|
7490
|
+
reportTemplateViolation(prop);
|
|
7491
|
+
}
|
|
7492
|
+
value = newValue;
|
|
7493
|
+
}
|
|
7494
|
+
});
|
|
7495
|
+
}
|
|
7496
|
+
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
7497
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
7498
|
+
enumerable: true,
|
|
7499
|
+
configurable: true,
|
|
7500
|
+
get: originalDescriptor.get,
|
|
7501
|
+
set(value) {
|
|
7502
|
+
reportTemplateViolation('stylesheetTokens');
|
|
7503
|
+
// Avoid logging/reporting twice (for both stylesheetToken and stylesheetTokens)
|
|
7504
|
+
mutationTrackingDisabled = true;
|
|
7505
|
+
originalDescriptor.set.call(this, value);
|
|
7506
|
+
mutationTrackingDisabled = false;
|
|
7507
|
+
}
|
|
7508
|
+
});
|
|
7509
|
+
}
|
|
7510
|
+
function addLegacyStylesheetTokensShim(tmpl) {
|
|
7511
|
+
// When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
|
|
7512
|
+
// is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
7513
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
7514
|
+
enumerable: true,
|
|
7515
|
+
configurable: true,
|
|
7516
|
+
get() {
|
|
7517
|
+
const {
|
|
7518
|
+
stylesheetToken
|
|
7519
|
+
} = this;
|
|
7520
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
7521
|
+
return stylesheetToken;
|
|
7522
|
+
}
|
|
7523
|
+
// Shim for the old `stylesheetTokens` property
|
|
7524
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
7525
|
+
return {
|
|
7526
|
+
hostAttribute: `${stylesheetToken}-host`,
|
|
7527
|
+
shadowAttribute: stylesheetToken
|
|
7528
|
+
};
|
|
7529
|
+
},
|
|
7530
|
+
set(value) {
|
|
7531
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
7532
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
7533
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
7534
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
7535
|
+
}
|
|
7536
|
+
});
|
|
7537
|
+
}
|
|
7333
7538
|
function freezeTemplate(tmpl) {
|
|
7539
|
+
// TODO [#2782]: remove this flag and delete the legacy behavior
|
|
7334
7540
|
if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
|
|
7335
7541
|
// Deep freeze the template
|
|
7336
7542
|
freeze(tmpl);
|
|
@@ -7338,66 +7544,16 @@
|
|
|
7338
7544
|
deepFreeze(tmpl.stylesheets);
|
|
7339
7545
|
}
|
|
7340
7546
|
} else {
|
|
7341
|
-
//
|
|
7342
|
-
//
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
enumerable: true,
|
|
7346
|
-
configurable: true,
|
|
7347
|
-
get() {
|
|
7348
|
-
const {
|
|
7349
|
-
stylesheetToken
|
|
7350
|
-
} = this;
|
|
7351
|
-
if (isUndefined$1(stylesheetToken)) {
|
|
7352
|
-
return stylesheetToken;
|
|
7353
|
-
}
|
|
7354
|
-
// Shim for the old `stylesheetTokens` property
|
|
7355
|
-
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
7356
|
-
return {
|
|
7357
|
-
hostAttribute: `${stylesheetToken}-host`,
|
|
7358
|
-
shadowAttribute: stylesheetToken
|
|
7359
|
-
};
|
|
7360
|
-
},
|
|
7361
|
-
set(value) {
|
|
7362
|
-
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
7363
|
-
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
7364
|
-
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
7365
|
-
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
7366
|
-
}
|
|
7367
|
-
});
|
|
7368
|
-
// When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
|
|
7547
|
+
// template is not frozen - shim, report, and warn
|
|
7548
|
+
// this shim should be applied in both dev and prod
|
|
7549
|
+
addLegacyStylesheetTokensShim(tmpl);
|
|
7550
|
+
// When ENABLE_FROZEN_TEMPLATE is false, we want to warn in dev mode whenever someone is mutating the template
|
|
7369
7551
|
if (process.env.NODE_ENV !== 'production') {
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
defineProperty(tmpl, prop, {
|
|
7376
|
-
enumerable: true,
|
|
7377
|
-
configurable: true,
|
|
7378
|
-
get() {
|
|
7379
|
-
return value;
|
|
7380
|
-
},
|
|
7381
|
-
set(newValue) {
|
|
7382
|
-
if (!mutationWarningsSilenced) {
|
|
7383
|
-
logError(`Dynamically setting the "${prop}" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
7384
|
-
}
|
|
7385
|
-
value = newValue;
|
|
7386
|
-
}
|
|
7387
|
-
});
|
|
7388
|
-
}
|
|
7389
|
-
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
7390
|
-
defineProperty(tmpl, 'stylesheetTokens', {
|
|
7391
|
-
enumerable: true,
|
|
7392
|
-
configurable: true,
|
|
7393
|
-
get: originalDescriptor.get,
|
|
7394
|
-
set(value) {
|
|
7395
|
-
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
7396
|
-
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
7397
|
-
mutationWarningsSilenced = true;
|
|
7398
|
-
originalDescriptor.set.call(this, value);
|
|
7399
|
-
mutationWarningsSilenced = false;
|
|
7400
|
-
}
|
|
7552
|
+
trackMutations(tmpl);
|
|
7553
|
+
} else {
|
|
7554
|
+
// In prod mode, we only track mutations if reporting is enabled
|
|
7555
|
+
onReportingEnabled(() => {
|
|
7556
|
+
trackMutations(tmpl);
|
|
7401
7557
|
});
|
|
7402
7558
|
}
|
|
7403
7559
|
}
|
|
@@ -7425,7 +7581,7 @@
|
|
|
7425
7581
|
}
|
|
7426
7582
|
return ctor;
|
|
7427
7583
|
}
|
|
7428
|
-
/* version: 2.
|
|
7584
|
+
/* version: 2.36.0 */
|
|
7429
7585
|
|
|
7430
7586
|
/*
|
|
7431
7587
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7703,7 +7859,7 @@
|
|
|
7703
7859
|
const cachedConstructors = new Map();
|
|
7704
7860
|
const elementsUpgradedOutsideLWC = new WeakSet();
|
|
7705
7861
|
let elementBeingUpgradedByLWC = false;
|
|
7706
|
-
// Creates a constructor that is intended to be used as a
|
|
7862
|
+
// Creates a constructor that is intended to be used directly as a custom element, except that the upgradeCallback is
|
|
7707
7863
|
// passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
|
|
7708
7864
|
// Another benefit is that only LWC can create components that actually do anything – if you do
|
|
7709
7865
|
// `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
|
|
@@ -7748,7 +7904,7 @@
|
|
|
7748
7904
|
}
|
|
7749
7905
|
return UpgradableConstructor;
|
|
7750
7906
|
};
|
|
7751
|
-
const
|
|
7907
|
+
const createCustomElementUsingUpgradableConstructor = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
|
|
7752
7908
|
// use global custom elements registry
|
|
7753
7909
|
let UpgradableConstructor = cachedConstructors.get(tagName);
|
|
7754
7910
|
if (isUndefined$1(UpgradableConstructor)) {
|
|
@@ -7776,7 +7932,7 @@
|
|
|
7776
7932
|
*/
|
|
7777
7933
|
/**
|
|
7778
7934
|
* Create a scoped registry, i.e. a function that can create custom elements whose tag names
|
|
7779
|
-
* do not conflict with
|
|
7935
|
+
* do not conflict with third-party custom elements having the same tag name.
|
|
7780
7936
|
*/
|
|
7781
7937
|
function createScopedRegistry() {
|
|
7782
7938
|
if (!hasCustomElements) {
|
|
@@ -8317,10 +8473,10 @@
|
|
|
8317
8473
|
* We have three modes for creating custom elements:
|
|
8318
8474
|
*
|
|
8319
8475
|
* 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
|
|
8320
|
-
* 2. "
|
|
8321
|
-
*
|
|
8322
|
-
*
|
|
8323
|
-
* constructor, which allows us to have completely customized functionality for different components.
|
|
8476
|
+
* 2. "Upgradable constructor" custom element. This allows us to have two LWC components with the same tag name,
|
|
8477
|
+
* via a trick: every custom element constructor we define in the registry is basically the same. It's essentially
|
|
8478
|
+
* a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its constructor ("upgradable
|
|
8479
|
+
* constructor"), which allows us to have completely customized functionality for different components.
|
|
8324
8480
|
* 3. "Scoped" (or "pivot") custom elements. This relies on a sophisticated system that emulates the "scoped custom
|
|
8325
8481
|
* elements registry" proposal, with support for avoiding conflicts in tag names both between LWC components and
|
|
8326
8482
|
* between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
|
|
@@ -8331,8 +8487,8 @@
|
|
|
8331
8487
|
if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
|
|
8332
8488
|
createCustomElement = createCustomElementScoped;
|
|
8333
8489
|
} else {
|
|
8334
|
-
// use global
|
|
8335
|
-
createCustomElement =
|
|
8490
|
+
// use the global registry, with an upgradable constructor for the defined custom element
|
|
8491
|
+
createCustomElement = createCustomElementUsingUpgradableConstructor;
|
|
8336
8492
|
}
|
|
8337
8493
|
} else {
|
|
8338
8494
|
// no registry available here
|
|
@@ -8388,10 +8544,10 @@
|
|
|
8388
8544
|
|
|
8389
8545
|
var assert = /*#__PURE__*/Object.freeze({
|
|
8390
8546
|
__proto__: null,
|
|
8547
|
+
fail: fail,
|
|
8391
8548
|
invariant: invariant,
|
|
8392
|
-
isTrue: isTrue$1,
|
|
8393
8549
|
isFalse: isFalse$1,
|
|
8394
|
-
|
|
8550
|
+
isTrue: isTrue$1
|
|
8395
8551
|
});
|
|
8396
8552
|
function isUndefined(obj) {
|
|
8397
8553
|
return obj === undefined;
|
|
@@ -8399,7 +8555,7 @@
|
|
|
8399
8555
|
function isNull(obj) {
|
|
8400
8556
|
return obj === null;
|
|
8401
8557
|
}
|
|
8402
|
-
/** version: 2.
|
|
8558
|
+
/** version: 2.36.0 */
|
|
8403
8559
|
|
|
8404
8560
|
/*
|
|
8405
8561
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8960,7 +9116,7 @@
|
|
|
8960
9116
|
});
|
|
8961
9117
|
freeze(LightningElement);
|
|
8962
9118
|
seal(LightningElement.prototype);
|
|
8963
|
-
/* version: 2.
|
|
9119
|
+
/* version: 2.36.0 */
|
|
8964
9120
|
|
|
8965
9121
|
exports.LightningElement = LightningElement;
|
|
8966
9122
|
exports.__unstable__ProfilerControl = profilerControl;
|