@sveltier/ui 0.0.0-stage → 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -2
  3. package/dist/components/Accordion/Accordion.svelte +74 -0
  4. package/dist/components/Accordion/Accordion.svelte.d.ts +25 -0
  5. package/dist/components/Accordion/accordion.css +88 -0
  6. package/dist/components/Accordion/index.d.ts +2 -0
  7. package/dist/components/Accordion/index.js +1 -0
  8. package/dist/components/Accordion/types.d.ts +64 -0
  9. package/dist/components/Accordion/types.js +1 -0
  10. package/dist/components/Alert/Alert.svelte +88 -0
  11. package/dist/components/Alert/Alert.svelte.d.ts +4 -0
  12. package/dist/components/Alert/alert.css +78 -0
  13. package/dist/components/Alert/index.d.ts +2 -0
  14. package/dist/components/Alert/index.js +1 -0
  15. package/dist/components/Alert/types.d.ts +67 -0
  16. package/dist/components/Alert/types.js +1 -0
  17. package/dist/components/Avatar/Avatar.svelte +47 -0
  18. package/dist/components/Avatar/Avatar.svelte.d.ts +4 -0
  19. package/dist/components/Avatar/avatar.css +34 -0
  20. package/dist/components/Avatar/index.d.ts +2 -0
  21. package/dist/components/Avatar/index.js +1 -0
  22. package/dist/components/Avatar/types.d.ts +47 -0
  23. package/dist/components/Avatar/types.js +1 -0
  24. package/dist/components/Badge/Badge.svelte +53 -0
  25. package/dist/components/Badge/Badge.svelte.d.ts +4 -0
  26. package/dist/components/Badge/badge.css +57 -0
  27. package/dist/components/Badge/index.d.ts +2 -0
  28. package/dist/components/Badge/index.js +1 -0
  29. package/dist/components/Badge/types.d.ts +43 -0
  30. package/dist/components/Badge/types.js +1 -0
  31. package/dist/components/Button/Button.svelte +85 -0
  32. package/dist/components/Button/Button.svelte.d.ts +4 -0
  33. package/dist/components/Button/button.css +132 -0
  34. package/dist/components/Button/index.d.ts +2 -0
  35. package/dist/components/Button/index.js +1 -0
  36. package/dist/components/Button/types.d.ts +76 -0
  37. package/dist/components/Button/types.js +1 -0
  38. package/dist/components/ButtonGroup/ButtonGroup.svelte +61 -0
  39. package/dist/components/ButtonGroup/ButtonGroup.svelte.d.ts +4 -0
  40. package/dist/components/ButtonGroup/button-group.css +39 -0
  41. package/dist/components/ButtonGroup/index.d.ts +2 -0
  42. package/dist/components/ButtonGroup/index.js +1 -0
  43. package/dist/components/ButtonGroup/types.d.ts +48 -0
  44. package/dist/components/ButtonGroup/types.js +1 -0
  45. package/dist/components/Card/Card.svelte +53 -0
  46. package/dist/components/Card/Card.svelte.d.ts +4 -0
  47. package/dist/components/Card/card.css +62 -0
  48. package/dist/components/Card/index.d.ts +2 -0
  49. package/dist/components/Card/index.js +1 -0
  50. package/dist/components/Card/types.d.ts +56 -0
  51. package/dist/components/Card/types.js +1 -0
  52. package/dist/components/Checkbox/Checkbox.svelte +105 -0
  53. package/dist/components/Checkbox/Checkbox.svelte.d.ts +4 -0
  54. package/dist/components/Checkbox/checkbox.css +138 -0
  55. package/dist/components/Checkbox/index.d.ts +2 -0
  56. package/dist/components/Checkbox/index.js +1 -0
  57. package/dist/components/Checkbox/types.d.ts +76 -0
  58. package/dist/components/Checkbox/types.js +1 -0
  59. package/dist/components/Chip/Chip.svelte +109 -0
  60. package/dist/components/Chip/Chip.svelte.d.ts +4 -0
  61. package/dist/components/Chip/chip.css +101 -0
  62. package/dist/components/Chip/index.d.ts +2 -0
  63. package/dist/components/Chip/index.js +1 -0
  64. package/dist/components/Chip/types.d.ts +69 -0
  65. package/dist/components/Chip/types.js +1 -0
  66. package/dist/components/Choice/Choice.svelte +60 -0
  67. package/dist/components/Choice/Choice.svelte.d.ts +4 -0
  68. package/dist/components/Choice/choice.css +75 -0
  69. package/dist/components/Choice/types.d.ts +43 -0
  70. package/dist/components/Choice/types.js +1 -0
  71. package/dist/components/Dialog/Dialog.svelte +36 -0
  72. package/dist/components/Dialog/Dialog.svelte.d.ts +4 -0
  73. package/dist/components/Dialog/index.d.ts +2 -0
  74. package/dist/components/Dialog/index.js +1 -0
  75. package/dist/components/Dialog/types.d.ts +50 -0
  76. package/dist/components/Dialog/types.js +1 -0
  77. package/dist/components/Divider/Divider.svelte +19 -0
  78. package/dist/components/Divider/Divider.svelte.d.ts +4 -0
  79. package/dist/components/Divider/divider.css +23 -0
  80. package/dist/components/Divider/index.d.ts +2 -0
  81. package/dist/components/Divider/index.js +1 -0
  82. package/dist/components/Divider/types.d.ts +10 -0
  83. package/dist/components/Divider/types.js +1 -0
  84. package/dist/components/Field/Field.svelte +95 -0
  85. package/dist/components/Field/Field.svelte.d.ts +4 -0
  86. package/dist/components/Field/field.css +210 -0
  87. package/dist/components/Field/index.d.ts +3 -0
  88. package/dist/components/Field/index.js +2 -0
  89. package/dist/components/Field/types.d.ts +109 -0
  90. package/dist/components/Field/types.js +2 -0
  91. package/dist/components/Form/Form.svelte +93 -0
  92. package/dist/components/Form/Form.svelte.d.ts +8 -0
  93. package/dist/components/Form/form.css +16 -0
  94. package/dist/components/Form/index.d.ts +2 -0
  95. package/dist/components/Form/index.js +1 -0
  96. package/dist/components/Form/types.d.ts +38 -0
  97. package/dist/components/Form/types.js +1 -0
  98. package/dist/components/Icon/Icon.svelte +38 -0
  99. package/dist/components/Icon/Icon.svelte.d.ts +4 -0
  100. package/dist/components/Icon/icon.css +33 -0
  101. package/dist/components/Icon/index.d.ts +2 -0
  102. package/dist/components/Icon/index.js +1 -0
  103. package/dist/components/Icon/types.d.ts +34 -0
  104. package/dist/components/Icon/types.js +1 -0
  105. package/dist/components/List/List.svelte +39 -0
  106. package/dist/components/List/List.svelte.d.ts +4 -0
  107. package/dist/components/List/ListItem.svelte +57 -0
  108. package/dist/components/List/ListItem.svelte.d.ts +4 -0
  109. package/dist/components/List/index.d.ts +3 -0
  110. package/dist/components/List/index.js +2 -0
  111. package/dist/components/List/list.css +127 -0
  112. package/dist/components/List/types.d.ts +67 -0
  113. package/dist/components/List/types.js +1 -0
  114. package/dist/components/Menu/Menu.svelte +195 -0
  115. package/dist/components/Menu/Menu.svelte.d.ts +4 -0
  116. package/dist/components/Menu/index.d.ts +2 -0
  117. package/dist/components/Menu/index.js +1 -0
  118. package/dist/components/Menu/menu.css +103 -0
  119. package/dist/components/Menu/types.d.ts +90 -0
  120. package/dist/components/Menu/types.js +1 -0
  121. package/dist/components/Modal/Modal.svelte +146 -0
  122. package/dist/components/Modal/Modal.svelte.d.ts +4 -0
  123. package/dist/components/Modal/modal.css +150 -0
  124. package/dist/components/Modal/types.d.ts +54 -0
  125. package/dist/components/Modal/types.js +1 -0
  126. package/dist/components/NativeSelect/NativeSelect.svelte +110 -0
  127. package/dist/components/NativeSelect/NativeSelect.svelte.d.ts +25 -0
  128. package/dist/components/NativeSelect/index.d.ts +2 -0
  129. package/dist/components/NativeSelect/index.js +1 -0
  130. package/dist/components/NativeSelect/native-select.css +45 -0
  131. package/dist/components/NativeSelect/types.d.ts +58 -0
  132. package/dist/components/NativeSelect/types.js +1 -0
  133. package/dist/components/NumberField/NumberField.svelte +246 -0
  134. package/dist/components/NumberField/NumberField.svelte.d.ts +4 -0
  135. package/dist/components/NumberField/index.d.ts +2 -0
  136. package/dist/components/NumberField/index.js +1 -0
  137. package/dist/components/NumberField/number-field.css +74 -0
  138. package/dist/components/NumberField/types.d.ts +73 -0
  139. package/dist/components/NumberField/types.js +1 -0
  140. package/dist/components/Popover/Popover.svelte +115 -0
  141. package/dist/components/Popover/Popover.svelte.d.ts +4 -0
  142. package/dist/components/Popover/index.d.ts +2 -0
  143. package/dist/components/Popover/index.js +1 -0
  144. package/dist/components/Popover/popover.css +67 -0
  145. package/dist/components/Popover/types.d.ts +83 -0
  146. package/dist/components/Popover/types.js +1 -0
  147. package/dist/components/Progress/ProgressCircular.svelte +61 -0
  148. package/dist/components/Progress/ProgressCircular.svelte.d.ts +4 -0
  149. package/dist/components/Progress/ProgressLinear.svelte +44 -0
  150. package/dist/components/Progress/ProgressLinear.svelte.d.ts +4 -0
  151. package/dist/components/Progress/index.d.ts +3 -0
  152. package/dist/components/Progress/index.js +2 -0
  153. package/dist/components/Progress/progress-circular.css +61 -0
  154. package/dist/components/Progress/progress-linear.css +67 -0
  155. package/dist/components/Progress/types.d.ts +53 -0
  156. package/dist/components/Progress/types.js +1 -0
  157. package/dist/components/RadioGroup/RadioGroup.svelte +149 -0
  158. package/dist/components/RadioGroup/RadioGroup.svelte.d.ts +25 -0
  159. package/dist/components/RadioGroup/index.d.ts +2 -0
  160. package/dist/components/RadioGroup/index.js +1 -0
  161. package/dist/components/RadioGroup/radio-group.css +139 -0
  162. package/dist/components/RadioGroup/types.d.ts +93 -0
  163. package/dist/components/RadioGroup/types.js +1 -0
  164. package/dist/components/SegmentedControl/SegmentedControl.svelte +70 -0
  165. package/dist/components/SegmentedControl/SegmentedControl.svelte.d.ts +25 -0
  166. package/dist/components/SegmentedControl/index.d.ts +2 -0
  167. package/dist/components/SegmentedControl/index.js +1 -0
  168. package/dist/components/SegmentedControl/segmented-control.css +68 -0
  169. package/dist/components/SegmentedControl/types.d.ts +60 -0
  170. package/dist/components/SegmentedControl/types.js +1 -0
  171. package/dist/components/Sheet/Sheet.svelte +56 -0
  172. package/dist/components/Sheet/Sheet.svelte.d.ts +4 -0
  173. package/dist/components/Sheet/index.d.ts +2 -0
  174. package/dist/components/Sheet/index.js +2 -0
  175. package/dist/components/Sheet/sheet.css +61 -0
  176. package/dist/components/Sheet/types.d.ts +51 -0
  177. package/dist/components/Sheet/types.js +1 -0
  178. package/dist/components/Skeleton/Skeleton.svelte +33 -0
  179. package/dist/components/Skeleton/Skeleton.svelte.d.ts +4 -0
  180. package/dist/components/Skeleton/index.d.ts +2 -0
  181. package/dist/components/Skeleton/index.js +1 -0
  182. package/dist/components/Skeleton/skeleton.css +70 -0
  183. package/dist/components/Skeleton/types.d.ts +25 -0
  184. package/dist/components/Skeleton/types.js +1 -0
  185. package/dist/components/Slider/Slider.svelte +153 -0
  186. package/dist/components/Slider/Slider.svelte.d.ts +4 -0
  187. package/dist/components/Slider/index.d.ts +2 -0
  188. package/dist/components/Slider/index.js +1 -0
  189. package/dist/components/Slider/slider.css +206 -0
  190. package/dist/components/Slider/types.d.ts +102 -0
  191. package/dist/components/Slider/types.js +1 -0
  192. package/dist/components/Switch/Switch.svelte +94 -0
  193. package/dist/components/Switch/Switch.svelte.d.ts +4 -0
  194. package/dist/components/Switch/index.d.ts +2 -0
  195. package/dist/components/Switch/index.js +1 -0
  196. package/dist/components/Switch/switch.css +118 -0
  197. package/dist/components/Switch/types.d.ts +67 -0
  198. package/dist/components/Switch/types.js +1 -0
  199. package/dist/components/Tabs/Tabs.svelte +93 -0
  200. package/dist/components/Tabs/Tabs.svelte.d.ts +25 -0
  201. package/dist/components/Tabs/index.d.ts +2 -0
  202. package/dist/components/Tabs/index.js +1 -0
  203. package/dist/components/Tabs/tabs.css +73 -0
  204. package/dist/components/Tabs/types.d.ts +59 -0
  205. package/dist/components/Tabs/types.js +1 -0
  206. package/dist/components/TextField/TextField.svelte +115 -0
  207. package/dist/components/TextField/TextField.svelte.d.ts +4 -0
  208. package/dist/components/TextField/index.d.ts +2 -0
  209. package/dist/components/TextField/index.js +1 -0
  210. package/dist/components/TextField/types.d.ts +57 -0
  211. package/dist/components/TextField/types.js +1 -0
  212. package/dist/components/Textarea/Textarea.svelte +116 -0
  213. package/dist/components/Textarea/Textarea.svelte.d.ts +4 -0
  214. package/dist/components/Textarea/index.d.ts +2 -0
  215. package/dist/components/Textarea/index.js +1 -0
  216. package/dist/components/Textarea/textarea.css +35 -0
  217. package/dist/components/Textarea/types.d.ts +60 -0
  218. package/dist/components/Textarea/types.js +1 -0
  219. package/dist/components/Tooltip/Tooltip.svelte +161 -0
  220. package/dist/components/Tooltip/Tooltip.svelte.d.ts +4 -0
  221. package/dist/components/Tooltip/index.d.ts +2 -0
  222. package/dist/components/Tooltip/index.js +1 -0
  223. package/dist/components/Tooltip/tooltip.css +44 -0
  224. package/dist/components/Tooltip/types.d.ts +55 -0
  225. package/dist/components/Tooltip/types.js +1 -0
  226. package/dist/core/defaults/DefaultsProvider.svelte +30 -0
  227. package/dist/core/defaults/DefaultsProvider.svelte.d.ts +13 -0
  228. package/dist/core/defaults/context.d.ts +45 -0
  229. package/dist/core/defaults/context.js +38 -0
  230. package/dist/core/display/display.d.ts +39 -0
  231. package/dist/core/display/display.js +53 -0
  232. package/dist/core/errors/codes.d.ts +124 -0
  233. package/dist/core/errors/codes.js +108 -0
  234. package/dist/core/errors/errors.d.ts +8 -0
  235. package/dist/core/errors/errors.js +7 -0
  236. package/dist/core/form/constraints.d.ts +15 -0
  237. package/dist/core/form/constraints.js +42 -0
  238. package/dist/core/form/context.d.ts +19 -0
  239. package/dist/core/form/context.js +4 -0
  240. package/dist/core/form/field.svelte.d.ts +34 -0
  241. package/dist/core/form/field.svelte.js +66 -0
  242. package/dist/core/form/number.d.ts +24 -0
  243. package/dist/core/form/number.js +71 -0
  244. package/dist/core/form/types.d.ts +22 -0
  245. package/dist/core/form/types.js +1 -0
  246. package/dist/core/locale/locale.d.ts +56 -0
  247. package/dist/core/locale/locale.js +82 -0
  248. package/dist/core/overlay/types.d.ts +33 -0
  249. package/dist/core/overlay/types.js +1 -0
  250. package/dist/core/props/classes.d.ts +21 -0
  251. package/dist/core/props/classes.js +44 -0
  252. package/dist/core/props/element.d.ts +18 -0
  253. package/dist/core/props/element.js +1 -0
  254. package/dist/core/props/types.d.ts +47 -0
  255. package/dist/core/props/types.js +16 -0
  256. package/dist/core/provider/UIProvider.svelte +63 -0
  257. package/dist/core/provider/UIProvider.svelte.d.ts +29 -0
  258. package/dist/core/theme/ThemeProvider.svelte +178 -0
  259. package/dist/core/theme/ThemeProvider.svelte.d.ts +25 -0
  260. package/dist/core/theme/color.d.ts +23 -0
  261. package/dist/core/theme/color.js +54 -0
  262. package/dist/core/theme/context.d.ts +25 -0
  263. package/dist/core/theme/context.js +14 -0
  264. package/dist/core/theme/css.d.ts +25 -0
  265. package/dist/core/theme/css.js +73 -0
  266. package/dist/core/theme/define.d.ts +11 -0
  267. package/dist/core/theme/define.js +21 -0
  268. package/dist/core/theme/resolve.d.ts +6 -0
  269. package/dist/core/theme/resolve.js +18 -0
  270. package/dist/core/theme/theme-provider.css +13 -0
  271. package/dist/core/theme/types.d.ts +35 -0
  272. package/dist/core/theme/types.js +61 -0
  273. package/dist/core/toast/ToastOutlet.svelte +192 -0
  274. package/dist/core/toast/ToastOutlet.svelte.d.ts +11 -0
  275. package/dist/core/toast/ToastProvider.svelte +39 -0
  276. package/dist/core/toast/ToastProvider.svelte.d.ts +19 -0
  277. package/dist/core/toast/toast.css +134 -0
  278. package/dist/core/toast/toast.svelte.d.ts +117 -0
  279. package/dist/core/toast/toast.svelte.js +133 -0
  280. package/dist/dev/off.d.ts +5 -0
  281. package/dist/dev/off.js +4 -0
  282. package/dist/dev/on.d.ts +20 -0
  283. package/dist/dev/on.js +49 -0
  284. package/dist/index.d.ts +67 -0
  285. package/dist/index.js +83 -0
  286. package/dist/primitives/anchored/anchored.d.ts +39 -0
  287. package/dist/primitives/anchored/anchored.js +104 -0
  288. package/dist/primitives/anchored/fallback.d.ts +31 -0
  289. package/dist/primitives/anchored/fallback.js +73 -0
  290. package/dist/primitives/focus/focus-trap.d.ts +25 -0
  291. package/dist/primitives/focus/focus-trap.js +86 -0
  292. package/dist/primitives/focus/roving-focus.d.ts +22 -0
  293. package/dist/primitives/focus/roving-focus.js +86 -0
  294. package/dist/primitives/focus/tabbable.d.ts +9 -0
  295. package/dist/primitives/focus/tabbable.js +75 -0
  296. package/dist/primitives/inert/inert-others.d.ts +12 -0
  297. package/dist/primitives/inert/inert-others.js +44 -0
  298. package/dist/primitives/keyboard/keymap.d.ts +17 -0
  299. package/dist/primitives/keyboard/keymap.js +39 -0
  300. package/dist/primitives/keyboard/typeahead.d.ts +18 -0
  301. package/dist/primitives/keyboard/typeahead.js +50 -0
  302. package/dist/primitives/layer/dismissable.d.ts +32 -0
  303. package/dist/primitives/layer/dismissable.js +91 -0
  304. package/dist/primitives/motion/easing.d.ts +9 -0
  305. package/dist/primitives/motion/easing.js +46 -0
  306. package/dist/primitives/motion/motion.d.ts +59 -0
  307. package/dist/primitives/motion/motion.js +80 -0
  308. package/dist/primitives/portal/Portal.svelte +37 -0
  309. package/dist/primitives/portal/Portal.svelte.d.ts +9 -0
  310. package/dist/primitives/portal/PortalContent.svelte +15 -0
  311. package/dist/primitives/portal/PortalContent.svelte.d.ts +9 -0
  312. package/dist/primitives/portal/portal.css +8 -0
  313. package/dist/primitives/scroll-lock/scroll-lock.d.ts +10 -0
  314. package/dist/primitives/scroll-lock/scroll-lock.js +33 -0
  315. package/dist/primitives/virtual/virtual-list.svelte.d.ts +65 -0
  316. package/dist/primitives/virtual/virtual-list.svelte.js +291 -0
  317. package/dist/styles/base.css +44 -0
  318. package/dist/styles/props.css +140 -0
  319. package/dist/styles/tokens.css +84 -0
  320. package/dist/styles/visually-hidden.css +16 -0
  321. package/dist/themes/aurora.d.ts +13 -0
  322. package/dist/themes/aurora.js +103 -0
  323. package/dist/themes/heritage.d.ts +13 -0
  324. package/dist/themes/heritage.js +102 -0
  325. package/dist/themes/maison.d.ts +13 -0
  326. package/dist/themes/maison.js +99 -0
  327. package/dist/themes/milano.d.ts +13 -0
  328. package/dist/themes/milano.js +101 -0
  329. package/dist/themes/monolith.d.ts +13 -0
  330. package/dist/themes/monolith.js +101 -0
  331. package/package.json +87 -5
