@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,143 @@
1
+ /** What .data-control is made of, classified. The props follow the
2
+ families the project registers (variants.ts, ADR 0015).
3
+
4
+ The control draws its own rows: every class below the root that is
5
+ not an axis is a PART. The buttons, fields, chips and pagination in
6
+ them are the kit's own components. */
7
+ export declare const PREFIX = "data-control";
8
+ export declare const AXES: {
9
+ readonly size: readonly ["xs", "sm", "md", "lg", "xl"];
10
+ readonly variant: readonly ["boxed"];
11
+ };
12
+ export declare const FLAGS: {};
13
+ export declare const PARTS: readonly ["bar", "bar-left", "bar-right", "search", "count", "filters", "filter", "filter-remove", "editor", "field", "field-label", "more", "actions-start", "actions-end", "actions", "page-options", "pagination", "range", "body", "total"];
14
+ /** Every text the control writes. */
15
+ export interface DataControlLabels {
16
+ filters: string;
17
+ sort: string;
18
+ noSort: string;
19
+ search: string;
20
+ perPage: (n: number) => string;
21
+ selected: (n: number) => string;
22
+ range: (from: number, to: number, total: number) => string;
23
+ results: (total: number) => string;
24
+ save: string;
25
+ undo: string;
26
+ redo: string;
27
+ reset: string;
28
+ delete: string;
29
+ add: string;
30
+ export: string;
31
+ removeFilter: (title: string) => string;
32
+ yes: string;
33
+ no: string;
34
+ any: string;
35
+ confirmDeleteTitle: (n: number) => string;
36
+ confirmDeleteText: string;
37
+ cancel: string;
38
+ confirmDiscardTitle: (n: number) => string;
39
+ confirmDiscardText: string;
40
+ discard: string;
41
+ stay: string;
42
+ }
43
+ export declare const LABELS: DataControlLabels;
44
+ /**
45
+ * The controls of a data handler, around the view that shows its rows:
46
+ * filters, sort, search, page size, pagination, and actions on the
47
+ * selection or on the whole resource. Every one of them is optional, and
48
+ * an action only appears when the handler can do it (`update`, `delete`).
49
+ *
50
+ * Deleting and dropping unsaved changes are confirmed in a Dialog, unless
51
+ * the handler was given its own `confirmDelete` / `confirmDiscard`.
52
+ */
53
+ import type { Snippet } from 'svelte';
54
+ import type { HTMLAttributes } from 'svelte/elements';
55
+ import type { DataHandlerState, EntitySuggestion, Filter, HandledFilter } from './data-handler.svelte.js';
56
+ declare function $$render<F extends readonly Filter[], Model extends Record<string, any>, Id>(): {
57
+ props: {
58
+ readonly size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
59
+ readonly variant?: "boxed" | undefined;
60
+ } & {} & {
61
+ background?: string;
62
+ } & Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
63
+ /** The handler whose rows and requests these controls drive. */
64
+ handler: DataHandlerState<F, Model, Id>;
65
+ /** The view: a Table, a Grid, a List — given the handler. */
66
+ children?: Snippet<[DataHandlerState<F, Model, Id>]>;
67
+ /** Offer the handler's filters. Default true. */
68
+ filters?: boolean;
69
+ /** Draw every filter as a field in the bar, and the page size and the sort
70
+ with the pagination, instead of a menu, chips and a select in the bar. */
71
+ fields?: boolean;
72
+ /** Offer the handler's sorts. Default true. */
73
+ sorts?: boolean;
74
+ /** Draw the filter, sort and save buttons as icons alone, their text as a title, and the menus and filters small. The sort in use and the number of results go with the filters. */
75
+ compact?: boolean;
76
+ /** Draw a search field. Default true. */
77
+ search?: boolean;
78
+ /** Milliseconds without typing before the search is fetched. Default 300. */
79
+ searchDelay?: number;
80
+ /** The page sizes to choose from, or `false` for none. */
81
+ limits?: number[] | false;
82
+ /** Where the pagination goes. Default `bottom`. */
83
+ pagination?: "top" | "bottom" | "both" | "none";
84
+ /** Draw save, undo, redo and discard, when the handler can update. Default true. */
85
+ editing?: boolean;
86
+ /** Draw delete, when the handler can delete. Default true. */
87
+ removable?: boolean;
88
+ /** Draw export: `true`, or the options the export runs with. */
89
+ exportable?: boolean | ({
90
+ name?: string;
91
+ max?: number;
92
+ batch?: number;
93
+ columns?: {
94
+ key: string;
95
+ label?: string;
96
+ }[];
97
+ format?: ((row: Model) => Record<string, unknown>) | undefined;
98
+ separator?: string;
99
+ decimal?: string;
100
+ download?: boolean;
101
+ } | undefined);
102
+ /** Draw an add button calling this. */
103
+ onAdd?: () => void;
104
+ /** Confirm deletions and discarded changes in a dialog. Default true. */
105
+ confirm?: boolean;
106
+ /** How an entity is drawn, in its filter's chip and suggestions. Default: its text. */
107
+ entity?: Snippet<[HandledFilter, EntitySuggestion]>;
108
+ /** Drawn first in the bar, before the filters. */
109
+ start?: Snippet<[DataHandlerState<F, Model, Id>]>;
110
+ /** Drawn at the start of the bar, after the filters and the sort. */
111
+ leftActions?: Snippet<[DataHandlerState<F, Model, Id>]>;
112
+ /** Drawn at the end of the bar, after the built-in actions. */
113
+ rightActions?: Snippet<[DataHandlerState<F, Model, Id>]>;
114
+ /** Drawn above the view (and above a top pagination). */
115
+ header?: Snippet<[DataHandlerState<F, Model, Id>]>;
116
+ /** Drawn below the view (and below a bottom pagination). */
117
+ footer?: Snippet<[DataHandlerState<F, Model, Id>]>;
118
+ /** The texts, for another language. */
119
+ labels?: Partial<DataControlLabels>;
120
+ class?: string;
121
+ };
122
+ exports: {};
123
+ bindings: "";
124
+ slots: {};
125
+ events: {};
126
+ };
127
+ declare class __sveltets_Render<F extends readonly Filter[], Model extends Record<string, any>, Id> {
128
+ props(): ReturnType<typeof $$render<F, Model, Id>>['props'];
129
+ events(): ReturnType<typeof $$render<F, Model, Id>>['events'];
130
+ slots(): ReturnType<typeof $$render<F, Model, Id>>['slots'];
131
+ bindings(): "";
132
+ exports(): {};
133
+ }
134
+ interface $$IsomorphicComponent {
135
+ new <F extends readonly Filter[], Model extends Record<string, any>, Id>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<F, Model, Id>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<F, Model, Id>['props']>, ReturnType<__sveltets_Render<F, Model, Id>['events']>, ReturnType<__sveltets_Render<F, Model, Id>['slots']>> & {
136
+ $$bindings?: ReturnType<__sveltets_Render<F, Model, Id>['bindings']>;
137
+ } & ReturnType<__sveltets_Render<F, Model, Id>['exports']>;
138
+ <F extends readonly Filter[], Model extends Record<string, any>, Id>(internal: unknown, props: ReturnType<__sveltets_Render<F, Model, Id>['props']> & {}): ReturnType<__sveltets_Render<F, Model, Id>['exports']>;
139
+ z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>['bindings']>;
140
+ }
141
+ declare const DataControl: $$IsomorphicComponent;
142
+ type DataControl<F extends readonly Filter[], Model extends Record<string, any>, Id> = InstanceType<typeof DataControl<F, Model, Id>>;
143
+ export default DataControl;
@@ -0,0 +1,67 @@
1
+ <script module lang="ts">
2
+ /* No PREFIX, no AXES: the data handler draws nothing, so it has no
3
+ namespace and nothing for a family to style. The class is exported for use without the
4
+ component: `new DataHandlerState({ … })`. */
5
+ export {
6
+ DataHandlerState,
7
+ parseQuery,
8
+ parseFilterValues,
9
+ filterValuesToParams,
10
+ type DataHandlerOptions,
11
+ type DataHandlerMessages,
12
+ type DataRow,
13
+ type DiscardChoice,
14
+ type EntityValue,
15
+ type EntitySuggestion,
16
+ type Filter,
17
+ type FilterValues,
18
+ type GetParams,
19
+ type GetResult,
20
+ type HandledFilter,
21
+ type Identifier,
22
+ type Navigation,
23
+ type Sort
24
+ } from './data-handler.svelte.js';
25
+ </script>
26
+
27
+ <script
28
+ lang="ts"
29
+ generics="const F extends readonly Filter[], Model extends Record<string, any>, Id = string"
30
+ >
31
+ /**
32
+ * The live state of one remote resource, handed to its children. Renders
33
+ * nothing of its own: whatever the children draw — a DataControl, a Table,
34
+ * a Grid — reads and changes the resource through the handler they are
35
+ * given.
36
+ *
37
+ * The handler is built once, from the props as they are on mount: changing
38
+ * a prop afterwards does not rebuild it (that would drop the rows, the
39
+ * selection and the edits). Talk to the handler instead.
40
+ */
41
+ import { onMount, untrack, type Snippet } from 'svelte';
42
+ import {
43
+ DataHandlerState,
44
+ type DataHandlerOptions,
45
+ type Filter
46
+ } from './data-handler.svelte.js';
47
+
48
+ interface Props extends DataHandlerOptions<F, Model, Id> {
49
+ /** What to draw with the handler. */
50
+ children?: Snippet<[DataHandlerState<F, Model, Id>]>;
51
+ /** The handler itself, for the parent. Bindable, read only. */
52
+ handler?: DataHandlerState<F, Model, Id>;
53
+ /** Fetch on mount when no `init` was given. Default true. */
54
+ autoload?: boolean;
55
+ }
56
+
57
+ let { children, handler = $bindable(), autoload = true, ...options }: Props = $props();
58
+
59
+ const instance = untrack(() => new DataHandlerState<F, Model, Id>({ ...options } as DataHandlerOptions<F, Model, Id>));
60
+ handler = instance;
61
+
62
+ onMount(() => {
63
+ if (autoload && !options.init) instance.load({ replace: true });
64
+ });
65
+ </script>
66
+
67
+ {@render children?.(instance)}
@@ -0,0 +1,44 @@
1
+ export { DataHandlerState, parseQuery, parseFilterValues, filterValuesToParams, type DataHandlerOptions, type DataHandlerMessages, type DataRow, type DiscardChoice, type EntityValue, type EntitySuggestion, type Filter, type FilterValues, type GetParams, type GetResult, type HandledFilter, type Identifier, type Navigation, type Sort } from './data-handler.svelte.js';
2
+ /**
3
+ * The live state of one remote resource, handed to its children. Renders
4
+ * nothing of its own: whatever the children draw — a DataControl, a Table,
5
+ * a Grid — reads and changes the resource through the handler they are
6
+ * given.
7
+ *
8
+ * The handler is built once, from the props as they are on mount: changing
9
+ * a prop afterwards does not rebuild it (that would drop the rows, the
10
+ * selection and the edits). Talk to the handler instead.
11
+ */
12
+ import { type Snippet } from 'svelte';
13
+ import { DataHandlerState, type DataHandlerOptions, type Filter } from './data-handler.svelte.js';
14
+ declare function $$render<const F extends readonly Filter[], Model extends Record<string, any>, Id = string>(): {
15
+ props: DataHandlerOptions<F, Model, Id> & {
16
+ /** What to draw with the handler. */
17
+ children?: Snippet<[DataHandlerState<F, Model, Id>]>;
18
+ /** The handler itself, for the parent. Bindable, read only. */
19
+ handler?: DataHandlerState<F, Model, Id>;
20
+ /** Fetch on mount when no `init` was given. Default true. */
21
+ autoload?: boolean;
22
+ };
23
+ exports: {};
24
+ bindings: "handler";
25
+ slots: {};
26
+ events: {};
27
+ };
28
+ declare class __sveltets_Render<const F extends readonly Filter[], Model extends Record<string, any>, Id = string> {
29
+ props(): ReturnType<typeof $$render<F, Model, Id>>['props'];
30
+ events(): ReturnType<typeof $$render<F, Model, Id>>['events'];
31
+ slots(): ReturnType<typeof $$render<F, Model, Id>>['slots'];
32
+ bindings(): "handler";
33
+ exports(): {};
34
+ }
35
+ interface $$IsomorphicComponent {
36
+ new <const F extends readonly Filter[], Model extends Record<string, any>, Id = string>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<F, Model, Id>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<F, Model, Id>['props']>, ReturnType<__sveltets_Render<F, Model, Id>['events']>, ReturnType<__sveltets_Render<F, Model, Id>['slots']>> & {
37
+ $$bindings?: ReturnType<__sveltets_Render<F, Model, Id>['bindings']>;
38
+ } & ReturnType<__sveltets_Render<F, Model, Id>['exports']>;
39
+ <const F extends readonly Filter[], Model extends Record<string, any>, Id = string>(internal: unknown, props: ReturnType<__sveltets_Render<F, Model, Id>['props']> & {}): ReturnType<__sveltets_Render<F, Model, Id>['exports']>;
40
+ z_$$bindings?: ReturnType<__sveltets_Render<any, any, any>['bindings']>;
41
+ }
42
+ declare const DataHandler: $$IsomorphicComponent;
43
+ type DataHandler<const F extends readonly Filter[], Model extends Record<string, any>, Id = string> = InstanceType<typeof DataHandler<F, Model, Id>>;
44
+ export default DataHandler;
@@ -0,0 +1,185 @@
1
+ <script lang="ts">
2
+ /**
3
+ * A field that opens a calendar: an Input, a Dropdown and an inline
4
+ * Calendar, put together. It draws nothing of its own — no namespace —
5
+ * so it looks like the family's input, dropdown and calendar.
6
+ *
7
+ * The value lives in a real `<input type="date">` (`datetime-local`,
8
+ * `time`), visually hidden: it carries `name`, `required`, `min` and
9
+ * `max`, so a form submits and validates it as the browser does, and the
10
+ * page says what the field holds. The visible field is read only and
11
+ * shows `format(value)`; the calendar only writes into the native one.
12
+ * When the browser finds it invalid, the visible field shows why.
13
+ *
14
+ * `value` is a Date, or `[start, end]` with `range` (then the native
15
+ * input is a text one holding `start/end`). A single date closes the box
16
+ * on its pick, a range on its second date; with a time, the box stays
17
+ * open while the time is set.
18
+ */
19
+ import type { ComponentProps } from 'svelte';
20
+ import Input from './Input.svelte';
21
+ import Dropdown from './Dropdown.svelte';
22
+ import Calendar from './Calendar.svelte';
23
+
24
+ type Value = Date | Date[] | null;
25
+ type Kind = 'date' | 'datetime-local' | 'time';
26
+
27
+ interface Props {
28
+ /** The picked date, or [start, end] with `range`. Bindable. */
29
+ value?: Value;
30
+ /** A day (default), a day and a time, or a time alone. */
31
+ type?: Kind;
32
+ /** Pick a start and an end. Days only. */
33
+ range?: boolean;
34
+ /** On the visible field, for a `<label for>`. */
35
+ id?: string;
36
+ /** For a form: the native input's name. */
37
+ name?: string;
38
+ /** A value is needed: the native input says so to its form. */
39
+ required?: boolean;
40
+ placeholder?: string;
41
+ disabled?: boolean;
42
+ min?: Date;
43
+ max?: Date;
44
+ /** How a value is written in the field. Defaults to the browser's locale for the type. */
45
+ format?: (date: Date) => string;
46
+ /** After every completed pick, and after a clear (`null`). */
47
+ onChange?: (value: Value) => void;
48
+ /** Colour the field by its validity, as Input's `validator`. */
49
+ validator?: boolean;
50
+ /** An error from outside, as on Input: shown, and the field is invalid. */
51
+ error?: string | null;
52
+ /** Anything else the Calendar takes: locale, firstDay, view… */
53
+ calendar?: Partial<ComponentProps<typeof Calendar>>;
54
+ /** The field's size, as Input's. */
55
+ size?: ComponentProps<typeof Input>['size'];
56
+ class?: string;
57
+ }
58
+
59
+ let {
60
+ value = $bindable(null),
61
+ type = 'date',
62
+ range = false,
63
+ id,
64
+ name,
65
+ required = false,
66
+ placeholder,
67
+ disabled = false,
68
+ min,
69
+ max,
70
+ format,
71
+ onChange,
72
+ validator = false,
73
+ error = null,
74
+ calendar = {},
75
+ size,
76
+ class: klass = ''
77
+ }: Props = $props();
78
+
79
+ let open = $state(false);
80
+ /** The browser's message once it found the native input invalid. */
81
+ let refused = $state<string | null>(null);
82
+
83
+ let ranged = $derived(range && type === 'date');
84
+ let timed = $derived(type !== 'date');
85
+
86
+ const list = (v: Value): Date[] => (v == null ? [] : Array.isArray(v) ? v : [v]);
87
+ const pad = (n: number) => String(n).padStart(2, '0');
88
+ const day = (d: Date) => `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
89
+ const clock = (d: Date) => `${pad(d.getHours())}:${pad(d.getMinutes())}`;
90
+
91
+ /** A date as the native input writes it. */
92
+ function serial(d: Date): string {
93
+ if (type === 'time') return clock(d);
94
+ if (type === 'datetime-local') return `${day(d)}T${clock(d)}`;
95
+ return day(d);
96
+ }
97
+
98
+ function shown(d: Date): string {
99
+ if (format) return format(d);
100
+ if (type === 'time') return d.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' });
101
+ if (type === 'datetime-local') return d.toLocaleString(undefined, { dateStyle: 'short', timeStyle: 'short' });
102
+ return d.toLocaleDateString();
103
+ }
104
+
105
+ let text = $derived(list(value).map(shown).join(' – '));
106
+ let submitted = $derived(list(value).map(serial).join('/'));
107
+
108
+ /* The native input checks `min` and `max` itself, written as it reads them.
109
+ A range is a text input: only `required` is checked there. */
110
+ let bounds = $derived({
111
+ min: min && !ranged ? serial(min) : undefined,
112
+ max: max && !ranged ? serial(max) : undefined
113
+ });
114
+
115
+ function picked(next: Value) {
116
+ value = next;
117
+ refused = null;
118
+ const done = ranged ? list(next).length === 2 : next != null;
119
+ if (done) {
120
+ if (!timed) open = false;
121
+ onChange?.(next);
122
+ }
123
+ }
124
+
125
+ function clear() {
126
+ value = null;
127
+ refused = null;
128
+ onChange?.(null);
129
+ }
130
+ </script>
131
+
132
+ <span class={klass} style="position: relative; display: inline-block;">
133
+ <Dropdown bind:open>
134
+ {#snippet trigger({ props })}
135
+ <Input
136
+ {...props}
137
+ {id}
138
+ {size}
139
+ {placeholder}
140
+ {disabled}
141
+ {validator}
142
+ error={error || refused}
143
+ value={text}
144
+ readonly
145
+ aria-haspopup="dialog"
146
+ aria-required={required || undefined}
147
+ onkeydown={(e: KeyboardEvent) => {
148
+ if (e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown') {
149
+ e.preventDefault();
150
+ props.onclick();
151
+ } else if ((e.key === 'Backspace' || e.key === 'Delete') && value != null) {
152
+ e.preventDefault();
153
+ clear();
154
+ }
155
+ }}
156
+ />
157
+ {/snippet}
158
+ <Calendar
159
+ {...calendar}
160
+ range={ranged}
161
+ timepicker={timed}
162
+ options={type === 'time' ? { onlyTimepicker: true, ...calendar.options } : calendar.options}
163
+ {min}
164
+ {max}
165
+ {value}
166
+ onChange={picked}
167
+ />
168
+ </Dropdown>
169
+ <!-- What the field holds, as the browser reads it: the form's value and
170
+ its validity. Out of sight and out of the tab order; when the browser
171
+ finds it invalid, the visible field shows the message. -->
172
+ <input
173
+ type={ranged ? 'text' : type}
174
+ {name}
175
+ {required}
176
+ {disabled}
177
+ min={bounds.min}
178
+ max={bounds.max}
179
+ value={submitted}
180
+ tabindex="-1"
181
+ aria-hidden="true"
182
+ style="position: absolute; inset-inline-start: 0; inset-block-end: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none;"
183
+ oninvalid={(e) => (refused = e.currentTarget.validationMessage)}
184
+ />
185
+ </span>
@@ -0,0 +1,56 @@
1
+ /**
2
+ * A field that opens a calendar: an Input, a Dropdown and an inline
3
+ * Calendar, put together. It draws nothing of its own — no namespace —
4
+ * so it looks like the family's input, dropdown and calendar.
5
+ *
6
+ * The value lives in a real `<input type="date">` (`datetime-local`,
7
+ * `time`), visually hidden: it carries `name`, `required`, `min` and
8
+ * `max`, so a form submits and validates it as the browser does, and the
9
+ * page says what the field holds. The visible field is read only and
10
+ * shows `format(value)`; the calendar only writes into the native one.
11
+ * When the browser finds it invalid, the visible field shows why.
12
+ *
13
+ * `value` is a Date, or `[start, end]` with `range` (then the native
14
+ * input is a text one holding `start/end`). A single date closes the box
15
+ * on its pick, a range on its second date; with a time, the box stays
16
+ * open while the time is set.
17
+ */
18
+ import type { ComponentProps } from 'svelte';
19
+ import Input from './Input.svelte';
20
+ import Calendar from './Calendar.svelte';
21
+ type Value = Date | Date[] | null;
22
+ type Kind = 'date' | 'datetime-local' | 'time';
23
+ interface Props {
24
+ /** The picked date, or [start, end] with `range`. Bindable. */
25
+ value?: Value;
26
+ /** A day (default), a day and a time, or a time alone. */
27
+ type?: Kind;
28
+ /** Pick a start and an end. Days only. */
29
+ range?: boolean;
30
+ /** On the visible field, for a `<label for>`. */
31
+ id?: string;
32
+ /** For a form: the native input's name. */
33
+ name?: string;
34
+ /** A value is needed: the native input says so to its form. */
35
+ required?: boolean;
36
+ placeholder?: string;
37
+ disabled?: boolean;
38
+ min?: Date;
39
+ max?: Date;
40
+ /** How a value is written in the field. Defaults to the browser's locale for the type. */
41
+ format?: (date: Date) => string;
42
+ /** After every completed pick, and after a clear (`null`). */
43
+ onChange?: (value: Value) => void;
44
+ /** Colour the field by its validity, as Input's `validator`. */
45
+ validator?: boolean;
46
+ /** An error from outside, as on Input: shown, and the field is invalid. */
47
+ error?: string | null;
48
+ /** Anything else the Calendar takes: locale, firstDay, view… */
49
+ calendar?: Partial<ComponentProps<typeof Calendar>>;
50
+ /** The field's size, as Input's. */
51
+ size?: ComponentProps<typeof Input>['size'];
52
+ class?: string;
53
+ }
54
+ declare const DatePicker: import("svelte").Component<Props, {}, "value">;
55
+ type DatePicker = ReturnType<typeof DatePicker>;
56
+ export default DatePicker;