@everymatrix/helper-filters 1.44.0 → 1.45.2

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