@everymatrix/player-user-consents 1.43.4 → 1.45.0

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