@sondor-technology/sondor-components 1.0.9 → 1.0.10

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 (431) hide show
  1. package/dist/components/accordion/accordion.constants.d.ts +5 -0
  2. package/dist/components/accordion/accordion.constants.d.ts.map +1 -0
  3. package/dist/components/accordion/accordion.constants.js +3 -0
  4. package/dist/components/accordion/accordion.constants.js.map +1 -0
  5. package/dist/components/accordion/accordion.d.ts +29 -0
  6. package/dist/components/accordion/accordion.d.ts.map +1 -0
  7. package/dist/components/accordion/accordion.js +226 -0
  8. package/dist/components/accordion/accordion.js.map +1 -0
  9. package/dist/components/alert/alert.constants.d.ts +2 -0
  10. package/dist/components/alert/alert.constants.d.ts.map +1 -1
  11. package/dist/components/alert/alert.d.ts +50 -2
  12. package/dist/components/alert/alert.d.ts.map +1 -1
  13. package/dist/components/alert/alert.js +285 -16
  14. package/dist/components/alert/alert.js.map +1 -1
  15. package/dist/components/avatar/avatar.d.ts +20 -0
  16. package/dist/components/avatar/avatar.d.ts.map +1 -0
  17. package/dist/components/avatar/avatar.js +100 -0
  18. package/dist/components/avatar/avatar.js.map +1 -0
  19. package/dist/components/back-to-top/back-to-top.d.ts +29 -0
  20. package/dist/components/back-to-top/back-to-top.d.ts.map +1 -0
  21. package/dist/components/back-to-top/back-to-top.js +149 -0
  22. package/dist/components/back-to-top/back-to-top.js.map +1 -0
  23. package/dist/components/bar-chart/bar-chart.d.ts +42 -0
  24. package/dist/components/bar-chart/bar-chart.d.ts.map +1 -0
  25. package/dist/components/bar-chart/bar-chart.js +298 -0
  26. package/dist/components/bar-chart/bar-chart.js.map +1 -0
  27. package/dist/components/breadcrumb/breadcrumb.js +2 -2
  28. package/dist/components/button/button.d.ts +1 -0
  29. package/dist/components/button/button.d.ts.map +1 -1
  30. package/dist/components/button/button.js +8 -8
  31. package/dist/components/button/button.js.map +1 -1
  32. package/dist/components/button-group/button-group.js +4 -4
  33. package/dist/components/calendar/calendar.d.ts.map +1 -1
  34. package/dist/components/calendar/calendar.js +11 -9
  35. package/dist/components/calendar/calendar.js.map +1 -1
  36. package/dist/components/chart/chart-base.d.ts +59 -0
  37. package/dist/components/chart/chart-base.d.ts.map +1 -0
  38. package/dist/components/chart/chart-base.js +261 -0
  39. package/dist/components/chart/chart-base.js.map +1 -0
  40. package/dist/components/chart/chart.utils.d.ts +27 -0
  41. package/dist/components/chart/chart.utils.d.ts.map +1 -0
  42. package/dist/components/chart/chart.utils.js +117 -0
  43. package/dist/components/chart/chart.utils.js.map +1 -0
  44. package/dist/components/code-block/code-block.d.ts +5 -0
  45. package/dist/components/code-block/code-block.d.ts.map +1 -1
  46. package/dist/components/code-block/code-block.js +34 -24
  47. package/dist/components/code-block/code-block.js.map +1 -1
  48. package/dist/components/consent/consent.d.ts +63 -0
  49. package/dist/components/consent/consent.d.ts.map +1 -0
  50. package/dist/components/consent/consent.js +327 -0
  51. package/dist/components/consent/consent.js.map +1 -0
  52. package/dist/components/consent/consent.utils.d.ts +36 -0
  53. package/dist/components/consent/consent.utils.d.ts.map +1 -0
  54. package/dist/components/consent/consent.utils.js +82 -0
  55. package/dist/components/consent/consent.utils.js.map +1 -0
  56. package/dist/components/contact/contact.d.ts +22 -0
  57. package/dist/components/contact/contact.d.ts.map +1 -0
  58. package/dist/components/contact/contact.js +83 -0
  59. package/dist/components/contact/contact.js.map +1 -0
  60. package/dist/components/container/container.d.ts +20 -0
  61. package/dist/components/container/container.d.ts.map +1 -0
  62. package/dist/components/container/container.js +68 -0
  63. package/dist/components/container/container.js.map +1 -0
  64. package/dist/components/content-card/content-card.js +4 -4
  65. package/dist/components/context-menu/context-menu.d.ts +89 -0
  66. package/dist/components/context-menu/context-menu.d.ts.map +1 -0
  67. package/dist/components/context-menu/context-menu.js +414 -0
  68. package/dist/components/context-menu/context-menu.js.map +1 -0
  69. package/dist/components/cron-builder/cron-builder.d.ts.map +1 -1
  70. package/dist/components/cron-builder/cron-builder.js +13 -11
  71. package/dist/components/cron-builder/cron-builder.js.map +1 -1
  72. package/dist/components/cta/cta.d.ts +20 -0
  73. package/dist/components/cta/cta.d.ts.map +1 -0
  74. package/dist/components/cta/cta.js +64 -0
  75. package/dist/components/cta/cta.js.map +1 -0
  76. package/dist/components/drawer/drawer.js +6 -6
  77. package/dist/components/faq/faq-item.d.ts +22 -0
  78. package/dist/components/faq/faq-item.d.ts.map +1 -0
  79. package/dist/components/faq/faq-item.js +117 -0
  80. package/dist/components/faq/faq-item.js.map +1 -0
  81. package/dist/components/faq/faq.d.ts +18 -0
  82. package/dist/components/faq/faq.d.ts.map +1 -0
  83. package/dist/components/faq/faq.js +38 -0
  84. package/dist/components/faq/faq.js.map +1 -0
  85. package/dist/components/feature-grid/feature-grid.d.ts +22 -0
  86. package/dist/components/feature-grid/feature-grid.d.ts.map +1 -0
  87. package/dist/components/feature-grid/feature-grid.js +55 -0
  88. package/dist/components/feature-grid/feature-grid.js.map +1 -0
  89. package/dist/components/feature-grid/feature.d.ts +18 -0
  90. package/dist/components/feature-grid/feature.d.ts.map +1 -0
  91. package/dist/components/feature-grid/feature.js +91 -0
  92. package/dist/components/feature-grid/feature.js.map +1 -0
  93. package/dist/components/field/field.js +2 -2
  94. package/dist/components/footer/footer.js +4 -4
  95. package/dist/components/form/form-reset.d.ts +7 -0
  96. package/dist/components/form/form-reset.d.ts.map +1 -0
  97. package/dist/components/form/form-reset.js +47 -0
  98. package/dist/components/form/form-reset.js.map +1 -0
  99. package/dist/components/form/form.d.ts +5 -0
  100. package/dist/components/form/form.d.ts.map +1 -1
  101. package/dist/components/form/form.js +17 -3
  102. package/dist/components/form/form.js.map +1 -1
  103. package/dist/components/grid/grid.d.ts +5 -0
  104. package/dist/components/grid/grid.d.ts.map +1 -1
  105. package/dist/components/grid/grid.js +86 -4
  106. package/dist/components/grid/grid.js.map +1 -1
  107. package/dist/components/heat-map/heat-map.d.ts +39 -0
  108. package/dist/components/heat-map/heat-map.d.ts.map +1 -0
  109. package/dist/components/heat-map/heat-map.js +306 -0
  110. package/dist/components/heat-map/heat-map.js.map +1 -0
  111. package/dist/components/hero/hero.d.ts +26 -0
  112. package/dist/components/hero/hero.d.ts.map +1 -0
  113. package/dist/components/hero/hero.js +132 -0
  114. package/dist/components/hero/hero.js.map +1 -0
  115. package/dist/components/icon/icon-paths.d.ts +84 -0
  116. package/dist/components/icon/icon-paths.d.ts.map +1 -1
  117. package/dist/components/icon/icon-paths.js +89 -0
  118. package/dist/components/icon/icon-paths.js.map +1 -1
  119. package/dist/components/icon/icon.d.ts +2 -0
  120. package/dist/components/icon/icon.d.ts.map +1 -1
  121. package/dist/components/icon/icon.js +10 -1
  122. package/dist/components/icon/icon.js.map +1 -1
  123. package/dist/components/image/image.d.ts +31 -0
  124. package/dist/components/image/image.d.ts.map +1 -0
  125. package/dist/components/image/image.js +179 -0
  126. package/dist/components/image/image.js.map +1 -0
  127. package/dist/components/input/input.js +4 -4
  128. package/dist/components/lazy/lazy.d.ts +34 -0
  129. package/dist/components/lazy/lazy.d.ts.map +1 -0
  130. package/dist/components/lazy/lazy.js +104 -0
  131. package/dist/components/lazy/lazy.js.map +1 -0
  132. package/dist/components/line-chart/line-chart.d.ts +37 -0
  133. package/dist/components/line-chart/line-chart.d.ts.map +1 -0
  134. package/dist/components/line-chart/line-chart.js +271 -0
  135. package/dist/components/line-chart/line-chart.js.map +1 -0
  136. package/dist/components/list/list-item.d.ts +45 -0
  137. package/dist/components/list/list-item.d.ts.map +1 -0
  138. package/dist/components/list/list-item.js +263 -0
  139. package/dist/components/list/list-item.js.map +1 -0
  140. package/dist/components/list/list.d.ts +50 -0
  141. package/dist/components/list/list.d.ts.map +1 -0
  142. package/dist/components/list/list.js +161 -0
  143. package/dist/components/list/list.js.map +1 -0
  144. package/dist/components/logo-cloud/logo-cloud.d.ts +19 -0
  145. package/dist/components/logo-cloud/logo-cloud.d.ts.map +1 -0
  146. package/dist/components/logo-cloud/logo-cloud.js +66 -0
  147. package/dist/components/logo-cloud/logo-cloud.js.map +1 -0
  148. package/dist/components/modal/modal.d.ts +12 -0
  149. package/dist/components/modal/modal.d.ts.map +1 -1
  150. package/dist/components/modal/modal.js +40 -11
  151. package/dist/components/modal/modal.js.map +1 -1
  152. package/dist/components/page-layout/page-layout.js +8 -8
  153. package/dist/components/pagination/pagination.d.ts +15 -0
  154. package/dist/components/pagination/pagination.d.ts.map +1 -0
  155. package/dist/components/pagination/pagination.js +126 -0
  156. package/dist/components/pagination/pagination.js.map +1 -0
  157. package/dist/components/pagination/pagination.utils.d.ts +3 -0
  158. package/dist/components/pagination/pagination.utils.d.ts.map +1 -0
  159. package/dist/components/pagination/pagination.utils.js +19 -0
  160. package/dist/components/pagination/pagination.utils.js.map +1 -0
  161. package/dist/components/pie-chart/pie-chart.d.ts +33 -0
  162. package/dist/components/pie-chart/pie-chart.d.ts.map +1 -0
  163. package/dist/components/pie-chart/pie-chart.js +233 -0
  164. package/dist/components/pie-chart/pie-chart.js.map +1 -0
  165. package/dist/components/pin-input/pin-input.js +4 -4
  166. package/dist/components/popover/popover.d.ts.map +1 -1
  167. package/dist/components/popover/popover.js +1 -3
  168. package/dist/components/popover/popover.js.map +1 -1
  169. package/dist/components/post-list/post-card.d.ts +16 -0
  170. package/dist/components/post-list/post-card.d.ts.map +1 -0
  171. package/dist/components/post-list/post-card.js +22 -0
  172. package/dist/components/post-list/post-card.js.map +1 -0
  173. package/dist/components/post-list/post-list.d.ts +17 -0
  174. package/dist/components/post-list/post-list.d.ts.map +1 -0
  175. package/dist/components/post-list/post-list.js +23 -0
  176. package/dist/components/post-list/post-list.js.map +1 -0
  177. package/dist/components/pricing/pricing-tier.d.ts +23 -0
  178. package/dist/components/pricing/pricing-tier.d.ts.map +1 -0
  179. package/dist/components/pricing/pricing-tier.js +144 -0
  180. package/dist/components/pricing/pricing-tier.js.map +1 -0
  181. package/dist/components/pricing/pricing.d.ts +18 -0
  182. package/dist/components/pricing/pricing.d.ts.map +1 -0
  183. package/dist/components/pricing/pricing.js +38 -0
  184. package/dist/components/pricing/pricing.js.map +1 -0
  185. package/dist/components/progress/progress.d.ts +17 -0
  186. package/dist/components/progress/progress.d.ts.map +1 -0
  187. package/dist/components/progress/progress.js +109 -0
  188. package/dist/components/progress/progress.js.map +1 -0
  189. package/dist/components/project-grid/project-card.d.ts +17 -0
  190. package/dist/components/project-grid/project-card.d.ts.map +1 -0
  191. package/dist/components/project-grid/project-card.js +23 -0
  192. package/dist/components/project-grid/project-card.js.map +1 -0
  193. package/dist/components/project-grid/project-grid.d.ts +17 -0
  194. package/dist/components/project-grid/project-grid.d.ts.map +1 -0
  195. package/dist/components/project-grid/project-grid.js +23 -0
  196. package/dist/components/project-grid/project-grid.js.map +1 -0
  197. package/dist/components/radio/radio.js +1 -1
  198. package/dist/components/reveal/reveal.constants.d.ts +10 -0
  199. package/dist/components/reveal/reveal.constants.d.ts.map +1 -0
  200. package/dist/components/reveal/reveal.constants.js +11 -0
  201. package/dist/components/reveal/reveal.constants.js.map +1 -0
  202. package/dist/components/reveal/reveal.d.ts +64 -0
  203. package/dist/components/reveal/reveal.d.ts.map +1 -0
  204. package/dist/components/reveal/reveal.js +352 -0
  205. package/dist/components/reveal/reveal.js.map +1 -0
  206. package/dist/components/scroll-progress/scroll-progress.d.ts +32 -0
  207. package/dist/components/scroll-progress/scroll-progress.d.ts.map +1 -0
  208. package/dist/components/scroll-progress/scroll-progress.js +120 -0
  209. package/dist/components/scroll-progress/scroll-progress.js.map +1 -0
  210. package/dist/components/section/card-row.d.ts +30 -0
  211. package/dist/components/section/card-row.d.ts.map +1 -0
  212. package/dist/components/section/card-row.js +174 -0
  213. package/dist/components/section/card-row.js.map +1 -0
  214. package/dist/components/section/card.d.ts +27 -0
  215. package/dist/components/section/card.d.ts.map +1 -0
  216. package/dist/components/section/card.js +205 -0
  217. package/dist/components/section/card.js.map +1 -0
  218. package/dist/components/section/row-item.d.ts +22 -0
  219. package/dist/components/section/row-item.d.ts.map +1 -0
  220. package/dist/components/section/row-item.js +53 -0
  221. package/dist/components/section/row-item.js.map +1 -0
  222. package/dist/components/section/section.d.ts +70 -0
  223. package/dist/components/section/section.d.ts.map +1 -0
  224. package/dist/components/section/section.js +240 -0
  225. package/dist/components/section/section.js.map +1 -0
  226. package/dist/components/select/select.js +3 -3
  227. package/dist/components/series-nav/series-nav.d.ts +29 -0
  228. package/dist/components/series-nav/series-nav.d.ts.map +1 -0
  229. package/dist/components/series-nav/series-nav.js +178 -0
  230. package/dist/components/series-nav/series-nav.js.map +1 -0
  231. package/dist/components/site-header/site-header.d.ts +51 -0
  232. package/dist/components/site-header/site-header.d.ts.map +1 -0
  233. package/dist/components/site-header/site-header.js +296 -0
  234. package/dist/components/site-header/site-header.js.map +1 -0
  235. package/dist/components/skeleton/skeleton.js +7 -7
  236. package/dist/components/sparkline/sparkline.d.ts +19 -0
  237. package/dist/components/sparkline/sparkline.d.ts.map +1 -0
  238. package/dist/components/sparkline/sparkline.js +99 -0
  239. package/dist/components/sparkline/sparkline.js.map +1 -0
  240. package/dist/components/spinner/spinner.d.ts +13 -0
  241. package/dist/components/spinner/spinner.d.ts.map +1 -0
  242. package/dist/components/spinner/spinner.js +65 -0
  243. package/dist/components/spinner/spinner.js.map +1 -0
  244. package/dist/components/split/split.d.ts +23 -0
  245. package/dist/components/split/split.d.ts.map +1 -0
  246. package/dist/components/split/split.js +104 -0
  247. package/dist/components/split/split.js.map +1 -0
  248. package/dist/components/stack/stack.d.ts +21 -0
  249. package/dist/components/stack/stack.d.ts.map +1 -0
  250. package/dist/components/stack/stack.js +102 -0
  251. package/dist/components/stack/stack.js.map +1 -0
  252. package/dist/components/stat-card/stat-card.d.ts +35 -0
  253. package/dist/components/stat-card/stat-card.d.ts.map +1 -0
  254. package/dist/components/stat-card/stat-card.js +199 -0
  255. package/dist/components/stat-card/stat-card.js.map +1 -0
  256. package/dist/components/stats/stat.d.ts +16 -0
  257. package/dist/components/stats/stat.d.ts.map +1 -0
  258. package/dist/components/stats/stat.js +51 -0
  259. package/dist/components/stats/stat.js.map +1 -0
  260. package/dist/components/stats/stats.d.ts +19 -0
  261. package/dist/components/stats/stats.d.ts.map +1 -0
  262. package/dist/components/stats/stats.js +45 -0
  263. package/dist/components/stats/stats.js.map +1 -0
  264. package/dist/components/switch/switch.js +2 -2
  265. package/dist/components/table/data-table.d.ts +115 -27
  266. package/dist/components/table/data-table.d.ts.map +1 -1
  267. package/dist/components/table/data-table.js +1012 -411
  268. package/dist/components/table/data-table.js.map +1 -1
  269. package/dist/components/table/data-table.utils.d.ts +81 -0
  270. package/dist/components/table/data-table.utils.d.ts.map +1 -0
  271. package/dist/components/table/data-table.utils.js +208 -0
  272. package/dist/components/table/data-table.utils.js.map +1 -0
  273. package/dist/components/table/table.d.ts +28 -0
  274. package/dist/components/table/table.d.ts.map +1 -1
  275. package/dist/components/table/table.js +161 -33
  276. package/dist/components/table/table.js.map +1 -1
  277. package/dist/components/team/person.d.ts +19 -0
  278. package/dist/components/team/person.d.ts.map +1 -0
  279. package/dist/components/team/person.js +123 -0
  280. package/dist/components/team/person.js.map +1 -0
  281. package/dist/components/team/team.d.ts +18 -0
  282. package/dist/components/team/team.d.ts.map +1 -0
  283. package/dist/components/team/team.js +36 -0
  284. package/dist/components/team/team.js.map +1 -0
  285. package/dist/components/testimonials/testimonial.d.ts +18 -0
  286. package/dist/components/testimonials/testimonial.d.ts.map +1 -0
  287. package/dist/components/testimonials/testimonial.js +115 -0
  288. package/dist/components/testimonials/testimonial.js.map +1 -0
  289. package/dist/components/testimonials/testimonials.d.ts +18 -0
  290. package/dist/components/testimonials/testimonials.d.ts.map +1 -0
  291. package/dist/components/testimonials/testimonials.js +36 -0
  292. package/dist/components/testimonials/testimonials.js.map +1 -0
  293. package/dist/components/textarea/textarea.js +3 -3
  294. package/dist/components/theme-toggle/theme-toggle.js +1 -1
  295. package/dist/components/time-picker/time-picker.js +3 -3
  296. package/dist/components/timeline/timeline-item.d.ts +18 -0
  297. package/dist/components/timeline/timeline-item.d.ts.map +1 -0
  298. package/dist/components/timeline/timeline-item.js +102 -0
  299. package/dist/components/timeline/timeline-item.js.map +1 -0
  300. package/dist/components/timeline/timeline.d.ts +18 -0
  301. package/dist/components/timeline/timeline.d.ts.map +1 -0
  302. package/dist/components/timeline/timeline.js +30 -0
  303. package/dist/components/timeline/timeline.js.map +1 -0
  304. package/dist/components/toast/toast.d.ts +33 -0
  305. package/dist/components/toast/toast.d.ts.map +1 -0
  306. package/dist/components/toast/toast.js +147 -0
  307. package/dist/components/toast/toast.js.map +1 -0
  308. package/dist/components/toggle-group/toggle-button.d.ts +2 -0
  309. package/dist/components/toggle-group/toggle-button.d.ts.map +1 -1
  310. package/dist/components/toggle-group/toggle-button.js +12 -4
  311. package/dist/components/toggle-group/toggle-button.js.map +1 -1
  312. package/dist/components/toggle-group/toggle-group.js +4 -4
  313. package/dist/components/tooltip/tooltip.js +21 -21
  314. package/dist/components/vertical-nav/vertical-nav-group.js +3 -3
  315. package/dist/components/vertical-nav/vertical-nav-item.js +4 -4
  316. package/dist/components/video-embed/video-embed.d.ts +37 -0
  317. package/dist/components/video-embed/video-embed.d.ts.map +1 -0
  318. package/dist/components/video-embed/video-embed.js +183 -0
  319. package/dist/components/video-embed/video-embed.js.map +1 -0
  320. package/dist/index.d.ts +107 -0
  321. package/dist/index.d.ts.map +1 -0
  322. package/dist/index.js +104 -0
  323. package/dist/index.js.map +1 -0
  324. package/dist/styles/index.css +205 -2
  325. package/dist/styles/reset.d.ts.map +1 -1
  326. package/dist/styles/reset.js +5 -0
  327. package/dist/styles/reset.js.map +1 -1
  328. package/package.json +210 -7
  329. package/src/components/accordion/accordion.constants.ts +5 -0
  330. package/src/components/accordion/accordion.ts +209 -0
  331. package/src/components/alert/alert.constants.ts +3 -0
  332. package/src/components/alert/alert.ts +284 -17
  333. package/src/components/avatar/avatar.ts +84 -0
  334. package/src/components/back-to-top/back-to-top.ts +140 -0
  335. package/src/components/bar-chart/bar-chart.ts +295 -0
  336. package/src/components/breadcrumb/breadcrumb.ts +2 -2
  337. package/src/components/button/button.ts +9 -8
  338. package/src/components/button-group/button-group.ts +4 -4
  339. package/src/components/calendar/calendar.ts +12 -9
  340. package/src/components/chart/chart-base.ts +275 -0
  341. package/src/components/chart/chart.utils.ts +140 -0
  342. package/src/components/code-block/code-block.ts +35 -24
  343. package/src/components/consent/consent.ts +312 -0
  344. package/src/components/consent/consent.utils.ts +110 -0
  345. package/src/components/contact/contact.ts +83 -0
  346. package/src/components/container/container.ts +60 -0
  347. package/src/components/content-card/content-card.ts +4 -4
  348. package/src/components/context-menu/context-menu.ts +426 -0
  349. package/src/components/cron-builder/cron-builder.ts +21 -18
  350. package/src/components/cta/cta.ts +64 -0
  351. package/src/components/drawer/drawer.ts +6 -6
  352. package/src/components/faq/faq-item.ts +110 -0
  353. package/src/components/faq/faq.ts +40 -0
  354. package/src/components/feature-grid/feature-grid.ts +52 -0
  355. package/src/components/feature-grid/feature.ts +84 -0
  356. package/src/components/field/field.ts +2 -2
  357. package/src/components/footer/footer.ts +4 -4
  358. package/src/components/form/form-reset.ts +45 -0
  359. package/src/components/form/form.ts +17 -3
  360. package/src/components/grid/grid.ts +73 -4
  361. package/src/components/heat-map/heat-map.ts +292 -0
  362. package/src/components/hero/hero.ts +132 -0
  363. package/src/components/icon/icon-paths.ts +92 -1
  364. package/src/components/icon/icon.ts +8 -1
  365. package/src/components/image/image.ts +165 -0
  366. package/src/components/input/input.ts +4 -4
  367. package/src/components/lazy/lazy.ts +94 -0
  368. package/src/components/line-chart/line-chart.ts +271 -0
  369. package/src/components/list/list-item.ts +225 -0
  370. package/src/components/list/list.ts +157 -0
  371. package/src/components/logo-cloud/logo-cloud.ts +65 -0
  372. package/src/components/modal/modal.ts +37 -11
  373. package/src/components/page-layout/page-layout.ts +8 -8
  374. package/src/components/pagination/pagination.ts +120 -0
  375. package/src/components/pagination/pagination.utils.ts +14 -0
  376. package/src/components/pie-chart/pie-chart.ts +230 -0
  377. package/src/components/pin-input/pin-input.ts +4 -4
  378. package/src/components/popover/popover.ts +1 -3
  379. package/src/components/post-list/post-card.ts +18 -0
  380. package/src/components/post-list/post-list.ts +19 -0
  381. package/src/components/pricing/pricing-tier.ts +132 -0
  382. package/src/components/pricing/pricing.ts +39 -0
  383. package/src/components/progress/progress.ts +95 -0
  384. package/src/components/project-grid/project-card.ts +19 -0
  385. package/src/components/project-grid/project-grid.ts +19 -0
  386. package/src/components/radio/radio.ts +1 -1
  387. package/src/components/reveal/reveal.constants.ts +20 -0
  388. package/src/components/reveal/reveal.ts +344 -0
  389. package/src/components/scroll-progress/scroll-progress.ts +119 -0
  390. package/src/components/section/card-row.ts +152 -0
  391. package/src/components/section/card.ts +197 -0
  392. package/src/components/section/row-item.ts +38 -0
  393. package/src/components/section/section.ts +232 -0
  394. package/src/components/select/select.ts +3 -3
  395. package/src/components/series-nav/series-nav.ts +164 -0
  396. package/src/components/site-header/site-header.ts +276 -0
  397. package/src/components/skeleton/skeleton.ts +7 -7
  398. package/src/components/sparkline/sparkline.ts +83 -0
  399. package/src/components/spinner/spinner.ts +55 -0
  400. package/src/components/split/split.ts +106 -0
  401. package/src/components/stack/stack.ts +88 -0
  402. package/src/components/stat-card/stat-card.ts +179 -0
  403. package/src/components/stats/stat.ts +49 -0
  404. package/src/components/stats/stats.ts +47 -0
  405. package/src/components/switch/switch.ts +2 -2
  406. package/src/components/table/data-table.ts +1015 -425
  407. package/src/components/table/data-table.utils.ts +276 -0
  408. package/src/components/table/table.ts +168 -38
  409. package/src/components/team/person.ts +113 -0
  410. package/src/components/team/team.ts +37 -0
  411. package/src/components/testimonials/testimonial.ts +108 -0
  412. package/src/components/testimonials/testimonials.ts +37 -0
  413. package/src/components/textarea/textarea.ts +3 -3
  414. package/src/components/theme-toggle/theme-toggle.ts +1 -1
  415. package/src/components/time-picker/time-picker.ts +3 -3
  416. package/src/components/timeline/timeline-item.ts +100 -0
  417. package/src/components/timeline/timeline.ts +31 -0
  418. package/src/components/toast/toast.ts +153 -0
  419. package/src/components/toggle-group/toggle-button.ts +9 -4
  420. package/src/components/toggle-group/toggle-group.ts +4 -4
  421. package/src/components/tooltip/tooltip.ts +21 -21
  422. package/src/components/vertical-nav/vertical-nav-group.ts +3 -3
  423. package/src/components/vertical-nav/vertical-nav-item.ts +4 -4
  424. package/src/components/video-embed/video-embed.ts +162 -0
  425. package/src/index.ts +108 -0
  426. package/src/styles/globals.css +63 -0
  427. package/src/styles/index.css +3 -1
  428. package/src/styles/prose.css +154 -0
  429. package/src/styles/reset.ts +5 -0
  430. package/src/styles/theme.css +53 -1
  431. package/src/styles/typography.css +1 -0
