lwc 2.3.4 → 2.5.1
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 +389 -174
- package/dist/engine-dom/iife/es2017/engine-dom.js +389 -174
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +359 -137
- package/dist/engine-dom/iife/es5/engine-dom.js +404 -198
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +372 -159
- package/dist/engine-dom/umd/es2017/engine-dom.js +389 -174
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +359 -137
- package/dist/engine-dom/umd/es5/engine-dom.js +404 -198
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +372 -159
- package/dist/engine-server/commonjs/es2017/engine-server.js +333 -181
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +333 -181
- 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.1 */
|
|
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.4 */
|
|
532
|
+
/** version: 2.5.1 */
|
|
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);
|
|
@@ -3345,18 +3354,33 @@
|
|
|
3345
3354
|
|
|
3346
3355
|
function getClassDescriptorType(descriptor) {
|
|
3347
3356
|
if (isFunction$1(descriptor.value)) {
|
|
3348
|
-
return
|
|
3357
|
+
return "method"
|
|
3358
|
+
/* Method */
|
|
3359
|
+
;
|
|
3349
3360
|
} else if (isFunction$1(descriptor.set) || isFunction$1(descriptor.get)) {
|
|
3350
|
-
return
|
|
3361
|
+
return "accessor"
|
|
3362
|
+
/* Accessor */
|
|
3363
|
+
;
|
|
3351
3364
|
} else {
|
|
3352
|
-
return
|
|
3365
|
+
return "field"
|
|
3366
|
+
/* Field */
|
|
3367
|
+
;
|
|
3353
3368
|
}
|
|
3354
3369
|
}
|
|
3355
3370
|
|
|
3356
3371
|
function validateObservedField(Ctor, fieldName, descriptor) {
|
|
3357
3372
|
if (!isUndefined$1(descriptor)) {
|
|
3358
3373
|
var type = getClassDescriptorType(descriptor);
|
|
3359
|
-
|
|
3374
|
+
var message = "Invalid observed ".concat(fieldName, " field. Found a duplicate ").concat(type, " with the same name."); // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.
|
|
3375
|
+
// This branch is only here for backward compatibility reasons.
|
|
3376
|
+
|
|
3377
|
+
if (type === "accessor"
|
|
3378
|
+
/* Accessor */
|
|
3379
|
+
) {
|
|
3380
|
+
logError(message);
|
|
3381
|
+
} else {
|
|
3382
|
+
assert.fail(message);
|
|
3383
|
+
}
|
|
3360
3384
|
}
|
|
3361
3385
|
}
|
|
3362
3386
|
|
|
@@ -3383,7 +3407,16 @@
|
|
|
3383
3407
|
function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
|
|
3384
3408
|
if (!isUndefined$1(descriptor)) {
|
|
3385
3409
|
var type = getClassDescriptorType(descriptor);
|
|
3386
|
-
|
|
3410
|
+
var message = "Invalid @api ".concat(fieldName, " field. Found a duplicate ").concat(type, " with the same name."); // [W-9927596] Ideally we always throw an error when detecting duplicate public properties.
|
|
3411
|
+
// This branch is only here for backward compatibility reasons.
|
|
3412
|
+
|
|
3413
|
+
if (type === "accessor"
|
|
3414
|
+
/* Accessor */
|
|
3415
|
+
) {
|
|
3416
|
+
logError(message);
|
|
3417
|
+
} else {
|
|
3418
|
+
assert.fail(message);
|
|
3419
|
+
}
|
|
3387
3420
|
}
|
|
3388
3421
|
}
|
|
3389
3422
|
|
|
@@ -3444,9 +3477,16 @@
|
|
|
3444
3477
|
// field declaration
|
|
3445
3478
|
if (process.env.NODE_ENV !== 'production') {
|
|
3446
3479
|
validateFieldDecoratedWithApi(Ctor, fieldName, descriptor);
|
|
3447
|
-
}
|
|
3480
|
+
} // [W-9927596] If a component has both a public property and a private setter/getter
|
|
3481
|
+
// with the same name, the property is defined as a public accessor. This branch is
|
|
3482
|
+
// only here for backward compatibility reasons.
|
|
3448
3483
|
|
|
3449
|
-
|
|
3484
|
+
|
|
3485
|
+
if (!isUndefined$1(descriptor) && !isUndefined$1(descriptor.get)) {
|
|
3486
|
+
descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
|
|
3487
|
+
} else {
|
|
3488
|
+
descriptor = createPublicPropertyDescriptor(fieldName);
|
|
3489
|
+
}
|
|
3450
3490
|
}
|
|
3451
3491
|
|
|
3452
3492
|
apiFields[fieldName] = descriptor;
|
|
@@ -3526,9 +3566,16 @@
|
|
|
3526
3566
|
|
|
3527
3567
|
if (process.env.NODE_ENV !== 'production') {
|
|
3528
3568
|
validateObservedField(Ctor, _fieldName2, descriptor);
|
|
3529
|
-
}
|
|
3569
|
+
} // [W-9927596] Only mark a field as observed whenever it isn't a duplicated public nor
|
|
3570
|
+
// tracked property. This is only here for backward compatibility purposes.
|
|
3571
|
+
|
|
3530
3572
|
|
|
3531
|
-
|
|
3573
|
+
var isDuplicatePublicProp = !isUndefined$1(publicProps) && _fieldName2 in publicProps;
|
|
3574
|
+
var isDuplicateTrackedProp = !isUndefined$1(track) && _fieldName2 in track;
|
|
3575
|
+
|
|
3576
|
+
if (!isDuplicatePublicProp && !isDuplicateTrackedProp) {
|
|
3577
|
+
observedFields[_fieldName2] = createObservedFieldPropertyDescriptor(_fieldName2);
|
|
3578
|
+
}
|
|
3532
3579
|
}
|
|
3533
3580
|
}
|
|
3534
3581
|
|
|
@@ -4383,6 +4430,17 @@
|
|
|
4383
4430
|
|
|
4384
4431
|
function setElementShadowToken(elm, token) {
|
|
4385
4432
|
elm.$shadowToken$ = token;
|
|
4433
|
+
} // Set the scope token class for *.scoped.css styles
|
|
4434
|
+
|
|
4435
|
+
|
|
4436
|
+
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
4437
|
+
var cmpTemplate = owner.cmpTemplate,
|
|
4438
|
+
context = owner.context;
|
|
4439
|
+
var token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
4440
|
+
|
|
4441
|
+
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
4442
|
+
owner.renderer.getClassList(elm).add(token);
|
|
4443
|
+
}
|
|
4386
4444
|
}
|
|
4387
4445
|
|
|
4388
4446
|
function updateNodeHook(oldVnode, vnode) {
|
|
@@ -4446,12 +4504,13 @@
|
|
|
4446
4504
|
|
|
4447
4505
|
function fallbackElmHook(elm, vnode) {
|
|
4448
4506
|
var owner = vnode.owner;
|
|
4507
|
+
setScopeTokenClassIfNecessary(elm, owner);
|
|
4449
4508
|
|
|
4450
4509
|
if (owner.shadowMode === 1
|
|
4451
4510
|
/* Synthetic */
|
|
4452
4511
|
) {
|
|
4453
4512
|
var context = vnode.data.context;
|
|
4454
|
-
var
|
|
4513
|
+
var stylesheetToken = owner.context.stylesheetToken;
|
|
4455
4514
|
|
|
4456
4515
|
if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
4457
4516
|
/* manual */
|
|
@@ -4462,7 +4521,7 @@
|
|
|
4462
4521
|
// into each element from the template, so they can be styled accordingly.
|
|
4463
4522
|
|
|
4464
4523
|
|
|
4465
|
-
setElementShadowToken(elm,
|
|
4524
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4466
4525
|
}
|
|
4467
4526
|
|
|
4468
4527
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4541,14 +4600,15 @@
|
|
|
4541
4600
|
mode = vnode.mode,
|
|
4542
4601
|
ctor = vnode.ctor,
|
|
4543
4602
|
owner = vnode.owner;
|
|
4603
|
+
setScopeTokenClassIfNecessary(elm, owner);
|
|
4544
4604
|
|
|
4545
4605
|
if (owner.shadowMode === 1
|
|
4546
4606
|
/* Synthetic */
|
|
4547
4607
|
) {
|
|
4548
|
-
var
|
|
4608
|
+
var stylesheetToken = owner.context.stylesheetToken; // when running in synthetic shadow mode, we need to set the shadowToken value
|
|
4549
4609
|
// into each element from the template, so they can be styled accordingly.
|
|
4550
4610
|
|
|
4551
|
-
setElementShadowToken(elm,
|
|
4611
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4552
4612
|
}
|
|
4553
4613
|
|
|
4554
4614
|
var def = getComponentInternalDef(ctor);
|
|
@@ -4837,12 +4897,18 @@
|
|
|
4837
4897
|
};
|
|
4838
4898
|
|
|
4839
4899
|
function linkNodeToShadow(elm, owner) {
|
|
4840
|
-
var
|
|
4900
|
+
var renderer = owner.renderer,
|
|
4901
|
+
renderMode = owner.renderMode,
|
|
4902
|
+
shadowMode = owner.shadowMode; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4841
4903
|
|
|
4842
|
-
if (
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4904
|
+
if (renderer.isSyntheticShadowDefined) {
|
|
4905
|
+
if (shadowMode === 1
|
|
4906
|
+
/* Synthetic */
|
|
4907
|
+
|| renderMode === 0
|
|
4908
|
+
/* Light */
|
|
4909
|
+
) {
|
|
4910
|
+
elm[KEY__SHADOW_RESOLVER] = getRenderRoot(owner)[KEY__SHADOW_RESOLVER];
|
|
4911
|
+
}
|
|
4846
4912
|
}
|
|
4847
4913
|
}
|
|
4848
4914
|
|
|
@@ -5179,13 +5245,10 @@
|
|
|
5179
5245
|
}
|
|
5180
5246
|
|
|
5181
5247
|
var idx = vmBeingRendered.idx,
|
|
5182
|
-
renderMode = vmBeingRendered.renderMode,
|
|
5183
5248
|
shadowMode = vmBeingRendered.shadowMode;
|
|
5184
5249
|
|
|
5185
5250
|
if (shadowMode === 1
|
|
5186
5251
|
/* Synthetic */
|
|
5187
|
-
&& renderMode === 1
|
|
5188
|
-
/* Shadow */
|
|
5189
5252
|
) {
|
|
5190
5253
|
return StringReplace.call(id, /\S+/g, function (id) {
|
|
5191
5254
|
return "".concat(id, "-").concat(idx);
|
|
@@ -5215,13 +5278,10 @@
|
|
|
5215
5278
|
}
|
|
5216
5279
|
|
|
5217
5280
|
var idx = vmBeingRendered.idx,
|
|
5218
|
-
renderMode = vmBeingRendered.renderMode,
|
|
5219
5281
|
shadowMode = vmBeingRendered.shadowMode; // Apply transformation only for fragment-only-urls, and only in shadow DOM
|
|
5220
5282
|
|
|
5221
5283
|
if (shadowMode === 1
|
|
5222
5284
|
/* Synthetic */
|
|
5223
|
-
&& renderMode === 1
|
|
5224
|
-
/* Shadow */
|
|
5225
5285
|
&& /^#/.test(url)) {
|
|
5226
5286
|
return "".concat(url, "-").concat(idx);
|
|
5227
5287
|
}
|
|
@@ -5322,6 +5382,10 @@
|
|
|
5322
5382
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5323
5383
|
*/
|
|
5324
5384
|
|
|
5385
|
+
function makeHostToken(token) {
|
|
5386
|
+
return "".concat(token, "-host");
|
|
5387
|
+
}
|
|
5388
|
+
|
|
5325
5389
|
function createInlineStyleVNode(content) {
|
|
5326
5390
|
return h('style', {
|
|
5327
5391
|
key: 'style',
|
|
@@ -5331,55 +5395,92 @@
|
|
|
5331
5395
|
}, [t(content)]);
|
|
5332
5396
|
}
|
|
5333
5397
|
|
|
5334
|
-
function
|
|
5398
|
+
function updateStylesheetToken(vm, template) {
|
|
5335
5399
|
var elm = vm.elm,
|
|
5336
5400
|
context = vm.context,
|
|
5337
5401
|
renderer = vm.renderer,
|
|
5338
|
-
renderMode = vm.renderMode
|
|
5402
|
+
renderMode = vm.renderMode,
|
|
5403
|
+
shadowMode = vm.shadowMode;
|
|
5339
5404
|
var newStylesheets = template.stylesheets,
|
|
5340
|
-
|
|
5341
|
-
var
|
|
5405
|
+
newStylesheetToken = template.stylesheetToken;
|
|
5406
|
+
var isSyntheticShadow = renderMode === 1
|
|
5407
|
+
/* Shadow */
|
|
5408
|
+
&& shadowMode === 1
|
|
5409
|
+
/* Synthetic */
|
|
5410
|
+
;
|
|
5411
|
+
var hasScopedStyles = context.hasScopedStyles;
|
|
5412
|
+
var newToken;
|
|
5413
|
+
var newHasTokenInClass;
|
|
5414
|
+
var newHasTokenInAttribute; // Reset the styling token applied to the host element.
|
|
5342
5415
|
|
|
5343
|
-
var
|
|
5416
|
+
var oldToken = context.stylesheetToken,
|
|
5417
|
+
oldHasTokenInClass = context.hasTokenInClass,
|
|
5418
|
+
oldHasTokenInAttribute = context.hasTokenInAttribute;
|
|
5344
5419
|
|
|
5345
|
-
if (
|
|
5346
|
-
renderer.
|
|
5420
|
+
if (oldHasTokenInClass) {
|
|
5421
|
+
renderer.getClassList(elm).remove(makeHostToken(oldToken));
|
|
5422
|
+
}
|
|
5423
|
+
|
|
5424
|
+
if (oldHasTokenInAttribute) {
|
|
5425
|
+
renderer.removeAttribute(elm, makeHostToken(oldToken));
|
|
5347
5426
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
5348
|
-
// associated stylesheets.
|
|
5427
|
+
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
5349
5428
|
|
|
5350
5429
|
|
|
5351
|
-
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
}
|
|
5430
|
+
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
5431
|
+
newToken = newStylesheetToken;
|
|
5432
|
+
} // Set the new styling token on the host element
|
|
5433
|
+
|
|
5356
5434
|
|
|
5357
|
-
if (!isUndefined$1(
|
|
5358
|
-
|
|
5435
|
+
if (!isUndefined$1(newToken)) {
|
|
5436
|
+
if (hasScopedStyles) {
|
|
5437
|
+
renderer.getClassList(elm).add(makeHostToken(newToken));
|
|
5438
|
+
newHasTokenInClass = true;
|
|
5439
|
+
}
|
|
5440
|
+
|
|
5441
|
+
if (isSyntheticShadow) {
|
|
5442
|
+
renderer.setAttribute(elm, makeHostToken(newToken), '');
|
|
5443
|
+
newHasTokenInAttribute = true;
|
|
5444
|
+
}
|
|
5359
5445
|
} // Update the styling tokens present on the context object.
|
|
5360
5446
|
|
|
5361
5447
|
|
|
5362
|
-
context.
|
|
5363
|
-
context.
|
|
5448
|
+
context.stylesheetToken = newToken;
|
|
5449
|
+
context.hasTokenInClass = newHasTokenInClass;
|
|
5450
|
+
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
5364
5451
|
}
|
|
5365
5452
|
|
|
5366
|
-
function evaluateStylesheetsContent(stylesheets,
|
|
5453
|
+
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
5367
5454
|
var content = [];
|
|
5368
5455
|
|
|
5369
5456
|
for (var _i12 = 0; _i12 < stylesheets.length; _i12++) {
|
|
5370
5457
|
var stylesheet = stylesheets[_i12];
|
|
5371
5458
|
|
|
5372
5459
|
if (isArray$1(stylesheet)) {
|
|
5373
|
-
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet,
|
|
5460
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
5374
5461
|
} else {
|
|
5375
5462
|
if (process.env.NODE_ENV !== 'production') {
|
|
5376
5463
|
// in dev-mode, we support hot swapping of stylesheet, which means that
|
|
5377
5464
|
// the component instance might be attempting to use an old version of
|
|
5378
5465
|
// the stylesheet, while internally, we have a replacement for it.
|
|
5379
5466
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
5380
|
-
}
|
|
5467
|
+
} // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
5468
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
5469
|
+
|
|
5470
|
+
|
|
5471
|
+
var isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
5472
|
+
var useActualHostSelector = vm.renderMode === 0
|
|
5473
|
+
/* Light */
|
|
5474
|
+
? !isScopedCss : vm.shadowMode === 0
|
|
5475
|
+
/* Native */
|
|
5476
|
+
; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
5381
5477
|
|
|
5382
|
-
|
|
5478
|
+
var scopeToken = isScopedCss || vm.shadowMode === 1
|
|
5479
|
+
/* Synthetic */
|
|
5480
|
+
&& vm.renderMode === 1
|
|
5481
|
+
/* Shadow */
|
|
5482
|
+
? stylesheetToken : undefined;
|
|
5483
|
+
ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
|
|
5383
5484
|
}
|
|
5384
5485
|
}
|
|
5385
5486
|
|
|
@@ -5388,34 +5489,35 @@
|
|
|
5388
5489
|
|
|
5389
5490
|
function getStylesheetsContent(vm, template) {
|
|
5390
5491
|
var stylesheets = template.stylesheets,
|
|
5391
|
-
|
|
5392
|
-
var renderMode = vm.renderMode,
|
|
5393
|
-
shadowMode = vm.shadowMode;
|
|
5492
|
+
stylesheetToken = template.stylesheetToken;
|
|
5394
5493
|
var content = [];
|
|
5395
5494
|
|
|
5396
5495
|
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5496
|
+
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
5497
|
+
}
|
|
5498
|
+
|
|
5499
|
+
return content;
|
|
5500
|
+
} // It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
5501
|
+
// perf testing has not shown it to be a huge improvement yet:
|
|
5502
|
+
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
5503
|
+
|
|
5400
5504
|
|
|
5401
|
-
|
|
5505
|
+
function getNearestNativeShadowComponent(vm) {
|
|
5506
|
+
var owner = vm;
|
|
5507
|
+
|
|
5508
|
+
while (!isNull(owner)) {
|
|
5509
|
+
if (owner.renderMode === 1
|
|
5402
5510
|
/* Shadow */
|
|
5403
|
-
&& shadowMode ===
|
|
5404
|
-
/*
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
shadowSelector = "[".concat(stylesheetTokens.shadowAttribute, "]");
|
|
5408
|
-
} else {
|
|
5409
|
-
hostSelector = '';
|
|
5410
|
-
shadowSelector = '';
|
|
5511
|
+
&& owner.shadowMode === 0
|
|
5512
|
+
/* Native */
|
|
5513
|
+
) {
|
|
5514
|
+
return owner;
|
|
5411
5515
|
}
|
|
5412
5516
|
|
|
5413
|
-
|
|
5414
|
-
/* Native */
|
|
5415
|
-
);
|
|
5517
|
+
owner = owner.owner;
|
|
5416
5518
|
}
|
|
5417
5519
|
|
|
5418
|
-
return
|
|
5520
|
+
return owner;
|
|
5419
5521
|
}
|
|
5420
5522
|
|
|
5421
5523
|
function createStylesheet(vm, stylesheets) {
|
|
@@ -5431,13 +5533,26 @@
|
|
|
5431
5533
|
for (var _i13 = 0; _i13 < stylesheets.length; _i13++) {
|
|
5432
5534
|
renderer.insertGlobalStylesheet(stylesheets[_i13]);
|
|
5433
5535
|
}
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
} else {
|
|
5437
|
-
// native shadow or light DOM
|
|
5536
|
+
} else if (renderer.ssr) {
|
|
5537
|
+
// native shadow or light DOM, SSR
|
|
5438
5538
|
var combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5439
5539
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
5540
|
+
} else {
|
|
5541
|
+
// native shadow or light DOM, DOM renderer
|
|
5542
|
+
var root = getNearestNativeShadowComponent(vm);
|
|
5543
|
+
var isGlobal = isNull(root);
|
|
5544
|
+
|
|
5545
|
+
for (var _i14 = 0; _i14 < stylesheets.length; _i14++) {
|
|
5546
|
+
if (isGlobal) {
|
|
5547
|
+
renderer.insertGlobalStylesheet(stylesheets[_i14]);
|
|
5548
|
+
} else {
|
|
5549
|
+
// local level
|
|
5550
|
+
renderer.insertStylesheet(stylesheets[_i14], root.cmpRoot);
|
|
5551
|
+
}
|
|
5552
|
+
}
|
|
5440
5553
|
}
|
|
5554
|
+
|
|
5555
|
+
return null;
|
|
5441
5556
|
}
|
|
5442
5557
|
/*
|
|
5443
5558
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5635,8 +5750,7 @@
|
|
|
5635
5750
|
context = vm.context,
|
|
5636
5751
|
cmpSlots = vm.cmpSlots,
|
|
5637
5752
|
cmpTemplate = vm.cmpTemplate,
|
|
5638
|
-
tro = vm.tro
|
|
5639
|
-
shadowMode = vm.shadowMode;
|
|
5753
|
+
tro = vm.tro;
|
|
5640
5754
|
tro.observe(function () {
|
|
5641
5755
|
// Reset the cache memoizer for template when needed.
|
|
5642
5756
|
if (html !== cmpTemplate) {
|
|
@@ -5660,15 +5774,12 @@
|
|
|
5660
5774
|
|
|
5661
5775
|
vm.cmpTemplate = html; // Create a brand new template cache for the swapped templated.
|
|
5662
5776
|
|
|
5663
|
-
context.tplCache = create(null); //
|
|
5777
|
+
context.tplCache = create(null); // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
5664
5778
|
|
|
5665
|
-
|
|
5666
|
-
/* Synthetic */
|
|
5667
|
-
) {
|
|
5668
|
-
updateSyntheticShadowAttributes(vm, html);
|
|
5669
|
-
} // Evaluate, create stylesheet and cache the produced VNode for future
|
|
5670
|
-
// re-rendering.
|
|
5779
|
+
context.hasScopedStyles = computeHasScopedStyles(html); // Update the scoping token on the host element.
|
|
5671
5780
|
|
|
5781
|
+
updateStylesheetToken(vm, html); // Evaluate, create stylesheet and cache the produced VNode for future
|
|
5782
|
+
// re-rendering.
|
|
5672
5783
|
|
|
5673
5784
|
var stylesheetsContent = getStylesheetsContent(vm, html);
|
|
5674
5785
|
context.styleVNode = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);
|
|
@@ -5708,6 +5819,20 @@
|
|
|
5708
5819
|
|
|
5709
5820
|
return vnodes;
|
|
5710
5821
|
}
|
|
5822
|
+
|
|
5823
|
+
function computeHasScopedStyles(template) {
|
|
5824
|
+
var stylesheets = template.stylesheets;
|
|
5825
|
+
|
|
5826
|
+
if (!isUndefined$1(stylesheets)) {
|
|
5827
|
+
for (var _i15 = 0; _i15 < stylesheets.length; _i15++) {
|
|
5828
|
+
if (isTrue(stylesheets[_i15][KEY__SCOPED_CSS])) {
|
|
5829
|
+
return true;
|
|
5830
|
+
}
|
|
5831
|
+
}
|
|
5832
|
+
}
|
|
5833
|
+
|
|
5834
|
+
return false;
|
|
5835
|
+
}
|
|
5711
5836
|
/*
|
|
5712
5837
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5713
5838
|
* All rights reserved.
|
|
@@ -5930,8 +6055,8 @@
|
|
|
5930
6055
|
assert.isTrue(isObject(service), "Invalid service declaration, ".concat(service, ": service must be an object"));
|
|
5931
6056
|
}
|
|
5932
6057
|
|
|
5933
|
-
for (var
|
|
5934
|
-
var hookName = hooks[
|
|
6058
|
+
for (var _i16 = 0; _i16 < hooks.length; ++_i16) {
|
|
6059
|
+
var hookName = hooks[_i16];
|
|
5935
6060
|
|
|
5936
6061
|
if (hookName in service) {
|
|
5937
6062
|
var l = Services[hookName];
|
|
@@ -5954,8 +6079,8 @@
|
|
|
5954
6079
|
def = vm.def,
|
|
5955
6080
|
context = vm.context;
|
|
5956
6081
|
|
|
5957
|
-
for (var
|
|
5958
|
-
cbs[
|
|
6082
|
+
for (var _i17 = 0, _len6 = cbs.length; _i17 < _len6; ++_i17) {
|
|
6083
|
+
cbs[_i17].call(undefined, component, {}, def, context);
|
|
5959
6084
|
}
|
|
5960
6085
|
}
|
|
5961
6086
|
/*
|
|
@@ -5966,7 +6091,6 @@
|
|
|
5966
6091
|
*/
|
|
5967
6092
|
|
|
5968
6093
|
|
|
5969
|
-
var isNativeShadowRootDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
5970
6094
|
var idx = 0;
|
|
5971
6095
|
/** The internal slot used to associate different objects the engine manipulates with the VM */
|
|
5972
6096
|
|
|
@@ -6072,50 +6196,11 @@
|
|
|
6072
6196
|
return ancestor;
|
|
6073
6197
|
}
|
|
6074
6198
|
|
|
6075
|
-
function assertNotSyntheticComposedWithinNative(vm) {
|
|
6076
|
-
var isSynthetic = vm.renderMode === 1
|
|
6077
|
-
/* Shadow */
|
|
6078
|
-
&& vm.shadowMode === 1
|
|
6079
|
-
/* Synthetic */
|
|
6080
|
-
;
|
|
6081
|
-
|
|
6082
|
-
if (!isSynthetic) {
|
|
6083
|
-
return;
|
|
6084
|
-
}
|
|
6085
|
-
|
|
6086
|
-
var ancestor = getNearestShadowAncestor(vm);
|
|
6087
|
-
|
|
6088
|
-
if (!isNull(ancestor)) {
|
|
6089
|
-
// Any native shadow component being an ancestor of a synthetic shadow component is disallowed.
|
|
6090
|
-
assert.isFalse(ancestor.renderMode === 1
|
|
6091
|
-
/* Shadow */
|
|
6092
|
-
&& ancestor.shadowMode === 0
|
|
6093
|
-
/* Native */
|
|
6094
|
-
, "".concat(getComponentTag(vm), " (synthetic shadow DOM) cannot be composed inside of ").concat(getComponentTag(ancestor), " (native shadow DOM), because synthetic-within-native composition is disallowed"));
|
|
6095
|
-
}
|
|
6096
|
-
}
|
|
6097
|
-
|
|
6098
6199
|
function createVM(elm, def, options) {
|
|
6099
6200
|
var mode = options.mode,
|
|
6100
6201
|
owner = options.owner,
|
|
6101
6202
|
renderer = options.renderer,
|
|
6102
6203
|
tagName = options.tagName;
|
|
6103
|
-
var shadowMode;
|
|
6104
|
-
|
|
6105
|
-
if (renderer.syntheticShadow) {
|
|
6106
|
-
shadowMode = def.shadowSupportMode === "any"
|
|
6107
|
-
/* Any */
|
|
6108
|
-
&& isNativeShadowRootDefined ? 0
|
|
6109
|
-
/* Native */
|
|
6110
|
-
: 1
|
|
6111
|
-
/* Synthetic */
|
|
6112
|
-
;
|
|
6113
|
-
} else {
|
|
6114
|
-
shadowMode = 0
|
|
6115
|
-
/* Native */
|
|
6116
|
-
;
|
|
6117
|
-
}
|
|
6118
|
-
|
|
6119
6204
|
var vm = {
|
|
6120
6205
|
elm: elm,
|
|
6121
6206
|
def: def,
|
|
@@ -6138,10 +6223,12 @@
|
|
|
6138
6223
|
oar: create(null),
|
|
6139
6224
|
cmpTemplate: null,
|
|
6140
6225
|
renderMode: def.renderMode,
|
|
6141
|
-
shadowMode:
|
|
6226
|
+
shadowMode: null,
|
|
6142
6227
|
context: {
|
|
6143
|
-
|
|
6144
|
-
|
|
6228
|
+
stylesheetToken: undefined,
|
|
6229
|
+
hasTokenInClass: undefined,
|
|
6230
|
+
hasTokenInAttribute: undefined,
|
|
6231
|
+
hasScopedStyles: undefined,
|
|
6145
6232
|
styleVNode: null,
|
|
6146
6233
|
tplCache: EmptyObject,
|
|
6147
6234
|
wiredConnecting: EmptyArray,
|
|
@@ -6154,26 +6241,83 @@
|
|
|
6154
6241
|
setHook: setHook,
|
|
6155
6242
|
getHook: getHook
|
|
6156
6243
|
};
|
|
6244
|
+
vm.shadowMode = computeShadowMode(vm);
|
|
6157
6245
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
6158
6246
|
|
|
6159
6247
|
if (process.env.NODE_ENV !== 'production') {
|
|
6160
6248
|
vm.toString = function () {
|
|
6161
6249
|
return "[object:vm ".concat(def.name, " (").concat(vm.idx, ")]");
|
|
6162
6250
|
};
|
|
6163
|
-
|
|
6164
|
-
assertNotSyntheticComposedWithinNative(vm);
|
|
6165
6251
|
} // Create component instance associated to the vm and the element.
|
|
6166
6252
|
|
|
6167
6253
|
|
|
6168
6254
|
invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
|
|
6169
6255
|
|
|
6170
|
-
if (
|
|
6256
|
+
if (hasWireAdapters(vm)) {
|
|
6171
6257
|
installWireAdapters(vm);
|
|
6172
6258
|
}
|
|
6173
6259
|
|
|
6174
6260
|
return vm;
|
|
6175
6261
|
}
|
|
6176
6262
|
|
|
6263
|
+
function computeShadowMode(vm) {
|
|
6264
|
+
var def = vm.def,
|
|
6265
|
+
renderer = vm.renderer;
|
|
6266
|
+
var isNativeShadowDefined = renderer.isNativeShadowDefined,
|
|
6267
|
+
isSyntheticShadowDefined = renderer.isSyntheticShadowDefined;
|
|
6268
|
+
var shadowMode;
|
|
6269
|
+
|
|
6270
|
+
if (isSyntheticShadowDefined) {
|
|
6271
|
+
if (def.renderMode === 0
|
|
6272
|
+
/* Light */
|
|
6273
|
+
) {
|
|
6274
|
+
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
|
6275
|
+
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
6276
|
+
shadowMode = 0
|
|
6277
|
+
/* Native */
|
|
6278
|
+
;
|
|
6279
|
+
} else if (isNativeShadowDefined) {
|
|
6280
|
+
if (def.shadowSupportMode === "any"
|
|
6281
|
+
/* Any */
|
|
6282
|
+
) {
|
|
6283
|
+
shadowMode = 0
|
|
6284
|
+
/* Native */
|
|
6285
|
+
;
|
|
6286
|
+
} else {
|
|
6287
|
+
var shadowAncestor = getNearestShadowAncestor(vm);
|
|
6288
|
+
|
|
6289
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
6290
|
+
/* Native */
|
|
6291
|
+
) {
|
|
6292
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
6293
|
+
// transitively opts all of its descendants into native.
|
|
6294
|
+
shadowMode = 0
|
|
6295
|
+
/* Native */
|
|
6296
|
+
;
|
|
6297
|
+
} else {
|
|
6298
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
6299
|
+
// to be native.
|
|
6300
|
+
shadowMode = 1
|
|
6301
|
+
/* Synthetic */
|
|
6302
|
+
;
|
|
6303
|
+
}
|
|
6304
|
+
}
|
|
6305
|
+
} else {
|
|
6306
|
+
// Synthetic if there is no native Shadow DOM support.
|
|
6307
|
+
shadowMode = 1
|
|
6308
|
+
/* Synthetic */
|
|
6309
|
+
;
|
|
6310
|
+
}
|
|
6311
|
+
} else {
|
|
6312
|
+
// Native if the synthetic shadow polyfill is unavailable.
|
|
6313
|
+
shadowMode = 0
|
|
6314
|
+
/* Native */
|
|
6315
|
+
;
|
|
6316
|
+
}
|
|
6317
|
+
|
|
6318
|
+
return shadowMode;
|
|
6319
|
+
}
|
|
6320
|
+
|
|
6177
6321
|
function assertIsVM(obj) {
|
|
6178
6322
|
if (isNull(obj) || !isObject(obj) || !('cmpRoot' in obj)) {
|
|
6179
6323
|
throw new TypeError("".concat(obj, " is not a VM."));
|
|
@@ -6293,19 +6437,19 @@
|
|
|
6293
6437
|
});
|
|
6294
6438
|
rehydrateQueue = []; // reset to a new queue
|
|
6295
6439
|
|
|
6296
|
-
for (var
|
|
6297
|
-
var vm = vms[
|
|
6440
|
+
for (var _i18 = 0, _len7 = vms.length; _i18 < _len7; _i18 += 1) {
|
|
6441
|
+
var vm = vms[_i18];
|
|
6298
6442
|
|
|
6299
6443
|
try {
|
|
6300
6444
|
rehydrate(vm);
|
|
6301
6445
|
} catch (error) {
|
|
6302
|
-
if (
|
|
6446
|
+
if (_i18 + 1 < _len7) {
|
|
6303
6447
|
// pieces of the queue are still pending to be rehydrated, those should have priority
|
|
6304
6448
|
if (rehydrateQueue.length === 0) {
|
|
6305
6449
|
addCallbackToNextTick(flushRehydrationQueue);
|
|
6306
6450
|
}
|
|
6307
6451
|
|
|
6308
|
-
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms,
|
|
6452
|
+
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, _i18 + 1));
|
|
6309
6453
|
} // we need to end the measure before throwing.
|
|
6310
6454
|
|
|
6311
6455
|
|
|
@@ -6409,8 +6553,8 @@
|
|
|
6409
6553
|
var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
|
|
6410
6554
|
// inserted in reserved order.
|
|
6411
6555
|
|
|
6412
|
-
for (var
|
|
6413
|
-
var elm = vCustomElementCollection[
|
|
6556
|
+
for (var _i19 = vCustomElementCollection.length - 1; _i19 >= 0; _i19 -= 1) {
|
|
6557
|
+
var elm = vCustomElementCollection[_i19].elm; // There are two cases where the element could be undefined:
|
|
6414
6558
|
// * when there is an error during the construction phase, and an error
|
|
6415
6559
|
// boundary picks it, there is a possibility that the VCustomElement
|
|
6416
6560
|
// is not properly initialized, and therefore is should be ignored.
|
|
@@ -6444,8 +6588,8 @@
|
|
|
6444
6588
|
|
|
6445
6589
|
|
|
6446
6590
|
function recursivelyDisconnectChildren(vnodes) {
|
|
6447
|
-
for (var
|
|
6448
|
-
var vnode = vnodes[
|
|
6591
|
+
for (var _i20 = 0, _len8 = vnodes.length; _i20 < _len8; _i20 += 1) {
|
|
6592
|
+
var vnode = vnodes[_i20];
|
|
6449
6593
|
|
|
6450
6594
|
if (!isNull(vnode) && isArray$1(vnode.children) && !isUndefined$1(vnode.elm)) {
|
|
6451
6595
|
// vnode is a VElement with children
|
|
@@ -6469,8 +6613,8 @@
|
|
|
6469
6613
|
renderer = vm.renderer;
|
|
6470
6614
|
var rootNode = getRenderRoot(vm);
|
|
6471
6615
|
|
|
6472
|
-
for (var
|
|
6473
|
-
var child = children[
|
|
6616
|
+
for (var _i21 = 0, _len9 = children.length; _i21 < _len9; _i21++) {
|
|
6617
|
+
var child = children[_i21];
|
|
6474
6618
|
|
|
6475
6619
|
if (!isNull(child) && !isUndefined$1(child.elm)) {
|
|
6476
6620
|
renderer.remove(child.elm, rootNode);
|
|
@@ -6515,8 +6659,8 @@
|
|
|
6515
6659
|
var oldSlots = vm.cmpSlots;
|
|
6516
6660
|
var cmpSlots = vm.cmpSlots = create(null);
|
|
6517
6661
|
|
|
6518
|
-
for (var
|
|
6519
|
-
var vnode = children[
|
|
6662
|
+
for (var _i22 = 0, _len10 = children.length; _i22 < _len10; _i22 += 1) {
|
|
6663
|
+
var vnode = children[_i22];
|
|
6520
6664
|
|
|
6521
6665
|
if (isNull(vnode)) {
|
|
6522
6666
|
continue;
|
|
@@ -6546,8 +6690,8 @@
|
|
|
6546
6690
|
return;
|
|
6547
6691
|
}
|
|
6548
6692
|
|
|
6549
|
-
for (var
|
|
6550
|
-
var key = oldKeys[
|
|
6693
|
+
for (var _i23 = 0, _len11 = oldKeys.length; _i23 < _len11; _i23 += 1) {
|
|
6694
|
+
var key = oldKeys[_i23];
|
|
6551
6695
|
|
|
6552
6696
|
if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
|
|
6553
6697
|
markComponentAsDirty(vm);
|
|
@@ -6889,11 +7033,14 @@
|
|
|
6889
7033
|
ArrayPush$1.call(wiredConnecting, function () {
|
|
6890
7034
|
connector.connect();
|
|
6891
7035
|
|
|
6892
|
-
if (
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
7036
|
+
if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
7037
|
+
if (hasDynamicParams) {
|
|
7038
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
7039
|
+
return;
|
|
7040
|
+
}
|
|
6896
7041
|
}
|
|
7042
|
+
|
|
7043
|
+
computeConfigAndUpdate();
|
|
6897
7044
|
});
|
|
6898
7045
|
ArrayPush$1.call(wiredDisconnecting, function () {
|
|
6899
7046
|
connector.disconnect();
|
|
@@ -6907,8 +7054,8 @@
|
|
|
6907
7054
|
function connectWireAdapters(vm) {
|
|
6908
7055
|
var wiredConnecting = vm.context.wiredConnecting;
|
|
6909
7056
|
|
|
6910
|
-
for (var
|
|
6911
|
-
wiredConnecting[
|
|
7057
|
+
for (var _i24 = 0, _len12 = wiredConnecting.length; _i24 < _len12; _i24 += 1) {
|
|
7058
|
+
wiredConnecting[_i24]();
|
|
6912
7059
|
}
|
|
6913
7060
|
}
|
|
6914
7061
|
|
|
@@ -6916,8 +7063,8 @@
|
|
|
6916
7063
|
var wiredDisconnecting = vm.context.wiredDisconnecting;
|
|
6917
7064
|
runWithBoundaryProtection(vm, vm, noop, function () {
|
|
6918
7065
|
// job
|
|
6919
|
-
for (var
|
|
6920
|
-
wiredDisconnecting[
|
|
7066
|
+
for (var _i25 = 0, _len13 = wiredDisconnecting.length; _i25 < _len13; _i25 += 1) {
|
|
7067
|
+
wiredDisconnecting[_i25]();
|
|
6921
7068
|
}
|
|
6922
7069
|
}, noop);
|
|
6923
7070
|
}
|
|
@@ -6992,7 +7139,7 @@
|
|
|
6992
7139
|
|
|
6993
7140
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
6994
7141
|
}
|
|
6995
|
-
/* version: 2.
|
|
7142
|
+
/* version: 2.5.1 */
|
|
6996
7143
|
|
|
6997
7144
|
/*
|
|
6998
7145
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7007,14 +7154,18 @@
|
|
|
7007
7154
|
if (process.env.NODE_ENV === 'development') {
|
|
7008
7155
|
// @ts-ignore
|
|
7009
7156
|
window.__lwcResetGlobalStylesheets = function () {
|
|
7010
|
-
for (var
|
|
7011
|
-
var key = _Object$keys[
|
|
7157
|
+
for (var _i26 = 0, _Object$keys = Object.keys(globalStylesheets); _i26 < _Object$keys.length; _i26++) {
|
|
7158
|
+
var key = _Object$keys[_i26];
|
|
7012
7159
|
delete globalStylesheets[key];
|
|
7013
7160
|
}
|
|
7014
7161
|
};
|
|
7015
7162
|
}
|
|
7016
7163
|
|
|
7017
7164
|
var globalStylesheetsParentElement = document.head || document.body || document;
|
|
7165
|
+
var supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync);
|
|
7166
|
+
var styleElements = create(null);
|
|
7167
|
+
var styleSheets = create(null);
|
|
7168
|
+
var nodesToStyleSheets = new WeakMap();
|
|
7018
7169
|
var getCustomElement, defineCustomElement, HTMLElementConstructor;
|
|
7019
7170
|
|
|
7020
7171
|
function isCustomElementRegistryAvailable() {
|
|
@@ -7053,6 +7204,52 @@
|
|
|
7053
7204
|
}
|
|
7054
7205
|
}
|
|
7055
7206
|
|
|
7207
|
+
function insertConstructableStyleSheet(content, target) {
|
|
7208
|
+
// It's important for CSSStyleSheets to be unique based on their content, so that
|
|
7209
|
+
// `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
|
|
7210
|
+
var styleSheet = styleSheets[content];
|
|
7211
|
+
|
|
7212
|
+
if (isUndefined$1(styleSheet)) {
|
|
7213
|
+
styleSheet = new CSSStyleSheet();
|
|
7214
|
+
styleSheet.replaceSync(content);
|
|
7215
|
+
styleSheets[content] = styleSheet;
|
|
7216
|
+
}
|
|
7217
|
+
|
|
7218
|
+
if (!target.adoptedStyleSheets.includes(styleSheet)) {
|
|
7219
|
+
target.adoptedStyleSheets = [].concat(_toConsumableArray(target.adoptedStyleSheets), [styleSheet]);
|
|
7220
|
+
}
|
|
7221
|
+
}
|
|
7222
|
+
|
|
7223
|
+
function insertStyleElement(content, target) {
|
|
7224
|
+
// Avoid inserting duplicate `<style>`s
|
|
7225
|
+
var sheets = nodesToStyleSheets.get(target);
|
|
7226
|
+
|
|
7227
|
+
if (isUndefined$1(sheets)) {
|
|
7228
|
+
sheets = create(null);
|
|
7229
|
+
nodesToStyleSheets.set(target, sheets);
|
|
7230
|
+
}
|
|
7231
|
+
|
|
7232
|
+
if (sheets[content]) {
|
|
7233
|
+
return;
|
|
7234
|
+
}
|
|
7235
|
+
|
|
7236
|
+
sheets[content] = true; // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
|
|
7237
|
+
// faster to call `cloneNode()` on an existing node than to recreate it every time.
|
|
7238
|
+
|
|
7239
|
+
var elm = styleElements[content];
|
|
7240
|
+
|
|
7241
|
+
if (isUndefined$1(elm)) {
|
|
7242
|
+
elm = document.createElement('style');
|
|
7243
|
+
elm.type = 'text/css';
|
|
7244
|
+
elm.textContent = content;
|
|
7245
|
+
styleElements[content] = elm;
|
|
7246
|
+
} else {
|
|
7247
|
+
elm = elm.cloneNode(true);
|
|
7248
|
+
}
|
|
7249
|
+
|
|
7250
|
+
target.appendChild(elm);
|
|
7251
|
+
}
|
|
7252
|
+
|
|
7056
7253
|
if (isCustomElementRegistryAvailable()) {
|
|
7057
7254
|
getCustomElement = customElements.get.bind(customElements);
|
|
7058
7255
|
defineCustomElement = customElements.define.bind(customElements);
|
|
@@ -7096,7 +7293,8 @@
|
|
|
7096
7293
|
|
|
7097
7294
|
var renderer = {
|
|
7098
7295
|
ssr: false,
|
|
7099
|
-
|
|
7296
|
+
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7297
|
+
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7100
7298
|
createElement: function createElement(tagName, namespace) {
|
|
7101
7299
|
return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
|
|
7102
7300
|
},
|
|
@@ -7193,6 +7391,14 @@
|
|
|
7193
7391
|
elm.textContent = content;
|
|
7194
7392
|
globalStylesheetsParentElement.appendChild(elm);
|
|
7195
7393
|
},
|
|
7394
|
+
insertStylesheet: function insertStylesheet(content, target) {
|
|
7395
|
+
if (supportsConstructableStyleSheets) {
|
|
7396
|
+
insertConstructableStyleSheet(content, target);
|
|
7397
|
+
} else {
|
|
7398
|
+
// Fall back to <style> element
|
|
7399
|
+
insertStyleElement(content, target);
|
|
7400
|
+
}
|
|
7401
|
+
},
|
|
7196
7402
|
assertInstanceOfHTMLElement: function assertInstanceOfHTMLElement(elm, msg) {
|
|
7197
7403
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7198
7404
|
},
|
|
@@ -7434,7 +7640,7 @@
|
|
|
7434
7640
|
return false;
|
|
7435
7641
|
}
|
|
7436
7642
|
|
|
7437
|
-
if (renderer.
|
|
7643
|
+
if (renderer.isSyntheticShadowDefined) {
|
|
7438
7644
|
// TODO [#1252]: old behavior that is still used by some pieces of the platform,
|
|
7439
7645
|
// specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
|
|
7440
7646
|
// used, will be considered global elements.
|
|
@@ -7486,7 +7692,7 @@
|
|
|
7486
7692
|
});
|
|
7487
7693
|
freeze(LightningElement);
|
|
7488
7694
|
seal(LightningElement.prototype);
|
|
7489
|
-
/* version: 2.
|
|
7695
|
+
/* version: 2.5.1 */
|
|
7490
7696
|
|
|
7491
7697
|
exports.LightningElement = LightningElement;
|
|
7492
7698
|
exports.__unstable__ProfilerControl = profilerControl;
|