@lwrjs/everywhere 0.11.0-alpha.9 → 0.11.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.
Files changed (24) hide show
  1. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/cf4401d7a2e8460959bdccb3b614d8cc/config.js +11 -0
  2. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_0/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +14 -0
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{3_6_0/s/1f4d9d7e0920460bb4f6c08de42d5cce → 4_0_1/s/89dbc50e02634ae47c903e8bfc5a5168}/lwc.js +382 -202
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_11_0-alpha_9 → 0_11_0}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
  5. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_11_0-alpha_9 → 0_11_0}/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js +21 -21
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_11_0-alpha_9/s/a37f8d7ae754062f6d1290426c835686 → 0_11_0/s/6a2bfb1eac6ea32f0a60242bcbe498d0}/lwr_loader.js +6 -5
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_11_0-alpha_9 → 0_11_0}/s/274c8343f810353bbad085a79709395f/lwr_metrics.js +1 -1
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/0_11_0/s/f3a204ef43fb3057d910f80d7e9f9ba7/lwr_preInit.js +25 -0
  9. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_11_0-alpha_9 → 0_11_0}/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +4 -7
  10. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_11_0-alpha_9 → 0_11_0}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  11. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_11_0-alpha_9 → 0_11_0}/lwr-error-shim.js +1 -2
  12. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_11_0-alpha_9 → 0_11_0}/lwr-loader-shim.bundle.js +9 -9
  13. package/build/assets/amd/lwr-everywhere-debug.js +10 -9
  14. package/build/assets/amd/lwr-everywhere-min.js +2 -2
  15. package/build/assets/amd/lwr-everywhere.js +10 -9
  16. package/build/assets/core/lwr-everywhere-debug.js +6 -5
  17. package/build/assets/core/lwr-everywhere-min.js +1 -1
  18. package/build/assets/core/lwr-everywhere.js +6 -5
  19. package/build/assets/esm/lwr-everywhere-debug.js +1 -1
  20. package/build/assets/esm/lwr-everywhere-min.js +1 -1
  21. package/build/assets/esm/lwr-everywhere.js +1 -1
  22. package/package.json +11 -11
  23. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/3a771d2da2474611b236cb8990b06c30/config.js +0 -11
  24. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_0-alpha_9/s/625ff96e920182ae7ef5b87f02964e6c/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -18
@@ -1,4 +1,4 @@
1
- LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwc/v/4_0_1', ['exports'], (function (exports) { 'use strict';
2
2
 
3
3
  /**
4
4
  * Copyright (C) 2023 salesforce.com, inc.
@@ -162,6 +162,28 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
162
162
  } while (o !== null);
163
163
  }
164
164
 
165
+ /*
166
+ * Copyright (c) 2023, salesforce.com, inc.
167
+ * All rights reserved.
168
+ * SPDX-License-Identifier: MIT
169
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
170
+ */
171
+ // These must be updated when the enum is updated.
172
+ // It's a bit annoying to do have to do this manually, but this makes the file tree-shakeable,
173
+ // passing the `verify-treeshakeable.js` test.
174
+ const LOWEST_API_VERSION = 58 /* APIVersion.V58_244_SUMMER_23 */;
175
+ function isAPIFeatureEnabled(apiVersionFeature, apiVersion) {
176
+ switch (apiVersionFeature) {
177
+ case 0 /* APIFeature.LOWERCASE_SCOPE_TOKENS */:
178
+ case 1 /* APIFeature.TREAT_ALL_PARSE5_ERRORS_AS_ERRORS */:
179
+ return apiVersion >= 59 /* APIVersion.V59_246_WINTER_24 */;
180
+ case 2 /* APIFeature.USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS */:
181
+ case 3 /* APIFeature.DISABLE_OBJECT_REST_SPREAD_TRANSFORMATION */:
182
+ case 4 /* APIFeature.SKIP_UNNECESSARY_REGISTER_DECORATORS */:
183
+ return apiVersion >= 60 /* APIVersion.V60_248_SPRING_24 */;
184
+ }
185
+ }
186
+
165
187
  /*
166
188
  * Copyright (c) 2018, salesforce.com, inc.
167
189
  * All rights reserved.
@@ -292,9 +314,9 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
292
314
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
293
315
  */
294
316
  // Increment whenever the LWC template compiler changes
295
- const LWC_VERSION = "3.6.0";
317
+ const LWC_VERSION = "4.0.1";
296
318
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
297
- /** version: 3.6.0 */
319
+ /** version: 4.0.1 */
298
320
 
299
321
  /**
300
322
  * Copyright (C) 2023 salesforce.com, inc.
@@ -316,7 +338,6 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
316
338
  ENABLE_WIRE_SYNC_EMIT: null,
317
339
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
318
340
  ENABLE_FROZEN_TEMPLATE: null,
319
- DISABLE_ARIA_REFLECTION_POLYFILL: null,
320
341
  ENABLE_LEGACY_SCOPE_TOKENS: null
321
342
  };
322
343
  // eslint-disable-next-line no-restricted-properties
@@ -374,82 +395,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
374
395
  setFeatureFlag(name, value);
375
396
  }
376
397
  }
377
- /** version: 3.6.0 */
378
-
379
- /**
380
- * Copyright (C) 2023 salesforce.com, inc.
381
- */
382
-
383
- /*
384
- * Copyright (c) 2018, salesforce.com, inc.
385
- * All rights reserved.
386
- * SPDX-License-Identifier: MIT
387
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
388
- */
389
- function detect(propName, prototype) {
390
- return isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName));
391
- }
392
-
393
- /*
394
- * Copyright (c) 2018, salesforce.com, inc.
395
- * All rights reserved.
396
- * SPDX-License-Identifier: MIT
397
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
398
- */
399
- function createAriaPropertyPropertyDescriptor(attrName) {
400
- // Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
401
- // from Element.prototype, because these methods are overridden in LightningElement.
402
- return {
403
- get() {
404
- // reflect what's in the attribute
405
- return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
406
- },
407
- set(newValue) {
408
- // reflect into the corresponding attribute
409
- if (isNull(newValue)) {
410
- this.removeAttribute(attrName);
411
- } else {
412
- this.setAttribute(attrName, newValue);
413
- }
414
- },
415
- configurable: true,
416
- enumerable: true
417
- };
418
- }
419
- function patch$1(propName, prototype) {
420
- const attrName = AriaPropNameToAttrNameMap[propName];
421
- const descriptor = createAriaPropertyPropertyDescriptor(attrName);
422
- defineProperty(prototype, propName, descriptor);
423
- }
424
-
425
- /*
426
- * Copyright (c) 2018, salesforce.com, inc.
427
- * All rights reserved.
428
- * SPDX-License-Identifier: MIT
429
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
430
- */
431
- function applyAriaReflection(prototype = Element.prototype) {
432
- const ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
433
- for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1) {
434
- const propName = ElementPrototypeAriaPropertyNames[i];
435
- if (detect(propName, prototype)) {
436
- patch$1(propName, prototype);
437
- }
438
- }
439
- }
440
- /** version: 3.6.0 */
441
-
442
- /*
443
- * Copyright (c) 2018, salesforce.com, inc.
444
- * All rights reserved.
445
- * SPDX-License-Identifier: MIT
446
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
447
- */
448
- if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
449
- // If DISABLE_ARIA_REFLECTION_POLYFILL is false, then we need to apply the ARIA reflection polyfill globally,
450
- // i.e. to the global Element.prototype
451
- applyAriaReflection();
452
- }
398
+ /** version: 4.0.1 */
453
399
 
