proto-daisy-ui 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/dist/cjs/dealers-a8306eb8.js +15 -0
  4. package/dist/cjs/index-b1631310.js +1219 -0
  5. package/dist/cjs/index.cjs.js +2 -0
  6. package/dist/cjs/loader.cjs.js +21 -0
  7. package/dist/cjs/proto-button-d349703f.js +9 -0
  8. package/dist/cjs/proto-daisy-ui.cjs.entry.js +25 -0
  9. package/dist/cjs/proto-daisy-ui.cjs.js +19 -0
  10. package/dist/cjs/proto-demo.cjs.entry.js +20 -0
  11. package/dist/cjs/proto-hero.cjs.entry.js +21 -0
  12. package/dist/cjs/proto-home.cjs.entry.js +24 -0
  13. package/dist/cjs/proto-list.cjs.entry.js +58 -0
  14. package/dist/cjs/proto-shell.cjs.entry.js +120 -0
  15. package/dist/cjs/store-74bb495b.js +332 -0
  16. package/dist/collection/collection-manifest.json +17 -0
  17. package/dist/collection/components/functional/index.js +1 -0
  18. package/dist/collection/components/functional/proto-button.js +6 -0
  19. package/dist/collection/components/proto-daisy-ui/proto-daisy-ui.css +2023 -0
  20. package/dist/collection/components/proto-daisy-ui/proto-daisy-ui.js +20 -0
  21. package/dist/collection/components/proto-demo/proto-demo.css +0 -0
  22. package/dist/collection/components/proto-demo/proto-demo.js +14 -0
  23. package/dist/collection/components/proto-hero/proto-hero.css +3 -0
  24. package/dist/collection/components/proto-hero/proto-hero.js +43 -0
  25. package/dist/collection/components/proto-home/proto-home.css +0 -0
  26. package/dist/collection/components/proto-home/proto-home.js +26 -0
  27. package/dist/collection/components/proto-list/proto-list.css +0 -0
  28. package/dist/collection/components/proto-list/proto-list.js +64 -0
  29. package/dist/collection/components/proto-shell/proto-footer.js +20 -0
  30. package/dist/collection/components/proto-shell/proto-header.js +81 -0
  31. package/dist/collection/components/proto-shell/proto-shell.css +3 -0
  32. package/dist/collection/components/proto-shell/proto-shell.js +47 -0
  33. package/dist/collection/index.js +1 -0
  34. package/dist/collection/utils/bag.js +23 -0
  35. package/dist/collection/utils/dealers.js +13 -0
  36. package/dist/collection/utils/index.js +5 -0
  37. package/dist/collection/utils/store.js +115 -0
  38. package/dist/collection/utils/tw-version.js +4 -0
  39. package/dist/collection/utils/types.js +1 -0
  40. package/dist/components/dealers.js +13 -0
  41. package/dist/components/index.d.ts +27 -0
  42. package/dist/components/index.js +7 -0
  43. package/dist/components/proto-button.js +7 -0
  44. package/dist/components/proto-daisy-ui.d.ts +11 -0
  45. package/dist/components/proto-daisy-ui.js +39 -0
  46. package/dist/components/proto-demo.d.ts +11 -0
  47. package/dist/components/proto-demo.js +33 -0
  48. package/dist/components/proto-hero.d.ts +11 -0
  49. package/dist/components/proto-hero.js +36 -0
  50. package/dist/components/proto-home.d.ts +11 -0
  51. package/dist/components/proto-home.js +37 -0
  52. package/dist/components/proto-list.d.ts +11 -0
  53. package/dist/components/proto-list.js +71 -0
  54. package/dist/components/proto-shell.d.ts +11 -0
  55. package/dist/components/proto-shell.js +135 -0
  56. package/dist/components/store.js +329 -0
  57. package/dist/esm/dealers-752f9914.js +13 -0
  58. package/dist/esm/index-832d1e38.js +1192 -0
  59. package/dist/esm/index.js +1 -0
  60. package/dist/esm/loader.js +17 -0
  61. package/dist/esm/polyfills/core-js.js +11 -0
  62. package/dist/esm/polyfills/css-shim.js +1 -0
  63. package/dist/esm/polyfills/dom.js +79 -0
  64. package/dist/esm/polyfills/es5-html-element.js +1 -0
  65. package/dist/esm/polyfills/index.js +34 -0
  66. package/dist/esm/polyfills/system.js +6 -0
  67. package/dist/esm/proto-button-c929a8fb.js +7 -0
  68. package/dist/esm/proto-daisy-ui.entry.js +21 -0
  69. package/dist/esm/proto-daisy-ui.js +17 -0
  70. package/dist/esm/proto-demo.entry.js +16 -0
  71. package/dist/esm/proto-hero.entry.js +17 -0
  72. package/dist/esm/proto-home.entry.js +20 -0
  73. package/dist/esm/proto-list.entry.js +54 -0
  74. package/dist/esm/proto-shell.entry.js +116 -0
  75. package/dist/esm/store-6cbf6338.js +329 -0
  76. package/dist/index.cjs.js +1 -0
  77. package/dist/index.js +1 -0
  78. package/dist/proto-daisy-ui/index.esm.js +0 -0
  79. package/dist/proto-daisy-ui/p-0cbc124a.js +1 -0
  80. package/dist/proto-daisy-ui/p-4c1c4093.entry.js +1 -0
  81. package/dist/proto-daisy-ui/p-78473e80.js +1 -0
  82. package/dist/proto-daisy-ui/p-82c6ae5e.entry.js +1 -0
  83. package/dist/proto-daisy-ui/p-98b063cb.js +1 -0
  84. package/dist/proto-daisy-ui/p-bba460f2.entry.js +1 -0
  85. package/dist/proto-daisy-ui/p-d7d5a047.entry.js +1 -0
  86. package/dist/proto-daisy-ui/p-e274e36c.entry.js +1 -0
  87. package/dist/proto-daisy-ui/p-eeb6284e.entry.js +1 -0
  88. package/dist/proto-daisy-ui/p-f445bcf9.js +2 -0
  89. package/dist/proto-daisy-ui/proto-daisy-ui.esm.js +1 -0
  90. package/dist/types/components/functional/index.d.ts +1 -0
  91. package/dist/types/components/functional/proto-button.d.ts +4 -0
  92. package/dist/types/components/proto-daisy-ui/proto-daisy-ui.d.ts +4 -0
  93. package/dist/types/components/proto-demo/proto-demo.d.ts +3 -0
  94. package/dist/types/components/proto-hero/proto-hero.d.ts +4 -0
  95. package/dist/types/components/proto-home/proto-home.d.ts +3 -0
  96. package/dist/types/components/proto-list/proto-list.d.ts +3 -0
  97. package/dist/types/components/proto-shell/proto-footer.d.ts +4 -0
  98. package/dist/types/components/proto-shell/proto-header.d.ts +4 -0
  99. package/dist/types/components/proto-shell/proto-shell.d.ts +4 -0
  100. package/dist/types/components.d.ts +106 -0
  101. package/dist/types/index.d.ts +1 -0
  102. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  103. package/dist/types/utils/bag.d.ts +10 -0
  104. package/dist/types/utils/dealers.d.ts +6 -0
  105. package/dist/types/utils/index.d.ts +5 -0
  106. package/dist/types/utils/store.d.ts +12 -0
  107. package/dist/types/utils/tw-version.d.ts +3 -0
  108. package/dist/types/utils/types.d.ts +8 -0
  109. package/loader/cdn.js +3 -0
  110. package/loader/index.cjs.js +3 -0
  111. package/loader/index.d.ts +12 -0
  112. package/loader/index.es2017.js +3 -0
  113. package/loader/index.js +4 -0
  114. package/loader/package.json +10 -0
  115. package/package.json +53 -0
