@maggioli-design-system/mds-accordion-timer 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 (121) hide show
  1. package/dist/cjs/index-dc0bb58e.js +1017 -0
  2. package/dist/cjs/index.cjs.js +2 -0
  3. package/dist/cjs/loader.cjs.js +21 -0
  4. package/dist/cjs/mds-accordion-timer.cjs.entry.js +129 -0
  5. package/dist/cjs/mds-accordion-timer.cjs.js +19 -0
  6. package/dist/collection/collection-manifest.json +12 -0
  7. package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.css +3 -0
  8. package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.js +184 -0
  9. package/dist/collection/components/mds-accordion-timer/test/mds-accordion-timer.stories.js +32 -0
  10. package/dist/collection/dictionary/autocomplete.js +59 -0
  11. package/dist/collection/dictionary/button.js +26 -0
  12. package/dist/collection/dictionary/color.js +19 -0
  13. package/dist/collection/dictionary/icon.js +3 -0
  14. package/dist/collection/dictionary/input-text-type.js +13 -0
  15. package/dist/collection/dictionary/loading.js +5 -0
  16. package/dist/collection/dictionary/typography.js +37 -0
  17. package/dist/collection/dictionary/variant.js +64 -0
  18. package/dist/collection/fixtures/cities.js +110 -0
  19. package/dist/collection/interface/input-value.js +1 -0
  20. package/dist/collection/types/autocomplete.js +1 -0
  21. package/dist/collection/types/button.js +1 -0
  22. package/dist/collection/types/form-rel.js +1 -0
  23. package/dist/collection/types/input-text-type.js +1 -0
  24. package/dist/collection/types/input-value-type.js +1 -0
  25. package/dist/collection/types/loading.js +1 -0
  26. package/dist/collection/types/typography.js +1 -0
  27. package/dist/collection/types/variant.js +1 -0
  28. package/dist/custom-elements/index.d.ts +45 -0
  29. package/dist/custom-elements/index.js +141 -0
  30. package/dist/esm/index-468ab090.js +989 -0
  31. package/dist/esm/index.js +1 -0
  32. package/dist/esm/loader.js +17 -0
  33. package/dist/esm/mds-accordion-timer.entry.js +125 -0
  34. package/dist/esm/mds-accordion-timer.js +17 -0
  35. package/dist/esm/polyfills/core-js.js +11 -0
  36. package/dist/esm/polyfills/css-shim.js +1 -0
  37. package/dist/esm/polyfills/dom.js +79 -0
  38. package/dist/esm/polyfills/es5-html-element.js +1 -0
  39. package/dist/esm/polyfills/index.js +34 -0
  40. package/dist/esm/polyfills/system.js +6 -0
  41. package/dist/esm-es5/index-468ab090.js +1 -0
  42. package/dist/esm-es5/index.js +0 -0
  43. package/dist/esm-es5/loader.js +1 -0
  44. package/dist/esm-es5/mds-accordion-timer.entry.js +1 -0
  45. package/dist/esm-es5/mds-accordion-timer.js +1 -0
  46. package/dist/index.cjs.js +1 -0
  47. package/dist/index.js +1 -0
  48. package/dist/mds-accordion-timer/index.esm.js +0 -0
  49. package/dist/mds-accordion-timer/mds-accordion-timer.esm.js +1 -0
  50. package/dist/mds-accordion-timer/mds-accordion-timer.js +130 -0
  51. package/dist/mds-accordion-timer/p-104355eb.system.entry.js +1 -0
  52. package/dist/mds-accordion-timer/p-2c75936b.entry.js +1 -0
  53. package/dist/mds-accordion-timer/p-50ea2036.system.js +1 -0
  54. package/dist/mds-accordion-timer/p-74539cca.system.js +1 -0
  55. package/dist/mds-accordion-timer/p-a652c8b3.system.js +1 -0
  56. package/dist/mds-accordion-timer/p-ac3fdd27.js +1 -0
  57. package/dist/stats.json +471 -0
  58. package/dist/types/components/mds-accordion-timer/mds-accordion-timer.d.ts +37 -0
  59. package/dist/types/components.d.ts +49 -0
  60. package/dist/types/dictionary/autocomplete.d.ts +2 -0
  61. package/dist/types/dictionary/button.d.ts +5 -0
  62. package/dist/types/dictionary/color.d.ts +3 -0
  63. package/dist/types/dictionary/icon.d.ts +2 -0
  64. package/dist/types/dictionary/input-text-type.d.ts +2 -0
  65. package/dist/types/dictionary/loading.d.ts +2 -0
  66. package/dist/types/dictionary/typography.d.ts +5 -0
  67. package/dist/types/dictionary/variant.d.ts +9 -0
  68. package/dist/types/fixtures/cities.d.ts +2 -0
  69. package/dist/types/interface/input-value.d.ts +4 -0
  70. package/dist/types/stencil-public-runtime.d.ts +1563 -0
  71. package/dist/types/types/autocomplete.d.ts +2 -0
  72. package/dist/types/types/button.d.ts +4 -0
  73. package/dist/types/types/form-rel.d.ts +1 -0
  74. package/dist/types/types/input-text-type.d.ts +1 -0
  75. package/dist/types/types/input-value-type.d.ts +1 -0
  76. package/dist/types/types/loading.d.ts +1 -0
  77. package/dist/types/types/typography.d.ts +4 -0
  78. package/dist/types/types/variant.d.ts +10 -0
  79. package/loader/cdn.js +3 -0
  80. package/loader/index.cjs.js +3 -0
  81. package/loader/index.d.ts +12 -0
  82. package/loader/index.es2017.js +3 -0
  83. package/loader/index.js +4 -0
  84. package/loader/package.json +10 -0
  85. package/package.json +45 -0
  86. package/readme.md +24 -0
  87. package/src/components/mds-accordion-timer/mds-accordion-timer.css +3 -0
  88. package/src/components/mds-accordion-timer/mds-accordion-timer.tsx +159 -0
  89. package/src/components/mds-accordion-timer/readme.md +24 -0
  90. package/src/components/mds-accordion-timer/test/mds-accordion-timer.e2e.ts +11 -0
  91. package/src/components/mds-accordion-timer/test/mds-accordion-timer.spec.tsx +18 -0
  92. package/src/components/mds-accordion-timer/test/mds-accordion-timer.stories.js +32 -0
  93. package/src/components.d.ts +49 -0
  94. package/src/dictionary/autocomplete.ts +62 -0
  95. package/src/dictionary/button.ts +35 -0
  96. package/src/dictionary/color.ts +24 -0
  97. package/src/dictionary/icon.ts +5 -0
  98. package/src/dictionary/input-text-type.ts +17 -0
  99. package/src/dictionary/loading.ts +9 -0
  100. package/src/dictionary/typography.ts +46 -0
  101. package/src/dictionary/variant.ts +81 -0
  102. package/src/fixtures/cities.ts +116 -0
  103. package/src/interface/input-value.ts +5 -0
  104. package/src/types/autocomplete.ts +69 -0
  105. package/src/types/button.ts +24 -0
  106. package/src/types/form-rel.ts +11 -0
  107. package/src/types/input-text-type.ts +11 -0
  108. package/src/types/input-value-type.ts +5 -0
  109. package/src/types/loading.ts +3 -0
  110. package/src/types/typography.ts +35 -0
  111. package/src/types/variant.ts +72 -0
  112. package/www/build/index.esm.js +0 -0
  113. package/www/build/mds-accordion-timer.esm.js +1 -0
  114. package/www/build/mds-accordion-timer.js +130 -0
  115. package/www/build/p-104355eb.system.entry.js +1 -0
  116. package/www/build/p-2c75936b.entry.js +1 -0
  117. package/www/build/p-50ea2036.system.js +1 -0
  118. package/www/build/p-74539cca.system.js +1 -0
  119. package/www/build/p-a652c8b3.system.js +1 -0
  120. package/www/build/p-ac3fdd27.js +1 -0
  121. package/www/host.config.json +15 -0