454
400
  /**
455
401
  * Copyright (C) 2023 salesforce.com, inc.
@@ -524,6 +470,12 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
524
470
  currentDispatcher$1(reportingEventId, payload);
525
471
  }
526
472
  }
473
+ /**
474
+ * Return true if reporting is enabled
475
+ */
476
+ function isReportingEnabled() {
477
+ return enabled$1;
478
+ }
527
479
 
528
480
  /*
529
481
  * Copyright (c) 2018, salesforce.com, inc.
@@ -818,20 +770,6 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
818
770
  }
819
771
  return list;
820
772
  }
821
- // Set a ref (lwc:ref) on a VM, from a template API
822
- function setRefVNode(vm, ref, vnode) {
823
- if (process.env.NODE_ENV !== 'production' && isUndefined$1(vm.refVNodes)) {
824
- throw new Error('refVNodes must be defined when setting a ref');
825
- }
826
- // If this method is called, then vm.refVNodes is set as the template has refs.
827
- // If not, then something went wrong and we threw an error above.
828
- const refVNodes = vm.refVNodes;
829
- // In cases of conflict (two elements with the same ref), prefer, the last one,
830
- // in depth-first traversal order.
831
- if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
832
- refVNodes[ref] = vnode;
833
- }
834
- }
835
773
  // Throw an error if we're running in prod mode. Ensures code is truly removed from prod mode.
836
774
  function assertNotProd() {
837
775
  /* istanbul ignore if */
@@ -858,6 +796,44 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
858
796
  const instrumentDef = (_a = _globalThis.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : noop;
859
797
  const instrumentInstance = (_b = _globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : noop;
860
798
 
799
+ /*
800
+ * Copyright (c) 2023, salesforce.com, inc.
801
+ * All rights reserved.
802
+ * SPDX-License-Identifier: MIT
803
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
804
+ */
805
+ // Apply ARIA string reflection behavior to a prototype.
806
+ // This is deliberately kept separate from @lwc/aria-reflection. @lwc/aria-reflection is a global polyfill that is
807
+ // needed for backwards compatibility in LEX, whereas `applyAriaReflection` is designed to only apply to our own
808
+ // LightningElement/BaseBridgeElement prototypes.
809
+ function applyAriaReflection(prototype) {
810
+ for (const propName of keys(AriaPropNameToAttrNameMap)) {
811
+ const attrName = AriaPropNameToAttrNameMap[propName];
812
+ if (isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName))) {
813
+ // Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
814
+ // from Element.prototype, because these methods are overridden in LightningElement.
815
+ defineProperty(prototype, propName, {
816
+ get() {
817
+ return this.getAttribute(attrName);
818
+ },
819
+ set(newValue) {
820
+ // TODO [#3284]: there is disagreement between browsers and the spec on how to treat undefined
821
+ // Our historical behavior is to only treat null as removing the attribute
822
+ // See also https://github.com/w3c/aria/issues/1858
823
+ if (isNull(newValue)) {
824
+ this.removeAttribute(attrName);
825
+ } else {
826
+ this.setAttribute(attrName, newValue);
827
+ }
828
+ },
829
+ // configurable and enumerable to allow it to be overridden – this mimics Safari's/Chrome's behavior
830
+ configurable: true,
831
+ enumerable: true
832
+ });
833
+ }
834
+ }
835
+ }
836
+
861
837
  /*
862
838
  * Copyright (c) 2018, salesforce.com, inc.
863
839
  * All rights reserved.
@@ -1529,7 +1505,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
1529
1505
  valueMutated(originalTarget, key);
1530
1506
  return true;
1531
1507
  }
1532
- /*LWC compiler v3.6.0*/
1508
+ /*LWC compiler v4.0.1*/
1533
1509
  }
1534
1510
  const getterMap = new WeakMap();
1535
1511
  const setterMap = new WeakMap();
@@ -1622,7 +1598,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
1622
1598
  /* istanbul ignore next */
1623
1599
  return false;
1624
1600
  }
1625
- /*LWC compiler v3.6.0*/
1601
+ /*LWC compiler v4.0.1*/
1626
1602
  }
