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