@limetech/lime-elements 36.1.0-next.9 → 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 +327 -326
  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 +19 -31
  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 +17 -26
  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 +327 -326
  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 +19 -31
  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 +21 -20
  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-19f72dab.entry.js +0 -1
  248. package/dist/lime-elements/p-2639edf9.entry.js +0 -73
  249. package/dist/lime-elements/p-2fc4f4ff.entry.js +0 -1
  250. package/dist/lime-elements/p-3b0c9885.entry.js +0 -37
  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-3f388717.entry.js +0 -11
  254. package/dist/lime-elements/p-41e902ac.entry.js +0 -126
  255. package/dist/lime-elements/p-4dc07252.entry.js +0 -82
  256. package/dist/lime-elements/p-53e01330.entry.js +0 -1
  257. package/dist/lime-elements/p-5ef52589.entry.js +0 -1
  258. package/dist/lime-elements/p-629862f4.entry.js +0 -1
  259. package/dist/lime-elements/p-63e25a0a.entry.js +0 -1
  260. package/dist/lime-elements/p-6b1bc80f.entry.js +0 -1
  261. package/dist/lime-elements/p-93cd2268.entry.js +0 -1
  262. package/dist/lime-elements/p-95f275ab.entry.js +0 -1
  263. package/dist/lime-elements/p-9917f042.entry.js +0 -16
  264. package/dist/lime-elements/p-995bbd2a.entry.js +0 -1
  265. package/dist/lime-elements/p-a465084b.entry.js +0 -82
  266. package/dist/lime-elements/p-b0046fcd.entry.js +0 -1
  267. package/dist/lime-elements/p-b0e54dc2.entry.js +0 -1
  268. package/dist/lime-elements/p-b4de3380.entry.js +0 -1
  269. package/dist/lime-elements/p-c59cbd68.entry.js +0 -1
  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
@@ -22,67 +22,18 @@ function _interopNamespace(e) {
22
22
 
23
23
  const NAMESPACE = 'lime-elements';
24
24
 
25
+ /**
26
+ * Virtual DOM patching algorithm based on Snabbdom by
27
+ * Simon Friis Vindum (@paldepind)
28
+ * Licensed under the MIT License
29
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
30
+ *
31
+ * Modified for Stencil's renderer and slot projection
32
+ */
25
33
  let scopeId;
26
34
  let hostTagName;
27
35
  let isSvgMode = false;
28
36
  let queuePending = false;
29
- const win = typeof window !== 'undefined' ? window : {};
30
- const doc = win.document || { head: {} };
31
- const plt = {
32
- $flags$: 0,
33
- $resourcesUrl$: '',
34
- jmp: (h) => h(),
35
- raf: (h) => requestAnimationFrame(h),
36
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
37
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
38
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
39
- };
40
- const promiseResolve = (v) => Promise.resolve(v);
41
- const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
42
- try {
43
- new CSSStyleSheet();
44
- return typeof new CSSStyleSheet().replace === 'function';
45
- }
46
- catch (e) { }
47
- return false;
48
- })()
49
- ;
50
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
51
- if (listeners) {
52
- listeners.map(([flags, name, method]) => {
53
- const target = getHostListenerTarget(elm, flags) ;
54
- const handler = hostListenerProxy(hostRef, method);
55
- const opts = hostListenerOpts(flags);
56
- plt.ael(target, name, handler, opts);
57
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
58
- });
59
- }
60
- };
61
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
62
- try {
63
- {
64
- if (hostRef.$flags$ & 256 /* isListenReady */) {
65
- // instance is ready, let's call it's member method for this event
66
- hostRef.$lazyInstance$[methodName](ev);
67
- }
68
- else {
69
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
70
- }
71
- }
72
- }
73
- catch (e) {
74
- consoleError(e);
75
- }
76
- };
77
- const getHostListenerTarget = (elm, flags) => {
78
- if (flags & 8 /* TargetWindow */)
79
- return win;
80
- return elm;
81
- };
82
- // prettier-ignore
83
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
84
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
85
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
86
37
  const createTime = (fnName, tagName = '') => {
87
38
  {
88
39
  return () => {
@@ -97,71 +48,8 @@ const uniqueTime = (key, measureText) => {
97
48
  };
98
49
  }
99
50
  };
100
- const rootAppliedStyles = new WeakMap();
101
- const registerStyle = (scopeId, cssText, allowCS) => {
102
- let style = styles.get(scopeId);
103
- if (supportsConstructibleStylesheets && allowCS) {
104
- style = (style || new CSSStyleSheet());
105
- style.replace(cssText);
106
- }
107
- else {
108
- style = cssText;
109
- }
110
- styles.set(scopeId, style);
111
- };
112
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
113
- let scopeId = getScopeId(cmpMeta);
114
- let style = styles.get(scopeId);
115
- // if an element is NOT connected then getRootNode() will return the wrong root node
116
- // so the fallback is to always use the document for the root node in those cases
117
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
118
- if (style) {
119
- if (typeof style === 'string') {
120
- styleContainerNode = styleContainerNode.head || styleContainerNode;
121
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
122
- let styleElm;
123
- if (!appliedStyles) {
124
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
125
- }
126
- if (!appliedStyles.has(scopeId)) {
127
- {
128
- {
129
- styleElm = doc.createElement('style');
130
- styleElm.innerHTML = style;
131
- }
132
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
133
- }
134
- if (appliedStyles) {
135
- appliedStyles.add(scopeId);
136
- }
137
- }
138
- }
139
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
140
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
141
- }
142
- }
143
- return scopeId;
144
- };
145
- const attachStyles = (hostRef) => {
146
- const cmpMeta = hostRef.$cmpMeta$;
147
- const elm = hostRef.$hostElement$;
148
- const flags = cmpMeta.$flags$;
149
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
150
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
151
- if (flags & 10 /* needsScopedEncapsulation */) {
152
- // only required when we're NOT using native shadow dom (slot)
153
- // or this browser doesn't support native shadow dom
154
- // and this host element was NOT created with SSR
155
- // let's pick out the inner content for slot projection
156
- // create a node to represent where the original
157
- // content was first placed, which is useful later on
158
- // DOM WRITE!!
159
- elm['s-sc'] = scopeId;
160
- elm.classList.add(scopeId + '-h');
161
- }
162
- endAttachStyles();
163
- };
164
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
51
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
52
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
165
53
  /**
166
54
  * Default style mode id
167
55
  */
