@sinnstack/ui 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +373 -0
  3. package/README.md +186 -2
  4. package/docs/blocks.md +364 -0
  5. package/docs/data.md +128 -0
  6. package/docs/motion.md +166 -0
  7. package/docs/primitives.md +510 -0
  8. package/docs/seo.md +187 -0
  9. package/docs/tokens.md +122 -0
  10. package/package.json +141 -3
  11. package/scripts/check-contrast.mjs +180 -0
  12. package/src/blocks/BlockRenderer.astro +54 -0
  13. package/src/blocks/CTABanner.astro +121 -0
  14. package/src/blocks/CTAPair.astro +110 -0
  15. package/src/blocks/CardGrid.astro +167 -0
  16. package/src/blocks/ConsentEmbed.astro +125 -0
  17. package/src/blocks/ConsentManager.astro +147 -0
  18. package/src/blocks/ConsentScript.astro +47 -0
  19. package/src/blocks/ContactCard.astro +164 -0
  20. package/src/blocks/ContactForm.astro +224 -0
  21. package/src/blocks/ErrorPage.astro +242 -0
  22. package/src/blocks/FAQ.astro +135 -0
  23. package/src/blocks/FeatureGrid.astro +148 -0
  24. package/src/blocks/Hero.astro +171 -0
  25. package/src/blocks/HeroCarousel.astro +220 -0
  26. package/src/blocks/HighlightCards.astro +107 -0
  27. package/src/blocks/LocationHours.astro +311 -0
  28. package/src/blocks/LogoCloud.astro +135 -0
  29. package/src/blocks/MaintenancePage.astro +168 -0
  30. package/src/blocks/MediaText.astro +177 -0
  31. package/src/blocks/PageHeader.astro +126 -0
  32. package/src/blocks/ProseSection.astro +98 -0
  33. package/src/blocks/Reviews.astro +194 -0
  34. package/src/blocks/RichText.astro +57 -0
  35. package/src/blocks/StatsBand.astro +117 -0
  36. package/src/blocks/Steps.astro +141 -0
  37. package/src/blocks/Testimonials.astro +144 -0
  38. package/src/blocks/Topbar.astro +158 -0
  39. package/src/blocks/cms/card-grid.ts +80 -0
  40. package/src/blocks/cms/consent.ts +45 -0
  41. package/src/blocks/cms/contact-card.ts +88 -0
  42. package/src/blocks/cms/contact-form.ts +55 -0
  43. package/src/blocks/cms/cta-banner.ts +48 -0
  44. package/src/blocks/cms/cta-pair.ts +63 -0
  45. package/src/blocks/cms/data-base.ts +7 -0
  46. package/src/blocks/cms/data.ts +257 -0
  47. package/src/blocks/cms/faq.ts +70 -0
  48. package/src/blocks/cms/feature-grid.ts +80 -0
  49. package/src/blocks/cms/fixtures.ts +599 -0
  50. package/src/blocks/cms/hero-carousel.ts +80 -0
  51. package/src/blocks/cms/hero.ts +77 -0
  52. package/src/blocks/cms/highlight-cards.ts +76 -0
  53. package/src/blocks/cms/images.ts +38 -0
  54. package/src/blocks/cms/index.ts +87 -0
  55. package/src/blocks/cms/location-hours.ts +149 -0
  56. package/src/blocks/cms/logo-cloud.ts +62 -0
  57. package/src/blocks/cms/media-text.ts +44 -0
  58. package/src/blocks/cms/page-header.ts +49 -0
  59. package/src/blocks/cms/pages.ts +81 -0
  60. package/src/blocks/cms/prose-section.ts +45 -0
  61. package/src/blocks/cms/reviews.ts +101 -0
  62. package/src/blocks/cms/shared.ts +115 -0
  63. package/src/blocks/cms/stats-band.ts +61 -0
  64. package/src/blocks/cms/steps.ts +67 -0
  65. package/src/blocks/cms/testimonials.ts +80 -0
  66. package/src/blocks/cms/topbar.ts +64 -0
  67. package/src/blocks/cms/types.ts +63 -0
  68. package/src/blocks/consent.ts +14 -0
  69. package/src/blocks/icons.ts +47 -0
  70. package/src/blocks/index.ts +42 -0
  71. package/src/blocks/internal/Actions.astro +29 -0
  72. package/src/blocks/internal/BlockHeader.astro +45 -0
  73. package/src/blocks/internal/BlockShell.astro +58 -0
  74. package/src/blocks/internal/CarouselScript.astro +7 -0
  75. package/src/blocks/internal/ConsentEmbedScript.astro +7 -0
  76. package/src/blocks/internal/ConsentManagerScript.astro +7 -0
  77. package/src/blocks/internal/HoursScript.astro +7 -0
  78. package/src/blocks/internal/Placeholder.astro +13 -0
  79. package/src/blocks/internal/RichTextNode.astro +133 -0
  80. package/src/blocks/internal/StandaloneDocument.astro +53 -0
  81. package/src/blocks/internal/tina.ts +19 -0
  82. package/src/blocks/internal/util.ts +23 -0
  83. package/src/blocks/lib/consent.ts +96 -0
  84. package/src/blocks/lib/contact.ts +86 -0
  85. package/src/blocks/lib/error-pages.ts +119 -0
  86. package/src/blocks/lib/faq.ts +37 -0
  87. package/src/blocks/lib/hours.ts +201 -0
  88. package/src/blocks/lib/maintenance.ts +129 -0
  89. package/src/blocks/lib/reviews.ts +22 -0
  90. package/src/blocks/lib/rich-text.ts +143 -0
  91. package/src/blocks/lib/slug.ts +12 -0
  92. package/src/blocks/registry.ts +79 -0
  93. package/src/blocks/scripts/carousel.ts +218 -0
  94. package/src/blocks/scripts/consent-embed.ts +105 -0
  95. package/src/blocks/scripts/consent-manager.ts +112 -0
  96. package/src/blocks/scripts/consent-store.ts +86 -0
  97. package/src/blocks/scripts/error-page.ts +71 -0
  98. package/src/blocks/scripts/hours.ts +106 -0
  99. package/src/blocks/scripts/maintenance.ts +109 -0
  100. package/src/blocks/styles/blocks.css +1320 -0
  101. package/src/blocks/styles/consent.css +102 -0
  102. package/src/blocks/styles/faq.css +28 -0
  103. package/src/blocks/styles/location.css +92 -0
  104. package/src/blocks/styles/prose-section.css +13 -0
  105. package/src/blocks/styles/quotes.css +123 -0
  106. package/src/blocks/styles/rich-text.css +14 -0
  107. package/src/blocks/types.ts +283 -0
  108. package/src/data/ChartAxis.astro +19 -0
  109. package/src/data/ChartContainer.astro +151 -0
  110. package/src/data/ChartLegend.astro +25 -0
  111. package/src/data/ChartSeries.astro +14 -0
  112. package/src/data/ChartTable.astro +17 -0
  113. package/src/data/ChartTooltip.astro +20 -0
  114. package/src/data/Sparkline.astro +55 -0
  115. package/src/data/cms.ts +190 -0
  116. package/src/data/index.ts +10 -0
  117. package/src/data/lib/chart.ts +450 -0
  118. package/src/data/lib/render.ts +219 -0
  119. package/src/data/lib/scale.ts +107 -0
  120. package/src/data/lib/sparkline.ts +117 -0
  121. package/src/data/scripts/chart.ts +324 -0
  122. package/src/data/styles/chart.css +392 -0
  123. package/src/motion/Marquee.astro +90 -0
  124. package/src/motion/MotionProvider.astro +50 -0
  125. package/src/motion/PageTransitions.astro +61 -0
  126. package/src/motion/Parallax.astro +44 -0
  127. package/src/motion/ParallaxLayer.astro +31 -0
  128. package/src/motion/RevealOnScroll.astro +59 -0
  129. package/src/motion/SceneRegistry.astro +38 -0
  130. package/src/motion/ScrollScene.astro +81 -0
  131. package/src/motion/index.ts +12 -0
  132. package/src/motion/integration.ts +48 -0
  133. package/src/motion/runtime/page-transitions.ts +68 -0
  134. package/src/motion/runtime/runtime.ts +180 -0
  135. package/src/motion/runtime/scenes.ts +248 -0
  136. package/src/motion/runtime/types.ts +103 -0
  137. package/src/motion/styles/motion.css +332 -0
  138. package/src/motion/transitions.ts +74 -0
  139. package/src/motion/virtual.d.ts +4 -0
  140. package/src/primitives/Accordion.astro +129 -0
  141. package/src/primitives/Breadcrumbs.astro +50 -0
  142. package/src/primitives/BulletList.astro +69 -0
  143. package/src/primitives/Button.astro +73 -0
  144. package/src/primitives/ButtonGroup.astro +54 -0
  145. package/src/primitives/Callout.astro +137 -0
  146. package/src/primitives/Caption.astro +35 -0
  147. package/src/primitives/Card.astro +72 -0
  148. package/src/primitives/CardContent.astro +24 -0
  149. package/src/primitives/CardFooter.astro +36 -0
  150. package/src/primitives/CardHeader.astro +86 -0
  151. package/src/primitives/Checkbox.astro +38 -0
  152. package/src/primitives/ChoiceGroup.astro +23 -0
  153. package/src/primitives/Cluster.astro +49 -0
  154. package/src/primitives/Container.astro +44 -0
  155. package/src/primitives/DescriptionList.astro +83 -0
  156. package/src/primitives/Dialog.astro +38 -0
  157. package/src/primitives/Disclosure.astro +67 -0
  158. package/src/primitives/Divider.astro +93 -0
  159. package/src/primitives/Drawer.astro +33 -0
  160. package/src/primitives/Fieldset.astro +80 -0
  161. package/src/primitives/Flex.astro +64 -0
  162. package/src/primitives/FocusRing.astro +63 -0
  163. package/src/primitives/FocusTrap.astro +64 -0
  164. package/src/primitives/Footer.astro +155 -0
  165. package/src/primitives/Form.astro +68 -0
  166. package/src/primitives/FormDescription.astro +26 -0
  167. package/src/primitives/FormError.astro +106 -0
  168. package/src/primitives/FormField.astro +72 -0
  169. package/src/primitives/Grid.astro +64 -0
  170. package/src/primitives/Heading.astro +45 -0
  171. package/src/primitives/IconButton.astro +48 -0
  172. package/src/primitives/Image.astro +125 -0
  173. package/src/primitives/Input.astro +84 -0
  174. package/src/primitives/Label.astro +50 -0
  175. package/src/primitives/Link.astro +81 -0
  176. package/src/primitives/LinkButton.astro +66 -0
  177. package/src/primitives/List.astro +39 -0
  178. package/src/primitives/ListItem.astro +178 -0
  179. package/src/primitives/MediaObject.astro +66 -0
  180. package/src/primitives/MetricCard.astro +276 -0
  181. package/src/primitives/NavLink.astro +81 -0
  182. package/src/primitives/NavMenu.astro +109 -0
  183. package/src/primitives/Navbar.astro +197 -0
  184. package/src/primitives/Panel.astro +153 -0
  185. package/src/primitives/Picture.astro +167 -0
  186. package/src/primitives/Popover.astro +95 -0
  187. package/src/primitives/Prose.astro +45 -0
  188. package/src/primitives/Radio.astro +21 -0
  189. package/src/primitives/Rating.astro +135 -0
  190. package/src/primitives/ReducedMotion.astro +90 -0
  191. package/src/primitives/SegmentedControl.astro +132 -0
  192. package/src/primitives/Select.astro +107 -0
  193. package/src/primitives/Sheet.astro +45 -0
  194. package/src/primitives/SkipLink.astro +31 -0
  195. package/src/primitives/Slider.astro +186 -0
  196. package/src/primitives/Spacer.astro +35 -0
  197. package/src/primitives/Stack.astro +51 -0
  198. package/src/primitives/Surface.astro +70 -0
  199. package/src/primitives/Switch.astro +22 -0
  200. package/src/primitives/Table.astro +382 -0
  201. package/src/primitives/Tabs.astro +126 -0
  202. package/src/primitives/Text.astro +56 -0
  203. package/src/primitives/Textarea.astro +73 -0
  204. package/src/primitives/Thumbnail.astro +154 -0
  205. package/src/primitives/Toggle.astro +99 -0
  206. package/src/primitives/Tooltip.astro +50 -0
  207. package/src/primitives/VisuallyHidden.astro +29 -0
  208. package/src/primitives/index.ts +103 -0
  209. package/src/primitives/internal/AccordionScript.astro +7 -0
  210. package/src/primitives/internal/ChoiceField.astro +89 -0
  211. package/src/primitives/internal/FocusTrapScript.astro +8 -0
  212. package/src/primitives/internal/FormValidationScript.astro +10 -0
  213. package/src/primitives/internal/IndeterminateScript.astro +13 -0
  214. package/src/primitives/internal/ModalPanel.astro +114 -0
  215. package/src/primitives/internal/OverlayScript.astro +7 -0
  216. package/src/primitives/internal/ReducedMotionScript.astro +7 -0
  217. package/src/primitives/internal/SliderScript.astro +7 -0
  218. package/src/primitives/internal/SparklineScript.astro +7 -0
  219. package/src/primitives/internal/TableSortScript.astro +7 -0
  220. package/src/primitives/internal/TabsScript.astro +7 -0
  221. package/src/primitives/internal/TooltipScript.astro +7 -0
  222. package/src/primitives/lib/deprecate.ts +47 -0
  223. package/src/primitives/lib/focus-trap.ts +197 -0
  224. package/src/primitives/lib/focus.ts +60 -0
  225. package/src/primitives/lib/image-plan.ts +82 -0
  226. package/src/primitives/lib/image.ts +129 -0
  227. package/src/primitives/lib/motion.ts +68 -0
  228. package/src/primitives/lib/slider.ts +170 -0
  229. package/src/primitives/scripts/accordion.ts +123 -0
  230. package/src/primitives/scripts/form-validation.ts +225 -0
  231. package/src/primitives/scripts/overlay.ts +71 -0
  232. package/src/primitives/scripts/reduced-motion.ts +59 -0
  233. package/src/primitives/scripts/slider.ts +150 -0
  234. package/src/primitives/scripts/sparkline.ts +131 -0
  235. package/src/primitives/scripts/table-sort.ts +68 -0
  236. package/src/primitives/scripts/tabs.ts +151 -0
  237. package/src/primitives/scripts/tooltip.ts +28 -0
  238. package/src/primitives/styles/a11y.css +104 -0
  239. package/src/primitives/styles/accordion.css +53 -0
  240. package/src/primitives/styles/breadcrumbs.css +59 -0
  241. package/src/primitives/styles/bullet-list.css +89 -0
  242. package/src/primitives/styles/button.css +237 -0
  243. package/src/primitives/styles/choice.css +164 -0
  244. package/src/primitives/styles/cluster.css +24 -0
  245. package/src/primitives/styles/container.css +19 -0
  246. package/src/primitives/styles/data.css +849 -0
  247. package/src/primitives/styles/disclosure.css +140 -0
  248. package/src/primitives/styles/divider.css +50 -0
  249. package/src/primitives/styles/flex.css +42 -0
  250. package/src/primitives/styles/form.css +241 -0
  251. package/src/primitives/styles/grid.css +36 -0
  252. package/src/primitives/styles/media.css +247 -0
  253. package/src/primitives/styles/nav.css +792 -0
  254. package/src/primitives/styles/overlay.css +362 -0
  255. package/src/primitives/styles/prose.css +146 -0
  256. package/src/primitives/styles/scale.css +175 -0
  257. package/src/primitives/styles/segmented.css +165 -0
  258. package/src/primitives/styles/slider.css +170 -0
  259. package/src/primitives/styles/spacer.css +17 -0
  260. package/src/primitives/styles/stack.css +25 -0
  261. package/src/primitives/styles/surface.css +403 -0
  262. package/src/primitives/styles/tabs.css +223 -0
  263. package/src/primitives/styles/typography.css +144 -0
  264. package/src/primitives/styles/utilities.css +24 -0
  265. package/src/primitives/types.ts +385 -0
  266. package/src/primitives/utils.ts +254 -0
  267. package/src/seo/JSONLD.astro +35 -0
  268. package/src/seo/SEOHead.astro +47 -0
  269. package/src/seo/cms.ts +80 -0
  270. package/src/seo/index.ts +10 -0
  271. package/src/seo/integration.ts +231 -0
  272. package/src/seo/lib/jsonld.ts +334 -0
  273. package/src/seo/lib/meta.ts +205 -0
  274. package/src/seo/lib/redirects.ts +283 -0
  275. package/src/seo/lib/robots.ts +33 -0
  276. package/src/seo/lib/rss.ts +98 -0
  277. package/src/seo/lib/sitemap.ts +105 -0
  278. package/src/seo/lib/url.ts +68 -0
  279. package/src/tokens/base.css +71 -0
  280. package/src/tokens/tokens.css +210 -0
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Client-side sorting for <Table sortable="client">.
3
+ * Header buttons reorder <tbody> rows by each cell's data-value (raw value rendered by the
4
+ * server), numerically for numeric/date columns and naturally for text. Empty values stay
5
+ * last in both directions; ties keep their previous order (stable). Updates aria-sort and
6
+ * announces the new order in a polite live region.
7
+ */
8
+ const FLAG = '__sinnTableSort';
9
+ const w = window as unknown as Record<string, boolean>;
10
+
11
+ function cellValue(row: HTMLTableRowElement, index: number): string {
12
+ const cell = row.cells[index];
13
+ return cell?.dataset.value ?? cell?.textContent?.trim() ?? '';
14
+ }
15
+
16
+ if (!w[FLAG]) {
17
+ w[FLAG] = true;
18
+ const collator = new Intl.Collator(document.documentElement.lang || undefined, { numeric: true, sensitivity: 'base' });
19
+
20
+ document.addEventListener('click', (event) => {
21
+ const button = (event.target as Element | null)?.closest?.('button.sinn-table__sort');
22
+ if (!button) return;
23
+ const th = button.closest('th');
24
+ const table = th?.closest('table');
25
+ const tbody = table?.tBodies[0];
26
+ if (!th || !table || !tbody) return;
27
+
28
+ const index = (th as HTMLTableCellElement).cellIndex;
29
+ const next = th.getAttribute('aria-sort') === 'ascending' ? 'descending' : 'ascending';
30
+ const numeric = th.dataset.sortType === 'number';
31
+ const dir = next === 'ascending' ? 1 : -1;
32
+
33
+ const rows = [...tbody.rows].map((row, i) => ({ row, i, v: cellValue(row, index) }));
34
+ rows.sort((a, b) => {
35
+ const ea = a.v === '';
36
+ const eb = b.v === '';
37
+ if (ea !== eb) return ea ? 1 : -1;
38
+ if (ea && eb) return a.i - b.i;
39
+ let cmp: number;
40
+ if (numeric) {
41
+ const na = Number(a.v);
42
+ const nb = Number(b.v);
43
+ cmp = !Number.isNaN(na) && !Number.isNaN(nb) ? na - nb : Date.parse(a.v) - Date.parse(b.v);
44
+ } else {
45
+ cmp = collator.compare(a.v, b.v);
46
+ }
47
+ return cmp * dir || a.i - b.i;
48
+ });
49
+ tbody.append(...rows.map((r) => r.row));
50
+
51
+ for (const header of th.parentElement?.children ?? []) {
52
+ if (header !== th && header.hasAttribute('aria-sort')) header.removeAttribute('aria-sort');
53
+ }
54
+ th.setAttribute('aria-sort', next);
55
+
56
+ const status = table.closest('.sinn-table')?.querySelector<HTMLElement>('[data-sinn-table-status]');
57
+ if (status) {
58
+ const label = button.textContent?.trim() ?? '';
59
+ const direction = status.dataset[next] ?? next;
60
+ status.textContent = (status.dataset.template ?? 'Sorted by {column}, {direction}')
61
+ .replace('{column}', label)
62
+ .replace('{direction}', direction);
63
+ }
64
+ });
65
+ }
66
+
67
+ // Module scope (keeps top-level names private to this file).
68
+ export {};
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Tabs: upgrades the server-rendered links + panels to ARIA tabs (WAI-ARIA APG pattern).
3
+ * Roles are added here, not in the HTML, so without this script the markup tells the truth
4
+ * (links to sections). Selection: aria-selected + data-selected on the tab, data-selected on the
5
+ * panel (CSS hides the rest; not `hidden`, so print CSS can still show every panel).
6
+ *
7
+ * Keys: ←/→ (↑/↓ too when vertical; reversed in RTL), Home/End. Automatic activation selects
8
+ * on focus; manual moves focus and selects on Enter/Space. Disabled tabs are skipped.
9
+ * Event: `sinn-tab-change` (bubbles, composed) with `{ id, index, previousId }`.
10
+ */
11
+ import type { SinnTabChangeDetail } from '../types';
12
+
13
+ const FLAG = '__sinnTabs';
14
+ const w = window as unknown as Record<string, boolean>;
15
+
16
+ const parts = (root: HTMLElement) => ({
17
+ tabs: [...root.querySelectorAll<HTMLAnchorElement>(':scope > .sinn-tabs__list > .sinn-tabs__tab')],
18
+ panels: [...root.querySelectorAll<HTMLElement>(':scope > .sinn-tabs__panel')],
19
+ });
20
+ const disabled = (t: Element) => t.getAttribute('aria-disabled') === 'true';
21
+
22
+ function select(root: HTMLElement, index: number, opts: { focus?: boolean; emit?: boolean } = {}) {
23
+ const { tabs, panels } = parts(root);
24
+ const tab = tabs[index];
25
+ if (!tab || disabled(tab)) return;
26
+ const prev = tabs.findIndex((t) => t.getAttribute('aria-selected') === 'true');
27
+ tabs.forEach((t, k) => {
28
+ const on = k === index;
29
+ t.setAttribute('aria-selected', String(on));
30
+ t.toggleAttribute('data-selected', on);
31
+ t.tabIndex = on ? 0 : -1;
32
+ panels[k]?.toggleAttribute('data-selected', on);
33
+ });
34
+ if (opts.focus) {
35
+ tab.focus();
36
+ // Bring a tab scrolled out of an overflowing list into view, without moving the page.
37
+ tab.scrollIntoView({ block: 'nearest', inline: 'nearest' });
38
+ }
39
+ if (root.hasAttribute('data-sync-hash') && opts.emit && panels[index]) {
40
+ history.replaceState(history.state, '', `#${panels[index].id}`);
41
+ }
42
+ if (opts.emit && prev !== index) {
43
+ root.dispatchEvent(
44
+ new CustomEvent<SinnTabChangeDetail>('sinn-tab-change', {
45
+ bubbles: true,
46
+ composed: true,
47
+ detail: { id: panels[index]?.id ?? '', index, previousId: prev >= 0 ? (panels[prev]?.id ?? null) : null },
48
+ }),
49
+ );
50
+ }
51
+ }
52
+
53
+ /** The tab whose panel holds the URL target (the panel itself or something inside it). */
54
+ function hashIndex(root: HTMLElement): number {
55
+ const id = decodeURIComponent(location.hash.slice(1));
56
+ if (!id) return -1;
57
+ const el = document.getElementById(id);
58
+ const panel = el?.closest('.sinn-tabs__panel');
59
+ return panel && panel.parentElement === root ? parts(root).panels.indexOf(panel as HTMLElement) : -1;
60
+ }
61
+
62
+ function enhance(root: HTMLElement) {
63
+ const { tabs, panels } = parts(root);
64
+ const list = root.querySelector<HTMLElement>(':scope > .sinn-tabs__list');
65
+ if (!list || !tabs.length) return;
66
+ list.setAttribute('role', 'tablist');
67
+ if (root.dataset.label) list.setAttribute('aria-label', root.dataset.label);
68
+ if (root.dataset.orientation === 'vertical') list.setAttribute('aria-orientation', 'vertical');
69
+ tabs.forEach((t, i) => {
70
+ t.setAttribute('role', 'tab');
71
+ if (panels[i]) t.setAttribute('aria-controls', panels[i].id);
72
+ });
73
+ panels.forEach((p, i) => {
74
+ p.setAttribute('role', 'tabpanel');
75
+ if (tabs[i]) p.setAttribute('aria-labelledby', tabs[i].id);
76
+ p.tabIndex = 0;
77
+ });
78
+ const fromHash = hashIndex(root);
79
+ const initial = fromHash >= 0 && !disabled(tabs[fromHash]) ? fromHash : Math.max(0, tabs.findIndex((t) => t.hasAttribute('data-selected')));
80
+ select(root, initial);
81
+ root.dataset.enhanced = '';
82
+ }
83
+
84
+ const init = () => {
85
+ for (const root of document.querySelectorAll<HTMLElement>('[data-sinn-tabs]:not([data-enhanced])')) enhance(root);
86
+ };
87
+
88
+ const tabFrom = (t: EventTarget | null) => {
89
+ const tab = (t as Element | null)?.closest?.<HTMLAnchorElement>('.sinn-tabs__tab');
90
+ const root = tab?.parentElement?.parentElement as HTMLElement | undefined;
91
+ return tab && root?.hasAttribute('data-enhanced') ? { tab, root } : null;
92
+ };
93
+
94
+ if (!w[FLAG]) {
95
+ w[FLAG] = true;
96
+
97
+ document.addEventListener('click', (e) => {
98
+ const hit = tabFrom(e.target);
99
+ if (!hit) return;
100
+ // Let modified clicks (new tab/window) keep their link behavior.
101
+ if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;
102
+ e.preventDefault();
103
+ const { tabs } = parts(hit.root);
104
+ select(hit.root, tabs.indexOf(hit.tab), { focus: true, emit: true });
105
+ });
106
+
107
+ document.addEventListener('keydown', (e) => {
108
+ const hit = tabFrom(e.target);
109
+ if (!hit || e.altKey || e.ctrlKey || e.metaKey) return;
110
+ const { root, tab } = hit;
111
+ const { tabs } = parts(root);
112
+ const i = tabs.indexOf(tab);
113
+ const manual = root.dataset.activation === 'manual';
114
+ if (e.key === 'Enter' || e.key === ' ') {
115
+ e.preventDefault();
116
+ select(root, i, { focus: true, emit: true });
117
+ return;
118
+ }
119
+ const vertical = root.dataset.orientation === 'vertical';
120
+ const rtl = getComputedStyle(root).direction === 'rtl';
121
+ const fwd = [rtl ? 'ArrowLeft' : 'ArrowRight', ...(vertical ? ['ArrowDown'] : [])];
122
+ const back = [rtl ? 'ArrowRight' : 'ArrowLeft', ...(vertical ? ['ArrowUp'] : [])];
123
+ const enabled = tabs.map((t, k) => (disabled(t) ? -1 : k)).filter((k) => k >= 0);
124
+ if (!enabled.length) return;
125
+ const pos = enabled.indexOf(i);
126
+ let next: number | null = null;
127
+ if (fwd.includes(e.key)) next = enabled[(pos + 1) % enabled.length];
128
+ else if (back.includes(e.key)) next = enabled[(pos - 1 + enabled.length) % enabled.length];
129
+ else if (e.key === 'Home') next = enabled[0];
130
+ else if (e.key === 'End') next = enabled[enabled.length - 1];
131
+ if (next === null) return;
132
+ e.preventDefault();
133
+ if (manual) {
134
+ tabs[next].focus();
135
+ tabs[next].scrollIntoView({ block: 'nearest', inline: 'nearest' });
136
+ } else select(root, next, { focus: true, emit: true });
137
+ });
138
+
139
+ // Links elsewhere on the page to #panel (or to something inside a panel) switch tabs.
140
+ window.addEventListener('hashchange', () => {
141
+ for (const root of document.querySelectorAll<HTMLElement>('[data-sinn-tabs][data-enhanced]')) {
142
+ const i = hashIndex(root);
143
+ if (i >= 0) select(root, i, { emit: true });
144
+ }
145
+ });
146
+
147
+ document.addEventListener('astro:page-load', init);
148
+ }
149
+ init();
150
+
151
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Tooltip: Esc dismisses the visible tooltip without moving focus or the pointer
3
+ * (WCAG 1.4.13 "dismissible"). It shows again after the pointer leaves or focus moves on.
4
+ */
5
+ const FLAG = '__sinnTooltip';
6
+ const w = window as unknown as Record<string, boolean>;
7
+
8
+ if (!w[FLAG]) {
9
+ w[FLAG] = true;
10
+
11
+ document.addEventListener('keydown', (event) => {
12
+ if (event.key !== 'Escape') return;
13
+ for (const tip of document.querySelectorAll<HTMLElement>('.sinn-tooltip')) {
14
+ if (tip.matches(':hover') || tip.matches(':focus-within')) tip.dataset.dismissed = '';
15
+ }
16
+ });
17
+
18
+ const reset = (event: Event) => {
19
+ const tip = (event.target as Element | null)?.closest?.<HTMLElement>('.sinn-tooltip[data-dismissed]');
20
+ const next = (event as FocusEvent | PointerEvent).relatedTarget as Node | null;
21
+ if (tip && !(next && tip.contains(next))) delete tip.dataset.dismissed;
22
+ };
23
+ document.addEventListener('pointerout', reset);
24
+ document.addEventListener('focusout', reset);
25
+ }
26
+
27
+ // Module scope (keeps top-level names private to this file).
28
+ export {};
@@ -0,0 +1,104 @@
1
+ /* VisuallyHidden, FocusRing, FocusTrap, ReducedMotion. */
2
+ /* Same order as tokens.css: whichever stylesheet loads first fixes the layer order. */
3
+ @layer sinn.reset, sinn.tokens, sinn.primitives, sinn.data, sinn.motion, sinn.blocks, sinn.overrides;
4
+
5
+ @layer sinn.primitives {
6
+ /* ---------- VisuallyHidden (focusable variant) ---------- */
7
+ /* Hidden until it, or something inside it, receives focus. */
8
+ .sinn-sr-only-focusable:not(:focus, :focus-within) {
9
+ position: absolute;
10
+ inline-size: 1px;
11
+ block-size: 1px;
12
+ padding: 0;
13
+ margin: -1px;
14
+ overflow: hidden;
15
+ clip-path: inset(50%);
16
+ white-space: nowrap;
17
+ border: 0;
18
+ }
19
+
20
+ /* ---------- FocusRing ----------
21
+ * Deliberately not wrapped in :where(): FocusRing is an override utility, so its
22
+ * (low, class-level) specificity wins over components' zero-specificity focus styles. */
23
+ .sinn-focus-ring {
24
+ --sinn-p-ring-w: var(--sinn-focus-width);
25
+ --sinn-p-ring-offset: var(--sinn-focus-offset);
26
+ --sinn-p-ring-color: var(--sinn-color-focus);
27
+ display: contents;
28
+ }
29
+ .sinn-focus-ring[data-offset='inset'] { --sinn-p-ring-offset: calc(var(--sinn-p-ring-w) * -1); }
30
+ .sinn-focus-ring[data-offset='tight'] { --sinn-p-ring-offset: 0px; }
31
+ .sinn-focus-ring[data-offset='loose'] { --sinn-p-ring-offset: calc(var(--sinn-focus-offset) * 2); }
32
+ .sinn-focus-ring[data-weight='thick'] { --sinn-p-ring-w: calc(var(--sinn-focus-width) * 1.5); }
33
+
34
+ /* Default: the ring goes on whichever element inside gets keyboard focus. */
35
+ .sinn-focus-ring:not([data-within]) :focus-visible {
36
+ outline: var(--sinn-p-ring-w) solid var(--sinn-p-ring-color);
37
+ outline-offset: var(--sinn-p-ring-offset);
38
+ }
39
+
40
+ /* within: the wrapper shows the ring while anything inside has keyboard focus
41
+ (search field + button, a custom card, a composite control). */
42
+ .sinn-focus-ring[data-within] {
43
+ display: block;
44
+ border-radius: var(--sinn-p-ring-radius, var(--sinn-radius-m));
45
+ }
46
+ .sinn-focus-ring[data-within][data-display='inline'] { display: inline-block; }
47
+ .sinn-focus-ring[data-within]:has(:focus-visible) {
48
+ outline: var(--sinn-p-ring-w) solid var(--sinn-p-ring-color);
49
+ outline-offset: var(--sinn-p-ring-offset);
50
+ }
51
+ .sinn-focus-ring[data-within] :focus-visible { outline: none; }
52
+
53
+ /* contrast: a surface-colored halo fills the offset gap, so the ring stays visible on
54
+ photos, gradients and colored fills (helps meet 2.4.13 Focus Appearance). */
55
+ .sinn-focus-ring[data-tone='contrast']:not([data-within]) :focus-visible,
56
+ .sinn-focus-ring[data-tone='contrast'][data-within]:has(:focus-visible) {
57
+ box-shadow: 0 0 0 max(var(--sinn-p-ring-offset), 0px) var(--sinn-color-surface);
58
+ }
59
+
60
+ .sinn-focus-ring[data-radius='s'] { --sinn-p-ring-radius: var(--sinn-radius-s); }
61
+ .sinn-focus-ring[data-radius='l'] { --sinn-p-ring-radius: var(--sinn-radius-l); }
62
+ .sinn-focus-ring[data-radius='full'] { --sinn-p-ring-radius: var(--sinn-radius-full); }
63
+
64
+ /* ---------- FocusTrap ---------- */
65
+ :where(sinn-focus-trap) { display: block; }
66
+ :where(sinn-focus-trap[data-display='contents']) { display: contents; }
67
+ :where(sinn-focus-trap:focus) { outline: none; }
68
+
69
+ /* ---------- ReducedMotion ---------- */
70
+ :where(.sinn-motion) { position: relative; }
71
+ :where(.sinn-motion__still) { display: none; }
72
+
73
+ /* Reduced (OS or site override): show the still alternative instead of the moving one. */
74
+ @media (prefers-reduced-motion: reduce) {
75
+ :where(:root:not([data-motion='full'])) :where(.sinn-motion:has(> .sinn-motion__still)) > :where(.sinn-motion__motion) { display: none; }
76
+ :where(:root:not([data-motion='full'])) :where(.sinn-motion) > :where(.sinn-motion__still) { display: block; }
77
+ /* One class of specificity on purpose: the toggle is also a .sinn-button (display: inline-flex), and
78
+ hiding it must not depend on which stylesheet the bundler happens to load last. */
79
+ :where(:root:not([data-motion='full'])) .sinn-motion__toggle { display: none; }
80
+ }
81
+ :where(:root[data-motion='reduce']) :where(.sinn-motion:has(> .sinn-motion__still)) > :where(.sinn-motion__motion) { display: none; }
82
+ :where(:root[data-motion='reduce']) :where(.sinn-motion) > :where(.sinn-motion__still) { display: block; }
83
+ :where(:root[data-motion='reduce']) .sinn-motion__toggle { display: none; }
84
+
85
+ /* Paused (by the user, or reduced motion with no still alternative): freeze CSS animations. */
86
+ .sinn-motion[data-paused] .sinn-motion__motion,
87
+ .sinn-motion[data-paused] .sinn-motion__motion * {
88
+ animation-play-state: paused !important;
89
+ }
90
+
91
+ :where(.sinn-motion__toggle) {
92
+ position: absolute;
93
+ inset-block-end: var(--sinn-space-2xs);
94
+ inset-inline-end: var(--sinn-space-2xs);
95
+ z-index: 2;
96
+ }
97
+ :where(.sinn-motion[data-controls='below']) :where(.sinn-motion__toggle) {
98
+ position: static;
99
+ margin-block-start: var(--sinn-space-2xs);
100
+ }
101
+ :where(.sinn-motion__toggle-icon-play) { display: none; }
102
+ :where(.sinn-motion[data-paused]) :where(.sinn-motion__toggle-icon-play) { display: inline; }
103
+ :where(.sinn-motion[data-paused]) :where(.sinn-motion__toggle-icon-pause) { display: none; }
104
+ }
@@ -0,0 +1,53 @@
1
+ /* Accordion: a group of Disclosures (see disclosure.css) plus the "Show all" toolbar. */
2
+ /* Same order as tokens.css: whichever stylesheet loads first fixes the layer order. */
3
+ @layer sinn.reset, sinn.tokens, sinn.primitives, sinn.data, sinn.motion, sinn.blocks, sinn.overrides;
4
+
5
+ @layer sinn.primitives {
6
+ :where(.sinn-accordion) { display: flex; flex-direction: column; }
7
+ :where(.sinn-accordion[data-variant='card']) { gap: var(--sinn-space-xs); }
8
+
9
+ :where(.sinn-accordion__toolbar) {
10
+ display: flex;
11
+ justify-content: flex-end;
12
+ padding-block-end: var(--sinn-space-2xs);
13
+ }
14
+ /* The button needs the script. Its row is reserved from the first paint (no layout shift when
15
+ the script arrives) but stays invisible until the script marks the accordion ready. */
16
+ :where(.sinn-accordion:not([data-ready])) > :where(.sinn-accordion__toolbar) { visibility: hidden; }
17
+ @media (scripting: none) {
18
+ :where(.sinn-accordion__toolbar) { display: none; }
19
+ }
20
+ :where(.sinn-accordion__all) {
21
+ min-block-size: 1.5rem;
22
+ padding: var(--sinn-space-3xs) 0;
23
+ border: 0;
24
+ background: none;
25
+ font: inherit;
26
+ font-size: var(--sinn-text-s);
27
+ font-weight: var(--sinn-weight-medium);
28
+ color: var(--sinn-color-accent-text);
29
+ text-decoration: underline;
30
+ text-decoration-thickness: 1px;
31
+ text-underline-offset: 0.2em;
32
+ cursor: pointer;
33
+ }
34
+ @media (hover: hover) {
35
+ :where(.sinn-accordion__all:hover) { text-decoration-thickness: 2px; }
36
+ }
37
+ :where(.sinn-accordion__all:focus-visible) {
38
+ outline: var(--sinn-focus-width) solid var(--sinn-color-focus);
39
+ outline-offset: var(--sinn-focus-offset);
40
+ border-radius: var(--sinn-radius-s);
41
+ }
42
+
43
+ /* Deep link target: give the opened section a moment of emphasis. */
44
+ :where(.sinn-accordion__item:target) > :where(.sinn-disclosure__summary) {
45
+ background-color: var(--sinn-color-accent-soft);
46
+ }
47
+ @media print {
48
+ :where(.sinn-accordion__toolbar) { display: none; }
49
+ }
50
+ @media (forced-colors: active) {
51
+ :where(.sinn-accordion__all) { color: LinkText; }
52
+ }
53
+ }
@@ -0,0 +1,59 @@
1
+ /* Breadcrumbs. Separators are CSS-only (decorative): a chevron drawn with borders, flipped in RTL. */
2
+ /* Same order as tokens.css: whichever stylesheet loads first fixes the layer order. */
3
+ @layer sinn.reset, sinn.tokens, sinn.primitives, sinn.data, sinn.motion, sinn.blocks, sinn.overrides;
4
+
5
+ @layer sinn.primitives {
6
+ :where(.sinn-breadcrumbs) {
7
+ --sinn-p-crumb-size: var(--sinn-text-s);
8
+ font-size: var(--sinn-p-crumb-size);
9
+ line-height: var(--sinn-leading-snug);
10
+ }
11
+ :where(.sinn-breadcrumbs[data-size='m']) { --sinn-p-crumb-size: var(--sinn-text-m); }
12
+ :where(.sinn-breadcrumbs__list) {
13
+ display: flex;
14
+ flex-wrap: wrap;
15
+ align-items: center;
16
+ gap: var(--sinn-space-3xs) 0;
17
+ margin: 0;
18
+ padding: 0;
19
+ list-style: none;
20
+ }
21
+ :where(.sinn-breadcrumbs__item) {
22
+ display: inline-flex;
23
+ align-items: center;
24
+ min-inline-size: 0;
25
+ color: var(--sinn-color-text-muted);
26
+ }
27
+ :where(.sinn-breadcrumbs__item + .sinn-breadcrumbs__item)::before {
28
+ content: '';
29
+ flex-shrink: 0;
30
+ inline-size: 0.4em;
31
+ block-size: 0.4em;
32
+ margin-inline: 0.6em 0.75em;
33
+ border-block-start: 0.1em solid currentColor;
34
+ border-inline-end: 0.1em solid currentColor;
35
+ opacity: 0.7;
36
+ transform: rotate(45deg);
37
+ }
38
+ :where(.sinn-breadcrumbs__item + .sinn-breadcrumbs__item:dir(rtl))::before { transform: rotate(-45deg); }
39
+ :where(.sinn-breadcrumbs__link) {
40
+ color: inherit;
41
+ text-decoration: underline;
42
+ text-decoration-thickness: max(1px, 0.0625em);
43
+ text-underline-offset: 0.18em;
44
+ border-radius: var(--sinn-radius-s);
45
+ }
46
+ :where(.sinn-breadcrumbs__link:hover) { color: var(--sinn-color-text); }
47
+ :where(.sinn-breadcrumbs__link:focus-visible) {
48
+ outline: var(--sinn-focus-width) solid var(--sinn-color-focus);
49
+ outline-offset: var(--sinn-focus-offset);
50
+ }
51
+ :where(.sinn-breadcrumbs__current) {
52
+ color: var(--sinn-color-text);
53
+ font-weight: var(--sinn-weight-semibold);
54
+ overflow-wrap: anywhere;
55
+ }
56
+ @media (forced-colors: active) {
57
+ :where(.sinn-breadcrumbs__item + .sinn-breadcrumbs__item)::before { opacity: 1; }
58
+ }
59
+ }
@@ -0,0 +1,89 @@
1
+ /* BulletList: short text items with CSS-only check or dot markers, optionally in two columns. */
2
+ /* Same order as tokens.css: whichever stylesheet loads first fixes the layer order. */
3
+ @layer sinn.reset, sinn.tokens, sinn.primitives, sinn.data, sinn.motion, sinn.blocks, sinn.overrides;
4
+
5
+ @layer sinn.primitives {
6
+ :where(.sinn-bullet-list) {
7
+ --sinn-p-gap: var(--sinn-space-2xs);
8
+ --sinn-p-marker: 1.5em;
9
+ display: flex;
10
+ flex-direction: column;
11
+ gap: var(--sinn-p-gap);
12
+ margin: 0;
13
+ padding: 0;
14
+ list-style: none;
15
+ }
16
+ :where(.sinn-bullet-list[data-gap='3xs']) { --sinn-p-gap: var(--sinn-space-3xs); }
17
+ :where(.sinn-bullet-list[data-gap='xs']) { --sinn-p-gap: var(--sinn-space-xs); }
18
+ :where(.sinn-bullet-list[data-gap='s']) { --sinn-p-gap: var(--sinn-space-s); }
19
+ :where(.sinn-bullet-list) > :where(li) { position: relative; }
20
+
21
+ /* Two balanced columns, filled top to bottom; one column when there's no room for two.
22
+ `columnMin` arrives as data-min (a measure token key). A private property, set on the list
23
+ itself, so a Grid's own data-min further up the tree never leaks in. */
24
+ :where(.sinn-bullet-list) { --sinn-p-col-min: 14rem; }
25
+ :where(.sinn-bullet-list[data-min='xs']) { --sinn-p-col-min: var(--sinn-measure-xs); }
26
+ :where(.sinn-bullet-list[data-min='s']) { --sinn-p-col-min: var(--sinn-measure-s); }
27
+ :where(.sinn-bullet-list[data-min='m']) { --sinn-p-col-min: var(--sinn-measure-m); }
28
+ :where(.sinn-bullet-list[data-min='l']) { --sinn-p-col-min: var(--sinn-measure-l); }
29
+ :where(.sinn-bullet-list[data-min='xl']) { --sinn-p-col-min: var(--sinn-measure-xl); }
30
+ :where(.sinn-bullet-list[data-columns='2']) {
31
+ display: block;
32
+ columns: var(--sinn-p-col-min) 2;
33
+ column-gap: var(--sinn-space-l);
34
+ }
35
+ :where(.sinn-bullet-list[data-columns='2']) > :where(li) { break-inside: avoid; padding-block-end: var(--sinn-p-gap); }
36
+
37
+ /* Dot */
38
+ :where(.sinn-bullet-list[data-marker='dot']) > :where(li) { padding-inline-start: 1.1em; }
39
+ :where(.sinn-bullet-list[data-marker='dot']) > :where(li)::before {
40
+ content: '';
41
+ position: absolute;
42
+ inset-inline-start: 0.2em;
43
+ inset-block-start: calc(0.5lh - 0.2em);
44
+ inline-size: 0.4em;
45
+ block-size: 0.4em;
46
+ border-radius: var(--sinn-radius-full);
47
+ background-color: var(--sinn-color-accent-text);
48
+ }
49
+
50
+ /* Check: a white disc with a hairline ring (::before) and an accent check drawn with a mask (::after). */
51
+ :where(.sinn-bullet-list[data-marker='check']) > :where(li) {
52
+ min-block-size: var(--sinn-p-marker);
53
+ padding-inline-start: calc(var(--sinn-p-marker) + 0.6em);
54
+ }
55
+ :where(.sinn-bullet-list[data-marker='check']) > :where(li)::before,
56
+ :where(.sinn-bullet-list[data-marker='check']) > :where(li)::after {
57
+ content: '';
58
+ position: absolute;
59
+ inset-inline-start: 0;
60
+ inset-block-start: max(0px, calc(0.5lh - var(--sinn-p-marker) / 2));
61
+ inline-size: var(--sinn-p-marker);
62
+ block-size: var(--sinn-p-marker);
63
+ border-radius: var(--sinn-radius-full);
64
+ }
65
+ :where(.sinn-bullet-list[data-marker='check']) > :where(li)::before {
66
+ background-color: var(--sinn-color-surface-raised);
67
+ box-shadow: inset 0 0 0 var(--sinn-border-width-thin) var(--sinn-color-border);
68
+ }
69
+ :where(.sinn-bullet-list[data-marker='check']) > :where(li)::after {
70
+ background-color: var(--sinn-color-accent);
71
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 12.5l3.5 3.5L17 9' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
72
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 12.5l3.5 3.5L17 9' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
73
+ }
74
+
75
+ /* Strong (colored) surfaces: translucent disc, check in the surface's text color. */
76
+ :where([data-surface='strong']) :where(.sinn-bullet-list[data-marker='check']) > :where(li)::before {
77
+ box-shadow: none;
78
+ background-color: color-mix(in oklch, var(--sinn-p-tone-contrast) 18%, transparent);
79
+ }
80
+ :where([data-surface='strong']) :where(.sinn-bullet-list[data-marker='check']) > :where(li)::after,
81
+ :where([data-surface='strong']) :where(.sinn-bullet-list[data-marker='dot']) > :where(li)::before {
82
+ background-color: currentColor;
83
+ }
84
+
85
+ @media (forced-colors: active) {
86
+ :where(.sinn-bullet-list[data-marker='check']) > :where(li)::after,
87
+ :where(.sinn-bullet-list[data-marker='dot']) > :where(li)::before { forced-color-adjust: none; background-color: CanvasText; }
88
+ }
89
+ }