lwc 2.20.4 → 2.22.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 +181 -127
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +181 -127
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +168 -115
  5. package/dist/engine-dom/iife/es5/engine-dom.js +226 -147
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +201 -119
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +181 -127
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +168 -115
  11. package/dist/engine-dom/umd/es5/engine-dom.js +226 -147
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +201 -119
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +89 -318
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +89 -318
  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
@@ -368,9 +368,9 @@
368
368
  // Increment whenever the LWC template compiler changes
369
369
 
370
370
 
371
- var LWC_VERSION = "2.20.4";
371
+ var LWC_VERSION = "2.22.0";
372
372
  var LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
373
- /** version: 2.20.4 */
373
+ /** version: 2.22.0 */
374
374
 
375
375
  /*
376
376
  * Copyright (c) 2018, salesforce.com, inc.
@@ -549,7 +549,7 @@
549
549
  setFeatureFlag(name, value);
550
550
  }
551
551
  }
552
- /** version: 2.20.4 */
552
+ /** version: 2.22.0 */
553
553
 
554
554
  /*
555
555
  * Copyright (c) 2018, salesforce.com, inc.
@@ -855,20 +855,24 @@
855
855
 
856
856
  return ReactiveObserver;
857
857
  }();
858
- /*
859
- * Copyright (c) 2018, salesforce.com, inc.
860
- * All rights reserved.
861
- * SPDX-License-Identifier: MIT
862
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
863
- */
864
-
865
858
 
866
859
  function componentValueMutated(vm, key) {
867
- valueMutated(vm.component, key);
860
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
861
+ {
862
+ valueMutated(vm.component, key);
863
+ }
868
864
  }
869
865
 
870
866
  function componentValueObserved(vm, key) {
871
- valueObserved(vm.component, key);
867
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
868
+ {
869
+ valueObserved(vm.component, key);
870
+ }
871
+ }
872
+
873
+ function createReactiveObserver(callback) {
874
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
875
+ return new ReactiveObserver(callback);
872
876
  }
873
877
  /*
874
878
  * Copyright (c) 2018, salesforce.com, inc.
@@ -2283,8 +2287,28 @@
2283
2287
  */
2284
2288
 
2285
2289
  function unwrap(value) {
2290
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2286
2291
  return reactiveMembrane.unwrapProxy(value);
2287
2292
  }