@@ -197,7 +85,7 @@ const h = (nodeName, vnodeData, ...children) => {
197
85
  let key = null;
198
86
  let simple = false;
199
87
  let lastSimple = false;
200
- let vNodeChildren = [];
88
+ const vNodeChildren = [];
201
89
  const walk = (c) => {
202
90
  for (let i = 0; i < c.length; i++) {
203
91
  child = c[i];
@@ -300,6 +188,149 @@ const convertToPrivate = (node) => {
300
188
  vnode.$name$ = node.vname;
301
189
  return vnode;
302
190
  };
191
+ /**
192
+ * Parse a new property value for a given property type.
193
+ *
194
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
195
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
196
+ * 1. `any`, the type given to `propValue` in the function signature
197
+ * 2. the type stored from `propType`.
198
+ *
199
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
200
+ *
201
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
202
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
203
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
204
+ * ```tsx
205
+ * <my-cmp prop-val={0}></my-cmp>
206
+ * ```
207
+ *
208
+ * HTML prop values on the other hand, will always a string
209
+ *
210
+ * @param propValue the new value to coerce to some type
211
+ * @param propType the type of the prop, expressed as a binary number
212
+ * @returns the parsed/coerced value
213
+ */
214
+ const parsePropertyValue = (propValue, propType) => {
215
+ // ensure this value is of the correct prop type
216
+ if (propValue != null && !isComplexType(propValue)) {
217
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
218
+ // per the HTML spec, any string value means it is a boolean true value
219
+ // but we'll cheat here and say that the string "false" is the boolean false
220
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
221
+ }
222
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
223
+ // force it to be a number
224
+ return parseFloat(propValue);
225
+ }
226
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
227
+ // could have been passed as a number or boolean
228
+ // but we still want it as a string
229
+ return String(propValue);
230
+ }
231
+ // redundant return here for better minification
232
+ return propValue;
233
+ }
234
+ // not sure exactly what type we want
235
+ // so no need to change to a different type
236
+ return propValue;
237
+ };
238
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
239
+ const createEvent = (ref, name, flags) => {
240
+ const elm = getElement(ref);
241
+ return {
242
+ emit: (detail) => {
243
+ return emitEvent(elm, name, {
244
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
245
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
246
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
247
+ detail,
248
+ });
249
+ },
250
+ };
251
+ };
252
+ /**
253
+ * Helper function to create & dispatch a custom Event on a provided target
254
+ * @param elm the target of the Event
255
+ * @param name the name to give the custom Event
256
+ * @param opts options for configuring a custom Event
257
+ * @returns the custom Event
258
+ */
259
+ const emitEvent = (elm, name, opts) => {
260
+ const ev = plt.ce(name, opts);
261
+ elm.dispatchEvent(ev);
262
+ return ev;
263
+ };
264
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
265
+ const registerStyle = (scopeId, cssText, allowCS) => {
266
+ let style = styles.get(scopeId);
267
+ if (supportsConstructableStylesheets && allowCS) {
268
+ style = (style || new CSSStyleSheet());
269
+ if (typeof style === 'string') {
270
+ style = cssText;
271
+ }
272
+ else {
273
+ style.replaceSync(cssText);
274
+ }
275
+ }
276
+ else {
277
+ style = cssText;
278
+ }
279
+ styles.set(scopeId, style);
280
+ };
281
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
282
+ let scopeId = getScopeId(cmpMeta);
283
+ const style = styles.get(scopeId);
284
+ // if an element is NOT connected then getRootNode() will return the wrong root node
285
+ // so the fallback is to always use the document for the root node in those cases
286
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
287
+ if (style) {
288
+ if (typeof style === 'string') {
289
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
290
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
291
+ let styleElm;
292
+ if (!appliedStyles) {
293
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
294
+ }
295
+ if (!appliedStyles.has(scopeId)) {
296
+ {
297
+ {
298
+ styleElm = doc.createElement('style');
299
+ styleElm.innerHTML = style;
300
+ }
301
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
302
+ }
303
+ if (appliedStyles) {
304
+ appliedStyles.add(scopeId);
305
+ }
306
+ }
307
+ }
308
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
309
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
310
+ }
311
+ }
312
+ return scopeId;
313
+ };
314
+ const attachStyles = (hostRef) => {
315
+ const cmpMeta = hostRef.$cmpMeta$;
316
+ const elm = hostRef.$hostElement$;
317
+ const flags = cmpMeta.$flags$;
318
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
319
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
320
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
321
+ // only required when we're NOT using native shadow dom (slot)
322
+ // or this browser doesn't support native shadow dom
323
+ // and this host element was NOT created with SSR
324
+ // let's pick out the inner content for slot projection
325
+ // create a node to represent where the original
326
+ // content was first placed, which is useful later on
327
+ // DOM WRITE!!
328
+ elm['s-sc'] = scopeId;
329
+ elm.classList.add(scopeId + '-h');
330
+ }
331
+ endAttachStyles();
332
+ };
333
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
303
334
  /**
304
335
  * Production setAccessor() function based on Preact by
305
336
  * Jason Miller (@developit)
@@ -397,7 +428,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
397
428
  if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
398
429
  try {
399
430
  if (!elm.tagName.includes('-')) {
400
- let n = newValue == null ? '' : newValue;
431
+ const n = newValue == null ? '' : newValue;
401
432
  // Workaround for Safari, moving the <input> caret when re-assigning the same valued
402
433
  if (memberName === 'list') {
403
434
  isProp = false;
@@ -436,7 +467,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
436
467
  }
437
468
  }
438
469
  }
439
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
470
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
440
471
  newValue = newValue === true ? '' : newValue;
441
472
  if (xlink) {
442
473
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -454,7 +485,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
454
485
  // if the element passed in is a shadow root, which is a document fragment
455
486
  // then we want to be adding attrs/props to the shadow root's "host" element
456
487
  // if it's not a shadow root, then we add attrs/props to the same element
457
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
488
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
458
489
  ? newVnode.$elm$.host
459
490
  : newVnode.$elm$;
460
491
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -472,9 +503,19 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
472
503
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
473
504
  }
474
505
  };
506
+ /**
507
+ * Create a DOM Node corresponding to one of the children of a given VNode.
508
+ *
509
+ * @param oldParentVNode the parent VNode from the previous render
510
+ * @param newParentVNode the parent VNode from the current render
511
+ * @param childIndex the index of the VNode, in the _new_ parent node's
512
+ * children, for which we will create a new DOM node
513
+ * @param parentElm the parent DOM node which our new node will be a child of
514
+ * @returns the newly created node
515
+ */
475
516
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
476
517
  // tslint:disable-next-line: prefer-const
