@swisspost/design-system-components 1.5.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/dist/cjs/check-non-empty-ae713942.js +13 -0
  2. package/dist/cjs/check-non-empty-ae713942.js.map +1 -0
  3. package/dist/cjs/{check-one-of-4c2e8b2e.js → check-one-of-27ad3154.js} +1 -1
  4. package/dist/cjs/check-one-of-27ad3154.js.map +1 -0
  5. package/dist/cjs/constants-238701d3.js +7 -0
  6. package/dist/cjs/constants-238701d3.js.map +1 -0
  7. package/dist/cjs/fade-35a3633a.js +12 -0
  8. package/dist/cjs/fade-35a3633a.js.map +1 -0
  9. package/dist/cjs/index-b38a23e0.js +41 -0
  10. package/dist/cjs/index-b38a23e0.js.map +1 -0
  11. package/dist/cjs/{index-12cc37c9.js → index-b619e205.js} +245 -41
  12. package/dist/cjs/index-b619e205.js.map +1 -0
  13. package/dist/cjs/index.cjs.js +26 -0
  14. package/dist/cjs/index.cjs.js.map +1 -1
  15. package/dist/cjs/loader.cjs.js +3 -12
  16. package/dist/cjs/loader.cjs.js.map +1 -1
  17. package/dist/cjs/package-7c4db872.js +7 -0
  18. package/dist/cjs/package-7c4db872.js.map +1 -0
  19. package/dist/cjs/post-accordion.cjs.entry.js +89 -0
  20. package/dist/cjs/post-accordion.cjs.entry.js.map +1 -0
  21. package/dist/cjs/post-alert-c037e6a3.js +101 -0
  22. package/dist/{post-components/p-7240ae7b.entry.js.map → cjs/post-alert-c037e6a3.js.map} +1 -1
  23. package/dist/cjs/post-alert.cjs.entry.js +9 -96
  24. package/dist/cjs/post-alert.cjs.entry.js.map +1 -1
  25. package/dist/cjs/post-collapsible-7c9d23a2.js +93 -0
  26. package/dist/cjs/post-collapsible-7c9d23a2.js.map +1 -0
  27. package/dist/cjs/post-collapsible.cjs.entry.js +7 -119
  28. package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
  29. package/dist/cjs/post-components.cjs.js +3 -6
  30. package/dist/cjs/post-components.cjs.js.map +1 -1
  31. package/dist/cjs/post-icon-f418f76a.js +105 -0
  32. package/dist/cjs/post-icon-f418f76a.js.map +1 -0
  33. package/dist/cjs/post-icon.cjs.entry.js +8 -100
  34. package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
  35. package/dist/cjs/post-tab-header-e08c2a42.js +33 -0
  36. package/dist/cjs/post-tab-header-e08c2a42.js.map +1 -0
  37. package/dist/cjs/post-tab-header.cjs.entry.js +6 -26
  38. package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -1
  39. package/dist/cjs/post-tab-panel-721f7f32.js +27 -0
  40. package/dist/cjs/post-tab-panel-721f7f32.js.map +1 -0
  41. package/dist/cjs/post-tab-panel.cjs.entry.js +4 -20
  42. package/dist/cjs/post-tab-panel.cjs.entry.js.map +1 -1
  43. package/dist/cjs/post-tabs-4bcc867b.js +153 -0
  44. package/dist/cjs/post-tabs-4bcc867b.js.map +1 -0
  45. package/dist/cjs/post-tabs.cjs.entry.js +5 -146
  46. package/dist/cjs/post-tabs.cjs.entry.js.map +1 -1
  47. package/dist/cjs/post-tooltip-261c5cda.js +5095 -0
  48. package/dist/cjs/post-tooltip-261c5cda.js.map +1 -0
  49. package/dist/cjs/post-tooltip.cjs.entry.js +5 -5088
  50. package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -1
  51. package/dist/collection/animations/collapse.js +13 -0
  52. package/dist/collection/animations/collapse.js.map +1 -0
  53. package/dist/collection/animations/fade.js +4 -4
  54. package/dist/collection/animations/fade.js.map +1 -1
  55. package/dist/collection/collection-manifest.json +10 -9
  56. package/dist/collection/components/post-accordion/post-accordion.css +1 -0
  57. package/dist/collection/components/post-accordion/post-accordion.js +178 -0
  58. package/dist/collection/components/post-accordion/post-accordion.js.map +1 -0
  59. package/dist/collection/components/post-alert/post-alert.css +1 -1
  60. package/dist/collection/components/post-alert/post-alert.js +9 -7
  61. package/dist/collection/components/post-alert/post-alert.js.map +1 -1
  62. package/dist/collection/components/post-collapsible/heading-levels.js +2 -0
  63. package/dist/collection/components/post-collapsible/heading-levels.js.map +1 -0
  64. package/dist/collection/components/post-collapsible/post-collapsible.css +1 -29
  65. package/dist/collection/components/post-collapsible/post-collapsible.js +65 -63
  66. package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -1
  67. package/dist/collection/components/post-icon/post-icon.js +5 -4
  68. package/dist/collection/components/post-icon/post-icon.js.map +1 -1
  69. package/dist/collection/components/post-tab-header/post-tab-header.css +1 -1
  70. package/dist/collection/components/post-tab-header/post-tab-header.js +5 -4
  71. package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -1
  72. package/dist/collection/components/post-tab-panel/post-tab-panel.js +2 -2
  73. package/dist/collection/components/post-tabs/post-tabs.js +11 -7
  74. package/dist/collection/components/post-tabs/post-tabs.js.map +1 -1
  75. package/dist/collection/components/post-tooltip/post-tooltip.js +22 -15
  76. package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -1
  77. package/dist/collection/index.js +8 -1
  78. package/dist/collection/index.js.map +1 -1
  79. package/dist/collection/utils/index.js +1 -3
  80. package/dist/collection/utils/index.js.map +1 -1
  81. package/dist/collection/utils/is-motion-reduced.js +4 -0
  82. package/dist/collection/utils/is-motion-reduced.js.map +1 -0
  83. package/dist/collection/utils/property-checkers/check-non-empty.js +1 -1
  84. package/dist/collection/utils/property-checkers/empty-or.js +1 -1
  85. package/dist/collection/utils/property-checkers/index.js +4 -4
  86. package/dist/components/check-non-empty.js +2 -2
  87. package/dist/components/check-non-empty.js.map +1 -1
  88. package/dist/components/check-one-of.js.map +1 -1
  89. package/dist/components/constants.js +5 -0
  90. package/dist/components/constants.js.map +1 -0
  91. package/dist/components/fade.js +4 -4
  92. package/dist/components/fade.js.map +1 -1
  93. package/dist/components/index.d.ts +6 -0
  94. package/dist/components/index.js +8 -1
  95. package/dist/components/index.js.map +1 -1
  96. package/dist/components/index2.js +36 -0
  97. package/dist/components/index2.js.map +1 -0
  98. package/dist/components/package.js +1 -1
  99. package/dist/components/post-accordion.d.ts +11 -0
  100. package/dist/components/post-accordion.js +108 -0
  101. package/dist/components/post-accordion.js.map +1 -0
  102. package/dist/components/post-alert.js +1 -128
  103. package/dist/components/post-alert.js.map +1 -1
  104. package/dist/components/post-alert2.js +138 -0
  105. package/dist/components/post-alert2.js.map +1 -0
  106. package/dist/components/post-collapsible.js +1 -146
  107. package/dist/components/post-collapsible.js.map +1 -1
  108. package/dist/components/post-collapsible2.js +117 -0
  109. package/dist/components/post-collapsible2.js.map +1 -0
  110. package/dist/components/post-icon2.js +11 -21
  111. package/dist/components/post-icon2.js.map +1 -1
  112. package/dist/components/post-tab-header.js +1 -45
  113. package/dist/components/post-tab-header.js.map +1 -1
  114. package/dist/components/post-tab-header2.js +51 -0
  115. package/dist/components/post-tab-header2.js.map +1 -0
  116. package/dist/components/post-tab-panel.js +1 -39
  117. package/dist/components/post-tab-panel.js.map +1 -1
  118. package/dist/components/post-tab-panel2.js +43 -0
  119. package/dist/components/post-tab-panel2.js.map +1 -0
  120. package/dist/components/post-tabs.js +1 -165
  121. package/dist/components/post-tabs.js.map +1 -1
  122. package/dist/components/post-tabs2.js +169 -0
  123. package/dist/components/post-tabs2.js.map +1 -0
  124. package/dist/components/post-tooltip.js +1 -5111
  125. package/dist/components/post-tooltip.js.map +1 -1
  126. package/dist/components/post-tooltip2.js +5117 -0
  127. package/dist/components/post-tooltip2.js.map +1 -0
  128. package/dist/docs.d.ts +334 -235
  129. package/dist/docs.json +458 -14
  130. package/dist/esm/check-non-empty-09c39561.js +11 -0
  131. package/dist/esm/check-non-empty-09c39561.js.map +1 -0
  132. package/dist/esm/{check-one-of-ded5e15e.js → check-one-of-74750af9.js} +1 -1
  133. package/dist/esm/check-one-of-74750af9.js.map +1 -0
  134. package/dist/esm/constants-8d548297.js +5 -0
  135. package/dist/esm/constants-8d548297.js.map +1 -0
  136. package/dist/esm/fade-7fd71785.js +9 -0
  137. package/dist/esm/fade-7fd71785.js.map +1 -0
  138. package/dist/esm/index-35921354.js +36 -0
  139. package/dist/esm/index-35921354.js.map +1 -0
  140. package/dist/esm/{index-5611074b.js → index-4eff5fc5.js} +245 -41
  141. package/dist/esm/index-4eff5fc5.js.map +1 -0
  142. package/dist/esm/index.js +14 -1
  143. package/dist/esm/index.js.map +1 -1
  144. package/dist/esm/loader.js +4 -13
  145. package/dist/esm/loader.js.map +1 -1
  146. package/dist/esm/package-3bbdb32c.js +5 -0
  147. package/dist/esm/package-3bbdb32c.js.map +1 -0
  148. package/dist/esm/post-accordion.entry.js +85 -0
  149. package/dist/esm/post-accordion.entry.js.map +1 -0
  150. package/dist/{post-components/p-7240ae7b.entry.js → esm/post-alert-5dd43c8b.js} +99 -2
  151. package/dist/esm/post-alert-5dd43c8b.js.map +1 -0
  152. package/dist/esm/post-alert.entry.js +8 -99
  153. package/dist/esm/post-alert.entry.js.map +1 -1
  154. package/dist/esm/post-collapsible-26dc2340.js +91 -0
  155. package/dist/esm/post-collapsible-26dc2340.js.map +1 -0
  156. package/dist/esm/post-collapsible.entry.js +6 -122
  157. package/dist/esm/post-collapsible.entry.js.map +1 -1
  158. package/dist/esm/post-components.js +4 -7
  159. package/dist/esm/post-components.js.map +1 -1
  160. package/dist/esm/post-icon-fb0eb8aa.js +103 -0
  161. package/dist/esm/post-icon-fb0eb8aa.js.map +1 -0
  162. package/dist/esm/post-icon.entry.js +7 -103
  163. package/dist/esm/post-icon.entry.js.map +1 -1
  164. package/dist/esm/post-tab-header-deebc551.js +31 -0
  165. package/dist/esm/post-tab-header-deebc551.js.map +1 -0
  166. package/dist/esm/post-tab-header.entry.js +5 -29
  167. package/dist/esm/post-tab-header.entry.js.map +1 -1
  168. package/dist/esm/post-tab-panel-4b820f71.js +25 -0
  169. package/dist/esm/post-tab-panel-4b820f71.js.map +1 -0
  170. package/dist/esm/post-tab-panel.entry.js +3 -23
  171. package/dist/esm/post-tab-panel.entry.js.map +1 -1
  172. package/dist/esm/post-tabs-2d8d6a33.js +151 -0
  173. package/dist/esm/post-tabs-2d8d6a33.js.map +1 -0
  174. package/dist/esm/post-tabs.entry.js +4 -149
  175. package/dist/esm/post-tabs.entry.js.map +1 -1
  176. package/dist/esm/post-tooltip-811309c5.js +5093 -0
  177. package/dist/esm/post-tooltip-811309c5.js.map +1 -0
  178. package/dist/esm/post-tooltip.entry.js +4 -5091
  179. package/dist/esm/post-tooltip.entry.js.map +1 -1
  180. package/dist/post-components/index.esm.js +1 -1
  181. package/dist/post-components/{p-8c386036.entry.js → p-01e8dfe6.js} +3 -3
  182. package/dist/post-components/p-01e8dfe6.js.map +1 -0
  183. package/dist/post-components/p-0a49c1a3.entry.js +2 -0
  184. package/dist/post-components/{p-bcc705f1.js → p-1339f8cd.js} +1 -1
  185. package/dist/post-components/p-1339f8cd.js.map +1 -0
  186. package/dist/post-components/{p-123bb6fb.entry.js → p-1a8a8ef2.js} +2 -2
  187. package/dist/post-components/p-1a8a8ef2.js.map +1 -0
  188. package/dist/post-components/p-27092ac3.entry.js +2 -0
  189. package/dist/post-components/p-27092ac3.entry.js.map +1 -0
  190. package/dist/post-components/{p-e5306504.js → p-2737eaf5.js} +1 -1
  191. package/dist/post-components/p-2737eaf5.js.map +1 -0
  192. package/dist/post-components/p-332eef46.js +2 -0
  193. package/dist/post-components/p-332eef46.js.map +1 -0
  194. package/dist/post-components/p-440193f4.js +2 -0
  195. package/dist/post-components/p-440193f4.js.map +1 -0
  196. package/dist/post-components/p-541142fd.js +2 -0
  197. package/dist/post-components/p-541142fd.js.map +1 -0
  198. package/dist/post-components/{p-0d37fe44.entry.js → p-574acdb0.js} +2 -2
  199. package/dist/post-components/p-574acdb0.js.map +1 -0
  200. package/dist/post-components/p-66460e3f.entry.js +2 -0
  201. package/dist/post-components/p-66460e3f.entry.js.map +1 -0
  202. package/dist/post-components/p-810ee105.entry.js +2 -0
  203. package/dist/post-components/p-810ee105.entry.js.map +1 -0
  204. package/dist/post-components/p-939df031.entry.js +2 -0
  205. package/dist/post-components/p-939df031.entry.js.map +1 -0
  206. package/dist/post-components/p-94b3f291.entry.js +2 -0
  207. package/dist/post-components/p-94b3f291.entry.js.map +1 -0
  208. package/dist/post-components/p-97000cb6.js +2 -0
  209. package/dist/post-components/p-97000cb6.js.map +1 -0
  210. package/dist/post-components/p-a7649277.js +3 -0
  211. package/dist/post-components/p-a7649277.js.map +1 -0
  212. package/dist/post-components/p-abd149b3.entry.js +2 -0
  213. package/dist/post-components/p-abd149b3.entry.js.map +1 -0
  214. package/dist/post-components/p-b531475e.js +2 -0
  215. package/dist/post-components/p-b531475e.js.map +1 -0
  216. package/dist/post-components/p-c6b73d6e.js +2 -0
  217. package/dist/post-components/p-c6b73d6e.js.map +1 -0
  218. package/dist/post-components/p-d4fb9f16.js +2 -0
  219. package/dist/post-components/p-d4fb9f16.js.map +1 -0
  220. package/dist/post-components/p-dfe29f7f.js +2 -0
  221. package/dist/post-components/p-dfe29f7f.js.map +1 -0
  222. package/dist/post-components/p-e9dc9039.entry.js +2 -0
  223. package/dist/post-components/p-e9dc9039.entry.js.map +1 -0
  224. package/dist/post-components/post-components.esm.js +1 -1
  225. package/dist/post-components/post-components.esm.js.map +1 -1
  226. package/dist/types/animations/collapse.d.ts +2 -0
  227. package/dist/types/components/post-accordion/post-accordion.d.ts +28 -0
  228. package/dist/types/components/post-alert/post-alert.d.ts +1 -1
  229. package/dist/types/components/post-collapsible/heading-levels.d.ts +2 -0
  230. package/dist/types/components/post-collapsible/post-collapsible.d.ts +16 -12
  231. package/dist/types/components.d.ts +79 -3
  232. package/dist/types/index.d.ts +7 -0
  233. package/dist/types/stencil-public-runtime.d.ts +38 -5
  234. package/dist/types/utils/index.d.ts +1 -3
  235. package/dist/types/utils/is-motion-reduced.d.ts +1 -0
  236. package/loader/index.d.ts +1 -1
  237. package/package.json +8 -8
  238. package/dist/cjs/check-non-empty-35b4d0b5.js +0 -14
  239. package/dist/cjs/check-non-empty-35b4d0b5.js.map +0 -1
  240. package/dist/cjs/check-one-of-4c2e8b2e.js.map +0 -1
  241. package/dist/cjs/check-type-508a21a5.js +0 -18
  242. package/dist/cjs/check-type-508a21a5.js.map +0 -1
  243. package/dist/cjs/fade-8c6d4fa7.js +0 -12
  244. package/dist/cjs/fade-8c6d4fa7.js.map +0 -1
  245. package/dist/cjs/index-12cc37c9.js.map +0 -1
  246. package/dist/cjs/index-f8f6f146.js +0 -28
  247. package/dist/cjs/index-f8f6f146.js.map +0 -1
  248. package/dist/cjs/package-112e1698.js +0 -7
  249. package/dist/cjs/package-112e1698.js.map +0 -1
  250. package/dist/collection/utils/get-element-height.js +0 -12
  251. package/dist/collection/utils/get-element-height.js.map +0 -1
  252. package/dist/collection/utils/on-transition-end.js +0 -15
  253. package/dist/collection/utils/on-transition-end.js.map +0 -1
  254. package/dist/collection/utils/should-reduce-motion.js +0 -4
  255. package/dist/collection/utils/should-reduce-motion.js.map +0 -1
  256. package/dist/components/check-type.js +0 -16
  257. package/dist/components/check-type.js.map +0 -1
  258. package/dist/esm/check-non-empty-554bdf88.js +0 -11
  259. package/dist/esm/check-non-empty-554bdf88.js.map +0 -1
  260. package/dist/esm/check-one-of-ded5e15e.js.map +0 -1
  261. package/dist/esm/check-type-18ebb4e7.js +0 -16
  262. package/dist/esm/check-type-18ebb4e7.js.map +0 -1
  263. package/dist/esm/fade-671f1489.js +0 -9
  264. package/dist/esm/fade-671f1489.js.map +0 -1
  265. package/dist/esm/index-5611074b.js.map +0 -1
  266. package/dist/esm/index-7f723686.js +0 -24
  267. package/dist/esm/index-7f723686.js.map +0 -1
  268. package/dist/esm/package-331628f1.js +0 -5
  269. package/dist/esm/package-331628f1.js.map +0 -1
  270. package/dist/esm/polyfills/css-shim.js +0 -1
  271. package/dist/post-components/p-0d37fe44.entry.js.map +0 -1
  272. package/dist/post-components/p-123bb6fb.entry.js.map +0 -1
  273. package/dist/post-components/p-15fc087f.js +0 -2
  274. package/dist/post-components/p-15fc087f.js.map +0 -1
  275. package/dist/post-components/p-65a9d1c2.entry.js +0 -2
  276. package/dist/post-components/p-65a9d1c2.entry.js.map +0 -1
  277. package/dist/post-components/p-75a7b352.js +0 -2
  278. package/dist/post-components/p-75a7b352.js.map +0 -1
  279. package/dist/post-components/p-8c386036.entry.js.map +0 -1
  280. package/dist/post-components/p-97a064da.entry.js +0 -2
  281. package/dist/post-components/p-97a064da.entry.js.map +0 -1
  282. package/dist/post-components/p-bcc705f1.js.map +0 -1
  283. package/dist/post-components/p-c8efe0ae.js +0 -2
  284. package/dist/post-components/p-c8efe0ae.js.map +0 -1
  285. package/dist/post-components/p-ccae1c68.entry.js +0 -2
  286. package/dist/post-components/p-ccae1c68.entry.js.map +0 -1
  287. package/dist/post-components/p-d94db268.js +0 -3
  288. package/dist/post-components/p-d94db268.js.map +0 -1
  289. package/dist/post-components/p-e5306504.js.map +0 -1
  290. package/dist/post-components/p-eb3ff4dc.js +0 -2
  291. package/dist/types/utils/get-element-height.d.ts +0 -3
  292. package/dist/types/utils/on-transition-end.d.ts +0 -1
  293. package/dist/types/utils/should-reduce-motion.d.ts +0 -1
  294. /package/dist/post-components/{p-eb3ff4dc.js.map → p-0a49c1a3.entry.js.map} +0 -0