2293
+
2294
+ function getReadOnlyProxy(value) {
2295
+ // We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
2296
+ // them from their parents. This applies to both the client and server.
2297
+ return reactiveMembrane.getReadOnlyProxy(value);
2298
+ }
2299
+
2300
+ function getReactiveProxy(value) {
2301
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2302
+ return reactiveMembrane.getProxy(value);
2303
+ } // Making the component instance a live value when using Locker to support expandos.
2304
+
2305
+
2306
+ function markLockerLiveObject(obj) {
2307
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2308
+ {
2309
+ obj[lockerLivePropertyKey] = undefined;
2310
+ }
2311
+ }
2288
2312
  /*
2289
2313
  * Copyright (c) 2018, salesforce.com, inc.
2290
2314
  * All rights reserved.
@@ -2399,10 +2423,9 @@
2399
2423
  vm.callHook = _callHook;
2400
2424
  vm.setHook = _setHook;
2401
2425
  vm.getHook = _getHook;
2402
- } // Making the component instance a live value when using Locker to support expandos.
2403
-
2426
+ }
2404
2427
 
2405
- this[lockerLivePropertyKey] = undefined; // Linking elm, shadow root and component with the VM.
2428
+ markLockerLiveObject(this); // Linking elm, shadow root and component with the VM.
2406
2429
 
2407
2430
  associateVM(component, vm);
2408
2431
  associateVM(elm, vm);
@@ -2742,55 +2765,6 @@
2742
2765
  configurable: true
2743
2766
  };
2744
2767
  }
2745
- /*
2746
- * Copyright (c) 2018, salesforce.com, inc.
2747
- * All rights reserved.
2748
- * SPDX-License-Identifier: MIT
2749
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2750
- */
2751
-
2752
-
2753
- function api$1() {
2754
- if (process.env.NODE_ENV !== 'production') {
2755
- assert.fail("@api decorator can only be used as a decorator function.");
2756
- }
2757
-
2758
- throw new Error();
2759
- }
2760
-
2761
- function createPublicPropertyDescriptor(key) {
2762
- return {
2763
- get: function get() {
2764
- var vm = getAssociatedVM(this);
2765
-
2766
- if (isBeingConstructed(vm)) {
2767
- if (process.env.NODE_ENV !== 'production') {
2768
- logError("Can\u2019t read the value of property `".concat(toString$1(key), "` from the constructor because the owner component hasn\u2019t set the value yet. Instead, use the constructor to set a default value for the property."), vm);
2769
- }
2770
-
2771
- return;
2772
- }
2773
-
2774
- componentValueObserved(vm, key);
2775
- return vm.cmpProps[key];
2776
- },
2777
- set: function set(newValue) {
2778
- var vm = getAssociatedVM(this);
2779
-
2780
- if (process.env.NODE_ENV !== 'production') {
2781
- var _vmBeingRendered3 = getVMBeingRendered();
2782
-
2783
- assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2784
- assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2785
- }
2786
-
2787
- vm.cmpProps[key] = newValue;
2788
- componentValueMutated(vm, key);
2789
- },
2790
- enumerable: true,
2791
- configurable: true
2792
- };
2793
- }
2794
2768
 
2795
2769
  var AccessorReactiveObserver = /*#__PURE__*/function (_ReactiveObserver) {
2796
2770
  _inherits(AccessorReactiveObserver, _ReactiveObserver);
@@ -2849,6 +2823,60 @@
2849
2823
  return AccessorReactiveObserver;
2850
2824
  }(ReactiveObserver);
2851
2825
 
