@mgdis/mg-components 5.27.2 → 5.27.3

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 (93) hide show
  1. package/dist/cjs/index-7bb96ccc.js +1636 -0
  2. package/dist/cjs/index-7bb96ccc.js.map +1 -0
  3. package/dist/cjs/{index-00072168.js → index-8e9b0d9b.js} +67 -27
  4. package/dist/cjs/index-8e9b0d9b.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/mg-action-more_36.cjs.entry.js +123 -115
  7. package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
  8. package/dist/cjs/mg-components.cjs.js +9 -9
  9. package/dist/cjs/mg-components.cjs.js.map +1 -1
  10. package/dist/cjs/mg-loader.cjs.entry.js +3 -3
  11. package/dist/collection/collection-manifest.json +1 -1
  12. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +21 -18
  13. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
  14. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +2 -1
  15. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  16. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -4
  17. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
  18. package/dist/collection/components/molecules/mg-popover/mg-popover.js +6 -2
  19. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  20. package/dist/components/index.es.js +60 -20
  21. package/dist/components/index.es.js.map +1 -1
  22. package/dist/components/index2.js +2 -2
  23. package/dist/components/mg-action-more.js +2 -2
  24. package/dist/components/mg-badge2.js +3 -3
  25. package/dist/components/mg-button2.js +4 -4
  26. package/dist/components/mg-card2.js +2 -2
  27. package/dist/components/mg-details.js +2 -2
  28. package/dist/components/mg-form.js +3 -3
  29. package/dist/components/mg-icon2.js +2 -2
  30. package/dist/components/mg-illustrated-message.js +2 -2
  31. package/dist/components/mg-input-checkbox.js +4 -4
  32. package/dist/components/mg-input-date.js +11 -11
  33. package/dist/components/mg-input-numeric.js +5 -5
  34. package/dist/components/mg-input-password.js +3 -3
  35. package/dist/components/mg-input-radio.js +4 -4
  36. package/dist/components/mg-input-select2.js +6 -6
  37. package/dist/components/mg-input-text2.js +6 -6
  38. package/dist/components/mg-input-textarea.js +6 -6
  39. package/dist/components/mg-input-title2.js +2 -2
  40. package/dist/components/mg-input-toggle.js +4 -4
  41. package/dist/components/mg-input2.js +3 -3
  42. package/dist/components/mg-item-more2.js +26 -23
  43. package/dist/components/mg-item-more2.js.map +1 -1
  44. package/dist/components/mg-loader.js +2 -2
  45. package/dist/components/mg-menu-item2.js +8 -7
  46. package/dist/components/mg-menu-item2.js.map +1 -1
  47. package/dist/components/mg-message.js +3 -3
  48. package/dist/components/mg-modal.js +6 -6
  49. package/dist/components/mg-pagination2.js +2 -2
  50. package/dist/components/mg-panel.js +4 -4
  51. package/dist/components/mg-popover-content2.js +3 -3
  52. package/dist/components/mg-popover2.js +9 -5
  53. package/dist/components/mg-popover2.js.map +1 -1
  54. package/dist/components/mg-skip-links.js +2 -2
  55. package/dist/components/mg-tabs.js +6 -6
  56. package/dist/components/mg-tag.js +3 -3
  57. package/dist/components/mg-tooltip2.js +6 -6
  58. package/dist/esm/{index-8d5d1bfd.js → index-138ea119.js} +62 -22
  59. package/dist/esm/index-138ea119.js.map +1 -0
  60. package/dist/esm/index-c4faef56.js +1607 -0
  61. package/dist/esm/index-c4faef56.js.map +1 -0
  62. package/dist/esm/loader.js +2 -2
  63. package/dist/esm/mg-action-more_36.entry.js +123 -115
  64. package/dist/esm/mg-action-more_36.entry.js.map +1 -1
  65. package/dist/esm/mg-components.js +10 -10
  66. package/dist/esm/mg-components.js.map +1 -1
  67. package/dist/esm/mg-loader.entry.js +3 -3
  68. package/dist/mg-components/mg-components.esm.js +1 -1
  69. package/dist/mg-components/mg-components.esm.js.map +1 -1
  70. package/dist/mg-components/p-284c8327.entry.js +2 -0
  71. package/dist/mg-components/p-284c8327.entry.js.map +1 -0
  72. package/dist/mg-components/p-4c68f6ea.js +3 -0
  73. package/dist/mg-components/p-4c68f6ea.js.map +1 -0
  74. package/dist/mg-components/{p-99e2f42a.entry.js → p-bac6ca1f.entry.js} +2 -2
  75. package/dist/mg-components/p-e9433a87.js +2 -0
  76. package/dist/mg-components/p-e9433a87.js.map +1 -0
  77. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +1 -5
  78. package/ide/intellij/web-types.json +1 -1
  79. package/ide/vscode/html-custom-data.json +1 -1
  80. package/package.json +21 -21
  81. package/dist/cjs/index-00072168.js.map +0 -1
  82. package/dist/cjs/index-7e27c7ae.js +0 -2561
  83. package/dist/cjs/index-7e27c7ae.js.map +0 -1
  84. package/dist/esm/index-8d5d1bfd.js.map +0 -1
  85. package/dist/esm/index-e479d5ae.js +0 -2532
  86. package/dist/esm/index-e479d5ae.js.map +0 -1
  87. package/dist/mg-components/p-7315d4a6.js +0 -3
  88. package/dist/mg-components/p-7315d4a6.js.map +0 -1
  89. package/dist/mg-components/p-8800813b.js +0 -2
  90. package/dist/mg-components/p-8800813b.js.map +0 -1
  91. package/dist/mg-components/p-f9ac8927.entry.js +0 -2
  92. package/dist/mg-components/p-f9ac8927.entry.js.map +0 -1
  93. /package/dist/mg-components/{p-99e2f42a.entry.js.map → p-bac6ca1f.entry.js.map} +0 -0
