@lwrjs/everywhere 0.13.0-alpha.0 → 0.13.0-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/06bb09054e5c6120da9cf13b2ec7653a/config.js +12 -0
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_13_0-alpha_1/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/{6_3_4/s/5c26ade60a97bb24c64d3829320b13f6 → 6_5_2/s/b04b0848c889e153c4119373afa73a21}/lwc.js +400 -160
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_13_0-alpha_0 → 0_13_0-alpha_1}/s/cb931ebef2b89dcf8ab51456e3a68864/lwr_everywhereAmd.js +3 -3
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_13_0-alpha_0 → 0_13_0-alpha_1}/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_13_0-alpha_0/s/589732f011b79219a57c1f4a08038efe → 0_13_0-alpha_1/s/db873ff051952f601e5b94afcd12a640}/lwr_loader.js +4 -4
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_13_0-alpha_0 → 0_13_0-alpha_1}/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_13_0-alpha_0 → 0_13_0-alpha_1}/s/ec0fad0e38a96bb0b88c9f4553460347/lwr_preInit.js +1 -1
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_13_0-alpha_0 → 0_13_0-alpha_1}/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_13_0-alpha_0 → 0_13_0-alpha_1}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_13_0-alpha_0 → 0_13_0-alpha_1}/lwr-error-shim.js +1 -1
- package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_13_0-alpha_0 → 0_13_0-alpha_1}/lwr-loader-shim.bundle.js +7 -7
- package/build/assets/amd/lwr-everywhere-debug.js +9 -9
- package/build/assets/amd/lwr-everywhere-min.js +2 -2
- package/build/assets/amd/lwr-everywhere.js +9 -9
- package/build/assets/core/lwr-everywhere-debug.js +5 -5
- package/build/assets/core/lwr-everywhere-min.js +1 -1
- package/build/assets/core/lwr-everywhere.js +5 -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 +9 -9
- package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/063276514e896851bb9af991a41a6bd4/config.js +0 -12
- package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_13_0-alpha_0/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_5_2', ['exports'], (function (exports) { 'use strict';
|
2
2
|
|
3
3
|
/**
|
4
4
|
* Copyright (c) 2024 Salesforce, Inc.
|
@@ -148,6 +148,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
148
148
|
} = String;
|
149
149
|
// No JSDocs here - see comment for Array.prototype
|
150
150
|
const {
|
151
|
+
charAt: StringCharAt,
|
151
152
|
charCodeAt: StringCharCodeAt,
|
152
153
|
replace: StringReplace,
|
153
154
|
split: StringSplit,
|
@@ -291,7 +292,8 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
291
292
|
// These must be updated when the enum is updated.
|
292
293
|
// It's a bit annoying to do have to do this manually, but this makes the file tree-shakeable,
|
293
294
|
// passing the `verify-treeshakeable.js` test.
|
294
|
-
const
|
295
|
+
const allVersions = [58 /* APIVersion.V58_244_SUMMER_23 */, 59 /* APIVersion.V59_246_WINTER_24 */, 60 /* APIVersion.V60_248_SPRING_24 */, 61 /* APIVersion.V61_250_SUMMER_24 */, 62 /* APIVersion.V62_252_WINTER_25 */];
|
296
|
+
const LOWEST_API_VERSION = allVersions[0];
|
295
297
|
/**
|
296
298
|
*
|
297
299
|
* @param apiVersionFeature
|
@@ -440,9 +442,9 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
440
442
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
441
443
|
*/
|
442
444
|
// Increment whenever the LWC template compiler changes
|
443
|
-
const LWC_VERSION = "6.
|
445
|
+
const LWC_VERSION = "6.5.2";
|
444
446
|
const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
|
445
|
-
/** version: 6.
|
447
|
+
/** version: 6.5.2 */
|
446
448
|
|
447
449
|
/**
|
448
450
|
* Copyright (c) 2024 Salesforce, Inc.
|
@@ -528,7 +530,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
528
530
|
setFeatureFlag(name, value);
|
529
531
|
}
|
530
532
|
}
|
531
|
-
/** version: 6.
|
533
|
+
/** version: 6.5.2 */
|
532
534
|
|
533
535
|
/**
|
534
536
|
* Copyright (c) 2024 Salesforce, Inc.
|
@@ -783,15 +785,17 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
783
785
|
if (len > 0) {
|
784
786
|
for (let i = 0; i < len; i++) {
|
785
787
|
const set = listeners[i];
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
//
|
792
|
-
const
|
793
|
-
|
788
|
+
const setLength = set.length;
|
789
|
+
// The length is usually 1, so avoid doing an indexOf when we know for certain
|
790
|
+
// that `this` is the first item in the array.
|
791
|
+
if (setLength > 1) {
|
792
|
+
// Swap with the last item before removal.
|
793
|
+
// (Avoiding splice here is a perf optimization, and the order doesn't matter.)
|
794
|
+
const index = ArrayIndexOf.call(set, this);
|
795
|
+
set[index] = set[setLength - 1];
|
794
796
|
}
|
797
|
+
// Remove the last item
|
798
|
+
ArrayPop.call(set);
|
795
799
|
}
|
796
800
|
listeners.length = 0;
|
797
801
|
}
|
@@ -1718,7 +1722,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
1718
1722
|
valueMutated(originalTarget, key);
|
1719
1723
|
return true;
|
1720
1724
|
}
|
1721
|
-
/*LWC compiler v6.
|
1725
|
+
/*LWC compiler v6.5.2*/
|
1722
1726
|
}
|
1723
1727
|
const getterMap = new WeakMap();
|
1724
1728
|
const setterMap = new WeakMap();
|
@@ -1811,7 +1815,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
1811
1815
|
/* istanbul ignore next */
|
1812
1816
|
return false;
|
1813
1817
|
}
|
1814
|
-
/*LWC compiler v6.
|
1818
|
+
/*LWC compiler v6.5.2*/
|
1815
1819
|
}
|
1816
1820
|
function extract(objectOrArray) {
|
1817
1821
|
if (isArray(objectOrArray)) {
|
@@ -2739,7 +2743,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
2739
2743
|
}
|
2740
2744
|
|
2741
2745
|
/*
|
2742
|
-
* Copyright (c)
|
2746
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
2743
2747
|
* All rights reserved.
|
2744
2748
|
* SPDX-License-Identifier: MIT
|
2745
2749
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -3428,7 +3432,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
3428
3432
|
}
|
3429
3433
|
|
3430
3434
|
/*
|
3431
|
-
* Copyright (c)
|
3435
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
3432
3436
|
* All rights reserved.
|
3433
3437
|
* SPDX-License-Identifier: MIT
|
3434
3438
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -3518,7 +3522,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
3518
3522
|
}
|
3519
3523
|
function HTMLBridgeElementFactory(SuperClass, publicProperties, methods, observedFields, proto, hasCustomSuperClass) {
|
3520
3524
|
const HTMLBridgeElement = class extends SuperClass {
|
3521
|
-
/*LWC compiler v6.
|
3525
|
+
/*LWC compiler v6.5.2*/
|
3522
3526
|
};
|
3523
3527
|
// generating the hash table for attributes to avoid duplicate fields and facilitate validation
|
3524
3528
|
// and false positives in case of inheritance.
|
@@ -4384,7 +4388,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4384
4388
|
}
|
4385
4389
|
|
4386
4390
|
/*
|
4387
|
-
* Copyright (c)
|
4391
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
4388
4392
|
* All rights reserved.
|
4389
4393
|
* SPDX-License-Identifier: MIT
|
4390
4394
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -4410,6 +4414,12 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4410
4414
|
function isVStatic(vnode) {
|
4411
4415
|
return vnode.type === 4 /* VNodeType.Static */;
|
4412
4416
|
}
|
4417
|
+
function isVStaticPartElement(vnode) {
|
4418
|
+
return vnode.type === 1 /* VStaticPartType.Element */;
|
4419
|
+
}
|
4420
|
+
function isVStaticPartText(vnode) {
|
4421
|
+
return vnode.type === 0 /* VStaticPartType.Text */;
|
4422
|
+
}
|
4413
4423
|
|
4414
4424
|
/*
|
4415
4425
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -4420,9 +4430,12 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4420
4430
|
const ColonCharCode = 58;
|
4421
4431
|
function patchAttributes(oldVnode, vnode, renderer) {
|
4422
4432
|
const {
|
4423
|
-
|
4424
|
-
|
4425
|
-
} = vnode
|
4433
|
+
data,
|
4434
|
+
elm
|
4435
|
+
} = vnode;
|
4436
|
+
const {
|
4437
|
+
attrs
|
4438
|
+
} = data;
|
4426
4439
|
if (isUndefined$1(attrs)) {
|
4427
4440
|
return;
|
4428
4441
|
}
|
@@ -4431,9 +4444,8 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4431
4444
|
if (oldAttrs === attrs) {
|
4432
4445
|
return;
|
4433
4446
|
}
|
4434
|
-
|
4435
|
-
|
4436
|
-
} = vnode;
|
4447
|
+
// Note VStaticPartData does not contain the external property so it will always default to false.
|
4448
|
+
const external = 'external' in data ? data.external : false;
|
4437
4449
|
const {
|
4438
4450
|
setAttribute,
|
4439
4451
|
removeAttribute,
|
@@ -4549,8 +4561,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4549
4561
|
*/
|
4550
4562
|
const classNameToClassMap = create(null);
|
4551
4563
|
function getMapFromClassName(className) {
|
4552
|
-
|
4553
|
-
if (className == null) {
|
4564
|
+
if (isUndefined$1(className) || isNull(className) || className === '') {
|
4554
4565
|
return EmptyObject;
|
4555
4566
|
}
|
4556
4567
|
// computed class names must be string
|
@@ -4594,12 +4605,18 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4594
4605
|
if (oldClass === newClass) {
|
4595
4606
|
return;
|
4596
4607
|
}
|
4608
|
+
const newClassMap = getMapFromClassName(newClass);
|
4609
|
+
const oldClassMap = getMapFromClassName(oldClass);
|
4610
|
+
if (oldClassMap === newClassMap) {
|
4611
|
+
// These objects are cached by className string (`classNameToClassMap`), so we can only get here if there is
|
4612
|
+
// a key collision due to types, e.g. oldClass is `undefined` and newClass is `""` (empty string), or oldClass
|
4613
|
+
// is `1` (number) and newClass is `"1"` (string).
|
4614
|
+
return;
|
4615
|
+
}
|
4597
4616
|
const {
|
4598
4617
|
getClassList
|
4599
4618
|
} = renderer;
|
4600
4619
|
const classList = getClassList(elm);
|
4601
|
-
const newClassMap = getMapFromClassName(newClass);
|
4602
|
-
const oldClassMap = getMapFromClassName(oldClass);
|
4603
4620
|
let name;
|
4604
4621
|
for (name in oldClassMap) {
|
4605
4622
|
// remove only if it is not in the new class collection and it is not set from within the instance
|
@@ -4621,13 +4638,18 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4621
4638
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
4622
4639
|
*/
|
4623
4640
|
// The style property is a string when defined via an expression in the template.
|
4624
|
-
function patchStyleAttribute(oldVnode, vnode, renderer) {
|
4641
|
+
function patchStyleAttribute(oldVnode, vnode, renderer, owner) {
|
4625
4642
|
const {
|
4626
4643
|
elm,
|
4627
4644
|
data: {
|
4628
4645
|
style: newStyle
|
4629
4646
|
}
|
4630
4647
|
} = vnode;
|
4648
|
+
if (process.env.NODE_ENV !== 'production') {
|
4649
|
+
if (!isNull(newStyle) && !isUndefined$1(newStyle) && !isString(newStyle)) {
|
4650
|
+
logError(`Invalid 'style' attribute passed to <${elm.tagName.toLowerCase()}> is ignored. This attribute must be a string value.`, owner);
|
4651
|
+
}
|
4652
|
+
}
|
4631
4653
|
const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;
|
4632
4654
|
if (oldStyle === newStyle) {
|
4633
4655
|
return;
|
@@ -4651,9 +4673,12 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4651
4673
|
*/
|
4652
4674
|
function applyEventListeners(vnode, renderer) {
|
4653
4675
|
const {
|
4654
|
-
elm
|
4676
|
+
elm,
|
4677
|
+
data
|
4655
4678
|
} = vnode;
|
4656
|
-
const
|
4679
|
+
const {
|
4680
|
+
on
|
4681
|
+
} = data;
|
4657
4682
|
if (isUndefined$1(on)) {
|
4658
4683
|
return;
|
4659
4684
|
}
|
@@ -4750,12 +4775,52 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4750
4775
|
refVNodes[ref] = vnode;
|
4751
4776
|
}
|
4752
4777
|
|
4778
|
+
/*
|
4779
|
+
* Copyright (c) 2024, salesforce.com, inc.
|
4780
|
+
* All rights reserved.
|
4781
|
+
* SPDX-License-Identifier: MIT
|
4782
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
4783
|
+
*/
|
4784
|
+
function patchTextVNode(n1, n2, renderer) {
|
4785
|
+
n2.elm = n1.elm;
|
4786
|
+
if (n2.text !== n1.text) {
|
4787
|
+
updateTextContent$1(n2, renderer);
|
4788
|
+
}
|
4789
|
+
}
|
4790
|
+
function patchTextVStaticPart(n1, n2, renderer) {
|
4791
|
+
if (isNull(n1) || n2.text !== n1.text) {
|
4792
|
+
updateTextContent$1(n2, renderer);
|
4793
|
+
}
|
4794
|
+
}
|
4795
|
+
function updateTextContent$1(vnode, renderer) {
|
4796
|
+
const {
|
4797
|
+
elm,
|
4798
|
+
text
|
4799
|
+
} = vnode;
|
4800
|
+
const {
|
4801
|
+
setText
|
4802
|
+
} = renderer;
|
4803
|
+
if (process.env.NODE_ENV !== 'production') {
|
4804
|
+
unlockDomMutation();
|
4805
|
+
}
|
4806
|
+
setText(elm, text);
|
4807
|
+
if (process.env.NODE_ENV !== 'production') {
|
4808
|
+
lockDomMutation();
|
4809
|
+
}
|
4810
|
+
}
|
4811
|
+
|
4753
4812
|
/*
|
4754
4813
|
* Copyright (c) 2023, salesforce.com, inc.
|
4755
4814
|
* All rights reserved.
|
4756
4815
|
* SPDX-License-Identifier: MIT
|
4757
4816
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
4758
4817
|
*/
|
4818
|
+
/**
|
4819
|
+
* Given an array of static parts, mounts the DOM element to the part based on the staticPartId
|
4820
|
+
* @param root the root element
|
4821
|
+
* @param parts an array of VStaticParts
|
4822
|
+
* @param renderer the renderer to use
|
4823
|
+
*/
|
4759
4824
|
function traverseAndSetElements(root, parts, renderer) {
|
4760
4825
|
const numParts = parts.length;
|
4761
4826
|
// Optimization given that, in most cases, there will be one part, and it's just the root
|
@@ -4822,18 +4887,29 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4822
4887
|
traverseAndSetElements(root, parts, renderer);
|
4823
4888
|
// Currently only event listeners and refs are supported for static vnodes
|
4824
4889
|
for (const part of parts) {
|
4825
|
-
|
4826
|
-
|
4827
|
-
|
4828
|
-
|
4890
|
+
if (isVStaticPartElement(part)) {
|
4891
|
+
// Event listeners only need to be applied once when mounting
|
4892
|
+
applyEventListeners(part, renderer);
|
4893
|
+
// Refs must be updated after every render due to refVNodes getting reset before every render
|
4894
|
+
applyRefs(part, owner);
|
4895
|
+
patchAttributes(null, part, renderer);
|
4896
|
+
patchClassAttribute(null, part, renderer);
|
4897
|
+
patchStyleAttribute(null, part, renderer, owner);
|
4898
|
+
} else {
|
4899
|
+
if (process.env.NODE_ENV !== 'production' && !isVStaticPartText(part)) {
|
4900
|
+
throw new Error(`LWC internal error, encountered unknown static part type: ${part.type}`);
|
4901
|
+
}
|
4902
|
+
patchTextVStaticPart(null, part, renderer);
|
4903
|
+
}
|
4829
4904
|
}
|
4830
4905
|
}
|
4831
4906
|
/**
|
4832
|
-
*
|
4907
|
+
* Updates the static elements based on the content of the VStaticParts
|
4833
4908
|
* @param n1 the previous VStatic vnode
|
4834
4909
|
* @param n2 the current VStatic vnode
|
4910
|
+
* @param renderer the renderer to use
|
4835
4911
|
*/
|
4836
|
-
function patchStaticParts(n1, n2) {
|
4912
|
+
function patchStaticParts(n1, n2, renderer) {
|
4837
4913
|
const {
|
4838
4914
|
parts: currParts,
|
4839
4915
|
owner: currPartsOwner
|
@@ -4848,17 +4924,53 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4848
4924
|
assert.isTrue(currParts.length === prevParts?.length, 'Expected static parts to be the same for the same element. This is an error with the LWC framework itself.');
|
4849
4925
|
}
|
4850
4926
|
for (let i = 0; i < currParts.length; i++) {
|
4927
|
+
const prevPart = prevParts[i];
|
4851
4928
|
const part = currParts[i];
|
4852
4929
|
// Patch only occurs if the vnode is newly generated, which means the part.elm is always undefined
|
4853
4930
|
// Since the vnode and elements are the same we can safely assume that prevParts[i].elm is defined.
|
4854
|
-
part.elm =
|
4855
|
-
|
4856
|
-
|
4931
|
+
part.elm = prevPart.elm;
|
4932
|
+
if (process.env.NODE_ENV !== 'production' && prevPart.type !== part.type) {
|
4933
|
+
throw new Error(`LWC internal error, static part types do not match. Previous type was ${prevPart.type} and current type is ${part.type}`);
|
4934
|
+
}
|
4935
|
+
if (isVStaticPartElement(part)) {
|
4936
|
+
// Refs must be updated after every render due to refVNodes getting reset before every render
|
4937
|
+
applyRefs(part, currPartsOwner);
|
4938
|
+
patchAttributes(prevPart, part, renderer);
|
4939
|
+
patchClassAttribute(prevPart, part, renderer);
|
4940
|
+
patchStyleAttribute(prevPart, part, renderer, currPartsOwner);
|
4941
|
+
} else {
|
4942
|
+
patchTextVStaticPart(null, part, renderer);
|
4943
|
+
}
|
4944
|
+
}
|
4945
|
+
}
|
4946
|
+
/**
|
4947
|
+
* Mounts the hydration specific attributes
|
4948
|
+
* @param vnode the parent VStatic node
|
4949
|
+
* @param renderer the renderer to use
|
4950
|
+
*/
|
4951
|
+
function hydrateStaticParts(vnode, renderer) {
|
4952
|
+
const {
|
4953
|
+
parts,
|
4954
|
+
owner
|
4955
|
+
} = vnode;
|
4956
|
+
if (isUndefined$1(parts)) {
|
4957
|
+
return;
|
4958
|
+
}
|
4959
|
+
// Note, hydration doesn't patch attributes because hydration validation occurs before this routine
|
4960
|
+
// which guarantees that the elements are the same.
|
4961
|
+
// We only need to apply the parts for things that cannot be done on the server.
|
4962
|
+
for (const part of parts) {
|
4963
|
+
if (isVStaticPartElement(part)) {
|
4964
|
+
// Event listeners only need to be applied once when mounting
|
4965
|
+
applyEventListeners(part, renderer);
|
4966
|
+
// Refs must be updated after every render due to refVNodes getting reset before every render
|
4967
|
+
applyRefs(part, owner);
|
4968
|
+
}
|
4857
4969
|
}
|
4858
4970
|
}
|
4859
4971
|
|
4860
4972
|
/*
|
4861
|
-
* Copyright (c)
|
4973
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
4862
4974
|
* All rights reserved.
|
4863
4975
|
* SPDX-License-Identifier: MIT
|
4864
4976
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -4893,7 +5005,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4893
5005
|
switch (n2.type) {
|
4894
5006
|
case 0 /* VNodeType.Text */:
|
4895
5007
|
// VText has no special capability, fallback to the owner's renderer
|
4896
|
-
|
5008
|
+
patchTextVNode(n1, n2, renderer);
|
4897
5009
|
break;
|
4898
5010
|
case 1 /* VNodeType.Comment */:
|
4899
5011
|
// VComment has no special capability, fallback to the owner's renderer
|
@@ -4940,12 +5052,6 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4940
5052
|
break;
|
4941
5053
|
}
|
4942
5054
|
}
|
4943
|
-
function patchText(n1, n2, renderer) {
|
4944
|
-
n2.elm = n1.elm;
|
4945
|
-
if (n2.text !== n1.text) {
|
4946
|
-
updateTextContent(n2, renderer);
|
4947
|
-
}
|
4948
|
-
}
|
4949
5055
|
function mountText(vnode, parent, anchor, renderer) {
|
4950
5056
|
const {
|
4951
5057
|
owner
|
@@ -4962,7 +5068,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
4962
5068
|
// FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
|
4963
5069
|
// it is the case today.
|
4964
5070
|
if (n2.text !== n1.text) {
|
4965
|
-
updateTextContent(n2, renderer);
|
5071
|
+
updateTextContent$1(n2, renderer);
|
4966
5072
|
}
|
4967
5073
|
}
|
4968
5074
|
function mountComment(vnode, parent, anchor, renderer) {
|
@@ -5022,7 +5128,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
5022
5128
|
// slotAssignments can only apply to the top level element, never to a static part.
|
5023
5129
|
patchSlotAssignment(n1, n2, renderer);
|
5024
5130
|
// The `refs` object is blown away in every re-render, so we always need to re-apply them
|
5025
|
-
patchStaticParts(n1, n2);
|
5131
|
+
patchStaticParts(n1, n2, renderer);
|
5026
5132
|
}
|
5027
5133
|
function patchElement(n1, n2, renderer) {
|
5028
5134
|
const elm = n2.elm = n1.elm;
|
@@ -5038,22 +5144,23 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
5038
5144
|
isSyntheticShadowDefined
|
5039
5145
|
} = renderer;
|
5040
5146
|
const elm = vnode.elm = cloneNode(vnode.fragment, true);
|
5147
|
+
// Define the root node shadow resolver
|
5041
5148
|
linkNodeToShadow(elm, owner, renderer);
|
5042
5149
|
applyElementRestrictions(elm, vnode);
|
5043
|
-
// Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
5044
5150
|
const {
|
5045
5151
|
renderMode,
|
5046
5152
|
shadowMode
|
5047
5153
|
} = owner;
|
5048
5154
|
if (isSyntheticShadowDefined) {
|
5155
|
+
// Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
|
5049
5156
|
if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
|
5050
5157
|
elm[KEY__SHADOW_STATIC] = true;
|
5051
5158
|
}
|
5052
5159
|
}
|
5053
5160
|
// slotAssignments can only apply to the top level element, never to a static part.
|
5054
5161
|
patchSlotAssignment(null, vnode, renderer);
|
5055
|
-
insertNode(elm, parent, anchor, renderer);
|
5056
5162
|
mountStaticParts(elm, vnode, renderer);
|
5163
|
+
insertNode(elm, parent, anchor, renderer);
|
5057
5164
|
}
|
5058
5165
|
function mountCustomElement(vnode, parent, anchor, renderer) {
|
5059
5166
|
const {
|
@@ -5234,22 +5341,6 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
5234
5341
|
}
|
5235
5342
|
}
|
5236
5343
|
}
|
5237
|
-
function updateTextContent(vnode, renderer) {
|
5238
|
-
const {
|
5239
|
-
elm,
|
5240
|
-
text
|
5241
|
-
} = vnode;
|
5242
|
-
const {
|
5243
|
-
setText
|
5244
|
-
} = renderer;
|
5245
|
-
if (process.env.NODE_ENV !== 'production') {
|
5246
|
-
unlockDomMutation();
|
5247
|
-
}
|
5248
|
-
setText(elm, text);
|
5249
|
-
if (process.env.NODE_ENV !== 'production') {
|
5250
|
-
lockDomMutation();
|
5251
|
-
}
|
5252
|
-
}
|
5253
5344
|
function insertFragmentOrNode(vnode, parent, anchor, renderer) {
|
5254
5345
|
if (process.env.NODE_ENV !== 'production') {
|
5255
5346
|
unlockDomMutation();
|
@@ -5293,15 +5384,18 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
5293
5384
|
applyStaticClassAttribute(vnode, renderer);
|
5294
5385
|
applyStaticStyleAttribute(vnode, renderer);
|
5295
5386
|
}
|
5387
|
+
const {
|
5388
|
+
owner
|
5389
|
+
} = vnode;
|
5296
5390
|
// Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
|
5297
5391
|
// value is set before type=radio.
|
5298
5392
|
patchClassAttribute(oldVnode, vnode, renderer);
|
5299
|
-
patchStyleAttribute(oldVnode, vnode, renderer);
|
5393
|
+
patchStyleAttribute(oldVnode, vnode, renderer, owner);
|
5300
5394
|
patchAttributes(oldVnode, vnode, renderer);
|
5301
5395
|
patchProps(oldVnode, vnode, renderer);
|
5302
5396
|
patchSlotAssignment(oldVnode, vnode, renderer);
|
5303
5397
|
// The `refs` object is blown away in every re-render, so we always need to re-apply them
|
5304
|
-
applyRefs(vnode,
|
5398
|
+
applyRefs(vnode, owner);
|
5305
5399
|
}
|
5306
5400
|
function applyStyleScoping(elm, owner, renderer) {
|
5307
5401
|
const {
|
@@ -5699,7 +5793,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
5699
5793
|
}
|
5700
5794
|
|
5701
5795
|
/*
|
5702
|
-
* Copyright (c)
|
5796
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
5703
5797
|
* All rights reserved.
|
5704
5798
|
* SPDX-License-Identifier: MIT
|
5705
5799
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -5709,10 +5803,14 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
5709
5803
|
ArrayPush$1.call(getVMBeingRendered().velements, vnode);
|
5710
5804
|
}
|
5711
5805
|
// [s]tatic [p]art
|
5712
|
-
function sp(partId, data) {
|
5806
|
+
function sp(partId, data, text) {
|
5807
|
+
// Static part will always have either text or data, it's guaranteed by the compiler.
|
5808
|
+
const type = isNull(text) ? 1 /* VStaticPartType.Element */ : 0 /* VStaticPartType.Text */;
|
5713
5809
|
return {
|
5810
|
+
type,
|
5714
5811
|
partId,
|
5715
5812
|
data,
|
5813
|
+
text,
|
5716
5814
|
elm: undefined // elm is defined later
|
5717
5815
|
};
|
5718
5816
|
}
|
@@ -5729,8 +5827,9 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
5729
5827
|
};
|
5730
5828
|
}
|
5731
5829
|
// [st]atic node
|
5732
|
-
function st(
|
5830
|
+
function st(fragmentFactory, key, parts) {
|
5733
5831
|
const owner = getVMBeingRendered();
|
5832
|
+
const fragment = fragmentFactory(parts);
|
5734
5833
|
const vnode = {
|
5735
5834
|
type: 4 /* VNodeType.Static */,
|
5736
5835
|
sel: undefined,
|
@@ -5772,9 +5871,6 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
5772
5871
|
// checking reserved internal data properties
|
5773
5872
|
assert.isFalse(data.className && data.classMap, `vnode.data.className and vnode.data.classMap ambiguous declaration.`);
|
5774
5873
|
assert.isFalse(data.styleDecls && data.style, `vnode.data.styleDecls and vnode.data.style ambiguous declaration.`);
|
5775
|
-
if (data.style && !isString(data.style)) {
|
5776
|
-
logError(`Invalid 'style' attribute passed to <${sel}> is ignored. This attribute must be a string value.`, vmBeingRendered);
|
5777
|
-
}
|
5778
5874
|
forEach.call(children, childVnode => {
|
5779
5875
|
if (childVnode != null) {
|
5780
5876
|
assert.isTrue('type' in childVnode && 'sel' in childVnode && 'elm' in childVnode && 'key' in childVnode, `${childVnode} is not a vnode.`);
|
@@ -5984,22 +6080,28 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
5984
6080
|
if (isArray$1(vnode)) {
|
5985
6081
|
ArrayPush$1.apply(list, vnode);
|
5986
6082
|
} else {
|
6083
|
+
// `isArray` doesn't narrow this block properly...
|
5987
6084
|
ArrayPush$1.call(list, vnode);
|
5988
6085
|
}
|
5989
6086
|
if (process.env.NODE_ENV !== 'production') {
|
5990
6087
|
const vnodes = isArray$1(vnode) ? vnode : [vnode];
|
5991
6088
|
forEach.call(vnodes, childVnode => {
|
5992
|
-
|
6089
|
+
// Check that the child vnode is either an element or VStatic
|
6090
|
+
if (!isNull(childVnode) && (isVBaseElement(childVnode) || isVStatic(childVnode))) {
|
5993
6091
|
const {
|
5994
6092
|
key
|
5995
6093
|
} = childVnode;
|
6094
|
+
// In @lwc/engine-server the fragment doesn't have a tagName, default to the VM's tagName.
|
6095
|
+
const {
|
6096
|
+
tagName
|
6097
|
+
} = vmBeingRendered;
|
5996
6098
|
if (isString(key) || isNumber(key)) {
|
5997
6099
|
if (keyMap[key] === 1 && isUndefined$1(iterationError)) {
|
5998
|
-
iterationError = `Duplicated "key" attribute value
|
6100
|
+
iterationError = `Duplicated "key" attribute value in "<${tagName}>" for item number ${j}. A key with value "${key}" appears more than once in the iteration. Key values must be unique numbers or strings.`;
|
5999
6101
|
}
|
6000
6102
|
keyMap[key] = 1;
|
6001
6103
|
} else if (isUndefined$1(iterationError)) {
|
6002
|
-
iterationError = `Invalid "key" attribute value in "<${
|
6104
|
+
iterationError = `Invalid "key" attribute value in "<${tagName}>" for item number ${j}. Set a unique "key" value on all iterated child elements.`;
|
6003
6105
|
}
|
6004
6106
|
}
|
6005
6107
|
});
|
@@ -6032,6 +6134,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
6032
6134
|
if (isArray$1(item)) {
|
6033
6135
|
ArrayPush$1.apply(flattened, item);
|
6034
6136
|
} else {
|
6137
|
+
// `isArray` doesn't narrow this block properly...
|
6035
6138
|
ArrayPush$1.call(flattened, item);
|
6036
6139
|
}
|
6037
6140
|
}
|
@@ -6349,7 +6452,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
6349
6452
|
}
|
6350
6453
|
|
6351
6454
|
/*
|
6352
|
-
* Copyright (c)
|
6455
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
6353
6456
|
* All rights reserved.
|
6354
6457
|
* SPDX-License-Identifier: MIT
|
6355
6458
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -6386,6 +6489,28 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
6386
6489
|
}
|
6387
6490
|
}
|
6388
6491
|
}
|
6492
|
+
const browserExpressionSerializer = (partToken, classAttrToken) => {
|
6493
|
+
// This will insert the scoped style token as a static class attribute in the fragment
|
6494
|
+
// bypassing the need to call applyStyleScoping when mounting static parts.
|
6495
|
+
const type = StringCharAt.call(partToken, 0);
|
6496
|
+
switch (type) {
|
6497
|
+
case "c" /* STATIC_PART_TOKEN_ID.CLASS */:
|
6498
|
+
return classAttrToken;
|
6499
|
+
case "t" /* STATIC_PART_TOKEN_ID.TEXT */:
|
6500
|
+
// Using a single space here gives us a single empty text node
|
6501
|
+
return ' ';
|
6502
|
+
default:
|
6503
|
+
return '';
|
6504
|
+
}
|
6505
|
+
};
|
6506
|
+
// This function serializes the expressions generated by static content optimization.
|
6507
|
+
// Currently this is only needed for SSR.
|
6508
|
+
// TODO [#4078]: Split the implementation between @lwc/engine-dom and @lwc/engine-server
|
6509
|
+
function buildSerializeExpressionFn(parts) {
|
6510
|
+
{
|
6511
|
+
return browserExpressionSerializer;
|
6512
|
+
}
|
6513
|
+
}
|
6389
6514
|
// This should be a no-op outside of LWC's Karma tests, where it's not needed
|
6390
6515
|
let registerFragmentCache = noop;
|
6391
6516
|
// Only used in LWC's Karma tests
|
@@ -6407,7 +6532,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
6407
6532
|
return (strings, ...keys) => {
|
6408
6533
|
const cache = create(null);
|
6409
6534
|
registerFragmentCache(cache);
|
6410
|
-
return function () {
|
6535
|
+
return function (parts) {
|
6411
6536
|
const {
|
6412
6537
|
context: {
|
6413
6538
|
hasScopedStyles,
|
@@ -6427,14 +6552,27 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
6427
6552
|
if (hasStyleToken && isSyntheticShadow) {
|
6428
6553
|
cacheKey |= 2 /* FragmentCache.SHADOW_MODE_SYNTHETIC */;
|
6429
6554
|
}
|
6430
|
-
|
6431
|
-
|
6555
|
+
// Cache is only here to prevent calling innerHTML multiple times which doesn't happen on the server.
|
6556
|
+
{
|
6557
|
+
// Disable this on the server to prevent cache poisoning when expressions are used.
|
6558
|
+
const cached = cache[cacheKey];
|
6559
|
+
if (!isUndefined$1(cached)) {
|
6560
|
+
return cached;
|
6561
|
+
}
|
6432
6562
|
}
|
6433
6563
|
// If legacy stylesheet tokens are required, then add them to the rendered string
|
6434
6564
|
const stylesheetTokenToRender = stylesheetToken + (hasLegacyToken ? ` ${legacyStylesheetToken}` : '');
|
6435
6565
|
const classToken = hasScopedStyles && hasStyleToken ? ' ' + stylesheetTokenToRender : '';
|
6436
6566
|
const classAttrToken = hasScopedStyles && hasStyleToken ? ` class="${stylesheetTokenToRender}"` : '';
|
6437
6567
|
const attrToken = hasStyleToken && isSyntheticShadow ? ' ' + stylesheetTokenToRender : '';
|
6568
|
+
// In the browser, we provide the entire class attribute as a perf optimization to avoid applying it on mount.
|
6569
|
+
// The remaining class expression will be applied when the static parts are mounted.
|
6570
|
+
// In SSR, the entire class attribute (expression included) is assembled along with the fragment.
|
6571
|
+
// This is why in the browser we provide the entire class attribute and in SSR we only provide the class token.
|
6572
|
+
const exprClassToken = classAttrToken;
|
6573
|
+
// TODO [#3624]: The implementation of this function should be specific to @lwc/engine-dom and @lwc/engine-server.
|
6574
|
+
// Find a way to split this in a future refactor.
|
6575
|
+
const serializeExpression = buildSerializeExpressionFn();
|
6438
6576
|
let htmlFragment = '';
|
6439
6577
|
for (let i = 0, n = keys.length; i < n; i++) {
|
6440
6578
|
switch (keys[i]) {
|
@@ -6454,6 +6592,10 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
6454
6592
|
// ${1}${2}
|
6455
6593
|
htmlFragment += strings[i] + classAttrToken + attrToken;
|
6456
6594
|
break;
|
6595
|
+
default:
|
6596
|
+
// expressions ${partId:attributeName/textId}
|
6597
|
+
htmlFragment += strings[i] + serializeExpression(keys[i], exprClassToken);
|
6598
|
+
break;
|
6457
6599
|
}
|
6458
6600
|
}
|
6459
6601
|
htmlFragment += strings[strings.length - 1];
|
@@ -7387,7 +7529,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
7387
7529
|
scheduleRehydration(vm);
|
7388
7530
|
}
|
7389
7531
|
}
|
7390
|
-
function runFormAssociatedCustomElementCallback(vm, faceCb) {
|
7532
|
+
function runFormAssociatedCustomElementCallback(vm, faceCb, args) {
|
7391
7533
|
const {
|
7392
7534
|
renderMode,
|
7393
7535
|
shadowMode
|
@@ -7395,24 +7537,24 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
7395
7537
|
if (shadowMode === 1 /* ShadowMode.Synthetic */ && renderMode !== 0 /* RenderMode.Light */) {
|
7396
7538
|
throw new Error('Form associated lifecycle methods are not available in synthetic shadow. Please use native shadow or light DOM.');
|
7397
7539
|
}
|
7398
|
-
invokeComponentCallback(vm, faceCb);
|
7540
|
+
invokeComponentCallback(vm, faceCb, args);
|
7399
7541
|
}
|
7400
|
-
function runFormAssociatedCallback(elm) {
|
7542
|
+
function runFormAssociatedCallback(elm, form) {
|
7401
7543
|
const vm = getAssociatedVM(elm);
|
7402
7544
|
const {
|
7403
7545
|
formAssociatedCallback
|
7404
7546
|
} = vm.def;
|
7405
7547
|
if (!isUndefined$1(formAssociatedCallback)) {
|
7406
|
-
runFormAssociatedCustomElementCallback(vm, formAssociatedCallback);
|
7548
|
+
runFormAssociatedCustomElementCallback(vm, formAssociatedCallback, [form]);
|
7407
7549
|
}
|
7408
7550
|
}
|
7409
|
-
function runFormDisabledCallback(elm) {
|
7551
|
+
function runFormDisabledCallback(elm, disabled) {
|
7410
7552
|
const vm = getAssociatedVM(elm);
|
7411
7553
|
const {
|
7412
7554
|
formDisabledCallback
|
7413
7555
|
} = vm.def;
|
7414
7556
|
if (!isUndefined$1(formDisabledCallback)) {
|
7415
|
-
runFormAssociatedCustomElementCallback(vm, formDisabledCallback);
|
7557
|
+
runFormAssociatedCustomElementCallback(vm, formDisabledCallback, [disabled]);
|
7416
7558
|
}
|
7417
7559
|
}
|
7418
7560
|
function runFormResetCallback(elm) {
|
@@ -7424,13 +7566,13 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
7424
7566
|
runFormAssociatedCustomElementCallback(vm, formResetCallback);
|
7425
7567
|
}
|
7426
7568
|
}
|
7427
|
-
function runFormStateRestoreCallback(elm) {
|
7569
|
+
function runFormStateRestoreCallback(elm, state, reason) {
|
7428
7570
|
const vm = getAssociatedVM(elm);
|
7429
7571
|
const {
|
7430
7572
|
formStateRestoreCallback
|
7431
7573
|
} = vm.def;
|
7432
7574
|
if (!isUndefined$1(formStateRestoreCallback)) {
|
7433
|
-
runFormAssociatedCustomElementCallback(vm, formStateRestoreCallback);
|
7575
|
+
runFormAssociatedCustomElementCallback(vm, formStateRestoreCallback, [state, reason]);
|
7434
7576
|
}
|
7435
7577
|
}
|
7436
7578
|
function resetRefVNodes(vm) {
|
@@ -7800,9 +7942,12 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
7800
7942
|
if (!hasCorrectNodeType(vnode, node, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
7801
7943
|
return handleMismatch(node, vnode, renderer);
|
7802
7944
|
}
|
7945
|
+
return updateTextContent(node, vnode, vnode.owner, renderer);
|
7946
|
+
}
|
7947
|
+
function updateTextContent(node, vnode, owner, renderer) {
|
7803
7948
|
if (process.env.NODE_ENV !== 'production') {
|
7804
7949
|
if (!textNodeContentsAreEqual(node, vnode, renderer)) {
|
7805
|
-
logWarn('Hydration mismatch: text values do not match, will recover from the difference',
|
7950
|
+
logWarn('Hydration mismatch: text values do not match, will recover from the difference', owner);
|
7806
7951
|
}
|
7807
7952
|
}
|
7808
7953
|
const {
|
@@ -7833,11 +7978,26 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
7833
7978
|
return node;
|
7834
7979
|
}
|
7835
7980
|
function hydrateStaticElement(elm, vnode, renderer) {
|
7836
|
-
if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer) || !
|
7981
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer) || !areCompatibleStaticNodes(vnode.fragment, elm, vnode, renderer)) {
|
7982
|
+
return handleMismatch(elm, vnode, renderer);
|
7983
|
+
}
|
7984
|
+
return hydrateStaticElementParts(elm, vnode, renderer);
|
7985
|
+
}
|
7986
|
+
function hydrateStaticElementParts(elm, vnode, renderer) {
|
7987
|
+
const {
|
7988
|
+
parts
|
7989
|
+
} = vnode;
|
7990
|
+
if (!isUndefined$1(parts)) {
|
7991
|
+
// Elements must first be set on the static part to validate against.
|
7992
|
+
traverseAndSetElements(elm, parts, renderer);
|
7993
|
+
}
|
7994
|
+
if (!haveCompatibleStaticParts(vnode, renderer)) {
|
7837
7995
|
return handleMismatch(elm, vnode, renderer);
|
7838
7996
|
}
|
7839
7997
|
vnode.elm = elm;
|
7840
|
-
|
7998
|
+
// Hydration only requires applying event listeners and refs.
|
7999
|
+
// All other expressions should be applied during SSR or through the handleMismatch routine.
|
8000
|
+
hydrateStaticParts(vnode, renderer);
|
7841
8001
|
return elm;
|
7842
8002
|
}
|
7843
8003
|
function hydrateFragment(elm, vnode, renderer) {
|
@@ -8045,9 +8205,12 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8045
8205
|
}
|
8046
8206
|
return false;
|
8047
8207
|
}
|
8048
|
-
const
|
8049
|
-
|
8050
|
-
|
8208
|
+
const {
|
8209
|
+
data
|
8210
|
+
} = vnode;
|
8211
|
+
const hasCompatibleAttrs = validateAttrs(vnode, elm, data, renderer, shouldValidateAttr);
|
8212
|
+
const hasCompatibleClass = shouldValidateAttr('class') ? validateClassAttr(vnode, elm, data, renderer) : true;
|
8213
|
+
const hasCompatibleStyle = shouldValidateAttr('style') ? validateStyleAttr(vnode, elm, data, renderer) : true;
|
8051
8214
|
return hasCompatibleAttrs && hasCompatibleClass && hasCompatibleStyle;
|
8052
8215
|
}
|
8053
8216
|
function attributeValuesAreEqual(vnodeValue, value) {
|
@@ -8063,12 +8226,10 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8063
8226
|
// In all other cases, the two values are not considered equal
|
8064
8227
|
return false;
|
8065
8228
|
}
|
8066
|
-
function validateAttrs(vnode, elm, renderer, shouldValidateAttr) {
|
8229
|
+
function validateAttrs(vnode, elm, data, renderer, shouldValidateAttr) {
|
8067
8230
|
const {
|
8068
|
-
|
8069
|
-
|
8070
|
-
}
|
8071
|
-
} = vnode;
|
8231
|
+
attrs = {}
|
8232
|
+
} = data;
|
8072
8233
|
let nodesAreCompatible = true;
|
8073
8234
|
// Validate attributes, though we could always recovery from those by running the update mods.
|
8074
8235
|
// Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.
|
@@ -8076,9 +8237,6 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8076
8237
|
if (!shouldValidateAttr(attrName)) {
|
8077
8238
|
continue;
|
8078
8239
|
}
|
8079
|
-
const {
|
8080
|
-
owner
|
8081
|
-
} = vnode;
|
8082
8240
|
const {
|
8083
8241
|
getAttribute
|
8084
8242
|
} = renderer;
|
@@ -8088,18 +8246,19 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8088
8246
|
const {
|
8089
8247
|
getProperty
|
8090
8248
|
} = renderer;
|
8091
|
-
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found ${isNull(elmAttrValue) ? 'null' : `"${elmAttrValue}"`}`, owner);
|
8249
|
+
logError(`Mismatch hydrating element <${getProperty(elm, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found ${isNull(elmAttrValue) ? 'null' : `"${elmAttrValue}"`}`, vnode.owner);
|
8092
8250
|
}
|
8093
8251
|
nodesAreCompatible = false;
|
8094
8252
|
}
|
8095
8253
|
}
|
8096
8254
|
return nodesAreCompatible;
|
8097
8255
|
}
|
8098
|
-
function validateClassAttr(vnode, elm, renderer) {
|
8256
|
+
function validateClassAttr(vnode, elm, data, renderer) {
|
8099
8257
|
const {
|
8100
|
-
data,
|
8101
8258
|
owner
|
8102
8259
|
} = vnode;
|
8260
|
+
// classMap is never available on VStaticPartData so it can default to undefined
|
8261
|
+
// casting to prevent TS error.
|
8103
8262
|
let {
|
8104
8263
|
className,
|
8105
8264
|
classMap
|
@@ -8179,13 +8338,12 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8179
8338
|
}
|
8180
8339
|
return nodesAreCompatible;
|
8181
8340
|
}
|
8182
|
-
function validateStyleAttr(vnode, elm, renderer) {
|
8341
|
+
function validateStyleAttr(vnode, elm, data, renderer) {
|
8342
|
+
// Note styleDecls is always undefined for VStaticPartData, casting here to default it to undefined
|
8183
8343
|
const {
|
8184
|
-
|
8185
|
-
|
8186
|
-
|
8187
|
-
}
|
8188
|
-
} = vnode;
|
8344
|
+
style,
|
8345
|
+
styleDecls
|
8346
|
+
} = data;
|
8189
8347
|
const {
|
8190
8348
|
getAttribute
|
8191
8349
|
} = renderer;
|
@@ -8226,7 +8384,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8226
8384
|
}
|
8227
8385
|
return nodesAreCompatible;
|
8228
8386
|
}
|
8229
|
-
function
|
8387
|
+
function areCompatibleStaticNodes(client, ssr, vnode, renderer) {
|
8230
8388
|
const {
|
8231
8389
|
getProperty,
|
8232
8390
|
getAttribute
|
@@ -8246,24 +8404,72 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8246
8404
|
if (!hasCorrectNodeType(vnode, ssr, 1 /* EnvNodeTypes.ELEMENT */, renderer)) {
|
8247
8405
|
return false;
|
8248
8406
|
}
|
8407
|
+
const {
|
8408
|
+
owner,
|
8409
|
+
parts
|
8410
|
+
} = vnode;
|
8249
8411
|
let isCompatibleElements = true;
|
8250
8412
|
if (getProperty(client, 'tagName') !== getProperty(ssr, 'tagName')) {
|
8251
8413
|
if (process.env.NODE_ENV !== 'production') {
|
8252
|
-
logError(`Hydration mismatch: expecting element with tag "${getProperty(client, 'tagName').toLowerCase()}" but found "${getProperty(ssr, 'tagName').toLowerCase()}".`,
|
8414
|
+
logError(`Hydration mismatch: expecting element with tag "${getProperty(client, 'tagName').toLowerCase()}" but found "${getProperty(ssr, 'tagName').toLowerCase()}".`, owner);
|
8253
8415
|
}
|
8254
8416
|
return false;
|
8255
8417
|
}
|
8256
8418
|
const clientAttrsNames = getProperty(client, 'getAttributeNames').call(client);
|
8257
8419
|
clientAttrsNames.forEach(attrName => {
|
8258
8420
|
if (getAttribute(client, attrName) !== getAttribute(ssr, attrName)) {
|
8259
|
-
if
|
8260
|
-
|
8421
|
+
// Check if the root element attributes have expressions, if it does then we need to delegate hydration
|
8422
|
+
// validation to haveCompatibleStaticParts.
|
8423
|
+
// Note if there are no parts then it is a fully static fragment.
|
8424
|
+
// partId === 0 will always refer to the root element, this is guaranteed by the compiler.
|
8425
|
+
if (parts?.[0].partId !== 0) {
|
8426
|
+
if (process.env.NODE_ENV !== 'production') {
|
8427
|
+
logError(`Mismatch hydrating element <${getProperty(client, 'tagName').toLowerCase()}>: attribute "${attrName}" has different values, expected "${getAttribute(client, attrName)}" but found "${getAttribute(ssr, attrName)}"`, owner);
|
8428
|
+
}
|
8429
|
+
isCompatibleElements = false;
|
8261
8430
|
}
|
8262
|
-
isCompatibleElements = false;
|
8263
8431
|
}
|
8264
8432
|
});
|
8265
8433
|
return isCompatibleElements;
|
8266
8434
|
}
|
8435
|
+
function haveCompatibleStaticParts(vnode, renderer) {
|
8436
|
+
const {
|
8437
|
+
parts,
|
8438
|
+
owner
|
8439
|
+
} = vnode;
|
8440
|
+
if (isUndefined$1(parts)) {
|
8441
|
+
return true;
|
8442
|
+
}
|
8443
|
+
// The validation here relies on 2 key invariants:
|
8444
|
+
// 1. It's never the case that `parts` is undefined on the server but defined on the client (or vice-versa)
|
8445
|
+
// 2. It's never the case that `parts` has one length on the server but another on the client
|
8446
|
+
for (const part of parts) {
|
8447
|
+
const {
|
8448
|
+
elm
|
8449
|
+
} = part;
|
8450
|
+
if (isVStaticPartElement(part)) {
|
8451
|
+
if (!hasCorrectNodeType(vnode, elm, 1 /* EnvNodeTypes.ELEMENT */, renderer)) {
|
8452
|
+
return false;
|
8453
|
+
}
|
8454
|
+
const {
|
8455
|
+
data
|
8456
|
+
} = part;
|
8457
|
+
const hasMatchingAttrs = validateAttrs(vnode, elm, data, renderer, () => true);
|
8458
|
+
const hasMatchingStyleAttr = validateStyleAttr(vnode, elm, data, renderer);
|
8459
|
+
const hasMatchingClass = validateClassAttr(vnode, elm, data, renderer);
|
8460
|
+
if (isFalse(hasMatchingAttrs && hasMatchingStyleAttr && hasMatchingClass)) {
|
8461
|
+
return false;
|
8462
|
+
}
|
8463
|
+
} else {
|
8464
|
+
// VStaticPartText
|
8465
|
+
if (!hasCorrectNodeType(vnode, elm, 3 /* EnvNodeTypes.TEXT */, renderer)) {
|
8466
|
+
return false;
|
8467
|
+
}
|
8468
|
+
updateTextContent(elm, part, owner, renderer);
|
8469
|
+
}
|
8470
|
+
}
|
8471
|
+
return true;
|
8472
|
+
}
|
8267
8473
|
|
8268
8474
|
/*
|
8269
8475
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -8279,7 +8485,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8279
8485
|
}
|
8280
8486
|
|
8281
8487
|
/*
|
8282
|
-
* Copyright (c)
|
8488
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
8283
8489
|
* All rights reserved.
|
8284
8490
|
* SPDX-License-Identifier: MIT
|
8285
8491
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
@@ -8336,9 +8542,9 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8336
8542
|
// we can at least warn when they use the most common mutation methods.
|
8337
8543
|
for (const prop of ARRAY_MUTATION_METHODS) {
|
8338
8544
|
const originalArrayMethod = getOriginalArrayMethod(prop);
|
8545
|
+
// Assertions used here because TypeScript can't handle mapping over our types
|
8339
8546
|
stylesheets[prop] = function arrayMutationWarningWrapper() {
|
8340
8547
|
reportTemplateViolation('stylesheets');
|
8341
|
-
// @ts-expect-error can't properly determine the right `this`
|
8342
8548
|
return originalArrayMethod.apply(this, arguments);
|
8343
8549
|
};
|
8344
8550
|
}
|
@@ -8520,7 +8726,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8520
8726
|
}
|
8521
8727
|
return getReadOnlyProxy(obj);
|
8522
8728
|
}
|
8523
|
-
/** version: 6.
|
8729
|
+
/** version: 6.5.2 */
|
8524
8730
|
|
8525
8731
|
/*
|
8526
8732
|
* Copyright (c) 2018, salesforce.com, inc.
|
@@ -8733,25 +8939,19 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8733
8939
|
* SPDX-License-Identifier: MIT
|
8734
8940
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
8735
8941
|
*/
|
8736
|
-
const LIFECYCLE_CALLBACKS = {
|
8737
|
-
connectedCallback: connectRootElement,
|
8738
|
-
disconnectedCallback: disconnectRootElement,
|
8739
|
-
formAssociatedCallback: runFormAssociatedCallback,
|
8740
|
-
formDisabledCallback: runFormDisabledCallback,
|
8741
|
-
formResetCallback: runFormResetCallback,
|
8742
|
-
formStateRestoreCallback: runFormStateRestoreCallback
|
8743
|
-
};
|
8744
8942
|
const cachedConstructors = new Map();
|
8745
8943
|
const nativeLifecycleElementsToUpgradedByLWC = new WeakMap();
|
8746
8944
|
let elementBeingUpgradedByLWC = false;
|
8747
|
-
|
8748
|
-
|
8749
|
-
|
8750
|
-
|
8751
|
-
|
8752
|
-
|
8945
|
+
let BaseUpgradableConstructor;
|
8946
|
+
let BaseHTMLElement;
|
8947
|
+
function createBaseUpgradableConstructor() {
|
8948
|
+
// Creates a constructor that is intended to be used directly as a custom element, except that the upgradeCallback is
|
8949
|
+
// passed in to the constructor so LWC can reuse the same custom element constructor for multiple components.
|
8950
|
+
// Another benefit is that only LWC can create components that actually do anything – if you do
|
8951
|
+
// `customElements.define('x-foo')`, then you don't have access to the upgradeCallback, so it's a dummy custom element.
|
8952
|
+
// This class should be created once per tag name.
|
8753
8953
|
// TODO [#2972]: this class should expose observedAttributes as necessary
|
8754
|
-
class
|
8954
|
+
BaseUpgradableConstructor = class TheBaseUpgradableConstructor extends HTMLElement {
|
8755
8955
|
constructor(upgradeCallback, useNativeLifecycle) {
|
8756
8956
|
super();
|
8757
8957
|
if (useNativeLifecycle) {
|
@@ -8768,17 +8968,57 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8768
8968
|
// TODO [#2970]: LWC elements cannot be upgraded via new Ctor()
|
8769
8969
|
// Do we want to support this? Throw an error? Currently for backwards compat it's a no-op.
|
8770
8970
|
}
|
8771
|
-
|
8772
|
-
}
|
8773
|
-
UpgradableConstructor.formAssociated = isFormAssociated;
|
8774
|
-
for (const [propName, callback] of entries(LIFECYCLE_CALLBACKS)) {
|
8775
|
-
UpgradableConstructor.prototype[propName] = function () {
|
8776
|
-
// If the element is in the WeakMap (i.e. it's marked as native lifecycle), and if it was upgraded by LWC,
|
8777
|
-
// then it can use native lifecycle
|
8971
|
+
connectedCallback() {
|
8778
8972
|
if (isTrue(nativeLifecycleElementsToUpgradedByLWC.get(this))) {
|
8779
|
-
|
8973
|
+
connectRootElement(this);
|
8780
8974
|
}
|
8781
|
-
}
|
8975
|
+
}
|
8976
|
+
disconnectedCallback() {
|
8977
|
+
if (isTrue(nativeLifecycleElementsToUpgradedByLWC.get(this))) {
|
8978
|
+
disconnectRootElement(this);
|
8979
|
+
}
|
8980
|
+
}
|
8981
|
+
formAssociatedCallback(form) {
|
8982
|
+
if (isTrue(nativeLifecycleElementsToUpgradedByLWC.get(this))) {
|
8983
|
+
runFormAssociatedCallback(this, form);
|
8984
|
+
}
|
8985
|
+
}
|
8986
|
+
formDisabledCallback(disabled) {
|
8987
|
+
if (isTrue(nativeLifecycleElementsToUpgradedByLWC.get(this))) {
|
8988
|
+
runFormDisabledCallback(this, disabled);
|
8989
|
+
}
|
8990
|
+
}
|
8991
|
+
formResetCallback() {
|
8992
|
+
if (isTrue(nativeLifecycleElementsToUpgradedByLWC.get(this))) {
|
8993
|
+
runFormResetCallback(this);
|
8994
|
+
}
|
8995
|
+
}
|
8996
|
+
formStateRestoreCallback(state, reason) {
|
8997
|
+
if (isTrue(nativeLifecycleElementsToUpgradedByLWC.get(this))) {
|
8998
|
+
runFormStateRestoreCallback(this, state, reason);
|
8999
|
+
}
|
9000
|
+
}
|
9001
|
+
/*LWC compiler v6.5.2*/
|
9002
|
+
};
|
9003
|
+
BaseHTMLElement = HTMLElement; // cache to track if it changes
|
9004
|
+
}
|
9005
|
+
const createUpgradableConstructor = isFormAssociated => {
|
9006
|
+
if (HTMLElement !== BaseHTMLElement) {
|
9007
|
+
// If the global HTMLElement changes out from under our feet, then we need to create a new
|
9008
|
+
// BaseUpgradableConstructor from scratch (since it extends from HTMLElement). This can occur if
|
9009
|
+
// polyfills are in play, e.g. a polyfill for scoped custom element registries.
|
9010
|
+
// This workaround can potentially be removed when W-15361244 is resolved.
|
9011
|
+
createBaseUpgradableConstructor();
|
9012
|
+
}
|
9013
|
+
// Using a BaseUpgradableConstructor superclass here is a perf optimization to avoid
|
9014
|
+
// re-defining the same logic (connectedCallback, disconnectedCallback, etc.) over and over.
|
9015
|
+
class UpgradableConstructor extends BaseUpgradableConstructor {
|
9016
|
+
/*LWC compiler v6.5.2*/
|
9017
|
+
}
|
9018
|
+
if (isFormAssociated) {
|
9019
|
+
// Perf optimization - the vast majority of components have formAssociated=false,
|
9020
|
+
// so we can skip the setter in those cases, since undefined works the same as false.
|
9021
|
+
UpgradableConstructor.formAssociated = isFormAssociated;
|
8782
9022
|
}
|
8783
9023
|
return UpgradableConstructor;
|
8784
9024
|
};
|
@@ -8796,11 +9036,11 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8796
9036
|
}
|
8797
9037
|
const createCustomElement = (tagName, upgradeCallback, useNativeLifecycle, isFormAssociated) => {
|
8798
9038
|
const UpgradableConstructor = getUpgradableConstructor(tagName, isFormAssociated);
|
9039
|
+
if (Boolean(UpgradableConstructor.formAssociated) !== isFormAssociated) {
|
9040
|
+
throw new Error(`<${tagName}> was already registered with formAssociated=${UpgradableConstructor.formAssociated}. It cannot be re-registered with formAssociated=${isFormAssociated}. Please rename your component to have a different name than <${tagName}>`);
|
9041
|
+
}
|
8799
9042
|
elementBeingUpgradedByLWC = true;
|
8800
9043
|
try {
|
8801
|
-
if (UpgradableConstructor.formAssociated !== isFormAssociated) {
|
8802
|
-
throw new Error(`<${tagName}> was already registered with formAssociated=${UpgradableConstructor.formAssociated}. It cannot be re-registered with formAssociated=${isFormAssociated}. Please rename your component to have a different name than <${tagName}>`);
|
8803
|
-
}
|
8804
9044
|
return new UpgradableConstructor(upgradeCallback, useNativeLifecycle);
|
8805
9045
|
} finally {
|
8806
9046
|
elementBeingUpgradedByLWC = false;
|
@@ -8896,7 +9136,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8896
9136
|
function isNull(obj) {
|
8897
9137
|
return obj === null;
|
8898
9138
|
}
|
8899
|
-
/** version: 6.
|
9139
|
+
/** version: 6.5.2 */
|
8900
9140
|
|
8901
9141
|
/*
|
8902
9142
|
* Copyright (c) 2023, salesforce.com, inc.
|
@@ -8916,7 +9156,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
8916
9156
|
this.setNewContext = setNewContext;
|
8917
9157
|
this.setDisconnectedCallback = setDisconnectedCallback;
|
8918
9158
|
}
|
8919
|
-
/*LWC compiler v6.
|
9159
|
+
/*LWC compiler v6.5.2*/
|
8920
9160
|
}
|
8921
9161
|
function registerContextConsumer(elm, adapterContextToken, subscriptionPayload) {
|
8922
9162
|
dispatchEvent(elm, new WireContextSubscriptionEvent(adapterContextToken, subscriptionPayload));
|
@@ -9314,19 +9554,19 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
9314
9554
|
attributeChangedCallback(name, oldValue, newValue) {
|
9315
9555
|
attributeChangedCallback.call(this, name, oldValue, newValue);
|
9316
9556
|
}
|
9317
|
-
formAssociatedCallback() {
|
9318
|
-
runFormAssociatedCallback(this);
|
9557
|
+
formAssociatedCallback(form) {
|
9558
|
+
runFormAssociatedCallback(this, form);
|
9319
9559
|
}
|
9320
|
-
formDisabledCallback() {
|
9321
|
-
runFormDisabledCallback(this);
|
9560
|
+
formDisabledCallback(disabled) {
|
9561
|
+
runFormDisabledCallback(this, disabled);
|
9322
9562
|
}
|
9323
9563
|
formResetCallback() {
|
9324
9564
|
runFormResetCallback(this);
|
9325
9565
|
}
|
9326
|
-
formStateRestoreCallback() {
|
9327
|
-
runFormStateRestoreCallback(this);
|
9566
|
+
formStateRestoreCallback(state, reason) {
|
9567
|
+
runFormStateRestoreCallback(this, state, reason);
|
9328
9568
|
}
|
9329
|
-
/*LWC compiler v6.
|
9569
|
+
/*LWC compiler v6.5.2*/
|
9330
9570
|
}, _a.observedAttributes = observedAttributes,
|
9331
9571
|
// Note CustomElementConstructor is not upgraded by LWC and inherits directly from HTMLElement which means it calls the native
|
9332
9572
|
// attachInternals API.
|
@@ -9559,7 +9799,7 @@ LWR.define('lwc/v/6_3_4', ['exports'], (function (exports) { 'use strict';
|
|
9559
9799
|
});
|
9560
9800
|
});
|
9561
9801
|
}
|
9562
|
-
/** version: 6.
|
9802
|
+
/** version: 6.5.2 */
|
9563
9803
|
|
9564
9804
|
exports.LightningElement = LightningElement;
|
9565
9805
|
exports.__unstable__ProfilerControl = profilerControl;
|