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