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