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