proto-tinker-wc 0.0.1

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