@yannosay/sinth 5.3.3 → 5.3.4

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 (39) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +4 -2
  3. package/dist/browser/sinth.js +596 -69
  4. package/dist/cli/index.js +35 -3
  5. package/dist/cli/skill.d.ts +10 -0
  6. package/dist/cli/skill.js +106 -0
  7. package/dist/cli/templates.js +1 -1
  8. package/dist/compiler/codegen.js +4 -2
  9. package/dist/compiler/elements.d.ts +6 -0
  10. package/dist/compiler/elements.js +12 -0
  11. package/dist/compiler/html.d.ts +2 -0
  12. package/dist/compiler/html.js +7 -0
  13. package/dist/compiler/prerender.js +5 -3
  14. package/dist/deploy/platforms.js +9 -0
  15. package/dist/deploy/redirects.d.ts +31 -0
  16. package/dist/deploy/redirects.js +102 -0
  17. package/dist/project/build.js +44 -2
  18. package/dist/project/config.d.ts +6 -0
  19. package/dist/project/config.js +15 -2
  20. package/dist/project/env.d.ts +11 -0
  21. package/dist/project/env.js +84 -0
  22. package/dist/project/project.js +13 -0
  23. package/dist/runtime/index.js +21 -3
  24. package/dist/server/dev.d.ts +4 -0
  25. package/dist/server/dev.js +32 -9
  26. package/dist/server/functions.d.ts +2 -1
  27. package/dist/server/functions.js +15 -17
  28. package/dist/server/preview.d.ts +3 -0
  29. package/dist/server/preview.js +8 -1
  30. package/dist/server/static.d.ts +9 -0
  31. package/dist/server/static.js +24 -1
  32. package/lib/ui/index.sinth +533 -24
  33. package/package.json +1 -1
  34. package/schema/sinth.config.schema.json +27 -0
  35. package/skills/agents.md +15 -9
  36. package/skills/sinth/SKILL.md +66 -24
  37. package/skills/sinth/references/language.md +2 -1
  38. package/skills/sinth/references/project-and-deploy.md +18 -2
  39. package/skills/sinth/references/ui.md +95 -0
@@ -1,14 +1,43 @@
1
1
  -- sinth:ui: the official Sinth component library.
2
- -- Usage: import { Button, Card } from "sinth:ui"
3
- -- Theme it by overriding the --ui-* custom properties on :root.
2
+ -- Usage: import { Button, Card, toast } from "sinth:ui"
3
+ -- Theme it by overriding the --ui-* custom properties on :root. Every component is keyboard
4
+ -- accessible and follows the WAI-ARIA patterns for its role.
4
5
 
