@rededor/cura 0.5.0-alpha.0 → 0.5.1

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 (437) hide show
  1. package/dist/assets/icons/iconset-default-list.ts +1 -0
  2. package/dist/assets/icons/iconset-default-tmp.svg +976 -0
  3. package/dist/assets/icons/iconset-default.svg +1 -0
  4. package/dist/cjs/app-globals-0e3b7fc6.js +511 -0
  5. package/dist/cjs/app-globals-0e3b7fc6.js.map +1 -0
  6. package/dist/cjs/css-shim-83cf0349.js +8 -0
  7. package/dist/cjs/css-shim-83cf0349.js.map +1 -0
  8. package/dist/cjs/cura-accordion_12.cjs.entry.js +674 -0
  9. package/dist/cjs/cura-accordion_12.cjs.entry.js.map +1 -0
  10. package/dist/cjs/cura.cjs.js +36 -0
  11. package/dist/cjs/cura.cjs.js.map +1 -0
  12. package/dist/cjs/index-404d93e9.js +2247 -0
  13. package/dist/cjs/index-404d93e9.js.map +1 -0
  14. package/dist/cjs/index.cjs.js +4 -0
  15. package/dist/cjs/index.cjs.js.map +1 -0
  16. package/dist/cjs/loader.cjs.js +42 -0
  17. package/dist/cjs/loader.cjs.js.map +1 -0
  18. package/dist/cjs/shadow-css-8baae635.js +391 -0
  19. package/dist/cjs/shadow-css-8baae635.js.map +1 -0
  20. package/dist/collection/api/cura-api.js +34 -0
  21. package/dist/collection/api/cura-api.js.map +1 -0
  22. package/dist/collection/api/cura-api.type.js +7 -0
  23. package/dist/collection/api/cura-api.type.js.map +1 -0
  24. package/dist/collection/api/modules/cura-theme-breakpoints-module.js +14 -0
  25. package/dist/collection/api/modules/cura-theme-breakpoints-module.js.map +1 -0
  26. package/dist/collection/api/modules/cura-theme-colors-module.js +76 -0
  27. package/dist/collection/api/modules/cura-theme-colors-module.js.map +1 -0
  28. package/dist/collection/api/modules/cura-theme-fonts-module.js +36 -0
  29. package/dist/collection/api/modules/cura-theme-fonts-module.js.map +1 -0
  30. package/dist/collection/api/modules/cura-theme-module.js +78 -0
  31. package/dist/collection/api/modules/cura-theme-module.js.map +1 -0
  32. package/dist/collection/api/modules/cura-theme-spacing-module.js +13 -0
  33. package/dist/collection/api/modules/cura-theme-spacing-module.js.map +1 -0
  34. package/dist/collection/api/theme-presets/static.js +71 -0
  35. package/dist/collection/api/theme-presets/static.js.map +1 -0
  36. package/dist/collection/api/theme-presets/theme-default.js +50 -0
  37. package/dist/collection/api/theme-presets/theme-default.js.map +1 -0
  38. package/dist/collection/api/theme-presets/theme-legacy-default.js +32 -0
  39. package/dist/collection/api/theme-presets/theme-legacy-default.js.map +1 -0
  40. package/dist/collection/api/theme-presets/theme-maternity.js +46 -0
  41. package/dist/collection/api/theme-presets/theme-maternity.js.map +1 -0
  42. package/dist/collection/api/theme-presets/theme-oncology.js +53 -0
  43. package/dist/collection/api/theme-presets/theme-oncology.js.map +1 -0
  44. package/dist/collection/api/theme-presets/theme-presets.js +11 -0
  45. package/dist/collection/api/theme-presets/theme-presets.js.map +1 -0
  46. package/dist/collection/assets/icons/iconset-default-list.js +2 -0
  47. package/dist/collection/assets/icons/iconset-default-list.js.map +1 -0
  48. package/dist/collection/assets/icons/iconset-default-tmp.svg +976 -0
  49. package/dist/collection/assets/icons/iconset-default.svg +1 -0
  50. package/dist/collection/assets-raw/icons/default/360.svg +8 -0
  51. package/dist/collection/assets-raw/icons/default/accessibility.svg +5 -0
  52. package/dist/collection/assets-raw/icons/default/addUser.svg +6 -0
  53. package/dist/collection/assets-raw/icons/default/airdrop.svg +6 -0
  54. package/dist/collection/assets-raw/icons/default/alertCircle.svg +5 -0
  55. package/dist/collection/assets-raw/icons/default/alertTriangle.svg +5 -0
  56. package/dist/collection/assets-raw/icons/default/arrowDown.svg +3 -0
  57. package/dist/collection/assets-raw/icons/default/arrowDownCircle.svg +4 -0
  58. package/dist/collection/assets-raw/icons/default/arrowLeft.svg +3 -0
  59. package/dist/collection/assets-raw/icons/default/arrowLeftCircle.svg +4 -0
  60. package/dist/collection/assets-raw/icons/default/arrowRight.svg +3 -0
  61. package/dist/collection/assets-raw/icons/default/arrowRightCircle.svg +4 -0
  62. package/dist/collection/assets-raw/icons/default/arrowUp.svg +3 -0
  63. package/dist/collection/assets-raw/icons/default/arrowUpCircle.svg +4 -0
  64. package/dist/collection/assets-raw/icons/default/attach.svg +3 -0
  65. package/dist/collection/assets-raw/icons/default/avatarF.svg +6 -0
  66. package/dist/collection/assets-raw/icons/default/avatarM.svg +5 -0
  67. package/dist/collection/assets-raw/icons/default/biometry.svg +3 -0
  68. package/dist/collection/assets-raw/icons/default/bloodGroup.svg +3 -0
  69. package/dist/collection/assets-raw/icons/default/calendar.svg +8 -0
  70. package/dist/collection/assets-raw/icons/default/cam.svg +4 -0
  71. package/dist/collection/assets-raw/icons/default/camOff.svg +5 -0
  72. package/dist/collection/assets-raw/icons/default/central.svg +7 -0
  73. package/dist/collection/assets-raw/icons/default/chatCircle.svg +6 -0
  74. package/dist/collection/assets-raw/icons/default/check.svg +3 -0
  75. package/dist/collection/assets-raw/icons/default/checkBadge.svg +4 -0
  76. package/dist/collection/assets-raw/icons/default/checkCircle.svg +4 -0
  77. package/dist/collection/assets-raw/icons/default/checkDouble.svg +4 -0
  78. package/dist/collection/assets-raw/icons/default/clock.svg +5 -0
  79. package/dist/collection/assets-raw/icons/default/close.svg +3 -0
  80. package/dist/collection/assets-raw/icons/default/closeCircle.svg +5 -0
  81. package/dist/collection/assets-raw/icons/default/collapse.svg +4 -0
  82. package/dist/collection/assets-raw/icons/default/config.svg +4 -0
  83. package/dist/collection/assets-raw/icons/default/currency.svg +3 -0
  84. package/dist/collection/assets-raw/icons/default/delete.svg +7 -0
  85. package/dist/collection/assets-raw/icons/default/desktop.svg +6 -0
  86. package/dist/collection/assets-raw/icons/default/doc.svg +7 -0
  87. package/dist/collection/assets-raw/icons/default/down.svg +3 -0
  88. package/dist/collection/assets-raw/icons/default/download.svg +3 -0
  89. package/dist/collection/assets-raw/icons/default/duplicate.svg +4 -0
  90. package/dist/collection/assets-raw/icons/default/edit.svg +5 -0
  91. package/dist/collection/assets-raw/icons/default/exam.svg +6 -0
  92. package/dist/collection/assets-raw/icons/default/examDoc.svg +8 -0
  93. package/dist/collection/assets-raw/icons/default/expand.svg +4 -0
  94. package/dist/collection/assets-raw/icons/default/facebook.svg +3 -0
  95. package/dist/collection/assets-raw/icons/default/fileBmp.svg +17 -0
  96. package/dist/collection/assets-raw/icons/default/fileJpg.svg +8 -0
  97. package/dist/collection/assets-raw/icons/default/filePdf.svg +10 -0
  98. package/dist/collection/assets-raw/icons/default/filePng.svg +10 -0
  99. package/dist/collection/assets-raw/icons/default/fileUpload.svg +5 -0
  100. package/dist/collection/assets-raw/icons/default/fileXls.svg +8 -0
  101. package/dist/collection/assets-raw/icons/default/filter.svg +11 -0
  102. package/dist/collection/assets-raw/icons/default/fullscreen.svg +6 -0
  103. package/dist/collection/assets-raw/icons/default/gallery.svg +6 -0
  104. package/dist/collection/assets-raw/icons/default/geotag.svg +4 -0
  105. package/dist/collection/assets-raw/icons/default/geotagUnity.svg +5 -0
  106. package/dist/collection/assets-raw/icons/default/geotagUnityGroup.svg +3 -0
  107. package/dist/collection/assets-raw/icons/default/google.svg +3 -0
  108. package/dist/collection/assets-raw/icons/default/graph.svg +6 -0
  109. package/dist/collection/assets-raw/icons/default/healthPlan.svg +6 -0
  110. package/dist/collection/assets-raw/icons/default/heart.svg +3 -0
  111. package/dist/collection/assets-raw/icons/default/height.svg +10 -0
  112. package/dist/collection/assets-raw/icons/default/height2.svg +8 -0
  113. package/dist/collection/assets-raw/icons/default/home.svg +6 -0
  114. package/dist/collection/assets-raw/icons/default/horizontalList.svg +4 -0
  115. package/dist/collection/assets-raw/icons/default/imageUp.svg +5 -0
  116. package/dist/collection/assets-raw/icons/default/infoCircle.svg +5 -0
  117. package/dist/collection/assets-raw/icons/default/instagram.svg +5 -0
  118. package/dist/collection/assets-raw/icons/default/key.svg +4 -0
  119. package/dist/collection/assets-raw/icons/default/lamp.svg +12 -0
  120. package/dist/collection/assets-raw/icons/default/language.svg +9 -0
  121. package/dist/collection/assets-raw/icons/default/language2.svg +4 -0
  122. package/dist/collection/assets-raw/icons/default/languageEN.svg +5 -0
  123. package/dist/collection/assets-raw/icons/default/languagePT.svg +5 -0
  124. package/dist/collection/assets-raw/icons/default/lattes.svg +3 -0
  125. package/dist/collection/assets-raw/icons/default/left.svg +3 -0
  126. package/dist/collection/assets-raw/icons/default/like.svg +4 -0
  127. package/dist/collection/assets-raw/icons/default/link.svg +4 -0
  128. package/dist/collection/assets-raw/icons/default/linkExternal.svg +4 -0
  129. package/dist/collection/assets-raw/icons/default/linkedin.svg +5 -0
  130. package/dist/collection/assets-raw/icons/default/list.svg +8 -0
  131. package/dist/collection/assets-raw/icons/default/login.svg +4 -0
  132. package/dist/collection/assets-raw/icons/default/logout.svg +3 -0
  133. package/dist/collection/assets-raw/icons/default/mail.svg +6 -0
  134. package/dist/collection/assets-raw/icons/default/maintenance.svg +4 -0
  135. package/dist/collection/assets-raw/icons/default/medDoc.svg +5 -0
  136. package/dist/collection/assets-raw/icons/default/medEspec.svg +4 -0
  137. package/dist/collection/assets-raw/icons/default/medImg.svg +5 -0
  138. package/dist/collection/assets-raw/icons/default/medUser.svg +10 -0
  139. package/dist/collection/assets-raw/icons/default/medical.svg +9 -0
  140. package/dist/collection/assets-raw/icons/default/menuHamburguer.svg +5 -0
  141. package/dist/collection/assets-raw/icons/default/menuKebab.svg +5 -0
  142. package/dist/collection/assets-raw/icons/default/menuMeatballs.svg +5 -0
  143. package/dist/collection/assets-raw/icons/default/mic.svg +5 -0
  144. package/dist/collection/assets-raw/icons/default/micOff.svg +6 -0
  145. package/dist/collection/assets-raw/icons/default/minus.svg +3 -0
  146. package/dist/collection/assets-raw/icons/default/minusCircle.svg +4 -0
  147. package/dist/collection/assets-raw/icons/default/minusSquare.svg +4 -0
  148. package/dist/collection/assets-raw/icons/default/mobile.svg +4 -0
  149. package/dist/collection/assets-raw/icons/default/news.svg +8 -0
  150. package/dist/collection/assets-raw/icons/default/notification.svg +6 -0
  151. package/dist/collection/assets-raw/icons/default/npsDeslike.svg +6 -0
  152. package/dist/collection/assets-raw/icons/default/npsHate.svg +6 -0
  153. package/dist/collection/assets-raw/icons/default/npsLike.svg +6 -0
  154. package/dist/collection/assets-raw/icons/default/npsLove.svg +6 -0
  155. package/dist/collection/assets-raw/icons/default/npsNeutral.svg +6 -0
  156. package/dist/collection/assets-raw/icons/default/order.svg +6 -0
  157. package/dist/collection/assets-raw/icons/default/partner.svg +5 -0
  158. package/dist/collection/assets-raw/icons/default/phone.svg +5 -0
  159. package/dist/collection/assets-raw/icons/default/play.svg +4 -0
  160. package/dist/collection/assets-raw/icons/default/plus.svg +4 -0
  161. package/dist/collection/assets-raw/icons/default/plusCircle.svg +5 -0
  162. package/dist/collection/assets-raw/icons/default/plusSquare.svg +5 -0
  163. package/dist/collection/assets-raw/icons/default/print.svg +7 -0
  164. package/dist/collection/assets-raw/icons/default/profile.svg +4 -0
  165. package/dist/collection/assets-raw/icons/default/profileCircle.svg +4 -0
  166. package/dist/collection/assets-raw/icons/default/questionCircle.svg +4 -0
  167. package/dist/collection/assets-raw/icons/default/questionSquare.svg +4 -0
  168. package/dist/collection/assets-raw/icons/default/range.svg +5 -0
  169. package/dist/collection/assets-raw/icons/default/reload.svg +4 -0
  170. package/dist/collection/assets-raw/icons/default/ribbon.svg +4 -0
  171. package/dist/collection/assets-raw/icons/default/right.svg +3 -0
  172. package/dist/collection/assets-raw/icons/default/schedule.svg +9 -0
  173. package/dist/collection/assets-raw/icons/default/scheduleCheck.svg +8 -0
  174. package/dist/collection/assets-raw/icons/default/scheduleHistorico.svg +9 -0
  175. package/dist/collection/assets-raw/icons/default/search.svg +4 -0
  176. package/dist/collection/assets-raw/icons/default/secure.svg +6 -0
  177. package/dist/collection/assets-raw/icons/default/share.svg +7 -0
  178. package/dist/collection/assets-raw/icons/default/siren.svg +12 -0
  179. package/dist/collection/assets-raw/icons/default/sound.svg +5 -0
  180. package/dist/collection/assets-raw/icons/default/soundOff.svg +4 -0
  181. package/dist/collection/assets-raw/icons/default/subItem.svg +4 -0
  182. package/dist/collection/assets-raw/icons/default/target.svg +8 -0
  183. package/dist/collection/assets-raw/icons/default/team.svg +6 -0
  184. package/dist/collection/assets-raw/icons/default/telegram.svg +3 -0
  185. package/dist/collection/assets-raw/icons/default/twitter.svg +5 -0
  186. package/dist/collection/assets-raw/icons/default/unLink.svg +10 -0
  187. package/dist/collection/assets-raw/icons/default/unSecure.svg +6 -0
  188. package/dist/collection/assets-raw/icons/default/unity.svg +13 -0
  189. package/dist/collection/assets-raw/icons/default/unlike.svg +4 -0
  190. package/dist/collection/assets-raw/icons/default/up.svg +3 -0
  191. package/dist/collection/assets-raw/icons/default/upload.svg +3 -0
  192. package/dist/collection/assets-raw/icons/default/verticalList.svg +4 -0
  193. package/dist/collection/assets-raw/icons/default/viewFalse.svg +5 -0
  194. package/dist/collection/assets-raw/icons/default/viewTrue.svg +4 -0
  195. package/dist/collection/assets-raw/icons/default/weight.svg +5 -0
  196. package/dist/collection/assets-raw/icons/default/whatsapp.svg +4 -0
  197. package/dist/collection/assets-raw/icons/default/wifi.svg +6 -0
  198. package/dist/collection/assets-raw/icons/default/wifiOff.svg +7 -0
  199. package/dist/collection/assets-raw/icons/default/youtube.svg +4 -0
  200. package/dist/collection/assets-raw/icons/default/zoomIn.svg +6 -0
  201. package/dist/collection/assets-raw/icons/default/zoomOut.svg +5 -0
  202. package/dist/collection/collection-manifest.json +24 -0
  203. package/dist/collection/components/accordion/cura-accordion/cura-accordion.css +14 -0
  204. package/dist/collection/components/accordion/cura-accordion/cura-accordion.js +271 -0
  205. package/dist/collection/components/accordion/cura-accordion/cura-accordion.js.map +1 -0
  206. package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js +160 -0
  207. package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js.map +1 -0
  208. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.css +142 -0
  209. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js +199 -0
  210. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js.map +1 -0
  211. package/dist/collection/components/buttons/cura-button/cura-button.css +185 -0
  212. package/dist/collection/components/buttons/cura-button/cura-button.js +309 -0
  213. package/dist/collection/components/buttons/cura-button/cura-button.js.map +1 -0
  214. package/dist/collection/components/buttons/cura-button/cura-button.stories.js +168 -0
  215. package/dist/collection/components/buttons/cura-button/cura-button.stories.js.map +1 -0
  216. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.css +220 -0
  217. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +309 -0
  218. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js.map +1 -0
  219. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js +168 -0
  220. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js.map +1 -0
  221. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.css +204 -0
  222. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +309 -0
  223. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js.map +1 -0
  224. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js +168 -0
  225. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js.map +1 -0
  226. package/dist/collection/components/cura-icon/cura-icon.css +12 -0
  227. package/dist/collection/components/cura-icon/cura-icon.js +162 -0
  228. package/dist/collection/components/cura-icon/cura-icon.js.map +1 -0
  229. package/dist/collection/components/cura-icon/cura-icon.stories.js +75 -0
  230. package/dist/collection/components/cura-icon/cura-icon.stories.js.map +1 -0
  231. package/dist/collection/components/cura-icons-view/cura-icons-view.css +68 -0
  232. package/dist/collection/components/cura-icons-view/cura-icons-view.js +33 -0
  233. package/dist/collection/components/cura-icons-view/cura-icons-view.js.map +1 -0
  234. package/dist/collection/components/cura-icons-view/cura-icons-view.stories.js +11 -0
  235. package/dist/collection/components/cura-icons-view/cura-icons-view.stories.js.map +1 -0
  236. package/dist/collection/components/cura-page-template/cura-page-template.css +105 -0
  237. package/dist/collection/components/cura-page-template/cura-page-template.js +55 -0
  238. package/dist/collection/components/cura-page-template/cura-page-template.js.map +1 -0
  239. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.css +33 -0
  240. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +77 -0
  241. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js.map +1 -0
  242. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.stories.js +56 -0
  243. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.stories.js.map +1 -0
  244. package/dist/collection/components/text/cura-display/cura-display.css +84 -0
  245. package/dist/collection/components/text/cura-display/cura-display.js +146 -0
  246. package/dist/collection/components/text/cura-display/cura-display.js.map +1 -0
  247. package/dist/collection/components/text/cura-display/cura-display.stories.js +80 -0
  248. package/dist/collection/components/text/cura-display/cura-display.stories.js.map +1 -0
  249. package/dist/collection/components/text/cura-heading/cura-heading.css +92 -0
  250. package/dist/collection/components/text/cura-heading/cura-heading.js +168 -0
  251. package/dist/collection/components/text/cura-heading/cura-heading.js.map +1 -0
  252. package/dist/collection/components/text/cura-heading/cura-heading.stories.js +91 -0
  253. package/dist/collection/components/text/cura-heading/cura-heading.stories.js.map +1 -0
  254. package/dist/collection/components/text/cura-paragraph/cura-paragraph.css +115 -0
  255. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +150 -0
  256. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js.map +1 -0
  257. package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js +94 -0
  258. package/dist/collection/components/text/cura-paragraph/cura-paragraph.stories.js.map +1 -0
  259. package/dist/collection/index.js +2 -0
  260. package/dist/collection/index.js.map +1 -0
  261. package/dist/collection/rededor-cura-start.js +10 -0
  262. package/dist/collection/rededor-cura-start.js.map +1 -0
  263. package/dist/collection/stories/assets/accessibility.svg +5 -0
  264. package/dist/collection/stories/assets/discord.svg +15 -0
  265. package/dist/collection/stories/assets/github.svg +3 -0
  266. package/dist/collection/stories/assets/tutorials.svg +12 -0
  267. package/dist/collection/stories/assets/youtube.svg +4 -0
  268. package/dist/collection/stories/olds/Button.js +21 -0
  269. package/dist/collection/stories/olds/Button.st.js +50 -0
  270. package/dist/collection/stories/olds/Header.js +47 -0
  271. package/dist/collection/stories/olds/Header.st.js +28 -0
  272. package/dist/collection/stories/olds/Page.js +94 -0
  273. package/dist/collection/stories/olds/Page.st.js +27 -0
  274. package/dist/collection/utils/utils.js +16 -0
  275. package/dist/collection/utils/utils.js.map +1 -0
  276. package/dist/collection/utils/utils.spec.js +16 -0
  277. package/dist/collection/utils/utils.spec.js.map +1 -0
  278. package/dist/components/cura-accordion-item.d.ts +11 -0
  279. package/dist/components/cura-accordion-item.js +76 -0
  280. package/dist/components/cura-accordion-item.js.map +1 -0
  281. package/dist/components/cura-accordion.d.ts +11 -0
  282. package/dist/components/cura-accordion.js +120 -0
  283. package/dist/components/cura-accordion.js.map +1 -0
  284. package/dist/components/cura-button-outline.d.ts +11 -0
  285. package/dist/components/cura-button-outline.js +123 -0
  286. package/dist/components/cura-button-outline.js.map +1 -0
  287. package/dist/components/cura-button-transparent.d.ts +11 -0
  288. package/dist/components/cura-button-transparent.js +123 -0
  289. package/dist/components/cura-button-transparent.js.map +1 -0
  290. package/dist/components/cura-button.d.ts +11 -0
  291. package/dist/components/cura-button.js +123 -0
  292. package/dist/components/cura-button.js.map +1 -0
  293. package/dist/components/cura-display.d.ts +11 -0
  294. package/dist/components/cura-display.js +89 -0
  295. package/dist/components/cura-display.js.map +1 -0
  296. package/dist/components/cura-heading.d.ts +11 -0
  297. package/dist/components/cura-heading.js +94 -0
  298. package/dist/components/cura-heading.js.map +1 -0
  299. package/dist/components/cura-icon.d.ts +11 -0
  300. package/dist/components/cura-icon.js +8 -0
  301. package/dist/components/cura-icon.js.map +1 -0
  302. package/dist/components/cura-icon2.js +79 -0
  303. package/dist/components/cura-icon2.js.map +1 -0
  304. package/dist/components/cura-icons-view.d.ts +11 -0
  305. package/dist/components/cura-icons-view.js +51 -0
  306. package/dist/components/cura-icons-view.js.map +1 -0
  307. package/dist/components/cura-loader-circle.d.ts +11 -0
  308. package/dist/components/cura-loader-circle.js +8 -0
  309. package/dist/components/cura-loader-circle.js.map +1 -0
  310. package/dist/components/cura-loader-circle2.js +51 -0
  311. package/dist/components/cura-loader-circle2.js.map +1 -0
  312. package/dist/components/cura-page-template.d.ts +11 -0
  313. package/dist/components/cura-page-template.js +49 -0
  314. package/dist/components/cura-page-template.js.map +1 -0
  315. package/dist/components/cura-paragraph.d.ts +11 -0
  316. package/dist/components/cura-paragraph.js +87 -0
  317. package/dist/components/cura-paragraph.js.map +1 -0
  318. package/dist/components/index.d.ts +39 -0
  319. package/dist/components/index.js +547 -0
  320. package/dist/components/index.js.map +1 -0
  321. package/dist/cura/cura.esm.js +2 -0
  322. package/dist/cura/cura.esm.js.map +1 -0
  323. package/dist/cura/cura.js +133 -0
  324. package/dist/cura/index.esm.js +2 -0
  325. package/dist/cura/index.esm.js.map +1 -0
  326. package/dist/cura/p-118112e5.system.js +14 -0
  327. package/dist/cura/p-118112e5.system.js.map +1 -0
  328. package/dist/cura/p-183305c3.js +2 -0
  329. package/dist/cura/p-183305c3.js.map +1 -0
  330. package/dist/cura/p-319699df.entry.js +2 -0
  331. package/dist/cura/p-319699df.entry.js.map +1 -0
  332. package/dist/cura/p-3f6aaefc.system.js +2 -0
  333. package/dist/cura/p-3f6aaefc.system.js.map +1 -0
  334. package/dist/cura/p-46d20db3.js +3 -0
  335. package/dist/cura/p-46d20db3.js.map +1 -0
  336. package/dist/cura/p-50ea2036.system.js +2 -0
  337. package/dist/cura/p-50ea2036.system.js.map +1 -0
  338. package/dist/cura/p-5250cb43.system.js +2 -0
  339. package/dist/cura/p-5250cb43.system.js.map +1 -0
  340. package/dist/cura/p-5cc3c8bd.system.entry.js +2 -0
  341. package/dist/cura/p-5cc3c8bd.system.entry.js.map +1 -0
  342. package/dist/cura/p-788e035b.system.js +2 -0
  343. package/dist/cura/p-788e035b.system.js.map +1 -0
  344. package/dist/cura/p-beab48cd.js +13 -0
  345. package/dist/cura/p-beab48cd.js.map +1 -0
  346. package/dist/cura/p-c0c00396.system.js +3 -0
  347. package/dist/cura/p-c0c00396.system.js.map +1 -0
  348. package/dist/cura/p-d5c64a5f.js +2 -0
  349. package/dist/cura/p-d5c64a5f.js.map +1 -0
  350. package/dist/esm/app-globals-cc003eaf.js +509 -0
  351. package/dist/esm/app-globals-cc003eaf.js.map +1 -0
  352. package/dist/esm/css-shim-d13f0738.js +6 -0
  353. package/dist/esm/css-shim-d13f0738.js.map +1 -0
  354. package/dist/esm/cura-accordion_12.entry.js +659 -0
  355. package/dist/esm/cura-accordion_12.entry.js.map +1 -0
  356. package/dist/esm/cura.js +31 -0
  357. package/dist/esm/cura.js.map +1 -0
  358. package/dist/esm/index-d99da69e.js +2216 -0
  359. package/dist/esm/index-d99da69e.js.map +1 -0
  360. package/dist/esm/index.js +3 -0
  361. package/dist/esm/index.js.map +1 -0
  362. package/dist/esm/loader.js +38 -0
  363. package/dist/esm/loader.js.map +1 -0
  364. package/dist/esm/polyfills/core-js.js +11 -0
  365. package/dist/esm/polyfills/css-shim.js +1 -0
  366. package/dist/esm/polyfills/dom.js +79 -0
  367. package/dist/esm/polyfills/es5-html-element.js +1 -0
  368. package/dist/esm/polyfills/index.js +34 -0
  369. package/dist/esm/polyfills/system.js +6 -0
  370. package/dist/esm/shadow-css-07b0c8c8.js +389 -0
  371. package/dist/esm/shadow-css-07b0c8c8.js.map +1 -0
  372. package/dist/esm-es5/app-globals-cc003eaf.js +2 -0
  373. package/dist/esm-es5/app-globals-cc003eaf.js.map +1 -0
  374. package/dist/esm-es5/css-shim-d13f0738.js +2 -0
  375. package/dist/esm-es5/css-shim-d13f0738.js.map +1 -0
  376. package/dist/esm-es5/cura-accordion_12.entry.js +2 -0
  377. package/dist/esm-es5/cura-accordion_12.entry.js.map +1 -0
  378. package/dist/esm-es5/cura.js +2 -0
  379. package/dist/esm-es5/cura.js.map +1 -0
  380. package/dist/esm-es5/index-d99da69e.js +3 -0
  381. package/dist/esm-es5/index-d99da69e.js.map +1 -0
  382. package/dist/esm-es5/index.js +2 -0
  383. package/dist/esm-es5/index.js.map +1 -0
  384. package/dist/esm-es5/loader.js +2 -0
  385. package/dist/esm-es5/loader.js.map +1 -0
  386. package/dist/esm-es5/shadow-css-07b0c8c8.js +13 -0
  387. package/dist/esm-es5/shadow-css-07b0c8c8.js.map +1 -0
  388. package/dist/index.cjs.js +1 -0
  389. package/dist/index.js +1 -0
  390. package/dist/loader/cdn.js +3 -0
  391. package/dist/loader/index.cjs.js +3 -0
  392. package/dist/loader/index.d.ts +21 -0
  393. package/dist/loader/index.es2017.js +3 -0
  394. package/dist/loader/index.js +4 -0
  395. package/dist/loader/package.json +11 -0
  396. package/dist/types/api/cura-api.d.ts +6 -0
  397. package/dist/types/api/cura-api.type.d.ts +65 -0
  398. package/dist/types/api/modules/cura-theme-breakpoints-module.d.ts +5 -0
  399. package/dist/types/api/modules/cura-theme-colors-module.d.ts +48 -0
  400. package/dist/types/api/modules/cura-theme-fonts-module.d.ts +24 -0
  401. package/dist/types/api/modules/cura-theme-module.d.ts +32 -0
  402. package/dist/types/api/modules/cura-theme-spacing-module.d.ts +6 -0
  403. package/dist/types/api/theme-presets/static.d.ts +69 -0
  404. package/dist/types/api/theme-presets/theme-default.d.ts +46 -0
  405. package/dist/types/api/theme-presets/theme-legacy-default.d.ts +43 -0
  406. package/dist/types/api/theme-presets/theme-maternity.d.ts +43 -0
  407. package/dist/types/api/theme-presets/theme-oncology.d.ts +50 -0
  408. package/dist/types/api/theme-presets/theme-presets.d.ts +181 -0
  409. package/dist/types/assets/icons/iconset-default-list.d.ts +2 -0
  410. package/dist/types/components/accordion/cura-accordion/cura-accordion.d.ts +39 -0
  411. package/dist/types/components/accordion/cura-accordion/cura-accordion.stories.d.ts +154 -0
  412. package/dist/types/components/accordion/cura-accordion-item/cura-accordion-item.d.ts +29 -0
  413. package/dist/types/components/buttons/cura-button/cura-button.d.ts +61 -0
  414. package/dist/types/components/buttons/cura-button/cura-button.stories.d.ts +171 -0
  415. package/dist/types/components/buttons/cura-button-outline/cura-button-outline.d.ts +61 -0
  416. package/dist/types/components/buttons/cura-button-outline/cura-button-outline.stories.d.ts +171 -0
  417. package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.d.ts +61 -0
  418. package/dist/types/components/buttons/cura-button-transparent/cura-button-transparent.stories.d.ts +171 -0
  419. package/dist/types/components/cura-icon/cura-icon.d.ts +56 -0
  420. package/dist/types/components/cura-icon/cura-icon.stories.d.ts +65 -0
  421. package/dist/types/components/cura-icons-view/cura-icons-view.d.ts +7 -0
  422. package/dist/types/components/cura-icons-view/cura-icons-view.stories.d.ts +7 -0
  423. package/dist/types/components/cura-page-template/cura-page-template.d.ts +8 -0
  424. package/dist/types/components/loaders/cura-loader-circle/cura-loader-circle.d.ts +23 -0
  425. package/dist/types/components/loaders/cura-loader-circle/cura-loader-circle.stories.d.ts +43 -0
  426. package/dist/types/components/text/cura-display/cura-display.d.ts +38 -0
  427. package/dist/types/components/text/cura-display/cura-display.stories.d.ts +76 -0
  428. package/dist/types/components/text/cura-heading/cura-heading.d.ts +43 -0
  429. package/dist/types/components/text/cura-heading/cura-heading.stories.d.ts +90 -0
  430. package/dist/types/components/text/cura-paragraph/cura-paragraph.d.ts +37 -0
  431. package/dist/types/components/text/cura-paragraph/cura-paragraph.stories.d.ts +74 -0
  432. package/dist/types/components.d.ts +688 -0
  433. package/dist/types/index.d.ts +1 -0
  434. package/dist/types/rededor-cura-start.d.ts +9 -0
  435. package/dist/types/stencil-public-runtime.d.ts +1638 -0
  436. package/dist/types/utils/utils.d.ts +2 -0
  437. package/package.json +4 -6
