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