@everymatrix/general-input 1.10.0

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