@limetech/lime-elements 36.1.0-next.8 → 36.1.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 (277) hide show
  1. package/dist/cjs/{checkbox.template-b6c6562c.js → checkbox.template-ac867c17.js} +1 -1
  2. package/dist/cjs/{index-2a28697b.js → index-287e25e0.js} +424 -246
  3. package/dist/cjs/lime-elements.cjs.js +3 -3
  4. package/dist/cjs/limel-badge.cjs.entry.js +2 -1
  5. package/dist/cjs/limel-banner.cjs.entry.js +3 -1
  6. package/dist/cjs/limel-button-group.cjs.entry.js +3 -8
  7. package/dist/cjs/{limel-button.cjs.entry.js → limel-button_2.cjs.entry.js} +117 -21
  8. package/dist/cjs/limel-checkbox.cjs.entry.js +10 -26
  9. package/dist/cjs/limel-chip-set.cjs.entry.js +21 -52
  10. package/dist/cjs/{limel-linear-progress.cjs.entry.js → limel-circular-progress_2.cjs.entry.js} +34 -7
  11. package/dist/cjs/limel-code-editor.cjs.entry.js +110 -97
  12. package/dist/cjs/limel-collapsible-section.cjs.entry.js +4 -5
  13. package/dist/cjs/limel-color-picker-palette.cjs.entry.js +5 -1
  14. package/dist/cjs/limel-color-picker.cjs.entry.js +8 -2
  15. package/dist/cjs/limel-config.cjs.entry.js +2 -1
  16. package/dist/cjs/limel-date-picker.cjs.entry.js +15 -33
  17. package/dist/cjs/limel-dialog.cjs.entry.js +4 -12
  18. package/dist/cjs/limel-dock-button.cjs.entry.js +5 -15
  19. package/dist/cjs/limel-dock.cjs.entry.js +8 -40
  20. package/dist/cjs/limel-file.cjs.entry.js +10 -24
  21. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +149 -48
  22. package/dist/cjs/limel-flex-container.cjs.entry.js +1 -13
  23. package/dist/cjs/limel-form.cjs.entry.js +328 -327
  24. package/dist/cjs/limel-grid.cjs.entry.js +1 -1
  25. package/dist/cjs/limel-header.cjs.entry.js +5 -1
  26. package/dist/cjs/limel-icon-button.cjs.entry.js +3 -8
  27. package/dist/cjs/limel-icon.cjs.entry.js +4 -1
  28. package/dist/cjs/limel-info-tile.cjs.entry.js +95 -0
  29. package/dist/cjs/limel-input-field.cjs.entry.js +27 -60
  30. package/dist/cjs/limel-list_2.cjs.entry.js +10 -21
  31. package/dist/cjs/limel-menu-list.cjs.entry.js +7 -14
  32. package/dist/cjs/limel-picker.cjs.entry.js +14 -39
  33. package/dist/cjs/limel-popover_4.cjs.entry.js +13 -12
  34. package/dist/cjs/limel-portal.cjs.entry.js +63 -73
  35. package/dist/cjs/limel-progress-flow-item.cjs.entry.js +4 -13
  36. package/dist/cjs/limel-progress-flow.cjs.entry.js +4 -20
  37. package/dist/cjs/limel-select.cjs.entry.js +20 -32
  38. package/dist/cjs/limel-shortcut.cjs.entry.js +52 -0
  39. package/dist/cjs/limel-slider.cjs.entry.js +12 -33
  40. package/dist/cjs/limel-snackbar.cjs.entry.js +7 -5
  41. package/dist/cjs/limel-spinner.cjs.entry.js +1 -7
  42. package/dist/cjs/limel-split-button.cjs.entry.js +35 -0
  43. package/dist/cjs/limel-switch.cjs.entry.js +6 -19
  44. package/dist/cjs/limel-tab-bar.cjs.entry.js +2 -5
  45. package/dist/cjs/limel-tab-panel.cjs.entry.js +2 -5
  46. package/dist/cjs/limel-table.cjs.entry.js +16 -28
  47. package/dist/cjs/loader.cjs.js +3 -3
  48. package/dist/cjs/{translations-5a8d7f6c.js → translations-ca7279bc.js} +6 -0
  49. package/dist/collection/collection-manifest.json +5 -2
  50. package/dist/collection/components/badge/badge.js +35 -26
  51. package/dist/collection/components/banner/banner.js +88 -83
  52. package/dist/collection/components/button/button.css +4 -1
  53. package/dist/collection/components/button/button.js +148 -160
  54. package/dist/collection/components/button-group/button-group.js +81 -79
  55. package/dist/collection/components/checkbox/checkbox.js +172 -176
  56. package/dist/collection/components/checkbox/checkbox.template.js +15 -23
  57. package/dist/collection/components/chip-set/chip-set.js +486 -528
  58. package/dist/collection/components/circular-progress/circular-progress.css +27 -5
  59. package/dist/collection/components/circular-progress/circular-progress.js +129 -113
  60. package/dist/collection/components/code-editor/code-editor.js +178 -182
  61. package/dist/collection/components/collapsible-section/collapsible-section.js +120 -124
  62. package/dist/collection/components/color-picker/color-picker-palette.js +102 -92
  63. package/dist/collection/components/color-picker/color-picker.js +143 -131
  64. package/dist/collection/components/config/config.js +21 -17
  65. package/dist/collection/components/date-picker/date-picker.js +254 -261
  66. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.css +591 -166
  67. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.js +150 -143
  68. package/dist/collection/components/date-picker/pickers/QuarterPicker.js +1 -3
  69. package/dist/collection/components/dialog/dialog.css +7 -1
  70. package/dist/collection/components/dialog/dialog.js +134 -142
  71. package/dist/collection/components/dock/dock-button/dock-button.js +138 -141
  72. package/dist/collection/components/dock/dock.js +204 -233
  73. package/dist/collection/components/file/file.js +187 -191
  74. package/dist/collection/components/flex-container/flex-container.js +96 -102
  75. package/dist/collection/components/form/form.js +158 -150
  76. package/dist/collection/components/form/widgets/code-editor.js +2 -0
  77. package/dist/collection/components/grid/grid.js +11 -7
  78. package/dist/collection/components/header/header.js +89 -87
  79. package/dist/collection/components/icon/icon.js +79 -66
  80. package/dist/collection/components/icon-button/icon-button.js +85 -85
  81. package/dist/collection/components/info-tile/info-tile.css +310 -0
  82. package/dist/collection/components/info-tile/info-tile.js +294 -0
  83. package/dist/collection/components/info-tile/info-tile.types.js +1 -0
  84. package/dist/collection/components/input-field/input-field.css +3 -0
  85. package/dist/collection/components/input-field/input-field.js +482 -523
  86. package/dist/collection/components/linear-progress/linear-progress.js +57 -61
  87. package/dist/collection/components/list/list-renderer.js +3 -12
  88. package/dist/collection/components/list/list.css +11 -116
  89. package/dist/collection/components/list/list.js +167 -166
  90. package/dist/collection/components/list/radio-button/radio-button.template.js +2 -8
  91. package/dist/collection/components/menu/menu.js +183 -195
  92. package/dist/collection/components/menu-list/menu-list-renderer.js +2 -9
  93. package/dist/collection/components/menu-list/menu-list.css +11 -116
  94. package/dist/collection/components/menu-list/menu-list.js +149 -146
  95. package/dist/collection/components/menu-surface/menu-surface.js +69 -64
  96. package/dist/collection/components/picker/picker.js +412 -427
  97. package/dist/collection/components/popover/popover.js +79 -74
  98. package/dist/collection/components/popover-surface/popover-surface.js +34 -25
  99. package/dist/collection/components/portal/portal.js +145 -158
  100. package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.js +90 -94
  101. package/dist/collection/components/progress-flow/progress-flow.js +93 -101
  102. package/dist/collection/components/select/select.css +8 -7
  103. package/dist/collection/components/select/select.js +206 -211
  104. package/dist/collection/components/select/select.template.js +18 -27
  105. package/dist/collection/components/shortcut/shortcut.css +91 -0
  106. package/dist/collection/components/shortcut/shortcut.js +161 -0
  107. package/dist/collection/components/slider/slider.js +233 -264
  108. package/dist/collection/components/snackbar/snackbar.js +175 -169
  109. package/dist/collection/components/spinner/spinner.js +56 -85
  110. package/dist/collection/components/split-button/split-button.css +84 -0
  111. package/dist/collection/components/split-button/split-button.js +176 -0
  112. package/dist/collection/components/switch/switch.js +117 -129
  113. package/dist/collection/components/tab-bar/tab-bar.js +87 -92
  114. package/dist/collection/components/tab-panel/tab-panel.js +64 -61
  115. package/dist/collection/components/table/table.js +447 -457
  116. package/dist/collection/components/tooltip/tooltip-content.js +70 -61
  117. package/dist/collection/components/tooltip/tooltip.js +96 -91
  118. package/dist/collection/global/shared-types/link.types.js +1 -0
  119. package/dist/collection/style/internal/z-index.scss +0 -5
  120. package/dist/collection/translations/da.js +1 -0
  121. package/dist/collection/translations/en.js +1 -0
  122. package/dist/collection/translations/fi.js +1 -0
  123. package/dist/collection/translations/nl.js +1 -0
  124. package/dist/collection/translations/no.js +1 -0
  125. package/dist/collection/translations/sv.js +1 -0
  126. package/dist/esm/{checkbox.template-2f1bbc98.js → checkbox.template-fc7fcd06.js} +1 -1
  127. package/dist/esm/{index-11cd0b60.js → index-cdfd351d.js} +424 -246
  128. package/dist/esm/lime-elements.js +3 -3
  129. package/dist/esm/limel-badge.entry.js +2 -1
  130. package/dist/esm/limel-banner.entry.js +3 -1
  131. package/dist/esm/limel-button-group.entry.js +3 -8
  132. package/dist/esm/{limel-button.entry.js → limel-button_2.entry.js} +117 -22
  133. package/dist/esm/limel-checkbox.entry.js +10 -26
  134. package/dist/esm/limel-chip-set.entry.js +21 -52
  135. package/dist/esm/{limel-linear-progress.entry.js → limel-circular-progress_2.entry.js} +34 -8
  136. package/dist/esm/limel-code-editor.entry.js +110 -97
  137. package/dist/esm/limel-collapsible-section.entry.js +4 -5
  138. package/dist/esm/limel-color-picker-palette.entry.js +5 -1
  139. package/dist/esm/limel-color-picker.entry.js +8 -2
  140. package/dist/esm/limel-config.entry.js +2 -1
  141. package/dist/esm/limel-date-picker.entry.js +15 -33
  142. package/dist/esm/limel-dialog.entry.js +4 -12
  143. package/dist/esm/limel-dock-button.entry.js +5 -15
  144. package/dist/esm/limel-dock.entry.js +8 -40
  145. package/dist/esm/limel-file.entry.js +10 -24
  146. package/dist/esm/limel-flatpickr-adapter.entry.js +149 -48
  147. package/dist/esm/limel-flex-container.entry.js +1 -13
  148. package/dist/esm/limel-form.entry.js +328 -327
  149. package/dist/esm/limel-grid.entry.js +1 -1
  150. package/dist/esm/limel-header.entry.js +5 -1
  151. package/dist/esm/limel-icon-button.entry.js +3 -8
  152. package/dist/esm/limel-icon.entry.js +4 -1
  153. package/dist/esm/limel-info-tile.entry.js +91 -0
  154. package/dist/esm/limel-input-field.entry.js +27 -60
  155. package/dist/esm/limel-list_2.entry.js +10 -21
  156. package/dist/esm/limel-menu-list.entry.js +7 -14
  157. package/dist/esm/limel-picker.entry.js +14 -39
  158. package/dist/esm/limel-popover_4.entry.js +13 -12
  159. package/dist/esm/limel-portal.entry.js +63 -73
  160. package/dist/esm/limel-progress-flow-item.entry.js +4 -13
  161. package/dist/esm/limel-progress-flow.entry.js +4 -20
  162. package/dist/esm/limel-select.entry.js +20 -32
  163. package/dist/esm/limel-shortcut.entry.js +48 -0
  164. package/dist/esm/limel-slider.entry.js +12 -33
  165. package/dist/esm/limel-snackbar.entry.js +7 -5
  166. package/dist/esm/limel-spinner.entry.js +1 -7
  167. package/dist/esm/limel-split-button.entry.js +31 -0
  168. package/dist/esm/limel-switch.entry.js +6 -19
  169. package/dist/esm/limel-tab-bar.entry.js +2 -5
  170. package/dist/esm/limel-tab-panel.entry.js +2 -5
  171. package/dist/esm/limel-table.entry.js +16 -28
  172. package/dist/esm/loader.js +3 -3
  173. package/dist/esm/polyfills/css-shim.js +1 -1
  174. package/dist/esm/{translations-682e905e.js → translations-0d0ee941.js} +6 -0
  175. package/dist/lime-elements/lime-elements.esm.js +1 -1
  176. package/dist/lime-elements/p-059e0a64.entry.js +1 -0
  177. package/dist/lime-elements/{p-440454ed.entry.js → p-06f2f6b4.entry.js} +1 -1
  178. package/dist/lime-elements/p-12a7453b.entry.js +73 -0
  179. package/dist/lime-elements/p-1386d86d.entry.js +82 -0
  180. package/dist/lime-elements/p-15c2eb16.entry.js +1 -0
  181. package/dist/lime-elements/{p-c80acfb2.entry.js → p-15ca0d70.entry.js} +4 -4
  182. package/dist/lime-elements/{p-ed65468d.entry.js → p-16eb9071.entry.js} +1 -1
  183. package/dist/lime-elements/{p-1ede893b.js → p-1af8258b.js} +1 -1
  184. package/dist/lime-elements/{p-71efe2ca.entry.js → p-21058db5.entry.js} +4 -3
  185. package/dist/lime-elements/p-246862ec.js +1 -0
  186. package/dist/lime-elements/p-36a3b897.entry.js +1 -0
  187. package/dist/lime-elements/p-4eda8b67.entry.js +82 -0
  188. package/dist/lime-elements/{p-9af0704c.entry.js → p-4fb4e89b.entry.js} +1 -1
  189. package/dist/lime-elements/p-4fc38050.entry.js +1 -0
  190. package/dist/lime-elements/{p-a5af84a7.entry.js → p-5338663b.entry.js} +1 -1
  191. package/dist/lime-elements/p-5ce60a32.entry.js +126 -0
  192. package/dist/lime-elements/p-5f13035a.entry.js +1 -0
  193. package/dist/lime-elements/p-5f29f099.entry.js +16 -0
  194. package/dist/lime-elements/p-600464a9.entry.js +1 -0
  195. package/dist/lime-elements/p-6534e16a.entry.js +1 -0
  196. package/dist/lime-elements/p-6a4a5ddd.entry.js +1 -0
  197. package/dist/lime-elements/p-6c38b505.entry.js +1 -0
  198. package/dist/lime-elements/p-75d01713.entry.js +1 -0
  199. package/dist/lime-elements/p-768b7cbb.entry.js +1 -0
  200. package/dist/lime-elements/{p-6e7809a6.entry.js → p-82cd7bb6.entry.js} +1 -1
  201. package/dist/lime-elements/p-84a137a7.entry.js +1 -0
  202. package/dist/lime-elements/{p-aa66620a.entry.js → p-8ab597a8.entry.js} +2 -2
  203. package/dist/lime-elements/{p-8827628d.entry.js → p-8fb83e83.entry.js} +2 -2
  204. package/dist/lime-elements/p-90961075.entry.js +1 -0
  205. package/dist/lime-elements/p-9984b31c.entry.js +1 -0
  206. package/dist/lime-elements/p-9bd76629.entry.js +59 -0
  207. package/dist/lime-elements/p-9ea8dd5c.entry.js +1 -0
  208. package/dist/lime-elements/p-cad7cda1.entry.js +16 -0
  209. package/dist/lime-elements/{p-104c89e8.entry.js → p-cfaa685f.entry.js} +1 -1
  210. package/dist/lime-elements/{p-94899019.entry.js → p-d1187867.entry.js} +1 -1
  211. package/dist/lime-elements/p-d4e788e1.js +2 -0
  212. package/dist/lime-elements/p-d512656b.entry.js +1 -0
  213. package/dist/lime-elements/p-d8e5a9ee.entry.js +1 -0
  214. package/dist/lime-elements/p-de161bb5.entry.js +1 -0
  215. package/dist/lime-elements/p-e4bca82b.entry.js +1 -0
  216. package/dist/lime-elements/p-e6f84d68.entry.js +1 -0
  217. package/dist/lime-elements/{p-c15da26d.entry.js → p-e7bb664f.entry.js} +1 -1
  218. package/dist/lime-elements/p-e88f7922.entry.js +1 -0
  219. package/dist/lime-elements/p-ec4c075d.entry.js +1 -0
  220. package/dist/lime-elements/p-f1ed857b.entry.js +37 -0
  221. package/dist/lime-elements/p-f33cfcb8.entry.js +11 -0
  222. package/dist/lime-elements/style/internal/z-index.scss +0 -5
  223. package/dist/loader/package.json +1 -0
  224. package/dist/types/components/circular-progress/circular-progress.d.ts +5 -0
  225. package/dist/types/components/dock/dock.d.ts +0 -1
  226. package/dist/types/components/info-tile/info-tile.d.ts +87 -0
  227. package/dist/types/components/info-tile/info-tile.types.d.ts +23 -0
  228. package/dist/types/components/picker/picker.d.ts +2 -2
  229. package/dist/types/components/shortcut/shortcut.d.ts +42 -0
  230. package/dist/types/components/split-button/split-button.d.ts +46 -0
  231. package/dist/types/components.d.ts +403 -67
  232. package/dist/types/global/shared-types/link.types.d.ts +25 -0
  233. package/dist/types/interface.d.ts +2 -0
  234. package/dist/types/stencil-public-runtime.d.ts +20 -4
  235. package/dist/types/translations/da.d.ts +1 -0
  236. package/dist/types/translations/en.d.ts +1 -0
  237. package/dist/types/translations/fi.d.ts +1 -0
  238. package/dist/types/translations/nl.d.ts +1 -0
  239. package/dist/types/translations/no.d.ts +1 -0
  240. package/dist/types/translations/sv.d.ts +1 -0
  241. package/package.json +25 -24
  242. package/dist/cjs/limel-circular-progress.cjs.entry.js +0 -44
  243. package/dist/cjs/limel-menu.cjs.entry.js +0 -137
  244. package/dist/esm/limel-circular-progress.entry.js +0 -40
  245. package/dist/esm/limel-menu.entry.js +0 -133
  246. package/dist/lime-elements/p-009de50e.entry.js +0 -1
  247. package/dist/lime-elements/p-0ba0c38a.entry.js +0 -11
  248. package/dist/lime-elements/p-19f72dab.entry.js +0 -1
  249. package/dist/lime-elements/p-2639edf9.entry.js +0 -73
  250. package/dist/lime-elements/p-2fc4f4ff.entry.js +0 -1
  251. package/dist/lime-elements/p-3bf54a4c.js +0 -1
  252. package/dist/lime-elements/p-3cf4aae0.entry.js +0 -1
  253. package/dist/lime-elements/p-41e902ac.entry.js +0 -126
  254. package/dist/lime-elements/p-4dc07252.entry.js +0 -82
  255. package/dist/lime-elements/p-53e01330.entry.js +0 -1
  256. package/dist/lime-elements/p-5ef52589.entry.js +0 -1
  257. package/dist/lime-elements/p-629862f4.entry.js +0 -1
  258. package/dist/lime-elements/p-63e25a0a.entry.js +0 -1
  259. package/dist/lime-elements/p-6b1bc80f.entry.js +0 -1
  260. package/dist/lime-elements/p-93cd2268.entry.js +0 -1
  261. package/dist/lime-elements/p-95f275ab.entry.js +0 -1
  262. package/dist/lime-elements/p-9917f042.entry.js +0 -16
  263. package/dist/lime-elements/p-995bbd2a.entry.js +0 -1
  264. package/dist/lime-elements/p-a465084b.entry.js +0 -82
  265. package/dist/lime-elements/p-b0046fcd.entry.js +0 -1
  266. package/dist/lime-elements/p-b0e54dc2.entry.js +0 -1
  267. package/dist/lime-elements/p-b4de3380.entry.js +0 -1
  268. package/dist/lime-elements/p-c59cbd68.entry.js +0 -1
  269. package/dist/lime-elements/p-cb8db8c2.entry.js +0 -37
  270. package/dist/lime-elements/p-d74fa89e.entry.js +0 -1
  271. package/dist/lime-elements/p-e98d76e8.entry.js +0 -59
  272. package/dist/lime-elements/p-e9a95b8f.js +0 -1
  273. package/dist/lime-elements/p-eec907ac.entry.js +0 -1
  274. package/dist/lime-elements/p-f0c9dadd.entry.js +0 -1
  275. package/dist/lime-elements/p-f0e872b6.entry.js +0 -16
  276. package/dist/lime-elements/p-f41567a1.entry.js +0 -1
  277. package/dist/lime-elements/p-f5df4d4f.entry.js +0 -1
