@lwrjs/everywhere 0.12.0-alpha.4 → 0.12.0-alpha.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. package/README.md +2 -0
  2. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/c4ab7e5dbc0697efbf468c722dbd35d0/config.js +11 -0
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_6/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +14 -0
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{5_3_0/s/d6928cae62ba4c18e61fa9c234830c2a → 6_0_0/s/6e7ff236fd6011fdc06fb33b61261493}/lwc.js +135 -91
  5. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_12_0-alpha_4 → 0_12_0-alpha_6}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_12_0-alpha_4 → 0_12_0-alpha_6}/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js +21 -21
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_12_0-alpha_4/s/5c5d9084a8557502d4eed0d5788db05d → 0_12_0-alpha_6/s/7d8a8e317de06e72e1bf307d3ea8d1f0}/lwr_loader.js +3 -3
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_12_0-alpha_4 → 0_12_0-alpha_6}/s/274c8343f810353bbad085a79709395f/lwr_metrics.js +1 -1
  9. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/{0_12_0-alpha_4 → 0_12_0-alpha_6}/s/f3a204ef43fb3057d910f80d7e9f9ba7/lwr_preInit.js +1 -1
  10. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_12_0-alpha_4 → 0_12_0-alpha_6}/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +1 -1
  11. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_12_0-alpha_4 → 0_12_0-alpha_6}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  12. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_12_0-alpha_4 → 0_12_0-alpha_6}/lwr-error-shim.js +1 -1
  13. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_12_0-alpha_4 → 0_12_0-alpha_6}/lwr-loader-shim.bundle.js +6 -6
  14. package/build/assets/amd/lwr-everywhere-debug.js +8 -8
  15. package/build/assets/amd/lwr-everywhere-min.js +2 -2
  16. package/build/assets/amd/lwr-everywhere.js +8 -8
  17. package/build/assets/core/lwr-everywhere-debug.js +4 -4
  18. package/build/assets/core/lwr-everywhere.js +4 -4
  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 +7 -7
  23. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/1acd458a2d969105f87cecce5be6675c/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_12_0-alpha_4/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
package/README.md CHANGED
@@ -165,7 +165,9 @@ To enable authentication with LWR Everywhere, follow these steps to set up a sec
165
165
  1. Go to _Setup_ -> _CORS_
166
166
  1. Add a new "Allowed Origin" for the website (e.g. `"https://my-website.com"`)
167
167
  1. Setup a [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)
168
+
168
169
  1. Add a `script-src` CSP to the web page containing the Connected App origin, and `'unsafe-eval'` to support [Lightning Web Security](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/security_lwsec_intro). For example:
