@itcenteratunihelsinki/huds-lib 0.8.40 → 0.8.42

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 (559) hide show
  1. package/dist/cjs/color-box_8.cjs.entry.js +13 -36
  2. package/dist/cjs/color-box_8.cjs.entry.js.map +1 -0
  3. package/dist/cjs/{globalScript-6b592153.js → globalScript-45ad6d41.js} +3 -1
  4. package/dist/cjs/globalScript-45ad6d41.js.map +1 -0
  5. package/dist/cjs/huds-lib.cjs.js +13 -4
  6. package/dist/cjs/huds-lib.cjs.js.map +1 -0
  7. package/dist/cjs/hy-accordion-container_83.cjs.entry.js +388 -192
  8. package/dist/cjs/hy-accordion-container_83.cjs.entry.js.map +1 -0
  9. package/dist/cjs/hy-event-item.cjs.entry.js +7 -2
  10. package/dist/cjs/hy-event-item.cjs.entry.js.map +1 -0
  11. package/dist/cjs/hy-events.cjs.entry.js +6 -2
  12. package/dist/cjs/hy-events.cjs.entry.js.map +1 -0
  13. package/dist/cjs/{index-dfc917d9.js → index-25bd964b.js} +692 -287
  14. package/dist/cjs/index-25bd964b.js.map +1 -0
  15. package/dist/cjs/index.cjs.js +2 -0
  16. package/dist/cjs/index.cjs.js.map +1 -0
  17. package/dist/cjs/loader.cjs.js +7 -4
  18. package/dist/cjs/loader.cjs.js.map +1 -0
  19. package/dist/cjs/utils-14d5aa6f.js +2 -0
  20. package/dist/cjs/utils-14d5aa6f.js.map +1 -0
  21. package/dist/collection/collection-manifest.json +2 -2
  22. package/dist/collection/components/accordion-container/accordion-container.js +37 -30
  23. package/dist/collection/components/accordion-container/accordion-container.js.map +1 -0
  24. package/dist/collection/components/accordion-item/accordion-item.js +116 -114
  25. package/dist/collection/components/accordion-item/accordion-item.js.map +1 -0
  26. package/dist/collection/components/adjacent-image-text/adjacent-image-text.js +277 -275
  27. package/dist/collection/components/adjacent-image-text/adjacent-image-text.js.map +1 -0
  28. package/dist/collection/components/baseline/baseline.js +35 -32
  29. package/dist/collection/components/baseline/baseline.js.map +1 -0
  30. package/dist/collection/components/button/button.js +226 -257
  31. package/dist/collection/components/button/button.js.map +1 -0
  32. package/dist/collection/components/color-box/color-box.js +13 -9
  33. package/dist/collection/components/color-box/color-box.js.map +1 -0
  34. package/dist/collection/components/courses/hy-content-list/hy-content-list.js +174 -167
  35. package/dist/collection/components/courses/hy-content-list/hy-content-list.js.map +1 -0
  36. package/dist/collection/components/courses/hy-content-list-item/hy-content-list-item.css +2 -2
  37. package/dist/collection/components/courses/hy-content-list-item/hy-content-list-item.js +320 -312
  38. package/dist/collection/components/courses/hy-content-list-item/hy-content-list-item.js.map +1 -0
  39. package/dist/collection/components/cta-button/cta-button.js +141 -138
  40. package/dist/collection/components/cta-button/cta-button.js.map +1 -0
  41. package/dist/collection/components/cta-link/cta-link.js +107 -103
  42. package/dist/collection/components/cta-link/cta-link.js.map +1 -0
  43. package/dist/collection/components/docs-container/docs-container.js +13 -9
  44. package/dist/collection/components/docs-container/docs-container.js.map +1 -0
  45. package/dist/collection/components/footer/hy-footer/hy-footer.js +13 -9
  46. package/dist/collection/components/footer/hy-footer/hy-footer.js.map +1 -0
  47. package/dist/collection/components/footer/hy-footer-action/hy-footer-action.js +63 -55
  48. package/dist/collection/components/footer/hy-footer-action/hy-footer-action.js.map +1 -0
  49. package/dist/collection/components/footer/hy-footer-base/hy-footer-base.js +183 -187
  50. package/dist/collection/components/footer/hy-footer-base/hy-footer-base.js.map +1 -0
  51. package/dist/collection/components/footer/hy-footer-info/hy-footer-info.js +278 -270
  52. package/dist/collection/components/footer/hy-footer-info/hy-footer-info.js.map +1 -0
  53. package/dist/collection/components/footer/hy-footer-link-item/hy-footer-link-item.js +191 -190
  54. package/dist/collection/components/footer/hy-footer-link-item/hy-footer-link-item.js.map +1 -0
  55. package/dist/collection/components/global-workers/globals.worker.js +1 -0
  56. package/dist/collection/components/global-workers/globals.worker.js.map +1 -0
  57. package/dist/collection/components/grid-container/grid-container.js +13 -9
  58. package/dist/collection/components/grid-container/grid-container.js.map +1 -0
  59. package/dist/collection/components/grid-item/grid-item.css +0 -23
  60. package/dist/collection/components/grid-item/grid-item.js +102 -96
  61. package/dist/collection/components/grid-item/grid-item.js.map +1 -0
  62. package/dist/collection/components/grid-row/grid-row.js +13 -9
  63. package/dist/collection/components/grid-row/grid-row.js.map +1 -0
  64. package/dist/collection/components/heading/heading-fw.css +17 -17
  65. package/dist/collection/components/heading/heading.css +17 -17
  66. package/dist/collection/components/heading/heading.js +142 -146
  67. package/dist/collection/components/heading/heading.js.map +1 -0
  68. package/dist/collection/components/hy-anchor-link-list/hy-anchor-link-list.js +105 -99
  69. package/dist/collection/components/hy-anchor-link-list/hy-anchor-link-list.js.map +1 -0
  70. package/dist/collection/components/hy-badge/hy-badge.js +35 -30
  71. package/dist/collection/components/hy-badge/hy-badge.js.map +1 -0
  72. package/dist/collection/components/hy-banner/hy-banner.js +137 -135
  73. package/dist/collection/components/hy-banner/hy-banner.js.map +1 -0
  74. package/dist/collection/components/hy-box/hy-box.js +323 -318
  75. package/dist/collection/components/hy-box/hy-box.js.map +1 -0
  76. package/dist/collection/components/hy-box-container/hy-box-container.js +53 -54
  77. package/dist/collection/components/hy-box-container/hy-box-container.js.map +1 -0
  78. package/dist/collection/components/hy-breadcrumbs/hy-breadcrumbs.js +89 -82
  79. package/dist/collection/components/hy-breadcrumbs/hy-breadcrumbs.js.map +1 -0
  80. package/dist/collection/components/hy-checkbox/hy-checkbox.js +108 -114
  81. package/dist/collection/components/hy-checkbox/hy-checkbox.js.map +1 -0
  82. package/dist/collection/components/hy-collaboration/hy-collaboration.js +105 -99
  83. package/dist/collection/components/hy-collaboration/hy-collaboration.js.map +1 -0
  84. package/dist/collection/components/hy-crisis-banner/hy-crisis-banner.js +88 -85
  85. package/dist/collection/components/hy-crisis-banner/hy-crisis-banner.js.map +1 -0
  86. package/dist/collection/components/hy-dropdown/hy-dropdown.js +153 -147
  87. package/dist/collection/components/hy-dropdown/hy-dropdown.js.map +1 -0
  88. package/dist/collection/components/hy-dropdown/hy-dropdown.panel.item.js +76 -74
  89. package/dist/collection/components/hy-dropdown/hy-dropdown.panel.item.js.map +1 -0
  90. package/dist/collection/components/hy-dropdown/hy-dropdown.panel.js +27 -22
  91. package/dist/collection/components/hy-dropdown/hy-dropdown.panel.js.map +1 -0
  92. package/dist/collection/components/hy-event-item/hy-event-item.js +184 -192
  93. package/dist/collection/components/hy-event-item/hy-event-item.js.map +1 -0
  94. package/dist/collection/components/hy-events/hy-events.js +131 -127
  95. package/dist/collection/components/hy-events/hy-events.js.map +1 -0
  96. package/dist/collection/components/hy-filter-group/hy-filter-group.item.js +44 -41
  97. package/dist/collection/components/hy-filter-group/hy-filter-group.item.js.map +1 -0
  98. package/dist/collection/components/hy-filter-group/hy-filter-group.js +64 -54
  99. package/dist/collection/components/hy-filter-group/hy-filter-group.js.map +1 -0
  100. package/dist/collection/components/hy-filter-list-type/hy-filter-list-type.js +62 -56
  101. package/dist/collection/components/hy-filter-list-type/hy-filter-list-type.js.map +1 -0
  102. package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.js +38 -30
  103. package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.js.map +1 -0
  104. package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.reset.js +3 -4
  105. package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.reset.js.map +1 -0
  106. package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.reset.toggle.js +3 -8
  107. package/dist/collection/components/hy-filter-visibility-tool/hy-filter-visibility-tool.reset.toggle.js.map +1 -0
  108. package/dist/collection/components/hy-general-list/hy-general-list.js +123 -113
  109. package/dist/collection/components/hy-general-list/hy-general-list.js.map +1 -0
  110. package/dist/collection/components/hy-general-list-item/hy-general-list-item.js +256 -258
  111. package/dist/collection/components/hy-general-list-item/hy-general-list-item.js.map +1 -0
  112. package/dist/collection/components/hy-hero/hy-hero.css +2 -2
  113. package/dist/collection/components/hy-hero/hy-hero.js +296 -308
  114. package/dist/collection/components/hy-hero/hy-hero.js.map +1 -0
  115. package/dist/collection/components/hy-introduction/hy-introduction.js +248 -250
  116. package/dist/collection/components/hy-introduction/hy-introduction.js.map +1 -0
  117. package/dist/collection/components/hy-key-figure/hy-key-figure.js +73 -66
  118. package/dist/collection/components/hy-key-figure/hy-key-figure.js.map +1 -0
  119. package/dist/collection/components/hy-key-figure-group/hy-key-figure-group.css +1 -1
  120. package/dist/collection/components/hy-key-figure-group/hy-key-figure-group.js +67 -65
  121. package/dist/collection/components/hy-key-figure-group/hy-key-figure-group.js.map +1 -0
  122. package/dist/collection/components/hy-key-highlight/hy-key-highlight.js +73 -67
  123. package/dist/collection/components/hy-key-highlight/hy-key-highlight.js.map +1 -0
  124. package/dist/collection/components/hy-key-highlight-group/hy-key-highlight-group.css +2 -2
  125. package/dist/collection/components/hy-key-highlight-group/hy-key-highlight-group.js +79 -71
  126. package/dist/collection/components/hy-key-highlight-group/hy-key-highlight-group.js.map +1 -0
  127. package/dist/collection/components/hy-large-process-flow/hy-large-process-flow.css +6 -6
  128. package/dist/collection/components/hy-large-process-flow/hy-large-process-flow.js +55 -46
  129. package/dist/collection/components/hy-large-process-flow/hy-large-process-flow.js.map +1 -0
  130. package/dist/collection/components/hy-large-process-flow-phase/hy-large-process-flow-phase.css +3 -3
  131. package/dist/collection/components/hy-large-process-flow-phase/hy-large-process-flow-phase.js +41 -37
  132. package/dist/collection/components/hy-large-process-flow-phase/hy-large-process-flow-phase.js.map +1 -0
  133. package/dist/collection/components/hy-link-list/hy-link-list.js +107 -100
  134. package/dist/collection/components/hy-link-list/hy-link-list.js.map +1 -0
  135. package/dist/collection/components/hy-list-item/hy-list-item.js +429 -451
  136. package/dist/collection/components/hy-list-item/hy-list-item.js.map +1 -0
  137. package/dist/collection/components/hy-logo-grid/hy-logo-grid.item.js +54 -47
  138. package/dist/collection/components/hy-logo-grid/hy-logo-grid.item.js.map +1 -0
  139. package/dist/collection/components/hy-logo-grid/hy-logo-grid.js +54 -46
  140. package/dist/collection/components/hy-logo-grid/hy-logo-grid.js.map +1 -0
  141. package/dist/collection/components/hy-main/hy-main.js +35 -29
  142. package/dist/collection/components/hy-main/hy-main.js.map +1 -0
  143. package/dist/collection/components/hy-main-content-wrapper/hy-main-content-wrapper.js +13 -10
  144. package/dist/collection/components/hy-main-content-wrapper/hy-main-content-wrapper.js.map +1 -0
  145. package/dist/collection/components/hy-opening-hours/hy-opening-hours.css +2 -2
  146. package/dist/collection/components/hy-opening-hours/hy-opening-hours.js +305 -308
  147. package/dist/collection/components/hy-opening-hours/hy-opening-hours.js.map +1 -0
  148. package/dist/collection/components/hy-opening-hours-content/hy-opening-hours-content.css +2 -2
  149. package/dist/collection/components/hy-opening-hours-content/hy-opening-hours-content.js +108 -107
  150. package/dist/collection/components/hy-opening-hours-content/hy-opening-hours-content.js.map +1 -0
  151. package/dist/collection/components/hy-person-card/hy-person-card.js +423 -438
  152. package/dist/collection/components/hy-person-card/hy-person-card.js.map +1 -0
  153. package/dist/collection/components/hy-prominent-image/hy-prominent-image.js +107 -100
  154. package/dist/collection/components/hy-prominent-image/hy-prominent-image.js.map +1 -0
  155. package/dist/collection/components/hy-quote/hy-quote.js +52 -51
  156. package/dist/collection/components/hy-quote/hy-quote.js.map +1 -0
  157. package/dist/collection/components/hy-search-field/hy-search-field.js +167 -167
  158. package/dist/collection/components/hy-search-field/hy-search-field.js.map +1 -0
  159. package/dist/collection/components/hy-shortcuts/hy-shortcuts.css +1 -1
  160. package/dist/collection/components/hy-shortcuts/hy-shortcuts.js +90 -87
  161. package/dist/collection/components/hy-shortcuts/hy-shortcuts.js.map +1 -0
  162. package/dist/collection/components/hy-table-container/hy-table-container.css +6 -6
  163. package/dist/collection/components/hy-table-container/hy-table-container.js +13 -10
  164. package/dist/collection/components/hy-table-container/hy-table-container.js.map +1 -0
  165. package/dist/collection/components/hy-tabs/hy-tabs.js +116 -111
  166. package/dist/collection/components/hy-tabs/hy-tabs.js.map +1 -0
  167. package/dist/collection/components/hy-tabs-item/hy-tabs-item.js +37 -28
  168. package/dist/collection/components/hy-tabs-item/hy-tabs-item.js.map +1 -0
  169. package/dist/collection/components/hy-tag/hy-tag.js +13 -11
  170. package/dist/collection/components/hy-tag/hy-tag.js.map +1 -0
  171. package/dist/collection/components/hy-twitter-feed/hy-twitter-feed.js +108 -128
  172. package/dist/collection/components/hy-twitter-feed/hy-twitter-feed.js.map +1 -0
  173. package/dist/collection/components/hy-two-columns/hy-two-columns.js +35 -33
  174. package/dist/collection/components/hy-two-columns/hy-two-columns.js.map +1 -0
  175. package/dist/collection/components/hy-user-login-form/hy-user-login-form.js +54 -46
  176. package/dist/collection/components/hy-user-login-form/hy-user-login-form.js.map +1 -0
  177. package/dist/collection/components/hy-video/hy-video.css +1 -1
  178. package/dist/collection/components/hy-video/hy-video.js +463 -500
  179. package/dist/collection/components/hy-video/hy-video.js.map +1 -0
  180. package/dist/collection/components/icon/AddToTodoList.js +2 -2
  181. package/dist/collection/components/icon/AddToTodoList.js.map +1 -0
  182. package/dist/collection/components/icon/Alert.js +2 -3
  183. package/dist/collection/components/icon/Alert.js.map +1 -0
  184. package/dist/collection/components/icon/Archive.js +2 -5
  185. package/dist/collection/components/icon/Archive.js.map +1 -0
  186. package/dist/collection/components/icon/Arrow.js +2 -2
  187. package/dist/collection/components/icon/Arrow.js.map +1 -0
  188. package/dist/collection/components/icon/ArrowDown.js +2 -2
  189. package/dist/collection/components/icon/ArrowDown.js.map +1 -0
  190. package/dist/collection/components/icon/ArrowRight.js +2 -7
  191. package/dist/collection/components/icon/ArrowRight.js.map +1 -0
  192. package/dist/collection/components/icon/ArrowUp.js +2 -2
  193. package/dist/collection/components/icon/ArrowUp.js.map +1 -0
  194. package/dist/collection/components/icon/Avatar.js +2 -2
  195. package/dist/collection/components/icon/Avatar.js.map +1 -0
  196. package/dist/collection/components/icon/AvatarGroup.js +2 -2
  197. package/dist/collection/components/icon/AvatarGroup.js.map +1 -0
  198. package/dist/collection/components/icon/Bachelor.js +2 -2
  199. package/dist/collection/components/icon/Bachelor.js.map +1 -0
  200. package/dist/collection/components/icon/BulletList.js +2 -2
  201. package/dist/collection/components/icon/BulletList.js.map +1 -0
  202. package/dist/collection/components/icon/Camera.js +2 -2
  203. package/dist/collection/components/icon/Camera.js.map +1 -0
  204. package/dist/collection/components/icon/CaretDown.js +2 -2
  205. package/dist/collection/components/icon/CaretDown.js.map +1 -0
  206. package/dist/collection/components/icon/CaretLeft.js +2 -2
  207. package/dist/collection/components/icon/CaretLeft.js.map +1 -0
  208. package/dist/collection/components/icon/CaretRight.js +2 -2
  209. package/dist/collection/components/icon/CaretRight.js.map +1 -0
  210. package/dist/collection/components/icon/CaretUp.js +2 -2
  211. package/dist/collection/components/icon/CaretUp.js.map +1 -0
  212. package/dist/collection/components/icon/Chat.js +2 -2
  213. package/dist/collection/components/icon/Chat.js.map +1 -0
  214. package/dist/collection/components/icon/CodeFork.js +2 -2
  215. package/dist/collection/components/icon/CodeFork.js.map +1 -0
  216. package/dist/collection/components/icon/Cogs.js +2 -2
  217. package/dist/collection/components/icon/Cogs.js.map +1 -0
  218. package/dist/collection/components/icon/Contentlink.js +2 -2
  219. package/dist/collection/components/icon/Contentlink.js.map +1 -0
  220. package/dist/collection/components/icon/Customlink.js +2 -2
  221. package/dist/collection/components/icon/Customlink.js.map +1 -0
  222. package/dist/collection/components/icon/Date.js +2 -2
  223. package/dist/collection/components/icon/Date.js.map +1 -0
  224. package/dist/collection/components/icon/Discover.js +2 -2
  225. package/dist/collection/components/icon/Discover.js.map +1 -0
  226. package/dist/collection/components/icon/Done.js +2 -2
  227. package/dist/collection/components/icon/Done.js.map +1 -0
  228. package/dist/collection/components/icon/Dot.js +2 -2
  229. package/dist/collection/components/icon/Dot.js.map +1 -0
  230. package/dist/collection/components/icon/DotArrowRight.js +2 -6
  231. package/dist/collection/components/icon/DotArrowRight.js.map +1 -0
  232. package/dist/collection/components/icon/Download.js +2 -2
  233. package/dist/collection/components/icon/Download.js.map +1 -0
  234. package/dist/collection/components/icon/Drag.js +2 -2
  235. package/dist/collection/components/icon/Drag.js.map +1 -0
  236. package/dist/collection/components/icon/Dragbutton.js +2 -2
  237. package/dist/collection/components/icon/Dragbutton.js.map +1 -0
  238. package/dist/collection/components/icon/DropDown.js +2 -2
  239. package/dist/collection/components/icon/DropDown.js.map +1 -0
  240. package/dist/collection/components/icon/Edit.js +2 -2
  241. package/dist/collection/components/icon/Edit.js.map +1 -0
  242. package/dist/collection/components/icon/EditEvent.js +2 -2
  243. package/dist/collection/components/icon/EditEvent.js.map +1 -0
  244. package/dist/collection/components/icon/Embed.js +2 -2
  245. package/dist/collection/components/icon/Embed.js.map +1 -0
  246. package/dist/collection/components/icon/Euro.js +2 -2
  247. package/dist/collection/components/icon/Euro.js.map +1 -0
  248. package/dist/collection/components/icon/Events.js +2 -2
  249. package/dist/collection/components/icon/Events.js.map +1 -0
  250. package/dist/collection/components/icon/ExternalLink.js +2 -2
  251. package/dist/collection/components/icon/ExternalLink.js.map +1 -0
  252. package/dist/collection/components/icon/EyeSlash.js +2 -2
  253. package/dist/collection/components/icon/EyeSlash.js.map +1 -0
  254. package/dist/collection/components/icon/Facebook.js +2 -2
  255. package/dist/collection/components/icon/Facebook.js.map +1 -0
  256. package/dist/collection/components/icon/Favorites.js +2 -2
  257. package/dist/collection/components/icon/Favorites.js.map +1 -0
  258. package/dist/collection/components/icon/Feed.js +2 -2
  259. package/dist/collection/components/icon/Feed.js.map +1 -0
  260. package/dist/collection/components/icon/FileText.js +2 -2
  261. package/dist/collection/components/icon/FileText.js.map +1 -0
  262. package/dist/collection/components/icon/FullScreen.js +2 -2
  263. package/dist/collection/components/icon/FullScreen.js.map +1 -0
  264. package/dist/collection/components/icon/Globe.js +2 -2
  265. package/dist/collection/components/icon/Globe.js.map +1 -0
  266. package/dist/collection/components/icon/GooglePlus.js +2 -2
  267. package/dist/collection/components/icon/GooglePlus.js.map +1 -0
  268. package/dist/collection/components/icon/Grid.js +2 -2
  269. package/dist/collection/components/icon/Grid.js.map +1 -0
  270. package/dist/collection/components/icon/Hamburger.js +2 -2
  271. package/dist/collection/components/icon/Hamburger.js.map +1 -0
  272. package/dist/collection/components/icon/Heart.js +2 -2
  273. package/dist/collection/components/icon/Heart.js.map +1 -0
  274. package/dist/collection/components/icon/HeartSupport.js +2 -2
  275. package/dist/collection/components/icon/HeartSupport.js.map +1 -0
  276. package/dist/collection/components/icon/Helsinginyliopisto.js +2 -2
  277. package/dist/collection/components/icon/Helsinginyliopisto.js.map +1 -0
  278. package/dist/collection/components/icon/Home.js +2 -2
  279. package/dist/collection/components/icon/Home.js.map +1 -0
  280. package/dist/collection/components/icon/HorizontalResize.js +2 -2
  281. package/dist/collection/components/icon/HorizontalResize.js.map +1 -0
  282. package/dist/collection/components/icon/HyLogo.js +2 -2
  283. package/dist/collection/components/icon/HyLogo.js.map +1 -0
  284. package/dist/collection/components/icon/IdNumber.js +2 -2
  285. package/dist/collection/components/icon/IdNumber.js.map +1 -0
  286. package/dist/collection/components/icon/Image.js +2 -2
  287. package/dist/collection/components/icon/Image.js.map +1 -0
  288. package/dist/collection/components/icon/ImageGallery.js +2 -2
  289. package/dist/collection/components/icon/ImageGallery.js.map +1 -0
  290. package/dist/collection/components/icon/Images.js +2 -2
  291. package/dist/collection/components/icon/Images.js.map +1 -0
  292. package/dist/collection/components/icon/Info.js +2 -2
  293. package/dist/collection/components/icon/Info.js.map +1 -0
  294. package/dist/collection/components/icon/InfoStroke.js +2 -2
  295. package/dist/collection/components/icon/InfoStroke.js.map +1 -0
  296. package/dist/collection/components/icon/Instagram.js +2 -2
  297. package/dist/collection/components/icon/Instagram.js.map +1 -0
  298. package/dist/collection/components/icon/LeikiList.js +2 -2
  299. package/dist/collection/components/icon/LeikiList.js.map +1 -0
  300. package/dist/collection/components/icon/LinkArrow.js +2 -2
  301. package/dist/collection/components/icon/LinkArrow.js.map +1 -0
  302. package/dist/collection/components/icon/LinkArrow1.js +2 -2
  303. package/dist/collection/components/icon/LinkArrow1.js.map +1 -0
  304. package/dist/collection/components/icon/LinkArrowDown.js +2 -2
  305. package/dist/collection/components/icon/LinkArrowDown.js.map +1 -0
  306. package/dist/collection/components/icon/LinkArrowLeft.js +2 -2
  307. package/dist/collection/components/icon/LinkArrowLeft.js.map +1 -0
  308. package/dist/collection/components/icon/LinkArrowOffsite.js +2 -2
  309. package/dist/collection/components/icon/LinkArrowOffsite.js.map +1 -0
  310. package/dist/collection/components/icon/LinkArrowUp.js +2 -2
  311. package/dist/collection/components/icon/LinkArrowUp.js.map +1 -0
  312. package/dist/collection/components/icon/Linkedin.js +2 -2
  313. package/dist/collection/components/icon/Linkedin.js.map +1 -0
  314. package/dist/collection/components/icon/List.js +2 -2
  315. package/dist/collection/components/icon/List.js.map +1 -0
  316. package/dist/collection/components/icon/ListAsBlocks.js +2 -2
  317. package/dist/collection/components/icon/ListAsBlocks.js.map +1 -0
  318. package/dist/collection/components/icon/ListStyleGrid.js +2 -10
  319. package/dist/collection/components/icon/ListStyleGrid.js.map +1 -0
  320. package/dist/collection/components/icon/ListStyleList.js +2 -5
  321. package/dist/collection/components/icon/ListStyleList.js.map +1 -0
  322. package/dist/collection/components/icon/Listoflinks.js +2 -2
  323. package/dist/collection/components/icon/Listoflinks.js.map +1 -0
  324. package/dist/collection/components/icon/Location.js +2 -2
  325. package/dist/collection/components/icon/Location.js.map +1 -0
  326. package/dist/collection/components/icon/Log.js +2 -2
  327. package/dist/collection/components/icon/Log.js.map +1 -0
  328. package/dist/collection/components/icon/Login.js +2 -2
  329. package/dist/collection/components/icon/Login.js.map +1 -0
  330. package/dist/collection/components/icon/Logout.js +2 -2
  331. package/dist/collection/components/icon/Logout.js.map +1 -0
  332. package/dist/collection/components/icon/MagnifyMinus.js +2 -2
  333. package/dist/collection/components/icon/MagnifyMinus.js.map +1 -0
  334. package/dist/collection/components/icon/MagnifyPlus.js +2 -2
  335. package/dist/collection/components/icon/MagnifyPlus.js.map +1 -0
  336. package/dist/collection/components/icon/Mail.js +2 -2
  337. package/dist/collection/components/icon/Mail.js.map +1 -0
  338. package/dist/collection/components/icon/Master.js +2 -2
  339. package/dist/collection/components/icon/Master.js.map +1 -0
  340. package/dist/collection/components/icon/Minus.js +2 -2
  341. package/dist/collection/components/icon/Minus.js.map +1 -0
  342. package/dist/collection/components/icon/Mobile.js +2 -2
  343. package/dist/collection/components/icon/Mobile.js.map +1 -0
  344. package/dist/collection/components/icon/Modify.js +2 -2
  345. package/dist/collection/components/icon/Modify.js.map +1 -0
  346. package/dist/collection/components/icon/NaviTriangle.js +2 -2
  347. package/dist/collection/components/icon/NaviTriangle.js.map +1 -0
  348. package/dist/collection/components/icon/NewGroup.js +2 -2
  349. package/dist/collection/components/icon/NewGroup.js.map +1 -0
  350. package/dist/collection/components/icon/NewPerson.js +2 -2
  351. package/dist/collection/components/icon/NewPerson.js.map +1 -0
  352. package/dist/collection/components/icon/Notification.js +2 -2
  353. package/dist/collection/components/icon/Notification.js.map +1 -0
  354. package/dist/collection/components/icon/OpinderLogo.js +2 -2
  355. package/dist/collection/components/icon/OpinderLogo.js.map +1 -0
  356. package/dist/collection/components/icon/OpinderLogoNew.js +2 -2
  357. package/dist/collection/components/icon/OpinderLogoNew.js.map +1 -0
  358. package/dist/collection/components/icon/Pdf.js +2 -2
  359. package/dist/collection/components/icon/Pdf.js.map +1 -0
  360. package/dist/collection/components/icon/People.js +2 -2
  361. package/dist/collection/components/icon/People.js.map +1 -0
  362. package/dist/collection/components/icon/PermissionAll.js +2 -2
  363. package/dist/collection/components/icon/PermissionAll.js.map +1 -0
  364. package/dist/collection/components/icon/PermissionGroup.js +2 -2
  365. package/dist/collection/components/icon/PermissionGroup.js.map +1 -0
  366. package/dist/collection/components/icon/PermissionPrivate.js +2 -2
  367. package/dist/collection/components/icon/PermissionPrivate.js.map +1 -0
  368. package/dist/collection/components/icon/Person.js +2 -2
  369. package/dist/collection/components/icon/Person.js.map +1 -0
  370. package/dist/collection/components/icon/PersonOutline.js +2 -2
  371. package/dist/collection/components/icon/PersonOutline.js.map +1 -0
  372. package/dist/collection/components/icon/Phone.js +2 -2
  373. package/dist/collection/components/icon/Phone.js.map +1 -0
  374. package/dist/collection/components/icon/Play.js +2 -2
  375. package/dist/collection/components/icon/Play.js.map +1 -0
  376. package/dist/collection/components/icon/Plus.js +2 -2
  377. package/dist/collection/components/icon/Plus.js.map +1 -0
  378. package/dist/collection/components/icon/Preview.js +2 -2
  379. package/dist/collection/components/icon/Preview.js.map +1 -0
  380. package/dist/collection/components/icon/Profile.js +2 -2
  381. package/dist/collection/components/icon/Profile.js.map +1 -0
  382. package/dist/collection/components/icon/Question.js +2 -2
  383. package/dist/collection/components/icon/Question.js.map +1 -0
  384. package/dist/collection/components/icon/Remove.js +2 -2
  385. package/dist/collection/components/icon/Remove.js.map +1 -0
  386. package/dist/collection/components/icon/Retweet.js +2 -2
  387. package/dist/collection/components/icon/Retweet.js.map +1 -0
  388. package/dist/collection/components/icon/RotateLeft.js +2 -2
  389. package/dist/collection/components/icon/RotateLeft.js.map +1 -0
  390. package/dist/collection/components/icon/RotateRight.js +2 -2
  391. package/dist/collection/components/icon/RotateRight.js.map +1 -0
  392. package/dist/collection/components/icon/Search.js +2 -2
  393. package/dist/collection/components/icon/Search.js.map +1 -0
  394. package/dist/collection/components/icon/Share.js +2 -2
  395. package/dist/collection/components/icon/Share.js.map +1 -0
  396. package/dist/collection/components/icon/SlimHamburgerMenu.js +2 -2
  397. package/dist/collection/components/icon/SlimHamburgerMenu.js.map +1 -0
  398. package/dist/collection/components/icon/SocialMedia.js +2 -2
  399. package/dist/collection/components/icon/SocialMedia.js.map +1 -0
  400. package/dist/collection/components/icon/SomeFacebook.js +2 -2
  401. package/dist/collection/components/icon/SomeFacebook.js.map +1 -0
  402. package/dist/collection/components/icon/SomeInstagram.js +2 -4
  403. package/dist/collection/components/icon/SomeInstagram.js.map +1 -0
  404. package/dist/collection/components/icon/SomeLinkedin.js +2 -2
  405. package/dist/collection/components/icon/SomeLinkedin.js.map +1 -0
  406. package/dist/collection/components/icon/SomeTwitter.js +2 -2
  407. package/dist/collection/components/icon/SomeTwitter.js.map +1 -0
  408. package/dist/collection/components/icon/SomeYoutube.js +2 -2
  409. package/dist/collection/components/icon/SomeYoutube.js.map +1 -0
  410. package/dist/collection/components/icon/Spinner.js +2 -2
  411. package/dist/collection/components/icon/Spinner.js.map +1 -0
  412. package/dist/collection/components/icon/Square.js +2 -2
  413. package/dist/collection/components/icon/Square.js.map +1 -0
  414. package/dist/collection/components/icon/SquareChecked.js +2 -2
  415. package/dist/collection/components/icon/SquareChecked.js.map +1 -0
  416. package/dist/collection/components/icon/Time.js +2 -2
  417. package/dist/collection/components/icon/Time.js.map +1 -0
  418. package/dist/collection/components/icon/TodoList.js +2 -2
  419. package/dist/collection/components/icon/TodoList.js.map +1 -0
  420. package/dist/collection/components/icon/Tour.js +2 -2
  421. package/dist/collection/components/icon/Tour.js.map +1 -0
  422. package/dist/collection/components/icon/Twitter.js +2 -2
  423. package/dist/collection/components/icon/Twitter.js.map +1 -0
  424. package/dist/collection/components/icon/TwitterLike.js +2 -2
  425. package/dist/collection/components/icon/TwitterLike.js.map +1 -0
  426. package/dist/collection/components/icon/UnitsAndFaculties.js +2 -2
  427. package/dist/collection/components/icon/UnitsAndFaculties.js.map +1 -0
  428. package/dist/collection/components/icon/Url.js +2 -2
  429. package/dist/collection/components/icon/Url.js.map +1 -0
  430. package/dist/collection/components/icon/Video.js +2 -2
  431. package/dist/collection/components/icon/Video.js.map +1 -0
  432. package/dist/collection/components/icon/Warning.js +2 -2
  433. package/dist/collection/components/icon/Warning.js.map +1 -0
  434. package/dist/collection/components/icon/Wrench.js +2 -2
  435. package/dist/collection/components/icon/Wrench.js.map +1 -0
  436. package/dist/collection/components/icon/Youtube.js +2 -2
  437. package/dist/collection/components/icon/Youtube.js.map +1 -0
  438. package/dist/collection/components/icon/allIcons.js +1 -0
  439. package/dist/collection/components/icon/allIcons.js.map +1 -0
  440. package/dist/collection/components/icon/icon.js +68 -60
  441. package/dist/collection/components/icon/icon.js.map +1 -0
  442. package/dist/collection/components/icon/icons.js +5 -8
  443. package/dist/collection/components/icon/icons.js.map +1 -0
  444. package/dist/collection/components/image/image.js +148 -141
  445. package/dist/collection/components/image/image.js.map +1 -0
  446. package/dist/collection/components/ingress/ingress.js +35 -30
  447. package/dist/collection/components/ingress/ingress.js.map +1 -0
  448. package/dist/collection/components/link/link.js +107 -99
  449. package/dist/collection/components/link/link.js.map +1 -0
  450. package/dist/collection/components/link-box/link-box.css +0 -1
  451. package/dist/collection/components/link-box/link-box.js +271 -272
  452. package/dist/collection/components/link-box/link-box.js.map +1 -0
  453. package/dist/collection/components/link-box-list/link-box-list.js +96 -89
  454. package/dist/collection/components/link-box-list/link-box-list.js.map +1 -0
  455. package/dist/collection/components/navigation/hy-menu-main-group/hy-menu-main-group.js +286 -290
  456. package/dist/collection/components/navigation/hy-menu-main-group/hy-menu-main-group.js.map +1 -0
  457. package/dist/collection/components/navigation/menu-language/menu-language.js +148 -138
  458. package/dist/collection/components/navigation/menu-language/menu-language.js.map +1 -0
  459. package/dist/collection/components/navigation/menu-language-item/menu-language-item.js +124 -114
  460. package/dist/collection/components/navigation/menu-language-item/menu-language-item.js.map +1 -0
  461. package/dist/collection/components/pagination/hy-pager/hy-pager.js +13 -9
  462. package/dist/collection/components/pagination/hy-pager/hy-pager.js.map +1 -0
  463. package/dist/collection/components/pagination/hy-pager-item/hy-pager-item.js +93 -95
  464. package/dist/collection/components/pagination/hy-pager-item/hy-pager-item.js.map +1 -0
  465. package/dist/collection/components/paragraph-text/paragraph-text-content.css +14 -14
  466. package/dist/collection/components/paragraph-text/paragraph-text-landing.css +8 -8
  467. package/dist/collection/components/paragraph-text/paragraph-text.css +22 -22
  468. package/dist/collection/components/paragraph-text/paragraph-text.js +73 -67
  469. package/dist/collection/components/paragraph-text/paragraph-text.js.map +1 -0
  470. package/dist/collection/components/person-profile/person-profile-listing/person-profile-listing.css +1 -1
  471. package/dist/collection/components/person-profile/person-profile-listing/person-profile.listing.js +128 -126
  472. package/dist/collection/components/person-profile/person-profile-listing/person-profile.listing.js.map +1 -0
  473. package/dist/collection/components/person-profile/person-profile.css +4 -4
  474. package/dist/collection/components/person-profile/person-profile.js +139 -182
  475. package/dist/collection/components/person-profile/person-profile.js.map +1 -0
  476. package/dist/collection/components/process/process.js +72 -62
  477. package/dist/collection/components/process/process.js.map +1 -0
  478. package/dist/collection/components/process-flow-box/process-flow-box.js +145 -148
  479. package/dist/collection/components/process-flow-box/process-flow-box.js.map +1 -0
  480. package/dist/collection/components/row/row.js +69 -72
  481. package/dist/collection/components/row/row.js.map +1 -0
  482. package/dist/collection/components/section-container/section-container.js +13 -9
  483. package/dist/collection/components/section-container/section-container.js.map +1 -0
  484. package/dist/collection/components/site-header/site-header.css +1 -1
  485. package/dist/collection/components/site-header/site-header.js +541 -560
  486. package/dist/collection/components/site-header/site-header.js.map +1 -0
  487. package/dist/collection/components/site-header/site-logo/site-logo.js +149 -148
  488. package/dist/collection/components/site-header/site-logo/site-logo.js.map +1 -0
  489. package/dist/collection/components/site-header/site-search/site-search.css +3 -3
  490. package/dist/collection/components/site-header/site-search/site-search.js +298 -312
  491. package/dist/collection/components/site-header/site-search/site-search.js.map +1 -0
  492. package/dist/collection/components/tiny-text/tiny-text.js +13 -9
  493. package/dist/collection/components/tiny-text/tiny-text.js.map +1 -0
  494. package/dist/collection/global/colors.js +1 -0
  495. package/dist/collection/global/colors.js.map +1 -0
  496. package/dist/collection/global/globalScript.js +1 -0
  497. package/dist/collection/global/globalScript.js.map +1 -0
  498. package/dist/collection/global/typography.js +1 -0
  499. package/dist/collection/global/typography.js.map +1 -0
  500. package/dist/collection/index.js +1 -0
  501. package/dist/collection/index.js.map +1 -0
  502. package/dist/collection/utils/utils.js +1 -0
  503. package/dist/collection/utils/utils.js.map +1 -0
  504. package/dist/esm/color-box_8.entry.js +14 -37
  505. package/dist/esm/color-box_8.entry.js.map +1 -0
  506. package/dist/esm/{globalScript-9d045b36.js → globalScript-4ad40215.js} +3 -1
  507. package/dist/esm/globalScript-4ad40215.js.map +1 -0
  508. package/dist/esm/huds-lib.js +10 -4
  509. package/dist/esm/huds-lib.js.map +1 -0
  510. package/dist/esm/hy-accordion-container_83.entry.js +389 -193
  511. package/dist/esm/hy-accordion-container_83.entry.js.map +1 -0
  512. package/dist/esm/hy-event-item.entry.js +7 -2
  513. package/dist/esm/hy-event-item.entry.js.map +1 -0
  514. package/dist/esm/hy-events.entry.js +7 -3
  515. package/dist/esm/hy-events.entry.js.map +1 -0
  516. package/dist/esm/{index-daaf0985.js → index-3a66d87e.js} +692 -288
  517. package/dist/esm/index-3a66d87e.js.map +1 -0
  518. package/dist/esm/index.js +2 -0
  519. package/dist/esm/index.js.map +1 -0
  520. package/dist/esm/loader.js +7 -4
  521. package/dist/esm/loader.js.map +1 -0
  522. package/dist/esm/polyfills/css-shim.js +1 -1
  523. package/dist/esm/{utils-7731bbdf.js → utils-43c56d92.js} +3 -1
  524. package/dist/esm/utils-43c56d92.js.map +1 -0
  525. package/dist/huds-lib/huds-lib.esm.js +2 -1
  526. package/dist/huds-lib/huds-lib.esm.js.map +1 -0
  527. package/dist/huds-lib/index.esm.js +2 -0
  528. package/dist/huds-lib/index.esm.js.map +1 -0
  529. package/dist/huds-lib/p-1aeae669.entry.js +2 -0
  530. package/dist/huds-lib/p-1aeae669.entry.js.map +1 -0
  531. package/dist/huds-lib/p-30e3190a.entry.js +88 -0
  532. package/dist/huds-lib/p-30e3190a.entry.js.map +1 -0
  533. package/dist/huds-lib/p-63584350.js +2 -0
  534. package/dist/huds-lib/p-63584350.js.map +1 -0
  535. package/dist/huds-lib/p-7b75f0ea.entry.js +2 -0
  536. package/dist/huds-lib/p-7b75f0ea.entry.js.map +1 -0
  537. package/dist/huds-lib/p-b02e49ad.js +2 -0
  538. package/dist/huds-lib/p-b02e49ad.js.map +1 -0
  539. package/dist/huds-lib/p-c8ed784d.entry.js +2 -0
  540. package/dist/huds-lib/p-c8ed784d.entry.js.map +1 -0
  541. package/dist/huds-lib/p-ff975a68.js +3 -0
  542. package/dist/huds-lib/p-ff975a68.js.map +1 -0
  543. package/dist/types/components/courses/hy-content-list-item/hy-content-list-item.d.ts +1 -1
  544. package/dist/types/components/person-profile/person-profile-listing/person-profile.listing.d.ts +1 -1
  545. package/dist/types/components.d.ts +68 -20
  546. package/dist/types/stencil-public-runtime.d.ts +92 -19
  547. package/dist/types/utils/utils.d.ts +4 -4
  548. package/loader/index.d.ts +11 -12
  549. package/loader/index.es2017.js +1 -0
  550. package/loader/index.js +2 -11
  551. package/loader/package.json +2 -1
  552. package/package.json +12 -11
  553. package/dist/huds-lib/p-04dcccdc.js +0 -1
  554. package/dist/huds-lib/p-0ea3ec9a.js +0 -1
  555. package/dist/huds-lib/p-2244fcda.entry.js +0 -1
  556. package/dist/huds-lib/p-aba9f82a.entry.js +0 -1
  557. package/dist/huds-lib/p-bf06c2eb.entry.js +0 -87
  558. package/dist/huds-lib/p-c68c36c3.entry.js +0 -1
  559. package/dist/huds-lib/p-f8697bf9.js +0 -1