@@ -1,66 +1,17 @@
1
1
  const NAMESPACE = 'lime-elements';
2
2
 
3
+ /**
4
+ * Virtual DOM patching algorithm based on Snabbdom by
5
+ * Simon Friis Vindum (@paldepind)
6
+ * Licensed under the MIT License
7
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
8
+ *
9
+ * Modified for Stencil's renderer and slot projection
10
+ */
3
11
  let scopeId;
4
12
  let hostTagName;
5
13
  let isSvgMode = false;
6
14
  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 addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
29
- if (listeners) {
30
- listeners.map(([flags, name, method]) => {
31
- const target = getHostListenerTarget(elm, flags) ;
32
- const handler = hostListenerProxy(hostRef, method);
33
- const opts = hostListenerOpts(flags);
34
- plt.ael(target, name, handler, opts);
35
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
36
- });
37
- }
38
- };
39
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
40
- try {
41
- {
42
- if (hostRef.$flags$ & 256 /* isListenReady */) {
43
- // instance is ready, let's call it's member method for this event
44
- hostRef.$lazyInstance$[methodName](ev);
45
- }
46
- else {
47
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
48
- }
49
- }
50
- }
51
- catch (e) {
52
- consoleError(e);
53
- }
54
- };
55
- const getHostListenerTarget = (elm, flags) => {
56
- if (flags & 8 /* TargetWindow */)
57
- return win;
58
- return elm;
59
- };
60
- // prettier-ignore
61
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
62
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
63
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
64
15
  const createTime = (fnName, tagName = '') => {
65
16
  {
66
17
  return () => {
@@ -75,71 +26,8 @@ const uniqueTime = (key, measureText) => {
75
26
  };
76
27
  }
77
28
  };
78
- const rootAppliedStyles = new WeakMap();
79
- const registerStyle = (scopeId, cssText, allowCS) => {
80
- let style = styles.get(scopeId);
81
- if (supportsConstructibleStylesheets && allowCS) {
82
- style = (style || new CSSStyleSheet());
83
- style.replace(cssText);
84
- }
85
- else {
86
- style = cssText;
87
- }
88
- styles.set(scopeId, style);
89
- };
90
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
91
- let scopeId = getScopeId(cmpMeta);
92
- let style = styles.get(scopeId);
93
- // if an element is NOT connected then getRootNode() will return the wrong root node
94
- // so the fallback is to always use the document for the root node in those cases
95
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
96
- if (style) {
97
- if (typeof style === 'string') {
98
- styleContainerNode = styleContainerNode.head || styleContainerNode;
99
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
100
- let styleElm;
101
- if (!appliedStyles) {
102
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
103
- }
104
- if (!appliedStyles.has(scopeId)) {
105
- {
106
- {
107
- styleElm = doc.createElement('style');
108
- styleElm.innerHTML = style;
109
- }
110
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
111
- }
112
- if (appliedStyles) {
113
- appliedStyles.add(scopeId);
114
- }
115
- }
116
- }
117
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
118
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
119
- }
120
- }
121
- return scopeId;
122
- };
123
- const attachStyles = (hostRef) => {
124
- const cmpMeta = hostRef.$cmpMeta$;
125
- const elm = hostRef.$hostElement$;
126
- const flags = cmpMeta.$flags$;
127
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
128
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
129
- if (flags & 10 /* needsScopedEncapsulation */) {
130
- // only required when we're NOT using native shadow dom (slot)
131
- // or this browser doesn't support native shadow dom
132
- // and this host element was NOT created with SSR
133
- // let's pick out the inner content for slot projection
134
- // create a node to represent where the original
135
- // content was first placed, which is useful later on
136
- // DOM WRITE!!
137
- elm['s-sc'] = scopeId;
138
- elm.classList.add(scopeId + '-h');
139
- }
140
- endAttachStyles();
141
- };
142
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
29
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
30
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
143
31
  /**
144
32
  * Default style mode id
145
33
  */
