@lwc/ssr-runtime 8.5.0 → 8.6.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.js CHANGED
@@ -7,736 +7,445 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
9
9
  */
10
- const MULTI_SPACE = /\s+/g;
11
- class ClassList {
12
- constructor(el) {
13
- this.el = el;
14
- }
15
- add(...newClassNames) {
16
- const className = this.el.className;
17
- const set = new Set(className.split(MULTI_SPACE).filter(Boolean));
18
- for (const newClassName of newClassNames) {
19
- set.add(newClassName);
20
- }
21
- this.el.className = Array.from(set).join(' ');
22
- }
23
- contains(className) {
24
- const currentClassNameStr = this.el.className;
25
- return currentClassNameStr.split(MULTI_SPACE).includes(className);
26
- }
27
- remove(...classNamesToRemove) {
28
- const className = this.el.className;
29
- const set = new Set(className.split(MULTI_SPACE).filter(Boolean));
30
- for (const newClassName of classNamesToRemove) {
31
- set.delete(newClassName);
32
- }
33
- this.el.className = Array.from(set).join(' ');
34
- }
35
- replace(oldClassName, newClassName) {
36
- let classWasReplaced = false;
37
- const className = this.el.className;
38
- const listOfClasses = className.split(MULTI_SPACE).filter(Boolean);
39
- listOfClasses.forEach((value, idx) => {
40
- if (value === oldClassName) {
41
- classWasReplaced = true;
42
- listOfClasses[idx] = newClassName;
43
- }
44
- });
45
- this.el.className = listOfClasses.join(' ');
46
- return classWasReplaced;
47
- }
48
- toggle(classNameToToggle, force) {
49
- const classNameStr = this.el.className;
50
- const set = new Set(classNameStr.split(MULTI_SPACE).filter(Boolean));
51
- if (!set.has(classNameToToggle) && force !== false) {
52
- set.add(classNameToToggle);
53
- }
54
- else if (set.has(classNameToToggle) && force !== true) {
55
- set.delete(classNameToToggle);
56
- }
57
- this.el.className = Array.from(set).join(' ');
58
- return set.has(classNameToToggle);
59
- }
60
- get value() {
61
- return this.el.className;
62
- }
63
- toString() {
64
- return this.el.className;
65
- }
66
- item(_index) {
67
- throw new Error('Method "item" not implemented.');
68
- }
69
- supports(_token) {
70
- throw new Error('Method "supports" not implemented.');
71
- }
72
- forEach(_callbackfn, _thisArg) {
73
- throw new Error('Method "forEach" not implemented.');
74
- }
75
- get length() {
76
- throw new Error('Property "length" not implemented.');
77
- }
78
- }
79
-
80
- /******************************************************************************
81
- Copyright (c) Microsoft Corporation.
82
-
83
- Permission to use, copy, modify, and/or distribute this software for any
84
- purpose with or without fee is hereby granted.
85
-
86
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
87
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
88
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
89
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
90
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
91
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
92
- PERFORMANCE OF THIS SOFTWARE.
93
- ***************************************************************************** */
94
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
95
-
96
-
97
- function __classPrivateFieldGet(receiver, state, kind, f) {
98
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
99
- 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");
100
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
101
- }
102
-
103
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
104
- if (kind === "m") throw new TypeError("Private method is not writable");
105
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
106
- 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");
107
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
108
- }
109
-
110
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
111
- var e = new Error(message);
112
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
113
- };
114
-
115
- /**
116
- * Copyright (c) 2024 Salesforce, Inc.
117
- */
118
- /*
119
- * Copyright (c) 2018, salesforce.com, inc.
120
- * All rights reserved.
121
- * SPDX-License-Identifier: MIT
122
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
123
- */
124
- /**
125
- *
126
- * @param value
127
- * @param msg
128
- */
129
-
130
- /*
131
- * Copyright (c) 2024, Salesforce, Inc.
132
- * All rights reserved.
133
- * SPDX-License-Identifier: MIT
134
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
135
- */
136
- const {
137
- /** Detached {@linkcode Object.assign}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN Reference}. */
138
- assign,
139
- /** Detached {@linkcode Object.create}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create MDN Reference}. */
140
- create,
141
- /** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */
142
- defineProperties,
143
- /** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */
144
- defineProperty,
145
- /** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
146
- entries,
147
- /** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */
148
- freeze,
149
- /** Detached {@linkcode Object.fromEntries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries MDN Reference}. */
150
- fromEntries,
151
- /** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */
152
- getOwnPropertyDescriptor,
153
- /** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */
154
- getOwnPropertyDescriptors,
155
- /** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
156
- getOwnPropertyNames,
157
- /** Detached {@linkcode Object.getOwnPropertySymbols}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols MDN Reference}. */
158
- getOwnPropertySymbols,
159
- /** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
160
- getPrototypeOf,
161
- /** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
162
- hasOwnProperty,
163
- /** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */
164
- isFrozen,
165
- /** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */
166
- keys,
167
- /** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */
168
- seal,
169
- /** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
170
- setPrototypeOf, } = Object;
171
- const {
172
- /** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
173
- isArray,
174
- /** Detached {@linkcode Array.from}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from MDN Reference}. */
175
- from: ArrayFrom, } = Array;
176
- // For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
177
- // though it works fine for one, e.g. isArray), so comments for these are added to the export
178
- // statement, rather than this declaration.
179
- 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!
180
- } = Array.prototype;
181
- // No JSDocs here - see comment for Array.prototype
182
- const { charAt: StringCharAt, charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, trim: StringTrim, } = String.prototype;
183
- /**
184
- * Determines whether the argument is `null`.
185
- * @param obj Value to test
186
- * @returns `true` if the value is `null`.
187
- */
188
- function isNull(obj) {
189
- return obj === null;
190
- }
191
- const OtS = {}.toString;
192
- /**
193
- * Converts the argument to a string, safely accounting for objects with "null" prototype.
194
- * Note that `toString(null)` returns `"[object Null]"` rather than `"null"`.
195
- * @param obj Value to convert to a string.
196
- * @returns String representation of the value.
197
- */
198
- function toString(obj) {
199
- if (obj?.toString) {
200
- // Arrays might hold objects with "null" prototype So using
201
- // Array.prototype.toString directly will cause an error Iterate through
202
- // all the items and handle individually.
203
- if (isArray(obj)) {
204
- // This behavior is slightly different from Array#toString:
205
- // 1. Array#toString calls `this.join`, rather than Array#join
206
- // Ex: arr = []; arr.join = () => 1; arr.toString() === 1; toString(arr) === ''
207
- // 2. Array#toString delegates to Object#toString if `this.join` is not a function
208
- // Ex: arr = []; arr.join = 'no'; arr.toString() === '[object Array]; toString(arr) = ''
209
- // 3. Array#toString converts null/undefined to ''
210
- // Ex: arr = [null, undefined]; arr.toString() === ','; toString(arr) === '[object Null],undefined'
211
- // 4. Array#toString converts recursive references to arrays to ''
212
- // Ex: arr = [1]; arr.push(arr, 2); arr.toString() === '1,,2'; toString(arr) throws
213
- // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
214
- return ArrayJoin.call(ArrayMap.call(obj, toString), ',');
215
- }
216
- return obj.toString();
217
- }
218
- else if (typeof obj === 'object') {
219
- // This catches null and returns "[object Null]". Weird, but kept for backwards compatibility.
220
- return OtS.call(obj);
221
- }
222
- else {
223
- return String(obj);
224
- }
225
- }
226
-
227
- /*
228
- * Copyright (c) 2018, salesforce.com, inc.
229
- * All rights reserved.
230
- * SPDX-License-Identifier: MIT
231
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
232
- */
233
- /**
234
- * According to the following list, there are 48 aria attributes of which two (ariaDropEffect and
235
- * ariaGrabbed) are deprecated:
236
- * https://www.w3.org/TR/wai-aria-1.1/#x6-6-definitions-of-states-and-properties-all-aria-attributes
237
- *
238
- * The above list of 46 aria attributes is consistent with the following resources:
239
- * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
240
- * https://wicg.github.io/aom/spec/aria-reflection.html
241
- *
242
- * NOTE: If you update this list, please update test files that implicitly reference this list!
243
- * Searching the codebase for `aria-flowto` and `ariaFlowTo` should be good enough to find all usages.
244
- */
245
- const AriaPropertyNames = [
246
- 'ariaActiveDescendant',
247
- 'ariaAtomic',
248
- 'ariaAutoComplete',
249
- 'ariaBusy',
250
- 'ariaChecked',
251
- 'ariaColCount',
252
- 'ariaColIndex',
253
- 'ariaColIndexText',
254
- 'ariaColSpan',
255
- 'ariaControls',
256
- 'ariaCurrent',
257
- 'ariaDescribedBy',
258
- 'ariaDescription',
259
- 'ariaDetails',
260
- 'ariaDisabled',
261
- 'ariaErrorMessage',
262
- 'ariaExpanded',
263
- 'ariaFlowTo',
264
- 'ariaHasPopup',
265
- 'ariaHidden',
266
- 'ariaInvalid',
267
- 'ariaKeyShortcuts',
268
- 'ariaLabel',
269
- 'ariaLabelledBy',
270
- 'ariaLevel',
271
- 'ariaLive',
272
- 'ariaModal',
273
- 'ariaMultiLine',
274
- 'ariaMultiSelectable',
275
- 'ariaOrientation',
276
- 'ariaOwns',
277
- 'ariaPlaceholder',
278
- 'ariaPosInSet',
279
- 'ariaPressed',
280
- 'ariaReadOnly',
281
- 'ariaRelevant',
282
- 'ariaRequired',
283
- 'ariaRoleDescription',
284
- 'ariaRowCount',
285
- 'ariaRowIndex',
286
- 'ariaRowIndexText',
287
- 'ariaRowSpan',
288
- 'ariaSelected',
289
- 'ariaSetSize',
290
- 'ariaSort',
291
- 'ariaValueMax',
292
- 'ariaValueMin',
293
- 'ariaValueNow',
294
- 'ariaValueText',
295
- 'ariaBrailleLabel',
296
- 'ariaBrailleRoleDescription',
297
- 'role',
298
- ];
299
- const { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap } = /*@__PURE__*/ (() => {
300
- const AriaAttrNameToPropNameMap = create(null);
301
- const AriaPropNameToAttrNameMap = create(null);
302
- // Synthetic creation of all AOM property descriptors for Custom Elements
303
- forEach.call(AriaPropertyNames, (propName) => {
304
- const attrName = StringToLowerCase.call(StringReplace.call(propName, /^aria/, () => 'aria-'));
305
- AriaAttrNameToPropNameMap[attrName] = propName;
306
- AriaPropNameToAttrNameMap[propName] = attrName;
307
- });
308
- return { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap };
309
- })();
310
-
311
- /*
312
- * Copyright (c) 2020, salesforce.com, inc.
313
- * All rights reserved.
314
- * SPDX-License-Identifier: MIT
315
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
316
- */
317
- const ESCAPED_CHARS = {
318
- '"': '"',
319
- "'": ''',
320
- '<': '&lt;',
321
- '>': '&gt;',
322
- '&': '&amp;',
323
- };
324
- /**
325
- *
326
- * @param str
327
- * @param attrMode
328
- */
329
- function htmlEscape(str, attrMode = false) {
330
- const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
331
- return str.replace(searchValue, (char) => ESCAPED_CHARS[char]);
10
+ // Stubs for all the un-implemented exports from @lwc/engine-server
11
+ function api(..._) {
12
+ throw new Error('@api cannot be used in SSR context.');
332
13
  }
333
- function flattenStylesheets(stylesheets) {
334
- const list = [];
335
- for (const stylesheet of stylesheets) {
336
- if (!isArray(stylesheet)) {
337
- list.push(stylesheet);
338
- }
339
- else {
340
- list.push(...flattenStylesheets(stylesheet));
341
- }
342
- }
343
- return list;
14
+ function createContextProvider(..._) {
15
+ throw new Error('createContextProvider cannot be used in SSR context.');
344
16
  }
345
- /** version: 8.5.0 */
346
-
347
- /*
348
- * Copyright (c) 2024, Salesforce, Inc.
349
- * All rights reserved.
350
- * SPDX-License-Identifier: MIT
351
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
352
- */
353
- var _MutationTracker_enabledSet, _MutationTracker_mutationMap;
354
- class MutationTracker {
355
- constructor() {
356
- _MutationTracker_enabledSet.set(this, new WeakSet());
357
- _MutationTracker_mutationMap.set(this, new WeakMap());
358
- }
359
- add(instance, attrName) {
360
- if (__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").has(instance)) {
361
- let mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
362
- if (!mutatedAttrs) {
363
- mutatedAttrs = new Set();
364
- __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").set(instance, mutatedAttrs);
365
- }
366
- mutatedAttrs.add(attrName.toLowerCase());
367
- }
368
- }
369
- enable(instance) {
370
- __classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").add(instance);
371
- }
372
- disable(instance) {
373
- __classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").delete(instance);
374
- }
375
- renderMutatedAttrs(instance) {
376
- const mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
377
- if (mutatedAttrs) {
378
- return ` data-lwc-host-mutated="${[...mutatedAttrs].sort().join(' ')}"`;
379
- }
380
- else {
381
- return '';
382
- }
383
- }
17
+ function createElement(..._) {
18
+ throw new Error('createElement cannot be used in SSR context.');
384
19
  }
385
- _MutationTracker_enabledSet = new WeakMap(), _MutationTracker_mutationMap = new WeakMap();
386
- const mutationTracker = new MutationTracker();
387
-
388
- /*
389
- * Copyright (c) 2024, Salesforce, Inc.
390
- * All rights reserved.
391
- * SPDX-License-Identifier: MIT
392
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
393
- */
394
- /**
395
- * Map of global attribute or ARIA attribute to the corresponding property name.
396
- * Not all global attributes are included, just those from `HTMLElementTheGoodParts`.
397
- */
398
- const attrsToProps = assign(create(null), {
399
- accesskey: 'accessKey',
400
- dir: 'dir',
401
- draggable: 'draggable',
402
- hidden: 'hidden',
403
- id: 'id',
404
- lang: 'lang',
405
- spellcheck: 'spellcheck',
406
- tabindex: 'tabIndex',
407
- title: 'title',
408
- ...AriaAttrNameToPropNameMap,
409
- });
410
- /**
411
- * Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
412
- */
413
- const stringDescriptor = (attrName) => ({
414
- configurable: true,
415
- enumerable: true,
416
- get() {
417
- return this.getAttribute(attrName);
20
+ function freezeTemplate(..._) {
21
+ throw new Error('freezeTemplate cannot be used in SSR context.');
22
+ }
23
+ function getComponentDef(..._) {
24
+ throw new Error('getComponentDef cannot be used in SSR context.');
25
+ }
26
+ function isComponentConstructor(..._) {
27
+ throw new Error('isComponentConstructor cannot be used in SSR context.');
28
+ }
29
+ function parseFragment(..._) {
30
+ throw new Error('parseFragment cannot be used in SSR context.');
31
+ }
32
+ function parseSVGFragment(..._) {
33
+ throw new Error('parseSVGFragment cannot be used in SSR context.');
34
+ }
35
+ function readonly(..._) {
36
+ throw new Error('readonly cannot be used in SSR context.');
37
+ }
38
+ function registerComponent(..._) {
39
+ throw new Error('registerComponent cannot be used in SSR context.');
40
+ }
41
+ function registerDecorators(..._) {
42
+ throw new Error('registerDecorators cannot be used in SSR context.');
43
+ }
44
+ function registerTemplate(..._) {
45
+ throw new Error('registerTemplate cannot be used in SSR context.');
46
+ }
47
+ function sanitizeAttribute(..._) {
48
+ throw new Error('sanitizeAttribute cannot be used in SSR context.');
49
+ }
50
+ function setFeatureFlag(..._) {
51
+ throw new Error('setFeatureFlag cannot be used in SSR context.');
52
+ }
53
+ function setFeatureFlagForTest(..._) {
54
+ throw new Error('setFeatureFlagForTest cannot be used in SSR context.');
55
+ }
56
+ function swapComponent(..._) {
57
+ throw new Error('swapComponent cannot be used in SSR context.');
58
+ }
59
+ function swapStyle(..._) {
60
+ throw new Error('swapStyle cannot be used in SSR context.');
61
+ }
62
+ function swapTemplate(..._) {
63
+ throw new Error('swapTemplate cannot be used in SSR context.');
64
+ }
65
+ function track(..._) {
66
+ throw new Error('@track cannot be used in SSR context.');
67
+ }
68
+ function unwrap(..._) {
69
+ throw new Error('unwrap cannot be used in SSR context.');
70
+ }
71
+ function wire(..._) {
72
+ throw new Error('@wire cannot be used in SSR context.');
73
+ }
74
+ const renderer = {
75
+ isSyntheticShadowDefined: false,
76
+ insert(..._) {
77
+ throw new Error('renderer.insert cannot be used in SSR context.');
418
78
  },
419
- set(newValue) {
420
- const currentValue = this.getAttribute(attrName);
421
- const normalizedValue = String(newValue);
422
- if (normalizedValue !== currentValue) {
423
- this.setAttribute(attrName, normalizedValue);
424
- }
79
+ remove(..._) {
80
+ throw new Error('renderer.remove cannot be used in SSR context.');
81
+ },
82
+ cloneNode(..._) {
83
+ throw new Error('renderer.cloneNode cannot be used in SSR context.');
84
+ },
85
+ createFragment(..._) {
86
+ throw new Error('renderer.createFragment cannot be used in SSR context.');
87
+ },
88
+ createElement(..._) {
89
+ throw new Error('renderer.createElement cannot be used in SSR context.');
90
+ },
91
+ createText(..._) {
92
+ throw new Error('renderer.createText cannot be used in SSR context.');
93
+ },
94
+ createComment(..._) {
95
+ throw new Error('renderer.createComment cannot be used in SSR context.');
96
+ },
97
+ createCustomElement(..._) {
98
+ throw new Error('renderer.createCustomElement cannot be used in SSR context.');
99
+ },
100
+ nextSibling(..._) {
101
+ throw new Error('renderer.nextSibling cannot be used in SSR context.');
102
+ },
103
+ previousSibling(..._) {
104
+ throw new Error('renderer.previousSibling cannot be used in SSR context.');
105
+ },
106
+ attachShadow(..._) {
107
+ throw new Error('renderer.attachShadow cannot be used in SSR context.');
108
+ },
109
+ getProperty(..._) {
110
+ throw new Error('renderer.getProperty cannot be used in SSR context.');
111
+ },
112
+ setProperty(..._) {
113
+ throw new Error('renderer.setProperty cannot be used in SSR context.');
114
+ },
115
+ setText(..._) {
116
+ throw new Error('renderer.setText cannot be used in SSR context.');
117
+ },
118
+ getAttribute(..._) {
119
+ throw new Error('renderer.getAttribute cannot be used in SSR context.');
120
+ },
121
+ setAttribute(..._) {
122
+ throw new Error('renderer.setAttribute cannot be used in SSR context.');
123
+ },
124
+ removeAttribute(..._) {
125
+ throw new Error('renderer.removeAttribute cannot be used in SSR context.');
126
+ },
127
+ addEventListener(..._) {
128
+ throw new Error('renderer.addEventListener cannot be used in SSR context.');
129
+ },
130
+ removeEventListener(..._) {
131
+ throw new Error('renderer.removeEventListener cannot be used in SSR context.');
132
+ },
133
+ dispatchEvent(..._) {
134
+ throw new Error('renderer.dispatchEvent cannot be used in SSR context.');
135
+ },
136
+ getClassList(..._) {
137
+ throw new Error('renderer.getClassList cannot be used in SSR context.');
138
+ },
139
+ setCSSStyleProperty(..._) {
140
+ throw new Error('renderer.setCSSStyleProperty cannot be used in SSR context.');
141
+ },
142
+ getBoundingClientRect(..._) {
143
+ throw new Error('renderer.getBoundingClientRect cannot be used in SSR context.');
144
+ },
145
+ querySelector(..._) {
146
+ throw new Error('renderer.querySelector cannot be used in SSR context.');
147
+ },
148
+ querySelectorAll(..._) {
149
+ throw new Error('renderer.querySelectorAll cannot be used in SSR context.');
150
+ },
151
+ getElementsByTagName(..._) {
152
+ throw new Error('renderer.getElementsByTagName cannot be used in SSR context.');
153
+ },
154
+ getElementsByClassName(..._) {
155
+ throw new Error('renderer.getElementsByClassName cannot be used in SSR context.');
156
+ },
157
+ getChildren(..._) {
158
+ throw new Error('renderer.getChildren cannot be used in SSR context.');
159
+ },
160
+ getChildNodes(..._) {
161
+ throw new Error('renderer.getChildNodes cannot be used in SSR context.');
162
+ },
163
+ getFirstChild(..._) {
164
+ throw new Error('renderer.getFirstChild cannot be used in SSR context.');
165
+ },
166
+ getFirstElementChild(..._) {
167
+ throw new Error('renderer.getFirstElementChild cannot be used in SSR context.');
168
+ },
169
+ getLastChild(..._) {
170
+ throw new Error('renderer.getLastChild cannot be used in SSR context.');
171
+ },
172
+ getLastElementChild(..._) {
173
+ throw new Error('renderer.getLastElementChild cannot be used in SSR context.');
174
+ },
175
+ getTagName(..._) {
176
+ throw new Error('renderer.getTagName cannot be used in SSR context.');
177
+ },
178
+ getStyle(..._) {
179
+ throw new Error('renderer.getStyle cannot be used in SSR context.');
180
+ },
181
+ isConnected(..._) {
182
+ throw new Error('renderer.isConnected cannot be used in SSR context.');
183
+ },
184
+ insertStylesheet(..._) {
185
+ throw new Error('renderer.insertStylesheet cannot be used in SSR context.');
425
186
  },
426
- });
427
- /** Descriptor for a boolean that checks for `attr="true"` or `attr="false"`, e.g. `spellcheck` and `draggable`. */
428
- const explicitBooleanDescriptor = (attrName, defaultValue) => ({
429
- configurable: true,
430
- enumerable: true,
431
- get() {
432
- const value = this.getAttribute(attrName);
433
- return value === null ? defaultValue : value === String(defaultValue);
187
+ assertInstanceOfHTMLElement(..._) {
188
+ throw new Error('renderer.assertInstanceOfHTMLElement cannot be used in SSR context.');
434
189
  },
435
- set(newValue) {
436
- const currentValue = this.getAttribute(attrName);
437
- const normalizedValue = String(Boolean(newValue));
438
- if (normalizedValue !== currentValue) {
439
- this.setAttribute(attrName, normalizedValue);
440
- }
190
+ ownerDocument(..._) {
191
+ throw new Error('renderer.ownerDocument cannot be used in SSR context.');
441
192
  },
442
- });
443
- /**
444
- * Descriptor for a "true" boolean attribute that checks solely for presence, e.g. `hidden`.
445
- */
446
- const booleanAttributeDescriptor = (attrName) => ({
447
- configurable: true,
448
- enumerable: true,
449
- get() {
450
- return this.hasAttribute(attrName);
193
+ registerContextConsumer(..._) {
194
+ throw new Error('renderer.registerContextConsumer cannot be used in SSR context.');
451
195
  },
452
- set(newValue) {
453
- const hasAttribute = this.hasAttribute(attrName);
454
- if (newValue) {
455
- if (!hasAttribute) {
456
- this.setAttribute(attrName, '');
457
- }
458
- }
459
- else {
460
- if (hasAttribute) {
461
- this.removeAttribute(attrName);
462
- }
463
- }
196
+ attachInternals(..._) {
197
+ throw new Error('renderer.attachInternals cannot be used in SSR context.');
464
198
  },
465
- });
466
- /**
467
- * Descriptor for ARIA reflections, e.g. `ariaLabel` and `role`.
468
- */
469
- const ariaDescriptor = (attrName) => ({
470
- configurable: true,
471
- enumerable: true,
472
- get() {
473
- return this.getAttribute(attrName);
199
+ defineCustomElement(..._) {
200
+ throw new Error('renderer.defineCustomElement cannot be used in SSR context.');
474
201
  },
475
- set(newValue) {
476
- const currentValue = this.getAttribute(attrName);
477
- if (newValue !== currentValue) {
478
- // TODO [#3284]: According to the spec, IDL nullable type values
479
- // (null and undefined) should remove the attribute; however, we
480
- // only do so in the case of null for historical reasons.
481
- if (isNull(newValue)) {
482
- this.removeAttribute(attrName);
483
- }
484
- else {
485
- this.setAttribute(attrName, toString(newValue));
486
- }
487
- }
202
+ getParentNode(..._) {
203
+ throw new Error('renderer.getParentNode cannot be used in SSR context.');
488
204
  },
489
- });
490
- function reflectAttrToProp(instance, attrName, attrValue) {
491
- const reflectedPropName = attrsToProps[attrName];
492
- // If it is a reflected property and it was not overridden by the instance
493
- if (reflectedPropName && !hasOwnProperty.call(instance, reflectedPropName)) {
494
- const currentValue = instance[reflectedPropName];
495
- if (currentValue !== attrValue) {
496
- instance[reflectedPropName] = attrValue;
497
- }
498
- }
499
- }
500
- const descriptors = {
501
- accessKey: stringDescriptor('accesskey'),
502
- dir: stringDescriptor('dir'),
503
- draggable: explicitBooleanDescriptor('draggable', true),
504
- hidden: booleanAttributeDescriptor('hidden'),
505
- id: stringDescriptor('id'),
506
- lang: stringDescriptor('lang'),
507
- spellcheck: explicitBooleanDescriptor('spellcheck', false),
508
- tabIndex: {
509
- get() {
510
- const str = this.getAttribute('tabindex');
511
- const num = Number(str);
512
- return isFinite(num) ? Math.trunc(num) : -1;
513
- },
514
- set(newValue) {
515
- const currentValue = this.getAttribute('tabindex');
516
- const num = Number(newValue);
517
- const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
518
- if (normalizedValue !== currentValue) {
519
- this.setAttribute('tabindex', toString(newValue));
520
- }
521
- },
205
+ startTrackingMutations(..._) {
206
+ throw new Error('renderer.startTrackingMutations cannot be used in SSR context.');
207
+ },
208
+ stopTrackingMutations(..._) {
209
+ throw new Error('renderer.stopTrackingMutations cannot be used in SSR context.');
522
210
  },
523
- title: stringDescriptor('title'),
524
211
  };
525
- // Add descriptors for ARIA attributes
526
- for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
527
- descriptors[propName] = ariaDescriptor(attrName);
528
- }
212
+ /**
213
+ * The hot API is used to orchestrate hot swapping in client rendered components.
214
+ * It doesn't do anything on the server side, however, you may import it.
215
+ *
216
+ * The whole point of defining this and exporting it is so that you can import it in isomorphic code without
217
+ * an error being thrown by the import itself.
218
+ */
219
+ // A real stub, not a "not implemented" one! 😯
220
+ const hot = undefined;
529
221
 
222
+ /**
223
+ * Copyright (c) 2024 Salesforce, Inc.
224
+ */
530
225
  /*
531
- * Copyright (c) 2024, salesforce.com, inc.
226
+ * Copyright (c) 2018, salesforce.com, inc.
532
227
  * All rights reserved.
533
228
  * SPDX-License-Identifier: MIT
534
229
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
535
- */
536
- var _LightningElement_attrs, _LightningElement_classList;
537
- const SYMBOL__SET_INTERNALS = Symbol('set-internals');
538
- const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
539
- class LightningElement {
540
- constructor(propsAvailableAtConstruction) {
541
- this.isConnected = false;
542
- this.className = '';
543
- _LightningElement_attrs.set(this, void 0);
544
- _LightningElement_classList.set(this, null);
545
- assign(this, propsAvailableAtConstruction);
546
- }
547
- [(_LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
548
- __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
549
- assign(this, props);
550
- defineProperty(this, 'className', {
551
- get() {
552
- return props.class ?? '';
553
- },
554
- set(newVal) {
555
- props.class = newVal;
556
- attrs.class = newVal;
557
- mutationTracker.add(this, 'class');
558
- },
559
- });
560
- }
561
- get classList() {
562
- if (__classPrivateFieldGet(this, _LightningElement_classList, "f")) {
563
- return __classPrivateFieldGet(this, _LightningElement_classList, "f");
564
- }
565
- return (__classPrivateFieldSet(this, _LightningElement_classList, new ClassList(this), "f"));
566
- }
567
- setAttribute(attrName, attrValue) {
568
- const normalizedName = StringToLowerCase.call(toString(attrName));
569
- const normalizedValue = String(attrValue);
570
- __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName] = normalizedValue;
571
- reflectAttrToProp(this, normalizedName, normalizedValue);
572
- mutationTracker.add(this, normalizedName);
573
- }
574
- getAttribute(attrName) {
575
- const normalizedName = StringToLowerCase.call(toString(attrName));
576
- if (hasOwnProperty.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName)) {
577
- return __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
578
- }
579
- return null;
580
- }
581
- hasAttribute(attrName) {
582
- const normalizedName = StringToLowerCase.call(toString(attrName));
583
- return hasOwnProperty.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName);
584
- }
585
- removeAttribute(attrName) {
586
- const normalizedName = StringToLowerCase.call(toString(attrName));
587
- delete __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
588
- reflectAttrToProp(this, normalizedName, null);
589
- // Track mutations for removal of non-existing attributes
590
- mutationTracker.add(this, normalizedName);
591
- }
592
- addEventListener(_type, _listener, _options) {
593
- // noop
594
- }
595
- removeEventListener(_type, _listener, _options) {
596
- // noop
597
- }
598
- // ----------------------------------------------------------- //
599
- // Props/methods explicitly not available in this environment //
600
- // Getters are named "get*" for parity with @lwc/engine-server //
601
- // ----------------------------------------------------------- //
602
- get children() {
603
- throw new TypeError('"getChildren" is not supported in this environment');
604
- }
605
- get childNodes() {
606
- throw new TypeError('"getChildNodes" is not supported in this environment');
607
- }
608
- get firstChild() {
609
- throw new TypeError('"getFirstChild" is not supported in this environment');
610
- }
611
- get firstElementChild() {
612
- throw new TypeError('"getFirstElementChild" is not supported in this environment');
613
- }
614
- get hostElement() {
615
- // Intentionally different to match @lwc/engine-*core*
616
- throw new TypeError('this.hostElement is not supported in this environment');
617
- }
618
- get lastChild() {
619
- throw new TypeError('"getLastChild" is not supported in this environment');
620
- }
621
- get lastElementChild() {
622
- throw new TypeError('"getLastElementChild" is not supported in this environment');
623
- }
624
- get ownerDocument() {
625
- // Intentionally not "get*" to match @lwc/engine-server
626
- throw new TypeError('"ownerDocument" is not supported in this environment');
627
- }
628
- get style() {
629
- // Intentionally not "get*" to match @lwc/engine-server
630
- throw new TypeError('"style" is not supported in this environment');
631
- }
632
- attachInternals() {
633
- throw new TypeError('"attachInternals" is not supported in this environment');
634
- }
635
- dispatchEvent(_event) {
636
- throw new TypeError('"dispatchEvent" is not supported in this environment');
637
- }
638
- getBoundingClientRect() {
639
- throw new TypeError('"getBoundingClientRect" is not supported in this environment');
640
- }
641
- getElementsByClassName(_classNames) {
642
- throw new TypeError('"getElementsByClassName" is not supported in this environment');
643
- }
644
- getElementsByTagName(_qualifiedName) {
645
- throw new TypeError('"getElementsByTagName" is not supported in this environment');
646
- }
647
- querySelector(_selectors) {
648
- throw new TypeError('"querySelector" is not supported in this environment');
649
- }
650
- querySelectorAll(_selectors) {
651
- throw new TypeError('"querySelectorAll" is not supported in this environment');
652
- }
653
- getAttributeNS(_namespace, _localName) {
654
- throw new Error('Method "getAttributeNS" not implemented.');
655
- }
656
- hasAttributeNS(_namespace, _localName) {
657
- throw new Error('Method "hasAttributeNS" not implemented.');
658
- }
659
- removeAttributeNS(_namespace, _localName) {
660
- throw new Error('Method "removeAttributeNS" not implemented.');
661
- }
662
- setAttributeNS(_namespace, _qualifiedName, _value) {
663
- throw new Error('Method "setAttributeNS" not implemented.');
230
+ */
231
+ /**
232
+ *
233
+ * @param value
234
+ * @param msg
235
+ */
236
+ /**
237
+ *
238
+ * @param value
239
+ * @param msg
240
+ */
241
+ function isFalse$1(value, msg) {
242
+ if (value) {
243
+ throw new Error(`Assert Violation: ${msg}`);
664
244
  }
665
245
  }
666
- defineProperties(LightningElement.prototype, descriptors);
667
246
 
668
247
  /*
669
- * Copyright (c) 2024, salesforce.com, inc.
248
+ * Copyright (c) 2024, Salesforce, Inc.
670
249
  * All rights reserved.
671
250
  * SPDX-License-Identifier: MIT
672
251
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
673
252
  */
674
- const escapeAttrVal = (attrVal) => attrVal.replaceAll('&', '&amp;').replaceAll('"', '&quot;');
675
- function* renderAttrs(instance, attrs) {
676
- if (!attrs) {
677
- return;
678
- }
679
- for (const attrName of Object.getOwnPropertyNames(attrs)) {
680
- const attrVal = attrs[attrName];
681
- if (typeof attrVal === 'string') {
682
- yield attrVal === '' ? ` ${attrName}` : ` ${attrName}="${escapeAttrVal(attrVal)}"`;
683
- }
684
- else if (attrVal === null) {
685
- yield '';
686
- }
687
- }
688
- yield mutationTracker.renderMutatedAttrs(instance);
689
- }
690
- function renderAttrsNoYield(emit, instance, attrs) {
691
- if (!attrs) {
692
- return;
693
- }
694
- for (const attrName of Object.getOwnPropertyNames(attrs)) {
695
- const attrVal = attrs[attrName];
696
- if (typeof attrVal === 'string') {
697
- emit(attrVal === '' ? ` ${attrName}` : ` ${attrName}="${escapeAttrVal(attrVal)}"`);
698
- }
699
- else if (attrVal === null) {
700
- emit('');
701
- }
702
- }
703
- emit(mutationTracker.renderMutatedAttrs(instance));
704
- }
705
- function* fallbackTmpl(_props, _attrs, _slotted, Cmp, _instance) {
706
- if (Cmp.renderMode !== 'light') {
707
- yield '<template shadowrootmode="open"></template>';
708
- }
709
- }
710
- function fallbackTmplNoYield(emit, _props, _attrs, _slotted, Cmp, _instance) {
711
- if (Cmp.renderMode !== 'light') {
712
- emit('<template shadowrootmode="open"></template>');
713
- }
253
+ const {
254
+ /** Detached {@linkcode Object.assign}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN Reference}. */
255
+ assign,
256
+ /** Detached {@linkcode Object.create}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create MDN Reference}. */
257
+ create,
258
+ /** Detached {@linkcode Object.defineProperties}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties MDN Reference}. */
259
+ defineProperties,
260
+ /** Detached {@linkcode Object.defineProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty MDN Reference}. */
261
+ defineProperty,
262
+ /** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
263
+ entries,
264
+ /** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */
265
+ freeze,
266
+ /** Detached {@linkcode Object.fromEntries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries MDN Reference}. */
267
+ fromEntries,
268
+ /** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */
269
+ getOwnPropertyDescriptor,
270
+ /** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */
271
+ getOwnPropertyDescriptors,
272
+ /** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
273
+ getOwnPropertyNames,
274
+ /** Detached {@linkcode Object.getOwnPropertySymbols}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols MDN Reference}. */
275
+ getOwnPropertySymbols,
276
+ /** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
277
+ getPrototypeOf,
278
+ /** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
279
+ hasOwnProperty,
280
+ /** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */
281
+ isFrozen,
282
+ /** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */
283
+ keys,
284
+ /** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */
285
+ seal,
286
+ /** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
287
+ setPrototypeOf, } = Object;
288
+ const {
289
+ /** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
290
+ isArray,
291
+ /** Detached {@linkcode Array.from}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from MDN Reference}. */
292
+ from: ArrayFrom, } = Array;
293
+ // For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
294
+ // though it works fine for one, e.g. isArray), so comments for these are added to the export
295
+ // statement, rather than this declaration.
296
+ 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!
297
+ } = Array.prototype;
298
+ // No JSDocs here - see comment for Array.prototype
299
+ const { charAt: StringCharAt, charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, trim: StringTrim, } = String.prototype;
300
+ /**
301
+ * Determines whether the argument is `null`.
302
+ * @param obj Value to test
303
+ * @returns `true` if the value is `null`.
304
+ */
305
+ function isNull(obj) {
306
+ return obj === null;
714
307
  }
715
- async function serverSideRenderComponent(tagName, Component, props = {}, mode = 'asyncYield') {
716
- if (typeof tagName !== 'string') {
717
- throw new Error(`tagName must be a string, found: ${tagName}`);
718
- }
719
- // TODO [#4726]: remove `generateMarkup` export
720
- const generateMarkup = SYMBOL__GENERATE_MARKUP in Component ? Component[SYMBOL__GENERATE_MARKUP] : Component;
721
- let markup = '';
722
- const emit = (segment) => {
723
- markup += segment;
724
- };
725
- if (mode === 'asyncYield') {
726
- for await (const segment of generateMarkup(tagName, props, null, null)) {
727
- markup += segment;
308
+ const OtS = {}.toString;
309
+ /**
310
+ * Converts the argument to a string, safely accounting for objects with "null" prototype.
311
+ * Note that `toString(null)` returns `"[object Null]"` rather than `"null"`.
312
+ * @param obj Value to convert to a string.
313
+ * @returns String representation of the value.
314
+ */
315
+ function toString(obj) {
316
+ if (obj?.toString) {
317
+ // Arrays might hold objects with "null" prototype So using
318
+ // Array.prototype.toString directly will cause an error Iterate through
319
+ // all the items and handle individually.
320
+ if (isArray(obj)) {
321
+ // This behavior is slightly different from Array#toString:
322
+ // 1. Array#toString calls `this.join`, rather than Array#join
323
+ // Ex: arr = []; arr.join = () => 1; arr.toString() === 1; toString(arr) === ''
324
+ // 2. Array#toString delegates to Object#toString if `this.join` is not a function
325
+ // Ex: arr = []; arr.join = 'no'; arr.toString() === '[object Array]; toString(arr) = ''
326
+ // 3. Array#toString converts null/undefined to ''
327
+ // Ex: arr = [null, undefined]; arr.toString() === ','; toString(arr) === '[object Null],undefined'
328
+ // 4. Array#toString converts recursive references to arrays to ''
329
+ // Ex: arr = [1]; arr.push(arr, 2); arr.toString() === '1,,2'; toString(arr) throws
330
+ // Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
331
+ return ArrayJoin.call(ArrayMap.call(obj, toString), ',');
728
332
  }
333
+ return obj.toString();
729
334
  }
730
- else if (mode === 'async') {
731
- await generateMarkup(emit, tagName, props, null, null);
732
- }
733
- else if (mode === 'sync') {
734
- generateMarkup(emit, tagName, props, null, null);
335
+ else if (typeof obj === 'object') {
336
+ // This catches null and returns "[object Null]". Weird, but kept for backwards compatibility.
337
+ return OtS.call(obj);
735
338
  }
736
339
  else {
737
- throw new Error(`Invalid mode: ${mode}`);
340
+ return String(obj);
738
341
  }
739
- return markup;
342
+ }
343
+
344
+ /*
345
+ * Copyright (c) 2018, salesforce.com, inc.
346
+ * All rights reserved.
347
+ * SPDX-License-Identifier: MIT
348
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
349
+ */
350
+ /**
351
+ * According to the following list, there are 48 aria attributes of which two (ariaDropEffect and
352
+ * ariaGrabbed) are deprecated:
353
+ * https://www.w3.org/TR/wai-aria-1.1/#x6-6-definitions-of-states-and-properties-all-aria-attributes
354
+ *
355
+ * The above list of 46 aria attributes is consistent with the following resources:
356
+ * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
357
+ * https://wicg.github.io/aom/spec/aria-reflection.html
358
+ *
359
+ * NOTE: If you update this list, please update test files that implicitly reference this list!
360
+ * Searching the codebase for `aria-flowto` and `ariaFlowTo` should be good enough to find all usages.
361
+ */
362
+ const AriaPropertyNames = [
363
+ 'ariaActiveDescendant',
364
+ 'ariaAtomic',
365
+ 'ariaAutoComplete',
366
+ 'ariaBusy',
367
+ 'ariaChecked',
368
+ 'ariaColCount',
369
+ 'ariaColIndex',
370
+ 'ariaColIndexText',
371
+ 'ariaColSpan',
372
+ 'ariaControls',
373
+ 'ariaCurrent',
374
+ 'ariaDescribedBy',
375
+ 'ariaDescription',
376
+ 'ariaDetails',
377
+ 'ariaDisabled',
378
+ 'ariaErrorMessage',
379
+ 'ariaExpanded',
380
+ 'ariaFlowTo',
381
+ 'ariaHasPopup',
382
+ 'ariaHidden',
383
+ 'ariaInvalid',
384
+ 'ariaKeyShortcuts',
385
+ 'ariaLabel',
386
+ 'ariaLabelledBy',
387
+ 'ariaLevel',
388
+ 'ariaLive',
389
+ 'ariaModal',
390
+ 'ariaMultiLine',
391
+ 'ariaMultiSelectable',
392
+ 'ariaOrientation',
393
+ 'ariaOwns',
394
+ 'ariaPlaceholder',
395
+ 'ariaPosInSet',
396
+ 'ariaPressed',
397
+ 'ariaReadOnly',
398
+ 'ariaRelevant',
399
+ 'ariaRequired',
400
+ 'ariaRoleDescription',
401
+ 'ariaRowCount',
402
+ 'ariaRowIndex',
403
+ 'ariaRowIndexText',
404
+ 'ariaRowSpan',
405
+ 'ariaSelected',
406
+ 'ariaSetSize',
407
+ 'ariaSort',
408
+ 'ariaValueMax',
409
+ 'ariaValueMin',
410
+ 'ariaValueNow',
411
+ 'ariaValueText',
412
+ 'ariaBrailleLabel',
413
+ 'ariaBrailleRoleDescription',
414
+ 'role',
415
+ ];
416
+ const { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap } = /*@__PURE__*/ (() => {
417
+ const AriaAttrNameToPropNameMap = create(null);
418
+ const AriaPropNameToAttrNameMap = create(null);
419
+ // Synthetic creation of all AOM property descriptors for Custom Elements
420
+ forEach.call(AriaPropertyNames, (propName) => {
421
+ const attrName = StringToLowerCase.call(StringReplace.call(propName, /^aria/, () => 'aria-'));
422
+ AriaAttrNameToPropNameMap[attrName] = propName;
423
+ AriaPropNameToAttrNameMap[propName] = attrName;
424
+ });
425
+ return { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap };
426
+ })();
427
+
428
+ /*
429
+ * Copyright (c) 2020, salesforce.com, inc.
430
+ * All rights reserved.
431
+ * SPDX-License-Identifier: MIT
432
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
433
+ */
434
+ const ESCAPED_CHARS = {
435
+ '"': '&quot;',
436
+ "'": '&#x27;',
437
+ '<': '&lt;',
438
+ '>': '&gt;',
439
+ '&': '&amp;',
440
+ };
441
+ /**
442
+ *
443
+ * @param str
444
+ * @param attrMode
445
+ */
446
+ function htmlEscape(str, attrMode = false) {
447
+ const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
448
+ return str.replace(searchValue, (char) => ESCAPED_CHARS[char]);
740
449
  }
741
450
 
742
451
  /*
@@ -745,220 +454,467 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
745
454
  * SPDX-License-Identifier: MIT
746
455
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
747
456
  */
748
- // Stubs for all the un-implemented exports from @lwc/engine-server
749
- function api(..._) {
750
- throw new Error('@api cannot be used in SSR context.');
751
- }
752
- function createContextProvider(..._) {
753
- throw new Error('createContextProvider cannot be used in SSR context.');
754
- }
755
- function createElement(..._) {
756
- throw new Error('createElement cannot be used in SSR context.');
757
- }
758
- function freezeTemplate(..._) {
759
- throw new Error('freezeTemplate cannot be used in SSR context.');
760
- }
761
- function getComponentDef(..._) {
762
- throw new Error('getComponentDef cannot be used in SSR context.');
763
- }
764
- function isComponentConstructor(..._) {
765
- throw new Error('isComponentConstructor cannot be used in SSR context.');
766
- }
767
- function parseFragment(..._) {
768
- throw new Error('parseFragment cannot be used in SSR context.');
769
- }
770
- function parseSVGFragment(..._) {
771
- throw new Error('parseSVGFragment cannot be used in SSR context.');
772
- }
773
- function readonly(..._) {
774
- throw new Error('readonly cannot be used in SSR context.');
775
- }
776
- function registerComponent(..._) {
777
- throw new Error('registerComponent cannot be used in SSR context.');
778
- }
779
- function registerDecorators(..._) {
780
- throw new Error('registerDecorators cannot be used in SSR context.');
781
- }
782
- function registerTemplate(..._) {
783
- throw new Error('registerTemplate cannot be used in SSR context.');
784
- }
785
- function sanitizeAttribute(..._) {
786
- throw new Error('sanitizeAttribute cannot be used in SSR context.');
787
- }
788
- function setFeatureFlag(..._) {
789
- throw new Error('setFeatureFlag cannot be used in SSR context.');
790
- }
791
- function setFeatureFlagForTest(..._) {
792
- throw new Error('setFeatureFlagForTest cannot be used in SSR context.');
793
- }
794
- function setHooks(..._) {
795
- throw new Error('setHooks cannot be used in SSR context.');
796
- }
797
- function swapComponent(..._) {
798
- throw new Error('swapComponent cannot be used in SSR context.');
799
- }
800
- function swapStyle(..._) {
801
- throw new Error('swapStyle cannot be used in SSR context.');
802
- }
803
- function swapTemplate(..._) {
804
- throw new Error('swapTemplate cannot be used in SSR context.');
805
- }
806
- function track(..._) {
807
- throw new Error('@track cannot be used in SSR context.');
808
- }
809
- function unwrap(..._) {
810
- throw new Error('unwrap cannot be used in SSR context.');
457
+ let hooksAreSet = false;
458
+ /**
459
+ * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
460
+ * libraries to sanitize HTML content. This hook process the content passed via the template to
461
+ * lwc:inner-html directive.
462
+ * It is meant to be overridden via `setHooks`; it throws an error by default.
463
+ */
464
+ let sanitizeHtmlContent = () => {
465
+ // locker-service patches this function during runtime to sanitize HTML content.
466
+ throw new Error('sanitizeHtmlContent hook must be implemented.');
467
+ };
468
+ function setHooks(hooks) {
469
+ isFalse$1(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
470
+ hooksAreSet = true;
471
+ sanitizeHtmlContent = hooks.sanitizeHtmlContent;
811
472
  }
812
- function wire(..._) {
813
- throw new Error('@wire cannot be used in SSR context.');
473
+ function flattenStylesheets(stylesheets) {
474
+ const list = [];
475
+ for (const stylesheet of stylesheets) {
476
+ if (!isArray(stylesheet)) {
477
+ list.push(stylesheet);
478
+ }
479
+ else {
480
+ list.push(...flattenStylesheets(stylesheet));
481
+ }
482
+ }
483
+ return list;
814
484
  }
815
- const renderer = {
816
- isSyntheticShadowDefined: false,
817
- insert(..._) {
818
- throw new Error('renderer.insert cannot be used in SSR context.');
819
- },
820
- remove(..._) {
821
- throw new Error('renderer.remove cannot be used in SSR context.');
822
- },
823
- cloneNode(..._) {
824
- throw new Error('renderer.cloneNode cannot be used in SSR context.');
825
- },
826
- createFragment(..._) {
827
- throw new Error('renderer.createFragment cannot be used in SSR context.');
828
- },
829
- createElement(..._) {
830
- throw new Error('renderer.createElement cannot be used in SSR context.');
831
- },
832
- createText(..._) {
833
- throw new Error('renderer.createText cannot be used in SSR context.');
834
- },
835
- createComment(..._) {
836
- throw new Error('renderer.createComment cannot be used in SSR context.');
837
- },
838
- createCustomElement(..._) {
839
- throw new Error('renderer.createCustomElement cannot be used in SSR context.');
840
- },
841
- nextSibling(..._) {
842
- throw new Error('renderer.nextSibling cannot be used in SSR context.');
843
- },
844
- previousSibling(..._) {
845
- throw new Error('renderer.previousSibling cannot be used in SSR context.');
846
- },
847
- attachShadow(..._) {
848
- throw new Error('renderer.attachShadow cannot be used in SSR context.');
849
- },
850
- getProperty(..._) {
851
- throw new Error('renderer.getProperty cannot be used in SSR context.');
852
- },
853
- setProperty(..._) {
854
- throw new Error('renderer.setProperty cannot be used in SSR context.');
855
- },
856
- setText(..._) {
857
- throw new Error('renderer.setText cannot be used in SSR context.');
858
- },
859
- getAttribute(..._) {
860
- throw new Error('renderer.getAttribute cannot be used in SSR context.');
861
- },
862
- setAttribute(..._) {
863
- throw new Error('renderer.setAttribute cannot be used in SSR context.');
864
- },
865
- removeAttribute(..._) {
866
- throw new Error('renderer.removeAttribute cannot be used in SSR context.');
867
- },
868
- addEventListener(..._) {
869
- throw new Error('renderer.addEventListener cannot be used in SSR context.');
870
- },
871
- removeEventListener(..._) {
872
- throw new Error('renderer.removeEventListener cannot be used in SSR context.');
873
- },
874
- dispatchEvent(..._) {
875
- throw new Error('renderer.dispatchEvent cannot be used in SSR context.');
876
- },
877
- getClassList(..._) {
878
- throw new Error('renderer.getClassList cannot be used in SSR context.');
879
- },
880
- setCSSStyleProperty(..._) {
881
- throw new Error('renderer.setCSSStyleProperty cannot be used in SSR context.');
882
- },
883
- getBoundingClientRect(..._) {
884
- throw new Error('renderer.getBoundingClientRect cannot be used in SSR context.');
885
- },
886
- querySelector(..._) {
887
- throw new Error('renderer.querySelector cannot be used in SSR context.');
888
- },
889
- querySelectorAll(..._) {
890
- throw new Error('renderer.querySelectorAll cannot be used in SSR context.');
891
- },
892
- getElementsByTagName(..._) {
893
- throw new Error('renderer.getElementsByTagName cannot be used in SSR context.');
894
- },
895
- getElementsByClassName(..._) {
896
- throw new Error('renderer.getElementsByClassName cannot be used in SSR context.');
897
- },
898
- getChildren(..._) {
899
- throw new Error('renderer.getChildren cannot be used in SSR context.');
900
- },
901
- getChildNodes(..._) {
902
- throw new Error('renderer.getChildNodes cannot be used in SSR context.');
903
- },
904
- getFirstChild(..._) {
905
- throw new Error('renderer.getFirstChild cannot be used in SSR context.');
906
- },
907
- getFirstElementChild(..._) {
908
- throw new Error('renderer.getFirstElementChild cannot be used in SSR context.');
909
- },
910
- getLastChild(..._) {
911
- throw new Error('renderer.getLastChild cannot be used in SSR context.');
912
- },
913
- getLastElementChild(..._) {
914
- throw new Error('renderer.getLastElementChild cannot be used in SSR context.');
915
- },
916
- getTagName(..._) {
917
- throw new Error('renderer.getTagName cannot be used in SSR context.');
918
- },
919
- getStyle(..._) {
920
- throw new Error('renderer.getStyle cannot be used in SSR context.');
921
- },
922
- isConnected(..._) {
923
- throw new Error('renderer.isConnected cannot be used in SSR context.');
924
- },
925
- insertStylesheet(..._) {
926
- throw new Error('renderer.insertStylesheet cannot be used in SSR context.');
485
+ /** version: 8.6.0 */
486
+
487
+ /*
488
+ * Copyright (c) 2024, Salesforce, Inc.
489
+ * All rights reserved.
490
+ * SPDX-License-Identifier: MIT
491
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
492
+ */
493
+ const MULTI_SPACE = /\s+/g;
494
+ class ClassList {
495
+ constructor(el) {
496
+ this.el = el;
497
+ }
498
+ add(...newClassNames) {
499
+ const className = this.el.className;
500
+ const set = new Set(className.split(MULTI_SPACE).filter(Boolean));
501
+ for (const newClassName of newClassNames) {
502
+ set.add(newClassName);
503
+ }
504
+ this.el.className = Array.from(set).join(' ');
505
+ }
506
+ contains(className) {
507
+ const currentClassNameStr = this.el.className;
508
+ return currentClassNameStr.split(MULTI_SPACE).includes(className);
509
+ }
510
+ remove(...classNamesToRemove) {
511
+ const className = this.el.className;
512
+ const set = new Set(className.split(MULTI_SPACE).filter(Boolean));
513
+ for (const newClassName of classNamesToRemove) {
514
+ set.delete(newClassName);
515
+ }
516
+ this.el.className = Array.from(set).join(' ');
517
+ }
518
+ replace(oldClassName, newClassName) {
519
+ let classWasReplaced = false;
520
+ const className = this.el.className;
521
+ const listOfClasses = className.split(MULTI_SPACE).filter(Boolean);
522
+ listOfClasses.forEach((value, idx) => {
523
+ if (value === oldClassName) {
524
+ classWasReplaced = true;
525
+ listOfClasses[idx] = newClassName;
526
+ }
527
+ });
528
+ this.el.className = listOfClasses.join(' ');
529
+ return classWasReplaced;
530
+ }
531
+ toggle(classNameToToggle, force) {
532
+ const classNameStr = this.el.className;
533
+ const set = new Set(classNameStr.split(MULTI_SPACE).filter(Boolean));
534
+ if (!set.has(classNameToToggle) && force !== false) {
535
+ set.add(classNameToToggle);
536
+ }
537
+ else if (set.has(classNameToToggle) && force !== true) {
538
+ set.delete(classNameToToggle);
539
+ }
540
+ this.el.className = Array.from(set).join(' ');
541
+ return set.has(classNameToToggle);
542
+ }
543
+ get value() {
544
+ return this.el.className;
545
+ }
546
+ toString() {
547
+ return this.el.className;
548
+ }
549
+ item(_index) {
550
+ throw new Error('Method "item" not implemented.');
551
+ }
552
+ supports(_token) {
553
+ throw new Error('Method "supports" not implemented.');
554
+ }
555
+ forEach(_callbackfn, _thisArg) {
556
+ throw new Error('Method "forEach" not implemented.');
557
+ }
558
+ get length() {
559
+ throw new Error('Property "length" not implemented.');
560
+ }
561
+ }
562
+
563
+ /******************************************************************************
564
+ Copyright (c) Microsoft Corporation.
565
+
566
+ Permission to use, copy, modify, and/or distribute this software for any
567
+ purpose with or without fee is hereby granted.
568
+
569
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
570
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
571
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
572
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
573
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
574
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
575
+ PERFORMANCE OF THIS SOFTWARE.
576
+ ***************************************************************************** */
577
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
578
+
579
+
580
+ function __classPrivateFieldGet(receiver, state, kind, f) {
581
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
582
+ 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");
583
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
584
+ }
585
+
586
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
587
+ if (kind === "m") throw new TypeError("Private method is not writable");
588
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
589
+ 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");
590
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
591
+ }
592
+
593
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
594
+ var e = new Error(message);
595
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
596
+ };
597
+
598
+ /*
599
+ * Copyright (c) 2024, Salesforce, Inc.
600
+ * All rights reserved.
601
+ * SPDX-License-Identifier: MIT
602
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
603
+ */
604
+ var _MutationTracker_enabledSet, _MutationTracker_mutationMap;
605
+ class MutationTracker {
606
+ constructor() {
607
+ _MutationTracker_enabledSet.set(this, new WeakSet());
608
+ _MutationTracker_mutationMap.set(this, new WeakMap());
609
+ }
610
+ add(instance, attrName) {
611
+ if (__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").has(instance)) {
612
+ let mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
613
+ if (!mutatedAttrs) {
614
+ mutatedAttrs = new Set();
615
+ __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").set(instance, mutatedAttrs);
616
+ }
617
+ mutatedAttrs.add(attrName.toLowerCase());
618
+ }
619
+ }
620
+ enable(instance) {
621
+ __classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").add(instance);
622
+ }
623
+ disable(instance) {
624
+ __classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").delete(instance);
625
+ }
626
+ renderMutatedAttrs(instance) {
627
+ const mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
628
+ if (mutatedAttrs) {
629
+ return ` data-lwc-host-mutated="${[...mutatedAttrs].sort().join(' ')}"`;
630
+ }
631
+ else {
632
+ return '';
633
+ }
634
+ }
635
+ }
636
+ _MutationTracker_enabledSet = new WeakMap(), _MutationTracker_mutationMap = new WeakMap();
637
+ const mutationTracker = new MutationTracker();
638
+
639
+ /*
640
+ * Copyright (c) 2024, Salesforce, Inc.
641
+ * All rights reserved.
642
+ * SPDX-License-Identifier: MIT
643
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
644
+ */
645
+ /**
646
+ * Map of global attribute or ARIA attribute to the corresponding property name.
647
+ * Not all global attributes are included, just those from `HTMLElementTheGoodParts`.
648
+ */
649
+ const attrsToProps = assign(create(null), {
650
+ accesskey: 'accessKey',
651
+ dir: 'dir',
652
+ draggable: 'draggable',
653
+ hidden: 'hidden',
654
+ id: 'id',
655
+ lang: 'lang',
656
+ spellcheck: 'spellcheck',
657
+ tabindex: 'tabIndex',
658
+ title: 'title',
659
+ ...AriaAttrNameToPropNameMap,
660
+ });
661
+ /**
662
+ * Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
663
+ */
664
+ const stringDescriptor = (attrName) => ({
665
+ configurable: true,
666
+ enumerable: true,
667
+ get() {
668
+ return this.getAttribute(attrName);
927
669
  },
928
- assertInstanceOfHTMLElement(..._) {
929
- throw new Error('renderer.assertInstanceOfHTMLElement cannot be used in SSR context.');
670
+ set(newValue) {
671
+ const currentValue = this.getAttribute(attrName);
672
+ const normalizedValue = String(newValue);
673
+ if (normalizedValue !== currentValue) {
674
+ this.setAttribute(attrName, normalizedValue);
675
+ }
930
676
  },
931
- ownerDocument(..._) {
932
- throw new Error('renderer.ownerDocument cannot be used in SSR context.');
677
+ });
678
+ /** Descriptor for a boolean that checks for `attr="true"` or `attr="false"`, e.g. `spellcheck` and `draggable`. */
679
+ const explicitBooleanDescriptor = (attrName, defaultValue) => ({
680
+ configurable: true,
681
+ enumerable: true,
682
+ get() {
683
+ const value = this.getAttribute(attrName);
684
+ return value === null ? defaultValue : value === String(defaultValue);
933
685
  },
934
- registerContextConsumer(..._) {
935
- throw new Error('renderer.registerContextConsumer cannot be used in SSR context.');
686
+ set(newValue) {
687
+ const currentValue = this.getAttribute(attrName);
688
+ const normalizedValue = String(Boolean(newValue));
689
+ if (normalizedValue !== currentValue) {
690
+ this.setAttribute(attrName, normalizedValue);
691
+ }
936
692
  },
937
- attachInternals(..._) {
938
- throw new Error('renderer.attachInternals cannot be used in SSR context.');
693
+ });
694
+ /**
695
+ * Descriptor for a "true" boolean attribute that checks solely for presence, e.g. `hidden`.
696
+ */
697
+ const booleanAttributeDescriptor = (attrName) => ({
698
+ configurable: true,
699
+ enumerable: true,
700
+ get() {
701
+ return this.hasAttribute(attrName);
939
702
  },
940
- defineCustomElement(..._) {
941
- throw new Error('renderer.defineCustomElement cannot be used in SSR context.');
703
+ set(newValue) {
704
+ const hasAttribute = this.hasAttribute(attrName);
705
+ if (newValue) {
706
+ if (!hasAttribute) {
707
+ this.setAttribute(attrName, '');
708
+ }
709
+ }
710
+ else {
711
+ if (hasAttribute) {
712
+ this.removeAttribute(attrName);
713
+ }
714
+ }
942
715
  },
943
- getParentNode(..._) {
944
- throw new Error('renderer.getParentNode cannot be used in SSR context.');
716
+ });
717
+ /**
718
+ * Descriptor for ARIA reflections, e.g. `ariaLabel` and `role`.
719
+ */
720
+ const ariaDescriptor = (attrName) => ({
721
+ configurable: true,
722
+ enumerable: true,
723
+ get() {
724
+ return this.getAttribute(attrName);
945
725
  },
946
- startTrackingMutations(..._) {
947
- throw new Error('renderer.startTrackingMutations cannot be used in SSR context.');
726
+ set(newValue) {
727
+ const currentValue = this.getAttribute(attrName);
728
+ if (newValue !== currentValue) {
729
+ // TODO [#3284]: According to the spec, IDL nullable type values
730
+ // (null and undefined) should remove the attribute; however, we
731
+ // only do so in the case of null for historical reasons.
732
+ if (isNull(newValue)) {
733
+ this.removeAttribute(attrName);
734
+ }
735
+ else {
736
+ this.setAttribute(attrName, toString(newValue));
737
+ }
738
+ }
948
739
  },
949
- stopTrackingMutations(..._) {
950
- throw new Error('renderer.stopTrackingMutations cannot be used in SSR context.');
740
+ });
741
+ function reflectAttrToProp(instance, attrName, attrValue) {
742
+ const reflectedPropName = attrsToProps[attrName];
743
+ // If it is a reflected property and it was not overridden by the instance
744
+ if (reflectedPropName && !hasOwnProperty.call(instance, reflectedPropName)) {
745
+ const currentValue = instance[reflectedPropName];
746
+ if (currentValue !== attrValue) {
747
+ instance[reflectedPropName] = attrValue;
748
+ }
749
+ }
750
+ }
751
+ const descriptors = {
752
+ accessKey: stringDescriptor('accesskey'),
753
+ dir: stringDescriptor('dir'),
754
+ draggable: explicitBooleanDescriptor('draggable', true),
755
+ hidden: booleanAttributeDescriptor('hidden'),
756
+ id: stringDescriptor('id'),
757
+ lang: stringDescriptor('lang'),
758
+ spellcheck: explicitBooleanDescriptor('spellcheck', false),
759
+ tabIndex: {
760
+ get() {
761
+ const str = this.getAttribute('tabindex');
762
+ const num = Number(str);
763
+ return isFinite(num) ? Math.trunc(num) : -1;
764
+ },
765
+ set(newValue) {
766
+ const currentValue = this.getAttribute('tabindex');
767
+ const num = Number(newValue);
768
+ const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
769
+ if (normalizedValue !== currentValue) {
770
+ this.setAttribute('tabindex', toString(newValue));
771
+ }
772
+ },
951
773
  },
774
+ title: stringDescriptor('title'),
952
775
  };
953
- /**
954
- * The hot API is used to orchestrate hot swapping in client rendered components.
955
- * It doesn't do anything on the server side, however, you may import it.
956
- *
957
- * The whole point of defining this and exporting it is so that you can import it in isomorphic code without
958
- * an error being thrown by the import itself.
776
+ // Add descriptors for ARIA attributes
777
+ for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
778
+ descriptors[propName] = ariaDescriptor(attrName);
779
+ }
780
+
781
+ /*
782
+ * Copyright (c) 2024, salesforce.com, inc.
783
+ * All rights reserved.
784
+ * SPDX-License-Identifier: MIT
785
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
959
786
  */
960
- // A real stub, not a "not implemented" one! 😯
961
- const hot = undefined;
787
+ var _LightningElement_attrs, _LightningElement_classList;
788
+ const SYMBOL__SET_INTERNALS = Symbol('set-internals');
789
+ const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
790
+ class LightningElement {
791
+ constructor(propsAvailableAtConstruction) {
792
+ this.isConnected = false;
793
+ this.className = '';
794
+ _LightningElement_attrs.set(this, void 0);
795
+ _LightningElement_classList.set(this, null);
796
+ assign(this, propsAvailableAtConstruction);
797
+ }
798
+ [(_LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
799
+ __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
800
+ assign(this, props);
801
+ defineProperty(this, 'className', {
802
+ get() {
803
+ return props.class ?? '';
804
+ },
805
+ set(newVal) {
806
+ props.class = newVal;
807
+ attrs.class = newVal;
808
+ mutationTracker.add(this, 'class');
809
+ },
810
+ });
811
+ }
812
+ get classList() {
813
+ if (__classPrivateFieldGet(this, _LightningElement_classList, "f")) {
814
+ return __classPrivateFieldGet(this, _LightningElement_classList, "f");
815
+ }
816
+ return (__classPrivateFieldSet(this, _LightningElement_classList, new ClassList(this), "f"));
817
+ }
818
+ setAttribute(attrName, attrValue) {
819
+ const normalizedName = StringToLowerCase.call(toString(attrName));
820
+ const normalizedValue = String(attrValue);
821
+ __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName] = normalizedValue;
822
+ reflectAttrToProp(this, normalizedName, normalizedValue);
823
+ mutationTracker.add(this, normalizedName);
824
+ }
825
+ getAttribute(attrName) {
826
+ const normalizedName = StringToLowerCase.call(toString(attrName));
827
+ if (hasOwnProperty.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName)) {
828
+ return __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
829
+ }
830
+ return null;
831
+ }
832
+ hasAttribute(attrName) {
833
+ const normalizedName = StringToLowerCase.call(toString(attrName));
834
+ return hasOwnProperty.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName);
835
+ }
836
+ removeAttribute(attrName) {
837
+ const normalizedName = StringToLowerCase.call(toString(attrName));
838
+ delete __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
839
+ reflectAttrToProp(this, normalizedName, null);
840
+ // Track mutations for removal of non-existing attributes
841
+ mutationTracker.add(this, normalizedName);
842
+ }
843
+ addEventListener(_type, _listener, _options) {
844
+ // noop
845
+ }
846
+ removeEventListener(_type, _listener, _options) {
847
+ // noop
848
+ }
849
+ // ----------------------------------------------------------- //
850
+ // Props/methods explicitly not available in this environment //
851
+ // Getters are named "get*" for parity with @lwc/engine-server //
852
+ // ----------------------------------------------------------- //
853
+ get children() {
854
+ throw new TypeError('"getChildren" is not supported in this environment');
855
+ }
856
+ get childNodes() {
857
+ throw new TypeError('"getChildNodes" is not supported in this environment');
858
+ }
859
+ get firstChild() {
860
+ throw new TypeError('"getFirstChild" is not supported in this environment');
861
+ }
862
+ get firstElementChild() {
863
+ throw new TypeError('"getFirstElementChild" is not supported in this environment');
864
+ }
865
+ get hostElement() {
866
+ // Intentionally different to match @lwc/engine-*core*
867
+ throw new TypeError('this.hostElement is not supported in this environment');
868
+ }
869
+ get lastChild() {
870
+ throw new TypeError('"getLastChild" is not supported in this environment');
871
+ }
872
+ get lastElementChild() {
873
+ throw new TypeError('"getLastElementChild" is not supported in this environment');
874
+ }
875
+ get ownerDocument() {
876
+ // Intentionally not "get*" to match @lwc/engine-server
877
+ throw new TypeError('"ownerDocument" is not supported in this environment');
878
+ }
879
+ get style() {
880
+ // Intentionally not "get*" to match @lwc/engine-server
881
+ throw new TypeError('"style" is not supported in this environment');
882
+ }
883
+ attachInternals() {
884
+ throw new TypeError('"attachInternals" is not supported in this environment');
885
+ }
886
+ dispatchEvent(_event) {
887
+ throw new TypeError('"dispatchEvent" is not supported in this environment');
888
+ }
889
+ getBoundingClientRect() {
890
+ throw new TypeError('"getBoundingClientRect" is not supported in this environment');
891
+ }
892
+ getElementsByClassName(_classNames) {
893
+ throw new TypeError('"getElementsByClassName" is not supported in this environment');
894
+ }
895
+ getElementsByTagName(_qualifiedName) {
896
+ throw new TypeError('"getElementsByTagName" is not supported in this environment');
897
+ }
898
+ querySelector(_selectors) {
899
+ throw new TypeError('"querySelector" is not supported in this environment');
900
+ }
901
+ querySelectorAll(_selectors) {
902
+ throw new TypeError('"querySelectorAll" is not supported in this environment');
903
+ }
904
+ getAttributeNS(_namespace, _localName) {
905
+ throw new Error('Method "getAttributeNS" not implemented.');
906
+ }
907
+ hasAttributeNS(_namespace, _localName) {
908
+ throw new Error('Method "hasAttributeNS" not implemented.');
909
+ }
910
+ removeAttributeNS(_namespace, _localName) {
911
+ throw new Error('Method "removeAttributeNS" not implemented.');
912
+ }
913
+ setAttributeNS(_namespace, _qualifiedName, _value) {
914
+ throw new Error('Method "setAttributeNS" not implemented.');
915
+ }
916
+ }
917
+ defineProperties(LightningElement.prototype, descriptors);
962
918
 
963
919
  /*
964
920
  * Copyright (c) 2024, salesforce.com, inc.
@@ -966,35 +922,72 @@ const hot = undefined;
966
922
  * SPDX-License-Identifier: MIT
967
923
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
968
924
  */
969
- /**
970
- * Converts an iterable into one that emits the object used by the [`iterator` directive](
971
- * https://lwc.dev/guide/html_templates#iterator).
972
- */
973
- function* toIteratorDirective(iterable) {
974
- if (iterable === undefined || iterable === null)
925
+ const escapeAttrVal = (attrVal) => attrVal.replaceAll('&', '&amp;').replaceAll('"', '&quot;');
926
+ function* renderAttrs(instance, attrs) {
927
+ if (!attrs) {
975
928
  return;
976
- if (!iterable[Symbol.iterator]) {
977
- throw new Error(
978
- // Mimic error message from "[i]terable node" in engine-core's api.ts
979
- `Invalid template iteration for value \`${iterable}\`. It must be an array-like object.`);
980
929
  }
981
- const iterator = iterable[Symbol.iterator]();
982
- let next = iterator.next();
983
- let index = 0;
984
- let { value, done: last = false } = next;
985
- while (last === false) {
986
- // using a look-back approach because we need to know if the element is the last
987
- next = iterator.next();
988
- last = next.done ?? false;
989
- yield {
990
- value,
991
- index,
992
- first: index === 0,
993
- last,
994
- };
995
- index += 1;
996
- value = next.value;
930
+ for (const attrName of Object.getOwnPropertyNames(attrs)) {
931
+ const attrVal = attrs[attrName];
932
+ if (typeof attrVal === 'string') {
933
+ yield attrVal === '' ? ` ${attrName}` : ` ${attrName}="${escapeAttrVal(attrVal)}"`;
934
+ }
935
+ else if (attrVal === null) {
936
+ yield '';
937
+ }
938
+ }
939
+ yield mutationTracker.renderMutatedAttrs(instance);
940
+ }
941
+ function renderAttrsNoYield(emit, instance, attrs) {
942
+ if (!attrs) {
943
+ return;
944
+ }
945
+ for (const attrName of Object.getOwnPropertyNames(attrs)) {
946
+ const attrVal = attrs[attrName];
947
+ if (typeof attrVal === 'string') {
948
+ emit(attrVal === '' ? ` ${attrName}` : ` ${attrName}="${escapeAttrVal(attrVal)}"`);
949
+ }
950
+ else if (attrVal === null) {
951
+ emit('');
952
+ }
953
+ }
954
+ emit(mutationTracker.renderMutatedAttrs(instance));
955
+ }
956
+ function* fallbackTmpl(_props, _attrs, _slotted, Cmp, _instance) {
957
+ if (Cmp.renderMode !== 'light') {
958
+ yield '<template shadowrootmode="open"></template>';
959
+ }
960
+ }
961
+ function fallbackTmplNoYield(emit, _props, _attrs, _slotted, Cmp, _instance) {
962
+ if (Cmp.renderMode !== 'light') {
963
+ emit('<template shadowrootmode="open"></template>');
964
+ }
965
+ }
966
+ async function serverSideRenderComponent(tagName, Component, props = {}, mode = 'asyncYield') {
967
+ if (typeof tagName !== 'string') {
968
+ throw new Error(`tagName must be a string, found: ${tagName}`);
969
+ }
970
+ // TODO [#4726]: remove `generateMarkup` export
971
+ const generateMarkup = SYMBOL__GENERATE_MARKUP in Component ? Component[SYMBOL__GENERATE_MARKUP] : Component;
972
+ let markup = '';
973
+ const emit = (segment) => {
974
+ markup += segment;
975
+ };
976
+ if (mode === 'asyncYield') {
977
+ for await (const segment of generateMarkup(tagName, props, null, null)) {
978
+ markup += segment;
979
+ }
980
+ }
981
+ else if (mode === 'async') {
982
+ await generateMarkup(emit, tagName, props, null, null);
983
+ }
984
+ else if (mode === 'sync') {
985
+ generateMarkup(emit, tagName, props, null, null);
986
+ }
987
+ else {
988
+ throw new Error(`Invalid mode: ${mode}`);
997
989
  }
990
+ return markup;
998
991
  }
999
992
 
1000
993
  /*
@@ -1075,6 +1068,43 @@ function renderStylesheets(stylesheets, scopeToken, Component, hasScopedTemplate
1075
1068
  return result;
1076
1069
  }
1077
1070
 
1078
- export { ClassList, LightningElement, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, createContextProvider, createElement, fallbackTmpl, fallbackTmplNoYield, freezeTemplate, getComponentDef, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, mutationTracker, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, renderAttrs, renderAttrsNoYield, serverSideRenderComponent as renderComponent, renderStylesheets, renderer, sanitizeAttribute, serverSideRenderComponent, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap, validateStyleTextContents, wire };
1079
- /** version: 8.5.0 */
1071
+ /*
1072
+ * Copyright (c) 2024, salesforce.com, inc.
1073
+ * All rights reserved.
1074
+ * SPDX-License-Identifier: MIT
1075
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1076
+ */
1077
+ /**
1078
+ * Converts an iterable into one that emits the object used by the [`iterator` directive](
1079
+ * https://lwc.dev/guide/html_templates#iterator).
1080
+ */
1081
+ function* toIteratorDirective(iterable) {
1082
+ if (iterable === undefined || iterable === null)
1083
+ return;
1084
+ if (!iterable[Symbol.iterator]) {
1085
+ throw new Error(
1086
+ // Mimic error message from "[i]terable node" in engine-core's api.ts
1087
+ `Invalid template iteration for value \`${iterable}\`. It must be an array-like object.`);
1088
+ }
1089
+ const iterator = iterable[Symbol.iterator]();
1090
+ let next = iterator.next();
1091
+ let index = 0;
1092
+ let { value, done: last = false } = next;
1093
+ while (last === false) {
1094
+ // using a look-back approach because we need to know if the element is the last
1095
+ next = iterator.next();
1096
+ last = next.done ?? false;
1097
+ yield {
1098
+ value,
1099
+ index,
1100
+ first: index === 0,
1101
+ last,
1102
+ };
1103
+ index += 1;
1104
+ value = next.value;
1105
+ }
1106
+ }
1107
+
1108
+ export { ClassList, LightningElement, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, createContextProvider, createElement, fallbackTmpl, fallbackTmplNoYield, freezeTemplate, getComponentDef, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, mutationTracker, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, renderAttrs, renderAttrsNoYield, serverSideRenderComponent as renderComponent, renderStylesheets, renderer, sanitizeAttribute, sanitizeHtmlContent, serverSideRenderComponent, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap, validateStyleTextContents, wire };
1109
+ /** version: 8.6.0 */
1080
1110
  //# sourceMappingURL=index.js.map