@maggioli-design-system/mds-table-row 4.5.2 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-97006570.js +1198 -0
  3. package/dist/cjs/loader.cjs.js +4 -2
  4. package/dist/cjs/mds-table-row.cjs.entry.js +5 -4
  5. package/dist/cjs/mds-table-row.cjs.js +12 -10
  6. package/dist/collection/collection-manifest.json +2 -2
  7. package/dist/collection/common/locale.js +50 -0
  8. package/dist/collection/components/mds-table-row/mds-table-row.css +159 -39
  9. package/dist/collection/components/mds-table-row/mds-table-row.js +1 -1
  10. package/dist/collection/type/preference.js +1 -0
  11. package/dist/collection/type/variant-file-format.js +20 -11
  12. package/dist/components/mds-table-row.js +4 -3
  13. package/dist/documentation.d.ts +34 -0
  14. package/dist/documentation.json +3 -3
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/index-ac4b33c0.js +1171 -0
  17. package/dist/esm/loader.js +5 -3
  18. package/dist/esm/mds-table-row.entry.js +5 -4
  19. package/dist/esm/mds-table-row.js +13 -11
  20. package/dist/esm-es5/app-globals-0f993ce5.js +1 -0
  21. package/dist/esm-es5/index-ac4b33c0.js +1 -0
  22. package/dist/esm-es5/loader.js +1 -1
  23. package/dist/esm-es5/mds-table-row.entry.js +1 -1
  24. package/dist/esm-es5/mds-table-row.js +1 -1
  25. package/dist/mds-table-row/mds-table-row.esm.js +1 -1
  26. package/dist/mds-table-row/mds-table-row.js +1 -1
  27. package/dist/mds-table-row/p-0a6d4960.js +2 -0
  28. package/dist/mds-table-row/p-11e2454f.system.js +1 -0
  29. package/dist/mds-table-row/p-24249845.entry.js +1 -0
  30. package/dist/mds-table-row/p-56ba5cbf.system.js +1 -0
  31. package/dist/mds-table-row/p-778c4fcb.system.entry.js +1 -0
  32. package/dist/mds-table-row/p-bc92b059.system.js +2 -0
  33. package/dist/mds-table-row/p-e1255160.js +1 -0
  34. package/dist/stats.json +45 -33
  35. package/dist/types/common/locale.d.ts +15 -0
  36. package/dist/types/stencil-public-runtime.d.ts +3 -10
  37. package/dist/types/type/preference.d.ts +2 -0
  38. package/documentation.json +53 -23
  39. package/loader/cdn.js +1 -2
  40. package/loader/index.cjs.js +1 -2
  41. package/loader/index.d.ts +3 -0
  42. package/loader/index.es2017.js +1 -2
  43. package/loader/index.js +1 -2
  44. package/package.json +4 -4
  45. package/src/common/locale.ts +66 -0
  46. package/src/components/mds-table-row/css/mds-table-row-pref-animation.css +16 -0
  47. package/src/components/mds-table-row/mds-table-row.css +14 -0
  48. package/src/fixtures/icons.json +30 -0
  49. package/src/fixtures/iconsauce.json +21 -0
  50. package/src/tailwind/components.css +71 -0
  51. package/src/type/preference.ts +10 -0
  52. package/src/type/variant-file-format.ts +20 -11
  53. package/www/build/mds-table-row.esm.js +1 -1
  54. package/www/build/mds-table-row.js +1 -1
  55. package/www/build/p-0a6d4960.js +2 -0
  56. package/www/build/p-11e2454f.system.js +1 -0
  57. package/www/build/p-24249845.entry.js +1 -0
  58. package/www/build/p-56ba5cbf.system.js +1 -0
  59. package/www/build/p-778c4fcb.system.entry.js +1 -0
  60. package/www/build/p-bc92b059.system.js +2 -0
  61. package/www/build/p-e1255160.js +1 -0
  62. package/dist/cjs/index-7b6fb148.js +0 -1644
  63. package/dist/esm/index-9f40909f.js +0 -1617
  64. package/dist/esm-es5/index-9f40909f.js +0 -1
  65. package/dist/mds-table-row/p-24e0f761.system.js +0 -2
  66. package/dist/mds-table-row/p-4e5a0559.js +0 -2
  67. package/dist/mds-table-row/p-65fbbba9.system.js +0 -1
  68. package/dist/mds-table-row/p-ab9fb13e.entry.js +0 -1
  69. package/dist/mds-table-row/p-f8b0aa6b.system.entry.js +0 -1
  70. package/www/build/p-24e0f761.system.js +0 -2
  71. package/www/build/p-4e5a0559.js +0 -2
  72. package/www/build/p-65fbbba9.system.js +0 -1
  73. package/www/build/p-ab9fb13e.entry.js +0 -1
  74. package/www/build/p-f8b0aa6b.system.entry.js +0 -1
