@rededor/cura 0.4.6 → 0.5.0-alpha.0

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