@lwc/ssr-runtime 8.12.7-alpha.0 → 8.12.7
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/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/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): any;
|
21
21
|
remove(...classNamesToRemove: string[]): void;
|
22
22
|
replace(oldClassName: string, newClassName: string): boolean;
|
23
23
|
toggle(classNameToToggle: string, force?: boolean): boolean;
|
@@ -30,3 +30,4 @@ 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.7 */
|
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,256 +1335,49 @@ 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
|
-
* 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
|
-
|
1358
1338
|
/*
|
1359
1339
|
* Copyright (c) 2024, salesforce.com, inc.
|
1360
1340
|
* All rights reserved.
|
1361
1341
|
* SPDX-License-Identifier: MIT
|
1362
1342
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1363
1343
|
*/
|
1364
|
-
var _LightningElement_attrs, _LightningElement_classList;
|
1344
|
+
var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList;
|
1365
1345
|
const SYMBOL__SET_INTERNALS = Symbol('set-internals');
|
1366
1346
|
const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
|
1367
1347
|
const SYMBOL__DEFAULT_TEMPLATE = Symbol('default-template');
|
1368
1348
|
class LightningElement {
|
1369
1349
|
constructor(propsAvailableAtConstruction) {
|
1370
1350
|
this.isConnected = false;
|
1371
|
-
this
|
1372
|
-
_LightningElement_attrs.set(this,
|
1351
|
+
_LightningElement_props.set(this, undefined);
|
1352
|
+
_LightningElement_attrs.set(this, undefined);
|
1373
1353
|
_LightningElement_classList.set(this, null);
|
1374
1354
|
assign(this, propsAvailableAtConstruction);
|
1375
1355
|
}
|
1376
|
-
[(_LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
|
1356
|
+
[(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties, privateProperties) {
|
1357
|
+
__classPrivateFieldSet(this, _LightningElement_props, props, "f");
|
1377
1358
|
__classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1359
|
+
// Avoid setting the following types of properties that should not be set:
|
1360
|
+
// - Properties that are not public.
|
1361
|
+
// - Properties that are not global.
|
1362
|
+
// - Properties that are global but are internally overridden.
|
1363
|
+
for (const propName of keys(props)) {
|
1364
|
+
const attrName = htmlPropertyToAttribute(propName);
|
1365
|
+
if (publicProperties.has(propName) ||
|
1366
|
+
((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
|
1367
|
+
!privateProperties.has(propName))) {
|
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]);
|
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');
|
1389
1381
|
}
|
1390
1382
|
get classList() {
|
1391
1383
|
if (__classPrivateFieldGet(this, _LightningElement_classList, "f")) {
|
@@ -1498,7 +1490,6 @@ defineProperties(LightningElement.prototype, descriptors);
|
|
1498
1490
|
* SPDX-License-Identifier: MIT
|
1499
1491
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1500
1492
|
*/
|
1501
|
-
const escapeAttrVal = (attrValue) => attrValue.replaceAll('&', '&').replaceAll('"', '"');
|
1502
1493
|
function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
|
1503
1494
|
// The scopeToken is e.g. `lwc-xyz123` which is the token our parent gives us.
|
1504
1495
|
// The hostScopeToken is e.g. `lwc-abc456-host` which is the token for our own component.
|
@@ -1532,7 +1523,8 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
|
|
1532
1523
|
hasClassAttribute = true;
|
1533
1524
|
}
|
1534
1525
|
}
|
1535
|
-
result +=
|
1526
|
+
result +=
|
1527
|
+
attrValue === '' ? ` ${attrName}` : ` ${attrName}="${htmlEscape(attrValue, true)}"`;
|
1536
1528
|
}
|
1537
1529
|
// If we didn't render any `class` attribute, render one for the scope token(s)
|
1538
1530
|
if (!hasClassAttribute && combinedScopeToken) {
|
@@ -1551,14 +1543,20 @@ function* renderAttrs(instance, attrs, hostScopeToken, scopeToken) {
|
|
1551
1543
|
function renderAttrsNoYield(emit, instance, attrs, hostScopeToken, scopeToken) {
|
1552
1544
|
emit(renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken));
|
1553
1545
|
}
|
1554
|
-
function* fallbackTmpl(
|
1546
|
+
function* fallbackTmpl(shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, instance) {
|
1555
1547
|
if (Cmp.renderMode !== 'light') {
|
1556
|
-
yield
|
1548
|
+
yield `<template shadowrootmode="open"></template>`;
|
1549
|
+
if (shadowSlottedContent) {
|
1550
|
+
yield shadowSlottedContent(instance);
|
1551
|
+
}
|
1557
1552
|
}
|
1558
1553
|
}
|
1559
|
-
function fallbackTmplNoYield(emit,
|
1554
|
+
function fallbackTmplNoYield(emit, shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, instance) {
|
1560
1555
|
if (Cmp.renderMode !== 'light') {
|
1561
|
-
emit(
|
1556
|
+
emit(`<template shadowrootmode="open"></template>`);
|
1557
|
+
if (shadowSlottedContent) {
|
1558
|
+
shadowSlottedContent(emit, instance);
|
1559
|
+
}
|
1562
1560
|
}
|
1563
1561
|
}
|
1564
1562
|
async function serverSideRenderComponent(tagName, Component, props = {}, mode = DEFAULT_SSR_MODE) {
|
@@ -1571,15 +1569,15 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
|
|
1571
1569
|
markup += segment;
|
1572
1570
|
};
|
1573
1571
|
if (mode === 'asyncYield') {
|
1574
|
-
for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null)) {
|
1572
|
+
for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null, null)) {
|
1575
1573
|
markup += segment;
|
1576
1574
|
}
|
1577
1575
|
}
|
1578
1576
|
else if (mode === 'async') {
|
1579
|
-
await generateMarkup(emit, tagName, props, null, null, null, null, null, null);
|
1577
|
+
await generateMarkup(emit, tagName, props, null, null, null, null, null, null, null);
|
1580
1578
|
}
|
1581
1579
|
else if (mode === 'sync') {
|
1582
|
-
generateMarkup(emit, tagName, props, null, null, null, null, null, null);
|
1580
|
+
generateMarkup(emit, tagName, props, null, null, null, null, null, null, null);
|
1583
1581
|
}
|
1584
1582
|
else {
|
1585
1583
|
throw new Error(`Invalid mode: ${mode}`);
|
@@ -1594,14 +1592,27 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
|
|
1594
1592
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1595
1593
|
*/
|
1596
1594
|
/**
|
1597
|
-
* Given an object, render it for use as a text content node.
|
1595
|
+
* Given an object, render it for use as a text content node. Not that this applies to individual text nodes,
|
1596
|
+
* not the concatenated result of multiple adjacent text nodes.
|
1598
1597
|
* @param value
|
1599
1598
|
*/
|
1600
|
-
function
|
1599
|
+
function normalizeTextContent(value) {
|
1601
1600
|
// Using non strict equality to align with original implementation (ex. undefined == null)
|
1602
1601
|
// See: https://github.com/salesforce/lwc/blob/348130f/packages/%40lwc/engine-core/src/framework/api.ts#L548
|
1603
1602
|
return value == null ? '' : String(value);
|
1604
1603
|
}
|
1604
|
+
/**
|
1605
|
+
* Given a string, render it for use as text content in HTML. Notably this escapes HTML and renders as
|
1606
|
+
* a ZWJ is empty. Intended to be used on the result of concatenating multiple adjacent text nodes together.
|
1607
|
+
* @param value
|
1608
|
+
*/
|
1609
|
+
function renderTextContent(value) {
|
1610
|
+
// We are at the end of a series of text nodes - flush to a concatenated string
|
1611
|
+
// We only render the ZWJ if there were actually any dynamic text nodes rendered
|
1612
|
+
// The ZWJ is just so hydration can compare the SSR'd dynamic text content against
|
1613
|
+
// the CSR'd text content.
|
1614
|
+
return value === '' ? '\u200D' : htmlEscape(value);
|
1615
|
+
}
|
1605
1616
|
|
1606
1617
|
/*
|
1607
1618
|
* Copyright (c) 2024, Salesforce, Inc.
|
@@ -1801,17 +1812,15 @@ exports.createElement = createElement;
|
|
1801
1812
|
exports.establishContextfulRelationship = establishContextfulRelationship;
|
1802
1813
|
exports.fallbackTmpl = fallbackTmpl;
|
1803
1814
|
exports.fallbackTmplNoYield = fallbackTmplNoYield;
|
1804
|
-
exports.filterProperties = filterProperties;
|
1805
1815
|
exports.freezeTemplate = freezeTemplate;
|
1806
1816
|
exports.getComponentDef = getComponentDef;
|
1807
|
-
exports.getReadOnlyProxy = getReadOnlyProxy;
|
1808
1817
|
exports.hasScopedStaticStylesheets = hasScopedStaticStylesheets;
|
1809
1818
|
exports.hot = hot;
|
1810
1819
|
exports.htmlEscape = htmlEscape;
|
1811
1820
|
exports.isComponentConstructor = isComponentConstructor;
|
1812
|
-
exports.massageTextContent = massageTextContent;
|
1813
1821
|
exports.mutationTracker = mutationTracker;
|
1814
1822
|
exports.normalizeClass = normalizeClass;
|
1823
|
+
exports.normalizeTextContent = normalizeTextContent;
|
1815
1824
|
exports.parseFragment = parseFragment;
|
1816
1825
|
exports.parseSVGFragment = parseSVGFragment;
|
1817
1826
|
exports.readonly = readonly;
|
@@ -1822,6 +1831,7 @@ exports.renderAttrs = renderAttrs;
|
|
1822
1831
|
exports.renderAttrsNoYield = renderAttrsNoYield;
|
1823
1832
|
exports.renderComponent = serverSideRenderComponent;
|
1824
1833
|
exports.renderStylesheets = renderStylesheets;
|
1834
|
+
exports.renderTextContent = renderTextContent;
|
1825
1835
|
exports.renderer = renderer;
|
1826
1836
|
exports.sanitizeAttribute = sanitizeAttribute;
|
1827
1837
|
exports.serverSideRenderComponent = serverSideRenderComponent;
|
@@ -1836,5 +1846,5 @@ exports.track = track;
|
|
1836
1846
|
exports.unwrap = unwrap$1;
|
1837
1847
|
exports.validateStyleTextContents = validateStyleTextContents;
|
1838
1848
|
exports.wire = wire;
|
1839
|
-
/** version: 8.12.
|
1849
|
+
/** version: 8.12.7 */
|
1840
1850
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.d.ts
CHANGED
@@ -1,13 +1,12 @@
|
|
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
|
-
export { filterProperties } from './reflection';
|
8
6
|
export { fallbackTmpl, fallbackTmplNoYield, GenerateMarkupFn, renderAttrs, renderAttrsNoYield, serverSideRenderComponent, serverSideRenderComponent as renderComponent, } from './render';
|
9
|
-
export {
|
7
|
+
export { normalizeTextContent, renderTextContent } from './render-text-content';
|
10
8
|
export { hasScopedStaticStylesheets, renderStylesheets } from './styles';
|
11
9
|
export { toIteratorDirective } from './to-iterator-directive';
|
12
10
|
export { validateStyleTextContents } from './validate-style-text-contents';
|
13
11
|
export { createContextProvider, establishContextfulRelationship, connectContext } from './wire';
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|