staffa 0.5.0 → 0.6.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 (62) hide show
  1. package/README.md +6 -0
  2. package/dist/components/button.js +1 -2
  3. package/dist/components/checkbox.js +1 -1
  4. package/dist/components/field.js +0 -1
  5. package/dist/components/tabs.js +0 -1
  6. package/dist/components/toast.d.ts +2 -2
  7. package/dist/components/toast.js +42 -16
  8. package/dist/staffa.esm.js +1 -1
  9. package/dist/theme.js +10 -3
  10. package/package.json +5 -4
  11. package/skill/Attributes.md +10 -0
  12. package/skill/AutocompleteOptions.md +37 -0
  13. package/skill/BoxOptions.md +33 -0
  14. package/skill/ButtonChooserOptions.md +37 -0
  15. package/skill/ButtonGroupOptions.md +23 -0
  16. package/skill/ButtonOptions.md +57 -0
  17. package/skill/CheckboxOptions.md +27 -0
  18. package/skill/ContentOptions.md +16 -0
  19. package/skill/DialogOptions.md +70 -0
  20. package/skill/FieldOptions.md +63 -0
  21. package/skill/FloatingMenuOptions.md +21 -0
  22. package/skill/FormOptions.md +31 -0
  23. package/skill/MainOptions.md +91 -0
  24. package/skill/MenuItem.md +52 -0
  25. package/skill/MenuOptions.md +25 -0
  26. package/skill/SKILL.md +548 -0
  27. package/skill/SelectOptions.md +21 -0
  28. package/skill/Slot.md +13 -0
  29. package/skill/Tab.md +33 -0
  30. package/skill/TabsOptions.md +28 -0
  31. package/skill/TextareaOptions.md +51 -0
  32. package/skill/TextlineOptions.md +45 -0
  33. package/skill/TextlineType.md +18 -0
  34. package/skill/ToastOptions.md +40 -0
  35. package/skill/TooltipOptions.md +22 -0
  36. package/skill/addTooltip.md +25 -0
  37. package/skill/alert.md +17 -0
  38. package/skill/autocomplete.md +22 -0
  39. package/skill/box.md +25 -0
  40. package/skill/button.md +29 -0
  41. package/skill/buttonChooser.md +23 -0
  42. package/skill/buttonGroup.md +20 -0
  43. package/skill/checkbox.md +17 -0
  44. package/skill/confirm.md +17 -0
  45. package/skill/dialog.md +28 -0
  46. package/skill/form.md +28 -0
  47. package/skill/getDarkMode.md +12 -0
  48. package/skill/main.md +33 -0
  49. package/skill/menuButton.md +27 -0
  50. package/skill/prompt.md +19 -0
  51. package/skill/select.md +17 -0
  52. package/skill/showFloatingMenu.md +22 -0
  53. package/skill/tabs.md +19 -0
  54. package/skill/textarea.md +16 -0
  55. package/skill/textline.md +19 -0
  56. package/skill/toast.md +20 -0
  57. package/src/components/button.ts +1 -2
  58. package/src/components/checkbox.ts +1 -1
  59. package/src/components/field.ts +1 -2
  60. package/src/components/tabs.ts +1 -2
  61. package/src/components/toast.ts +48 -18
  62. package/src/theme.ts +10 -0