477
- let newVNode = newParentVNode.$children$[childIndex];
518
+ const newVNode = newParentVNode.$children$[childIndex];
478
519
  let i = 0;
479
520
  let elm;
480
521
  let childNode;
@@ -551,6 +592,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
551
592
  }
552
593
  }
553
594
  };
595
+ /**
596
+ * Reconcile the children of a new VNode with the children of an old VNode by
597
+ * traversing the two collections of children, identifying nodes that are
598
+ * conserved or changed, calling out to `patch` to make any necessary
599
+ * updates to the DOM, and rearranging DOM nodes as needed.
600
+ *
601
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
602
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
603
+ * 'windows' by storing start and end indices and references to the
604
+ * corresponding array entries. Initially the two 'windows' are basically equal
605
+ * to the entire array, but we progressively narrow the windows until there are
606
+ * no children left to update by doing the following:
607
+ *
608
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
609
+ * that if we have an initial array like the following we'll end up dealing
610
+ * only with a window bounded by the highlighted elements:
611
+ *
612
+ * [null, null, VNode1 , ... , VNode2, null, null]
613
+ * ^^^^^^ ^^^^^^
614
+ *
615
+ * 2. Check to see if the elements at the head and tail positions are equal
616
+ * across the windows. This will basically detect elements which haven't
617
+ * been added, removed, or changed position, i.e. if you had the following
618
+ * VNode elements (represented as HTML):
619
+ *
620
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
621
+ * newVNode: `<div><p><span>THERE</span></p></div>`
622
+ *
623
+ * Then when comparing the children of the `<div>` tag we check the equality
624
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
625
+ * same tag in the same position, we'd be able to avoid completely
626
+ * re-rendering the subtree under them with a new DOM element and would just
627
+ * call out to `patch` to handle reconciling their children and so on.
628
+ *
629
+ * 3. Check, for both windows, to see if the element at the beginning of the
630
+ * window corresponds to the element at the end of the other window. This is
631
+ * a heuristic which will let us identify _some_ situations in which
632
+ * elements have changed position, for instance it _should_ detect that the
633
+ * children nodes themselves have not changed but merely moved in the
634
+ * following example:
635
+ *
636
+ * oldVNode: `<div><element-one /><element-two /></div>`
637
+ * newVNode: `<div><element-two /><element-one /></div>`
638
+ *
639
+ * If we find cases like this then we also need to move the concrete DOM
640
+ * elements corresponding to the moved children to write the re-order to the
641
+ * DOM.
642
+ *
643
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
644
+ * nodes in the old children which have the same key as the first element in
645
+ * our window on the new children. If we find such a node we handle calling
646
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
647
+ * what we find.
648
+ *
649
+ * Finally, once we've narrowed our 'windows' to the point that either of them
650
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
651
+ * insertion or deletion that needs to happen to get a DOM state that correctly
652
+ * reflects the new child VNodes. If, for instance, after our window on the old
653
+ * children has collapsed we still have more nodes on the new children that
654
+ * we haven't dealt with yet then we need to add them, or if the new children
655
+ * collapse but we still have unhandled _old_ children then we need to make
656
+ * sure the corresponding DOM nodes are removed.
657
+ *
658
+ * @param parentElm the node into which the parent VNode is rendered
659
+ * @param oldCh the old children of the parent node
660
+ * @param newVNode the new VNode which will replace the parent
661
+ * @param newCh the new children of the parent node
662
+ */
554
663
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
555
664
  let oldStartIdx = 0;
