@lwrjs/everywhere 0.11.0-alpha.0 → 0.11.0-alpha.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.
Files changed (22) hide show
  1. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/0808c9fa1078cc94411450ea87d99b14/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-alpha_0 → 0_11_0-alpha_2}/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +4 -4
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{2_50_0/s/b40440e2e29d782101f05d6085a324e9 → 3_1_3/s/5ecae4481a6009197f93d4b83392ccba}/lwc.js +103 -244
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_11_0-alpha_0 → 0_11_0-alpha_2}/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_0 → 0_11_0-alpha_2}/s/5e6db37af51f0d23be4893abe5eeb913/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_0/s/98696c48f1e30fce990320a6d012ccb9 → 0_11_0-alpha_2/s/5969d495c0759c5fb5648cdbffad91fb}/lwr_loader.js +5 -4
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_11_0-alpha_0 → 0_11_0-alpha_2}/s/7a802ee7a2430244c1f66bce2c2eafef/lwr_metrics.js +1 -1
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_11_0-alpha_0 → 0_11_0-alpha_2}/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +1 -1
  9. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_11_0-alpha_0 → 0_11_0-alpha_2}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  10. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_11_0-alpha_0 → 0_11_0-alpha_2}/lwr-error-shim.js +1 -1
  11. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_11_0-alpha_0 → 0_11_0-alpha_2}/lwr-loader-shim.bundle.js +8 -7
  12. package/build/assets/amd/lwr-everywhere-debug.js +10 -9
  13. package/build/assets/amd/lwr-everywhere-min.js +2 -2
  14. package/build/assets/amd/lwr-everywhere.js +10 -9
  15. package/build/assets/core/lwr-everywhere-debug.js +6 -5
  16. package/build/assets/core/lwr-everywhere-min.js +1 -1
  17. package/build/assets/core/lwr-everywhere.js +6 -5
  18. package/build/assets/esm/lwr-everywhere-debug.js +1 -1
  19. package/build/assets/esm/lwr-everywhere-min.js +1 -1
  20. package/build/assets/esm/lwr-everywhere.js +1 -1
  21. package/package.json +8 -8
  22. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/a9b95935f0eeadc62b3772a9488d374c/config.js +0 -10
@@ -1,10 +1,8 @@
1
- LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwc/v/3_1_3', ['exports'], (function (exports) { 'use strict';
2
2
 
3
- /* proxy-compat-disable */
4
3
  /**
5
4
  * Copyright (C) 2023 salesforce.com, inc.
6
5
  */
7
- /* proxy-compat-disable */
8
6
  /**
9
7
  * Copyright (C) 2023 salesforce.com, inc.
10
8
  */
@@ -216,12 +214,11 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
216
214
  const _globalThis = typeof globalThis === 'object' ? globalThis : window;
217
215
 
218
216
  /*
219
- * Copyright (c) 2018, salesforce.com, inc.
217
+ * Copyright (c) 2023, Salesforce.com, inc.
220
218
  * All rights reserved.
221
219
  * SPDX-License-Identifier: MIT
222
220
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
223
221
  */
224
- const KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = '$isNativeShadowRootDefined$';
225
222
  const KEY__SHADOW_RESOLVER = '$shadowResolver$';
226
223
  const KEY__SHADOW_STATIC = '$shadowStaticNode$';
227
224
  const KEY__SHADOW_TOKEN = '$shadowToken$';
@@ -294,11 +291,10 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
294
291
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
295
292
  */
296
293
  // Increment whenever the LWC template compiler changes
297
- const LWC_VERSION = "2.50.0";
294
+ const LWC_VERSION = "3.1.3";
298
295
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
299
- /** version: 2.50.0 */
296
+ /** version: 3.1.3 */
300
297
 
301
- /* proxy-compat-disable */
302
298
  /**
303
299
  * Copyright (C) 2023 salesforce.com, inc.
304
300
  */
