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
|
@@ -107,6 +107,10 @@ var LWC = (function (exports) {
|
|
|
107
107
|
return obj === false;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
function isBoolean(obj) {
|
|
111
|
+
return typeof obj === 'boolean';
|
|
112
|
+
}
|
|
113
|
+
|
|
110
114
|
function isFunction$1(obj) {
|
|
111
115
|
return typeof obj === 'function';
|
|
112
116
|
}
|
|
@@ -249,6 +253,7 @@ var LWC = (function (exports) {
|
|
|
249
253
|
const KEY__SHADOW_RESOLVER = '$shadowResolver$';
|
|
250
254
|
const KEY__SHADOW_TOKEN = '$shadowToken$';
|
|
251
255
|
const KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
|
|
256
|
+
const KEY__SCOPED_CSS = '$scoped$';
|
|
252
257
|
/**
|
|
253
258
|
* Map composed of properties to attributes not following the HTML property to attribute mapping
|
|
254
259
|
* convention.
|
|
@@ -297,7 +302,7 @@ var LWC = (function (exports) {
|
|
|
297
302
|
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
|
298
303
|
return attributeName;
|
|
299
304
|
}
|
|
300
|
-
/** version: 2.
|
|
305
|
+
/** version: 2.5.1 */
|
|
301
306
|
|
|
302
307
|
/*
|
|
303
308
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -402,19 +407,33 @@ var LWC = (function (exports) {
|
|
|
402
407
|
*/
|
|
403
408
|
|
|
404
409
|
|
|
410
|
+
const features = {
|
|
411
|
+
ENABLE_REACTIVE_SETTER: null,
|
|
412
|
+
ENABLE_HMR: null,
|
|
413
|
+
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
414
|
+
ENABLE_ELEMENT_PATCH: null,
|
|
415
|
+
ENABLE_NODE_LIST_PATCH: null,
|
|
416
|
+
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
417
|
+
ENABLE_NODE_PATCH: null,
|
|
418
|
+
ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
|
|
419
|
+
ENABLE_MIXED_SHADOW_MODE: null,
|
|
420
|
+
ENABLE_WIRE_SYNC_EMIT: null
|
|
421
|
+
};
|
|
422
|
+
|
|
405
423
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
406
424
|
Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
|
|
407
425
|
value: create(null)
|
|
408
426
|
});
|
|
409
427
|
}
|
|
410
428
|
|
|
411
|
-
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
412
|
-
|
|
429
|
+
const runtimeFlags = _globalThis.lwcRuntimeFlags;
|
|
430
|
+
/**
|
|
431
|
+
* Set the value at runtime of a given feature flag. This method only be invoked once per feature
|
|
432
|
+
* flag. It is meant to be used during the app initialization.
|
|
433
|
+
*/
|
|
413
434
|
|
|
414
435
|
function setFeatureFlag(name, value) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
if (!isBoolean) {
|
|
436
|
+
if (!isBoolean(value)) {
|
|
418
437
|
const message = `Failed to set the value "${value}" for the runtime feature flag "${name}". Runtime feature flags can only be set to a boolean value.`;
|
|
419
438
|
|
|
420
439
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -426,9 +445,10 @@ var LWC = (function (exports) {
|
|
|
426
445
|
}
|
|
427
446
|
}
|
|
428
447
|
|
|
429
|
-
if (isUndefined$1(
|
|
430
|
-
// eslint-disable-next-line no-console
|
|
431
|
-
|
|
448
|
+
if (isUndefined$1(features[name])) {
|
|
449
|
+
const availableFlags = keys(features).map(name => `"${name}"`).join(', '); // eslint-disable-next-line no-console
|
|
450
|
+
|
|
451
|
+
console.warn(`Failed to set the value "${value}" for the runtime feature flag "${name}" because it is undefined. Available flags: ${availableFlags}.`);
|
|
432
452
|
return;
|
|
433
453
|
}
|
|
434
454
|
|
|
@@ -445,37 +465,23 @@ var LWC = (function (exports) {
|
|
|
445
465
|
return;
|
|
446
466
|
}
|
|
447
467
|
|
|
448
|
-
|
|
468
|
+
defineProperty(runtimeFlags, name, {
|
|
449
469
|
value
|
|
450
470
|
});
|
|
451
471
|
}
|
|
452
|
-
}
|
|
453
|
-
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Set the value at runtime of a given feature flag. This method should only be used for testing
|
|
475
|
+
* purposes. It is a no-op when invoked in production mode.
|
|
476
|
+
*/
|
|
454
477
|
|
|
455
478
|
|
|
456
479
|
function setFeatureFlagForTest(name, value) {
|
|
457
480
|
if (process.env.NODE_ENV !== 'production') {
|
|
458
|
-
|
|
481
|
+
setFeatureFlag(name, value);
|
|
459
482
|
}
|
|
460
483
|
}
|
|
461
|
-
|
|
462
|
-
const featureFlagLookup = {
|
|
463
|
-
ENABLE_REACTIVE_SETTER: null,
|
|
464
|
-
ENABLE_HMR: null,
|
|
465
|
-
// Flag to toggle on/off the enforcement of innerText/outerText shadow dom semantic in elements when using synthetic shadow.
|
|
466
|
-
// Note: Once active, elements outside the lwc boundary are controlled by the ENABLE_ELEMENT_PATCH flag.
|
|
467
|
-
ENABLE_INNER_OUTER_TEXT_PATCH: null,
|
|
468
|
-
// Flags to toggle on/off the enforcement of shadow dom semantic in element/node outside lwc boundary when using synthetic shadow.
|
|
469
|
-
ENABLE_ELEMENT_PATCH: null,
|
|
470
|
-
ENABLE_NODE_LIST_PATCH: null,
|
|
471
|
-
ENABLE_HTML_COLLECTIONS_PATCH: null,
|
|
472
|
-
ENABLE_NODE_PATCH: null,
|
|
473
|
-
// Disables the fix for #2121 where non-composed events are visible outside of their shadow root.
|
|
474
|
-
ENABLE_NON_COMPOSED_EVENTS_LEAKAGE: null,
|
|
475
|
-
ENABLE_LIGHT_DOM_COMPONENTS: null,
|
|
476
|
-
ENABLE_MIXED_SHADOW_MODE: null
|
|
477
|
-
};
|
|
478
|
-
/** version: 2.3.4 */
|
|
484
|
+
/** version: 2.5.1 */
|
|
479
485
|
|
|
480
486
|
/* proxy-compat-disable */
|
|
481
487
|
|
|
@@ -486,6 +492,7 @@ var LWC = (function (exports) {
|
|
|
486
492
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
487
493
|
*/
|
|
488
494
|
|
|
495
|
+
|
|
489
496
|
let nextTickCallbackQueue = [];
|
|
490
497
|
const SPACE_CHAR = 32;
|
|
491
498
|
const EmptyObject = seal(create(null));
|
|
@@ -2806,12 +2813,6 @@ var LWC = (function (exports) {
|
|
|
2806
2813
|
associateVM(component, vm);
|
|
2807
2814
|
associateVM(elm, vm);
|
|
2808
2815
|
|
|
2809
|
-
if (!runtimeFlags.ENABLE_LIGHT_DOM_COMPONENTS) {
|
|
2810
|
-
assert.isTrue(def.renderMode !== 0
|
|
2811
|
-
/* Light */
|
|
2812
|
-
, `${def.name || 'Anonymous class'} is an invalid LWC component. Light DOM components are not available in this environment.`);
|
|
2813
|
-
}
|
|
2814
|
-
|
|
2815
2816
|
if (vm.renderMode === 1
|
|
2816
2817
|
/* Shadow */
|
|
2817
2818
|
) {
|
|
@@ -2850,6 +2851,12 @@ var LWC = (function (exports) {
|
|
|
2850
2851
|
if (process.env.NODE_ENV !== 'production') {
|
|
2851
2852
|
patchShadowRootWithRestrictions(cmpRoot);
|
|
2852
2853
|
}
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
function warnIfInvokedDuringConstruction(vm, methodName) {
|
|
2857
|
+
if (isBeingConstructed(vm)) {
|
|
2858
|
+
logError(`this.${methodName}() should not be called during the construction of the custom element for ${getComponentTag(vm)} because the element is not yet in the DOM or has no children yet.`);
|
|
2859
|
+
}
|
|
2853
2860
|
} // @ts-ignore
|
|
2854
2861
|
|
|
2855
2862
|
|
|
@@ -3008,7 +3015,7 @@ var LWC = (function (exports) {
|
|
|
3008
3015
|
} = vm;
|
|
3009
3016
|
|
|
3010
3017
|
if (process.env.NODE_ENV !== 'production') {
|
|
3011
|
-
|
|
3018
|
+
warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect');
|
|
3012
3019
|
}
|
|
3013
3020
|
|
|
3014
3021
|
return getBoundingClientRect(elm);
|
|
@@ -3024,7 +3031,7 @@ var LWC = (function (exports) {
|
|
|
3024
3031
|
} = vm;
|
|
3025
3032
|
|
|
3026
3033
|
if (process.env.NODE_ENV !== 'production') {
|
|
3027
|
-
|
|
3034
|
+
warnIfInvokedDuringConstruction(vm, 'querySelector');
|
|
3028
3035
|
}
|
|
3029
3036
|
|
|
3030
3037
|
return querySelector(elm, selectors);
|
|
@@ -3040,7 +3047,7 @@ var LWC = (function (exports) {
|
|
|
3040
3047
|
} = vm;
|
|
3041
3048
|
|
|
3042
3049
|
if (process.env.NODE_ENV !== 'production') {
|
|
3043
|
-
|
|
3050
|
+
warnIfInvokedDuringConstruction(vm, 'querySelectorAll');
|
|
3044
3051
|
}
|
|
3045
3052
|
|
|
3046
3053
|
return querySelectorAll(elm, selectors);
|
|
@@ -3056,7 +3063,7 @@ var LWC = (function (exports) {
|
|
|
3056
3063
|
} = vm;
|
|
3057
3064
|
|
|
3058
3065
|
if (process.env.NODE_ENV !== 'production') {
|
|
3059
|
-
|
|
3066
|
+
warnIfInvokedDuringConstruction(vm, 'getElementsByTagName');
|
|
3060
3067
|
}
|
|
3061
3068
|
|
|
3062
3069
|
return getElementsByTagName(elm, tagNameOrWildCard);
|
|
@@ -3072,7 +3079,7 @@ var LWC = (function (exports) {
|
|
|
3072
3079
|
} = vm;
|
|
3073
3080
|
|
|
3074
3081
|
if (process.env.NODE_ENV !== 'production') {
|
|
3075
|
-
|
|
3082
|
+
warnIfInvokedDuringConstruction(vm, 'getElementsByClassName');
|
|
3076
3083
|
}
|
|
3077
3084
|
|
|
3078
3085
|
return getElementsByClassName(elm, names);
|
|
@@ -3445,18 +3452,33 @@ var LWC = (function (exports) {
|
|
|
3445
3452
|
|
|
3446
3453
|
function getClassDescriptorType(descriptor) {
|
|
3447
3454
|
if (isFunction$1(descriptor.value)) {
|
|
3448
|
-
return
|
|
3455
|
+
return "method"
|
|
3456
|
+
/* Method */
|
|
3457
|
+
;
|
|
3449
3458
|
} else if (isFunction$1(descriptor.set) || isFunction$1(descriptor.get)) {
|
|
3450
|
-
return
|
|
3459
|
+
return "accessor"
|
|
3460
|
+
/* Accessor */
|
|
3461
|
+
;
|
|
3451
3462
|
} else {
|
|
3452
|
-
return
|
|
3463
|
+
return "field"
|
|
3464
|
+
/* Field */
|
|
3465
|
+
;
|
|
3453
3466
|
}
|
|
3454
3467
|
}
|
|
3455
3468
|
|
|
3456
3469
|
function validateObservedField(Ctor, fieldName, descriptor) {
|
|
3457
3470
|
if (!isUndefined$1(descriptor)) {
|
|
3458
3471
|
const type = getClassDescriptorType(descriptor);
|
|
3459
|
-
|
|
3472
|
+
const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`; // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.
|
|
3473
|
+
// This branch is only here for backward compatibility reasons.
|
|
3474
|
+
|
|
3475
|
+
if (type === "accessor"
|
|
3476
|
+
/* Accessor */
|
|
3477
|
+
) {
|
|
3478
|
+
logError(message);
|
|
3479
|
+
} else {
|
|
3480
|
+
assert.fail(message);
|
|
3481
|
+
}
|
|
3460
3482
|
}
|
|
3461
3483
|
}
|
|
3462
3484
|
|
|
@@ -3483,7 +3505,16 @@ var LWC = (function (exports) {
|
|
|
3483
3505
|
function validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {
|
|
3484
3506
|
if (!isUndefined$1(descriptor)) {
|
|
3485
3507
|
const type = getClassDescriptorType(descriptor);
|
|
3486
|
-
|
|
3508
|
+
const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`; // [W-9927596] Ideally we always throw an error when detecting duplicate public properties.
|
|
3509
|
+
// This branch is only here for backward compatibility reasons.
|
|
3510
|
+
|
|
3511
|
+
if (type === "accessor"
|
|
3512
|
+
/* Accessor */
|
|
3513
|
+
) {
|
|
3514
|
+
logError(message);
|
|
3515
|
+
} else {
|
|
3516
|
+
assert.fail(message);
|
|
3517
|
+
}
|
|
3487
3518
|
}
|
|
3488
3519
|
}
|
|
3489
3520
|
|
|
@@ -3546,9 +3577,16 @@ var LWC = (function (exports) {
|
|
|
3546
3577
|
// field declaration
|
|
3547
3578
|
if (process.env.NODE_ENV !== 'production') {
|
|
3548
3579
|
validateFieldDecoratedWithApi(Ctor, fieldName, descriptor);
|
|
3549
|
-
}
|
|
3580
|
+
} // [W-9927596] If a component has both a public property and a private setter/getter
|
|
3581
|
+
// with the same name, the property is defined as a public accessor. This branch is
|
|
3582
|
+
// only here for backward compatibility reasons.
|
|
3583
|
+
|
|
3550
3584
|
|
|
3551
|
-
descriptor
|
|
3585
|
+
if (!isUndefined$1(descriptor) && !isUndefined$1(descriptor.get)) {
|
|
3586
|
+
descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
|
|
3587
|
+
} else {
|
|
3588
|
+
descriptor = createPublicPropertyDescriptor(fieldName);
|
|
3589
|
+
}
|
|
3552
3590
|
}
|
|
3553
3591
|
|
|
3554
3592
|
apiFields[fieldName] = descriptor;
|
|
@@ -3628,9 +3666,16 @@ var LWC = (function (exports) {
|
|
|
3628
3666
|
|
|
3629
3667
|
if (process.env.NODE_ENV !== 'production') {
|
|
3630
3668
|
validateObservedField(Ctor, fieldName, descriptor);
|
|
3631
|
-
}
|
|
3669
|
+
} // [W-9927596] Only mark a field as observed whenever it isn't a duplicated public nor
|
|
3670
|
+
// tracked property. This is only here for backward compatibility purposes.
|
|
3671
|
+
|
|
3632
3672
|
|
|
3633
|
-
|
|
3673
|
+
const isDuplicatePublicProp = !isUndefined$1(publicProps) && fieldName in publicProps;
|
|
3674
|
+
const isDuplicateTrackedProp = !isUndefined$1(track) && fieldName in track;
|
|
3675
|
+
|
|
3676
|
+
if (!isDuplicatePublicProp && !isDuplicateTrackedProp) {
|
|
3677
|
+
observedFields[fieldName] = createObservedFieldPropertyDescriptor(fieldName);
|
|
3678
|
+
}
|
|
3634
3679
|
}
|
|
3635
3680
|
}
|
|
3636
3681
|
|
|
@@ -4482,6 +4527,19 @@ var LWC = (function (exports) {
|
|
|
4482
4527
|
|
|
4483
4528
|
function setElementShadowToken(elm, token) {
|
|
4484
4529
|
elm.$shadowToken$ = token;
|
|
4530
|
+
} // Set the scope token class for *.scoped.css styles
|
|
4531
|
+
|
|
4532
|
+
|
|
4533
|
+
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
4534
|
+
const {
|
|
4535
|
+
cmpTemplate,
|
|
4536
|
+
context
|
|
4537
|
+
} = owner;
|
|
4538
|
+
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
4539
|
+
|
|
4540
|
+
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
4541
|
+
owner.renderer.getClassList(elm).add(token);
|
|
4542
|
+
}
|
|
4485
4543
|
}
|
|
4486
4544
|
|
|
4487
4545
|
function updateNodeHook(oldVnode, vnode) {
|
|
@@ -4555,6 +4613,7 @@ var LWC = (function (exports) {
|
|
|
4555
4613
|
const {
|
|
4556
4614
|
owner
|
|
4557
4615
|
} = vnode;
|
|
4616
|
+
setScopeTokenClassIfNecessary(elm, owner);
|
|
4558
4617
|
|
|
4559
4618
|
if (owner.shadowMode === 1
|
|
4560
4619
|
/* Synthetic */
|
|
@@ -4565,7 +4624,7 @@ var LWC = (function (exports) {
|
|
|
4565
4624
|
}
|
|
4566
4625
|
} = vnode;
|
|
4567
4626
|
const {
|
|
4568
|
-
|
|
4627
|
+
stylesheetToken
|
|
4569
4628
|
} = owner.context;
|
|
4570
4629
|
|
|
4571
4630
|
if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
@@ -4577,7 +4636,7 @@ var LWC = (function (exports) {
|
|
|
4577
4636
|
// into each element from the template, so they can be styled accordingly.
|
|
4578
4637
|
|
|
4579
4638
|
|
|
4580
|
-
setElementShadowToken(elm,
|
|
4639
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4581
4640
|
}
|
|
4582
4641
|
|
|
4583
4642
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4666,16 +4725,17 @@ var LWC = (function (exports) {
|
|
|
4666
4725
|
ctor,
|
|
4667
4726
|
owner
|
|
4668
4727
|
} = vnode;
|
|
4728
|
+
setScopeTokenClassIfNecessary(elm, owner);
|
|
4669
4729
|
|
|
4670
4730
|
if (owner.shadowMode === 1
|
|
4671
4731
|
/* Synthetic */
|
|
4672
4732
|
) {
|
|
4673
4733
|
const {
|
|
4674
|
-
|
|
4734
|
+
stylesheetToken
|
|
4675
4735
|
} = owner.context; // when running in synthetic shadow mode, we need to set the shadowToken value
|
|
4676
4736
|
// into each element from the template, so they can be styled accordingly.
|
|
4677
4737
|
|
|
4678
|
-
setElementShadowToken(elm,
|
|
4738
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4679
4739
|
}
|
|
4680
4740
|
|
|
4681
4741
|
const def = getComponentInternalDef(ctor);
|
|
@@ -4975,13 +5035,19 @@ var LWC = (function (exports) {
|
|
|
4975
5035
|
|
|
4976
5036
|
function linkNodeToShadow(elm, owner) {
|
|
4977
5037
|
const {
|
|
5038
|
+
renderer,
|
|
5039
|
+
renderMode,
|
|
4978
5040
|
shadowMode
|
|
4979
5041
|
} = owner; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4980
5042
|
|
|
4981
|
-
if (
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
5043
|
+
if (renderer.isSyntheticShadowDefined) {
|
|
5044
|
+
if (shadowMode === 1
|
|
5045
|
+
/* Synthetic */
|
|
5046
|
+
|| renderMode === 0
|
|
5047
|
+
/* Light */
|
|
5048
|
+
) {
|
|
5049
|
+
elm[KEY__SHADOW_RESOLVER] = getRenderRoot(owner)[KEY__SHADOW_RESOLVER];
|
|
5050
|
+
}
|
|
4985
5051
|
}
|
|
4986
5052
|
}
|
|
4987
5053
|
|
|
@@ -5327,14 +5393,11 @@ var LWC = (function (exports) {
|
|
|
5327
5393
|
|
|
5328
5394
|
const {
|
|
5329
5395
|
idx,
|
|
5330
|
-
renderMode,
|
|
5331
5396
|
shadowMode
|
|
5332
5397
|
} = vmBeingRendered;
|
|
5333
5398
|
|
|
5334
5399
|
if (shadowMode === 1
|
|
5335
5400
|
/* Synthetic */
|
|
5336
|
-
&& renderMode === 1
|
|
5337
|
-
/* Shadow */
|
|
5338
5401
|
) {
|
|
5339
5402
|
return StringReplace.call(id, /\S+/g, id => `${id}-${idx}`);
|
|
5340
5403
|
}
|
|
@@ -5363,14 +5426,11 @@ var LWC = (function (exports) {
|
|
|
5363
5426
|
|
|
5364
5427
|
const {
|
|
5365
5428
|
idx,
|
|
5366
|
-
renderMode,
|
|
5367
5429
|
shadowMode
|
|
5368
5430
|
} = vmBeingRendered; // Apply transformation only for fragment-only-urls, and only in shadow DOM
|
|
5369
5431
|
|
|
5370
5432
|
if (shadowMode === 1
|
|
5371
5433
|
/* Synthetic */
|
|
5372
|
-
&& renderMode === 1
|
|
5373
|
-
/* Shadow */
|
|
5374
5434
|
&& /^#/.test(url)) {
|
|
5375
5435
|
return `${url}-${idx}`;
|
|
5376
5436
|
}
|
|
@@ -5471,6 +5531,10 @@ var LWC = (function (exports) {
|
|
|
5471
5531
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5472
5532
|
*/
|
|
5473
5533
|
|
|
5534
|
+
function makeHostToken(token) {
|
|
5535
|
+
return `${token}-host`;
|
|
5536
|
+
}
|
|
5537
|
+
|
|
5474
5538
|
function createInlineStyleVNode(content) {
|
|
5475
5539
|
return h('style', {
|
|
5476
5540
|
key: 'style',
|
|
@@ -5480,59 +5544,100 @@ var LWC = (function (exports) {
|
|
|
5480
5544
|
}, [t(content)]);
|
|
5481
5545
|
}
|
|
5482
5546
|
|
|
5483
|
-
function
|
|
5547
|
+
function updateStylesheetToken(vm, template) {
|
|
5484
5548
|
const {
|
|
5485
5549
|
elm,
|
|
5486
5550
|
context,
|
|
5487
5551
|
renderer,
|
|
5488
|
-
renderMode
|
|
5552
|
+
renderMode,
|
|
5553
|
+
shadowMode
|
|
5489
5554
|
} = vm;
|
|
5490
5555
|
const {
|
|
5491
5556
|
stylesheets: newStylesheets,
|
|
5492
|
-
|
|
5557
|
+
stylesheetToken: newStylesheetToken
|
|
5493
5558
|
} = template;
|
|
5494
|
-
|
|
5559
|
+
const isSyntheticShadow = renderMode === 1
|
|
5560
|
+
/* Shadow */
|
|
5561
|
+
&& shadowMode === 1
|
|
5562
|
+
/* Synthetic */
|
|
5563
|
+
;
|
|
5564
|
+
const {
|
|
5565
|
+
hasScopedStyles
|
|
5566
|
+
} = context;
|
|
5567
|
+
let newToken;
|
|
5568
|
+
let newHasTokenInClass;
|
|
5569
|
+
let newHasTokenInAttribute; // Reset the styling token applied to the host element.
|
|
5570
|
+
|
|
5571
|
+
const {
|
|
5572
|
+
stylesheetToken: oldToken,
|
|
5573
|
+
hasTokenInClass: oldHasTokenInClass,
|
|
5574
|
+
hasTokenInAttribute: oldHasTokenInAttribute
|
|
5575
|
+
} = context;
|
|
5495
5576
|
|
|
5496
|
-
|
|
5577
|
+
if (oldHasTokenInClass) {
|
|
5578
|
+
renderer.getClassList(elm).remove(makeHostToken(oldToken));
|
|
5579
|
+
}
|
|
5497
5580
|
|
|
5498
|
-
if (
|
|
5499
|
-
renderer.removeAttribute(elm,
|
|
5581
|
+
if (oldHasTokenInAttribute) {
|
|
5582
|
+
renderer.removeAttribute(elm, makeHostToken(oldToken));
|
|
5500
5583
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
5501
|
-
// associated stylesheets.
|
|
5584
|
+
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
5502
5585
|
|
|
5503
5586
|
|
|
5504
|
-
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5587
|
+
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
5588
|
+
newToken = newStylesheetToken;
|
|
5589
|
+
} // Set the new styling token on the host element
|
|
5590
|
+
|
|
5591
|
+
|
|
5592
|
+
if (!isUndefined$1(newToken)) {
|
|
5593
|
+
if (hasScopedStyles) {
|
|
5594
|
+
renderer.getClassList(elm).add(makeHostToken(newToken));
|
|
5595
|
+
newHasTokenInClass = true;
|
|
5596
|
+
}
|
|
5509
5597
|
|
|
5510
|
-
|
|
5511
|
-
|
|
5598
|
+
if (isSyntheticShadow) {
|
|
5599
|
+
renderer.setAttribute(elm, makeHostToken(newToken), '');
|
|
5600
|
+
newHasTokenInAttribute = true;
|
|
5601
|
+
}
|
|
5512
5602
|
} // Update the styling tokens present on the context object.
|
|
5513
5603
|
|
|
5514
5604
|
|
|
5515
|
-
context.
|
|
5516
|
-
context.
|
|
5605
|
+
context.stylesheetToken = newToken;
|
|
5606
|
+
context.hasTokenInClass = newHasTokenInClass;
|
|
5607
|
+
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
5517
5608
|
}
|
|
5518
5609
|
|
|
5519
|
-
function evaluateStylesheetsContent(stylesheets,
|
|
5610
|
+
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
5520
5611
|
const content = [];
|
|
5521
5612
|
|
|
5522
5613
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5523
5614
|
let stylesheet = stylesheets[i];
|
|
5524
5615
|
|
|
5525
5616
|
if (isArray$1(stylesheet)) {
|
|
5526
|
-
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet,
|
|
5617
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
5527
5618
|
} else {
|
|
5528
5619
|
if (process.env.NODE_ENV !== 'production') {
|
|
5529
5620
|
// in dev-mode, we support hot swapping of stylesheet, which means that
|
|
5530
5621
|
// the component instance might be attempting to use an old version of
|
|
5531
5622
|
// the stylesheet, while internally, we have a replacement for it.
|
|
5532
5623
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
5533
|
-
}
|
|
5624
|
+
} // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
5625
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
5626
|
+
|
|
5534
5627
|
|
|
5535
|
-
|
|
5628
|
+
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
5629
|
+
const useActualHostSelector = vm.renderMode === 0
|
|
5630
|
+
/* Light */
|
|
5631
|
+
? !isScopedCss : vm.shadowMode === 0
|
|
5632
|
+
/* Native */
|
|
5633
|
+
; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
5634
|
+
|
|
5635
|
+
const scopeToken = isScopedCss || vm.shadowMode === 1
|
|
5636
|
+
/* Synthetic */
|
|
5637
|
+
&& vm.renderMode === 1
|
|
5638
|
+
/* Shadow */
|
|
5639
|
+
? stylesheetToken : undefined;
|
|
5640
|
+
ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
|
|
5536
5641
|
}
|
|
5537
5642
|
}
|
|
5538
5643
|
|
|
@@ -5542,37 +5647,36 @@ var LWC = (function (exports) {
|
|
|
5542
5647
|
function getStylesheetsContent(vm, template) {
|
|
5543
5648
|
const {
|
|
5544
5649
|
stylesheets,
|
|
5545
|
-
|
|
5650
|
+
stylesheetToken
|
|
5546
5651
|
} = template;
|
|
5547
|
-
const {
|
|
5548
|
-
renderMode,
|
|
5549
|
-
shadowMode
|
|
5550
|
-
} = vm;
|
|
5551
5652
|
let content = [];
|
|
5552
5653
|
|
|
5553
5654
|
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5655
|
+
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
5656
|
+
}
|
|
5657
|
+
|
|
5658
|
+
return content;
|
|
5659
|
+
} // It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
5660
|
+
// perf testing has not shown it to be a huge improvement yet:
|
|
5661
|
+
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
5662
|
+
|
|
5557
5663
|
|
|
5558
|
-
|
|
5664
|
+
function getNearestNativeShadowComponent(vm) {
|
|
5665
|
+
let owner = vm;
|
|
5666
|
+
|
|
5667
|
+
while (!isNull(owner)) {
|
|
5668
|
+
if (owner.renderMode === 1
|
|
5559
5669
|
/* Shadow */
|
|
5560
|
-
&& shadowMode ===
|
|
5561
|
-
/*
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
shadowSelector = `[${stylesheetTokens.shadowAttribute}]`;
|
|
5565
|
-
} else {
|
|
5566
|
-
hostSelector = '';
|
|
5567
|
-
shadowSelector = '';
|
|
5670
|
+
&& owner.shadowMode === 0
|
|
5671
|
+
/* Native */
|
|
5672
|
+
) {
|
|
5673
|
+
return owner;
|
|
5568
5674
|
}
|
|
5569
5675
|
|
|
5570
|
-
|
|
5571
|
-
/* Native */
|
|
5572
|
-
);
|
|
5676
|
+
owner = owner.owner;
|
|
5573
5677
|
}
|
|
5574
5678
|
|
|
5575
|
-
return
|
|
5679
|
+
return owner;
|
|
5576
5680
|
}
|
|
5577
5681
|
|
|
5578
5682
|
function createStylesheet(vm, stylesheets) {
|
|
@@ -5590,13 +5694,26 @@ var LWC = (function (exports) {
|
|
|
5590
5694
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5591
5695
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5592
5696
|
}
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
} else {
|
|
5596
|
-
// native shadow or light DOM
|
|
5697
|
+
} else if (renderer.ssr) {
|
|
5698
|
+
// native shadow or light DOM, SSR
|
|
5597
5699
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5598
5700
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
5701
|
+
} else {
|
|
5702
|
+
// native shadow or light DOM, DOM renderer
|
|
5703
|
+
const root = getNearestNativeShadowComponent(vm);
|
|
5704
|
+
const isGlobal = isNull(root);
|
|
5705
|
+
|
|
5706
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
5707
|
+
if (isGlobal) {
|
|
5708
|
+
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5709
|
+
} else {
|
|
5710
|
+
// local level
|
|
5711
|
+
renderer.insertStylesheet(stylesheets[i], root.cmpRoot);
|
|
5712
|
+
}
|
|
5713
|
+
}
|
|
5599
5714
|
}
|
|
5715
|
+
|
|
5716
|
+
return null;
|
|
5600
5717
|
}
|
|
5601
5718
|
/*
|
|
5602
5719
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5802,8 +5919,7 @@ var LWC = (function (exports) {
|
|
|
5802
5919
|
context,
|
|
5803
5920
|
cmpSlots,
|
|
5804
5921
|
cmpTemplate,
|
|
5805
|
-
tro
|
|
5806
|
-
shadowMode
|
|
5922
|
+
tro
|
|
5807
5923
|
} = vm;
|
|
5808
5924
|
tro.observe(() => {
|
|
5809
5925
|
// Reset the cache memoizer for template when needed.
|
|
@@ -5828,15 +5944,12 @@ var LWC = (function (exports) {
|
|
|
5828
5944
|
|
|
5829
5945
|
vm.cmpTemplate = html; // Create a brand new template cache for the swapped templated.
|
|
5830
5946
|
|
|
5831
|
-
context.tplCache = create(null); //
|
|
5947
|
+
context.tplCache = create(null); // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
5832
5948
|
|
|
5833
|
-
|
|
5834
|
-
/* Synthetic */
|
|
5835
|
-
) {
|
|
5836
|
-
updateSyntheticShadowAttributes(vm, html);
|
|
5837
|
-
} // Evaluate, create stylesheet and cache the produced VNode for future
|
|
5838
|
-
// re-rendering.
|
|
5949
|
+
context.hasScopedStyles = computeHasScopedStyles(html); // Update the scoping token on the host element.
|
|
5839
5950
|
|
|
5951
|
+
updateStylesheetToken(vm, html); // Evaluate, create stylesheet and cache the produced VNode for future
|
|
5952
|
+
// re-rendering.
|
|
5840
5953
|
|
|
5841
5954
|
const stylesheetsContent = getStylesheetsContent(vm, html);
|
|
5842
5955
|
context.styleVNode = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);
|
|
@@ -5878,6 +5991,22 @@ var LWC = (function (exports) {
|
|
|
5878
5991
|
|
|
5879
5992
|
return vnodes;
|
|
5880
5993
|
}
|
|
5994
|
+
|
|
5995
|
+
function computeHasScopedStyles(template) {
|
|
5996
|
+
const {
|
|
5997
|
+
stylesheets
|
|
5998
|
+
} = template;
|
|
5999
|
+
|
|
6000
|
+
if (!isUndefined$1(stylesheets)) {
|
|
6001
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
6002
|
+
if (isTrue(stylesheets[i][KEY__SCOPED_CSS])) {
|
|
6003
|
+
return true;
|
|
6004
|
+
}
|
|
6005
|
+
}
|
|
6006
|
+
}
|
|
6007
|
+
|
|
6008
|
+
return false;
|
|
6009
|
+
}
|
|
5881
6010
|
/*
|
|
5882
6011
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5883
6012
|
* All rights reserved.
|
|
@@ -6149,7 +6278,6 @@ var LWC = (function (exports) {
|
|
|
6149
6278
|
*/
|
|
6150
6279
|
|
|
6151
6280
|
|
|
6152
|
-
const isNativeShadowRootDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
6153
6281
|
let idx = 0;
|
|
6154
6282
|
/** The internal slot used to associate different objects the engine manipulates with the VM */
|
|
6155
6283
|
|
|
@@ -6258,29 +6386,6 @@ var LWC = (function (exports) {
|
|
|
6258
6386
|
return ancestor;
|
|
6259
6387
|
}
|
|
6260
6388
|
|
|
6261
|
-
function assertNotSyntheticComposedWithinNative(vm) {
|
|
6262
|
-
const isSynthetic = vm.renderMode === 1
|
|
6263
|
-
/* Shadow */
|
|
6264
|
-
&& vm.shadowMode === 1
|
|
6265
|
-
/* Synthetic */
|
|
6266
|
-
;
|
|
6267
|
-
|
|
6268
|
-
if (!isSynthetic) {
|
|
6269
|
-
return;
|
|
6270
|
-
}
|
|
6271
|
-
|
|
6272
|
-
const ancestor = getNearestShadowAncestor(vm);
|
|
6273
|
-
|
|
6274
|
-
if (!isNull(ancestor)) {
|
|
6275
|
-
// Any native shadow component being an ancestor of a synthetic shadow component is disallowed.
|
|
6276
|
-
assert.isFalse(ancestor.renderMode === 1
|
|
6277
|
-
/* Shadow */
|
|
6278
|
-
&& ancestor.shadowMode === 0
|
|
6279
|
-
/* Native */
|
|
6280
|
-
, `${getComponentTag(vm)} (synthetic shadow DOM) cannot be composed inside of ${getComponentTag(ancestor)} (native shadow DOM), because synthetic-within-native composition is disallowed`);
|
|
6281
|
-
}
|
|
6282
|
-
}
|
|
6283
|
-
|
|
6284
6389
|
function createVM(elm, def, options) {
|
|
6285
6390
|
const {
|
|
6286
6391
|
mode,
|
|
@@ -6288,22 +6393,6 @@ var LWC = (function (exports) {
|
|
|
6288
6393
|
renderer,
|
|
6289
6394
|
tagName
|
|
6290
6395
|
} = options;
|
|
6291
|
-
let shadowMode;
|
|
6292
|
-
|
|
6293
|
-
if (renderer.syntheticShadow) {
|
|
6294
|
-
shadowMode = def.shadowSupportMode === "any"
|
|
6295
|
-
/* Any */
|
|
6296
|
-
&& isNativeShadowRootDefined ? 0
|
|
6297
|
-
/* Native */
|
|
6298
|
-
: 1
|
|
6299
|
-
/* Synthetic */
|
|
6300
|
-
;
|
|
6301
|
-
} else {
|
|
6302
|
-
shadowMode = 0
|
|
6303
|
-
/* Native */
|
|
6304
|
-
;
|
|
6305
|
-
}
|
|
6306
|
-
|
|
6307
6396
|
const vm = {
|
|
6308
6397
|
elm,
|
|
6309
6398
|
def,
|
|
@@ -6326,10 +6415,12 @@ var LWC = (function (exports) {
|
|
|
6326
6415
|
oar: create(null),
|
|
6327
6416
|
cmpTemplate: null,
|
|
6328
6417
|
renderMode: def.renderMode,
|
|
6329
|
-
shadowMode,
|
|
6418
|
+
shadowMode: null,
|
|
6330
6419
|
context: {
|
|
6331
|
-
|
|
6332
|
-
|
|
6420
|
+
stylesheetToken: undefined,
|
|
6421
|
+
hasTokenInClass: undefined,
|
|
6422
|
+
hasTokenInAttribute: undefined,
|
|
6423
|
+
hasScopedStyles: undefined,
|
|
6333
6424
|
styleVNode: null,
|
|
6334
6425
|
tplCache: EmptyObject,
|
|
6335
6426
|
wiredConnecting: EmptyArray,
|
|
@@ -6342,26 +6433,87 @@ var LWC = (function (exports) {
|
|
|
6342
6433
|
setHook,
|
|
6343
6434
|
getHook
|
|
6344
6435
|
};
|
|
6436
|
+
vm.shadowMode = computeShadowMode(vm);
|
|
6345
6437
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
6346
6438
|
|
|
6347
6439
|
if (process.env.NODE_ENV !== 'production') {
|
|
6348
6440
|
vm.toString = () => {
|
|
6349
6441
|
return `[object:vm ${def.name} (${vm.idx})]`;
|
|
6350
6442
|
};
|
|
6351
|
-
|
|
6352
|
-
assertNotSyntheticComposedWithinNative(vm);
|
|
6353
6443
|
} // Create component instance associated to the vm and the element.
|
|
6354
6444
|
|
|
6355
6445
|
|
|
6356
6446
|
invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
|
|
6357
6447
|
|
|
6358
|
-
if (
|
|
6448
|
+
if (hasWireAdapters(vm)) {
|
|
6359
6449
|
installWireAdapters(vm);
|
|
6360
6450
|
}
|
|
6361
6451
|
|
|
6362
6452
|
return vm;
|
|
6363
6453
|
}
|
|
6364
6454
|
|
|
6455
|
+
function computeShadowMode(vm) {
|
|
6456
|
+
const {
|
|
6457
|
+
def,
|
|
6458
|
+
renderer
|
|
6459
|
+
} = vm;
|
|
6460
|
+
const {
|
|
6461
|
+
isNativeShadowDefined,
|
|
6462
|
+
isSyntheticShadowDefined
|
|
6463
|
+
} = renderer;
|
|
6464
|
+
let shadowMode;
|
|
6465
|
+
|
|
6466
|
+
if (isSyntheticShadowDefined) {
|
|
6467
|
+
if (def.renderMode === 0
|
|
6468
|
+
/* Light */
|
|
6469
|
+
) {
|
|
6470
|
+
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
|
6471
|
+
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
6472
|
+
shadowMode = 0
|
|
6473
|
+
/* Native */
|
|
6474
|
+
;
|
|
6475
|
+
} else if (isNativeShadowDefined) {
|
|
6476
|
+
if (def.shadowSupportMode === "any"
|
|
6477
|
+
/* Any */
|
|
6478
|
+
) {
|
|
6479
|
+
shadowMode = 0
|
|
6480
|
+
/* Native */
|
|
6481
|
+
;
|
|
6482
|
+
} else {
|
|
6483
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
6484
|
+
|
|
6485
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
6486
|
+
/* Native */
|
|
6487
|
+
) {
|
|
6488
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
6489
|
+
// transitively opts all of its descendants into native.
|
|
6490
|
+
shadowMode = 0
|
|
6491
|
+
/* Native */
|
|
6492
|
+
;
|
|
6493
|
+
} else {
|
|
6494
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
6495
|
+
// to be native.
|
|
6496
|
+
shadowMode = 1
|
|
6497
|
+
/* Synthetic */
|
|
6498
|
+
;
|
|
6499
|
+
}
|
|
6500
|
+
}
|
|
6501
|
+
} else {
|
|
6502
|
+
// Synthetic if there is no native Shadow DOM support.
|
|
6503
|
+
shadowMode = 1
|
|
6504
|
+
/* Synthetic */
|
|
6505
|
+
;
|
|
6506
|
+
}
|
|
6507
|
+
} else {
|
|
6508
|
+
// Native if the synthetic shadow polyfill is unavailable.
|
|
6509
|
+
shadowMode = 0
|
|
6510
|
+
/* Native */
|
|
6511
|
+
;
|
|
6512
|
+
}
|
|
6513
|
+
|
|
6514
|
+
return shadowMode;
|
|
6515
|
+
}
|
|
6516
|
+
|
|
6365
6517
|
function assertIsVM(obj) {
|
|
6366
6518
|
if (isNull(obj) || !isObject(obj) || !('cmpRoot' in obj)) {
|
|
6367
6519
|
throw new TypeError(`${obj} is not a VM.`);
|
|
@@ -7103,11 +7255,14 @@ var LWC = (function (exports) {
|
|
|
7103
7255
|
ArrayPush$1.call(wiredConnecting, () => {
|
|
7104
7256
|
connector.connect();
|
|
7105
7257
|
|
|
7106
|
-
if (
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7258
|
+
if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
7259
|
+
if (hasDynamicParams) {
|
|
7260
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
7261
|
+
return;
|
|
7262
|
+
}
|
|
7110
7263
|
}
|
|
7264
|
+
|
|
7265
|
+
computeConfigAndUpdate();
|
|
7111
7266
|
});
|
|
7112
7267
|
ArrayPush$1.call(wiredDisconnecting, () => {
|
|
7113
7268
|
connector.disconnect();
|
|
@@ -7214,7 +7369,7 @@ var LWC = (function (exports) {
|
|
|
7214
7369
|
|
|
7215
7370
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
7216
7371
|
}
|
|
7217
|
-
/* version: 2.
|
|
7372
|
+
/* version: 2.5.1 */
|
|
7218
7373
|
|
|
7219
7374
|
/*
|
|
7220
7375
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7236,6 +7391,10 @@ var LWC = (function (exports) {
|
|
|
7236
7391
|
}
|
|
7237
7392
|
|
|
7238
7393
|
const globalStylesheetsParentElement = document.head || document.body || document;
|
|
7394
|
+
const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync);
|
|
7395
|
+
const styleElements = create(null);
|
|
7396
|
+
const styleSheets = create(null);
|
|
7397
|
+
const nodesToStyleSheets = new WeakMap();
|
|
7239
7398
|
let getCustomElement, defineCustomElement, HTMLElementConstructor;
|
|
7240
7399
|
|
|
7241
7400
|
function isCustomElementRegistryAvailable() {
|
|
@@ -7262,6 +7421,52 @@ var LWC = (function (exports) {
|
|
|
7262
7421
|
}
|
|
7263
7422
|
}
|
|
7264
7423
|
|
|
7424
|
+
function insertConstructableStyleSheet(content, target) {
|
|
7425
|
+
// It's important for CSSStyleSheets to be unique based on their content, so that
|
|
7426
|
+
// `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
|
|
7427
|
+
let styleSheet = styleSheets[content];
|
|
7428
|
+
|
|
7429
|
+
if (isUndefined$1(styleSheet)) {
|
|
7430
|
+
styleSheet = new CSSStyleSheet();
|
|
7431
|
+
styleSheet.replaceSync(content);
|
|
7432
|
+
styleSheets[content] = styleSheet;
|
|
7433
|
+
}
|
|
7434
|
+
|
|
7435
|
+
if (!target.adoptedStyleSheets.includes(styleSheet)) {
|
|
7436
|
+
target.adoptedStyleSheets = [...target.adoptedStyleSheets, styleSheet];
|
|
7437
|
+
}
|
|
7438
|
+
}
|
|
7439
|
+
|
|
7440
|
+
function insertStyleElement(content, target) {
|
|
7441
|
+
// Avoid inserting duplicate `<style>`s
|
|
7442
|
+
let sheets = nodesToStyleSheets.get(target);
|
|
7443
|
+
|
|
7444
|
+
if (isUndefined$1(sheets)) {
|
|
7445
|
+
sheets = create(null);
|
|
7446
|
+
nodesToStyleSheets.set(target, sheets);
|
|
7447
|
+
}
|
|
7448
|
+
|
|
7449
|
+
if (sheets[content]) {
|
|
7450
|
+
return;
|
|
7451
|
+
}
|
|
7452
|
+
|
|
7453
|
+
sheets[content] = true; // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
|
|
7454
|
+
// faster to call `cloneNode()` on an existing node than to recreate it every time.
|
|
7455
|
+
|
|
7456
|
+
let elm = styleElements[content];
|
|
7457
|
+
|
|
7458
|
+
if (isUndefined$1(elm)) {
|
|
7459
|
+
elm = document.createElement('style');
|
|
7460
|
+
elm.type = 'text/css';
|
|
7461
|
+
elm.textContent = content;
|
|
7462
|
+
styleElements[content] = elm;
|
|
7463
|
+
} else {
|
|
7464
|
+
elm = elm.cloneNode(true);
|
|
7465
|
+
}
|
|
7466
|
+
|
|
7467
|
+
target.appendChild(elm);
|
|
7468
|
+
}
|
|
7469
|
+
|
|
7265
7470
|
if (isCustomElementRegistryAvailable()) {
|
|
7266
7471
|
getCustomElement = customElements.get.bind(customElements);
|
|
7267
7472
|
defineCustomElement = customElements.define.bind(customElements);
|
|
@@ -7307,7 +7512,8 @@ var LWC = (function (exports) {
|
|
|
7307
7512
|
|
|
7308
7513
|
const renderer = {
|
|
7309
7514
|
ssr: false,
|
|
7310
|
-
|
|
7515
|
+
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7516
|
+
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7311
7517
|
|
|
7312
7518
|
createElement(tagName, namespace) {
|
|
7313
7519
|
return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
|
|
@@ -7430,6 +7636,15 @@ var LWC = (function (exports) {
|
|
|
7430
7636
|
globalStylesheetsParentElement.appendChild(elm);
|
|
7431
7637
|
},
|
|
7432
7638
|
|
|
7639
|
+
insertStylesheet(content, target) {
|
|
7640
|
+
if (supportsConstructableStyleSheets) {
|
|
7641
|
+
insertConstructableStyleSheet(content, target);
|
|
7642
|
+
} else {
|
|
7643
|
+
// Fall back to <style> element
|
|
7644
|
+
insertStyleElement(content, target);
|
|
7645
|
+
}
|
|
7646
|
+
},
|
|
7647
|
+
|
|
7433
7648
|
assertInstanceOfHTMLElement(elm, msg) {
|
|
7434
7649
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7435
7650
|
},
|
|
@@ -7659,7 +7874,7 @@ var LWC = (function (exports) {
|
|
|
7659
7874
|
return false;
|
|
7660
7875
|
}
|
|
7661
7876
|
|
|
7662
|
-
if (renderer.
|
|
7877
|
+
if (renderer.isSyntheticShadowDefined) {
|
|
7663
7878
|
// TODO [#1252]: old behavior that is still used by some pieces of the platform,
|
|
7664
7879
|
// specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
|
|
7665
7880
|
// used, will be considered global elements.
|
|
@@ -7712,7 +7927,7 @@ var LWC = (function (exports) {
|
|
|
7712
7927
|
});
|
|
7713
7928
|
freeze(LightningElement);
|
|
7714
7929
|
seal(LightningElement.prototype);
|
|
7715
|
-
/* version: 2.
|
|
7930
|
+
/* version: 2.5.1 */
|
|
7716
7931
|
|
|
7717
7932
|
exports.LightningElement = LightningElement;
|
|
7718
7933
|
exports.__unstable__ProfilerControl = profilerControl;
|