lwc 2.5.10-alpha1 → 2.7.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.
Files changed (54) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +168 -134
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +169 -135
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +154 -133
  5. package/dist/engine-dom/iife/es5/engine-dom.js +185 -145
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +172 -145
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +170 -136
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +155 -134
  11. package/dist/engine-dom/umd/es5/engine-dom.js +186 -146
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +173 -146
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +179 -142
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +179 -142
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +29 -130
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +30 -131
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +30 -131
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +37 -128
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +37 -128
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +31 -132
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +31 -132
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +38 -129
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +38 -129
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +3 -3
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -3
  33. package/dist/wire-service/iife/es5/wire-service.js +12 -12
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +12 -12
  36. package/dist/wire-service/umd/es2017/wire-service.js +4 -4
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +4 -4
  38. package/dist/wire-service/umd/es5/wire-service.js +13 -13
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +13 -13
  41. package/package.json +8 -8
  42. package/dist/engine/esm/es2017/engine.js +0 -7981
  43. package/dist/engine/iife/es2017/engine.js +0 -8013
  44. package/dist/engine/iife/es2017/engine.min.js +0 -9
  45. package/dist/engine/iife/es2017/engine_debug.js +0 -6541
  46. package/dist/engine/iife/es5/engine.js +0 -6060
  47. package/dist/engine/iife/es5/engine.min.js +0 -23
  48. package/dist/engine/iife/es5/engine_debug.js +0 -4856
  49. package/dist/engine/umd/es2017/engine.js +0 -8014
  50. package/dist/engine/umd/es2017/engine.min.js +0 -9
  51. package/dist/engine/umd/es2017/engine_debug.js +0 -6542
  52. package/dist/engine/umd/es5/engine.js +0 -6061
  53. package/dist/engine/umd/es5/engine.min.js +0 -23
  54. package/dist/engine/umd/es5/engine_debug.js +0 -4857
