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
|
@@ -341,9 +341,9 @@ function htmlAttributeToProperty(attrName) {
|
|
|
341
341
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
342
342
|
*/
|
|
343
343
|
// Increment whenever the LWC template compiler changes
|
|
344
|
-
const LWC_VERSION = "2.32.
|
|
344
|
+
const LWC_VERSION = "2.32.1";
|
|
345
345
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
346
|
-
/** version: 2.32.
|
|
346
|
+
/** version: 2.32.1 */
|
|
347
347
|
|
|
348
348
|
/**
|
|
349
349
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -425,7 +425,7 @@ for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1)
|
|
|
425
425
|
patch$1(propName);
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
|
-
/** version: 2.32.
|
|
428
|
+
/** version: 2.32.1 */
|
|
429
429
|
|
|
430
430
|
/**
|
|
431
431
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -439,19 +439,14 @@ for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1)
|
|
|
439
439
|
*/
|
|
440
440
|
const features = {
|
|
441
441
|
DUMMY_TEST_FLAG: null,
|
|
442
|
-
ENABLE_ELEMENT_PATCH: null,
|
|
443
442
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
444
|
-
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
445
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
446
443
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
447
444
|
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
448
|
-
ENABLE_NODE_LIST_PATCH: null,
|
|
449
|
-
ENABLE_NODE_PATCH: null,
|
|
450
|
-
ENABLE_REACTIVE_SETTER: null,
|
|
451
445
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
452
446
|
ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
|
|
453
447
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
454
448
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
449
|
+
ENABLE_FROZEN_TEMPLATE: null,
|
|
455
450
|
};
|
|
456
451
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
457
452
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -505,7 +500,7 @@ function setFeatureFlagForTest(name, value) {
|
|
|
505
500
|
setFeatureFlag(name, value);
|
|
506
501
|
}
|
|
507
502
|
}
|
|
508
|
-
/** version: 2.32.
|
|
503
|
+
/** version: 2.32.1 */
|
|
509
504
|
|
|
510
505
|
/*
|
|
511
506
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1076,7 +1071,7 @@ function patchElementWithRestrictions(elm, options) {
|
|
|
1076
1071
|
}),
|
|
1077
1072
|
};
|
|
1078
1073
|
// Apply extra restriction related to DOM manipulation if the element is not a portal.
|
|
1079
|
-
if (!options.isLight && !options.isPortal) {
|
|
1074
|
+
if (!options.isLight && options.isSynthetic && !options.isPortal) {
|
|
1080
1075
|
const { appendChild, insertBefore, removeChild, replaceChild } = elm;
|
|
1081
1076
|
const originalNodeValueDescriptor = getPropertyDescriptor(elm, 'nodeValue');
|
|
1082
1077
|
const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');
|
|
@@ -2329,45 +2324,6 @@ function createObservedFieldPropertyDescriptor(key) {
|
|
|
2329
2324
|
configurable: true,
|
|
2330
2325
|
};
|
|
2331
2326
|
}
|
|
2332
|
-
class AccessorReactiveObserver extends ReactiveObserver {
|
|
2333
|
-
constructor(vm, set) {
|
|
2334
|
-
super(() => {
|
|
2335
|
-
if (isFalse(this.debouncing)) {
|
|
2336
|
-
this.debouncing = true;
|
|
2337
|
-
addCallbackToNextTick(() => {
|
|
2338
|
-
if (isTrue(this.debouncing)) {
|
|
2339
|
-
const { value } = this;
|
|
2340
|
-
const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
|
|
2341
|
-
set.call(component, value);
|
|
2342
|
-
// de-bouncing after the call to the original setter to prevent
|
|
2343
|
-
// infinity loop if the setter itself is mutating things that
|
|
2344
|
-
// were accessed during the previous invocation.
|
|
2345
|
-
this.debouncing = false;
|
|
2346
|
-
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
|
|
2347
|
-
// immediate rehydration due to a setter driven mutation, otherwise
|
|
2348
|
-
// the component will get rendered on the second tick, which it is not
|
|
2349
|
-
// desirable.
|
|
2350
|
-
rerenderVM(vm);
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
});
|
|
2354
|
-
}
|
|
2355
|
-
});
|
|
2356
|
-
this.debouncing = false;
|
|
2357
|
-
}
|
|
2358
|
-
reset(value) {
|
|
2359
|
-
super.reset();
|
|
2360
|
-
this.debouncing = false;
|
|
2361
|
-
if (arguments.length > 0) {
|
|
2362
|
-
this.value = value;
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
|
-
}
|
|
2366
|
-
function createAccessorReactiveObserver(vm, set) {
|
|
2367
|
-
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
2368
|
-
return new AccessorReactiveObserver(vm, set)
|
|
2369
|
-
;
|
|
2370
|
-
}
|
|
2371
2327
|
|
|
2372
2328
|
/*
|
|
2373
2329
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2376,90 +2332,71 @@ function createAccessorReactiveObserver(vm, set) {
|
|
|
2376
2332
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2377
2333
|
*/
|
|
2378
2334
|
function api$1() {
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2335
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2336
|
+
assert.fail(`@api decorator can only be used as a decorator function.`);
|
|
2337
|
+
}
|
|
2338
|
+
throw new Error();
|
|
2383
2339
|
}
|
|
2384
2340
|
function createPublicPropertyDescriptor(key) {
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2341
|
+
return {
|
|
2342
|
+
get() {
|
|
2343
|
+
const vm = getAssociatedVM(this);
|
|
2344
|
+
if (isBeingConstructed(vm)) {
|
|
2345
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2346
|
+
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);
|
|
2347
|
+
}
|
|
2348
|
+
return;
|
|
2349
|
+
}
|
|
2350
|
+
componentValueObserved(vm, key);
|
|
2351
|
+
return vm.cmpProps[key];
|
|
2352
|
+
},
|
|
2353
|
+
set(newValue) {
|
|
2354
|
+
const vm = getAssociatedVM(this);
|
|
2355
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2356
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2357
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2358
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2359
|
+
}
|
|
2360
|
+
vm.cmpProps[key] = newValue;
|
|
2361
|
+
componentValueMutated(vm, key);
|
|
2362
|
+
},
|
|
2363
|
+
enumerable: true,
|
|
2364
|
+
configurable: true,
|
|
2365
|
+
};
|
|
2410
2366
|
}
|
|
2411
2367
|
function createPublicAccessorDescriptor(key, descriptor) {
|
|
2412
|
-
|
|
2413
|
-
get
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
configurable
|
|
2417
|
-
} = descriptor;
|
|
2418
|
-
if (!isFunction$1(get)) {
|
|
2419
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2420
|
-
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2421
|
-
}
|
|
2422
|
-
throw new Error();
|
|
2423
|
-
}
|
|
2424
|
-
return {
|
|
2425
|
-
get() {
|
|
2426
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2427
|
-
// Assert that the this value is an actual Component with an associated VM.
|
|
2428
|
-
getAssociatedVM(this);
|
|
2429
|
-
}
|
|
2430
|
-
return get.call(this);
|
|
2431
|
-
},
|
|
2432
|
-
set(newValue) {
|
|
2433
|
-
const vm = getAssociatedVM(this);
|
|
2434
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2435
|
-
const vmBeingRendered = getVMBeingRendered();
|
|
2436
|
-
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2437
|
-
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2438
|
-
}
|
|
2439
|
-
if (set) {
|
|
2440
|
-
if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
2441
|
-
let ro = vm.oar[key];
|
|
2442
|
-
if (isUndefined$1(ro)) {
|
|
2443
|
-
ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
|
|
2444
|
-
}
|
|
2445
|
-
// every time we invoke this setter from outside (through this wrapper setter)
|
|
2446
|
-
// we should reset the value and then debounce just in case there is a pending
|
|
2447
|
-
// invocation the next tick that is not longer relevant since the value is changing
|
|
2448
|
-
// from outside.
|
|
2449
|
-
ro.reset(newValue);
|
|
2450
|
-
ro.observe(() => {
|
|
2451
|
-
set.call(this, newValue);
|
|
2452
|
-
});
|
|
2453
|
-
} else {
|
|
2454
|
-
set.call(this, newValue);
|
|
2368
|
+
const { get, set, enumerable, configurable } = descriptor;
|
|
2369
|
+
if (!isFunction$1(get)) {
|
|
2370
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2371
|
+
assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
|
|
2455
2372
|
}
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2373
|
+
throw new Error();
|
|
2374
|
+
}
|
|
2375
|
+
return {
|
|
2376
|
+
get() {
|
|
2377
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2378
|
+
// Assert that the this value is an actual Component with an associated VM.
|
|
2379
|
+
getAssociatedVM(this);
|
|
2380
|
+
}
|
|
2381
|
+
return get.call(this);
|
|
2382
|
+
},
|
|
2383
|
+
set(newValue) {
|
|
2384
|
+
const vm = getAssociatedVM(this);
|
|
2385
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2386
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2387
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2388
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
|
|
2389
|
+
}
|
|
2390
|
+
if (set) {
|
|
2391
|
+
set.call(this, newValue);
|
|
2392
|
+
}
|
|
2393
|
+
else if (process.env.NODE_ENV !== 'production') {
|
|
2394
|
+
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.`);
|
|
2395
|
+
}
|
|
2396
|
+
},
|
|
2397
|
+
enumerable,
|
|
2398
|
+
configurable,
|
|
2399
|
+
};
|
|
2463
2400
|
}
|
|
2464
2401
|
|
|
2465
2402
|
/*
|
|
@@ -2785,12 +2722,6 @@ function checkVersionMismatch(func, type) {
|
|
|
2785
2722
|
}
|
|
2786
2723
|
}
|
|
2787
2724
|
|
|
2788
|
-
/*
|
|
2789
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
2790
|
-
* All rights reserved.
|
|
2791
|
-
* SPDX-License-Identifier: MIT
|
|
2792
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2793
|
-
*/
|
|
2794
2725
|
const signedTemplateSet = new Set();
|
|
2795
2726
|
function defaultEmptyTemplate() {
|
|
2796
2727
|
return [];
|
|
@@ -2808,32 +2739,6 @@ function registerTemplate(tpl) {
|
|
|
2808
2739
|
checkVersionMismatch(tpl, 'template');
|
|
2809
2740
|
}
|
|
2810
2741
|
signedTemplateSet.add(tpl);
|
|
2811
|
-
// FIXME[@W-10950976]: the template object should be frozen, and it should not be possible to set
|
|
2812
|
-
// the stylesheets or stylesheetToken(s). For backwards compat, though, we shim stylesheetTokens
|
|
2813
|
-
// on top of stylesheetToken for anyone who is accessing the old internal API.
|
|
2814
|
-
// Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
2815
|
-
defineProperty(tpl, 'stylesheetTokens', {
|
|
2816
|
-
enumerable: true,
|
|
2817
|
-
configurable: true,
|
|
2818
|
-
get() {
|
|
2819
|
-
const { stylesheetToken } = this;
|
|
2820
|
-
if (isUndefined$1(stylesheetToken)) {
|
|
2821
|
-
return stylesheetToken;
|
|
2822
|
-
}
|
|
2823
|
-
// Shim for the old `stylesheetTokens` property
|
|
2824
|
-
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
2825
|
-
return {
|
|
2826
|
-
hostAttribute: `${stylesheetToken}-host`,
|
|
2827
|
-
shadowAttribute: stylesheetToken,
|
|
2828
|
-
};
|
|
2829
|
-
},
|
|
2830
|
-
set(value) {
|
|
2831
|
-
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
2832
|
-
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
2833
|
-
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
2834
|
-
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
2835
|
-
},
|
|
2836
|
-
});
|
|
2837
2742
|
// chaining this method as a way to wrap existing
|
|
2838
2743
|
// assignment of templates easily, without too much transformation
|
|
2839
2744
|
return tpl;
|
|
@@ -4370,11 +4275,13 @@ function applyDomManual(elm, vnode) {
|
|
|
4370
4275
|
function applyElementRestrictions(elm, vnode) {
|
|
4371
4276
|
var _a, _b;
|
|
4372
4277
|
if (process.env.NODE_ENV !== 'production') {
|
|
4278
|
+
const isSynthetic = vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
4373
4279
|
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 */;
|
|
4374
4280
|
const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
|
|
4375
4281
|
patchElementWithRestrictions(elm, {
|
|
4376
4282
|
isPortal,
|
|
4377
|
-
isLight
|
|
4283
|
+
isLight,
|
|
4284
|
+
isSynthetic
|
|
4378
4285
|
});
|
|
4379
4286
|
}
|
|
4380
4287
|
}
|
|
@@ -4790,7 +4697,7 @@ function s(slotName, data, children, slotset) {
|
|
|
4790
4697
|
// undefined is for root components, but root components cannot accept slotted content
|
|
4791
4698
|
setVMBeingRendered(slotset.owner);
|
|
4792
4699
|
try {
|
|
4793
|
-
ArrayPush$1.
|
|
4700
|
+
ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
|
|
4794
4701
|
}
|
|
4795
4702
|
finally {
|
|
4796
4703
|
setVMBeingRendered(vmBeingRenderedInception);
|
|
@@ -5670,15 +5577,10 @@ function resetComponentStateWhenRemoved(vm) {
|
|
|
5670
5577
|
} = vm;
|
|
5671
5578
|
if (state !== 2 /* VMState.disconnected */) {
|
|
5672
5579
|
const {
|
|
5673
|
-
oar,
|
|
5674
5580
|
tro
|
|
5675
5581
|
} = vm;
|
|
5676
5582
|
// Making sure that any observing record will not trigger the rehydrated on this vm
|
|
5677
5583
|
tro.reset();
|
|
5678
|
-
// Making sure that any observing accessor record will not trigger the setter to be reinvoked
|
|
5679
|
-
for (const key in oar) {
|
|
5680
|
-
oar[key].reset();
|
|
5681
|
-
}
|
|
5682
5584
|
runDisconnectedCallback(vm);
|
|
5683
5585
|
// Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
|
|
5684
5586
|
runChildNodesDisconnectedCallback(vm);
|
|
@@ -5731,7 +5633,6 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5731
5633
|
cmpSlots: {
|
|
5732
5634
|
slotAssignments: create(null)
|
|
5733
5635
|
},
|
|
5734
|
-
oar: create(null),
|
|
5735
5636
|
cmpTemplate: null,
|
|
5736
5637
|
hydrated: Boolean(hydrated),
|
|
5737
5638
|
renderMode: def.renderMode,
|
|
@@ -6912,94 +6813,166 @@ function setHooks(hooks) {
|
|
|
6912
6813
|
// See @lwc/engine-core/src/framework/template.ts
|
|
6913
6814
|
const TEMPLATE_PROPS = ['slots', 'stylesheetToken', 'stylesheets', 'renderMode'];
|
|
6914
6815
|
// Via https://www.npmjs.com/package/object-observer
|
|
6915
|
-
const ARRAY_MUTATION_METHODS = [
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
'reverse',
|
|
6921
|
-
'sort',
|
|
6922
|
-
'fill',
|
|
6923
|
-
'splice',
|
|
6924
|
-
'copyWithin',
|
|
6925
|
-
];
|
|
6816
|
+
const ARRAY_MUTATION_METHODS = ['pop', 'push', 'shift', 'unshift', 'reverse', 'sort', 'fill', 'splice', 'copyWithin'];
|
|
6817
|
+
// Expandos that may be placed on a stylesheet factory function, and which are meaningful to LWC at runtime
|
|
6818
|
+
const STYLESHEET_FUNCTION_EXPANDOS = [
|
|
6819
|
+
// SEE `KEY__SCOPED_CSS` in @lwc/style-compiler
|
|
6820
|
+
'$scoped$'];
|
|
6926
6821
|
function getOriginalArrayMethod(prop) {
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6822
|
+
switch (prop) {
|
|
6823
|
+
case 'pop':
|
|
6824
|
+
return ArrayPop;
|
|
6825
|
+
case 'push':
|
|
6826
|
+
return ArrayPush$1;
|
|
6827
|
+
case 'shift':
|
|
6828
|
+
return ArrayShift;
|
|
6829
|
+
case 'unshift':
|
|
6830
|
+
return ArrayUnshift;
|
|
6831
|
+
case 'reverse':
|
|
6832
|
+
return ArrayReverse;
|
|
6833
|
+
case 'sort':
|
|
6834
|
+
return ArraySort;
|
|
6835
|
+
case 'fill':
|
|
6836
|
+
return ArrayFill;
|
|
6837
|
+
case 'splice':
|
|
6838
|
+
return ArraySplice;
|
|
6839
|
+
case 'copyWithin':
|
|
6840
|
+
return ArrayCopyWithin;
|
|
6841
|
+
}
|
|
6947
6842
|
}
|
|
6948
6843
|
let mutationWarningsSilenced = false;
|
|
6949
|
-
// Warn if the user tries to mutate
|
|
6844
|
+
// Warn if the user tries to mutate a stylesheets array, e.g.:
|
|
6950
6845
|
// `tmpl.stylesheets.push(someStylesheetFunction)`
|
|
6951
6846
|
function warnOnArrayMutation(stylesheets) {
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6847
|
+
// We can't handle users calling Array.prototype.slice.call(tmpl.stylesheets), but
|
|
6848
|
+
// we can at least warn when they use the most common mutation methods.
|
|
6849
|
+
for (const prop of ARRAY_MUTATION_METHODS) {
|
|
6850
|
+
const originalArrayMethod = getOriginalArrayMethod(prop);
|
|
6851
|
+
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
|
6852
|
+
logError(`Mutating the "stylesheets" array on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6853
|
+
// @ts-ignore
|
|
6854
|
+
return originalArrayMethod.apply(this, arguments);
|
|
6855
|
+
};
|
|
6856
|
+
}
|
|
6857
|
+
}
|
|
6858
|
+
// Warn if the user tries to mutate a stylesheet factory function, e.g.:
|
|
6859
|
+
// `stylesheet.$scoped$ = true`
|
|
6860
|
+
function warnOnStylesheetFunctionMutation(stylesheet) {
|
|
6861
|
+
// We could warn on other properties, but in practice only certain expandos are meaningful to LWC at runtime
|
|
6862
|
+
for (const prop of STYLESHEET_FUNCTION_EXPANDOS) {
|
|
6863
|
+
let value = stylesheet[prop];
|
|
6864
|
+
defineProperty(stylesheet, prop, {
|
|
6865
|
+
enumerable: true,
|
|
6866
|
+
configurable: true,
|
|
6867
|
+
get() {
|
|
6868
|
+
return value;
|
|
6869
|
+
},
|
|
6870
|
+
set(newValue) {
|
|
6871
|
+
logError(`Dynamically setting the "${prop}" property on a stylesheet function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6872
|
+
value = newValue;
|
|
6873
|
+
}
|
|
6874
|
+
});
|
|
6875
|
+
}
|
|
6876
|
+
}
|
|
6877
|
+
// Warn on either array or stylesheet (function) mutation, in a deeply-nested array
|
|
6878
|
+
function warnOnStylesheetsMutation(stylesheets) {
|
|
6879
|
+
traverseStylesheets(stylesheets, subStylesheets => {
|
|
6880
|
+
if (isArray$1(subStylesheets)) {
|
|
6881
|
+
warnOnArrayMutation(subStylesheets);
|
|
6882
|
+
} else {
|
|
6883
|
+
warnOnStylesheetFunctionMutation(subStylesheets);
|
|
6962
6884
|
}
|
|
6885
|
+
});
|
|
6886
|
+
}
|
|
6887
|
+
// Deeply freeze the entire array (of arrays) of stylesheet factory functions
|
|
6888
|
+
function deepFreeze(stylesheets) {
|
|
6889
|
+
traverseStylesheets(stylesheets, subStylesheets => {
|
|
6890
|
+
freeze(subStylesheets);
|
|
6891
|
+
});
|
|
6892
|
+
}
|
|
6893
|
+
// Deep-traverse an array (of arrays) of stylesheet factory functions, and call the callback for every array/function
|
|
6894
|
+
function traverseStylesheets(stylesheets, callback) {
|
|
6895
|
+
callback(stylesheets);
|
|
6896
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
6897
|
+
const stylesheet = stylesheets[i];
|
|
6898
|
+
if (isArray$1(stylesheet)) {
|
|
6899
|
+
traverseStylesheets(stylesheet, callback);
|
|
6900
|
+
} else {
|
|
6901
|
+
callback(stylesheet);
|
|
6902
|
+
}
|
|
6903
|
+
}
|
|
6963
6904
|
}
|
|
6964
|
-
// TODO [#2782]: eventually freezeTemplate() will _actually_ freeze the tmpl object. Today it
|
|
6965
|
-
// just warns on mutation.
|
|
6966
6905
|
function freezeTemplate(tmpl) {
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
});
|
|
6906
|
+
if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
|
|
6907
|
+
// Deep freeze the template
|
|
6908
|
+
freeze(tmpl);
|
|
6909
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6910
|
+
deepFreeze(tmpl.stylesheets);
|
|
6911
|
+
}
|
|
6912
|
+
} else {
|
|
6913
|
+
// TODO [#2782]: remove this flag and delete the legacy behavior
|
|
6914
|
+
// When ENABLE_FROZEN_TEMPLATE is false, then we shim stylesheetTokens on top of stylesheetToken for anyone who
|
|
6915
|
+
// is accessing the old internal API (backwards compat). Details: https://salesforce.quip.com/v1rmAFu2cKAr
|
|
6916
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6917
|
+
enumerable: true,
|
|
6918
|
+
configurable: true,
|
|
6919
|
+
get() {
|
|
6920
|
+
const {
|
|
6921
|
+
stylesheetToken
|
|
6922
|
+
} = this;
|
|
6923
|
+
if (isUndefined$1(stylesheetToken)) {
|
|
6924
|
+
return stylesheetToken;
|
|
6987
6925
|
}
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
6926
|
+
// Shim for the old `stylesheetTokens` property
|
|
6927
|
+
// See https://github.com/salesforce/lwc/pull/2332/files#diff-7901555acef29969adaa6583185b3e9bce475cdc6f23e799a54e0018cb18abaa
|
|
6928
|
+
return {
|
|
6929
|
+
hostAttribute: `${stylesheetToken}-host`,
|
|
6930
|
+
shadowAttribute: stylesheetToken
|
|
6931
|
+
};
|
|
6932
|
+
},
|
|
6933
|
+
set(value) {
|
|
6934
|
+
// If the value is null or some other exotic object, you would be broken anyway in the past
|
|
6935
|
+
// because the engine would try to access hostAttribute/shadowAttribute, which would throw an error.
|
|
6936
|
+
// However it may be undefined in newer versions of LWC, so we need to guard against that case.
|
|
6937
|
+
this.stylesheetToken = isUndefined$1(value) ? undefined : value.shadowAttribute;
|
|
6938
|
+
}
|
|
6939
|
+
});
|
|
6940
|
+
// When ENABLE_FROZEN_TEMPLATE is false, warn in dev mode whenever someone is mutating the template
|
|
6941
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6942
|
+
if (!isUndefined$1(tmpl.stylesheets)) {
|
|
6943
|
+
warnOnStylesheetsMutation(tmpl.stylesheets);
|
|
6944
|
+
}
|
|
6945
|
+
for (const prop of TEMPLATE_PROPS) {
|
|
6946
|
+
let value = tmpl[prop];
|
|
6947
|
+
defineProperty(tmpl, prop, {
|
|
6948
|
+
enumerable: true,
|
|
6949
|
+
configurable: true,
|
|
6950
|
+
get() {
|
|
6951
|
+
return value;
|
|
6952
|
+
},
|
|
6953
|
+
set(newValue) {
|
|
6954
|
+
if (!mutationWarningsSilenced) {
|
|
6955
|
+
logError(`Dynamically setting the "${prop}" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6956
|
+
}
|
|
6957
|
+
value = newValue;
|
|
6958
|
+
}
|
|
7001
6959
|
});
|
|
6960
|
+
}
|
|
6961
|
+
const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, 'stylesheetTokens');
|
|
6962
|
+
defineProperty(tmpl, 'stylesheetTokens', {
|
|
6963
|
+
enumerable: true,
|
|
6964
|
+
configurable: true,
|
|
6965
|
+
get: originalDescriptor.get,
|
|
6966
|
+
set(value) {
|
|
6967
|
+
logError(`Dynamically setting the "stylesheetTokens" property on a template function ` + `is deprecated and may be removed in a future version of LWC.`);
|
|
6968
|
+
// Avoid logging twice (for both stylesheetToken and stylesheetTokens)
|
|
6969
|
+
mutationWarningsSilenced = true;
|
|
6970
|
+
originalDescriptor.set.call(this, value);
|
|
6971
|
+
mutationWarningsSilenced = false;
|
|
6972
|
+
}
|
|
6973
|
+
});
|
|
7002
6974
|
}
|
|
6975
|
+
}
|
|
7003
6976
|
}
|
|
7004
6977
|
|
|
7005
6978
|
/*
|
|
@@ -7024,7 +6997,7 @@ function getComponentConstructor(elm) {
|
|
|
7024
6997
|
}
|
|
7025
6998
|
return ctor;
|
|
7026
6999
|
}
|
|
7027
|
-
/* version: 2.32.
|
|
7000
|
+
/* version: 2.32.1 */
|
|
7028
7001
|
|
|
7029
7002
|
/*
|
|
7030
7003
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7997,7 +7970,7 @@ function rendererFactory(baseRenderer) {
|
|
|
7997
7970
|
function isNull(obj) {
|
|
7998
7971
|
return obj === null;
|
|
7999
7972
|
}
|
|
8000
|
-
/** version: 2.32.
|
|
7973
|
+
/** version: 2.32.1 */
|
|
8001
7974
|
|
|
8002
7975
|
/*
|
|
8003
7976
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8558,6 +8531,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
|
8558
8531
|
});
|
|
8559
8532
|
freeze(LightningElement);
|
|
8560
8533
|
seal(LightningElement.prototype);
|
|
8561
|
-
/* version: 2.32.
|
|
8534
|
+
/* version: 2.32.1 */
|
|
8562
8535
|
|
|
8563
8536
|
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 };
|