556
665
  let newStartIdx = 0;
@@ -566,7 +675,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
566
675
  let elmToMove;
567
676
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
568
677
  if (oldStartVnode == null) {
569
- // Vnode might have been moved left
678
+ // VNode might have been moved left
570
679
  oldStartVnode = oldCh[++oldStartIdx];
571
680
  }
572
681
  else if (oldEndVnode == null) {
@@ -579,29 +688,65 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
579
688
  newEndVnode = newCh[--newEndIdx];
580
689
  }
581
690
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
691
+ // if the start nodes are the same then we should patch the new VNode
692
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
693
+ // indices to reflect that. We don't need to move any DOM Nodes around
694
+ // since things are matched up in order.
582
695
  patch(oldStartVnode, newStartVnode);
583
696
  oldStartVnode = oldCh[++oldStartIdx];
584
697
  newStartVnode = newCh[++newStartIdx];
585
698
  }
586
699
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
700
+ // likewise, if the end nodes are the same we patch new onto old and
701
+ // decrement our end indices, and also likewise in this case we don't
702
+ // need to move any DOM Nodes.
587
703
  patch(oldEndVnode, newEndVnode);
588
704
  oldEndVnode = oldCh[--oldEndIdx];
589
705
  newEndVnode = newCh[--newEndIdx];
590
706
  }
591
707
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
592
708
  patch(oldStartVnode, newEndVnode);
709
+ // We need to move the element for `oldStartVnode` into a position which
710
+ // will be appropriate for `newEndVnode`. For this we can use
711
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
712
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
713
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
714
+ //
715
+ // <old-start-node />
716
+ // <some-intervening-node />
717
+ // <old-end-node />
718
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
719
+ // <next-sibling />
720
+ //
721
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
722
+ // the node for `oldStartVnode` at the end of the children of
723
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
724
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
725
+ // append it to the children of the parent element.
593
726
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
594
727
  oldStartVnode = oldCh[++oldStartIdx];
595
728
  newEndVnode = newCh[--newEndIdx];
596
729
  }
597
730
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
598
731
  patch(oldEndVnode, newStartVnode);
732
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
733
+ // the same node, so since we're here we know that they are not. Thus we
734
+ // can move the element for `oldEndVnode` _before_ the element for
735
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
736
+ // future.
599
737
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
600
738
  oldEndVnode = oldCh[--oldEndIdx];
601
739
  newStartVnode = newCh[++newStartIdx];
602
740
  }
