@lwc/ssr-runtime 8.12.4 → 8.12.6-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +211 -210
- package/dist/index.d.ts +0 -1
- package/dist/index.js +212 -210
- package/dist/render.d.ts +5 -5
- package/package.json +4 -4
package/dist/index.cjs.js
CHANGED
@@ -631,7 +631,7 @@ function setHooks(hooks) {
|
|
631
631
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
632
632
|
*/
|
633
633
|
const DEFAULT_SSR_MODE = 'sync';
|
634
|
-
/** version: 8.12.
|
634
|
+
/** version: 8.12.5 */
|
635
635
|
|
636
636
|
/*
|
637
637
|
* Copyright (c) 2024, Salesforce, Inc.
|
@@ -709,6 +709,205 @@ class ClassList {
|
|
709
709
|
}
|
710
710
|
}
|
711
711
|
|
712
|
+
/******************************************************************************
|
713
|
+
Copyright (c) Microsoft Corporation.
|
714
|
+
|
715
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
716
|
+
purpose with or without fee is hereby granted.
|
717
|
+
|
718
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
719
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
720
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
721
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
722
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
723
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
724
|
+
PERFORMANCE OF THIS SOFTWARE.
|
725
|
+
***************************************************************************** */
|
726
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
727
|
+
|
728
|
+
|
729
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
730
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
731
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
732
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
733
|
+
}
|
734
|
+
|
735
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
736
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
737
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
738
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
739
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
740
|
+
}
|
741
|
+
|
742
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
743
|
+
var e = new Error(message);
|
744
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
745
|
+
};
|
746
|
+
|
747
|
+
/*
|
748
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
749
|
+
* All rights reserved.
|
750
|
+
* SPDX-License-Identifier: MIT
|
751
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
752
|
+
*/
|
753
|
+
var _MutationTracker_enabledSet, _MutationTracker_mutationMap;
|
754
|
+
class MutationTracker {
|
755
|
+
constructor() {
|
756
|
+
_MutationTracker_enabledSet.set(this, new WeakSet());
|
757
|
+
_MutationTracker_mutationMap.set(this, new WeakMap());
|
758
|
+
}
|
759
|
+
add(instance, attrName) {
|
760
|
+
if (__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").has(instance)) {
|
761
|
+
let mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
|
762
|
+
if (!mutatedAttrs) {
|
763
|
+
mutatedAttrs = new Set();
|
764
|
+
__classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").set(instance, mutatedAttrs);
|
765
|
+
}
|
766
|
+
mutatedAttrs.add(attrName.toLowerCase());
|
767
|
+
}
|
768
|
+
}
|
769
|
+
enable(instance) {
|
770
|
+
__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").add(instance);
|
771
|
+
}
|
772
|
+
disable(instance) {
|
773
|
+
__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").delete(instance);
|
774
|
+
}
|
775
|
+
renderMutatedAttrs(instance) {
|
776
|
+
const mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
|
777
|
+
if (mutatedAttrs) {
|
778
|
+
return ` data-lwc-host-mutated="${[...mutatedAttrs].sort().join(' ')}"`;
|
779
|
+
}
|
780
|
+
else {
|
781
|
+
return '';
|
782
|
+
}
|
783
|
+
}
|
784
|
+
}
|
785
|
+
_MutationTracker_enabledSet = new WeakMap(), _MutationTracker_mutationMap = new WeakMap();
|
786
|
+
const mutationTracker = new MutationTracker();
|
787
|
+
|
788
|
+
/*
|
789
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
790
|
+
* All rights reserved.
|
791
|
+
* SPDX-License-Identifier: MIT
|
792
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
793
|
+
*/
|
794
|
+
/**
|
795
|
+
* Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
|
796
|
+
*/
|
797
|
+
const stringDescriptor = (attrName) => ({
|
798
|
+
configurable: true,
|
799
|
+
enumerable: true,
|
800
|
+
get() {
|
801
|
+
return this.getAttribute(attrName);
|
802
|
+
},
|
803
|
+
set(newValue) {
|
804
|
+
const currentValue = this.getAttribute(attrName);
|
805
|
+
const normalizedValue = String(newValue);
|
806
|
+
if (normalizedValue !== currentValue) {
|
807
|
+
this.setAttribute(attrName, normalizedValue);
|
808
|
+
}
|
809
|
+
},
|
810
|
+
});
|
811
|
+
/** Descriptor for a boolean that checks for `attr="true"` or `attr="false"`, e.g. `spellcheck` and `draggable`. */
|
812
|
+
const explicitBooleanDescriptor = (attrName, defaultValue) => ({
|
813
|
+
configurable: true,
|
814
|
+
enumerable: true,
|
815
|
+
get() {
|
816
|
+
const value = this.getAttribute(attrName);
|
817
|
+
if (value === null)
|
818
|
+
return defaultValue;
|
819
|
+
// spellcheck=false => false, everything else => true
|
820
|
+
// draggable=true => true, everything else => false
|
821
|
+
return value.toLowerCase() === String(defaultValue) ? defaultValue : !defaultValue;
|
822
|
+
},
|
823
|
+
set(newValue) {
|
824
|
+
const currentValue = this.getAttribute(attrName);
|
825
|
+
const normalizedValue = String(Boolean(newValue));
|
826
|
+
if (normalizedValue !== currentValue) {
|
827
|
+
this.setAttribute(attrName, normalizedValue);
|
828
|
+
}
|
829
|
+
},
|
830
|
+
});
|
831
|
+
/**
|
832
|
+
* Descriptor for a "true" boolean attribute that checks solely for presence, e.g. `hidden`.
|
833
|
+
*/
|
834
|
+
const booleanAttributeDescriptor = (attrName) => ({
|
835
|
+
configurable: true,
|
836
|
+
enumerable: true,
|
837
|
+
get() {
|
838
|
+
return this.hasAttribute(attrName);
|
839
|
+
},
|
840
|
+
set(newValue) {
|
841
|
+
const hasAttribute = this.hasAttribute(attrName);
|
842
|
+
if (newValue) {
|
843
|
+
if (!hasAttribute) {
|
844
|
+
this.setAttribute(attrName, '');
|
845
|
+
}
|
846
|
+
}
|
847
|
+
else {
|
848
|
+
if (hasAttribute) {
|
849
|
+
this.removeAttribute(attrName);
|
850
|
+
}
|
851
|
+
}
|
852
|
+
},
|
853
|
+
});
|
854
|
+
/**
|
855
|
+
* Descriptor for ARIA reflections, e.g. `ariaLabel` and `role`.
|
856
|
+
*/
|
857
|
+
const ariaDescriptor = (attrName) => ({
|
858
|
+
configurable: true,
|
859
|
+
enumerable: true,
|
860
|
+
get() {
|
861
|
+
return this.getAttribute(attrName);
|
862
|
+
},
|
863
|
+
set(newValue) {
|
864
|
+
const currentValue = this.getAttribute(attrName);
|
865
|
+
if (newValue !== currentValue) {
|
866
|
+
// TODO [#3284]: According to the spec, IDL nullable type values
|
867
|
+
// (null and undefined) should remove the attribute; however, we
|
868
|
+
// only do so in the case of null for historical reasons.
|
869
|
+
if (isNull(newValue)) {
|
870
|
+
this.removeAttribute(attrName);
|
871
|
+
}
|
872
|
+
else {
|
873
|
+
this.setAttribute(attrName, toString(newValue));
|
874
|
+
}
|
875
|
+
}
|
876
|
+
},
|
877
|
+
});
|
878
|
+
const tabIndexDescriptor = () => ({
|
879
|
+
configurable: true,
|
880
|
+
enumerable: true,
|
881
|
+
get() {
|
882
|
+
const str = this.getAttribute('tabindex');
|
883
|
+
const num = Number(str);
|
884
|
+
return isFinite(num) ? Math.trunc(num) : -1;
|
885
|
+
},
|
886
|
+
set(newValue) {
|
887
|
+
const currentValue = this.getAttribute('tabindex');
|
888
|
+
const num = Number(newValue);
|
889
|
+
const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
|
890
|
+
if (normalizedValue !== currentValue) {
|
891
|
+
this.setAttribute('tabindex', toString(newValue));
|
892
|
+
}
|
893
|
+
},
|
894
|
+
});
|
895
|
+
const descriptors = {
|
896
|
+
accessKey: stringDescriptor('accesskey'),
|
897
|
+
dir: stringDescriptor('dir'),
|
898
|
+
draggable: explicitBooleanDescriptor('draggable', true),
|
899
|
+
hidden: booleanAttributeDescriptor('hidden'),
|
900
|
+
id: stringDescriptor('id'),
|
901
|
+
lang: stringDescriptor('lang'),
|
902
|
+
spellcheck: explicitBooleanDescriptor('spellcheck', false),
|
903
|
+
tabIndex: tabIndexDescriptor(),
|
904
|
+
title: stringDescriptor('title'),
|
905
|
+
};
|
906
|
+
// Add descriptors for ARIA attributes
|
907
|
+
for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
|
908
|
+
descriptors[propName] = ariaDescriptor(attrName);
|
909
|
+
}
|
910
|
+
|
712
911
|
/**
|
713
912
|
* Copyright (C) 2017 salesforce.com, inc.
|
714
913
|
*/
|
@@ -1136,205 +1335,6 @@ function getReadOnlyProxy(value) {
|
|
1136
1335
|
return reactiveMembrane.getReadOnlyProxy(value);
|
1137
1336
|
}
|
1138
1337
|
|
1139
|
-
/******************************************************************************
|
1140
|
-
Copyright (c) Microsoft Corporation.
|
1141
|
-
|
1142
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
1143
|
-
purpose with or without fee is hereby granted.
|
1144
|
-
|
1145
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
1146
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
1147
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
1148
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
1149
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
1150
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
1151
|
-
PERFORMANCE OF THIS SOFTWARE.
|
1152
|
-
***************************************************************************** */
|
1153
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
1154
|
-
|
1155
|
-
|
1156
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
1157
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1158
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1159
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1160
|
-
}
|
1161
|
-
|
1162
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
1163
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
1164
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1165
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1166
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1167
|
-
}
|
1168
|
-
|
1169
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
1170
|
-
var e = new Error(message);
|
1171
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
1172
|
-
};
|
1173
|
-
|
1174
|
-
/*
|
1175
|
-
* Copyright (c) 2024, Salesforce, Inc.
|
1176
|
-
* All rights reserved.
|
1177
|
-
* SPDX-License-Identifier: MIT
|
1178
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1179
|
-
*/
|
1180
|
-
var _MutationTracker_enabledSet, _MutationTracker_mutationMap;
|
1181
|
-
class MutationTracker {
|
1182
|
-
constructor() {
|
1183
|
-
_MutationTracker_enabledSet.set(this, new WeakSet());
|
1184
|
-
_MutationTracker_mutationMap.set(this, new WeakMap());
|
1185
|
-
}
|
1186
|
-
add(instance, attrName) {
|
1187
|
-
if (__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").has(instance)) {
|
1188
|
-
let mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
|
1189
|
-
if (!mutatedAttrs) {
|
1190
|
-
mutatedAttrs = new Set();
|
1191
|
-
__classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").set(instance, mutatedAttrs);
|
1192
|
-
}
|
1193
|
-
mutatedAttrs.add(attrName.toLowerCase());
|
1194
|
-
}
|
1195
|
-
}
|
1196
|
-
enable(instance) {
|
1197
|
-
__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").add(instance);
|
1198
|
-
}
|
1199
|
-
disable(instance) {
|
1200
|
-
__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").delete(instance);
|
1201
|
-
}
|
1202
|
-
renderMutatedAttrs(instance) {
|
1203
|
-
const mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
|
1204
|
-
if (mutatedAttrs) {
|
1205
|
-
return ` data-lwc-host-mutated="${[...mutatedAttrs].sort().join(' ')}"`;
|
1206
|
-
}
|
1207
|
-
else {
|
1208
|
-
return '';
|
1209
|
-
}
|
1210
|
-
}
|
1211
|
-
}
|
1212
|
-
_MutationTracker_enabledSet = new WeakMap(), _MutationTracker_mutationMap = new WeakMap();
|
1213
|
-
const mutationTracker = new MutationTracker();
|
1214
|
-
|
1215
|
-
/*
|
1216
|
-
* Copyright (c) 2024, Salesforce, Inc.
|
1217
|
-
* All rights reserved.
|
1218
|
-
* SPDX-License-Identifier: MIT
|
1219
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1220
|
-
*/
|
1221
|
-
/**
|
1222
|
-
* Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
|
1223
|
-
*/
|
1224
|
-
const stringDescriptor = (attrName) => ({
|
1225
|
-
configurable: true,
|
1226
|
-
enumerable: true,
|
1227
|
-
get() {
|
1228
|
-
return this.getAttribute(attrName);
|
1229
|
-
},
|
1230
|
-
set(newValue) {
|
1231
|
-
const currentValue = this.getAttribute(attrName);
|
1232
|
-
const normalizedValue = String(newValue);
|
1233
|
-
if (normalizedValue !== currentValue) {
|
1234
|
-
this.setAttribute(attrName, normalizedValue);
|
1235
|
-
}
|
1236
|
-
},
|
1237
|
-
});
|
1238
|
-
/** Descriptor for a boolean that checks for `attr="true"` or `attr="false"`, e.g. `spellcheck` and `draggable`. */
|
1239
|
-
const explicitBooleanDescriptor = (attrName, defaultValue) => ({
|
1240
|
-
configurable: true,
|
1241
|
-
enumerable: true,
|
1242
|
-
get() {
|
1243
|
-
const value = this.getAttribute(attrName);
|
1244
|
-
if (value === null)
|
1245
|
-
return defaultValue;
|
1246
|
-
// spellcheck=false => false, everything else => true
|
1247
|
-
// draggable=true => true, everything else => false
|
1248
|
-
return value.toLowerCase() === String(defaultValue) ? defaultValue : !defaultValue;
|
1249
|
-
},
|
1250
|
-
set(newValue) {
|
1251
|
-
const currentValue = this.getAttribute(attrName);
|
1252
|
-
const normalizedValue = String(Boolean(newValue));
|
1253
|
-
if (normalizedValue !== currentValue) {
|
1254
|
-
this.setAttribute(attrName, normalizedValue);
|
1255
|
-
}
|
1256
|
-
},
|
1257
|
-
});
|
1258
|
-
/**
|
1259
|
-
* Descriptor for a "true" boolean attribute that checks solely for presence, e.g. `hidden`.
|
1260
|
-
*/
|
1261
|
-
const booleanAttributeDescriptor = (attrName) => ({
|
1262
|
-
configurable: true,
|
1263
|
-
enumerable: true,
|
1264
|
-
get() {
|
1265
|
-
return this.hasAttribute(attrName);
|
1266
|
-
},
|
1267
|
-
set(newValue) {
|
1268
|
-
const hasAttribute = this.hasAttribute(attrName);
|
1269
|
-
if (newValue) {
|
1270
|
-
if (!hasAttribute) {
|
1271
|
-
this.setAttribute(attrName, '');
|
1272
|
-
}
|
1273
|
-
}
|
1274
|
-
else {
|
1275
|
-
if (hasAttribute) {
|
1276
|
-
this.removeAttribute(attrName);
|
1277
|
-
}
|
1278
|
-
}
|
1279
|
-
},
|
1280
|
-
});
|
1281
|
-
/**
|
1282
|
-
* Descriptor for ARIA reflections, e.g. `ariaLabel` and `role`.
|
1283
|
-
*/
|
1284
|
-
const ariaDescriptor = (attrName) => ({
|
1285
|
-
configurable: true,
|
1286
|
-
enumerable: true,
|
1287
|
-
get() {
|
1288
|
-
return this.getAttribute(attrName);
|
1289
|
-
},
|
1290
|
-
set(newValue) {
|
1291
|
-
const currentValue = this.getAttribute(attrName);
|
1292
|
-
if (newValue !== currentValue) {
|
1293
|
-
// TODO [#3284]: According to the spec, IDL nullable type values
|
1294
|
-
// (null and undefined) should remove the attribute; however, we
|
1295
|
-
// only do so in the case of null for historical reasons.
|
1296
|
-
if (isNull(newValue)) {
|
1297
|
-
this.removeAttribute(attrName);
|
1298
|
-
}
|
1299
|
-
else {
|
1300
|
-
this.setAttribute(attrName, toString(newValue));
|
1301
|
-
}
|
1302
|
-
}
|
1303
|
-
},
|
1304
|
-
});
|
1305
|
-
const tabIndexDescriptor = () => ({
|
1306
|
-
configurable: true,
|
1307
|
-
enumerable: true,
|
1308
|
-
get() {
|
1309
|
-
const str = this.getAttribute('tabindex');
|
1310
|
-
const num = Number(str);
|
1311
|
-
return isFinite(num) ? Math.trunc(num) : -1;
|
1312
|
-
},
|
1313
|
-
set(newValue) {
|
1314
|
-
const currentValue = this.getAttribute('tabindex');
|
1315
|
-
const num = Number(newValue);
|
1316
|
-
const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
|
1317
|
-
if (normalizedValue !== currentValue) {
|
1318
|
-
this.setAttribute('tabindex', toString(newValue));
|
1319
|
-
}
|
1320
|
-
},
|
1321
|
-
});
|
1322
|
-
const descriptors = {
|
1323
|
-
accessKey: stringDescriptor('accesskey'),
|
1324
|
-
dir: stringDescriptor('dir'),
|
1325
|
-
draggable: explicitBooleanDescriptor('draggable', true),
|
1326
|
-
hidden: booleanAttributeDescriptor('hidden'),
|
1327
|
-
id: stringDescriptor('id'),
|
1328
|
-
lang: stringDescriptor('lang'),
|
1329
|
-
spellcheck: explicitBooleanDescriptor('spellcheck', false),
|
1330
|
-
tabIndex: tabIndexDescriptor(),
|
1331
|
-
title: stringDescriptor('title'),
|
1332
|
-
};
|
1333
|
-
// Add descriptors for ARIA attributes
|
1334
|
-
for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
|
1335
|
-
descriptors[propName] = ariaDescriptor(attrName);
|
1336
|
-
}
|
1337
|
-
|
1338
1338
|
/*
|
1339
1339
|
* Copyright (c) 2024, salesforce.com, inc.
|
1340
1340
|
* All rights reserved.
|
@@ -1365,7 +1365,9 @@ class LightningElement {
|
|
1365
1365
|
if (publicFields.has(propName) ||
|
1366
1366
|
((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
|
1367
1367
|
!privateFields.has(propName))) {
|
1368
|
-
|
1368
|
+
// For props passed from parents to children, they are intended to be read-only
|
1369
|
+
// to avoid a child mutating its parent's state
|
1370
|
+
this[propName] = getReadOnlyProxy(props[propName]);
|
1369
1371
|
}
|
1370
1372
|
}
|
1371
1373
|
}
|
@@ -1488,7 +1490,6 @@ defineProperties(LightningElement.prototype, descriptors);
|
|
1488
1490
|
* SPDX-License-Identifier: MIT
|
1489
1491
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1490
1492
|
*/
|
1491
|
-
const escapeAttrVal = (attrValue) => attrValue.replaceAll('&', '&').replaceAll('"', '"');
|
1492
1493
|
function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
|
1493
1494
|
// The scopeToken is e.g. `lwc-xyz123` which is the token our parent gives us.
|
1494
1495
|
// The hostScopeToken is e.g. `lwc-abc456-host` which is the token for our own component.
|
@@ -1522,7 +1523,8 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
|
|
1522
1523
|
hasClassAttribute = true;
|
1523
1524
|
}
|
1524
1525
|
}
|
1525
|
-
result +=
|
1526
|
+
result +=
|
1527
|
+
attrValue === '' ? ` ${attrName}` : ` ${attrName}="${htmlEscape(attrValue, true)}"`;
|
1526
1528
|
}
|
1527
1529
|
// If we didn't render any `class` attribute, render one for the scope token(s)
|
1528
1530
|
if (!hasClassAttribute && combinedScopeToken) {
|
@@ -1541,12 +1543,12 @@ function* renderAttrs(instance, attrs, hostScopeToken, scopeToken) {
|
|
1541
1543
|
function renderAttrsNoYield(emit, instance, attrs, hostScopeToken, scopeToken) {
|
1542
1544
|
emit(renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken));
|
1543
1545
|
}
|
1544
|
-
function* fallbackTmpl(_shadowSlottedContent, _lightSlottedContent, Cmp, _instance) {
|
1546
|
+
function* fallbackTmpl(_shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, _instance) {
|
1545
1547
|
if (Cmp.renderMode !== 'light') {
|
1546
1548
|
yield '<template shadowrootmode="open"></template>';
|
1547
1549
|
}
|
1548
1550
|
}
|
1549
|
-
function fallbackTmplNoYield(emit, _shadowSlottedContent, _lightSlottedContent, Cmp, _instance) {
|
1551
|
+
function fallbackTmplNoYield(emit, _shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, _instance) {
|
1550
1552
|
if (Cmp.renderMode !== 'light') {
|
1551
1553
|
emit('<template shadowrootmode="open"></template>');
|
1552
1554
|
}
|
@@ -1561,15 +1563,15 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
|
|
1561
1563
|
markup += segment;
|
1562
1564
|
};
|
1563
1565
|
if (mode === 'asyncYield') {
|
1564
|
-
for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null)) {
|
1566
|
+
for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null, null)) {
|
1565
1567
|
markup += segment;
|
1566
1568
|
}
|
1567
1569
|
}
|
1568
1570
|
else if (mode === 'async') {
|
1569
|
-
await generateMarkup(emit, tagName, props, null, null, null, null, null, null);
|
1571
|
+
await generateMarkup(emit, tagName, props, null, null, null, null, null, null, null);
|
1570
1572
|
}
|
1571
1573
|
else if (mode === 'sync') {
|
1572
|
-
generateMarkup(emit, tagName, props, null, null, null, null, null, null);
|
1574
|
+
generateMarkup(emit, tagName, props, null, null, null, null, null, null, null);
|
1573
1575
|
}
|
1574
1576
|
else {
|
1575
1577
|
throw new Error(`Invalid mode: ${mode}`);
|
@@ -1806,7 +1808,6 @@ exports.fallbackTmpl = fallbackTmpl;
|
|
1806
1808
|
exports.fallbackTmplNoYield = fallbackTmplNoYield;
|
1807
1809
|
exports.freezeTemplate = freezeTemplate;
|
1808
1810
|
exports.getComponentDef = getComponentDef;
|
1809
|
-
exports.getReadOnlyProxy = getReadOnlyProxy;
|
1810
1811
|
exports.hasScopedStaticStylesheets = hasScopedStaticStylesheets;
|
1811
1812
|
exports.hot = hot;
|
1812
1813
|
exports.htmlEscape = htmlEscape;
|
@@ -1839,5 +1840,5 @@ exports.track = track;
|
|
1839
1840
|
exports.unwrap = unwrap$1;
|
1840
1841
|
exports.validateStyleTextContents = validateStyleTextContents;
|
1841
1842
|
exports.wire = wire;
|
1842
|
-
/** version: 8.12.
|
1843
|
+
/** version: 8.12.5 */
|
1843
1844
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
export * from './stubs';
|
2
2
|
export { htmlEscape, setHooks, sanitizeHtmlContent, normalizeClass } from '@lwc/shared';
|
3
3
|
export { ClassList } from './class-list';
|
4
|
-
export { getReadOnlyProxy } from './get-read-only-proxy';
|
5
4
|
export { LightningElement, LightningElementConstructor, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, } from './lightning-element';
|
6
5
|
export { mutationTracker } from './mutation-tracker';
|
7
6
|
export { fallbackTmpl, fallbackTmplNoYield, GenerateMarkupFn, renderAttrs, renderAttrsNoYield, serverSideRenderComponent, serverSideRenderComponent as renderComponent, } from './render';
|
package/dist/index.js
CHANGED
@@ -627,7 +627,7 @@ function setHooks(hooks) {
|
|
627
627
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
628
628
|
*/
|
629
629
|
const DEFAULT_SSR_MODE = 'sync';
|
630
|
-
/** version: 8.12.
|
630
|
+
/** version: 8.12.5 */
|
631
631
|
|
632
632
|
/*
|
633
633
|
* Copyright (c) 2024, Salesforce, Inc.
|
@@ -705,6 +705,205 @@ class ClassList {
|
|
705
705
|
}
|
706
706
|
}
|
707
707
|
|
708
|
+
/******************************************************************************
|
709
|
+
Copyright (c) Microsoft Corporation.
|
710
|
+
|
711
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
712
|
+
purpose with or without fee is hereby granted.
|
713
|
+
|
714
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
715
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
716
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
717
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
718
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
719
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
720
|
+
PERFORMANCE OF THIS SOFTWARE.
|
721
|
+
***************************************************************************** */
|
722
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
723
|
+
|
724
|
+
|
725
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
726
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
727
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
728
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
729
|
+
}
|
730
|
+
|
731
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
732
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
733
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
734
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
735
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
736
|
+
}
|
737
|
+
|
738
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
739
|
+
var e = new Error(message);
|
740
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
741
|
+
};
|
742
|
+
|
743
|
+
/*
|
744
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
745
|
+
* All rights reserved.
|
746
|
+
* SPDX-License-Identifier: MIT
|
747
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
748
|
+
*/
|
749
|
+
var _MutationTracker_enabledSet, _MutationTracker_mutationMap;
|
750
|
+
class MutationTracker {
|
751
|
+
constructor() {
|
752
|
+
_MutationTracker_enabledSet.set(this, new WeakSet());
|
753
|
+
_MutationTracker_mutationMap.set(this, new WeakMap());
|
754
|
+
}
|
755
|
+
add(instance, attrName) {
|
756
|
+
if (__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").has(instance)) {
|
757
|
+
let mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
|
758
|
+
if (!mutatedAttrs) {
|
759
|
+
mutatedAttrs = new Set();
|
760
|
+
__classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").set(instance, mutatedAttrs);
|
761
|
+
}
|
762
|
+
mutatedAttrs.add(attrName.toLowerCase());
|
763
|
+
}
|
764
|
+
}
|
765
|
+
enable(instance) {
|
766
|
+
__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").add(instance);
|
767
|
+
}
|
768
|
+
disable(instance) {
|
769
|
+
__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").delete(instance);
|
770
|
+
}
|
771
|
+
renderMutatedAttrs(instance) {
|
772
|
+
const mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
|
773
|
+
if (mutatedAttrs) {
|
774
|
+
return ` data-lwc-host-mutated="${[...mutatedAttrs].sort().join(' ')}"`;
|
775
|
+
}
|
776
|
+
else {
|
777
|
+
return '';
|
778
|
+
}
|
779
|
+
}
|
780
|
+
}
|
781
|
+
_MutationTracker_enabledSet = new WeakMap(), _MutationTracker_mutationMap = new WeakMap();
|
782
|
+
const mutationTracker = new MutationTracker();
|
783
|
+
|
784
|
+
/*
|
785
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
786
|
+
* All rights reserved.
|
787
|
+
* SPDX-License-Identifier: MIT
|
788
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
789
|
+
*/
|
790
|
+
/**
|
791
|
+
* Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
|
792
|
+
*/
|
793
|
+
const stringDescriptor = (attrName) => ({
|
794
|
+
configurable: true,
|
795
|
+
enumerable: true,
|
796
|
+
get() {
|
797
|
+
return this.getAttribute(attrName);
|
798
|
+
},
|
799
|
+
set(newValue) {
|
800
|
+
const currentValue = this.getAttribute(attrName);
|
801
|
+
const normalizedValue = String(newValue);
|
802
|
+
if (normalizedValue !== currentValue) {
|
803
|
+
this.setAttribute(attrName, normalizedValue);
|
804
|
+
}
|
805
|
+
},
|
806
|
+
});
|
807
|
+
/** Descriptor for a boolean that checks for `attr="true"` or `attr="false"`, e.g. `spellcheck` and `draggable`. */
|
808
|
+
const explicitBooleanDescriptor = (attrName, defaultValue) => ({
|
809
|
+
configurable: true,
|
810
|
+
enumerable: true,
|
811
|
+
get() {
|
812
|
+
const value = this.getAttribute(attrName);
|
813
|
+
if (value === null)
|
814
|
+
return defaultValue;
|
815
|
+
// spellcheck=false => false, everything else => true
|
816
|
+
// draggable=true => true, everything else => false
|
817
|
+
return value.toLowerCase() === String(defaultValue) ? defaultValue : !defaultValue;
|
818
|
+
},
|
819
|
+
set(newValue) {
|
820
|
+
const currentValue = this.getAttribute(attrName);
|
821
|
+
const normalizedValue = String(Boolean(newValue));
|
822
|
+
if (normalizedValue !== currentValue) {
|
823
|
+
this.setAttribute(attrName, normalizedValue);
|
824
|
+
}
|
825
|
+
},
|
826
|
+
});
|
827
|
+
/**
|
828
|
+
* Descriptor for a "true" boolean attribute that checks solely for presence, e.g. `hidden`.
|
829
|
+
*/
|
830
|
+
const booleanAttributeDescriptor = (attrName) => ({
|
831
|
+
configurable: true,
|
832
|
+
enumerable: true,
|
833
|
+
get() {
|
834
|
+
return this.hasAttribute(attrName);
|
835
|
+
},
|
836
|
+
set(newValue) {
|
837
|
+
const hasAttribute = this.hasAttribute(attrName);
|
838
|
+
if (newValue) {
|
839
|
+
if (!hasAttribute) {
|
840
|
+
this.setAttribute(attrName, '');
|
841
|
+
}
|
842
|
+
}
|
843
|
+
else {
|
844
|
+
if (hasAttribute) {
|
845
|
+
this.removeAttribute(attrName);
|
846
|
+
}
|
847
|
+
}
|
848
|
+
},
|
849
|
+
});
|
850
|
+
/**
|
851
|
+
* Descriptor for ARIA reflections, e.g. `ariaLabel` and `role`.
|
852
|
+
*/
|
853
|
+
const ariaDescriptor = (attrName) => ({
|
854
|
+
configurable: true,
|
855
|
+
enumerable: true,
|
856
|
+
get() {
|
857
|
+
return this.getAttribute(attrName);
|
858
|
+
},
|
859
|
+
set(newValue) {
|
860
|
+
const currentValue = this.getAttribute(attrName);
|
861
|
+
if (newValue !== currentValue) {
|
862
|
+
// TODO [#3284]: According to the spec, IDL nullable type values
|
863
|
+
// (null and undefined) should remove the attribute; however, we
|
864
|
+
// only do so in the case of null for historical reasons.
|
865
|
+
if (isNull(newValue)) {
|
866
|
+
this.removeAttribute(attrName);
|
867
|
+
}
|
868
|
+
else {
|
869
|
+
this.setAttribute(attrName, toString(newValue));
|
870
|
+
}
|
871
|
+
}
|
872
|
+
},
|
873
|
+
});
|
874
|
+
const tabIndexDescriptor = () => ({
|
875
|
+
configurable: true,
|
876
|
+
enumerable: true,
|
877
|
+
get() {
|
878
|
+
const str = this.getAttribute('tabindex');
|
879
|
+
const num = Number(str);
|
880
|
+
return isFinite(num) ? Math.trunc(num) : -1;
|
881
|
+
},
|
882
|
+
set(newValue) {
|
883
|
+
const currentValue = this.getAttribute('tabindex');
|
884
|
+
const num = Number(newValue);
|
885
|
+
const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
|
886
|
+
if (normalizedValue !== currentValue) {
|
887
|
+
this.setAttribute('tabindex', toString(newValue));
|
888
|
+
}
|
889
|
+
},
|
890
|
+
});
|
891
|
+
const descriptors = {
|
892
|
+
accessKey: stringDescriptor('accesskey'),
|
893
|
+
dir: stringDescriptor('dir'),
|
894
|
+
draggable: explicitBooleanDescriptor('draggable', true),
|
895
|
+
hidden: booleanAttributeDescriptor('hidden'),
|
896
|
+
id: stringDescriptor('id'),
|
897
|
+
lang: stringDescriptor('lang'),
|
898
|
+
spellcheck: explicitBooleanDescriptor('spellcheck', false),
|
899
|
+
tabIndex: tabIndexDescriptor(),
|
900
|
+
title: stringDescriptor('title'),
|
901
|
+
};
|
902
|
+
// Add descriptors for ARIA attributes
|
903
|
+
for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
|
904
|
+
descriptors[propName] = ariaDescriptor(attrName);
|
905
|
+
}
|
906
|
+
|
708
907
|
/**
|
709
908
|
* Copyright (C) 2017 salesforce.com, inc.
|
710
909
|
*/
|
@@ -1132,205 +1331,6 @@ function getReadOnlyProxy(value) {
|
|
1132
1331
|
return reactiveMembrane.getReadOnlyProxy(value);
|
1133
1332
|
}
|
1134
1333
|
|
1135
|
-
/******************************************************************************
|
1136
|
-
Copyright (c) Microsoft Corporation.
|
1137
|
-
|
1138
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
1139
|
-
purpose with or without fee is hereby granted.
|
1140
|
-
|
1141
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
1142
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
1143
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
1144
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
1145
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
1146
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
1147
|
-
PERFORMANCE OF THIS SOFTWARE.
|
1148
|
-
***************************************************************************** */
|
1149
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
1150
|
-
|
1151
|
-
|
1152
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
1153
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
1154
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
1155
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
1156
|
-
}
|
1157
|
-
|
1158
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
1159
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
1160
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
1161
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
1162
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
1163
|
-
}
|
1164
|
-
|
1165
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
1166
|
-
var e = new Error(message);
|
1167
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
1168
|
-
};
|
1169
|
-
|
1170
|
-
/*
|
1171
|
-
* Copyright (c) 2024, Salesforce, Inc.
|
1172
|
-
* All rights reserved.
|
1173
|
-
* SPDX-License-Identifier: MIT
|
1174
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1175
|
-
*/
|
1176
|
-
var _MutationTracker_enabledSet, _MutationTracker_mutationMap;
|
1177
|
-
class MutationTracker {
|
1178
|
-
constructor() {
|
1179
|
-
_MutationTracker_enabledSet.set(this, new WeakSet());
|
1180
|
-
_MutationTracker_mutationMap.set(this, new WeakMap());
|
1181
|
-
}
|
1182
|
-
add(instance, attrName) {
|
1183
|
-
if (__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").has(instance)) {
|
1184
|
-
let mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
|
1185
|
-
if (!mutatedAttrs) {
|
1186
|
-
mutatedAttrs = new Set();
|
1187
|
-
__classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").set(instance, mutatedAttrs);
|
1188
|
-
}
|
1189
|
-
mutatedAttrs.add(attrName.toLowerCase());
|
1190
|
-
}
|
1191
|
-
}
|
1192
|
-
enable(instance) {
|
1193
|
-
__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").add(instance);
|
1194
|
-
}
|
1195
|
-
disable(instance) {
|
1196
|
-
__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").delete(instance);
|
1197
|
-
}
|
1198
|
-
renderMutatedAttrs(instance) {
|
1199
|
-
const mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
|
1200
|
-
if (mutatedAttrs) {
|
1201
|
-
return ` data-lwc-host-mutated="${[...mutatedAttrs].sort().join(' ')}"`;
|
1202
|
-
}
|
1203
|
-
else {
|
1204
|
-
return '';
|
1205
|
-
}
|
1206
|
-
}
|
1207
|
-
}
|
1208
|
-
_MutationTracker_enabledSet = new WeakMap(), _MutationTracker_mutationMap = new WeakMap();
|
1209
|
-
const mutationTracker = new MutationTracker();
|
1210
|
-
|
1211
|
-
/*
|
1212
|
-
* Copyright (c) 2024, Salesforce, Inc.
|
1213
|
-
* All rights reserved.
|
1214
|
-
* SPDX-License-Identifier: MIT
|
1215
|
-
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1216
|
-
*/
|
1217
|
-
/**
|
1218
|
-
* Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
|
1219
|
-
*/
|
1220
|
-
const stringDescriptor = (attrName) => ({
|
1221
|
-
configurable: true,
|
1222
|
-
enumerable: true,
|
1223
|
-
get() {
|
1224
|
-
return this.getAttribute(attrName);
|
1225
|
-
},
|
1226
|
-
set(newValue) {
|
1227
|
-
const currentValue = this.getAttribute(attrName);
|
1228
|
-
const normalizedValue = String(newValue);
|
1229
|
-
if (normalizedValue !== currentValue) {
|
1230
|
-
this.setAttribute(attrName, normalizedValue);
|
1231
|
-
}
|
1232
|
-
},
|
1233
|
-
});
|
1234
|
-
/** Descriptor for a boolean that checks for `attr="true"` or `attr="false"`, e.g. `spellcheck` and `draggable`. */
|
1235
|
-
const explicitBooleanDescriptor = (attrName, defaultValue) => ({
|
1236
|
-
configurable: true,
|
1237
|
-
enumerable: true,
|
1238
|
-
get() {
|
1239
|
-
const value = this.getAttribute(attrName);
|
1240
|
-
if (value === null)
|
1241
|
-
return defaultValue;
|
1242
|
-
// spellcheck=false => false, everything else => true
|
1243
|
-
// draggable=true => true, everything else => false
|
1244
|
-
return value.toLowerCase() === String(defaultValue) ? defaultValue : !defaultValue;
|
1245
|
-
},
|
1246
|
-
set(newValue) {
|
1247
|
-
const currentValue = this.getAttribute(attrName);
|
1248
|
-
const normalizedValue = String(Boolean(newValue));
|
1249
|
-
if (normalizedValue !== currentValue) {
|
1250
|
-
this.setAttribute(attrName, normalizedValue);
|
1251
|
-
}
|
1252
|
-
},
|
1253
|
-
});
|
1254
|
-
/**
|
1255
|
-
* Descriptor for a "true" boolean attribute that checks solely for presence, e.g. `hidden`.
|
1256
|
-
*/
|
1257
|
-
const booleanAttributeDescriptor = (attrName) => ({
|
1258
|
-
configurable: true,
|
1259
|
-
enumerable: true,
|
1260
|
-
get() {
|
1261
|
-
return this.hasAttribute(attrName);
|
1262
|
-
},
|
1263
|
-
set(newValue) {
|
1264
|
-
const hasAttribute = this.hasAttribute(attrName);
|
1265
|
-
if (newValue) {
|
1266
|
-
if (!hasAttribute) {
|
1267
|
-
this.setAttribute(attrName, '');
|
1268
|
-
}
|
1269
|
-
}
|
1270
|
-
else {
|
1271
|
-
if (hasAttribute) {
|
1272
|
-
this.removeAttribute(attrName);
|
1273
|
-
}
|
1274
|
-
}
|
1275
|
-
},
|
1276
|
-
});
|
1277
|
-
/**
|
1278
|
-
* Descriptor for ARIA reflections, e.g. `ariaLabel` and `role`.
|
1279
|
-
*/
|
1280
|
-
const ariaDescriptor = (attrName) => ({
|
1281
|
-
configurable: true,
|
1282
|
-
enumerable: true,
|
1283
|
-
get() {
|
1284
|
-
return this.getAttribute(attrName);
|
1285
|
-
},
|
1286
|
-
set(newValue) {
|
1287
|
-
const currentValue = this.getAttribute(attrName);
|
1288
|
-
if (newValue !== currentValue) {
|
1289
|
-
// TODO [#3284]: According to the spec, IDL nullable type values
|
1290
|
-
// (null and undefined) should remove the attribute; however, we
|
1291
|
-
// only do so in the case of null for historical reasons.
|
1292
|
-
if (isNull(newValue)) {
|
1293
|
-
this.removeAttribute(attrName);
|
1294
|
-
}
|
1295
|
-
else {
|
1296
|
-
this.setAttribute(attrName, toString(newValue));
|
1297
|
-
}
|
1298
|
-
}
|
1299
|
-
},
|
1300
|
-
});
|
1301
|
-
const tabIndexDescriptor = () => ({
|
1302
|
-
configurable: true,
|
1303
|
-
enumerable: true,
|
1304
|
-
get() {
|
1305
|
-
const str = this.getAttribute('tabindex');
|
1306
|
-
const num = Number(str);
|
1307
|
-
return isFinite(num) ? Math.trunc(num) : -1;
|
1308
|
-
},
|
1309
|
-
set(newValue) {
|
1310
|
-
const currentValue = this.getAttribute('tabindex');
|
1311
|
-
const num = Number(newValue);
|
1312
|
-
const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
|
1313
|
-
if (normalizedValue !== currentValue) {
|
1314
|
-
this.setAttribute('tabindex', toString(newValue));
|
1315
|
-
}
|
1316
|
-
},
|
1317
|
-
});
|
1318
|
-
const descriptors = {
|
1319
|
-
accessKey: stringDescriptor('accesskey'),
|
1320
|
-
dir: stringDescriptor('dir'),
|
1321
|
-
draggable: explicitBooleanDescriptor('draggable', true),
|
1322
|
-
hidden: booleanAttributeDescriptor('hidden'),
|
1323
|
-
id: stringDescriptor('id'),
|
1324
|
-
lang: stringDescriptor('lang'),
|
1325
|
-
spellcheck: explicitBooleanDescriptor('spellcheck', false),
|
1326
|
-
tabIndex: tabIndexDescriptor(),
|
1327
|
-
title: stringDescriptor('title'),
|
1328
|
-
};
|
1329
|
-
// Add descriptors for ARIA attributes
|
1330
|
-
for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
|
1331
|
-
descriptors[propName] = ariaDescriptor(attrName);
|
1332
|
-
}
|
1333
|
-
|
1334
1334
|
/*
|
1335
1335
|
* Copyright (c) 2024, salesforce.com, inc.
|
1336
1336
|
* All rights reserved.
|
@@ -1361,7 +1361,9 @@ class LightningElement {
|
|
1361
1361
|
if (publicFields.has(propName) ||
|
1362
1362
|
((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
|
1363
1363
|
!privateFields.has(propName))) {
|
1364
|
-
|
1364
|
+
// For props passed from parents to children, they are intended to be read-only
|
1365
|
+
// to avoid a child mutating its parent's state
|
1366
|
+
this[propName] = getReadOnlyProxy(props[propName]);
|
1365
1367
|
}
|
1366
1368
|
}
|
1367
1369
|
}
|
@@ -1484,7 +1486,6 @@ defineProperties(LightningElement.prototype, descriptors);
|
|
1484
1486
|
* SPDX-License-Identifier: MIT
|
1485
1487
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1486
1488
|
*/
|
1487
|
-
const escapeAttrVal = (attrValue) => attrValue.replaceAll('&', '&').replaceAll('"', '"');
|
1488
1489
|
function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
|
1489
1490
|
// The scopeToken is e.g. `lwc-xyz123` which is the token our parent gives us.
|
1490
1491
|
// The hostScopeToken is e.g. `lwc-abc456-host` which is the token for our own component.
|
@@ -1518,7 +1519,8 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
|
|
1518
1519
|
hasClassAttribute = true;
|
1519
1520
|
}
|
1520
1521
|
}
|
1521
|
-
result +=
|
1522
|
+
result +=
|
1523
|
+
attrValue === '' ? ` ${attrName}` : ` ${attrName}="${htmlEscape(attrValue, true)}"`;
|
1522
1524
|
}
|
1523
1525
|
// If we didn't render any `class` attribute, render one for the scope token(s)
|
1524
1526
|
if (!hasClassAttribute && combinedScopeToken) {
|
@@ -1537,12 +1539,12 @@ function* renderAttrs(instance, attrs, hostScopeToken, scopeToken) {
|
|
1537
1539
|
function renderAttrsNoYield(emit, instance, attrs, hostScopeToken, scopeToken) {
|
1538
1540
|
emit(renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken));
|
1539
1541
|
}
|
1540
|
-
function* fallbackTmpl(_shadowSlottedContent, _lightSlottedContent, Cmp, _instance) {
|
1542
|
+
function* fallbackTmpl(_shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, _instance) {
|
1541
1543
|
if (Cmp.renderMode !== 'light') {
|
1542
1544
|
yield '<template shadowrootmode="open"></template>';
|
1543
1545
|
}
|
1544
1546
|
}
|
1545
|
-
function fallbackTmplNoYield(emit, _shadowSlottedContent, _lightSlottedContent, Cmp, _instance) {
|
1547
|
+
function fallbackTmplNoYield(emit, _shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, _instance) {
|
1546
1548
|
if (Cmp.renderMode !== 'light') {
|
1547
1549
|
emit('<template shadowrootmode="open"></template>');
|
1548
1550
|
}
|
@@ -1557,15 +1559,15 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
|
|
1557
1559
|
markup += segment;
|
1558
1560
|
};
|
1559
1561
|
if (mode === 'asyncYield') {
|
1560
|
-
for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null)) {
|
1562
|
+
for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null, null)) {
|
1561
1563
|
markup += segment;
|
1562
1564
|
}
|
1563
1565
|
}
|
1564
1566
|
else if (mode === 'async') {
|
1565
|
-
await generateMarkup(emit, tagName, props, null, null, null, null, null, null);
|
1567
|
+
await generateMarkup(emit, tagName, props, null, null, null, null, null, null, null);
|
1566
1568
|
}
|
1567
1569
|
else if (mode === 'sync') {
|
1568
|
-
generateMarkup(emit, tagName, props, null, null, null, null, null, null);
|
1570
|
+
generateMarkup(emit, tagName, props, null, null, null, null, null, null, null);
|
1569
1571
|
}
|
1570
1572
|
else {
|
1571
1573
|
throw new Error(`Invalid mode: ${mode}`);
|
@@ -1788,6 +1790,6 @@ function createContextProvider(adapter) {
|
|
1788
1790
|
};
|
1789
1791
|
}
|
1790
1792
|
|
1791
|
-
export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, freezeTemplate, getComponentDef,
|
1792
|
-
/** version: 8.12.
|
1793
|
+
export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, freezeTemplate, getComponentDef, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, mutationTracker, normalizeClass, normalizeTextContent, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, renderAttrs, renderAttrsNoYield, serverSideRenderComponent as renderComponent, renderStylesheets, renderTextContent, renderer, sanitizeAttribute, sanitizeHtmlContent, serverSideRenderComponent, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap$1 as unwrap, validateStyleTextContents, wire };
|
1794
|
+
/** version: 8.12.5 */
|
1793
1795
|
//# sourceMappingURL=index.js.map
|
package/dist/render.d.ts
CHANGED
@@ -3,11 +3,11 @@ import type { LightningElement, LightningElementConstructor } from './lightning-
|
|
3
3
|
import type { Attributes, Properties } from './types';
|
4
4
|
export declare function renderAttrs(instance: LightningElement, attrs: Attributes, hostScopeToken: string | undefined, scopeToken: string | undefined): Generator<string, void, unknown>;
|
5
5
|
export declare function renderAttrsNoYield(emit: (segment: string) => void, instance: LightningElement, attrs: Attributes, hostScopeToken: string | undefined, scopeToken: string | undefined): void;
|
6
|
-
export declare function fallbackTmpl(_shadowSlottedContent: unknown, _lightSlottedContent: unknown, Cmp: LightningElementConstructor, _instance: unknown): Generator<string, void, unknown>;
|
7
|
-
export declare function fallbackTmplNoYield(emit: (segment: string) => void, _shadowSlottedContent: unknown, _lightSlottedContent: unknown, Cmp: LightningElementConstructor, _instance: unknown): void;
|
8
|
-
export type GenerateMarkupFn = (tagName: string, props: Properties | null, attrs: Attributes | null, shadowSlottedContent: AsyncGenerator<string> | null, lightSlottedContent: Record<number | string, AsyncGenerator<string>> | null, parent: LightningElement | null, scopeToken: string | null, contextfulParent: LightningElement | null) => AsyncGenerator<string>;
|
9
|
-
export type GenerateMarkupFnAsyncNoGen = (emit: (segment: string) => void, tagName: string, props: Properties | null, attrs: Attributes | null, shadowSlottedContent: AsyncGenerator<string> | null, lightSlottedContent: Record<number | string, AsyncGenerator<string>> | null, parent: LightningElement | null, scopeToken: string | null, contextfulParent: LightningElement | null) => Promise<void>;
|
10
|
-
export type GenerateMarkupFnSyncNoGen = (emit: (segment: string) => void, tagName: string, props: Properties | null, attrs: Attributes | null, shadowSlottedContent: AsyncGenerator<string> | null, lightSlottedContent: Record<number | string, AsyncGenerator<string>> | null, parent: LightningElement | null, scopeToken: string | null, contextfulParent: LightningElement | null) => void;
|
6
|
+
export declare function fallbackTmpl(_shadowSlottedContent: unknown, _lightSlottedContent: unknown, _scopedSlottedContent: unknown, Cmp: LightningElementConstructor, _instance: unknown): Generator<string, void, unknown>;
|
7
|
+
export declare function fallbackTmplNoYield(emit: (segment: string) => void, _shadowSlottedContent: unknown, _lightSlottedContent: unknown, _scopedSlottedContent: unknown, Cmp: LightningElementConstructor, _instance: unknown): void;
|
8
|
+
export type GenerateMarkupFn = (tagName: string, props: Properties | null, attrs: Attributes | null, shadowSlottedContent: AsyncGenerator<string> | null, lightSlottedContent: Record<number | string, AsyncGenerator<string>> | null, scopedSlottedContent: Record<number | string, AsyncGenerator<string>> | null, parent: LightningElement | null, scopeToken: string | null, contextfulParent: LightningElement | null) => AsyncGenerator<string>;
|
9
|
+
export type GenerateMarkupFnAsyncNoGen = (emit: (segment: string) => void, tagName: string, props: Properties | null, attrs: Attributes | null, shadowSlottedContent: AsyncGenerator<string> | null, lightSlottedContent: Record<number | string, AsyncGenerator<string>> | null, scopedSlottedContent: Record<number | string, AsyncGenerator<string>> | null, parent: LightningElement | null, scopeToken: string | null, contextfulParent: LightningElement | null) => Promise<void>;
|
10
|
+
export type GenerateMarkupFnSyncNoGen = (emit: (segment: string) => void, tagName: string, props: Properties | null, attrs: Attributes | null, shadowSlottedContent: AsyncGenerator<string> | null, lightSlottedContent: Record<number | string, AsyncGenerator<string>> | null, scopedSlottedContent: Record<number | string, AsyncGenerator<string>> | null, parent: LightningElement | null, scopeToken: string | null, contextfulParent: LightningElement | null) => void;
|
11
11
|
type GenerateMarkupFnVariants = GenerateMarkupFn | GenerateMarkupFnAsyncNoGen | GenerateMarkupFnSyncNoGen;
|
12
12
|
interface ComponentWithGenerateMarkup {
|
13
13
|
[SYMBOL__GENERATE_MARKUP]: GenerateMarkupFnVariants;
|
package/package.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
|
5
5
|
],
|
6
6
|
"name": "@lwc/ssr-runtime",
|
7
|
-
"version": "8.12.
|
7
|
+
"version": "8.12.6-alpha.0",
|
8
8
|
"description": "Runtime complement to @lwc/ssr-compiler",
|
9
9
|
"keywords": [
|
10
10
|
"lwc",
|
@@ -48,8 +48,8 @@
|
|
48
48
|
}
|
49
49
|
},
|
50
50
|
"devDependencies": {
|
51
|
-
"@lwc/shared": "8.12.
|
52
|
-
"@lwc/engine-core": "8.12.
|
51
|
+
"@lwc/shared": "8.12.6-alpha.0",
|
52
|
+
"@lwc/engine-core": "8.12.6-alpha.0",
|
53
53
|
"observable-membrane": "2.0.0"
|
54
54
|
}
|
55
|
-
}
|
55
|
+
}
|