@@ -309,6 +305,8 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
309
305
  * SPDX-License-Identifier: MIT
310
306
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
311
307
  */
308
+ // When deprecating a feature flag, ensure that it is also no longer set in the application. For
309
+ // example, in core, the flag should be removed from LwcPermAndPrefUtilImpl.java
312
310
  const features = {
313
311
  DUMMY_TEST_FLAG: null,
314
312
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
@@ -343,9 +341,8 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
343
341
  }
344
342
  }
345
343
  if (isUndefined$1(features[name])) {
346
- const availableFlags = keys(features).map(name => `"${name}"`).join(', ');
347
344
  // eslint-disable-next-line no-console
348
- console.warn(`Failed to set the value "${value}" for the runtime feature flag "${name}" because it is undefined. Available flags: ${availableFlags}.`);
345
+ console.info(`Attempt to set a value on an unknown feature flag "${name}" resulted in a NOOP.`);
349
346
  return;
350
347
  }
351
348
  // This may seem redundant, but `process.env.NODE_ENV === 'test-karma-lwc'` is replaced by Karma tests
@@ -375,9 +372,8 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
375
372
  setFeatureFlag(name, value);
376
373
  }
377
374
  }
378
- /** version: 2.50.0 */
375
+ /** version: 3.1.3 */
379
376
 
380
- /* proxy-compat-disable */
381
377
  /**
382
378
  * Copyright (C) 2023 salesforce.com, inc.
383
379
  */
@@ -439,7 +435,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
439
435
  }
440
436
  }
441
437
  }
442
- /** version: 2.50.0 */
438
+ /** version: 3.1.3 */
443
439
 
444
440
  /*
445
441
  * Copyright (c) 2018, salesforce.com, inc.
@@ -453,7 +449,6 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
453
449
  applyAriaReflection();
454
450
  }
455
451
 
456
- /* proxy-compat-disable */
457
452
  /**
458
453
  * Copyright (C) 2023 salesforce.com, inc.
459
454
  */
@@ -702,10 +697,17 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
702
697
  } = this;
703
698
  const len = listeners.length;
704
699
  if (len > 0) {
705
- for (let i = 0; i < len; i += 1) {
700
+ for (let i = 0; i < len; i++) {
706
701
  const set = listeners[i];
707
- const pos = ArrayIndexOf.call(listeners[i], this);
708
- ArraySplice.call(set, pos, 1);
702
+ if (set.length === 1) {
703
+ // Perf optimization for the common case - the length is usually 1, so avoid the indexOf+splice.
704
+ // If the length is 1, we can also be sure that `this` is the first item in the array.
705
+ set.length = 0;
706
+ } else {
707
+ // Slow case
708
+ const pos = ArrayIndexOf.call(set, this);
709
+ ArraySplice.call(set, pos, 1);
710
+ }
709
711
  }
710
712
  listeners.length = 0;
711
713
  }
@@ -850,6 +852,9 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
850
852
  function isCircularModuleDependency(obj) {
851
853
  return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
852
854
  }
855
+ var _a, _b;
856
+ const instrumentDef = (_a = _globalThis.__lwc_instrument_cmp_def) !== null && _a !== void 0 ? _a : noop;
857
+ const instrumentInstance = (_b = _globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : noop;
853
858
 
854
859
  /*
855
860
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1522,7 +1527,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
1522
1527
  valueMutated(originalTarget, key);
1523
1528
  return true;
1524
1529
  }
1525
- /*LWC compiler v2.50.0*/
1530
+ /*LWC compiler v3.1.3*/
1526
1531
  }
1527
1532
  const getterMap = new WeakMap();
1528
1533
  const setterMap = new WeakMap();
@@ -1615,7 +1620,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
1615
1620
  /* istanbul ignore next */
1616
1621
  return false;
1617
1622
  }
1618
- /*LWC compiler v2.50.0*/
1623
+ /*LWC compiler v3.1.3*/
1619
1624
  }
