lwc 2.32.1 → 2.34.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 +842 -595
- package/dist/engine-dom/iife/es2017/engine-dom.js +842 -595
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +758 -501
- package/dist/engine-dom/iife/es5/engine-dom.js +316 -177
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +329 -173
- package/dist/engine-dom/umd/es2017/engine-dom.js +842 -595
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +758 -501
- package/dist/engine-dom/umd/es5/engine-dom.js +316 -177
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +329 -173
- package/dist/engine-server/commonjs/es2017/engine-server.js +807 -507
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +807 -507
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +7 -5
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +7 -5
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +7 -5
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +7 -5
- 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 +5 -3
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +5 -3
- 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 +5 -3
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +5 -3
- package/package.json +7 -7
|
@@ -124,6 +124,9 @@
|
|
|
124
124
|
* The above list of 46 aria attributes is consistent with the following resources:
|
|
125
125
|
* https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
|
|
126
126
|
* https://wicg.github.io/aom/spec/aria-reflection.html
|
|
127
|
+
*
|
|
128
|
+
* NOTE: If you update this list, please update test files that implicitly reference this list!
|
|
129
|
+
* Searching the codebase for `aria-flowto` and `ariaFlowTo` should be good enough to find all usages.
|
|
127
130
|
*/
|
|
128
131
|
const AriaPropertyNames = [
|
|
129
132
|
'ariaActiveDescendant',
|
|
@@ -347,91 +350,9 @@
|
|
|
347
350
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
348
351
|
*/
|
|
349
352
|
// Increment whenever the LWC template compiler changes
|
|
350
|
-
const LWC_VERSION = "2.
|
|
353
|
+
const LWC_VERSION = "2.34.0";
|
|
351
354
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
352
|
-
/** version: 2.
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* Copyright (C) 2018 salesforce.com, inc.
|
|
356
|
-
*/
|
|
357
|
-
|
|
358
|
-
/*
|
|
359
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
360
|
-
* All rights reserved.
|
|
361
|
-
* SPDX-License-Identifier: MIT
|
|
362
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
363
|
-
*/
|
|
364
|
-
function detect(propName) {
|
|
365
|
-
return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/*
|
|
369
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
370
|
-
* All rights reserved.
|
|
371
|
-
* SPDX-License-Identifier: MIT
|
|
372
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
373
|
-
*/
|
|
374
|
-
const nodeToAriaPropertyValuesMap = new WeakMap();
|
|
375
|
-
function getAriaPropertyMap(elm) {
|
|
376
|
-
let map = nodeToAriaPropertyValuesMap.get(elm);
|
|
377
|
-
if (map === undefined) {
|
|
378
|
-
map = {};
|
|
379
|
-
nodeToAriaPropertyValuesMap.set(elm, map);
|
|
380
|
-
}
|
|
381
|
-
return map;
|
|
382
|
-
}
|
|
383
|
-
function getNormalizedAriaPropertyValue(value) {
|
|
384
|
-
return value == null ? null : String(value);
|
|
385
|
-
}
|
|
386
|
-
function createAriaPropertyPropertyDescriptor(propName, attrName) {
|
|
387
|
-
return {
|
|
388
|
-
get() {
|
|
389
|
-
const map = getAriaPropertyMap(this);
|
|
390
|
-
if (hasOwnProperty$1.call(map, propName)) {
|
|
391
|
-
return map[propName];
|
|
392
|
-
}
|
|
393
|
-
// otherwise just reflect what's in the attribute
|
|
394
|
-
return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
|
|
395
|
-
},
|
|
396
|
-
set(newValue) {
|
|
397
|
-
const normalizedValue = getNormalizedAriaPropertyValue(newValue);
|
|
398
|
-
const map = getAriaPropertyMap(this);
|
|
399
|
-
map[propName] = normalizedValue;
|
|
400
|
-
// reflect into the corresponding attribute
|
|
401
|
-
if (newValue === null) {
|
|
402
|
-
this.removeAttribute(attrName);
|
|
403
|
-
}
|
|
404
|
-
else {
|
|
405
|
-
this.setAttribute(attrName, newValue);
|
|
406
|
-
}
|
|
407
|
-
},
|
|
408
|
-
configurable: true,
|
|
409
|
-
enumerable: true,
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
function patch$1(propName) {
|
|
413
|
-
// Typescript is inferring the wrong function type for this particular
|
|
414
|
-
// overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
|
|
415
|
-
// @ts-ignore type-mismatch
|
|
416
|
-
const attrName = AriaPropNameToAttrNameMap[propName];
|
|
417
|
-
const descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);
|
|
418
|
-
Object.defineProperty(Element.prototype, propName, descriptor);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/*
|
|
422
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
423
|
-
* All rights reserved.
|
|
424
|
-
* SPDX-License-Identifier: MIT
|
|
425
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
426
|
-
*/
|
|
427
|
-
const ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
|
|
428
|
-
for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1) {
|
|
429
|
-
const propName = ElementPrototypeAriaPropertyNames[i];
|
|
430
|
-
if (detect(propName)) {
|
|
431
|
-
patch$1(propName);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
/** version: 2.32.1 */
|
|
355
|
+
/** version: 2.34.0 */
|
|
435
356
|
|
|
436
357
|
/**
|
|
437
358
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -453,6 +374,8 @@
|
|
|
453
374
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
454
375
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
455
376
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
377
|
+
DISABLE_ARIA_REFLECTION_POLYFILL: null,
|
|
378
|
+
ENABLE_PROGRAMMATIC_STYLESHEETS: null,
|
|
456
379
|
};
|
|
457
380
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
458
381
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -506,7 +429,83 @@
|
|
|
506
429
|
setFeatureFlag(name, value);
|
|
507
430
|
}
|
|
508
431
|
}
|
|
509
|
-
/** version: 2.
|
|
432
|
+
/** version: 2.34.0 */
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Copyright (C) 2018 salesforce.com, inc.
|
|
436
|
+
*/
|
|
437
|
+
|
|
438
|
+
/*
|
|
439
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
440
|
+
* All rights reserved.
|
|
441
|
+
* SPDX-License-Identifier: MIT
|
|
442
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
443
|
+
*/
|
|
444
|
+
function detect(propName, prototype) {
|
|
445
|
+
return isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName));
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/*
|
|
449
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
450
|
+
* All rights reserved.
|
|
451
|
+
* SPDX-License-Identifier: MIT
|
|
452
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
453
|
+
*/
|
|
454
|
+
function createAriaPropertyPropertyDescriptor(attrName) {
|
|
455
|
+
// Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
|
|
456
|
+
// from Element.prototype, because these methods are overridden in LightningElement.
|
|
457
|
+
return {
|
|
458
|
+
get() {
|
|
459
|
+
// reflect what's in the attribute
|
|
460
|
+
return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
|
|
461
|
+
},
|
|
462
|
+
set(newValue) {
|
|
463
|
+
// reflect into the corresponding attribute
|
|
464
|
+
if (isNull(newValue)) {
|
|
465
|
+
this.removeAttribute(attrName);
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
this.setAttribute(attrName, newValue);
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
configurable: true,
|
|
472
|
+
enumerable: true,
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function patch$1(propName, prototype) {
|
|
476
|
+
const attrName = AriaPropNameToAttrNameMap[propName];
|
|
477
|
+
const descriptor = createAriaPropertyPropertyDescriptor(attrName);
|
|
478
|
+
defineProperty(prototype, propName, descriptor);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/*
|
|
482
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
483
|
+
* All rights reserved.
|
|
484
|
+
* SPDX-License-Identifier: MIT
|
|
485
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
486
|
+
*/
|
|
487
|
+
function applyAriaReflection(prototype = Element.prototype) {
|
|
488
|
+
const ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
|
|
489
|
+
for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1) {
|
|
490
|
+
const propName = ElementPrototypeAriaPropertyNames[i];
|
|
491
|
+
if (detect(propName, prototype)) {
|
|
492
|
+
patch$1(propName, prototype);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
/** version: 2.34.0 */
|
|
497
|
+
|
|
498
|
+
/*
|
|
499
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
500
|
+
* All rights reserved.
|
|
501
|
+
* SPDX-License-Identifier: MIT
|
|
502
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
503
|
+
*/
|
|
504
|
+
if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
505
|
+
// If DISABLE_ARIA_REFLECTION_POLYFILL is false, then we need to apply the ARIA reflection polyfill globally,
|
|
506
|
+
// i.e. to the global Element.prototype
|
|
507
|
+
applyAriaReflection();
|
|
508
|
+
}
|
|
510
509
|
|
|
511
510
|
/*
|
|
512
511
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -823,6 +822,7 @@
|
|
|
823
822
|
if (!isUndefined$1(vm)) {
|
|
824
823
|
msg = `${msg}\n${getComponentStack(vm)}`;
|
|
825
824
|
}
|
|
825
|
+
// In Jest tests, reduce the warning and error verbosity by not printing the callstack
|
|
826
826
|
if (process.env.NODE_ENV === 'test') {
|
|
827
827
|
/* eslint-disable-next-line no-console */
|
|
828
828
|
console[method](msg);
|
|
@@ -892,6 +892,9 @@
|
|
|
892
892
|
// Global HTML Attributes & Properties
|
|
893
893
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
|
894
894
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
|
895
|
+
//
|
|
896
|
+
// If you update this list, check for test files that recapitulate the same list. Searching the codebase
|
|
897
|
+
// for e.g. "dropzone" should suffice.
|
|
895
898
|
const globalHTMLProperties = assign(create(null), {
|
|
896
899
|
accessKey: {
|
|
897
900
|
attribute: 'accesskey',
|
|
@@ -1925,46 +1928,51 @@
|
|
|
1925
1928
|
* for the Base Lightning Element, it also include the reactivity bit, so the standard property is reactive.
|
|
1926
1929
|
*/
|
|
1927
1930
|
function createBridgeToElementDescriptor(propName, descriptor) {
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1931
|
+
const {
|
|
1932
|
+
get,
|
|
1933
|
+
set,
|
|
1934
|
+
enumerable,
|
|
1935
|
+
configurable
|
|
1936
|
+
} = descriptor;
|
|
1937
|
+
if (!isFunction$1(get)) {
|
|
1938
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1939
|
+
assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard getter.`);
|
|
1934
1940
|
}
|
|
1935
|
-
|
|
1941
|
+
throw new TypeError();
|
|
1942
|
+
}
|
|
1943
|
+
if (!isFunction$1(set)) {
|
|
1944
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1945
|
+
assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard setter.`);
|
|
1946
|
+
}
|
|
1947
|
+
throw new TypeError();
|
|
1948
|
+
}
|
|
1949
|
+
return {
|
|
1950
|
+
enumerable,
|
|
1951
|
+
configurable,
|
|
1952
|
+
get() {
|
|
1953
|
+
const vm = getAssociatedVM(this);
|
|
1954
|
+
if (isBeingConstructed(vm)) {
|
|
1936
1955
|
if (process.env.NODE_ENV !== 'production') {
|
|
1937
|
-
|
|
1956
|
+
logError(`The value of property \`${propName}\` can't be read 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);
|
|
1938
1957
|
}
|
|
1939
|
-
|
|
1958
|
+
return;
|
|
1959
|
+
}
|
|
1960
|
+
componentValueObserved(vm, propName);
|
|
1961
|
+
return get.call(vm.elm);
|
|
1962
|
+
},
|
|
1963
|
+
set(newValue) {
|
|
1964
|
+
const vm = getAssociatedVM(this);
|
|
1965
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1966
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
1967
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${propName}`);
|
|
1968
|
+
assert.invariant(!isUpdatingTemplate, `When updating the template of ${vmBeingRendered}, one of the accessors used by the template has side effects on the state of ${vm}.${propName}`);
|
|
1969
|
+
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1970
|
+
assert.invariant(!isObject(newValue) || isNull(newValue), `Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
|
|
1971
|
+
}
|
|
1972
|
+
updateComponentValue(vm, propName, newValue);
|
|
1973
|
+
return set.call(vm.elm, newValue);
|
|
1940
1974
|
}
|
|
1941
|
-
|
|
1942
|
-
enumerable,
|
|
1943
|
-
configurable,
|
|
1944
|
-
get() {
|
|
1945
|
-
const vm = getAssociatedVM(this);
|
|
1946
|
-
if (isBeingConstructed(vm)) {
|
|
1947
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1948
|
-
logError(`The value of property \`${propName}\` can't be read 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);
|
|
1949
|
-
}
|
|
1950
|
-
return;
|
|
1951
|
-
}
|
|
1952
|
-
componentValueObserved(vm, propName);
|
|
1953
|
-
return get.call(vm.elm);
|
|
1954
|
-
},
|
|
1955
|
-
set(newValue) {
|
|
1956
|
-
const vm = getAssociatedVM(this);
|
|
1957
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1958
|
-
const vmBeingRendered = getVMBeingRendered();
|
|
1959
|
-
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${propName}`);
|
|
1960
|
-
assert.invariant(!isUpdatingTemplate, `When updating the template of ${vmBeingRendered}, one of the accessors used by the template has side effects on the state of ${vm}.${propName}`);
|
|
1961
|
-
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
1962
|
-
assert.invariant(!isObject(newValue) || isNull(newValue), `Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
|
|
1963
|
-
}
|
|
1964
|
-
updateComponentValue(vm, propName, newValue);
|
|
1965
|
-
return set.call(vm.elm, newValue);
|
|
1966
|
-
},
|
|
1967
|
-
};
|
|
1975
|
+
};
|
|
1968
1976
|
}
|
|
1969
1977
|
const EMPTY_REFS = freeze(create(null));
|
|
1970
1978
|
const refsCache = new WeakMap();
|
|
@@ -1974,345 +1982,442 @@
|
|
|
1974
1982
|
**/
|
|
1975
1983
|
// @ts-ignore
|
|
1976
1984
|
const LightningElement = function () {
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1985
|
+
// This should be as performant as possible, while any initialization should be done lazily
|
|
1986
|
+
if (isNull(vmBeingConstructed)) {
|
|
1987
|
+
// Thrown when doing something like `new LightningElement()` or
|
|
1988
|
+
// `class Foo extends LightningElement {}; new Foo()`
|
|
1989
|
+
throw new TypeError('Illegal constructor');
|
|
1990
|
+
}
|
|
1991
|
+
const vm = vmBeingConstructed;
|
|
1992
|
+
const {
|
|
1993
|
+
def,
|
|
1994
|
+
elm
|
|
1995
|
+
} = vm;
|
|
1996
|
+
const {
|
|
1997
|
+
bridge
|
|
1998
|
+
} = def;
|
|
1999
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2000
|
+
const {
|
|
2001
|
+
assertInstanceOfHTMLElement
|
|
2002
|
+
} = vm.renderer;
|
|
2003
|
+
assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
|
|
2004
|
+
}
|
|
2005
|
+
const component = this;
|
|
2006
|
+
setPrototypeOf(elm, bridge.prototype);
|
|
2007
|
+
vm.component = this;
|
|
2008
|
+
// Locker hooks assignment. When the LWC engine run with Locker, Locker intercepts all the new
|
|
2009
|
+
// component creation and passes hooks to instrument all the component interactions with the
|
|
2010
|
+
// engine. We are intentionally hiding this argument from the formal API of LightningElement
|
|
2011
|
+
// because we don't want folks to know about it just yet.
|
|
2012
|
+
if (arguments.length === 1) {
|
|
2013
|
+
const {
|
|
2014
|
+
callHook,
|
|
2015
|
+
setHook,
|
|
2016
|
+
getHook
|
|
2017
|
+
} = arguments[0];
|
|
2018
|
+
vm.callHook = callHook;
|
|
2019
|
+
vm.setHook = setHook;
|
|
2020
|
+
vm.getHook = getHook;
|
|
2021
|
+
}
|
|
2022
|
+
markLockerLiveObject(this);
|
|
2023
|
+
// Linking elm, shadow root and component with the VM.
|
|
2024
|
+
associateVM(component, vm);
|
|
2025
|
+
associateVM(elm, vm);
|
|
2026
|
+
if (vm.renderMode === 1 /* RenderMode.Shadow */) {
|
|
2027
|
+
vm.renderRoot = doAttachShadow(vm);
|
|
2028
|
+
} else {
|
|
2029
|
+
vm.renderRoot = elm;
|
|
2030
|
+
}
|
|
2031
|
+
// Adding extra guard rails in DEV mode.
|
|
2032
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2033
|
+
patchCustomElementWithRestrictions(elm);
|
|
2034
|
+
patchComponentWithRestrictions(component);
|
|
2035
|
+
}
|
|
2036
|
+
return this;
|
|
2037
|
+
};
|
|
2038
|
+
function doAttachShadow(vm) {
|
|
2039
|
+
const {
|
|
2040
|
+
elm,
|
|
2041
|
+
mode,
|
|
2042
|
+
shadowMode,
|
|
2043
|
+
def: {
|
|
2044
|
+
ctor
|
|
2045
|
+
},
|
|
2046
|
+
renderer: {
|
|
2047
|
+
attachShadow
|
|
2048
|
+
}
|
|
2049
|
+
} = vm;
|
|
2050
|
+
const shadowRoot = attachShadow(elm, {
|
|
2051
|
+
[KEY__SYNTHETIC_MODE]: shadowMode === 1 /* ShadowMode.Synthetic */,
|
|
2052
|
+
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
2053
|
+
mode
|
|
2054
|
+
});
|
|
2055
|
+
vm.shadowRoot = shadowRoot;
|
|
2056
|
+
associateVM(shadowRoot, vm);
|
|
2057
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2058
|
+
patchShadowRootWithRestrictions(shadowRoot);
|
|
2059
|
+
}
|
|
2060
|
+
return shadowRoot;
|
|
2061
|
+
}
|
|
2062
|
+
function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
|
2063
|
+
if (isBeingConstructed(vm)) {
|
|
2064
|
+
logError(`this.${methodOrPropName} should not be called during the construction of the custom element for ${getComponentTag(vm)} because the element is not yet in the DOM or has no children yet.`);
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
// @ts-ignore
|
|
2068
|
+
LightningElement.prototype = {
|
|
2069
|
+
constructor: LightningElement,
|
|
2070
|
+
dispatchEvent(event) {
|
|
2071
|
+
const vm = getAssociatedVM(this);
|
|
2072
|
+
const {
|
|
2073
|
+
elm,
|
|
2074
|
+
renderer: {
|
|
2075
|
+
dispatchEvent
|
|
2076
|
+
}
|
|
2077
|
+
} = vm;
|
|
2078
|
+
return dispatchEvent(elm, event);
|
|
2079
|
+
},
|
|
2080
|
+
addEventListener(type, listener, options) {
|
|
2081
|
+
const vm = getAssociatedVM(this);
|
|
2082
|
+
const {
|
|
2083
|
+
elm,
|
|
2084
|
+
renderer: {
|
|
2085
|
+
addEventListener
|
|
2086
|
+
}
|
|
2087
|
+
} = vm;
|
|
1986
2088
|
if (process.env.NODE_ENV !== 'production') {
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
}
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2089
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
2090
|
+
assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
2091
|
+
assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm} by adding an event listener for "${type}".`);
|
|
2092
|
+
assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
|
|
2093
|
+
}
|
|
2094
|
+
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2095
|
+
addEventListener(elm, type, wrappedListener, options);
|
|
2096
|
+
},
|
|
2097
|
+
removeEventListener(type, listener, options) {
|
|
2098
|
+
const vm = getAssociatedVM(this);
|
|
2099
|
+
const {
|
|
2100
|
+
elm,
|
|
2101
|
+
renderer: {
|
|
2102
|
+
removeEventListener
|
|
2103
|
+
}
|
|
2104
|
+
} = vm;
|
|
2105
|
+
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
2106
|
+
removeEventListener(elm, type, wrappedListener, options);
|
|
2107
|
+
},
|
|
2108
|
+
hasAttribute(name) {
|
|
2109
|
+
const vm = getAssociatedVM(this);
|
|
2110
|
+
const {
|
|
2111
|
+
elm,
|
|
2112
|
+
renderer: {
|
|
2113
|
+
getAttribute
|
|
2114
|
+
}
|
|
2115
|
+
} = vm;
|
|
2116
|
+
return !isNull(getAttribute(elm, name));
|
|
2117
|
+
},
|
|
2118
|
+
hasAttributeNS(namespace, name) {
|
|
2119
|
+
const vm = getAssociatedVM(this);
|
|
2120
|
+
const {
|
|
2121
|
+
elm,
|
|
2122
|
+
renderer: {
|
|
2123
|
+
getAttribute
|
|
2124
|
+
}
|
|
2125
|
+
} = vm;
|
|
2126
|
+
return !isNull(getAttribute(elm, name, namespace));
|
|
2127
|
+
},
|
|
2128
|
+
removeAttribute(name) {
|
|
2129
|
+
const vm = getAssociatedVM(this);
|
|
2130
|
+
const {
|
|
2131
|
+
elm,
|
|
2132
|
+
renderer: {
|
|
2133
|
+
removeAttribute
|
|
2134
|
+
}
|
|
2135
|
+
} = vm;
|
|
2136
|
+
unlockAttribute(elm, name);
|
|
2137
|
+
removeAttribute(elm, name);
|
|
2138
|
+
lockAttribute();
|
|
2139
|
+
},
|
|
2140
|
+
removeAttributeNS(namespace, name) {
|
|
2141
|
+
const {
|
|
2142
|
+
elm,
|
|
2143
|
+
renderer: {
|
|
2144
|
+
removeAttribute
|
|
2145
|
+
}
|
|
2146
|
+
} = getAssociatedVM(this);
|
|
2147
|
+
unlockAttribute(elm, name);
|
|
2148
|
+
removeAttribute(elm, name, namespace);
|
|
2149
|
+
lockAttribute();
|
|
2150
|
+
},
|
|
2151
|
+
getAttribute(name) {
|
|
2152
|
+
const vm = getAssociatedVM(this);
|
|
2153
|
+
const {
|
|
2154
|
+
elm
|
|
2155
|
+
} = vm;
|
|
2156
|
+
const {
|
|
2157
|
+
getAttribute
|
|
2158
|
+
} = vm.renderer;
|
|
2159
|
+
return getAttribute(elm, name);
|
|
2160
|
+
},
|
|
2161
|
+
getAttributeNS(namespace, name) {
|
|
2162
|
+
const vm = getAssociatedVM(this);
|
|
2163
|
+
const {
|
|
2164
|
+
elm
|
|
2165
|
+
} = vm;
|
|
2166
|
+
const {
|
|
2167
|
+
getAttribute
|
|
2168
|
+
} = vm.renderer;
|
|
2169
|
+
return getAttribute(elm, name, namespace);
|
|
2170
|
+
},
|
|
2171
|
+
setAttribute(name, value) {
|
|
2172
|
+
const vm = getAssociatedVM(this);
|
|
2173
|
+
const {
|
|
2174
|
+
elm,
|
|
2175
|
+
renderer: {
|
|
2176
|
+
setAttribute
|
|
2177
|
+
}
|
|
2178
|
+
} = vm;
|
|
2179
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2180
|
+
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2181
|
+
}
|
|
2182
|
+
unlockAttribute(elm, name);
|
|
2183
|
+
setAttribute(elm, name, value);
|
|
2184
|
+
lockAttribute();
|
|
2185
|
+
},
|
|
2186
|
+
setAttributeNS(namespace, name, value) {
|
|
2187
|
+
const vm = getAssociatedVM(this);
|
|
2188
|
+
const {
|
|
2189
|
+
elm,
|
|
2190
|
+
renderer: {
|
|
2191
|
+
setAttribute
|
|
2192
|
+
}
|
|
2193
|
+
} = vm;
|
|
2194
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2195
|
+
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2196
|
+
}
|
|
2197
|
+
unlockAttribute(elm, name);
|
|
2198
|
+
setAttribute(elm, name, value, namespace);
|
|
2199
|
+
lockAttribute();
|
|
2200
|
+
},
|
|
2201
|
+
getBoundingClientRect() {
|
|
2202
|
+
const vm = getAssociatedVM(this);
|
|
2203
|
+
const {
|
|
2204
|
+
elm,
|
|
2205
|
+
renderer: {
|
|
2206
|
+
getBoundingClientRect
|
|
2207
|
+
}
|
|
2208
|
+
} = vm;
|
|
2209
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2210
|
+
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
|
|
2009
2211
|
}
|
|
2010
|
-
|
|
2011
|
-
|
|
2212
|
+
return getBoundingClientRect(elm);
|
|
2213
|
+
},
|
|
2214
|
+
get isConnected() {
|
|
2215
|
+
const vm = getAssociatedVM(this);
|
|
2216
|
+
const {
|
|
2217
|
+
elm,
|
|
2218
|
+
renderer: {
|
|
2219
|
+
isConnected
|
|
2220
|
+
}
|
|
2221
|
+
} = vm;
|
|
2222
|
+
return isConnected(elm);
|
|
2223
|
+
},
|
|
2224
|
+
get classList() {
|
|
2225
|
+
const vm = getAssociatedVM(this);
|
|
2226
|
+
const {
|
|
2227
|
+
elm,
|
|
2228
|
+
renderer: {
|
|
2229
|
+
getClassList
|
|
2230
|
+
}
|
|
2231
|
+
} = vm;
|
|
2232
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2233
|
+
// TODO [#1290]: this still fails in dev but works in production, eventually, we should
|
|
2234
|
+
// just throw in all modes
|
|
2235
|
+
assert.isFalse(isBeingConstructed(vm), `Failed to construct ${vm}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`);
|
|
2236
|
+
}
|
|
2237
|
+
return getClassList(elm);
|
|
2238
|
+
},
|
|
2239
|
+
get template() {
|
|
2240
|
+
const vm = getAssociatedVM(this);
|
|
2241
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2242
|
+
if (vm.renderMode === 0 /* RenderMode.Light */) {
|
|
2243
|
+
logError('`this.template` returns null for light DOM components. Since there is no shadow, the rendered content can be accessed via `this` itself. e.g. instead of `this.template.querySelector`, use `this.querySelector`.');
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
return vm.shadowRoot;
|
|
2247
|
+
},
|
|
2248
|
+
get refs() {
|
|
2249
|
+
const vm = getAssociatedVM(this);
|
|
2250
|
+
if (isUpdatingTemplate) {
|
|
2251
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2252
|
+
logError(`this.refs should not be called while ${getComponentTag(vm)} is rendering. Use this.refs only when the DOM is stable, e.g. in renderedCallback().`);
|
|
2253
|
+
}
|
|
2254
|
+
// If the template is in the process of being updated, then we don't want to go through the normal
|
|
2255
|
+
// process of returning the refs and caching them, because the state of the refs is unstable.
|
|
2256
|
+
// This can happen if e.g. a template contains `<div class={foo}></div>` and `foo` is computed
|
|
2257
|
+
// based on `this.refs.bar`.
|
|
2258
|
+
return;
|
|
2012
2259
|
}
|
|
2013
|
-
// Adding extra guard rails in DEV mode.
|
|
2014
2260
|
if (process.env.NODE_ENV !== 'production') {
|
|
2015
|
-
|
|
2016
|
-
patchComponentWithRestrictions(component);
|
|
2261
|
+
warnIfInvokedDuringConstruction(vm, 'refs');
|
|
2017
2262
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2263
|
+
const {
|
|
2264
|
+
refVNodes,
|
|
2265
|
+
hasRefVNodes,
|
|
2266
|
+
cmpTemplate
|
|
2267
|
+
} = vm;
|
|
2268
|
+
// If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
|
|
2269
|
+
// if `this.refs` is called during the `connectedCallback` phase. The DOM elements have not been rendered yet,
|
|
2270
|
+
// so log a warning. Note we also check `isBeingConstructed()` to avoid a double warning (due to
|
|
2271
|
+
// `warnIfInvokedDuringConstruction` above).
|
|
2272
|
+
if (process.env.NODE_ENV !== 'production' && isNull(cmpTemplate) && !isBeingConstructed(vm)) {
|
|
2273
|
+
logError(`this.refs is undefined for ${getComponentTag(vm)}. This is either because the attached template has no "lwc:ref" directive, or this.refs was ` + `invoked before renderedCallback(). Use this.refs only when the referenced HTML elements have ` + `been rendered to the DOM, such as within renderedCallback() or disconnectedCallback().`);
|
|
2274
|
+
}
|
|
2275
|
+
// For backwards compatibility with component written before template refs
|
|
2276
|
+
// were introduced, we return undefined if the template has no refs defined
|
|
2277
|
+
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
2278
|
+
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
2279
|
+
// Note it is not sufficient to just check if `refVNodes` is null or empty,
|
|
2280
|
+
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
2281
|
+
if (!hasRefVNodes) {
|
|
2282
|
+
return;
|
|
2283
|
+
}
|
|
2284
|
+
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
2285
|
+
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
2286
|
+
if (isNull(refVNodes)) {
|
|
2287
|
+
return EMPTY_REFS;
|
|
2288
|
+
}
|
|
2289
|
+
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
2290
|
+
// are recreated from scratch every time the template is rendered.
|
|
2291
|
+
// This happens with `vm.refVNodes = null` in `template.ts` in `@lwc/engine-core`.
|
|
2292
|
+
let refs = refsCache.get(refVNodes);
|
|
2293
|
+
if (isUndefined$1(refs)) {
|
|
2294
|
+
refs = create(null);
|
|
2295
|
+
for (const key of keys(refVNodes)) {
|
|
2296
|
+
refs[key] = refVNodes[key].elm;
|
|
2297
|
+
}
|
|
2298
|
+
freeze(refs);
|
|
2299
|
+
refsCache.set(refVNodes, refs);
|
|
2300
|
+
}
|
|
2301
|
+
return refs;
|
|
2302
|
+
},
|
|
2303
|
+
// For backwards compat, we allow component authors to set `refs` as an expando
|
|
2304
|
+
set refs(value) {
|
|
2305
|
+
defineProperty(this, 'refs', {
|
|
2306
|
+
configurable: true,
|
|
2307
|
+
enumerable: true,
|
|
2308
|
+
writable: true,
|
|
2309
|
+
value
|
|
2026
2310
|
});
|
|
2027
|
-
|
|
2028
|
-
|
|
2311
|
+
},
|
|
2312
|
+
get shadowRoot() {
|
|
2313
|
+
// From within the component instance, the shadowRoot is always reported as "closed".
|
|
2314
|
+
// Authors should rely on this.template instead.
|
|
2315
|
+
return null;
|
|
2316
|
+
},
|
|
2317
|
+
get children() {
|
|
2318
|
+
const vm = getAssociatedVM(this);
|
|
2319
|
+
const renderer = vm.renderer;
|
|
2029
2320
|
if (process.env.NODE_ENV !== 'production') {
|
|
2030
|
-
|
|
2321
|
+
warnIfInvokedDuringConstruction(vm, 'children');
|
|
2031
2322
|
}
|
|
2032
|
-
return
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2323
|
+
return renderer.getChildren(vm.elm);
|
|
2324
|
+
},
|
|
2325
|
+
get childNodes() {
|
|
2326
|
+
const vm = getAssociatedVM(this);
|
|
2327
|
+
const renderer = vm.renderer;
|
|
2328
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2329
|
+
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
|
2037
2330
|
}
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
lockAttribute();
|
|
2081
|
-
},
|
|
2082
|
-
removeAttributeNS(namespace, name) {
|
|
2083
|
-
const { elm, renderer: { removeAttribute }, } = getAssociatedVM(this);
|
|
2084
|
-
unlockAttribute(elm, name);
|
|
2085
|
-
removeAttribute(elm, name, namespace);
|
|
2086
|
-
lockAttribute();
|
|
2087
|
-
},
|
|
2088
|
-
getAttribute(name) {
|
|
2089
|
-
const vm = getAssociatedVM(this);
|
|
2090
|
-
const { elm } = vm;
|
|
2091
|
-
const { getAttribute } = vm.renderer;
|
|
2092
|
-
return getAttribute(elm, name);
|
|
2093
|
-
},
|
|
2094
|
-
getAttributeNS(namespace, name) {
|
|
2095
|
-
const vm = getAssociatedVM(this);
|
|
2096
|
-
const { elm } = vm;
|
|
2097
|
-
const { getAttribute } = vm.renderer;
|
|
2098
|
-
return getAttribute(elm, name, namespace);
|
|
2099
|
-
},
|
|
2100
|
-
setAttribute(name, value) {
|
|
2101
|
-
const vm = getAssociatedVM(this);
|
|
2102
|
-
const { elm, renderer: { setAttribute }, } = vm;
|
|
2103
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2104
|
-
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2105
|
-
}
|
|
2106
|
-
unlockAttribute(elm, name);
|
|
2107
|
-
setAttribute(elm, name, value);
|
|
2108
|
-
lockAttribute();
|
|
2109
|
-
},
|
|
2110
|
-
setAttributeNS(namespace, name, value) {
|
|
2111
|
-
const vm = getAssociatedVM(this);
|
|
2112
|
-
const { elm, renderer: { setAttribute }, } = vm;
|
|
2113
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2114
|
-
assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
|
|
2115
|
-
}
|
|
2116
|
-
unlockAttribute(elm, name);
|
|
2117
|
-
setAttribute(elm, name, value, namespace);
|
|
2118
|
-
lockAttribute();
|
|
2119
|
-
},
|
|
2120
|
-
getBoundingClientRect() {
|
|
2121
|
-
const vm = getAssociatedVM(this);
|
|
2122
|
-
const { elm, renderer: { getBoundingClientRect }, } = vm;
|
|
2123
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2124
|
-
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');
|
|
2125
|
-
}
|
|
2126
|
-
return getBoundingClientRect(elm);
|
|
2127
|
-
},
|
|
2128
|
-
get isConnected() {
|
|
2129
|
-
const vm = getAssociatedVM(this);
|
|
2130
|
-
const { elm, renderer: { isConnected }, } = vm;
|
|
2131
|
-
return isConnected(elm);
|
|
2132
|
-
},
|
|
2133
|
-
get classList() {
|
|
2134
|
-
const vm = getAssociatedVM(this);
|
|
2135
|
-
const { elm, renderer: { getClassList }, } = vm;
|
|
2136
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2137
|
-
// TODO [#1290]: this still fails in dev but works in production, eventually, we should
|
|
2138
|
-
// just throw in all modes
|
|
2139
|
-
assert.isFalse(isBeingConstructed(vm), `Failed to construct ${vm}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`);
|
|
2140
|
-
}
|
|
2141
|
-
return getClassList(elm);
|
|
2142
|
-
},
|
|
2143
|
-
get template() {
|
|
2144
|
-
const vm = getAssociatedVM(this);
|
|
2145
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2146
|
-
if (vm.renderMode === 0 /* RenderMode.Light */) {
|
|
2147
|
-
logError('`this.template` returns null for light DOM components. Since there is no shadow, the rendered content can be accessed via `this` itself. e.g. instead of `this.template.querySelector`, use `this.querySelector`.');
|
|
2148
|
-
}
|
|
2149
|
-
}
|
|
2150
|
-
return vm.shadowRoot;
|
|
2151
|
-
},
|
|
2152
|
-
get refs() {
|
|
2153
|
-
const vm = getAssociatedVM(this);
|
|
2154
|
-
if (isUpdatingTemplate) {
|
|
2155
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2156
|
-
logError(`this.refs should not be called while ${getComponentTag(vm)} is rendering. Use this.refs only when the DOM is stable, e.g. in renderedCallback().`);
|
|
2157
|
-
}
|
|
2158
|
-
// If the template is in the process of being updated, then we don't want to go through the normal
|
|
2159
|
-
// process of returning the refs and caching them, because the state of the refs is unstable.
|
|
2160
|
-
// This can happen if e.g. a template contains `<div class={foo}></div>` and `foo` is computed
|
|
2161
|
-
// based on `this.refs.bar`.
|
|
2162
|
-
return;
|
|
2163
|
-
}
|
|
2164
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2165
|
-
warnIfInvokedDuringConstruction(vm, 'refs');
|
|
2166
|
-
}
|
|
2167
|
-
const { refVNodes, hasRefVNodes, cmpTemplate } = vm;
|
|
2168
|
-
// If the `cmpTemplate` is null, that means that the template has not been rendered yet. Most likely this occurs
|
|
2169
|
-
// if `this.refs` is called during the `connectedCallback` phase. The DOM elements have not been rendered yet,
|
|
2170
|
-
// so log a warning. Note we also check `isBeingConstructed()` to avoid a double warning (due to
|
|
2171
|
-
// `warnIfInvokedDuringConstruction` above).
|
|
2172
|
-
if (process.env.NODE_ENV !== 'production' &&
|
|
2173
|
-
isNull(cmpTemplate) &&
|
|
2174
|
-
!isBeingConstructed(vm)) {
|
|
2175
|
-
logError(`this.refs is undefined for ${getComponentTag(vm)}. This is either because the attached template has no "lwc:ref" directive, or this.refs was ` +
|
|
2176
|
-
`invoked before renderedCallback(). Use this.refs only when the referenced HTML elements have ` +
|
|
2177
|
-
`been rendered to the DOM, such as within renderedCallback() or disconnectedCallback().`);
|
|
2178
|
-
}
|
|
2179
|
-
// For backwards compatibility with component written before template refs
|
|
2180
|
-
// were introduced, we return undefined if the template has no refs defined
|
|
2181
|
-
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
2182
|
-
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
2183
|
-
// Note it is not sufficient to just check if `refVNodes` is null or empty,
|
|
2184
|
-
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
2185
|
-
if (!hasRefVNodes) {
|
|
2186
|
-
return;
|
|
2187
|
-
}
|
|
2188
|
-
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
2189
|
-
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
2190
|
-
if (isNull(refVNodes)) {
|
|
2191
|
-
return EMPTY_REFS;
|
|
2192
|
-
}
|
|
2193
|
-
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
2194
|
-
// are recreated from scratch every time the template is rendered.
|
|
2195
|
-
// This happens with `vm.refVNodes = null` in `template.ts` in `@lwc/engine-core`.
|
|
2196
|
-
let refs = refsCache.get(refVNodes);
|
|
2197
|
-
if (isUndefined$1(refs)) {
|
|
2198
|
-
refs = create(null);
|
|
2199
|
-
for (const key of keys(refVNodes)) {
|
|
2200
|
-
refs[key] = refVNodes[key].elm;
|
|
2201
|
-
}
|
|
2202
|
-
freeze(refs);
|
|
2203
|
-
refsCache.set(refVNodes, refs);
|
|
2204
|
-
}
|
|
2205
|
-
return refs;
|
|
2206
|
-
},
|
|
2207
|
-
// For backwards compat, we allow component authors to set `refs` as an expando
|
|
2208
|
-
set refs(value) {
|
|
2209
|
-
defineProperty(this, 'refs', {
|
|
2210
|
-
configurable: true,
|
|
2211
|
-
enumerable: true,
|
|
2212
|
-
writable: true,
|
|
2213
|
-
value,
|
|
2214
|
-
});
|
|
2215
|
-
},
|
|
2216
|
-
get shadowRoot() {
|
|
2217
|
-
// From within the component instance, the shadowRoot is always reported as "closed".
|
|
2218
|
-
// Authors should rely on this.template instead.
|
|
2219
|
-
return null;
|
|
2220
|
-
},
|
|
2221
|
-
get children() {
|
|
2222
|
-
const vm = getAssociatedVM(this);
|
|
2223
|
-
const renderer = vm.renderer;
|
|
2224
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2225
|
-
warnIfInvokedDuringConstruction(vm, 'children');
|
|
2226
|
-
}
|
|
2227
|
-
return renderer.getChildren(vm.elm);
|
|
2228
|
-
},
|
|
2229
|
-
get childNodes() {
|
|
2230
|
-
const vm = getAssociatedVM(this);
|
|
2231
|
-
const renderer = vm.renderer;
|
|
2232
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2233
|
-
warnIfInvokedDuringConstruction(vm, 'childNodes');
|
|
2234
|
-
}
|
|
2235
|
-
return renderer.getChildNodes(vm.elm);
|
|
2236
|
-
},
|
|
2237
|
-
get firstChild() {
|
|
2238
|
-
const vm = getAssociatedVM(this);
|
|
2239
|
-
const renderer = vm.renderer;
|
|
2240
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2241
|
-
warnIfInvokedDuringConstruction(vm, 'firstChild');
|
|
2242
|
-
}
|
|
2243
|
-
return renderer.getFirstChild(vm.elm);
|
|
2244
|
-
},
|
|
2245
|
-
get firstElementChild() {
|
|
2246
|
-
const vm = getAssociatedVM(this);
|
|
2247
|
-
const renderer = vm.renderer;
|
|
2248
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2249
|
-
warnIfInvokedDuringConstruction(vm, 'firstElementChild');
|
|
2250
|
-
}
|
|
2251
|
-
return renderer.getFirstElementChild(vm.elm);
|
|
2252
|
-
},
|
|
2253
|
-
get lastChild() {
|
|
2254
|
-
const vm = getAssociatedVM(this);
|
|
2255
|
-
const renderer = vm.renderer;
|
|
2256
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2257
|
-
warnIfInvokedDuringConstruction(vm, 'lastChild');
|
|
2258
|
-
}
|
|
2259
|
-
return renderer.getLastChild(vm.elm);
|
|
2260
|
-
},
|
|
2261
|
-
get lastElementChild() {
|
|
2262
|
-
const vm = getAssociatedVM(this);
|
|
2263
|
-
const renderer = vm.renderer;
|
|
2264
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2265
|
-
warnIfInvokedDuringConstruction(vm, 'lastElementChild');
|
|
2266
|
-
}
|
|
2267
|
-
return renderer.getLastElementChild(vm.elm);
|
|
2268
|
-
},
|
|
2269
|
-
render() {
|
|
2270
|
-
const vm = getAssociatedVM(this);
|
|
2271
|
-
return vm.def.template;
|
|
2272
|
-
},
|
|
2273
|
-
toString() {
|
|
2274
|
-
const vm = getAssociatedVM(this);
|
|
2275
|
-
return `[object ${vm.def.name}]`;
|
|
2276
|
-
},
|
|
2331
|
+
return renderer.getChildNodes(vm.elm);
|
|
2332
|
+
},
|
|
2333
|
+
get firstChild() {
|
|
2334
|
+
const vm = getAssociatedVM(this);
|
|
2335
|
+
const renderer = vm.renderer;
|
|
2336
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2337
|
+
warnIfInvokedDuringConstruction(vm, 'firstChild');
|
|
2338
|
+
}
|
|
2339
|
+
return renderer.getFirstChild(vm.elm);
|
|
2340
|
+
},
|
|
2341
|
+
get firstElementChild() {
|
|
2342
|
+
const vm = getAssociatedVM(this);
|
|
2343
|
+
const renderer = vm.renderer;
|
|
2344
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2345
|
+
warnIfInvokedDuringConstruction(vm, 'firstElementChild');
|
|
2346
|
+
}
|
|
2347
|
+
return renderer.getFirstElementChild(vm.elm);
|
|
2348
|
+
},
|
|
2349
|
+
get lastChild() {
|
|
2350
|
+
const vm = getAssociatedVM(this);
|
|
2351
|
+
const renderer = vm.renderer;
|
|
2352
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2353
|
+
warnIfInvokedDuringConstruction(vm, 'lastChild');
|
|
2354
|
+
}
|
|
2355
|
+
return renderer.getLastChild(vm.elm);
|
|
2356
|
+
},
|
|
2357
|
+
get lastElementChild() {
|
|
2358
|
+
const vm = getAssociatedVM(this);
|
|
2359
|
+
const renderer = vm.renderer;
|
|
2360
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2361
|
+
warnIfInvokedDuringConstruction(vm, 'lastElementChild');
|
|
2362
|
+
}
|
|
2363
|
+
return renderer.getLastElementChild(vm.elm);
|
|
2364
|
+
},
|
|
2365
|
+
render() {
|
|
2366
|
+
const vm = getAssociatedVM(this);
|
|
2367
|
+
return vm.def.template;
|
|
2368
|
+
},
|
|
2369
|
+
toString() {
|
|
2370
|
+
const vm = getAssociatedVM(this);
|
|
2371
|
+
return `[object ${vm.def.name}]`;
|
|
2372
|
+
}
|
|
2277
2373
|
};
|
|
2278
2374
|
const queryAndChildGetterDescriptors = create(null);
|
|
2279
|
-
const queryMethods = [
|
|
2280
|
-
'getElementsByClassName',
|
|
2281
|
-
'getElementsByTagName',
|
|
2282
|
-
'querySelector',
|
|
2283
|
-
'querySelectorAll',
|
|
2284
|
-
];
|
|
2375
|
+
const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
2285
2376
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
2286
2377
|
for (const queryMethod of queryMethods) {
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
}
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2378
|
+
queryAndChildGetterDescriptors[queryMethod] = {
|
|
2379
|
+
value(arg) {
|
|
2380
|
+
const vm = getAssociatedVM(this);
|
|
2381
|
+
const {
|
|
2382
|
+
elm,
|
|
2383
|
+
renderer
|
|
2384
|
+
} = vm;
|
|
2385
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2386
|
+
warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);
|
|
2387
|
+
}
|
|
2388
|
+
return renderer[queryMethod](elm, arg);
|
|
2389
|
+
},
|
|
2390
|
+
configurable: true,
|
|
2391
|
+
enumerable: true,
|
|
2392
|
+
writable: true
|
|
2393
|
+
};
|
|
2300
2394
|
}
|
|
2301
2395
|
defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
|
|
2302
2396
|
const lightningBasedDescriptors = create(null);
|
|
2303
2397
|
for (const propName in HTMLElementOriginalDescriptors) {
|
|
2304
|
-
|
|
2398
|
+
lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
|
|
2305
2399
|
}
|
|
2306
2400
|
defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
|
2401
|
+
function applyAriaReflectionToLightningElement() {
|
|
2402
|
+
// If ARIA reflection is not applied globally to Element.prototype, or if we are running server-side,
|
|
2403
|
+
// apply it to LightningElement.prototype.
|
|
2404
|
+
// This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
|
|
2405
|
+
applyAriaReflection(LightningElement.prototype);
|
|
2406
|
+
}
|
|
2407
|
+
// The reason for this odd if/else branching is limitations in @lwc/features:
|
|
2408
|
+
// https://github.com/salesforce/lwc/blob/master/packages/%40lwc/features/README.md#only-works-with-if-statements
|
|
2409
|
+
if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
2410
|
+
applyAriaReflectionToLightningElement();
|
|
2411
|
+
}
|
|
2307
2412
|
defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2413
|
+
get() {
|
|
2414
|
+
// If required, a runtime-specific implementation must be defined.
|
|
2415
|
+
throw new ReferenceError('The current runtime does not support CustomElementConstructor.');
|
|
2416
|
+
},
|
|
2417
|
+
configurable: true
|
|
2313
2418
|
});
|
|
2314
2419
|
if (process.env.NODE_ENV !== 'production') {
|
|
2315
|
-
|
|
2420
|
+
patchLightningElementPrototypeWithRestrictions(LightningElement.prototype);
|
|
2316
2421
|
}
|
|
2317
2422
|
|
|
2318
2423
|
function createObservedFieldPropertyDescriptor(key) {
|
|
@@ -2772,138 +2877,161 @@
|
|
|
2772
2877
|
const cachedGetterByKey = create(null);
|
|
2773
2878
|
const cachedSetterByKey = create(null);
|
|
2774
2879
|
function createGetter(key) {
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2880
|
+
let fn = cachedGetterByKey[key];
|
|
2881
|
+
if (isUndefined$1(fn)) {
|
|
2882
|
+
fn = cachedGetterByKey[key] = function () {
|
|
2883
|
+
const vm = getAssociatedVM(this);
|
|
2884
|
+
const {
|
|
2885
|
+
getHook
|
|
2886
|
+
} = vm;
|
|
2887
|
+
return getHook(vm.component, key);
|
|
2888
|
+
};
|
|
2889
|
+
}
|
|
2890
|
+
return fn;
|
|
2784
2891
|
}
|
|
2785
2892
|
function createSetter(key) {
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2893
|
+
let fn = cachedSetterByKey[key];
|
|
2894
|
+
if (isUndefined$1(fn)) {
|
|
2895
|
+
fn = cachedSetterByKey[key] = function (newValue) {
|
|
2896
|
+
const vm = getAssociatedVM(this);
|
|
2897
|
+
const {
|
|
2898
|
+
setHook
|
|
2899
|
+
} = vm;
|
|
2900
|
+
newValue = getReadOnlyProxy(newValue);
|
|
2901
|
+
setHook(vm.component, key, newValue);
|
|
2902
|
+
};
|
|
2903
|
+
}
|
|
2904
|
+
return fn;
|
|
2796
2905
|
}
|
|
2797
2906
|
function createMethodCaller(methodName) {
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
};
|
|
2907
|
+
return function () {
|
|
2908
|
+
const vm = getAssociatedVM(this);
|
|
2909
|
+
const {
|
|
2910
|
+
callHook,
|
|
2911
|
+
component
|
|
2912
|
+
} = vm;
|
|
2913
|
+
const fn = component[methodName];
|
|
2914
|
+
return callHook(vm.component, fn, ArraySlice.call(arguments));
|
|
2915
|
+
};
|
|
2804
2916
|
}
|
|
2805
2917
|
function createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback) {
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
}
|
|
2811
|
-
const propName = attributeToPropMap[attrName];
|
|
2812
|
-
if (isUndefined$1(propName)) {
|
|
2813
|
-
if (!isUndefined$1(superAttributeChangedCallback)) {
|
|
2814
|
-
// delegate unknown attributes to the super.
|
|
2815
|
-
// Typescript does not like it when you treat the `arguments` object as an array
|
|
2816
|
-
// @ts-ignore type-mismatch
|
|
2817
|
-
superAttributeChangedCallback.apply(this, arguments);
|
|
2818
|
-
}
|
|
2819
|
-
return;
|
|
2820
|
-
}
|
|
2821
|
-
if (!isAttributeLocked(this, attrName)) {
|
|
2822
|
-
// Ignore changes triggered by the engine itself during:
|
|
2823
|
-
// * diffing when public props are attempting to reflect to the DOM
|
|
2824
|
-
// * component via `this.setAttribute()`, should never update the prop
|
|
2825
|
-
// Both cases, the setAttribute call is always wrapped by the unlocking of the
|
|
2826
|
-
// attribute to be changed
|
|
2827
|
-
return;
|
|
2828
|
-
}
|
|
2829
|
-
// Reflect attribute change to the corresponding property when changed from outside.
|
|
2830
|
-
this[propName] = newValue;
|
|
2831
|
-
};
|
|
2832
|
-
}
|
|
2833
|
-
function HTMLBridgeElementFactory(SuperClass, props, methods) {
|
|
2834
|
-
let HTMLBridgeElement;
|
|
2835
|
-
/**
|
|
2836
|
-
* Modern browsers will have all Native Constructors as regular Classes
|
|
2837
|
-
* and must be instantiated with the new keyword. In older browsers,
|
|
2838
|
-
* specifically IE11, those are objects with a prototype property defined,
|
|
2839
|
-
* since they are not supposed to be extended or instantiated with the
|
|
2840
|
-
* new keyword. This forking logic supports both cases, specifically because
|
|
2841
|
-
* wc.ts relies on the construction path of the bridges to create new
|
|
2842
|
-
* fully qualifying web components.
|
|
2843
|
-
*/
|
|
2844
|
-
if (isFunction$1(SuperClass)) {
|
|
2845
|
-
HTMLBridgeElement = class extends SuperClass {
|
|
2846
|
-
};
|
|
2847
|
-
}
|
|
2848
|
-
else {
|
|
2849
|
-
HTMLBridgeElement = function () {
|
|
2850
|
-
// Bridge classes are not supposed to be instantiated directly in
|
|
2851
|
-
// browsers that do not support web components.
|
|
2852
|
-
throw new TypeError('Illegal constructor');
|
|
2853
|
-
};
|
|
2854
|
-
// prototype inheritance dance
|
|
2855
|
-
setPrototypeOf(HTMLBridgeElement, SuperClass);
|
|
2856
|
-
setPrototypeOf(HTMLBridgeElement.prototype, SuperClass.prototype);
|
|
2857
|
-
defineProperty(HTMLBridgeElement.prototype, 'constructor', {
|
|
2858
|
-
writable: true,
|
|
2859
|
-
configurable: true,
|
|
2860
|
-
value: HTMLBridgeElement,
|
|
2861
|
-
});
|
|
2918
|
+
return function attributeChangedCallback(attrName, oldValue, newValue) {
|
|
2919
|
+
if (oldValue === newValue) {
|
|
2920
|
+
// Ignore same values.
|
|
2921
|
+
return;
|
|
2862
2922
|
}
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
attributeToPropMap[htmlPropertyToAttribute(propName)] = propName;
|
|
2873
|
-
descriptors[propName] = {
|
|
2874
|
-
get: createGetter(propName),
|
|
2875
|
-
set: createSetter(propName),
|
|
2876
|
-
enumerable: true,
|
|
2877
|
-
configurable: true,
|
|
2878
|
-
};
|
|
2923
|
+
const propName = attributeToPropMap[attrName];
|
|
2924
|
+
if (isUndefined$1(propName)) {
|
|
2925
|
+
if (!isUndefined$1(superAttributeChangedCallback)) {
|
|
2926
|
+
// delegate unknown attributes to the super.
|
|
2927
|
+
// Typescript does not like it when you treat the `arguments` object as an array
|
|
2928
|
+
// @ts-ignore type-mismatch
|
|
2929
|
+
superAttributeChangedCallback.apply(this, arguments);
|
|
2930
|
+
}
|
|
2931
|
+
return;
|
|
2879
2932
|
}
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
};
|
|
2933
|
+
if (!isAttributeLocked(this, attrName)) {
|
|
2934
|
+
// Ignore changes triggered by the engine itself during:
|
|
2935
|
+
// * diffing when public props are attempting to reflect to the DOM
|
|
2936
|
+
// * component via `this.setAttribute()`, should never update the prop
|
|
2937
|
+
// Both cases, the setAttribute call is always wrapped by the unlocking of the
|
|
2938
|
+
// attribute to be changed
|
|
2939
|
+
return;
|
|
2888
2940
|
}
|
|
2889
|
-
//
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2941
|
+
// Reflect attribute change to the corresponding property when changed from outside.
|
|
2942
|
+
this[propName] = newValue;
|
|
2943
|
+
};
|
|
2944
|
+
}
|
|
2945
|
+
function HTMLBridgeElementFactory(SuperClass, props, methods) {
|
|
2946
|
+
let HTMLBridgeElement;
|
|
2947
|
+
/**
|
|
2948
|
+
* Modern browsers will have all Native Constructors as regular Classes
|
|
2949
|
+
* and must be instantiated with the new keyword. In older browsers,
|
|
2950
|
+
* specifically IE11, those are objects with a prototype property defined,
|
|
2951
|
+
* since they are not supposed to be extended or instantiated with the
|
|
2952
|
+
* new keyword. This forking logic supports both cases, specifically because
|
|
2953
|
+
* wc.ts relies on the construction path of the bridges to create new
|
|
2954
|
+
* fully qualifying web components.
|
|
2955
|
+
*/
|
|
2956
|
+
if (isFunction$1(SuperClass)) {
|
|
2957
|
+
HTMLBridgeElement = class extends SuperClass {};
|
|
2958
|
+
} else {
|
|
2959
|
+
HTMLBridgeElement = function () {
|
|
2960
|
+
// Bridge classes are not supposed to be instantiated directly in
|
|
2961
|
+
// browsers that do not support web components.
|
|
2962
|
+
throw new TypeError('Illegal constructor');
|
|
2895
2963
|
};
|
|
2896
|
-
//
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2964
|
+
// prototype inheritance dance
|
|
2965
|
+
setPrototypeOf(HTMLBridgeElement, SuperClass);
|
|
2966
|
+
setPrototypeOf(HTMLBridgeElement.prototype, SuperClass.prototype);
|
|
2967
|
+
defineProperty(HTMLBridgeElement.prototype, 'constructor', {
|
|
2968
|
+
writable: true,
|
|
2969
|
+
configurable: true,
|
|
2970
|
+
value: HTMLBridgeElement
|
|
2902
2971
|
});
|
|
2903
|
-
|
|
2904
|
-
|
|
2972
|
+
}
|
|
2973
|
+
// generating the hash table for attributes to avoid duplicate fields and facilitate validation
|
|
2974
|
+
// and false positives in case of inheritance.
|
|
2975
|
+
const attributeToPropMap = create(null);
|
|
2976
|
+
const {
|
|
2977
|
+
attributeChangedCallback: superAttributeChangedCallback
|
|
2978
|
+
} = SuperClass.prototype;
|
|
2979
|
+
const {
|
|
2980
|
+
observedAttributes: superObservedAttributes = []
|
|
2981
|
+
} = SuperClass;
|
|
2982
|
+
const descriptors = create(null);
|
|
2983
|
+
// expose getters and setters for each public props on the new Element Bridge
|
|
2984
|
+
for (let i = 0, len = props.length; i < len; i += 1) {
|
|
2985
|
+
const propName = props[i];
|
|
2986
|
+
attributeToPropMap[htmlPropertyToAttribute(propName)] = propName;
|
|
2987
|
+
descriptors[propName] = {
|
|
2988
|
+
get: createGetter(propName),
|
|
2989
|
+
set: createSetter(propName),
|
|
2990
|
+
enumerable: true,
|
|
2991
|
+
configurable: true
|
|
2992
|
+
};
|
|
2993
|
+
}
|
|
2994
|
+
// expose public methods as props on the new Element Bridge
|
|
2995
|
+
for (let i = 0, len = methods.length; i < len; i += 1) {
|
|
2996
|
+
const methodName = methods[i];
|
|
2997
|
+
descriptors[methodName] = {
|
|
2998
|
+
value: createMethodCaller(methodName),
|
|
2999
|
+
writable: true,
|
|
3000
|
+
configurable: true
|
|
3001
|
+
};
|
|
3002
|
+
}
|
|
3003
|
+
// creating a new attributeChangedCallback per bridge because they are bound to the corresponding
|
|
3004
|
+
// map of attributes to props. We do this after all other props and methods to avoid the possibility
|
|
3005
|
+
// of getting overrule by a class declaration in user-land, and we make it non-writable, non-configurable
|
|
3006
|
+
// to preserve this definition.
|
|
3007
|
+
descriptors.attributeChangedCallback = {
|
|
3008
|
+
value: createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback)
|
|
3009
|
+
};
|
|
3010
|
+
// Specify attributes for which we want to reflect changes back to their corresponding
|
|
3011
|
+
// properties via attributeChangedCallback.
|
|
3012
|
+
defineProperty(HTMLBridgeElement, 'observedAttributes', {
|
|
3013
|
+
get() {
|
|
3014
|
+
return [...superObservedAttributes, ...keys(attributeToPropMap)];
|
|
3015
|
+
}
|
|
3016
|
+
});
|
|
3017
|
+
defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
3018
|
+
return HTMLBridgeElement;
|
|
2905
3019
|
}
|
|
2906
3020
|
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
|
|
3021
|
+
{
|
|
3022
|
+
// This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
|
|
3023
|
+
// so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
|
|
3024
|
+
// ARIA props outside the LightningElement
|
|
3025
|
+
if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
3026
|
+
// If ARIA reflection is not applied globally to Element.prototype, apply it to HTMLBridgeElement.prototype.
|
|
3027
|
+
// This allows `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*` attrs.
|
|
3028
|
+
// This is especially important because the template compiler compiles aria-* attrs on components to aria* props
|
|
3029
|
+
//
|
|
3030
|
+
// Also note that we apply this to BaseBridgeElement.prototype to avoid excessively redefining property
|
|
3031
|
+
// accessors inside the HTMLBridgeElementFactory.
|
|
3032
|
+
applyAriaReflection(BaseBridgeElement.prototype);
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
2907
3035
|
freeze(BaseBridgeElement);
|
|
2908
3036
|
seal(BaseBridgeElement.prototype);
|
|
2909
3037
|
|
|
@@ -3359,6 +3487,9 @@
|
|
|
3359
3487
|
stylesheets: newStylesheets,
|
|
3360
3488
|
stylesheetToken: newStylesheetToken
|
|
3361
3489
|
} = template;
|
|
3490
|
+
const {
|
|
3491
|
+
stylesheets: newVmStylesheets
|
|
3492
|
+
} = vm;
|
|
3362
3493
|
const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
3363
3494
|
const {
|
|
3364
3495
|
hasScopedStyles
|
|
@@ -3382,7 +3513,9 @@
|
|
|
3382
3513
|
}
|
|
3383
3514
|
// Apply the new template styling token to the host element, if the new template has any
|
|
3384
3515
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
3385
|
-
|
|
3516
|
+
const hasNewStylesheets = hasStyles(newStylesheets);
|
|
3517
|
+
const hasNewVmStylesheets = hasStyles(newVmStylesheets);
|
|
3518
|
+
if (hasNewStylesheets || hasNewVmStylesheets) {
|
|
3386
3519
|
newToken = newStylesheetToken;
|
|
3387
3520
|
}
|
|
3388
3521
|
// Set the new styling token on the host element
|
|
@@ -3454,10 +3587,17 @@
|
|
|
3454
3587
|
stylesheets,
|
|
3455
3588
|
stylesheetToken
|
|
3456
3589
|
} = template;
|
|
3590
|
+
const {
|
|
3591
|
+
stylesheets: vmStylesheets
|
|
3592
|
+
} = vm;
|
|
3457
3593
|
let content = [];
|
|
3458
|
-
if (
|
|
3594
|
+
if (hasStyles(stylesheets)) {
|
|
3459
3595
|
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3460
3596
|
}
|
|
3597
|
+
// VM (component) stylesheets apply after template stylesheets
|
|
3598
|
+
if (hasStyles(vmStylesheets)) {
|
|
3599
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(vmStylesheets, stylesheetToken, vm));
|
|
3600
|
+
}
|
|
3461
3601
|
return content;
|
|
3462
3602
|
}
|
|
3463
3603
|
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
@@ -3495,10 +3635,13 @@
|
|
|
3495
3635
|
const {
|
|
3496
3636
|
template
|
|
3497
3637
|
} = getComponentInternalDef(vnode.ctor);
|
|
3638
|
+
const {
|
|
3639
|
+
vm
|
|
3640
|
+
} = vnode;
|
|
3498
3641
|
const {
|
|
3499
3642
|
stylesheetToken
|
|
3500
3643
|
} = template;
|
|
3501
|
-
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
|
|
3644
|
+
return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template, vm) ? makeHostToken(stylesheetToken) : null;
|
|
3502
3645
|
}
|
|
3503
3646
|
function getNearestNativeShadowComponent(vm) {
|
|
3504
3647
|
const owner = getNearestShadowComponent(vm);
|
|
@@ -4111,6 +4254,28 @@
|
|
|
4111
4254
|
// in fallback mode, the allocation will always set children to
|
|
4112
4255
|
// empty and delegate the real allocation to the slot elements
|
|
4113
4256
|
allocateChildren(n2, vm);
|
|
4257
|
+
// Solves an edge case with slotted VFragments in native shadow mode.
|
|
4258
|
+
//
|
|
4259
|
+
// During allocation, in native shadow, slotted VFragment nodes are flattened and their text delimiters are removed
|
|
4260
|
+
// to avoid interfering with native slot behavior. When this happens, if any of the fragments
|
|
4261
|
+
// were not stable, the children must go through the dynamic diffing algo.
|
|
4262
|
+
//
|
|
4263
|
+
// If the new children (n2.children) contain no VFragments, but the previous children (n1.children) were dynamic,
|
|
4264
|
+
// the new nodes must be marked dynamic so that all nodes are properly updated. The only indicator that the new
|
|
4265
|
+
// nodes need to be dynamic comes from the previous children, so we check that to determine whether we need to
|
|
4266
|
+
// mark the new children dynamic.
|
|
4267
|
+
//
|
|
4268
|
+
// Example:
|
|
4269
|
+
// n1.children: [div, VFragment('', div, null, ''), div] => [div, div, null, div]; // marked dynamic
|
|
4270
|
+
// n2.children: [div, null, div] => [div, null, div] // marked ???
|
|
4271
|
+
const {
|
|
4272
|
+
shadowMode,
|
|
4273
|
+
renderMode
|
|
4274
|
+
} = vm;
|
|
4275
|
+
if (shadowMode == 0 /* ShadowMode.Native */ && renderMode !== 0 /* RenderMode.Light */ && hasDynamicChildren(n1.children)) {
|
|
4276
|
+
// No-op if children has already been marked dynamic by 'allocateChildren()'.
|
|
4277
|
+
markAsDynamicChildren(n2.children);
|
|
4278
|
+
}
|
|
4114
4279
|
}
|
|
4115
4280
|
// in fallback mode, the children will be always empty, so, nothing
|
|
4116
4281
|
// will happen, but in native, it does allocate the light dom
|
|
@@ -4303,7 +4468,6 @@
|
|
|
4303
4468
|
//
|
|
4304
4469
|
// In case #2, we will always get a fresh VCustomElement.
|
|
4305
4470
|
const children = vnode.aChildren || vnode.children;
|
|
4306
|
-
vm.aChildren = children;
|
|
4307
4471
|
const {
|
|
4308
4472
|
renderMode,
|
|
4309
4473
|
shadowMode
|
|
@@ -4316,15 +4480,61 @@
|
|
|
4316
4480
|
logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
|
|
4317
4481
|
}
|
|
4318
4482
|
}
|
|
4483
|
+
// If any of the children being allocated are VFragments, we remove the text delimiters and flatten all immediate
|
|
4484
|
+
// children VFragments to avoid them interfering with default slot behavior.
|
|
4485
|
+
const allocatedChildren = flattenFragmentsInChildren(children);
|
|
4486
|
+
vnode.children = allocatedChildren;
|
|
4487
|
+
vm.aChildren = allocatedChildren;
|
|
4319
4488
|
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
|
4320
4489
|
// slow path
|
|
4321
|
-
allocateInSlot(vm,
|
|
4490
|
+
allocateInSlot(vm, allocatedChildren, vnode.owner);
|
|
4322
4491
|
// save the allocated children in case this vnode is reused.
|
|
4323
|
-
vnode.aChildren =
|
|
4492
|
+
vnode.aChildren = allocatedChildren;
|
|
4324
4493
|
// every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4325
4494
|
vnode.children = EmptyArray;
|
|
4326
4495
|
}
|
|
4327
4496
|
}
|
|
4497
|
+
/**
|
|
4498
|
+
* Flattens the contents of all VFragments in an array of VNodes, removes the text delimiters on those VFragments, and
|
|
4499
|
+
* marks the resulting children array as dynamic. Uses a stack (array) to iteratively traverse the nested VFragments
|
|
4500
|
+
* and avoid the perf overhead of creating/destroying throwaway arrays/objects in a recursive approach.
|
|
4501
|
+
*
|
|
4502
|
+
* With the delimiters removed, the contents are marked dynamic so they are diffed correctly.
|
|
4503
|
+
*
|
|
4504
|
+
* This function is used for slotted VFragments to avoid the text delimiters interfering with slotting functionality.
|
|
4505
|
+
*/
|
|
4506
|
+
function flattenFragmentsInChildren(children) {
|
|
4507
|
+
const flattenedChildren = [];
|
|
4508
|
+
// Initialize our stack with the direct children of the custom component and check whether we have a VFragment.
|
|
4509
|
+
// If no VFragment is found in children, we don't need to traverse anything or mark the children dynamic and can return early.
|
|
4510
|
+
const nodeStack = [];
|
|
4511
|
+
let fragmentFound = false;
|
|
4512
|
+
for (let i = children.length - 1; i > -1; i -= 1) {
|
|
4513
|
+
const child = children[i];
|
|
4514
|
+
ArrayPush$1.call(nodeStack, child);
|
|
4515
|
+
fragmentFound = fragmentFound || !!(child && isVFragment(child));
|
|
4516
|
+
}
|
|
4517
|
+
if (!fragmentFound) {
|
|
4518
|
+
return children;
|
|
4519
|
+
}
|
|
4520
|
+
let currentNode;
|
|
4521
|
+
while (!isUndefined$1(currentNode = ArrayPop.call(nodeStack))) {
|
|
4522
|
+
if (!isNull(currentNode) && isVFragment(currentNode)) {
|
|
4523
|
+
const fChildren = currentNode.children;
|
|
4524
|
+
// Ignore the start and end text node delimiters
|
|
4525
|
+
for (let i = fChildren.length - 2; i > 0; i -= 1) {
|
|
4526
|
+
ArrayPush$1.call(nodeStack, fChildren[i]);
|
|
4527
|
+
}
|
|
4528
|
+
} else {
|
|
4529
|
+
ArrayPush$1.call(flattenedChildren, currentNode);
|
|
4530
|
+
}
|
|
4531
|
+
}
|
|
4532
|
+
// We always mark the children as dynamic because nothing generates stable VFragments yet.
|
|
4533
|
+
// If/when stable VFragments are generated by the compiler, this code should be updated to
|
|
4534
|
+
// not mark dynamic if all flattened VFragments were stable.
|
|
4535
|
+
markAsDynamicChildren(flattenedChildren);
|
|
4536
|
+
return flattenedChildren;
|
|
4537
|
+
}
|
|
4328
4538
|
function createViewModelHook(elm, vnode, renderer) {
|
|
4329
4539
|
let vm = getAssociatedVMIfPresent(elm);
|
|
4330
4540
|
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
@@ -4349,22 +4559,20 @@
|
|
|
4349
4559
|
}
|
|
4350
4560
|
return vm;
|
|
4351
4561
|
}
|
|
4352
|
-
|
|
4353
|
-
* Collects all slots into a SlotSet, traversing through VFragment Nodes
|
|
4354
|
-
*/
|
|
4355
|
-
function collectSlots(vm, children, cmpSlotsMapping) {
|
|
4562
|
+
function allocateInSlot(vm, children, owner) {
|
|
4356
4563
|
var _a, _b;
|
|
4564
|
+
const {
|
|
4565
|
+
cmpSlots: {
|
|
4566
|
+
slotAssignments: oldSlotsMapping
|
|
4567
|
+
}
|
|
4568
|
+
} = vm;
|
|
4569
|
+
const cmpSlotsMapping = create(null);
|
|
4570
|
+
// Collect all slots into cmpSlotsMapping
|
|
4357
4571
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4358
4572
|
const vnode = children[i];
|
|
4359
4573
|
if (isNull(vnode)) {
|
|
4360
4574
|
continue;
|
|
4361
4575
|
}
|
|
4362
|
-
// Dive further iff the content is wrapped in a VFragment
|
|
4363
|
-
if (isVFragment(vnode)) {
|
|
4364
|
-
// Remove the text delimiter nodes to avoid overriding default slot content
|
|
4365
|
-
collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
|
|
4366
|
-
continue;
|
|
4367
|
-
}
|
|
4368
4576
|
let slotName = '';
|
|
4369
4577
|
if (isVBaseElement(vnode)) {
|
|
4370
4578
|
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
@@ -4374,15 +4582,6 @@
|
|
|
4374
4582
|
const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
4375
4583
|
ArrayPush$1.call(vnodes, vnode);
|
|
4376
4584
|
}
|
|
4377
|
-
}
|
|
4378
|
-
function allocateInSlot(vm, children, owner) {
|
|
4379
|
-
const {
|
|
4380
|
-
cmpSlots: {
|
|
4381
|
-
slotAssignments: oldSlotsMapping
|
|
4382
|
-
}
|
|
4383
|
-
} = vm;
|
|
4384
|
-
const cmpSlotsMapping = create(null);
|
|
4385
|
-
collectSlots(vm, children, cmpSlotsMapping);
|
|
4386
4585
|
vm.cmpSlots = {
|
|
4387
4586
|
owner,
|
|
4388
4587
|
slotAssignments: cmpSlotsMapping
|
|
@@ -4413,14 +4612,14 @@
|
|
|
4413
4612
|
}
|
|
4414
4613
|
}
|
|
4415
4614
|
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
4416
|
-
const
|
|
4417
|
-
// dynamic children means it was generated by an iteration
|
|
4418
|
-
//
|
|
4615
|
+
const DynamicChildren = new WeakMap();
|
|
4616
|
+
// dynamic children means it was either generated by an iteration in a template
|
|
4617
|
+
// or part of an unstable fragment, and will require a more complex diffing algo.
|
|
4419
4618
|
function markAsDynamicChildren(children) {
|
|
4420
|
-
|
|
4619
|
+
DynamicChildren.set(children, 1);
|
|
4421
4620
|
}
|
|
4422
4621
|
function hasDynamicChildren(children) {
|
|
4423
|
-
return
|
|
4622
|
+
return DynamicChildren.has(children);
|
|
4424
4623
|
}
|
|
4425
4624
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
4426
4625
|
const map = {};
|
|
@@ -5286,7 +5485,7 @@
|
|
|
5286
5485
|
// Create a brand new template cache for the swapped templated.
|
|
5287
5486
|
context.tplCache = create(null);
|
|
5288
5487
|
// Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
5289
|
-
context.hasScopedStyles = computeHasScopedStyles(html);
|
|
5488
|
+
context.hasScopedStyles = computeHasScopedStyles(html, vm);
|
|
5290
5489
|
// Update the scoping token on the host element.
|
|
5291
5490
|
updateStylesheetToken(vm, html);
|
|
5292
5491
|
// Evaluate, create stylesheet and cache the produced VNode for future
|
|
@@ -5329,9 +5528,8 @@
|
|
|
5329
5528
|
}
|
|
5330
5529
|
return vnodes;
|
|
5331
5530
|
}
|
|
5332
|
-
function
|
|
5333
|
-
|
|
5334
|
-
if (!isUndefined$1(stylesheets)) {
|
|
5531
|
+
function computeHasScopedStylesInStylesheets(stylesheets) {
|
|
5532
|
+
if (hasStyles(stylesheets)) {
|
|
5335
5533
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5336
5534
|
if (isTrue(stylesheets[i][KEY__SCOPED_CSS])) {
|
|
5337
5535
|
return true;
|
|
@@ -5340,6 +5538,15 @@
|
|
|
5340
5538
|
}
|
|
5341
5539
|
return false;
|
|
5342
5540
|
}
|
|
5541
|
+
function computeHasScopedStyles(template, vm) {
|
|
5542
|
+
const { stylesheets } = template;
|
|
5543
|
+
const vmStylesheets = !isUndefined$1(vm) ? vm.stylesheets : null;
|
|
5544
|
+
return (computeHasScopedStylesInStylesheets(stylesheets) ||
|
|
5545
|
+
computeHasScopedStylesInStylesheets(vmStylesheets));
|
|
5546
|
+
}
|
|
5547
|
+
function hasStyles(stylesheets) {
|
|
5548
|
+
return !isUndefined$1(stylesheets) && !isNull(stylesheets) && stylesheets.length > 0;
|
|
5549
|
+
}
|
|
5343
5550
|
|
|
5344
5551
|
/*
|
|
5345
5552
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5655,6 +5862,7 @@
|
|
|
5655
5862
|
// Properties set right after VM creation.
|
|
5656
5863
|
tro: null,
|
|
5657
5864
|
shadowMode: null,
|
|
5865
|
+
stylesheets: null,
|
|
5658
5866
|
// Properties set by the LightningElement constructor.
|
|
5659
5867
|
component: null,
|
|
5660
5868
|
shadowRoot: null,
|
|
@@ -5667,6 +5875,7 @@
|
|
|
5667
5875
|
if (process.env.NODE_ENV !== 'production') {
|
|
5668
5876
|
vm.debugInfo = create(null);
|
|
5669
5877
|
}
|
|
5878
|
+
vm.stylesheets = computeStylesheets(vm, def.ctor);
|
|
5670
5879
|
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5671
5880
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5672
5881
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -5685,6 +5894,42 @@
|
|
|
5685
5894
|
}
|
|
5686
5895
|
return vm;
|
|
5687
5896
|
}
|
|
5897
|
+
function validateComponentStylesheets(vm, stylesheets) {
|
|
5898
|
+
let valid = true;
|
|
5899
|
+
const validate = arrayOrStylesheet => {
|
|
5900
|
+
if (isArray$1(arrayOrStylesheet)) {
|
|
5901
|
+
for (let i = 0; i < arrayOrStylesheet.length; i++) {
|
|
5902
|
+
validate(arrayOrStylesheet[i]);
|
|
5903
|
+
}
|
|
5904
|
+
} else if (!isFunction$1(arrayOrStylesheet)) {
|
|
5905
|
+
// function assumed to be a stylesheet factory
|
|
5906
|
+
valid = false;
|
|
5907
|
+
}
|
|
5908
|
+
};
|
|
5909
|
+
if (!isArray$1(stylesheets)) {
|
|
5910
|
+
valid = false;
|
|
5911
|
+
} else {
|
|
5912
|
+
validate(stylesheets);
|
|
5913
|
+
}
|
|
5914
|
+
return valid;
|
|
5915
|
+
}
|
|
5916
|
+
// Validate and flatten any stylesheets defined as `static stylesheets`
|
|
5917
|
+
function computeStylesheets(vm, ctor) {
|
|
5918
|
+
if (lwcRuntimeFlags.ENABLE_PROGRAMMATIC_STYLESHEETS) {
|
|
5919
|
+
const {
|
|
5920
|
+
stylesheets
|
|
5921
|
+
} = ctor;
|
|
5922
|
+
if (!isUndefined$1(stylesheets)) {
|
|
5923
|
+
const valid = validateComponentStylesheets(vm, stylesheets);
|
|
5924
|
+
if (valid) {
|
|
5925
|
+
return flattenStylesheets(stylesheets);
|
|
5926
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
5927
|
+
logError(`static stylesheets must be an array of CSS stylesheets. Found invalid stylesheets on <${vm.tagName}>`, vm);
|
|
5928
|
+
}
|
|
5929
|
+
}
|
|
5930
|
+
}
|
|
5931
|
+
return null;
|
|
5932
|
+
}
|
|
5688
5933
|
function computeShadowMode(vm, renderer) {
|
|
5689
5934
|
const {
|
|
5690
5935
|
def
|
|
@@ -7003,7 +7248,7 @@
|
|
|
7003
7248
|
}
|
|
7004
7249
|
return ctor;
|
|
7005
7250
|
}
|
|
7006
|
-
/* version: 2.
|
|
7251
|
+
/* version: 2.34.0 */
|
|
7007
7252
|
|
|
7008
7253
|
/*
|
|
7009
7254
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7110,7 +7355,9 @@
|
|
|
7110
7355
|
//
|
|
7111
7356
|
// Test utilities
|
|
7112
7357
|
//
|
|
7113
|
-
|
|
7358
|
+
// Only used in LWC's Karma tests
|
|
7359
|
+
// @ts-ignore
|
|
7360
|
+
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
7114
7361
|
// @ts-ignore
|
|
7115
7362
|
window.__lwcResetGlobalStylesheets = () => {
|
|
7116
7363
|
stylesheetCache.clear();
|
|
@@ -7976,7 +8223,7 @@
|
|
|
7976
8223
|
function isNull(obj) {
|
|
7977
8224
|
return obj === null;
|
|
7978
8225
|
}
|
|
7979
|
-
/** version: 2.
|
|
8226
|
+
/** version: 2.34.0 */
|
|
7980
8227
|
|
|
7981
8228
|
/*
|
|
7982
8229
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8537,7 +8784,7 @@
|
|
|
8537
8784
|
});
|
|
8538
8785
|
freeze(LightningElement);
|
|
8539
8786
|
seal(LightningElement.prototype);
|
|
8540
|
-
/* version: 2.
|
|
8787
|
+
/* version: 2.34.0 */
|
|
8541
8788
|
|
|
8542
8789
|
exports.LightningElement = LightningElement;
|
|
8543
8790
|
exports.__unstable__ProfilerControl = profilerControl;
|