1627
1603
  function extract(objectOrArray) {
1628
1604
  if (isArray(objectOrArray)) {
@@ -1993,12 +1969,30 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
1993
1969
  // https://html.spec.whatwg.org/multipage/custom-elements.html#form-associated-custom-elements
1994
1970
  const formAssociatedProps = new Set(['setFormValue', 'form', 'setValidity', 'willValidate', 'validity', 'validationMessage', 'checkValidity', 'reportValidity', 'labels']);
1995
1971
  // Verify that access to a form-associated property of the ElementInternals proxy has formAssociated set in the LWC.
1996
- function assertFormAssociatedPropertySet(propertyKey, isFormAssociated) {
1997
- if (formAssociatedProps.has(propertyKey) && !isFormAssociated) {
1972
+ function verifyPropForFormAssociation(propertyKey, isFormAssociated) {
1973
+ if (isString(propertyKey) && formAssociatedProps.has(propertyKey) && !isFormAssociated) {
1998
1974
  //Note this error message mirrors Chrome and Firefox error messages, in Safari the error is slightly different.
1999
1975
  throw new DOMException(`Failed to execute '${propertyKey}' on 'ElementInternals': The target element is not a form-associated custom element.`);
2000
1976
  }
2001
1977
  }
1978
+ const elementInternalsAccessorAllowList = new Set(['shadowRoot', 'role', ...formAssociatedProps]);
1979
+ // Prevent access to properties not defined in the HTML spec in case browsers decide to
1980
+ // provide new APIs that provide access to form associated properties.
1981
+ // This can be removed along with UpgradeableConstructor.
1982
+ function isAllowedElementInternalAccessor(propertyKey) {
1983
+ let isAllowedAccessor = false;
1984
+ // As of this writing all ElementInternal property keys as described in the spec are implemented with strings
1985
+ // in Chrome, Firefox, and Safari
1986
+ if (isString(propertyKey)) {
1987
+ // Allow list is based on HTML spec:
1988
+ // https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface
1989
+ isAllowedAccessor = elementInternalsAccessorAllowList.has(propertyKey) || /^aria/.test(propertyKey);
1990
+ if (!isAllowedAccessor && process.env.NODE_ENV !== 'production') {
1991
+ logWarn('Only properties defined in the ElementInternals HTML spec are available.');
1992
+ }
1993
+ }
1994
+ return isAllowedAccessor;
1995
+ }
2002
1996
  // Wrap all ElementInternal objects in a proxy to prevent form association when `formAssociated` is not set on an LWC.
2003
1997
  // This is needed because the 1UpgradeableConstructor1 always sets `formAssociated=true`, which means all
2004
1998
  // ElementInternal objects will have form-associated properties set when an LWC is placed in a form.
@@ -2007,17 +2001,28 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
2007
2001
  function createElementInternalsProxy(elementInternals, isFormAssociated) {
2008
2002
  const elementInternalsProxy = new Proxy(elementInternals, {
2009
2003
  set(target, propertyKey, newValue) {
2010
- // ElementInternals implementation uses strings as property keys exclusively in chrome, firefox, and safari
2011
- assertFormAssociatedPropertySet(propertyKey, isFormAssociated);
2012
- return Reflect.set(target, propertyKey, newValue);
2004
+ if (isAllowedElementInternalAccessor(propertyKey)) {
2005
+ // Verify that formAssociated is set for form associated properties
2006
+ verifyPropForFormAssociation(propertyKey, isFormAssociated);
2007
+ return Reflect.set(target, propertyKey, newValue);
2008
+ }
2009
+ // As of this writing ElementInternals do not have non-string properties that can be set.
2010
+ return false;
2013
2011
  },
2014
2012
  get(target, propertyKey) {
2015
- // ElementInternals implementation uses strings as property keys exclusively in chrome, firefox, and safari
2016
- assertFormAssociatedPropertySet(propertyKey, isFormAssociated);
2017
- const internalsPropertyValue = Reflect.get(target, propertyKey);
2018
- // Bind the property value to the target so that function invocations are called with the
2019
- // correct context ('this' value).
2020
- return typeof internalsPropertyValue === 'function' ? internalsPropertyValue.bind(target) : internalsPropertyValue;
2013
+ if (
2014
+ // Pass through Object.prototype methods such as toString()
2015
+ hasOwnProperty$1.call(Object.prototype, propertyKey) ||
2016
+ // As of this writing, ElementInternals only uses Symbol.toStringTag which is called
2017
+ // on Object.hasOwnProperty invocations
2018
+ Symbol.for('Symbol.toStringTag') === propertyKey ||
2019
+ // ElementInternals allow listed properties
2020
+ isAllowedElementInternalAccessor(propertyKey)) {
2021
+ // Verify that formAssociated is set for form associated properties
2022
+ verifyPropForFormAssociation(propertyKey, isFormAssociated);
2023
+ const propertyValue = Reflect.get(target, propertyKey);
2024
+ return isFunction$1(propertyValue) ? propertyValue.bind(target) : propertyValue;
2025
+ }
2021
2026
  }
2022
2027
  });
2023
2028
  return elementInternalsProxy;
@@ -2384,15 +2389,10 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
2384
2389
  lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
2385
2390
  }
2386
2391
  defineProperties(LightningElement.prototype, lightningBasedDescriptors);
2387
- function applyAriaReflectionToLightningElement() {
2388
- // If ARIA reflection is not applied globally to Element.prototype, or if we are running server-side,
2389
- // apply it to LightningElement.prototype.
2390
- // This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
2391
- applyAriaReflection(LightningElement.prototype);
2392
- }
2393
- if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
2394
- applyAriaReflectionToLightningElement();
2395
- }
2392
+ // Apply ARIA reflection to LightningElement.prototype, on both the browser and server.
2393
+ // This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
2394
+ // Note this works regardless of whether the global ARIA reflection polyfill is applied or not.
2395
+ applyAriaReflection(LightningElement.prototype);
2396
2396
  defineProperty(LightningElement, 'CustomElementConstructor', {
2397
2397
  get() {
2398
2398
  // If required, a runtime-specific implementation must be defined.
@@ -3275,7 +3275,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
3275
3275
  }
3276
3276
  function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto, hasCustomSuperClass) {
3277
3277
  const HTMLBridgeElement = class extends SuperClass {
3278
- /*LWC compiler v3.6.0*/
3278
+ /*LWC compiler v4.0.1*/
3279
3279
  };
3280
3280
  // generating the hash table for attributes to avoid duplicate fields and facilitate validation
3281
3281
  // and false positives in case of inheritance.
@@ -3375,15 +3375,15 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
3375
3375
  // This ARIA reflection only really makes sense in the browser. On the server, there is no `renderedCallback()`,
3376
3376
  // so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't need to expose
3377
3377
  // ARIA props outside the LightningElement
3378
- if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
3379
- // If ARIA reflection is not applied globally to Element.prototype, apply it to HTMLBridgeElement.prototype.
3380
- // This allows `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*` attrs.
3381
- // This is especially important because the template compiler compiles aria-* attrs on components to aria* props
3382
- //
3383
- // Also note that we apply this to BaseBridgeElement.prototype to avoid excessively redefining property
3384
- // accessors inside the HTMLBridgeElementFactory.
3385
- applyAriaReflection(BaseBridgeElement.prototype);
3386
- }
3378
+ //
3379
+ // Apply ARIA reflection to HTMLBridgeElement.prototype. This allows `elm.aria*` property accessors to work from
3380
+ // outside a component, and to reflect `aria-*` attrs. This is especially important because the template compiler
3381
+ // compiles aria-* attrs on components to aria* props.
3382
+ // Note this works regardless of whether the global ARIA reflection polyfill is applied or not.
3383
+ //
3384
+ // Also note that we apply this to BaseBridgeElement.prototype to avoid excessively redefining property
3385
+ // accessors inside the HTMLBridgeElementFactory.
3386
+ applyAriaReflection(BaseBridgeElement.prototype);
3387
3387
  }
3388
3388
  freeze(BaseBridgeElement);
3389
3389
  seal(BaseBridgeElement.prototype);
@@ -4445,6 +4445,118 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
4445
4445
  }
4446
4446
  }
4447
4447
 
4448
+ /*
4449
+ * Copyright (c) 2023, salesforce.com, inc.
4450
+ * All rights reserved.
4451
+ * SPDX-License-Identifier: MIT
4452
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4453
+ */
4454
+ // Set a ref (lwc:ref) on a VM, from a template API
4455
+ function applyRefs(vnode, owner) {
4456
+ const {
4457
+ data
4458
+ } = vnode;
4459
+ const {
4460
+ ref
4461
+ } = data;
4462
+ if (isUndefined$1(ref)) {
4463
+ return;
4464
+ }
4465
+ if (process.env.NODE_ENV !== 'production' && isUndefined$1(owner.refVNodes)) {
4466
+ throw new Error('refVNodes must be defined when setting a ref');
4467
+ }
4468
+ // If this method is called, then vm.refVNodes is set as the template has refs.
4469
+ // If not, then something went wrong and we threw an error above.
4470
+ const refVNodes = owner.refVNodes;
4471
+ // In cases of conflict (two elements with the same ref), prefer the last one,
4472
+ // in depth-first traversal order. This happens automatically due to how we render
4473
+ refVNodes[ref] = vnode;
4474
+ }
4475
+
4476
+ /*
4477
+ * Copyright (c) 2023, salesforce.com, inc.
4478
+ * All rights reserved.
4479
+ * SPDX-License-Identifier: MIT
4480
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4481
+ */
4482
+ function traverseAndSetElements(root, parts, renderer) {
4483
+ const numParts = parts.length;
4484
+ // Optimization given that, in most cases, there will be one part, and it's just the root
4485
+ if (numParts === 1) {
4486
+ const firstPart = parts[0];
4487
+ if (firstPart.partId === 0) {
4488
+ // 0 means the root node
4489
+ firstPart.elm = root;
4490
+ return;
4491
+ }
4492
+ }
4493
+ const partIdsToParts = new Map();
4494
+ for (const staticPart of parts) {
4495
+ partIdsToParts.set(staticPart.partId, staticPart);
4496
+ }
4497
+ let numFoundParts = 0;
4498
+ const {
4499
+ previousSibling,
4500
+ getLastChild
4501
+ } = renderer;
4502
+ const stack = [root];
4503
+ let partId = -1;
4504
+ // Depth-first traversal. We assign a partId to each element, which is an integer based on traversal order.
4505
+ while (stack.length > 0) {
4506
+ const elm = ArrayShift.call(stack);
4507
+ partId++;
4508
+ const part = partIdsToParts.get(partId);
4509
+ if (!isUndefined$1(part)) {
4510
+ part.elm = elm;
4511
+ if (++numFoundParts === numParts) {
4512
+ return; // perf optimization - stop traversing once we've found everything we need
4513
+ }
4514
+ }
4515
+ // For depth-first traversal, prepend to the stack in reverse order
4516
+ // Note that we traverse using `*Child`/`*Sibling` rather than `children` because the browser uses a linked
4517
+ // list under the hood to represent the DOM tree, so it's faster to do this than to create an underlying array
4518
+ // by calling `children`.
4519
+ let child = getLastChild(elm);
4520
+ while (!isNull(child)) {
4521
+ ArrayUnshift.call(stack, child);
4522
+ child = previousSibling(child);
4523
+ }
4524
+ }
4525
+ if (process.env.NODE_ENV !== 'production') {
4526
+ assert.isTrue(numFoundParts === numParts, `Should have found all parts by now. Found ${numFoundParts}, needed ${numParts}.`);
4527
+ }
4528
+ }
4529
+ /**
4530
+ * Given an array of static parts, do all the mounting required for these parts.
4531
+ *
4532
+ * @param root - the root element
4533
+ * @param vnode - the parent VStatic
4534
+ * @param renderer - the renderer to use
4535
+ * @param mount - true this is a first (mount) render as opposed to a subsequent (patch) render
4536
+ */
4537
+ function applyStaticParts(root, vnode, renderer, mount) {
4538
+ const {
4539
+ parts,
4540
+ owner
4541
+ } = vnode;
4542
+ if (isUndefined$1(parts)) {
4543
+ return;
4544
+ }
4545
+ // This adds `part.elm` to each `part`. We have to do this on every mount/patch because the `parts`
4546
+ // array is recreated from scratch every time, so each `part.elm` is now undefined.
4547
+ // TODO [#3800]: avoid calling traverseAndSetElements on every re-render
4548
+ traverseAndSetElements(root, parts, renderer);
4549
+ // Currently only event listeners and refs are supported for static vnodes
4550
+ for (const part of parts) {
4551
+ if (mount) {
4552
+ // Event listeners only need to be applied once when mounting
4553
+ applyEventListeners(part, renderer);
4554
+ }
4555
+ // Refs must be updated after every render due to refVNodes getting reset before every render
4556
+ applyRefs(part, owner);
4557
+ }
4558
+ }
4559
+
4448
4560
  /*
4449
4561
  * Copyright (c) 2018, salesforce.com, inc.
4450
4562
  * All rights reserved.
@@ -4489,7 +4601,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
4489
4601
  patchComment(n1, n2, renderer);
4490
4602
  break;
4491
4603
  case 4 /* VNodeType.Static */:
4492
- n2.elm = n1.elm;
4604
+ patchStatic(n1, n2, renderer);
4493
4605
  break;
4494
4606
  case 5 /* VNodeType.Fragment */:
4495
4607
  patchFragment(n1, n2, parent, renderer);
@@ -4603,13 +4715,18 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
4603
4715
  applyStyleScoping(elm, owner, renderer);
4604
4716
  applyDomManual(elm, vnode);
4605
4717
  applyElementRestrictions(elm, vnode);
4606
- patchElementPropsAndAttrs$1(null, vnode, renderer);
4718
+ patchElementPropsAndAttrsAndRefs$1(null, vnode, renderer);
4607
4719
  insertNode(elm, parent, anchor, renderer);
4608
4720
  mountVNodes(vnode.children, elm, renderer, null);
4609
4721
  }
