lwc 2.22.0 → 2.23.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 (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +1222 -947
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +1222 -946
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +1129 -882
  5. package/dist/engine-dom/iife/es5/engine-dom.js +524 -499
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +475 -457
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +1222 -946
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +1129 -882
  11. package/dist/engine-dom/umd/es5/engine-dom.js +524 -499
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +475 -457
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +809 -626
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +809 -626
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +30 -27
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +30 -27
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +29 -26
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +32 -31
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +31 -30
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +30 -27
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +29 -26
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +32 -31
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +31 -30
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  34. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  36. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  37. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  39. package/package.json +7 -7
@@ -299,9 +299,13 @@ function htmlPropertyToAttribute(propName) {
299
299
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
300
300
  */
301
301
  // Increment whenever the LWC template compiler changes
302
- const LWC_VERSION = "2.22.0";
302
+ const LWC_VERSION = "2.23.2";
303
303
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
304
- /** version: 2.22.0 */
304
+ /** version: 2.23.2 */
305
+
306
+ /**
307
+ * Copyright (C) 2018 salesforce.com, inc.
308
+ */
305
309
 
306
310
  /*
307
311
  * Copyright (c) 2018, salesforce.com, inc.
@@ -310,7 +314,7 @@ const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
310
314
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
311
315
  */
312
316
  function detect(propName) {
313
- return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;
317
+ return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
314
318
  }
315
319
 
316
320
  /*
@@ -379,6 +383,7 @@ for (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1)
379
383
  patch$1(propName);
380
384
  }
381
385
  }
386
+ /** version: 2.23.2 */
382
387
 
383
388
  /**
384
389
  * Copyright (C) 2018 salesforce.com, inc.
@@ -398,6 +403,7 @@ const features = {
398
403
  ENABLE_HTML_COLLECTIONS_PATCH: null,
399
404
  ENABLE_INNER_OUTER_TEXT_PATCH: null,
400
405
  ENABLE_MIXED_SHADOW_MODE: null,
406
+ ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
401
407
  ENABLE_NODE_LIST_PATCH: null,
402
408
  ENABLE_NODE_PATCH: null,
403
409
  ENABLE_REACTIVE_SETTER: null,
@@ -406,7 +412,7 @@ const features = {
406
412
  if (!_globalThis.lwcRuntimeFlags) {
407
413
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', { value: create(null) });
408
414
  }
409
- const runtimeFlags = _globalThis.lwcRuntimeFlags;
415
+ const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
410
416
  /**
411
417
  * Set the value at runtime of a given feature flag. This method only be invoked once per feature
412
418
  * flag. It is meant to be used during the app initialization.
@@ -433,17 +439,17 @@ function setFeatureFlag(name, value) {
433
439
  }
434
440
  if (process.env.NODE_ENV !== 'production') {
435
441
  // Allow the same flag to be set more than once outside of production to enable testing
436
- runtimeFlags[name] = value;
442
+ lwcRuntimeFlags[name] = value;
437
443
  }
438
444
  else {
439
445
  // Disallow the same flag to be set more than once in production
440
- const runtimeValue = runtimeFlags[name];
446
+ const runtimeValue = lwcRuntimeFlags[name];
441
447
  if (!isUndefined$1(runtimeValue)) {
442
448
  // eslint-disable-next-line no-console
443
449
  console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
444
450
  return;
445
451
  }
446
- defineProperty(runtimeFlags, name, { value });
452
+ defineProperty(lwcRuntimeFlags, name, { value });
447
453
  }
448
454
  }
449
455
  /**
@@ -455,7 +461,7 @@ function setFeatureFlagForTest(name, value) {
455
461
  setFeatureFlag(name, value);
456
462
  }
457
463
  }
458
- /** version: 2.22.0 */
464
+ /** version: 2.23.2 */
459
465
 
460
466
  /*
461
467
  * Copyright (c) 2018, salesforce.com, inc.
@@ -469,7 +475,7 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
469
475
  window.addEventListener('test-dummy-flag', () => {
470
476
  let hasFlag = false;
471
477
 
472
- if (runtimeFlags.DUMMY_TEST_FLAG) {
478
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
473
479
  hasFlag = true;
474
480
  }
475
481
 
@@ -496,7 +502,7 @@ if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
496
502
  window.addEventListener('test-dummy-flag', () => {
497
503
  let hasFlag = false;
498
504
 
499
- if (runtimeFlags.DUMMY_TEST_FLAG) {
505
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
500
506
  hasFlag = true;
501
507
  }
502
508
 
@@ -804,8 +810,8 @@ function isCircularModuleDependency(obj) {
804
810
  */
805
811
  // This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
806
812
  // to inject at runtime.
807
- const HTMLElementConstructor$1 = typeof HTMLElement !== 'undefined' ? HTMLElement : function () { };
808
- const HTMLElementPrototype = HTMLElementConstructor$1.prototype;
813
+ const HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () { };
814
+ const HTMLElementPrototype = HTMLElementConstructor.prototype;
809
815
 
810
816
  /*
811
817
  * Copyright (c) 2018, salesforce.com, inc.
@@ -1260,6 +1266,14 @@ function patchLightningElementPrototypeWithRestrictions(proto) {
1260
1266
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
1261
1267
  }
1262
1268
 
1269
+ function updateComponentValue(vm, key, newValue) {
1270
+ const { cmpFields } = vm;
1271
+ if (newValue !== cmpFields[key]) {
1272
+ cmpFields[key] = newValue;
1273
+ componentValueMutated(vm, key);
1274
+ }
1275
+ }
1276
+
1263
1277
  /**
1264
1278
  * Copyright (C) 2017 salesforce.com, inc.
1265
1279
  */
@@ -1892,10 +1906,7 @@ function createBridgeToElementDescriptor(propName, descriptor) {
1892
1906
  assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1893
1907
  assert.invariant(!isObject(newValue) || isNull(newValue), `Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
1894
1908
  }
1895
- if (newValue !== vm.cmpProps[propName]) {
1896
- vm.cmpProps[propName] = newValue;
1897
- componentValueMutated(vm, propName);
1898
- }
1909
+ updateComponentValue(vm, propName, newValue);
1899
1910
  return set.call(vm.elm, newValue);
1900
1911
  },
1901
1912
  };
@@ -2190,10 +2201,7 @@ function createObservedFieldPropertyDescriptor(key) {
2190
2201
  },
2191
2202
  set(newValue) {
2192
2203
  const vm = getAssociatedVM(this);
2193
- if (newValue !== vm.cmpFields[key]) {
2194
- vm.cmpFields[key] = newValue;
2195
- componentValueMutated(vm, key);
2196
- }
2204
+ updateComponentValue(vm, key, newValue);
2197
2205
  },
2198
2206
  enumerable: true,
2199
2207
  configurable: true,
@@ -2322,7 +2330,7 @@ function createPublicAccessorDescriptor(key, descriptor) {
2322
2330
  }
2323
2331
 
2324
2332
  if (set) {
2325
- if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
2333
+ if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
2326
2334
  let ro = vm.oar[key];
2327
2335
 
2328
2336
  if (isUndefined$1(ro)) {
@@ -2380,10 +2388,7 @@ function internalTrackDecorator(key) {
2380
2388
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2381
2389
  }
2382
2390
  const reactiveOrAnyValue = getReactiveProxy(newValue);
2383
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2384
- vm.cmpFields[key] = reactiveOrAnyValue;
2385
- componentValueMutated(vm, key);
2386
- }
2391
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2387
2392
  },
2388
2393
  enumerable: true,
2389
2394
  configurable: true,
@@ -2422,10 +2427,7 @@ function internalWireFieldDecorator(key) {
2422
2427
  * letting the author to do the wrong thing, but it will keep our
2423
2428
  * system to be backward compatible.
2424
2429
  */
2425
- if (value !== vm.cmpFields[key]) {
2426
- vm.cmpFields[key] = value;
2427
- componentValueMutated(vm, key);
2428
- }
2430
+ updateComponentValue(vm, key, value);
2429
2431
  },
2430
2432
  enumerable: true,
2431
2433
  configurable: true,
@@ -2886,7 +2888,7 @@ function HTMLBridgeElementFactory(SuperClass, props, methods) {
2886
2888
  defineProperties(HTMLBridgeElement.prototype, descriptors);
2887
2889
  return HTMLBridgeElement;
2888
2890
  }
2889
- const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2891
+ const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2890
2892
  freeze(BaseBridgeElement);
2891
2893
  seal(BaseBridgeElement.prototype);
2892
2894
 
@@ -2980,7 +2982,7 @@ function getTemplateOrSwappedTemplate(tpl) {
2980
2982
  throw new ReferenceError();
2981
2983
  }
2982
2984
 
2983
- if (runtimeFlags.ENABLE_HMR) {
2985
+ if (lwcRuntimeFlags.ENABLE_HMR) {
2984
2986
  const visited = new Set();
2985
2987
 
2986
2988
  while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
@@ -2997,7 +2999,7 @@ function getComponentOrSwappedComponent(Ctor) {
2997
2999
  throw new ReferenceError();
2998
3000
  }
2999
3001
 
3000
- if (runtimeFlags.ENABLE_HMR) {
3002
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3001
3003
  const visited = new Set();
3002
3004
 
3003
3005
  while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
@@ -3014,7 +3016,7 @@ function getStyleOrSwappedStyle(style) {
3014
3016
  throw new ReferenceError();
3015
3017
  }
3016
3018
 
3017
- if (runtimeFlags.ENABLE_HMR) {
3019
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3018
3020
  const visited = new Set();
3019
3021
 
3020
3022
  while (swappedStyleMap.has(style) && !visited.has(style)) {
@@ -3031,7 +3033,7 @@ function setActiveVM(vm) {
3031
3033
  throw new ReferenceError();
3032
3034
  }
3033
3035
 
3034
- if (runtimeFlags.ENABLE_HMR) {
3036
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3035
3037
  // tracking active component
3036
3038
  const Ctor = vm.def.ctor;
3037
3039
  let componentVMs = activeComponents.get(Ctor);
@@ -3088,7 +3090,7 @@ function removeActiveVM(vm) {
3088
3090
  throw new ReferenceError();
3089
3091
  }
3090
3092
 
3091
- if (runtimeFlags.ENABLE_HMR) {
3093
+ if (lwcRuntimeFlags.ENABLE_HMR) {
3092
3094
  // tracking inactive component
3093
3095
  const Ctor = vm.def.ctor;
3094
3096
  let list = activeComponents.get(Ctor);
@@ -3135,7 +3137,7 @@ function swapTemplate(oldTpl, newTpl) {
3135
3137
  }
3136
3138
  }
3137
3139
 
3138
- if (!runtimeFlags.ENABLE_HMR) {
3140
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3139
3141
  throw new Error('HMR is not enabled');
3140
3142
  }
3141
3143
 
@@ -3151,7 +3153,7 @@ function swapComponent(oldComponent, newComponent) {
3151
3153
  }
3152
3154
  }
3153
3155
 
3154
- if (!runtimeFlags.ENABLE_HMR) {
3156
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3155
3157
  throw new Error('HMR is not enabled');
3156
3158
  }
3157
3159
 
@@ -3165,7 +3167,7 @@ function swapStyle(oldStyle, newStyle) {
3165
3167
  return rehydrateHotStyle(oldStyle);
3166
3168
  }
3167
3169
 
3168
- if (!runtimeFlags.ENABLE_HMR) {
3170
+ if (!lwcRuntimeFlags.ENABLE_HMR) {
3169
3171
  throw new Error('HMR is not enabled');
3170
3172
  }
3171
3173
 
@@ -3514,13 +3516,13 @@ function getNearestNativeShadowComponent(vm) {
3514
3516
  return owner;
3515
3517
  }
3516
3518
  function createStylesheet(vm, stylesheets) {
3517
- const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
3519
+ const { renderMode, shadowMode, renderer: { insertStylesheet }, } = vm;
3518
3520
  if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
3519
3521
  for (let i = 0; i < stylesheets.length; i++) {
3520
3522
  insertStylesheet(stylesheets[i]);
3521
3523
  }
3522
3524
  }
3523
- else if (ssr || vm.hydrated) {
3525
+ else if (vm.hydrated) {
3524
3526
  // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3525
3527
  // This works in the client, because the stylesheets are created, and cached in the VM
3526
3528
  // the first time the VM renders.
@@ -3545,30 +3547,67 @@ function createStylesheet(vm, stylesheets) {
3545
3547
  * SPDX-License-Identifier: MIT
3546
3548
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3547
3549
  */
3550
+
3551
+ function checkHasVM(elm) {
3552
+ const hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
3553
+
3554
+ if (process.env.NODE_ENV !== 'production' && !hasVM) {
3555
+ // Occurs when an element is manually created with the same tag name as an existing LWC component. In that case,
3556
+ // we skip calling the LWC connectedCallback/disconnectedCallback logic and log an error.
3557
+ logError(`VM for tag name "${elm.tagName.toLowerCase()}" is undefined. ` + `This indicates that an element was created with this tag name, ` + `which is already reserved by an LWC component. Use lwc.createElement ` + `instead to create elements.`);
3558
+ }
3559
+
3560
+ return hasVM;
3561
+ }
3562
+
3548
3563
  function getUpgradableConstructor(tagName, renderer) {
3549
- const { getCustomElement, HTMLElementExported: RendererHTMLElement, defineCustomElement, } = renderer;
3550
- // Should never get a tag with upper case letter at this point, the compiler should
3551
- // produce only tags with lowercase letters
3552
- // But, for backwards compatibility, we will lower case the tagName
3553
- tagName = tagName.toLowerCase();
3554
- let CE = getCustomElement(tagName);
3555
- if (!isUndefined$1(CE)) {
3556
- return CE;
3564
+ const {
3565
+ getCustomElement,
3566
+ HTMLElementExported: RendererHTMLElement,
3567
+ defineCustomElement
3568
+ } = renderer; // Should never get a tag with upper case letter at this point, the compiler should
3569
+ // produce only tags with lowercase letters
3570
+ // But, for backwards compatibility, we will lower case the tagName
3571
+
3572
+ tagName = tagName.toLowerCase();
3573
+ let CE = getCustomElement(tagName);
3574
+
3575
+ if (!isUndefined$1(CE)) {
3576
+ return CE;
3577
+ }
3578
+ /**
3579
+ * LWC Upgradable Element reference to an element that was created
3580
+ * via the scoped registry mechanism, and that is ready to be upgraded.
3581
+ */
3582
+
3583
+
3584
+ CE = class LWCUpgradableElement extends RendererHTMLElement {
3585
+ constructor(upgradeCallback) {
3586
+ super();
3587
+
3588
+ if (isFunction$1(upgradeCallback)) {
3589
+ upgradeCallback(this); // nothing to do with the result for now
3590
+ }
3557
3591
  }
3558
- /**
3559
- * LWC Upgradable Element reference to an element that was created
3560
- * via the scoped registry mechanism, and that is ready to be upgraded.
3561
- */
3562
- CE = class LWCUpgradableElement extends RendererHTMLElement {
3563
- constructor(upgradeCallback) {
3564
- super();
3565
- if (isFunction$1(upgradeCallback)) {
3566
- upgradeCallback(this); // nothing to do with the result for now
3567
- }
3568
- }
3592
+
3593
+ };
3594
+
3595
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3596
+ CE.prototype.connectedCallback = function () {
3597
+ if (checkHasVM(this)) {
3598
+ connectRootElement(this);
3599
+ }
3569
3600
  };
3570
- defineCustomElement(tagName, CE);
3571
- return CE;
3601
+
3602
+ CE.prototype.disconnectedCallback = function () {
3603
+ if (checkHasVM(this)) {
3604
+ disconnectRootElement(this);
3605
+ }
3606
+ };
3607
+ }
3608
+
3609
+ defineCustomElement(tagName, CE);
3610
+ return CE;
3572
3611
  }
3573
3612
 
3574
3613
  /*
@@ -3656,6 +3695,14 @@ function patchProps(oldVnode, vnode, renderer) {
3656
3695
  // different than the one previously set.
3657
3696
  if (isFirstPatch ||
3658
3697
  cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
3698
+ // Additional verification if properties are supported by the element
3699
+ // Validation relies on html properties and public properties being defined on the element,
3700
+ // SSR has its own custom validation.
3701
+ if (process.env.NODE_ENV !== 'production') {
3702
+ if (!(key in elm)) {
3703
+ logWarn(`Unknown public property "${key}" of element <${elm.tagName.toLowerCase()}>. This is either a typo on the corresponding attribute "${htmlPropertyToAttribute(key)}", or the attribute does not exist in this browser or DOM implementation.`);
3704
+ }
3705
+ }
3659
3706
  setProperty(elm, key, cur);
3660
3707
  }
3661
3708
  }
@@ -3814,569 +3861,798 @@ function applyStaticStyleAttribute(vnode, renderer) {
3814
3861
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3815
3862
  */
3816
3863
  function patchChildren(c1, c2, parent, renderer) {
3817
- if (hasDynamicChildren(c2)) {
3818
- updateDynamicChildren(c1, c2, parent, renderer);
3819
- }
3820
- else {
3821
- updateStaticChildren(c1, c2, parent, renderer);
3822
- }
3864
+ if (hasDynamicChildren(c2)) {
3865
+ updateDynamicChildren(c1, c2, parent, renderer);
3866
+ } else {
3867
+ updateStaticChildren(c1, c2, parent, renderer);
3868
+ }
3823
3869
  }
3824
- function patch(n1, n2, renderer) {
3825
- var _a, _b;
3826
- if (n1 === n2) {
3827
- return;
3828
- }
3829
- if (process.env.NODE_ENV !== 'production') {
3830
- if (!isSameVnode(n1, n2)) {
3831
- throw new Error('Expected these VNodes to be the same: ' +
3832
- JSON.stringify({ sel: n1.sel, key: n1.key }) +
3833
- ', ' +
3834
- JSON.stringify({ sel: n2.sel, key: n2.key }));
3835
- }
3836
- }
3837
- switch (n2.type) {
3838
- case 0 /* VNodeType.Text */:
3839
- // VText has no special capability, fallback to the owner's renderer
3840
- patchText(n1, n2, renderer);
3841
- break;
3842
- case 1 /* VNodeType.Comment */:
3843
- // VComment has no special capability, fallback to the owner's renderer
3844
- patchComment(n1, n2, renderer);
3845
- break;
3846
- case 4 /* VNodeType.Static */:
3847
- n2.elm = n1.elm;
3848
- break;
3849
- case 2 /* VNodeType.Element */:
3850
- patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3851
- break;
3852
- case 3 /* VNodeType.CustomElement */:
3853
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3854
- break;
3870
+
3871
+ function patch(n1, n2, parent, renderer) {
3872
+ var _a, _b;
3873
+
3874
+ if (n1 === n2) {
3875
+ return;
3876
+ }
3877
+
3878
+ if (process.env.NODE_ENV !== 'production') {
3879
+ if (!isSameVnode(n1, n2)) {
3880
+ throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
3881
+ sel: n1.sel,
3882
+ key: n1.key
3883
+ }) + ', ' + JSON.stringify({
3884
+ sel: n2.sel,
3885
+ key: n2.key
3886
+ }));
3855
3887
  }
3888
+ }
3889
+
3890
+ switch (n2.type) {
3891
+ case 0
3892
+ /* VNodeType.Text */
3893
+ :
3894
+ // VText has no special capability, fallback to the owner's renderer
3895
+ patchText(n1, n2, renderer);
3896
+ break;
3897
+
3898
+ case 1
3899
+ /* VNodeType.Comment */
3900
+ :
3901
+ // VComment has no special capability, fallback to the owner's renderer
3902
+ patchComment(n1, n2, renderer);
3903
+ break;
3904
+
3905
+ case 4
3906
+ /* VNodeType.Static */
3907
+ :
3908
+ n2.elm = n1.elm;
3909
+ break;
3910
+
3911
+ case 2
3912
+ /* VNodeType.Element */
3913
+ :
3914
+ patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3915
+ break;
3916
+
3917
+ case 3
3918
+ /* VNodeType.CustomElement */
3919
+ :
3920
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3921
+ break;
3922
+ }
3856
3923
  }
3924
+
3857
3925
  function mount(node, parent, renderer, anchor) {
3858
- var _a, _b;
3859
- switch (node.type) {
3860
- case 0 /* VNodeType.Text */:
3861
- // VText has no special capability, fallback to the owner's renderer
3862
- mountText(node, parent, anchor, renderer);
3863
- break;
3864
- case 1 /* VNodeType.Comment */:
3865
- // VComment has no special capability, fallback to the owner's renderer
3866
- mountComment(node, parent, anchor, renderer);
3867
- break;
3868
- case 4 /* VNodeType.Static */:
3869
- // VStatic cannot have a custom renderer associated to them, using owner's renderer
3870
- mountStatic(node, parent, anchor, renderer);
3871
- break;
3872
- case 2 /* VNodeType.Element */:
3873
- // If the vnode data has a renderer override use it, else fallback to owner's renderer
3874
- mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3875
- break;
3876
- case 3 /* VNodeType.CustomElement */:
3877
- // If the vnode data has a renderer override use it, else fallback to owner's renderer
3878
- mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3879
- break;
3880
- }
3926
+ var _a, _b;
3927
+
3928
+ switch (node.type) {
3929
+ case 0
3930
+ /* VNodeType.Text */
3931
+ :
3932
+ // VText has no special capability, fallback to the owner's renderer
3933
+ mountText(node, parent, anchor, renderer);
3934
+ break;
3935
+
3936
+ case 1
3937
+ /* VNodeType.Comment */
3938
+ :
3939
+ // VComment has no special capability, fallback to the owner's renderer
3940
+ mountComment(node, parent, anchor, renderer);
3941
+ break;
3942
+
3943
+ case 4
3944
+ /* VNodeType.Static */
3945
+ :
3946
+ // VStatic cannot have a custom renderer associated to them, using owner's renderer
3947
+ mountStatic(node, parent, anchor, renderer);
3948
+ break;
3949
+
3950
+ case 2
3951
+ /* VNodeType.Element */
3952
+ :
3953
+ // If the vnode data has a renderer override use it, else fallback to owner's renderer
3954
+ mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3955
+ break;
3956
+
3957
+ case 3
3958
+ /* VNodeType.CustomElement */
3959
+ :
3960
+ // If the vnode data has a renderer override use it, else fallback to owner's renderer
3961
+ mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3962
+ break;
3963
+ }
3881
3964
  }
3965
+
3882
3966
  function patchText(n1, n2, renderer) {
3883
- n2.elm = n1.elm;
3884
- if (n2.text !== n1.text) {
3885
- updateTextContent(n2, renderer);
3886
- }
3967
+ n2.elm = n1.elm;
3968
+
3969
+ if (n2.text !== n1.text) {
3970
+ updateTextContent(n2, renderer);
3971
+ }
3887
3972
  }
3973
+
3888
3974
  function mountText(vnode, parent, anchor, renderer) {
3889
- const { owner } = vnode;
3890
- const { createText } = renderer;
3891
- const textNode = (vnode.elm = createText(vnode.text));
3892
- linkNodeToShadow(textNode, owner, renderer);
3893
- insertNode(textNode, parent, anchor, renderer);
3975
+ const {
3976
+ owner
3977
+ } = vnode;
3978
+ const {
3979
+ createText
3980
+ } = renderer;
3981
+ const textNode = vnode.elm = createText(vnode.text);
3982
+ linkNodeToShadow(textNode, owner, renderer);
3983
+ insertNode(textNode, parent, anchor, renderer);
3894
3984
  }
3985
+
3895
3986
  function patchComment(n1, n2, renderer) {
3896
- n2.elm = n1.elm;
3897
- // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3898
- // it is the case today.
3899
- if (n2.text !== n1.text) {
3900
- updateTextContent(n2, renderer);
3901
- }
3987
+ n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3988
+ // it is the case today.
3989
+
3990
+ if (n2.text !== n1.text) {
3991
+ updateTextContent(n2, renderer);
3992
+ }
3902
3993
  }
3994
+
3903
3995
  function mountComment(vnode, parent, anchor, renderer) {
3904
- const { owner } = vnode;
3905
- const { createComment } = renderer;
3906
- const commentNode = (vnode.elm = createComment(vnode.text));
3907
- linkNodeToShadow(commentNode, owner, renderer);
3908
- insertNode(commentNode, parent, anchor, renderer);
3996
+ const {
3997
+ owner
3998
+ } = vnode;
3999
+ const {
4000
+ createComment
4001
+ } = renderer;
4002
+ const commentNode = vnode.elm = createComment(vnode.text);
4003
+ linkNodeToShadow(commentNode, owner, renderer);
4004
+ insertNode(commentNode, parent, anchor, renderer);
3909
4005
  }
4006
+
3910
4007
  function mountElement(vnode, parent, anchor, renderer) {
3911
- const { sel, owner, data: { svg }, } = vnode;
3912
- const { createElement } = renderer;
3913
- const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
3914
- const elm = (vnode.elm = createElement(sel, namespace));
3915
- linkNodeToShadow(elm, owner, renderer);
3916
- applyStyleScoping(elm, owner, renderer);
3917
- applyDomManual(elm, vnode);
3918
- applyElementRestrictions(elm, vnode);
3919
- patchElementPropsAndAttrs$1(null, vnode, renderer);
3920
- insertNode(elm, parent, anchor, renderer);
3921
- mountVNodes(vnode.children, elm, renderer, null);
4008
+ const {
4009
+ sel,
4010
+ owner,
4011
+ data: {
4012
+ svg
4013
+ }
4014
+ } = vnode;
4015
+ const {
4016
+ createElement
4017
+ } = renderer;
4018
+ const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
4019
+ const elm = vnode.elm = createElement(sel, namespace);
4020
+ linkNodeToShadow(elm, owner, renderer);
4021
+ applyStyleScoping(elm, owner, renderer);
4022
+ applyDomManual(elm, vnode);
4023
+ applyElementRestrictions(elm, vnode);
4024
+ patchElementPropsAndAttrs$1(null, vnode, renderer);
4025
+ insertNode(elm, parent, anchor, renderer);
4026
+ mountVNodes(vnode.children, elm, renderer, null);
3922
4027
  }
4028
+
3923
4029
  function patchElement(n1, n2, renderer) {
3924
- const elm = (n2.elm = n1.elm);
3925
- patchElementPropsAndAttrs$1(n1, n2, renderer);
3926
- patchChildren(n1.children, n2.children, elm, renderer);
4030
+ const elm = n2.elm = n1.elm;
4031
+ patchElementPropsAndAttrs$1(n1, n2, renderer);
4032
+ patchChildren(n1.children, n2.children, elm, renderer);
3927
4033
  }
4034
+
3928
4035
  function mountStatic(vnode, parent, anchor, renderer) {
3929
- const { owner } = vnode;
3930
- const { cloneNode, isSyntheticShadowDefined } = renderer;
3931
- const elm = (vnode.elm = cloneNode(vnode.fragment, true));
3932
- linkNodeToShadow(elm, owner, renderer);
3933
- applyElementRestrictions(elm, vnode);
3934
- // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3935
- const { renderMode, shadowMode } = owner;
3936
- if (isSyntheticShadowDefined) {
3937
- if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
3938
- elm[KEY__SHADOW_STATIC] = true;
3939
- }
4036
+ const {
4037
+ owner
4038
+ } = vnode;
4039
+ const {
4040
+ cloneNode,
4041
+ isSyntheticShadowDefined
4042
+ } = renderer;
4043
+ const elm = vnode.elm = cloneNode(vnode.fragment, true);
4044
+ linkNodeToShadow(elm, owner, renderer);
4045
+ applyElementRestrictions(elm, vnode); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
4046
+
4047
+ const {
4048
+ renderMode,
4049
+ shadowMode
4050
+ } = owner;
4051
+
4052
+ if (isSyntheticShadowDefined) {
4053
+ if (shadowMode === 1
4054
+ /* ShadowMode.Synthetic */
4055
+ || renderMode === 0
4056
+ /* RenderMode.Light */
4057
+ ) {
4058
+ elm[KEY__SHADOW_STATIC] = true;
3940
4059
  }
3941
- insertNode(elm, parent, anchor, renderer);
4060
+ }
4061
+
4062
+ insertNode(elm, parent, anchor, renderer);
3942
4063
  }
4064
+
3943
4065
  function mountCustomElement(vnode, parent, anchor, renderer) {
3944
- const { sel, owner } = vnode;
3945
- const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
3946
- /**
3947
- * Note: if the upgradable constructor does not expect, or throw when we new it
3948
- * with a callback as the first argument, we could implement a more advanced
3949
- * mechanism that only passes that argument if the constructor is known to be
3950
- * an upgradable custom element.
3951
- */
3952
- let vm;
3953
- const elm = new UpgradableConstructor((elm) => {
3954
- // the custom element from the registry is expecting an upgrade callback
3955
- vm = createViewModelHook(elm, vnode, renderer);
3956
- });
3957
- vnode.elm = elm;
3958
- vnode.vm = vm;
3959
- linkNodeToShadow(elm, owner, renderer);
3960
- applyStyleScoping(elm, owner, renderer);
3961
- if (vm) {
3962
- allocateChildren(vnode, vm);
3963
- }
3964
- else if (vnode.ctor !== UpgradableConstructor) {
3965
- throw new TypeError(`Incorrect Component Constructor`);
3966
- }
3967
- patchElementPropsAndAttrs$1(null, vnode, renderer);
3968
- insertNode(elm, parent, anchor, renderer);
3969
- if (vm) {
4066
+ const {
4067
+ sel,
4068
+ owner
4069
+ } = vnode;
4070
+ const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
4071
+ /**
4072
+ * Note: if the upgradable constructor does not expect, or throw when we new it
4073
+ * with a callback as the first argument, we could implement a more advanced
4074
+ * mechanism that only passes that argument if the constructor is known to be
4075
+ * an upgradable custom element.
4076
+ */
4077
+
4078
+ let vm;
4079
+ const elm = new UpgradableConstructor(elm => {
4080
+ // the custom element from the registry is expecting an upgrade callback
4081
+ vm = createViewModelHook(elm, vnode, renderer);
4082
+ });
4083
+ vnode.elm = elm;
4084
+ vnode.vm = vm;
4085
+ linkNodeToShadow(elm, owner, renderer);
4086
+ applyStyleScoping(elm, owner, renderer);
4087
+
4088
+ if (vm) {
4089
+ allocateChildren(vnode, vm);
4090
+ } else if (vnode.ctor !== UpgradableConstructor) {
4091
+ throw new TypeError(`Incorrect Component Constructor`);
4092
+ }
4093
+
4094
+ patchElementPropsAndAttrs$1(null, vnode, renderer);
4095
+ insertNode(elm, parent, anchor, renderer);
4096
+
4097
+ if (vm) {
4098
+ {
4099
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3970
4100
  if (process.env.NODE_ENV !== 'production') {
3971
- assert.isTrue(vm.state === 0 /* VMState.created */, `${vm} cannot be recycled.`);
4101
+ // With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
4102
+ // noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
4103
+ assert.isTrue(vm.state === 0
4104
+ /* VMState.created */
4105
+ , `${vm} cannot be recycled.`);
3972
4106
  }
4107
+
3973
4108
  runConnectedCallback(vm);
4109
+ }
3974
4110
  }
3975
- mountVNodes(vnode.children, elm, renderer, null);
3976
- if (vm) {
3977
- appendVM(vm);
3978
- }
4111
+ }
4112
+
4113
+ mountVNodes(vnode.children, elm, renderer, null);
4114
+
4115
+ if (vm) {
4116
+ appendVM(vm);
4117
+ }
3979
4118
  }
3980
- function patchCustomElement(n1, n2, renderer) {
3981
- const elm = (n2.elm = n1.elm);
3982
- const vm = (n2.vm = n1.vm);
4119
+
4120
+ function patchCustomElement(n1, n2, parent, renderer) {
4121
+ if (n1.ctor !== n2.ctor) {
4122
+ // If the constructor, unmount the current component and mount a new one using the new
4123
+ // constructor.
4124
+ const anchor = renderer.nextSibling(n1.elm);
4125
+ unmount(n1, parent, renderer, true);
4126
+ mountCustomElement(n2, parent, anchor, renderer);
4127
+ } else {
4128
+ // Otherwise patch the existing component with new props/attrs/etc.
4129
+ const elm = n2.elm = n1.elm;
4130
+ const vm = n2.vm = n1.vm;
3983
4131
  patchElementPropsAndAttrs$1(n1, n2, renderer);
4132
+
3984
4133
  if (!isUndefined$1(vm)) {
3985
- // in fallback mode, the allocation will always set children to
3986
- // empty and delegate the real allocation to the slot elements
3987
- allocateChildren(n2, vm);
3988
- }
3989
- // in fallback mode, the children will be always empty, so, nothing
4134
+ // in fallback mode, the allocation will always set children to
4135
+ // empty and delegate the real allocation to the slot elements
4136
+ allocateChildren(n2, vm);
4137
+ } // in fallback mode, the children will be always empty, so, nothing
3990
4138
  // will happen, but in native, it does allocate the light dom
4139
+
4140
+
3991
4141
  patchChildren(n1.children, n2.children, elm, renderer);
4142
+
3992
4143
  if (!isUndefined$1(vm)) {
3993
- // this will probably update the shadowRoot, but only if the vm is in a dirty state
3994
- // this is important to preserve the top to bottom synchronous rendering phase.
3995
- rerenderVM(vm);
4144
+ // this will probably update the shadowRoot, but only if the vm is in a dirty state
4145
+ // this is important to preserve the top to bottom synchronous rendering phase.
4146
+ rerenderVM(vm);
3996
4147
  }
4148
+ }
3997
4149
  }
4150
+
3998
4151
  function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
3999
- for (; start < end; ++start) {
4000
- const vnode = vnodes[start];
4001
- if (isVNode(vnode)) {
4002
- mount(vnode, parent, renderer, anchor);
4003
- }
4152
+ for (; start < end; ++start) {
4153
+ const vnode = vnodes[start];
4154
+
4155
+ if (isVNode(vnode)) {
4156
+ mount(vnode, parent, renderer, anchor);
4004
4157
  }
4158
+ }
4005
4159
  }
4160
+
4006
4161
  function unmount(vnode, parent, renderer, doRemove = false) {
4007
- const { type, elm, sel } = vnode;
4008
- // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
4009
- // subtree root, is the only element worth unmounting from the subtree.
4010
- if (doRemove) {
4011
- // The vnode might or might not have a data.renderer associated to it
4012
- // but the removal used here is from the owner instead.
4013
- removeNode(elm, parent, renderer);
4014
- }
4015
- switch (type) {
4016
- case 2 /* VNodeType.Element */: {
4017
- // Slot content is removed to trigger slotchange event when removing slot.
4018
- // Only required for synthetic shadow.
4019
- const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
4020
- unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
4021
- break;
4022
- }
4023
- case 3 /* VNodeType.CustomElement */: {
4024
- const { vm } = vnode;
4025
- // No need to unmount the children here, `removeVM` will take care of removing the
4026
- // children.
4027
- if (!isUndefined$1(vm)) {
4028
- removeVM(vm);
4029
- }
4162
+ const {
4163
+ type,
4164
+ elm,
4165
+ sel
4166
+ } = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
4167
+ // subtree root, is the only element worth unmounting from the subtree.
4168
+
4169
+ if (doRemove) {
4170
+ // The vnode might or might not have a data.renderer associated to it
4171
+ // but the removal used here is from the owner instead.
4172
+ removeNode(elm, parent, renderer);
4173
+ }
4174
+
4175
+ switch (type) {
4176
+ case 2
4177
+ /* VNodeType.Element */
4178
+ :
4179
+ {
4180
+ // Slot content is removed to trigger slotchange event when removing slot.
4181
+ // Only required for synthetic shadow.
4182
+ const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1
4183
+ /* ShadowMode.Synthetic */
4184
+ ;
4185
+ unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
4186
+ break;
4187
+ }
4188
+
4189
+ case 3
4190
+ /* VNodeType.CustomElement */
4191
+ :
4192
+ {
4193
+ const {
4194
+ vm
4195
+ } = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
4196
+ // children.
4197
+
4198
+ if (!isUndefined$1(vm)) {
4199
+ removeVM(vm);
4030
4200
  }
4031
- }
4201
+ }
4202
+ }
4032
4203
  }
4204
+
4033
4205
  function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
4034
- for (; start < end; ++start) {
4035
- const ch = vnodes[start];
4036
- if (isVNode(ch)) {
4037
- unmount(ch, parent, renderer, doRemove);
4038
- }
4206
+ for (; start < end; ++start) {
4207
+ const ch = vnodes[start];
4208
+
4209
+ if (isVNode(ch)) {
4210
+ unmount(ch, parent, renderer, doRemove);
4039
4211
  }
4212
+ }
4040
4213
  }
4214
+
4041
4215
  function isVNode(vnode) {
4042
- return vnode != null;
4216
+ return vnode != null;
4043
4217
  }
4218
+
4044
4219
  function linkNodeToShadow(elm, owner, renderer) {
4045
- const { renderRoot, renderMode, shadowMode } = owner;
4046
- const { isSyntheticShadowDefined } = renderer;
4047
- // TODO [#1164]: this should eventually be done by the polyfill directly
4048
- if (isSyntheticShadowDefined) {
4049
- if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
4050
- elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
4051
- }
4220
+ const {
4221
+ renderRoot,
4222
+ renderMode,
4223
+ shadowMode
4224
+ } = owner;
4225
+ const {
4226
+ isSyntheticShadowDefined
4227
+ } = renderer; // TODO [#1164]: this should eventually be done by the polyfill directly
4228
+
4229
+ if (isSyntheticShadowDefined) {
4230
+ if (shadowMode === 1
4231
+ /* ShadowMode.Synthetic */
4232
+ || renderMode === 0
4233
+ /* RenderMode.Light */
4234
+ ) {
4235
+ elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
4052
4236
  }
4237
+ }
4053
4238
  }
4239
+
4054
4240
  function updateTextContent(vnode, renderer) {
4055
- const { elm, text } = vnode;
4056
- const { setText } = renderer;
4057
- if (process.env.NODE_ENV !== 'production') {
4058
- unlockDomMutation();
4059
- }
4060
- setText(elm, text);
4061
- if (process.env.NODE_ENV !== 'production') {
4062
- lockDomMutation();
4063
- }
4241
+ const {
4242
+ elm,
4243
+ text
4244
+ } = vnode;
4245
+ const {
4246
+ setText
4247
+ } = renderer;
4248
+
4249
+ if (process.env.NODE_ENV !== 'production') {
4250
+ unlockDomMutation();
4251
+ }
4252
+
4253
+ setText(elm, text);
4254
+
4255
+ if (process.env.NODE_ENV !== 'production') {
4256
+ lockDomMutation();
4257
+ }
4064
4258
  }
4259
+
4065
4260
  function insertNode(node, parent, anchor, renderer) {
4066
- if (process.env.NODE_ENV !== 'production') {
4067
- unlockDomMutation();
4068
- }
4069
- renderer.insert(node, parent, anchor);
4070
- if (process.env.NODE_ENV !== 'production') {
4071
- lockDomMutation();
4072
- }
4261
+ if (process.env.NODE_ENV !== 'production') {
4262
+ unlockDomMutation();
4263
+ }
4264
+
4265
+ renderer.insert(node, parent, anchor);
4266
+
4267
+ if (process.env.NODE_ENV !== 'production') {
4268
+ lockDomMutation();
4269
+ }
4073
4270
  }
4271
+
4074
4272
  function removeNode(node, parent, renderer) {
4075
- if (process.env.NODE_ENV !== 'production') {
4076
- unlockDomMutation();
4077
- }
4078
- renderer.remove(node, parent);
4079
- if (process.env.NODE_ENV !== 'production') {
4080
- lockDomMutation();
4081
- }
4273
+ if (process.env.NODE_ENV !== 'production') {
4274
+ unlockDomMutation();
4275
+ }
4276
+
4277
+ renderer.remove(node, parent);
4278
+
4279
+ if (process.env.NODE_ENV !== 'production') {
4280
+ lockDomMutation();
4281
+ }
4082
4282
  }
4283
+
4083
4284
  function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
4084
- if (isNull(oldVnode)) {
4085
- applyEventListeners(vnode, renderer);
4086
- applyStaticClassAttribute(vnode, renderer);
4087
- applyStaticStyleAttribute(vnode, renderer);
4088
- }
4089
- // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
4090
- // value is set before type=radio.
4091
- patchClassAttribute(oldVnode, vnode, renderer);
4092
- patchStyleAttribute(oldVnode, vnode, renderer);
4093
- patchAttributes(oldVnode, vnode, renderer);
4094
- patchProps(oldVnode, vnode, renderer);
4285
+ if (isNull(oldVnode)) {
4286
+ applyEventListeners(vnode, renderer);
4287
+ applyStaticClassAttribute(vnode, renderer);
4288
+ applyStaticStyleAttribute(vnode, renderer);
4289
+ } // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
4290
+ // value is set before type=radio.
4291
+
4292
+
4293
+ patchClassAttribute(oldVnode, vnode, renderer);
4294
+ patchStyleAttribute(oldVnode, vnode, renderer);
4295
+ patchAttributes(oldVnode, vnode, renderer);
4296
+ patchProps(oldVnode, vnode, renderer);
4095
4297
  }
4298
+
4096
4299
  function applyStyleScoping(elm, owner, renderer) {
4097
- // Set the class name for `*.scoped.css` style scoping.
4098
- const scopeToken = getScopeTokenClass(owner);
4099
- if (!isNull(scopeToken)) {
4100
- const { getClassList } = renderer;
4101
- // TODO [#2762]: this dot notation with add is probably problematic
4102
- // probably we should have a renderer api for just the add operation
4103
- getClassList(elm).add(scopeToken);
4104
- }
4105
- // Set property element for synthetic shadow DOM style scoping.
4106
- const { stylesheetToken: syntheticToken } = owner.context;
4107
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
4108
- elm.$shadowToken$ = syntheticToken;
4109
- }
4110
- }
4111
- function applyDomManual(elm, vnode) {
4112
- var _a;
4113
- const { owner, data: { context }, } = vnode;
4114
- if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual" /* LwcDomMode.Manual */) {
4115
- elm.$domManual$ = true;
4116
- }
4117
- }
4118
- function applyElementRestrictions(elm, vnode) {
4119
- var _a, _b;
4120
- if (process.env.NODE_ENV !== 'production') {
4121
- const isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
4122
- const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
4123
- patchElementWithRestrictions(elm, {
4124
- isPortal,
4125
- isLight,
4126
- });
4300
+ // Set the class name for `*.scoped.css` style scoping.
4301
+ const scopeToken = getScopeTokenClass(owner);
4302
+
4303
+ if (!isNull(scopeToken)) {
4304
+ const {
4305
+ getClassList
4306
+ } = renderer; // TODO [#2762]: this dot notation with add is probably problematic
4307
+ // probably we should have a renderer api for just the add operation
4308
+
4309
+ getClassList(elm).add(scopeToken);
4310
+ } // Set property element for synthetic shadow DOM style scoping.
4311
+
4312
+
4313
+ const {
4314
+ stylesheetToken: syntheticToken
4315
+ } = owner.context;
4316
+
4317
+ if (owner.shadowMode === 1
4318
+ /* ShadowMode.Synthetic */
4319
+ && !isUndefined$1(syntheticToken)) {
4320
+ elm.$shadowToken$ = syntheticToken;
4321
+ }
4322
+ }
4323
+
4324
+ function applyDomManual(elm, vnode) {
4325
+ var _a;
4326
+
4327
+ const {
4328
+ owner,
4329
+ data: {
4330
+ context
4127
4331
  }
4332
+ } = vnode;
4333
+
4334
+ if (owner.shadowMode === 1
4335
+ /* ShadowMode.Synthetic */
4336
+ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
4337
+ /* LwcDomMode.Manual */
4338
+ ) {
4339
+ elm.$domManual$ = true;
4340
+ }
4128
4341
  }
4342
+
4343
+ function applyElementRestrictions(elm, vnode) {
4344
+ var _a, _b;
4345
+
4346
+ if (process.env.NODE_ENV !== 'production') {
4347
+ const isPortal = vnode.type === 2
4348
+ /* VNodeType.Element */
4349
+ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual"
4350
+ /* LwcDomMode.Manual */
4351
+ ;
4352
+ const isLight = vnode.owner.renderMode === 0
4353
+ /* RenderMode.Light */
4354
+ ;
4355
+ patchElementWithRestrictions(elm, {
4356
+ isPortal,
4357
+ isLight
4358
+ });
4359
+ }
4360
+ }
4361
+
4129
4362
  function allocateChildren(vnode, vm) {
4130
- // A component with slots will re-render because:
4131
- // 1- There is a change of the internal state.
4132
- // 2- There is a change on the external api (ex: slots)
4133
- //
4134
- // In case #1, the vnodes in the cmpSlots will be reused since they didn't changed. This routine emptied the
4135
- // slotted children when those VCustomElement were rendered and therefore in subsequent calls to allocate children
4136
- // in a reused VCustomElement, there won't be any slotted children.
4137
- // For those cases, we will use the reference for allocated children stored when rendering the fresh VCustomElement.
4138
- //
4139
- // In case #2, we will always get a fresh VCustomElement.
4140
- const children = vnode.aChildren || vnode.children;
4141
- vm.aChildren = children;
4142
- const { renderMode, shadowMode } = vm;
4143
- if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
4144
- // slow path
4145
- allocateInSlot(vm, children);
4146
- // save the allocated children in case this vnode is reused.
4147
- vnode.aChildren = children;
4148
- // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
4149
- vnode.children = EmptyArray;
4150
- }
4363
+ // A component with slots will re-render because:
4364
+ // 1- There is a change of the internal state.
4365
+ // 2- There is a change on the external api (ex: slots)
4366
+ //
4367
+ // In case #1, the vnodes in the cmpSlots will be reused since they didn't changed. This routine emptied the
4368
+ // slotted children when those VCustomElement were rendered and therefore in subsequent calls to allocate children
4369
+ // in a reused VCustomElement, there won't be any slotted children.
4370
+ // For those cases, we will use the reference for allocated children stored when rendering the fresh VCustomElement.
4371
+ //
4372
+ // In case #2, we will always get a fresh VCustomElement.
4373
+ const children = vnode.aChildren || vnode.children;
4374
+ vm.aChildren = children;
4375
+ const {
4376
+ renderMode,
4377
+ shadowMode
4378
+ } = vm;
4379
+
4380
+ if (shadowMode === 1
4381
+ /* ShadowMode.Synthetic */
4382
+ || renderMode === 0
4383
+ /* RenderMode.Light */
4384
+ ) {
4385
+ // slow path
4386
+ allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
4387
+
4388
+ vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
4389
+
4390
+ vnode.children = EmptyArray;
4391
+ }
4151
4392
  }
4393
+
4152
4394
  function createViewModelHook(elm, vnode, renderer) {
4153
- let vm = getAssociatedVMIfPresent(elm);
4154
- // There is a possibility that a custom element is registered under tagName, in which case, the
4155
- // initialization is already carry on, and there is nothing else to do here since this hook is
4156
- // called right after invoking `document.createElement`.
4157
- if (!isUndefined$1(vm)) {
4158
- return vm;
4159
- }
4160
- const { sel, mode, ctor, owner } = vnode;
4161
- vm = createVM(elm, ctor, renderer, {
4162
- mode,
4163
- owner,
4164
- tagName: sel,
4165
- });
4166
- if (process.env.NODE_ENV !== 'production') {
4167
- assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
4168
- }
4395
+ let vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the
4396
+ // initialization is already carry on, and there is nothing else to do here since this hook is
4397
+ // called right after invoking `document.createElement`.
4398
+
4399
+ if (!isUndefined$1(vm)) {
4169
4400
  return vm;
4401
+ }
4402
+
4403
+ const {
4404
+ sel,
4405
+ mode,
4406
+ ctor,
4407
+ owner
4408
+ } = vnode;
4409
+ vm = createVM(elm, ctor, renderer, {
4410
+ mode,
4411
+ owner,
4412
+ tagName: sel
4413
+ });
4414
+
4415
+ if (process.env.NODE_ENV !== 'production') {
4416
+ assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
4417
+ }
4418
+
4419
+ return vm;
4170
4420
  }
4421
+
4171
4422
  function allocateInSlot(vm, children) {
4172
- var _a;
4173
- const { cmpSlots: oldSlots } = vm;
4174
- const cmpSlots = (vm.cmpSlots = create(null));
4175
- for (let i = 0, len = children.length; i < len; i += 1) {
4176
- const vnode = children[i];
4177
- if (isNull(vnode)) {
4178
- continue;
4179
- }
4180
- let slotName = '';
4181
- if (isVBaseElement(vnode)) {
4182
- slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';
4183
- }
4184
- const vnodes = (cmpSlots[slotName] = cmpSlots[slotName] || []);
4185
- ArrayPush$1.call(vnodes, vnode);
4186
- }
4187
- if (isFalse(vm.isDirty)) {
4188
- // We need to determine if the old allocation is really different from the new one
4189
- // and mark the vm as dirty
4190
- const oldKeys = keys(oldSlots);
4191
- if (oldKeys.length !== keys(cmpSlots).length) {
4192
- markComponentAsDirty(vm);
4193
- return;
4194
- }
4195
- for (let i = 0, len = oldKeys.length; i < len; i += 1) {
4196
- const key = oldKeys[i];
4197
- if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
4198
- markComponentAsDirty(vm);
4199
- return;
4200
- }
4201
- const oldVNodes = oldSlots[key];
4202
- const vnodes = cmpSlots[key];
4203
- for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
4204
- if (oldVNodes[j] !== vnodes[j]) {
4205
- markComponentAsDirty(vm);
4206
- return;
4207
- }
4208
- }
4423
+ var _a;
4424
+
4425
+ const {
4426
+ cmpSlots: oldSlots
4427
+ } = vm;
4428
+ const cmpSlots = vm.cmpSlots = create(null);
4429
+
4430
+ for (let i = 0, len = children.length; i < len; i += 1) {
4431
+ const vnode = children[i];
4432
+
4433
+ if (isNull(vnode)) {
4434
+ continue;
4435
+ }
4436
+
4437
+ let slotName = '';
4438
+
4439
+ if (isVBaseElement(vnode)) {
4440
+ slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';
4441
+ }
4442
+
4443
+ const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || [];
4444
+ ArrayPush$1.call(vnodes, vnode);
4445
+ }
4446
+
4447
+ if (isFalse(vm.isDirty)) {
4448
+ // We need to determine if the old allocation is really different from the new one
4449
+ // and mark the vm as dirty
4450
+ const oldKeys = keys(oldSlots);
4451
+
4452
+ if (oldKeys.length !== keys(cmpSlots).length) {
4453
+ markComponentAsDirty(vm);
4454
+ return;
4455
+ }
4456
+
4457
+ for (let i = 0, len = oldKeys.length; i < len; i += 1) {
4458
+ const key = oldKeys[i];
4459
+
4460
+ if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
4461
+ markComponentAsDirty(vm);
4462
+ return;
4463
+ }
4464
+
4465
+ const oldVNodes = oldSlots[key];
4466
+ const vnodes = cmpSlots[key];
4467
+
4468
+ for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
4469
+ if (oldVNodes[j] !== vnodes[j]) {
4470
+ markComponentAsDirty(vm);
4471
+ return;
4209
4472
  }
4473
+ }
4210
4474
  }
4211
- }
4212
- // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
4213
- const FromIteration = new WeakMap();
4214
- // dynamic children means it was generated by an iteration
4475
+ }
4476
+ } // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
4477
+
4478
+
4479
+ const FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration
4215
4480
  // in a template, and will require a more complex diffing algo.
4481
+
4216
4482
  function markAsDynamicChildren(children) {
4217
- FromIteration.set(children, 1);
4483
+ FromIteration.set(children, 1);
4218
4484
  }
4485
+
4219
4486
  function hasDynamicChildren(children) {
4220
- return FromIteration.has(children);
4487
+ return FromIteration.has(children);
4221
4488
  }
4489
+
4222
4490
  function createKeyToOldIdx(children, beginIdx, endIdx) {
4223
- const map = {};
4224
- // TODO [#1637]: simplify this by assuming that all vnodes has keys
4225
- for (let j = beginIdx; j <= endIdx; ++j) {
4226
- const ch = children[j];
4227
- if (isVNode(ch)) {
4228
- const { key } = ch;
4229
- if (key !== undefined) {
4230
- map[key] = j;
4231
- }
4232
- }
4491
+ const map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys
4492
+
4493
+ for (let j = beginIdx; j <= endIdx; ++j) {
4494
+ const ch = children[j];
4495
+
4496
+ if (isVNode(ch)) {
4497
+ const {
4498
+ key
4499
+ } = ch;
4500
+
4501
+ if (key !== undefined) {
4502
+ map[key] = j;
4503
+ }
4233
4504
  }
4234
- return map;
4505
+ }
4506
+
4507
+ return map;
4235
4508
  }
4509
+
4236
4510
  function updateDynamicChildren(oldCh, newCh, parent, renderer) {
4237
- let oldStartIdx = 0;
4238
- let newStartIdx = 0;
4239
- let oldEndIdx = oldCh.length - 1;
4240
- let oldStartVnode = oldCh[0];
4241
- let oldEndVnode = oldCh[oldEndIdx];
4242
- const newChEnd = newCh.length - 1;
4243
- let newEndIdx = newChEnd;
4244
- let newStartVnode = newCh[0];
4245
- let newEndVnode = newCh[newEndIdx];
4246
- let oldKeyToIdx;
4247
- let idxInOld;
4248
- let elmToMove;
4249
- let before;
4250
- let clonedOldCh = false;
4251
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
4252
- if (!isVNode(oldStartVnode)) {
4253
- oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
4254
- }
4255
- else if (!isVNode(oldEndVnode)) {
4256
- oldEndVnode = oldCh[--oldEndIdx];
4257
- }
4258
- else if (!isVNode(newStartVnode)) {
4259
- newStartVnode = newCh[++newStartIdx];
4260
- }
4261
- else if (!isVNode(newEndVnode)) {
4262
- newEndVnode = newCh[--newEndIdx];
4263
- }
4264
- else if (isSameVnode(oldStartVnode, newStartVnode)) {
4265
- patch(oldStartVnode, newStartVnode, renderer);
4266
- oldStartVnode = oldCh[++oldStartIdx];
4267
- newStartVnode = newCh[++newStartIdx];
4268
- }
4269
- else if (isSameVnode(oldEndVnode, newEndVnode)) {
4270
- patch(oldEndVnode, newEndVnode, renderer);
4271
- oldEndVnode = oldCh[--oldEndIdx];
4272
- newEndVnode = newCh[--newEndIdx];
4273
- }
4274
- else if (isSameVnode(oldStartVnode, newEndVnode)) {
4275
- // Vnode moved right
4276
- patch(oldStartVnode, newEndVnode, renderer);
4277
- insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
4278
- oldStartVnode = oldCh[++oldStartIdx];
4279
- newEndVnode = newCh[--newEndIdx];
4280
- }
4281
- else if (isSameVnode(oldEndVnode, newStartVnode)) {
4282
- // Vnode moved left
4283
- patch(oldEndVnode, newStartVnode, renderer);
4284
- insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
4285
- oldEndVnode = oldCh[--oldEndIdx];
4286
- newStartVnode = newCh[++newStartIdx];
4287
- }
4288
- else {
4289
- if (oldKeyToIdx === undefined) {
4290
- oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
4291
- }
4292
- idxInOld = oldKeyToIdx[newStartVnode.key];
4293
- if (isUndefined$1(idxInOld)) {
4294
- // New element
4295
- mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4296
- newStartVnode = newCh[++newStartIdx];
4297
- }
4298
- else {
4299
- elmToMove = oldCh[idxInOld];
4300
- if (isVNode(elmToMove)) {
4301
- if (elmToMove.sel !== newStartVnode.sel) {
4302
- // New element
4303
- mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4304
- }
4305
- else {
4306
- patch(elmToMove, newStartVnode, renderer);
4307
- // Delete the old child, but copy the array since it is read-only.
4308
- // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
4309
- // so we only care about the `oldCh` object inside this function.
4310
- // To avoid cloning over and over again, we check `clonedOldCh`
4311
- // and only clone once.
4312
- if (!clonedOldCh) {
4313
- clonedOldCh = true;
4314
- oldCh = [...oldCh];
4315
- }
4316
- // We've already cloned at least once, so it's no longer read-only
4317
- oldCh[idxInOld] = undefined;
4318
- insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
4319
- }
4320
- }
4321
- newStartVnode = newCh[++newStartIdx];
4322
- }
4511
+ let oldStartIdx = 0;
4512
+ let newStartIdx = 0;
4513
+ let oldEndIdx = oldCh.length - 1;
4514
+ let oldStartVnode = oldCh[0];
4515
+ let oldEndVnode = oldCh[oldEndIdx];
4516
+ const newChEnd = newCh.length - 1;
4517
+ let newEndIdx = newChEnd;
4518
+ let newStartVnode = newCh[0];
4519
+ let newEndVnode = newCh[newEndIdx];
4520
+ let oldKeyToIdx;
4521
+ let idxInOld;
4522
+ let elmToMove;
4523
+ let before;
4524
+ let clonedOldCh = false;
4525
+
4526
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
4527
+ if (!isVNode(oldStartVnode)) {
4528
+ oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
4529
+ } else if (!isVNode(oldEndVnode)) {
4530
+ oldEndVnode = oldCh[--oldEndIdx];
4531
+ } else if (!isVNode(newStartVnode)) {
4532
+ newStartVnode = newCh[++newStartIdx];
4533
+ } else if (!isVNode(newEndVnode)) {
4534
+ newEndVnode = newCh[--newEndIdx];
4535
+ } else if (isSameVnode(oldStartVnode, newStartVnode)) {
4536
+ patch(oldStartVnode, newStartVnode, parent, renderer);
4537
+ oldStartVnode = oldCh[++oldStartIdx];
4538
+ newStartVnode = newCh[++newStartIdx];
4539
+ } else if (isSameVnode(oldEndVnode, newEndVnode)) {
4540
+ patch(oldEndVnode, newEndVnode, parent, renderer);
4541
+ oldEndVnode = oldCh[--oldEndIdx];
4542
+ newEndVnode = newCh[--newEndIdx];
4543
+ } else if (isSameVnode(oldStartVnode, newEndVnode)) {
4544
+ // Vnode moved right
4545
+ patch(oldStartVnode, newEndVnode, parent, renderer);
4546
+ insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
4547
+ oldStartVnode = oldCh[++oldStartIdx];
4548
+ newEndVnode = newCh[--newEndIdx];
4549
+ } else if (isSameVnode(oldEndVnode, newStartVnode)) {
4550
+ // Vnode moved left
4551
+ patch(oldEndVnode, newStartVnode, parent, renderer);
4552
+ insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
4553
+ oldEndVnode = oldCh[--oldEndIdx];
4554
+ newStartVnode = newCh[++newStartIdx];
4555
+ } else {
4556
+ if (oldKeyToIdx === undefined) {
4557
+ oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
4558
+ }
4559
+
4560
+ idxInOld = oldKeyToIdx[newStartVnode.key];
4561
+
4562
+ if (isUndefined$1(idxInOld)) {
4563
+ // New element
4564
+ mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4565
+ newStartVnode = newCh[++newStartIdx];
4566
+ } else {
4567
+ elmToMove = oldCh[idxInOld];
4568
+
4569
+ if (isVNode(elmToMove)) {
4570
+ if (elmToMove.sel !== newStartVnode.sel) {
4571
+ // New element
4572
+ mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4573
+ } else {
4574
+ patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
4575
+ // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
4576
+ // so we only care about the `oldCh` object inside this function.
4577
+ // To avoid cloning over and over again, we check `clonedOldCh`
4578
+ // and only clone once.
4579
+
4580
+ if (!clonedOldCh) {
4581
+ clonedOldCh = true;
4582
+ oldCh = [...oldCh];
4583
+ } // We've already cloned at least once, so it's no longer read-only
4584
+
4585
+
4586
+ oldCh[idxInOld] = undefined;
4587
+ insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
4588
+ }
4323
4589
  }
4590
+
4591
+ newStartVnode = newCh[++newStartIdx];
4592
+ }
4324
4593
  }
4325
- if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
4326
- if (oldStartIdx > oldEndIdx) {
4327
- // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
4328
- // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
4329
- let i = newEndIdx;
4330
- let n;
4331
- do {
4332
- n = newCh[++i];
4333
- } while (!isVNode(n) && i < newChEnd);
4334
- before = isVNode(n) ? n.elm : null;
4335
- mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
4336
- }
4337
- else {
4338
- unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
4339
- }
4594
+ }
4595
+
4596
+ if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
4597
+ if (oldStartIdx > oldEndIdx) {
4598
+ // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
4599
+ // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
4600
+ let i = newEndIdx;
4601
+ let n;
4602
+
4603
+ do {
4604
+ n = newCh[++i];
4605
+ } while (!isVNode(n) && i < newChEnd);
4606
+
4607
+ before = isVNode(n) ? n.elm : null;
4608
+ mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
4609
+ } else {
4610
+ unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
4340
4611
  }
4612
+ }
4341
4613
  }
4614
+
4342
4615
  function updateStaticChildren(c1, c2, parent, renderer) {
4343
- const c1Length = c1.length;
4344
- const c2Length = c2.length;
4345
- if (c1Length === 0) {
4346
- // the old list is empty, we can directly insert anything new
4347
- mountVNodes(c2, parent, renderer, null);
4348
- return;
4349
- }
4350
- if (c2Length === 0) {
4351
- // the old list is nonempty and the new list is empty so we can directly remove all old nodes
4352
- // this is the case in which the dynamic children of an if-directive should be removed
4353
- unmountVNodes(c1, parent, renderer, true);
4354
- return;
4355
- }
4356
- // if the old list is not empty, the new list MUST have the same
4357
- // amount of nodes, that's why we call this static children
4358
- let anchor = null;
4359
- for (let i = c2Length - 1; i >= 0; i -= 1) {
4360
- const n1 = c1[i];
4361
- const n2 = c2[i];
4362
- if (n2 !== n1) {
4363
- if (isVNode(n1)) {
4364
- if (isVNode(n2)) {
4365
- // both vnodes are equivalent, and we just need to patch them
4366
- patch(n1, n2, renderer);
4367
- anchor = n2.elm;
4368
- }
4369
- else {
4370
- // removing the old vnode since the new one is null
4371
- unmount(n1, parent, renderer, true);
4372
- }
4373
- }
4374
- else if (isVNode(n2)) {
4375
- mount(n2, parent, renderer, anchor);
4376
- anchor = n2.elm;
4377
- }
4616
+ const c1Length = c1.length;
4617
+ const c2Length = c2.length;
4618
+
4619
+ if (c1Length === 0) {
4620
+ // the old list is empty, we can directly insert anything new
4621
+ mountVNodes(c2, parent, renderer, null);
4622
+ return;
4623
+ }
4624
+
4625
+ if (c2Length === 0) {
4626
+ // the old list is nonempty and the new list is empty so we can directly remove all old nodes
4627
+ // this is the case in which the dynamic children of an if-directive should be removed
4628
+ unmountVNodes(c1, parent, renderer, true);
4629
+ return;
4630
+ } // if the old list is not empty, the new list MUST have the same
4631
+ // amount of nodes, that's why we call this static children
4632
+
4633
+
4634
+ let anchor = null;
4635
+
4636
+ for (let i = c2Length - 1; i >= 0; i -= 1) {
4637
+ const n1 = c1[i];
4638
+ const n2 = c2[i];
4639
+
4640
+ if (n2 !== n1) {
4641
+ if (isVNode(n1)) {
4642
+ if (isVNode(n2)) {
4643
+ // both vnodes are equivalent, and we just need to patch them
4644
+ patch(n1, n2, parent, renderer);
4645
+ anchor = n2.elm;
4646
+ } else {
4647
+ // removing the old vnode since the new one is null
4648
+ unmount(n1, parent, renderer, true);
4378
4649
  }
4650
+ } else if (isVNode(n2)) {
4651
+ mount(n2, parent, renderer, anchor);
4652
+ anchor = n2.elm;
4653
+ }
4379
4654
  }
4655
+ }
4380
4656
  }
4381
4657
 
4382
4658
  /*
@@ -4697,13 +4973,6 @@ function fid(url) {
4697
4973
  }
4698
4974
  return url;
4699
4975
  }
4700
- /**
4701
- * Map to store an index value assigned to any dynamic component reference ingested
4702
- * by dc() api. This allows us to generate a unique unique per template per dynamic
4703
- * component reference to avoid diffing algo mismatches.
4704
- */
4705
- const DynamicImportedComponentMap = new Map();
4706
- let dynamicImportedComponentCounter = 0;
4707
4976
  /**
4708
4977
  * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
4709
4978
  */
@@ -4720,18 +4989,7 @@ function dc(sel, Ctor, data, children = EmptyArray) {
4720
4989
  if (!isComponentConstructor(Ctor)) {
4721
4990
  throw new Error(`Invalid LWC Constructor ${toString$1(Ctor)} for custom element <${sel}>.`);
4722
4991
  }
4723
- let idx = DynamicImportedComponentMap.get(Ctor);
4724
- if (isUndefined$1(idx)) {
4725
- idx = dynamicImportedComponentCounter++;
4726
- DynamicImportedComponentMap.set(Ctor, idx);
4727
- }
4728
- // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
4729
- // to identify different constructors as vnodes with different keys to avoid reusing the
4730
- // element used for previous constructors.
4731
- // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
4732
- // hoisting optimization.
4733
- const newData = Object.assign(Object.assign({}, data), { key: `dc:${idx}:${data.key}` });
4734
- return c(sel, Ctor, newData, children);
4992
+ return c(sel, Ctor, data, children);
4735
4993
  }
4736
4994
  /**
4737
4995
  * slow children collection marking mechanism. this API allows the compiler to signal
@@ -5457,7 +5715,7 @@ function createVM(elm, ctor, renderer, options) {
5457
5715
  return `[object:vm ${def.name} (${vm.idx})]`;
5458
5716
  };
5459
5717
 
5460
- if (runtimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
5718
+ if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
5461
5719
  vm.shadowMode = 0
5462
5720
  /* ShadowMode.Native */
5463
5721
  ;
@@ -5496,7 +5754,7 @@ function computeShadowMode(vm, renderer) {
5496
5754
  } else if (isNativeShadowDefined) {
5497
5755
  // Not combined with above condition because @lwc/features only supports identifiers in
5498
5756
  // the if-condition.
5499
- if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
5757
+ if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
5500
5758
  if (def.shadowSupportMode === "any"
5501
5759
  /* ShadowSupportMode.Any */
5502
5760
  ) {
@@ -5625,16 +5883,9 @@ function runRenderedCallback(vm) {
5625
5883
  const {
5626
5884
  def: {
5627
5885
  renderedCallback
5628
- },
5629
- renderer: {
5630
- ssr
5631
5886
  }
5632
5887
  } = vm;
5633
5888
 
5634
- if (isTrue(ssr)) {
5635
- return;
5636
- }
5637
-
5638
5889
  const {
5639
5890
  rendered
5640
5891
  } = Services;
@@ -5884,13 +6135,7 @@ function resetComponentRoot(vm) {
5884
6135
  vm.velements = EmptyArray;
5885
6136
  }
5886
6137
  function scheduleRehydration(vm) {
5887
- const {
5888
- renderer: {
5889
- ssr
5890
- }
5891
- } = vm;
5892
-
5893
- if (isTrue(ssr) || isTrue(vm.isScheduled)) {
6138
+ if (isTrue(vm.isScheduled)) {
5894
6139
  return;
5895
6140
  }
5896
6141
 
@@ -5997,15 +6242,8 @@ class WireContextRegistrationEvent extends CustomEvent {
5997
6242
  }
5998
6243
 
5999
6244
  function createFieldDataCallback(vm, name) {
6000
- const {
6001
- cmpFields
6002
- } = vm;
6003
6245
  return value => {
6004
- if (value !== vm.cmpFields[name]) {
6005
- // storing the value in the underlying storage
6006
- cmpFields[name] = value;
6007
- componentValueMutated(vm, name);
6008
- }
6246
+ updateComponentValue(vm, name, value);
6009
6247
  };
6010
6248
  }
6011
6249
 
@@ -6223,7 +6461,7 @@ function installWireAdapters(vm) {
6223
6461
  ArrayPush$1.call(wiredConnecting, () => {
6224
6462
  connector.connect();
6225
6463
 
6226
- if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
6464
+ if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
6227
6465
  if (hasDynamicParams) {
6228
6466
  Promise.resolve().then(computeConfigAndUpdate);
6229
6467
  return;
@@ -6369,6 +6607,7 @@ function hydrateNode(node, vnode, renderer) {
6369
6607
  }
6370
6608
  return renderer.nextSibling(hydratedNode);
6371
6609
  }
6610
+ const NODE_VALUE_PROP = 'nodeValue';
6372
6611
  function hydrateText(node, vnode, renderer) {
6373
6612
  var _a;
6374
6613
  if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
@@ -6376,7 +6615,7 @@ function hydrateText(node, vnode, renderer) {
6376
6615
  }
6377
6616
  if (process.env.NODE_ENV !== 'production') {
6378
6617
  const { getProperty } = renderer;
6379
- const nodeValue = getProperty(node, 'nodeValue');
6618
+ const nodeValue = getProperty(node, NODE_VALUE_PROP);
6380
6619
  if (nodeValue !== vnode.text && !(nodeValue === '\u200D' && vnode.text === '')) {
6381
6620
  logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);
6382
6621
  }
@@ -6393,13 +6632,13 @@ function hydrateComment(node, vnode, renderer) {
6393
6632
  }
6394
6633
  if (process.env.NODE_ENV !== 'production') {
6395
6634
  const { getProperty } = renderer;
6396
- const nodeValue = getProperty(node, 'nodeValue');
6635
+ const nodeValue = getProperty(node, NODE_VALUE_PROP);
6397
6636
  if (nodeValue !== vnode.text) {
6398
6637
  logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);
6399
6638
  }
6400
6639
  }
6401
6640
  const { setProperty } = renderer;
6402
- setProperty(node, 'nodeValue', (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6641
+ setProperty(node, NODE_VALUE_PROP, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
6403
6642
  vnode.elm = node;
6404
6643
  return node;
6405
6644
  }
@@ -6667,13 +6906,13 @@ function areCompatibleNodes(client, ssr, vnode, renderer) {
6667
6906
  if (!hasCorrectNodeType(vnode, ssr, 3 /* EnvNodeTypes.TEXT */, renderer)) {
6668
6907
  return false;
6669
6908
  }
6670
- return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
6909
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
6671
6910
  }
6672
6911
  if (getProperty(client, 'nodeType') === 8 /* EnvNodeTypes.COMMENT */) {
6673
6912
  if (!hasCorrectNodeType(vnode, ssr, 8 /* EnvNodeTypes.COMMENT */, renderer)) {
6674
6913
  return false;
6675
6914
  }
6676
- return getProperty(client, 'nodeValue') === getProperty(ssr, 'nodeValue');
6915
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
6677
6916
  }
6678
6917
  if (!hasCorrectNodeType(vnode, ssr, 1 /* EnvNodeTypes.ELEMENT */, renderer)) {
6679
6918
  return false;
@@ -6829,7 +7068,7 @@ function getComponentConstructor(elm) {
6829
7068
  }
6830
7069
  return ctor;
6831
7070
  }
6832
- /* version: 2.22.0 */
7071
+ /* version: 2.23.2 */
6833
7072
 
6834
7073
  /*
6835
7074
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6979,61 +7218,303 @@ function insertStylesheet(content, target) {
6979
7218
  * SPDX-License-Identifier: MIT
6980
7219
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6981
7220
  */
6982
- const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
6983
- let createFragment;
6984
- if (SUPPORTS_TEMPLATE) {
6985
- // Parse the fragment HTML string into DOM
6986
- createFragment = function (html) {
6987
- const template = document.createElement('template');
6988
- template.innerHTML = html;
6989
- return template.content.firstChild;
6990
- };
6991
- }
6992
- else {
6993
- // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
6994
- // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
6995
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
6996
- // With other elements added from:
6997
- // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
6998
- // Using the test:
6999
- // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
7000
- // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
7001
- const topLevelWrappingMap = {
7002
- caption: ['table'],
7003
- col: ['colgroup', 'table'],
7004
- colgroup: ['table'],
7005
- option: ['select'],
7006
- tbody: ['table'],
7007
- td: ['tr', 'tbody', 'table'],
7008
- th: ['tr', 'tbody', 'table'],
7009
- thead: ['table'],
7010
- tfoot: ['table'],
7011
- tr: ['tbody', 'table'],
7012
- };
7013
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
7014
- const getTagName = function (text) {
7015
- return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
7016
- };
7017
- // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
7018
- createFragment = function (html) {
7019
- const wrapperTags = topLevelWrappingMap[getTagName(html)];
7020
- if (!isUndefined$1(wrapperTags)) {
7021
- for (const wrapperTag of wrapperTags) {
7022
- html = `<${wrapperTag}>${html}</${wrapperTag}>`;
7221
+ /**
7222
+ * A factory function that produces a renderer.
7223
+ * Renderer encapsulates operations that are required to render an LWC component into the underlying
7224
+ * runtime environment. In the case of @lwc/enigne-dom, it is meant to be used in a DOM environment.
7225
+ * Example usage:
7226
+ * import { renderer, rendererFactory } from 'lwc';
7227
+ * const customRenderer = rendererFactory(renderer);
7228
+ *
7229
+ * @param baseRenderer Either null or the base renderer imported from 'lwc'.
7230
+ */
7231
+ function rendererFactory(baseRenderer) {
7232
+ // Util functions
7233
+ function assertInvariant(value, msg) {
7234
+ if (!value) {
7235
+ throw new Error(`Invariant Violation: ${msg}`);
7236
+ }
7237
+ }
7238
+ function isNull(obj) {
7239
+ return obj === null;
7240
+ }
7241
+ function isUndefined(obj) {
7242
+ return obj === undefined;
7243
+ }
7244
+ let getCustomElement;
7245
+ let defineCustomElement;
7246
+ let HTMLElementConstructor;
7247
+ function isCustomElementRegistryAvailable() {
7248
+ if (typeof customElements === 'undefined') {
7249
+ return false;
7250
+ }
7251
+ try {
7252
+ // dereference HTMLElement global because babel wraps globals in compat mode with a
7253
+ // _wrapNativeSuper()
7254
+ // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
7255
+ // get wrapped by babel.
7256
+ const HTMLElementAlias = HTMLElement;
7257
+ // In case we use compat mode with a modern browser, the compat mode transformation
7258
+ // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
7259
+ // which are not equipped to be initialized that way.
7260
+ class clazz extends HTMLElementAlias {
7023
7261
  }
7262
+ customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
7263
+ new clazz();
7264
+ return true;
7265
+ }
7266
+ catch (_a) {
7267
+ return false;
7024
7268
  }
7025
- // For IE11, the document title must not be undefined, but it can be an empty string
7026
- // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
7027
- const doc = document.implementation.createHTMLDocument('');
7028
- doc.body.innerHTML = html;
7029
- let content = doc.body;
7030
- if (!isUndefined$1(wrapperTags)) {
7031
- for (let i = 0; i < wrapperTags.length; i++) {
7032
- content = content.firstChild;
7269
+ }
7270
+ if (isCustomElementRegistryAvailable()) {
7271
+ getCustomElement = customElements.get.bind(customElements);
7272
+ defineCustomElement = customElements.define.bind(customElements);
7273
+ HTMLElementConstructor = HTMLElement;
7274
+ }
7275
+ else {
7276
+ const registry = Object.create(null);
7277
+ const reverseRegistry = new WeakMap();
7278
+ defineCustomElement = function define(name, ctor) {
7279
+ if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
7280
+ throw new TypeError(`Invalid Registration`);
7281
+ }
7282
+ registry[name] = ctor;
7283
+ reverseRegistry.set(ctor, name);
7284
+ };
7285
+ getCustomElement = function get(name) {
7286
+ return registry[name];
7287
+ };
7288
+ HTMLElementConstructor = function HTMLElement() {
7289
+ if (!(this instanceof HTMLElement)) {
7290
+ throw new TypeError(`Invalid Invocation`);
7291
+ }
7292
+ const { constructor } = this;
7293
+ const name = reverseRegistry.get(constructor);
7294
+ if (!name) {
7295
+ throw new TypeError(`Invalid Construction`);
7296
+ }
7297
+ const elm = document.createElement(name);
7298
+ Object.setPrototypeOf(elm, constructor.prototype);
7299
+ return elm;
7300
+ };
7301
+ HTMLElementConstructor.prototype = HTMLElement.prototype;
7302
+ }
7303
+ function cloneNode(node, deep) {
7304
+ return node.cloneNode(deep);
7305
+ }
7306
+ function createElement(tagName, namespace) {
7307
+ return isUndefined(namespace)
7308
+ ? document.createElement(tagName)
7309
+ : document.createElementNS(namespace, tagName);
7310
+ }
7311
+ function createText(content) {
7312
+ return document.createTextNode(content);
7313
+ }
7314
+ function createComment(content) {
7315
+ return document.createComment(content);
7316
+ }
7317
+ let createFragment;
7318
+ // IE11 lacks support for this feature
7319
+ const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
7320
+ if (SUPPORTS_TEMPLATE) {
7321
+ // Parse the fragment HTML string into DOM
7322
+ createFragment = function (html) {
7323
+ const template = document.createElement('template');
7324
+ template.innerHTML = html;
7325
+ return template.content.firstChild;
7326
+ };
7327
+ }
7328
+ else {
7329
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
7330
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
7331
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
7332
+ // With other elements added from:
7333
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
7334
+ // Using the test:
7335
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
7336
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
7337
+ const topLevelWrappingMap = {
7338
+ caption: ['table'],
7339
+ col: ['colgroup', 'table'],
7340
+ colgroup: ['table'],
7341
+ option: ['select'],
7342
+ tbody: ['table'],
7343
+ td: ['tr', 'tbody', 'table'],
7344
+ th: ['tr', 'tbody', 'table'],
7345
+ thead: ['table'],
7346
+ tfoot: ['table'],
7347
+ tr: ['tbody', 'table'],
7348
+ };
7349
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
7350
+ const getTagName = function (text) {
7351
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
7352
+ };
7353
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
7354
+ createFragment = function (html) {
7355
+ const wrapperTags = topLevelWrappingMap[getTagName(html)];
7356
+ if (!isUndefined(wrapperTags)) {
7357
+ for (const wrapperTag of wrapperTags) {
7358
+ html = `<${wrapperTag}>${html}</${wrapperTag}>`;
7359
+ }
7033
7360
  }
7361
+ // For IE11, the document title must not be undefined, but it can be an empty string
7362
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
7363
+ const doc = document.implementation.createHTMLDocument('');
7364
+ doc.body.innerHTML = html;
7365
+ let content = doc.body;
7366
+ if (!isUndefined(wrapperTags)) {
7367
+ for (let i = 0; i < wrapperTags.length; i++) {
7368
+ content = content.firstChild;
7369
+ }
7370
+ }
7371
+ return content.firstChild;
7372
+ };
7373
+ }
7374
+ function insert(node, parent, anchor) {
7375
+ parent.insertBefore(node, anchor);
7376
+ }
7377
+ function remove(node, parent) {
7378
+ parent.removeChild(node);
7379
+ }
7380
+ function nextSibling(node) {
7381
+ return node.nextSibling;
7382
+ }
7383
+ function attachShadow(element, options) {
7384
+ // `shadowRoot` will be non-null in two cases:
7385
+ // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
7386
+ // 2. when a webapp author places <c-app> in their static HTML and mounts their
7387
+ // root component with customElement.define('c-app', Ctor)
7388
+ if (!isNull(element.shadowRoot)) {
7389
+ return element.shadowRoot;
7390
+ }
7391
+ return element.attachShadow(options);
7392
+ }
7393
+ function setText(node, content) {
7394
+ node.nodeValue = content;
7395
+ }
7396
+ function getProperty(node, key) {
7397
+ return node[key];
7398
+ }
7399
+ function setProperty(node, key, value) {
7400
+ node[key] = value;
7401
+ }
7402
+ function getAttribute(element, name, namespace) {
7403
+ return isUndefined(namespace)
7404
+ ? element.getAttribute(name)
7405
+ : element.getAttributeNS(namespace, name);
7406
+ }
7407
+ function setAttribute(element, name, value, namespace) {
7408
+ return isUndefined(namespace)
7409
+ ? element.setAttribute(name, value)
7410
+ : element.setAttributeNS(namespace, name, value);
7411
+ }
7412
+ function removeAttribute(element, name, namespace) {
7413
+ if (isUndefined(namespace)) {
7414
+ element.removeAttribute(name);
7034
7415
  }
7035
- return content.firstChild;
7416
+ else {
7417
+ element.removeAttributeNS(namespace, name);
7418
+ }
7419
+ }
7420
+ function addEventListener(target, type, callback, options) {
7421
+ target.addEventListener(type, callback, options);
7422
+ }
7423
+ function removeEventListener(target, type, callback, options) {
7424
+ target.removeEventListener(type, callback, options);
7425
+ }
7426
+ function dispatchEvent(target, event) {
7427
+ return target.dispatchEvent(event);
7428
+ }
7429
+ function getClassList(element) {
7430
+ return element.classList;
7431
+ }
7432
+ function setCSSStyleProperty(element, name, value, important) {
7433
+ // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
7434
+ // represent elements in the engine?
7435
+ element.style.setProperty(name, value, important ? 'important' : '');
7436
+ }
7437
+ function getBoundingClientRect(element) {
7438
+ return element.getBoundingClientRect();
7439
+ }
7440
+ function querySelector(element, selectors) {
7441
+ return element.querySelector(selectors);
7442
+ }
7443
+ function querySelectorAll(element, selectors) {
7444
+ return element.querySelectorAll(selectors);
7445
+ }
7446
+ function getElementsByTagName(element, tagNameOrWildCard) {
7447
+ return element.getElementsByTagName(tagNameOrWildCard);
7448
+ }
7449
+ function getElementsByClassName(element, names) {
7450
+ return element.getElementsByClassName(names);
7451
+ }
7452
+ function getChildren(element) {
7453
+ return element.children;
7454
+ }
7455
+ function getChildNodes(element) {
7456
+ return element.childNodes;
7457
+ }
7458
+ function getFirstChild(element) {
7459
+ return element.firstChild;
7460
+ }
7461
+ function getFirstElementChild(element) {
7462
+ return element.firstElementChild;
7463
+ }
7464
+ function getLastChild(element) {
7465
+ return element.lastChild;
7466
+ }
7467
+ function getLastElementChild(element) {
7468
+ return element.lastElementChild;
7469
+ }
7470
+ function isConnected(node) {
7471
+ return node.isConnected;
7472
+ }
7473
+ function assertInstanceOfHTMLElement(elm, msg) {
7474
+ assertInvariant(elm instanceof HTMLElement, msg);
7475
+ }
7476
+ const HTMLElementExported = HTMLElementConstructor;
7477
+ const renderer = {
7478
+ HTMLElementExported,
7479
+ insert,
7480
+ remove,
7481
+ cloneNode,
7482
+ createFragment,
7483
+ createElement,
7484
+ createText,
7485
+ createComment,
7486
+ nextSibling,
7487
+ attachShadow,
7488
+ getProperty,
7489
+ setProperty,
7490
+ setText,
7491
+ getAttribute,
7492
+ setAttribute,
7493
+ removeAttribute,
7494
+ addEventListener,
7495
+ removeEventListener,
7496
+ dispatchEvent,
7497
+ getClassList,
7498
+ setCSSStyleProperty,
7499
+ getBoundingClientRect,
7500
+ querySelector,
7501
+ querySelectorAll,
7502
+ getElementsByTagName,
7503
+ getElementsByClassName,
7504
+ getChildren,
7505
+ getChildNodes,
7506
+ getFirstChild,
7507
+ getFirstElementChild,
7508
+ getLastChild,
7509
+ getLastElementChild,
7510
+ isConnected,
7511
+ assertInstanceOfHTMLElement,
7512
+ defineCustomElement,
7513
+ getCustomElement,
7036
7514
  };
7515
+ // Meant to inherit any properties passed via the base renderer as the argument to the factory.
7516
+ Object.setPrototypeOf(renderer, baseRenderer);
7517
+ return renderer;
7037
7518
  }
7038
7519
 
7039
7520
  /*
@@ -7042,245 +7523,21 @@ else {
7042
7523
  * SPDX-License-Identifier: MIT
7043
7524
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7044
7525
  */
7045
- let getCustomElement;
7046
- let defineCustomElement;
7047
- let HTMLElementConstructor;
7048
- function isCustomElementRegistryAvailable() {
7049
- if (typeof customElements === 'undefined') {
7050
- return false;
7051
- }
7052
- try {
7053
- // dereference HTMLElement global because babel wraps globals in compat mode with a
7054
- // _wrapNativeSuper()
7055
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
7056
- // get wrapped by babel.
7057
- const HTMLElementAlias = HTMLElement;
7058
- // In case we use compat mode with a modern browser, the compat mode transformation
7059
- // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
7060
- // which are not equipped to be initialized that way.
7061
- class clazz extends HTMLElementAlias {
7062
- }
7063
- customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
7064
- new clazz();
7065
- return true;
7066
- }
7067
- catch (_a) {
7068
- return false;
7069
- }
7070
- }
7071
- if (isCustomElementRegistryAvailable()) {
7072
- getCustomElement = customElements.get.bind(customElements);
7073
- defineCustomElement = customElements.define.bind(customElements);
7074
- HTMLElementConstructor = HTMLElement;
7075
- }
7076
- else {
7077
- const registry = create(null);
7078
- const reverseRegistry = new WeakMap();
7079
- defineCustomElement = function define(name, ctor) {
7080
- if (name !== StringToLowerCase.call(name) || registry[name]) {
7081
- throw new TypeError(`Invalid Registration`);
7082
- }
7083
- registry[name] = ctor;
7084
- reverseRegistry.set(ctor, name);
7085
- };
7086
- getCustomElement = function get(name) {
7087
- return registry[name];
7088
- };
7089
- HTMLElementConstructor = function HTMLElement() {
7090
- if (!(this instanceof HTMLElement)) {
7091
- throw new TypeError(`Invalid Invocation`);
7092
- }
7093
- const { constructor } = this;
7094
- const name = reverseRegistry.get(constructor);
7095
- if (!name) {
7096
- throw new TypeError(`Invalid Construction`);
7097
- }
7098
- const elm = document.createElement(name);
7099
- setPrototypeOf(elm, constructor.prototype);
7100
- return elm;
7101
- };
7102
- HTMLElementConstructor.prototype = HTMLElement.prototype;
7103
- }
7104
- let hydrating = false;
7105
- function setIsHydrating(value) {
7106
- hydrating = value;
7107
- }
7108
- const ssr = false;
7109
- function isHydrating() {
7110
- return hydrating;
7111
- }
7112
- const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
7113
- const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
7114
- function cloneNode(node, deep) {
7115
- return node.cloneNode(deep);
7116
- }
7117
- function createElement$1(tagName, namespace) {
7118
- return isUndefined$1(namespace)
7119
- ? document.createElement(tagName)
7120
- : document.createElementNS(namespace, tagName);
7121
- }
7122
- function createText(content) {
7123
- return document.createTextNode(content);
7124
- }
7125
- function createComment(content) {
7126
- return document.createComment(content);
7127
- }
7128
- function insert(node, parent, anchor) {
7129
- parent.insertBefore(node, anchor);
7130
- }
7131
- function remove(node, parent) {
7132
- parent.removeChild(node);
7133
- }
7134
- function nextSibling(node) {
7135
- return node.nextSibling;
7136
- }
7137
- function attachShadow(element, options) {
7138
- // `hydrating` will be true in two cases:
7139
- // 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
7140
- // 2. when a webapp author places <c-app> in their static HTML and mounts their
7141
- // root component with customeElement.define('c-app', Ctor)
7142
- //
7143
- // The second case can be treated as a failed hydration with nominal impact
7144
- // to performance. However, because <c-app> won't have a <template shadowroot>
7145
- // declarative child, `element.shadowRoot` is `null`.
7146
- if (hydrating && element.shadowRoot) {
7147
- return element.shadowRoot;
7148
- }
7149
- return element.attachShadow(options);
7150
- }
7151
- function setText(node, content) {
7152
- node.nodeValue = content;
7153
- }
7154
- function getProperty(node, key) {
7155
- return node[key];
7156
- }
7157
- function setProperty(node, key, value) {
7158
- if (process.env.NODE_ENV !== 'production') {
7159
- if (node instanceof Element && !(key in node)) {
7160
- // TODO [#1297]: Move this validation to the compiler
7161
- assert.fail(`Unknown public property "${key}" of element <${node.tagName}>. This is likely a typo on the corresponding attribute "${htmlPropertyToAttribute(key)}".`);
7162
- }
7163
- }
7164
- node[key] = value;
7165
- }
7166
- function getAttribute(element, name, namespace) {
7167
- return isUndefined$1(namespace)
7168
- ? element.getAttribute(name)
7169
- : element.getAttributeNS(namespace, name);
7170
- }
7171
- function setAttribute(element, name, value, namespace) {
7172
- return isUndefined$1(namespace)
7173
- ? element.setAttribute(name, value)
7174
- : element.setAttributeNS(namespace, name, value);
7175
- }
7176
- function removeAttribute(element, name, namespace) {
7177
- if (isUndefined$1(namespace)) {
7178
- element.removeAttribute(name);
7179
- }
7180
- else {
7181
- element.removeAttributeNS(namespace, name);
7182
- }
7183
- }
7184
- function addEventListener(target, type, callback, options) {
7185
- target.addEventListener(type, callback, options);
7186
- }
7187
- function removeEventListener(target, type, callback, options) {
7188
- target.removeEventListener(type, callback, options);
7189
- }
7190
- function dispatchEvent(target, event) {
7191
- return target.dispatchEvent(event);
7192
- }
7193
- function getClassList(element) {
7194
- return element.classList;
7195
- }
7196
- function setCSSStyleProperty(element, name, value, important) {
7197
- // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
7198
- // represent elements in the engine?
7199
- element.style.setProperty(name, value, important ? 'important' : '');
7200
- }
7201
- function getBoundingClientRect(element) {
7202
- return element.getBoundingClientRect();
7203
- }
7204
- function querySelector(element, selectors) {
7205
- return element.querySelector(selectors);
7206
- }
7207
- function querySelectorAll(element, selectors) {
7208
- return element.querySelectorAll(selectors);
7209
- }
7210
- function getElementsByTagName(element, tagNameOrWildCard) {
7211
- return element.getElementsByTagName(tagNameOrWildCard);
7212
- }
7213
- function getElementsByClassName(element, names) {
7214
- return element.getElementsByClassName(names);
7215
- }
7216
- function getChildren(element) {
7217
- return element.children;
7218
- }
7219
- function getChildNodes(element) {
7220
- return element.childNodes;
7221
- }
7222
- function getFirstChild(element) {
7223
- return element.firstChild;
7224
- }
7225
- function getFirstElementChild(element) {
7226
- return element.firstElementChild;
7227
- }
7228
- function getLastChild(element) {
7229
- return element.lastChild;
7230
- }
7231
- function getLastElementChild(element) {
7232
- return element.lastElementChild;
7233
- }
7234
- function isConnected(node) {
7235
- return node.isConnected;
7236
- }
7237
- function assertInstanceOfHTMLElement(elm, msg) {
7238
- assert.invariant(elm instanceof HTMLElement, msg);
7239
- }
7240
- const HTMLElementExported = HTMLElementConstructor;
7241
- const renderer = {
7242
- ssr,
7243
- isNativeShadowDefined,
7244
- isSyntheticShadowDefined,
7245
- HTMLElementExported,
7246
- isHydrating,
7247
- insert,
7248
- remove,
7249
- cloneNode,
7250
- createFragment,
7251
- createElement: createElement$1,
7252
- createText,
7253
- createComment,
7254
- nextSibling,
7255
- attachShadow,
7256
- getProperty,
7257
- setProperty,
7258
- setText,
7259
- getAttribute,
7260
- setAttribute,
7261
- removeAttribute,
7262
- addEventListener,
7263
- removeEventListener,
7264
- dispatchEvent,
7265
- getClassList,
7266
- setCSSStyleProperty,
7267
- getBoundingClientRect,
7268
- querySelector,
7269
- querySelectorAll,
7270
- getElementsByTagName,
7271
- getElementsByClassName,
7272
- getChildren,
7273
- getChildNodes,
7274
- getFirstChild,
7275
- getFirstElementChild,
7276
- getLastChild,
7277
- getLastElementChild,
7278
- isConnected,
7526
+ /**
7527
+ * The base renderer that will be used by engine-core.
7528
+ * This will be used for DOM operations when lwc is running in a browser environment.
7529
+ */
7530
+ const renderer = assign(
7531
+ // The base renderer will invoke the factory with null and assign additional properties that are
7532
+ // shared across renderers
7533
+ rendererFactory(null),
7534
+ // Properties that are either not required to be sandboxed or rely on a globally shared information
7535
+ {
7536
+ // insertStyleSheet implementation shares a global cache of stylesheet data
7279
7537
  insertStylesheet,
7280
- assertInstanceOfHTMLElement,
7281
- defineCustomElement,
7282
- getCustomElement,
7283
- };
7538
+ isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
7539
+ isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
7540
+ });
7284
7541
 
7285
7542
  /*
7286
7543
  * Copyright (c) 2018, salesforce.com, inc.
@@ -7329,13 +7586,8 @@ function hydrateComponent(element, Ctor, props = {}) {
7329
7586
  return;
7330
7587
  }
7331
7588
  try {
7332
- // Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
7333
- // and uses the same algo to create the stylesheets as in SSR.
7334
- setIsHydrating(true);
7335
7589
  const vm = createVMWithProps(element, Ctor, props);
7336
7590
  hydrateRoot(vm);
7337
- // set it back since now we finished hydration.
7338
- setIsHydrating(false);
7339
7591
  }
7340
7592
  catch (e) {
7341
7593
  // Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
@@ -7346,13 +7598,8 @@ function hydrateComponent(element, Ctor, props = {}) {
7346
7598
  resetShadowRootAndLightDom(element, Ctor);
7347
7599
  // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
7348
7600
  createVMWithProps(element, Ctor, props);
7349
- setIsHydrating(false);
7350
7601
  connectRootElement(element);
7351
7602
  }
7352
- finally {
7353
- // in case there's an error during recovery
7354
- setIsHydrating(false);
7355
- }
7356
7603
  }
7357
7604
 
7358
7605
  /*
@@ -7426,44 +7673,60 @@ function buildCustomElementConstructor(Ctor) {
7426
7673
  * SPDX-License-Identifier: MIT
7427
7674
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
7428
7675
  */
7429
- // TODO [#2472]: Remove this workaround when appropriate.
7430
7676
  // eslint-disable-next-line @lwc/lwc-internal/no-global-node
7677
+
7431
7678
  const _Node$1 = Node;
7432
7679
  const ConnectingSlot = new WeakMap();
7433
7680
  const DisconnectingSlot = new WeakMap();
7681
+
7434
7682
  function callNodeSlot(node, slot) {
7435
- if (process.env.NODE_ENV !== 'production') {
7436
- assert.isTrue(node, `callNodeSlot() should not be called for a non-object`);
7437
- }
7438
- const fn = slot.get(node);
7439
- if (!isUndefined$1(fn)) {
7440
- fn(node);
7441
- }
7442
- return node; // for convenience
7683
+ if (process.env.NODE_ENV !== 'production') {
7684
+ assert.isTrue(node, `callNodeSlot() should not be called for a non-object`);
7685
+ }
7686
+
7687
+ const fn = slot.get(node);
7688
+
7689
+ if (!isUndefined$1(fn)) {
7690
+ fn(node);
7691
+ }
7692
+
7693
+ return node; // for convenience
7443
7694
  }
7444
- // Monkey patching Node methods to be able to detect the insertions and removal of root elements
7445
- // created via createElement.
7446
- const { appendChild, insertBefore, removeChild, replaceChild } = _Node$1.prototype;
7447
- assign(_Node$1.prototype, {
7695
+
7696
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7697
+ // Monkey patching Node methods to be able to detect the insertions and removal of root elements
7698
+ // created via createElement.
7699
+ const {
7700
+ appendChild,
7701
+ insertBefore,
7702
+ removeChild,
7703
+ replaceChild
7704
+ } = _Node$1.prototype;
7705
+ assign(_Node$1.prototype, {
7448
7706
  appendChild(newChild) {
7449
- const appendedNode = appendChild.call(this, newChild);
7450
- return callNodeSlot(appendedNode, ConnectingSlot);
7707
+ const appendedNode = appendChild.call(this, newChild);
7708
+ return callNodeSlot(appendedNode, ConnectingSlot);
7451
7709
  },
7710
+
7452
7711
  insertBefore(newChild, referenceNode) {
7453
- const insertedNode = insertBefore.call(this, newChild, referenceNode);
7454
- return callNodeSlot(insertedNode, ConnectingSlot);
7712
+ const insertedNode = insertBefore.call(this, newChild, referenceNode);
7713
+ return callNodeSlot(insertedNode, ConnectingSlot);
7455
7714
  },
7715
+
7456
7716
  removeChild(oldChild) {
7457
- const removedNode = removeChild.call(this, oldChild);
7458
- return callNodeSlot(removedNode, DisconnectingSlot);
7717
+ const removedNode = removeChild.call(this, oldChild);
7718
+ return callNodeSlot(removedNode, DisconnectingSlot);
7459
7719
  },
7720
+
7460
7721
  replaceChild(newChild, oldChild) {
7461
- const replacedNode = replaceChild.call(this, newChild, oldChild);
7462
- callNodeSlot(replacedNode, DisconnectingSlot);
7463
- callNodeSlot(newChild, ConnectingSlot);
7464
- return replacedNode;
7465
- },
7466
- });
7722
+ const replacedNode = replaceChild.call(this, newChild, oldChild);
7723
+ callNodeSlot(replacedNode, DisconnectingSlot);
7724
+ callNodeSlot(newChild, ConnectingSlot);
7725
+ return replacedNode;
7726
+ }
7727
+
7728
+ });
7729
+ }
7467
7730
  /**
7468
7731
  * EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
7469
7732
  * difference that in the options, you can pass the `is` property set to a Constructor instead of
@@ -7475,38 +7738,50 @@ assign(_Node$1.prototype, {
7475
7738
  * const el = createElement('x-foo', { is: FooCtor });
7476
7739
  * ```
7477
7740
  */
7741
+
7742
+
7478
7743
  function createElement(sel, options) {
7479
- if (!isObject(options) || isNull(options)) {
7480
- throw new TypeError(`"createElement" function expects an object as second parameter but received "${toString$1(options)}".`);
7481
- }
7482
- const Ctor = options.is;
7483
- if (!isFunction$1(Ctor)) {
7484
- throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
7485
- }
7486
- const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
7487
- let wasComponentUpgraded = false;
7488
- // the custom element from the registry is expecting an upgrade callback
7489
- /**
7490
- * Note: if the upgradable constructor does not expect, or throw when we new it
7491
- * with a callback as the first argument, we could implement a more advanced
7492
- * mechanism that only passes that argument if the constructor is known to be
7493
- * an upgradable custom element.
7494
- */
7495
- const element = new UpgradableConstructor((elm) => {
7496
- createVM(elm, Ctor, renderer, {
7497
- tagName: sel,
7498
- mode: options.mode !== 'closed' ? 'open' : 'closed',
7499
- owner: null,
7500
- });
7501
- ConnectingSlot.set(elm, connectRootElement);
7502
- DisconnectingSlot.set(elm, disconnectRootElement);
7503
- wasComponentUpgraded = true;
7744
+ if (!isObject(options) || isNull(options)) {
7745
+ throw new TypeError(`"createElement" function expects an object as second parameter but received "${toString$1(options)}".`);
7746
+ }
7747
+
7748
+ const Ctor = options.is;
7749
+
7750
+ if (!isFunction$1(Ctor)) {
7751
+ throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
7752
+ }
7753
+
7754
+ const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
7755
+ let wasComponentUpgraded = false; // the custom element from the registry is expecting an upgrade callback
7756
+
7757
+ /**
7758
+ * Note: if the upgradable constructor does not expect, or throw when we new it
7759
+ * with a callback as the first argument, we could implement a more advanced
7760
+ * mechanism that only passes that argument if the constructor is known to be
7761
+ * an upgradable custom element.
7762
+ */
7763
+
7764
+ const element = new UpgradableConstructor(elm => {
7765
+ createVM(elm, Ctor, renderer, {
7766
+ tagName: sel,
7767
+ mode: options.mode !== 'closed' ? 'open' : 'closed',
7768
+ owner: null
7504
7769
  });
7505
- if (!wasComponentUpgraded) {
7506
- /* eslint-disable-next-line no-console */
7507
- console.error(`Unexpected tag name "${sel}". This name is a registered custom element, preventing LWC to upgrade the element.`);
7770
+
7771
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7772
+ ConnectingSlot.set(elm, connectRootElement);
7773
+ DisconnectingSlot.set(elm, disconnectRootElement);
7508
7774
  }
7509
- return element;
7775
+
7776
+ wasComponentUpgraded = true;
7777
+ });
7778
+
7779
+ if (!wasComponentUpgraded) {
7780
+ /* eslint-disable-next-line no-console */
7781
+ console.error(`Unexpected tag name "${sel}". This name is a registered custom element, preventing LWC to upgrade the element.`);
7782
+ }
7783
+
7784
+ return element;
7510
7785
  }
7511
7786
 
7512
7787
  /*
@@ -7540,7 +7815,7 @@ function isNodeShadowed(node) {
7540
7815
  }
7541
7816
  // TODO [#1252]: Old behavior that is still used by some pieces of the platform. Manually
7542
7817
  // inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
7543
- return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
7818
+ return renderer.isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
7544
7819
  }
7545
7820
 
7546
7821
  /*
@@ -7577,6 +7852,6 @@ defineProperty(LightningElement, 'CustomElementConstructor', {
7577
7852
  });
7578
7853
  freeze(LightningElement);
7579
7854
  seal(LightningElement.prototype);
7580
- /* version: 2.22.0 */
7855
+ /* version: 2.23.2 */
7581
7856
 
7582
- export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };
7857
+ export { LightningElement, profilerControl as __unstable__ProfilerControl, api$1 as api, deprecatedBuildCustomElementConstructor as buildCustomElementConstructor, createContextProvider, createElement, freezeTemplate, getComponentConstructor, getComponentDef, hydrateComponent, isComponentConstructor, isNodeShadowed as isNodeFromTemplate, parseFragment, parseSVGFragment, readonly, register, registerComponent, registerDecorators, registerTemplate, renderer, rendererFactory, sanitizeAttribute, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, track, unwrap, wire };