@@ -175,7 +63,7 @@ const h = (nodeName, vnodeData, ...children) => {
175
63
  let key = null;
176
64
  let simple = false;
177
65
  let lastSimple = false;
178
- let vNodeChildren = [];
66
+ const vNodeChildren = [];
179
67
  const walk = (c) => {
180
68
  for (let i = 0; i < c.length; i++) {
181
69
  child = c[i];
@@ -278,6 +166,149 @@ const convertToPrivate = (node) => {
278
166
  vnode.$name$ = node.vname;
279
167
  return vnode;
280
168
  };
169
+ /**
170
+ * Parse a new property value for a given property type.
171
+ *
172
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
173
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
174
+ * 1. `any`, the type given to `propValue` in the function signature
175
+ * 2. the type stored from `propType`.
176
+ *
177
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
178
+ *
179
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
180
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
181
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
182
+ * ```tsx
183
+ * <my-cmp prop-val={0}></my-cmp>
184
+ * ```
185
+ *
186
+ * HTML prop values on the other hand, will always a string
187
+ *
188
+ * @param propValue the new value to coerce to some type
189
+ * @param propType the type of the prop, expressed as a binary number
190
+ * @returns the parsed/coerced value
191
+ */
192
+ const parsePropertyValue = (propValue, propType) => {
193
+ // ensure this value is of the correct prop type
194
+ if (propValue != null && !isComplexType(propValue)) {
195
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
196
+ // per the HTML spec, any string value means it is a boolean true value
197
+ // but we'll cheat here and say that the string "false" is the boolean false
198
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
199
+ }
200
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
201
+ // force it to be a number
202
+ return parseFloat(propValue);
203
+ }
204
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
205
+ // could have been passed as a number or boolean
206
+ // but we still want it as a string
207
+ return String(propValue);
208
+ }
209
+ // redundant return here for better minification
210
+ return propValue;
211
+ }
212
+ // not sure exactly what type we want
213
+ // so no need to change to a different type
214
+ return propValue;
215
+ };
216
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
217
+ const createEvent = (ref, name, flags) => {
218
+ const elm = getElement(ref);
219
+ return {
220
+ emit: (detail) => {
221
+ return emitEvent(elm, name, {
222
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
223
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
224
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
225
+ detail,
226
+ });
227
+ },
228
+ };
229
+ };
230
+ /**
231
+ * Helper function to create & dispatch a custom Event on a provided target
232
+ * @param elm the target of the Event
233
+ * @param name the name to give the custom Event
234
+ * @param opts options for configuring a custom Event
235
+ * @returns the custom Event
236
+ */
237
+ const emitEvent = (elm, name, opts) => {
238
+ const ev = plt.ce(name, opts);
239
+ elm.dispatchEvent(ev);
240
+ return ev;
241
+ };
242
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
243
+ const registerStyle = (scopeId, cssText, allowCS) => {
244
+ let style = styles.get(scopeId);
245
+ if (supportsConstructableStylesheets && allowCS) {
246
+ style = (style || new CSSStyleSheet());
247
+ if (typeof style === 'string') {
248
+ style = cssText;
249
+ }
250
+ else {
251
+ style.replaceSync(cssText);
252
+ }
253
+ }
254
+ else {
255
+ style = cssText;
256
+ }
257
+ styles.set(scopeId, style);
258
+ };
259
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
260
+ let scopeId = getScopeId(cmpMeta);
261
+ const style = styles.get(scopeId);
262
+ // if an element is NOT connected then getRootNode() will return the wrong root node
263
+ // so the fallback is to always use the document for the root node in those cases
264
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
265
+ if (style) {
266
+ if (typeof style === 'string') {
267
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
268
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
269
+ let styleElm;
270
+ if (!appliedStyles) {
271
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
272
+ }
273
+ if (!appliedStyles.has(scopeId)) {
274
+ {
275
+ {
276
+ styleElm = doc.createElement('style');
277
+ styleElm.innerHTML = style;
278
+ }
279
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
280
+ }
281
+ if (appliedStyles) {
282
+ appliedStyles.add(scopeId);
283
+ }
284
+ }
285
+ }
286
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
287
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
288
+ }
289
+ }
290
+ return scopeId;
291
+ };
292
+ const attachStyles = (hostRef) => {
293
+ const cmpMeta = hostRef.$cmpMeta$;
294
+ const elm = hostRef.$hostElement$;
295
+ const flags = cmpMeta.$flags$;
296
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
297
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
298
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
299
+ // only required when we're NOT using native shadow dom (slot)
300
+ // or this browser doesn't support native shadow dom
301
+ // and this host element was NOT created with SSR
302
+ // let's pick out the inner content for slot projection
303
+ // create a node to represent where the original
304
+ // content was first placed, which is useful later on
305
+ // DOM WRITE!!
306
+ elm['s-sc'] = scopeId;
307
+ elm.classList.add(scopeId + '-h');
308
+ }
309
+ endAttachStyles();
310
+ };
311
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
281
312
  /**
282
313
  * Production setAccessor() function based on Preact by
283
314
  * Jason Miller (@developit)
@@ -375,7 +406,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
375
406
  if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
376
407
  try {
377
408
  if (!elm.tagName.includes('-')) {
378
- let n = newValue == null ? '' : newValue;
409
+ const n = newValue == null ? '' : newValue;
379
410
  // Workaround for Safari, moving the <input> caret when re-assigning the same valued
380
411
  if (memberName === 'list') {
381
412
  isProp = false;
@@ -414,7 +445,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
414
445
  }
415
446
  }
416
447
  }
417
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
448
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
418
449
  newValue = newValue === true ? '' : newValue;
419
450
  if (xlink) {
420
451
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -432,7 +463,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
432
463
  // if the element passed in is a shadow root, which is a document fragment
433
464
  // then we want to be adding attrs/props to the shadow root's "host" element
434
465
  // if it's not a shadow root, then we add attrs/props to the same element
435
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
466
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
436
467
  ? newVnode.$elm$.host
437
468
  : newVnode.$elm$;
438
469
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -450,9 +481,19 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
450
481
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
451
482
  }
452
483
  };
484
+ /**
485
+ * Create a DOM Node corresponding to one of the children of a given VNode.
486
+ *
487
+ * @param oldParentVNode the parent VNode from the previous render
488
+ * @param newParentVNode the parent VNode from the current render
489
+ * @param childIndex the index of the VNode, in the _new_ parent node's
490
+ * children, for which we will create a new DOM node
491
+ * @param parentElm the parent DOM node which our new node will be a child of
492
+ * @returns the newly created node
493
+ */
453
494
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
454
495
  // tslint:disable-next-line: prefer-const
