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
|
@@ -347,9 +347,9 @@
|
|
|
347
347
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
348
348
|
*/
|
|
349
349
|
// Increment whenever the LWC template compiler changes
|
|
350
|
-
const LWC_VERSION = "2.32.
|
|
350
|
+
const LWC_VERSION = "2.32.1";
|
|
351
351
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
352
|
-
/** version: 2.32.
|
|
352
|
+
/** version: 2.32.1 */
|
|
353
353
|
|
|
354
354
|
/**
|
|
355
355
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -431,7 +431,7 @@
|
|
|
431
431
|
patch$1(propName);
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
/** version: 2.32.
|
|
434
|
+
/** version: 2.32.1 */
|
|
435
435
|
|
|
436
436
|
/**
|
|
437
437
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -445,19 +445,14 @@
|
|
|
445
445
|
*/
|
|
446
446
|
const features = {
|
|
447
447
|
DUMMY_TEST_FLAG: null,
|
|
448
|
-
ENABLE_ELEMENT_PATCH: null,
|
|
449
448
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
450
|
-
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
451
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
452
449
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
453
450
|
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
454
|
-
ENABLE_NODE_LIST_PATCH: null,
|
|
455
|
-
ENABLE_NODE_PATCH: null,
|
|
456
|
-
ENABLE_REACTIVE_SETTER: null,
|
|
457
451
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
458
452
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
459
453
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
460
454
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
455
|
+
ENABLE_FROZEN_TEMPLATE: null,
|
|
461
456
|
};
|
|
462
457
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
463
458
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -511,7 +506,7 @@
|
|
|
511
506
|
setFeatureFlag(name, value);
|
|
512
507
|
}
|
|
513
508
|
}
|
|
514
|
-
/** version: 2.32.
|
|
509
|
+
/** version: 2.32.1 */
|
|
515
510
|
|
|
516
511
|
/*
|
|
517
512
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1082,7 +1077,7 @@
|
|
|
1082
1077
|
}),
|
|
1083
1078
|
};
|
|
1084
1079
|
// Apply extra restriction related to DOM manipulation if the element is not a portal.
|
|
1085
|
-
if (!options.isLight && !options.isPortal) {
|
|
1080
|
+
if (!options.isLight && options.isSynthetic && !options.isPortal) {
|
|
1086
1081
|
const { appendChild, insertBefore, removeChild, replaceChild } = elm;
|
|
1087
1082
|
const originalNodeValueDescriptor = getPropertyDescriptor(elm, 'nodeValue');
|
|
1088
1083
|
const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
|
|
@@ -2335,45 +2330,6 @@
|
|
|
2335
2330
|
configurable: true,
|
|
2336
2331
|
};
|
|
2337
2332
|
}
|
|
2338
|
-
class AccessorReactiveObserver extends ReactiveObserver {
|
|
2339
|
-
constructor(vm, set) {
|
|
2340
|
-
super(() => {
|
|
2341
|
-
if (isFalse(this.debouncing)) {
|
|
2342
|
-
this.debouncing = true;
|
|
2343
|
-
addCallbackToNextTick(() => {
|
|
2344
|
-
if (isTrue(this.debouncing)) {
|
|
2345
|
-
const { value } = this;
|
|
2346
|
-
const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
|
|
2347
|
-
set.call(component, value);
|
|
2348
|
-
// de-bouncing after the call to the original setter to prevent
|
|
2349
|
-
// infinity loop if the setter itself is mutating things that
|
|
2350
|
-
// were accessed during the previous invocation.
|
|
2351
|
-
this.debouncing = false;
|
|
2352
|
-
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
|
|
2353
|
-
// immediate rehydration due to a setter driven mutation, otherwise
|
|
2354
|
-
// the component will get rendered on the second tick, which it is not
|
|
2355
|
-
// desirable.
|
|
2356
|
-
rerenderVM(vm);
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
});
|
|
2360
|
-
}
|
|
2361
|
-
});
|
|
2362
|
-
this.debouncing = false;
|
|
2363
|
-
}
|
|
2364
|
-
reset(value) {
|
|
2365
|
-
super.reset();
|
|
2366
|
-
this.debouncing = false;
|
|
2367
|
-
if (arguments.length > 0) {
|
|
2368
|
-
this.value = value;
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
function createAccessorReactiveObserver(vm, set) {
|
|
2373
|
-
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
2374
|
-
return new AccessorReactiveObserver(vm, set)
|
|
2375
|
-
;
|
|
2376
|
-
}
|
|
2377
2333
|
|
|
2378
2334
|
/*
|
|
2379
2335
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2382,90 +2338,71 @@
|
|
|
2382
2338
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2383
2339
|
*/
|
|
2384
2340
|
function api$1() {
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2341
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2342
|
+
assert.fail(`@api decorator can only be used as a decorator function.`);
|
|
2343
|
+
}
|
|
2344
|
+
throw new Error();
|
|
2389
2345
|
}
|
|
2390
2346
|
function createPublicPropertyDescriptor(key) {
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2347
|
+
return {
|
|
2348
|
+
get() {
|
|
2349
|
+
const vm = getAssociatedVM(this);
|
|
2350
|
+
if (isBeingConstructed(vm)) {
|
|
2351
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2352
|
+
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);
|
|
2353
|
+
}
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
componentValueObserved(vm, key);
|
|
2357
|
+
return vm.cmpProps[key];
|
|
2358
|
+
},
|
|
2359
|
+
set(newValue) {
|
|
2360
|
+
const vm = getAssociatedVM(this);
|
|
2361
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2362
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2363
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2364
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2365
|
+
}
|
|
2366
|
+
vm.cmpProps[key] = newValue;
|
|
2367
|
+
componentValueMutated(vm, key);
|
|
2368
|
+
},
|
|
2369
|
+
enumerable: true,
|
|
2370
|
+
configurable: true,
|
|
2371
|
+
};
|
|
2416
2372
|
}
|
|
2417
2373
|
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2418
|
-
|
|
2419
|
-
get
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
configurable
|
|
2423
|
-
} = descriptor;
|
|
2424
|
-
if (!isFunction$1(get)) {
|
|
2425
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2426
|
-
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2427
|
-
}
|
|
2428
|
-
throw new Error();
|
|
2429
|
-
}
|
|
2430
|
-
return {
|
|
2431
|
-
get() {
|
|
2432
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2433
|
-
// Assert that the this value is an actual Component with an associated VM.
|
|
2434
|
-
getAssociatedVM(this);
|
|
2435
|
-
}
|
|
2436
|
-
return get.call(this);
|
|
2437
|
-
},
|
|
2438
|
-
set(newValue) {
|
|
2439
|
-
const vm = getAssociatedVM(this);
|
|
2440
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2441
|
-
const vmBeingRendered = getVMBeingRendered();
|
|
2442
|
-
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2443
|
-
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2444
|
-
}
|
|
2445
|
-
if (set) {
|
|
2446
|
-
if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
2447
|
-
let ro = vm.oar[key];
|
|
2448
|
-
if (isUndefined$1(ro)) {
|
|
2449
|
-
ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
|
|
2450
|
-
}
|
|
2451
|
-
// every time we invoke this setter from outside (through this wrapper setter)
|
|
2452
|
-
// we should reset the value and then debounce just in case there is a pending
|
|
2453
|
-
// invocation the next tick that is not longer relevant since the value is changing
|
|
2454
|
-
// from outside.
|
|
2455
|
-
ro.reset(newValue);
|
|
2456
|
-
ro.observe(() => {
|
|
2457
|
-
set.call(this, newValue);
|
|
2458
|
-
});
|
|
2459
|
-
} else {
|
|
2460
|
-
set.call(this, newValue);
|
|
2374
|
+
const { get, set, enumerable, configurable } = descriptor;
|
|
2375
|
+
if (!isFunction$1(get)) {
|
|
2376
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2377
|
+
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2461
2378
|
}
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2379
|
+
throw new Error();
|
|
2380
|
+
}
|
|
2381
|
+
return {
|
|
2382
|
+
get() {
|
|
2383
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2384
|
+
// Assert that the this value is an actual Component with an associated VM.
|
|
2385
|
+
getAssociatedVM(this);
|
|
2386
|
+
}
|
|
2387
|
+
return get.call(this);
|
|
2388
|
+
},
|
|
2389
|
+
set(newValue) {
|
|
2390
|
+
const vm = getAssociatedVM(this);
|
|
2391
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2392
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2393
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2394
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2395
|
+
}
|
|
2396
|
+
if (set) {
|
|
2397
|
+
set.call(this, newValue);
|
|
2398
|
+
}
|
|
2399
|
+
else if (process.env.NODE_ENV !== 'production') {
|
|
2400
|
+
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.`);
|
|
2401
|
+
}
|
|
2402
|
+
},
|
|
2403
|
+
enumerable,
|
|
2404
|
+
configurable,
|
|
2405
|
+
};
|
|
2469
2406
|
}
|
|
2470
2407
|
|
|
2471
2408
|
/*
|
|
@@ -2791,12 +2728,6 @@
|
|
|
2791
2728
|
}
|
|
2792
2729
|
}
|
|
2793
2730
|
|
|
2794
|
-
/*
|
|
2795
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
2796
|
-
* All rights reserved.
|
|
2797
|
-
* SPDX-License-Identifier: MIT
|
|
2798
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2799
|
-
*/
|
|
2800
2731
|
const signedTemplateSet = new Set();
|
|
2801
2732
|
function defaultEmptyTemplate() {
|
|
2802
2733
|
return [];
|
|
@@ -2814,32 +2745,6 @@
|
|
|
2814
2745
|
checkVersionMismatch(tpl, 'template');
|
|
2815
2746
|
}
|
|
2816
2747
|
signedTemplateSet.add(tpl);
|
|
2817
|
-
// FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
|
|
2818
|
-
// the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
|
|
2819
|
-
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2820
|
-
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2821
|
-
defineProperty(tpl, 'stylesheetTokens', {
|
|
2822
|
-
enumerable: true,
|
|
2823
|
-
configurable: true,
|
|
2824
|
-
get() {
|
|
2825
|
-
const { stylesheetToken } = this;
|
|
2826
|
-
if (isUndefined$1(stylesheetToken)) {
|
|
2827
|
-
return stylesheetToken;
|
|
2828
|
-
}
|
|
2829
|
-
// Shim for the old `stylesheetTokens` property
|
|
2830
|
-
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
2831
|
-
return {
|
|
2832
|
-
hostAttribute: `${stylesheetToken}-host`,
|
|
2833
|
-
shadowAttribute: stylesheetToken,
|
|
2834
|
-
};
|
|
2835
|
-
},
|
|
2836
|
-
set(value) {
|
|
2837
|
-
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
2838
|
-
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
2839
|
-
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
2840
|
-
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
2841
|
-
},
|
|
2842
|
-
});
|
|
2843
2748
|
// chaining this method as a way to wrap existing
|
|
2844
2749
|
// assignment of templates easily, without too much transformation
|
|
2845
2750
|
return tpl;
|
|
@@ -4376,11 +4281,13 @@
|
|
|
4376
4281
|
function applyElementRestrictions(elm, vnode) {
|
|
4377
4282
|
var _a, _b;
|
|
4378
4283
|
if (process.env.NODE_ENV !== 'production') {
|
|
4284
|
+
const isSynthetic = vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
4379
4285
|
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 */;
|
|
4380
4286
|
const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
|
|
4381
4287
|
patchElementWithRestrictions(elm, {
|
|
4382
4288
|
isPortal,
|
|
4383
|
-
isLight
|
|
4289
|
+
isLight,
|
|
4290
|
+
isSynthetic
|
|
4384
4291
|
});
|
|
4385
4292
|
}
|
|
4386
4293
|
}
|
|
@@ -4796,7 +4703,7 @@
|
|
|
4796
4703
|
// undefined is for root components, but root components cannot accept slotted content
|
|
4797
4704
|
setVMBeingRendered(slotset.owner);
|
|
4798
4705
|
try {
|
|
4799
|
-
ArrayPush$1.
|
|
4706
|
+
ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
|
|
4800
4707
|
}
|
|
4801
4708
|
finally {
|
|
4802
4709
|
setVMBeingRendered(vmBeingRenderedInception);
|
|
@@ -5676,15 +5583,10 @@
|
|
|
5676
5583
|
} = vm;
|
|
5677
5584
|
if (state !== 2 /* VMState.disconnected */) {
|
|
5678
5585
|
const {
|
|
5679
|
-
oar,
|
|
5680
5586
|
tro
|
|
5681
5587
|
} = vm;
|
|
5682
5588
|
// Making sure that any observing record will not trigger the rehydrated on this vm
|
|
5683
5589
|
tro.reset();
|
|
5684
|
-
// Making sure that any observing accessor record will not trigger the setter to be reinvoked
|
|
5685
|
-
for (const key in oar) {
|
|
5686
|
-
oar[key].reset();
|
|
5687
|
-
}
|
|
5688
5590
|
runDisconnectedCallback(vm);
|
|
5689
5591
|
// Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
|
|
5690
5592
|
runChildNodesDisconnectedCallback(vm);
|
|
@@ -5737,7 +5639,6 @@
|
|
|
5737
5639
|
cmpSlots: {
|
|
5738
5640
|
slotAssignments: create(null)
|
|
5739
5641
|
},
|
|
5740
|
-
oar: create(null),
|
|
5741
5642
|
cmpTemplate: null,
|
|
5742
5643
|
hydrated: Boolean(hydrated),
|
|
5743
5644
|
renderMode: def.renderMode,
|
|
@@ -6918,94 +6819,166 @@
|
|
|
6918
6819
|
// See @lwc/engine-core/src/framework/template.ts
|
|
6919
6820
|
const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
6920
6821
|
// Via https://www.npmjs.com/package/object-observer
|
|
6921
|
-
const ARRAY_MUTATION_METHODS = [
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
'reverse',
|
|
6927
|
-
'sort',
|
|
6928
|
-
'fill',
|
|
6929
|
-
'splice',
|
|
6930
|
-
'copyWithin',
|
|
6931
|
-
];
|
|
6822
|
+
const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
6823
|
+
// Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
|
|
6824
|
+
const STYLESHEET_FUNCTION_EXPANDOS = [
|
|
6825
|
+
// SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
|
|
6826
|
+
'$scoped$'];
|
|
6932
6827
|
function getOriginalArrayMethod(prop) {
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6828
|
+
switch (prop) {
|
|
6829
|
+
case 'pop':
|
|
6830
|
+
return ArrayPop;
|
|
6831
|
+
case 'push':
|
|
6832
|
+
return ArrayPush$1;
|
|
6833
|
+
case 'shift':
|
|
6834
|
+
return ArrayShift;
|
|
6835
|
+
case 'unshift':
|
|
6836
|
+
return ArrayUnshift;
|
|
6837
|
+
case 'reverse':
|
|
6838
|
+
return ArrayReverse;
|
|
6839
|
+
case 'sort':
|
|
6840
|
+
return ArraySort;
|
|
6841
|
+
case 'fill':
|
|
6842
|
+
return ArrayFill;
|
|
6843
|
+
case 'splice':
|
|
6844
|
+
return ArraySplice;
|
|
6845
|
+
case 'copyWithin':
|
|
6846
|
+
return ArrayCopyWithin;
|
|
6847
|
+
}
|
|
6953
6848
|
}
|
|
6954
6849
|
let mutationWarningsSilenced = false;
|
|
6955
|
-
// Warn if the user tries to mutate
|
|
6850
|
+
// Warn if the user tries to mutate a stylesheets array, e.g.:
|
|
6956
6851
|
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
6957
6852
|
function warnOnArrayMutation(stylesheets) {
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6853
|
+
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
6854
|
+
// we can at least warn when they use the most common mutation methods.
|
|
6855
|
+
for (const prop of ARRAY_MUTATION_METHODS) {
|
|
6856
|
+
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
6857
|
+
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
6858
|
+
logError(`Mutating the "stylesheets" array on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6859
|
+
// @ts-ignore
|
|
6860
|
+
return originalArrayMethod.apply(this, arguments);
|
|
6861
|
+
};
|
|
6862
|
+
}
|
|
6863
|
+
}
|
|
6864
|
+
// Warn if the user tries to mutate a stylesheet factory function, e.g.:
|
|
6865
|
+
// `stylesheet.$scoped$ = true`
|
|
6866
|
+
function warnOnStylesheetFunctionMutation(stylesheet) {
|
|
6867
|
+
// We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
|
|
6868
|
+
for (const prop of STYLESHEET_FUNCTION_EXPANDOS) {
|
|
6869
|
+
let value = stylesheet[prop];
|
|
6870
|
+
defineProperty(stylesheet, prop, {
|
|
6871
|
+
enumerable: true,
|
|
6872
|
+
configurable: true,
|
|
6873
|
+
get() {
|
|
6874
|
+
return value;
|
|
6875
|
+
},
|
|
6876
|
+
set(newValue) {
|
|
6877
|
+
logError(`Dynamically setting the "${prop}" property on a stylesheet function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6878
|
+
value = newValue;
|
|
6879
|
+
}
|
|
6880
|
+
});
|
|
6881
|
+
}
|
|
6882
|
+
}
|
|
6883
|
+
// Warn on either array or stylesheet (function) mutation, in a deeply-nested array
|
|
6884
|
+
function warnOnStylesheetsMutation(stylesheets) {
|
|
6885
|
+
traverseStylesheets(stylesheets, subStylesheets => {
|
|
6886
|
+
if (isArray$1(subStylesheets)) {
|
|
6887
|
+
warnOnArrayMutation(subStylesheets);
|
|
6888
|
+
} else {
|
|
6889
|
+
warnOnStylesheetFunctionMutation(subStylesheets);
|
|
6968
6890
|
}
|
|
6891
|
+
});
|
|
6892
|
+
}
|
|
6893
|
+
// Deeply freeze the entire array (of arrays) of stylesheet factory functions
|
|
6894
|
+
function deepFreeze(stylesheets) {
|
|
6895
|
+
traverseStylesheets(stylesheets, subStylesheets => {
|
|
6896
|
+
freeze(subStylesheets);
|
|
6897
|
+
});
|
|
6898
|
+
}
|
|
6899
|
+
// Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
|
|
6900
|
+
function traverseStylesheets(stylesheets, callback) {
|
|
6901
|
+
callback(stylesheets);
|
|
6902
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
6903
|
+
const stylesheet = stylesheets[i];
|
|
6904
|
+
if (isArray$1(stylesheet)) {
|
|
6905
|
+
traverseStylesheets(stylesheet, callback);
|
|
6906
|
+
} else {
|
|
6907
|
+
callback(stylesheet);
|
|
6908
|
+
}
|
|
6909
|
+
}
|
|
6969
6910
|
}
|
|
6970
|
-
// TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
|
|
6971
|
-
// just warns on mutation.
|
|
6972
6911
|
function freezeTemplate(tmpl) {
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
});
|
|
6912
|
+
if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
|
|
6913
|
+
// Deep freeze the template
|
|
6914
|
+
freeze(tmpl);
|
|
6915
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6916
|
+
deepFreeze(tmpl.stylesheets);
|
|
6917
|
+
}
|
|
6918
|
+
} else {
|
|
6919
|
+
// TODO [#2782]: remove this flag and delete the legacy behavior
|
|
6920
|
+
// When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
|
|
6921
|
+
// is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
6922
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6923
|
+
enumerable: true,
|
|
6924
|
+
configurable: true,
|
|
6925
|
+
get() {
|
|
6926
|
+
const {
|
|
6927
|
+
stylesheetToken
|
|
6928
|
+
} = this;
|
|
6929
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
6930
|
+
return stylesheetToken;
|
|
6993
6931
|
}
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
6932
|
+
// Shim for the old `stylesheetTokens` property
|
|
6933
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
6934
|
+
return {
|
|
6935
|
+
hostAttribute: `${stylesheetToken}-host`,
|
|
6936
|
+
shadowAttribute: stylesheetToken
|
|
6937
|
+
};
|
|
6938
|
+
},
|
|
6939
|
+
set(value) {
|
|
6940
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
6941
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
6942
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
6943
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
6944
|
+
}
|
|
6945
|
+
});
|
|
6946
|
+
// When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
|
|
6947
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6948
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6949
|
+
warnOnStylesheetsMutation(tmpl.stylesheets);
|
|
6950
|
+
}
|
|
6951
|
+
for (const prop of TEMPLATE_PROPS) {
|
|
6952
|
+
let value = tmpl[prop];
|
|
6953
|
+
defineProperty(tmpl, prop, {
|
|
6954
|
+
enumerable: true,
|
|
6955
|
+
configurable: true,
|
|
6956
|
+
get() {
|
|
6957
|
+
return value;
|
|
6958
|
+
},
|
|
6959
|
+
set(newValue) {
|
|
6960
|
+
if (!mutationWarningsSilenced) {
|
|
6961
|
+
logError(`Dynamically setting the "${prop}" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6962
|
+
}
|
|
6963
|
+
value = newValue;
|
|
6964
|
+
}
|
|
7007
6965
|
});
|
|
6966
|
+
}
|
|
6967
|
+
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
6968
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6969
|
+
enumerable: true,
|
|
6970
|
+
configurable: true,
|
|
6971
|
+
get: originalDescriptor.get,
|
|
6972
|
+
set(value) {
|
|
6973
|
+
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6974
|
+
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
6975
|
+
mutationWarningsSilenced = true;
|
|
6976
|
+
originalDescriptor.set.call(this, value);
|
|
6977
|
+
mutationWarningsSilenced = false;
|
|
6978
|
+
}
|
|
6979
|
+
});
|
|
7008
6980
|
}
|
|
6981
|
+
}
|
|
7009
6982
|
}
|
|
7010
6983
|
|
|
7011
6984
|
/*
|
|
@@ -7030,7 +7003,7 @@
|
|
|
7030
7003
|
}
|
|
7031
7004
|
return ctor;
|
|
7032
7005
|
}
|
|
7033
|
-
/* version: 2.32.
|
|
7006
|
+
/* version: 2.32.1 */
|
|
7034
7007
|
|
|
7035
7008
|
/*
|
|
7036
7009
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8003,7 +7976,7 @@
|
|
|
8003
7976
|
function isNull(obj) {
|
|
8004
7977
|
return obj === null;
|
|
8005
7978
|
}
|
|
8006
|
-
/** version: 2.32.
|
|
7979
|
+
/** version: 2.32.1 */
|
|
8007
7980
|
|
|
8008
7981
|
/*
|
|
8009
7982
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8564,7 +8537,7 @@
|
|
|
8564
8537
|
});
|
|
8565
8538
|
freeze(LightningElement);
|
|
8566
8539
|
seal(LightningElement.prototype);
|
|
8567
|
-
/* version: 2.32.
|
|
8540
|
+
/* version: 2.32.1 */
|
|
8568
8541
|
|
|
8569
8542
|
exports.LightningElement = LightningElement;
|
|
8570
8543
|
exports.__unstable__ProfilerControl = profilerControl;
|