@@ -0,0 +1,95 @@
1
+ import {LitElement, html, css} from "lit";
2
+ import {customElement, property} from "lit/decorators.js";
3
+ import {ifDefined} from "lit/directives/if-defined.js";
4
+ import {resetStyles} from "../../styles/reset.js";
5
+
6
+ /** Determinate when `value` is set, indeterminate otherwise. */
7
+ @customElement("st-progress")
8
+ export class StProgress extends LitElement {
9
+ @property({type: Number}) value?: number;
10
+ @property({type: Number}) max = 100;
11
+ @property({type: String}) label = "Progress";
12
+ @property({type: String, reflect: true}) color: "primary" | "success" | "warning" | "error" =
13
+ "primary";
14
+
15
+ static styles = [
16
+ resetStyles,
17
+ css`
18
+ :host {
19
+ display: block;
20
+ }
21
+ .track {
22
+ height: 0.5rem;
23
+ overflow: hidden;
24
+ border-radius: 999px;
25
+ background: var(--st-color-surface-muted);
26
+ border: 1px solid var(--st-color-border);
27
+ }
28
+ .bar {
29
+ height: 100%;
30
+ width: var(--_pct, 40%);
31
+ border-radius: inherit;
32
+ background: var(--_bar, var(--st-color-primary));
33
+ transition: width 0.2s ease;
34
+ }
35
+ :host([color="success"]) {
36
+ --_bar: var(--st-color-success);
37
+ }
38
+ :host([color="warning"]) {
39
+ --_bar: var(--st-color-warning);
40
+ }
41
+ :host([color="error"]) {
42
+ --_bar: var(--st-color-error);
43
+ }
44
+ .indeterminate .bar {
45
+ animation: slide 1.2s ease-in-out infinite;
46
+ width: 40%;
47
+ }
48
+ @keyframes slide {
49
+ from {
50
+ margin-left: -40%;
51
+ }
52
+ to {
53
+ margin-left: 100%;
54
+ }
55
+ }
56
+ @media (prefers-reduced-motion: reduce) {
57
+ .indeterminate .bar {
58
+ animation: none;
59
+ margin-left: 30%;
60
+ }
61
+ .bar {
62
+ transition: none;
63
+ }
64
+ }
65
+ `,
66
+ ];
67
+
68
+ private get _percent() {
69
+ if (this.value === undefined || this.max <= 0) return undefined;
70
+ return Math.min(100, Math.max(0, (this.value / this.max) * 100));
71
+ }
72
+
73
+ render() {
74
+ const pct = this._percent;
75
+ const determinate = pct !== undefined;
76
+ return html`
77
+ <div
78
+ class="track ${determinate ? "" : "indeterminate"}"
79
+ role="progressbar"
80
+ aria-label=${this.label}
81
+ aria-valuemin="0"
82
+ aria-valuemax=${ifDefined(determinate ? this.max : undefined)}
83
+ aria-valuenow=${ifDefined(determinate ? this.value : undefined)}
84
+ >
85
+ <div class="bar" style=${determinate ? `--_pct:${pct}%` : ""}></div>
86
+ </div>
87
+ `;
88
+ }
89
+ }
90
+
91
+ declare global {
92
+ interface HTMLElementTagNameMap {
93
+ "st-progress": StProgress;
94
+ }
95
+ }
@@ -0,0 +1,19 @@
1
+ import {customElement} from "lit/decorators.js";
2
+ import {StCard} from "../section/card.js";
3
+
4
+ /**
5
+ * One piece of work in a `st-project-grid`: a picture, a title linking to the project, a short
6
+ * description and links to the code or a live demo.
7
+ *
8
+ * Slots: `image`, `meta` (the year, role or technologies), `title` (a heading containing the
9
+ * link), the default slot (the description) and `footer` (links or buttons). Set `tags` (comma
10
+ * separated) for the grid's filter.
11
+ */
12
+ @customElement("st-project-card")
13
+ export class StProjectCard extends StCard {}
14
+
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ "st-project-card": StProjectCard;
18
+ }
19
+ }
@@ -0,0 +1,19 @@
1
+ import {customElement} from "lit/decorators.js";
2
+ import {StCardRow} from "../section/card-row.js";
3
+ import "./project-card.js";
4
+
5
+ /**
6
+ * A portfolio row: your projects as `st-project-card` items in a grid, optionally filtered by
7
+ * topic (`filterable`).
8
+ *
9
+ * Slots: `eyebrow`, `title`, `lead` and the default slot for the `st-project-card` items.
10
+ * Events: `st-filter` `{tag, count}` when a topic is chosen.
11
+ */
12
+ @customElement("st-project-grid")
13
+ export class StProjectGrid extends StCardRow {}
14
+
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ "st-project-grid": StProjectGrid;
18
+ }
19
+ }
@@ -83,7 +83,7 @@ export class StRadio extends LitElement {
83
83
  }