@@ -22,6 +22,14 @@ function _interopNamespace(e) {
22
22
 
23
23
  const NAMESPACE = 'huds-lib';
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 contentRef;
27
35
  let hostTagName;
@@ -31,65 +39,6 @@ let checkSlotRelocate = false;
31
39
  let isSvgMode = false;
32
40
  let queueCongestion = 0;
33
41
  let queuePending = false;
34
- const win = typeof window !== 'undefined' ? window : {};
35
- const doc = win.document || { head: {} };
36
- const plt = {
37
- $flags$: 0,
38
- $resourcesUrl$: '',
39
- jmp: (h) => h(),
40
- raf: (h) => requestAnimationFrame(h),
41
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
42
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
43
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
44
- };
45
- const promiseResolve = (v) => Promise.resolve(v);
46
- const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
47
- try {
48
- new CSSStyleSheet();
49
- return typeof new CSSStyleSheet().replace === 'function';
50
- }
51
- catch (e) { }
52
- return false;
53
- })()
54
- ;
55
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
56
- if (listeners) {
57
- listeners.map(([flags, name, method]) => {
58
- const target = getHostListenerTarget(elm, flags) ;
59
- const handler = hostListenerProxy(hostRef, method);
60
- const opts = hostListenerOpts(flags);
61
- plt.ael(target, name, handler, opts);
62
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
63
- });
64
- }
65
- };
66
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
67
- try {
68
- {
69
- if (hostRef.$flags$ & 256 /* isListenReady */) {
70
- // instance is ready, let's call it's member method for this event
71
- hostRef.$lazyInstance$[methodName](ev);
72
- }
73
- else {
74
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
75
- }
76
- }
77
- }
78
- catch (e) {
79
- consoleError(e);
80
- }
81
- };
82
- const getHostListenerTarget = (elm, flags) => {
83
- if (flags & 4 /* TargetDocument */)
84
- return doc;
85
- if (flags & 8 /* TargetWindow */)
86
- return win;
87
- return elm;
88
- };
89
- // prettier-ignore
90
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
91
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
92
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
93
42
  const createTime = (fnName, tagName = '') => {
94
43
  {
95
44
  return () => {
@@ -104,75 +53,8 @@ const uniqueTime = (key, measureText) => {
104
53
  };
105
54
  }
106
55
  };
107
- const rootAppliedStyles = new WeakMap();
108
- const registerStyle = (scopeId, cssText, allowCS) => {
109
- let style = styles.get(scopeId);
110
- if (supportsConstructibleStylesheets && allowCS) {
111
- style = (style || new CSSStyleSheet());
112
- style.replace(cssText);
113
- }
114
- else {
115
- style = cssText;
116
- }
117
- styles.set(scopeId, style);
118
- };
119
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
120
- let scopeId = getScopeId(cmpMeta, mode);
121
- let style = styles.get(scopeId);
122
- // if an element is NOT connected then getRootNode() will return the wrong root node
123
- // so the fallback is to always use the document for the root node in those cases
124
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
125
- if (style) {
126
- if (typeof style === 'string') {
127
- styleContainerNode = styleContainerNode.head || styleContainerNode;
128
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
129
- let styleElm;
130
- if (!appliedStyles) {
131
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
132
- }
133
- if (!appliedStyles.has(scopeId)) {
134
- {
135
- {
136
- styleElm = doc.createElement('style');
137
- styleElm.innerHTML = style;
138
- }
139
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
140
- }
141
- if (appliedStyles) {
142
- appliedStyles.add(scopeId);
143
- }
144
- }
145
- }
146
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
147
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
148
- }
149
- }
150
- return scopeId;
151
- };
152
- const attachStyles = (hostRef) => {
153
- const cmpMeta = hostRef.$cmpMeta$;
154
- const elm = hostRef.$hostElement$;
155
- const flags = cmpMeta.$flags$;
156
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
157
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$);
158
- if (flags & 10 /* needsScopedEncapsulation */) {
159
- // only required when we're NOT using native shadow dom (slot)
160
- // or this browser doesn't support native shadow dom
161
- // and this host element was NOT created with SSR
162
- // let's pick out the inner content for slot projection
163
- // create a node to represent where the original
164
- // content was first placed, which is useful later on
165
- // DOM WRITE!!
166
- elm['s-sc'] = scopeId;
167
- elm.classList.add(scopeId + '-h');
168
- }
169
- endAttachStyles();
170
- };
171
- const getScopeId = (cmp, mode) => 'sc-' + (mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + '-' + mode : cmp.$tagName$);
172
- // Private
173
- const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
174
- // Public
175
- const setMode = (handler) => modeResolutionChain.push(handler);
56
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
57
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
176
58
  /**
177
59
  * Default style mode id
178
60
  */
