@sdxc/ui 2026.10.29 → 2026.11.1

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 (411) hide show
  1. package/README.md +187 -113
  2. package/dist/{behaviors → app/behaviors}/drag-session.js +1 -1
  3. package/dist/{behaviors → app/behaviors}/toaster.js +1 -1
  4. package/dist/{components → app}/chart.d.ts +1 -1
  5. package/dist/{components → app}/chart.js +18 -34
  6. package/dist/{components → app}/context-menu.d.ts +2 -2
  7. package/dist/{components → app}/context-menu.js +8 -7
  8. package/dist/{components → app}/drop-indicator.js +3 -3
  9. package/dist/{components → app}/drop-zone.js +3 -3
  10. package/dist/{components → app}/empty.d.ts +1 -1
  11. package/dist/{components → app}/empty.js +11 -21
  12. package/dist/{components → app}/file-trigger.js +2 -2
  13. package/dist/{components → app}/grid-list.d.ts +1 -1
  14. package/dist/{components → app}/grid-list.js +16 -18
  15. package/dist/app/index.d.ts +41 -0
  16. package/dist/app/index.js +41 -0
  17. package/dist/{components → app}/menubar.js +5 -7
  18. package/dist/{mixins → app/mixins}/drag-reorder.js +1 -1
  19. package/dist/{mixins → app/mixins}/drop-zone.js +1 -1
  20. package/dist/{mixins → app/mixins}/grid-list-keys.js +2 -2
  21. package/dist/{mixins → app/mixins}/menubar-keys.js +2 -2
  22. package/dist/{mixins → app/mixins}/resize-handle.js +3 -3
  23. package/dist/{mixins/treeKeys.js → app/mixins/tree-keys.js} +2 -2
  24. package/dist/{components → app}/resizable.js +7 -10
  25. package/dist/{components → app}/shortcut-list.js +4 -3
  26. package/dist/{components → app}/skeleton.js +3 -3
  27. package/dist/{styles → app/styles}/chart-palette.d.ts +1 -1
  28. package/dist/{styles → app/styles}/graphic-host.d.ts +1 -1
  29. package/dist/{styles → app/styles}/legend-toggle.d.ts +1 -1
  30. package/dist/{components → app}/table.js +12 -15
  31. package/dist/{components → app}/toast.js +18 -24
  32. package/dist/{components → app}/toolbar.js +3 -3
  33. package/dist/{components → app}/tree.d.ts +1 -1
  34. package/dist/{components → app}/tree.js +10 -14
  35. package/dist/{utils → app/utils}/chart-path.d.ts +1 -1
  36. package/dist/{utils → app/utils}/chart-path.js +2 -2
  37. package/dist/{utils → app/utils}/chart-scale.js +1 -1
  38. package/dist/behaviors/index.d.ts +0 -5
  39. package/dist/behaviors/index.js +0 -5
  40. package/dist/{components → chat}/attachment.d.ts +1 -1
  41. package/dist/{components → chat}/attachment.js +17 -23
  42. package/dist/{behaviors → chat/behaviors}/scroll-follow-model.js +1 -1
  43. package/dist/{components → chat}/bubble.js +14 -14
  44. package/dist/chat/index.d.ts +16 -0
  45. package/dist/chat/index.js +16 -0
  46. package/dist/{components → chat}/marker.js +6 -8
  47. package/dist/{components → chat}/message-scroller.d.ts +1 -1
  48. package/dist/{components → chat}/message-scroller.js +12 -18
  49. package/dist/{components → chat}/message.js +10 -12
  50. package/dist/{mixins → chat/mixins}/message-follow.js +2 -2
  51. package/dist/{components → color}/color-area.js +7 -10
  52. package/dist/{components → color}/color-field.js +7 -6
  53. package/dist/{components → color}/color-picker.d.ts +1 -1
  54. package/dist/{components → color}/color-picker.js +9 -12
  55. package/dist/{components → color}/color-slider.js +10 -13
  56. package/dist/{components → color}/color-swatch-picker.js +4 -5
  57. package/dist/{components → color}/color-swatch.js +3 -4
  58. package/dist/{components → color}/color-wheel.js +5 -6
  59. package/dist/color/index.d.ts +21 -0
  60. package/dist/color/index.js +21 -0
  61. package/dist/{mixins → color/mixins}/color-area-drag.d.ts +1 -1
  62. package/dist/{mixins → color/mixins}/color-area-drag.js +2 -2
  63. package/dist/{mixins → color/mixins}/color-preview.js +1 -1
  64. package/dist/{mixins → color/mixins}/color-wheel-drag.js +1 -1
  65. package/dist/{styles → color/styles}/rtl-aware-gradient-direction.d.ts +1 -1
  66. package/dist/components/accordion.d.ts +3 -3
  67. package/dist/components/accordion.js +19 -15
  68. package/dist/components/alert-dialog.js +5 -4
  69. package/dist/components/alert.js +10 -20
  70. package/dist/components/aspect-ratio.js +3 -4
  71. package/dist/components/avatar.d.ts +6 -6
  72. package/dist/components/avatar.js +56 -8
  73. package/dist/components/badge.js +11 -9
  74. package/dist/components/breadcrumbs.js +7 -9
  75. package/dist/components/button.d.ts +8 -6
  76. package/dist/components/button.js +22 -14
  77. package/dist/components/calendar.js +13 -24
  78. package/dist/components/card.js +9 -11
  79. package/dist/components/carousel.d.ts +1 -1
  80. package/dist/components/carousel.js +12 -20
  81. package/dist/components/checkbox-group.js +3 -3
  82. package/dist/components/checkbox.js +2 -2
  83. package/dist/components/combobox.js +6 -6
  84. package/dist/components/command.js +10 -14
  85. package/dist/components/cta-group.d.ts +30 -14
  86. package/dist/components/cta-group.js +29 -10
  87. package/dist/components/date-field.js +2 -1
  88. package/dist/components/date-picker.js +4 -5
  89. package/dist/components/date-range-picker.js +3 -2
  90. package/dist/components/description.js +2 -1
  91. package/dist/components/dialog-dismiss.d.ts +18 -0
  92. package/dist/components/dialog-dismiss.js +15 -0
  93. package/dist/components/dialog.js +11 -15
  94. package/dist/components/disclosure.js +10 -14
  95. package/dist/components/drawer.js +3 -4
  96. package/dist/components/field-error.js +3 -3
  97. package/dist/components/form.js +2 -1
  98. package/dist/components/group.js +3 -3
  99. package/dist/components/header.js +3 -3
  100. package/dist/components/heading-scope.js +2 -1
  101. package/dist/components/heading.d.ts +4 -4
  102. package/dist/components/heading.js +7 -7
  103. package/dist/components/highlight.js +17 -12
  104. package/dist/components/hover-card.js +6 -8
  105. package/dist/components/image-placeholder.js +13 -19
  106. package/dist/components/index.d.ts +6 -38
  107. package/dist/components/index.js +6 -38
  108. package/dist/components/input.js +3 -4
  109. package/dist/components/item.js +10 -19
  110. package/dist/components/keyboard.js +3 -3
  111. package/dist/components/label.js +2 -1
  112. package/dist/components/link-button.d.ts +7 -5
  113. package/dist/components/link-button.js +16 -11
  114. package/dist/components/link.js +3 -4
  115. package/dist/components/listbox.js +6 -11
  116. package/dist/components/menu.js +5 -6
  117. package/dist/components/meter.js +5 -6
  118. package/dist/components/modal.js +9 -11
  119. package/dist/components/nav-link.d.ts +1 -1
  120. package/dist/components/nav-link.js +3 -4
  121. package/dist/components/navigation-menu.js +17 -23
  122. package/dist/components/number-field.js +8 -10
  123. package/dist/components/otp-field.js +2 -1
  124. package/dist/components/overlay-arrow.js +3 -4
  125. package/dist/components/pagination.js +8 -10
  126. package/dist/components/popover.js +3 -4
  127. package/dist/components/progress-bar.js +5 -5
  128. package/dist/components/radio-group.js +5 -7
  129. package/dist/components/range-calendar.js +3 -3
  130. package/dist/components/scroll-area.js +4 -5
  131. package/dist/components/search-field.js +8 -11
  132. package/dist/components/section.js +2 -1
  133. package/dist/components/select.js +10 -22
  134. package/dist/components/selection-indicator.js +3 -3
  135. package/dist/components/sentinel-row.js +3 -3
  136. package/dist/components/separator.js +3 -3
  137. package/dist/components/shared-element.js +2 -1
  138. package/dist/components/sheet.js +6 -7
  139. package/dist/components/sidebar.js +48 -76
  140. package/dist/components/slider.js +8 -10
  141. package/dist/components/spinner.js +3 -3
  142. package/dist/components/switch.js +3 -3
  143. package/dist/components/tabs.js +9 -12
  144. package/dist/components/tag-group.js +7 -9
  145. package/dist/components/text-field.js +2 -1
  146. package/dist/components/text.js +2 -1
  147. package/dist/components/textarea.js +3 -4
  148. package/dist/components/time-field.js +2 -1
  149. package/dist/components/toggle-button.js +5 -7
  150. package/dist/components/tooltip.js +3 -3
  151. package/dist/components/typeset.js +128 -123
  152. package/dist/components/youtube-embed.js +2 -1
  153. package/dist/docs/anchor-heading.d.ts +41 -0
  154. package/dist/docs/anchor-heading.js +62 -0
  155. package/dist/docs/callout.d.ts +46 -0
  156. package/dist/docs/callout.js +61 -0
  157. package/dist/docs/code-block.d.ts +74 -0
  158. package/dist/docs/code-block.js +322 -0
  159. package/dist/docs/code-tabs-sync.d.ts +26 -0
  160. package/dist/docs/code-tabs-sync.js +12 -0
  161. package/dist/docs/code-tabs.d.ts +53 -0
  162. package/dist/docs/code-tabs.js +102 -0
  163. package/dist/docs/copy-button.d.ts +31 -0
  164. package/dist/docs/copy-button.js +49 -0
  165. package/dist/docs/docs-feedback.d.ts +55 -0
  166. package/dist/docs/docs-feedback.js +72 -0
  167. package/dist/docs/docs-footer.d.ts +40 -0
  168. package/dist/docs/docs-footer.js +45 -0
  169. package/dist/docs/docs-hub.d.ts +93 -0
  170. package/dist/docs/docs-hub.js +142 -0
  171. package/dist/docs/docs-layout.d.ts +90 -0
  172. package/dist/docs/docs-layout.js +166 -0
  173. package/dist/docs/docs-nav-tools.d.ts +25 -0
  174. package/dist/docs/docs-nav-tools.js +14 -0
  175. package/dist/docs/docs-nav.d.ts +53 -0
  176. package/dist/docs/docs-nav.js +76 -0
  177. package/dist/docs/docs-not-found.d.ts +68 -0
  178. package/dist/docs/docs-not-found.js +100 -0
  179. package/dist/docs/docs-page-header.d.ts +55 -0
  180. package/dist/docs/docs-page-header.js +54 -0
  181. package/dist/docs/docs-pager.d.ts +46 -0
  182. package/dist/docs/docs-pager.js +74 -0
  183. package/dist/docs/file-tree.d.ts +57 -0
  184. package/dist/docs/file-tree.js +142 -0
  185. package/dist/docs/index.d.ts +38 -0
  186. package/dist/docs/index.js +38 -0
  187. package/dist/docs/install-command.d.ts +54 -0
  188. package/dist/docs/install-command.js +33 -0
  189. package/dist/docs/mixins/code-tabs-sync.d.ts +47 -0
  190. package/dist/docs/mixins/code-tabs-sync.js +137 -0
  191. package/dist/docs/mixins/copy-feedback.d.ts +25 -0
  192. package/dist/docs/mixins/copy-feedback.js +49 -0
  193. package/dist/docs/mixins/copy-from-url.d.ts +27 -0
  194. package/dist/docs/mixins/copy-from-url.js +95 -0
  195. package/dist/docs/mixins/docs-nav-tools.d.ts +27 -0
  196. package/dist/docs/mixins/docs-nav-tools.js +97 -0
  197. package/dist/docs/mixins/toc-spy.d.ts +30 -0
  198. package/dist/docs/mixins/toc-spy.js +165 -0
  199. package/dist/docs/next-steps.d.ts +45 -0
  200. package/dist/docs/next-steps.js +79 -0
  201. package/dist/docs/page-actions.d.ts +77 -0
  202. package/dist/docs/page-actions.js +78 -0
  203. package/dist/docs/plan-notice.d.ts +28 -0
  204. package/dist/docs/plan-notice.js +33 -0
  205. package/dist/docs/props-table.d.ts +64 -0
  206. package/dist/docs/props-table.js +147 -0
  207. package/dist/docs/steps.d.ts +51 -0
  208. package/dist/docs/steps.js +112 -0
  209. package/dist/docs/table-of-contents.d.ts +49 -0
  210. package/dist/docs/table-of-contents.js +139 -0
  211. package/dist/docs/ui-label.d.ts +51 -0
  212. package/dist/docs/ui-label.js +64 -0
  213. package/dist/docs/utils/docs-tree.d.ts +81 -0
  214. package/dist/docs/utils/docs-tree.js +57 -0
  215. package/dist/docs/utils/reveal-in-scroller.d.ts +19 -0
  216. package/dist/docs/utils/reveal-in-scroller.js +43 -0
  217. package/dist/landing/accent-text.d.ts +47 -0
  218. package/dist/landing/accent-text.js +107 -0
  219. package/dist/landing/animations/entrance.d.ts +40 -0
  220. package/dist/landing/animations/entrance.js +52 -0
  221. package/dist/landing/announcement-chip.d.ts +45 -0
  222. package/dist/landing/announcement-chip.js +36 -0
  223. package/dist/landing/author-band.d.ts +78 -0
  224. package/dist/landing/author-band.js +190 -0
  225. package/dist/landing/bento.d.ts +99 -0
  226. package/dist/landing/bento.js +138 -0
  227. package/dist/landing/changelog-strip.d.ts +74 -0
  228. package/dist/landing/changelog-strip.js +201 -0
  229. package/dist/{patterns → landing}/check-row.js +5 -7
  230. package/dist/{patterns → landing}/closing-cta.d.ts +4 -4
  231. package/dist/{patterns → landing}/closing-cta.js +8 -8
  232. package/dist/landing/code-stage.d.ts +93 -0
  233. package/dist/landing/code-stage.js +434 -0
  234. package/dist/landing/crosshair.d.ts +44 -0
  235. package/dist/landing/crosshair.js +48 -0
  236. package/dist/landing/curriculum.d.ts +79 -0
  237. package/dist/landing/curriculum.js +194 -0
  238. package/dist/landing/drawn-chart.d.ts +74 -0
  239. package/dist/landing/drawn-chart.js +377 -0
  240. package/dist/landing/event-ticker.d.ts +71 -0
  241. package/dist/landing/event-ticker.js +331 -0
  242. package/dist/landing/fan-out-diagram.d.ts +70 -0
  243. package/dist/landing/fan-out-diagram.js +481 -0
  244. package/dist/{patterns → landing}/faq-band.d.ts +7 -5
  245. package/dist/{patterns → landing}/faq-band.js +11 -12
  246. package/dist/landing/feature-band.d.ts +108 -0
  247. package/dist/landing/feature-band.js +67 -0
  248. package/dist/landing/feature.d.ts +148 -0
  249. package/dist/landing/feature.js +219 -0
  250. package/dist/landing/flow-diagram.d.ts +62 -0
  251. package/dist/landing/flow-diagram.js +240 -0
  252. package/dist/{patterns → landing}/icon-well.d.ts +17 -7
  253. package/dist/landing/icon-well.js +31 -0
  254. package/dist/landing/index.d.ts +52 -0
  255. package/dist/landing/index.js +52 -0
  256. package/dist/{patterns → landing}/install-tabs.js +4 -5
  257. package/dist/landing/landing-header.d.ts +103 -0
  258. package/dist/landing/landing-header.js +110 -0
  259. package/dist/landing/landing-hero.d.ts +119 -0
  260. package/dist/landing/landing-hero.js +172 -0
  261. package/dist/landing/landing-section.d.ts +110 -0
  262. package/dist/landing/landing-section.js +183 -0
  263. package/dist/landing/logo-cloud.d.ts +56 -0
  264. package/dist/landing/logo-cloud.js +160 -0
  265. package/dist/landing/logo-sentence.d.ts +38 -0
  266. package/dist/landing/logo-sentence.js +51 -0
  267. package/dist/landing/marquee.d.ts +44 -0
  268. package/dist/landing/marquee.js +97 -0
  269. package/dist/landing/motion-loop.d.ts +43 -0
  270. package/dist/landing/motion-loop.js +42 -0
  271. package/dist/landing/pricing-band.d.ts +94 -0
  272. package/dist/landing/pricing-band.js +151 -0
  273. package/dist/landing/product-frame.d.ts +108 -0
  274. package/dist/landing/product-frame.js +202 -0
  275. package/dist/{patterns → landing}/proof-strip.d.ts +4 -4
  276. package/dist/{patterns → landing}/proof-strip.js +3 -3
  277. package/dist/landing/rails.d.ts +45 -0
  278. package/dist/landing/rails.js +69 -0
  279. package/dist/landing/rotating-text.d.ts +44 -0
  280. package/dist/landing/rotating-text.js +67 -0
  281. package/dist/landing/segmented-stage.d.ts +75 -0
  282. package/dist/landing/segmented-stage.js +141 -0
  283. package/dist/landing/sequence-diagram.d.ts +65 -0
  284. package/dist/landing/sequence-diagram.js +348 -0
  285. package/dist/landing/site-footer.d.ts +100 -0
  286. package/dist/landing/site-footer.js +274 -0
  287. package/dist/landing/site-header.d.ts +126 -0
  288. package/dist/landing/site-header.js +595 -0
  289. package/dist/{components → landing}/split.d.ts +14 -4
  290. package/dist/{components → landing}/split.js +30 -21
  291. package/dist/landing/sponsor-wall.d.ts +81 -0
  292. package/dist/landing/sponsor-wall.js +241 -0
  293. package/dist/{components → landing}/stat-strip.d.ts +31 -4
  294. package/dist/landing/stat-strip.js +105 -0
  295. package/dist/landing/step-list.d.ts +73 -0
  296. package/dist/landing/step-list.js +182 -0
  297. package/dist/landing/styles/card-grid.d.ts +115 -0
  298. package/dist/landing/styles/card-grid.js +295 -0
  299. package/dist/{patterns → landing}/tabbed-stage.d.ts +26 -8
  300. package/dist/landing/tabbed-stage.js +233 -0
  301. package/dist/landing/testimonial-band.d.ts +110 -0
  302. package/dist/landing/testimonial-band.js +164 -0
  303. package/dist/landing/typed-terminal.d.ts +62 -0
  304. package/dist/landing/typed-terminal.js +233 -0
  305. package/dist/landing/utils/pause-toggle.d.ts +37 -0
  306. package/dist/landing/utils/pause-toggle.js +71 -0
  307. package/dist/mixins/copy-to-clipboard.d.ts +6 -0
  308. package/dist/mixins/copy-to-clipboard.js +17 -1
  309. package/dist/mixins/dialog-dismiss.d.ts +21 -0
  310. package/dist/mixins/dialog-dismiss.js +62 -0
  311. package/dist/mixins/index.d.ts +2 -15
  312. package/dist/mixins/index.js +2 -15
  313. package/dist/styles/index.d.ts +2 -5
  314. package/dist/styles/index.js +2 -5
  315. package/dist/styles/landing.d.ts +200 -0
  316. package/dist/styles/landing.js +516 -0
  317. package/dist/styles/surface-control.d.ts +18 -0
  318. package/dist/styles/surface-control.js +31 -0
  319. package/dist/utils/eyebrow.d.ts +39 -0
  320. package/dist/utils/eyebrow.js +21 -0
  321. package/dist/utils/index.d.ts +1 -5
  322. package/dist/utils/index.js +1 -5
  323. package/package.json +14 -4
  324. package/src/theme.css +87 -22
  325. package/dist/components/feature.d.ts +0 -102
  326. package/dist/components/feature.js +0 -151
  327. package/dist/components/logo-cloud.d.ts +0 -42
  328. package/dist/components/logo-cloud.js +0 -41
  329. package/dist/components/marketing-header.d.ts +0 -71
  330. package/dist/components/marketing-header.js +0 -81
  331. package/dist/components/marketing-section.d.ts +0 -81
  332. package/dist/components/marketing-section.js +0 -103
  333. package/dist/components/stat-strip.js +0 -64
  334. package/dist/patterns/accent-text.d.ts +0 -30
  335. package/dist/patterns/accent-text.js +0 -17
  336. package/dist/patterns/announcement-chip.d.ts +0 -41
  337. package/dist/patterns/announcement-chip.js +0 -49
  338. package/dist/patterns/bento.d.ts +0 -67
  339. package/dist/patterns/bento.js +0 -95
  340. package/dist/patterns/code-stage.d.ts +0 -63
  341. package/dist/patterns/code-stage.js +0 -82
  342. package/dist/patterns/feature-band.d.ts +0 -85
  343. package/dist/patterns/feature-band.js +0 -50
  344. package/dist/patterns/icon-well.js +0 -38
  345. package/dist/patterns/index.d.ts +0 -23
  346. package/dist/patterns/index.js +0 -23
  347. package/dist/patterns/landing-hero.d.ts +0 -93
  348. package/dist/patterns/landing-hero.js +0 -126
  349. package/dist/patterns/product-frame.d.ts +0 -60
  350. package/dist/patterns/product-frame.js +0 -70
  351. package/dist/patterns/step-list.d.ts +0 -45
  352. package/dist/patterns/step-list.js +0 -84
  353. package/dist/patterns/tabbed-stage.js +0 -77
  354. package/dist/styles/marketing.d.ts +0 -120
  355. package/dist/styles/marketing.js +0 -225
  356. package/dist/utils/semantic-color-panel.d.ts +0 -35
  357. package/dist/utils/semantic-color-panel.js +0 -28
  358. /package/dist/{behaviors → app/behaviors}/drag-session.d.ts +0 -0
  359. /package/dist/{behaviors → app/behaviors}/resize-session.d.ts +0 -0
  360. /package/dist/{behaviors → app/behaviors}/resize-session.js +0 -0
  361. /package/dist/{behaviors → app/behaviors}/selection-model.d.ts +0 -0
  362. /package/dist/{behaviors → app/behaviors}/selection-model.js +0 -0
  363. /package/dist/{behaviors → app/behaviors}/toaster.d.ts +0 -0
  364. /package/dist/{components → app}/drop-indicator.d.ts +0 -0
  365. /package/dist/{components → app}/drop-zone.d.ts +0 -0
  366. /package/dist/{components → app}/file-trigger.d.ts +0 -0
  367. /package/dist/{components → app}/menubar.d.ts +0 -0
  368. /package/dist/{mixins → app/mixins}/chart-tooltip.d.ts +0 -0
  369. /package/dist/{mixins → app/mixins}/chart-tooltip.js +0 -0
  370. /package/dist/{mixins → app/mixins}/context-menu.d.ts +0 -0
  371. /package/dist/{mixins → app/mixins}/context-menu.js +0 -0
  372. /package/dist/{mixins → app/mixins}/drag-reorder.d.ts +0 -0
  373. /package/dist/{mixins → app/mixins}/drop-zone.d.ts +0 -0
  374. /package/dist/{mixins → app/mixins}/grid-list-keys.d.ts +0 -0
  375. /package/dist/{mixins → app/mixins}/menubar-keys.d.ts +0 -0
  376. /package/dist/{mixins → app/mixins}/resize-handle.d.ts +0 -0
  377. /package/dist/{mixins/treeKeys.d.ts → app/mixins/tree-keys.d.ts} +0 -0
  378. /package/dist/{components → app}/resizable.d.ts +0 -0
  379. /package/dist/{components → app}/shortcut-list.d.ts +0 -0
  380. /package/dist/{components → app}/skeleton.d.ts +0 -0
  381. /package/dist/{styles → app/styles}/chart-palette.js +0 -0
  382. /package/dist/{styles → app/styles}/graphic-host.js +0 -0
  383. /package/dist/{styles → app/styles}/legend-toggle.js +0 -0
  384. /package/dist/{components → app}/table.d.ts +0 -0
  385. /package/dist/{components → app}/toast.d.ts +0 -0
  386. /package/dist/{components → app}/toolbar.d.ts +0 -0
  387. /package/dist/{utils → app/utils}/chart-marker-indices.d.ts +0 -0
  388. /package/dist/{utils → app/utils}/chart-marker-indices.js +0 -0
  389. /package/dist/{utils → app/utils}/chart-scale.d.ts +0 -0
  390. /package/dist/{behaviors → chat/behaviors}/scroll-follow-model.d.ts +0 -0
  391. /package/dist/{components → chat}/bubble.d.ts +0 -0
  392. /package/dist/{components → chat}/marker.d.ts +0 -0
  393. /package/dist/{components → chat}/message.d.ts +0 -0
  394. /package/dist/{mixins → chat/mixins}/attachment-trigger.d.ts +0 -0
  395. /package/dist/{mixins → chat/mixins}/attachment-trigger.js +0 -0
  396. /package/dist/{mixins → chat/mixins}/message-follow.d.ts +0 -0
  397. /package/dist/{components → color}/color-area.d.ts +0 -0
  398. /package/dist/{components → color}/color-field.d.ts +0 -0
  399. /package/dist/{components → color}/color-slider.d.ts +0 -0
  400. /package/dist/{components → color}/color-swatch-picker.d.ts +0 -0
  401. /package/dist/{components → color}/color-swatch.d.ts +0 -0
  402. /package/dist/{components → color}/color-wheel.d.ts +0 -0
  403. /package/dist/{mixins → color/mixins}/color-channel-sync.d.ts +0 -0
  404. /package/dist/{mixins → color/mixins}/color-channel-sync.js +0 -0
  405. /package/dist/{mixins → color/mixins}/color-preview.d.ts +0 -0
  406. /package/dist/{mixins → color/mixins}/color-wheel-drag.d.ts +0 -0
  407. /package/dist/{styles → color/styles}/rtl-aware-gradient-direction.js +0 -0
  408. /package/dist/{utils → color/utils}/hue-spectrum.d.ts +0 -0
  409. /package/dist/{utils → color/utils}/hue-spectrum.js +0 -0
  410. /package/dist/{patterns → landing}/check-row.d.ts +0 -0
  411. /package/dist/{patterns → landing}/install-tabs.d.ts +0 -0
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Why JS: a reader who picks Bun in one set of code tabs expects every set sharing that
3
+ * choice to switch, on this page and the next; radios only know their own group.
4
+ * No-JS baseline: each set still switches on its own through its radios and CSS.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/component";
10
+ /** Attribute every set of code tabs carries, holding its sync key (empty when unsynced). */
11
+ export const CODE_TABS_ATTRIBUTE = "data-code-tabs";
12
+ /** How long a remembered choice outlives the visit it was made in, in seconds. */
13
+ const MAX_AGE_SECONDS = 60 * 60 * 24 * 365;
14
+ /**
15
+ * The cookie and `localStorage` key a sync key's choice is stored under. A server that
16
+ * renders the remembered choice reads the cookie by this name, or uses
17
+ * {@link readCodeTabsCookie}.
18
+ *
19
+ * @param syncKey The key the tab sets share, such as `package-manager`.
20
+ * @returns The storage key, such as `ui-code-tabs.package-manager`.
21
+ */
22
+ export function codeTabsStorageKey(syncKey) {
23
+ return `ui-code-tabs.${syncKey}`;
24
+ }
25
+ /**
26
+ * Reads the remembered choice for `syncKey` from a request's `Cookie` header, so the
27
+ * server renders the reader's tab already selected and the page never flashes.
28
+ *
29
+ * @param cookieHeader The request's `Cookie` header, or nothing when none was sent.
30
+ * @param syncKey The key the tab sets share.
31
+ * @returns The chosen tab's value, or `undefined` when the reader has not chosen.
32
+ * @example <CodeTabs syncKey="package-manager" persist="cookie" selected={readCodeTabsCookie(request.headers.get("Cookie"), "package-manager")} … />
33
+ */
34
+ export function readCodeTabsCookie(cookieHeader, syncKey) {
35
+ if (!cookieHeader)
36
+ return undefined;
37
+ let name = codeTabsStorageKey(syncKey);
38
+ for (let entry of cookieHeader.split(";")) {
39
+ let separator = entry.indexOf("=");
40
+ if (separator === -1 || entry.slice(0, separator).trim() !== name)
41
+ continue;
42
+ try {
43
+ return decodeURIComponent(entry.slice(separator + 1).trim());
44
+ }
45
+ catch {
46
+ return undefined;
47
+ }
48
+ }
49
+ return undefined;
50
+ }
51
+ /**
52
+ * Keeps every set of code tabs sharing `syncKey` on one choice. Attach it to an element
53
+ * inside the set: on insertion it selects the remembered choice (a cached page was
54
+ * rendered for whoever asked first), and each switch is stored and mirrored into the
55
+ * other sets on the page. With `local` storage, other browser tabs follow too.
56
+ *
57
+ * @param syncKey The key the tab sets share.
58
+ * @param persist Where the choice is remembered between pages.
59
+ * @returns A mixin descriptor for an element inside the set's `[data-code-tabs]` root.
60
+ * @example <span hidden mix={[codeTabsSync("package-manager", "cookie")]} />
61
+ */
62
+ export const codeTabsSync = createMixin((handle) => {
63
+ let controller;
64
+ let syncKey = "";
65
+ let persist = "none";
66
+ handle.addEventListener("insert", (event) => {
67
+ controller?.abort();
68
+ let set = event.node.closest(`[${CODE_TABS_ATTRIBUTE}]`);
69
+ if (!set)
70
+ return;
71
+ controller = new AbortController();
72
+ let { signal } = controller;
73
+ let remembered = readChoice(syncKey, persist);
74
+ if (remembered !== undefined)
75
+ select(set, remembered);
76
+ set.addEventListener("change", (change) => {
77
+ let input = change.target;
78
+ if (!(input instanceof HTMLInputElement) || input.type !== "radio")
79
+ return;
80
+ writeChoice(syncKey, persist, input.value);
81
+ for (let other of document.querySelectorAll(selectorFor(syncKey))) {
82
+ if (other !== set)
83
+ select(other, input.value);
84
+ }
85
+ }, { signal });
86
+ if (persist === "local") {
87
+ window.addEventListener("storage", (storage) => {
88
+ if (storage.key !== codeTabsStorageKey(syncKey) || storage.newValue === null)
89
+ return;
90
+ select(set, storage.newValue);
91
+ }, { signal });
92
+ }
93
+ });
94
+ handle.addEventListener("remove", () => {
95
+ controller?.abort();
96
+ controller = undefined;
97
+ });
98
+ return (key, mode) => {
99
+ syncKey = key;
100
+ persist = mode;
101
+ return handle.element;
102
+ };
103
+ });
104
+ /** Selector matching every set of code tabs that shares `syncKey`. */
105
+ function selectorFor(syncKey) {
106
+ return `[${CODE_TABS_ATTRIBUTE}="${CSS.escape(syncKey)}"]`;
107
+ }
108
+ /** Checks the radio standing for `value`, leaving a set that offers no such tab alone. */
109
+ function select(set, value) {
110
+ let input = set.querySelector(`input[type="radio"][value="${CSS.escape(value)}"]`);
111
+ if (input instanceof HTMLInputElement)
112
+ input.checked = true;
113
+ }
114
+ /** Reads the remembered choice; blocked storage reads as no choice. */
115
+ function readChoice(syncKey, persist) {
116
+ try {
117
+ if (persist === "local")
118
+ return localStorage.getItem(codeTabsStorageKey(syncKey)) ?? undefined;
119
+ if (persist === "cookie")
120
+ return readCodeTabsCookie(document.cookie, syncKey);
121
+ }
122
+ catch { }
123
+ return undefined;
124
+ }
125
+ /** Stores the choice for the next page; blocked storage passes silently. */
126
+ function writeChoice(syncKey, persist, value) {
127
+ try {
128
+ let key = codeTabsStorageKey(syncKey);
129
+ if (persist === "local")
130
+ localStorage.setItem(key, value);
131
+ if (persist === "cookie") {
132
+ let secure = location.protocol === "https:" ? "; secure" : "";
133
+ document.cookie = `${key}=${encodeURIComponent(value)}; path=/; max-age=${MAX_AGE_SECONDS}; samesite=lax${secure}`;
134
+ }
135
+ }
136
+ catch { }
137
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Confirms a copy on the button that made it: the button carries `data-copied` for two
3
+ * seconds, so its styles can swap the copy glyph for a check, and its status region reads
4
+ * the confirmation out. Pairs with {@link copyToClipboard}, whose event it answers.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { ElementProps, MixinFactory } from "remix/component";
10
+ /** Attribute the button carries while it confirms a copy. */
11
+ export declare const COPIED_ATTRIBUTE = "data-copied";
12
+ /**
13
+ * Marks its host button as copied after every successful {@link copyToClipboard} write and
14
+ * writes `copiedLabel` into the `[role="status"]` element inside it, which a screen reader
15
+ * announces; both clear after two seconds, and a second copy restarts the clock.
16
+ *
17
+ * @param copiedLabel The confirmation a screen reader announces, such as "Copied".
18
+ * @returns A mixin descriptor for the copy button's `mix` prop.
19
+ * @example
20
+ * <button commandfor="code" command={COPY_COMMAND} mix={[copyToClipboard(), copyFeedback(t("copied"))]}>
21
+ * <CopyIcon />
22
+ * <span role="status" mix={[visuallyHidden()]} />
23
+ * </button>
24
+ */
25
+ export declare const copyFeedback: MixinFactory<HTMLButtonElement, [copiedLabel: string], ElementProps>;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Confirms a copy on the button that made it: the button carries `data-copied` for two
3
+ * seconds, so its styles can swap the copy glyph for a check, and its status region reads
4
+ * the confirmation out. Pairs with {@link copyToClipboard}, whose event it answers.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createElement, createMixin, on } from "remix/component";
10
+ /** How long a button reads as copied after a successful write. */
11
+ const CONFIRM_MS = 2000;
12
+ /** Attribute the button carries while it confirms a copy. */
13
+ export const COPIED_ATTRIBUTE = "data-copied";
14
+ /**
15
+ * Marks its host button as copied after every successful {@link copyToClipboard} write and
16
+ * writes `copiedLabel` into the `[role="status"]` element inside it, which a screen reader
17
+ * announces; both clear after two seconds, and a second copy restarts the clock.
18
+ *
19
+ * @param copiedLabel The confirmation a screen reader announces, such as "Copied".
20
+ * @returns A mixin descriptor for the copy button's `mix` prop.
21
+ * @example
22
+ * <button commandfor="code" command={COPY_COMMAND} mix={[copyToClipboard(), copyFeedback(t("copied"))]}>
23
+ * <CopyIcon />
24
+ * <span role="status" mix={[visuallyHidden()]} />
25
+ * </button>
26
+ */
27
+ export const copyFeedback = createMixin((handle) => {
28
+ let timer;
29
+ handle.addEventListener("remove", () => clearTimeout(timer));
30
+ return (copiedLabel) => createElement(handle.element, {
31
+ mix: [
32
+ on("ui:copy", (event) => {
33
+ if (!event.success)
34
+ return;
35
+ let button = event.currentTarget;
36
+ let status = button.querySelector('[role="status"]');
37
+ button.setAttribute(COPIED_ATTRIBUTE, "");
38
+ if (status)
39
+ status.textContent = copiedLabel;
40
+ clearTimeout(timer);
41
+ timer = setTimeout(() => {
42
+ button.removeAttribute(COPIED_ATTRIBUTE);
43
+ if (status)
44
+ status.textContent = "";
45
+ }, CONFIRM_MS);
46
+ }),
47
+ ],
48
+ });
49
+ });
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copies a document fetched from a URL onto the clipboard when its host button is pressed,
3
+ * for a "Copy page" button that hands a page's Markdown twin to the reader. It settles with
4
+ * the same `ui:copy` event {@link copyToClipboard} dispatches, so `copyFeedback` confirms it.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { ElementProps, MixinFactory } from "remix/component";
10
+ /**
11
+ * Fetches `href` with `Accept: text/markdown, text/plain` on every press and writes the
12
+ * body to the clipboard, then dispatches a `ui:copy` {@link CopyEvent}. A failed fetch or
13
+ * write writes `failedLabel` into the button's `[role="status"]` element for four seconds.
14
+ *
15
+ * @param href URL of the text to copy, such as the page's `.md` twin.
16
+ * @param failedLabel What a screen reader announces when the copy fails.
17
+ * @returns A mixin descriptor for the copy button's `mix` prop.
18
+ * @example
19
+ * <button type="button" mix={[copyFromUrl("/docs/install.md", t("copyFailed")), copyFeedback(t("copied"))]}>
20
+ * {t("copyPage")}
21
+ * <span role="status" mix={[visuallyHidden()]} />
22
+ * </button>
23
+ */
24
+ export declare const copyFromUrl: MixinFactory<HTMLButtonElement, [
25
+ href: string,
26
+ failedLabel?: string
27
+ ], ElementProps>;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Copies a document fetched from a URL onto the clipboard when its host button is pressed,
3
+ * for a "Copy page" button that hands a page's Markdown twin to the reader. It settles with
4
+ * the same `ui:copy` event {@link copyToClipboard} dispatches, so `copyFeedback` confirms it.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createElement, createMixin, on } from "remix/component";
10
+ import { CopyEvent } from "../../mixins/copy-to-clipboard.js";
11
+ import { DISABLED_SELECTOR } from "../../utils/disabled-selector.js";
12
+ /** How long a failure message stays in the button's status region. */
13
+ const FAILURE_MS = 4000;
14
+ /**
15
+ * The body of `href`, or `null` when the request fails or answers with an error status.
16
+ */
17
+ async function fetchText(href, signal) {
18
+ try {
19
+ let response = await fetch(href, { headers: { accept: "text/markdown, text/plain" }, signal });
20
+ return response.ok ? await response.text() : null;
21
+ }
22
+ catch {
23
+ return null;
24
+ }
25
+ }
26
+ /**
27
+ * Writes the body `text` resolves to and reports whether it reached the clipboard. Where
28
+ * `ClipboardItem` exists the write starts within the press and waits for the body, which
29
+ * keeps Safari's user activation alive across the fetch.
30
+ */
31
+ async function writeClipboard(text) {
32
+ try {
33
+ if (typeof ClipboardItem === "undefined") {
34
+ let body = await text;
35
+ if (body === null)
36
+ return false;
37
+ await navigator.clipboard.writeText(body);
38
+ return true;
39
+ }
40
+ let blob = text.then((body) => body === null
41
+ ? Promise.reject(new Error("The page answered without a body"))
42
+ : new Blob([body], { type: "text/plain" }));
43
+ await navigator.clipboard.write([new ClipboardItem({ "text/plain": blob })]);
44
+ return true;
45
+ }
46
+ catch {
47
+ return false;
48
+ }
49
+ }
50
+ /**
51
+ * Fetches `href` with `Accept: text/markdown, text/plain` on every press and writes the
52
+ * body to the clipboard, then dispatches a `ui:copy` {@link CopyEvent}. A failed fetch or
53
+ * write writes `failedLabel` into the button's `[role="status"]` element for four seconds.
54
+ *
55
+ * @param href URL of the text to copy, such as the page's `.md` twin.
56
+ * @param failedLabel What a screen reader announces when the copy fails.
57
+ * @returns A mixin descriptor for the copy button's `mix` prop.
58
+ * @example
59
+ * <button type="button" mix={[copyFromUrl("/docs/install.md", t("copyFailed")), copyFeedback(t("copied"))]}>
60
+ * {t("copyPage")}
61
+ * <span role="status" mix={[visuallyHidden()]} />
62
+ * </button>
63
+ */
64
+ export const copyFromUrl = createMixin((handle) => {
65
+ let timer;
66
+ handle.addEventListener("remove", () => clearTimeout(timer));
67
+ return (href, failedLabel) => createElement(handle.element, {
68
+ mix: [
69
+ on("click", async (event, signal) => {
70
+ let button = event.currentTarget;
71
+ if (button.matches(DISABLED_SELECTOR))
72
+ return;
73
+ let text = fetchText(href, signal);
74
+ let copied = await writeClipboard(text);
75
+ if (signal.aborted)
76
+ return;
77
+ button.dispatchEvent(new CopyEvent(copied, (await text) ?? ""));
78
+ if (!copied)
79
+ announceFailure(button, failedLabel);
80
+ }),
81
+ ],
82
+ });
83
+ /** Writes the failure into the button's status region, clearing it after a while. */
84
+ function announceFailure(button, failedLabel) {
85
+ let status = button.querySelector('[role="status"]');
86
+ if (!status || !failedLabel)
87
+ return;
88
+ status.textContent = failedLabel;
89
+ clearTimeout(timer);
90
+ timer = setTimeout(() => {
91
+ if (status.textContent === failedLabel)
92
+ status.textContent = "";
93
+ }, FAILURE_MS);
94
+ }
95
+ });
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Finishes a server-rendered docs sidebar in the browser: it opens scrolled to the current
3
+ * page, in the docked column and again each time a drawer holding it opens, and an optional
4
+ * field filters its pages by title while keeping each match's group open around it.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { ElementProps, MixinFactory } from "remix/component";
10
+ /**
11
+ * Works on the closest `[data-docs-nav]` around its host. The current link is the one with
12
+ * `aria-current="page"`. When the host holds an `<input>`, typing hides every `li` whose
13
+ * title misses the query, hides sections left empty, opens `<details>` groups holding a
14
+ * match, and shows `[data-docs-nav-empty]` when nothing matches; clearing the field restores
15
+ * every group's own open state. The host is `hidden` until this runs, so a page without
16
+ * script never shows an inert field.
17
+ *
18
+ * @example
19
+ * <div data-docs-nav><div hidden mix={[docsNavTools()]}><input type="search" /></div><nav>…</nav></div>
20
+ */
21
+ export declare const docsNavTools: MixinFactory<HTMLElement, [], ElementProps>;
22
+ /**
23
+ * Shows the pages whose title holds every word of `query`, case- and accent-insensitive,
24
+ * with the groups and sections that contain them; a group whose own title matches keeps all
25
+ * its pages. An empty query restores the full tree and each group's own open state.
26
+ */
27
+ export declare function filterDocsNav(nav: HTMLElement, query: string, ownState: Map<HTMLDetailsElement, boolean>): void;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Finishes a server-rendered docs sidebar in the browser: it opens scrolled to the current
3
+ * page, in the docked column and again each time a drawer holding it opens, and an optional
4
+ * field filters its pages by title while keeping each match's group open around it.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/component";
10
+ import { revealInScroller } from "../utils/reveal-in-scroller.js";
11
+ /**
12
+ * Works on the closest `[data-docs-nav]` around its host. The current link is the one with
13
+ * `aria-current="page"`. When the host holds an `<input>`, typing hides every `li` whose
14
+ * title misses the query, hides sections left empty, opens `<details>` groups holding a
15
+ * match, and shows `[data-docs-nav-empty]` when nothing matches; clearing the field restores
16
+ * every group's own open state. The host is `hidden` until this runs, so a page without
17
+ * script never shows an inert field.
18
+ *
19
+ * @example
20
+ * <div data-docs-nav><div hidden mix={[docsNavTools()]}><input type="search" /></div><nav>…</nav></div>
21
+ */
22
+ export const docsNavTools = createMixin((handle) => {
23
+ let controller;
24
+ handle.addEventListener("insert", (event) => {
25
+ controller?.abort();
26
+ controller = new AbortController();
27
+ enhance(event.node, controller.signal);
28
+ });
29
+ handle.addEventListener("remove", () => {
30
+ controller?.abort();
31
+ controller = undefined;
32
+ });
33
+ });
34
+ /** Wires reveal-on-open and the filter for the nav around `host` until `signal` aborts. */
35
+ function enhance(host, signal) {
36
+ let nav = host.closest("[data-docs-nav]");
37
+ if (!nav)
38
+ return;
39
+ let reveal = () => {
40
+ let current = nav.querySelector('[aria-current="page"]');
41
+ if (current)
42
+ revealInScroller(current, "center");
43
+ };
44
+ reveal();
45
+ nav.closest("dialog")?.addEventListener("toggle", reveal, { signal });
46
+ let input = host.querySelector("input");
47
+ if (!input)
48
+ return;
49
+ host.hidden = false;
50
+ let groups = [...nav.querySelectorAll("details")];
51
+ let ownState = new Map(groups.map((group) => [group, group.open]));
52
+ input.addEventListener("input", () => filterDocsNav(nav, input.value, ownState), { signal });
53
+ }
54
+ /**
55
+ * Shows the pages whose title holds every word of `query`, case- and accent-insensitive,
56
+ * with the groups and sections that contain them; a group whose own title matches keeps all
57
+ * its pages. An empty query restores the full tree and each group's own open state.
58
+ */
59
+ export function filterDocsNav(nav, query, ownState) {
60
+ let words = normalize(query).split(/\s+/).filter(Boolean);
61
+ let empty = nav.querySelector("[data-docs-nav-empty]");
62
+ let anyMatch = false;
63
+ for (let section of nav.querySelectorAll("[data-docs-nav-section]")) {
64
+ let visible = false;
65
+ for (let item of section.querySelectorAll("[data-docs-nav-list] > li")) {
66
+ visible = applyFilter(item, words) || visible;
67
+ }
68
+ section.hidden = !visible;
69
+ anyMatch ||= visible;
70
+ }
71
+ if (words.length === 0)
72
+ for (let [group, open] of ownState)
73
+ group.open = open;
74
+ if (empty)
75
+ empty.hidden = anyMatch;
76
+ }
77
+ /** Shows or hides `item` and its nested pages for `words`; reports whether it stays shown. */
78
+ function applyFilter(item, words) {
79
+ let title = item.querySelector(":scope > a, :scope > details > summary");
80
+ let own = words.every((word) => normalize(title?.textContent ?? "").includes(word));
81
+ let children = item.querySelectorAll(":scope > details > ul > li, :scope > ul > li");
82
+ let childShown = false;
83
+ for (let child of children)
84
+ childShown = applyFilter(child, own ? [] : words) || childShown;
85
+ let group = item.querySelector(":scope > details");
86
+ if (group && childShown && words.length > 0)
87
+ group.open = true;
88
+ item.hidden = !(own || childShown);
89
+ return !item.hidden;
90
+ }
91
+ /** Lower-cases `value` and strips diacritics, so "Configuracion" finds "Configuración". */
92
+ function normalize(value) {
93
+ return value
94
+ .normalize("NFD")
95
+ .replaceAll(/\p{Diacritic}/gu, "")
96
+ .toLowerCase();
97
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Follows the reader through a page for an "On this page" list: marks every section on
3
+ * screen, slides one marker over them, names the section being read and keeps it in view
4
+ * inside a scrolling rail. The links stay plain anchors, so the list works before it loads.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import type { ElementProps, MixinFactory } from "remix/component";
10
+ /**
11
+ * Watches the headings that the host's `a[href^="#"]` links point at. On every settled
12
+ * scroll and resize it sets `data-active` on each link whose section is on screen
13
+ * (`"lead"` on the first), moves the `[data-toc-marker]` element over them through
14
+ * `--toc-marker-start` / `--toc-marker-size`, and on the closest `[data-toc]` writes the lead's
15
+ * text into `[data-toc-reading]` and sets `--toc-progress` (0–1) for a progress ring. The top edge a section must pass is
16
+ * the first heading's `scroll-margin-top`, so it matches where a jump to that heading lands.
17
+ * A link followed inside a `<details>` closes it, so the section is not hidden under the list.
18
+ *
19
+ * @example
20
+ * <nav><ul mix={[tocSpy()]}><li><a href="#install">Install</a></li></ul></nav>
21
+ */
22
+ export declare const tocSpy: MixinFactory<HTMLElement, [], ElementProps>;
23
+ /**
24
+ * The indexes of the sections on screen. A reader scrolled to the bottom of the page is
25
+ * credited with the last section even when its heading never reached the top edge.
26
+ */
27
+ export declare function sectionsInView(starts: number[], viewport: {
28
+ top: number;
29
+ bottom: number;
30
+ }, atBottom: boolean): number[];
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Follows the reader through a page for an "On this page" list: marks every section on
3
+ * screen, slides one marker over them, names the section being read and keeps it in view
4
+ * inside a scrolling rail. The links stay plain anchors, so the list works before it loads.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createMixin } from "remix/component";
10
+ import { revealInScroller } from "../utils/reveal-in-scroller.js";
11
+ /**
12
+ * Watches the headings that the host's `a[href^="#"]` links point at. On every settled
13
+ * scroll and resize it sets `data-active` on each link whose section is on screen
14
+ * (`"lead"` on the first), moves the `[data-toc-marker]` element over them through
15
+ * `--toc-marker-start` / `--toc-marker-size`, and on the closest `[data-toc]` writes the lead's
16
+ * text into `[data-toc-reading]` and sets `--toc-progress` (0–1) for a progress ring. The top edge a section must pass is
17
+ * the first heading's `scroll-margin-top`, so it matches where a jump to that heading lands.
18
+ * A link followed inside a `<details>` closes it, so the section is not hidden under the list.
19
+ *
20
+ * @example
21
+ * <nav><ul mix={[tocSpy()]}><li><a href="#install">Install</a></li></ul></nav>
22
+ */
23
+ export const tocSpy = createMixin((handle) => {
24
+ let controller;
25
+ handle.addEventListener("insert", (event) => {
26
+ controller?.abort();
27
+ controller = new AbortController();
28
+ watch(event.node, controller.signal);
29
+ });
30
+ handle.addEventListener("remove", () => {
31
+ controller?.abort();
32
+ controller = undefined;
33
+ });
34
+ });
35
+ /**
36
+ * Starts following the page for `host` until `signal` aborts. The sections are read again on
37
+ * every recount, so a client-side navigation that keeps this list (new links, or new headings
38
+ * under the same ids) is followed from its first scroll, and a page with none yet still arms.
39
+ */
40
+ function watch(host, signal) {
41
+ let view = host.ownerDocument.defaultView;
42
+ if (!view)
43
+ return;
44
+ let frame = 0;
45
+ /** One recount per frame, however many events the frame delivers. */
46
+ function schedule() {
47
+ view?.cancelAnimationFrame(frame);
48
+ frame = view?.requestAnimationFrame(() => update(host)) ?? 0;
49
+ }
50
+ view.addEventListener("scroll", schedule, { passive: true, signal });
51
+ view.addEventListener("resize", schedule, { passive: true, signal });
52
+ view.addEventListener("hashchange", schedule, { signal });
53
+ view.navigation?.addEventListener("navigatesuccess", schedule, { signal });
54
+ host.closest("details")?.addEventListener("toggle", schedule, { signal });
55
+ host.addEventListener("click", (click) => closeOnJump(host, click), { signal });
56
+ let links = new MutationObserver(schedule);
57
+ links.observe(host, {
58
+ childList: true,
59
+ subtree: true,
60
+ attributes: true,
61
+ attributeFilter: ["href"],
62
+ });
63
+ signal.addEventListener("abort", () => {
64
+ view?.cancelAnimationFrame(frame);
65
+ links.disconnect();
66
+ }, { once: true });
67
+ update(host);
68
+ host.dataset.tocReady = "";
69
+ }
70
+ /** Pairs every in-page link inside `host` with the heading it points at, in list order. */
71
+ function collectSections(host) {
72
+ let sections = [];
73
+ for (let link of host.querySelectorAll('a[href^="#"]')) {
74
+ let id = decodeURIComponent(link.hash.slice(1));
75
+ let heading = id ? host.ownerDocument.getElementById(id) : null;
76
+ if (heading)
77
+ sections.push({ link, heading });
78
+ }
79
+ return sections;
80
+ }
81
+ /**
82
+ * The indexes of the sections on screen. A reader scrolled to the bottom of the page is
83
+ * credited with the last section even when its heading never reached the top edge.
84
+ */
85
+ export function sectionsInView(starts, viewport, atBottom) {
86
+ let visible = [];
87
+ for (let index = 0; index < starts.length; index++) {
88
+ let start = starts[index];
89
+ let end = starts[index + 1] ?? Number.POSITIVE_INFINITY;
90
+ if (end > viewport.top + 1 && start < viewport.bottom)
91
+ visible.push(index);
92
+ }
93
+ let last = starts.length - 1;
94
+ if (atBottom && last >= 0 && !visible.includes(last))
95
+ visible.push(last);
96
+ return visible;
97
+ }
98
+ /** Reads the list's sections afresh, works out which are on screen and moves the marks to match. */
99
+ function update(host) {
100
+ let sections = collectSections(host);
101
+ let root = host.ownerDocument.documentElement;
102
+ let first = sections[0]?.heading;
103
+ let top = first ? Number.parseFloat(getComputedStyle(first).scrollMarginTop) || 0 : 0;
104
+ let starts = sections.map((section) => section.heading.getBoundingClientRect().top);
105
+ let atBottom = root.scrollHeight > root.clientHeight &&
106
+ root.scrollTop + root.clientHeight >= root.scrollHeight - 2;
107
+ let visible = sectionsInView(starts, { top, bottom: root.clientHeight }, atBottom);
108
+ let lead = visible[0];
109
+ for (let link of host.querySelectorAll("a[data-active]")) {
110
+ if (!sections.some((section) => section.link === link))
111
+ link.removeAttribute("data-active");
112
+ }
113
+ for (let [index, section] of sections.entries()) {
114
+ if (index === lead)
115
+ section.link.dataset.active = "lead";
116
+ else if (visible.includes(index))
117
+ section.link.dataset.active = "";
118
+ else
119
+ section.link.removeAttribute("data-active");
120
+ }
121
+ moveMarker(host, sections, visible);
122
+ let scope = host.closest("[data-toc]") ?? host;
123
+ let reading = scope.querySelector("[data-toc-reading]");
124
+ let progressHost = scope;
125
+ if (lead === undefined) {
126
+ if (reading)
127
+ reading.textContent = "";
128
+ progressHost.style.setProperty("--toc-progress", "0");
129
+ return;
130
+ }
131
+ let leadSection = sections[lead];
132
+ if (reading)
133
+ reading.textContent = leadSection.link.textContent ?? "";
134
+ progressHost.style.setProperty("--toc-progress", String((lead + 1) / sections.length));
135
+ revealInScroller(leadSection.link);
136
+ }
137
+ /**
138
+ * Stretches the marker from the first marked link to the last, measured against the
139
+ * marker's offset parent so the list's own padding and scroll position never skew it.
140
+ */
141
+ function moveMarker(host, sections, visible) {
142
+ let marker = host.querySelector("[data-toc-marker]");
143
+ if (!marker)
144
+ return;
145
+ let firstIndex = visible[0];
146
+ let lastIndex = visible.at(-1);
147
+ if (firstIndex === undefined || lastIndex === undefined) {
148
+ marker.style.setProperty("--toc-marker-size", "0px");
149
+ return;
150
+ }
151
+ let first = sections[firstIndex].link;
152
+ let last = sections[lastIndex].link;
153
+ let start = first.offsetTop;
154
+ let size = last.offsetTop + last.offsetHeight - start;
155
+ marker.style.setProperty("--toc-marker-start", `${start}px`);
156
+ marker.style.setProperty("--toc-marker-size", `${size}px`);
157
+ }
158
+ /** Closes the `<details>` around the list once one of its links is followed. */
159
+ function closeOnJump(host, click) {
160
+ if (!(click.target instanceof Element) || !click.target.closest("a[href]"))
161
+ return;
162
+ let details = host.closest("details");
163
+ if (details)
164
+ details.open = false;
165
+ }