455
- let newVNode = newParentVNode.$children$[childIndex];
496
+ const newVNode = newParentVNode.$children$[childIndex];
456
497
  let i = 0;
457
498
  let elm;
458
499
  let childNode;
@@ -529,6 +570,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
529
570
  }
530
571
  }
531
572
  };
573
+ /**
574
+ * Reconcile the children of a new VNode with the children of an old VNode by
575
+ * traversing the two collections of children, identifying nodes that are
576
+ * conserved or changed, calling out to `patch` to make any necessary
577
+ * updates to the DOM, and rearranging DOM nodes as needed.
578
+ *
579
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
580
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
581
+ * 'windows' by storing start and end indices and references to the
582
+ * corresponding array entries. Initially the two 'windows' are basically equal
583
+ * to the entire array, but we progressively narrow the windows until there are
584
+ * no children left to update by doing the following:
585
+ *
586
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
587
+ * that if we have an initial array like the following we'll end up dealing
588
+ * only with a window bounded by the highlighted elements:
589
+ *
590
+ * [null, null, VNode1 , ... , VNode2, null, null]
591
+ * ^^^^^^ ^^^^^^
592
+ *
593
+ * 2. Check to see if the elements at the head and tail positions are equal
594
+ * across the windows. This will basically detect elements which haven't
595
+ * been added, removed, or changed position, i.e. if you had the following
596
+ * VNode elements (represented as HTML):
597
+ *
598
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
599
+ * newVNode: `<div><p><span>THERE</span></p></div>`
600
+ *
601
+ * Then when comparing the children of the `<div>` tag we check the equality
602
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
603
+ * same tag in the same position, we'd be able to avoid completely
604
+ * re-rendering the subtree under them with a new DOM element and would just
605
+ * call out to `patch` to handle reconciling their children and so on.
606
+ *
607
+ * 3. Check, for both windows, to see if the element at the beginning of the
608
+ * window corresponds to the element at the end of the other window. This is
609
+ * a heuristic which will let us identify _some_ situations in which
610
+ * elements have changed position, for instance it _should_ detect that the
611
+ * children nodes themselves have not changed but merely moved in the
612
+ * following example:
613
+ *
614
+ * oldVNode: `<div><element-one /><element-two /></div>`
615
+ * newVNode: `<div><element-two /><element-one /></div>`
616
+ *
617
+ * If we find cases like this then we also need to move the concrete DOM
618
+ * elements corresponding to the moved children to write the re-order to the
619
+ * DOM.
620
+ *
621
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
622
+ * nodes in the old children which have the same key as the first element in
623
+ * our window on the new children. If we find such a node we handle calling
624
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
625
+ * what we find.
626
+ *
627
+ * Finally, once we've narrowed our 'windows' to the point that either of them
628
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
629
+ * insertion or deletion that needs to happen to get a DOM state that correctly
630
+ * reflects the new child VNodes. If, for instance, after our window on the old
631
+ * children has collapsed we still have more nodes on the new children that
632
+ * we haven't dealt with yet then we need to add them, or if the new children
633
+ * collapse but we still have unhandled _old_ children then we need to make
634
+ * sure the corresponding DOM nodes are removed.
635
+ *
636
+ * @param parentElm the node into which the parent VNode is rendered
637
+ * @param oldCh the old children of the parent node
638
+ * @param newVNode the new VNode which will replace the parent
639
+ * @param newCh the new children of the parent node
640
+ */
532
641
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
533
642
  let oldStartIdx = 0;