1620
1625
  function extract(objectOrArray) {
1621
1626
  if (isArray(objectOrArray)) {
@@ -1905,6 +1910,8 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
1905
1910
  // `class Foo extends LightningElement {}; new Foo()`
1906
1911
  throw new TypeError('Illegal constructor');
1907
1912
  }
1913
+ // This is a no-op unless Lightning DevTools are enabled.
1914
+ instrumentInstance(this, vmBeingConstructed);
1908
1915
  const vm = vmBeingConstructed;
1909
1916
  const {
1910
1917
  def,
@@ -2281,6 +2288,13 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
2281
2288
  }
2282
2289
  return renderer.ownerDocument(vm.elm);
2283
2290
  },
2291
+ get tagName() {
2292
+ const {
2293
+ elm,
2294
+ renderer
2295
+ } = getAssociatedVM(this);
2296
+ return renderer.getTagName(elm);
2297
+ },
2284
2298
  render() {
2285
2299
  const vm = getAssociatedVM(this);
2286
2300
  return vm.def.template;
@@ -3192,35 +3206,9 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
3192
3206
  };
3193
3207
  }
3194
3208
  function HTMLBridgeElementFactory(SuperClass, props, methods) {
3195
- let HTMLBridgeElement;
3196
- /**
3197
- * Modern browsers will have all Native Constructors as regular Classes
3198
- * and must be instantiated with the new keyword. In older browsers,
3199
- * specifically IE11, those are objects with a prototype property defined,
3200
- * since they are not supposed to be extended or instantiated with the
3201
- * new keyword. This forking logic supports both cases, specifically because
3202
- * wc.ts relies on the construction path of the bridges to create new
3203
- * fully qualifying web components.
3204
- */
3205
- if (isFunction$1(SuperClass)) {
3206
- HTMLBridgeElement = class extends SuperClass {
3207
- /*LWC compiler v2.50.0*/
3208
- };
3209
- } else {
3210
- HTMLBridgeElement = function () {
3211
- // Bridge classes are not supposed to be instantiated directly in
3212
- // browsers that do not support web components.
3213
- throw new TypeError('Illegal constructor');
3214
- };
3215
- // prototype inheritance dance
3216
- setPrototypeOf(HTMLBridgeElement, SuperClass);
3217
- setPrototypeOf(HTMLBridgeElement.prototype, SuperClass.prototype);
3218
- defineProperty(HTMLBridgeElement.prototype, 'constructor', {
3219
- writable: true,
3220
- configurable: true,
3221
- value: HTMLBridgeElement
3222
- });
3223
- }
3209
+ const HTMLBridgeElement = class extends SuperClass {
3210
+ /*LWC compiler v3.1.3*/
3211
+ };
3224
3212
  // generating the hash table for attributes to avoid duplicate fields and facilitate validation
3225
3213
  // and false positives in case of inheritance.
3226
3214
  const attributeToPropMap = create(null);
@@ -3645,6 +3633,8 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
3645
3633
  errorCallback,
3646
3634
  render
3647
3635
  };
3636
+ // This is a no-op unless Lightning DevTools are enabled.
3637
+ instrumentDef(def);
3648
3638
  if (process.env.NODE_ENV !== 'production') {
3649
3639
  freeze(Ctor.prototype);
3650
3640
  }
@@ -3860,7 +3850,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
3860
3850
  }
3861
3851
  const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3862
3852
  if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS && !isScopedCss && vm.renderMode === 0 /* RenderMode.Light */) {
3863
- logError('Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).');
3853
+ logError('Unscoped CSS is not supported in Light DOM in this environment. Please use scoped CSS ' + '(*.scoped.css) instead of unscoped CSS (*.css). See also: https://sfdc.co/scoped-styles-light-dom');
3864
3854
  continue;
3865
3855
  }
3866
3856
  // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
@@ -4963,12 +4953,11 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
4963
4953
  }
4964
4954
  }
