@everymatrix/lottery-ticket-controller 0.1.24 → 1.0.70

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