lwc 2.23.1 → 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 +1182 -856
- package/dist/engine-dom/iife/es2017/engine-dom.js +1182 -855
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +1101 -803
- package/dist/engine-dom/iife/es5/engine-dom.js +449 -368
- package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +409 -335
- package/dist/engine-dom/umd/es2017/engine-dom.js +1182 -855
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +1101 -803
- package/dist/engine-dom/umd/es5/engine-dom.js +449 -368
- package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +409 -335
- package/dist/engine-server/commonjs/es2017/engine-server.js +782 -521
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
- package/dist/engine-server/esm/es2017/engine-server.js +782 -521
- 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
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
295
295
|
return attributeName;
|
|
296
296
|
}
|
|
297
|
-
/** version: 2.23.
|
|
297
|
+
/** version: 2.23.2 */
|
|
298
298
|
|
|
299
299
|
/**
|
|
300
300
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
patch$1(propName);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
/** version: 2.23.
|
|
379
|
+
/** version: 2.23.2 */
|
|
380
380
|
|
|
381
381
|
/**
|
|
382
382
|
* Copyright (C) 2018 salesforce.com, inc.
|
|
@@ -396,6 +396,7 @@
|
|
|
396
396
|
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
397
397
|
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
398
398
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
399
|
+
ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
399
400
|
ENABLE_NODE_LIST_PATCH: null,
|
|
400
401
|
ENABLE_NODE_PATCH: null,
|
|
401
402
|
ENABLE_REACTIVE_SETTER: null,
|
|
@@ -709,8 +710,8 @@
|
|
|
709
710
|
*/
|
|
710
711
|
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
711
712
|
// to inject at runtime.
|
|
712
|
-
const HTMLElementConstructor
|
|
713
|
-
const HTMLElementPrototype = HTMLElementConstructor
|
|
713
|
+
const HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () { };
|
|
714
|
+
const HTMLElementPrototype = HTMLElementConstructor.prototype;
|
|
714
715
|
|
|
715
716
|
/*
|
|
716
717
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -2100,7 +2101,7 @@
|
|
|
2100
2101
|
defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
2101
2102
|
return HTMLBridgeElement;
|
|
2102
2103
|
}
|
|
2103
|
-
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor
|
|
2104
|
+
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
|
|
2104
2105
|
freeze(BaseBridgeElement);
|
|
2105
2106
|
seal(BaseBridgeElement.prototype);
|
|
2106
2107
|
function setActiveVM(vm) {
|
|
@@ -2475,30 +2476,61 @@
|
|
|
2475
2476
|
* SPDX-License-Identifier: MIT
|
|
2476
2477
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2477
2478
|
*/
|
|
2479
|
+
|
|
2480
|
+
function checkHasVM(elm) {
|
|
2481
|
+
const hasVM = !isUndefined$1(getAssociatedVMIfPresent(elm));
|
|
2482
|
+
|
|
2483
|
+
return hasVM;
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2478
2486
|
function getUpgradableConstructor(tagName, renderer) {
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
+
const {
|
|
2488
|
+
getCustomElement,
|
|
2489
|
+
HTMLElementExported: RendererHTMLElement,
|
|
2490
|
+
defineCustomElement
|
|
2491
|
+
} = renderer; // Should never get a tag with upper case letter at this point, the compiler should
|
|
2492
|
+
// produce only tags with lowercase letters
|
|
2493
|
+
// But, for backwards compatibility, we will lower case the tagName
|
|
2494
|
+
|
|
2495
|
+
tagName = tagName.toLowerCase();
|
|
2496
|
+
let CE = getCustomElement(tagName);
|
|
2497
|
+
|
|
2498
|
+
if (!isUndefined$1(CE)) {
|
|
2499
|
+
return CE;
|
|
2500
|
+
}
|
|
2501
|
+
/**
|
|
2502
|
+
* LWC Upgradable Element reference to an element that was created
|
|
2503
|
+
* via the scoped registry mechanism, and that is ready to be upgraded.
|
|
2504
|
+
*/
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
CE = class LWCUpgradableElement extends RendererHTMLElement {
|
|
2508
|
+
constructor(upgradeCallback) {
|
|
2509
|
+
super();
|
|
2510
|
+
|
|
2511
|
+
if (isFunction$1(upgradeCallback)) {
|
|
2512
|
+
upgradeCallback(this); // nothing to do with the result for now
|
|
2513
|
+
}
|
|
2487
2514
|
}
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
CE =
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
upgradeCallback(this); // nothing to do with the result for now
|
|
2497
|
-
}
|
|
2498
|
-
}
|
|
2515
|
+
|
|
2516
|
+
};
|
|
2517
|
+
|
|
2518
|
+
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
2519
|
+
CE.prototype.connectedCallback = function () {
|
|
2520
|
+
if (checkHasVM(this)) {
|
|
2521
|
+
connectRootElement(this);
|
|
2522
|
+
}
|
|
2499
2523
|
};
|
|
2500
|
-
|
|
2501
|
-
|
|
2524
|
+
|
|
2525
|
+
CE.prototype.disconnectedCallback = function () {
|
|
2526
|
+
if (checkHasVM(this)) {
|
|
2527
|
+
disconnectRootElement(this);
|
|
2528
|
+
}
|
|
2529
|
+
};
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
defineCustomElement(tagName, CE);
|
|
2533
|
+
return CE;
|
|
2502
2534
|
}
|
|
2503
2535
|
|
|
2504
2536
|
/*
|
|
@@ -2740,534 +2772,732 @@
|
|
|
2740
2772
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2741
2773
|
*/
|
|
2742
2774
|
function patchChildren(c1, c2, parent, renderer) {
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
}
|
|
2775
|
+
if (hasDynamicChildren(c2)) {
|
|
2776
|
+
updateDynamicChildren(c1, c2, parent, renderer);
|
|
2777
|
+
} else {
|
|
2778
|
+
updateStaticChildren(c1, c2, parent, renderer);
|
|
2779
|
+
}
|
|
2749
2780
|
}
|
|
2781
|
+
|
|
2750
2782
|
function patch(n1, n2, parent, renderer) {
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2783
|
+
var _a, _b;
|
|
2784
|
+
|
|
2785
|
+
if (n1 === n2) {
|
|
2786
|
+
return;
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
switch (n2.type) {
|
|
2790
|
+
case 0
|
|
2791
|
+
/* VNodeType.Text */
|
|
2792
|
+
:
|
|
2793
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
2794
|
+
patchText(n1, n2, renderer);
|
|
2795
|
+
break;
|
|
2796
|
+
|
|
2797
|
+
case 1
|
|
2798
|
+
/* VNodeType.Comment */
|
|
2799
|
+
:
|
|
2800
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
2801
|
+
patchComment(n1, n2, renderer);
|
|
2802
|
+
break;
|
|
2803
|
+
|
|
2804
|
+
case 4
|
|
2805
|
+
/* VNodeType.Static */
|
|
2806
|
+
:
|
|
2807
|
+
n2.elm = n1.elm;
|
|
2808
|
+
break;
|
|
2809
|
+
|
|
2810
|
+
case 2
|
|
2811
|
+
/* VNodeType.Element */
|
|
2812
|
+
:
|
|
2813
|
+
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
2814
|
+
break;
|
|
2815
|
+
|
|
2816
|
+
case 3
|
|
2817
|
+
/* VNodeType.CustomElement */
|
|
2818
|
+
:
|
|
2819
|
+
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
2820
|
+
break;
|
|
2821
|
+
}
|
|
2774
2822
|
}
|
|
2823
|
+
|
|
2775
2824
|
function mount(node, parent, renderer, anchor) {
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2825
|
+
var _a, _b;
|
|
2826
|
+
|
|
2827
|
+
switch (node.type) {
|
|
2828
|
+
case 0
|
|
2829
|
+
/* VNodeType.Text */
|
|
2830
|
+
:
|
|
2831
|
+
// VText has no special capability, fallback to the owner's renderer
|
|
2832
|
+
mountText(node, parent, anchor, renderer);
|
|
2833
|
+
break;
|
|
2834
|
+
|
|
2835
|
+
case 1
|
|
2836
|
+
/* VNodeType.Comment */
|
|
2837
|
+
:
|
|
2838
|
+
// VComment has no special capability, fallback to the owner's renderer
|
|
2839
|
+
mountComment(node, parent, anchor, renderer);
|
|
2840
|
+
break;
|
|
2841
|
+
|
|
2842
|
+
case 4
|
|
2843
|
+
/* VNodeType.Static */
|
|
2844
|
+
:
|
|
2845
|
+
// VStatic cannot have a custom renderer associated to them, using owner's renderer
|
|
2846
|
+
mountStatic(node, parent, anchor, renderer);
|
|
2847
|
+
break;
|
|
2848
|
+
|
|
2849
|
+
case 2
|
|
2850
|
+
/* VNodeType.Element */
|
|
2851
|
+
:
|
|
2852
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
2853
|
+
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
2854
|
+
break;
|
|
2855
|
+
|
|
2856
|
+
case 3
|
|
2857
|
+
/* VNodeType.CustomElement */
|
|
2858
|
+
:
|
|
2859
|
+
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
2860
|
+
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
2861
|
+
break;
|
|
2862
|
+
}
|
|
2799
2863
|
}
|
|
2864
|
+
|
|
2800
2865
|
function patchText(n1, n2, renderer) {
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2866
|
+
n2.elm = n1.elm;
|
|
2867
|
+
|
|
2868
|
+
if (n2.text !== n1.text) {
|
|
2869
|
+
updateTextContent(n2, renderer);
|
|
2870
|
+
}
|
|
2805
2871
|
}
|
|
2872
|
+
|
|
2806
2873
|
function mountText(vnode, parent, anchor, renderer) {
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2874
|
+
const {
|
|
2875
|
+
owner
|
|
2876
|
+
} = vnode;
|
|
2877
|
+
const {
|
|
2878
|
+
createText
|
|
2879
|
+
} = renderer;
|
|
2880
|
+
const textNode = vnode.elm = createText(vnode.text);
|
|
2881
|
+
linkNodeToShadow(textNode, owner, renderer);
|
|
2882
|
+
insertNode(textNode, parent, anchor, renderer);
|
|
2812
2883
|
}
|
|
2884
|
+
|
|
2813
2885
|
function patchComment(n1, n2, renderer) {
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2886
|
+
n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
2887
|
+
// it is the case today.
|
|
2888
|
+
|
|
2889
|
+
if (n2.text !== n1.text) {
|
|
2890
|
+
updateTextContent(n2, renderer);
|
|
2891
|
+
}
|
|
2820
2892
|
}
|
|
2893
|
+
|
|
2821
2894
|
function mountComment(vnode, parent, anchor, renderer) {
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2895
|
+
const {
|
|
2896
|
+
owner
|
|
2897
|
+
} = vnode;
|
|
2898
|
+
const {
|
|
2899
|
+
createComment
|
|
2900
|
+
} = renderer;
|
|
2901
|
+
const commentNode = vnode.elm = createComment(vnode.text);
|
|
2902
|
+
linkNodeToShadow(commentNode, owner, renderer);
|
|
2903
|
+
insertNode(commentNode, parent, anchor, renderer);
|
|
2827
2904
|
}
|
|
2905
|
+
|
|
2828
2906
|
function mountElement(vnode, parent, anchor, renderer) {
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2907
|
+
const {
|
|
2908
|
+
sel,
|
|
2909
|
+
owner,
|
|
2910
|
+
data: {
|
|
2911
|
+
svg
|
|
2912
|
+
}
|
|
2913
|
+
} = vnode;
|
|
2914
|
+
const {
|
|
2915
|
+
createElement
|
|
2916
|
+
} = renderer;
|
|
2917
|
+
const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;
|
|
2918
|
+
const elm = vnode.elm = createElement(sel, namespace);
|
|
2919
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
2920
|
+
applyStyleScoping(elm, owner, renderer);
|
|
2921
|
+
applyDomManual(elm, vnode);
|
|
2922
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
2923
|
+
insertNode(elm, parent, anchor, renderer);
|
|
2924
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
2839
2925
|
}
|
|
2926
|
+
|
|
2840
2927
|
function patchElement(n1, n2, renderer) {
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2928
|
+
const elm = n2.elm = n1.elm;
|
|
2929
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
2930
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
2844
2931
|
}
|
|
2932
|
+
|
|
2845
2933
|
function mountStatic(vnode, parent, anchor, renderer) {
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2934
|
+
const {
|
|
2935
|
+
owner
|
|
2936
|
+
} = vnode;
|
|
2937
|
+
const {
|
|
2938
|
+
cloneNode,
|
|
2939
|
+
isSyntheticShadowDefined
|
|
2940
|
+
} = renderer;
|
|
2941
|
+
const elm = vnode.elm = cloneNode(vnode.fragment, true);
|
|
2942
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
2943
|
+
|
|
2944
|
+
const {
|
|
2945
|
+
renderMode,
|
|
2946
|
+
shadowMode
|
|
2947
|
+
} = owner;
|
|
2948
|
+
|
|
2949
|
+
if (isSyntheticShadowDefined) {
|
|
2950
|
+
if (shadowMode === 1
|
|
2951
|
+
/* ShadowMode.Synthetic */
|
|
2952
|
+
|| renderMode === 0
|
|
2953
|
+
/* RenderMode.Light */
|
|
2954
|
+
) {
|
|
2955
|
+
elm[KEY__SHADOW_STATIC] = true;
|
|
2856
2956
|
}
|
|
2857
|
-
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2959
|
+
insertNode(elm, parent, anchor, renderer);
|
|
2858
2960
|
}
|
|
2961
|
+
|
|
2859
2962
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2963
|
+
const {
|
|
2964
|
+
sel,
|
|
2965
|
+
owner
|
|
2966
|
+
} = vnode;
|
|
2967
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
2968
|
+
/**
|
|
2969
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
2970
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
2971
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
2972
|
+
* an upgradable custom element.
|
|
2973
|
+
*/
|
|
2974
|
+
|
|
2975
|
+
let vm;
|
|
2976
|
+
const elm = new UpgradableConstructor(elm => {
|
|
2977
|
+
// the custom element from the registry is expecting an upgrade callback
|
|
2978
|
+
vm = createViewModelHook(elm, vnode, renderer);
|
|
2979
|
+
});
|
|
2980
|
+
vnode.elm = elm;
|
|
2981
|
+
vnode.vm = vm;
|
|
2982
|
+
linkNodeToShadow(elm, owner, renderer);
|
|
2983
|
+
applyStyleScoping(elm, owner, renderer);
|
|
2984
|
+
|
|
2985
|
+
if (vm) {
|
|
2986
|
+
allocateChildren(vnode, vm);
|
|
2987
|
+
} else if (vnode.ctor !== UpgradableConstructor) {
|
|
2988
|
+
throw new TypeError(`Incorrect Component Constructor`);
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
2992
|
+
insertNode(elm, parent, anchor, renderer);
|
|
2993
|
+
|
|
2994
|
+
if (vm) {
|
|
2995
|
+
{
|
|
2996
|
+
if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
2997
|
+
|
|
2886
2998
|
runConnectedCallback(vm);
|
|
2999
|
+
}
|
|
2887
3000
|
}
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
3001
|
+
}
|
|
3002
|
+
|
|
3003
|
+
mountVNodes(vnode.children, elm, renderer, null);
|
|
3004
|
+
|
|
3005
|
+
if (vm) {
|
|
3006
|
+
appendVM(vm);
|
|
3007
|
+
}
|
|
2892
3008
|
}
|
|
3009
|
+
|
|
2893
3010
|
function patchCustomElement(n1, n2, parent, renderer) {
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
3011
|
+
if (n1.ctor !== n2.ctor) {
|
|
3012
|
+
// If the constructor, unmount the current component and mount a new one using the new
|
|
3013
|
+
// constructor.
|
|
3014
|
+
const anchor = renderer.nextSibling(n1.elm);
|
|
3015
|
+
unmount(n1, parent, renderer, true);
|
|
3016
|
+
mountCustomElement(n2, parent, anchor, renderer);
|
|
3017
|
+
} else {
|
|
3018
|
+
// Otherwise patch the existing component with new props/attrs/etc.
|
|
3019
|
+
const elm = n2.elm = n1.elm;
|
|
3020
|
+
const vm = n2.vm = n1.vm;
|
|
3021
|
+
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3022
|
+
|
|
3023
|
+
if (!isUndefined$1(vm)) {
|
|
3024
|
+
// in fallback mode, the allocation will always set children to
|
|
3025
|
+
// empty and delegate the real allocation to the slot elements
|
|
3026
|
+
allocateChildren(n2, vm);
|
|
3027
|
+
} // in fallback mode, the children will be always empty, so, nothing
|
|
3028
|
+
// will happen, but in native, it does allocate the light dom
|
|
3029
|
+
|
|
3030
|
+
|
|
3031
|
+
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3032
|
+
|
|
3033
|
+
if (!isUndefined$1(vm)) {
|
|
3034
|
+
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3035
|
+
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
3036
|
+
rerenderVM(vm);
|
|
2919
3037
|
}
|
|
3038
|
+
}
|
|
2920
3039
|
}
|
|
3040
|
+
|
|
2921
3041
|
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
3042
|
+
for (; start < end; ++start) {
|
|
3043
|
+
const vnode = vnodes[start];
|
|
3044
|
+
|
|
3045
|
+
if (isVNode(vnode)) {
|
|
3046
|
+
mount(vnode, parent, renderer, anchor);
|
|
2927
3047
|
}
|
|
3048
|
+
}
|
|
2928
3049
|
}
|
|
3050
|
+
|
|
2929
3051
|
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
3052
|
+
const {
|
|
3053
|
+
type,
|
|
3054
|
+
elm,
|
|
3055
|
+
sel
|
|
3056
|
+
} = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3057
|
+
// subtree root, is the only element worth unmounting from the subtree.
|
|
3058
|
+
|
|
3059
|
+
if (doRemove) {
|
|
3060
|
+
// The vnode might or might not have a data.renderer associated to it
|
|
3061
|
+
// but the removal used here is from the owner instead.
|
|
3062
|
+
removeNode(elm, parent, renderer);
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
switch (type) {
|
|
3066
|
+
case 2
|
|
3067
|
+
/* VNodeType.Element */
|
|
3068
|
+
:
|
|
3069
|
+
{
|
|
3070
|
+
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3071
|
+
// Only required for synthetic shadow.
|
|
3072
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1
|
|
3073
|
+
/* ShadowMode.Synthetic */
|
|
3074
|
+
;
|
|
3075
|
+
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3076
|
+
break;
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
case 3
|
|
3080
|
+
/* VNodeType.CustomElement */
|
|
3081
|
+
:
|
|
3082
|
+
{
|
|
3083
|
+
const {
|
|
3084
|
+
vm
|
|
3085
|
+
} = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
|
|
3086
|
+
// children.
|
|
3087
|
+
|
|
3088
|
+
if (!isUndefined$1(vm)) {
|
|
3089
|
+
removeVM(vm);
|
|
2953
3090
|
}
|
|
2954
|
-
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
2955
3093
|
}
|
|
3094
|
+
|
|
2956
3095
|
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
3096
|
+
for (; start < end; ++start) {
|
|
3097
|
+
const ch = vnodes[start];
|
|
3098
|
+
|
|
3099
|
+
if (isVNode(ch)) {
|
|
3100
|
+
unmount(ch, parent, renderer, doRemove);
|
|
2962
3101
|
}
|
|
3102
|
+
}
|
|
2963
3103
|
}
|
|
3104
|
+
|
|
2964
3105
|
function isVNode(vnode) {
|
|
2965
|
-
|
|
3106
|
+
return vnode != null;
|
|
2966
3107
|
}
|
|
3108
|
+
|
|
2967
3109
|
function linkNodeToShadow(elm, owner, renderer) {
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
3110
|
+
const {
|
|
3111
|
+
renderRoot,
|
|
3112
|
+
renderMode,
|
|
3113
|
+
shadowMode
|
|
3114
|
+
} = owner;
|
|
3115
|
+
const {
|
|
3116
|
+
isSyntheticShadowDefined
|
|
3117
|
+
} = renderer; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3118
|
+
|
|
3119
|
+
if (isSyntheticShadowDefined) {
|
|
3120
|
+
if (shadowMode === 1
|
|
3121
|
+
/* ShadowMode.Synthetic */
|
|
3122
|
+
|| renderMode === 0
|
|
3123
|
+
/* RenderMode.Light */
|
|
3124
|
+
) {
|
|
3125
|
+
elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
|
|
2975
3126
|
}
|
|
3127
|
+
}
|
|
2976
3128
|
}
|
|
3129
|
+
|
|
2977
3130
|
function updateTextContent(vnode, renderer) {
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
3131
|
+
const {
|
|
3132
|
+
elm,
|
|
3133
|
+
text
|
|
3134
|
+
} = vnode;
|
|
3135
|
+
const {
|
|
3136
|
+
setText
|
|
3137
|
+
} = renderer;
|
|
3138
|
+
|
|
3139
|
+
setText(elm, text);
|
|
2981
3140
|
}
|
|
3141
|
+
|
|
2982
3142
|
function insertNode(node, parent, anchor, renderer) {
|
|
2983
|
-
|
|
3143
|
+
|
|
3144
|
+
renderer.insert(node, parent, anchor);
|
|
2984
3145
|
}
|
|
3146
|
+
|
|
2985
3147
|
function removeNode(node, parent, renderer) {
|
|
2986
|
-
|
|
3148
|
+
|
|
3149
|
+
renderer.remove(node, parent);
|
|
2987
3150
|
}
|
|
3151
|
+
|
|
2988
3152
|
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3153
|
+
if (isNull(oldVnode)) {
|
|
3154
|
+
applyEventListeners(vnode, renderer);
|
|
3155
|
+
applyStaticClassAttribute(vnode, renderer);
|
|
3156
|
+
applyStaticStyleAttribute(vnode, renderer);
|
|
3157
|
+
} // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
3158
|
+
// value is set before type=radio.
|
|
3159
|
+
|
|
3160
|
+
|
|
3161
|
+
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3162
|
+
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3163
|
+
patchAttributes(oldVnode, vnode, renderer);
|
|
3164
|
+
patchProps(oldVnode, vnode, renderer);
|
|
3000
3165
|
}
|
|
3166
|
+
|
|
3001
3167
|
function applyStyleScoping(elm, owner, renderer) {
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3168
|
+
// Set the class name for `*.scoped.css` style scoping.
|
|
3169
|
+
const scopeToken = getScopeTokenClass(owner);
|
|
3170
|
+
|
|
3171
|
+
if (!isNull(scopeToken)) {
|
|
3172
|
+
const {
|
|
3173
|
+
getClassList
|
|
3174
|
+
} = renderer; // TODO [#2762]: this dot notation with add is probably problematic
|
|
3175
|
+
// probably we should have a renderer api for just the add operation
|
|
3176
|
+
|
|
3177
|
+
getClassList(elm).add(scopeToken);
|
|
3178
|
+
} // Set property element for synthetic shadow DOM style scoping.
|
|
3179
|
+
|
|
3180
|
+
|
|
3181
|
+
const {
|
|
3182
|
+
stylesheetToken: syntheticToken
|
|
3183
|
+
} = owner.context;
|
|
3184
|
+
|
|
3185
|
+
if (owner.shadowMode === 1
|
|
3186
|
+
/* ShadowMode.Synthetic */
|
|
3187
|
+
&& !isUndefined$1(syntheticToken)) {
|
|
3188
|
+
elm.$shadowToken$ = syntheticToken;
|
|
3189
|
+
}
|
|
3015
3190
|
}
|
|
3191
|
+
|
|
3016
3192
|
function applyDomManual(elm, vnode) {
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3193
|
+
var _a;
|
|
3194
|
+
|
|
3195
|
+
const {
|
|
3196
|
+
owner,
|
|
3197
|
+
data: {
|
|
3198
|
+
context
|
|
3021
3199
|
}
|
|
3200
|
+
} = vnode;
|
|
3201
|
+
|
|
3202
|
+
if (owner.shadowMode === 1
|
|
3203
|
+
/* ShadowMode.Synthetic */
|
|
3204
|
+
&& ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
|
|
3205
|
+
/* LwcDomMode.Manual */
|
|
3206
|
+
) {
|
|
3207
|
+
elm.$domManual$ = true;
|
|
3208
|
+
}
|
|
3022
3209
|
}
|
|
3210
|
+
|
|
3023
3211
|
function allocateChildren(vnode, vm) {
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3212
|
+
// A component with slots will re-render because:
|
|
3213
|
+
// 1- There is a change of the internal state.
|
|
3214
|
+
// 2- There is a change on the external api (ex: slots)
|
|
3215
|
+
//
|
|
3216
|
+
// In case #1, the vnodes in the cmpSlots will be reused since they didn't changed. This routine emptied the
|
|
3217
|
+
// slotted children when those VCustomElement were rendered and therefore in subsequent calls to allocate children
|
|
3218
|
+
// in a reused VCustomElement, there won't be any slotted children.
|
|
3219
|
+
// For those cases, we will use the reference for allocated children stored when rendering the fresh VCustomElement.
|
|
3220
|
+
//
|
|
3221
|
+
// In case #2, we will always get a fresh VCustomElement.
|
|
3222
|
+
const children = vnode.aChildren || vnode.children;
|
|
3223
|
+
vm.aChildren = children;
|
|
3224
|
+
const {
|
|
3225
|
+
renderMode,
|
|
3226
|
+
shadowMode
|
|
3227
|
+
} = vm;
|
|
3228
|
+
|
|
3229
|
+
if (shadowMode === 1
|
|
3230
|
+
/* ShadowMode.Synthetic */
|
|
3231
|
+
|| renderMode === 0
|
|
3232
|
+
/* RenderMode.Light */
|
|
3233
|
+
) {
|
|
3234
|
+
// slow path
|
|
3235
|
+
allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
|
|
3236
|
+
|
|
3237
|
+
vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
3238
|
+
|
|
3239
|
+
vnode.children = EmptyArray;
|
|
3240
|
+
}
|
|
3045
3241
|
}
|
|
3242
|
+
|
|
3046
3243
|
function createViewModelHook(elm, vnode, renderer) {
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3244
|
+
let vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the
|
|
3245
|
+
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
3246
|
+
// called right after invoking `document.createElement`.
|
|
3247
|
+
|
|
3248
|
+
if (!isUndefined$1(vm)) {
|
|
3249
|
+
return vm;
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3252
|
+
const {
|
|
3253
|
+
sel,
|
|
3254
|
+
mode,
|
|
3255
|
+
ctor,
|
|
3256
|
+
owner
|
|
3257
|
+
} = vnode;
|
|
3258
|
+
vm = createVM(elm, ctor, renderer, {
|
|
3259
|
+
mode,
|
|
3260
|
+
owner,
|
|
3261
|
+
tagName: sel
|
|
3262
|
+
});
|
|
3263
|
+
|
|
3264
|
+
return vm;
|
|
3265
|
+
}
|
|
3266
|
+
|
|
3267
|
+
function allocateInSlot(vm, children) {
|
|
3268
|
+
var _a;
|
|
3269
|
+
|
|
3270
|
+
const {
|
|
3271
|
+
cmpSlots: oldSlots
|
|
3272
|
+
} = vm;
|
|
3273
|
+
const cmpSlots = vm.cmpSlots = create(null);
|
|
3274
|
+
|
|
3275
|
+
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
3276
|
+
const vnode = children[i];
|
|
3277
|
+
|
|
3278
|
+
if (isNull(vnode)) {
|
|
3279
|
+
continue;
|
|
3280
|
+
}
|
|
3281
|
+
|
|
3282
|
+
let slotName = '';
|
|
3283
|
+
|
|
3284
|
+
if (isVBaseElement(vnode)) {
|
|
3285
|
+
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';
|
|
3286
|
+
}
|
|
3287
|
+
|
|
3288
|
+
const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || [];
|
|
3289
|
+
ArrayPush$1.call(vnodes, vnode);
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3292
|
+
if (isFalse(vm.isDirty)) {
|
|
3293
|
+
// We need to determine if the old allocation is really different from the new one
|
|
3294
|
+
// and mark the vm as dirty
|
|
3295
|
+
const oldKeys = keys(oldSlots);
|
|
3296
|
+
|
|
3297
|
+
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
3298
|
+
markComponentAsDirty(vm);
|
|
3299
|
+
return;
|
|
3053
3300
|
}
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
}
|
|
3071
|
-
let slotName = '';
|
|
3072
|
-
if (isVBaseElement(vnode)) {
|
|
3073
|
-
slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';
|
|
3074
|
-
}
|
|
3075
|
-
const vnodes = (cmpSlots[slotName] = cmpSlots[slotName] || []);
|
|
3076
|
-
ArrayPush$1.call(vnodes, vnode);
|
|
3077
|
-
}
|
|
3078
|
-
if (isFalse(vm.isDirty)) {
|
|
3079
|
-
// We need to determine if the old allocation is really different from the new one
|
|
3080
|
-
// and mark the vm as dirty
|
|
3081
|
-
const oldKeys = keys(oldSlots);
|
|
3082
|
-
if (oldKeys.length !== keys(cmpSlots).length) {
|
|
3083
|
-
markComponentAsDirty(vm);
|
|
3084
|
-
return;
|
|
3085
|
-
}
|
|
3086
|
-
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
3087
|
-
const key = oldKeys[i];
|
|
3088
|
-
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
3089
|
-
markComponentAsDirty(vm);
|
|
3090
|
-
return;
|
|
3091
|
-
}
|
|
3092
|
-
const oldVNodes = oldSlots[key];
|
|
3093
|
-
const vnodes = cmpSlots[key];
|
|
3094
|
-
for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
3095
|
-
if (oldVNodes[j] !== vnodes[j]) {
|
|
3096
|
-
markComponentAsDirty(vm);
|
|
3097
|
-
return;
|
|
3098
|
-
}
|
|
3099
|
-
}
|
|
3301
|
+
|
|
3302
|
+
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
3303
|
+
const key = oldKeys[i];
|
|
3304
|
+
|
|
3305
|
+
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
3306
|
+
markComponentAsDirty(vm);
|
|
3307
|
+
return;
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
const oldVNodes = oldSlots[key];
|
|
3311
|
+
const vnodes = cmpSlots[key];
|
|
3312
|
+
|
|
3313
|
+
for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
|
|
3314
|
+
if (oldVNodes[j] !== vnodes[j]) {
|
|
3315
|
+
markComponentAsDirty(vm);
|
|
3316
|
+
return;
|
|
3100
3317
|
}
|
|
3318
|
+
}
|
|
3101
3319
|
}
|
|
3102
|
-
|
|
3103
|
-
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
3104
|
-
|
|
3105
|
-
|
|
3320
|
+
}
|
|
3321
|
+
} // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
3322
|
+
|
|
3323
|
+
|
|
3324
|
+
const FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration
|
|
3106
3325
|
// in a template, and will require a more complex diffing algo.
|
|
3326
|
+
|
|
3107
3327
|
function markAsDynamicChildren(children) {
|
|
3108
|
-
|
|
3328
|
+
FromIteration.set(children, 1);
|
|
3109
3329
|
}
|
|
3330
|
+
|
|
3110
3331
|
function hasDynamicChildren(children) {
|
|
3111
|
-
|
|
3332
|
+
return FromIteration.has(children);
|
|
3112
3333
|
}
|
|
3334
|
+
|
|
3113
3335
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3336
|
+
const map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
3337
|
+
|
|
3338
|
+
for (let j = beginIdx; j <= endIdx; ++j) {
|
|
3339
|
+
const ch = children[j];
|
|
3340
|
+
|
|
3341
|
+
if (isVNode(ch)) {
|
|
3342
|
+
const {
|
|
3343
|
+
key
|
|
3344
|
+
} = ch;
|
|
3345
|
+
|
|
3346
|
+
if (key !== undefined) {
|
|
3347
|
+
map[key] = j;
|
|
3348
|
+
}
|
|
3124
3349
|
}
|
|
3125
|
-
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3352
|
+
return map;
|
|
3126
3353
|
}
|
|
3354
|
+
|
|
3127
3355
|
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
}
|
|
3207
|
-
// We've already cloned at least once, so it's no longer read-only
|
|
3208
|
-
oldCh[idxInOld] = undefined;
|
|
3209
|
-
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
3210
|
-
}
|
|
3211
|
-
}
|
|
3212
|
-
newStartVnode = newCh[++newStartIdx];
|
|
3213
|
-
}
|
|
3356
|
+
let oldStartIdx = 0;
|
|
3357
|
+
let newStartIdx = 0;
|
|
3358
|
+
let oldEndIdx = oldCh.length - 1;
|
|
3359
|
+
let oldStartVnode = oldCh[0];
|
|
3360
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
|
3361
|
+
const newChEnd = newCh.length - 1;
|
|
3362
|
+
let newEndIdx = newChEnd;
|
|
3363
|
+
let newStartVnode = newCh[0];
|
|
3364
|
+
let newEndVnode = newCh[newEndIdx];
|
|
3365
|
+
let oldKeyToIdx;
|
|
3366
|
+
let idxInOld;
|
|
3367
|
+
let elmToMove;
|
|
3368
|
+
let before;
|
|
3369
|
+
let clonedOldCh = false;
|
|
3370
|
+
|
|
3371
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
3372
|
+
if (!isVNode(oldStartVnode)) {
|
|
3373
|
+
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
3374
|
+
} else if (!isVNode(oldEndVnode)) {
|
|
3375
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
3376
|
+
} else if (!isVNode(newStartVnode)) {
|
|
3377
|
+
newStartVnode = newCh[++newStartIdx];
|
|
3378
|
+
} else if (!isVNode(newEndVnode)) {
|
|
3379
|
+
newEndVnode = newCh[--newEndIdx];
|
|
3380
|
+
} else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
3381
|
+
patch(oldStartVnode, newStartVnode, parent, renderer);
|
|
3382
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
3383
|
+
newStartVnode = newCh[++newStartIdx];
|
|
3384
|
+
} else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
3385
|
+
patch(oldEndVnode, newEndVnode, parent, renderer);
|
|
3386
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
3387
|
+
newEndVnode = newCh[--newEndIdx];
|
|
3388
|
+
} else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
3389
|
+
// Vnode moved right
|
|
3390
|
+
patch(oldStartVnode, newEndVnode, parent, renderer);
|
|
3391
|
+
insertNode(oldStartVnode.elm, parent, renderer.nextSibling(oldEndVnode.elm), renderer);
|
|
3392
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
|
3393
|
+
newEndVnode = newCh[--newEndIdx];
|
|
3394
|
+
} else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
3395
|
+
// Vnode moved left
|
|
3396
|
+
patch(oldEndVnode, newStartVnode, parent, renderer);
|
|
3397
|
+
insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer);
|
|
3398
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
|
3399
|
+
newStartVnode = newCh[++newStartIdx];
|
|
3400
|
+
} else {
|
|
3401
|
+
if (oldKeyToIdx === undefined) {
|
|
3402
|
+
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
3406
|
+
|
|
3407
|
+
if (isUndefined$1(idxInOld)) {
|
|
3408
|
+
// New element
|
|
3409
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
3410
|
+
newStartVnode = newCh[++newStartIdx];
|
|
3411
|
+
} else {
|
|
3412
|
+
elmToMove = oldCh[idxInOld];
|
|
3413
|
+
|
|
3414
|
+
if (isVNode(elmToMove)) {
|
|
3415
|
+
if (elmToMove.sel !== newStartVnode.sel) {
|
|
3416
|
+
// New element
|
|
3417
|
+
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
3418
|
+
} else {
|
|
3419
|
+
patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
|
|
3420
|
+
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
3421
|
+
// so we only care about the `oldCh` object inside this function.
|
|
3422
|
+
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
3423
|
+
// and only clone once.
|
|
3424
|
+
|
|
3425
|
+
if (!clonedOldCh) {
|
|
3426
|
+
clonedOldCh = true;
|
|
3427
|
+
oldCh = [...oldCh];
|
|
3428
|
+
} // We've already cloned at least once, so it's no longer read-only
|
|
3429
|
+
|
|
3430
|
+
|
|
3431
|
+
oldCh[idxInOld] = undefined;
|
|
3432
|
+
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
3433
|
+
}
|
|
3214
3434
|
}
|
|
3435
|
+
|
|
3436
|
+
newStartVnode = newCh[++newStartIdx];
|
|
3437
|
+
}
|
|
3215
3438
|
}
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3439
|
+
}
|
|
3440
|
+
|
|
3441
|
+
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
3442
|
+
if (oldStartIdx > oldEndIdx) {
|
|
3443
|
+
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
3444
|
+
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
3445
|
+
let i = newEndIdx;
|
|
3446
|
+
let n;
|
|
3447
|
+
|
|
3448
|
+
do {
|
|
3449
|
+
n = newCh[++i];
|
|
3450
|
+
} while (!isVNode(n) && i < newChEnd);
|
|
3451
|
+
|
|
3452
|
+
before = isVNode(n) ? n.elm : null;
|
|
3453
|
+
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
3454
|
+
} else {
|
|
3455
|
+
unmountVNodes(oldCh, parent, renderer, true, oldStartIdx, oldEndIdx + 1);
|
|
3231
3456
|
}
|
|
3457
|
+
}
|
|
3232
3458
|
}
|
|
3459
|
+
|
|
3233
3460
|
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
anchor = n2.elm;
|
|
3268
|
-
}
|
|
3461
|
+
const c1Length = c1.length;
|
|
3462
|
+
const c2Length = c2.length;
|
|
3463
|
+
|
|
3464
|
+
if (c1Length === 0) {
|
|
3465
|
+
// the old list is empty, we can directly insert anything new
|
|
3466
|
+
mountVNodes(c2, parent, renderer, null);
|
|
3467
|
+
return;
|
|
3468
|
+
}
|
|
3469
|
+
|
|
3470
|
+
if (c2Length === 0) {
|
|
3471
|
+
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
3472
|
+
// this is the case in which the dynamic children of an if-directive should be removed
|
|
3473
|
+
unmountVNodes(c1, parent, renderer, true);
|
|
3474
|
+
return;
|
|
3475
|
+
} // if the old list is not empty, the new list MUST have the same
|
|
3476
|
+
// amount of nodes, that's why we call this static children
|
|
3477
|
+
|
|
3478
|
+
|
|
3479
|
+
let anchor = null;
|
|
3480
|
+
|
|
3481
|
+
for (let i = c2Length - 1; i >= 0; i -= 1) {
|
|
3482
|
+
const n1 = c1[i];
|
|
3483
|
+
const n2 = c2[i];
|
|
3484
|
+
|
|
3485
|
+
if (n2 !== n1) {
|
|
3486
|
+
if (isVNode(n1)) {
|
|
3487
|
+
if (isVNode(n2)) {
|
|
3488
|
+
// both vnodes are equivalent, and we just need to patch them
|
|
3489
|
+
patch(n1, n2, parent, renderer);
|
|
3490
|
+
anchor = n2.elm;
|
|
3491
|
+
} else {
|
|
3492
|
+
// removing the old vnode since the new one is null
|
|
3493
|
+
unmount(n1, parent, renderer, true);
|
|
3269
3494
|
}
|
|
3495
|
+
} else if (isVNode(n2)) {
|
|
3496
|
+
mount(n2, parent, renderer, anchor);
|
|
3497
|
+
anchor = n2.elm;
|
|
3498
|
+
}
|
|
3270
3499
|
}
|
|
3500
|
+
}
|
|
3271
3501
|
}
|
|
3272
3502
|
|
|
3273
3503
|
/*
|
|
@@ -4902,6 +5132,7 @@
|
|
|
4902
5132
|
}
|
|
4903
5133
|
return renderer.nextSibling(hydratedNode);
|
|
4904
5134
|
}
|
|
5135
|
+
const NODE_VALUE_PROP = 'nodeValue';
|
|
4905
5136
|
function hydrateText(node, vnode, renderer) {
|
|
4906
5137
|
var _a;
|
|
4907
5138
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
|
@@ -4918,7 +5149,7 @@
|
|
|
4918
5149
|
return handleMismatch(node, vnode, renderer);
|
|
4919
5150
|
}
|
|
4920
5151
|
const { setProperty } = renderer;
|
|
4921
|
-
setProperty(node,
|
|
5152
|
+
setProperty(node, NODE_VALUE_PROP, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
|
|
4922
5153
|
vnode.elm = node;
|
|
4923
5154
|
return node;
|
|
4924
5155
|
}
|
|
@@ -5139,13 +5370,13 @@
|
|
|
5139
5370
|
if (!hasCorrectNodeType(vnode, ssr, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
|
5140
5371
|
return false;
|
|
5141
5372
|
}
|
|
5142
|
-
return getProperty(client,
|
|
5373
|
+
return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
|
|
5143
5374
|
}
|
|
5144
5375
|
if (getProperty(client, 'nodeType') === 8 /* EnvNodeTypes.COMMENT */) {
|
|
5145
5376
|
if (!hasCorrectNodeType(vnode, ssr, 8 /* EnvNodeTypes.COMMENT */, renderer)) {
|
|
5146
5377
|
return false;
|
|
5147
5378
|
}
|
|
5148
|
-
return getProperty(client,
|
|
5379
|
+
return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
|
|
5149
5380
|
}
|
|
5150
5381
|
if (!hasCorrectNodeType(vnode, ssr, 1 /* EnvNodeTypes.ELEMENT */, renderer)) {
|
|
5151
5382
|
return false;
|
|
@@ -5203,7 +5434,7 @@
|
|
|
5203
5434
|
}
|
|
5204
5435
|
return ctor;
|
|
5205
5436
|
}
|
|
5206
|
-
/* version: 2.23.
|
|
5437
|
+
/* version: 2.23.2 */
|
|
5207
5438
|
|
|
5208
5439
|
/*
|
|
5209
5440
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5344,61 +5575,303 @@
|
|
|
5344
5575
|
* SPDX-License-Identifier: MIT
|
|
5345
5576
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5346
5577
|
*/
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
//
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
html = `<${wrapperTag}>${html}</${wrapperTag}>`;
|
|
5578
|
+
/**
|
|
5579
|
+
* A factory function that produces a renderer.
|
|
5580
|
+
* Renderer encapsulates operations that are required to render an LWC component into the underlying
|
|
5581
|
+
* runtime environment. In the case of @lwc/enigne-dom, it is meant to be used in a DOM environment.
|
|
5582
|
+
* Example usage:
|
|
5583
|
+
* import { renderer, rendererFactory } from 'lwc';
|
|
5584
|
+
* const customRenderer = rendererFactory(renderer);
|
|
5585
|
+
*
|
|
5586
|
+
* @param baseRenderer Either null or the base renderer imported from 'lwc'.
|
|
5587
|
+
*/
|
|
5588
|
+
function rendererFactory(baseRenderer) {
|
|
5589
|
+
// Util functions
|
|
5590
|
+
function assertInvariant(value, msg) {
|
|
5591
|
+
if (!value) {
|
|
5592
|
+
throw new Error(`Invariant Violation: ${msg}`);
|
|
5593
|
+
}
|
|
5594
|
+
}
|
|
5595
|
+
function isNull(obj) {
|
|
5596
|
+
return obj === null;
|
|
5597
|
+
}
|
|
5598
|
+
function isUndefined(obj) {
|
|
5599
|
+
return obj === undefined;
|
|
5600
|
+
}
|
|
5601
|
+
let getCustomElement;
|
|
5602
|
+
let defineCustomElement;
|
|
5603
|
+
let HTMLElementConstructor;
|
|
5604
|
+
function isCustomElementRegistryAvailable() {
|
|
5605
|
+
if (typeof customElements === 'undefined') {
|
|
5606
|
+
return false;
|
|
5607
|
+
}
|
|
5608
|
+
try {
|
|
5609
|
+
// dereference HTMLElement global because babel wraps globals in compat mode with a
|
|
5610
|
+
// _wrapNativeSuper()
|
|
5611
|
+
// This is a problem because LWCUpgradableElement extends renderer.HTMLElementExported which does not
|
|
5612
|
+
// get wrapped by babel.
|
|
5613
|
+
const HTMLElementAlias = HTMLElement;
|
|
5614
|
+
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
5615
|
+
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
5616
|
+
// which are not equipped to be initialized that way.
|
|
5617
|
+
class clazz extends HTMLElementAlias {
|
|
5388
5618
|
}
|
|
5619
|
+
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
5620
|
+
new clazz();
|
|
5621
|
+
return true;
|
|
5622
|
+
}
|
|
5623
|
+
catch (_a) {
|
|
5624
|
+
return false;
|
|
5389
5625
|
}
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5626
|
+
}
|
|
5627
|
+
if (isCustomElementRegistryAvailable()) {
|
|
5628
|
+
getCustomElement = customElements.get.bind(customElements);
|
|
5629
|
+
defineCustomElement = customElements.define.bind(customElements);
|
|
5630
|
+
HTMLElementConstructor = HTMLElement;
|
|
5631
|
+
}
|
|
5632
|
+
else {
|
|
5633
|
+
const registry = Object.create(null);
|
|
5634
|
+
const reverseRegistry = new WeakMap();
|
|
5635
|
+
defineCustomElement = function define(name, ctor) {
|
|
5636
|
+
if (name !== String.prototype.toLowerCase.call(name) || registry[name]) {
|
|
5637
|
+
throw new TypeError(`Invalid Registration`);
|
|
5398
5638
|
}
|
|
5639
|
+
registry[name] = ctor;
|
|
5640
|
+
reverseRegistry.set(ctor, name);
|
|
5641
|
+
};
|
|
5642
|
+
getCustomElement = function get(name) {
|
|
5643
|
+
return registry[name];
|
|
5644
|
+
};
|
|
5645
|
+
HTMLElementConstructor = function HTMLElement() {
|
|
5646
|
+
if (!(this instanceof HTMLElement)) {
|
|
5647
|
+
throw new TypeError(`Invalid Invocation`);
|
|
5648
|
+
}
|
|
5649
|
+
const { constructor } = this;
|
|
5650
|
+
const name = reverseRegistry.get(constructor);
|
|
5651
|
+
if (!name) {
|
|
5652
|
+
throw new TypeError(`Invalid Construction`);
|
|
5653
|
+
}
|
|
5654
|
+
const elm = document.createElement(name);
|
|
5655
|
+
Object.setPrototypeOf(elm, constructor.prototype);
|
|
5656
|
+
return elm;
|
|
5657
|
+
};
|
|
5658
|
+
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
5659
|
+
}
|
|
5660
|
+
function cloneNode(node, deep) {
|
|
5661
|
+
return node.cloneNode(deep);
|
|
5662
|
+
}
|
|
5663
|
+
function createElement(tagName, namespace) {
|
|
5664
|
+
return isUndefined(namespace)
|
|
5665
|
+
? document.createElement(tagName)
|
|
5666
|
+
: document.createElementNS(namespace, tagName);
|
|
5667
|
+
}
|
|
5668
|
+
function createText(content) {
|
|
5669
|
+
return document.createTextNode(content);
|
|
5670
|
+
}
|
|
5671
|
+
function createComment(content) {
|
|
5672
|
+
return document.createComment(content);
|
|
5673
|
+
}
|
|
5674
|
+
let createFragment;
|
|
5675
|
+
// IE11 lacks support for this feature
|
|
5676
|
+
const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === 'function';
|
|
5677
|
+
if (SUPPORTS_TEMPLATE) {
|
|
5678
|
+
// Parse the fragment HTML string into DOM
|
|
5679
|
+
createFragment = function (html) {
|
|
5680
|
+
const template = document.createElement('template');
|
|
5681
|
+
template.innerHTML = html;
|
|
5682
|
+
return template.content.firstChild;
|
|
5683
|
+
};
|
|
5684
|
+
}
|
|
5685
|
+
else {
|
|
5686
|
+
// In browsers that don't support <template> (e.g. IE11), we need to be careful to wrap elements like
|
|
5687
|
+
// <td> in the proper container elements (e.g. <tbody>), because otherwise they will be parsed as null.
|
|
5688
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L273-L280
|
|
5689
|
+
// With other elements added from:
|
|
5690
|
+
// https://github.com/sindresorhus/html-tags/blob/95dcdd5/index.js
|
|
5691
|
+
// Using the test:
|
|
5692
|
+
// document.createRange().createContextualFragment(`<${tag}></${tag}>`).firstChild === null
|
|
5693
|
+
// And omitting <html>, <head>, and <body> as these are not practical in an LWC component.
|
|
5694
|
+
const topLevelWrappingMap = {
|
|
5695
|
+
caption: ['table'],
|
|
5696
|
+
col: ['colgroup', 'table'],
|
|
5697
|
+
colgroup: ['table'],
|
|
5698
|
+
option: ['select'],
|
|
5699
|
+
tbody: ['table'],
|
|
5700
|
+
td: ['tr', 'tbody', 'table'],
|
|
5701
|
+
th: ['tr', 'tbody', 'table'],
|
|
5702
|
+
thead: ['table'],
|
|
5703
|
+
tfoot: ['table'],
|
|
5704
|
+
tr: ['tbody', 'table'],
|
|
5705
|
+
};
|
|
5706
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L282-L288
|
|
5707
|
+
const getTagName = function (text) {
|
|
5708
|
+
return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();
|
|
5709
|
+
};
|
|
5710
|
+
// Via https://github.com/webcomponents/polyfills/blob/ee1db33/packages/template/template.js#L295-L320
|
|
5711
|
+
createFragment = function (html) {
|
|
5712
|
+
const wrapperTags = topLevelWrappingMap[getTagName(html)];
|
|
5713
|
+
if (!isUndefined(wrapperTags)) {
|
|
5714
|
+
for (const wrapperTag of wrapperTags) {
|
|
5715
|
+
html = `<${wrapperTag}>${html}</${wrapperTag}>`;
|
|
5716
|
+
}
|
|
5717
|
+
}
|
|
5718
|
+
// For IE11, the document title must not be undefined, but it can be an empty string
|
|
5719
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument#browser_compatibility
|
|
5720
|
+
const doc = document.implementation.createHTMLDocument('');
|
|
5721
|
+
doc.body.innerHTML = html;
|
|
5722
|
+
let content = doc.body;
|
|
5723
|
+
if (!isUndefined(wrapperTags)) {
|
|
5724
|
+
for (let i = 0; i < wrapperTags.length; i++) {
|
|
5725
|
+
content = content.firstChild;
|
|
5726
|
+
}
|
|
5727
|
+
}
|
|
5728
|
+
return content.firstChild;
|
|
5729
|
+
};
|
|
5730
|
+
}
|
|
5731
|
+
function insert(node, parent, anchor) {
|
|
5732
|
+
parent.insertBefore(node, anchor);
|
|
5733
|
+
}
|
|
5734
|
+
function remove(node, parent) {
|
|
5735
|
+
parent.removeChild(node);
|
|
5736
|
+
}
|
|
5737
|
+
function nextSibling(node) {
|
|
5738
|
+
return node.nextSibling;
|
|
5739
|
+
}
|
|
5740
|
+
function attachShadow(element, options) {
|
|
5741
|
+
// `shadowRoot` will be non-null in two cases:
|
|
5742
|
+
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
5743
|
+
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
5744
|
+
// root component with customElement.define('c-app', Ctor)
|
|
5745
|
+
if (!isNull(element.shadowRoot)) {
|
|
5746
|
+
return element.shadowRoot;
|
|
5747
|
+
}
|
|
5748
|
+
return element.attachShadow(options);
|
|
5749
|
+
}
|
|
5750
|
+
function setText(node, content) {
|
|
5751
|
+
node.nodeValue = content;
|
|
5752
|
+
}
|
|
5753
|
+
function getProperty(node, key) {
|
|
5754
|
+
return node[key];
|
|
5755
|
+
}
|
|
5756
|
+
function setProperty(node, key, value) {
|
|
5757
|
+
node[key] = value;
|
|
5758
|
+
}
|
|
5759
|
+
function getAttribute(element, name, namespace) {
|
|
5760
|
+
return isUndefined(namespace)
|
|
5761
|
+
? element.getAttribute(name)
|
|
5762
|
+
: element.getAttributeNS(namespace, name);
|
|
5763
|
+
}
|
|
5764
|
+
function setAttribute(element, name, value, namespace) {
|
|
5765
|
+
return isUndefined(namespace)
|
|
5766
|
+
? element.setAttribute(name, value)
|
|
5767
|
+
: element.setAttributeNS(namespace, name, value);
|
|
5768
|
+
}
|
|
5769
|
+
function removeAttribute(element, name, namespace) {
|
|
5770
|
+
if (isUndefined(namespace)) {
|
|
5771
|
+
element.removeAttribute(name);
|
|
5399
5772
|
}
|
|
5400
|
-
|
|
5773
|
+
else {
|
|
5774
|
+
element.removeAttributeNS(namespace, name);
|
|
5775
|
+
}
|
|
5776
|
+
}
|
|
5777
|
+
function addEventListener(target, type, callback, options) {
|
|
5778
|
+
target.addEventListener(type, callback, options);
|
|
5779
|
+
}
|
|
5780
|
+
function removeEventListener(target, type, callback, options) {
|
|
5781
|
+
target.removeEventListener(type, callback, options);
|
|
5782
|
+
}
|
|
5783
|
+
function dispatchEvent(target, event) {
|
|
5784
|
+
return target.dispatchEvent(event);
|
|
5785
|
+
}
|
|
5786
|
+
function getClassList(element) {
|
|
5787
|
+
return element.classList;
|
|
5788
|
+
}
|
|
5789
|
+
function setCSSStyleProperty(element, name, value, important) {
|
|
5790
|
+
// TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
|
|
5791
|
+
// represent elements in the engine?
|
|
5792
|
+
element.style.setProperty(name, value, important ? 'important' : '');
|
|
5793
|
+
}
|
|
5794
|
+
function getBoundingClientRect(element) {
|
|
5795
|
+
return element.getBoundingClientRect();
|
|
5796
|
+
}
|
|
5797
|
+
function querySelector(element, selectors) {
|
|
5798
|
+
return element.querySelector(selectors);
|
|
5799
|
+
}
|
|
5800
|
+
function querySelectorAll(element, selectors) {
|
|
5801
|
+
return element.querySelectorAll(selectors);
|
|
5802
|
+
}
|
|
5803
|
+
function getElementsByTagName(element, tagNameOrWildCard) {
|
|
5804
|
+
return element.getElementsByTagName(tagNameOrWildCard);
|
|
5805
|
+
}
|
|
5806
|
+
function getElementsByClassName(element, names) {
|
|
5807
|
+
return element.getElementsByClassName(names);
|
|
5808
|
+
}
|
|
5809
|
+
function getChildren(element) {
|
|
5810
|
+
return element.children;
|
|
5811
|
+
}
|
|
5812
|
+
function getChildNodes(element) {
|
|
5813
|
+
return element.childNodes;
|
|
5814
|
+
}
|
|
5815
|
+
function getFirstChild(element) {
|
|
5816
|
+
return element.firstChild;
|
|
5817
|
+
}
|
|
5818
|
+
function getFirstElementChild(element) {
|
|
5819
|
+
return element.firstElementChild;
|
|
5820
|
+
}
|
|
5821
|
+
function getLastChild(element) {
|
|
5822
|
+
return element.lastChild;
|
|
5823
|
+
}
|
|
5824
|
+
function getLastElementChild(element) {
|
|
5825
|
+
return element.lastElementChild;
|
|
5826
|
+
}
|
|
5827
|
+
function isConnected(node) {
|
|
5828
|
+
return node.isConnected;
|
|
5829
|
+
}
|
|
5830
|
+
function assertInstanceOfHTMLElement(elm, msg) {
|
|
5831
|
+
assertInvariant(elm instanceof HTMLElement, msg);
|
|
5832
|
+
}
|
|
5833
|
+
const HTMLElementExported = HTMLElementConstructor;
|
|
5834
|
+
const renderer = {
|
|
5835
|
+
HTMLElementExported,
|
|
5836
|
+
insert,
|
|
5837
|
+
remove,
|
|
5838
|
+
cloneNode,
|
|
5839
|
+
createFragment,
|
|
5840
|
+
createElement,
|
|
5841
|
+
createText,
|
|
5842
|
+
createComment,
|
|
5843
|
+
nextSibling,
|
|
5844
|
+
attachShadow,
|
|
5845
|
+
getProperty,
|
|
5846
|
+
setProperty,
|
|
5847
|
+
setText,
|
|
5848
|
+
getAttribute,
|
|
5849
|
+
setAttribute,
|
|
5850
|
+
removeAttribute,
|
|
5851
|
+
addEventListener,
|
|
5852
|
+
removeEventListener,
|
|
5853
|
+
dispatchEvent,
|
|
5854
|
+
getClassList,
|
|
5855
|
+
setCSSStyleProperty,
|
|
5856
|
+
getBoundingClientRect,
|
|
5857
|
+
querySelector,
|
|
5858
|
+
querySelectorAll,
|
|
5859
|
+
getElementsByTagName,
|
|
5860
|
+
getElementsByClassName,
|
|
5861
|
+
getChildren,
|
|
5862
|
+
getChildNodes,
|
|
5863
|
+
getFirstChild,
|
|
5864
|
+
getFirstElementChild,
|
|
5865
|
+
getLastChild,
|
|
5866
|
+
getLastElementChild,
|
|
5867
|
+
isConnected,
|
|
5868
|
+
assertInstanceOfHTMLElement,
|
|
5869
|
+
defineCustomElement,
|
|
5870
|
+
getCustomElement,
|
|
5401
5871
|
};
|
|
5872
|
+
// Meant to inherit any properties passed via the base renderer as the argument to the factory.
|
|
5873
|
+
Object.setPrototypeOf(renderer, baseRenderer);
|
|
5874
|
+
return renderer;
|
|
5402
5875
|
}
|
|
5403
5876
|
|
|
5404
5877
|
/*
|
|
@@ -5407,225 +5880,21 @@
|
|
|
5407
5880
|
* SPDX-License-Identifier: MIT
|
|
5408
5881
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5409
5882
|
*/
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
// get wrapped by babel.
|
|
5422
|
-
const HTMLElementAlias = HTMLElement;
|
|
5423
|
-
// In case we use compat mode with a modern browser, the compat mode transformation
|
|
5424
|
-
// invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
|
|
5425
|
-
// which are not equipped to be initialized that way.
|
|
5426
|
-
class clazz extends HTMLElementAlias {
|
|
5427
|
-
}
|
|
5428
|
-
customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
|
|
5429
|
-
new clazz();
|
|
5430
|
-
return true;
|
|
5431
|
-
}
|
|
5432
|
-
catch (_a) {
|
|
5433
|
-
return false;
|
|
5434
|
-
}
|
|
5435
|
-
}
|
|
5436
|
-
if (isCustomElementRegistryAvailable()) {
|
|
5437
|
-
getCustomElement = customElements.get.bind(customElements);
|
|
5438
|
-
defineCustomElement = customElements.define.bind(customElements);
|
|
5439
|
-
HTMLElementConstructor = HTMLElement;
|
|
5440
|
-
}
|
|
5441
|
-
else {
|
|
5442
|
-
const registry = create(null);
|
|
5443
|
-
const reverseRegistry = new WeakMap();
|
|
5444
|
-
defineCustomElement = function define(name, ctor) {
|
|
5445
|
-
if (name !== StringToLowerCase.call(name) || registry[name]) {
|
|
5446
|
-
throw new TypeError(`Invalid Registration`);
|
|
5447
|
-
}
|
|
5448
|
-
registry[name] = ctor;
|
|
5449
|
-
reverseRegistry.set(ctor, name);
|
|
5450
|
-
};
|
|
5451
|
-
getCustomElement = function get(name) {
|
|
5452
|
-
return registry[name];
|
|
5453
|
-
};
|
|
5454
|
-
HTMLElementConstructor = function HTMLElement() {
|
|
5455
|
-
if (!(this instanceof HTMLElement)) {
|
|
5456
|
-
throw new TypeError(`Invalid Invocation`);
|
|
5457
|
-
}
|
|
5458
|
-
const { constructor } = this;
|
|
5459
|
-
const name = reverseRegistry.get(constructor);
|
|
5460
|
-
if (!name) {
|
|
5461
|
-
throw new TypeError(`Invalid Construction`);
|
|
5462
|
-
}
|
|
5463
|
-
const elm = document.createElement(name);
|
|
5464
|
-
setPrototypeOf(elm, constructor.prototype);
|
|
5465
|
-
return elm;
|
|
5466
|
-
};
|
|
5467
|
-
HTMLElementConstructor.prototype = HTMLElement.prototype;
|
|
5468
|
-
}
|
|
5469
|
-
const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
5470
|
-
const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
|
|
5471
|
-
function cloneNode(node, deep) {
|
|
5472
|
-
return node.cloneNode(deep);
|
|
5473
|
-
}
|
|
5474
|
-
function createElement$1(tagName, namespace) {
|
|
5475
|
-
return isUndefined$1(namespace)
|
|
5476
|
-
? document.createElement(tagName)
|
|
5477
|
-
: document.createElementNS(namespace, tagName);
|
|
5478
|
-
}
|
|
5479
|
-
function createText(content) {
|
|
5480
|
-
return document.createTextNode(content);
|
|
5481
|
-
}
|
|
5482
|
-
function createComment(content) {
|
|
5483
|
-
return document.createComment(content);
|
|
5484
|
-
}
|
|
5485
|
-
function insert(node, parent, anchor) {
|
|
5486
|
-
parent.insertBefore(node, anchor);
|
|
5487
|
-
}
|
|
5488
|
-
function remove(node, parent) {
|
|
5489
|
-
parent.removeChild(node);
|
|
5490
|
-
}
|
|
5491
|
-
function nextSibling(node) {
|
|
5492
|
-
return node.nextSibling;
|
|
5493
|
-
}
|
|
5494
|
-
function attachShadow(element, options) {
|
|
5495
|
-
// `shadowRoot` will be non-null in two cases:
|
|
5496
|
-
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
|
|
5497
|
-
// 2. when a webapp author places <c-app> in their static HTML and mounts their
|
|
5498
|
-
// root component with customElement.define('c-app', Ctor)
|
|
5499
|
-
if (!isNull(element.shadowRoot)) {
|
|
5500
|
-
return element.shadowRoot;
|
|
5501
|
-
}
|
|
5502
|
-
return element.attachShadow(options);
|
|
5503
|
-
}
|
|
5504
|
-
function setText(node, content) {
|
|
5505
|
-
node.nodeValue = content;
|
|
5506
|
-
}
|
|
5507
|
-
function getProperty(node, key) {
|
|
5508
|
-
return node[key];
|
|
5509
|
-
}
|
|
5510
|
-
function setProperty(node, key, value) {
|
|
5511
|
-
node[key] = value;
|
|
5512
|
-
}
|
|
5513
|
-
function getAttribute(element, name, namespace) {
|
|
5514
|
-
return isUndefined$1(namespace)
|
|
5515
|
-
? element.getAttribute(name)
|
|
5516
|
-
: element.getAttributeNS(namespace, name);
|
|
5517
|
-
}
|
|
5518
|
-
function setAttribute(element, name, value, namespace) {
|
|
5519
|
-
return isUndefined$1(namespace)
|
|
5520
|
-
? element.setAttribute(name, value)
|
|
5521
|
-
: element.setAttributeNS(namespace, name, value);
|
|
5522
|
-
}
|
|
5523
|
-
function removeAttribute(element, name, namespace) {
|
|
5524
|
-
if (isUndefined$1(namespace)) {
|
|
5525
|
-
element.removeAttribute(name);
|
|
5526
|
-
}
|
|
5527
|
-
else {
|
|
5528
|
-
element.removeAttributeNS(namespace, name);
|
|
5529
|
-
}
|
|
5530
|
-
}
|
|
5531
|
-
function addEventListener(target, type, callback, options) {
|
|
5532
|
-
target.addEventListener(type, callback, options);
|
|
5533
|
-
}
|
|
5534
|
-
function removeEventListener(target, type, callback, options) {
|
|
5535
|
-
target.removeEventListener(type, callback, options);
|
|
5536
|
-
}
|
|
5537
|
-
function dispatchEvent(target, event) {
|
|
5538
|
-
return target.dispatchEvent(event);
|
|
5539
|
-
}
|
|
5540
|
-
function getClassList(element) {
|
|
5541
|
-
return element.classList;
|
|
5542
|
-
}
|
|
5543
|
-
function setCSSStyleProperty(element, name, value, important) {
|
|
5544
|
-
// TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
|
|
5545
|
-
// represent elements in the engine?
|
|
5546
|
-
element.style.setProperty(name, value, important ? 'important' : '');
|
|
5547
|
-
}
|
|
5548
|
-
function getBoundingClientRect(element) {
|
|
5549
|
-
return element.getBoundingClientRect();
|
|
5550
|
-
}
|
|
5551
|
-
function querySelector(element, selectors) {
|
|
5552
|
-
return element.querySelector(selectors);
|
|
5553
|
-
}
|
|
5554
|
-
function querySelectorAll(element, selectors) {
|
|
5555
|
-
return element.querySelectorAll(selectors);
|
|
5556
|
-
}
|
|
5557
|
-
function getElementsByTagName(element, tagNameOrWildCard) {
|
|
5558
|
-
return element.getElementsByTagName(tagNameOrWildCard);
|
|
5559
|
-
}
|
|
5560
|
-
function getElementsByClassName(element, names) {
|
|
5561
|
-
return element.getElementsByClassName(names);
|
|
5562
|
-
}
|
|
5563
|
-
function getChildren(element) {
|
|
5564
|
-
return element.children;
|
|
5565
|
-
}
|
|
5566
|
-
function getChildNodes(element) {
|
|
5567
|
-
return element.childNodes;
|
|
5568
|
-
}
|
|
5569
|
-
function getFirstChild(element) {
|
|
5570
|
-
return element.firstChild;
|
|
5571
|
-
}
|
|
5572
|
-
function getFirstElementChild(element) {
|
|
5573
|
-
return element.firstElementChild;
|
|
5574
|
-
}
|
|
5575
|
-
function getLastChild(element) {
|
|
5576
|
-
return element.lastChild;
|
|
5577
|
-
}
|
|
5578
|
-
function getLastElementChild(element) {
|
|
5579
|
-
return element.lastElementChild;
|
|
5580
|
-
}
|
|
5581
|
-
function isConnected(node) {
|
|
5582
|
-
return node.isConnected;
|
|
5583
|
-
}
|
|
5584
|
-
function assertInstanceOfHTMLElement(elm, msg) {
|
|
5585
|
-
assert.invariant(elm instanceof HTMLElement, msg);
|
|
5586
|
-
}
|
|
5587
|
-
const HTMLElementExported = HTMLElementConstructor;
|
|
5588
|
-
const renderer = {
|
|
5589
|
-
isNativeShadowDefined,
|
|
5590
|
-
isSyntheticShadowDefined,
|
|
5591
|
-
HTMLElementExported,
|
|
5592
|
-
insert,
|
|
5593
|
-
remove,
|
|
5594
|
-
cloneNode,
|
|
5595
|
-
createFragment,
|
|
5596
|
-
createElement: createElement$1,
|
|
5597
|
-
createText,
|
|
5598
|
-
createComment,
|
|
5599
|
-
nextSibling,
|
|
5600
|
-
attachShadow,
|
|
5601
|
-
getProperty,
|
|
5602
|
-
setProperty,
|
|
5603
|
-
setText,
|
|
5604
|
-
getAttribute,
|
|
5605
|
-
setAttribute,
|
|
5606
|
-
removeAttribute,
|
|
5607
|
-
addEventListener,
|
|
5608
|
-
removeEventListener,
|
|
5609
|
-
dispatchEvent,
|
|
5610
|
-
getClassList,
|
|
5611
|
-
setCSSStyleProperty,
|
|
5612
|
-
getBoundingClientRect,
|
|
5613
|
-
querySelector,
|
|
5614
|
-
querySelectorAll,
|
|
5615
|
-
getElementsByTagName,
|
|
5616
|
-
getElementsByClassName,
|
|
5617
|
-
getChildren,
|
|
5618
|
-
getChildNodes,
|
|
5619
|
-
getFirstChild,
|
|
5620
|
-
getFirstElementChild,
|
|
5621
|
-
getLastChild,
|
|
5622
|
-
getLastElementChild,
|
|
5623
|
-
isConnected,
|
|
5883
|
+
/**
|
|
5884
|
+
* The base renderer that will be used by engine-core.
|
|
5885
|
+
* This will be used for DOM operations when lwc is running in a browser environment.
|
|
5886
|
+
*/
|
|
5887
|
+
const renderer = assign(
|
|
5888
|
+
// The base renderer will invoke the factory with null and assign additional properties that are
|
|
5889
|
+
// shared across renderers
|
|
5890
|
+
rendererFactory(null),
|
|
5891
|
+
// Properties that are either not required to be sandboxed or rely on a globally shared information
|
|
5892
|
+
{
|
|
5893
|
+
// insertStyleSheet implementation shares a global cache of stylesheet data
|
|
5624
5894
|
insertStylesheet,
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
};
|
|
5895
|
+
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
5896
|
+
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
5897
|
+
});
|
|
5629
5898
|
|
|
5630
5899
|
/*
|
|
5631
5900
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5756,41 +6025,57 @@
|
|
|
5756
6025
|
* SPDX-License-Identifier: MIT
|
|
5757
6026
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5758
6027
|
*/
|
|
5759
|
-
// TODO [#2472]: Remove this workaround when appropriate.
|
|
5760
6028
|
// eslint-disable-next-line @lwc/lwc-internal/no-global-node
|
|
6029
|
+
|
|
5761
6030
|
const _Node$1 = Node;
|
|
5762
6031
|
const ConnectingSlot = new WeakMap();
|
|
5763
6032
|
const DisconnectingSlot = new WeakMap();
|
|
6033
|
+
|
|
5764
6034
|
function callNodeSlot(node, slot) {
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
6035
|
+
|
|
6036
|
+
const fn = slot.get(node);
|
|
6037
|
+
|
|
6038
|
+
if (!isUndefined$1(fn)) {
|
|
6039
|
+
fn(node);
|
|
6040
|
+
}
|
|
6041
|
+
|
|
6042
|
+
return node; // for convenience
|
|
5770
6043
|
}
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
6044
|
+
|
|
6045
|
+
if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
6046
|
+
// Monkey patching Node methods to be able to detect the insertions and removal of root elements
|
|
6047
|
+
// created via createElement.
|
|
6048
|
+
const {
|
|
6049
|
+
appendChild,
|
|
6050
|
+
insertBefore,
|
|
6051
|
+
removeChild,
|
|
6052
|
+
replaceChild
|
|
6053
|
+
} = _Node$1.prototype;
|
|
6054
|
+
assign(_Node$1.prototype, {
|
|
5775
6055
|
appendChild(newChild) {
|
|
5776
|
-
|
|
5777
|
-
|
|
6056
|
+
const appendedNode = appendChild.call(this, newChild);
|
|
6057
|
+
return callNodeSlot(appendedNode, ConnectingSlot);
|
|
5778
6058
|
},
|
|
6059
|
+
|
|
5779
6060
|
insertBefore(newChild, referenceNode) {
|
|
5780
|
-
|
|
5781
|
-
|
|
6061
|
+
const insertedNode = insertBefore.call(this, newChild, referenceNode);
|
|
6062
|
+
return callNodeSlot(insertedNode, ConnectingSlot);
|
|
5782
6063
|
},
|
|
6064
|
+
|
|
5783
6065
|
removeChild(oldChild) {
|
|
5784
|
-
|
|
5785
|
-
|
|
6066
|
+
const removedNode = removeChild.call(this, oldChild);
|
|
6067
|
+
return callNodeSlot(removedNode, DisconnectingSlot);
|
|
5786
6068
|
},
|
|
6069
|
+
|
|
5787
6070
|
replaceChild(newChild, oldChild) {
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
}
|
|
5793
|
-
|
|
6071
|
+
const replacedNode = replaceChild.call(this, newChild, oldChild);
|
|
6072
|
+
callNodeSlot(replacedNode, DisconnectingSlot);
|
|
6073
|
+
callNodeSlot(newChild, ConnectingSlot);
|
|
6074
|
+
return replacedNode;
|
|
6075
|
+
}
|
|
6076
|
+
|
|
6077
|
+
});
|
|
6078
|
+
}
|
|
5794
6079
|
/**
|
|
5795
6080
|
* EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
|
|
5796
6081
|
* difference that in the options, you can pass the `is` property set to a Constructor instead of
|
|
@@ -5802,38 +6087,50 @@
|
|
|
5802
6087
|
* const el = createElement('x-foo', { is: FooCtor });
|
|
5803
6088
|
* ```
|
|
5804
6089
|
*/
|
|
6090
|
+
|
|
6091
|
+
|
|
5805
6092
|
function createElement(sel, options) {
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
6093
|
+
if (!isObject(options) || isNull(options)) {
|
|
6094
|
+
throw new TypeError(`"createElement" function expects an object as second parameter but received "${toString$1(options)}".`);
|
|
6095
|
+
}
|
|
6096
|
+
|
|
6097
|
+
const Ctor = options.is;
|
|
6098
|
+
|
|
6099
|
+
if (!isFunction$1(Ctor)) {
|
|
6100
|
+
throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
|
|
6101
|
+
}
|
|
6102
|
+
|
|
6103
|
+
const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
|
|
6104
|
+
let wasComponentUpgraded = false; // the custom element from the registry is expecting an upgrade callback
|
|
6105
|
+
|
|
6106
|
+
/**
|
|
6107
|
+
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
6108
|
+
* with a callback as the first argument, we could implement a more advanced
|
|
6109
|
+
* mechanism that only passes that argument if the constructor is known to be
|
|
6110
|
+
* an upgradable custom element.
|
|
6111
|
+
*/
|
|
6112
|
+
|
|
6113
|
+
const element = new UpgradableConstructor(elm => {
|
|
6114
|
+
createVM(elm, Ctor, renderer, {
|
|
6115
|
+
tagName: sel,
|
|
6116
|
+
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
6117
|
+
owner: null
|
|
5831
6118
|
});
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
6119
|
+
|
|
6120
|
+
if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
6121
|
+
ConnectingSlot.set(elm, connectRootElement);
|
|
6122
|
+
DisconnectingSlot.set(elm, disconnectRootElement);
|
|
5835
6123
|
}
|
|
5836
|
-
|
|
6124
|
+
|
|
6125
|
+
wasComponentUpgraded = true;
|
|
6126
|
+
});
|
|
6127
|
+
|
|
6128
|
+
if (!wasComponentUpgraded) {
|
|
6129
|
+
/* eslint-disable-next-line no-console */
|
|
6130
|
+
console.error(`Unexpected tag name "${sel}". This name is a registered custom element, preventing LWC to upgrade the element.`);
|
|
6131
|
+
}
|
|
6132
|
+
|
|
6133
|
+
return element;
|
|
5837
6134
|
}
|
|
5838
6135
|
|
|
5839
6136
|
/*
|
|
@@ -5867,7 +6164,7 @@
|
|
|
5867
6164
|
}
|
|
5868
6165
|
// TODO [#1252]: Old behavior that is still used by some pieces of the platform. Manually
|
|
5869
6166
|
// inserted nodes without the `lwc:dom=manual` directive will be considered as global elements.
|
|
5870
|
-
return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
|
|
6167
|
+
return renderer.isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
|
|
5871
6168
|
}
|
|
5872
6169
|
|
|
5873
6170
|
/*
|
|
@@ -5904,7 +6201,7 @@
|
|
|
5904
6201
|
});
|
|
5905
6202
|
freeze(LightningElement);
|
|
5906
6203
|
seal(LightningElement.prototype);
|
|
5907
|
-
/* version: 2.23.
|
|
6204
|
+
/* version: 2.23.2 */
|
|
5908
6205
|
|
|
5909
6206
|
exports.LightningElement = LightningElement;
|
|
5910
6207
|
exports.__unstable__ProfilerControl = profilerControl;
|
|
@@ -5926,6 +6223,7 @@
|
|
|
5926
6223
|
exports.registerDecorators = registerDecorators;
|
|
5927
6224
|
exports.registerTemplate = registerTemplate;
|
|
5928
6225
|
exports.renderer = renderer;
|
|
6226
|
+
exports.rendererFactory = rendererFactory;
|
|
5929
6227
|
exports.sanitizeAttribute = sanitizeAttribute;
|
|
5930
6228
|
exports.setFeatureFlag = setFeatureFlag;
|
|
5931
6229
|
exports.setFeatureFlagForTest = setFeatureFlagForTest;
|