@@ -187,11 +69,30 @@ const EMPTY_OBJ = {};
187
69
  const SVG_NS = 'http://www.w3.org/2000/svg';
188
70
  const HTML_NS = 'http://www.w3.org/1999/xhtml';
189
71
  const isDef = (v) => v != null;
72
+ /**
73
+ * Check whether a value is a 'complex type', defined here as an object or a
74
+ * function.
75
+ *
76
+ * @param o the value to check
77
+ * @returns whether it's a complex type or not
78
+ */
190
79
  const isComplexType = (o) => {
191
80
  // https://jsperf.com/typeof-fn-object/5
192
81
  o = typeof o;
193
82
  return o === 'object' || o === 'function';
194
83
  };
84
+ /**
85
+ * Helper method for querying a `meta` tag that contains a nonce value
86
+ * out of a DOM's head.
87
+ *
88
+ * @param doc The DOM containing the `head` to query against
89
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
90
+ * exists or the tag has no content.
91
+ */
92
+ function queryNonceMetaTagContent(doc) {
93
+ var _a, _b, _c;
94
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
95
+ }
195
96
  /**
196
97
  * Production h() function based on Preact by
197
98
  * Jason Miller (@developit)
@@ -200,7 +101,6 @@ const isComplexType = (o) => {
200
101
  *
201
102
  * Modified for Stencil's compiler and vdom
202
103
  */
