lwc 2.20.2 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +203 -171
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +203 -171
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +193 -161
  5. package/dist/engine-dom/iife/es5/engine-dom.js +288 -254
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +278 -243
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +203 -171
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +193 -161
  11. package/dist/engine-dom/umd/es5/engine-dom.js +288 -254
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +278 -243
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +280 -258
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +280 -258
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  29. package/dist/wire-service/iife/es5/wire-service.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
  31. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  32. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  33. package/dist/wire-service/umd/es5/wire-service.js +2 -2
  34. package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
  35. package/package.json +7 -7
@@ -419,9 +419,9 @@ function htmlEscape(str, attrMode = false) {
419
419
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
420
420
  */
421
421
  // Increment whenever the LWC template compiler changes
422
- const LWC_VERSION = "2.20.2";
422
+ const LWC_VERSION = "2.21.0";
423
423
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
424
- /** version: 2.20.2 */
424
+ /** version: 2.21.0 */
425
425
 
426
426
  /*
427
427
  * Copyright (c) 2020, salesforce.com, inc.
@@ -530,7 +530,7 @@ function setFeatureFlagForTest(name, value) {
530
530
  setFeatureFlag(name, value);
531
531
  }
532
532
  }
533
- /** version: 2.20.2 */
533
+ /** version: 2.21.0 */
534
534
 
535
535
  /* proxy-compat-disable */
536
536
 
@@ -3255,6 +3255,175 @@ function getComponentDef(Ctor) {
3255
3255
  };
3256
3256
  }
3257
3257
 
