@lwc/ssr-runtime 8.5.0 → 8.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clone-and-deep-freeze.d.ts +1 -0
- package/dist/index.cjs.js +892 -714
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +891 -715
- package/dist/index.js.map +1 -1
- package/dist/lightning-element.d.ts +52 -0
- package/dist/reflection.d.ts +7 -2
- package/dist/stubs.d.ts +0 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -7,110 +7,217 @@
|
|
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
|
-
|
11
|
-
|
12
|
-
|
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
|
-
}
|
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.');
|
78
13
|
}
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
function
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
function
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
}
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
14
|
+
function createContextProvider(..._) {
|
15
|
+
throw new Error('createContextProvider cannot be used in SSR context.');
|
16
|
+
}
|
17
|
+
function createElement(..._) {
|
18
|
+
throw new Error('createElement cannot be used in SSR context.');
|
19
|
+
}
|
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.');
|
78
|
+
},
|
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.');
|
186
|
+
},
|
187
|
+
assertInstanceOfHTMLElement(..._) {
|
188
|
+
throw new Error('renderer.assertInstanceOfHTMLElement cannot be used in SSR context.');
|
189
|
+
},
|
190
|
+
ownerDocument(..._) {
|
191
|
+
throw new Error('renderer.ownerDocument cannot be used in SSR context.');
|
192
|
+
},
|
193
|
+
registerContextConsumer(..._) {
|
194
|
+
throw new Error('renderer.registerContextConsumer cannot be used in SSR context.');
|
195
|
+
},
|
196
|
+
attachInternals(..._) {
|
197
|
+
throw new Error('renderer.attachInternals cannot be used in SSR context.');
|
198
|
+
},
|
199
|
+
defineCustomElement(..._) {
|
200
|
+
throw new Error('renderer.defineCustomElement cannot be used in SSR context.');
|
201
|
+
},
|
202
|
+
getParentNode(..._) {
|
203
|
+
throw new Error('renderer.getParentNode cannot be used in SSR context.');
|
204
|
+
},
|
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.');
|
210
|
+
},
|
113
211
|
};
|
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;
|
114
221
|
|
115
222
|
/**
|
116
223
|
* Copyright (c) 2024 Salesforce, Inc.
|
@@ -126,6 +233,16 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
126
233
|
* @param value
|
127
234
|
* @param msg
|
128
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}`);
|
244
|
+
}
|
245
|
+
}
|
129
246
|
|
130
247
|
/*
|
131
248
|
* Copyright (c) 2024, Salesforce, Inc.
|
@@ -178,8 +295,18 @@ from: ArrayFrom, } = Array;
|
|
178
295
|
// statement, rather than this declaration.
|
179
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!
|
180
297
|
} = Array.prototype;
|
298
|
+
/** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */
|
299
|
+
const { fromCharCode: StringFromCharCode } = String;
|
181
300
|
// No JSDocs here - see comment for Array.prototype
|
182
301
|
const { charAt: StringCharAt, charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, trim: StringTrim, } = String.prototype;
|
302
|
+
/**
|
303
|
+
* Determines whether the argument is `undefined`.
|
304
|
+
* @param obj Value to test
|
305
|
+
* @returns `true` if the value is `undefined`.
|
306
|
+
*/
|
307
|
+
function isUndefined(obj) {
|
308
|
+
return obj === undefined;
|
309
|
+
}
|
183
310
|
/**
|
184
311
|
* Determines whether the argument is `null`.
|
185
312
|
* @param obj Value to test
|
@@ -188,6 +315,14 @@ const { charAt: StringCharAt, charCodeAt: StringCharCodeAt, replace: StringRepla
|
|
188
315
|
function isNull(obj) {
|
189
316
|
return obj === null;
|
190
317
|
}
|
318
|
+
/**
|
319
|
+
* Determines whether the argument is an object or null.
|
320
|
+
* @param obj Value to test
|
321
|
+
* @returns `true` if the value is an object or null.
|
322
|
+
*/
|
323
|
+
function isObject(obj) {
|
324
|
+
return typeof obj === 'object';
|
325
|
+
}
|
191
326
|
const OtS = {}.toString;
|
192
327
|
/**
|
193
328
|
* Converts the argument to a string, safely accounting for objects with "null" prototype.
|
@@ -302,442 +437,325 @@ const { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap } = /*@__PURE__*/ (
|
|
302
437
|
// Synthetic creation of all AOM property descriptors for Custom Elements
|
303
438
|
forEach.call(AriaPropertyNames, (propName) => {
|
304
439
|
const attrName = StringToLowerCase.call(StringReplace.call(propName, /^aria/, () => 'aria-'));
|
440
|
+
// These type assertions are because the map types are a 1:1 mapping of ariaX to aria-x.
|
441
|
+
// TypeScript knows we have one of ariaX | ariaY and one of aria-x | aria-y, and tries to
|
442
|
+
// prevent us from doing ariaX: aria-y, but we that it's safe.
|
305
443
|
AriaAttrNameToPropNameMap[attrName] = propName;
|
306
444
|
AriaPropNameToAttrNameMap[propName] = attrName;
|
307
445
|
});
|
308
446
|
return { AriaAttrNameToPropNameMap, AriaPropNameToAttrNameMap };
|
309
447
|
})();
|
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
|
-
'<': '<',
|
321
|
-
'>': '>',
|
322
|
-
'&': '&',
|
323
|
-
};
|
324
448
|
/**
|
325
449
|
*
|
326
|
-
* @param
|
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]);
|
332
|
-
}
|
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;
|
344
|
-
}
|
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
|
450
|
+
* @param attrName
|
352
451
|
*/
|
353
|
-
|
354
|
-
|
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
|
-
}
|
452
|
+
function isAriaAttribute(attrName) {
|
453
|
+
return attrName in AriaAttrNameToPropNameMap;
|
384
454
|
}
|
385
|
-
|
386
|
-
const
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
455
|
+
// This list is based on https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
|
456
|
+
const GLOBAL_ATTRIBUTE = /*@__PURE__*/ new Set([
|
457
|
+
'accesskey',
|
458
|
+
'autocapitalize',
|
459
|
+
'autofocus',
|
460
|
+
'class',
|
461
|
+
'contenteditable',
|
462
|
+
'contextmenu',
|
463
|
+
'dir',
|
464
|
+
'draggable',
|
465
|
+
'enterkeyhint',
|
466
|
+
'exportparts',
|
467
|
+
'hidden',
|
468
|
+
'id',
|
469
|
+
'inputmode',
|
470
|
+
'is',
|
471
|
+
'itemid',
|
472
|
+
'itemprop',
|
473
|
+
'itemref',
|
474
|
+
'itemscope',
|
475
|
+
'itemtype',
|
476
|
+
'lang',
|
477
|
+
'nonce',
|
478
|
+
'part',
|
479
|
+
'slot',
|
480
|
+
'spellcheck',
|
481
|
+
'style',
|
482
|
+
'tabindex',
|
483
|
+
'title',
|
484
|
+
'translate',
|
485
|
+
]);
|
410
486
|
/**
|
411
|
-
*
|
487
|
+
*
|
488
|
+
* @param attrName
|
412
489
|
*/
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
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
|
-
}
|
441
|
-
},
|
442
|
-
});
|
490
|
+
function isGlobalHtmlAttribute(attrName) {
|
491
|
+
return GLOBAL_ATTRIBUTE.has(attrName);
|
492
|
+
}
|
493
|
+
// These are HTML standard prop/attribute IDL mappings, but are not predictable based on camel/kebab-case conversion
|
494
|
+
const SPECIAL_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/ new Map([
|
495
|
+
['accessKey', 'accesskey'],
|
496
|
+
['readOnly', 'readonly'],
|
497
|
+
['tabIndex', 'tabindex'],
|
498
|
+
['bgColor', 'bgcolor'],
|
499
|
+
['colSpan', 'colspan'],
|
500
|
+
['rowSpan', 'rowspan'],
|
501
|
+
['contentEditable', 'contenteditable'],
|
502
|
+
['crossOrigin', 'crossorigin'],
|
503
|
+
['dateTime', 'datetime'],
|
504
|
+
['formAction', 'formaction'],
|
505
|
+
['isMap', 'ismap'],
|
506
|
+
['maxLength', 'maxlength'],
|
507
|
+
['minLength', 'minlength'],
|
508
|
+
['noValidate', 'novalidate'],
|
509
|
+
['useMap', 'usemap'],
|
510
|
+
['htmlFor', 'for'],
|
511
|
+
]);
|
443
512
|
/**
|
444
|
-
*
|
513
|
+
* Map associating previously transformed HTML property into HTML attribute.
|
445
514
|
*/
|
446
|
-
const
|
447
|
-
configurable: true,
|
448
|
-
enumerable: true,
|
449
|
-
get() {
|
450
|
-
return this.hasAttribute(attrName);
|
451
|
-
},
|
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
|
-
}
|
464
|
-
},
|
465
|
-
});
|
515
|
+
const CACHED_PROPERTY_ATTRIBUTE_MAPPING = /*@__PURE__@*/ new Map();
|
466
516
|
/**
|
467
|
-
*
|
517
|
+
*
|
518
|
+
* @param propName
|
468
519
|
*/
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
520
|
+
function htmlPropertyToAttribute(propName) {
|
521
|
+
const ariaAttributeName = AriaPropNameToAttrNameMap[propName];
|
522
|
+
if (!isUndefined(ariaAttributeName)) {
|
523
|
+
return ariaAttributeName;
|
524
|
+
}
|
525
|
+
const specialAttributeName = SPECIAL_PROPERTY_ATTRIBUTE_MAPPING.get(propName);
|
526
|
+
if (!isUndefined(specialAttributeName)) {
|
527
|
+
return specialAttributeName;
|
528
|
+
}
|
529
|
+
const cachedAttributeName = CACHED_PROPERTY_ATTRIBUTE_MAPPING.get(propName);
|
530
|
+
if (!isUndefined(cachedAttributeName)) {
|
531
|
+
return cachedAttributeName;
|
532
|
+
}
|
533
|
+
let attributeName = '';
|
534
|
+
for (let i = 0, len = propName.length; i < len; i++) {
|
535
|
+
const code = StringCharCodeAt.call(propName, i);
|
536
|
+
if (code >= 65 && // "A"
|
537
|
+
code <= 90 // "Z"
|
538
|
+
) {
|
539
|
+
attributeName += '-' + StringFromCharCode(code + 32);
|
487
540
|
}
|
488
|
-
|
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;
|
541
|
+
else {
|
542
|
+
attributeName += StringFromCharCode(code);
|
497
543
|
}
|
498
544
|
}
|
545
|
+
CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
|
546
|
+
return attributeName;
|
499
547
|
}
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
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
|
-
},
|
522
|
-
},
|
523
|
-
title: stringDescriptor('title'),
|
548
|
+
|
549
|
+
/*
|
550
|
+
* Copyright (c) 2020, salesforce.com, inc.
|
551
|
+
* All rights reserved.
|
552
|
+
* SPDX-License-Identifier: MIT
|
553
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
554
|
+
*/
|
555
|
+
const ESCAPED_CHARS = {
|
556
|
+
'"': '"',
|
557
|
+
"'": ''',
|
558
|
+
'<': '<',
|
559
|
+
'>': '>',
|
560
|
+
'&': '&',
|
524
561
|
};
|
525
|
-
|
526
|
-
|
527
|
-
|
562
|
+
/**
|
563
|
+
*
|
564
|
+
* @param str
|
565
|
+
* @param attrMode
|
566
|
+
*/
|
567
|
+
function htmlEscape(str, attrMode = false) {
|
568
|
+
const searchValue = attrMode ? /["&]/g : /["'<>&]/g;
|
569
|
+
return str.replace(searchValue, (char) => ESCAPED_CHARS[char]);
|
528
570
|
}
|
529
571
|
|
530
572
|
/*
|
531
|
-
* Copyright (c) 2024,
|
573
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
532
574
|
* All rights reserved.
|
533
575
|
* SPDX-License-Identifier: MIT
|
534
576
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
535
577
|
*/
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
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.');
|
578
|
+
let hooksAreSet = false;
|
579
|
+
/**
|
580
|
+
* EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
|
581
|
+
* libraries to sanitize HTML content. This hook process the content passed via the template to
|
582
|
+
* lwc:inner-html directive.
|
583
|
+
* It is meant to be overridden via `setHooks`; it throws an error by default.
|
584
|
+
*/
|
585
|
+
let sanitizeHtmlContent = () => {
|
586
|
+
// locker-service patches this function during runtime to sanitize HTML content.
|
587
|
+
throw new Error('sanitizeHtmlContent hook must be implemented.');
|
588
|
+
};
|
589
|
+
function setHooks(hooks) {
|
590
|
+
isFalse$1(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');
|
591
|
+
hooksAreSet = true;
|
592
|
+
sanitizeHtmlContent = hooks.sanitizeHtmlContent;
|
593
|
+
}
|
594
|
+
function flattenStylesheets(stylesheets) {
|
595
|
+
const list = [];
|
596
|
+
for (const stylesheet of stylesheets) {
|
597
|
+
if (!isArray(stylesheet)) {
|
598
|
+
list.push(stylesheet);
|
599
|
+
}
|
600
|
+
else {
|
601
|
+
list.push(...flattenStylesheets(stylesheet));
|
602
|
+
}
|
664
603
|
}
|
604
|
+
return list;
|
665
605
|
}
|
666
|
-
|
606
|
+
/** version: 8.7.0 */
|
667
607
|
|
668
608
|
/*
|
669
|
-
* Copyright (c) 2024,
|
609
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
670
610
|
* All rights reserved.
|
671
611
|
* SPDX-License-Identifier: MIT
|
672
612
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
673
613
|
*/
|
674
|
-
const
|
675
|
-
|
676
|
-
|
677
|
-
|
614
|
+
const MULTI_SPACE = /\s+/g;
|
615
|
+
class ClassList {
|
616
|
+
constructor(el) {
|
617
|
+
this.el = el;
|
678
618
|
}
|
679
|
-
|
680
|
-
const
|
681
|
-
|
682
|
-
|
619
|
+
add(...newClassNames) {
|
620
|
+
const className = this.el.className;
|
621
|
+
const set = new Set(className.split(MULTI_SPACE).filter(Boolean));
|
622
|
+
for (const newClassName of newClassNames) {
|
623
|
+
set.add(newClassName);
|
683
624
|
}
|
684
|
-
|
685
|
-
|
625
|
+
this.el.className = Array.from(set).join(' ');
|
626
|
+
}
|
627
|
+
contains(className) {
|
628
|
+
const currentClassNameStr = this.el.className;
|
629
|
+
return currentClassNameStr.split(MULTI_SPACE).includes(className);
|
630
|
+
}
|
631
|
+
remove(...classNamesToRemove) {
|
632
|
+
const className = this.el.className;
|
633
|
+
const set = new Set(className.split(MULTI_SPACE).filter(Boolean));
|
634
|
+
for (const newClassName of classNamesToRemove) {
|
635
|
+
set.delete(newClassName);
|
686
636
|
}
|
637
|
+
this.el.className = Array.from(set).join(' ');
|
687
638
|
}
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
639
|
+
replace(oldClassName, newClassName) {
|
640
|
+
let classWasReplaced = false;
|
641
|
+
const className = this.el.className;
|
642
|
+
const listOfClasses = className.split(MULTI_SPACE).filter(Boolean);
|
643
|
+
listOfClasses.forEach((value, idx) => {
|
644
|
+
if (value === oldClassName) {
|
645
|
+
classWasReplaced = true;
|
646
|
+
listOfClasses[idx] = newClassName;
|
647
|
+
}
|
648
|
+
});
|
649
|
+
this.el.className = listOfClasses.join(' ');
|
650
|
+
return classWasReplaced;
|
693
651
|
}
|
694
|
-
|
695
|
-
const
|
696
|
-
|
697
|
-
|
652
|
+
toggle(classNameToToggle, force) {
|
653
|
+
const classNameStr = this.el.className;
|
654
|
+
const set = new Set(classNameStr.split(MULTI_SPACE).filter(Boolean));
|
655
|
+
if (!set.has(classNameToToggle) && force !== false) {
|
656
|
+
set.add(classNameToToggle);
|
698
657
|
}
|
699
|
-
else if (
|
700
|
-
|
658
|
+
else if (set.has(classNameToToggle) && force !== true) {
|
659
|
+
set.delete(classNameToToggle);
|
701
660
|
}
|
661
|
+
this.el.className = Array.from(set).join(' ');
|
662
|
+
return set.has(classNameToToggle);
|
702
663
|
}
|
703
|
-
|
704
|
-
|
705
|
-
function* fallbackTmpl(_props, _attrs, _slotted, Cmp, _instance) {
|
706
|
-
if (Cmp.renderMode !== 'light') {
|
707
|
-
yield '<template shadowrootmode="open"></template>';
|
664
|
+
get value() {
|
665
|
+
return this.el.className;
|
708
666
|
}
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
667
|
+
toString() {
|
668
|
+
return this.el.className;
|
669
|
+
}
|
670
|
+
item(_index) {
|
671
|
+
throw new Error('Method "item" not implemented.');
|
672
|
+
}
|
673
|
+
supports(_token) {
|
674
|
+
throw new Error('Method "supports" not implemented.');
|
675
|
+
}
|
676
|
+
forEach(_callbackfn, _thisArg) {
|
677
|
+
throw new Error('Method "forEach" not implemented.');
|
678
|
+
}
|
679
|
+
get length() {
|
680
|
+
throw new Error('Property "length" not implemented.');
|
713
681
|
}
|
714
682
|
}
|
715
|
-
|
716
|
-
|
717
|
-
|
683
|
+
|
684
|
+
/******************************************************************************
|
685
|
+
Copyright (c) Microsoft Corporation.
|
686
|
+
|
687
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
688
|
+
purpose with or without fee is hereby granted.
|
689
|
+
|
690
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
691
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
692
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
693
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
694
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
695
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
696
|
+
PERFORMANCE OF THIS SOFTWARE.
|
697
|
+
***************************************************************************** */
|
698
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
699
|
+
|
700
|
+
|
701
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
702
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
703
|
+
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");
|
704
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
705
|
+
}
|
706
|
+
|
707
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
708
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
709
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
710
|
+
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");
|
711
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
712
|
+
}
|
713
|
+
|
714
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
715
|
+
var e = new Error(message);
|
716
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
717
|
+
};
|
718
|
+
|
719
|
+
/*
|
720
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
721
|
+
* All rights reserved.
|
722
|
+
* SPDX-License-Identifier: MIT
|
723
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
724
|
+
*/
|
725
|
+
var _MutationTracker_enabledSet, _MutationTracker_mutationMap;
|
726
|
+
class MutationTracker {
|
727
|
+
constructor() {
|
728
|
+
_MutationTracker_enabledSet.set(this, new WeakSet());
|
729
|
+
_MutationTracker_mutationMap.set(this, new WeakMap());
|
718
730
|
}
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
markup += segment;
|
731
|
+
add(instance, attrName) {
|
732
|
+
if (__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").has(instance)) {
|
733
|
+
let mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
|
734
|
+
if (!mutatedAttrs) {
|
735
|
+
mutatedAttrs = new Set();
|
736
|
+
__classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").set(instance, mutatedAttrs);
|
737
|
+
}
|
738
|
+
mutatedAttrs.add(attrName.toLowerCase());
|
728
739
|
}
|
729
740
|
}
|
730
|
-
|
731
|
-
|
741
|
+
enable(instance) {
|
742
|
+
__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").add(instance);
|
732
743
|
}
|
733
|
-
|
734
|
-
|
744
|
+
disable(instance) {
|
745
|
+
__classPrivateFieldGet(this, _MutationTracker_enabledSet, "f").delete(instance);
|
735
746
|
}
|
736
|
-
|
737
|
-
|
747
|
+
renderMutatedAttrs(instance) {
|
748
|
+
const mutatedAttrs = __classPrivateFieldGet(this, _MutationTracker_mutationMap, "f").get(instance);
|
749
|
+
if (mutatedAttrs) {
|
750
|
+
return ` data-lwc-host-mutated="${[...mutatedAttrs].sort().join(' ')}"`;
|
751
|
+
}
|
752
|
+
else {
|
753
|
+
return '';
|
754
|
+
}
|
738
755
|
}
|
739
|
-
return markup;
|
740
756
|
}
|
757
|
+
_MutationTracker_enabledSet = new WeakMap(), _MutationTracker_mutationMap = new WeakMap();
|
758
|
+
const mutationTracker = new MutationTracker();
|
741
759
|
|
742
760
|
/*
|
743
761
|
* Copyright (c) 2024, Salesforce, Inc.
|
@@ -745,220 +763,271 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
|
|
745
763
|
* SPDX-License-Identifier: MIT
|
746
764
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
747
765
|
*/
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
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.');
|
811
|
-
}
|
812
|
-
function wire(..._) {
|
813
|
-
throw new Error('@wire cannot be used in SSR context.');
|
766
|
+
/**
|
767
|
+
* Filters out the following types of properties that should not be set.
|
768
|
+
* - Properties that are not public.
|
769
|
+
* - Properties that are not global.
|
770
|
+
* - Properties that are global but are internally overridden.
|
771
|
+
*/
|
772
|
+
function filterProperties(props, publicFields, privateFields) {
|
773
|
+
const propsToAssign = create(null);
|
774
|
+
const publicFieldSet = new Set(publicFields);
|
775
|
+
const privateFieldSet = new Set(privateFields);
|
776
|
+
keys(props).forEach((propName) => {
|
777
|
+
const attrName = htmlPropertyToAttribute(propName);
|
778
|
+
if (publicFieldSet.has(propName) ||
|
779
|
+
((isGlobalHtmlAttribute(attrName) || isAriaAttribute(attrName)) &&
|
780
|
+
!privateFieldSet.has(propName))) {
|
781
|
+
propsToAssign[propName] = props[propName];
|
782
|
+
}
|
783
|
+
});
|
784
|
+
return propsToAssign;
|
814
785
|
}
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
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.');
|
786
|
+
/**
|
787
|
+
* Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
|
788
|
+
*/
|
789
|
+
const stringDescriptor = (attrName) => ({
|
790
|
+
configurable: true,
|
791
|
+
enumerable: true,
|
792
|
+
get() {
|
793
|
+
return this.getAttribute(attrName);
|
927
794
|
},
|
928
|
-
|
929
|
-
|
795
|
+
set(newValue) {
|
796
|
+
const currentValue = this.getAttribute(attrName);
|
797
|
+
const normalizedValue = String(newValue);
|
798
|
+
if (normalizedValue !== currentValue) {
|
799
|
+
this.setAttribute(attrName, normalizedValue);
|
800
|
+
}
|
930
801
|
},
|
931
|
-
|
932
|
-
|
802
|
+
});
|
803
|
+
/** Descriptor for a boolean that checks for `attr="true"` or `attr="false"`, e.g. `spellcheck` and `draggable`. */
|
804
|
+
const explicitBooleanDescriptor = (attrName, defaultValue) => ({
|
805
|
+
configurable: true,
|
806
|
+
enumerable: true,
|
807
|
+
get() {
|
808
|
+
const value = this.getAttribute(attrName);
|
809
|
+
return value === null ? defaultValue : value === String(defaultValue);
|
933
810
|
},
|
934
|
-
|
935
|
-
|
811
|
+
set(newValue) {
|
812
|
+
const currentValue = this.getAttribute(attrName);
|
813
|
+
const normalizedValue = String(Boolean(newValue));
|
814
|
+
if (normalizedValue !== currentValue) {
|
815
|
+
this.setAttribute(attrName, normalizedValue);
|
816
|
+
}
|
936
817
|
},
|
937
|
-
|
938
|
-
|
818
|
+
});
|
819
|
+
/**
|
820
|
+
* Descriptor for a "true" boolean attribute that checks solely for presence, e.g. `hidden`.
|
821
|
+
*/
|
822
|
+
const booleanAttributeDescriptor = (attrName) => ({
|
823
|
+
configurable: true,
|
824
|
+
enumerable: true,
|
825
|
+
get() {
|
826
|
+
return this.hasAttribute(attrName);
|
939
827
|
},
|
940
|
-
|
941
|
-
|
828
|
+
set(newValue) {
|
829
|
+
const hasAttribute = this.hasAttribute(attrName);
|
830
|
+
if (newValue) {
|
831
|
+
if (!hasAttribute) {
|
832
|
+
this.setAttribute(attrName, '');
|
833
|
+
}
|
834
|
+
}
|
835
|
+
else {
|
836
|
+
if (hasAttribute) {
|
837
|
+
this.removeAttribute(attrName);
|
838
|
+
}
|
839
|
+
}
|
942
840
|
},
|
943
|
-
|
944
|
-
|
841
|
+
});
|
842
|
+
/**
|
843
|
+
* Descriptor for ARIA reflections, e.g. `ariaLabel` and `role`.
|
844
|
+
*/
|
845
|
+
const ariaDescriptor = (attrName) => ({
|
846
|
+
configurable: true,
|
847
|
+
enumerable: true,
|
848
|
+
get() {
|
849
|
+
return this.getAttribute(attrName);
|
945
850
|
},
|
946
|
-
|
947
|
-
|
851
|
+
set(newValue) {
|
852
|
+
const currentValue = this.getAttribute(attrName);
|
853
|
+
if (newValue !== currentValue) {
|
854
|
+
// TODO [#3284]: According to the spec, IDL nullable type values
|
855
|
+
// (null and undefined) should remove the attribute; however, we
|
856
|
+
// only do so in the case of null for historical reasons.
|
857
|
+
if (isNull(newValue)) {
|
858
|
+
this.removeAttribute(attrName);
|
859
|
+
}
|
860
|
+
else {
|
861
|
+
this.setAttribute(attrName, toString(newValue));
|
862
|
+
}
|
863
|
+
}
|
948
864
|
},
|
949
|
-
|
950
|
-
|
865
|
+
});
|
866
|
+
const descriptors = {
|
867
|
+
accessKey: stringDescriptor('accesskey'),
|
868
|
+
dir: stringDescriptor('dir'),
|
869
|
+
draggable: explicitBooleanDescriptor('draggable', true),
|
870
|
+
hidden: booleanAttributeDescriptor('hidden'),
|
871
|
+
id: stringDescriptor('id'),
|
872
|
+
lang: stringDescriptor('lang'),
|
873
|
+
spellcheck: explicitBooleanDescriptor('spellcheck', false),
|
874
|
+
tabIndex: {
|
875
|
+
get() {
|
876
|
+
const str = this.getAttribute('tabindex');
|
877
|
+
const num = Number(str);
|
878
|
+
return isFinite(num) ? Math.trunc(num) : -1;
|
879
|
+
},
|
880
|
+
set(newValue) {
|
881
|
+
const currentValue = this.getAttribute('tabindex');
|
882
|
+
const num = Number(newValue);
|
883
|
+
const normalizedValue = isFinite(num) ? String(Math.trunc(num)) : '0';
|
884
|
+
if (normalizedValue !== currentValue) {
|
885
|
+
this.setAttribute('tabindex', toString(newValue));
|
886
|
+
}
|
887
|
+
},
|
951
888
|
},
|
889
|
+
title: stringDescriptor('title'),
|
952
890
|
};
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
891
|
+
// Add descriptors for ARIA attributes
|
892
|
+
for (const [attrName, propName] of entries(AriaAttrNameToPropNameMap)) {
|
893
|
+
descriptors[propName] = ariaDescriptor(attrName);
|
894
|
+
}
|
895
|
+
|
896
|
+
/*
|
897
|
+
* Copyright (c) 2024, salesforce.com, inc.
|
898
|
+
* All rights reserved.
|
899
|
+
* SPDX-License-Identifier: MIT
|
900
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
959
901
|
*/
|
960
|
-
|
961
|
-
const
|
902
|
+
var _LightningElement_attrs, _LightningElement_classList;
|
903
|
+
const SYMBOL__SET_INTERNALS = Symbol('set-internals');
|
904
|
+
const SYMBOL__GENERATE_MARKUP = Symbol('generate-markup');
|
905
|
+
class LightningElement {
|
906
|
+
constructor(propsAvailableAtConstruction) {
|
907
|
+
this.isConnected = false;
|
908
|
+
this.className = '';
|
909
|
+
_LightningElement_attrs.set(this, void 0);
|
910
|
+
_LightningElement_classList.set(this, null);
|
911
|
+
assign(this, propsAvailableAtConstruction);
|
912
|
+
}
|
913
|
+
[(_LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
|
914
|
+
__classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
|
915
|
+
assign(this, props);
|
916
|
+
defineProperty(this, 'className', {
|
917
|
+
get() {
|
918
|
+
return props.class ?? '';
|
919
|
+
},
|
920
|
+
set(newVal) {
|
921
|
+
props.class = newVal;
|
922
|
+
attrs.class = newVal;
|
923
|
+
mutationTracker.add(this, 'class');
|
924
|
+
},
|
925
|
+
});
|
926
|
+
}
|
927
|
+
get classList() {
|
928
|
+
if (__classPrivateFieldGet(this, _LightningElement_classList, "f")) {
|
929
|
+
return __classPrivateFieldGet(this, _LightningElement_classList, "f");
|
930
|
+
}
|
931
|
+
return (__classPrivateFieldSet(this, _LightningElement_classList, new ClassList(this), "f"));
|
932
|
+
}
|
933
|
+
setAttribute(attrName, attrValue) {
|
934
|
+
const normalizedName = StringToLowerCase.call(toString(attrName));
|
935
|
+
const normalizedValue = String(attrValue);
|
936
|
+
__classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName] = normalizedValue;
|
937
|
+
mutationTracker.add(this, normalizedName);
|
938
|
+
}
|
939
|
+
getAttribute(attrName) {
|
940
|
+
const normalizedName = StringToLowerCase.call(toString(attrName));
|
941
|
+
if (hasOwnProperty.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName)) {
|
942
|
+
return __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
|
943
|
+
}
|
944
|
+
return null;
|
945
|
+
}
|
946
|
+
hasAttribute(attrName) {
|
947
|
+
const normalizedName = StringToLowerCase.call(toString(attrName));
|
948
|
+
return hasOwnProperty.call(__classPrivateFieldGet(this, _LightningElement_attrs, "f"), normalizedName);
|
949
|
+
}
|
950
|
+
removeAttribute(attrName) {
|
951
|
+
const normalizedName = StringToLowerCase.call(toString(attrName));
|
952
|
+
delete __classPrivateFieldGet(this, _LightningElement_attrs, "f")[normalizedName];
|
953
|
+
// Track mutations for removal of non-existing attributes
|
954
|
+
mutationTracker.add(this, normalizedName);
|
955
|
+
}
|
956
|
+
addEventListener(_type, _listener, _options) {
|
957
|
+
// noop
|
958
|
+
}
|
959
|
+
removeEventListener(_type, _listener, _options) {
|
960
|
+
// noop
|
961
|
+
}
|
962
|
+
// ----------------------------------------------------------- //
|
963
|
+
// Props/methods explicitly not available in this environment //
|
964
|
+
// Getters are named "get*" for parity with @lwc/engine-server //
|
965
|
+
// ----------------------------------------------------------- //
|
966
|
+
get children() {
|
967
|
+
throw new TypeError('"getChildren" is not supported in this environment');
|
968
|
+
}
|
969
|
+
get childNodes() {
|
970
|
+
throw new TypeError('"getChildNodes" is not supported in this environment');
|
971
|
+
}
|
972
|
+
get firstChild() {
|
973
|
+
throw new TypeError('"getFirstChild" is not supported in this environment');
|
974
|
+
}
|
975
|
+
get firstElementChild() {
|
976
|
+
throw new TypeError('"getFirstElementChild" is not supported in this environment');
|
977
|
+
}
|
978
|
+
get hostElement() {
|
979
|
+
// Intentionally different to match @lwc/engine-*core*
|
980
|
+
throw new TypeError('this.hostElement is not supported in this environment');
|
981
|
+
}
|
982
|
+
get lastChild() {
|
983
|
+
throw new TypeError('"getLastChild" is not supported in this environment');
|
984
|
+
}
|
985
|
+
get lastElementChild() {
|
986
|
+
throw new TypeError('"getLastElementChild" is not supported in this environment');
|
987
|
+
}
|
988
|
+
get ownerDocument() {
|
989
|
+
// Intentionally not "get*" to match @lwc/engine-server
|
990
|
+
throw new TypeError('"ownerDocument" is not supported in this environment');
|
991
|
+
}
|
992
|
+
get style() {
|
993
|
+
// Intentionally not "get*" to match @lwc/engine-server
|
994
|
+
throw new TypeError('"style" is not supported in this environment');
|
995
|
+
}
|
996
|
+
attachInternals() {
|
997
|
+
throw new TypeError('"attachInternals" is not supported in this environment');
|
998
|
+
}
|
999
|
+
dispatchEvent(_event) {
|
1000
|
+
throw new TypeError('"dispatchEvent" is not supported in this environment');
|
1001
|
+
}
|
1002
|
+
getBoundingClientRect() {
|
1003
|
+
throw new TypeError('"getBoundingClientRect" is not supported in this environment');
|
1004
|
+
}
|
1005
|
+
getElementsByClassName(_classNames) {
|
1006
|
+
throw new TypeError('"getElementsByClassName" is not supported in this environment');
|
1007
|
+
}
|
1008
|
+
getElementsByTagName(_qualifiedName) {
|
1009
|
+
throw new TypeError('"getElementsByTagName" is not supported in this environment');
|
1010
|
+
}
|
1011
|
+
querySelector(_selectors) {
|
1012
|
+
throw new TypeError('"querySelector" is not supported in this environment');
|
1013
|
+
}
|
1014
|
+
querySelectorAll(_selectors) {
|
1015
|
+
throw new TypeError('"querySelectorAll" is not supported in this environment');
|
1016
|
+
}
|
1017
|
+
getAttributeNS(_namespace, _localName) {
|
1018
|
+
throw new Error('Method "getAttributeNS" not implemented.');
|
1019
|
+
}
|
1020
|
+
hasAttributeNS(_namespace, _localName) {
|
1021
|
+
throw new Error('Method "hasAttributeNS" not implemented.');
|
1022
|
+
}
|
1023
|
+
removeAttributeNS(_namespace, _localName) {
|
1024
|
+
throw new Error('Method "removeAttributeNS" not implemented.');
|
1025
|
+
}
|
1026
|
+
setAttributeNS(_namespace, _qualifiedName, _value) {
|
1027
|
+
throw new Error('Method "setAttributeNS" not implemented.');
|
1028
|
+
}
|
1029
|
+
}
|
1030
|
+
defineProperties(LightningElement.prototype, descriptors);
|
962
1031
|
|
963
1032
|
/*
|
964
1033
|
* Copyright (c) 2024, salesforce.com, inc.
|
@@ -966,35 +1035,72 @@ const hot = undefined;
|
|
966
1035
|
* SPDX-License-Identifier: MIT
|
967
1036
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
968
1037
|
*/
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
*/
|
973
|
-
function* toIteratorDirective(iterable) {
|
974
|
-
if (iterable === undefined || iterable === null)
|
1038
|
+
const escapeAttrVal = (attrVal) => attrVal.replaceAll('&', '&').replaceAll('"', '"');
|
1039
|
+
function* renderAttrs(instance, attrs) {
|
1040
|
+
if (!attrs) {
|
975
1041
|
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
1042
|
}
|
981
|
-
const
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
1043
|
+
for (const attrName of Object.getOwnPropertyNames(attrs)) {
|
1044
|
+
const attrVal = attrs[attrName];
|
1045
|
+
if (typeof attrVal === 'string') {
|
1046
|
+
yield attrVal === '' ? ` ${attrName}` : ` ${attrName}="${escapeAttrVal(attrVal)}"`;
|
1047
|
+
}
|
1048
|
+
else if (attrVal === null) {
|
1049
|
+
yield '';
|
1050
|
+
}
|
1051
|
+
}
|
1052
|
+
yield mutationTracker.renderMutatedAttrs(instance);
|
1053
|
+
}
|
1054
|
+
function renderAttrsNoYield(emit, instance, attrs) {
|
1055
|
+
if (!attrs) {
|
1056
|
+
return;
|
1057
|
+
}
|
1058
|
+
for (const attrName of Object.getOwnPropertyNames(attrs)) {
|
1059
|
+
const attrVal = attrs[attrName];
|
1060
|
+
if (typeof attrVal === 'string') {
|
1061
|
+
emit(attrVal === '' ? ` ${attrName}` : ` ${attrName}="${escapeAttrVal(attrVal)}"`);
|
1062
|
+
}
|
1063
|
+
else if (attrVal === null) {
|
1064
|
+
emit('');
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
emit(mutationTracker.renderMutatedAttrs(instance));
|
1068
|
+
}
|
1069
|
+
function* fallbackTmpl(_props, _attrs, _slotted, Cmp, _instance) {
|
1070
|
+
if (Cmp.renderMode !== 'light') {
|
1071
|
+
yield '<template shadowrootmode="open"></template>';
|
1072
|
+
}
|
1073
|
+
}
|
1074
|
+
function fallbackTmplNoYield(emit, _props, _attrs, _slotted, Cmp, _instance) {
|
1075
|
+
if (Cmp.renderMode !== 'light') {
|
1076
|
+
emit('<template shadowrootmode="open"></template>');
|
1077
|
+
}
|
1078
|
+
}
|
1079
|
+
async function serverSideRenderComponent(tagName, Component, props = {}, mode = 'asyncYield') {
|
1080
|
+
if (typeof tagName !== 'string') {
|
1081
|
+
throw new Error(`tagName must be a string, found: ${tagName}`);
|
1082
|
+
}
|
1083
|
+
// TODO [#4726]: remove `generateMarkup` export
|
1084
|
+
const generateMarkup = SYMBOL__GENERATE_MARKUP in Component ? Component[SYMBOL__GENERATE_MARKUP] : Component;
|
1085
|
+
let markup = '';
|
1086
|
+
const emit = (segment) => {
|
1087
|
+
markup += segment;
|
1088
|
+
};
|
1089
|
+
if (mode === 'asyncYield') {
|
1090
|
+
for await (const segment of generateMarkup(tagName, props, null, null)) {
|
1091
|
+
markup += segment;
|
1092
|
+
}
|
1093
|
+
}
|
1094
|
+
else if (mode === 'async') {
|
1095
|
+
await generateMarkup(emit, tagName, props, null, null);
|
1096
|
+
}
|
1097
|
+
else if (mode === 'sync') {
|
1098
|
+
generateMarkup(emit, tagName, props, null, null);
|
1099
|
+
}
|
1100
|
+
else {
|
1101
|
+
throw new Error(`Invalid mode: ${mode}`);
|
997
1102
|
}
|
1103
|
+
return markup;
|
998
1104
|
}
|
999
1105
|
|
1000
1106
|
/*
|
@@ -1075,6 +1181,76 @@ function renderStylesheets(stylesheets, scopeToken, Component, hasScopedTemplate
|
|
1075
1181
|
return result;
|
1076
1182
|
}
|
1077
1183
|
|
1078
|
-
|
1079
|
-
|
1184
|
+
/*
|
1185
|
+
* Copyright (c) 2024, salesforce.com, inc.
|
1186
|
+
* All rights reserved.
|
1187
|
+
* SPDX-License-Identifier: MIT
|
1188
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1189
|
+
*/
|
1190
|
+
/**
|
1191
|
+
* Converts an iterable into one that emits the object used by the [`iterator` directive](
|
1192
|
+
* https://lwc.dev/guide/html_templates#iterator).
|
1193
|
+
*/
|
1194
|
+
function* toIteratorDirective(iterable) {
|
1195
|
+
if (iterable === undefined || iterable === null)
|
1196
|
+
return;
|
1197
|
+
if (!iterable[Symbol.iterator]) {
|
1198
|
+
throw new Error(
|
1199
|
+
// Mimic error message from "[i]terable node" in engine-core's api.ts
|
1200
|
+
`Invalid template iteration for value \`${iterable}\`. It must be an array-like object.`);
|
1201
|
+
}
|
1202
|
+
const iterator = iterable[Symbol.iterator]();
|
1203
|
+
let next = iterator.next();
|
1204
|
+
let index = 0;
|
1205
|
+
let { value, done: last = false } = next;
|
1206
|
+
while (last === false) {
|
1207
|
+
// using a look-back approach because we need to know if the element is the last
|
1208
|
+
next = iterator.next();
|
1209
|
+
last = next.done ?? false;
|
1210
|
+
yield {
|
1211
|
+
value,
|
1212
|
+
index,
|
1213
|
+
first: index === 0,
|
1214
|
+
last,
|
1215
|
+
};
|
1216
|
+
index += 1;
|
1217
|
+
value = next.value;
|
1218
|
+
}
|
1219
|
+
}
|
1220
|
+
|
1221
|
+
/*
|
1222
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
1223
|
+
* All rights reserved.
|
1224
|
+
* SPDX-License-Identifier: MIT
|
1225
|
+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1226
|
+
*/
|
1227
|
+
// Deep freeze and clone an object. Designed for cloning/freezing child props when passed from a parent to a child so
|
1228
|
+
// that they are immutable. This is one of the normal guarantees of both engine-dom and engine-server that we want to
|
1229
|
+
// emulate in ssr-runtime. The goal here is that a child cannot mutate the props of its parent and thus affect
|
1230
|
+
// the parent's rendering, which would lead to bidirectional reactivity and mischief.
|
1231
|
+
function cloneAndDeepFreeze(obj) {
|
1232
|
+
if (isArray(obj)) {
|
1233
|
+
const res = [];
|
1234
|
+
for (const item of obj) {
|
1235
|
+
ArrayPush.call(res, cloneAndDeepFreeze(item));
|
1236
|
+
}
|
1237
|
+
freeze(res);
|
1238
|
+
return res;
|
1239
|
+
}
|
1240
|
+
else if (isObject(obj) && !isNull(obj)) {
|
1241
|
+
const res = create(null);
|
1242
|
+
for (const [key, value] of entries(obj)) {
|
1243
|
+
res[key] = cloneAndDeepFreeze(value);
|
1244
|
+
}
|
1245
|
+
freeze(res);
|
1246
|
+
return res;
|
1247
|
+
}
|
1248
|
+
else {
|
1249
|
+
// primitive
|
1250
|
+
return obj;
|
1251
|
+
}
|
1252
|
+
}
|
1253
|
+
|
1254
|
+
export { ClassList, LightningElement, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, cloneAndDeepFreeze, createContextProvider, createElement, fallbackTmpl, fallbackTmplNoYield, filterProperties, 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 };
|
1255
|
+
/** version: 8.7.0 */
|
1080
1256
|
//# sourceMappingURL=index.js.map
|