203
- // const stack: any[] = [];
204
104
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
205
105
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
206
106
  const h = (nodeName, vnodeData, ...children) => {
@@ -209,7 +109,7 @@ const h = (nodeName, vnodeData, ...children) => {
209
109
  let slotName = null;
210
110
  let simple = false;
211
111
  let lastSimple = false;
212
- let vNodeChildren = [];
112
+ const vNodeChildren = [];
213
113
  const walk = (c) => {
214
114
  for (let i = 0; i < c.length; i++) {
215
115
  child = c[i];
@@ -270,6 +170,14 @@ const h = (nodeName, vnodeData, ...children) => {
270
170
  }
271
171
  return vnode;
272
172
  };
173
+ /**
174
+ * A utility function for creating a virtual DOM node from a tag and some
175
+ * possible text content.
176
+ *
177
+ * @param tag the tag for this element
178
+ * @param text possible text content for the node
179
+ * @returns a newly-minted virtual DOM node
180
+ */
273
181
  const newVNode = (tag, text) => {
274
182
  const vnode = {
275
183
  $flags$: 0,
@@ -290,11 +198,31 @@ const newVNode = (tag, text) => {
290
198
  return vnode;
291
199
  };
292
200
  const Host = {};
201
+ /**
202
+ * Check whether a given node is a Host node or not
203
+ *
204
+ * @param node the virtual DOM node to check
205
+ * @returns whether it's a Host node or not
206
+ */
293
207
  const isHost = (node) => node && node.$tag$ === Host;
208
+ /**
209
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
210
+ *
211
+ * Note that these functions convert from {@link d.VNode} to
212
+ * {@link d.ChildNode} to give functional component developers a friendly
213
+ * interface.
214
+ */
294
215
  const vdomFnUtils = {
295
216
  forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
296
217
  map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
297
218
  };
219
+ /**
220
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
221
+ * friendlier public interface (hence, 'convertToPublic').
222
+ *
223
+ * @param node the virtual DOM node to convert
224
+ * @returns a converted child node
225
+ */
298
226
  const convertToPublic = (node) => ({
299
227
  vattrs: node.$attrs$,
300
228
  vchildren: node.$children$,
@@ -303,6 +231,15 @@ const convertToPublic = (node) => ({
303
231
  vtag: node.$tag$,
304
232
  vtext: node.$text$,
305
233
  });
234
+ /**
235
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
236
+ * order to use the resulting object in the virtual DOM. The initial object was
237
+ * likely created as part of presenting a public API, so converting it back
238
+ * involved making it 'private' again (hence, `convertToPrivate`).
239
+ *
240
+ * @param node the child node to convert
241
+ * @returns a converted virtual DOM node
242
+ */
306
243
  const convertToPrivate = (node) => {
307
244
  if (typeof node.vtag === 'function') {
308
245
  const vnodeData = Object.assign({}, node.vattrs);
@@ -321,6 +258,161 @@ const convertToPrivate = (node) => {
321
258
  vnode.$name$ = node.vname;
322
259
  return vnode;
323
260
  };
261
+ // Private
262
+ const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
263
+ // Public
264
+ const setMode = (handler) => modeResolutionChain.push(handler);
265
+ /**
266
+ * Parse a new property value for a given property type.
267
+ *
268
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
269
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
270
+ * 1. `any`, the type given to `propValue` in the function signature
271
+ * 2. the type stored from `propType`.
272
+ *
273
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
274
+ *
275
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
276
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
277
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
278
+ * ```tsx
279
+ * <my-cmp prop-val={0}></my-cmp>
280
+ * ```
281
+ *
282
+ * HTML prop values on the other hand, will always a string
283
+ *
284
+ * @param propValue the new value to coerce to some type
285
+ * @param propType the type of the prop, expressed as a binary number
286
+ * @returns the parsed/coerced value
287
+ */
288
+ const parsePropertyValue = (propValue, propType) => {
289
+ // ensure this value is of the correct prop type
290
+ if (propValue != null && !isComplexType(propValue)) {
291
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
292
+ // per the HTML spec, any string value means it is a boolean true value
293
+ // but we'll cheat here and say that the string "false" is the boolean false
294
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
295
+ }
296
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
297
+ // force it to be a number
298
+ return parseFloat(propValue);
299
+ }
300
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
301
+ // could have been passed as a number or boolean
302
+ // but we still want it as a string
303
+ return String(propValue);
304
+ }
305
+ // redundant return here for better minification
306
+ return propValue;
307
+ }
308
+ // not sure exactly what type we want
309
+ // so no need to change to a different type
310
+ return propValue;
311
+ };
312
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
313
+ const createEvent = (ref, name, flags) => {
314
+ const elm = getElement(ref);
315
+ return {
316
+ emit: (detail) => {
317
+ return emitEvent(elm, name, {
318
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
319
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
320
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
321
+ detail,
322
+ });
323
+ },
324
+ };
325
+ };
326
+ /**
327
+ * Helper function to create & dispatch a custom Event on a provided target
328
+ * @param elm the target of the Event
329
+ * @param name the name to give the custom Event
330
+ * @param opts options for configuring a custom Event
331
+ * @returns the custom Event
332
+ */
333
+ const emitEvent = (elm, name, opts) => {
334
+ const ev = plt.ce(name, opts);
335
+ elm.dispatchEvent(ev);
336
+ return ev;
337
+ };
338
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
339
+ const registerStyle = (scopeId, cssText, allowCS) => {
340
+ let style = styles.get(scopeId);
341
+ if (supportsConstructableStylesheets && allowCS) {
342
+ style = (style || new CSSStyleSheet());
343
+ if (typeof style === 'string') {
344
+ style = cssText;
345
+ }
346
+ else {
347
+ style.replaceSync(cssText);
348
+ }
349
+ }
350
+ else {
351
+ style = cssText;
352
+ }
353
+ styles.set(scopeId, style);
354
+ };
355
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
356
+ var _a;
357
+ let scopeId = getScopeId(cmpMeta, mode);
358
+ const style = styles.get(scopeId);
359
+ // if an element is NOT connected then getRootNode() will return the wrong root node
360
+ // so the fallback is to always use the document for the root node in those cases
361
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
362
+ if (style) {
363
+ if (typeof style === 'string') {
364
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
365
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
366
+ let styleElm;
367
+ if (!appliedStyles) {
368
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
369
+ }
370
+ if (!appliedStyles.has(scopeId)) {
371
+ {
372
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
373
+ {
374
+ styleElm = doc.createElement('style');
375
+ styleElm.innerHTML = style;
376
+ }
377
+ // Apply CSP nonce to the style tag if it exists
378
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
379
+ if (nonce != null) {
380
+ styleElm.setAttribute('nonce', nonce);
381
+ }
382
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
383
+ }
384
+ if (appliedStyles) {
385
+ appliedStyles.add(scopeId);
386
+ }
387
+ }
388
+ }
389
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
390
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
391
+ }
392
+ }
393
+ return scopeId;
394
+ };
395
+ const attachStyles = (hostRef) => {
396
+ const cmpMeta = hostRef.$cmpMeta$;
397
+ const elm = hostRef.$hostElement$;
398
+ const flags = cmpMeta.$flags$;
399
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
400
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$);
401
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
402
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
403
+ // only required when we're NOT using native shadow dom (slot)
404
+ // or this browser doesn't support native shadow dom
405
+ // and this host element was NOT created with SSR
406
+ // let's pick out the inner content for slot projection
407
+ // create a node to represent where the original
408
+ // content was first placed, which is useful later on
409
+ // DOM WRITE!!
410
+ elm['s-sc'] = scopeId;
411
+ elm.classList.add(scopeId + '-h');
412
+ }
413
+ endAttachStyles();
414
+ };
415
+ const getScopeId = (cmp, mode) => 'sc-' + (mode && cmp.$flags$ & 32 /* CMP_FLAGS.hasMode */ ? cmp.$tagName$ + '-' + mode : cmp.$tagName$);
324
416
  /**
325
417
  * Production setAccessor() function based on Preact by
326
418
  * Jason Miller (@developit)
@@ -418,7 +510,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
418
510
  if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
419
511
  try {
420
512
  if (!elm.tagName.includes('-')) {
421
- let n = newValue == null ? '' : newValue;
513
+ const n = newValue == null ? '' : newValue;
422
514
  // Workaround for Safari, moving the <input> caret when re-assigning the same valued
423
515
  if (memberName === 'list') {
424
516
  isProp = false;
@@ -457,7 +549,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
457
549
  }
458
550
  }
459
551
  }
460
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
552
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
461
553
  newValue = newValue === true ? '' : newValue;
462
554
  if (xlink) {
463
555
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -475,7 +567,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
475
567
  // if the element passed in is a shadow root, which is a document fragment
476
568
  // then we want to be adding attrs/props to the shadow root's "host" element
477
569
  // if it's not a shadow root, then we add attrs/props to the same element
478
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
570
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
479
571
  ? newVnode.$elm$.host
480
572
  : newVnode.$elm$;
481
573
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -493,9 +585,19 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
493
585
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
494
586
  }
495
587
  };
588
+ /**
589
+ * Create a DOM Node corresponding to one of the children of a given VNode.
590
+ *
591
+ * @param oldParentVNode the parent VNode from the previous render
592
+ * @param newParentVNode the parent VNode from the current render
593
+ * @param childIndex the index of the VNode, in the _new_ parent node's
594
+ * children, for which we will create a new DOM node
595
+ * @param parentElm the parent DOM node which our new node will be a child of
596
+ * @returns the newly created node
597
+ */
496
598
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
497
599
  // tslint:disable-next-line: prefer-const
498
- let newVNode = newParentVNode.$children$[childIndex];
600
+ const newVNode = newParentVNode.$children$[childIndex];
499
601
  let i = 0;
500
602
  let elm;
501
603
  let childNode;
@@ -510,16 +612,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
510
612
  }
511
613
  newVNode.$flags$ |= newVNode.$children$
512
614
  ? // slot element has fallback content
513
- 2 /* isSlotFallback */
615
+ 2 /* VNODE_FLAGS.isSlotFallback */
514
616
  : // slot element does not have fallback content
515
- 1 /* isSlotReference */;
617
+ 1 /* VNODE_FLAGS.isSlotReference */;
516
618
  }
