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