4965
4955
  }
4966
- // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
4967
- const DynamicChildren = new WeakMap();
4956
+ const DynamicChildren = new WeakSet();
4968
4957
  // dynamic children means it was either generated by an iteration in a template
4969
4958
  // or part of an unstable fragment, and will require a more complex diffing algo.
4970
4959
  function markAsDynamicChildren(children) {
4971
- DynamicChildren.set(children, 1);
4960
+ DynamicChildren.add(children);
4972
4961
  }
4973
4962
  function hasDynamicChildren(children) {
4974
4963
  return DynamicChildren.has(children);
@@ -6195,7 +6184,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
6195
6184
  }
6196
6185
 
6197
6186
  /*
6198
- * Copyright (c) 2018, salesforce.com, inc.
6187
+ * Copyright (c) 2023, Salesforce.com, inc.
6199
6188
  * All rights reserved.
6200
6189
  * SPDX-License-Identifier: MIT
6201
6190
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
@@ -6400,8 +6389,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
6400
6389
  def
6401
6390
  } = vm;
6402
6391
  const {
6403
- isSyntheticShadowDefined,
6404
- isNativeShadowDefined
6392
+ isSyntheticShadowDefined
6405
6393
  } = renderer;
6406
6394
  let shadowMode;
6407
6395
  if (isSyntheticShadowDefined) {
@@ -6409,29 +6397,22 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
6409
6397
  // ShadowMode.Native implies "not synthetic shadow" which is consistent with how
6410
6398
  // everything defaults to native when the synthetic shadow polyfill is unavailable.
6411
6399
  shadowMode = 0 /* ShadowMode.Native */;
6412
- } else if (isNativeShadowDefined) {
6413
- // Not combined with above condition because @lwc/features only supports identifiers in
6414
- // the if-condition.
6415
- if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6416
- if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */) {
6400
+ } else if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
6401
+ if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */) {
6402
+ shadowMode = 0 /* ShadowMode.Native */;
6403
+ } else {
6404
+ const shadowAncestor = getNearestShadowAncestor(vm);
6405
+ if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
6406
+ // Transitive support for native Shadow DOM. A component in native mode
6407
+ // transitively opts all of its descendants into native.
6417
6408
  shadowMode = 0 /* ShadowMode.Native */;
6418
6409
  } else {
6419
- const shadowAncestor = getNearestShadowAncestor(vm);
6420
- if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
6421
- // Transitive support for native Shadow DOM. A component in native mode
6422
- // transitively opts all of its descendants into native.
6423
- shadowMode = 0 /* ShadowMode.Native */;
6424
- } else {
6425
- // Synthetic if neither this component nor any of its ancestors are configured
6426
- // to be native.
6427
- shadowMode = 1 /* ShadowMode.Synthetic */;
6428
- }
6410
+ // Synthetic if neither this component nor any of its ancestors are configured
6411
+ // to be native.
6412
+ shadowMode = 1 /* ShadowMode.Synthetic */;
6429
6413
  }
6430
- } else {
6431
- shadowMode = 1 /* ShadowMode.Synthetic */;
6432
6414
  }
6433
6415
  } else {
6434
- // Synthetic if there is no native Shadow DOM support.
6435
6416
  shadowMode = 1 /* ShadowMode.Synthetic */;
6436
6417
  }
6437
6418
  } else {
@@ -7821,7 +7802,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
7821
7802
  }
7822
7803
  return getReadOnlyProxy(obj);
7823
7804
  }
7824
- /** version: 2.50.0 */
7805
+ /** version: 3.1.3 */
7825
7806
 
