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
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
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); }; }
|
|
34
34
|
|
|
35
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
35
|
+
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); }
|
|
36
36
|
|
|
37
37
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
38
38
|
|
|
@@ -154,6 +154,10 @@
|
|
|
154
154
|
return obj === false;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
function isBoolean(obj) {
|
|
158
|
+
return typeof obj === 'boolean';
|
|
159
|
+
}
|
|
160
|
+
|
|
157
161
|
function isFunction$1(obj) {
|
|
158
162
|
return typeof obj === 'function';
|
|
159
163
|
}
|
|
@@ -297,6 +301,7 @@
|
|
|
297
301
|
var KEY__SHADOW_RESOLVER = '$shadowResolver$';
|
|
298
302
|
var KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
299
303
|
var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
304
|
+
var KEY__SCOPED_CSS = '$scoped$';
|
|
300
305
|
/**
|
|
301
306
|
* Map composed of properties to attributes not following the HTML property to attribute mapping
|
|
302
307
|
* convention.
|
|
@@ -345,7 +350,7 @@
|
|
|
345
350
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
346
351
|
return attributeName;
|
|
347
352
|
}
|
|
348
|
-
/** version: 2.
|
|
353
|
+
/** version: 2.5.0 */
|
|
349
354
|
|
|
350
355
|
/*
|
|
351
356
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -448,19 +453,33 @@
|
|
|
448
453
|
*/
|
|
449
454
|
|
|
450
455
|
|
|
456
|
+
var features = {
|
|
457
|
+
ENABLE_REACTIVE_SETTER: null,
|
|
458
|
+
ENABLE_HMR: null,
|
|
459
|
+
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
460
|
+
ENABLE_ELEMENT_PATCH: null,
|
|
461
|
+
ENABLE_NODE_LIST_PATCH: null,
|
|
462
|
+
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
463
|
+
ENABLE_NODE_PATCH: null,
|
|
464
|
+
ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
|
|
465
|
+
ENABLE_MIXED_SHADOW_MODE: null,
|
|
466
|
+
ENABLE_WIRE_SYNC_EMIT: null
|
|
467
|
+
};
|
|
468
|
+
|
|
451
469
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
452
470
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
453
471
|
value: create(null)
|
|
454
472
|
});
|
|
455
473
|
}
|
|
456
474
|
|
|
457
|
-
var runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
458
|
-
|
|
475
|
+
var runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
476
|
+
/**
|
|
477
|
+
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
|
478
|
+
* flag. It is meant to be used during the app initialization.
|
|
479
|
+
*/
|
|
459
480
|
|
|
460
481
|
function setFeatureFlag(name, value) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
if (!isBoolean) {
|
|
482
|
+
if (!isBoolean(value)) {
|
|
464
483
|
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.");
|
|
465
484
|
|
|
466
485
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -472,9 +491,12 @@
|
|
|
472
491
|
}
|
|
473
492
|
}
|
|
474
493
|
|
|
475
|
-
if (isUndefined$1(
|
|
476
|
-
|
|
477
|
-
|
|
494
|
+
if (isUndefined$1(features[name])) {
|
|
495
|
+
var availableFlags = keys(features).map(function (name) {
|
|
496
|
+
return "\"".concat(name, "\"");
|
|
497
|
+
}).join(', '); // eslint-disable-next-line no-console
|
|
498
|
+
|
|
499
|
+
console.warn("Failed to set the value \"".concat(value, "\" for the runtime feature flag \"").concat(name, "\" because it is undefined. Available flags: ").concat(availableFlags, "."));
|
|
478
500
|
return;
|
|
479
501
|
}
|
|
480
502
|
|
|
@@ -491,37 +513,23 @@
|
|
|
491
513
|
return;
|
|
492
514
|
}
|
|
493
515
|
|
|
494
|
-
|
|
516
|
+
defineProperty(runtimeFlags, name, {
|
|
495
517
|
value: value
|
|
496
518
|
});
|
|
497
519
|
}
|
|
498
|
-
}
|
|
499
|
-
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Set the value at runtime of a given feature flag. This method should only be used for testing
|
|
523
|
+
* purposes. It is a no-op when invoked in production mode.
|
|
524
|
+
*/
|
|
500
525
|
|
|
501
526
|
|
|
502
527
|
function setFeatureFlagForTest(name, value) {
|
|
503
528
|
if (process.env.NODE_ENV !== 'production') {
|
|
504
|
-
|
|
529
|
+
setFeatureFlag(name, value);
|
|
505
530
|
}
|
|
506
531
|
}
|
|
507
|
-
|
|
508
|
-
var featureFlagLookup = {
|
|
509
|
-
ENABLE_REACTIVE_SETTER: null,
|
|
510
|
-
ENABLE_HMR: null,
|
|
511
|
-
// Flag to toggle on/off the enforcement of innerText/outerText shadow dom semantic in elements when using synthetic shadow.
|
|
512
|
-
// Note: Once active, elements outside the lwc boundary are controlled by the ENABLE_ELEMENT_PATCH flag.
|
|
513
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
514
|
-
// Flags to toggle on/off the enforcement of shadow dom semantic in element/node outside lwc boundary when using synthetic shadow.
|
|
515
|
-
ENABLE_ELEMENT_PATCH: null,
|
|
516
|
-
ENABLE_NODE_LIST_PATCH: null,
|
|
517
|
-
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
518
|
-
ENABLE_NODE_PATCH: null,
|
|
519
|
-
// Disables the fix for #2121 where non-composed events are visible outside of their shadow root.
|
|
520
|
-
ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
|
|
521
|
-
ENABLE_LIGHT_DOM_COMPONENTS: null,
|
|
522
|
-
ENABLE_MIXED_SHADOW_MODE: null
|
|
523
|
-
};
|
|
524
|
-
/** version: 2.3.3 */
|
|
532
|
+
/** version: 2.5.0 */
|
|
525
533
|
|
|
526
534
|
/* proxy-compat-disable */
|
|
527
535
|
|
|
@@ -532,6 +540,7 @@
|
|
|
532
540
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
533
541
|
*/
|
|
534
542
|
|
|
543
|
+
|
|
535
544
|
var nextTickCallbackQueue = [];
|
|
536
545
|
var SPACE_CHAR = 32;
|
|
537
546
|
var EmptyObject = seal(create(null));
|
|
@@ -2783,12 +2792,6 @@
|
|
|
2783
2792
|
associateVM(component, vm);
|
|
2784
2793
|
associateVM(elm, vm);
|
|
2785
2794
|
|
|
2786
|
-
if (!runtimeFlags.ENABLE_LIGHT_DOM_COMPONENTS) {
|
|
2787
|
-
assert.isTrue(def.renderMode !== 0
|
|
2788
|
-
/* Light */
|
|
2789
|
-
, "".concat(def.name || 'Anonymous class', " is an invalid LWC component. Light DOM components are not available in this environment."));
|
|
2790
|
-
}
|
|
2791
|
-
|
|
2792
2795
|
if (vm.renderMode === 1
|
|
2793
2796
|
/* Shadow */
|
|
2794
2797
|
) {
|
|
@@ -2819,6 +2822,12 @@
|
|
|
2819
2822
|
if (process.env.NODE_ENV !== 'production') {
|
|
2820
2823
|
patchShadowRootWithRestrictions(cmpRoot);
|
|
2821
2824
|
}
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
function warnIfInvokedDuringConstruction(vm, methodName) {
|
|
2828
|
+
if (isBeingConstructed(vm)) {
|
|
2829
|
+
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."));
|
|
2830
|
+
}
|
|
2822
2831
|
} // @ts-ignore
|
|
2823
2832
|
|
|
2824
2833
|
|
|
@@ -2932,7 +2941,7 @@
|
|
|
2932
2941
|
getBoundingClientRect = vm.renderer.getBoundingClientRect;
|
|
2933
2942
|
|
|
2934
2943
|
if (process.env.NODE_ENV !== 'production') {
|
|
2935
|
-
|
|
2944
|
+
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect');
|
|
2936
2945
|
}
|
|
2937
2946
|
|
|
2938
2947
|
return getBoundingClientRect(elm);
|
|
@@ -2943,7 +2952,7 @@
|
|
|
2943
2952
|
querySelector = vm.renderer.querySelector;
|
|
2944
2953
|
|
|
2945
2954
|
if (process.env.NODE_ENV !== 'production') {
|
|
2946
|
-
|
|
2955
|
+
warnIfInvokedDuringConstruction(vm, 'querySelector');
|
|
2947
2956
|
}
|
|
2948
2957
|
|
|
2949
2958
|
return querySelector(elm, selectors);
|
|
@@ -2954,7 +2963,7 @@
|
|
|
2954
2963
|
querySelectorAll = vm.renderer.querySelectorAll;
|
|
2955
2964
|
|
|
2956
2965
|
if (process.env.NODE_ENV !== 'production') {
|
|
2957
|
-
|
|
2966
|
+
warnIfInvokedDuringConstruction(vm, 'querySelectorAll');
|
|
2958
2967
|
}
|
|
2959
2968
|
|
|
2960
2969
|
return querySelectorAll(elm, selectors);
|
|
@@ -2965,7 +2974,7 @@
|
|
|
2965
2974
|
getElementsByTagName = vm.renderer.getElementsByTagName;
|
|
2966
2975
|
|
|
2967
2976
|
if (process.env.NODE_ENV !== 'production') {
|
|
2968
|
-
|
|
2977
|
+
warnIfInvokedDuringConstruction(vm, 'getElementsByTagName');
|
|
2969
2978
|
}
|
|
2970
2979
|
|
|
2971
2980
|
return getElementsByTagName(elm, tagNameOrWildCard);
|
|
@@ -2976,7 +2985,7 @@
|
|
|
2976
2985
|
getElementsByClassName = vm.renderer.getElementsByClassName;
|
|
2977
2986
|
|
|
2978
2987
|
if (process.env.NODE_ENV !== 'production') {
|
|
2979
|
-
|
|
2988
|
+
warnIfInvokedDuringConstruction(vm, 'getElementsByClassName');
|
|
2980
2989
|
}
|
|
2981
2990
|
|
|
2982
2991
|
return getElementsByClassName(elm, names);
|
|
@@ -4383,6 +4392,17 @@
|
|
|
4383
4392
|
|
|
4384
4393
|
function setElementShadowToken(elm, token) {
|
|
4385
4394
|
elm.$shadowToken$ = token;
|
|
4395
|
+
} // Set the scope token class for *.scoped.css styles
|
|
4396
|
+
|
|
4397
|
+
|
|
4398
|
+
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
4399
|
+
var cmpTemplate = owner.cmpTemplate,
|
|
4400
|
+
context = owner.context;
|
|
4401
|
+
var token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
4402
|
+
|
|
4403
|
+
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
4404
|
+
owner.renderer.getClassList(elm).add(token);
|
|
4405
|
+
}
|
|
4386
4406
|
}
|
|
4387
4407
|
|
|
4388
4408
|
function updateNodeHook(oldVnode, vnode) {
|
|
@@ -4446,12 +4466,13 @@
|
|
|
4446
4466
|
|
|
4447
4467
|
function fallbackElmHook(elm, vnode) {
|
|
4448
4468
|
var owner = vnode.owner;
|
|
4469
|
+
setScopeTokenClassIfNecessary(elm, owner);
|
|
4449
4470
|
|
|
4450
4471
|
if (owner.shadowMode === 1
|
|
4451
4472
|
/* Synthetic */
|
|
4452
4473
|
) {
|
|
4453
4474
|
var context = vnode.data.context;
|
|
4454
|
-
var
|
|
4475
|
+
var stylesheetToken = owner.context.stylesheetToken;
|
|
4455
4476
|
|
|
4456
4477
|
if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
4457
4478
|
/* manual */
|
|
@@ -4462,7 +4483,7 @@
|
|
|
4462
4483
|
// into each element from the template, so they can be styled accordingly.
|
|
4463
4484
|
|
|
4464
4485
|
|
|
4465
|
-
setElementShadowToken(elm,
|
|
4486
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4466
4487
|
}
|
|
4467
4488
|
|
|
4468
4489
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4541,14 +4562,15 @@
|
|
|
4541
4562
|
mode = vnode.mode,
|
|
4542
4563
|
ctor = vnode.ctor,
|
|
4543
4564
|
owner = vnode.owner;
|
|
4565
|
+
setScopeTokenClassIfNecessary(elm, owner);
|
|
4544
4566
|
|
|
4545
4567
|
if (owner.shadowMode === 1
|
|
4546
4568
|
/* Synthetic */
|
|
4547
4569
|
) {
|
|
4548
|
-
var
|
|
4570
|
+
var stylesheetToken = owner.context.stylesheetToken; // when running in synthetic shadow mode, we need to set the shadowToken value
|
|
4549
4571
|
// into each element from the template, so they can be styled accordingly.
|
|
4550
4572
|
|
|
4551
|
-
setElementShadowToken(elm,
|
|
4573
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4552
4574
|
}
|
|
4553
4575
|
|
|
4554
4576
|
var def = getComponentInternalDef(ctor);
|
|
@@ -4837,12 +4859,18 @@
|
|
|
4837
4859
|
};
|
|
4838
4860
|
|
|
4839
4861
|
function linkNodeToShadow(elm, owner) {
|
|
4840
|
-
var
|
|
4862
|
+
var renderer = owner.renderer,
|
|
4863
|
+
renderMode = owner.renderMode,
|
|
4864
|
+
shadowMode = owner.shadowMode; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4841
4865
|
|
|
4842
|
-
if (
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4866
|
+
if (renderer.isSyntheticShadowDefined) {
|
|
4867
|
+
if (shadowMode === 1
|
|
4868
|
+
/* Synthetic */
|
|
4869
|
+
|| renderMode === 0
|
|
4870
|
+
/* Light */
|
|
4871
|
+
) {
|
|
4872
|
+
elm[KEY__SHADOW_RESOLVER] = getRenderRoot(owner)[KEY__SHADOW_RESOLVER];
|
|
4873
|
+
}
|
|
4846
4874
|
}
|
|
4847
4875
|
}
|
|
4848
4876
|
|
|
@@ -5179,13 +5207,10 @@
|
|
|
5179
5207
|
}
|
|
5180
5208
|
|
|
5181
5209
|
var idx = vmBeingRendered.idx,
|
|
5182
|
-
renderMode = vmBeingRendered.renderMode,
|
|
5183
5210
|
shadowMode = vmBeingRendered.shadowMode;
|
|
5184
5211
|
|
|
5185
5212
|
if (shadowMode === 1
|
|
5186
5213
|
/* Synthetic */
|
|
5187
|
-
&& renderMode === 1
|
|
5188
|
-
/* Shadow */
|
|
5189
5214
|
) {
|
|
5190
5215
|
return StringReplace.call(id, /\S+/g, function (id) {
|
|
5191
5216
|
return "".concat(id, "-").concat(idx);
|
|
@@ -5215,13 +5240,10 @@
|
|
|
5215
5240
|
}
|
|
5216
5241
|
|
|
5217
5242
|
var idx = vmBeingRendered.idx,
|
|
5218
|
-
renderMode = vmBeingRendered.renderMode,
|
|
5219
5243
|
shadowMode = vmBeingRendered.shadowMode; // Apply transformation only for fragment-only-urls, and only in shadow DOM
|
|
5220
5244
|
|
|
5221
5245
|
if (shadowMode === 1
|
|
5222
5246
|
/* Synthetic */
|
|
5223
|
-
&& renderMode === 1
|
|
5224
|
-
/* Shadow */
|
|
5225
5247
|
&& /^#/.test(url)) {
|
|
5226
5248
|
return "".concat(url, "-").concat(idx);
|
|
5227
5249
|
}
|
|
@@ -5322,6 +5344,10 @@
|
|
|
5322
5344
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5323
5345
|
*/
|
|
5324
5346
|
|
|
5347
|
+
function makeHostToken(token) {
|
|
5348
|
+
return "".concat(token, "-host");
|
|
5349
|
+
}
|
|
5350
|
+
|
|
5325
5351
|
function createInlineStyleVNode(content) {
|
|
5326
5352
|
return h('style', {
|
|
5327
5353
|
key: 'style',
|
|
@@ -5331,55 +5357,92 @@
|
|
|
5331
5357
|
}, [t(content)]);
|
|
5332
5358
|
}
|
|
5333
5359
|
|
|
5334
|
-
function
|
|
5360
|
+
function updateStylesheetToken(vm, template) {
|
|
5335
5361
|
var elm = vm.elm,
|
|
5336
5362
|
context = vm.context,
|
|
5337
5363
|
renderer = vm.renderer,
|
|
5338
|
-
renderMode = vm.renderMode
|
|
5364
|
+
renderMode = vm.renderMode,
|
|
5365
|
+
shadowMode = vm.shadowMode;
|
|
5339
5366
|
var newStylesheets = template.stylesheets,
|
|
5340
|
-
|
|
5341
|
-
var
|
|
5367
|
+
newStylesheetToken = template.stylesheetToken;
|
|
5368
|
+
var isSyntheticShadow = renderMode === 1
|
|
5369
|
+
/* Shadow */
|
|
5370
|
+
&& shadowMode === 1
|
|
5371
|
+
/* Synthetic */
|
|
5372
|
+
;
|
|
5373
|
+
var hasScopedStyles = context.hasScopedStyles;
|
|
5374
|
+
var newToken;
|
|
5375
|
+
var newHasTokenInClass;
|
|
5376
|
+
var newHasTokenInAttribute; // Reset the styling token applied to the host element.
|
|
5342
5377
|
|
|
5343
|
-
var
|
|
5378
|
+
var oldToken = context.stylesheetToken,
|
|
5379
|
+
oldHasTokenInClass = context.hasTokenInClass,
|
|
5380
|
+
oldHasTokenInAttribute = context.hasTokenInAttribute;
|
|
5344
5381
|
|
|
5345
|
-
if (
|
|
5346
|
-
renderer.
|
|
5382
|
+
if (oldHasTokenInClass) {
|
|
5383
|
+
renderer.getClassList(elm).remove(makeHostToken(oldToken));
|
|
5384
|
+
}
|
|
5385
|
+
|
|
5386
|
+
if (oldHasTokenInAttribute) {
|
|
5387
|
+
renderer.removeAttribute(elm, makeHostToken(oldToken));
|
|
5347
5388
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
5348
|
-
// associated stylesheets.
|
|
5389
|
+
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
5349
5390
|
|
|
5350
5391
|
|
|
5351
|
-
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
}
|
|
5392
|
+
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
5393
|
+
newToken = newStylesheetToken;
|
|
5394
|
+
} // Set the new styling token on the host element
|
|
5395
|
+
|
|
5356
5396
|
|
|
5357
|
-
if (!isUndefined$1(
|
|
5358
|
-
|
|
5397
|
+
if (!isUndefined$1(newToken)) {
|
|
5398
|
+
if (hasScopedStyles) {
|
|
5399
|
+
renderer.getClassList(elm).add(makeHostToken(newToken));
|
|
5400
|
+
newHasTokenInClass = true;
|
|
5401
|
+
}
|
|
5402
|
+
|
|
5403
|
+
if (isSyntheticShadow) {
|
|
5404
|
+
renderer.setAttribute(elm, makeHostToken(newToken), '');
|
|
5405
|
+
newHasTokenInAttribute = true;
|
|
5406
|
+
}
|
|
5359
5407
|
} // Update the styling tokens present on the context object.
|
|
5360
5408
|
|
|
5361
5409
|
|
|
5362
|
-
context.
|
|
5363
|
-
context.
|
|
5410
|
+
context.stylesheetToken = newToken;
|
|
5411
|
+
context.hasTokenInClass = newHasTokenInClass;
|
|
5412
|
+
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
5364
5413
|
}
|
|
5365
5414
|
|
|
5366
|
-
function evaluateStylesheetsContent(stylesheets,
|
|
5415
|
+
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
5367
5416
|
var content = [];
|
|
5368
5417
|
|
|
5369
5418
|
for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
|
|
5370
5419
|
var stylesheet = stylesheets[_i12];
|
|
5371
5420
|
|
|
5372
5421
|
if (isArray$1(stylesheet)) {
|
|
5373
|
-
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet,
|
|
5422
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
5374
5423
|
} else {
|
|
5375
5424
|
if (process.env.NODE_ENV !== 'production') {
|
|
5376
5425
|
// in dev-mode, we support hot swapping of stylesheet, which means that
|
|
5377
5426
|
// the component instance might be attempting to use an old version of
|
|
5378
5427
|
// the stylesheet, while internally, we have a replacement for it.
|
|
5379
5428
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
5380
|
-
}
|
|
5429
|
+
} // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
5430
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
5431
|
+
|
|
5432
|
+
|
|
5433
|
+
var isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
5434
|
+
var useActualHostSelector = vm.renderMode === 0
|
|
5435
|
+
/* Light */
|
|
5436
|
+
? !isScopedCss : vm.shadowMode === 0
|
|
5437
|
+
/* Native */
|
|
5438
|
+
; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
5381
5439
|
|
|
5382
|
-
|
|
5440
|
+
var scopeToken = isScopedCss || vm.shadowMode === 1
|
|
5441
|
+
/* Synthetic */
|
|
5442
|
+
&& vm.renderMode === 1
|
|
5443
|
+
/* Shadow */
|
|
5444
|
+
? stylesheetToken : undefined;
|
|
5445
|
+
ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
|
|
5383
5446
|
}
|
|
5384
5447
|
}
|
|
5385
5448
|
|
|
@@ -5388,34 +5451,35 @@
|
|
|
5388
5451
|
|
|
5389
5452
|
function getStylesheetsContent(vm, template) {
|
|
5390
5453
|
var stylesheets = template.stylesheets,
|
|
5391
|
-
|
|
5392
|
-
var renderMode = vm.renderMode,
|
|
5393
|
-
shadowMode = vm.shadowMode;
|
|
5454
|
+
stylesheetToken = template.stylesheetToken;
|
|
5394
5455
|
var content = [];
|
|
5395
5456
|
|
|
5396
5457
|
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5458
|
+
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
5459
|
+
}
|
|
5460
|
+
|
|
5461
|
+
return content;
|
|
5462
|
+
} // It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
5463
|
+
// perf testing has not shown it to be a huge improvement yet:
|
|
5464
|
+
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
5465
|
+
|
|
5400
5466
|
|
|
5401
|
-
|
|
5467
|
+
function getNearestNativeShadowComponent(vm) {
|
|
5468
|
+
var owner = vm;
|
|
5469
|
+
|
|
5470
|
+
while (!isNull(owner)) {
|
|
5471
|
+
if (owner.renderMode === 1
|
|
5402
5472
|
/* Shadow */
|
|
5403
|
-
&& shadowMode ===
|
|
5404
|
-
/*
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
shadowSelector = "[".concat(stylesheetTokens.shadowAttribute, "]");
|
|
5408
|
-
} else {
|
|
5409
|
-
hostSelector = '';
|
|
5410
|
-
shadowSelector = '';
|
|
5473
|
+
&& owner.shadowMode === 0
|
|
5474
|
+
/* Native */
|
|
5475
|
+
) {
|
|
5476
|
+
return owner;
|
|
5411
5477
|
}
|
|
5412
5478
|
|
|
5413
|
-
|
|
5414
|
-
/* Native */
|
|
5415
|
-
);
|
|
5479
|
+
owner = owner.owner;
|
|
5416
5480
|
}
|
|
5417
5481
|
|
|
5418
|
-
return
|
|
5482
|
+
return owner;
|
|
5419
5483
|
}
|
|
5420
5484
|
|
|
5421
5485
|
function createStylesheet(vm, stylesheets) {
|
|
@@ -5431,13 +5495,26 @@
|
|
|
5431
5495
|
for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
|
|
5432
5496
|
renderer.insertGlobalStylesheet(stylesheets[_i13]);
|
|
5433
5497
|
}
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
} else {
|
|
5437
|
-
// native shadow or light DOM
|
|
5498
|
+
} else if (renderer.ssr) {
|
|
5499
|
+
// native shadow or light DOM, SSR
|
|
5438
5500
|
var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5439
5501
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
5502
|
+
} else {
|
|
5503
|
+
// native shadow or light DOM, DOM renderer
|
|
5504
|
+
var root = getNearestNativeShadowComponent(vm);
|
|
5505
|
+
var isGlobal = isNull(root);
|
|
5506
|
+
|
|
5507
|
+
for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
|
|
5508
|
+
if (isGlobal) {
|
|
5509
|
+
renderer.insertGlobalStylesheet(stylesheets[_i14]);
|
|
5510
|
+
} else {
|
|
5511
|
+
// local level
|
|
5512
|
+
renderer.insertStylesheet(stylesheets[_i14], root.cmpRoot);
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5440
5515
|
}
|
|
5516
|
+
|
|
5517
|
+
return null;
|
|
5441
5518
|
}
|
|
5442
5519
|
/*
|
|
5443
5520
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5635,8 +5712,7 @@
|
|
|
5635
5712
|
context = vm.context,
|
|
5636
5713
|
cmpSlots = vm.cmpSlots,
|
|
5637
5714
|
cmpTemplate = vm.cmpTemplate,
|
|
5638
|
-
tro = vm.tro
|
|
5639
|
-
shadowMode = vm.shadowMode;
|
|
5715
|
+
tro = vm.tro;
|
|
5640
5716
|
tro.observe(function () {
|
|
5641
5717
|
// Reset the cache memoizer for template when needed.
|
|
5642
5718
|
if (html !== cmpTemplate) {
|
|
@@ -5660,15 +5736,12 @@
|
|
|
5660
5736
|
|
|
5661
5737
|
vm.cmpTemplate = html; // Create a brand new template cache for the swapped templated.
|
|
5662
5738
|
|
|
5663
|
-
context.tplCache = create(null); //
|
|
5739
|
+
context.tplCache = create(null); // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
5664
5740
|
|
|
5665
|
-
|
|
5666
|
-
/* Synthetic */
|
|
5667
|
-
) {
|
|
5668
|
-
updateSyntheticShadowAttributes(vm, html);
|
|
5669
|
-
} // Evaluate, create stylesheet and cache the produced VNode for future
|
|
5670
|
-
// re-rendering.
|
|
5741
|
+
context.hasScopedStyles = computeHasScopedStyles(html); // Update the scoping token on the host element.
|
|
5671
5742
|
|
|
5743
|
+
updateStylesheetToken(vm, html); // Evaluate, create stylesheet and cache the produced VNode for future
|
|
5744
|
+
// re-rendering.
|
|
5672
5745
|
|
|
5673
5746
|
var stylesheetsContent = getStylesheetsContent(vm, html);
|
|
5674
5747
|
context.styleVNode = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);
|
|
@@ -5708,6 +5781,20 @@
|
|
|
5708
5781
|
|
|
5709
5782
|
return vnodes;
|
|
5710
5783
|
}
|
|
5784
|
+
|
|
5785
|
+
function computeHasScopedStyles(template) {
|
|
5786
|
+
var stylesheets = template.stylesheets;
|
|
5787
|
+
|
|
5788
|
+
if (!isUndefined$1(stylesheets)) {
|
|
5789
|
+
for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
|
|
5790
|
+
if (isTrue(stylesheets[_i15][KEY__SCOPED_CSS])) {
|
|
5791
|
+
return true;
|
|
5792
|
+
}
|
|
5793
|
+
}
|
|
5794
|
+
}
|
|
5795
|
+
|
|
5796
|
+
return false;
|
|
5797
|
+
}
|
|
5711
5798
|
/*
|
|
5712
5799
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5713
5800
|
* All rights reserved.
|
|
@@ -5745,12 +5832,9 @@
|
|
|
5745
5832
|
var component = vm.component,
|
|
5746
5833
|
callHook = vm.callHook,
|
|
5747
5834
|
owner = vm.owner;
|
|
5748
|
-
var result;
|
|
5749
5835
|
runWithBoundaryProtection(vm, owner, noop, function () {
|
|
5750
|
-
|
|
5751
|
-
result = callHook(component, fn, args);
|
|
5836
|
+
callHook(component, fn, args);
|
|
5752
5837
|
}, noop);
|
|
5753
|
-
return result;
|
|
5754
5838
|
}
|
|
5755
5839
|
|
|
5756
5840
|
function invokeComponentConstructor(vm, Ctor) {
|
|
@@ -5820,29 +5904,6 @@
|
|
|
5820
5904
|
return renderInvocationSuccessful ? evaluateTemplate(vm, html) : [];
|
|
5821
5905
|
}
|
|
5822
5906
|
|
|
5823
|
-
function invokeComponentRenderedCallback(vm) {
|
|
5824
|
-
var renderedCallback = vm.def.renderedCallback,
|
|
5825
|
-
component = vm.component,
|
|
5826
|
-
callHook = vm.callHook,
|
|
5827
|
-
owner = vm.owner;
|
|
5828
|
-
|
|
5829
|
-
if (!isUndefined$1(renderedCallback)) {
|
|
5830
|
-
runWithBoundaryProtection(vm, owner, function () {
|
|
5831
|
-
logOperationStart(4
|
|
5832
|
-
/* RenderedCallback */
|
|
5833
|
-
, vm);
|
|
5834
|
-
}, function () {
|
|
5835
|
-
// job
|
|
5836
|
-
callHook(component, renderedCallback);
|
|
5837
|
-
}, function () {
|
|
5838
|
-
// post
|
|
5839
|
-
logOperationEnd(4
|
|
5840
|
-
/* RenderedCallback */
|
|
5841
|
-
, vm);
|
|
5842
|
-
});
|
|
5843
|
-
}
|
|
5844
|
-
}
|
|
5845
|
-
|
|
5846
5907
|
function invokeEventListener(vm, fn, thisValue, event) {
|
|
5847
5908
|
var callHook = vm.callHook,
|
|
5848
5909
|
owner = vm.owner;
|
|
@@ -5956,8 +6017,8 @@
|
|
|
5956
6017
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
5957
6018
|
}
|
|
5958
6019
|
|
|
5959
|
-
for (var
|
|
5960
|
-
var hookName = hooks[
|
|
6020
|
+
for (var _i16 = 0; _i16 < hooks.length; ++_i16) {
|
|
6021
|
+
var hookName = hooks[_i16];
|
|
5961
6022
|
|
|
5962
6023
|
if (hookName in service) {
|
|
5963
6024
|
var l = Services[hookName];
|
|
@@ -5980,8 +6041,8 @@
|
|
|
5980
6041
|
def = vm.def,
|
|
5981
6042
|
context = vm.context;
|
|
5982
6043
|
|
|
5983
|
-
for (var
|
|
5984
|
-
cbs[
|
|
6044
|
+
for (var _i17 = 0, _len6 = cbs.length; _i17 < _len6; ++_i17) {
|
|
6045
|
+
cbs[_i17].call(undefined, component, {}, def, context);
|
|
5985
6046
|
}
|
|
5986
6047
|
}
|
|
5987
6048
|
/*
|
|
@@ -5992,7 +6053,6 @@
|
|
|
5992
6053
|
*/
|
|
5993
6054
|
|
|
5994
6055
|
|
|
5995
|
-
var isNativeShadowRootDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
5996
6056
|
var idx = 0;
|
|
5997
6057
|
/** The internal slot used to associate different objects the engine manipulates with the VM */
|
|
5998
6058
|
|
|
@@ -6098,50 +6158,11 @@
|
|
|
6098
6158
|
return ancestor;
|
|
6099
6159
|
}
|
|
6100
6160
|
|
|
6101
|
-
function assertNotSyntheticComposedWithinNative(vm) {
|
|
6102
|
-
var isSynthetic = vm.renderMode === 1
|
|
6103
|
-
/* Shadow */
|
|
6104
|
-
&& vm.shadowMode === 1
|
|
6105
|
-
/* Synthetic */
|
|
6106
|
-
;
|
|
6107
|
-
|
|
6108
|
-
if (!isSynthetic) {
|
|
6109
|
-
return;
|
|
6110
|
-
}
|
|
6111
|
-
|
|
6112
|
-
var ancestor = getNearestShadowAncestor(vm);
|
|
6113
|
-
|
|
6114
|
-
if (!isNull(ancestor)) {
|
|
6115
|
-
// Any native shadow component being an ancestor of a synthetic shadow component is disallowed.
|
|
6116
|
-
assert.isFalse(ancestor.renderMode === 1
|
|
6117
|
-
/* Shadow */
|
|
6118
|
-
&& ancestor.shadowMode === 0
|
|
6119
|
-
/* Native */
|
|
6120
|
-
, "".concat(getComponentTag(vm), " (synthetic shadow DOM) cannot be composed inside of ").concat(getComponentTag(ancestor), " (native shadow DOM), because synthetic-within-native composition is disallowed"));
|
|
6121
|
-
}
|
|
6122
|
-
}
|
|
6123
|
-
|
|
6124
6161
|
function createVM(elm, def, options) {
|
|
6125
6162
|
var mode = options.mode,
|
|
6126
6163
|
owner = options.owner,
|
|
6127
6164
|
renderer = options.renderer,
|
|
6128
6165
|
tagName = options.tagName;
|
|
6129
|
-
var shadowMode;
|
|
6130
|
-
|
|
6131
|
-
if (renderer.syntheticShadow) {
|
|
6132
|
-
shadowMode = def.shadowSupportMode === "any"
|
|
6133
|
-
/* Any */
|
|
6134
|
-
&& isNativeShadowRootDefined ? 0
|
|
6135
|
-
/* Native */
|
|
6136
|
-
: 1
|
|
6137
|
-
/* Synthetic */
|
|
6138
|
-
;
|
|
6139
|
-
} else {
|
|
6140
|
-
shadowMode = 0
|
|
6141
|
-
/* Native */
|
|
6142
|
-
;
|
|
6143
|
-
}
|
|
6144
|
-
|
|
6145
6166
|
var vm = {
|
|
6146
6167
|
elm: elm,
|
|
6147
6168
|
def: def,
|
|
@@ -6164,10 +6185,12 @@
|
|
|
6164
6185
|
oar: create(null),
|
|
6165
6186
|
cmpTemplate: null,
|
|
6166
6187
|
renderMode: def.renderMode,
|
|
6167
|
-
shadowMode:
|
|
6188
|
+
shadowMode: null,
|
|
6168
6189
|
context: {
|
|
6169
|
-
|
|
6170
|
-
|
|
6190
|
+
stylesheetToken: undefined,
|
|
6191
|
+
hasTokenInClass: undefined,
|
|
6192
|
+
hasTokenInAttribute: undefined,
|
|
6193
|
+
hasScopedStyles: undefined,
|
|
6171
6194
|
styleVNode: null,
|
|
6172
6195
|
tplCache: EmptyObject,
|
|
6173
6196
|
wiredConnecting: EmptyArray,
|
|
@@ -6180,26 +6203,83 @@
|
|
|
6180
6203
|
setHook: setHook,
|
|
6181
6204
|
getHook: getHook
|
|
6182
6205
|
};
|
|
6206
|
+
vm.shadowMode = computeShadowMode(vm);
|
|
6183
6207
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
6184
6208
|
|
|
6185
6209
|
if (process.env.NODE_ENV !== 'production') {
|
|
6186
6210
|
vm.toString = function () {
|
|
6187
6211
|
return "[object:vm ".concat(def.name, " (").concat(vm.idx, ")]");
|
|
6188
6212
|
};
|
|
6189
|
-
|
|
6190
|
-
assertNotSyntheticComposedWithinNative(vm);
|
|
6191
6213
|
} // Create component instance associated to the vm and the element.
|
|
6192
6214
|
|
|
6193
6215
|
|
|
6194
6216
|
invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
|
|
6195
6217
|
|
|
6196
|
-
if (
|
|
6218
|
+
if (hasWireAdapters(vm)) {
|
|
6197
6219
|
installWireAdapters(vm);
|
|
6198
6220
|
}
|
|
6199
6221
|
|
|
6200
6222
|
return vm;
|
|
6201
6223
|
}
|
|
6202
6224
|
|
|
6225
|
+
function computeShadowMode(vm) {
|
|
6226
|
+
var def = vm.def,
|
|
6227
|
+
renderer = vm.renderer;
|
|
6228
|
+
var isNativeShadowDefined = renderer.isNativeShadowDefined,
|
|
6229
|
+
isSyntheticShadowDefined = renderer.isSyntheticShadowDefined;
|
|
6230
|
+
var shadowMode;
|
|
6231
|
+
|
|
6232
|
+
if (isSyntheticShadowDefined) {
|
|
6233
|
+
if (def.renderMode === 0
|
|
6234
|
+
/* Light */
|
|
6235
|
+
) {
|
|
6236
|
+
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
|
6237
|
+
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
6238
|
+
shadowMode = 0
|
|
6239
|
+
/* Native */
|
|
6240
|
+
;
|
|
6241
|
+
} else if (isNativeShadowDefined) {
|
|
6242
|
+
if (def.shadowSupportMode === "any"
|
|
6243
|
+
/* Any */
|
|
6244
|
+
) {
|
|
6245
|
+
shadowMode = 0
|
|
6246
|
+
/* Native */
|
|
6247
|
+
;
|
|
6248
|
+
} else {
|
|
6249
|
+
var shadowAncestor = getNearestShadowAncestor(vm);
|
|
6250
|
+
|
|
6251
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
6252
|
+
/* Native */
|
|
6253
|
+
) {
|
|
6254
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
6255
|
+
// transitively opts all of its descendants into native.
|
|
6256
|
+
shadowMode = 0
|
|
6257
|
+
/* Native */
|
|
6258
|
+
;
|
|
6259
|
+
} else {
|
|
6260
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
6261
|
+
// to be native.
|
|
6262
|
+
shadowMode = 1
|
|
6263
|
+
/* Synthetic */
|
|
6264
|
+
;
|
|
6265
|
+
}
|
|
6266
|
+
}
|
|
6267
|
+
} else {
|
|
6268
|
+
// Synthetic if there is no native Shadow DOM support.
|
|
6269
|
+
shadowMode = 1
|
|
6270
|
+
/* Synthetic */
|
|
6271
|
+
;
|
|
6272
|
+
}
|
|
6273
|
+
} else {
|
|
6274
|
+
// Native if the synthetic shadow polyfill is unavailable.
|
|
6275
|
+
shadowMode = 0
|
|
6276
|
+
/* Native */
|
|
6277
|
+
;
|
|
6278
|
+
}
|
|
6279
|
+
|
|
6280
|
+
return shadowMode;
|
|
6281
|
+
}
|
|
6282
|
+
|
|
6203
6283
|
function assertIsVM(obj) {
|
|
6204
6284
|
if (isNull(obj) || !isObject(obj) || !('cmpRoot' in obj)) {
|
|
6205
6285
|
throw new TypeError("".concat(obj, " is not a VM."));
|
|
@@ -6279,7 +6359,10 @@
|
|
|
6279
6359
|
}
|
|
6280
6360
|
|
|
6281
6361
|
function runRenderedCallback(vm) {
|
|
6282
|
-
|
|
6362
|
+
var renderer = vm.renderer,
|
|
6363
|
+
renderedCallback = vm.def.renderedCallback;
|
|
6364
|
+
|
|
6365
|
+
if (isTrue(renderer.ssr)) {
|
|
6283
6366
|
return;
|
|
6284
6367
|
}
|
|
6285
6368
|
|
|
@@ -6289,7 +6372,15 @@
|
|
|
6289
6372
|
invokeServiceHook(vm, rendered);
|
|
6290
6373
|
}
|
|
6291
6374
|
|
|
6292
|
-
|
|
6375
|
+
if (!isUndefined$1(renderedCallback)) {
|
|
6376
|
+
logOperationStart(4
|
|
6377
|
+
/* RenderedCallback */
|
|
6378
|
+
, vm);
|
|
6379
|
+
invokeComponentCallback(vm, renderedCallback);
|
|
6380
|
+
logOperationEnd(4
|
|
6381
|
+
/* RenderedCallback */
|
|
6382
|
+
, vm);
|
|
6383
|
+
}
|
|
6293
6384
|
}
|
|
6294
6385
|
|
|
6295
6386
|
var rehydrateQueue = [];
|
|
@@ -6308,19 +6399,19 @@
|
|
|
6308
6399
|
});
|
|
6309
6400
|
rehydrateQueue = []; // reset to a new queue
|
|
6310
6401
|
|
|
6311
|
-
for (var
|
|
6312
|
-
var vm = vms[
|
|
6402
|
+
for (var _i18 = 0, _len7 = vms.length; _i18 < _len7; _i18 += 1) {
|
|
6403
|
+
var vm = vms[_i18];
|
|
6313
6404
|
|
|
6314
6405
|
try {
|
|
6315
6406
|
rehydrate(vm);
|
|
6316
6407
|
} catch (error) {
|
|
6317
|
-
if (
|
|
6408
|
+
if (_i18 + 1 < _len7) {
|
|
6318
6409
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
6319
6410
|
if (rehydrateQueue.length === 0) {
|
|
6320
6411
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
6321
6412
|
}
|
|
6322
6413
|
|
|
6323
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
6414
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i18 + 1));
|
|
6324
6415
|
} // we need to end the measure before throwing.
|
|
6325
6416
|
|
|
6326
6417
|
|
|
@@ -6424,8 +6515,8 @@
|
|
|
6424
6515
|
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
6425
6516
|
// inserted in reserved order.
|
|
6426
6517
|
|
|
6427
|
-
for (var
|
|
6428
|
-
var elm = vCustomElementCollection[
|
|
6518
|
+
for (var _i19 = vCustomElementCollection.length - 1; _i19 >= 0; _i19 -= 1) {
|
|
6519
|
+
var elm = vCustomElementCollection[_i19].elm; // There are two cases where the element could be undefined:
|
|
6429
6520
|
// * when there is an error during the construction phase, and an error
|
|
6430
6521
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
6431
6522
|
// is not properly initialized, and therefore is should be ignored.
|
|
@@ -6459,8 +6550,8 @@
|
|
|
6459
6550
|
|
|
6460
6551
|
|
|
6461
6552
|
function recursivelyDisconnectChildren(vnodes) {
|
|
6462
|
-
for (var
|
|
6463
|
-
var vnode = vnodes[
|
|
6553
|
+
for (var _i20 = 0, _len8 = vnodes.length; _i20 < _len8; _i20 += 1) {
|
|
6554
|
+
var vnode = vnodes[_i20];
|
|
6464
6555
|
|
|
6465
6556
|
if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
|
|
6466
6557
|
// vnode is a VElement with children
|
|
@@ -6484,8 +6575,8 @@
|
|
|
6484
6575
|
renderer = vm.renderer;
|
|
6485
6576
|
var rootNode = getRenderRoot(vm);
|
|
6486
6577
|
|
|
6487
|
-
for (var
|
|
6488
|
-
var child = children[
|
|
6578
|
+
for (var _i21 = 0, _len9 = children.length; _i21 < _len9; _i21++) {
|
|
6579
|
+
var child = children[_i21];
|
|
6489
6580
|
|
|
6490
6581
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6491
6582
|
renderer.remove(child.elm, rootNode);
|
|
@@ -6530,8 +6621,8 @@
|
|
|
6530
6621
|
var oldSlots = vm.cmpSlots;
|
|
6531
6622
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
6532
6623
|
|
|
6533
|
-
for (var
|
|
6534
|
-
var vnode = children[
|
|
6624
|
+
for (var _i22 = 0, _len10 = children.length; _i22 < _len10; _i22 += 1) {
|
|
6625
|
+
var vnode = children[_i22];
|
|
6535
6626
|
|
|
6536
6627
|
if (isNull(vnode)) {
|
|
6537
6628
|
continue;
|
|
@@ -6561,8 +6652,8 @@
|
|
|
6561
6652
|
return;
|
|
6562
6653
|
}
|
|
6563
6654
|
|
|
6564
|
-
for (var
|
|
6565
|
-
var key = oldKeys[
|
|
6655
|
+
for (var _i23 = 0, _len11 = oldKeys.length; _i23 < _len11; _i23 += 1) {
|
|
6656
|
+
var key = oldKeys[_i23];
|
|
6566
6657
|
|
|
6567
6658
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
6568
6659
|
markComponentAsDirty(vm);
|
|
@@ -6904,11 +6995,14 @@
|
|
|
6904
6995
|
ArrayPush$1.call(wiredConnecting, function () {
|
|
6905
6996
|
connector.connect();
|
|
6906
6997
|
|
|
6907
|
-
if (
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6998
|
+
if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
6999
|
+
if (hasDynamicParams) {
|
|
7000
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
7001
|
+
return;
|
|
7002
|
+
}
|
|
6911
7003
|
}
|
|
7004
|
+
|
|
7005
|
+
computeConfigAndUpdate();
|
|
6912
7006
|
});
|
|
6913
7007
|
ArrayPush$1.call(wiredDisconnecting, function () {
|
|
6914
7008
|
connector.disconnect();
|
|
@@ -6922,8 +7016,8 @@
|
|
|
6922
7016
|
function connectWireAdapters(vm) {
|
|
6923
7017
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
6924
7018
|
|
|
6925
|
-
for (var
|
|
6926
|
-
wiredConnecting[
|
|
7019
|
+
for (var _i24 = 0, _len12 = wiredConnecting.length; _i24 < _len12; _i24 += 1) {
|
|
7020
|
+
wiredConnecting[_i24]();
|
|
6927
7021
|
}
|
|
6928
7022
|
}
|
|
6929
7023
|
|
|
@@ -6931,8 +7025,8 @@
|
|
|
6931
7025
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
6932
7026
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
6933
7027
|
// job
|
|
6934
|
-
for (var
|
|
6935
|
-
wiredDisconnecting[
|
|
7028
|
+
for (var _i25 = 0, _len13 = wiredDisconnecting.length; _i25 < _len13; _i25 += 1) {
|
|
7029
|
+
wiredDisconnecting[_i25]();
|
|
6936
7030
|
}
|
|
6937
7031
|
}, noop);
|
|
6938
7032
|
}
|
|
@@ -7007,7 +7101,7 @@
|
|
|
7007
7101
|
|
|
7008
7102
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
7009
7103
|
}
|
|
7010
|
-
/* version: 2.
|
|
7104
|
+
/* version: 2.5.0 */
|
|
7011
7105
|
|
|
7012
7106
|
/*
|
|
7013
7107
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7022,14 +7116,18 @@
|
|
|
7022
7116
|
if (process.env.NODE_ENV === 'development') {
|
|
7023
7117
|
// @ts-ignore
|
|
7024
7118
|
window.__lwcResetGlobalStylesheets = function () {
|
|
7025
|
-
for (var
|
|
7026
|
-
var key = _Object$keys[
|
|
7119
|
+
for (var _i26 = 0, _Object$keys = Object.keys(globalStylesheets); _i26 < _Object$keys.length; _i26++) {
|
|
7120
|
+
var key = _Object$keys[_i26];
|
|
7027
7121
|
delete globalStylesheets[key];
|
|
7028
7122
|
}
|
|
7029
7123
|
};
|
|
7030
7124
|
}
|
|
7031
7125
|
|
|
7032
7126
|
var globalStylesheetsParentElement = document.head || document.body || document;
|
|
7127
|
+
var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync);
|
|
7128
|
+
var styleElements = create(null);
|
|
7129
|
+
var styleSheets = create(null);
|
|
7130
|
+
var nodesToStyleSheets = new WeakMap();
|
|
7033
7131
|
var getCustomElement, defineCustomElement, HTMLElementConstructor;
|
|
7034
7132
|
|
|
7035
7133
|
function isCustomElementRegistryAvailable() {
|
|
@@ -7068,6 +7166,52 @@
|
|
|
7068
7166
|
}
|
|
7069
7167
|
}
|
|
7070
7168
|
|
|
7169
|
+
function insertConstructableStyleSheet(content, target) {
|
|
7170
|
+
// It's important for CSSStyleSheets to be unique based on their content, so that
|
|
7171
|
+
// `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
|
|
7172
|
+
var styleSheet = styleSheets[content];
|
|
7173
|
+
|
|
7174
|
+
if (isUndefined$1(styleSheet)) {
|
|
7175
|
+
styleSheet = new CSSStyleSheet();
|
|
7176
|
+
styleSheet.replaceSync(content);
|
|
7177
|
+
styleSheets[content] = styleSheet;
|
|
7178
|
+
}
|
|
7179
|
+
|
|
7180
|
+
if (!target.adoptedStyleSheets.includes(styleSheet)) {
|
|
7181
|
+
target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
|
|
7182
|
+
}
|
|
7183
|
+
}
|
|
7184
|
+
|
|
7185
|
+
function insertStyleElement(content, target) {
|
|
7186
|
+
// Avoid inserting duplicate `<style>`s
|
|
7187
|
+
var sheets = nodesToStyleSheets.get(target);
|
|
7188
|
+
|
|
7189
|
+
if (isUndefined$1(sheets)) {
|
|
7190
|
+
sheets = create(null);
|
|
7191
|
+
nodesToStyleSheets.set(target, sheets);
|
|
7192
|
+
}
|
|
7193
|
+
|
|
7194
|
+
if (sheets[content]) {
|
|
7195
|
+
return;
|
|
7196
|
+
}
|
|
7197
|
+
|
|
7198
|
+
sheets[content] = true; // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
|
|
7199
|
+
// faster to call `cloneNode()` on an existing node than to recreate it every time.
|
|
7200
|
+
|
|
7201
|
+
var elm = styleElements[content];
|
|
7202
|
+
|
|
7203
|
+
if (isUndefined$1(elm)) {
|
|
7204
|
+
elm = document.createElement('style');
|
|
7205
|
+
elm.type = 'text/css';
|
|
7206
|
+
elm.textContent = content;
|
|
7207
|
+
styleElements[content] = elm;
|
|
7208
|
+
} else {
|
|
7209
|
+
elm = elm.cloneNode(true);
|
|
7210
|
+
}
|
|
7211
|
+
|
|
7212
|
+
target.appendChild(elm);
|
|
7213
|
+
}
|
|
7214
|
+
|
|
7071
7215
|
if (isCustomElementRegistryAvailable()) {
|
|
7072
7216
|
getCustomElement = customElements.get.bind(customElements);
|
|
7073
7217
|
defineCustomElement = customElements.define.bind(customElements);
|
|
@@ -7111,7 +7255,8 @@
|
|
|
7111
7255
|
|
|
7112
7256
|
var renderer = {
|
|
7113
7257
|
ssr: false,
|
|
7114
|
-
|
|
7258
|
+
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7259
|
+
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7115
7260
|
createElement: function createElement(tagName, namespace) {
|
|
7116
7261
|
return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
|
|
7117
7262
|
},
|
|
@@ -7208,6 +7353,14 @@
|
|
|
7208
7353
|
elm.textContent = content;
|
|
7209
7354
|
globalStylesheetsParentElement.appendChild(elm);
|
|
7210
7355
|
},
|
|
7356
|
+
insertStylesheet: function insertStylesheet(content, target) {
|
|
7357
|
+
if (supportsConstructableStyleSheets) {
|
|
7358
|
+
insertConstructableStyleSheet(content, target);
|
|
7359
|
+
} else {
|
|
7360
|
+
// Fall back to <style> element
|
|
7361
|
+
insertStyleElement(content, target);
|
|
7362
|
+
}
|
|
7363
|
+
},
|
|
7211
7364
|
assertInstanceOfHTMLElement: function assertInstanceOfHTMLElement(elm, msg) {
|
|
7212
7365
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7213
7366
|
},
|
|
@@ -7449,7 +7602,7 @@
|
|
|
7449
7602
|
return false;
|
|
7450
7603
|
}
|
|
7451
7604
|
|
|
7452
|
-
if (renderer.
|
|
7605
|
+
if (renderer.isSyntheticShadowDefined) {
|
|
7453
7606
|
// TODO [#1252]: old behavior that is still used by some pieces of the platform,
|
|
7454
7607
|
// specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
|
|
7455
7608
|
// used, will be considered global elements.
|
|
@@ -7501,7 +7654,7 @@
|
|
|
7501
7654
|
});
|
|
7502
7655
|
freeze(LightningElement);
|
|
7503
7656
|
seal(LightningElement.prototype);
|
|
7504
|
-
/* version: 2.
|
|
7657
|
+
/* version: 2.5.0 */
|
|
7505
7658
|
|
|
7506
7659
|
exports.LightningElement = LightningElement;
|
|
7507
7660
|
exports.__unstable__ProfilerControl = profilerControl;
|