@@ -0,0 +1,134 @@
1
+ @layer sv.tokens, sv.base, sv.components, sv.utilities;
2
+
3
+ @layer sv.components {
4
+ /*
5
+ * The region: a strip of the screen's height in the top layer, with the toasts at its
6
+ * bottom, across a phone and at the end from 600px. It never changes height, so a toast
7
+ * fading out stays where it was while the others move. Around the toasts, presses go
8
+ * through to the page.
9
+ */
10
+ .sv-toasts {
11
+ position: fixed;
12
+ inset-block: 0;
13
+ inset-inline: var(--sv-space-8);
14
+ box-sizing: border-box;
15
+ display: flex;
16
+ flex-direction: column;
17
+ justify-content: flex-end;
18
+ inline-size: auto;
19
+ block-size: auto;
20
+ max-inline-size: none;
21
+ max-block-size: none;
22
+ margin: 0;
23
+ padding-block: 0 calc(var(--sv-space-21) + env(safe-area-inset-bottom, 0px));
24
+ padding-inline: 0;
25
+ border: 0;
26
+ overflow: visible;
27
+ background: transparent;
28
+ color: var(--sv-color-text);
29
+ font-family: var(--sv-font-ui);
30
+ pointer-events: none;
31
+ }
32
+
33
+ @media (width >= 600px) {
34
+ .sv-toasts {
35
+ inset-inline: auto var(--sv-space-21);
36
+ inline-size: 21rem;
37
+ }
38
+ }
39
+
40
+ /* F8 focuses the region; the ring goes round the toasts, not the strip. */
41
+ .sv-toasts:focus-visible {
42
+ outline: none;
43
+ }
44
+
45
+ .sv-toasts:focus-visible .sv-toasts__list {
46
+ outline: var(--sv-focus-width) solid var(--sv-color-primary);
47
+ outline-offset: var(--sv-focus-offset);
48
+ }
49
+
50
+ .sv-toasts__list {
51
+ display: grid;
52
+ gap: var(--sv-space-8);
53
+ margin: 0;
54
+ padding: 0;
55
+ border-radius: var(--sv-rounded, min(var(--sv-radius-md), var(--sv-radius-lg)));
56
+ list-style: none;
57
+ pointer-events: auto;
58
+ }
59
+
60
+ /* Filled with its colour; neutral is the page inverted, so it reads on any surface. */
61
+ .sv-toast {
62
+ display: flex;
63
+ gap: var(--sv-space-5);
64
+ align-items: center;
65
+ box-sizing: border-box;
66
+ min-block-size: calc(var(--sv-control-lg) * var(--sv-density));
67
+ padding-block: calc(var(--sv-space-5) * var(--sv-density));
68
+ padding-inline: calc(var(--sv-space-13) * var(--sv-density)) var(--sv-space-5);
69
+ border-radius: var(--sv-rounded, min(var(--sv-radius-md), var(--sv-radius-lg)));
70
+ background-color: var(--sv-variant-bg);
71
+ box-shadow: var(--sv-shadow);
72
+ color: var(--sv-variant-fg);
73
+ font-size: var(--sv-text-sm);
74
+ line-height: var(--sv-leading-snug);
75
+ }
76
+
77
+ .sv-toast__message {
78
+ flex: 1;
79
+ min-inline-size: 0;
80
+ margin: 0;
81
+ padding-block: var(--sv-space-3);
82
+ overflow-wrap: break-word;
83
+ }
84
+
85
+ .sv-toast__action,
86
+ .sv-toast__close {
87
+ flex: none;
88
+ border: 0;
89
+ background: transparent;
90
+ color: inherit;
91
+ cursor: pointer;
92
+ }
93
+
94
+ .sv-toast__action {
95
+ min-block-size: var(--sv-control-sm);
96
+ padding-inline: var(--sv-space-8);
97
+ border-radius: var(--sv-radius-sm);
98
+ font: inherit;
99
+ font-weight: var(--sv-weight-semibold);
100
+ /* Lettered like the theme's buttons: capitals in a theme that sets them. */
101
+ letter-spacing: var(--sv-button-tracking);
102
+ text-transform: var(--sv-button-transform);
103
+ white-space: nowrap;
104
+ }
105
+
106
+ .sv-toast__close {
107
+ display: inline-grid;
108
+ place-items: center;
109
+ inline-size: var(--sv-control-sm);
110
+ block-size: var(--sv-control-sm);
111
+ padding: 0;
112
+ border-radius: 50%;
113
+ }
114
+
115
+ .sv-toast__close svg {
116
+ inline-size: 1.272em;
117
+ block-size: 1.272em;
118
+ }
119
+
120
+ @media (hover: hover) {
121
+ :is(.sv-toast__action, .sv-toast__close):hover {
122
+ background-color: color-mix(in oklch, currentColor var(--sv-state-hover), transparent);
123
+ }
124
+ }
125
+
126
+ :is(.sv-toast__action, .sv-toast__close):active {
127
+ background-color: color-mix(in oklch, currentColor var(--sv-state-press), transparent);
128
+ }
129
+
130
+ /* The ring takes the toast's own text colour, which contrasts with it in every colour. */
131
+ .sv-toast :focus-visible {
132
+ outline-color: currentColor;
133
+ }
134
+ }
@@ -0,0 +1,117 @@
1
+ import type { Color, Density, Rounded } from '../props/types.js';
2
+ /** The Toast props that `DefaultsProvider` and `UIProvider` can set for a subtree. */
3
+ export interface ToastDefaults {
4
+ /**
5
+ * The colour of a toast shown without one: `neutral` is the page inverted.
6
+ * @default 'neutral'
7
+ */
8
+ color: Color;
9
+ /**
10
+ * How long a toast stays, in ms, not counting the time it is hovered or focused. `0` keeps
11
+ * it until it is dismissed.
12
+ * @default 6000
13
+ */
14
+ duration: number;
15
+ /**
16
+ * Multiplies the padding, never the text.
17
+ * @default 'default'
18
+ */
19
+ density: Density;
20
+ /**
21
+ * Corner rounding. `true` keeps the theme's radius.
22
+ * @default true
23
+ */
24
+ rounded: Rounded;
25
+ }
26
+ declare module '../defaults/context.js' {
27
+ interface ComponentDefaults {
28
+ Toast: ToastDefaults;
29
+ }
30
+ }
31
+ /** A button in a toast, such as Undo. The toast closes after `onclick` has run. */
32
+ export interface ToastAction {
33
+ /** The button's text, short: "Undo", "Retry", "View". */
34
+ label: string;
35
+ onclick: () => void;
36
+ }
37
+ /** How a toast looks and how long it stays. Unset options take the Toast defaults. */
38
+ export interface ToastOptions {
39
+ /** A button that acts on what the message reports, such as Undo. */
40
+ action?: ToastAction;
41
+ /** The colour. `error` is announced at once; the others wait for the screen reader to pause. */
42
+ color?: Color;
43
+ /** In ms, not counting the time it is hovered or focused. `0` keeps it until it is dismissed. */
44
+ duration?: number;
45
+ }
46
+ /**
47
+ * Short messages at the bottom of the screen that report what just happened, with a button
48
+ * to act on it, such as Undo. At most three show at once, newest first; each leaves after
49
+ * its duration, which waits while the pointer or focus is on the toasts. F8 moves focus to
50
+ * them. While a Dialog or Sheet is open they show inside it, so they can still be pressed.
51
+ * Returned by `useToast()`.
52
+ *
53
+ * @example
54
+ * const toast = useToast();
55
+ * toast.show('Payment sent', { action: { label: 'Undo', onclick: cancelPayment } });
56
+ */
57
+ export interface ToastInstance {
58
+ /** Shows `message` and returns the toast's id. */
59
+ show(message: string, options?: ToastOptions): string;
60
+ /** Closes the toast with this id, if it is still shown. */
61
+ dismiss(id: string): void;
62
+ }
63
+ /** A toast as the outlets render it. */
64
+ export interface ToastEntry {
65
+ id: string;
66
+ message: string;
67
+ color: Color;
68
+ action?: ToastAction;
69
+ }
70
+ /** What the live regions read out: the message, then the action's label. */
71
+ export interface Announcement {
72
+ id: string;
73
+ message: string;
74
+ action?: string;
75
+ assertive: boolean;
76
+ }
77
+ /**
78
+ * The toasts of an app: the queue, the timers and what to announce. Outlets render them: the
79
+ * provider's at the end of the page, and one inside each open modal dialog, which makes the
80
+ * rest of the page inert. The topmost outlet shows them all.
81
+ */
82
+ export declare class Toasts {
83
+ #private;
84
+ /** Newest first. */
85
+ list: ToastEntry[];
86
+ announcements: Announcement[];
87
+ /** The provider's outlet, used while no modal dialog has one open. */
88
+ readonly base: {};
89
+ constructor(defaults: () => ToastDefaults);
90
+ /** The outlet that shows the toasts. */
91
+ get top(): object;
92
+ /** The density and rounding of every toast, from the provider's defaults. */
93
+ get style(): Pick<ToastDefaults, 'density' | 'rounded'>;
94
+ /** Makes `outlet` the topmost until the returned function is called. */
95
+ register(outlet: object): () => void;
96
+ show(message: string, { action, color, duration }?: ToastOptions): string;
97
+ dismiss(id: string): void;
98
+ /** Stops every timer until each source has resumed: the pointer on the toasts, focus in them. */
99
+ pause(source: object): void;
100
+ resume(source: object): void;
101
+ }
102
+ /** The nearest provider's toasts, if there is one. */
103
+ export declare const getToasts: () => Toasts | undefined;
104
+ export declare const setToasts: (toasts: Toasts) => Toasts;
105
+ /**
106
+ * Returns the toasts of the nearest `<UIProvider>` or `<ToastProvider>`. Call it while a
107
+ * component initialises; call `show()` whenever something happens.
108
+ *
109
+ * @example
110
+ * <script>
111
+ * import { Button, useToast } from '@sveltier/ui';
112
+ * const toast = useToast();
113
+ * </script>
114
+ *
115
+ * <Button onclick={() => toast.show('Saved', { color: 'success' })}>Save</Button>
116
+ */
117
+ export declare function useToast(): ToastInstance;
@@ -0,0 +1,133 @@
1
+ import { getContext, hasContext, setContext, untrack } from 'svelte';
2
+ import { sveltierError } from '../errors/errors.js';
3
+ // At most this many on screen; a newer toast pushes the oldest out.
4
+ const MAX = 3;
5
+ // Long enough for a screen reader to take the text, short enough that switching outlets
6
+ // does not read it twice.
7
+ const ANNOUNCED = 1000;
8
+ /**
9
+ * The toasts of an app: the queue, the timers and what to announce. Outlets render them: the
10
+ * provider's at the end of the page, and one inside each open modal dialog, which makes the
11
+ * rest of the page inert. The topmost outlet shows them all.
12
+ */
13
+ export class Toasts {
14
+ /** Newest first. */
15
+ list = $state.raw([]);
16
+ announcements = $state.raw([]);
17
+ /** The provider's outlet, used while no modal dialog has one open. */
18
+ base = {};
19
+ #outlets = $state.raw([]);
20
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity -- never read reactively
21
+ #timers = new Map();
22
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity -- never read reactively
23
+ #pausers = new Set();
24
+ #count = 0;
25
+ #defaults;
26
+ constructor(defaults) {
27
+ this.#defaults = defaults;
28
+ }
29
+ /** The outlet that shows the toasts. */
30
+ get top() {
31
+ return this.#outlets.at(-1) ?? this.base;
32
+ }
33
+ /** The density and rounding of every toast, from the provider's defaults. */
34
+ get style() {
35
+ const { density, rounded } = this.#defaults();
36
+ return { density, rounded };
37
+ }
38
+ // The methods below may run inside an effect, which must not come to depend on the lists
39
+ // they change, so they read them untracked.
40
+ /** Makes `outlet` the topmost until the returned function is called. */
41
+ register(outlet) {
42
+ untrack(() => (this.#outlets = [...this.#outlets, outlet]));
43
+ return () => untrack(() => (this.#outlets = this.#outlets.filter((other) => other !== outlet)));
44
+ }
45
+ show(message, { action, color, duration } = {}) {
46
+ const id = `sv-toast-${++this.#count}`;
47
+ // Toasts answer what the user does, so they belong to the browser: one shown while the
48
+ // server renders would have nothing to hydrate into.
49
+ if (typeof window === 'undefined')
50
+ return id;
51
+ const defaults = untrack(this.#defaults);
52
+ const entry = { id, message, color: color ?? defaults.color, action };
53
+ untrack(() => (this.list = [entry, ...this.list]));
54
+ for (const old of untrack(() => this.list.slice(MAX)))
55
+ this.dismiss(old.id);
56
+ const time = duration ?? defaults.duration;
57
+ if (time > 0 && Number.isFinite(time)) {
58
+ this.#timers.set(id, { remaining: time, started: 0 });
59
+ if (this.#pausers.size === 0)
60
+ this.#start(id);
61
+ }
62
+ this.#announce(entry);
63
+ return id;
64
+ }
65
+ dismiss(id) {
66
+ this.#stop(id);
67
+ this.#timers.delete(id);
68
+ untrack(() => (this.list = this.list.filter((toast) => toast.id !== id)));
69
+ }
70
+ /** Stops every timer until each source has resumed: the pointer on the toasts, focus in them. */
71
+ pause(source) {
72
+ if (this.#pausers.size === 0)
73
+ for (const id of this.#timers.keys())
74
+ this.#stop(id);
75
+ this.#pausers.add(source);
76
+ }
77
+ resume(source) {
78
+ if (!this.#pausers.delete(source) || this.#pausers.size > 0)
79
+ return;
80
+ for (const id of this.#timers.keys())
81
+ this.#start(id);
82
+ }
83
+ #start(id) {
84
+ const timer = this.#timers.get(id);
85
+ if (!timer)
86
+ return;
87
+ timer.started = performance.now();
88
+ timer.handle = setTimeout(() => this.dismiss(id), timer.remaining);
89
+ }
90
+ #stop(id) {
91
+ const timer = this.#timers.get(id);
92
+ if (timer?.handle === undefined)
93
+ return;
94
+ clearTimeout(timer.handle);
95
+ timer.handle = undefined;
96
+ timer.remaining -= performance.now() - timer.started;
97
+ }
98
+ #announce({ id, message, action, color }) {
99
+ const note = { id, message, action: action?.label, assertive: color === 'error' };
100
+ untrack(() => (this.announcements = [...this.announcements, note]));
101
+ setTimeout(() => {
102
+ this.announcements = this.announcements.filter((other) => other !== note);
103
+ }, ANNOUNCED);
104
+ }
105
+ }
106
+ // A private symbol key instead of createContext(): its `has` function only exists from
107
+ // Svelte 5.57, and the supported range starts at 5.40.
108
+ const KEY = Symbol('sveltier.toasts');
109
+ /** The nearest provider's toasts, if there is one. */
110
+ export const getToasts = () => hasContext(KEY) ? getContext(KEY) : undefined;
111
+ export const setToasts = (toasts) => setContext(KEY, toasts);
112
+ /**
113
+ * Returns the toasts of the nearest `<UIProvider>` or `<ToastProvider>`. Call it while a
114
+ * component initialises; call `show()` whenever something happens.
115
+ *
116
+ * @example
117
+ * <script>
118
+ * import { Button, useToast } from '@sveltier/ui';
119
+ * const toast = useToast();
120
+ * </script>
121
+ *
122
+ * <Button onclick={() => toast.show('Saved', { color: 'success' })}>Save</Button>
123
+ */
124
+ export function useToast() {
125
+ const toasts = getToasts();
126
+ if (!toasts) {
127
+ throw sveltierError('SV4003', 'useToast() was called outside a <UIProvider>. Call it in a component inside <UIProvider>, or inside <ToastProvider> when the app uses <ThemeProvider> alone.');
128
+ }
129
+ return {
130
+ show: (message, options) => toasts.show(message, options),
131
+ dismiss: (id) => toasts.dismiss(id)
132
+ };
133
+ }
@@ -0,0 +1,5 @@
1
+ import type * as On from './on.js';
2
+ export declare const DEV: boolean;
3
+ export declare const checkValue: typeof On.checkValue;
4
+ export declare const warnUnnamed: typeof On.warnUnnamed;
5
+ export declare const warnNamelessTrigger: typeof On.warnNamelessTrigger;
@@ -0,0 +1,4 @@
1
+ export const DEV = false;
2
+ export const checkValue = () => { };
3
+ export const warnUnnamed = () => { };
4
+ export const warnNamelessTrigger = () => { };
@@ -0,0 +1,20 @@
1
+ export declare const DEV: boolean;
2
+ /**
3
+ * Warns when a prop that takes one of a fixed set of values got another one. `hint` names the
4
+ * likely intent, for example the prop the value belongs to.
5
+ */
6
+ export declare function checkValue(component: string, prop: string, value: unknown, valid: readonly unknown[], hint?: string): void;
7
+ /**
8
+ * Warns when a form control or a dialog has no accessible name: no label with text, and no ARIA
9
+ * name. `give` names what to add, as the message says it ("a label", "a title").
10
+ */
11
+ export declare function warnUnnamed(component: string, element: (HTMLElement & {
12
+ labels?: NodeListOf<HTMLLabelElement> | null;
13
+ }) | null | undefined, give?: string): void;
14
+ /**
15
+ * Warns when a tooltip describes a control that has no accessible name: a description names
16
+ * nothing, so an icon-only button would be announced as just "button".
17
+ */
18
+ export declare function warnNamelessTrigger(component: string, element: HTMLElement & {
19
+ labels?: NodeListOf<HTMLLabelElement> | null;
20
+ }): void;
package/dist/dev/on.js ADDED
@@ -0,0 +1,49 @@
1
+ import { ERRORS_URL } from '../core/errors/errors.js';
2
+ export const DEV = true;
3
+ const warned = new Set();
4
+ /** Warns once per message, in the format of thrown errors. */
5
+ function warn(code, message) {
6
+ const text = `[sveltier ${code}] ${message} ${ERRORS_URL}#${code}`;
7
+ if (warned.has(text))
8
+ return;
9
+ warned.add(text);
10
+ console.warn(text);
11
+ }
12
+ const show = (value) => (typeof value === 'string' ? `'${value}'` : String(value));
13
+ /**
14
+ * Warns when a prop that takes one of a fixed set of values got another one. `hint` names the
15
+ * likely intent, for example the prop the value belongs to.
16
+ */
17
+ export function checkValue(component, prop, value, valid, hint) {
18
+ if (value == null || valid.includes(value))
19
+ return;
20
+ const got = typeof value === 'string' ? `"${value}"` : `{${String(value)}}`;
21
+ warn('SV2002', `<${component}> got ${prop}=${got}. Valid values: ${valid.map(show).join(' | ')}.${hint ? ` ${hint}` : ''}`);
22
+ }
23
+ /**
24
+ * Warns when a form control or a dialog has no accessible name: no label with text, and no ARIA
25
+ * name. `give` names what to add, as the message says it ("a label", "a title").
26
+ */
27
+ export function warnUnnamed(component, element, give = 'a label') {
28
+ if (!element)
29
+ return;
30
+ // A label that wraps the control but holds no text names nothing.
31
+ if ([...(element.labels ?? [])].some((label) => label.textContent?.trim()))
32
+ return;
33
+ if (element.getAttribute('aria-label') || element.getAttribute('aria-labelledby'))
34
+ return;
35
+ warn('SV5001', `<${component}> has no accessible name. Give it ${give}, or name it with aria-label or aria-labelledby.`);
36
+ }
37
+ /**
38
+ * Warns when a tooltip describes a control that has no accessible name: a description names
39
+ * nothing, so an icon-only button would be announced as just "button".
40
+ */
41
+ export function warnNamelessTrigger(component, element) {
42
+ if (element.textContent?.trim() ||
43
+ element.querySelector('img[alt]:not([alt=""])') ||
44
+ ['aria-label', 'aria-labelledby', 'title'].some((name) => element.getAttribute(name)) ||
45
+ [...(element.labels ?? [])].some((label) => label.textContent?.trim())) {
46
+ return;
47
+ }
48
+ warn('SV4002', `<${component}> describes a control that has no accessible name. A tooltip adds a description, not a name: give the control aria-label, as every icon-only button needs, or visible text.`);
49
+ }
@@ -0,0 +1,67 @@
1
+ export { default as UIProvider, type UIProviderProps } from './core/provider/UIProvider.svelte';
2
+ export { default as ThemeProvider, type ThemeProviderProps } from './core/theme/ThemeProvider.svelte';
3
+ export { useTheme, type ThemeInstance } from './core/theme/context.js';
4
+ export { defineTheme } from './core/theme/define.js';
5
+ export { themeCss, themeScript, type ThemeCssOptions } from './core/theme/css.js';
6
+ export { contrast, onColor, parseOklch, type Oklch } from './core/theme/color.js';
7
+ export { INTENT_COLORS, NEUTRAL_COLORS, THEME_VARIABLES, type IntentColor, type NeutralColor, type ThemeChoice, type ThemeColors, type ThemeDefinition, type ThemeInput, type ThemeVariable, type ThemeVariables } from './core/theme/types.js';
8
+ export { monolith, monolithDark, monolithLight } from './themes/monolith.js';
9
+ export { heritage, heritageDark, heritageLight } from './themes/heritage.js';
10
+ export { aurora, auroraDark, auroraLight } from './themes/aurora.js';
11
+ export { maison, maisonDark, maisonLight } from './themes/maison.js';
12
+ export { milano, milanoDark, milanoLight } from './themes/milano.js';
13
+ export { DENSITIES, ROUNDED, SIZES, VARIANTS, type Color, type CustomColors, type Density, type Rounded, type SharedProps, type Size, type Variant } from './core/props/types.js';
14
+ export { sharedClasses, type SharedClassProps } from './core/props/classes.js';
15
+ export type { ElementProps } from './core/props/element.js';
16
+ export { default as DefaultsProvider, type DefaultsProviderProps } from './core/defaults/DefaultsProvider.svelte';
17
+ export { useDefaults, type ComponentDefaults, type DefaultsConfig, type GlobalDefaults } from './core/defaults/context.js';
18
+ export { BREAKPOINTS, useDisplay, type Breakpoint, type DisplayInstance, type DisplayOptions, type DisplayThresholds } from './core/display/display.js';
19
+ export { MESSAGES, useLocale, type LocaleInstance, type LocaleOptions, type MessageKey, type Messages } from './core/locale/locale.js';
20
+ export { ERROR_CODES, type ErrorCode, type ErrorEntry } from './core/errors/codes.js';
21
+ export type { FieldError, Rule, ValidateOn } from './core/form/types.js';
22
+ export { CLOSE_REASONS, type CloseReason, type TriggerAttributes } from './core/overlay/types.js';
23
+ export { default as ToastProvider, type ToastProviderProps } from './core/toast/ToastProvider.svelte';
24
+ export { useToast, type ToastAction, type ToastDefaults, type ToastInstance, type ToastOptions } from './core/toast/toast.svelte.js';
25
+ export { focusTrap, type FocusTrapOptions } from './primitives/focus/focus-trap.js';
26
+ export { rovingFocus, type RovingFocusOptions } from './primitives/focus/roving-focus.js';
27
+ export { isTabbable, tabbable, type FocusableElement } from './primitives/focus/tabbable.js';
28
+ export { dismissable, type DismissableOptions, type DismissReason } from './primitives/layer/dismissable.js';
29
+ export { default as Portal, type PortalProps } from './primitives/portal/Portal.svelte';
30
+ export { inertOthers } from './primitives/inert/inert-others.js';
31
+ export { scrollLock } from './primitives/scroll-lock/scroll-lock.js';
32
+ export { anchored, type Align, type AnchoredOptions, type Side } from './primitives/anchored/anchored.js';
33
+ export { combination, keymap, type KeyHandler } from './primitives/keyboard/keymap.js';
34
+ export { typeahead, type TypeaheadOptions } from './primitives/keyboard/typeahead.js';
35
+ export { cubicBezier } from './primitives/motion/easing.js';
36
+ export { easing, fade, motion, pop, rise, spring, SPRINGS, type Motion, type SpringPreset, type TransitionOptions } from './primitives/motion/motion.js';
37
+ export { virtualList, type ScrollToIndexOptions, type VirtualItem, type VirtualKey, type VirtualList, type VirtualListOptions } from './primitives/virtual/virtual-list.svelte.js';
38
+ export { Accordion, type AccordionDefaults, type AccordionItem, type AccordionProps } from './components/Accordion/index.js';
39
+ export { Alert, type AlertDefaults, type AlertProps } from './components/Alert/index.js';
40
+ export { Avatar, type AvatarDefaults, type AvatarProps } from './components/Avatar/index.js';
41
+ export { Badge, type BadgeDefaults, type BadgeProps } from './components/Badge/index.js';
42
+ export { Button, type ButtonDefaults, type ButtonProps } from './components/Button/index.js';
43
+ export { ButtonGroup, type ButtonGroupDefaults, type ButtonGroupProps } from './components/ButtonGroup/index.js';
44
+ export { Card, type CardDefaults, type CardProps } from './components/Card/index.js';
45
+ export { Checkbox, type CheckboxDefaults, type CheckboxProps } from './components/Checkbox/index.js';
46
+ export { Chip, type ChipDefaults, type ChipProps } from './components/Chip/index.js';
47
+ export { Dialog, type DialogDefaults, type DialogProps } from './components/Dialog/index.js';
48
+ export { Divider, type DividerProps } from './components/Divider/index.js';
49
+ export { Field, FIELD_VARIANTS, type FieldContentProps, type FieldControlAttributes, type FieldDefaults, type FieldProps, type FieldVariant } from './components/Field/index.js';
50
+ export { Form, type FormProps } from './components/Form/index.js';
51
+ export { Icon, type IconProps } from './components/Icon/index.js';
52
+ export { List, ListItem, type ListDefaults, type ListItemProps, type ListProps } from './components/List/index.js';
53
+ export { Menu, type MenuAction, type MenuDefaults, type MenuHeading, type MenuItem, type MenuProps, type MenuSeparator } from './components/Menu/index.js';
54
+ export { NativeSelect, type NativeSelectDefaults, type NativeSelectOption, type NativeSelectProps } from './components/NativeSelect/index.js';
55
+ export { NumberField, type NumberFieldDefaults, type NumberFieldProps } from './components/NumberField/index.js';
56
+ export { Popover, type PopoverDefaults, type PopoverProps } from './components/Popover/index.js';
57
+ export { ProgressCircular, ProgressLinear, type ProgressCircularDefaults, type ProgressCircularProps, type ProgressLinearDefaults, type ProgressLinearProps } from './components/Progress/index.js';
58
+ export { RadioGroup, type RadioGroupDefaults, type RadioGroupOption, type RadioGroupProps } from './components/RadioGroup/index.js';
59
+ export { SegmentedControl, type SegmentedControlDefaults, type SegmentedControlOption, type SegmentedControlProps } from './components/SegmentedControl/index.js';
60
+ export { Sheet, SHEET_SIDES, type SheetDefaults, type SheetProps, type SheetSide } from './components/Sheet/index.js';
61
+ export { Skeleton, type SkeletonProps } from './components/Skeleton/index.js';
62
+ export { Slider, type SliderDefaults, type SliderProps, type SliderTick } from './components/Slider/index.js';
63
+ export { Switch, type SwitchDefaults, type SwitchProps } from './components/Switch/index.js';
64
+ export { Tabs, type TabsDefaults, type TabsItem, type TabsProps } from './components/Tabs/index.js';
65
+ export { Textarea, type TextareaDefaults, type TextareaProps } from './components/Textarea/index.js';
66
+ export { TextField, type TextFieldDefaults, type TextFieldProps, type TextFieldType } from './components/TextField/index.js';
67
+ export { Tooltip, type TooltipDefaults, type TooltipProps } from './components/Tooltip/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,83 @@
1
+ // Root provider
2
+ export { default as UIProvider } from './core/provider/UIProvider.svelte';
3
+ // Theme engine
4
+ export { default as ThemeProvider } from './core/theme/ThemeProvider.svelte';
5
+ export { useTheme } from './core/theme/context.js';
6
+ export { defineTheme } from './core/theme/define.js';
7
+ export { themeCss, themeScript } from './core/theme/css.js';
8
+ export { contrast, onColor, parseOklch } from './core/theme/color.js';
9
+ export { INTENT_COLORS, NEUTRAL_COLORS, THEME_VARIABLES } from './core/theme/types.js';
10
+ // Built-in themes, also importable one by one from '@sveltier/ui/themes/<name>'
11
+ export { monolith, monolithDark, monolithLight } from './themes/monolith.js';
12
+ export { heritage, heritageDark, heritageLight } from './themes/heritage.js';
13
+ export { aurora, auroraDark, auroraLight } from './themes/aurora.js';
14
+ export { maison, maisonDark, maisonLight } from './themes/maison.js';
15
+ export { milano, milanoDark, milanoLight } from './themes/milano.js';
16
+ // Shared props
17
+ export { DENSITIES, ROUNDED, SIZES, VARIANTS } from './core/props/types.js';
18
+ export { sharedClasses } from './core/props/classes.js';
19
+ // Defaults
20
+ export { default as DefaultsProvider } from './core/defaults/DefaultsProvider.svelte';
21
+ export { useDefaults } from './core/defaults/context.js';
22
+ // Display
23
+ export { BREAKPOINTS, useDisplay } from './core/display/display.js';
24
+ // Locale
25
+ export { MESSAGES, useLocale } from './core/locale/locale.js';
26
+ // Errors
27
+ export { ERROR_CODES } from './core/errors/codes.js';
28
+ // Overlays: what an overlay hands to the control that opens it
29
+ export { CLOSE_REASONS } from './core/overlay/types.js';
30
+ // Toasts
31
+ export { default as ToastProvider } from './core/toast/ToastProvider.svelte';
32
+ export { useToast } from './core/toast/toast.svelte.js';
33
+ // Primitives: focus
34
+ export { focusTrap } from './primitives/focus/focus-trap.js';
35
+ export { rovingFocus } from './primitives/focus/roving-focus.js';
36
+ export { isTabbable, tabbable } from './primitives/focus/tabbable.js';
37
+ // Primitives: layers
38
+ export { dismissable } from './primitives/layer/dismissable.js';
39
+ // Primitives: portal and modality
40
+ export { default as Portal } from './primitives/portal/Portal.svelte';
41
+ export { inertOthers } from './primitives/inert/inert-others.js';
42
+ export { scrollLock } from './primitives/scroll-lock/scroll-lock.js';
43
+ // Primitives: positioning
44
+ export { anchored } from './primitives/anchored/anchored.js';
45
+ // Primitives: keyboard
46
+ export { combination, keymap } from './primitives/keyboard/keymap.js';
47
+ export { typeahead } from './primitives/keyboard/typeahead.js';
48
+ // Primitives: motion
49
+ export { cubicBezier } from './primitives/motion/easing.js';
50
+ export { easing, fade, motion, pop, rise, spring, SPRINGS } from './primitives/motion/motion.js';
51
+ // Primitives: virtual lists
52
+ export { virtualList } from './primitives/virtual/virtual-list.svelte.js';
53
+ // Components
54
+ export { Accordion } from './components/Accordion/index.js';
55
+ export { Alert } from './components/Alert/index.js';
56
+ export { Avatar } from './components/Avatar/index.js';
57
+ export { Badge } from './components/Badge/index.js';
58
+ export { Button } from './components/Button/index.js';
59
+ export { ButtonGroup } from './components/ButtonGroup/index.js';
60
+ export { Card } from './components/Card/index.js';
61
+ export { Checkbox } from './components/Checkbox/index.js';
62
+ export { Chip } from './components/Chip/index.js';
63
+ export { Dialog } from './components/Dialog/index.js';
64
+ export { Divider } from './components/Divider/index.js';
65
+ export { Field, FIELD_VARIANTS } from './components/Field/index.js';
66
+ export { Form } from './components/Form/index.js';
67
+ export { Icon } from './components/Icon/index.js';
68
+ export { List, ListItem } from './components/List/index.js';
69
+ export { Menu } from './components/Menu/index.js';
70
+ export { NativeSelect } from './components/NativeSelect/index.js';
71
+ export { NumberField } from './components/NumberField/index.js';
72
+ export { Popover } from './components/Popover/index.js';
73
+ export { ProgressCircular, ProgressLinear } from './components/Progress/index.js';
74
+ export { RadioGroup } from './components/RadioGroup/index.js';
75
+ export { SegmentedControl } from './components/SegmentedControl/index.js';
76
+ export { Sheet, SHEET_SIDES } from './components/Sheet/index.js';
77
+ export { Skeleton } from './components/Skeleton/index.js';
78
+ export { Slider } from './components/Slider/index.js';
79
+ export { Switch } from './components/Switch/index.js';
80
+ export { Tabs } from './components/Tabs/index.js';
81
+ export { Textarea } from './components/Textarea/index.js';
82
+ export { TextField } from './components/TextField/index.js';
83
+ export { Tooltip } from './components/Tooltip/index.js';
@@ -0,0 +1,39 @@
1
+ import type { Attachment } from 'svelte/attachments';
2
+ export declare const SIDES: readonly ["top", "bottom", "start", "end"];
3
+ export declare const ALIGNS: readonly ["start", "center", "end"];
4
+ export declare const PHYSICAL_SIDES: readonly ["top", "bottom", "left", "right"];
5
+ /** Side of the anchor. `start` and `end` follow the writing direction. */
6
+ export type Side = (typeof SIDES)[number];
7
+ /** Alignment along that side, following the writing direction. */
8
+ export type Align = (typeof ALIGNS)[number];
9
+ export type PhysicalSide = (typeof PHYSICAL_SIDES)[number];
10
+ export interface AnchoredOptions {
11
+ /** The element to place against. Nothing happens until it exists. */
12
+ anchor: Element | null | undefined;
13
+ /** Defaults to `'bottom'`. */
14
+ side?: Side;
15
+ /** Defaults to `'start'`. */
16
+ align?: Align;
17
+ /** Gap between the anchor and the floating element, in px. Defaults to 5. */
18
+ offset?: number;
19
+ /** Move to the opposite side when there is not enough room. Defaults to `true`. */
20
+ flip?: boolean;
21
+ }
22
+ /**
23
+ * The physical side, and the alignment in physical terms (start is left or top), of a
24
+ * logical placement in the element's direction. Both placement paths use it, so they agree.
25
+ */
26
+ export declare function physical(side: Side, align: Align, rtl: boolean): [PhysicalSide, Align];
27
+ /** `position-area` in physical keywords: `bottom span-right` is below, from the left edge. */
28
+ export declare function positionArea(side: PhysicalSide, align: Align): string;
29
+ /**
30
+ * Places the element next to `anchor` and keeps it there on scroll and resize, flipping to
31
+ * the opposite side when there is not enough room. Uses CSS anchor positioning where the
32
+ * browser has it, otherwise loads a small script. The element must be positioned against the
33
+ * viewport: a popover in the top layer, or `position: fixed`.
34
+ *
35
+ * @example
36
+ * <button bind:this={trigger}>Account</button>
37
+ * <div popover="manual" {@attach anchored({ anchor: trigger, side: 'bottom', align: 'end' })}>…</div>
38
+ */
39
+ export declare function anchored({ anchor, side, align, offset, flip }: AnchoredOptions): Attachment<HTMLElement>;