lwc 2.22.0 → 2.23.2
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 +1222 -947
- package/dist/engine-dom/iife/es2017/engine-dom.js +1222 -946
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +1129 -882
- package/dist/engine-dom/iife/es5/engine-dom.js +524 -499
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +475 -457
- package/dist/engine-dom/umd/es2017/engine-dom.js +1222 -946
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +1129 -882
- package/dist/engine-dom/umd/es5/engine-dom.js +524 -499
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +475 -457
- package/dist/engine-server/commonjs/es2017/engine-server.js +809 -626
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +809 -626
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +30 -27
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +30 -27
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +29 -26
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +32 -31
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +31 -30
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +30 -27
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +29 -26
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +32 -31
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +31 -30
- 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
|
@@ -349,7 +349,11 @@
|
|
|
349
349
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
350
350
|
return attributeName;
|
|
351
351
|
}
|
|
352
|
-
/** version: 2.
|
|
352
|
+
/** version: 2.23.2 */
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Copyright (C) 2018 salesforce.com, inc.
|
|
356
|
+
*/
|
|
353
357
|
|
|
354
358
|
/*
|
|
355
359
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -359,7 +363,7 @@
|
|
|
359
363
|
*/
|
|
360
364
|
|
|
361
365
|
function detect(propName) {
|
|
362
|
-
return
|
|
366
|
+
return getOwnPropertyDescriptor$1(Element.prototype, propName) === undefined;
|
|
363
367
|
}
|
|
364
368
|
/*
|
|
365
369
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -439,6 +443,8 @@
|
|
|
439
443
|
patch$1(propName);
|
|
440
444
|
}
|
|
441
445
|
}
|
|
446
|
+
/** version: 2.23.2 */
|
|
447
|
+
|
|
442
448
|
/**
|
|
443
449
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
444
450
|
*/
|
|
@@ -459,6 +465,7 @@
|
|
|
459
465
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
460
466
|
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
461
467
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
468
|
+
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
462
469
|
ENABLE_NODE_LIST_PATCH: null,
|
|
463
470
|
ENABLE_NODE_PATCH: null,
|
|
464
471
|
ENABLE_REACTIVE_SETTER: null,
|
|
@@ -471,7 +478,7 @@
|
|
|
471
478
|
});
|
|
472
479
|
}
|
|
473
480
|
|
|
474
|
-
var
|
|
481
|
+
var lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
|
|
475
482
|
/**
|
|
476
483
|
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
|
477
484
|
* flag. It is meant to be used during the app initialization.
|
|
@@ -499,7 +506,7 @@
|
|
|
499
506
|
|
|
500
507
|
{
|
|
501
508
|
// Disallow the same flag to be set more than once in production
|
|
502
|
-
var runtimeValue =
|
|
509
|
+
var runtimeValue = lwcRuntimeFlags[name];
|
|
503
510
|
|
|
504
511
|
if (!isUndefined$1(runtimeValue)) {
|
|
505
512
|
// eslint-disable-next-line no-console
|
|
@@ -507,7 +514,7 @@
|
|
|
507
514
|
return;
|
|
508
515
|
}
|
|
509
516
|
|
|
510
|
-
defineProperty(
|
|
517
|
+
defineProperty(lwcRuntimeFlags, name, {
|
|
511
518
|
value: value
|
|
512
519
|
});
|
|
513
520
|
}
|
|
@@ -863,8 +870,8 @@
|
|
|
863
870
|
// to inject at runtime.
|
|
864
871
|
|
|
865
872
|
|
|
866
|
-
var HTMLElementConstructor
|
|
867
|
-
var HTMLElementPrototype = HTMLElementConstructor
|
|
873
|
+
var HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
|
|
874
|
+
var HTMLElementPrototype = HTMLElementConstructor.prototype;
|
|
868
875
|
/*
|
|
869
876
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
870
877
|
* All rights reserved.
|
|
@@ -1019,6 +1026,15 @@
|
|
|
1019
1026
|
HTMLElementOriginalDescriptors[propName] = descriptor;
|
|
1020
1027
|
}
|
|
1021
1028
|
});
|
|
1029
|
+
|
|
1030
|
+
function updateComponentValue(vm, key, newValue) {
|
|
1031
|
+
var cmpFields = vm.cmpFields;
|
|
1032
|
+
|
|
1033
|
+
if (newValue !== cmpFields[key]) {
|
|
1034
|
+
cmpFields[key] = newValue;
|
|
1035
|
+
componentValueMutated(vm, key);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1022
1038
|
/**
|
|
1023
1039
|
* Copyright (C) 2017 salesforce.com, inc.
|
|
1024
1040
|
*/
|
|
@@ -1749,11 +1765,7 @@
|
|
|
1749
1765
|
set: function set(newValue) {
|
|
1750
1766
|
var vm = getAssociatedVM(this);
|
|
1751
1767
|
|
|
1752
|
-
|
|
1753
|
-
vm.cmpProps[propName] = newValue;
|
|
1754
|
-
componentValueMutated(vm, propName);
|
|
1755
|
-
}
|
|
1756
|
-
|
|
1768
|
+
updateComponentValue(vm, propName, newValue);
|
|
1757
1769
|
return _set.call(vm.elm, newValue);
|
|
1758
1770
|
}
|
|
1759
1771
|
};
|
|
@@ -2041,11 +2053,7 @@
|
|
|
2041
2053
|
},
|
|
2042
2054
|
set: function set(newValue) {
|
|
2043
2055
|
var vm = getAssociatedVM(this);
|
|
2044
|
-
|
|
2045
|
-
if (newValue !== vm.cmpFields[key]) {
|
|
2046
|
-
vm.cmpFields[key] = newValue;
|
|
2047
|
-
componentValueMutated(vm, key);
|
|
2048
|
-
}
|
|
2056
|
+
updateComponentValue(vm, key, newValue);
|
|
2049
2057
|
},
|
|
2050
2058
|
enumerable: true,
|
|
2051
2059
|
configurable: true
|
|
@@ -2172,7 +2180,7 @@
|
|
|
2172
2180
|
var vm = getAssociatedVM(this);
|
|
2173
2181
|
|
|
2174
2182
|
if (_set2) {
|
|
2175
|
-
if (
|
|
2183
|
+
if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
2176
2184
|
var ro = vm.oar[key];
|
|
2177
2185
|
|
|
2178
2186
|
if (isUndefined$1(ro)) {
|
|
@@ -2223,11 +2231,7 @@
|
|
|
2223
2231
|
var vm = getAssociatedVM(this);
|
|
2224
2232
|
|
|
2225
2233
|
var reactiveOrAnyValue = getReactiveProxy(newValue);
|
|
2226
|
-
|
|
2227
|
-
if (reactiveOrAnyValue !== vm.cmpFields[key]) {
|
|
2228
|
-
vm.cmpFields[key] = reactiveOrAnyValue;
|
|
2229
|
-
componentValueMutated(vm, key);
|
|
2230
|
-
}
|
|
2234
|
+
updateComponentValue(vm, key, reactiveOrAnyValue);
|
|
2231
2235
|
},
|
|
2232
2236
|
enumerable: true,
|
|
2233
2237
|
configurable: true
|
|
@@ -2268,10 +2272,7 @@
|
|
|
2268
2272
|
* system to be backward compatible.
|
|
2269
2273
|
*/
|
|
2270
2274
|
|
|
2271
|
-
|
|
2272
|
-
vm.cmpFields[key] = value;
|
|
2273
|
-
componentValueMutated(vm, key);
|
|
2274
|
-
}
|
|
2275
|
+
updateComponentValue(vm, key, value);
|
|
2275
2276
|
},
|
|
2276
2277
|
enumerable: true,
|
|
2277
2278
|
configurable: true
|
|
@@ -2672,7 +2673,7 @@
|
|
|
2672
2673
|
return HTMLBridgeElement;
|
|
2673
2674
|
}
|
|
2674
2675
|
|
|
2675
|
-
var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor
|
|
2676
|
+
var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
|
|
2676
2677
|
freeze(BaseBridgeElement);
|
|
2677
2678
|
seal(BaseBridgeElement.prototype);
|
|
2678
2679
|
|
|
@@ -2685,7 +2686,7 @@
|
|
|
2685
2686
|
|
|
2686
2687
|
function swapTemplate(oldTpl, newTpl) {
|
|
2687
2688
|
|
|
2688
|
-
if (!
|
|
2689
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
2689
2690
|
throw new Error('HMR is not enabled');
|
|
2690
2691
|
}
|
|
2691
2692
|
|
|
@@ -2694,7 +2695,7 @@
|
|
|
2694
2695
|
|
|
2695
2696
|
function swapComponent(oldComponent, newComponent) {
|
|
2696
2697
|
|
|
2697
|
-
if (!
|
|
2698
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
2698
2699
|
throw new Error('HMR is not enabled');
|
|
2699
2700
|
}
|
|
2700
2701
|
|
|
@@ -2703,7 +2704,7 @@
|
|
|
2703
2704
|
|
|
2704
2705
|
function swapStyle(oldStyle, newStyle) {
|
|
2705
2706
|
|
|
2706
|
-
if (!
|
|
2707
|
+
if (!lwcRuntimeFlags.ENABLE_HMR) {
|
|
2707
2708
|
throw new Error('HMR is not enabled');
|
|
2708
2709
|
}
|
|
2709
2710
|
|
|
@@ -3137,9 +3138,7 @@
|
|
|
3137
3138
|
function createStylesheet(vm, stylesheets) {
|
|
3138
3139
|
var renderMode = vm.renderMode,
|
|
3139
3140
|
shadowMode = vm.shadowMode,
|
|
3140
|
-
|
|
3141
|
-
ssr = _vm$renderer2.ssr,
|
|
3142
|
-
insertStylesheet = _vm$renderer2.insertStylesheet;
|
|
3141
|
+
insertStylesheet = vm.renderer.insertStylesheet;
|
|
3143
3142
|
|
|
3144
3143
|
if (renderMode === 1
|
|
3145
3144
|
/* RenderMode.Shadow */
|
|
@@ -3149,7 +3148,7 @@
|
|
|
3149
3148
|
for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
|
|
3150
3149
|
insertStylesheet(stylesheets[_i12]);
|
|
3151
3150
|
}
|
|
3152
|
-
} else if (
|
|
3151
|
+
} else if (vm.hydrated) {
|
|
3153
3152
|
// Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.
|
|
3154
3153
|
// This works in the client, because the stylesheets are created, and cached in the VM
|
|
3155
3154
|
// the first time the VM renders.
|
|
@@ -3176,6 +3175,12 @@
|
|
|
3176
3175
|
*/
|
|
3177
3176
|
|
|
3178
3177
|
|
|
3178
|
+
function checkHasVM(elm) {
|
|
3179
|
+
var hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
|
|
3180
|
+
|
|
3181
|
+
return hasVM;
|
|
3182
|
+
}
|
|
3183
|
+
|
|
3179
3184
|
function getUpgradableConstructor(tagName, renderer) {
|
|
3180
3185
|
var getCustomElement = renderer.getCustomElement,
|
|
3181
3186
|
RendererHTMLElement = renderer.HTMLElementExported,
|
|
@@ -3217,6 +3222,20 @@
|
|
|
3217
3222
|
return _createClass(LWCUpgradableElement);
|
|
3218
3223
|
}(RendererHTMLElement);
|
|
3219
3224
|
|
|
3225
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3226
|
+
CE.prototype.connectedCallback = function () {
|
|
3227
|
+
if (checkHasVM(this)) {
|
|
3228
|
+
connectRootElement(this);
|
|
3229
|
+
}
|
|
3230
|
+
};
|
|
3231
|
+
|
|
3232
|
+
CE.prototype.disconnectedCallback = function () {
|
|
3233
|
+
if (checkHasVM(this)) {
|
|
3234
|
+
disconnectRootElement(this);
|
|
3235
|
+
}
|
|
3236
|
+
};
|
|
3237
|
+
}
|
|
3238
|
+
|
|
3220
3239
|
defineCustomElement(tagName, CE);
|
|
3221
3240
|
return CE;
|
|
3222
3241
|
}
|
|
@@ -3328,6 +3347,7 @@
|
|
|
3328
3347
|
// different than the one previously set.
|
|
3329
3348
|
|
|
3330
3349
|
if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key])) {
|
|
3350
|
+
|
|
3331
3351
|
setProperty(elm, key, cur);
|
|
3332
3352
|
}
|
|
3333
3353
|
}
|
|
@@ -3530,7 +3550,7 @@
|
|
|
3530
3550
|
}
|
|
3531
3551
|
}
|
|
3532
3552
|
|
|
3533
|
-
function patch(n1, n2, renderer) {
|
|
3553
|
+
function patch(n1, n2, parent, renderer) {
|
|
3534
3554
|
var _a, _b;
|
|
3535
3555
|
|
|
3536
3556
|
if (n1 === n2) {
|
|
@@ -3567,7 +3587,7 @@
|
|
|
3567
3587
|
case 3
|
|
3568
3588
|
/* VNodeType.CustomElement */
|
|
3569
3589
|
:
|
|
3570
|
-
patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3590
|
+
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3571
3591
|
break;
|
|
3572
3592
|
}
|
|
3573
3593
|
}
|
|
@@ -3721,8 +3741,12 @@
|
|
|
3721
3741
|
insertNode(elm, parent, anchor, renderer);
|
|
3722
3742
|
|
|
3723
3743
|
if (vm) {
|
|
3744
|
+
{
|
|
3745
|
+
if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3724
3746
|
|
|
3725
|
-
|
|
3747
|
+
runConnectedCallback(vm);
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3726
3750
|
}
|
|
3727
3751
|
|
|
3728
3752
|
mountVNodes(vnode.children, elm, renderer, null);
|
|
@@ -3732,25 +3756,34 @@
|
|
|
3732
3756
|
}
|
|
3733
3757
|
}
|
|
3734
3758
|
|
|
3735
|
-
function patchCustomElement(n1, n2, renderer) {
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3759
|
+
function patchCustomElement(n1, n2, parent, renderer) {
|
|
3760
|
+
if (n1.ctor !== n2.ctor) {
|
|
3761
|
+
// If the constructor, unmount the current component and mount a new one using the new
|
|
3762
|
+
// constructor.
|
|
3763
|
+
var anchor = renderer.nextSibling(n1.elm);
|
|
3764
|
+
unmount(n1, parent, renderer, true);
|
|
3765
|
+
mountCustomElement(n2, parent, anchor, renderer);
|
|
3766
|
+
} else {
|
|
3767
|
+
// Otherwise patch the existing component with new props/attrs/etc.
|
|
3768
|
+
var elm = n2.elm = n1.elm;
|
|
3769
|
+
var vm = n2.vm = n1.vm;
|
|
3770
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3739
3771
|
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3772
|
+
if (!isUndefined$1(vm)) {
|
|
3773
|
+
// in fallback mode, the allocation will always set children to
|
|
3774
|
+
// empty and delegate the real allocation to the slot elements
|
|
3775
|
+
allocateChildren(n2, vm);
|
|
3776
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
3777
|
+
// will happen, but in native, it does allocate the light dom
|
|
3746
3778
|
|
|
3747
3779
|
|
|
3748
|
-
|
|
3780
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3749
3781
|
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3782
|
+
if (!isUndefined$1(vm)) {
|
|
3783
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3784
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3785
|
+
rerenderVM(vm);
|
|
3786
|
+
}
|
|
3754
3787
|
}
|
|
3755
3788
|
}
|
|
3756
3789
|
|
|
@@ -3881,10 +3914,10 @@
|
|
|
3881
3914
|
var scopeToken = getScopeTokenClass(owner);
|
|
3882
3915
|
|
|
3883
3916
|
if (!isNull(scopeToken)) {
|
|
3884
|
-
var
|
|
3917
|
+
var getClassList = renderer.getClassList; // TODO [#2762]: this dot notation with add is probably problematic
|
|
3885
3918
|
// probably we should have a renderer api for just the add operation
|
|
3886
3919
|
|
|
3887
|
-
|
|
3920
|
+
getClassList(elm).add(scopeToken);
|
|
3888
3921
|
} // Set property element for synthetic shadow DOM style scoping.
|
|
3889
3922
|
|
|
3890
3923
|
|
|
@@ -4074,22 +4107,22 @@
|
|
|
4074
4107
|
} else if (!isVNode(newEndVnode)) {
|
|
4075
4108
|
newEndVnode = newCh[--newEndIdx];
|
|
4076
4109
|
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
4077
|
-
patch(oldStartVnode, newStartVnode, renderer);
|
|
4110
|
+
patch(oldStartVnode, newStartVnode, parent, renderer);
|
|
4078
4111
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4079
4112
|
newStartVnode = newCh[++newStartIdx];
|
|
4080
4113
|
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
4081
|
-
patch(oldEndVnode, newEndVnode, renderer);
|
|
4114
|
+
patch(oldEndVnode, newEndVnode, parent, renderer);
|
|
4082
4115
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4083
4116
|
newEndVnode = newCh[--newEndIdx];
|
|
4084
4117
|
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
4085
4118
|
// Vnode moved right
|
|
4086
|
-
patch(oldStartVnode, newEndVnode, renderer);
|
|
4119
|
+
patch(oldStartVnode, newEndVnode, parent, renderer);
|
|
4087
4120
|
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
4088
4121
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
4089
4122
|
newEndVnode = newCh[--newEndIdx];
|
|
4090
4123
|
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
4091
4124
|
// Vnode moved left
|
|
4092
|
-
patch(oldEndVnode, newStartVnode, renderer);
|
|
4125
|
+
patch(oldEndVnode, newStartVnode, parent, renderer);
|
|
4093
4126
|
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
4094
4127
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
4095
4128
|
newStartVnode = newCh[++newStartIdx];
|
|
@@ -4112,7 +4145,7 @@
|
|
|
4112
4145
|
// New element
|
|
4113
4146
|
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4114
4147
|
} else {
|
|
4115
|
-
patch(elmToMove, newStartVnode, renderer); // Delete the old child, but copy the array since it is read-only.
|
|
4148
|
+
patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
|
|
4116
4149
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4117
4150
|
// so we only care about the `oldCh` object inside this function.
|
|
4118
4151
|
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
@@ -4182,7 +4215,7 @@
|
|
|
4182
4215
|
if (isVNode(n1)) {
|
|
4183
4216
|
if (isVNode(n2)) {
|
|
4184
4217
|
// both vnodes are equivalent, and we just need to patch them
|
|
4185
|
-
patch(n1, n2, renderer);
|
|
4218
|
+
patch(n1, n2, parent, renderer);
|
|
4186
4219
|
anchor = n2.elm;
|
|
4187
4220
|
} else {
|
|
4188
4221
|
// removing the old vnode since the new one is null
|
|
@@ -4483,19 +4516,11 @@
|
|
|
4483
4516
|
|
|
4484
4517
|
return url;
|
|
4485
4518
|
}
|
|
4486
|
-
/**
|
|
4487
|
-
* Map to store an index value assigned to any dynamic component reference ingested
|
|
4488
|
-
* by dc() api. This allows us to generate a unique unique per template per dynamic
|
|
4489
|
-
* component reference to avoid diffing algo mismatches.
|
|
4490
|
-
*/
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
var DynamicImportedComponentMap = new Map();
|
|
4494
|
-
var dynamicImportedComponentCounter = 0;
|
|
4495
4519
|
/**
|
|
4496
4520
|
* create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
|
|
4497
4521
|
*/
|
|
4498
4522
|
|
|
4523
|
+
|
|
4499
4524
|
function dc(sel, Ctor, data) {
|
|
4500
4525
|
var children = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : EmptyArray;
|
|
4501
4526
|
|
|
@@ -4508,22 +4533,7 @@
|
|
|
4508
4533
|
throw new Error("Invalid LWC Constructor ".concat(toString$1(Ctor), " for custom element <").concat(sel, ">."));
|
|
4509
4534
|
}
|
|
4510
4535
|
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
if (isUndefined$1(idx)) {
|
|
4514
|
-
idx = dynamicImportedComponentCounter++;
|
|
4515
|
-
DynamicImportedComponentMap.set(Ctor, idx);
|
|
4516
|
-
} // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
|
|
4517
|
-
// to identify different constructors as vnodes with different keys to avoid reusing the
|
|
4518
|
-
// element used for previous constructors.
|
|
4519
|
-
// Shallow clone is necessary here becuase VElementData may be shared across VNodes due to
|
|
4520
|
-
// hoisting optimization.
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
var newData = Object.assign(Object.assign({}, data), {
|
|
4524
|
-
key: "dc:".concat(idx, ":").concat(data.key)
|
|
4525
|
-
});
|
|
4526
|
-
return c(sel, Ctor, newData, children);
|
|
4536
|
+
return c(sel, Ctor, data, children);
|
|
4527
4537
|
}
|
|
4528
4538
|
/**
|
|
4529
4539
|
* slow children collection marking mechanism. this API allows the compiler to signal
|
|
@@ -5253,7 +5263,7 @@
|
|
|
5253
5263
|
} else if (isNativeShadowDefined) {
|
|
5254
5264
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5255
5265
|
// the if-condition.
|
|
5256
|
-
if (
|
|
5266
|
+
if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
5257
5267
|
if (def.shadowSupportMode === "any"
|
|
5258
5268
|
/* ShadowSupportMode.Any */
|
|
5259
5269
|
) {
|
|
@@ -5363,13 +5373,7 @@
|
|
|
5363
5373
|
}
|
|
5364
5374
|
|
|
5365
5375
|
function runRenderedCallback(vm) {
|
|
5366
|
-
var renderedCallback = vm.def.renderedCallback
|
|
5367
|
-
ssr = vm.renderer.ssr;
|
|
5368
|
-
|
|
5369
|
-
if (isTrue(ssr)) {
|
|
5370
|
-
return;
|
|
5371
|
-
}
|
|
5372
|
-
|
|
5376
|
+
var renderedCallback = vm.def.renderedCallback;
|
|
5373
5377
|
var rendered = Services.rendered;
|
|
5374
5378
|
|
|
5375
5379
|
if (rendered) {
|
|
@@ -5592,9 +5596,7 @@
|
|
|
5592
5596
|
}
|
|
5593
5597
|
|
|
5594
5598
|
function scheduleRehydration(vm) {
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
if (isTrue(ssr) || isTrue(vm.isScheduled)) {
|
|
5599
|
+
if (isTrue(vm.isScheduled)) {
|
|
5598
5600
|
return;
|
|
5599
5601
|
}
|
|
5600
5602
|
|
|
@@ -5696,13 +5698,8 @@
|
|
|
5696
5698
|
}( /*#__PURE__*/_wrapNativeSuper(CustomEvent));
|
|
5697
5699
|
|
|
5698
5700
|
function createFieldDataCallback(vm, name) {
|
|
5699
|
-
var cmpFields = vm.cmpFields;
|
|
5700
5701
|
return function (value) {
|
|
5701
|
-
|
|
5702
|
-
// storing the value in the underlying storage
|
|
5703
|
-
cmpFields[name] = value;
|
|
5704
|
-
componentValueMutated(vm, name);
|
|
5705
|
-
}
|
|
5702
|
+
updateComponentValue(vm, name, value);
|
|
5706
5703
|
};
|
|
5707
5704
|
}
|
|
5708
5705
|
|
|
@@ -5911,7 +5908,7 @@
|
|
|
5911
5908
|
ArrayPush$1.call(wiredConnecting, function () {
|
|
5912
5909
|
connector.connect();
|
|
5913
5910
|
|
|
5914
|
-
if (!
|
|
5911
|
+
if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
5915
5912
|
if (hasDynamicParams) {
|
|
5916
5913
|
Promise.resolve().then(computeConfigAndUpdate);
|
|
5917
5914
|
return;
|
|
@@ -6085,6 +6082,8 @@
|
|
|
6085
6082
|
return renderer.nextSibling(hydratedNode);
|
|
6086
6083
|
}
|
|
6087
6084
|
|
|
6085
|
+
var NODE_VALUE_PROP = 'nodeValue';
|
|
6086
|
+
|
|
6088
6087
|
function hydrateText(node, vnode, renderer) {
|
|
6089
6088
|
var _a;
|
|
6090
6089
|
|
|
@@ -6110,7 +6109,7 @@
|
|
|
6110
6109
|
}
|
|
6111
6110
|
|
|
6112
6111
|
var setProperty = renderer.setProperty;
|
|
6113
|
-
setProperty(node,
|
|
6112
|
+
setProperty(node, NODE_VALUE_PROP, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
6114
6113
|
vnode.elm = node;
|
|
6115
6114
|
return node;
|
|
6116
6115
|
}
|
|
@@ -6142,10 +6141,10 @@
|
|
|
6142
6141
|
// it may be that this element has lwc:inner-html, we need to diff and in case are the same,
|
|
6143
6142
|
// remove the innerHTML from props so it reuses the existing dom elements.
|
|
6144
6143
|
var props = vnode.data.props;
|
|
6145
|
-
var
|
|
6144
|
+
var getProperty = renderer.getProperty;
|
|
6146
6145
|
|
|
6147
6146
|
if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
|
|
6148
|
-
if (
|
|
6147
|
+
if (getProperty(elm, 'innerHTML') === props.innerHTML) {
|
|
6149
6148
|
// Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization
|
|
6150
6149
|
vnode.data = Object.assign(Object.assign({}, vnode.data), {
|
|
6151
6150
|
props: cloneAndOmitKey(props, 'innerHTML')
|
|
@@ -6157,8 +6156,8 @@
|
|
|
6157
6156
|
patchElementPropsAndAttrs(vnode, renderer);
|
|
6158
6157
|
|
|
6159
6158
|
if (!isDomManual) {
|
|
6160
|
-
var
|
|
6161
|
-
hydrateChildren(
|
|
6159
|
+
var getFirstChild = renderer.getFirstChild;
|
|
6160
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
|
|
6162
6161
|
}
|
|
6163
6162
|
|
|
6164
6163
|
return elm;
|
|
@@ -6191,10 +6190,10 @@
|
|
|
6191
6190
|
if (vm.renderMode !== 0
|
|
6192
6191
|
/* RenderMode.Light */
|
|
6193
6192
|
) {
|
|
6194
|
-
var
|
|
6193
|
+
var getFirstChild = renderer.getFirstChild; // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.
|
|
6195
6194
|
// Note: for Light DOM, this is handled while hydrating the VM
|
|
6196
6195
|
|
|
6197
|
-
hydrateChildren(
|
|
6196
|
+
hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
|
|
6198
6197
|
}
|
|
6199
6198
|
|
|
6200
6199
|
hydrateVM(vm);
|
|
@@ -6229,11 +6228,11 @@
|
|
|
6229
6228
|
// next node in the list to be hydrated.
|
|
6230
6229
|
|
|
6231
6230
|
|
|
6232
|
-
var
|
|
6231
|
+
var nextSibling = renderer.nextSibling;
|
|
6233
6232
|
|
|
6234
6233
|
do {
|
|
6235
6234
|
var current = nextNode;
|
|
6236
|
-
nextNode =
|
|
6235
|
+
nextNode = nextSibling(nextNode);
|
|
6237
6236
|
removeNode(current, parentNode, renderer);
|
|
6238
6237
|
} while (nextNode);
|
|
6239
6238
|
}
|
|
@@ -6290,9 +6289,8 @@
|
|
|
6290
6289
|
attrValue = _Object$entries$_i[1];
|
|
6291
6290
|
|
|
6292
6291
|
vnode.owner;
|
|
6293
|
-
var
|
|
6294
|
-
|
|
6295
|
-
var elmAttrValue = _getAttribute(elm, attrName);
|
|
6292
|
+
var getAttribute = renderer.getAttribute;
|
|
6293
|
+
var elmAttrValue = getAttribute(elm, attrName);
|
|
6296
6294
|
|
|
6297
6295
|
if (String(attrValue) !== elmAttrValue) {
|
|
6298
6296
|
|
|
@@ -6408,7 +6406,7 @@
|
|
|
6408
6406
|
return false;
|
|
6409
6407
|
}
|
|
6410
6408
|
|
|
6411
|
-
return getProperty(client,
|
|
6409
|
+
return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
|
|
6412
6410
|
}
|
|
6413
6411
|
|
|
6414
6412
|
if (getProperty(client, 'nodeType') === 8
|
|
@@ -6420,7 +6418,7 @@
|
|
|
6420
6418
|
return false;
|
|
6421
6419
|
}
|
|
6422
6420
|
|
|
6423
|
-
return getProperty(client,
|
|
6421
|
+
return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
|
|
6424
6422
|
}
|
|
6425
6423
|
|
|
6426
6424
|
if (!hasCorrectNodeType(vnode, ssr, 1
|
|
@@ -6492,7 +6490,7 @@
|
|
|
6492
6490
|
|
|
6493
6491
|
return ctor;
|
|
6494
6492
|
}
|
|
6495
|
-
/* version: 2.
|
|
6493
|
+
/* version: 2.23.2 */
|
|
6496
6494
|
|
|
6497
6495
|
/*
|
|
6498
6496
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -6650,373 +6648,395 @@
|
|
|
6650
6648
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6651
6649
|
*/
|
|
6652
6650
|
|
|
6651
|
+
/**
|
|
6652
|
+
* A factory function that produces a renderer.
|
|
6653
|
+
* Renderer encapsulates operations that are required to render an LWC component into the underlying
|
|
6654
|
+
* runtime environment. In the case of @lwc/enigne-dom, it is meant to be used in a DOM environment.
|
|
6655
|
+
* Example usage:
|
|
6656
|
+
* import { renderer, rendererFactory } from 'lwc';
|
|
6657
|
+
* const customRenderer = rendererFactory(renderer);
|
|
6658
|
+
*
|
|
6659
|
+
* @param baseRenderer Either null or the base renderer imported from 'lwc'.
|
|
6660
|
+
*/
|
|
6653
6661
|
|
|
6654
|
-
var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
|
|
6655
|
-
var createFragment;
|
|
6656
6662
|
|
|
6657
|
-
|
|
6658
|
-
//
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
}
|
|
6664
|
-
} else {
|
|
6665
|
-
// In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
|
|
6666
|
-
// <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
|
|
6667
|
-
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
|
|
6668
|
-
// With other elements added from:
|
|
6669
|
-
// https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
|
|
6670
|
-
// Using the test:
|
|
6671
|
-
// document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
|
|
6672
|
-
// And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
|
|
6673
|
-
var topLevelWrappingMap = {
|
|
6674
|
-
caption: ['table'],
|
|
6675
|
-
col: ['colgroup', 'table'],
|
|
6676
|
-
colgroup: ['table'],
|
|
6677
|
-
option: ['select'],
|
|
6678
|
-
tbody: ['table'],
|
|
6679
|
-
td: ['tr', 'tbody', 'table'],
|
|
6680
|
-
th: ['tr', 'tbody', 'table'],
|
|
6681
|
-
thead: ['table'],
|
|
6682
|
-
tfoot: ['table'],
|
|
6683
|
-
tr: ['tbody', 'table']
|
|
6684
|
-
}; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
|
|
6685
|
-
|
|
6686
|
-
var getTagName = function getTagName(text) {
|
|
6687
|
-
return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
|
|
6688
|
-
}; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
createFragment = function createFragment(html) {
|
|
6692
|
-
var wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
6693
|
-
|
|
6694
|
-
if (!isUndefined$1(wrapperTags)) {
|
|
6695
|
-
var _iterator5 = _createForOfIteratorHelper(wrapperTags),
|
|
6696
|
-
_step5;
|
|
6663
|
+
function rendererFactory(baseRenderer) {
|
|
6664
|
+
// Util functions
|
|
6665
|
+
function assertInvariant(value, msg) {
|
|
6666
|
+
if (!value) {
|
|
6667
|
+
throw new Error("Invariant Violation: ".concat(msg));
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6697
6670
|
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
|
|
6702
|
-
}
|
|
6703
|
-
} catch (err) {
|
|
6704
|
-
_iterator5.e(err);
|
|
6705
|
-
} finally {
|
|
6706
|
-
_iterator5.f();
|
|
6707
|
-
}
|
|
6708
|
-
} // For IE11, the document title must not be undefined, but it can be an empty string
|
|
6709
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
|
|
6671
|
+
function isNull(obj) {
|
|
6672
|
+
return obj === null;
|
|
6673
|
+
}
|
|
6710
6674
|
|
|
6675
|
+
function isUndefined(obj) {
|
|
6676
|
+
return obj === undefined;
|
|
6677
|
+
}
|
|
6711
6678
|
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6679
|
+
var getCustomElement;
|
|
6680
|
+
var defineCustomElement;
|
|
6681
|
+
var HTMLElementConstructor;
|
|
6715
6682
|
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
}
|
|
6683
|
+
function isCustomElementRegistryAvailable() {
|
|
6684
|
+
if (typeof customElements === 'undefined') {
|
|
6685
|
+
return false;
|
|
6720
6686
|
}
|
|
6721
6687
|
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
*/
|
|
6688
|
+
try {
|
|
6689
|
+
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
6690
|
+
// _wrapNativeSuper()
|
|
6691
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
6692
|
+
// get wrapped by babel.
|
|
6693
|
+
var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
|
|
6694
|
+
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
6695
|
+
// which are not equipped to be initialized that way.
|
|
6731
6696
|
|
|
6697
|
+
var clazz = /*#__PURE__*/function (_HTMLElementAlias) {
|
|
6698
|
+
_inherits(clazz, _HTMLElementAlias);
|
|
6732
6699
|
|
|
6733
|
-
|
|
6734
|
-
var defineCustomElement;
|
|
6735
|
-
var HTMLElementConstructor;
|
|
6700
|
+
var _super7 = _createSuper(clazz);
|
|
6736
6701
|
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
return false;
|
|
6740
|
-
}
|
|
6702
|
+
function clazz() {
|
|
6703
|
+
_classCallCheck(this, clazz);
|
|
6741
6704
|
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
// _wrapNativeSuper()
|
|
6745
|
-
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
6746
|
-
// get wrapped by babel.
|
|
6747
|
-
var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
|
|
6748
|
-
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
6749
|
-
// which are not equipped to be initialized that way.
|
|
6705
|
+
return _super7.apply(this, arguments);
|
|
6706
|
+
}
|
|
6750
6707
|
|
|
6751
|
-
|
|
6752
|
-
|
|
6708
|
+
return _createClass(clazz);
|
|
6709
|
+
}(HTMLElementAlias);
|
|
6753
6710
|
|
|
6754
|
-
|
|
6711
|
+
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
6712
|
+
new clazz();
|
|
6713
|
+
return true;
|
|
6714
|
+
} catch (_a) {
|
|
6715
|
+
return false;
|
|
6716
|
+
}
|
|
6717
|
+
}
|
|
6755
6718
|
|
|
6756
|
-
|
|
6757
|
-
|
|
6719
|
+
if (isCustomElementRegistryAvailable()) {
|
|
6720
|
+
getCustomElement = customElements.get.bind(customElements);
|
|
6721
|
+
defineCustomElement = customElements.define.bind(customElements);
|
|
6722
|
+
HTMLElementConstructor = HTMLElement;
|
|
6723
|
+
} else {
|
|
6724
|
+
var registry = Object.create(null);
|
|
6725
|
+
var reverseRegistry = new WeakMap();
|
|
6758
6726
|
|
|
6759
|
-
|
|
6727
|
+
defineCustomElement = function define(name, ctor) {
|
|
6728
|
+
if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
|
|
6729
|
+
throw new TypeError("Invalid Registration");
|
|
6760
6730
|
}
|
|
6761
6731
|
|
|
6762
|
-
|
|
6763
|
-
|
|
6732
|
+
registry[name] = ctor;
|
|
6733
|
+
reverseRegistry.set(ctor, name);
|
|
6734
|
+
};
|
|
6764
6735
|
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
} catch (_a) {
|
|
6769
|
-
return false;
|
|
6770
|
-
}
|
|
6771
|
-
}
|
|
6736
|
+
getCustomElement = function get(name) {
|
|
6737
|
+
return registry[name];
|
|
6738
|
+
};
|
|
6772
6739
|
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
} else {
|
|
6778
|
-
var registry = create(null);
|
|
6779
|
-
var reverseRegistry = new WeakMap();
|
|
6740
|
+
HTMLElementConstructor = function HTMLElement() {
|
|
6741
|
+
if (!(this instanceof HTMLElement)) {
|
|
6742
|
+
throw new TypeError("Invalid Invocation");
|
|
6743
|
+
}
|
|
6780
6744
|
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
throw new TypeError("Invalid Registration");
|
|
6784
|
-
}
|
|
6745
|
+
var constructor = this.constructor;
|
|
6746
|
+
var name = reverseRegistry.get(constructor);
|
|
6785
6747
|
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6748
|
+
if (!name) {
|
|
6749
|
+
throw new TypeError("Invalid Construction");
|
|
6750
|
+
}
|
|
6789
6751
|
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6752
|
+
var elm = document.createElement(name);
|
|
6753
|
+
Object.setPrototypeOf(elm, constructor.prototype);
|
|
6754
|
+
return elm;
|
|
6755
|
+
};
|
|
6793
6756
|
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
throw new TypeError("Invalid Invocation");
|
|
6797
|
-
}
|
|
6757
|
+
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
6758
|
+
}
|
|
6798
6759
|
|
|
6799
|
-
|
|
6800
|
-
|
|
6760
|
+
function cloneNode(node, deep) {
|
|
6761
|
+
return node.cloneNode(deep);
|
|
6762
|
+
}
|
|
6801
6763
|
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6764
|
+
function createElement(tagName, namespace) {
|
|
6765
|
+
return isUndefined(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
|
|
6766
|
+
}
|
|
6805
6767
|
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
};
|
|
6768
|
+
function createText(content) {
|
|
6769
|
+
return document.createTextNode(content);
|
|
6770
|
+
}
|
|
6810
6771
|
|
|
6811
|
-
|
|
6812
|
-
|
|
6772
|
+
function createComment(content) {
|
|
6773
|
+
return document.createComment(content);
|
|
6774
|
+
}
|
|
6813
6775
|
|
|
6814
|
-
|
|
6776
|
+
var createFragment; // IE11 lacks support for this feature
|
|
6815
6777
|
|
|
6816
|
-
|
|
6817
|
-
hydrating = value;
|
|
6818
|
-
}
|
|
6778
|
+
var SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
|
|
6819
6779
|
|
|
6820
|
-
|
|
6780
|
+
if (SUPPORTS_TEMPLATE) {
|
|
6781
|
+
// Parse the fragment HTML string into DOM
|
|
6782
|
+
createFragment = function createFragment(html) {
|
|
6783
|
+
var template = document.createElement('template');
|
|
6784
|
+
template.innerHTML = html;
|
|
6785
|
+
return template.content.firstChild;
|
|
6786
|
+
};
|
|
6787
|
+
} else {
|
|
6788
|
+
// In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
|
|
6789
|
+
// <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
|
|
6790
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
|
|
6791
|
+
// With other elements added from:
|
|
6792
|
+
// https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
|
|
6793
|
+
// Using the test:
|
|
6794
|
+
// document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
|
|
6795
|
+
// And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
|
|
6796
|
+
var topLevelWrappingMap = {
|
|
6797
|
+
caption: ['table'],
|
|
6798
|
+
col: ['colgroup', 'table'],
|
|
6799
|
+
colgroup: ['table'],
|
|
6800
|
+
option: ['select'],
|
|
6801
|
+
tbody: ['table'],
|
|
6802
|
+
td: ['tr', 'tbody', 'table'],
|
|
6803
|
+
th: ['tr', 'tbody', 'table'],
|
|
6804
|
+
thead: ['table'],
|
|
6805
|
+
tfoot: ['table'],
|
|
6806
|
+
tr: ['tbody', 'table']
|
|
6807
|
+
}; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
|
|
6808
|
+
|
|
6809
|
+
var getTagName = function getTagName(text) {
|
|
6810
|
+
return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
|
|
6811
|
+
}; // Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
|
|
6812
|
+
|
|
6813
|
+
|
|
6814
|
+
createFragment = function createFragment(html) {
|
|
6815
|
+
var wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
6816
|
+
|
|
6817
|
+
if (!isUndefined(wrapperTags)) {
|
|
6818
|
+
var _iterator5 = _createForOfIteratorHelper(wrapperTags),
|
|
6819
|
+
_step5;
|
|
6820
|
+
|
|
6821
|
+
try {
|
|
6822
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
6823
|
+
var wrapperTag = _step5.value;
|
|
6824
|
+
html = "<".concat(wrapperTag, ">").concat(html, "</").concat(wrapperTag, ">");
|
|
6825
|
+
}
|
|
6826
|
+
} catch (err) {
|
|
6827
|
+
_iterator5.e(err);
|
|
6828
|
+
} finally {
|
|
6829
|
+
_iterator5.f();
|
|
6830
|
+
}
|
|
6831
|
+
} // For IE11, the document title must not be undefined, but it can be an empty string
|
|
6832
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
|
|
6821
6833
|
|
|
6822
|
-
function isHydrating() {
|
|
6823
|
-
return hydrating;
|
|
6824
|
-
}
|
|
6825
6834
|
|
|
6826
|
-
|
|
6827
|
-
|
|
6835
|
+
var doc = document.implementation.createHTMLDocument('');
|
|
6836
|
+
doc.body.innerHTML = html;
|
|
6837
|
+
var content = doc.body;
|
|
6828
6838
|
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6839
|
+
if (!isUndefined(wrapperTags)) {
|
|
6840
|
+
for (var _i32 = 0; _i32 < wrapperTags.length; _i32++) {
|
|
6841
|
+
content = content.firstChild;
|
|
6842
|
+
}
|
|
6843
|
+
}
|
|
6832
6844
|
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6845
|
+
return content.firstChild;
|
|
6846
|
+
};
|
|
6847
|
+
}
|
|
6836
6848
|
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6849
|
+
function insert(node, parent, anchor) {
|
|
6850
|
+
parent.insertBefore(node, anchor);
|
|
6851
|
+
}
|
|
6840
6852
|
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6853
|
+
function remove(node, parent) {
|
|
6854
|
+
parent.removeChild(node);
|
|
6855
|
+
}
|
|
6844
6856
|
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6857
|
+
function nextSibling(node) {
|
|
6858
|
+
return node.nextSibling;
|
|
6859
|
+
}
|
|
6848
6860
|
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6861
|
+
function attachShadow(element, options) {
|
|
6862
|
+
// `shadowRoot` will be non-null in two cases:
|
|
6863
|
+
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
6864
|
+
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
6865
|
+
// root component with customElement.define('c-app', Ctor)
|
|
6866
|
+
if (!isNull(element.shadowRoot)) {
|
|
6867
|
+
return element.shadowRoot;
|
|
6868
|
+
}
|
|
6852
6869
|
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
}
|
|
6870
|
+
return element.attachShadow(options);
|
|
6871
|
+
}
|
|
6856
6872
|
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
6860
|
-
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
6861
|
-
// root component with customeElement.define('c-app', Ctor)
|
|
6862
|
-
//
|
|
6863
|
-
// The second case can be treated as a failed hydration with nominal impact
|
|
6864
|
-
// to performance. However, because <c-app> won't have a <template shadowroot>
|
|
6865
|
-
// declarative child, `element.shadowRoot` is `null`.
|
|
6866
|
-
if (hydrating && element.shadowRoot) {
|
|
6867
|
-
return element.shadowRoot;
|
|
6873
|
+
function setText(node, content) {
|
|
6874
|
+
node.nodeValue = content;
|
|
6868
6875
|
}
|
|
6869
6876
|
|
|
6870
|
-
|
|
6871
|
-
|
|
6877
|
+
function getProperty(node, key) {
|
|
6878
|
+
return node[key];
|
|
6879
|
+
}
|
|
6872
6880
|
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6881
|
+
function setProperty(node, key, value) {
|
|
6882
|
+
node[key] = value;
|
|
6883
|
+
}
|
|
6876
6884
|
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6885
|
+
function getAttribute(element, name, namespace) {
|
|
6886
|
+
return isUndefined(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
|
|
6887
|
+
}
|
|
6880
6888
|
|
|
6881
|
-
|
|
6889
|
+
function setAttribute(element, name, value, namespace) {
|
|
6890
|
+
return isUndefined(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
|
|
6891
|
+
}
|
|
6882
6892
|
|
|
6883
|
-
|
|
6884
|
-
|
|
6893
|
+
function removeAttribute(element, name, namespace) {
|
|
6894
|
+
if (isUndefined(namespace)) {
|
|
6895
|
+
element.removeAttribute(name);
|
|
6896
|
+
} else {
|
|
6897
|
+
element.removeAttributeNS(namespace, name);
|
|
6898
|
+
}
|
|
6899
|
+
}
|
|
6885
6900
|
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6901
|
+
function addEventListener(target, type, callback, options) {
|
|
6902
|
+
target.addEventListener(type, callback, options);
|
|
6903
|
+
}
|
|
6889
6904
|
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6905
|
+
function removeEventListener(target, type, callback, options) {
|
|
6906
|
+
target.removeEventListener(type, callback, options);
|
|
6907
|
+
}
|
|
6893
6908
|
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
element.removeAttribute(name);
|
|
6897
|
-
} else {
|
|
6898
|
-
element.removeAttributeNS(namespace, name);
|
|
6909
|
+
function dispatchEvent(target, event) {
|
|
6910
|
+
return target.dispatchEvent(event);
|
|
6899
6911
|
}
|
|
6900
|
-
}
|
|
6901
6912
|
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6913
|
+
function getClassList(element) {
|
|
6914
|
+
return element.classList;
|
|
6915
|
+
}
|
|
6905
6916
|
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6917
|
+
function setCSSStyleProperty(element, name, value, important) {
|
|
6918
|
+
// TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
|
|
6919
|
+
// represent elements in the engine?
|
|
6920
|
+
element.style.setProperty(name, value, important ? 'important' : '');
|
|
6921
|
+
}
|
|
6909
6922
|
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6923
|
+
function getBoundingClientRect(element) {
|
|
6924
|
+
return element.getBoundingClientRect();
|
|
6925
|
+
}
|
|
6913
6926
|
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6927
|
+
function querySelector(element, selectors) {
|
|
6928
|
+
return element.querySelector(selectors);
|
|
6929
|
+
}
|
|
6917
6930
|
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
element.style.setProperty(name, value, important ? 'important' : '');
|
|
6922
|
-
}
|
|
6931
|
+
function querySelectorAll(element, selectors) {
|
|
6932
|
+
return element.querySelectorAll(selectors);
|
|
6933
|
+
}
|
|
6923
6934
|
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6935
|
+
function getElementsByTagName(element, tagNameOrWildCard) {
|
|
6936
|
+
return element.getElementsByTagName(tagNameOrWildCard);
|
|
6937
|
+
}
|
|
6927
6938
|
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6939
|
+
function getElementsByClassName(element, names) {
|
|
6940
|
+
return element.getElementsByClassName(names);
|
|
6941
|
+
}
|
|
6931
6942
|
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6943
|
+
function getChildren(element) {
|
|
6944
|
+
return element.children;
|
|
6945
|
+
}
|
|
6935
6946
|
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6947
|
+
function getChildNodes(element) {
|
|
6948
|
+
return element.childNodes;
|
|
6949
|
+
}
|
|
6939
6950
|
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6951
|
+
function getFirstChild(element) {
|
|
6952
|
+
return element.firstChild;
|
|
6953
|
+
}
|
|
6943
6954
|
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6955
|
+
function getFirstElementChild(element) {
|
|
6956
|
+
return element.firstElementChild;
|
|
6957
|
+
}
|
|
6947
6958
|
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6959
|
+
function getLastChild(element) {
|
|
6960
|
+
return element.lastChild;
|
|
6961
|
+
}
|
|
6951
6962
|
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6963
|
+
function getLastElementChild(element) {
|
|
6964
|
+
return element.lastElementChild;
|
|
6965
|
+
}
|
|
6955
6966
|
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6967
|
+
function isConnected(node) {
|
|
6968
|
+
return node.isConnected;
|
|
6969
|
+
}
|
|
6959
6970
|
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6971
|
+
function assertInstanceOfHTMLElement(elm, msg) {
|
|
6972
|
+
assertInvariant(elm instanceof HTMLElement, msg);
|
|
6973
|
+
}
|
|
6963
6974
|
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6975
|
+
var HTMLElementExported = HTMLElementConstructor;
|
|
6976
|
+
var renderer = {
|
|
6977
|
+
HTMLElementExported: HTMLElementExported,
|
|
6978
|
+
insert: insert,
|
|
6979
|
+
remove: remove,
|
|
6980
|
+
cloneNode: cloneNode,
|
|
6981
|
+
createFragment: createFragment,
|
|
6982
|
+
createElement: createElement,
|
|
6983
|
+
createText: createText,
|
|
6984
|
+
createComment: createComment,
|
|
6985
|
+
nextSibling: nextSibling,
|
|
6986
|
+
attachShadow: attachShadow,
|
|
6987
|
+
getProperty: getProperty,
|
|
6988
|
+
setProperty: setProperty,
|
|
6989
|
+
setText: setText,
|
|
6990
|
+
getAttribute: getAttribute,
|
|
6991
|
+
setAttribute: setAttribute,
|
|
6992
|
+
removeAttribute: removeAttribute,
|
|
6993
|
+
addEventListener: addEventListener,
|
|
6994
|
+
removeEventListener: removeEventListener,
|
|
6995
|
+
dispatchEvent: dispatchEvent,
|
|
6996
|
+
getClassList: getClassList,
|
|
6997
|
+
setCSSStyleProperty: setCSSStyleProperty,
|
|
6998
|
+
getBoundingClientRect: getBoundingClientRect,
|
|
6999
|
+
querySelector: querySelector,
|
|
7000
|
+
querySelectorAll: querySelectorAll,
|
|
7001
|
+
getElementsByTagName: getElementsByTagName,
|
|
7002
|
+
getElementsByClassName: getElementsByClassName,
|
|
7003
|
+
getChildren: getChildren,
|
|
7004
|
+
getChildNodes: getChildNodes,
|
|
7005
|
+
getFirstChild: getFirstChild,
|
|
7006
|
+
getFirstElementChild: getFirstElementChild,
|
|
7007
|
+
getLastChild: getLastChild,
|
|
7008
|
+
getLastElementChild: getLastElementChild,
|
|
7009
|
+
isConnected: isConnected,
|
|
7010
|
+
assertInstanceOfHTMLElement: assertInstanceOfHTMLElement,
|
|
7011
|
+
defineCustomElement: defineCustomElement,
|
|
7012
|
+
getCustomElement: getCustomElement
|
|
7013
|
+
}; // Meant to inherit any properties passed via the base renderer as the argument to the factory.
|
|
6967
7014
|
|
|
6968
|
-
|
|
6969
|
-
return
|
|
7015
|
+
Object.setPrototypeOf(renderer, baseRenderer);
|
|
7016
|
+
return renderer;
|
|
6970
7017
|
}
|
|
7018
|
+
/*
|
|
7019
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
7020
|
+
* All rights reserved.
|
|
7021
|
+
* SPDX-License-Identifier: MIT
|
|
7022
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7023
|
+
*/
|
|
7024
|
+
|
|
7025
|
+
/**
|
|
7026
|
+
* The base renderer that will be used by engine-core.
|
|
7027
|
+
* This will be used for DOM operations when lwc is running in a browser environment.
|
|
7028
|
+
*/
|
|
6971
7029
|
|
|
6972
|
-
function assertInstanceOfHTMLElement(elm, msg) {
|
|
6973
|
-
assert.invariant(elm instanceof HTMLElement, msg);
|
|
6974
|
-
}
|
|
6975
7030
|
|
|
6976
|
-
var
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
HTMLElementExported: HTMLElementExported,
|
|
6982
|
-
isHydrating: isHydrating,
|
|
6983
|
-
insert: insert,
|
|
6984
|
-
remove: remove,
|
|
6985
|
-
cloneNode: cloneNode,
|
|
6986
|
-
createFragment: createFragment,
|
|
6987
|
-
createElement: createElement$1,
|
|
6988
|
-
createText: createText,
|
|
6989
|
-
createComment: createComment,
|
|
6990
|
-
nextSibling: nextSibling,
|
|
6991
|
-
attachShadow: attachShadow,
|
|
6992
|
-
getProperty: getProperty,
|
|
6993
|
-
setProperty: setProperty,
|
|
6994
|
-
setText: setText,
|
|
6995
|
-
getAttribute: getAttribute,
|
|
6996
|
-
setAttribute: setAttribute,
|
|
6997
|
-
removeAttribute: removeAttribute,
|
|
6998
|
-
addEventListener: addEventListener,
|
|
6999
|
-
removeEventListener: removeEventListener,
|
|
7000
|
-
dispatchEvent: dispatchEvent,
|
|
7001
|
-
getClassList: getClassList,
|
|
7002
|
-
setCSSStyleProperty: setCSSStyleProperty,
|
|
7003
|
-
getBoundingClientRect: getBoundingClientRect,
|
|
7004
|
-
querySelector: querySelector,
|
|
7005
|
-
querySelectorAll: querySelectorAll,
|
|
7006
|
-
getElementsByTagName: getElementsByTagName,
|
|
7007
|
-
getElementsByClassName: getElementsByClassName,
|
|
7008
|
-
getChildren: getChildren,
|
|
7009
|
-
getChildNodes: getChildNodes,
|
|
7010
|
-
getFirstChild: getFirstChild,
|
|
7011
|
-
getFirstElementChild: getFirstElementChild,
|
|
7012
|
-
getLastChild: getLastChild,
|
|
7013
|
-
getLastElementChild: getLastElementChild,
|
|
7014
|
-
isConnected: isConnected,
|
|
7031
|
+
var renderer = assign( // The base renderer will invoke the factory with null and assign additional properties that are
|
|
7032
|
+
// shared across renderers
|
|
7033
|
+
rendererFactory(null), // Properties that are either not required to be sandboxed or rely on a globally shared information
|
|
7034
|
+
{
|
|
7035
|
+
// insertStyleSheet implementation shares a global cache of stylesheet data
|
|
7015
7036
|
insertStylesheet: insertStylesheet,
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
};
|
|
7037
|
+
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7038
|
+
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
|
|
7039
|
+
});
|
|
7020
7040
|
/*
|
|
7021
7041
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
7022
7042
|
* All rights reserved.
|
|
@@ -7081,13 +7101,8 @@
|
|
|
7081
7101
|
}
|
|
7082
7102
|
|
|
7083
7103
|
try {
|
|
7084
|
-
// Let the renderer know we are hydrating, so it does not replace the existing shadowRoot
|
|
7085
|
-
// and uses the same algo to create the stylesheets as in SSR.
|
|
7086
|
-
setIsHydrating(true);
|
|
7087
7104
|
var vm = createVMWithProps(element, Ctor, props);
|
|
7088
|
-
hydrateRoot(vm);
|
|
7089
|
-
|
|
7090
|
-
setIsHydrating(false);
|
|
7105
|
+
hydrateRoot(vm);
|
|
7091
7106
|
} catch (e) {
|
|
7092
7107
|
// Fallback: In case there's an error while hydrating, let's log the error, and replace the element content
|
|
7093
7108
|
// with the client generated DOM.
|
|
@@ -7098,11 +7113,7 @@
|
|
|
7098
7113
|
resetShadowRootAndLightDom(element, Ctor); // we need to recreate the vm with the hydration flag on, so it re-uses the existing shadowRoot.
|
|
7099
7114
|
|
|
7100
7115
|
createVMWithProps(element, Ctor, props);
|
|
7101
|
-
setIsHydrating(false);
|
|
7102
7116
|
connectRootElement(element);
|
|
7103
|
-
} finally {
|
|
7104
|
-
// in case there's an error during recovery
|
|
7105
|
-
setIsHydrating(false);
|
|
7106
7117
|
}
|
|
7107
7118
|
}
|
|
7108
7119
|
/*
|
|
@@ -7193,7 +7204,6 @@
|
|
|
7193
7204
|
* SPDX-License-Identifier: MIT
|
|
7194
7205
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
7195
7206
|
*/
|
|
7196
|
-
// TODO [#2472]: Remove this workaround when appropriate.
|
|
7197
7207
|
// eslint-disable-next-line @lwc/lwc-internal/no-global-node
|
|
7198
7208
|
|
|
7199
7209
|
|
|
@@ -7210,39 +7220,41 @@
|
|
|
7210
7220
|
}
|
|
7211
7221
|
|
|
7212
7222
|
return node; // for convenience
|
|
7213
|
-
}
|
|
7214
|
-
// created via createElement.
|
|
7215
|
-
|
|
7223
|
+
}
|
|
7216
7224
|
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
+
if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
7226
|
+
// Monkey patching Node methods to be able to detect the insertions and removal of root elements
|
|
7227
|
+
// created via createElement.
|
|
7228
|
+
var _Node$1$prototype = _Node$1.prototype,
|
|
7229
|
+
_appendChild = _Node$1$prototype.appendChild,
|
|
7230
|
+
_insertBefore = _Node$1$prototype.insertBefore,
|
|
7231
|
+
_removeChild = _Node$1$prototype.removeChild,
|
|
7232
|
+
_replaceChild = _Node$1$prototype.replaceChild;
|
|
7233
|
+
assign(_Node$1.prototype, {
|
|
7234
|
+
appendChild: function appendChild(newChild) {
|
|
7235
|
+
var appendedNode = _appendChild.call(this, newChild);
|
|
7225
7236
|
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7237
|
+
return callNodeSlot(appendedNode, ConnectingSlot);
|
|
7238
|
+
},
|
|
7239
|
+
insertBefore: function insertBefore(newChild, referenceNode) {
|
|
7240
|
+
var insertedNode = _insertBefore.call(this, newChild, referenceNode);
|
|
7230
7241
|
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7242
|
+
return callNodeSlot(insertedNode, ConnectingSlot);
|
|
7243
|
+
},
|
|
7244
|
+
removeChild: function removeChild(oldChild) {
|
|
7245
|
+
var removedNode = _removeChild.call(this, oldChild);
|
|
7235
7246
|
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7247
|
+
return callNodeSlot(removedNode, DisconnectingSlot);
|
|
7248
|
+
},
|
|
7249
|
+
replaceChild: function replaceChild(newChild, oldChild) {
|
|
7250
|
+
var replacedNode = _replaceChild.call(this, newChild, oldChild);
|
|
7240
7251
|
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7252
|
+
callNodeSlot(replacedNode, DisconnectingSlot);
|
|
7253
|
+
callNodeSlot(newChild, ConnectingSlot);
|
|
7254
|
+
return replacedNode;
|
|
7255
|
+
}
|
|
7256
|
+
});
|
|
7257
|
+
}
|
|
7246
7258
|
/**
|
|
7247
7259
|
* EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
|
|
7248
7260
|
* difference that in the options, you can pass the `is` property set to a Constructor instead of
|
|
@@ -7255,6 +7267,7 @@
|
|
|
7255
7267
|
* ```
|
|
7256
7268
|
*/
|
|
7257
7269
|
|
|
7270
|
+
|
|
7258
7271
|
function createElement(sel, options) {
|
|
7259
7272
|
if (!isObject(options) || isNull(options)) {
|
|
7260
7273
|
throw new TypeError("\"createElement\" function expects an object as second parameter but received \"".concat(toString$1(options), "\"."));
|
|
@@ -7282,8 +7295,12 @@
|
|
|
7282
7295
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
7283
7296
|
owner: null
|
|
7284
7297
|
});
|
|
7285
|
-
|
|
7286
|
-
|
|
7298
|
+
|
|
7299
|
+
if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
7300
|
+
ConnectingSlot.set(elm, connectRootElement);
|
|
7301
|
+
DisconnectingSlot.set(elm, disconnectRootElement);
|
|
7302
|
+
}
|
|
7303
|
+
|
|
7287
7304
|
wasComponentUpgraded = true;
|
|
7288
7305
|
});
|
|
7289
7306
|
|
|
@@ -7330,7 +7347,7 @@
|
|
|
7330
7347
|
// inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
|
|
7331
7348
|
|
|
7332
7349
|
|
|
7333
|
-
return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
|
|
7350
|
+
return renderer.isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
|
|
7334
7351
|
}
|
|
7335
7352
|
/*
|
|
7336
7353
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7374,7 +7391,7 @@
|
|
|
7374
7391
|
});
|
|
7375
7392
|
freeze(LightningElement);
|
|
7376
7393
|
seal(LightningElement.prototype);
|
|
7377
|
-
/* version: 2.
|
|
7394
|
+
/* version: 2.23.2 */
|
|
7378
7395
|
|
|
7379
7396
|
exports.LightningElement = LightningElement;
|
|
7380
7397
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -7396,6 +7413,7 @@
|
|
|
7396
7413
|
exports.registerDecorators = registerDecorators;
|
|
7397
7414
|
exports.registerTemplate = registerTemplate;
|
|
7398
7415
|
exports.renderer = renderer;
|
|
7416
|
+
exports.rendererFactory = rendererFactory;
|
|
7399
7417
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
7400
7418
|
exports.setFeatureFlag = setFeatureFlag;
|
|
7401
7419
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|