4722
+ function patchStatic(n1, n2, renderer) {
4723
+ const elm = n2.elm = n1.elm;
4724
+ // The `refs` object is blown away in every re-render, so we always need to re-apply them
4725
+ applyStaticParts(elm, n2, renderer, false);
4726
+ }
4610
4727
  function patchElement(n1, n2, renderer) {
4611
4728
  const elm = n2.elm = n1.elm;
4612
- patchElementPropsAndAttrs$1(n1, n2, renderer);
4729
+ patchElementPropsAndAttrsAndRefs$1(n1, n2, renderer);
4613
4730
  patchChildren(n1.children, n2.children, elm, renderer);
4614
4731
  }
4615
4732
  function mountStatic(vnode, parent, anchor, renderer) {
@@ -4634,8 +4751,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
4634
4751
  }
4635
4752
  }
4636
4753
  insertNode(elm, parent, anchor, renderer);
4637
- // Event listeners are only applied once when mounting, so they are allowed for static vnodes
4638
- applyEventListeners(vnode, renderer);
4754
+ applyStaticParts(elm, vnode, renderer, true);
4639
4755
  }
4640
4756
  function mountCustomElement(vnode, parent, anchor, renderer) {
4641
4757
  const {
@@ -4695,7 +4811,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
4695
4811
  if (vm) {
4696
4812
  allocateChildren(vnode, vm);
4697
4813
  }
4698
- patchElementPropsAndAttrs$1(null, vnode, renderer);
4814
+ patchElementPropsAndAttrsAndRefs$1(null, vnode, renderer);
4699
4815
  insertNode(elm, parent, anchor, renderer);
4700
4816
  if (vm) {
4701
4817
  {
@@ -4726,7 +4842,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
4726
4842
  // Otherwise patch the existing component with new props/attrs/etc.
4727
4843
  const elm = n2.elm = n1.elm;
4728
4844
  const vm = n2.vm = n1.vm;
4729
- patchElementPropsAndAttrs$1(n1, n2, renderer);
4845
+ patchElementPropsAndAttrsAndRefs$1(n1, n2, renderer);
4730
4846
  if (!isUndefined$1(vm)) {
4731
4847
  // in fallback mode, the allocation will always set children to
4732
4848
  // empty and delegate the real allocation to the slot elements
@@ -4891,7 +5007,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
4891
5007
  lockDomMutation();
4892
5008
  }
4893
5009
  }
4894
- function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
5010
+ function patchElementPropsAndAttrsAndRefs$1(oldVnode, vnode, renderer) {
4895
5011
  if (isNull(oldVnode)) {
4896
5012
  applyEventListeners(vnode, renderer);
4897
5013
  applyStaticClassAttribute(vnode, renderer);
@@ -4903,6 +5019,8 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
4903
5019
  patchStyleAttribute(oldVnode, vnode, renderer);
4904
5020
  patchAttributes(oldVnode, vnode, renderer);
4905
5021
  patchProps(oldVnode, vnode, renderer);
5022
+ // The `refs` object is blown away in every re-render, so we always need to re-apply them
5023
+ applyRefs(vnode, vnode.owner);
4906
5024
  }
4907
5025
  function applyStyleScoping(elm, owner, renderer) {
4908
5026
  const {
@@ -5310,6 +5428,14 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
5310
5428
  function addVNodeToChildLWC(vnode) {
5311
5429
  ArrayPush$1.call(getVMBeingRendered().velements, vnode);
5312
5430
  }
5431
+ // [s]tatic [p]art
5432
+ function sp(partId, data) {
5433
+ return {
5434
+ partId,
5435
+ data,
5436
+ elm: undefined // elm is defined later
5437
+ };
5438
+ }
5313
5439
  // [s]coped [s]lot [f]actory
5314
5440
  function ssf(slotName, factory) {
5315
5441
  return {
@@ -5323,7 +5449,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
5323
5449
  };
5324
5450
  }
5325
5451
  // [st]atic node
5326
- function st(fragment, key, data) {
5452
+ function st(fragment, key, parts) {
5327
5453
  const owner = getVMBeingRendered();
5328
5454
  const vnode = {
5329
5455
  type: 4 /* VNodeType.Static */,
@@ -5332,12 +5458,8 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
5332
5458
  elm: undefined,
5333
5459
  fragment,
5334
5460
  owner,
5335
- data
5461
+ parts
5336
5462
  };
5337
- const ref = data === null || data === void 0 ? void 0 : data.ref;
5338
- if (!isUndefined$1(ref)) {
5339
- setRefVNode(owner, ref, vnode);
5340
- }
5341
5463
  return vnode;
5342
5464
  }
5343
5465
  // [fr]agment node
@@ -5377,8 +5499,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
5377
5499
  });
5378
5500
  }
5379
5501
  const {
5380
- key,
5381
- ref
5502
+ key
5382
5503
  } = data;
5383
5504
  const vnode = {
5384
5505
  type: 2 /* VNodeType.Element */,
@@ -5389,9 +5510,6 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
5389
5510
  key,
5390
5511
  owner: vmBeingRendered
5391
5512
  };
5392
- if (!isUndefined$1(ref)) {
5393
- setRefVNode(vmBeingRendered, ref, vnode);
5394
- }
5395
5513
  return vnode;
5396
5514
  }
5397
5515
  // [t]ab[i]ndex function
@@ -5463,11 +5581,17 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
5463
5581
  const vmBeingRendered = getVMBeingRendered();
5464
5582
  const {
5465
5583
  renderMode,
5466
- shadowMode
5584
+ shadowMode,
5585
+ apiVersion
5467
5586
  } = vmBeingRendered;
5468
5587
  if (renderMode === 0 /* RenderMode.Light */) {
5469
- sc(children);
5470
- return children;
5588
+ // light DOM slots - backwards-compatible behavior uses flattening, new behavior uses fragments
5589
+ if (isAPIFeatureEnabled(2 /* APIFeature.USE_FRAGMENTS_FOR_LIGHT_DOM_SLOTS */, apiVersion)) {
5590
+ return fr(data.key, children, 0);
5591
+ } else {
5592
+ sc(children);
5593
+ return children;
5594
+ }
5471
5595
  }
5472
5596
  if (shadowMode === 1 /* ShadowMode.Synthetic */) {
5473
5597
  // TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic
@@ -5498,8 +5622,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
5498
5622
  }
5499
5623
  }
5500
5624
  const {
5501
- key,
5502
- ref
5625
+ key
5503
5626
  } = data;
5504
5627
  let elm, aChildren, vm;
5505
5628
  const vnode = {
@@ -5516,9 +5639,6 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
5516
5639
  vm
5517
5640
  };
5518
5641
  addVNodeToChildLWC(vnode);
5519
- if (!isUndefined$1(ref)) {
5520
- setRefVNode(vmBeingRendered, ref, vnode);
5521
- }
5522
5642
  return vnode;
5523
5643
  }
5524
5644
  // [i]terable node
@@ -5816,7 +5936,8 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
5816
5936
  fid,
5817
5937
  shc,
5818
5938
  ssf,
5819
- ddc
5939
+ ddc,
5940
+ sp
5820
5941
  });
