@ptcwebops/ptcw-design 0.1.1 → 0.1.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 (143) hide show
  1. package/dist/cjs/icon-asset_5.cjs.entry.js +207 -0
  2. package/dist/{ptcw-design/index-f7043a90.js → cjs/index-ac192914.js} +195 -1311
  3. package/dist/cjs/index.cjs.js +2 -0
  4. package/dist/cjs/list-item.cjs.entry.js +27 -0
  5. package/dist/cjs/loader.cjs.js +21 -0
  6. package/dist/cjs/lottie-player.cjs.entry.js +13476 -0
  7. package/dist/cjs/my-component.cjs.entry.js +26 -0
  8. package/dist/cjs/ptc-card.cjs.entry.js +75 -0
  9. package/dist/cjs/ptc-date.cjs.entry.js +48 -0
  10. package/dist/cjs/ptc-footer.cjs.entry.js +19 -0
  11. package/dist/cjs/ptc-image.cjs.entry.js +58 -0
  12. package/dist/cjs/ptc-img.cjs.entry.js +160 -0
  13. package/dist/cjs/ptc-link.cjs.entry.js +53 -0
  14. package/dist/cjs/ptc-list.cjs.entry.js +32 -0
  15. package/dist/cjs/ptc-lottie.cjs.entry.js +23 -0
  16. package/dist/cjs/ptc-nav-item.cjs.entry.js +94 -0
  17. package/dist/cjs/ptc-nav.cjs.entry.js +19 -0
  18. package/dist/cjs/ptc-overlay.cjs.entry.js +19 -0
  19. package/dist/cjs/ptc-picture.cjs.entry.js +26 -0
  20. package/dist/cjs/ptc-spacer.cjs.entry.js +46 -0
  21. package/dist/cjs/ptc-span.cjs.entry.js +31 -0
  22. package/dist/cjs/ptc-title.cjs.entry.js +49 -0
  23. package/dist/cjs/ptcw-design.cjs.js +19 -0
  24. package/dist/collection/assets/svg-imgs/close.svg +11 -0
  25. package/dist/collection/collection-manifest.json +40 -0
  26. package/dist/collection/components/icon-asset/assets/brands.svg +1381 -0
  27. package/dist/collection/components/icon-asset/assets/footer-social.svg +0 -0
  28. package/dist/collection/components/icon-asset/assets/ptc-sprite.svg +144 -0
  29. package/dist/collection/components/icon-asset/assets/regular.svg +463 -0
  30. package/dist/collection/components/icon-asset/assets/solid.svg +3013 -0
  31. package/dist/collection/components/icon-asset/assets/svg-with-js.min.css +5 -0
  32. package/dist/collection/components/icon-asset/icon-asset.css +30 -0
  33. package/dist/collection/components/icon-asset/icon-asset.js +177 -0
  34. package/dist/collection/components/list-item/list-item.css +3 -0
  35. package/dist/collection/components/list-item/list-item.js +63 -0
  36. package/dist/collection/components/my-component/my-component.css +3 -0
  37. package/dist/collection/components/my-component/my-component.js +74 -0
  38. package/dist/collection/components/ptc-announcement/ptc-announcement.css +87 -0
  39. package/dist/collection/components/ptc-announcement/ptc-announcement.js +127 -0
  40. package/dist/collection/components/ptc-button/ptc-button.css +155 -0
  41. package/dist/collection/components/ptc-button/ptc-button.js +223 -0
  42. package/dist/collection/components/ptc-card/ptc-card.css +239 -0
  43. package/dist/collection/components/ptc-card/ptc-card.js +260 -0
  44. package/dist/collection/components/ptc-date/ptc-date.css +3 -0
  45. package/dist/collection/components/ptc-date/ptc-date.js +155 -0
  46. package/dist/collection/components/ptc-footer/ptc-footer.css +40 -0
  47. package/dist/collection/components/ptc-footer/ptc-footer.js +25 -0
  48. package/dist/collection/components/ptc-image/ptc-image.css +4 -0
  49. package/dist/collection/components/ptc-image/ptc-image.js +92 -0
  50. package/dist/collection/components/ptc-img/ptc-img.css +65 -0
  51. package/dist/collection/components/ptc-img/ptc-img.js +315 -0
  52. package/dist/collection/components/ptc-link/ptc-link.css +168 -0
  53. package/dist/collection/components/ptc-link/ptc-link.js +197 -0
  54. package/dist/collection/components/ptc-list/ptc-list.css +24 -0
  55. package/dist/collection/components/ptc-list/ptc-list.js +66 -0
  56. package/dist/collection/components/ptc-lottie/ptc-lottie.css +5 -0
  57. package/dist/collection/components/ptc-lottie/ptc-lottie.js +58 -0
  58. package/dist/collection/components/ptc-nav/ptc-nav.css +29 -0
  59. package/dist/collection/components/ptc-nav/ptc-nav.js +21 -0
  60. package/dist/collection/components/ptc-nav-item/ptc-nav-item.css +81 -0
  61. package/dist/collection/components/ptc-nav-item/ptc-nav-item.js +252 -0
  62. package/dist/collection/components/ptc-overlay/ptc-overlay.css +3 -0
  63. package/dist/collection/components/ptc-overlay/ptc-overlay.js +14 -0
  64. package/dist/collection/components/ptc-para/ptc-para.css +64 -0
  65. package/dist/collection/components/ptc-para/ptc-para.js +111 -0
  66. package/dist/collection/components/ptc-picture/ptc-picture.css +3 -0
  67. package/dist/collection/components/ptc-picture/ptc-picture.js +44 -0
  68. package/dist/collection/components/ptc-spacer/ptc-spacer.css +307 -0
  69. package/dist/collection/components/ptc-spacer/ptc-spacer.js +99 -0
  70. package/dist/collection/components/ptc-span/ptc-span.css +36 -0
  71. package/dist/collection/components/ptc-span/ptc-span.js +86 -0
  72. package/dist/collection/components/ptc-svg-btn/ptc-svg-btn.css +77 -0
  73. package/dist/collection/components/ptc-svg-btn/ptc-svg-btn.js +34 -0
  74. package/dist/collection/components/ptc-title/ptc-title.css +64 -0
  75. package/dist/collection/components/ptc-title/ptc-title.js +105 -0
  76. package/dist/collection/index.js +1 -0
  77. package/dist/collection/utils/interfaces.js +6 -0
  78. package/dist/collection/utils/utils.js +3 -0
  79. package/dist/custom-elements/index.js +14452 -0
  80. package/dist/{ptcw-design/ptc-announcement.entry.js → esm/icon-asset_5.entry.js} +170 -2
  81. package/dist/esm/index-7a3883ee.js +1687 -0
  82. package/dist/esm/index.js +1 -0
  83. package/dist/{ptcw-design → esm}/list-item.entry.js +1 -1
  84. package/dist/esm/loader.js +17 -0
  85. package/dist/{ptcw-design → esm}/lottie-player.entry.js +31 -782
  86. package/dist/{ptcw-design → esm}/my-component.entry.js +1 -1
  87. package/dist/esm/polyfills/core-js.js +11 -0
  88. package/dist/esm/polyfills/css-shim.js +1 -0
  89. package/dist/esm/polyfills/dom.js +79 -0
  90. package/dist/esm/polyfills/es5-html-element.js +1 -0
  91. package/dist/esm/polyfills/index.js +34 -0
  92. package/dist/esm/polyfills/system.js +6 -0
  93. package/dist/{ptcw-design → esm}/ptc-card.entry.js +1 -1
  94. package/dist/{ptcw-design → esm}/ptc-date.entry.js +1 -1
  95. package/dist/{ptcw-design → esm}/ptc-footer.entry.js +1 -1
  96. package/dist/{ptcw-design → esm}/ptc-image.entry.js +1 -1
  97. package/dist/{ptcw-design → esm}/ptc-img.entry.js +2 -16
  98. package/dist/{ptcw-design → esm}/ptc-link.entry.js +1 -1
  99. package/dist/{ptcw-design → esm}/ptc-list.entry.js +1 -1
  100. package/dist/{ptcw-design → esm}/ptc-lottie.entry.js +1 -1
  101. package/dist/{ptcw-design → esm}/ptc-nav-item.entry.js +1 -1
  102. package/dist/{ptcw-design → esm}/ptc-nav.entry.js +1 -1
  103. package/dist/{ptcw-design → esm}/ptc-overlay.entry.js +1 -1
  104. package/dist/{ptcw-design → esm}/ptc-picture.entry.js +1 -1
  105. package/dist/{ptcw-design → esm}/ptc-spacer.entry.js +1 -1
  106. package/dist/{ptcw-design → esm}/ptc-span.entry.js +1 -1
  107. package/dist/{ptcw-design → esm}/ptc-title.entry.js +1 -1
  108. package/dist/esm/ptcw-design.js +17 -0
  109. package/dist/index.cjs.js +1 -0
  110. package/dist/index.js +1 -0
  111. package/dist/node_modules/@teamhive/lottie-player/dist/collection/components/lottie-player/lottie-player.css +187 -0
  112. package/dist/ptcw-design/index.esm.js +0 -1
  113. package/dist/ptcw-design/p-0c8df906.entry.js +1 -0
  114. package/dist/ptcw-design/p-186beb2c.entry.js +1 -0
  115. package/dist/ptcw-design/p-1df1006b.entry.js +1 -0
  116. package/dist/ptcw-design/p-2d5f8cff.entry.js +1 -0
  117. package/dist/ptcw-design/p-4586b0f5.entry.js +1 -0
  118. package/dist/ptcw-design/p-50923c9a.js +1 -0
  119. package/dist/ptcw-design/p-51a3e9e6.entry.js +1 -0
  120. package/dist/ptcw-design/p-56f6f900.entry.js +1 -0
  121. package/dist/ptcw-design/p-5f776886.entry.js +1 -0
  122. package/dist/ptcw-design/p-66ffa30c.entry.js +1 -0
  123. package/dist/ptcw-design/p-6b1a35e1.entry.js +1 -0
  124. package/dist/ptcw-design/p-796b8287.entry.js +1 -0
  125. package/dist/ptcw-design/p-90402319.entry.js +1 -0
  126. package/dist/ptcw-design/p-919311d2.entry.js +1 -0
  127. package/dist/ptcw-design/p-97a61538.entry.js +1 -0
  128. package/dist/ptcw-design/p-ac449734.entry.js +1 -0
  129. package/dist/ptcw-design/p-d6553853.entry.js +1 -0
  130. package/dist/ptcw-design/p-dddd4d6e.entry.js +1 -0
  131. package/dist/ptcw-design/p-ef250898.entry.js +1 -0
  132. package/dist/ptcw-design/p-f80152dc.entry.js +1 -0
  133. package/dist/ptcw-design/ptcw-design.css +2 -1030
  134. package/dist/ptcw-design/ptcw-design.esm.js +1 -122
  135. package/package.json +2 -2
  136. package/dist/ptcw-design/app-globals-0f993ce5.js +0 -3
  137. package/dist/ptcw-design/css-shim-003e9264.js +0 -4
  138. package/dist/ptcw-design/dom-1b195079.js +0 -73
  139. package/dist/ptcw-design/icon-asset.entry.js +0 -60
  140. package/dist/ptcw-design/ptc-button.entry.js +0 -57
  141. package/dist/ptcw-design/ptc-para.entry.js +0 -36
  142. package/dist/ptcw-design/ptc-svg-btn.entry.js +0 -27
  143. package/dist/ptcw-design/shadow-css-c1ad5fdc.js +0 -383