@@ -0,0 +1,11 @@
1
+ import { E as EMPTY_VALUES } from './constants-8d548297.js';
2
+
3
+ function checkNonEmpty(value, error) {
4
+ if (EMPTY_VALUES.some(v => v === value)) {
5
+ throw new Error(error);
6
+ }
7
+ }
8
+
9
+ export { checkNonEmpty as c };
10
+
11
+ //# sourceMappingURL=check-non-empty-09c39561.js.map
@@ -0,0 +1 @@
1
+ {"file":"check-non-empty-09c39561.js","mappings":";;SAEgB,aAAa,CAAC,KAAc,EAAE,KAAa;EACzD,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,EAAE;IACvC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GACxB;AACH;;;;","names":[],"sources":["src/utils/property-checkers/check-non-empty.ts"],"sourcesContent":["import { EMPTY_VALUES } from './constants';\n\nexport function checkNonEmpty(value: unknown, error: string) {\n if (EMPTY_VALUES.some(v => v === value)) {\n throw new Error(error);\n }\n}\n"],"version":3}
@@ -5,4 +5,4 @@ function checkOneOf(value, possibleValues, error) {
5
5
 
6
6
  export { checkOneOf as c };
7
7
 
8
- //# sourceMappingURL=check-one-of-ded5e15e.js.map
8
+ //# sourceMappingURL=check-one-of-74750af9.js.map
@@ -0,0 +1 @@
1
+ {"file":"check-one-of-74750af9.js","mappings":"SAAgB,UAAU,CAAI,KAAQ,EAAE,cAA4B,EAAE,KAAa;EACjF,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9D;;;;","names":[],"sources":["src/utils/property-checkers/check-one-of.ts"],"sourcesContent":["export function checkOneOf<T>(value: T, possibleValues: readonly T[], error: string) {\n if (!possibleValues.includes(value)) throw new Error(error);\n}\n"],"version":3}
@@ -0,0 +1,5 @@
1
+ const EMPTY_VALUES = [undefined, null, ''];
2
+
3
+ export { EMPTY_VALUES as E };
4
+
5
+ //# sourceMappingURL=constants-8d548297.js.map
@@ -0,0 +1 @@
1
+ {"file":"constants-8d548297.js","mappings":"MAAa,YAAY,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE;;;;","names":[],"sources":["src/utils/property-checkers/constants.ts"],"sourcesContent":["export const EMPTY_VALUES = [undefined, null, ''];\n"],"version":3}
@@ -0,0 +1,9 @@
1
+ const fadeDuration = 200;
2
+ const fadedOutKeyframe = { opacity: '0' };
3
+ const fadedInKeyframe = { opacity: '1' };
4
+ const fadeIn = (el) => el.animate([fadedOutKeyframe, fadedInKeyframe], { duration: fadeDuration });
5
+ const fadeOut = (el) => el.animate([fadedInKeyframe, fadedOutKeyframe], { duration: fadeDuration });
6
+
7
+ export { fadeIn as a, fadeOut as f };
8
+
9
+ //# sourceMappingURL=fade-7fd71785.js.map
@@ -0,0 +1 @@
1
+ {"file":"fade-7fd71785.js","mappings":"AAAA,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,gBAAgB,GAAa,EAAC,OAAO,EAAE,GAAG,EAAC,CAAC;AAClD,MAAM,eAAe,GAAa,EAAC,OAAO,EAAE,GAAG,EAAC,CAAC;MAEpC,MAAM,GAAG,CAAC,EAAW,KAAgB,EAAE,CAAC,OAAO,CAC1D,CAAE,gBAAgB,EAAE,eAAe,CAAE,EACrC,EAAE,QAAQ,EAAE,YAAY,EAAE,EAC1B;MAEW,OAAO,GAAG,CAAC,EAAW,KAAgB,EAAE,CAAC,OAAO,CAC3D,CAAE,eAAe,EAAE,gBAAgB,CAAE,EACrC,EAAE,QAAQ,EAAE,YAAY,EAAE;;;;","names":[],"sources":["src/animations/fade.ts"],"sourcesContent":["const fadeDuration = 200;\nconst fadedOutKeyframe: Keyframe = {opacity: '0'};\nconst fadedInKeyframe: Keyframe = {opacity: '1'};\n\nexport const fadeIn = (el: Element): Animation => el.animate(\n [ fadedOutKeyframe, fadedInKeyframe ],\n { duration: fadeDuration }\n);\n\nexport const fadeOut = (el: Element): Animation => el.animate(\n [ fadedInKeyframe, fadedOutKeyframe ],\n { duration: fadeDuration }\n);\n"],"version":3}
@@ -0,0 +1,36 @@
1
+ import { E as EMPTY_VALUES } from './constants-8d548297.js';
2
+ import { c as checkOneOf } from './check-one-of-74750af9.js';
3
+
4
+ function emptyOr(check) {
5
+ return (...args) => {
6
+ const value = args[0];
7
+ if (!EMPTY_VALUES.some(v => v === value))
8
+ check(...args);
9
+ };
10
+ }
11
+
12
+ function checkPattern(value, pattern, errorMessage) {
13
+ if (typeof value !== 'string' || !pattern.test(value))
14
+ throw new Error(errorMessage);
15
+ }
16
+
17
+ function checkType(value, type, error) {
18
+ const typeIsArray = type === 'array';
19
+ const valueIsArray = Array.isArray(value);
20
+ if (typeIsArray || valueIsArray) {
21
+ if (valueIsArray !== typeIsArray)
22
+ throw new Error(error);
23
+ }
24
+ else {
25
+ if (typeof value !== type)
26
+ throw new Error(error);
27
+ }
28
+ }
29
+
30
+ const checkEmptyOrOneOf = emptyOr(checkOneOf);
31
+ const checkEmptyOrPattern = emptyOr(checkPattern);
32
+ const checkEmptyOrType = emptyOr(checkType);
33
+
34
+ export { checkEmptyOrPattern as a, checkEmptyOrOneOf as b, checkType as c, checkEmptyOrType as d };
35
+
36
+ //# sourceMappingURL=index-35921354.js.map
@@ -0,0 +1 @@
1
+ {"file":"index-35921354.js","mappings":";;;SAEgB,OAAO,CAAsB,KAA2B;EACtE,OAAO,CAAC,GAAG,IAAO;IAChB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC;MAAE,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;GAC1D,CAAC;AACJ;;SCPgB,YAAY,CAAC,KAAc,EAAE,OAAe,EAAE,YAAoB;EAChF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;AACvF;;SCMgB,SAAS,CAAC,KAAc,EAAE,IAAkB,EAAE,KAAa;EACzE,MAAM,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC;EACrC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;EAE1C,IAAI,WAAW,IAAI,YAAY,EAAE;IAC/B,IAAI,YAAY,KAAK,WAAW;MAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GAC1D;OAAM;IACL,IAAI,OAAO,KAAK,KAAK,IAAI;MAAE,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;GACnD;AACH;;MCZa,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE;MACxC,mBAAmB,GAAG,OAAO,CAAC,YAAY,EAAE;MAC5C,gBAAgB,GAAG,OAAO,CAAC,SAAS;;;;","names":[],"sources":["src/utils/property-checkers/empty-or.ts","src/utils/property-checkers/check-pattern.ts","src/utils/property-checkers/check-type.ts","src/utils/property-checkers/index.ts"],"sourcesContent":["import { EMPTY_VALUES } from './constants';\n\nexport function emptyOr<T extends unknown[]>(check: (...args: T) => void) {\n return (...args: T) => {\n const value = args[0];\n if (!EMPTY_VALUES.some(v => v === value)) check(...args);\n };\n}\n","export function checkPattern(value: unknown, pattern: RegExp, errorMessage: string) {\n if (typeof value !== 'string' || !pattern.test(value)) throw new Error(errorMessage);\n}\n","export type PropertyType =\n | 'boolean'\n | 'number'\n | 'string'\n | 'array'\n | 'object'\n | 'function';\n\nexport function checkType(value: unknown, type: PropertyType, error: string) {\n const typeIsArray = type === 'array';\n const valueIsArray = Array.isArray(value);\n\n if (typeIsArray || valueIsArray) {\n if (valueIsArray !== typeIsArray) throw new Error(error);\n } else {\n if (typeof value !== type) throw new Error(error);\n }\n}\n","import { emptyOr } from './empty-or';\nimport { checkOneOf } from './check-one-of';\nimport { checkPattern } from './check-pattern';\nimport { checkType } from './check-type';\n\nexport const checkEmptyOrOneOf = emptyOr(checkOneOf);\nexport const checkEmptyOrPattern = emptyOr(checkPattern);\nexport const checkEmptyOrType = emptyOr(checkType);\n\nexport * from './check-non-empty';\nexport * from './check-one-of';\nexport * from './check-pattern';\nexport * from './check-type';\n"],"version":3}
@@ -105,10 +105,10 @@ const h = (nodeName, vnodeData, ...children) => {
105
105
  };
106
106
  walk(children);
107
107
  if (vnodeData) {
108
- // normalize class / classname attributes
109
108
  if (vnodeData.key) {
110
109
  key = vnodeData.key;
111
110
  }
111
+ // normalize class / className attributes
112
112
  {
113
113
  const classData = vnodeData.className || vnodeData.class;
114
114
  if (classData) {
@@ -310,9 +310,9 @@ const registerStyle = (scopeId, cssText, allowCS) => {
310
310
  }
311
311
  styles.set(scopeId, style);
312
312
  };
313
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
313
+ const addStyle = (styleContainerNode, cmpMeta, mode) => {
314
314
  var _a;
315
- let scopeId = getScopeId(cmpMeta);
315
+ const scopeId = getScopeId(cmpMeta);
316
316
  const style = styles.get(scopeId);
317
317
  // if an element is NOT connected then getRootNode() will return the wrong root node
318
318
  // so the fallback is to always use the document for the root node in those cases
@@ -327,11 +327,8 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
327
327
  }
328
328
  if (!appliedStyles.has(scopeId)) {
329
329
  {
330
- // TODO(STENCIL-659): Remove code implementing the CSS variable shim
331
- {
332
- styleElm = doc.createElement('style');
333
- styleElm.innerHTML = style;
334
- }
330
+ styleElm = doc.createElement('style');
331
+ styleElm.innerHTML = style;
335
332
  // Apply CSP nonce to the style tag if it exists
336
333
  const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
337
334
  if (nonce != null) {
@@ -356,7 +353,6 @@ const attachStyles = (hostRef) => {
356
353
  const flags = cmpMeta.$flags$;
357
354
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
358
355
  const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
359
- // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
360
356
  if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
361
357
  // only required when we're NOT using native shadow dom (slot)
362
358
  // or this browser doesn't support native shadow dom
@@ -379,6 +375,21 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
379
375
  *
380
376
  * Modified for Stencil's compiler and vdom
381
377
  */
378
+ /**
379
+ * When running a VDom render set properties present on a VDom node onto the
380
+ * corresponding HTML element.
381
+ *
382
+ * Note that this function has special functionality for the `class`,
383
+ * `style`, `key`, and `ref` attributes, as well as event handlers (like
384
+ * `onClick`, etc). All others are just passed through as-is.
385
+ *
386
+ * @param elm the HTMLElement onto which attributes should be set
387
+ * @param memberName the name of the attribute to set
388
+ * @param oldValue the old value for the attribute
389
+ * @param newValue the new value for the attribute
390
+ * @param isSvg whether we're in an svg context or not
391
+ * @param flags bitflags for Vdom variables
392
+ */
382
393
  const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
383
394
  if (oldValue !== newValue) {
384
395
  let isProp = isMemberInElement(elm, memberName);
@@ -937,9 +948,9 @@ const patch = (oldVNode, newVNode) => {
937
948
  }
938
949
  };
939
950
  /**
940
- * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
941
- * calling them with `null`. This signals that the DOM element corresponding to
942
- * the VDom node has been removed from the DOM.
951
+ * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
952
+ * them with `null`. This signals that the DOM element corresponding to the VDom
953
+ * node has been removed from the DOM.
943
954
  *
944
955
  * @param vNode a virtual DOM node
945
956
  */
@@ -960,12 +971,39 @@ const nullifyVNodeRefs = (vNode) => {
960
971
  * @param hostRef data needed to root and render the virtual DOM tree, such as
961
972
  * the DOM node into which it should be rendered.
962
973
  * @param renderFnResults the virtual DOM nodes to be rendered
974
+ * @param isInitialLoad whether or not this is the first call after page load
963
975
  */
964
- const renderVdom = (hostRef, renderFnResults) => {
976
+ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
965
977
  const hostElm = hostRef.$hostElement$;
966
978
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
979
+ // if `renderFnResults` is a Host node then we can use it directly. If not,
980
+ // we need to call `h` again to wrap the children of our component in a
981
+ // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
982
+ // implicitly that the top-level vdom node is 1) an only child and 2)
983
+ // contains attrs that need to be set on the host element.
967
984
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
968
985
  hostTagName = hostElm.tagName;
986
+ // On the first render and *only* on the first render we want to check for
987
+ // any attributes set on the host element which are also set on the vdom
988
+ // node. If we find them, we override the value on the VDom node attrs with
989
+ // the value from the host element, which allows developers building apps
990
+ // with Stencil components to override e.g. the `role` attribute on a
991
+ // component even if it's already set on the `Host`.
992
+ if (isInitialLoad && rootVnode.$attrs$) {
993
+ for (const key of Object.keys(rootVnode.$attrs$)) {
994
+ // We have a special implementation in `setAccessor` for `style` and
995
+ // `class` which reconciles values coming from the VDom with values
996
+ // already present on the DOM element, so we don't want to override those
997
+ // attributes on the VDom tree with values from the host element if they
998
+ // are present.
999
+ //
1000
+ // Likewise, `ref` and `key` are special internal values for the Stencil
1001
+ // runtime and we don't want to override those either.
1002
+ if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
1003
+ rootVnode.$attrs$[key] = hostElm[key];
1004
+ }
1005
+ }
1006
+ }
969
1007
  rootVnode.$tag$ = null;
970
1008
  rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
971
1009
  hostRef.$vnode$ = rootVnode;
@@ -1023,6 +1061,13 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
1023
1061
  // called in order after `dispatchHooks` exits.
1024
1062
  let maybePromise;
1025
1063
  if (isInitialLoad) {
1064
+ {
1065
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1066
+ if (hostRef.$queuedListeners$) {
1067
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1068
+ hostRef.$queuedListeners$ = undefined;
1069
+ }
1070
+ }
1026
1071
  {
1027
1072
  // If `componentWillLoad` returns a `Promise` then we want to wait on
1028
1073
  // whatever's going on in that `Promise` before we launch into
@@ -1067,6 +1112,16 @@ const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.th
1067
1112
  */
1068
1113
  const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
1069
1114
  (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
1115
+ /**
1116
+ * Update a component given reference to its host elements and so on.
1117
+ *
1118
+ * @param hostRef an object containing references to the element's host node,
1119
+ * VDom nodes, and other metadata
1120
+ * @param instance a reference to the underlying host element where it will be
1121
+ * rendered
1122
+ * @param isInitialLoad whether or not this function is being called as part of
1123
+ * the first render cycle
1124
+ */
1070
1125
  const updateComponent = async (hostRef, instance, isInitialLoad) => {
1071
1126
  var _a;
1072
1127
  const elm = hostRef.$hostElement$;
@@ -1078,7 +1133,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1078
1133
  }
1079
1134
  const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1080
1135
  {
1081
- callRender(hostRef, instance);
1136
+ callRender(hostRef, instance, elm, isInitialLoad);
1082
1137
  }
1083
1138
  if (rc) {
1084
1139
  // ok, so turns out there are some child host elements
@@ -1102,8 +1157,24 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1102
1157
  }
1103
1158
  }
1104
1159
  };
1105
- const callRender = (hostRef, instance, elm) => {
1160
+ /**
1161
+ * Handle making the call to the VDom renderer with the proper context given
1162
+ * various build variables
1163
+ *
1164
+ * @param hostRef an object containing references to the element's host node,
1165
+ * VDom nodes, and other metadata
1166
+ * @param instance a reference to the underlying host element where it will be
1167
+ * rendered
1168
+ * @param elm the Host element for the component
1169
+ * @param isInitialLoad whether or not this function is being called as part of
1170
+ * @returns an empty promise
1171
+ */
1172
+ const callRender = (hostRef, instance, elm, isInitialLoad) => {
1106
1173
  try {
1174
+ /**
1175
+ * minification optimization: `allRenderFn` is `true` if all components have a `render`
1176
+ * method, so we can call the method immediately. If not, check before calling it.
1177
+ */
1107
1178
  instance = instance.render() ;
1108
1179
  {
1109
1180
  hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
@@ -1117,7 +1188,7 @@ const callRender = (hostRef, instance, elm) => {
1117
1188
  // or we need to update the css class/attrs on the host element
1118
1189
  // DOM WRITE!
1119
1190
  {
1120
- renderVdom(hostRef, instance);
1191
+ renderVdom(hostRef, instance, isInitialLoad);
1121
1192
  }
1122
1193
  }
1123
1194
  }
@@ -1180,6 +1251,16 @@ const appDidLoad = (who) => {
1180
1251
  }
1181
1252
  nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1182
1253
  };
1254
+ /**
1255
+ * Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
1256
+ * e.g. custom element node. If a build figures out that e.g. no component
1257
+ * has a `componentDidLoad` method, the instance method gets removed from the
1258
+ * output bundle and this function returns `undefined`.
1259
+ * @param instance any object that may or may not contain methods
1260
+ * @param method method name
1261
+ * @param arg single arbitrary argument
1262
+ * @returns result of method call if it exists, otherwise `undefined`
1263
+ */
1183
1264
  const safeCall = (instance, method, arg) => {
1184
1265
  if (instance && instance[method]) {
1185
1266
  try {
@@ -1247,6 +1328,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1247
1328
  * @returns a reference to the same constructor passed in (but now mutated)
1248
1329
  */
1249
1330
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1331
+ var _a;
1250
1332
  if (cmpMeta.$members$) {
1251
1333
  if (Cstr.watchers) {
1252
1334
  cmpMeta.$watchers$ = Cstr.watchers;
@@ -1284,7 +1366,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1284
1366
  });
1285
1367
  if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1286
1368
  const attrNameToPropName = new Map();
1287
- prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1369
+ prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
1288
1370
  plt.jmp(() => {
1289
1371
  const propName = attrNameToPropName.get(attrName);
1290
1372
  // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
@@ -1307,12 +1389,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1307
1389
  // customElements.define('my-component', MyComponent);
1308
1390
  // </script>
1309
1391
  // ```
1310
- // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1392
+ // In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
1311
1393
  // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1312
1394
  // to the value that was set inline i.e. "some-value" from above example. When
1313
- // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1395
+ // the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
1314
1396
  //
1315
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1397
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
1316
1398
  // by connectedCallback as this attributeChangedCallback will not fire.
1317
1399
  //
1318
1400
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
@@ -1332,23 +1414,62 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1332
1414
  // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1333
1415
  return;
1334
1416
  }
1417
+ else if (propName == null) {
1418
+ // At this point we should know this is not a "member", so we can treat it like watching an attribute
1419
+ // on a vanilla web component
1420
+ const hostRef = getHostRef(this);
1421
+ const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
1422
+ // We only want to trigger the callback(s) if:
1423
+ // 1. The instance is ready
1424
+ // 2. The watchers are ready
1425
+ // 3. The value has changed
1426
+ if (!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
1427
+ flags & 128 /* HOST_FLAGS.isWatchReady */ &&
1428
+ newValue !== oldValue) {
1429
+ const instance = hostRef.$lazyInstance$ ;
1430
+ const entry = cmpMeta.$watchers$[attrName];
1431
+ entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
1432
+ if (instance[callbackName] != null) {
1433
+ instance[callbackName].call(instance, newValue, oldValue, attrName);
1434
+ }
1435
+ });
1436
+ }
1437
+ return;
1438
+ }
1335
1439
  this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1336
1440
  });
1337
1441
  };
1338
- // create an array of attributes to observe
1339
- // and also create a map of html attribute name to js property name
1340
- Cstr.observedAttributes = members
1341
- .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1342
- .map(([propName, m]) => {
1343
- const attrName = m[1] || propName;
1344
- attrNameToPropName.set(attrName, propName);
1345
- return attrName;
1346
- });
1442
+ // Create an array of attributes to observe
1443
+ // This list in comprised of all strings used within a `@Watch()` decorator
1444
+ // on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
1445
+ // As such, there is no way to guarantee type-safety here that a user hasn't entered
1446
+ // an invalid attribute.
1447
+ Cstr.observedAttributes = Array.from(new Set([
1448
+ ...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
1449
+ ...members
1450
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
1451
+ .map(([propName, m]) => {
1452
+ const attrName = m[1] || propName;
1453
+ attrNameToPropName.set(attrName, propName);
1454
+ return attrName;
1455
+ }),
1456
+ ]));
1347
1457
  }
1348
1458
  }
1349
1459
  return Cstr;
1350
1460
  };
1351
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1461
+ /**
1462
+ * Initialize a Stencil component given a reference to its host element, its
1463
+ * runtime bookkeeping data structure, runtime metadata about the component,
1464
+ * and (optionally) an HMR version ID.
1465
+ *
1466
+ * @param elm a host element
1467
+ * @param hostRef the element's runtime bookkeeping object
1468
+ * @param cmpMeta runtime metadata for the Stencil component
1469
+ * @param hmrVersionId an (optional) HMR version ID
1470
+ */
1471
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1472
+ let Cstr;
1352
1473
  // initializeComponent
1353
1474
  if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1354
1475
  // Let the runtime know that the component has been initialized
@@ -1471,18 +1592,40 @@ const connectedCallback = (elm) => {
1471
1592
  }
1472
1593
  }
1473
1594
  else {
1595
+ // not the first time this has connected
1596
+ // reattach any event listeners to the host
1597
+ // since they would have been removed when disconnected
1598
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1474
1599
  // fire off connectedCallback() on component instance
1475
- fireConnectedCallback(hostRef.$lazyInstance$);
1600
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
1601
+ fireConnectedCallback(hostRef.$lazyInstance$);
1602
+ }
1603
+ else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1604
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
1605
+ }
1476
1606
  }
1477
1607
  endConnected();
1478
1608
  }
1479
1609
  };
1480
- const disconnectedCallback = (elm) => {
1610
+ const disconnectInstance = (instance) => {
1611
+ {
1612
+ safeCall(instance, 'disconnectedCallback');
1613
+ }
1614
+ };
1615
+ const disconnectedCallback = async (elm) => {
1481
1616
  if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1482
1617
  const hostRef = getHostRef(elm);
1483
- const instance = hostRef.$lazyInstance$ ;
1484
1618
  {
1485
- safeCall(instance, 'disconnectedCallback');
1619
+ if (hostRef.$rmListeners$) {
1620
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1621
+ hostRef.$rmListeners$ = undefined;
1622
+ }
1623
+ }
1624
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
1625
+ disconnectInstance(hostRef.$lazyInstance$);
1626
+ }
1627
+ else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1628
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
1486
1629
  }
1487
1630
  }
1488
1631
  };
