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