@lwrjs/everywhere 0.11.12 → 0.11.13
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/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/ef0f2c0fcdc95f8b58b71590775d541e/config.js +11 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_13/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +14 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{5_0_2/s/0bc69c766e057497c2e33d8fd9223511 → 6_0_0/s/6e7ff236fd6011fdc06fb33b61261493}/lwc.js +299 -280
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_11_12 → 0_11_13}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -4
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_11_12 → 0_11_13}/s/f30361ad8ff7af505bf4d465c8499181/lwr_init.js +21 -21
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_11_12/s/4b6ab255b3ee70325c16edbd339ca49b → 0_11_13/s/a0ef4c630f4231221e208bec3c30fb4f}/lwr_loader.js +3 -4
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_11_12 → 0_11_13}/s/274c8343f810353bbad085a79709395f/lwr_metrics.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/preInit/v/{0_11_12 → 0_11_13}/s/f3a204ef43fb3057d910f80d7e9f9ba7/lwr_preInit.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_11_12 → 0_11_13}/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_11_12 → 0_11_13}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_11_12 → 0_11_13}/lwr-error-shim.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_11_12 → 0_11_13}/lwr-loader-shim.bundle.js +6 -6
- package/build/assets/amd/lwr-everywhere-debug.js +8 -9
- package/build/assets/amd/lwr-everywhere-min.js +2 -2
- package/build/assets/amd/lwr-everywhere.js +8 -9
- package/build/assets/core/lwr-everywhere-debug.js +4 -5
- package/build/assets/core/lwr-everywhere.js +4 -5
- package/build/assets/esm/lwr-everywhere-debug.js +1 -1
- package/build/assets/esm/lwr-everywhere-min.js +1 -1
- package/build/assets/esm/lwr-everywhere.js +1 -1
- package/package.json +6 -6
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/d396651dbcf5b97a557f87e2f13bdc14/config.js +0 -11
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_11_12/s/8bce578258518655194bd71d1d72aad5/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LWR.define('lwc/v/
|
|
1
|
+
LWR.define('lwc/v/6_0_0', ['exports'], (function (exports) { 'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Copyright (C) 2023 salesforce.com, inc.
|
|
@@ -49,6 +49,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
49
49
|
create,
|
|
50
50
|
defineProperties,
|
|
51
51
|
defineProperty,
|
|
52
|
+
entries,
|
|
52
53
|
freeze,
|
|
53
54
|
getOwnPropertyDescriptor: getOwnPropertyDescriptor$1,
|
|
54
55
|
getOwnPropertyDescriptors,
|
|
@@ -182,6 +183,9 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
182
183
|
case 4 /* APIFeature.SKIP_UNNECESSARY_REGISTER_DECORATORS */:
|
|
183
184
|
case 5 /* APIFeature.USE_COMMENTS_FOR_FRAGMENT_BOOKENDS */:
|
|
184
185
|
return apiVersion >= 60 /* APIVersion.V60_248_SPRING_24 */;
|
|
186
|
+
case 6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */:
|
|
187
|
+
case 7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */:
|
|
188
|
+
return apiVersion >= 61 /* APIVersion.V61_250_SUMMER_24 */;
|
|
185
189
|
}
|
|
186
190
|
}
|
|
187
191
|
|
|
@@ -315,9 +319,9 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
315
319
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
316
320
|
*/
|
|
317
321
|
// Increment whenever the LWC template compiler changes
|
|
318
|
-
const LWC_VERSION = "
|
|
322
|
+
const LWC_VERSION = "6.0.0";
|
|
319
323
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
|
320
|
-
/** version:
|
|
324
|
+
/** version: 6.0.0 */
|
|
321
325
|
|
|
322
326
|
/**
|
|
323
327
|
* Copyright (C) 2023 salesforce.com, inc.
|
|
@@ -335,11 +339,12 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
335
339
|
PLACEHOLDER_TEST_FLAG: null,
|
|
336
340
|
ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
|
|
337
341
|
ENABLE_MIXED_SHADOW_MODE: null,
|
|
338
|
-
|
|
342
|
+
DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
|
|
339
343
|
ENABLE_WIRE_SYNC_EMIT: null,
|
|
340
344
|
DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
|
|
341
345
|
ENABLE_FROZEN_TEMPLATE: null,
|
|
342
|
-
ENABLE_LEGACY_SCOPE_TOKENS: null
|
|
346
|
+
ENABLE_LEGACY_SCOPE_TOKENS: null,
|
|
347
|
+
ENABLE_FORCE_SHADOW_MIGRATE_MODE: null
|
|
343
348
|
};
|
|
344
349
|
// eslint-disable-next-line no-restricted-properties
|
|
345
350
|
if (!_globalThis.lwcRuntimeFlags) {
|
|
@@ -396,7 +401,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
396
401
|
setFeatureFlag(name, value);
|
|
397
402
|
}
|
|
398
403
|
}
|
|
399
|
-
/** version:
|
|
404
|
+
/** version: 6.0.0 */
|
|
400
405
|
|
|
401
406
|
/**
|
|
402
407
|
* Copyright (C) 2023 salesforce.com, inc.
|
|
@@ -438,7 +443,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
438
443
|
}
|
|
439
444
|
onReportingEnabledCallbacks.length = 0; // clear the array
|
|
440
445
|
},
|
|
441
|
-
|
|
442
446
|
/**
|
|
443
447
|
* Detach the current reporting control (aka dispatcher).
|
|
444
448
|
*/
|
|
@@ -616,7 +620,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
616
620
|
} else if (reactiveObservers[0] === ro) {
|
|
617
621
|
return; // perf optimization considering that most subscriptions will come from the same record
|
|
618
622
|
}
|
|
619
|
-
|
|
620
623
|
if (ArrayIndexOf.call(reactiveObservers, ro) === -1) {
|
|
621
624
|
ro.link(reactiveObservers);
|
|
622
625
|
}
|
|
@@ -733,6 +736,14 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
733
736
|
}
|
|
734
737
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
|
|
735
738
|
}
|
|
739
|
+
function shouldUseNativeCustomElementLifecycle(ctor) {
|
|
740
|
+
if (lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
741
|
+
// temporary "kill switch"
|
|
742
|
+
return false;
|
|
743
|
+
}
|
|
744
|
+
const apiVersion = getComponentAPIVersion(ctor);
|
|
745
|
+
return isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
|
|
746
|
+
}
|
|
736
747
|
// Borrowed from Vue template compiler.
|
|
737
748
|
// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16
|
|
738
749
|
const DECLARATION_DELIMITER = /;(?![^(]*\))/g;
|
|
@@ -798,53 +809,52 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
798
809
|
const instrumentInstance = (_b = _globalThis.__lwc_instrument_cmp_instance) !== null && _b !== void 0 ? _b : noop;
|
|
799
810
|
|
|
800
811
|
/*
|
|
801
|
-
* Copyright (c)
|
|
812
|
+
* Copyright (c) 2018, salesforce.com, inc.
|
|
802
813
|
* All rights reserved.
|
|
803
814
|
* SPDX-License-Identifier: MIT
|
|
804
815
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
805
816
|
*/
|
|
806
|
-
//
|
|
807
|
-
//
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
function applyAriaReflection(prototype) {
|
|
811
|
-
for (const propName of keys(AriaPropNameToAttrNameMap)) {
|
|
812
|
-
const attrName = AriaPropNameToAttrNameMap[propName];
|
|
813
|
-
if (isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName))) {
|
|
814
|
-
// Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
|
|
815
|
-
// from Element.prototype, because these methods are overridden in LightningElement.
|
|
816
|
-
defineProperty(prototype, propName, {
|
|
817
|
-
get() {
|
|
818
|
-
return this.getAttribute(attrName);
|
|
819
|
-
},
|
|
820
|
-
set(newValue) {
|
|
821
|
-
// TODO [#3284]: there is disagreement between browsers and the spec on how to treat undefined
|
|
822
|
-
// Our historical behavior is to only treat null as removing the attribute
|
|
823
|
-
// See also https://github.com/w3c/aria/issues/1858
|
|
824
|
-
if (isNull(newValue)) {
|
|
825
|
-
this.removeAttribute(attrName);
|
|
826
|
-
} else {
|
|
827
|
-
this.setAttribute(attrName, newValue);
|
|
828
|
-
}
|
|
829
|
-
},
|
|
830
|
-
// configurable and enumerable to allow it to be overridden – this mimics Safari's/Chrome's behavior
|
|
831
|
-
configurable: true,
|
|
832
|
-
enumerable: true
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
}
|
|
817
|
+
// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
|
|
818
|
+
// to inject at runtime.
|
|
819
|
+
const HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};
|
|
820
|
+
const HTMLElementPrototype = HTMLElementConstructor.prototype;
|
|
837
821
|
|
|
838
822
|
/*
|
|
839
|
-
* Copyright (c)
|
|
823
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
840
824
|
* All rights reserved.
|
|
841
825
|
* SPDX-License-Identifier: MIT
|
|
842
826
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
843
827
|
*/
|
|
844
|
-
//
|
|
845
|
-
//
|
|
846
|
-
|
|
847
|
-
|
|
828
|
+
// Apply ARIA string reflection behavior to a prototype.
|
|
829
|
+
// This is deliberately kept separate from @lwc/aria-reflection. @lwc/aria-reflection is a global polyfill that is
|
|
830
|
+
// needed for backwards compatibility in LEX, whereas this is designed to only apply to our own
|
|
831
|
+
// LightningElement/BaseBridgeElement prototypes.
|
|
832
|
+
// Note we only need to handle ARIA reflections that aren't already in Element.prototype
|
|
833
|
+
const ariaReflectionPolyfillDescriptors = create(null);
|
|
834
|
+
for (const [propName, attrName] of entries(AriaPropNameToAttrNameMap)) {
|
|
835
|
+
if (isUndefined$1(getPropertyDescriptor(HTMLElementPrototype, propName))) {
|
|
836
|
+
// Note that we need to call this.{get,set,has,remove}Attribute rather than dereferencing
|
|
837
|
+
// from Element.prototype, because these methods are overridden in LightningElement.
|
|
838
|
+
ariaReflectionPolyfillDescriptors[propName] = {
|
|
839
|
+
get() {
|
|
840
|
+
return this.getAttribute(attrName);
|
|
841
|
+
},
|
|
842
|
+
set(newValue) {
|
|
843
|
+
// TODO [#3284]: there is disagreement between browsers and the spec on how to treat undefined
|
|
844
|
+
// Our historical behavior is to only treat null as removing the attribute
|
|
845
|
+
// See also https://github.com/w3c/aria/issues/1858
|
|
846
|
+
if (isNull(newValue)) {
|
|
847
|
+
this.removeAttribute(attrName);
|
|
848
|
+
} else {
|
|
849
|
+
this.setAttribute(attrName, newValue);
|
|
850
|
+
}
|
|
851
|
+
},
|
|
852
|
+
// configurable and enumerable to allow it to be overridden – this mimics Safari's/Chrome's behavior
|
|
853
|
+
configurable: true,
|
|
854
|
+
enumerable: true
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
}
|
|
848
858
|
|
|
849
859
|
/*
|
|
850
860
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -1094,28 +1104,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
1094
1104
|
})
|
|
1095
1105
|
};
|
|
1096
1106
|
}
|
|
1097
|
-
function getLightningElementPrototypeRestrictionsDescriptors(proto) {
|
|
1098
|
-
assertNotProd(); // this method should never leak to prod
|
|
1099
|
-
const originalDispatchEvent = proto.dispatchEvent;
|
|
1100
|
-
return {
|
|
1101
|
-
dispatchEvent: generateDataDescriptor({
|
|
1102
|
-
value(event) {
|
|
1103
|
-
const vm = getAssociatedVM(this);
|
|
1104
|
-
if (!isNull(event) && isObject(event)) {
|
|
1105
|
-
const {
|
|
1106
|
-
type
|
|
1107
|
-
} = event;
|
|
1108
|
-
if (!/^[a-z][a-z0-9_]*$/.test(type)) {
|
|
1109
|
-
logError(`Invalid event type "${type}" dispatched in element ${getComponentTag(vm)}.` + ` Event name must start with a lowercase letter and followed only lowercase` + ` letters, numbers, and underscores`, vm);
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
// Typescript does not like it when you treat the `arguments` object as an array
|
|
1113
|
-
// @ts-ignore type-mismatch
|
|
1114
|
-
return originalDispatchEvent.apply(this, arguments);
|
|
1115
|
-
}
|
|
1116
|
-
})
|
|
1117
|
-
};
|
|
1118
|
-
}
|
|
1119
1107
|
// This routine will prevent access to certain properties on a shadow root instance to guarantee
|
|
1120
1108
|
// that all components will work fine in IE11 and other browsers without shadow dom support.
|
|
1121
1109
|
function patchShadowRootWithRestrictions(sr) {
|
|
@@ -1126,9 +1114,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
1126
1114
|
const elmProto = getPrototypeOf$1(elm);
|
|
1127
1115
|
setPrototypeOf(elm, create(elmProto, restrictionsDescriptors));
|
|
1128
1116
|
}
|
|
1129
|
-
function patchLightningElementPrototypeWithRestrictions(proto) {
|
|
1130
|
-
defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
|
|
1131
|
-
}
|
|
1132
1117
|
function updateComponentValue(vm, key, newValue) {
|
|
1133
1118
|
const {
|
|
1134
1119
|
cmpFields
|
|
@@ -1295,7 +1280,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
1295
1280
|
if (!isExtensible(shadowTarget)) {
|
|
1296
1281
|
return false; // was already locked down
|
|
1297
1282
|
}
|
|
1298
|
-
|
|
1299
1283
|
if (!isExtensible(originalTarget)) {
|
|
1300
1284
|
this.lockShadowTarget(shadowTarget);
|
|
1301
1285
|
return false;
|
|
@@ -1506,7 +1490,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
1506
1490
|
valueMutated(originalTarget, key);
|
|
1507
1491
|
return true;
|
|
1508
1492
|
}
|
|
1509
|
-
/*LWC compiler
|
|
1493
|
+
/*LWC compiler v6.0.0*/
|
|
1510
1494
|
}
|
|
1511
1495
|
const getterMap = new WeakMap();
|
|
1512
1496
|
const setterMap = new WeakMap();
|
|
@@ -1599,7 +1583,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
1599
1583
|
/* istanbul ignore next */
|
|
1600
1584
|
return false;
|
|
1601
1585
|
}
|
|
1602
|
-
/*LWC compiler
|
|
1586
|
+
/*LWC compiler v6.0.0*/
|
|
1603
1587
|
}
|
|
1604
1588
|
function extract(objectOrArray) {
|
|
1605
1589
|
if (isArray(objectOrArray)) {
|
|
@@ -1807,6 +1791,77 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
1807
1791
|
}
|
|
1808
1792
|
}
|
|
1809
1793
|
|
|
1794
|
+
/*
|
|
1795
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
1796
|
+
* All rights reserved.
|
|
1797
|
+
* SPDX-License-Identifier: MIT
|
|
1798
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
1799
|
+
*/
|
|
1800
|
+
let globalStylesheet;
|
|
1801
|
+
function isStyleElement(elm) {
|
|
1802
|
+
return elm.tagName === 'STYLE';
|
|
1803
|
+
}
|
|
1804
|
+
async function fetchStylesheet(elm) {
|
|
1805
|
+
if (isStyleElement(elm)) {
|
|
1806
|
+
return elm.textContent;
|
|
1807
|
+
} else {
|
|
1808
|
+
// <link>
|
|
1809
|
+
const {
|
|
1810
|
+
href
|
|
1811
|
+
} = elm;
|
|
1812
|
+
try {
|
|
1813
|
+
return await (await fetch(href)).text();
|
|
1814
|
+
} catch (err) {
|
|
1815
|
+
logWarnOnce(`Ignoring cross-origin stylesheet in migrate mode: ${href}`);
|
|
1816
|
+
// ignore errors with cross-origin stylesheets - nothing we can do for those
|
|
1817
|
+
return '';
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
function initGlobalStylesheet() {
|
|
1822
|
+
const stylesheet = new CSSStyleSheet();
|
|
1823
|
+
const elmsToPromises = new Map();
|
|
1824
|
+
let lastSeenLength = 0;
|
|
1825
|
+
const copyToGlobalStylesheet = () => {
|
|
1826
|
+
const elms = document.head.querySelectorAll('style:not([data-rendered-by-lwc]),link[rel="stylesheet"]');
|
|
1827
|
+
if (elms.length === lastSeenLength) {
|
|
1828
|
+
return; // nothing to update
|
|
1829
|
+
}
|
|
1830
|
+
lastSeenLength = elms.length;
|
|
1831
|
+
const promises = [...elms].map(elm => {
|
|
1832
|
+
let promise = elmsToPromises.get(elm);
|
|
1833
|
+
if (!promise) {
|
|
1834
|
+
// Cache the promise
|
|
1835
|
+
promise = fetchStylesheet(elm);
|
|
1836
|
+
elmsToPromises.set(elm, promise);
|
|
1837
|
+
}
|
|
1838
|
+
return promise;
|
|
1839
|
+
});
|
|
1840
|
+
Promise.all(promises).then(stylesheetTexts => {
|
|
1841
|
+
// When replaceSync() is called, the entire contents of the constructable stylesheet are replaced
|
|
1842
|
+
// with the copied+concatenated styles. This means that any shadow root's adoptedStyleSheets that
|
|
1843
|
+
// contains this constructable stylesheet will immediately get the new styles.
|
|
1844
|
+
stylesheet.replaceSync(stylesheetTexts.join('\n'));
|
|
1845
|
+
});
|
|
1846
|
+
};
|
|
1847
|
+
const headObserver = new MutationObserver(copyToGlobalStylesheet);
|
|
1848
|
+
// By observing only the childList, note that we are not covering the case where someone changes an `href`
|
|
1849
|
+
// on an existing <link>`, or the textContent on an existing `<style>`. This is assumed to be an uncommon
|
|
1850
|
+
// case and not worth covering.
|
|
1851
|
+
headObserver.observe(document.head, {
|
|
1852
|
+
childList: true
|
|
1853
|
+
});
|
|
1854
|
+
copyToGlobalStylesheet();
|
|
1855
|
+
return stylesheet;
|
|
1856
|
+
}
|
|
1857
|
+
function applyShadowMigrateMode(shadowRoot) {
|
|
1858
|
+
if (!globalStylesheet) {
|
|
1859
|
+
globalStylesheet = initGlobalStylesheet();
|
|
1860
|
+
}
|
|
1861
|
+
shadowRoot.synthetic = true; // pretend to be synthetic mode
|
|
1862
|
+
shadowRoot.adoptedStyleSheets.push(globalStylesheet);
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1810
1865
|
/*
|
|
1811
1866
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
1812
1867
|
* All rights reserved.
|
|
@@ -1959,6 +2014,9 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
1959
2014
|
if (process.env.NODE_ENV !== 'production') {
|
|
1960
2015
|
patchShadowRootWithRestrictions(shadowRoot);
|
|
1961
2016
|
}
|
|
2017
|
+
if (lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE && vm.shadowMigrateMode) {
|
|
2018
|
+
applyShadowMigrateMode(shadowRoot);
|
|
2019
|
+
}
|
|
1962
2020
|
return shadowRoot;
|
|
1963
2021
|
}
|
|
1964
2022
|
function warnIfInvokedDuringConstruction(vm, methodOrPropName) {
|
|
@@ -2389,11 +2447,17 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
2389
2447
|
for (const propName in HTMLElementOriginalDescriptors) {
|
|
2390
2448
|
lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
|
|
2391
2449
|
}
|
|
2392
|
-
defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
|
2393
2450
|
// Apply ARIA reflection to LightningElement.prototype, on both the browser and server.
|
|
2394
2451
|
// This allows `this.aria*` property accessors to work from inside a component, and to reflect `aria-*` attrs.
|
|
2395
2452
|
// Note this works regardless of whether the global ARIA reflection polyfill is applied or not.
|
|
2396
|
-
|
|
2453
|
+
{
|
|
2454
|
+
// In the browser, we use createBridgeToElementDescriptor, so we can get the normal reactivity lifecycle for
|
|
2455
|
+
// aria* properties
|
|
2456
|
+
for (const [propName, descriptor] of entries(ariaReflectionPolyfillDescriptors)) {
|
|
2457
|
+
lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, descriptor);
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
defineProperties(LightningElement.prototype, lightningBasedDescriptors);
|
|
2397
2461
|
defineProperty(LightningElement, 'CustomElementConstructor', {
|
|
2398
2462
|
get() {
|
|
2399
2463
|
// If required, a runtime-specific implementation must be defined.
|
|
@@ -2401,9 +2465,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
2401
2465
|
},
|
|
2402
2466
|
configurable: true
|
|
2403
2467
|
});
|
|
2404
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2405
|
-
patchLightningElementPrototypeWithRestrictions(LightningElement.prototype);
|
|
2406
|
-
}
|
|
2407
2468
|
function createObservedFieldPropertyDescriptor(key) {
|
|
2408
2469
|
return {
|
|
2409
2470
|
get() {
|
|
@@ -2472,7 +2533,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
2472
2533
|
if (isUndefined$1(adapterContextToken)) {
|
|
2473
2534
|
return; // no provider found, nothing to be done
|
|
2474
2535
|
}
|
|
2475
|
-
|
|
2476
2536
|
const {
|
|
2477
2537
|
elm,
|
|
2478
2538
|
context: {
|
|
@@ -2906,7 +2966,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
2906
2966
|
return "field" /* DescriptorType.Field */;
|
|
2907
2967
|
}
|
|
2908
2968
|
}
|
|
2909
|
-
|
|
2910
2969
|
function validateObservedField(Ctor, fieldName, descriptor) {
|
|
2911
2970
|
assertNotProd(); // this method should never leak to prod
|
|
2912
2971
|
if (!isUndefined$1(descriptor)) {
|
|
@@ -3276,7 +3335,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
3276
3335
|
}
|
|
3277
3336
|
function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto, hasCustomSuperClass) {
|
|
3278
3337
|
const HTMLBridgeElement = class extends SuperClass {
|
|
3279
|
-
/*LWC compiler
|
|
3338
|
+
/*LWC compiler v6.0.0*/
|
|
3280
3339
|
};
|
|
3281
3340
|
// generating the hash table for attributes to avoid duplicate fields and facilitate validation
|
|
3282
3341
|
// and false positives in case of inheritance.
|
|
@@ -3301,7 +3360,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
3301
3360
|
// and can break tooling that expects it to be iterable or defined, e.g. Jest:
|
|
3302
3361
|
// https://github.com/jestjs/jest/blob/b4c9587/packages/pretty-format/src/plugins/DOMElement.ts#L95
|
|
3303
3362
|
// It also doesn't make sense to override e.g. "constructor".
|
|
3304
|
-
.filter(propName => !(propName in HTMLElementPrototype)));
|
|
3363
|
+
.filter(propName => !(propName in HTMLElementPrototype) && !(propName in ariaReflectionPolyfillDescriptors)));
|
|
3305
3364
|
for (const propName of nonPublicPropertiesToWarnOn) {
|
|
3306
3365
|
if (ArrayIndexOf.call(publicProperties, propName) === -1) {
|
|
3307
3366
|
descriptors[propName] = createAccessorThatWarns(propName);
|
|
@@ -3371,21 +3430,19 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
3371
3430
|
defineProperties(HTMLBridgeElement.prototype, descriptors);
|
|
3372
3431
|
return HTMLBridgeElement;
|
|
3373
3432
|
}
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
applyAriaReflection(BaseBridgeElement.prototype);
|
|
3388
|
-
}
|
|
3433
|
+
// We do some special handling of non-standard ARIA props like ariaLabelledBy as well as props without (as of this
|
|
3434
|
+
// writing) broad cross-browser support like ariaBrailleLabel. This is so the reflection works correctly and preserves
|
|
3435
|
+
// backwards compatibility with the previous global polyfill approach.
|
|
3436
|
+
//
|
|
3437
|
+
// The goal here is to expose `elm.aria*` property accessors to work from outside a component, and to reflect `aria-*`
|
|
3438
|
+
// attrs. This is especially important because the template compiler compiles aria-* attrs on components to aria* props.
|
|
3439
|
+
// Note this works regardless of whether the global ARIA reflection polyfill is applied or not.
|
|
3440
|
+
//
|
|
3441
|
+
// Also note this ARIA reflection only really makes sense in the browser. On the server, there is no
|
|
3442
|
+
// `renderedCallback()`, so you cannot do e.g. `this.template.querySelector('x-child').ariaBusy = 'true'`. So we don't
|
|
3443
|
+
// need to expose ARIA props outside the LightningElement
|
|
3444
|
+
const basePublicProperties = [...getOwnPropertyNames$1(HTMLElementOriginalDescriptors), ...getOwnPropertyNames$1(ariaReflectionPolyfillDescriptors)];
|
|
3445
|
+
const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, basePublicProperties, [], [], null, false);
|
|
3389
3446
|
freeze(BaseBridgeElement);
|
|
3390
3447
|
seal(BaseBridgeElement.prototype);
|
|
3391
3448
|
|
|
@@ -3437,7 +3494,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
3437
3494
|
}
|
|
3438
3495
|
});
|
|
3439
3496
|
}
|
|
3440
|
-
|
|
3441
3497
|
_getWeakRefs(key) {
|
|
3442
3498
|
let weakRefs = this._map.get(key);
|
|
3443
3499
|
if (isUndefined$1(weakRefs)) {
|
|
@@ -3736,7 +3792,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
3736
3792
|
if (!isUndefined$1(ctorRenderMode)) {
|
|
3737
3793
|
renderMode = ctorRenderMode === 'light' ? 0 /* RenderMode.Light */ : 1 /* RenderMode.Shadow */;
|
|
3738
3794
|
}
|
|
3739
|
-
|
|
3740
3795
|
let formAssociated = superDef.formAssociated;
|
|
3741
3796
|
if (!isUndefined$1(ctorFormAssociated)) {
|
|
3742
3797
|
formAssociated = ctorFormAssociated;
|
|
@@ -3869,7 +3924,9 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
3869
3924
|
// avoid leaking the reference to the public props descriptors
|
|
3870
3925
|
publicProps[key] = {
|
|
3871
3926
|
config: propsConfig[key] || 0,
|
|
3927
|
+
// a property by default
|
|
3872
3928
|
type: "any" /* PropDefType.any */,
|
|
3929
|
+
// no type inference for public services
|
|
3873
3930
|
attr: htmlPropertyToAttribute(key)
|
|
3874
3931
|
};
|
|
3875
3932
|
}
|
|
@@ -3899,6 +3956,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
3899
3956
|
function createInlineStyleVNode(content) {
|
|
3900
3957
|
return api.h('style', {
|
|
3901
3958
|
key: 'style',
|
|
3959
|
+
// special key
|
|
3902
3960
|
attrs: {
|
|
3903
3961
|
type: 'text/css'
|
|
3904
3962
|
}
|
|
@@ -4021,7 +4079,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
4021
4079
|
}
|
|
4022
4080
|
useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
|
|
4023
4081
|
}
|
|
4024
|
-
|
|
4025
4082
|
ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
|
|
4026
4083
|
}
|
|
4027
4084
|
}
|
|
@@ -4140,21 +4197,21 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
4140
4197
|
} = vnode;
|
|
4141
4198
|
return type === 2 /* VNodeType.Element */ || type === 3 /* VNodeType.CustomElement */;
|
|
4142
4199
|
}
|
|
4143
|
-
|
|
4144
4200
|
function isSameVnode(vnode1, vnode2) {
|
|
4145
4201
|
return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
|
|
4146
4202
|
}
|
|
4147
4203
|
function isVCustomElement(vnode) {
|
|
4148
4204
|
return vnode.type === 3 /* VNodeType.CustomElement */;
|
|
4149
4205
|
}
|
|
4150
|
-
|
|
4151
4206
|
function isVFragment(vnode) {
|
|
4152
4207
|
return vnode.type === 5 /* VNodeType.Fragment */;
|
|
4153
4208
|
}
|
|
4154
|
-
|
|
4155
4209
|
function isVScopedSlotFragment(vnode) {
|
|
4156
4210
|
return vnode.type === 6 /* VNodeType.ScopedSlotFragment */;
|
|
4157
4211
|
}
|
|
4212
|
+
function isVStatic(vnode) {
|
|
4213
|
+
return vnode.type === 4 /* VNodeType.Static */;
|
|
4214
|
+
}
|
|
4158
4215
|
|
|
4159
4216
|
/*
|
|
4160
4217
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4208,6 +4265,26 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
4208
4265
|
}
|
|
4209
4266
|
}
|
|
4210
4267
|
}
|
|
4268
|
+
function patchSlotAssignment(oldVnode, vnode, renderer) {
|
|
4269
|
+
const {
|
|
4270
|
+
slotAssignment
|
|
4271
|
+
} = vnode;
|
|
4272
|
+
if ((oldVnode === null || oldVnode === void 0 ? void 0 : oldVnode.slotAssignment) === slotAssignment) {
|
|
4273
|
+
return;
|
|
4274
|
+
}
|
|
4275
|
+
const {
|
|
4276
|
+
elm
|
|
4277
|
+
} = vnode;
|
|
4278
|
+
const {
|
|
4279
|
+
setAttribute,
|
|
4280
|
+
removeAttribute
|
|
4281
|
+
} = renderer;
|
|
4282
|
+
if (isUndefined$1(slotAssignment) || isNull(slotAssignment)) {
|
|
4283
|
+
removeAttribute(elm, 'slot');
|
|
4284
|
+
} else {
|
|
4285
|
+
setAttribute(elm, 'slot', slotAssignment);
|
|
4286
|
+
}
|
|
4287
|
+
}
|
|
4211
4288
|
|
|
4212
4289
|
/*
|
|
4213
4290
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -4722,6 +4799,8 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
4722
4799
|
}
|
|
4723
4800
|
function patchStatic(n1, n2, renderer) {
|
|
4724
4801
|
const elm = n2.elm = n1.elm;
|
|
4802
|
+
// slotAssignments can only apply to the top level element, never to a static part.
|
|
4803
|
+
patchSlotAssignment(n1, n2, renderer);
|
|
4725
4804
|
// The `refs` object is blown away in every re-render, so we always need to re-apply them
|
|
4726
4805
|
applyStaticParts(elm, n2, renderer, false);
|
|
4727
4806
|
}
|
|
@@ -4751,13 +4830,16 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
4751
4830
|
elm[KEY__SHADOW_STATIC] = true;
|
|
4752
4831
|
}
|
|
4753
4832
|
}
|
|
4833
|
+
// slotAssignments can only apply to the top level element, never to a static part.
|
|
4834
|
+
patchSlotAssignment(null, vnode, renderer);
|
|
4754
4835
|
insertNode(elm, parent, anchor, renderer);
|
|
4755
4836
|
applyStaticParts(elm, vnode, renderer, true);
|
|
4756
4837
|
}
|
|
4757
4838
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
|
4758
4839
|
const {
|
|
4759
4840
|
sel,
|
|
4760
|
-
owner
|
|
4841
|
+
owner,
|
|
4842
|
+
ctor
|
|
4761
4843
|
} = vnode;
|
|
4762
4844
|
const {
|
|
4763
4845
|
createCustomElement
|
|
@@ -4773,38 +4855,13 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
4773
4855
|
// the custom element from the registry is expecting an upgrade callback
|
|
4774
4856
|
vm = createViewModelHook(elm, vnode, renderer);
|
|
4775
4857
|
};
|
|
4776
|
-
let connectedCallback;
|
|
4777
|
-
let disconnectedCallback;
|
|
4778
|
-
let formAssociatedCallback;
|
|
4779
|
-
let formDisabledCallback;
|
|
4780
|
-
let formResetCallback;
|
|
4781
|
-
let formStateRestoreCallback;
|
|
4782
|
-
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
4783
|
-
connectedCallback = elm => {
|
|
4784
|
-
connectRootElement(elm);
|
|
4785
|
-
};
|
|
4786
|
-
disconnectedCallback = elm => {
|
|
4787
|
-
disconnectRootElement(elm);
|
|
4788
|
-
};
|
|
4789
|
-
formAssociatedCallback = elm => {
|
|
4790
|
-
runFormAssociatedCallback(elm);
|
|
4791
|
-
};
|
|
4792
|
-
formDisabledCallback = elm => {
|
|
4793
|
-
runFormDisabledCallback(elm);
|
|
4794
|
-
};
|
|
4795
|
-
formResetCallback = elm => {
|
|
4796
|
-
runFormResetCallback(elm);
|
|
4797
|
-
};
|
|
4798
|
-
formStateRestoreCallback = elm => {
|
|
4799
|
-
runFormStateRestoreCallback(elm);
|
|
4800
|
-
};
|
|
4801
|
-
}
|
|
4802
4858
|
// Should never get a tag with upper case letter at this point; the compiler
|
|
4803
4859
|
// should produce only tags with lowercase letters. However, the Java
|
|
4804
4860
|
// compiler may generate tagnames with uppercase letters so - for backwards
|
|
4805
4861
|
// compatibility, we lower case the tagname here.
|
|
4806
4862
|
const normalizedTagname = sel.toLowerCase();
|
|
4807
|
-
const
|
|
4863
|
+
const useNativeLifecycle = shouldUseNativeCustomElementLifecycle(ctor);
|
|
4864
|
+
const elm = createCustomElement(normalizedTagname, upgradeCallback, useNativeLifecycle);
|
|
4808
4865
|
vnode.elm = elm;
|
|
4809
4866
|
vnode.vm = vm;
|
|
4810
4867
|
linkNodeToShadow(elm, owner, renderer);
|
|
@@ -4816,7 +4873,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
4816
4873
|
insertNode(elm, parent, anchor, renderer);
|
|
4817
4874
|
if (vm) {
|
|
4818
4875
|
{
|
|
4819
|
-
if (!
|
|
4876
|
+
if (!useNativeLifecycle) {
|
|
4820
4877
|
if (process.env.NODE_ENV !== 'production') {
|
|
4821
4878
|
// With synthetic lifecycle callbacks, it's possible for elements to be removed without the engine
|
|
4822
4879
|
// noticing it (e.g. `appendChild` the same host element twice). This test ensures we don't regress.
|
|
@@ -5021,6 +5078,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5021
5078
|
patchStyleAttribute(oldVnode, vnode, renderer);
|
|
5022
5079
|
patchAttributes(oldVnode, vnode, renderer);
|
|
5023
5080
|
patchProps(oldVnode, vnode, renderer);
|
|
5081
|
+
patchSlotAssignment(oldVnode, vnode, renderer);
|
|
5024
5082
|
// The `refs` object is blown away in every re-render, so we always need to re-apply them
|
|
5025
5083
|
applyRefs(vnode, vnode.owner);
|
|
5026
5084
|
}
|
|
@@ -5189,7 +5247,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5189
5247
|
return vm;
|
|
5190
5248
|
}
|
|
5191
5249
|
function allocateInSlot(vm, children, owner) {
|
|
5192
|
-
var _a
|
|
5250
|
+
var _a;
|
|
5193
5251
|
const {
|
|
5194
5252
|
cmpSlots: {
|
|
5195
5253
|
slotAssignments: oldSlotsMapping
|
|
@@ -5203,8 +5261,8 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5203
5261
|
continue;
|
|
5204
5262
|
}
|
|
5205
5263
|
let slotName = '';
|
|
5206
|
-
if (isVBaseElement(vnode)) {
|
|
5207
|
-
slotName = (
|
|
5264
|
+
if (isVBaseElement(vnode) || isVStatic(vnode)) {
|
|
5265
|
+
slotName = (_a = vnode.slotAssignment) !== null && _a !== void 0 ? _a : '';
|
|
5208
5266
|
} else if (isVScopedSlotFragment(vnode)) {
|
|
5209
5267
|
slotName = vnode.slotName;
|
|
5210
5268
|
}
|
|
@@ -5460,7 +5518,8 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5460
5518
|
elm: undefined,
|
|
5461
5519
|
fragment,
|
|
5462
5520
|
owner,
|
|
5463
|
-
parts
|
|
5521
|
+
parts,
|
|
5522
|
+
slotAssignment: undefined
|
|
5464
5523
|
};
|
|
5465
5524
|
return vnode;
|
|
5466
5525
|
}
|
|
@@ -5503,7 +5562,8 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5503
5562
|
});
|
|
5504
5563
|
}
|
|
5505
5564
|
const {
|
|
5506
|
-
key
|
|
5565
|
+
key,
|
|
5566
|
+
slotAssignment
|
|
5507
5567
|
} = data;
|
|
5508
5568
|
const vnode = {
|
|
5509
5569
|
type: 2 /* VNodeType.Element */,
|
|
@@ -5512,7 +5572,8 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5512
5572
|
children,
|
|
5513
5573
|
elm: undefined,
|
|
5514
5574
|
key,
|
|
5515
|
-
owner: vmBeingRendered
|
|
5575
|
+
owner: vmBeingRendered,
|
|
5576
|
+
slotAssignment
|
|
5516
5577
|
};
|
|
5517
5578
|
return vnode;
|
|
5518
5579
|
}
|
|
@@ -5537,6 +5598,11 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5537
5598
|
assert.isTrue(isObject(data), `s() 2nd argument data must be an object.`);
|
|
5538
5599
|
assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);
|
|
5539
5600
|
}
|
|
5601
|
+
const vmBeingRendered = getVMBeingRendered();
|
|
5602
|
+
const {
|
|
5603
|
+
renderMode,
|
|
5604
|
+
apiVersion
|
|
5605
|
+
} = vmBeingRendered;
|
|
5540
5606
|
if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
|
|
5541
5607
|
const newChildren = [];
|
|
5542
5608
|
const slotAssignments = slotset.slotAssignments[slotName];
|
|
@@ -5556,7 +5622,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5556
5622
|
}
|
|
5557
5623
|
// If the passed slot content is factory, evaluate it and add the produced vnodes
|
|
5558
5624
|
if (assignedNodeIsScopedSlot) {
|
|
5559
|
-
const vmBeingRenderedInception = getVMBeingRendered();
|
|
5560
5625
|
// Evaluate in the scope of the slot content's owner
|
|
5561
5626
|
// if a slotset is provided, there will always be an owner. The only case where owner is
|
|
5562
5627
|
// undefined is for root components, but root components cannot accept slotted content
|
|
@@ -5571,22 +5636,33 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5571
5636
|
ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
|
|
5572
5637
|
});
|
|
5573
5638
|
} finally {
|
|
5574
|
-
setVMBeingRendered(
|
|
5639
|
+
setVMBeingRendered(vmBeingRendered);
|
|
5575
5640
|
}
|
|
5576
5641
|
} else {
|
|
5642
|
+
// This block is for standard slots (non-scoped slots)
|
|
5643
|
+
let clonedVNode;
|
|
5644
|
+
if (renderMode === 0 /* RenderMode.Light */ && isAPIFeatureEnabled(6 /* APIFeature.USE_LIGHT_DOM_SLOT_FORWARDING */, apiVersion) && (isVBaseElement(vnode) || isVStatic(vnode)) &&
|
|
5645
|
+
// We only need to copy the vnodes when the slot assignment changes, copying every time causes issues with
|
|
5646
|
+
// disconnected/connected callback firing.
|
|
5647
|
+
vnode.slotAssignment !== data.slotAssignment) {
|
|
5648
|
+
// When the light DOM slot assignment (slot attribute) changes we can't use the same reference
|
|
5649
|
+
// to the vnode because the current way the diffing algo works, it will replace the original reference
|
|
5650
|
+
// to the host element with a new one. This means the new element will be mounted and immediately unmounted.
|
|
5651
|
+
// Creating a copy of the vnode to preserve a reference to the previous host element.
|
|
5652
|
+
clonedVNode = Object.assign(Object.assign({}, vnode), {
|
|
5653
|
+
slotAssignment: data.slotAssignment
|
|
5654
|
+
});
|
|
5655
|
+
}
|
|
5577
5656
|
// If the slot content is standard type, the content is static, no additional
|
|
5578
5657
|
// processing needed on the vnode
|
|
5579
|
-
ArrayPush$1.call(newChildren, vnode);
|
|
5658
|
+
ArrayPush$1.call(newChildren, clonedVNode !== null && clonedVNode !== void 0 ? clonedVNode : vnode);
|
|
5580
5659
|
}
|
|
5581
5660
|
}
|
|
5582
5661
|
}
|
|
5583
5662
|
children = newChildren;
|
|
5584
5663
|
}
|
|
5585
|
-
const vmBeingRendered = getVMBeingRendered();
|
|
5586
5664
|
const {
|
|
5587
|
-
|
|
5588
|
-
shadowMode,
|
|
5589
|
-
apiVersion
|
|
5665
|
+
shadowMode
|
|
5590
5666
|
} = vmBeingRendered;
|
|
5591
5667
|
if (renderMode === 0 /* RenderMode.Light */) {
|
|
5592
5668
|
// light DOM slots - backwards-compatible behavior uses flattening, new behavior uses fragments
|
|
@@ -5626,7 +5702,8 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5626
5702
|
}
|
|
5627
5703
|
}
|
|
5628
5704
|
const {
|
|
5629
|
-
key
|
|
5705
|
+
key,
|
|
5706
|
+
slotAssignment
|
|
5630
5707
|
} = data;
|
|
5631
5708
|
let elm, aChildren, vm;
|
|
5632
5709
|
const vnode = {
|
|
@@ -5636,9 +5713,11 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
5636
5713
|
children,
|
|
5637
5714
|
elm,
|
|
5638
5715
|
key,
|
|
5716
|
+
slotAssignment,
|
|
5639
5717
|
ctor: Ctor,
|
|
5640
5718
|
owner: vmBeingRendered,
|
|
5641
5719
|
mode: 'open',
|
|
5720
|
+
// TODO [#1294]: this should be defined in Ctor
|
|
5642
5721
|
aChildren,
|
|
5643
5722
|
vm
|
|
5644
5723
|
};
|
|
@@ -6098,17 +6177,14 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6098
6177
|
if (hasStyleToken && hasScopedStyles) {
|
|
6099
6178
|
cacheKey |= 1 /* FragmentCache.HAS_SCOPED_STYLE */;
|
|
6100
6179
|
}
|
|
6101
|
-
|
|
6102
6180
|
if (hasStyleToken && isSyntheticShadow) {
|
|
6103
6181
|
cacheKey |= 2 /* FragmentCache.SHADOW_MODE_SYNTHETIC */;
|
|
6104
6182
|
}
|
|
6105
|
-
|
|
6106
6183
|
if (hasLegacyToken) {
|
|
6107
6184
|
// This isn't strictly required for prod, but it's required for our karma tests
|
|
6108
6185
|
// since the lwcRuntimeFlag may change over time
|
|
6109
6186
|
cacheKey |= 4 /* FragmentCache.HAS_LEGACY_SCOPE_TOKEN */;
|
|
6110
6187
|
}
|
|
6111
|
-
|
|
6112
6188
|
if (!isUndefined$1(cache[cacheKey])) {
|
|
6113
6189
|
return cache[cacheKey];
|
|
6114
6190
|
}
|
|
@@ -6322,7 +6398,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6322
6398
|
}
|
|
6323
6399
|
}
|
|
6324
6400
|
}
|
|
6325
|
-
|
|
6326
6401
|
function invokeComponentRenderMethod(vm) {
|
|
6327
6402
|
const {
|
|
6328
6403
|
def: {
|
|
@@ -6449,7 +6524,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6449
6524
|
if (!isFunction$1(listener)) {
|
|
6450
6525
|
throw new TypeError('Expected an EventListener but received ' + typeof listener); // avoiding problems with non-valid listeners
|
|
6451
6526
|
}
|
|
6452
|
-
|
|
6453
6527
|
let wrappedListener = cmpEventListenerMap.get(listener);
|
|
6454
6528
|
if (isUndefined$1(wrappedListener)) {
|
|
6455
6529
|
wrappedListener = function (event) {
|
|
@@ -6522,7 +6596,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6522
6596
|
// old vnode.children is removed from the DOM.
|
|
6523
6597
|
function removeVM(vm) {
|
|
6524
6598
|
if (process.env.NODE_ENV !== 'production') {
|
|
6525
|
-
if (!
|
|
6599
|
+
if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor)) {
|
|
6526
6600
|
// With native lifecycle, we cannot be certain that connectedCallback was called before a component
|
|
6527
6601
|
// was removed from the VDOM. If the component is disconnected, then connectedCallback will not fire
|
|
6528
6602
|
// in native mode, although it will fire in synthetic mode due to appendChild triggering it.
|
|
@@ -6586,6 +6660,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6586
6660
|
// Properties set right after VM creation.
|
|
6587
6661
|
tro: null,
|
|
6588
6662
|
shadowMode: null,
|
|
6663
|
+
shadowMigrateMode: false,
|
|
6589
6664
|
stylesheets: null,
|
|
6590
6665
|
// Properties set by the LightningElement constructor.
|
|
6591
6666
|
component: null,
|
|
@@ -6601,8 +6676,21 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6601
6676
|
vm.debugInfo = create(null);
|
|
6602
6677
|
}
|
|
6603
6678
|
vm.stylesheets = computeStylesheets(vm, def.ctor);
|
|
6604
|
-
|
|
6679
|
+
const computedShadowMode = computeShadowMode(def, vm.owner, renderer);
|
|
6680
|
+
if (lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
|
|
6681
|
+
vm.shadowMode = 0 /* ShadowMode.Native */;
|
|
6682
|
+
vm.shadowMigrateMode = computedShadowMode === 1 /* ShadowMode.Synthetic */;
|
|
6683
|
+
} else {
|
|
6684
|
+
vm.shadowMode = computedShadowMode;
|
|
6685
|
+
}
|
|
6605
6686
|
vm.tro = getTemplateReactiveObserver(vm);
|
|
6687
|
+
// We don't need to report the shadow mode if we're rendering in light DOM
|
|
6688
|
+
if (isReportingEnabled() && vm.renderMode === 1 /* RenderMode.Shadow */) {
|
|
6689
|
+
report("ShadowModeUsage" /* ReportingEventId.ShadowModeUsage */, {
|
|
6690
|
+
tagName: vm.tagName,
|
|
6691
|
+
mode: vm.shadowMode
|
|
6692
|
+
});
|
|
6693
|
+
}
|
|
6606
6694
|
if (process.env.NODE_ENV !== 'production') {
|
|
6607
6695
|
vm.toString = () => {
|
|
6608
6696
|
return `[object:vm ${def.name} (${vm.idx})]`;
|
|
@@ -6688,12 +6776,12 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6688
6776
|
if (process.env.NODE_ENV !== 'production' && lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
|
|
6689
6777
|
return 0 /* ShadowMode.Native */;
|
|
6690
6778
|
}
|
|
6691
|
-
|
|
6692
6779
|
const {
|
|
6693
6780
|
isSyntheticShadowDefined
|
|
6694
6781
|
} = renderer;
|
|
6695
6782
|
let shadowMode;
|
|
6696
|
-
|
|
6783
|
+
// If ENABLE_FORCE_SHADOW_MIGRATE_MODE is true, then ShadowMode.Synthetic here will mean "force-migrate" mode.
|
|
6784
|
+
if (isSyntheticShadowDefined || lwcRuntimeFlags.ENABLE_FORCE_SHADOW_MIGRATE_MODE) {
|
|
6697
6785
|
if (def.renderMode === 0 /* RenderMode.Light */) {
|
|
6698
6786
|
// ShadowMode.Native implies "not synthetic shadow" which is consistent with how
|
|
6699
6787
|
// everything defaults to native when the synthetic shadow polyfill is unavailable.
|
|
@@ -6720,7 +6808,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6720
6808
|
// Native if the synthetic shadow polyfill is unavailable.
|
|
6721
6809
|
shadowMode = 0 /* ShadowMode.Native */;
|
|
6722
6810
|
}
|
|
6723
|
-
|
|
6724
6811
|
return shadowMode;
|
|
6725
6812
|
}
|
|
6726
6813
|
function assertIsVM(obj) {
|
|
@@ -6826,10 +6913,8 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6826
6913
|
throw error; // eslint-disable-line no-unsafe-finally
|
|
6827
6914
|
}
|
|
6828
6915
|
}
|
|
6829
|
-
|
|
6830
6916
|
logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
|
|
6831
6917
|
}
|
|
6832
|
-
|
|
6833
6918
|
function runConnectedCallback(vm) {
|
|
6834
6919
|
const {
|
|
6835
6920
|
state
|
|
@@ -6837,7 +6922,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6837
6922
|
if (state === 1 /* VMState.connected */) {
|
|
6838
6923
|
return; // nothing to do since it was already connected
|
|
6839
6924
|
}
|
|
6840
|
-
|
|
6841
6925
|
vm.state = 1 /* VMState.connected */;
|
|
6842
6926
|
if (hasWireAdapters(vm)) {
|
|
6843
6927
|
connectWireAdapters(vm);
|
|
@@ -6852,7 +6936,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
6852
6936
|
}
|
|
6853
6937
|
// This test only makes sense in the browser, with synthetic lifecycle, and when reporting is enabled or
|
|
6854
6938
|
// we're in dev mode. This is to detect a particular issue with synthetic lifecycle.
|
|
6855
|
-
if (!
|
|
6939
|
+
if (!shouldUseNativeCustomElementLifecycle(vm.component.constructor) && (process.env.NODE_ENV !== 'production' || isReportingEnabled())) {
|
|
6856
6940
|
if (!vm.renderer.isConnected(vm.elm)) {
|
|
6857
6941
|
if (process.env.NODE_ENV !== 'production') {
|
|
6858
6942
|
logWarnOnce(`Element <${vm.tagName}> ` + `fired a \`connectedCallback\` and rendered, but was not connected to the DOM. ` + `Please ensure all components are actually connected to the DOM, e.g. using ` + `\`document.body.appendChild(element)\`. This will not be supported in future versions of ` + `LWC and could cause component errors. For details, see: https://sfdc.co/synthetic-lifecycle`);
|
|
@@ -7021,7 +7105,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
7021
7105
|
if (isUndefined$1(errorBoundaryVm)) {
|
|
7022
7106
|
throw error; // eslint-disable-line no-unsafe-finally
|
|
7023
7107
|
}
|
|
7024
|
-
|
|
7025
7108
|
resetComponentRoot(vm); // remove offenders
|
|
7026
7109
|
logOperationStart(6 /* OperationId.ErrorCallback */, vm);
|
|
7027
7110
|
// error boundaries must have an ErrorCallback
|
|
@@ -7203,7 +7286,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
7203
7286
|
if (enabled) {
|
|
7204
7287
|
return; // don't double-apply the patches
|
|
7205
7288
|
}
|
|
7206
|
-
|
|
7207
7289
|
enabled = true;
|
|
7208
7290
|
const {
|
|
7209
7291
|
setAttribute
|
|
@@ -7304,7 +7386,6 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
7304
7386
|
}
|
|
7305
7387
|
// If we return undefined, it's because the element was rendered wholly outside a LightningElement
|
|
7306
7388
|
}
|
|
7307
|
-
|
|
7308
7389
|
function checkAndReportViolation(elm, prop, isSetter, setValue) {
|
|
7309
7390
|
const vm = findVM(elm);
|
|
7310
7391
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -8188,7 +8269,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
8188
8269
|
}
|
|
8189
8270
|
return getReadOnlyProxy(obj);
|
|
8190
8271
|
}
|
|
8191
|
-
/** version:
|
|
8272
|
+
/** version: 6.0.0 */
|
|
8192
8273
|
|
|
8193
8274
|
/*
|
|
8194
8275
|
* Copyright (c) 2018, salesforce.com, inc.
|
|
@@ -8295,6 +8376,8 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
8295
8376
|
const elm = document.createElement('style');
|
|
8296
8377
|
elm.type = 'text/css';
|
|
8297
8378
|
elm.textContent = content;
|
|
8379
|
+
// Add an attribute to distinguish global styles added by LWC as opposed to other frameworks/libraries on the page
|
|
8380
|
+
elm.setAttribute('data-rendered-by-lwc', '');
|
|
8298
8381
|
return elm;
|
|
8299
8382
|
}
|
|
8300
8383
|
function createStyleElement(content, cacheData) {
|
|
@@ -8401,123 +8484,74 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
8401
8484
|
* SPDX-License-Identifier: MIT
|
|
8402
8485
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
8403
8486
|
*/
|
|
8487
|
+
const LIFECYCLE_CALLBACKS = {
|
|
8488
|
+
connectedCallback: connectRootElement,
|
|
8489
|
+
disconnectedCallback: disconnectRootElement,
|
|
8490
|
+
formAssociatedCallback: runFormAssociatedCallback,
|
|
8491
|
+
formDisabledCallback: runFormDisabledCallback,
|
|
8492
|
+
formResetCallback: runFormResetCallback,
|
|
8493
|
+
formStateRestoreCallback: runFormStateRestoreCallback
|
|
8494
|
+
};
|
|
8404
8495
|
const cachedConstructors = new Map();
|
|
8405
|
-
const
|
|
8496
|
+
const nativeLifecycleElementsToUpgradedByLWC = new WeakMap();
|
|
8406
8497
|
let elementBeingUpgradedByLWC = false;
|
|
8407
|
-
let formAssociatedCallbackToUse;
|
|
8408
|
-
let formDisabledCallbackToUse;
|
|
8409
|
-
let formResetCallbackToUse;
|
|
8410
|
-
let formStateRestoreCallbackToUse;
|
|
8411
|
-
const instancesToFormAssociatedCallbacks = new WeakMap();
|
|
8412
|
-
const instancesToFormDisabledCallbacks = new WeakMap();
|
|
8413
|
-
const instancesToFormResetCallbacks = new WeakMap();
|
|
8414
|
-
const instancesToFormStateRestoreCallbacks = new WeakMap();
|
|
8415
8498
|
// Creates a constructor that is intended to be used directly as a custom element, except that the upgradeCallback is
|
|
8416
8499
|
// passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
|
|
8417
8500
|
// Another benefit is that only LWC can create components that actually do anything – if you do
|
|
8418
8501
|
// `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
|
|
8419
8502
|
// This class should be created once per tag name.
|
|
8420
|
-
const createUpgradableConstructor = (
|
|
8421
|
-
const hasConnectedCallback = !isUndefined$1(connectedCallback);
|
|
8422
|
-
const hasDisconnectedCallback = !isUndefined$1(disconnectedCallback);
|
|
8503
|
+
const createUpgradableConstructor = () => {
|
|
8423
8504
|
// TODO [#2972]: this class should expose observedAttributes as necessary
|
|
8424
8505
|
class UpgradableConstructor extends HTMLElement {
|
|
8425
|
-
constructor(upgradeCallback) {
|
|
8506
|
+
constructor(upgradeCallback, useNativeLifecycle) {
|
|
8426
8507
|
super();
|
|
8508
|
+
if (useNativeLifecycle) {
|
|
8509
|
+
// When in native lifecycle mode, we need to keep track of instances that were created outside LWC
|
|
8510
|
+
// (i.e. not created by `lwc.createElement()`). If the element uses synthetic lifecycle, then we don't
|
|
8511
|
+
// need to track this.
|
|
8512
|
+
nativeLifecycleElementsToUpgradedByLWC.set(this, elementBeingUpgradedByLWC);
|
|
8513
|
+
}
|
|
8427
8514
|
// If the element is not created using lwc.createElement(), e.g. `document.createElement('x-foo')`,
|
|
8428
|
-
// then
|
|
8515
|
+
// then elementBeingUpgradedByLWC will be false
|
|
8429
8516
|
if (elementBeingUpgradedByLWC) {
|
|
8430
|
-
instancesToFormAssociatedCallbacks.set(this, formAssociatedCallbackToUse);
|
|
8431
|
-
instancesToFormDisabledCallbacks.set(this, formDisabledCallbackToUse);
|
|
8432
|
-
instancesToFormResetCallbacks.set(this, formResetCallbackToUse);
|
|
8433
|
-
instancesToFormStateRestoreCallbacks.set(this, formStateRestoreCallbackToUse);
|
|
8434
8517
|
upgradeCallback(this);
|
|
8435
|
-
} else if (hasConnectedCallback || hasDisconnectedCallback) {
|
|
8436
|
-
// If this element has connected or disconnected callbacks, then we need to keep track of
|
|
8437
|
-
// instances that were created outside LWC (i.e. not created by `lwc.createElement()`).
|
|
8438
|
-
// If the element has no connected or disconnected callbacks, then we don't need to track this.
|
|
8439
|
-
elementsUpgradedOutsideLWC.add(this);
|
|
8440
|
-
// TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
|
|
8441
|
-
// Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
|
|
8442
8518
|
}
|
|
8519
|
+
// TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
|
|
8520
|
+
// Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
|
|
8443
8521
|
}
|
|
8444
|
-
|
|
8445
|
-
formAssociatedCallback() {
|
|
8446
|
-
const formAssociatedCallback = instancesToFormAssociatedCallbacks.get(this);
|
|
8447
|
-
// if element was upgraded outside LWC, this will be undefined
|
|
8448
|
-
if (!isUndefined$1(formAssociatedCallback)) {
|
|
8449
|
-
formAssociatedCallback(this);
|
|
8450
|
-
}
|
|
8451
|
-
}
|
|
8452
|
-
formResetCallback() {
|
|
8453
|
-
const formResetCallback = instancesToFormResetCallbacks.get(this);
|
|
8454
|
-
// if element was upgraded outside LWC, this will be undefined
|
|
8455
|
-
if (!isUndefined$1(formResetCallback)) {
|
|
8456
|
-
formResetCallback(this);
|
|
8457
|
-
}
|
|
8458
|
-
}
|
|
8459
|
-
formDisabledCallback() {
|
|
8460
|
-
const formDisabledCallback = instancesToFormDisabledCallbacks.get(this);
|
|
8461
|
-
// if element was upgraded outside LWC, this will be undefined
|
|
8462
|
-
if (!isUndefined$1(formDisabledCallback)) {
|
|
8463
|
-
formDisabledCallback(this);
|
|
8464
|
-
}
|
|
8465
|
-
}
|
|
8466
|
-
formStateRestoreCallback() {
|
|
8467
|
-
const formStateRestoreCallback = instancesToFormStateRestoreCallbacks.get(this);
|
|
8468
|
-
// if element was upgraded outside LWC, this will be undefined
|
|
8469
|
-
if (!isUndefined$1(formStateRestoreCallback)) {
|
|
8470
|
-
formStateRestoreCallback(this);
|
|
8471
|
-
}
|
|
8472
|
-
}
|
|
8473
|
-
/*LWC compiler v5.0.2*/
|
|
8522
|
+
/*LWC compiler v6.0.0*/
|
|
8474
8523
|
}
|
|
8475
8524
|
UpgradableConstructor.formAssociated = true;
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
if (
|
|
8481
|
-
|
|
8482
|
-
}
|
|
8483
|
-
};
|
|
8484
|
-
}
|
|
8485
|
-
if (hasDisconnectedCallback) {
|
|
8486
|
-
UpgradableConstructor.prototype.disconnectedCallback = function () {
|
|
8487
|
-
if (!elementsUpgradedOutsideLWC.has(this)) {
|
|
8488
|
-
disconnectedCallback(this);
|
|
8525
|
+
for (const [propName, callback] of entries(LIFECYCLE_CALLBACKS)) {
|
|
8526
|
+
UpgradableConstructor.prototype[propName] = function () {
|
|
8527
|
+
// If the element is in the WeakMap (i.e. it's marked as native lifecycle), and if it was upgraded by LWC,
|
|
8528
|
+
// then it can use native lifecycle
|
|
8529
|
+
if (isTrue(nativeLifecycleElementsToUpgradedByLWC.get(this))) {
|
|
8530
|
+
callback(this);
|
|
8489
8531
|
}
|
|
8490
8532
|
};
|
|
8491
8533
|
}
|
|
8492
8534
|
return UpgradableConstructor;
|
|
8493
8535
|
};
|
|
8494
|
-
function getUpgradableConstructor(tagName
|
|
8536
|
+
function getUpgradableConstructor(tagName) {
|
|
8495
8537
|
let UpgradableConstructor = cachedConstructors.get(tagName);
|
|
8496
8538
|
if (isUndefined$1(UpgradableConstructor)) {
|
|
8497
8539
|
if (!isUndefined$1(customElements.get(tagName))) {
|
|
8498
8540
|
throw new Error(`Unexpected tag name "${tagName}". This name is a registered custom element, preventing LWC to upgrade the element.`);
|
|
8499
8541
|
}
|
|
8500
|
-
UpgradableConstructor = createUpgradableConstructor(
|
|
8542
|
+
UpgradableConstructor = createUpgradableConstructor();
|
|
8501
8543
|
customElements.define(tagName, UpgradableConstructor);
|
|
8502
8544
|
cachedConstructors.set(tagName, UpgradableConstructor);
|
|
8503
8545
|
}
|
|
8504
8546
|
return UpgradableConstructor;
|
|
8505
8547
|
}
|
|
8506
|
-
const createCustomElement = (tagName, upgradeCallback,
|
|
8507
|
-
const UpgradableConstructor = getUpgradableConstructor(tagName
|
|
8508
|
-
formAssociatedCallbackToUse = formAssociatedCallback;
|
|
8509
|
-
formDisabledCallbackToUse = formDisabledCallback;
|
|
8510
|
-
formResetCallbackToUse = formResetCallback;
|
|
8511
|
-
formStateRestoreCallbackToUse = formStateRestoreCallback;
|
|
8548
|
+
const createCustomElement = (tagName, upgradeCallback, useNativeLifecycle) => {
|
|
8549
|
+
const UpgradableConstructor = getUpgradableConstructor(tagName);
|
|
8512
8550
|
elementBeingUpgradedByLWC = true;
|
|
8513
8551
|
try {
|
|
8514
|
-
return new UpgradableConstructor(upgradeCallback);
|
|
8552
|
+
return new UpgradableConstructor(upgradeCallback, useNativeLifecycle);
|
|
8515
8553
|
} finally {
|
|
8516
8554
|
elementBeingUpgradedByLWC = false;
|
|
8517
|
-
formAssociatedCallbackToUse = undefined;
|
|
8518
|
-
formDisabledCallbackToUse = undefined;
|
|
8519
|
-
formResetCallbackToUse = undefined;
|
|
8520
|
-
formStateRestoreCallbackToUse = undefined;
|
|
8521
8555
|
}
|
|
8522
8556
|
};
|
|
8523
8557
|
|
|
@@ -8579,7 +8613,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
8579
8613
|
function isNull(obj) {
|
|
8580
8614
|
return obj === null;
|
|
8581
8615
|
}
|
|
8582
|
-
/** version:
|
|
8616
|
+
/** version: 6.0.0 */
|
|
8583
8617
|
|
|
8584
8618
|
/*
|
|
8585
8619
|
* Copyright (c) 2023, salesforce.com, inc.
|
|
@@ -8599,7 +8633,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
8599
8633
|
this.setNewContext = setNewContext;
|
|
8600
8634
|
this.setDisconnectedCallback = setDisconnectedCallback;
|
|
8601
8635
|
}
|
|
8602
|
-
/*LWC compiler
|
|
8636
|
+
/*LWC compiler v6.0.0*/
|
|
8603
8637
|
}
|
|
8604
8638
|
function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
|
|
8605
8639
|
dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
|
|
@@ -8979,7 +9013,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
8979
9013
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
8980
9014
|
attributeChangedCallback.call(this, name, oldValue, newValue);
|
|
8981
9015
|
}
|
|
8982
|
-
/*LWC compiler
|
|
9016
|
+
/*LWC compiler v6.0.0*/
|
|
8983
9017
|
}, _a.observedAttributes = observedAttributes, _a;
|
|
8984
9018
|
}
|
|
8985
9019
|
|
|
@@ -9004,8 +9038,13 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
9004
9038
|
}
|
|
9005
9039
|
return node; // for convenience
|
|
9006
9040
|
}
|
|
9007
|
-
|
|
9008
|
-
|
|
9041
|
+
let monkeyPatched = false;
|
|
9042
|
+
function monkeyPatchDomAPIs() {
|
|
9043
|
+
if (monkeyPatched) {
|
|
9044
|
+
// don't double-patch
|
|
9045
|
+
return;
|
|
9046
|
+
}
|
|
9047
|
+
monkeyPatched = true;
|
|
9009
9048
|
// Monkey patching Node methods to be able to detect the insertions and removal of root elements
|
|
9010
9049
|
// created via createElement.
|
|
9011
9050
|
const {
|
|
@@ -9061,6 +9100,10 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
9061
9100
|
// passing `sel` as a camel-case, which makes them invalid custom elements name
|
|
9062
9101
|
// the following line guarantees that this does not leaks beyond this point.
|
|
9063
9102
|
const tagName = StringToLowerCase.call(sel);
|
|
9103
|
+
const apiVersion = getComponentAPIVersion(Ctor);
|
|
9104
|
+
const useNativeCustomElementLifecycle =
|
|
9105
|
+
// temporary "kill switch"
|
|
9106
|
+
!lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE && isAPIFeatureEnabled(7 /* APIFeature.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE */, apiVersion);
|
|
9064
9107
|
// the custom element from the registry is expecting an upgrade callback
|
|
9065
9108
|
/**
|
|
9066
9109
|
* Note: if the upgradable constructor does not expect, or throw when we new it
|
|
@@ -9074,39 +9117,15 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
9074
9117
|
mode: options.mode !== 'closed' ? 'open' : 'closed',
|
|
9075
9118
|
owner: null
|
|
9076
9119
|
});
|
|
9077
|
-
if (!
|
|
9120
|
+
if (!useNativeCustomElementLifecycle) {
|
|
9121
|
+
// Monkey-patch on-demand, because if there are no components on the page using an old API
|
|
9122
|
+
// version, then we don't want to monkey patch at all
|
|
9123
|
+
monkeyPatchDomAPIs();
|
|
9078
9124
|
ConnectingSlot.set(elm, connectRootElement);
|
|
9079
9125
|
DisconnectingSlot.set(elm, disconnectRootElement);
|
|
9080
9126
|
}
|
|
9081
9127
|
};
|
|
9082
|
-
|
|
9083
|
-
let disconnectedCallback;
|
|
9084
|
-
let formAssociatedCallback;
|
|
9085
|
-
let formDisabledCallback;
|
|
9086
|
-
let formResetCallback;
|
|
9087
|
-
let formStateRestoreCallback;
|
|
9088
|
-
if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
|
|
9089
|
-
connectedCallback = elm => {
|
|
9090
|
-
connectRootElement(elm);
|
|
9091
|
-
};
|
|
9092
|
-
disconnectedCallback = elm => {
|
|
9093
|
-
disconnectRootElement(elm);
|
|
9094
|
-
};
|
|
9095
|
-
formAssociatedCallback = elm => {
|
|
9096
|
-
runFormAssociatedCallback(elm);
|
|
9097
|
-
};
|
|
9098
|
-
formDisabledCallback = elm => {
|
|
9099
|
-
runFormDisabledCallback(elm);
|
|
9100
|
-
};
|
|
9101
|
-
formResetCallback = elm => {
|
|
9102
|
-
runFormResetCallback(elm);
|
|
9103
|
-
};
|
|
9104
|
-
formStateRestoreCallback = elm => {
|
|
9105
|
-
runFormStateRestoreCallback(elm);
|
|
9106
|
-
};
|
|
9107
|
-
}
|
|
9108
|
-
const element = createCustomElement(tagName, upgradeCallback, connectedCallback, disconnectedCallback, formAssociatedCallback, formDisabledCallback, formResetCallback, formStateRestoreCallback);
|
|
9109
|
-
return element;
|
|
9128
|
+
return createCustomElement(tagName, upgradeCallback, useNativeCustomElementLifecycle);
|
|
9110
9129
|
}
|
|
9111
9130
|
|
|
9112
9131
|
/*
|
|
@@ -9209,7 +9228,7 @@ LWR.define('lwc/v/5_0_2', ['exports'], (function (exports) { 'use strict';
|
|
|
9209
9228
|
});
|
|
9210
9229
|
});
|
|
9211
9230
|
}
|
|
9212
|
-
/** version:
|
|
9231
|
+
/** version: 6.0.0 */
|
|
9213
9232
|
|
|
9214
9233
|
exports.LightningElement = LightningElement;
|
|
9215
9234
|
exports.__unstable__ProfilerControl = profilerControl;
|