534
643
  let newStartIdx = 0;
@@ -544,7 +653,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
544
653
  let elmToMove;
545
654
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
546
655
  if (oldStartVnode == null) {
547
- // Vnode might have been moved left
656
+ // VNode might have been moved left
548
657
  oldStartVnode = oldCh[++oldStartIdx];
549
658
  }
550
659
  else if (oldEndVnode == null) {
@@ -557,29 +666,65 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
557
666
  newEndVnode = newCh[--newEndIdx];
558
667
  }
559
668
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
669
+ // if the start nodes are the same then we should patch the new VNode
670
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
671
+ // indices to reflect that. We don't need to move any DOM Nodes around
672
+ // since things are matched up in order.
560
673
  patch(oldStartVnode, newStartVnode);
561
674
  oldStartVnode = oldCh[++oldStartIdx];
562
675
  newStartVnode = newCh[++newStartIdx];
563
676
  }
564
677
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
678
+ // likewise, if the end nodes are the same we patch new onto old and
679
+ // decrement our end indices, and also likewise in this case we don't
680
+ // need to move any DOM Nodes.
565
681
  patch(oldEndVnode, newEndVnode);
566
682
  oldEndVnode = oldCh[--oldEndIdx];
567
683
  newEndVnode = newCh[--newEndIdx];
