@lwc/ssr-runtime 8.2.0 → 8.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.cjs.js CHANGED
@@ -5,8 +5,6 @@
5
5
 
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
- var shared = require('@lwc/shared');
9
-
10
8
  /*
11
9
  * Copyright (c) 2024, Salesforce, Inc.
12
10
  * All rights reserved.
@@ -106,31 +104,266 @@ function __classPrivateFieldGet(receiver, state, kind, f) {
106
104
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
107
105
  }
108
106
 
107
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
108
+ if (kind === "m") throw new TypeError("Private method is not writable");
109
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
110
+ 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");
111
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
112
+ }
113
+
109
114
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
110
115
  var e = new Error(message);
111
116
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
112
117
  };
113
118
 
119
+ /**
120
+ * Copyright (c) 2024 Salesforce, Inc.
121
+ */
122
+ /*
123
+ * Copyright (c) 2018, salesforce.com, inc.
124
+ * All rights reserved.
125
+ * SPDX-License-Identifier: MIT
126
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
127
+ */
128
+ /**
129
+ *
130
+ * @param value
131
+ * @param msg
132
+ */
133
+
134
+ /*
135
+ * Copyright (c) 2024, Salesforce, Inc.
136
+ * All rights reserved.
137
+ * SPDX-License-Identifier: MIT
138
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
139
+ */
140
+ const {
141
+ /** Detached {@linkcode Object.assign}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN Reference}. */
142
+ assign,
143
+ /** Detached {@linkcode Object.create}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create MDN Reference}. */
144
+ create,
145
+ /** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */
146
+ defineProperties,
147
+ /** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */
148
+ defineProperty,
149
+ /** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
150
+ entries,
151
+ /** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */
152
+ freeze,
153
+ /** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */
154
+ getOwnPropertyDescriptor,
155
+ /** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */
156
+ getOwnPropertyDescriptors,
157
+ /** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
158
+ getOwnPropertyNames,
159
+ /** Detached {@linkcode Object.getOwnPropertySymbols}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols MDN Reference}. */
160
+ getOwnPropertySymbols,
161
+ /** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
162
+ getPrototypeOf,
163
+ /** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
164
+ hasOwnProperty,
165
+ /** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */
166
+ isFrozen,
167
+ /** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */
168
+ keys,
169
+ /** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */
170
+ seal,
171
+ /** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
172
+ setPrototypeOf, } = Object;
173
+ const {
174
+ /** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
175
+ isArray,
176
+ /** Detached {@linkcode Array.from}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from MDN Reference}. */
177
+ from: ArrayFrom, } = Array;
178
+ // For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
179
+ // though it works fine for one, e.g. isArray), so comments for these are added to the export
180
+ // statement, rather than this declaration.
181
+ const { concat: ArrayConcat, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, // Weird anomaly!
182
+ } = Array.prototype;
183
+ // No JSDocs here - see comment for Array.prototype
184
+ const { charAt: StringCharAt, charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, trim: StringTrim, } = String.prototype;
185
+ /**
186
+ * Determines whether the argument is `null`.
187
+ * @param obj Value to test
188
+ * @returns `true` if the value is `null`.
189
+ */
190
+ function isNull(obj) {
191
+ return obj === null;
192
+ }
193
+ const OtS = {}.toString;
194
+ /**
195
+ * Converts the argument to a string, safely accounting for objects with "null" prototype.
196
+ * Note that `toString(null)` returns `"[object Null]"` rather than `"null"`.
197
+ * @param obj Value to convert to a string.
198
+ * @returns String representation of the value.
199
+ */
200
+ function toString(obj) {
201
+ if (obj?.toString) {
202
+ // Arrays might hold objects with "null" prototype So using
203
+ // Array.prototype.toString directly will cause an error Iterate through
204
+ // all the items and handle individually.
205
+ if (isArray(obj)) {
206
+ // This behavior is slightly different from Array#toString:
207
+ // 1. Array#toString calls `this.join`, rather than Array#join
208
+ // Ex: arr = []; arr.join = () => 1; arr.toString() === 1; toString(arr) === ''
209
+ // 2. Array#toString delegates to Object#toString if `this.join` is not a function
210
+ // Ex: arr = []; arr.join = 'no'; arr.toString() === '[object Array]; toString(arr) = ''
211
+ // 3. Array#toString converts null/undefined to ''
212
+ // Ex: arr = [null, undefined]; arr.toString() === ','; toString(arr) === '[object Null],undefined'
213
+ // 4. Array#toString converts recursive references to arrays to ''
214
+ // Ex: arr = [1]; arr.push(arr, 2); arr.toString() === '1,,2'; toString(arr) throws
215
+ // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
216
+ return ArrayJoin.call(ArrayMap.call(obj, toString), ',');
217
+ }
218
+ return obj.toString();
219
+ }
220
+ else if (typeof obj === 'object') {
221
+ // This catches null and returns "[object Null]". Weird, but kept for backwards compatibility.
222
+ return OtS.call(obj);
223
+ }
224
+ else {
225
+ return String(obj);
226
+ }
227
+ }
228
+
229
+ /*
230
+ * Copyright (c) 2018, salesforce.com, inc.
231
+ * All rights reserved.
232
+ * SPDX-License-Identifier: MIT
233
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
234
+ */
235
+ /**
236
+ * According to the following list, there are 48 aria attributes of which two (ariaDropEffect and
237
+ * ariaGrabbed) are deprecated:
238
+ * https://www.w3.org/TR/wai-aria-1.1/#x6-6-definitions-of-states-and-properties-all-aria-attributes
239
+ *
240
+ * The above list of 46 aria attributes is consistent with the following resources:
241
+ * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
242
+ * https://wicg.github.io/aom/spec/aria-reflection.html
243
+ *
244
+ * NOTE: If you update this list, please update test files that implicitly reference this list!
245
+ * Searching the codebase for `aria-flowto` and `ariaFlowTo` should be good enough to find all usages.
246
+ */
247
+ const AriaPropertyNames = [
248
+ 'ariaActiveDescendant',
249
+ 'ariaAtomic',
250
+ 'ariaAutoComplete',
251
+ 'ariaBusy',
252
+ 'ariaChecked',
253
+ 'ariaColCount',
254
+ 'ariaColIndex',
255
+ 'ariaColIndexText',
256
+ 'ariaColSpan',
257
+ 'ariaControls',
258
+ 'ariaCurrent',
259
+ 'ariaDescribedBy',
260
+ 'ariaDescription',
261
+ 'ariaDetails',
262
+ 'ariaDisabled',
263
+ 'ariaErrorMessage',
264
+ 'ariaExpanded',
265
+ 'ariaFlowTo',
266
+ 'ariaHasPopup',
267
+ 'ariaHidden',
268
+ 'ariaInvalid',
269
+ 'ariaKeyShortcuts',
270
+ 'ariaLabel',
271
+ 'ariaLabelledBy',
272
+ 'ariaLevel',
273
+ 'ariaLive',
274
+ 'ariaModal',
275
+ 'ariaMultiLine',
276
+ 'ariaMultiSelectable',
277
+ 'ariaOrientation',
278
+ 'ariaOwns',
279
+ 'ariaPlaceholder',
280
+ 'ariaPosInSet',
281
+ 'ariaPressed',
282
+ 'ariaReadOnly',
283
+ 'ariaRelevant',
284
+ 'ariaRequired',
285
+ 'ariaRoleDescription',
286
+ 'ariaRowCount',
287
+ 'ariaRowIndex',
288
+ 'ariaRowIndexText',
289
+ 'ariaRowSpan',
290
+ 'ariaSelected',
291
+ 'ariaSetSize',
292
+ 'ariaSort',
293
+ 'ariaValueMax',
294
+ 'ariaValueMin',
295
+ 'ariaValueNow',
296
+ 'ariaValueText',
297
+ 'ariaBrailleLabel',
298
+ 'ariaBrailleRoleDescription',
299
+ 'role',
300
+ ];
301
+ const { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap } = /*@__PURE__*/ (() => {
302
+ const AriaAttrNameToPropNameMap = create(null);
303
+ const AriaPropNameToAttrNameMap = create(null);
304
+ // Synthetic creation of all AOM property descriptors for Custom Elements
305
+ forEach.call(AriaPropertyNames, (propName) => {
306
+ const attrName = StringToLowerCase.call(StringReplace.call(propName, /^aria/, () => 'aria-'));
307
+ AriaAttrNameToPropNameMap[attrName] = propName;
308
+ AriaPropNameToAttrNameMap[propName] = attrName;
309
+ });
310
+ return { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap };
311
+ })();
312
+
313
+ /*
314
+ * Copyright (c) 2020, salesforce.com, inc.
315
+ * All rights reserved.
316
+ * SPDX-License-Identifier: MIT
317
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
318
+ */
319
+ const ESCAPED_CHARS = {
320
+ '"': '"',
321
+ "'": ''',
322
+ '<': '&lt;',
323
+ '>': '&gt;',
324
+ '&': '&amp;',
325
+ };
326
+ /**
327
+ *
328
+ * @param str
329
+ * @param attrMode
330
+ */
331
+ function htmlEscape(str, attrMode = false) {
332
+ const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
333
+ return str.replace(searchValue, (char) => ESCAPED_CHARS[char]);
334
+ }
335
+ /** version: 8.4.0 */
336
+
114
337
  /*
115
338
  * Copyright (c) 2024, Salesforce, Inc.
116
339
  * All rights reserved.
117
340
  * SPDX-License-Identifier: MIT
118
341
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
119
342
  */
343
+ var _MutationTracker_enabledSet, _MutationTracker_mutationMap;
120
344
  class MutationTracker {
121
345
  constructor() {
122
- this.mutationMap = new WeakMap();
346
+ _MutationTracker_enabledSet.set(this, new WeakSet());
347
+ _MutationTracker_mutationMap.set(this, new WeakMap());
123
348
  }
124
349
  add(instance, attrName) {
125
- let mutatedAttrs = this.mutationMap.get(instance);
126
- if (!mutatedAttrs) {
127
- mutatedAttrs = new Set();
128
- this.mutationMap.set(instance, mutatedAttrs);
350
+ if (__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").has(instance)) {
351
+ let mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
352
+ if (!mutatedAttrs) {
353
+ mutatedAttrs = new Set();
354
+ __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").set(instance, mutatedAttrs);
355
+ }
356
+ mutatedAttrs.add(attrName.toLowerCase());
129
357
  }
130
- mutatedAttrs.add(attrName.toLowerCase());
358
+ }
359
+ enable(instance) {
360
+ __classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").add(instance);
361
+ }
362
+ disable(instance) {
363
+ __classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").delete(instance);
131
364
  }
132
365
  renderMutatedAttrs(instance) {
133
- const mutatedAttrs = this.mutationMap.get(instance);
366
+ const mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
134
367
  if (mutatedAttrs) {
135
368
  return ` data-lwc-host-mutated="${[...mutatedAttrs].sort().join(' ')}"`;
136
369
  }
@@ -139,42 +372,73 @@ class MutationTracker {
139
372
  }
140
373
  }
141
374
  }
375
+ _MutationTracker_enabledSet = new WeakMap(), _MutationTracker_mutationMap = new WeakMap();
142
376
  const mutationTracker = new MutationTracker();
143
377
 
378
+ /*
379
+ * Copyright (c) 2024, Salesforce, Inc.
380
+ * All rights reserved.
381
+ * SPDX-License-Identifier: MIT
382
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
383
+ */
384
+ // Eventually include globals that also reflect
385
+ const attrsToProps = AriaAttrNameToPropNameMap;
386
+ function reflectAttrToProp(instance, attrName, attrValue) {
387
+ const reflectedPropName = attrsToProps[attrName];
388
+ // If it is a reflected property and it was not overridden by the instance
389
+ if (reflectedPropName && !hasOwnProperty.call(instance, reflectedPropName)) {
390
+ const currentValue = instance[reflectedPropName];
391
+ if (currentValue !== attrValue) {
392
+ instance[reflectedPropName] = attrValue;
393
+ }
394
+ }
395
+ }
396
+ const descriptors = create(null);
397
+ for (const [attrName, propName] of entries(attrsToProps)) {
398
+ descriptors[propName] = {
399
+ get() {
400
+ return this.getAttribute(attrName);
401
+ },
402
+ set(newValue) {
403
+ const currentValue = this.getAttribute(attrName);
404
+ if (newValue !== currentValue) {
405
+ // TODO [#3284]: According to the spec, IDL nullable type values
406
+ // (null and undefined) should remove the attribute; however, we
407
+ // only do so in the case of null for historical reasons.
408
+ // See also https://github.com/w3c/aria/issues/1858
409
+ if (isNull(newValue)) {
410
+ this.removeAttribute(attrName);
411
+ }
412
+ else {
413
+ this.setAttribute(attrName, toString(newValue));
414
+ }
415
+ }
416
+ },
417
+ configurable: true,
418
+ enumerable: true,
419
+ };
420
+ }
421
+
144
422
  /*
145
423
  * Copyright (c) 2024, salesforce.com, inc.
146
424
  * All rights reserved.
147
425
  * SPDX-License-Identifier: MIT
148
426
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
149
427
  */
150
- var _LightningElement_instances, _LightningElement_setAttribute;
428
+ var _LightningElement_attrs, _LightningElement_classList;
429
+ const SYMBOL__SET_INTERNALS = Symbol('set-internals');
151
430
  class LightningElement {
152
431
  constructor(propsAvailableAtConstruction) {
153
- _LightningElement_instances.add(this);
154
432
  this.isConnected = false;
155
433
  this.className = '';
156
- this.__classList = null;
157
- Object.assign(this, propsAvailableAtConstruction);
158
- }
159
- // TODO [W-14977927]: protect internals from userland
160
- __internal__setState(props, reflectedProps, attrs) {
161
- Object.assign(this, props);
162
- this.__attrs = attrs;
163
- // Whenever a reflected prop changes, we'll update the original props object
164
- // that was passed in. That'll be referenced when the attrs are rendered later.
165
- for (const reflectedPropName of reflectedProps) {
166
- Object.defineProperty(this, reflectedPropName, {
167
- get() {
168
- return props[reflectedPropName] ?? null;
169
- },
170
- set(newValue) {
171
- props[reflectedPropName] = newValue;
172
- mutationTracker.add(this, shared.htmlPropertyToAttribute(reflectedPropName));
173
- },
174
- enumerable: true,
175
- });
176
- }
177
- Object.defineProperty(this, 'className', {
434
+ _LightningElement_attrs.set(this, void 0);
435
+ _LightningElement_classList.set(this, null);
436
+ assign(this, propsAvailableAtConstruction);
437
+ }
438
+ [(_LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
439
+ __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
440
+ assign(this, props);
441
+ defineProperty(this, 'className', {
178
442
  get() {
179
443
  return props.class ?? '';
180
444
  },
@@ -186,35 +450,35 @@ class LightningElement {
186
450
  });
187
451
  }
188
452
  get classList() {
189
- if (this.__classList) {
190
- return this.__classList;
453
+ if (__classPrivateFieldGet(this, _LightningElement_classList, "f")) {
454
+ return __classPrivateFieldGet(this, _LightningElement_classList, "f");
191
455
  }
192
- return (this.__classList = new ClassList(this));
456
+ return (__classPrivateFieldSet(this, _LightningElement_classList, new ClassList(this), "f"));
193
457
  }
194
458
  setAttribute(attrName, attrValue) {
195
- __classPrivateFieldGet(this, _LightningElement_instances, "m", _LightningElement_setAttribute).call(this, attrName, String(attrValue));
459
+ const normalizedName = StringToLowerCase.call(toString(attrName));
460
+ const normalizedValue = String(attrValue);
461
+ __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName] = normalizedValue;
462
+ reflectAttrToProp(this, normalizedName, normalizedValue);
463
+ mutationTracker.add(this, normalizedName);
196
464
  }
197
465
  getAttribute(attrName) {
198
- if (this.hasAttribute(attrName)) {
199
- return this.__attrs[attrName];
466
+ const normalizedName = StringToLowerCase.call(toString(attrName));
467
+ if (hasOwnProperty.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName)) {
468
+ return __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
200
469
  }
201
470
  return null;
202
471
  }
203
472
  hasAttribute(attrName) {
204
- return typeof attrName === 'string' && typeof this.__attrs[attrName] === 'string';
473
+ const normalizedName = StringToLowerCase.call(toString(attrName));
474
+ return hasOwnProperty.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName);
205
475
  }
206
476
  removeAttribute(attrName) {
207
- if (this.hasAttribute(attrName)) {
208
- // Reflected attributes use accessor methods to update their
209
- // corresponding properties so we can't simply `delete`. Instead,
210
- // we use `null` when we want to remove.
211
- __classPrivateFieldGet(this, _LightningElement_instances, "m", _LightningElement_setAttribute).call(this, attrName, null);
212
- }
213
- else {
214
- // This interprets the removal of a non-existing attribute as an
215
- // attribute mutation. We may want to revisit this.
216
- mutationTracker.add(this, attrName);
217
- }
477
+ const normalizedName = StringToLowerCase.call(toString(attrName));
478
+ delete __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
479
+ reflectAttrToProp(this, normalizedName, null);
480
+ // Track mutations for removal of non-existing attributes
481
+ mutationTracker.add(this, normalizedName);
218
482
  }
219
483
  addEventListener(_type, _listener, _options) {
220
484
  // noop
@@ -290,10 +554,7 @@ class LightningElement {
290
554
  throw new Error('Method "setAttributeNS" not implemented.');
291
555
  }
292
556
  }
293
- _LightningElement_instances = new WeakSet(), _LightningElement_setAttribute = function _LightningElement_setAttribute(attrName, attrValue) {
294
- this.__attrs[attrName] = attrValue;
295
- mutationTracker.add(this, attrName);
296
- };
557
+ defineProperties(LightningElement.prototype, descriptors);
297
558
 
298
559
  /*
299
560
  * Copyright (c) 2024, salesforce.com, inc.
@@ -317,19 +578,274 @@ function* renderAttrs(instance, attrs) {
317
578
  }
318
579
  yield mutationTracker.renderMutatedAttrs(instance);
319
580
  }
581
+ function renderAttrsNoYield(emit, instance, attrs) {
582
+ if (!attrs) {
583
+ return;
584
+ }
585
+ for (const attrName of Object.getOwnPropertyNames(attrs)) {
586
+ const attrVal = attrs[attrName];
587
+ if (typeof attrVal === 'string') {
588
+ emit(attrVal === '' ? ` ${attrName}` : ` ${attrName}="${escapeAttrVal(attrVal)}"`);
589
+ }
590
+ else if (attrVal === null) {
591
+ emit('');
592
+ }
593
+ }
594
+ emit(mutationTracker.renderMutatedAttrs(instance));
595
+ }
320
596
  function* fallbackTmpl(_props, _attrs, _slotted, Cmp, _instance) {
321
597
  if (Cmp.renderMode !== 'light') {
322
598
  yield '<template shadowrootmode="open"></template>';
323
599
  }
324
600
  }
325
- async function serverSideRenderComponent(tagName, compiledGenerateMarkup, props) {
601
+ function fallbackTmplNoYield(emit, _props, _attrs, _slotted, Cmp, _instance) {
602
+ if (Cmp.renderMode !== 'light') {
603
+ emit('<template shadowrootmode="open"></template>');
604
+ }
605
+ }
606
+ async function serverSideRenderComponent(tagName, compiledGenerateMarkup, props, mode = 'asyncYield') {
326
607
  let markup = '';
327
- for await (const segment of compiledGenerateMarkup(tagName, props, null, null)) {
608
+ const emit = (segment) => {
328
609
  markup += segment;
610
+ };
611
+ if (mode === 'asyncYield') {
612
+ for await (const segment of compiledGenerateMarkup(tagName, props, null, null)) {
613
+ markup += segment;
614
+ }
615
+ }
616
+ else if (mode === 'async') {
617
+ await compiledGenerateMarkup(emit, tagName, props, null, null);
618
+ }
619
+ else if (mode === 'sync') {
620
+ compiledGenerateMarkup(emit, tagName, props, null, null);
621
+ }
622
+ else {
623
+ throw new Error(`Invalid mode: ${mode}`);
329
624
  }
330
625
  return markup;
331
626
  }
332
627
 
628
+ /*
629
+ * Copyright (c) 2024, Salesforce, Inc.
630
+ * All rights reserved.
631
+ * SPDX-License-Identifier: MIT
632
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
633
+ */
634
+ // Stubs for all the un-implemented exports from @lwc/engine-server
635
+ function api(..._) {
636
+ throw new Error('@api cannot be used in SSR context.');
637
+ }
638
+ function createContextProvider(..._) {
639
+ throw new Error('createContextProvider cannot be used in SSR context.');
640
+ }
641
+ function createElement(..._) {
642
+ throw new Error('createElement cannot be used in SSR context.');
643
+ }
644
+ function freezeTemplate(..._) {
645
+ throw new Error('freezeTemplate cannot be used in SSR context.');
646
+ }
647
+ function getComponentDef(..._) {
648
+ throw new Error('getComponentDef cannot be used in SSR context.');
649
+ }
650
+ function isComponentConstructor(..._) {
651
+ throw new Error('isComponentConstructor cannot be used in SSR context.');
652
+ }
653
+ function parseFragment(..._) {
654
+ throw new Error('parseFragment cannot be used in SSR context.');
655
+ }
656
+ function parseSVGFragment(..._) {
657
+ throw new Error('parseSVGFragment cannot be used in SSR context.');
658
+ }
659
+ function readonly(..._) {
660
+ throw new Error('readonly cannot be used in SSR context.');
661
+ }
662
+ function registerComponent(..._) {
663
+ throw new Error('registerComponent cannot be used in SSR context.');
664
+ }
665
+ function registerDecorators(..._) {
666
+ throw new Error('registerDecorators cannot be used in SSR context.');
667
+ }
668
+ function registerTemplate(..._) {
669
+ throw new Error('registerTemplate cannot be used in SSR context.');
670
+ }
671
+ function sanitizeAttribute(..._) {
672
+ throw new Error('sanitizeAttribute cannot be used in SSR context.');
673
+ }
674
+ function setFeatureFlag(..._) {
675
+ throw new Error('setFeatureFlag cannot be used in SSR context.');
676
+ }
677
+ function setFeatureFlagForTest(..._) {
678
+ throw new Error('setFeatureFlagForTest cannot be used in SSR context.');
679
+ }
680
+ function setHooks(..._) {
681
+ throw new Error('setHooks cannot be used in SSR context.');
682
+ }
683
+ function swapComponent(..._) {
684
+ throw new Error('swapComponent cannot be used in SSR context.');
685
+ }
686
+ function swapStyle(..._) {
687
+ throw new Error('swapStyle cannot be used in SSR context.');
688
+ }
689
+ function swapTemplate(..._) {
690
+ throw new Error('swapTemplate cannot be used in SSR context.');
691
+ }
692
+ function track(..._) {
693
+ throw new Error('@track cannot be used in SSR context.');
694
+ }
695
+ function unwrap(..._) {
696
+ throw new Error('unwrap cannot be used in SSR context.');
697
+ }
698
+ function wire(..._) {
699
+ throw new Error('@wire cannot be used in SSR context.');
700
+ }
701
+ const renderer = {
702
+ isSyntheticShadowDefined: false,
703
+ insert(..._) {
704
+ throw new Error('renderer.insert cannot be used in SSR context.');
705
+ },
706
+ remove(..._) {
707
+ throw new Error('renderer.remove cannot be used in SSR context.');
708
+ },
709
+ cloneNode(..._) {
710
+ throw new Error('renderer.cloneNode cannot be used in SSR context.');
711
+ },
712
+ createFragment(..._) {
713
+ throw new Error('renderer.createFragment cannot be used in SSR context.');
714
+ },
715
+ createElement(..._) {
716
+ throw new Error('renderer.createElement cannot be used in SSR context.');
717
+ },
718
+ createText(..._) {
719
+ throw new Error('renderer.createText cannot be used in SSR context.');
720
+ },
721
+ createComment(..._) {
722
+ throw new Error('renderer.createComment cannot be used in SSR context.');
723
+ },
724
+ createCustomElement(..._) {
725
+ throw new Error('renderer.createCustomElement cannot be used in SSR context.');
726
+ },
727
+ nextSibling(..._) {
728
+ throw new Error('renderer.nextSibling cannot be used in SSR context.');
729
+ },
730
+ previousSibling(..._) {
731
+ throw new Error('renderer.previousSibling cannot be used in SSR context.');
732
+ },
733
+ attachShadow(..._) {
734
+ throw new Error('renderer.attachShadow cannot be used in SSR context.');
735
+ },
736
+ getProperty(..._) {
737
+ throw new Error('renderer.getProperty cannot be used in SSR context.');
738
+ },
739
+ setProperty(..._) {
740
+ throw new Error('renderer.setProperty cannot be used in SSR context.');
741
+ },
742
+ setText(..._) {
743
+ throw new Error('renderer.setText cannot be used in SSR context.');
744
+ },
745
+ getAttribute(..._) {
746
+ throw new Error('renderer.getAttribute cannot be used in SSR context.');
747
+ },
748
+ setAttribute(..._) {
749
+ throw new Error('renderer.setAttribute cannot be used in SSR context.');
750
+ },
751
+ removeAttribute(..._) {
752
+ throw new Error('renderer.removeAttribute cannot be used in SSR context.');
753
+ },
754
+ addEventListener(..._) {
755
+ throw new Error('renderer.addEventListener cannot be used in SSR context.');
756
+ },
757
+ removeEventListener(..._) {
758
+ throw new Error('renderer.removeEventListener cannot be used in SSR context.');
759
+ },
760
+ dispatchEvent(..._) {
761
+ throw new Error('renderer.dispatchEvent cannot be used in SSR context.');
762
+ },
763
+ getClassList(..._) {
764
+ throw new Error('renderer.getClassList cannot be used in SSR context.');
765
+ },
766
+ setCSSStyleProperty(..._) {
767
+ throw new Error('renderer.setCSSStyleProperty cannot be used in SSR context.');
768
+ },
769
+ getBoundingClientRect(..._) {
770
+ throw new Error('renderer.getBoundingClientRect cannot be used in SSR context.');
771
+ },
772
+ querySelector(..._) {
773
+ throw new Error('renderer.querySelector cannot be used in SSR context.');
774
+ },
775
+ querySelectorAll(..._) {
776
+ throw new Error('renderer.querySelectorAll cannot be used in SSR context.');
777
+ },
778
+ getElementsByTagName(..._) {
779
+ throw new Error('renderer.getElementsByTagName cannot be used in SSR context.');
780
+ },
781
+ getElementsByClassName(..._) {
782
+ throw new Error('renderer.getElementsByClassName cannot be used in SSR context.');
783
+ },
784
+ getChildren(..._) {
785
+ throw new Error('renderer.getChildren cannot be used in SSR context.');
786
+ },
787
+ getChildNodes(..._) {
788
+ throw new Error('renderer.getChildNodes cannot be used in SSR context.');
789
+ },
790
+ getFirstChild(..._) {
791
+ throw new Error('renderer.getFirstChild cannot be used in SSR context.');
792
+ },
793
+ getFirstElementChild(..._) {
794
+ throw new Error('renderer.getFirstElementChild cannot be used in SSR context.');
795
+ },
796
+ getLastChild(..._) {
797
+ throw new Error('renderer.getLastChild cannot be used in SSR context.');
798
+ },
799
+ getLastElementChild(..._) {
800
+ throw new Error('renderer.getLastElementChild cannot be used in SSR context.');
801
+ },
802
+ getTagName(..._) {
803
+ throw new Error('renderer.getTagName cannot be used in SSR context.');
804
+ },
805
+ getStyle(..._) {
806
+ throw new Error('renderer.getStyle cannot be used in SSR context.');
807
+ },
808
+ isConnected(..._) {
809
+ throw new Error('renderer.isConnected cannot be used in SSR context.');
810
+ },
811
+ insertStylesheet(..._) {
812
+ throw new Error('renderer.insertStylesheet cannot be used in SSR context.');
813
+ },
814
+ assertInstanceOfHTMLElement(..._) {
815
+ throw new Error('renderer.assertInstanceOfHTMLElement cannot be used in SSR context.');
816
+ },
817
+ ownerDocument(..._) {
818
+ throw new Error('renderer.ownerDocument cannot be used in SSR context.');
819
+ },
820
+ registerContextConsumer(..._) {
821
+ throw new Error('renderer.registerContextConsumer cannot be used in SSR context.');
822
+ },
823
+ attachInternals(..._) {
824
+ throw new Error('renderer.attachInternals cannot be used in SSR context.');
825
+ },
826
+ defineCustomElement(..._) {
827
+ throw new Error('renderer.defineCustomElement cannot be used in SSR context.');
828
+ },
829
+ getParentNode(..._) {
830
+ throw new Error('renderer.getParentNode cannot be used in SSR context.');
831
+ },
832
+ startTrackingMutations(..._) {
833
+ throw new Error('renderer.startTrackingMutations cannot be used in SSR context.');
834
+ },
835
+ stopTrackingMutations(..._) {
836
+ throw new Error('renderer.stopTrackingMutations cannot be used in SSR context.');
837
+ },
838
+ };
839
+ /**
840
+ * The hot API is used to orchestrate hot swapping in client rendered components.
841
+ * It doesn't do anything on the server side, however, you may import it.
842
+ *
843
+ * The whole point of defining this and exporting it is so that you can import it in isomorphic code without
844
+ * an error being thrown by the import itself.
845
+ */
846
+ // A real stub, not a "not implemented" one! 😯
847
+ const hot = undefined;
848
+
333
849
  /*
334
850
  * Copyright (c) 2024, salesforce.com, inc.
335
851
  * All rights reserved.
@@ -417,12 +933,40 @@ function validateStyleTextContents(contents) {
417
933
 
418
934
  exports.ClassList = ClassList;
419
935
  exports.LightningElement = LightningElement;
420
- exports.MutationTracker = MutationTracker;
936
+ exports.SYMBOL__SET_INTERNALS = SYMBOL__SET_INTERNALS;
937
+ exports.api = api;
938
+ exports.createContextProvider = createContextProvider;
939
+ exports.createElement = createElement;
421
940
  exports.fallbackTmpl = fallbackTmpl;
941
+ exports.fallbackTmplNoYield = fallbackTmplNoYield;
942
+ exports.freezeTemplate = freezeTemplate;
943
+ exports.getComponentDef = getComponentDef;
944
+ exports.hot = hot;
945
+ exports.htmlEscape = htmlEscape;
946
+ exports.isComponentConstructor = isComponentConstructor;
947
+ exports.mutationTracker = mutationTracker;
948
+ exports.parseFragment = parseFragment;
949
+ exports.parseSVGFragment = parseSVGFragment;
950
+ exports.readonly = readonly;
951
+ exports.registerComponent = registerComponent;
952
+ exports.registerDecorators = registerDecorators;
953
+ exports.registerTemplate = registerTemplate;
422
954
  exports.renderAttrs = renderAttrs;
955
+ exports.renderAttrsNoYield = renderAttrsNoYield;
423
956
  exports.renderComponent = serverSideRenderComponent;
957
+ exports.renderer = renderer;
958
+ exports.sanitizeAttribute = sanitizeAttribute;
424
959
  exports.serverSideRenderComponent = serverSideRenderComponent;
960
+ exports.setFeatureFlag = setFeatureFlag;
961
+ exports.setFeatureFlagForTest = setFeatureFlagForTest;
962
+ exports.setHooks = setHooks;
963
+ exports.swapComponent = swapComponent;
964
+ exports.swapStyle = swapStyle;
965
+ exports.swapTemplate = swapTemplate;
425
966
  exports.toIteratorDirective = toIteratorDirective;
967
+ exports.track = track;
968
+ exports.unwrap = unwrap;
426
969
  exports.validateStyleTextContents = validateStyleTextContents;
427
- /** version: 8.2.0 */
970
+ exports.wire = wire;
971
+ /** version: 8.4.0 */
428
972
  //# sourceMappingURL=index.cjs.js.map