@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,80 @@
1
+ /** What .tabs is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015).
3
+
4
+ One namespace, `tabs`: the strip AND the tabs in it (ADR 0009). The
5
+ component draws every tab, so `.tabs-item` and its states are PARTS.
6
+ A panel is rendered right after its tab because the CSS reaches it with
7
+ `+` — moving it elsewhere would break the selector. */
8
+ export declare const PREFIX = "tabs";
9
+ export declare const AXES: {
10
+ readonly size: readonly ["xs", "sm", "md", "lg", "xl"];
11
+ readonly variant: readonly ["border", "box", "lift"];
12
+ readonly placement: readonly ["top", "bottom"];
13
+ };
14
+ export declare const FLAGS: {};
15
+ export declare const PARTS: readonly ["item", "item-active", "item-disabled", "item-content", "indicator"];
16
+ import type { Snippet } from 'svelte';
17
+ /** One tab, and optionally the panel it reveals. */
18
+ export interface TabItem<V = string | number> {
19
+ /** The tab's text, or a snippet drawing whatever belongs in its place. */
20
+ label: string | Snippet;
21
+ /** What identifies the tab when the strip is driven by `value` rather than by index. */
22
+ value?: V;
23
+ /** Unreachable, and drawn as such. */
24
+ disabled?: boolean;
25
+ /** What the tab shows when selected. Omit to place panels yourself. */
26
+ content?: Snippet;
27
+ }
28
+ import type { HTMLAttributes } from 'svelte/elements';
29
+ declare function $$render<V extends string | number>(): {
30
+ props: {
31
+ readonly size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
32
+ readonly variant?: "border" | "box" | "lift" | undefined;
33
+ readonly placement?: "top" | "bottom" | undefined;
34
+ } & {} & {
35
+ background?: string;
36
+ } & HTMLAttributes<HTMLDivElement> & {
37
+ /**
38
+ * The tabs, in order. A tab's `label` takes a snippet as readily as a
39
+ * string, for the one tab that carries an icon or a count.
40
+ */
41
+ tabs?: TabItem<V>[];
42
+ /**
43
+ * How to draw the inside of every tab. Written once for the whole strip;
44
+ * a tab whose own `label` is a snippet skips it.
45
+ */
46
+ tab?: Snippet<[TabItem<V>]>;
47
+ /** Index of the selected tab. Bindable, so a parent can drive it. */
48
+ active?: number;
49
+ /** `value` of the selected tab, for tabs keyed by their own id rather than by
50
+ position. Bindable. When set, it decides the selection over `active`. */
51
+ value?: V;
52
+ /** Called with the new index, and the tab's `value`, when a tab is chosen. */
53
+ onSelect?: (index: number, value: V | undefined) => void;
54
+ /** Slide the selection from one tab to the next. Not with `lift`, whose
55
+ tab opens into its panel. */
56
+ animated?: boolean;
57
+ class?: string;
58
+ };
59
+ exports: {};
60
+ bindings: "active" | "value";
61
+ slots: {};
62
+ events: {};
63
+ };
64
+ declare class __sveltets_Render<V extends string | number> {
65
+ props(): ReturnType<typeof $$render<V>>['props'];
66
+ events(): ReturnType<typeof $$render<V>>['events'];
67
+ slots(): ReturnType<typeof $$render<V>>['slots'];
68
+ bindings(): "active" | "value";
69
+ exports(): {};
70
+ }
71
+ interface $$IsomorphicComponent {
72
+ new <V extends string | number>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<V>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<V>['props']>, ReturnType<__sveltets_Render<V>['events']>, ReturnType<__sveltets_Render<V>['slots']>> & {
73
+ $$bindings?: ReturnType<__sveltets_Render<V>['bindings']>;
74
+ } & ReturnType<__sveltets_Render<V>['exports']>;
75
+ <V extends string | number>(internal: unknown, props: ReturnType<__sveltets_Render<V>['props']> & {}): ReturnType<__sveltets_Render<V>['exports']>;
76
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
77
+ }
78
+ declare const Tabs: $$IsomorphicComponent;
79
+ type Tabs<V extends string | number> = InstanceType<typeof Tabs<V>>;
80
+ export default Tabs;
@@ -0,0 +1,43 @@
1
+ <script module lang="ts">
2
+ /** What .text is made of, classified. */
3
+ export const PREFIX = 'text';
4
+
5
+ /* Two axes rather than one product. `s` carries the size AND the leading
6
+ that belongs with it, `b` carries the weight; they never interacted, so
7
+ the twelve `.text-sN-bN` classes were twelve ways of saying seven
8
+ things. */
9
+ export const AXES = {
10
+ s: ['1', '2', '3', '4'],
11
+ b: ['1', '2', '3'],
12
+ color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error']
13
+ } as const;
14
+
15
+ export const FLAGS = {} as const;
16
+ export const PARTS = [] as const;
17
+ </script>
18
+
19
+ <script lang="ts">
20
+ /**
21
+ * A paragraph.
22
+ *
23
+ * No `level`: a paragraph has no heading level to pick. It renders `<p>`,
24
+ * and a `<span>` would be a different prop on the day something needs one.
25
+ */
26
+ import type { Snippet } from 'svelte';
27
+ import type { HTMLAttributes } from 'svelte/elements';
28
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
29
+
30
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLParagraphElement>, 'color'> {
31
+ class?: string;
32
+ children?: Snippet;
33
+ }
34
+
35
+ /* Both defaulted: `.text` alone is not a class, so a paragraph with no
36
+ props still has to name a size and a weight to have either. */
37
+ let { s = '2', b = '3', class: klass = '', children, ...axes }: Props = $props();
38
+
39
+ let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, { ...axes, s, b }));
40
+ let classes = $derived(cx(applied.classes, klass));
41
+ </script>
42
+
43
+ <p class={classes} {...applied.rest}>{@render children?.()}</p>
@@ -0,0 +1,25 @@
1
+ /** What .text is made of, classified. */
2
+ export declare const PREFIX = "text";
3
+ export declare const AXES: {
4
+ readonly s: readonly ["1", "2", "3", "4"];
5
+ readonly b: readonly ["1", "2", "3"];
6
+ readonly color: readonly ["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"];
7
+ };
8
+ export declare const FLAGS: {};
9
+ export declare const PARTS: readonly [];
10
+ /**
11
+ * A paragraph.
12
+ *
13
+ * No `level`: a paragraph has no heading level to pick. It renders `<p>`,
14
+ * and a `<span>` would be a different prop on the day something needs one.
15
+ */
16
+ import type { Snippet } from 'svelte';
17
+ import type { HTMLAttributes } from 'svelte/elements';
18
+ import { type AxisProps } from '../variants.js';
19
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLParagraphElement>, 'color'> {
20
+ class?: string;
21
+ children?: Snippet;
22
+ }
23
+ declare const Text: import("svelte").Component<Props, {}, "">;
24
+ type Text = ReturnType<typeof Text>;
25
+ export default Text;
@@ -0,0 +1,76 @@
1
+ <script module lang="ts">
2
+ /** What .textarea is made of, classified. The props follow the
3
+ families the project registers (variants.ts, ADR 0015). */
4
+ export const PREFIX = 'textarea';
5
+
6
+ export const AXES = {
7
+ color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error'],
8
+ size: ['xs', 'sm', 'md', 'lg', 'xl'],
9
+ variant: ['ghost']
10
+ } as const;
11
+
12
+ export const FLAGS = {} as const;
13
+ export const PARTS = [] as const;
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ import type { Snippet } from 'svelte';
18
+ import type { HTMLTextareaAttributes } from 'svelte/elements';
19
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
20
+
21
+ // `size` is ours — the HTML attribute of the same name is a character count
22
+ // our CSS overrides anyway.
23
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLTextareaAttributes, 'size' | 'color'> {
24
+ /**
25
+ * Colour the field by its own validity and reveal `hint` once the
26
+ * browser marks it invalid. The CSS drives this off `:user-invalid`,
27
+ * so it only fires after the visitor has actually had a go.
28
+ */
29
+ validator?: boolean;
30
+ /**
31
+ * Shown under the field when it is invalid. It has to be the field's
32
+ * next sibling for the CSS to reach it, which is the whole reason this
33
+ * is a prop and not something you write yourself.
34
+ */
35
+ hint?: Snippet;
36
+ /**
37
+ * An error from outside (the server said no): marks the field invalid and
38
+ * shows this, for as long as it is given. The parent owns it.
39
+ */
40
+ error?: string | null;
41
+ /** The `<textarea>` itself. Bindable. */
42
+ element?: HTMLTextAreaElement;
43
+ class?: string;
44
+ value?: string | number;
45
+ }
46
+
47
+ // The axes are deliberately NOT destructured: they travel in `axes` and are
48
+ // resolved by name, so an axis a family drops changes nothing down here.
49
+ let {
50
+ validator = false,
51
+ hint,
52
+ error = null,
53
+ element = $bindable(),
54
+ disabled = false,
55
+ value = $bindable(''),
56
+ class: klass = '',
57
+ ...axes
58
+ }: Props = $props();
59
+
60
+ let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
61
+ let failed = $derived(!disabled && !!error);
62
+ let classes = $derived(cx(PREFIX, applied.classes, (validator || failed) && 'validator', klass));
63
+
64
+ /* An error from outside is the field's validity too: a form holding it
65
+ does not submit. */
66
+ $effect(() => {
67
+ element?.setCustomValidity(failed ? (error ?? '') : '');
68
+ });
69
+ </script>
70
+
71
+ <textarea aria-invalid={failed ? 'true' : undefined} {...applied.rest} {disabled} bind:this={element} class={classes} bind:value></textarea>
72
+ {#if failed}
73
+ <p class="validator-hint">{error}</p>
74
+ {:else if hint}
75
+ <p class="validator-hint">{@render hint()}</p>
76
+ {/if}
@@ -0,0 +1,39 @@
1
+ /** What .textarea is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015). */
3
+ export declare const PREFIX = "textarea";
4
+ export declare const AXES: {
5
+ readonly color: readonly ["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"];
6
+ readonly size: readonly ["xs", "sm", "md", "lg", "xl"];
7
+ readonly variant: readonly ["ghost"];
8
+ };
9
+ export declare const FLAGS: {};
10
+ export declare const PARTS: readonly [];
11
+ import type { Snippet } from 'svelte';
12
+ import type { HTMLTextareaAttributes } from 'svelte/elements';
13
+ import { type AxisProps } from '../variants.js';
14
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLTextareaAttributes, 'size' | 'color'> {
15
+ /**
16
+ * Colour the field by its own validity and reveal `hint` once the
17
+ * browser marks it invalid. The CSS drives this off `:user-invalid`,
18
+ * so it only fires after the visitor has actually had a go.
19
+ */
20
+ validator?: boolean;
21
+ /**
22
+ * Shown under the field when it is invalid. It has to be the field's
23
+ * next sibling for the CSS to reach it, which is the whole reason this
24
+ * is a prop and not something you write yourself.
25
+ */
26
+ hint?: Snippet;
27
+ /**
28
+ * An error from outside (the server said no): marks the field invalid and
29
+ * shows this, for as long as it is given. The parent owns it.
30
+ */
31
+ error?: string | null;
32
+ /** The `<textarea>` itself. Bindable. */
33
+ element?: HTMLTextAreaElement;
34
+ class?: string;
35
+ value?: string | number;
36
+ }
37
+ declare const Textarea: import("svelte").Component<Props, {}, "value" | "element">;
38
+ type Textarea = ReturnType<typeof Textarea>;
39
+ export default Textarea;
@@ -0,0 +1,46 @@
1
+ <script module lang="ts">
2
+ /** What .title is made of, classified. */
3
+ export const PREFIX = 'title';
4
+
5
+ /* A title has ONE size — that is what makes it the title. Its colour is an
6
+ axis like every other component's, and the only reason text had none
7
+ before is that the file shipped no colour at all. */
8
+ export const AXES = {
9
+ color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error']
10
+ } as const;
11
+
12
+ export const FLAGS = {} as const;
13
+ export const PARTS = [] as const;
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ /**
18
+ * The page's heading.
19
+ *
20
+ * `level` picks the TAG, nothing else — `<h1>` … `<h6>`, and no class
21
+ * changes. The semantic level and the visual size are two different
22
+ * questions, and welding them is exactly what a set of `<H1>` … `<H6>`
23
+ * components would do: an `<h3>` opening a section can legitimately be
24
+ * large, and a small `<h1>` is a real design. So the tag is yours and the
25
+ * look is the class.
26
+ */
27
+ import type { Snippet } from 'svelte';
28
+ import type { HTMLAttributes } from 'svelte/elements';
29
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
30
+
31
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLHeadingElement>, 'color'> {
32
+ /** Which heading tag to render. Purely semantic; the look never moves. */
33
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
34
+ class?: string;
35
+ children?: Snippet;
36
+ }
37
+
38
+ let { level = 1, class: klass = '', children, ...axes }: 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
+ <svelte:element this={`h${level}`} class={classes} {...applied.rest}>
45
+ {@render children?.()}
46
+ </svelte:element>
@@ -0,0 +1,29 @@
1
+ /** What .title is made of, classified. */
2
+ export declare const PREFIX = "title";
3
+ export declare const AXES: {
4
+ readonly color: readonly ["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"];
5
+ };
6
+ export declare const FLAGS: {};
7
+ export declare const PARTS: readonly [];
8
+ /**
9
+ * The page's heading.
10
+ *
11
+ * `level` picks the TAG, nothing else — `<h1>` … `<h6>`, and no class
12
+ * changes. The semantic level and the visual size are two different
13
+ * questions, and welding them is exactly what a set of `<H1>` … `<H6>`
14
+ * components would do: an `<h3>` opening a section can legitimately be
15
+ * large, and a small `<h1>` is a real design. So the tag is yours and the
16
+ * look is the class.
17
+ */
18
+ import type { Snippet } from 'svelte';
19
+ import type { HTMLAttributes } from 'svelte/elements';
20
+ import { type AxisProps } from '../variants.js';
21
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLAttributes<HTMLHeadingElement>, 'color'> {
22
+ /** Which heading tag to render. Purely semantic; the look never moves. */
23
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
24
+ class?: string;
25
+ children?: Snippet;
26
+ }
27
+ declare const Title: import("svelte").Component<Props, {}, "">;
28
+ type Title = ReturnType<typeof Title>;
29
+ export default Title;
@@ -0,0 +1,154 @@
1
+ <script module lang="ts">
2
+ /** What .toast is made of, classified. The props follow the
3
+ families the project registers (variants.ts, ADR 0015). */
4
+ export const PREFIX = 'toast';
5
+
6
+ export const AXES = {
7
+ /* Either one pins the stack to a corner; neither leaves it in the flow. */
8
+ side: ['top', 'bottom'],
9
+ align: ['start', 'center', 'end']
10
+ } as const;
11
+
12
+ export const FLAGS = {} as const;
13
+ export const PARTS = [] as const;
14
+
15
+ /** The colours an alert has an icon for, and any other the family ships. */
16
+ export type ToastColor = 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error';
17
+
18
+ export interface ToastOptions {
19
+ message: string;
20
+ title?: string;
21
+ color?: ToastColor;
22
+ /** Milliseconds on screen. `0` keeps it until dismissed. Default 5000. */
23
+ duration?: number;
24
+ /** One button inside the alert. Clicking it also dismisses the alert. */
25
+ action?: { label: string; onClick: () => void };
26
+ }
27
+
28
+ interface Item extends ToastOptions {
29
+ id: number;
30
+ duration: number;
31
+ }
32
+ </script>
33
+
34
+ <script lang="ts">
35
+ /**
36
+ * A stack of alerts. Bind the component and call `add()` to push one;
37
+ * each is dismissible and leaves on its own after `duration`, its
38
+ * countdown paused while the pointer is over it or focus is inside it.
39
+ *
40
+ * With `side` or `align` the stack is pinned to that corner of the
41
+ * viewport; without, it sits in the flow where it is placed.
42
+ */
43
+ import type { HTMLAttributes } from 'svelte/elements';
44
+ import { flip } from 'svelte/animate';
45
+ import { fly } from 'svelte/transition';
46
+ import Alert from './Alert.svelte';
47
+ import Button from './Button.svelte';
48
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
49
+
50
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, HTMLAttributes<HTMLElement> {
51
+ /** The region's accessible name. */
52
+ label?: string;
53
+ /** Each close button's accessible name. */
54
+ dismissLabel?: string;
55
+ /** At most this many alerts; the oldest goes first. */
56
+ max?: number;
57
+ class?: string;
58
+ }
59
+
60
+ // The axes are deliberately NOT destructured: they travel in `axes` and are
61
+ // resolved by name, so an axis a family drops changes nothing down here.
62
+ let {
63
+ label = 'Notifications',
64
+ dismissLabel = 'Dismiss',
65
+ max = Infinity,
66
+ class: klass = '',
67
+ ...axes
68
+ }: Props = $props();
69
+
70
+ let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
71
+ let classes = $derived(cx(PREFIX, applied.classes, klass));
72
+ let top = $derived(classes.includes(`${PREFIX}-top`));
73
+
74
+ let items: Item[] = $state([]);
75
+ let next = 1;
76
+
77
+ /** Push an alert. Returns its id, for `dismiss`. */
78
+ export function add(options: string | ToastOptions): number {
79
+ const o = typeof options === 'string' ? { message: options } : options;
80
+ const id = next++;
81
+ items.push({ ...o, id, duration: o.duration ?? 5000 });
82
+ if (items.length > max) items.splice(0, items.length - max);
83
+ return id;
84
+ }
85
+
86
+ /** Remove an alert now. Unknown ids are ignored. */
87
+ export function dismiss(id: number): void {
88
+ const i = items.findIndex((t) => t.id === id);
89
+ if (i >= 0) items.splice(i, 1);
90
+ }
91
+
92
+ /** Remove every alert. */
93
+ export function clear(): void {
94
+ items.length = 0;
95
+ }
96
+
97
+ /** Runs an alert's countdown, paused while hovered or focused. */
98
+ function countdown(node: HTMLElement, t: Item) {
99
+ if (!t.duration) return;
100
+ let left = t.duration;
101
+ let started = Date.now();
102
+ let timer: ReturnType<typeof setTimeout> | undefined;
103
+ let held = 0;
104
+ const run = () => {
105
+ started = Date.now();
106
+ timer = setTimeout(() => dismiss(t.id), left);
107
+ };
108
+ const hold = () => {
109
+ if (held++ === 0 && timer) {
110
+ clearTimeout(timer);
111
+ timer = undefined;
112
+ left -= Date.now() - started;
113
+ }
114
+ };
115
+ const release = () => {
116
+ if (--held === 0) run();
117
+ };
118
+ node.addEventListener('pointerenter', hold);
119
+ node.addEventListener('pointerleave', release);
120
+ node.addEventListener('focusin', hold);
121
+ node.addEventListener('focusout', release);
122
+ run();
123
+ return {
124
+ destroy() {
125
+ clearTimeout(timer);
126
+ node.removeEventListener('pointerenter', hold);
127
+ node.removeEventListener('pointerleave', release);
128
+ node.removeEventListener('focusin', hold);
129
+ node.removeEventListener('focusout', release);
130
+ }
131
+ };
132
+ }
133
+ </script>
134
+
135
+ <section {...applied.rest} class={classes} aria-label={label} aria-live="polite">
136
+ {#each items as t (t.id)}
137
+ <div use:countdown={t} animate:flip={{ duration: 180 }} in:fly={{ y: top ? -16 : 16, duration: 180 }} out:fly={{ x: 24, duration: 160 }}>
138
+ {#snippet action()}
139
+ <Button
140
+ size="sm"
141
+ onclick={() => {
142
+ t.action?.onClick();
143
+ dismiss(t.id);
144
+ }}>{t.action?.label}</Button
145
+ >
146
+ {/snippet}
147
+ <!-- `as never`: any colour name goes; a family that lacks one simply
148
+ draws the default alert, as a class it never ships does. -->
149
+ <Alert color={t.color as never} title={t.title} dismissible {dismissLabel} onDismiss={() => dismiss(t.id)} actions={t.action ? action : undefined}>
150
+ {t.message}
151
+ </Alert>
152
+ </div>
153
+ {/each}
154
+ </section>
@@ -0,0 +1,49 @@
1
+ /** What .toast is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015). */
3
+ export declare const PREFIX = "toast";
4
+ export declare const AXES: {
5
+ readonly side: readonly ["top", "bottom"];
6
+ readonly align: readonly ["start", "center", "end"];
7
+ };
8
+ export declare const FLAGS: {};
9
+ export declare const PARTS: readonly [];
10
+ /** The colours an alert has an icon for, and any other the family ships. */
11
+ export type ToastColor = 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error';
12
+ export interface ToastOptions {
13
+ message: string;
14
+ title?: string;
15
+ color?: ToastColor;
16
+ /** Milliseconds on screen. `0` keeps it until dismissed. Default 5000. */
17
+ duration?: number;
18
+ /** One button inside the alert. Clicking it also dismisses the alert. */
19
+ action?: {
20
+ label: string;
21
+ onClick: () => void;
22
+ };
23
+ }
24
+ /**
25
+ * A stack of alerts. Bind the component and call `add()` to push one;
26
+ * each is dismissible and leaves on its own after `duration`, its
27
+ * countdown paused while the pointer is over it or focus is inside it.
28
+ *
29
+ * With `side` or `align` the stack is pinned to that corner of the
30
+ * viewport; without, it sits in the flow where it is placed.
31
+ */
32
+ import type { HTMLAttributes } from 'svelte/elements';
33
+ import { type AxisProps } from '../variants.js';
34
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, HTMLAttributes<HTMLElement> {
35
+ /** The region's accessible name. */
36
+ label?: string;
37
+ /** Each close button's accessible name. */
38
+ dismissLabel?: string;
39
+ /** At most this many alerts; the oldest goes first. */
40
+ max?: number;
41
+ class?: string;
42
+ }
43
+ declare const Toast: import("svelte").Component<Props, {
44
+ add: (options: string | ToastOptions) => number;
45
+ dismiss: (id: number) => void;
46
+ clear: () => void;
47
+ }, "">;
48
+ type Toast = ReturnType<typeof Toast>;
49
+ export default Toast;
@@ -0,0 +1,48 @@
1
+ <script module lang="ts">
2
+ /** What .toggle is made of, classified. The props follow the
3
+ families the project registers (variants.ts, ADR 0015). */
4
+ export const PREFIX = 'toggle';
5
+
6
+ export const AXES = {
7
+ color: ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error'],
8
+ size: ['xs', 'sm', 'md', 'lg', 'xl'],
9
+ /* `track` colours the rail rather than the knob. It lands on the toggle
10
+ itself (.toggle.toggle-track), so it is a variant, not a part. */
11
+ variant: ['track']
12
+ } as const;
13
+
14
+ export const FLAGS = {} as const;
15
+ export const PARTS = [] as const;
16
+ </script>
17
+
18
+ <script lang="ts">
19
+ import type { Snippet } from 'svelte';
20
+ import type { HTMLInputAttributes } from 'svelte/elements';
21
+ import { applyAxes, cx, type AxisProps } from '../variants.js';
22
+
23
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLInputAttributes, 'size' | 'color' | 'type'> {
24
+ /** Colour the control by its own validity and reveal `hint` when invalid. */
25
+ validator?: boolean;
26
+ /** Shown below once invalid. It must be the control's next sibling for the
27
+ CSS to reach it, which is why it is a prop rather than your markup. */
28
+ hint?: Snippet;
29
+ class?: string;
30
+ checked?: boolean;
31
+ }
32
+
33
+ // The axes are deliberately NOT destructured: they travel in `axes` and are
34
+ // resolved by name, so an axis a family drops changes nothing down here.
35
+ let {
36
+ validator = false,
37
+ hint,
38
+ checked = $bindable(false),
39
+ class: klass = '',
40
+ ...axes
41
+ }: Props = $props();
42
+
43
+ let applied = $derived(applyAxes(PREFIX, AXES, FLAGS, axes));
44
+ let classes = $derived(cx(PREFIX, applied.classes, validator && 'validator', klass));
45
+ </script>
46
+
47
+ <input type="checkbox" {...applied.rest} class={classes} bind:checked />
48
+ {#if hint}<p class="validator-hint">{@render hint()}</p>{/if}
@@ -0,0 +1,25 @@
1
+ /** What .toggle is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015). */
3
+ export declare const PREFIX = "toggle";
4
+ export declare const AXES: {
5
+ readonly color: readonly ["primary", "secondary", "accent", "neutral", "info", "success", "warning", "error"];
6
+ readonly size: readonly ["xs", "sm", "md", "lg", "xl"];
7
+ readonly variant: readonly ["track"];
8
+ };
9
+ export declare const FLAGS: {};
10
+ export declare const PARTS: readonly [];
11
+ import type { Snippet } from 'svelte';
12
+ import type { HTMLInputAttributes } from 'svelte/elements';
13
+ import { type AxisProps } from '../variants.js';
14
+ interface Props extends AxisProps<typeof AXES, typeof FLAGS, typeof PREFIX>, Omit<HTMLInputAttributes, 'size' | 'color' | 'type'> {
15
+ /** Colour the control by its own validity and reveal `hint` when invalid. */
16
+ validator?: boolean;
17
+ /** Shown below once invalid. It must be the control's next sibling for the
18
+ CSS to reach it, which is why it is a prop rather than your markup. */
19
+ hint?: Snippet;
20
+ class?: string;
21
+ checked?: boolean;
22
+ }
23
+ declare const Toggle: import("svelte").Component<Props, {}, "checked">;
24
+ type Toggle = ReturnType<typeof Toggle>;
25
+ export default Toggle;