2826
+ function createAccessorReactiveObserver(vm, set) {
2827
+ // On the server side, we don't need mutation tracking. Skipping it improves performance.
2828
+ return new AccessorReactiveObserver(vm, set);
2829
+ }
2830
+ /*
2831
+ * Copyright (c) 2018, salesforce.com, inc.
2832
+ * All rights reserved.
2833
+ * SPDX-License-Identifier: MIT
2834
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2835
+ */
2836
+
2837
+
2838
+ function api$1() {
2839
+ if (process.env.NODE_ENV !== 'production') {
2840
+ assert.fail("@api decorator can only be used as a decorator function.");
2841
+ }
2842
+
2843
+ throw new Error();
2844
+ }
2845
+
2846
+ function createPublicPropertyDescriptor(key) {
2847
+ return {
2848
+ get: function get() {
2849
+ var vm = getAssociatedVM(this);
2850
+
2851
+ if (isBeingConstructed(vm)) {
2852
+ if (process.env.NODE_ENV !== 'production') {
2853
+ logError("Can\u2019t read the value of property `".concat(toString$1(key), "` from the constructor because the owner component hasn\u2019t set the value yet. Instead, use the constructor to set a default value for the property."), vm);
2854
+ }
2855
+
2856
+ return;
2857
+ }
2858
+
2859
+ componentValueObserved(vm, key);
2860
+ return vm.cmpProps[key];
2861
+ },
2862
+ set: function set(newValue) {
2863
+ var vm = getAssociatedVM(this);
2864
+
2865
+ if (process.env.NODE_ENV !== 'production') {
2866
+ var _vmBeingRendered3 = getVMBeingRendered();
2867
+
2868
+ assert.invariant(!isInvokingRender, "".concat(_vmBeingRendered3, ".render() method has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2869
+ assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered3, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2870
+ }
2871
+
2872
+ vm.cmpProps[key] = newValue;
2873
+ componentValueMutated(vm, key);
2874
+ },
2875
+ enumerable: true,
2876
+ configurable: true
2877
+ };
2878
+ }
2879
+
2852
2880
  function createPublicAccessorDescriptor(key, descriptor) {
2853
2881
  var _get3 = descriptor.get,
2854
2882
  _set2 = descriptor.set,
@@ -2889,7 +2917,7 @@
2889
2917
  var ro = vm.oar[key];
2890
2918
 
2891
2919
  if (isUndefined$1(ro)) {
2892
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, _set2);
2920
+ ro = vm.oar[key] = createAccessorReactiveObserver(vm, _set2);
2893
2921
  } // every time we invoke this setter from outside (through this wrapper setter)
2894
2922
  // we should reset the value and then debounce just in case there is a pending
2895
2923
  // invocation the next tick that is not longer relevant since the value is changing
@@ -2921,7 +2949,7 @@
2921
2949
 
2922
2950
  function track(target) {
2923
2951
  if (arguments.length === 1) {
2924
- return reactiveMembrane.getProxy(target);
2952
+ return getReactiveProxy(target);
2925
2953
  }
2926
2954
 
2927
2955
  if (process.env.NODE_ENV !== 'production') {
@@ -2948,7 +2976,7 @@
2948
2976
  assert.invariant(!isUpdatingTemplate, "Updating the template of ".concat(_vmBeingRendered5, " has side effects on the state of ").concat(vm, ".").concat(toString$1(key)));
2949
2977
  }
2950
2978
 
2951
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2979
+ var reactiveOrAnyValue = getReactiveProxy(newValue);
2952
2980
 
2953
2981
  if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2954
2982
  vm.cmpFields[key] = reactiveOrAnyValue;
@@ -3423,7 +3451,7 @@
3423
3451
  fn = cachedSetterByKey[key] = function (newValue) {
3424
3452
  var vm = getAssociatedVM(this);
3425
3453
  var setHook = vm.setHook;
3426
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
3454
+ newValue = getReadOnlyProxy(newValue);
3427
3455
  setHook(vm.component, key, newValue);
3428
3456
  };
3429
3457
  }
@@ -4855,10 +4883,11 @@
4855
4883
  svg = vnode.data.svg;
4856
4884
  var createElement = renderer.createElement;
4857
4885
  var namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
4858
- var elm = createElement(sel, namespace);
4886
+ var elm = vnode.elm = createElement(sel, namespace);
4859
4887
  linkNodeToShadow(elm, owner, renderer);
4860
- fallbackElmHook(elm, vnode, renderer);
4861
- vnode.elm = elm;
4888
+ applyStyleScoping(elm, owner, renderer);
4889
+ applyDomManual(elm, vnode);
4890
+ applyElementRestrictions(elm, vnode);
4862
4891
  patchElementPropsAndAttrs$1(null, vnode, renderer);
4863
4892
  insertNode(elm, parent, anchor, renderer);
4864
4893
  mountVNodes(vnode.children, elm, renderer, null);
@@ -4875,7 +4904,8 @@
4875
4904
  var cloneNode = renderer.cloneNode,
4876
4905
  isSyntheticShadowDefined = renderer.isSyntheticShadowDefined;
4877
4906
  var elm = vnode.elm = cloneNode(vnode.fragment, true);
4878
- linkNodeToShadow(elm, owner, renderer); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
4907
+ linkNodeToShadow(elm, owner, renderer);
4908
+ applyElementRestrictions(elm, vnode); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
4879
4909
 
4880
4910
  var renderMode = owner.renderMode,
4881
4911
  shadowMode = owner.shadowMode;
@@ -4890,16 +4920,6 @@
4890
4920
  }
4891
4921
  }
4892
4922
 