@@ -0,0 +1,2247 @@
1
+ 'use strict';
2
+
3
+ function _interopNamespace(e) {
4
+ if (e && e.__esModule) return e;
5
+ var n = Object.create(null);
6
+ if (e) {
7
+ Object.keys(e).forEach(function (k) {
8
+ if (k !== 'default') {
9
+ var d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: function () {
13
+ return e[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n['default'] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ const NAMESPACE = 'cura';
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
+ */
33
+ let scopeId;
34
+ let contentRef;
35
+ let hostTagName;
36
+ let useNativeShadowDom = false;
37
+ let checkSlotFallbackVisibility = false;
38
+ let checkSlotRelocate = false;
39
+ let isSvgMode = false;
40
+ let queuePending = false;
41
+ const createTime = (fnName, tagName = '') => {
42
+ {
43
+ return () => {
44
+ return;
45
+ };
46
+ }
47
+ };
48
+ const uniqueTime = (key, measureText) => {
49
+ {
50
+ return () => {
51
+ return;
52
+ };
53
+ }
54
+ };
55
+ const CONTENT_REF_ID = 'r';
56
+ const ORG_LOCATION_ID = 'o';
57
+ const SLOT_NODE_ID = 's';
58
+ const TEXT_NODE_ID = 't';
59
+ const HYDRATE_ID = 's-id';
60
+ const HYDRATED_STYLE_ID = 'sty-id';
61
+ const HYDRATE_CHILD_ID = 'c-id';
62
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
63
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
64
+ /**
65
+ * Default style mode id
66
+ */
67
+ /**
68
+ * Reusable empty obj/array
69
+ * Don't add values to these!!
70
+ */
71
+ const EMPTY_OBJ = {};
72
+ /**
73
+ * Namespaces
74
+ */
75
+ const SVG_NS = 'http://www.w3.org/2000/svg';
76
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
77
+ const isDef = (v) => v != null;
78
+ /**
79
+ * Check whether a value is a 'complex type', defined here as an object or a
80
+ * function.
81
+ *
82
+ * @param o the value to check
83
+ * @returns whether it's a complex type or not
84
+ */
85
+ const isComplexType = (o) => {
86
+ // https://jsperf.com/typeof-fn-object/5
87
+ o = typeof o;
88
+ return o === 'object' || o === 'function';
89
+ };
90
+ /**
91
+ * Helper method for querying a `meta` tag that contains a nonce value
92
+ * out of a DOM's head.
93
+ *
94
+ * @param doc The DOM containing the `head` to query against
95
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
96
+ * exists or the tag has no content.
97
+ */
98
+ function queryNonceMetaTagContent(doc) {
99
+ var _a, _b, _c;
100
+ 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;
101
+ }
102
+ /**
103
+ * Production h() function based on Preact by
104
+ * Jason Miller (@developit)
105
+ * Licensed under the MIT License
106
+ * https://github.com/developit/preact/blob/master/LICENSE
107
+ *
108
+ * Modified for Stencil's compiler and vdom
109
+ */
110
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
111
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
112
+ const h = (nodeName, vnodeData, ...children) => {
113
+ let child = null;
114
+ let slotName = null;
115
+ let simple = false;
116
+ let lastSimple = false;
117
+ const vNodeChildren = [];
118
+ const walk = (c) => {
119
+ for (let i = 0; i < c.length; i++) {
120
+ child = c[i];
121
+ if (Array.isArray(child)) {
122
+ walk(child);
123
+ }
124
+ else if (child != null && typeof child !== 'boolean') {
125
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
126
+ child = String(child);
127
+ }
128
+ if (simple && lastSimple) {
129
+ // If the previous child was simple (string), we merge both
130
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
131
+ }
132
+ else {
133
+ // Append a new vNode, if it's text, we create a text vNode
134
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
135
+ }
136
+ lastSimple = simple;
137
+ }
138
+ }
139
+ };
140
+ walk(children);
141
+ if (vnodeData) {
142
+ if (vnodeData.name) {
143
+ slotName = vnodeData.name;
144
+ }
145
+ {
146
+ const classData = vnodeData.className || vnodeData.class;
147
+ if (classData) {
148
+ vnodeData.class =
149
+ typeof classData !== 'object'
150
+ ? classData
151
+ : Object.keys(classData)
152
+ .filter((k) => classData[k])
153
+ .join(' ');
154
+ }
155
+ }
156
+ }
157
+ const vnode = newVNode(nodeName, null);
158
+ vnode.$attrs$ = vnodeData;
159
+ if (vNodeChildren.length > 0) {
160
+ vnode.$children$ = vNodeChildren;
161
+ }
162
+ {
163
+ vnode.$name$ = slotName;
164
+ }
165
+ return vnode;
166
+ };
167
+ /**
168
+ * A utility function for creating a virtual DOM node from a tag and some
169
+ * possible text content.
170
+ *
171
+ * @param tag the tag for this element
172
+ * @param text possible text content for the node
173
+ * @returns a newly-minted virtual DOM node
174
+ */
175
+ const newVNode = (tag, text) => {
176
+ const vnode = {
177
+ $flags$: 0,
178
+ $tag$: tag,
179
+ $text$: text,
180
+ $elm$: null,
181
+ $children$: null,
182
+ };
183
+ {
184
+ vnode.$attrs$ = null;
185
+ }
186
+ {
187
+ vnode.$name$ = null;
188
+ }
189
+ return vnode;
190
+ };
191
+ const Host = {};
192
+ /**
193
+ * Check whether a given node is a Host node or not
194
+ *
195
+ * @param node the virtual DOM node to check
196
+ * @returns whether it's a Host node or not
197
+ */
198
+ const isHost = (node) => node && node.$tag$ === Host;
199
+ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
200
+ const endHydrate = createTime('hydrateClient', tagName);
201
+ const shadowRoot = hostElm.shadowRoot;
202
+ const childRenderNodes = [];
203
+ const slotNodes = [];
204
+ const shadowRootNodes = shadowRoot ? [] : null;
205
+ const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
206
+ if (!plt.$orgLocNodes$) {
207
+ initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
208
+ }
209
+ hostElm[HYDRATE_ID] = hostId;
210
+ hostElm.removeAttribute(HYDRATE_ID);
211
+ clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
212
+ childRenderNodes.map((c) => {
213
+ const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
214
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
215
+ const node = c.$elm$;
216
+ if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
217
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
218
+ }
219
+ if (!shadowRoot) {
220
+ node['s-hn'] = tagName;
221
+ if (orgLocationNode) {
222
+ node['s-ol'] = orgLocationNode;
223
+ node['s-ol']['s-nr'] = node;
224
+ }
225
+ }
226
+ plt.$orgLocNodes$.delete(orgLocationId);
227
+ });
228
+ if (shadowRoot) {
229
+ shadowRootNodes.map((shadowRootNode) => {
230
+ if (shadowRootNode) {
231
+ shadowRoot.appendChild(shadowRootNode);
232
+ }
233
+ });
234
+ }
235
+ endHydrate();
236
+ };
237
+ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
238
+ let childNodeType;
239
+ let childIdSplt;
240
+ let childVNode;
241
+ let i;
242
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
243
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
244
+ if (childNodeType) {
245
+ // got the node data from the element's attribute
246
+ // `${hostId}.${nodeId}.${depth}.${index}`
247
+ childIdSplt = childNodeType.split('.');
248
+ if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
249
+ childVNode = {
250
+ $flags$: 0,
251
+ $hostId$: childIdSplt[0],
252
+ $nodeId$: childIdSplt[1],
253
+ $depth$: childIdSplt[2],
254
+ $index$: childIdSplt[3],
255
+ $tag$: node.tagName.toLowerCase(),
256
+ $elm$: node,
257
+ $attrs$: null,
258
+ $children$: null,
259
+ $key$: null,
260
+ $name$: null,
261
+ $text$: null,
262
+ };
263
+ childRenderNodes.push(childVNode);
264
+ node.removeAttribute(HYDRATE_CHILD_ID);
265
+ // this is a new child vnode
266
+ // so ensure its parent vnode has the vchildren array
267
+ if (!parentVNode.$children$) {
268
+ parentVNode.$children$ = [];
269
+ }
270
+ // add our child vnode to a specific index of the vnode's children
271
+ parentVNode.$children$[childVNode.$index$] = childVNode;
272
+ // this is now the new parent vnode for all the next child checks
273
+ parentVNode = childVNode;
274
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
275
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
276
+ }
277
+ }
278
+ }
279
+ // recursively drill down, end to start so we can remove nodes
280
+ for (i = node.childNodes.length - 1; i >= 0; i--) {
281
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
282
+ }
283
+ if (node.shadowRoot) {
284
+ // keep drilling down through the shadow root nodes
285
+ for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
286
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
287
+ }
288
+ }
289
+ }
290
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
291
+ // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
292
+ childIdSplt = node.nodeValue.split('.');
293
+ if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
294
+ // comment node for either the host id or a 0 host id
295
+ childNodeType = childIdSplt[0];
296
+ childVNode = {
297
+ $flags$: 0,
298
+ $hostId$: childIdSplt[1],
299
+ $nodeId$: childIdSplt[2],
300
+ $depth$: childIdSplt[3],
301
+ $index$: childIdSplt[4],
302
+ $elm$: node,
303
+ $attrs$: null,
304
+ $children$: null,
305
+ $key$: null,
306
+ $name$: null,
307
+ $tag$: null,
308
+ $text$: null,
309
+ };
310
+ if (childNodeType === TEXT_NODE_ID) {
311
+ childVNode.$elm$ = node.nextSibling;
312
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
313
+ childVNode.$text$ = childVNode.$elm$.textContent;
314
+ childRenderNodes.push(childVNode);
315
+ // remove the text comment since it's no longer needed
316
+ node.remove();
317
+ if (!parentVNode.$children$) {
318
+ parentVNode.$children$ = [];
319
+ }
320
+ parentVNode.$children$[childVNode.$index$] = childVNode;
321
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
322
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
323
+ }
324
+ }
325
+ }
326
+ else if (childVNode.$hostId$ === hostId) {
327
+ // this comment node is specifcally for this host id
328
+ if (childNodeType === SLOT_NODE_ID) {
329
+ // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
330
+ childVNode.$tag$ = 'slot';
331
+ if (childIdSplt[5]) {
332
+ node['s-sn'] = childVNode.$name$ = childIdSplt[5];
333
+ }
334
+ else {
335
+ node['s-sn'] = '';
336
+ }
337
+ node['s-sr'] = true;
338
+ if (shadowRootNodes) {
339
+ // browser support shadowRoot and this is a shadow dom component
340
+ // create an actual slot element
341
+ childVNode.$elm$ = doc.createElement(childVNode.$tag$);
342
+ if (childVNode.$name$) {
343
+ // add the slot name attribute
344
+ childVNode.$elm$.setAttribute('name', childVNode.$name$);
345
+ }
346
+ // insert the new slot element before the slot comment
347
+ node.parentNode.insertBefore(childVNode.$elm$, node);
348
+ // remove the slot comment since it's not needed for shadow
349
+ node.remove();
350
+ if (childVNode.$depth$ === '0') {
351
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
352
+ }
353
+ }
354
+ slotNodes.push(childVNode);
355
+ if (!parentVNode.$children$) {
356
+ parentVNode.$children$ = [];
357
+ }
358
+ parentVNode.$children$[childVNode.$index$] = childVNode;
359
+ }
360
+ else if (childNodeType === CONTENT_REF_ID) {
361
+ // `${CONTENT_REF_ID}.${hostId}`;
362
+ if (shadowRootNodes) {
363
+ // remove the content ref comment since it's not needed for shadow
364
+ node.remove();
365
+ }
366
+ else {
367
+ hostElm['s-cr'] = node;
368
+ node['s-cn'] = true;
369
+ }
370
+ }
371
+ }
372
+ }
373
+ }
374
+ else if (parentVNode && parentVNode.$tag$ === 'style') {
375
+ const vnode = newVNode(null, node.textContent);
376
+ vnode.$elm$ = node;
377
+ vnode.$index$ = '0';
378
+ parentVNode.$children$ = [vnode];
379
+ }
380
+ };
381
+ const initializeDocumentHydrate = (node, orgLocNodes) => {
382
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
383
+ let i = 0;
384
+ for (; i < node.childNodes.length; i++) {
385
+ initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
386
+ }
387
+ if (node.shadowRoot) {
388
+ for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
389
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
390
+ }
391
+ }
392
+ }
393
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
394
+ const childIdSplt = node.nodeValue.split('.');
395
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
396
+ orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
397
+ node.nodeValue = '';
398
+ // useful to know if the original location is
399
+ // the root light-dom of a shadow dom component
400
+ node['s-en'] = childIdSplt[3];
401
+ }
402
+ }
403
+ };
404
+ /**
405
+ * Parse a new property value for a given property type.
406
+ *
407
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
408
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
409
+ * 1. `any`, the type given to `propValue` in the function signature
410
+ * 2. the type stored from `propType`.
411
+ *
412
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
413
+ *
414
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
415
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
416
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
417
+ * ```tsx
418
+ * <my-cmp prop-val={0}></my-cmp>
419
+ * ```
420
+ *
421
+ * HTML prop values on the other hand, will always a string
422
+ *
423
+ * @param propValue the new value to coerce to some type
424
+ * @param propType the type of the prop, expressed as a binary number
425
+ * @returns the parsed/coerced value
426
+ */
427
+ const parsePropertyValue = (propValue, propType) => {
428
+ // ensure this value is of the correct prop type
429
+ if (propValue != null && !isComplexType(propValue)) {
430
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
431
+ // per the HTML spec, any string value means it is a boolean true value
432
+ // but we'll cheat here and say that the string "false" is the boolean false
433
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
434
+ }
435
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
436
+ // force it to be a number
437
+ return parseFloat(propValue);
438
+ }
439
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
440
+ // could have been passed as a number or boolean
441
+ // but we still want it as a string
442
+ return String(propValue);
443
+ }
444
+ // redundant return here for better minification
445
+ return propValue;
446
+ }
447
+ // not sure exactly what type we want
448
+ // so no need to change to a different type
449
+ return propValue;
450
+ };
451
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
452
+ /**
453
+ * Helper function to create & dispatch a custom Event on a provided target
454
+ * @param elm the target of the Event
455
+ * @param name the name to give the custom Event
456
+ * @param opts options for configuring a custom Event
457
+ * @returns the custom Event
458
+ */
459
+ const emitEvent = (elm, name, opts) => {
460
+ const ev = plt.ce(name, opts);
461
+ elm.dispatchEvent(ev);
462
+ return ev;
463
+ };
464
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
465
+ const registerStyle = (scopeId, cssText, allowCS) => {
466
+ let style = styles.get(scopeId);
467
+ if (supportsConstructableStylesheets && allowCS) {
468
+ style = (style || new CSSStyleSheet());
469
+ if (typeof style === 'string') {
470
+ style = cssText;
471
+ }
472
+ else {
473
+ style.replaceSync(cssText);
474
+ }
475
+ }
476
+ else {
477
+ style = cssText;
478
+ }
479
+ styles.set(scopeId, style);
480
+ };
481
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
482
+ var _a;
483
+ let scopeId = getScopeId(cmpMeta);
484
+ const style = styles.get(scopeId);
485
+ // if an element is NOT connected then getRootNode() will return the wrong root node
486
+ // so the fallback is to always use the document for the root node in those cases
487
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
488
+ if (style) {
489
+ if (typeof style === 'string') {
490
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
491
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
492
+ let styleElm;
493
+ if (!appliedStyles) {
494
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
495
+ }
496
+ if (!appliedStyles.has(scopeId)) {
497
+ if (styleContainerNode.host &&
498
+ (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
499
+ // This is only happening on native shadow-dom, do not needs CSS var shim
500
+ styleElm.innerHTML = style;
501
+ }
502
+ else {
503
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
504
+ if (plt.$cssShim$) {
505
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
506
+ styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style,
507
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
508
+ !!(cmpMeta.$flags$ & 10 /* CMP_FLAGS.needsScopedEncapsulation */));
509
+ const newScopeId = styleElm['s-sc'];
510
+ if (newScopeId) {
511
+ scopeId = newScopeId;
512
+ // we don't want to add this styleID to the appliedStyles Set
513
+ // since the cssVarShim might need to apply several different
514
+ // stylesheets for the same component
515
+ appliedStyles = null;
516
+ }
517
+ }
518
+ else {
519
+ styleElm = doc.createElement('style');
520
+ styleElm.innerHTML = style;
521
+ }
522
+ // Apply CSP nonce to the style tag if it exists
523
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
524
+ if (nonce != null) {
525
+ styleElm.setAttribute('nonce', nonce);
526
+ }
527
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
528
+ }
529
+ if (appliedStyles) {
530
+ appliedStyles.add(scopeId);
531
+ }
532
+ }
533
+ }
534
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
535
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
536
+ }
537
+ }
538
+ return scopeId;
539
+ };
540
+ const attachStyles = (hostRef) => {
541
+ const cmpMeta = hostRef.$cmpMeta$;
542
+ const elm = hostRef.$hostElement$;
543
+ const flags = cmpMeta.$flags$;
544
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
545
+ const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
546
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
547
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
548
+ // only required when we're NOT using native shadow dom (slot)
549
+ // or this browser doesn't support native shadow dom
550
+ // and this host element was NOT created with SSR
551
+ // let's pick out the inner content for slot projection
552
+ // create a node to represent where the original
553
+ // content was first placed, which is useful later on
554
+ // DOM WRITE!!
555
+ elm['s-sc'] = scopeId;
556
+ elm.classList.add(scopeId + '-h');
557
+ }
558
+ endAttachStyles();
559
+ };
560
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
561
+ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
562
+ /**
563
+ * Production setAccessor() function based on Preact by
564
+ * Jason Miller (@developit)
565
+ * Licensed under the MIT License
566
+ * https://github.com/developit/preact/blob/master/LICENSE
567
+ *
568
+ * Modified for Stencil's compiler and vdom
569
+ */
570
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
571
+ if (oldValue !== newValue) {
572
+ let isProp = isMemberInElement(elm, memberName);
573
+ let ln = memberName.toLowerCase();
574
+ if (memberName === 'class') {
575
+ const classList = elm.classList;
576
+ const oldClasses = parseClassList(oldValue);
577
+ const newClasses = parseClassList(newValue);
578
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
579
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
580
+ }
581
+ else if (memberName === 'style') {
582
+ // update style attribute, css properties and values
583
+ {
584
+ for (const prop in oldValue) {
585
+ if (!newValue || newValue[prop] == null) {
586
+ if (prop.includes('-')) {
587
+ elm.style.removeProperty(prop);
588
+ }
589
+ else {
590
+ elm.style[prop] = '';
591
+ }
592
+ }
593
+ }
594
+ }
595
+ for (const prop in newValue) {
596
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
597
+ if (prop.includes('-')) {
598
+ elm.style.setProperty(prop, newValue[prop]);
599
+ }
600
+ else {
601
+ elm.style[prop] = newValue[prop];
602
+ }
603
+ }
604
+ }
605
+ }
606
+ else if ((!isProp ) &&
607
+ memberName[0] === 'o' &&
608
+ memberName[1] === 'n') {
609
+ // Event Handlers
610
+ // so if the member name starts with "on" and the 3rd characters is
611
+ // a capital letter, and it's not already a member on the element,
612
+ // then we're assuming it's an event listener
613
+ if (memberName[2] === '-') {
614
+ // on- prefixed events
615
+ // allows to be explicit about the dom event to listen without any magic
616
+ // under the hood:
617
+ // <my-cmp on-click> // listens for "click"
618
+ // <my-cmp on-Click> // listens for "Click"
619
+ // <my-cmp on-ionChange> // listens for "ionChange"
620
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
621
+ memberName = memberName.slice(3);
622
+ }
623
+ else if (isMemberInElement(win, ln)) {
624
+ // standard event
625
+ // the JSX attribute could have been "onMouseOver" and the
626
+ // member name "onmouseover" is on the window's prototype
627
+ // so let's add the listener "mouseover", which is all lowercased
628
+ memberName = ln.slice(2);
629
+ }
630
+ else {
631
+ // custom event
632
+ // the JSX attribute could have been "onMyCustomEvent"
633
+ // so let's trim off the "on" prefix and lowercase the first character
634
+ // and add the listener "myCustomEvent"
635
+ // except for the first character, we keep the event name case
636
+ memberName = ln[2] + memberName.slice(3);
637
+ }
638
+ if (oldValue) {
639
+ plt.rel(elm, memberName, oldValue, false);
640
+ }
641
+ if (newValue) {
642
+ plt.ael(elm, memberName, newValue, false);
643
+ }
644
+ }
645
+ else {
646
+ // Set property if it exists and it's not a SVG
647
+ const isComplex = isComplexType(newValue);
648
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
649
+ try {
650
+ if (!elm.tagName.includes('-')) {
651
+ const n = newValue == null ? '' : newValue;
652
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
653
+ if (memberName === 'list') {
654
+ isProp = false;
655
+ }
656
+ else if (oldValue == null || elm[memberName] != n) {
657
+ elm[memberName] = n;
658
+ }
659
+ }
660
+ else {
661
+ elm[memberName] = newValue;
662
+ }
663
+ }
664
+ catch (e) { }
665
+ }
666
+ /**
667
+ * Need to manually update attribute if:
668
+ * - memberName is not an attribute
669
+ * - if we are rendering the host element in order to reflect attribute
670
+ * - if it's a SVG, since properties might not work in <svg>
671
+ * - if the newValue is null/undefined or 'false'.
672
+ */
673
+ let xlink = false;
674
+ {
675
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
676
+ memberName = ln;
677
+ xlink = true;
678
+ }
679
+ }
680
+ if (newValue == null || newValue === false) {
681
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
682
+ if (xlink) {
683
+ elm.removeAttributeNS(XLINK_NS, memberName);
684
+ }
685
+ else {
686
+ elm.removeAttribute(memberName);
687
+ }
688
+ }
689
+ }
690
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
691
+ newValue = newValue === true ? '' : newValue;
692
+ if (xlink) {
693
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
694
+ }
695
+ else {
696
+ elm.setAttribute(memberName, newValue);
697
+ }
698
+ }
699
+ }
700
+ }
701
+ };
702
+ const parseClassListRegex = /\s/;
703
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
704
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
705
+ // if the element passed in is a shadow root, which is a document fragment
706
+ // then we want to be adding attrs/props to the shadow root's "host" element
707
+ // if it's not a shadow root, then we add attrs/props to the same element
708
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
709
+ ? newVnode.$elm$.host
710
+ : newVnode.$elm$;
711
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
712
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
713
+ {
714
+ // remove attributes no longer present on the vnode by setting them to undefined
715
+ for (memberName in oldVnodeAttrs) {
716
+ if (!(memberName in newVnodeAttrs)) {
717
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
718
+ }
719
+ }
720
+ }
721
+ // add new & update changed attributes
722
+ for (memberName in newVnodeAttrs) {
723
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
724
+ }
725
+ };
726
+ /**
727
+ * Create a DOM Node corresponding to one of the children of a given VNode.
728
+ *
729
+ * @param oldParentVNode the parent VNode from the previous render
730
+ * @param newParentVNode the parent VNode from the current render
731
+ * @param childIndex the index of the VNode, in the _new_ parent node's
732
+ * children, for which we will create a new DOM node
733
+ * @param parentElm the parent DOM node which our new node will be a child of
734
+ * @returns the newly created node
735
+ */
736
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
737
+ // tslint:disable-next-line: prefer-const
738
+ const newVNode = newParentVNode.$children$[childIndex];
739
+ let i = 0;
740
+ let elm;
741
+ let childNode;
742
+ let oldVNode;
743
+ if (!useNativeShadowDom) {
744
+ // remember for later we need to check to relocate nodes
745
+ checkSlotRelocate = true;
746
+ if (newVNode.$tag$ === 'slot') {
747
+ if (scopeId) {
748
+ // scoped css needs to add its scoped id to the parent element
749
+ parentElm.classList.add(scopeId + '-s');
750
+ }
751
+ newVNode.$flags$ |= newVNode.$children$
752
+ ? // slot element has fallback content
753
+ 2 /* VNODE_FLAGS.isSlotFallback */
754
+ : // slot element does not have fallback content
755
+ 1 /* VNODE_FLAGS.isSlotReference */;
756
+ }
757
+ }
758
+ if (newVNode.$text$ !== null) {
759
+ // create text node
760
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
761
+ }
762
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
763
+ // create a slot reference node
764
+ elm = newVNode.$elm$ =
765
+ doc.createTextNode('');
766
+ }
767
+ else {
768
+ if (!isSvgMode) {
769
+ isSvgMode = newVNode.$tag$ === 'svg';
770
+ }
771
+ // create element
772
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
773
+ ? 'slot-fb'
774
+ : newVNode.$tag$)
775
+ );
776
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
777
+ isSvgMode = false;
778
+ }
779
+ // add css classes, attrs, props, listeners, etc.
780
+ {
781
+ updateElement(null, newVNode, isSvgMode);
782
+ }
783
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
784
+ // if there is a scopeId and this is the initial render
785
+ // then let's add the scopeId as a css class
786
+ elm.classList.add((elm['s-si'] = scopeId));
787
+ }
788
+ if (newVNode.$children$) {
789
+ for (i = 0; i < newVNode.$children$.length; ++i) {
790
+ // create the node
791
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
792
+ // return node could have been null
793
+ if (childNode) {
794
+ // append our new node
795
+ elm.appendChild(childNode);
796
+ }
797
+ }
798
+ }
799
+ {
800
+ if (newVNode.$tag$ === 'svg') {
801
+ // Only reset the SVG context when we're exiting <svg> element
802
+ isSvgMode = false;
803
+ }
804
+ else if (elm.tagName === 'foreignObject') {
805
+ // Reenter SVG context when we're exiting <foreignObject> element
806
+ isSvgMode = true;
807
+ }
808
+ }
809
+ }
810
+ {
811
+ elm['s-hn'] = hostTagName;
812
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
813
+ // remember the content reference comment
814
+ elm['s-sr'] = true;
815
+ // remember the content reference comment
816
+ elm['s-cr'] = contentRef;
817
+ // remember the slot name, or empty string for default slot
818
+ elm['s-sn'] = newVNode.$name$ || '';
819
+ // check if we've got an old vnode for this slot
820
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
821
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
822
+ // we've got an old slot vnode and the wrapper is being replaced
823
+ // so let's move the old slot content back to it's original location
824
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
825
+ }
826
+ }
827
+ }
828
+ return elm;
829
+ };
830
+ const putBackInOriginalLocation = (parentElm, recursive) => {
831
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
832
+ const oldSlotChildNodes = parentElm.childNodes;
833
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
834
+ const childNode = oldSlotChildNodes[i];
835
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
836
+ // // this child node in the old element is from another component
837
+ // // remove this node from the old slot's parent
838
+ // childNode.remove();
839
+ // and relocate it back to it's original location
840
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
841
+ // remove the old original location comment entirely
842
+ // later on the patch function will know what to do
843
+ // and move this to the correct spot in need be
844
+ childNode['s-ol'].remove();
845
+ childNode['s-ol'] = undefined;
846
+ checkSlotRelocate = true;
847
+ }
848
+ if (recursive) {
849
+ putBackInOriginalLocation(childNode, recursive);
850
+ }
851
+ }
852
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
853
+ };
854
+ /**
855
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
856
+ * add them to the DOM in the appropriate place.
857
+ *
858
+ * @param parentElm the DOM node which should be used as a parent for the new
859
+ * DOM nodes
860
+ * @param before a child of the `parentElm` which the new children should be
861
+ * inserted before (optional)
862
+ * @param parentVNode the parent virtual DOM node
863
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
864
+ * @param startIdx the index in the child virtual DOM nodes at which to start
865
+ * creating DOM nodes (inclusive)
866
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
867
+ * creating DOM nodes (inclusive)
868
+ */
869
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
870
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
871
+ let childNode;
872
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
873
+ containerElm = containerElm.shadowRoot;
874
+ }
875
+ for (; startIdx <= endIdx; ++startIdx) {
876
+ if (vnodes[startIdx]) {
877
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
878
+ if (childNode) {
879
+ vnodes[startIdx].$elm$ = childNode;
880
+ containerElm.insertBefore(childNode, referenceNode(before) );
881
+ }
882
+ }
883
+ }
884
+ };
885
+ /**
886
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
887
+ * This can be used to, for instance, clean up after a list of children which
888
+ * should no longer be shown.
889
+ *
890
+ * This function also handles some of Stencil's slot relocation logic.
891
+ *
892
+ * @param vnodes a list of virtual DOM nodes to remove
893
+ * @param startIdx the index at which to start removing nodes (inclusive)
894
+ * @param endIdx the index at which to stop removing nodes (inclusive)
895
+ */
896
+ const removeVnodes = (vnodes, startIdx, endIdx) => {
897
+ for (let index = startIdx; index <= endIdx; ++index) {
898
+ const vnode = vnodes[index];
899
+ if (vnode) {
900
+ const elm = vnode.$elm$;
901
+ if (elm) {
902
+ {
903
+ // we're removing this element
904
+ // so it's possible we need to show slot fallback content now
905
+ checkSlotFallbackVisibility = true;
906
+ if (elm['s-ol']) {
907
+ // remove the original location comment
908
+ elm['s-ol'].remove();
909
+ }
910
+ else {
911
+ // it's possible that child nodes of the node
912
+ // that's being removed are slot nodes
913
+ putBackInOriginalLocation(elm, true);
914
+ }
915
+ }
916
+ // remove the vnode's element from the dom
917
+ elm.remove();
918
+ }
919
+ }
920
+ }
921
+ };
922
+ /**
923
+ * Reconcile the children of a new VNode with the children of an old VNode by
924
+ * traversing the two collections of children, identifying nodes that are
925
+ * conserved or changed, calling out to `patch` to make any necessary
926
+ * updates to the DOM, and rearranging DOM nodes as needed.
927
+ *
928
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
929
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
930
+ * 'windows' by storing start and end indices and references to the
931
+ * corresponding array entries. Initially the two 'windows' are basically equal
932
+ * to the entire array, but we progressively narrow the windows until there are
933
+ * no children left to update by doing the following:
934
+ *
935
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
936
+ * that if we have an initial array like the following we'll end up dealing
937
+ * only with a window bounded by the highlighted elements:
938
+ *
939
+ * [null, null, VNode1 , ... , VNode2, null, null]
940
+ * ^^^^^^ ^^^^^^
941
+ *
942
+ * 2. Check to see if the elements at the head and tail positions are equal
943
+ * across the windows. This will basically detect elements which haven't
944
+ * been added, removed, or changed position, i.e. if you had the following
945
+ * VNode elements (represented as HTML):
946
+ *
947
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
948
+ * newVNode: `<div><p><span>THERE</span></p></div>`
949
+ *
950
+ * Then when comparing the children of the `<div>` tag we check the equality
951
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
952
+ * same tag in the same position, we'd be able to avoid completely
953
+ * re-rendering the subtree under them with a new DOM element and would just
954
+ * call out to `patch` to handle reconciling their children and so on.
955
+ *
956
+ * 3. Check, for both windows, to see if the element at the beginning of the
957
+ * window corresponds to the element at the end of the other window. This is
958
+ * a heuristic which will let us identify _some_ situations in which
959
+ * elements have changed position, for instance it _should_ detect that the
960
+ * children nodes themselves have not changed but merely moved in the
961
+ * following example:
962
+ *
963
+ * oldVNode: `<div><element-one /><element-two /></div>`
964
+ * newVNode: `<div><element-two /><element-one /></div>`
965
+ *
966
+ * If we find cases like this then we also need to move the concrete DOM
967
+ * elements corresponding to the moved children to write the re-order to the
968
+ * DOM.
969
+ *
970
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
971
+ * nodes in the old children which have the same key as the first element in
972
+ * our window on the new children. If we find such a node we handle calling
973
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
974
+ * what we find.
975
+ *
976
+ * Finally, once we've narrowed our 'windows' to the point that either of them
977
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
978
+ * insertion or deletion that needs to happen to get a DOM state that correctly
979
+ * reflects the new child VNodes. If, for instance, after our window on the old
980
+ * children has collapsed we still have more nodes on the new children that
981
+ * we haven't dealt with yet then we need to add them, or if the new children
982
+ * collapse but we still have unhandled _old_ children then we need to make
983
+ * sure the corresponding DOM nodes are removed.
984
+ *
985
+ * @param parentElm the node into which the parent VNode is rendered
986
+ * @param oldCh the old children of the parent node
987
+ * @param newVNode the new VNode which will replace the parent
988
+ * @param newCh the new children of the parent node
989
+ */
990
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
991
+ let oldStartIdx = 0;
992
+ let newStartIdx = 0;
993
+ let oldEndIdx = oldCh.length - 1;
994
+ let oldStartVnode = oldCh[0];
995
+ let oldEndVnode = oldCh[oldEndIdx];
996
+ let newEndIdx = newCh.length - 1;
997
+ let newStartVnode = newCh[0];
998
+ let newEndVnode = newCh[newEndIdx];
999
+ let node;
1000
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1001
+ if (oldStartVnode == null) {
1002
+ // VNode might have been moved left
1003
+ oldStartVnode = oldCh[++oldStartIdx];
1004
+ }
1005
+ else if (oldEndVnode == null) {
1006
+ oldEndVnode = oldCh[--oldEndIdx];
1007
+ }
1008
+ else if (newStartVnode == null) {
1009
+ newStartVnode = newCh[++newStartIdx];
1010
+ }
1011
+ else if (newEndVnode == null) {
1012
+ newEndVnode = newCh[--newEndIdx];
1013
+ }
1014
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
1015
+ // if the start nodes are the same then we should patch the new VNode
1016
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
1017
+ // indices to reflect that. We don't need to move any DOM Nodes around
1018
+ // since things are matched up in order.
1019
+ patch(oldStartVnode, newStartVnode);
1020
+ oldStartVnode = oldCh[++oldStartIdx];
1021
+ newStartVnode = newCh[++newStartIdx];
1022
+ }
1023
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
1024
+ // likewise, if the end nodes are the same we patch new onto old and
1025
+ // decrement our end indices, and also likewise in this case we don't
1026
+ // need to move any DOM Nodes.
1027
+ patch(oldEndVnode, newEndVnode);
1028
+ oldEndVnode = oldCh[--oldEndIdx];
1029
+ newEndVnode = newCh[--newEndIdx];
1030
+ }
1031
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
1032
+ // case: "Vnode moved right"
1033
+ //
1034
+ // We've found that the last node in our window on the new children is
1035
+ // the same VNode as the _first_ node in our window on the old children
1036
+ // we're dealing with now. Visually, this is the layout of these two
1037
+ // nodes:
1038
+ //
1039
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1040
+ // ^^^^^^^^^^^
1041
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1042
+ // ^^^^^^^^^^^^^
1043
+ //
1044
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
1045
+ // and move the DOM element for `oldStartVnode`.
1046
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1047
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1048
+ }
1049
+ patch(oldStartVnode, newEndVnode);
1050
+ // We need to move the element for `oldStartVnode` into a position which
1051
+ // will be appropriate for `newEndVnode`. For this we can use
1052
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
1053
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
1054
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
1055
+ //
1056
+ // <old-start-node />
1057
+ // <some-intervening-node />
1058
+ // <old-end-node />
1059
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
1060
+ // <next-sibling />
1061
+ //
1062
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
1063
+ // the node for `oldStartVnode` at the end of the children of
1064
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
1065
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
1066
+ // append it to the children of the parent element.
1067
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1068
+ oldStartVnode = oldCh[++oldStartIdx];
1069
+ newEndVnode = newCh[--newEndIdx];
1070
+ }
1071
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
1072
+ // case: "Vnode moved left"
1073
+ //
1074
+ // We've found that the first node in our window on the new children is
1075
+ // the same VNode as the _last_ node in our window on the old children.
1076
+ // Visually, this is the layout of these two nodes:
1077
+ //
1078
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1079
+ // ^^^^^^^^^^^^^
1080
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1081
+ // ^^^^^^^^^^^
1082
+ //
1083
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
1084
+ // (which will handle updating any changed attributes, reconciling their
1085
+ // children etc) but we also need to move the DOM node to which
1086
+ // `oldEndVnode` corresponds.
1087
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1088
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1089
+ }
1090
+ patch(oldEndVnode, newStartVnode);
1091
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
1092
+ // the same node, so since we're here we know that they are not. Thus we
1093
+ // can move the element for `oldEndVnode` _before_ the element for
1094
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
1095
+ // future.
1096
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
1097
+ oldEndVnode = oldCh[--oldEndIdx];
1098
+ newStartVnode = newCh[++newStartIdx];
1099
+ }
1100
+ else {
1101
+ {
1102
+ // We either didn't find an element in the old children that matches
1103
+ // the key of the first new child OR the build is not using `key`
1104
+ // attributes at all. In either case we need to create a new element
1105
+ // for the new node.
1106
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
1107
+ newStartVnode = newCh[++newStartIdx];
1108
+ }
1109
+ if (node) {
1110
+ // if we created a new node then handle inserting it to the DOM
1111
+ {
1112
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1113
+ }
1114
+ }
1115
+ }
1116
+ }
1117
+ if (oldStartIdx > oldEndIdx) {
1118
+ // we have some more new nodes to add which don't match up with old nodes
1119
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
1120
+ }
1121
+ else if (newStartIdx > newEndIdx) {
1122
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
1123
+ // in the new array, so lets remove them (which entails cleaning up the
1124
+ // relevant DOM nodes)
1125
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1126
+ }
1127
+ };
1128
+ /**
1129
+ * Compare two VNodes to determine if they are the same
1130
+ *
1131
+ * **NB**: This function is an equality _heuristic_ based on the available
1132
+ * information set on the two VNodes and can be misleading under certain
1133
+ * circumstances. In particular, if the two nodes do not have `key` attrs
1134
+ * (available under `$key$` on VNodes) then the function falls back on merely
1135
+ * checking that they have the same tag.
1136
+ *
1137
+ * So, in other words, if `key` attrs are not set on VNodes which may be
1138
+ * changing order within a `children` array or something along those lines then
1139
+ * we could obtain a false negative and then have to do needless re-rendering
1140
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
1141
+ *
1142
+ * @param leftVNode the first VNode to check
1143
+ * @param rightVNode the second VNode to check
1144
+ * @returns whether they're equal or not
1145
+ */
1146
+ const isSameVnode = (leftVNode, rightVNode) => {
1147
+ // compare if two vnode to see if they're "technically" the same
1148
+ // need to have the same element tag, and same key to be the same
1149
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1150
+ if (leftVNode.$tag$ === 'slot') {
1151
+ return leftVNode.$name$ === rightVNode.$name$;
1152
+ }
1153
+ return true;
1154
+ }
1155
+ return false;
1156
+ };
1157
+ const referenceNode = (node) => {
1158
+ // this node was relocated to a new location in the dom
1159
+ // because of some other component's slot
1160
+ // but we still have an html comment in place of where
1161
+ // it's original location was according to it's original vdom
1162
+ return (node && node['s-ol']) || node;
1163
+ };
1164
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1165
+ /**
1166
+ * Handle reconciling an outdated VNode with a new one which corresponds to
1167
+ * it. This function handles flushing updates to the DOM and reconciling the
1168
+ * children of the two nodes (if any).
1169
+ *
1170
+ * @param oldVNode an old VNode whose DOM element and children we want to update
1171
+ * @param newVNode a new VNode representing an updated version of the old one
1172
+ */
1173
+ const patch = (oldVNode, newVNode) => {
1174
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
1175
+ const oldChildren = oldVNode.$children$;
1176
+ const newChildren = newVNode.$children$;
1177
+ const tag = newVNode.$tag$;
1178
+ const text = newVNode.$text$;
1179
+ let defaultHolder;
1180
+ if (text === null) {
1181
+ {
1182
+ // test if we're rendering an svg element, or still rendering nodes inside of one
1183
+ // only add this to the when the compiler sees we're using an svg somewhere
1184
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1185
+ }
1186
+ {
1187
+ if (tag === 'slot')
1188
+ ;
1189
+ else {
1190
+ // either this is the first render of an element OR it's an update
1191
+ // AND we already know it's possible it could have changed
1192
+ // this updates the element's css classes, attrs, props, listeners, etc.
1193
+ updateElement(oldVNode, newVNode, isSvgMode);
1194
+ }
1195
+ }
1196
+ if (oldChildren !== null && newChildren !== null) {
1197
+ // looks like there's child vnodes for both the old and new vnodes
1198
+ // so we need to call `updateChildren` to reconcile them
1199
+ updateChildren(elm, oldChildren, newVNode, newChildren);
1200
+ }
1201
+ else if (newChildren !== null) {
1202
+ // no old child vnodes, but there are new child vnodes to add
1203
+ if (oldVNode.$text$ !== null) {
1204
+ // the old vnode was text, so be sure to clear it out
1205
+ elm.textContent = '';
1206
+ }
1207
+ // add the new vnode children
1208
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1209
+ }
1210
+ else if (oldChildren !== null) {
1211
+ // no new child vnodes, but there are old child vnodes to remove
1212
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1213
+ }
1214
+ if (isSvgMode && tag === 'svg') {
1215
+ isSvgMode = false;
1216
+ }
1217
+ }
1218
+ else if ((defaultHolder = elm['s-cr'])) {
1219
+ // this element has slotted content
1220
+ defaultHolder.parentNode.textContent = text;
1221
+ }
1222
+ else if (oldVNode.$text$ !== text) {
1223
+ // update the text content for the text only vnode
1224
+ // and also only if the text is different than before
1225
+ elm.data = text;
1226
+ }
1227
+ };
1228
+ const updateFallbackSlotVisibility = (elm) => {
1229
+ // tslint:disable-next-line: prefer-const
1230
+ const childNodes = elm.childNodes;
1231
+ let childNode;
1232
+ let i;
1233
+ let ilen;
1234
+ let j;
1235
+ let slotNameAttr;
1236
+ let nodeType;
1237
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
1238
+ childNode = childNodes[i];
1239
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1240
+ if (childNode['s-sr']) {
1241
+ // this is a slot fallback node
1242
+ // get the slot name for this slot reference node
1243
+ slotNameAttr = childNode['s-sn'];
1244
+ // by default always show a fallback slot node
1245
+ // then hide it if there are other slots in the light dom
1246
+ childNode.hidden = false;
1247
+ for (j = 0; j < ilen; j++) {
1248
+ nodeType = childNodes[j].nodeType;
1249
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
1250
+ // this sibling node is from a different component OR is a named fallback slot node
1251
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1252
+ childNode.hidden = true;
1253
+ break;
1254
+ }
1255
+ }
1256
+ else {
1257
+ // this is a default fallback slot node
1258
+ // any element or text node (with content)
1259
+ // should hide the default fallback slot node
1260
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1261
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
1262
+ childNode.hidden = true;
1263
+ break;
1264
+ }
1265
+ }
1266
+ }
1267
+ }
1268
+ // keep drilling down
1269
+ updateFallbackSlotVisibility(childNode);
1270
+ }
1271
+ }
1272
+ };
1273
+ const relocateNodes = [];
1274
+ const relocateSlotContent = (elm) => {
1275
+ // tslint:disable-next-line: prefer-const
1276
+ let childNode;
1277
+ let node;
1278
+ let hostContentNodes;
1279
+ let slotNameAttr;
1280
+ let relocateNodeData;
1281
+ let j;
1282
+ let i = 0;
1283
+ const childNodes = elm.childNodes;
1284
+ const ilen = childNodes.length;
1285
+ for (; i < ilen; i++) {
1286
+ childNode = childNodes[i];
1287
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1288
+ // first got the content reference comment node
1289
+ // then we got it's parent, which is where all the host content is in now
1290
+ hostContentNodes = node.parentNode.childNodes;
1291
+ slotNameAttr = childNode['s-sn'];
1292
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1293
+ node = hostContentNodes[j];
1294
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
1295
+ // let's do some relocating to its new home
1296
+ // but never relocate a content reference node
1297
+ // that is suppose to always represent the original content location
1298
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
1299
+ // it's possible we've already decided to relocate this node
1300
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1301
+ // made some changes to slots
1302
+ // let's make sure we also double check
1303
+ // fallbacks are correctly hidden or shown
1304
+ checkSlotFallbackVisibility = true;
1305
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
1306
+ if (relocateNodeData) {
1307
+ // previously we never found a slot home for this node
1308
+ // but turns out we did, so let's remember it now
1309
+ relocateNodeData.$slotRefNode$ = childNode;
1310
+ }
1311
+ else {
1312
+ // add to our list of nodes to relocate
1313
+ relocateNodes.push({
1314
+ $slotRefNode$: childNode,
1315
+ $nodeToRelocate$: node,
1316
+ });
1317
+ }
1318
+ if (node['s-sr']) {
1319
+ relocateNodes.map((relocateNode) => {
1320
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1321
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1322
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1323
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1324
+ }
1325
+ }
1326
+ });
1327
+ }
1328
+ }
1329
+ else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1330
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
1331
+ // if we never find a home for this element then we'll need to hide it
1332
+ relocateNodes.push({
1333
+ $nodeToRelocate$: node,
1334
+ });
1335
+ }
1336
+ }
1337
+ }
1338
+ }
1339
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1340
+ relocateSlotContent(childNode);
1341
+ }
1342
+ }
1343
+ };
1344
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1345
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1346
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
1347
+ return true;
1348
+ }
1349
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
1350
+ return true;
1351
+ }
1352
+ return false;
1353
+ }
1354
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
1355
+ return true;
1356
+ }
1357
+ return slotNameAttr === '';
1358
+ };
1359
+ /**
1360
+ * The main entry point for Stencil's virtual DOM-based rendering engine
1361
+ *
1362
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1363
+ * function will handle creating a virtual DOM tree with a single root, patching
1364
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
1365
+ * relocation, and reflecting attributes.
1366
+ *
1367
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
1368
+ * the DOM node into which it should be rendered.
1369
+ * @param renderFnResults the virtual DOM nodes to be rendered
1370
+ */
1371
+ const renderVdom = (hostRef, renderFnResults) => {
1372
+ const hostElm = hostRef.$hostElement$;
1373
+ const cmpMeta = hostRef.$cmpMeta$;
1374
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1375
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1376
+ hostTagName = hostElm.tagName;
1377
+ if (cmpMeta.$attrsToReflect$) {
1378
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1379
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1380
+ }
1381
+ rootVnode.$tag$ = null;
1382
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1383
+ hostRef.$vnode$ = rootVnode;
1384
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1385
+ {
1386
+ scopeId = hostElm['s-sc'];
1387
+ }
1388
+ {
1389
+ contentRef = hostElm['s-cr'];
1390
+ useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1391
+ // always reset
1392
+ checkSlotFallbackVisibility = false;
1393
+ }
1394
+ // synchronous patch
1395
+ patch(oldVNode, rootVnode);
1396
+ {
1397
+ // while we're moving nodes around existing nodes, temporarily disable
1398
+ // the disconnectCallback from working
1399
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1400
+ if (checkSlotRelocate) {
1401
+ relocateSlotContent(rootVnode.$elm$);
1402
+ let relocateData;
1403
+ let nodeToRelocate;
1404
+ let orgLocationNode;
1405
+ let parentNodeRef;
1406
+ let insertBeforeNode;
1407
+ let refNode;
1408
+ let i = 0;
1409
+ for (; i < relocateNodes.length; i++) {
1410
+ relocateData = relocateNodes[i];
1411
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1412
+ if (!nodeToRelocate['s-ol']) {
1413
+ // add a reference node marking this node's original location
1414
+ // keep a reference to this node for later lookups
1415
+ orgLocationNode =
1416
+ doc.createTextNode('');
1417
+ orgLocationNode['s-nr'] = nodeToRelocate;
1418
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1419
+ }
1420
+ }
1421
+ for (i = 0; i < relocateNodes.length; i++) {
1422
+ relocateData = relocateNodes[i];
1423
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1424
+ if (relocateData.$slotRefNode$) {
1425
+ // by default we're just going to insert it directly
1426
+ // after the slot reference node
1427
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
1428
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1429
+ orgLocationNode = nodeToRelocate['s-ol'];
1430
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
1431
+ refNode = orgLocationNode['s-nr'];
1432
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1433
+ refNode = refNode.nextSibling;
1434
+ if (!refNode || !refNode['s-nr']) {
1435
+ insertBeforeNode = refNode;
1436
+ break;
1437
+ }
1438
+ }
1439
+ }
1440
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1441
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
1442
+ // we've checked that it's worth while to relocate
1443
+ // since that the node to relocate
1444
+ // has a different next sibling or parent relocated
1445
+ if (nodeToRelocate !== insertBeforeNode) {
1446
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1447
+ // probably a component in the index.html that doesn't have it's hostname set
1448
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1449
+ }
1450
+ // add it back to the dom but in its new home
1451
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1452
+ }
1453
+ }
1454
+ }
1455
+ else {
1456
+ // this node doesn't have a slot home to go to, so let's hide it
1457
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1458
+ nodeToRelocate.hidden = true;
1459
+ }
1460
+ }
1461
+ }
1462
+ }
1463
+ if (checkSlotFallbackVisibility) {
1464
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1465
+ }
1466
+ // done moving nodes around
1467
+ // allow the disconnect callback to work again
1468
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1469
+ // always reset
1470
+ relocateNodes.length = 0;
1471
+ }
1472
+ };
1473
+ const attachToAncestor = (hostRef, ancestorComponent) => {
1474
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1475
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1476
+ }
1477
+ };
1478
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
1479
+ {
1480
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1481
+ }
1482
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1483
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1484
+ return;
1485
+ }
1486
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1487
+ // there is no ancestor component or the ancestor component
1488
+ // has already fired off its lifecycle update then
1489
+ // fire off the initial update
1490
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1491
+ return writeTask(dispatch) ;
1492
+ };
1493
+ /**
1494
+ * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
1495
+ * component lifecycle methods like `componentWillLoad` as well as
1496
+ * {@link updateComponent}, which will kick off the virtual DOM re-render.
1497
+ *
1498
+ * @param hostRef a reference to a host DOM node
1499
+ * @param isInitialLoad whether we're on the initial load or not
1500
+ * @returns an empty Promise which is used to enqueue a series of operations for
1501
+ * the component
1502
+ */
1503
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1504
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1505
+ const instance = hostRef.$lazyInstance$ ;
1506
+ // We're going to use this variable together with `enqueue` to implement a
1507
+ // little promise-based queue. We start out with it `undefined`. When we add
1508
+ // the first function to the queue we'll set this variable to be that
1509
+ // function's return value. When we attempt to add subsequent values to the
1510
+ // queue we'll check that value and, if it was a `Promise`, we'll then chain
1511
+ // the new function off of that `Promise` using `.then()`. This will give our
1512
+ // queue two nice properties:
1513
+ //
1514
+ // 1. If all functions added to the queue are synchronous they'll be called
1515
+ // synchronously right away.
1516
+ // 2. If all functions added to the queue are asynchronous they'll all be
1517
+ // called in order after `dispatchHooks` exits.
1518
+ let maybePromise;
1519
+ endSchedule();
1520
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1521
+ };
1522
+ /**
1523
+ * This function uses a Promise to implement a simple first-in, first-out queue
1524
+ * of functions to be called.
1525
+ *
1526
+ * The queue is ordered on the basis of the first argument. If it's
1527
+ * `undefined`, then nothing is on the queue yet, so the provided function can
1528
+ * be called synchronously (although note that this function may return a
1529
+ * `Promise`). The idea is that then the return value of that enqueueing
1530
+ * operation is kept around, so that if it was a `Promise` then subsequent
1531
+ * functions can be enqueued by calling this function again with that `Promise`
1532
+ * as the first argument.
1533
+ *
1534
+ * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
1535
+ * @param fn a function to enqueue
1536
+ * @returns either a `Promise` or the return value of the provided function
1537
+ */
1538
+ const enqueue = (maybePromise, fn) => maybePromise instanceof Promise ? maybePromise.then(fn) : fn();
1539
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1540
+ var _a;
1541
+ const elm = hostRef.$hostElement$;
1542
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1543
+ const rc = elm['s-rc'];
1544
+ if (isInitialLoad) {
1545
+ // DOM WRITE!
1546
+ attachStyles(hostRef);
1547
+ }
1548
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1549
+ {
1550
+ callRender(hostRef, instance);
1551
+ }
1552
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
1553
+ if (plt.$cssShim$) {
1554
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
1555
+ plt.$cssShim$.updateHost(elm);
1556
+ }
1557
+ if (rc) {
1558
+ // ok, so turns out there are some child host elements
1559
+ // waiting on this parent element to load
1560
+ // let's fire off all update callbacks waiting
1561
+ rc.map((cb) => cb());
1562
+ elm['s-rc'] = undefined;
1563
+ }
1564
+ endRender();
1565
+ endUpdate();
1566
+ {
1567
+ const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
1568
+ const postUpdate = () => postUpdateComponent(hostRef);
1569
+ if (childrenPromises.length === 0) {
1570
+ postUpdate();
1571
+ }
1572
+ else {
1573
+ Promise.all(childrenPromises).then(postUpdate);
1574
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1575
+ childrenPromises.length = 0;
1576
+ }
1577
+ }
1578
+ };
1579
+ const callRender = (hostRef, instance, elm) => {
1580
+ try {
1581
+ instance = instance.render() ;
1582
+ {
1583
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1584
+ }
1585
+ {
1586
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1587
+ }
1588
+ {
1589
+ {
1590
+ // looks like we've got child nodes to render into this host element
1591
+ // or we need to update the css class/attrs on the host element
1592
+ // DOM WRITE!
1593
+ {
1594
+ renderVdom(hostRef, instance);
1595
+ }
1596
+ }
1597
+ }
1598
+ }
1599
+ catch (e) {
1600
+ consoleError(e, hostRef.$hostElement$);
1601
+ }
1602
+ return null;
1603
+ };
1604
+ const postUpdateComponent = (hostRef) => {
1605
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1606
+ const elm = hostRef.$hostElement$;
1607
+ const endPostUpdate = createTime('postUpdate', tagName);
1608
+ const instance = hostRef.$lazyInstance$ ;
1609
+ const ancestorComponent = hostRef.$ancestorComponent$;
1610
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1611
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1612
+ {
1613
+ // DOM WRITE!
1614
+ addHydratedFlag(elm);
1615
+ }
1616
+ {
1617
+ safeCall(instance, 'componentDidLoad');
1618
+ }
1619
+ endPostUpdate();
1620
+ {
1621
+ hostRef.$onReadyResolve$(elm);
1622
+ if (!ancestorComponent) {
1623
+ appDidLoad();
1624
+ }
1625
+ }
1626
+ }
1627
+ else {
1628
+ endPostUpdate();
1629
+ }
1630
+ // load events fire from bottom to top
1631
+ // the deepest elements load first then bubbles up
1632
+ {
1633
+ if (hostRef.$onRenderResolve$) {
1634
+ hostRef.$onRenderResolve$();
1635
+ hostRef.$onRenderResolve$ = undefined;
1636
+ }
1637
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1638
+ nextTick(() => scheduleUpdate(hostRef, false));
1639
+ }
1640
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1641
+ }
1642
+ // ( •_•)
1643
+ // ( •_•)>⌐■-■
1644
+ // (⌐■_■)
1645
+ };
1646
+ const appDidLoad = (who) => {
1647
+ // on appload
1648
+ // we have finish the first big initial render
1649
+ {
1650
+ addHydratedFlag(doc.documentElement);
1651
+ }
1652
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1653
+ };
1654
+ const safeCall = (instance, method, arg) => {
1655
+ if (instance && instance[method]) {
1656
+ try {
1657
+ return instance[method](arg);
1658
+ }
1659
+ catch (e) {
1660
+ consoleError(e);
1661
+ }
1662
+ }
1663
+ return undefined;
1664
+ };
1665
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1666
+ ;
1667
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1668
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1669
+ // check our new property value against our internal value
1670
+ const hostRef = getHostRef(ref);
1671
+ const elm = hostRef.$hostElement$ ;
1672
+ const oldVal = hostRef.$instanceValues$.get(propName);
1673
+ const flags = hostRef.$flags$;
1674
+ const instance = hostRef.$lazyInstance$ ;
1675
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1676
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1677
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1678
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1679
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1680
+ // gadzooks! the property's value has changed!!
1681
+ // set our new value!
1682
+ hostRef.$instanceValues$.set(propName, newVal);
1683
+ if (instance) {
1684
+ // get an array of method names of watch functions to call
1685
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1686
+ const watchMethods = cmpMeta.$watchers$[propName];
1687
+ if (watchMethods) {
1688
+ // this instance is watching for when this property changed
1689
+ watchMethods.map((watchMethodName) => {
1690
+ try {
1691
+ // fire off each of the watch methods that are watching this property
1692
+ instance[watchMethodName](newVal, oldVal, propName);
1693
+ }
1694
+ catch (e) {
1695
+ consoleError(e, elm);
1696
+ }
1697
+ });
1698
+ }
1699
+ }
1700
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1701
+ // looks like this value actually changed, so we've got work to do!
1702
+ // but only if we've already rendered, otherwise just chill out
1703
+ // queue that we need to do an update, but don't worry about queuing
1704
+ // up millions cuz this function ensures it only runs once
1705
+ scheduleUpdate(hostRef, false);
1706
+ }
1707
+ }
1708
+ }
1709
+ };
1710
+ /**
1711
+ * Attach a series of runtime constructs to a compiled Stencil component
1712
+ * constructor, including getters and setters for the `@Prop` and `@State`
1713
+ * decorators, callbacks for when attributes change, and so on.
1714
+ *
1715
+ * @param Cstr the constructor for a component that we need to process
1716
+ * @param cmpMeta metadata collected previously about the component
1717
+ * @param flags a number used to store a series of bit flags
1718
+ * @returns a reference to the same constructor passed in (but now mutated)
1719
+ */
1720
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1721
+ if (cmpMeta.$members$) {
1722
+ if (Cstr.watchers) {
1723
+ cmpMeta.$watchers$ = Cstr.watchers;
1724
+ }
1725
+ // It's better to have a const than two Object.entries()
1726
+ const members = Object.entries(cmpMeta.$members$);
1727
+ const prototype = Cstr.prototype;
1728
+ members.map(([memberName, [memberFlags]]) => {
1729
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1730
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1731
+ // proxyComponent - prop
1732
+ Object.defineProperty(prototype, memberName, {
1733
+ get() {
1734
+ // proxyComponent, get value
1735
+ return getValue(this, memberName);
1736
+ },
1737
+ set(newValue) {
1738
+ // proxyComponent, set value
1739
+ setValue(this, memberName, newValue, cmpMeta);
1740
+ },
1741
+ configurable: true,
1742
+ enumerable: true,
1743
+ });
1744
+ }
1745
+ });
1746
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1747
+ const attrNameToPropName = new Map();
1748
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1749
+ plt.jmp(() => {
1750
+ const propName = attrNameToPropName.get(attrName);
1751
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1752
+ // in the case where an attribute was set inline.
1753
+ // ```html
1754
+ // <my-component some-attribute="some-value"></my-component>
1755
+ // ```
1756
+ //
1757
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1758
+ // programmatically changes it before it has been upgraded as shown below:
1759
+ //
1760
+ // ```html
1761
+ // <!-- this component has _not_ been upgraded yet -->
1762
+ // <my-component id="test" some-attribute="some-value"></my-component>
1763
+ // <script>
1764
+ // // grab non-upgraded component
1765
+ // el = document.querySelector("#test");
1766
+ // el.someAttribute = "another-value";
1767
+ // // upgrade component
1768
+ // customElements.define('my-component', MyComponent);
1769
+ // </script>
1770
+ // ```
1771
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1772
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1773
+ // to the value that was set inline i.e. "some-value" from above example. When
1774
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1775
+ //
1776
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1777
+ // by connectedCallback as this attributeChangedCallback will not fire.
1778
+ //
1779
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1780
+ //
1781
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1782
+ // properties here given that this goes against best practices outlined here
1783
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1784
+ if (this.hasOwnProperty(propName)) {
1785
+ newValue = this[propName];
1786
+ delete this[propName];
1787
+ }
1788
+ else if (prototype.hasOwnProperty(propName) &&
1789
+ typeof this[propName] === 'number' &&
1790
+ this[propName] == newValue) {
1791
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1792
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1793
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1794
+ return;
1795
+ }
1796
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1797
+ });
1798
+ };
1799
+ // create an array of attributes to observe
1800
+ // and also create a map of html attribute name to js property name
1801
+ Cstr.observedAttributes = members
1802
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1803
+ .map(([propName, m]) => {
1804
+ const attrName = m[1] || propName;
1805
+ attrNameToPropName.set(attrName, propName);
1806
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1807
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1808
+ }
1809
+ return attrName;
1810
+ });
1811
+ }
1812
+ }
1813
+ return Cstr;
1814
+ };
1815
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1816
+ // initializeComponent
1817
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1818
+ // Let the runtime know that the component has been initialized
1819
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1820
+ {
1821
+ // lazy loaded components
1822
+ // request the component's implementation to be
1823
+ // wired up with the host element
1824
+ Cstr = loadModule(cmpMeta);
1825
+ if (Cstr.then) {
1826
+ // Await creates a micro-task avoid if possible
1827
+ const endLoad = uniqueTime();
1828
+ Cstr = await Cstr;
1829
+ endLoad();
1830
+ }
1831
+ if (!Cstr.isProxied) {
1832
+ // we've never proxied this Constructor before
1833
+ // let's add the getters/setters to its prototype before
1834
+ // the first time we create an instance of the implementation
1835
+ {
1836
+ cmpMeta.$watchers$ = Cstr.watchers;
1837
+ }
1838
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1839
+ Cstr.isProxied = true;
1840
+ }
1841
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1842
+ // ok, time to construct the instance
1843
+ // but let's keep track of when we start and stop
1844
+ // so that the getters/setters don't incorrectly step on data
1845
+ {
1846
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1847
+ }
1848
+ // construct the lazy-loaded component implementation
1849
+ // passing the hostRef is very important during
1850
+ // construction in order to directly wire together the
1851
+ // host element and the lazy-loaded instance
1852
+ try {
1853
+ new Cstr(hostRef);
1854
+ }
1855
+ catch (e) {
1856
+ consoleError(e);
1857
+ }
1858
+ {
1859
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1860
+ }
1861
+ {
1862
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1863
+ }
1864
+ endNewInstance();
1865
+ fireConnectedCallback(hostRef.$lazyInstance$);
1866
+ }
1867
+ if (Cstr.style) {
1868
+ // this component has styles but we haven't registered them yet
1869
+ let style = Cstr.style;
1870
+ const scopeId = getScopeId(cmpMeta);
1871
+ if (!styles.has(scopeId)) {
1872
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1873
+ if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
1874
+ style = await Promise.resolve().then(function () { return require('./shadow-css-8baae635.js'); }).then((m) => m.scopeCss(style, scopeId, false));
1875
+ }
1876
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1877
+ endRegisterStyles();
1878
+ }
1879
+ }
1880
+ }
1881
+ // we've successfully created a lazy instance
1882
+ const ancestorComponent = hostRef.$ancestorComponent$;
1883
+ const schedule = () => scheduleUpdate(hostRef, true);
1884
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1885
+ // this is the initial load and this component it has an ancestor component
1886
+ // but the ancestor component has NOT fired its will update lifecycle yet
1887
+ // so let's just cool our jets and wait for the ancestor to continue first
1888
+ // this will get fired off when the ancestor component
1889
+ // finally gets around to rendering its lazy self
1890
+ // fire off the initial update
1891
+ ancestorComponent['s-rc'].push(schedule);
1892
+ }
1893
+ else {
1894
+ schedule();
1895
+ }
1896
+ };
1897
+ const fireConnectedCallback = (instance) => {
1898
+ {
1899
+ safeCall(instance, 'connectedCallback');
1900
+ }
1901
+ };
1902
+ const connectedCallback = (elm) => {
1903
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1904
+ const hostRef = getHostRef(elm);
1905
+ const cmpMeta = hostRef.$cmpMeta$;
1906
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1907
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1908
+ // first time this component has connected
1909
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1910
+ let hostId;
1911
+ {
1912
+ hostId = elm.getAttribute(HYDRATE_ID);
1913
+ if (hostId) {
1914
+ if (supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1915
+ const scopeId = addStyle(elm.shadowRoot, cmpMeta);
1916
+ elm.classList.remove(scopeId + '-h', scopeId + '-s');
1917
+ }
1918
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
1919
+ }
1920
+ }
1921
+ if (!hostId) {
1922
+ // initUpdate
1923
+ // if the slot polyfill is required we'll need to put some nodes
1924
+ // in here to act as original content anchors as we move nodes around
1925
+ // host element has been connected to the DOM
1926
+ if ((// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
1927
+ cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1928
+ setContentReference(elm);
1929
+ }
1930
+ }
1931
+ {
1932
+ // find the first ancestor component (if there is one) and register
1933
+ // this component as one of the actively loading child components for its ancestor
1934
+ let ancestorComponent = elm;
1935
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1936
+ // climb up the ancestors looking for the first
1937
+ // component that hasn't finished its lifecycle update yet
1938
+ if ((ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
1939
+ ancestorComponent.hasAttribute('s-id') &&
1940
+ ancestorComponent['s-p']) ||
1941
+ ancestorComponent['s-p']) {
1942
+ // we found this components first ancestor component
1943
+ // keep a reference to this component's ancestor component
1944
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1945
+ break;
1946
+ }
1947
+ }
1948
+ }
1949
+ // Lazy properties
1950
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1951
+ if (cmpMeta.$members$) {
1952
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1953
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1954
+ const value = elm[memberName];
1955
+ delete elm[memberName];
1956
+ elm[memberName] = value;
1957
+ }
1958
+ });
1959
+ }
1960
+ {
1961
+ initializeComponent(elm, hostRef, cmpMeta);
1962
+ }
1963
+ }
1964
+ else {
1965
+ // fire off connectedCallback() on component instance
1966
+ fireConnectedCallback(hostRef.$lazyInstance$);
1967
+ }
1968
+ endConnected();
1969
+ }
1970
+ };
1971
+ const setContentReference = (elm) => {
1972
+ // only required when we're NOT using native shadow dom (slot)
1973
+ // or this browser doesn't support native shadow dom
1974
+ // and this host element was NOT created with SSR
1975
+ // let's pick out the inner content for slot projection
1976
+ // create a node to represent where the original
1977
+ // content was first placed, which is useful later on
1978
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1979
+ contentRefElm['s-cn'] = true;
1980
+ elm.insertBefore(contentRefElm, elm.firstChild);
1981
+ };
1982
+ const disconnectedCallback = (elm) => {
1983
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1984
+ const hostRef = getHostRef(elm);
1985
+ const instance = hostRef.$lazyInstance$ ;
1986
+ // clear CSS var-shim tracking
1987
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
1988
+ if (plt.$cssShim$) {
1989
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
1990
+ plt.$cssShim$.removeHost(elm);
1991
+ }
1992
+ {
1993
+ safeCall(instance, 'disconnectedCallback');
1994
+ }
1995
+ }
1996
+ };
1997
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1998
+ var _a;
1999
+ const endBootstrap = createTime();
2000
+ const cmpTags = [];
2001
+ const exclude = options.exclude || [];
2002
+ const customElements = win.customElements;
2003
+ const head = doc.head;
2004
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
2005
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
2006
+ const deferredConnectedCallbacks = [];
2007
+ const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2008
+ let appLoadFallback;
2009
+ let isBootstrapping = true;
2010
+ let i = 0;
2011
+ Object.assign(plt, options);
2012
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2013
+ {
2014
+ // If the app is already hydrated there is not point to disable the
2015
+ // async queue. This will improve the first input delay
2016
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
2017
+ }
2018
+ {
2019
+ for (; i < styles.length; i++) {
2020
+ registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
2021
+ }
2022
+ }
2023
+ lazyBundles.map((lazyBundle) => {
2024
+ lazyBundle[1].map((compactMeta) => {
2025
+ const cmpMeta = {
2026
+ $flags$: compactMeta[0],
2027
+ $tagName$: compactMeta[1],
2028
+ $members$: compactMeta[2],
2029
+ $listeners$: compactMeta[3],
2030
+ };
2031
+ {
2032
+ cmpMeta.$members$ = compactMeta[2];
2033
+ }
2034
+ {
2035
+ cmpMeta.$attrsToReflect$ = [];
2036
+ }
2037
+ {
2038
+ cmpMeta.$watchers$ = {};
2039
+ }
2040
+ if (!supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2041
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
2042
+ cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
2043
+ }
2044
+ const tagName = cmpMeta.$tagName$;
2045
+ const HostElement = class extends HTMLElement {
2046
+ // StencilLazyHost
2047
+ constructor(self) {
2048
+ // @ts-ignore
2049
+ super(self);
2050
+ self = this;
2051
+ registerHost(self, cmpMeta);
2052
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2053
+ // this component is using shadow dom
2054
+ // and this browser supports shadow dom
2055
+ // add the read-only property "shadowRoot" to the host element
2056
+ // adding the shadow root build conditionals to minimize runtime
2057
+ if (supportsShadow) {
2058
+ {
2059
+ self.attachShadow({ mode: 'open' });
2060
+ }
2061
+ }
2062
+ else if (!('shadowRoot' in self)) {
2063
+ self.shadowRoot = self;
2064
+ }
2065
+ }
2066
+ }
2067
+ connectedCallback() {
2068
+ if (appLoadFallback) {
2069
+ clearTimeout(appLoadFallback);
2070
+ appLoadFallback = null;
2071
+ }
2072
+ if (isBootstrapping) {
2073
+ // connectedCallback will be processed once all components have been registered
2074
+ deferredConnectedCallbacks.push(this);
2075
+ }
2076
+ else {
2077
+ plt.jmp(() => connectedCallback(this));
2078
+ }
2079
+ }
2080
+ disconnectedCallback() {
2081
+ plt.jmp(() => disconnectedCallback(this));
2082
+ }
2083
+ componentOnReady() {
2084
+ return getHostRef(this).$onReadyPromise$;
2085
+ }
2086
+ };
2087
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
2088
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
2089
+ cmpTags.push(tagName);
2090
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
2091
+ }
2092
+ });
2093
+ });
2094
+ {
2095
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
2096
+ visibilityStyle.setAttribute('data-styles', '');
2097
+ // Apply CSP nonce to the style tag if it exists
2098
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
2099
+ if (nonce != null) {
2100
+ visibilityStyle.setAttribute('nonce', nonce);
2101
+ }
2102
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
2103
+ }
2104
+ // Process deferred connectedCallbacks now all components have been registered
2105
+ isBootstrapping = false;
2106
+ if (deferredConnectedCallbacks.length) {
2107
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
2108
+ }
2109
+ else {
2110
+ {
2111
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
2112
+ }
2113
+ }
2114
+ // Fallback appLoad event
2115
+ endBootstrap();
2116
+ };
2117
+ /**
2118
+ * Assigns the given value to the nonce property on the runtime platform object.
2119
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
2120
+ * @param nonce The value to be assigned to the platform nonce property.
2121
+ * @returns void
2122
+ */
2123
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
2124
+ const hostRefs = /*@__PURE__*/ new WeakMap();
2125
+ const getHostRef = (ref) => hostRefs.get(ref);
2126
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
2127
+ const registerHost = (elm, cmpMeta) => {
2128
+ const hostRef = {
2129
+ $flags$: 0,
2130
+ $hostElement$: elm,
2131
+ $cmpMeta$: cmpMeta,
2132
+ $instanceValues$: new Map(),
2133
+ };
2134
+ {
2135
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
2136
+ elm['s-p'] = [];
2137
+ elm['s-rc'] = [];
2138
+ }
2139
+ return hostRefs.set(elm, hostRef);
2140
+ };
2141
+ const isMemberInElement = (elm, memberName) => memberName in elm;
2142
+ const consoleError = (e, el) => (0, console.error)(e, el);
2143
+ const cmpModules = /*@__PURE__*/ new Map();
2144
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2145
+ // loadModuleImport
2146
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
2147
+ const bundleId = cmpMeta.$lazyBundleId$;
2148
+ const module = cmpModules.get(bundleId) ;
2149
+ if (module) {
2150
+ return module[exportName];
2151
+ }
2152
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
2153
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
2154
+ /* @vite-ignore */
2155
+ /* webpackInclude: /\.entry\.js$/ */
2156
+ /* webpackExclude: /\.system\.entry\.js$/ */
2157
+ /* webpackMode: "lazy" */
2158
+ `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
2159
+ {
2160
+ cmpModules.set(bundleId, importedModule);
2161
+ }
2162
+ return importedModule[exportName];
2163
+ }, consoleError);
2164
+ };
2165
+ const styles = /*@__PURE__*/ new Map();
2166
+ const win = typeof window !== 'undefined' ? window : {};
2167
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
2168
+ const CSS = win.CSS ;
2169
+ const doc = win.document || { head: {} };
2170
+ const plt = {
2171
+ $flags$: 0,
2172
+ $resourcesUrl$: '',
2173
+ jmp: (h) => h(),
2174
+ raf: (h) => requestAnimationFrame(h),
2175
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
2176
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2177
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
2178
+ };
2179
+ const supportsShadow =
2180
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
2181
+ /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
2182
+ ;
2183
+ const promiseResolve = (v) => Promise.resolve(v);
2184
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2185
+ try {
2186
+ new CSSStyleSheet();
2187
+ return typeof new CSSStyleSheet().replaceSync === 'function';
2188
+ }
2189
+ catch (e) { }
2190
+ return false;
2191
+ })()
2192
+ ;
2193
+ const queueDomReads = [];
2194
+ const queueDomWrites = [];
2195
+ const queueTask = (queue, write) => (cb) => {
2196
+ queue.push(cb);
2197
+ if (!queuePending) {
2198
+ queuePending = true;
2199
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
2200
+ nextTick(flush);
2201
+ }
2202
+ else {
2203
+ plt.raf(flush);
2204
+ }
2205
+ }
2206
+ };
2207
+ const consume = (queue) => {
2208
+ for (let i = 0; i < queue.length; i++) {
2209
+ try {
2210
+ queue[i](performance.now());
2211
+ }
2212
+ catch (e) {
2213
+ consoleError(e);
2214
+ }
2215
+ }
2216
+ queue.length = 0;
2217
+ };
2218
+ const flush = () => {
2219
+ // always force a bunch of medium callbacks to run, but still have
2220
+ // a throttle on how many can run in a certain time
2221
+ // DOM READS!!!
2222
+ consume(queueDomReads);
2223
+ // DOM WRITES!!!
2224
+ {
2225
+ consume(queueDomWrites);
2226
+ if ((queuePending = queueDomReads.length > 0)) {
2227
+ // still more to do yet, but we've run out of time
2228
+ // let's let this thing cool off and try again in the next tick
2229
+ plt.raf(flush);
2230
+ }
2231
+ }
2232
+ };
2233
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
2234
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2235
+
2236
+ exports.CSS = CSS;
2237
+ exports.Host = Host;
2238
+ exports.bootstrapLazy = bootstrapLazy;
2239
+ exports.getElement = getElement;
2240
+ exports.h = h;
2241
+ exports.plt = plt;
2242
+ exports.promiseResolve = promiseResolve;
2243
+ exports.registerInstance = registerInstance;
2244
+ exports.setNonce = setNonce;
2245
+ exports.win = win;
2246
+
2247
+ //# sourceMappingURL=index-404d93e9.js.map