5
- component Button(str variant = "primary", str size = "md", str? href, bool disabled = false, str type = "button", bool block = false) {
6
+ -- Shared state: toasts are shown by the Toaster component, from anywhere that calls toast().
7
+ var obj[] toasts = []
8
+ var num toastSeq = 0
9
+
10
+ -- Shows a notification. tone: info, success, warning or danger. duration in ms (0 keeps it open).
11
+ function toast(str message, str tone = "info", num duration = 4000) {
12
+ toastSeq += 1
13
+ const id = toastSeq
14
+ toasts.push({ id: id, message: message, tone: tone })
15
+ if duration > 0 {
16
+ setTimeout(() => dismissToast(id), duration)
17
+ }
18
+ }
19
+
20
+ function dismissToast(num id) {
21
+ const i = toasts.findIndex((t) => t.id == id)
22
+ if i != -1 {
23
+ toasts.splice(i, 1)
24
+ }
25
+ }
26
+
27
+ function uiId(str prefix) -> str {
28
+ return "ui-" + prefix + "-" + Math.random().toString(36).slice(2, 8)
29
+ }
30
+
31
+ component Button(str variant = "primary", str size = "md", str? href, bool disabled = false, str type = "button", bool block = false, bool loading = false) {
6
32
  if href {
7
- Link(class: ["ui-btn", "ui-btn--" + variant, "ui-btn--" + size, block ? "ui-btn--block" : ""], href: href, ariaDisabled: disabled ? "true" : null) {
33
+ Link(class: ["ui-btn", "ui-btn--" + variant, "ui-btn--" + size, block ? "ui-btn--block" : ""], href: disabled ? null : href, ariaDisabled: disabled ? "true" : null) {
8
34
  $slot
9
35
  }
10
36
  } else {
11
- Button(class: ["ui-btn", "ui-btn--" + variant, "ui-btn--" + size, block ? "ui-btn--block" : ""], type: type, disabled: disabled) {
37
+ Button(class: ["ui-btn", "ui-btn--" + variant, "ui-btn--" + size, block ? "ui-btn--block" : ""], type: type, disabled: disabled or loading, ariaBusy: loading ? "true" : null) {
38
+ if loading {
39
+ Span(class: "ui-spinner ui-spinner--inline", ariaHidden: "true")
40
+ }
12
41
  $slot
13
42
  }
14
43
  }
@@ -72,7 +101,8 @@ component VStack(str gap = "1rem", str align = "stretch") {
72
101
  }
73
102
  }
74
103
 
75
- component Field(str label, bind value, str type = "text", str placeholder = "", str? hint, str? error, bool required = false, str? name) {
104
+ component Field(str label, bind value, str type = "text", str placeholder = "", str? hint, str? error, bool required = false, bool disabled = false, str? name, str? autocomplete) {
105
+ const str id = uiId("field")
76
106
  Label(class: ["ui-field", error ? "ui-field--invalid" : ""]) {
77
107
  Span(class: "ui-field__label") {
78
108
  label
@@ -81,21 +111,47 @@ component Field(str label, bind value, str type = "text", str placeholder = "",
81
111
  }
82
112
  }
83
113
  if type == "textarea" {
84
- Textarea(class: "ui-field__control", model: value, placeholder: placeholder, required: required, name: name, ariaInvalid: error ? "true" : null)
114
+ Textarea(class: "ui-field__control", model: value, placeholder: placeholder, required: required, disabled: disabled, name: name, ariaInvalid: error ? "true" : null, ariaDescribedby: error or hint ? id : null)
85
115
  } else {
86
- Input(class: "ui-field__control", type: type, model: value, placeholder: placeholder, required: required, name: name, ariaInvalid: error ? "true" : null)
116
+ Input(class: "ui-field__control", type: type, model: value, placeholder: placeholder, required: required, disabled: disabled, name: name, autocomplete: autocomplete, ariaInvalid: error ? "true" : null, ariaDescribedby: error or hint ? id : null)
87
117
  }
88
118
  if error {
89
- Span(class: "ui-field__error") { error }
119
+ Span(class: "ui-field__error", id: id) { error }
90
120
  } else if hint {
91
- Span(class: "ui-field__hint") { hint }
121
+ Span(class: "ui-field__hint", id: id) { hint }
92
122
  }
93
123
  }
94
124
  }
95
125
 
96
- component Toggle(bind checked, str? label) {
97
- Label(class: "ui-toggle") {
98
- Input(type: "checkbox", role: "switch", class: "ui-toggle__input", model: checked)
126
+ -- options: strings, or objects with value and label.
127
+ component Select(str label, bind value, any[] options, str? placeholder, str? hint, str? error, bool required = false, bool disabled = false, str? name) {
128
+ const str id = uiId("select")
129
+ Label(class: ["ui-field", error ? "ui-field--invalid" : ""]) {
130
+ Span(class: "ui-field__label") {
131
+ label
132
+ if required {
133
+ Span(class: "ui-field__required", ariaHidden: "true") { " *" }
134
+ }
135
+ }
136
+ Select(class: "ui-field__control", model: value, required: required, disabled: disabled, name: name, ariaInvalid: error ? "true" : null, ariaDescribedby: error or hint ? id : null) {
137
+ if placeholder {
138
+ Option(value: "", disabled: true) { placeholder }
139
+ }
140
+ for opt in options {
141
+ Option(value: typeof opt == "object" ? opt.value : opt) { typeof opt == "object" ? opt.label : opt }
142
+ }
143
+ }
144
+ if error {
145
+ Span(class: "ui-field__error", id: id) { error }
146
+ } else if hint {
147
+ Span(class: "ui-field__hint", id: id) { hint }
148
+ }
149
+ }
150
+ }
151
+
152
+ component Toggle(bind checked, str? label, bool disabled = false) {
153
+ Label(class: ["ui-toggle", disabled ? "ui-toggle--disabled" : ""]) {
154
+ Input(type: "checkbox", role: "switch", class: "ui-toggle__input", model: checked, disabled: disabled)
99
155
  Span(class: "ui-toggle__track", ariaHidden: "true") {
100
156
  Span(class: "ui-toggle__thumb")
101
157
  }
@@ -105,23 +161,64 @@ component Toggle(bind checked, str? label) {
105
161
  }
106
162
  }
107
163
 
108
- component Modal(bind open, str? title, str width = "32rem") {
164
+ -- A modal dialog: traps focus while open, restores it on close, locks page scrolling and closes
165
+ -- with Escape or a backdrop click (dismissible: false keeps it open until the code closes it).
166
+ component Modal(bind open, str? title, str width = "32rem", bool dismissible = true) {
109
167
  var obj dialog = null
168
+ var obj opener = null
169
+ const str titleId = uiId("modal")
110
170
 
111
- watch open {
112
- if open {
171
+ function lock(bool on) {
172
+ if on {
173
+ opener = document.activeElement
174
+ document.documentElement.style.overflow = "hidden"
113
175
  setTimeout(() => dialog?.focus(), 0)
176
+ } else {
177
+ document.documentElement.style.overflow = ""
178
+ if opener and opener.isConnected {
179
+ opener.focus()
180
+ }
181
+ opener = null
182
+ }
183
+ }
184
+
185
+ function trapFocus(obj e) {
186
+ const items = Array.from(dialog.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])"))
187
+ if items.length == 0 {
188
+ e.preventDefault()
189
+ return
190
+ }
191
+ const first = items[0]
192
+ const last = items[items.length - 1]
193
+ if e.shiftKey and (document.activeElement == first or document.activeElement == dialog) {
194
+ e.preventDefault()
195
+ last.focus()
196
+ } else if not e.shiftKey and document.activeElement == last {
197
+ e.preventDefault()
198
+ first.focus()
199
+ }
200
+ }
201
+
202
+ function close() {
203
+ if dismissible {
204
+ open = false
114
205
  }
115
206
  }
116
207
 
208
+ watch open { lock(open) }
209
+ onMount { if open { lock(true) } }
210
+ onDestroy { if open { document.documentElement.style.overflow = "" } }
211
+
117
212
  if open transition("ui-fade") {
118
- Div(class: "ui-modal", onClick.self: open = false, onKeyDown.esc: open = false) {
119
- Div(class: "ui-modal__dialog", ref: dialog, role: "dialog", ariaModal: "true", ariaLabel: title, tabindex: "-1", style: { maxWidth: width }) {
213
+ Div(class: "ui-modal", onClick.self: close(), onKeyDown.esc: close(), onKeyDown.tab: trapFocus(e)) {
214
+ Div(class: "ui-modal__dialog", ref: dialog, role: "dialog", ariaModal: "true", ariaLabelledby: title ? titleId : null, tabindex: "-1", style: { maxWidth: width }) {
120
215
  Header(class: "ui-modal__header") {
121
216
  if title {
122
- Heading(level: 2, class: "ui-modal__title") { title }
217
+ Heading(level: 2, class: "ui-modal__title", id: titleId) { title }
218
+ }
219
+ if dismissible {
220
+ Button(class: "ui-modal__close", ariaLabel: "Close", onClick: open = false) { "×" }
123
221
  }
124
- Button(class: "ui-modal__close", ariaLabel: "Close", onClick: open = false) { "×" }
125
222
  }
126
223
  Div(class: "ui-modal__body") {
127
224
  $slot
@@ -132,11 +229,233 @@ component Modal(bind open, str? title, str width = "32rem") {
132
229
  }
133
230
  }
134
231
 
232
+ -- tabs: the tab labels. Put one Div per tab in the slot; only the selected one is shown.
233
+ -- Arrow keys, Home and End move between tabs (WAI-ARIA tabs pattern).
234
+ component Tabs(str[] tabs, bind selected = 0, str? label) {
235
+ var obj list = null
236
+ const str id = uiId("tabs")
237
+
238
+ function pick(num i) {
239
+ selected = (i + tabs.length) % tabs.length
240
+ setTimeout(() => list?.querySelectorAll("[role=tab]")[selected]?.focus(), 0)
241
+ }
242
+
243
+ Div(class: "ui-tabs") {
244
+ Div(class: "ui-tabs__list", role: "tablist", ariaLabel: label, ref: list,
245
+ onKeyDown.right: pick(selected + 1), onKeyDown.left: pick(selected - 1),
246
+ onKeyDown.home: pick(0), onKeyDown.end: pick(tabs.length - 1)) {
247
+ for tab, i in tabs {
248
+ Button(class: "ui-tabs__tab", role: "tab", id: id + "-tab-" + i, ariaSelected: selected == i ? "true" : "false",
249
+ ariaControls: id + "-panel", tabindex: selected == i ? "0" : "-1", onClick: selected = i) { tab }
250
+ }
251
+ }
252
+ Div(class: "ui-tabs__panel", role: "tabpanel", id: id + "-panel", ariaLabelledby: id + "-tab-" + selected, tabindex: "0", dataSelected: selected) {
253
+ $slot
254
+ }
255
+ }
256
+ }
257
+
258
+ -- A disclosure built on <details>: works without JavaScript and with find-in-page.
259
+ component Accordion(str title, bool open = false) {
260
+ Details(class: "ui-accordion", open: open) {
261
+ Summary(class: "ui-accordion__summary") { title }
262
+ Div(class: "ui-accordion__body") {
263
+ $slot
264
+ }
265
+ }
266
+ }
267
+
268
+ component Tooltip(str text, str placement = "top") {
269
+ const str id = uiId("tip")
270
+ Span(class: ["ui-tooltip", "ui-tooltip--" + placement], ariaDescribedby: id) {
271
+ $slot
272
+ Span(class: "ui-tooltip__bubble", role: "tooltip", id: id) { text }
273
+ }
274
+ }
275
+
276
+ -- columns: objects with key and label (optional: align "end" for numbers).
277
+ -- rows: objects; set sortable to sort by clicking a header.
278
+ component Table(obj[] columns, obj[] rows, str? caption, bool sortable = false, str empty = "No data", bool striped = true) {
279
+ var str sortKey = ""
280
+ var num sortDir = 1
281
+ computed obj[] sorted = sortKey == "" ? rows : rows.slice().sort((a, b) => (a[sortKey] > b[sortKey] ? 1 : a[sortKey] < b[sortKey] ? -1 : 0) * sortDir)
282
+
283
+ function sortBy(str key) {
284
+ if sortKey == key {
285
+ sortDir = -sortDir
286
+ } else {
287
+ sortKey = key
288
+ sortDir = 1
289
+ }
290
+ }
291
+
292
+ Div(class: "ui-table__wrap", tabindex: "0", role: "region", ariaLabel: caption) {
293
+ Table(class: ["ui-table", striped ? "ui-table--striped" : ""]) {
294
+ if caption {
295
+ Caption(class: "ui-table__caption") { caption }
296
+ }
297
+ Thead {
298
+ Tr {
299
+ for col in columns {
300
+ Th(scope: "col", class: col.align == "end" ? "ui-table__num" : "", ariaSort: sortKey == col.key ? (sortDir == 1 ? "ascending" : "descending") : null) {
301
+ if sortable {
302
+ Button(class: "ui-table__sort", onClick: sortBy(col.key)) {
303
+ col.label
304
+ Span(class: "ui-table__arrow", ariaHidden: "true") { sortKey == col.key ? (sortDir == 1 ? " ▲" : " ▼") : "" }
305
+ }
306
+ } else {
307
+ col.label
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }
313
+ Tbody {
314
+ for row in sorted {
315
+ Tr {
316
+ for col in columns {
317
+ Td(class: col.align == "end" ? "ui-table__num" : "") { row[col.key] }
318
+ }
319
+ }
320
+ } else {
321
+ Tr {
322
+ Td(class: "ui-table__empty", colspan: columns.length) { empty }
323
+ }
324
+ }
325
+ }
326
+ }
327
+ }
328
+ }
329
+
330
+ -- page is 1-based. Shows first, last and the pages around the current one.
331
+ component Pagination(bind page, num total, str label = "Pagination") {
332
+ computed num[] pages = range(1, total + 1).filter((p) => p == 1 or p == total or Math.abs(p - page) <= 1)
333
+
334
+ Nav(class: "ui-pagination", ariaLabel: label) {
335
+ Button(class: "ui-pagination__item", disabled: page <= 1, ariaLabel: "Previous page", onClick: page -= 1) { "‹" }
336
+ for p, i in pages {
337
+ if i > 0 and p - pages[i - 1] > 1 {
338
+ Span(class: "ui-pagination__gap", ariaHidden: "true") { "…" }
339
+ }
340
+ Button(class: "ui-pagination__item", ariaCurrent: p == page ? "page" : null, onClick: page = p) { p }
341
+ }
342
+ Button(class: "ui-pagination__item", disabled: page >= total, ariaLabel: "Next page", onClick: page += 1) { "›" }
343
+ }
344
+ }
345
+
346
+ -- items: objects with label and an optional href (the last item is the current page).
347
+ component Breadcrumbs(obj[] items) {
348
+ Nav(class: "ui-breadcrumbs", ariaLabel: "Breadcrumb") {
349
+ Ol {
350
+ for item, i in items {
351
+ Li {
352
+ if item.href and i < items.length - 1 {
353
+ Link(href: item.href) { item.label }
354
+ } else {
355
+ Span(ariaCurrent: i == items.length - 1 ? "page" : null) { item.label }
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+ }
362
+
363
+ -- value from 0 to max; leave it out for an indeterminate bar.
364
+ component ProgressBar(num? value, num max = 100, str label = "Progress") {
365
+ Div(class: ["ui-progress", value == null ? "ui-progress--indeterminate" : ""], role: "progressbar", ariaLabel: label,
366
+ ariaValuemin: "0", ariaValuemax: max, ariaValuenow: value) {
367
+ Div(class: "ui-progress__bar", style: { width: value == null ? "40%" : Math.min(100, Math.max(0, value / max * 100)) + "%" })
368
+ }
369
+ }
370
+
371
+ component Skeleton(str width = "100%", str height = "1rem", str radius = "var(--ui-radius)") {
372
+ Span(class: "ui-skeleton", ariaHidden: "true", style: { width: width, height: height, borderRadius: radius })
373
+ }
374
+
375
+ component EmptyState(str title, str? description) {
376
+ Div(class: "ui-empty") {
377
+ Strong(class: "ui-empty__title") { title }
378
+ if description {
379
+ Paragraph(class: "ui-empty__description") { description }
380
+ }
381
+ $slot
382
+ }
383
+ }
384
+
385
+ -- A dropdown menu: the slot holds the items (Button or Link elements). Closes on Escape,
386
+ -- outside clicks and after an item is chosen.
387
+ component Dropdown(str label, str variant = "secondary", str align = "start") {
388
+ var bool open = false
389
+ var obj root = null
390
+
391
+ function toggle() {
392
+ open = not open
393
+ if open {
394
+ setTimeout(() => root?.querySelector(".ui-dropdown__menu a, .ui-dropdown__menu button")?.focus(), 0)
395
+ }
396
+ }
397
+
398
+ function move(obj e, num dir) {
399
+ const items = Array.from(root.querySelectorAll(".ui-dropdown__menu a, .ui-dropdown__menu button"))
400
+ if items.length == 0 {
401
+ return
402
+ }
403
+ e.preventDefault()
404
+ const i = items.indexOf(document.activeElement)
405
+ items[(i + dir + items.length) % items.length].focus()
406
+ }
407
+
408
+ function closeAndFocus() {
409
+ open = false
410
+ root?.querySelector(".ui-dropdown__trigger")?.focus()
411
+ }
412
+
413
+ onMount {
414
+ const away = (e) => {
415
+ if open and root and not root.contains(e.target) {
416
+ open = false
417
+ }
418
+ }
419
+ document.addEventListener("click", away)
420
+ return () => document.removeEventListener("click", away)
421
+ }
422
+
423
+ Div(class: "ui-dropdown", ref: root, onKeyDown.esc: closeAndFocus(), onKeyDown.down: move(e, 1), onKeyDown.up: move(e, -1)) {
424
+ Button(class: ["ui-btn", "ui-btn--" + variant, "ui-btn--md", "ui-dropdown__trigger"], ariaHaspopup: "menu", ariaExpanded: open ? "true" : "false", onClick: toggle()) {
425
+ label
426
+ Span(class: "ui-dropdown__caret", ariaHidden: "true") { "▾" }
427
+ }
428
+ if open {
429
+ Div(class: ["ui-dropdown__menu", "ui-dropdown__menu--" + align], role: "menu", onClick: open = false) {
430
+ $slot
431
+ }
432
+ }
433
+ }
434
+ }
435
+
436
+ -- Renders the notifications created with toast(). Place it once, for example at the end of a layout.
437
+ component Toaster(str position = "bottom-end") {
438
+ Div(class: ["ui-toaster", "ui-toaster--" + position], role: "region", ariaLabel: "Notifications", ariaLive: "polite") {
439
+ for t in toasts key t.id {
440
+ Div(class: ["ui-toast", "ui-toast--" + t.tone], role: t.tone == "danger" ? "alert" : "status") {
441
+ Span(class: "ui-toast__message") { t.message }
442
+ Button(class: "ui-toast__close", ariaLabel: "Dismiss", onClick: dismissToast(t.id)) { "×" }
443
+ }
444
+ }
445
+ }
446
+ }
447
+
448
+ component Kbd() {
449
+ Kbd(class: "ui-kbd") {
450
+ $slot
451
+ }
452
+ }
453
+
135
454
  component Avatar(str name, str? src, str size = "2.5rem") {
136
455
  if src {
137
456
  Img(class: "ui-avatar", src: src, alt: name, style: { width: size, height: size })
138
457
  } else {
139
- Span(class: "ui-avatar ui-avatar--initials", title: name, style: { width: size, height: size }) {
458
+ Span(class: "ui-avatar ui-avatar--initials", role: "img", ariaLabel: name, title: name, style: { width: size, height: size }) {
140
459
  name.split(" ").map((part) => part.slice(0, 1)).join("").slice(0, 2).toUpperCase()
141
460
  }
142
461
  }
@@ -203,6 +522,10 @@ style global {
203
522
  --ui-accent: "#c084fc"
204
523
  --ui-accent-hover: "#d8b4fe"
205
524
  --ui-accent-text: "#0a0a0b"
525
+ --ui-success: "#4ade80"
526
+ --ui-warning: "#fbbf24"
527
+ --ui-danger: "#f87171"
528
+ --ui-info: "#60a5fa"
206
529
  --ui-shadow: "0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35)"
207
530
  }
208
531
  }
@@ -234,6 +557,7 @@ style global {
234
557
  transition: "background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.05s"
235
558
  &:active { transform: "translateY(1px)" }
236
559
  &:disabled, &[aria-disabled="true"] { opacity: "0.5"; cursor: "not-allowed"; pointerEvents: "none" }
560
+ &[aria-busy="true"] { opacity: "0.8"; cursor: "progress" }
237
561
  }
238
562
  .ui-btn--sm { padding: "0.375rem 0.75rem"; fontSize: "0.875rem" }
239
563
  .ui-btn--md { padding: "0.625rem 1.125rem"; fontSize: "0.95rem" }
@@ -312,6 +636,7 @@ style global {
312
636
  background: "var(--ui-bg)"
313
637
  transition: "border-color 0.15s, box-shadow 0.15s"
314
638
  &:focus { outline: "none"; borderColor: "var(--ui-accent)"; boxShadow: "0 0 0 3px color-mix(in srgb, var(--ui-accent) 25%, transparent)" }
639
+ &:disabled { opacity: "0.6"; cursor: "not-allowed" }
315
640
  }
316
641
  textarea.ui-field__control { minHeight: "6rem"; resize: "vertical" }
317
642
  .ui-field--invalid .ui-field__control { borderColor: "var(--ui-danger)" }
@@ -319,6 +644,7 @@ style global {
319
644
  .ui-field__error { color: "var(--ui-danger)"; fontSize: "0.85rem" }
320
645
 
321
646
  .ui-toggle { display: "inline-flex"; alignItems: "center"; gap: "0.6rem"; cursor: "pointer"; position: "relative" }
647
+ .ui-toggle--disabled { opacity: "0.55"; cursor: "not-allowed" }
322
648
  .ui-toggle__input { position: "absolute"; opacity: "0"; width: "1px"; height: "1px" }
323
649
  .ui-toggle__track {
324
650
  width: "2.5rem"
@@ -368,10 +694,11 @@ style global {
368
694
  gap: "1rem"
369
695
  maxHeight: "90vh"
370
696
  overflow: "auto"
697
+ &:focus { outline: "none" }
371
698
  }
372
699
  .ui-modal__header { display: "flex"; alignItems: "center"; justifyContent: "space-between"; gap: "1rem" }
373
700
  .ui-modal__title { margin: "0"; fontSize: "1.2rem" }
374
- .ui-modal__close {
701
+ .ui-modal__close, .ui-toast__close {
375
702
  border: "0"
376
703
  background: "transparent"
377
704
  color: "var(--ui-muted)"
@@ -381,10 +708,190 @@ style global {
381
708
  padding: "0.25rem 0.5rem"
382
709
  borderRadius: "var(--ui-radius)"
383
710
  marginLeft: "auto"
384
- &:hover { background: "var(--ui-surface)"; color: "var(--ui-text)" }
711
+ &:hover { background: "var(--ui-surface-2)"; color: "var(--ui-text)" }
385
712
  }
386
713
  .ui-fade-enter, .ui-fade-leave { opacity: "0" }
387
714
 
715
+ .ui-tabs__list { display: "flex"; gap: "0.25rem"; borderBottom: "1px solid var(--ui-border)"; overflowX: "auto" }
716
+ .ui-tabs__tab {
717
+ font: "inherit"
718
+ fontWeight: "500"
719
+ color: "var(--ui-muted)"
720
+ background: "transparent"
721
+ border: "0"
722
+ borderBottom: "2px solid transparent"
723
+ padding: "0.6rem 0.9rem"
724
+ marginBottom: "-1px"
725
+ cursor: "pointer"
726
+ whiteSpace: "nowrap"
727
+ &:hover { color: "var(--ui-text)" }
728
+ &[aria-selected="true"] { color: "var(--ui-text)"; borderBottomColor: "var(--ui-accent)" }
729
+ }
730
+ .ui-tabs__panel { paddingTop: "1rem" }
731
+ .ui-tabs__panel > * { display: "none" }
732
+ .ui-tabs__panel[data-selected="0"] > :nth-child(1) { display: "block" }
733
+ .ui-tabs__panel[data-selected="1"] > :nth-child(2) { display: "block" }
734
+ .ui-tabs__panel[data-selected="2"] > :nth-child(3) { display: "block" }
735
+ .ui-tabs__panel[data-selected="3"] > :nth-child(4) { display: "block" }
736
+ .ui-tabs__panel[data-selected="4"] > :nth-child(5) { display: "block" }
737
+ .ui-tabs__panel[data-selected="5"] > :nth-child(6) { display: "block" }
738
+ .ui-tabs__panel[data-selected="6"] > :nth-child(7) { display: "block" }
739
+ .ui-tabs__panel[data-selected="7"] > :nth-child(8) { display: "block" }
740
+
741
+ .ui-accordion { borderBottom: "1px solid var(--ui-border)" }
742
+ .ui-accordion__summary {
743
+ cursor: "pointer"
744
+ padding: "0.85rem 0"
745
+ fontWeight: "600"
746
+ listStyle: "none"
747
+ display: "flex"
748
+ justifyContent: "space-between"
749
+ &::-webkit-details-marker { display: "none" }
750
+ &::after { content: "'+'"; color: "var(--ui-muted)"; fontWeight: "400" }
751
+ }
752
+ .ui-accordion[open] > .ui-accordion__summary::after { content: "'−'" }
753
+ .ui-accordion__body { paddingBottom: "1rem" }
754
+
755
+ .ui-tooltip { position: "relative"; display: "inline-flex" }
756
+ .ui-tooltip__bubble {
757
+ position: "absolute"
758
+ left: "50%"
759
+ bottom: "calc(100% + 6px)"
760
+ transform: "translateX(-50%)"
761
+ background: "var(--ui-text)"
762
+ color: "var(--ui-bg)"
763
+ fontSize: "0.8rem"
764
+ lineHeight: "1.3"
765
+ padding: "0.35rem 0.55rem"
766
+ borderRadius: "6px"
767
+ whiteSpace: "nowrap"
768
+ pointerEvents: "none"
769
+ opacity: "0"
770
+ visibility: "hidden"
771
+ transition: "opacity 0.12s"
772
+ zIndex: "50"
773
+ }
774
+ .ui-tooltip--bottom .ui-tooltip__bubble { bottom: "auto"; top: "calc(100% + 6px)" }
775
+ .ui-tooltip:hover .ui-tooltip__bubble, .ui-tooltip:focus-within .ui-tooltip__bubble { opacity: "1"; visibility: "visible" }
776
+
777
+ .ui-table__wrap { overflowX: "auto"; border: "1px solid var(--ui-border)"; borderRadius: "var(--ui-radius)" }
778
+ .ui-table { width: "100%"; borderCollapse: "collapse"; fontSize: "0.92rem" }
779
+ .ui-table th, .ui-table td { padding: "0.6rem 0.85rem"; textAlign: "start"; borderBottom: "1px solid var(--ui-border)" }
780
+ .ui-table th { background: "var(--ui-surface)"; fontWeight: "600"; whiteSpace: "nowrap" }
781
+ .ui-table tbody tr:last-child td { borderBottom: "0" }
782
+ .ui-table--striped tbody tr:nth-child(even) td { background: "color-mix(in srgb, var(--ui-surface) 60%, transparent)" }
783
+ .ui-table__num { textAlign: "end"; fontVariantNumeric: "tabular-nums" }
784
+ .ui-table th.ui-table__num { textAlign: "end" }
785
+ .ui-table__caption { captionSide: "top"; textAlign: "start"; padding: "0.6rem 0.85rem"; fontWeight: "600" }
786
+ .ui-table__sort { font: "inherit"; color: "inherit"; background: "none"; border: "0"; padding: "0"; cursor: "pointer" }
787
+ .ui-table__arrow { color: "var(--ui-muted)"; fontSize: "0.75em" }
788
+ .ui-table__empty { textAlign: "center"; color: "var(--ui-muted)"; padding: "1.5rem" }
789
+
790
+ .ui-pagination { display: "flex"; alignItems: "center"; gap: "0.25rem"; flexWrap: "wrap" }
791
+ .ui-pagination__item {
792
+ font: "inherit"
793
+ minWidth: "2.25rem"
794
+ height: "2.25rem"
795
+ padding: "0 0.5rem"
796
+ borderRadius: "var(--ui-radius)"
797
+ border: "1px solid var(--ui-border)"
798
+ background: "var(--ui-bg)"
799
+ color: "var(--ui-text)"
800
+ cursor: "pointer"
801
+ &:hover { background: "var(--ui-surface)" }
802
+ &:disabled { opacity: "0.45"; cursor: "not-allowed" }
803
+ &[aria-current="page"] { background: "var(--ui-accent)"; borderColor: "var(--ui-accent)"; color: "var(--ui-accent-text)" }
804
+ }
805
+ .ui-pagination__gap { color: "var(--ui-muted)"; padding: "0 0.25rem" }
806
+
807
+ .ui-breadcrumbs ol { display: "flex"; flexWrap: "wrap"; gap: "0.4rem"; listStyle: "none"; margin: "0"; padding: "0"; fontSize: "0.9rem" }
808
+ .ui-breadcrumbs li { display: "flex"; gap: "0.4rem"; color: "var(--ui-muted)" }
809
+ .ui-breadcrumbs li + li::before { content: "'/'"; color: "var(--ui-border)" }
810
+ .ui-breadcrumbs a { color: "var(--ui-muted)"; textDecoration: "none" }
811
+ .ui-breadcrumbs a:hover { color: "var(--ui-text)" }
812
+ .ui-breadcrumbs [aria-current] { color: "var(--ui-text)"; fontWeight: "500" }
813
+
814
+ .ui-progress { height: "0.5rem"; background: "var(--ui-surface-2)"; borderRadius: "999px"; overflow: "hidden" }
815
+ .ui-progress__bar { height: "100%"; background: "var(--ui-accent)"; borderRadius: "inherit"; transition: "width 0.2s" }
816
+ .ui-progress--indeterminate .ui-progress__bar { animation: "ui-indeterminate 1.2s ease-in-out infinite" }
817
+ @keyframes ui-indeterminate { from { transform: "translateX(-100%)" } to { transform: "translateX(250%)" } }
818
+
819
+ .ui-skeleton {
820
+ display: "block"
821
+ background: "linear-gradient(90deg, var(--ui-surface-2) 25%, var(--ui-surface) 50%, var(--ui-surface-2) 75%)"
822
+ backgroundSize: "200% 100%"
823
+ animation: "ui-shimmer 1.4s linear infinite"
824
+ }
825
+ @keyframes ui-shimmer { from { backgroundPosition: "200% 0" } to { backgroundPosition: "-200% 0" } }
826
+
827
+ .ui-empty { display: "flex"; flexDirection: "column"; alignItems: "center"; gap: "0.5rem"; textAlign: "center"; padding: "2.5rem 1rem"; border: "1px dashed var(--ui-border)"; borderRadius: "var(--ui-radius-lg)" }
828
+ .ui-empty__title { fontSize: "1.05rem" }
829
+ .ui-empty__description { margin: "0"; color: "var(--ui-muted)"; maxWidth: "36rem" }
830
+
831
+ .ui-dropdown { position: "relative"; display: "inline-block" }
832
+ .ui-dropdown__caret { fontSize: "0.8em"; opacity: "0.7" }
833
+ .ui-dropdown__menu {
834
+ position: "absolute"
835
+ top: "calc(100% + 4px)"
836
+ left: "0"
837
+ minWidth: "12rem"
838
+ zIndex: "60"
839
+ display: "flex"
840
+ flexDirection: "column"
841
+ padding: "0.3rem"
842
+ background: "var(--ui-bg)"
843
+ border: "1px solid var(--ui-border)"
844
+ borderRadius: "var(--ui-radius)"
845
+ boxShadow: "var(--ui-shadow)"
846
+ }
847
+ .ui-dropdown__menu--end { left: "auto"; right: "0" }
848
+ .ui-dropdown__menu > a, .ui-dropdown__menu > button {
849
+ font: "inherit"
850
+ textAlign: "start"
851
+ color: "var(--ui-text)"
852
+ background: "none"
853
+ border: "0"
854
+ borderRadius: "6px"
855
+ padding: "0.45rem 0.65rem"
856
+ textDecoration: "none"
857
+ cursor: "pointer"
858
+ &:hover, &:focus-visible { background: "var(--ui-surface)"; outline: "none" }
859
+ }
860
+
861
+ .ui-toaster { position: "fixed"; zIndex: "1100"; display: "flex"; flexDirection: "column"; gap: "0.5rem"; padding: "1rem"; maxWidth: "min(26rem, 100vw)"; pointerEvents: "none" }
862
+ .ui-toaster--bottom-end { right: "0"; bottom: "0" }
863
+ .ui-toaster--bottom-start { left: "0"; bottom: "0" }
864
+ .ui-toaster--top-end { right: "0"; top: "0" }
865
+ .ui-toaster--top-start { left: "0"; top: "0" }
866
+ .ui-toast {
867
+ pointerEvents: "auto"
868
+ display: "flex"
869
+ alignItems: "center"
870
+ gap: "0.75rem"
871
+ padding: "0.7rem 0.6rem 0.7rem 1rem"
872
+ background: "var(--ui-bg)"
873
+ border: "1px solid var(--ui-border)"
874
+ borderLeft: "4px solid var(--ui-info)"
875
+ borderRadius: "var(--ui-radius)"
876
+ boxShadow: "var(--ui-shadow)"
877
+ animation: "ui-toast-in 0.18s ease-out"
878
+ }
879
+ .ui-toast--success { borderLeftColor: "var(--ui-success)" }
880
+ .ui-toast--warning { borderLeftColor: "var(--ui-warning)" }
881
+ .ui-toast--danger { borderLeftColor: "var(--ui-danger)" }
882
+ .ui-toast__close { fontSize: "1.2rem" }
883
+ @keyframes ui-toast-in { from { opacity: "0"; transform: "translateY(6px)" } }
884
+
885
+ .ui-kbd {
886
+ fontFamily: "var(--ui-mono)"
887
+ fontSize: "0.8em"
888
+ padding: "0.1rem 0.4rem"
889
+ border: "1px solid var(--ui-border)"
890
+ borderBottomWidth: "2px"
891
+ borderRadius: "5px"
892
+ background: "var(--ui-surface)"
893
+ }
894
+
388
895
  .ui-avatar { borderRadius: "50%"; objectFit: "cover"; flexShrink: "0" }
389
896
  .ui-avatar--initials {
390
897
  display: "inline-flex"
@@ -403,10 +910,12 @@ style global {
403
910
  borderTopColor: "var(--ui-accent)"
404
911
  animation: "ui-spin 0.7s linear infinite"
405
912
  }
913
+ .ui-spinner--inline { width: "1em"; height: "1em"; borderColor: "currentColor"; borderTopColor: "transparent" }
406
914
  @keyframes ui-spin { to { transform: "rotate(360deg)" } }
407
915
  reducedMotion {
408
916
  .ui-spinner { animationDuration: "2s" }
409
- .ui-btn, .ui-card--interactive, .ui-modal { transition: "none" }
917
+ .ui-skeleton, .ui-progress--indeterminate .ui-progress__bar, .ui-toast { animation: "none" }
918
+ .ui-btn, .ui-card--interactive, .ui-modal, .ui-progress__bar { transition: "none" }
410
919
  }
411
920
 
412
921
  .ui-navbar {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yannosay/sinth",
3
- "version": "5.3.3",
3
+ "version": "5.3.4",
4
4
  "description": "A compiled, type-checked language for websites and web apps: reactive components, file-based routing with instant navigation, prerendered pages, API routes and one-command deploys.",
5
5
  "author": "Yannosay Productions",
6
6
  "license": "AGPL-3.0",