lwc 2.20.2 → 2.20.5

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 +287 -260
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +287 -260
  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
@@ -250,7 +250,7 @@ const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
250
250
  // e.g. `</tagName>` or `<tagName />`. For instance, `<meta>` closes on its own; no need for a slash.
251
251
  // These only come from HTML; there are no void elements in the SVG or MathML namespaces.
252
252
  // See: https://html.spec.whatwg.org/multipage/syntax.html#syntax-tags
253
- const VOID_ELEMENTS_SET = new Set([
253
+ const VOID_ELEMENTS = [
254
254
  'area',
255
255
  'base',
256
256
  'br',
@@ -264,7 +264,12 @@ const VOID_ELEMENTS_SET = new Set([
264
264
  'source',
265
265
  'track',
266
266
  'wbr',
267
- ]);
267
+ ];
268
+ // These elements have been deprecated but preserving their usage for backwards compatibility
269
+ // until we can officially deprecate them from LWC.
270
+ // See: https://html.spec.whatwg.org/multipage/obsolete.html#obsolete-but-conforming-features
271
+ const DEPRECATED_VOID_ELEMENTS = ['param', 'keygen', 'menuitem'];
272
+ const VOID_ELEMENTS_SET = new Set([...VOID_ELEMENTS, ...DEPRECATED_VOID_ELEMENTS]);
268
273
  function isVoidElement(name, namespace) {
269
274
  return namespace === HTML_NAMESPACE && VOID_ELEMENTS_SET.has(name.toLowerCase());
270
275
  }
@@ -415,9 +420,9 @@ function htmlEscape(str, attrMode = false) {
415
420
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
416
421
  */
417
422
  // Increment whenever the LWC template compiler changes
418
- const LWC_VERSION = "2.20.2";
423
+ const LWC_VERSION = "2.20.5";
419
424
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
420
- /** version: 2.20.2 */
425
+ /** version: 2.20.5 */
421
426
 
422
427
  /*
423
428
  * Copyright (c) 2020, salesforce.com, inc.
@@ -526,7 +531,7 @@ function setFeatureFlagForTest(name, value) {
526
531
  setFeatureFlag(name, value);
527
532
  }
528
533
  }
529
- /** version: 2.20.2 */
534
+ /** version: 2.20.5 */
530
535
 
531
536
  /* proxy-compat-disable */
532
537
 
@@ -3251,6 +3256,175 @@ function getComponentDef(Ctor) {
3251
3256
  };
3252
3257
  }
3253
3258
 
3259
+ /*
3260
+ * Copyright (c) 2018, salesforce.com, inc.
3261
+ * All rights reserved.
3262
+ * SPDX-License-Identifier: MIT
3263
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3264
+ */
3265
+ function makeHostToken(token) {
3266
+ return `${token}-host`;
3267
+ }
3268
+ function createInlineStyleVNode(content) {
3269
+ return api.h('style', {
3270
+ key: 'style',
3271
+ attrs: {
3272
+ type: 'text/css',
3273
+ },
3274
+ }, [api.t(content)]);
3275
+ }
3276
+ function updateStylesheetToken(vm, template) {
3277
+ const { elm, context, renderMode, shadowMode, renderer: { getClassList, removeAttribute, setAttribute }, } = vm;
3278
+ const { stylesheets: newStylesheets, stylesheetToken: newStylesheetToken } = template;
3279
+ const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
3280
+ const { hasScopedStyles } = context;
3281
+ let newToken;
3282
+ let newHasTokenInClass;
3283
+ let newHasTokenInAttribute;
3284
+ // Reset the styling token applied to the host element.
3285
+ const { stylesheetToken: oldToken, hasTokenInClass: oldHasTokenInClass, hasTokenInAttribute: oldHasTokenInAttribute, } = context;
3286
+ if (!isUndefined$1(oldToken)) {
3287
+ if (oldHasTokenInClass) {
3288
+ getClassList(elm).remove(makeHostToken(oldToken));
3289
+ }
3290
+ if (oldHasTokenInAttribute) {
3291
+ removeAttribute(elm, makeHostToken(oldToken));
3292
+ }
3293
+ }
3294
+ // Apply the new template styling token to the host element, if the new template has any
3295
+ // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
3296
+ if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3297
+ newToken = newStylesheetToken;
3298
+ }
3299
+ // Set the new styling token on the host element
3300
+ if (!isUndefined$1(newToken)) {
3301
+ if (hasScopedStyles) {
3302
+ getClassList(elm).add(makeHostToken(newToken));
3303
+ newHasTokenInClass = true;
3304
+ }
3305
+ if (isSyntheticShadow) {
3306
+ setAttribute(elm, makeHostToken(newToken), '');
3307
+ newHasTokenInAttribute = true;
3308
+ }
3309
+ }
3310
+ // Update the styling tokens present on the context object.
3311
+ context.stylesheetToken = newToken;
3312
+ context.hasTokenInClass = newHasTokenInClass;
3313
+ context.hasTokenInAttribute = newHasTokenInAttribute;
3314
+ }
3315
+ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3316
+ const content = [];
3317
+ let root;
3318
+ for (let i = 0; i < stylesheets.length; i++) {
3319
+ let stylesheet = stylesheets[i];
3320
+ if (isArray$1(stylesheet)) {
3321
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3322
+ }
3323
+ else {
3324
+ if (process.env.NODE_ENV !== 'production') {
3325
+ // Check for compiler version mismatch in dev mode only
3326
+ checkVersionMismatch(stylesheet, 'stylesheet');
3327
+ // in dev-mode, we support hot swapping of stylesheet, which means that
3328
+ // the component instance might be attempting to use an old version of
3329
+ // the stylesheet, while internally, we have a replacement for it.
3330
+ stylesheet = getStyleOrSwappedStyle(stylesheet);
3331
+ }
3332
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3333
+ // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
3334
+ const scopeToken = isScopedCss ||
3335
+ (vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */)
3336
+ ? stylesheetToken
3337
+ : undefined;
3338
+ // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
3339
+ // native shadow DOM. Synthetic shadow DOM never uses `:host`.
3340
+ const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */
3341
+ ? !isScopedCss
3342
+ : vm.shadowMode === 0 /* ShadowMode.Native */;
3343
+ // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
3344
+ // we use an attribute selector on the host to simulate :dir().
3345
+ let useNativeDirPseudoclass;
3346
+ if (vm.renderMode === 1 /* RenderMode.Shadow */) {
3347
+ useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
3348
+ }
3349
+ else {
3350
+ // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
3351
+ // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
3352
+ if (isUndefined$1(root)) {
3353
+ // Only calculate the root once as necessary
3354
+ root = getNearestShadowComponent(vm);
3355
+ }
3356
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
3357
+ }
3358
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
3359
+ }
3360
+ }
3361
+ return content;
3362
+ }
3363
+ function getStylesheetsContent(vm, template) {
3364
+ const { stylesheets, stylesheetToken } = template;
3365
+ let content = [];
3366
+ if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
3367
+ content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
3368
+ }
3369
+ return content;
3370
+ }
3371
+ // It might be worth caching this to avoid doing the lookup repeatedly, but
3372
+ // perf testing has not shown it to be a huge improvement yet:
3373
+ // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
3374
+ function getNearestShadowComponent(vm) {
3375
+ let owner = vm;
3376
+ while (!isNull(owner)) {
3377
+ if (owner.renderMode === 1 /* RenderMode.Shadow */) {
3378
+ return owner;
3379
+ }
3380
+ owner = owner.owner;
3381
+ }
3382
+ return owner;
3383
+ }
3384
+ /**
3385
+ * If the component that is currently being rendered uses scoped styles,
3386
+ * this returns the unique token for that scoped stylesheet. Otherwise
3387
+ * it returns null.
3388
+ */
3389
+ function getScopeTokenClass(owner) {
3390
+ const { cmpTemplate, context } = owner;
3391
+ return (context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken)) || null;
3392
+ }
3393
+ function getNearestNativeShadowComponent(vm) {
3394
+ const owner = getNearestShadowComponent(vm);
3395
+ if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
3396
+ // Synthetic-within-native is impossible. So if the nearest shadow component is
3397
+ // synthetic, we know we won't find a native component if we go any further.
3398
+ return null;
3399
+ }
3400
+ return owner;
3401
+ }
3402
+ function createStylesheet(vm, stylesheets) {
3403
+ const { renderMode, shadowMode, renderer: { ssr, insertStylesheet }, } = vm;
3404
+ if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
3405
+ for (let i = 0; i < stylesheets.length; i++) {
3406
+ insertStylesheet(stylesheets[i]);
3407
+ }
3408
+ }
3409
+ else if (ssr || vm.hydrated) {
3410
+ // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
3411
+ // This works in the client, because the stylesheets are created, and cached in the VM
3412
+ // the first time the VM renders.
3413
+ // native shadow or light DOM, SSR
3414
+ return ArrayMap.call(stylesheets, createInlineStyleVNode);
3415
+ }
3416
+ else {
3417
+ // native shadow or light DOM, DOM renderer
3418
+ const root = getNearestNativeShadowComponent(vm);
3419
+ // null root means a global style
3420
+ const target = isNull(root) ? undefined : root.shadowRoot;
3421
+ for (let i = 0; i < stylesheets.length; i++) {
3422
+ insertStylesheet(stylesheets[i], target);
3423
+ }
3424
+ }
3425
+ return null;
3426
+ }
3427
+
3254
3428
  /*
3255
3429
  * Copyright (c) 2020, salesforce.com, inc.
3256
3430
  * All rights reserved.
@@ -3762,10 +3936,9 @@ function setElementShadowToken(elm, token) {
3762
3936
  }
3763
3937
  // Set the scope token class for *.scoped.css styles
3764
3938
  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) {
3939
+ const token = getScopeTokenClass(owner);
3940
+ if (!isNull(token)) {
3941
+ const { getClassList } = renderer;
3769
3942
  // TODO [#2762]: this dot notation with add is probably problematic
3770
3943
  // probably we should have a renderer api for just the add operation
3771
3944
  getClassList(elm).add(token);
@@ -4528,166 +4701,6 @@ const api = freeze({
4528
4701
  shc,
4529
4702
  });
4530
4703
 
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
4704
  /*
4692
4705
  * Copyright (c) 2018, salesforce.com, inc.
4693
4706
  * All rights reserved.
@@ -6269,7 +6282,7 @@ function freezeTemplate(tmpl) {
6269
6282
  });
6270
6283
  }
6271
6284
  }
6272
- /* version: 2.20.2 */
6285
+ /* version: 2.20.5 */
6273
6286
 
