@salla.sa/twilight-components 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/cjs/index-6ea83d19.js +1619 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/loader.cjs.js +21 -0
  6. package/dist/cjs/salla-alert_3.cjs.entry.js +171 -0
  7. package/dist/cjs/salla-modal.cjs.entry.js +52 -0
  8. package/dist/cjs/twilight-components.cjs.js +19 -0
  9. package/dist/collection/collection-manifest.json +15 -0
  10. package/dist/collection/components/alert/alert.css +112 -0
  11. package/dist/collection/components/alert/alert.js +194 -0
  12. package/dist/collection/components/generate-summary.js +35 -0
  13. package/dist/collection/components/modal/modal.css +158 -0
  14. package/dist/collection/components/modal/modal.js +180 -0
  15. package/dist/collection/components/salla-login/salla-login.css +104 -0
  16. package/dist/collection/components/salla-login/salla-login.js +113 -0
  17. package/dist/collection/components/search-modal/search-modal.css +0 -0
  18. package/dist/collection/components/search-modal/search-modal.js +126 -0
  19. package/dist/collection/index.js +1 -0
  20. package/dist/collection/interfaces/colors.js +1 -0
  21. package/dist/collection/interfaces/index.js +2 -0
  22. package/dist/collection/interfaces/ratio.js +1 -0
  23. package/dist/collection/plugins/tailwind-theme/index.js +35 -0
  24. package/dist/collection/plugins/tailwind-theme/scripts/generator.js +51 -0
  25. package/dist/collection/utils/utils.js +16 -0
  26. package/dist/esm/index-3c2b0663.js +1591 -0
  27. package/dist/esm/index.js +1 -0
  28. package/dist/esm/loader.js +17 -0
  29. package/dist/esm/polyfills/core-js.js +11 -0
  30. package/dist/esm/polyfills/css-shim.js +1 -0
  31. package/dist/esm/polyfills/dom.js +79 -0
  32. package/dist/esm/polyfills/es5-html-element.js +1 -0
  33. package/dist/esm/polyfills/index.js +34 -0
  34. package/dist/esm/polyfills/system.js +6 -0
  35. package/dist/esm/salla-alert_3.entry.js +165 -0
  36. package/dist/esm/salla-modal.entry.js +48 -0
  37. package/dist/esm/twilight-components.js +17 -0
  38. package/dist/index.cjs.js +1 -0
  39. package/dist/index.js +1 -0
  40. package/dist/twilight-components/index.esm.js +0 -0
  41. package/dist/twilight-components/p-58168e3c.entry.js +1 -0
  42. package/dist/twilight-components/p-a2a8cae2.entry.js +1 -0
  43. package/dist/twilight-components/p-e1773073.js +1 -0
  44. package/dist/twilight-components/twilight-components.esm.js +1 -0
  45. package/dist/types/components/alert/alert.d.ts +38 -0
  46. package/dist/types/components/modal/modal.d.ts +28 -0
  47. package/dist/types/components/salla-login/salla-login.d.ts +14 -0
  48. package/dist/types/components/search-modal/search-modal.d.ts +22 -0
  49. package/dist/types/components.d.ts +188 -0
  50. package/dist/types/index.d.ts +1 -0
  51. package/dist/types/interfaces/colors.d.ts +1 -0
  52. package/dist/types/interfaces/index.d.ts +2 -0
  53. package/dist/types/interfaces/ratio.d.ts +1 -0
  54. package/dist/types/stencil-public-runtime.d.ts +1563 -0
  55. package/dist/types/utils/utils.d.ts +6 -0
  56. package/loader/cdn.js +3 -0
  57. package/loader/index.cjs.js +3 -0
  58. package/loader/index.d.ts +13 -0
  59. package/loader/index.es2017.js +3 -0
  60. package/loader/index.js +4 -0
  61. package/loader/package.json +10 -0
  62. package/package.json +66 -0