170
+
169
171
  ```html
170
172
  <meta
171
173
  http-equiv="Content-Security-Policy"
@@ -0,0 +1,11 @@
1
+ /* This script is generated */
2
+ /* Client Bootstrap configuration */
3
+ globalThis.LWR = globalThis.LWR || {};
4
+ Object.assign(globalThis.LWR, {"appId":"amd-bootstrap","bootstrapModule":"@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_6","autoBoot":true,"imports":{"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_12_0-alpha_6/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_6"],"/1/module/amd/1/l/en-US/mi/lwr%2FpreInit%2Fv%2F0_12_0-alpha_6/s/f3a204ef43fb3057d910f80d7e9f9ba7/lwr_preInit.js":["lwr/preInit/v/0_12_0-alpha_6"],"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_12_0-alpha_6/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js":["lwr/init/v/0_12_0-alpha_6"],"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_12_0-alpha_6/s/274c8343f810353bbad085a79709395f/lwr_metrics.js":["lwr/metrics/v/0_12_0-alpha_6"],"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_12_0-alpha_6/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js":["lwr/profiler/v/0_12_0-alpha_6"],"/1/module/amd/1/l/en-US/mi/lwc%2Fv%2F6_0_0/s/6e7ff236fd6011fdc06fb33b61261493/lwc.js":["lwc/v/6_0_0"],"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_12_0-alpha_6/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js":["lwr/everywhereAmd/v/0_12_0-alpha_6"],"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_12_0-alpha_6/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js":["lwr/vault/v/0_12_0-alpha_6"]},"index":{"@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_6":"/1/module/amd/1/l/en-US/mi/%40lwrjs%2Fapp-service%2Famd-bootstrap%2Fmodule%2Famd%2Fv%2F0_12_0-alpha_6/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js","lwr/preInit/v/0_12_0-alpha_6":"/1/module/amd/1/l/en-US/mi/lwr%2FpreInit%2Fv%2F0_12_0-alpha_6/s/f3a204ef43fb3057d910f80d7e9f9ba7/lwr_preInit.js","lwr/init/v/0_12_0-alpha_6":"/1/module/amd/1/l/en-US/mi/lwr%2Finit%2Fv%2F0_12_0-alpha_6/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js","lwr/metrics/v/0_12_0-alpha_6":"/1/module/amd/1/l/en-US/mi/lwr%2Fmetrics%2Fv%2F0_12_0-alpha_6/s/274c8343f810353bbad085a79709395f/lwr_metrics.js","lwr/profiler/v/0_12_0-alpha_6":"/1/module/amd/1/l/en-US/mi/lwr%2Fprofiler%2Fv%2F0_12_0-alpha_6/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js","lwc/v/6_0_0":"/1/module/amd/1/l/en-US/mi/lwc%2Fv%2F6_0_0/s/6e7ff236fd6011fdc06fb33b61261493/lwc.js","lwr/everywhereAmd/v/0_12_0-alpha_6":"/1/module/amd/1/l/en-US/mi/lwr%2FeverywhereAmd%2Fv%2F0_12_0-alpha_6/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js","lwr/vault/v/0_12_0-alpha_6":"/1/module/amd/1/l/en-US/mi/lwr%2Fvault%2Fv%2F0_12_0-alpha_6/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js"},"rootComponents":["lwr/everywhereAmd/v/0_12_0-alpha_6"],"serverData":{},"requiredModules":["@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_6"],"preloadModules":["lwr/preInit/v/0_12_0-alpha_6","lwr/init/v/0_12_0-alpha_6","lwr/metrics/v/0_12_0-alpha_6","lwc/v/6_0_0","lwr/everywhereAmd/v/0_12_0-alpha_6"],"endpoints":{"uris":{"mapping":"/1/mapping/amd/1/l/en-US/mp/"}}});
5
+ globalThis.process = { env: {"NODE_ENV":"compat","SSR":false,"basePath":"","locale":"en-US","assetBasePath":"","uiBasePath":""} };
6
+ globalThis.lwcRuntimeFlags = { ENABLE_MIXED_SHADOW_MODE: false };
7
+ // Appended by Static Site Generator
8
+ if (!globalThis.LWR.imports) { globalThis.LWR.imports = {}; }
9
+ Object.assign(globalThis.LWR.imports, {"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_12_0-alpha_6/s/7d8a8e317de06e72e1bf307d3ea8d1f0/lwr_loader.js":["lwr/loader/v/0_12_0-alpha_6"]})
10
+ if (!globalThis.LWR.index) { globalThis.LWR.index = {}; }
11
+ Object.assign(globalThis.LWR.index, {"lwr/loader/v/0_12_0-alpha_6":"/1/module/amd/1/l/en-US/mi/lwr%2Floader%2Fv%2F0_12_0-alpha_6/s/7d8a8e317de06e72e1bf307d3ea8d1f0/lwr_loader.js"})
@@ -0,0 +1,14 @@
1
+ LWR.define('@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_6', ['lwr/loader/v/0_12_0-alpha_6', 'lwr/preInit/v/0_12_0-alpha_6', 'lwr/init/v/0_12_0-alpha_6'], (function (_0_12_0Alpha_6$2, _0_12_0Alpha_6, _0_12_0Alpha_6$1) { 'use strict';
2
+
3
+ const clientBootstrapConfig = _0_12_0Alpha_6.getClientBootstrapConfig();
4
+
5
+ // initialize additional non-configured root components
6
+ const { rootComponents, serverData } = clientBootstrapConfig;
7
+ Promise.all(rootComponents.map(async (rootSpecifier) => {
8
+ const element = _0_12_0Alpha_6$1.toKebabCase(rootSpecifier);
9
+ return _0_12_0Alpha_6$2.load(rootSpecifier, '@lwrjs/app-service/amd-bootstrap/module/amd/v/0_12_0-alpha_6').then(({default: Ctor}) => {
10
+ _0_12_0Alpha_6$1.init([[element, Ctor]], serverData);
11
+ });
12
+ }));
13
+
14
+ }));
@@ -1,4 +1,4 @@
1
- LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
1
+ LWR.define('lwc/v/6_0_0', ['exports'], (function (exports) { 'use strict';
2
2
 
3
3
  /**
4
4
  * Copyright (C) 2023 salesforce.com, inc.
@@ -183,6 +183,9 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
183
183
  case 4 /* APIFeature.SKIP_UNNECESSARY_REGISTER_DECORATORS */:
184
184
  case 5 /* APIFeature.USE_COMMENTS_FOR_FRAGMENT_BOOKENDS */:
185
185
  return apiVersion >= 60 /* APIVersion.V60_248_SPRING_24 */;
186
+ case 6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */:
187
+ case 7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */:
188
+ return apiVersion >= 61 /* APIVersion.V61_250_SUMMER_24 */;
186
189
  }
187
190
  }
188
191
 
@@ -316,9 +319,9 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
316
319
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
317
320
  */
318
321
  // Increment whenever the LWC template compiler changes
319
- const LWC_VERSION = "5.3.0";
322
+ const LWC_VERSION = "6.0.0";
320
323
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
321
- /** version: 5.3.0 */
324
+ /** version: 6.0.0 */
322
325
 
323
326
  /**
324
327
  * Copyright (C) 2023 salesforce.com, inc.
@@ -336,7 +339,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
336
339
  PLACEHOLDER_TEST_FLAG: null,
337
340
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
338
341
  ENABLE_MIXED_SHADOW_MODE: null,
339
- ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
342
+ DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
340
343
  ENABLE_WIRE_SYNC_EMIT: null,
341
344
  DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
342
345
  ENABLE_FROZEN_TEMPLATE: null,
@@ -398,7 +401,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
398
401
  setFeatureFlag(name, value);
399
402
  }
400
403
  }
401
- /** version: 5.3.0 */
404
+ /** version: 6.0.0 */
402
405
 
403
406
  /**
404
407
  * Copyright (C) 2023 salesforce.com, inc.
@@ -733,6 +736,14 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
733
736
  }
734
737
  return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
735
738
  }
739
+ function shouldUseNativeCustomElementLifecycle(ctor) {
740
+ if (lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
741
+ // temporary "kill switch"
742
+ return false;
743
+ }
744
+ const apiVersion = getComponentAPIVersion(ctor);
745
+ return isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
746
+ }
736
747
  // Borrowed from Vue template compiler.
737
748
  // https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
738
749
  const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
@@ -1093,28 +1104,6 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
1093
1104
  })
1094
1105
  };
1095
1106
  }
1096
- function getLightningElementPrototypeRestrictionsDescriptors(proto) {
1097
- assertNotProd(); // this method should never leak to prod
1098
- const originalDispatchEvent = proto.dispatchEvent;
1099
- return {
1100
- dispatchEvent: generateDataDescriptor({
1101
- value(event) {
1102
- const vm = getAssociatedVM(this);
1103
- if (!isNull(event) && isObject(event)) {
1104
- const {
1105
- type
1106
- } = event;
1107
- if (!/^[a-z][a-z0-9_]*$/.test(type)) {
1108
- logError(`Invalid event type "${type}" dispatched in element ${getComponentTag(vm)}.` + ` Event name must start with a lowercase letter and followed only lowercase` + ` letters, numbers, and underscores`, vm);
1109
- }
1110
- }
1111
- // Typescript does not like it when you treat the `arguments` object as an array
1112
- // @ts-ignore type-mismatch
1113
- return originalDispatchEvent.apply(this, arguments);
1114
- }
1115
- })
1116
- };
1117
- }
1118
1107
  // This routine will prevent access to certain properties on a shadow root instance to guarantee
1119
1108
  // that all components will work fine in IE11 and other browsers without shadow dom support.
1120
1109
  function patchShadowRootWithRestrictions(sr) {
@@ -1125,9 +1114,6 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
1125
1114
  const elmProto = getPrototypeOf$1(elm);
1126
1115
  setPrototypeOf(elm, create(elmProto, restrictionsDescriptors));
1127
1116
  }
1128
- function patchLightningElementPrototypeWithRestrictions(proto) {
1129
- defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1130
- }
1131
1117
  function updateComponentValue(vm, key, newValue) {
1132
1118
  const {
1133
1119
  cmpFields
@@ -1504,7 +1490,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
1504
1490
  valueMutated(originalTarget, key);
1505
1491
  return true;
1506
1492
  }
1507
- /*LWC compiler v5.3.0*/
1493
+ /*LWC compiler v6.0.0*/
1508
1494
  }
1509
1495
  const getterMap = new WeakMap();
1510
1496
  const setterMap = new WeakMap();
@@ -1597,7 +1583,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
1597
1583
  /* istanbul ignore next */
1598
1584
  return false;
1599
1585
  }
1600
- /*LWC compiler v5.3.0*/
1586
+ /*LWC compiler v6.0.0*/
1601
1587
  }
1602
1588
  function extract(objectOrArray) {
1603
1589
  if (isArray(objectOrArray)) {
@@ -2479,9 +2465,6 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
2479
2465
  },
2480
2466
  configurable: true
2481
2467
  });
2482
- if (process.env.NODE_ENV !== 'production') {
2483
- patchLightningElementPrototypeWithRestrictions(LightningElement.prototype);
2484
- }
2485
2468
  function createObservedFieldPropertyDescriptor(key) {
2486
2469
  return {
2487
2470
  get() {
@@ -3352,7 +3335,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
3352
3335
  }
3353
3336
  function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto, hasCustomSuperClass) {
3354
3337
  const HTMLBridgeElement = class extends SuperClass {
3355
- /*LWC compiler v5.3.0*/
3338
+ /*LWC compiler v6.0.0*/
3356
3339
  };
3357
3340
  // generating the hash table for attributes to avoid duplicate fields and facilitate validation
3358
3341
  // and false positives in case of inheritance.
@@ -4226,6 +4209,9 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
4226
4209
  function isVScopedSlotFragment(vnode) {
4227
4210
  return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
4228
4211
  }
4212
+ function isVStatic(vnode) {
4213
+ return vnode.type === 4 /* VNodeType.Static */;
4214
+ }
4229
4215
 
4230
4216
  /*
4231
4217
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4279,6 +4265,26 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
4279
4265
  }
4280
4266
  }
4281
4267
  }
4268
+ function patchSlotAssignment(oldVnode, vnode, renderer) {
4269
+ const {
4270
+ slotAssignment
4271
+ } = vnode;
4272
+ if ((oldVnode === null || oldVnode === void 0 ? void 0 : oldVnode.slotAssignment) === slotAssignment) {
4273
+ return;
4274
+ }
4275
+ const {
4276
+ elm
4277
+ } = vnode;
4278
+ const {
4279
+ setAttribute,
4280
+ removeAttribute
4281
+ } = renderer;
4282
+ if (isUndefined$1(slotAssignment) || isNull(slotAssignment)) {
4283
+ removeAttribute(elm, 'slot');
4284
+ } else {
4285
+ setAttribute(elm, 'slot', slotAssignment);
4286
+ }
4287
+ }
4282
4288
 
4283
4289
  /*
4284
4290
  * Copyright (c) 2018, salesforce.com, inc.
@@ -4793,6 +4799,8 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
4793
4799
  }
4794
4800
  function patchStatic(n1, n2, renderer) {
4795
4801
  const elm = n2.elm = n1.elm;
4802
+ // slotAssignments can only apply to the top level element, never to a static part.
4803
+ patchSlotAssignment(n1, n2, renderer);
4796
4804
  // The `refs` object is blown away in every re-render, so we always need to re-apply them
4797
4805
  applyStaticParts(elm, n2, renderer, false);
4798
4806
  }
@@ -4822,13 +4830,16 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
4822
4830
  elm[KEY__SHADOW_STATIC] = true;
4823
4831
  }
4824
4832
  }
4833
+ // slotAssignments can only apply to the top level element, never to a static part.
4834
+ patchSlotAssignment(null, vnode, renderer);
4825
4835
  insertNode(elm, parent, anchor, renderer);
4826
4836
  applyStaticParts(elm, vnode, renderer, true);
4827
4837
  }
4828
4838
  function mountCustomElement(vnode, parent, anchor, renderer) {
4829
4839
  const {
4830
4840
  sel,
4831
- owner
4841
+ owner,
4842
+ ctor
4832
4843
  } = vnode;
4833
4844
  const {
4834
4845
  createCustomElement
@@ -4849,7 +4860,8 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
4849
4860
  // compiler may generate tagnames with uppercase letters so - for backwards
4850
4861
  // compatibility, we lower case the tagname here.
4851
4862
  const normalizedTagname = sel.toLowerCase();
4852
- const elm = createCustomElement(normalizedTagname, upgradeCallback);
4863
+ const useNativeLifecycle = shouldUseNativeCustomElementLifecycle(ctor);
4864
+ const elm = createCustomElement(normalizedTagname, upgradeCallback, useNativeLifecycle);
4853
4865
  vnode.elm = elm;
4854
4866
  vnode.vm = vm;
4855
4867
  linkNodeToShadow(elm, owner, renderer);
@@ -4861,7 +4873,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
4861
4873
  insertNode(elm, parent, anchor, renderer);
4862
4874
  if (vm) {
4863
4875
  {
4864
- if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
4876
+ if (!useNativeLifecycle) {
4865
4877
  if (process.env.NODE_ENV !== 'production') {
4866
4878
  // With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
4867
4879
  // noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
@@ -5066,6 +5078,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5066
5078
  patchStyleAttribute(oldVnode, vnode, renderer);
5067
5079
  patchAttributes(oldVnode, vnode, renderer);
5068
5080
  patchProps(oldVnode, vnode, renderer);
5081
+ patchSlotAssignment(oldVnode, vnode, renderer);
5069
5082
  // The `refs` object is blown away in every re-render, so we always need to re-apply them
5070
5083
  applyRefs(vnode, vnode.owner);
5071
5084
  }
@@ -5234,7 +5247,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5234
5247
  return vm;
5235
5248
  }
5236
5249
  function allocateInSlot(vm, children, owner) {
5237
- var _a, _b;
5250
+ var _a;
5238
5251
  const {
5239
5252
  cmpSlots: {
5240
5253
  slotAssignments: oldSlotsMapping
@@ -5248,8 +5261,8 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5248
5261
  continue;
5249
5262
  }
5250
5263
  let slotName = '';
5251
- if (isVBaseElement(vnode)) {
5252
- slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
5264
+ if (isVBaseElement(vnode) || isVStatic(vnode)) {
5265
+ slotName = (_a = vnode.slotAssignment) !== null && _a !== void 0 ? _a : '';
5253
5266
  } else if (isVScopedSlotFragment(vnode)) {
5254
5267
  slotName = vnode.slotName;
5255
5268
  }
@@ -5505,7 +5518,8 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5505
5518
  elm: undefined,
5506
5519
  fragment,
5507
5520
  owner,
5508
- parts
5521
+ parts,
5522
+ slotAssignment: undefined
5509
5523
  };
5510
5524
  return vnode;
5511
5525
  }
@@ -5548,7 +5562,8 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5548
5562
  });
5549
5563
  }
5550
5564
  const {
5551
- key
5565
+ key,
5566
+ slotAssignment
5552
5567
  } = data;
5553
5568
  const vnode = {
5554
5569
  type: 2 /* VNodeType.Element */,
@@ -5557,7 +5572,8 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5557
5572
  children,
5558
5573
  elm: undefined,
5559
5574
  key,
5560
- owner: vmBeingRendered
5575
+ owner: vmBeingRendered,
5576
+ slotAssignment
5561
5577
  };
5562
5578
  return vnode;
5563
5579
  }
@@ -5582,6 +5598,11 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5582
5598
  assert.isTrue(isObject(data), `s() 2nd argument data must be an object.`);
5583
5599
  assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);
5584
5600
  }
5601
+ const vmBeingRendered = getVMBeingRendered();
5602
+ const {
5603
+ renderMode,
5604
+ apiVersion
5605
+ } = vmBeingRendered;
5585
5606
  if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
5586
5607
  const newChildren = [];
5587
5608
  const slotAssignments = slotset.slotAssignments[slotName];
@@ -5601,7 +5622,6 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5601
5622
  }
5602
5623
  // If the passed slot content is factory, evaluate it and add the produced vnodes
5603
5624
  if (assignedNodeIsScopedSlot) {
5604
- const vmBeingRenderedInception = getVMBeingRendered();
5605
5625
  // Evaluate in the scope of the slot content's owner
5606
5626
  // if a slotset is provided, there will always be an owner. The only case where owner is
5607
5627
  // undefined is for root components, but root components cannot accept slotted content
@@ -5616,22 +5636,33 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5616
5636
  ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
5617
5637
  });
5618
5638
  } finally {
5619
- setVMBeingRendered(vmBeingRenderedInception);
5639
+ setVMBeingRendered(vmBeingRendered);
5620
5640
  }
5621
5641
  } else {
5642
+ // This block is for standard slots (non-scoped slots)
5643
+ let clonedVNode;
5644
+ if (renderMode === 0 /* RenderMode.Light */ && isAPIFeatureEnabled(6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */, apiVersion) && (isVBaseElement(vnode) || isVStatic(vnode)) &&
5645
+ // We only need to copy the vnodes when the slot assignment changes, copying every time causes issues with
5646
+ // disconnected/connected callback firing.
5647
+ vnode.slotAssignment !== data.slotAssignment) {
5648
+ // When the light DOM slot assignment (slot attribute) changes we can't use the same reference
5649
+ // to the vnode because the current way the diffing algo works, it will replace the original reference
5650
+ // to the host element with a new one. This means the new element will be mounted and immediately unmounted.
5651
+ // Creating a copy of the vnode to preserve a reference to the previous host element.
5652
+ clonedVNode = Object.assign(Object.assign({}, vnode), {
5653
+ slotAssignment: data.slotAssignment
5654
+ });
5655
+ }
5622
5656
  // If the slot content is standard type, the content is static, no additional
5623
5657
  // processing needed on the vnode
5624
- ArrayPush$1.call(newChildren, vnode);
5658
+ ArrayPush$1.call(newChildren, clonedVNode !== null && clonedVNode !== void 0 ? clonedVNode : vnode);
5625
5659
  }
5626
5660
  }
5627
5661
  }
5628
5662
  children = newChildren;
5629
5663
  }
5630
- const vmBeingRendered = getVMBeingRendered();
5631
5664
  const {
5632
- renderMode,
5633
- shadowMode,
5634
- apiVersion
5665
+ shadowMode
5635
5666
  } = vmBeingRendered;
5636
5667
  if (renderMode === 0 /* RenderMode.Light */) {
5637
5668
  // light DOM slots - backwards-compatible behavior uses flattening, new behavior uses fragments
@@ -5671,7 +5702,8 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5671
5702
  }
5672
5703
  }
5673
5704
  const {
5674
- key
5705
+ key,
5706
+ slotAssignment
5675
5707
  } = data;
5676
5708
  let elm, aChildren, vm;
5677
5709
  const vnode = {
@@ -5681,6 +5713,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
5681
5713
  children,
5682
5714
  elm,
5683
5715
  key,
5716
+ slotAssignment,
5684
5717
  ctor: Ctor,
5685
5718
  owner: vmBeingRendered,
5686
5719
  mode: 'open',
@@ -6563,7 +6596,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
6563
6596
  // old vnode.children is removed from the DOM.
6564
6597
  function removeVM(vm) {
6565
6598
  if (process.env.NODE_ENV !== 'production') {
6566
- if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
6599
+ if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor)) {
6567
6600
  // With native lifecycle, we cannot be certain that connectedCallback was called before a component
6568
6601
  // was removed from the VDOM. If the component is disconnected, then connectedCallback will not fire
6569
6602
  // in native mode, although it will fire in synthetic mode due to appendChild triggering it.
@@ -6903,7 +6936,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
6903
6936
  }
6904
6937
  // This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
6905
6938
  // we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
6906
- if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE && (process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
6939
+ if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor) && (process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
6907
6940
  if (!vm.renderer.isConnected(vm.elm)) {
6908
6941
  if (process.env.NODE_ENV !== 'production') {
6909
6942
  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`);