7826
7807
  /*
7827
7808
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7912,14 +7893,12 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
7912
7893
  // This check for constructable style sheets is similar to Fast's:
7913
7894
  // https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53
7914
7895
  // See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070
7915
- const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
7896
+ const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets) &&
7916
7897
  // The original adoptedStylesheet proposal used a frozen array. A follow-up proposal made the array mutable.
7917
7898
  // Chromium 99+ and Firefox 101+ support mutable arrays. We check if the array is mutable, to ensure backward compat.
7918
7899
  // (If the length is writable, then the array is mutable.) See: https://chromestatus.com/feature/5638996492288000
7919
7900
  // TODO [#2828]: Re-evaluate this in the future once we drop support for older browser versions.
7920
- const supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets && getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable;
7921
- // Detect IE, via https://stackoverflow.com/a/9851769
7922
- const isIE11 = !isUndefined$1(document.documentMode);
7901
+ isTrue(getOwnPropertyDescriptor$1(document.adoptedStyleSheets, 'length').writable);
7923
7902
  const stylesheetCache = new Map();
7924
7903
  //
7925
7904
  // Test utilities
@@ -7945,12 +7924,6 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
7945
7924
  // If the <style> was already used, then we should clone it. We cannot insert
7946
7925
  // the same <style> in two places in the DOM.
7947
7926
  if (usedElement) {
7948
- // For a mysterious reason, IE11 doesn't like the way we clone <style> nodes
7949
- // and will render the incorrect styles if we do things that way. It's just
7950
- // a perf optimization, so we can skip it for IE11.
7951
- if (isIE11) {
7952
- return createFreshStyleElement(content);
7953
- }
7954
7927
  // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
7955
7928
  // faster to call `cloneNode()` on an existing node than to recreate it every time.
7956
7929
  return element.cloneNode(true);
@@ -7971,13 +7944,8 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
7971
7944
  const {
7972
7945
  stylesheet
7973
7946
  } = cacheData;
7974
- // Mutable adopted stylesheets are only supported in certain browsers.
7975
- // The reason we use it is for perf: https://github.com/salesforce/lwc/pull/2683
7976
- if (supportsMutableAdoptedStyleSheets) {
7977
- adoptedStyleSheets.push(stylesheet);
7978
- } else {
7979
- target.adoptedStyleSheets = [...adoptedStyleSheets, stylesheet];
7980
- }
7947
+ // The reason we prefer .push() rather than reassignment is for perf: https://github.com/salesforce/lwc/pull/2683
7948
+ adoptedStyleSheets.push(stylesheet);
7981
7949
  }
7982
7950
  function insertStyleElement(content, target, cacheData) {
7983
7951
  const elm = createStyleElement(content, cacheData);
@@ -8047,51 +8015,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8047
8015
  }
8048
8016
 
8049
8017
  /*
8050
- * Copyright (c) 2020, salesforce.com, inc.
8051
- * All rights reserved.
8052
- * SPDX-License-Identifier: MIT
8053
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8054
- */
8055
- function isCustomElementRegistryAvailable() {
8056
- if (typeof customElements === 'undefined') {
8057
- return false;
8058
- }
8059
- try {
8060
- // dereference HTMLElement global because babel wraps globals in compat mode with a
8061
- // _wrapNativeSuper()
8062
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElement which does not
8063
- // get wrapped by babel.
8064
- const HTMLElementAlias = HTMLElement;
8065
- // In case we use compat mode with a modern browser, the compat mode transformation
8066
- // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
8067
- // which are not equipped to be initialized that way.
8068
- class clazz extends HTMLElementAlias {
8069
- /*LWC compiler v2.50.0*/
8070
- }
8071
- customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
8072
- new clazz();
8073
- return true;
8074
- } catch (_a) {
8075
- return false;
8076
- }
8077
- }
8078
- const hasCustomElements = isCustomElementRegistryAvailable();
8079
-
8080
- /*
8081
- * Copyright (c) 2018, salesforce.com, inc.
8082
- * All rights reserved.
8083
- * SPDX-License-Identifier: MIT
8084
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8085
- */
8086
- // Creates a custom element for compat (legacy) browser environments
8087
- const createCustomElementCompat = (tagName, upgradeCallback) => {
8088
- const elm = document.createElement(tagName);
8089
- upgradeCallback(elm); // nothing to do with the result for now
8090
- return elm;
8091
- };
8092
-
8093
- /*
8094
- * Copyright (c) 2018, salesforce.com, inc.
8018
+ * Copyright (c) 2023, Salesforce.com, inc.
8095
8019
  * All rights reserved.
8096
8020
  * SPDX-License-Identifier: MIT
8097
8021
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
@@ -8124,7 +8048,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8124
8048
  // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
8125
8049
  }
8126
8050
  }
8127
- /*LWC compiler v2.50.0*/
8051
+ /*LWC compiler v3.1.3*/
8128
8052
  }
