@lwc/ssr-runtime 8.12.6-alpha.0 → 8.12.7-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/class-list.d.ts +1 -2
- package/dist/get-read-only-proxy.d.ts +0 -1
- package/dist/index.cjs.js +248 -252
- package/dist/index.d.ts +3 -2
- package/dist/index.js +246 -251
- package/dist/lightning-element.d.ts +2 -4
- package/dist/mutation-tracker.d.ts +0 -1
- package/dist/reflection.d.ts +7 -1
- package/dist/render-text-content.d.ts +2 -10
- package/dist/render.d.ts +5 -6
- package/dist/stubs.d.ts +0 -1
- package/dist/styles.d.ts +0 -1
- package/dist/to-iterator-directive.d.ts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/validate-style-text-contents.d.ts +0 -1
- package/dist/wire.d.ts +0 -1
- package/package.json +3 -3
package/dist/class-list.d.ts
CHANGED
@@ -17,7 +17,7 @@ export declare class ClassList implements DOMTokenList {
|
|
17
17
|
el: LightningElement;
|
18
18
|
constructor(el: LightningElement);
|
19
19
|
add(...newClassNames: string[]): void;
|
20
|
-
contains(className: string):
|
20
|
+
contains(className: string): boolean;
|
21
21
|
remove(...classNamesToRemove: string[]): void;
|
22
22
|
replace(oldClassName: string, newClassName: string): boolean;
|
23
23
|
toggle(classNameToToggle: string, force?: boolean): boolean;
|
@@ -30,4 +30,3 @@ export declare class ClassList implements DOMTokenList {
|
|
30
30
|
get length(): number;
|
31
31
|
}
|
32
32
|
export {};
|
33
|
-
//# sourceMappingURL=class-list.d.ts.map
|
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.2 */
|
635
635
|
|
636
636
|
/*
|
637
637
|
* Copyright (c) 2024, Salesforce, Inc.
|
@@ -709,205 +709,6 @@ 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
|
-
|
911
712
|
/**
|
912
713
|
* Copyright (C) 2017 salesforce.com, inc.
|
913
714
|
*/
|
@@ -1335,49 +1136,256 @@ function getReadOnlyProxy(value) {
|
|
1335
1136
|
return reactiveMembrane.getReadOnlyProxy(value);
|
1336
1137
|
}
|
1337
1138
|
|
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
|
+
* Filters out the following types of properties that should not be set.
|
1223
|
+
* - Properties that are not public.
|
1224
|
+
* - Properties that are not global.
|
1225
|
+
* - Properties that are global but are internally overridden.
|
1226
|
+
*/
|
1227
|
+
function filterProperties(props, publicFields, privateFields) {
|
1228
|
+
const propsToAssign = create(null);
|
1229
|
+
const publicFieldSet = new Set(publicFields);
|
1230
|
+
const privateFieldSet = new Set(privateFields);
|
1231
|
+
keys(props).forEach((propName) => {
|
1232
|
+
const attrName = htmlPropertyToAttribute(propName);
|
1233
|
+
if (publicFieldSet.has(propName) ||
|
1234
|
+
((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
|
1235
|
+
!privateFieldSet.has(propName))) {
|
1236
|
+
propsToAssign[propName] = props[propName];
|
1237
|
+
}
|
1238
|
+
});
|
1239
|
+
return propsToAssign;
|
1240
|
+
}
|
1241
|
+
/**
|
1242
|
+
* Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
|
1243
|
+
*/
|
1244
|
+
const stringDescriptor = (attrName) => ({
|
1245
|
+
configurable: true,
|
1246
|
+
enumerable: true,
|
1247
|
+
get() {
|
1248
|
+
return this.getAttribute(attrName);
|
1249
|
+
},
|
1250
|
+
set(newValue) {
|
1251
|
+
const currentValue = this.getAttribute(attrName);
|
1252
|
+
const normalizedValue = String(newValue);
|
1253
|
+
if (normalizedValue !== currentValue) {
|
1254
|
+
this.setAttribute(attrName, normalizedValue);
|
1255
|
+
}
|
1256
|
+
},
|
1257
|
+
});
|
1258
|
+
/** Descriptor for a boolean that checks for `attr="true"` or `attr="false"`, e.g. `spellcheck` and `draggable`. */
|
1259
|
+
const explicitBooleanDescriptor = (attrName, defaultValue) => ({
|
1260
|
+
configurable: true,
|
1261
|
+
enumerable: true,
|
1262
|
+
get() {
|
1263
|
+
const value = this.getAttribute(attrName);
|
1264
|
+
if (value === null)
|
1265
|
+
return defaultValue;
|
1266
|
+
// spellcheck=false => false, everything else => true
|
1267
|
+
// draggable=true => true, everything else => false
|
1268
|
+
return value.toLowerCase() === String(defaultValue) ? defaultValue : !defaultValue;
|
1269
|
+
},
|
1270
|
+
set(newValue) {
|
1271
|
+
const currentValue = this.getAttribute(attrName);
|
1272
|
+
const normalizedValue = String(Boolean(newValue));
|
1273
|
+
if (normalizedValue !== currentValue) {
|
1274
|
+
this.setAttribute(attrName, normalizedValue);
|
1275
|
+
}
|
1276
|
+
},
|
1277
|
+
});
|
1278
|
+
/**
|
1279
|
+
* Descriptor for a "true" boolean attribute that checks solely for presence, e.g. `hidden`.
|
1280
|
+
*/
|
1281
|
+
const booleanAttributeDescriptor = (attrName) => ({
|
1282
|
+
configurable: true,
|
1283
|
+
enumerable: true,
|
1284
|
+
get() {
|
1285
|
+
return this.hasAttribute(attrName);
|
1286
|
+
},
|
1287
|
+
set(newValue) {
|
1288
|
+
const hasAttribute = this.hasAttribute(attrName);
|
1289
|
+
if (newValue) {
|
1290
|
+
if (!hasAttribute) {
|
1291
|
+
this.setAttribute(attrName, '');
|
1292
|
+
}
|
1293
|
+
}
|
1294
|
+
else {
|
1295
|
+
if (hasAttribute) {
|
1296
|
+
this.removeAttribute(attrName);
|
1297
|
+
}
|
1298
|
+
}
|
1299
|
+
},
|
1300
|
+
});
|
1301
|
+
/**
|
1302
|
+
* Descriptor for ARIA reflections, e.g. `ariaLabel` and `role`.
|
1303
|
+
*/
|
1304
|
+
const ariaDescriptor = (attrName) => ({
|
1305
|
+
configurable: true,
|
1306
|
+
enumerable: true,
|
1307
|
+
get() {
|
1308
|
+
return this.getAttribute(attrName);
|
1309
|
+
},
|
1310
|
+
set(newValue) {
|
1311
|
+
const currentValue = this.getAttribute(attrName);
|
1312
|
+
if (newValue !== currentValue) {
|
1313
|
+
// TODO [#3284]: According to the spec, IDL nullable type values
|
1314
|
+
// (null and undefined) should remove the attribute; however, we
|
1315
|
+
// only do so in the case of null for historical reasons.
|
1316
|
+
if (isNull(newValue)) {
|
1317
|
+
this.removeAttribute(attrName);
|
1318
|
+
}
|
1319
|
+
else {
|
1320
|
+
this.setAttribute(attrName, toString(newValue));
|
1321
|
+
}
|
1322
|
+
}
|
1323
|
+
},
|
1324
|
+
});
|
1325
|
+
const tabIndexDescriptor = () => ({
|
1326
|
+
configurable: true,
|
1327
|
+
enumerable: true,
|
1328
|
+
get() {
|
1329
|
+
const str = this.getAttribute('tabindex');
|
1330
|
+
const num = Number(str);
|
1331
|
+
return isFinite(num) ? Math.trunc(num) : -1;
|
1332
|
+
},
|
1333
|
+
set(newValue) {
|
1334
|
+
const currentValue = this.getAttribute('tabindex');
|
1335
|
+
const num = Number(newValue);
|
1336
|
+
const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
|
1337
|
+
if (normalizedValue !== currentValue) {
|
1338
|
+
this.setAttribute('tabindex', toString(newValue));
|
1339
|
+
}
|
1340
|
+
},
|
1341
|
+
});
|
1342
|
+
const descriptors = {
|
1343
|
+
accessKey: stringDescriptor('accesskey'),
|
1344
|
+
dir: stringDescriptor('dir'),
|
1345
|
+
draggable: explicitBooleanDescriptor('draggable', true),
|
1346
|
+
hidden: booleanAttributeDescriptor('hidden'),
|
1347
|
+
id: stringDescriptor('id'),
|
1348
|
+
lang: stringDescriptor('lang'),
|
1349
|
+
spellcheck: explicitBooleanDescriptor('spellcheck', false),
|
1350
|
+
tabIndex: tabIndexDescriptor(),
|
1351
|
+
title: stringDescriptor('title'),
|
1352
|
+
};
|
1353
|
+
// Add descriptors for ARIA attributes
|
1354
|
+
for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
|
1355
|
+
descriptors[propName] = ariaDescriptor(attrName);
|
1356
|
+
}
|
1357
|
+
|
1338
1358
|
/*
|
1339
1359
|
* Copyright (c) 2024, salesforce.com, inc.
|
1340
1360
|
* All rights reserved.
|
1341
1361
|
* SPDX-License-Identifier: MIT
|
1342
1362
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1343
1363
|
*/
|
1344
|
-
var
|
1364
|
+
var _LightningElement_attrs, _LightningElement_classList;
|
1345
1365
|
const SYMBOL__SET_INTERNALS = Symbol('set-internals');
|
1346
1366
|
const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
|
1347
1367
|
const SYMBOL__DEFAULT_TEMPLATE = Symbol('default-template');
|
1348
1368
|
class LightningElement {
|
1349
1369
|
constructor(propsAvailableAtConstruction) {
|
1350
1370
|
this.isConnected = false;
|
1351
|
-
|
1352
|
-
_LightningElement_attrs.set(this,
|
1371
|
+
this.className = '';
|
1372
|
+
_LightningElement_attrs.set(this, void 0);
|
1353
1373
|
_LightningElement_classList.set(this, null);
|
1354
1374
|
assign(this, propsAvailableAtConstruction);
|
1355
1375
|
}
|
1356
|
-
[(
|
1357
|
-
__classPrivateFieldSet(this, _LightningElement_props, props, "f");
|
1376
|
+
[(_LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
|
1358
1377
|
__classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
this[propName] = getReadOnlyProxy(props[propName]);
|
1371
|
-
}
|
1372
|
-
}
|
1373
|
-
}
|
1374
|
-
get className() {
|
1375
|
-
return __classPrivateFieldGet(this, _LightningElement_props, "f").class ?? '';
|
1376
|
-
}
|
1377
|
-
set className(newVal) {
|
1378
|
-
__classPrivateFieldGet(this, _LightningElement_props, "f").class = newVal;
|
1379
|
-
__classPrivateFieldGet(this, _LightningElement_attrs, "f").class = newVal;
|
1380
|
-
mutationTracker.add(this, 'class');
|
1378
|
+
assign(this, props);
|
1379
|
+
defineProperty(this, 'className', {
|
1380
|
+
get() {
|
1381
|
+
return props.class ?? '';
|
1382
|
+
},
|
1383
|
+
set(newVal) {
|
1384
|
+
props.class = newVal;
|
1385
|
+
attrs.class = newVal;
|
1386
|
+
mutationTracker.add(this, 'class');
|
1387
|
+
},
|
1388
|
+
});
|
1381
1389
|
}
|
1382
1390
|
get classList() {
|
1383
1391
|
if (__classPrivateFieldGet(this, _LightningElement_classList, "f")) {
|
@@ -1490,6 +1498,7 @@ defineProperties(LightningElement.prototype, descriptors);
|
|
1490
1498
|
* SPDX-License-Identifier: MIT
|
1491
1499
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1492
1500
|
*/
|
1501
|
+
const escapeAttrVal = (attrValue) => attrValue.replaceAll('&', '&').replaceAll('"', '"');
|
1493
1502
|
function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
|
1494
1503
|
// The scopeToken is e.g. `lwc-xyz123` which is the token our parent gives us.
|
1495
1504
|
// The hostScopeToken is e.g. `lwc-abc456-host` which is the token for our own component.
|
@@ -1523,8 +1532,7 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
|
|
1523
1532
|
hasClassAttribute = true;
|
1524
1533
|
}
|
1525
1534
|
}
|
1526
|
-
result +=
|
1527
|
-
attrValue === '' ? ` ${attrName}` : ` ${attrName}="${htmlEscape(attrValue, true)}"`;
|
1535
|
+
result += attrValue === '' ? ` ${attrName}` : ` ${attrName}="${escapeAttrVal(attrValue)}"`;
|
1528
1536
|
}
|
1529
1537
|
// If we didn't render any `class` attribute, render one for the scope token(s)
|
1530
1538
|
if (!hasClassAttribute && combinedScopeToken) {
|
@@ -1543,12 +1551,12 @@ function* renderAttrs(instance, attrs, hostScopeToken, scopeToken) {
|
|
1543
1551
|
function renderAttrsNoYield(emit, instance, attrs, hostScopeToken, scopeToken) {
|
1544
1552
|
emit(renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken));
|
1545
1553
|
}
|
1546
|
-
function* fallbackTmpl(_shadowSlottedContent, _lightSlottedContent,
|
1554
|
+
function* fallbackTmpl(_props, _attrs, _shadowSlottedContent, _lightSlottedContent, Cmp, _instance) {
|
1547
1555
|
if (Cmp.renderMode !== 'light') {
|
1548
1556
|
yield '<template shadowrootmode="open"></template>';
|
1549
1557
|
}
|
1550
1558
|
}
|
1551
|
-
function fallbackTmplNoYield(emit, _shadowSlottedContent, _lightSlottedContent,
|
1559
|
+
function fallbackTmplNoYield(emit, _props, _attrs, _shadowSlottedContent, _lightSlottedContent, Cmp, _instance) {
|
1552
1560
|
if (Cmp.renderMode !== 'light') {
|
1553
1561
|
emit('<template shadowrootmode="open"></template>');
|
1554
1562
|
}
|
@@ -1563,15 +1571,15 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
|
|
1563
1571
|
markup += segment;
|
1564
1572
|
};
|
1565
1573
|
if (mode === 'asyncYield') {
|
1566
|
-
for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null
|
1574
|
+
for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null)) {
|
1567
1575
|
markup += segment;
|
1568
1576
|
}
|
1569
1577
|
}
|
1570
1578
|
else if (mode === 'async') {
|
1571
|
-
await generateMarkup(emit, tagName, props, null, null, null, null, null, null
|
1579
|
+
await generateMarkup(emit, tagName, props, null, null, null, null, null, null);
|
1572
1580
|
}
|
1573
1581
|
else if (mode === 'sync') {
|
1574
|
-
generateMarkup(emit, tagName, props, null, null, null, null, null, null
|
1582
|
+
generateMarkup(emit, tagName, props, null, null, null, null, null, null);
|
1575
1583
|
}
|
1576
1584
|
else {
|
1577
1585
|
throw new Error(`Invalid mode: ${mode}`);
|
@@ -1586,27 +1594,14 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
|
|
1586
1594
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1587
1595
|
*/
|
1588
1596
|
/**
|
1589
|
-
* Given an object, render it for use as a text content node.
|
1590
|
-
* not the concatenated result of multiple adjacent text nodes.
|
1597
|
+
* Given an object, render it for use as a text content node.
|
1591
1598
|
* @param value
|
1592
1599
|
*/
|
1593
|
-
function
|
1600
|
+
function massageTextContent(value) {
|
1594
1601
|
// Using non strict equality to align with original implementation (ex. undefined == null)
|
1595
1602
|
// See: https://github.com/salesforce/lwc/blob/348130f/packages/%40lwc/engine-core/src/framework/api.ts#L548
|
1596
1603
|
return value == null ? '' : String(value);
|
1597
1604
|
}
|
1598
|
-
/**
|
1599
|
-
* Given a string, render it for use as text content in HTML. Notably this escapes HTML and renders as
|
1600
|
-
* a ZWJ is empty. Intended to be used on the result of concatenating multiple adjacent text nodes together.
|
1601
|
-
* @param value
|
1602
|
-
*/
|
1603
|
-
function renderTextContent(value) {
|
1604
|
-
// We are at the end of a series of text nodes - flush to a concatenated string
|
1605
|
-
// We only render the ZWJ if there were actually any dynamic text nodes rendered
|
1606
|
-
// The ZWJ is just so hydration can compare the SSR'd dynamic text content against
|
1607
|
-
// the CSR'd text content.
|
1608
|
-
return value === '' ? '\u200D' : htmlEscape(value);
|
1609
|
-
}
|
1610
1605
|
|
1611
1606
|
/*
|
1612
1607
|
* Copyright (c) 2024, Salesforce, Inc.
|
@@ -1806,15 +1801,17 @@ exports.createElement = createElement;
|
|
1806
1801
|
exports.establishContextfulRelationship = establishContextfulRelationship;
|
1807
1802
|
exports.fallbackTmpl = fallbackTmpl;
|
1808
1803
|
exports.fallbackTmplNoYield = fallbackTmplNoYield;
|
1804
|
+
exports.filterProperties = filterProperties;
|
1809
1805
|
exports.freezeTemplate = freezeTemplate;
|
1810
1806
|
exports.getComponentDef = getComponentDef;
|
1807
|
+
exports.getReadOnlyProxy = getReadOnlyProxy;
|
1811
1808
|
exports.hasScopedStaticStylesheets = hasScopedStaticStylesheets;
|
1812
1809
|
exports.hot = hot;
|
1813
1810
|
exports.htmlEscape = htmlEscape;
|
1814
1811
|
exports.isComponentConstructor = isComponentConstructor;
|
1812
|
+
exports.massageTextContent = massageTextContent;
|
1815
1813
|
exports.mutationTracker = mutationTracker;
|
1816
1814
|
exports.normalizeClass = normalizeClass;
|
1817
|
-
exports.normalizeTextContent = normalizeTextContent;
|
1818
1815
|
exports.parseFragment = parseFragment;
|
1819
1816
|
exports.parseSVGFragment = parseSVGFragment;
|
1820
1817
|
exports.readonly = readonly;
|
@@ -1825,7 +1822,6 @@ exports.renderAttrs = renderAttrs;
|
|
1825
1822
|
exports.renderAttrsNoYield = renderAttrsNoYield;
|
1826
1823
|
exports.renderComponent = serverSideRenderComponent;
|
1827
1824
|
exports.renderStylesheets = renderStylesheets;
|
1828
|
-
exports.renderTextContent = renderTextContent;
|
1829
1825
|
exports.renderer = renderer;
|
1830
1826
|
exports.sanitizeAttribute = sanitizeAttribute;
|
1831
1827
|
exports.serverSideRenderComponent = serverSideRenderComponent;
|
@@ -1840,5 +1836,5 @@ exports.track = track;
|
|
1840
1836
|
exports.unwrap = unwrap$1;
|
1841
1837
|
exports.validateStyleTextContents = validateStyleTextContents;
|
1842
1838
|
exports.wire = wire;
|
1843
|
-
/** version: 8.12.
|
1839
|
+
/** version: 8.12.2 */
|
1844
1840
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.d.ts
CHANGED
@@ -1,12 +1,13 @@
|
|
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';
|
4
5
|
export { LightningElement, LightningElementConstructor, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, } from './lightning-element';
|
5
6
|
export { mutationTracker } from './mutation-tracker';
|
7
|
+
export { filterProperties } from './reflection';
|
6
8
|
export { fallbackTmpl, fallbackTmplNoYield, GenerateMarkupFn, renderAttrs, renderAttrsNoYield, serverSideRenderComponent, serverSideRenderComponent as renderComponent, } from './render';
|
7
|
-
export {
|
9
|
+
export { massageTextContent } from './render-text-content';
|
8
10
|
export { hasScopedStaticStylesheets, renderStylesheets } from './styles';
|
9
11
|
export { toIteratorDirective } from './to-iterator-directive';
|
10
12
|
export { validateStyleTextContents } from './validate-style-text-contents';
|
11
13
|
export { createContextProvider, establishContextfulRelationship, connectContext } from './wire';
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|