@@ -1,1644 +0,0 @@
1
- 'use strict';
2
-
3
- function _interopNamespace(e) {
4
- if (e && e.__esModule) return e;
5
- var n = Object.create(null);
6
- if (e) {
7
- Object.keys(e).forEach(function (k) {
8
- if (k !== 'default') {
9
- var d = Object.getOwnPropertyDescriptor(e, k);
10
- Object.defineProperty(n, k, d.get ? d : {
11
- enumerable: true,
12
- get: function () {
13
- return e[k];
14
- }
15
- });
16
- }
17
- });
18
- }
19
- n['default'] = e;
20
- return Object.freeze(n);
21
- }
22
-
23
- const NAMESPACE = 'mds-table-row';
24
-
25
- /**
26
- * Virtual DOM patching algorithm based on Snabbdom by
27
- * Simon Friis Vindum (@paldepind)
28
- * Licensed under the MIT License
29
- * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
30
- *
31
- * Modified for Stencil's renderer and slot projection
32
- */
33
- let scopeId;
34
- let hostTagName;
35
- let isSvgMode = false;
36
- let queuePending = false;
37
- const createTime = (fnName, tagName = '') => {
38
- {
39
- return () => {
40
- return;
41
- };
42
- }
43
- };
44
- const uniqueTime = (key, measureText) => {
45
- {
46
- return () => {
47
- return;
48
- };
49
- }
50
- };
51
- const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
52
- /**
53
- * Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
54
- *
55
- * Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
56
- * support as of Stencil v4.
57
- */
58
- const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
59
- /**
60
- * Default style mode id
61
- */
62
- /**
63
- * Reusable empty obj/array
64
- * Don't add values to these!!
65
- */
66
- const EMPTY_OBJ = {};
67
- const isDef = (v) => v != null;
68
- /**
69
- * Check whether a value is a 'complex type', defined here as an object or a
70
- * function.
71
- *
72
- * @param o the value to check
73
- * @returns whether it's a complex type or not
74
- */
75
- const isComplexType = (o) => {
76
- // https://jsperf.com/typeof-fn-object/5
77
- o = typeof o;
78
- return o === 'object' || o === 'function';
79
- };
80
- /**
81
- * Helper method for querying a `meta` tag that contains a nonce value
82
- * out of a DOM's head.
83
- *
84
- * @param doc The DOM containing the `head` to query against
85
- * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
86
- * exists or the tag has no content.
87
- */
88
- function queryNonceMetaTagContent(doc) {
89
- var _a, _b, _c;
90
- return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
91
- }
92
- /**
93
- * Production h() function based on Preact by
94
- * Jason Miller (@developit)
95
- * Licensed under the MIT License
96
- * https://github.com/developit/preact/blob/master/LICENSE
97
- *
98
- * Modified for Stencil's compiler and vdom
99
- */
100
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
101
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
102
- const h = (nodeName, vnodeData, ...children) => {
103
- let child = null;
104
- let simple = false;
105
- let lastSimple = false;
106
- const vNodeChildren = [];
107
- const walk = (c) => {
108
- for (let i = 0; i < c.length; i++) {
109
- child = c[i];
110
- if (Array.isArray(child)) {
111
- walk(child);
112
- }
113
- else if (child != null && typeof child !== 'boolean') {
114
- if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
115
- child = String(child);
116
- }
117
- if (simple && lastSimple) {
118
- // If the previous child was simple (string), we merge both
119
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
120
- }
121
- else {
122
- // Append a new vNode, if it's text, we create a text vNode
123
- vNodeChildren.push(simple ? newVNode(null, child) : child);
124
- }
125
- lastSimple = simple;
126
- }
127
- }
128
- };
129
- walk(children);
130
- const vnode = newVNode(nodeName, null);
131
- vnode.$attrs$ = vnodeData;
132
- if (vNodeChildren.length > 0) {
133
- vnode.$children$ = vNodeChildren;
134
- }
135
- return vnode;
136
- };
137
- /**
138
- * A utility function for creating a virtual DOM node from a tag and some
139
- * possible text content.
140
- *
141
- * @param tag the tag for this element
142
- * @param text possible text content for the node
143
- * @returns a newly-minted virtual DOM node
144
- */
145
- const newVNode = (tag, text) => {
146
- const vnode = {
147
- $flags$: 0,
148
- $tag$: tag,
149
- $text$: text,
150
- $elm$: null,
151
- $children$: null,
152
- };
153
- {
154
- vnode.$attrs$ = null;
155
- }
156
- return vnode;
157
- };
158
- const Host = {};
159
- /**
160
- * Check whether a given node is a Host node or not
161
- *
162
- * @param node the virtual DOM node to check
163
- * @returns whether it's a Host node or not
164
- */
165
- const isHost = (node) => node && node.$tag$ === Host;
166
- /**
167
- * Parse a new property value for a given property type.
168
- *
169
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
170
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
171
- * 1. `any`, the type given to `propValue` in the function signature
172
- * 2. the type stored from `propType`.
173
- *
174
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
175
- *
176
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
177
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
178
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
179
- * ```tsx
180
- * <my-cmp prop-val={0}></my-cmp>
181
- * ```
182
- *
183
- * HTML prop values on the other hand, will always a string
184
- *
185
- * @param propValue the new value to coerce to some type
186
- * @param propType the type of the prop, expressed as a binary number
187
- * @returns the parsed/coerced value
188
- */
189
- const parsePropertyValue = (propValue, propType) => {
190
- // ensure this value is of the correct prop type
191
- if (propValue != null && !isComplexType(propValue)) {
192
- if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
193
- // per the HTML spec, any string value means it is a boolean true value
194
- // but we'll cheat here and say that the string "false" is the boolean false
195
- return propValue === 'false' ? false : propValue === '' || !!propValue;
196
- }
197
- // redundant return here for better minification
198
- return propValue;
199
- }
200
- // not sure exactly what type we want
201
- // so no need to change to a different type
202
- return propValue;
203
- };
204
- /**
205
- * Helper function to create & dispatch a custom Event on a provided target
206
- * @param elm the target of the Event
207
- * @param name the name to give the custom Event
208
- * @param opts options for configuring a custom Event
209
- * @returns the custom Event
210
- */
211
- const emitEvent = (elm, name, opts) => {
212
- const ev = plt.ce(name, opts);
213
- elm.dispatchEvent(ev);
214
- return ev;
215
- };
216
- const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
217
- const registerStyle = (scopeId, cssText, allowCS) => {
218
- let style = styles.get(scopeId);
219
- if (supportsConstructableStylesheets && allowCS) {
220
- style = (style || new CSSStyleSheet());
221
- if (typeof style === 'string') {
222
- style = cssText;
223
- }
224
- else {
225
- style.replaceSync(cssText);
226
- }
227
- }
228
- else {
229
- style = cssText;
230
- }
231
- styles.set(scopeId, style);
232
- };
233
- const addStyle = (styleContainerNode, cmpMeta, mode) => {
234
- var _a;
235
- const scopeId = getScopeId(cmpMeta);
236
- const style = styles.get(scopeId);
237
- // if an element is NOT connected then getRootNode() will return the wrong root node
238
- // so the fallback is to always use the document for the root node in those cases
239
- styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
240
- if (style) {
241
- if (typeof style === 'string') {
242
- styleContainerNode = styleContainerNode.head || styleContainerNode;
243
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
244
- let styleElm;
245
- if (!appliedStyles) {
246
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
247
- }
248
- if (!appliedStyles.has(scopeId)) {
249
- {
250
- styleElm = doc.createElement('style');
251
- styleElm.innerHTML = style;
252
- // Apply CSP nonce to the style tag if it exists
253
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
254
- if (nonce != null) {
255
- styleElm.setAttribute('nonce', nonce);
256
- }
257
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
258
- }
259
- // Add styles for `slot-fb` elements if we're using slots outside the Shadow DOM
260
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
261
- styleElm.innerHTML += SLOT_FB_CSS;
262
- }
263
- if (appliedStyles) {
264
- appliedStyles.add(scopeId);
265
- }
266
- }
267
- }
268
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
269
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
270
- }
271
- }
272
- return scopeId;
273
- };
274
- const attachStyles = (hostRef) => {
275
- const cmpMeta = hostRef.$cmpMeta$;
276
- const elm = hostRef.$hostElement$;
277
- const flags = cmpMeta.$flags$;
278
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
279
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
280
- if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
281
- // only required when we're NOT using native shadow dom (slot)
282
- // or this browser doesn't support native shadow dom
283
- // and this host element was NOT created with SSR
284
- // let's pick out the inner content for slot projection
285
- // create a node to represent where the original
286
- // content was first placed, which is useful later on
287
- // DOM WRITE!!
288
- elm['s-sc'] = scopeId;
289
- elm.classList.add(scopeId + '-h');
290
- }
291
- endAttachStyles();
292
- };
293
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
294
- /**
295
- * Production setAccessor() function based on Preact by
296
- * Jason Miller (@developit)
297
- * Licensed under the MIT License
298
- * https://github.com/developit/preact/blob/master/LICENSE
299
- *
300
- * Modified for Stencil's compiler and vdom
301
- */
302
- /**
303
- * When running a VDom render set properties present on a VDom node onto the
304
- * corresponding HTML element.
305
- *
306
- * Note that this function has special functionality for the `class`,
307
- * `style`, `key`, and `ref` attributes, as well as event handlers (like
308
- * `onClick`, etc). All others are just passed through as-is.
309
- *
310
- * @param elm the HTMLElement onto which attributes should be set
311
- * @param memberName the name of the attribute to set
312
- * @param oldValue the old value for the attribute
313
- * @param newValue the new value for the attribute
314
- * @param isSvg whether we're in an svg context or not
315
- * @param flags bitflags for Vdom variables
316
- */
317
- const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
318
- if (oldValue !== newValue) {
319
- let isProp = isMemberInElement(elm, memberName);
320
- memberName.toLowerCase();
321
- {
322
- // Set property if it exists and it's not a SVG
323
- const isComplex = isComplexType(newValue);
324
- if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
325
- try {
326
- if (!elm.tagName.includes('-')) {
327
- const n = newValue == null ? '' : newValue;
328
- // Workaround for Safari, moving the <input> caret when re-assigning the same valued
329
- if (memberName === 'list') {
330
- isProp = false;
331
- }
332
- else if (oldValue == null || elm[memberName] != n) {
333
- elm[memberName] = n;
334
- }
335
- }
336
- else {
337
- elm[memberName] = newValue;
338
- }
339
- }
340
- catch (e) {
341
- /**
342
- * in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
343
- */
344
- }
345
- }
346
- if (newValue == null || newValue === false) {
347
- if (newValue !== false || elm.getAttribute(memberName) === '') {
348
- {
349
- elm.removeAttribute(memberName);
350
- }
351
- }
352
- }
353
- else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
354
- newValue = newValue === true ? '' : newValue;
355
- {
356
- elm.setAttribute(memberName, newValue);
357
- }
358
- }
359
- }
360
- }
361
- };
362
- const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
363
- // if the element passed in is a shadow root, which is a document fragment
364
- // then we want to be adding attrs/props to the shadow root's "host" element
365
- // if it's not a shadow root, then we add attrs/props to the same element
366
- const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
367
- ? newVnode.$elm$.host
368
- : newVnode.$elm$;
369
- const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
370
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
371
- {
372
- // remove attributes no longer present on the vnode by setting them to undefined
373
- for (memberName in oldVnodeAttrs) {
374
- if (!(memberName in newVnodeAttrs)) {
375
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
376
- }
377
- }
378
- }
379
- // add new & update changed attributes
380
- for (memberName in newVnodeAttrs) {
381
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
382
- }
383
- };
384
- /**
385
- * Create a DOM Node corresponding to one of the children of a given VNode.
386
- *
387
- * @param oldParentVNode the parent VNode from the previous render
388
- * @param newParentVNode the parent VNode from the current render
389
- * @param childIndex the index of the VNode, in the _new_ parent node's
390
- * children, for which we will create a new DOM node
391
- * @param parentElm the parent DOM node which our new node will be a child of
392
- * @returns the newly created node
393
- */
394
- const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
395
- // tslint:disable-next-line: prefer-const
396
- const newVNode = newParentVNode.$children$[childIndex];
397
- let i = 0;
398
- let elm;
399
- let childNode;
400
- {
401
- // create element
402
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
403
- // add css classes, attrs, props, listeners, etc.
404
- {
405
- updateElement(null, newVNode, isSvgMode);
406
- }
407
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
408
- // if there is a scopeId and this is the initial render
409
- // then let's add the scopeId as a css class
410
- elm.classList.add((elm['s-si'] = scopeId));
411
- }
412
- if (newVNode.$children$) {
413
- for (i = 0; i < newVNode.$children$.length; ++i) {
414
- // create the node
415
- childNode = createElm(oldParentVNode, newVNode, i);
416
- // return node could have been null
417
- if (childNode) {
418
- // append our new node
419
- elm.appendChild(childNode);
420
- }
421
- }
422
- }
423
- }
424
- // This needs to always happen so we can hide nodes that are projected
425
- // to another component but don't end up in a slot
426
- elm['s-hn'] = hostTagName;
427
- return elm;
428
- };
429
- /**
430
- * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
431
- * add them to the DOM in the appropriate place.
432
- *
433
- * @param parentElm the DOM node which should be used as a parent for the new
434
- * DOM nodes
435
- * @param before a child of the `parentElm` which the new children should be
436
- * inserted before (optional)
437
- * @param parentVNode the parent virtual DOM node
438
- * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
439
- * @param startIdx the index in the child virtual DOM nodes at which to start
440
- * creating DOM nodes (inclusive)
441
- * @param endIdx the index in the child virtual DOM nodes at which to stop
442
- * creating DOM nodes (inclusive)
443
- */
444
- const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
445
- let containerElm = (parentElm);
446
- let childNode;
447
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
448
- containerElm = containerElm.shadowRoot;
449
- }
450
- for (; startIdx <= endIdx; ++startIdx) {
451
- if (vnodes[startIdx]) {
452
- childNode = createElm(null, parentVNode, startIdx);
453
- if (childNode) {
454
- vnodes[startIdx].$elm$ = childNode;
455
- containerElm.insertBefore(childNode, before);
456
- }
457
- }
458
- }
459
- };
460
- /**
461
- * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
462
- * This can be used to, for instance, clean up after a list of children which
463
- * should no longer be shown.
464
- *
465
- * This function also handles some of Stencil's slot relocation logic.
466
- *
467
- * @param vnodes a list of virtual DOM nodes to remove
468
- * @param startIdx the index at which to start removing nodes (inclusive)
469
- * @param endIdx the index at which to stop removing nodes (inclusive)
470
- */
471
- const removeVnodes = (vnodes, startIdx, endIdx) => {
472
- for (let index = startIdx; index <= endIdx; ++index) {
473
- const vnode = vnodes[index];
474
- if (vnode) {
475
- const elm = vnode.$elm$;
476
- if (elm) {
477
- // remove the vnode's element from the dom
478
- elm.remove();
479
- }
480
- }
481
- }
482
- };
483
- /**
484
- * Reconcile the children of a new VNode with the children of an old VNode by
485
- * traversing the two collections of children, identifying nodes that are
486
- * conserved or changed, calling out to `patch` to make any necessary
487
- * updates to the DOM, and rearranging DOM nodes as needed.
488
- *
489
- * The algorithm for reconciling children works by analyzing two 'windows' onto
490
- * the two arrays of children (`oldCh` and `newCh`). We keep track of the
491
- * 'windows' by storing start and end indices and references to the
492
- * corresponding array entries. Initially the two 'windows' are basically equal
493
- * to the entire array, but we progressively narrow the windows until there are
494
- * no children left to update by doing the following:
495
- *
496
- * 1. Skip any `null` entries at the beginning or end of the two arrays, so
497
- * that if we have an initial array like the following we'll end up dealing
498
- * only with a window bounded by the highlighted elements:
499
- *
500
- * [null, null, VNode1 , ... , VNode2, null, null]
501
- * ^^^^^^ ^^^^^^
502
- *
503
- * 2. Check to see if the elements at the head and tail positions are equal
504
- * across the windows. This will basically detect elements which haven't
505
- * been added, removed, or changed position, i.e. if you had the following
506
- * VNode elements (represented as HTML):
507
- *
508
- * oldVNode: `<div><p><span>HEY</span></p></div>`
509
- * newVNode: `<div><p><span>THERE</span></p></div>`
510
- *
511
- * Then when comparing the children of the `<div>` tag we check the equality
512
- * of the VNodes corresponding to the `<p>` tags and, since they are the
513
- * same tag in the same position, we'd be able to avoid completely
514
- * re-rendering the subtree under them with a new DOM element and would just
515
- * call out to `patch` to handle reconciling their children and so on.
516
- *
517
- * 3. Check, for both windows, to see if the element at the beginning of the
518
- * window corresponds to the element at the end of the other window. This is
519
- * a heuristic which will let us identify _some_ situations in which
520
- * elements have changed position, for instance it _should_ detect that the
521
- * children nodes themselves have not changed but merely moved in the
522
- * following example:
523
- *
524
- * oldVNode: `<div><element-one /><element-two /></div>`
525
- * newVNode: `<div><element-two /><element-one /></div>`
526
- *
527
- * If we find cases like this then we also need to move the concrete DOM
528
- * elements corresponding to the moved children to write the re-order to the
529
- * DOM.
530
- *
531
- * 4. Finally, if VNodes have the `key` attribute set on them we check for any
532
- * nodes in the old children which have the same key as the first element in
533
- * our window on the new children. If we find such a node we handle calling
534
- * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
535
- * what we find.
536
- *
537
- * Finally, once we've narrowed our 'windows' to the point that either of them
538
- * collapse (i.e. they have length 0) we then handle any remaining VNode
539
- * insertion or deletion that needs to happen to get a DOM state that correctly
540
- * reflects the new child VNodes. If, for instance, after our window on the old
541
- * children has collapsed we still have more nodes on the new children that
542
- * we haven't dealt with yet then we need to add them, or if the new children
543
- * collapse but we still have unhandled _old_ children then we need to make
544
- * sure the corresponding DOM nodes are removed.
545
- *
546
- * @param parentElm the node into which the parent VNode is rendered
547
- * @param oldCh the old children of the parent node
548
- * @param newVNode the new VNode which will replace the parent
549
- * @param newCh the new children of the parent node
550
- * @param isInitialRender whether or not this is the first render of the vdom
551
- */
552
- const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
553
- let oldStartIdx = 0;
554
- let newStartIdx = 0;
555
- let oldEndIdx = oldCh.length - 1;
556
- let oldStartVnode = oldCh[0];
557
- let oldEndVnode = oldCh[oldEndIdx];
558
- let newEndIdx = newCh.length - 1;
559
- let newStartVnode = newCh[0];
560
- let newEndVnode = newCh[newEndIdx];
561
- let node;
562
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
563
- if (oldStartVnode == null) {
564
- // VNode might have been moved left
565
- oldStartVnode = oldCh[++oldStartIdx];
566
- }
567
- else if (oldEndVnode == null) {
568
- oldEndVnode = oldCh[--oldEndIdx];
569
- }
570
- else if (newStartVnode == null) {
571
- newStartVnode = newCh[++newStartIdx];
572
- }
573
- else if (newEndVnode == null) {
574
- newEndVnode = newCh[--newEndIdx];
575
- }
576
- else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
577
- // if the start nodes are the same then we should patch the new VNode
578
- // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
579
- // indices to reflect that. We don't need to move any DOM Nodes around
580
- // since things are matched up in order.
581
- patch(oldStartVnode, newStartVnode, isInitialRender);
582
- oldStartVnode = oldCh[++oldStartIdx];
583
- newStartVnode = newCh[++newStartIdx];
584
- }
585
- else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
586
- // likewise, if the end nodes are the same we patch new onto old and
587
- // decrement our end indices, and also likewise in this case we don't
588
- // need to move any DOM Nodes.
589
- patch(oldEndVnode, newEndVnode, isInitialRender);
590
- oldEndVnode = oldCh[--oldEndIdx];
591
- newEndVnode = newCh[--newEndIdx];
592
- }
593
- else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
594
- patch(oldStartVnode, newEndVnode, isInitialRender);
595
- // We need to move the element for `oldStartVnode` into a position which
596
- // will be appropriate for `newEndVnode`. For this we can use
597
- // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
598
- // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
599
- // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
600
- //
601
- // <old-start-node />
602
- // <some-intervening-node />
603
- // <old-end-node />
604
- // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
605
- // <next-sibling />
606
- //
607
- // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
608
- // the node for `oldStartVnode` at the end of the children of
609
- // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
610
- // aren't any siblings, and passing `null` to `Node.insertBefore` will
611
- // append it to the children of the parent element.
612
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
613
- oldStartVnode = oldCh[++oldStartIdx];
614
- newEndVnode = newCh[--newEndIdx];
615
- }
616
- else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
617
- patch(oldEndVnode, newStartVnode, isInitialRender);
618
- // We've already checked above if `oldStartVnode` and `newStartVnode` are
619
- // the same node, so since we're here we know that they are not. Thus we
620
- // can move the element for `oldEndVnode` _before_ the element for
621
- // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
622
- // future.
623
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
624
- oldEndVnode = oldCh[--oldEndIdx];
625
- newStartVnode = newCh[++newStartIdx];
626
- }
627
- else {
628
- {
629
- // We either didn't find an element in the old children that matches
630
- // the key of the first new child OR the build is not using `key`
631
- // attributes at all. In either case we need to create a new element
632
- // for the new node.
633
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
634
- newStartVnode = newCh[++newStartIdx];
635
- }
636
- if (node) {
637
- // if we created a new node then handle inserting it to the DOM
638
- {
639
- oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
640
- }
641
- }
642
- }
643
- }
644
- if (oldStartIdx > oldEndIdx) {
645
- // we have some more new nodes to add which don't match up with old nodes
646
- addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
647
- }
648
- else if (newStartIdx > newEndIdx) {
649
- // there are nodes in the `oldCh` array which no longer correspond to nodes
650
- // in the new array, so lets remove them (which entails cleaning up the
651
- // relevant DOM nodes)
652
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
653
- }
654
- };
655
- /**
656
- * Compare two VNodes to determine if they are the same
657
- *
658
- * **NB**: This function is an equality _heuristic_ based on the available
659
- * information set on the two VNodes and can be misleading under certain
660
- * circumstances. In particular, if the two nodes do not have `key` attrs
661
- * (available under `$key$` on VNodes) then the function falls back on merely
662
- * checking that they have the same tag.
663
- *
664
- * So, in other words, if `key` attrs are not set on VNodes which may be
665
- * changing order within a `children` array or something along those lines then
666
- * we could obtain a false negative and then have to do needless re-rendering
667
- * (i.e. we'd say two VNodes aren't equal when in fact they should be).
668
- *
669
- * @param leftVNode the first VNode to check
670
- * @param rightVNode the second VNode to check
671
- * @param isInitialRender whether or not this is the first render of the vdom
672
- * @returns whether they're equal or not
673
- */
674
- const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
675
- // compare if two vnode to see if they're "technically" the same
676
- // need to have the same element tag, and same key to be the same
677
- if (leftVNode.$tag$ === rightVNode.$tag$) {
678
- return true;
679
- }
680
- return false;
681
- };
682
- /**
683
- * Handle reconciling an outdated VNode with a new one which corresponds to
684
- * it. This function handles flushing updates to the DOM and reconciling the
685
- * children of the two nodes (if any).
686
- *
687
- * @param oldVNode an old VNode whose DOM element and children we want to update
688
- * @param newVNode a new VNode representing an updated version of the old one
689
- * @param isInitialRender whether or not this is the first render of the vdom
690
- */
691
- const patch = (oldVNode, newVNode, isInitialRender = false) => {
692
- const elm = (newVNode.$elm$ = oldVNode.$elm$);
693
- const oldChildren = oldVNode.$children$;
694
- const newChildren = newVNode.$children$;
695
- const tag = newVNode.$tag$;
696
- {
697
- {
698
- if (tag === 'slot')
699
- ;
700
- else {
701
- // either this is the first render of an element OR it's an update
702
- // AND we already know it's possible it could have changed
703
- // this updates the element's css classes, attrs, props, listeners, etc.
704
- updateElement(oldVNode, newVNode, isSvgMode);
705
- }
706
- }
707
- if (oldChildren !== null && newChildren !== null) {
708
- // looks like there's child vnodes for both the old and new vnodes
709
- // so we need to call `updateChildren` to reconcile them
710
- updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
711
- }
712
- else if (newChildren !== null) {
713
- // add the new vnode children
714
- addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
715
- }
716
- else if (oldChildren !== null) {
717
- // no new child vnodes, but there are old child vnodes to remove
718
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
719
- }
720
- }
721
- };
722
- /**
723
- * The main entry point for Stencil's virtual DOM-based rendering engine
724
- *
725
- * Given a {@link d.HostRef} container and some virtual DOM nodes, this
726
- * function will handle creating a virtual DOM tree with a single root, patching
727
- * the current virtual DOM tree onto an old one (if any), dealing with slot
728
- * relocation, and reflecting attributes.
729
- *
730
- * @param hostRef data needed to root and render the virtual DOM tree, such as
731
- * the DOM node into which it should be rendered.
732
- * @param renderFnResults the virtual DOM nodes to be rendered
733
- * @param isInitialLoad whether or not this is the first call after page load
734
- */
735
- const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
736
- const hostElm = hostRef.$hostElement$;
737
- const cmpMeta = hostRef.$cmpMeta$;
738
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
739
- // if `renderFnResults` is a Host node then we can use it directly. If not,
740
- // we need to call `h` again to wrap the children of our component in a
741
- // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
742
- // implicitly that the top-level vdom node is 1) an only child and 2)
743
- // contains attrs that need to be set on the host element.
744
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
745
- hostTagName = hostElm.tagName;
746
- if (cmpMeta.$attrsToReflect$) {
747
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
748
- cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
749
- }
750
- // On the first render and *only* on the first render we want to check for
751
- // any attributes set on the host element which are also set on the vdom
752
- // node. If we find them, we override the value on the VDom node attrs with
753
- // the value from the host element, which allows developers building apps
754
- // with Stencil components to override e.g. the `role` attribute on a
755
- // component even if it's already set on the `Host`.
756
- if (isInitialLoad && rootVnode.$attrs$) {
757
- for (const key of Object.keys(rootVnode.$attrs$)) {
758
- // We have a special implementation in `setAccessor` for `style` and
759
- // `class` which reconciles values coming from the VDom with values
760
- // already present on the DOM element, so we don't want to override those
761
- // attributes on the VDom tree with values from the host element if they
762
- // are present.
763
- //
764
- // Likewise, `ref` and `key` are special internal values for the Stencil
765
- // runtime and we don't want to override those either.
766
- if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
767
- rootVnode.$attrs$[key] = hostElm[key];
768
- }
769
- }
770
- }
771
- rootVnode.$tag$ = null;
772
- rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
773
- hostRef.$vnode$ = rootVnode;
774
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
775
- {
776
- scopeId = hostElm['s-sc'];
777
- }
778
- // synchronous patch
779
- patch(oldVNode, rootVnode, isInitialLoad);
780
- };
781
- const attachToAncestor = (hostRef, ancestorComponent) => {
782
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
783
- ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
784
- }
785
- };
786
- const scheduleUpdate = (hostRef, isInitialLoad) => {
787
- {
788
- hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
789
- }
790
- if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
791
- hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
792
- return;
793
- }
794
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
795
- // there is no ancestor component or the ancestor component
796
- // has already fired off its lifecycle update then
797
- // fire off the initial update
798
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
799
- return writeTask(dispatch) ;
800
- };
801
- /**
802
- * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
803
- * component lifecycle methods like `componentWillLoad` as well as
804
- * {@link updateComponent}, which will kick off the virtual DOM re-render.
805
- *
806
- * @param hostRef a reference to a host DOM node
807
- * @param isInitialLoad whether we're on the initial load or not
808
- * @returns an empty Promise which is used to enqueue a series of operations for
809
- * the component
810
- */
811
- const dispatchHooks = (hostRef, isInitialLoad) => {
812
- const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
813
- const instance = hostRef.$lazyInstance$ ;
814
- // We're going to use this variable together with `enqueue` to implement a
815
- // little promise-based queue. We start out with it `undefined`. When we add
816
- // the first function to the queue we'll set this variable to be that
817
- // function's return value. When we attempt to add subsequent values to the
818
- // queue we'll check that value and, if it was a `Promise`, we'll then chain
819
- // the new function off of that `Promise` using `.then()`. This will give our
820
- // queue two nice properties:
821
- //
822
- // 1. If all functions added to the queue are synchronous they'll be called
823
- // synchronously right away.
824
- // 2. If all functions added to the queue are asynchronous they'll all be
825
- // called in order after `dispatchHooks` exits.
826
- let maybePromise;
827
- if (isInitialLoad) {
828
- {
829
- hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
830
- if (hostRef.$queuedListeners$) {
831
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
832
- hostRef.$queuedListeners$ = undefined;
833
- }
834
- }
835
- }
836
- endSchedule();
837
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
838
- };
839
- /**
840
- * This function uses a Promise to implement a simple first-in, first-out queue
841
- * of functions to be called.
842
- *
843
- * The queue is ordered on the basis of the first argument. If it's
844
- * `undefined`, then nothing is on the queue yet, so the provided function can
845
- * be called synchronously (although note that this function may return a
846
- * `Promise`). The idea is that then the return value of that enqueueing
847
- * operation is kept around, so that if it was a `Promise` then subsequent
848
- * functions can be enqueued by calling this function again with that `Promise`
849
- * as the first argument.
850
- *
851
- * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
852
- * @param fn a function to enqueue
853
- * @returns either a `Promise` or the return value of the provided function
854
- */
855
- const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
856
- /**
857
- * Check that a value is a `Promise`. To check, we first see if the value is an
858
- * instance of the `Promise` global. In a few circumstances, in particular if
859
- * the global has been overwritten, this is could be misleading, so we also do
860
- * a little 'duck typing' check to see if the `.then` property of the value is
861
- * defined and a function.
862
- *
863
- * @param maybePromise it might be a promise!
864
- * @returns whether it is or not
865
- */
866
- const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
867
- (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
868
- /**
869
- * Update a component given reference to its host elements and so on.
870
- *
871
- * @param hostRef an object containing references to the element's host node,
872
- * VDom nodes, and other metadata
873
- * @param instance a reference to the underlying host element where it will be
874
- * rendered
875
- * @param isInitialLoad whether or not this function is being called as part of
876
- * the first render cycle
877
- */
878
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
879
- var _a;
880
- const elm = hostRef.$hostElement$;
881
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
882
- const rc = elm['s-rc'];
883
- if (isInitialLoad) {
884
- // DOM WRITE!
885
- attachStyles(hostRef);
886
- }
887
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
888
- {
889
- callRender(hostRef, instance, elm, isInitialLoad);
890
- }
891
- if (rc) {
892
- // ok, so turns out there are some child host elements
893
- // waiting on this parent element to load
894
- // let's fire off all update callbacks waiting
895
- rc.map((cb) => cb());
896
- elm['s-rc'] = undefined;
897
- }
898
- endRender();
899
- endUpdate();
900
- {
901
- const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
902
- const postUpdate = () => postUpdateComponent(hostRef);
903
- if (childrenPromises.length === 0) {
904
- postUpdate();
905
- }
906
- else {
907
- Promise.all(childrenPromises).then(postUpdate);
908
- hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
909
- childrenPromises.length = 0;
910
- }
911
- }
912
- };
913
- /**
914
- * Handle making the call to the VDom renderer with the proper context given
915
- * various build variables
916
- *
917
- * @param hostRef an object containing references to the element's host node,
918
- * VDom nodes, and other metadata
919
- * @param instance a reference to the underlying host element where it will be
920
- * rendered
921
- * @param elm the Host element for the component
922
- * @param isInitialLoad whether or not this function is being called as part of
923
- * @returns an empty promise
924
- */
925
- const callRender = (hostRef, instance, elm, isInitialLoad) => {
926
- try {
927
- /**
928
- * minification optimization: `allRenderFn` is `true` if all components have a `render`
929
- * method, so we can call the method immediately. If not, check before calling it.
930
- */
931
- instance = instance.render() ;
932
- {
933
- hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
934
- }
935
- {
936
- hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
937
- }
938
- {
939
- {
940
- // looks like we've got child nodes to render into this host element
941
- // or we need to update the css class/attrs on the host element
942
- // DOM WRITE!
943
- {
944
- renderVdom(hostRef, instance, isInitialLoad);
945
- }
946
- }
947
- }
948
- }
949
- catch (e) {
950
- consoleError(e, hostRef.$hostElement$);
951
- }
952
- return null;
953
- };
954
- const postUpdateComponent = (hostRef) => {
955
- const tagName = hostRef.$cmpMeta$.$tagName$;
956
- const elm = hostRef.$hostElement$;
957
- const endPostUpdate = createTime('postUpdate', tagName);
958
- const ancestorComponent = hostRef.$ancestorComponent$;
959
- if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
960
- hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
961
- {
962
- // DOM WRITE!
963
- addHydratedFlag(elm);
964
- }
965
- endPostUpdate();
966
- {
967
- hostRef.$onReadyResolve$(elm);
968
- if (!ancestorComponent) {
969
- appDidLoad();
970
- }
971
- }
972
- }
973
- else {
974
- endPostUpdate();
975
- }
976
- // load events fire from bottom to top
977
- // the deepest elements load first then bubbles up
978
- {
979
- if (hostRef.$onRenderResolve$) {
980
- hostRef.$onRenderResolve$();
981
- hostRef.$onRenderResolve$ = undefined;
982
- }
983
- if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
984
- nextTick(() => scheduleUpdate(hostRef, false));
985
- }
986
- hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
987
- }
988
- // ( •_•)
989
- // ( •_•)>⌐■-■
990
- // (⌐■_■)
991
- };
992
- const appDidLoad = (who) => {
993
- // on appload
994
- // we have finish the first big initial render
995
- {
996
- addHydratedFlag(doc.documentElement);
997
- }
998
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
999
- };
1000
- /**
1001
- * Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
1002
- * e.g. custom element node. If a build figures out that e.g. no component
1003
- * has a `componentDidLoad` method, the instance method gets removed from the
1004
- * output bundle and this function returns `undefined`.
1005
- * @param instance any object that may or may not contain methods
1006
- * @param method method name
1007
- * @param arg single arbitrary argument
1008
- * @returns result of method call if it exists, otherwise `undefined`
1009
- */
1010
- const safeCall = (instance, method, arg) => {
1011
- if (instance && instance[method]) {
1012
- try {
1013
- return instance[method](arg);
1014
- }
1015
- catch (e) {
1016
- consoleError(e);
1017
- }
1018
- }
1019
- return undefined;
1020
- };
1021
- const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
1022
- ;
1023
- const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1024
- const setValue = (ref, propName, newVal, cmpMeta) => {
1025
- // check our new property value against our internal value
1026
- const hostRef = getHostRef(ref);
1027
- const oldVal = hostRef.$instanceValues$.get(propName);
1028
- const flags = hostRef.$flags$;
1029
- const instance = hostRef.$lazyInstance$ ;
1030
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1031
- // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1032
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1033
- const didValueChange = newVal !== oldVal && !areBothNaN;
1034
- if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1035
- // gadzooks! the property's value has changed!!
1036
- // set our new value!
1037
- hostRef.$instanceValues$.set(propName, newVal);
1038
- if (instance) {
1039
- if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1040
- // looks like this value actually changed, so we've got work to do!
1041
- // but only if we've already rendered, otherwise just chill out
1042
- // queue that we need to do an update, but don't worry about queuing
1043
- // up millions cuz this function ensures it only runs once
1044
- scheduleUpdate(hostRef, false);
1045
- }
1046
- }
1047
- }
1048
- };
1049
- /**
1050
- * Attach a series of runtime constructs to a compiled Stencil component
1051
- * constructor, including getters and setters for the `@Prop` and `@State`
1052
- * decorators, callbacks for when attributes change, and so on.
1053
- *
1054
- * @param Cstr the constructor for a component that we need to process
1055
- * @param cmpMeta metadata collected previously about the component
1056
- * @param flags a number used to store a series of bit flags
1057
- * @returns a reference to the same constructor passed in (but now mutated)
1058
- */
1059
- const proxyComponent = (Cstr, cmpMeta, flags) => {
1060
- var _a;
1061
- const prototype = Cstr.prototype;
1062
- if (cmpMeta.$members$) {
1063
- // It's better to have a const than two Object.entries()
1064
- const members = Object.entries(cmpMeta.$members$);
1065
- members.map(([memberName, [memberFlags]]) => {
1066
- if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1067
- ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1068
- // proxyComponent - prop
1069
- Object.defineProperty(prototype, memberName, {
1070
- get() {
1071
- // proxyComponent, get value
1072
- return getValue(this, memberName);
1073
- },
1074
- set(newValue) {
1075
- // proxyComponent, set value
1076
- setValue(this, memberName, newValue, cmpMeta);
1077
- },
1078
- configurable: true,
1079
- enumerable: true,
1080
- });
1081
- }
1082
- });
1083
- if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1084
- const attrNameToPropName = new Map();
1085
- prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
1086
- plt.jmp(() => {
1087
- var _a;
1088
- const propName = attrNameToPropName.get(attrName);
1089
- // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1090
- // in the case where an attribute was set inline.
1091
- // ```html
1092
- // <my-component some-attribute="some-value"></my-component>
1093
- // ```
1094
- //
1095
- // There is an edge case where a developer sets the attribute inline on a custom element and then
1096
- // programmatically changes it before it has been upgraded as shown below:
1097
- //
1098
- // ```html
1099
- // <!-- this component has _not_ been upgraded yet -->
1100
- // <my-component id="test" some-attribute="some-value"></my-component>
1101
- // <script>
1102
- // // grab non-upgraded component
1103
- // el = document.querySelector("#test");
1104
- // el.someAttribute = "another-value";
1105
- // // upgrade component
1106
- // customElements.define('my-component', MyComponent);
1107
- // </script>
1108
- // ```
1109
- // In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
1110
- // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1111
- // to the value that was set inline i.e. "some-value" from above example. When
1112
- // the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
1113
- //
1114
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
1115
- // by connectedCallback as this attributeChangedCallback will not fire.
1116
- //
1117
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1118
- //
1119
- // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1120
- // properties here given that this goes against best practices outlined here
1121
- // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1122
- if (this.hasOwnProperty(propName)) {
1123
- newValue = this[propName];
1124
- delete this[propName];
1125
- }
1126
- else if (prototype.hasOwnProperty(propName) &&
1127
- typeof this[propName] === 'number' &&
1128
- this[propName] == newValue) {
1129
- // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1130
- // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1131
- // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1132
- return;
1133
- }
1134
- else if (propName == null) {
1135
- // At this point we should know this is not a "member", so we can treat it like watching an attribute
1136
- // on a vanilla web component
1137
- const hostRef = getHostRef(this);
1138
- const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
1139
- // We only want to trigger the callback(s) if:
1140
- // 1. The instance is ready
1141
- // 2. The watchers are ready
1142
- // 3. The value has changed
1143
- if (flags &&
1144
- !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
1145
- flags & 128 /* HOST_FLAGS.isWatchReady */ &&
1146
- newValue !== oldValue) {
1147
- const instance = hostRef.$lazyInstance$ ;
1148
- const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
1149
- entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
1150
- if (instance[callbackName] != null) {
1151
- instance[callbackName].call(instance, newValue, oldValue, attrName);
1152
- }
1153
- });
1154
- }
1155
- return;
1156
- }
1157
- this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1158
- });
1159
- };
1160
- // Create an array of attributes to observe
1161
- // This list in comprised of all strings used within a `@Watch()` decorator
1162
- // on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
1163
- // As such, there is no way to guarantee type-safety here that a user hasn't entered
1164
- // an invalid attribute.
1165
- Cstr.observedAttributes = Array.from(new Set([
1166
- ...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
1167
- ...members
1168
- .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
1169
- .map(([propName, m]) => {
1170
- var _a;
1171
- const attrName = m[1] || propName;
1172
- attrNameToPropName.set(attrName, propName);
1173
- if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1174
- (_a = cmpMeta.$attrsToReflect$) === null || _a === void 0 ? void 0 : _a.push([propName, attrName]);
1175
- }
1176
- return attrName;
1177
- }),
1178
- ]));
1179
- }
1180
- }
1181
- return Cstr;
1182
- };
1183
- /**
1184
- * Initialize a Stencil component given a reference to its host element, its
1185
- * runtime bookkeeping data structure, runtime metadata about the component,
1186
- * and (optionally) an HMR version ID.
1187
- *
1188
- * @param elm a host element
1189
- * @param hostRef the element's runtime bookkeeping object
1190
- * @param cmpMeta runtime metadata for the Stencil component
1191
- * @param hmrVersionId an (optional) HMR version ID
1192
- */
1193
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1194
- let Cstr;
1195
- // initializeComponent
1196
- if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1197
- // Let the runtime know that the component has been initialized
1198
- hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1199
- {
1200
- // lazy loaded components
1201
- // request the component's implementation to be
1202
- // wired up with the host element
1203
- Cstr = loadModule(cmpMeta);
1204
- if (Cstr.then) {
1205
- // Await creates a micro-task avoid if possible
1206
- const endLoad = uniqueTime();
1207
- Cstr = await Cstr;
1208
- endLoad();
1209
- }
1210
- if (!Cstr.isProxied) {
1211
- proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1212
- Cstr.isProxied = true;
1213
- }
1214
- const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1215
- // ok, time to construct the instance
1216
- // but let's keep track of when we start and stop
1217
- // so that the getters/setters don't incorrectly step on data
1218
- {
1219
- hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1220
- }
1221
- // construct the lazy-loaded component implementation
1222
- // passing the hostRef is very important during
1223
- // construction in order to directly wire together the
1224
- // host element and the lazy-loaded instance
1225
- try {
1226
- new Cstr(hostRef);
1227
- }
1228
- catch (e) {
1229
- consoleError(e);
1230
- }
1231
- {
1232
- hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1233
- }
1234
- endNewInstance();
1235
- }
1236
- if (Cstr.style) {
1237
- // this component has styles but we haven't registered them yet
1238
- let style = Cstr.style;
1239
- const scopeId = getScopeId(cmpMeta);
1240
- if (!styles.has(scopeId)) {
1241
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1242
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1243
- endRegisterStyles();
1244
- }
1245
- }
1246
- }
1247
- // we've successfully created a lazy instance
1248
- const ancestorComponent = hostRef.$ancestorComponent$;
1249
- const schedule = () => scheduleUpdate(hostRef, true);
1250
- if (ancestorComponent && ancestorComponent['s-rc']) {
1251
- // this is the initial load and this component it has an ancestor component
1252
- // but the ancestor component has NOT fired its will update lifecycle yet
1253
- // so let's just cool our jets and wait for the ancestor to continue first
1254
- // this will get fired off when the ancestor component
1255
- // finally gets around to rendering its lazy self
1256
- // fire off the initial update
1257
- ancestorComponent['s-rc'].push(schedule);
1258
- }
1259
- else {
1260
- schedule();
1261
- }
1262
- };
1263
- const fireConnectedCallback = (instance) => {
1264
- };
1265
- const connectedCallback = (elm) => {
1266
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1267
- const hostRef = getHostRef(elm);
1268
- const cmpMeta = hostRef.$cmpMeta$;
1269
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1270
- if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1271
- // first time this component has connected
1272
- hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1273
- {
1274
- // find the first ancestor component (if there is one) and register
1275
- // this component as one of the actively loading child components for its ancestor
1276
- let ancestorComponent = elm;
1277
- while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1278
- // climb up the ancestors looking for the first
1279
- // component that hasn't finished its lifecycle update yet
1280
- if (ancestorComponent['s-p']) {
1281
- // we found this components first ancestor component
1282
- // keep a reference to this component's ancestor component
1283
- attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1284
- break;
1285
- }
1286
- }
1287
- }
1288
- // Lazy properties
1289
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1290
- if (cmpMeta.$members$) {
1291
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1292
- if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1293
- const value = elm[memberName];
1294
- delete elm[memberName];
1295
- elm[memberName] = value;
1296
- }
1297
- });
1298
- }
1299
- {
1300
- initializeComponent(elm, hostRef, cmpMeta);
1301
- }
1302
- }
1303
- else {
1304
- // not the first time this has connected
1305
- // reattach any event listeners to the host
1306
- // since they would have been removed when disconnected
1307
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1308
- // fire off connectedCallback() on component instance
1309
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1310
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1311
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1312
- }
1313
- }
1314
- endConnected();
1315
- }
1316
- };
1317
- const disconnectInstance = (instance) => {
1318
- };
1319
- const disconnectedCallback = async (elm) => {
1320
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1321
- const hostRef = getHostRef(elm);
1322
- {
1323
- if (hostRef.$rmListeners$) {
1324
- hostRef.$rmListeners$.map((rmListener) => rmListener());
1325
- hostRef.$rmListeners$ = undefined;
1326
- }
1327
- }
1328
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1329
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1330
- hostRef.$onReadyPromise$.then(() => disconnectInstance());
1331
- }
1332
- }
1333
- };
1334
- const bootstrapLazy = (lazyBundles, options = {}) => {
1335
- var _a;
1336
- const endBootstrap = createTime();
1337
- const cmpTags = [];
1338
- const exclude = options.exclude || [];
1339
- const customElements = win.customElements;
1340
- const head = doc.head;
1341
- const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1342
- const dataStyles = /*@__PURE__*/ doc.createElement('style');
1343
- const deferredConnectedCallbacks = [];
1344
- let appLoadFallback;
1345
- let isBootstrapping = true;
1346
- Object.assign(plt, options);
1347
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1348
- let hasSlotRelocation = false;
1349
- lazyBundles.map((lazyBundle) => {
1350
- lazyBundle[1].map((compactMeta) => {
1351
- const cmpMeta = {
1352
- $flags$: compactMeta[0],
1353
- $tagName$: compactMeta[1],
1354
- $members$: compactMeta[2],
1355
- $listeners$: compactMeta[3],
1356
- };
1357
- // Check if we are using slots outside the shadow DOM in this component.
1358
- // We'll use this information later to add styles for `slot-fb` elements
1359
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
1360
- hasSlotRelocation = true;
1361
- }
1362
- {
1363
- cmpMeta.$members$ = compactMeta[2];
1364
- }
1365
- {
1366
- cmpMeta.$listeners$ = compactMeta[3];
1367
- }
1368
- {
1369
- cmpMeta.$attrsToReflect$ = [];
1370
- }
1371
- const tagName = cmpMeta.$tagName$;
1372
- const HostElement = class extends HTMLElement {
1373
- // StencilLazyHost
1374
- constructor(self) {
1375
- // @ts-ignore
1376
- super(self);
1377
- self = this;
1378
- registerHost(self, cmpMeta);
1379
- if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1380
- // this component is using shadow dom
1381
- // and this browser supports shadow dom
1382
- // add the read-only property "shadowRoot" to the host element
1383
- // adding the shadow root build conditionals to minimize runtime
1384
- {
1385
- {
1386
- self.attachShadow({ mode: 'open' });
1387
- }
1388
- }
1389
- }
1390
- }
1391
- connectedCallback() {
1392
- if (appLoadFallback) {
1393
- clearTimeout(appLoadFallback);
1394
- appLoadFallback = null;
1395
- }
1396
- if (isBootstrapping) {
1397
- // connectedCallback will be processed once all components have been registered
1398
- deferredConnectedCallbacks.push(this);
1399
- }
1400
- else {
1401
- plt.jmp(() => connectedCallback(this));
1402
- }
1403
- }
1404
- disconnectedCallback() {
1405
- plt.jmp(() => disconnectedCallback(this));
1406
- }
1407
- componentOnReady() {
1408
- return getHostRef(this).$onReadyPromise$;
1409
- }
1410
- };
1411
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
1412
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1413
- cmpTags.push(tagName);
1414
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1415
- }
1416
- });
1417
- });
1418
- // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
1419
- if (hasSlotRelocation) {
1420
- dataStyles.innerHTML += SLOT_FB_CSS;
1421
- }
1422
- // Add hydration styles
1423
- {
1424
- dataStyles.innerHTML += cmpTags + HYDRATED_CSS;
1425
- }
1426
- // If we have styles, add them to the DOM
1427
- if (dataStyles.innerHTML.length) {
1428
- dataStyles.setAttribute('data-styles', '');
1429
- // Apply CSP nonce to the style tag if it exists
1430
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1431
- if (nonce != null) {
1432
- dataStyles.setAttribute('nonce', nonce);
1433
- }
1434
- // Insert the styles into the document head
1435
- // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
1436
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1437
- }
1438
- // Process deferred connectedCallbacks now all components have been registered
1439
- isBootstrapping = false;
1440
- if (deferredConnectedCallbacks.length) {
1441
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
1442
- }
1443
- else {
1444
- {
1445
- plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1446
- }
1447
- }
1448
- // Fallback appLoad event
1449
- endBootstrap();
1450
- };
1451
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1452
- if (listeners) {
1453
- listeners.map(([flags, name, method]) => {
1454
- const target = getHostListenerTarget(elm, flags) ;
1455
- const handler = hostListenerProxy(hostRef, method);
1456
- const opts = hostListenerOpts(flags);
1457
- plt.ael(target, name, handler, opts);
1458
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1459
- });
1460
- }
1461
- };
1462
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
1463
- try {
1464
- {
1465
- if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1466
- // instance is ready, let's call it's member method for this event
1467
- hostRef.$lazyInstance$[methodName](ev);
1468
- }
1469
- else {
1470
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1471
- }
1472
- }
1473
- }
1474
- catch (e) {
1475
- consoleError(e);
1476
- }
1477
- };
1478
- const getHostListenerTarget = (elm, flags) => {
1479
- if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
1480
- return doc;
1481
- return elm;
1482
- };
1483
- // prettier-ignore
1484
- const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1485
- /**
1486
- * Assigns the given value to the nonce property on the runtime platform object.
1487
- * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1488
- * @param nonce The value to be assigned to the platform nonce property.
1489
- * @returns void
1490
- */
1491
- const setNonce = (nonce) => (plt.$nonce$ = nonce);
1492
- /**
1493
- * A WeakMap mapping runtime component references to their corresponding host reference
1494
- * instances.
1495
- */
1496
- const hostRefs = /*@__PURE__*/ new WeakMap();
1497
- /**
1498
- * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
1499
- *
1500
- * @param ref the runtime ref of interest
1501
- * @returns the Host reference (if found) or undefined
1502
- */
1503
- const getHostRef = (ref) => hostRefs.get(ref);
1504
- /**
1505
- * Register a lazy instance with the {@link hostRefs} object so it's
1506
- * corresponding {@link d.HostRef} can be retrieved later.
1507
- *
1508
- * @param lazyInstance the lazy instance of interest
1509
- * @param hostRef that instances `HostRef` object
1510
- * @returns a reference to the host ref WeakMap
1511
- */
1512
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1513
- /**
1514
- * Register a host element for a Stencil component, setting up various metadata
1515
- * and callbacks based on {@link BUILD} flags as well as the component's runtime
1516
- * metadata.
1517
- *
1518
- * @param hostElement the host element to register
1519
- * @param cmpMeta runtime metadata for that component
1520
- * @returns a reference to the host ref WeakMap
1521
- */
1522
- const registerHost = (hostElement, cmpMeta) => {
1523
- const hostRef = {
1524
- $flags$: 0,
1525
- $hostElement$: hostElement,
1526
- $cmpMeta$: cmpMeta,
1527
- $instanceValues$: new Map(),
1528
- };
1529
- {
1530
- hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1531
- hostElement['s-p'] = [];
1532
- hostElement['s-rc'] = [];
1533
- }
1534
- addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
1535
- return hostRefs.set(hostElement, hostRef);
1536
- };
1537
- const isMemberInElement = (elm, memberName) => memberName in elm;
1538
- const consoleError = (e, el) => (0, console.error)(e, el);
1539
- const cmpModules = /*@__PURE__*/ new Map();
1540
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1541
- // loadModuleImport
1542
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1543
- const bundleId = cmpMeta.$lazyBundleId$;
1544
- const module = cmpModules.get(bundleId) ;
1545
- if (module) {
1546
- return module[exportName];
1547
- }
1548
-
1549
- if (!hmrVersionId || !BUILD.hotModuleReplacement) {
1550
- const processMod = importedModule => {
1551
- cmpModules.set(bundleId, importedModule);
1552
- return importedModule[exportName];
1553
- }
1554
- switch(bundleId) {
1555
-
1556
- case 'mds-table-row.cjs':
1557
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1558
- /* webpackMode: "lazy" */
1559
- './mds-table-row.cjs.entry.js')); }).then(processMod, consoleError);
1560
- }
1561
- }
1562
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1563
- /* @vite-ignore */
1564
- /* webpackInclude: /\.entry\.js$/ */
1565
- /* webpackExclude: /\.system\.entry\.js$/ */
1566
- /* webpackMode: "lazy" */
1567
- `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
1568
- {
1569
- cmpModules.set(bundleId, importedModule);
1570
- }
1571
- return importedModule[exportName];
1572
- }, consoleError);
1573
- };
1574
- const styles = /*@__PURE__*/ new Map();
1575
- const win = typeof window !== 'undefined' ? window : {};
1576
- const doc = win.document || { head: {} };
1577
- const plt = {
1578
- $flags$: 0,
1579
- $resourcesUrl$: '',
1580
- jmp: (h) => h(),
1581
- raf: (h) => requestAnimationFrame(h),
1582
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1583
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1584
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
1585
- };
1586
- const promiseResolve = (v) => Promise.resolve(v);
1587
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1588
- try {
1589
- new CSSStyleSheet();
1590
- return typeof new CSSStyleSheet().replaceSync === 'function';
1591
- }
1592
- catch (e) { }
1593
- return false;
1594
- })()
1595
- ;
1596
- const queueDomReads = [];
1597
- const queueDomWrites = [];
1598
- const queueTask = (queue, write) => (cb) => {
1599
- queue.push(cb);
1600
- if (!queuePending) {
1601
- queuePending = true;
1602
- if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1603
- nextTick(flush);
1604
- }
1605
- else {
1606
- plt.raf(flush);
1607
- }
1608
- }
1609
- };
1610
- const consume = (queue) => {
1611
- for (let i = 0; i < queue.length; i++) {
1612
- try {
1613
- queue[i](performance.now());
1614
- }
1615
- catch (e) {
1616
- consoleError(e);
1617
- }
1618
- }
1619
- queue.length = 0;
1620
- };
1621
- const flush = () => {
1622
- // always force a bunch of medium callbacks to run, but still have
1623
- // a throttle on how many can run in a certain time
1624
- // DOM READS!!!
1625
- consume(queueDomReads);
1626
- // DOM WRITES!!!
1627
- {
1628
- consume(queueDomWrites);
1629
- if ((queuePending = queueDomReads.length > 0)) {
1630
- // still more to do yet, but we've run out of time
1631
- // let's let this thing cool off and try again in the next tick
1632
- plt.raf(flush);
1633
- }
1634
- }
1635
- };
1636
- const nextTick = (cb) => promiseResolve().then(cb);
1637
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1638
-
1639
- exports.Host = Host;
1640
- exports.bootstrapLazy = bootstrapLazy;
1641
- exports.h = h;
1642
- exports.promiseResolve = promiseResolve;
1643
- exports.registerInstance = registerInstance;
1644
- exports.setNonce = setNonce;