8129
8053
  // Do not unnecessarily add a connectedCallback/disconnectedCallback, as it introduces perf overhead
8130
8054
  // See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
@@ -8144,7 +8068,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8144
8068
  }
8145
8069
  return UpgradableConstructor;
8146
8070
  };
8147
- const createCustomElementUsingUpgradableConstructor = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
8071
+ const createCustomElement = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
8148
8072
  // use global custom elements registry
8149
8073
  let UpgradableConstructor = cachedConstructors.get(tagName);
8150
8074
  if (isUndefined$1(UpgradableConstructor)) {
@@ -8164,31 +8088,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8164
8088
  };
8165
8089
 
8166
8090
  /*
8167
- * Copyright (c) 2018, salesforce.com, inc.
8168
- * All rights reserved.
8169
- * SPDX-License-Identifier: MIT
8170
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8171
- */
8172
- /**
8173
- * We have two modes for creating custom elements:
8174
- *
8175
- * 1. Compat (legacy) browser support (e.g. IE11). Totally custom, doesn't rely on native browser APIs.
8176
- * 2. "Upgradable constructor" custom element. This allows us to have two LWC components with the same tag name,
8177
- * via a trick: every custom element constructor we define in the registry is basically the same. It's essentially
8178
- * a dummy `class extends HTMLElement` that accepts an `upgradeCallback` in its constructor ("upgradable
8179
- * constructor"), which allows us to have completely customized functionality for different components.
8180
- */
8181
- let createCustomElement;
8182
- if (hasCustomElements) {
8183
- // use the global registry, with an upgradable constructor for the defined custom element
8184
- createCustomElement = createCustomElementUsingUpgradableConstructor;
8185
- } else {
8186
- // no registry available here
8187
- createCustomElement = createCustomElementCompat;
8188
- }
8189
-
8190
- /*
8191
- * Copyright (c) 2018, salesforce.com, inc.
8091
+ * Copyright (c) 2023, Salesforce.com, inc.
8192
8092
  * All rights reserved.
8193
8093
  * SPDX-License-Identifier: MIT
8194
8094
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
@@ -8205,7 +8105,6 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8205
8105
  */
