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