@lwc/ssr-runtime 8.12.7-alpha.0 → 8.13.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -258,48 +258,26 @@ assign,
258
258
  create,
259
259
  /** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */
260
260
  defineProperties,
261
- /** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */
262
- defineProperty,
263
261
  /** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
264
262
  entries,
265
- /** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */
266
- freeze,
267
- /** Detached {@linkcode Object.fromEntries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries MDN Reference}. */
268
- fromEntries,
269
- /** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */
270
- getOwnPropertyDescriptor: getOwnPropertyDescriptor$1,
271
- /** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */
272
- getOwnPropertyDescriptors,
273
263
  /** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
274
264
  getOwnPropertyNames: getOwnPropertyNames$1,
275
- /** Detached {@linkcode Object.getOwnPropertySymbols}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols MDN Reference}. */
276
- getOwnPropertySymbols: getOwnPropertySymbols$1,
277
- /** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
278
- getPrototypeOf: getPrototypeOf$1,
279
265
  /** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
280
266
  hasOwnProperty: hasOwnProperty$1,
281
- /** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */
282
- isFrozen,
283
267
  /** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */
284
- keys,
285
- /** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */
286
- seal,
287
- /** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
288
- setPrototypeOf, } = Object;
268
+ keys} = Object;
289
269
  const {
290
270
  /** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
291
- isArray: isArray$1,
292
- /** Detached {@linkcode Array.from}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from MDN Reference}. */
293
- from: ArrayFrom, } = Array;
271
+ isArray: isArray$1} = Array;
294
272
  // For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
295
273
  // though it works fine for one, e.g. isArray), so comments for these are added to the export
296
274
  // statement, rather than this declaration.
297
- const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, // Weird anomaly!
275
+ const { join: ArrayJoin, map: ArrayMap, forEach, // Weird anomaly!
298
276
  } = Array.prototype;
299
277
  /** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */
300
278
  const { fromCharCode: StringFromCharCode } = String;
301
279
  // No JSDocs here - see comment for Array.prototype
302
- const { charAt: StringCharAt, charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, trim: StringTrim, } = String.prototype;
280
+ const { charCodeAt: StringCharCodeAt, replace: StringReplace, toLowerCase: StringToLowerCase, trim: StringTrim, } = String.prototype;
303
281
  /**
304
282
  * Determines whether the argument is `undefined`.
305
283
  * @param obj Value to test
@@ -631,7 +609,7 @@ function setHooks(hooks) {
631
609
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
632
610
  */
633
611
  const DEFAULT_SSR_MODE = 'sync';
634
- /** version: 8.12.2 */
612
+ /** version: 8.13.0 */
635
613
 
636
614
  /*
637
615
  * Copyright (c) 2024, Salesforce, Inc.
@@ -695,6 +673,10 @@ class ClassList {
695
673
  toString() {
696
674
  return this.el.className;
697
675
  }
676
+ get length() {
677
+ const currentClassNameStr = this.el.className ?? '';
678
+ return currentClassNameStr.split(MULTI_SPACE).length;
679
+ }
698
680
  item(_index) {
699
681
  throw new Error('Method "item" not implemented.');
700
682
  }
@@ -704,10 +686,206 @@ class ClassList {
704
686
  forEach(_callbackfn, _thisArg) {
705
687
  throw new Error('Method "forEach" not implemented.');
706
688
  }
707
- get length() {
708
- throw new Error('Property "length" not implemented.');
689
+ }
690
+
691
+ /******************************************************************************
692
+ Copyright (c) Microsoft Corporation.
693
+
694
+ Permission to use, copy, modify, and/or distribute this software for any
695
+ purpose with or without fee is hereby granted.
696
+
697
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
698
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
699
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
700
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
701
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
702
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
703
+ PERFORMANCE OF THIS SOFTWARE.
704
+ ***************************************************************************** */
705
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
706
+
707
+
708
+ function __classPrivateFieldGet(receiver, state, kind, f) {
709
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
710
+ 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");
711
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
712
+ }
713
+
714
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
715
+ if (kind === "m") throw new TypeError("Private method is not writable");
716
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
717
+ 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");
718
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
719
+ }
720
+
721
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
722
+ var e = new Error(message);
723
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
724
+ };
725
+
726
+ /*
727
+ * Copyright (c) 2024, Salesforce, Inc.
728
+ * All rights reserved.
729
+ * SPDX-License-Identifier: MIT
730
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
731
+ */
732
+ var _MutationTracker_enabledSet, _MutationTracker_mutationMap;
733
+ class MutationTracker {
734
+ constructor() {
735
+ _MutationTracker_enabledSet.set(this, new WeakSet());
736
+ _MutationTracker_mutationMap.set(this, new WeakMap());
737
+ }
738
+ add(instance, attrName) {
739
+ if (__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").has(instance)) {
740
+ let mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
741
+ if (!mutatedAttrs) {
742
+ mutatedAttrs = new Set();
743
+ __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").set(instance, mutatedAttrs);
744
+ }
745
+ mutatedAttrs.add(attrName.toLowerCase());
746
+ }
747
+ }
748
+ enable(instance) {
749
+ __classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").add(instance);
750
+ }
751
+ disable(instance) {
752
+ __classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").delete(instance);
753
+ }
754
+ renderMutatedAttrs(instance) {
755
+ const mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
756
+ if (mutatedAttrs) {
757
+ return ` data-lwc-host-mutated="${[...mutatedAttrs].sort().join(' ')}"`;
758
+ }
759
+ else {
760
+ return '';
761
+ }
709
762
  }
710
763
  }
