@everymatrix/casino-engagement-suite-modal 1.44.0 → 1.45.2

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