3258
+ /*
3259
+ * Copyright (c) 2018, salesforce.com, inc.
3260
+ * All rights reserved.
3261
+ * SPDX-License-Identifier: MIT
3262
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3263
+ */
3264
+ function makeHostToken(token) {
3265
+ return `${token}-host`;
3266
+ }
3267
+ function createInlineStyleVNode(content) {
3268
+ return api.h('style', {
3269
+ key: 'style',
3270
+ attrs: {
3271
+ type: 'text/css',
3272
+ },
3273
+ }, [api.t(content)]);
3274
+ }
3275
+ function updateStylesheetToken(vm, template) {
3276
+ const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
3277
+ const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
3278
+ const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
3279
+ const { hasScopedStyles } = context;
3280
+ let newToken;
3281
+ let newHasTokenInClass;
3282
+ let newHasTokenInAttribute;
3283
+ // Reset the styling token applied to the host element.
3284
+ const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
3285
+ if (!isUndefined$1(oldToken)) {
3286
+ if (oldHasTokenInClass) {
3287
+ getClassList(elm).remove(makeHostToken(oldToken));
3288
+ }
3289
+ if (oldHasTokenInAttribute) {
3290
+ removeAttribute(elm, makeHostToken(oldToken));
3291
+ }
3292
+ }
3293
+ // Apply the new template styling token to the host element, if the new template has any
3294
+ // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
3295
+ if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3296
+ newToken = newStylesheetToken;
3297
+ }
3298
+ // Set the new styling token on the host element
3299
+ if (!isUndefined$1(newToken)) {
3300
+ if (hasScopedStyles) {
3301
+ getClassList(elm).add(makeHostToken(newToken));
3302
+ newHasTokenInClass = true;
3303
+ }
3304
+ if (isSyntheticShadow) {
3305
+ setAttribute(elm, makeHostToken(newToken), '');
3306
+ newHasTokenInAttribute = true;
3307
+ }
3308
+ }
3309
+ // Update the styling tokens present on the context object.
3310
+ context.stylesheetToken = newToken;
3311
+ context.hasTokenInClass = newHasTokenInClass;
3312
+ context.hasTokenInAttribute = newHasTokenInAttribute;
3313
+ }
3314
+ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3315
+ const content = [];
3316
+ let root;
3317
+ for (let i = 0; i < stylesheets.length; i++) {
3318
+ let stylesheet = stylesheets[i];
3319
+ if (isArray$1(stylesheet)) {
3320
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3321
+ }
3322
+ else {
3323
+ if (process.env.NODE_ENV !== 'production') {
3324
+ // Check for compiler version mismatch in dev mode only
3325
+ checkVersionMismatch(stylesheet, 'stylesheet');
3326
+ // in dev-mode, we support hot swapping of stylesheet, which means that
3327
+ // the component instance might be attempting to use an old version of
3328
+ // the stylesheet, while internally, we have a replacement for it.
3329
+ stylesheet = getStyleOrSwappedStyle(stylesheet);
3330
+ }
3331
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3332
+ // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
3333
+ const scopeToken = isScopedCss ||
3334
+ (vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */)
3335
+ ? stylesheetToken
3336
+ : undefined;
3337
+ // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
3338
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
3339
+ const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */
3340
+ ? !isScopedCss
3341
+ : vm.shadowMode === 0 /* ShadowMode.Native */;
3342
+ // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
3343
+ // we use an attribute selector on the host to simulate :dir().
3344
+ let useNativeDirPseudoclass;
3345
+ if (vm.renderMode === 1 /* RenderMode.Shadow */) {
3346
+ useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
3347
+ }
3348
+ else {
3349
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
3350
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
3351
+ if (isUndefined$1(root)) {
3352
+ // Only calculate the root once as necessary
3353
+ root = getNearestShadowComponent(vm);
3354
+ }
3355
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
3356
+ }
3357
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
3358
+ }
3359
+ }
3360
+ return content;
3361
+ }
3362
+ function getStylesheetsContent(vm, template) {
3363
+ const { stylesheets, stylesheetToken } = template;
3364
+ let content = [];
3365
+ if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
3366
+ content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
3367
+ }
3368
+ return content;
3369
+ }
3370
+ // It might be worth caching this to avoid doing the lookup repeatedly, but
3371
+ // perf testing has not shown it to be a huge improvement yet:
3372
+ // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
3373
+ function getNearestShadowComponent(vm) {
3374
+ let owner = vm;
3375
+ while (!isNull(owner)) {
3376
+ if (owner.renderMode === 1 /* RenderMode.Shadow */) {
3377
+ return owner;
3378
+ }
3379
+ owner = owner.owner;
3380
+ }
3381
+ return owner;
3382
+ }
3383
+ /**
3384
+ * If the component that is currently being rendered uses scoped styles,
3385
+ * this returns the unique token for that scoped stylesheet. Otherwise
3386
+ * it returns null.
3387
+ */
3388
+ function getScopeTokenClass(owner) {
3389
+ const { cmpTemplate, context } = owner;
3390
+ return (context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken)) || null;
3391
+ }
3392
+ function getNearestNativeShadowComponent(vm) {
3393
+ const owner = getNearestShadowComponent(vm);
3394
+ if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
3395
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
3396
+ // synthetic, we know we won't find a native component if we go any further.
3397
+ return null;
3398
+ }
3399
+ return owner;
3400
+ }
3401
+ function createStylesheet(vm, stylesheets) {
3402
+ const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
3403
+ if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
3404
+ for (let i = 0; i < stylesheets.length; i++) {
3405
+ insertStylesheet(stylesheets[i]);
3406
+ }
3407
+ }
3408
+ else if (ssr || vm.hydrated) {
3409
+ // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3410
+ // This works in the client, because the stylesheets are created, and cached in the VM
3411
+ // the first time the VM renders.
3412
+ // native shadow or light DOM, SSR
3413
+ return ArrayMap.call(stylesheets, createInlineStyleVNode);
3414
+ }
3415
+ else {
3416
+ // native shadow or light DOM, DOM renderer
3417
+ const root = getNearestNativeShadowComponent(vm);
3418
+ // null root means a global style
3419
+ const target = isNull(root) ? undefined : root.shadowRoot;
3420
+ for (let i = 0; i < stylesheets.length; i++) {
3421
+ insertStylesheet(stylesheets[i], target);
3422
+ }
3423
+ }
3424
+ return null;
3425
+ }
3426
+
3258
3427
  /*
3259
3428
  * Copyright (c) 2020, salesforce.com, inc.
3260
3429
  * All rights reserved.
@@ -3766,10 +3935,9 @@ function setElementShadowToken(elm, token) {
3766
3935
  }
3767
3936
  // Set the scope token class for *.scoped.css styles
3768
3937
  function setScopeTokenClassIfNecessary(elm, owner, renderer) {
3769
- const { cmpTemplate, context } = owner;
3770
- const { getClassList } = renderer;
3771
- const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
3772
- if (!isUndefined$1(token) && context.hasScopedStyles) {
3938
+ const token = getScopeTokenClass(owner);
3939
+ if (!isNull(token)) {
3940
+ const { getClassList } = renderer;
3773
3941
  // TODO [#2762]: this dot notation with add is probably problematic
3774
3942
  // probably we should have a renderer api for just the add operation
3775
3943
  getClassList(elm).add(token);
@@ -4532,166 +4700,6 @@ const api = freeze({
4532
4700
  shc,
4533
4701
  });
4534
4702
 
4535
- /*
4536
- * Copyright (c) 2018, salesforce.com, inc.
4537
- * All rights reserved.
4538
- * SPDX-License-Identifier: MIT
4539
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4540
- */
4541
- function makeHostToken(token) {
4542
- return `${token}-host`;
4543
- }
4544
- function createInlineStyleVNode(content) {
4545
- return api.h('style', {
4546
- key: 'style',
4547
- attrs: {
4548
- type: 'text/css',
4549
- },
4550
- }, [api.t(content)]);
4551
- }
4552
- function updateStylesheetToken(vm, template) {
4553
- const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
4554
- const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
4555
- const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
4556
- const { hasScopedStyles } = context;
4557
- let newToken;
4558
- let newHasTokenInClass;
4559
- let newHasTokenInAttribute;
4560
- // Reset the styling token applied to the host element.
4561
- const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
4562
- if (!isUndefined$1(oldToken)) {
4563
- if (oldHasTokenInClass) {
4564
- getClassList(elm).remove(makeHostToken(oldToken));
4565
- }
4566
- if (oldHasTokenInAttribute) {
4567
- removeAttribute(elm, makeHostToken(oldToken));
4568
- }
4569
- }
4570
- // Apply the new template styling token to the host element, if the new template has any
4571
- // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
4572
- if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
4573
- newToken = newStylesheetToken;
4574
- }
4575
- // Set the new styling token on the host element
4576
- if (!isUndefined$1(newToken)) {
4577
- if (hasScopedStyles) {
4578
- getClassList(elm).add(makeHostToken(newToken));
4579
- newHasTokenInClass = true;
4580
- }
4581
- if (isSyntheticShadow) {
4582
- setAttribute(elm, makeHostToken(newToken), '');
4583
- newHasTokenInAttribute = true;
4584
- }
4585
- }
4586
- // Update the styling tokens present on the context object.
4587
- context.stylesheetToken = newToken;
4588
- context.hasTokenInClass = newHasTokenInClass;
4589
- context.hasTokenInAttribute = newHasTokenInAttribute;
4590
- }
4591
- function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
4592
- const content = [];
4593
- let root;
4594
- for (let i = 0; i < stylesheets.length; i++) {
4595
- let stylesheet = stylesheets[i];
4596
- if (isArray$1(stylesheet)) {
4597
- ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
4598
- }
4599
- else {
4600
- if (process.env.NODE_ENV !== 'production') {
4601
- // Check for compiler version mismatch in dev mode only
4602
- checkVersionMismatch(stylesheet, 'stylesheet');
4603
- // in dev-mode, we support hot swapping of stylesheet, which means that
4604
- // the component instance might be attempting to use an old version of
4605
- // the stylesheet, while internally, we have a replacement for it.
4606
- stylesheet = getStyleOrSwappedStyle(stylesheet);
4607
- }
4608
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
4609
- // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
4610
- const scopeToken = isScopedCss ||
4611
- (vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */)
4612
- ? stylesheetToken
4613
- : undefined;
4614
- // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
4615
- // native shadow DOM. Synthetic shadow DOM never uses `:host`.
4616
- const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */
4617
- ? !isScopedCss
4618
- : vm.shadowMode === 0 /* ShadowMode.Native */;
4619
- // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
4620
- // we use an attribute selector on the host to simulate :dir().
4621
- let useNativeDirPseudoclass;
4622
- if (vm.renderMode === 1 /* RenderMode.Shadow */) {
4623
- useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
4624
- }
4625
- else {
4626
- // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
4627
- // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
4628
- if (isUndefined$1(root)) {
4629
- // Only calculate the root once as necessary
4630
- root = getNearestShadowComponent(vm);
4631
- }
4632
- useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
4633
- }
4634
- ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
4635
- }
4636
- }
4637
- return content;
4638
- }
4639
- function getStylesheetsContent(vm, template) {
4640
- const { stylesheets, stylesheetToken } = template;
4641
- let content = [];
4642
- if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
4643
- content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
4644
- }
4645
- return content;
4646
- }
4647
- // It might be worth caching this to avoid doing the lookup repeatedly, but
4648
- // perf testing has not shown it to be a huge improvement yet:
4649
- // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
4650
- function getNearestShadowComponent(vm) {
4651
- let owner = vm;
4652
- while (!isNull(owner)) {
4653
- if (owner.renderMode === 1 /* RenderMode.Shadow */) {
4654
- return owner;
4655
- }
4656
- owner = owner.owner;
4657
- }
4658
- return owner;
4659
- }
4660
- function getNearestNativeShadowComponent(vm) {
4661
- const owner = getNearestShadowComponent(vm);
4662
- if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
4663
- // Synthetic-within-native is impossible. So if the nearest shadow component is
4664
- // synthetic, we know we won't find a native component if we go any further.
4665
- return null;
4666
- }
4667
- return owner;
4668
- }
4669
- function createStylesheet(vm, stylesheets) {
4670
- const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
4671
- if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
4672
- for (let i = 0; i < stylesheets.length; i++) {
4673
- insertStylesheet(stylesheets[i]);
4674
- }
4675
- }
4676
- else if (ssr || vm.hydrated) {
4677
- // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
4678
- // This works in the client, because the stylesheets are created, and cached in the VM
4679
- // the first time the VM renders.
4680
- // native shadow or light DOM, SSR
4681
- return ArrayMap.call(stylesheets, createInlineStyleVNode);
4682
- }
4683
- else {
4684
- // native shadow or light DOM, DOM renderer
4685
- const root = getNearestNativeShadowComponent(vm);
4686
- // null root means a global style
4687
- const target = isNull(root) ? undefined : root.shadowRoot;
4688
- for (let i = 0; i < stylesheets.length; i++) {
4689
- insertStylesheet(stylesheets[i], target);
4690
- }
4691
- }
4692
- return null;
4693
- }
4694
-
4695
4703
  /*
4696
4704
  * Copyright (c) 2018, salesforce.com, inc.
4697
4705
  * All rights reserved.
@@ -6273,7 +6281,7 @@ function freezeTemplate(tmpl) {
6273
6281
  });
6274
6282
  }
6275
6283
  }
6276
- /* version: 2.20.2 */
6284
+ /* version: 2.21.0 */
6277
6285
 
