@everymatrix/blog-article-details 1.31.2 → 1.32.4

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