@lwc/ssr-runtime 8.3.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 +323 -44
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +321 -45
- package/dist/index.js.map +1 -1
- package/dist/lightning-element.d.ts +6 -5
- package/dist/reflection.d.ts +3 -0
- package/dist/render.d.ts +10 -4
- package/dist/types.d.ts +2 -1
- package/package.json +3 -3
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.
|
@@ -118,6 +116,224 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
118
116
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
119
117
|
};
|
120
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
|
+
'<': '<',
|
323
|
+
'>': '>',
|
324
|
+
'&': '&',
|
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
|
+
|
121
337
|
/*
|
122
338
|
* Copyright (c) 2024, Salesforce, Inc.
|
123
339
|
* All rights reserved.
|
@@ -159,41 +375,70 @@ class MutationTracker {
|
|
159
375
|
_MutationTracker_enabledSet = new WeakMap(), _MutationTracker_mutationMap = new WeakMap();
|
160
376
|
const mutationTracker = new MutationTracker();
|
161
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
|
+
|
162
422
|
/*
|
163
423
|
* Copyright (c) 2024, salesforce.com, inc.
|
164
424
|
* All rights reserved.
|
165
425
|
* SPDX-License-Identifier: MIT
|
166
426
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
167
427
|
*/
|
168
|
-
var
|
428
|
+
var _LightningElement_attrs, _LightningElement_classList;
|
169
429
|
const SYMBOL__SET_INTERNALS = Symbol('set-internals');
|
170
430
|
class LightningElement {
|
171
431
|
constructor(propsAvailableAtConstruction) {
|
172
|
-
_LightningElement_instances.add(this);
|
173
432
|
this.isConnected = false;
|
174
433
|
this.className = '';
|
175
434
|
_LightningElement_attrs.set(this, void 0);
|
176
435
|
_LightningElement_classList.set(this, null);
|
177
|
-
|
436
|
+
assign(this, propsAvailableAtConstruction);
|
178
437
|
}
|
179
|
-
[(_LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(),
|
180
|
-
Object.assign(this, props);
|
438
|
+
[(_LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
|
181
439
|
__classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
|
182
|
-
|
183
|
-
|
184
|
-
for (const reflectedPropName of reflectedProps) {
|
185
|
-
Object.defineProperty(this, reflectedPropName, {
|
186
|
-
get() {
|
187
|
-
return props[reflectedPropName] ?? null;
|
188
|
-
},
|
189
|
-
set(newValue) {
|
190
|
-
props[reflectedPropName] = newValue;
|
191
|
-
mutationTracker.add(this, shared.htmlPropertyToAttribute(reflectedPropName));
|
192
|
-
},
|
193
|
-
enumerable: true,
|
194
|
-
});
|
195
|
-
}
|
196
|
-
Object.defineProperty(this, 'className', {
|
440
|
+
assign(this, props);
|
441
|
+
defineProperty(this, 'className', {
|
197
442
|
get() {
|
198
443
|
return props.class ?? '';
|
199
444
|
},
|
@@ -211,29 +456,29 @@ class LightningElement {
|
|
211
456
|
return (__classPrivateFieldSet(this, _LightningElement_classList, new ClassList(this), "f"));
|
212
457
|
}
|
213
458
|
setAttribute(attrName, attrValue) {
|
214
|
-
|
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);
|
215
464
|
}
|
216
465
|
getAttribute(attrName) {
|
217
|
-
|
218
|
-
|
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];
|
219
469
|
}
|
220
470
|
return null;
|
221
471
|
}
|
222
472
|
hasAttribute(attrName) {
|
223
|
-
|
473
|
+
const normalizedName = StringToLowerCase.call(toString(attrName));
|
474
|
+
return hasOwnProperty.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName);
|
224
475
|
}
|
225
476
|
removeAttribute(attrName) {
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
}
|
232
|
-
else {
|
233
|
-
// This interprets the removal of a non-existing attribute as an
|
234
|
-
// attribute mutation. We may want to revisit this.
|
235
|
-
mutationTracker.add(this, attrName);
|
236
|
-
}
|
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);
|
237
482
|
}
|
238
483
|
addEventListener(_type, _listener, _options) {
|
239
484
|
// noop
|
@@ -309,10 +554,7 @@ class LightningElement {
|
|
309
554
|
throw new Error('Method "setAttributeNS" not implemented.');
|
310
555
|
}
|
311
556
|
}
|
312
|
-
|
313
|
-
__classPrivateFieldGet(this, _LightningElement_attrs, "f")[attrName] = attrValue;
|
314
|
-
mutationTracker.add(this, attrName);
|
315
|
-
};
|
557
|
+
defineProperties(LightningElement.prototype, descriptors);
|
316
558
|
|
317
559
|
/*
|
318
560
|
* Copyright (c) 2024, salesforce.com, inc.
|
@@ -336,15 +578,49 @@ function* renderAttrs(instance, attrs) {
|
|
336
578
|
}
|
337
579
|
yield mutationTracker.renderMutatedAttrs(instance);
|
338
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
|
+
}
|
339
596
|
function* fallbackTmpl(_props, _attrs, _slotted, Cmp, _instance) {
|
340
597
|
if (Cmp.renderMode !== 'light') {
|
341
598
|
yield '<template shadowrootmode="open"></template>';
|
342
599
|
}
|
343
600
|
}
|
344
|
-
|
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') {
|
345
607
|
let markup = '';
|
346
|
-
|
608
|
+
const emit = (segment) => {
|
347
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}`);
|
348
624
|
}
|
349
625
|
return markup;
|
350
626
|
}
|
@@ -662,9 +938,11 @@ exports.api = api;
|
|
662
938
|
exports.createContextProvider = createContextProvider;
|
663
939
|
exports.createElement = createElement;
|
664
940
|
exports.fallbackTmpl = fallbackTmpl;
|
941
|
+
exports.fallbackTmplNoYield = fallbackTmplNoYield;
|
665
942
|
exports.freezeTemplate = freezeTemplate;
|
666
943
|
exports.getComponentDef = getComponentDef;
|
667
944
|
exports.hot = hot;
|
945
|
+
exports.htmlEscape = htmlEscape;
|
668
946
|
exports.isComponentConstructor = isComponentConstructor;
|
669
947
|
exports.mutationTracker = mutationTracker;
|
670
948
|
exports.parseFragment = parseFragment;
|
@@ -674,6 +952,7 @@ exports.registerComponent = registerComponent;
|
|
674
952
|
exports.registerDecorators = registerDecorators;
|
675
953
|
exports.registerTemplate = registerTemplate;
|
676
954
|
exports.renderAttrs = renderAttrs;
|
955
|
+
exports.renderAttrsNoYield = renderAttrsNoYield;
|
677
956
|
exports.renderComponent = serverSideRenderComponent;
|
678
957
|
exports.renderer = renderer;
|
679
958
|
exports.sanitizeAttribute = sanitizeAttribute;
|
@@ -689,5 +968,5 @@ exports.track = track;
|
|
689
968
|
exports.unwrap = unwrap;
|
690
969
|
exports.validateStyleTextContents = validateStyleTextContents;
|
691
970
|
exports.wire = wire;
|
692
|
-
/** version: 8.
|
971
|
+
/** version: 8.4.0 */
|
693
972
|
//# sourceMappingURL=index.cjs.js.map
|