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