lwc 2.32.1 → 2.33.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 +683 -560
- package/dist/engine-dom/iife/es2017/engine-dom.js +683 -560
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +593 -467
- package/dist/engine-dom/iife/es5/engine-dom.js +121 -95
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +119 -92
- package/dist/engine-dom/umd/es2017/engine-dom.js +683 -560
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +593 -467
- package/dist/engine-dom/umd/es5/engine-dom.js +121 -95
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +119 -92
- package/dist/engine-server/commonjs/es2017/engine-server.js +655 -474
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +655 -474
- 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
|
@@ -121,6 +121,9 @@
|
|
|
121
121
|
* The above list of 46 aria attributes is consistent with the following resources:
|
|
122
122
|
* https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
|
|
123
123
|
* https://wicg.github.io/aom/spec/aria-reflection.html
|
|
124
|
+
*
|
|
125
|
+
* NOTE: If you update this list, please update test files that implicitly reference this list!
|
|
126
|
+
* Searching the codebase for `aria-flowto` and `ariaFlowTo` should be good enough to find all usages.
|
|
124
127
|
*/
|
|
125
128
|
const AriaPropertyNames = [
|
|
126
129
|
'ariaActiveDescendant',
|
|
@@ -336,89 +339,7 @@
|
|
|
336
339
|
CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
|
|
337
340
|
return propertyName;
|
|
338
341
|
}
|
|
339
|
-
/** version: 2.
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Copyright (C) 2018 salesforce.com, inc.
|
|
343
|
-
*/
|
|
344
|
-
|
|
345
|
-
/*
|
|
346
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
347
|
-
* All rights reserved.
|
|
348
|
-
* SPDX-License-Identifier: MIT
|
|
349
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
350
|
-
*/
|
|
351
|
-
function detect(propName) {
|
|
352
|
-
return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/*
|
|
356
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
357
|
-
* All rights reserved.
|
|
358
|
-
* SPDX-License-Identifier: MIT
|
|
359
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
360
|
-
*/
|
|
361
|
-
const nodeToAriaPropertyValuesMap = new WeakMap();
|
|
362
|
-
function getAriaPropertyMap(elm) {
|
|
363
|
-
let map = nodeToAriaPropertyValuesMap.get(elm);
|
|
364
|
-
if (map === undefined) {
|
|
365
|
-
map = {};
|
|
366
|
-
nodeToAriaPropertyValuesMap.set(elm, map);
|
|
367
|
-
}
|
|
368
|
-
return map;
|
|
369
|
-
}
|
|
370
|
-
function getNormalizedAriaPropertyValue(value) {
|
|
371
|
-
return value == null ? null : String(value);
|
|
372
|
-
}
|
|
373
|
-
function createAriaPropertyPropertyDescriptor(propName, attrName) {
|
|
374
|
-
return {
|
|
375
|
-
get() {
|
|
376
|
-
const map = getAriaPropertyMap(this);
|
|
377
|
-
if (hasOwnProperty$1.call(map, propName)) {
|
|
378
|
-
return map[propName];
|
|
379
|
-
}
|
|
380
|
-
// otherwise just reflect what's in the attribute
|
|
381
|
-
return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
|
|
382
|
-
},
|
|
383
|
-
set(newValue) {
|
|
384
|
-
const normalizedValue = getNormalizedAriaPropertyValue(newValue);
|
|
385
|
-
const map = getAriaPropertyMap(this);
|
|
386
|
-
map[propName] = normalizedValue;
|
|
387
|
-
// reflect into the corresponding attribute
|
|
388
|
-
if (newValue === null) {
|
|
389
|
-
this.removeAttribute(attrName);
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
392
|
-
this.setAttribute(attrName, newValue);
|
|
393
|
-
}
|
|
394
|
-
},
|
|
395
|
-
configurable: true,
|
|
396
|
-
enumerable: true,
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
function patch$1(propName) {
|
|
400
|
-
// Typescript is inferring the wrong function type for this particular
|
|
401
|
-
// overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
|
|
402
|
-
// @ts-ignore type-mismatch
|
|
403
|
-
const attrName = AriaPropNameToAttrNameMap[propName];
|
|
404
|
-
const descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);
|
|
405
|
-
Object.defineProperty(Element.prototype, propName, descriptor);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/*
|
|
409
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
410
|
-
* All rights reserved.
|
|
411
|
-
* SPDX-License-Identifier: MIT
|
|
412
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
413
|
-
*/
|
|
414
|
-
const ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
|
|
415
|
-
for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1) {
|
|
416
|
-
const propName = ElementPrototypeAriaPropertyNames[i];
|
|
417
|
-
if (detect(propName)) {
|
|
418
|
-
patch$1(propName);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
/** version: 2.32.1 */
|
|
342
|
+
/** version: 2.33.0 */
|
|
422
343
|
|
|
423
344
|
/**
|
|
424
345
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -440,6 +361,7 @@
|
|
|
440
361
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
441
362
|
ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
|
|
442
363
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
364
|
+
DISABLE_ARIA_REFLECTION_POLYFILL: null,
|
|
443
365
|
};
|
|
444
366
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
445
367
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
|
|
@@ -483,6 +405,83 @@
|
|
|
483
405
|
*/
|
|
484
406
|
function setFeatureFlagForTest(name, value) {
|
|
485
407
|
}
|
|
408
|
+
/** version: 2.33.0 */
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Copyright (C) 2018 salesforce.com, inc.
|
|
412
|
+
*/
|
|
413
|
+
|
|
414
|
+
/*
|
|
415
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
416
|
+
* All rights reserved.
|
|
417
|
+
* SPDX-License-Identifier: MIT
|
|
418
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
419
|
+
*/
|
|
420
|
+
function detect(propName, prototype) {
|
|
421
|
+
return isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName));
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/*
|
|
425
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
426
|
+
* All rights reserved.
|
|
427
|
+
* SPDX-License-Identifier: MIT
|
|
428
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
429
|
+
*/
|
|
430
|
+
function createAriaPropertyPropertyDescriptor(attrName) {
|
|
431
|
+
// Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
|
|
432
|
+
// from Element.prototype, because these methods are overridden in LightningElement.
|
|
433
|
+
return {
|
|
434
|
+
get() {
|
|
435
|
+
// reflect what's in the attribute
|
|
436
|
+
return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
|
|
437
|
+
},
|
|
438
|
+
set(newValue) {
|
|
439
|
+
// reflect into the corresponding attribute
|
|
440
|
+
if (isNull(newValue)) {
|
|
441
|
+
this.removeAttribute(attrName);
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
this.setAttribute(attrName, newValue);
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
configurable: true,
|
|
448
|
+
enumerable: true,
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
function patch$1(propName, prototype) {
|
|
452
|
+
const attrName = AriaPropNameToAttrNameMap[propName];
|
|
453
|
+
const descriptor = createAriaPropertyPropertyDescriptor(attrName);
|
|
454
|
+
defineProperty(prototype, propName, descriptor);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/*
|
|
458
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
459
|
+
* All rights reserved.
|
|
460
|
+
* SPDX-License-Identifier: MIT
|
|
461
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
462
|
+
*/
|
|
463
|
+
function applyAriaReflection(prototype = Element.prototype) {
|
|
464
|
+
const ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
|
|
465
|
+
for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1) {
|
|
466
|
+
const propName = ElementPrototypeAriaPropertyNames[i];
|
|
467
|
+
if (detect(propName, prototype)) {
|
|
468
|
+
patch$1(propName, prototype);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
/** version: 2.33.0 */
|
|
473
|
+
|
|
474
|
+
/*
|
|
475
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
476
|
+
* All rights reserved.
|
|
477
|
+
* SPDX-License-Identifier: MIT
|
|
478
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
479
|
+
*/
|
|
480
|
+
if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
481
|
+
// If DISABLE_ARIA_REFLECTION_POLYFILL is false, then we need to apply the ARIA reflection polyfill globally,
|
|
482
|
+
// i.e. to the global Element.prototype
|
|
483
|
+
applyAriaReflection();
|
|
484
|
+
}
|
|
486
485
|
|
|
487
486
|
/*
|
|
488
487
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1389,30 +1388,35 @@
|
|
|
1389
1388
|
* for the Base Lightning Element, it also include the reactivity bit, so the standard property is reactive.
|
|
1390
1389
|
*/
|
|
1391
1390
|
function createBridgeToElementDescriptor(propName, descriptor) {
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1391
|
+
const {
|
|
1392
|
+
get,
|
|
1393
|
+
set,
|
|
1394
|
+
enumerable,
|
|
1395
|
+
configurable
|
|
1396
|
+
} = descriptor;
|
|
1397
|
+
if (!isFunction$1(get)) {
|
|
1398
|
+
throw new TypeError();
|
|
1399
|
+
}
|
|
1400
|
+
if (!isFunction$1(set)) {
|
|
1401
|
+
throw new TypeError();
|
|
1402
|
+
}
|
|
1403
|
+
return {
|
|
1404
|
+
enumerable,
|
|
1405
|
+
configurable,
|
|
1406
|
+
get() {
|
|
1407
|
+
const vm = getAssociatedVM(this);
|
|
1408
|
+
if (isBeingConstructed(vm)) {
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
componentValueObserved(vm, propName);
|
|
1412
|
+
return get.call(vm.elm);
|
|
1413
|
+
},
|
|
1414
|
+
set(newValue) {
|
|
1415
|
+
const vm = getAssociatedVM(this);
|
|
1416
|
+
updateComponentValue(vm, propName, newValue);
|
|
1417
|
+
return set.call(vm.elm, newValue);
|
|
1398
1418
|
}
|
|
1399
|
-
|
|
1400
|
-
enumerable,
|
|
1401
|
-
configurable,
|
|
1402
|
-
get() {
|
|
1403
|
-
const vm = getAssociatedVM(this);
|
|
1404
|
-
if (isBeingConstructed(vm)) {
|
|
1405
|
-
return;
|
|
1406
|
-
}
|
|
1407
|
-
componentValueObserved(vm, propName);
|
|
1408
|
-
return get.call(vm.elm);
|
|
1409
|
-
},
|
|
1410
|
-
set(newValue) {
|
|
1411
|
-
const vm = getAssociatedVM(this);
|
|
1412
|
-
updateComponentValue(vm, propName, newValue);
|
|
1413
|
-
return set.call(vm.elm, newValue);
|
|
1414
|
-
},
|
|
1415
|
-
};
|
|
1419
|
+
};
|
|
1416
1420
|
}
|
|
1417
1421
|
const EMPTY_REFS = freeze(create(null));
|
|
1418
1422
|
const refsCache = new WeakMap();
|
|
@@ -1422,262 +1426,361 @@
|
|
|
1422
1426
|
**/
|
|
1423
1427
|
// @ts-ignore
|
|
1424
1428
|
const LightningElement = function () {
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1429
|
+
// This should be as performant as possible, while any initialization should be done lazily
|
|
1430
|
+
if (isNull(vmBeingConstructed)) {
|
|
1431
|
+
// Thrown when doing something like `new LightningElement()` or
|
|
1432
|
+
// `class Foo extends LightningElement {}; new Foo()`
|
|
1433
|
+
throw new TypeError('Illegal constructor');
|
|
1434
|
+
}
|
|
1435
|
+
const vm = vmBeingConstructed;
|
|
1436
|
+
const {
|
|
1437
|
+
def,
|
|
1438
|
+
elm
|
|
1439
|
+
} = vm;
|
|
1440
|
+
const {
|
|
1441
|
+
bridge
|
|
1442
|
+
} = def;
|
|
1443
|
+
const component = this;
|
|
1444
|
+
setPrototypeOf(elm, bridge.prototype);
|
|
1445
|
+
vm.component = this;
|
|
1446
|
+
// Locker hooks assignment. When the LWC engine run with Locker, Locker intercepts all the new
|
|
1447
|
+
// component creation and passes hooks to instrument all the component interactions with the
|
|
1448
|
+
// engine. We are intentionally hiding this argument from the formal API of LightningElement
|
|
1449
|
+
// because we don't want folks to know about it just yet.
|
|
1450
|
+
if (arguments.length === 1) {
|
|
1451
|
+
const {
|
|
1452
|
+
callHook,
|
|
1453
|
+
setHook,
|
|
1454
|
+
getHook
|
|
1455
|
+
} = arguments[0];
|
|
1456
|
+
vm.callHook = callHook;
|
|
1457
|
+
vm.setHook = setHook;
|
|
1458
|
+
vm.getHook = getHook;
|
|
1459
|
+
}
|
|
1460
|
+
markLockerLiveObject(this);
|
|
1461
|
+
// Linking elm, shadow root and component with the VM.
|
|
1462
|
+
associateVM(component, vm);
|
|
1463
|
+
associateVM(elm, vm);
|
|
1464
|
+
if (vm.renderMode === 1 /* RenderMode.Shadow */) {
|
|
1465
|
+
vm.renderRoot = doAttachShadow(vm);
|
|
1466
|
+
} else {
|
|
1467
|
+
vm.renderRoot = elm;
|
|
1468
|
+
}
|
|
1469
|
+
return this;
|
|
1458
1470
|
};
|
|
1459
1471
|
function doAttachShadow(vm) {
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1472
|
+
const {
|
|
1473
|
+
elm,
|
|
1474
|
+
mode,
|
|
1475
|
+
shadowMode,
|
|
1476
|
+
def: {
|
|
1477
|
+
ctor
|
|
1478
|
+
},
|
|
1479
|
+
renderer: {
|
|
1480
|
+
attachShadow
|
|
1481
|
+
}
|
|
1482
|
+
} = vm;
|
|
1483
|
+
const shadowRoot = attachShadow(elm, {
|
|
1484
|
+
[KEY__SYNTHETIC_MODE]: shadowMode === 1 /* ShadowMode.Synthetic */,
|
|
1485
|
+
delegatesFocus: Boolean(ctor.delegatesFocus),
|
|
1486
|
+
mode
|
|
1487
|
+
});
|
|
1488
|
+
vm.shadowRoot = shadowRoot;
|
|
1489
|
+
associateVM(shadowRoot, vm);
|
|
1490
|
+
return shadowRoot;
|
|
1469
1491
|
}
|
|
1470
1492
|
// @ts-ignore
|
|
1471
1493
|
LightningElement.prototype = {
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
}
|
|
1513
|
-
getAttribute(name)
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1494
|
+
constructor: LightningElement,
|
|
1495
|
+
dispatchEvent(event) {
|
|
1496
|
+
const vm = getAssociatedVM(this);
|
|
1497
|
+
const {
|
|
1498
|
+
elm,
|
|
1499
|
+
renderer: {
|
|
1500
|
+
dispatchEvent
|
|
1501
|
+
}
|
|
1502
|
+
} = vm;
|
|
1503
|
+
return dispatchEvent(elm, event);
|
|
1504
|
+
},
|
|
1505
|
+
addEventListener(type, listener, options) {
|
|
1506
|
+
const vm = getAssociatedVM(this);
|
|
1507
|
+
const {
|
|
1508
|
+
elm,
|
|
1509
|
+
renderer: {
|
|
1510
|
+
addEventListener
|
|
1511
|
+
}
|
|
1512
|
+
} = vm;
|
|
1513
|
+
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
1514
|
+
addEventListener(elm, type, wrappedListener, options);
|
|
1515
|
+
},
|
|
1516
|
+
removeEventListener(type, listener, options) {
|
|
1517
|
+
const vm = getAssociatedVM(this);
|
|
1518
|
+
const {
|
|
1519
|
+
elm,
|
|
1520
|
+
renderer: {
|
|
1521
|
+
removeEventListener
|
|
1522
|
+
}
|
|
1523
|
+
} = vm;
|
|
1524
|
+
const wrappedListener = getWrappedComponentsListener(vm, listener);
|
|
1525
|
+
removeEventListener(elm, type, wrappedListener, options);
|
|
1526
|
+
},
|
|
1527
|
+
hasAttribute(name) {
|
|
1528
|
+
const vm = getAssociatedVM(this);
|
|
1529
|
+
const {
|
|
1530
|
+
elm,
|
|
1531
|
+
renderer: {
|
|
1532
|
+
getAttribute
|
|
1533
|
+
}
|
|
1534
|
+
} = vm;
|
|
1535
|
+
return !isNull(getAttribute(elm, name));
|
|
1536
|
+
},
|
|
1537
|
+
hasAttributeNS(namespace, name) {
|
|
1538
|
+
const vm = getAssociatedVM(this);
|
|
1539
|
+
const {
|
|
1540
|
+
elm,
|
|
1541
|
+
renderer: {
|
|
1542
|
+
getAttribute
|
|
1543
|
+
}
|
|
1544
|
+
} = vm;
|
|
1545
|
+
return !isNull(getAttribute(elm, name, namespace));
|
|
1546
|
+
},
|
|
1547
|
+
removeAttribute(name) {
|
|
1548
|
+
const vm = getAssociatedVM(this);
|
|
1549
|
+
const {
|
|
1550
|
+
elm,
|
|
1551
|
+
renderer: {
|
|
1552
|
+
removeAttribute
|
|
1553
|
+
}
|
|
1554
|
+
} = vm;
|
|
1555
|
+
unlockAttribute(elm, name);
|
|
1556
|
+
removeAttribute(elm, name);
|
|
1557
|
+
lockAttribute();
|
|
1558
|
+
},
|
|
1559
|
+
removeAttributeNS(namespace, name) {
|
|
1560
|
+
const {
|
|
1561
|
+
elm,
|
|
1562
|
+
renderer: {
|
|
1563
|
+
removeAttribute
|
|
1564
|
+
}
|
|
1565
|
+
} = getAssociatedVM(this);
|
|
1566
|
+
unlockAttribute(elm, name);
|
|
1567
|
+
removeAttribute(elm, name, namespace);
|
|
1568
|
+
lockAttribute();
|
|
1569
|
+
},
|
|
1570
|
+
getAttribute(name) {
|
|
1571
|
+
const vm = getAssociatedVM(this);
|
|
1572
|
+
const {
|
|
1573
|
+
elm
|
|
1574
|
+
} = vm;
|
|
1575
|
+
const {
|
|
1576
|
+
getAttribute
|
|
1577
|
+
} = vm.renderer;
|
|
1578
|
+
return getAttribute(elm, name);
|
|
1579
|
+
},
|
|
1580
|
+
getAttributeNS(namespace, name) {
|
|
1581
|
+
const vm = getAssociatedVM(this);
|
|
1582
|
+
const {
|
|
1583
|
+
elm
|
|
1584
|
+
} = vm;
|
|
1585
|
+
const {
|
|
1586
|
+
getAttribute
|
|
1587
|
+
} = vm.renderer;
|
|
1588
|
+
return getAttribute(elm, name, namespace);
|
|
1589
|
+
},
|
|
1590
|
+
setAttribute(name, value) {
|
|
1591
|
+
const vm = getAssociatedVM(this);
|
|
1592
|
+
const {
|
|
1593
|
+
elm,
|
|
1594
|
+
renderer: {
|
|
1595
|
+
setAttribute
|
|
1596
|
+
}
|
|
1597
|
+
} = vm;
|
|
1598
|
+
unlockAttribute(elm, name);
|
|
1599
|
+
setAttribute(elm, name, value);
|
|
1600
|
+
lockAttribute();
|
|
1601
|
+
},
|
|
1602
|
+
setAttributeNS(namespace, name, value) {
|
|
1603
|
+
const vm = getAssociatedVM(this);
|
|
1604
|
+
const {
|
|
1605
|
+
elm,
|
|
1606
|
+
renderer: {
|
|
1607
|
+
setAttribute
|
|
1608
|
+
}
|
|
1609
|
+
} = vm;
|
|
1610
|
+
unlockAttribute(elm, name);
|
|
1611
|
+
setAttribute(elm, name, value, namespace);
|
|
1612
|
+
lockAttribute();
|
|
1613
|
+
},
|
|
1614
|
+
getBoundingClientRect() {
|
|
1615
|
+
const vm = getAssociatedVM(this);
|
|
1616
|
+
const {
|
|
1617
|
+
elm,
|
|
1618
|
+
renderer: {
|
|
1619
|
+
getBoundingClientRect
|
|
1620
|
+
}
|
|
1621
|
+
} = vm;
|
|
1622
|
+
return getBoundingClientRect(elm);
|
|
1623
|
+
},
|
|
1624
|
+
get isConnected() {
|
|
1625
|
+
const vm = getAssociatedVM(this);
|
|
1626
|
+
const {
|
|
1627
|
+
elm,
|
|
1628
|
+
renderer: {
|
|
1629
|
+
isConnected
|
|
1630
|
+
}
|
|
1631
|
+
} = vm;
|
|
1632
|
+
return isConnected(elm);
|
|
1633
|
+
},
|
|
1634
|
+
get classList() {
|
|
1635
|
+
const vm = getAssociatedVM(this);
|
|
1636
|
+
const {
|
|
1637
|
+
elm,
|
|
1638
|
+
renderer: {
|
|
1639
|
+
getClassList
|
|
1640
|
+
}
|
|
1641
|
+
} = vm;
|
|
1642
|
+
return getClassList(elm);
|
|
1643
|
+
},
|
|
1644
|
+
get template() {
|
|
1645
|
+
const vm = getAssociatedVM(this);
|
|
1646
|
+
return vm.shadowRoot;
|
|
1647
|
+
},
|
|
1648
|
+
get refs() {
|
|
1649
|
+
const vm = getAssociatedVM(this);
|
|
1650
|
+
if (isUpdatingTemplate) {
|
|
1651
|
+
// If the template is in the process of being updated, then we don't want to go through the normal
|
|
1652
|
+
// process of returning the refs and caching them, because the state of the refs is unstable.
|
|
1653
|
+
// This can happen if e.g. a template contains `<div class={foo}></div>` and `foo` is computed
|
|
1654
|
+
// based on `this.refs.bar`.
|
|
1655
|
+
return;
|
|
1656
|
+
}
|
|
1657
|
+
const {
|
|
1658
|
+
refVNodes,
|
|
1659
|
+
hasRefVNodes,
|
|
1660
|
+
cmpTemplate
|
|
1661
|
+
} = vm;
|
|
1662
|
+
// For backwards compatibility with component written before template refs
|
|
1663
|
+
// were introduced, we return undefined if the template has no refs defined
|
|
1664
|
+
// anywhere. This fixes components that may want to add an expando called `refs`
|
|
1665
|
+
// and are checking if it exists with `if (this.refs)` before adding it.
|
|
1666
|
+
// Note it is not sufficient to just check if `refVNodes` is null or empty,
|
|
1667
|
+
// because a template may have `lwc:ref` defined within a falsy `if:true` block.
|
|
1668
|
+
if (!hasRefVNodes) {
|
|
1669
|
+
return;
|
|
1670
|
+
}
|
|
1671
|
+
// For templates that are using `lwc:ref`, if there are no refs currently available
|
|
1672
|
+
// (e.g. refs inside of a falsy `if:true` block), we return an empty object.
|
|
1673
|
+
if (isNull(refVNodes)) {
|
|
1674
|
+
return EMPTY_REFS;
|
|
1675
|
+
}
|
|
1676
|
+
// The refNodes can be cached based on the refVNodes, since the refVNodes
|
|
1677
|
+
// are recreated from scratch every time the template is rendered.
|
|
1678
|
+
// This happens with `vm.refVNodes = null` in `template.ts` in `@lwc/engine-core`.
|
|
1679
|
+
let refs = refsCache.get(refVNodes);
|
|
1680
|
+
if (isUndefined$1(refs)) {
|
|
1681
|
+
refs = create(null);
|
|
1682
|
+
for (const key of keys(refVNodes)) {
|
|
1683
|
+
refs[key] = refVNodes[key].elm;
|
|
1684
|
+
}
|
|
1685
|
+
freeze(refs);
|
|
1686
|
+
refsCache.set(refVNodes, refs);
|
|
1687
|
+
}
|
|
1688
|
+
return refs;
|
|
1689
|
+
},
|
|
1690
|
+
// For backwards compat, we allow component authors to set `refs` as an expando
|
|
1691
|
+
set refs(value) {
|
|
1692
|
+
defineProperty(this, 'refs', {
|
|
1693
|
+
configurable: true,
|
|
1694
|
+
enumerable: true,
|
|
1695
|
+
writable: true,
|
|
1696
|
+
value
|
|
1697
|
+
});
|
|
1698
|
+
},
|
|
1699
|
+
get shadowRoot() {
|
|
1700
|
+
// From within the component instance, the shadowRoot is always reported as "closed".
|
|
1701
|
+
// Authors should rely on this.template instead.
|
|
1702
|
+
return null;
|
|
1703
|
+
},
|
|
1704
|
+
get children() {
|
|
1705
|
+
const vm = getAssociatedVM(this);
|
|
1706
|
+
const renderer = vm.renderer;
|
|
1707
|
+
return renderer.getChildren(vm.elm);
|
|
1708
|
+
},
|
|
1709
|
+
get childNodes() {
|
|
1710
|
+
const vm = getAssociatedVM(this);
|
|
1711
|
+
const renderer = vm.renderer;
|
|
1712
|
+
return renderer.getChildNodes(vm.elm);
|
|
1713
|
+
},
|
|
1714
|
+
get firstChild() {
|
|
1715
|
+
const vm = getAssociatedVM(this);
|
|
1716
|
+
const renderer = vm.renderer;
|
|
1717
|
+
return renderer.getFirstChild(vm.elm);
|
|
1718
|
+
},
|
|
1719
|
+
get firstElementChild() {
|
|
1720
|
+
const vm = getAssociatedVM(this);
|
|
1721
|
+
const renderer = vm.renderer;
|
|
1722
|
+
return renderer.getFirstElementChild(vm.elm);
|
|
1723
|
+
},
|
|
1724
|
+
get lastChild() {
|
|
1725
|
+
const vm = getAssociatedVM(this);
|
|
1726
|
+
const renderer = vm.renderer;
|
|
1727
|
+
return renderer.getLastChild(vm.elm);
|
|
1728
|
+
},
|
|
1729
|
+
get lastElementChild() {
|
|
1730
|
+
const vm = getAssociatedVM(this);
|
|
1731
|
+
const renderer = vm.renderer;
|
|
1732
|
+
return renderer.getLastElementChild(vm.elm);
|
|
1733
|
+
},
|
|
1734
|
+
render() {
|
|
1735
|
+
const vm = getAssociatedVM(this);
|
|
1736
|
+
return vm.def.template;
|
|
1737
|
+
},
|
|
1738
|
+
toString() {
|
|
1739
|
+
const vm = getAssociatedVM(this);
|
|
1740
|
+
return `[object ${vm.def.name}]`;
|
|
1741
|
+
}
|
|
1648
1742
|
};
|
|
1649
1743
|
const queryAndChildGetterDescriptors = create(null);
|
|
1650
|
-
const queryMethods = [
|
|
1651
|
-
'getElementsByClassName',
|
|
1652
|
-
'getElementsByTagName',
|
|
1653
|
-
'querySelector',
|
|
1654
|
-
'querySelectorAll',
|
|
1655
|
-
];
|
|
1744
|
+
const queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];
|
|
1656
1745
|
// Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs
|
|
1657
1746
|
for (const queryMethod of queryMethods) {
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1747
|
+
queryAndChildGetterDescriptors[queryMethod] = {
|
|
1748
|
+
value(arg) {
|
|
1749
|
+
const vm = getAssociatedVM(this);
|
|
1750
|
+
const {
|
|
1751
|
+
elm,
|
|
1752
|
+
renderer
|
|
1753
|
+
} = vm;
|
|
1754
|
+
return renderer[queryMethod](elm, arg);
|
|
1755
|
+
},
|
|
1756
|
+
configurable: true,
|
|
1757
|
+
enumerable: true,
|
|
1758
|
+
writable: true
|
|
1759
|
+
};
|
|
1668
1760
|
}
|
|
1669
1761
|
defineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);
|
|
1670
1762
|
const lightningBasedDescriptors = create(null);
|
|
1671
1763
|
for (const propName in HTMLElementOriginalDescriptors) {
|
|
1672
|
-
|
|
1764
|
+
lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
|
|
1673
1765
|
}
|
|
1674
1766
|
defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
|
1767
|
+
function applyAriaReflectionToLightningElement() {
|
|
1768
|
+
// If ARIA reflection is not applied globally to Element.prototype, or if we are running server-side,
|
|
1769
|
+
// apply it to LightningElement.prototype.
|
|
1770
|
+
// This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
|
|
1771
|
+
applyAriaReflection(LightningElement.prototype);
|
|
1772
|
+
}
|
|
1773
|
+
// The reason for this odd if/else branching is limitations in @lwc/features:
|
|
1774
|
+
// https://github.com/salesforce/lwc/blob/master/packages/%40lwc/features/README.md#only-works-with-if-statements
|
|
1775
|
+
if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
1776
|
+
applyAriaReflectionToLightningElement();
|
|
1777
|
+
}
|
|
1675
1778
|
defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1779
|
+
get() {
|
|
1780
|
+
// If required, a runtime-specific implementation must be defined.
|
|
1781
|
+
throw new ReferenceError('The current runtime does not support CustomElementConstructor.');
|
|
1782
|
+
},
|
|
1783
|
+
configurable: true
|
|
1681
1784
|
});
|
|
1682
1785
|
|
|
1683
1786
|
function createObservedFieldPropertyDescriptor(key) {
|
|
@@ -1964,138 +2067,161 @@
|
|
|
1964
2067
|
const cachedGetterByKey = create(null);
|
|
1965
2068
|
const cachedSetterByKey = create(null);
|
|
1966
2069
|
function createGetter(key) {
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2070
|
+
let fn = cachedGetterByKey[key];
|
|
2071
|
+
if (isUndefined$1(fn)) {
|
|
2072
|
+
fn = cachedGetterByKey[key] = function () {
|
|
2073
|
+
const vm = getAssociatedVM(this);
|
|
2074
|
+
const {
|
|
2075
|
+
getHook
|
|
2076
|
+
} = vm;
|
|
2077
|
+
return getHook(vm.component, key);
|
|
2078
|
+
};
|
|
2079
|
+
}
|
|
2080
|
+
return fn;
|
|
1976
2081
|
}
|
|
1977
2082
|
function createSetter(key) {
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2083
|
+
let fn = cachedSetterByKey[key];
|
|
2084
|
+
if (isUndefined$1(fn)) {
|
|
2085
|
+
fn = cachedSetterByKey[key] = function (newValue) {
|
|
2086
|
+
const vm = getAssociatedVM(this);
|
|
2087
|
+
const {
|
|
2088
|
+
setHook
|
|
2089
|
+
} = vm;
|
|
2090
|
+
newValue = getReadOnlyProxy(newValue);
|
|
2091
|
+
setHook(vm.component, key, newValue);
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
2094
|
+
return fn;
|
|
1988
2095
|
}
|
|
1989
2096
|
function createMethodCaller(methodName) {
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
};
|
|
2097
|
+
return function () {
|
|
2098
|
+
const vm = getAssociatedVM(this);
|
|
2099
|
+
const {
|
|
2100
|
+
callHook,
|
|
2101
|
+
component
|
|
2102
|
+
} = vm;
|
|
2103
|
+
const fn = component[methodName];
|
|
2104
|
+
return callHook(vm.component, fn, ArraySlice.call(arguments));
|
|
2105
|
+
};
|
|
1996
2106
|
}
|
|
1997
2107
|
function createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback) {
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
}
|
|
2003
|
-
const propName = attributeToPropMap[attrName];
|
|
2004
|
-
if (isUndefined$1(propName)) {
|
|
2005
|
-
if (!isUndefined$1(superAttributeChangedCallback)) {
|
|
2006
|
-
// delegate unknown attributes to the super.
|
|
2007
|
-
// Typescript does not like it when you treat the `arguments` object as an array
|
|
2008
|
-
// @ts-ignore type-mismatch
|
|
2009
|
-
superAttributeChangedCallback.apply(this, arguments);
|
|
2010
|
-
}
|
|
2011
|
-
return;
|
|
2012
|
-
}
|
|
2013
|
-
if (!isAttributeLocked(this, attrName)) {
|
|
2014
|
-
// Ignore changes triggered by the engine itself during:
|
|
2015
|
-
// * diffing when public props are attempting to reflect to the DOM
|
|
2016
|
-
// * component via `this.setAttribute()`, should never update the prop
|
|
2017
|
-
// Both cases, the setAttribute call is always wrapped by the unlocking of the
|
|
2018
|
-
// attribute to be changed
|
|
2019
|
-
return;
|
|
2020
|
-
}
|
|
2021
|
-
// Reflect attribute change to the corresponding property when changed from outside.
|
|
2022
|
-
this[propName] = newValue;
|
|
2023
|
-
};
|
|
2024
|
-
}
|
|
2025
|
-
function HTMLBridgeElementFactory(SuperClass, props, methods) {
|
|
2026
|
-
let HTMLBridgeElement;
|
|
2027
|
-
/**
|
|
2028
|
-
* Modern browsers will have all Native Constructors as regular Classes
|
|
2029
|
-
* and must be instantiated with the new keyword. In older browsers,
|
|
2030
|
-
* specifically IE11, those are objects with a prototype property defined,
|
|
2031
|
-
* since they are not supposed to be extended or instantiated with the
|
|
2032
|
-
* new keyword. This forking logic supports both cases, specifically because
|
|
2033
|
-
* wc.ts relies on the construction path of the bridges to create new
|
|
2034
|
-
* fully qualifying web components.
|
|
2035
|
-
*/
|
|
2036
|
-
if (isFunction$1(SuperClass)) {
|
|
2037
|
-
HTMLBridgeElement = class extends SuperClass {
|
|
2038
|
-
};
|
|
2039
|
-
}
|
|
2040
|
-
else {
|
|
2041
|
-
HTMLBridgeElement = function () {
|
|
2042
|
-
// Bridge classes are not supposed to be instantiated directly in
|
|
2043
|
-
// browsers that do not support web components.
|
|
2044
|
-
throw new TypeError('Illegal constructor');
|
|
2045
|
-
};
|
|
2046
|
-
// prototype inheritance dance
|
|
2047
|
-
setPrototypeOf(HTMLBridgeElement, SuperClass);
|
|
2048
|
-
setPrototypeOf(HTMLBridgeElement.prototype, SuperClass.prototype);
|
|
2049
|
-
defineProperty(HTMLBridgeElement.prototype, 'constructor', {
|
|
2050
|
-
writable: true,
|
|
2051
|
-
configurable: true,
|
|
2052
|
-
value: HTMLBridgeElement,
|
|
2053
|
-
});
|
|
2108
|
+
return function attributeChangedCallback(attrName, oldValue, newValue) {
|
|
2109
|
+
if (oldValue === newValue) {
|
|
2110
|
+
// Ignore same values.
|
|
2111
|
+
return;
|
|
2054
2112
|
}
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
attributeToPropMap[htmlPropertyToAttribute(propName)] = propName;
|
|
2065
|
-
descriptors[propName] = {
|
|
2066
|
-
get: createGetter(propName),
|
|
2067
|
-
set: createSetter(propName),
|
|
2068
|
-
enumerable: true,
|
|
2069
|
-
configurable: true,
|
|
2070
|
-
};
|
|
2113
|
+
const propName = attributeToPropMap[attrName];
|
|
2114
|
+
if (isUndefined$1(propName)) {
|
|
2115
|
+
if (!isUndefined$1(superAttributeChangedCallback)) {
|
|
2116
|
+
// delegate unknown attributes to the super.
|
|
2117
|
+
// Typescript does not like it when you treat the `arguments` object as an array
|
|
2118
|
+
// @ts-ignore type-mismatch
|
|
2119
|
+
superAttributeChangedCallback.apply(this, arguments);
|
|
2120
|
+
}
|
|
2121
|
+
return;
|
|
2071
2122
|
}
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
};
|
|
2123
|
+
if (!isAttributeLocked(this, attrName)) {
|
|
2124
|
+
// Ignore changes triggered by the engine itself during:
|
|
2125
|
+
// * diffing when public props are attempting to reflect to the DOM
|
|
2126
|
+
// * component via `this.setAttribute()`, should never update the prop
|
|
2127
|
+
// Both cases, the setAttribute call is always wrapped by the unlocking of the
|
|
2128
|
+
// attribute to be changed
|
|
2129
|
+
return;
|
|
2080
2130
|
}
|
|
2081
|
-
//
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2131
|
+
// Reflect attribute change to the corresponding property when changed from outside.
|
|
2132
|
+
this[propName] = newValue;
|
|
2133
|
+
};
|
|
2134
|
+
}
|
|
2135
|
+
function HTMLBridgeElementFactory(SuperClass, props, methods) {
|
|
2136
|
+
let HTMLBridgeElement;
|
|
2137
|
+
/**
|
|
2138
|
+
* Modern browsers will have all Native Constructors as regular Classes
|
|
2139
|
+
* and must be instantiated with the new keyword. In older browsers,
|
|
2140
|
+
* specifically IE11, those are objects with a prototype property defined,
|
|
2141
|
+
* since they are not supposed to be extended or instantiated with the
|
|
2142
|
+
* new keyword. This forking logic supports both cases, specifically because
|
|
2143
|
+
* wc.ts relies on the construction path of the bridges to create new
|
|
2144
|
+
* fully qualifying web components.
|
|
2145
|
+
*/
|
|
2146
|
+
if (isFunction$1(SuperClass)) {
|
|
2147
|
+
HTMLBridgeElement = class extends SuperClass {};
|
|
2148
|
+
} else {
|
|
2149
|
+
HTMLBridgeElement = function () {
|
|
2150
|
+
// Bridge classes are not supposed to be instantiated directly in
|
|
2151
|
+
// browsers that do not support web components.
|
|
2152
|
+
throw new TypeError('Illegal constructor');
|
|
2087
2153
|
};
|
|
2088
|
-
//
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2154
|
+
// prototype inheritance dance
|
|
2155
|
+
setPrototypeOf(HTMLBridgeElement, SuperClass);
|
|
2156
|
+
setPrototypeOf(HTMLBridgeElement.prototype, SuperClass.prototype);
|
|
2157
|
+
defineProperty(HTMLBridgeElement.prototype, 'constructor', {
|
|
2158
|
+
writable: true,
|
|
2159
|
+
configurable: true,
|
|
2160
|
+
value: HTMLBridgeElement
|
|
2094
2161
|
});
|
|
2095
|
-
|
|
2096
|
-
|
|
2162
|
+
}
|
|
2163
|
+
// generating the hash table for attributes to avoid duplicate fields and facilitate validation
|
|
2164
|
+
// and false positives in case of inheritance.
|
|
2165
|
+
const attributeToPropMap = create(null);
|
|
2166
|
+
const {
|
|
2167
|
+
attributeChangedCallback: superAttributeChangedCallback
|
|
2168
|
+
} = SuperClass.prototype;
|
|
2169
|
+
const {
|
|
2170
|
+
observedAttributes: superObservedAttributes = []
|
|
2171
|
+
} = SuperClass;
|
|
2172
|
+
const descriptors = create(null);
|
|
2173
|
+
// expose getters and setters for each public props on the new Element Bridge
|
|
2174
|
+
for (let i = 0, len = props.length; i < len; i += 1) {
|
|
2175
|
+
const propName = props[i];
|
|
2176
|
+
attributeToPropMap[htmlPropertyToAttribute(propName)] = propName;
|
|
2177
|
+
descriptors[propName] = {
|
|
2178
|
+
get: createGetter(propName),
|
|
2179
|
+
set: createSetter(propName),
|
|
2180
|
+
enumerable: true,
|
|
2181
|
+
configurable: true
|
|
2182
|
+
};
|
|
2183
|
+
}
|
|
2184
|
+
// expose public methods as props on the new Element Bridge
|
|
2185
|
+
for (let i = 0, len = methods.length; i < len; i += 1) {
|
|
2186
|
+
const methodName = methods[i];
|
|
2187
|
+
descriptors[methodName] = {
|
|
2188
|
+
value: createMethodCaller(methodName),
|
|
2189
|
+
writable: true,
|
|
2190
|
+
configurable: true
|
|
2191
|
+
};
|
|
2192
|
+
}
|
|
2193
|
+
// creating a new attributeChangedCallback per bridge because they are bound to the corresponding
|
|
2194
|
+
// map of attributes to props. We do this after all other props and methods to avoid the possibility
|
|
2195
|
+
// of getting overrule by a class declaration in user-land, and we make it non-writable, non-configurable
|
|
2196
|
+
// to preserve this definition.
|
|
2197
|
+
descriptors.attributeChangedCallback = {
|
|
2198
|
+
value: createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback)
|
|
2199
|
+
};
|
|
2200
|
+
// Specify attributes for which we want to reflect changes back to their corresponding
|
|
2201
|
+
// properties via attributeChangedCallback.
|
|
2202
|
+
defineProperty(HTMLBridgeElement, 'observedAttributes', {
|
|
2203
|
+
get() {
|
|
2204
|
+
return [...superObservedAttributes, ...keys(attributeToPropMap)];
|
|
2205
|
+
}
|
|
2206
|
+
});
|
|
2207
|
+
defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
2208
|
+
return HTMLBridgeElement;
|
|
2097
2209
|
}
|
|
2098
2210
|
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
|
|
2211
|
+
{
|
|
2212
|
+
// This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
|
|
2213
|
+
// so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
|
|
2214
|
+
// ARIA props outside the LightningElement
|
|
2215
|
+
if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
|
|
2216
|
+
// If ARIA reflection is not applied globally to Element.prototype, apply it to HTMLBridgeElement.prototype.
|
|
2217
|
+
// This allows `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*` attrs.
|
|
2218
|
+
// This is especially important because the template compiler compiles aria-* attrs on components to aria* props
|
|
2219
|
+
//
|
|
2220
|
+
// Also note that we apply this to BaseBridgeElement.prototype to avoid excessively redefining property
|
|
2221
|
+
// accessors inside the HTMLBridgeElementFactory.
|
|
2222
|
+
applyAriaReflection(BaseBridgeElement.prototype);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2099
2225
|
freeze(BaseBridgeElement);
|
|
2100
2226
|
seal(BaseBridgeElement.prototype);
|
|
2101
2227
|
function setActiveVM(vm) {
|
|
@@ -6257,7 +6383,7 @@
|
|
|
6257
6383
|
function isNull(obj) {
|
|
6258
6384
|
return obj === null;
|
|
6259
6385
|
}
|
|
6260
|
-
/** version: 2.
|
|
6386
|
+
/** version: 2.33.0 */
|
|
6261
6387
|
|
|
6262
6388
|
/*
|
|
6263
6389
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6810,7 +6936,7 @@
|
|
|
6810
6936
|
});
|
|
6811
6937
|
freeze(LightningElement);
|
|
6812
6938
|
seal(LightningElement.prototype);
|
|
6813
|
-
/* version: 2.
|
|
6939
|
+
/* version: 2.33.0 */
|
|
6814
6940
|
|
|
6815
6941
|
exports.LightningElement = LightningElement;
|
|
6816
6942
|
exports.__unstable__ProfilerControl = profilerControl;
|