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