@swisspost/design-system-components 10.7.0 → 10.9.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 (333) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/{create-validator-decorator-D7nAb9KJ.js → create-validator-decorator-DVm_SDrR.js} +1 -1
  3. package/dist/cjs/{index-DWIlRT6N.js → index-DY4QxKNv.js} +5 -5
  4. package/dist/cjs/is-focus-visible-B3CqVQsX.js +19 -0
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/{one-of-B8RUgrZk.js → one-of-qu7_EPxf.js} +1 -1
  7. package/dist/cjs/{package-BtKYhTNj.js → package-kgRYEtTJ.js} +1 -1
  8. package/dist/cjs/{pattern-B6VoDk_m.js → pattern-EpwCKMyC.js} +1 -1
  9. package/dist/cjs/post-accordion_2.cjs.entry.js +6 -6
  10. package/dist/cjs/post-autocomplete.cjs.entry.js +5 -5
  11. package/dist/cjs/post-avatar.cjs.entry.js +85 -61
  12. package/dist/cjs/post-back-to-top.cjs.entry.js +6 -6
  13. package/dist/cjs/post-banner.cjs.entry.js +5 -5
  14. package/dist/cjs/post-breadcrumb-item.cjs.entry.js +8 -8
  15. package/dist/cjs/post-breadcrumbs.cjs.entry.js +7 -7
  16. package/dist/cjs/post-closebutton_14.cjs.entry.js +545 -607
  17. package/dist/cjs/post-collapsible_2.cjs.entry.js +13 -7
  18. package/dist/cjs/post-components.cjs.js +2 -2
  19. package/dist/cjs/post-date-picker.cjs.entry.js +24 -9
  20. package/dist/cjs/post-footer.cjs.entry.js +6 -6
  21. package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
  22. package/dist/cjs/post-listbox-option.cjs.entry.js +4 -4
  23. package/dist/cjs/post-listbox.cjs.entry.js +4 -4
  24. package/dist/cjs/post-number-input.cjs.entry.js +5 -5
  25. package/dist/cjs/post-pagination.cjs.entry.js +6 -6
  26. package/dist/cjs/post-popover-trigger.cjs.entry.js +5 -5
  27. package/dist/cjs/post-popover.cjs.entry.js +9 -9
  28. package/dist/cjs/post-progressbar.cjs.entry.js +4 -4
  29. package/dist/cjs/post-rating.cjs.entry.js +6 -6
  30. package/dist/cjs/post-side-navigation-trigger.cjs.entry.js +6 -6
  31. package/dist/cjs/post-side-navigation.cjs.entry.js +14 -9
  32. package/dist/cjs/post-stepper-item.cjs.entry.js +3 -3
  33. package/dist/cjs/post-stepper.cjs.entry.js +7 -7
  34. package/dist/cjs/post-tab-item.cjs.entry.js +6 -6
  35. package/dist/cjs/post-tab-panel.cjs.entry.js +6 -6
  36. package/dist/cjs/post-tabs.cjs.entry.js +37 -9
  37. package/dist/cjs/post-tooltip-trigger.cjs.entry.js +6 -6
  38. package/dist/cjs/post-tooltip.cjs.entry.js +8 -6
  39. package/dist/cjs/{required-bXtlqqaA.js → required-Dgzo-rb5.js} +1 -1
  40. package/dist/cjs/{type-BqLE7Uui.js → type-DBRxpBZI.js} +1 -1
  41. package/dist/cjs/{url-CUy3C3sH.js → url-Dl1JABeP.js} +1 -1
  42. package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
  43. package/dist/collection/components/post-avatar/avatar-utils.js +1 -2
  44. package/dist/collection/components/post-avatar/post-avatar.js +77 -59
  45. package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -1
  46. package/dist/collection/components/post-banner/post-banner.css +1 -1
  47. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -1
  48. package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.css +1 -1
  49. package/dist/collection/components/post-closebutton/post-closebutton.css +1 -1
  50. package/dist/collection/components/post-collapsible/post-collapsible.js +9 -3
  51. package/dist/collection/components/post-date-picker/post-date-picker.css +1 -1
  52. package/dist/collection/components/post-date-picker/post-date-picker.js +18 -3
  53. package/dist/collection/components/post-footer/post-footer.css +1 -1
  54. package/dist/collection/components/post-header/post-header.css +1 -1
  55. package/dist/collection/components/post-header/post-header.js +100 -18
  56. package/dist/collection/components/post-icon/post-icon.css +1 -1
  57. package/dist/collection/components/post-icon/post-icon.js +1 -2
  58. package/dist/collection/components/post-language-menu/post-language-menu.css +1 -1
  59. package/dist/collection/components/post-language-menu/post-language-menu.js +2 -2
  60. package/dist/collection/components/post-linkarea/post-linkarea.js +1 -1
  61. package/dist/collection/components/post-listbox/post-listbox.css +1 -1
  62. package/dist/collection/components/post-listbox/post-listbox.js +1 -1
  63. package/dist/collection/components/post-listbox-option/post-listbox-option.js +2 -2
  64. package/dist/collection/components/post-logo/post-logo.css +1 -1
  65. package/dist/collection/components/post-logo/post-logo.js +1 -1
  66. package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
  67. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +1 -1
  68. package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
  69. package/dist/collection/components/post-megadropdown/post-megadropdown.js +34 -16
  70. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -1
  71. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +1 -1
  72. package/dist/collection/components/post-menu/post-menu.css +1 -1
  73. package/dist/collection/components/post-menu/post-menu.js +3 -14
  74. package/dist/collection/components/post-menu-item/post-menu-item.css +1 -1
  75. package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +1 -1
  76. package/dist/collection/components/post-number-input/post-number-input.css +2 -2
  77. package/dist/collection/components/post-number-input/post-number-input.js +2 -2
  78. package/dist/collection/components/post-pagination/post-pagination.css +1 -1
  79. package/dist/collection/components/post-popover/post-popover.css +1 -1
  80. package/dist/collection/components/post-popover/post-popover.js +2 -2
  81. package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +1 -1
  82. package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
  83. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +211 -323
  84. package/dist/collection/components/post-progressbar/post-progressbar.js +1 -1
  85. package/dist/collection/components/post-rating/post-rating.js +1 -1
  86. package/dist/collection/components/post-side-navigation/post-side-navigation.css +1 -1
  87. package/dist/collection/components/post-side-navigation/post-side-navigation.js +7 -3
  88. package/dist/collection/components/post-side-navigation-trigger/post-side-navigation-trigger.js +1 -1
  89. package/dist/collection/components/post-stepper/post-stepper.js +1 -1
  90. package/dist/collection/components/post-stepper-item/post-stepper-item.js +1 -1
  91. package/dist/collection/components/post-tab-item/post-tab-item.js +2 -2
  92. package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
  93. package/dist/collection/components/post-tabs/post-tabs.css +1 -1
  94. package/dist/collection/components/post-tabs/post-tabs.js +31 -3
  95. package/dist/collection/components/post-togglebutton/post-togglebutton.js +1 -1
  96. package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
  97. package/dist/collection/components/post-tooltip/post-tooltip.js +3 -1
  98. package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +1 -1
  99. package/dist/collection/test-setup.js +28 -0
  100. package/dist/collection/utils/floating-ui/middleware/flip.js +77 -0
  101. package/dist/collection/utils/floating-ui/middleware/safe-space.js +52 -0
  102. package/dist/collection/utils/floating-ui/util.js +10 -0
  103. package/dist/collection/utils/index.js +1 -0
  104. package/dist/collection/utils/is-focus-visible.js +15 -0
  105. package/dist/components/is-focus-visible.js +1 -0
  106. package/dist/components/package.js +1 -1
  107. package/dist/components/post-accordion-item2.js +1 -1
  108. package/dist/components/post-avatar.js +1 -1
  109. package/dist/components/post-back-to-top.js +1 -1
  110. package/dist/components/post-banner.js +1 -1
  111. package/dist/components/post-breadcrumb-item.js +1 -1
  112. package/dist/components/post-breadcrumbs.js +1 -1
  113. package/dist/components/post-closebutton2.js +1 -1
  114. package/dist/components/post-collapsible2.js +1 -1
  115. package/dist/components/post-date-picker.js +1 -1
  116. package/dist/components/post-footer.js +1 -1
  117. package/dist/components/post-header.js +1 -1
  118. package/dist/components/post-icon2.js +1 -1
  119. package/dist/components/post-language-menu.js +1 -1
  120. package/dist/components/post-linkarea.js +1 -1
  121. package/dist/components/post-listbox-option.js +1 -1
  122. package/dist/components/post-listbox.js +1 -1
  123. package/dist/components/post-logo.js +1 -1
  124. package/dist/components/post-mainnavigation.js +1 -1
  125. package/dist/components/post-megadropdown-trigger.js +1 -1
  126. package/dist/components/post-megadropdown.js +1 -1
  127. package/dist/components/post-menu-item2.js +1 -1
  128. package/dist/components/post-menu-trigger2.js +1 -1
  129. package/dist/components/post-menu2.js +1 -1
  130. package/dist/components/post-number-input.js +1 -1
  131. package/dist/components/post-pagination.js +1 -1
  132. package/dist/components/post-popover-trigger.js +1 -1
  133. package/dist/components/post-popover.js +1 -1
  134. package/dist/components/post-popovercontainer2.js +1 -1
  135. package/dist/components/post-progressbar.js +1 -1
  136. package/dist/components/post-rating.js +1 -1
  137. package/dist/components/post-side-navigation-trigger.js +1 -1
  138. package/dist/components/post-side-navigation.js +1 -1
  139. package/dist/components/post-stepper-item.js +1 -1
  140. package/dist/components/post-stepper.js +1 -1
  141. package/dist/components/post-tab-item.js +1 -1
  142. package/dist/components/post-tab-panel.js +1 -1
  143. package/dist/components/post-tabs.js +1 -1
  144. package/dist/components/post-togglebutton2.js +1 -1
  145. package/dist/components/post-tooltip-trigger.js +1 -1
  146. package/dist/components/post-tooltip.js +1 -1
  147. package/dist/components/react/index.js +1 -1
  148. package/dist/components/react/p-BWwWKRO5.js +1 -0
  149. package/dist/components/react/p-CAL337jJ.js +1 -0
  150. package/dist/components/react/p-CBVthgj-.js +1 -0
  151. package/dist/components/react/{p-DS46v3ju.js → p-CLkb55ud.js} +1 -1
  152. package/dist/components/react/{p-C8_zqgAP.js → p-CYBXVnUJ.js} +1 -1
  153. package/dist/components/react/p-Ci-TsJYj.js +1 -0
  154. package/dist/components/react/p-CtgMQs_Q.js +1 -0
  155. package/dist/components/react/p-D4LBzsbB.js +1 -0
  156. package/dist/components/react/p-D5lqOfVk.js +1 -0
  157. package/dist/components/react/p-DGpWjdFJ.js +1 -0
  158. package/dist/components/react/{p-BBv5JYsW.js → p-DSk0Nq8U.js} +1 -1
  159. package/dist/components/react/{p-1y1rv5Tw.js → p-Db3d6dKF.js} +1 -1
  160. package/dist/components/react/p-DkDIUTRi.js +1 -0
  161. package/dist/components/react/post-accordion-item.js +1 -1
  162. package/dist/components/react/post-accordion.js +1 -1
  163. package/dist/components/react/post-autocomplete.js +1 -1
  164. package/dist/components/react/post-avatar.js +1 -1
  165. package/dist/components/react/post-back-to-top.js +1 -1
  166. package/dist/components/react/post-banner.js +1 -1
  167. package/dist/components/react/post-breadcrumb-item.js +1 -1
  168. package/dist/components/react/post-breadcrumbs.js +1 -1
  169. package/dist/components/react/post-closebutton.js +1 -1
  170. package/dist/components/react/post-collapsible-trigger.js +1 -1
  171. package/dist/components/react/post-collapsible.js +1 -1
  172. package/dist/components/react/post-date-picker.js +1 -1
  173. package/dist/components/react/post-footer.js +1 -1
  174. package/dist/components/react/post-header.js +1 -1
  175. package/dist/components/react/post-icon.js +1 -1
  176. package/dist/components/react/post-language-menu-item.js +1 -1
  177. package/dist/components/react/post-language-menu.js +1 -1
  178. package/dist/components/react/post-linkarea.js +1 -1
  179. package/dist/components/react/post-listbox-option.js +1 -1
  180. package/dist/components/react/post-listbox.js +1 -1
  181. package/dist/components/react/post-logo.js +1 -1
  182. package/dist/components/react/post-mainnavigation.js +1 -1
  183. package/dist/components/react/post-megadropdown-trigger.js +1 -1
  184. package/dist/components/react/post-megadropdown.js +1 -1
  185. package/dist/components/react/post-menu-item.js +1 -1
  186. package/dist/components/react/post-menu-trigger.js +1 -1
  187. package/dist/components/react/post-menu.js +1 -1
  188. package/dist/components/react/post-number-input.js +1 -1
  189. package/dist/components/react/post-pagination.js +1 -1
  190. package/dist/components/react/post-popover-trigger.js +1 -1
  191. package/dist/components/react/post-popover.js +1 -1
  192. package/dist/components/react/post-popovercontainer.js +1 -1
  193. package/dist/components/react/post-progressbar.js +1 -1
  194. package/dist/components/react/post-rating.js +1 -1
  195. package/dist/components/react/post-side-navigation-trigger.js +1 -1
  196. package/dist/components/react/post-side-navigation.js +1 -1
  197. package/dist/components/react/post-stepper-item.js +1 -1
  198. package/dist/components/react/post-stepper.js +1 -1
  199. package/dist/components/react/post-tab-item.js +1 -1
  200. package/dist/components/react/post-tab-panel.js +1 -1
  201. package/dist/components/react/post-tabs.js +1 -1
  202. package/dist/components/react/post-togglebutton.js +1 -1
  203. package/dist/components/react/post-tooltip-trigger.js +1 -1
  204. package/dist/components/react/post-tooltip.js +1 -1
  205. package/dist/docs.json +67 -45
  206. package/dist/esm/{create-validator-decorator-DFpQtJzK.js → create-validator-decorator-Cp_NUmrr.js} +1 -1
  207. package/dist/esm/{index-Bs0zeM5Q.js → index-D0jX3Fts.js} +5 -5
  208. package/dist/esm/is-focus-visible-BWwWKRO5.js +17 -0
  209. package/dist/esm/loader.js +3 -3
  210. package/dist/esm/{one-of-DQCfaZpw.js → one-of-B9locHPx.js} +1 -1
  211. package/dist/esm/{package-BBz9PVf0.js → package-CAL337jJ.js} +1 -1
  212. package/dist/esm/{pattern-3lnaFlkk.js → pattern-BL3OBU8C.js} +1 -1
  213. package/dist/esm/post-accordion_2.entry.js +6 -6
  214. package/dist/esm/post-autocomplete.entry.js +5 -5
  215. package/dist/esm/post-avatar.entry.js +85 -61
  216. package/dist/esm/post-back-to-top.entry.js +6 -6
  217. package/dist/esm/post-banner.entry.js +5 -5
  218. package/dist/esm/post-breadcrumb-item.entry.js +8 -8
  219. package/dist/esm/post-breadcrumbs.entry.js +7 -7
  220. package/dist/esm/post-closebutton_14.entry.js +545 -607
  221. package/dist/esm/post-collapsible_2.entry.js +13 -7
  222. package/dist/esm/post-components.js +3 -3
  223. package/dist/esm/post-date-picker.entry.js +24 -9
  224. package/dist/esm/post-footer.entry.js +6 -6
  225. package/dist/esm/post-linkarea.entry.js +3 -3
  226. package/dist/esm/post-listbox-option.entry.js +4 -4
  227. package/dist/esm/post-listbox.entry.js +4 -4
  228. package/dist/esm/post-number-input.entry.js +5 -5
  229. package/dist/esm/post-pagination.entry.js +6 -6
  230. package/dist/esm/post-popover-trigger.entry.js +5 -5
  231. package/dist/esm/post-popover.entry.js +9 -9
  232. package/dist/esm/post-progressbar.entry.js +4 -4
  233. package/dist/esm/post-rating.entry.js +6 -6
  234. package/dist/esm/post-side-navigation-trigger.entry.js +6 -6
  235. package/dist/esm/post-side-navigation.entry.js +14 -9
  236. package/dist/esm/post-stepper-item.entry.js +3 -3
  237. package/dist/esm/post-stepper.entry.js +7 -7
  238. package/dist/esm/post-tab-item.entry.js +6 -6
  239. package/dist/esm/post-tab-panel.entry.js +6 -6
  240. package/dist/esm/post-tabs.entry.js +37 -9
  241. package/dist/esm/post-tooltip-trigger.entry.js +6 -6
  242. package/dist/esm/post-tooltip.entry.js +8 -6
  243. package/dist/esm/{required-NuzPg5jZ.js → required-CDaQB1gC.js} +1 -1
  244. package/dist/esm/{type-ChnksJ25.js → type-CQ7XuPCZ.js} +1 -1
  245. package/dist/esm/{url-BCk3ZU-x.js → url-B-86gtTK.js} +1 -1
  246. package/dist/post-components/{p-63e570c4.entry.js → p-077be898.entry.js} +1 -1
  247. package/dist/post-components/{p-6a2f47af.entry.js → p-184bd61c.entry.js} +1 -1
  248. package/dist/post-components/p-1933e4fa.entry.js +1 -0
  249. package/dist/post-components/p-21e6f82a.entry.js +1 -0
  250. package/dist/post-components/{p-c2de3702.entry.js → p-2220db4c.entry.js} +1 -1
  251. package/dist/post-components/p-2aff3873.entry.js +1 -0
  252. package/dist/post-components/p-2b475cd7.entry.js +1 -0
  253. package/dist/post-components/p-33a898ec.entry.js +1 -0
  254. package/dist/post-components/p-405c1fff.entry.js +1 -0
  255. package/dist/post-components/{p-bd128657.entry.js → p-5efaca25.entry.js} +1 -1
  256. package/dist/post-components/p-6a9661d9.entry.js +1 -0
  257. package/dist/post-components/{p-f275b872.entry.js → p-7dd192b3.entry.js} +1 -1
  258. package/dist/post-components/p-8e5052d5.entry.js +1 -0
  259. package/dist/post-components/p-9440738d.entry.js +1 -0
  260. package/dist/post-components/{p-31550a50.entry.js → p-965a02fb.entry.js} +1 -1
  261. package/dist/post-components/{p-61a45246.entry.js → p-9740719e.entry.js} +1 -1
  262. package/dist/post-components/p-9af8f5af.entry.js +1 -0
  263. package/dist/post-components/{p-DeUk3rcv.js → p-BCPv4bcY.js} +1 -1
  264. package/dist/post-components/p-BWwWKRO5.js +1 -0
  265. package/dist/post-components/p-CAL337jJ.js +1 -0
  266. package/dist/post-components/{p-D1s6tESz.js → p-CP3LjuFR.js} +1 -1
  267. package/dist/post-components/p-D0jX3Fts.js +2 -0
  268. package/dist/post-components/{p-Bl-_v3aT.js → p-D6mVqZLg.js} +1 -1
  269. package/dist/post-components/{p-BwhzbRIR.js → p-DSaWK_q-.js} +1 -1
  270. package/dist/post-components/p-VPHnF9fB.js +1 -0
  271. package/dist/post-components/p-a6971c1c.entry.js +1 -0
  272. package/dist/post-components/p-a7d8f328.entry.js +1 -0
  273. package/dist/post-components/{p-f784e149.entry.js → p-bb9a0e1e.entry.js} +1 -1
  274. package/dist/post-components/{p-e6a4146b.entry.js → p-bf8c7dca.entry.js} +1 -1
  275. package/dist/post-components/p-c3351def.entry.js +1 -0
  276. package/dist/post-components/{p-31a97aae.entry.js → p-c87f33f0.entry.js} +1 -1
  277. package/dist/post-components/{p-64480e3a.entry.js → p-e30b534d.entry.js} +1 -1
  278. package/dist/post-components/{p-43240818.entry.js → p-e73eabac.entry.js} +1 -1
  279. package/dist/post-components/{p-f566768e.entry.js → p-e84fe883.entry.js} +1 -1
  280. package/dist/post-components/{p-aa33141b.entry.js → p-eaa28736.entry.js} +1 -1
  281. package/dist/post-components/{p-451ec8ee.entry.js → p-f2cb8ed1.entry.js} +1 -1
  282. package/dist/post-components/{p-58b66607.entry.js → p-ffbf2375.entry.js} +1 -1
  283. package/dist/post-components/p-gv9b-Z15.js +1 -0
  284. package/dist/post-components/post-components.css +2 -2
  285. package/dist/post-components/post-components.esm.js +1 -1
  286. package/dist/types/components/post-avatar/avatar-utils.d.ts +0 -2
  287. package/dist/types/components/post-avatar/post-avatar.d.ts +11 -9
  288. package/dist/types/components/post-date-picker/post-date-picker.d.ts +2 -0
  289. package/dist/types/components/post-header/post-header.d.ts +14 -0
  290. package/dist/types/components/post-language-menu/post-language-menu.d.ts +3 -0
  291. package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +1 -1
  292. package/dist/types/components/post-menu/post-menu.d.ts +0 -1
  293. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +74 -69
  294. package/dist/types/components/post-tabs/post-tabs.d.ts +4 -0
  295. package/dist/types/components.d.ts +39 -26
  296. package/dist/types/utils/floating-ui/middleware/flip.d.ts +14 -0
  297. package/dist/types/utils/floating-ui/middleware/safe-space.d.ts +10 -0
  298. package/dist/types/utils/floating-ui/util.d.ts +4 -0
  299. package/dist/types/utils/index.d.ts +1 -0
  300. package/dist/types/utils/is-focus-visible.d.ts +5 -0
  301. package/dist/vrt/helpers/header-test-config.js +2 -1
  302. package/hydrate/index.js +659 -634
  303. package/hydrate/index.mjs +659 -634
  304. package/package.json +22 -21
  305. package/dist/components/react/p-BBz9PVf0.js +0 -1
  306. package/dist/components/react/p-BgEY7xhT.js +0 -1
  307. package/dist/components/react/p-C3J7fIWx.js +0 -1
  308. package/dist/components/react/p-C5ibTdH5.js +0 -1
  309. package/dist/components/react/p-CUKzje9q.js +0 -1
  310. package/dist/components/react/p-DTBtJCjk.js +0 -1
  311. package/dist/components/react/p-XUkUhxaz.js +0 -1
  312. package/dist/components/react/p-ialuSSl2.js +0 -1
  313. package/dist/post-components/p-10e430c3.entry.js +0 -1
  314. package/dist/post-components/p-32e1e951.entry.js +0 -1
  315. package/dist/post-components/p-4f08b99b.entry.js +0 -1
  316. package/dist/post-components/p-54432b47.entry.js +0 -1
  317. package/dist/post-components/p-5d7de657.entry.js +0 -1
  318. package/dist/post-components/p-63dd9a76.entry.js +0 -1
  319. package/dist/post-components/p-96d07f2b.entry.js +0 -1
  320. package/dist/post-components/p-9a1e8b1d.entry.js +0 -1
  321. package/dist/post-components/p-BBz9PVf0.js +0 -1
  322. package/dist/post-components/p-Bs0zeM5Q.js +0 -2
  323. package/dist/post-components/p-DH-eJVHZ.js +0 -1
  324. package/dist/post-components/p-Dk-DtPZn.js +0 -1
  325. package/dist/post-components/p-aff180f5.entry.js +0 -1
  326. package/dist/post-components/p-d5327dd1.entry.js +0 -1
  327. package/dist/post-components/p-e1817744.entry.js +0 -1
  328. package/dist/post-components/p-f6da5e69.entry.js +0 -1
  329. package/dist/post-components/p-f917527c.entry.js +0 -1
  330. package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/vrt/helpers/header-variants.config.d.ts +0 -23
  331. package/dist/vrt/helpers/header-variants.config.js +0 -157
  332. /package/dist/collection/utils/{floating-ui.js → floating-ui/platform/safe-area.js} +0 -0
  333. /package/dist/types/utils/{floating-ui.d.ts → floating-ui/platform/safe-area.d.ts} +0 -0