5821
5942
 
5822
5943
  /*
@@ -6097,8 +6218,6 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
6097
6218
  // add the VM to the list of host VMs that can be re-rendered if html is swapped
6098
6219
  setActiveVM(vm);
6099
6220
  }
6100
- // reset the refs; they will be set during the tmpl() instantiation
6101
- vm.refVNodes = html.hasRefs ? create(null) : null;
6102
6221
  // right before producing the vnodes, we clear up all internal references
6103
6222
  // to custom elements from the template.
6104
6223
  vm.velements = [];
@@ -6280,6 +6399,17 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
6280
6399
  var _a;
6281
6400
  return (_a = registeredComponentMap.get(Ctor)) === null || _a === void 0 ? void 0 : _a.sel;
6282
6401
  }
6402
+ function getComponentAPIVersion(Ctor) {
6403
+ const metadata = registeredComponentMap.get(Ctor);
6404
+ const apiVersion = metadata === null || metadata === void 0 ? void 0 : metadata.apiVersion;
6405
+ if (isUndefined$1(apiVersion)) {
6406
+ // This should only occur in our Karma tests; in practice every component
6407
+ // is registered, and so this code path should not get hit. But to be safe,
6408
+ // return the lowest possible version.
6409
+ return LOWEST_API_VERSION;
6410
+ }
6411
+ return apiVersion;
6412
+ }
6283
6413
  function getTemplateReactiveObserver(vm) {
6284
6414
  return createReactiveObserver(() => {
6285
6415
  const {
@@ -6413,6 +6543,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
6413
6543
  hydrated
6414
6544
  } = options;
6415
6545
  const def = getComponentInternalDef(ctor);
6546
+ const apiVersion = getComponentAPIVersion(ctor);
6416
6547
  const vm = {
6417
6548
  elm,
6418
6549
  def,
@@ -6459,7 +6590,8 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
6459
6590
  callHook,
6460
6591
  setHook,
6461
6592
  getHook,
6462
- renderer
6593
+ renderer,
6594
+ apiVersion
6463
6595
  };
6464
6596
  if (process.env.NODE_ENV !== 'production') {
6465
6597
  vm.debugInfo = create(null);
@@ -6623,6 +6755,8 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
6623
6755
  children: oldCh,
6624
6756
  renderer
6625
6757
  } = vm;
6758
+ // reset the refs; they will be set during `patchChildren`
6759
+ resetRefVNodes(vm);
6626
6760
  // caching the new children collection
6627
6761
  vm.children = newCh;
6628
6762
  if (newCh.length > 0 || oldCh.length > 0) {
@@ -6712,6 +6846,18 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
6712
6846
  invokeComponentCallback(vm, connectedCallback);
6713
6847
  logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
6714
6848
  }
6849
+ // This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
6850
+ // we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
6851
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE && (process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
6852
+ if (!vm.renderer.isConnected(vm.elm)) {
6853
+ if (process.env.NODE_ENV !== 'production') {
6854
+ logWarnOnce(`Element <${vm.tagName}> ` + `fired a \`connectedCallback\` and rendered, but was not connected to the DOM. ` + `Please ensure all components are actually connected to the DOM, e.g. using ` + `\`document.body.appendChild(element)\`. This will not be supported in future versions of ` + `LWC and could cause component errors. For details, see: https://sfdc.co/synthetic-lifecycle`);
6855
+ }
6856
+ report("ConnectedCallbackWhileDisconnected" /* ReportingEventId.ConnectedCallbackWhileDisconnected */, {
6857
+ tagName: vm.tagName
6858
+ });
6859
+ }
6860
+ }
6715
6861
  }