6278
6286
  /*
6279
6287
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6281,6 +6289,16 @@ function freezeTemplate(tmpl) {
6281
6289
  * SPDX-License-Identifier: MIT
6282
6290
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6283
6291
  */
6292
+ // We use Symbols as the keys for HostElement properties to avoid conflicting
6293
+ // with public component properties defined by a component author.
6294
+ const HostNamespaceKey = Symbol('namespace');
6295
+ const HostTypeKey = Symbol('type');
6296
+ const HostParentKey = Symbol('parent');
6297
+ const HostShadowRootKey = Symbol('shadow-root');
6298
+ const HostChildrenKey = Symbol('children');
6299
+ const HostAttributesKey = Symbol('attributes');
6300
+ const HostEventListenersKey = Symbol('event-listeners');
6301
+ const HostValueKey = Symbol('value');
6284
6302
  var HostNodeType;
6285
6303
  (function (HostNodeType) {
6286
6304
  HostNodeType["Text"] = "text";
@@ -6315,16 +6333,16 @@ function unsupportedMethod(name) {
6315
6333
  throw new TypeError(`"${name}" is not supported in this environment`);
6316
6334
  };
6317
6335
  }
6318
- function createElement(name, namespace) {
6336
+ function createElement(tagName, namespace) {
6319
6337
  return {
6320
- type: HostNodeType.Element,
6321
- name,
6322
- namespace: namespace !== null && namespace !== void 0 ? namespace : HTML_NAMESPACE,
6323
- parent: null,
6324
- shadowRoot: null,
6325
- children: [],
6326
- attributes: [],
6327
- eventListeners: {},
6338
+ [HostTypeKey]: HostNodeType.Element,
6339
+ tagName,
6340
+ [HostNamespaceKey]: namespace !== null && namespace !== void 0 ? namespace : HTML_NAMESPACE,
6341
+ [HostParentKey]: null,
6342
+ [HostShadowRootKey]: null,
6343
+ [HostChildrenKey]: [],
6344
+ [HostAttributesKey]: [],
6345
+ [HostEventListenersKey]: {},
6328
6346
  };
6329
6347
  }
6330
6348
  const registry = create(null);
@@ -6339,11 +6357,11 @@ function registerCustomElement(name, ctor) {
6339
6357
  class HTMLElementImpl {
6340
6358
  constructor() {
6341
6359
  const { constructor } = this;
6342
- const name = reverseRegistry.get(constructor);
6343
- if (!name) {
6360
+ const tagName = reverseRegistry.get(constructor);
6361
+ if (!tagName) {
6344
6362
  throw new TypeError(`Invalid Construction`);
6345
6363
  }
6346
- return createElement(name);
6364
+ return createElement(tagName);
6347
6365
  }
6348
6366
  }
6349
6367
  const ssr = true;
@@ -6353,73 +6371,74 @@ function isHydrating() {
6353
6371
  const isNativeShadowDefined = false;
6354
6372
  const isSyntheticShadowDefined = false;
6355
6373
  function insert(node, parent, anchor) {
6356
- if (node.parent !== null && node.parent !== parent) {
6357
- const nodeIndex = node.parent.children.indexOf(node);
6358
- node.parent.children.splice(nodeIndex, 1);
6374
+ const nodeParent = node[HostParentKey];
6375
+ if (nodeParent !== null && nodeParent !== parent) {
6376
+ const nodeIndex = nodeParent[HostChildrenKey].indexOf(node);
6377
+ nodeParent[HostChildrenKey].splice(nodeIndex, 1);
6359
6378
  }
6360
- node.parent = parent;
6361
- const anchorIndex = isNull(anchor) ? -1 : parent.children.indexOf(anchor);
6379
+ node[HostParentKey] = parent;
6380
+ const anchorIndex = isNull(anchor) ? -1 : parent[HostChildrenKey].indexOf(anchor);
6362
6381
  if (anchorIndex === -1) {
6363
- parent.children.push(node);
6382
+ parent[HostChildrenKey].push(node);
6364
6383
  }
6365
6384
  else {
6366
- parent.children.splice(anchorIndex, 0, node);
6385
+ parent[HostChildrenKey].splice(anchorIndex, 0, node);
6367
6386
  }
6368
6387
  }
6369
6388
  function remove(node, parent) {
6370
- const nodeIndex = parent.children.indexOf(node);
6371
- parent.children.splice(nodeIndex, 1);
6389
+ const nodeIndex = parent[HostChildrenKey].indexOf(node);
6390
+ parent[HostChildrenKey].splice(nodeIndex, 1);
6372
6391
  }
6373
6392
  function cloneNode(node) {
6374
6393
  return node;
6375
6394
  }
6376
6395
  function createFragment(html) {
6377
6396
  return {
6378
- type: HostNodeType.Raw,
6379
- parent: null,
6380
- value: html,
6397
+ [HostTypeKey]: HostNodeType.Raw,
6398
+ [HostParentKey]: null,
6399
+ [HostValueKey]: html,
6381
6400
  };
6382
6401
  }
6383
6402
  function createText(content) {
6384
6403
  return {
6385
- type: HostNodeType.Text,
6386
- value: String(content),
6387
- parent: null,
6404
+ [HostTypeKey]: HostNodeType.Text,
6405
+ [HostValueKey]: String(content),
6406
+ [HostParentKey]: null,
6388
6407
  };
6389
6408
  }
6390
6409
  function createComment(content) {
6391
6410
  return {
6392
- type: HostNodeType.Comment,
6393
- value: content,
6394
- parent: null,
6411
+ [HostTypeKey]: HostNodeType.Comment,
6412
+ [HostValueKey]: content,
6413
+ [HostParentKey]: null,
6395
6414
  };
6396
6415
  }
6397
6416
  function nextSibling(node) {
6398
- const { parent } = node;
6417
+ const parent = node[HostParentKey];
6399
6418
  if (isNull(parent)) {
6400
6419
  return null;
6401
6420
  }
6402
- const nodeIndex = parent.children.indexOf(node);
6403
- return parent.children[nodeIndex + 1] || null;
6421
+ const nodeIndex = parent[HostChildrenKey].indexOf(node);
6422
+ return parent[HostChildrenKey][nodeIndex + 1] || null;
6404
6423
  }
6405
6424
  function attachShadow(element, config) {
6406
- element.shadowRoot = {
6407
- type: HostNodeType.ShadowRoot,
6408
- children: [],
6425
+ element[HostShadowRootKey] = {
6426
+ [HostTypeKey]: HostNodeType.ShadowRoot,
6427
+ [HostChildrenKey]: [],
6409
6428
  mode: config.mode,
6410
6429
  delegatesFocus: !!config.delegatesFocus,
6411
6430
  };
6412
- return element.shadowRoot;
6431
+ return element[HostShadowRootKey];
6413
6432
  }
6414
6433
  function getProperty(node, key) {
6415
6434
  var _a, _b;
6416
6435
  if (key in node) {
6417
6436
  return node[key];
6418
6437
  }
6419
- if (node.type === HostNodeType.Element) {
6438
+ if (node[HostTypeKey] === HostNodeType.Element) {
6420
6439
  const attrName = htmlPropertyToAttribute(key);
6421
6440
  // Handle all the boolean properties.
6422
- if (isBooleanAttribute(attrName, node.name)) {
6441
+ if (isBooleanAttribute(attrName, node.tagName)) {
6423
6442
  return (_a = getAttribute(node, attrName)) !== null && _a !== void 0 ? _a : false;
6424
6443
  }
6425
6444
  // Handle global html attributes and AOM.
@@ -6428,7 +6447,7 @@ function getProperty(node, key) {
6428
6447
  }
6429
6448
  // Handle special elements live bindings. The checked property is already handled above
6430
6449
  // in the boolean case.
6431
- if (node.name === 'input' && key === 'value') {
6450
+ if (node.tagName === 'input' && key === 'value') {
6432
6451
  return (_b = getAttribute(node, 'value')) !== null && _b !== void 0 ? _b : '';
6433
6452
  }
6434
6453
  }
@@ -6441,20 +6460,20 @@ function setProperty(node, key, value) {
6441
6460
  if (key in node) {
6442
6461
  return (node[key] = value);
6443
6462
  }
6444
- if (node.type === HostNodeType.Element) {
6463
+ if (node[HostTypeKey] === HostNodeType.Element) {
6445
6464
  const attrName = htmlPropertyToAttribute(key);
6446
6465
  if (key === 'innerHTML') {
6447
- node.children = [
6466
+ node[HostChildrenKey] = [
6448
6467
  {
6449
- type: HostNodeType.Raw,
6450
- parent: node,
6451
- value,
6468
+ [HostTypeKey]: HostNodeType.Raw,
6469
+ [HostParentKey]: node,
6470
+ [HostValueKey]: value,
6452
6471
  },
6453
6472
  ];
6454
6473
  return;
6455
6474
  }
6456
6475
  // Handle all the boolean properties.
6457
- if (isBooleanAttribute(attrName, node.name)) {
6476
+ if (isBooleanAttribute(attrName, node.tagName)) {
6458
6477
  return value === true
6459
6478
  ? setAttribute(node, attrName, '')
6460
6479
  : removeAttribute(node, attrName);
@@ -6465,7 +6484,7 @@ function setProperty(node, key, value) {
6465
6484
  }
6466
6485
  // Handle special elements live bindings. The checked property is already handled above
6467
6486
  // in the boolean case.
6468
- if (node.name === 'input' && attrName === 'value') {
6487
+ if (node.tagName === 'input' && attrName === 'value') {
6469
6488
  return isNull(value) || isUndefined$1(value)
6470
6489
  ? removeAttribute(node, 'value')
6471
6490
  : setAttribute(node, 'value', value);
@@ -6477,32 +6496,32 @@ function setProperty(node, key, value) {
6477
6496
  }
6478
6497
  }
6479
6498
  function setText(node, content) {
6480
- if (node.type === HostNodeType.Text) {
6481
- node.value = content;
6499
+ if (node[HostTypeKey] === HostNodeType.Text) {
6500
+ node[HostValueKey] = content;
6482
6501
  }
6483
- else if (node.type === HostNodeType.Element) {
6484
- node.children = [
6502
+ else if (node[HostTypeKey] === HostNodeType.Element) {
6503
+ node[HostChildrenKey] = [
6485
6504
  {
6486
- type: HostNodeType.Text,
6487
- parent: node,
6488
- value: content,
6505
+ [HostTypeKey]: HostNodeType.Text,
6506
+ [HostParentKey]: node,
6507
+ [HostValueKey]: content,
6489
6508
  },
6490
6509
  ];
6491
6510
  }
6492
6511
  }
6493
6512
  function getAttribute(element, name, namespace = null) {
6494
- const attribute = element.attributes.find((attr) => attr.name === name && attr.namespace === namespace);
6513
+ const attribute = element[HostAttributesKey].find((attr) => attr.name === name && attr[HostNamespaceKey] === namespace);
6495
6514
  return attribute ? attribute.value : null;
6496
6515
  }
6497
6516
  function setAttribute(element, name, value, namespace = null) {
6498
- const attribute = element.attributes.find((attr) => attr.name === name && attr.namespace === namespace);
6517
+ const attribute = element[HostAttributesKey].find((attr) => attr.name === name && attr[HostNamespaceKey] === namespace);
6499
6518
  if (isUndefined$1(namespace)) {
6500
6519
  namespace = null;
6501
6520
  }
6502
6521
  if (isUndefined$1(attribute)) {
6503
- element.attributes.push({
6522
+ element[HostAttributesKey].push({
6504
6523
  name,
6505
- namespace,
6524
+ [HostNamespaceKey]: namespace,
6506
6525
  value: String(value),
6507
6526
  });
6508
6527
  }
@@ -6511,18 +6530,18 @@ function setAttribute(element, name, value, namespace = null) {
6511
6530
  }
6512
6531
  }
6513
6532
  function removeAttribute(element, name, namespace) {
6514
- element.attributes = element.attributes.filter((attr) => attr.name !== name && attr.namespace !== namespace);
6533
+ element[HostAttributesKey] = element[HostAttributesKey].filter((attr) => attr.name !== name && attr[HostNamespaceKey] !== namespace);
6515
6534
  }
6516
6535
  function getClassList(element) {
6517
6536
  function getClassAttribute() {
6518
- let classAttribute = element.attributes.find((attr) => attr.name === 'class' && isNull(attr.namespace));
6537
+ let classAttribute = element[HostAttributesKey].find((attr) => attr.name === 'class' && isNull(attr[HostNamespaceKey]));
6519
6538
  if (isUndefined$1(classAttribute)) {
6520
6539
  classAttribute = {
6521
6540
  name: 'class',
6522
- namespace: null,
6541
+ [HostNamespaceKey]: null,
6523
6542
  value: '',
6524
6543
  };
6525
- element.attributes.push(classAttribute);
6544
+ element[HostAttributesKey].push(classAttribute);
6526
6545
  }
6527
6546
  return classAttribute;
6528
6547
  }
@@ -6542,12 +6561,12 @@ function getClassList(element) {
6542
6561
  };
6543
6562
  }
6544
6563
  function setCSSStyleProperty(element, name, value, important) {
6545
- const styleAttribute = element.attributes.find((attr) => attr.name === 'style' && isNull(attr.namespace));
6564
+ const styleAttribute = element[HostAttributesKey].find((attr) => attr.name === 'style' && isNull(attr[HostNamespaceKey]));
6546
6565
  const serializedProperty = `${name}: ${value}${important ? ' !important' : ''}`;
6547
6566
  if (isUndefined$1(styleAttribute)) {
6548
- element.attributes.push({
6567
+ element[HostAttributesKey].push({
6549
6568
  name: 'style',
6550
- namespace: null,
6569
+ [HostNamespaceKey]: null,
6551
6570
  value: serializedProperty,
6552
6571
  });
6553
6572
  }
@@ -6556,7 +6575,7 @@ function setCSSStyleProperty(element, name, value, important) {
6556
6575
  }
6557
6576
  }
6558
6577
  function isConnected(node) {
6559
- return !isNull(node.parent);
6578
+ return !isNull(node[HostParentKey]);
6560
6579
  }
6561
6580
  // Noop on SSR (for now). This need to be reevaluated whenever we will implement support for
6562
6581
  // synthetic shadow.
@@ -6644,13 +6663,13 @@ function serializeAttributes(attributes) {
6644
6663
  function serializeChildNodes(children) {
6645
6664
  return children
6646
6665
  .map((child) => {
6647
- switch (child.type) {
6666
+ switch (child[HostTypeKey]) {
6648
6667
  case HostNodeType.Text:
6649
- return child.value === '' ? '\u200D' : htmlEscape(child.value);
6668
+ return child[HostValueKey] === '' ? '\u200D' : htmlEscape(child[HostValueKey]);
6650
6669
  case HostNodeType.Comment:
6651
- return `<!--${htmlEscape(child.value)}-->`;
6670
+ return `<!--${htmlEscape(child[HostValueKey])}-->`;
6652
6671
  case HostNodeType.Raw:
6653
- return child.value;
6672
+ return child[HostValueKey];
6654
6673
  case HostNodeType.Element:
6655
6674
  return serializeElement(child);
6656
6675
  }
@@ -6662,27 +6681,30 @@ function serializeShadowRoot(shadowRoot) {
6662
6681
  if (shadowRoot.delegatesFocus) {
6663
6682
  attrs.push('shadowrootdelegatesfocus');
6664
6683
  }
6665
- return `<template ${attrs.join(' ')}>${serializeChildNodes(shadowRoot.children)}</template>`;
6684
+ return `<template ${attrs.join(' ')}>${serializeChildNodes(shadowRoot[HostChildrenKey])}</template>`;
6666
6685
  }
6667
6686
  function serializeElement(element) {
6668
6687
  let output = '';
6669
- const { name, namespace } = element;
6688
+ const tagName = element.tagName;
6689
+ const namespace = element[HostNamespaceKey];
6670
6690
  const isForeignElement = namespace !== HTML_NAMESPACE;
6671
- const hasChildren = element.children.length > 0;
6672
- const attrs = element.attributes.length ? ` ${serializeAttributes(element.attributes)}` : '';
6673
- output += `<${name}${attrs}`;
6691
+ const hasChildren = element[HostChildrenKey].length > 0;
6692
+ const attrs = element[HostAttributesKey].length
6693
+ ? ` ${serializeAttributes(element[HostAttributesKey])}`
6694
+ : '';
6695
+ output += `<${tagName}${attrs}`;
6674
6696
  // Note that foreign elements can have children but not shadow roots
6675
6697
  if (isForeignElement && !hasChildren) {
6676
6698
  output += '/>';
6677
6699
  return output;
6678
6700
  }
6679
6701
  output += '>';
6680
- if (element.shadowRoot) {
6681
- output += serializeShadowRoot(element.shadowRoot);
6702
+ if (element[HostShadowRootKey]) {
6703
+ output += serializeShadowRoot(element[HostShadowRootKey]);
6682
6704
  }
6683
- output += serializeChildNodes(element.children);
6684
- if (!isVoidElement(name, namespace) || hasChildren) {
6685
- output += `</${name}>`;
6705
+ output += serializeChildNodes(element[HostChildrenKey]);
6706
+ if (!isVoidElement(tagName, namespace) || hasChildren) {
6707
+ output += `</${tagName}>`;
6686
6708
  }
6687
6709
  return output;
6688
6710
  }
@@ -6694,14 +6716,14 @@ function serializeElement(element) {
6694
6716
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6695
6717
  */
6696
6718
  const FakeRootElement = {
6697
- type: HostNodeType.Element,
6698
- name: 'fake-root-element',
6699
- namespace: HTML_NAMESPACE,
6700
- parent: null,
6701
- shadowRoot: null,
6702
- children: [],
6703
- attributes: [],
6704
- eventListeners: {},
6719
+ [HostTypeKey]: HostNodeType.Element,
6720
+ tagName: 'fake-root-element',
6721
+ [HostNamespaceKey]: HTML_NAMESPACE,
6722
+ [HostParentKey]: null,
6723
+ [HostShadowRootKey]: null,
6724
+ [HostChildrenKey]: [],
6725
+ [HostAttributesKey]: [],
6726
+ [HostEventListenersKey]: {},
6705
6727
  };
6706
6728
  function renderComponent(tagName, Ctor, props = {}) {
6707
6729
  if (!isString(tagName)) {
@@ -6722,7 +6744,7 @@ function renderComponent(tagName, Ctor, props = {}) {
6722
6744
  for (const [key, value] of Object.entries(props)) {
6723
6745
  element[key] = value;
6724
6746
  }
6725
- element.parent = FakeRootElement;
6747
+ element[HostParentKey] = FakeRootElement;
6726
6748
  connectRootElement(element);
6727
6749
  return serializeElement(element);
6728
6750
  }
@@ -6735,7 +6757,7 @@ function renderComponent(tagName, Ctor, props = {}) {
6735
6757
  */
6736
6758
  freeze(LightningElement);
6737
6759
  seal(LightningElement.prototype);
6738
- /* version: 2.20.2 */
6760
+ /* version: 2.21.0 */
6739
6761
 
6740
6762
  exports.LightningElement = LightningElement;
6741
6763
  exports.api = api$1;