lwc 2.3.3 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine-dom/esm/es2017/engine-dom.js +360 -198
- package/dist/engine-dom/iife/es2017/engine-dom.js +360 -198
- package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es2017/engine-dom_debug.js +361 -168
- package/dist/engine-dom/iife/es5/engine-dom.js +371 -218
- package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/iife/es5/engine-dom_debug.js +370 -186
- package/dist/engine-dom/umd/es2017/engine-dom.js +360 -198
- package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es2017/engine-dom_debug.js +361 -168
- package/dist/engine-dom/umd/es5/engine-dom.js +371 -218
- package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
- package/dist/engine-dom/umd/es5/engine-dom_debug.js +370 -186
- package/dist/engine-server/commonjs/es2017/engine-server.js +304 -205
- package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
- package/dist/engine-server/esm/es2017/engine-server.js +304 -205
- package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +29 -16
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +29 -16
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +29 -16
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +31 -16
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +31 -16
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +29 -16
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +29 -16
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +31 -16
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
- package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +31 -16
- package/dist/wire-service/esm/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service.js +2 -2
- package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/iife/es5/wire-service.js +3 -3
- package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
- package/dist/wire-service/iife/es5/wire-service_debug.js +3 -3
- package/dist/wire-service/umd/es2017/wire-service.js +2 -2
- package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
- package/dist/wire-service/umd/es5/wire-service.js +3 -3
- package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
- package/dist/wire-service/umd/es5/wire-service_debug.js +3 -3
- package/package.json +8 -8
|
@@ -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.0 */
|
|
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.3 */
|
|
487
|
+
/** version: 2.5.0 */
|
|
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);
|
|
@@ -4485,6 +4492,19 @@
|
|
|
4485
4492
|
|
|
4486
4493
|
function setElementShadowToken(elm, token) {
|
|
4487
4494
|
elm.$shadowToken$ = token;
|
|
4495
|
+
} // Set the scope token class for *.scoped.css styles
|
|
4496
|
+
|
|
4497
|
+
|
|
4498
|
+
function setScopeTokenClassIfNecessary(elm, owner) {
|
|
4499
|
+
const {
|
|
4500
|
+
cmpTemplate,
|
|
4501
|
+
context
|
|
4502
|
+
} = owner;
|
|
4503
|
+
const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
|
|
4504
|
+
|
|
4505
|
+
if (!isUndefined$1(token) && context.hasScopedStyles) {
|
|
4506
|
+
owner.renderer.getClassList(elm).add(token);
|
|
4507
|
+
}
|
|
4488
4508
|
}
|
|
4489
4509
|
|
|
4490
4510
|
function updateNodeHook(oldVnode, vnode) {
|
|
@@ -4558,6 +4578,7 @@
|
|
|
4558
4578
|
const {
|
|
4559
4579
|
owner
|
|
4560
4580
|
} = vnode;
|
|
4581
|
+
setScopeTokenClassIfNecessary(elm, owner);
|
|
4561
4582
|
|
|
4562
4583
|
if (owner.shadowMode === 1
|
|
4563
4584
|
/* Synthetic */
|
|
@@ -4568,7 +4589,7 @@
|
|
|
4568
4589
|
}
|
|
4569
4590
|
} = vnode;
|
|
4570
4591
|
const {
|
|
4571
|
-
|
|
4592
|
+
stylesheetToken
|
|
4572
4593
|
} = owner.context;
|
|
4573
4594
|
|
|
4574
4595
|
if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual"
|
|
@@ -4580,7 +4601,7 @@
|
|
|
4580
4601
|
// into each element from the template, so they can be styled accordingly.
|
|
4581
4602
|
|
|
4582
4603
|
|
|
4583
|
-
setElementShadowToken(elm,
|
|
4604
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4584
4605
|
}
|
|
4585
4606
|
|
|
4586
4607
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -4669,16 +4690,17 @@
|
|
|
4669
4690
|
ctor,
|
|
4670
4691
|
owner
|
|
4671
4692
|
} = vnode;
|
|
4693
|
+
setScopeTokenClassIfNecessary(elm, owner);
|
|
4672
4694
|
|
|
4673
4695
|
if (owner.shadowMode === 1
|
|
4674
4696
|
/* Synthetic */
|
|
4675
4697
|
) {
|
|
4676
4698
|
const {
|
|
4677
|
-
|
|
4699
|
+
stylesheetToken
|
|
4678
4700
|
} = owner.context; // when running in synthetic shadow mode, we need to set the shadowToken value
|
|
4679
4701
|
// into each element from the template, so they can be styled accordingly.
|
|
4680
4702
|
|
|
4681
|
-
setElementShadowToken(elm,
|
|
4703
|
+
setElementShadowToken(elm, stylesheetToken);
|
|
4682
4704
|
}
|
|
4683
4705
|
|
|
4684
4706
|
const def = getComponentInternalDef(ctor);
|
|
@@ -4978,13 +5000,19 @@
|
|
|
4978
5000
|
|
|
4979
5001
|
function linkNodeToShadow(elm, owner) {
|
|
4980
5002
|
const {
|
|
5003
|
+
renderer,
|
|
5004
|
+
renderMode,
|
|
4981
5005
|
shadowMode
|
|
4982
5006
|
} = owner; // TODO [#1164]: this should eventually be done by the polyfill directly
|
|
4983
5007
|
|
|
4984
|
-
if (
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
5008
|
+
if (renderer.isSyntheticShadowDefined) {
|
|
5009
|
+
if (shadowMode === 1
|
|
5010
|
+
/* Synthetic */
|
|
5011
|
+
|| renderMode === 0
|
|
5012
|
+
/* Light */
|
|
5013
|
+
) {
|
|
5014
|
+
elm[KEY__SHADOW_RESOLVER] = getRenderRoot(owner)[KEY__SHADOW_RESOLVER];
|
|
5015
|
+
}
|
|
4988
5016
|
}
|
|
4989
5017
|
}
|
|
4990
5018
|
|
|
@@ -5330,14 +5358,11 @@
|
|
|
5330
5358
|
|
|
5331
5359
|
const {
|
|
5332
5360
|
idx,
|
|
5333
|
-
renderMode,
|
|
5334
5361
|
shadowMode
|
|
5335
5362
|
} = vmBeingRendered;
|
|
5336
5363
|
|
|
5337
5364
|
if (shadowMode === 1
|
|
5338
5365
|
/* Synthetic */
|
|
5339
|
-
&& renderMode === 1
|
|
5340
|
-
/* Shadow */
|
|
5341
5366
|
) {
|
|
5342
5367
|
return StringReplace.call(id, /\S+/g, id => `${id}-${idx}`);
|
|
5343
5368
|
}
|
|
@@ -5366,14 +5391,11 @@
|
|
|
5366
5391
|
|
|
5367
5392
|
const {
|
|
5368
5393
|
idx,
|
|
5369
|
-
renderMode,
|
|
5370
5394
|
shadowMode
|
|
5371
5395
|
} = vmBeingRendered; // Apply transformation only for fragment-only-urls, and only in shadow DOM
|
|
5372
5396
|
|
|
5373
5397
|
if (shadowMode === 1
|
|
5374
5398
|
/* Synthetic */
|
|
5375
|
-
&& renderMode === 1
|
|
5376
|
-
/* Shadow */
|
|
5377
5399
|
&& /^#/.test(url)) {
|
|
5378
5400
|
return `${url}-${idx}`;
|
|
5379
5401
|
}
|
|
@@ -5474,6 +5496,10 @@
|
|
|
5474
5496
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
5475
5497
|
*/
|
|
5476
5498
|
|
|
5499
|
+
function makeHostToken(token) {
|
|
5500
|
+
return `${token}-host`;
|
|
5501
|
+
}
|
|
5502
|
+
|
|
5477
5503
|
function createInlineStyleVNode(content) {
|
|
5478
5504
|
return h('style', {
|
|
5479
5505
|
key: 'style',
|
|
@@ -5483,59 +5509,100 @@
|
|
|
5483
5509
|
}, [t(content)]);
|
|
5484
5510
|
}
|
|
5485
5511
|
|
|
5486
|
-
function
|
|
5512
|
+
function updateStylesheetToken(vm, template) {
|
|
5487
5513
|
const {
|
|
5488
5514
|
elm,
|
|
5489
5515
|
context,
|
|
5490
5516
|
renderer,
|
|
5491
|
-
renderMode
|
|
5517
|
+
renderMode,
|
|
5518
|
+
shadowMode
|
|
5492
5519
|
} = vm;
|
|
5493
5520
|
const {
|
|
5494
5521
|
stylesheets: newStylesheets,
|
|
5495
|
-
|
|
5522
|
+
stylesheetToken: newStylesheetToken
|
|
5496
5523
|
} = template;
|
|
5497
|
-
|
|
5524
|
+
const isSyntheticShadow = renderMode === 1
|
|
5525
|
+
/* Shadow */
|
|
5526
|
+
&& shadowMode === 1
|
|
5527
|
+
/* Synthetic */
|
|
5528
|
+
;
|
|
5529
|
+
const {
|
|
5530
|
+
hasScopedStyles
|
|
5531
|
+
} = context;
|
|
5532
|
+
let newToken;
|
|
5533
|
+
let newHasTokenInClass;
|
|
5534
|
+
let newHasTokenInAttribute; // Reset the styling token applied to the host element.
|
|
5535
|
+
|
|
5536
|
+
const {
|
|
5537
|
+
stylesheetToken: oldToken,
|
|
5538
|
+
hasTokenInClass: oldHasTokenInClass,
|
|
5539
|
+
hasTokenInAttribute: oldHasTokenInAttribute
|
|
5540
|
+
} = context;
|
|
5498
5541
|
|
|
5499
|
-
|
|
5542
|
+
if (oldHasTokenInClass) {
|
|
5543
|
+
renderer.getClassList(elm).remove(makeHostToken(oldToken));
|
|
5544
|
+
}
|
|
5500
5545
|
|
|
5501
|
-
if (
|
|
5502
|
-
renderer.removeAttribute(elm,
|
|
5546
|
+
if (oldHasTokenInAttribute) {
|
|
5547
|
+
renderer.removeAttribute(elm, makeHostToken(oldToken));
|
|
5503
5548
|
} // Apply the new template styling token to the host element, if the new template has any
|
|
5504
|
-
// associated stylesheets.
|
|
5549
|
+
// associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
|
|
5505
5550
|
|
|
5506
5551
|
|
|
5507
|
-
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
}
|
|
5552
|
+
if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
|
|
5553
|
+
newToken = newStylesheetToken;
|
|
5554
|
+
} // Set the new styling token on the host element
|
|
5555
|
+
|
|
5512
5556
|
|
|
5513
|
-
if (!isUndefined$1(
|
|
5514
|
-
|
|
5557
|
+
if (!isUndefined$1(newToken)) {
|
|
5558
|
+
if (hasScopedStyles) {
|
|
5559
|
+
renderer.getClassList(elm).add(makeHostToken(newToken));
|
|
5560
|
+
newHasTokenInClass = true;
|
|
5561
|
+
}
|
|
5562
|
+
|
|
5563
|
+
if (isSyntheticShadow) {
|
|
5564
|
+
renderer.setAttribute(elm, makeHostToken(newToken), '');
|
|
5565
|
+
newHasTokenInAttribute = true;
|
|
5566
|
+
}
|
|
5515
5567
|
} // Update the styling tokens present on the context object.
|
|
5516
5568
|
|
|
5517
5569
|
|
|
5518
|
-
context.
|
|
5519
|
-
context.
|
|
5570
|
+
context.stylesheetToken = newToken;
|
|
5571
|
+
context.hasTokenInClass = newHasTokenInClass;
|
|
5572
|
+
context.hasTokenInAttribute = newHasTokenInAttribute;
|
|
5520
5573
|
}
|
|
5521
5574
|
|
|
5522
|
-
function evaluateStylesheetsContent(stylesheets,
|
|
5575
|
+
function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
|
|
5523
5576
|
const content = [];
|
|
5524
5577
|
|
|
5525
5578
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5526
5579
|
let stylesheet = stylesheets[i];
|
|
5527
5580
|
|
|
5528
5581
|
if (isArray$1(stylesheet)) {
|
|
5529
|
-
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet,
|
|
5582
|
+
ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
|
|
5530
5583
|
} else {
|
|
5531
5584
|
if (process.env.NODE_ENV !== 'production') {
|
|
5532
5585
|
// in dev-mode, we support hot swapping of stylesheet, which means that
|
|
5533
5586
|
// the component instance might be attempting to use an old version of
|
|
5534
5587
|
// the stylesheet, while internally, we have a replacement for it.
|
|
5535
5588
|
stylesheet = getStyleOrSwappedStyle(stylesheet);
|
|
5536
|
-
}
|
|
5589
|
+
} // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
|
|
5590
|
+
// native shadow DOM. Synthetic shadow DOM never uses `:host`.
|
|
5591
|
+
|
|
5592
|
+
|
|
5593
|
+
const isScopedCss = stylesheet[KEY__SCOPED_CSS];
|
|
5594
|
+
const useActualHostSelector = vm.renderMode === 0
|
|
5595
|
+
/* Light */
|
|
5596
|
+
? !isScopedCss : vm.shadowMode === 0
|
|
5597
|
+
/* Native */
|
|
5598
|
+
; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
|
|
5537
5599
|
|
|
5538
|
-
|
|
5600
|
+
const scopeToken = isScopedCss || vm.shadowMode === 1
|
|
5601
|
+
/* Synthetic */
|
|
5602
|
+
&& vm.renderMode === 1
|
|
5603
|
+
/* Shadow */
|
|
5604
|
+
? stylesheetToken : undefined;
|
|
5605
|
+
ArrayPush$1.call(content, stylesheet(useActualHostSelector, scopeToken));
|
|
5539
5606
|
}
|
|
5540
5607
|
}
|
|
5541
5608
|
|
|
@@ -5545,37 +5612,36 @@
|
|
|
5545
5612
|
function getStylesheetsContent(vm, template) {
|
|
5546
5613
|
const {
|
|
5547
5614
|
stylesheets,
|
|
5548
|
-
|
|
5615
|
+
stylesheetToken
|
|
5549
5616
|
} = template;
|
|
5550
|
-
const {
|
|
5551
|
-
renderMode,
|
|
5552
|
-
shadowMode
|
|
5553
|
-
} = vm;
|
|
5554
5617
|
let content = [];
|
|
5555
5618
|
|
|
5556
5619
|
if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5620
|
+
content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
|
|
5621
|
+
}
|
|
5622
|
+
|
|
5623
|
+
return content;
|
|
5624
|
+
} // It might be worth caching this to avoid doing the lookup repeatedly, but
|
|
5625
|
+
// perf testing has not shown it to be a huge improvement yet:
|
|
5626
|
+
// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
|
|
5560
5627
|
|
|
5561
|
-
|
|
5628
|
+
|
|
5629
|
+
function getNearestNativeShadowComponent(vm) {
|
|
5630
|
+
let owner = vm;
|
|
5631
|
+
|
|
5632
|
+
while (!isNull(owner)) {
|
|
5633
|
+
if (owner.renderMode === 1
|
|
5562
5634
|
/* Shadow */
|
|
5563
|
-
&& shadowMode ===
|
|
5564
|
-
/*
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
shadowSelector = `[${stylesheetTokens.shadowAttribute}]`;
|
|
5568
|
-
} else {
|
|
5569
|
-
hostSelector = '';
|
|
5570
|
-
shadowSelector = '';
|
|
5635
|
+
&& owner.shadowMode === 0
|
|
5636
|
+
/* Native */
|
|
5637
|
+
) {
|
|
5638
|
+
return owner;
|
|
5571
5639
|
}
|
|
5572
5640
|
|
|
5573
|
-
|
|
5574
|
-
/* Native */
|
|
5575
|
-
);
|
|
5641
|
+
owner = owner.owner;
|
|
5576
5642
|
}
|
|
5577
5643
|
|
|
5578
|
-
return
|
|
5644
|
+
return owner;
|
|
5579
5645
|
}
|
|
5580
5646
|
|
|
5581
5647
|
function createStylesheet(vm, stylesheets) {
|
|
@@ -5593,13 +5659,26 @@
|
|
|
5593
5659
|
for (let i = 0; i < stylesheets.length; i++) {
|
|
5594
5660
|
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5595
5661
|
}
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
} else {
|
|
5599
|
-
// native shadow or light DOM
|
|
5662
|
+
} else if (renderer.ssr) {
|
|
5663
|
+
// native shadow or light DOM, SSR
|
|
5600
5664
|
const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\n');
|
|
5601
5665
|
return createInlineStyleVNode(combinedStylesheetContent);
|
|
5666
|
+
} else {
|
|
5667
|
+
// native shadow or light DOM, DOM renderer
|
|
5668
|
+
const root = getNearestNativeShadowComponent(vm);
|
|
5669
|
+
const isGlobal = isNull(root);
|
|
5670
|
+
|
|
5671
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
5672
|
+
if (isGlobal) {
|
|
5673
|
+
renderer.insertGlobalStylesheet(stylesheets[i]);
|
|
5674
|
+
} else {
|
|
5675
|
+
// local level
|
|
5676
|
+
renderer.insertStylesheet(stylesheets[i], root.cmpRoot);
|
|
5677
|
+
}
|
|
5678
|
+
}
|
|
5602
5679
|
}
|
|
5680
|
+
|
|
5681
|
+
return null;
|
|
5603
5682
|
}
|
|
5604
5683
|
/*
|
|
5605
5684
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -5805,8 +5884,7 @@
|
|
|
5805
5884
|
context,
|
|
5806
5885
|
cmpSlots,
|
|
5807
5886
|
cmpTemplate,
|
|
5808
|
-
tro
|
|
5809
|
-
shadowMode
|
|
5887
|
+
tro
|
|
5810
5888
|
} = vm;
|
|
5811
5889
|
tro.observe(() => {
|
|
5812
5890
|
// Reset the cache memoizer for template when needed.
|
|
@@ -5831,15 +5909,12 @@
|
|
|
5831
5909
|
|
|
5832
5910
|
vm.cmpTemplate = html; // Create a brand new template cache for the swapped templated.
|
|
5833
5911
|
|
|
5834
|
-
context.tplCache = create(null); //
|
|
5912
|
+
context.tplCache = create(null); // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.
|
|
5835
5913
|
|
|
5836
|
-
|
|
5837
|
-
/* Synthetic */
|
|
5838
|
-
) {
|
|
5839
|
-
updateSyntheticShadowAttributes(vm, html);
|
|
5840
|
-
} // Evaluate, create stylesheet and cache the produced VNode for future
|
|
5841
|
-
// re-rendering.
|
|
5914
|
+
context.hasScopedStyles = computeHasScopedStyles(html); // Update the scoping token on the host element.
|
|
5842
5915
|
|
|
5916
|
+
updateStylesheetToken(vm, html); // Evaluate, create stylesheet and cache the produced VNode for future
|
|
5917
|
+
// re-rendering.
|
|
5843
5918
|
|
|
5844
5919
|
const stylesheetsContent = getStylesheetsContent(vm, html);
|
|
5845
5920
|
context.styleVNode = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);
|
|
@@ -5881,6 +5956,22 @@
|
|
|
5881
5956
|
|
|
5882
5957
|
return vnodes;
|
|
5883
5958
|
}
|
|
5959
|
+
|
|
5960
|
+
function computeHasScopedStyles(template) {
|
|
5961
|
+
const {
|
|
5962
|
+
stylesheets
|
|
5963
|
+
} = template;
|
|
5964
|
+
|
|
5965
|
+
if (!isUndefined$1(stylesheets)) {
|
|
5966
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
|
5967
|
+
if (isTrue(stylesheets[i][KEY__SCOPED_CSS])) {
|
|
5968
|
+
return true;
|
|
5969
|
+
}
|
|
5970
|
+
}
|
|
5971
|
+
}
|
|
5972
|
+
|
|
5973
|
+
return false;
|
|
5974
|
+
}
|
|
5884
5975
|
/*
|
|
5885
5976
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
5886
5977
|
* All rights reserved.
|
|
@@ -5921,12 +6012,9 @@
|
|
|
5921
6012
|
callHook,
|
|
5922
6013
|
owner
|
|
5923
6014
|
} = vm;
|
|
5924
|
-
let result;
|
|
5925
6015
|
runWithBoundaryProtection(vm, owner, noop, () => {
|
|
5926
|
-
|
|
5927
|
-
result = callHook(component, fn, args);
|
|
6016
|
+
callHook(component, fn, args);
|
|
5928
6017
|
}, noop);
|
|
5929
|
-
return result;
|
|
5930
6018
|
}
|
|
5931
6019
|
|
|
5932
6020
|
function invokeComponentConstructor(vm, Ctor) {
|
|
@@ -6000,33 +6088,6 @@
|
|
|
6000
6088
|
return renderInvocationSuccessful ? evaluateTemplate(vm, html) : [];
|
|
6001
6089
|
}
|
|
6002
6090
|
|
|
6003
|
-
function invokeComponentRenderedCallback(vm) {
|
|
6004
|
-
const {
|
|
6005
|
-
def: {
|
|
6006
|
-
renderedCallback
|
|
6007
|
-
},
|
|
6008
|
-
component,
|
|
6009
|
-
callHook,
|
|
6010
|
-
owner
|
|
6011
|
-
} = vm;
|
|
6012
|
-
|
|
6013
|
-
if (!isUndefined$1(renderedCallback)) {
|
|
6014
|
-
runWithBoundaryProtection(vm, owner, () => {
|
|
6015
|
-
logOperationStart(4
|
|
6016
|
-
/* RenderedCallback */
|
|
6017
|
-
, vm);
|
|
6018
|
-
}, () => {
|
|
6019
|
-
// job
|
|
6020
|
-
callHook(component, renderedCallback);
|
|
6021
|
-
}, () => {
|
|
6022
|
-
// post
|
|
6023
|
-
logOperationEnd(4
|
|
6024
|
-
/* RenderedCallback */
|
|
6025
|
-
, vm);
|
|
6026
|
-
});
|
|
6027
|
-
}
|
|
6028
|
-
}
|
|
6029
|
-
|
|
6030
6091
|
function invokeEventListener(vm, fn, thisValue, event) {
|
|
6031
6092
|
const {
|
|
6032
6093
|
callHook,
|
|
@@ -6182,7 +6243,6 @@
|
|
|
6182
6243
|
*/
|
|
6183
6244
|
|
|
6184
6245
|
|
|
6185
|
-
const isNativeShadowRootDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
|
|
6186
6246
|
let idx = 0;
|
|
6187
6247
|
/** The internal slot used to associate different objects the engine manipulates with the VM */
|
|
6188
6248
|
|
|
@@ -6291,29 +6351,6 @@
|
|
|
6291
6351
|
return ancestor;
|
|
6292
6352
|
}
|
|
6293
6353
|
|
|
6294
|
-
function assertNotSyntheticComposedWithinNative(vm) {
|
|
6295
|
-
const isSynthetic = vm.renderMode === 1
|
|
6296
|
-
/* Shadow */
|
|
6297
|
-
&& vm.shadowMode === 1
|
|
6298
|
-
/* Synthetic */
|
|
6299
|
-
;
|
|
6300
|
-
|
|
6301
|
-
if (!isSynthetic) {
|
|
6302
|
-
return;
|
|
6303
|
-
}
|
|
6304
|
-
|
|
6305
|
-
const ancestor = getNearestShadowAncestor(vm);
|
|
6306
|
-
|
|
6307
|
-
if (!isNull(ancestor)) {
|
|
6308
|
-
// Any native shadow component being an ancestor of a synthetic shadow component is disallowed.
|
|
6309
|
-
assert.isFalse(ancestor.renderMode === 1
|
|
6310
|
-
/* Shadow */
|
|
6311
|
-
&& ancestor.shadowMode === 0
|
|
6312
|
-
/* Native */
|
|
6313
|
-
, `${getComponentTag(vm)} (synthetic shadow DOM) cannot be composed inside of ${getComponentTag(ancestor)} (native shadow DOM), because synthetic-within-native composition is disallowed`);
|
|
6314
|
-
}
|
|
6315
|
-
}
|
|
6316
|
-
|
|
6317
6354
|
function createVM(elm, def, options) {
|
|
6318
6355
|
const {
|
|
6319
6356
|
mode,
|
|
@@ -6321,22 +6358,6 @@
|
|
|
6321
6358
|
renderer,
|
|
6322
6359
|
tagName
|
|
6323
6360
|
} = options;
|
|
6324
|
-
let shadowMode;
|
|
6325
|
-
|
|
6326
|
-
if (renderer.syntheticShadow) {
|
|
6327
|
-
shadowMode = def.shadowSupportMode === "any"
|
|
6328
|
-
/* Any */
|
|
6329
|
-
&& isNativeShadowRootDefined ? 0
|
|
6330
|
-
/* Native */
|
|
6331
|
-
: 1
|
|
6332
|
-
/* Synthetic */
|
|
6333
|
-
;
|
|
6334
|
-
} else {
|
|
6335
|
-
shadowMode = 0
|
|
6336
|
-
/* Native */
|
|
6337
|
-
;
|
|
6338
|
-
}
|
|
6339
|
-
|
|
6340
6361
|
const vm = {
|
|
6341
6362
|
elm,
|
|
6342
6363
|
def,
|
|
@@ -6359,10 +6380,12 @@
|
|
|
6359
6380
|
oar: create(null),
|
|
6360
6381
|
cmpTemplate: null,
|
|
6361
6382
|
renderMode: def.renderMode,
|
|
6362
|
-
shadowMode,
|
|
6383
|
+
shadowMode: null,
|
|
6363
6384
|
context: {
|
|
6364
|
-
|
|
6365
|
-
|
|
6385
|
+
stylesheetToken: undefined,
|
|
6386
|
+
hasTokenInClass: undefined,
|
|
6387
|
+
hasTokenInAttribute: undefined,
|
|
6388
|
+
hasScopedStyles: undefined,
|
|
6366
6389
|
styleVNode: null,
|
|
6367
6390
|
tplCache: EmptyObject,
|
|
6368
6391
|
wiredConnecting: EmptyArray,
|
|
@@ -6375,26 +6398,87 @@
|
|
|
6375
6398
|
setHook,
|
|
6376
6399
|
getHook
|
|
6377
6400
|
};
|
|
6401
|
+
vm.shadowMode = computeShadowMode(vm);
|
|
6378
6402
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
6379
6403
|
|
|
6380
6404
|
if (process.env.NODE_ENV !== 'production') {
|
|
6381
6405
|
vm.toString = () => {
|
|
6382
6406
|
return `[object:vm ${def.name} (${vm.idx})]`;
|
|
6383
6407
|
};
|
|
6384
|
-
|
|
6385
|
-
assertNotSyntheticComposedWithinNative(vm);
|
|
6386
6408
|
} // Create component instance associated to the vm and the element.
|
|
6387
6409
|
|
|
6388
6410
|
|
|
6389
6411
|
invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
|
|
6390
6412
|
|
|
6391
|
-
if (
|
|
6413
|
+
if (hasWireAdapters(vm)) {
|
|
6392
6414
|
installWireAdapters(vm);
|
|
6393
6415
|
}
|
|
6394
6416
|
|
|
6395
6417
|
return vm;
|
|
6396
6418
|
}
|
|
6397
6419
|
|
|
6420
|
+
function computeShadowMode(vm) {
|
|
6421
|
+
const {
|
|
6422
|
+
def,
|
|
6423
|
+
renderer
|
|
6424
|
+
} = vm;
|
|
6425
|
+
const {
|
|
6426
|
+
isNativeShadowDefined,
|
|
6427
|
+
isSyntheticShadowDefined
|
|
6428
|
+
} = renderer;
|
|
6429
|
+
let shadowMode;
|
|
6430
|
+
|
|
6431
|
+
if (isSyntheticShadowDefined) {
|
|
6432
|
+
if (def.renderMode === 0
|
|
6433
|
+
/* Light */
|
|
6434
|
+
) {
|
|
6435
|
+
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
|
6436
|
+
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
6437
|
+
shadowMode = 0
|
|
6438
|
+
/* Native */
|
|
6439
|
+
;
|
|
6440
|
+
} else if (isNativeShadowDefined) {
|
|
6441
|
+
if (def.shadowSupportMode === "any"
|
|
6442
|
+
/* Any */
|
|
6443
|
+
) {
|
|
6444
|
+
shadowMode = 0
|
|
6445
|
+
/* Native */
|
|
6446
|
+
;
|
|
6447
|
+
} else {
|
|
6448
|
+
const shadowAncestor = getNearestShadowAncestor(vm);
|
|
6449
|
+
|
|
6450
|
+
if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
|
|
6451
|
+
/* Native */
|
|
6452
|
+
) {
|
|
6453
|
+
// Transitive support for native Shadow DOM. A component in native mode
|
|
6454
|
+
// transitively opts all of its descendants into native.
|
|
6455
|
+
shadowMode = 0
|
|
6456
|
+
/* Native */
|
|
6457
|
+
;
|
|
6458
|
+
} else {
|
|
6459
|
+
// Synthetic if neither this component nor any of its ancestors are configured
|
|
6460
|
+
// to be native.
|
|
6461
|
+
shadowMode = 1
|
|
6462
|
+
/* Synthetic */
|
|
6463
|
+
;
|
|
6464
|
+
}
|
|
6465
|
+
}
|
|
6466
|
+
} else {
|
|
6467
|
+
// Synthetic if there is no native Shadow DOM support.
|
|
6468
|
+
shadowMode = 1
|
|
6469
|
+
/* Synthetic */
|
|
6470
|
+
;
|
|
6471
|
+
}
|
|
6472
|
+
} else {
|
|
6473
|
+
// Native if the synthetic shadow polyfill is unavailable.
|
|
6474
|
+
shadowMode = 0
|
|
6475
|
+
/* Native */
|
|
6476
|
+
;
|
|
6477
|
+
}
|
|
6478
|
+
|
|
6479
|
+
return shadowMode;
|
|
6480
|
+
}
|
|
6481
|
+
|
|
6398
6482
|
function assertIsVM(obj) {
|
|
6399
6483
|
if (isNull(obj) || !isObject(obj) || !('cmpRoot' in obj)) {
|
|
6400
6484
|
throw new TypeError(`${obj} is not a VM.`);
|
|
@@ -6476,7 +6560,14 @@
|
|
|
6476
6560
|
}
|
|
6477
6561
|
|
|
6478
6562
|
function runRenderedCallback(vm) {
|
|
6479
|
-
|
|
6563
|
+
const {
|
|
6564
|
+
renderer,
|
|
6565
|
+
def: {
|
|
6566
|
+
renderedCallback
|
|
6567
|
+
}
|
|
6568
|
+
} = vm;
|
|
6569
|
+
|
|
6570
|
+
if (isTrue(renderer.ssr)) {
|
|
6480
6571
|
return;
|
|
6481
6572
|
}
|
|
6482
6573
|
|
|
@@ -6488,7 +6579,15 @@
|
|
|
6488
6579
|
invokeServiceHook(vm, rendered);
|
|
6489
6580
|
}
|
|
6490
6581
|
|
|
6491
|
-
|
|
6582
|
+
if (!isUndefined$1(renderedCallback)) {
|
|
6583
|
+
logOperationStart(4
|
|
6584
|
+
/* RenderedCallback */
|
|
6585
|
+
, vm);
|
|
6586
|
+
invokeComponentCallback(vm, renderedCallback);
|
|
6587
|
+
logOperationEnd(4
|
|
6588
|
+
/* RenderedCallback */
|
|
6589
|
+
, vm);
|
|
6590
|
+
}
|
|
6492
6591
|
}
|
|
6493
6592
|
|
|
6494
6593
|
let rehydrateQueue = [];
|
|
@@ -7121,11 +7220,14 @@
|
|
|
7121
7220
|
ArrayPush$1.call(wiredConnecting, () => {
|
|
7122
7221
|
connector.connect();
|
|
7123
7222
|
|
|
7124
|
-
if (
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7223
|
+
if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
|
|
7224
|
+
if (hasDynamicParams) {
|
|
7225
|
+
Promise.resolve().then(computeConfigAndUpdate);
|
|
7226
|
+
return;
|
|
7227
|
+
}
|
|
7128
7228
|
}
|
|
7229
|
+
|
|
7230
|
+
computeConfigAndUpdate();
|
|
7129
7231
|
});
|
|
7130
7232
|
ArrayPush$1.call(wiredDisconnecting, () => {
|
|
7131
7233
|
connector.disconnect();
|
|
@@ -7232,7 +7334,7 @@
|
|
|
7232
7334
|
|
|
7233
7335
|
return reactiveMembrane.getReadOnlyProxy(obj);
|
|
7234
7336
|
}
|
|
7235
|
-
/* version: 2.
|
|
7337
|
+
/* version: 2.5.0 */
|
|
7236
7338
|
|
|
7237
7339
|
/*
|
|
7238
7340
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -7254,6 +7356,10 @@
|
|
|
7254
7356
|
}
|
|
7255
7357
|
|
|
7256
7358
|
const globalStylesheetsParentElement = document.head || document.body || document;
|
|
7359
|
+
const supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync);
|
|
7360
|
+
const styleElements = create(null);
|
|
7361
|
+
const styleSheets = create(null);
|
|
7362
|
+
const nodesToStyleSheets = new WeakMap();
|
|
7257
7363
|
let getCustomElement, defineCustomElement, HTMLElementConstructor;
|
|
7258
7364
|
|
|
7259
7365
|
function isCustomElementRegistryAvailable() {
|
|
@@ -7280,6 +7386,52 @@
|
|
|
7280
7386
|
}
|
|
7281
7387
|
}
|
|
7282
7388
|
|
|
7389
|
+
function insertConstructableStyleSheet(content, target) {
|
|
7390
|
+
// It's important for CSSStyleSheets to be unique based on their content, so that
|
|
7391
|
+
// `shadowRoot.adoptedStyleSheets.includes(sheet)` works.
|
|
7392
|
+
let styleSheet = styleSheets[content];
|
|
7393
|
+
|
|
7394
|
+
if (isUndefined$1(styleSheet)) {
|
|
7395
|
+
styleSheet = new CSSStyleSheet();
|
|
7396
|
+
styleSheet.replaceSync(content);
|
|
7397
|
+
styleSheets[content] = styleSheet;
|
|
7398
|
+
}
|
|
7399
|
+
|
|
7400
|
+
if (!target.adoptedStyleSheets.includes(styleSheet)) {
|
|
7401
|
+
target.adoptedStyleSheets = [...target.adoptedStyleSheets, styleSheet];
|
|
7402
|
+
}
|
|
7403
|
+
}
|
|
7404
|
+
|
|
7405
|
+
function insertStyleElement(content, target) {
|
|
7406
|
+
// Avoid inserting duplicate `<style>`s
|
|
7407
|
+
let sheets = nodesToStyleSheets.get(target);
|
|
7408
|
+
|
|
7409
|
+
if (isUndefined$1(sheets)) {
|
|
7410
|
+
sheets = create(null);
|
|
7411
|
+
nodesToStyleSheets.set(target, sheets);
|
|
7412
|
+
}
|
|
7413
|
+
|
|
7414
|
+
if (sheets[content]) {
|
|
7415
|
+
return;
|
|
7416
|
+
}
|
|
7417
|
+
|
|
7418
|
+
sheets[content] = true; // This `<style>` may be repeated multiple times in the DOM, so cache it. It's a bit
|
|
7419
|
+
// faster to call `cloneNode()` on an existing node than to recreate it every time.
|
|
7420
|
+
|
|
7421
|
+
let elm = styleElements[content];
|
|
7422
|
+
|
|
7423
|
+
if (isUndefined$1(elm)) {
|
|
7424
|
+
elm = document.createElement('style');
|
|
7425
|
+
elm.type = 'text/css';
|
|
7426
|
+
elm.textContent = content;
|
|
7427
|
+
styleElements[content] = elm;
|
|
7428
|
+
} else {
|
|
7429
|
+
elm = elm.cloneNode(true);
|
|
7430
|
+
}
|
|
7431
|
+
|
|
7432
|
+
target.appendChild(elm);
|
|
7433
|
+
}
|
|
7434
|
+
|
|
7283
7435
|
if (isCustomElementRegistryAvailable()) {
|
|
7284
7436
|
getCustomElement = customElements.get.bind(customElements);
|
|
7285
7437
|
defineCustomElement = customElements.define.bind(customElements);
|
|
@@ -7325,7 +7477,8 @@
|
|
|
7325
7477
|
|
|
7326
7478
|
const renderer = {
|
|
7327
7479
|
ssr: false,
|
|
7328
|
-
|
|
7480
|
+
isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
|
|
7481
|
+
isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN),
|
|
7329
7482
|
|
|
7330
7483
|
createElement(tagName, namespace) {
|
|
7331
7484
|
return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
|
|
@@ -7448,6 +7601,15 @@
|
|
|
7448
7601
|
globalStylesheetsParentElement.appendChild(elm);
|
|
7449
7602
|
},
|
|
7450
7603
|
|
|
7604
|
+
insertStylesheet(content, target) {
|
|
7605
|
+
if (supportsConstructableStyleSheets) {
|
|
7606
|
+
insertConstructableStyleSheet(content, target);
|
|
7607
|
+
} else {
|
|
7608
|
+
// Fall back to <style> element
|
|
7609
|
+
insertStyleElement(content, target);
|
|
7610
|
+
}
|
|
7611
|
+
},
|
|
7612
|
+
|
|
7451
7613
|
assertInstanceOfHTMLElement(elm, msg) {
|
|
7452
7614
|
assert.invariant(elm instanceof HTMLElement, msg);
|
|
7453
7615
|
},
|
|
@@ -7677,7 +7839,7 @@
|
|
|
7677
7839
|
return false;
|
|
7678
7840
|
}
|
|
7679
7841
|
|
|
7680
|
-
if (renderer.
|
|
7842
|
+
if (renderer.isSyntheticShadowDefined) {
|
|
7681
7843
|
// TODO [#1252]: old behavior that is still used by some pieces of the platform,
|
|
7682
7844
|
// specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
|
|
7683
7845
|
// used, will be considered global elements.
|
|
@@ -7730,7 +7892,7 @@
|
|
|
7730
7892
|
});
|
|
7731
7893
|
freeze(LightningElement);
|
|
7732
7894
|
seal(LightningElement.prototype);
|
|
7733
|
-
/* version: 2.
|
|
7895
|
+
/* version: 2.5.0 */
|
|
7734
7896
|
|
|
7735
7897
|
exports.LightningElement = LightningElement;
|
|
7736
7898
|
exports.__unstable__ProfilerControl = profilerControl;
|