4893
- if (process.env.NODE_ENV !== 'production') {
4894
- var isLight = renderMode === 0
4895
- /* RenderMode.Light */
4896
- ;
4897
- patchElementWithRestrictions(elm, {
4898
- isPortal: false,
4899
- isLight: isLight
4900
- });
4901
- }
4902
-
4903
4923
  insertNode(elm, parent, anchor, renderer);
4904
4924
  }
4905
4925
 
@@ -4919,9 +4939,10 @@
4919
4939
  // the custom element from the registry is expecting an upgrade callback
4920
4940
  vm = createViewModelHook(elm, vnode, renderer);
4921
4941
  });
4922
- linkNodeToShadow(elm, owner, renderer);
4923
4942
  vnode.elm = elm;
4924
4943
  vnode.vm = vm;
4944
+ linkNodeToShadow(elm, owner, renderer);
4945
+ applyStyleScoping(elm, owner, renderer);
4925
4946
 
4926
4947
  if (vm) {
4927
4948
  allocateChildren(vnode, vm);
@@ -5043,26 +5064,6 @@
5043
5064
  return vnode != null;
5044
5065
  }
5045
5066
 
5046
- function observeElementChildNodes(elm) {
5047
- elm.$domManual$ = true;
5048
- }
5049
-
5050
- function setElementShadowToken(elm, token) {
5051
- elm.$shadowToken$ = token;
5052
- } // Set the scope token class for *.scoped.css styles
5053
-
5054
-
5055
- function setScopeTokenClassIfNecessary(elm, owner, renderer) {
5056
- var token = getScopeTokenClass(owner);
5057
-
5058
- if (!isNull(token)) {
5059
- var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
5060
- // probably we should have a renderer api for just the add operation
5061
-
5062
- _getClassList(elm).add(token);
5063
- }
5064
- }
5065
-
5066
5067
  function linkNodeToShadow(elm, owner, renderer) {
5067
5068
  var renderRoot = owner.renderRoot,
5068
5069
  renderMode = owner.renderMode,
@@ -5135,36 +5136,52 @@
5135
5136
  patchProps(oldVnode, vnode, renderer);
5136
5137
  }
5137
5138
 