568
684
  }
569
685
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
570
686
  patch(oldStartVnode, newEndVnode);
687
+ // We need to move the element for `oldStartVnode` into a position which
688
+ // will be appropriate for `newEndVnode`. For this we can use
689
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
690
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
691
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
692
+ //
693
+ // <old-start-node />
694
+ // <some-intervening-node />
695
+ // <old-end-node />
696
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
697
+ // <next-sibling />
698
+ //
699
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
700
+ // the node for `oldStartVnode` at the end of the children of
701
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
702
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
703
+ // append it to the children of the parent element.
571
704
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
572
705
  oldStartVnode = oldCh[++oldStartIdx];
573
706
  newEndVnode = newCh[--newEndIdx];
574
707
  }
575
708
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
576
709
  patch(oldEndVnode, newStartVnode);
710
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
711
+ // the same node, so since we're here we know that they are not. Thus we
712
+ // can move the element for `oldEndVnode` _before_ the element for
713
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
714
+ // future.
577
715
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
578
716
  oldEndVnode = oldCh[--oldEndIdx];
579
717
  newStartVnode = newCh[++newStartIdx];
580
718
  }
581
719
  else {
582
- // createKeyToOldIdx
720
+ // Here we do some checks to match up old and new nodes based on the
721
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
722
+ // in the JSX for a DOM element in the implementation of a Stencil
723
+ // component.
724
+ //
725
+ // First we check to see if there are any nodes in the array of old
726
+ // children which have the same key as the first node in the new
727
+ // children.
583
728
  idxInOld = -1;
584
729
  {
585
730
  for (i = oldStartIdx; i <= oldEndIdx; ++i) {
@@ -590,23 +735,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
590
735
  }
591
736
  }
592
737
  if (idxInOld >= 0) {
738
+ // We found a node in the old children which matches up with the first
739
+ // node in the new children! So let's deal with that
593
740
  elmToMove = oldCh[idxInOld];
594
741
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
742
+ // the tag doesn't match so we'll need a new DOM element
595
743
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
596
744
  }
597
745
  else {
598
746
  patch(elmToMove, newStartVnode);
747
+ // invalidate the matching old node so that we won't try to update it
748
+ // again later on
599
749
  oldCh[idxInOld] = undefined;
600
750
  node = elmToMove.$elm$;
601
751
  }
602
752
  newStartVnode = newCh[++newStartIdx];
603
753
  }
604
754
  else {
605
- // new element
755
+ // We either didn't find an element in the old children that matches
756
+ // the key of the first new child OR the build is not using `key`
757
+ // attributes at all. In either case we need to create a new element
758
+ // for the new node.
606
759
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
607
760
  newStartVnode = newCh[++newStartIdx];
608
761
  }
609
762
  if (node) {
763
+ // if we created a new node then handle inserting it to the DOM
610
764
  {
611
765
  oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
612
766
  }
@@ -614,22 +768,52 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
614
768
  }
615
769
  }
616
770
  if (oldStartIdx > oldEndIdx) {
771
+ // we have some more new nodes to add which don't match up with old nodes
617
772
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
618
773
  }
619
774
  else if (newStartIdx > newEndIdx) {
775
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
776
+ // in the new array, so lets remove them (which entails cleaning up the
777
+ // relevant DOM nodes)
620
778
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
621
779
  }
622
780
  };
