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