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