764
+ _MutationTracker_enabledSet = new WeakMap(), _MutationTracker_mutationMap = new WeakMap();
765
+ const mutationTracker = new MutationTracker();
766
+
767
+ /*
768
+ * Copyright (c) 2024, Salesforce, Inc.
769
+ * All rights reserved.
770
+ * SPDX-License-Identifier: MIT
771
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
772
+ */
773
+ /**
774
+ * Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
775
+ */
776
+ const stringDescriptor = (attrName) => ({
777
+ configurable: true,
778
+ enumerable: true,
779
+ get() {
780
+ return this.getAttribute(attrName);
781
+ },
782
+ set(newValue) {
783
+ const currentValue = this.getAttribute(attrName);
784
+ const normalizedValue = String(newValue);
785
+ if (normalizedValue !== currentValue) {
786
+ this.setAttribute(attrName, normalizedValue);
787
+ }
788
+ },
789
+ });
790
+ /** Descriptor for a boolean that checks for `attr="true"` or `attr="false"`, e.g. `spellcheck` and `draggable`. */
791
+ const explicitBooleanDescriptor = (attrName, defaultValue) => ({
792
+ configurable: true,
793
+ enumerable: true,
794
+ get() {
795
+ const value = this.getAttribute(attrName);
796
+ if (value === null)
797
+ return defaultValue;
798
+ // spellcheck=false => false, everything else => true
799
+ // draggable=true => true, everything else => false
800
+ return value.toLowerCase() === String(defaultValue) ? defaultValue : !defaultValue;
801
+ },
802
+ set(newValue) {
803
+ const currentValue = this.getAttribute(attrName);
804
+ const normalizedValue = String(Boolean(newValue));
805
+ if (normalizedValue !== currentValue) {
806
+ this.setAttribute(attrName, normalizedValue);
807
+ }
808
+ },
809
+ });
810
+ /**
811
+ * Descriptor for a "true" boolean attribute that checks solely for presence, e.g. `hidden`.
812
+ */
813
+ const booleanAttributeDescriptor = (attrName) => ({
814
+ configurable: true,
815
+ enumerable: true,
816
+ get() {
817
+ return this.hasAttribute(attrName);
818
+ },
819
+ set(newValue) {
820
+ const hasAttribute = this.hasAttribute(attrName);
821
+ if (newValue) {
822
+ if (!hasAttribute) {
823
+ this.setAttribute(attrName, '');
824
+ }
825
+ }
826
+ else {
827
+ if (hasAttribute) {
828
+ this.removeAttribute(attrName);
829
+ }
830
+ }
831
+ },
832
+ });
833
+ /**
834
+ * Descriptor for ARIA reflections, e.g. `ariaLabel` and `role`.
835
+ */
836
+ const ariaDescriptor = (attrName) => ({
837
+ configurable: true,
838
+ enumerable: true,
839
+ get() {
840
+ return this.getAttribute(attrName);
841
+ },
842
+ set(newValue) {
843
+ const currentValue = this.getAttribute(attrName);
844
+ if (newValue !== currentValue) {
845
+ // TODO [#3284]: According to the spec, IDL nullable type values
846
+ // (null and undefined) should remove the attribute; however, we
847
+ // only do so in the case of null for historical reasons.
848
+ if (isNull(newValue)) {
849
+ this.removeAttribute(attrName);
850
+ }
851
+ else {
852
+ this.setAttribute(attrName, toString(newValue));
853
+ }
854
+ }
855
+ },
856
+ });
857
+ const tabIndexDescriptor = () => ({
858
+ configurable: true,
859
+ enumerable: true,
860
+ get() {
861
+ const str = this.getAttribute('tabindex');
862
+ const num = Number(str);
863
+ return isFinite(num) ? Math.trunc(num) : -1;
864
+ },
865
+ set(newValue) {
866
+ const currentValue = this.getAttribute('tabindex');
867
+ const num = Number(newValue);
868
+ const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
869
+ if (normalizedValue !== currentValue) {
870
+ this.setAttribute('tabindex', toString(newValue));
871
+ }
872
+ },
873
+ });
874
+ const descriptors = {
875
+ accessKey: stringDescriptor('accesskey'),
876
+ dir: stringDescriptor('dir'),
877
+ draggable: explicitBooleanDescriptor('draggable', true),
878
+ hidden: booleanAttributeDescriptor('hidden'),
879
+ id: stringDescriptor('id'),
880
+ lang: stringDescriptor('lang'),
881
+ spellcheck: explicitBooleanDescriptor('spellcheck', false),
882
+ tabIndex: tabIndexDescriptor(),
883
+ title: stringDescriptor('title'),
884
+ };
885
+ // Add descriptors for ARIA attributes
886
+ for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
887
+ descriptors[propName] = ariaDescriptor(attrName);
888
+ }
711
889
 