@@ -8236,7 +8269,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
8236
8269
  }
8237
8270
  return getReadOnlyProxy(obj);
8238
8271
  }
8239
- /** version: 5.3.0 */
8272
+ /** version: 6.0.0 */
8240
8273
 
8241
8274
  /*
8242
8275
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8451,17 +8484,17 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
8451
8484
  * SPDX-License-Identifier: MIT
8452
8485
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8453
8486
  */
8454
- const cachedConstructors = new Map();
8455
- const elementsUpgradedOutsideLWC = new WeakSet();
8456
- let elementBeingUpgradedByLWC = false;
8457
- const lifecycleCallbacks = lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE ? {
8487
+ const LIFECYCLE_CALLBACKS = {
8458
8488
  connectedCallback: connectRootElement,
8459
8489
  disconnectedCallback: disconnectRootElement,
8460
8490
  formAssociatedCallback: runFormAssociatedCallback,
8461
8491
  formDisabledCallback: runFormDisabledCallback,
8462
8492
  formResetCallback: runFormResetCallback,
8463
8493
  formStateRestoreCallback: runFormStateRestoreCallback
8464
- } : undefined;
8494
+ };
8495
+ const cachedConstructors = new Map();
8496
+ const nativeLifecycleElementsToUpgradedByLWC = new WeakMap();
8497
+ let elementBeingUpgradedByLWC = false;
8465
8498
  // Creates a constructor that is intended to be used directly as a custom element, except that the upgradeCallback is
