@lwc/engine-core 5.0.4 → 5.0.6
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/index.cjs.js +57 -69
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +58 -70
- package/dist/index.js.map +1 -1
- package/dist/libs/aria-reflection/aria-reflection.d.ts +2 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -424,17 +424,6 @@ var _a, _b;
|
|
|
424
424
|
const instrumentDef = (_a = shared.globalThis.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : shared.noop;
|
|
425
425
|
const instrumentInstance = (_b = shared.globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : shared.noop;
|
|
426
426
|
|
|
427
|
-
/*
|
|
428
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
429
|
-
* All rights reserved.
|
|
430
|
-
* SPDX-License-Identifier: MIT
|
|
431
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
432
|
-
*/
|
|
433
|
-
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
434
|
-
// to inject at runtime.
|
|
435
|
-
const HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () { };
|
|
436
|
-
const HTMLElementPrototype = HTMLElementConstructor.prototype;
|
|
437
|
-
|
|
438
427
|
/*
|
|
439
428
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
440
429
|
* All rights reserved.
|
|
@@ -443,36 +432,48 @@ const HTMLElementPrototype = HTMLElementConstructor.prototype;
|
|
|
443
432
|
*/
|
|
444
433
|
// Apply ARIA string reflection behavior to a prototype.
|
|
445
434
|
// This is deliberately kept separate from @lwc/aria-reflection. @lwc/aria-reflection is a global polyfill that is
|
|
446
|
-
// needed for backwards compatibility in LEX, whereas
|
|
435
|
+
// needed for backwards compatibility in LEX, whereas `applyAriaReflection` is designed to only apply to our own
|
|
447
436
|
// LightningElement/BaseBridgeElement prototypes.
|
|
448
|
-
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
437
|
+
function applyAriaReflection(prototype) {
|
|
438
|
+
for (const propName of shared.keys(shared.AriaPropNameToAttrNameMap)) {
|
|
439
|
+
const attrName = shared.AriaPropNameToAttrNameMap[propName];
|
|
440
|
+
if (shared.isUndefined(shared.getOwnPropertyDescriptor(prototype, propName))) {
|
|
441
|
+
// Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
|
|
442
|
+
// from Element.prototype, because these methods are overridden in LightningElement.
|
|
443
|
+
shared.defineProperty(prototype, propName, {
|
|
444
|
+
get() {
|
|
445
|
+
return this.getAttribute(attrName);
|
|
446
|
+
},
|
|
447
|
+
set(newValue) {
|
|
448
|
+
// TODO [#3284]: there is disagreement between browsers and the spec on how to treat undefined
|
|
449
|
+
// Our historical behavior is to only treat null as removing the attribute
|
|
450
|
+
// See also https://github.com/w3c/aria/issues/1858
|
|
451
|
+
if (shared.isNull(newValue)) {
|
|
452
|
+
this.removeAttribute(attrName);
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
this.setAttribute(attrName, newValue);
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
// configurable and enumerable to allow it to be overridden – this mimics Safari's/Chrome's behavior
|
|
459
|
+
configurable: true,
|
|
460
|
+
enumerable: true,
|
|
461
|
+
});
|
|
462
|
+
}
|
|
473
463
|
}
|
|
474
464
|
}
|
|
475
465
|
|
|
466
|
+
/*
|
|
467
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
468
|
+
* All rights reserved.
|
|
469
|
+
* SPDX-License-Identifier: MIT
|
|
470
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
471
|
+
*/
|
|
472
|
+
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
473
|
+
// to inject at runtime.
|
|
474
|
+
const HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () { };
|
|
475
|
+
const HTMLElementPrototype = HTMLElementConstructor.prototype;
|
|
476
|
+
|
|
476
477
|
/*
|
|
477
478
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
478
479
|
* All rights reserved.
|
|
@@ -1845,22 +1846,11 @@ const lightningBasedDescriptors = shared.create(null);
|
|
|
1845
1846
|
for (const propName in HTMLElementOriginalDescriptors) {
|
|
1846
1847
|
lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
|
|
1847
1848
|
}
|
|
1849
|
+
shared.defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
|
1848
1850
|
// Apply ARIA reflection to LightningElement.prototype, on both the browser and server.
|
|
1849
1851
|
// This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
|
|
1850
1852
|
// Note this works regardless of whether the global ARIA reflection polyfill is applied or not.
|
|
1851
|
-
|
|
1852
|
-
// In the browser, we use createBridgeToElementDescriptor, so we can get the normal reactivity lifecycle for
|
|
1853
|
-
// aria* properties
|
|
1854
|
-
for (const [propName, descriptor] of shared.entries(ariaReflectionPolyfillDescriptors)) {
|
|
1855
|
-
lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, descriptor);
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
else {
|
|
1859
|
-
// On the server, we cannot use createBridgeToElementDescriptor because getAttribute/setAttribute are
|
|
1860
|
-
// not supported on HTMLElement. So apply the polyfill directly on top of LightningElement
|
|
1861
|
-
shared.defineProperties(LightningElement.prototype, ariaReflectionPolyfillDescriptors);
|
|
1862
|
-
}
|
|
1863
|
-
shared.defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
|
1853
|
+
applyAriaReflection(LightningElement.prototype);
|
|
1864
1854
|
shared.defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
1865
1855
|
get() {
|
|
1866
1856
|
// If required, a runtime-specific implementation must be defined.
|
|
@@ -2710,8 +2700,7 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
|
|
|
2710
2700
|
// and can break tooling that expects it to be iterable or defined, e.g. Jest:
|
|
2711
2701
|
// https://github.com/jestjs/jest/blob/b4c9587/packages/pretty-format/src/plugins/DOMElement.ts#L95
|
|
2712
2702
|
// It also doesn't make sense to override e.g. "constructor".
|
|
2713
|
-
.filter((propName) => !(propName in HTMLElementPrototype)
|
|
2714
|
-
!(propName in ariaReflectionPolyfillDescriptors)));
|
|
2703
|
+
.filter((propName) => !(propName in HTMLElementPrototype)));
|
|
2715
2704
|
for (const propName of nonPublicPropertiesToWarnOn) {
|
|
2716
2705
|
if (shared.ArrayIndexOf.call(publicProperties, propName) === -1) {
|
|
2717
2706
|
descriptors[propName] = createAccessorThatWarns(propName);
|
|
@@ -2781,22 +2770,21 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
|
|
|
2781
2770
|
shared.defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
2782
2771
|
return HTMLBridgeElement;
|
|
2783
2772
|
}
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
//
|
|
2787
|
-
//
|
|
2788
|
-
//
|
|
2789
|
-
//
|
|
2790
|
-
//
|
|
2791
|
-
//
|
|
2792
|
-
//
|
|
2793
|
-
//
|
|
2794
|
-
//
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, basePublicProperties, [], [], null, false);
|
|
2773
|
+
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, shared.getOwnPropertyNames(HTMLElementOriginalDescriptors), [], [], null, false);
|
|
2774
|
+
if (process.env.IS_BROWSER) {
|
|
2775
|
+
// This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
|
|
2776
|
+
// so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
|
|
2777
|
+
// ARIA props outside the LightningElement
|
|
2778
|
+
//
|
|
2779
|
+
// Apply ARIA reflection to HTMLBridgeElement.prototype. This allows `elm.aria*` property accessors to work from
|
|
2780
|
+
// outside a component, and to reflect `aria-*` attrs. This is especially important because the template compiler
|
|
2781
|
+
// compiles aria-* attrs on components to aria* props.
|
|
2782
|
+
// Note this works regardless of whether the global ARIA reflection polyfill is applied or not.
|
|
2783
|
+
//
|
|
2784
|
+
// Also note that we apply this to BaseBridgeElement.prototype to avoid excessively redefining property
|
|
2785
|
+
// accessors inside the HTMLBridgeElementFactory.
|
|
2786
|
+
applyAriaReflection(BaseBridgeElement.prototype);
|
|
2787
|
+
}
|
|
2800
2788
|
shared.freeze(BaseBridgeElement);
|
|
2801
2789
|
shared.seal(BaseBridgeElement.prototype);
|
|
2802
2790
|
|
|
@@ -7371,5 +7359,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
7371
7359
|
exports.track = track;
|
|
7372
7360
|
exports.unwrap = unwrap;
|
|
7373
7361
|
exports.wire = wire;
|
|
7374
|
-
/** version: 5.0.
|
|
7362
|
+
/** version: 5.0.6 */
|
|
7375
7363
|
//# sourceMappingURL=index.cjs.js.map
|