@lwc/engine-core 2.28.1 → 2.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-core.cjs.js +219 -636
- package/dist/engine-core.js +219 -636
- package/package.json +3 -3
- package/types/framework/vm.d.ts +3 -0
package/dist/engine-core.cjs.js
CHANGED
|
@@ -12,16 +12,14 @@ var shared = require('@lwc/shared');
|
|
|
12
12
|
* SPDX-License-Identifier: MIT
|
|
13
13
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
14
14
|
*/
|
|
15
|
+
// Only used in LWC's Karma tests
|
|
15
16
|
// @ts-ignore
|
|
16
|
-
|
|
17
17
|
if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
|
|
18
18
|
window.addEventListener('test-dummy-flag', () => {
|
|
19
19
|
let hasFlag = false;
|
|
20
|
-
|
|
21
20
|
if (features.lwcRuntimeFlags.DUMMY_TEST_FLAG) {
|
|
22
21
|
hasFlag = true;
|
|
23
22
|
}
|
|
24
|
-
|
|
25
23
|
window.dispatchEvent(new CustomEvent('has-dummy-flag', {
|
|
26
24
|
detail: {
|
|
27
25
|
package: '@lwc/engine-core',
|
|
@@ -1884,39 +1882,31 @@ function api$1() {
|
|
|
1884
1882
|
if (process.env.NODE_ENV !== 'production') {
|
|
1885
1883
|
shared.assert.fail(`@api decorator can only be used as a decorator function.`);
|
|
1886
1884
|
}
|
|
1887
|
-
|
|
1888
1885
|
throw new Error();
|
|
1889
1886
|
}
|
|
1890
1887
|
function createPublicPropertyDescriptor(key) {
|
|
1891
1888
|
return {
|
|
1892
1889
|
get() {
|
|
1893
1890
|
const vm = getAssociatedVM(this);
|
|
1894
|
-
|
|
1895
1891
|
if (isBeingConstructed(vm)) {
|
|
1896
1892
|
if (process.env.NODE_ENV !== 'production') {
|
|
1897
1893
|
logError(`Can’t read the value of property \`${shared.toString(key)}\` from the constructor because the owner component hasn’t set the value yet. Instead, use the constructor to set a default value for the property.`, vm);
|
|
1898
1894
|
}
|
|
1899
|
-
|
|
1900
1895
|
return;
|
|
1901
1896
|
}
|
|
1902
|
-
|
|
1903
1897
|
componentValueObserved(vm, key);
|
|
1904
1898
|
return vm.cmpProps[key];
|
|
1905
1899
|
},
|
|
1906
|
-
|
|
1907
1900
|
set(newValue) {
|
|
1908
1901
|
const vm = getAssociatedVM(this);
|
|
1909
|
-
|
|
1910
1902
|
if (process.env.NODE_ENV !== 'production') {
|
|
1911
1903
|
const vmBeingRendered = getVMBeingRendered();
|
|
1912
1904
|
shared.assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${shared.toString(key)}`);
|
|
1913
1905
|
shared.assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${shared.toString(key)}`);
|
|
1914
1906
|
}
|
|
1915
|
-
|
|
1916
1907
|
vm.cmpProps[key] = newValue;
|
|
1917
1908
|
componentValueMutated(vm, key);
|
|
1918
1909
|
},
|
|
1919
|
-
|
|
1920
1910
|
enumerable: true,
|
|
1921
1911
|
configurable: true
|
|
1922
1912
|
};
|
|
@@ -1928,46 +1918,37 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
1928
1918
|
enumerable,
|
|
1929
1919
|
configurable
|
|
1930
1920
|
} = descriptor;
|
|
1931
|
-
|
|
1932
1921
|
if (!shared.isFunction(get)) {
|
|
1933
1922
|
if (process.env.NODE_ENV !== 'production') {
|
|
1934
1923
|
shared.assert.invariant(shared.isFunction(get), `Invalid compiler output for public accessor ${shared.toString(key)} decorated with @api`);
|
|
1935
1924
|
}
|
|
1936
|
-
|
|
1937
1925
|
throw new Error();
|
|
1938
1926
|
}
|
|
1939
|
-
|
|
1940
1927
|
return {
|
|
1941
1928
|
get() {
|
|
1942
1929
|
if (process.env.NODE_ENV !== 'production') {
|
|
1943
1930
|
// Assert that the this value is an actual Component with an associated VM.
|
|
1944
1931
|
getAssociatedVM(this);
|
|
1945
1932
|
}
|
|
1946
|
-
|
|
1947
1933
|
return get.call(this);
|
|
1948
1934
|
},
|
|
1949
|
-
|
|
1950
1935
|
set(newValue) {
|
|
1951
1936
|
const vm = getAssociatedVM(this);
|
|
1952
|
-
|
|
1953
1937
|
if (process.env.NODE_ENV !== 'production') {
|
|
1954
1938
|
const vmBeingRendered = getVMBeingRendered();
|
|
1955
1939
|
shared.assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${shared.toString(key)}`);
|
|
1956
1940
|
shared.assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${shared.toString(key)}`);
|
|
1957
1941
|
}
|
|
1958
|
-
|
|
1959
1942
|
if (set) {
|
|
1960
1943
|
if (features.lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
|
|
1961
1944
|
let ro = vm.oar[key];
|
|
1962
|
-
|
|
1963
1945
|
if (shared.isUndefined(ro)) {
|
|
1964
1946
|
ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
|
|
1965
|
-
}
|
|
1947
|
+
}
|
|
1948
|
+
// every time we invoke this setter from outside (through this wrapper setter)
|
|
1966
1949
|
// we should reset the value and then debounce just in case there is a pending
|
|
1967
1950
|
// invocation the next tick that is not longer relevant since the value is changing
|
|
1968
1951
|
// from outside.
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
1952
|
ro.reset(newValue);
|
|
1972
1953
|
ro.observe(() => {
|
|
1973
1954
|
set.call(this, newValue);
|
|
@@ -1979,7 +1960,6 @@ function createPublicAccessorDescriptor(key, descriptor) {
|
|
|
1979
1960
|
shared.assert.fail(`Invalid attempt to set a new value for property ${shared.toString(key)} of ${vm} that does not has a setter decorated with @api.`);
|
|
1980
1961
|
}
|
|
1981
1962
|
},
|
|
1982
|
-
|
|
1983
1963
|
enumerable,
|
|
1984
1964
|
configurable
|
|
1985
1965
|
};
|
|
@@ -2944,11 +2924,9 @@ function getComponentDef(Ctor) {
|
|
|
2944
2924
|
* SPDX-License-Identifier: MIT
|
|
2945
2925
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
2946
2926
|
*/
|
|
2947
|
-
|
|
2948
2927
|
function makeHostToken(token) {
|
|
2949
2928
|
return `${token}-host`;
|
|
2950
2929
|
}
|
|
2951
|
-
|
|
2952
2930
|
function createInlineStyleVNode(content) {
|
|
2953
2931
|
return api.h('style', {
|
|
2954
2932
|
key: 'style',
|
|
@@ -2957,7 +2935,6 @@ function createInlineStyleVNode(content) {
|
|
|
2957
2935
|
}
|
|
2958
2936
|
}, [api.t(content)]);
|
|
2959
2937
|
}
|
|
2960
|
-
|
|
2961
2938
|
function updateStylesheetToken(vm, template) {
|
|
2962
2939
|
const {
|
|
2963
2940
|
elm,
|
|
@@ -2974,112 +2951,81 @@ function updateStylesheetToken(vm, template) {
|
|
|
2974
2951
|
stylesheets: newStylesheets,
|
|
2975
2952
|
stylesheetToken: newStylesheetToken
|
|
2976
2953
|
} = template;
|
|
2977
|
-
const isSyntheticShadow = renderMode === 1
|
|
2978
|
-
/* RenderMode.Shadow */
|
|
2979
|
-
&& shadowMode === 1
|
|
2980
|
-
/* ShadowMode.Synthetic */
|
|
2981
|
-
;
|
|
2954
|
+
const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
2982
2955
|
const {
|
|
2983
2956
|
hasScopedStyles
|
|
2984
2957
|
} = context;
|
|
2985
2958
|
let newToken;
|
|
2986
2959
|
let newHasTokenInClass;
|
|
2987
|
-
let newHasTokenInAttribute;
|
|
2988
|
-
|
|
2960
|
+
let newHasTokenInAttribute;
|
|
2961
|
+
// Reset the styling token applied to the host element.
|
|
2989
2962
|
const {
|
|
2990
2963
|
stylesheetToken: oldToken,
|
|
2991
2964
|
hasTokenInClass: oldHasTokenInClass,
|
|
2992
2965
|
hasTokenInAttribute: oldHasTokenInAttribute
|
|
2993
2966
|
} = context;
|
|
2994
|
-
|
|
2995
2967
|
if (!shared.isUndefined(oldToken)) {
|
|
2996
2968
|
if (oldHasTokenInClass) {
|
|
2997
2969
|
getClassList(elm).remove(makeHostToken(oldToken));
|
|
2998
2970
|
}
|
|
2999
|
-
|
|
3000
2971
|
if (oldHasTokenInAttribute) {
|
|
3001
2972
|
removeAttribute(elm, makeHostToken(oldToken));
|
|
3002
2973
|
}
|
|
3003
|
-
}
|
|
2974
|
+
}
|
|
2975
|
+
// Apply the new template styling token to the host element, if the new template has any
|
|
3004
2976
|
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
2977
|
if (!shared.isUndefined(newStylesheets) && newStylesheets.length !== 0) {
|
|
3008
2978
|
newToken = newStylesheetToken;
|
|
3009
|
-
}
|
|
3010
|
-
|
|
3011
|
-
|
|
2979
|
+
}
|
|
2980
|
+
// Set the new styling token on the host element
|
|
3012
2981
|
if (!shared.isUndefined(newToken)) {
|
|
3013
2982
|
if (hasScopedStyles) {
|
|
3014
2983
|
getClassList(elm).add(makeHostToken(newToken));
|
|
3015
2984
|
newHasTokenInClass = true;
|
|
3016
2985
|
}
|
|
3017
|
-
|
|
3018
2986
|
if (isSyntheticShadow) {
|
|
3019
2987
|
setAttribute(elm, makeHostToken(newToken), '');
|
|
3020
2988
|
newHasTokenInAttribute = true;
|
|
3021
2989
|
}
|
|
3022
|
-
}
|
|
3023
|
-
|
|
3024
|
-
|
|
2990
|
+
}
|
|
2991
|
+
// Update the styling tokens present on the context object.
|
|
3025
2992
|
context.stylesheetToken = newToken;
|
|
3026
2993
|
context.hasTokenInClass = newHasTokenInClass;
|
|
3027
2994
|
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
3028
2995
|
}
|
|
3029
|
-
|
|
3030
2996
|
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
3031
2997
|
const content = [];
|
|
3032
2998
|
let root;
|
|
3033
|
-
|
|
3034
2999
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
3035
3000
|
let stylesheet = stylesheets[i];
|
|
3036
|
-
|
|
3037
3001
|
if (shared.isArray(stylesheet)) {
|
|
3038
3002
|
shared.ArrayPush.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
3039
3003
|
} else {
|
|
3040
3004
|
if (process.env.NODE_ENV !== 'production') {
|
|
3041
3005
|
// Check for compiler version mismatch in dev mode only
|
|
3042
|
-
checkVersionMismatch(stylesheet, 'stylesheet');
|
|
3006
|
+
checkVersionMismatch(stylesheet, 'stylesheet');
|
|
3007
|
+
// in dev-mode, we support hot swapping of stylesheet, which means that
|
|
3043
3008
|
// the component instance might be attempting to use an old version of
|
|
3044
3009
|
// the stylesheet, while internally, we have a replacement for it.
|
|
3045
|
-
|
|
3046
3010
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
3047
3011
|
}
|
|
3048
|
-
|
|
3049
3012
|
const isScopedCss = stylesheet[shared.KEY__SCOPED_CSS];
|
|
3050
|
-
|
|
3051
3013
|
if (features.lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS) {
|
|
3052
|
-
if (!isScopedCss && vm.renderMode === 0
|
|
3053
|
-
/* RenderMode.Light */
|
|
3054
|
-
) {
|
|
3014
|
+
if (!isScopedCss && vm.renderMode === 0 /* RenderMode.Light */) {
|
|
3055
3015
|
logError('Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).');
|
|
3056
3016
|
continue;
|
|
3057
3017
|
}
|
|
3058
|
-
}
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
/* ShadowMode.Synthetic */
|
|
3063
|
-
&& vm.renderMode === 1
|
|
3064
|
-
/* RenderMode.Shadow */
|
|
3065
|
-
? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
3018
|
+
}
|
|
3019
|
+
// Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
3020
|
+
const scopeToken = isScopedCss || vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */ ? stylesheetToken : undefined;
|
|
3021
|
+
// Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
3066
3022
|
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
/* RenderMode.Light */
|
|
3070
|
-
? !isScopedCss : vm.shadowMode === 0
|
|
3071
|
-
/* ShadowMode.Native */
|
|
3072
|
-
; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
3023
|
+
const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */ ? !isScopedCss : vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
3024
|
+
// Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
|
|
3073
3025
|
// we use an attribute selector on the host to simulate :dir().
|
|
3074
|
-
|
|
3075
3026
|
let useNativeDirPseudoclass;
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
/* RenderMode.Shadow */
|
|
3079
|
-
) {
|
|
3080
|
-
useNativeDirPseudoclass = vm.shadowMode === 0
|
|
3081
|
-
/* ShadowMode.Native */
|
|
3082
|
-
;
|
|
3027
|
+
if (vm.renderMode === 1 /* RenderMode.Shadow */) {
|
|
3028
|
+
useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
|
|
3083
3029
|
} else {
|
|
3084
3030
|
// Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
|
|
3085
3031
|
// At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
|
|
@@ -3087,48 +3033,36 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
|
3087
3033
|
// Only calculate the root once as necessary
|
|
3088
3034
|
root = getNearestShadowComponent(vm);
|
|
3089
3035
|
}
|
|
3090
|
-
|
|
3091
|
-
useNativeDirPseudoclass = shared.isNull(root) || root.shadowMode === 0
|
|
3092
|
-
/* ShadowMode.Native */
|
|
3093
|
-
;
|
|
3036
|
+
useNativeDirPseudoclass = shared.isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
|
|
3094
3037
|
}
|
|
3095
3038
|
|
|
3096
3039
|
shared.ArrayPush.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
3097
3040
|
}
|
|
3098
3041
|
}
|
|
3099
|
-
|
|
3100
3042
|
return content;
|
|
3101
3043
|
}
|
|
3102
|
-
|
|
3103
3044
|
function getStylesheetsContent(vm, template) {
|
|
3104
3045
|
const {
|
|
3105
3046
|
stylesheets,
|
|
3106
3047
|
stylesheetToken
|
|
3107
3048
|
} = template;
|
|
3108
3049
|
let content = [];
|
|
3109
|
-
|
|
3110
3050
|
if (!shared.isUndefined(stylesheets) && stylesheets.length !== 0) {
|
|
3111
3051
|
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
3112
3052
|
}
|
|
3113
|
-
|
|
3114
3053
|
return content;
|
|
3115
|
-
}
|
|
3054
|
+
}
|
|
3055
|
+
// It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
3116
3056
|
// perf testing has not shown it to be a huge improvement yet:
|
|
3117
3057
|
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
3118
|
-
|
|
3119
3058
|
function getNearestShadowComponent(vm) {
|
|
3120
3059
|
let owner = vm;
|
|
3121
|
-
|
|
3122
3060
|
while (!shared.isNull(owner)) {
|
|
3123
|
-
if (owner.renderMode === 1
|
|
3124
|
-
/* RenderMode.Shadow */
|
|
3125
|
-
) {
|
|
3061
|
+
if (owner.renderMode === 1 /* RenderMode.Shadow */) {
|
|
3126
3062
|
return owner;
|
|
3127
3063
|
}
|
|
3128
|
-
|
|
3129
3064
|
owner = owner.owner;
|
|
3130
3065
|
}
|
|
3131
|
-
|
|
3132
3066
|
return owner;
|
|
3133
3067
|
}
|
|
3134
3068
|
/**
|
|
@@ -3136,8 +3070,6 @@ function getNearestShadowComponent(vm) {
|
|
|
3136
3070
|
* this returns the unique token for that scoped stylesheet. Otherwise
|
|
3137
3071
|
* it returns null.
|
|
3138
3072
|
*/
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
3073
|
function getScopeTokenClass(owner) {
|
|
3142
3074
|
const {
|
|
3143
3075
|
cmpTemplate,
|
|
@@ -3151,7 +3083,6 @@ function getScopeTokenClass(owner) {
|
|
|
3151
3083
|
*
|
|
3152
3084
|
* A host style token is applied to the component if scoped styles are used.
|
|
3153
3085
|
*/
|
|
3154
|
-
|
|
3155
3086
|
function getStylesheetTokenHost(vnode) {
|
|
3156
3087
|
const {
|
|
3157
3088
|
template
|
|
@@ -3161,21 +3092,15 @@ function getStylesheetTokenHost(vnode) {
|
|
|
3161
3092
|
} = template;
|
|
3162
3093
|
return !shared.isUndefined(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
|
|
3163
3094
|
}
|
|
3164
|
-
|
|
3165
3095
|
function getNearestNativeShadowComponent(vm) {
|
|
3166
3096
|
const owner = getNearestShadowComponent(vm);
|
|
3167
|
-
|
|
3168
|
-
if (!shared.isNull(owner) && owner.shadowMode === 1
|
|
3169
|
-
/* ShadowMode.Synthetic */
|
|
3170
|
-
) {
|
|
3097
|
+
if (!shared.isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3171
3098
|
// Synthetic-within-native is impossible. So if the nearest shadow component is
|
|
3172
3099
|
// synthetic, we know we won't find a native component if we go any further.
|
|
3173
3100
|
return null;
|
|
3174
3101
|
}
|
|
3175
|
-
|
|
3176
3102
|
return owner;
|
|
3177
3103
|
}
|
|
3178
|
-
|
|
3179
3104
|
function createStylesheet(vm, stylesheets) {
|
|
3180
3105
|
const {
|
|
3181
3106
|
renderMode,
|
|
@@ -3184,12 +3109,7 @@ function createStylesheet(vm, stylesheets) {
|
|
|
3184
3109
|
insertStylesheet
|
|
3185
3110
|
}
|
|
3186
3111
|
} = vm;
|
|
3187
|
-
|
|
3188
|
-
if (renderMode === 1
|
|
3189
|
-
/* RenderMode.Shadow */
|
|
3190
|
-
&& shadowMode === 1
|
|
3191
|
-
/* ShadowMode.Synthetic */
|
|
3192
|
-
) {
|
|
3112
|
+
if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
|
|
3193
3113
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
3194
3114
|
insertStylesheet(stylesheets[i]);
|
|
3195
3115
|
}
|
|
@@ -3201,15 +3121,13 @@ function createStylesheet(vm, stylesheets) {
|
|
|
3201
3121
|
return shared.ArrayMap.call(stylesheets, createInlineStyleVNode);
|
|
3202
3122
|
} else {
|
|
3203
3123
|
// native shadow or light DOM, DOM renderer
|
|
3204
|
-
const root = getNearestNativeShadowComponent(vm);
|
|
3205
|
-
|
|
3124
|
+
const root = getNearestNativeShadowComponent(vm);
|
|
3125
|
+
// null root means a global style
|
|
3206
3126
|
const target = shared.isNull(root) ? undefined : root.shadowRoot;
|
|
3207
|
-
|
|
3208
3127
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
3209
3128
|
insertStylesheet(stylesheets[i], target);
|
|
3210
3129
|
}
|
|
3211
3130
|
}
|
|
3212
|
-
|
|
3213
3131
|
return null;
|
|
3214
3132
|
}
|
|
3215
3133
|
|
|
@@ -3495,14 +3413,11 @@ function patchChildren(c1, c2, parent, renderer) {
|
|
|
3495
3413
|
updateStaticChildren(c1, c2, parent, renderer);
|
|
3496
3414
|
}
|
|
3497
3415
|
}
|
|
3498
|
-
|
|
3499
3416
|
function patch(n1, n2, parent, renderer) {
|
|
3500
3417
|
var _a, _b;
|
|
3501
|
-
|
|
3502
3418
|
if (n1 === n2) {
|
|
3503
3419
|
return;
|
|
3504
3420
|
}
|
|
3505
|
-
|
|
3506
3421
|
if (process.env.NODE_ENV !== 'production') {
|
|
3507
3422
|
if (!isSameVnode(n1, n2)) {
|
|
3508
3423
|
throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
|
|
@@ -3514,103 +3429,63 @@ function patch(n1, n2, parent, renderer) {
|
|
|
3514
3429
|
}));
|
|
3515
3430
|
}
|
|
3516
3431
|
}
|
|
3517
|
-
|
|
3518
3432
|
switch (n2.type) {
|
|
3519
|
-
case 0
|
|
3520
|
-
/* VNodeType.Text */
|
|
3521
|
-
:
|
|
3433
|
+
case 0 /* VNodeType.Text */:
|
|
3522
3434
|
// VText has no special capability, fallback to the owner's renderer
|
|
3523
3435
|
patchText(n1, n2, renderer);
|
|
3524
3436
|
break;
|
|
3525
|
-
|
|
3526
|
-
case 1
|
|
3527
|
-
/* VNodeType.Comment */
|
|
3528
|
-
:
|
|
3437
|
+
case 1 /* VNodeType.Comment */:
|
|
3529
3438
|
// VComment has no special capability, fallback to the owner's renderer
|
|
3530
3439
|
patchComment(n1, n2, renderer);
|
|
3531
3440
|
break;
|
|
3532
|
-
|
|
3533
|
-
case 4
|
|
3534
|
-
/* VNodeType.Static */
|
|
3535
|
-
:
|
|
3441
|
+
case 4 /* VNodeType.Static */:
|
|
3536
3442
|
n2.elm = n1.elm;
|
|
3537
3443
|
break;
|
|
3538
|
-
|
|
3539
|
-
case 5
|
|
3540
|
-
/* VNodeType.Fragment */
|
|
3541
|
-
:
|
|
3444
|
+
case 5 /* VNodeType.Fragment */:
|
|
3542
3445
|
patchFragment(n1, n2, parent, renderer);
|
|
3543
3446
|
break;
|
|
3544
|
-
|
|
3545
|
-
case 2
|
|
3546
|
-
/* VNodeType.Element */
|
|
3547
|
-
:
|
|
3447
|
+
case 2 /* VNodeType.Element */:
|
|
3548
3448
|
patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3549
3449
|
break;
|
|
3550
|
-
|
|
3551
|
-
case 3
|
|
3552
|
-
/* VNodeType.CustomElement */
|
|
3553
|
-
:
|
|
3450
|
+
case 3 /* VNodeType.CustomElement */:
|
|
3554
3451
|
patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3555
3452
|
break;
|
|
3556
3453
|
}
|
|
3557
3454
|
}
|
|
3558
|
-
|
|
3559
3455
|
function mount(node, parent, renderer, anchor) {
|
|
3560
3456
|
var _a, _b;
|
|
3561
|
-
|
|
3562
3457
|
switch (node.type) {
|
|
3563
|
-
case 0
|
|
3564
|
-
/* VNodeType.Text */
|
|
3565
|
-
:
|
|
3458
|
+
case 0 /* VNodeType.Text */:
|
|
3566
3459
|
// VText has no special capability, fallback to the owner's renderer
|
|
3567
3460
|
mountText(node, parent, anchor, renderer);
|
|
3568
3461
|
break;
|
|
3569
|
-
|
|
3570
|
-
case 1
|
|
3571
|
-
/* VNodeType.Comment */
|
|
3572
|
-
:
|
|
3462
|
+
case 1 /* VNodeType.Comment */:
|
|
3573
3463
|
// VComment has no special capability, fallback to the owner's renderer
|
|
3574
3464
|
mountComment(node, parent, anchor, renderer);
|
|
3575
3465
|
break;
|
|
3576
|
-
|
|
3577
|
-
case 4
|
|
3578
|
-
/* VNodeType.Static */
|
|
3579
|
-
:
|
|
3466
|
+
case 4 /* VNodeType.Static */:
|
|
3580
3467
|
// VStatic cannot have a custom renderer associated to them, using owner's renderer
|
|
3581
3468
|
mountStatic(node, parent, anchor, renderer);
|
|
3582
3469
|
break;
|
|
3583
|
-
|
|
3584
|
-
case 5
|
|
3585
|
-
/* VNodeType.Fragment */
|
|
3586
|
-
:
|
|
3470
|
+
case 5 /* VNodeType.Fragment */:
|
|
3587
3471
|
mountFragment(node, parent, anchor, renderer);
|
|
3588
3472
|
break;
|
|
3589
|
-
|
|
3590
|
-
case 2
|
|
3591
|
-
/* VNodeType.Element */
|
|
3592
|
-
:
|
|
3473
|
+
case 2 /* VNodeType.Element */:
|
|
3593
3474
|
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3594
3475
|
mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
|
|
3595
3476
|
break;
|
|
3596
|
-
|
|
3597
|
-
case 3
|
|
3598
|
-
/* VNodeType.CustomElement */
|
|
3599
|
-
:
|
|
3477
|
+
case 3 /* VNodeType.CustomElement */:
|
|
3600
3478
|
// If the vnode data has a renderer override use it, else fallback to owner's renderer
|
|
3601
3479
|
mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
|
|
3602
3480
|
break;
|
|
3603
3481
|
}
|
|
3604
3482
|
}
|
|
3605
|
-
|
|
3606
3483
|
function patchText(n1, n2, renderer) {
|
|
3607
3484
|
n2.elm = n1.elm;
|
|
3608
|
-
|
|
3609
3485
|
if (n2.text !== n1.text) {
|
|
3610
3486
|
updateTextContent(n2, renderer);
|
|
3611
3487
|
}
|
|
3612
3488
|
}
|
|
3613
|
-
|
|
3614
3489
|
function mountText(vnode, parent, anchor, renderer) {
|
|
3615
3490
|
const {
|
|
3616
3491
|
owner
|
|
@@ -3622,16 +3497,14 @@ function mountText(vnode, parent, anchor, renderer) {
|
|
|
3622
3497
|
linkNodeToShadow(textNode, owner, renderer);
|
|
3623
3498
|
insertNode(textNode, parent, anchor, renderer);
|
|
3624
3499
|
}
|
|
3625
|
-
|
|
3626
3500
|
function patchComment(n1, n2, renderer) {
|
|
3627
|
-
n2.elm = n1.elm;
|
|
3501
|
+
n2.elm = n1.elm;
|
|
3502
|
+
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
|
3628
3503
|
// it is the case today.
|
|
3629
|
-
|
|
3630
3504
|
if (n2.text !== n1.text) {
|
|
3631
3505
|
updateTextContent(n2, renderer);
|
|
3632
3506
|
}
|
|
3633
3507
|
}
|
|
3634
|
-
|
|
3635
3508
|
function mountComment(vnode, parent, anchor, renderer) {
|
|
3636
3509
|
const {
|
|
3637
3510
|
owner
|
|
@@ -3643,32 +3516,27 @@ function mountComment(vnode, parent, anchor, renderer) {
|
|
|
3643
3516
|
linkNodeToShadow(commentNode, owner, renderer);
|
|
3644
3517
|
insertNode(commentNode, parent, anchor, renderer);
|
|
3645
3518
|
}
|
|
3646
|
-
|
|
3647
3519
|
function mountFragment(vnode, parent, anchor, renderer) {
|
|
3648
3520
|
const {
|
|
3649
3521
|
children
|
|
3650
3522
|
} = vnode;
|
|
3651
|
-
mountVNodes(children, parent, renderer, anchor);
|
|
3652
|
-
|
|
3523
|
+
mountVNodes(children, parent, renderer, anchor);
|
|
3524
|
+
// children of a fragment will always have at least the two delimiters.
|
|
3653
3525
|
vnode.elm = children[children.length - 1].elm;
|
|
3654
3526
|
}
|
|
3655
|
-
|
|
3656
3527
|
function patchFragment(n1, n2, parent, renderer) {
|
|
3657
3528
|
const {
|
|
3658
3529
|
children,
|
|
3659
3530
|
stable
|
|
3660
3531
|
} = n2;
|
|
3661
|
-
|
|
3662
3532
|
if (stable) {
|
|
3663
3533
|
updateStaticChildren(n1.children, children, parent, renderer);
|
|
3664
3534
|
} else {
|
|
3665
3535
|
updateDynamicChildren(n1.children, children, parent, renderer);
|
|
3666
|
-
}
|
|
3667
|
-
|
|
3668
|
-
|
|
3536
|
+
}
|
|
3537
|
+
// Note: not reusing n1.elm, because during patching, it may be patched with another text node.
|
|
3669
3538
|
n2.elm = children[children.length - 1].elm;
|
|
3670
3539
|
}
|
|
3671
|
-
|
|
3672
3540
|
function mountElement(vnode, parent, anchor, renderer) {
|
|
3673
3541
|
const {
|
|
3674
3542
|
sel,
|
|
@@ -3690,13 +3558,11 @@ function mountElement(vnode, parent, anchor, renderer) {
|
|
|
3690
3558
|
insertNode(elm, parent, anchor, renderer);
|
|
3691
3559
|
mountVNodes(vnode.children, elm, renderer, null);
|
|
3692
3560
|
}
|
|
3693
|
-
|
|
3694
3561
|
function patchElement(n1, n2, renderer) {
|
|
3695
3562
|
const elm = n2.elm = n1.elm;
|
|
3696
3563
|
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3697
3564
|
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3698
3565
|
}
|
|
3699
|
-
|
|
3700
3566
|
function mountStatic(vnode, parent, anchor, renderer) {
|
|
3701
3567
|
const {
|
|
3702
3568
|
owner
|
|
@@ -3707,26 +3573,19 @@ function mountStatic(vnode, parent, anchor, renderer) {
|
|
|
3707
3573
|
} = renderer;
|
|
3708
3574
|
const elm = vnode.elm = cloneNode(vnode.fragment, true);
|
|
3709
3575
|
linkNodeToShadow(elm, owner, renderer);
|
|
3710
|
-
applyElementRestrictions(elm, vnode);
|
|
3711
|
-
|
|
3576
|
+
applyElementRestrictions(elm, vnode);
|
|
3577
|
+
// Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
|
3712
3578
|
const {
|
|
3713
3579
|
renderMode,
|
|
3714
3580
|
shadowMode
|
|
3715
3581
|
} = owner;
|
|
3716
|
-
|
|
3717
3582
|
if (isSyntheticShadowDefined) {
|
|
3718
|
-
if (shadowMode === 1
|
|
3719
|
-
/* ShadowMode.Synthetic */
|
|
3720
|
-
|| renderMode === 0
|
|
3721
|
-
/* RenderMode.Light */
|
|
3722
|
-
) {
|
|
3583
|
+
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
|
3723
3584
|
elm[shared.KEY__SHADOW_STATIC] = true;
|
|
3724
3585
|
}
|
|
3725
3586
|
}
|
|
3726
|
-
|
|
3727
3587
|
insertNode(elm, parent, anchor, renderer);
|
|
3728
3588
|
}
|
|
3729
|
-
|
|
3730
3589
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
3731
3590
|
const {
|
|
3732
3591
|
sel,
|
|
@@ -3741,55 +3600,44 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3741
3600
|
* mechanism that only passes that argument if the constructor is known to be
|
|
3742
3601
|
* an upgradable custom element.
|
|
3743
3602
|
*/
|
|
3744
|
-
|
|
3745
3603
|
let vm;
|
|
3746
|
-
|
|
3747
3604
|
const upgradeCallback = elm => {
|
|
3748
3605
|
// the custom element from the registry is expecting an upgrade callback
|
|
3749
3606
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
3750
3607
|
};
|
|
3751
|
-
|
|
3752
3608
|
const connectedCallback = elm => {
|
|
3753
3609
|
if (features.lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3754
3610
|
connectRootElement(elm);
|
|
3755
3611
|
}
|
|
3756
3612
|
};
|
|
3757
|
-
|
|
3758
3613
|
const disconnectedCallback = elm => {
|
|
3759
3614
|
if (features.lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3760
3615
|
disconnectRootElement(elm);
|
|
3761
3616
|
}
|
|
3762
|
-
};
|
|
3617
|
+
};
|
|
3618
|
+
// Should never get a tag with upper case letter at this point; the compiler
|
|
3763
3619
|
// should produce only tags with lowercase letters. However, the Java
|
|
3764
3620
|
// compiler may generate tagnames with uppercase letters so - for backwards
|
|
3765
3621
|
// compatibility, we lower case the tagname here.
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
3622
|
const normalizedTagname = sel.toLowerCase();
|
|
3769
3623
|
const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
|
|
3770
3624
|
vnode.elm = elm;
|
|
3771
3625
|
vnode.vm = vm;
|
|
3772
3626
|
linkNodeToShadow(elm, owner, renderer);
|
|
3773
3627
|
applyStyleScoping(elm, owner, renderer);
|
|
3774
|
-
|
|
3775
3628
|
if (vm) {
|
|
3776
3629
|
allocateChildren(vnode, vm);
|
|
3777
3630
|
}
|
|
3778
|
-
|
|
3779
3631
|
patchElementPropsAndAttrs$1(null, vnode, renderer);
|
|
3780
3632
|
insertNode(elm, parent, anchor, renderer);
|
|
3781
|
-
|
|
3782
3633
|
if (vm) {
|
|
3783
3634
|
if (process.env.IS_BROWSER) {
|
|
3784
3635
|
if (!features.lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
3785
3636
|
if (process.env.NODE_ENV !== 'production') {
|
|
3786
3637
|
// With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
|
|
3787
3638
|
// noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
|
|
3788
|
-
shared.assert.isTrue(vm.state === 0
|
|
3789
|
-
/* VMState.created */
|
|
3790
|
-
, `${vm} cannot be recycled.`);
|
|
3639
|
+
shared.assert.isTrue(vm.state === 0 /* VMState.created */, `${vm} cannot be recycled.`);
|
|
3791
3640
|
}
|
|
3792
|
-
|
|
3793
3641
|
runConnectedCallback(vm);
|
|
3794
3642
|
}
|
|
3795
3643
|
} else {
|
|
@@ -3798,14 +3646,11 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
|
3798
3646
|
runConnectedCallback(vm);
|
|
3799
3647
|
}
|
|
3800
3648
|
}
|
|
3801
|
-
|
|
3802
3649
|
mountVNodes(vnode.children, elm, renderer, null);
|
|
3803
|
-
|
|
3804
3650
|
if (vm) {
|
|
3805
3651
|
appendVM(vm);
|
|
3806
3652
|
}
|
|
3807
3653
|
}
|
|
3808
|
-
|
|
3809
3654
|
function patchCustomElement(n1, n2, parent, renderer) {
|
|
3810
3655
|
if (n1.ctor !== n2.ctor) {
|
|
3811
3656
|
// If the constructor, unmount the current component and mount a new one using the new
|
|
@@ -3818,17 +3663,14 @@ function patchCustomElement(n1, n2, parent, renderer) {
|
|
|
3818
3663
|
const elm = n2.elm = n1.elm;
|
|
3819
3664
|
const vm = n2.vm = n1.vm;
|
|
3820
3665
|
patchElementPropsAndAttrs$1(n1, n2, renderer);
|
|
3821
|
-
|
|
3822
3666
|
if (!shared.isUndefined(vm)) {
|
|
3823
3667
|
// in fallback mode, the allocation will always set children to
|
|
3824
3668
|
// empty and delegate the real allocation to the slot elements
|
|
3825
3669
|
allocateChildren(n2, vm);
|
|
3826
|
-
}
|
|
3670
|
+
}
|
|
3671
|
+
// in fallback mode, the children will be always empty, so, nothing
|
|
3827
3672
|
// will happen, but in native, it does allocate the light dom
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
3673
|
patchChildren(n1.children, n2.children, elm, renderer);
|
|
3831
|
-
|
|
3832
3674
|
if (!shared.isUndefined(vm)) {
|
|
3833
3675
|
// this will probably update the shadowRoot, but only if the vm is in a dirty state
|
|
3834
3676
|
// this is important to preserve the top to bottom synchronous rendering phase.
|
|
@@ -3836,29 +3678,24 @@ function patchCustomElement(n1, n2, parent, renderer) {
|
|
|
3836
3678
|
}
|
|
3837
3679
|
}
|
|
3838
3680
|
}
|
|
3839
|
-
|
|
3840
3681
|
function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
|
|
3841
3682
|
for (; start < end; ++start) {
|
|
3842
3683
|
const vnode = vnodes[start];
|
|
3843
|
-
|
|
3844
3684
|
if (isVNode(vnode)) {
|
|
3845
3685
|
mount(vnode, parent, renderer, anchor);
|
|
3846
3686
|
}
|
|
3847
3687
|
}
|
|
3848
3688
|
}
|
|
3849
|
-
|
|
3850
3689
|
function unmount(vnode, parent, renderer, doRemove = false) {
|
|
3851
3690
|
const {
|
|
3852
3691
|
type,
|
|
3853
3692
|
elm,
|
|
3854
3693
|
sel
|
|
3855
|
-
} = vnode;
|
|
3694
|
+
} = vnode;
|
|
3695
|
+
// When unmounting a VNode subtree not all the elements have to removed from the DOM. The
|
|
3856
3696
|
// subtree root, is the only element worth unmounting from the subtree.
|
|
3857
|
-
|
|
3858
3697
|
if (doRemove) {
|
|
3859
|
-
if (type === 5
|
|
3860
|
-
/* VNodeType.Fragment */
|
|
3861
|
-
) {
|
|
3698
|
+
if (type === 5 /* VNodeType.Fragment */) {
|
|
3862
3699
|
unmountVNodes(vnode.children, parent, renderer, doRemove);
|
|
3863
3700
|
} else {
|
|
3864
3701
|
// The vnode might or might not have a data.renderer associated to it
|
|
@@ -3866,51 +3703,39 @@ function unmount(vnode, parent, renderer, doRemove = false) {
|
|
|
3866
3703
|
removeNode(elm, parent, renderer);
|
|
3867
3704
|
}
|
|
3868
3705
|
}
|
|
3869
|
-
|
|
3870
3706
|
switch (type) {
|
|
3871
|
-
case 2
|
|
3872
|
-
/* VNodeType.Element */
|
|
3873
|
-
:
|
|
3707
|
+
case 2 /* VNodeType.Element */:
|
|
3874
3708
|
{
|
|
3875
3709
|
// Slot content is removed to trigger slotchange event when removing slot.
|
|
3876
3710
|
// Only required for synthetic shadow.
|
|
3877
|
-
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1
|
|
3878
|
-
/* ShadowMode.Synthetic */
|
|
3879
|
-
;
|
|
3711
|
+
const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
|
|
3880
3712
|
unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
|
|
3881
3713
|
break;
|
|
3882
3714
|
}
|
|
3883
|
-
|
|
3884
|
-
case 3
|
|
3885
|
-
/* VNodeType.CustomElement */
|
|
3886
|
-
:
|
|
3715
|
+
case 3 /* VNodeType.CustomElement */:
|
|
3887
3716
|
{
|
|
3888
3717
|
const {
|
|
3889
3718
|
vm
|
|
3890
|
-
} = vnode;
|
|
3719
|
+
} = vnode;
|
|
3720
|
+
// No need to unmount the children here, `removeVM` will take care of removing the
|
|
3891
3721
|
// children.
|
|
3892
|
-
|
|
3893
3722
|
if (!shared.isUndefined(vm)) {
|
|
3894
3723
|
removeVM(vm);
|
|
3895
3724
|
}
|
|
3896
3725
|
}
|
|
3897
3726
|
}
|
|
3898
3727
|
}
|
|
3899
|
-
|
|
3900
3728
|
function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
|
|
3901
3729
|
for (; start < end; ++start) {
|
|
3902
3730
|
const ch = vnodes[start];
|
|
3903
|
-
|
|
3904
3731
|
if (isVNode(ch)) {
|
|
3905
3732
|
unmount(ch, parent, renderer, doRemove);
|
|
3906
3733
|
}
|
|
3907
3734
|
}
|
|
3908
3735
|
}
|
|
3909
|
-
|
|
3910
3736
|
function isVNode(vnode) {
|
|
3911
3737
|
return vnode != null;
|
|
3912
3738
|
}
|
|
3913
|
-
|
|
3914
3739
|
function linkNodeToShadow(elm, owner, renderer) {
|
|
3915
3740
|
const {
|
|
3916
3741
|
renderRoot,
|
|
@@ -3919,19 +3744,14 @@ function linkNodeToShadow(elm, owner, renderer) {
|
|
|
3919
3744
|
} = owner;
|
|
3920
3745
|
const {
|
|
3921
3746
|
isSyntheticShadowDefined
|
|
3922
|
-
} = renderer;
|
|
3923
|
-
|
|
3747
|
+
} = renderer;
|
|
3748
|
+
// TODO [#1164]: this should eventually be done by the polyfill directly
|
|
3924
3749
|
if (isSyntheticShadowDefined) {
|
|
3925
|
-
if (shadowMode === 1
|
|
3926
|
-
/* ShadowMode.Synthetic */
|
|
3927
|
-
|| renderMode === 0
|
|
3928
|
-
/* RenderMode.Light */
|
|
3929
|
-
) {
|
|
3750
|
+
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
|
3930
3751
|
elm[shared.KEY__SHADOW_RESOLVER] = renderRoot[shared.KEY__SHADOW_RESOLVER];
|
|
3931
3752
|
}
|
|
3932
3753
|
}
|
|
3933
3754
|
}
|
|
3934
|
-
|
|
3935
3755
|
function updateTextContent(vnode, renderer) {
|
|
3936
3756
|
const {
|
|
3937
3757
|
elm,
|
|
@@ -3940,120 +3760,87 @@ function updateTextContent(vnode, renderer) {
|
|
|
3940
3760
|
const {
|
|
3941
3761
|
setText
|
|
3942
3762
|
} = renderer;
|
|
3943
|
-
|
|
3944
3763
|
if (process.env.NODE_ENV !== 'production') {
|
|
3945
3764
|
unlockDomMutation();
|
|
3946
3765
|
}
|
|
3947
|
-
|
|
3948
3766
|
setText(elm, text);
|
|
3949
|
-
|
|
3950
3767
|
if (process.env.NODE_ENV !== 'production') {
|
|
3951
3768
|
lockDomMutation();
|
|
3952
3769
|
}
|
|
3953
3770
|
}
|
|
3954
|
-
|
|
3955
3771
|
function insertNode(node, parent, anchor, renderer) {
|
|
3956
3772
|
if (process.env.NODE_ENV !== 'production') {
|
|
3957
3773
|
unlockDomMutation();
|
|
3958
3774
|
}
|
|
3959
|
-
|
|
3960
3775
|
renderer.insert(node, parent, anchor);
|
|
3961
|
-
|
|
3962
3776
|
if (process.env.NODE_ENV !== 'production') {
|
|
3963
3777
|
lockDomMutation();
|
|
3964
3778
|
}
|
|
3965
3779
|
}
|
|
3966
|
-
|
|
3967
3780
|
function removeNode(node, parent, renderer) {
|
|
3968
3781
|
if (process.env.NODE_ENV !== 'production') {
|
|
3969
3782
|
unlockDomMutation();
|
|
3970
3783
|
}
|
|
3971
|
-
|
|
3972
3784
|
renderer.remove(node, parent);
|
|
3973
|
-
|
|
3974
3785
|
if (process.env.NODE_ENV !== 'production') {
|
|
3975
3786
|
lockDomMutation();
|
|
3976
3787
|
}
|
|
3977
3788
|
}
|
|
3978
|
-
|
|
3979
3789
|
function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
|
|
3980
3790
|
if (shared.isNull(oldVnode)) {
|
|
3981
3791
|
applyEventListeners(vnode, renderer);
|
|
3982
3792
|
applyStaticClassAttribute(vnode, renderer);
|
|
3983
3793
|
applyStaticStyleAttribute(vnode, renderer);
|
|
3984
|
-
}
|
|
3794
|
+
}
|
|
3795
|
+
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
|
3985
3796
|
// value is set before type=radio.
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
3797
|
patchClassAttribute(oldVnode, vnode, renderer);
|
|
3989
3798
|
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
3990
3799
|
patchAttributes(oldVnode, vnode, renderer);
|
|
3991
3800
|
patchProps(oldVnode, vnode, renderer);
|
|
3992
3801
|
}
|
|
3993
|
-
|
|
3994
3802
|
function applyStyleScoping(elm, owner, renderer) {
|
|
3995
3803
|
// Set the class name for `*.scoped.css` style scoping.
|
|
3996
3804
|
const scopeToken = getScopeTokenClass(owner);
|
|
3997
|
-
|
|
3998
3805
|
if (!shared.isNull(scopeToken)) {
|
|
3999
3806
|
const {
|
|
4000
3807
|
getClassList
|
|
4001
|
-
} = renderer;
|
|
3808
|
+
} = renderer;
|
|
3809
|
+
// TODO [#2762]: this dot notation with add is probably problematic
|
|
4002
3810
|
// probably we should have a renderer api for just the add operation
|
|
4003
|
-
|
|
4004
3811
|
getClassList(elm).add(scopeToken);
|
|
4005
|
-
}
|
|
4006
|
-
|
|
4007
|
-
|
|
3812
|
+
}
|
|
3813
|
+
// Set property element for synthetic shadow DOM style scoping.
|
|
4008
3814
|
const {
|
|
4009
3815
|
stylesheetToken: syntheticToken
|
|
4010
3816
|
} = owner.context;
|
|
4011
|
-
|
|
4012
|
-
if (owner.shadowMode === 1
|
|
4013
|
-
/* ShadowMode.Synthetic */
|
|
4014
|
-
&& !shared.isUndefined(syntheticToken)) {
|
|
3817
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !shared.isUndefined(syntheticToken)) {
|
|
4015
3818
|
elm.$shadowToken$ = syntheticToken;
|
|
4016
3819
|
}
|
|
4017
3820
|
}
|
|
4018
|
-
|
|
4019
3821
|
function applyDomManual(elm, vnode) {
|
|
4020
3822
|
var _a;
|
|
4021
|
-
|
|
4022
3823
|
const {
|
|
4023
3824
|
owner,
|
|
4024
3825
|
data: {
|
|
4025
3826
|
context
|
|
4026
3827
|
}
|
|
4027
3828
|
} = vnode;
|
|
4028
|
-
|
|
4029
|
-
if (owner.shadowMode === 1
|
|
4030
|
-
/* ShadowMode.Synthetic */
|
|
4031
|
-
&& ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
|
|
4032
|
-
/* LwcDomMode.Manual */
|
|
4033
|
-
) {
|
|
3829
|
+
if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual" /* LwcDomMode.Manual */) {
|
|
4034
3830
|
elm.$domManual$ = true;
|
|
4035
3831
|
}
|
|
4036
3832
|
}
|
|
4037
|
-
|
|
4038
3833
|
function applyElementRestrictions(elm, vnode) {
|
|
4039
3834
|
var _a, _b;
|
|
4040
|
-
|
|
4041
3835
|
if (process.env.NODE_ENV !== 'production') {
|
|
4042
|
-
const isPortal = vnode.type === 2
|
|
4043
|
-
/*
|
|
4044
|
-
&& ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual"
|
|
4045
|
-
/* LwcDomMode.Manual */
|
|
4046
|
-
;
|
|
4047
|
-
const isLight = vnode.owner.renderMode === 0
|
|
4048
|
-
/* RenderMode.Light */
|
|
4049
|
-
;
|
|
3836
|
+
const isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
|
|
3837
|
+
const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
|
|
4050
3838
|
patchElementWithRestrictions(elm, {
|
|
4051
3839
|
isPortal,
|
|
4052
3840
|
isLight
|
|
4053
3841
|
});
|
|
4054
3842
|
}
|
|
4055
3843
|
}
|
|
4056
|
-
|
|
4057
3844
|
function allocateChildren(vnode, vm) {
|
|
4058
3845
|
// A component with slots will re-render because:
|
|
4059
3846
|
// 1- There is a change of the internal state.
|
|
@@ -4071,41 +3858,31 @@ function allocateChildren(vnode, vm) {
|
|
|
4071
3858
|
renderMode,
|
|
4072
3859
|
shadowMode
|
|
4073
3860
|
} = vm;
|
|
4074
|
-
|
|
4075
3861
|
if (process.env.NODE_ENV !== 'production') {
|
|
4076
3862
|
// If any of the children being allocated is a scoped slot fragment, make sure the receiving
|
|
4077
3863
|
// component is a light DOM component. This is mainly to validate light dom parent running
|
|
4078
3864
|
// in native shadow mode.
|
|
4079
|
-
if (renderMode !== 0
|
|
4080
|
-
/* RenderMode.Light */
|
|
4081
|
-
&& shared.ArraySome.call(children, child => !shared.isNull(child) && isVScopedSlotFragment(child))) {
|
|
3865
|
+
if (renderMode !== 0 /* RenderMode.Light */ && shared.ArraySome.call(children, child => !shared.isNull(child) && isVScopedSlotFragment(child))) {
|
|
4082
3866
|
logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
|
|
4083
3867
|
}
|
|
4084
3868
|
}
|
|
4085
|
-
|
|
4086
|
-
if (shadowMode === 1
|
|
4087
|
-
/* ShadowMode.Synthetic */
|
|
4088
|
-
|| renderMode === 0
|
|
4089
|
-
/* RenderMode.Light */
|
|
4090
|
-
) {
|
|
3869
|
+
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
|
4091
3870
|
// slow path
|
|
4092
|
-
allocateInSlot(vm, children, vnode.owner);
|
|
4093
|
-
|
|
4094
|
-
vnode.aChildren = children;
|
|
4095
|
-
|
|
3871
|
+
allocateInSlot(vm, children, vnode.owner);
|
|
3872
|
+
// save the allocated children in case this vnode is reused.
|
|
3873
|
+
vnode.aChildren = children;
|
|
3874
|
+
// every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
|
|
4096
3875
|
vnode.children = EmptyArray;
|
|
4097
3876
|
}
|
|
4098
3877
|
}
|
|
4099
|
-
|
|
4100
3878
|
function createViewModelHook(elm, vnode, renderer) {
|
|
4101
|
-
let vm = getAssociatedVMIfPresent(elm);
|
|
3879
|
+
let vm = getAssociatedVMIfPresent(elm);
|
|
3880
|
+
// There is a possibility that a custom element is registered under tagName, in which case, the
|
|
4102
3881
|
// initialization is already carry on, and there is nothing else to do here since this hook is
|
|
4103
3882
|
// called right after invoking `document.createElement`.
|
|
4104
|
-
|
|
4105
3883
|
if (!shared.isUndefined(vm)) {
|
|
4106
3884
|
return vm;
|
|
4107
3885
|
}
|
|
4108
|
-
|
|
4109
3886
|
const {
|
|
4110
3887
|
sel,
|
|
4111
3888
|
mode,
|
|
@@ -4117,48 +3894,37 @@ function createViewModelHook(elm, vnode, renderer) {
|
|
|
4117
3894
|
owner,
|
|
4118
3895
|
tagName: sel
|
|
4119
3896
|
});
|
|
4120
|
-
|
|
4121
3897
|
if (process.env.NODE_ENV !== 'production') {
|
|
4122
3898
|
shared.assert.isTrue(shared.isArray(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
|
|
4123
3899
|
}
|
|
4124
|
-
|
|
4125
3900
|
return vm;
|
|
4126
3901
|
}
|
|
4127
3902
|
/**
|
|
4128
3903
|
* Collects all slots into a SlotSet, traversing through VFragment Nodes
|
|
4129
3904
|
*/
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
3905
|
function collectSlots(vm, children, cmpSlotsMapping) {
|
|
4133
3906
|
var _a, _b;
|
|
4134
|
-
|
|
4135
3907
|
for (let i = 0, len = children.length; i < len; i += 1) {
|
|
4136
3908
|
const vnode = children[i];
|
|
4137
|
-
|
|
4138
3909
|
if (shared.isNull(vnode)) {
|
|
4139
3910
|
continue;
|
|
4140
|
-
}
|
|
4141
|
-
|
|
4142
|
-
|
|
3911
|
+
}
|
|
3912
|
+
// Dive further iff the content is wrapped in a VFragment
|
|
4143
3913
|
if (isVFragment(vnode)) {
|
|
4144
3914
|
// Remove the text delimiter nodes to avoid overriding default slot content
|
|
4145
3915
|
collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
|
|
4146
3916
|
continue;
|
|
4147
3917
|
}
|
|
4148
|
-
|
|
4149
3918
|
let slotName = '';
|
|
4150
|
-
|
|
4151
3919
|
if (isVBaseElement(vnode)) {
|
|
4152
3920
|
slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
|
|
4153
3921
|
} else if (isVScopedSlotFragment(vnode)) {
|
|
4154
3922
|
slotName = vnode.slotName;
|
|
4155
3923
|
}
|
|
4156
|
-
|
|
4157
3924
|
const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
|
|
4158
3925
|
shared.ArrayPush.call(vnodes, vnode);
|
|
4159
3926
|
}
|
|
4160
3927
|
}
|
|
4161
|
-
|
|
4162
3928
|
function allocateInSlot(vm, children, owner) {
|
|
4163
3929
|
const {
|
|
4164
3930
|
cmpSlots: {
|
|
@@ -4171,28 +3937,22 @@ function allocateInSlot(vm, children, owner) {
|
|
|
4171
3937
|
owner,
|
|
4172
3938
|
slotAssignments: cmpSlotsMapping
|
|
4173
3939
|
};
|
|
4174
|
-
|
|
4175
3940
|
if (shared.isFalse(vm.isDirty)) {
|
|
4176
3941
|
// We need to determine if the old allocation is really different from the new one
|
|
4177
3942
|
// and mark the vm as dirty
|
|
4178
3943
|
const oldKeys = shared.keys(oldSlotsMapping);
|
|
4179
|
-
|
|
4180
3944
|
if (oldKeys.length !== shared.keys(cmpSlotsMapping).length) {
|
|
4181
3945
|
markComponentAsDirty(vm);
|
|
4182
3946
|
return;
|
|
4183
3947
|
}
|
|
4184
|
-
|
|
4185
3948
|
for (let i = 0, len = oldKeys.length; i < len; i += 1) {
|
|
4186
3949
|
const key = oldKeys[i];
|
|
4187
|
-
|
|
4188
3950
|
if (shared.isUndefined(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
|
|
4189
3951
|
markComponentAsDirty(vm);
|
|
4190
3952
|
return;
|
|
4191
3953
|
}
|
|
4192
|
-
|
|
4193
3954
|
const oldVNodes = oldSlotsMapping[key];
|
|
4194
3955
|
const vnodes = cmpSlotsMapping[key];
|
|
4195
|
-
|
|
4196
3956
|
for (let j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
|
|
4197
3957
|
if (oldVNodes[j] !== vnodes[j]) {
|
|
4198
3958
|
markComponentAsDirty(vm);
|
|
@@ -4201,40 +3961,33 @@ function allocateInSlot(vm, children, owner) {
|
|
|
4201
3961
|
}
|
|
4202
3962
|
}
|
|
4203
3963
|
}
|
|
4204
|
-
}
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
3964
|
+
}
|
|
3965
|
+
// Using a WeakMap instead of a WeakSet because this one works in IE11 :(
|
|
3966
|
+
const FromIteration = new WeakMap();
|
|
3967
|
+
// dynamic children means it was generated by an iteration
|
|
4208
3968
|
// in a template, and will require a more complex diffing algo.
|
|
4209
|
-
|
|
4210
3969
|
function markAsDynamicChildren(children) {
|
|
4211
3970
|
FromIteration.set(children, 1);
|
|
4212
3971
|
}
|
|
4213
|
-
|
|
4214
3972
|
function hasDynamicChildren(children) {
|
|
4215
3973
|
return FromIteration.has(children);
|
|
4216
3974
|
}
|
|
4217
|
-
|
|
4218
3975
|
function createKeyToOldIdx(children, beginIdx, endIdx) {
|
|
4219
|
-
const map = {};
|
|
4220
|
-
|
|
3976
|
+
const map = {};
|
|
3977
|
+
// TODO [#1637]: simplify this by assuming that all vnodes has keys
|
|
4221
3978
|
for (let j = beginIdx; j <= endIdx; ++j) {
|
|
4222
3979
|
const ch = children[j];
|
|
4223
|
-
|
|
4224
3980
|
if (isVNode(ch)) {
|
|
4225
3981
|
const {
|
|
4226
3982
|
key
|
|
4227
3983
|
} = ch;
|
|
4228
|
-
|
|
4229
3984
|
if (key !== undefined) {
|
|
4230
3985
|
map[key] = j;
|
|
4231
3986
|
}
|
|
4232
3987
|
}
|
|
4233
3988
|
}
|
|
4234
|
-
|
|
4235
3989
|
return map;
|
|
4236
3990
|
}
|
|
4237
|
-
|
|
4238
3991
|
function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
4239
3992
|
let oldStartIdx = 0;
|
|
4240
3993
|
let newStartIdx = 0;
|
|
@@ -4250,7 +4003,6 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
|
4250
4003
|
let elmToMove;
|
|
4251
4004
|
let before;
|
|
4252
4005
|
let clonedOldCh = false;
|
|
4253
|
-
|
|
4254
4006
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
4255
4007
|
if (!isVNode(oldStartVnode)) {
|
|
4256
4008
|
oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
|
|
@@ -4284,54 +4036,46 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
|
4284
4036
|
if (oldKeyToIdx === undefined) {
|
|
4285
4037
|
oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
|
|
4286
4038
|
}
|
|
4287
|
-
|
|
4288
4039
|
idxInOld = oldKeyToIdx[newStartVnode.key];
|
|
4289
|
-
|
|
4290
4040
|
if (shared.isUndefined(idxInOld)) {
|
|
4291
4041
|
// New element
|
|
4292
4042
|
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4293
4043
|
newStartVnode = newCh[++newStartIdx];
|
|
4294
4044
|
} else {
|
|
4295
4045
|
elmToMove = oldCh[idxInOld];
|
|
4296
|
-
|
|
4297
4046
|
if (isVNode(elmToMove)) {
|
|
4298
4047
|
if (elmToMove.sel !== newStartVnode.sel) {
|
|
4299
4048
|
// New element
|
|
4300
4049
|
mount(newStartVnode, parent, renderer, oldStartVnode.elm);
|
|
4301
4050
|
} else {
|
|
4302
|
-
patch(elmToMove, newStartVnode, parent, renderer);
|
|
4051
|
+
patch(elmToMove, newStartVnode, parent, renderer);
|
|
4052
|
+
// Delete the old child, but copy the array since it is read-only.
|
|
4303
4053
|
// The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
|
|
4304
4054
|
// so we only care about the `oldCh` object inside this function.
|
|
4305
4055
|
// To avoid cloning over and over again, we check `clonedOldCh`
|
|
4306
4056
|
// and only clone once.
|
|
4307
|
-
|
|
4308
4057
|
if (!clonedOldCh) {
|
|
4309
4058
|
clonedOldCh = true;
|
|
4310
4059
|
oldCh = [...oldCh];
|
|
4311
|
-
}
|
|
4312
|
-
|
|
4313
|
-
|
|
4060
|
+
}
|
|
4061
|
+
// We've already cloned at least once, so it's no longer read-only
|
|
4314
4062
|
oldCh[idxInOld] = undefined;
|
|
4315
4063
|
insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
|
|
4316
4064
|
}
|
|
4317
4065
|
}
|
|
4318
|
-
|
|
4319
4066
|
newStartVnode = newCh[++newStartIdx];
|
|
4320
4067
|
}
|
|
4321
4068
|
}
|
|
4322
4069
|
}
|
|
4323
|
-
|
|
4324
4070
|
if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
|
|
4325
4071
|
if (oldStartIdx > oldEndIdx) {
|
|
4326
4072
|
// There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
|
|
4327
4073
|
// already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
|
|
4328
4074
|
let i = newEndIdx;
|
|
4329
4075
|
let n;
|
|
4330
|
-
|
|
4331
4076
|
do {
|
|
4332
4077
|
n = newCh[++i];
|
|
4333
4078
|
} while (!isVNode(n) && i < newChEnd);
|
|
4334
|
-
|
|
4335
4079
|
before = isVNode(n) ? n.elm : null;
|
|
4336
4080
|
mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
|
|
4337
4081
|
} else {
|
|
@@ -4339,32 +4083,26 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
|
|
|
4339
4083
|
}
|
|
4340
4084
|
}
|
|
4341
4085
|
}
|
|
4342
|
-
|
|
4343
4086
|
function updateStaticChildren(c1, c2, parent, renderer) {
|
|
4344
4087
|
const c1Length = c1.length;
|
|
4345
4088
|
const c2Length = c2.length;
|
|
4346
|
-
|
|
4347
4089
|
if (c1Length === 0) {
|
|
4348
4090
|
// the old list is empty, we can directly insert anything new
|
|
4349
4091
|
mountVNodes(c2, parent, renderer, null);
|
|
4350
4092
|
return;
|
|
4351
4093
|
}
|
|
4352
|
-
|
|
4353
4094
|
if (c2Length === 0) {
|
|
4354
4095
|
// the old list is nonempty and the new list is empty so we can directly remove all old nodes
|
|
4355
4096
|
// this is the case in which the dynamic children of an if-directive should be removed
|
|
4356
4097
|
unmountVNodes(c1, parent, renderer, true);
|
|
4357
4098
|
return;
|
|
4358
|
-
}
|
|
4099
|
+
}
|
|
4100
|
+
// if the old list is not empty, the new list MUST have the same
|
|
4359
4101
|
// amount of nodes, that's why we call this static children
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
4102
|
let anchor = null;
|
|
4363
|
-
|
|
4364
4103
|
for (let i = c2Length - 1; i >= 0; i -= 1) {
|
|
4365
4104
|
const n1 = c1[i];
|
|
4366
4105
|
const n2 = c2[i];
|
|
4367
|
-
|
|
4368
4106
|
if (n2 !== n1) {
|
|
4369
4107
|
if (isVNode(n1)) {
|
|
4370
4108
|
if (isVNode(n2)) {
|
|
@@ -5354,42 +5092,30 @@ function invokeServiceHook(vm, cbs) {
|
|
|
5354
5092
|
*/
|
|
5355
5093
|
let idx = 0;
|
|
5356
5094
|
/** The internal slot used to associate different objects the engine manipulates with the VM */
|
|
5357
|
-
|
|
5358
5095
|
const ViewModelReflection = new WeakMap();
|
|
5359
|
-
|
|
5360
5096
|
function callHook(cmp, fn, args = []) {
|
|
5361
5097
|
return fn.apply(cmp, args);
|
|
5362
5098
|
}
|
|
5363
|
-
|
|
5364
5099
|
function setHook(cmp, prop, newValue) {
|
|
5365
5100
|
cmp[prop] = newValue;
|
|
5366
5101
|
}
|
|
5367
|
-
|
|
5368
5102
|
function getHook(cmp, prop) {
|
|
5369
5103
|
return cmp[prop];
|
|
5370
5104
|
}
|
|
5371
|
-
|
|
5372
5105
|
function rerenderVM(vm) {
|
|
5373
5106
|
rehydrate(vm);
|
|
5374
5107
|
}
|
|
5375
5108
|
function connectRootElement(elm) {
|
|
5376
5109
|
const vm = getAssociatedVM(elm);
|
|
5377
|
-
logGlobalOperationStart(7
|
|
5378
|
-
|
|
5379
|
-
, vm); // Usually means moving the element from one place to another, which is observable via
|
|
5110
|
+
logGlobalOperationStart(7 /* OperationId.GlobalHydrate */, vm);
|
|
5111
|
+
// Usually means moving the element from one place to another, which is observable via
|
|
5380
5112
|
// life-cycle hooks.
|
|
5381
|
-
|
|
5382
|
-
if (vm.state === 1
|
|
5383
|
-
/* VMState.connected */
|
|
5384
|
-
) {
|
|
5113
|
+
if (vm.state === 1 /* VMState.connected */) {
|
|
5385
5114
|
disconnectRootElement(elm);
|
|
5386
5115
|
}
|
|
5387
|
-
|
|
5388
5116
|
runConnectedCallback(vm);
|
|
5389
5117
|
rehydrate(vm);
|
|
5390
|
-
logGlobalOperationEnd(7
|
|
5391
|
-
/* OperationId.GlobalHydrate */
|
|
5392
|
-
, vm);
|
|
5118
|
+
logGlobalOperationEnd(7 /* OperationId.GlobalHydrate */, vm);
|
|
5393
5119
|
}
|
|
5394
5120
|
function disconnectRootElement(elm) {
|
|
5395
5121
|
const vm = getAssociatedVM(elm);
|
|
@@ -5397,65 +5123,48 @@ function disconnectRootElement(elm) {
|
|
|
5397
5123
|
}
|
|
5398
5124
|
function appendVM(vm) {
|
|
5399
5125
|
rehydrate(vm);
|
|
5400
|
-
}
|
|
5126
|
+
}
|
|
5127
|
+
// just in case the component comes back, with this we guarantee re-rendering it
|
|
5401
5128
|
// while preventing any attempt to rehydration until after reinsertion.
|
|
5402
|
-
|
|
5403
5129
|
function resetComponentStateWhenRemoved(vm) {
|
|
5404
5130
|
const {
|
|
5405
5131
|
state
|
|
5406
5132
|
} = vm;
|
|
5407
|
-
|
|
5408
|
-
if (state !== 2
|
|
5409
|
-
/* VMState.disconnected */
|
|
5410
|
-
) {
|
|
5133
|
+
if (state !== 2 /* VMState.disconnected */) {
|
|
5411
5134
|
const {
|
|
5412
5135
|
oar,
|
|
5413
5136
|
tro
|
|
5414
|
-
} = vm;
|
|
5415
|
-
|
|
5416
|
-
tro.reset();
|
|
5417
|
-
|
|
5137
|
+
} = vm;
|
|
5138
|
+
// Making sure that any observing record will not trigger the rehydrated on this vm
|
|
5139
|
+
tro.reset();
|
|
5140
|
+
// Making sure that any observing accessor record will not trigger the setter to be reinvoked
|
|
5418
5141
|
for (const key in oar) {
|
|
5419
5142
|
oar[key].reset();
|
|
5420
5143
|
}
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5144
|
+
runDisconnectedCallback(vm);
|
|
5145
|
+
// Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
|
|
5424
5146
|
runChildNodesDisconnectedCallback(vm);
|
|
5425
5147
|
runLightChildNodesDisconnectedCallback(vm);
|
|
5426
5148
|
}
|
|
5427
|
-
|
|
5428
5149
|
if (process.env.NODE_ENV !== 'production') {
|
|
5429
5150
|
removeActiveVM(vm);
|
|
5430
5151
|
}
|
|
5431
|
-
}
|
|
5152
|
+
}
|
|
5153
|
+
// this method is triggered by the diffing algo only when a vnode from the
|
|
5432
5154
|
// old vnode.children is removed from the DOM.
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
5155
|
function removeVM(vm) {
|
|
5436
5156
|
if (process.env.NODE_ENV !== 'production') {
|
|
5437
|
-
shared.assert.isTrue(vm.state === 1
|
|
5438
|
-
/* VMState.connected */
|
|
5439
|
-
|| vm.state === 2
|
|
5440
|
-
/* VMState.disconnected */
|
|
5441
|
-
, `${vm} must have been connected.`);
|
|
5157
|
+
shared.assert.isTrue(vm.state === 1 /* VMState.connected */ || vm.state === 2 /* VMState.disconnected */, `${vm} must have been connected.`);
|
|
5442
5158
|
}
|
|
5443
|
-
|
|
5444
5159
|
resetComponentStateWhenRemoved(vm);
|
|
5445
5160
|
}
|
|
5446
|
-
|
|
5447
5161
|
function getNearestShadowAncestor(vm) {
|
|
5448
5162
|
let ancestor = vm.owner;
|
|
5449
|
-
|
|
5450
|
-
while (!shared.isNull(ancestor) && ancestor.renderMode === 0
|
|
5451
|
-
/* RenderMode.Light */
|
|
5452
|
-
) {
|
|
5163
|
+
while (!shared.isNull(ancestor) && ancestor.renderMode === 0 /* RenderMode.Light */) {
|
|
5453
5164
|
ancestor = ancestor.owner;
|
|
5454
5165
|
}
|
|
5455
|
-
|
|
5456
5166
|
return ancestor;
|
|
5457
5167
|
}
|
|
5458
|
-
|
|
5459
5168
|
function createVM(elm, ctor, renderer, options) {
|
|
5460
5169
|
const {
|
|
5461
5170
|
mode,
|
|
@@ -5468,9 +5177,7 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5468
5177
|
elm,
|
|
5469
5178
|
def,
|
|
5470
5179
|
idx: idx++,
|
|
5471
|
-
state: 0
|
|
5472
|
-
/* VMState.created */
|
|
5473
|
-
,
|
|
5180
|
+
state: 0 /* VMState.created */,
|
|
5474
5181
|
isScheduled: false,
|
|
5475
5182
|
isDirty: true,
|
|
5476
5183
|
tagName,
|
|
@@ -5512,31 +5219,27 @@ function createVM(elm, ctor, renderer, options) {
|
|
|
5512
5219
|
getHook,
|
|
5513
5220
|
renderer
|
|
5514
5221
|
};
|
|
5222
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5223
|
+
vm.debugInfo = shared.create(null);
|
|
5224
|
+
}
|
|
5515
5225
|
vm.shadowMode = computeShadowMode(vm, renderer);
|
|
5516
5226
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
5517
|
-
|
|
5518
5227
|
if (process.env.NODE_ENV !== 'production') {
|
|
5519
5228
|
vm.toString = () => {
|
|
5520
5229
|
return `[object:vm ${def.name} (${vm.idx})]`;
|
|
5521
5230
|
};
|
|
5522
|
-
|
|
5523
5231
|
if (features.lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
|
|
5524
|
-
vm.shadowMode = 0
|
|
5525
|
-
/* ShadowMode.Native */
|
|
5526
|
-
;
|
|
5232
|
+
vm.shadowMode = 0 /* ShadowMode.Native */;
|
|
5527
5233
|
}
|
|
5528
|
-
}
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5234
|
+
}
|
|
5235
|
+
// Create component instance associated to the vm and the element.
|
|
5236
|
+
invokeComponentConstructor(vm, def.ctor);
|
|
5237
|
+
// Initializing the wire decorator per instance only when really needed
|
|
5533
5238
|
if (hasWireAdapters(vm)) {
|
|
5534
5239
|
installWireAdapters(vm);
|
|
5535
5240
|
}
|
|
5536
|
-
|
|
5537
5241
|
return vm;
|
|
5538
5242
|
}
|
|
5539
|
-
|
|
5540
5243
|
function computeShadowMode(vm, renderer) {
|
|
5541
5244
|
const {
|
|
5542
5245
|
def
|
|
@@ -5546,136 +5249,98 @@ function computeShadowMode(vm, renderer) {
|
|
|
5546
5249
|
isNativeShadowDefined
|
|
5547
5250
|
} = renderer;
|
|
5548
5251
|
let shadowMode;
|
|
5549
|
-
|
|
5550
5252
|
if (isSyntheticShadowDefined) {
|
|
5551
|
-
if (def.renderMode === 0
|
|
5552
|
-
/* RenderMode.Light */
|
|
5553
|
-
) {
|
|
5253
|
+
if (def.renderMode === 0 /* RenderMode.Light */) {
|
|
5554
5254
|
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
|
5555
5255
|
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
5556
|
-
shadowMode = 0
|
|
5557
|
-
/* ShadowMode.Native */
|
|
5558
|
-
;
|
|
5256
|
+
shadowMode = 0 /* ShadowMode.Native */;
|
|
5559
5257
|
} else if (isNativeShadowDefined) {
|
|
5560
5258
|
// Not combined with above condition because @lwc/features only supports identifiers in
|
|
5561
5259
|
// the if-condition.
|
|
5562
5260
|
if (features.lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
|
|
5563
|
-
if (def.shadowSupportMode === "any"
|
|
5564
|
-
|
|
5565
|
-
) {
|
|
5566
|
-
shadowMode = 0
|
|
5567
|
-
/* ShadowMode.Native */
|
|
5568
|
-
;
|
|
5261
|
+
if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */) {
|
|
5262
|
+
shadowMode = 0 /* ShadowMode.Native */;
|
|
5569
5263
|
} else {
|
|
5570
5264
|
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
5571
|
-
|
|
5572
|
-
if (!shared.isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
5573
|
-
/* ShadowMode.Native */
|
|
5574
|
-
) {
|
|
5265
|
+
if (!shared.isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
|
|
5575
5266
|
// Transitive support for native Shadow DOM. A component in native mode
|
|
5576
5267
|
// transitively opts all of its descendants into native.
|
|
5577
|
-
shadowMode = 0
|
|
5578
|
-
/* ShadowMode.Native */
|
|
5579
|
-
;
|
|
5268
|
+
shadowMode = 0 /* ShadowMode.Native */;
|
|
5580
5269
|
} else {
|
|
5581
5270
|
// Synthetic if neither this component nor any of its ancestors are configured
|
|
5582
5271
|
// to be native.
|
|
5583
|
-
shadowMode = 1
|
|
5584
|
-
/* ShadowMode.Synthetic */
|
|
5585
|
-
;
|
|
5272
|
+
shadowMode = 1 /* ShadowMode.Synthetic */;
|
|
5586
5273
|
}
|
|
5587
5274
|
}
|
|
5588
5275
|
} else {
|
|
5589
|
-
shadowMode = 1
|
|
5590
|
-
/* ShadowMode.Synthetic */
|
|
5591
|
-
;
|
|
5276
|
+
shadowMode = 1 /* ShadowMode.Synthetic */;
|
|
5592
5277
|
}
|
|
5593
5278
|
} else {
|
|
5594
5279
|
// Synthetic if there is no native Shadow DOM support.
|
|
5595
|
-
shadowMode = 1
|
|
5596
|
-
/* ShadowMode.Synthetic */
|
|
5597
|
-
;
|
|
5280
|
+
shadowMode = 1 /* ShadowMode.Synthetic */;
|
|
5598
5281
|
}
|
|
5599
5282
|
} else {
|
|
5600
5283
|
// Native if the synthetic shadow polyfill is unavailable.
|
|
5601
|
-
shadowMode = 0
|
|
5602
|
-
/* ShadowMode.Native */
|
|
5603
|
-
;
|
|
5284
|
+
shadowMode = 0 /* ShadowMode.Native */;
|
|
5604
5285
|
}
|
|
5605
5286
|
|
|
5606
5287
|
return shadowMode;
|
|
5607
5288
|
}
|
|
5608
|
-
|
|
5609
5289
|
function assertIsVM(obj) {
|
|
5610
5290
|
if (shared.isNull(obj) || !shared.isObject(obj) || !('renderRoot' in obj)) {
|
|
5611
5291
|
throw new TypeError(`${obj} is not a VM.`);
|
|
5612
5292
|
}
|
|
5613
5293
|
}
|
|
5614
|
-
|
|
5615
5294
|
function associateVM(obj, vm) {
|
|
5616
5295
|
ViewModelReflection.set(obj, vm);
|
|
5617
5296
|
}
|
|
5618
5297
|
function getAssociatedVM(obj) {
|
|
5619
5298
|
const vm = ViewModelReflection.get(obj);
|
|
5620
|
-
|
|
5621
5299
|
if (process.env.NODE_ENV !== 'production') {
|
|
5622
5300
|
assertIsVM(vm);
|
|
5623
5301
|
}
|
|
5624
|
-
|
|
5625
5302
|
return vm;
|
|
5626
5303
|
}
|
|
5627
5304
|
function getAssociatedVMIfPresent(obj) {
|
|
5628
5305
|
const maybeVm = ViewModelReflection.get(obj);
|
|
5629
|
-
|
|
5630
5306
|
if (process.env.NODE_ENV !== 'production') {
|
|
5631
5307
|
if (!shared.isUndefined(maybeVm)) {
|
|
5632
5308
|
assertIsVM(maybeVm);
|
|
5633
5309
|
}
|
|
5634
5310
|
}
|
|
5635
|
-
|
|
5636
5311
|
return maybeVm;
|
|
5637
5312
|
}
|
|
5638
|
-
|
|
5639
5313
|
function rehydrate(vm) {
|
|
5640
5314
|
if (shared.isTrue(vm.isDirty)) {
|
|
5641
5315
|
const children = renderComponent(vm);
|
|
5642
5316
|
patchShadowRoot(vm, children);
|
|
5643
5317
|
}
|
|
5644
5318
|
}
|
|
5645
|
-
|
|
5646
5319
|
function patchShadowRoot(vm, newCh) {
|
|
5647
5320
|
const {
|
|
5648
5321
|
renderRoot,
|
|
5649
5322
|
children: oldCh,
|
|
5650
5323
|
renderer
|
|
5651
|
-
} = vm;
|
|
5652
|
-
|
|
5324
|
+
} = vm;
|
|
5325
|
+
// caching the new children collection
|
|
5653
5326
|
vm.children = newCh;
|
|
5654
|
-
|
|
5655
5327
|
if (newCh.length > 0 || oldCh.length > 0) {
|
|
5656
5328
|
// patch function mutates vnodes by adding the element reference,
|
|
5657
5329
|
// however, if patching fails it contains partial changes.
|
|
5658
5330
|
if (oldCh !== newCh) {
|
|
5659
5331
|
runWithBoundaryProtection(vm, vm, () => {
|
|
5660
5332
|
// pre
|
|
5661
|
-
logOperationStart(2
|
|
5662
|
-
/* OperationId.Patch */
|
|
5663
|
-
, vm);
|
|
5333
|
+
logOperationStart(2 /* OperationId.Patch */, vm);
|
|
5664
5334
|
}, () => {
|
|
5665
5335
|
// job
|
|
5666
5336
|
patchChildren(oldCh, newCh, renderRoot, renderer);
|
|
5667
5337
|
}, () => {
|
|
5668
5338
|
// post
|
|
5669
|
-
logOperationEnd(2
|
|
5670
|
-
/* OperationId.Patch */
|
|
5671
|
-
, vm);
|
|
5339
|
+
logOperationEnd(2 /* OperationId.Patch */, vm);
|
|
5672
5340
|
});
|
|
5673
5341
|
}
|
|
5674
5342
|
}
|
|
5675
|
-
|
|
5676
|
-
if (vm.state === 1
|
|
5677
|
-
/* VMState.connected */
|
|
5678
|
-
) {
|
|
5343
|
+
if (vm.state === 1 /* VMState.connected */) {
|
|
5679
5344
|
// If the element is connected, that means connectedCallback was already issued, and
|
|
5680
5345
|
// any successive rendering should finish with the call to renderedCallback, otherwise
|
|
5681
5346
|
// the connectedCallback will take care of calling it in the right order at the end of
|
|
@@ -5683,53 +5348,37 @@ function patchShadowRoot(vm, newCh) {
|
|
|
5683
5348
|
runRenderedCallback(vm);
|
|
5684
5349
|
}
|
|
5685
5350
|
}
|
|
5686
|
-
|
|
5687
5351
|
function runRenderedCallback(vm) {
|
|
5688
5352
|
const {
|
|
5689
5353
|
def: {
|
|
5690
5354
|
renderedCallback
|
|
5691
5355
|
}
|
|
5692
5356
|
} = vm;
|
|
5693
|
-
|
|
5694
5357
|
if (!process.env.IS_BROWSER) {
|
|
5695
5358
|
return;
|
|
5696
5359
|
}
|
|
5697
|
-
|
|
5698
5360
|
const {
|
|
5699
5361
|
rendered
|
|
5700
5362
|
} = Services;
|
|
5701
|
-
|
|
5702
5363
|
if (rendered) {
|
|
5703
5364
|
invokeServiceHook(vm, rendered);
|
|
5704
5365
|
}
|
|
5705
|
-
|
|
5706
5366
|
if (!shared.isUndefined(renderedCallback)) {
|
|
5707
|
-
logOperationStart(4
|
|
5708
|
-
/* OperationId.RenderedCallback */
|
|
5709
|
-
, vm);
|
|
5367
|
+
logOperationStart(4 /* OperationId.RenderedCallback */, vm);
|
|
5710
5368
|
invokeComponentCallback(vm, renderedCallback);
|
|
5711
|
-
logOperationEnd(4
|
|
5712
|
-
/* OperationId.RenderedCallback */
|
|
5713
|
-
, vm);
|
|
5369
|
+
logOperationEnd(4 /* OperationId.RenderedCallback */, vm);
|
|
5714
5370
|
}
|
|
5715
5371
|
}
|
|
5716
5372
|
let rehydrateQueue = [];
|
|
5717
|
-
|
|
5718
5373
|
function flushRehydrationQueue() {
|
|
5719
|
-
logGlobalOperationStart(8
|
|
5720
|
-
/* OperationId.GlobalRehydrate */
|
|
5721
|
-
);
|
|
5722
|
-
|
|
5374
|
+
logGlobalOperationStart(8 /* OperationId.GlobalRehydrate */);
|
|
5723
5375
|
if (process.env.NODE_ENV !== 'production') {
|
|
5724
5376
|
shared.assert.invariant(rehydrateQueue.length, `If rehydrateQueue was scheduled, it is because there must be at least one VM on this pending queue instead of ${rehydrateQueue}.`);
|
|
5725
5377
|
}
|
|
5726
|
-
|
|
5727
5378
|
const vms = rehydrateQueue.sort((a, b) => a.idx - b.idx);
|
|
5728
5379
|
rehydrateQueue = []; // reset to a new queue
|
|
5729
|
-
|
|
5730
5380
|
for (let i = 0, len = vms.length; i < len; i += 1) {
|
|
5731
5381
|
const vm = vms[i];
|
|
5732
|
-
|
|
5733
5382
|
try {
|
|
5734
5383
|
rehydrate(vm);
|
|
5735
5384
|
} catch (error) {
|
|
@@ -5738,78 +5387,54 @@ function flushRehydrationQueue() {
|
|
|
5738
5387
|
if (rehydrateQueue.length === 0) {
|
|
5739
5388
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
5740
5389
|
}
|
|
5741
|
-
|
|
5742
5390
|
shared.ArrayUnshift.apply(rehydrateQueue, shared.ArraySlice.call(vms, i + 1));
|
|
5743
|
-
}
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
/* OperationId.GlobalRehydrate */
|
|
5748
|
-
); // re-throwing the original error will break the current tick, but since the next tick is
|
|
5391
|
+
}
|
|
5392
|
+
// we need to end the measure before throwing.
|
|
5393
|
+
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
|
5394
|
+
// re-throwing the original error will break the current tick, but since the next tick is
|
|
5749
5395
|
// already scheduled, it should continue patching the rest.
|
|
5750
|
-
|
|
5751
5396
|
throw error; // eslint-disable-line no-unsafe-finally
|
|
5752
5397
|
}
|
|
5753
5398
|
}
|
|
5754
5399
|
|
|
5755
|
-
logGlobalOperationEnd(8
|
|
5756
|
-
/* OperationId.GlobalRehydrate */
|
|
5757
|
-
);
|
|
5400
|
+
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
|
5758
5401
|
}
|
|
5759
5402
|
|
|
5760
5403
|
function runConnectedCallback(vm) {
|
|
5761
5404
|
const {
|
|
5762
5405
|
state
|
|
5763
5406
|
} = vm;
|
|
5764
|
-
|
|
5765
|
-
if (state === 1
|
|
5766
|
-
/* VMState.connected */
|
|
5767
|
-
) {
|
|
5407
|
+
if (state === 1 /* VMState.connected */) {
|
|
5768
5408
|
return; // nothing to do since it was already connected
|
|
5769
5409
|
}
|
|
5770
5410
|
|
|
5771
|
-
vm.state = 1
|
|
5772
|
-
|
|
5773
|
-
; // reporting connection
|
|
5774
|
-
|
|
5411
|
+
vm.state = 1 /* VMState.connected */;
|
|
5412
|
+
// reporting connection
|
|
5775
5413
|
const {
|
|
5776
5414
|
connected
|
|
5777
5415
|
} = Services;
|
|
5778
|
-
|
|
5779
5416
|
if (connected) {
|
|
5780
5417
|
invokeServiceHook(vm, connected);
|
|
5781
5418
|
}
|
|
5782
|
-
|
|
5783
5419
|
if (hasWireAdapters(vm)) {
|
|
5784
5420
|
connectWireAdapters(vm);
|
|
5785
5421
|
}
|
|
5786
|
-
|
|
5787
5422
|
const {
|
|
5788
5423
|
connectedCallback
|
|
5789
5424
|
} = vm.def;
|
|
5790
|
-
|
|
5791
5425
|
if (!shared.isUndefined(connectedCallback)) {
|
|
5792
|
-
logOperationStart(3
|
|
5793
|
-
/* OperationId.ConnectedCallback */
|
|
5794
|
-
, vm);
|
|
5426
|
+
logOperationStart(3 /* OperationId.ConnectedCallback */, vm);
|
|
5795
5427
|
invokeComponentCallback(vm, connectedCallback);
|
|
5796
|
-
logOperationEnd(3
|
|
5797
|
-
/* OperationId.ConnectedCallback */
|
|
5798
|
-
, vm);
|
|
5428
|
+
logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
|
|
5799
5429
|
}
|
|
5800
5430
|
}
|
|
5801
|
-
|
|
5802
5431
|
function hasWireAdapters(vm) {
|
|
5803
5432
|
return shared.getOwnPropertyNames(vm.def.wire).length > 0;
|
|
5804
5433
|
}
|
|
5805
|
-
|
|
5806
5434
|
function runDisconnectedCallback(vm) {
|
|
5807
5435
|
if (process.env.NODE_ENV !== 'production') {
|
|
5808
|
-
shared.assert.isTrue(vm.state !== 2
|
|
5809
|
-
/* VMState.disconnected */
|
|
5810
|
-
, `${vm} must be inserted.`);
|
|
5436
|
+
shared.assert.isTrue(vm.state !== 2 /* VMState.disconnected */, `${vm} must be inserted.`);
|
|
5811
5437
|
}
|
|
5812
|
-
|
|
5813
5438
|
if (shared.isFalse(vm.isDirty)) {
|
|
5814
5439
|
// this guarantees that if the component is reused/reinserted,
|
|
5815
5440
|
// it will be re-rendered because we are disconnecting the reactivity
|
|
@@ -5817,67 +5442,54 @@ function runDisconnectedCallback(vm) {
|
|
|
5817
5442
|
// of disconnected components.
|
|
5818
5443
|
vm.isDirty = true;
|
|
5819
5444
|
}
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
/* VMState.disconnected */
|
|
5823
|
-
; // reporting disconnection
|
|
5824
|
-
|
|
5445
|
+
vm.state = 2 /* VMState.disconnected */;
|
|
5446
|
+
// reporting disconnection
|
|
5825
5447
|
const {
|
|
5826
5448
|
disconnected
|
|
5827
5449
|
} = Services;
|
|
5828
|
-
|
|
5829
5450
|
if (disconnected) {
|
|
5830
5451
|
invokeServiceHook(vm, disconnected);
|
|
5831
5452
|
}
|
|
5832
|
-
|
|
5833
5453
|
if (hasWireAdapters(vm)) {
|
|
5834
5454
|
disconnectWireAdapters(vm);
|
|
5835
5455
|
}
|
|
5836
|
-
|
|
5837
5456
|
const {
|
|
5838
5457
|
disconnectedCallback
|
|
5839
5458
|
} = vm.def;
|
|
5840
|
-
|
|
5841
5459
|
if (!shared.isUndefined(disconnectedCallback)) {
|
|
5842
|
-
logOperationStart(5
|
|
5843
|
-
/* OperationId.DisconnectedCallback */
|
|
5844
|
-
, vm);
|
|
5460
|
+
logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
|
|
5845
5461
|
invokeComponentCallback(vm, disconnectedCallback);
|
|
5846
|
-
logOperationEnd(5
|
|
5847
|
-
/* OperationId.DisconnectedCallback */
|
|
5848
|
-
, vm);
|
|
5462
|
+
logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
|
|
5849
5463
|
}
|
|
5850
5464
|
}
|
|
5851
|
-
|
|
5852
5465
|
function runChildNodesDisconnectedCallback(vm) {
|
|
5853
5466
|
const {
|
|
5854
5467
|
velements: vCustomElementCollection
|
|
5855
|
-
} = vm;
|
|
5468
|
+
} = vm;
|
|
5469
|
+
// Reporting disconnection for every child in inverse order since they are
|
|
5856
5470
|
// inserted in reserved order.
|
|
5857
|
-
|
|
5858
5471
|
for (let i = vCustomElementCollection.length - 1; i >= 0; i -= 1) {
|
|
5859
5472
|
const {
|
|
5860
5473
|
elm
|
|
5861
|
-
} = vCustomElementCollection[i];
|
|
5474
|
+
} = vCustomElementCollection[i];
|
|
5475
|
+
// There are two cases where the element could be undefined:
|
|
5862
5476
|
// * when there is an error during the construction phase, and an error
|
|
5863
5477
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
5864
5478
|
// is not properly initialized, and therefore is should be ignored.
|
|
5865
5479
|
// * when slotted custom element is not used by the element where it is
|
|
5866
5480
|
// slotted into it, as a result, the custom element was never
|
|
5867
5481
|
// initialized.
|
|
5868
|
-
|
|
5869
5482
|
if (!shared.isUndefined(elm)) {
|
|
5870
|
-
const childVM = getAssociatedVMIfPresent(elm);
|
|
5483
|
+
const childVM = getAssociatedVMIfPresent(elm);
|
|
5484
|
+
// The VM associated with the element might be associated undefined
|
|
5871
5485
|
// in the case where the VM failed in the middle of its creation,
|
|
5872
5486
|
// eg: constructor throwing before invoking super().
|
|
5873
|
-
|
|
5874
5487
|
if (!shared.isUndefined(childVM)) {
|
|
5875
5488
|
resetComponentStateWhenRemoved(childVM);
|
|
5876
5489
|
}
|
|
5877
5490
|
}
|
|
5878
5491
|
}
|
|
5879
5492
|
}
|
|
5880
|
-
|
|
5881
5493
|
function runLightChildNodesDisconnectedCallback(vm) {
|
|
5882
5494
|
const {
|
|
5883
5495
|
aChildren: adoptedChildren
|
|
@@ -5891,23 +5503,15 @@ function runLightChildNodesDisconnectedCallback(vm) {
|
|
|
5891
5503
|
* custom element itself will trigger the removal of anything slotted or anything
|
|
5892
5504
|
* defined on its shadow.
|
|
5893
5505
|
*/
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
5506
|
function recursivelyDisconnectChildren(vnodes) {
|
|
5897
5507
|
for (let i = 0, len = vnodes.length; i < len; i += 1) {
|
|
5898
5508
|
const vnode = vnodes[i];
|
|
5899
|
-
|
|
5900
5509
|
if (!shared.isNull(vnode) && !shared.isUndefined(vnode.elm)) {
|
|
5901
5510
|
switch (vnode.type) {
|
|
5902
|
-
case 2
|
|
5903
|
-
/* VNodeType.Element */
|
|
5904
|
-
:
|
|
5511
|
+
case 2 /* VNodeType.Element */:
|
|
5905
5512
|
recursivelyDisconnectChildren(vnode.children);
|
|
5906
5513
|
break;
|
|
5907
|
-
|
|
5908
|
-
case 3
|
|
5909
|
-
/* VNodeType.CustomElement */
|
|
5910
|
-
:
|
|
5514
|
+
case 3 /* VNodeType.CustomElement */:
|
|
5911
5515
|
{
|
|
5912
5516
|
const vm = getAssociatedVM(vnode.elm);
|
|
5913
5517
|
resetComponentStateWhenRemoved(vm);
|
|
@@ -5916,12 +5520,11 @@ function recursivelyDisconnectChildren(vnodes) {
|
|
|
5916
5520
|
}
|
|
5917
5521
|
}
|
|
5918
5522
|
}
|
|
5919
|
-
}
|
|
5523
|
+
}
|
|
5524
|
+
// This is a super optimized mechanism to remove the content of the root node (shadow root
|
|
5920
5525
|
// for shadow DOM components and the root element itself for light DOM) without having to go
|
|
5921
5526
|
// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
|
|
5922
5527
|
// children VNodes might not be representing the current state of the DOM.
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
5528
|
function resetComponentRoot(vm) {
|
|
5926
5529
|
const {
|
|
5927
5530
|
children,
|
|
@@ -5930,15 +5533,12 @@ function resetComponentRoot(vm) {
|
|
|
5930
5533
|
remove
|
|
5931
5534
|
}
|
|
5932
5535
|
} = vm;
|
|
5933
|
-
|
|
5934
5536
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5935
5537
|
const child = children[i];
|
|
5936
|
-
|
|
5937
5538
|
if (!shared.isNull(child) && !shared.isUndefined(child.elm)) {
|
|
5938
5539
|
remove(child.elm, renderRoot);
|
|
5939
5540
|
}
|
|
5940
5541
|
}
|
|
5941
|
-
|
|
5942
5542
|
vm.children = EmptyArray;
|
|
5943
5543
|
runChildNodesDisconnectedCallback(vm);
|
|
5944
5544
|
vm.velements = EmptyArray;
|
|
@@ -5947,58 +5547,43 @@ function scheduleRehydration(vm) {
|
|
|
5947
5547
|
if (!process.env.IS_BROWSER || shared.isTrue(vm.isScheduled)) {
|
|
5948
5548
|
return;
|
|
5949
5549
|
}
|
|
5950
|
-
|
|
5951
5550
|
vm.isScheduled = true;
|
|
5952
|
-
|
|
5953
5551
|
if (rehydrateQueue.length === 0) {
|
|
5954
5552
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
5955
5553
|
}
|
|
5956
|
-
|
|
5957
5554
|
shared.ArrayPush.call(rehydrateQueue, vm);
|
|
5958
5555
|
}
|
|
5959
|
-
|
|
5960
5556
|
function getErrorBoundaryVM(vm) {
|
|
5961
5557
|
let currentVm = vm;
|
|
5962
|
-
|
|
5963
5558
|
while (!shared.isNull(currentVm)) {
|
|
5964
5559
|
if (!shared.isUndefined(currentVm.def.errorCallback)) {
|
|
5965
5560
|
return currentVm;
|
|
5966
5561
|
}
|
|
5967
|
-
|
|
5968
5562
|
currentVm = currentVm.owner;
|
|
5969
5563
|
}
|
|
5970
5564
|
}
|
|
5971
|
-
|
|
5972
5565
|
function runWithBoundaryProtection(vm, owner, pre, job, post) {
|
|
5973
5566
|
let error;
|
|
5974
5567
|
pre();
|
|
5975
|
-
|
|
5976
5568
|
try {
|
|
5977
5569
|
job();
|
|
5978
5570
|
} catch (e) {
|
|
5979
5571
|
error = Object(e);
|
|
5980
5572
|
} finally {
|
|
5981
5573
|
post();
|
|
5982
|
-
|
|
5983
5574
|
if (!shared.isUndefined(error)) {
|
|
5984
5575
|
addErrorComponentStack(vm, error);
|
|
5985
5576
|
const errorBoundaryVm = shared.isNull(owner) ? undefined : getErrorBoundaryVM(owner);
|
|
5986
|
-
|
|
5987
5577
|
if (shared.isUndefined(errorBoundaryVm)) {
|
|
5988
5578
|
throw error; // eslint-disable-line no-unsafe-finally
|
|
5989
5579
|
}
|
|
5990
5580
|
|
|
5991
5581
|
resetComponentRoot(vm); // remove offenders
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
/* OperationId.ErrorCallback */
|
|
5995
|
-
, vm); // error boundaries must have an ErrorCallback
|
|
5996
|
-
|
|
5582
|
+
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
5583
|
+
// error boundaries must have an ErrorCallback
|
|
5997
5584
|
const errorCallback = errorBoundaryVm.def.errorCallback;
|
|
5998
5585
|
invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
|
|
5999
|
-
logOperationEnd(6
|
|
6000
|
-
/* OperationId.ErrorCallback */
|
|
6001
|
-
, vm);
|
|
5586
|
+
logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
|
|
6002
5587
|
}
|
|
6003
5588
|
}
|
|
6004
5589
|
}
|
|
@@ -6012,7 +5597,6 @@ function forceRehydration(vm) {
|
|
|
6012
5597
|
// content of the shadowRoot, this way we can guarantee that all children
|
|
6013
5598
|
// elements will be throw away, and new instances will be created.
|
|
6014
5599
|
vm.cmpTemplate = () => [];
|
|
6015
|
-
|
|
6016
5600
|
if (shared.isFalse(vm.isDirty)) {
|
|
6017
5601
|
// forcing the vm to rehydrate in the next tick
|
|
6018
5602
|
markComponentAsDirty(vm);
|
|
@@ -6028,6 +5612,7 @@ function forceRehydration(vm) {
|
|
|
6028
5612
|
*/
|
|
6029
5613
|
const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
|
|
6030
5614
|
const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
|
|
5615
|
+
const WIRE_DEBUG_ENTRY = '@wire';
|
|
6031
5616
|
const WireMetaMap = new Map();
|
|
6032
5617
|
class WireContextRegistrationEvent extends CustomEvent {
|
|
6033
5618
|
constructor(adapterToken, {
|
|
@@ -6047,15 +5632,12 @@ class WireContextRegistrationEvent extends CustomEvent {
|
|
|
6047
5632
|
}
|
|
6048
5633
|
});
|
|
6049
5634
|
}
|
|
6050
|
-
|
|
6051
5635
|
}
|
|
6052
|
-
|
|
6053
5636
|
function createFieldDataCallback(vm, name) {
|
|
6054
5637
|
return value => {
|
|
6055
5638
|
updateComponentValue(vm, name, value);
|
|
6056
5639
|
};
|
|
6057
5640
|
}
|
|
6058
|
-
|
|
6059
5641
|
function createMethodDataCallback(vm, method) {
|
|
6060
5642
|
return value => {
|
|
6061
5643
|
// dispatching new value into the wired method
|
|
@@ -6065,45 +5647,40 @@ function createMethodDataCallback(vm, method) {
|
|
|
6065
5647
|
}, shared.noop);
|
|
6066
5648
|
};
|
|
6067
5649
|
}
|
|
6068
|
-
|
|
6069
5650
|
function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
|
|
6070
|
-
let hasPendingConfig = false;
|
|
6071
|
-
|
|
5651
|
+
let hasPendingConfig = false;
|
|
5652
|
+
// creating the reactive observer for reactive params when needed
|
|
6072
5653
|
const ro = createReactiveObserver(() => {
|
|
6073
5654
|
if (hasPendingConfig === false) {
|
|
6074
|
-
hasPendingConfig = true;
|
|
6075
|
-
|
|
5655
|
+
hasPendingConfig = true;
|
|
5656
|
+
// collect new config in the micro-task
|
|
6076
5657
|
Promise.resolve().then(() => {
|
|
6077
|
-
hasPendingConfig = false;
|
|
6078
|
-
|
|
6079
|
-
ro.reset();
|
|
6080
|
-
|
|
5658
|
+
hasPendingConfig = false;
|
|
5659
|
+
// resetting current reactive params
|
|
5660
|
+
ro.reset();
|
|
5661
|
+
// dispatching a new config due to a change in the configuration
|
|
6081
5662
|
computeConfigAndUpdate();
|
|
6082
5663
|
});
|
|
6083
5664
|
}
|
|
6084
5665
|
});
|
|
6085
|
-
|
|
6086
5666
|
const computeConfigAndUpdate = () => {
|
|
6087
5667
|
let config;
|
|
6088
|
-
ro.observe(() => config = configCallback(component));
|
|
5668
|
+
ro.observe(() => config = configCallback(component));
|
|
5669
|
+
// eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
|
|
6089
5670
|
// TODO: dev-mode validation of config based on the adapter.configSchema
|
|
6090
5671
|
// @ts-ignore it is assigned in the observe() callback
|
|
6091
|
-
|
|
6092
5672
|
callbackWhenConfigIsReady(config);
|
|
6093
5673
|
};
|
|
6094
|
-
|
|
6095
5674
|
return {
|
|
6096
5675
|
computeConfigAndUpdate,
|
|
6097
5676
|
ro
|
|
6098
5677
|
};
|
|
6099
5678
|
}
|
|
6100
|
-
|
|
6101
5679
|
function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
6102
5680
|
const {
|
|
6103
5681
|
adapter
|
|
6104
5682
|
} = wireDef;
|
|
6105
5683
|
const adapterContextToken = getAdapterToken(adapter);
|
|
6106
|
-
|
|
6107
5684
|
if (shared.isUndefined(adapterContextToken)) {
|
|
6108
5685
|
return; // no provider found, nothing to be done
|
|
6109
5686
|
}
|
|
@@ -6117,8 +5694,8 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
6117
5694
|
renderer: {
|
|
6118
5695
|
dispatchEvent
|
|
6119
5696
|
}
|
|
6120
|
-
} = vm;
|
|
6121
|
-
|
|
5697
|
+
} = vm;
|
|
5698
|
+
// waiting for the component to be connected to formally request the context via the token
|
|
6122
5699
|
shared.ArrayPush.call(wiredConnecting, () => {
|
|
6123
5700
|
// This event is responsible for connecting the host element with another
|
|
6124
5701
|
// element in the composed path that is providing contextual data. The provider
|
|
@@ -6131,18 +5708,15 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
|
|
|
6131
5708
|
// TODO: dev-mode validation of config based on the adapter.contextSchema
|
|
6132
5709
|
callbackWhenContextIsReady(newContext);
|
|
6133
5710
|
},
|
|
6134
|
-
|
|
6135
5711
|
setDisconnectedCallback(disconnectCallback) {
|
|
6136
5712
|
// adds this callback into the disconnect bucket so it gets disconnected from parent
|
|
6137
5713
|
// the the element hosting the wire is disconnected
|
|
6138
5714
|
shared.ArrayPush.call(wiredDisconnecting, disconnectCallback);
|
|
6139
5715
|
}
|
|
6140
|
-
|
|
6141
5716
|
});
|
|
6142
5717
|
dispatchEvent(elm, contextRegistrationEvent);
|
|
6143
5718
|
});
|
|
6144
5719
|
}
|
|
6145
|
-
|
|
6146
5720
|
function createConnector(vm, name, wireDef) {
|
|
6147
5721
|
const {
|
|
6148
5722
|
method,
|
|
@@ -6150,10 +5724,27 @@ function createConnector(vm, name, wireDef) {
|
|
|
6150
5724
|
configCallback,
|
|
6151
5725
|
dynamic
|
|
6152
5726
|
} = wireDef;
|
|
6153
|
-
|
|
5727
|
+
let debugInfo;
|
|
5728
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5729
|
+
const wiredPropOrMethod = shared.isUndefined(method) ? name : method.name;
|
|
5730
|
+
debugInfo = shared.create(null);
|
|
5731
|
+
debugInfo.wasDataProvisionedForConfig = false;
|
|
5732
|
+
vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
|
|
5733
|
+
}
|
|
5734
|
+
const fieldOrMethodCallback = shared.isUndefined(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
|
|
5735
|
+
const dataCallback = value => {
|
|
5736
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5737
|
+
debugInfo.data = value;
|
|
5738
|
+
// Note: most of the time, the data provided is for the current config, but there may be
|
|
5739
|
+
// some conditions in which it does not, ex:
|
|
5740
|
+
// race conditions in a poor network while the adapter does not cancel a previous request.
|
|
5741
|
+
debugInfo.wasDataProvisionedForConfig = true;
|
|
5742
|
+
}
|
|
5743
|
+
fieldOrMethodCallback(value);
|
|
5744
|
+
};
|
|
6154
5745
|
let context;
|
|
6155
|
-
let connector;
|
|
6156
|
-
|
|
5746
|
+
let connector;
|
|
5747
|
+
// Workaround to pass the component element associated to this wire adapter instance.
|
|
6157
5748
|
shared.defineProperty(dataCallback, DeprecatedWiredElementHost, {
|
|
6158
5749
|
value: vm.elm
|
|
6159
5750
|
});
|
|
@@ -6164,41 +5755,41 @@ function createConnector(vm, name, wireDef) {
|
|
|
6164
5755
|
// job
|
|
6165
5756
|
connector = new adapter(dataCallback);
|
|
6166
5757
|
}, shared.noop);
|
|
6167
|
-
|
|
6168
5758
|
const updateConnectorConfig = config => {
|
|
6169
5759
|
// every time the config is recomputed due to tracking,
|
|
6170
5760
|
// this callback will be invoked with the new computed config
|
|
6171
5761
|
runWithBoundaryProtection(vm, vm, shared.noop, () => {
|
|
6172
5762
|
// job
|
|
5763
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
5764
|
+
debugInfo.config = config;
|
|
5765
|
+
debugInfo.context = context;
|
|
5766
|
+
debugInfo.wasDataProvisionedForConfig = false;
|
|
5767
|
+
}
|
|
6173
5768
|
connector.update(config, context);
|
|
6174
5769
|
}, shared.noop);
|
|
6175
|
-
};
|
|
5770
|
+
};
|
|
5771
|
+
// Computes the current wire config and calls the update method on the wire adapter.
|
|
6176
5772
|
// If it has params, we will need to observe changes in the next tick.
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
5773
|
const {
|
|
6180
5774
|
computeConfigAndUpdate,
|
|
6181
5775
|
ro
|
|
6182
|
-
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
6183
|
-
|
|
5776
|
+
} = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
|
|
5777
|
+
// if the adapter needs contextualization, we need to watch for new context and push it alongside the config
|
|
6184
5778
|
if (!shared.isUndefined(adapter.contextSchema)) {
|
|
6185
5779
|
createContextWatcher(vm, wireDef, newContext => {
|
|
6186
5780
|
// every time the context is pushed into this component,
|
|
6187
5781
|
// this callback will be invoked with the new computed context
|
|
6188
5782
|
if (context !== newContext) {
|
|
6189
|
-
context = newContext;
|
|
5783
|
+
context = newContext;
|
|
5784
|
+
// Note: when new context arrives, the config will be recomputed and pushed along side the new
|
|
6190
5785
|
// context, this is to preserve the identity characteristics, config should not have identity
|
|
6191
5786
|
// (ever), while context can have identity
|
|
6192
|
-
|
|
6193
|
-
if (vm.state === 1
|
|
6194
|
-
/* VMState.connected */
|
|
6195
|
-
) {
|
|
5787
|
+
if (vm.state === 1 /* VMState.connected */) {
|
|
6196
5788
|
computeConfigAndUpdate();
|
|
6197
5789
|
}
|
|
6198
5790
|
}
|
|
6199
5791
|
});
|
|
6200
5792
|
}
|
|
6201
|
-
|
|
6202
5793
|
return {
|
|
6203
5794
|
// @ts-ignore the boundary protection executes sync, connector is always defined
|
|
6204
5795
|
connector,
|
|
@@ -6206,7 +5797,6 @@ function createConnector(vm, name, wireDef) {
|
|
|
6206
5797
|
resetConfigWatcher: () => ro.reset()
|
|
6207
5798
|
};
|
|
6208
5799
|
}
|
|
6209
|
-
|
|
6210
5800
|
const AdapterToTokenMap = new Map();
|
|
6211
5801
|
function getAdapterToken(adapter) {
|
|
6212
5802
|
return AdapterToTokenMap.get(adapter);
|
|
@@ -6219,7 +5809,6 @@ function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
|
|
|
6219
5809
|
if (adapter.adapter) {
|
|
6220
5810
|
adapter = adapter.adapter;
|
|
6221
5811
|
}
|
|
6222
|
-
|
|
6223
5812
|
const method = descriptor.value;
|
|
6224
5813
|
const def = {
|
|
6225
5814
|
adapter,
|
|
@@ -6234,7 +5823,6 @@ function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
|
|
|
6234
5823
|
if (adapter.adapter) {
|
|
6235
5824
|
adapter = adapter.adapter;
|
|
6236
5825
|
}
|
|
6237
|
-
|
|
6238
5826
|
const def = {
|
|
6239
5827
|
adapter,
|
|
6240
5828
|
configCallback,
|
|
@@ -6249,17 +5837,15 @@ function installWireAdapters(vm) {
|
|
|
6249
5837
|
wire
|
|
6250
5838
|
}
|
|
6251
5839
|
} = vm;
|
|
5840
|
+
vm.debugInfo[WIRE_DEBUG_ENTRY] = shared.create(null);
|
|
6252
5841
|
const wiredConnecting = context.wiredConnecting = [];
|
|
6253
5842
|
const wiredDisconnecting = context.wiredDisconnecting = [];
|
|
6254
|
-
|
|
6255
5843
|
for (const fieldNameOrMethod in wire) {
|
|
6256
5844
|
const descriptor = wire[fieldNameOrMethod];
|
|
6257
5845
|
const wireDef = WireMetaMap.get(descriptor);
|
|
6258
|
-
|
|
6259
5846
|
if (process.env.NODE_ENV !== 'production') {
|
|
6260
5847
|
shared.assert.invariant(wireDef, `Internal Error: invalid wire definition found.`);
|
|
6261
5848
|
}
|
|
6262
|
-
|
|
6263
5849
|
if (!shared.isUndefined(wireDef)) {
|
|
6264
5850
|
const {
|
|
6265
5851
|
connector,
|
|
@@ -6269,14 +5855,12 @@ function installWireAdapters(vm) {
|
|
|
6269
5855
|
const hasDynamicParams = wireDef.dynamic.length > 0;
|
|
6270
5856
|
shared.ArrayPush.call(wiredConnecting, () => {
|
|
6271
5857
|
connector.connect();
|
|
6272
|
-
|
|
6273
5858
|
if (!features.lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
6274
5859
|
if (hasDynamicParams) {
|
|
6275
5860
|
Promise.resolve().then(computeConfigAndUpdate);
|
|
6276
5861
|
return;
|
|
6277
5862
|
}
|
|
6278
5863
|
}
|
|
6279
|
-
|
|
6280
5864
|
computeConfigAndUpdate();
|
|
6281
5865
|
});
|
|
6282
5866
|
shared.ArrayPush.call(wiredDisconnecting, () => {
|
|
@@ -6290,7 +5874,6 @@ function connectWireAdapters(vm) {
|
|
|
6290
5874
|
const {
|
|
6291
5875
|
wiredConnecting
|
|
6292
5876
|
} = vm.context;
|
|
6293
|
-
|
|
6294
5877
|
for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
|
|
6295
5878
|
wiredConnecting[i]();
|
|
6296
5879
|
}
|
|
@@ -6942,4 +6525,4 @@ exports.swapTemplate = swapTemplate;
|
|
|
6942
6525
|
exports.track = track;
|
|
6943
6526
|
exports.unwrap = unwrap;
|
|
6944
6527
|
exports.wire = wire;
|
|
6945
|
-
/* version: 2.
|
|
6528
|
+
/* version: 2.30.0 */
|