8466
8499
  // passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
8467
8500
  // Another benefit is that only LWC can create components that actually do anything – if you do
@@ -8470,34 +8503,33 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
8470
8503
  const createUpgradableConstructor = () => {
8471
8504
  // TODO [#2972]: this class should expose observedAttributes as necessary
8472
8505
  class UpgradableConstructor extends HTMLElement {
8473
- constructor(upgradeCallback) {
8506
+ constructor(upgradeCallback, useNativeLifecycle) {
8474
8507
  super();
8508
+ if (useNativeLifecycle) {
8509
+ // When in native lifecycle mode, we need to keep track of instances that were created outside LWC
8510
+ // (i.e. not created by `lwc.createElement()`). If the element uses synthetic lifecycle, then we don't
8511
+ // need to track this.
8512
+ nativeLifecycleElementsToUpgradedByLWC.set(this, elementBeingUpgradedByLWC);
8513
+ }
8475
8514
  // If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
8476
- // then elementBeingUpgraded will be false
8515
+ // then elementBeingUpgradedByLWC will be false
8477
8516
  if (elementBeingUpgradedByLWC) {
8478
8517
  upgradeCallback(this);
8479
- } else if (!isUndefined$1(lifecycleCallbacks)) {
8480
- // If this element has any lifecycle callbacks, then we need to keep track of
8481
- // instances that were created outside LWC (i.e. not created by `lwc.createElement()`).
8482
- // If the element has no connected or disconnected callbacks, then we don't need to track this.
8483
- elementsUpgradedOutsideLWC.add(this);
8484
- // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
8485
- // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
8486
8518
  }
8519
+ // TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
8520
+ // Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
8487
8521
  }
8488
- /*LWC compiler v5.3.0*/
8522
+ /*LWC compiler v6.0.0*/
8489
8523
  }
8490
8524
  UpgradableConstructor.formAssociated = true;
8491
- // Do not unnecessarily add a connectedCallback/disconnectedCallback/etc., as it introduces perf overhead
8492
- // See: https://github.com/salesforce/lwc/pull/3162#issuecomment-1311851174
8493
- if (!isUndefined$1(lifecycleCallbacks)) {
8494
- for (const [propName, callback] of entries(lifecycleCallbacks)) {
8495
- UpgradableConstructor.prototype[propName] = function () {
8496
- if (!elementsUpgradedOutsideLWC.has(this)) {
8497
- callback(this);
8498
- }
8499
- };
8500
- }
8525
+ for (const [propName, callback] of entries(LIFECYCLE_CALLBACKS)) {
8526
+ UpgradableConstructor.prototype[propName] = function () {
8527
+ // If the element is in the WeakMap (i.e. it's marked as native lifecycle), and if it was upgraded by LWC,
8528
+ // then it can use native lifecycle
8529
+ if (isTrue(nativeLifecycleElementsToUpgradedByLWC.get(this))) {
8530
+ callback(this);
8531
+ }
8532
+ };
8501
8533
  }
8502
8534
  return UpgradableConstructor;
8503
8535
  };
@@ -8513,11 +8545,11 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
8513
8545
  }
8514
8546
  return UpgradableConstructor;
8515
8547
  }