517
619
  }
518
620
  if (newVNode.$text$ !== null) {
519
621
  // create text node
520
622
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
521
623
  }
522
- else if (newVNode.$flags$ & 1 /* isSlotReference */) {
624
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
523
625
  // create a slot reference node
524
626
  elm = newVNode.$elm$ =
525
627
  doc.createTextNode('');
@@ -529,7 +631,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
529
631
  isSvgMode = newVNode.$tag$ === 'svg';
530
632
  }
531
633
  // create element
532
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
634
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
533
635
  ? 'slot-fb'
534
636
  : newVNode.$tag$)
535
637
  );
@@ -569,7 +671,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
569
671
  }
570
672
  {
571
673
  elm['s-hn'] = hostTagName;
572
- if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
674
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
573
675
  // remember the content reference comment
574
676
  elm['s-sr'] = true;
575
677
  // remember the content reference comment
@@ -588,7 +690,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
588
690
  return elm;
589
691
  };
590
692
  const putBackInOriginalLocation = (parentElm, recursive) => {
591
- plt.$flags$ |= 1 /* isTmpDisconnected */;
693
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
592
694
  const oldSlotChildNodes = parentElm.childNodes;
593
695
  for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
594
696
  const childNode = oldSlotChildNodes[i];
@@ -609,8 +711,23 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
609
711
  putBackInOriginalLocation(childNode, recursive);
610
712
  }
611
713
  }
612
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
714
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
613
715
  };
716
+ /**
717
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
718
+ * add them to the DOM in the appropriate place.
719
+ *
720
+ * @param parentElm the DOM node which should be used as a parent for the new
721
+ * DOM nodes
722
+ * @param before a child of the `parentElm` which the new children should be
723
+ * inserted before (optional)
724
+ * @param parentVNode the parent virtual DOM node
725
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
726
+ * @param startIdx the index in the child virtual DOM nodes at which to start
727
+ * creating DOM nodes (inclusive)
728
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
729
+ * creating DOM nodes (inclusive)
730
+ */
614
731
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
615
732
  let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
616
733
  let childNode;
@@ -627,30 +744,112 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
627
744
  }
628
745
  }
629
746
  };