6716
6862
  function hasWireAdapters(vm) {
6717
6863
  return getOwnPropertyNames$1(vm.def.wire).length > 0;
@@ -6863,6 +7009,11 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
6863
7009
  if (!isUndefined$1(error)) {
6864
7010
  addErrorComponentStack(vm, error);
6865
7011
  const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
7012
+ // Error boundaries are not in effect when server-side rendering. `errorCallback`
7013
+ // is intended to allow recovery from errors - changing the state of a component
7014
+ // and instigating a re-render. That is at odds with the single-pass, synchronous
7015
+ // nature of SSR. For that reason, all errors bubble up to the `renderComponent`
7016
+ // call site.
6866
7017
  if (isUndefined$1(errorBoundaryVm)) {
6867
7018
  throw error; // eslint-disable-line no-unsafe-finally
6868
7019
  }
@@ -6948,6 +7099,12 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
6948
7099
  runFormAssociatedCustomElementCallback(vm, formStateRestoreCallback);
6949
7100
  }
6950
7101
  }
7102
+ function resetRefVNodes(vm) {
7103
+ const {
7104
+ cmpTemplate
7105
+ } = vm;
7106
+ vm.refVNodes = !isNull(cmpTemplate) && cmpTemplate.hasRefs ? create(null) : null;
7107
+ }
6951
7108
 
