@usecapsule/core-components 1.0.0

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