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.
- package/dist/engine-dom/esm/es2017/engine-dom.js +181 -127
- package/dist/engine-dom/iife/es2017/engine-dom.js +181 -127
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +168 -115
- package/dist/engine-dom/iife/es5/engine-dom.js +226 -147
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +201 -119
- package/dist/engine-dom/umd/es2017/engine-dom.js +181 -127
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +168 -115
- package/dist/engine-dom/umd/es5/engine-dom.js +226 -147
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +201 -119
- package/dist/engine-server/commonjs/es2017/engine-server.js +89 -318
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +89 -318
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +3 -3
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +3 -3
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +2 -2
- package/dist/wire-service/iife/es5/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +2 -2
- package/dist/wire-service/umd/es5/wire-service_debug.js +2 -2
- package/package.json +7 -7
|
@@ -291,7 +291,7 @@ var LWC = (function (exports) {
|
|
|
291
291
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
292
292
|
return attributeName;
|
|
293
293
|
}
|
|
294
|
-
/** version: 2.
|
|
294
|
+
/** version: 2.22.0 */
|
|
295
295
|
|
|
296
296
|
/*
|
|
297
297
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -592,18 +592,21 @@ var LWC = (function (exports) {
|
|
|
592
592
|
ArrayPush$1.call(this.listeners, reactiveObservers);
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
|
|
596
|
-
/*
|
|
597
|
-
* Copyright (c) 2018, salesforce.com, inc.
|
|
598
|
-
* All rights reserved.
|
|
599
|
-
* SPDX-License-Identifier: MIT
|
|
600
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
601
|
-
*/
|
|
602
595
|
function componentValueMutated(vm, key) {
|
|
603
|
-
|
|
596
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
597
|
+
{
|
|
598
|
+
valueMutated(vm.component, key);
|
|
599
|
+
}
|
|
604
600
|
}
|
|
605
601
|
function componentValueObserved(vm, key) {
|
|
606
|
-
|
|
602
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
603
|
+
{
|
|
604
|
+
valueObserved(vm.component, key);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
function createReactiveObserver(callback) {
|
|
608
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
609
|
+
return new ReactiveObserver(callback) ;
|
|
607
610
|
}
|
|
608
611
|
|
|
609
612
|
/*
|
|
@@ -1286,7 +1289,24 @@ var LWC = (function (exports) {
|
|
|
1286
1289
|
* change or being removed.
|
|
1287
1290
|
*/
|
|
1288
1291
|
function unwrap(value) {
|
|
1289
|
-
|
|
1292
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1293
|
+
return reactiveMembrane.unwrapProxy(value) ;
|
|
1294
|
+
}
|
|
1295
|
+
function getReadOnlyProxy(value) {
|
|
1296
|
+
// We must return a frozen wrapper around the value, so that child components cannot mutate properties passed to
|
|
1297
|
+
// them from their parents. This applies to both the client and server.
|
|
1298
|
+
return reactiveMembrane.getReadOnlyProxy(value);
|
|
1299
|
+
}
|
|
1300
|
+
function getReactiveProxy(value) {
|
|
1301
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1302
|
+
return reactiveMembrane.getProxy(value) ;
|
|
1303
|
+
}
|
|
1304
|
+
// Making the component instance a live value when using Locker to support expandos.
|
|
1305
|
+
function markLockerLiveObject(obj) {
|
|
1306
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1307
|
+
{
|
|
1308
|
+
obj[lockerLivePropertyKey] = undefined;
|
|
1309
|
+
}
|
|
1290
1310
|
}
|
|
1291
1311
|
|
|
1292
1312
|
/*
|
|
@@ -1356,8 +1376,7 @@ var LWC = (function (exports) {
|
|
|
1356
1376
|
vm.setHook = setHook;
|
|
1357
1377
|
vm.getHook = getHook;
|
|
1358
1378
|
}
|
|
1359
|
-
|
|
1360
|
-
this[lockerLivePropertyKey] = undefined;
|
|
1379
|
+
markLockerLiveObject(this);
|
|
1361
1380
|
// Linking elm, shadow root and component with the VM.
|
|
1362
1381
|
associateVM(component, vm);
|
|
1363
1382
|
associateVM(elm, vm);
|
|
@@ -1564,6 +1583,45 @@ var LWC = (function (exports) {
|
|
|
1564
1583
|
configurable: true,
|
|
1565
1584
|
};
|
|
1566
1585
|
}
|
|
1586
|
+
class AccessorReactiveObserver extends ReactiveObserver {
|
|
1587
|
+
constructor(vm, set) {
|
|
1588
|
+
super(() => {
|
|
1589
|
+
if (isFalse(this.debouncing)) {
|
|
1590
|
+
this.debouncing = true;
|
|
1591
|
+
addCallbackToNextTick(() => {
|
|
1592
|
+
if (isTrue(this.debouncing)) {
|
|
1593
|
+
const { value } = this;
|
|
1594
|
+
const { isDirty: dirtyStateBeforeSetterCall, component, idx } = vm;
|
|
1595
|
+
set.call(component, value);
|
|
1596
|
+
// de-bouncing after the call to the original setter to prevent
|
|
1597
|
+
// infinity loop if the setter itself is mutating things that
|
|
1598
|
+
// were accessed during the previous invocation.
|
|
1599
|
+
this.debouncing = false;
|
|
1600
|
+
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
|
|
1601
|
+
// immediate rehydration due to a setter driven mutation, otherwise
|
|
1602
|
+
// the component will get rendered on the second tick, which it is not
|
|
1603
|
+
// desirable.
|
|
1604
|
+
rerenderVM(vm);
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1610
|
+
this.debouncing = false;
|
|
1611
|
+
}
|
|
1612
|
+
reset(value) {
|
|
1613
|
+
super.reset();
|
|
1614
|
+
this.debouncing = false;
|
|
1615
|
+
if (arguments.length > 0) {
|
|
1616
|
+
this.value = value;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
function createAccessorReactiveObserver(vm, set) {
|
|
1621
|
+
// On the server side, we don't need mutation tracking. Skipping it improves performance.
|
|
1622
|
+
return new AccessorReactiveObserver(vm, set)
|
|
1623
|
+
;
|
|
1624
|
+
}
|
|
1567
1625
|
|
|
1568
1626
|
/*
|
|
1569
1627
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1600,50 +1658,6 @@ var LWC = (function (exports) {
|
|
|
1600
1658
|
configurable: true
|
|
1601
1659
|
};
|
|
1602
1660
|
}
|
|
1603
|
-
class AccessorReactiveObserver extends ReactiveObserver {
|
|
1604
|
-
constructor(vm, set) {
|
|
1605
|
-
super(() => {
|
|
1606
|
-
if (isFalse(this.debouncing)) {
|
|
1607
|
-
this.debouncing = true;
|
|
1608
|
-
addCallbackToNextTick(() => {
|
|
1609
|
-
if (isTrue(this.debouncing)) {
|
|
1610
|
-
const {
|
|
1611
|
-
value
|
|
1612
|
-
} = this;
|
|
1613
|
-
const {
|
|
1614
|
-
isDirty: dirtyStateBeforeSetterCall,
|
|
1615
|
-
component,
|
|
1616
|
-
idx
|
|
1617
|
-
} = vm;
|
|
1618
|
-
set.call(component, value); // de-bouncing after the call to the original setter to prevent
|
|
1619
|
-
// infinity loop if the setter itself is mutating things that
|
|
1620
|
-
// were accessed during the previous invocation.
|
|
1621
|
-
|
|
1622
|
-
this.debouncing = false;
|
|
1623
|
-
|
|
1624
|
-
if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {
|
|
1625
|
-
// immediate rehydration due to a setter driven mutation, otherwise
|
|
1626
|
-
// the component will get rendered on the second tick, which it is not
|
|
1627
|
-
// desirable.
|
|
1628
|
-
rerenderVM(vm);
|
|
1629
|
-
}
|
|
1630
|
-
}
|
|
1631
|
-
});
|
|
1632
|
-
}
|
|
1633
|
-
});
|
|
1634
|
-
this.debouncing = false;
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
reset(value) {
|
|
1638
|
-
super.reset();
|
|
1639
|
-
this.debouncing = false;
|
|
1640
|
-
|
|
1641
|
-
if (arguments.length > 0) {
|
|
1642
|
-
this.value = value;
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
}
|
|
1647
1661
|
function createPublicAccessorDescriptor(key, descriptor) {
|
|
1648
1662
|
const {
|
|
1649
1663
|
get,
|
|
@@ -1671,7 +1685,7 @@ var LWC = (function (exports) {
|
|
|
1671
1685
|
let ro = vm.oar[key];
|
|
1672
1686
|
|
|
1673
1687
|
if (isUndefined$1(ro)) {
|
|
1674
|
-
ro = vm.oar[key] =
|
|
1688
|
+
ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
|
|
1675
1689
|
} // every time we invoke this setter from outside (through this wrapper setter)
|
|
1676
1690
|
// we should reset the value and then debounce just in case there is a pending
|
|
1677
1691
|
// invocation the next tick that is not longer relevant since the value is changing
|
|
@@ -1701,7 +1715,7 @@ var LWC = (function (exports) {
|
|
|
1701
1715
|
*/
|
|
1702
1716
|
function track(target) {
|
|
1703
1717
|
if (arguments.length === 1) {
|
|
1704
|
-
return
|
|
1718
|
+
return getReactiveProxy(target);
|
|
1705
1719
|
}
|
|
1706
1720
|
throw new Error();
|
|
1707
1721
|
}
|
|
@@ -1714,7 +1728,7 @@ var LWC = (function (exports) {
|
|
|
1714
1728
|
},
|
|
1715
1729
|
set(newValue) {
|
|
1716
1730
|
const vm = getAssociatedVM(this);
|
|
1717
|
-
const reactiveOrAnyValue =
|
|
1731
|
+
const reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
1718
1732
|
if (reactiveOrAnyValue !== vm.cmpFields[key]) {
|
|
1719
1733
|
vm.cmpFields[key] = reactiveOrAnyValue;
|
|
1720
1734
|
componentValueMutated(vm, key);
|
|
@@ -1967,7 +1981,7 @@ var LWC = (function (exports) {
|
|
|
1967
1981
|
fn = cachedSetterByKey[key] = function (newValue) {
|
|
1968
1982
|
const vm = getAssociatedVM(this);
|
|
1969
1983
|
const { setHook } = vm;
|
|
1970
|
-
newValue =
|
|
1984
|
+
newValue = getReadOnlyProxy(newValue);
|
|
1971
1985
|
setHook(vm.component, key, newValue);
|
|
1972
1986
|
};
|
|
1973
1987
|
}
|
|
@@ -2811,10 +2825,10 @@ var LWC = (function (exports) {
|
|
|
2811
2825
|
const { sel, owner, data: { svg }, } = vnode;
|
|
2812
2826
|
const { createElement } = renderer;
|
|
2813
2827
|
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
2814
|
-
const elm = createElement(sel, namespace);
|
|
2828
|
+
const elm = (vnode.elm = createElement(sel, namespace));
|
|
2815
2829
|
linkNodeToShadow(elm, owner, renderer);
|
|
2816
|
-
|
|
2817
|
-
|
|
2830
|
+
applyStyleScoping(elm, owner, renderer);
|
|
2831
|
+
applyDomManual(elm, vnode);
|
|
2818
2832
|
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
2819
2833
|
insertNode(elm, parent, anchor, renderer);
|
|
2820
2834
|
mountVNodes(vnode.children, elm, renderer, null);
|
|
@@ -2852,9 +2866,10 @@ var LWC = (function (exports) {
|
|
|
2852
2866
|
// the custom element from the registry is expecting an upgrade callback
|
|
2853
2867
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
2854
2868
|
});
|
|
2855
|
-
linkNodeToShadow(elm, owner, renderer);
|
|
2856
2869
|
vnode.elm = elm;
|
|
2857
2870
|
vnode.vm = vm;
|
|
2871
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
2872
|
+
applyStyleScoping(elm, owner, renderer);
|
|
2858
2873
|
if (vm) {
|
|
2859
2874
|
allocateChildren(vnode, vm);
|
|
2860
2875
|
}
|
|
@@ -2935,22 +2950,6 @@ var LWC = (function (exports) {
|
|
|
2935
2950
|
function isVNode(vnode) {
|
|
2936
2951
|
return vnode != null;
|
|
2937
2952
|
}
|
|
2938
|
-
function observeElementChildNodes(elm) {
|
|
2939
|
-
elm.$domManual$ = true;
|
|
2940
|
-
}
|
|
2941
|
-
function setElementShadowToken(elm, token) {
|
|
2942
|
-
elm.$shadowToken$ = token;
|
|
2943
|
-
}
|
|
2944
|
-
// Set the scope token class for *.scoped.css styles
|
|
2945
|
-
function setScopeTokenClassIfNecessary(elm, owner, renderer) {
|
|
2946
|
-
const token = getScopeTokenClass(owner);
|
|
2947
|
-
if (!isNull(token)) {
|
|
2948
|
-
const { getClassList } = renderer;
|
|
2949
|
-
// TODO [#2762]: this dot notation with add is probably problematic
|
|
2950
|
-
// probably we should have a renderer api for just the add operation
|
|
2951
|
-
getClassList(elm).add(token);
|
|
2952
|
-
}
|
|
2953
|
-
}
|
|
2954
2953
|
function linkNodeToShadow(elm, owner, renderer) {
|
|
2955
2954
|
const { renderRoot, renderMode, shadowMode } = owner;
|
|
2956
2955
|
const { isSyntheticShadowDefined } = renderer;
|
|
@@ -2985,23 +2984,26 @@ var LWC = (function (exports) {
|
|
|
2985
2984
|
patchAttributes(oldVnode, vnode, renderer);
|
|
2986
2985
|
patchProps(oldVnode, vnode, renderer);
|
|
2987
2986
|
}
|
|
2988
|
-
function
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
if (
|
|
2992
|
-
const {
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
2987
|
+
function applyStyleScoping(elm, owner, renderer) {
|
|
2988
|
+
// Set the class name for `*.scoped.css` style scoping.
|
|
2989
|
+
const scopeToken = getScopeTokenClass(owner);
|
|
2990
|
+
if (!isNull(scopeToken)) {
|
|
2991
|
+
const { getClassList } = renderer;
|
|
2992
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
2993
|
+
// probably we should have a renderer api for just the add operation
|
|
2994
|
+
getClassList(elm).add(scopeToken);
|
|
2995
|
+
}
|
|
2996
|
+
// Set property element for synthetic shadow DOM style scoping.
|
|
2997
|
+
const { stylesheetToken: syntheticToken } = owner.context;
|
|
2998
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
|
|
2999
|
+
elm.$shadowToken$ = syntheticToken;
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
function applyDomManual(elm, vnode) {
|
|
3003
|
+
var _a;
|
|
3004
|
+
const { owner, data: { context }, } = vnode;
|
|
3005
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual" /* LwcDomMode.Manual */) {
|
|
3006
|
+
elm.$domManual$ = true;
|
|
3005
3007
|
}
|
|
3006
3008
|
}
|
|
3007
3009
|
function allocateChildren(vnode, vm) {
|
|
@@ -3036,15 +3038,6 @@ var LWC = (function (exports) {
|
|
|
3036
3038
|
return vm;
|
|
3037
3039
|
}
|
|
3038
3040
|
const { sel, mode, ctor, owner } = vnode;
|
|
3039
|
-
setScopeTokenClassIfNecessary(elm, owner, renderer);
|
|
3040
|
-
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3041
|
-
const { stylesheetToken } = owner.context;
|
|
3042
|
-
// when running in synthetic shadow mode, we need to set the shadowToken value
|
|
3043
|
-
// into each element from the template, so they can be styled accordingly.
|
|
3044
|
-
if (!isUndefined$1(stylesheetToken)) {
|
|
3045
|
-
setElementShadowToken(elm, stylesheetToken);
|
|
3046
|
-
}
|
|
3047
|
-
}
|
|
3048
3041
|
vm = createVM(elm, ctor, renderer, {
|
|
3049
3042
|
mode,
|
|
3050
3043
|
owner,
|
|
@@ -3861,7 +3854,7 @@ var LWC = (function (exports) {
|
|
|
3861
3854
|
return signedTemplateMap.get(Ctor);
|
|
3862
3855
|
}
|
|
3863
3856
|
function getTemplateReactiveObserver(vm) {
|
|
3864
|
-
return
|
|
3857
|
+
return createReactiveObserver(() => {
|
|
3865
3858
|
const { isDirty } = vm;
|
|
3866
3859
|
if (isFalse(isDirty)) {
|
|
3867
3860
|
markComponentAsDirty(vm);
|
|
@@ -4596,7 +4589,7 @@ var LWC = (function (exports) {
|
|
|
4596
4589
|
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
4597
4590
|
let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
|
|
4598
4591
|
|
|
4599
|
-
const ro =
|
|
4592
|
+
const ro = createReactiveObserver(() => {
|
|
4600
4593
|
if (hasPendingConfig === false) {
|
|
4601
4594
|
hasPendingConfig = true; // collect new config in the micro-task
|
|
4602
4595
|
|
|
@@ -4882,7 +4875,7 @@ var LWC = (function (exports) {
|
|
|
4882
4875
|
* being removed.
|
|
4883
4876
|
*/
|
|
4884
4877
|
function readonly(obj) {
|
|
4885
|
-
return
|
|
4878
|
+
return getReadOnlyProxy(obj);
|
|
4886
4879
|
}
|
|
4887
4880
|
|
|
4888
4881
|
/*
|
|
@@ -5234,7 +5227,7 @@ var LWC = (function (exports) {
|
|
|
5234
5227
|
}
|
|
5235
5228
|
return ctor;
|
|
5236
5229
|
}
|
|
5237
|
-
/* version: 2.
|
|
5230
|
+
/* version: 2.22.0 */
|
|
5238
5231
|
|
|
5239
5232
|
/*
|
|
5240
5233
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5369,6 +5362,69 @@ var LWC = (function (exports) {
|
|
|
5369
5362
|
}
|
|
5370
5363
|
}
|
|
5371
5364
|
|
|
5365
|
+
/*
|
|
5366
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
5367
|
+
* All rights reserved.
|
|
5368
|
+
* SPDX-License-Identifier: MIT
|
|
5369
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5370
|
+
*/
|
|
5371
|
+
const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
|
|
5372
|
+
let createFragment;
|
|
5373
|
+
if (SUPPORTS_TEMPLATE) {
|
|
5374
|
+
// Parse the fragment HTML string into DOM
|
|
5375
|
+
createFragment = function (html) {
|
|
5376
|
+
const template = document.createElement('template');
|
|
5377
|
+
template.innerHTML = html;
|
|
5378
|
+
return template.content.firstChild;
|
|
5379
|
+
};
|
|
5380
|
+
}
|
|
5381
|
+
else {
|
|
5382
|
+
// In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
|
|
5383
|
+
// <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
|
|
5384
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
|
|
5385
|
+
// With other elements added from:
|
|
5386
|
+
// https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
|
|
5387
|
+
// Using the test:
|
|
5388
|
+
// document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
|
|
5389
|
+
// And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
|
|
5390
|
+
const topLevelWrappingMap = {
|
|
5391
|
+
caption: ['table'],
|
|
5392
|
+
col: ['colgroup', 'table'],
|
|
5393
|
+
colgroup: ['table'],
|
|
5394
|
+
option: ['select'],
|
|
5395
|
+
tbody: ['table'],
|
|
5396
|
+
td: ['tr', 'tbody', 'table'],
|
|
5397
|
+
th: ['tr', 'tbody', 'table'],
|
|
5398
|
+
thead: ['table'],
|
|
5399
|
+
tfoot: ['table'],
|
|
5400
|
+
tr: ['tbody', 'table'],
|
|
5401
|
+
};
|
|
5402
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
|
|
5403
|
+
const getTagName = function (text) {
|
|
5404
|
+
return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
|
|
5405
|
+
};
|
|
5406
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
|
|
5407
|
+
createFragment = function (html) {
|
|
5408
|
+
const wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
5409
|
+
if (!isUndefined$1(wrapperTags)) {
|
|
5410
|
+
for (const wrapperTag of wrapperTags) {
|
|
5411
|
+
html = `<${wrapperTag}>${html}</${wrapperTag}>`;
|
|
5412
|
+
}
|
|
5413
|
+
}
|
|
5414
|
+
// For IE11, the document title must not be undefined, but it can be an empty string
|
|
5415
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
|
|
5416
|
+
const doc = document.implementation.createHTMLDocument('');
|
|
5417
|
+
doc.body.innerHTML = html;
|
|
5418
|
+
let content = doc.body;
|
|
5419
|
+
if (!isUndefined$1(wrapperTags)) {
|
|
5420
|
+
for (let i = 0; i < wrapperTags.length; i++) {
|
|
5421
|
+
content = content.firstChild;
|
|
5422
|
+
}
|
|
5423
|
+
}
|
|
5424
|
+
return content.firstChild;
|
|
5425
|
+
};
|
|
5426
|
+
}
|
|
5427
|
+
|
|
5372
5428
|
/*
|
|
5373
5429
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5374
5430
|
* All rights reserved.
|
|
@@ -5447,9 +5503,6 @@ var LWC = (function (exports) {
|
|
|
5447
5503
|
function cloneNode(node, deep) {
|
|
5448
5504
|
return node.cloneNode(deep);
|
|
5449
5505
|
}
|
|
5450
|
-
function createFragment(html) {
|
|
5451
|
-
return document.createRange().createContextualFragment(html).firstChild;
|
|
5452
|
-
}
|
|
5453
5506
|
function createElement$1(tagName, namespace) {
|
|
5454
5507
|
return isUndefined$1(namespace)
|
|
5455
5508
|
? document.createElement(tagName)
|
|
@@ -5899,7 +5952,7 @@ var LWC = (function (exports) {
|
|
|
5899
5952
|
});
|
|
5900
5953
|
freeze(LightningElement);
|
|
5901
5954
|
seal(LightningElement.prototype);
|
|
5902
|
-
/* version: 2.
|
|
5955
|
+
/* version: 2.22.0 */
|
|
5903
5956
|
|
|
5904
5957
|
exports.LightningElement = LightningElement;
|
|
5905
5958
|
exports.__unstable__ProfilerControl = profilerControl;
|