630
- const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
631
- for (; startIdx <= endIdx; ++startIdx) {
632
- if ((vnode = vnodes[startIdx])) {
633
- elm = vnode.$elm$;
634
- callNodeRefs(vnode);
635
- {
636
- // we're removing this element
637
- // so it's possible we need to show slot fallback content now
638
- checkSlotFallbackVisibility = true;
639
- if (elm['s-ol']) {
640
- // remove the original location comment
641
- elm['s-ol'].remove();
642
- }
643
- else {
644
- // it's possible that child nodes of the node
645
- // that's being removed are slot nodes
646
- putBackInOriginalLocation(elm, true);
747
+ /**
748
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
749
+ * This can be used to, for instance, clean up after a list of children which
750
+ * should no longer be shown.
751
+ *
752
+ * This function also handles some of Stencil's slot relocation logic.
753
+ *
754
+ * @param vnodes a list of virtual DOM nodes to remove
755
+ * @param startIdx the index at which to start removing nodes (inclusive)
756
+ * @param endIdx the index at which to stop removing nodes (inclusive)
757
+ */
758
+ const removeVnodes = (vnodes, startIdx, endIdx) => {
759
+ for (let index = startIdx; index <= endIdx; ++index) {
760
+ const vnode = vnodes[index];
761
+ if (vnode) {
762
+ const elm = vnode.$elm$;
763
+ nullifyVNodeRefs(vnode);
764
+ if (elm) {
765
+ {
766
+ // we're removing this element
767
+ // so it's possible we need to show slot fallback content now
768
+ checkSlotFallbackVisibility = true;
769
+ if (elm['s-ol']) {
770
+ // remove the original location comment
771
+ elm['s-ol'].remove();
772
+ }
773
+ else {
774
+ // it's possible that child nodes of the node
775
+ // that's being removed are slot nodes
776
+ putBackInOriginalLocation(elm, true);
777
+ }
647
778
  }
779
+ // remove the vnode's element from the dom
780
+ elm.remove();
648
781
  }
649
- // remove the vnode's element from the dom
650
- elm.remove();
651
782
  }
652
783
  }
653
784
  };
785
+ /**
786
+ * Reconcile the children of a new VNode with the children of an old VNode by
787
+ * traversing the two collections of children, identifying nodes that are
788
+ * conserved or changed, calling out to `patch` to make any necessary
789
+ * updates to the DOM, and rearranging DOM nodes as needed.
790
+ *
791
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
792
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
793
+ * 'windows' by storing start and end indices and references to the
794
+ * corresponding array entries. Initially the two 'windows' are basically equal
795
+ * to the entire array, but we progressively narrow the windows until there are
796
+ * no children left to update by doing the following:
797
+ *
798
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
799
+ * that if we have an initial array like the following we'll end up dealing
800
+ * only with a window bounded by the highlighted elements:
801
+ *
802
+ * [null, null, VNode1 , ... , VNode2, null, null]
803
+ * ^^^^^^ ^^^^^^
804
+ *
805
+ * 2. Check to see if the elements at the head and tail positions are equal
806
+ * across the windows. This will basically detect elements which haven't
807
+ * been added, removed, or changed position, i.e. if you had the following
808
+ * VNode elements (represented as HTML):
809
+ *
810
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
811
+ * newVNode: `<div><p><span>THERE</span></p></div>`
812
+ *
813
+ * Then when comparing the children of the `<div>` tag we check the equality
814
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
815
+ * same tag in the same position, we'd be able to avoid completely
816
+ * re-rendering the subtree under them with a new DOM element and would just
817
+ * call out to `patch` to handle reconciling their children and so on.
818
+ *
819
+ * 3. Check, for both windows, to see if the element at the beginning of the
820
+ * window corresponds to the element at the end of the other window. This is
821
+ * a heuristic which will let us identify _some_ situations in which
822
+ * elements have changed position, for instance it _should_ detect that the
823
+ * children nodes themselves have not changed but merely moved in the
824
+ * following example:
825
+ *
826
+ * oldVNode: `<div><element-one /><element-two /></div>`
827
+ * newVNode: `<div><element-two /><element-one /></div>`
828
+ *
829
+ * If we find cases like this then we also need to move the concrete DOM
830
+ * elements corresponding to the moved children to write the re-order to the
831
+ * DOM.
832
+ *
833
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
834
+ * nodes in the old children which have the same key as the first element in
835
+ * our window on the new children. If we find such a node we handle calling
836
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
837
+ * what we find.
838
+ *
839
+ * Finally, once we've narrowed our 'windows' to the point that either of them
840
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
841
+ * insertion or deletion that needs to happen to get a DOM state that correctly
842
+ * reflects the new child VNodes. If, for instance, after our window on the old
843
+ * children has collapsed we still have more nodes on the new children that
844
+ * we haven't dealt with yet then we need to add them, or if the new children
845
+ * collapse but we still have unhandled _old_ children then we need to make
846
+ * sure the corresponding DOM nodes are removed.
847
+ *
848
+ * @param parentElm the node into which the parent VNode is rendered
849
+ * @param oldCh the old children of the parent node
850
+ * @param newVNode the new VNode which will replace the parent
851
+ * @param newCh the new children of the parent node
852
+ */
654
853
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
655
854
  let oldStartIdx = 0;
656
855
  let newStartIdx = 0;
@@ -666,7 +865,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
666
865
  let elmToMove;
667
866
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
668
867
  if (oldStartVnode == null) {
669
- // Vnode might have been moved left
868
+ // VNode might have been moved left
670
869
  oldStartVnode = oldCh[++oldStartIdx];
671
870
  }
672
871
  else if (oldEndVnode == null) {
@@ -679,37 +878,100 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
679
878
  newEndVnode = newCh[--newEndIdx];
680
879
  }
681
880
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
881
+ // if the start nodes are the same then we should patch the new VNode
882
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
883
+ // indices to reflect that. We don't need to move any DOM Nodes around
884
+ // since things are matched up in order.
682
885
  patch(oldStartVnode, newStartVnode);
683
886
  oldStartVnode = oldCh[++oldStartIdx];
684
887
  newStartVnode = newCh[++newStartIdx];
685
888
  }
686
889
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
890
+ // likewise, if the end nodes are the same we patch new onto old and
891
+ // decrement our end indices, and also likewise in this case we don't
892
+ // need to move any DOM Nodes.
687
893
  patch(oldEndVnode, newEndVnode);
688
894
  oldEndVnode = oldCh[--oldEndIdx];
689
895
  newEndVnode = newCh[--newEndIdx];
690
896
  }
691
897
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
692
- // Vnode moved right
898
+ // case: "Vnode moved right"
899
+ //
900
+ // We've found that the last node in our window on the new children is
901
+ // the same VNode as the _first_ node in our window on the old children
902
+ // we're dealing with now. Visually, this is the layout of these two
903
+ // nodes:
904
+ //
905
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
906
+ // ^^^^^^^^^^^
907
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
908
+ // ^^^^^^^^^^^^^
909
+ //
910
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
911
+ // and move the DOM element for `oldStartVnode`.
693
912
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
694
913
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
695
914
  }
696
915
  patch(oldStartVnode, newEndVnode);
916
+ // We need to move the element for `oldStartVnode` into a position which
917
+ // will be appropriate for `newEndVnode`. For this we can use
918
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
919
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
920
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
921
+ //
922
+ // <old-start-node />
923
+ // <some-intervening-node />
924
+ // <old-end-node />
925
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
926
+ // <next-sibling />
927
+ //
928
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
929
+ // the node for `oldStartVnode` at the end of the children of
930
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
931
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
932
+ // append it to the children of the parent element.
697
933
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
698
934
  oldStartVnode = oldCh[++oldStartIdx];
699
935
  newEndVnode = newCh[--newEndIdx];
700
936
  }
701
937
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
702
- // Vnode moved left
938
+ // case: "Vnode moved left"
939
+ //
940
+ // We've found that the first node in our window on the new children is
941
+ // the same VNode as the _last_ node in our window on the old children.
942
+ // Visually, this is the layout of these two nodes:
943
+ //
944
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
945
+ // ^^^^^^^^^^^^^
946
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
947
+ // ^^^^^^^^^^^
948
+ //
949
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
950
+ // (which will handle updating any changed attributes, reconciling their
951
+ // children etc) but we also need to move the DOM node to which
952
+ // `oldEndVnode` corresponds.
703
953
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
704
954
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
705
955
  }
706
956
  patch(oldEndVnode, newStartVnode);
957
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
958
+ // the same node, so since we're here we know that they are not. Thus we
959
+ // can move the element for `oldEndVnode` _before_ the element for
960
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
961
+ // future.
707
962
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
708
963
  oldEndVnode = oldCh[--oldEndIdx];
709
964
  newStartVnode = newCh[++newStartIdx];
710
965
  }
711
966
  else {
712
- // createKeyToOldIdx
967
+ // Here we do some checks to match up old and new nodes based on the
968
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
969
+ // in the JSX for a DOM element in the implementation of a Stencil
970
+ // component.
971
+ //
972
+ // First we check to see if there are any nodes in the array of old
973
+ // children which have the same key as the first node in the new
974
+ // children.
713
975
  idxInOld = -1;
714
976
  {
715
977
  for (i = oldStartIdx; i <= oldEndIdx; ++i) {
@@ -720,23 +982,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
720
982
  }
721
983
  }
722
984
  if (idxInOld >= 0) {
985
+ // We found a node in the old children which matches up with the first
986
+ // node in the new children! So let's deal with that
723
987
  elmToMove = oldCh[idxInOld];
724
988
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
989
+ // the tag doesn't match so we'll need a new DOM element
725
990
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
726
991
  }
727
992
  else {
728
993
  patch(elmToMove, newStartVnode);
994
+ // invalidate the matching old node so that we won't try to update it
995
+ // again later on
729
996
  oldCh[idxInOld] = undefined;
730
997
  node = elmToMove.$elm$;
731
998
  }
732
999
  newStartVnode = newCh[++newStartIdx];
733
1000
  }
734
1001
  else {
735
- // new element
1002
+ // We either didn't find an element in the old children that matches
1003
+ // the key of the first new child OR the build is not using `key`
1004
+ // attributes at all. In either case we need to create a new element
1005
+ // for the new node.
736
1006
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
737
1007
  newStartVnode = newCh[++newStartIdx];
738
1008
  }
739
1009
  if (node) {
1010
+ // if we created a new node then handle inserting it to the DOM
740
1011
  {
741
1012
  parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
742
1013
  }
@@ -744,21 +1015,44 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
744
1015
  }
745
1016
  }
746
1017
  if (oldStartIdx > oldEndIdx) {
1018
+ // we have some more new nodes to add which don't match up with old nodes
747
1019
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
748
1020
  }
749
1021
  else if (newStartIdx > newEndIdx) {
1022
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
1023
+ // in the new array, so lets remove them (which entails cleaning up the
1024
+ // relevant DOM nodes)
750
1025
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
751
1026
  }
752
1027
  };
