@lwc/engine-core 5.2.1-alpha.1 → 5.2.2
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 +71 -59
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +70 -58
- package/dist/index.js.map +1 -1
- package/dist/libs/aria-reflection/aria-reflection.d.ts +1 -2
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
|
@@ -425,54 +425,53 @@ const instrumentDef = (_a = shared.globalThis.__lwc_instrument_cmp_def) !== null
|
|
|
425
425
|
const instrumentInstance = (_b = shared.globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : shared.noop;
|
|
426
426
|
|
|
427
427
|
/*
|
|
428
|
-
* Copyright (c)
|
|
428
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
429
429
|
* All rights reserved.
|
|
430
430
|
* SPDX-License-Identifier: MIT
|
|
431
431
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
432
432
|
*/
|
|
433
|
-
//
|
|
434
|
-
//
|
|
435
|
-
|
|
436
|
-
|
|
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
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
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;
|
|
465
437
|
|
|
466
438
|
/*
|
|
467
|
-
* Copyright (c)
|
|
439
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
468
440
|
* All rights reserved.
|
|
469
441
|
* SPDX-License-Identifier: MIT
|
|
470
442
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
471
443
|
*/
|
|
472
|
-
//
|
|
473
|
-
//
|
|
474
|
-
|
|
475
|
-
|
|
444
|
+
// Apply ARIA string reflection behavior to a prototype.
|
|
445
|
+
// 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 this is designed to only apply to our own
|
|
447
|
+
// LightningElement/BaseBridgeElement prototypes.
|
|
448
|
+
// Note we only need to handle ARIA reflections that aren't already in Element.prototype
|
|
449
|
+
const ariaReflectionPolyfillDescriptors = shared.create(null);
|
|
450
|
+
for (const [propName, attrName] of shared.entries(shared.AriaPropNameToAttrNameMap)) {
|
|
451
|
+
if (shared.isUndefined(shared.getPropertyDescriptor(HTMLElementPrototype, propName))) {
|
|
452
|
+
// Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
|
|
453
|
+
// from Element.prototype, because these methods are overridden in LightningElement.
|
|
454
|
+
ariaReflectionPolyfillDescriptors[propName] = {
|
|
455
|
+
get() {
|
|
456
|
+
return this.getAttribute(attrName);
|
|
457
|
+
},
|
|
458
|
+
set(newValue) {
|
|
459
|
+
// TODO [#3284]: there is disagreement between browsers and the spec on how to treat undefined
|
|
460
|
+
// Our historical behavior is to only treat null as removing the attribute
|
|
461
|
+
// See also https://github.com/w3c/aria/issues/1858
|
|
462
|
+
if (shared.isNull(newValue)) {
|
|
463
|
+
this.removeAttribute(attrName);
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
this.setAttribute(attrName, newValue);
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
// configurable and enumerable to allow it to be overridden – this mimics Safari's/Chrome's behavior
|
|
470
|
+
configurable: true,
|
|
471
|
+
enumerable: true,
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
}
|
|
476
475
|
|
|
477
476
|
/*
|
|
478
477
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1922,11 +1921,22 @@ const lightningBasedDescriptors = shared.create(null);
|
|
|
1922
1921
|
for (const propName in HTMLElementOriginalDescriptors) {
|
|
1923
1922
|
lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
|
|
1924
1923
|
}
|
|
1925
|
-
shared.defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
|
1926
1924
|
// Apply ARIA reflection to LightningElement.prototype, on both the browser and server.
|
|
1927
1925
|
// This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
|
|
1928
1926
|
// Note this works regardless of whether the global ARIA reflection polyfill is applied or not.
|
|
1929
|
-
|
|
1927
|
+
if (process.env.IS_BROWSER) {
|
|
1928
|
+
// In the browser, we use createBridgeToElementDescriptor, so we can get the normal reactivity lifecycle for
|
|
1929
|
+
// aria* properties
|
|
1930
|
+
for (const [propName, descriptor] of shared.entries(ariaReflectionPolyfillDescriptors)) {
|
|
1931
|
+
lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, descriptor);
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
else {
|
|
1935
|
+
// On the server, we cannot use createBridgeToElementDescriptor because getAttribute/setAttribute are
|
|
1936
|
+
// not supported on HTMLElement. So apply the polyfill directly on top of LightningElement
|
|
1937
|
+
shared.defineProperties(LightningElement.prototype, ariaReflectionPolyfillDescriptors);
|
|
1938
|
+
}
|
|
1939
|
+
shared.defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
|
1930
1940
|
shared.defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
1931
1941
|
get() {
|
|
1932
1942
|
// If required, a runtime-specific implementation must be defined.
|
|
@@ -2776,7 +2786,8 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
|
|
|
2776
2786
|
// and can break tooling that expects it to be iterable or defined, e.g. Jest:
|
|
2777
2787
|
// https://github.com/jestjs/jest/blob/b4c9587/packages/pretty-format/src/plugins/DOMElement.ts#L95
|
|
2778
2788
|
// It also doesn't make sense to override e.g. "constructor".
|
|
2779
|
-
.filter((propName) => !(propName in HTMLElementPrototype)
|
|
2789
|
+
.filter((propName) => !(propName in HTMLElementPrototype) &&
|
|
2790
|
+
!(propName in ariaReflectionPolyfillDescriptors)));
|
|
2780
2791
|
for (const propName of nonPublicPropertiesToWarnOn) {
|
|
2781
2792
|
if (shared.ArrayIndexOf.call(publicProperties, propName) === -1) {
|
|
2782
2793
|
descriptors[propName] = createAccessorThatWarns(propName);
|
|
@@ -2846,21 +2857,22 @@ function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observe
|
|
|
2846
2857
|
shared.defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
2847
2858
|
return HTMLBridgeElement;
|
|
2848
2859
|
}
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2860
|
+
// We do some special handling of non-standard ARIA props like ariaLabelledBy as well as props without (as of this
|
|
2861
|
+
// writing) broad cross-browser support like ariaBrailleLabel. This is so the reflection works correctly and preserves
|
|
2862
|
+
// backwards compatibility with the previous global polyfill approach.
|
|
2863
|
+
//
|
|
2864
|
+
// The goal here is to expose `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*`
|
|
2865
|
+
// attrs. This is especially important because the template compiler compiles aria-* attrs on components to aria* props.
|
|
2866
|
+
// Note this works regardless of whether the global ARIA reflection polyfill is applied or not.
|
|
2867
|
+
//
|
|
2868
|
+
// Also note this ARIA reflection only really makes sense in the browser. On the server, there is no
|
|
2869
|
+
// `renderedCallback()`, so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't
|
|
2870
|
+
// need to expose ARIA props outside the LightningElement
|
|
2871
|
+
const basePublicProperties = [
|
|
2872
|
+
...shared.getOwnPropertyNames(HTMLElementOriginalDescriptors),
|
|
2873
|
+
...(process.env.IS_BROWSER ? shared.getOwnPropertyNames(ariaReflectionPolyfillDescriptors) : []),
|
|
2874
|
+
];
|
|
2875
|
+
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, basePublicProperties, [], [], null, false);
|
|
2864
2876
|
shared.freeze(BaseBridgeElement);
|
|
2865
2877
|
shared.seal(BaseBridgeElement.prototype);
|
|
2866
2878
|
|
|
@@ -7375,11 +7387,11 @@ function readonly(obj) {
|
|
|
7375
7387
|
return getReadOnlyProxy(obj);
|
|
7376
7388
|
}
|
|
7377
7389
|
|
|
7378
|
-
Object.defineProperty(exports,
|
|
7390
|
+
Object.defineProperty(exports, "setFeatureFlag", {
|
|
7379
7391
|
enumerable: true,
|
|
7380
7392
|
get: function () { return features.setFeatureFlag; }
|
|
7381
7393
|
});
|
|
7382
|
-
Object.defineProperty(exports,
|
|
7394
|
+
Object.defineProperty(exports, "setFeatureFlagForTest", {
|
|
7383
7395
|
enumerable: true,
|
|
7384
7396
|
get: function () { return features.setFeatureFlagForTest; }
|
|
7385
7397
|
});
|
|
@@ -7418,5 +7430,5 @@ exports.swapTemplate = swapTemplate;
|
|
|
7418
7430
|
exports.track = track;
|
|
7419
7431
|
exports.unwrap = unwrap;
|
|
7420
7432
|
exports.wire = wire;
|
|
7421
|
-
/** version: 5.2.
|
|
7433
|
+
/** version: 5.2.2 */
|
|
7422
7434
|
//# sourceMappingURL=index.cjs.js.map
|