712
890
  /**
713
891
  * Copyright (C) 2017 salesforce.com, inc.
@@ -1136,256 +1314,49 @@ function getReadOnlyProxy(value) {
1136
1314
  return reactiveMembrane.getReadOnlyProxy(value);
1137
1315
  }
1138
1316
 
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
1317
  /*
1359
1318
  * Copyright (c) 2024, salesforce.com, inc.
1360
1319
  * All rights reserved.
1361
1320
  * SPDX-License-Identifier: MIT
1362
1321
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1363
1322
  */
1364
- var _LightningElement_attrs, _LightningElement_classList;
1323
+ var _LightningElement_props, _LightningElement_attrs, _LightningElement_classList;
1365
1324
  const SYMBOL__SET_INTERNALS = Symbol('set-internals');
1366
1325
  const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
1367
1326
  const SYMBOL__DEFAULT_TEMPLATE = Symbol('default-template');
1368
1327
  class LightningElement {
1369
1328
  constructor(propsAvailableAtConstruction) {
1370
1329
  this.isConnected = false;
1371
- this.className = '';
1372
- _LightningElement_attrs.set(this, void 0);
1330
+ _LightningElement_props.set(this, undefined);
1331
+ _LightningElement_attrs.set(this, undefined);
1373
1332
  _LightningElement_classList.set(this, null);
1374
1333
  assign(this, propsAvailableAtConstruction);
1375
1334
  }
1376
- [(_LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
1335
+ [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicProperties, privateProperties) {
1336
+ __classPrivateFieldSet(this, _LightningElement_props, props, "f");
1377
1337
  __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
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
- });
1338
+ // Avoid setting the following types of properties that should not be set:
1339
+ // - Properties that are not public.
1340
+ // - Properties that are not global.
1341
+ // - Properties that are global but are internally overridden.
1342
+ for (const propName of keys(props)) {
1343
+ const attrName = htmlPropertyToAttribute(propName);
1344
+ if (publicProperties.has(propName) ||
1345
+ ((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
1346
+ !privateProperties.has(propName))) {
1347
+ // For props passed from parents to children, they are intended to be read-only
1348
+ // to avoid a child mutating its parent's state
1349
+ this[propName] = getReadOnlyProxy(props[propName]);
1350
+ }
1351
+ }
1352
+ }
1353
+ get className() {
1354
+ return __classPrivateFieldGet(this, _LightningElement_props, "f").class ?? '';
1355
+ }
1356
+ set className(newVal) {
1357
+ __classPrivateFieldGet(this, _LightningElement_props, "f").class = newVal;
1358
+ __classPrivateFieldGet(this, _LightningElement_attrs, "f").class = newVal;
1359
+ mutationTracker.add(this, 'class');
1389
1360
  }
1390
1361
  get classList() {
1391
1362
  if (__classPrivateFieldGet(this, _LightningElement_classList, "f")) {
@@ -1498,7 +1469,6 @@ defineProperties(LightningElement.prototype, descriptors);
1498
1469
  * SPDX-License-Identifier: MIT
1499
1470
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1500
1471
  */
1501
- const escapeAttrVal = (attrValue) => attrValue.replaceAll('&', '&').replaceAll('"', '"');
1502
1472
  function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
1503
1473
  // The scopeToken is e.g. `lwc-xyz123` which is the token our parent gives us.
1504
1474
  // The hostScopeToken is e.g. `lwc-abc456-host` which is the token for our own component.
@@ -1532,7 +1502,8 @@ function renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken) {
1532
1502
  hasClassAttribute = true;
1533
1503
  }
1534
1504
  }
1535
- result += attrValue === '' ? ` ${attrName}` : ` ${attrName}="${escapeAttrVal(attrValue)}"`;
1505
+ result +=
1506
+ attrValue === '' ? ` ${attrName}` : ` ${attrName}="${htmlEscape(attrValue, true)}"`;
1536
1507
  }
1537
1508
  // If we didn't render any `class` attribute, render one for the scope token(s)
1538
1509
  if (!hasClassAttribute && combinedScopeToken) {
@@ -1551,14 +1522,20 @@ function* renderAttrs(instance, attrs, hostScopeToken, scopeToken) {
1551
1522
  function renderAttrsNoYield(emit, instance, attrs, hostScopeToken, scopeToken) {
1552
1523
  emit(renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken));
1553
1524
  }
1554
- function* fallbackTmpl(_props, _attrs, _shadowSlottedContent, _lightSlottedContent, Cmp, _instance) {
1525
+ function* fallbackTmpl(shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, instance) {
1555
1526
  if (Cmp.renderMode !== 'light') {
1556
- yield '<template shadowrootmode="open"></template>';
1527
+ yield `<template shadowrootmode="open"></template>`;
1528
+ if (shadowSlottedContent) {
1529
+ yield shadowSlottedContent(instance);
1530
+ }
1557
1531
  }
1558
1532
  }
1559
- function fallbackTmplNoYield(emit, _props, _attrs, _shadowSlottedContent, _lightSlottedContent, Cmp, _instance) {
1533
+ function fallbackTmplNoYield(emit, shadowSlottedContent, _lightSlottedContent, _scopedSlottedContent, Cmp, instance) {
1560
1534
  if (Cmp.renderMode !== 'light') {
1561
- emit('<template shadowrootmode="open"></template>');
1535
+ emit(`<template shadowrootmode="open"></template>`);
1536
+ if (shadowSlottedContent) {
1537
+ shadowSlottedContent(emit, instance);
1538
+ }
1562
1539
  }
1563
1540
  }
1564
1541
  async function serverSideRenderComponent(tagName, Component, props = {}, mode = DEFAULT_SSR_MODE) {
@@ -1570,16 +1547,23 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
1570
1547
  const emit = (segment) => {
1571
1548
  markup += segment;
1572
1549
  };
1550
+ if (!generateMarkup) {
1551
+ // If a non-component is accidentally provided, render an empty template
1552
+ emit(`<${tagName}>`);
1553
+ fallbackTmplNoYield(emit, null, null, null, Component, null);
1554
+ emit(`</${tagName}>`);
1555
+ return markup;
1556
+ }
1573
1557
  if (mode === 'asyncYield') {
1574
- for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null)) {
1558
+ for await (const segment of generateMarkup(tagName, props, null, null, null, null, null, null, null)) {
1575
1559
  markup += segment;
1576
1560
  }
1577
1561
  }
1578
1562
  else if (mode === 'async') {
1579
- await generateMarkup(emit, tagName, props, null, null, null, null, null, null);
1563
+ await generateMarkup(emit, tagName, props, null, null, null, null, null, null, null);
1580
1564
  }
1581
1565
  else if (mode === 'sync') {
1582
- generateMarkup(emit, tagName, props, null, null, null, null, null, null);
1566
+ generateMarkup(emit, tagName, props, null, null, null, null, null, null, null);
1583
1567
  }
1584
1568
  else {
1585
1569
  throw new Error(`Invalid mode: ${mode}`);
@@ -1594,14 +1578,27 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
1594
1578
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1595
1579
  */
1596
1580
  /**
1597
- * Given an object, render it for use as a text content node.
1581
+ * Given an object, render it for use as a text content node. Not that this applies to individual text nodes,
1582
+ * not the concatenated result of multiple adjacent text nodes.
1598
1583
  * @param value
1599
1584
  */
1600
- function massageTextContent(value) {
1585
+ function normalizeTextContent(value) {
1601
1586
  // Using non strict equality to align with original implementation (ex. undefined == null)
1602
1587
  // See: https://github.com/salesforce/lwc/blob/348130f/packages/%40lwc/engine-core/src/framework/api.ts#L548
1603
1588
  return value == null ? '' : String(value);
1604
1589
  }
1590
+ /**
1591
+ * Given a string, render it for use as text content in HTML. Notably this escapes HTML and renders as
1592
+ * a ZWJ is empty. Intended to be used on the result of concatenating multiple adjacent text nodes together.
1593
+ * @param value
1594
+ */
1595
+ function renderTextContent(value) {
1596
+ // We are at the end of a series of text nodes - flush to a concatenated string
1597
+ // We only render the ZWJ if there were actually any dynamic text nodes rendered
1598
+ // The ZWJ is just so hydration can compare the SSR'd dynamic text content against
1599
+ // the CSR'd text content.
1600
+ return value === '' ? '\u200D' : htmlEscape(value);
1601
+ }
1605
1602
 
1606
1603
  /*
1607
1604
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1801,17 +1798,15 @@ exports.createElement = createElement;
1801
1798
  exports.establishContextfulRelationship = establishContextfulRelationship;
1802
1799
  exports.fallbackTmpl = fallbackTmpl;
1803
1800
  exports.fallbackTmplNoYield = fallbackTmplNoYield;
1804
- exports.filterProperties = filterProperties;
1805
1801
  exports.freezeTemplate = freezeTemplate;
1806
1802
  exports.getComponentDef = getComponentDef;
1807
- exports.getReadOnlyProxy = getReadOnlyProxy;
1808
1803
  exports.hasScopedStaticStylesheets = hasScopedStaticStylesheets;
1809
1804
  exports.hot = hot;
1810
1805
  exports.htmlEscape = htmlEscape;
1811
1806
  exports.isComponentConstructor = isComponentConstructor;
1812
- exports.massageTextContent = massageTextContent;
1813
1807
  exports.mutationTracker = mutationTracker;
1814
1808
  exports.normalizeClass = normalizeClass;
1809
+ exports.normalizeTextContent = normalizeTextContent;
1815
1810
  exports.parseFragment = parseFragment;
1816
1811
  exports.parseSVGFragment = parseSVGFragment;
1817
1812
  exports.readonly = readonly;
@@ -1822,6 +1817,7 @@ exports.renderAttrs = renderAttrs;
1822
1817
  exports.renderAttrsNoYield = renderAttrsNoYield;
1823
1818
  exports.renderComponent = serverSideRenderComponent;
1824
1819
  exports.renderStylesheets = renderStylesheets;
1820
+ exports.renderTextContent = renderTextContent;
1825
1821
  exports.renderer = renderer;
1826
1822
  exports.sanitizeAttribute = sanitizeAttribute;
1827
1823
  exports.serverSideRenderComponent = serverSideRenderComponent;
@@ -1836,5 +1832,5 @@ exports.track = track;
1836
1832
  exports.unwrap = unwrap$1;
1837
1833
  exports.validateStyleTextContents = validateStyleTextContents;
1838
1834
  exports.wire = wire;
1839
- /** version: 8.12.2 */
1835
+ /** version: 8.13.0 */
1840
1836
  //# sourceMappingURL=index.cjs.js.map