623
- const isSameVnode = (vnode1, vnode2) => {
781
+ /**
782
+ * Compare two VNodes to determine if they are the same
783
+ *
784
+ * **NB**: This function is an equality _heuristic_ based on the available
785
+ * information set on the two VNodes and can be misleading under certain
786
+ * circumstances. In particular, if the two nodes do not have `key` attrs
787
+ * (available under `$key$` on VNodes) then the function falls back on merely
788
+ * checking that they have the same tag.
789
+ *
790
+ * So, in other words, if `key` attrs are not set on VNodes which may be
791
+ * changing order within a `children` array or something along those lines then
792
+ * we could obtain a false positive and then have to do needless re-rendering.
793
+ *
794
+ * @param leftVNode the first VNode to check
795
+ * @param rightVNode the second VNode to check
796
+ * @returns whether they're equal or not
797
+ */
798
+ const isSameVnode = (leftVNode, rightVNode) => {
624
799
  // compare if two vnode to see if they're "technically" the same
625
800
  // need to have the same element tag, and same key to be the same
626
- if (vnode1.$tag$ === vnode2.$tag$) {
801
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
802
+ // this will be set if components in the build have `key` attrs set on them
627
803
  {
628
- return vnode1.$key$ === vnode2.$key$;
804
+ return leftVNode.$key$ === rightVNode.$key$;
629
805
  }
630
806
  }
631
807
  return false;
632
808
  };
809
+ /**
810
+ * Handle reconciling an outdated VNode with a new one which corresponds to
811
+ * it. This function handles flushing updates to the DOM and reconciling the
812
+ * children of the two nodes (if any).
813
+ *
814
+ * @param oldVNode an old VNode whose DOM element and children we want to update
815
+ * @param newVNode a new VNode representing an updated version of the old one
816
+ */
633
817
  const patch = (oldVNode, newVNode) => {
634
818
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
635
819
  const oldChildren = oldVNode.$children$;
@@ -642,7 +826,6 @@ const patch = (oldVNode, newVNode) => {
642
826
  // only add this to the when the compiler sees we're using an svg somewhere
643
827
  isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
644
828
  }
645
- // element node
646
829
  {
647
830
  if (tag === 'slot')
648
831
  ;
@@ -655,6 +838,7 @@ const patch = (oldVNode, newVNode) => {
655
838
  }
656
839
  if (oldChildren !== null && newChildren !== null) {
657
840
  // looks like there's child vnodes for both the old and new vnodes
841
+ // so we need to call `updateChildren` to reconcile them
658
842
  updateChildren(elm, oldChildren, newVNode, newChildren);
659
843
  }
660
844
  else if (newChildren !== null) {
@@ -697,7 +881,7 @@ const renderVdom = (hostRef, renderFnResults) => {
697
881
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
698
882
  }
699
883
  rootVnode.$tag$ = null;
700
- rootVnode.$flags$ |= 4 /* isHost */;
884
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
701
885
  hostRef.$vnode$ = rootVnode;
702
886
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
703
887
  {
@@ -706,32 +890,6 @@ const renderVdom = (hostRef, renderFnResults) => {
706
890
  // synchronous patch
707
891
  patch(oldVNode, rootVnode);
708
892
  };
709
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
710
- const createEvent = (ref, name, flags) => {
711
- const elm = getElement(ref);
712
- return {
713
- emit: (detail) => {
714
- return emitEvent(elm, name, {
715
- bubbles: !!(flags & 4 /* Bubbles */),
716
- composed: !!(flags & 2 /* Composed */),
717
- cancelable: !!(flags & 1 /* Cancellable */),
718
- detail,
719
- });
720
- },
721
- };
722
- };
723
- /**
724
- * Helper function to create & dispatch a custom Event on a provided target
725
- * @param elm the target of the Event
726
- * @param name the name to give the custom Event
727
- * @param opts options for configuring a custom Event
728
- * @returns the custom Event
729
- */
730
- const emitEvent = (elm, name, opts) => {
731
- const ev = plt.ce(name, opts);
732
- elm.dispatchEvent(ev);
733
- return ev;
734
- };
735
893
  const attachToAncestor = (hostRef, ancestorComponent) => {
736
894
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
737
895
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -739,10 +897,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
739
897
  };
740
898
  const scheduleUpdate = (hostRef, isInitialLoad) => {
741
899
  {
742
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
900
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
743
901
  }
744
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
745
- hostRef.$flags$ |= 512 /* needsRerender */;
902
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
903
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
746
904
  return;
747
905
  }
748
906
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -758,7 +916,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
758
916
  let promise;
759
917
  if (isInitialLoad) {
760
918
  {
761
- hostRef.$flags$ |= 256 /* isListenReady */;
919
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
762
920
  if (hostRef.$queuedListeners$) {
763
921
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
764
922
  hostRef.$queuedListeners$ = null;
@@ -806,7 +964,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
806
964
  }
807
965
  else {
808
966
  Promise.all(childrenPromises).then(postUpdate);
809
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
967
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
810
968
  childrenPromises.length = 0;
811
969
  }
812
970
  }
@@ -815,10 +973,10 @@ const callRender = (hostRef, instance, elm) => {
815
973
  try {
816
974
  instance = instance.render() ;
817
975
  {
818
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
976
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
819
977
  }
820
978
  {
821
- hostRef.$flags$ |= 2 /* hasRendered */;
979
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
822
980
  }
823
981
  {
824
982
  {
@@ -845,8 +1003,8 @@ const postUpdateComponent = (hostRef) => {
845
1003
  {
846
1004
  safeCall(instance, 'componentDidRender');
847
1005
  }
848
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
849
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1006
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1007
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
850
1008
  {
851
1009
  // DOM WRITE!
852
1010
  addHydratedFlag(elm);
@@ -878,10 +1036,10 @@ const postUpdateComponent = (hostRef) => {
878
1036
  hostRef.$onRenderResolve$();
879
1037
  hostRef.$onRenderResolve$ = undefined;
880
1038
  }
881
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1039
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
882
1040
  nextTick(() => scheduleUpdate(hostRef, false));
883
1041
  }
884
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1042
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
885
1043
  }
886
1044
  // ( •_•)
887
1045
  // ( •_•)>⌐■-■
@@ -911,53 +1069,6 @@ const then = (promise, thenFn) => {
911
1069
  };
912
1070
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
913
1071
  ;
914
- /**
915
- * Parse a new property value for a given property type.
916
- *
917
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
918
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
919
- * 1. `any`, the type given to `propValue` in the function signature
920
- * 2. the type stored from `propType`.
921
- *
922
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
923
- *
924
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
925
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
926
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
927
- * ```tsx
928
- * <my-cmp prop-val={0}></my-cmp>
929
- * ```
930
- *
931
- * HTML prop values on the other hand, will always a string
932
- *
933
- * @param propValue the new value to coerce to some type
934
- * @param propType the type of the prop, expressed as a binary number
935
- * @returns the parsed/coerced value
936
- */
937
- const parsePropertyValue = (propValue, propType) => {
938
- // ensure this value is of the correct prop type
939
- if (propValue != null && !isComplexType(propValue)) {
940
- if (propType & 4 /* Boolean */) {
941
- // per the HTML spec, any string value means it is a boolean true value
942
- // but we'll cheat here and say that the string "false" is the boolean false
943
- return propValue === 'false' ? false : propValue === '' || !!propValue;
944
- }
945
- if (propType & 2 /* Number */) {
946
- // force it to be a number
947
- return parseFloat(propValue);
948
- }
949
- if (propType & 1 /* String */) {
950
- // could have been passed as a number or boolean
951
- // but we still want it as a string
952
- return String(propValue);
953
- }
954
- // redundant return here for better minification
955
- return propValue;
956
- }
957
- // not sure exactly what type we want
958
- // so no need to change to a different type
959
- return propValue;
960
- };
961
1072
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
962
1073
  const setValue = (ref, propName, newVal, cmpMeta) => {
963
1074
  // check our new property value against our internal value
@@ -970,13 +1081,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
970
1081
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
971
1082
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
972
1083
  const didValueChange = newVal !== oldVal && !areBothNaN;
973
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1084
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
974
1085
  // gadzooks! the property's value has changed!!
975
1086
  // set our new value!
976
1087
  hostRef.$instanceValues$.set(propName, newVal);
977
1088
  if (instance) {
978
1089
  // get an array of method names of watch functions to call
979
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1090
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
980
1091
  const watchMethods = cmpMeta.$watchers$[propName];
981
1092
  if (watchMethods) {
982
1093
  // this instance is watching for when this property changed
@@ -991,7 +1102,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
991
1102
  });
992
1103
  }
993
1104
  }
994
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1105
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
995
1106
  // looks like this value actually changed, so we've got work to do!
996
1107
  // but only if we've already rendered, otherwise just chill out
997
1108
  // queue that we need to do an update, but don't worry about queuing
@@ -1001,6 +1112,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1001
1112
  }
1002
1113
  }
1003
1114
  };
1115
+ /**
1116
+ * Attach a series of runtime constructs to a compiled Stencil component
1117
+ * constructor, including getters and setters for the `@Prop` and `@State`
1118
+ * decorators, callbacks for when attributes change, and so on.
1119
+ *
1120
+ * @param Cstr the constructor for a component that we need to process
1121
+ * @param cmpMeta metadata collected previously about the component
1122
+ * @param flags a number used to store a series of bit flags
1123
+ * @returns a reference to the same constructor passed in (but now mutated)
1124
+ */
1004
1125
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1005
1126
  if (cmpMeta.$members$) {
1006
1127
  if (Cstr.watchers) {
@@ -1010,8 +1131,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1010
1131
  const members = Object.entries(cmpMeta.$members$);
1011
1132
  const prototype = Cstr.prototype;
1012
1133
  members.map(([memberName, [memberFlags]]) => {
1013
- if ((memberFlags & 31 /* Prop */ ||
1014
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1134
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1135
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1015
1136
  // proxyComponent - prop
1016
1137
  Object.defineProperty(prototype, memberName, {
1017
1138
  get() {
@@ -1026,8 +1147,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1026
1147
  enumerable: true,
1027
1148
  });
1028
1149
  }
1029
- else if (flags & 1 /* isElementConstructor */ &&
1030
- memberFlags & 64 /* Method */) {
1150
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1151
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1031
1152
  // proxyComponent - method
1032
1153
  Object.defineProperty(prototype, memberName, {
1033
1154
  value(...args) {
@@ -1037,7 +1158,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1037
1158
  });
1038
1159
  }
1039
1160
  });
1040
- if ((flags & 1 /* isElementConstructor */)) {
1161
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1041
1162
  const attrNameToPropName = new Map();
1042
1163
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1043
1164
  plt.jmp(() => {
@@ -1093,11 +1214,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1093
1214
  // create an array of attributes to observe
1094
1215
  // and also create a map of html attribute name to js property name
1095
1216
  Cstr.observedAttributes = members
1096
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1217
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1097
1218
  .map(([propName, m]) => {
1098
1219
  const attrName = m[1] || propName;
1099
1220
  attrNameToPropName.set(attrName, propName);
1100
- if (m[0] & 512 /* ReflectAttr */) {
1221
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1101
1222
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1102
1223
  }
1103
1224
  return attrName;
@@ -1108,10 +1229,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1108
1229
  };
1109
1230
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1110
1231
  // initializeComponent
1111
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1232
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1112
1233
  {
1113
1234
  // we haven't initialized this element yet
1114
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1235
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1115
1236
  // lazy loaded components
1116
1237
  // request the component's implementation to be
1117
1238
  // wired up with the host element
@@ -1129,7 +1250,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1129
1250
  {
1130
1251
  cmpMeta.$watchers$ = Cstr.watchers;
1131
1252
  }
1132
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1253
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1133
1254
  Cstr.isProxied = true;
1134
1255
  }
1135
1256
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -1137,7 +1258,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1137
1258
  // but let's keep track of when we start and stop
1138
1259
  // so that the getters/setters don't incorrectly step on data
1139
1260
  {
1140
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1261
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1141
1262
  }
1142
1263
  // construct the lazy-loaded component implementation
1143
1264
  // passing the hostRef is very important during
@@ -1150,10 +1271,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1150
1271
  consoleError(e);
1151
1272
  }
1152
1273
  {
1153
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1274
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1154
1275
  }
1155
1276
  {
1156
- hostRef.$flags$ |= 128 /* isWatchReady */;
1277
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1157
1278
  }
1158
1279
  endNewInstance();
1159
1280
  fireConnectedCallback(hostRef.$lazyInstance$);
@@ -1164,7 +1285,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1164
1285
  const scopeId = getScopeId(cmpMeta);
1165
1286
  if (!styles.has(scopeId)) {
1166
1287
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1167
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1288
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1168
1289
  endRegisterStyles();
1169
1290
  }
1170
1291
  }
@@ -1191,13 +1312,13 @@ const fireConnectedCallback = (instance) => {
1191
1312
  }
1192
1313
  };
1193
1314
  const connectedCallback = (elm) => {
1194
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1315
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1195
1316
  const hostRef = getHostRef(elm);
1196
1317
  const cmpMeta = hostRef.$cmpMeta$;
1197
1318
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1198
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1319
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1199
1320
  // first time this component has connected
1200
- hostRef.$flags$ |= 1 /* hasConnected */;
1321
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1201
1322
  {
1202
1323
  // find the first ancestor component (if there is one) and register
1203
1324
  // this component as one of the actively loading child components for its ancestor
@@ -1217,7 +1338,7 @@ const connectedCallback = (elm) => {
1217
1338
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1218
1339
  if (cmpMeta.$members$) {
1219
1340
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1220
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1341
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1221
1342
  const value = elm[memberName];
1222
1343
  delete elm[memberName];
1223
1344
  elm[memberName] = value;
@@ -1240,7 +1361,7 @@ const connectedCallback = (elm) => {
1240
1361
  }
1241
1362
  };
1242
1363
  const disconnectedCallback = (elm) => {
1243
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1364
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1244
1365
  const hostRef = getHostRef(elm);
1245
1366
  const instance = hostRef.$lazyInstance$ ;
1246
1367
  {
@@ -1295,7 +1416,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1295
1416
  super(self);
1296
1417
  self = this;
1297
1418
  registerHost(self, cmpMeta);
1298
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1419
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1299
1420
  // this component is using shadow dom
1300
1421
  // and this browser supports shadow dom
1301
1422
  // add the read-only property "shadowRoot" to the host element
@@ -1330,7 +1451,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1330
1451
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1331
1452
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1332
1453
  cmpTags.push(tagName);
1333
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1454
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1334
1455
  }
1335
1456
  });
1336
1457
  });
@@ -1352,7 +1473,41 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1352
1473
  // Fallback appLoad event
1353
1474
  endBootstrap();
1354
1475
  };
1355
- const hostRefs = new WeakMap();
1476
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1477
+ if (listeners) {
1478
+ listeners.map(([flags, name, method]) => {
1479
+ const target = getHostListenerTarget(elm, flags) ;
1480
+ const handler = hostListenerProxy(hostRef, method);
1481
+ const opts = hostListenerOpts(flags);
1482
+ plt.ael(target, name, handler, opts);
1483
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1484
+ });
1485
+ }
1486
+ };
1487
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1488
+ try {
1489
+ {
1490
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1491
+ // instance is ready, let's call it's member method for this event
1492
+ hostRef.$lazyInstance$[methodName](ev);
1493
+ }
1494
+ else {
1495
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1496
+ }
1497
+ }
1498
+ }
1499
+ catch (e) {
1500
+ consoleError(e);
1501
+ }
1502
+ };
1503
+ const getHostListenerTarget = (elm, flags) => {
1504
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
1505
+ return win;
1506
+ return elm;
1507
+ };
1508
+ // prettier-ignore
1509
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1510
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1356
1511
  const getHostRef = (ref) => hostRefs.get(ref);
1357
1512
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1358
1513
  const registerHost = (elm, cmpMeta) => {
@@ -1384,7 +1539,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1384
1539
  if (module) {
1385
1540
  return module[exportName];
1386
1541
  }
1542
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1387
1543
  return import(
1544
+ /* @vite-ignore */
1388
1545
  /* webpackInclude: /\.entry\.js$/ */
1389
1546
  /* webpackExclude: /\.system\.entry\.js$/ */
1390
1547
  /* webpackMode: "lazy" */
@@ -1395,14 +1552,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1395
1552
  return importedModule[exportName];
1396
1553
  }, consoleError);
1397
1554
  };
1398
- const styles = new Map();
1555
+ const styles = /*@__PURE__*/ new Map();
1556
+ const win = typeof window !== 'undefined' ? window : {};
1557
+ const doc = win.document || { head: {} };
1558
+ const plt = {
1559
+ $flags$: 0,
1560
+ $resourcesUrl$: '',
1561
+ jmp: (h) => h(),
1562
+ raf: (h) => requestAnimationFrame(h),
1563
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1564
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1565
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1566
+ };
1567
+ const promiseResolve = (v) => Promise.resolve(v);
1568
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1569
+ try {
1570
+ new CSSStyleSheet();
1571
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1572
+ }
1573
+ catch (e) { }
1574
+ return false;
1575
+ })()
1576
+ ;
1399
1577
  const queueDomReads = [];
1400
1578
  const queueDomWrites = [];
1401
1579
  const queueTask = (queue, write) => (cb) => {
1402
1580
  queue.push(cb);
1403
1581
  if (!queuePending) {
1404
1582
  queuePending = true;
1405
- if (write && plt.$flags$ & 4 /* queueSync */) {
1583
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1406
1584
  nextTick(flush);
1407
1585
  }
1408
1586
  else {