@lwc/ssr-runtime 8.12.7-alpha.0 → 8.12.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/class-list.d.ts +2 -1
- package/dist/get-read-only-proxy.d.ts +1 -0
- package/dist/index.cjs.js +260 -250
- package/dist/index.d.ts +2 -3
- package/dist/index.js +259 -248
- package/dist/lightning-element.d.ts +4 -3
- package/dist/mutation-tracker.d.ts +1 -0
- package/dist/reflection.d.ts +1 -7
- package/dist/render-text-content.d.ts +10 -2
- package/dist/render.d.ts +6 -5
- package/dist/stubs.d.ts +1 -0
- package/dist/styles.d.ts +1 -0
- package/dist/to-iterator-directive.d.ts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/validate-style-text-contents.d.ts +1 -0
- package/dist/wire.d.ts +1 -0
- package/package.json +4 -4
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.7 */
|
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,256 +1331,49 @@ 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
|
-
* Filters out the following types of properties that should not be set.
|
1219
|
-
* - Properties that are not public.
|
1220
|
-
* - Properties that are not global.
|
1221
|
-
* - Properties that are global but are internally overridden.
|
1222
|
-
*/
|
1223
|
-
function filterProperties(props, publicFields, privateFields) {
|
1224
|
-
const propsToAssign = create(null);
|
1225
|
-
const publicFieldSet = new Set(publicFields);
|
1226
|
-
const privateFieldSet = new Set(privateFields);
|
1227
|
-
keys(props).forEach((propName) => {
|
1228
|
-
const attrName = htmlPropertyToAttribute(propName);
|
1229
|
-
if (publicFieldSet.has(propName) ||
|
1230
|
-
((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
|
1231
|
-
!privateFieldSet.has(propName))) {
|
1232
|
-
propsToAssign[propName] = props[propName];
|
1233
|
-
}
|
1234
|
-
});
|
1235
|
-
return propsToAssign;
|
1236
|
-
}
|
1237
|
-
/**
|
1238
|
-
* Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
|
1239
|
-
*/
|
1240
|
-
const stringDescriptor = (attrName) => ({
|
1241
|
-
configurable: true,
|
1242
|
-
enumerable: true,
|
1243
|
-
get() {
|
1244
|
-
return this.getAttribute(attrName);
|
1245
|
-
},
|
1246
|
-
set(newValue) {
|
1247
|
-
const currentValue = this.getAttribute(attrName);
|
1248
|
-
const normalizedValue = String(newValue);
|
1249
|
-
if (normalizedValue !== currentValue) {
|
1250
|
-
this.setAttribute(attrName, normalizedValue);
|
1251
|
-
}
|
1252
|
-
},
|
1253
|
-
});
|
1254
|
-
/** Descriptor for a boolean that checks for `attr="true"` or `attr="false"`, e.g. `spellcheck` and `draggable`. */
|
1255
|
-
const explicitBooleanDescriptor = (attrName, defaultValue) => ({
|
1256
|
-
configurable: true,
|
1257
|
-
enumerable: true,
|
1258
|
-
get() {
|
1259
|
-
const value = this.getAttribute(attrName);
|
1260
|
-
if (value === null)
|
1261
|
-
return defaultValue;
|
1262
|
-
// spellcheck=false => false, everything else => true
|
1263
|
-
// draggable=true => true, everything else => false
|
1264
|
-
return value.toLowerCase() === String(defaultValue) ? defaultValue : !defaultValue;
|
1265
|
-
},
|
1266
|
-
set(newValue) {
|
1267
|
-
const currentValue = this.getAttribute(attrName);
|
1268
|
-
const normalizedValue = String(Boolean(newValue));
|
1269
|
-
if (normalizedValue !== currentValue) {
|
1270
|
-
this.setAttribute(attrName, normalizedValue);
|
1271
|
-
}
|
1272
|
-
},
|
1273
|
-
});
|
1274
|
-
/**
|
1275
|
-
* Descriptor for a "true" boolean attribute that checks solely for presence, e.g. `hidden`.
|
1276
|
-
*/
|
1277
|
-
const booleanAttributeDescriptor = (attrName) => ({
|
1278
|
-
configurable: true,
|
1279
|
-
enumerable: true,
|
1280
|
-
get() {
|
1281
|
-
return this.hasAttribute(attrName);
|
1282
|
-
},
|
1283
|
-
set(newValue) {
|
1284
|
-
const hasAttribute = this.hasAttribute(attrName);
|
1285
|
-
if (newValue) {
|
1286
|
-
if (!hasAttribute) {
|
1287
|
-
this.setAttribute(attrName, '');
|
1288
|
-
}
|
1289
|
-
}
|
1290
|
-
else {
|
1291
|
-
if (hasAttribute) {
|
1292
|
-
this.removeAttribute(attrName);
|
1293
|
-
}
|
1294
|
-
}
|
1295
|
-
},
|
1296
|
-
});
|
1297
|
-
/**
|
1298
|
-
* Descriptor for ARIA reflections, e.g. `ariaLabel` and `role`.
|
1299
|
-
*/
|
1300
|
-
const ariaDescriptor = (attrName) => ({
|
1301
|
-
configurable: true,
|
1302
|
-
enumerable: true,
|
1303
|
-
get() {
|
1304
|
-
return this.getAttribute(attrName);
|
1305
|
-
},
|
1306
|
-
set(newValue) {
|
1307
|
-
const currentValue = this.getAttribute(attrName);
|
1308
|
-
if (newValue !== currentValue) {
|
1309
|
-
// TODO [#3284]: According to the spec, IDL nullable type values
|
1310
|
-
// (null and undefined) should remove the attribute; however, we
|
1311
|
-
// only do so in the case of null for historical reasons.
|
1312
|
-
if (isNull(newValue)) {
|
1313
|
-
this.removeAttribute(attrName);
|
1314
|
-
}
|
1315
|
-
else {
|
1316
|
-
this.setAttribute(attrName, toString(newValue));
|
1317
|
-
}
|
1318
|
-
}
|
1319
|
-
},
|
1320
|
-
});
|
1321
|
-
const tabIndexDescriptor = () => ({
|
1322
|
-
configurable: true,
|
1323
|
-
enumerable: true,
|
1324
|
-
get() {
|
1325
|
-
const str = this.getAttribute('tabindex');
|
1326
|
-
const num = Number(str);
|
1327
|
-
return isFinite(num) ? Math.trunc(num) : -1;
|
1328
|
-
},
|
1329
|
-
set(newValue) {
|
1330
|
-
const currentValue = this.getAttribute('tabindex');
|
1331
|
-
const num = Number(newValue);
|
1332
|
-
const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
|
1333
|
-
if (normalizedValue !== currentValue) {
|
1334
|
-
this.setAttribute('tabindex', toString(newValue));
|
1335
|
-
}
|
1336
|
-
},
|
1337
|
-
});
|
1338
|
-
const descriptors = {
|
1339
|
-
accessKey: stringDescriptor('accesskey'),
|
1340
|
-
dir: stringDescriptor('dir'),
|
1341
|
-
draggable: explicitBooleanDescriptor('draggable', true),
|
1342
|
-
hidden: booleanAttributeDescriptor('hidden'),
|
1343
|
-
id: stringDescriptor('id'),
|
1344
|
-
lang: stringDescriptor('lang'),
|
1345
|
-
spellcheck: explicitBooleanDescriptor('spellcheck', false),
|
1346
|
-
tabIndex: tabIndexDescriptor(),
|
1347
|
-
title: stringDescriptor('title'),
|
1348
|
-
};
|
1349
|
-
// Add descriptors for ARIA attributes
|
1350
|
-
for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
|
1351
|
-
descriptors[propName] = ariaDescriptor(attrName);
|
1352
|
-
}
|
1353
|
-
|
1354
1334
|
/*
|
1355
1335
|
* Copyright (c) 2024, salesforce.com, inc.
|
1356
1336
|
* All rights reserved.
|
1357
1337
|
* SPDX-License-Identifier: MIT
|
1358
1338
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1359
1339
|
*/
|
1360
|
-
var _LightningElement_attrs, _LightningElement_classList;
|
1340
|
+
var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList;
|
1361
1341
|
const SYMBOL__SET_INTERNALS = Symbol('set-internals');
|
1362
1342
|
const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
|
1363
1343
|
const SYMBOL__DEFAULT_TEMPLATE = Symbol('default-template');
|
1364
1344
|
class LightningElement {
|
1365
1345
|
constructor(propsAvailableAtConstruction) {
|
1366
1346
|
this.isConnected = false;
|
1367
|
-
this
|
1368
|
-
_LightningElement_attrs.set(this,
|
1347
|
+
_LightningElement_props.set(this, undefined);
|
1348
|
+
_LightningElement_attrs.set(this, undefined);
|
1369
1349
|
_LightningElement_classList.set(this, null);
|
1370
1350
|
assign(this, propsAvailableAtConstruction);
|
1371
1351
|
}
|
1372
|
-
[(_LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
|
1352
|
+
[(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties, privateProperties) {
|
1353
|
+
__classPrivateFieldSet(this, _LightningElement_props, props, "f");
|
1373
1354
|
__classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1355
|
+
// Avoid setting the following types of properties that should not be set:
|
1356
|
+
// - Properties that are not public.
|
1357
|
+
// - Properties that are not global.
|
1358
|
+
// - Properties that are global but are internally overridden.
|
1359
|
+
for (const propName of keys(props)) {
|
1360
|
+
const attrName = htmlPropertyToAttribute(propName);
|
1361
|
+
if (publicProperties.has(propName) ||
|
1362
|
+
((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
|
1363
|
+
!privateProperties.has(propName))) {
|
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]);
|
1367
|
+
}
|
1368
|
+
}
|
1369
|
+
}
|
1370
|
+
get className() {
|
1371
|
+
return __classPrivateFieldGet(this, _LightningElement_props, "f").class ?? '';
|
1372
|
+
}
|
1373
|
+
set className(newVal) {
|
1374
|
+
__classPrivateFieldGet(this, _LightningElement_props, "f").class = newVal;
|
1375
|
+
__classPrivateFieldGet(this, _LightningElement_attrs, "f").class = newVal;
|
1376
|
+
mutationTracker.add(this, 'class');
|
1385
1377
|
}
|
1386
1378
|
get classList() {
|
1387
1379
|
if (__classPrivateFieldGet(this, _LightningElement_classList, "f")) {
|
@@ -1494,7 +1486,6 @@ defineProperties(LightningElement.prototype, descriptors);
|
|
1494
1486
|
* SPDX-License-Identifier: MIT
|
1495
1487
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1496
1488
|
*/
|
1497
|
-
const escapeAttrVal = (attrValue) => attrValue.replaceAll('&', '&').replaceAll('"', '"');
|
1498
1489
|
function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
|
1499
1490
|
// The scopeToken is e.g. `lwc-xyz123` which is the token our parent gives us.
|
1500
1491
|
// The hostScopeToken is e.g. `lwc-abc456-host` which is the token for our own component.
|
@@ -1528,7 +1519,8 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
|
|
1528
1519
|
hasClassAttribute = true;
|
1529
1520
|
}
|
1530
1521
|
}
|
1531
|
-
result +=
|
1522
|
+
result +=
|
1523
|
+
attrValue === '' ? ` ${attrName}` : ` ${attrName}="${htmlEscape(attrValue, true)}"`;
|
1532
1524
|
}
|
1533
1525
|
// If we didn't render any `class` attribute, render one for the scope token(s)
|
1534
1526
|
if (!hasClassAttribute && combinedScopeToken) {
|
@@ -1547,14 +1539,20 @@ function* renderAttrs(instance, attrs, hostScopeToken, scopeToken) {
|
|
1547
1539
|
function renderAttrsNoYield(emit, instance, attrs, hostScopeToken, scopeToken) {
|
1548
1540
|
emit(renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken));
|
1549
1541
|
}
|
1550
|
-
function* fallbackTmpl(
|
1542
|
+
function* fallbackTmpl(shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, instance) {
|
1551
1543
|
if (Cmp.renderMode !== 'light') {
|
1552
|
-
yield
|
1544
|
+
yield `<template shadowrootmode="open"></template>`;
|
1545
|
+
if (shadowSlottedContent) {
|
1546
|
+
yield shadowSlottedContent(instance);
|
1547
|
+
}
|
1553
1548
|
}
|
1554
1549
|
}
|
1555
|
-
function fallbackTmplNoYield(emit,
|
1550
|
+
function fallbackTmplNoYield(emit, shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, instance) {
|
1556
1551
|
if (Cmp.renderMode !== 'light') {
|
1557
|
-
emit(
|
1552
|
+
emit(`<template shadowrootmode="open"></template>`);
|
1553
|
+
if (shadowSlottedContent) {
|
1554
|
+
shadowSlottedContent(emit, instance);
|
1555
|
+
}
|
1558
1556
|
}
|
1559
1557
|
}
|
1560
1558
|
async function serverSideRenderComponent(tagName, Component, props = {}, mode = DEFAULT_SSR_MODE) {
|
@@ -1567,15 +1565,15 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
|
|
1567
1565
|
markup += segment;
|
1568
1566
|
};
|
1569
1567
|
if (mode === 'asyncYield') {
|
1570
|
-
for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null)) {
|
1568
|
+
for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null, null)) {
|
1571
1569
|
markup += segment;
|
1572
1570
|
}
|
1573
1571
|
}
|
1574
1572
|
else if (mode === 'async') {
|
1575
|
-
await generateMarkup(emit, tagName, props, null, null, null, null, null, null);
|
1573
|
+
await generateMarkup(emit, tagName, props, null, null, null, null, null, null, null);
|
1576
1574
|
}
|
1577
1575
|
else if (mode === 'sync') {
|
1578
|
-
generateMarkup(emit, tagName, props, null, null, null, null, null, null);
|
1576
|
+
generateMarkup(emit, tagName, props, null, null, null, null, null, null, null);
|
1579
1577
|
}
|
1580
1578
|
else {
|
1581
1579
|
throw new Error(`Invalid mode: ${mode}`);
|
@@ -1590,14 +1588,27 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
|
|
1590
1588
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1591
1589
|
*/
|
1592
1590
|
/**
|
1593
|
-
* Given an object, render it for use as a text content node.
|
1591
|
+
* Given an object, render it for use as a text content node. Not that this applies to individual text nodes,
|
1592
|
+
* not the concatenated result of multiple adjacent text nodes.
|
1594
1593
|
* @param value
|
1595
1594
|
*/
|
1596
|
-
function
|
1595
|
+
function normalizeTextContent(value) {
|
1597
1596
|
// Using non strict equality to align with original implementation (ex. undefined == null)
|
1598
1597
|
// See: https://github.com/salesforce/lwc/blob/348130f/packages/%40lwc/engine-core/src/framework/api.ts#L548
|
1599
1598
|
return value == null ? '' : String(value);
|
1600
1599
|
}
|
1600
|
+
/**
|
1601
|
+
* Given a string, render it for use as text content in HTML. Notably this escapes HTML and renders as
|
1602
|
+
* a ZWJ is empty. Intended to be used on the result of concatenating multiple adjacent text nodes together.
|
1603
|
+
* @param value
|
1604
|
+
*/
|
1605
|
+
function renderTextContent(value) {
|
1606
|
+
// We are at the end of a series of text nodes - flush to a concatenated string
|
1607
|
+
// We only render the ZWJ if there were actually any dynamic text nodes rendered
|
1608
|
+
// The ZWJ is just so hydration can compare the SSR'd dynamic text content against
|
1609
|
+
// the CSR'd text content.
|
1610
|
+
return value === '' ? '\u200D' : htmlEscape(value);
|
1611
|
+
}
|
1601
1612
|
|
1602
1613
|
/*
|
1603
1614
|
* Copyright (c) 2024, Salesforce, Inc.
|
@@ -1785,6 +1796,6 @@ function createContextProvider(adapter) {
|
|
1785
1796
|
};
|
1786
1797
|
}
|
1787
1798
|
|
1788
|
-
export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield,
|
1789
|
-
/** version: 8.12.
|
1799
|
+
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 };
|
1800
|
+
/** version: 8.12.7 */
|
1790
1801
|
//# sourceMappingURL=index.js.map
|
@@ -1,4 +1,3 @@
|
|
1
|
-
/// <reference types="node" />
|
2
1
|
import { ClassList } from './class-list';
|
3
2
|
import type { Attributes, Properties } from './types';
|
4
3
|
import type { Stylesheets } from '@lwc/shared';
|
@@ -27,10 +26,11 @@ export declare class LightningElement implements PropsAvailableAtConstruction {
|
|
27
26
|
tabIndex: number;
|
28
27
|
title: string;
|
29
28
|
isConnected: boolean;
|
30
|
-
className: string;
|
31
29
|
tagName: string;
|
32
30
|
constructor(propsAvailableAtConstruction: PropsAvailableAtConstruction & Properties);
|
33
|
-
[SYMBOL__SET_INTERNALS](props: Properties, attrs: Attributes): void;
|
31
|
+
[SYMBOL__SET_INTERNALS](props: Properties, attrs: Attributes, publicProperties: Set<string>, privateProperties: Set<string>): void;
|
32
|
+
get className(): any;
|
33
|
+
set className(newVal: any);
|
34
34
|
get classList(): ClassList;
|
35
35
|
setAttribute(attrName: string, attrValue: string): void;
|
36
36
|
getAttribute(attrName: string): string | null;
|
@@ -113,3 +113,4 @@ export declare class LightningElement implements PropsAvailableAtConstruction {
|
|
113
113
|
role: string | null;
|
114
114
|
}
|
115
115
|
export {};
|
116
|
+
//# sourceMappingURL=lightning-element.d.ts.map
|
package/dist/reflection.d.ts
CHANGED
@@ -1,8 +1,2 @@
|
|
1
|
-
/**
|
2
|
-
* Filters out the following types of properties that should not be set.
|
3
|
-
* - Properties that are not public.
|
4
|
-
* - Properties that are not global.
|
5
|
-
* - Properties that are global but are internally overridden.
|
6
|
-
*/
|
7
|
-
export declare function filterProperties(props: Record<string, unknown>, publicFields: Array<string>, privateFields: Array<string>): Record<string, unknown>;
|
8
1
|
export declare const descriptors: Record<string, PropertyDescriptor>;
|
2
|
+
//# sourceMappingURL=reflection.d.ts.map
|
@@ -1,5 +1,13 @@
|
|
1
1
|
/**
|
2
|
-
* Given an object, render it for use as a text content node.
|
2
|
+
* Given an object, render it for use as a text content node. Not that this applies to individual text nodes,
|
3
|
+
* not the concatenated result of multiple adjacent text nodes.
|
3
4
|
* @param value
|
4
5
|
*/
|
5
|
-
export declare function
|
6
|
+
export declare function normalizeTextContent(value: unknown): string;
|
7
|
+
/**
|
8
|
+
* Given a string, render it for use as text content in HTML. Notably this escapes HTML and renders as
|
9
|
+
* a ZWJ is empty. Intended to be used on the result of concatenating multiple adjacent text nodes together.
|
10
|
+
* @param value
|
11
|
+
*/
|
12
|
+
export declare function renderTextContent(value: string): string;
|
13
|
+
//# sourceMappingURL=render-text-content.d.ts.map
|