753
- const isSameVnode = (vnode1, vnode2) => {
1028
+ /**
1029
+ * Compare two VNodes to determine if they are the same
1030
+ *
1031
+ * **NB**: This function is an equality _heuristic_ based on the available
1032
+ * information set on the two VNodes and can be misleading under certain
1033
+ * circumstances. In particular, if the two nodes do not have `key` attrs
1034
+ * (available under `$key$` on VNodes) then the function falls back on merely
1035
+ * checking that they have the same tag.
1036
+ *
1037
+ * So, in other words, if `key` attrs are not set on VNodes which may be
1038
+ * changing order within a `children` array or something along those lines then
1039
+ * we could obtain a false negative and then have to do needless re-rendering
1040
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
1041
+ *
1042
+ * @param leftVNode the first VNode to check
1043
+ * @param rightVNode the second VNode to check
1044
+ * @returns whether they're equal or not
1045
+ */
1046
+ const isSameVnode = (leftVNode, rightVNode) => {
754
1047
  // compare if two vnode to see if they're "technically" the same
755
1048
  // need to have the same element tag, and same key to be the same
756
- if (vnode1.$tag$ === vnode2.$tag$) {
757
- if (vnode1.$tag$ === 'slot') {
758
- return vnode1.$name$ === vnode2.$name$;
1049
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1050
+ if (leftVNode.$tag$ === 'slot') {
1051
+ return leftVNode.$name$ === rightVNode.$name$;
759
1052
  }
1053
+ // this will be set if components in the build have `key` attrs set on them
760
1054
  {
761
- return vnode1.$key$ === vnode2.$key$;
1055
+ return leftVNode.$key$ === rightVNode.$key$;
762
1056
  }
763
1057
  }
764
1058
  return false;
@@ -771,6 +1065,14 @@ const referenceNode = (node) => {
771
1065
  return (node && node['s-ol']) || node;
772
1066
  };
773
1067
  const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1068
+ /**
1069
+ * Handle reconciling an outdated VNode with a new one which corresponds to
1070
+ * it. This function handles flushing updates to the DOM and reconciling the
1071
+ * children of the two nodes (if any).
1072
+ *
1073
+ * @param oldVNode an old VNode whose DOM element and children we want to update
1074
+ * @param newVNode a new VNode representing an updated version of the old one
1075
+ */
774
1076
  const patch = (oldVNode, newVNode) => {
775
1077
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
776
1078
  const oldChildren = oldVNode.$children$;
@@ -784,7 +1086,6 @@ const patch = (oldVNode, newVNode) => {
784
1086
  // only add this to the when the compiler sees we're using an svg somewhere
785
1087
  isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
786
1088
  }
787
- // element node
788
1089
  {
789
1090
  if (tag === 'slot')
790
1091
  ;
@@ -797,6 +1098,7 @@ const patch = (oldVNode, newVNode) => {
797
1098
  }
798
1099
  if (oldChildren !== null && newChildren !== null) {
799
1100
  // looks like there's child vnodes for both the old and new vnodes
1101
+ // so we need to call `updateChildren` to reconcile them
800
1102
  updateChildren(elm, oldChildren, newVNode, newChildren);
801
1103
  }
802
1104
  else if (newChildren !== null) {
@@ -828,7 +1130,7 @@ const patch = (oldVNode, newVNode) => {
828
1130
  };
829
1131
  const updateFallbackSlotVisibility = (elm) => {
830
1132
  // tslint:disable-next-line: prefer-const
831
- let childNodes = elm.childNodes;
1133
+ const childNodes = elm.childNodes;
832
1134
  let childNode;
833
1135
  let i;
834
1136
  let ilen;
@@ -837,7 +1139,7 @@ const updateFallbackSlotVisibility = (elm) => {
837
1139
  let nodeType;
838
1140
  for (i = 0, ilen = childNodes.length; i < ilen; i++) {
839
1141
  childNode = childNodes[i];
840
- if (childNode.nodeType === 1 /* ElementNode */) {
1142
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
841
1143
  if (childNode['s-sr']) {
842
1144
  // this is a slot fallback node
843
1145
  // get the slot name for this slot reference node
@@ -849,7 +1151,7 @@ const updateFallbackSlotVisibility = (elm) => {
849
1151
  nodeType = childNodes[j].nodeType;
850
1152
  if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
851
1153
  // this sibling node is from a different component OR is a named fallback slot node
852
- if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1154
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
853
1155
  childNode.hidden = true;
854
1156
  break;
855
1157
  }
@@ -858,8 +1160,8 @@ const updateFallbackSlotVisibility = (elm) => {
858
1160
  // this is a default fallback slot node
859
1161
  // any element or text node (with content)
860
1162
  // should hide the default fallback slot node
861
- if (nodeType === 1 /* ElementNode */ ||
862
- (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
1163
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1164
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
863
1165
  childNode.hidden = true;
864
1166
  break;
865
1167
  }
@@ -881,8 +1183,8 @@ const relocateSlotContent = (elm) => {
881
1183
  let relocateNodeData;
882
1184
  let j;
883
1185
  let i = 0;
884
- let childNodes = elm.childNodes;
885
- let ilen = childNodes.length;
1186
+ const childNodes = elm.childNodes;
1187
+ const ilen = childNodes.length;
886
1188
  for (; i < ilen; i++) {
887
1189
  childNode = childNodes[i];
888
1190
  if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
@@ -937,13 +1239,13 @@ const relocateSlotContent = (elm) => {
937
1239
  }
938
1240
  }
939
1241
  }
940
- if (childNode.nodeType === 1 /* ElementNode */) {
1242
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
941
1243
  relocateSlotContent(childNode);
942
1244
  }
943
1245
  }
944
1246
  };
945
1247
  const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
946
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1248
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
947
1249
  if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
948
1250
  return true;
949
1251
  }
@@ -957,12 +1259,31 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
957
1259
  }
958
1260
  return slotNameAttr === '';
959
1261
  };
960
- const callNodeRefs = (vNode) => {
1262
+ /**
1263
+ * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
1264
+ * calling them with `null`. This signals that the DOM element corresponding to
1265
+ * the VDom node has been removed from the DOM.
1266
+ *
1267
+ * @param vNode a virtual DOM node
1268
+ */
1269
+ const nullifyVNodeRefs = (vNode) => {
961
1270
  {
962
1271
  vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
963
- vNode.$children$ && vNode.$children$.map(callNodeRefs);
1272
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
964
1273
  }
965
1274
  };
1275
+ /**
1276
+ * The main entry point for Stencil's virtual DOM-based rendering engine
1277
+ *
1278
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1279
+ * function will handle creating a virtual DOM tree with a single root, patching
1280
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
1281
+ * relocation, and reflecting attributes.
1282
+ *
1283
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
1284
+ * the DOM node into which it should be rendered.
1285
+ * @param renderFnResults the virtual DOM nodes to be rendered
1286
+ */
966
1287
  const renderVdom = (hostRef, renderFnResults) => {
967
1288
  const hostElm = hostRef.$hostElement$;
968
1289
  const cmpMeta = hostRef.$cmpMeta$;
@@ -974,7 +1295,7 @@ const renderVdom = (hostRef, renderFnResults) => {
974
1295
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
975
1296
  }
976
1297
  rootVnode.$tag$ = null;
977
- rootVnode.$flags$ |= 4 /* isHost */;
1298
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
978
1299
  hostRef.$vnode$ = rootVnode;
979
1300
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
980
1301
  {
@@ -982,7 +1303,7 @@ const renderVdom = (hostRef, renderFnResults) => {
982
1303
  }
983
1304
  {
984
1305
  contentRef = hostElm['s-cr'];
985
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1306
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
986
1307
  // always reset
987
1308
  checkSlotFallbackVisibility = false;
988
1309
  }
@@ -991,7 +1312,7 @@ const renderVdom = (hostRef, renderFnResults) => {
991
1312
  {
992
1313
  // while we're moving nodes around existing nodes, temporarily disable
993
1314
  // the disconnectCallback from working
994
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1315
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
995
1316
  if (checkSlotRelocate) {
996
1317
  relocateSlotContent(rootVnode.$elm$);
997
1318
  let relocateData;
@@ -1049,7 +1370,7 @@ const renderVdom = (hostRef, renderFnResults) => {
1049
1370
  }
1050
1371
  else {
1051
1372
  // this node doesn't have a slot home to go to, so let's hide it
1052
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1373
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1053
1374
  nodeToRelocate.hidden = true;
1054
1375
  }
1055
1376
  }
@@ -1060,37 +1381,11 @@ const renderVdom = (hostRef, renderFnResults) => {
1060
1381
  }
1061
1382
  // done moving nodes around
1062
1383
  // allow the disconnect callback to work again
1063
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1384
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1064
1385
  // always reset
1065
1386
  relocateNodes.length = 0;
1066
1387
  }
1067
1388
  };
1068
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
1069
- const createEvent = (ref, name, flags) => {
1070
- const elm = getElement(ref);
1071
- return {
1072
- emit: (detail) => {
1073
- return emitEvent(elm, name, {
1074
- bubbles: !!(flags & 4 /* Bubbles */),
1075
- composed: !!(flags & 2 /* Composed */),
1076
- cancelable: !!(flags & 1 /* Cancellable */),
1077
- detail,
1078
- });
1079
- },
1080
- };
1081
- };
1082
- /**
1083
- * Helper function to create & dispatch a custom Event on a provided target
1084
- * @param elm the target of the Event
1085
- * @param name the name to give the custom Event
1086
- * @param opts options for configuring a custom Event
1087
- * @returns the custom Event
1088
- */
1089
- const emitEvent = (elm, name, opts) => {
1090
- const ev = plt.ce(name, opts);
1091
- elm.dispatchEvent(ev);
1092
- return ev;
1093
- };
1094
1389
  const attachToAncestor = (hostRef, ancestorComponent) => {
1095
1390
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1096
1391
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -1098,10 +1393,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
1098
1393
  };
1099
1394
  const scheduleUpdate = (hostRef, isInitialLoad) => {
1100
1395
  {
1101
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1396
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1102
1397
  }
1103
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1104
- hostRef.$flags$ |= 512 /* needsRerender */;
1398
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1399
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1105
1400
  return;
1106
1401
  }
1107
1402
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -1111,35 +1406,83 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
1111
1406
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1112
1407
  return writeTask(dispatch) ;
1113
1408
  };
1409
+ /**
1410
+ * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
1411
+ * component lifecycle methods like `componentWillLoad` as well as
1412
+ * {@link updateComponent}, which will kick off the virtual DOM re-render.
1413
+ *
1414
+ * @param hostRef a reference to a host DOM node
1415
+ * @param isInitialLoad whether we're on the initial load or not
1416
+ * @returns an empty Promise which is used to enqueue a series of operations for
1417
+ * the component
1418
+ */
1114
1419
  const dispatchHooks = (hostRef, isInitialLoad) => {
1115
1420
  const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1116
1421
  const instance = hostRef.$lazyInstance$ ;
1117
- let promise;
1422
+ // We're going to use this variable together with `enqueue` to implement a
1423
+ // little promise-based queue. We start out with it `undefined`. When we add
1424
+ // the first function to the queue we'll set this variable to be that
1425
+ // function's return value. When we attempt to add subsequent values to the
1426
+ // queue we'll check that value and, if it was a `Promise`, we'll then chain
1427
+ // the new function off of that `Promise` using `.then()`. This will give our
1428
+ // queue two nice properties:
1429
+ //
1430
+ // 1. If all functions added to the queue are synchronous they'll be called
1431
+ // synchronously right away.
1432
+ // 2. If all functions added to the queue are asynchronous they'll all be
1433
+ // called in order after `dispatchHooks` exits.
1434
+ let maybePromise;
1118
1435
  if (isInitialLoad) {
1119
1436
  {
1120
- hostRef.$flags$ |= 256 /* isListenReady */;
1437
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1121
1438
  if (hostRef.$queuedListeners$) {
1122
1439
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1123
1440
  hostRef.$queuedListeners$ = null;
1124
1441
  }
1125
1442
  }
1126
1443
  {
1127
- promise = safeCall(instance, 'componentWillLoad');
1444
+ // If `componentWillLoad` returns a `Promise` then we want to wait on
1445
+ // whatever's going on in that `Promise` before we launch into
1446
+ // rendering the component, doing other lifecycle stuff, etc. So
1447
+ // in that case we assign the returned promise to the variable we
1448
+ // declared above to hold a possible 'queueing' Promise
1449
+ maybePromise = safeCall(instance, 'componentWillLoad');
1128
1450
  }
1129
1451
  }
1130
1452
  else {
1131
1453
  {
1132
- promise = safeCall(instance, 'componentWillUpdate');
1454
+ // Like `componentWillLoad` above, we allow Stencil component
1455
+ // authors to return a `Promise` from this lifecycle callback, and
1456
+ // we specify that our runtime will wait for that `Promise` to
1457
+ // resolve before the component re-renders. So if the method
1458
+ // returns a `Promise` we need to keep it around!
1459
+ maybePromise = safeCall(instance, 'componentWillUpdate');
1133
1460
  }
1134
1461
  }
1135
1462
  {
1136
- promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1463
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, 'componentWillRender'));
1137
1464
  }
1138
1465
  endSchedule();
1139
- return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1466
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1140
1467
  };
1468
+ /**
1469
+ * This function uses a Promise to implement a simple first-in, first-out queue
1470
+ * of functions to be called.
1471
+ *
1472
+ * The queue is ordered on the basis of the first argument. If it's
1473
+ * `undefined`, then nothing is on the queue yet, so the provided function can
1474
+ * be called synchronously (although note that this function may return a
1475
+ * `Promise`). The idea is that then the return value of that enqueueing
1476
+ * operation is kept around, so that if it was a `Promise` then subsequent
1477
+ * functions can be enqueued by calling this function again with that `Promise`
1478
+ * as the first argument.
1479
+ *
1480
+ * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
1481
+ * @param fn a function to enqueue
1482
+ * @returns either a `Promise` or the return value of the provided function
1483
+ */
1484
+ const enqueue = (maybePromise, fn) => maybePromise instanceof Promise ? maybePromise.then(fn) : fn();
1141
1485
  const updateComponent = async (hostRef, instance, isInitialLoad) => {
1142
- // updateComponent
1143
1486
  const elm = hostRef.$hostElement$;
1144
1487
  const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1145
1488
  const rc = elm['s-rc'];
@@ -1168,7 +1511,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1168
1511
  }
1169
1512
  else {
1170
1513
  Promise.all(childrenPromises).then(postUpdate);
1171
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1514
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1172
1515
  childrenPromises.length = 0;
1173
1516
  }
1174
1517
  }
@@ -1177,10 +1520,10 @@ const callRender = (hostRef, instance, elm) => {
1177
1520
  try {
1178
1521
  instance = instance.render() ;
1179
1522
  {
1180
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1523
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1181
1524
  }
1182
1525
  {
1183
- hostRef.$flags$ |= 2 /* hasRendered */;
1526
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1184
1527
  }
1185
1528
  {
1186
1529
  {
@@ -1207,8 +1550,8 @@ const postUpdateComponent = (hostRef) => {
1207
1550
  {
1208
1551
  safeCall(instance, 'componentDidRender');
1209
1552
  }
1210
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1211
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1553
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1554
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1212
1555
  {
1213
1556
  // DOM WRITE!
1214
1557
  addHydratedFlag(elm);
@@ -1234,10 +1577,10 @@ const postUpdateComponent = (hostRef) => {
1234
1577
  hostRef.$onRenderResolve$();
1235
1578
  hostRef.$onRenderResolve$ = undefined;
1236
1579
  }
1237
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1580
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1238
1581
  nextTick(() => scheduleUpdate(hostRef, false));
1239
1582
  }
1240
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1583
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1241
1584
  }
1242
1585
  // ( •_•)
1243
1586
  // ( •_•)>⌐■-■
@@ -1250,7 +1593,7 @@ const appDidLoad = (who) => {
1250
1593
  addHydratedFlag(doc.documentElement);
1251
1594
  }
1252
1595
  {
1253
- plt.$flags$ |= 2 /* appLoaded */;
1596
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
1254
1597
  }
1255
1598
  nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1256
1599
  };
@@ -1265,35 +1608,8 @@ const safeCall = (instance, method, arg) => {
1265
1608
  }
1266
1609
  return undefined;
1267
1610
  };
1268
- const then = (promise, thenFn) => {
1269
- return promise && promise.then ? promise.then(thenFn) : thenFn();
1270
- };
1271
1611
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1272
1612
  ;
1273
- const parsePropertyValue = (propValue, propType) => {
1274
- // ensure this value is of the correct prop type
1275
- if (propValue != null && !isComplexType(propValue)) {
1276
- if (propType & 4 /* Boolean */) {
1277
- // per the HTML spec, any string value means it is a boolean true value
1278
- // but we'll cheat here and say that the string "false" is the boolean false
1279
- return propValue === 'false' ? false : propValue === '' || !!propValue;
1280
- }
1281
- if (propType & 2 /* Number */) {
1282
- // force it to be a number
1283
- return parseFloat(propValue);
1284
- }
1285
- if (propType & 1 /* String */) {
1286
- // could have been passed as a number or boolean
1287
- // but we still want it as a string
1288
- return String(propValue);
1289
- }
1290
- // redundant return here for better minification
1291
- return propValue;
1292
- }
1293
- // not sure exactly what type we want
1294
- // so no need to change to a different type
1295
- return propValue;
1296
- };
1297
1613
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1298
1614
  const setValue = (ref, propName, newVal, cmpMeta) => {
1299
1615
  // check our new property value against our internal value
@@ -1303,13 +1619,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1303
1619
  const flags = hostRef.$flags$;
1304
1620
  const instance = hostRef.$lazyInstance$ ;
1305
1621
  newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1306
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
1622
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1623
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1624
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1625
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1307
1626
  // gadzooks! the property's value has changed!!
1308
1627
  // set our new value!
1309
1628
  hostRef.$instanceValues$.set(propName, newVal);
1310
1629
  if (instance) {
1311
1630
  // get an array of method names of watch functions to call
1312
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1631
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1313
1632
  const watchMethods = cmpMeta.$watchers$[propName];
1314
1633
  if (watchMethods) {
1315
1634
  // this instance is watching for when this property changed
@@ -1324,7 +1643,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1324
1643
  });
1325
1644
  }
1326
1645
  }
1327
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1646
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1328
1647
  // looks like this value actually changed, so we've got work to do!
1329
1648
  // but only if we've already rendered, otherwise just chill out
1330
1649
  // queue that we need to do an update, but don't worry about queuing
@@ -1334,6 +1653,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1334
1653
  }
1335
1654
  }
1336
1655
  };
1656
+ /**
1657
+ * Attach a series of runtime constructs to a compiled Stencil component
1658
+ * constructor, including getters and setters for the `@Prop` and `@State`
1659
+ * decorators, callbacks for when attributes change, and so on.
1660
+ *
1661
+ * @param Cstr the constructor for a component that we need to process
1662
+ * @param cmpMeta metadata collected previously about the component
1663
+ * @param flags a number used to store a series of bit flags
1664
+ * @returns a reference to the same constructor passed in (but now mutated)
1665
+ */
1337
1666
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1338
1667
  if (cmpMeta.$members$) {
1339
1668
  if (Cstr.watchers) {
@@ -1343,8 +1672,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1343
1672
  const members = Object.entries(cmpMeta.$members$);
1344
1673
  const prototype = Cstr.prototype;
1345
1674
  members.map(([memberName, [memberFlags]]) => {
1346
- if ((memberFlags & 31 /* Prop */ ||
1347
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1675
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1676
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1348
1677
  // proxyComponent - prop
1349
1678
  Object.defineProperty(prototype, memberName, {
1350
1679
  get() {
@@ -1360,7 +1689,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1360
1689
  });
1361
1690
  }
1362
1691
  });
1363
- if ((flags & 1 /* isElementConstructor */)) {
1692
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1364
1693
  const attrNameToPropName = new Map();
1365
1694
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1366
1695
  plt.jmp(() => {
@@ -1416,11 +1745,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1416
1745
  // create an array of attributes to observe
1417
1746
  // and also create a map of html attribute name to js property name
1418
1747
  Cstr.observedAttributes = members
1419
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1748
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1420
1749
  .map(([propName, m]) => {
1421
1750
  const attrName = m[1] || propName;
1422
1751
  attrNameToPropName.set(attrName, propName);
1423
- if (m[0] & 512 /* ReflectAttr */) {
1752
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1424
1753
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1425
1754
  }
1426
1755
  return attrName;
@@ -1431,10 +1760,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1431
1760
  };
1432
1761
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1433
1762
  // initializeComponent
1434
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1763
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1764
+ // Let the runtime know that the component has been initialized
1765
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1435
1766
  {
1436
- // we haven't initialized this element yet
1437
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1438
1767
  // lazy loaded components
1439
1768
  // request the component's implementation to be
1440
1769
  // wired up with the host element
@@ -1452,7 +1781,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1452
1781
  {
1453
1782
  cmpMeta.$watchers$ = Cstr.watchers;
1454
1783
  }
1455
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1784
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1456
1785
  Cstr.isProxied = true;
1457
1786
  }
1458
1787
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -1460,7 +1789,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1460
1789
  // but let's keep track of when we start and stop
1461
1790
  // so that the getters/setters don't incorrectly step on data
1462
1791
  {
1463
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1792
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1464
1793
  }
1465
1794
  // construct the lazy-loaded component implementation
1466
1795
  // passing the hostRef is very important during
@@ -1473,10 +1802,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1473
1802
  consoleError(e);
1474
1803
  }
1475
1804
  {
1476
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1805
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1477
1806
  }
1478
1807
  {
1479
- hostRef.$flags$ |= 128 /* isWatchReady */;
1808
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1480
1809
  }
1481
1810
  endNewInstance();
1482
1811
  }
@@ -1489,7 +1818,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1489
1818
  const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
1490
1819
  if (!styles.has(scopeId)) {
1491
1820
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1492
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1821
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1493
1822
  endRegisterStyles();
1494
1823
  }
1495
1824
  }
@@ -1511,19 +1840,20 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1511
1840
  }
1512
1841
  };
1513
1842
  const connectedCallback = (elm) => {
1514
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1843
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1515
1844
  const hostRef = getHostRef(elm);
1516
1845
  const cmpMeta = hostRef.$cmpMeta$;
1517
1846
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1518
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1847
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1519
1848
  // first time this component has connected
1520
- hostRef.$flags$ |= 1 /* hasConnected */;
1849
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1521
1850
  {
1522
1851
  // initUpdate
1523
1852
  // if the slot polyfill is required we'll need to put some nodes
1524
1853
  // in here to act as original content anchors as we move nodes around
1525
1854
  // host element has been connected to the DOM
1526
- if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1855
+ if ((// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
1856
+ cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1527
1857
  setContentReference(elm);
1528
1858
  }
1529
1859
  }
@@ -1546,7 +1876,7 @@ const connectedCallback = (elm) => {
1546
1876
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1547
1877
  if (cmpMeta.$members$) {
1548
1878
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1549
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1879
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1550
1880
  const value = elm[memberName];
1551
1881
  delete elm[memberName];
1552
1882
  elm[memberName] = value;
@@ -1578,7 +1908,7 @@ const setContentReference = (elm) => {
1578
1908
  elm.insertBefore(contentRefElm, elm.firstChild);
1579
1909
  };
1580
1910
  const disconnectedCallback = (elm) => {
1581
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1911
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1582
1912
  const hostRef = getHostRef(elm);
1583
1913
  const instance = hostRef.$lazyInstance$ ;
1584
1914
  {
@@ -1593,6 +1923,7 @@ const disconnectedCallback = (elm) => {
1593
1923
  }
1594
1924
  };
1595
1925
  const bootstrapLazy = (lazyBundles, options = {}) => {
1926
+ var _a;
1596
1927
  const endBootstrap = createTime();
1597
1928
  const cmpTags = [];
1598
1929
  const exclude = options.exclude || [];
@@ -1607,7 +1938,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1607
1938
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1608
1939
  {
1609
1940
  if (options.syncQueue) {
1610
- plt.$flags$ |= 4 /* queueSync */;
1941
+ plt.$flags$ |= 4 /* PLATFORM_FLAGS.queueSync */;
1611
1942
  }
1612
1943
  }
1613
1944
  lazyBundles.map((lazyBundle) => {
@@ -1638,7 +1969,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1638
1969
  super(self);
1639
1970
  self = this;
1640
1971
  registerHost(self, cmpMeta);
1641
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1972
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1642
1973
  // this component is using shadow dom
1643
1974
  // and this browser supports shadow dom
1644
1975
  // add the read-only property "shadowRoot" to the host element
@@ -1673,13 +2004,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1673
2004
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1674
2005
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1675
2006
  cmpTags.push(tagName);
1676
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
2007
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1677
2008
  }
1678
2009
  });
1679
2010
  });
1680
2011
  {
1681
2012
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1682
2013
  visibilityStyle.setAttribute('data-styles', '');
2014
+ // Apply CSP nonce to the style tag if it exists
2015
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
2016
+ if (nonce != null) {
2017
+ visibilityStyle.setAttribute('nonce', nonce);
2018
+ }
1683
2019
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1684
2020
  }
1685
2021
  // Process deferred connectedCallbacks now all components have been registered
@@ -1696,7 +2032,50 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1696
2032
  endBootstrap();
1697
2033
  };
1698
2034
  const Fragment = (_, children) => children;
1699
- const hostRefs = new WeakMap();
2035
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
2036
+ if (listeners) {
2037
+ listeners.map(([flags, name, method]) => {
2038
+ const target = getHostListenerTarget(elm, flags) ;
2039
+ const handler = hostListenerProxy(hostRef, method);
2040
+ const opts = hostListenerOpts(flags);
2041
+ plt.ael(target, name, handler, opts);
2042
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
2043
+ });
2044
+ }
2045
+ };
2046
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
2047
+ try {
2048
+ {
2049
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
2050
+ // instance is ready, let's call it's member method for this event
2051
+ hostRef.$lazyInstance$[methodName](ev);
2052
+ }
2053
+ else {
2054
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
2055
+ }
2056
+ }
2057
+ }
2058
+ catch (e) {
2059
+ consoleError(e);
2060
+ }
2061
+ };
2062
+ const getHostListenerTarget = (elm, flags) => {
2063
+ if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
2064
+ return doc;
2065
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
2066
+ return win;
2067
+ return elm;
2068
+ };
2069
+ // prettier-ignore
2070
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
2071
+ /**
2072
+ * Assigns the given value to the nonce property on the runtime platform object.
2073
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
2074
+ * @param nonce The value to be assigned to the platform nonce property.
2075
+ * @returns void
2076
+ */
2077
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
2078
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1700
2079
  const getHostRef = (ref) => hostRefs.get(ref);
1701
2080
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1702
2081
  const registerHost = (elm, cmpMeta) => {
@@ -1725,7 +2104,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1725
2104
  if (module) {
1726
2105
  return module[exportName];
1727
2106
  }
2107
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1728
2108
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
2109
+ /* @vite-ignore */
1729
2110
  /* webpackInclude: /\.entry\.js$/ */
1730
2111
  /* webpackExclude: /\.system\.entry\.js$/ */
1731
2112
  /* webpackMode: "lazy" */
@@ -1736,8 +2117,29 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1736
2117
  return importedModule[exportName];
1737
2118
  }, consoleError);
1738
2119
  };
1739
- const styles = new Map();
2120
+ const styles = /*@__PURE__*/ new Map();
1740
2121
  const modeResolutionChain = [];
2122
+ const win = typeof window !== 'undefined' ? window : {};
2123
+ const doc = win.document || { head: {} };
2124
+ const plt = {
2125
+ $flags$: 0,
2126
+ $resourcesUrl$: '',
2127
+ jmp: (h) => h(),
2128
+ raf: (h) => requestAnimationFrame(h),
2129
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
2130
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2131
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
2132
+ };
2133
+ const promiseResolve = (v) => Promise.resolve(v);
2134
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2135
+ try {
2136
+ new CSSStyleSheet();
2137
+ return typeof new CSSStyleSheet().replaceSync === 'function';
2138
+ }
2139
+ catch (e) { }
2140
+ return false;
2141
+ })()
2142
+ ;
1741
2143
  const queueDomReads = [];
1742
2144
  const queueDomWrites = [];
1743
2145
  const queueDomWritesLow = [];
@@ -1745,7 +2147,7 @@ const queueTask = (queue, write) => (cb) => {
1745
2147
  queue.push(cb);
1746
2148
  if (!queuePending) {
1747
2149
  queuePending = true;
1748
- if (write && plt.$flags$ & 4 /* queueSync */) {
2150
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1749
2151
  nextTick(flush);
1750
2152
  }
1751
2153
  else {
@@ -1792,7 +2194,7 @@ const flush = () => {
1792
2194
  consume(queueDomReads);
1793
2195
  // DOM WRITES!!!
1794
2196
  {
1795
- const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
2197
+ const timeout = (plt.$flags$ & 6 /* PLATFORM_FLAGS.queueMask */) === 2 /* PLATFORM_FLAGS.appLoaded */
1796
2198
  ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0))
1797
2199
  : Infinity;
1798
2200
  consumeTimeout(queueDomWrites, timeout);
@@ -1823,3 +2225,6 @@ exports.h = h;
1823
2225
  exports.promiseResolve = promiseResolve;
1824
2226
  exports.registerInstance = registerInstance;
1825
2227
  exports.setMode = setMode;
2228
+ exports.setNonce = setNonce;
2229
+
2230
+ //# sourceMappingURL=index-25bd964b.js.map