@@ -0,0 +1,1017 @@
1
+ 'use strict';
2
+
3
+ function _interopNamespace(e) {
4
+ if (e && e.__esModule) return e;
5
+ var n = Object.create(null);
6
+ if (e) {
7
+ Object.keys(e).forEach(function (k) {
8
+ if (k !== 'default') {
9
+ var d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: function () {
13
+ return e[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n['default'] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ const NAMESPACE = 'mds-accordion-timer';
24
+
25
+ let scopeId;
26
+ let hostTagName;
27
+ let queuePending = false;
28
+ const win = typeof window !== 'undefined' ? window : {};
29
+ const doc = win.document || { head: {} };
30
+ const plt = {
31
+ $flags$: 0,
32
+ $resourcesUrl$: '',
33
+ jmp: (h) => h(),
34
+ raf: (h) => requestAnimationFrame(h),
35
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
36
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
37
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
38
+ };
39
+ const promiseResolve = (v) => Promise.resolve(v);
40
+ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
41
+ try {
42
+ new CSSStyleSheet();
43
+ return typeof new CSSStyleSheet().replace === 'function';
44
+ }
45
+ catch (e) { }
46
+ return false;
47
+ })()
48
+ ;
49
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
50
+ if (listeners) {
51
+ listeners.map(([flags, name, method]) => {
52
+ const target = elm;
53
+ const handler = hostListenerProxy(hostRef, method);
54
+ const opts = hostListenerOpts(flags);
55
+ plt.ael(target, name, handler, opts);
56
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
57
+ });
58
+ }
59
+ };
60
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
61
+ try {
62
+ {
63
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
64
+ // instance is ready, let's call it's member method for this event
65
+ hostRef.$lazyInstance$[methodName](ev);
66
+ }
67
+ else {
68
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
69
+ }
70
+ }
71
+ }
72
+ catch (e) {
73
+ consoleError(e);
74
+ }
75
+ };
76
+ // prettier-ignore
77
+ const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
78
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
79
+ const createTime = (fnName, tagName = '') => {
80
+ {
81
+ return () => {
82
+ return;
83
+ };
84
+ }
85
+ };
86
+ const uniqueTime = (key, measureText) => {
87
+ {
88
+ return () => {
89
+ return;
90
+ };
91
+ }
92
+ };
93
+ const rootAppliedStyles = new WeakMap();
94
+ const registerStyle = (scopeId, cssText, allowCS) => {
95
+ let style = styles.get(scopeId);
96
+ if (supportsConstructibleStylesheets && allowCS) {
97
+ style = (style || new CSSStyleSheet());
98
+ style.replace(cssText);
99
+ }
100
+ else {
101
+ style = cssText;
102
+ }
103
+ styles.set(scopeId, style);
104
+ };
105
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
106
+ let scopeId = getScopeId(cmpMeta);
107
+ let style = styles.get(scopeId);
108
+ // if an element is NOT connected then getRootNode() will return the wrong root node
109
+ // so the fallback is to always use the document for the root node in those cases
110
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
111
+ if (style) {
112
+ if (typeof style === 'string') {
113
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
114
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
115
+ let styleElm;
116
+ if (!appliedStyles) {
117
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
118
+ }
119
+ if (!appliedStyles.has(scopeId)) {
120
+ {
121
+ {
122
+ styleElm = doc.createElement('style');
123
+ styleElm.innerHTML = style;
124
+ }
125
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
126
+ }
127
+ if (appliedStyles) {
128
+ appliedStyles.add(scopeId);
129
+ }
130
+ }
131
+ }
132
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
133
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
134
+ }
135
+ }
136
+ return scopeId;
137
+ };
138
+ const attachStyles = (hostRef) => {
139
+ const cmpMeta = hostRef.$cmpMeta$;
140
+ const elm = hostRef.$hostElement$;
141
+ const flags = cmpMeta.$flags$;
142
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
143
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
144
+ if (flags & 10 /* needsScopedEncapsulation */) {
145
+ // only required when we're NOT using native shadow dom (slot)
146
+ // or this browser doesn't support native shadow dom
147
+ // and this host element was NOT created with SSR
148
+ // let's pick out the inner content for slot projection
149
+ // create a node to represent where the original
150
+ // content was first placed, which is useful later on
151
+ // DOM WRITE!!
152
+ elm['s-sc'] = scopeId;
153
+ elm.classList.add(scopeId + '-h');
154
+ }
155
+ endAttachStyles();
156
+ };
157
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
158
+ const isDef = (v) => v != null;
159
+ const isComplexType = (o) => {
160
+ // https://jsperf.com/typeof-fn-object/5
161
+ o = typeof o;
162
+ return o === 'object' || o === 'function';
163
+ };
164
+ /**
165
+ * Production h() function based on Preact by
166
+ * Jason Miller (@developit)
167
+ * Licensed under the MIT License
168
+ * https://github.com/developit/preact/blob/master/LICENSE
169
+ *
170
+ * Modified for Stencil's compiler and vdom
171
+ */
172
+ // const stack: any[] = [];
173
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
174
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
175
+ const h = (nodeName, vnodeData, ...children) => {
176
+ let child = null;
177
+ let simple = false;
178
+ let lastSimple = false;
179
+ let vNodeChildren = [];
180
+ const walk = (c) => {
181
+ for (let i = 0; i < c.length; i++) {
182
+ child = c[i];
183
+ if (Array.isArray(child)) {
184
+ walk(child);
185
+ }
186
+ else if (child != null && typeof child !== 'boolean') {
187
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
188
+ child = String(child);
189
+ }
190
+ if (simple && lastSimple) {
191
+ // If the previous child was simple (string), we merge both
192
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
193
+ }
194
+ else {
195
+ // Append a new vNode, if it's text, we create a text vNode
196
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
197
+ }
198
+ lastSimple = simple;
199
+ }
200
+ }
201
+ };
202
+ walk(children);
203
+ const vnode = newVNode(nodeName, null);
204
+ vnode.$attrs$ = vnodeData;
205
+ if (vNodeChildren.length > 0) {
206
+ vnode.$children$ = vNodeChildren;
207
+ }
208
+ return vnode;
209
+ };
210
+ const newVNode = (tag, text) => {
211
+ const vnode = {
212
+ $flags$: 0,
213
+ $tag$: tag,
214
+ $text$: text,
215
+ $elm$: null,
216
+ $children$: null,
217
+ };
218
+ return vnode;
219
+ };
220
+ const Host = {};
221
+ const isHost = (node) => node && node.$tag$ === Host;
222
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
223
+ // tslint:disable-next-line: prefer-const
224
+ let newVNode = newParentVNode.$children$[childIndex];
225
+ let i = 0;
226
+ let elm;
227
+ let childNode;
228
+ {
229
+ // create element
230
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
231
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
232
+ // if there is a scopeId and this is the initial render
233
+ // then let's add the scopeId as a css class
234
+ elm.classList.add((elm['s-si'] = scopeId));
235
+ }
236
+ if (newVNode.$children$) {
237
+ for (i = 0; i < newVNode.$children$.length; ++i) {
238
+ // create the node
239
+ childNode = createElm(oldParentVNode, newVNode, i);
240
+ // return node could have been null
241
+ if (childNode) {
242
+ // append our new node
243
+ elm.appendChild(childNode);
244
+ }
245
+ }
246
+ }
247
+ }
248
+ return elm;
249
+ };
250
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
251
+ let containerElm = (parentElm);
252
+ let childNode;
253
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
254
+ containerElm = containerElm.shadowRoot;
255
+ }
256
+ for (; startIdx <= endIdx; ++startIdx) {
257
+ if (vnodes[startIdx]) {
258
+ childNode = createElm(null, parentVNode, startIdx);
259
+ if (childNode) {
260
+ vnodes[startIdx].$elm$ = childNode;
261
+ containerElm.insertBefore(childNode, before);
262
+ }
263
+ }
264
+ }
265
+ };
266
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
267
+ for (; startIdx <= endIdx; ++startIdx) {
268
+ if ((vnode = vnodes[startIdx])) {
269
+ elm = vnode.$elm$;
270
+ // remove the vnode's element from the dom
271
+ elm.remove();
272
+ }
273
+ }
274
+ };
275
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
276
+ let oldStartIdx = 0;
277
+ let newStartIdx = 0;
278
+ let oldEndIdx = oldCh.length - 1;
279
+ let oldStartVnode = oldCh[0];
280
+ let oldEndVnode = oldCh[oldEndIdx];
281
+ let newEndIdx = newCh.length - 1;
282
+ let newStartVnode = newCh[0];
283
+ let newEndVnode = newCh[newEndIdx];
284
+ let node;
285
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
286
+ if (oldStartVnode == null) {
287
+ // Vnode might have been moved left
288
+ oldStartVnode = oldCh[++oldStartIdx];
289
+ }
290
+ else if (oldEndVnode == null) {
291
+ oldEndVnode = oldCh[--oldEndIdx];
292
+ }
293
+ else if (newStartVnode == null) {
294
+ newStartVnode = newCh[++newStartIdx];
295
+ }
296
+ else if (newEndVnode == null) {
297
+ newEndVnode = newCh[--newEndIdx];
298
+ }
299
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
300
+ patch(oldStartVnode, newStartVnode);
301
+ oldStartVnode = oldCh[++oldStartIdx];
302
+ newStartVnode = newCh[++newStartIdx];
303
+ }
304
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
305
+ patch(oldEndVnode, newEndVnode);
306
+ oldEndVnode = oldCh[--oldEndIdx];
307
+ newEndVnode = newCh[--newEndIdx];
308
+ }
309
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
310
+ patch(oldStartVnode, newEndVnode);
311
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
312
+ oldStartVnode = oldCh[++oldStartIdx];
313
+ newEndVnode = newCh[--newEndIdx];
314
+ }
315
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
316
+ patch(oldEndVnode, newStartVnode);
317
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
318
+ oldEndVnode = oldCh[--oldEndIdx];
319
+ newStartVnode = newCh[++newStartIdx];
320
+ }
321
+ else {
322
+ {
323
+ // new element
324
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
325
+ newStartVnode = newCh[++newStartIdx];
326
+ }
327
+ if (node) {
328
+ {
329
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
330
+ }
331
+ }
332
+ }
333
+ }
334
+ if (oldStartIdx > oldEndIdx) {
335
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
336
+ }
337
+ else if (newStartIdx > newEndIdx) {
338
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
339
+ }
340
+ };
341
+ const isSameVnode = (vnode1, vnode2) => {
342
+ // compare if two vnode to see if they're "technically" the same
343
+ // need to have the same element tag, and same key to be the same
344
+ if (vnode1.$tag$ === vnode2.$tag$) {
345
+ return true;
346
+ }
347
+ return false;
348
+ };
349
+ const patch = (oldVNode, newVNode) => {
350
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
351
+ const oldChildren = oldVNode.$children$;
352
+ const newChildren = newVNode.$children$;
353
+ {
354
+ if (oldChildren !== null && newChildren !== null) {
355
+ // looks like there's child vnodes for both the old and new vnodes
356
+ updateChildren(elm, oldChildren, newVNode, newChildren);
357
+ }
358
+ else if (newChildren !== null) {
359
+ // add the new vnode children
360
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
361
+ }
362
+ else if (oldChildren !== null) {
363
+ // no new child vnodes, but there are old child vnodes to remove
364
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
365
+ }
366
+ }
367
+ };
368
+ const renderVdom = (hostRef, renderFnResults) => {
369
+ const hostElm = hostRef.$hostElement$;
370
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
371
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
372
+ hostTagName = hostElm.tagName;
373
+ rootVnode.$tag$ = null;
374
+ rootVnode.$flags$ |= 4 /* isHost */;
375
+ hostRef.$vnode$ = rootVnode;
376
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
377
+ {
378
+ scopeId = hostElm['s-sc'];
379
+ }
380
+ // synchronous patch
381
+ patch(oldVNode, rootVnode);
382
+ };
383
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
384
+ const createEvent = (ref, name, flags) => {
385
+ const elm = getElement(ref);
386
+ return {
387
+ emit: (detail) => {
388
+ return emitEvent(elm, name, {
389
+ bubbles: !!(flags & 4 /* Bubbles */),
390
+ composed: !!(flags & 2 /* Composed */),
391
+ cancelable: !!(flags & 1 /* Cancellable */),
392
+ detail,
393
+ });
394
+ },
395
+ };
396
+ };
397
+ /**
398
+ * Helper function to create & dispatch a custom Event on a provided target
399
+ * @param elm the target of the Event
400
+ * @param name the name to give the custom Event
401
+ * @param opts options for configuring a custom Event
402
+ * @returns the custom Event
403
+ */
404
+ const emitEvent = (elm, name, opts) => {
405
+ const ev = plt.ce(name, opts);
406
+ elm.dispatchEvent(ev);
407
+ return ev;
408
+ };
409
+ const attachToAncestor = (hostRef, ancestorComponent) => {
410
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
411
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
412
+ }
413
+ };
414
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
415
+ {
416
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
417
+ }
418
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
419
+ hostRef.$flags$ |= 512 /* needsRerender */;
420
+ return;
421
+ }
422
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
423
+ // there is no ancestor component or the ancestor component
424
+ // has already fired off its lifecycle update then
425
+ // fire off the initial update
426
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
427
+ return writeTask(dispatch) ;
428
+ };
429
+ const dispatchHooks = (hostRef, isInitialLoad) => {
430
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
431
+ const instance = hostRef.$lazyInstance$ ;
432
+ let promise;
433
+ if (isInitialLoad) {
434
+ {
435
+ hostRef.$flags$ |= 256 /* isListenReady */;
436
+ if (hostRef.$queuedListeners$) {
437
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
438
+ hostRef.$queuedListeners$ = null;
439
+ }
440
+ }
441
+ }
442
+ endSchedule();
443
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
444
+ };
445
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
446
+ // updateComponent
447
+ const elm = hostRef.$hostElement$;
448
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
449
+ const rc = elm['s-rc'];
450
+ if (isInitialLoad) {
451
+ // DOM WRITE!
452
+ attachStyles(hostRef);
453
+ }
454
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
455
+ {
456
+ callRender(hostRef, instance);
457
+ }
458
+ if (rc) {
459
+ // ok, so turns out there are some child host elements
460
+ // waiting on this parent element to load
461
+ // let's fire off all update callbacks waiting
462
+ rc.map((cb) => cb());
463
+ elm['s-rc'] = undefined;
464
+ }
465
+ endRender();
466
+ endUpdate();
467
+ {
468
+ const childrenPromises = elm['s-p'];
469
+ const postUpdate = () => postUpdateComponent(hostRef);
470
+ if (childrenPromises.length === 0) {
471
+ postUpdate();
472
+ }
473
+ else {
474
+ Promise.all(childrenPromises).then(postUpdate);
475
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
476
+ childrenPromises.length = 0;
477
+ }
478
+ }
479
+ };
480
+ const callRender = (hostRef, instance, elm) => {
481
+ try {
482
+ instance = instance.render() ;
483
+ {
484
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
485
+ }
486
+ {
487
+ hostRef.$flags$ |= 2 /* hasRendered */;
488
+ }
489
+ {
490
+ {
491
+ // looks like we've got child nodes to render into this host element
492
+ // or we need to update the css class/attrs on the host element
493
+ // DOM WRITE!
494
+ {
495
+ renderVdom(hostRef, instance);
496
+ }
497
+ }
498
+ }
499
+ }
500
+ catch (e) {
501
+ consoleError(e, hostRef.$hostElement$);
502
+ }
503
+ return null;
504
+ };
505
+ const postUpdateComponent = (hostRef) => {
506
+ const tagName = hostRef.$cmpMeta$.$tagName$;
507
+ const elm = hostRef.$hostElement$;
508
+ const endPostUpdate = createTime('postUpdate', tagName);
509
+ const instance = hostRef.$lazyInstance$ ;
510
+ const ancestorComponent = hostRef.$ancestorComponent$;
511
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
512
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
513
+ {
514
+ // DOM WRITE!
515
+ addHydratedFlag(elm);
516
+ }
517
+ {
518
+ safeCall(instance, 'componentDidLoad');
519
+ }
520
+ endPostUpdate();
521
+ {
522
+ hostRef.$onReadyResolve$(elm);
523
+ if (!ancestorComponent) {
524
+ appDidLoad();
525
+ }
526
+ }
527
+ }
528
+ else {
529
+ endPostUpdate();
530
+ }
531
+ // load events fire from bottom to top
532
+ // the deepest elements load first then bubbles up
533
+ {
534
+ if (hostRef.$onRenderResolve$) {
535
+ hostRef.$onRenderResolve$();
536
+ hostRef.$onRenderResolve$ = undefined;
537
+ }
538
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
539
+ nextTick(() => scheduleUpdate(hostRef, false));
540
+ }
541
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
542
+ }
543
+ // ( •_•)
544
+ // ( •_•)>⌐■-■
545
+ // (⌐■_■)
546
+ };
547
+ const appDidLoad = (who) => {
548
+ // on appload
549
+ // we have finish the first big initial render
550
+ {
551
+ addHydratedFlag(doc.documentElement);
552
+ }
553
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
554
+ };
555
+ const safeCall = (instance, method, arg) => {
556
+ if (instance && instance[method]) {
557
+ try {
558
+ return instance[method](arg);
559
+ }
560
+ catch (e) {
561
+ consoleError(e);
562
+ }
563
+ }
564
+ return undefined;
565
+ };
566
+ const then = (promise, thenFn) => {
567
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
568
+ };
569
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
570
+ ;
571
+ const parsePropertyValue = (propValue, propType) => {
572
+ // ensure this value is of the correct prop type
573
+ if (propValue != null && !isComplexType(propValue)) {
574
+ if (propType & 2 /* Number */) {
575
+ // force it to be a number
576
+ return parseFloat(propValue);
577
+ }
578
+ // redundant return here for better minification
579
+ return propValue;
580
+ }
581
+ // not sure exactly what type we want
582
+ // so no need to change to a different type
583
+ return propValue;
584
+ };
585
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
586
+ const setValue = (ref, propName, newVal, cmpMeta) => {
587
+ // check our new property value against our internal value
588
+ const hostRef = getHostRef(ref);
589
+ const oldVal = hostRef.$instanceValues$.get(propName);
590
+ const flags = hostRef.$flags$;
591
+ const instance = hostRef.$lazyInstance$ ;
592
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
593
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
594
+ // gadzooks! the property's value has changed!!
595
+ // set our new value!
596
+ hostRef.$instanceValues$.set(propName, newVal);
597
+ if (instance) {
598
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
599
+ // looks like this value actually changed, so we've got work to do!
600
+ // but only if we've already rendered, otherwise just chill out
601
+ // queue that we need to do an update, but don't worry about queuing
602
+ // up millions cuz this function ensures it only runs once
603
+ scheduleUpdate(hostRef, false);
604
+ }
605
+ }
606
+ }
607
+ };
608
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
609
+ if (cmpMeta.$members$) {
610
+ // It's better to have a const than two Object.entries()
611
+ const members = Object.entries(cmpMeta.$members$);
612
+ const prototype = Cstr.prototype;
613
+ members.map(([memberName, [memberFlags]]) => {
614
+ if ((memberFlags & 31 /* Prop */ ||
615
+ ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
616
+ // proxyComponent - prop
617
+ Object.defineProperty(prototype, memberName, {
618
+ get() {
619
+ // proxyComponent, get value
620
+ return getValue(this, memberName);
621
+ },
622
+ set(newValue) {
623
+ // proxyComponent, set value
624
+ setValue(this, memberName, newValue, cmpMeta);
625
+ },
626
+ configurable: true,
627
+ enumerable: true,
628
+ });
629
+ }
630
+ });
631
+ if ((flags & 1 /* isElementConstructor */)) {
632
+ const attrNameToPropName = new Map();
633
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
634
+ plt.jmp(() => {
635
+ const propName = attrNameToPropName.get(attrName);
636
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
637
+ // in the case where an attribute was set inline.
638
+ // ```html
639
+ // <my-component some-attribute="some-value"></my-component>
640
+ // ```
641
+ //
642
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
643
+ // programmatically changes it before it has been upgraded as shown below:
644
+ //
645
+ // ```html
646
+ // <!-- this component has _not_ been upgraded yet -->
647
+ // <my-component id="test" some-attribute="some-value"></my-component>
648
+ // <script>
649
+ // // grab non-upgraded component
650
+ // el = document.querySelector("#test");
651
+ // el.someAttribute = "another-value";
652
+ // // upgrade component
653
+ // customElements.define('my-component', MyComponent);
654
+ // </script>
655
+ // ```
656
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
657
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
658
+ // to the value that was set inline i.e. "some-value" from above example. When
659
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
660
+ //
661
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
662
+ // by connectedCallback as this attributeChangedCallback will not fire.
663
+ //
664
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
665
+ //
666
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
667
+ // properties here given that this goes against best practices outlined here
668
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
669
+ if (this.hasOwnProperty(propName)) {
670
+ newValue = this[propName];
671
+ delete this[propName];
672
+ }
673
+ else if (prototype.hasOwnProperty(propName) &&
674
+ typeof this[propName] === 'number' &&
675
+ this[propName] == newValue) {
676
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
677
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
678
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
679
+ return;
680
+ }
681
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
682
+ });
683
+ };
684
+ // create an array of attributes to observe
685
+ // and also create a map of html attribute name to js property name
686
+ Cstr.observedAttributes = members
687
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
688
+ .map(([propName, m]) => {
689
+ const attrName = m[1] || propName;
690
+ attrNameToPropName.set(attrName, propName);
691
+ return attrName;
692
+ });
693
+ }
694
+ }
695
+ return Cstr;
696
+ };
697
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
698
+ // initializeComponent
699
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
700
+ {
701
+ // we haven't initialized this element yet
702
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
703
+ // lazy loaded components
704
+ // request the component's implementation to be
705
+ // wired up with the host element
706
+ Cstr = loadModule(cmpMeta);
707
+ if (Cstr.then) {
708
+ // Await creates a micro-task avoid if possible
709
+ const endLoad = uniqueTime();
710
+ Cstr = await Cstr;
711
+ endLoad();
712
+ }
713
+ if (!Cstr.isProxied) {
714
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
715
+ Cstr.isProxied = true;
716
+ }
717
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
718
+ // ok, time to construct the instance
719
+ // but let's keep track of when we start and stop
720
+ // so that the getters/setters don't incorrectly step on data
721
+ {
722
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
723
+ }
724
+ // construct the lazy-loaded component implementation
725
+ // passing the hostRef is very important during
726
+ // construction in order to directly wire together the
727
+ // host element and the lazy-loaded instance
728
+ try {
729
+ new Cstr(hostRef);
730
+ }
731
+ catch (e) {
732
+ consoleError(e);
733
+ }
734
+ {
735
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
736
+ }
737
+ endNewInstance();
738
+ fireConnectedCallback(hostRef.$lazyInstance$);
739
+ }
740
+ if (Cstr.style) {
741
+ // this component has styles but we haven't registered them yet
742
+ let style = Cstr.style;
743
+ const scopeId = getScopeId(cmpMeta);
744
+ if (!styles.has(scopeId)) {
745
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
746
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
747
+ endRegisterStyles();
748
+ }
749
+ }
750
+ }
751
+ // we've successfully created a lazy instance
752
+ const ancestorComponent = hostRef.$ancestorComponent$;
753
+ const schedule = () => scheduleUpdate(hostRef, true);
754
+ if (ancestorComponent && ancestorComponent['s-rc']) {
755
+ // this is the initial load and this component it has an ancestor component
756
+ // but the ancestor component has NOT fired its will update lifecycle yet
757
+ // so let's just cool our jets and wait for the ancestor to continue first
758
+ // this will get fired off when the ancestor component
759
+ // finally gets around to rendering its lazy self
760
+ // fire off the initial update
761
+ ancestorComponent['s-rc'].push(schedule);
762
+ }
763
+ else {
764
+ schedule();
765
+ }
766
+ };
767
+ const fireConnectedCallback = (instance) => {
768
+ {
769
+ safeCall(instance, 'connectedCallback');
770
+ }
771
+ };
772
+ const connectedCallback = (elm) => {
773
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
774
+ const hostRef = getHostRef(elm);
775
+ const cmpMeta = hostRef.$cmpMeta$;
776
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
777
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
778
+ // first time this component has connected
779
+ hostRef.$flags$ |= 1 /* hasConnected */;
780
+ {
781
+ // find the first ancestor component (if there is one) and register
782
+ // this component as one of the actively loading child components for its ancestor
783
+ let ancestorComponent = elm;
784
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
785
+ // climb up the ancestors looking for the first
786
+ // component that hasn't finished its lifecycle update yet
787
+ if (ancestorComponent['s-p']) {
788
+ // we found this components first ancestor component
789
+ // keep a reference to this component's ancestor component
790
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
791
+ break;
792
+ }
793
+ }
794
+ }
795
+ // Lazy properties
796
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
797
+ if (cmpMeta.$members$) {
798
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
799
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
800
+ const value = elm[memberName];
801
+ delete elm[memberName];
802
+ elm[memberName] = value;
803
+ }
804
+ });
805
+ }
806
+ {
807
+ initializeComponent(elm, hostRef, cmpMeta);
808
+ }
809
+ }
810
+ else {
811
+ // not the first time this has connected
812
+ // reattach any event listeners to the host
813
+ // since they would have been removed when disconnected
814
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
815
+ // fire off connectedCallback() on component instance
816
+ fireConnectedCallback(hostRef.$lazyInstance$);
817
+ }
818
+ endConnected();
819
+ }
820
+ };
821
+ const disconnectedCallback = (elm) => {
822
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
823
+ const hostRef = getHostRef(elm);
824
+ const instance = hostRef.$lazyInstance$ ;
825
+ {
826
+ if (hostRef.$rmListeners$) {
827
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
828
+ hostRef.$rmListeners$ = undefined;
829
+ }
830
+ }
831
+ {
832
+ safeCall(instance, 'disconnectedCallback');
833
+ }
834
+ }
835
+ };
836
+ const bootstrapLazy = (lazyBundles, options = {}) => {
837
+ const endBootstrap = createTime();
838
+ const cmpTags = [];
839
+ const exclude = options.exclude || [];
840
+ const customElements = win.customElements;
841
+ const head = doc.head;
842
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
843
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
844
+ const deferredConnectedCallbacks = [];
845
+ let appLoadFallback;
846
+ let isBootstrapping = true;
847
+ Object.assign(plt, options);
848
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
849
+ lazyBundles.map((lazyBundle) => {
850
+ lazyBundle[1].map((compactMeta) => {
851
+ const cmpMeta = {
852
+ $flags$: compactMeta[0],
853
+ $tagName$: compactMeta[1],
854
+ $members$: compactMeta[2],
855
+ $listeners$: compactMeta[3],
856
+ };
857
+ {
858
+ cmpMeta.$members$ = compactMeta[2];
859
+ }
860
+ {
861
+ cmpMeta.$listeners$ = compactMeta[3];
862
+ }
863
+ const tagName = cmpMeta.$tagName$;
864
+ const HostElement = class extends HTMLElement {
865
+ // StencilLazyHost
866
+ constructor(self) {
867
+ // @ts-ignore
868
+ super(self);
869
+ self = this;
870
+ registerHost(self, cmpMeta);
871
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
872
+ // this component is using shadow dom
873
+ // and this browser supports shadow dom
874
+ // add the read-only property "shadowRoot" to the host element
875
+ // adding the shadow root build conditionals to minimize runtime
876
+ {
877
+ {
878
+ self.attachShadow({ mode: 'open' });
879
+ }
880
+ }
881
+ }
882
+ }
883
+ connectedCallback() {
884
+ if (appLoadFallback) {
885
+ clearTimeout(appLoadFallback);
886
+ appLoadFallback = null;
887
+ }
888
+ if (isBootstrapping) {
889
+ // connectedCallback will be processed once all components have been registered
890
+ deferredConnectedCallbacks.push(this);
891
+ }
892
+ else {
893
+ plt.jmp(() => connectedCallback(this));
894
+ }
895
+ }
896
+ disconnectedCallback() {
897
+ plt.jmp(() => disconnectedCallback(this));
898
+ }
899
+ componentOnReady() {
900
+ return getHostRef(this).$onReadyPromise$;
901
+ }
902
+ };
903
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
904
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
905
+ cmpTags.push(tagName);
906
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
907
+ }
908
+ });
909
+ });
910
+ {
911
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
912
+ visibilityStyle.setAttribute('data-styles', '');
913
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
914
+ }
915
+ // Process deferred connectedCallbacks now all components have been registered
916
+ isBootstrapping = false;
917
+ if (deferredConnectedCallbacks.length) {
918
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
919
+ }
920
+ else {
921
+ {
922
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
923
+ }
924
+ }
925
+ // Fallback appLoad event
926
+ endBootstrap();
927
+ };
928
+ const hostRefs = new WeakMap();
929
+ const getHostRef = (ref) => hostRefs.get(ref);
930
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
931
+ const registerHost = (elm, cmpMeta) => {
932
+ const hostRef = {
933
+ $flags$: 0,
934
+ $hostElement$: elm,
935
+ $cmpMeta$: cmpMeta,
936
+ $instanceValues$: new Map(),
937
+ };
938
+ {
939
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
940
+ elm['s-p'] = [];
941
+ elm['s-rc'] = [];
942
+ }
943
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
944
+ return hostRefs.set(elm, hostRef);
945
+ };
946
+ const consoleError = (e, el) => (0, console.error)(e, el);
947
+ const cmpModules = /*@__PURE__*/ new Map();
948
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
949
+ // loadModuleImport
950
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
951
+ const bundleId = cmpMeta.$lazyBundleId$;
952
+ const module = cmpModules.get(bundleId) ;
953
+ if (module) {
954
+ return module[exportName];
955
+ }
956
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
957
+ /* webpackInclude: /\.entry\.js$/ */
958
+ /* webpackExclude: /\.system\.entry\.js$/ */
959
+ /* webpackMode: "lazy" */
960
+ `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
961
+ {
962
+ cmpModules.set(bundleId, importedModule);
963
+ }
964
+ return importedModule[exportName];
965
+ }, consoleError);
966
+ };
967
+ const styles = new Map();
968
+ const queueDomReads = [];
969
+ const queueDomWrites = [];
970
+ const queueTask = (queue, write) => (cb) => {
971
+ queue.push(cb);
972
+ if (!queuePending) {
973
+ queuePending = true;
974
+ if (write && plt.$flags$ & 4 /* queueSync */) {
975
+ nextTick(flush);
976
+ }
977
+ else {
978
+ plt.raf(flush);
979
+ }
980
+ }
981
+ };
982
+ const consume = (queue) => {
983
+ for (let i = 0; i < queue.length; i++) {
984
+ try {
985
+ queue[i](performance.now());
986
+ }
987
+ catch (e) {
988
+ consoleError(e);
989
+ }
990
+ }
991
+ queue.length = 0;
992
+ };
993
+ const flush = () => {
994
+ // always force a bunch of medium callbacks to run, but still have
995
+ // a throttle on how many can run in a certain time
996
+ // DOM READS!!!
997
+ consume(queueDomReads);
998
+ // DOM WRITES!!!
999
+ {
1000
+ consume(queueDomWrites);
1001
+ if ((queuePending = queueDomReads.length > 0)) {
1002
+ // still more to do yet, but we've run out of time
1003
+ // let's let this thing cool off and try again in the next tick
1004
+ plt.raf(flush);
1005
+ }
1006
+ }
1007
+ };
1008
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1009
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1010
+
1011
+ exports.Host = Host;
1012
+ exports.bootstrapLazy = bootstrapLazy;
1013
+ exports.createEvent = createEvent;
1014
+ exports.getElement = getElement;
1015
+ exports.h = h;
1016
+ exports.promiseResolve = promiseResolve;
1017
+ exports.registerInstance = registerInstance;