6274
6287
  /*
6275
6288
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6277,6 +6290,16 @@ function freezeTemplate(tmpl) {
6277
6290
  * SPDX-License-Identifier: MIT
6278
6291
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6279
6292
  */
6293
+ // We use Symbols as the keys for HostElement properties to avoid conflicting
6294
+ // with public component properties defined by a component author.
6295
+ const HostNamespaceKey = Symbol('namespace');
6296
+ const HostTypeKey = Symbol('type');
6297
+ const HostParentKey = Symbol('parent');
6298
+ const HostShadowRootKey = Symbol('shadow-root');
6299
+ const HostChildrenKey = Symbol('children');
6300
+ const HostAttributesKey = Symbol('attributes');
6301
+ const HostEventListenersKey = Symbol('event-listeners');
6302
+ const HostValueKey = Symbol('value');
6280
6303
  var HostNodeType;
6281
6304
  (function (HostNodeType) {
6282
6305
  HostNodeType["Text"] = "text";
@@ -6311,16 +6334,16 @@ function unsupportedMethod(name) {
6311
6334
  throw new TypeError(`"${name}" is not supported in this environment`);
6312
6335
  };
6313
6336
  }
6314
- function createElement(name, namespace) {
6337
+ function createElement(tagName, namespace) {
6315
6338
  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: {},
6339
+ [HostTypeKey]: HostNodeType.Element,
6340
+ tagName,
6341
+ [HostNamespaceKey]: namespace !== null && namespace !== void 0 ? namespace : HTML_NAMESPACE,
6342
+ [HostParentKey]: null,
6343
+ [HostShadowRootKey]: null,
6344
+ [HostChildrenKey]: [],
6345
+ [HostAttributesKey]: [],
6346
+ [HostEventListenersKey]: {},
6324
6347
  };
6325
6348
  }
6326
6349
  const registry = create(null);
@@ -6335,11 +6358,11 @@ function registerCustomElement(name, ctor) {
6335
6358
  class HTMLElementImpl {
6336
6359
  constructor() {
6337
6360
  const { constructor } = this;
6338
- const name = reverseRegistry.get(constructor);
6339
- if (!name) {
6361
+ const tagName = reverseRegistry.get(constructor);
6362
+ if (!tagName) {
6340
6363
  throw new TypeError(`Invalid Construction`);
6341
6364
  }
6342
- return createElement(name);
6365
+ return createElement(tagName);
6343
6366
  }
6344
6367
  }
6345
6368
  const ssr = true;
@@ -6349,73 +6372,74 @@ function isHydrating() {
6349
6372
  const isNativeShadowDefined = false;
6350
6373
  const isSyntheticShadowDefined = false;
6351
6374
  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);
6375
+ const nodeParent = node[HostParentKey];
6376
+ if (nodeParent !== null && nodeParent !== parent) {
6377
+ const nodeIndex = nodeParent[HostChildrenKey].indexOf(node);
6378
+ nodeParent[HostChildrenKey].splice(nodeIndex, 1);
6355
6379
  }
6356
- node.parent = parent;
6357
- const anchorIndex = isNull(anchor) ? -1 : parent.children.indexOf(anchor);
6380
+ node[HostParentKey] = parent;
6381
+ const anchorIndex = isNull(anchor) ? -1 : parent[HostChildrenKey].indexOf(anchor);
6358
6382
  if (anchorIndex === -1) {
6359
- parent.children.push(node);
6383
+ parent[HostChildrenKey].push(node);
6360
6384
  }
6361
6385
  else {
6362
- parent.children.splice(anchorIndex, 0, node);
6386
+ parent[HostChildrenKey].splice(anchorIndex, 0, node);
6363
6387
  }
6364
6388
  }
6365
6389
  function remove(node, parent) {
6366
- const nodeIndex = parent.children.indexOf(node);
6367
- parent.children.splice(nodeIndex, 1);
6390
+ const nodeIndex = parent[HostChildrenKey].indexOf(node);
6391
+ parent[HostChildrenKey].splice(nodeIndex, 1);
6368
6392
  }
6369
6393
  function cloneNode(node) {
6370
6394
  return node;
6371
6395
  }
6372
6396
  function createFragment(html) {
6373
6397
  return {
6374
- type: HostNodeType.Raw,
6375
- parent: null,
6376
- value: html,
6398
+ [HostTypeKey]: HostNodeType.Raw,
6399
+ [HostParentKey]: null,
6400
+ [HostValueKey]: html,
6377
6401
  };
6378
6402
  }
6379
6403
  function createText(content) {
6380
6404
  return {
6381
- type: HostNodeType.Text,
6382
- value: String(content),
6383
- parent: null,
6405
+ [HostTypeKey]: HostNodeType.Text,
6406
+ [HostValueKey]: String(content),
6407
+ [HostParentKey]: null,
6384
6408
  };
6385
6409
  }
6386
6410
  function createComment(content) {
6387
6411
  return {
6388
- type: HostNodeType.Comment,
6389
- value: content,
6390
- parent: null,
6412
+ [HostTypeKey]: HostNodeType.Comment,
6413
+ [HostValueKey]: content,
6414
+ [HostParentKey]: null,
6391
6415
  };
6392
6416
  }
6393
6417
  function nextSibling(node) {
6394
- const { parent } = node;
6418
+ const parent = node[HostParentKey];
6395
6419
  if (isNull(parent)) {
6396
6420
  return null;
6397
6421
  }
6398
- const nodeIndex = parent.children.indexOf(node);
6399
- return parent.children[nodeIndex + 1] || null;
6422
+ const nodeIndex = parent[HostChildrenKey].indexOf(node);
6423
+ return parent[HostChildrenKey][nodeIndex + 1] || null;
6400
6424
  }
6401
6425
  function attachShadow(element, config) {
6402
- element.shadowRoot = {
6403
- type: HostNodeType.ShadowRoot,
6404
- children: [],
6426
+ element[HostShadowRootKey] = {
6427
+ [HostTypeKey]: HostNodeType.ShadowRoot,
6428
+ [HostChildrenKey]: [],
6405
6429
  mode: config.mode,
6406
6430
  delegatesFocus: !!config.delegatesFocus,
6407
6431
  };
6408
- return element.shadowRoot;
6432
+ return element[HostShadowRootKey];
6409
6433
  }
6410
6434
  function getProperty(node, key) {
6411
6435
  var _a, _b;
6412
6436
  if (key in node) {
6413
6437
  return node[key];
6414
6438
  }
6415
- if (node.type === HostNodeType.Element) {
6439
+ if (node[HostTypeKey] === HostNodeType.Element) {
6416
6440
  const attrName = htmlPropertyToAttribute(key);
6417
6441
  // Handle all the boolean properties.
6418
- if (isBooleanAttribute(attrName, node.name)) {
6442
+ if (isBooleanAttribute(attrName, node.tagName)) {
6419
6443
  return (_a = getAttribute(node, attrName)) !== null && _a !== void 0 ? _a : false;
6420
6444
  }
6421
6445
  // Handle global html attributes and AOM.
@@ -6424,7 +6448,7 @@ function getProperty(node, key) {
6424
6448
  }
6425
6449
  // Handle special elements live bindings. The checked property is already handled above
6426
6450
  // in the boolean case.
6427
- if (node.name === 'input' && key === 'value') {
6451
+ if (node.tagName === 'input' && key === 'value') {
6428
6452
  return (_b = getAttribute(node, 'value')) !== null && _b !== void 0 ? _b : '';
6429
6453
  }
6430
6454
  }
@@ -6437,20 +6461,20 @@ function setProperty(node, key, value) {
6437
6461
  if (key in node) {
6438
6462
  return (node[key] = value);
6439
6463
  }
6440
- if (node.type === HostNodeType.Element) {
6464
+ if (node[HostTypeKey] === HostNodeType.Element) {
6441
6465
  const attrName = htmlPropertyToAttribute(key);
6442
6466
  if (key === 'innerHTML') {
6443
- node.children = [
6467
+ node[HostChildrenKey] = [
6444
6468
  {
6445
- type: HostNodeType.Raw,
6446
- parent: node,
6447
- value,
6469
+ [HostTypeKey]: HostNodeType.Raw,
6470
+ [HostParentKey]: node,
6471
+ [HostValueKey]: value,
6448
6472
  },
6449
6473
  ];
6450
6474
  return;
6451
6475
  }
6452
6476
  // Handle all the boolean properties.
6453
- if (isBooleanAttribute(attrName, node.name)) {
6477
+ if (isBooleanAttribute(attrName, node.tagName)) {
6454
6478
  return value === true
6455
6479
  ? setAttribute(node, attrName, '')
6456
6480
  : removeAttribute(node, attrName);
@@ -6461,7 +6485,7 @@ function setProperty(node, key, value) {
6461
6485
  }
6462
6486
  // Handle special elements live bindings. The checked property is already handled above
6463
6487
  // in the boolean case.
6464
- if (node.name === 'input' && attrName === 'value') {
6488
+ if (node.tagName === 'input' && attrName === 'value') {
6465
6489
  return isNull(value) || isUndefined$1(value)
6466
6490
  ? removeAttribute(node, 'value')
6467
6491
  : setAttribute(node, 'value', value);
@@ -6473,32 +6497,32 @@ function setProperty(node, key, value) {
6473
6497
  }
6474
6498
  }
6475
6499
  function setText(node, content) {
6476
- if (node.type === HostNodeType.Text) {
6477
- node.value = content;
6500
+ if (node[HostTypeKey] === HostNodeType.Text) {
6501
+ node[HostValueKey] = content;
6478
6502
  }
6479
- else if (node.type === HostNodeType.Element) {
6480
- node.children = [
6503
+ else if (node[HostTypeKey] === HostNodeType.Element) {
6504
+ node[HostChildrenKey] = [
6481
6505
  {
6482
- type: HostNodeType.Text,
6483
- parent: node,
6484
- value: content,
6506
+ [HostTypeKey]: HostNodeType.Text,
6507
+ [HostParentKey]: node,
6508
+ [HostValueKey]: content,
6485
6509
  },
6486
6510
  ];
6487
6511
  }
6488
6512
  }
6489
6513
  function getAttribute(element, name, namespace = null) {
6490
- const attribute = element.attributes.find((attr) => attr.name === name && attr.namespace === namespace);
6514
+ const attribute = element[HostAttributesKey].find((attr) => attr.name === name && attr[HostNamespaceKey] === namespace);
6491
6515
  return attribute ? attribute.value : null;
6492
6516
  }
6493
6517
  function setAttribute(element, name, value, namespace = null) {
6494
- const attribute = element.attributes.find((attr) => attr.name === name && attr.namespace === namespace);
6518
+ const attribute = element[HostAttributesKey].find((attr) => attr.name === name && attr[HostNamespaceKey] === namespace);
6495
6519
  if (isUndefined$1(namespace)) {
6496
6520
  namespace = null;
6497
6521
  }
6498
6522
  if (isUndefined$1(attribute)) {
6499
- element.attributes.push({
6523
+ element[HostAttributesKey].push({
6500
6524
  name,
6501
- namespace,
6525
+ [HostNamespaceKey]: namespace,
6502
6526
  value: String(value),
6503
6527
  });
6504
6528
  }
@@ -6507,18 +6531,18 @@ function setAttribute(element, name, value, namespace = null) {
6507
6531
  }
6508
6532
  }
6509
6533
  function removeAttribute(element, name, namespace) {
6510
- element.attributes = element.attributes.filter((attr) => attr.name !== name && attr.namespace !== namespace);
6534
+ element[HostAttributesKey] = element[HostAttributesKey].filter((attr) => attr.name !== name && attr[HostNamespaceKey] !== namespace);
6511
6535
  }
6512
6536
  function getClassList(element) {
6513
6537
  function getClassAttribute() {
6514
- let classAttribute = element.attributes.find((attr) => attr.name === 'class' && isNull(attr.namespace));
6538
+ let classAttribute = element[HostAttributesKey].find((attr) => attr.name === 'class' && isNull(attr[HostNamespaceKey]));
6515
6539
  if (isUndefined$1(classAttribute)) {
6516
6540
  classAttribute = {
6517
6541
  name: 'class',
6518
- namespace: null,
6542
+ [HostNamespaceKey]: null,
6519
6543
  value: '',
6520
6544
  };
6521
- element.attributes.push(classAttribute);
6545
+ element[HostAttributesKey].push(classAttribute);
6522
6546
  }
6523
6547
  return classAttribute;
6524
6548
  }
@@ -6538,12 +6562,12 @@ function getClassList(element) {
6538
6562
  };
6539
6563
  }
6540
6564
  function setCSSStyleProperty(element, name, value, important) {
6541
- const styleAttribute = element.attributes.find((attr) => attr.name === 'style' && isNull(attr.namespace));
6565
+ const styleAttribute = element[HostAttributesKey].find((attr) => attr.name === 'style' && isNull(attr[HostNamespaceKey]));
6542
6566
  const serializedProperty = `${name}: ${value}${important ? ' !important' : ''}`;
6543
6567
  if (isUndefined$1(styleAttribute)) {
6544
- element.attributes.push({
6568
+ element[HostAttributesKey].push({
6545
6569
  name: 'style',
6546
- namespace: null,
6570
+ [HostNamespaceKey]: null,
6547
6571
  value: serializedProperty,
6548
6572
  });
6549
6573
  }
@@ -6552,7 +6576,7 @@ function setCSSStyleProperty(element, name, value, important) {
6552
6576
  }
6553
6577
  }
6554
6578
  function isConnected(node) {
6555
- return !isNull(node.parent);
6579
+ return !isNull(node[HostParentKey]);
6556
6580
  }
6557
6581
  // Noop on SSR (for now). This need to be reevaluated whenever we will implement support for
6558
6582
  // synthetic shadow.
@@ -6640,13 +6664,13 @@ function serializeAttributes(attributes) {
6640
6664
  function serializeChildNodes(children) {
6641
6665
  return children
6642
6666
  .map((child) => {
6643
- switch (child.type) {
6667
+ switch (child[HostTypeKey]) {
6644
6668
  case HostNodeType.Text:
6645
- return child.value === '' ? '\u200D' : htmlEscape(child.value);
6669
+ return child[HostValueKey] === '' ? '\u200D' : htmlEscape(child[HostValueKey]);
6646
6670
  case HostNodeType.Comment:
6647
- return `<!--${htmlEscape(child.value)}-->`;
6671
+ return `<!--${htmlEscape(child[HostValueKey])}-->`;
6648
6672
  case HostNodeType.Raw:
6649
- return child.value;
6673
+ return child[HostValueKey];
6650
6674
  case HostNodeType.Element:
6651
6675
  return serializeElement(child);
6652
6676
  }
@@ -6658,27 +6682,30 @@ function serializeShadowRoot(shadowRoot) {
6658
6682
  if (shadowRoot.delegatesFocus) {
6659
6683
  attrs.push('shadowrootdelegatesfocus');
6660
6684
  }
6661
- return `<template ${attrs.join(' ')}>${serializeChildNodes(shadowRoot.children)}</template>`;
6685
+ return `<template ${attrs.join(' ')}>${serializeChildNodes(shadowRoot[HostChildrenKey])}</template>`;
6662
6686
  }
6663
6687
  function serializeElement(element) {
6664
6688
  let output = '';
6665
- const { name, namespace } = element;
6689
+ const tagName = element.tagName;
6690
+ const namespace = element[HostNamespaceKey];
6666
6691
  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}`;
6692
+ const hasChildren = element[HostChildrenKey].length > 0;
6693
+ const attrs = element[HostAttributesKey].length
6694
+ ? ` ${serializeAttributes(element[HostAttributesKey])}`
6695
+ : '';
6696
+ output += `<${tagName}${attrs}`;
6670
6697
  // Note that foreign elements can have children but not shadow roots
6671
6698
  if (isForeignElement && !hasChildren) {
6672
6699
  output += '/>';
6673
6700
  return output;
6674
6701
  }
6675
6702
  output += '>';
6676
- if (element.shadowRoot) {
6677
- output += serializeShadowRoot(element.shadowRoot);
6703
+ if (element[HostShadowRootKey]) {
6704
+ output += serializeShadowRoot(element[HostShadowRootKey]);
6678
6705
  }
6679
- output += serializeChildNodes(element.children);
6680
- if (!isVoidElement(name, namespace) || hasChildren) {
6681
- output += `</${name}>`;
6706
+ output += serializeChildNodes(element[HostChildrenKey]);
6707
+ if (!isVoidElement(tagName, namespace) || hasChildren) {
6708
+ output += `</${tagName}>`;
6682
6709
  }
6683
6710
  return output;
6684
6711
  }
@@ -6690,14 +6717,14 @@ function serializeElement(element) {
6690
6717
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6691
6718
  */
6692
6719
  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: {},
6720
+ [HostTypeKey]: HostNodeType.Element,
6721
+ tagName: 'fake-root-element',
6722
+ [HostNamespaceKey]: HTML_NAMESPACE,
6723
+ [HostParentKey]: null,
6724
+ [HostShadowRootKey]: null,
6725
+ [HostChildrenKey]: [],
6726
+ [HostAttributesKey]: [],
6727
+ [HostEventListenersKey]: {},
6701
6728
  };
6702
6729
  function renderComponent(tagName, Ctor, props = {}) {
6703
6730
  if (!isString(tagName)) {
@@ -6718,7 +6745,7 @@ function renderComponent(tagName, Ctor, props = {}) {
6718
6745
  for (const [key, value] of Object.entries(props)) {
6719
6746
  element[key] = value;
6720
6747
  }
6721
- element.parent = FakeRootElement;
6748
+ element[HostParentKey] = FakeRootElement;
6722
6749
  connectRootElement(element);
6723
6750
  return serializeElement(element);
6724
6751
  }
@@ -6731,6 +6758,6 @@ function renderComponent(tagName, Ctor, props = {}) {
6731
6758
  */
6732
6759
  freeze(LightningElement);
6733
6760
  seal(LightningElement.prototype);
6734
- /* version: 2.20.2 */
6761
+ /* version: 2.20.5 */
6735
6762
 
6736
6763
  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 };