@@ -0,0 +1,1619 @@
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 = 'twilight-components';
24
+
25
+ let scopeId;
26
+ let contentRef;
27
+ let hostTagName;
28
+ let useNativeShadowDom = false;
29
+ let checkSlotFallbackVisibility = false;
30
+ let checkSlotRelocate = false;
31
+ let isSvgMode = false;
32
+ let queuePending = false;
33
+ const win = typeof window !== 'undefined' ? window : {};
34
+ const doc = win.document || { head: {} };
35
+ const plt = {
36
+ $flags$: 0,
37
+ $resourcesUrl$: '',
38
+ jmp: (h) => h(),
39
+ raf: (h) => requestAnimationFrame(h),
40
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
41
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
42
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
43
+ };
44
+ const promiseResolve = (v) => Promise.resolve(v);
45
+ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
46
+ try {
47
+ new CSSStyleSheet();
48
+ return typeof new CSSStyleSheet().replace === 'function';
49
+ }
50
+ catch (e) { }
51
+ return false;
52
+ })()
53
+ ;
54
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
55
+ if (listeners) {
56
+ listeners.map(([flags, name, method]) => {
57
+ const target = getHostListenerTarget(elm, flags) ;
58
+ const handler = hostListenerProxy(hostRef, method);
59
+ const opts = hostListenerOpts(flags);
60
+ plt.ael(target, name, handler, opts);
61
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
62
+ });
63
+ }
64
+ };
65
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
66
+ try {
67
+ {
68
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
69
+ // instance is ready, let's call it's member method for this event
70
+ hostRef.$lazyInstance$[methodName](ev);
71
+ }
72
+ else {
73
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
74
+ }
75
+ }
76
+ }
77
+ catch (e) {
78
+ consoleError(e);
79
+ }
80
+ };
81
+ const getHostListenerTarget = (elm, flags) => {
82
+ if (flags & 8 /* TargetWindow */)
83
+ return win;
84
+ return elm;
85
+ };
86
+ // prettier-ignore
87
+ const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
88
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
89
+ const createTime = (fnName, tagName = '') => {
90
+ {
91
+ return () => {
92
+ return;
93
+ };
94
+ }
95
+ };
96
+ const uniqueTime = (key, measureText) => {
97
+ {
98
+ return () => {
99
+ return;
100
+ };
101
+ }
102
+ };
103
+ const rootAppliedStyles = new WeakMap();
104
+ const registerStyle = (scopeId, cssText, allowCS) => {
105
+ let style = styles.get(scopeId);
106
+ if (supportsConstructibleStylesheets && allowCS) {
107
+ style = (style || new CSSStyleSheet());
108
+ style.replace(cssText);
109
+ }
110
+ else {
111
+ style = cssText;
112
+ }
113
+ styles.set(scopeId, style);
114
+ };
115
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
116
+ let scopeId = getScopeId(cmpMeta);
117
+ let style = styles.get(scopeId);
118
+ // if an element is NOT connected then getRootNode() will return the wrong root node
119
+ // so the fallback is to always use the document for the root node in those cases
120
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
121
+ if (style) {
122
+ if (typeof style === 'string') {
123
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
124
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
125
+ let styleElm;
126
+ if (!appliedStyles) {
127
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
128
+ }
129
+ if (!appliedStyles.has(scopeId)) {
130
+ {
131
+ {
132
+ styleElm = doc.createElement('style');
133
+ styleElm.innerHTML = style;
134
+ }
135
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
136
+ }
137
+ if (appliedStyles) {
138
+ appliedStyles.add(scopeId);
139
+ }
140
+ }
141
+ }
142
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
143
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
144
+ }
145
+ }
146
+ return scopeId;
147
+ };
148
+ const attachStyles = (hostRef) => {
149
+ const cmpMeta = hostRef.$cmpMeta$;
150
+ const elm = hostRef.$hostElement$;
151
+ const flags = cmpMeta.$flags$;
152
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
153
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
154
+ if (flags & 10 /* needsScopedEncapsulation */) {
155
+ // only required when we're NOT using native shadow dom (slot)
156
+ // or this browser doesn't support native shadow dom
157
+ // and this host element was NOT created with SSR
158
+ // let's pick out the inner content for slot projection
159
+ // create a node to represent where the original
160
+ // content was first placed, which is useful later on
161
+ // DOM WRITE!!
162
+ elm['s-sc'] = scopeId;
163
+ elm.classList.add(scopeId + '-h');
164
+ if (flags & 2 /* scopedCssEncapsulation */) {
165
+ elm.classList.add(scopeId + '-s');
166
+ }
167
+ }
168
+ endAttachStyles();
169
+ };
170
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
171
+ /**
172
+ * Default style mode id
173
+ */
174
+ /**
175
+ * Reusable empty obj/array
176
+ * Don't add values to these!!
177
+ */
178
+ const EMPTY_OBJ = {};
179
+ const isDef = (v) => v != null;
180
+ const isComplexType = (o) => {
181
+ // https://jsperf.com/typeof-fn-object/5
182
+ o = typeof o;
183
+ return o === 'object' || o === 'function';
184
+ };
185
+ /**
186
+ * Production h() function based on Preact by
187
+ * Jason Miller (@developit)
188
+ * Licensed under the MIT License
189
+ * https://github.com/developit/preact/blob/master/LICENSE
190
+ *
191
+ * Modified for Stencil's compiler and vdom
192
+ */
193
+ // const stack: any[] = [];
194
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
195
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
196
+ const h = (nodeName, vnodeData, ...children) => {
197
+ let child = null;
198
+ let key = null;
199
+ let slotName = null;
200
+ let simple = false;
201
+ let lastSimple = false;
202
+ let vNodeChildren = [];
203
+ const walk = (c) => {
204
+ for (let i = 0; i < c.length; i++) {
205
+ child = c[i];
206
+ if (Array.isArray(child)) {
207
+ walk(child);
208
+ }
209
+ else if (child != null && typeof child !== 'boolean') {
210
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
211
+ child = String(child);
212
+ }
213
+ if (simple && lastSimple) {
214
+ // If the previous child was simple (string), we merge both
215
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
216
+ }
217
+ else {
218
+ // Append a new vNode, if it's text, we create a text vNode
219
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
220
+ }
221
+ lastSimple = simple;
222
+ }
223
+ }
224
+ };
225
+ walk(children);
226
+ if (vnodeData) {
227
+ // normalize class / classname attributes
228
+ if (vnodeData.key) {
229
+ key = vnodeData.key;
230
+ }
231
+ if (vnodeData.name) {
232
+ slotName = vnodeData.name;
233
+ }
234
+ {
235
+ const classData = vnodeData.className || vnodeData.class;
236
+ if (classData) {
237
+ vnodeData.class =
238
+ typeof classData !== 'object'
239
+ ? classData
240
+ : Object.keys(classData)
241
+ .filter((k) => classData[k])
242
+ .join(' ');
243
+ }
244
+ }
245
+ }
246
+ const vnode = newVNode(nodeName, null);
247
+ vnode.$attrs$ = vnodeData;
248
+ if (vNodeChildren.length > 0) {
249
+ vnode.$children$ = vNodeChildren;
250
+ }
251
+ {
252
+ vnode.$key$ = key;
253
+ }
254
+ {
255
+ vnode.$name$ = slotName;
256
+ }
257
+ return vnode;
258
+ };
259
+ const newVNode = (tag, text) => {
260
+ const vnode = {
261
+ $flags$: 0,
262
+ $tag$: tag,
263
+ $text$: text,
264
+ $elm$: null,
265
+ $children$: null,
266
+ };
267
+ {
268
+ vnode.$attrs$ = null;
269
+ }
270
+ {
271
+ vnode.$key$ = null;
272
+ }
273
+ {
274
+ vnode.$name$ = null;
275
+ }
276
+ return vnode;
277
+ };
278
+ const Host = {};
279
+ const isHost = (node) => node && node.$tag$ === Host;
280
+ /**
281
+ * Production setAccessor() function based on Preact by
282
+ * Jason Miller (@developit)
283
+ * Licensed under the MIT License
284
+ * https://github.com/developit/preact/blob/master/LICENSE
285
+ *
286
+ * Modified for Stencil's compiler and vdom
287
+ */
288
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
289
+ if (oldValue !== newValue) {
290
+ let isProp = isMemberInElement(elm, memberName);
291
+ let ln = memberName.toLowerCase();
292
+ if (memberName === 'class') {
293
+ const classList = elm.classList;
294
+ const oldClasses = parseClassList(oldValue);
295
+ const newClasses = parseClassList(newValue);
296
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
297
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
298
+ }
299
+ else if (memberName === 'style') {
300
+ // update style attribute, css properties and values
301
+ {
302
+ for (const prop in oldValue) {
303
+ if (!newValue || newValue[prop] == null) {
304
+ if (prop.includes('-')) {
305
+ elm.style.removeProperty(prop);
306
+ }
307
+ else {
308
+ elm.style[prop] = '';
309
+ }
310
+ }
311
+ }
312
+ }
313
+ for (const prop in newValue) {
314
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
315
+ if (prop.includes('-')) {
316
+ elm.style.setProperty(prop, newValue[prop]);
317
+ }
318
+ else {
319
+ elm.style[prop] = newValue[prop];
320
+ }
321
+ }
322
+ }
323
+ }
324
+ else if (memberName === 'key')
325
+ ;
326
+ else if ((!isProp ) &&
327
+ memberName[0] === 'o' &&
328
+ memberName[1] === 'n') {
329
+ // Event Handlers
330
+ // so if the member name starts with "on" and the 3rd characters is
331
+ // a capital letter, and it's not already a member on the element,
332
+ // then we're assuming it's an event listener
333
+ if (memberName[2] === '-') {
334
+ // on- prefixed events
335
+ // allows to be explicit about the dom event to listen without any magic
336
+ // under the hood:
337
+ // <my-cmp on-click> // listens for "click"
338
+ // <my-cmp on-Click> // listens for "Click"
339
+ // <my-cmp on-ionChange> // listens for "ionChange"
340
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
341
+ memberName = memberName.slice(3);
342
+ }
343
+ else if (isMemberInElement(win, ln)) {
344
+ // standard event
345
+ // the JSX attribute could have been "onMouseOver" and the
346
+ // member name "onmouseover" is on the window's prototype
347
+ // so let's add the listener "mouseover", which is all lowercased
348
+ memberName = ln.slice(2);
349
+ }
350
+ else {
351
+ // custom event
352
+ // the JSX attribute could have been "onMyCustomEvent"
353
+ // so let's trim off the "on" prefix and lowercase the first character
354
+ // and add the listener "myCustomEvent"
355
+ // except for the first character, we keep the event name case
356
+ memberName = ln[2] + memberName.slice(3);
357
+ }
358
+ if (oldValue) {
359
+ plt.rel(elm, memberName, oldValue, false);
360
+ }
361
+ if (newValue) {
362
+ plt.ael(elm, memberName, newValue, false);
363
+ }
364
+ }
365
+ else {
366
+ // Set property if it exists and it's not a SVG
367
+ const isComplex = isComplexType(newValue);
368
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
369
+ try {
370
+ if (!elm.tagName.includes('-')) {
371
+ let n = newValue == null ? '' : newValue;
372
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
373
+ if (memberName === 'list') {
374
+ isProp = false;
375
+ // tslint:disable-next-line: triple-equals
376
+ }
377
+ else if (oldValue == null || elm[memberName] != n) {
378
+ elm[memberName] = n;
379
+ }
380
+ }
381
+ else {
382
+ elm[memberName] = newValue;
383
+ }
384
+ }
385
+ catch (e) { }
386
+ }
387
+ if (newValue == null || newValue === false) {
388
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
389
+ {
390
+ elm.removeAttribute(memberName);
391
+ }
392
+ }
393
+ }
394
+ else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
395
+ newValue = newValue === true ? '' : newValue;
396
+ {
397
+ elm.setAttribute(memberName, newValue);
398
+ }
399
+ }
400
+ }
401
+ }
402
+ };
403
+ const parseClassListRegex = /\s/;
404
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
405
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
406
+ // if the element passed in is a shadow root, which is a document fragment
407
+ // then we want to be adding attrs/props to the shadow root's "host" element
408
+ // if it's not a shadow root, then we add attrs/props to the same element
409
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
410
+ ? newVnode.$elm$.host
411
+ : newVnode.$elm$;
412
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
413
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
414
+ {
415
+ // remove attributes no longer present on the vnode by setting them to undefined
416
+ for (memberName in oldVnodeAttrs) {
417
+ if (!(memberName in newVnodeAttrs)) {
418
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
419
+ }
420
+ }
421
+ }
422
+ // add new & update changed attributes
423
+ for (memberName in newVnodeAttrs) {
424
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
425
+ }
426
+ };
427
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
428
+ // tslint:disable-next-line: prefer-const
429
+ let newVNode = newParentVNode.$children$[childIndex];
430
+ let i = 0;
431
+ let elm;
432
+ let childNode;
433
+ let oldVNode;
434
+ if (!useNativeShadowDom) {
435
+ // remember for later we need to check to relocate nodes
436
+ checkSlotRelocate = true;
437
+ if (newVNode.$tag$ === 'slot') {
438
+ if (scopeId) {
439
+ // scoped css needs to add its scoped id to the parent element
440
+ parentElm.classList.add(scopeId + '-s');
441
+ }
442
+ newVNode.$flags$ |= newVNode.$children$
443
+ ? // slot element has fallback content
444
+ 2 /* isSlotFallback */
445
+ : // slot element does not have fallback content
446
+ 1 /* isSlotReference */;
447
+ }
448
+ }
449
+ if (newVNode.$text$ !== null) {
450
+ // create text node
451
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
452
+ }
453
+ else if (newVNode.$flags$ & 1 /* isSlotReference */) {
454
+ // create a slot reference node
455
+ elm = newVNode.$elm$ =
456
+ doc.createTextNode('');
457
+ }
458
+ else {
459
+ // create element
460
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
461
+ ? 'slot-fb'
462
+ : newVNode.$tag$));
463
+ // add css classes, attrs, props, listeners, etc.
464
+ {
465
+ updateElement(null, newVNode, isSvgMode);
466
+ }
467
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
468
+ // if there is a scopeId and this is the initial render
469
+ // then let's add the scopeId as a css class
470
+ elm.classList.add((elm['s-si'] = scopeId));
471
+ }
472
+ if (newVNode.$children$) {
473
+ for (i = 0; i < newVNode.$children$.length; ++i) {
474
+ // create the node
475
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
476
+ // return node could have been null
477
+ if (childNode) {
478
+ // append our new node
479
+ elm.appendChild(childNode);
480
+ }
481
+ }
482
+ }
483
+ }
484
+ {
485
+ elm['s-hn'] = hostTagName;
486
+ if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
487
+ // remember the content reference comment
488
+ elm['s-sr'] = true;
489
+ // remember the content reference comment
490
+ elm['s-cr'] = contentRef;
491
+ // remember the slot name, or empty string for default slot
492
+ elm['s-sn'] = newVNode.$name$ || '';
493
+ // check if we've got an old vnode for this slot
494
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
495
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
496
+ // we've got an old slot vnode and the wrapper is being replaced
497
+ // so let's move the old slot content back to it's original location
498
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
499
+ }
500
+ }
501
+ }
502
+ return elm;
503
+ };
504
+ const putBackInOriginalLocation = (parentElm, recursive) => {
505
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
506
+ const oldSlotChildNodes = parentElm.childNodes;
507
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
508
+ const childNode = oldSlotChildNodes[i];
509
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
510
+ // // this child node in the old element is from another component
511
+ // // remove this node from the old slot's parent
512
+ // childNode.remove();
513
+ // and relocate it back to it's original location
514
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
515
+ // remove the old original location comment entirely
516
+ // later on the patch function will know what to do
517
+ // and move this to the correct spot in need be
518
+ childNode['s-ol'].remove();
519
+ childNode['s-ol'] = undefined;
520
+ checkSlotRelocate = true;
521
+ }
522
+ if (recursive) {
523
+ putBackInOriginalLocation(childNode, recursive);
524
+ }
525
+ }
526
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
527
+ };
528
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
529
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
530
+ let childNode;
531
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
532
+ containerElm = containerElm.shadowRoot;
533
+ }
534
+ for (; startIdx <= endIdx; ++startIdx) {
535
+ if (vnodes[startIdx]) {
536
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
537
+ if (childNode) {
538
+ vnodes[startIdx].$elm$ = childNode;
539
+ containerElm.insertBefore(childNode, referenceNode(before) );
540
+ }
541
+ }
542
+ }
543
+ };
544
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
545
+ for (; startIdx <= endIdx; ++startIdx) {
546
+ if ((vnode = vnodes[startIdx])) {
547
+ elm = vnode.$elm$;
548
+ {
549
+ // we're removing this element
550
+ // so it's possible we need to show slot fallback content now
551
+ checkSlotFallbackVisibility = true;
552
+ if (elm['s-ol']) {
553
+ // remove the original location comment
554
+ elm['s-ol'].remove();
555
+ }
556
+ else {
557
+ // it's possible that child nodes of the node
558
+ // that's being removed are slot nodes
559
+ putBackInOriginalLocation(elm, true);
560
+ }
561
+ }
562
+ // remove the vnode's element from the dom
563
+ elm.remove();
564
+ }
565
+ }
566
+ };
567
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
568
+ let oldStartIdx = 0;
569
+ let newStartIdx = 0;
570
+ let idxInOld = 0;
571
+ let i = 0;
572
+ let oldEndIdx = oldCh.length - 1;
573
+ let oldStartVnode = oldCh[0];
574
+ let oldEndVnode = oldCh[oldEndIdx];
575
+ let newEndIdx = newCh.length - 1;
576
+ let newStartVnode = newCh[0];
577
+ let newEndVnode = newCh[newEndIdx];
578
+ let node;
579
+ let elmToMove;
580
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
581
+ if (oldStartVnode == null) {
582
+ // Vnode might have been moved left
583
+ oldStartVnode = oldCh[++oldStartIdx];
584
+ }
585
+ else if (oldEndVnode == null) {
586
+ oldEndVnode = oldCh[--oldEndIdx];
587
+ }
588
+ else if (newStartVnode == null) {
589
+ newStartVnode = newCh[++newStartIdx];
590
+ }
591
+ else if (newEndVnode == null) {
592
+ newEndVnode = newCh[--newEndIdx];
593
+ }
594
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
595
+ patch(oldStartVnode, newStartVnode);
596
+ oldStartVnode = oldCh[++oldStartIdx];
597
+ newStartVnode = newCh[++newStartIdx];
598
+ }
599
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
600
+ patch(oldEndVnode, newEndVnode);
601
+ oldEndVnode = oldCh[--oldEndIdx];
602
+ newEndVnode = newCh[--newEndIdx];
603
+ }
604
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
605
+ // Vnode moved right
606
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
607
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
608
+ }
609
+ patch(oldStartVnode, newEndVnode);
610
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
611
+ oldStartVnode = oldCh[++oldStartIdx];
612
+ newEndVnode = newCh[--newEndIdx];
613
+ }
614
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
615
+ // Vnode moved left
616
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
617
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
618
+ }
619
+ patch(oldEndVnode, newStartVnode);
620
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
621
+ oldEndVnode = oldCh[--oldEndIdx];
622
+ newStartVnode = newCh[++newStartIdx];
623
+ }
624
+ else {
625
+ // createKeyToOldIdx
626
+ idxInOld = -1;
627
+ {
628
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
629
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
630
+ idxInOld = i;
631
+ break;
632
+ }
633
+ }
634
+ }
635
+ if (idxInOld >= 0) {
636
+ elmToMove = oldCh[idxInOld];
637
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
638
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
639
+ }
640
+ else {
641
+ patch(elmToMove, newStartVnode);
642
+ oldCh[idxInOld] = undefined;
643
+ node = elmToMove.$elm$;
644
+ }
645
+ newStartVnode = newCh[++newStartIdx];
646
+ }
647
+ else {
648
+ // new element
649
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
650
+ newStartVnode = newCh[++newStartIdx];
651
+ }
652
+ if (node) {
653
+ {
654
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
655
+ }
656
+ }
657
+ }
658
+ }
659
+ if (oldStartIdx > oldEndIdx) {
660
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
661
+ }
662
+ else if (newStartIdx > newEndIdx) {
663
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
664
+ }
665
+ };
666
+ const isSameVnode = (vnode1, vnode2) => {
667
+ // compare if two vnode to see if they're "technically" the same
668
+ // need to have the same element tag, and same key to be the same
669
+ if (vnode1.$tag$ === vnode2.$tag$) {
670
+ if (vnode1.$tag$ === 'slot') {
671
+ return vnode1.$name$ === vnode2.$name$;
672
+ }
673
+ {
674
+ return vnode1.$key$ === vnode2.$key$;
675
+ }
676
+ }
677
+ return false;
678
+ };
679
+ const referenceNode = (node) => {
680
+ // this node was relocated to a new location in the dom
681
+ // because of some other component's slot
682
+ // but we still have an html comment in place of where
683
+ // it's original location was according to it's original vdom
684
+ return (node && node['s-ol']) || node;
685
+ };
686
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
687
+ const patch = (oldVNode, newVNode) => {
688
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
689
+ const oldChildren = oldVNode.$children$;
690
+ const newChildren = newVNode.$children$;
691
+ const tag = newVNode.$tag$;
692
+ const text = newVNode.$text$;
693
+ let defaultHolder;
694
+ if (text === null) {
695
+ // element node
696
+ {
697
+ if (tag === 'slot')
698
+ ;
699
+ else {
700
+ // either this is the first render of an element OR it's an update
701
+ // AND we already know it's possible it could have changed
702
+ // this updates the element's css classes, attrs, props, listeners, etc.
703
+ updateElement(oldVNode, newVNode, isSvgMode);
704
+ }
705
+ }
706
+ if (oldChildren !== null && newChildren !== null) {
707
+ // looks like there's child vnodes for both the old and new vnodes
708
+ updateChildren(elm, oldChildren, newVNode, newChildren);
709
+ }
710
+ else if (newChildren !== null) {
711
+ // no old child vnodes, but there are new child vnodes to add
712
+ if (oldVNode.$text$ !== null) {
713
+ // the old vnode was text, so be sure to clear it out
714
+ elm.textContent = '';
715
+ }
716
+ // add the new vnode children
717
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
718
+ }
719
+ else if (oldChildren !== null) {
720
+ // no new child vnodes, but there are old child vnodes to remove
721
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
722
+ }
723
+ }
724
+ else if ((defaultHolder = elm['s-cr'])) {
725
+ // this element has slotted content
726
+ defaultHolder.parentNode.textContent = text;
727
+ }
728
+ else if (oldVNode.$text$ !== text) {
729
+ // update the text content for the text only vnode
730
+ // and also only if the text is different than before
731
+ elm.data = text;
732
+ }
733
+ };
734
+ const updateFallbackSlotVisibility = (elm) => {
735
+ // tslint:disable-next-line: prefer-const
736
+ let childNodes = elm.childNodes;
737
+ let childNode;
738
+ let i;
739
+ let ilen;
740
+ let j;
741
+ let slotNameAttr;
742
+ let nodeType;
743
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
744
+ childNode = childNodes[i];
745
+ if (childNode.nodeType === 1 /* ElementNode */) {
746
+ if (childNode['s-sr']) {
747
+ // this is a slot fallback node
748
+ // get the slot name for this slot reference node
749
+ slotNameAttr = childNode['s-sn'];
750
+ // by default always show a fallback slot node
751
+ // then hide it if there are other slots in the light dom
752
+ childNode.hidden = false;
753
+ for (j = 0; j < ilen; j++) {
754
+ nodeType = childNodes[j].nodeType;
755
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
756
+ // this sibling node is from a different component OR is a named fallback slot node
757
+ if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
758
+ childNode.hidden = true;
759
+ break;
760
+ }
761
+ }
762
+ else {
763
+ // this is a default fallback slot node
764
+ // any element or text node (with content)
765
+ // should hide the default fallback slot node
766
+ if (nodeType === 1 /* ElementNode */ ||
767
+ (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
768
+ childNode.hidden = true;
769
+ break;
770
+ }
771
+ }
772
+ }
773
+ }
774
+ // keep drilling down
775
+ updateFallbackSlotVisibility(childNode);
776
+ }
777
+ }
778
+ };
779
+ const relocateNodes = [];
780
+ const relocateSlotContent = (elm) => {
781
+ // tslint:disable-next-line: prefer-const
782
+ let childNode;
783
+ let node;
784
+ let hostContentNodes;
785
+ let slotNameAttr;
786
+ let relocateNodeData;
787
+ let j;
788
+ let i = 0;
789
+ let childNodes = elm.childNodes;
790
+ let ilen = childNodes.length;
791
+ for (; i < ilen; i++) {
792
+ childNode = childNodes[i];
793
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
794
+ // first got the content reference comment node
795
+ // then we got it's parent, which is where all the host content is in now
796
+ hostContentNodes = node.parentNode.childNodes;
797
+ slotNameAttr = childNode['s-sn'];
798
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
799
+ node = hostContentNodes[j];
800
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
801
+ // let's do some relocating to its new home
802
+ // but never relocate a content reference node
803
+ // that is suppose to always represent the original content location
804
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
805
+ // it's possible we've already decided to relocate this node
806
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
807
+ // made some changes to slots
808
+ // let's make sure we also double check
809
+ // fallbacks are correctly hidden or shown
810
+ checkSlotFallbackVisibility = true;
811
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
812
+ if (relocateNodeData) {
813
+ // previously we never found a slot home for this node
814
+ // but turns out we did, so let's remember it now
815
+ relocateNodeData.$slotRefNode$ = childNode;
816
+ }
817
+ else {
818
+ // add to our list of nodes to relocate
819
+ relocateNodes.push({
820
+ $slotRefNode$: childNode,
821
+ $nodeToRelocate$: node,
822
+ });
823
+ }
824
+ if (node['s-sr']) {
825
+ relocateNodes.map((relocateNode) => {
826
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
827
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
828
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
829
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
830
+ }
831
+ }
832
+ });
833
+ }
834
+ }
835
+ else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
836
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
837
+ // if we never find a home for this element then we'll need to hide it
838
+ relocateNodes.push({
839
+ $nodeToRelocate$: node,
840
+ });
841
+ }
842
+ }
843
+ }
844
+ }
845
+ if (childNode.nodeType === 1 /* ElementNode */) {
846
+ relocateSlotContent(childNode);
847
+ }
848
+ }
849
+ };
850
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
851
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
852
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
853
+ return true;
854
+ }
855
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
856
+ return true;
857
+ }
858
+ return false;
859
+ }
860
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
861
+ return true;
862
+ }
863
+ return slotNameAttr === '';
864
+ };
865
+ const renderVdom = (hostRef, renderFnResults) => {
866
+ const hostElm = hostRef.$hostElement$;
867
+ const cmpMeta = hostRef.$cmpMeta$;
868
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
869
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
870
+ hostTagName = hostElm.tagName;
871
+ if (cmpMeta.$attrsToReflect$) {
872
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
873
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
874
+ }
875
+ rootVnode.$tag$ = null;
876
+ rootVnode.$flags$ |= 4 /* isHost */;
877
+ hostRef.$vnode$ = rootVnode;
878
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
879
+ {
880
+ scopeId = hostElm['s-sc'];
881
+ }
882
+ {
883
+ contentRef = hostElm['s-cr'];
884
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
885
+ // always reset
886
+ checkSlotFallbackVisibility = false;
887
+ }
888
+ // synchronous patch
889
+ patch(oldVNode, rootVnode);
890
+ {
891
+ // while we're moving nodes around existing nodes, temporarily disable
892
+ // the disconnectCallback from working
893
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
894
+ if (checkSlotRelocate) {
895
+ relocateSlotContent(rootVnode.$elm$);
896
+ let relocateData;
897
+ let nodeToRelocate;
898
+ let orgLocationNode;
899
+ let parentNodeRef;
900
+ let insertBeforeNode;
901
+ let refNode;
902
+ let i = 0;
903
+ for (; i < relocateNodes.length; i++) {
904
+ relocateData = relocateNodes[i];
905
+ nodeToRelocate = relocateData.$nodeToRelocate$;
906
+ if (!nodeToRelocate['s-ol']) {
907
+ // add a reference node marking this node's original location
908
+ // keep a reference to this node for later lookups
909
+ orgLocationNode =
910
+ doc.createTextNode('');
911
+ orgLocationNode['s-nr'] = nodeToRelocate;
912
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
913
+ }
914
+ }
915
+ for (i = 0; i < relocateNodes.length; i++) {
916
+ relocateData = relocateNodes[i];
917
+ nodeToRelocate = relocateData.$nodeToRelocate$;
918
+ if (relocateData.$slotRefNode$) {
919
+ // by default we're just going to insert it directly
920
+ // after the slot reference node
921
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
922
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
923
+ orgLocationNode = nodeToRelocate['s-ol'];
924
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
925
+ refNode = orgLocationNode['s-nr'];
926
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
927
+ refNode = refNode.nextSibling;
928
+ if (!refNode || !refNode['s-nr']) {
929
+ insertBeforeNode = refNode;
930
+ break;
931
+ }
932
+ }
933
+ }
934
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
935
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
936
+ // we've checked that it's worth while to relocate
937
+ // since that the node to relocate
938
+ // has a different next sibling or parent relocated
939
+ if (nodeToRelocate !== insertBeforeNode) {
940
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
941
+ // probably a component in the index.html that doesn't have it's hostname set
942
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
943
+ }
944
+ // add it back to the dom but in its new home
945
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
946
+ }
947
+ }
948
+ }
949
+ else {
950
+ // this node doesn't have a slot home to go to, so let's hide it
951
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
952
+ nodeToRelocate.hidden = true;
953
+ }
954
+ }
955
+ }
956
+ }
957
+ if (checkSlotFallbackVisibility) {
958
+ updateFallbackSlotVisibility(rootVnode.$elm$);
959
+ }
960
+ // done moving nodes around
961
+ // allow the disconnect callback to work again
962
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
963
+ // always reset
964
+ relocateNodes.length = 0;
965
+ }
966
+ };
967
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
968
+ const createEvent = (ref, name, flags) => {
969
+ const elm = getElement(ref);
970
+ return {
971
+ emit: (detail) => {
972
+ return emitEvent(elm, name, {
973
+ bubbles: !!(flags & 4 /* Bubbles */),
974
+ composed: !!(flags & 2 /* Composed */),
975
+ cancelable: !!(flags & 1 /* Cancellable */),
976
+ detail,
977
+ });
978
+ },
979
+ };
980
+ };
981
+ /**
982
+ * Helper function to create & dispatch a custom Event on a provided target
983
+ * @param elm the target of the Event
984
+ * @param name the name to give the custom Event
985
+ * @param opts options for configuring a custom Event
986
+ * @returns the custom Event
987
+ */
988
+ const emitEvent = (elm, name, opts) => {
989
+ const ev = plt.ce(name, opts);
990
+ elm.dispatchEvent(ev);
991
+ return ev;
992
+ };
993
+ const attachToAncestor = (hostRef, ancestorComponent) => {
994
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
995
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
996
+ }
997
+ };
998
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
999
+ {
1000
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1001
+ }
1002
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1003
+ hostRef.$flags$ |= 512 /* needsRerender */;
1004
+ return;
1005
+ }
1006
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1007
+ // there is no ancestor component or the ancestor component
1008
+ // has already fired off its lifecycle update then
1009
+ // fire off the initial update
1010
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1011
+ return writeTask(dispatch) ;
1012
+ };
1013
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1014
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1015
+ const instance = hostRef.$lazyInstance$ ;
1016
+ let promise;
1017
+ if (isInitialLoad) {
1018
+ {
1019
+ hostRef.$flags$ |= 256 /* isListenReady */;
1020
+ if (hostRef.$queuedListeners$) {
1021
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1022
+ hostRef.$queuedListeners$ = null;
1023
+ }
1024
+ }
1025
+ {
1026
+ promise = safeCall(instance, 'componentWillLoad');
1027
+ }
1028
+ }
1029
+ endSchedule();
1030
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1031
+ };
1032
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1033
+ // updateComponent
1034
+ const elm = hostRef.$hostElement$;
1035
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1036
+ const rc = elm['s-rc'];
1037
+ if (isInitialLoad) {
1038
+ // DOM WRITE!
1039
+ attachStyles(hostRef);
1040
+ }
1041
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1042
+ {
1043
+ callRender(hostRef, instance);
1044
+ }
1045
+ if (rc) {
1046
+ // ok, so turns out there are some child host elements
1047
+ // waiting on this parent element to load
1048
+ // let's fire off all update callbacks waiting
1049
+ rc.map((cb) => cb());
1050
+ elm['s-rc'] = undefined;
1051
+ }
1052
+ endRender();
1053
+ endUpdate();
1054
+ {
1055
+ const childrenPromises = elm['s-p'];
1056
+ const postUpdate = () => postUpdateComponent(hostRef);
1057
+ if (childrenPromises.length === 0) {
1058
+ postUpdate();
1059
+ }
1060
+ else {
1061
+ Promise.all(childrenPromises).then(postUpdate);
1062
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1063
+ childrenPromises.length = 0;
1064
+ }
1065
+ }
1066
+ };
1067
+ const callRender = (hostRef, instance, elm) => {
1068
+ try {
1069
+ instance = instance.render() ;
1070
+ {
1071
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1072
+ }
1073
+ {
1074
+ hostRef.$flags$ |= 2 /* hasRendered */;
1075
+ }
1076
+ {
1077
+ {
1078
+ // looks like we've got child nodes to render into this host element
1079
+ // or we need to update the css class/attrs on the host element
1080
+ // DOM WRITE!
1081
+ {
1082
+ renderVdom(hostRef, instance);
1083
+ }
1084
+ }
1085
+ }
1086
+ }
1087
+ catch (e) {
1088
+ consoleError(e, hostRef.$hostElement$);
1089
+ }
1090
+ return null;
1091
+ };
1092
+ const postUpdateComponent = (hostRef) => {
1093
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1094
+ const elm = hostRef.$hostElement$;
1095
+ const endPostUpdate = createTime('postUpdate', tagName);
1096
+ const ancestorComponent = hostRef.$ancestorComponent$;
1097
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1098
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1099
+ {
1100
+ // DOM WRITE!
1101
+ addHydratedFlag(elm);
1102
+ }
1103
+ endPostUpdate();
1104
+ {
1105
+ hostRef.$onReadyResolve$(elm);
1106
+ if (!ancestorComponent) {
1107
+ appDidLoad();
1108
+ }
1109
+ }
1110
+ }
1111
+ else {
1112
+ endPostUpdate();
1113
+ }
1114
+ // load events fire from bottom to top
1115
+ // the deepest elements load first then bubbles up
1116
+ {
1117
+ if (hostRef.$onRenderResolve$) {
1118
+ hostRef.$onRenderResolve$();
1119
+ hostRef.$onRenderResolve$ = undefined;
1120
+ }
1121
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
1122
+ nextTick(() => scheduleUpdate(hostRef, false));
1123
+ }
1124
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1125
+ }
1126
+ // ( •_•)
1127
+ // ( •_•)>⌐■-■
1128
+ // (⌐■_■)
1129
+ };
1130
+ const appDidLoad = (who) => {
1131
+ // on appload
1132
+ // we have finish the first big initial render
1133
+ {
1134
+ addHydratedFlag(doc.documentElement);
1135
+ }
1136
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1137
+ };
1138
+ const safeCall = (instance, method, arg) => {
1139
+ if (instance && instance[method]) {
1140
+ try {
1141
+ return instance[method](arg);
1142
+ }
1143
+ catch (e) {
1144
+ consoleError(e);
1145
+ }
1146
+ }
1147
+ return undefined;
1148
+ };
1149
+ const then = (promise, thenFn) => {
1150
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1151
+ };
1152
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1153
+ ;
1154
+ const parsePropertyValue = (propValue, propType) => {
1155
+ // ensure this value is of the correct prop type
1156
+ if (propValue != null && !isComplexType(propValue)) {
1157
+ if (propType & 4 /* Boolean */) {
1158
+ // per the HTML spec, any string value means it is a boolean true value
1159
+ // but we'll cheat here and say that the string "false" is the boolean false
1160
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
1161
+ }
1162
+ if (propType & 2 /* Number */) {
1163
+ // force it to be a number
1164
+ return parseFloat(propValue);
1165
+ }
1166
+ if (propType & 1 /* String */) {
1167
+ // could have been passed as a number or boolean
1168
+ // but we still want it as a string
1169
+ return String(propValue);
1170
+ }
1171
+ // redundant return here for better minification
1172
+ return propValue;
1173
+ }
1174
+ // not sure exactly what type we want
1175
+ // so no need to change to a different type
1176
+ return propValue;
1177
+ };
1178
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1179
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1180
+ // check our new property value against our internal value
1181
+ const hostRef = getHostRef(ref);
1182
+ const oldVal = hostRef.$instanceValues$.get(propName);
1183
+ const flags = hostRef.$flags$;
1184
+ const instance = hostRef.$lazyInstance$ ;
1185
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1186
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
1187
+ // gadzooks! the property's value has changed!!
1188
+ // set our new value!
1189
+ hostRef.$instanceValues$.set(propName, newVal);
1190
+ if (instance) {
1191
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1192
+ // looks like this value actually changed, so we've got work to do!
1193
+ // but only if we've already rendered, otherwise just chill out
1194
+ // queue that we need to do an update, but don't worry about queuing
1195
+ // up millions cuz this function ensures it only runs once
1196
+ scheduleUpdate(hostRef, false);
1197
+ }
1198
+ }
1199
+ }
1200
+ };
1201
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1202
+ if (cmpMeta.$members$) {
1203
+ // It's better to have a const than two Object.entries()
1204
+ const members = Object.entries(cmpMeta.$members$);
1205
+ const prototype = Cstr.prototype;
1206
+ members.map(([memberName, [memberFlags]]) => {
1207
+ if ((memberFlags & 31 /* Prop */ ||
1208
+ ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1209
+ // proxyComponent - prop
1210
+ Object.defineProperty(prototype, memberName, {
1211
+ get() {
1212
+ // proxyComponent, get value
1213
+ return getValue(this, memberName);
1214
+ },
1215
+ set(newValue) {
1216
+ // proxyComponent, set value
1217
+ setValue(this, memberName, newValue, cmpMeta);
1218
+ },
1219
+ configurable: true,
1220
+ enumerable: true,
1221
+ });
1222
+ }
1223
+ });
1224
+ if ((flags & 1 /* isElementConstructor */)) {
1225
+ const attrNameToPropName = new Map();
1226
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1227
+ plt.jmp(() => {
1228
+ const propName = attrNameToPropName.get(attrName);
1229
+ // In a webcomponent lifecyle the attributeChangedCallback runs prior to connectedCallback
1230
+ // in the case where an attribute was set inline.
1231
+ // ```html
1232
+ // <my-component some-attribute="some-value"></my-component>
1233
+ // ```
1234
+ //
1235
+ // There is an edge case where a developer sets the attribute inline on a custom element and then programatically
1236
+ // changes it before it has been upgraded as shown below:
1237
+ //
1238
+ // ```html
1239
+ // <!-- this component has _not_ been upgraded yet -->
1240
+ // <my-component id="test" some-attribute="some-value"></my-component>
1241
+ // <script>
1242
+ // // grab non-upgraded component
1243
+ // el = document.querySelector("#test");
1244
+ // el.someAttribute = "another-value";
1245
+ // // upgrade component
1246
+ // cutsomElements.define('my-component', MyComponent);
1247
+ // </script>
1248
+ // ```
1249
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1250
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1251
+ // to the value that was set inline i.e. "some-value" from above example. When
1252
+ // the connectedCallback attempts to unshadow it will use "some-value" as the intial value rather than "another-value"
1253
+ //
1254
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1255
+ // by connectedCallback as this attributeChangedCallback will not fire.
1256
+ //
1257
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1258
+ //
1259
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1260
+ // properties here given that this goes against best practices outlined here
1261
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1262
+ if (this.hasOwnProperty(propName)) {
1263
+ newValue = this[propName];
1264
+ delete this[propName];
1265
+ }
1266
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1267
+ });
1268
+ };
1269
+ // create an array of attributes to observe
1270
+ // and also create a map of html attribute name to js property name
1271
+ Cstr.observedAttributes = members
1272
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1273
+ .map(([propName, m]) => {
1274
+ const attrName = m[1] || propName;
1275
+ attrNameToPropName.set(attrName, propName);
1276
+ if (m[0] & 512 /* ReflectAttr */) {
1277
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1278
+ }
1279
+ return attrName;
1280
+ });
1281
+ }
1282
+ }
1283
+ return Cstr;
1284
+ };
1285
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1286
+ // initializeComponent
1287
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1288
+ {
1289
+ // we haven't initialized this element yet
1290
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1291
+ // lazy loaded components
1292
+ // request the component's implementation to be
1293
+ // wired up with the host element
1294
+ Cstr = loadModule(cmpMeta);
1295
+ if (Cstr.then) {
1296
+ // Await creates a micro-task avoid if possible
1297
+ const endLoad = uniqueTime();
1298
+ Cstr = await Cstr;
1299
+ endLoad();
1300
+ }
1301
+ if (!Cstr.isProxied) {
1302
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1303
+ Cstr.isProxied = true;
1304
+ }
1305
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1306
+ // ok, time to construct the instance
1307
+ // but let's keep track of when we start and stop
1308
+ // so that the getters/setters don't incorrectly step on data
1309
+ {
1310
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1311
+ }
1312
+ // construct the lazy-loaded component implementation
1313
+ // passing the hostRef is very important during
1314
+ // construction in order to directly wire together the
1315
+ // host element and the lazy-loaded instance
1316
+ try {
1317
+ new Cstr(hostRef);
1318
+ }
1319
+ catch (e) {
1320
+ consoleError(e);
1321
+ }
1322
+ {
1323
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1324
+ }
1325
+ endNewInstance();
1326
+ }
1327
+ if (Cstr.style) {
1328
+ // this component has styles but we haven't registered them yet
1329
+ let style = Cstr.style;
1330
+ const scopeId = getScopeId(cmpMeta);
1331
+ if (!styles.has(scopeId)) {
1332
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1333
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1334
+ endRegisterStyles();
1335
+ }
1336
+ }
1337
+ }
1338
+ // we've successfully created a lazy instance
1339
+ const ancestorComponent = hostRef.$ancestorComponent$;
1340
+ const schedule = () => scheduleUpdate(hostRef, true);
1341
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1342
+ // this is the intial load and this component it has an ancestor component
1343
+ // but the ancestor component has NOT fired its will update lifecycle yet
1344
+ // so let's just cool our jets and wait for the ancestor to continue first
1345
+ // this will get fired off when the ancestor component
1346
+ // finally gets around to rendering its lazy self
1347
+ // fire off the initial update
1348
+ ancestorComponent['s-rc'].push(schedule);
1349
+ }
1350
+ else {
1351
+ schedule();
1352
+ }
1353
+ };
1354
+ const connectedCallback = (elm) => {
1355
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1356
+ const hostRef = getHostRef(elm);
1357
+ const cmpMeta = hostRef.$cmpMeta$;
1358
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1359
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1360
+ // first time this component has connected
1361
+ hostRef.$flags$ |= 1 /* hasConnected */;
1362
+ {
1363
+ // initUpdate
1364
+ // if the slot polyfill is required we'll need to put some nodes
1365
+ // in here to act as original content anchors as we move nodes around
1366
+ // host element has been connected to the DOM
1367
+ if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1368
+ setContentReference(elm);
1369
+ }
1370
+ }
1371
+ {
1372
+ // find the first ancestor component (if there is one) and register
1373
+ // this component as one of the actively loading child components for its ancestor
1374
+ let ancestorComponent = elm;
1375
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1376
+ // climb up the ancestors looking for the first
1377
+ // component that hasn't finished its lifecycle update yet
1378
+ if (ancestorComponent['s-p']) {
1379
+ // we found this components first ancestor component
1380
+ // keep a reference to this component's ancestor component
1381
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1382
+ break;
1383
+ }
1384
+ }
1385
+ }
1386
+ // Lazy properties
1387
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1388
+ if (cmpMeta.$members$) {
1389
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1390
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1391
+ const value = elm[memberName];
1392
+ delete elm[memberName];
1393
+ elm[memberName] = value;
1394
+ }
1395
+ });
1396
+ }
1397
+ {
1398
+ initializeComponent(elm, hostRef, cmpMeta);
1399
+ }
1400
+ }
1401
+ else {
1402
+ // not the first time this has connected
1403
+ // reattach any event listeners to the host
1404
+ // since they would have been removed when disconnected
1405
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1406
+ }
1407
+ endConnected();
1408
+ }
1409
+ };
1410
+ const setContentReference = (elm) => {
1411
+ // only required when we're NOT using native shadow dom (slot)
1412
+ // or this browser doesn't support native shadow dom
1413
+ // and this host element was NOT created with SSR
1414
+ // let's pick out the inner content for slot projection
1415
+ // create a node to represent where the original
1416
+ // content was first placed, which is useful later on
1417
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1418
+ contentRefElm['s-cn'] = true;
1419
+ elm.insertBefore(contentRefElm, elm.firstChild);
1420
+ };
1421
+ const disconnectedCallback = (elm) => {
1422
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1423
+ const hostRef = getHostRef(elm);
1424
+ const instance = hostRef.$lazyInstance$ ;
1425
+ {
1426
+ if (hostRef.$rmListeners$) {
1427
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1428
+ hostRef.$rmListeners$ = undefined;
1429
+ }
1430
+ }
1431
+ {
1432
+ safeCall(instance, 'disconnectedCallback');
1433
+ }
1434
+ }
1435
+ };
1436
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1437
+ const endBootstrap = createTime();
1438
+ const cmpTags = [];
1439
+ const exclude = options.exclude || [];
1440
+ const customElements = win.customElements;
1441
+ const head = doc.head;
1442
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1443
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1444
+ const deferredConnectedCallbacks = [];
1445
+ let appLoadFallback;
1446
+ let isBootstrapping = true;
1447
+ Object.assign(plt, options);
1448
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1449
+ lazyBundles.map((lazyBundle) => lazyBundle[1].map((compactMeta) => {
1450
+ const cmpMeta = {
1451
+ $flags$: compactMeta[0],
1452
+ $tagName$: compactMeta[1],
1453
+ $members$: compactMeta[2],
1454
+ $listeners$: compactMeta[3],
1455
+ };
1456
+ {
1457
+ cmpMeta.$members$ = compactMeta[2];
1458
+ }
1459
+ {
1460
+ cmpMeta.$listeners$ = compactMeta[3];
1461
+ }
1462
+ {
1463
+ cmpMeta.$attrsToReflect$ = [];
1464
+ }
1465
+ const tagName = cmpMeta.$tagName$;
1466
+ const HostElement = class extends HTMLElement {
1467
+ // StencilLazyHost
1468
+ constructor(self) {
1469
+ // @ts-ignore
1470
+ super(self);
1471
+ self = this;
1472
+ registerHost(self, cmpMeta);
1473
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1474
+ // this component is using shadow dom
1475
+ // and this browser supports shadow dom
1476
+ // add the read-only property "shadowRoot" to the host element
1477
+ // adding the shadow root build conditionals to minimize runtime
1478
+ {
1479
+ {
1480
+ self.attachShadow({ mode: 'open' });
1481
+ }
1482
+ }
1483
+ }
1484
+ }
1485
+ connectedCallback() {
1486
+ if (appLoadFallback) {
1487
+ clearTimeout(appLoadFallback);
1488
+ appLoadFallback = null;
1489
+ }
1490
+ if (isBootstrapping) {
1491
+ // connectedCallback will be processed once all components have been registered
1492
+ deferredConnectedCallbacks.push(this);
1493
+ }
1494
+ else {
1495
+ plt.jmp(() => connectedCallback(this));
1496
+ }
1497
+ }
1498
+ disconnectedCallback() {
1499
+ plt.jmp(() => disconnectedCallback(this));
1500
+ }
1501
+ componentOnReady() {
1502
+ return getHostRef(this).$onReadyPromise$;
1503
+ }
1504
+ };
1505
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1506
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1507
+ cmpTags.push(tagName);
1508
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1509
+ }
1510
+ }));
1511
+ {
1512
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1513
+ visibilityStyle.setAttribute('data-styles', '');
1514
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1515
+ }
1516
+ // Process deferred connectedCallbacks now all components have been registered
1517
+ isBootstrapping = false;
1518
+ if (deferredConnectedCallbacks.length) {
1519
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1520
+ }
1521
+ else {
1522
+ {
1523
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1524
+ }
1525
+ }
1526
+ // Fallback appLoad event
1527
+ endBootstrap();
1528
+ };
1529
+ const hostRefs = new WeakMap();
1530
+ const getHostRef = (ref) => hostRefs.get(ref);
1531
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1532
+ const registerHost = (elm, cmpMeta) => {
1533
+ const hostRef = {
1534
+ $flags$: 0,
1535
+ $hostElement$: elm,
1536
+ $cmpMeta$: cmpMeta,
1537
+ $instanceValues$: new Map(),
1538
+ };
1539
+ {
1540
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1541
+ elm['s-p'] = [];
1542
+ elm['s-rc'] = [];
1543
+ }
1544
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1545
+ return hostRefs.set(elm, hostRef);
1546
+ };
1547
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1548
+ const consoleError = (e, el) => (0, console.error)(e, el);
1549
+ const cmpModules = /*@__PURE__*/ new Map();
1550
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1551
+ // loadModuleImport
1552
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1553
+ const bundleId = cmpMeta.$lazyBundleId$;
1554
+ const module = cmpModules.get(bundleId) ;
1555
+ if (module) {
1556
+ return module[exportName];
1557
+ }
1558
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1559
+ /* webpackInclude: /\.entry\.js$/ */
1560
+ /* webpackExclude: /\.system\.entry\.js$/ */
1561
+ /* webpackMode: "lazy" */
1562
+ `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
1563
+ {
1564
+ cmpModules.set(bundleId, importedModule);
1565
+ }
1566
+ return importedModule[exportName];
1567
+ }, consoleError);
1568
+ };
1569
+ const styles = new Map();
1570
+ const queueDomReads = [];
1571
+ const queueDomWrites = [];
1572
+ const queueTask = (queue, write) => (cb) => {
1573
+ queue.push(cb);
1574
+ if (!queuePending) {
1575
+ queuePending = true;
1576
+ if (write && plt.$flags$ & 4 /* queueSync */) {
1577
+ nextTick(flush);
1578
+ }
1579
+ else {
1580
+ plt.raf(flush);
1581
+ }
1582
+ }
1583
+ };
1584
+ const consume = (queue) => {
1585
+ for (let i = 0; i < queue.length; i++) {
1586
+ try {
1587
+ queue[i](performance.now());
1588
+ }
1589
+ catch (e) {
1590
+ consoleError(e);
1591
+ }
1592
+ }
1593
+ queue.length = 0;
1594
+ };
1595
+ const flush = () => {
1596
+ // always force a bunch of medium callbacks to run, but still have
1597
+ // a throttle on how many can run in a certain time
1598
+ // DOM READS!!!
1599
+ consume(queueDomReads);
1600
+ // DOM WRITES!!!
1601
+ {
1602
+ consume(queueDomWrites);
1603
+ if ((queuePending = queueDomReads.length > 0)) {
1604
+ // still more to do yet, but we've run out of time
1605
+ // let's let this thing cool off and try again in the next tick
1606
+ plt.raf(flush);
1607
+ }
1608
+ }
1609
+ };
1610
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1611
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1612
+
1613
+ exports.Host = Host;
1614
+ exports.bootstrapLazy = bootstrapLazy;
1615
+ exports.createEvent = createEvent;
1616
+ exports.getElement = getElement;
1617
+ exports.h = h;
1618
+ exports.promiseResolve = promiseResolve;
1619
+ exports.registerInstance = registerInstance;