lwc 2.32.0 → 2.32.1
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 +222 -249
- package/dist/engine-dom/iife/es2017/engine-dom.js +222 -249
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +94 -145
- package/dist/engine-dom/iife/es5/engine-dom.js +211 -226
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +120 -183
- package/dist/engine-dom/umd/es2017/engine-dom.js +222 -249
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +94 -145
- package/dist/engine-dom/umd/es5/engine-dom.js +211 -226
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +120 -183
- package/dist/engine-server/commonjs/es2017/engine-server.js +218 -224
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +218 -224
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +676 -909
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +676 -909
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +644 -882
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +85 -345
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +85 -345
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +676 -909
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +644 -882
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +85 -345
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +85 -345
- 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
|
@@ -467,9 +467,9 @@ function htmlEscape(str, attrMode = false) {
|
|
|
467
467
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
468
468
|
*/
|
|
469
469
|
// Increment whenever the LWC template compiler changes
|
|
470
|
-
const LWC_VERSION = "2.32.
|
|
470
|
+
const LWC_VERSION = "2.32.1";
|
|
471
471
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
472
|
-
/** version: 2.32.
|
|
472
|
+
/** version: 2.32.1 */
|
|
473
473
|
|
|
474
474
|
/*
|
|
475
475
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -515,19 +515,14 @@ if (typeof CustomEvent !== 'function') {
|
|
|
515
515
|
*/
|
|
516
516
|
const features = {
|
|
517
517
|
DUMMY_TEST_FLAG: null,
|
|
518
|
-
ENABLE_ELEMENT_PATCH: null,
|
|
519
518
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
520
|
-
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
521
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
522
519
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
523
520
|
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
524
|
-
ENABLE_NODE_LIST_PATCH: null,
|
|
525
|
-
ENABLE_NODE_PATCH: null,
|
|
526
|
-
ENABLE_REACTIVE_SETTER: null,
|
|
527
521
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
528
522
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
529
523
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
530
524
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
525
|
+
ENABLE_FROZEN_TEMPLATE: null,
|
|
531
526
|
};
|
|
532
527
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
533
528
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -581,7 +576,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
581
576
|
setFeatureFlag(name, value);
|
|
582
577
|
}
|
|
583
578
|
}
|
|
584
|
-
/** version: 2.32.
|
|
579
|
+
/** version: 2.32.1 */
|
|
585
580
|
|
|
586
581
|
/* proxy-compat-disable */
|
|
587
582
|
|
|
@@ -998,7 +993,7 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
998
993
|
}),
|
|
999
994
|
};
|
|
1000
995
|
// Apply extra restriction related to DOM manipulation if the element is not a portal.
|
|
1001
|
-
if (!options.isLight && !options.isPortal) {
|
|
996
|
+
if (!options.isLight && options.isSynthetic && !options.isPortal) {
|
|
1002
997
|
const { appendChild, insertBefore, removeChild, replaceChild } = elm;
|
|
1003
998
|
const originalNodeValueDescriptor = getPropertyDescriptor(elm, 'nodeValue');
|
|
1004
999
|
const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
|
|
@@ -2241,24 +2236,6 @@ function createObservedFieldPropertyDescriptor(key) {
|
|
|
2241
2236
|
};
|
|
2242
2237
|
}
|
|
2243
2238
|
|
|
2244
|
-
/*
|
|
2245
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
2246
|
-
* All rights reserved.
|
|
2247
|
-
* SPDX-License-Identifier: MIT
|
|
2248
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2249
|
-
*/
|
|
2250
|
-
const DUMMY_ACCESSOR_REACTIVE_OBSERVER = {
|
|
2251
|
-
observe(job) {
|
|
2252
|
-
job();
|
|
2253
|
-
},
|
|
2254
|
-
reset() { },
|
|
2255
|
-
link() { },
|
|
2256
|
-
};
|
|
2257
|
-
function createAccessorReactiveObserver(vm, set) {
|
|
2258
|
-
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
2259
|
-
return DUMMY_ACCESSOR_REACTIVE_OBSERVER;
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
2239
|
/*
|
|
2263
2240
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
2264
2241
|
* All rights reserved.
|
|
@@ -2266,88 +2243,69 @@ function createAccessorReactiveObserver(vm, set) {
|
|
|
2266
2243
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2267
2244
|
*/
|
|
2268
2245
|
function api$1() {
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2246
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2247
|
+
assert.fail(`@api decorator can only be used as a decorator function.`);
|
|
2248
|
+
}
|
|
2249
|
+
throw new Error();
|
|
2273
2250
|
}
|
|
2274
2251
|
function createPublicPropertyDescriptor(key) {
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2252
|
+
return {
|
|
2253
|
+
get() {
|
|
2254
|
+
const vm = getAssociatedVM(this);
|
|
2255
|
+
if (isBeingConstructed(vm)) {
|
|
2256
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2257
|
+
logError(`Can’t read the value of property \`${toString$1(key)}\` from the constructor because the owner component hasn’t set the value yet. Instead, use the constructor to set a default value for the property.`, vm);
|
|
2258
|
+
}
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2261
|
+
return vm.cmpProps[key];
|
|
2262
|
+
},
|
|
2263
|
+
set(newValue) {
|
|
2264
|
+
const vm = getAssociatedVM(this);
|
|
2265
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2266
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2267
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2268
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2269
|
+
}
|
|
2270
|
+
vm.cmpProps[key] = newValue;
|
|
2271
|
+
},
|
|
2272
|
+
enumerable: true,
|
|
2273
|
+
configurable: true,
|
|
2274
|
+
};
|
|
2298
2275
|
}
|
|
2299
2276
|
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2300
|
-
|
|
2301
|
-
get
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
configurable
|
|
2305
|
-
} = descriptor;
|
|
2306
|
-
if (!isFunction$1(get)) {
|
|
2307
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2308
|
-
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2309
|
-
}
|
|
2310
|
-
throw new Error();
|
|
2311
|
-
}
|
|
2312
|
-
return {
|
|
2313
|
-
get() {
|
|
2314
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2315
|
-
// Assert that the this value is an actual Component with an associated VM.
|
|
2316
|
-
getAssociatedVM(this);
|
|
2317
|
-
}
|
|
2318
|
-
return get.call(this);
|
|
2319
|
-
},
|
|
2320
|
-
set(newValue) {
|
|
2321
|
-
const vm = getAssociatedVM(this);
|
|
2322
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2323
|
-
const vmBeingRendered = getVMBeingRendered();
|
|
2324
|
-
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2325
|
-
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2326
|
-
}
|
|
2327
|
-
if (set) {
|
|
2328
|
-
if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
2329
|
-
let ro = vm.oar[key];
|
|
2330
|
-
if (isUndefined$1(ro)) {
|
|
2331
|
-
ro = vm.oar[key] = createAccessorReactiveObserver();
|
|
2332
|
-
}
|
|
2333
|
-
// every time we invoke this setter from outside (through this wrapper setter)
|
|
2334
|
-
// we should reset the value and then debounce just in case there is a pending
|
|
2335
|
-
// invocation the next tick that is not longer relevant since the value is changing
|
|
2336
|
-
// from outside.
|
|
2337
|
-
ro.reset(newValue);
|
|
2338
|
-
ro.observe(() => {
|
|
2339
|
-
set.call(this, newValue);
|
|
2340
|
-
});
|
|
2341
|
-
} else {
|
|
2342
|
-
set.call(this, newValue);
|
|
2277
|
+
const { get, set, enumerable, configurable } = descriptor;
|
|
2278
|
+
if (!isFunction$1(get)) {
|
|
2279
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2280
|
+
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2343
2281
|
}
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2282
|
+
throw new Error();
|
|
2283
|
+
}
|
|
2284
|
+
return {
|
|
2285
|
+
get() {
|
|
2286
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2287
|
+
// Assert that the this value is an actual Component with an associated VM.
|
|
2288
|
+
getAssociatedVM(this);
|
|
2289
|
+
}
|
|
2290
|
+
return get.call(this);
|
|
2291
|
+
},
|
|
2292
|
+
set(newValue) {
|
|
2293
|
+
const vm = getAssociatedVM(this);
|
|
2294
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2295
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2296
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2297
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2298
|
+
}
|
|
2299
|
+
if (set) {
|
|
2300
|
+
set.call(this, newValue);
|
|
2301
|
+
}
|
|
2302
|
+
else if (process.env.NODE_ENV !== 'production') {
|
|
2303
|
+
assert.fail(`Invalid attempt to set a new value for property ${toString$1(key)} of ${vm} that does not has a setter decorated with @api.`);
|
|
2304
|
+
}
|
|
2305
|
+
},
|
|
2306
|
+
enumerable,
|
|
2307
|
+
configurable,
|
|
2308
|
+
};
|
|
2351
2309
|
}
|
|
2352
2310
|
|
|
2353
2311
|
/*
|
|
@@ -2671,12 +2629,6 @@ function checkVersionMismatch(func, type) {
|
|
|
2671
2629
|
}
|
|
2672
2630
|
}
|
|
2673
2631
|
|
|
2674
|
-
/*
|
|
2675
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
2676
|
-
* All rights reserved.
|
|
2677
|
-
* SPDX-License-Identifier: MIT
|
|
2678
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2679
|
-
*/
|
|
2680
2632
|
const signedTemplateSet = new Set();
|
|
2681
2633
|
function defaultEmptyTemplate() {
|
|
2682
2634
|
return [];
|
|
@@ -2694,32 +2646,6 @@ function registerTemplate(tpl) {
|
|
|
2694
2646
|
checkVersionMismatch(tpl, 'template');
|
|
2695
2647
|
}
|
|
2696
2648
|
signedTemplateSet.add(tpl);
|
|
2697
|
-
// FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
|
|
2698
|
-
// the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
|
|
2699
|
-
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2700
|
-
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2701
|
-
defineProperty(tpl, 'stylesheetTokens', {
|
|
2702
|
-
enumerable: true,
|
|
2703
|
-
configurable: true,
|
|
2704
|
-
get() {
|
|
2705
|
-
const { stylesheetToken } = this;
|
|
2706
|
-
if (isUndefined$1(stylesheetToken)) {
|
|
2707
|
-
return stylesheetToken;
|
|
2708
|
-
}
|
|
2709
|
-
// Shim for the old `stylesheetTokens` property
|
|
2710
|
-
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
2711
|
-
return {
|
|
2712
|
-
hostAttribute: `${stylesheetToken}-host`,
|
|
2713
|
-
shadowAttribute: stylesheetToken,
|
|
2714
|
-
};
|
|
2715
|
-
},
|
|
2716
|
-
set(value) {
|
|
2717
|
-
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
2718
|
-
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
2719
|
-
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
2720
|
-
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
2721
|
-
},
|
|
2722
|
-
});
|
|
2723
2649
|
// chaining this method as a way to wrap existing
|
|
2724
2650
|
// assignment of templates easily, without too much transformation
|
|
2725
2651
|
return tpl;
|
|
@@ -4111,11 +4037,13 @@ function applyDomManual(elm, vnode) {
|
|
|
4111
4037
|
function applyElementRestrictions(elm, vnode) {
|
|
4112
4038
|
var _a, _b;
|
|
4113
4039
|
if (process.env.NODE_ENV !== 'production') {
|
|
4040
|
+
const isSynthetic = vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
4114
4041
|
const isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
|
|
4115
4042
|
const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
|
|
4116
4043
|
patchElementWithRestrictions(elm, {
|
|
4117
4044
|
isPortal,
|
|
4118
|
-
isLight
|
|
4045
|
+
isLight,
|
|
4046
|
+
isSynthetic
|
|
4119
4047
|
});
|
|
4120
4048
|
}
|
|
4121
4049
|
}
|
|
@@ -4531,7 +4459,7 @@ function s(slotName, data, children, slotset) {
|
|
|
4531
4459
|
// undefined is for root components, but root components cannot accept slotted content
|
|
4532
4460
|
setVMBeingRendered(slotset.owner);
|
|
4533
4461
|
try {
|
|
4534
|
-
ArrayPush$1.
|
|
4462
|
+
ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
|
|
4535
4463
|
}
|
|
4536
4464
|
finally {
|
|
4537
4465
|
setVMBeingRendered(vmBeingRenderedInception);
|
|
@@ -5366,15 +5294,10 @@ function resetComponentStateWhenRemoved(vm) {
|
|
|
5366
5294
|
} = vm;
|
|
5367
5295
|
if (state !== 2 /* VMState.disconnected */) {
|
|
5368
5296
|
const {
|
|
5369
|
-
oar,
|
|
5370
5297
|
tro
|
|
5371
5298
|
} = vm;
|
|
5372
5299
|
// Making sure that any observing record will not trigger the rehydrated on this vm
|
|
5373
5300
|
tro.reset();
|
|
5374
|
-
// Making sure that any observing accessor record will not trigger the setter to be reinvoked
|
|
5375
|
-
for (const key in oar) {
|
|
5376
|
-
oar[key].reset();
|
|
5377
|
-
}
|
|
5378
5301
|
runDisconnectedCallback(vm);
|
|
5379
5302
|
// Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
|
|
5380
5303
|
runChildNodesDisconnectedCallback(vm);
|
|
@@ -5427,7 +5350,6 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5427
5350
|
cmpSlots: {
|
|
5428
5351
|
slotAssignments: create(null)
|
|
5429
5352
|
},
|
|
5430
|
-
oar: create(null),
|
|
5431
5353
|
cmpTemplate: null,
|
|
5432
5354
|
hydrated: Boolean(hydrated),
|
|
5433
5355
|
renderMode: def.renderMode,
|
|
@@ -6113,96 +6035,168 @@ function setHooks(hooks) {
|
|
|
6113
6035
|
// See @lwc/engine-core/src/framework/template.ts
|
|
6114
6036
|
const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
6115
6037
|
// Via https://www.npmjs.com/package/object-observer
|
|
6116
|
-
const ARRAY_MUTATION_METHODS = [
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
'reverse',
|
|
6122
|
-
'sort',
|
|
6123
|
-
'fill',
|
|
6124
|
-
'splice',
|
|
6125
|
-
'copyWithin',
|
|
6126
|
-
];
|
|
6038
|
+
const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
6039
|
+
// Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
|
|
6040
|
+
const STYLESHEET_FUNCTION_EXPANDOS = [
|
|
6041
|
+
// SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
|
|
6042
|
+
'$scoped$'];
|
|
6127
6043
|
function getOriginalArrayMethod(prop) {
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6044
|
+
switch (prop) {
|
|
6045
|
+
case 'pop':
|
|
6046
|
+
return ArrayPop;
|
|
6047
|
+
case 'push':
|
|
6048
|
+
return ArrayPush$1;
|
|
6049
|
+
case 'shift':
|
|
6050
|
+
return ArrayShift;
|
|
6051
|
+
case 'unshift':
|
|
6052
|
+
return ArrayUnshift;
|
|
6053
|
+
case 'reverse':
|
|
6054
|
+
return ArrayReverse;
|
|
6055
|
+
case 'sort':
|
|
6056
|
+
return ArraySort;
|
|
6057
|
+
case 'fill':
|
|
6058
|
+
return ArrayFill;
|
|
6059
|
+
case 'splice':
|
|
6060
|
+
return ArraySplice;
|
|
6061
|
+
case 'copyWithin':
|
|
6062
|
+
return ArrayCopyWithin;
|
|
6063
|
+
}
|
|
6148
6064
|
}
|
|
6149
6065
|
let mutationWarningsSilenced = false;
|
|
6150
|
-
// Warn if the user tries to mutate
|
|
6066
|
+
// Warn if the user tries to mutate a stylesheets array, e.g.:
|
|
6151
6067
|
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
6152
6068
|
function warnOnArrayMutation(stylesheets) {
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6069
|
+
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
6070
|
+
// we can at least warn when they use the most common mutation methods.
|
|
6071
|
+
for (const prop of ARRAY_MUTATION_METHODS) {
|
|
6072
|
+
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
6073
|
+
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
6074
|
+
logError(`Mutating the "stylesheets" array on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6075
|
+
// @ts-ignore
|
|
6076
|
+
return originalArrayMethod.apply(this, arguments);
|
|
6077
|
+
};
|
|
6078
|
+
}
|
|
6079
|
+
}
|
|
6080
|
+
// Warn if the user tries to mutate a stylesheet factory function, e.g.:
|
|
6081
|
+
// `stylesheet.$scoped$ = true`
|
|
6082
|
+
function warnOnStylesheetFunctionMutation(stylesheet) {
|
|
6083
|
+
// We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
|
|
6084
|
+
for (const prop of STYLESHEET_FUNCTION_EXPANDOS) {
|
|
6085
|
+
let value = stylesheet[prop];
|
|
6086
|
+
defineProperty(stylesheet, prop, {
|
|
6087
|
+
enumerable: true,
|
|
6088
|
+
configurable: true,
|
|
6089
|
+
get() {
|
|
6090
|
+
return value;
|
|
6091
|
+
},
|
|
6092
|
+
set(newValue) {
|
|
6093
|
+
logError(`Dynamically setting the "${prop}" property on a stylesheet function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6094
|
+
value = newValue;
|
|
6095
|
+
}
|
|
6096
|
+
});
|
|
6097
|
+
}
|
|
6098
|
+
}
|
|
6099
|
+
// Warn on either array or stylesheet (function) mutation, in a deeply-nested array
|
|
6100
|
+
function warnOnStylesheetsMutation(stylesheets) {
|
|
6101
|
+
traverseStylesheets(stylesheets, subStylesheets => {
|
|
6102
|
+
if (isArray$1(subStylesheets)) {
|
|
6103
|
+
warnOnArrayMutation(subStylesheets);
|
|
6104
|
+
} else {
|
|
6105
|
+
warnOnStylesheetFunctionMutation(subStylesheets);
|
|
6106
|
+
}
|
|
6107
|
+
});
|
|
6108
|
+
}
|
|
6109
|
+
// Deeply freeze the entire array (of arrays) of stylesheet factory functions
|
|
6110
|
+
function deepFreeze(stylesheets) {
|
|
6111
|
+
traverseStylesheets(stylesheets, subStylesheets => {
|
|
6112
|
+
freeze(subStylesheets);
|
|
6113
|
+
});
|
|
6114
|
+
}
|
|
6115
|
+
// Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
|
|
6116
|
+
function traverseStylesheets(stylesheets, callback) {
|
|
6117
|
+
callback(stylesheets);
|
|
6118
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
6119
|
+
const stylesheet = stylesheets[i];
|
|
6120
|
+
if (isArray$1(stylesheet)) {
|
|
6121
|
+
traverseStylesheets(stylesheet, callback);
|
|
6122
|
+
} else {
|
|
6123
|
+
callback(stylesheet);
|
|
6163
6124
|
}
|
|
6125
|
+
}
|
|
6164
6126
|
}
|
|
6165
|
-
// TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
|
|
6166
|
-
// just warns on mutation.
|
|
6167
6127
|
function freezeTemplate(tmpl) {
|
|
6128
|
+
if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
|
|
6129
|
+
// Deep freeze the template
|
|
6130
|
+
freeze(tmpl);
|
|
6131
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6132
|
+
deepFreeze(tmpl.stylesheets);
|
|
6133
|
+
}
|
|
6134
|
+
} else {
|
|
6135
|
+
// TODO [#2782]: remove this flag and delete the legacy behavior
|
|
6136
|
+
// When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
|
|
6137
|
+
// is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
6138
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6139
|
+
enumerable: true,
|
|
6140
|
+
configurable: true,
|
|
6141
|
+
get() {
|
|
6142
|
+
const {
|
|
6143
|
+
stylesheetToken
|
|
6144
|
+
} = this;
|
|
6145
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
6146
|
+
return stylesheetToken;
|
|
6147
|
+
}
|
|
6148
|
+
// Shim for the old `stylesheetTokens` property
|
|
6149
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
6150
|
+
return {
|
|
6151
|
+
hostAttribute: `${stylesheetToken}-host`,
|
|
6152
|
+
shadowAttribute: stylesheetToken
|
|
6153
|
+
};
|
|
6154
|
+
},
|
|
6155
|
+
set(value) {
|
|
6156
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
6157
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
6158
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
6159
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
6160
|
+
}
|
|
6161
|
+
});
|
|
6162
|
+
// When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
|
|
6168
6163
|
if (process.env.NODE_ENV !== 'production') {
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
},
|
|
6187
|
-
});
|
|
6188
|
-
}
|
|
6189
|
-
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
6190
|
-
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6191
|
-
enumerable: true,
|
|
6192
|
-
configurable: true,
|
|
6193
|
-
get: originalDescriptor.get,
|
|
6194
|
-
set(value) {
|
|
6195
|
-
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` +
|
|
6196
|
-
`is deprecated and may be removed in a future version of LWC.`);
|
|
6197
|
-
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
6198
|
-
mutationWarningsSilenced = true;
|
|
6199
|
-
originalDescriptor.set.call(this, value);
|
|
6200
|
-
mutationWarningsSilenced = false;
|
|
6201
|
-
},
|
|
6164
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6165
|
+
warnOnStylesheetsMutation(tmpl.stylesheets);
|
|
6166
|
+
}
|
|
6167
|
+
for (const prop of TEMPLATE_PROPS) {
|
|
6168
|
+
let value = tmpl[prop];
|
|
6169
|
+
defineProperty(tmpl, prop, {
|
|
6170
|
+
enumerable: true,
|
|
6171
|
+
configurable: true,
|
|
6172
|
+
get() {
|
|
6173
|
+
return value;
|
|
6174
|
+
},
|
|
6175
|
+
set(newValue) {
|
|
6176
|
+
if (!mutationWarningsSilenced) {
|
|
6177
|
+
logError(`Dynamically setting the "${prop}" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6178
|
+
}
|
|
6179
|
+
value = newValue;
|
|
6180
|
+
}
|
|
6202
6181
|
});
|
|
6182
|
+
}
|
|
6183
|
+
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
6184
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6185
|
+
enumerable: true,
|
|
6186
|
+
configurable: true,
|
|
6187
|
+
get: originalDescriptor.get,
|
|
6188
|
+
set(value) {
|
|
6189
|
+
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6190
|
+
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
6191
|
+
mutationWarningsSilenced = true;
|
|
6192
|
+
originalDescriptor.set.call(this, value);
|
|
6193
|
+
mutationWarningsSilenced = false;
|
|
6194
|
+
}
|
|
6195
|
+
});
|
|
6203
6196
|
}
|
|
6197
|
+
}
|
|
6204
6198
|
}
|
|
6205
|
-
/* version: 2.32.
|
|
6199
|
+
/* version: 2.32.1 */
|
|
6206
6200
|
|
|
6207
6201
|
/*
|
|
6208
6202
|
* Copyright (c) 2020, salesforce.com, inc.
|
|
@@ -6673,6 +6667,6 @@ function renderComponent(tagName, Ctor, props = {}) {
|
|
|
6673
6667
|
*/
|
|
6674
6668
|
freeze(LightningElement);
|
|
6675
6669
|
seal(LightningElement.prototype);
|
|
6676
|
-
/* version: 2.32.
|
|
6670
|
+
/* version: 2.32.1 */
|
|
6677
6671
|
|
|
6678
6672
|
export { LightningElement, api$1 as api, createContextProvider, freezeTemplate, getComponentDef, isComponentConstructor, parseFragment, parseFragment as parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderComponent, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, track, unwrap, wire };
|