@@ -1,2561 +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 = 'mg-components';
24
- const BUILD = /* mg-components */ { allRenderFn: false, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: true, cmpShouldUpdate: true, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: true, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: true, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: true, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
25
-
26
- /**
27
- * Virtual DOM patching algorithm based on Snabbdom by
28
- * Simon Friis Vindum (@paldepind)
29
- * Licensed under the MIT License
30
- * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
31
- *
32
- * Modified for Stencil's renderer and slot projection
33
- */
34
- let scopeId;
35
- let contentRef;
36
- let hostTagName;
37
- let useNativeShadowDom = false;
38
- let checkSlotFallbackVisibility = false;
39
- let checkSlotRelocate = false;
40
- let isSvgMode = false;
41
- let queuePending = false;
42
- const createTime = (fnName, tagName = '') => {
43
- {
44
- return () => {
45
- return;
46
- };
47
- }
48
- };
49
- const uniqueTime = (key, measureText) => {
50
- {
51
- return () => {
52
- return;
53
- };
54
- }
55
- };
56
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
57
- /**
58
- * Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
59
- *
60
- * Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
61
- * support as of Stencil v4.
62
- */
63
- const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
64
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
65
- /**
66
- * Default style mode id
67
- */
68
- /**
69
- * Reusable empty obj/array
70
- * Don't add values to these!!
71
- */
72
- const EMPTY_OBJ = {};
73
- const isDef = (v) => v != null;
74
- /**
75
- * Check whether a value is a 'complex type', defined here as an object or a
76
- * function.
77
- *
78
- * @param o the value to check
79
- * @returns whether it's a complex type or not
80
- */
81
- const isComplexType = (o) => {
82
- // https://jsperf.com/typeof-fn-object/5
83
- o = typeof o;
84
- return o === 'object' || o === 'function';
85
- };
86
- /**
87
- * Helper method for querying a `meta` tag that contains a nonce value
88
- * out of a DOM's head.
89
- *
90
- * @param doc The DOM containing the `head` to query against
91
- * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
92
- * exists or the tag has no content.
93
- */
94
- function queryNonceMetaTagContent(doc) {
95
- var _a, _b, _c;
96
- 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;
97
- }
98
- /**
99
- * Production h() function based on Preact by
100
- * Jason Miller (@developit)
101
- * Licensed under the MIT License
102
- * https://github.com/developit/preact/blob/master/LICENSE
103
- *
104
- * Modified for Stencil's compiler and vdom
105
- */
106
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
107
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
108
- const h = (nodeName, vnodeData, ...children) => {
109
- let child = null;
110
- let key = null;
111
- let slotName = null;
112
- let simple = false;
113
- let lastSimple = false;
114
- const vNodeChildren = [];
115
- const walk = (c) => {
116
- for (let i = 0; i < c.length; i++) {
117
- child = c[i];
118
- if (Array.isArray(child)) {
119
- walk(child);
120
- }
121
- else if (child != null && typeof child !== 'boolean') {
122
- if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
123
- child = String(child);
124
- }
125
- if (simple && lastSimple) {
126
- // If the previous child was simple (string), we merge both
127
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
128
- }
129
- else {
130
- // Append a new vNode, if it's text, we create a text vNode
131
- vNodeChildren.push(simple ? newVNode(null, child) : child);
132
- }
133
- lastSimple = simple;
134
- }
135
- }
136
- };
137
- walk(children);
138
- if (vnodeData) {
139
- if (vnodeData.key) {
140
- key = vnodeData.key;
141
- }
142
- if (vnodeData.name) {
143
- slotName = vnodeData.name;
144
- }
145
- // normalize class / className attributes
146
- {
147
- const classData = vnodeData.className || vnodeData.class;
148
- if (classData) {
149
- vnodeData.class =
150
- typeof classData !== 'object'
151
- ? classData
152
- : Object.keys(classData)
153
- .filter((k) => classData[k])
154
- .join(' ');
155
- }
156
- }
157
- }
158
- if (typeof nodeName === 'function') {
159
- // nodeName is a functional component
160
- return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
161
- }
162
- const vnode = newVNode(nodeName, null);
163
- vnode.$attrs$ = vnodeData;
164
- if (vNodeChildren.length > 0) {
165
- vnode.$children$ = vNodeChildren;
166
- }
167
- {
168
- vnode.$key$ = key;
169
- }
170
- {
171
- vnode.$name$ = slotName;
172
- }
173
- return vnode;
174
- };
175
- /**
176
- * A utility function for creating a virtual DOM node from a tag and some
177
- * possible text content.
178
- *
179
- * @param tag the tag for this element
180
- * @param text possible text content for the node
181
- * @returns a newly-minted virtual DOM node
182
- */
183
- const newVNode = (tag, text) => {
184
- const vnode = {
185
- $flags$: 0,
186
- $tag$: tag,
187
- $text$: text,
188
- $elm$: null,
189
- $children$: null,
190
- };
191
- {
192
- vnode.$attrs$ = null;
193
- }
194
- {
195
- vnode.$key$ = null;
196
- }
197
- {
198
- vnode.$name$ = null;
199
- }
200
- return vnode;
201
- };
202
- const Host = {};
203
- /**
204
- * Check whether a given node is a Host node or not
205
- *
206
- * @param node the virtual DOM node to check
207
- * @returns whether it's a Host node or not
208
- */
209
- const isHost = (node) => node && node.$tag$ === Host;
210
- /**
211
- * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
212
- *
213
- * Note that these functions convert from {@link d.VNode} to
214
- * {@link d.ChildNode} to give functional component developers a friendly
215
- * interface.
216
- */
217
- const vdomFnUtils = {
218
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
219
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
220
- };
221
- /**
222
- * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
223
- * friendlier public interface (hence, 'convertToPublic').
224
- *
225
- * @param node the virtual DOM node to convert
226
- * @returns a converted child node
227
- */
228
- const convertToPublic = (node) => ({
229
- vattrs: node.$attrs$,
230
- vchildren: node.$children$,
231
- vkey: node.$key$,
232
- vname: node.$name$,
233
- vtag: node.$tag$,
234
- vtext: node.$text$,
235
- });
236
- /**
237
- * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
238
- * order to use the resulting object in the virtual DOM. The initial object was
239
- * likely created as part of presenting a public API, so converting it back
240
- * involved making it 'private' again (hence, `convertToPrivate`).
241
- *
242
- * @param node the child node to convert
243
- * @returns a converted virtual DOM node
244
- */
245
- const convertToPrivate = (node) => {
246
- if (typeof node.vtag === 'function') {
247
- const vnodeData = Object.assign({}, node.vattrs);
248
- if (node.vkey) {
249
- vnodeData.key = node.vkey;
250
- }
251
- if (node.vname) {
252
- vnodeData.name = node.vname;
253
- }
254
- return h(node.vtag, vnodeData, ...(node.vchildren || []));
255
- }
256
- const vnode = newVNode(node.vtag, node.vtext);
257
- vnode.$attrs$ = node.vattrs;
258
- vnode.$children$ = node.vchildren;
259
- vnode.$key$ = node.vkey;
260
- vnode.$name$ = node.vname;
261
- return vnode;
262
- };
263
- /**
264
- * Parse a new property value for a given property type.
265
- *
266
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
267
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
268
- * 1. `any`, the type given to `propValue` in the function signature
269
- * 2. the type stored from `propType`.
270
- *
271
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
272
- *
273
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
274
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
275
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
276
- * ```tsx
277
- * <my-cmp prop-val={0}></my-cmp>
278
- * ```
279
- *
280
- * HTML prop values on the other hand, will always a string
281
- *
282
- * @param propValue the new value to coerce to some type
283
- * @param propType the type of the prop, expressed as a binary number
284
- * @returns the parsed/coerced value
285
- */
286
- const parsePropertyValue = (propValue, propType) => {
287
- // ensure this value is of the correct prop type
288
- if (propValue != null && !isComplexType(propValue)) {
289
- if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
290
- // per the HTML spec, any string value means it is a boolean true value
291
- // but we'll cheat here and say that the string "false" is the boolean false
292
- return propValue === 'false' ? false : propValue === '' || !!propValue;
293
- }
294
- if (propType & 2 /* MEMBER_FLAGS.Number */) {
295
- // force it to be a number
296
- return parseFloat(propValue);
297
- }
298
- if (propType & 1 /* MEMBER_FLAGS.String */) {
299
- // could have been passed as a number or boolean
300
- // but we still want it as a string
301
- return String(propValue);
302
- }
303
- // redundant return here for better minification
304
- return propValue;
305
- }
306
- // not sure exactly what type we want
307
- // so no need to change to a different type
308
- return propValue;
309
- };
310
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
311
- const createEvent = (ref, name, flags) => {
312
- const elm = getElement(ref);
313
- return {
314
- emit: (detail) => {
315
- return emitEvent(elm, name, {
316
- bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
317
- composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
318
- cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
319
- detail,
320
- });
321
- },
322
- };
323
- };
324
- /**
325
- * Helper function to create & dispatch a custom Event on a provided target
326
- * @param elm the target of the Event
327
- * @param name the name to give the custom Event
328
- * @param opts options for configuring a custom Event
329
- * @returns the custom Event
330
- */
331
- const emitEvent = (elm, name, opts) => {
332
- const ev = plt.ce(name, opts);
333
- elm.dispatchEvent(ev);
334
- return ev;
335
- };
336
- const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
337
- const registerStyle = (scopeId, cssText, allowCS) => {
338
- let style = styles.get(scopeId);
339
- if (supportsConstructableStylesheets && allowCS) {
340
- style = (style || new CSSStyleSheet());
341
- if (typeof style === 'string') {
342
- style = cssText;
343
- }
344
- else {
345
- style.replaceSync(cssText);
346
- }
347
- }
348
- else {
349
- style = cssText;
350
- }
351
- styles.set(scopeId, style);
352
- };
353
- const addStyle = (styleContainerNode, cmpMeta, mode) => {
354
- var _a;
355
- const scopeId = getScopeId(cmpMeta);
356
- const style = styles.get(scopeId);
357
- // if an element is NOT connected then getRootNode() will return the wrong root node
358
- // so the fallback is to always use the document for the root node in those cases
359
- styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
360
- if (style) {
361
- if (typeof style === 'string') {
362
- styleContainerNode = styleContainerNode.head || styleContainerNode;
363
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
364
- let styleElm;
365
- if (!appliedStyles) {
366
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
367
- }
368
- if (!appliedStyles.has(scopeId)) {
369
- {
370
- styleElm = doc.createElement('style');
371
- styleElm.innerHTML = style;
372
- // Apply CSP nonce to the style tag if it exists
373
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
374
- if (nonce != null) {
375
- styleElm.setAttribute('nonce', nonce);
376
- }
377
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
378
- }
379
- // Add styles for `slot-fb` elements if we're using slots outside the Shadow DOM
380
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
381
- styleElm.innerHTML += SLOT_FB_CSS;
382
- }
383
- if (appliedStyles) {
384
- appliedStyles.add(scopeId);
385
- }
386
- }
387
- }
388
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
389
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
390
- }
391
- }
392
- return scopeId;
393
- };
394
- const attachStyles = (hostRef) => {
395
- const cmpMeta = hostRef.$cmpMeta$;
396
- const elm = hostRef.$hostElement$;
397
- const flags = cmpMeta.$flags$;
398
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
399
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
400
- if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
401
- // only required when we're NOT using native shadow dom (slot)
402
- // or this browser doesn't support native shadow dom
403
- // and this host element was NOT created with SSR
404
- // let's pick out the inner content for slot projection
405
- // create a node to represent where the original
406
- // content was first placed, which is useful later on
407
- // DOM WRITE!!
408
- elm['s-sc'] = scopeId;
409
- elm.classList.add(scopeId + '-h');
410
- if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
411
- elm.classList.add(scopeId + '-s');
412
- }
413
- }
414
- endAttachStyles();
415
- };
416
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
417
- /**
418
- * Production setAccessor() function based on Preact by
419
- * Jason Miller (@developit)
420
- * Licensed under the MIT License
421
- * https://github.com/developit/preact/blob/master/LICENSE
422
- *
423
- * Modified for Stencil's compiler and vdom
424
- */
425
- /**
426
- * When running a VDom render set properties present on a VDom node onto the
427
- * corresponding HTML element.
428
- *
429
- * Note that this function has special functionality for the `class`,
430
- * `style`, `key`, and `ref` attributes, as well as event handlers (like
431
- * `onClick`, etc). All others are just passed through as-is.
432
- *
433
- * @param elm the HTMLElement onto which attributes should be set
434
- * @param memberName the name of the attribute to set
435
- * @param oldValue the old value for the attribute
436
- * @param newValue the new value for the attribute
437
- * @param isSvg whether we're in an svg context or not
438
- * @param flags bitflags for Vdom variables
439
- */
440
- const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
441
- if (oldValue !== newValue) {
442
- let isProp = isMemberInElement(elm, memberName);
443
- let ln = memberName.toLowerCase();
444
- if (memberName === 'class') {
445
- const classList = elm.classList;
446
- const oldClasses = parseClassList(oldValue);
447
- const newClasses = parseClassList(newValue);
448
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
449
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
450
- }
451
- else if (memberName === 'style') {
452
- // update style attribute, css properties and values
453
- {
454
- for (const prop in oldValue) {
455
- if (!newValue || newValue[prop] == null) {
456
- if (prop.includes('-')) {
457
- elm.style.removeProperty(prop);
458
- }
459
- else {
460
- elm.style[prop] = '';
461
- }
462
- }
463
- }
464
- }
465
- for (const prop in newValue) {
466
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
467
- if (prop.includes('-')) {
468
- elm.style.setProperty(prop, newValue[prop]);
469
- }
470
- else {
471
- elm.style[prop] = newValue[prop];
472
- }
473
- }
474
- }
475
- }
476
- else if (memberName === 'key')
477
- ;
478
- else if (memberName === 'ref') {
479
- // minifier will clean this up
480
- if (newValue) {
481
- newValue(elm);
482
- }
483
- }
484
- else if ((!isProp ) &&
485
- memberName[0] === 'o' &&
486
- memberName[1] === 'n') {
487
- // Event Handlers
488
- // so if the member name starts with "on" and the 3rd characters is
489
- // a capital letter, and it's not already a member on the element,
490
- // then we're assuming it's an event listener
491
- if (memberName[2] === '-') {
492
- // on- prefixed events
493
- // allows to be explicit about the dom event to listen without any magic
494
- // under the hood:
495
- // <my-cmp on-click> // listens for "click"
496
- // <my-cmp on-Click> // listens for "Click"
497
- // <my-cmp on-ionChange> // listens for "ionChange"
498
- // <my-cmp on-EVENTS> // listens for "EVENTS"
499
- memberName = memberName.slice(3);
500
- }
501
- else if (isMemberInElement(win, ln)) {
502
- // standard event
503
- // the JSX attribute could have been "onMouseOver" and the
504
- // member name "onmouseover" is on the window's prototype
505
- // so let's add the listener "mouseover", which is all lowercased
506
- memberName = ln.slice(2);
507
- }
508
- else {
509
- // custom event
510
- // the JSX attribute could have been "onMyCustomEvent"
511
- // so let's trim off the "on" prefix and lowercase the first character
512
- // and add the listener "myCustomEvent"
513
- // except for the first character, we keep the event name case
514
- memberName = ln[2] + memberName.slice(3);
515
- }
516
- if (oldValue || newValue) {
517
- // Need to account for "capture" events.
518
- // If the event name ends with "Capture", we'll update the name to remove
519
- // the "Capture" suffix and make sure the event listener is setup to handle the capture event.
520
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
521
- // Make sure we only replace the last instance of "Capture"
522
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
523
- if (oldValue) {
524
- plt.rel(elm, memberName, oldValue, capture);
525
- }
526
- if (newValue) {
527
- plt.ael(elm, memberName, newValue, capture);
528
- }
529
- }
530
- }
531
- else {
532
- // Set property if it exists and it's not a SVG
533
- const isComplex = isComplexType(newValue);
534
- if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
535
- try {
536
- if (!elm.tagName.includes('-')) {
537
- const n = newValue == null ? '' : newValue;
538
- // Workaround for Safari, moving the <input> caret when re-assigning the same valued
539
- if (memberName === 'list') {
540
- isProp = false;
541
- }
542
- else if (oldValue == null || elm[memberName] != n) {
543
- elm[memberName] = n;
544
- }
545
- }
546
- else {
547
- elm[memberName] = newValue;
548
- }
549
- }
550
- catch (e) {
551
- /**
552
- * in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
553
- */
554
- }
555
- }
556
- /**
557
- * Need to manually update attribute if:
558
- * - memberName is not an attribute
559
- * - if we are rendering the host element in order to reflect attribute
560
- * - if it's a SVG, since properties might not work in <svg>
561
- * - if the newValue is null/undefined or 'false'.
562
- */
563
- let xlink = false;
564
- {
565
- if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
566
- memberName = ln;
567
- xlink = true;
568
- }
569
- }
570
- if (newValue == null || newValue === false) {
571
- if (newValue !== false || elm.getAttribute(memberName) === '') {
572
- if (xlink) {
573
- elm.removeAttributeNS(XLINK_NS, memberName);
574
- }
575
- else {
576
- elm.removeAttribute(memberName);
577
- }
578
- }
579
- }
580
- else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
581
- newValue = newValue === true ? '' : newValue;
582
- if (xlink) {
583
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
584
- }
585
- else {
586
- elm.setAttribute(memberName, newValue);
587
- }
588
- }
589
- }
590
- }
591
- };
592
- const parseClassListRegex = /\s/;
593
- /**
594
- * Parsed a string of classnames into an array
595
- * @param value className string, e.g. "foo bar baz"
596
- * @returns list of classes, e.g. ["foo", "bar", "baz"]
597
- */
598
- const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
599
- const CAPTURE_EVENT_SUFFIX = 'Capture';
600
- const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
601
- const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
602
- // if the element passed in is a shadow root, which is a document fragment
603
- // then we want to be adding attrs/props to the shadow root's "host" element
604
- // if it's not a shadow root, then we add attrs/props to the same element
605
- const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
606
- ? newVnode.$elm$.host
607
- : newVnode.$elm$;
608
- const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
609
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
610
- {
611
- // remove attributes no longer present on the vnode by setting them to undefined
612
- for (memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
613
- if (!(memberName in newVnodeAttrs)) {
614
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
615
- }
616
- }
617
- }
618
- // add new & update changed attributes
619
- for (memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
620
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
621
- }
622
- };
623
- /**
624
- * Sort a list of attribute names to ensure that all the attribute names which
625
- * are _not_ `"ref"` come before `"ref"`. Preserve the order of the non-ref
626
- * attributes.
627
- *
628
- * **Note**: if the supplied attributes do not include `'ref'` then the same
629
- * (by reference) array will be returned without modification.
630
- *
631
- * @param attrNames attribute names to sort
632
- * @returns a list of attribute names, sorted if they include `"ref"`
633
- */
634
- function sortedAttrNames(attrNames) {
635
- return attrNames.includes('ref')
636
- ? // we need to sort these to ensure that `'ref'` is the last attr
637
- [...attrNames.filter((attr) => attr !== 'ref'), 'ref']
638
- : // no need to sort, return the original array
639
- attrNames;
640
- }
641
- /**
642
- * Create a DOM Node corresponding to one of the children of a given VNode.
643
- *
644
- * @param oldParentVNode the parent VNode from the previous render
645
- * @param newParentVNode the parent VNode from the current render
646
- * @param childIndex the index of the VNode, in the _new_ parent node's
647
- * children, for which we will create a new DOM node
648
- * @param parentElm the parent DOM node which our new node will be a child of
649
- * @returns the newly created node
650
- */
651
- const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
652
- var _a;
653
- // tslint:disable-next-line: prefer-const
654
- const newVNode = newParentVNode.$children$[childIndex];
655
- let i = 0;
656
- let elm;
657
- let childNode;
658
- let oldVNode;
659
- if (!useNativeShadowDom) {
660
- // remember for later we need to check to relocate nodes
661
- checkSlotRelocate = true;
662
- if (newVNode.$tag$ === 'slot') {
663
- if (scopeId) {
664
- // scoped css needs to add its scoped id to the parent element
665
- parentElm.classList.add(scopeId + '-s');
666
- }
667
- newVNode.$flags$ |= newVNode.$children$
668
- ? // slot element has fallback content
669
- 2 /* VNODE_FLAGS.isSlotFallback */
670
- : // slot element does not have fallback content
671
- 1 /* VNODE_FLAGS.isSlotReference */;
672
- }
673
- }
674
- if (newVNode.$text$ !== null) {
675
- // create text node
676
- elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
677
- }
678
- else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
679
- // create a slot reference node
680
- elm = newVNode.$elm$ =
681
- doc.createTextNode('');
682
- }
683
- else {
684
- // create element
685
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
686
- ? 'slot-fb'
687
- : newVNode.$tag$));
688
- // add css classes, attrs, props, listeners, etc.
689
- {
690
- updateElement(null, newVNode, isSvgMode);
691
- }
692
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
693
- // if there is a scopeId and this is the initial render
694
- // then let's add the scopeId as a css class
695
- elm.classList.add((elm['s-si'] = scopeId));
696
- }
697
- if (newVNode.$children$) {
698
- for (i = 0; i < newVNode.$children$.length; ++i) {
699
- // create the node
700
- childNode = createElm(oldParentVNode, newVNode, i, elm);
701
- // return node could have been null
702
- if (childNode) {
703
- // append our new node
704
- elm.appendChild(childNode);
705
- }
706
- }
707
- }
708
- }
709
- // This needs to always happen so we can hide nodes that are projected
710
- // to another component but don't end up in a slot
711
- elm['s-hn'] = hostTagName;
712
- {
713
- if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
714
- // remember the content reference comment
715
- elm['s-sr'] = true;
716
- // remember the content reference comment
717
- elm['s-cr'] = contentRef;
718
- // remember the slot name, or empty string for default slot
719
- elm['s-sn'] = newVNode.$name$ || '';
720
- // remember the ref callback function
721
- elm['s-rf'] = (_a = newVNode.$attrs$) === null || _a === void 0 ? void 0 : _a.ref;
722
- // check if we've got an old vnode for this slot
723
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
724
- if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
725
- {
726
- // we've got an old slot vnode and the wrapper is being replaced
727
- // so let's move the old slot content back to its original location
728
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
729
- }
730
- }
731
- }
732
- }
733
- return elm;
734
- };
735
- const putBackInOriginalLocation = (parentElm, recursive) => {
736
- plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
737
- const oldSlotChildNodes = Array.from(parentElm.childNodes);
738
- if (parentElm['s-sr'] && BUILD.experimentalSlotFixes) {
739
- let node = parentElm;
740
- while ((node = node.nextSibling)) {
741
- if (node && node['s-sn'] === parentElm['s-sn'] && node['s-sh'] === hostTagName) {
742
- oldSlotChildNodes.push(node);
743
- }
744
- }
745
- }
746
- for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
747
- const childNode = oldSlotChildNodes[i];
748
- if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
749
- // and relocate it back to it's original location
750
- parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
751
- // remove the old original location comment entirely
752
- // later on the patch function will know what to do
753
- // and move this to the correct spot if need be
754
- childNode['s-ol'].remove();
755
- childNode['s-ol'] = undefined;
756
- // Reset so we can correctly move the node around again.
757
- childNode['s-sh'] = undefined;
758
- checkSlotRelocate = true;
759
- }
760
- if (recursive) {
761
- putBackInOriginalLocation(childNode, recursive);
762
- }
763
- }
764
- plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
765
- };
766
- /**
767
- * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
768
- * add them to the DOM in the appropriate place.
769
- *
770
- * @param parentElm the DOM node which should be used as a parent for the new
771
- * DOM nodes
772
- * @param before a child of the `parentElm` which the new children should be
773
- * inserted before (optional)
774
- * @param parentVNode the parent virtual DOM node
775
- * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
776
- * @param startIdx the index in the child virtual DOM nodes at which to start
777
- * creating DOM nodes (inclusive)
778
- * @param endIdx the index in the child virtual DOM nodes at which to stop
779
- * creating DOM nodes (inclusive)
780
- */
781
- const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
782
- let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
783
- let childNode;
784
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
785
- containerElm = containerElm.shadowRoot;
786
- }
787
- for (; startIdx <= endIdx; ++startIdx) {
788
- if (vnodes[startIdx]) {
789
- childNode = createElm(null, parentVNode, startIdx, parentElm);
790
- if (childNode) {
791
- vnodes[startIdx].$elm$ = childNode;
792
- containerElm.insertBefore(childNode, referenceNode(before) );
793
- }
794
- }
795
- }
796
- };
797
- /**
798
- * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
799
- * This can be used to, for instance, clean up after a list of children which
800
- * should no longer be shown.
801
- *
802
- * This function also handles some of Stencil's slot relocation logic.
803
- *
804
- * @param vnodes a list of virtual DOM nodes to remove
805
- * @param startIdx the index at which to start removing nodes (inclusive)
806
- * @param endIdx the index at which to stop removing nodes (inclusive)
807
- */
808
- const removeVnodes = (vnodes, startIdx, endIdx) => {
809
- for (let index = startIdx; index <= endIdx; ++index) {
810
- const vnode = vnodes[index];
811
- if (vnode) {
812
- const elm = vnode.$elm$;
813
- nullifyVNodeRefs(vnode);
814
- if (elm) {
815
- {
816
- // we're removing this element
817
- // so it's possible we need to show slot fallback content now
818
- checkSlotFallbackVisibility = true;
819
- if (elm['s-ol']) {
820
- // remove the original location comment
821
- elm['s-ol'].remove();
822
- }
823
- else {
824
- // it's possible that child nodes of the node
825
- // that's being removed are slot nodes
826
- putBackInOriginalLocation(elm, true);
827
- }
828
- }
829
- // remove the vnode's element from the dom
830
- elm.remove();
831
- }
832
- }
833
- }
834
- };
835
- /**
836
- * Reconcile the children of a new VNode with the children of an old VNode by
837
- * traversing the two collections of children, identifying nodes that are
838
- * conserved or changed, calling out to `patch` to make any necessary
839
- * updates to the DOM, and rearranging DOM nodes as needed.
840
- *
841
- * The algorithm for reconciling children works by analyzing two 'windows' onto
842
- * the two arrays of children (`oldCh` and `newCh`). We keep track of the
843
- * 'windows' by storing start and end indices and references to the
844
- * corresponding array entries. Initially the two 'windows' are basically equal
845
- * to the entire array, but we progressively narrow the windows until there are
846
- * no children left to update by doing the following:
847
- *
848
- * 1. Skip any `null` entries at the beginning or end of the two arrays, so
849
- * that if we have an initial array like the following we'll end up dealing
850
- * only with a window bounded by the highlighted elements:
851
- *
852
- * [null, null, VNode1 , ... , VNode2, null, null]
853
- * ^^^^^^ ^^^^^^
854
- *
855
- * 2. Check to see if the elements at the head and tail positions are equal
856
- * across the windows. This will basically detect elements which haven't
857
- * been added, removed, or changed position, i.e. if you had the following
858
- * VNode elements (represented as HTML):
859
- *
860
- * oldVNode: `<div><p><span>HEY</span></p></div>`
861
- * newVNode: `<div><p><span>THERE</span></p></div>`
862
- *
863
- * Then when comparing the children of the `<div>` tag we check the equality
864
- * of the VNodes corresponding to the `<p>` tags and, since they are the
865
- * same tag in the same position, we'd be able to avoid completely
866
- * re-rendering the subtree under them with a new DOM element and would just
867
- * call out to `patch` to handle reconciling their children and so on.
868
- *
869
- * 3. Check, for both windows, to see if the element at the beginning of the
870
- * window corresponds to the element at the end of the other window. This is
871
- * a heuristic which will let us identify _some_ situations in which
872
- * elements have changed position, for instance it _should_ detect that the
873
- * children nodes themselves have not changed but merely moved in the
874
- * following example:
875
- *
876
- * oldVNode: `<div><element-one /><element-two /></div>`
877
- * newVNode: `<div><element-two /><element-one /></div>`
878
- *
879
- * If we find cases like this then we also need to move the concrete DOM
880
- * elements corresponding to the moved children to write the re-order to the
881
- * DOM.
882
- *
883
- * 4. Finally, if VNodes have the `key` attribute set on them we check for any
884
- * nodes in the old children which have the same key as the first element in
885
- * our window on the new children. If we find such a node we handle calling
886
- * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
887
- * what we find.
888
- *
889
- * Finally, once we've narrowed our 'windows' to the point that either of them
890
- * collapse (i.e. they have length 0) we then handle any remaining VNode
891
- * insertion or deletion that needs to happen to get a DOM state that correctly
892
- * reflects the new child VNodes. If, for instance, after our window on the old
893
- * children has collapsed we still have more nodes on the new children that
894
- * we haven't dealt with yet then we need to add them, or if the new children
895
- * collapse but we still have unhandled _old_ children then we need to make
896
- * sure the corresponding DOM nodes are removed.
897
- *
898
- * @param parentElm the node into which the parent VNode is rendered
899
- * @param oldCh the old children of the parent node
900
- * @param newVNode the new VNode which will replace the parent
901
- * @param newCh the new children of the parent node
902
- * @param isInitialRender whether or not this is the first render of the vdom
903
- */
904
- const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
905
- let oldStartIdx = 0;
906
- let newStartIdx = 0;
907
- let idxInOld = 0;
908
- let i = 0;
909
- let oldEndIdx = oldCh.length - 1;
910
- let oldStartVnode = oldCh[0];
911
- let oldEndVnode = oldCh[oldEndIdx];
912
- let newEndIdx = newCh.length - 1;
913
- let newStartVnode = newCh[0];
914
- let newEndVnode = newCh[newEndIdx];
915
- let node;
916
- let elmToMove;
917
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
918
- if (oldStartVnode == null) {
919
- // VNode might have been moved left
920
- oldStartVnode = oldCh[++oldStartIdx];
921
- }
922
- else if (oldEndVnode == null) {
923
- oldEndVnode = oldCh[--oldEndIdx];
924
- }
925
- else if (newStartVnode == null) {
926
- newStartVnode = newCh[++newStartIdx];
927
- }
928
- else if (newEndVnode == null) {
929
- newEndVnode = newCh[--newEndIdx];
930
- }
931
- else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
932
- // if the start nodes are the same then we should patch the new VNode
933
- // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
934
- // indices to reflect that. We don't need to move any DOM Nodes around
935
- // since things are matched up in order.
936
- patch(oldStartVnode, newStartVnode, isInitialRender);
937
- oldStartVnode = oldCh[++oldStartIdx];
938
- newStartVnode = newCh[++newStartIdx];
939
- }
940
- else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
941
- // likewise, if the end nodes are the same we patch new onto old and
942
- // decrement our end indices, and also likewise in this case we don't
943
- // need to move any DOM Nodes.
944
- patch(oldEndVnode, newEndVnode, isInitialRender);
945
- oldEndVnode = oldCh[--oldEndIdx];
946
- newEndVnode = newCh[--newEndIdx];
947
- }
948
- else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
949
- // case: "Vnode moved right"
950
- //
951
- // We've found that the last node in our window on the new children is
952
- // the same VNode as the _first_ node in our window on the old children
953
- // we're dealing with now. Visually, this is the layout of these two
954
- // nodes:
955
- //
956
- // newCh: [..., newStartVnode , ... , newEndVnode , ...]
957
- // ^^^^^^^^^^^
958
- // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
959
- // ^^^^^^^^^^^^^
960
- //
961
- // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
962
- // and move the DOM element for `oldStartVnode`.
963
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
964
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
965
- }
966
- patch(oldStartVnode, newEndVnode, isInitialRender);
967
- // We need to move the element for `oldStartVnode` into a position which
968
- // will be appropriate for `newEndVnode`. For this we can use
969
- // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
970
- // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
971
- // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
972
- //
973
- // <old-start-node />
974
- // <some-intervening-node />
975
- // <old-end-node />
976
- // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
977
- // <next-sibling />
978
- //
979
- // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
980
- // the node for `oldStartVnode` at the end of the children of
981
- // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
982
- // aren't any siblings, and passing `null` to `Node.insertBefore` will
983
- // append it to the children of the parent element.
984
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
985
- oldStartVnode = oldCh[++oldStartIdx];
986
- newEndVnode = newCh[--newEndIdx];
987
- }
988
- else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
989
- // case: "Vnode moved left"
990
- //
991
- // We've found that the first node in our window on the new children is
992
- // the same VNode as the _last_ node in our window on the old children.
993
- // Visually, this is the layout of these two nodes:
994
- //
995
- // newCh: [..., newStartVnode , ... , newEndVnode , ...]
996
- // ^^^^^^^^^^^^^
997
- // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
998
- // ^^^^^^^^^^^
999
- //
1000
- // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
1001
- // (which will handle updating any changed attributes, reconciling their
1002
- // children etc) but we also need to move the DOM node to which
1003
- // `oldEndVnode` corresponds.
1004
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1005
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1006
- }
1007
- patch(oldEndVnode, newStartVnode, isInitialRender);
1008
- // We've already checked above if `oldStartVnode` and `newStartVnode` are
1009
- // the same node, so since we're here we know that they are not. Thus we
1010
- // can move the element for `oldEndVnode` _before_ the element for
1011
- // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
1012
- // future.
1013
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
1014
- oldEndVnode = oldCh[--oldEndIdx];
1015
- newStartVnode = newCh[++newStartIdx];
1016
- }
1017
- else {
1018
- // Here we do some checks to match up old and new nodes based on the
1019
- // `$key$` attribute, which is set by putting a `key="my-key"` attribute
1020
- // in the JSX for a DOM element in the implementation of a Stencil
1021
- // component.
1022
- //
1023
- // First we check to see if there are any nodes in the array of old
1024
- // children which have the same key as the first node in the new
1025
- // children.
1026
- idxInOld = -1;
1027
- {
1028
- for (i = oldStartIdx; i <= oldEndIdx; ++i) {
1029
- if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
1030
- idxInOld = i;
1031
- break;
1032
- }
1033
- }
1034
- }
1035
- if (idxInOld >= 0) {
1036
- // We found a node in the old children which matches up with the first
1037
- // node in the new children! So let's deal with that
1038
- elmToMove = oldCh[idxInOld];
1039
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1040
- // the tag doesn't match so we'll need a new DOM element
1041
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
1042
- }
1043
- else {
1044
- patch(elmToMove, newStartVnode, isInitialRender);
1045
- // invalidate the matching old node so that we won't try to update it
1046
- // again later on
1047
- oldCh[idxInOld] = undefined;
1048
- node = elmToMove.$elm$;
1049
- }
1050
- newStartVnode = newCh[++newStartIdx];
1051
- }
1052
- else {
1053
- // We either didn't find an element in the old children that matches
1054
- // the key of the first new child OR the build is not using `key`
1055
- // attributes at all. In either case we need to create a new element
1056
- // for the new node.
1057
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
1058
- newStartVnode = newCh[++newStartIdx];
1059
- }
1060
- if (node) {
1061
- // if we created a new node then handle inserting it to the DOM
1062
- {
1063
- parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1064
- }
1065
- }
1066
- }
1067
- }
1068
- if (oldStartIdx > oldEndIdx) {
1069
- // we have some more new nodes to add which don't match up with old nodes
1070
- addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
1071
- }
1072
- else if (newStartIdx > newEndIdx) {
1073
- // there are nodes in the `oldCh` array which no longer correspond to nodes
1074
- // in the new array, so lets remove them (which entails cleaning up the
1075
- // relevant DOM nodes)
1076
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1077
- }
1078
- };
1079
- /**
1080
- * Compare two VNodes to determine if they are the same
1081
- *
1082
- * **NB**: This function is an equality _heuristic_ based on the available
1083
- * information set on the two VNodes and can be misleading under certain
1084
- * circumstances. In particular, if the two nodes do not have `key` attrs
1085
- * (available under `$key$` on VNodes) then the function falls back on merely
1086
- * checking that they have the same tag.
1087
- *
1088
- * So, in other words, if `key` attrs are not set on VNodes which may be
1089
- * changing order within a `children` array or something along those lines then
1090
- * we could obtain a false negative and then have to do needless re-rendering
1091
- * (i.e. we'd say two VNodes aren't equal when in fact they should be).
1092
- *
1093
- * @param leftVNode the first VNode to check
1094
- * @param rightVNode the second VNode to check
1095
- * @param isInitialRender whether or not this is the first render of the vdom
1096
- * @returns whether they're equal or not
1097
- */
1098
- const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1099
- // compare if two vnode to see if they're "technically" the same
1100
- // need to have the same element tag, and same key to be the same
1101
- if (leftVNode.$tag$ === rightVNode.$tag$) {
1102
- if (leftVNode.$tag$ === 'slot') {
1103
- return leftVNode.$name$ === rightVNode.$name$;
1104
- }
1105
- // this will be set if JSX tags in the build have `key` attrs set on them
1106
- // we only want to check this if we're not on the first render since on
1107
- // first render `leftVNode.$key$` will always be `null`, so we can be led
1108
- // astray and, for instance, accidentally delete a DOM node that we want to
1109
- // keep around.
1110
- if (!isInitialRender) {
1111
- return leftVNode.$key$ === rightVNode.$key$;
1112
- }
1113
- return true;
1114
- }
1115
- return false;
1116
- };
1117
- const referenceNode = (node) => {
1118
- // this node was relocated to a new location in the dom
1119
- // because of some other component's slot
1120
- // but we still have an html comment in place of where
1121
- // it's original location was according to it's original vdom
1122
- return (node && node['s-ol']) || node;
1123
- };
1124
- const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1125
- /**
1126
- * Handle reconciling an outdated VNode with a new one which corresponds to
1127
- * it. This function handles flushing updates to the DOM and reconciling the
1128
- * children of the two nodes (if any).
1129
- *
1130
- * @param oldVNode an old VNode whose DOM element and children we want to update
1131
- * @param newVNode a new VNode representing an updated version of the old one
1132
- * @param isInitialRender whether or not this is the first render of the vdom
1133
- */
1134
- const patch = (oldVNode, newVNode, isInitialRender = false) => {
1135
- const elm = (newVNode.$elm$ = oldVNode.$elm$);
1136
- const oldChildren = oldVNode.$children$;
1137
- const newChildren = newVNode.$children$;
1138
- const tag = newVNode.$tag$;
1139
- const text = newVNode.$text$;
1140
- let defaultHolder;
1141
- if (text === null) {
1142
- {
1143
- if (tag === 'slot' && !useNativeShadowDom) ;
1144
- else {
1145
- // either this is the first render of an element OR it's an update
1146
- // AND we already know it's possible it could have changed
1147
- // this updates the element's css classes, attrs, props, listeners, etc.
1148
- updateElement(oldVNode, newVNode, isSvgMode);
1149
- }
1150
- }
1151
- if (oldChildren !== null && newChildren !== null) {
1152
- // looks like there's child vnodes for both the old and new vnodes
1153
- // so we need to call `updateChildren` to reconcile them
1154
- updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
1155
- }
1156
- else if (newChildren !== null) {
1157
- // no old child vnodes, but there are new child vnodes to add
1158
- if (oldVNode.$text$ !== null) {
1159
- // the old vnode was text, so be sure to clear it out
1160
- elm.textContent = '';
1161
- }
1162
- // add the new vnode children
1163
- addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1164
- }
1165
- else if (oldChildren !== null) {
1166
- // no new child vnodes, but there are old child vnodes to remove
1167
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
1168
- }
1169
- }
1170
- else if ((defaultHolder = elm['s-cr'])) {
1171
- // this element has slotted content
1172
- defaultHolder.parentNode.textContent = text;
1173
- }
1174
- else if (oldVNode.$text$ !== text) {
1175
- // update the text content for the text only vnode
1176
- // and also only if the text is different than before
1177
- elm.data = text;
1178
- }
1179
- };
1180
- /**
1181
- * Adjust the `.hidden` property as-needed on any nodes in a DOM subtree which
1182
- * are slot fallbacks nodes.
1183
- *
1184
- * A slot fallback node should be visible by default. Then, it should be
1185
- * conditionally hidden if:
1186
- *
1187
- * - it has a sibling with a `slot` property set to its slot name or if
1188
- * - it is a default fallback slot node, in which case we hide if it has any
1189
- * content
1190
- *
1191
- * @param elm the element of interest
1192
- */
1193
- const updateFallbackSlotVisibility = (elm) => {
1194
- const childNodes = elm.childNodes;
1195
- for (const childNode of childNodes) {
1196
- if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1197
- if (childNode['s-sr']) {
1198
- // this is a slot fallback node
1199
- // get the slot name for this slot reference node
1200
- const slotName = childNode['s-sn'];
1201
- // by default always show a fallback slot node
1202
- // then hide it if there are other slots in the light dom
1203
- childNode.hidden = false;
1204
- // we need to check all of its sibling nodes in order to see if
1205
- // `childNode` should be hidden
1206
- for (const siblingNode of childNodes) {
1207
- // Don't check the node against itself
1208
- if (siblingNode !== childNode) {
1209
- if (siblingNode['s-hn'] !== childNode['s-hn'] || slotName !== '') {
1210
- // this sibling node is from a different component OR is a named
1211
- // fallback slot node
1212
- if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
1213
- (slotName === siblingNode.getAttribute('slot') || slotName === siblingNode['s-sn'])) {
1214
- childNode.hidden = true;
1215
- break;
1216
- }
1217
- }
1218
- else {
1219
- // this is a default fallback slot node
1220
- // any element or text node (with content)
1221
- // should hide the default fallback slot node
1222
- if (siblingNode.nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1223
- (siblingNode.nodeType === 3 /* NODE_TYPE.TextNode */ && siblingNode.textContent.trim() !== '')) {
1224
- childNode.hidden = true;
1225
- break;
1226
- }
1227
- }
1228
- }
1229
- }
1230
- }
1231
- // keep drilling down
1232
- updateFallbackSlotVisibility(childNode);
1233
- }
1234
- }
1235
- };
1236
- /**
1237
- * Component-global information about nodes which are either currently being
1238
- * relocated or will be shortly.
1239
- */
1240
- const relocateNodes = [];
1241
- /**
1242
- * Mark the contents of a slot for relocation via adding references to them to
1243
- * the {@link relocateNodes} data structure. The actual work of relocating them
1244
- * will then be handled in {@link renderVdom}.
1245
- *
1246
- * @param elm a render node whose child nodes need to be relocated
1247
- */
1248
- const markSlotContentForRelocation = (elm) => {
1249
- // tslint:disable-next-line: prefer-const
1250
- let node;
1251
- let hostContentNodes;
1252
- let j;
1253
- for (const childNode of elm.childNodes) {
1254
- // we need to find child nodes which are slot references so we can then try
1255
- // to match them up with nodes that need to be relocated
1256
- if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1257
- // first get the content reference comment node ('s-cr'), then we get
1258
- // its parent, which is where all the host content is now
1259
- hostContentNodes = node.parentNode.childNodes;
1260
- const slotName = childNode['s-sn'];
1261
- // iterate through all the nodes under the location where the host was
1262
- // originally rendered
1263
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
1264
- node = hostContentNodes[j];
1265
- // check that the node is not a content reference node or a node
1266
- // reference and then check that the host name does not match that of
1267
- // childNode.
1268
- // In addition, check that the slot either has not already been relocated, or
1269
- // that its current location's host is not childNode's host. This is essentially
1270
- // a check so that we don't try to relocate (and then hide) a node that is already
1271
- // where it should be.
1272
- if (!node['s-cn'] &&
1273
- !node['s-nr'] &&
1274
- node['s-hn'] !== childNode['s-hn'] &&
1275
- (!BUILD.experimentalSlotFixes )) {
1276
- // if `node` is located in the slot that `childNode` refers to (via the
1277
- // `'s-sn'` property) then we need to relocate it from it's current spot
1278
- // (under the host element parent) to the right slot location
1279
- if (isNodeLocatedInSlot(node, slotName)) {
1280
- // it's possible we've already decided to relocate this node
1281
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1282
- // made some changes to slots
1283
- // let's make sure we also double check
1284
- // fallbacks are correctly hidden or shown
1285
- checkSlotFallbackVisibility = true;
1286
- // ensure that the slot-name attr is correct
1287
- node['s-sn'] = node['s-sn'] || slotName;
1288
- if (relocateNodeData) {
1289
- relocateNodeData.$nodeToRelocate$['s-sh'] = childNode['s-hn'];
1290
- // we marked this node for relocation previously but didn't find
1291
- // out the slot reference node to which it needs to be relocated
1292
- // so write it down now!
1293
- relocateNodeData.$slotRefNode$ = childNode;
1294
- }
1295
- else {
1296
- node['s-sh'] = childNode['s-hn'];
1297
- // add to our list of nodes to relocate
1298
- relocateNodes.push({
1299
- $slotRefNode$: childNode,
1300
- $nodeToRelocate$: node,
1301
- });
1302
- }
1303
- if (node['s-sr']) {
1304
- relocateNodes.map((relocateNode) => {
1305
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1306
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1307
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
1308
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1309
- }
1310
- }
1311
- });
1312
- }
1313
- }
1314
- else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1315
- // the node is not found within the slot (`childNode`) that we're
1316
- // currently looking at, so we stick it into `relocateNodes` to
1317
- // handle later. If we never find a home for this element then
1318
- // we'll need to hide it
1319
- relocateNodes.push({
1320
- $nodeToRelocate$: node,
1321
- });
1322
- }
1323
- }
1324
- }
1325
- }
1326
- // if we're dealing with any type of element (capable of itself being a
1327
- // slot reference or containing one) then we recur
1328
- if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1329
- markSlotContentForRelocation(childNode);
1330
- }
1331
- }
1332
- };
1333
- /**
1334
- * Check whether a node is located in a given named slot.
1335
- *
1336
- * @param nodeToRelocate the node of interest
1337
- * @param slotName the slot name to check
1338
- * @returns whether the node is located in the slot or not
1339
- */
1340
- const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
1341
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1342
- if (nodeToRelocate.getAttribute('slot') === null && slotName === '') {
1343
- // if the node doesn't have a slot attribute, and the slot we're checking
1344
- // is not a named slot, then we assume the node should be within the slot
1345
- return true;
1346
- }
1347
- if (nodeToRelocate.getAttribute('slot') === slotName) {
1348
- return true;
1349
- }
1350
- return false;
1351
- }
1352
- if (nodeToRelocate['s-sn'] === slotName) {
1353
- return true;
1354
- }
1355
- return slotName === '';
1356
- };
1357
- /**
1358
- * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
1359
- * them with `null`. This signals that the DOM element corresponding to the VDom
1360
- * node has been removed from the DOM.
1361
- *
1362
- * @param vNode a virtual DOM node
1363
- */
1364
- const nullifyVNodeRefs = (vNode) => {
1365
- {
1366
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1367
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1368
- }
1369
- };
1370
- /**
1371
- * The main entry point for Stencil's virtual DOM-based rendering engine
1372
- *
1373
- * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1374
- * function will handle creating a virtual DOM tree with a single root, patching
1375
- * the current virtual DOM tree onto an old one (if any), dealing with slot
1376
- * relocation, and reflecting attributes.
1377
- *
1378
- * @param hostRef data needed to root and render the virtual DOM tree, such as
1379
- * the DOM node into which it should be rendered.
1380
- * @param renderFnResults the virtual DOM nodes to be rendered
1381
- * @param isInitialLoad whether or not this is the first call after page load
1382
- */
1383
- const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1384
- var _a, _b, _c, _d;
1385
- const hostElm = hostRef.$hostElement$;
1386
- const cmpMeta = hostRef.$cmpMeta$;
1387
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1388
- // if `renderFnResults` is a Host node then we can use it directly. If not,
1389
- // we need to call `h` again to wrap the children of our component in a
1390
- // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
1391
- // implicitly that the top-level vdom node is 1) an only child and 2)
1392
- // contains attrs that need to be set on the host element.
1393
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1394
- hostTagName = hostElm.tagName;
1395
- if (cmpMeta.$attrsToReflect$) {
1396
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1397
- cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1398
- }
1399
- // On the first render and *only* on the first render we want to check for
1400
- // any attributes set on the host element which are also set on the vdom
1401
- // node. If we find them, we override the value on the VDom node attrs with
1402
- // the value from the host element, which allows developers building apps
1403
- // with Stencil components to override e.g. the `role` attribute on a
1404
- // component even if it's already set on the `Host`.
1405
- if (isInitialLoad && rootVnode.$attrs$) {
1406
- for (const key of Object.keys(rootVnode.$attrs$)) {
1407
- // We have a special implementation in `setAccessor` for `style` and
1408
- // `class` which reconciles values coming from the VDom with values
1409
- // already present on the DOM element, so we don't want to override those
1410
- // attributes on the VDom tree with values from the host element if they
1411
- // are present.
1412
- //
1413
- // Likewise, `ref` and `key` are special internal values for the Stencil
1414
- // runtime and we don't want to override those either.
1415
- if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
1416
- rootVnode.$attrs$[key] = hostElm[key];
1417
- }
1418
- }
1419
- }
1420
- rootVnode.$tag$ = null;
1421
- rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1422
- hostRef.$vnode$ = rootVnode;
1423
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1424
- {
1425
- scopeId = hostElm['s-sc'];
1426
- }
1427
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1428
- {
1429
- contentRef = hostElm['s-cr'];
1430
- // always reset
1431
- checkSlotFallbackVisibility = false;
1432
- }
1433
- // synchronous patch
1434
- patch(oldVNode, rootVnode, isInitialLoad);
1435
- {
1436
- // while we're moving nodes around existing nodes, temporarily disable
1437
- // the disconnectCallback from working
1438
- plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1439
- if (checkSlotRelocate) {
1440
- markSlotContentForRelocation(rootVnode.$elm$);
1441
- for (const relocateData of relocateNodes) {
1442
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1443
- if (!nodeToRelocate['s-ol']) {
1444
- // add a reference node marking this node's original location
1445
- // keep a reference to this node for later lookups
1446
- const orgLocationNode = doc.createTextNode('');
1447
- orgLocationNode['s-nr'] = nodeToRelocate;
1448
- nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1449
- }
1450
- }
1451
- for (const relocateData of relocateNodes) {
1452
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1453
- const slotRefNode = relocateData.$slotRefNode$;
1454
- if (slotRefNode) {
1455
- const parentNodeRef = slotRefNode.parentNode;
1456
- // When determining where to insert content, the most simple case would be
1457
- // to relocate the node immediately following the slot reference node. We do this
1458
- // by getting a reference to the node immediately following the slot reference node
1459
- // since we will use `insertBefore` to manipulate the DOM.
1460
- //
1461
- // If there is no node immediately following the slot reference node, then we will just
1462
- // end up appending the node as the last child of the parent.
1463
- let insertBeforeNode = slotRefNode.nextSibling;
1464
- // If the node we're currently planning on inserting the new node before is an element,
1465
- // we need to do some additional checks to make sure we're inserting the node in the correct order.
1466
- // The use case here would be that we have multiple nodes being relocated to the same slot. So, we want
1467
- // to make sure they get inserted into their new home in the same order they were declared in their original location.
1468
- //
1469
- // TODO(STENCIL-914): Remove `experimentalSlotFixes` check
1470
- {
1471
- let orgLocationNode = (_a = nodeToRelocate['s-ol']) === null || _a === void 0 ? void 0 : _a.previousSibling;
1472
- while (orgLocationNode) {
1473
- let refNode = (_b = orgLocationNode['s-nr']) !== null && _b !== void 0 ? _b : null;
1474
- if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1475
- refNode = refNode.nextSibling;
1476
- // If the refNode is the same node to be relocated or another element's slot reference, keep searching to find the
1477
- // correct relocation target
1478
- while (refNode === nodeToRelocate || (refNode === null || refNode === void 0 ? void 0 : refNode['s-sr'])) {
1479
- refNode = refNode === null || refNode === void 0 ? void 0 : refNode.nextSibling;
1480
- }
1481
- if (!refNode || !refNode['s-nr']) {
1482
- insertBeforeNode = refNode;
1483
- break;
1484
- }
1485
- }
1486
- orgLocationNode = orgLocationNode.previousSibling;
1487
- }
1488
- }
1489
- if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1490
- nodeToRelocate.nextSibling !== insertBeforeNode) {
1491
- // we've checked that it's worth while to relocate
1492
- // since that the node to relocate
1493
- // has a different next sibling or parent relocated
1494
- if (nodeToRelocate !== insertBeforeNode) {
1495
- if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1496
- // probably a component in the index.html that doesn't have its hostname set
1497
- nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1498
- }
1499
- // Add it back to the dom but in its new home
1500
- // If we get to this point and `insertBeforeNode` is `null`, that means
1501
- // we're just going to append the node as the last child of the parent. Passing
1502
- // `null` as the second arg here will trigger that behavior.
1503
- parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1504
- // Reset the `hidden` value back to what it was defined as originally
1505
- // This solves a problem where a `slot` is dynamically rendered and `hidden` may have
1506
- // been set on content originally, but now it has a slot to go to so it should have
1507
- // the value it was defined as having in the DOM, not what we overrode it to.
1508
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1509
- nodeToRelocate.hidden = (_c = nodeToRelocate['s-ih']) !== null && _c !== void 0 ? _c : false;
1510
- }
1511
- }
1512
- }
1513
- nodeToRelocate && typeof slotRefNode['s-rf'] === 'function' && slotRefNode['s-rf'](nodeToRelocate);
1514
- }
1515
- else {
1516
- // this node doesn't have a slot home to go to, so let's hide it
1517
- if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1518
- // Store the initial value of `hidden` so we can reset it later when
1519
- // moving nodes around.
1520
- if (isInitialLoad) {
1521
- nodeToRelocate['s-ih'] = (_d = nodeToRelocate.hidden) !== null && _d !== void 0 ? _d : false;
1522
- }
1523
- nodeToRelocate.hidden = true;
1524
- }
1525
- }
1526
- }
1527
- }
1528
- if (checkSlotFallbackVisibility) {
1529
- updateFallbackSlotVisibility(rootVnode.$elm$);
1530
- }
1531
- // done moving nodes around
1532
- // allow the disconnect callback to work again
1533
- plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1534
- // always reset
1535
- relocateNodes.length = 0;
1536
- }
1537
- // Clear the content ref so we don't create a memory leak
1538
- contentRef = undefined;
1539
- };
1540
- const attachToAncestor = (hostRef, ancestorComponent) => {
1541
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1542
- ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1543
- }
1544
- };
1545
- const scheduleUpdate = (hostRef, isInitialLoad) => {
1546
- {
1547
- hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1548
- }
1549
- if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1550
- hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1551
- return;
1552
- }
1553
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1554
- // there is no ancestor component or the ancestor component
1555
- // has already fired off its lifecycle update then
1556
- // fire off the initial update
1557
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1558
- return writeTask(dispatch) ;
1559
- };
1560
- /**
1561
- * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
1562
- * component lifecycle methods like `componentWillLoad` as well as
1563
- * {@link updateComponent}, which will kick off the virtual DOM re-render.
1564
- *
1565
- * @param hostRef a reference to a host DOM node
1566
- * @param isInitialLoad whether we're on the initial load or not
1567
- * @returns an empty Promise which is used to enqueue a series of operations for
1568
- * the component
1569
- */
1570
- const dispatchHooks = (hostRef, isInitialLoad) => {
1571
- const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1572
- const instance = hostRef.$lazyInstance$ ;
1573
- // We're going to use this variable together with `enqueue` to implement a
1574
- // little promise-based queue. We start out with it `undefined`. When we add
1575
- // the first function to the queue we'll set this variable to be that
1576
- // function's return value. When we attempt to add subsequent values to the
1577
- // queue we'll check that value and, if it was a `Promise`, we'll then chain
1578
- // the new function off of that `Promise` using `.then()`. This will give our
1579
- // queue two nice properties:
1580
- //
1581
- // 1. If all functions added to the queue are synchronous they'll be called
1582
- // synchronously right away.
1583
- // 2. If all functions added to the queue are asynchronous they'll all be
1584
- // called in order after `dispatchHooks` exits.
1585
- let maybePromise;
1586
- if (isInitialLoad) {
1587
- {
1588
- hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1589
- if (hostRef.$queuedListeners$) {
1590
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1591
- hostRef.$queuedListeners$ = undefined;
1592
- }
1593
- }
1594
- {
1595
- // If `componentWillLoad` returns a `Promise` then we want to wait on
1596
- // whatever's going on in that `Promise` before we launch into
1597
- // rendering the component, doing other lifecycle stuff, etc. So
1598
- // in that case we assign the returned promise to the variable we
1599
- // declared above to hold a possible 'queueing' Promise
1600
- maybePromise = safeCall(instance, 'componentWillLoad');
1601
- }
1602
- }
1603
- else {
1604
- {
1605
- // Like `componentWillLoad` above, we allow Stencil component
1606
- // authors to return a `Promise` from this lifecycle callback, and
1607
- // we specify that our runtime will wait for that `Promise` to
1608
- // resolve before the component re-renders. So if the method
1609
- // returns a `Promise` we need to keep it around!
1610
- maybePromise = safeCall(instance, 'componentWillUpdate');
1611
- }
1612
- }
1613
- endSchedule();
1614
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1615
- };
1616
- /**
1617
- * This function uses a Promise to implement a simple first-in, first-out queue
1618
- * of functions to be called.
1619
- *
1620
- * The queue is ordered on the basis of the first argument. If it's
1621
- * `undefined`, then nothing is on the queue yet, so the provided function can
1622
- * be called synchronously (although note that this function may return a
1623
- * `Promise`). The idea is that then the return value of that enqueueing
1624
- * operation is kept around, so that if it was a `Promise` then subsequent
1625
- * functions can be enqueued by calling this function again with that `Promise`
1626
- * as the first argument.
1627
- *
1628
- * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
1629
- * @param fn a function to enqueue
1630
- * @returns either a `Promise` or the return value of the provided function
1631
- */
1632
- const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
1633
- /**
1634
- * Check that a value is a `Promise`. To check, we first see if the value is an
1635
- * instance of the `Promise` global. In a few circumstances, in particular if
1636
- * the global has been overwritten, this is could be misleading, so we also do
1637
- * a little 'duck typing' check to see if the `.then` property of the value is
1638
- * defined and a function.
1639
- *
1640
- * @param maybePromise it might be a promise!
1641
- * @returns whether it is or not
1642
- */
1643
- const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
1644
- (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
1645
- /**
1646
- * Update a component given reference to its host elements and so on.
1647
- *
1648
- * @param hostRef an object containing references to the element's host node,
1649
- * VDom nodes, and other metadata
1650
- * @param instance a reference to the underlying host element where it will be
1651
- * rendered
1652
- * @param isInitialLoad whether or not this function is being called as part of
1653
- * the first render cycle
1654
- */
1655
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
1656
- var _a;
1657
- const elm = hostRef.$hostElement$;
1658
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1659
- const rc = elm['s-rc'];
1660
- if (isInitialLoad) {
1661
- // DOM WRITE!
1662
- attachStyles(hostRef);
1663
- }
1664
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1665
- {
1666
- callRender(hostRef, instance, elm, isInitialLoad);
1667
- }
1668
- if (rc) {
1669
- // ok, so turns out there are some child host elements
1670
- // waiting on this parent element to load
1671
- // let's fire off all update callbacks waiting
1672
- rc.map((cb) => cb());
1673
- elm['s-rc'] = undefined;
1674
- }
1675
- endRender();
1676
- endUpdate();
1677
- {
1678
- const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
1679
- const postUpdate = () => postUpdateComponent(hostRef);
1680
- if (childrenPromises.length === 0) {
1681
- postUpdate();
1682
- }
1683
- else {
1684
- Promise.all(childrenPromises).then(postUpdate);
1685
- hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1686
- childrenPromises.length = 0;
1687
- }
1688
- }
1689
- };
1690
- /**
1691
- * Handle making the call to the VDom renderer with the proper context given
1692
- * various build variables
1693
- *
1694
- * @param hostRef an object containing references to the element's host node,
1695
- * VDom nodes, and other metadata
1696
- * @param instance a reference to the underlying host element where it will be
1697
- * rendered
1698
- * @param elm the Host element for the component
1699
- * @param isInitialLoad whether or not this function is being called as part of
1700
- * @returns an empty promise
1701
- */
1702
- const callRender = (hostRef, instance, elm, isInitialLoad) => {
1703
- try {
1704
- /**
1705
- * minification optimization: `allRenderFn` is `true` if all components have a `render`
1706
- * method, so we can call the method immediately. If not, check before calling it.
1707
- */
1708
- instance = instance.render && instance.render();
1709
- {
1710
- hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1711
- }
1712
- {
1713
- hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1714
- }
1715
- {
1716
- {
1717
- // looks like we've got child nodes to render into this host element
1718
- // or we need to update the css class/attrs on the host element
1719
- // DOM WRITE!
1720
- {
1721
- renderVdom(hostRef, instance, isInitialLoad);
1722
- }
1723
- }
1724
- }
1725
- }
1726
- catch (e) {
1727
- consoleError(e, hostRef.$hostElement$);
1728
- }
1729
- return null;
1730
- };
1731
- const postUpdateComponent = (hostRef) => {
1732
- const tagName = hostRef.$cmpMeta$.$tagName$;
1733
- const elm = hostRef.$hostElement$;
1734
- const endPostUpdate = createTime('postUpdate', tagName);
1735
- const instance = hostRef.$lazyInstance$ ;
1736
- const ancestorComponent = hostRef.$ancestorComponent$;
1737
- {
1738
- safeCall(instance, 'componentDidRender');
1739
- }
1740
- if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1741
- hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1742
- {
1743
- // DOM WRITE!
1744
- addHydratedFlag(elm);
1745
- }
1746
- {
1747
- safeCall(instance, 'componentDidLoad');
1748
- }
1749
- endPostUpdate();
1750
- {
1751
- hostRef.$onReadyResolve$(elm);
1752
- if (!ancestorComponent) {
1753
- appDidLoad();
1754
- }
1755
- }
1756
- }
1757
- else {
1758
- {
1759
- safeCall(instance, 'componentDidUpdate');
1760
- }
1761
- endPostUpdate();
1762
- }
1763
- {
1764
- hostRef.$onInstanceResolve$(elm);
1765
- }
1766
- // load events fire from bottom to top
1767
- // the deepest elements load first then bubbles up
1768
- {
1769
- if (hostRef.$onRenderResolve$) {
1770
- hostRef.$onRenderResolve$();
1771
- hostRef.$onRenderResolve$ = undefined;
1772
- }
1773
- if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1774
- nextTick(() => scheduleUpdate(hostRef, false));
1775
- }
1776
- hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1777
- }
1778
- // ( •_•)
1779
- // ( •_•)>⌐■-■
1780
- // (⌐■_■)
1781
- };
1782
- const appDidLoad = (who) => {
1783
- // on appload
1784
- // we have finish the first big initial render
1785
- {
1786
- addHydratedFlag(doc.documentElement);
1787
- }
1788
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1789
- };
1790
- /**
1791
- * Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
1792
- * e.g. custom element node. If a build figures out that e.g. no component
1793
- * has a `componentDidLoad` method, the instance method gets removed from the
1794
- * output bundle and this function returns `undefined`.
1795
- * @param instance any object that may or may not contain methods
1796
- * @param method method name
1797
- * @param arg single arbitrary argument
1798
- * @returns result of method call if it exists, otherwise `undefined`
1799
- */
1800
- const safeCall = (instance, method, arg) => {
1801
- if (instance && instance[method]) {
1802
- try {
1803
- return instance[method](arg);
1804
- }
1805
- catch (e) {
1806
- consoleError(e);
1807
- }
1808
- }
1809
- return undefined;
1810
- };
1811
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1812
- ;
1813
- const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1814
- const setValue = (ref, propName, newVal, cmpMeta) => {
1815
- // check our new property value against our internal value
1816
- const hostRef = getHostRef(ref);
1817
- const elm = hostRef.$hostElement$ ;
1818
- const oldVal = hostRef.$instanceValues$.get(propName);
1819
- const flags = hostRef.$flags$;
1820
- const instance = hostRef.$lazyInstance$ ;
1821
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1822
- // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1823
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1824
- const didValueChange = newVal !== oldVal && !areBothNaN;
1825
- if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1826
- // gadzooks! the property's value has changed!!
1827
- // set our new value!
1828
- hostRef.$instanceValues$.set(propName, newVal);
1829
- if (instance) {
1830
- // get an array of method names of watch functions to call
1831
- if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1832
- const watchMethods = cmpMeta.$watchers$[propName];
1833
- if (watchMethods) {
1834
- // this instance is watching for when this property changed
1835
- watchMethods.map((watchMethodName) => {
1836
- try {
1837
- // fire off each of the watch methods that are watching this property
1838
- instance[watchMethodName](newVal, oldVal, propName);
1839
- }
1840
- catch (e) {
1841
- consoleError(e, elm);
1842
- }
1843
- });
1844
- }
1845
- }
1846
- if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1847
- if (instance.componentShouldUpdate) {
1848
- if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1849
- return;
1850
- }
1851
- }
1852
- // looks like this value actually changed, so we've got work to do!
1853
- // but only if we've already rendered, otherwise just chill out
1854
- // queue that we need to do an update, but don't worry about queuing
1855
- // up millions cuz this function ensures it only runs once
1856
- scheduleUpdate(hostRef, false);
1857
- }
1858
- }
1859
- }
1860
- };
1861
- /**
1862
- * Attach a series of runtime constructs to a compiled Stencil component
1863
- * constructor, including getters and setters for the `@Prop` and `@State`
1864
- * decorators, callbacks for when attributes change, and so on.
1865
- *
1866
- * @param Cstr the constructor for a component that we need to process
1867
- * @param cmpMeta metadata collected previously about the component
1868
- * @param flags a number used to store a series of bit flags
1869
- * @returns a reference to the same constructor passed in (but now mutated)
1870
- */
1871
- const proxyComponent = (Cstr, cmpMeta, flags) => {
1872
- var _a;
1873
- const prototype = Cstr.prototype;
1874
- if (cmpMeta.$members$) {
1875
- if (Cstr.watchers) {
1876
- cmpMeta.$watchers$ = Cstr.watchers;
1877
- }
1878
- // It's better to have a const than two Object.entries()
1879
- const members = Object.entries(cmpMeta.$members$);
1880
- members.map(([memberName, [memberFlags]]) => {
1881
- if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1882
- ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1883
- // proxyComponent - prop
1884
- Object.defineProperty(prototype, memberName, {
1885
- get() {
1886
- // proxyComponent, get value
1887
- return getValue(this, memberName);
1888
- },
1889
- set(newValue) {
1890
- // proxyComponent, set value
1891
- setValue(this, memberName, newValue, cmpMeta);
1892
- },
1893
- configurable: true,
1894
- enumerable: true,
1895
- });
1896
- }
1897
- else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1898
- memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1899
- // proxyComponent - method
1900
- Object.defineProperty(prototype, memberName, {
1901
- value(...args) {
1902
- var _a;
1903
- const ref = getHostRef(this);
1904
- return (_a = ref === null || ref === void 0 ? void 0 : ref.$onInstancePromise$) === null || _a === void 0 ? void 0 : _a.then(() => { var _a; return (_a = ref.$lazyInstance$) === null || _a === void 0 ? void 0 : _a[memberName](...args); });
1905
- },
1906
- });
1907
- }
1908
- });
1909
- if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1910
- const attrNameToPropName = new Map();
1911
- prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
1912
- plt.jmp(() => {
1913
- var _a;
1914
- const propName = attrNameToPropName.get(attrName);
1915
- // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1916
- // in the case where an attribute was set inline.
1917
- // ```html
1918
- // <my-component some-attribute="some-value"></my-component>
1919
- // ```
1920
- //
1921
- // There is an edge case where a developer sets the attribute inline on a custom element and then
1922
- // programmatically changes it before it has been upgraded as shown below:
1923
- //
1924
- // ```html
1925
- // <!-- this component has _not_ been upgraded yet -->
1926
- // <my-component id="test" some-attribute="some-value"></my-component>
1927
- // <script>
1928
- // // grab non-upgraded component
1929
- // el = document.querySelector("#test");
1930
- // el.someAttribute = "another-value";
1931
- // // upgrade component
1932
- // customElements.define('my-component', MyComponent);
1933
- // </script>
1934
- // ```
1935
- // In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
1936
- // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1937
- // to the value that was set inline i.e. "some-value" from above example. When
1938
- // the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
1939
- //
1940
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
1941
- // by connectedCallback as this attributeChangedCallback will not fire.
1942
- //
1943
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1944
- //
1945
- // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1946
- // properties here given that this goes against best practices outlined here
1947
- // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1948
- if (this.hasOwnProperty(propName)) {
1949
- newValue = this[propName];
1950
- delete this[propName];
1951
- }
1952
- else if (prototype.hasOwnProperty(propName) &&
1953
- typeof this[propName] === 'number' &&
1954
- this[propName] == newValue) {
1955
- // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1956
- // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1957
- // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1958
- return;
1959
- }
1960
- else if (propName == null) {
1961
- // At this point we should know this is not a "member", so we can treat it like watching an attribute
1962
- // on a vanilla web component
1963
- const hostRef = getHostRef(this);
1964
- const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
1965
- // We only want to trigger the callback(s) if:
1966
- // 1. The instance is ready
1967
- // 2. The watchers are ready
1968
- // 3. The value has changed
1969
- if (flags &&
1970
- !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
1971
- flags & 128 /* HOST_FLAGS.isWatchReady */ &&
1972
- newValue !== oldValue) {
1973
- const instance = hostRef.$lazyInstance$ ;
1974
- const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
1975
- entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
1976
- if (instance[callbackName] != null) {
1977
- instance[callbackName].call(instance, newValue, oldValue, attrName);
1978
- }
1979
- });
1980
- }
1981
- return;
1982
- }
1983
- this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1984
- });
1985
- };
1986
- // Create an array of attributes to observe
1987
- // This list in comprised of all strings used within a `@Watch()` decorator
1988
- // on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
1989
- // As such, there is no way to guarantee type-safety here that a user hasn't entered
1990
- // an invalid attribute.
1991
- Cstr.observedAttributes = Array.from(new Set([
1992
- ...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
1993
- ...members
1994
- .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
1995
- .map(([propName, m]) => {
1996
- var _a;
1997
- const attrName = m[1] || propName;
1998
- attrNameToPropName.set(attrName, propName);
1999
- if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
2000
- (_a = cmpMeta.$attrsToReflect$) === null || _a === void 0 ? void 0 : _a.push([propName, attrName]);
2001
- }
2002
- return attrName;
2003
- }),
2004
- ]));
2005
- }
2006
- }
2007
- return Cstr;
2008
- };
2009
- /**
2010
- * Initialize a Stencil component given a reference to its host element, its
2011
- * runtime bookkeeping data structure, runtime metadata about the component,
2012
- * and (optionally) an HMR version ID.
2013
- *
2014
- * @param elm a host element
2015
- * @param hostRef the element's runtime bookkeeping object
2016
- * @param cmpMeta runtime metadata for the Stencil component
2017
- * @param hmrVersionId an (optional) HMR version ID
2018
- */
2019
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2020
- let Cstr;
2021
- // initializeComponent
2022
- if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
2023
- // Let the runtime know that the component has been initialized
2024
- hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
2025
- const bundleId = cmpMeta.$lazyBundleId$;
2026
- if (bundleId) {
2027
- // lazy loaded components
2028
- // request the component's implementation to be
2029
- // wired up with the host element
2030
- Cstr = loadModule(cmpMeta);
2031
- if (Cstr.then) {
2032
- // Await creates a micro-task avoid if possible
2033
- const endLoad = uniqueTime();
2034
- Cstr = await Cstr;
2035
- endLoad();
2036
- }
2037
- if (!Cstr.isProxied) {
2038
- // we've never proxied this Constructor before
2039
- // let's add the getters/setters to its prototype before
2040
- // the first time we create an instance of the implementation
2041
- {
2042
- cmpMeta.$watchers$ = Cstr.watchers;
2043
- }
2044
- proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
2045
- Cstr.isProxied = true;
2046
- }
2047
- const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
2048
- // ok, time to construct the instance
2049
- // but let's keep track of when we start and stop
2050
- // so that the getters/setters don't incorrectly step on data
2051
- {
2052
- hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
2053
- }
2054
- // construct the lazy-loaded component implementation
2055
- // passing the hostRef is very important during
2056
- // construction in order to directly wire together the
2057
- // host element and the lazy-loaded instance
2058
- try {
2059
- new Cstr(hostRef);
2060
- }
2061
- catch (e) {
2062
- consoleError(e);
2063
- }
2064
- {
2065
- hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
2066
- }
2067
- {
2068
- hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
2069
- }
2070
- endNewInstance();
2071
- }
2072
- else {
2073
- // sync constructor component
2074
- Cstr = elm.constructor;
2075
- // wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
2076
- // watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
2077
- // Stencil has completed instantiating the component.
2078
- customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */));
2079
- }
2080
- if (Cstr.style) {
2081
- // this component has styles but we haven't registered them yet
2082
- let style = Cstr.style;
2083
- const scopeId = getScopeId(cmpMeta);
2084
- if (!styles.has(scopeId)) {
2085
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
2086
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
2087
- endRegisterStyles();
2088
- }
2089
- }
2090
- }
2091
- // we've successfully created a lazy instance
2092
- const ancestorComponent = hostRef.$ancestorComponent$;
2093
- const schedule = () => scheduleUpdate(hostRef, true);
2094
- if (ancestorComponent && ancestorComponent['s-rc']) {
2095
- // this is the initial load and this component it has an ancestor component
2096
- // but the ancestor component has NOT fired its will update lifecycle yet
2097
- // so let's just cool our jets and wait for the ancestor to continue first
2098
- // this will get fired off when the ancestor component
2099
- // finally gets around to rendering its lazy self
2100
- // fire off the initial update
2101
- ancestorComponent['s-rc'].push(schedule);
2102
- }
2103
- else {
2104
- schedule();
2105
- }
2106
- };
2107
- const fireConnectedCallback = (instance) => {
2108
- };
2109
- const connectedCallback = (elm) => {
2110
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2111
- const hostRef = getHostRef(elm);
2112
- const cmpMeta = hostRef.$cmpMeta$;
2113
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2114
- if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
2115
- // first time this component has connected
2116
- hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
2117
- {
2118
- // initUpdate
2119
- // if the slot polyfill is required we'll need to put some nodes
2120
- // in here to act as original content anchors as we move nodes around
2121
- // host element has been connected to the DOM
2122
- if ((// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2123
- cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
2124
- setContentReference(elm);
2125
- }
2126
- }
2127
- {
2128
- // find the first ancestor component (if there is one) and register
2129
- // this component as one of the actively loading child components for its ancestor
2130
- let ancestorComponent = elm;
2131
- while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
2132
- // climb up the ancestors looking for the first
2133
- // component that hasn't finished its lifecycle update yet
2134
- if (ancestorComponent['s-p']) {
2135
- // we found this components first ancestor component
2136
- // keep a reference to this component's ancestor component
2137
- attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
2138
- break;
2139
- }
2140
- }
2141
- }
2142
- // Lazy properties
2143
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2144
- if (cmpMeta.$members$) {
2145
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2146
- if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
2147
- const value = elm[memberName];
2148
- delete elm[memberName];
2149
- elm[memberName] = value;
2150
- }
2151
- });
2152
- }
2153
- {
2154
- initializeComponent(elm, hostRef, cmpMeta);
2155
- }
2156
- }
2157
- else {
2158
- // not the first time this has connected
2159
- // reattach any event listeners to the host
2160
- // since they would have been removed when disconnected
2161
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
2162
- // fire off connectedCallback() on component instance
2163
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
2164
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
2165
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
2166
- }
2167
- }
2168
- endConnected();
2169
- }
2170
- };
2171
- const setContentReference = (elm) => {
2172
- // only required when we're NOT using native shadow dom (slot)
2173
- // or this browser doesn't support native shadow dom
2174
- // and this host element was NOT created with SSR
2175
- // let's pick out the inner content for slot projection
2176
- // create a node to represent where the original
2177
- // content was first placed, which is useful later on
2178
- const contentRefElm = (elm['s-cr'] = doc.createComment(''));
2179
- contentRefElm['s-cn'] = true;
2180
- elm.insertBefore(contentRefElm, elm.firstChild);
2181
- };
2182
- const disconnectInstance = (instance) => {
2183
- {
2184
- safeCall(instance, 'disconnectedCallback');
2185
- }
2186
- };
2187
- const disconnectedCallback = async (elm) => {
2188
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2189
- const hostRef = getHostRef(elm);
2190
- {
2191
- if (hostRef.$rmListeners$) {
2192
- hostRef.$rmListeners$.map((rmListener) => rmListener());
2193
- hostRef.$rmListeners$ = undefined;
2194
- }
2195
- }
2196
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
2197
- disconnectInstance(hostRef.$lazyInstance$);
2198
- }
2199
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
2200
- hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
2201
- }
2202
- }
2203
- };
2204
- const bootstrapLazy = (lazyBundles, options = {}) => {
2205
- var _a;
2206
- const endBootstrap = createTime();
2207
- const cmpTags = [];
2208
- const exclude = options.exclude || [];
2209
- const customElements = win.customElements;
2210
- const head = doc.head;
2211
- const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
2212
- const dataStyles = /*@__PURE__*/ doc.createElement('style');
2213
- const deferredConnectedCallbacks = [];
2214
- let appLoadFallback;
2215
- let isBootstrapping = true;
2216
- Object.assign(plt, options);
2217
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2218
- let hasSlotRelocation = false;
2219
- lazyBundles.map((lazyBundle) => {
2220
- lazyBundle[1].map((compactMeta) => {
2221
- var _a;
2222
- const cmpMeta = {
2223
- $flags$: compactMeta[0],
2224
- $tagName$: compactMeta[1],
2225
- $members$: compactMeta[2],
2226
- $listeners$: compactMeta[3],
2227
- };
2228
- // Check if we are using slots outside the shadow DOM in this component.
2229
- // We'll use this information later to add styles for `slot-fb` elements
2230
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
2231
- hasSlotRelocation = true;
2232
- }
2233
- {
2234
- cmpMeta.$members$ = compactMeta[2];
2235
- }
2236
- {
2237
- cmpMeta.$listeners$ = compactMeta[3];
2238
- }
2239
- {
2240
- cmpMeta.$attrsToReflect$ = [];
2241
- }
2242
- {
2243
- cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
2244
- }
2245
- const tagName = cmpMeta.$tagName$;
2246
- const HostElement = class extends HTMLElement {
2247
- // StencilLazyHost
2248
- constructor(self) {
2249
- // @ts-ignore
2250
- super(self);
2251
- self = this;
2252
- registerHost(self, cmpMeta);
2253
- if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2254
- // this component is using shadow dom
2255
- // and this browser supports shadow dom
2256
- // add the read-only property "shadowRoot" to the host element
2257
- // adding the shadow root build conditionals to minimize runtime
2258
- {
2259
- {
2260
- self.attachShadow({ mode: 'open' });
2261
- }
2262
- }
2263
- }
2264
- }
2265
- connectedCallback() {
2266
- if (appLoadFallback) {
2267
- clearTimeout(appLoadFallback);
2268
- appLoadFallback = null;
2269
- }
2270
- if (isBootstrapping) {
2271
- // connectedCallback will be processed once all components have been registered
2272
- deferredConnectedCallbacks.push(this);
2273
- }
2274
- else {
2275
- plt.jmp(() => connectedCallback(this));
2276
- }
2277
- }
2278
- disconnectedCallback() {
2279
- plt.jmp(() => disconnectedCallback(this));
2280
- }
2281
- componentOnReady() {
2282
- return getHostRef(this).$onReadyPromise$;
2283
- }
2284
- };
2285
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
2286
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
2287
- cmpTags.push(tagName);
2288
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
2289
- }
2290
- });
2291
- });
2292
- // Only bother generating CSS if we have components
2293
- // TODO(STENCIL-1118): Add test cases for CSS content based on conditionals
2294
- if (cmpTags.length > 0) {
2295
- // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
2296
- if (hasSlotRelocation) {
2297
- dataStyles.textContent += SLOT_FB_CSS;
2298
- }
2299
- // Add hydration styles
2300
- {
2301
- dataStyles.textContent += cmpTags + HYDRATED_CSS;
2302
- }
2303
- // If we have styles, add them to the DOM
2304
- if (dataStyles.innerHTML.length) {
2305
- dataStyles.setAttribute('data-styles', '');
2306
- // Apply CSP nonce to the style tag if it exists
2307
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
2308
- if (nonce != null) {
2309
- dataStyles.setAttribute('nonce', nonce);
2310
- }
2311
- // Insert the styles into the document head
2312
- // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
2313
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
2314
- }
2315
- }
2316
- // Process deferred connectedCallbacks now all components have been registered
2317
- isBootstrapping = false;
2318
- if (deferredConnectedCallbacks.length) {
2319
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
2320
- }
2321
- else {
2322
- {
2323
- plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
2324
- }
2325
- }
2326
- // Fallback appLoad event
2327
- endBootstrap();
2328
- };
2329
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
2330
- if (listeners) {
2331
- listeners.map(([flags, name, method]) => {
2332
- const target = getHostListenerTarget(elm, flags) ;
2333
- const handler = hostListenerProxy(hostRef, method);
2334
- const opts = hostListenerOpts(flags);
2335
- plt.ael(target, name, handler, opts);
2336
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
2337
- });
2338
- }
2339
- };
2340
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
2341
- try {
2342
- {
2343
- if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
2344
- // instance is ready, let's call it's member method for this event
2345
- hostRef.$lazyInstance$[methodName](ev);
2346
- }
2347
- else {
2348
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
2349
- }
2350
- }
2351
- }
2352
- catch (e) {
2353
- consoleError(e);
2354
- }
2355
- };
2356
- const getHostListenerTarget = (elm, flags) => {
2357
- if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
2358
- return win;
2359
- return elm;
2360
- };
2361
- // prettier-ignore
2362
- const hostListenerOpts = (flags) => supportsListenerOptions
2363
- ? ({
2364
- passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
2365
- capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
2366
- })
2367
- : (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
2368
- /**
2369
- * Assigns the given value to the nonce property on the runtime platform object.
2370
- * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
2371
- * @param nonce The value to be assigned to the platform nonce property.
2372
- * @returns void
2373
- */
2374
- const setNonce = (nonce) => (plt.$nonce$ = nonce);
2375
- /**
2376
- * A WeakMap mapping runtime component references to their corresponding host reference
2377
- * instances.
2378
- *
2379
- * **Note**: If we're in an HMR context we need to store a reference to this
2380
- * value on `window` in order to maintain the mapping of {@link d.RuntimeRef}
2381
- * to {@link d.HostRef} across HMR updates.
2382
- *
2383
- * This is necessary because when HMR updates for a component are processed by
2384
- * the browser-side dev server client the JS bundle for that component is
2385
- * re-fetched. Since the module containing {@link hostRefs} is included in
2386
- * that bundle, if we do not store a reference to it the new iteration of the
2387
- * component will not have access to the previous hostRef map, leading to a
2388
- * bug where the new version of the component cannot properly initialize.
2389
- */
2390
- const hostRefs = new WeakMap();
2391
- /**
2392
- * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
2393
- *
2394
- * @param ref the runtime ref of interest
2395
- * @returns the Host reference (if found) or undefined
2396
- */
2397
- const getHostRef = (ref) => hostRefs.get(ref);
2398
- /**
2399
- * Register a lazy instance with the {@link hostRefs} object so it's
2400
- * corresponding {@link d.HostRef} can be retrieved later.
2401
- *
2402
- * @param lazyInstance the lazy instance of interest
2403
- * @param hostRef that instances `HostRef` object
2404
- * @returns a reference to the host ref WeakMap
2405
- */
2406
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
2407
- /**
2408
- * Register a host element for a Stencil component, setting up various metadata
2409
- * and callbacks based on {@link BUILD} flags as well as the component's runtime
2410
- * metadata.
2411
- *
2412
- * @param hostElement the host element to register
2413
- * @param cmpMeta runtime metadata for that component
2414
- * @returns a reference to the host ref WeakMap
2415
- */
2416
- const registerHost = (hostElement, cmpMeta) => {
2417
- const hostRef = {
2418
- $flags$: 0,
2419
- $hostElement$: hostElement,
2420
- $cmpMeta$: cmpMeta,
2421
- $instanceValues$: new Map(),
2422
- };
2423
- {
2424
- hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
2425
- }
2426
- {
2427
- hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
2428
- hostElement['s-p'] = [];
2429
- hostElement['s-rc'] = [];
2430
- }
2431
- addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
2432
- return hostRefs.set(hostElement, hostRef);
2433
- };
2434
- const isMemberInElement = (elm, memberName) => memberName in elm;
2435
- const consoleError = (e, el) => (0, console.error)(e, el);
2436
- const cmpModules = /*@__PURE__*/ new Map();
2437
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2438
- // loadModuleImport
2439
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
2440
- const bundleId = cmpMeta.$lazyBundleId$;
2441
- const module = cmpModules.get(bundleId) ;
2442
- if (module) {
2443
- return module[exportName];
2444
- }
2445
-
2446
- if (!hmrVersionId || !BUILD.hotModuleReplacement) {
2447
- const processMod = importedModule => {
2448
- cmpModules.set(bundleId, importedModule);
2449
- return importedModule[exportName];
2450
- }
2451
- switch(bundleId) {
2452
-
2453
- case 'mg-action-more_36.cjs':
2454
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
2455
- /* webpackMode: "lazy" */
2456
- './mg-action-more_36.cjs.entry.js')); }).then(processMod, consoleError);
2457
- case 'mg-loader.cjs':
2458
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
2459
- /* webpackMode: "lazy" */
2460
- './mg-loader.cjs.entry.js')); }).then(processMod, consoleError);
2461
- }
2462
- }
2463
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
2464
- /* @vite-ignore */
2465
- /* webpackInclude: /\.entry\.js$/ */
2466
- /* webpackExclude: /\.system\.entry\.js$/ */
2467
- /* webpackMode: "lazy" */
2468
- `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
2469
- {
2470
- cmpModules.set(bundleId, importedModule);
2471
- }
2472
- return importedModule[exportName];
2473
- }, consoleError);
2474
- };
2475
- const styles = /*@__PURE__*/ new Map();
2476
- const win = typeof window !== 'undefined' ? window : {};
2477
- const doc = win.document || { head: {} };
2478
- const plt = {
2479
- $flags$: 0,
2480
- $resourcesUrl$: '',
2481
- jmp: (h) => h(),
2482
- raf: (h) => requestAnimationFrame(h),
2483
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
2484
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2485
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
2486
- };
2487
- const supportsListenerOptions = /*@__PURE__*/ (() => {
2488
- let supportsListenerOptions = false;
2489
- try {
2490
- doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
2491
- get() {
2492
- supportsListenerOptions = true;
2493
- },
2494
- }));
2495
- }
2496
- catch (e) { }
2497
- return supportsListenerOptions;
2498
- })();
2499
- const promiseResolve = (v) => Promise.resolve(v);
2500
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2501
- try {
2502
- new CSSStyleSheet();
2503
- return typeof new CSSStyleSheet().replaceSync === 'function';
2504
- }
2505
- catch (e) { }
2506
- return false;
2507
- })()
2508
- ;
2509
- const queueDomReads = [];
2510
- const queueDomWrites = [];
2511
- const queueTask = (queue, write) => (cb) => {
2512
- queue.push(cb);
2513
- if (!queuePending) {
2514
- queuePending = true;
2515
- if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
2516
- nextTick(flush);
2517
- }
2518
- else {
2519
- plt.raf(flush);
2520
- }
2521
- }
2522
- };
2523
- const consume = (queue) => {
2524
- for (let i = 0; i < queue.length; i++) {
2525
- try {
2526
- queue[i](performance.now());
2527
- }
2528
- catch (e) {
2529
- consoleError(e);
2530
- }
2531
- }
2532
- queue.length = 0;
2533
- };
2534
- const flush = () => {
2535
- // always force a bunch of medium callbacks to run, but still have
2536
- // a throttle on how many can run in a certain time
2537
- // DOM READS!!!
2538
- consume(queueDomReads);
2539
- // DOM WRITES!!!
2540
- {
2541
- consume(queueDomWrites);
2542
- if ((queuePending = queueDomReads.length > 0)) {
2543
- // still more to do yet, but we've run out of time
2544
- // let's let this thing cool off and try again in the next tick
2545
- plt.raf(flush);
2546
- }
2547
- }
2548
- };
2549
- const nextTick = (cb) => promiseResolve().then(cb);
2550
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2551
-
2552
- exports.Host = Host;
2553
- exports.bootstrapLazy = bootstrapLazy;
2554
- exports.createEvent = createEvent;
2555
- exports.getElement = getElement;
2556
- exports.h = h;
2557
- exports.promiseResolve = promiseResolve;
2558
- exports.registerInstance = registerInstance;
2559
- exports.setNonce = setNonce;
2560
-
2561
- //# sourceMappingURL=index-7e27c7ae.js.map