6952
7109
  /*
6953
7110
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7115,10 +7272,11 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7115
7272
  //
7116
7273
  // See the README for @lwc/aria-reflection
7117
7274
  const NON_STANDARD_ARIA_PROPS = ['ariaActiveDescendant', 'ariaControls', 'ariaDescribedBy', 'ariaDetails', 'ariaErrorMessage', 'ariaFlowTo', 'ariaLabelledBy', 'ariaOwns'];
7118
- function isLightningElement(elm) {
7119
- // The former case is for `this.prop` (inside component) and the latter is for `element.prop` (outside component).
7120
- // In both cases, we apply the non-standard prop even when the global polyfill is disabled, so this is kosher.
7121
- return elm instanceof LightningElement || elm instanceof BaseBridgeElement;
7275
+ function isGlobalAriaPolyfillLoaded() {
7276
+ // Sniff for the legacy polyfill being loaded. The reason this works is because ariaActiveDescendant is a
7277
+ // non-standard ARIA property reflection that is only supported in our legacy polyfill. See
7278
+ // @lwc/aria-reflection/README.md for details.
7279
+ return !isUndefined$1(getOwnPropertyDescriptor$1(Element.prototype, 'ariaActiveDescendant'));
7122
7280
  }
7123
7281
  function findVM(elm) {
7124
7282
  // If it's a shadow DOM component, then it has a host
@@ -7132,7 +7290,8 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7132
7290
  // Else it might be a light DOM component. Walk up the tree trying to find the owner
7133
7291
  let parentElement = elm;
7134
7292
  while (!isNull(parentElement = parentElement.parentElement)) {
7135
- if (isLightningElement(parentElement)) {
7293
+ if (parentElement instanceof BaseBridgeElement) {
7294
+ // parentElement is an LWC component
7136
7295
  const vm = getAssociatedVMIfPresent(parentElement);
7137
7296
  if (!isUndefined$1(vm)) {
7138
7297
  return vm;
@@ -7143,25 +7302,23 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7143
7302
  }
7144
7303
 
7145
7304
  function checkAndReportViolation(elm, prop, isSetter, setValue) {
7146
- if (!isLightningElement(elm)) {
7147
- const vm = findVM(elm);
7148
- if (process.env.NODE_ENV !== 'production') {
7149
- logWarnOnce(`Element <${elm.tagName.toLowerCase()}> ` + (isUndefined$1(vm) ? '' : `owned by <${vm.elm.tagName.toLowerCase()}> `) + `uses non-standard property "${prop}". This will be removed in a future version of LWC. ` + `See https://sfdc.co/deprecated-aria`);
7150
- }
7151
- let setValueType;
7152
- if (isSetter) {
7153
- // `typeof null` is "object" which is not very useful for detecting null.
7154
- // We mostly want to know null vs undefined vs other types here, due to
7155
- // https://github.com/salesforce/lwc/issues/3284
7156
- setValueType = isNull(setValue) ? 'null' : typeof setValue;
7157
- }
7158
- report("NonStandardAriaReflection" /* ReportingEventId.NonStandardAriaReflection */, {
7159
- tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
7160
- propertyName: prop,
7161
- isSetter,
7162
- setValueType
7163
- });
7164
- }
7305
+ const vm = findVM(elm);
7306
+ if (process.env.NODE_ENV !== 'production') {
7307
+ logWarnOnce(`Element <${elm.tagName.toLowerCase()}> ` + (isUndefined$1(vm) ? '' : `owned by <${vm.elm.tagName.toLowerCase()}> `) + `uses non-standard property "${prop}". This will be removed in a future version of LWC. ` + `See https://sfdc.co/deprecated-aria`);
7308
+ }
7309
+ let setValueType;
7310
+ if (isSetter) {
7311
+ // `typeof null` is "object" which is not very useful for detecting null.
7312
+ // We mostly want to know null vs undefined vs other types here, due to
7313
+ // https://github.com/salesforce/lwc/issues/3284
7314
+ setValueType = isNull(setValue) ? 'null' : typeof setValue;
7315
+ }
7316
+ report("NonStandardAriaReflection" /* ReportingEventId.NonStandardAriaReflection */, {
7317
+ tagName: vm === null || vm === void 0 ? void 0 : vm.tagName,
7318
+ propertyName: prop,
7319
+ isSetter,
7320
+ setValueType
7321
+ });
7165
7322
  }