@@ -0,0 +1,57 @@
1
+ ## ButtonOptions · interface
2
+
3
+ Options for `button`.
4
+
5
+ ### buttonOptions.content · member
6
+
7
+ Button content: a string for plain text, or a function for custom markup.
8
+
9
+ **Type:** `Slot`
10
+
11
+ ### buttonOptions.icon · member
12
+
13
+ Leading icon/adornment, drawn before the label.
14
+
15
+ **Type:** `Slot`
16
+
17
+ ### buttonOptions.click · member
18
+
19
+ Click handler.
20
+
21
+ **Type:** `(event: Event) => void`
22
+
23
+ ### buttonOptions.disabled · member
24
+
25
+ Disables the button.
26
+
27
+ **Type:** `boolean`
28
+
29
+ ### buttonOptions.type · member
30
+
31
+ Native button behaviour. Defaults to `"button"`.
32
+
33
+ **Type:** `"button" | "submit" | "reset"`
34
+
35
+ ### buttonOptions.href · member
36
+
37
+ Render as a link (`<a role=button>`) pointing here instead of a `<button>`.
38
+
39
+ **Type:** `string`
40
+
41
+ ### buttonOptions.ariaLabel · member
42
+
43
+ Accessible label, when the button has only an icon.
44
+
45
+ **Type:** `string`
46
+
47
+ ### buttonOptions.attrs · member
48
+
49
+ Aberdeen attr/style string applied to the button. A button is a surface, so
50
+ pass surface modifier classes here to restyle it, e.g. `".danger"`,
51
+ `".neutral .outlined"`. Defaults to a filled `.primary` surface.
52
+
53
+ Size is set here too, with `.small` or `.large` (medium is the default and
54
+ needs no class), e.g. `".danger .small"`. A `.small`/`.large` parent (such
55
+ as a `buttonGroup`) also sizes its buttons, so you can set it once.
56
+
57
+ **Type:** `string`
@@ -0,0 +1,27 @@
1
+ ## CheckboxOptions · interface
2
+
3
+ Options for `checkbox`.
4
+
5
+ ### checkboxOptions.label · member
6
+
7
+ The label shown next to the box. Required for a meaningful checkbox.
8
+
9
+ **Type:** `Slot`
10
+
11
+ ### checkboxOptions.bind · member
12
+
13
+ Two-way binding target holding a boolean.
14
+
15
+ **Type:** `Bindable<boolean>`
16
+
17
+ ### checkboxOptions.checked · member
18
+
19
+ Static initial checked state.
20
+
21
+ **Type:** `boolean`
22
+
23
+ ### checkboxOptions.change · member
24
+
25
+ Fired on `change` with the native event.
26
+
27
+ **Type:** `(event: Event) => void`
@@ -0,0 +1,16 @@
1
+ ## ContentOptions · interface
2
+
3
+ Options for components that wrap a single block of caller-provided content,
4
+ with an `attrs` escape hatch on the outermost element.
5
+
6
+ ### contentOptions.attrs · member
7
+
8
+ Aberdeen attr/style string applied to the widget's outermost element.
9
+
10
+ **Type:** `string`
11
+
12
+ ### contentOptions.content · member
13
+
14
+ Draws the children of this component. A string is rendered as rich text.
15
+
16
+ **Type:** `Slot<[]>`
@@ -0,0 +1,70 @@
1
+ ## DialogOptions · interface
2
+
3
+ Options for `dialog`.
4
+
5
+ ### dialogOptions.header · member
6
+
7
+ Slot rendered in the styled header bar.
8
+
9
+ **Type:** `Slot`
10
+
11
+ ### dialogOptions.footer · member
12
+
13
+ Slot rendered in the styled footer bar.
14
+
15
+ **Type:** `Slot`
16
+
17
+ ### dialogOptions.attrs · member
18
+
19
+ Aberdeen attr/style string applied to the dialog panel. A surface — pass modifier classes (e.g. `".warning"`) to recolour it.
20
+
21
+ **Type:** `string`
22
+
23
+ ### dialogOptions.headerAttrs · member
24
+
25
+ Aberdeen attr/style string applied to the header bar.
26
+
27
+ **Type:** `string`
28
+
29
+ ### dialogOptions.footerAttrs · member
30
+
31
+ Aberdeen attr/style string applied to the footer bar.
32
+
33
+ **Type:** `string`
34
+
35
+ ### dialogOptions.contentAttrs · member
36
+
37
+ Aberdeen attr/style string applied to the scrollable content `<div>`.
38
+
39
+ **Type:** `string`
40
+
41
+ ### dialogOptions.allowCancel · member
42
+
43
+ Allow closing via Esc or clicking the backdrop. Defaults to `true`.
44
+ May be changed on a proxied options object while the dialog is open
45
+ (e.g. lock when form data is dirty).
46
+
47
+ **Type:** `boolean`
48
+
49
+ ### dialogOptions.cancelWithScope · member
50
+
51
+ When set to `true` (default) the model will be destroyed when the `dialog()`-calling
52
+ scope is destroyed.
53
+
54
+ **Type:** `boolean`
55
+
56
+ ### dialogOptions.content · member
57
+
58
+ Dialog body. A `Slot` whose draw-function receives a `close()` function
59
+ — call it to dismiss the dialog programmatically. (A plain string renders as
60
+ rich text.)
61
+
62
+ **Type:** `Slot<[close: () => void]>`
63
+
64
+ ### dialogOptions.onClose · member
65
+
66
+ Called when the dialog closes for any reason (explicit `close()`, Esc, or
67
+ backdrop click). Useful when you want a side-effect on close but don't need
68
+ the Promise returned by `dialog`.
69
+
70
+ **Type:** `() => void`
@@ -0,0 +1,63 @@
1
+ ## FieldOptions · interface
2
+
3
+ Options shared by all *form field* components (textline, textarea, checkbox,
4
+ autocomplete, ...).
5
+
6
+ Fields share a consistent vertical layout: an optional label, the control
7
+ itself, and optional help/error text below it. `form` relies on this
8
+ shared structure to align groups of fields.
9
+
10
+ ### fieldOptions.attrs · member
11
+
12
+ Aberdeen attr/style string applied to the field's wrapper element.
13
+
14
+ **Type:** `string`
15
+
16
+ ### fieldOptions.label · member
17
+
18
+ Visible label, associated with the control via `for`/`id` for a11y.
19
+
20
+ **Type:** `Slot`
21
+
22
+ ### fieldOptions.help · member
23
+
24
+ Helper text shown beneath the control.
25
+
26
+ **Type:** `Slot`
27
+
28
+ ### fieldOptions.error · member
29
+
30
+ Error message shown beneath the control. When set, the control is marked
31
+ `aria-invalid` and styled accordingly. May be reactive.
32
+
33
+ **Type:** `string`
34
+
35
+ ### fieldOptions.disabled · member
36
+
37
+ Disables the control.
38
+
39
+ **Type:** `boolean`
40
+
41
+ ### fieldOptions.required · member
42
+
43
+ Marks the field required (adds a `*` and the `aria-required` attribute).
44
+
45
+ **Type:** `boolean`
46
+
47
+ ### fieldOptions.name · member
48
+
49
+ The `name` attribute, for native form submission.
50
+
51
+ **Type:** `string`
52
+
53
+ ### fieldOptions.id · member
54
+
55
+ Explicit id for the control; auto-generated when omitted.
56
+
57
+ **Type:** `string`
58
+
59
+ ### fieldOptions.inputAttrs · member
60
+
61
+ Aberdeen attr/style string applied to the control (input) element itself.
62
+
63
+ **Type:** `string`
@@ -0,0 +1,21 @@
1
+ ## FloatingMenuOptions · interface
2
+
3
+ Options for `showFloatingMenu`.
4
+
5
+ ### floatingMenuOptions.items · member
6
+
7
+ Items to show.
8
+
9
+ **Type:** `MenuEntry[]`
10
+
11
+ ### floatingMenuOptions.anchor · member
12
+
13
+ Element to anchor the menu to (positioned just below it, flips up if needed).
14
+
15
+ **Type:** `HTMLElement`
16
+
17
+ ### floatingMenuOptions.dropdownAttrs · member
18
+
19
+ Aberdeen attr/style string on the floating panel.
20
+
21
+ **Type:** `string`
@@ -0,0 +1,31 @@
1
+ ## FormOptions · interface
2
+
3
+ Options for `form`.
4
+
5
+ ### formOptions.submit · member
6
+
7
+ Submit handler. Called with collected form data (keyed by each field's
8
+ `name`) and the original event. `preventDefault()` is already called.
9
+ Multi-value fields (e.g. multi-select) produce a `string[]`.
10
+
11
+ **Type:** `(data: Record<string, string | string[]>, event: SubmitEvent) => void`
12
+
13
+ ### formOptions.layout · member
14
+
15
+ Layout of fields. `"stacked"` (default) is a single column; `"grid"` packs
16
+ fields into a responsive multi-column grid. A field can span the full grid
17
+ width by adding the `.s-wide` class (e.g. `attrs: ".s-wide"`).
18
+
19
+ **Type:** `"stacked" | "grid"`
20
+
21
+ ### formOptions.actionsAttrs · member
22
+
23
+ Aberdeen attr/style string for the action bar.
24
+
25
+ **Type:** `string`
26
+
27
+ ### formOptions.actions · member
28
+
29
+ Footer actions (typically a ("./buttonGroup").buttonGroup or buttons).
30
+
31
+ **Type:** `Slot`
@@ -0,0 +1,91 @@
1
+ ## MainOptions · interface
2
+
3
+ Options for `main`.
4
+
5
+ ### mainOptions.attrs · member
6
+
7
+ Aberdeen attr/style string applied to the outermost shell element.
8
+
9
+ **Type:** `string`
10
+
11
+ ### mainOptions.title · member
12
+
13
+ App/page title shown in the top bar.
14
+
15
+ **Type:** `Slot`
16
+
17
+ ### mainOptions.subtitle · member
18
+
19
+ Secondary line under the title.
20
+
21
+ **Type:** `Slot`
22
+
23
+ ### mainOptions.icon · member
24
+
25
+ Leading icon/logo in the top bar.
26
+
27
+ **Type:** `Slot`
28
+
29
+ ### mainOptions.menu · member
30
+
31
+ Action area on the right of the top bar (buttons, menu, ...).
32
+
33
+ **Type:** `Slot`
34
+
35
+ ### mainOptions.content · member
36
+
37
+ The scrollable page content. A string is rendered as rich text.
38
+
39
+ **Type:** `Slot`
40
+
41
+ ### mainOptions.footer · member
42
+
43
+ Footer content, pinned below the scroll area.
44
+
45
+ **Type:** `Slot`
46
+
47
+ ### mainOptions.maxWidth · member
48
+
49
+ Max width for the page's *content*, e.g. `"60rem"`. The header and footer
50
+ backgrounds still span the full shell width, but their contents — and the
51
+ sidebar + separator + content trio (or just the content when there's no
52
+ sidebar) — cap to this width and centre horizontally. When unset, everything
53
+ fills the available width. Either way the content shares the page surface —
54
+ it is not boxed.
55
+
56
+ **Type:** `string`
57
+
58
+ ### mainOptions.contentAttrs · member
59
+
60
+ Aberdeen attr/style string applied to the content area.
61
+
62
+ **Type:** `string`
63
+
64
+ ### mainOptions.topbarAttrs · member
65
+
66
+ Aberdeen attr/style string applied to the top bar.
67
+
68
+ **Type:** `string`
69
+
70
+ ### mainOptions.nav · member
71
+
72
+ Navigation menu. When provided, renders a sidebar (in `"left"` / `"right"`
73
+ mode) or a button+dropdown (in `"button"` mode). The sidebar automatically
74
+ collapses to button mode when the shell is too narrow.
75
+
76
+ **Type:** `MenuOptions`
77
+
78
+ ### mainOptions.navPosition · member
79
+
80
+ Where to render the nav. Defaults to `"left"`.
81
+ - `"left"` / `"right"`: sidebar next to the content area; collapses to a
82
+ button+dropdown in the top bar when the shell width drops below 640 px.
83
+ - `"button"`: always a button+dropdown, never a sidebar.
84
+
85
+ **Type:** `"button" | "left" | "right"`
86
+
87
+ ### mainOptions.navAttrs · member
88
+
89
+ Aberdeen attr/style string applied to the sidebar nav panel.
90
+
91
+ **Type:** `string`
@@ -0,0 +1,52 @@
1
+ ## MenuItem · interface
2
+
3
+ A clickable item in a menu or sidebar nav.
4
+
5
+ **Tip:** set `href` and call Aberdeen's `interceptLinks()` once at app
6
+ startup for SPA-style navigation. When `href` is set, the item is
7
+ automatically highlighted as active whenever the current URL matches it
8
+ (via `matchCurrent`).
9
+
10
+ ### menuItem.label · member
11
+
12
+ Label text or draw function. Strings are rendered as rich text.
13
+
14
+ **Type:** `Slot`
15
+
16
+ ### menuItem.icon · member
17
+
18
+ Leading icon drawn before the label.
19
+
20
+ **Type:** `Slot`
21
+
22
+ ### menuItem.click · member
23
+
24
+ Click handler.
25
+
26
+ **Type:** `(e: Event) => void`
27
+
28
+ ### menuItem.href · member
29
+
30
+ Render as a link (`<a>`) pointing here. Pairs naturally with
31
+ `interceptLinks()` — the item is highlighted automatically when the URL
32
+ matches.
33
+
34
+ **Type:** `string`
35
+
36
+ ### menuItem.target · member
37
+
38
+ `target` for the link (`_blank`, etc.). Only meaningful with `href`.
39
+
40
+ **Type:** `string`
41
+
42
+ ### menuItem.disabled · member
43
+
44
+ Disables the item.
45
+
46
+ **Type:** `boolean`
47
+
48
+ ### menuItem.attrs · member
49
+
50
+ Aberdeen attr/style string on the item element.
51
+
52
+ **Type:** `string`
@@ -0,0 +1,25 @@
1
+ ## MenuOptions · interface
2
+
3
+ Options for `menuButton` and `MainOptions.nav`.
4
+
5
+ ### menuOptions.items · member
6
+
7
+ Items shown in the dropdown or sidebar nav.
8
+
9
+ **Type:** `MenuEntry[]`
10
+
11
+ ### menuOptions.button · member
12
+
13
+ Customize the trigger button rendered by `menuButton`. Defaults to a
14
+ `☰` icon button. The `click` handler is managed internally.
15
+
16
+ When used as a `nav` in `S.main()`, this also customizes the hamburger
17
+ button shown when the sidebar collapses.
18
+
19
+ **Type:** `ButtonOptions`
20
+
21
+ ### menuOptions.dropdownAttrs · member
22
+
23
+ Aberdeen attr/style string on the floating dropdown panel.
24
+
25
+ **Type:** `string`