603
741
  else {
604
- // createKeyToOldIdx
742
+ // Here we do some checks to match up old and new nodes based on the
743
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
744
+ // in the JSX for a DOM element in the implementation of a Stencil
745
+ // component.
746
+ //
747
+ // First we check to see if there are any nodes in the array of old
748
+ // children which have the same key as the first node in the new
749
+ // children.
605
750
  idxInOld = -1;
606
751
  {
607
752
  for (i = oldStartIdx; i <= oldEndIdx; ++i) {
@@ -612,23 +757,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
612
757
  }
613
758
  }
614
759
  if (idxInOld >= 0) {
760
+ // We found a node in the old children which matches up with the first
761
+ // node in the new children! So let's deal with that
615
762
  elmToMove = oldCh[idxInOld];
616
763
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
764
+ // the tag doesn't match so we'll need a new DOM element
617
765
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
618
766
  }
619
767
  else {
620
768
  patch(elmToMove, newStartVnode);
769
+ // invalidate the matching old node so that we won't try to update it
770
+ // again later on
621
771
  oldCh[idxInOld] = undefined;
622
772
  node = elmToMove.$elm$;
623
773
  }
624
774
  newStartVnode = newCh[++newStartIdx];
625
775
  }
626
776
  else {
627
- // new element
777
+ // We either didn't find an element in the old children that matches
778
+ // the key of the first new child OR the build is not using `key`
779
+ // attributes at all. In either case we need to create a new element
780
+ // for the new node.
628
781
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
629
782
  newStartVnode = newCh[++newStartIdx];
630
783
  }
631
784
  if (node) {
785
+ // if we created a new node then handle inserting it to the DOM
632
786
  {
633
787
  oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
634
788
  }
@@ -636,22 +790,52 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
636
790
  }
637
791
  }
638
792
  if (oldStartIdx > oldEndIdx) {
793
+ // we have some more new nodes to add which don't match up with old nodes
639
794
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
640
795
  }
641
796
  else if (newStartIdx > newEndIdx) {
797
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
798
+ // in the new array, so lets remove them (which entails cleaning up the
799
+ // relevant DOM nodes)
642
800
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
643
801
  }
644
802
  };
