@sepale/components 0.0.0-stage → 0.1.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 (261) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -3
  3. package/dist/components/Accordion.svelte +48 -0
  4. package/dist/components/Accordion.svelte.d.ts +24 -0
  5. package/dist/components/Alert.svelte +107 -0
  6. package/dist/components/Alert.svelte.d.ts +40 -0
  7. package/dist/components/Avatar.svelte +75 -0
  8. package/dist/components/Avatar.svelte.d.ts +37 -0
  9. package/dist/components/Badge.svelte +46 -0
  10. package/dist/components/Badge.svelte.d.ts +22 -0
  11. package/dist/components/Breadcrumbs.svelte +36 -0
  12. package/dist/components/Breadcrumbs.svelte.d.ts +18 -0
  13. package/dist/components/Bubble.svelte +43 -0
  14. package/dist/components/Bubble.svelte.d.ts +23 -0
  15. package/dist/components/Button.svelte +132 -0
  16. package/dist/components/Button.svelte.d.ts +40 -0
  17. package/dist/components/Calendar.svelte +193 -0
  18. package/dist/components/Calendar.svelte.d.ts +60 -0
  19. package/dist/components/Card.svelte +69 -0
  20. package/dist/components/Card.svelte.d.ts +37 -0
  21. package/dist/components/Carousel.svelte +550 -0
  22. package/dist/components/Carousel.svelte.d.ts +124 -0
  23. package/dist/components/Checkbox.svelte +48 -0
  24. package/dist/components/Checkbox.svelte.d.ts +26 -0
  25. package/dist/components/Chip.svelte +60 -0
  26. package/dist/components/Chip.svelte.d.ts +26 -0
  27. package/dist/components/ChipsInput.svelte +158 -0
  28. package/dist/components/ChipsInput.svelte.d.ts +64 -0
  29. package/dist/components/Collapse.svelte +101 -0
  30. package/dist/components/Collapse.svelte.d.ts +46 -0
  31. package/dist/components/ColorPicker.svelte +135 -0
  32. package/dist/components/ColorPicker.svelte.d.ts +44 -0
  33. package/dist/components/Combobox.svelte +496 -0
  34. package/dist/components/Combobox.svelte.d.ts +96 -0
  35. package/dist/components/DataControl.svelte +754 -0
  36. package/dist/components/DataControl.svelte.d.ts +143 -0
  37. package/dist/components/DataHandler.svelte +67 -0
  38. package/dist/components/DataHandler.svelte.d.ts +44 -0
  39. package/dist/components/DatePicker.svelte +185 -0
  40. package/dist/components/DatePicker.svelte.d.ts +56 -0
  41. package/dist/components/Dialog.svelte +194 -0
  42. package/dist/components/Dialog.svelte.d.ts +51 -0
  43. package/dist/components/Divider.svelte +54 -0
  44. package/dist/components/Divider.svelte.d.ts +27 -0
  45. package/dist/components/Dock.svelte +34 -0
  46. package/dist/components/Dock.svelte.d.ts +18 -0
  47. package/dist/components/Drawer.svelte +174 -0
  48. package/dist/components/Drawer.svelte.d.ts +51 -0
  49. package/dist/components/Dropdown.svelte +183 -0
  50. package/dist/components/Dropdown.svelte.d.ts +52 -0
  51. package/dist/components/Editable.svelte +292 -0
  52. package/dist/components/Editable.svelte.d.ts +113 -0
  53. package/dist/components/EmptyState.svelte +64 -0
  54. package/dist/components/EmptyState.svelte.d.ts +29 -0
  55. package/dist/components/Fieldset.svelte +42 -0
  56. package/dist/components/Fieldset.svelte.d.ts +20 -0
  57. package/dist/components/FileDropzone.svelte +154 -0
  58. package/dist/components/FileDropzone.svelte.d.ts +45 -0
  59. package/dist/components/FileExplorer.svelte +643 -0
  60. package/dist/components/FileExplorer.svelte.d.ts +114 -0
  61. package/dist/components/FileInput.svelte +125 -0
  62. package/dist/components/FileInput.svelte.d.ts +51 -0
  63. package/dist/components/FloatingLabel.svelte +38 -0
  64. package/dist/components/FloatingLabel.svelte.d.ts +24 -0
  65. package/dist/components/Footer.svelte +68 -0
  66. package/dist/components/Footer.svelte.d.ts +37 -0
  67. package/dist/components/Grid.svelte +122 -0
  68. package/dist/components/Grid.svelte.d.ts +72 -0
  69. package/dist/components/Hero.svelte +62 -0
  70. package/dist/components/Hero.svelte.d.ts +33 -0
  71. package/dist/components/Input.svelte +184 -0
  72. package/dist/components/Input.svelte.d.ts +65 -0
  73. package/dist/components/Join.svelte +38 -0
  74. package/dist/components/Join.svelte.d.ts +21 -0
  75. package/dist/components/Kanban.svelte +284 -0
  76. package/dist/components/Kanban.svelte.d.ts +93 -0
  77. package/dist/components/Label.svelte +32 -0
  78. package/dist/components/Label.svelte.d.ts +21 -0
  79. package/dist/components/LaptopFrame.svelte +44 -0
  80. package/dist/components/LaptopFrame.svelte.d.ts +21 -0
  81. package/dist/components/List.svelte +95 -0
  82. package/dist/components/List.svelte.d.ts +69 -0
  83. package/dist/components/Loading.svelte +37 -0
  84. package/dist/components/Loading.svelte.d.ts +17 -0
  85. package/dist/components/Menu.svelte +144 -0
  86. package/dist/components/Menu.svelte.d.ts +53 -0
  87. package/dist/components/MobileFrame.svelte +41 -0
  88. package/dist/components/MobileFrame.svelte.d.ts +21 -0
  89. package/dist/components/Navbar.svelte +49 -0
  90. package/dist/components/Navbar.svelte.d.ts +25 -0
  91. package/dist/components/NumberInput.svelte +255 -0
  92. package/dist/components/NumberInput.svelte.d.ts +68 -0
  93. package/dist/components/Pagination.svelte +169 -0
  94. package/dist/components/Pagination.svelte.d.ts +50 -0
  95. package/dist/components/Progress.svelte +65 -0
  96. package/dist/components/Progress.svelte.d.ts +28 -0
  97. package/dist/components/RadialProgress.svelte +48 -0
  98. package/dist/components/RadialProgress.svelte.d.ts +20 -0
  99. package/dist/components/Radio.svelte +50 -0
  100. package/dist/components/Radio.svelte.d.ts +28 -0
  101. package/dist/components/Range.svelte +53 -0
  102. package/dist/components/Range.svelte.d.ts +26 -0
  103. package/dist/components/Rating.svelte +90 -0
  104. package/dist/components/Rating.svelte.d.ts +41 -0
  105. package/dist/components/Select.svelte +338 -0
  106. package/dist/components/Select.svelte.d.ts +74 -0
  107. package/dist/components/Sidebar.svelte +100 -0
  108. package/dist/components/Sidebar.svelte.d.ts +54 -0
  109. package/dist/components/Skeleton.svelte +40 -0
  110. package/dist/components/Skeleton.svelte.d.ts +18 -0
  111. package/dist/components/Stat.svelte +71 -0
  112. package/dist/components/Stat.svelte.d.ts +35 -0
  113. package/dist/components/Stats.svelte +38 -0
  114. package/dist/components/Stats.svelte.d.ts +22 -0
  115. package/dist/components/Steps.svelte +204 -0
  116. package/dist/components/Steps.svelte.d.ts +66 -0
  117. package/dist/components/Subtitle.svelte +44 -0
  118. package/dist/components/Subtitle.svelte.d.ts +26 -0
  119. package/dist/components/Swatch.svelte +61 -0
  120. package/dist/components/Swatch.svelte.d.ts +27 -0
  121. package/dist/components/Switch.svelte +105 -0
  122. package/dist/components/Switch.svelte.d.ts +44 -0
  123. package/dist/components/Table.svelte +243 -0
  124. package/dist/components/Table.svelte.d.ts +121 -0
  125. package/dist/components/Tabs.svelte +142 -0
  126. package/dist/components/Tabs.svelte.d.ts +80 -0
  127. package/dist/components/Text.svelte +43 -0
  128. package/dist/components/Text.svelte.d.ts +25 -0
  129. package/dist/components/Textarea.svelte +76 -0
  130. package/dist/components/Textarea.svelte.d.ts +39 -0
  131. package/dist/components/Title.svelte +46 -0
  132. package/dist/components/Title.svelte.d.ts +29 -0
  133. package/dist/components/Toast.svelte +154 -0
  134. package/dist/components/Toast.svelte.d.ts +49 -0
  135. package/dist/components/Toggle.svelte +48 -0
  136. package/dist/components/Toggle.svelte.d.ts +25 -0
  137. package/dist/components/Tooltip.svelte +70 -0
  138. package/dist/components/Tooltip.svelte.d.ts +34 -0
  139. package/dist/components/WindowFrame.svelte +53 -0
  140. package/dist/components/WindowFrame.svelte.d.ts +24 -0
  141. package/dist/components/accordion-context.d.ts +8 -0
  142. package/dist/components/accordion-context.js +25 -0
  143. package/dist/components/color.d.ts +39 -0
  144. package/dist/components/color.js +92 -0
  145. package/dist/components/data-handler.svelte.d.ts +362 -0
  146. package/dist/components/data-handler.svelte.js +690 -0
  147. package/dist/components/file-icons.d.ts +25 -0
  148. package/dist/components/file-icons.js +46 -0
  149. package/dist/family-types.d.ts +45 -0
  150. package/dist/family-types.js +73 -0
  151. package/dist/generated/classes.d.ts +17 -0
  152. package/dist/generated/classes.js +2511 -0
  153. package/dist/generated/components.d.ts +39 -0
  154. package/dist/generated/components.js +28666 -0
  155. package/dist/generated/registry.d.ts +35 -0
  156. package/dist/generated/registry.js +2658 -0
  157. package/dist/index.d.ts +73 -0
  158. package/dist/index.js +99 -0
  159. package/dist/sepale-types.d.ts +8 -0
  160. package/dist/sepale-types.js +200 -0
  161. package/dist/theme.d.ts +123 -0
  162. package/dist/theme.js +226 -0
  163. package/dist/variants.d.ts +124 -0
  164. package/dist/variants.js +70 -0
  165. package/dist/vendor/air-datepicker/LICENSE.md +21 -0
  166. package/dist/vendor/air-datepicker/README.md +19 -0
  167. package/dist/vendor/air-datepicker/buttonPresets.d.ts +13 -0
  168. package/dist/vendor/air-datepicker/buttonPresets.js +12 -0
  169. package/dist/vendor/air-datepicker/consts.d.ts +18 -0
  170. package/dist/vendor/air-datepicker/consts.js +35 -0
  171. package/dist/vendor/air-datepicker/datepicker.d.ts +289 -0
  172. package/dist/vendor/air-datepicker/datepicker.js +1435 -0
  173. package/dist/vendor/air-datepicker/datepickerBody.d.ts +46 -0
  174. package/dist/vendor/air-datepicker/datepickerBody.js +386 -0
  175. package/dist/vendor/air-datepicker/datepickerButtons.d.ts +25 -0
  176. package/dist/vendor/air-datepicker/datepickerButtons.js +85 -0
  177. package/dist/vendor/air-datepicker/datepickerCell.d.ts +35 -0
  178. package/dist/vendor/air-datepicker/datepickerCell.js +297 -0
  179. package/dist/vendor/air-datepicker/datepickerKeyboard.d.ts +26 -0
  180. package/dist/vendor/air-datepicker/datepickerKeyboard.js +207 -0
  181. package/dist/vendor/air-datepicker/datepickerNav.d.ts +31 -0
  182. package/dist/vendor/air-datepicker/datepickerNav.js +200 -0
  183. package/dist/vendor/air-datepicker/datepickerTime.d.ts +60 -0
  184. package/dist/vendor/air-datepicker/datepickerTime.js +276 -0
  185. package/dist/vendor/air-datepicker/defaults.d.ts +65 -0
  186. package/dist/vendor/air-datepicker/defaults.js +79 -0
  187. package/dist/vendor/air-datepicker/index.d.ts +168 -0
  188. package/dist/vendor/air-datepicker/index.js +3 -0
  189. package/dist/vendor/air-datepicker/locale/ar.d.ts +4 -0
  190. package/dist/vendor/air-datepicker/locale/ar.js +14 -0
  191. package/dist/vendor/air-datepicker/locale/bg.d.ts +4 -0
  192. package/dist/vendor/air-datepicker/locale/bg.js +14 -0
  193. package/dist/vendor/air-datepicker/locale/ca.d.ts +4 -0
  194. package/dist/vendor/air-datepicker/locale/ca.js +14 -0
  195. package/dist/vendor/air-datepicker/locale/cs.d.ts +4 -0
  196. package/dist/vendor/air-datepicker/locale/cs.js +14 -0
  197. package/dist/vendor/air-datepicker/locale/da.d.ts +4 -0
  198. package/dist/vendor/air-datepicker/locale/da.js +14 -0
  199. package/dist/vendor/air-datepicker/locale/de.d.ts +4 -0
  200. package/dist/vendor/air-datepicker/locale/de.js +14 -0
  201. package/dist/vendor/air-datepicker/locale/el.d.ts +4 -0
  202. package/dist/vendor/air-datepicker/locale/el.js +14 -0
  203. package/dist/vendor/air-datepicker/locale/en.d.ts +4 -0
  204. package/dist/vendor/air-datepicker/locale/en.js +14 -0
  205. package/dist/vendor/air-datepicker/locale/es.d.ts +4 -0
  206. package/dist/vendor/air-datepicker/locale/es.js +14 -0
  207. package/dist/vendor/air-datepicker/locale/eu.d.ts +4 -0
  208. package/dist/vendor/air-datepicker/locale/eu.js +14 -0
  209. package/dist/vendor/air-datepicker/locale/fi.d.ts +4 -0
  210. package/dist/vendor/air-datepicker/locale/fi.js +14 -0
  211. package/dist/vendor/air-datepicker/locale/fr.d.ts +4 -0
  212. package/dist/vendor/air-datepicker/locale/fr.js +14 -0
  213. package/dist/vendor/air-datepicker/locale/hr.d.ts +4 -0
  214. package/dist/vendor/air-datepicker/locale/hr.js +14 -0
  215. package/dist/vendor/air-datepicker/locale/hu.d.ts +4 -0
  216. package/dist/vendor/air-datepicker/locale/hu.js +14 -0
  217. package/dist/vendor/air-datepicker/locale/id.d.ts +4 -0
  218. package/dist/vendor/air-datepicker/locale/id.js +14 -0
  219. package/dist/vendor/air-datepicker/locale/it.d.ts +4 -0
  220. package/dist/vendor/air-datepicker/locale/it.js +14 -0
  221. package/dist/vendor/air-datepicker/locale/ja.d.ts +4 -0
  222. package/dist/vendor/air-datepicker/locale/ja.js +14 -0
  223. package/dist/vendor/air-datepicker/locale/ko.d.ts +4 -0
  224. package/dist/vendor/air-datepicker/locale/ko.js +14 -0
  225. package/dist/vendor/air-datepicker/locale/nb.d.ts +4 -0
  226. package/dist/vendor/air-datepicker/locale/nb.js +14 -0
  227. package/dist/vendor/air-datepicker/locale/nl.d.ts +4 -0
  228. package/dist/vendor/air-datepicker/locale/nl.js +14 -0
  229. package/dist/vendor/air-datepicker/locale/pl.d.ts +4 -0
  230. package/dist/vendor/air-datepicker/locale/pl.js +14 -0
  231. package/dist/vendor/air-datepicker/locale/pt-BR.d.ts +4 -0
  232. package/dist/vendor/air-datepicker/locale/pt-BR.js +14 -0
  233. package/dist/vendor/air-datepicker/locale/pt.d.ts +4 -0
  234. package/dist/vendor/air-datepicker/locale/pt.js +14 -0
  235. package/dist/vendor/air-datepicker/locale/ro.d.ts +4 -0
  236. package/dist/vendor/air-datepicker/locale/ro.js +14 -0
  237. package/dist/vendor/air-datepicker/locale/ru.d.ts +4 -0
  238. package/dist/vendor/air-datepicker/locale/ru.js +14 -0
  239. package/dist/vendor/air-datepicker/locale/si.d.ts +4 -0
  240. package/dist/vendor/air-datepicker/locale/si.js +14 -0
  241. package/dist/vendor/air-datepicker/locale/sk.d.ts +4 -0
  242. package/dist/vendor/air-datepicker/locale/sk.js +14 -0
  243. package/dist/vendor/air-datepicker/locale/sl.d.ts +4 -0
  244. package/dist/vendor/air-datepicker/locale/sl.js +14 -0
  245. package/dist/vendor/air-datepicker/locale/sv.d.ts +4 -0
  246. package/dist/vendor/air-datepicker/locale/sv.js +14 -0
  247. package/dist/vendor/air-datepicker/locale/th.d.ts +4 -0
  248. package/dist/vendor/air-datepicker/locale/th.js +14 -0
  249. package/dist/vendor/air-datepicker/locale/tr.d.ts +4 -0
  250. package/dist/vendor/air-datepicker/locale/tr.js +16 -0
  251. package/dist/vendor/air-datepicker/locale/uk.d.ts +4 -0
  252. package/dist/vendor/air-datepicker/locale/uk.js +14 -0
  253. package/dist/vendor/air-datepicker/locale/zh.d.ts +4 -0
  254. package/dist/vendor/air-datepicker/locale/zh.js +14 -0
  255. package/dist/vendor/air-datepicker/typedefs.d.ts +3 -0
  256. package/dist/vendor/air-datepicker/typedefs.js +15 -0
  257. package/dist/vendor/air-datepicker/utils.d.ts +155 -0
  258. package/dist/vendor/air-datepicker/utils.js +395 -0
  259. package/dist/vendor/air-datepicker/withEvents.d.ts +1 -0
  260. package/dist/vendor/air-datepicker/withEvents.js +39 -0
  261. package/package.json +44 -3