8206
8106
  function rendererFactory(baseRenderer) {
8207
8107
  const renderer = function (exports) {
8208
- /* proxy-compat-disable */
8209
8108
  /**
8210
8109
  * Copyright (C) 2023 salesforce.com, inc.
8211
8110
  */
@@ -8246,7 +8145,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8246
8145
  function isNull(obj) {
8247
8146
  return obj === null;
8248
8147
  }
8249
- /** version: 2.50.0 */
8148
+ /** version: 3.1.3 */
8250
8149
 
8251
8150
  /*
8252
8151
  * Copyright (c) 2023, salesforce.com, inc.
@@ -8266,7 +8165,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8266
8165
  this.setNewContext = setNewContext;
8267
8166
  this.setDisconnectedCallback = setDisconnectedCallback;
8268
8167
  }
8269
- /*LWC compiler v2.50.0*/
8168
+ /*LWC compiler v3.1.3*/
8270
8169
  }
8271
8170
  function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
8272
8171
  dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
@@ -8303,61 +8202,11 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8303
8202
  function createComment(content) {
8304
8203
  return document.createComment(content);
8305
8204
  }
8306
- exports.createFragment = void 0;
8307
- // IE11 lacks support for this feature
8308
- const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8309
- if (SUPPORTS_TEMPLATE) {
8310
- // Parse the fragment HTML string into DOM
8311
- exports.createFragment = function (html) {
8312
- const template = document.createElement('template');
8313
- template.innerHTML = html;
8314
- return template.content.firstChild;
8315
- };
8316
- } else {
8317
- // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8318
- // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8319
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8320
- // With other elements added from:
8321
- // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8322
- // Using the test:
8323
- // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8324
- // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8325
- const topLevelWrappingMap = {
8326
- caption: ['table'],
8327
- col: ['colgroup', 'table'],
8328
- colgroup: ['table'],
8329
- option: ['select'],
8330
- tbody: ['table'],
8331
- td: ['tr', 'tbody', 'table'],
8332
- th: ['tr', 'tbody', 'table'],
8333
- thead: ['table'],
8334
- tfoot: ['table'],
8335
- tr: ['tbody', 'table']
8336
- };
8337
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8338
- const getTagName = function (text) {
8339
- return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8340
- };
8341
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8342
- exports.createFragment = function (html) {
8343
- const wrapperTags = topLevelWrappingMap[getTagName(html)];
8344
- if (!isUndefined(wrapperTags)) {
8345
- for (const wrapperTag of wrapperTags) {
8346
- html = `<${wrapperTag}>${html}</${wrapperTag}>`;
8347
- }
8348
- }
8349
- // For IE11, the document title must not be undefined, but it can be an empty string
8350
- // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8351
- const doc = document.implementation.createHTMLDocument('');
8352
- doc.body.innerHTML = html;
8353
- let content = doc.body;
8354
- if (!isUndefined(wrapperTags)) {
8355
- for (let i = 0; i < wrapperTags.length; i++) {
8356
- content = content.firstChild;
8357
- }
8358
- }
8359
- return content.firstChild;
8360
- };
8205
+ // Parse the fragment HTML string into DOM
8206
+ function createFragment(html) {
8207
+ const template = document.createElement('template');
8208
+ template.innerHTML = html;
8209
+ return template.content.firstChild;
8361
8210
  }
8362
8211
  function insert(node, parent, anchor) {
8363
8212
  parent.insertBefore(node, anchor);
@@ -8459,12 +8308,16 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8459
8308
  function ownerDocument(element) {
8460
8309
  return element.ownerDocument;
8461
8310
  }
8311
+ function getTagName(elm) {
8312
+ return elm.tagName;
8313
+ }
8462
8314
  exports.addEventListener = addEventListener;
8463
8315
  exports.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
8464
8316
  exports.attachShadow = attachShadow;
8465
8317
  exports.cloneNode = cloneNode;
8466
8318
  exports.createComment = createComment;
8467
8319
  exports.createElement = createElement;
8320
+ exports.createFragment = createFragment;
8468
8321
  exports.createText = createText;
8469
8322
  exports.dispatchEvent = dispatchEvent;
8470
8323
  exports.getAttribute = getAttribute;
@@ -8479,6 +8332,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8479
8332
  exports.getLastChild = getLastChild;
8480
8333
  exports.getLastElementChild = getLastElementChild;
8481
8334
  exports.getProperty = getProperty;
8335
+ exports.getTagName = getTagName;
8482
8336
  exports.insert = insert;
8483
8337
  exports.isConnected = isConnected;
8484
8338
  exports.nextSibling = nextSibling;
@@ -8502,7 +8356,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8502
8356
  }
8503
8357
 
8504
8358
  /*
8505
- * Copyright (c) 2018, salesforce.com, inc.
8359
+ * Copyright (c) 2023, Salesforce.com, inc.
8506
8360
  * All rights reserved.
8507
8361
  * SPDX-License-Identifier: MIT
8508
8362
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
@@ -8521,7 +8375,6 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8521
8375
  insertStylesheet,
8522
8376
  // relies on a shared global cache
8523
8377
  createCustomElement,
8524
- isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
8525
8378
  isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
8526
8379
  });
8527
8380
 
@@ -8615,9 +8468,12 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8615
8468
  }
8616
8469
  return Ctor.CustomElementConstructor;
8617
8470
  }
8618
- // Note: WeakSet is not supported in IE11, and the polyfill is not performant enough.
8619
- // This WeakSet usage is valid because this functionality is not meant to run in IE11.
8620
- const hydratedCustomElements = new WeakSet();
8471
+ function clearNode(node) {
8472
+ const childNodes = renderer.getChildNodes(node);
8473
+ for (let i = childNodes.length - 1; i >= 0; i--) {
8474
+ renderer.remove(childNodes[i], node);
8475
+ }
8476
+ }
8621
8477
  function buildCustomElementConstructor(Ctor) {
8622
8478
  var _a;
8623
8479
  const HtmlPrototype = getComponentHtmlPrototype(Ctor);
@@ -8630,25 +8486,28 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8630
8486
  return _a = class extends HTMLElement {
8631
8487
  constructor() {
8632
8488
  super();
8633
- if (this.isConnected) {
8634
- // this if block is hit when there's already an un-upgraded element in the DOM with the same tag name.
8635
- hydrateComponent(this, Ctor, {});
8636
- hydratedCustomElements.add(this);
8637
- } else {
8638
- createVM(this, Ctor, renderer, {
8639
- mode: 'open',
8640
- owner: null,
8641
- tagName: this.tagName
8642
- });
8489
+ if (!isNull(this.shadowRoot)) {
8490
+ if (process.env.NODE_ENV !== 'production') {
8491
+ // eslint-disable-next-line no-console
8492
+ console.warn(`Found an existing shadow root for the custom element "${Ctor.name}". Call \`hydrateComponent\` instead.`);
8493
+ }
8494
+ clearNode(this.shadowRoot);
8495
+ }
8496
+ if (this.childNodes.length > 0) {
8497
+ if (process.env.NODE_ENV !== 'production') {
8498
+ // eslint-disable-next-line no-console
8499
+ console.warn(`Custom elements cannot have child nodes. Ensure the element is empty, including whitespace.`);
8500
+ }
8501
+ clearNode(this);
8643
8502
  }
8503
+ createVM(this, Ctor, renderer, {
8504
+ mode: 'open',
8505
+ owner: null,
8506
+ tagName: this.tagName
8507
+ });
8644
8508
  }
8645
8509
  connectedCallback() {
8646
- if (hydratedCustomElements.has(this)) {
8647
- // This is an un-upgraded element that was hydrated in the constructor.
8648
- hydratedCustomElements.delete(this);
8649
- } else {
8650
- connectRootElement(this);
8651
- }
8510
+ connectRootElement(this);
8652
8511
  }
8653
8512
  disconnectedCallback() {
8654
8513
  disconnectRootElement(this);
@@ -8656,7 +8515,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8656
8515
  attributeChangedCallback(name, oldValue, newValue) {
8657
8516
  attributeChangedCallback.call(this, name, oldValue, newValue);
8658
8517
  }
8659
- /*LWC compiler v2.50.0*/
8518
+ /*LWC compiler v3.1.3*/
8660
8519
  }, _a.observedAttributes = observedAttributes, _a;
8661
8520
  }
8662
8521
 
@@ -8870,7 +8729,7 @@ LWR.define('lwc/v/2_50_0', ['exports'], (function (exports) { 'use strict';
8870
8729
  });
8871
8730
  });
8872
8731
  }
8873
- /** version: 2.50.0 */
8732
+ /** version: 3.1.3 */
8874
8733
 
8875
8734
  exports.LightningElement = LightningElement;
8876
8735
  exports.__unstable__ProfilerControl = profilerControl;