@@ -0,0 +1,1219 @@
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-daisy-ui';
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
+ const 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
+ const 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
+ const 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
+ const 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 instance = hostRef.$lazyInstance$ ;
699
+ const ancestorComponent = hostRef.$ancestorComponent$;
700
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
701
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
702
+ {
703
+ // DOM WRITE!
704
+ addHydratedFlag(elm);
705
+ }
706
+ {
707
+ safeCall(instance, 'componentDidLoad');
708
+ }
709
+ endPostUpdate();
710
+ {
711
+ hostRef.$onReadyResolve$(elm);
712
+ if (!ancestorComponent) {
713
+ appDidLoad();
714
+ }
715
+ }
716
+ }
717
+ else {
718
+ endPostUpdate();
719
+ }
720
+ // load events fire from bottom to top
721
+ // the deepest elements load first then bubbles up
722
+ {
723
+ if (hostRef.$onRenderResolve$) {
724
+ hostRef.$onRenderResolve$();
725
+ hostRef.$onRenderResolve$ = undefined;
726
+ }
727
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
728
+ nextTick(() => scheduleUpdate(hostRef, false));
729
+ }
730
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
731
+ }
732
+ // ( •_•)
733
+ // ( •_•)>⌐■-■
734
+ // (⌐■_■)
735
+ };
736
+ const forceUpdate = (ref) => {
737
+ {
738
+ const hostRef = getHostRef(ref);
739
+ const isConnected = hostRef.$hostElement$.isConnected;
740
+ if (isConnected &&
741
+ (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
742
+ scheduleUpdate(hostRef, false);
743
+ }
744
+ // Returns "true" when the forced update was successfully scheduled
745
+ return isConnected;
746
+ }
747
+ };
748
+ const appDidLoad = (who) => {
749
+ // on appload
750
+ // we have finish the first big initial render
751
+ {
752
+ addHydratedFlag(doc.documentElement);
753
+ }
754
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
755
+ };
756
+ const safeCall = (instance, method, arg) => {
757
+ if (instance && instance[method]) {
758
+ try {
759
+ return instance[method](arg);
760
+ }
761
+ catch (e) {
762
+ consoleError(e);
763
+ }
764
+ }
765
+ return undefined;
766
+ };
767
+ const then = (promise, thenFn) => {
768
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
769
+ };
770
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
771
+ ;
772
+ /**
773
+ * Parse a new property value for a given property type.
774
+ *
775
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
776
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
777
+ * 1. `any`, the type given to `propValue` in the function signature
778
+ * 2. the type stored from `propType`.
779
+ *
780
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
781
+ *
782
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
783
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
784
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
785
+ * ```tsx
786
+ * <my-cmp prop-val={0}></my-cmp>
787
+ * ```
788
+ *
789
+ * HTML prop values on the other hand, will always a string
790
+ *
791
+ * @param propValue the new value to coerce to some type
792
+ * @param propType the type of the prop, expressed as a binary number
793
+ * @returns the parsed/coerced value
794
+ */
795
+ const parsePropertyValue = (propValue, propType) => {
796
+ // ensure this value is of the correct prop type
797
+ if (propValue != null && !isComplexType(propValue)) {
798
+ if (propType & 1 /* String */) {
799
+ // could have been passed as a number or boolean
800
+ // but we still want it as a string
801
+ return String(propValue);
802
+ }
803
+ // redundant return here for better minification
804
+ return propValue;
805
+ }
806
+ // not sure exactly what type we want
807
+ // so no need to change to a different type
808
+ return propValue;
809
+ };
810
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
811
+ const setValue = (ref, propName, newVal, cmpMeta) => {
812
+ // check our new property value against our internal value
813
+ const hostRef = getHostRef(ref);
814
+ const oldVal = hostRef.$instanceValues$.get(propName);
815
+ const flags = hostRef.$flags$;
816
+ const instance = hostRef.$lazyInstance$ ;
817
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
818
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
819
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
820
+ const didValueChange = newVal !== oldVal && !areBothNaN;
821
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
822
+ // gadzooks! the property's value has changed!!
823
+ // set our new value!
824
+ hostRef.$instanceValues$.set(propName, newVal);
825
+ if (instance) {
826
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
827
+ // looks like this value actually changed, so we've got work to do!
828
+ // but only if we've already rendered, otherwise just chill out
829
+ // queue that we need to do an update, but don't worry about queuing
830
+ // up millions cuz this function ensures it only runs once
831
+ scheduleUpdate(hostRef, false);
832
+ }
833
+ }
834
+ }
835
+ };
836
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
837
+ if (cmpMeta.$members$) {
838
+ // It's better to have a const than two Object.entries()
839
+ const members = Object.entries(cmpMeta.$members$);
840
+ const prototype = Cstr.prototype;
841
+ members.map(([memberName, [memberFlags]]) => {
842
+ if ((memberFlags & 31 /* Prop */ ||
843
+ ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
844
+ // proxyComponent - prop
845
+ Object.defineProperty(prototype, memberName, {
846
+ get() {
847
+ // proxyComponent, get value
848
+ return getValue(this, memberName);
849
+ },
850
+ set(newValue) {
851
+ // proxyComponent, set value
852
+ setValue(this, memberName, newValue, cmpMeta);
853
+ },
854
+ configurable: true,
855
+ enumerable: true,
856
+ });
857
+ }
858
+ });
859
+ if ((flags & 1 /* isElementConstructor */)) {
860
+ const attrNameToPropName = new Map();
861
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
862
+ plt.jmp(() => {
863
+ const propName = attrNameToPropName.get(attrName);
864
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
865
+ // in the case where an attribute was set inline.
866
+ // ```html
867
+ // <my-component some-attribute="some-value"></my-component>
868
+ // ```
869
+ //
870
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
871
+ // programmatically changes it before it has been upgraded as shown below:
872
+ //
873
+ // ```html
874
+ // <!-- this component has _not_ been upgraded yet -->
875
+ // <my-component id="test" some-attribute="some-value"></my-component>
876
+ // <script>
877
+ // // grab non-upgraded component
878
+ // el = document.querySelector("#test");
879
+ // el.someAttribute = "another-value";
880
+ // // upgrade component
881
+ // customElements.define('my-component', MyComponent);
882
+ // </script>
883
+ // ```
884
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
885
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
886
+ // to the value that was set inline i.e. "some-value" from above example. When
887
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
888
+ //
889
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
890
+ // by connectedCallback as this attributeChangedCallback will not fire.
891
+ //
892
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
893
+ //
894
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
895
+ // properties here given that this goes against best practices outlined here
896
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
897
+ if (this.hasOwnProperty(propName)) {
898
+ newValue = this[propName];
899
+ delete this[propName];
900
+ }
901
+ else if (prototype.hasOwnProperty(propName) &&
902
+ typeof this[propName] === 'number' &&
903
+ this[propName] == newValue) {
904
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
905
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
906
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
907
+ return;
908
+ }
909
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
910
+ });
911
+ };
912
+ // create an array of attributes to observe
913
+ // and also create a map of html attribute name to js property name
914
+ Cstr.observedAttributes = members
915
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
916
+ .map(([propName, m]) => {
917
+ const attrName = m[1] || propName;
918
+ attrNameToPropName.set(attrName, propName);
919
+ return attrName;
920
+ });
921
+ }
922
+ }
923
+ return Cstr;
924
+ };
925
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
926
+ // initializeComponent
927
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
928
+ {
929
+ // we haven't initialized this element yet
930
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
931
+ // lazy loaded components
932
+ // request the component's implementation to be
933
+ // wired up with the host element
934
+ Cstr = loadModule(cmpMeta);
935
+ if (Cstr.then) {
936
+ // Await creates a micro-task avoid if possible
937
+ const endLoad = uniqueTime();
938
+ Cstr = await Cstr;
939
+ endLoad();
940
+ }
941
+ if (!Cstr.isProxied) {
942
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
943
+ Cstr.isProxied = true;
944
+ }
945
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
946
+ // ok, time to construct the instance
947
+ // but let's keep track of when we start and stop
948
+ // so that the getters/setters don't incorrectly step on data
949
+ {
950
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
951
+ }
952
+ // construct the lazy-loaded component implementation
953
+ // passing the hostRef is very important during
954
+ // construction in order to directly wire together the
955
+ // host element and the lazy-loaded instance
956
+ try {
957
+ new Cstr(hostRef);
958
+ }
959
+ catch (e) {
960
+ consoleError(e);
961
+ }
962
+ {
963
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
964
+ }
965
+ endNewInstance();
966
+ }
967
+ if (Cstr.style) {
968
+ // this component has styles but we haven't registered them yet
969
+ let style = Cstr.style;
970
+ const scopeId = getScopeId(cmpMeta);
971
+ if (!styles.has(scopeId)) {
972
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
973
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
974
+ endRegisterStyles();
975
+ }
976
+ }
977
+ }
978
+ // we've successfully created a lazy instance
979
+ const ancestorComponent = hostRef.$ancestorComponent$;
980
+ const schedule = () => scheduleUpdate(hostRef, true);
981
+ if (ancestorComponent && ancestorComponent['s-rc']) {
982
+ // this is the initial load and this component it has an ancestor component
983
+ // but the ancestor component has NOT fired its will update lifecycle yet
984
+ // so let's just cool our jets and wait for the ancestor to continue first
985
+ // this will get fired off when the ancestor component
986
+ // finally gets around to rendering its lazy self
987
+ // fire off the initial update
988
+ ancestorComponent['s-rc'].push(schedule);
989
+ }
990
+ else {
991
+ schedule();
992
+ }
993
+ };
994
+ const connectedCallback = (elm) => {
995
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
996
+ const hostRef = getHostRef(elm);
997
+ const cmpMeta = hostRef.$cmpMeta$;
998
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
999
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1000
+ // first time this component has connected
1001
+ hostRef.$flags$ |= 1 /* hasConnected */;
1002
+ {
1003
+ // find the first ancestor component (if there is one) and register
1004
+ // this component as one of the actively loading child components for its ancestor
1005
+ let ancestorComponent = elm;
1006
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1007
+ // climb up the ancestors looking for the first
1008
+ // component that hasn't finished its lifecycle update yet
1009
+ if (ancestorComponent['s-p']) {
1010
+ // we found this components first ancestor component
1011
+ // keep a reference to this component's ancestor component
1012
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1013
+ break;
1014
+ }
1015
+ }
1016
+ }
1017
+ // Lazy properties
1018
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1019
+ if (cmpMeta.$members$) {
1020
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1021
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1022
+ const value = elm[memberName];
1023
+ delete elm[memberName];
1024
+ elm[memberName] = value;
1025
+ }
1026
+ });
1027
+ }
1028
+ {
1029
+ initializeComponent(elm, hostRef, cmpMeta);
1030
+ }
1031
+ }
1032
+ endConnected();
1033
+ }
1034
+ };
1035
+ const disconnectedCallback = (elm) => {
1036
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1037
+ getHostRef(elm);
1038
+ }
1039
+ };
1040
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1041
+ const endBootstrap = createTime();
1042
+ const cmpTags = [];
1043
+ const exclude = options.exclude || [];
1044
+ const customElements = win.customElements;
1045
+ const head = doc.head;
1046
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1047
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1048
+ const deferredConnectedCallbacks = [];
1049
+ let appLoadFallback;
1050
+ let isBootstrapping = true;
1051
+ Object.assign(plt, options);
1052
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1053
+ lazyBundles.map((lazyBundle) => {
1054
+ lazyBundle[1].map((compactMeta) => {
1055
+ const cmpMeta = {
1056
+ $flags$: compactMeta[0],
1057
+ $tagName$: compactMeta[1],
1058
+ $members$: compactMeta[2],
1059
+ $listeners$: compactMeta[3],
1060
+ };
1061
+ {
1062
+ cmpMeta.$members$ = compactMeta[2];
1063
+ }
1064
+ const tagName = cmpMeta.$tagName$;
1065
+ const HostElement = class extends HTMLElement {
1066
+ // StencilLazyHost
1067
+ constructor(self) {
1068
+ // @ts-ignore
1069
+ super(self);
1070
+ self = this;
1071
+ registerHost(self, cmpMeta);
1072
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1073
+ // this component is using shadow dom
1074
+ // and this browser supports shadow dom
1075
+ // add the read-only property "shadowRoot" to the host element
1076
+ // adding the shadow root build conditionals to minimize runtime
1077
+ {
1078
+ {
1079
+ self.attachShadow({ mode: 'open' });
1080
+ }
1081
+ }
1082
+ }
1083
+ }
1084
+ connectedCallback() {
1085
+ if (appLoadFallback) {
1086
+ clearTimeout(appLoadFallback);
1087
+ appLoadFallback = null;
1088
+ }
1089
+ if (isBootstrapping) {
1090
+ // connectedCallback will be processed once all components have been registered
1091
+ deferredConnectedCallbacks.push(this);
1092
+ }
1093
+ else {
1094
+ plt.jmp(() => connectedCallback(this));
1095
+ }
1096
+ }
1097
+ disconnectedCallback() {
1098
+ plt.jmp(() => disconnectedCallback(this));
1099
+ }
1100
+ componentOnReady() {
1101
+ return getHostRef(this).$onReadyPromise$;
1102
+ }
1103
+ };
1104
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1105
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1106
+ cmpTags.push(tagName);
1107
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1108
+ }
1109
+ });
1110
+ });
1111
+ {
1112
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1113
+ visibilityStyle.setAttribute('data-styles', '');
1114
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1115
+ }
1116
+ // Process deferred connectedCallbacks now all components have been registered
1117
+ isBootstrapping = false;
1118
+ if (deferredConnectedCallbacks.length) {
1119
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1120
+ }
1121
+ else {
1122
+ {
1123
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1124
+ }
1125
+ }
1126
+ // Fallback appLoad event
1127
+ endBootstrap();
1128
+ };
1129
+ const hostRefs = new WeakMap();
1130
+ const getHostRef = (ref) => hostRefs.get(ref);
1131
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1132
+ const registerHost = (elm, cmpMeta) => {
1133
+ const hostRef = {
1134
+ $flags$: 0,
1135
+ $hostElement$: elm,
1136
+ $cmpMeta$: cmpMeta,
1137
+ $instanceValues$: new Map(),
1138
+ };
1139
+ {
1140
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1141
+ elm['s-p'] = [];
1142
+ elm['s-rc'] = [];
1143
+ }
1144
+ return hostRefs.set(elm, hostRef);
1145
+ };
1146
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1147
+ const consoleError = (e, el) => (0, console.error)(e, el);
1148
+ const cmpModules = /*@__PURE__*/ new Map();
1149
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1150
+ // loadModuleImport
1151
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1152
+ const bundleId = cmpMeta.$lazyBundleId$;
1153
+ const module = cmpModules.get(bundleId) ;
1154
+ if (module) {
1155
+ return module[exportName];
1156
+ }
1157
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1158
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1159
+ /* @vite-ignore */
1160
+ /* webpackInclude: /\.entry\.js$/ */
1161
+ /* webpackExclude: /\.system\.entry\.js$/ */
1162
+ /* webpackMode: "lazy" */
1163
+ `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
1164
+ {
1165
+ cmpModules.set(bundleId, importedModule);
1166
+ }
1167
+ return importedModule[exportName];
1168
+ }, consoleError);
1169
+ };
1170
+ const styles = new Map();
1171
+ const queueDomReads = [];
1172
+ const queueDomWrites = [];
1173
+ const queueTask = (queue, write) => (cb) => {
1174
+ queue.push(cb);
1175
+ if (!queuePending) {
1176
+ queuePending = true;
1177
+ if (write && plt.$flags$ & 4 /* queueSync */) {
1178
+ nextTick(flush);
1179
+ }
1180
+ else {
1181
+ plt.raf(flush);
1182
+ }
1183
+ }
1184
+ };
1185
+ const consume = (queue) => {
1186
+ for (let i = 0; i < queue.length; i++) {
1187
+ try {
1188
+ queue[i](performance.now());
1189
+ }
1190
+ catch (e) {
1191
+ consoleError(e);
1192
+ }
1193
+ }
1194
+ queue.length = 0;
1195
+ };
1196
+ const flush = () => {
1197
+ // always force a bunch of medium callbacks to run, but still have
1198
+ // a throttle on how many can run in a certain time
1199
+ // DOM READS!!!
1200
+ consume(queueDomReads);
1201
+ // DOM WRITES!!!
1202
+ {
1203
+ consume(queueDomWrites);
1204
+ if ((queuePending = queueDomReads.length > 0)) {
1205
+ // still more to do yet, but we've run out of time
1206
+ // let's let this thing cool off and try again in the next tick
1207
+ plt.raf(flush);
1208
+ }
1209
+ }
1210
+ };
1211
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1212
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1213
+
1214
+ exports.bootstrapLazy = bootstrapLazy;
1215
+ exports.forceUpdate = forceUpdate;
1216
+ exports.getRenderingRef = getRenderingRef;
1217
+ exports.h = h;
1218
+ exports.promiseResolve = promiseResolve;
1219
+ exports.registerInstance = registerInstance;