lwc 2.3.3 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +360 -198
- package/dist/engine-dom/iife/es2017/engine-dom.js +360 -198
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +361 -168
- package/dist/engine-dom/iife/es5/engine-dom.js +371 -218
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +370 -186
- package/dist/engine-dom/umd/es2017/engine-dom.js +360 -198
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +361 -168
- package/dist/engine-dom/umd/es5/engine-dom.js +371 -218
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +370 -186
- package/dist/engine-server/commonjs/es2017/engine-server.js +304 -205
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +304 -205
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +29 -16
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +29 -16
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +29 -16
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +31 -16
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +31 -16
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +29 -16
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +29 -16
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +31 -16
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +31 -16
- 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 +3 -3
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
- 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 +3 -3
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +3 -3
- package/package.json +8 -8
|
@@ -29,7 +29,7 @@ var LWC = (function (exports) {
|
|
|
29
29
|
|
|
30
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf2(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf2(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
31
31
|
|
|
32
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
32
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
33
33
|
|
|
34
34
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
35
35
|
|
|
@@ -151,6 +151,10 @@ var LWC = (function (exports) {
|
|
|
151
151
|
return obj === false;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
function isBoolean(obj) {
|
|
155
|
+
return typeof obj === 'boolean';
|
|
156
|
+
}
|
|
157
|
+
|
|
154
158
|
function isFunction$1(obj) {
|
|
155
159
|
return typeof obj === 'function';
|
|
156
160
|
}
|
|
@@ -294,6 +298,7 @@ var LWC = (function (exports) {
|
|
|
294
298
|
var KEY__SHADOW_RESOLVER = '$shadowResolver$';
|
|
295
299
|
var KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
296
300
|
var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
301
|
+
var KEY__SCOPED_CSS = '$scoped$';
|
|
297
302
|
/**
|
|
298
303
|
* Map composed of properties to attributes not following the HTML property to attribute mapping
|
|
299
304
|
* convention.
|
|
@@ -342,7 +347,7 @@ var LWC = (function (exports) {
|
|
|
342
347
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
343
348
|
return attributeName;
|
|
344
349
|
}
|
|
345
|
-
/** version: 2.
|
|
350
|
+
/** version: 2.5.0 */
|
|
346
351
|
|
|
347
352
|
/*
|
|
348
353
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -445,19 +450,33 @@ var LWC = (function (exports) {
|
|
|
445
450
|
*/
|
|
446
451
|
|
|
447
452
|
|
|
453
|
+
var features = {
|
|
454
|
+
ENABLE_REACTIVE_SETTER: null,
|
|
455
|
+
ENABLE_HMR: null,
|
|
456
|
+
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
457
|
+
ENABLE_ELEMENT_PATCH: null,
|
|
458
|
+
ENABLE_NODE_LIST_PATCH: null,
|
|
459
|
+
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
460
|
+
ENABLE_NODE_PATCH: null,
|
|
461
|
+
ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
|
|
462
|
+
ENABLE_MIXED_SHADOW_MODE: null,
|
|
463
|
+
ENABLE_WIRE_SYNC_EMIT: null
|
|
464
|
+
};
|
|
465
|
+
|
|
448
466
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
449
467
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
450
468
|
value: create(null)
|
|
451
469
|
});
|
|
452
470
|
}
|
|
453
471
|
|
|
454
|
-
var runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
455
|
-
|
|
472
|
+
var runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
473
|
+
/**
|
|
474
|
+
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
|
475
|
+
* flag. It is meant to be used during the app initialization.
|
|
476
|
+
*/
|
|
456
477
|
|
|
457
478
|
function setFeatureFlag(name, value) {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
if (!isBoolean) {
|
|
479
|
+
if (!isBoolean(value)) {
|
|
461
480
|
var message = "Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\". Runtime feature flags can only be set to a boolean value.");
|
|
462
481
|
|
|
463
482
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -469,9 +488,12 @@ var LWC = (function (exports) {
|
|
|
469
488
|
}
|
|
470
489
|
}
|
|
471
490
|
|
|
472
|
-
if (isUndefined$1(
|
|
473
|
-
|
|
474
|
-
|
|
491
|
+
if (isUndefined$1(features[name])) {
|
|
492
|
+
var availableFlags = keys(features).map(function (name) {
|
|
493
|
+
return "\"".concat(name, "\"");
|
|
494
|
+
}).join(', '); // eslint-disable-next-line no-console
|
|
495
|
+
|
|
496
|
+
console.warn("Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\" because it is undefined. Available flags: ").concat(availableFlags, "."));
|
|
475
497
|
return;
|
|
476
498
|
}
|
|
477
499
|
|
|
@@ -488,37 +510,23 @@ var LWC = (function (exports) {
|
|
|
488
510
|
return;
|
|
489
511
|
}
|
|
490
512
|
|
|
491
|
-
|
|
513
|
+
defineProperty(runtimeFlags, name, {
|
|
492
514
|
value: value
|
|
493
515
|
});
|
|
494
516
|
}
|
|
495
|
-
}
|
|
496
|
-
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Set the value at runtime of a given feature flag. This method should only be used for testing
|
|
520
|
+
* purposes. It is a no-op when invoked in production mode.
|
|
521
|
+
*/
|
|
497
522
|
|
|
498
523
|
|
|
499
524
|
function setFeatureFlagForTest(name, value) {
|
|
500
525
|
if (process.env.NODE_ENV !== 'production') {
|
|
501
|
-
|
|
526
|
+
setFeatureFlag(name, value);
|
|
502
527
|
}
|
|
503
528
|
}
|
|
504
|
-
|
|
505
|
-
var featureFlagLookup = {
|
|
506
|
-
ENABLE_REACTIVE_SETTER: null,
|
|
507
|
-
ENABLE_HMR: null,
|
|
508
|
-
// Flag to toggle on/off the enforcement of innerText/outerText shadow dom semantic in elements when using synthetic shadow.
|
|
509
|
-
// Note: Once active, elements outside the lwc boundary are controlled by the ENABLE_ELEMENT_PATCH flag.
|
|
510
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
511
|
-
// Flags to toggle on/off the enforcement of shadow dom semantic in element/node outside lwc boundary when using synthetic shadow.
|
|
512
|
-
ENABLE_ELEMENT_PATCH: null,
|
|
513
|
-
ENABLE_NODE_LIST_PATCH: null,
|
|
514
|
-
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
515
|
-
ENABLE_NODE_PATCH: null,
|
|
516
|
-
// Disables the fix for #2121 where non-composed events are visible outside of their shadow root.
|
|
517
|
-
ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
|
|
518
|
-
ENABLE_LIGHT_DOM_COMPONENTS: null,
|
|
519
|
-
ENABLE_MIXED_SHADOW_MODE: null
|
|
520
|
-
};
|
|
521
|
-
/** version: 2.3.3 */
|
|
529
|
+
/** version: 2.5.0 */
|
|
522
530
|
|
|
523
531
|
/* proxy-compat-disable */
|
|
524
532
|
|
|
@@ -529,6 +537,7 @@ var LWC = (function (exports) {
|
|
|
529
537
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
530
538
|
*/
|
|
531
539
|
|
|
540
|
+
|
|
532
541
|
var nextTickCallbackQueue = [];
|
|
533
542
|
var SPACE_CHAR = 32;
|
|
534
543
|
var EmptyObject = seal(create(null));
|
|
@@ -2780,12 +2789,6 @@ var LWC = (function (exports) {
|
|
|
2780
2789
|
associateVM(component, vm);
|
|
2781
2790
|
associateVM(elm, vm);
|
|
2782
2791
|
|
|
2783
|
-
if (!runtimeFlags.ENABLE_LIGHT_DOM_COMPONENTS) {
|
|
2784
|
-
assert.isTrue(def.renderMode !== 0
|
|
2785
|
-
/* Light */
|
|
2786
|
-
, "".concat(def.name || 'Anonymous class', " is an invalid LWC component. Light DOM components are not available in this environment."));
|
|
2787
|
-
}
|
|
2788
|
-
|
|
2789
2792
|
if (vm.renderMode === 1
|
|
2790
2793
|
/* Shadow */
|
|
2791
2794
|
) {
|
|
@@ -2816,6 +2819,12 @@ var LWC = (function (exports) {
|
|
|
2816
2819
|
if (process.env.NODE_ENV !== 'production') {
|
|
2817
2820
|
patchShadowRootWithRestrictions(cmpRoot);
|
|
2818
2821
|
}
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
function warnIfInvokedDuringConstruction(vm, methodName) {
|
|
2825
|
+
if (isBeingConstructed(vm)) {
|
|
2826
|
+
logError("this.".concat(methodName, "() should not be called during the construction of the custom element for ").concat(getComponentTag(vm), " because the element is not yet in the DOM or has no children yet."));
|
|
2827
|
+
}
|
|
2819
2828
|
} // @ts-ignore
|
|
2820
2829
|
|
|
2821
2830
|
|
|
@@ -2929,7 +2938,7 @@ var LWC = (function (exports) {
|
|
|
2929
2938
|
getBoundingClientRect = vm.renderer.getBoundingClientRect;
|
|
2930
2939
|
|
|
2931
2940
|
if (process.env.NODE_ENV !== 'production') {
|
|
2932
|
-
|
|
2941
|
+
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect');
|
|
2933
2942
|
}
|
|
2934
2943
|
|
|
2935
2944
|
return getBoundingClientRect(elm);
|
|
@@ -2940,7 +2949,7 @@ var LWC = (function (exports) {
|
|
|
2940
2949
|
querySelector = vm.renderer.querySelector;
|
|
2941
2950
|
|
|
2942
2951
|
if (process.env.NODE_ENV !== 'production') {
|
|
2943
|
-
|
|
2952
|
+
warnIfInvokedDuringConstruction(vm, 'querySelector');
|
|
2944
2953
|
}
|
|
2945
2954
|
|
|
2946
2955
|
return querySelector(elm, selectors);
|
|
@@ -2951,7 +2960,7 @@ var LWC = (function (exports) {
|
|
|
2951
2960
|
querySelectorAll = vm.renderer.querySelectorAll;
|
|
2952
2961
|
|
|
2953
2962
|
if (process.env.NODE_ENV !== 'production') {
|
|
2954
|
-
|
|
2963
|
+
warnIfInvokedDuringConstruction(vm, 'querySelectorAll');
|
|
2955
2964
|
}
|
|
2956
2965
|
|
|
2957
2966
|
return querySelectorAll(elm, selectors);
|
|
@@ -2962,7 +2971,7 @@ var LWC = (function (exports) {
|
|
|
2962
2971
|
getElementsByTagName = vm.renderer.getElementsByTagName;
|
|
2963
2972
|
|
|
2964
2973
|
if (process.env.NODE_ENV !== 'production') {
|
|
2965
|
-
|
|
2974
|
+
warnIfInvokedDuringConstruction(vm, 'getElementsByTagName');
|
|
2966
2975
|
}
|
|
2967
2976
|
|
|
2968
2977
|
return getElementsByTagName(elm, tagNameOrWildCard);
|
|
@@ -2973,7 +2982,7 @@ var LWC = (function (exports) {
|
|
|
2973
2982
|
getElementsByClassName = vm.renderer.getElementsByClassName;
|
|
2974
2983
|
|
|
2975
2984
|
if (process.env.NODE_ENV !== 'production') {
|
|
2976
|
-
|
|
2985
|
+
warnIfInvokedDuringConstruction(vm, 'getElementsByClassName');
|
|
2977
2986
|
}
|
|
2978
2987
|
|
|
2979
2988
|
return getElementsByClassName(elm, names);
|
|
@@ -4380,6 +4389,17 @@ var LWC = (function (exports) {
|
|
|
4380
4389
|
|
|
4381
4390
|
function setElementShadowToken(elm, token) {
|
|
4382
4391
|
elm.$shadowToken$ = token;
|
|
4392
|
+
} // Set the scope token class for *.scoped.css styles
|
|
4393
|
+
|
|
4394
|
+
|
|
4395
|
+
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
4396
|
+
var cmpTemplate = owner.cmpTemplate,
|
|
4397
|
+
context = owner.context;
|
|
4398
|
+
var token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
4399
|
+
|
|
4400
|
+
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
4401
|
+
owner.renderer.getClassList(elm).add(token);
|
|
4402
|
+
}
|
|
4383
4403
|
}
|
|
4384
4404
|
|
|
4385
4405
|
function updateNodeHook(oldVnode, vnode) {
|
|
@@ -4443,12 +4463,13 @@ var LWC = (function (exports) {
|
|
|
4443
4463
|
|
|
4444
4464
|
function fallbackElmHook(elm, vnode) {
|
|
4445
4465
|
var owner = vnode.owner;
|
|
4466
|
+
setScopeTokenClassIfNecessary(elm, owner);
|
|
4446
4467
|
|
|
4447
4468
|
if (owner.shadowMode === 1
|
|
4448
4469
|
/* Synthetic */
|
|
4449
4470
|
) {
|
|
4450
4471
|
var context = vnode.data.context;
|
|
4451
|
-
var
|
|
4472
|
+
var stylesheetToken = owner.context.stylesheetToken;
|
|
4452
4473
|
|
|
4453
4474
|
if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
4454
4475
|
/* manual */
|
|
@@ -4459,7 +4480,7 @@ var LWC = (function (exports) {
|
|
|
4459
4480
|
// into each element from the template, so they can be styled accordingly.
|
|
4460
4481
|
|
|
4461
4482
|
|
|
4462
|
-
setElementShadowToken(elm,
|
|
4483
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4463
4484
|
}
|
|
4464
4485
|
|
|
4465
4486
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4538,14 +4559,15 @@ var LWC = (function (exports) {
|
|
|
4538
4559
|
mode = vnode.mode,
|
|
4539
4560
|
ctor = vnode.ctor,
|
|
4540
4561
|
owner = vnode.owner;
|
|
4562
|
+
setScopeTokenClassIfNecessary(elm, owner);
|
|
4541
4563
|
|
|
4542
4564
|
if (owner.shadowMode === 1
|
|
4543
4565
|
/* Synthetic */
|
|
4544
4566
|
) {
|
|
4545
|
-
var
|
|
4567
|
+
var stylesheetToken = owner.context.stylesheetToken; // when running in synthetic shadow mode, we need to set the shadowToken value
|
|
4546
4568
|
// into each element from the template, so they can be styled accordingly.
|
|
4547
4569
|
|
|
4548
|
-
setElementShadowToken(elm,
|
|
4570
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4549
4571
|
}
|
|
4550
4572
|
|
|
4551
4573
|
var def = getComponentInternalDef(ctor);
|
|
@@ -4834,12 +4856,18 @@ var LWC = (function (exports) {
|
|
|
4834
4856
|
};
|
|
4835
4857
|
|
|
4836
4858
|
function linkNodeToShadow(elm, owner) {
|
|
4837
|
-
var
|
|
4859
|
+
var renderer = owner.renderer,
|
|
4860
|
+
renderMode = owner.renderMode,
|
|
4861
|
+
shadowMode = owner.shadowMode; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4838
4862
|
|
|
4839
|
-
if (
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4863
|
+
if (renderer.isSyntheticShadowDefined) {
|
|
4864
|
+
if (shadowMode === 1
|
|
4865
|
+
/* Synthetic */
|
|
4866
|
+
|| renderMode === 0
|
|
4867
|
+
/* Light */
|
|
4868
|
+
) {
|
|
4869
|
+
elm[KEY__SHADOW_RESOLVER] = getRenderRoot(owner)[KEY__SHADOW_RESOLVER];
|
|
4870
|
+
}
|
|
4843
4871
|
}
|
|
4844
4872
|
}
|
|
4845
4873
|
|
|
@@ -5176,13 +5204,10 @@ var LWC = (function (exports) {
|
|
|
5176
5204
|
}
|
|
5177
5205
|
|
|
5178
5206
|
var idx = vmBeingRendered.idx,
|
|
5179
|
-
renderMode = vmBeingRendered.renderMode,
|
|
5180
5207
|
shadowMode = vmBeingRendered.shadowMode;
|
|
5181
5208
|
|
|
5182
5209
|
if (shadowMode === 1
|
|
5183
5210
|
/* Synthetic */
|
|
5184
|
-
&& renderMode === 1
|
|
5185
|
-
/* Shadow */
|
|
5186
5211
|
) {
|
|
5187
5212
|
return StringReplace.call(id, /\S+/g, function (id) {
|
|
5188
5213
|
return "".concat(id, "-").concat(idx);
|
|
@@ -5212,13 +5237,10 @@ var LWC = (function (exports) {
|
|
|
5212
5237
|
}
|
|
5213
5238
|
|
|
5214
5239
|
var idx = vmBeingRendered.idx,
|
|
5215
|
-
renderMode = vmBeingRendered.renderMode,
|
|
5216
5240
|
shadowMode = vmBeingRendered.shadowMode; // Apply transformation only for fragment-only-urls, and only in shadow DOM
|
|
5217
5241
|
|
|
5218
5242
|
if (shadowMode === 1
|
|
5219
5243
|
/* Synthetic */
|
|
5220
|
-
&& renderMode === 1
|
|
5221
|
-
/* Shadow */
|
|
5222
5244
|
&& /^#/.test(url)) {
|
|
5223
5245
|
return "".concat(url, "-").concat(idx);
|
|
5224
5246
|
}
|
|
@@ -5319,6 +5341,10 @@ var LWC = (function (exports) {
|
|
|
5319
5341
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5320
5342
|
*/
|
|
5321
5343
|
|
|
5344
|
+
function makeHostToken(token) {
|
|
5345
|
+
return "".concat(token, "-host");
|
|
5346
|
+
}
|
|
5347
|
+
|
|
5322
5348
|
function createInlineStyleVNode(content) {
|
|
5323
5349
|
return h('style', {
|
|
5324
5350
|
key: 'style',
|
|
@@ -5328,55 +5354,92 @@ var LWC = (function (exports) {
|
|
|
5328
5354
|
}, [t(content)]);
|
|
5329
5355
|
}
|
|
5330
5356
|
|
|
5331
|
-
function
|
|
5357
|
+
function updateStylesheetToken(vm, template) {
|
|
5332
5358
|
var elm = vm.elm,
|
|
5333
5359
|
context = vm.context,
|
|
5334
5360
|
renderer = vm.renderer,
|
|
5335
|
-
renderMode = vm.renderMode
|
|
5361
|
+
renderMode = vm.renderMode,
|
|
5362
|
+
shadowMode = vm.shadowMode;
|
|
5336
5363
|
var newStylesheets = template.stylesheets,
|
|
5337
|
-
|
|
5338
|
-
var
|
|
5364
|
+
newStylesheetToken = template.stylesheetToken;
|
|
5365
|
+
var isSyntheticShadow = renderMode === 1
|
|
5366
|
+
/* Shadow */
|
|
5367
|
+
&& shadowMode === 1
|
|
5368
|
+
/* Synthetic */
|
|
5369
|
+
;
|
|
5370
|
+
var hasScopedStyles = context.hasScopedStyles;
|
|
5371
|
+
var newToken;
|
|
5372
|
+
var newHasTokenInClass;
|
|
5373
|
+
var newHasTokenInAttribute; // Reset the styling token applied to the host element.
|
|
5339
5374
|
|
|
5340
|
-
var
|
|
5375
|
+
var oldToken = context.stylesheetToken,
|
|
5376
|
+
oldHasTokenInClass = context.hasTokenInClass,
|
|
5377
|
+
oldHasTokenInAttribute = context.hasTokenInAttribute;
|
|
5341
5378
|
|
|
5342
|
-
if (
|
|
5343
|
-
renderer.
|
|
5379
|
+
if (oldHasTokenInClass) {
|
|
5380
|
+
renderer.getClassList(elm).remove(makeHostToken(oldToken));
|
|
5381
|
+
}
|
|
5382
|
+
|
|
5383
|
+
if (oldHasTokenInAttribute) {
|
|
5384
|
+
renderer.removeAttribute(elm, makeHostToken(oldToken));
|
|
5344
5385
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
5345
|
-
// associated stylesheets.
|
|
5386
|
+
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
5346
5387
|
|
|
5347
5388
|
|
|
5348
|
-
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
}
|
|
5389
|
+
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
5390
|
+
newToken = newStylesheetToken;
|
|
5391
|
+
} // Set the new styling token on the host element
|
|
5392
|
+
|
|
5353
5393
|
|
|
5354
|
-
if (!isUndefined$1(
|
|
5355
|
-
|
|
5394
|
+
if (!isUndefined$1(newToken)) {
|
|
5395
|
+
if (hasScopedStyles) {
|
|
5396
|
+
renderer.getClassList(elm).add(makeHostToken(newToken));
|
|
5397
|
+
newHasTokenInClass = true;
|
|
5398
|
+
}
|
|
5399
|
+
|
|
5400
|
+
if (isSyntheticShadow) {
|
|
5401
|
+
renderer.setAttribute(elm, makeHostToken(newToken), '');
|
|
5402
|
+
newHasTokenInAttribute = true;
|
|
5403
|
+
}
|
|
5356
5404
|
} // Update the styling tokens present on the context object.
|
|
5357
5405
|
|
|
5358
5406
|
|
|
5359
|
-
context.
|
|
5360
|
-
context.
|
|
5407
|
+
context.stylesheetToken = newToken;
|
|
5408
|
+
context.hasTokenInClass = newHasTokenInClass;
|
|
5409
|
+
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
5361
5410
|
}
|
|
5362
5411
|
|
|
5363
|
-
function evaluateStylesheetsContent(stylesheets,
|
|
5412
|
+
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
5364
5413
|
var content = [];
|
|
5365
5414
|
|
|
5366
5415
|
for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
|
|
5367
5416
|
var stylesheet = stylesheets[_i12];
|
|
5368
5417
|
|
|
5369
5418
|
if (isArray$1(stylesheet)) {
|
|
5370
|
-
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet,
|
|
5419
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
5371
5420
|
} else {
|
|
5372
5421
|
if (process.env.NODE_ENV !== 'production') {
|
|
5373
5422
|
// in dev-mode, we support hot swapping of stylesheet, which means that
|
|
5374
5423
|
// the component instance might be attempting to use an old version of
|
|
5375
5424
|
// the stylesheet, while internally, we have a replacement for it.
|
|
5376
5425
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
5377
|
-
}
|
|
5426
|
+
} // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
5427
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
5428
|
+
|
|
5429
|
+
|
|
5430
|
+
var isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
5431
|
+
var useActualHostSelector = vm.renderMode === 0
|
|
5432
|
+
/* Light */
|
|
5433
|
+
? !isScopedCss : vm.shadowMode === 0
|
|
5434
|
+
/* Native */
|
|
5435
|
+
; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
5378
5436
|
|
|
5379
|
-
|
|
5437
|
+
var scopeToken = isScopedCss || vm.shadowMode === 1
|
|
5438
|
+
/* Synthetic */
|
|
5439
|
+
&& vm.renderMode === 1
|
|
5440
|
+
/* Shadow */
|
|
5441
|
+
? stylesheetToken : undefined;
|
|
5442
|
+
ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
|
|
5380
5443
|
}
|
|
5381
5444
|
}
|
|
5382
5445
|
|
|
@@ -5385,34 +5448,35 @@ var LWC = (function (exports) {
|
|
|
5385
5448
|
|
|
5386
5449
|
function getStylesheetsContent(vm, template) {
|
|
5387
5450
|
var stylesheets = template.stylesheets,
|
|
5388
|
-
|
|
5389
|
-
var renderMode = vm.renderMode,
|
|
5390
|
-
shadowMode = vm.shadowMode;
|
|
5451
|
+
stylesheetToken = template.stylesheetToken;
|
|
5391
5452
|
var content = [];
|
|
5392
5453
|
|
|
5393
5454
|
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5455
|
+
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
5456
|
+
}
|
|
5457
|
+
|
|
5458
|
+
return content;
|
|
5459
|
+
} // It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
5460
|
+
// perf testing has not shown it to be a huge improvement yet:
|
|
5461
|
+
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
5462
|
+
|
|
5397
5463
|
|
|
5398
|
-
|
|
5464
|
+
function getNearestNativeShadowComponent(vm) {
|
|
5465
|
+
var owner = vm;
|
|
5466
|
+
|
|
5467
|
+
while (!isNull(owner)) {
|
|
5468
|
+
if (owner.renderMode === 1
|
|
5399
5469
|
/* Shadow */
|
|
5400
|
-
&& shadowMode ===
|
|
5401
|
-
/*
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
shadowSelector = "[".concat(stylesheetTokens.shadowAttribute, "]");
|
|
5405
|
-
} else {
|
|
5406
|
-
hostSelector = '';
|
|
5407
|
-
shadowSelector = '';
|
|
5470
|
+
&& owner.shadowMode === 0
|
|
5471
|
+
/* Native */
|
|
5472
|
+
) {
|
|
5473
|
+
return owner;
|
|
5408
5474
|
}
|
|
5409
5475
|
|
|
5410
|
-
|
|
5411
|
-
/* Native */
|
|
5412
|
-
);
|
|
5476
|
+
owner = owner.owner;
|
|
5413
5477
|
}
|
|
5414
5478
|
|
|
5415
|
-
return
|
|
5479
|
+
return owner;
|
|
5416
5480
|
}
|
|
5417
5481
|
|
|
5418
5482
|
function createStylesheet(vm, stylesheets) {
|
|
@@ -5428,13 +5492,26 @@ var LWC = (function (exports) {
|
|
|
5428
5492
|
for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
|
|
5429
5493
|
renderer.insertGlobalStylesheet(stylesheets[_i13]);
|
|
5430
5494
|
}
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
} else {
|
|
5434
|
-
// native shadow or light DOM
|
|
5495
|
+
} else if (renderer.ssr) {
|
|
5496
|
+
// native shadow or light DOM, SSR
|
|
5435
5497
|
var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5436
5498
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
5499
|
+
} else {
|
|
5500
|
+
// native shadow or light DOM, DOM renderer
|
|
5501
|
+
var root = getNearestNativeShadowComponent(vm);
|
|
5502
|
+
var isGlobal = isNull(root);
|
|
5503
|
+
|
|
5504
|
+
for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
|
|
5505
|
+
if (isGlobal) {
|
|
5506
|
+
renderer.insertGlobalStylesheet(stylesheets[_i14]);
|
|
5507
|
+
} else {
|
|
5508
|
+
// local level
|
|
5509
|
+
renderer.insertStylesheet(stylesheets[_i14], root.cmpRoot);
|
|
5510
|
+
}
|
|
5511
|
+
}
|
|
5437
5512
|
}
|
|
5513
|
+
|
|
5514
|
+
return null;
|
|
5438
5515
|
}
|
|
5439
5516
|
/*
|
|
5440
5517
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5632,8 +5709,7 @@ var LWC = (function (exports) {
|
|
|
5632
5709
|
context = vm.context,
|
|
5633
5710
|
cmpSlots = vm.cmpSlots,
|
|
5634
5711
|
cmpTemplate = vm.cmpTemplate,
|
|
5635
|
-
tro = vm.tro
|
|
5636
|
-
shadowMode = vm.shadowMode;
|
|
5712
|
+
tro = vm.tro;
|
|
5637
5713
|
tro.observe(function () {
|
|
5638
5714
|
// Reset the cache memoizer for template when needed.
|
|
5639
5715
|
if (html !== cmpTemplate) {
|
|
@@ -5657,15 +5733,12 @@ var LWC = (function (exports) {
|
|
|
5657
5733
|
|
|
5658
5734
|
vm.cmpTemplate = html; // Create a brand new template cache for the swapped templated.
|
|
5659
5735
|
|
|
5660
|
-
context.tplCache = create(null); //
|
|
5736
|
+
context.tplCache = create(null); // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
5661
5737
|
|
|
5662
|
-
|
|
5663
|
-
/* Synthetic */
|
|
5664
|
-
) {
|
|
5665
|
-
updateSyntheticShadowAttributes(vm, html);
|
|
5666
|
-
} // Evaluate, create stylesheet and cache the produced VNode for future
|
|
5667
|
-
// re-rendering.
|
|
5738
|
+
context.hasScopedStyles = computeHasScopedStyles(html); // Update the scoping token on the host element.
|
|
5668
5739
|
|
|
5740
|
+
updateStylesheetToken(vm, html); // Evaluate, create stylesheet and cache the produced VNode for future
|
|
5741
|
+
// re-rendering.
|
|
5669
5742
|
|
|
5670
5743
|
var stylesheetsContent = getStylesheetsContent(vm, html);
|
|
5671
5744
|
context.styleVNode = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);
|
|
@@ -5705,6 +5778,20 @@ var LWC = (function (exports) {
|
|
|
5705
5778
|
|
|
5706
5779
|
return vnodes;
|
|
5707
5780
|
}
|
|
5781
|
+
|
|
5782
|
+
function computeHasScopedStyles(template) {
|
|
5783
|
+
var stylesheets = template.stylesheets;
|
|
5784
|
+
|
|
5785
|
+
if (!isUndefined$1(stylesheets)) {
|
|
5786
|
+
for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
|
|
5787
|
+
if (isTrue(stylesheets[_i15][KEY__SCOPED_CSS])) {
|
|
5788
|
+
return true;
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5792
|
+
|
|
5793
|
+
return false;
|
|
5794
|
+
}
|
|
5708
5795
|
/*
|
|
5709
5796
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5710
5797
|
* All rights reserved.
|
|
@@ -5742,12 +5829,9 @@ var LWC = (function (exports) {
|
|
|
5742
5829
|
var component = vm.component,
|
|
5743
5830
|
callHook = vm.callHook,
|
|
5744
5831
|
owner = vm.owner;
|
|
5745
|
-
var result;
|
|
5746
5832
|
runWithBoundaryProtection(vm, owner, noop, function () {
|
|
5747
|
-
|
|
5748
|
-
result = callHook(component, fn, args);
|
|
5833
|
+
callHook(component, fn, args);
|
|
5749
5834
|
}, noop);
|
|
5750
|
-
return result;
|
|
5751
5835
|
}
|
|
5752
5836
|
|
|
5753
5837
|
function invokeComponentConstructor(vm, Ctor) {
|
|
@@ -5817,29 +5901,6 @@ var LWC = (function (exports) {
|
|
|
5817
5901
|
return renderInvocationSuccessful ? evaluateTemplate(vm, html) : [];
|
|
5818
5902
|
}
|
|
5819
5903
|
|
|
5820
|
-
function invokeComponentRenderedCallback(vm) {
|
|
5821
|
-
var renderedCallback = vm.def.renderedCallback,
|
|
5822
|
-
component = vm.component,
|
|
5823
|
-
callHook = vm.callHook,
|
|
5824
|
-
owner = vm.owner;
|
|
5825
|
-
|
|
5826
|
-
if (!isUndefined$1(renderedCallback)) {
|
|
5827
|
-
runWithBoundaryProtection(vm, owner, function () {
|
|
5828
|
-
logOperationStart(4
|
|
5829
|
-
/* RenderedCallback */
|
|
5830
|
-
, vm);
|
|
5831
|
-
}, function () {
|
|
5832
|
-
// job
|
|
5833
|
-
callHook(component, renderedCallback);
|
|
5834
|
-
}, function () {
|
|
5835
|
-
// post
|
|
5836
|
-
logOperationEnd(4
|
|
5837
|
-
/* RenderedCallback */
|
|
5838
|
-
, vm);
|
|
5839
|
-
});
|
|
5840
|
-
}
|
|
5841
|
-
}
|
|
5842
|
-
|
|
5843
5904
|
function invokeEventListener(vm, fn, thisValue, event) {
|
|
5844
5905
|
var callHook = vm.callHook,
|
|
5845
5906
|
owner = vm.owner;
|
|
@@ -5953,8 +6014,8 @@ var LWC = (function (exports) {
|
|
|
5953
6014
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
5954
6015
|
}
|
|
5955
6016
|
|
|
5956
|
-
for (var
|
|
5957
|
-
var hookName = hooks[
|
|
6017
|
+
for (var _i16 = 0; _i16 < hooks.length; ++_i16) {
|
|
6018
|
+
var hookName = hooks[_i16];
|
|
5958
6019
|
|
|
5959
6020
|
if (hookName in service) {
|
|
5960
6021
|
var l = Services[hookName];
|
|
@@ -5977,8 +6038,8 @@ var LWC = (function (exports) {
|
|
|
5977
6038
|
def = vm.def,
|
|
5978
6039
|
context = vm.context;
|
|
5979
6040
|
|
|
5980
|
-
for (var
|
|
5981
|
-
cbs[
|
|
6041
|
+
for (var _i17 = 0, _len6 = cbs.length; _i17 < _len6; ++_i17) {
|
|
6042
|
+
cbs[_i17].call(undefined, component, {}, def, context);
|
|
5982
6043
|
}
|
|
5983
6044
|
}
|
|
5984
6045
|
/*
|
|
@@ -5989,7 +6050,6 @@ var LWC = (function (exports) {
|
|
|
5989
6050
|
*/
|
|
5990
6051
|
|
|
5991
6052
|
|
|
5992
|
-
var isNativeShadowRootDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
5993
6053
|
var idx = 0;
|
|
5994
6054
|
/** The internal slot used to associate different objects the engine manipulates with the VM */
|
|
5995
6055
|
|
|
@@ -6095,50 +6155,11 @@ var LWC = (function (exports) {
|
|
|
6095
6155
|
return ancestor;
|
|
6096
6156
|
}
|
|
6097
6157
|
|
|
6098
|
-
function assertNotSyntheticComposedWithinNative(vm) {
|
|
6099
|
-
var isSynthetic = vm.renderMode === 1
|
|
6100
|
-
/* Shadow */
|
|
6101
|
-
&& vm.shadowMode === 1
|
|
6102
|
-
/* Synthetic */
|
|
6103
|
-
;
|
|
6104
|
-
|
|
6105
|
-
if (!isSynthetic) {
|
|
6106
|
-
return;
|
|
6107
|
-
}
|
|
6108
|
-
|
|
6109
|
-
var ancestor = getNearestShadowAncestor(vm);
|
|
6110
|
-
|
|
6111
|
-
if (!isNull(ancestor)) {
|
|
6112
|
-
// Any native shadow component being an ancestor of a synthetic shadow component is disallowed.
|
|
6113
|
-
assert.isFalse(ancestor.renderMode === 1
|
|
6114
|
-
/* Shadow */
|
|
6115
|
-
&& ancestor.shadowMode === 0
|
|
6116
|
-
/* Native */
|
|
6117
|
-
, "".concat(getComponentTag(vm), " (synthetic shadow DOM) cannot be composed inside of ").concat(getComponentTag(ancestor), " (native shadow DOM), because synthetic-within-native composition is disallowed"));
|
|
6118
|
-
}
|
|
6119
|
-
}
|
|
6120
|
-
|
|
6121
6158
|
function createVM(elm, def, options) {
|
|
6122
6159
|
var mode = options.mode,
|
|
6123
6160
|
owner = options.owner,
|
|
6124
6161
|
renderer = options.renderer,
|
|
6125
6162
|
tagName = options.tagName;
|
|
6126
|
-
var shadowMode;
|
|
6127
|
-
|
|
6128
|
-
if (renderer.syntheticShadow) {
|
|
6129
|
-
shadowMode = def.shadowSupportMode === "any"
|
|
6130
|
-
/* Any */
|
|
6131
|
-
&& isNativeShadowRootDefined ? 0
|
|
6132
|
-
/* Native */
|
|
6133
|
-
: 1
|
|
6134
|
-
/* Synthetic */
|
|
6135
|
-
;
|
|
6136
|
-
} else {
|
|
6137
|
-
shadowMode = 0
|
|
6138
|
-
/* Native */
|
|
6139
|
-
;
|
|
6140
|
-
}
|
|
6141
|
-
|
|
6142
6163
|
var vm = {
|
|
6143
6164
|
elm: elm,
|
|
6144
6165
|
def: def,
|
|
@@ -6161,10 +6182,12 @@ var LWC = (function (exports) {
|
|
|
6161
6182
|
oar: create(null),
|
|
6162
6183
|
cmpTemplate: null,
|
|
6163
6184
|
renderMode: def.renderMode,
|
|
6164
|
-
shadowMode:
|
|
6185
|
+
shadowMode: null,
|
|
6165
6186
|
context: {
|
|
6166
|
-
|
|
6167
|
-
|
|
6187
|
+
stylesheetToken: undefined,
|
|
6188
|
+
hasTokenInClass: undefined,
|
|
6189
|
+
hasTokenInAttribute: undefined,
|
|
6190
|
+
hasScopedStyles: undefined,
|
|
6168
6191
|
styleVNode: null,
|
|
6169
6192
|
tplCache: EmptyObject,
|
|
6170
6193
|
wiredConnecting: EmptyArray,
|
|
@@ -6177,26 +6200,83 @@ var LWC = (function (exports) {
|
|
|
6177
6200
|
setHook: setHook,
|
|
6178
6201
|
getHook: getHook
|
|
6179
6202
|
};
|
|
6203
|
+
vm.shadowMode = computeShadowMode(vm);
|
|
6180
6204
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
6181
6205
|
|
|
6182
6206
|
if (process.env.NODE_ENV !== 'production') {
|
|
6183
6207
|
vm.toString = function () {
|
|
6184
6208
|
return "[object:vm ".concat(def.name, " (").concat(vm.idx, ")]");
|
|
6185
6209
|
};
|
|
6186
|
-
|
|
6187
|
-
assertNotSyntheticComposedWithinNative(vm);
|
|
6188
6210
|
} // Create component instance associated to the vm and the element.
|
|
6189
6211
|
|
|
6190
6212
|
|
|
6191
6213
|
invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
|
|
6192
6214
|
|
|
6193
|
-
if (
|
|
6215
|
+
if (hasWireAdapters(vm)) {
|
|
6194
6216
|
installWireAdapters(vm);
|
|
6195
6217
|
}
|
|
6196
6218
|
|
|
6197
6219
|
return vm;
|
|
6198
6220
|
}
|
|
6199
6221
|
|
|
6222
|
+
function computeShadowMode(vm) {
|
|
6223
|
+
var def = vm.def,
|
|
6224
|
+
renderer = vm.renderer;
|
|
6225
|
+
var isNativeShadowDefined = renderer.isNativeShadowDefined,
|
|
6226
|
+
isSyntheticShadowDefined = renderer.isSyntheticShadowDefined;
|
|
6227
|
+
var shadowMode;
|
|
6228
|
+
|
|
6229
|
+
if (isSyntheticShadowDefined) {
|
|
6230
|
+
if (def.renderMode === 0
|
|
6231
|
+
/* Light */
|
|
6232
|
+
) {
|
|
6233
|
+
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
|
6234
|
+
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
6235
|
+
shadowMode = 0
|
|
6236
|
+
/* Native */
|
|
6237
|
+
;
|
|
6238
|
+
} else if (isNativeShadowDefined) {
|
|
6239
|
+
if (def.shadowSupportMode === "any"
|
|
6240
|
+
/* Any */
|
|
6241
|
+
) {
|
|
6242
|
+
shadowMode = 0
|
|
6243
|
+
/* Native */
|
|
6244
|
+
;
|
|
6245
|
+
} else {
|
|
6246
|
+
var shadowAncestor = getNearestShadowAncestor(vm);
|
|
6247
|
+
|
|
6248
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
6249
|
+
/* Native */
|
|
6250
|
+
) {
|
|
6251
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
6252
|
+
// transitively opts all of its descendants into native.
|
|
6253
|
+
shadowMode = 0
|
|
6254
|
+
/* Native */
|
|
6255
|
+
;
|
|
6256
|
+
} else {
|
|
6257
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
6258
|
+
// to be native.
|
|
6259
|
+
shadowMode = 1
|
|
6260
|
+
/* Synthetic */
|
|
6261
|
+
;
|
|
6262
|
+
}
|
|
6263
|
+
}
|
|
6264
|
+
} else {
|
|
6265
|
+
// Synthetic if there is no native Shadow DOM support.
|
|
6266
|
+
shadowMode = 1
|
|
6267
|
+
/* Synthetic */
|
|
6268
|
+
;
|
|
6269
|
+
}
|
|
6270
|
+
} else {
|
|
6271
|
+
// Native if the synthetic shadow polyfill is unavailable.
|
|
6272
|
+
shadowMode = 0
|
|
6273
|
+
/* Native */
|
|
6274
|
+
;
|
|
6275
|
+
}
|
|
6276
|
+
|
|
6277
|
+
return shadowMode;
|
|
6278
|
+
}
|
|
6279
|
+
|
|
6200
6280
|
function assertIsVM(obj) {
|
|
6201
6281
|
if (isNull(obj) || !isObject(obj) || !('cmpRoot' in obj)) {
|
|
6202
6282
|
throw new TypeError("".concat(obj, " is not a VM."));
|
|
@@ -6276,7 +6356,10 @@ var LWC = (function (exports) {
|
|
|
6276
6356
|
}
|
|
6277
6357
|
|
|
6278
6358
|
function runRenderedCallback(vm) {
|
|
6279
|
-
|
|
6359
|
+
var renderer = vm.renderer,
|
|
6360
|
+
renderedCallback = vm.def.renderedCallback;
|
|
6361
|
+
|
|
6362
|
+
if (isTrue(renderer.ssr)) {
|
|
6280
6363
|
return;
|
|
6281
6364
|
}
|
|
6282
6365
|
|
|
@@ -6286,7 +6369,15 @@ var LWC = (function (exports) {
|
|
|
6286
6369
|
invokeServiceHook(vm, rendered);
|
|
6287
6370
|
}
|
|
6288
6371
|
|
|
6289
|
-
|
|
6372
|
+
if (!isUndefined$1(renderedCallback)) {
|
|
6373
|
+
logOperationStart(4
|
|
6374
|
+
/* RenderedCallback */
|
|
6375
|
+
, vm);
|
|
6376
|
+
invokeComponentCallback(vm, renderedCallback);
|
|
6377
|
+
logOperationEnd(4
|
|
6378
|
+
/* RenderedCallback */
|
|
6379
|
+
, vm);
|
|
6380
|
+
}
|
|
6290
6381
|
}
|
|
6291
6382
|
|
|
6292
6383
|
var rehydrateQueue = [];
|
|
@@ -6305,19 +6396,19 @@ var LWC = (function (exports) {
|
|
|
6305
6396
|
});
|
|
6306
6397
|
rehydrateQueue = []; // reset to a new queue
|
|
6307
6398
|
|
|
6308
|
-
for (var
|
|
6309
|
-
var vm = vms[
|
|
6399
|
+
for (var _i18 = 0, _len7 = vms.length; _i18 < _len7; _i18 += 1) {
|
|
6400
|
+
var vm = vms[_i18];
|
|
6310
6401
|
|
|
6311
6402
|
try {
|
|
6312
6403
|
rehydrate(vm);
|
|
6313
6404
|
} catch (error) {
|
|
6314
|
-
if (
|
|
6405
|
+
if (_i18 + 1 < _len7) {
|
|
6315
6406
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
6316
6407
|
if (rehydrateQueue.length === 0) {
|
|
6317
6408
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
6318
6409
|
}
|
|
6319
6410
|
|
|
6320
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
6411
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i18 + 1));
|
|
6321
6412
|
} // we need to end the measure before throwing.
|
|
6322
6413
|
|
|
6323
6414
|
|
|
@@ -6421,8 +6512,8 @@ var LWC = (function (exports) {
|
|
|
6421
6512
|
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
6422
6513
|
// inserted in reserved order.
|
|
6423
6514
|
|
|
6424
|
-
for (var
|
|
6425
|
-
var elm = vCustomElementCollection[
|
|
6515
|
+
for (var _i19 = vCustomElementCollection.length - 1; _i19 >= 0; _i19 -= 1) {
|
|
6516
|
+
var elm = vCustomElementCollection[_i19].elm; // There are two cases where the element could be undefined:
|
|
6426
6517
|
// * when there is an error during the construction phase, and an error
|
|
6427
6518
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
6428
6519
|
// is not properly initialized, and therefore is should be ignored.
|
|
@@ -6456,8 +6547,8 @@ var LWC = (function (exports) {
|
|
|
6456
6547
|
|
|
6457
6548
|
|
|
6458
6549
|
function recursivelyDisconnectChildren(vnodes) {
|
|
6459
|
-
for (var
|
|
6460
|
-
var vnode = vnodes[
|
|
6550
|
+
for (var _i20 = 0, _len8 = vnodes.length; _i20 < _len8; _i20 += 1) {
|
|
6551
|
+
var vnode = vnodes[_i20];
|
|
6461
6552
|
|
|
6462
6553
|
if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
|
|
6463
6554
|
// vnode is a VElement with children
|
|
@@ -6481,8 +6572,8 @@ var LWC = (function (exports) {
|
|
|
6481
6572
|
renderer = vm.renderer;
|
|
6482
6573
|
var rootNode = getRenderRoot(vm);
|
|
6483
6574
|
|
|
6484
|
-
for (var
|
|
6485
|
-
var child = children[
|
|
6575
|
+
for (var _i21 = 0, _len9 = children.length; _i21 < _len9; _i21++) {
|
|
6576
|
+
var child = children[_i21];
|
|
6486
6577
|
|
|
6487
6578
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6488
6579
|
renderer.remove(child.elm, rootNode);
|
|
@@ -6527,8 +6618,8 @@ var LWC = (function (exports) {
|
|
|
6527
6618
|
var oldSlots = vm.cmpSlots;
|
|
6528
6619
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
6529
6620
|
|
|
6530
|
-
for (var
|
|
6531
|
-
var vnode = children[
|
|
6621
|
+
for (var _i22 = 0, _len10 = children.length; _i22 < _len10; _i22 += 1) {
|
|
6622
|
+
var vnode = children[_i22];
|
|
6532
6623
|
|
|
6533
6624
|
if (isNull(vnode)) {
|
|
6534
6625
|
continue;
|
|
@@ -6558,8 +6649,8 @@ var LWC = (function (exports) {
|
|
|
6558
6649
|
return;
|
|
6559
6650
|
}
|
|
6560
6651
|
|
|
6561
|
-
for (var
|
|
6562
|
-
var key = oldKeys[
|
|
6652
|
+
for (var _i23 = 0, _len11 = oldKeys.length; _i23 < _len11; _i23 += 1) {
|
|
6653
|
+
var key = oldKeys[_i23];
|
|
6563
6654
|
|
|
6564
6655
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
6565
6656
|
markComponentAsDirty(vm);
|
|
@@ -6901,11 +6992,14 @@ var LWC = (function (exports) {
|
|
|
6901
6992
|
ArrayPush$1.call(wiredConnecting, function () {
|
|
6902
6993
|
connector.connect();
|
|
6903
6994
|
|
|
6904
|
-
if (
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6995
|
+
if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
6996
|
+
if (hasDynamicParams) {
|
|
6997
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
6998
|
+
return;
|
|
6999
|
+
}
|
|
6908
7000
|
}
|
|
7001
|
+
|
|
7002
|
+
computeConfigAndUpdate();
|
|
6909
7003
|
});
|
|
6910
7004
|
ArrayPush$1.call(wiredDisconnecting, function () {
|
|
6911
7005
|
connector.disconnect();
|
|
@@ -6919,8 +7013,8 @@ var LWC = (function (exports) {
|
|
|
6919
7013
|
function connectWireAdapters(vm) {
|
|
6920
7014
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
6921
7015
|
|
|
6922
|
-
for (var
|
|
6923
|
-
wiredConnecting[
|
|
7016
|
+
for (var _i24 = 0, _len12 = wiredConnecting.length; _i24 < _len12; _i24 += 1) {
|
|
7017
|
+
wiredConnecting[_i24]();
|
|
6924
7018
|
}
|
|
6925
7019
|
}
|
|
6926
7020
|
|
|
@@ -6928,8 +7022,8 @@ var LWC = (function (exports) {
|
|
|
6928
7022
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
6929
7023
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
6930
7024
|
// job
|
|
6931
|
-
for (var
|
|
6932
|
-
wiredDisconnecting[
|
|
7025
|
+
for (var _i25 = 0, _len13 = wiredDisconnecting.length; _i25 < _len13; _i25 += 1) {
|
|
7026
|
+
wiredDisconnecting[_i25]();
|
|
6933
7027
|
}
|
|
6934
7028
|
}, noop);
|
|
6935
7029
|
}
|
|
@@ -7004,7 +7098,7 @@ var LWC = (function (exports) {
|
|
|
7004
7098
|
|
|
7005
7099
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
7006
7100
|
}
|
|
7007
|
-
/* version: 2.
|
|
7101
|
+
/* version: 2.5.0 */
|
|
7008
7102
|
|
|
7009
7103
|
/*
|
|
7010
7104
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7019,14 +7113,18 @@ var LWC = (function (exports) {
|
|
|
7019
7113
|
if (process.env.NODE_ENV === 'development') {
|
|
7020
7114
|
// @ts-ignore
|
|
7021
7115
|
window.__lwcResetGlobalStylesheets = function () {
|
|
7022
|
-
for (var
|
|
7023
|
-
var key = _Object$keys[
|
|
7116
|
+
for (var _i26 = 0, _Object$keys = Object.keys(globalStylesheets); _i26 < _Object$keys.length; _i26++) {
|
|
7117
|
+
var key = _Object$keys[_i26];
|
|
7024
7118
|
delete globalStylesheets[key];
|
|
7025
7119
|
}
|
|
7026
7120
|
};
|
|
7027
7121
|
}
|
|
7028
7122
|
|
|
7029
7123
|
var globalStylesheetsParentElement = document.head || document.body || document;
|
|
7124
|
+
var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync);
|
|
7125
|
+
var styleElements = create(null);
|
|
7126
|
+
var styleSheets = create(null);
|
|
7127
|
+
var nodesToStyleSheets = new WeakMap();
|
|
7030
7128
|
var getCustomElement, defineCustomElement, HTMLElementConstructor;
|
|
7031
7129
|
|
|
7032
7130
|
function isCustomElementRegistryAvailable() {
|
|
@@ -7065,6 +7163,52 @@ var LWC = (function (exports) {
|
|
|
7065
7163
|
}
|
|
7066
7164
|
}
|
|
7067
7165
|
|
|
7166
|
+
function insertConstructableStyleSheet(content, target) {
|
|
7167
|
+
// It's important for CSSStyleSheets to be unique based on their content, so that
|
|
7168
|
+
// `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
|
|
7169
|
+
var styleSheet = styleSheets[content];
|
|
7170
|
+
|
|
7171
|
+
if (isUndefined$1(styleSheet)) {
|
|
7172
|
+
styleSheet = new CSSStyleSheet();
|
|
7173
|
+
styleSheet.replaceSync(content);
|
|
7174
|
+
styleSheets[content] = styleSheet;
|
|
7175
|
+
}
|
|
7176
|
+
|
|
7177
|
+
if (!target.adoptedStyleSheets.includes(styleSheet)) {
|
|
7178
|
+
target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
|
|
7179
|
+
}
|
|
7180
|
+
}
|
|
7181
|
+
|
|
7182
|
+
function insertStyleElement(content, target) {
|
|
7183
|
+
// Avoid inserting duplicate `<style>`s
|
|
7184
|
+
var sheets = nodesToStyleSheets.get(target);
|
|
7185
|
+
|
|
7186
|
+
if (isUndefined$1(sheets)) {
|
|
7187
|
+
sheets = create(null);
|
|
7188
|
+
nodesToStyleSheets.set(target, sheets);
|
|
7189
|
+
}
|
|
7190
|
+
|
|
7191
|
+
if (sheets[content]) {
|
|
7192
|
+
return;
|
|
7193
|
+
}
|
|
7194
|
+
|
|
7195
|
+
sheets[content] = true; // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
|
|
7196
|
+
// faster to call `cloneNode()` on an existing node than to recreate it every time.
|
|
7197
|
+
|
|
7198
|
+
var elm = styleElements[content];
|
|
7199
|
+
|
|
7200
|
+
if (isUndefined$1(elm)) {
|
|
7201
|
+
elm = document.createElement('style');
|
|
7202
|
+
elm.type = 'text/css';
|
|
7203
|
+
elm.textContent = content;
|
|
7204
|
+
styleElements[content] = elm;
|
|
7205
|
+
} else {
|
|
7206
|
+
elm = elm.cloneNode(true);
|
|
7207
|
+
}
|
|
7208
|
+
|
|
7209
|
+
target.appendChild(elm);
|
|
7210
|
+
}
|
|
7211
|
+
|
|
7068
7212
|
if (isCustomElementRegistryAvailable()) {
|
|
7069
7213
|
getCustomElement = customElements.get.bind(customElements);
|
|
7070
7214
|
defineCustomElement = customElements.define.bind(customElements);
|
|
@@ -7108,7 +7252,8 @@ var LWC = (function (exports) {
|
|
|
7108
7252
|
|
|
7109
7253
|
var renderer = {
|
|
7110
7254
|
ssr: false,
|
|
7111
|
-
|
|
7255
|
+
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7256
|
+
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7112
7257
|
createElement: function createElement(tagName, namespace) {
|
|
7113
7258
|
return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
|
|
7114
7259
|
},
|
|
@@ -7205,6 +7350,14 @@ var LWC = (function (exports) {
|
|
|
7205
7350
|
elm.textContent = content;
|
|
7206
7351
|
globalStylesheetsParentElement.appendChild(elm);
|
|
7207
7352
|
},
|
|
7353
|
+
insertStylesheet: function insertStylesheet(content, target) {
|
|
7354
|
+
if (supportsConstructableStyleSheets) {
|
|
7355
|
+
insertConstructableStyleSheet(content, target);
|
|
7356
|
+
} else {
|
|
7357
|
+
// Fall back to <style> element
|
|
7358
|
+
insertStyleElement(content, target);
|
|
7359
|
+
}
|
|
7360
|
+
},
|
|
7208
7361
|
assertInstanceOfHTMLElement: function assertInstanceOfHTMLElement(elm, msg) {
|
|
7209
7362
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7210
7363
|
},
|
|
@@ -7446,7 +7599,7 @@ var LWC = (function (exports) {
|
|
|
7446
7599
|
return false;
|
|
7447
7600
|
}
|
|
7448
7601
|
|
|
7449
|
-
if (renderer.
|
|
7602
|
+
if (renderer.isSyntheticShadowDefined) {
|
|
7450
7603
|
// TODO [#1252]: old behavior that is still used by some pieces of the platform,
|
|
7451
7604
|
// specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
|
|
7452
7605
|
// used, will be considered global elements.
|
|
@@ -7498,7 +7651,7 @@ var LWC = (function (exports) {
|
|
|
7498
7651
|
});
|
|
7499
7652
|
freeze(LightningElement);
|
|
7500
7653
|
seal(LightningElement.prototype);
|
|
7501
|
-
/* version: 2.
|
|
7654
|
+
/* version: 2.5.0 */
|
|
7502
7655
|
|
|
7503
7656
|
exports.LightningElement = LightningElement;
|
|
7504
7657
|
exports.__unstable__ProfilerControl = profilerControl;
|