@@ -0,0 +1,70 @@
1
+ <script module lang="ts">
2
+ /** What .tooltip is made of, classified. The props follow the
3
+ families the project registers (variants.ts, ADR 0015). */
4
+ export const PREFIX = 'tooltip';
5
+
6
+ export const AXES = {
7
+ /* The side of the trigger the bubble sits on. */
8
+ side: ['top', 'right', 'bottom', 'left'],
9
+ color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error']
10
+ } as const;
11
+
12
+ export const FLAGS = {
13
+ open: 'Show the bubble all the time, not only on hover and focus.',
14
+ float:
15
+ 'Where the browser has anchor positioning: escape clipping ancestors and flip when there is no room (no arrow then). Ignored elsewhere.'
16
+ } as const;
17
+ export const PARTS = ['content'] as const;
18
+ </script>
19
+
20
+ <script lang="ts">
21
+ /**
22
+ * A short hint next to its trigger, on hover and on keyboard focus.
23
+ *
24
+ * Pure CSS: the bubble does not move to stay on screen. Pick the `side`
25
+ * that has room. The first focusable element inside gets `aria-describedby`
26
+ * pointing at the bubble, so a screen reader reads the hint too.
27
+ */
28
+ import type { Snippet } from 'svelte';
29
+ import type { HTMLAttributes } from 'svelte/elements';
30
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
31
+
32
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLSpanElement>, 'color'> {
33
+ /** The hint, as text. */
34
+ text?: string;
35
+ /** The hint, as markup. Wins over `text`. */
36
+ tip?: Snippet;
37
+ class?: string;
38
+ /** The trigger. */
39
+ children?: Snippet;
40
+ }
41
+
42
+ // The axes are deliberately NOT destructured: they travel in `axes` and are
43
+ // resolved by name, so an axis a family drops changes nothing down here.
44
+ let {
45
+ text,
46
+ tip,
47
+ class: klass = '',
48
+ children,
49
+ ...axes
50
+ }: Props = $props();
51
+
52
+ let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
53
+ let classes = $derived(cx(PREFIX, applied.classes, klass));
54
+
55
+ const id = `tooltip-${Math.random().toString(36).slice(2, 9)}`;
56
+
57
+ /** Points the trigger at the bubble, for assistive technology. */
58
+ function describe(node: HTMLElement) {
59
+ const trigger = node.querySelector<HTMLElement>('a[href], button, input, select, textarea, [tabindex]');
60
+ trigger?.setAttribute('aria-describedby', id);
61
+ }
62
+ </script>
63
+
64
+ <!-- The anchor name is per instance: `float` ties this bubble to this trigger. -->
65
+ <span {...applied.rest} class={classes} style:--tooltip-anchor="--{id}" use:describe>
66
+ {@render children?.()}
67
+ <span class="tooltip-content" role="tooltip" {id}>
68
+ {#if tip}{@render tip()}{:else}{text}{/if}
69
+ </span>
70
+ </span>
@@ -0,0 +1,34 @@
1
+ /** What .tooltip is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015). */
3
+ export declare const PREFIX = "tooltip";
4
+ export declare const AXES: {
5
+ readonly side: readonly ["top", "right", "bottom", "left"];
6
+ readonly color: readonly ["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"];
7
+ };
8
+ export declare const FLAGS: {
9
+ readonly open: "Show the bubble all the time, not only on hover and focus.";
10
+ readonly float: "Where the browser has anchor positioning: escape clipping ancestors and flip when there is no room (no arrow then). Ignored elsewhere.";
11
+ };
12
+ export declare const PARTS: readonly ["content"];
13
+ /**
14
+ * A short hint next to its trigger, on hover and on keyboard focus.
15
+ *
16
+ * Pure CSS: the bubble does not move to stay on screen. Pick the `side`
17
+ * that has room. The first focusable element inside gets `aria-describedby`
18
+ * pointing at the bubble, so a screen reader reads the hint too.
19
+ */
20
+ import type { Snippet } from 'svelte';
21
+ import type { HTMLAttributes } from 'svelte/elements';
22
+ import { type AxisProps } from '../variants.js';
23
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLSpanElement>, 'color'> {
24
+ /** The hint, as text. */
25
+ text?: string;
26
+ /** The hint, as markup. Wins over `text`. */
27
+ tip?: Snippet;
28
+ class?: string;
29
+ /** The trigger. */
30
+ children?: Snippet;
31
+ }
32
+ declare const Tooltip: import("svelte").Component<Props, {}, "">;
33
+ type Tooltip = ReturnType<typeof Tooltip>;
34
+ export default Tooltip;
@@ -0,0 +1,53 @@
1
+ <script module lang="ts">
2
+ /** What .window-frame is made of, classified. The props follow the
3
+ families the project registers (variants.ts, ADR 0015). */
4
+ export const PREFIX = 'window-frame';
5
+
6
+ export const AXES = {} as const;
7
+
8
+ export const FLAGS = {} as const;
9
+ export const PARTS = ['bar', 'controls', 'title', 'actions', 'body'] as const;
10
+ </script>
11
+
12
+ <script lang="ts">
13
+ /**
14
+ * An application window drawn around content: a title bar with three window
15
+ * controls, a title and actions, above a body that scrolls.
16
+ */
17
+ import type { Snippet } from 'svelte';
18
+ import type { HTMLAttributes } from 'svelte/elements';
19
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
20
+
21
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
22
+ /** The title, as text or as markup. */
23
+ title?: string | Snippet;
24
+ /** Buttons on the right of the bar. */
25
+ actions?: Snippet;
26
+ class?: string;
27
+ children?: Snippet;
28
+ }
29
+
30
+ // The axes are deliberately NOT destructured: they travel in `axes` and are
31
+ // resolved by name, so an axis a family drops changes nothing down here.
32
+ let {
33
+ title,
34
+ actions,
35
+ class: klass = '',
36
+ children,
37
+ ...axes
38
+ }: Props = $props();
39
+
40
+ let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
41
+ let classes = $derived(cx(PREFIX, applied.classes, klass));
42
+ </script>
43
+
44
+ <div {...applied.rest} class={classes}>
45
+ <div class="window-frame-bar">
46
+ <span class="window-frame-controls" aria-hidden="true"><span></span><span></span><span></span></span>
47
+ <span class="window-frame-title">
48
+ {#if typeof title === 'function'}{@render title()}{:else}{title ?? ''}{/if}
49
+ </span>
50
+ <span class="window-frame-actions">{@render actions?.()}</span>
51
+ </div>
52
+ <div class="window-frame-body">{@render children?.()}</div>
53
+ </div>
@@ -0,0 +1,24 @@
1
+ /** What .window-frame is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015). */
3
+ export declare const PREFIX = "window-frame";
4
+ export declare const AXES: {};
5
+ export declare const FLAGS: {};
6
+ export declare const PARTS: readonly ["bar", "controls", "title", "actions", "body"];
7
+ /**
8
+ * An application window drawn around content: a title bar with three window
9
+ * controls, a title and actions, above a body that scrolls.
10
+ */
11
+ import type { Snippet } from 'svelte';
12
+ import type { HTMLAttributes } from 'svelte/elements';
13
+ import { type AxisProps } from '../variants.js';
14
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
15
+ /** The title, as text or as markup. */
16
+ title?: string | Snippet;
17
+ /** Buttons on the right of the bar. */
18
+ actions?: Snippet;
19
+ class?: string;
20
+ children?: Snippet;
21
+ }
22
+ declare const WindowFrame: import("svelte").Component<Props, {}, "">;
23
+ type WindowFrame = ReturnType<typeof WindowFrame>;
24
+ export default WindowFrame;
@@ -0,0 +1,8 @@
1
+ export interface AccordionGroup {
2
+ /** Join the group; returns the function to leave it. */
3
+ join(close: () => void): () => void;
4
+ /** A member opened: an exclusive group closes the others. */
5
+ opened(close: () => void): void;
6
+ }
7
+ export declare function setAccordion(exclusive: () => boolean): void;
8
+ export declare function getAccordion(): AccordionGroup | undefined;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * How an Accordion and its Collapses talk: a Collapse that opens tells the
3
+ * group, and an exclusive group closes every other member.
4
+ */
5
+ import { getContext, setContext } from 'svelte';
6
+ const KEY = Symbol('accordion');
7
+ export function setAccordion(exclusive) {
8
+ const members = new Set();
9
+ setContext(KEY, {
10
+ join(close) {
11
+ members.add(close);
12
+ return () => members.delete(close);
13
+ },
14
+ opened(close) {
15
+ if (!exclusive())
16
+ return;
17
+ for (const other of members)
18
+ if (other !== close)
19
+ other();
20
+ }
21
+ });
22
+ }
23
+ export function getAccordion() {
24
+ return getContext(KEY);
25
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * A CSS colour, as the six hex digits `<input type="color">` insists on.
3
+ *
4
+ * Two conversions, and both are needed:
5
+ *
6
+ * 1. The value may be a reference — `var(--color-primary)` — so it is resolved
7
+ * against the document first, by assigning it to a probe element and
8
+ * reading the computed value back.
9
+ *
10
+ * 2. That computed value is NOT necessarily rgb. A browser keeps
11
+ * `oklch(1 0 0)` as `oklch(1 0 0)`, and reading three numbers out of it
12
+ * gives 1, 0, 0 — which as bytes is very nearly black. That is what used to
13
+ * happen to every daisy theme, whose whole palette is oklch: the swatches
14
+ * all came out black. So the resolved colour is painted onto a 1×1 canvas
15
+ * and the pixel is read, which is sRGB by definition whatever the input
16
+ * colour space was.
17
+ *
18
+ * The picker is the only thing that needs this. The tile beside it is a
19
+ * `.swatch` with the raw value in `--swatch-color`, and CSS renders oklch
20
+ * perfectly well — so what you SEE is always right even when the conversion
21
+ * is not.
22
+ */
23
+ export declare function colorToHex(input: string): string;
24
+ export interface Oklch {
25
+ l: number;
26
+ c: number;
27
+ h: number;
28
+ }
29
+ export declare function toOklch(input: string): Oklch;
30
+ /** The three numbers back as CSS, in the notation a theme file carries. */
31
+ export declare const oklchToCss: ({ l, c, h }: Oklch) => string;
32
+ /**
33
+ * WCAG contrast against a surface, measured off real pixels.
34
+ *
35
+ * Not computed from the lightness: two colours at the same OKLCH lightness
36
+ * can be a stop apart in relative luminance, and the badge has to say what a
37
+ * checker would say rather than what the slider suggests.
38
+ */
39
+ export declare function contrastRatio(a: string, b: string): number;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * A CSS colour, as the six hex digits `<input type="color">` insists on.
3
+ *
4
+ * Two conversions, and both are needed:
5
+ *
6
+ * 1. The value may be a reference — `var(--color-primary)` — so it is resolved
7
+ * against the document first, by assigning it to a probe element and
8
+ * reading the computed value back.
9
+ *
10
+ * 2. That computed value is NOT necessarily rgb. A browser keeps
11
+ * `oklch(1 0 0)` as `oklch(1 0 0)`, and reading three numbers out of it
12
+ * gives 1, 0, 0 — which as bytes is very nearly black. That is what used to
13
+ * happen to every daisy theme, whose whole palette is oklch: the swatches
14
+ * all came out black. So the resolved colour is painted onto a 1×1 canvas
15
+ * and the pixel is read, which is sRGB by definition whatever the input
16
+ * colour space was.
17
+ *
18
+ * The picker is the only thing that needs this. The tile beside it is a
19
+ * `.swatch` with the raw value in `--swatch-color`, and CSS renders oklch
20
+ * perfectly well — so what you SEE is always right even when the conversion
21
+ * is not.
22
+ */
23
+ let probe = null;
24
+ let ctx = null;
25
+ export function colorToHex(input) {
26
+ if (typeof document === 'undefined')
27
+ return '#000000';
28
+ if (!probe) {
29
+ probe = document.createElement('span');
30
+ probe.style.display = 'none';
31
+ document.body.appendChild(probe);
32
+ }
33
+ /* Reset then assign, so an invalid value leaves black rather than whatever
34
+ the previous call left behind. */
35
+ probe.style.color = '#000000';
36
+ probe.style.color = input;
37
+ const resolved = getComputedStyle(probe).color;
38
+ if (!ctx) {
39
+ const canvas = document.createElement('canvas');
40
+ canvas.width = canvas.height = 1;
41
+ ctx = canvas.getContext('2d', { willReadFrequently: true });
42
+ }
43
+ if (!ctx)
44
+ return '#000000';
45
+ try {
46
+ /* Clear first: a colour with alpha would otherwise composite over the
47
+ previous pixel and come back wrong. */
48
+ ctx.clearRect(0, 0, 1, 1);
49
+ ctx.fillStyle = '#000000';
50
+ ctx.fillStyle = resolved;
51
+ ctx.fillRect(0, 0, 1, 1);
52
+ const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data;
53
+ return '#' + [r, g, b].map((n = 0) => n.toString(16).padStart(2, '0')).join('');
54
+ }
55
+ catch {
56
+ return '#000000';
57
+ }
58
+ }
59
+ const lin = (v) => (v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4);
60
+ export function toOklch(input) {
61
+ const hex = colorToHex(input);
62
+ const [r = 0, g = 0, b = 0] = [1, 3, 5].map((i) => lin(parseInt(hex.slice(i, i + 2), 16) / 255));
63
+ const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
64
+ const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
65
+ const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
66
+ const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s;
67
+ const A = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s;
68
+ const B = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s;
69
+ return {
70
+ l: Math.round(L * 1000) / 1000,
71
+ c: Math.round(Math.hypot(A, B) * 1000) / 1000,
72
+ h: Math.round((((Math.atan2(B, A) * 180) / Math.PI + 360) % 360) * 10) / 10
73
+ };
74
+ }
75
+ /** The three numbers back as CSS, in the notation a theme file carries. */
76
+ export const oklchToCss = ({ l, c, h }) => `oklch(${Math.round(l * 1000) / 10}% ${Math.round(c * 1000) / 1000} ${h})`;
77
+ /**
78
+ * WCAG contrast against a surface, measured off real pixels.
79
+ *
80
+ * Not computed from the lightness: two colours at the same OKLCH lightness
81
+ * can be a stop apart in relative luminance, and the badge has to say what a
82
+ * checker would say rather than what the slider suggests.
83
+ */
84
+ export function contrastRatio(a, b) {
85
+ const lum = (x) => {
86
+ const hex = colorToHex(x);
87
+ const [r = 0, g = 0, bl = 0] = [1, 3, 5].map((i) => lin(parseInt(hex.slice(i, i + 2), 16) / 255));
88
+ return 0.2126 * r + 0.7152 * g + 0.0722 * bl;
89
+ };
90
+ const [x, y] = [lum(a), lum(b)];
91
+ return Math.round(((Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05)) * 10) / 10;
92
+ }