@@ -43,7 +43,7 @@ export class PostProgressbar {
43
43
  const max = this.getEffectiveMax();
44
44
  const value = this.getEffectiveValue(min, max);
45
45
  const percentage = ((value - min) / (max - min)) * 100;
46
- return (h(Host, { key: 'c29b1fa3dca89d999c2a55bd58c9c7450ed767c6', role: "progressbar", "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max }, h("div", { key: 'aaff038be7bdaf99de1e94c7479c2b57947195ac', class: "progress-value", style: { '--post-progressbar-value': `${percentage}%` } })));
46
+ return (h(Host, { key: '26bdbb5219393e8b44e2fe5395d8a4cd8aa7e18a', role: "progressbar", "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max }, h("div", { key: '65b81479fac7aa6024556ef6589064f997f4394e', class: "progress-value", style: { '--post-progressbar-value': `${percentage}%` } })));
47
47
  }
48
48
  static get is() { return "post-progressbar"; }
49
49
  static get encapsulation() { return "shadow"; }
@@ -83,7 +83,7 @@ export class PostRating {
83
83
  }
84
84
  }
85
85
  render() {
86
- return (h(Host, { key: '727813875ba5d754ec17f4a2b151c0c6cd4ab5ca', "data-version": version }, h("div", { key: '1ac7e5db0098568c16551a4850442e4c8f0e686b', role: "slider", class: "rating", tabindex: "0", "aria-label": this.label, "aria-valuemin": "0", "aria-valuemax": this.stars, "aria-valuenow": this.currentRating, "aria-valuetext": `${this.currentRating} / ${this.stars}`, "aria-readonly": this.readonly ? 'true' : 'false', onKeyDown: this.keydownHandler, onBlur: this.blurHandler }, Array.from({ length: this.stars }).map((v, i) => (h("div", { key: `star-${v}`, "aria-hidden": "true", class: {
86
+ return (h(Host, { key: 'c793abbf5e0d01bb19dc4464ebd75249959a1717', "data-version": version }, h("div", { key: '357946df40a3d3a85ece2d0ac6ecc761951d9471', role: "slider", class: "rating", tabindex: "0", "aria-label": this.label, "aria-valuemin": "0", "aria-valuemax": this.stars, "aria-valuenow": this.currentRating, "aria-valuetext": `${this.currentRating} / ${this.stars}`, "aria-readonly": this.readonly ? 'true' : 'false', onKeyDown: this.keydownHandler, onBlur: this.blurHandler }, Array.from({ length: this.stars }).map((v, i) => (h("div", { key: `star-${v}`, "aria-hidden": "true", class: {
87
87
  'star': true,
88
88
  'before-hover': i < this.hoveredIndex,
89
89
  'active': i < Math.round(this.currentRating),
@@ -1 +1 @@
1
- :host{display:flex}:host,:host dialog{background-color:var(--post-scheme-color-palette-bg-2);border-inline-end:var(--post-device-border-width-alternative1) solid var(--post-scheme-color-interactive-primary-enabled-stroke4)}:host dialog{overflow:visible;width:var(--post-core-dimension-296);bottom:auto;right:auto;border:none;padding:0;max-height:100dvh;transform:translateX(-100%);transition-property:transform,overlay,display;transition-behavior:allow-discrete;transition-duration:350ms;box-shadow:var(--post-device-elevation-300)}:host dialog[open]{transform:translateX(0)}@starting-style{:host dialog[open]{transform:translateX(-100%)}}@media(prefers-reduced-motion: reduce){:host dialog{transition:none}}:host post-closebutton{transform:translate(50%, 0)}
1
+ :host{display:flex}:host,:host dialog{background-color:var(--post-scheme-color-palette-bg-2);border-inline-end:var(--post-device-border-width-alternative1) solid var(--post-scheme-color-interactive-primary-enabled-stroke4)}:host dialog{overflow:visible;width:var(--post-core-dimension-296);bottom:auto;right:auto;border:none;padding:0;max-height:100dvh;transform:translateX(-100%);transition-property:transform,overlay,display;transition-behavior:allow-discrete;transition-duration:350ms;box-shadow:var(--post-device-elevation-300)}:host dialog:focus,:host dialog:focus-visible{outline:none}:host dialog[open]{transform:translateX(0)}@starting-style{:host dialog[open]{transform:translateX(-100%)}}@media(prefers-reduced-motion: reduce){:host dialog{transition:none}}:host post-closebutton{transform:translate(50%, 0)}
@@ -11,7 +11,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
11
11
  import { h, Host, } from "@stencil/core";
12
12
  import { version } from "../../../../package";
13
13
  import { breakpoint } from "../../utils/breakpoints";
14
- import { getFocusableChildren, OneOf, Required, Type } from "../../utils/index";
14
+ import { getFocusableChildren, isFocusVisible, OneOf, Required, Type } from "../../utils/index";
15
15
  import { SIDE_NAVIGATION_SIZES } from "./side-navigation-styles";
16
16
  /**
17
17
  * @slot default - Slot for the navigation content (must be a `<nav>` landmark with proper heading)
@@ -90,9 +90,13 @@ export class PostSideNavigation {
90
90
  async show() {
91
91
  if (this.device === 'desktop')
92
92
  return;
93
+ // Only move focus into the nav if the trigger was keyboard-focus-visible;
94
+ // that's the browser's own signal for a keyboard-driven interaction.
95
+ const wasTriggerFocusVisible = isFocusVisible(document.activeElement);
93
96
  this.dialog.showModal();
94
97
  this.postToggle.emit(true);
95
- this.focusNav();
98
+ if (wasTriggerFocusVisible)
99
+ this.focusNav();
96
100
  }
97
101
  /**
98
102
  * Closes the navigation programmatically.
@@ -129,7 +133,7 @@ export class PostSideNavigation {
129
133
  } }, h("slot", null), h("post-closebutton", { onClick: () => this.hide() }, this.textClose)));
130
134
  }
131
135
  render() {
132
- return (h(Host, { key: 'f7d9b4e515e5085d78e452298bdfbfb2325e7422', "data-version": version }, this.device === 'desktop' ? this.renderNav() : this.renderDialog()));
136
+ return (h(Host, { key: 'd323d8990ed9abfb5ca6c15daa70d49dabd496f9', "data-version": version }, this.device === 'desktop' ? this.renderNav() : this.renderDialog()));
133
137
  }
134
138
  static get is() { return "post-side-navigation"; }
135
139
  static get encapsulation() { return "shadow"; }
@@ -85,7 +85,7 @@ export class PostSideNavigationTrigger {
85
85
  await this.sideNavigation?.toggle();
86
86
  }
87
87
  render() {
88
- return (h(Host, { key: '1c908083562ec5ca01cd9410c72ac78ae11ce72f', "data-version": version }, h("slot", { key: '38f63424e8c66b4bf926418b57555dc676d24d45' })));
88
+ return (h(Host, { key: '2822a6c7246da96de537eff3e3fbf5a2db400547', "data-version": version }, h("slot", { key: '0bb02d90c7916a4dbfe6dd7fc0f4325509939a80' })));
89
89
  }
90
90
  static get is() { return "post-side-navigation-trigger"; }
91
91
  static get encapsulation() { return "shadow"; }
@@ -104,7 +104,7 @@ export class PostStepper {
104
104
  }
105
105
  }
106
106
  render() {
107
- return (h(Host, { key: 'e6d1f0498cb3de68badef6428cfe8fdff73b879b', "data-version": version }, h("ol", { key: '4c10c32d36eaeeb19712f7d99dcba7d5337d89a1' }, h("slot", { key: 'ced502f01025f44c09747299cf60c82ebcd905da', onSlotchange: () => this.updateSteps() })), h("div", { key: '93cfc9fbd328d4a384c56ccf1f884053643f88e6', class: "active-step", "aria-hidden": "true" }, h("span", { key: '076fad4efc393852d024157011a0e86d90ecfe99', class: "active-step-label" }, this.mobileActiveStepLabel), h("span", { key: '814817862389cd55859aec49205fae255cbbf1d7', innerHTML: this.mobileActiveStepName }))));
107
+ return (h(Host, { key: '52c9943bca4c1d7b1d964d812ce21d8b0eb2d236', "data-version": version }, h("ol", { key: 'ea1f27a214d9cdf14b5f2d07f14a8d54836a32b3' }, h("slot", { key: '6f07fe49d55152123dc39645ef17bf5557753005', onSlotchange: () => this.updateSteps() })), h("div", { key: 'ad3af45bc5d1493f9f1084cc28c77c39d27cbd35', class: "active-step", "aria-hidden": "true" }, h("span", { key: '6e3f5decadc8bcc67812dd67f6efe0afa0613b46', class: "active-step-label" }, this.mobileActiveStepLabel), h("span", { key: '4aeb9376181d78007a929c5e8e4ba11c181039bb', innerHTML: this.mobileActiveStepName }))));
108
108
  }
109
109
  static get is() { return "post-stepper"; }
110
110
  static get encapsulation() { return "shadow"; }
@@ -2,7 +2,7 @@ import { version } from "../../../../package";
2
2
  import { h, Host } from "@stencil/core";
3
3
  export class PostStepperItem {
4
4
  render() {
5
- return (h(Host, { key: 'f41ae27d8de89912b3aa34d9c89f5ec69f3df301', "data-version": version, role: "listitem" }, h("span", { key: '00a0dd2eb3fb020e49c5782245e1f3e72c77e780', class: "stepper-item-content" }, h("span", { key: 'bc9932083d295b92db24ddd22cb18a755db5ad11', class: "step-hidden-label visually-hidden" }), h("span", { key: 'efe2d809c82c1d7de9e0cdf4e52b924943afa0bf', class: "label" }, h("slot", { key: '47aceca3fc331ef91da60674dbc2af5ea7e76ec8' })))));
5
+ return (h(Host, { key: '53b052a2b68a93df9fda7f80f23d602d8a8efc56', "data-version": version, role: "listitem" }, h("span", { key: 'e06841841e7fad42ff9de3e39dadf5fab96b9952', class: "stepper-item-content" }, h("span", { key: 'f934ef19fbdd65111b7cf561dcc9297122d62595', class: "step-hidden-label visually-hidden" }), h("span", { key: '213db918f5ab854225974678c50176bb565ac2b1', class: "label" }, h("slot", { key: 'd8e067ea304700e37edb996a4c715d41e209b8d8' })))));
6
6
  }
7
7
  static get is() { return "post-stepper-item"; }
8
8
  static get encapsulation() { return "shadow"; }
@@ -44,9 +44,9 @@ export class PostTabItem {
44
44
  }
45
45
  render() {
46
46
  const isSSR = Build.isServer;
47
- return (h(Host, { key: '0c98772d01658e932be9982b6983eb3c1f0c4053', id: this.tabId, role: this.isPagesVariant ? undefined : 'tab', "data-version": version, "data-pages-variant": this.isPagesVariant.toString(), "aria-selected": this.isPagesVariant ? undefined : 'false', "aria-disabled": this.disabled ? 'true' : undefined, tabindex: this.isPagesVariant ? undefined : '-1', class: `${this.isPagesVariant ? 'nav-item' : 'tab-title'}${isSSR && !this.isPagesVariant ? ' ssr' : ''}`, style: isSSR && !this.isPagesVariant
47
+ return (h(Host, { key: '974d9682ef0448cf3adf9481ba472a5c196349b3', id: this.tabId, role: this.isPagesVariant ? undefined : 'tab', "data-version": version, "data-pages-variant": this.isPagesVariant.toString(), "aria-selected": this.isPagesVariant ? undefined : 'false', "aria-disabled": this.disabled ? 'true' : undefined, tabindex: this.isPagesVariant ? undefined : '-1', class: `${this.isPagesVariant ? 'nav-item' : 'tab-title'}${isSSR && !this.isPagesVariant ? ' ssr' : ''}`, style: isSSR && !this.isPagesVariant
48
48
  ? { '--active': `var(--post-tab-item-${this.name}, 0)` }
49
- : undefined }, h("slot", { key: 'fba27566a1226e560161f839df050666763bdce5' })));
49
+ : undefined }, h("slot", { key: '6a7ed6323892a40ea22e487bc9460af69fda02c6' })));
50
50
  }
51
51
  static get is() { return "post-tab-item"; }
52
52
  static get encapsulation() { return "shadow"; }
@@ -21,7 +21,7 @@ export class PostTabPanel {
21
21
  }
22
22
  render() {
23
23
  const isSSR = Build.isServer;
24
- return (h(Host, { key: '2b02063bf2e67f4e826155759f28a1ae47b0c8e0', "data-version": version, id: this.panelId, role: "tabpanel", slot: "panels", style: isSSR ? { display: `var(--post-tab-panel-${this.for}, none)` } : undefined }, h("slot", { key: 'b4c39e035d0f49f5654b030f4aada27fbebb122c' })));
24
+ return (h(Host, { key: '07d93ddaa69253a956ed50cd9ecd6ed039fbc6e2', "data-version": version, id: this.panelId, role: "tabpanel", slot: "panels", style: isSSR ? { display: `var(--post-tab-panel-${this.for}, none)` } : undefined }, h("slot", { key: 'd6887db4e0e4dc22f8f8fdf098d6068ef4bd1a91' })));
25
25
  }
26
26
  static get is() { return "post-tab-panel"; }
27
27
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- :host{display:block}:host .tabs-wrapper{position:relative;display:flex;align-items:center}:host .tabs-wrapper button.scroll-btn{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;display:flex;align-items:center;justify-content:center;transition:background-color 100ms,border-color 100ms,color 100ms;cursor:pointer}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn{background-color:ButtonFace !important}:host .tabs-wrapper button.scroll-btn:hover{background-color:Highlight !important}}:host .tabs-wrapper button.scroll-btn post-icon{color:currentColor}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn post-icon{color:Highlight}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:hover post-icon{color:canvas}}:host .tabs-wrapper button.scroll-btn[hidden]{display:none}:host .tabs-wrapper button.scroll-btn{outline-offset:var(--post-device-spacing-padding-44) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){transition:none}:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus):hover{color:HighlightText;border-color:HighlightText}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){transition:none}:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus):hover{color:HighlightText;border-color:HighlightText}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}:host .tabs-wrapper .tabs{overflow-x:hidden;background-color:rgba(0,0,0,0) !important;display:flex;flex-wrap:nowrap;align-items:end;overscroll-behavior-x:contain;white-space:nowrap;margin-block:0;padding-inline-start:0;list-style:none}:host(.page-tabs){overflow:visible !important}:host(.page-tabs) .tabs-wrapper{margin-inline:calc(-1*(var(--post-container-offset)))}@media screen and (min-width: 1024px){:host(.page-tabs) .tabs-wrapper{margin-inline:calc(-1 * (var(--post-container-offset)) + 20px)}:host(.page-tabs) .tabs-wrapper::after{box-shadow:20px 0 0 var(--post-palette-color-nested-tabs-page-stroke),-20px 0 0 var(--post-palette-color-nested-tabs-page-stroke)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper::after{box-shadow:20px 0 0 LinkText,-20px 0 0 LinkText}}:host(.page-tabs) .tabs-wrapper button.scroll-btn{color:var(--post-scheme-color-interactive-primary-enabled-fg5);background-color:var(--post-scheme-color-interactive-primary-enabled-bg5);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-primary-enabled-stroke);position:absolute;z-index:2;box-shadow:var(--post-device-elevation-200);border-radius:var(--post-device-border-radius-2)}:host(.page-tabs) .tabs-wrapper button.scroll-btn:hover{border-color:var(--post-scheme-color-interactive-primary-hover-stroke) !important;color:var(--post-scheme-color-interactive-primary-hover-fg4);background-color:var(--post-scheme-color-interactive-primary-hover-bg8)}:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn-left{inset-inline-start:0;border-inline-start:none;border-radius:0 var(--post-device-border-radius-2) var(--post-device-border-radius-2) 0}:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn-right{inset-inline-end:0;border-inline-end:none;border-radius:var(--post-device-border-radius-2) 0 0 var(--post-device-border-radius-2)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn{background-color:Highlight;color:HighlightText}}:host(.page-tabs) .tabs-wrapper::after{content:"";position:absolute;inset-block-end:0;inset-inline-start:0;width:100%;height:var(--post-device-border-width-default);background-color:var(--post-palette-color-nested-tabs-page-stroke)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper::after{background-color:LinkText}}:host(.page-tabs) .tabs-wrapper .tabs{padding-inline:calc(var(--post-container-offset));gap:var(--post-device-spacing-gap-inline-5);scrollbar-width:none}:host(.page-tabs) .tabs-wrapper .tabs::-webkit-scrollbar{display:none}:host(.page-tabs:not([size=small])) button.scroll-btn{top:var(--post-device-spacing-padding-36)}:host(.page-tabs[size=small]) button.scroll-btn{top:var(--post-device-spacing-padding-36)}:host(.content-tabs) .tabs-wrapper button.scroll-btn{flex-shrink:0;color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}:host(.content-tabs) .tabs-wrapper button.scroll-btn:hover{border-color:var(--post-scheme-color-interactive-primary-hover-stroke) !important;color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.content-tabs) .tabs-wrapper button.scroll-btn:hover{color:HighlightText}}:host(post-tabs:not([size=small])) button.scroll-btn{height:var(--post-device-sizing-interactive-button-height-10);width:var(--post-device-sizing-interactive-button-width-1);border-radius:var(--post-device-border-radius-2)}:host(post-tabs:not([size=small])) button.scroll-btn post-icon{height:var(--post-device-sizing-interactive-icon-size5);width:var(--post-device-sizing-interactive-icon-size5)}:host(.page-tabs:not([size=small])) button.scroll-btn-left{padding-inline:var(--post-device-spacing-padding-39) var(--post-device-spacing-padding-40)}:host(.page-tabs:not([size=small])) button.scroll-btn-right{padding-inline:var(--post-device-spacing-padding-40) var(--post-device-spacing-padding-39)}:host([size=small]) button.scroll-btn{height:var(--post-device-sizing-interactive-button-size-1);width:var(--post-device-sizing-interactive-button-size-1);border-radius:var(--post-device-border-radius-2)}:host([size=small]) button.scroll-btn post-icon{height:var(--post-device-sizing-interactive-icon-size4);width:var(--post-device-sizing-interactive-icon-size4)}:host(.page-tabs[size=small]) button.scroll-btn-left{padding-inline:var(--post-device-spacing-padding-42) var(--post-device-spacing-padding-43)}:host(.page-tabs[size=small]) button.scroll-btn-right{padding-inline:var(--post-device-spacing-padding-43) var(--post-device-spacing-padding-42)}
1
+ :host{display:block}:host .tabs-wrapper{position:relative;display:flex;align-items:center}:host .tabs-wrapper button.scroll-btn{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;display:flex;align-items:center;justify-content:center;transition:background-color 100ms,border-color 100ms,color 100ms;cursor:pointer}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn{background-color:ButtonFace !important}:host .tabs-wrapper button.scroll-btn:hover{background-color:Highlight !important}}:host .tabs-wrapper button.scroll-btn post-icon{color:currentColor}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn post-icon{color:Highlight}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:hover post-icon{color:canvas}}:host .tabs-wrapper button.scroll-btn[hidden]{display:none}:host .tabs-wrapper button.scroll-btn{outline-offset:var(--post-device-spacing-padding-44) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host .tabs-wrapper button.scroll-btn:focus-visible{outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:focus-visible{transition:none}:host .tabs-wrapper button.scroll-btn:focus-visible:hover{color:HighlightText;border-color:HighlightText}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:focus-visible{outline-color:Highlight !important}}:host .tabs-wrapper button.scroll-btn.pretend-focus{outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn.pretend-focus{transition:none}:host .tabs-wrapper button.scroll-btn.pretend-focus:hover{color:HighlightText;border-color:HighlightText}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn.pretend-focus{outline-color:Highlight !important}}:host .tabs-wrapper button.scroll-btn:has(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:has(:focus-visible){transition:none}:host .tabs-wrapper button.scroll-btn:has(:focus-visible):hover{color:HighlightText;border-color:HighlightText}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:has(:focus-visible){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){transition:none}:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus):hover{color:HighlightText;border-color:HighlightText}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host .tabs-wrapper button.scroll-btn:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}:host .tabs-wrapper .tabs{overflow-x:hidden;background-color:rgba(0,0,0,0) !important;display:flex;flex-wrap:nowrap;align-items:end;overscroll-behavior-x:contain;white-space:nowrap;margin-block:0;padding-inline-start:0;list-style:none}:host(.page-tabs){overflow:visible !important}:host(.page-tabs) .tabs-wrapper{margin-inline:calc(-1*(var(--post-container-offset)))}@media screen and (min-width: 1024px){:host(.page-tabs) .tabs-wrapper{margin-inline:calc(-1 * (var(--post-container-offset)) + 20px)}:host(.page-tabs) .tabs-wrapper::after{box-shadow:20px 0 0 var(--post-palette-color-nested-tabs-page-stroke),-20px 0 0 var(--post-palette-color-nested-tabs-page-stroke)}}@media screen and (min-width: 1024px)and (forced-colors: active),screen and (min-width: 1024px)and (-ms-high-contrast: active),screen and (min-width: 1024px)and (-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper::after{box-shadow:20px 0 0 LinkText,-20px 0 0 LinkText}}:host(.page-tabs) .tabs-wrapper button.scroll-btn{color:var(--post-scheme-color-interactive-primary-enabled-fg5);background-color:var(--post-scheme-color-interactive-primary-enabled-bg5);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-primary-enabled-stroke);position:absolute;z-index:2;box-shadow:var(--post-device-elevation-200);border-radius:var(--post-device-border-radius-2)}:host(.page-tabs) .tabs-wrapper button.scroll-btn:hover{border-color:var(--post-scheme-color-interactive-primary-hover-stroke) !important;color:var(--post-scheme-color-interactive-primary-hover-fg4);background-color:var(--post-scheme-color-interactive-primary-hover-bg8)}:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn-left{inset-inline-start:0;border-inline-start:none;border-radius:0 var(--post-device-border-radius-2) var(--post-device-border-radius-2) 0}:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn-right{inset-inline-end:0;border-inline-end:none;border-radius:var(--post-device-border-radius-2) 0 0 var(--post-device-border-radius-2)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper button.scroll-btn.scroll-btn{background-color:Highlight;color:HighlightText}}:host(.page-tabs) .tabs-wrapper::after{content:"";position:absolute;inset-block-end:0;inset-inline-start:0;width:100%;height:var(--post-device-border-width-default);background-color:var(--post-palette-color-nested-tabs-page-stroke)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.page-tabs) .tabs-wrapper::after{background-color:LinkText}}:host(.page-tabs) .tabs-wrapper .tabs{padding-inline:calc(var(--post-container-offset));gap:var(--post-device-spacing-gap-inline-5);scrollbar-width:none}:host(.page-tabs) .tabs-wrapper .tabs::-webkit-scrollbar{display:none}:host(.page-tabs:not([size=small])) button.scroll-btn{top:var(--post-device-spacing-padding-36)}:host(.page-tabs[size=small]) button.scroll-btn{top:var(--post-device-spacing-padding-36)}:host(.content-tabs) .tabs-wrapper button.scroll-btn{flex-shrink:0;color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}:host(.content-tabs) .tabs-wrapper button.scroll-btn:hover{border-color:var(--post-scheme-color-interactive-primary-hover-stroke) !important;color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(.content-tabs) .tabs-wrapper button.scroll-btn:hover{color:HighlightText}}:host(post-tabs:not([size=small])) button.scroll-btn{height:var(--post-device-sizing-interactive-button-height-10);width:var(--post-device-sizing-interactive-button-width-1);border-radius:var(--post-device-border-radius-2)}:host(post-tabs:not([size=small])) button.scroll-btn post-icon{height:var(--post-device-sizing-interactive-icon-size5);width:var(--post-device-sizing-interactive-icon-size5)}:host(.page-tabs:not([size=small])) button.scroll-btn-left{padding-inline:var(--post-device-spacing-padding-39) var(--post-device-spacing-padding-40)}:host(.page-tabs:not([size=small])) button.scroll-btn-right{padding-inline:var(--post-device-spacing-padding-40) var(--post-device-spacing-padding-39)}:host([size=small]) button.scroll-btn{height:var(--post-device-sizing-interactive-button-size-1);width:var(--post-device-sizing-interactive-button-size-1);border-radius:var(--post-device-border-radius-2)}:host([size=small]) button.scroll-btn post-icon{height:var(--post-device-sizing-interactive-icon-size4);width:var(--post-device-sizing-interactive-icon-size4)}:host(.page-tabs[size=small]) button.scroll-btn-left{padding-inline:var(--post-device-spacing-padding-42) var(--post-device-spacing-padding-43)}:host(.page-tabs[size=small]) button.scroll-btn-right{padding-inline:var(--post-device-spacing-padding-43) var(--post-device-spacing-padding-42)}
@@ -39,6 +39,18 @@ export class PostTabs {
39
39
  * Default is 'large'.
40
40
  */
41
41
  this.size = 'large';
42
+ // Showing or hiding a scroll button changes the container width, which can happen in the middle of a scroll:
43
+ // the scroll target has to be recomputed, otherwise the scroll stops short of the end
44
+ this.handleContainerResize = () => {
45
+ this.updateScrollButtons();
46
+ // When the whole component resizes instead (e.g. the window gets narrower), the tabs keep their position
47
+ const hostWidth = this.host.clientWidth;
48
+ if (hostWidth !== this.hostWidth) {
49
+ this.hostWidth = hostWidth;
50
+ this.pendingScroll = undefined;
51
+ }
52
+ this.pendingScroll?.();
53
+ };
42
54
  // Handles the visibility of scroll buttons based on the scroll position of the tabs container
43
55
  this.updateScrollButtons = () => {
44
56
  if (!this.tabsContainer)
@@ -122,7 +134,8 @@ export class PostTabs {
122
134
  this.contentObserver?.observe(this.host, config);
123
135
  }
124
136
  setupResizeObserver() {
125
- this.resizeObserver = new ResizeObserver(this.updateScrollButtons);
137
+ this.hostWidth = this.host.clientWidth;
138
+ this.resizeObserver = new ResizeObserver(this.handleContainerResize);
126
139
  this.resizeObserver.observe(this.tabsContainer);
127
140
  }
128
141
  handleContentChange(mutations) {
@@ -391,11 +404,23 @@ export class PostTabs {
391
404
  const paddingStart = Number.parseFloat(style.paddingInlineStart) || 0;
392
405
  const paddingEnd = Number.parseFloat(style.paddingInlineEnd) || 0;
393
406
  const contentWidth = this.tabsContainer.clientWidth - paddingStart - paddingEnd;
407
+ const maxScrollLeft = this.tabsContainer.scrollWidth - this.tabsContainer.clientWidth;
408
+ const reachesEnd = sign > 0 && this.tabsContainer.scrollLeft + contentWidth >= maxScrollLeft;
409
+ this.pendingScroll = reachesEnd ? () => this.scrollToEnd() : undefined;
394
410
  this.tabsContainer.scrollBy({
395
411
  left: sign * contentWidth,
396
412
  behavior: 'smooth',
397
413
  });
398
414
  }
415
+ scrollToEnd() {
416
+ const container = this.tabsContainer;
417
+ const maxScrollLeft = container.scrollWidth - container.clientWidth;
418
+ if (container.scrollLeft >= maxScrollLeft) {
419
+ this.pendingScroll = undefined;
420
+ return;
421
+ }
422
+ container.scrollTo({ left: maxScrollLeft, behavior: 'smooth' });
423
+ }
399
424
  scrollTabIntoView(tab, behavior = 'instant') {
400
425
  const container = this.tabsContainer;
401
426
  const style = getComputedStyle(container);
@@ -405,10 +430,13 @@ export class PostTabs {
405
430
  const tabRight = tabLeft + tab.offsetWidth;
406
431
  const containerLeft = container.scrollLeft + paddingStart;
407
432
  const containerRight = containerLeft + container.clientWidth - paddingStart - paddingEnd;
433
+ // Only aligning the tab to the right edge depends on the container width
434
+ this.pendingScroll = undefined;
408
435
  if (tabLeft < containerLeft) {
409
436
  container.scrollTo({ left: tabLeft - paddingStart, behavior });
410
437
  }
411
438
  else if (tabRight > containerRight) {
439
+ this.pendingScroll = () => this.scrollTabIntoView(tab, behavior);
412
440
  container.scrollTo({ left: tabRight - container.clientWidth + paddingEnd, behavior });
413
441
  }
414
442
  }
@@ -427,10 +455,10 @@ export class PostTabs {
427
455
  }
428
456
  : undefined;
429
457
  const style = isSSR && !this.isPagesVariant ? tabStyle : undefined;
430
- return (h(Host, { key: 'fb65fd2589517dd6d86e86435ec6b3a3b64b093d', "data-version": version, style: style }, h("div", { key: 'dbcdd791af381ccc23953acb38a8e71527a804ee', class: "tabs-wrapper", part: "post-tabs" }, h("button", { key: '20ce30515d80b282aa93f20a1f3281a1ef0f6359', ref: el => (this.leftScrollButton = el), class: "scroll-btn scroll-btn-left", type: "button", "aria-label": this.textPrevTabItems, tabindex: this.showLeftScrollButton ? 0 : -1, hidden: !this.showLeftScrollButton, onClick: () => this.scrollTabs('prev') }, h("post-icon", { key: '9a5402a28656d7a4459b9b848425bd15a45a0fce', name: "chevronleft" })), h(TabsContainer, { key: 'e821db02fd66aef6cf7a9fb5d925b0906571f3b6', ref: el => (this.tabsContainer = el), class: "tabs", role: this.isPagesVariant ? undefined : 'tablist', "aria-label": this.isPagesVariant ? this.label : undefined }, h("slot", { key: 'e3650e43ac269173cb58f1624f02778bf094573c', onSlotchange: () => {
458
+ return (h(Host, { key: '10c247c7c021a4fbbd8f79ce7b82888e0b7c8be2', "data-version": version, style: style }, h("div", { key: '5ccae325884c7cff0eec399da23513c0b864dde0', class: "tabs-wrapper", part: "post-tabs" }, h("button", { key: 'dd38a22327801b790f849449055b765d2c1bc3b6', ref: el => (this.leftScrollButton = el), class: "scroll-btn scroll-btn-left", type: "button", "aria-label": this.textPrevTabItems, tabindex: -1, hidden: !this.showLeftScrollButton, onClick: () => this.scrollTabs('prev') }, h("post-icon", { key: '461a92ab071472c995d0adad5c73c75c82d982fe', name: "chevronleft" })), h(TabsContainer, { key: 'edecdbfdc681b96539e5a0755330faf1795ecb35', ref: el => (this.tabsContainer = el), class: "tabs", role: this.isPagesVariant ? undefined : 'tablist', "aria-label": this.isPagesVariant ? this.label : undefined }, h("slot", { key: '6240234a2168b2e889cab92a7688731ca93a63a6', onSlotchange: () => {
431
459
  this.moveMisplacedTabs();
432
460
  this.enableTabs();
433
- } })), h("button", { key: '4345a9bc121ce187022cddf019d5c86d875a70e9', ref: el => (this.rightScrollButton = el), class: "scroll-btn scroll-btn-right", type: "button", "aria-label": this.textNextTabItems, tabindex: this.showRightScrollButton ? 0 : -1, hidden: !this.showRightScrollButton, onClick: () => this.scrollTabs('next') }, h("post-icon", { key: '2df749c1a4e506d9940ce61e077d0f0f330b7342', name: "chevronright" }))), !this.isPagesVariant && (h("div", { key: '184db29a5826af78d142ed1489be33c45831970b', class: "tab-content", part: "post-tabs-content" }, h("slot", { key: '4a984c7de97f2f89e7fd0f829f5bc62e2323f056', name: "panels", onSlotchange: () => this.moveMisplacedPanels() })))));
461
+ } })), h("button", { key: 'a4030c48cbbefb578b03ee9dad35724a1fdd5547', ref: el => (this.rightScrollButton = el), class: "scroll-btn scroll-btn-right", type: "button", "aria-label": this.textNextTabItems, tabindex: -1, hidden: !this.showRightScrollButton, onClick: () => this.scrollTabs('next') }, h("post-icon", { key: 'd89c831bdd2faf1991793df47e7ca79bf49e5339', name: "chevronright" }))), !this.isPagesVariant && (h("div", { key: 'aba319437ba8bfb9e7a144a44efcc32d82ef6b02', class: "tab-content", part: "post-tabs-content" }, h("slot", { key: 'e689b5e3a030909c5c77899ac899ded2481f82a6', name: "panels", onSlotchange: () => this.moveMisplacedPanels() })))));
434
462
  }
435
463
  static get is() { return "post-tabs"; }
436
464
  static get encapsulation() { return "shadow"; }
@@ -29,7 +29,7 @@ export class PostTogglebutton {
29
29
  });
30
30
  }
31
31
  render() {
32
- return (h(Host, { key: '81fa9d922480059096e4146c10cf2ef72357b482', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: '4e8d793e3867ba4c9c8e17d509652309a79f032a' })));
32
+ return (h(Host, { key: '6f61a07946f3e67bace0a883b73c424893c4043d', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: 'fd9b93e45da499dbb790ad675f3db36e248c1960' })));
33
33
  }
34
34
  static get is() { return "post-togglebutton"; }
35
35
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- :host{display:none}:host([open]){display:contents}post-popovercontainer[arrow]::after{position:absolute;content:"";inset:-13px;z-index:-1}post-popovercontainer{--post-current-bg: var(--post-scheme-color-surface-accent-bg);--post-current-fg: var(--post-scheme-color-surface-accent-fg);--post-popovercontainer-arrow-border-width: var(--post-device-border-width-alternative1);--post-popovercontainer-arrow-border-color: var(--post-scheme-color-surface-accent-fg)}post-popovercontainer::part(post-popovercontainer-border-mask){display:block;box-shadow:inset 0 0 0 var(--post-device-spacing-padding-14) var(--post-scheme-color-surface-accent-bg)}post-popovercontainer::part(post-popovercontainer-content){border:var(--post-device-border-width-alternative1) solid var(--post-scheme-color-surface-accent-fg);border-radius:var(--post-device-border-radius-1);padding:var(--post-device-spacing-padding-14) var(--post-device-spacing-padding-15);font-size:var(--post-device-font-size-9);max-width:var(--post-tooltip-max-width, 280px);word-wrap:break-word;white-space:normal}
1
+ :host{display:none}:host([open]){display:contents}post-popovercontainer{--post-current-bg: var(--post-scheme-color-surface-accent-bg);--post-current-fg: var(--post-scheme-color-surface-accent-fg);--post-popovercontainer-arrow-border-width: var(--post-device-border-width-alternative1);--post-popovercontainer-arrow-border-color: var(--post-scheme-color-surface-accent-fg)}post-popovercontainer::part(post-popovercontainer-border-mask){display:block;box-shadow:inset 0 0 0 var(--post-device-spacing-padding-14) var(--post-scheme-color-surface-accent-bg)}post-popovercontainer::part(post-popovercontainer-content){border:var(--post-device-border-width-alternative1) solid var(--post-scheme-color-surface-accent-fg);border-radius:var(--post-device-border-radius-1)}.tooltip-content{box-sizing:border-box;padding:var(--post-device-spacing-padding-14) var(--post-device-spacing-padding-15);font-size:var(--post-device-font-size-9);max-width:var(--post-tooltip-max-width, 280px);word-wrap:break-word;white-space:normal;overflow:hidden}
@@ -63,11 +63,13 @@ export class PostTooltip {
63
63
  * @param e Popovercontainer toggle event
64
64
  */
65
65
  handleBeforeToggle(e) {
66
+ // The 'open' attribute needs to be set synchronously for the popover to be measured correctly.
67
+ this.host.toggleAttribute('open', e.detail.willOpen);
66
68
  this.open = e.detail.willOpen;
67
69
  }
68
70
  render() {
69
71
  const popoverClass = `${this.arrow ? 'has-arrow' : ''}`;
70
- return (h(Host, { key: '62d5983e0ef32f851166d0c1d2c457cac0809fdf', "data-version": version }, h("post-popovercontainer", { key: '10150540956510724ab4832ecceb421a7013d983', safeSpace: "trapezoid", class: popoverClass, role: "tooltip", arrow: this.arrow, placement: this.placement, autoHide: true, onPostBeforeToggle: e => this.handleBeforeToggle(e), ref: (el) => (this.popoverRef = el) }, h("slot", { key: 'cdfaf0e916afa55ec3f1a7f64003101985560e27' }))));
72
+ return (h(Host, { key: '083507ae592ce9be50f6b4217a8d13785039478d', "data-version": version }, h("post-popovercontainer", { key: 'e0436489bd955cee95b287f35759c364b019be94', safeSpace: true, class: popoverClass, role: "tooltip", arrow: this.arrow, placement: this.placement, autoHide: true, onPostBeforeToggle: e => this.handleBeforeToggle(e), ref: (el) => (this.popoverRef = el) }, h("div", { key: '8e6417485a89f56c18e731351de0e9f5db2cdd9a', class: "tooltip-content" }, h("slot", { key: 'e4c9fed0c8a8454c20f504e38557abd8ea253a1b' })))));
71
73
  }
72
74
  static get is() { return "post-tooltip"; }
73
75
  static get encapsulation() { return "shadow"; }
@@ -180,7 +180,7 @@ export class PostTooltipTrigger {
180
180
  this.tooltip?.hide();
181
181
  }
182
182
  render() {
183
- return (h(Host, { key: '55adc12f457aa8a5dd4357ed27876b0e526f7ae3', "data-version": version }, h("slot", { key: '84da1734ae1c1ac9376caa693108e3ed54bf176f', onSlotchange: () => this.handleSlotChange() })));
183
+ return (h(Host, { key: '7811d666f249ead72768adaf5bdc92e47b447d8a', "data-version": version }, h("slot", { key: '68e56c43ebec2abffbf049647ac08757dadf22f9', onSlotchange: () => this.handleSlotChange() })));
184
184
  }
185
185
  static get is() { return "post-tooltip-trigger"; }
186
186
  static get encapsulation() { return "shadow"; }
@@ -5,3 +5,31 @@ jest.mock('@stencil/core', () => {
5
5
  getElement: (ref) => ref.host ?? document.createElement('post-test'),
6
6
  };
7
7
  });
8
+ // `newSpecPage` builds fresh component metadata for every page, but Stencil proxies a component
9
+ // class only once (`isProxied`). From the second page on, prop accessors that decorators such as
10
+ // `@Required()` put on the prototype are no longer wired to Stencil's prop storage, so the props
11
+ // read back as `undefined`. Restoring the prototype before every page mimics a fresh module load.
12
+ jest.mock('@stencil/core/testing', () => {
13
+ const actual = jest.requireActual('@stencil/core/testing');
14
+ const pristinePrototypes = new WeakMap();
15
+ return {
16
+ ...actual,
17
+ newSpecPage: (options) => {
18
+ for (const component of options.components ?? []) {
19
+ const prototype = component.prototype;
20
+ const pristine = pristinePrototypes.get(prototype);
21
+ if (!pristine) {
22
+ pristinePrototypes.set(prototype, Object.getOwnPropertyDescriptors(prototype));
23
+ continue;
24
+ }
25
+ for (const key of Reflect.ownKeys(prototype)) {
26
+ if (!(key in pristine))
27
+ delete prototype[key];
28
+ }
29
+ Object.defineProperties(prototype, pristine);
30
+ delete component.isProxied;
31
+ }
32
+ return actual.newSpecPage(options);
33
+ },
34
+ };
35
+ });
@@ -0,0 +1,77 @@
1
+ import { detectOverflow, } from "@floating-ui/dom";
2
+ import { evaluate, getAxisLength, getOppositeAxisPlacements, getOppositePlacement, getSide, getSideAxis, } from "@floating-ui/utils";
3
+ import { getOppositeSide } from "../util";
4
+ export const FLIP_MIDDLEWARE = 'post-flip';
5
+ /**
6
+ * Changes the placement of the floating element to keep it in view.
7
+ *
8
+ * Unlike the Floating UI `flip` middleware, placements are measured against `minSize` rather than
9
+ * against the current size of the floating element, and the placement with the smallest deficit is
10
+ * used when none of them fits.
11
+ */
12
+ export function flip(options = {}) {
13
+ return {
14
+ name: FLIP_MIDDLEWARE,
15
+ options,
16
+ async fn(state) {
17
+ const { middlewareData, placement } = state;
18
+ // see https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
19
+ if (middlewareData.arrow?.alignmentOffset)
20
+ return {};
21
+ const { minSize = {}, ...detectOverflowOptions } = evaluate(options, state);
22
+ const gap = Math.abs(middlewareData.offset?.[getSideAxis(placement)] ?? 0);
23
+ const side = getSide(placement);
24
+ const referenceOverflow = await detectOverflow(state, {
25
+ ...detectOverflowOptions,
26
+ elementContext: 'reference',
27
+ });
28
+ const floatingOverflow = await detectOverflow(state, {
29
+ ...detectOverflowOptions,
30
+ elementContext: 'floating',
31
+ });
32
+ // The floating element fits at its current placement, there is nothing left to do.
33
+ if (Math.max(referenceOverflow[side], floatingOverflow[side]) <= 0)
34
+ return {};
35
+ const previous = middlewareData[FLIP_MIDDLEWARE];
36
+ const measurement = { overflow: referenceOverflow, minSize, gap };
37
+ let deficits = previous?.deficits ?? [];
38
+ const placements = previous?.placements ?? (await getPlacements(state, measurement));
39
+ if (deficits.length < placements.length) {
40
+ deficits = [...deficits, getDeficit(side, measurement)];
41
+ }
42
+ const data = { placements, deficits };
43
+ // If there are still placements to try, move on to the next one.
44
+ if (deficits.length < placements.length) {
45
+ return { data, reset: { placement: placements[deficits.length] } };
46
+ }
47
+ // If none of the placements fit, fall back to the one that loses the least space.
48
+ const fallback = data.placements[data.deficits.indexOf(Math.min(...data.deficits))];
49
+ return fallback === placement ? { data } : { data, reset: { placement: fallback } };
50
+ },
51
+ };
52
+ }
53
+ /**
54
+ * Returns the placements to try, ordered from most to least promising.
55
+ */
56
+ async function getPlacements(state, measurement) {
57
+ const { placement, platform, elements } = state;
58
+ const { overflow } = measurement;
59
+ const side = getSide(placement);
60
+ const placements = [placement, getOppositePlacement(placement)];
61
+ const mainAxisDeficit = Math.min(getDeficit(side, measurement), getDeficit(getOppositeSide(side), measurement));
62
+ if (mainAxisDeficit <= 0)
63
+ return placements;
64
+ const rtl = (await platform.isRTL?.(elements.floating)) ?? false;
65
+ const crossAxisPlacements = getOppositeAxisPlacements(placement, true, 'start', rtl);
66
+ // Try the side with the most available space first.
67
+ crossAxisPlacements.sort((a, b) => overflow[getSide(a)] - overflow[getSide(b)]);
68
+ return [...placements, ...crossAxisPlacements];
69
+ }
70
+ /**
71
+ * Returns the amount of space required to display the floating element at its minimum size on the
72
+ * given side of the reference element.
73
+ */
74
+ function getDeficit(side, { minSize, overflow, gap }) {
75
+ const minLength = minSize[getAxisLength(getSideAxis(side))] ?? 0;
76
+ return gap + minLength + overflow[side];
77
+ }
@@ -0,0 +1,52 @@
1
+ import { getNextSide, getOppositeSide, getPreviousSide } from "../util";
2
+ import { getSide, getSideAxis, rectToClientRect, } from "@floating-ui/utils";
3
+ export const SAFE_SPACE_MIDDLEWARE = 'post-safe-space';
4
+ /**
5
+ * Computes the safe space, the area the pointer can travel through to get from the reference to
6
+ * the floating element.
7
+ */
8
+ export function safeSpace() {
9
+ return {
10
+ name: SAFE_SPACE_MIDDLEWARE,
11
+ async fn(state) {
12
+ const { placement, rects, x, y } = state;
13
+ const side = getSide(placement);
14
+ const reference = await getViewportRect(state, rects.reference);
15
+ const floating = await getViewportRect(state, { ...rects.floating, x, y });
16
+ const path = [
17
+ ...getPathAlongSide(floating, getOppositeSide(side)),
18
+ ...getPathAlongSide(reference, side),
19
+ ];
20
+ const points = [];
21
+ for (let i = 0; i < path.length; i += 2) {
22
+ points.push(`${path[i]}px ${path[i + 1]}px`);
23
+ }
24
+ const data = { polygon: `polygon(${points.join(', ')})` };
25
+ return { data };
26
+ },
27
+ };
28
+ }
29
+ /**
30
+ * Converts a rectangle from the floating element's offset parent's coordinate system to viewport
31
+ * coordinates.
32
+ */
33
+ async function getViewportRect({ elements, platform, strategy }, rect) {
34
+ const viewportRect = await platform.convertOffsetParentRelativeRectToViewportRelativeRect?.({
35
+ offsetParent: await platform.getOffsetParent?.(elements.floating),
36
+ rect,
37
+ elements,
38
+ strategy,
39
+ });
40
+ return rectToClientRect(viewportRect ?? rect);
41
+ }
42
+ /**
43
+ * Returns the path along the specified side of the given rectangle.
44
+ *
45
+ * The path is a list of coordinates in the form of [x₁, y₁, x₂, y₂] and is given in clockwise order.
46
+ */
47
+ function getPathAlongSide(rect, side) {
48
+ const self = rect[side];
49
+ const prev = rect[getPreviousSide(side)];
50
+ const next = rect[getNextSide(side)];
51
+ return getSideAxis(side) === 'x' ? [self, prev, self, next] : [prev, self, next, self];
52
+ }
@@ -0,0 +1,10 @@
1
+ import { sides } from "@floating-ui/utils";
2
+ /**
3
+ * Returns the nth side in clockwise direction relative to the given side.
4
+ */
5
+ function getRelativeSide(side, n) {
6
+ return sides[(sides.indexOf(side) + n) % 4];
7
+ }
8
+ export const getNextSide = (side) => getRelativeSide(side, 1);
9
+ export const getOppositeSide = (side) => getRelativeSide(side, 2);
10
+ export const getPreviousSide = (side) => getRelativeSide(side, 3);
@@ -8,6 +8,7 @@ export * from './event-from';
8
8
  export * from './get-focusable-children';
9
9
  export * from './get-root';
10
10
  export * from './get-slotted-element';
11
+ export * from './is-focus-visible';
11
12
  export * from './is-iso-date';
12
13
  export * from './is-motion-reduced';
13
14
  export * from './is-value-empty';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Checks whether an element currently matches `:focus-visible`, i.e. whether
3
+ * it was focused via keyboard rather than mouse/touch interaction.
4
+ */
5
+ export function isFocusVisible(element) {
6
+ if (!element)
7
+ return false;
8
+ try {
9
+ return element.matches(':focus-visible');
10
+ }
11
+ catch {
12
+ // Not supported, fall back to always treating focus as visible
13
+ return true;
14
+ }
15
+ }
@@ -0,0 +1 @@
1
+ function r(r){if(!r)return!1;try{return r.matches(":focus-visible")}catch{return!0}}export{r as i}
@@ -1 +1 @@
1
- const o="10.7.0";export{o as v}
1
+ const o="10.9.0";export{o as v}
@@ -1 +1 @@
1
- import{proxyCustomElement as o,HTMLElement as e,h as t,Host as i,transformTag as c}from"@stencil/core/internal/client";import"./breakpoints.js";import{E as a}from"./event-from.js";import{n as s}from"./nanoid.js";import{v as r}from"./package.js";import{d as n}from"./post-collapsible2.js";import{d}from"./post-collapsible-trigger2.js";import{d as l}from"./post-icon2.js";const p=o(class extends e{constructor(o){super(),!1!==o&&this.__registerHost(),this.__attachShadow(),this.collapsed=!1}onCollapseToggle(o){this.collapsed=!o.detail}async toggle(o){return this.collapsible.toggle(o)}onSlotLogoChange(){this.slottedLogo=this.host.querySelector('img[slot="logo"]')}componentWillRender(){this.slottedLogo=this.host.querySelector('img[slot="logo"]')}render(){const o=`c${s(6)}`,e=this.host.closest("post-accordion")?.getAttribute("heading-level");return t(i,{key:"b9699596d57887d99214c6f163355535c68eae1a","data-version":r},t("post-collapsible-trigger",{key:"ebd7c9d6bf2bc35d548867edc8766e31125d8509",for:o},t(`h${e??2}`,{key:"93806261d7dba93569b09d37dff0c01b4f29268b",class:"accordion-header"},t("button",{key:"785a4bcff2c6705aade9b045e1176d43a2ef202b",type:"button",class:"accordion-button"+(this.collapsed?" collapsed":""),part:"post-accordion-button"},t("span",{key:"87f8ba7f7ebe2ba851b6dc134656296820c467d0",class:{"logo-container":!0,"has-image":!!this.slottedLogo}},t("slot",{key:"146256cb174f5895b25fd8f44464ca32fba6b6ee",name:"logo",onSlotchange:this.onSlotLogoChange.bind(this)})),t("slot",{key:"d742ef89a88280f85c7da697536d4ad2ff825f0b",name:"header"}),t("post-icon",{key:"f83e438c9d504ebaa0066df81b6f74ec14dcb08a",name:"chevronup"})))),t("post-collapsible",{key:"179f36eab7ebdb9faa909a70eb43e1d78503e6e1",id:o,collapsed:this.collapsed,ref:o=>this.collapsible=o},t("div",{key:"e93c3570cf76c971b49bf28d3d5540ac289b2469",class:"accordion-body",part:"post-accordion-body"},t("slot",{key:"db26c35edb371cb855141b6f7552d96ea10e06a4"}))))}get host(){return this}static get style(){return':host{display:block;border-block-end:var(--post-device-border-width-default) var(--post-core-border-style-solid) var(--post-scheme-color-interactive-primary-enabled-stroke)}:host:has(.accordion-button:hover){border-block-end-color:var(--post-scheme-color-interactive-primary-hover-stroke)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host:has(.accordion-button:hover){border-block-end-color:Highlight}}:host([collapsed]) .accordion-button post-icon{transform:rotate(-180deg)}.accordion-header{color:var(--post-scheme-color-interactive-primary-enabled-fg1);font-size:var(--post-device-font-size-5);margin:0;line-height:var(--post-device-line-height-heading);font-weight:var(--post-device-font-weight-extra-black)}.accordion-button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;display:flex;position:relative;width:100%;align-items:center;text-align:start;gap:var(--post-device-spacing-gap-7);padding-block:var(--post-device-spacing-padding-19);padding-inline:var(--post-device-spacing-padding-5);border-block-end:var(--post-device-border-width-default) var(--post-core-border-style-solid) rgba(0,0,0,0);cursor:pointer;outline:none !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button{background-color:ButtonFace !important}.accordion-button:hover{background-color:Highlight !important}}.accordion-button::before{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.accordion-button:is(:focus-visible,:has(:focus-visible),.pretend-focus)::before{outline-style:var(--post-core-border-style-solid) !important;display:block;content:"";position:absolute;inset:calc(var(--post-device-border-width-default)*-1) 0 calc(var(--post-device-border-width-default)*-1);border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button:is(:focus-visible,:has(:focus-visible),.pretend-focus)::before{outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.accordion-button:is(:focus-visible,:focus-within,.pretend-focus)::before{outline-style:var(--post-core-border-style-solid) !important;display:block;content:"";position:absolute;inset:calc(var(--post-device-border-width-default)*-1) 0 calc(var(--post-device-border-width-default)*-1);border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button:is(:focus-visible,:focus-within,.pretend-focus)::before{outline-color:Highlight !important}}}.accordion-button slot::slotted(span[slot=header]){flex-grow:1}.accordion-button post-icon{flex:none;width:var(--post-core-dimension-24);aspect-ratio:1;transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1);transform:var(--post-accordion-icon-initial-transform, none)}.accordion-button.collapsed{padding-block-start:var(--post-device-spacing-padding-19);padding-block-end:var(--post-device-spacing-padding-19)}.accordion-button.collapsed post-icon{transform:rotate(-180deg)}.accordion-button:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}.accordion-button>::slotted(.text-truncate){display:block}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button:hover,.accordion-button:focus-visible{color:Highlight}}post-collapsible{margin-block-end:calc(var(--post-device-border-width-default)*-1)}.accordion-body{padding-block-start:var(--post-device-spacing-padding-15);padding-block-end:var(--post-device-spacing-padding-block-25);padding-inline:var(--post-device-spacing-padding-5)}.logo-container{display:none;width:var(--post-device-sizing-logo-1);aspect-ratio:1}.logo-container.has-image{display:block}.logo-container slot::slotted(img){display:block;width:100%;height:100%;object-fit:cover}.accordion-button>::slotted(:first-child),.accordion-body>::slotted(:first-child){margin-block-start:0 !important}.accordion-button>::slotted(:last-child),.accordion-body>::slotted(:last-child){margin-block-end:0 !important}'}},[257,"post-accordion-item",{collapsed:[1540],slottedLogo:[32],toggle:[64]},[[2,"postToggle","onCollapseToggle"]]]);function b(){"undefined"!=typeof customElements&&["post-accordion-item","post-collapsible","post-collapsible-trigger","post-icon"].forEach((o=>{switch(o){case"post-accordion-item":customElements.get(c(o))||customElements.define(c(o),p);break;case"post-collapsible":customElements.get(c(o))||n();break;case"post-collapsible-trigger":customElements.get(c(o))||d();break;case"post-icon":customElements.get(c(o))||l()}}))}!function(o,e,t,i){var c,a=arguments.length,s=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(o,e,t,i);else for(var r=o.length-1;r>=0;r--)(c=o[r])&&(s=(a<3?c(s):a>3?c(e,t,s):c(e,t))||s);a>3&&s&&Object.defineProperty(e,t,s)}([a("post-accordion-item")],p.prototype,"onCollapseToggle",null);export{p as P,b as d}
1
+ import{proxyCustomElement as o,HTMLElement as t,h as e,Host as i,transformTag as c}from"@stencil/core/internal/client";import"./breakpoints.js";import{E as r}from"./event-from.js";import{n as a}from"./nanoid.js";import{v as s}from"./package.js";import{d as n}from"./post-collapsible2.js";import{d}from"./post-collapsible-trigger2.js";import{d as l}from"./post-icon2.js";const b=o(class extends t{constructor(o){super(),!1!==o&&this.__registerHost(),this.__attachShadow(),this.collapsed=!1}onCollapseToggle(o){this.collapsed=!o.detail}async toggle(o){return this.collapsible.toggle(o)}onSlotLogoChange(){this.slottedLogo=this.host.querySelector('img[slot="logo"]')}componentWillRender(){this.slottedLogo=this.host.querySelector('img[slot="logo"]')}render(){const o=`c${a(6)}`,t=this.host.closest("post-accordion")?.getAttribute("heading-level");return e(i,{key:"b9699596d57887d99214c6f163355535c68eae1a","data-version":s},e("post-collapsible-trigger",{key:"ebd7c9d6bf2bc35d548867edc8766e31125d8509",for:o},e(`h${t??2}`,{key:"93806261d7dba93569b09d37dff0c01b4f29268b",class:"accordion-header"},e("button",{key:"785a4bcff2c6705aade9b045e1176d43a2ef202b",type:"button",class:"accordion-button"+(this.collapsed?" collapsed":""),part:"post-accordion-button"},e("span",{key:"87f8ba7f7ebe2ba851b6dc134656296820c467d0",class:{"logo-container":!0,"has-image":!!this.slottedLogo}},e("slot",{key:"146256cb174f5895b25fd8f44464ca32fba6b6ee",name:"logo",onSlotchange:this.onSlotLogoChange.bind(this)})),e("slot",{key:"d742ef89a88280f85c7da697536d4ad2ff825f0b",name:"header"}),e("post-icon",{key:"f83e438c9d504ebaa0066df81b6f74ec14dcb08a",name:"chevronup"})))),e("post-collapsible",{key:"179f36eab7ebdb9faa909a70eb43e1d78503e6e1",id:o,collapsed:this.collapsed,ref:o=>this.collapsible=o},e("div",{key:"e93c3570cf76c971b49bf28d3d5540ac289b2469",class:"accordion-body",part:"post-accordion-body"},e("slot",{key:"db26c35edb371cb855141b6f7552d96ea10e06a4"}))))}get host(){return this}static get style(){return':host{display:block;border-block-end:var(--post-device-border-width-default) var(--post-core-border-style-solid) var(--post-scheme-color-interactive-primary-enabled-stroke)}:host:has(.accordion-button:hover){border-block-end-color:var(--post-scheme-color-interactive-primary-hover-stroke)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host:has(.accordion-button:hover){border-block-end-color:Highlight}}:host([collapsed]) .accordion-button post-icon{transform:rotate(-180deg)}.accordion-header{color:var(--post-scheme-color-interactive-primary-enabled-fg1);font-size:var(--post-device-font-size-5);margin:0;line-height:var(--post-device-line-height-heading);font-weight:var(--post-device-font-weight-extra-black)}.accordion-button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;display:flex;position:relative;width:100%;align-items:center;text-align:start;gap:var(--post-device-spacing-gap-7);padding-block:var(--post-device-spacing-padding-19);padding-inline:var(--post-device-spacing-padding-5);border-block-end:var(--post-device-border-width-default) var(--post-core-border-style-solid) rgba(0,0,0,0);cursor:pointer;outline:none !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button{background-color:ButtonFace !important}.accordion-button:hover{background-color:Highlight !important}}.accordion-button::before{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.accordion-button:focus-visible::before{outline-style:var(--post-core-border-style-solid) !important;display:block;content:"";position:absolute;inset:calc(var(--post-device-border-width-default)*-1) 0 calc(var(--post-device-border-width-default)*-1);border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button:focus-visible::before{outline-color:Highlight !important}}.accordion-button.pretend-focus::before{outline-style:var(--post-core-border-style-solid) !important;display:block;content:"";position:absolute;inset:calc(var(--post-device-border-width-default)*-1) 0 calc(var(--post-device-border-width-default)*-1);border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button.pretend-focus::before{outline-color:Highlight !important}}.accordion-button:has(:focus-visible)::before{outline-style:var(--post-core-border-style-solid) !important;display:block;content:"";position:absolute;inset:calc(var(--post-device-border-width-default)*-1) 0 calc(var(--post-device-border-width-default)*-1);border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button:has(:focus-visible)::before{outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.accordion-button:is(:focus-visible,:focus-within,.pretend-focus)::before{outline-style:var(--post-core-border-style-solid) !important;display:block;content:"";position:absolute;inset:calc(var(--post-device-border-width-default)*-1) 0 calc(var(--post-device-border-width-default)*-1);border-radius:var(--post-device-border-radius-focus)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button:is(:focus-visible,:focus-within,.pretend-focus)::before{outline-color:Highlight !important}}}.accordion-button slot::slotted(span[slot=header]){flex-grow:1}.accordion-button post-icon{flex:none;width:var(--post-core-dimension-24);aspect-ratio:1;transition:transform 250ms cubic-bezier(0.4, 0, 0.2, 1);transform:var(--post-accordion-icon-initial-transform, none)}.accordion-button.collapsed{padding-block-start:var(--post-device-spacing-padding-19);padding-block-end:var(--post-device-spacing-padding-19)}.accordion-button.collapsed post-icon{transform:rotate(-180deg)}.accordion-button:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}.accordion-button>::slotted(.text-truncate){display:block}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.accordion-button:hover,.accordion-button:focus-visible{color:Highlight}}post-collapsible{margin-block-end:calc(var(--post-device-border-width-default)*-1)}.accordion-body{padding-block-start:var(--post-device-spacing-padding-15);padding-block-end:var(--post-device-spacing-padding-block-25);padding-inline:var(--post-device-spacing-padding-5)}.logo-container{display:none;width:var(--post-device-sizing-logo-1);aspect-ratio:1}.logo-container.has-image{display:block}.logo-container slot::slotted(img){display:block;width:100%;height:100%;object-fit:cover}.accordion-button>::slotted(:first-child),.accordion-body>::slotted(:first-child){margin-block-start:0 !important}.accordion-button>::slotted(:last-child),.accordion-body>::slotted(:last-child){margin-block-end:0 !important}'}},[257,"post-accordion-item",{collapsed:[1540],slottedLogo:[32],toggle:[64]},[[2,"postToggle","onCollapseToggle"]]]);function p(){"undefined"!=typeof customElements&&["post-accordion-item","post-collapsible","post-collapsible-trigger","post-icon"].forEach((o=>{switch(o){case"post-accordion-item":customElements.get(c(o))||customElements.define(c(o),b);break;case"post-collapsible":customElements.get(c(o))||n();break;case"post-collapsible-trigger":customElements.get(c(o))||d();break;case"post-icon":customElements.get(c(o))||l()}}))}!function(o,t,e,i){var c,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,e):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(o,t,e,i);else for(var s=o.length-1;s>=0;s--)(c=o[s])&&(a=(r<3?c(a):r>3?c(t,e,a):c(t,e))||a);r>3&&a&&Object.defineProperty(t,e,a)}([r("post-accordion-item")],b.prototype,"onCollapseToggle",null);export{b as P,p as d}
@@ -1 +1 @@
1
- import{proxyCustomElement as t,HTMLElement as e,h as i,Host as a,transformTag as s}from"@stencil/core/internal/client";import"./breakpoints.js";import{v as r}from"./package.js";import{P as o}from"./pattern.js";import{R as n}from"./required.js";import{T as c}from"./type.js";var l=function(t,e,i,a){var s,r=arguments.length,o=r<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,a);else for(var n=t.length-1;n>=0;n--)(s=t[n])&&(o=(r<3?s(o):r>3?s(e,i,o):s(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};const d=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;var h;!function(t){t.Slotted="slotted",t.Image="image",t.Initials="initials",t[t.Null=null]="Null"}(h||(h={}));const p=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.avatarType=null,this.imageUrl="",this.imageAlt="",this.initials="",this.storageKey=""}updateEmail(){this.getAvatarImage()}async getAvatarImage(){let t=!1;this.slottedImage=this.host.querySelector("img");const e=this.slottedImage?.getAttribute("src");e?await this.getImageByProp(e,this.fetchSlottedImage.bind(this))?this.slottedImage.style.display="block":(this.slottedImage.style.display="none",this.avatarType=h.Initials):(this.email?.match(d)&&(t=await this.getImageByProp(this.email,this.fetchImageByEmail.bind(this))),t||(this.avatarType=h.Initials))}async getImageByProp(t,e){if(!t)return!1;let i;try{i=await e(t)}catch(t){return console.info("Loading avatar image failed.",t),!1}return!!i?.ok&&(this.imageUrl=i.url,this.imageAlt=`${this.firstname} ${this.lastname} avatar`,this.avatarType=h.Image,!0)}async fetchImageByEmail(){const t=await async function(t){return await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)).then((t=>Array.from(new Uint8Array(t)).map((t=>t.toString(16).padStart(2,"0"))).join("")))}(this.email),e="https://www.gravatar.com/avatar/{email}?s=80&d=404&r=g".replace("{email}",t);return await fetch(e)}async fetchSlottedImage(t){return await fetch(t,{method:"HEAD"})}slotChanged(){const t=this.host.shadowRoot.querySelector("slot");(t?.assignedNodes({flatten:!0})||[]).forEach((t=>{t.nodeType===Node.ELEMENT_NODE&&"IMG"===t.tagName&&this.observeImageSrcChanges(t)})),this.getAvatarImage()}observeImageSrcChanges(t){this.slottedImageObserver&&this.slottedImageObserver.disconnect(),this.slottedImageObserver=new MutationObserver((t=>{t.forEach((t=>{"attributes"===t.type&&"src"===t.attributeName&&this.getAvatarImage()}))})),this.slottedImageObserver.observe(t,{attributes:!0,attributeFilter:["src"]})}connectedCallback(){this.avatarType=h.Initials,this.getAvatarImage()}render(){const t=[this.firstname,this.lastname].filter(Boolean).map((t=>t.trim())),e=t.map((t=>t.charAt(0))).join("").trim(),s=t.join(" ");return i(a,{key:"ba9c39d64f6a1b77131ba8c603c9be3aad113c53","data-version":r},i("span",{key:"27a9ac87e8978fabf1717f3eb978e39d06670507",class:"slotted"===this.avatarType?"":"d-none"},i("slot",{key:"3fa13670176f2fc3a79a8b11659962f433c37c2e",onSlotchange:this.slotChanged.bind(this)})),"image"===this.avatarType&&i("img",{key:"232099852c2ad8f2c4660eb1077c6d618092cdca",src:this.imageUrl,alt:this.imageAlt}),"initials"===this.avatarType&&i("span",{key:"e6b3bf751a95997a2abef2a16dcd8e2c78d308fa",class:"initials"},e,i("span",{key:"8d869a374678094e2ec5abc146b0b981c9079c15"},this.description??s)))}get host(){return this}static get watchers(){return{email:[{updateEmail:0}]}}static get style(){return':host{--post-avatar-bg:var(--post-scheme-color-interactive-primary-enabled-bg2);--post-avatar-fg:var(--post-scheme-color-interactive-primary-enabled-fg3);display:inline-flex;position:relative;width:var(--post-device-sizing-interactive-icon-size3);height:var(--post-device-sizing-interactive-icon-size3);background-color:var(--post-scheme-color-interactive-primary-enabled-stroke3);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-primary-enabled-stroke3);border-radius:var(--post-device-border-radius-round);font-size:var(--post-device-font-size-8);vertical-align:top;line-height:1}:host::after{display:block;content:"";position:absolute;inset:0;z-index:1;border-radius:inherit}*,*::before,*::after{box-sizing:border-box}slot,img,::slotted(img){display:block;width:100%;height:100%}img,::slotted(img){border-radius:var(--post-device-border-radius-round)}::slotted(:not(img)){display:none !important}.initials{display:flex;justify-content:center;align-items:center;position:relative;width:100%;height:100%;background-color:var(--post-avatar-bg);border-radius:var(--post-device-border-radius-round);color:var(--post-avatar-fg);text-transform:uppercase;font-weight:400;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms}.initials span{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}'}},[257,"post-avatar",{firstname:[513],lastname:[1],email:[1],description:[1],slottedImage:[32],avatarType:[32],imageUrl:[32],imageAlt:[32],initials:[32],storageKey:[32]},void 0,{email:[{updateEmail:0}]}]);l([n(),c("string")],p.prototype,"firstname",void 0),l([c("string")],p.prototype,"lastname",void 0),l([o(d)],p.prototype,"email",void 0),l([c("string")],p.prototype,"description",void 0);const m=p,g=function(){"undefined"!=typeof customElements&&["post-avatar"].forEach((t=>{"post-avatar"===t&&(customElements.get(s(t))||customElements.define(s(t),p))}))};export{m as PostAvatar,g as defineCustomElement}
1
+ import{proxyCustomElement as t,HTMLElement as e,h as i,Host as a,transformTag as s}from"@stencil/core/internal/client";import"./breakpoints.js";import{v as r}from"./package.js";import{P as o}from"./pattern.js";import{R as n}from"./required.js";import{T as c}from"./type.js";var d=function(t,e,i,a){var s,r=arguments.length,o=r<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,a);else for(var n=t.length-1;n>=0;n--)(s=t[n])&&(o=(r<3?s(o):r>3?s(e,i,o):s(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o};const l=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;var h;!function(t){t.Slotted="slotted",t.Image="image",t.Initials="initials"}(h||(h={}));const p=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.slottedImage=null,this.avatarType=h.Initials,this.imageUrl="",this.imageAlt="",this.showSlottedImage=()=>{this.slottedImage&&(this.slottedImage.style.display="block",this.avatarType=h.Slotted)},this.hideSlottedImage=()=>{this.slottedImage&&(this.slottedImage.style.display="none"),this.avatarType=h.Initials}}updateEmail(){this.getAvatarImage()}async getAvatarImage(){let t=!1;this.slottedImage=this.host.querySelector("img");const e=this.slottedImage?.getAttribute("src");e?(this.imageUrl="",this.updateSlottedImageVisibility()):(this.imageUrl="",this.email?.match(l)&&(t=await this.getImageByProp(this.email,this.fetchImageByEmail.bind(this))),t||(this.avatarType=h.Initials))}async getImageByProp(t,e,i=h.Image){if(!t)return!1;try{const a=await e(t);return i===h.Image&&(this.imageUrl=a,this.imageAlt=[this.firstname,this.lastname].filter(Boolean).join(" ")+" avatar"),this.avatarType=i,!0}catch(t){return console.info("Loading avatar image failed.",t),!1}}async fetchImageByEmail(t){return await this.loadImage(await async function(t){return`https://www.gravatar.com/avatar/${await async function(t){return await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)).then((t=>Array.from(new Uint8Array(t)).map((t=>t.toString(16).padStart(2,"0"))).join("")))}(t.trim().toLowerCase())}?s=80&d=404&r=g`}(t))}updateSlottedImageVisibility(){this.slottedImage?.complete&&this.slottedImage.naturalWidth>0?this.showSlottedImage():this.hideSlottedImage()}loadImage(t){return new Promise(((e,i)=>{const a=new Image;a.addEventListener("load",(()=>e(t)),{once:!0}),a.addEventListener("error",(()=>i(Error("Could not load "+t))),{once:!0}),a.src=t}))}slotChanged(t){const e=t.target.assignedElements({flatten:!0}).find((t=>t instanceof HTMLImageElement));e instanceof HTMLImageElement?this.observeSlottedImage(e):(this.disconnectSlottedImage(),this.slottedImage=null,this.getAvatarImage())}observeSlottedImage(t){this.disconnectSlottedImage(),this.slottedImage=t,t.addEventListener("load",this.showSlottedImage),t.addEventListener("error",this.hideSlottedImage),this.slottedImageObserver=new MutationObserver((()=>this.getAvatarImage())),this.slottedImageObserver.observe(t,{attributes:!0,attributeFilter:["src"]}),this.updateSlottedImageVisibility()}disconnectSlottedImage(){this.slottedImageObserver?.disconnect(),this.slottedImage&&(this.slottedImage.removeEventListener("load",this.showSlottedImage),this.slottedImage.removeEventListener("error",this.hideSlottedImage))}componentWillLoad(){this.avatarType=h.Initials,this.getAvatarImage()}disconnectedCallback(){this.disconnectSlottedImage()}render(){const t=[this.firstname,this.lastname].filter((t=>"string"==typeof t)).map((t=>t.trim())),e=t.map((t=>t.charAt(0))).join("").trim(),s=t.join(" ");return i(a,{key:"ccba82ea3d543a8fad108ea7a8dd30bf6715c132","data-version":r},i("span",{key:"5e7b58d3eeb6bdf49c8a81f36b4d7fffa5b925cc"},i("slot",{key:"7b91589fbccdef4e29e3f5f3f58607887adac559",onSlotchange:t=>this.slotChanged(t)})),this.avatarType===h.Image&&i("img",{key:"65e9e2945592323e54e08d8152e7571222ad728d",src:this.imageUrl,alt:this.imageAlt}),this.avatarType===h.Initials&&i("span",{key:"d4305127e6c77239ab4bf3226aacc153277732cc",class:"initials"},e,i("span",{key:"5e681cb3205708fc42706d20c5d37a097f290898"},this.description??s)))}get host(){return this}static get watchers(){return{email:[{updateEmail:0}]}}static get style(){return':host{--post-avatar-bg:var(--post-scheme-color-interactive-primary-enabled-bg2);--post-avatar-fg:var(--post-scheme-color-interactive-primary-enabled-fg3);display:inline-flex;position:relative;width:var(--post-device-sizing-interactive-icon-size3);height:var(--post-device-sizing-interactive-icon-size3);background-color:var(--post-scheme-color-interactive-primary-enabled-stroke3);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-primary-enabled-stroke3);border-radius:var(--post-device-border-radius-round);font-size:var(--post-device-font-size-8);vertical-align:top;line-height:1}:host::after{display:block;content:"";position:absolute;inset:0;z-index:1;border-radius:inherit}*,*::before,*::after{box-sizing:border-box}slot,img,::slotted(img){display:block;width:100%;height:100%}img,::slotted(img){border-radius:var(--post-device-border-radius-round)}::slotted(:not(img)){display:none !important}.initials{display:flex;justify-content:center;align-items:center;position:relative;width:100%;height:100%;background-color:var(--post-avatar-bg);border-radius:var(--post-device-border-radius-round);color:var(--post-avatar-fg);text-transform:uppercase;font-weight:400;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms}.initials span{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}'}},[257,"post-avatar",{firstname:[513],lastname:[1],email:[1],description:[1],avatarType:[32],imageUrl:[32],imageAlt:[32]},void 0,{email:[{updateEmail:0}]}]);d([n(),c("string")],p.prototype,"firstname",void 0),d([c("string")],p.prototype,"lastname",void 0),d([o(l)],p.prototype,"email",void 0),d([c("string")],p.prototype,"description",void 0);const m=p,f=function(){"undefined"!=typeof customElements&&["post-avatar"].forEach((t=>{"post-avatar"===t&&(customElements.get(s(t))||customElements.define(s(t),p))}))};export{m as PostAvatar,f as defineCustomElement}