8516
- const createCustomElement = (tagName, upgradeCallback) => {
8548
+ const createCustomElement = (tagName, upgradeCallback, useNativeLifecycle) => {
8517
8549
  const UpgradableConstructor = getUpgradableConstructor(tagName);
8518
8550
  elementBeingUpgradedByLWC = true;
8519
8551
  try {
8520
- return new UpgradableConstructor(upgradeCallback);
8552
+ return new UpgradableConstructor(upgradeCallback, useNativeLifecycle);
8521
8553
  } finally {
8522
8554
  elementBeingUpgradedByLWC = false;
8523
8555
  }
@@ -8581,7 +8613,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
8581
8613
  function isNull(obj) {
8582
8614
  return obj === null;
8583
8615
  }
8584
- /** version: 5.3.0 */
8616
+ /** version: 6.0.0 */
8585
8617
 
8586
8618
  /*
8587
8619
  * Copyright (c) 2023, salesforce.com, inc.
@@ -8601,7 +8633,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
8601
8633
  this.setNewContext = setNewContext;
8602
8634
  this.setDisconnectedCallback = setDisconnectedCallback;
8603
8635
  }
8604
- /*LWC compiler v5.3.0*/
8636
+ /*LWC compiler v6.0.0*/
8605
8637
  }
8606
8638
  function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
8607
8639
  dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
@@ -8981,7 +9013,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
8981
9013
  attributeChangedCallback(name, oldValue, newValue) {
8982
9014
  attributeChangedCallback.call(this, name, oldValue, newValue);
8983
9015
  }
8984
- /*LWC compiler v5.3.0*/
9016
+ /*LWC compiler v6.0.0*/
8985
9017
  }, _a.observedAttributes = observedAttributes, _a;