@@ -1,4856 +0,0 @@
1
- var LWC = (function (exports) {
2
- 'use strict';
3
-
4
- /*! *****************************************************************************
5
- Copyright (c) Microsoft Corporation.
6
-
7
- Permission to use, copy, modify, and/or distribute this software for any
8
- purpose with or without fee is hereby granted.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
- PERFORMANCE OF THIS SOFTWARE.
17
- ***************************************************************************** */
18
-
19
- /* global Reflect, Promise */
20
- var extendStatics = function (d, b) {
21
- extendStatics = Object.setPrototypeOf || {
22
- __proto__: []
23
- } instanceof Array && function (d, b) {
24
- d.__proto__ = b;
25
- } || function (d, b) {
26
- for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
27
- };
28
-
29
- return extendStatics(d, b);
30
- };
31
-
32
- function __extends(d, b) {
33
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
34
- extendStatics(d, b);
35
-
36
- function __() {
37
- this.constructor = d;
38
- }
39
-
40
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41
- }
42
- /** @deprecated */
43
-
44
- function __spreadArrays() {
45
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
46
-
47
- for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
48
-
49
- return r;
50
- }
51
-
52
- /* proxy-compat-disable */
53
- /*
54
- * Copyright (c) 2018, salesforce.com, inc.
55
- * All rights reserved.
56
- * SPDX-License-Identifier: MIT
57
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
58
- */
59
- function detect() {
60
- // Don't apply polyfill when ProxyCompat is enabled.
61
- if ('getKey' in Proxy) {
62
- return false;
63
- }
64
- var proxy = new Proxy([3, 4], {});
65
- var res = [1, 2].concat(proxy);
66
- return res.length !== 4;
67
- }
68
- /*
69
- * Copyright (c) 2018, salesforce.com, inc.
70
- * All rights reserved.
71
- * SPDX-License-Identifier: MIT
72
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
73
- */
74
- var isConcatSpreadable = Symbol.isConcatSpreadable;
75
- var isArray = Array.isArray;
76
- var _b = Array.prototype, ArraySlice = _b.slice, ArrayUnshift = _b.unshift, ArrayShift = _b.shift;
77
- function isObject(O) {
78
- return typeof O === 'object' ? O !== null : typeof O === 'function';
79
- } // https://www.ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable
80
- function isSpreadable(O) {
81
- if (!isObject(O)) {
82
- return false;
83
- }
84
- var spreadable = O[isConcatSpreadable];
85
- return spreadable !== undefined ? Boolean(spreadable) : isArray(O);
86
- } // https://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.concat
87
- function ArrayConcatPolyfill() {
88
- var _args = [];
89
- for (var _i = 0; _i < arguments.length; _i++) {
90
- _args[_i] = arguments[_i];
91
- }
92
- var O = Object(this);
93
- var A = [];
94
- var N = 0;
95
- var items = ArraySlice.call(arguments);
96
- ArrayUnshift.call(items, O);
97
- while (items.length) {
98
- var E = ArrayShift.call(items);
99
- if (isSpreadable(E)) {
100
- var k_1 = 0;
101
- var length = E.length;
102
- for (k_1; k_1 < length; k_1 += 1, N += 1) {
103
- if (k_1 in E) {
104
- var subElement = E[k_1];
105
- A[N] = subElement;
106
- }
107
- }
108
- }
109
- else {
110
- A[N] = E;
111
- N += 1;
112
- }
113
- }
114
- return A;
115
- }
116
- function apply() {
117
- // eslint-disable-next-line no-extend-native
118
- Array.prototype.concat = ArrayConcatPolyfill;
119
- }
120
- /*
121
- * Copyright (c) 2018, salesforce.com, inc.
122
- * All rights reserved.
123
- * SPDX-License-Identifier: MIT
124
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
125
- */
126
- if (detect()) {
127
- apply();
128
- }
129
- /**
130
- * Copyright (C) 2018 salesforce.com, inc.
131
- */
132
- /*
133
- * Copyright (c) 2018, salesforce.com, inc.
134
- * All rights reserved.
135
- * SPDX-License-Identifier: MIT
136
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
137
- */
138
- function invariant(value, msg) {
139
- if (!value) {
140
- throw new Error("Invariant Violation: " + msg);
141
- }
142
- }
143
- function isTrue(value, msg) {
144
- if (!value) {
145
- throw new Error("Assert Violation: " + msg);
146
- }
147
- }
148
- function isFalse(value, msg) {
149
- if (value) {
150
- throw new Error("Assert Violation: " + msg);
151
- }
152
- }
153
- function fail(msg) {
154
- throw new Error(msg);
155
- }
156
- var assert = /*#__PURE__*/ Object.freeze({
157
- __proto__: null,
158
- invariant: invariant,
159
- isTrue: isTrue,
160
- isFalse: isFalse,
161
- fail: fail
162
- });
163
- /*
164
- * Copyright (c) 2018, salesforce.com, inc.
165
- * All rights reserved.
166
- * SPDX-License-Identifier: MIT
167
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
168
- */
169
- var assign = Object.assign, create = Object.create, defineProperty = Object.defineProperty, freeze = Object.freeze, hasOwnProperty = Object.hasOwnProperty, keys = Object.keys, seal = Object.seal, setPrototypeOf = Object.setPrototypeOf;
170
- var isArray$1 = Array.isArray;
171
- var _c = Array.prototype, ArrayJoin = _c.join, ArrayMap = _c.map, forEach = _c.forEach;
172
- var _d = String.prototype, StringReplace = _d.replace, StringToLowerCase = _d.toLowerCase;
173
- function isUndefined(obj) {
174
- return obj === undefined;
175
- }
176
- function isNull(obj) {
177
- return obj === null;
178
- }
179
- function isFalse$1(obj) {
180
- return obj === false;
181
- }
182
- function isFunction(obj) {
183
- return typeof obj === 'function';
184
- }
185
- function isObject$1(obj) {
186
- return typeof obj === 'object';
187
- }
188
- var OtS = {}.toString;
189
- function toString(obj) {
190
- if (obj && obj.toString) {
191
- // Arrays might hold objects with "null" prototype So using
192
- // Array.prototype.toString directly will cause an error Iterate through
193
- // all the items and handle individually.
194
- if (isArray$1(obj)) {
195
- return ArrayJoin.call(ArrayMap.call(obj, toString), ',');
196
- }
197
- return obj.toString();
198
- }
199
- else if (typeof obj === 'object') {
200
- return OtS.call(obj);
201
- }
202
- else {
203
- return obj + '';
204
- }
205
- }
206
- /*
207
- * Copyright (c) 2018, salesforce.com, inc.
208
- * All rights reserved.
209
- * SPDX-License-Identifier: MIT
210
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
211
- */
212
- /**
213
- * According to the following list, there are 48 aria attributes of which two (ariaDropEffect and
214
- * ariaGrabbed) are deprecated:
215
- * https://www.w3.org/TR/wai-aria-1.1/#x6-6-definitions-of-states-and-properties-all-aria-attributes
216
- *
217
- * The above list of 46 aria attributes is consistent with the following resources:
218
- * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
219
- * https://wicg.github.io/aom/spec/aria-reflection.html
220
- */
221
- var AriaPropertyNames = ['ariaActiveDescendant', 'ariaAtomic', 'ariaAutoComplete', 'ariaBusy', 'ariaChecked', 'ariaColCount', 'ariaColIndex', 'ariaColSpan', 'ariaControls', 'ariaCurrent', 'ariaDescribedBy', 'ariaDetails', 'ariaDisabled', 'ariaErrorMessage', 'ariaExpanded', 'ariaFlowTo', 'ariaHasPopup', 'ariaHidden', 'ariaInvalid', 'ariaKeyShortcuts', 'ariaLabel', 'ariaLabelledBy', 'ariaLevel', 'ariaLive', 'ariaModal', 'ariaMultiLine', 'ariaMultiSelectable', 'ariaOrientation', 'ariaOwns', 'ariaPlaceholder', 'ariaPosInSet', 'ariaPressed', 'ariaReadOnly', 'ariaRelevant', 'ariaRequired', 'ariaRoleDescription', 'ariaRowCount', 'ariaRowIndex', 'ariaRowSpan', 'ariaSelected', 'ariaSetSize', 'ariaSort', 'ariaValueMax', 'ariaValueMin', 'ariaValueNow', 'ariaValueText', 'role'];
222
- var _e = (function () {
223
- var AriaAttrNameToPropNameMap = create(null);
224
- var AriaPropNameToAttrNameMap = create(null); // Synthetic creation of all AOM property descriptors for Custom Elements
225
- forEach.call(AriaPropertyNames, function (propName) {
226
- var attrName = StringToLowerCase.call(StringReplace.call(propName, /^aria/, function () { return 'aria-'; }));
227
- AriaAttrNameToPropNameMap[attrName] = propName;
228
- AriaPropNameToAttrNameMap[propName] = attrName;
229
- });
230
- return {
231
- AriaAttrNameToPropNameMap: AriaAttrNameToPropNameMap,
232
- AriaPropNameToAttrNameMap: AriaPropNameToAttrNameMap
233
- };
234
- })(), AriaPropNameToAttrNameMap = _e.AriaPropNameToAttrNameMap;
235
- /*
236
- * Copyright (c) 2018, salesforce.com, inc.
237
- * All rights reserved.
238
- * SPDX-License-Identifier: MIT
239
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
240
- */
241
- // We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
242
- // we can't use typeof since it will fail when transpiling.
243
- var hasNativeSymbolSupport = /*@__PURE__*/ (function () { return Symbol('x').toString() === 'Symbol(x)'; })();
244
- /*
245
- * Copyright (c) 2018, salesforce.com, inc.
246
- * All rights reserved.
247
- * SPDX-License-Identifier: MIT
248
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
249
- */
250
- // This method abstracts the creation of symbols, so we can fallback to strings when native symbols
251
- // are not supported.
252
- function createHiddenField(key, namespace) {
253
- return hasNativeSymbolSupport ? Symbol(key) : "$$lwc-" + namespace + "-" + key + "$$";
254
- }
255
- var hiddenFieldsMap = new WeakMap();
256
- function setHiddenField(o, field, value) {
257
- var valuesByField = hiddenFieldsMap.get(o);
258
- if (isUndefined(valuesByField)) {
259
- valuesByField = create(null);
260
- hiddenFieldsMap.set(o, valuesByField);
261
- }
262
- valuesByField[field] = value;
263
- }
264
- function getHiddenField(o, field) {
265
- var valuesByField = hiddenFieldsMap.get(o);
266
- if (!isUndefined(valuesByField)) {
267
- return valuesByField[field];
268
- }
269
- }
270
- /** version: 1.17.8 */
271
- /*
272
- * Copyright (c) 2018, salesforce.com, inc.
273
- * All rights reserved.
274
- * SPDX-License-Identifier: MIT
275
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
276
- */
277
- function detect$1(propName) {
278
- return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;
279
- }
280
- /*
281
- * Copyright (c) 2018, salesforce.com, inc.
282
- * All rights reserved.
283
- * SPDX-License-Identifier: MIT
284
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
285
- */
286
- var nodeToAriaPropertyValuesMap = new WeakMap();
287
- function getAriaPropertyMap(elm) {
288
- var map = nodeToAriaPropertyValuesMap.get(elm);
289
- if (map === undefined) {
290
- map = {};
291
- nodeToAriaPropertyValuesMap.set(elm, map);
292
- }
293
- return map;
294
- }
295
- function getNormalizedAriaPropertyValue(value) {
296
- return value == null ? null : String(value);
297
- }
298
- function createAriaPropertyPropertyDescriptor(propName, attrName) {
299
- return {
300
- get: function () {
301
- var map = getAriaPropertyMap(this);
302
- if (hasOwnProperty.call(map, propName)) {
303
- return map[propName];
304
- } // otherwise just reflect what's in the attribute
305
- return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
306
- },
307
- set: function (newValue) {
308
- var normalizedValue = getNormalizedAriaPropertyValue(newValue);
309
- var map = getAriaPropertyMap(this);
310
- map[propName] = normalizedValue; // reflect into the corresponding attribute
311
- if (newValue === null) {
312
- this.removeAttribute(attrName);
313
- }
314
- else {
315
- this.setAttribute(attrName, newValue);
316
- }
317
- },
318
- configurable: true,
319
- enumerable: true
320
- };
321
- }
322
- function patch(propName) {
323
- // Typescript is inferring the wrong function type for this particular
324
- // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
325
- // @ts-ignore type-mismatch
326
- var attrName = AriaPropNameToAttrNameMap[propName];
327
- var descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);
328
- Object.defineProperty(Element.prototype, propName, descriptor);
329
- }
330
- /*
331
- * Copyright (c) 2018, salesforce.com, inc.
332
- * All rights reserved.
333
- * SPDX-License-Identifier: MIT
334
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
335
- */
336
- var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
337
- for (var i_2 = 0, len = ElementPrototypeAriaPropertyNames.length; i_2 < len; i_2 += 1) {
338
- var propName = ElementPrototypeAriaPropertyNames[i_2];
339
- if (detect$1(propName)) {
340
- patch(propName);
341
- }
342
- }
343
- /* proxy-compat-disable */
344
- /**
345
- * Copyright (C) 2018 salesforce.com, inc.
346
- */
347
- /*
348
- * Copyright (c) 2018, salesforce.com, 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
- function invariant$1(value, msg) {
354
- if (!value) {
355
- throw new Error("Invariant Violation: " + msg);
356
- }
357
- }
358
- function isTrue$1(value, msg) {
359
- if (!value) {
360
- throw new Error("Assert Violation: " + msg);
361
- }
362
- }
363
- function isFalse$2(value, msg) {
364
- if (value) {
365
- throw new Error("Assert Violation: " + msg);
366
- }
367
- }
368
- function fail$1(msg) {
369
- throw new Error(msg);
370
- }
371
- var assert$1 = /*#__PURE__*/ Object.freeze({
372
- __proto__: null,
373
- invariant: invariant$1,
374
- isTrue: isTrue$1,
375
- isFalse: isFalse$2,
376
- fail: fail$1
377
- });
378
- /*
379
- * Copyright (c) 2018, salesforce.com, 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
- var assign$1 = Object.assign, create$1 = Object.create, defineProperties$1 = Object.defineProperties, defineProperty$1 = Object.defineProperty, freeze$1 = Object.freeze, getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor, getOwnPropertyNames$1 = Object.getOwnPropertyNames, getPrototypeOf$1 = Object.getPrototypeOf, hasOwnProperty$1 = Object.hasOwnProperty, isFrozen$1 = Object.isFrozen, keys$1 = Object.keys, seal$1 = Object.seal, setPrototypeOf$1 = Object.setPrototypeOf;
385
- var isArray$2 = Array.isArray;
386
- var _f = Array.prototype, ArrayJoin$1 = _f.join, ArrayMap$1 = _f.map, ArrayPush$1 = _f.push, ArraySlice$2 = _f.slice, ArrayUnshift$2 = _f.unshift, forEach$1 = _f.forEach;
387
- var StringFromCharCode$1 = String.fromCharCode;
388
- var _g = String.prototype, StringCharCodeAt$1 = _g.charCodeAt, StringReplace$1 = _g.replace, StringSlice$1 = _g.slice, StringToLowerCase$1 = _g.toLowerCase;
389
- function isUndefined$1(obj) {
390
- return obj === undefined;
391
- }
392
- function isNull$1(obj) {
393
- return obj === null;
394
- }
395
- function isTrue$1$1(obj) {
396
- return obj === true;
397
- }
398
- function isFalse$1$1(obj) {
399
- return obj === false;
400
- }
401
- function isFunction$1(obj) {
402
- return typeof obj === 'function';
403
- }
404
- function isString(obj) {
405
- return typeof obj === 'string';
406
- }
407
- var OtS$1 = {}.toString;
408
- function toString$1(obj) {
409
- if (obj && obj.toString) {
410
- // Arrays might hold objects with "null" prototype So using
411
- // Array.prototype.toString directly will cause an error Iterate through
412
- // all the items and handle individually.
413
- if (isArray$2(obj)) {
414
- return ArrayJoin$1.call(ArrayMap$1.call(obj, toString$1), ',');
415
- }
416
- return obj.toString();
417
- }
418
- else if (typeof obj === 'object') {
419
- return OtS$1.call(obj);
420
- }
421
- else {
422
- return obj + '';
423
- }
424
- }
425
- function getPropertyDescriptor(o, p) {
426
- do {
427
- var d_1 = getOwnPropertyDescriptor$1(o, p);
428
- if (!isUndefined$1(d_1)) {
429
- return d_1;
430
- }
431
- o = getPrototypeOf$1(o);
432
- } while (o !== null);
433
- }
434
- /*
435
- * Copyright (c) 2018, salesforce.com, inc.
436
- * All rights reserved.
437
- * SPDX-License-Identifier: MIT
438
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
439
- */
440
- /**
441
- * According to the following list, there are 48 aria attributes of which two (ariaDropEffect and
442
- * ariaGrabbed) are deprecated:
443
- * https://www.w3.org/TR/wai-aria-1.1/#x6-6-definitions-of-states-and-properties-all-aria-attributes
444
- *
445
- * The above list of 46 aria attributes is consistent with the following resources:
446
- * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
447
- * https://wicg.github.io/aom/spec/aria-reflection.html
448
- */
449
- var AriaPropertyNames$1 = ['ariaActiveDescendant', 'ariaAtomic', 'ariaAutoComplete', 'ariaBusy', 'ariaChecked', 'ariaColCount', 'ariaColIndex', 'ariaColSpan', 'ariaControls', 'ariaCurrent', 'ariaDescribedBy', 'ariaDetails', 'ariaDisabled', 'ariaErrorMessage', 'ariaExpanded', 'ariaFlowTo', 'ariaHasPopup', 'ariaHidden', 'ariaInvalid', 'ariaKeyShortcuts', 'ariaLabel', 'ariaLabelledBy', 'ariaLevel', 'ariaLive', 'ariaModal', 'ariaMultiLine', 'ariaMultiSelectable', 'ariaOrientation', 'ariaOwns', 'ariaPlaceholder', 'ariaPosInSet', 'ariaPressed', 'ariaReadOnly', 'ariaRelevant', 'ariaRequired', 'ariaRoleDescription', 'ariaRowCount', 'ariaRowIndex', 'ariaRowSpan', 'ariaSelected', 'ariaSetSize', 'ariaSort', 'ariaValueMax', 'ariaValueMin', 'ariaValueNow', 'ariaValueText', 'role'];
450
- var _h = (function () {
451
- var AriaAttrNameToPropNameMap = create$1(null);
452
- var AriaPropNameToAttrNameMap = create$1(null); // Synthetic creation of all AOM property descriptors for Custom Elements
453
- forEach$1.call(AriaPropertyNames$1, function (propName) {
454
- var attrName = StringToLowerCase$1.call(StringReplace$1.call(propName, /^aria/, function () { return 'aria-'; }));
455
- AriaAttrNameToPropNameMap[attrName] = propName;
456
- AriaPropNameToAttrNameMap[propName] = attrName;
457
- });
458
- return {
459
- AriaAttrNameToPropNameMap: AriaAttrNameToPropNameMap,
460
- AriaPropNameToAttrNameMap: AriaPropNameToAttrNameMap
461
- };
462
- })(), AriaPropNameToAttrNameMap$1 = _h.AriaPropNameToAttrNameMap;
463
- /*
464
- * Copyright (c) 2018, salesforce.com, inc.
465
- * All rights reserved.
466
- * SPDX-License-Identifier: MIT
467
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
468
- */
469
- // We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
470
- // we can't use typeof since it will fail when transpiling.
471
- var hasNativeSymbolSupport$1 = /*@__PURE__*/ (function () { return Symbol('x').toString() === 'Symbol(x)'; })();
472
- /*
473
- * Copyright (c) 2018, salesforce.com, inc.
474
- * All rights reserved.
475
- * SPDX-License-Identifier: MIT
476
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
477
- */
478
- // This method abstracts the creation of symbols, so we can fallback to strings when native symbols
479
- // are not supported.
480
- function createHiddenField$1(key, namespace) {
481
- return hasNativeSymbolSupport$1 ? Symbol(key) : "$$lwc-" + namespace + "-" + key + "$$";
482
- }
483
- var hiddenFieldsMap$1 = new WeakMap();
484
- function setHiddenField$1(o, field, value) {
485
- var valuesByField = hiddenFieldsMap$1.get(o);
486
- if (isUndefined$1(valuesByField)) {
487
- valuesByField = create$1(null);
488
- hiddenFieldsMap$1.set(o, valuesByField);
489
- }
490
- valuesByField[field] = value;
491
- }
492
- function getHiddenField$1(o, field) {
493
- var valuesByField = hiddenFieldsMap$1.get(o);
494
- if (!isUndefined$1(valuesByField)) {
495
- return valuesByField[field];
496
- }
497
- }
498
- /**
499
- * Map composed of properties to attributes not following the HTML property to attribute mapping
500
- * convention.
501
- */
502
- var NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING$1 = new Map([['accessKey', 'accesskey'], ['readOnly', 'readonly'], ['tabIndex', 'tabindex'], ['bgColor', 'bgcolor'], ['colSpan', 'colspan'], ['rowSpan', 'rowspan'], ['contentEditable', 'contenteditable'], ['crossOrigin', 'crossorigin'], ['dateTime', 'datetime'], ['formAction', 'formaction'], ['isMap', 'ismap'], ['maxLength', 'maxlength'], ['minLength', 'minlength'], ['noValidate', 'novalidate'], ['useMap', 'usemap'], ['htmlFor', 'for']]);
503
- /**
504
- * Map associating previously transformed HTML property into HTML attribute.
505
- */
506
- var CACHED_PROPERTY_ATTRIBUTE_MAPPING$1 = new Map();
507
- function htmlPropertyToAttribute$1(propName) {
508
- var ariaAttributeName = AriaPropNameToAttrNameMap$1[propName];
509
- if (!isUndefined$1(ariaAttributeName)) {
510
- return ariaAttributeName;
511
- }
512
- var specialAttributeName = NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING$1.get(propName);
513
- if (!isUndefined$1(specialAttributeName)) {
514
- return specialAttributeName;
515
- }
516
- var cachedAttributeName = CACHED_PROPERTY_ATTRIBUTE_MAPPING$1.get(propName);
517
- if (!isUndefined$1(cachedAttributeName)) {
518
- return cachedAttributeName;
519
- }
520
- var attributeName = '';
521
- for (var i_3 = 0, len = propName.length; i_3 < len; i_3++) {
522
- var code = StringCharCodeAt$1.call(propName, i_3);
523
- if (code >= 65 && // "A"
524
- code <= 90 // "Z"
525
- ) {
526
- attributeName += '-' + StringFromCharCode$1(code + 32);
527
- }
528
- else {
529
- attributeName += StringFromCharCode$1(code);
530
- }
531
- }
532
- CACHED_PROPERTY_ATTRIBUTE_MAPPING$1.set(propName, attributeName);
533
- return attributeName;
534
- }
535
- /** version: 1.17.8 */
536
- /*
537
- * Copyright (c) 2018, salesforce.com, inc.
538
- * All rights reserved.
539
- * SPDX-License-Identifier: MIT
540
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
541
- */
542
- var nextTickCallbackQueue = [];
543
- var SPACE_CHAR = 32;
544
- var EmptyObject = seal$1(create$1(null));
545
- var EmptyArray = seal$1([]);
546
- function flushCallbackQueue() {
547
- var callbacks = nextTickCallbackQueue;
548
- nextTickCallbackQueue = []; // reset to a new queue
549
- for (var i_4 = 0, len = callbacks.length; i_4 < len; i_4 += 1) {
550
- callbacks[i_4]();
551
- }
552
- }
553
- function addCallbackToNextTick(callback) {
554
- if (nextTickCallbackQueue.length === 0) {
555
- Promise.resolve().then(flushCallbackQueue);
556
- }
557
- ArrayPush$1.call(nextTickCallbackQueue, callback);
558
- }
559
- function guid() {
560
- function s4() {
561
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
562
- }
563
- return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
564
- }
565
- /*
566
- * Copyright (c) 2019, salesforce.com, inc.
567
- * All rights reserved.
568
- * SPDX-License-Identifier: MIT
569
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
570
- */
571
- var create$1$1 = Object.create;
572
- var _j = Array.prototype, ArraySplice$1$1 = _j.splice, ArrayIndexOf$1$1 = _j.indexOf, ArrayPush$1$1 = _j.push;
573
- var TargetToReactiveRecordMap = new WeakMap();
574
- function isUndefined$1$1(obj) {
575
- return obj === undefined;
576
- }
577
- function getReactiveRecord(target) {
578
- var reactiveRecord = TargetToReactiveRecordMap.get(target);
579
- if (isUndefined$1$1(reactiveRecord)) {
580
- var newRecord = create$1$1(null);
581
- reactiveRecord = newRecord;
582
- TargetToReactiveRecordMap.set(target, newRecord);
583
- }
584
- return reactiveRecord;
585
- }
586
- var currentReactiveObserver = null;
587
- function valueMutated(target, key) {
588
- var reactiveRecord = TargetToReactiveRecordMap.get(target);
589
- if (!isUndefined$1$1(reactiveRecord)) {
590
- var reactiveObservers = reactiveRecord[key];
591
- if (!isUndefined$1$1(reactiveObservers)) {
592
- for (var i_5 = 0, len = reactiveObservers.length; i_5 < len; i_5 += 1) {
593
- var ro = reactiveObservers[i_5];
594
- ro.notify();
595
- }
596
- }
597
- }
598
- }
599
- function valueObserved(target, key) {
600
- // We should determine if an active Observing Record is present to track mutations.
601
- if (currentReactiveObserver === null) {
602
- return;
603
- }
604
- var ro = currentReactiveObserver;
605
- var reactiveRecord = getReactiveRecord(target);
606
- var reactiveObservers = reactiveRecord[key];
607
- if (isUndefined$1$1(reactiveObservers)) {
608
- reactiveObservers = [];
609
- reactiveRecord[key] = reactiveObservers;
610
- }
611
- else if (reactiveObservers[0] === ro) {
612
- return; // perf optimization considering that most subscriptions will come from the same record
613
- }
614
- if (ArrayIndexOf$1$1.call(reactiveObservers, ro) === -1) {
615
- ro.link(reactiveObservers);
616
- }
617
- }
618
- var ReactiveObserver = /** @class */ (function () {
619
- function ReactiveObserver(callback) {
620
- this.listeners = [];
621
- this.callback = callback;
622
- }
623
- ReactiveObserver.prototype.observe = function (job) {
624
- var inceptionReactiveRecord = currentReactiveObserver;
625
- currentReactiveObserver = this;
626
- var error;
627
- try {
628
- job();
629
- }
630
- catch (e) {
631
- error = Object(e);
632
- }
633
- finally {
634
- currentReactiveObserver = inceptionReactiveRecord;
635
- if (error !== undefined) {
636
- throw error; // eslint-disable-line no-unsafe-finally
637
- }
638
- }
639
- };
640
- /**
641
- * This method is responsible for disconnecting the Reactive Observer
642
- * from any Reactive Record that has a reference to it, to prevent future
643
- * notifications about previously recorded access.
644
- */
645
- ReactiveObserver.prototype.reset = function () {
646
- var listeners = this.listeners;
647
- var len = listeners.length;
648
- if (len > 0) {
649
- for (var i_6 = 0; i_6 < len; i_6 += 1) {
650
- var set = listeners[i_6];
651
- var pos = ArrayIndexOf$1$1.call(listeners[i_6], this);
652
- ArraySplice$1$1.call(set, pos, 1);
653
- }
654
- listeners.length = 0;
655
- }
656
- }; // friend methods
657
- ReactiveObserver.prototype.notify = function () {
658
- this.callback.call(undefined, this);
659
- };
660
- ReactiveObserver.prototype.link = function (reactiveObservers) {
661
- ArrayPush$1$1.call(reactiveObservers, this); // we keep track of observing records where the observing record was added to so we can do some clean up later on
662
- ArrayPush$1$1.call(this.listeners, reactiveObservers);
663
- };
664
- return ReactiveObserver;
665
- }());
666
- /*
667
- * Copyright (c) 2018, salesforce.com, inc.
668
- * All rights reserved.
669
- * SPDX-License-Identifier: MIT
670
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
671
- */
672
- function componentValueMutated(vm, key) {
673
- valueMutated(vm.component, key);
674
- }
675
- function componentValueObserved(vm, key) {
676
- valueObserved(vm.component, key);
677
- }
678
- /*
679
- * Copyright (c) 2018, salesforce.com, inc.
680
- * All rights reserved.
681
- * SPDX-License-Identifier: MIT
682
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
683
- */
684
- function getComponentTag(vm) {
685
- return "<" + StringToLowerCase$1.call(vm.tagName) + ">";
686
- } // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
687
- function getErrorComponentStack(vm) {
688
- var wcStack = [];
689
- var currentVm = vm;
690
- while (!isNull$1(currentVm)) {
691
- ArrayPush$1.call(wcStack, getComponentTag(currentVm));
692
- currentVm = currentVm.owner;
693
- }
694
- return wcStack.reverse().join('\n\t');
695
- }
696
- /*
697
- * Copyright (c) 2018, salesforce.com, inc.
698
- * All rights reserved.
699
- * SPDX-License-Identifier: MIT
700
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
701
- */
702
- function handleEvent(event, vnode) {
703
- var type = event.type;
704
- var on = vnode.data.on;
705
- var handler = on && on[type]; // call event handler if exists
706
- if (handler) {
707
- handler.call(undefined, event);
708
- }
709
- }
710
- function createListener() {
711
- return function handler(event) {
712
- handleEvent(event, handler.vnode);
713
- };
714
- }
715
- function updateAllEventListeners(oldVnode, vnode) {
716
- if (isUndefined$1(oldVnode.listener)) {
717
- createAllEventListeners(vnode);
718
- }
719
- else {
720
- vnode.listener = oldVnode.listener;
721
- vnode.listener.vnode = vnode;
722
- }
723
- }
724
- function createAllEventListeners(vnode) {
725
- var elm = vnode.elm, on = vnode.data.on, renderer = vnode.owner.renderer;
726
- if (isUndefined$1(on)) {
727
- return;
728
- }
729
- var listener = vnode.listener = createListener();
730
- listener.vnode = vnode;
731
- var name;
732
- for (name in on) {
733
- renderer.addEventListener(elm, name, listener);
734
- }
735
- }
736
- var modEvents = {
737
- update: updateAllEventListeners,
738
- create: createAllEventListeners
739
- };
740
- /*
741
- * Copyright (c) 2018, salesforce.com, inc.
742
- * All rights reserved.
743
- * SPDX-License-Identifier: MIT
744
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
745
- */
746
- var defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
747
- function offsetPropertyErrorMessage(name) {
748
- return "Using the `" + name + "` property is an anti-pattern because it rounds the value to an integer. Instead, use the `getBoundingClientRect` method to obtain fractional values for the size of an element and its position relative to the viewport.";
749
- } // Global HTML Attributes & Properties
750
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
751
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
752
- assign$1(create$1(null), {
753
- accessKey: {
754
- attribute: 'accesskey'
755
- },
756
- accessKeyLabel: {
757
- readOnly: true
758
- },
759
- className: {
760
- attribute: 'class',
761
- error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.'
762
- },
763
- contentEditable: {
764
- attribute: 'contenteditable'
765
- },
766
- dataset: {
767
- readOnly: true,
768
- error: "Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead."
769
- },
770
- dir: {
771
- attribute: 'dir'
772
- },
773
- draggable: {
774
- attribute: 'draggable'
775
- },
776
- dropzone: {
777
- attribute: 'dropzone',
778
- readOnly: true
779
- },
780
- hidden: {
781
- attribute: 'hidden'
782
- },
783
- id: {
784
- attribute: 'id'
785
- },
786
- inputMode: {
787
- attribute: 'inputmode'
788
- },
789
- lang: {
790
- attribute: 'lang'
791
- },
792
- slot: {
793
- attribute: 'slot',
794
- error: 'Using the `slot` property is an anti-pattern.'
795
- },
796
- spellcheck: {
797
- attribute: 'spellcheck'
798
- },
799
- style: {
800
- attribute: 'style'
801
- },
802
- tabIndex: {
803
- attribute: 'tabindex'
804
- },
805
- title: {
806
- attribute: 'title'
807
- },
808
- translate: {
809
- attribute: 'translate'
810
- },
811
- // additional "global attributes" that are not present in the link above.
812
- isContentEditable: {
813
- readOnly: true
814
- },
815
- offsetHeight: {
816
- readOnly: true,
817
- error: offsetPropertyErrorMessage('offsetHeight')
818
- },
819
- offsetLeft: {
820
- readOnly: true,
821
- error: offsetPropertyErrorMessage('offsetLeft')
822
- },
823
- offsetParent: {
824
- readOnly: true
825
- },
826
- offsetTop: {
827
- readOnly: true,
828
- error: offsetPropertyErrorMessage('offsetTop')
829
- },
830
- offsetWidth: {
831
- readOnly: true,
832
- error: offsetPropertyErrorMessage('offsetWidth')
833
- },
834
- role: {
835
- attribute: 'role'
836
- }
837
- });
838
- var controlledElement = null;
839
- var controlledAttributeName;
840
- function isAttributeLocked(elm, attrName) {
841
- return elm !== controlledElement || attrName !== controlledAttributeName;
842
- }
843
- function lockAttribute(_elm, _key) {
844
- controlledElement = null;
845
- controlledAttributeName = undefined;
846
- }
847
- function unlockAttribute(elm, key) {
848
- controlledElement = elm;
849
- controlledAttributeName = key;
850
- }
851
- /*
852
- * Copyright (c) 2018, salesforce.com, inc.
853
- * All rights reserved.
854
- * SPDX-License-Identifier: MIT
855
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
856
- */
857
- var xlinkNS = 'http://www.w3.org/1999/xlink';
858
- var xmlNS = 'http://www.w3.org/XML/1998/namespace';
859
- var ColonCharCode = 58;
860
- function updateAttrs(oldVnode, vnode) {
861
- var attrs = vnode.data.attrs, renderer = vnode.owner.renderer;
862
- if (isUndefined$1(attrs)) {
863
- return;
864
- }
865
- var oldAttrs = oldVnode.data.attrs;
866
- if (oldAttrs === attrs) {
867
- return;
868
- }
869
- var elm = vnode.elm;
870
- var setAttribute = renderer.setAttribute, removeAttribute = renderer.removeAttribute;
871
- var key;
872
- oldAttrs = isUndefined$1(oldAttrs) ? EmptyObject : oldAttrs; // update modified attributes, add new attributes
873
- // this routine is only useful for data-* attributes in all kind of elements
874
- // and aria-* in standard elements (custom elements will use props for these)
875
- for (key in attrs) {
876
- var cur = attrs[key];
877
- var old = oldAttrs[key];
878
- if (old !== cur) {
879
- unlockAttribute(elm, key);
880
- if (StringCharCodeAt$1.call(key, 3) === ColonCharCode) {
881
- // Assume xml namespace
882
- setAttribute(elm, key, cur, xmlNS);
883
- }
884
- else if (StringCharCodeAt$1.call(key, 5) === ColonCharCode) {
885
- // Assume xlink namespace
886
- setAttribute(elm, key, cur, xlinkNS);
887
- }
888
- else if (isNull$1(cur)) {
889
- removeAttribute(elm, key);
890
- }
891
- else {
892
- setAttribute(elm, key, cur);
893
- }
894
- lockAttribute();
895
- }
896
- }
897
- }
898
- var emptyVNode = {
899
- data: {}
900
- };
901
- var modAttrs = {
902
- create: function (vnode) { return updateAttrs(emptyVNode, vnode); },
903
- update: updateAttrs
904
- };
905
- /*
906
- * Copyright (c) 2018, salesforce.com, inc.
907
- * All rights reserved.
908
- * SPDX-License-Identifier: MIT
909
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
910
- */
911
- function isLiveBindingProp(sel, key) {
912
- // For properties with live bindings, we read values from the DOM element
913
- // instead of relying on internally tracked values.
914
- return sel === 'input' && (key === 'value' || key === 'checked');
915
- }
916
- function update(oldVnode, vnode) {
917
- var props = vnode.data.props;
918
- if (isUndefined$1(props)) {
919
- return;
920
- }
921
- var oldProps = oldVnode.data.props;
922
- if (oldProps === props) {
923
- return;
924
- }
925
- var isFirstPatch = isUndefined$1(oldProps);
926
- var elm = vnode.elm, sel = vnode.sel, renderer = vnode.owner.renderer;
927
- for (var key in props) {
928
- var cur = props[key]; // if it is the first time this element is patched, or the current value is different to the previous value...
929
- if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? renderer.getProperty(elm, key) : oldProps[key])) {
930
- renderer.setProperty(elm, key, cur);
931
- }
932
- }
933
- }
934
- var emptyVNode$1 = {
935
- data: {}
936
- };
937
- var modProps = {
938
- create: function (vnode) { return update(emptyVNode$1, vnode); },
939
- update: update
940
- };
941
- /*
942
- * Copyright (c) 2018, salesforce.com, inc.
943
- * All rights reserved.
944
- * SPDX-License-Identifier: MIT
945
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
946
- */
947
- var classNameToClassMap = create$1(null);
948
- function getMapFromClassName(className) {
949
- // Intentionally using == to match undefined and null values from computed style attribute
950
- if (className == null) {
951
- return EmptyObject;
952
- } // computed class names must be string
953
- className = isString(className) ? className : className + '';
954
- var map = classNameToClassMap[className];
955
- if (map) {
956
- return map;
957
- }
958
- map = create$1(null);
959
- var start = 0;
960
- var o;
961
- var len = className.length;
962
- for (o = 0; o < len; o++) {
963
- if (StringCharCodeAt$1.call(className, o) === SPACE_CHAR) {
964
- if (o > start) {
965
- map[StringSlice$1.call(className, start, o)] = true;
966
- }
967
- start = o + 1;
968
- }
969
- }
970
- if (o > start) {
971
- map[StringSlice$1.call(className, start, o)] = true;
972
- }
973
- classNameToClassMap[className] = map;
974
- return map;
975
- }
976
- function updateClassAttribute(oldVnode, vnode) {
977
- var elm = vnode.elm, newClass = vnode.data.className, renderer = vnode.owner.renderer;
978
- var oldClass = oldVnode.data.className;
979
- if (oldClass === newClass) {
980
- return;
981
- }
982
- var classList = renderer.getClassList(elm);
983
- var newClassMap = getMapFromClassName(newClass);
984
- var oldClassMap = getMapFromClassName(oldClass);
985
- var name;
986
- for (name in oldClassMap) {
987
- // remove only if it is not in the new class collection and it is not set from within the instance
988
- if (isUndefined$1(newClassMap[name])) {
989
- classList.remove(name);
990
- }
991
- }
992
- for (name in newClassMap) {
993
- if (isUndefined$1(oldClassMap[name])) {
994
- classList.add(name);
995
- }
996
- }
997
- }
998
- var emptyVNode$2 = {
999
- data: {}
1000
- };
1001
- var modComputedClassName = {
1002
- create: function (vnode) { return updateClassAttribute(emptyVNode$2, vnode); },
1003
- update: updateClassAttribute
1004
- };
1005
- /*
1006
- * Copyright (c) 2018, salesforce.com, inc.
1007
- * All rights reserved.
1008
- * SPDX-License-Identifier: MIT
1009
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1010
- */
1011
- function updateStyleAttribute(oldVnode, vnode) {
1012
- var elm = vnode.elm, newStyle = vnode.data.style, renderer = vnode.owner.renderer;
1013
- var setAttribute = renderer.setAttribute, removeAttribute = renderer.removeAttribute;
1014
- if (oldVnode.data.style === newStyle) {
1015
- return;
1016
- }
1017
- if (!isString(newStyle) || newStyle === '') {
1018
- removeAttribute(elm, 'style');
1019
- }
1020
- else {
1021
- setAttribute(elm, 'style', newStyle);
1022
- }
1023
- }
1024
- var emptyVNode$3 = {
1025
- data: {}
1026
- };
1027
- var modComputedStyle = {
1028
- create: function (vnode) { return updateStyleAttribute(emptyVNode$3, vnode); },
1029
- update: updateStyleAttribute
1030
- };
1031
- /*
1032
- * Copyright (c) 2018, salesforce.com, inc.
1033
- * All rights reserved.
1034
- * SPDX-License-Identifier: MIT
1035
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1036
- */
1037
- // The compiler takes care of transforming the inline classnames into an object. It's faster to set the
1038
- // different classnames properties individually instead of via a string.
1039
- function createClassAttribute(vnode) {
1040
- var elm = vnode.elm, classMap = vnode.data.classMap, renderer = vnode.owner.renderer;
1041
- if (isUndefined$1(classMap)) {
1042
- return;
1043
- }
1044
- var classList = renderer.getClassList(elm);
1045
- for (var name in classMap) {
1046
- classList.add(name);
1047
- }
1048
- }
1049
- var modStaticClassName = {
1050
- create: createClassAttribute
1051
- };
1052
- /*
1053
- * Copyright (c) 2018, salesforce.com, inc.
1054
- * All rights reserved.
1055
- * SPDX-License-Identifier: MIT
1056
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1057
- */
1058
- // The compiler takes care of transforming the inline style into an object. It's faster to set the
1059
- // different style properties individually instead of via a string.
1060
- function createStyleAttribute(vnode) {
1061
- var elm = vnode.elm, styleMap = vnode.data.styleMap, renderer = vnode.owner.renderer;
1062
- if (isUndefined$1(styleMap)) {
1063
- return;
1064
- }
1065
- for (var name in styleMap) {
1066
- renderer.setCSSStyleProperty(elm, name, styleMap[name]);
1067
- }
1068
- }
1069
- var modStaticStyle = {
1070
- create: createStyleAttribute
1071
- };
1072
- /*
1073
- * Copyright (c) 2018, salesforce.com, inc.
1074
- * All rights reserved.
1075
- * SPDX-License-Identifier: MIT
1076
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1077
- */
1078
- /**
1079
- @license
1080
- Copyright (c) 2015 Simon Friis Vindum.
1081
- This code may only be used under the MIT License found at
1082
- https://github.com/snabbdom/snabbdom/blob/master/LICENSE
1083
- Code distributed by Snabbdom as part of the Snabbdom project at
1084
- https://github.com/snabbdom/snabbdom/
1085
- */
1086
- function isUndef(s) {
1087
- return s === undefined;
1088
- }
1089
- function sameVnode(vnode1, vnode2) {
1090
- return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
1091
- }
1092
- function isVNode(vnode) {
1093
- return vnode != null;
1094
- }
1095
- function createKeyToOldIdx(children, beginIdx, endIdx) {
1096
- var map = {};
1097
- var j, key, ch; // TODO [#1637]: simplify this by assuming that all vnodes has keys
1098
- for (j = beginIdx; j <= endIdx; ++j) {
1099
- ch = children[j];
1100
- if (isVNode(ch)) {
1101
- key = ch.key;
1102
- if (key !== undefined) {
1103
- map[key] = j;
1104
- }
1105
- }
1106
- }
1107
- return map;
1108
- }
1109
- function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
1110
- for (; startIdx <= endIdx; ++startIdx) {
1111
- var ch = vnodes[startIdx];
1112
- if (isVNode(ch)) {
1113
- ch.hook.create(ch);
1114
- ch.hook.insert(ch, parentElm, before);
1115
- }
1116
- }
1117
- }
1118
- function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
1119
- for (; startIdx <= endIdx; ++startIdx) {
1120
- var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
1121
- if (isVNode(ch)) {
1122
- ch.hook.remove(ch, parentElm);
1123
- }
1124
- }
1125
- }
1126
- function updateDynamicChildren(parentElm, oldCh, newCh) {
1127
- var oldStartIdx = 0;
1128
- var newStartIdx = 0;
1129
- var oldEndIdx = oldCh.length - 1;
1130
- var oldStartVnode = oldCh[0];
1131
- var oldEndVnode = oldCh[oldEndIdx];
1132
- var newChEnd = newCh.length - 1;
1133
- var newEndIdx = newChEnd;
1134
- var newStartVnode = newCh[0];
1135
- var newEndVnode = newCh[newEndIdx];
1136
- var oldKeyToIdx;
1137
- var idxInOld;
1138
- var elmToMove;
1139
- var before;
1140
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1141
- if (!isVNode(oldStartVnode)) {
1142
- oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
1143
- }
1144
- else if (!isVNode(oldEndVnode)) {
1145
- oldEndVnode = oldCh[--oldEndIdx];
1146
- }
1147
- else if (!isVNode(newStartVnode)) {
1148
- newStartVnode = newCh[++newStartIdx];
1149
- }
1150
- else if (!isVNode(newEndVnode)) {
1151
- newEndVnode = newCh[--newEndIdx];
1152
- }
1153
- else if (sameVnode(oldStartVnode, newStartVnode)) {
1154
- patchVnode(oldStartVnode, newStartVnode);
1155
- oldStartVnode = oldCh[++oldStartIdx];
1156
- newStartVnode = newCh[++newStartIdx];
1157
- }
1158
- else if (sameVnode(oldEndVnode, newEndVnode)) {
1159
- patchVnode(oldEndVnode, newEndVnode);
1160
- oldEndVnode = oldCh[--oldEndIdx];
1161
- newEndVnode = newCh[--newEndIdx];
1162
- }
1163
- else if (sameVnode(oldStartVnode, newEndVnode)) {
1164
- // Vnode moved right
1165
- patchVnode(oldStartVnode, newEndVnode);
1166
- newEndVnode.hook.move(oldStartVnode, parentElm, oldEndVnode.owner.renderer.nextSibling(oldEndVnode.elm));
1167
- oldStartVnode = oldCh[++oldStartIdx];
1168
- newEndVnode = newCh[--newEndIdx];
1169
- }
1170
- else if (sameVnode(oldEndVnode, newStartVnode)) {
1171
- // Vnode moved left
1172
- patchVnode(oldEndVnode, newStartVnode);
1173
- newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
1174
- oldEndVnode = oldCh[--oldEndIdx];
1175
- newStartVnode = newCh[++newStartIdx];
1176
- }
1177
- else {
1178
- if (oldKeyToIdx === undefined) {
1179
- oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
1180
- }
1181
- idxInOld = oldKeyToIdx[newStartVnode.key];
1182
- if (isUndef(idxInOld)) {
1183
- // New element
1184
- newStartVnode.hook.create(newStartVnode);
1185
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
1186
- newStartVnode = newCh[++newStartIdx];
1187
- }
1188
- else {
1189
- elmToMove = oldCh[idxInOld];
1190
- if (isVNode(elmToMove)) {
1191
- if (elmToMove.sel !== newStartVnode.sel) {
1192
- // New element
1193
- newStartVnode.hook.create(newStartVnode);
1194
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
1195
- }
1196
- else {
1197
- patchVnode(elmToMove, newStartVnode);
1198
- oldCh[idxInOld] = undefined;
1199
- newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
1200
- }
1201
- }
1202
- newStartVnode = newCh[++newStartIdx];
1203
- }
1204
- }
1205
- }
1206
- if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
1207
- if (oldStartIdx > oldEndIdx) {
1208
- // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
1209
- // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
1210
- var i_7 = newEndIdx;
1211
- var n = void 0;
1212
- do {
1213
- n = newCh[++i_7];
1214
- } while (!isVNode(n) && i_7 < newChEnd);
1215
- before = isVNode(n) ? n.elm : null;
1216
- addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
1217
- }
1218
- else {
1219
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
1220
- }
1221
- }
1222
- }
1223
- function updateStaticChildren(parentElm, oldCh, newCh) {
1224
- var oldChLength = oldCh.length;
1225
- var newChLength = newCh.length;
1226
- if (oldChLength === 0) {
1227
- // the old list is empty, we can directly insert anything new
1228
- addVnodes(parentElm, null, newCh, 0, newChLength);
1229
- return;
1230
- }
1231
- if (newChLength === 0) {
1232
- // the old list is nonempty and the new list is empty so we can directly remove all old nodes
1233
- // this is the case in which the dynamic children of an if-directive should be removed
1234
- removeVnodes(parentElm, oldCh, 0, oldChLength);
1235
- return;
1236
- } // if the old list is not empty, the new list MUST have the same
1237
- // amount of nodes, that's why we call this static children
1238
- var referenceElm = null;
1239
- for (var i_8 = newChLength - 1; i_8 >= 0; i_8 -= 1) {
1240
- var vnode = newCh[i_8];
1241
- var oldVNode = oldCh[i_8];
1242
- if (vnode !== oldVNode) {
1243
- if (isVNode(oldVNode)) {
1244
- if (isVNode(vnode)) {
1245
- // both vnodes must be equivalent, and se just need to patch them
1246
- patchVnode(oldVNode, vnode);
1247
- referenceElm = vnode.elm;
1248
- }
1249
- else {
1250
- // removing the old vnode since the new one is null
1251
- oldVNode.hook.remove(oldVNode, parentElm);
1252
- }
1253
- }
1254
- else if (isVNode(vnode)) {
1255
- // this condition is unnecessary
1256
- vnode.hook.create(vnode); // insert the new node one since the old one is null
1257
- vnode.hook.insert(vnode, parentElm, referenceElm);
1258
- referenceElm = vnode.elm;
1259
- }
1260
- }
1261
- }
1262
- }
1263
- function patchVnode(oldVnode, vnode) {
1264
- if (oldVnode !== vnode) {
1265
- vnode.elm = oldVnode.elm;
1266
- vnode.hook.update(oldVnode, vnode);
1267
- }
1268
- }
1269
- /*
1270
- * Copyright (c) 2020, salesforce.com, inc.
1271
- * All rights reserved.
1272
- * SPDX-License-Identifier: MIT
1273
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1274
- */
1275
- // This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
1276
- // to inject at runtime.
1277
- var HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () { };
1278
- var HTMLElementPrototype = HTMLElementConstructor.prototype;
1279
- /*
1280
- * Copyright (c) 2018, salesforce.com, inc.
1281
- * All rights reserved.
1282
- * SPDX-License-Identifier: MIT
1283
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1284
- */
1285
- /**
1286
- * This is a descriptor map that contains
1287
- * all standard properties that a Custom Element can support (including AOM properties), which
1288
- * determines what kind of capabilities the Base HTML Element and
1289
- * Base Lightning Element should support.
1290
- */
1291
- var HTMLElementOriginalDescriptors = create$1(null);
1292
- forEach$1.call(keys$1(AriaPropNameToAttrNameMap$1), function (propName) {
1293
- // Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
1294
- // in IE11, some properties are on Element.prototype instead of HTMLElement, just to be sure.
1295
- var descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
1296
- if (!isUndefined$1(descriptor)) {
1297
- HTMLElementOriginalDescriptors[propName] = descriptor;
1298
- }
1299
- });
1300
- forEach$1.call(defaultDefHTMLPropertyNames, function (propName) {
1301
- // Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
1302
- // in IE11, id property is on Element.prototype instead of HTMLElement, and we suspect that more will fall into
1303
- // this category, so, better to be sure.
1304
- var descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
1305
- if (!isUndefined$1(descriptor)) {
1306
- HTMLElementOriginalDescriptors[propName] = descriptor;
1307
- }
1308
- });
1309
- /**
1310
- * Copyright (C) 2017 salesforce.com, inc.
1311
- */
1312
- var isArray$1$1 = Array.isArray;
1313
- var getPrototypeOf$1$1 = Object.getPrototypeOf, ObjectCreate = Object.create, ObjectDefineProperty = Object.defineProperty, isExtensible = Object.isExtensible, getOwnPropertyDescriptor$1$1 = Object.getOwnPropertyDescriptor, getOwnPropertyNames$1$1 = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols, preventExtensions = Object.preventExtensions, hasOwnProperty$1$1 = Object.hasOwnProperty;
1314
- var _k = Array.prototype, ArrayPush$2 = _k.push, ArrayConcat = _k.concat;
1315
- function isUndefined$2(obj) {
1316
- return obj === undefined;
1317
- }
1318
- function isFunction$1$1(obj) {
1319
- return typeof obj === 'function';
1320
- }
1321
- var proxyToValueMap = new WeakMap();
1322
- function registerProxy(proxy, value) {
1323
- proxyToValueMap.set(proxy, value);
1324
- }
1325
- var unwrap = function (replicaOrAny) { return proxyToValueMap.get(replicaOrAny) || replicaOrAny; };
1326
- var BaseProxyHandler = /** @class */ (function () {
1327
- function BaseProxyHandler(membrane, value) {
1328
- this.originalTarget = value;
1329
- this.membrane = membrane;
1330
- } // Shared utility methods
1331
- BaseProxyHandler.prototype.wrapDescriptor = function (descriptor) {
1332
- if (hasOwnProperty$1$1.call(descriptor, 'value')) {
1333
- descriptor.value = this.wrapValue(descriptor.value);
1334
- }
1335
- else {
1336
- var originalSet = descriptor.set, originalGet = descriptor.get;
1337
- if (!isUndefined$2(originalGet)) {
1338
- descriptor.get = this.wrapGetter(originalGet);
1339
- }
1340
- if (!isUndefined$2(originalSet)) {
1341
- descriptor.set = this.wrapSetter(originalSet);
1342
- }
1343
- }
1344
- return descriptor;
1345
- };
1346
- BaseProxyHandler.prototype.copyDescriptorIntoShadowTarget = function (shadowTarget, key) {
1347
- var originalTarget = this.originalTarget; // Note: a property might get defined multiple times in the shadowTarget
1348
- // but it will always be compatible with the previous descriptor
1349
- // to preserve the object invariants, which makes these lines safe.
1350
- var originalDescriptor = getOwnPropertyDescriptor$1$1(originalTarget, key);
1351
- if (!isUndefined$2(originalDescriptor)) {
1352
- var wrappedDesc = this.wrapDescriptor(originalDescriptor);
1353
- ObjectDefineProperty(shadowTarget, key, wrappedDesc);
1354
- }
1355
- };
1356
- BaseProxyHandler.prototype.lockShadowTarget = function (shadowTarget) {
1357
- var _this = this;
1358
- var originalTarget = this.originalTarget;
1359
- var targetKeys = ArrayConcat.call(getOwnPropertyNames$1$1(originalTarget), getOwnPropertySymbols(originalTarget));
1360
- targetKeys.forEach(function (key) {
1361
- _this.copyDescriptorIntoShadowTarget(shadowTarget, key);
1362
- });
1363
- var tagPropertyKey = this.membrane.tagPropertyKey;
1364
- if (!isUndefined$2(tagPropertyKey) && !hasOwnProperty$1$1.call(shadowTarget, tagPropertyKey)) {
1365
- ObjectDefineProperty(shadowTarget, tagPropertyKey, ObjectCreate(null));
1366
- }
1367
- preventExtensions(shadowTarget);
1368
- }; // Shared Traps
1369
- BaseProxyHandler.prototype.apply = function (shadowTarget, thisArg, argArray) {
1370
- /* No op */
1371
- };
1372
- BaseProxyHandler.prototype.construct = function (shadowTarget, argArray, newTarget) {
1373
- /* No op */
1374
- };
1375
- BaseProxyHandler.prototype.get = function (shadowTarget, key) {
1376
- var _b = this, originalTarget = _b.originalTarget, valueObserved = _b.membrane.valueObserved;
1377
- var value = originalTarget[key];
1378
- valueObserved(originalTarget, key);
1379
- return this.wrapValue(value);
1380
- };
1381
- BaseProxyHandler.prototype.has = function (shadowTarget, key) {
1382
- var _b = this, originalTarget = _b.originalTarget, _c = _b.membrane, tagPropertyKey = _c.tagPropertyKey, valueObserved = _c.valueObserved;
1383
- valueObserved(originalTarget, key); // since key is never going to be undefined, and tagPropertyKey might be undefined
1384
- // we can simply compare them as the second part of the condition.
1385
- return key in originalTarget || key === tagPropertyKey;
1386
- };
1387
- BaseProxyHandler.prototype.ownKeys = function (shadowTarget) {
1388
- var _b = this, originalTarget = _b.originalTarget, tagPropertyKey = _b.membrane.tagPropertyKey; // if the membrane tag key exists and it is not in the original target, we add it to the keys.
1389
- var keys = isUndefined$2(tagPropertyKey) || hasOwnProperty$1$1.call(originalTarget, tagPropertyKey) ? [] : [tagPropertyKey]; // small perf optimization using push instead of concat to avoid creating an extra array
1390
- ArrayPush$2.apply(keys, getOwnPropertyNames$1$1(originalTarget));
1391
- ArrayPush$2.apply(keys, getOwnPropertySymbols(originalTarget));
1392
- return keys;
1393
- };
1394
- BaseProxyHandler.prototype.isExtensible = function (shadowTarget) {
1395
- var originalTarget = this.originalTarget; // optimization to avoid attempting to lock down the shadowTarget multiple times
1396
- if (!isExtensible(shadowTarget)) {
1397
- return false; // was already locked down
1398
- }
1399
- if (!isExtensible(originalTarget)) {
1400
- this.lockShadowTarget(shadowTarget);
1401
- return false;
1402
- }
1403
- return true;
1404
- };
1405
- BaseProxyHandler.prototype.getPrototypeOf = function (shadowTarget) {
1406
- var originalTarget = this.originalTarget;
1407
- return getPrototypeOf$1$1(originalTarget);
1408
- };
1409
- BaseProxyHandler.prototype.getOwnPropertyDescriptor = function (shadowTarget, key) {
1410
- var _b = this, originalTarget = _b.originalTarget, _c = _b.membrane, valueObserved = _c.valueObserved, tagPropertyKey = _c.tagPropertyKey; // keys looked up via getOwnPropertyDescriptor need to be reactive
1411
- valueObserved(originalTarget, key);
1412
- var desc = getOwnPropertyDescriptor$1$1(originalTarget, key);
1413
- if (isUndefined$2(desc)) {
1414
- if (key !== tagPropertyKey) {
1415
- return undefined;
1416
- } // if the key is the membrane tag key, and is not in the original target,
1417
- // we produce a synthetic descriptor and install it on the shadow target
1418
- desc = {
1419
- value: undefined,
1420
- writable: false,
1421
- configurable: false,
1422
- enumerable: false
1423
- };
1424
- ObjectDefineProperty(shadowTarget, tagPropertyKey, desc);
1425
- return desc;
1426
- }
1427
- if (desc.configurable === false) {
1428
- // updating the descriptor to non-configurable on the shadow
1429
- this.copyDescriptorIntoShadowTarget(shadowTarget, key);
1430
- } // Note: by accessing the descriptor, the key is marked as observed
1431
- // but access to the value, setter or getter (if available) cannot observe
1432
- // mutations, just like regular methods, in which case we just do nothing.
1433
- return this.wrapDescriptor(desc);
1434
- };
1435
- return BaseProxyHandler;
1436
- }());
1437
- var getterMap = new WeakMap();
1438
- var setterMap = new WeakMap();
1439
- var reverseGetterMap = new WeakMap();
1440
- var reverseSetterMap = new WeakMap();
1441
- var ReactiveProxyHandler = /** @class */ (function (_super) {
1442
- __extends(ReactiveProxyHandler, _super);
1443
- function ReactiveProxyHandler() {
1444
- return _super !== null && _super.apply(this, arguments) || this;
1445
- }
1446
- ReactiveProxyHandler.prototype.wrapValue = function (value) {
1447
- return this.membrane.getProxy(value);
1448
- };
1449
- ReactiveProxyHandler.prototype.wrapGetter = function (originalGet) {
1450
- var wrappedGetter = getterMap.get(originalGet);
1451
- if (!isUndefined$2(wrappedGetter)) {
1452
- return wrappedGetter;
1453
- }
1454
- var handler = this;
1455
- var get = function () {
1456
- // invoking the original getter with the original target
1457
- return handler.wrapValue(originalGet.call(unwrap(this)));
1458
- };
1459
- getterMap.set(originalGet, get);
1460
- reverseGetterMap.set(get, originalGet);
1461
- return get;
1462
- };
1463
- ReactiveProxyHandler.prototype.wrapSetter = function (originalSet) {
1464
- var wrappedSetter = setterMap.get(originalSet);
1465
- if (!isUndefined$2(wrappedSetter)) {
1466
- return wrappedSetter;
1467
- }
1468
- var set = function (v) {
1469
- // invoking the original setter with the original target
1470
- originalSet.call(unwrap(this), unwrap(v));
1471
- };
1472
- setterMap.set(originalSet, set);
1473
- reverseSetterMap.set(set, originalSet);
1474
- return set;
1475
- };
1476
- ReactiveProxyHandler.prototype.unwrapDescriptor = function (descriptor) {
1477
- if (hasOwnProperty$1$1.call(descriptor, 'value')) {
1478
- // dealing with a data descriptor
1479
- descriptor.value = unwrap(descriptor.value);
1480
- }
1481
- else {
1482
- var set = descriptor.set, get = descriptor.get;
1483
- if (!isUndefined$2(get)) {
1484
- descriptor.get = this.unwrapGetter(get);
1485
- }
1486
- if (!isUndefined$2(set)) {
1487
- descriptor.set = this.unwrapSetter(set);
1488
- }
1489
- }
1490
- return descriptor;
1491
- };
1492
- ReactiveProxyHandler.prototype.unwrapGetter = function (redGet) {
1493
- var reverseGetter = reverseGetterMap.get(redGet);
1494
- if (!isUndefined$2(reverseGetter)) {
1495
- return reverseGetter;
1496
- }
1497
- var handler = this;
1498
- var get = function () {
1499
- // invoking the red getter with the proxy of this
1500
- return unwrap(redGet.call(handler.wrapValue(this)));
1501
- };
1502
- getterMap.set(get, redGet);
1503
- reverseGetterMap.set(redGet, get);
1504
- return get;
1505
- };
1506
- ReactiveProxyHandler.prototype.unwrapSetter = function (redSet) {
1507
- var reverseSetter = reverseSetterMap.get(redSet);
1508
- if (!isUndefined$2(reverseSetter)) {
1509
- return reverseSetter;
1510
- }
1511
- var handler = this;
1512
- var set = function (v) {
1513
- // invoking the red setter with the proxy of this
1514
- redSet.call(handler.wrapValue(this), handler.wrapValue(v));
1515
- };
1516
- setterMap.set(set, redSet);
1517
- reverseSetterMap.set(redSet, set);
1518
- return set;
1519
- };
1520
- ReactiveProxyHandler.prototype.set = function (shadowTarget, key, value) {
1521
- var _b = this, originalTarget = _b.originalTarget, valueMutated = _b.membrane.valueMutated;
1522
- var oldValue = originalTarget[key];
1523
- if (oldValue !== value) {
1524
- originalTarget[key] = value;
1525
- valueMutated(originalTarget, key);
1526
- }
1527
- else if (key === 'length' && isArray$1$1(originalTarget)) {
1528
- // fix for issue #236: push will add the new index, and by the time length
1529
- // is updated, the internal length is already equal to the new length value
1530
- // therefore, the oldValue is equal to the value. This is the forking logic
1531
- // to support this use case.
1532
- valueMutated(originalTarget, key);
1533
- }
1534
- return true;
1535
- };
1536
- ReactiveProxyHandler.prototype.deleteProperty = function (shadowTarget, key) {
1537
- var _b = this, originalTarget = _b.originalTarget, valueMutated = _b.membrane.valueMutated;
1538
- delete originalTarget[key];
1539
- valueMutated(originalTarget, key);
1540
- return true;
1541
- };
1542
- ReactiveProxyHandler.prototype.setPrototypeOf = function (shadowTarget, prototype) {
1543
- };
1544
- ReactiveProxyHandler.prototype.preventExtensions = function (shadowTarget) {
1545
- if (isExtensible(shadowTarget)) {
1546
- var originalTarget = this.originalTarget;
1547
- preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
1548
- // the preventExtension call, in which case we should not attempt to lock down
1549
- // the shadow target.
1550
- if (isExtensible(originalTarget)) {
1551
- return false;
1552
- }
1553
- this.lockShadowTarget(shadowTarget);
1554
- }
1555
- return true;
1556
- };
1557
- ReactiveProxyHandler.prototype.defineProperty = function (shadowTarget, key, descriptor) {
1558
- var _b = this, originalTarget = _b.originalTarget, _c = _b.membrane, valueMutated = _c.valueMutated, tagPropertyKey = _c.tagPropertyKey;
1559
- if (key === tagPropertyKey && !hasOwnProperty$1$1.call(originalTarget, key)) {
1560
- // To avoid leaking the membrane tag property into the original target, we must
1561
- // be sure that the original target doesn't have yet.
1562
- // NOTE: we do not return false here because Object.freeze and equivalent operations
1563
- // will attempt to set the descriptor to the same value, and expect no to throw. This
1564
- // is an small compromise for the sake of not having to diff the descriptors.
1565
- return true;
1566
- }
1567
- ObjectDefineProperty(originalTarget, key, this.unwrapDescriptor(descriptor)); // intentionally testing if false since it could be undefined as well
1568
- if (descriptor.configurable === false) {
1569
- this.copyDescriptorIntoShadowTarget(shadowTarget, key);
1570
- }
1571
- valueMutated(originalTarget, key);
1572
- return true;
1573
- };
1574
- return ReactiveProxyHandler;
1575
- }(BaseProxyHandler));
1576
- var getterMap$1 = new WeakMap();
1577
- var setterMap$1 = new WeakMap();
1578
- var ReadOnlyHandler = /** @class */ (function (_super) {
1579
- __extends(ReadOnlyHandler, _super);
1580
- function ReadOnlyHandler() {
1581
- return _super !== null && _super.apply(this, arguments) || this;
1582
- }
1583
- ReadOnlyHandler.prototype.wrapValue = function (value) {
1584
- return this.membrane.getReadOnlyProxy(value);
1585
- };
1586
- ReadOnlyHandler.prototype.wrapGetter = function (originalGet) {
1587
- var wrappedGetter = getterMap$1.get(originalGet);
1588
- if (!isUndefined$2(wrappedGetter)) {
1589
- return wrappedGetter;
1590
- }
1591
- var handler = this;
1592
- var get = function () {
1593
- // invoking the original getter with the original target
1594
- return handler.wrapValue(originalGet.call(unwrap(this)));
1595
- };
1596
- getterMap$1.set(originalGet, get);
1597
- return get;
1598
- };
1599
- ReadOnlyHandler.prototype.wrapSetter = function (originalSet) {
1600
- var wrappedSetter = setterMap$1.get(originalSet);
1601
- if (!isUndefined$2(wrappedSetter)) {
1602
- return wrappedSetter;
1603
- }
1604
- var set = function (v) {
1605
- };
1606
- setterMap$1.set(originalSet, set);
1607
- return set;
1608
- };
1609
- ReadOnlyHandler.prototype.set = function (shadowTarget, key, value) {
1610
- return false;
1611
- };
1612
- ReadOnlyHandler.prototype.deleteProperty = function (shadowTarget, key) {
1613
- return false;
1614
- };
1615
- ReadOnlyHandler.prototype.setPrototypeOf = function (shadowTarget, prototype) {
1616
- };
1617
- ReadOnlyHandler.prototype.preventExtensions = function (shadowTarget) {
1618
- return false;
1619
- };
1620
- ReadOnlyHandler.prototype.defineProperty = function (shadowTarget, key, descriptor) {
1621
- return false;
1622
- };
1623
- return ReadOnlyHandler;
1624
- }(BaseProxyHandler));
1625
- var ObjectDotPrototype = Object.prototype;
1626
- function defaultValueIsObservable(value) {
1627
- // intentionally checking for null
1628
- if (value === null) {
1629
- return false;
1630
- } // treat all non-object types, including undefined, as non-observable values
1631
- if (typeof value !== 'object') {
1632
- return false;
1633
- }
1634
- if (isArray$1$1(value)) {
1635
- return true;
1636
- }
1637
- var proto = getPrototypeOf$1$1(value);
1638
- return proto === ObjectDotPrototype || proto === null || getPrototypeOf$1$1(proto) === null;
1639
- }
1640
- var defaultValueObserved = function (obj, key) {
1641
- /* do nothing */
1642
- };
1643
- var defaultValueMutated = function (obj, key) {
1644
- /* do nothing */
1645
- };
1646
- var defaultValueDistortion = function (value) { return value; };
1647
- function createShadowTarget(value) {
1648
- return isArray$1$1(value) ? [] : {};
1649
- }
1650
- var ReactiveMembrane = /** @class */ (function () {
1651
- function ReactiveMembrane(options) {
1652
- this.valueDistortion = defaultValueDistortion;
1653
- this.valueMutated = defaultValueMutated;
1654
- this.valueObserved = defaultValueObserved;
1655
- this.valueIsObservable = defaultValueIsObservable;
1656
- this.objectGraph = new WeakMap();
1657
- if (!isUndefined$2(options)) {
1658
- var valueDistortion_1 = options.valueDistortion, valueMutated_1 = options.valueMutated, valueObserved_1 = options.valueObserved, valueIsObservable = options.valueIsObservable, tagPropertyKey = options.tagPropertyKey;
1659
- this.valueDistortion = isFunction$1$1(valueDistortion_1) ? valueDistortion_1 : defaultValueDistortion;
1660
- this.valueMutated = isFunction$1$1(valueMutated_1) ? valueMutated_1 : defaultValueMutated;
1661
- this.valueObserved = isFunction$1$1(valueObserved_1) ? valueObserved_1 : defaultValueObserved;
1662
- this.valueIsObservable = isFunction$1$1(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
1663
- this.tagPropertyKey = tagPropertyKey;
1664
- }
1665
- }
1666
- ReactiveMembrane.prototype.getProxy = function (value) {
1667
- var unwrappedValue = unwrap(value);
1668
- var distorted = this.valueDistortion(unwrappedValue);
1669
- if (this.valueIsObservable(distorted)) {
1670
- var o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
1671
- // we return the readonly.
1672
- return o.readOnly === value ? value : o.reactive;
1673
- }
1674
- return distorted;
1675
- };
1676
- ReactiveMembrane.prototype.getReadOnlyProxy = function (value) {
1677
- value = unwrap(value);
1678
- var distorted = this.valueDistortion(value);
1679
- if (this.valueIsObservable(distorted)) {
1680
- return this.getReactiveState(value, distorted).readOnly;
1681
- }
1682
- return distorted;
1683
- };
1684
- ReactiveMembrane.prototype.unwrapProxy = function (p) {
1685
- return unwrap(p);
1686
- };
1687
- ReactiveMembrane.prototype.getReactiveState = function (value, distortedValue) {
1688
- var objectGraph = this.objectGraph;
1689
- var reactiveState = objectGraph.get(distortedValue);
1690
- if (reactiveState) {
1691
- return reactiveState;
1692
- }
1693
- var membrane = this;
1694
- reactiveState = {
1695
- get reactive() {
1696
- var reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
1697
- var proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
1698
- registerProxy(proxy, value);
1699
- ObjectDefineProperty(this, 'reactive', {
1700
- value: proxy
1701
- });
1702
- return proxy;
1703
- },
1704
- get readOnly() {
1705
- var readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
1706
- var proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
1707
- registerProxy(proxy, value);
1708
- ObjectDefineProperty(this, 'readOnly', {
1709
- value: proxy
1710
- });
1711
- return proxy;
1712
- }
1713
- };
1714
- objectGraph.set(distortedValue, reactiveState);
1715
- return reactiveState;
1716
- };
1717
- return ReactiveMembrane;
1718
- }());
1719
- /** version: 1.0.0 */
1720
- /*
1721
- * Copyright (c) 2018, salesforce.com, inc.
1722
- * All rights reserved.
1723
- * SPDX-License-Identifier: MIT
1724
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1725
- */
1726
- var lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
1727
- function valueDistortion(value) {
1728
- return value;
1729
- }
1730
- var reactiveMembrane = new ReactiveMembrane({
1731
- valueObserved: valueObserved,
1732
- valueMutated: valueMutated,
1733
- valueDistortion: valueDistortion,
1734
- tagPropertyKey: lockerLivePropertyKey
1735
- });
1736
- /**
1737
- * EXPERIMENTAL: This function implements an unwrap mechanism that
1738
- * works for observable membrane objects. This API is subject to
1739
- * change or being removed.
1740
- */
1741
- var unwrap$1 = function (value) {
1742
- var unwrapped = reactiveMembrane.unwrapProxy(value);
1743
- if (unwrapped !== value) {
1744
- // if value is a proxy, unwrap to access original value and apply distortion
1745
- return valueDistortion(unwrapped);
1746
- }
1747
- return value;
1748
- };
1749
- /*
1750
- * Copyright (c) 2018, salesforce.com, inc.
1751
- * All rights reserved.
1752
- * SPDX-License-Identifier: MIT
1753
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1754
- */
1755
- /**
1756
- * This operation is called with a descriptor of an standard html property
1757
- * that a Custom Element can support (including AOM properties), which
1758
- * determines what kind of capabilities the Base Lightning Element should support. When producing the new descriptors
1759
- * for the Base Lightning Element, it also include the reactivity bit, so the standard property is reactive.
1760
- */
1761
- function createBridgeToElementDescriptor(propName, descriptor) {
1762
- var get = descriptor.get, set = descriptor.set, enumerable = descriptor.enumerable, configurable = descriptor.configurable;
1763
- if (!isFunction$1(get)) {
1764
- throw new TypeError();
1765
- }
1766
- if (!isFunction$1(set)) {
1767
- throw new TypeError();
1768
- }
1769
- return {
1770
- enumerable: enumerable,
1771
- configurable: configurable,
1772
- get: function () {
1773
- var vm = getAssociatedVM(this);
1774
- if (isBeingConstructed(vm)) {
1775
- return;
1776
- }
1777
- componentValueObserved(vm, propName);
1778
- return get.call(vm.elm);
1779
- },
1780
- set: function (newValue) {
1781
- var vm = getAssociatedVM(this);
1782
- if (newValue !== vm.cmpProps[propName]) {
1783
- vm.cmpProps[propName] = newValue;
1784
- componentValueMutated(vm, propName);
1785
- }
1786
- return set.call(vm.elm, newValue);
1787
- }
1788
- };
1789
- }
1790
- /**
1791
- * This class is the base class for any LWC element.
1792
- * Some elements directly extends this class, others implement it via inheritance.
1793
- **/
1794
- function BaseLightningElementConstructor() {
1795
- if (isNull$1(vmBeingConstructed)) {
1796
- throw new ReferenceError('Illegal constructor');
1797
- }
1798
- var vm = vmBeingConstructed;
1799
- var elm = vm.elm, mode = vm.mode, renderer = vm.renderer, _b = vm.def, ctor = _b.ctor, bridge = _b.bridge;
1800
- var component = this;
1801
- setPrototypeOf$1(elm, bridge.prototype);
1802
- var cmpRoot = renderer.attachShadow(elm, {
1803
- mode: mode,
1804
- delegatesFocus: !!ctor.delegatesFocus,
1805
- '$$lwc-synthetic-mode$$': true
1806
- });
1807
- vm.component = this;
1808
- vm.cmpRoot = cmpRoot; // Locker hooks assignment. When the LWC engine run with Locker, Locker intercepts all the new
1809
- // component creation and passes hooks to instrument all the component interactions with the
1810
- // engine. We are intentionally hiding this argument from the formal API of LightningElement
1811
- // because we don't want folks to know about it just yet.
1812
- if (arguments.length === 1) {
1813
- var _c = arguments[0], callHook_1 = _c.callHook, setHook_1 = _c.setHook, getHook_1 = _c.getHook;
1814
- vm.callHook = callHook_1;
1815
- vm.setHook = setHook_1;
1816
- vm.getHook = getHook_1;
1817
- } // Making the component instance a live value when using Locker to support expandos.
1818
- defineProperty$1(component, lockerLivePropertyKey, EmptyObject); // Linking elm, shadow root and component with the VM.
1819
- associateVM(component, vm);
1820
- associateVM(cmpRoot, vm);
1821
- associateVM(elm, vm); // Adding extra guard rails in DEV mode.
1822
- return this;
1823
- }
1824
- BaseLightningElementConstructor.prototype = {
1825
- constructor: BaseLightningElementConstructor,
1826
- dispatchEvent: function (event) {
1827
- var _b = getAssociatedVM(this), elm = _b.elm, dispatchEvent = _b.renderer.dispatchEvent;
1828
- return dispatchEvent(elm, event);
1829
- },
1830
- addEventListener: function (type, listener, options) {
1831
- var vm = getAssociatedVM(this);
1832
- var elm = vm.elm, addEventListener = vm.renderer.addEventListener;
1833
- var wrappedListener = getWrappedComponentsListener(vm, listener);
1834
- addEventListener(elm, type, wrappedListener, options);
1835
- },
1836
- removeEventListener: function (type, listener, options) {
1837
- var vm = getAssociatedVM(this);
1838
- var elm = vm.elm, removeEventListener = vm.renderer.removeEventListener;
1839
- var wrappedListener = getWrappedComponentsListener(vm, listener);
1840
- removeEventListener(elm, type, wrappedListener, options);
1841
- },
1842
- hasAttribute: function (name) {
1843
- var _b = getAssociatedVM(this), elm = _b.elm, getAttribute = _b.renderer.getAttribute;
1844
- return !isNull$1(getAttribute(elm, name));
1845
- },
1846
- hasAttributeNS: function (namespace, name) {
1847
- var _b = getAssociatedVM(this), elm = _b.elm, getAttribute = _b.renderer.getAttribute;
1848
- return !isNull$1(getAttribute(elm, name, namespace));
1849
- },
1850
- removeAttribute: function (name) {
1851
- var _b = getAssociatedVM(this), elm = _b.elm, removeAttribute = _b.renderer.removeAttribute;
1852
- unlockAttribute(elm, name);
1853
- removeAttribute(elm, name);
1854
- lockAttribute();
1855
- },
1856
- removeAttributeNS: function (namespace, name) {
1857
- var _b = getAssociatedVM(this), elm = _b.elm, removeAttribute = _b.renderer.removeAttribute;
1858
- unlockAttribute(elm, name);
1859
- removeAttribute(elm, name, namespace);
1860
- lockAttribute();
1861
- },
1862
- getAttribute: function (name) {
1863
- var _b = getAssociatedVM(this), elm = _b.elm, getAttribute = _b.renderer.getAttribute;
1864
- return getAttribute(elm, name);
1865
- },
1866
- getAttributeNS: function (namespace, name) {
1867
- var _b = getAssociatedVM(this), elm = _b.elm, getAttribute = _b.renderer.getAttribute;
1868
- return getAttribute(elm, name, namespace);
1869
- },
1870
- setAttribute: function (name, value) {
1871
- var vm = getAssociatedVM(this);
1872
- var elm = vm.elm, setAttribute = vm.renderer.setAttribute;
1873
- unlockAttribute(elm, name);
1874
- setAttribute(elm, name, value);
1875
- lockAttribute();
1876
- },
1877
- setAttributeNS: function (namespace, name, value) {
1878
- var vm = getAssociatedVM(this);
1879
- var elm = vm.elm, setAttribute = vm.renderer.setAttribute;
1880
- unlockAttribute(elm, name);
1881
- setAttribute(elm, name, value, namespace);
1882
- lockAttribute();
1883
- },
1884
- getBoundingClientRect: function () {
1885
- var vm = getAssociatedVM(this);
1886
- var elm = vm.elm, getBoundingClientRect = vm.renderer.getBoundingClientRect;
1887
- return getBoundingClientRect(elm);
1888
- },
1889
- querySelector: function (selectors) {
1890
- var vm = getAssociatedVM(this);
1891
- var elm = vm.elm, querySelector = vm.renderer.querySelector;
1892
- return querySelector(elm, selectors);
1893
- },
1894
- querySelectorAll: function (selectors) {
1895
- var vm = getAssociatedVM(this);
1896
- var elm = vm.elm, querySelectorAll = vm.renderer.querySelectorAll;
1897
- return querySelectorAll(elm, selectors);
1898
- },
1899
- getElementsByTagName: function (tagNameOrWildCard) {
1900
- var vm = getAssociatedVM(this);
1901
- var elm = vm.elm, getElementsByTagName = vm.renderer.getElementsByTagName;
1902
- return getElementsByTagName(elm, tagNameOrWildCard);
1903
- },
1904
- getElementsByClassName: function (names) {
1905
- var vm = getAssociatedVM(this);
1906
- var elm = vm.elm, getElementsByClassName = vm.renderer.getElementsByClassName;
1907
- return getElementsByClassName(elm, names);
1908
- },
1909
- get isConnected() {
1910
- var _b = getAssociatedVM(this), elm = _b.elm, isConnected = _b.renderer.isConnected;
1911
- return isConnected(elm);
1912
- },
1913
- get classList() {
1914
- var vm = getAssociatedVM(this);
1915
- var elm = vm.elm, getClassList = vm.renderer.getClassList;
1916
- return getClassList(elm);
1917
- },
1918
- get template() {
1919
- var vm = getAssociatedVM(this);
1920
- return vm.cmpRoot;
1921
- },
1922
- get shadowRoot() {
1923
- // From within the component instance, the shadowRoot is always reported as "closed".
1924
- // Authors should rely on this.template instead.
1925
- return null;
1926
- },
1927
- render: function () {
1928
- var vm = getAssociatedVM(this);
1929
- return vm.def.template;
1930
- },
1931
- toString: function () {
1932
- var vm = getAssociatedVM(this);
1933
- return "[object " + vm.def.name + "]";
1934
- }
1935
- };
1936
- var lightningBasedDescriptors = create$1(null);
1937
- for (var propName in HTMLElementOriginalDescriptors) {
1938
- lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
1939
- }
1940
- defineProperties$1(BaseLightningElementConstructor.prototype, lightningBasedDescriptors);
1941
- defineProperty$1(BaseLightningElementConstructor, 'CustomElementConstructor', {
1942
- get: function () {
1943
- // If required, a runtime-specific implementation must be defined.
1944
- throw new ReferenceError('The current runtime does not support CustomElementConstructor.');
1945
- },
1946
- configurable: true
1947
- });
1948
- var BaseLightningElement = BaseLightningElementConstructor;
1949
- /*
1950
- * Copyright (c) 2018, salesforce.com, inc.
1951
- * All rights reserved.
1952
- * SPDX-License-Identifier: MIT
1953
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1954
- */
1955
- /**
1956
- * @wire decorator to wire fields and methods to a wire adapter in
1957
- * LWC Components. This function implements the internals of this
1958
- * decorator.
1959
- */
1960
- function wire(_adapter, _config) {
1961
- throw new Error();
1962
- }
1963
- function internalWireFieldDecorator(key) {
1964
- return {
1965
- get: function () {
1966
- var vm = getAssociatedVM(this);
1967
- componentValueObserved(vm, key);
1968
- return vm.cmpFields[key];
1969
- },
1970
- set: function (value) {
1971
- var vm = getAssociatedVM(this);
1972
- /**
1973
- * Reactivity for wired fields is provided in wiring.
1974
- * We intentionally add reactivity here since this is just
1975
- * letting the author to do the wrong thing, but it will keep our
1976
- * system to be backward compatible.
1977
- */
1978
- if (value !== vm.cmpFields[key]) {
1979
- vm.cmpFields[key] = value;
1980
- componentValueMutated(vm, key);
1981
- }
1982
- },
1983
- enumerable: true,
1984
- configurable: true
1985
- };
1986
- }
1987
- /*
1988
- * Copyright (c) 2018, salesforce.com, inc.
1989
- * All rights reserved.
1990
- * SPDX-License-Identifier: MIT
1991
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1992
- */
1993
- function track(target) {
1994
- if (arguments.length === 1) {
1995
- return reactiveMembrane.getProxy(target);
1996
- }
1997
- throw new Error();
1998
- }
1999
- function internalTrackDecorator(key) {
2000
- return {
2001
- get: function () {
2002
- var vm = getAssociatedVM(this);
2003
- componentValueObserved(vm, key);
2004
- return vm.cmpFields[key];
2005
- },
2006
- set: function (newValue) {
2007
- var vm = getAssociatedVM(this);
2008
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2009
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2010
- vm.cmpFields[key] = reactiveOrAnyValue;
2011
- componentValueMutated(vm, key);
2012
- }
2013
- },
2014
- enumerable: true,
2015
- configurable: true
2016
- };
2017
- }
2018
- /**
2019
- * Copyright (C) 2018 salesforce.com, inc.
2020
- */
2021
- /**
2022
- * Copyright (C) 2018 salesforce.com, inc.
2023
- */
2024
- /*
2025
- * Copyright (c) 2018, salesforce.com, inc.
2026
- * All rights reserved.
2027
- * SPDX-License-Identifier: MIT
2028
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2029
- */
2030
- var create$2 = Object.create;
2031
- function isUndefined$3(obj) {
2032
- return obj === undefined;
2033
- }
2034
- function isTrue$1$1$1(obj) {
2035
- return obj === true;
2036
- }
2037
- function isFalse$1$1$1(obj) {
2038
- return obj === false;
2039
- }
2040
- /*
2041
- * Copyright (c) 2018, salesforce.com, inc.
2042
- * All rights reserved.
2043
- * SPDX-License-Identifier: MIT
2044
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2045
- */
2046
- // Inspired from: https://mathiasbynens.be/notes/globalthis
2047
- var _globalThis = /*@__PURE__*/ function () {
2048
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
2049
- if (typeof globalThis === 'object') {
2050
- return globalThis;
2051
- }
2052
- var _globalThis;
2053
- try {
2054
- // eslint-disable-next-line no-extend-native
2055
- Object.defineProperty(Object.prototype, '__magic__', {
2056
- get: function () {
2057
- return this;
2058
- },
2059
- configurable: true
2060
- }); // __magic__ is undefined in Safari 10 and IE10 and older.
2061
- // @ts-ignore
2062
- // eslint-disable-next-line no-undef
2063
- _globalThis = __magic__; // @ts-ignore
2064
- delete Object.prototype.__magic__;
2065
- }
2066
- catch (ex) { // In IE8, Object.defineProperty only works on DOM objects.
2067
- }
2068
- finally {
2069
- // If the magic above fails for some reason we assume that we are in a legacy browser.
2070
- // Assume `window` exists in this case.
2071
- if (typeof _globalThis === 'undefined') {
2072
- // @ts-ignore
2073
- _globalThis = window;
2074
- }
2075
- }
2076
- return _globalThis;
2077
- }();
2078
- /** version: 1.17.8 */
2079
- /*
2080
- * Copyright (c) 2018, salesforce.com, inc.
2081
- * All rights reserved.
2082
- * SPDX-License-Identifier: MIT
2083
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2084
- */
2085
- if (!_globalThis.lwcRuntimeFlags) {
2086
- Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
2087
- value: create$2(null)
2088
- });
2089
- }
2090
- var runtimeFlags = _globalThis.lwcRuntimeFlags; // This function is not supported for use within components and is meant for
2091
- // configuring runtime feature flags during app initialization.
2092
- function setFeatureFlag(name, value) {
2093
- var isBoolean = isTrue$1$1$1(value) || isFalse$1$1$1(value);
2094
- if (!isBoolean) {
2095
- var message = "Failed to set the value \"" + value + "\" for the runtime feature flag \"" + name + "\". Runtime feature flags can only be set to a boolean value.";
2096
- {
2097
- // eslint-disable-next-line no-console
2098
- console.error(message);
2099
- return;
2100
- }
2101
- }
2102
- if (isUndefined$3(featureFlagLookup[name])) {
2103
- // eslint-disable-next-line no-console
2104
- console.warn("Failed to set the value \"" + value + "\" for the runtime feature flag \"" + name + "\" because it is undefined. Possible reasons are that 1) it was misspelled or 2) it was removed from the @lwc/features package.");
2105
- return;
2106
- }
2107
- {
2108
- // Disallow the same flag to be set more than once in production
2109
- var runtimeValue = runtimeFlags[name];
2110
- if (!isUndefined$3(runtimeValue)) {
2111
- // eslint-disable-next-line no-console
2112
- console.error("Failed to set the value \"" + value + "\" for the runtime feature flag \"" + name + "\". \"" + name + "\" has already been set with the value \"" + runtimeValue + "\".");
2113
- return;
2114
- }
2115
- Object.defineProperty(runtimeFlags, name, {
2116
- value: value
2117
- });
2118
- }
2119
- } // This function is exposed to components to facilitate testing so we add a
2120
- // check to make sure it is not invoked in production.
2121
- function setFeatureFlagForTest(name, value) {
2122
- }
2123
- var featureFlagLookup = {
2124
- ENABLE_REACTIVE_SETTER: null,
2125
- ENABLE_HMR: null,
2126
- // Flag to toggle on/off the enforcement of innerText/outerText shadow dom semantic in elements when using synthetic shadow.
2127
- // Note: Once active, elements outside the lwc boundary are controlled by the ENABLE_ELEMENT_PATCH flag.
2128
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
2129
- // Flags to toggle on/off the enforcement of shadow dom semantic in element/node outside lwc boundary when using synthetic shadow.
2130
- ENABLE_ELEMENT_PATCH: null,
2131
- ENABLE_NODE_LIST_PATCH: null,
2132
- ENABLE_HTML_COLLECTIONS_PATCH: null,
2133
- ENABLE_NODE_PATCH: null
2134
- };
2135
- /** version: 1.17.8 */
2136
- /*
2137
- * Copyright (c) 2018, salesforce.com, inc.
2138
- * All rights reserved.
2139
- * SPDX-License-Identifier: MIT
2140
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2141
- */
2142
- function api() {
2143
- throw new Error();
2144
- }
2145
- function createPublicPropertyDescriptor(key) {
2146
- return {
2147
- get: function () {
2148
- var vm = getAssociatedVM(this);
2149
- if (isBeingConstructed(vm)) {
2150
- return;
2151
- }
2152
- componentValueObserved(vm, key);
2153
- return vm.cmpProps[key];
2154
- },
2155
- set: function (newValue) {
2156
- var vm = getAssociatedVM(this);
2157
- vm.cmpProps[key] = newValue;
2158
- componentValueMutated(vm, key);
2159
- },
2160
- enumerable: true,
2161
- configurable: true
2162
- };
2163
- }
2164
- var AccessorReactiveObserver = /** @class */ (function (_super) {
2165
- __extends(AccessorReactiveObserver, _super);
2166
- function AccessorReactiveObserver(vm, set) {
2167
- var _this = _super.call(this, function () {
2168
- if (isFalse$1$1(_this.debouncing)) {
2169
- _this.debouncing = true;
2170
- addCallbackToNextTick(function () {
2171
- if (isTrue$1$1(_this.debouncing)) {
2172
- var value = _this.value;
2173
- var dirtyStateBeforeSetterCall = vm.isDirty, component = vm.component, idx_1 = vm.idx;
2174
- set.call(component, value); // de-bouncing after the call to the original setter to prevent
2175
- // infinity loop if the setter itself is mutating things that
2176
- // were accessed during the previous invocation.
2177
- _this.debouncing = false;
2178
- if (isTrue$1$1(vm.isDirty) && isFalse$1$1(dirtyStateBeforeSetterCall) && idx_1 > 0) {
2179
- // immediate rehydration due to a setter driven mutation, otherwise
2180
- // the component will get rendered on the second tick, which it is not
2181
- // desirable.
2182
- rerenderVM(vm);
2183
- }
2184
- }
2185
- });
2186
- }
2187
- }) || this;
2188
- _this.debouncing = false;
2189
- return _this;
2190
- }
2191
- AccessorReactiveObserver.prototype.reset = function (value) {
2192
- _super.prototype.reset.call(this);
2193
- this.debouncing = false;
2194
- if (arguments.length > 0) {
2195
- this.value = value;
2196
- }
2197
- };
2198
- return AccessorReactiveObserver;
2199
- }(ReactiveObserver));
2200
- function createPublicAccessorDescriptor(key, descriptor) {
2201
- var get = descriptor.get, set = descriptor.set, enumerable = descriptor.enumerable, configurable = descriptor.configurable;
2202
- if (!isFunction$1(get)) {
2203
- throw new Error();
2204
- }
2205
- return {
2206
- get: function () {
2207
- return get.call(this);
2208
- },
2209
- set: function (newValue) {
2210
- var _this = this;
2211
- var vm = getAssociatedVM(this);
2212
- if (set) {
2213
- if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
2214
- var ro = vm.oar[key];
2215
- if (isUndefined$1(ro)) {
2216
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);
2217
- } // every time we invoke this setter from outside (through this wrapper setter)
2218
- // we should reset the value and then debounce just in case there is a pending
2219
- // invocation the next tick that is not longer relevant since the value is changing
2220
- // from outside.
2221
- ro.reset(newValue);
2222
- ro.observe(function () {
2223
- set.call(_this, newValue);
2224
- });
2225
- }
2226
- else {
2227
- set.call(this, newValue);
2228
- }
2229
- }
2230
- },
2231
- enumerable: enumerable,
2232
- configurable: configurable
2233
- };
2234
- }
2235
- function createObservedFieldPropertyDescriptor(key) {
2236
- return {
2237
- get: function () {
2238
- var vm = getAssociatedVM(this);
2239
- componentValueObserved(vm, key);
2240
- return vm.cmpFields[key];
2241
- },
2242
- set: function (newValue) {
2243
- var vm = getAssociatedVM(this);
2244
- if (newValue !== vm.cmpFields[key]) {
2245
- vm.cmpFields[key] = newValue;
2246
- componentValueMutated(vm, key);
2247
- }
2248
- },
2249
- enumerable: true,
2250
- configurable: true
2251
- };
2252
- }
2253
- /*
2254
- * Copyright (c) 2018, salesforce.com, inc.
2255
- * All rights reserved.
2256
- * SPDX-License-Identifier: MIT
2257
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2258
- */
2259
- var PropType;
2260
- (function (PropType) {
2261
- PropType[PropType["Field"] = 0] = "Field";
2262
- PropType[PropType["Set"] = 1] = "Set";
2263
- PropType[PropType["Get"] = 2] = "Get";
2264
- PropType[PropType["GetSet"] = 3] = "GetSet";
2265
- })(PropType || (PropType = {}));
2266
- /**
2267
- * INTERNAL: This function can only be invoked by compiled code. The compiler
2268
- * will prevent this function from being imported by user-land code.
2269
- */
2270
- function registerDecorators(Ctor, meta) {
2271
- var proto = Ctor.prototype;
2272
- var publicProps = meta.publicProps, publicMethods = meta.publicMethods, wire = meta.wire, track = meta.track, fields = meta.fields;
2273
- var apiMethods = create$1(null);
2274
- var apiFields = create$1(null);
2275
- var wiredMethods = create$1(null);
2276
- var wiredFields = create$1(null);
2277
- var observedFields = create$1(null);
2278
- var apiFieldsConfig = create$1(null);
2279
- var descriptor;
2280
- if (!isUndefined$1(publicProps)) {
2281
- for (var fieldName in publicProps) {
2282
- var propConfig = publicProps[fieldName];
2283
- apiFieldsConfig[fieldName] = propConfig.config;
2284
- descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2285
- if (propConfig.config > 0) {
2286
- if (isUndefined$1(descriptor)) {
2287
- throw new Error();
2288
- }
2289
- descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
2290
- }
2291
- else {
2292
- descriptor = createPublicPropertyDescriptor(fieldName);
2293
- }
2294
- apiFields[fieldName] = descriptor;
2295
- defineProperty$1(proto, fieldName, descriptor);
2296
- }
2297
- }
2298
- if (!isUndefined$1(publicMethods)) {
2299
- forEach$1.call(publicMethods, function (methodName) {
2300
- descriptor = getOwnPropertyDescriptor$1(proto, methodName);
2301
- if (isUndefined$1(descriptor)) {
2302
- throw new Error();
2303
- }
2304
- apiMethods[methodName] = descriptor;
2305
- });
2306
- }
2307
- if (!isUndefined$1(wire)) {
2308
- for (var fieldOrMethodName in wire) {
2309
- var _b = wire[fieldOrMethodName], adapter = _b.adapter, method = _b.method, configCallback = _b.config, _c = _b.dynamic, dynamic = _c === void 0 ? [] : _c;
2310
- descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
2311
- if (method === 1) {
2312
- if (isUndefined$1(descriptor)) {
2313
- throw new Error();
2314
- }
2315
- wiredMethods[fieldOrMethodName] = descriptor;
2316
- storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic);
2317
- }
2318
- else {
2319
- descriptor = internalWireFieldDecorator(fieldOrMethodName);
2320
- wiredFields[fieldOrMethodName] = descriptor;
2321
- storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic);
2322
- defineProperty$1(proto, fieldOrMethodName, descriptor);
2323
- }
2324
- }
2325
- }
2326
- if (!isUndefined$1(track)) {
2327
- for (var fieldName in track) {
2328
- descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2329
- descriptor = internalTrackDecorator(fieldName);
2330
- defineProperty$1(proto, fieldName, descriptor);
2331
- }
2332
- }
2333
- if (!isUndefined$1(fields)) {
2334
- for (var i_9 = 0, n = fields.length; i_9 < n; i_9++) {
2335
- var fieldName = fields[i_9];
2336
- descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2337
- observedFields[fieldName] = createObservedFieldPropertyDescriptor(fieldName);
2338
- }
2339
- }
2340
- setDecoratorsMeta(Ctor, {
2341
- apiMethods: apiMethods,
2342
- apiFields: apiFields,
2343
- apiFieldsConfig: apiFieldsConfig,
2344
- wiredMethods: wiredMethods,
2345
- wiredFields: wiredFields,
2346
- observedFields: observedFields
2347
- });
2348
- return Ctor;
2349
- }
2350
- var signedDecoratorToMetaMap = new Map();
2351
- function setDecoratorsMeta(Ctor, meta) {
2352
- signedDecoratorToMetaMap.set(Ctor, meta);
2353
- }
2354
- var defaultMeta = {
2355
- apiMethods: EmptyObject,
2356
- apiFields: EmptyObject,
2357
- apiFieldsConfig: EmptyObject,
2358
- wiredMethods: EmptyObject,
2359
- wiredFields: EmptyObject,
2360
- observedFields: EmptyObject
2361
- };
2362
- function getDecoratorsMeta(Ctor) {
2363
- var meta = signedDecoratorToMetaMap.get(Ctor);
2364
- return isUndefined$1(meta) ? defaultMeta : meta;
2365
- }
2366
- var signedTemplateSet = new Set();
2367
- function defaultEmptyTemplate() {
2368
- return [];
2369
- }
2370
- signedTemplateSet.add(defaultEmptyTemplate);
2371
- function isTemplateRegistered(tpl) {
2372
- return signedTemplateSet.has(tpl);
2373
- }
2374
- /**
2375
- * INTERNAL: This function can only be invoked by compiled code. The compiler
2376
- * will prevent this function from being imported by userland code.
2377
- */
2378
- function registerTemplate(tpl) {
2379
- signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
2380
- // assignment of templates easily, without too much transformation
2381
- return tpl;
2382
- }
2383
- /**
2384
- * EXPERIMENTAL: This function acts like a hook for Lightning Locker
2385
- * Service and other similar libraries to sanitize vulnerable attributes.
2386
- * This API is subject to change or being removed.
2387
- */
2388
- function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
2389
- // locker-service patches this function during runtime to sanitize vulnerable attributes.
2390
- // when ran off-core this function becomes a noop and returns the user authored value.
2391
- return attrValue;
2392
- }
2393
- /*
2394
- * Copyright (c) 2018, salesforce.com, inc.
2395
- * All rights reserved.
2396
- * SPDX-License-Identifier: MIT
2397
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2398
- */
2399
- // from the element instance, and get the value or set a new value on the component.
2400
- // This means that across different elements, similar names can get the exact same
2401
- // descriptor, so we can cache them:
2402
- var cachedGetterByKey = create$1(null);
2403
- var cachedSetterByKey = create$1(null);
2404
- function createGetter(key) {
2405
- var fn = cachedGetterByKey[key];
2406
- if (isUndefined$1(fn)) {
2407
- fn = cachedGetterByKey[key] = function () {
2408
- var vm = getAssociatedVM(this);
2409
- var getHook = vm.getHook;
2410
- return getHook(vm.component, key);
2411
- };
2412
- }
2413
- return fn;
2414
- }
2415
- function createSetter(key) {
2416
- var fn = cachedSetterByKey[key];
2417
- if (isUndefined$1(fn)) {
2418
- fn = cachedSetterByKey[key] = function (newValue) {
2419
- var vm = getAssociatedVM(this);
2420
- var setHook = vm.setHook;
2421
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2422
- setHook(vm.component, key, newValue);
2423
- };
2424
- }
2425
- return fn;
2426
- }
2427
- function createMethodCaller(methodName) {
2428
- return function () {
2429
- var vm = getAssociatedVM(this);
2430
- var callHook = vm.callHook, component = vm.component;
2431
- var fn = component[methodName];
2432
- return callHook(vm.component, fn, ArraySlice$2.call(arguments));
2433
- };
2434
- }
2435
- function createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback) {
2436
- return function attributeChangedCallback(attrName, oldValue, newValue) {
2437
- if (oldValue === newValue) {
2438
- // Ignore same values.
2439
- return;
2440
- }
2441
- var propName = attributeToPropMap[attrName];
2442
- if (isUndefined$1(propName)) {
2443
- if (!isUndefined$1(superAttributeChangedCallback)) {
2444
- // delegate unknown attributes to the super.
2445
- // Typescript does not like it when you treat the `arguments` object as an array
2446
- // @ts-ignore type-mismatch
2447
- superAttributeChangedCallback.apply(this, arguments);
2448
- }
2449
- return;
2450
- }
2451
- if (!isAttributeLocked(this, attrName)) {
2452
- // Ignore changes triggered by the engine itself during:
2453
- // * diffing when public props are attempting to reflect to the DOM
2454
- // * component via `this.setAttribute()`, should never update the prop
2455
- // Both cases, the setAttribute call is always wrapped by the unlocking of the
2456
- // attribute to be changed
2457
- return;
2458
- } // Reflect attribute change to the corresponding property when changed from outside.
2459
- this[propName] = newValue;
2460
- };
2461
- }
2462
- function HTMLBridgeElementFactory(SuperClass, props, methods) {
2463
- var HTMLBridgeElement;
2464
- /**
2465
- * Modern browsers will have all Native Constructors as regular Classes
2466
- * and must be instantiated with the new keyword. In older browsers,
2467
- * specifically IE11, those are objects with a prototype property defined,
2468
- * since they are not supposed to be extended or instantiated with the
2469
- * new keyword. This forking logic supports both cases, specifically because
2470
- * wc.ts relies on the construction path of the bridges to create new
2471
- * fully qualifying web components.
2472
- */
2473
- if (isFunction$1(SuperClass)) {
2474
- HTMLBridgeElement = /** @class */ (function (_super) {
2475
- __extends(HTMLBridgeElement, _super);
2476
- function HTMLBridgeElement() {
2477
- return _super !== null && _super.apply(this, arguments) || this;
2478
- }
2479
- return HTMLBridgeElement;
2480
- }(SuperClass));
2481
- }
2482
- else {
2483
- HTMLBridgeElement = function () {
2484
- // Bridge classes are not supposed to be instantiated directly in
2485
- // browsers that do not support web components.
2486
- throw new TypeError('Illegal constructor');
2487
- }; // prototype inheritance dance
2488
- setPrototypeOf$1(HTMLBridgeElement, SuperClass);
2489
- setPrototypeOf$1(HTMLBridgeElement.prototype, SuperClass.prototype);
2490
- defineProperty$1(HTMLBridgeElement.prototype, 'constructor', {
2491
- writable: true,
2492
- configurable: true,
2493
- value: HTMLBridgeElement
2494
- });
2495
- } // generating the hash table for attributes to avoid duplicate fields and facilitate validation
2496
- // and false positives in case of inheritance.
2497
- var attributeToPropMap = create$1(null);
2498
- var superAttributeChangedCallback = SuperClass.prototype.attributeChangedCallback;
2499
- var _b = SuperClass.observedAttributes, superObservedAttributes = _b === void 0 ? [] : _b;
2500
- var descriptors = create$1(null); // expose getters and setters for each public props on the new Element Bridge
2501
- for (var i_10 = 0, len = props.length; i_10 < len; i_10 += 1) {
2502
- var propName = props[i_10];
2503
- attributeToPropMap[htmlPropertyToAttribute$1(propName)] = propName;
2504
- descriptors[propName] = {
2505
- get: createGetter(propName),
2506
- set: createSetter(propName),
2507
- enumerable: true,
2508
- configurable: true
2509
- };
2510
- } // expose public methods as props on the new Element Bridge
2511
- for (var i_11 = 0, len = methods.length; i_11 < len; i_11 += 1) {
2512
- var methodName = methods[i_11];
2513
- descriptors[methodName] = {
2514
- value: createMethodCaller(methodName),
2515
- writable: true,
2516
- configurable: true
2517
- };
2518
- } // creating a new attributeChangedCallback per bridge because they are bound to the corresponding
2519
- // map of attributes to props. We do this after all other props and methods to avoid the possibility
2520
- // of getting overrule by a class declaration in user-land, and we make it non-writable, non-configurable
2521
- // to preserve this definition.
2522
- descriptors.attributeChangedCallback = {
2523
- value: createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback)
2524
- }; // Specify attributes for which we want to reflect changes back to their corresponding
2525
- // properties via attributeChangedCallback.
2526
- defineProperty$1(HTMLBridgeElement, 'observedAttributes', {
2527
- get: function () {
2528
- return __spreadArrays(superObservedAttributes, keys$1(attributeToPropMap));
2529
- }
2530
- });
2531
- defineProperties$1(HTMLBridgeElement.prototype, descriptors);
2532
- return HTMLBridgeElement;
2533
- }
2534
- var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2535
- freeze$1(BaseBridgeElement);
2536
- seal$1(BaseBridgeElement.prototype);
2537
- /*
2538
- * Copyright (c) 2020, salesforce.com, inc.
2539
- * All rights reserved.
2540
- * SPDX-License-Identifier: MIT
2541
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2542
- */
2543
- function resolveCircularModuleDependency(fn) {
2544
- return fn();
2545
- }
2546
- function isCircularModuleDependency(obj) {
2547
- return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
2548
- }
2549
- function setActiveVM(vm) {
2550
- {
2551
- // this method should never leak to prod
2552
- throw new ReferenceError();
2553
- }
2554
- }
2555
- function swapTemplate(oldTpl, newTpl) {
2556
- if (!runtimeFlags.ENABLE_HMR) {
2557
- throw new Error('HMR is not enabled');
2558
- }
2559
- return false;
2560
- }
2561
- function swapComponent(oldComponent, newComponent) {
2562
- if (!runtimeFlags.ENABLE_HMR) {
2563
- throw new Error('HMR is not enabled');
2564
- }
2565
- return false;
2566
- }
2567
- function swapStyle(oldStyle, newStyle) {
2568
- if (!runtimeFlags.ENABLE_HMR) {
2569
- throw new Error('HMR is not enabled');
2570
- }
2571
- return false;
2572
- }
2573
- /*
2574
- * Copyright (c) 2018, salesforce.com, inc.
2575
- * All rights reserved.
2576
- * SPDX-License-Identifier: MIT
2577
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2578
- */
2579
- var CtorToDefMap = new WeakMap();
2580
- function getCtorProto(Ctor) {
2581
- var proto = getPrototypeOf$1(Ctor);
2582
- if (isNull$1(proto)) {
2583
- throw new ReferenceError("Invalid prototype chain for " + Ctor.name + ", you must extend LightningElement.");
2584
- } // covering the cases where the ref is circular in AMD
2585
- if (isCircularModuleDependency(proto)) {
2586
- var p = resolveCircularModuleDependency(proto);
2587
- // of our Base class without having to leak it to user-land. If the circular function returns
2588
- // itself, that's the signal that we have hit the end of the proto chain, which must always
2589
- // be base.
2590
- proto = p === proto ? BaseLightningElement : p;
2591
- }
2592
- return proto;
2593
- }
2594
- function createComponentDef(Ctor) {
2595
- var decoratorsMeta = getDecoratorsMeta(Ctor);
2596
- var apiFields = decoratorsMeta.apiFields, apiFieldsConfig = decoratorsMeta.apiFieldsConfig, apiMethods = decoratorsMeta.apiMethods, wiredFields = decoratorsMeta.wiredFields, wiredMethods = decoratorsMeta.wiredMethods, observedFields = decoratorsMeta.observedFields;
2597
- var proto = Ctor.prototype;
2598
- var connectedCallback = proto.connectedCallback, disconnectedCallback = proto.disconnectedCallback, renderedCallback = proto.renderedCallback, errorCallback = proto.errorCallback, render = proto.render;
2599
- var superProto = getCtorProto(Ctor);
2600
- var superDef = superProto !== BaseLightningElement ? getComponentInternalDef(superProto) : lightingElementDef;
2601
- var bridge = HTMLBridgeElementFactory(superDef.bridge, keys$1(apiFields), keys$1(apiMethods));
2602
- var props = assign$1(create$1(null), superDef.props, apiFields);
2603
- var propsConfig = assign$1(create$1(null), superDef.propsConfig, apiFieldsConfig);
2604
- var methods = assign$1(create$1(null), superDef.methods, apiMethods);
2605
- var wire = assign$1(create$1(null), superDef.wire, wiredFields, wiredMethods);
2606
- connectedCallback = connectedCallback || superDef.connectedCallback;
2607
- disconnectedCallback = disconnectedCallback || superDef.disconnectedCallback;
2608
- renderedCallback = renderedCallback || superDef.renderedCallback;
2609
- errorCallback = errorCallback || superDef.errorCallback;
2610
- render = render || superDef.render;
2611
- var template = getComponentRegisteredTemplate(Ctor) || superDef.template;
2612
- var name = Ctor.name || superDef.name; // installing observed fields into the prototype.
2613
- defineProperties$1(proto, observedFields);
2614
- var def = {
2615
- ctor: Ctor,
2616
- name: name,
2617
- wire: wire,
2618
- props: props,
2619
- propsConfig: propsConfig,
2620
- methods: methods,
2621
- bridge: bridge,
2622
- template: template,
2623
- connectedCallback: connectedCallback,
2624
- disconnectedCallback: disconnectedCallback,
2625
- renderedCallback: renderedCallback,
2626
- errorCallback: errorCallback,
2627
- render: render
2628
- };
2629
- return def;
2630
- }
2631
- /**
2632
- * EXPERIMENTAL: This function allows for the identification of LWC constructors. This API is
2633
- * subject to change or being removed.
2634
- */
2635
- function isComponentConstructor(ctor) {
2636
- if (!isFunction$1(ctor)) {
2637
- return false;
2638
- } // Fast path: LightningElement is part of the prototype chain of the constructor.
2639
- if (ctor.prototype instanceof BaseLightningElement) {
2640
- return true;
2641
- } // Slow path: LightningElement is not part of the prototype chain of the constructor, we need
2642
- // climb up the constructor prototype chain to check in case there are circular dependencies
2643
- // to resolve.
2644
- var current = ctor;
2645
- do {
2646
- if (isCircularModuleDependency(current)) {
2647
- var circularResolved = resolveCircularModuleDependency(current); // If the circular function returns itself, that's the signal that we have hit the end
2648
- // of the proto chain, which must always be a valid base constructor.
2649
- if (circularResolved === current) {
2650
- return true;
2651
- }
2652
- current = circularResolved;
2653
- }
2654
- if (current === BaseLightningElement) {
2655
- return true;
2656
- }
2657
- } while (!isNull$1(current) && (current = getPrototypeOf$1(current))); // Finally return false if the LightningElement is not part of the prototype chain.
2658
- return false;
2659
- }
2660
- function getComponentInternalDef(Ctor) {
2661
- var def = CtorToDefMap.get(Ctor);
2662
- if (isUndefined$1(def)) {
2663
- if (isCircularModuleDependency(Ctor)) {
2664
- var resolvedCtor = resolveCircularModuleDependency(Ctor);
2665
- def = getComponentInternalDef(resolvedCtor); // Cache the unresolved component ctor too. The next time if the same unresolved ctor is used,
2666
- // look up the definition in cache instead of re-resolving and recreating the def.
2667
- CtorToDefMap.set(Ctor, def);
2668
- return def;
2669
- }
2670
- if (!isComponentConstructor(Ctor)) {
2671
- throw new TypeError(Ctor + " is not a valid component, or does not extends LightningElement from \"lwc\". You probably forgot to add the extend clause on the class declaration.");
2672
- }
2673
- def = createComponentDef(Ctor);
2674
- CtorToDefMap.set(Ctor, def);
2675
- }
2676
- return def;
2677
- }
2678
- var lightingElementDef = {
2679
- ctor: BaseLightningElement,
2680
- name: BaseLightningElement.name,
2681
- props: lightningBasedDescriptors,
2682
- propsConfig: EmptyObject,
2683
- methods: EmptyObject,
2684
- wire: EmptyObject,
2685
- bridge: BaseBridgeElement,
2686
- template: defaultEmptyTemplate,
2687
- render: BaseLightningElement.prototype.render
2688
- };
2689
- var PropDefType;
2690
- (function (PropDefType) {
2691
- PropDefType["any"] = "any";
2692
- })(PropDefType || (PropDefType = {}));
2693
- /**
2694
- * EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
2695
- * subject to change or being removed.
2696
- */
2697
- function getComponentDef(Ctor) {
2698
- var def = getComponentInternalDef(Ctor); // From the internal def object, we need to extract the info that is useful
2699
- // for some external services, e.g.: Locker Service, usually, all they care
2700
- // is about the shape of the constructor, the internals of it are not relevant
2701
- // because they don't have a way to mess with that.
2702
- var ctor = def.ctor, name = def.name, props = def.props, propsConfig = def.propsConfig, methods = def.methods;
2703
- var publicProps = {};
2704
- for (var key in props) {
2705
- // avoid leaking the reference to the public props descriptors
2706
- publicProps[key] = {
2707
- config: propsConfig[key] || 0,
2708
- type: PropDefType.any,
2709
- attr: htmlPropertyToAttribute$1(key)
2710
- };
2711
- }
2712
- var publicMethods = {};
2713
- for (var key in methods) {
2714
- // avoid leaking the reference to the public method descriptors
2715
- publicMethods[key] = methods[key].value;
2716
- }
2717
- return {
2718
- ctor: ctor,
2719
- name: name,
2720
- props: publicProps,
2721
- methods: publicMethods
2722
- };
2723
- }
2724
- /*
2725
- * Copyright (c) 2018, salesforce.com, inc.
2726
- * All rights reserved.
2727
- * SPDX-License-Identifier: MIT
2728
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2729
- */
2730
- var noop = function () { return void 0; };
2731
- function observeElementChildNodes(elm) {
2732
- elm.$domManual$ = true;
2733
- }
2734
- function setElementShadowToken(elm, token) {
2735
- elm.$shadowToken$ = token;
2736
- }
2737
- function updateNodeHook(oldVnode, vnode) {
2738
- var elm = vnode.elm, text = vnode.text, renderer = vnode.owner.renderer;
2739
- if (oldVnode.text !== text) {
2740
- renderer.setText(elm, text);
2741
- }
2742
- }
2743
- function insertNodeHook(vnode, parentNode, referenceNode) {
2744
- var renderer = vnode.owner.renderer;
2745
- renderer.insert(vnode.elm, parentNode, referenceNode);
2746
- }
2747
- function removeNodeHook(vnode, parentNode) {
2748
- var renderer = vnode.owner.renderer;
2749
- renderer.remove(vnode.elm, parentNode);
2750
- }
2751
- function createElmHook(vnode) {
2752
- modEvents.create(vnode); // Attrs need to be applied to element before props
2753
- // IE11 will wipe out value on radio inputs if value
2754
- // is set before type=radio.
2755
- modAttrs.create(vnode);
2756
- modProps.create(vnode);
2757
- modStaticClassName.create(vnode);
2758
- modStaticStyle.create(vnode);
2759
- modComputedClassName.create(vnode);
2760
- modComputedStyle.create(vnode);
2761
- }
2762
- var LWCDOMMode;
2763
- (function (LWCDOMMode) {
2764
- LWCDOMMode["manual"] = "manual";
2765
- })(LWCDOMMode || (LWCDOMMode = {}));
2766
- function fallbackElmHook(elm, vnode) {
2767
- var owner = vnode.owner;
2768
- if (isTrue$1$1(owner.renderer.syntheticShadow)) {
2769
- var context = vnode.data.context;
2770
- var shadowAttribute = owner.context.shadowAttribute;
2771
- if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === LWCDOMMode.manual) {
2772
- // this element will now accept any manual content inserted into it
2773
- observeElementChildNodes(elm);
2774
- } // when running in synthetic shadow mode, we need to set the shadowToken value
2775
- // into each element from the template, so they can be styled accordingly.
2776
- setElementShadowToken(elm, shadowAttribute);
2777
- }
2778
- var context;
2779
- }
2780
- function updateElmHook(oldVnode, vnode) {
2781
- // Attrs need to be applied to element before props
2782
- // IE11 will wipe out value on radio inputs if value
2783
- // is set before type=radio.
2784
- modAttrs.update(oldVnode, vnode);
2785
- modProps.update(oldVnode, vnode);
2786
- modComputedClassName.update(oldVnode, vnode);
2787
- modComputedStyle.update(oldVnode, vnode);
2788
- }
2789
- function updateChildrenHook(oldVnode, vnode) {
2790
- var children = vnode.children, owner = vnode.owner;
2791
- var fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
2792
- runWithBoundaryProtection(owner, owner.owner, noop, function () {
2793
- fn(vnode.elm, oldVnode.children, children);
2794
- }, noop);
2795
- }
2796
- function allocateChildrenHook(vnode, vm) {
2797
- // A component with slots will re-render because:
2798
- // 1- There is a change of the internal state.
2799
- // 2- There is a change on the external api (ex: slots)
2800
- //
2801
- // In case #1, the vnodes in the cmpSlots will be reused since they didn't changed. This routine emptied the
2802
- // slotted children when those VCustomElement were rendered and therefore in subsequent calls to allocate children
2803
- // in a reused VCustomElement, there won't be any slotted children.
2804
- // For those cases, we will use the reference for allocated children stored when rendering the fresh VCustomElement.
2805
- //
2806
- // In case #2, we will always get a fresh VCustomElement.
2807
- var children = vnode.aChildren || vnode.children;
2808
- vm.aChildren = children;
2809
- if (isTrue$1$1(vm.renderer.syntheticShadow)) {
2810
- // slow path
2811
- allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
2812
- vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
2813
- vnode.children = EmptyArray;
2814
- }
2815
- }
2816
- function createViewModelHook(elm, vnode) {
2817
- if (!isUndefined$1(getAssociatedVMIfPresent(elm))) {
2818
- // There is a possibility that a custom element is registered under tagName,
2819
- // in which case, the initialization is already carry on, and there is nothing else
2820
- // to do here since this hook is called right after invoking `document.createElement`.
2821
- return;
2822
- }
2823
- var sel = vnode.sel, mode = vnode.mode, ctor = vnode.ctor, owner = vnode.owner;
2824
- var def = getComponentInternalDef(ctor);
2825
- if (isTrue$1$1(owner.renderer.syntheticShadow)) {
2826
- var shadowAttribute = owner.context.shadowAttribute; // when running in synthetic shadow mode, we need to set the shadowToken value
2827
- // into each element from the template, so they can be styled accordingly.
2828
- setElementShadowToken(elm, shadowAttribute);
2829
- }
2830
- createVM(elm, def, {
2831
- mode: mode,
2832
- owner: owner,
2833
- tagName: sel,
2834
- renderer: owner.renderer
2835
- });
2836
- }
2837
- function createCustomElmHook(vnode) {
2838
- modEvents.create(vnode); // Attrs need to be applied to element before props
2839
- // IE11 will wipe out value on radio inputs if value
2840
- // is set before type=radio.
2841
- modAttrs.create(vnode);
2842
- modProps.create(vnode);
2843
- modStaticClassName.create(vnode);
2844
- modStaticStyle.create(vnode);
2845
- modComputedClassName.create(vnode);
2846
- modComputedStyle.create(vnode);
2847
- }
2848
- function createChildrenHook(vnode) {
2849
- var elm = vnode.elm, children = vnode.children;
2850
- for (var j = 0; j < children.length; ++j) {
2851
- var ch = children[j];
2852
- if (ch != null) {
2853
- ch.hook.create(ch);
2854
- ch.hook.insert(ch, elm, null);
2855
- }
2856
- }
2857
- }
2858
- function updateCustomElmHook(oldVnode, vnode) {
2859
- // Attrs need to be applied to element before props
2860
- // IE11 will wipe out value on radio inputs if value
2861
- // is set before type=radio.
2862
- modAttrs.update(oldVnode, vnode);
2863
- modProps.update(oldVnode, vnode);
2864
- modComputedClassName.update(oldVnode, vnode);
2865
- modComputedStyle.update(oldVnode, vnode);
2866
- }
2867
- function removeElmHook(vnode) {
2868
- // this method only needs to search on child vnodes from template
2869
- // to trigger the remove hook just in case some of those children
2870
- // are custom elements.
2871
- var children = vnode.children, elm = vnode.elm;
2872
- for (var j = 0, len = children.length; j < len; ++j) {
2873
- var ch = children[j];
2874
- if (!isNull$1(ch)) {
2875
- ch.hook.remove(ch, elm);
2876
- }
2877
- }
2878
- } // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
2879
- var FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration
2880
- // in a template, and will require a more complex diffing algo.
2881
- function markAsDynamicChildren(children) {
2882
- FromIteration.set(children, 1);
2883
- }
2884
- function hasDynamicChildren(children) {
2885
- return FromIteration.has(children);
2886
- }
2887
- /*
2888
- * Copyright (c) 2020, salesforce.com, inc.
2889
- * All rights reserved.
2890
- * SPDX-License-Identifier: MIT
2891
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2892
- */
2893
- function getUpgradableConstructor(tagName, renderer) {
2894
- // Should never get a tag with upper case letter at this point, the compiler should
2895
- // produce only tags with lowercase letters
2896
- // But, for backwards compatibility, we will lower case the tagName
2897
- tagName = tagName.toLowerCase();
2898
- var CE = renderer.getCustomElement(tagName);
2899
- if (!isUndefined$1(CE)) {
2900
- return CE;
2901
- }
2902
- /**
2903
- * LWC Upgradable Element reference to an element that was created
2904
- * via the scoped registry mechanism, and that is ready to be upgraded.
2905
- */
2906
- CE = /** @class */ (function (_super) {
2907
- __extends(LWCUpgradableElement, _super);
2908
- function LWCUpgradableElement(upgradeCallback) {
2909
- var _this = _super.call(this) || this;
2910
- if (isFunction$1(upgradeCallback)) {
2911
- upgradeCallback(_this); // nothing to do with the result for now
2912
- }
2913
- return _this;
2914
- }
2915
- return LWCUpgradableElement;
2916
- }(renderer.HTMLElement));
2917
- renderer.defineCustomElement(tagName, CE);
2918
- return CE;
2919
- }
2920
- /*
2921
- * Copyright (c) 2018, salesforce.com, inc.
2922
- * All rights reserved.
2923
- * SPDX-License-Identifier: MIT
2924
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2925
- */
2926
- var CHAR_S = 115;
2927
- var CHAR_V = 118;
2928
- var CHAR_G = 103;
2929
- var NamespaceAttributeForSVG = 'http://www.w3.org/2000/svg';
2930
- var SymbolIterator = Symbol.iterator;
2931
- var TextHook = {
2932
- create: function (vnode) {
2933
- var owner = vnode.owner;
2934
- var renderer = owner.renderer;
2935
- var elm = renderer.createText(vnode.text);
2936
- linkNodeToShadow(elm, owner);
2937
- vnode.elm = elm;
2938
- },
2939
- update: updateNodeHook,
2940
- insert: insertNodeHook,
2941
- move: insertNodeHook,
2942
- remove: removeNodeHook
2943
- }; // insert is called after update, which is used somewhere else (via a module)
2944
- // to mark the vm as inserted, that means we cannot use update as the main channel
2945
- // to rehydrate when dirty, because sometimes the element is not inserted just yet,
2946
- // which breaks some invariants. For that reason, we have the following for any
2947
- // Custom Element that is inserted via a template.
2948
- var ElementHook = {
2949
- create: function (vnode) {
2950
- var sel = vnode.sel, owner = vnode.owner, ns = vnode.data.ns;
2951
- var renderer = owner.renderer;
2952
- var elm = renderer.createElement(sel, ns);
2953
- linkNodeToShadow(elm, owner);
2954
- fallbackElmHook(elm, vnode);
2955
- vnode.elm = elm;
2956
- createElmHook(vnode);
2957
- },
2958
- update: function (oldVnode, vnode) {
2959
- updateElmHook(oldVnode, vnode);
2960
- updateChildrenHook(oldVnode, vnode);
2961
- },
2962
- insert: function (vnode, parentNode, referenceNode) {
2963
- insertNodeHook(vnode, parentNode, referenceNode);
2964
- createChildrenHook(vnode);
2965
- },
2966
- move: function (vnode, parentNode, referenceNode) {
2967
- insertNodeHook(vnode, parentNode, referenceNode);
2968
- },
2969
- remove: function (vnode, parentNode) {
2970
- removeNodeHook(vnode, parentNode);
2971
- removeElmHook(vnode);
2972
- }
2973
- };
2974
- var CustomElementHook = {
2975
- create: function (vnode) {
2976
- var sel = vnode.sel, owner = vnode.owner;
2977
- var renderer = owner.renderer;
2978
- var UpgradableConstructor = getUpgradableConstructor(sel, renderer);
2979
- /**
2980
- * Note: if the upgradable constructor does not expect, or throw when we new it
2981
- * with a callback as the first argument, we could implement a more advanced
2982
- * mechanism that only passes that argument if the constructor is known to be
2983
- * an upgradable custom element.
2984
- */
2985
- var elm = new UpgradableConstructor(function (elm) {
2986
- // the custom element from the registry is expecting an upgrade callback
2987
- createViewModelHook(elm, vnode);
2988
- });
2989
- linkNodeToShadow(elm, owner);
2990
- vnode.elm = elm;
2991
- var vm = getAssociatedVMIfPresent(elm);
2992
- if (vm) {
2993
- allocateChildrenHook(vnode, vm);
2994
- }
2995
- else if (vnode.ctor !== UpgradableConstructor) {
2996
- throw new TypeError("Incorrect Component Constructor");
2997
- }
2998
- createCustomElmHook(vnode);
2999
- },
3000
- update: function (oldVnode, vnode) {
3001
- updateCustomElmHook(oldVnode, vnode);
3002
- var vm = getAssociatedVMIfPresent(vnode.elm);
3003
- if (vm) {
3004
- // in fallback mode, the allocation will always set children to
3005
- // empty and delegate the real allocation to the slot elements
3006
- allocateChildrenHook(vnode, vm);
3007
- } // in fallback mode, the children will be always empty, so, nothing
3008
- // will happen, but in native, it does allocate the light dom
3009
- updateChildrenHook(oldVnode, vnode);
3010
- if (vm) {
3011
- // this is important to preserve the top to bottom synchronous rendering phase.
3012
- rerenderVM(vm);
3013
- }
3014
- },
3015
- insert: function (vnode, parentNode, referenceNode) {
3016
- insertNodeHook(vnode, parentNode, referenceNode);
3017
- var vm = getAssociatedVMIfPresent(vnode.elm);
3018
- if (vm) {
3019
- runConnectedCallback(vm);
3020
- }
3021
- createChildrenHook(vnode);
3022
- if (vm) {
3023
- appendVM(vm);
3024
- }
3025
- },
3026
- move: function (vnode, parentNode, referenceNode) {
3027
- insertNodeHook(vnode, parentNode, referenceNode);
3028
- },
3029
- remove: function (vnode, parentNode) {
3030
- removeNodeHook(vnode, parentNode);
3031
- var vm = getAssociatedVMIfPresent(vnode.elm);
3032
- if (vm) {
3033
- // for custom elements we don't have to go recursively because the removeVM routine
3034
- // will take care of disconnecting any child VM attached to its shadow as well.
3035
- removeVM(vm);
3036
- }
3037
- }
3038
- };
3039
- function linkNodeToShadow(elm, owner) {
3040
- var renderer = owner.renderer, cmpRoot = owner.cmpRoot; // TODO [#1164]: this should eventually be done by the polyfill directly
3041
- if (renderer.syntheticShadow) {
3042
- elm.$shadowResolver$ = cmpRoot.$shadowResolver$;
3043
- }
3044
- } // TODO [#1136]: this should be done by the compiler, adding ns to every sub-element
3045
- function addNS(vnode) {
3046
- var data = vnode.data, children = vnode.children, sel = vnode.sel;
3047
- data.ns = NamespaceAttributeForSVG; // TODO [#1275]: review why `sel` equal `foreignObject` should get this `ns`
3048
- if (isArray$2(children) && sel !== 'foreignObject') {
3049
- for (var j = 0, n = children.length; j < n; ++j) {
3050
- var childNode = children[j];
3051
- if (childNode != null && childNode.hook === ElementHook) {
3052
- addNS(childNode);
3053
- }
3054
- }
3055
- }
3056
- }
3057
- function addVNodeToChildLWC(vnode) {
3058
- ArrayPush$1.call(getVMBeingRendered().velements, vnode);
3059
- } // [h]tml node
3060
- function h(sel, data, children) {
3061
- var vmBeingRendered = getVMBeingRendered();
3062
- var key = data.key;
3063
- var text, elm;
3064
- var vnode = {
3065
- sel: sel,
3066
- data: data,
3067
- children: children,
3068
- text: text,
3069
- elm: elm,
3070
- key: key,
3071
- hook: ElementHook,
3072
- owner: vmBeingRendered
3073
- };
3074
- if (sel.length === 3 && StringCharCodeAt$1.call(sel, 0) === CHAR_S && StringCharCodeAt$1.call(sel, 1) === CHAR_V && StringCharCodeAt$1.call(sel, 2) === CHAR_G) {
3075
- addNS(vnode);
3076
- }
3077
- return vnode;
3078
- } // [t]ab[i]ndex function
3079
- function ti(value) {
3080
- // if value is greater than 0, we normalize to 0
3081
- // If value is an invalid tabIndex value (null, undefined, string, etc), we let that value pass through
3082
- // If value is less than -1, we don't care
3083
- var shouldNormalize = value > 0 && !(isTrue$1$1(value) || isFalse$1$1(value));
3084
- return shouldNormalize ? 0 : value;
3085
- } // [s]lot element node
3086
- function s(slotName, data, children, slotset) {
3087
- if (!isUndefined$1(slotset) && !isUndefined$1(slotset[slotName]) && slotset[slotName].length !== 0) {
3088
- children = slotset[slotName];
3089
- }
3090
- var vnode = h('slot', data, children);
3091
- if (vnode.owner.renderer.syntheticShadow) {
3092
- // TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic
3093
- sc(children);
3094
- }
3095
- return vnode;
3096
- } // [c]ustom element node
3097
- function c(sel, Ctor, data, children) {
3098
- if (children === void 0) { children = EmptyArray; }
3099
- var vmBeingRendered = getVMBeingRendered();
3100
- var key = data.key;
3101
- var text, elm;
3102
- var vnode = {
3103
- sel: sel,
3104
- data: data,
3105
- children: children,
3106
- text: text,
3107
- elm: elm,
3108
- key: key,
3109
- hook: CustomElementHook,
3110
- ctor: Ctor,
3111
- owner: vmBeingRendered,
3112
- mode: 'open'
3113
- };
3114
- addVNodeToChildLWC(vnode);
3115
- return vnode;
3116
- } // [i]terable node
3117
- function i(iterable, factory) {
3118
- var list = []; // TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic
3119
- sc(list);
3120
- if (isUndefined$1(iterable) || iterable === null) {
3121
- return list;
3122
- }
3123
- var iterator = iterable[SymbolIterator]();
3124
- var next = iterator.next();
3125
- var j = 0;
3126
- var value = next.value, last = next.done;
3127
- while (last === false) {
3128
- // implementing a look-back-approach because we need to know if the element is the last
3129
- next = iterator.next();
3130
- last = next.done; // template factory logic based on the previous collected value
3131
- var vnode = factory(value, j, j === 0, last);
3132
- if (isArray$2(vnode)) {
3133
- ArrayPush$1.apply(list, vnode);
3134
- }
3135
- else {
3136
- ArrayPush$1.call(list, vnode);
3137
- }
3138
- j += 1;
3139
- value = next.value;
3140
- }
3141
- return list;
3142
- }
3143
- /**
3144
- * [f]lattening
3145
- */
3146
- function f(items) {
3147
- var len = items.length;
3148
- var flattened = []; // TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic
3149
- sc(flattened);
3150
- for (var j = 0; j < len; j += 1) {
3151
- var item = items[j];
3152
- if (isArray$2(item)) {
3153
- ArrayPush$1.apply(flattened, item);
3154
- }
3155
- else {
3156
- ArrayPush$1.call(flattened, item);
3157
- }
3158
- }
3159
- return flattened;
3160
- } // [t]ext node
3161
- function t(text) {
3162
- var data = EmptyObject;
3163
- var sel, children, key, elm;
3164
- return {
3165
- sel: sel,
3166
- data: data,
3167
- children: children,
3168
- text: text,
3169
- elm: elm,
3170
- key: key,
3171
- hook: TextHook,
3172
- owner: getVMBeingRendered()
3173
- };
3174
- } // [d]ynamic value to produce a text vnode
3175
- function d(value) {
3176
- if (value == null) {
3177
- return null;
3178
- }
3179
- return t(value);
3180
- } // [b]ind function
3181
- function b(fn) {
3182
- var vmBeingRendered = getVMBeingRendered();
3183
- if (isNull$1(vmBeingRendered)) {
3184
- throw new Error();
3185
- }
3186
- var vm = vmBeingRendered;
3187
- return function (event) {
3188
- invokeEventListener(vm, fn, vm.component, event);
3189
- };
3190
- } // [k]ey function
3191
- function k(compilerKey, obj) {
3192
- switch (typeof obj) {
3193
- case 'number':
3194
- case 'string':
3195
- return compilerKey + ':' + obj;
3196
- }
3197
- } // [g]lobal [id] function
3198
- function gid(id) {
3199
- var vmBeingRendered = getVMBeingRendered();
3200
- if (isUndefined$1(id) || id === '') {
3201
- return id;
3202
- } // We remove attributes when they are assigned a value of null
3203
- if (isNull$1(id)) {
3204
- return null;
3205
- }
3206
- return id + "-" + vmBeingRendered.idx;
3207
- } // [f]ragment [id] function
3208
- function fid(url) {
3209
- var vmBeingRendered = getVMBeingRendered();
3210
- if (isUndefined$1(url) || url === '') {
3211
- return url;
3212
- } // We remove attributes when they are assigned a value of null
3213
- if (isNull$1(url)) {
3214
- return null;
3215
- } // Apply transformation only for fragment-only-urls
3216
- if (/^#/.test(url)) {
3217
- return url + "-" + vmBeingRendered.idx;
3218
- }
3219
- return url;
3220
- }
3221
- /**
3222
- * Map to store an index value assigned to any dynamic component reference ingested
3223
- * by dc() api. This allows us to generate a unique unique per template per dynamic
3224
- * component reference to avoid diffing algo mismatches.
3225
- */
3226
- var DynamicImportedComponentMap = new Map();
3227
- var dynamicImportedComponentCounter = 0;
3228
- /**
3229
- * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
3230
- */
3231
- function dc(sel, Ctor, data, children) {
3232
- if (Ctor == null) {
3233
- return null;
3234
- }
3235
- if (!isComponentConstructor(Ctor)) {
3236
- throw new Error("Invalid LWC Constructor " + toString$1(Ctor) + " for custom element <" + sel + ">.");
3237
- }
3238
- var idx = DynamicImportedComponentMap.get(Ctor);
3239
- if (isUndefined$1(idx)) {
3240
- idx = dynamicImportedComponentCounter++;
3241
- DynamicImportedComponentMap.set(Ctor, idx);
3242
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
3243
- // to identify different constructors as vnodes with different keys to avoid reusing the
3244
- // element used for previous constructors.
3245
- data.key = "dc:" + idx + ":" + data.key;
3246
- return c(sel, Ctor, data, children);
3247
- }
3248
- /**
3249
- * slow children collection marking mechanism. this API allows the compiler to signal
3250
- * to the engine that a particular collection of children must be diffed using the slow
3251
- * algo based on keys due to the nature of the list. E.g.:
3252
- *
3253
- * - slot element's children: the content of the slot has to be dynamic when in synthetic
3254
- * shadow mode because the `vnode.children` might be the slotted
3255
- * content vs default content, in which case the size and the
3256
- * keys are not matching.
3257
- * - children that contain dynamic components
3258
- * - children that are produced by iteration
3259
- *
3260
- */
3261
- function sc(vnodes) {
3262
- // choose to use the snabbdom virtual dom diffing algo instead of our
3263
- // static dummy algo.
3264
- markAsDynamicChildren(vnodes);
3265
- return vnodes;
3266
- }
3267
- var api$1 = /*#__PURE__*/ Object.freeze({
3268
- __proto__: null,
3269
- h: h,
3270
- ti: ti,
3271
- s: s,
3272
- c: c,
3273
- i: i,
3274
- f: f,
3275
- t: t,
3276
- d: d,
3277
- b: b,
3278
- k: k,
3279
- gid: gid,
3280
- fid: fid,
3281
- dc: dc,
3282
- sc: sc
3283
- });
3284
- /*
3285
- * Copyright (c) 2018, salesforce.com, inc.
3286
- * All rights reserved.
3287
- * SPDX-License-Identifier: MIT
3288
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3289
- */
3290
- function createShadowStyleVNode(content) {
3291
- return h('style', {
3292
- key: 'style',
3293
- attrs: {
3294
- type: 'text/css'
3295
- }
3296
- }, [t(content)]);
3297
- }
3298
- function updateSyntheticShadowAttributes(vm, template) {
3299
- var elm = vm.elm, context = vm.context, renderer = vm.renderer;
3300
- var newStylesheets = template.stylesheets, newStylesheetTokens = template.stylesheetTokens;
3301
- var newHostAttribute;
3302
- var newShadowAttribute; // Reset the styling token applied to the host element.
3303
- var oldHostAttribute = context.hostAttribute;
3304
- if (!isUndefined$1(oldHostAttribute)) {
3305
- renderer.removeAttribute(elm, oldHostAttribute);
3306
- } // Apply the new template styling token to the host element, if the new template has any
3307
- // associated stylesheets.
3308
- if (!isUndefined$1(newStylesheetTokens) && !isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3309
- newHostAttribute = newStylesheetTokens.hostAttribute;
3310
- newShadowAttribute = newStylesheetTokens.shadowAttribute;
3311
- renderer.setAttribute(elm, newHostAttribute, '');
3312
- } // Update the styling tokens present on the context object.
3313
- context.hostAttribute = newHostAttribute;
3314
- context.shadowAttribute = newShadowAttribute;
3315
- }
3316
- function evaluateStylesheetsContent(stylesheets, hostSelector, shadowSelector, nativeShadow) {
3317
- var content = [];
3318
- for (var i_12 = 0; i_12 < stylesheets.length; i_12++) {
3319
- var stylesheet = stylesheets[i_12];
3320
- if (isArray$2(stylesheet)) {
3321
- ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, hostSelector, shadowSelector, nativeShadow));
3322
- }
3323
- else {
3324
- ArrayPush$1.call(content, stylesheet(hostSelector, shadowSelector, nativeShadow));
3325
- }
3326
- }
3327
- return content;
3328
- }
3329
- function getStylesheetsContent(vm, template) {
3330
- var stylesheets = template.stylesheets, tokens = template.stylesheetTokens;
3331
- var syntheticShadow = vm.renderer.syntheticShadow;
3332
- var content = [];
3333
- if (!isUndefined$1(stylesheets) && !isUndefined$1(tokens)) {
3334
- var hostSelector = syntheticShadow ? "[" + tokens.hostAttribute + "]" : '';
3335
- var shadowSelector = syntheticShadow ? "[" + tokens.shadowAttribute + "]" : '';
3336
- content = evaluateStylesheetsContent(stylesheets, hostSelector, shadowSelector, !syntheticShadow);
3337
- }
3338
- return content;
3339
- }
3340
- function createStylesheet(vm, stylesheets) {
3341
- var renderer = vm.renderer;
3342
- if (renderer.syntheticShadow) {
3343
- for (var i_13 = 0; i_13 < stylesheets.length; i_13++) {
3344
- renderer.insertGlobalStylesheet(stylesheets[i_13]);
3345
- }
3346
- return null;
3347
- }
3348
- else {
3349
- var shadowStyleSheetContent = ArrayJoin$1.call(stylesheets, '\n');
3350
- return createShadowStyleVNode(shadowStyleSheetContent);
3351
- }
3352
- }
3353
- /*
3354
- * Copyright (c) 2018, salesforce.com, inc.
3355
- * All rights reserved.
3356
- * SPDX-License-Identifier: MIT
3357
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3358
- */
3359
- var GlobalMeasurementPhase;
3360
- (function (GlobalMeasurementPhase) {
3361
- GlobalMeasurementPhase["REHYDRATE"] = "lwc-rehydrate";
3362
- GlobalMeasurementPhase["HYDRATE"] = "lwc-hydrate";
3363
- })(GlobalMeasurementPhase || (GlobalMeasurementPhase = {})); // Even if all the browser the engine supports implements the UserTiming API, we need to guard the measure APIs.
3364
- // JSDom (used in Jest) for example doesn't implement the UserTiming APIs.
3365
- var isUserTimingSupported = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
3366
- function getMarkName(phase, vm) {
3367
- // Adding the VM idx to the mark name creates a unique mark name component instance. This is necessary to produce
3368
- // the right measures for components that are recursive.
3369
- return getComponentTag(vm) + " - " + phase + " - " + vm.idx;
3370
- }
3371
- function getMeasureName(phase, vm) {
3372
- return getComponentTag(vm) + " - " + phase;
3373
- }
3374
- function start(markName) {
3375
- performance.mark(markName);
3376
- }
3377
- function end(measureName, markName) {
3378
- performance.measure(measureName, markName); // Clear the created marks and measure to avoid filling the performance entries buffer.
3379
- // Note: Even if the entries get deleted, existing PerformanceObservers preserve a copy of those entries.
3380
- performance.clearMarks(markName);
3381
- performance.clearMarks(measureName);
3382
- }
3383
- function noop$1() {
3384
- /* do nothing */
3385
- }
3386
- var startMeasure = !isUserTimingSupported ? noop$1 : function (phase, vm) {
3387
- var markName = getMarkName(phase, vm);
3388
- start(markName);
3389
- };
3390
- var endMeasure = !isUserTimingSupported ? noop$1 : function (phase, vm) {
3391
- var markName = getMarkName(phase, vm);
3392
- var measureName = getMeasureName(phase, vm);
3393
- end(measureName, markName);
3394
- };
3395
- var startGlobalMeasure = !isUserTimingSupported ? noop$1 : function (phase, vm) {
3396
- var markName = isUndefined$1(vm) ? phase : getMarkName(phase, vm);
3397
- start(markName);
3398
- };
3399
- var endGlobalMeasure = !isUserTimingSupported ? noop$1 : function (phase, vm) {
3400
- var markName = isUndefined$1(vm) ? phase : getMarkName(phase, vm);
3401
- end(phase, markName);
3402
- };
3403
- /*
3404
- * Copyright (c) 2018, salesforce.com, inc.
3405
- * All rights reserved.
3406
- * SPDX-License-Identifier: MIT
3407
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3408
- */
3409
- function noop$2(_opId, _phase, _cmpName, _vm_idx) { }
3410
- var logOperation = noop$2;
3411
- var OperationId;
3412
- (function (OperationId) {
3413
- OperationId[OperationId["constructor"] = 0] = "constructor";
3414
- OperationId[OperationId["render"] = 1] = "render";
3415
- OperationId[OperationId["patch"] = 2] = "patch";
3416
- OperationId[OperationId["connectedCallback"] = 3] = "connectedCallback";
3417
- OperationId[OperationId["renderedCallback"] = 4] = "renderedCallback";
3418
- OperationId[OperationId["disconnectedCallback"] = 5] = "disconnectedCallback";
3419
- OperationId[OperationId["errorCallback"] = 6] = "errorCallback";
3420
- })(OperationId || (OperationId = {}));
3421
- var Phase;
3422
- (function (Phase) {
3423
- Phase[Phase["Start"] = 0] = "Start";
3424
- Phase[Phase["Stop"] = 1] = "Stop";
3425
- })(Phase || (Phase = {}));
3426
- var opIdToMeasurementPhaseMappingArray = ['constructor', 'render', 'patch', 'connectedCallback', 'renderedCallback', 'disconnectedCallback', 'errorCallback'];
3427
- var profilerEnabled = false;
3428
- var logMarks = false;
3429
- var bufferLogging = false;
3430
- var profilerStateCallbacks = [];
3431
- function trackProfilerState(callback) {
3432
- callback(profilerEnabled);
3433
- profilerStateCallbacks.push(callback);
3434
- }
3435
- function logOperationStart(opId, vm) {
3436
- if (logMarks) {
3437
- startMeasure(opIdToMeasurementPhaseMappingArray[opId], vm);
3438
- }
3439
- if (bufferLogging) {
3440
- logOperation(opId, Phase.Start, vm.tagName, vm.idx);
3441
- }
3442
- }
3443
- function logOperationEnd(opId, vm) {
3444
- if (logMarks) {
3445
- endMeasure(opIdToMeasurementPhaseMappingArray[opId], vm);
3446
- }
3447
- if (bufferLogging) {
3448
- logOperation(opId, Phase.Stop, vm.tagName, vm.idx);
3449
- }
3450
- }
3451
- function enableProfiler() {
3452
- profilerEnabled = true;
3453
- bufferLogging = true;
3454
- notifyProfilerStateChange();
3455
- }
3456
- function disableProfiler() {
3457
- {
3458
- profilerEnabled = false;
3459
- bufferLogging = false;
3460
- logMarks = false;
3461
- }
3462
- notifyProfilerStateChange();
3463
- }
3464
- function notifyProfilerStateChange() {
3465
- for (var i_14 = 0; i_14 < profilerStateCallbacks.length; i_14++) {
3466
- profilerStateCallbacks[i_14](profilerEnabled);
3467
- }
3468
- }
3469
- function attachDispatcher(dispatcher) {
3470
- logOperation = dispatcher;
3471
- bufferLogging = true;
3472
- }
3473
- function detachDispatcher() {
3474
- var currentLogOperation = logOperation;
3475
- logOperation = noop$2;
3476
- bufferLogging = false;
3477
- return currentLogOperation;
3478
- }
3479
- var profilerControl = {
3480
- enableProfiler: enableProfiler,
3481
- disableProfiler: disableProfiler,
3482
- attachDispatcher: attachDispatcher,
3483
- detachDispatcher: detachDispatcher
3484
- };
3485
- /*
3486
- * Copyright (c) 2018, salesforce.com, inc.
3487
- * All rights reserved.
3488
- * SPDX-License-Identifier: MIT
3489
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3490
- */
3491
- var isUpdatingTemplate = false;
3492
- var vmBeingRendered = null;
3493
- function getVMBeingRendered() {
3494
- return vmBeingRendered;
3495
- }
3496
- function setVMBeingRendered(vm) {
3497
- vmBeingRendered = vm;
3498
- }
3499
- var profilerEnabled$1 = false;
3500
- trackProfilerState(function (t) { return profilerEnabled$1 = t; });
3501
- function validateSlots(vm, html) {
3502
- {
3503
- // this method should never leak to prod
3504
- throw new ReferenceError();
3505
- }
3506
- }
3507
- function evaluateTemplate(vm, html) {
3508
- var isUpdatingTemplateInception = isUpdatingTemplate;
3509
- var vmOfTemplateBeingUpdatedInception = vmBeingRendered;
3510
- var vnodes = [];
3511
- runWithBoundaryProtection(vm, vm.owner, function () {
3512
- // pre
3513
- vmBeingRendered = vm;
3514
- if (profilerEnabled$1) {
3515
- logOperationStart(OperationId.render, vm);
3516
- }
3517
- }, function () {
3518
- // job
3519
- var component = vm.component, context = vm.context, cmpSlots = vm.cmpSlots, cmpTemplate = vm.cmpTemplate, tro = vm.tro, renderer = vm.renderer;
3520
- tro.observe(function () {
3521
- // Reset the cache memoizer for template when needed.
3522
- if (html !== cmpTemplate) {
3523
- // Perf opt: do not reset the shadow root during the first rendering (there is
3524
- // nothing to reset).
3525
- if (!isNull$1(cmpTemplate)) {
3526
- // It is important to reset the content to avoid reusing similar elements
3527
- // generated from a different template, because they could have similar IDs,
3528
- // and snabbdom just rely on the IDs.
3529
- resetShadowRoot(vm);
3530
- } // Check that the template was built by the compiler.
3531
- if (!isTemplateRegistered(html)) {
3532
- throw new TypeError("Invalid template returned by the render() method on " + vm + ". It must return an imported template (e.g.: `import html from \"./" + vm.def.name + ".html\"`), instead, it has returned: " + toString$1(html) + ".");
3533
- }
3534
- vm.cmpTemplate = html; // Create a brand new template cache for the swapped templated.
3535
- context.tplCache = create$1(null); // Update the synthetic shadow attributes on the host element if necessary.
3536
- if (renderer.syntheticShadow) {
3537
- updateSyntheticShadowAttributes(vm, html);
3538
- } // Evaluate, create stylesheet and cache the produced VNode for future
3539
- // re-rendering.
3540
- var stylesheetsContent = getStylesheetsContent(vm, html);
3541
- context.styleVNode = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);
3542
- }
3543
- if ("production" !== 'production') ; // right before producing the vnodes, we clear up all internal references
3544
- // to custom elements from the template.
3545
- vm.velements = []; // Set the global flag that template is being updated
3546
- isUpdatingTemplate = true;
3547
- vnodes = html.call(undefined, api$1, component, cmpSlots, context.tplCache);
3548
- var styleVNode = context.styleVNode;
3549
- if (!isNull$1(styleVNode)) {
3550
- ArrayUnshift$2.call(vnodes, styleVNode);
3551
- }
3552
- });
3553
- }, function () {
3554
- // post
3555
- isUpdatingTemplate = isUpdatingTemplateInception;
3556
- vmBeingRendered = vmOfTemplateBeingUpdatedInception;
3557
- if (profilerEnabled$1) {
3558
- logOperationEnd(OperationId.render, vm);
3559
- }
3560
- });
3561
- return vnodes;
3562
- }
3563
- /*
3564
- * Copyright (c) 2018, salesforce.com, inc.
3565
- * All rights reserved.
3566
- * SPDX-License-Identifier: MIT
3567
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3568
- */
3569
- function addErrorComponentStack(vm, error) {
3570
- if (!isFrozen$1(error) && isUndefined$1(error.wcStack)) {
3571
- var wcStack_1 = getErrorComponentStack(vm);
3572
- defineProperty$1(error, 'wcStack', {
3573
- get: function () {
3574
- return wcStack_1;
3575
- }
3576
- });
3577
- }
3578
- }
3579
- var vmBeingConstructed = null;
3580
- function isBeingConstructed(vm) {
3581
- return vmBeingConstructed === vm;
3582
- }
3583
- var profilerEnabled$2 = false;
3584
- trackProfilerState(function (t) { return profilerEnabled$2 = t; });
3585
- var noop$3 = function () { return void 0; };
3586
- function invokeComponentCallback(vm, fn, args) {
3587
- var component = vm.component, callHook = vm.callHook, owner = vm.owner;
3588
- var result;
3589
- runWithBoundaryProtection(vm, owner, noop$3, function () {
3590
- // job
3591
- result = callHook(component, fn, args);
3592
- }, noop$3);
3593
- return result;
3594
- }
3595
- function invokeComponentConstructor(vm, Ctor) {
3596
- var vmBeingConstructedInception = vmBeingConstructed;
3597
- var error;
3598
- if (profilerEnabled$2) {
3599
- logOperationStart(OperationId.constructor, vm);
3600
- }
3601
- vmBeingConstructed = vm;
3602
- /**
3603
- * Constructors don't need to be wrapped with a boundary because for root elements
3604
- * it should throw, while elements from template are already wrapped by a boundary
3605
- * associated to the diffing algo.
3606
- */
3607
- try {
3608
- // job
3609
- var result = new Ctor(); // Check indirectly if the constructor result is an instance of LightningElement. Using
3610
- // the "instanceof" operator would not work here since Locker Service provides its own
3611
- // implementation of LightningElement, so we indirectly check if the base constructor is
3612
- // invoked by accessing the component on the vm.
3613
- if (vmBeingConstructed.component !== result) {
3614
- throw new TypeError('Invalid component constructor, the class should extend LightningElement.');
3615
- }
3616
- }
3617
- catch (e) {
3618
- error = Object(e);
3619
- }
3620
- finally {
3621
- if (profilerEnabled$2) {
3622
- logOperationEnd(OperationId.constructor, vm);
3623
- }
3624
- vmBeingConstructed = vmBeingConstructedInception;
3625
- if (!isUndefined$1(error)) {
3626
- addErrorComponentStack(vm, error); // re-throwing the original error annotated after restoring the context
3627
- throw error; // eslint-disable-line no-unsafe-finally
3628
- }
3629
- }
3630
- }
3631
- function invokeComponentRenderMethod(vm) {
3632
- var render = vm.def.render, callHook = vm.callHook, component = vm.component, owner = vm.owner;
3633
- var vmBeingRenderedInception = getVMBeingRendered();
3634
- var html;
3635
- var renderInvocationSuccessful = false;
3636
- runWithBoundaryProtection(vm, owner, function () {
3637
- setVMBeingRendered(vm);
3638
- }, function () {
3639
- // job
3640
- vm.tro.observe(function () {
3641
- html = callHook(component, render);
3642
- renderInvocationSuccessful = true;
3643
- });
3644
- }, function () {
3645
- setVMBeingRendered(vmBeingRenderedInception);
3646
- }); // If render() invocation failed, process errorCallback in boundary and return an empty template
3647
- return renderInvocationSuccessful ? evaluateTemplate(vm, html) : [];
3648
- }
3649
- function invokeComponentRenderedCallback(vm) {
3650
- var renderedCallback = vm.def.renderedCallback, component = vm.component, callHook = vm.callHook, owner = vm.owner;
3651
- if (!isUndefined$1(renderedCallback)) {
3652
- runWithBoundaryProtection(vm, owner, function () {
3653
- if (profilerEnabled$2) {
3654
- logOperationStart(OperationId.renderedCallback, vm);
3655
- }
3656
- }, function () {
3657
- // job
3658
- callHook(component, renderedCallback);
3659
- }, function () {
3660
- // post
3661
- if (profilerEnabled$2) {
3662
- logOperationEnd(OperationId.renderedCallback, vm);
3663
- }
3664
- });
3665
- }
3666
- }
3667
- function invokeEventListener(vm, fn, thisValue, event) {
3668
- var callHook = vm.callHook, owner = vm.owner;
3669
- runWithBoundaryProtection(vm, owner, noop$3, function () {
3670
- // job
3671
- if ("production" !== 'production') ;
3672
- callHook(thisValue, fn, [event]);
3673
- }, noop$3);
3674
- }
3675
- /*
3676
- * Copyright (c) 2018, salesforce.com, inc.
3677
- * All rights reserved.
3678
- * SPDX-License-Identifier: MIT
3679
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3680
- */
3681
- var signedTemplateMap = new Map();
3682
- /**
3683
- * INTERNAL: This function can only be invoked by compiled code. The compiler
3684
- * will prevent this function from being imported by userland code.
3685
- */
3686
- function registerComponent(Ctor, _b) {
3687
- var tmpl = _b.tmpl;
3688
- signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
3689
- // without too much transformation
3690
- return Ctor;
3691
- }
3692
- function getComponentRegisteredTemplate(Ctor) {
3693
- return signedTemplateMap.get(Ctor);
3694
- }
3695
- function createComponent(vm, Ctor) {
3696
- // create the component instance
3697
- invokeComponentConstructor(vm, Ctor);
3698
- if (isUndefined$1(vm.component)) {
3699
- throw new ReferenceError("Invalid construction for " + Ctor + ", you must extend LightningElement.");
3700
- }
3701
- }
3702
- function getTemplateReactiveObserver(vm) {
3703
- return new ReactiveObserver(function () {
3704
- var isDirty = vm.isDirty;
3705
- if (isFalse$1$1(isDirty)) {
3706
- markComponentAsDirty(vm);
3707
- scheduleRehydration(vm);
3708
- }
3709
- });
3710
- }
3711
- function renderComponent(vm) {
3712
- vm.tro.reset();
3713
- var vnodes = invokeComponentRenderMethod(vm);
3714
- vm.isDirty = false;
3715
- vm.isScheduled = false;
3716
- return vnodes;
3717
- }
3718
- function markComponentAsDirty(vm) {
3719
- vm.isDirty = true;
3720
- }
3721
- var cmpEventListenerMap = new WeakMap();
3722
- function getWrappedComponentsListener(vm, listener) {
3723
- if (!isFunction$1(listener)) {
3724
- throw new TypeError(); // avoiding problems with non-valid listeners
3725
- }
3726
- var wrappedListener = cmpEventListenerMap.get(listener);
3727
- if (isUndefined$1(wrappedListener)) {
3728
- wrappedListener = function (event) {
3729
- invokeEventListener(vm, listener, undefined, event);
3730
- };
3731
- cmpEventListenerMap.set(listener, wrappedListener);
3732
- }
3733
- return wrappedListener;
3734
- }
3735
- /*
3736
- * Copyright (c) 2018, salesforce.com, inc.
3737
- * All rights reserved.
3738
- * SPDX-License-Identifier: MIT
3739
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3740
- */
3741
- var Services = create$1(null);
3742
- var hooks = ['rendered', 'connected', 'disconnected'];
3743
- /**
3744
- * EXPERIMENTAL: This function allows for the registration of "services"
3745
- * in LWC by exposing hooks into the component life-cycle. This API is
3746
- * subject to change or being removed.
3747
- */
3748
- function register(service) {
3749
- for (var i_15 = 0; i_15 < hooks.length; ++i_15) {
3750
- var hookName = hooks[i_15];
3751
- if (hookName in service) {
3752
- var l = Services[hookName];
3753
- if (isUndefined$1(l)) {
3754
- Services[hookName] = l = [];
3755
- }
3756
- ArrayPush$1.call(l, service[hookName]);
3757
- }
3758
- }
3759
- }
3760
- function invokeServiceHook(vm, cbs) {
3761
- var component = vm.component, def = vm.def, context = vm.context;
3762
- for (var i_16 = 0, len = cbs.length; i_16 < len; ++i_16) {
3763
- cbs[i_16].call(undefined, component, {}, def, context);
3764
- }
3765
- }
3766
- /*
3767
- * Copyright (c) 2018, salesforce.com, inc.
3768
- * All rights reserved.
3769
- * SPDX-License-Identifier: MIT
3770
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3771
- */
3772
- var VMState;
3773
- (function (VMState) {
3774
- VMState[VMState["created"] = 0] = "created";
3775
- VMState[VMState["connected"] = 1] = "connected";
3776
- VMState[VMState["disconnected"] = 2] = "disconnected";
3777
- })(VMState || (VMState = {}));
3778
- var profilerEnabled$3 = false;
3779
- trackProfilerState(function (t) { return profilerEnabled$3 = t; });
3780
- var idx = 0;
3781
- /** The internal slot used to associate different objects the engine manipulates with the VM */
3782
- var ViewModelReflection = createHiddenField$1('ViewModel', 'engine');
3783
- function callHook(cmp, fn, args) {
3784
- if (args === void 0) { args = []; }
3785
- return fn.apply(cmp, args);
3786
- }
3787
- function setHook(cmp, prop, newValue) {
3788
- cmp[prop] = newValue;
3789
- }
3790
- function getHook(cmp, prop) {
3791
- return cmp[prop];
3792
- }
3793
- function rerenderVM(vm) {
3794
- rehydrate(vm);
3795
- }
3796
- function connectRootElement(elm) {
3797
- var vm = getAssociatedVM(elm);
3798
- startGlobalMeasure(GlobalMeasurementPhase.HYDRATE, vm); // Usually means moving the element from one place to another, which is observable via
3799
- // life-cycle hooks.
3800
- if (vm.state === VMState.connected) {
3801
- disconnectRootElement(elm);
3802
- }
3803
- runConnectedCallback(vm);
3804
- rehydrate(vm);
3805
- endGlobalMeasure(GlobalMeasurementPhase.HYDRATE, vm);
3806
- }
3807
- function disconnectRootElement(elm) {
3808
- var vm = getAssociatedVM(elm);
3809
- resetComponentStateWhenRemoved(vm);
3810
- }
3811
- function appendVM(vm) {
3812
- rehydrate(vm);
3813
- } // just in case the component comes back, with this we guarantee re-rendering it
3814
- // while preventing any attempt to rehydration until after reinsertion.
3815
- function resetComponentStateWhenRemoved(vm) {
3816
- var state = vm.state;
3817
- if (state !== VMState.disconnected) {
3818
- var oar = vm.oar, tro = vm.tro; // Making sure that any observing record will not trigger the rehydrated on this vm
3819
- tro.reset(); // Making sure that any observing accessor record will not trigger the setter to be reinvoked
3820
- for (var key in oar) {
3821
- oar[key].reset();
3822
- }
3823
- runDisconnectedCallback(vm); // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
3824
- runShadowChildNodesDisconnectedCallback(vm);
3825
- runLightChildNodesDisconnectedCallback(vm);
3826
- }
3827
- } // this method is triggered by the diffing algo only when a vnode from the
3828
- // old vnode.children is removed from the DOM.
3829
- function removeVM(vm) {
3830
- resetComponentStateWhenRemoved(vm);
3831
- }
3832
- function createVM(elm, def, options) {
3833
- var mode = options.mode, owner = options.owner, renderer = options.renderer, tagName = options.tagName;
3834
- var vm = {
3835
- elm: elm,
3836
- def: def,
3837
- idx: idx++,
3838
- state: VMState.created,
3839
- isScheduled: false,
3840
- isDirty: true,
3841
- tagName: tagName,
3842
- mode: mode,
3843
- owner: owner,
3844
- renderer: renderer,
3845
- children: EmptyArray,
3846
- aChildren: EmptyArray,
3847
- velements: EmptyArray,
3848
- cmpProps: create$1(null),
3849
- cmpFields: create$1(null),
3850
- cmpSlots: create$1(null),
3851
- oar: create$1(null),
3852
- cmpTemplate: null,
3853
- context: {
3854
- hostAttribute: undefined,
3855
- shadowAttribute: undefined,
3856
- styleVNode: null,
3857
- tplCache: EmptyObject,
3858
- wiredConnecting: EmptyArray,
3859
- wiredDisconnecting: EmptyArray
3860
- },
3861
- tro: null,
3862
- component: null,
3863
- cmpRoot: null,
3864
- callHook: callHook,
3865
- setHook: setHook,
3866
- getHook: getHook
3867
- };
3868
- vm.tro = getTemplateReactiveObserver(vm);
3869
- createComponent(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
3870
- if (isFalse$1$1(renderer.ssr) && hasWireAdapters(vm)) {
3871
- installWireAdapters(vm);
3872
- }
3873
- return vm;
3874
- }
3875
- function associateVM(obj, vm) {
3876
- setHiddenField$1(obj, ViewModelReflection, vm);
3877
- }
3878
- function getAssociatedVM(obj) {
3879
- var vm = getHiddenField$1(obj, ViewModelReflection);
3880
- return vm;
3881
- }
3882
- function getAssociatedVMIfPresent(obj) {
3883
- var maybeVm = getHiddenField$1(obj, ViewModelReflection);
3884
- return maybeVm;
3885
- }
3886
- function rehydrate(vm) {
3887
- if (isTrue$1$1(vm.isDirty)) {
3888
- var children = renderComponent(vm);
3889
- patchShadowRoot(vm, children);
3890
- }
3891
- }
3892
- function patchShadowRoot(vm, newCh) {
3893
- var cmpRoot = vm.cmpRoot, oldCh = vm.children; // caching the new children collection
3894
- vm.children = newCh;
3895
- if (newCh.length > 0 || oldCh.length > 0) {
3896
- // patch function mutates vnodes by adding the element reference,
3897
- // however, if patching fails it contains partial changes.
3898
- if (oldCh !== newCh) {
3899
- var fn_1 = hasDynamicChildren(newCh) ? updateDynamicChildren : updateStaticChildren;
3900
- runWithBoundaryProtection(vm, vm, function () {
3901
- // pre
3902
- if (profilerEnabled$3) {
3903
- logOperationStart(OperationId.patch, vm);
3904
- }
3905
- }, function () {
3906
- // job
3907
- fn_1(cmpRoot, oldCh, newCh);
3908
- }, function () {
3909
- // post
3910
- if (profilerEnabled$3) {
3911
- logOperationEnd(OperationId.patch, vm);
3912
- }
3913
- });
3914
- }
3915
- }
3916
- if (vm.state === VMState.connected) {
3917
- // If the element is connected, that means connectedCallback was already issued, and
3918
- // any successive rendering should finish with the call to renderedCallback, otherwise
3919
- // the connectedCallback will take care of calling it in the right order at the end of
3920
- // the current rehydration process.
3921
- runRenderedCallback(vm);
3922
- }
3923
- }
3924
- function runRenderedCallback(vm) {
3925
- if (isTrue$1$1(vm.renderer.ssr)) {
3926
- return;
3927
- }
3928
- var rendered = Services.rendered;
3929
- if (rendered) {
3930
- invokeServiceHook(vm, rendered);
3931
- }
3932
- invokeComponentRenderedCallback(vm);
3933
- }
3934
- var rehydrateQueue = [];
3935
- function flushRehydrationQueue() {
3936
- startGlobalMeasure(GlobalMeasurementPhase.REHYDRATE);
3937
- var vms = rehydrateQueue.sort(function (a, b) { return a.idx - b.idx; });
3938
- rehydrateQueue = []; // reset to a new queue
3939
- for (var i_17 = 0, len = vms.length; i_17 < len; i_17 += 1) {
3940
- var vm = vms[i_17];
3941
- try {
3942
- rehydrate(vm);
3943
- }
3944
- catch (error) {
3945
- if (i_17 + 1 < len) {
3946
- // pieces of the queue are still pending to be rehydrated, those should have priority
3947
- if (rehydrateQueue.length === 0) {
3948
- addCallbackToNextTick(flushRehydrationQueue);
3949
- }
3950
- ArrayUnshift$2.apply(rehydrateQueue, ArraySlice$2.call(vms, i_17 + 1));
3951
- } // we need to end the measure before throwing.
3952
- endGlobalMeasure(GlobalMeasurementPhase.REHYDRATE); // re-throwing the original error will break the current tick, but since the next tick is
3953
- // already scheduled, it should continue patching the rest.
3954
- throw error; // eslint-disable-line no-unsafe-finally
3955
- }
3956
- }
3957
- endGlobalMeasure(GlobalMeasurementPhase.REHYDRATE);
3958
- }
3959
- function runConnectedCallback(vm) {
3960
- var state = vm.state;
3961
- if (state === VMState.connected) {
3962
- return; // nothing to do since it was already connected
3963
- }
3964
- vm.state = VMState.connected; // reporting connection
3965
- var connected = Services.connected;
3966
- if (connected) {
3967
- invokeServiceHook(vm, connected);
3968
- }
3969
- if (hasWireAdapters(vm)) {
3970
- connectWireAdapters(vm);
3971
- }
3972
- var connectedCallback = vm.def.connectedCallback;
3973
- if (!isUndefined$1(connectedCallback)) {
3974
- if (profilerEnabled$3) {
3975
- logOperationStart(OperationId.connectedCallback, vm);
3976
- }
3977
- invokeComponentCallback(vm, connectedCallback);
3978
- if (profilerEnabled$3) {
3979
- logOperationEnd(OperationId.connectedCallback, vm);
3980
- }
3981
- }
3982
- }
3983
- function hasWireAdapters(vm) {
3984
- return getOwnPropertyNames$1(vm.def.wire).length > 0;
3985
- }
3986
- function runDisconnectedCallback(vm) {
3987
- if (isFalse$1$1(vm.isDirty)) {
3988
- // this guarantees that if the component is reused/reinserted,
3989
- // it will be re-rendered because we are disconnecting the reactivity
3990
- // linking, so mutations are not automatically reflected on the state
3991
- // of disconnected components.
3992
- vm.isDirty = true;
3993
- }
3994
- vm.state = VMState.disconnected; // reporting disconnection
3995
- var disconnected = Services.disconnected;
3996
- if (disconnected) {
3997
- invokeServiceHook(vm, disconnected);
3998
- }
3999
- if (hasWireAdapters(vm)) {
4000
- disconnectWireAdapters(vm);
4001
- }
4002
- var disconnectedCallback = vm.def.disconnectedCallback;
4003
- if (!isUndefined$1(disconnectedCallback)) {
4004
- if (profilerEnabled$3) {
4005
- logOperationStart(OperationId.disconnectedCallback, vm);
4006
- }
4007
- invokeComponentCallback(vm, disconnectedCallback);
4008
- if (profilerEnabled$3) {
4009
- logOperationEnd(OperationId.disconnectedCallback, vm);
4010
- }
4011
- }
4012
- }
4013
- function runShadowChildNodesDisconnectedCallback(vm) {
4014
- var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
4015
- // inserted in reserved order.
4016
- for (var i_18 = vCustomElementCollection.length - 1; i_18 >= 0; i_18 -= 1) {
4017
- var elm = vCustomElementCollection[i_18].elm; // There are two cases where the element could be undefined:
4018
- // * when there is an error during the construction phase, and an error
4019
- // boundary picks it, there is a possibility that the VCustomElement
4020
- // is not properly initialized, and therefore is should be ignored.
4021
- // * when slotted custom element is not used by the element where it is
4022
- // slotted into it, as a result, the custom element was never
4023
- // initialized.
4024
- if (!isUndefined$1(elm)) {
4025
- var childVM = getAssociatedVMIfPresent(elm); // The VM associated with the element might be associated undefined
4026
- // in the case where the VM failed in the middle of its creation,
4027
- // eg: constructor throwing before invoking super().
4028
- if (!isUndefined$1(childVM)) {
4029
- resetComponentStateWhenRemoved(childVM);
4030
- }
4031
- }
4032
- }
4033
- }
4034
- function runLightChildNodesDisconnectedCallback(vm) {
4035
- var adoptedChildren = vm.aChildren;
4036
- recursivelyDisconnectChildren(adoptedChildren);
4037
- }
4038
- /**
4039
- * The recursion doesn't need to be a complete traversal of the vnode graph,
4040
- * instead it can be partial, when a custom element vnode is found, we don't
4041
- * need to continue into its children because by attempting to disconnect the
4042
- * custom element itself will trigger the removal of anything slotted or anything
4043
- * defined on its shadow.
4044
- */
4045
- function recursivelyDisconnectChildren(vnodes) {
4046
- for (var i_19 = 0, len = vnodes.length; i_19 < len; i_19 += 1) {
4047
- var vnode = vnodes[i_19];
4048
- if (!isNull$1(vnode) && isArray$2(vnode.children) && !isUndefined$1(vnode.elm)) {
4049
- // vnode is a VElement with children
4050
- if (isUndefined$1(vnode.ctor)) {
4051
- // it is a VElement, just keep looking (recursively)
4052
- recursivelyDisconnectChildren(vnode.children);
4053
- }
4054
- else {
4055
- // it is a VCustomElement, disconnect it and ignore its children
4056
- resetComponentStateWhenRemoved(getAssociatedVM(vnode.elm));
4057
- }
4058
- }
4059
- }
4060
- } // This is a super optimized mechanism to remove the content of the shadowRoot without having to go
4061
- // into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
4062
- // children VNodes might not be representing the current state of the DOM.
4063
- function resetShadowRoot(vm) {
4064
- var children = vm.children, cmpRoot = vm.cmpRoot, renderer = vm.renderer;
4065
- for (var i_20 = 0, len = children.length; i_20 < len; i_20++) {
4066
- var child = children[i_20];
4067
- if (!isNull$1(child) && !isUndefined$1(child.elm)) {
4068
- renderer.remove(child.elm, cmpRoot);
4069
- }
4070
- }
4071
- vm.children = EmptyArray;
4072
- runShadowChildNodesDisconnectedCallback(vm);
4073
- vm.velements = EmptyArray;
4074
- }
4075
- function scheduleRehydration(vm) {
4076
- if (isTrue$1$1(vm.renderer.ssr) || isTrue$1$1(vm.isScheduled)) {
4077
- return;
4078
- }
4079
- vm.isScheduled = true;
4080
- if (rehydrateQueue.length === 0) {
4081
- addCallbackToNextTick(flushRehydrationQueue);
4082
- }
4083
- ArrayPush$1.call(rehydrateQueue, vm);
4084
- }
4085
- function getErrorBoundaryVM(vm) {
4086
- var currentVm = vm;
4087
- while (!isNull$1(currentVm)) {
4088
- if (!isUndefined$1(currentVm.def.errorCallback)) {
4089
- return currentVm;
4090
- }
4091
- currentVm = currentVm.owner;
4092
- }
4093
- } // slow path routine
4094
- // NOTE: we should probably more this routine to the synthetic shadow folder
4095
- // and get the allocation to be cached by in the elm instead of in the VM
4096
- function allocateInSlot(vm, children) {
4097
- var oldSlots = vm.cmpSlots;
4098
- var cmpSlots = vm.cmpSlots = create$1(null);
4099
- for (var i_21 = 0, len = children.length; i_21 < len; i_21 += 1) {
4100
- var vnode = children[i_21];
4101
- if (isNull$1(vnode)) {
4102
- continue;
4103
- }
4104
- var data = vnode.data;
4105
- var slotName = data.attrs && data.attrs.slot || '';
4106
- var vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot
4107
- // which might have similar keys. Each vnode will always have a key that
4108
- // starts with a numeric character from compiler. In this case, we add a unique
4109
- // notation for slotted vnodes keys, e.g.: `@foo:1:1`
4110
- if (!isUndefined$1(vnode.key)) {
4111
- vnode.key = "@" + slotName + ":" + vnode.key;
4112
- }
4113
- ArrayPush$1.call(vnodes, vnode);
4114
- }
4115
- if (isFalse$1$1(vm.isDirty)) {
4116
- // We need to determine if the old allocation is really different from the new one
4117
- // and mark the vm as dirty
4118
- var oldKeys = keys$1(oldSlots);
4119
- if (oldKeys.length !== keys$1(cmpSlots).length) {
4120
- markComponentAsDirty(vm);
4121
- return;
4122
- }
4123
- for (var i_22 = 0, len = oldKeys.length; i_22 < len; i_22 += 1) {
4124
- var key = oldKeys[i_22];
4125
- if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
4126
- markComponentAsDirty(vm);
4127
- return;
4128
- }
4129
- var oldVNodes = oldSlots[key];
4130
- var vnodes = cmpSlots[key];
4131
- for (var j = 0, a = cmpSlots[key].length; j < a; j += 1) {
4132
- if (oldVNodes[j] !== vnodes[j]) {
4133
- markComponentAsDirty(vm);
4134
- return;
4135
- }
4136
- }
4137
- }
4138
- }
4139
- }
4140
- function runWithBoundaryProtection(vm, owner, pre, job, post) {
4141
- var error;
4142
- pre();
4143
- try {
4144
- job();
4145
- }
4146
- catch (e) {
4147
- error = Object(e);
4148
- }
4149
- finally {
4150
- post();
4151
- if (!isUndefined$1(error)) {
4152
- addErrorComponentStack(vm, error);
4153
- var errorBoundaryVm = isNull$1(owner) ? undefined : getErrorBoundaryVM(owner);
4154
- if (isUndefined$1(errorBoundaryVm)) {
4155
- throw error; // eslint-disable-line no-unsafe-finally
4156
- }
4157
- resetShadowRoot(vm); // remove offenders
4158
- if (profilerEnabled$3) {
4159
- logOperationStart(OperationId.errorCallback, vm);
4160
- } // error boundaries must have an ErrorCallback
4161
- var errorCallback = errorBoundaryVm.def.errorCallback;
4162
- invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
4163
- if (profilerEnabled$3) {
4164
- logOperationEnd(OperationId.errorCallback, vm);
4165
- }
4166
- }
4167
- }
4168
- }
4169
- /*
4170
- * Copyright (c) 2018, salesforce.com, inc.
4171
- * All rights reserved.
4172
- * SPDX-License-Identifier: MIT
4173
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4174
- */
4175
- var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
4176
- var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
4177
- var WireMetaMap = new Map();
4178
- function noop$4() { }
4179
- var WireContextRegistrationEvent = /** @class */ (function (_super) {
4180
- __extends(WireContextRegistrationEvent, _super);
4181
- function WireContextRegistrationEvent(adapterToken, _b) {
4182
- var setNewContext = _b.setNewContext, setDisconnectedCallback = _b.setDisconnectedCallback;
4183
- var _this = _super.call(this, adapterToken, {
4184
- bubbles: true,
4185
- composed: true
4186
- }) || this;
4187
- defineProperties$1(_this, {
4188
- setNewContext: {
4189
- value: setNewContext
4190
- },
4191
- setDisconnectedCallback: {
4192
- value: setDisconnectedCallback
4193
- }
4194
- });
4195
- return _this;
4196
- }
4197
- return WireContextRegistrationEvent;
4198
- }(CustomEvent));
4199
- function createFieldDataCallback(vm, name) {
4200
- var cmpFields = vm.cmpFields;
4201
- return function (value) {
4202
- if (value !== vm.cmpFields[name]) {
4203
- // storing the value in the underlying storage
4204
- cmpFields[name] = value;
4205
- componentValueMutated(vm, name);
4206
- }
4207
- };
4208
- }
4209
- function createMethodDataCallback(vm, method) {
4210
- return function (value) {
4211
- // dispatching new value into the wired method
4212
- runWithBoundaryProtection(vm, vm.owner, noop$4, function () {
4213
- // job
4214
- method.call(vm.component, value);
4215
- }, noop$4);
4216
- };
4217
- }
4218
- function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
4219
- var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
4220
- var ro = new ReactiveObserver(function () {
4221
- if (hasPendingConfig === false) {
4222
- hasPendingConfig = true; // collect new config in the micro-task
4223
- Promise.resolve().then(function () {
4224
- hasPendingConfig = false; // resetting current reactive params
4225
- ro.reset(); // dispatching a new config due to a change in the configuration
4226
- computeConfigAndUpdate();
4227
- });
4228
- }
4229
- });
4230
- var computeConfigAndUpdate = function () {
4231
- var config;
4232
- ro.observe(function () { return config = configCallback(component); }); // eslint-disable-next-line lwc-internal/no-invalid-todo
4233
- // TODO: dev-mode validation of config based on the adapter.configSchema
4234
- // @ts-ignore it is assigned in the observe() callback
4235
- callbackWhenConfigIsReady(config);
4236
- };
4237
- return {
4238
- computeConfigAndUpdate: computeConfigAndUpdate,
4239
- ro: ro
4240
- };
4241
- }
4242
- function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
4243
- var adapter = wireDef.adapter;
4244
- var adapterContextToken = getAdapterToken(adapter);
4245
- if (isUndefined$1(adapterContextToken)) {
4246
- return; // no provider found, nothing to be done
4247
- }
4248
- var elm = vm.elm, renderer = vm.renderer, _b = vm.context, wiredConnecting = _b.wiredConnecting, wiredDisconnecting = _b.wiredDisconnecting; // waiting for the component to be connected to formally request the context via the token
4249
- ArrayPush$1.call(wiredConnecting, function () {
4250
- // This event is responsible for connecting the host element with another
4251
- // element in the composed path that is providing contextual data. The provider
4252
- // must be listening for a special dom event with the name corresponding to the value of
4253
- // `adapterContextToken`, which will remain secret and internal to this file only to
4254
- // guarantee that the linkage can be forged.
4255
- var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
4256
- setNewContext: function (newContext) {
4257
- // eslint-disable-next-line lwc-internal/no-invalid-todo
4258
- // TODO: dev-mode validation of config based on the adapter.contextSchema
4259
- callbackWhenContextIsReady(newContext);
4260
- },
4261
- setDisconnectedCallback: function (disconnectCallback) {
4262
- // adds this callback into the disconnect bucket so it gets disconnected from parent
4263
- // the the element hosting the wire is disconnected
4264
- ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
4265
- }
4266
- });
4267
- renderer.dispatchEvent(elm, contextRegistrationEvent);
4268
- });
4269
- }
4270
- function createConnector(vm, name, wireDef) {
4271
- var method = wireDef.method, adapter = wireDef.adapter, configCallback = wireDef.configCallback, dynamic = wireDef.dynamic;
4272
- var dataCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
4273
- var context;
4274
- var connector; // Workaround to pass the component element associated to this wire adapter instance.
4275
- defineProperty$1(dataCallback, DeprecatedWiredElementHost, {
4276
- value: vm.elm
4277
- });
4278
- defineProperty$1(dataCallback, DeprecatedWiredParamsMeta, {
4279
- value: dynamic
4280
- });
4281
- runWithBoundaryProtection(vm, vm, noop$4, function () {
4282
- // job
4283
- connector = new adapter(dataCallback);
4284
- }, noop$4);
4285
- var updateConnectorConfig = function (config) {
4286
- // every time the config is recomputed due to tracking,
4287
- // this callback will be invoked with the new computed config
4288
- runWithBoundaryProtection(vm, vm, noop$4, function () {
4289
- // job
4290
- connector.update(config, context);
4291
- }, noop$4);
4292
- }; // Computes the current wire config and calls the update method on the wire adapter.
4293
- // If it has params, we will need to observe changes in the next tick.
4294
- var _b = createConfigWatcher(vm.component, configCallback, updateConnectorConfig), computeConfigAndUpdate = _b.computeConfigAndUpdate, ro = _b.ro; // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
4295
- if (!isUndefined$1(adapter.contextSchema)) {
4296
- createContextWatcher(vm, wireDef, function (newContext) {
4297
- // every time the context is pushed into this component,
4298
- // this callback will be invoked with the new computed context
4299
- if (context !== newContext) {
4300
- context = newContext; // Note: when new context arrives, the config will be recomputed and pushed along side the new
4301
- // context, this is to preserve the identity characteristics, config should not have identity
4302
- // (ever), while context can have identity
4303
- if (vm.state === VMState.connected) {
4304
- computeConfigAndUpdate();
4305
- }
4306
- }
4307
- });
4308
- }
4309
- return {
4310
- // @ts-ignore the boundary protection executes sync, connector is always defined
4311
- connector: connector,
4312
- computeConfigAndUpdate: computeConfigAndUpdate,
4313
- resetConfigWatcher: function () { return ro.reset(); }
4314
- };
4315
- }
4316
- var AdapterToTokenMap = new Map();
4317
- function getAdapterToken(adapter) {
4318
- return AdapterToTokenMap.get(adapter);
4319
- }
4320
- function setAdapterToken(adapter, token) {
4321
- AdapterToTokenMap.set(adapter, token);
4322
- }
4323
- function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
4324
- // support for callable adapters
4325
- if (adapter.adapter) {
4326
- adapter = adapter.adapter;
4327
- }
4328
- var method = descriptor.value;
4329
- var def = {
4330
- adapter: adapter,
4331
- method: method,
4332
- configCallback: configCallback,
4333
- dynamic: dynamic
4334
- };
4335
- WireMetaMap.set(descriptor, def);
4336
- }
4337
- function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
4338
- // support for callable adapters
4339
- if (adapter.adapter) {
4340
- adapter = adapter.adapter;
4341
- }
4342
- var def = {
4343
- adapter: adapter,
4344
- configCallback: configCallback,
4345
- dynamic: dynamic
4346
- };
4347
- WireMetaMap.set(descriptor, def);
4348
- }
4349
- function installWireAdapters(vm) {
4350
- var context = vm.context, wire = vm.def.wire;
4351
- var wiredConnecting = context.wiredConnecting = [];
4352
- var wiredDisconnecting = context.wiredDisconnecting = [];
4353
- var _loop_1 = function (fieldNameOrMethod) {
4354
- var descriptor = wire[fieldNameOrMethod];
4355
- var wireDef = WireMetaMap.get(descriptor);
4356
- if (!isUndefined$1(wireDef)) {
4357
- var _b = createConnector(vm, fieldNameOrMethod, wireDef), connector_1 = _b.connector, computeConfigAndUpdate_1 = _b.computeConfigAndUpdate, resetConfigWatcher_1 = _b.resetConfigWatcher;
4358
- var hasDynamicParams_1 = wireDef.dynamic.length > 0;
4359
- ArrayPush$1.call(wiredConnecting, function () {
4360
- connector_1.connect();
4361
- if (hasDynamicParams_1) {
4362
- Promise.resolve().then(computeConfigAndUpdate_1);
4363
- }
4364
- else {
4365
- computeConfigAndUpdate_1();
4366
- }
4367
- });
4368
- ArrayPush$1.call(wiredDisconnecting, function () {
4369
- connector_1.disconnect();
4370
- resetConfigWatcher_1();
4371
- });
4372
- }
4373
- };
4374
- for (var fieldNameOrMethod in wire) {
4375
- _loop_1(fieldNameOrMethod);
4376
- }
4377
- }
4378
- function connectWireAdapters(vm) {
4379
- var wiredConnecting = vm.context.wiredConnecting;
4380
- for (var i_23 = 0, len = wiredConnecting.length; i_23 < len; i_23 += 1) {
4381
- wiredConnecting[i_23]();
4382
- }
4383
- }
4384
- function disconnectWireAdapters(vm) {
4385
- var wiredDisconnecting = vm.context.wiredDisconnecting;
4386
- runWithBoundaryProtection(vm, vm, noop$4, function () {
4387
- // job
4388
- for (var i_24 = 0, len = wiredDisconnecting.length; i_24 < len; i_24 += 1) {
4389
- wiredDisconnecting[i_24]();
4390
- }
4391
- }, noop$4);
4392
- }
4393
- /*
4394
- * Copyright (c) 2018, salesforce.com, inc.
4395
- * All rights reserved.
4396
- * SPDX-License-Identifier: MIT
4397
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4398
- */
4399
- function createContextProvider(adapter) {
4400
- var adapterContextToken = getAdapterToken(adapter);
4401
- if (!isUndefined$1(adapterContextToken)) {
4402
- throw new Error("Adapter already has a context provider.");
4403
- }
4404
- adapterContextToken = guid();
4405
- setAdapterToken(adapter, adapterContextToken);
4406
- var providers = new WeakSet();
4407
- return function (elm, options) {
4408
- if (providers.has(elm)) {
4409
- throw new Error("Adapter was already installed on " + elm + ".");
4410
- }
4411
- providers.add(elm);
4412
- var consumerConnectedCallback = options.consumerConnectedCallback, consumerDisconnectedCallback = options.consumerDisconnectedCallback;
4413
- elm.addEventListener(adapterContextToken, function (evt) {
4414
- var setNewContext = evt.setNewContext, setDisconnectedCallback = evt.setDisconnectedCallback;
4415
- var consumer = {
4416
- provide: function (newContext) {
4417
- setNewContext(newContext);
4418
- }
4419
- };
4420
- var disconnectCallback = function () {
4421
- if (!isUndefined$1(consumerDisconnectedCallback)) {
4422
- consumerDisconnectedCallback(consumer);
4423
- }
4424
- };
4425
- setDisconnectedCallback(disconnectCallback);
4426
- consumerConnectedCallback(consumer);
4427
- evt.stopImmediatePropagation();
4428
- });
4429
- };
4430
- }
4431
- /*
4432
- * Copyright (c) 2018, salesforce.com, inc.
4433
- * All rights reserved.
4434
- * SPDX-License-Identifier: MIT
4435
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4436
- */
4437
- /**
4438
- * EXPERIMENTAL: This function allows you to create a reactive readonly
4439
- * membrane around any object value. This API is subject to change or
4440
- * being removed.
4441
- */
4442
- function readonly(obj) {
4443
- return reactiveMembrane.getReadOnlyProxy(obj);
4444
- }
4445
- /* version: 1.17.8 */
4446
- /*
4447
- * Copyright (c) 2018, salesforce.com, inc.
4448
- * All rights reserved.
4449
- * SPDX-License-Identifier: MIT
4450
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4451
- */
4452
- var globalStylesheets = create(null);
4453
- var globalStylesheetsParentElement = document.head || document.body || document;
4454
- var getCustomElement, defineCustomElement, HTMLElementConstructor$1;
4455
- function isCustomElementRegistryAvailable() {
4456
- if (typeof customElements === 'undefined') {
4457
- return false;
4458
- }
4459
- try {
4460
- // dereference HTMLElement global because babel wraps globals in compat mode with a
4461
- // _wrapNativeSuper()
4462
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElement which does not
4463
- // get wrapped by babel.
4464
- var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
4465
- // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
4466
- // which are not equipped to be initialized that way.
4467
- var clazz = /** @class */ (function (_super) {
4468
- __extends(clazz, _super);
4469
- function clazz() {
4470
- return _super !== null && _super.apply(this, arguments) || this;
4471
- }
4472
- return clazz;
4473
- }(HTMLElementAlias));
4474
- customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
4475
- new clazz();
4476
- return true;
4477
- }
4478
- catch (_a) {
4479
- return false;
4480
- }
4481
- }
4482
- if (isCustomElementRegistryAvailable()) {
4483
- getCustomElement = customElements.get.bind(customElements);
4484
- defineCustomElement = customElements.define.bind(customElements);
4485
- HTMLElementConstructor$1 = HTMLElement;
4486
- }
4487
- else {
4488
- var registry_1 = create(null);
4489
- var reverseRegistry_1 = new WeakMap();
4490
- defineCustomElement = function define(name, ctor) {
4491
- if (name !== StringToLowerCase.call(name) || registry_1[name]) {
4492
- throw new TypeError("Invalid Registration");
4493
- }
4494
- registry_1[name] = ctor;
4495
- reverseRegistry_1.set(ctor, name);
4496
- };
4497
- getCustomElement = function get(name) {
4498
- return registry_1[name];
4499
- };
4500
- HTMLElementConstructor$1 = function HTMLElement() {
4501
- if (!(this instanceof HTMLElement)) {
4502
- throw new TypeError("Invalid Invocation");
4503
- }
4504
- var constructor = this.constructor;
4505
- var name = reverseRegistry_1.get(constructor);
4506
- if (!name) {
4507
- throw new TypeError("Invalid Construction");
4508
- }
4509
- var elm = document.createElement(name);
4510
- setPrototypeOf(elm, constructor.prototype);
4511
- return elm;
4512
- };
4513
- HTMLElementConstructor$1.prototype = HTMLElement.prototype;
4514
- } // TODO [#0]: Evaluate how we can extract the `$shadowToken$` property name in a shared package
4515
- // to avoid having to synchronize it between the different modules.
4516
- var useSyntheticShadow = hasOwnProperty.call(Element.prototype, '$shadowToken$');
4517
- var renderer = {
4518
- ssr: false,
4519
- syntheticShadow: useSyntheticShadow,
4520
- createElement: function (tagName, namespace) {
4521
- return isUndefined(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
4522
- },
4523
- createText: function (content) {
4524
- return document.createTextNode(content);
4525
- },
4526
- insert: function (node, parent, anchor) {
4527
- parent.insertBefore(node, anchor);
4528
- },
4529
- remove: function (node, parent) {
4530
- parent.removeChild(node);
4531
- },
4532
- nextSibling: function (node) {
4533
- return node.nextSibling;
4534
- },
4535
- attachShadow: function (element, options) {
4536
- return element.attachShadow(options);
4537
- },
4538
- setText: function (node, content) {
4539
- node.nodeValue = content;
4540
- },
4541
- getProperty: function (node, key) {
4542
- return node[key];
4543
- },
4544
- setProperty: function (node, key, value) {
4545
- node[key] = value;
4546
- },
4547
- getAttribute: function (element, name, namespace) {
4548
- return isUndefined(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
4549
- },
4550
- setAttribute: function (element, name, value, namespace) {
4551
- return isUndefined(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
4552
- },
4553
- removeAttribute: function (element, name, namespace) {
4554
- if (isUndefined(namespace)) {
4555
- element.removeAttribute(name);
4556
- }
4557
- else {
4558
- element.removeAttributeNS(namespace, name);
4559
- }
4560
- },
4561
- addEventListener: function (target, type, callback, options) {
4562
- target.addEventListener(type, callback, options);
4563
- },
4564
- removeEventListener: function (target, type, callback, options) {
4565
- target.removeEventListener(type, callback, options);
4566
- },
4567
- dispatchEvent: function (target, event) {
4568
- return target.dispatchEvent(event);
4569
- },
4570
- getClassList: function (element) {
4571
- return element.classList;
4572
- },
4573
- setCSSStyleProperty: function (element, name, value) {
4574
- // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
4575
- // represent elements in the engine?
4576
- element.style.setProperty(name, value);
4577
- },
4578
- getBoundingClientRect: function (element) {
4579
- return element.getBoundingClientRect();
4580
- },
4581
- querySelector: function (element, selectors) {
4582
- return element.querySelector(selectors);
4583
- },
4584
- querySelectorAll: function (element, selectors) {
4585
- return element.querySelectorAll(selectors);
4586
- },
4587
- getElementsByTagName: function (element, tagNameOrWildCard) {
4588
- return element.getElementsByTagName(tagNameOrWildCard);
4589
- },
4590
- getElementsByClassName: function (element, names) {
4591
- return element.getElementsByClassName(names);
4592
- },
4593
- isConnected: function (node) {
4594
- return node.isConnected;
4595
- },
4596
- insertGlobalStylesheet: function (content) {
4597
- if (!isUndefined(globalStylesheets[content])) {
4598
- return;
4599
- }
4600
- globalStylesheets[content] = true;
4601
- var elm = document.createElement('style');
4602
- elm.type = 'text/css';
4603
- elm.textContent = content;
4604
- globalStylesheetsParentElement.appendChild(elm);
4605
- },
4606
- assertInstanceOfHTMLElement: function (elm, msg) {
4607
- assert.invariant(elm instanceof HTMLElement, msg);
4608
- },
4609
- defineCustomElement: defineCustomElement,
4610
- getCustomElement: getCustomElement,
4611
- HTMLElement: HTMLElementConstructor$1
4612
- };
4613
- /*
4614
- * Copyright (c) 2018, salesforce.com, inc.
4615
- * All rights reserved.
4616
- * SPDX-License-Identifier: MIT
4617
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4618
- */
4619
- /**
4620
- * This function builds a Web Component class from a LWC constructor so it can be
4621
- * registered as a new element via customElements.define() at any given time.
4622
- *
4623
- * @deprecated since version 1.3.11
4624
- *
4625
- * @example
4626
- * ```
4627
- * import { buildCustomElementConstructor } from 'lwc';
4628
- * import Foo from 'ns/foo';
4629
- * const WC = buildCustomElementConstructor(Foo);
4630
- * customElements.define('x-foo', WC);
4631
- * const elm = document.createElement('x-foo');
4632
- * ```
4633
- */
4634
- function deprecatedBuildCustomElementConstructor(Ctor) {
4635
- return Ctor.CustomElementConstructor;
4636
- }
4637
- function buildCustomElementConstructor(Ctor) {
4638
- var def = getComponentInternalDef(Ctor);
4639
- return /** @class */ (function (_super) {
4640
- __extends(class_1, _super);
4641
- function class_1() {
4642
- var _this = _super.call(this) || this;
4643
- createVM(_this, def, {
4644
- mode: 'open',
4645
- owner: null,
4646
- tagName: _this.tagName,
4647
- renderer: renderer
4648
- });
4649
- return _this;
4650
- }
4651
- class_1.prototype.connectedCallback = function () {
4652
- connectRootElement(this);
4653
- };
4654
- class_1.prototype.disconnectedCallback = function () {
4655
- disconnectRootElement(this);
4656
- };
4657
- return class_1;
4658
- }(def.bridge));
4659
- }
4660
- /*
4661
- * Copyright (c) 2018, salesforce.com, inc.
4662
- * All rights reserved.
4663
- * SPDX-License-Identifier: MIT
4664
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4665
- */
4666
- var ConnectingSlot = createHiddenField('connecting', 'engine');
4667
- var DisconnectingSlot = createHiddenField('disconnecting', 'engine');
4668
- function callNodeSlot(node, slot) {
4669
- var fn = getHiddenField(node, slot);
4670
- if (!isUndefined(fn)) {
4671
- fn(node);
4672
- }
4673
- return node; // for convenience
4674
- } // Monkey patching Node methods to be able to detect the insertions and removal of root elements
4675
- // created via createElement.
4676
- var _l = Node.prototype, appendChild = _l.appendChild, insertBefore = _l.insertBefore, removeChild = _l.removeChild, replaceChild = _l.replaceChild;
4677
- assign(Node.prototype, {
4678
- appendChild: function (newChild) {
4679
- var appendedNode = appendChild.call(this, newChild);
4680
- return callNodeSlot(appendedNode, ConnectingSlot);
4681
- },
4682
- insertBefore: function (newChild, referenceNode) {
4683
- var insertedNode = insertBefore.call(this, newChild, referenceNode);
4684
- return callNodeSlot(insertedNode, ConnectingSlot);
4685
- },
4686
- removeChild: function (oldChild) {
4687
- var removedNode = removeChild.call(this, oldChild);
4688
- return callNodeSlot(removedNode, DisconnectingSlot);
4689
- },
4690
- replaceChild: function (newChild, oldChild) {
4691
- var replacedNode = replaceChild.call(this, newChild, oldChild);
4692
- callNodeSlot(replacedNode, DisconnectingSlot);
4693
- callNodeSlot(newChild, ConnectingSlot);
4694
- return replacedNode;
4695
- }
4696
- });
4697
- /**
4698
- * EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
4699
- * difference that in the options, you can pass the `is` property set to a Constructor instead of
4700
- * just a string value. The intent is to allow the creation of an element controlled by LWC without
4701
- * having to register the element as a custom element.
4702
- *
4703
- * @example
4704
- * ```
4705
- * const el = createElement('x-foo', { is: FooCtor });
4706
- * ```
4707
- */
4708
- function createElement(sel, options) {
4709
- if (!isObject$1(options) || isNull(options)) {
4710
- throw new TypeError("\"createElement\" function expects an object as second parameter but received \"" + toString(options) + "\".");
4711
- }
4712
- var Ctor = options.is;
4713
- if (!isFunction(Ctor)) {
4714
- throw new TypeError("\"createElement\" function expects an \"is\" option with a valid component constructor.");
4715
- }
4716
- var UpgradableConstructor = getUpgradableConstructor(sel, renderer);
4717
- var wasComponentUpgraded = false; // the custom element from the registry is expecting an upgrade callback
4718
- /**
4719
- * Note: if the upgradable constructor does not expect, or throw when we new it
4720
- * with a callback as the first argument, we could implement a more advanced
4721
- * mechanism that only passes that argument if the constructor is known to be
4722
- * an upgradable custom element.
4723
- */
4724
- var element = new UpgradableConstructor(function (elm) {
4725
- var def = getComponentInternalDef(Ctor);
4726
- createVM(elm, def, {
4727
- tagName: sel,
4728
- mode: options.mode !== 'closed' ? 'open' : 'closed',
4729
- owner: null,
4730
- renderer: renderer
4731
- });
4732
- setHiddenField(elm, ConnectingSlot, connectRootElement);
4733
- setHiddenField(elm, DisconnectingSlot, disconnectRootElement);
4734
- wasComponentUpgraded = true;
4735
- });
4736
- if (!wasComponentUpgraded) {
4737
- /* eslint-disable-next-line no-console */
4738
- console.error("Unexpected tag name \"" + sel + "\". This name is a registered custom element, preventing LWC to upgrade the element.");
4739
- }
4740
- return element;
4741
- }
4742
- /*
4743
- * Copyright (c) 2018, salesforce.com, inc.
4744
- * All rights reserved.
4745
- * SPDX-License-Identifier: MIT
4746
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4747
- */
4748
- /**
4749
- * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
4750
- * This API is subject to change or being removed.
4751
- */
4752
- function getComponentConstructor(elm) {
4753
- var ctor = null;
4754
- if (elm instanceof HTMLElement) {
4755
- var vm = getAssociatedVMIfPresent(elm);
4756
- if (!isUndefined(vm)) {
4757
- ctor = vm.def.ctor;
4758
- }
4759
- }
4760
- return ctor;
4761
- }
4762
- /*
4763
- * Copyright (c) 2018, salesforce.com, inc.
4764
- * All rights reserved.
4765
- * SPDX-License-Identifier: MIT
4766
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4767
- */
4768
- /**
4769
- * EXPERIMENTAL: This function detects whether or not a Node is controlled by a LWC template. This
4770
- * API is subject to change or being removed.
4771
- */
4772
- function isNodeFromTemplate(node) {
4773
- if (isFalse$1(node instanceof Node)) {
4774
- return false;
4775
- } // TODO [#1250]: skipping the shadowRoot instances itself makes no sense, we need to revisit
4776
- // this with locker
4777
- if (node instanceof ShadowRoot) {
4778
- return false;
4779
- }
4780
- if (useSyntheticShadow) {
4781
- // TODO [#1252]: old behavior that is still used by some pieces of the platform,
4782
- // specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
4783
- // used, will be considered global elements.
4784
- if (isUndefined(node.$shadowResolver$)) {
4785
- return false;
4786
- }
4787
- }
4788
- var root = node.getRootNode();
4789
- return root instanceof ShadowRoot;
4790
- }
4791
- /*
4792
- * Copyright (c) 2018, salesforce.com, inc.
4793
- * All rights reserved.
4794
- * SPDX-License-Identifier: MIT
4795
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4796
- */
4797
- var ComponentConstructorToCustomElementConstructorMap = new Map();
4798
- function getCustomElementConstructor(Ctor) {
4799
- if (Ctor === BaseLightningElement) {
4800
- throw new TypeError("Invalid Constructor. LightningElement base class can't be claimed as a custom element.");
4801
- }
4802
- var ce = ComponentConstructorToCustomElementConstructorMap.get(Ctor);
4803
- if (isUndefined(ce)) {
4804
- ce = buildCustomElementConstructor(Ctor);
4805
- ComponentConstructorToCustomElementConstructorMap.set(Ctor, ce);
4806
- }
4807
- return ce;
4808
- }
4809
- /**
4810
- * This static getter builds a Web Component class from a LWC constructor so it can be registered
4811
- * as a new element via customElements.define() at any given time. E.g.:
4812
- *
4813
- * import Foo from 'ns/foo';
4814
- * customElements.define('x-foo', Foo.CustomElementConstructor);
4815
- * const elm = document.createElement('x-foo');
4816
- *
4817
- */
4818
- defineProperty(BaseLightningElement, 'CustomElementConstructor', {
4819
- get: function () {
4820
- return getCustomElementConstructor(this);
4821
- }
4822
- });
4823
- freeze(BaseLightningElement);
4824
- seal(BaseLightningElement.prototype);
4825
- /* version: 1.17.8 */
4826
-
4827
- exports.LightningElement = BaseLightningElement;
4828
- exports.__unstable__ProfilerControl = profilerControl;
4829
- exports.api = api;
4830
- exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
4831
- exports.createContextProvider = createContextProvider;
4832
- exports.createElement = createElement;
4833
- exports.getComponentConstructor = getComponentConstructor;
4834
- exports.getComponentDef = getComponentDef;
4835
- exports.isComponentConstructor = isComponentConstructor;
4836
- exports.isNodeFromTemplate = isNodeFromTemplate;
4837
- exports.readonly = readonly;
4838
- exports.register = register;
4839
- exports.registerComponent = registerComponent;
4840
- exports.registerDecorators = registerDecorators;
4841
- exports.registerTemplate = registerTemplate;
4842
- exports.sanitizeAttribute = sanitizeAttribute;
4843
- exports.setFeatureFlag = setFeatureFlag;
4844
- exports.setFeatureFlagForTest = setFeatureFlagForTest;
4845
- exports.swapComponent = swapComponent;
4846
- exports.swapStyle = swapStyle;
4847
- exports.swapTemplate = swapTemplate;
4848
- exports.track = track;
4849
- exports.unwrap = unwrap$1;
4850
- exports.wire = wire;
4851
-
4852
- Object.defineProperty(exports, '__esModule', { value: true });
4853
-
4854
- return exports;
4855
-
4856
- }({}));