7166
7323
  function enableDetection() {
7167
7324
  const {
@@ -7183,6 +7340,9 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7183
7340
  get,
7184
7341
  set
7185
7342
  } = descriptor;
7343
+ // It's important for this defineProperty call to happen _after_ ARIA accessors are applied to the
7344
+ // BaseBridgeElement and LightningElement prototypes. Otherwise, we will log/report for access of non-standard
7345
+ // props on these prototypes, which we actually don't want. We only care about access on generic HTMLElements.
7186
7346
  defineProperty(prototype, prop, {
7187
7347
  get() {
7188
7348
  checkAndReportViolation(this, prop, false, undefined);
@@ -7198,15 +7358,13 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7198
7358
  }
7199
7359
  }
7200
7360
  // No point in running this code if we're not in a browser, or if the global polyfill is not loaded
7201
- {
7202
- if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
7203
- // Always run detection in dev mode, so we can at least print to the console
7204
- if (process.env.NODE_ENV !== 'production') {
7205
- enableDetection();
7206
- } else {
7207
- // In prod mode, only enable detection if reporting is enabled
7208
- onReportingEnabled(enableDetection);
7209
- }
7361
+ if (isGlobalAriaPolyfillLoaded()) {
7362
+ // Always run detection in dev mode, so we can at least print to the console
7363
+ if (process.env.NODE_ENV !== 'production') {
7364
+ enableDetection();
7365
+ } else {
7366
+ // In prod mode, only enable detection if reporting is enabled
7367
+ onReportingEnabled(enableDetection);
7210
7368
  }
7211
7369
  }
7212
7370
 
@@ -7229,6 +7387,8 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7229
7387
  function hydrateVM(vm) {
7230
7388
  const children = renderComponent(vm);
7231
7389
  vm.children = children;
7390
+ // reset the refs; they will be set during `hydrateChildren`
7391
+ resetRefVNodes(vm);
7232
7392
  const {
7233
7393
  renderRoot: parentNode,
7234
7394
  renderer: {
@@ -7349,7 +7509,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7349
7509
  return handleMismatch(elm, vnode, renderer);
7350
7510
  }
7351
7511
  vnode.elm = elm;
7352
- applyEventListeners(vnode, renderer);
7512
+ applyStaticParts(elm, vnode, renderer, true);
7353
7513
  return elm;
7354
7514
  }
7355
7515
  function hydrateFragment(elm, vnode, renderer) {
@@ -7396,7 +7556,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7396
7556
  }
7397
7557
  }
7398
7558
  }
7399
- patchElementPropsAndAttrs(vnode, renderer);
7559
+ patchElementPropsAndAttrsAndRefs(vnode, renderer);
7400
7560
  if (!isDomManual) {
7401
7561
  const {
7402
7562
  getFirstChild
@@ -7428,6 +7588,11 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7428
7588
  ctor,
7429
7589
  owner
7430
7590
  } = vnode;
7591
+ const {
7592
+ defineCustomElement,
7593
+ getTagName
7594
+ } = renderer;
7595
+ defineCustomElement(StringToLowerCase.call(getTagName(elm)));
7431
7596
  const vm = createVM(elm, ctor, renderer, {
7432
7597
  mode,
7433
7598
  owner,
@@ -7437,7 +7602,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7437
7602
  vnode.elm = elm;
7438
7603
  vnode.vm = vm;
7439
7604
  allocateChildren(vnode, vm);
7440
- patchElementPropsAndAttrs(vnode, renderer);
7605
+ patchElementPropsAndAttrsAndRefs(vnode, renderer);
7441
7606
  // Insert hook section:
7442
7607
  if (process.env.NODE_ENV !== 'production') {
7443
7608
  assert.isTrue(vm.state === 0 /* VMState.created */, `${vm} cannot be recycled.`);
@@ -7509,9 +7674,11 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
7509
7674
  removeNode(node, parentNode, renderer);
7510
7675
  return vnode.elm;
7511
7676
  }
7512
- function patchElementPropsAndAttrs(vnode, renderer) {
7677
+ function patchElementPropsAndAttrsAndRefs(vnode, renderer) {
7513
7678
  applyEventListeners(vnode, renderer);
7514
7679
  patchProps(null, vnode, renderer);
7680
+ // The `refs` object is blown away in every re-render, so we always need to re-apply them
7681
+ applyRefs(vnode, vnode.owner);
7515
7682
  }
7516
7683
  function hasCorrectNodeType(vnode, node, nodeType, renderer) {
7517
7684
  const {
@@ -8004,7 +8171,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8004
8171
  }
8005
8172
  return getReadOnlyProxy(obj);
8006
8173
  }
8007
- /** version: 3.6.0 */
8174
+ /** version: 4.0.1 */
8008
8175
 
8009
8176
  /*
8010
8177
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8286,7 +8453,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8286
8453
  formStateRestoreCallback(this);
8287
8454
  }
8288
8455
  }
8289
- /*LWC compiler v3.6.0*/
8456
+ /*LWC compiler v4.0.1*/
8290
8457
  }
8291
8458
  UpgradableConstructor.formAssociated = true;
8292
8459
  // Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
@@ -8307,8 +8474,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8307
8474
  }
8308
8475
  return UpgradableConstructor;
8309
8476
  };
8310
- const createCustomElement = (tagName, upgradeCallback, connectedCallback, disconnectedCallback, formAssociatedCallback, formDisabledCallback, formResetCallback, formStateRestoreCallback) => {
8311
- // use global custom elements registry
8477
+ function getUpgradableConstructor(tagName, connectedCallback, disconnectedCallback) {
8312
8478
  let UpgradableConstructor = cachedConstructors.get(tagName);
8313
8479
  if (isUndefined$1(UpgradableConstructor)) {
8314
8480
  if (!isUndefined$1(customElements.get(tagName))) {
@@ -8318,6 +8484,10 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8318
8484
  customElements.define(tagName, UpgradableConstructor);
8319
8485
  cachedConstructors.set(tagName, UpgradableConstructor);
8320
8486
  }
8487
+ return UpgradableConstructor;
8488
+ }
8489
+ const createCustomElement = (tagName, upgradeCallback, connectedCallback, disconnectedCallback, formAssociatedCallback, formDisabledCallback, formResetCallback, formStateRestoreCallback) => {
8490
+ const UpgradableConstructor = getUpgradableConstructor(tagName, connectedCallback, disconnectedCallback);
8321
8491
  formAssociatedCallbackToUse = formAssociatedCallback;
8322
8492
  formDisabledCallbackToUse = formDisabledCallback;
8323
8493
  formResetCallbackToUse = formResetCallback;
@@ -8392,7 +8562,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8392
8562
  function isNull(obj) {
8393
8563
  return obj === null;
8394
8564
  }
8395
- /** version: 3.6.0 */
8565
+ /** version: 4.0.1 */
8396
8566
 
8397
8567
  /*
8398
8568
  * Copyright (c) 2023, salesforce.com, inc.
@@ -8412,7 +8582,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8412
8582
  this.setNewContext = setNewContext;
8413
8583
  this.setDisconnectedCallback = setDisconnectedCallback;
8414
8584
  }
8415
- /*LWC compiler v3.6.0*/
8585
+ /*LWC compiler v4.0.1*/
8416
8586
  }
8417
8587
  function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
8418
8588
  dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
@@ -8464,6 +8634,9 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8464
8634
  function nextSibling(node) {
8465
8635
  return node.nextSibling;
8466
8636
  }
8637
+ function previousSibling(node) {
8638
+ return node.previousSibling;
8639
+ }
8467
8640
  function attachShadow(element, options) {
8468
8641
  // `shadowRoot` will be non-null in two cases:
8469
8642
  // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
@@ -8594,6 +8767,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8594
8767
  exports.isConnected = isConnected;
8595
8768
  exports.nextSibling = nextSibling;
8596
8769
  exports.ownerDocument = ownerDocument;
8770
+ exports.previousSibling = previousSibling;
8597
8771
  exports.querySelector = querySelector;
8598
8772
  exports.querySelectorAll = querySelectorAll;
8599
8773
  exports.registerContextConsumer = registerContextConsumer;
@@ -8632,6 +8806,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8632
8806
  insertStylesheet,
8633
8807
  // relies on a shared global cache
8634
8808
  createCustomElement,
8809
+ defineCustomElement: getUpgradableConstructor,
8635
8810
  isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
8636
8811
  });
8637
8812
 
@@ -8682,6 +8857,11 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8682
8857
  return;
8683
8858
  }
8684
8859
  try {
8860
+ const {
8861
+ defineCustomElement,
8862
+ getTagName
8863
+ } = renderer;
8864
+ defineCustomElement(StringToLowerCase.call(getTagName(element)));
8685
8865
  const vm = createVMWithProps(element, Ctor, props);
8686
8866
  hydrateRoot(vm);
8687
8867
  } catch (e) {
@@ -8782,7 +8962,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
8782
8962
  attributeChangedCallback(name, oldValue, newValue) {
8783
8963
  attributeChangedCallback.call(this, name, oldValue, newValue);
8784
8964
  }
8785
- /*LWC compiler v3.6.0*/
8965
+ /*LWC compiler v4.0.1*/
8786
8966
  }, _a.observedAttributes = observedAttributes, _a;
8787
8967
  }
8788
8968
 
@@ -9012,7 +9192,7 @@ LWR.define('lwc/v/3_6_0', ['exports'], (function (exports) { 'use strict';
9012
9192
  });
9013
9193
  });
9014
9194
  }
9015
- /** version: 3.6.0 */
9195
+ /** version: 4.0.1 */
9016
9196
 
9017
9197
  exports.LightningElement = LightningElement;
9018
9198
  exports.__unstable__ProfilerControl = profilerControl;