@@ -0,0 +1,1687 @@
1
+ const NAMESPACE = 'ptcw-design';
2
+
3
+ let scopeId;
4
+ let contentRef;
5
+ let hostTagName;
6
+ let useNativeShadowDom = false;
7
+ let checkSlotFallbackVisibility = false;
8
+ let checkSlotRelocate = false;
9
+ let isSvgMode = false;
10
+ let queuePending = false;
11
+ const win = typeof window !== 'undefined' ? window : {};
12
+ const doc = win.document || { head: {} };
13
+ const plt = {
14
+ $flags$: 0,
15
+ $resourcesUrl$: '',
16
+ jmp: h => h(),
17
+ raf: h => requestAnimationFrame(h),
18
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
19
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
20
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
21
+ };
22
+ const promiseResolve = (v) => Promise.resolve(v);
23
+ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
24
+ try {
25
+ new CSSStyleSheet();
26
+ return typeof (new CSSStyleSheet()).replace === 'function';
27
+ }
28
+ catch (e) { }
29
+ return false;
30
+ })()
31
+ ;
32
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
33
+ if (listeners) {
34
+ listeners.map(([flags, name, method]) => {
35
+ const target = getHostListenerTarget(elm, flags) ;
36
+ const handler = hostListenerProxy(hostRef, method);
37
+ const opts = hostListenerOpts(flags);
38
+ plt.ael(target, name, handler, opts);
39
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
40
+ });
41
+ }
42
+ };
43
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
44
+ try {
45
+ {
46
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
47
+ // instance is ready, let's call it's member method for this event
48
+ hostRef.$lazyInstance$[methodName](ev);
49
+ }
50
+ else {
51
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
52
+ }
53
+ }
54
+ }
55
+ catch (e) {
56
+ consoleError(e);
57
+ }
58
+ };
59
+ const getHostListenerTarget = (elm, flags) => {
60
+ if (flags & 8 /* TargetWindow */)
61
+ return win;
62
+ return elm;
63
+ };
64
+ // prettier-ignore
65
+ const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
66
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
67
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
68
+ const createTime = (fnName, tagName = '') => {
69
+ {
70
+ return () => {
71
+ return;
72
+ };
73
+ }
74
+ };
75
+ const uniqueTime = (key, measureText) => {
76
+ {
77
+ return () => {
78
+ return;
79
+ };
80
+ }
81
+ };
82
+ const rootAppliedStyles = new WeakMap();
83
+ const registerStyle = (scopeId, cssText, allowCS) => {
84
+ let style = styles.get(scopeId);
85
+ if (supportsConstructibleStylesheets && allowCS) {
86
+ style = (style || new CSSStyleSheet());
87
+ style.replace(cssText);
88
+ }
89
+ else {
90
+ style = cssText;
91
+ }
92
+ styles.set(scopeId, style);
93
+ };
94
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
95
+ let scopeId = getScopeId(cmpMeta);
96
+ let style = styles.get(scopeId);
97
+ // if an element is NOT connected then getRootNode() will return the wrong root node
98
+ // so the fallback is to always use the document for the root node in those cases
99
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
100
+ if (style) {
101
+ if (typeof style === 'string') {
102
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
103
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
104
+ let styleElm;
105
+ if (!appliedStyles) {
106
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
107
+ }
108
+ if (!appliedStyles.has(scopeId)) {
109
+ {
110
+ {
111
+ styleElm = doc.createElement('style');
112
+ styleElm.innerHTML = style;
113
+ }
114
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
115
+ }
116
+ if (appliedStyles) {
117
+ appliedStyles.add(scopeId);
118
+ }
119
+ }
120
+ }
121
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
122
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
123
+ }
124
+ }
125
+ return scopeId;
126
+ };
127
+ const attachStyles = (hostRef) => {
128
+ const cmpMeta = hostRef.$cmpMeta$;
129
+ const elm = hostRef.$hostElement$;
130
+ const flags = cmpMeta.$flags$;
131
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
132
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
133
+ if (flags & 10 /* needsScopedEncapsulation */) {
134
+ // only required when we're NOT using native shadow dom (slot)
135
+ // or this browser doesn't support native shadow dom
136
+ // and this host element was NOT created with SSR
137
+ // let's pick out the inner content for slot projection
138
+ // create a node to represent where the original
139
+ // content was first placed, which is useful later on
140
+ // DOM WRITE!!
141
+ elm['s-sc'] = scopeId;
142
+ elm.classList.add(scopeId + '-h');
143
+ }
144
+ endAttachStyles();
145
+ };
146
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
147
+ /**
148
+ * Default style mode id
149
+ */
150
+ /**
151
+ * Reusable empty obj/array
152
+ * Don't add values to these!!
153
+ */
154
+ const EMPTY_OBJ = {};
155
+ /**
156
+ * Namespaces
157
+ */
158
+ const SVG_NS = 'http://www.w3.org/2000/svg';
159
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
160
+ const isDef = (v) => v != null;
161
+ const isComplexType = (o) => {
162
+ // https://jsperf.com/typeof-fn-object/5
163
+ o = typeof o;
164
+ return o === 'object' || o === 'function';
165
+ };
166
+ /**
167
+ * Production h() function based on Preact by
168
+ * Jason Miller (@developit)
169
+ * Licensed under the MIT License
170
+ * https://github.com/developit/preact/blob/master/LICENSE
171
+ *
172
+ * Modified for Stencil's compiler and vdom
173
+ */
174
+ // const stack: any[] = [];
175
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
176
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
177
+ const h = (nodeName, vnodeData, ...children) => {
178
+ let child = null;
179
+ let key = null;
180
+ let slotName = null;
181
+ let simple = false;
182
+ let lastSimple = false;
183
+ let vNodeChildren = [];
184
+ const walk = (c) => {
185
+ for (let i = 0; i < c.length; i++) {
186
+ child = c[i];
187
+ if (Array.isArray(child)) {
188
+ walk(child);
189
+ }
190
+ else if (child != null && typeof child !== 'boolean') {
191
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
192
+ child = String(child);
193
+ }
194
+ if (simple && lastSimple) {
195
+ // If the previous child was simple (string), we merge both
196
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
197
+ }
198
+ else {
199
+ // Append a new vNode, if it's text, we create a text vNode
200
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
201
+ }
202
+ lastSimple = simple;
203
+ }
204
+ }
205
+ };
206
+ walk(children);
207
+ if (vnodeData) {
208
+ // normalize class / classname attributes
209
+ if (vnodeData.key) {
210
+ key = vnodeData.key;
211
+ }
212
+ if (vnodeData.name) {
213
+ slotName = vnodeData.name;
214
+ }
215
+ {
216
+ const classData = vnodeData.className || vnodeData.class;
217
+ if (classData) {
218
+ vnodeData.class =
219
+ typeof classData !== 'object'
220
+ ? classData
221
+ : Object.keys(classData)
222
+ .filter(k => classData[k])
223
+ .join(' ');
224
+ }
225
+ }
226
+ }
227
+ if (typeof nodeName === 'function') {
228
+ // nodeName is a functional component
229
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
230
+ }
231
+ const vnode = newVNode(nodeName, null);
232
+ vnode.$attrs$ = vnodeData;
233
+ if (vNodeChildren.length > 0) {
234
+ vnode.$children$ = vNodeChildren;
235
+ }
236
+ {
237
+ vnode.$key$ = key;
238
+ }
239
+ {
240
+ vnode.$name$ = slotName;
241
+ }
242
+ return vnode;
243
+ };
244
+ const newVNode = (tag, text) => {
245
+ const vnode = {
246
+ $flags$: 0,
247
+ $tag$: tag,
248
+ $text$: text,
249
+ $elm$: null,
250
+ $children$: null,
251
+ };
252
+ {
253
+ vnode.$attrs$ = null;
254
+ }
255
+ {
256
+ vnode.$key$ = null;
257
+ }
258
+ {
259
+ vnode.$name$ = null;
260
+ }
261
+ return vnode;
262
+ };
263
+ const Host = {};
264
+ const isHost = (node) => node && node.$tag$ === Host;
265
+ const vdomFnUtils = {
266
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
267
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
268
+ };
269
+ const convertToPublic = (node) => ({
270
+ vattrs: node.$attrs$,
271
+ vchildren: node.$children$,
272
+ vkey: node.$key$,
273
+ vname: node.$name$,
274
+ vtag: node.$tag$,
275
+ vtext: node.$text$,
276
+ });
277
+ const convertToPrivate = (node) => {
278
+ if (typeof node.vtag === 'function') {
279
+ const vnodeData = Object.assign({}, node.vattrs);
280
+ if (node.vkey) {
281
+ vnodeData.key = node.vkey;
282
+ }
283
+ if (node.vname) {
284
+ vnodeData.name = node.vname;
285
+ }
286
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
287
+ }
288
+ const vnode = newVNode(node.vtag, node.vtext);
289
+ vnode.$attrs$ = node.vattrs;
290
+ vnode.$children$ = node.vchildren;
291
+ vnode.$key$ = node.vkey;
292
+ vnode.$name$ = node.vname;
293
+ return vnode;
294
+ };
295
+ /**
296
+ * Production setAccessor() function based on Preact by
297
+ * Jason Miller (@developit)
298
+ * Licensed under the MIT License
299
+ * https://github.com/developit/preact/blob/master/LICENSE
300
+ *
301
+ * Modified for Stencil's compiler and vdom
302
+ */
303
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
304
+ if (oldValue !== newValue) {
305
+ let isProp = isMemberInElement(elm, memberName);
306
+ let ln = memberName.toLowerCase();
307
+ if (memberName === 'class') {
308
+ const classList = elm.classList;
309
+ const oldClasses = parseClassList(oldValue);
310
+ const newClasses = parseClassList(newValue);
311
+ classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
312
+ classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
313
+ }
314
+ else if (memberName === 'style') {
315
+ // update style attribute, css properties and values
316
+ {
317
+ for (const prop in oldValue) {
318
+ if (!newValue || newValue[prop] == null) {
319
+ if (prop.includes('-')) {
320
+ elm.style.removeProperty(prop);
321
+ }
322
+ else {
323
+ elm.style[prop] = '';
324
+ }
325
+ }
326
+ }
327
+ }
328
+ for (const prop in newValue) {
329
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
330
+ if (prop.includes('-')) {
331
+ elm.style.setProperty(prop, newValue[prop]);
332
+ }
333
+ else {
334
+ elm.style[prop] = newValue[prop];
335
+ }
336
+ }
337
+ }
338
+ }
339
+ else if (memberName === 'key')
340
+ ;
341
+ else if (memberName === 'ref') {
342
+ // minifier will clean this up
343
+ if (newValue) {
344
+ newValue(elm);
345
+ }
346
+ }
347
+ else if ((!isProp ) && memberName[0] === 'o' && memberName[1] === 'n') {
348
+ // Event Handlers
349
+ // so if the member name starts with "on" and the 3rd characters is
350
+ // a capital letter, and it's not already a member on the element,
351
+ // then we're assuming it's an event listener
352
+ if (memberName[2] === '-') {
353
+ // on- prefixed events
354
+ // allows to be explicit about the dom event to listen without any magic
355
+ // under the hood:
356
+ // <my-cmp on-click> // listens for "click"
357
+ // <my-cmp on-Click> // listens for "Click"
358
+ // <my-cmp on-ionChange> // listens for "ionChange"
359
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
360
+ memberName = memberName.slice(3);
361
+ }
362
+ else if (isMemberInElement(win, ln)) {
363
+ // standard event
364
+ // the JSX attribute could have been "onMouseOver" and the
365
+ // member name "onmouseover" is on the window's prototype
366
+ // so let's add the listener "mouseover", which is all lowercased
367
+ memberName = ln.slice(2);
368
+ }
369
+ else {
370
+ // custom event
371
+ // the JSX attribute could have been "onMyCustomEvent"
372
+ // so let's trim off the "on" prefix and lowercase the first character
373
+ // and add the listener "myCustomEvent"
374
+ // except for the first character, we keep the event name case
375
+ memberName = ln[2] + memberName.slice(3);
376
+ }
377
+ if (oldValue) {
378
+ plt.rel(elm, memberName, oldValue, false);
379
+ }
380
+ if (newValue) {
381
+ plt.ael(elm, memberName, newValue, false);
382
+ }
383
+ }
384
+ else {
385
+ // Set property if it exists and it's not a SVG
386
+ const isComplex = isComplexType(newValue);
387
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
388
+ try {
389
+ if (!elm.tagName.includes('-')) {
390
+ let n = newValue == null ? '' : newValue;
391
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
392
+ if (memberName === 'list') {
393
+ isProp = false;
394
+ // tslint:disable-next-line: triple-equals
395
+ }
396
+ else if (oldValue == null || elm[memberName] != n) {
397
+ elm[memberName] = n;
398
+ }
399
+ }
400
+ else {
401
+ elm[memberName] = newValue;
402
+ }
403
+ }
404
+ catch (e) { }
405
+ }
406
+ /**
407
+ * Need to manually update attribute if:
408
+ * - memberName is not an attribute
409
+ * - if we are rendering the host element in order to reflect attribute
410
+ * - if it's a SVG, since properties might not work in <svg>
411
+ * - if the newValue is null/undefined or 'false'.
412
+ */
413
+ let xlink = false;
414
+ {
415
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
416
+ memberName = ln;
417
+ xlink = true;
418
+ }
419
+ }
420
+ if (newValue == null || newValue === false) {
421
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
422
+ if (xlink) {
423
+ elm.removeAttributeNS(XLINK_NS, memberName);
424
+ }
425
+ else {
426
+ elm.removeAttribute(memberName);
427
+ }
428
+ }
429
+ }
430
+ else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
431
+ newValue = newValue === true ? '' : newValue;
432
+ if (xlink) {
433
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
434
+ }
435
+ else {
436
+ elm.setAttribute(memberName, newValue);
437
+ }
438
+ }
439
+ }
440
+ }
441
+ };
442
+ const parseClassListRegex = /\s/;
443
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
444
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
445
+ // if the element passed in is a shadow root, which is a document fragment
446
+ // then we want to be adding attrs/props to the shadow root's "host" element
447
+ // if it's not a shadow root, then we add attrs/props to the same element
448
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
449
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
450
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
451
+ {
452
+ // remove attributes no longer present on the vnode by setting them to undefined
453
+ for (memberName in oldVnodeAttrs) {
454
+ if (!(memberName in newVnodeAttrs)) {
455
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
456
+ }
457
+ }
458
+ }
459
+ // add new & update changed attributes
460
+ for (memberName in newVnodeAttrs) {
461
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
462
+ }
463
+ };
464
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
465
+ // tslint:disable-next-line: prefer-const
466
+ let newVNode = newParentVNode.$children$[childIndex];
467
+ let i = 0;
468
+ let elm;
469
+ let childNode;
470
+ let oldVNode;
471
+ if (!useNativeShadowDom) {
472
+ // remember for later we need to check to relocate nodes
473
+ checkSlotRelocate = true;
474
+ if (newVNode.$tag$ === 'slot') {
475
+ if (scopeId) {
476
+ // scoped css needs to add its scoped id to the parent element
477
+ parentElm.classList.add(scopeId + '-s');
478
+ }
479
+ newVNode.$flags$ |= newVNode.$children$
480
+ ? // slot element has fallback content
481
+ 2 /* isSlotFallback */
482
+ : // slot element does not have fallback content
483
+ 1 /* isSlotReference */;
484
+ }
485
+ }
486
+ if (newVNode.$text$ !== null) {
487
+ // create text node
488
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
489
+ }
490
+ else if (newVNode.$flags$ & 1 /* isSlotReference */) {
491
+ // create a slot reference node
492
+ elm = newVNode.$elm$ = doc.createTextNode('');
493
+ }
494
+ else {
495
+ if (!isSvgMode) {
496
+ isSvgMode = newVNode.$tag$ === 'svg';
497
+ }
498
+ // create element
499
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */ ? 'slot-fb' : newVNode.$tag$)
500
+ );
501
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
502
+ isSvgMode = false;
503
+ }
504
+ // add css classes, attrs, props, listeners, etc.
505
+ {
506
+ updateElement(null, newVNode, isSvgMode);
507
+ }
508
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
509
+ // if there is a scopeId and this is the initial render
510
+ // then let's add the scopeId as a css class
511
+ elm.classList.add((elm['s-si'] = scopeId));
512
+ }
513
+ if (newVNode.$children$) {
514
+ for (i = 0; i < newVNode.$children$.length; ++i) {
515
+ // create the node
516
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
517
+ // return node could have been null
518
+ if (childNode) {
519
+ // append our new node
520
+ elm.appendChild(childNode);
521
+ }
522
+ }
523
+ }
524
+ {
525
+ if (newVNode.$tag$ === 'svg') {
526
+ // Only reset the SVG context when we're exiting <svg> element
527
+ isSvgMode = false;
528
+ }
529
+ else if (elm.tagName === 'foreignObject') {
530
+ // Reenter SVG context when we're exiting <foreignObject> element
531
+ isSvgMode = true;
532
+ }
533
+ }
534
+ }
535
+ {
536
+ elm['s-hn'] = hostTagName;
537
+ if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
538
+ // remember the content reference comment
539
+ elm['s-sr'] = true;
540
+ // remember the content reference comment
541
+ elm['s-cr'] = contentRef;
542
+ // remember the slot name, or empty string for default slot
543
+ elm['s-sn'] = newVNode.$name$ || '';
544
+ // check if we've got an old vnode for this slot
545
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
546
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
547
+ // we've got an old slot vnode and the wrapper is being replaced
548
+ // so let's move the old slot content back to it's original location
549
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
550
+ }
551
+ }
552
+ }
553
+ return elm;
554
+ };
555
+ const putBackInOriginalLocation = (parentElm, recursive) => {
556
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
557
+ const oldSlotChildNodes = parentElm.childNodes;
558
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
559
+ const childNode = oldSlotChildNodes[i];
560
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
561
+ // // this child node in the old element is from another component
562
+ // // remove this node from the old slot's parent
563
+ // childNode.remove();
564
+ // and relocate it back to it's original location
565
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
566
+ // remove the old original location comment entirely
567
+ // later on the patch function will know what to do
568
+ // and move this to the correct spot in need be
569
+ childNode['s-ol'].remove();
570
+ childNode['s-ol'] = undefined;
571
+ checkSlotRelocate = true;
572
+ }
573
+ if (recursive) {
574
+ putBackInOriginalLocation(childNode, recursive);
575
+ }
576
+ }
577
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
578
+ };
579
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
580
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
581
+ let childNode;
582
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
583
+ containerElm = containerElm.shadowRoot;
584
+ }
585
+ for (; startIdx <= endIdx; ++startIdx) {
586
+ if (vnodes[startIdx]) {
587
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
588
+ if (childNode) {
589
+ vnodes[startIdx].$elm$ = childNode;
590
+ containerElm.insertBefore(childNode, referenceNode(before) );
591
+ }
592
+ }
593
+ }
594
+ };
595
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
596
+ for (; startIdx <= endIdx; ++startIdx) {
597
+ if ((vnode = vnodes[startIdx])) {
598
+ elm = vnode.$elm$;
599
+ callNodeRefs(vnode);
600
+ {
601
+ // we're removing this element
602
+ // so it's possible we need to show slot fallback content now
603
+ checkSlotFallbackVisibility = true;
604
+ if (elm['s-ol']) {
605
+ // remove the original location comment
606
+ elm['s-ol'].remove();
607
+ }
608
+ else {
609
+ // it's possible that child nodes of the node
610
+ // that's being removed are slot nodes
611
+ putBackInOriginalLocation(elm, true);
612
+ }
613
+ }
614
+ // remove the vnode's element from the dom
615
+ elm.remove();
616
+ }
617
+ }
618
+ };
619
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
620
+ let oldStartIdx = 0;
621
+ let newStartIdx = 0;
622
+ let idxInOld = 0;
623
+ let i = 0;
624
+ let oldEndIdx = oldCh.length - 1;
625
+ let oldStartVnode = oldCh[0];
626
+ let oldEndVnode = oldCh[oldEndIdx];
627
+ let newEndIdx = newCh.length - 1;
628
+ let newStartVnode = newCh[0];
629
+ let newEndVnode = newCh[newEndIdx];
630
+ let node;
631
+ let elmToMove;
632
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
633
+ if (oldStartVnode == null) {
634
+ // Vnode might have been moved left
635
+ oldStartVnode = oldCh[++oldStartIdx];
636
+ }
637
+ else if (oldEndVnode == null) {
638
+ oldEndVnode = oldCh[--oldEndIdx];
639
+ }
640
+ else if (newStartVnode == null) {
641
+ newStartVnode = newCh[++newStartIdx];
642
+ }
643
+ else if (newEndVnode == null) {
644
+ newEndVnode = newCh[--newEndIdx];
645
+ }
646
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
647
+ patch(oldStartVnode, newStartVnode);
648
+ oldStartVnode = oldCh[++oldStartIdx];
649
+ newStartVnode = newCh[++newStartIdx];
650
+ }
651
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
652
+ patch(oldEndVnode, newEndVnode);
653
+ oldEndVnode = oldCh[--oldEndIdx];
654
+ newEndVnode = newCh[--newEndIdx];
655
+ }
656
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
657
+ // Vnode moved right
658
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
659
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
660
+ }
661
+ patch(oldStartVnode, newEndVnode);
662
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
663
+ oldStartVnode = oldCh[++oldStartIdx];
664
+ newEndVnode = newCh[--newEndIdx];
665
+ }
666
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
667
+ // Vnode moved left
668
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
669
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
670
+ }
671
+ patch(oldEndVnode, newStartVnode);
672
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
673
+ oldEndVnode = oldCh[--oldEndIdx];
674
+ newStartVnode = newCh[++newStartIdx];
675
+ }
676
+ else {
677
+ // createKeyToOldIdx
678
+ idxInOld = -1;
679
+ {
680
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
681
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
682
+ idxInOld = i;
683
+ break;
684
+ }
685
+ }
686
+ }
687
+ if (idxInOld >= 0) {
688
+ elmToMove = oldCh[idxInOld];
689
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
690
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
691
+ }
692
+ else {
693
+ patch(elmToMove, newStartVnode);
694
+ oldCh[idxInOld] = undefined;
695
+ node = elmToMove.$elm$;
696
+ }
697
+ newStartVnode = newCh[++newStartIdx];
698
+ }
699
+ else {
700
+ // new element
701
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
702
+ newStartVnode = newCh[++newStartIdx];
703
+ }
704
+ if (node) {
705
+ {
706
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
707
+ }
708
+ }
709
+ }
710
+ }
711
+ if (oldStartIdx > oldEndIdx) {
712
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
713
+ }
714
+ else if (newStartIdx > newEndIdx) {
715
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
716
+ }
717
+ };
718
+ const isSameVnode = (vnode1, vnode2) => {
719
+ // compare if two vnode to see if they're "technically" the same
720
+ // need to have the same element tag, and same key to be the same
721
+ if (vnode1.$tag$ === vnode2.$tag$) {
722
+ if (vnode1.$tag$ === 'slot') {
723
+ return vnode1.$name$ === vnode2.$name$;
724
+ }
725
+ {
726
+ return vnode1.$key$ === vnode2.$key$;
727
+ }
728
+ }
729
+ return false;
730
+ };
731
+ const referenceNode = (node) => {
732
+ // this node was relocated to a new location in the dom
733
+ // because of some other component's slot
734
+ // but we still have an html comment in place of where
735
+ // it's original location was according to it's original vdom
736
+ return (node && node['s-ol']) || node;
737
+ };
738
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
739
+ const patch = (oldVNode, newVNode) => {
740
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
741
+ const oldChildren = oldVNode.$children$;
742
+ const newChildren = newVNode.$children$;
743
+ const tag = newVNode.$tag$;
744
+ const text = newVNode.$text$;
745
+ let defaultHolder;
746
+ if (text === null) {
747
+ {
748
+ // test if we're rendering an svg element, or still rendering nodes inside of one
749
+ // only add this to the when the compiler sees we're using an svg somewhere
750
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
751
+ }
752
+ // element node
753
+ {
754
+ if (tag === 'slot')
755
+ ;
756
+ else {
757
+ // either this is the first render of an element OR it's an update
758
+ // AND we already know it's possible it could have changed
759
+ // this updates the element's css classes, attrs, props, listeners, etc.
760
+ updateElement(oldVNode, newVNode, isSvgMode);
761
+ }
762
+ }
763
+ if (oldChildren !== null && newChildren !== null) {
764
+ // looks like there's child vnodes for both the old and new vnodes
765
+ updateChildren(elm, oldChildren, newVNode, newChildren);
766
+ }
767
+ else if (newChildren !== null) {
768
+ // no old child vnodes, but there are new child vnodes to add
769
+ if (oldVNode.$text$ !== null) {
770
+ // the old vnode was text, so be sure to clear it out
771
+ elm.textContent = '';
772
+ }
773
+ // add the new vnode children
774
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
775
+ }
776
+ else if (oldChildren !== null) {
777
+ // no new child vnodes, but there are old child vnodes to remove
778
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
779
+ }
780
+ if (isSvgMode && tag === 'svg') {
781
+ isSvgMode = false;
782
+ }
783
+ }
784
+ else if ((defaultHolder = elm['s-cr'])) {
785
+ // this element has slotted content
786
+ defaultHolder.parentNode.textContent = text;
787
+ }
788
+ else if (oldVNode.$text$ !== text) {
789
+ // update the text content for the text only vnode
790
+ // and also only if the text is different than before
791
+ elm.data = text;
792
+ }
793
+ };
794
+ const updateFallbackSlotVisibility = (elm) => {
795
+ // tslint:disable-next-line: prefer-const
796
+ let childNodes = elm.childNodes;
797
+ let childNode;
798
+ let i;
799
+ let ilen;
800
+ let j;
801
+ let slotNameAttr;
802
+ let nodeType;
803
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
804
+ childNode = childNodes[i];
805
+ if (childNode.nodeType === 1 /* ElementNode */) {
806
+ if (childNode['s-sr']) {
807
+ // this is a slot fallback node
808
+ // get the slot name for this slot reference node
809
+ slotNameAttr = childNode['s-sn'];
810
+ // by default always show a fallback slot node
811
+ // then hide it if there are other slots in the light dom
812
+ childNode.hidden = false;
813
+ for (j = 0; j < ilen; j++) {
814
+ nodeType = childNodes[j].nodeType;
815
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
816
+ // this sibling node is from a different component OR is a named fallback slot node
817
+ if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
818
+ childNode.hidden = true;
819
+ break;
820
+ }
821
+ }
822
+ else {
823
+ // this is a default fallback slot node
824
+ // any element or text node (with content)
825
+ // should hide the default fallback slot node
826
+ if (nodeType === 1 /* ElementNode */ ||
827
+ (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
828
+ childNode.hidden = true;
829
+ break;
830
+ }
831
+ }
832
+ }
833
+ }
834
+ // keep drilling down
835
+ updateFallbackSlotVisibility(childNode);
836
+ }
837
+ }
838
+ };
839
+ const relocateNodes = [];
840
+ const relocateSlotContent = (elm) => {
841
+ // tslint:disable-next-line: prefer-const
842
+ let childNode;
843
+ let node;
844
+ let hostContentNodes;
845
+ let slotNameAttr;
846
+ let relocateNodeData;
847
+ let j;
848
+ let i = 0;
849
+ let childNodes = elm.childNodes;
850
+ let ilen = childNodes.length;
851
+ for (; i < ilen; i++) {
852
+ childNode = childNodes[i];
853
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
854
+ // first got the content reference comment node
855
+ // then we got it's parent, which is where all the host content is in now
856
+ hostContentNodes = node.parentNode.childNodes;
857
+ slotNameAttr = childNode['s-sn'];
858
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
859
+ node = hostContentNodes[j];
860
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
861
+ // let's do some relocating to its new home
862
+ // but never relocate a content reference node
863
+ // that is suppose to always represent the original content location
864
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
865
+ // it's possible we've already decided to relocate this node
866
+ relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
867
+ // made some changes to slots
868
+ // let's make sure we also double check
869
+ // fallbacks are correctly hidden or shown
870
+ checkSlotFallbackVisibility = true;
871
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
872
+ if (relocateNodeData) {
873
+ // previously we never found a slot home for this node
874
+ // but turns out we did, so let's remember it now
875
+ relocateNodeData.$slotRefNode$ = childNode;
876
+ }
877
+ else {
878
+ // add to our list of nodes to relocate
879
+ relocateNodes.push({
880
+ $slotRefNode$: childNode,
881
+ $nodeToRelocate$: node,
882
+ });
883
+ }
884
+ if (node['s-sr']) {
885
+ relocateNodes.map(relocateNode => {
886
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
887
+ relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
888
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
889
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
890
+ }
891
+ }
892
+ });
893
+ }
894
+ }
895
+ else if (!relocateNodes.some(r => r.$nodeToRelocate$ === node)) {
896
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
897
+ // if we never find a home for this element then we'll need to hide it
898
+ relocateNodes.push({
899
+ $nodeToRelocate$: node,
900
+ });
901
+ }
902
+ }
903
+ }
904
+ }
905
+ if (childNode.nodeType === 1 /* ElementNode */) {
906
+ relocateSlotContent(childNode);
907
+ }
908
+ }
909
+ };
910
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
911
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
912
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
913
+ return true;
914
+ }
915
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
916
+ return true;
917
+ }
918
+ return false;
919
+ }
920
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
921
+ return true;
922
+ }
923
+ return slotNameAttr === '';
924
+ };
925
+ const callNodeRefs = (vNode) => {
926
+ {
927
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
928
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
929
+ }
930
+ };
931
+ const renderVdom = (hostRef, renderFnResults) => {
932
+ const hostElm = hostRef.$hostElement$;
933
+ const cmpMeta = hostRef.$cmpMeta$;
934
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
935
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
936
+ hostTagName = hostElm.tagName;
937
+ if (cmpMeta.$attrsToReflect$) {
938
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
939
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
940
+ }
941
+ rootVnode.$tag$ = null;
942
+ rootVnode.$flags$ |= 4 /* isHost */;
943
+ hostRef.$vnode$ = rootVnode;
944
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
945
+ {
946
+ scopeId = hostElm['s-sc'];
947
+ }
948
+ {
949
+ contentRef = hostElm['s-cr'];
950
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
951
+ // always reset
952
+ checkSlotFallbackVisibility = false;
953
+ }
954
+ // synchronous patch
955
+ patch(oldVNode, rootVnode);
956
+ {
957
+ // while we're moving nodes around existing nodes, temporarily disable
958
+ // the disconnectCallback from working
959
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
960
+ if (checkSlotRelocate) {
961
+ relocateSlotContent(rootVnode.$elm$);
962
+ let relocateData;
963
+ let nodeToRelocate;
964
+ let orgLocationNode;
965
+ let parentNodeRef;
966
+ let insertBeforeNode;
967
+ let refNode;
968
+ let i = 0;
969
+ for (; i < relocateNodes.length; i++) {
970
+ relocateData = relocateNodes[i];
971
+ nodeToRelocate = relocateData.$nodeToRelocate$;
972
+ if (!nodeToRelocate['s-ol']) {
973
+ // add a reference node marking this node's original location
974
+ // keep a reference to this node for later lookups
975
+ orgLocationNode = doc.createTextNode('');
976
+ orgLocationNode['s-nr'] = nodeToRelocate;
977
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
978
+ }
979
+ }
980
+ for (i = 0; i < relocateNodes.length; i++) {
981
+ relocateData = relocateNodes[i];
982
+ nodeToRelocate = relocateData.$nodeToRelocate$;
983
+ if (relocateData.$slotRefNode$) {
984
+ // by default we're just going to insert it directly
985
+ // after the slot reference node
986
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
987
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
988
+ orgLocationNode = nodeToRelocate['s-ol'];
989
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
990
+ refNode = orgLocationNode['s-nr'];
991
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
992
+ refNode = refNode.nextSibling;
993
+ if (!refNode || !refNode['s-nr']) {
994
+ insertBeforeNode = refNode;
995
+ break;
996
+ }
997
+ }
998
+ }
999
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) || nodeToRelocate.nextSibling !== insertBeforeNode) {
1000
+ // we've checked that it's worth while to relocate
1001
+ // since that the node to relocate
1002
+ // has a different next sibling or parent relocated
1003
+ if (nodeToRelocate !== insertBeforeNode) {
1004
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1005
+ // probably a component in the index.html that doesn't have it's hostname set
1006
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1007
+ }
1008
+ // add it back to the dom but in its new home
1009
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1010
+ }
1011
+ }
1012
+ }
1013
+ else {
1014
+ // this node doesn't have a slot home to go to, so let's hide it
1015
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1016
+ nodeToRelocate.hidden = true;
1017
+ }
1018
+ }
1019
+ }
1020
+ }
1021
+ if (checkSlotFallbackVisibility) {
1022
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1023
+ }
1024
+ // done moving nodes around
1025
+ // allow the disconnect callback to work again
1026
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
1027
+ // always reset
1028
+ relocateNodes.length = 0;
1029
+ }
1030
+ };
1031
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
1032
+ const createEvent = (ref, name, flags) => {
1033
+ const elm = getElement(ref);
1034
+ return {
1035
+ emit: (detail) => {
1036
+ return emitEvent(elm, name, {
1037
+ bubbles: !!(flags & 4 /* Bubbles */),
1038
+ composed: !!(flags & 2 /* Composed */),
1039
+ cancelable: !!(flags & 1 /* Cancellable */),
1040
+ detail,
1041
+ });
1042
+ },
1043
+ };
1044
+ };
1045
+ const emitEvent = (elm, name, opts) => {
1046
+ const ev = plt.ce(name, opts);
1047
+ elm.dispatchEvent(ev);
1048
+ return ev;
1049
+ };
1050
+ const attachToAncestor = (hostRef, ancestorComponent) => {
1051
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1052
+ ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
1053
+ }
1054
+ };
1055
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
1056
+ {
1057
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1058
+ }
1059
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1060
+ hostRef.$flags$ |= 512 /* needsRerender */;
1061
+ return;
1062
+ }
1063
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1064
+ // there is no ancestor component or the ancestor component
1065
+ // has already fired off its lifecycle update then
1066
+ // fire off the initial update
1067
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1068
+ return writeTask(dispatch) ;
1069
+ };
1070
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1071
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1072
+ const instance = hostRef.$lazyInstance$ ;
1073
+ let promise;
1074
+ if (isInitialLoad) {
1075
+ {
1076
+ hostRef.$flags$ |= 256 /* isListenReady */;
1077
+ if (hostRef.$queuedListeners$) {
1078
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1079
+ hostRef.$queuedListeners$ = null;
1080
+ }
1081
+ }
1082
+ }
1083
+ else {
1084
+ {
1085
+ promise = safeCall(instance, 'componentWillUpdate');
1086
+ }
1087
+ }
1088
+ {
1089
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1090
+ }
1091
+ endSchedule();
1092
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1093
+ };
1094
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1095
+ // updateComponent
1096
+ const elm = hostRef.$hostElement$;
1097
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1098
+ const rc = elm['s-rc'];
1099
+ if (isInitialLoad) {
1100
+ // DOM WRITE!
1101
+ attachStyles(hostRef);
1102
+ }
1103
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1104
+ {
1105
+ callRender(hostRef, instance);
1106
+ }
1107
+ if (rc) {
1108
+ // ok, so turns out there are some child host elements
1109
+ // waiting on this parent element to load
1110
+ // let's fire off all update callbacks waiting
1111
+ rc.map(cb => cb());
1112
+ elm['s-rc'] = undefined;
1113
+ }
1114
+ endRender();
1115
+ endUpdate();
1116
+ {
1117
+ const childrenPromises = elm['s-p'];
1118
+ const postUpdate = () => postUpdateComponent(hostRef);
1119
+ if (childrenPromises.length === 0) {
1120
+ postUpdate();
1121
+ }
1122
+ else {
1123
+ Promise.all(childrenPromises).then(postUpdate);
1124
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1125
+ childrenPromises.length = 0;
1126
+ }
1127
+ }
1128
+ };
1129
+ const callRender = (hostRef, instance, elm) => {
1130
+ try {
1131
+ instance = instance.render() ;
1132
+ {
1133
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1134
+ }
1135
+ {
1136
+ hostRef.$flags$ |= 2 /* hasRendered */;
1137
+ }
1138
+ {
1139
+ {
1140
+ // looks like we've got child nodes to render into this host element
1141
+ // or we need to update the css class/attrs on the host element
1142
+ // DOM WRITE!
1143
+ {
1144
+ renderVdom(hostRef, instance);
1145
+ }
1146
+ }
1147
+ }
1148
+ }
1149
+ catch (e) {
1150
+ consoleError(e, hostRef.$hostElement$);
1151
+ }
1152
+ return null;
1153
+ };
1154
+ const postUpdateComponent = (hostRef) => {
1155
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1156
+ const elm = hostRef.$hostElement$;
1157
+ const endPostUpdate = createTime('postUpdate', tagName);
1158
+ const instance = hostRef.$lazyInstance$ ;
1159
+ const ancestorComponent = hostRef.$ancestorComponent$;
1160
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1161
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1162
+ {
1163
+ // DOM WRITE!
1164
+ addHydratedFlag(elm);
1165
+ }
1166
+ {
1167
+ safeCall(instance, 'componentDidLoad');
1168
+ }
1169
+ endPostUpdate();
1170
+ {
1171
+ hostRef.$onReadyResolve$(elm);
1172
+ if (!ancestorComponent) {
1173
+ appDidLoad();
1174
+ }
1175
+ }
1176
+ }
1177
+ else {
1178
+ endPostUpdate();
1179
+ }
1180
+ {
1181
+ hostRef.$onInstanceResolve$(elm);
1182
+ }
1183
+ // load events fire from bottom to top
1184
+ // the deepest elements load first then bubbles up
1185
+ {
1186
+ if (hostRef.$onRenderResolve$) {
1187
+ hostRef.$onRenderResolve$();
1188
+ hostRef.$onRenderResolve$ = undefined;
1189
+ }
1190
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
1191
+ nextTick(() => scheduleUpdate(hostRef, false));
1192
+ }
1193
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1194
+ }
1195
+ // ( •_•)
1196
+ // ( •_•)>⌐■-■
1197
+ // (⌐■_■)
1198
+ };
1199
+ const appDidLoad = (who) => {
1200
+ // on appload
1201
+ // we have finish the first big initial render
1202
+ {
1203
+ addHydratedFlag(doc.documentElement);
1204
+ }
1205
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1206
+ };
1207
+ const safeCall = (instance, method, arg) => {
1208
+ if (instance && instance[method]) {
1209
+ try {
1210
+ return instance[method](arg);
1211
+ }
1212
+ catch (e) {
1213
+ consoleError(e);
1214
+ }
1215
+ }
1216
+ return undefined;
1217
+ };
1218
+ const then = (promise, thenFn) => {
1219
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1220
+ };
1221
+ const addHydratedFlag = (elm) => (elm.classList.add('hydrated') );
1222
+ const parsePropertyValue = (propValue, propType) => {
1223
+ // ensure this value is of the correct prop type
1224
+ if (propValue != null && !isComplexType(propValue)) {
1225
+ if (propType & 4 /* Boolean */) {
1226
+ // per the HTML spec, any string value means it is a boolean true value
1227
+ // but we'll cheat here and say that the string "false" is the boolean false
1228
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
1229
+ }
1230
+ if (propType & 2 /* Number */) {
1231
+ // force it to be a number
1232
+ return parseFloat(propValue);
1233
+ }
1234
+ if (propType & 1 /* String */) {
1235
+ // could have been passed as a number or boolean
1236
+ // but we still want it as a string
1237
+ return String(propValue);
1238
+ }
1239
+ // redundant return here for better minification
1240
+ return propValue;
1241
+ }
1242
+ // not sure exactly what type we want
1243
+ // so no need to change to a different type
1244
+ return propValue;
1245
+ };
1246
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1247
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1248
+ // check our new property value against our internal value
1249
+ const hostRef = getHostRef(ref);
1250
+ const elm = hostRef.$hostElement$ ;
1251
+ const oldVal = hostRef.$instanceValues$.get(propName);
1252
+ const flags = hostRef.$flags$;
1253
+ const instance = hostRef.$lazyInstance$ ;
1254
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1255
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
1256
+ // gadzooks! the property's value has changed!!
1257
+ // set our new value!
1258
+ hostRef.$instanceValues$.set(propName, newVal);
1259
+ if (instance) {
1260
+ // get an array of method names of watch functions to call
1261
+ if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1262
+ const watchMethods = cmpMeta.$watchers$[propName];
1263
+ if (watchMethods) {
1264
+ // this instance is watching for when this property changed
1265
+ watchMethods.map(watchMethodName => {
1266
+ try {
1267
+ // fire off each of the watch methods that are watching this property
1268
+ instance[watchMethodName](newVal, oldVal, propName);
1269
+ }
1270
+ catch (e) {
1271
+ consoleError(e, elm);
1272
+ }
1273
+ });
1274
+ }
1275
+ }
1276
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1277
+ // looks like this value actually changed, so we've got work to do!
1278
+ // but only if we've already rendered, otherwise just chill out
1279
+ // queue that we need to do an update, but don't worry about queuing
1280
+ // up millions cuz this function ensures it only runs once
1281
+ scheduleUpdate(hostRef, false);
1282
+ }
1283
+ }
1284
+ }
1285
+ };
1286
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1287
+ if (cmpMeta.$members$) {
1288
+ if (Cstr.watchers) {
1289
+ cmpMeta.$watchers$ = Cstr.watchers;
1290
+ }
1291
+ // It's better to have a const than two Object.entries()
1292
+ const members = Object.entries(cmpMeta.$members$);
1293
+ const prototype = Cstr.prototype;
1294
+ members.map(([memberName, [memberFlags]]) => {
1295
+ if ((memberFlags & 31 /* Prop */ || ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1296
+ // proxyComponent - prop
1297
+ Object.defineProperty(prototype, memberName, {
1298
+ get() {
1299
+ // proxyComponent, get value
1300
+ return getValue(this, memberName);
1301
+ },
1302
+ set(newValue) {
1303
+ // proxyComponent, set value
1304
+ setValue(this, memberName, newValue, cmpMeta);
1305
+ },
1306
+ configurable: true,
1307
+ enumerable: true,
1308
+ });
1309
+ }
1310
+ else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
1311
+ // proxyComponent - method
1312
+ Object.defineProperty(prototype, memberName, {
1313
+ value(...args) {
1314
+ const ref = getHostRef(this);
1315
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
1316
+ },
1317
+ });
1318
+ }
1319
+ });
1320
+ if ((flags & 1 /* isElementConstructor */)) {
1321
+ const attrNameToPropName = new Map();
1322
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1323
+ plt.jmp(() => {
1324
+ const propName = attrNameToPropName.get(attrName);
1325
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1326
+ });
1327
+ };
1328
+ // create an array of attributes to observe
1329
+ // and also create a map of html attribute name to js property name
1330
+ Cstr.observedAttributes = members
1331
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1332
+ .map(([propName, m]) => {
1333
+ const attrName = m[1] || propName;
1334
+ attrNameToPropName.set(attrName, propName);
1335
+ if (m[0] & 512 /* ReflectAttr */) {
1336
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1337
+ }
1338
+ return attrName;
1339
+ });
1340
+ }
1341
+ }
1342
+ return Cstr;
1343
+ };
1344
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1345
+ // initializeComponent
1346
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1347
+ {
1348
+ // we haven't initialized this element yet
1349
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1350
+ // lazy loaded components
1351
+ // request the component's implementation to be
1352
+ // wired up with the host element
1353
+ Cstr = loadModule(cmpMeta);
1354
+ if (Cstr.then) {
1355
+ // Await creates a micro-task avoid if possible
1356
+ const endLoad = uniqueTime();
1357
+ Cstr = await Cstr;
1358
+ endLoad();
1359
+ }
1360
+ if (!Cstr.isProxied) {
1361
+ // we'eve never proxied this Constructor before
1362
+ // let's add the getters/setters to its prototype before
1363
+ // the first time we create an instance of the implementation
1364
+ {
1365
+ cmpMeta.$watchers$ = Cstr.watchers;
1366
+ }
1367
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1368
+ Cstr.isProxied = true;
1369
+ }
1370
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1371
+ // ok, time to construct the instance
1372
+ // but let's keep track of when we start and stop
1373
+ // so that the getters/setters don't incorrectly step on data
1374
+ {
1375
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1376
+ }
1377
+ // construct the lazy-loaded component implementation
1378
+ // passing the hostRef is very important during
1379
+ // construction in order to directly wire together the
1380
+ // host element and the lazy-loaded instance
1381
+ try {
1382
+ new Cstr(hostRef);
1383
+ }
1384
+ catch (e) {
1385
+ consoleError(e);
1386
+ }
1387
+ {
1388
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1389
+ }
1390
+ {
1391
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1392
+ }
1393
+ endNewInstance();
1394
+ }
1395
+ if (Cstr.style) {
1396
+ // this component has styles but we haven't registered them yet
1397
+ let style = Cstr.style;
1398
+ const scopeId = getScopeId(cmpMeta);
1399
+ if (!styles.has(scopeId)) {
1400
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1401
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1402
+ endRegisterStyles();
1403
+ }
1404
+ }
1405
+ }
1406
+ // we've successfully created a lazy instance
1407
+ const ancestorComponent = hostRef.$ancestorComponent$;
1408
+ const schedule = () => scheduleUpdate(hostRef, true);
1409
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1410
+ // this is the intial load and this component it has an ancestor component
1411
+ // but the ancestor component has NOT fired its will update lifecycle yet
1412
+ // so let's just cool our jets and wait for the ancestor to continue first
1413
+ // this will get fired off when the ancestor component
1414
+ // finally gets around to rendering its lazy self
1415
+ // fire off the initial update
1416
+ ancestorComponent['s-rc'].push(schedule);
1417
+ }
1418
+ else {
1419
+ schedule();
1420
+ }
1421
+ };
1422
+ const connectedCallback = (elm) => {
1423
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1424
+ const hostRef = getHostRef(elm);
1425
+ const cmpMeta = hostRef.$cmpMeta$;
1426
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1427
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1428
+ // first time this component has connected
1429
+ hostRef.$flags$ |= 1 /* hasConnected */;
1430
+ {
1431
+ // initUpdate
1432
+ // if the slot polyfill is required we'll need to put some nodes
1433
+ // in here to act as original content anchors as we move nodes around
1434
+ // host element has been connected to the DOM
1435
+ if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1436
+ setContentReference(elm);
1437
+ }
1438
+ }
1439
+ {
1440
+ // find the first ancestor component (if there is one) and register
1441
+ // this component as one of the actively loading child components for its ancestor
1442
+ let ancestorComponent = elm;
1443
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1444
+ // climb up the ancestors looking for the first
1445
+ // component that hasn't finished its lifecycle update yet
1446
+ if (ancestorComponent['s-p']) {
1447
+ // we found this components first ancestor component
1448
+ // keep a reference to this component's ancestor component
1449
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1450
+ break;
1451
+ }
1452
+ }
1453
+ }
1454
+ // Lazy properties
1455
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1456
+ if (cmpMeta.$members$) {
1457
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1458
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1459
+ const value = elm[memberName];
1460
+ delete elm[memberName];
1461
+ elm[memberName] = value;
1462
+ }
1463
+ });
1464
+ }
1465
+ {
1466
+ initializeComponent(elm, hostRef, cmpMeta);
1467
+ }
1468
+ }
1469
+ else {
1470
+ // not the first time this has connected
1471
+ // reattach any event listeners to the host
1472
+ // since they would have been removed when disconnected
1473
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1474
+ }
1475
+ endConnected();
1476
+ }
1477
+ };
1478
+ const setContentReference = (elm) => {
1479
+ // only required when we're NOT using native shadow dom (slot)
1480
+ // or this browser doesn't support native shadow dom
1481
+ // and this host element was NOT created with SSR
1482
+ // let's pick out the inner content for slot projection
1483
+ // create a node to represent where the original
1484
+ // content was first placed, which is useful later on
1485
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1486
+ contentRefElm['s-cn'] = true;
1487
+ elm.insertBefore(contentRefElm, elm.firstChild);
1488
+ };
1489
+ const disconnectedCallback = (elm) => {
1490
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1491
+ const hostRef = getHostRef(elm);
1492
+ {
1493
+ if (hostRef.$rmListeners$) {
1494
+ hostRef.$rmListeners$.map(rmListener => rmListener());
1495
+ hostRef.$rmListeners$ = undefined;
1496
+ }
1497
+ }
1498
+ }
1499
+ };
1500
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1501
+ const endBootstrap = createTime();
1502
+ const cmpTags = [];
1503
+ const exclude = options.exclude || [];
1504
+ const customElements = win.customElements;
1505
+ const head = doc.head;
1506
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1507
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1508
+ const deferredConnectedCallbacks = [];
1509
+ let appLoadFallback;
1510
+ let isBootstrapping = true;
1511
+ Object.assign(plt, options);
1512
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1513
+ lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
1514
+ const cmpMeta = {
1515
+ $flags$: compactMeta[0],
1516
+ $tagName$: compactMeta[1],
1517
+ $members$: compactMeta[2],
1518
+ $listeners$: compactMeta[3],
1519
+ };
1520
+ {
1521
+ cmpMeta.$members$ = compactMeta[2];
1522
+ }
1523
+ {
1524
+ cmpMeta.$listeners$ = compactMeta[3];
1525
+ }
1526
+ {
1527
+ cmpMeta.$attrsToReflect$ = [];
1528
+ }
1529
+ {
1530
+ cmpMeta.$watchers$ = {};
1531
+ }
1532
+ const tagName = cmpMeta.$tagName$;
1533
+ const HostElement = class extends HTMLElement {
1534
+ // StencilLazyHost
1535
+ constructor(self) {
1536
+ // @ts-ignore
1537
+ super(self);
1538
+ self = this;
1539
+ registerHost(self, cmpMeta);
1540
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1541
+ // this component is using shadow dom
1542
+ // and this browser supports shadow dom
1543
+ // add the read-only property "shadowRoot" to the host element
1544
+ // adding the shadow root build conditionals to minimize runtime
1545
+ {
1546
+ {
1547
+ self.attachShadow({ mode: 'open' });
1548
+ }
1549
+ }
1550
+ }
1551
+ }
1552
+ connectedCallback() {
1553
+ if (appLoadFallback) {
1554
+ clearTimeout(appLoadFallback);
1555
+ appLoadFallback = null;
1556
+ }
1557
+ if (isBootstrapping) {
1558
+ // connectedCallback will be processed once all components have been registered
1559
+ deferredConnectedCallbacks.push(this);
1560
+ }
1561
+ else {
1562
+ plt.jmp(() => connectedCallback(this));
1563
+ }
1564
+ }
1565
+ disconnectedCallback() {
1566
+ plt.jmp(() => disconnectedCallback(this));
1567
+ }
1568
+ componentOnReady() {
1569
+ return getHostRef(this).$onReadyPromise$;
1570
+ }
1571
+ };
1572
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1573
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1574
+ cmpTags.push(tagName);
1575
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1576
+ }
1577
+ }));
1578
+ {
1579
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1580
+ visibilityStyle.setAttribute('data-styles', '');
1581
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1582
+ }
1583
+ // Process deferred connectedCallbacks now all components have been registered
1584
+ isBootstrapping = false;
1585
+ if (deferredConnectedCallbacks.length) {
1586
+ deferredConnectedCallbacks.map(host => host.connectedCallback());
1587
+ }
1588
+ else {
1589
+ {
1590
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1591
+ }
1592
+ }
1593
+ // Fallback appLoad event
1594
+ endBootstrap();
1595
+ };
1596
+ const getAssetPath = (path) => {
1597
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
1598
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
1599
+ };
1600
+ const hostRefs = new WeakMap();
1601
+ const getHostRef = (ref) => hostRefs.get(ref);
1602
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1603
+ const registerHost = (elm, cmpMeta) => {
1604
+ const hostRef = {
1605
+ $flags$: 0,
1606
+ $hostElement$: elm,
1607
+ $cmpMeta$: cmpMeta,
1608
+ $instanceValues$: new Map(),
1609
+ };
1610
+ {
1611
+ hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
1612
+ }
1613
+ {
1614
+ hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
1615
+ elm['s-p'] = [];
1616
+ elm['s-rc'] = [];
1617
+ }
1618
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1619
+ return hostRefs.set(elm, hostRef);
1620
+ };
1621
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1622
+ const consoleError = (e, el) => (0, console.error)(e, el);
1623
+ const cmpModules = /*@__PURE__*/ new Map();
1624
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1625
+ // loadModuleImport
1626
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1627
+ const bundleId = cmpMeta.$lazyBundleId$;
1628
+ const module = cmpModules.get(bundleId) ;
1629
+ if (module) {
1630
+ return module[exportName];
1631
+ }
1632
+ return import(
1633
+ /* webpackInclude: /\.entry\.js$/ */
1634
+ /* webpackExclude: /\.system\.entry\.js$/ */
1635
+ /* webpackMode: "lazy" */
1636
+ `./${bundleId}.entry.js${''}`).then(importedModule => {
1637
+ {
1638
+ cmpModules.set(bundleId, importedModule);
1639
+ }
1640
+ return importedModule[exportName];
1641
+ }, consoleError);
1642
+ };
1643
+ const styles = new Map();
1644
+ const queueDomReads = [];
1645
+ const queueDomWrites = [];
1646
+ const queueTask = (queue, write) => (cb) => {
1647
+ queue.push(cb);
1648
+ if (!queuePending) {
1649
+ queuePending = true;
1650
+ if (write && plt.$flags$ & 4 /* queueSync */) {
1651
+ nextTick(flush);
1652
+ }
1653
+ else {
1654
+ plt.raf(flush);
1655
+ }
1656
+ }
1657
+ };
1658
+ const consume = (queue) => {
1659
+ for (let i = 0; i < queue.length; i++) {
1660
+ try {
1661
+ queue[i](performance.now());
1662
+ }
1663
+ catch (e) {
1664
+ consoleError(e);
1665
+ }
1666
+ }
1667
+ queue.length = 0;
1668
+ };
1669
+ const flush = () => {
1670
+ // always force a bunch of medium callbacks to run, but still have
1671
+ // a throttle on how many can run in a certain time
1672
+ // DOM READS!!!
1673
+ consume(queueDomReads);
1674
+ // DOM WRITES!!!
1675
+ {
1676
+ consume(queueDomWrites);
1677
+ if ((queuePending = queueDomReads.length > 0)) {
1678
+ // still more to do yet, but we've run out of time
1679
+ // let's let this thing cool off and try again in the next tick
1680
+ plt.raf(flush);
1681
+ }
1682
+ }
1683
+ };
1684
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1685
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1686
+
1687
+ export { Host as H, getElement as a, bootstrapLazy as b, createEvent as c, getAssetPath as g, h, promiseResolve as p, registerInstance as r };