645
- const isSameVnode = (vnode1, vnode2) => {
803
+ /**
804
+ * Compare two VNodes to determine if they are the same
805
+ *
806
+ * **NB**: This function is an equality _heuristic_ based on the available
807
+ * information set on the two VNodes and can be misleading under certain
808
+ * circumstances. In particular, if the two nodes do not have `key` attrs
809
+ * (available under `$key$` on VNodes) then the function falls back on merely
810
+ * checking that they have the same tag.
811
+ *
812
+ * So, in other words, if `key` attrs are not set on VNodes which may be
813
+ * changing order within a `children` array or something along those lines then
814
+ * we could obtain a false positive and then have to do needless re-rendering.
815
+ *
816
+ * @param leftVNode the first VNode to check
817
+ * @param rightVNode the second VNode to check
818
+ * @returns whether they're equal or not
819
+ */
820
+ const isSameVnode = (leftVNode, rightVNode) => {
646
821
  // compare if two vnode to see if they're "technically" the same
647
822
  // need to have the same element tag, and same key to be the same
648
- if (vnode1.$tag$ === vnode2.$tag$) {
823
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
824
+ // this will be set if components in the build have `key` attrs set on them
649
825
  {
650
- return vnode1.$key$ === vnode2.$key$;
826
+ return leftVNode.$key$ === rightVNode.$key$;
651
827
  }
652
828
  }
653
829
  return false;
654
830
  };
831
+ /**
832
+ * Handle reconciling an outdated VNode with a new one which corresponds to
833
+ * it. This function handles flushing updates to the DOM and reconciling the
834
+ * children of the two nodes (if any).
835
+ *
836
+ * @param oldVNode an old VNode whose DOM element and children we want to update
837
+ * @param newVNode a new VNode representing an updated version of the old one
838
+ */
655
839
  const patch = (oldVNode, newVNode) => {
656
840
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
657
841
  const oldChildren = oldVNode.$children$;
@@ -664,7 +848,6 @@ const patch = (oldVNode, newVNode) => {
664
848
  // only add this to the when the compiler sees we're using an svg somewhere
665
849
  isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
666
850
  }
667
- // element node
668
851
  {
669
852
  if (tag === 'slot')
670
853
  ;
@@ -677,6 +860,7 @@ const patch = (oldVNode, newVNode) => {
677
860
  }
678
861
  if (oldChildren !== null && newChildren !== null) {
679
862
  // looks like there's child vnodes for both the old and new vnodes
863
+ // so we need to call `updateChildren` to reconcile them
680
864
  updateChildren(elm, oldChildren, newVNode, newChildren);
681
865
  }
682
866
  else if (newChildren !== null) {
@@ -719,7 +903,7 @@ const renderVdom = (hostRef, renderFnResults) => {
719
903
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
720
904
  }
721
905
  rootVnode.$tag$ = null;
722
- rootVnode.$flags$ |= 4 /* isHost */;
906
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
723
907
  hostRef.$vnode$ = rootVnode;
724
908
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
725
909
  {
@@ -728,32 +912,6 @@ const renderVdom = (hostRef, renderFnResults) => {
728
912
  // synchronous patch
729
913
  patch(oldVNode, rootVnode);
730
914
  };
731
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
732
- const createEvent = (ref, name, flags) => {
733
- const elm = getElement(ref);
734
- return {
735
- emit: (detail) => {
736
- return emitEvent(elm, name, {
737
- bubbles: !!(flags & 4 /* Bubbles */),
738
- composed: !!(flags & 2 /* Composed */),
739
- cancelable: !!(flags & 1 /* Cancellable */),
740
- detail,
741
- });
742
- },
743
- };
744
- };
745
- /**
746
- * Helper function to create & dispatch a custom Event on a provided target
747
- * @param elm the target of the Event
748
- * @param name the name to give the custom Event
749
- * @param opts options for configuring a custom Event
750
- * @returns the custom Event
751
- */
752
- const emitEvent = (elm, name, opts) => {
753
- const ev = plt.ce(name, opts);
754
- elm.dispatchEvent(ev);
755
- return ev;
756
- };
757
915
  const attachToAncestor = (hostRef, ancestorComponent) => {
758
916
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
759
917
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -761,10 +919,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
761
919
  };
762
920
  const scheduleUpdate = (hostRef, isInitialLoad) => {
763
921
  {
764
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
922
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
765
923
  }
766
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
767
- hostRef.$flags$ |= 512 /* needsRerender */;
924
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
925
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
768
926
  return;
769
927
  }
770
928
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -780,7 +938,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
780
938
  let promise;
781
939
  if (isInitialLoad) {
782
940
  {
783
- hostRef.$flags$ |= 256 /* isListenReady */;
941
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
784
942
  if (hostRef.$queuedListeners$) {
785
943
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
786
944
  hostRef.$queuedListeners$ = null;
@@ -828,7 +986,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
828
986
  }
829
987
  else {
830
988
  Promise.all(childrenPromises).then(postUpdate);
831
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
989
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
832
990
  childrenPromises.length = 0;
833
991
  }
834
992
  }
@@ -837,10 +995,10 @@ const callRender = (hostRef, instance, elm) => {
837
995
  try {
838
996
  instance = instance.render() ;
839
997
  {
840
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
998
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
841
999
  }
842
1000
  {
843
- hostRef.$flags$ |= 2 /* hasRendered */;
1001
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
844
1002
  }
845
1003
  {
846
1004
  {
@@ -867,8 +1025,8 @@ const postUpdateComponent = (hostRef) => {
867
1025
  {
868
1026
  safeCall(instance, 'componentDidRender');
869
1027
  }
870
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
871
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1028
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1029
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
872
1030
  {
873
1031
  // DOM WRITE!
874
1032
  addHydratedFlag(elm);
@@ -900,10 +1058,10 @@ const postUpdateComponent = (hostRef) => {
900
1058
  hostRef.$onRenderResolve$();
901
1059
  hostRef.$onRenderResolve$ = undefined;
902
1060
  }
903
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1061
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
904
1062
  nextTick(() => scheduleUpdate(hostRef, false));
905
1063
  }
906
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1064
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
907
1065
  }
908
1066
  // ( •_•)
909
1067
  // ( •_•)>⌐■-■
@@ -933,53 +1091,6 @@ const then = (promise, thenFn) => {
933
1091
  };
934
1092
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
935
1093
  ;
936
- /**
937
- * Parse a new property value for a given property type.
938
- *
939
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
940
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
941
- * 1. `any`, the type given to `propValue` in the function signature
942
- * 2. the type stored from `propType`.
943
- *
944
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
945
- *
946
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
947
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
948
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
949
- * ```tsx
950
- * <my-cmp prop-val={0}></my-cmp>
951
- * ```
952
- *
953
- * HTML prop values on the other hand, will always a string
954
- *
955
- * @param propValue the new value to coerce to some type
956
- * @param propType the type of the prop, expressed as a binary number
957
- * @returns the parsed/coerced value
958
- */
959
- const parsePropertyValue = (propValue, propType) => {
960
- // ensure this value is of the correct prop type
961
- if (propValue != null && !isComplexType(propValue)) {
962
- if (propType & 4 /* Boolean */) {
963
- // per the HTML spec, any string value means it is a boolean true value
964
- // but we'll cheat here and say that the string "false" is the boolean false
965
- return propValue === 'false' ? false : propValue === '' || !!propValue;
966
- }
967
- if (propType & 2 /* Number */) {
968
- // force it to be a number
969
- return parseFloat(propValue);
970
- }
971
- if (propType & 1 /* String */) {
972
- // could have been passed as a number or boolean
973
- // but we still want it as a string
974
- return String(propValue);
975
- }
976
- // redundant return here for better minification
977
- return propValue;
978
- }
979
- // not sure exactly what type we want
980
- // so no need to change to a different type
981
- return propValue;
982
- };
983
1094
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
984
1095
  const setValue = (ref, propName, newVal, cmpMeta) => {
985
1096
  // check our new property value against our internal value
@@ -992,13 +1103,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
992
1103
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
993
1104
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
994
1105
  const didValueChange = newVal !== oldVal && !areBothNaN;
995
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1106
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
996
1107
  // gadzooks! the property's value has changed!!
997
1108
  // set our new value!
998
1109
  hostRef.$instanceValues$.set(propName, newVal);
999
1110
  if (instance) {
1000
1111
  // get an array of method names of watch functions to call
1001
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1112
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1002
1113
  const watchMethods = cmpMeta.$watchers$[propName];
1003
1114
  if (watchMethods) {
1004
1115
  // this instance is watching for when this property changed
@@ -1013,7 +1124,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1013
1124
  });
1014
1125
  }
1015
1126
  }
1016
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1127
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1017
1128
  // looks like this value actually changed, so we've got work to do!
1018
1129
  // but only if we've already rendered, otherwise just chill out
1019
1130
  // queue that we need to do an update, but don't worry about queuing
@@ -1023,6 +1134,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1023
1134
  }
1024
1135
  }
1025
1136
  };
1137
+ /**
1138
+ * Attach a series of runtime constructs to a compiled Stencil component
1139
+ * constructor, including getters and setters for the `@Prop` and `@State`
1140
+ * decorators, callbacks for when attributes change, and so on.
1141
+ *
1142
+ * @param Cstr the constructor for a component that we need to process
1143
+ * @param cmpMeta metadata collected previously about the component
1144
+ * @param flags a number used to store a series of bit flags
1145
+ * @returns a reference to the same constructor passed in (but now mutated)
1146
+ */
1026
1147
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1027
1148
  if (cmpMeta.$members$) {
1028
1149
  if (Cstr.watchers) {
@@ -1032,8 +1153,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1032
1153
  const members = Object.entries(cmpMeta.$members$);
1033
1154
  const prototype = Cstr.prototype;
1034
1155
  members.map(([memberName, [memberFlags]]) => {
1035
- if ((memberFlags & 31 /* Prop */ ||
1036
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1156
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1157
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1037
1158
  // proxyComponent - prop
1038
1159
  Object.defineProperty(prototype, memberName, {
1039
1160
  get() {
@@ -1048,8 +1169,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1048
1169
  enumerable: true,
1049
1170
  });
1050
1171
  }
1051
- else if (flags & 1 /* isElementConstructor */ &&
1052
- memberFlags & 64 /* Method */) {
1172
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1173
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1053
1174
  // proxyComponent - method
1054
1175
  Object.defineProperty(prototype, memberName, {
1055
1176
  value(...args) {
@@ -1059,7 +1180,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1059
1180
  });
1060
1181
  }
1061
1182
  });
1062
- if ((flags & 1 /* isElementConstructor */)) {
1183
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1063
1184
  const attrNameToPropName = new Map();
1064
1185
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1065
1186
  plt.jmp(() => {
@@ -1115,11 +1236,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1115
1236
  // create an array of attributes to observe
1116
1237
  // and also create a map of html attribute name to js property name
1117
1238
  Cstr.observedAttributes = members
1118
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1239
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1119
1240
  .map(([propName, m]) => {
1120
1241
  const attrName = m[1] || propName;
1121
1242
  attrNameToPropName.set(attrName, propName);
1122
- if (m[0] & 512 /* ReflectAttr */) {
1243
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1123
1244
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1124
1245
  }
1125
1246
  return attrName;
@@ -1130,10 +1251,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1130
1251
  };
1131
1252
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1132
1253
  // initializeComponent
1133
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1254
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1134
1255
  {
1135
1256
  // we haven't initialized this element yet
1136
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1257
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1137
1258
  // lazy loaded components
1138
1259
  // request the component's implementation to be
1139
1260
  // wired up with the host element
@@ -1151,7 +1272,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1151
1272
  {
1152
1273
  cmpMeta.$watchers$ = Cstr.watchers;
1153
1274
  }
1154
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1275
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1155
1276
  Cstr.isProxied = true;
1156
1277
  }
1157
1278
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -1159,7 +1280,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1159
1280
  // but let's keep track of when we start and stop
1160
1281
  // so that the getters/setters don't incorrectly step on data
1161
1282
  {
1162
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1283
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1163
1284
  }
1164
1285
  // construct the lazy-loaded component implementation
1165
1286
  // passing the hostRef is very important during
@@ -1172,10 +1293,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1172
1293
  consoleError(e);
1173
1294
  }
1174
1295
  {
1175
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1296
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1176
1297
  }
1177
1298
  {
1178
- hostRef.$flags$ |= 128 /* isWatchReady */;
1299
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1179
1300
  }
1180
1301
  endNewInstance();
1181
1302
  fireConnectedCallback(hostRef.$lazyInstance$);
@@ -1186,7 +1307,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1186
1307
  const scopeId = getScopeId(cmpMeta);
1187
1308
  if (!styles.has(scopeId)) {
1188
1309
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1189
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1310
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1190
1311
  endRegisterStyles();
1191
1312
  }
1192
1313
  }
@@ -1213,13 +1334,13 @@ const fireConnectedCallback = (instance) => {
1213
1334
  }
1214
1335
  };
1215
1336
  const connectedCallback = (elm) => {
1216
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1337
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1217
1338
  const hostRef = getHostRef(elm);
1218
1339
  const cmpMeta = hostRef.$cmpMeta$;
1219
1340
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1220
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1341
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1221
1342
  // first time this component has connected
1222
- hostRef.$flags$ |= 1 /* hasConnected */;
1343
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1223
1344
  {
1224
1345
  // find the first ancestor component (if there is one) and register
1225
1346
  // this component as one of the actively loading child components for its ancestor
@@ -1239,7 +1360,7 @@ const connectedCallback = (elm) => {
1239
1360
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1240
1361
  if (cmpMeta.$members$) {
1241
1362
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1242
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1363
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1243
1364
  const value = elm[memberName];
1244
1365
  delete elm[memberName];
1245
1366
  elm[memberName] = value;
@@ -1262,7 +1383,7 @@ const connectedCallback = (elm) => {
1262
1383
  }
1263
1384
  };
1264
1385
  const disconnectedCallback = (elm) => {
1265
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1386
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1266
1387
  const hostRef = getHostRef(elm);
1267
1388
  const instance = hostRef.$lazyInstance$ ;
1268
1389
  {
@@ -1317,7 +1438,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1317
1438
  super(self);
1318
1439
  self = this;
1319
1440
  registerHost(self, cmpMeta);
1320
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1441
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1321
1442
  // this component is using shadow dom
1322
1443
  // and this browser supports shadow dom
1323
1444
  // add the read-only property "shadowRoot" to the host element
@@ -1352,7 +1473,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1352
1473
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1353
1474
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1354
1475
  cmpTags.push(tagName);
1355
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1476
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1356
1477
  }
1357
1478
  });
1358
1479
  });
@@ -1374,7 +1495,41 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1374
1495
  // Fallback appLoad event
1375
1496
  endBootstrap();
1376
1497
  };
1377
- const hostRefs = new WeakMap();
1498
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1499
+ if (listeners) {
1500
+ listeners.map(([flags, name, method]) => {
1501
+ const target = getHostListenerTarget(elm, flags) ;
1502
+ const handler = hostListenerProxy(hostRef, method);
1503
+ const opts = hostListenerOpts(flags);
1504
+ plt.ael(target, name, handler, opts);
1505
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1506
+ });
1507
+ }
1508
+ };
1509
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1510
+ try {
1511
+ {
1512
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1513
+ // instance is ready, let's call it's member method for this event
1514
+ hostRef.$lazyInstance$[methodName](ev);
1515
+ }
1516
+ else {
1517
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1518
+ }
1519
+ }
1520
+ }
1521
+ catch (e) {
1522
+ consoleError(e);
1523
+ }
1524
+ };
1525
+ const getHostListenerTarget = (elm, flags) => {
1526
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
1527
+ return win;
1528
+ return elm;
1529
+ };
1530
+ // prettier-ignore
1531
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1532
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1378
1533
  const getHostRef = (ref) => hostRefs.get(ref);
1379
1534
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1380
1535
  const registerHost = (elm, cmpMeta) => {
@@ -1406,7 +1561,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1406
1561
  if (module) {
1407
1562
  return module[exportName];
1408
1563
  }
1564
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1409
1565
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1566
+ /* @vite-ignore */
1410
1567
  /* webpackInclude: /\.entry\.js$/ */
1411
1568
  /* webpackExclude: /\.system\.entry\.js$/ */
1412
1569
  /* webpackMode: "lazy" */
@@ -1417,14 +1574,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1417
1574
  return importedModule[exportName];
1418
1575
  }, consoleError);
1419
1576
  };
1420
- const styles = new Map();
1577
+ const styles = /*@__PURE__*/ new Map();
1578
+ const win = typeof window !== 'undefined' ? window : {};
1579
+ const doc = win.document || { head: {} };
1580
+ const plt = {
1581
+ $flags$: 0,
1582
+ $resourcesUrl$: '',
1583
+ jmp: (h) => h(),
1584
+ raf: (h) => requestAnimationFrame(h),
1585
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1586
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1587
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1588
+ };
1589
+ const promiseResolve = (v) => Promise.resolve(v);
1590
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1591
+ try {
1592
+ new CSSStyleSheet();
1593
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1594
+ }
1595
+ catch (e) { }
1596
+ return false;
1597
+ })()
1598
+ ;
1421
1599
  const queueDomReads = [];
1422
1600
  const queueDomWrites = [];
1423
1601
  const queueTask = (queue, write) => (cb) => {
1424
1602
  queue.push(cb);
1425
1603
  if (!queuePending) {
1426
1604
  queuePending = true;
1427
- if (write && plt.$flags$ & 4 /* queueSync */) {
1605
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1428
1606
  nextTick(flush);
1429
1607
  }
1430
1608
  else {