84
84
 
85
85
  :host([checked]) .control::after {
86
- background-color: #ffffff; /* Explicitly white for contrast */
86
+ background-color: var(--st-white); /* Explicitly white for contrast */
87
87
  transform: scale(1);
88
88
  }
89
89
 
@@ -0,0 +1,20 @@
1
+ export const revealEffects = [
2
+ "fade",
3
+ "slide-up",
4
+ "slide-down",
5
+ "slide-left",
6
+ "slide-right",
7
+ "zoom",
8
+ "blur",
9
+ "none",
10
+ ] as const;
11
+
12
+ /**
13
+ * How content appears. The slide effects name the direction the content travels as it arrives:
14
+ * `slide-up` rises from below, `slide-down` drops in from above, `slide-left` moves leftwards
15
+ * from the right, `slide-right` moves rightwards from the left. `none` turns the animation off.
16
+ */
17
+ export type RevealEffect = (typeof revealEffects)[number];
18
+
19
+ /** Lifecycle of a reveal. Absent until the element is armed, so unarmed content is always visible. */
20
+ export type RevealState = "pending" | "in" | "out";
@@ -0,0 +1,344 @@
1
+ import {LitElement, html, css, PropertyValues} from "lit";
2
+ import {customElement, property} from "lit/decorators.js";
3
+ import {resetStyles} from "../../styles/reset.js";
4
+ import type {RevealEffect, RevealState} from "./reveal.constants.js";
5
+
6
+ /** One observer per offset, shared by every reveal on the page. */
7
+ const observers = new Map<number, IntersectionObserver>();
8
+ const instances = new WeakMap<Element, StReveal>();
9
+
10
+ function observerFor(offset: number): IntersectionObserver {
11
+ let observer = observers.get(offset);
12
+ if (!observer) {
13
+ // Shrinking the bottom of the viewport makes content reveal once it has travelled `offset`%
14
+ // into view, and works for elements taller than the screen (a ratio threshold would not).
15
+ observer = new IntersectionObserver(
16
+ (entries) => entries.forEach((entry) => instances.get(entry.target)?.handleIntersection(entry)),
17
+ {rootMargin: `0px 0px -${offset}% 0px`},
18
+ );
19
+ observers.set(offset, observer);
20
+ }
21
+ return observer;
22
+ }
23
+
24
+ /** False for people who prefer reduced motion and when a page opts out with `data-reveal="off"`. */
25
+ function canAnimate(): boolean {
26
+ if (typeof IntersectionObserver === "undefined") return false;
27
+ if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return false;
28
+ return document.documentElement.dataset.reveal !== "off";
29
+ }
30
+
31
+ /** The hidden look. Used for the host itself, or for each child when `stagger` is set. */
32
+ const hidden = css`
33
+ opacity: 0;
34
+ transform: translate3d(var(--_tx), var(--_ty), 0) scale(var(--_scale));
35
+ filter: blur(var(--_blur));
36
+ will-change: opacity, transform;
37
+ `;
38
+
39
+ const shown = css`
40
+ opacity: 1;
41
+ transform: none;
42
+ filter: none;
43
+ `;
44
+
45
+ const transitions = css`
46
+ transition:
47
+ opacity var(--_duration) var(--_ease),
48
+ transform var(--_duration) var(--_ease),
49
+ filter var(--_duration) var(--_ease);
50
+ `;
51
+
52
+ /**
53
+ * Animates its content into view as it is scrolled to, and optionally back out as it leaves.
54
+ *
55
+ * The content always stays in the DOM, so search engines, screen readers and find-in-page see
56
+ * all of it. Content is only visually hidden once the element is armed in the browser, and only
57
+ * when it starts below the fold. Without JavaScript, with reduced motion, or with
58
+ * `<html data-reveal="off">`, everything is simply visible.
59
+ *
60
+ * Set `stagger` (milliseconds) to animate the direct children one after another instead of the
61
+ * element as a whole.
62
+ *
63
+ * Events: `st-reveal-in` and `st-reveal-out` (bubbles, composed) when the state changes.
64
+ */
65
+ @customElement("st-reveal")
66
+ export class StReveal extends LitElement {
67
+ @property({type: String, reflect: true}) effect: RevealEffect = "slide-up";
68
+ /** Length of the animation in milliseconds. */
69
+ @property({type: Number}) duration = 600;
70
+ /** Wait before the animation starts, in milliseconds. */
71
+ @property({type: Number}) delay = 0;
72
+ /** How far slide effects travel (any CSS length). */
73
+ @property({type: String}) distance = "2rem";
74
+ /** Any CSS timing function. Defaults to a gentle ease-out. */
75
+ @property({type: String}) easing = "";
76
+ /** Percentage of the viewport height the element must travel into view before it reveals. */
77
+ @property({type: Number}) offset = 10;
78
+ /** Milliseconds between each child when animating children in sequence (0 animates as one). */
79
+ @property({type: Number}) stagger = 0;
80
+ /** Animate out as the content leaves the viewport, and back in when it returns. */
81
+ @property({type: Boolean}) out = false;
82
+
83
+ private _state?: RevealState;
84
+ private _armFrame = 0;
85
+ private _observed?: IntersectionObserver;
86
+
87
+ static styles = [
88
+ resetStyles,
89
+ css`
90
+ :host {
91
+ display: block;
92
+ --_distance: 2rem;
93
+ --_duration: var(--st-duration-reveal, 600ms);
94
+ --_delay: 0ms;
95
+ --_ease: var(--st-ease-out, cubic-bezier(0.22, 1, 0.36, 1));
96
+ --_stagger: 0ms;
97
+ --_tx: 0;
98
+ --_ty: var(--_distance);
99
+ --_scale: 1;
100
+ --_blur: 0;
101
+ }
102
+
103
+ :host([effect="fade"]) {
104
+ --_ty: 0;
105
+ }
106
+ :host([effect="slide-up"]) {
107
+ --_ty: var(--_distance);
108
+ }
109
+ :host([effect="slide-down"]) {
110
+ --_ty: calc(var(--_distance) * -1);
111
+ }
112
+ :host([effect="slide-left"]) {
113
+ --_tx: var(--_distance);
114
+ --_ty: 0;
115
+ }
116
+ :host([effect="slide-right"]) {
117
+ --_tx: calc(var(--_distance) * -1);
118
+ --_ty: 0;
119
+ }
120
+ :host([effect="zoom"]) {
121
+ --_ty: 0;
122
+ --_scale: 0.92;
123
+ }
124
+ :host([effect="blur"]) {
125
+ --_ty: 0;
126
+ --_blur: 0.75rem;
127
+ }
128
+
129
+ /* Vertical slides keep travelling the way the content left the screen. */
130
+ :host([data-reveal="out"][data-exit="top"][effect="slide-up"]),
131
+ :host([data-reveal="out"][data-exit="top"][effect="slide-down"]) {
132
+ --_ty: calc(var(--_distance) * -1);
133
+ }
134
+ :host([data-reveal="out"][data-exit="bottom"][effect="slide-up"]),
135
+ :host([data-reveal="out"][data-exit="bottom"][effect="slide-down"]) {
136
+ --_ty: var(--_distance);
137
+ }
138
+
139
+ /* Whole element */
140
+ :host([data-reveal]:not([data-staggered])) {
141
+ ${transitions}
142
+ transition-delay: var(--_delay);
143
+ }
144
+ :host([data-reveal="pending"]:not([data-staggered])),
145
+ :host([data-reveal="out"]:not([data-staggered])) {
146
+ ${hidden}
147
+ }
148
+ :host([data-reveal="in"]:not([data-staggered])) {
149
+ ${shown}
150
+ }
151
+
152
+ /* Children in sequence */
153
+ :host([data-staggered][data-reveal]) ::slotted(*) {
154
+ ${transitions}
155
+ transition-delay: calc(var(--_delay) + var(--st-reveal-i, 0) * var(--_stagger));
156
+ }
157
+ :host([data-staggered][data-reveal="pending"]) ::slotted(*),
158
+ :host([data-staggered][data-reveal="out"]) ::slotted(*) {
159
+ ${hidden}
160
+ }
161
+ :host([data-staggered][data-reveal="in"]) ::slotted(*) {
162
+ ${shown}
163
+ }
164
+
165
+ /* Replay jumps back to the hidden state without animating there. */
166
+ :host([data-instant]),
167
+ :host([data-instant]) ::slotted(*) {
168
+ transition: none !important;
169
+ }
170
+
171
+ @media (prefers-reduced-motion: reduce), print {
172
+ :host,
173
+ :host ::slotted(*) {
174
+ opacity: 1 !important;
175
+ transform: none !important;
176
+ filter: none !important;
177
+ transition: none !important;
178
+ }
179
+ }
180
+ `,
181
+ ];
182
+
183
+ /** Current phase, or undefined while the content is simply visible (never armed). */
184
+ get state(): RevealState | undefined {
185
+ return this._state;
186
+ }
187
+
188
+ connectedCallback() {
189
+ super.connectedCallback();
190
+ this.addEventListener("focusin", this._onFocusIn);
191
+ this._arm();
192
+ }
193
+
194
+ disconnectedCallback() {
195
+ this.removeEventListener("focusin", this._onFocusIn);
196
+ this._disarm();
197
+ super.disconnectedCallback();
198
+ }
199
+
200
+ /** Hides the content again and plays the entry animation, for demos and previews. */
201
+ replay() {
202
+ if (this.effect === "none" || !canAnimate()) return;
203
+ if (!this._observed) this._arm();
204
+ this._hideInstantly();
205
+ requestAnimationFrame(() => {
206
+ requestAnimationFrame(() => {
207
+ if (this._isInViewport()) this._setState("in");
208
+ });
209
+ });
210
+ }
211
+
212
+ protected updated(changed: PropertyValues<this>) {
213
+ this.style.setProperty("--_duration", `${this.duration}ms`);
214
+ this.style.setProperty("--_delay", `${this.delay}ms`);
215
+ this.style.setProperty("--_stagger", `${this.stagger}ms`);
216
+ this.style.setProperty("--_distance", this.distance);
217
+ if (this.easing) this.style.setProperty("--_ease", this.easing);
218
+ else this.style.removeProperty("--_ease");
219
+
220
+ // Only a genuine change re-arms: on the first update every property is "changed".
221
+ const retune = (["effect", "offset", "out", "stagger"] as const).some(
222
+ (key) => changed.has(key) && changed.get(key) !== undefined,
223
+ );
224
+ if (retune) {
225
+ this._disarm();
226
+ this._arm();
227
+ }
228
+ }
229
+
230
+ // ------------------------------------------------------------------ arming
231
+
232
+ private _arm(allowRetry = true) {
233
+ if (this._observed || this.effect === "none" || !canAnimate()) return;
234
+
235
+ // Content that has just been added may not have a box yet. Give it one frame to get laid out
236
+ // before judging where it is, so content already on screen is never made to fade in.
237
+ if (allowRetry && this.getClientRects().length === 0) {
238
+ cancelAnimationFrame(this._armFrame);
239
+ this._armFrame = requestAnimationFrame(() => this._arm(false));
240
+ return;
241
+ }
242
+ this.toggleAttribute("data-staggered", this.stagger > 0);
243
+
244
+ const belowFold = this._startsBelowFold();
245
+ // Content already on screen, or already scrolled past, is shown straight away.
246
+ if (belowFold) this._hideInstantly();
247
+ else this._setState("in", false);
248
+
249
+ this._observed = observerFor(this.offset);
250
+ instances.set(this, this);
251
+ this._observed.observe(this);
252
+ }
253
+
254
+ /** Whether the content starts below the visible part of the screen. */
255
+ private _startsBelowFold(): boolean {
256
+ const limit = window.innerHeight * (1 - this.offset / 100);
257
+ if (this.getClientRects().length > 0) return this.getBoundingClientRect().top > limit;
258
+
259
+ // Not displayed. Inside a row that skips off-screen work (content-visibility) the nearest
260
+ // displayed ancestor says where we are; inside something hidden we have no position, so we
261
+ // wait and reveal as soon as we are shown on screen.
262
+ let node: Element | null = this.parentElement ?? (this.getRootNode() as ShadowRoot).host ?? null;
263
+ while (node && node.getClientRects().length === 0) {
264
+ node = node.parentElement ?? (node.getRootNode() as ShadowRoot).host ?? null;
265
+ }
266
+ if (node && getComputedStyle(node).contentVisibility === "auto") {
267
+ return node.getBoundingClientRect().top > limit;
268
+ }
269
+ return true;
270
+ }
271
+
272
+ private _disarm() {
273
+ cancelAnimationFrame(this._armFrame);
274
+ this._observed?.unobserve(this);
275
+ this._observed = undefined;
276
+ this._state = undefined;
277
+ this.removeAttribute("data-reveal");
278
+ this.removeAttribute("data-exit");
279
+ }
280
+
281
+ /** Moves to the hidden state without animating there (the hide itself must never be seen). */
282
+ private _hideInstantly() {
283
+ this.toggleAttribute("data-instant", true);
284
+ this._setState("pending", false);
285
+ void this.offsetWidth; // flush the hidden style while transitions are off
286
+ // Wait for the settings (distance, duration...) to be applied so they too skip the transition.
287
+ void this.updateComplete.then(() => {
288
+ void this.offsetWidth;
289
+ requestAnimationFrame(() => this.removeAttribute("data-instant"));
290
+ });
291
+ }
292
+
293
+ /** @internal Called by the shared observer. */
294
+ handleIntersection(entry: IntersectionObserverEntry) {
295
+ if (entry.isIntersecting) {
296
+ if (this._state !== "in") this._setState("in");
297
+ if (!this.out) this._unobserve();
298
+ } else if (this.out && this._state === "in") {
299
+ const rect = entry.boundingClientRect;
300
+ this.setAttribute("data-exit", rect.top + rect.height / 2 < window.innerHeight / 2 ? "top" : "bottom");
301
+ this._setState("out");
302
+ }
303
+ }
304
+
305
+ private _unobserve() {
306
+ this._observed?.unobserve(this);
307
+ this._observed = undefined;
308
+ }
309
+
310
+ private _setState(state: RevealState, announce = true) {
311
+ if (this._state === state) return;
312
+ this._state = state;
313
+ this.setAttribute("data-reveal", state);
314
+ if (announce && state !== "pending") {
315
+ this.dispatchEvent(new CustomEvent(`st-reveal-${state}`, {bubbles: true, composed: true}));
316
+ }
317
+ }
318
+
319
+ private _isInViewport() {
320
+ const rect = this.getBoundingClientRect();
321
+ return rect.bottom > 0 && rect.top < window.innerHeight * (1 - this.offset / 100);
322
+ }
323
+
324
+ /** Keyboard users must never land on invisible content. */
325
+ private _onFocusIn = () => {
326
+ if (this._state === "pending" || this._state === "out") this._setState("in");
327
+ };
328
+
329
+ private _onSlotChange(e: Event) {
330
+ (e.target as HTMLSlotElement)
331
+ .assignedElements()
332
+ .forEach((child, i) => (child as HTMLElement).style.setProperty("--st-reveal-i", String(i)));
333
+ }
334
+
335
+ render() {
336
+ return html`<slot @slotchange=${this._onSlotChange}></slot>`;
337
+ }
338
+ }
339
+
340
+ declare global {
341
+ interface HTMLElementTagNameMap {
342
+ "st-reveal": StReveal;
343
+ }
344
+ }
@@ -0,0 +1,119 @@
1
+ import {LitElement, html, css} from "lit";
2
+ import {customElement, property} from "lit/decorators.js";
3
+ import {resetStyles} from "../../styles/reset.js";
4
+
5
+ /**
6
+ * A thin bar showing how far down the page (or an article) the reader has scrolled.
7
+ *
8
+ * By default it tracks the whole page and sticks to the top of the screen. Point `target` at an
9
+ * element (such as the article) to measure progress through just that element. The bar is
10
+ * decorative and hidden from screen readers.
11
+ *
12
+ * Events: `st-scroll-progress` with `detail.progress` (0 to 1), only when the value changes.
13
+ */
14
+ @customElement("st-scroll-progress")
15
+ export class StScrollProgress extends LitElement {
16
+ /** CSS selector of the element to measure. Empty tracks the whole page. */
17
+ @property({type: String}) target = "";
18
+ @property({type: String, reflect: true}) position: "top" | "bottom" = "top";
19
+
20
+ private _progress = 0;
21
+ private _frame = 0;
22
+
23
+ static styles = [
24
+ resetStyles,
25
+ css`
26
+ :host {
27
+ position: fixed;
28
+ left: 0;
29
+ right: 0;
30
+ top: 0;
31
+ z-index: var(--st-scroll-progress-z, 100);
32
+ height: var(--st-scroll-progress-height, 0.25rem);
33
+ pointer-events: none;
34
+ }
35
+
36
+ :host([position="bottom"]) {
37
+ top: auto;
38
+ bottom: 0;
39
+ }
40
+
41
+ .bar {
42
+ width: 100%;
43
+ height: 100%;
44
+ background: var(--st-scroll-progress-color, var(--st-color-primary));
45
+ transform: scaleX(var(--_progress, 0));
46
+ transform-origin: left;
47
+ transition: transform 0.1s linear;
48
+ }
49
+
50
+ @media (prefers-reduced-motion: reduce) {
51
+ .bar {
52
+ transition: none;
53
+ }
54
+ }
55
+ `,
56
+ ];
57
+
58
+ /** Progress through the page or target, from 0 to 1. */
59
+ get progress() {
60
+ return this._progress;
61
+ }
62
+
63
+ connectedCallback() {
64
+ super.connectedCallback();
65
+ window.addEventListener("scroll", this._schedule, {passive: true});
66
+ window.addEventListener("resize", this._schedule, {passive: true});
67
+ this._schedule();
68
+ }
69
+
70
+ disconnectedCallback() {
71
+ window.removeEventListener("scroll", this._schedule);
72
+ window.removeEventListener("resize", this._schedule);
73
+ cancelAnimationFrame(this._frame);
74
+ super.disconnectedCallback();
75
+ }
76
+
77
+ protected updated() {
78
+ this._schedule();
79
+ }
80
+
81
+ private _schedule = () => {
82
+ cancelAnimationFrame(this._frame);
83
+ this._frame = requestAnimationFrame(() => this._measure());
84
+ };
85
+
86
+ private _measure() {
87
+ const element = this.target ? document.querySelector(this.target) : null;
88
+ let progress: number;
89
+
90
+ if (element) {
91
+ // Read: how much of the element has scrolled past the top of the screen.
92
+ const rect = element.getBoundingClientRect();
93
+ const scrollable = rect.height - window.innerHeight;
94
+ progress = scrollable > 0 ? -rect.top / scrollable : rect.top < 0 ? 1 : 0;
95
+ } else {
96
+ const root = document.documentElement;
97
+ const scrollable = root.scrollHeight - window.innerHeight;
98
+ progress = scrollable > 0 ? window.scrollY / scrollable : 0;
99
+ }
100
+
101
+ progress = Math.min(1, Math.max(0, progress));
102
+ if (progress === this._progress) return;
103
+ this._progress = progress;
104
+ this.style.setProperty("--_progress", String(progress));
105
+ this.dispatchEvent(
106
+ new CustomEvent("st-scroll-progress", {detail: {progress}, bubbles: true, composed: true}),
107
+ );
108
+ }
109
+
110
+ render() {
111
+ return html`<div class="bar" aria-hidden="true"></div>`;
112
+ }
113
+ }
114
+
115
+ declare global {
116
+ interface HTMLElementTagNameMap {
117
+ "st-scroll-progress": StScrollProgress;
118
+ }
119
+ }