8986
9018
  }
8987
9019
 
@@ -9006,7 +9038,13 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
9006
9038
  }
9007
9039
  return node; // for convenience
9008
9040
  }
9009
- if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
9041
+ let monkeyPatched = false;
9042
+ function monkeyPatchDomAPIs() {
9043
+ if (monkeyPatched) {
9044
+ // don't double-patch
9045
+ return;
9046
+ }
9047
+ monkeyPatched = true;
9010
9048
  // Monkey patching Node methods to be able to detect the insertions and removal of root elements
9011
9049
  // created via createElement.
9012
9050
  const {
@@ -9062,6 +9100,10 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
9062
9100
  // passing `sel` as a camel-case, which makes them invalid custom elements name
9063
9101
  // the following line guarantees that this does not leaks beyond this point.
9064
9102
  const tagName = StringToLowerCase.call(sel);
9103
+ const apiVersion = getComponentAPIVersion(Ctor);
9104
+ const useNativeCustomElementLifecycle =
9105
+ // temporary "kill switch"
9106
+ !lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE && isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
9065
9107
  // the custom element from the registry is expecting an upgrade callback
9066
9108
  /**
9067
9109
  * Note: if the upgradable constructor does not expect, or throw when we new it
@@ -9075,13 +9117,15 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
9075
9117
  mode: options.mode !== 'closed' ? 'open' : 'closed',
9076
9118
  owner: null
9077
9119
  });
9078
- if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
9120
+ if (!useNativeCustomElementLifecycle) {
9121
+ // Monkey-patch on-demand, because if there are no components on the page using an old API
9122
+ // version, then we don't want to monkey patch at all
9123
+ monkeyPatchDomAPIs();
9079
9124
  ConnectingSlot.set(elm, connectRootElement);
9080
9125
  DisconnectingSlot.set(elm, disconnectRootElement);
9081
9126
  }
9082
9127
  };
9083
- const element = createCustomElement(tagName, upgradeCallback);
9084
- return element;
9128
+ return createCustomElement(tagName, upgradeCallback, useNativeCustomElementLifecycle);
9085
9129
  }
9086
9130
 
9087
9131
  /*
@@ -9184,7 +9228,7 @@ LWR.define('lwc/v/5_3_0', ['exports'], (function (exports) { 'use strict';
9184
9228
  });
9185
9229
  });
9186
9230
  }
9187
- /** version: 5.3.0 */
9231
+ /** version: 6.0.0 */
9188
9232
 
9189
9233
  exports.LightningElement = LightningElement;
9190
9234
  exports.__unstable__ProfilerControl = profilerControl;
@@ -1,10 +1,10 @@
1
- LWR.define('lwr/everywhereAmd/v/0_12_0-alpha_4', ['exports', 'lwr/vault/v/0_12_0-alpha_4'], (function (exports, _0_12_0Alpha_4) { 'use strict';
1
+ LWR.define('lwr/everywhereAmd/v/0_12_0-alpha_6', ['exports', 'lwr/vault/v/0_12_0-alpha_6'], (function (exports, _0_12_0Alpha_6) { 'use strict';
2
2
 
3
3
  // IMPORTANT: Do not add any static imports to this file that are not bundled with the amd-client
4
4
 
5
5
  // Do an OAuthed fetch
6
6
  async function authFetch(url, accept = 'javascript') {
7
- const authInfo = _0_12_0Alpha_4.getAuthInfo();
7
+ const authInfo = _0_12_0Alpha_6.getAuthInfo();
8
8
  if (authInfo) {
9
9
  return fetch(url, {
10
10
  headers: {
@@ -53,7 +53,7 @@ LWR.define('lwr/everywhereAmd/v/0_12_0-alpha_4', ['exports', 'lwr/vault/v/0_12_0
53
53
  function authenticate(authInfo) {
54
54
  // Put OAuth info into the vault
55
55
  if (authInfo) {
56
- _0_12_0Alpha_4.setAuthInfo(authInfo);
56
+ _0_12_0Alpha_6.setAuthInfo(authInfo);
57
57
  }
58
58
  }
59
59