5138
- function fallbackElmHook(elm, vnode, renderer) {
5139
- var owner = vnode.owner;
5140
- setScopeTokenClassIfNecessary(elm, owner, renderer);
5139
+ function applyStyleScoping(elm, owner, renderer) {
5140
+ // Set the class name for `*.scoped.css` style scoping.
5141
+ var scopeToken = getScopeTokenClass(owner);
5142
+
5143
+ if (!isNull(scopeToken)) {
5144
+ var _getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
5145
+ // probably we should have a renderer api for just the add operation
5146
+
5147
+ _getClassList(elm).add(scopeToken);
5148
+ } // Set property element for synthetic shadow DOM style scoping.
5149
+
5150
+
5151
+ var syntheticToken = owner.context.stylesheetToken;
5141
5152
 
5142
5153
  if (owner.shadowMode === 1
5143
5154
  /* ShadowMode.Synthetic */
5144
- ) {
5145
- var context = vnode.data.context;
5146
- var stylesheetToken = owner.context.stylesheetToken;
5155
+ && !isUndefined$1(syntheticToken)) {
5156
+ elm.$shadowToken$ = syntheticToken;
5157
+ }
5158
+ }
5147
5159
 
5148
- if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
5149
- /* LwcDomMode.Manual */
5150
- ) {
5151
- // this element will now accept any manual content inserted into it
5152
- observeElementChildNodes(elm);
5153
- }
5160
+ function applyDomManual(elm, vnode) {
5161
+ var _a;
5154
5162
 
5155
- if (!isUndefined$1(stylesheetToken)) {
5156
- // when running in synthetic shadow mode, we need to set the shadowToken value
5157
- // into each element from the template, so they can be styled accordingly.
5158
- setElementShadowToken(elm, stylesheetToken);
5159
- }
5163
+ var owner = vnode.owner,
5164
+ context = vnode.data.context;
5165
+
5166
+ if (owner.shadowMode === 1
5167
+ /* ShadowMode.Synthetic */
5168
+ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
5169
+ /* LwcDomMode.Manual */
5170
+ ) {
5171
+ elm.$domManual$ = true;
5160
5172
  }
5173
+ }
5174
+
5175
+ function applyElementRestrictions(elm, vnode) {
5176
+ var _a, _b;
5161
5177
 
5162
5178
  if (process.env.NODE_ENV !== 'production') {
5163
- var _context = vnode.data.context;
5164
- var isPortal = !isUndefined$1(_context) && !isUndefined$1(_context.lwc) && _context.lwc.dom === "manual"
5179
+ var isPortal = vnode.type === 2
5180
+ /* VNodeType.Element */
5181
+ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual"
5165
5182
  /* LwcDomMode.Manual */
5166
5183
  ;
5167
- var isLight = owner.renderMode === 0
5184
+ var isLight = vnode.owner.renderMode === 0
5168
5185
  /* RenderMode.Light */
5169
5186
  ;
5170
5187
  patchElementWithRestrictions(elm, {
@@ -5217,19 +5234,6 @@
5217
5234
  mode = vnode.mode,
5218
5235
  ctor = vnode.ctor,
5219
5236
  owner = vnode.owner;
5220
- setScopeTokenClassIfNecessary(elm, owner, renderer);
5221
-
5222
- if (owner.shadowMode === 1
5223
- /* ShadowMode.Synthetic */
5224
- ) {
5225
- var stylesheetToken = owner.context.stylesheetToken; // when running in synthetic shadow mode, we need to set the shadowToken value
5226
- // into each element from the template, so they can be styled accordingly.
5227
-
5228
- if (!isUndefined$1(stylesheetToken)) {
5229
- setElementShadowToken(elm, stylesheetToken);
5230
- }
5231
- }
5232
-
5233
5237
  vm = createVM(elm, ctor, renderer, {
5234
5238
  mode: mode,
5235
5239
  owner: owner,
@@ -6496,7 +6500,7 @@
6496
6500
  }
6497
6501
 
6498
6502
  function getTemplateReactiveObserver(vm) {
6499
- return new ReactiveObserver(function () {
6503
+ return createReactiveObserver(function () {
6500
6504
  var isDirty = vm.isDirty;
6501
6505
 
6502
6506
  if (isFalse(isDirty)) {
@@ -7315,7 +7319,7 @@
7315
7319
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
7316
7320
  var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
7317
7321
 
7318
- var ro = new ReactiveObserver(function () {
7322
+ var ro = createReactiveObserver(function () {
7319
7323
  if (hasPendingConfig === false) {
7320
7324
  hasPendingConfig = true; // collect new config in the micro-task
7321
7325
 
@@ -7616,7 +7620,7 @@
7616
7620
  }
7617
7621
  }
7618
7622
 
7619
- return reactiveMembrane.getReadOnlyProxy(obj);
7623
+ return getReadOnlyProxy(obj);
7620
7624
  }
7621
7625
  /*
7622
7626
  * Copyright (c) 2022, salesforce.com, inc.
@@ -8297,7 +8301,7 @@
8297
8301
 
8298
8302
  return ctor;
8299
8303
  }
8300
- /* version: 2.20.4 */
8304
+ /* version: 2.22.0 */
8301
8305
 
8302
8306
  /*
8303
8307
  * Copyright (c) 2018, salesforce.com, inc.
@@ -8465,6 +8469,85 @@
8465
8469
  */
8466
8470
 
8467
8471
 
8472
+ var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
8473
+ var createFragment;
8474
+
8475
+ if (SUPPORTS_TEMPLATE) {
8476
+ // Parse the fragment HTML string into DOM
8477
+ createFragment = function createFragment(html) {
8478
+ var template = document.createElement('template');
8479
+ template.innerHTML = html;
8480
+ return template.content.firstChild;
8481
+ };
8482
+ } else {
8483
+ // In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
8484
+ // <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
8485
+ // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
8486
+ // With other elements added from:
8487
+ // https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
8488
+ // Using the test:
8489
+ // document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
8490
+ // And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
8491
+ var topLevelWrappingMap = {
8492
+ caption: ['table'],
8493
+ col: ['colgroup', 'table'],
8494
+ colgroup: ['table'],
8495
+ option: ['select'],
8496
+ tbody: ['table'],
8497
+ td: ['tr', 'tbody', 'table'],
8498
+ th: ['tr', 'tbody', 'table'],
8499
+ thead: ['table'],
8500
+ tfoot: ['table'],
8501
+ tr: ['tbody', 'table']
8502
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
8503
+
8504
+ var getTagName = function getTagName(text) {
8505
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
8506
+ }; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
8507
+
8508
+
8509
+ createFragment = function createFragment(html) {
8510
+ var wrapperTags = topLevelWrappingMap[getTagName(html)];
8511
+
8512
+ if (!isUndefined$1(wrapperTags)) {
8513
+ var _iterator5 = _createForOfIteratorHelper(wrapperTags),
8514
+ _step5;
8515
+
8516
+ try {
8517
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
8518
+ var wrapperTag = _step5.value;
8519
+ html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
8520
+ }
8521
+ } catch (err) {
8522
+ _iterator5.e(err);
8523
+ } finally {
8524
+ _iterator5.f();
8525
+ }
8526
+ } // For IE11, the document title must not be undefined, but it can be an empty string
8527
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
8528
+
8529
+
8530
+ var doc = document.implementation.createHTMLDocument('');
8531
+ doc.body.innerHTML = html;
8532
+ var content = doc.body;
8533
+
8534
+ if (!isUndefined$1(wrapperTags)) {
8535
+ for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
8536
+ content = content.firstChild;
8537
+ }
8538
+ }
8539
+
8540
+ return content.firstChild;
8541
+ };
8542
+ }
8543
+ /*
8544
+ * Copyright (c) 2018, salesforce.com, inc.
8545
+ * All rights reserved.
8546
+ * SPDX-License-Identifier: MIT
8547
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
8548
+ */
8549
+
8550
+
8468
8551
  var getCustomElement;
8469
8552
  var defineCustomElement;
8470
8553
  var HTMLElementConstructor;
@@ -8565,10 +8648,6 @@
8565
8648
  return node.cloneNode(deep);
8566
8649
  }
8567
8650
 
8568
- function createFragment(html) {
8569
- return document.createRange().createContextualFragment(html).firstChild;
8570
- }
8571
-
8572
8651
  function createElement$1(tagName, namespace) {
8573
8652
  return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
8574
8653
  }
@@ -8793,8 +8872,8 @@
8793
8872
  hydrated: true
8794
8873
  });
8795
8874
 
8796
- for (var _i32 = 0, _Object$entries2 = Object.entries(props); _i32 < _Object$entries2.length; _i32++) {
8797
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i32], 2),
8875
+ for (var _i33 = 0, _Object$entries2 = Object.entries(props); _i33 < _Object$entries2.length; _i33++) {
8876
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i33], 2),
8798
8877
  key = _Object$entries2$_i[0],
8799
8878
  value = _Object$entries2$_i[1];
8800
8879
 
@@ -9126,7 +9205,7 @@
9126
9205
  });
9127
9206
  freeze(LightningElement);
9128
9207
  seal(LightningElement.prototype);
9129
- /* version: 2.20.4 */
9208
+ /* version: 2.22.0 */
9130
9209
 
9131
9210
  exports.LightningElement = LightningElement;
9132
9211
  exports.__unstable__ProfilerControl = profilerControl;