@@ -1502,6 +1645,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1502
1645
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1503
1646
  lazyBundles.map((lazyBundle) => {
1504
1647
  lazyBundle[1].map((compactMeta) => {
1648
+ var _a;
1505
1649
  const cmpMeta = {
1506
1650
  $flags$: compactMeta[0],
1507
1651
  $tagName$: compactMeta[1],
@@ -1512,7 +1656,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1512
1656
  cmpMeta.$members$ = compactMeta[2];
1513
1657
  }
1514
1658
  {
1515
- cmpMeta.$watchers$ = {};
1659
+ cmpMeta.$listeners$ = compactMeta[3];
1660
+ }
1661
+ {
1662
+ cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
1516
1663
  }
1517
1664
  const tagName = cmpMeta.$tagName$;
1518
1665
  const HostElement = class extends HTMLElement {
@@ -1584,6 +1731,35 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1584
1731
  // Fallback appLoad event
1585
1732
  endBootstrap();
1586
1733
  };
1734
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1735
+ if (listeners) {
1736
+ listeners.map(([flags, name, method]) => {
1737
+ const target = elm;
1738
+ const handler = hostListenerProxy(hostRef, method);
1739
+ const opts = hostListenerOpts(flags);
1740
+ plt.ael(target, name, handler, opts);
1741
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1742
+ });
1743
+ }
1744
+ };
1745
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1746
+ try {
1747
+ {
1748
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1749
+ // instance is ready, let's call it's member method for this event
1750
+ hostRef.$lazyInstance$[methodName](ev);
1751
+ }
1752
+ else {
1753
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1754
+ }
1755
+ }
1756
+ }
1757
+ catch (e) {
1758
+ consoleError(e);
1759
+ }
1760
+ };
1761
+ // prettier-ignore
1762
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1587
1763
  /**
1588
1764
  * Assigns the given value to the nonce property on the runtime platform object.
1589
1765
  * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
@@ -1591,13 +1767,40 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1591
1767
  * @returns void
1592
1768
  */
1593
1769
  const setNonce = (nonce) => (plt.$nonce$ = nonce);
1770
+ /**
1771
+ * A WeakMap mapping runtime component references to their corresponding host reference
1772
+ * instances.
1773
+ */
1594
1774
  const hostRefs = /*@__PURE__*/ new WeakMap();
1775
+ /**
1776
+ * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
1777
+ *
1778
+ * @param ref the runtime ref of interest
1779
+ * @returns the Host reference (if found) or undefined
1780
+ */
1595
1781
  const getHostRef = (ref) => hostRefs.get(ref);
1782
+ /**
1783
+ * Register a lazy instance with the {@link hostRefs} object so it's
1784
+ * corresponding {@link d.HostRef} can be retrieved later.
1785
+ *
1786
+ * @param lazyInstance the lazy instance of interest
1787
+ * @param hostRef that instances `HostRef` object
1788
+ * @returns a reference to the host ref WeakMap
1789
+ */
1596
1790
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1597
- const registerHost = (elm, cmpMeta) => {
1791
+ /**
1792
+ * Register a host element for a Stencil component, setting up various metadata
1793
+ * and callbacks based on {@link BUILD} flags as well as the component's runtime
1794
+ * metadata.
1795
+ *
1796
+ * @param hostElement the host element to register
1797
+ * @param cmpMeta runtime metadata for that component
1798
+ * @returns a reference to the host ref WeakMap
1799
+ */
1800
+ const registerHost = (hostElement, cmpMeta) => {
1598
1801
  const hostRef = {
1599
1802
  $flags$: 0,
1600
- $hostElement$: elm,
1803
+ $hostElement$: hostElement,
1601
1804
  $cmpMeta$: cmpMeta,
1602
1805
  $instanceValues$: new Map(),
1603
1806
  };
@@ -1606,10 +1809,11 @@ const registerHost = (elm, cmpMeta) => {
1606
1809
  }
1607
1810
  {
1608
1811
  hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1609
- elm['s-p'] = [];
1610
- elm['s-rc'] = [];
1812
+ hostElement['s-p'] = [];
1813
+ hostElement['s-rc'] = [];
1611
1814
  }
1612
- return hostRefs.set(elm, hostRef);
1815
+ addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
1816
+ return hostRefs.set(hostElement, hostRef);
1613
1817
  };
1614
1818
  const isMemberInElement = (elm, memberName) => memberName in elm;
1615
1819
  const consoleError = (e, el) => (0, console.error)(e, el);
@@ -1702,4 +1906,4 @@ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1702
1906
 
1703
1907
  export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1704
1908
 
1705
- //# sourceMappingURL=index-5611074b.js.map
1909
+ //# sourceMappingURL=index-4eff5fc5.js.map