staffa 0.6.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 (48) hide show
  1. package/README.md +2 -0
  2. package/package.json +3 -2
  3. package/skill/Attributes.md +10 -0
  4. package/skill/AutocompleteOptions.md +37 -0
  5. package/skill/BoxOptions.md +33 -0
  6. package/skill/ButtonChooserOptions.md +37 -0
  7. package/skill/ButtonGroupOptions.md +23 -0
  8. package/skill/ButtonOptions.md +57 -0
  9. package/skill/CheckboxOptions.md +27 -0
  10. package/skill/ContentOptions.md +16 -0
  11. package/skill/DialogOptions.md +70 -0
  12. package/skill/FieldOptions.md +63 -0
  13. package/skill/FloatingMenuOptions.md +21 -0
  14. package/skill/FormOptions.md +31 -0
  15. package/skill/MainOptions.md +91 -0
  16. package/skill/MenuItem.md +52 -0
  17. package/skill/MenuOptions.md +25 -0
  18. package/skill/SKILL.md +548 -0
  19. package/skill/SelectOptions.md +21 -0
  20. package/skill/Slot.md +13 -0
  21. package/skill/Tab.md +33 -0
  22. package/skill/TabsOptions.md +28 -0
  23. package/skill/TextareaOptions.md +51 -0
  24. package/skill/TextlineOptions.md +45 -0
  25. package/skill/TextlineType.md +18 -0
  26. package/skill/ToastOptions.md +40 -0
  27. package/skill/TooltipOptions.md +22 -0
  28. package/skill/addTooltip.md +25 -0
  29. package/skill/alert.md +17 -0
  30. package/skill/autocomplete.md +22 -0
  31. package/skill/box.md +25 -0
  32. package/skill/button.md +29 -0
  33. package/skill/buttonChooser.md +23 -0
  34. package/skill/buttonGroup.md +20 -0
  35. package/skill/checkbox.md +17 -0
  36. package/skill/confirm.md +17 -0
  37. package/skill/dialog.md +28 -0
  38. package/skill/form.md +28 -0
  39. package/skill/getDarkMode.md +12 -0
  40. package/skill/main.md +33 -0
  41. package/skill/menuButton.md +27 -0
  42. package/skill/prompt.md +19 -0
  43. package/skill/select.md +17 -0
  44. package/skill/showFloatingMenu.md +22 -0
  45. package/skill/tabs.md +19 -0
  46. package/skill/textarea.md +16 -0
  47. package/skill/textline.md +19 -0
  48. package/skill/toast.md +20 -0
package/README.md CHANGED
@@ -285,6 +285,8 @@ ln -s ../../node_modules/staffa/skill .claude/skills/staffa
285
285
 
286
286
  ## Breaking changes
287
287
 
288
+ - **0.6**: None.
289
+
288
290
  - **0.5**
289
291
  - Surfaces (`.s-s`) now apply `border-radius` and — for `.tonal` and `.outlined` variants — `border` automatically. Custom surfaces or components that previously set these manually may see doubled or conflicting styles; remove the manual declarations.
290
292
  - `border:0` is now applied to `.s-btn` by default (overriding the browser's 2px button border). Custom button-like components built on `.s-btn` that relied on the browser default border should add an explicit border.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "staffa",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "An opinionated component library for the Aberdeen reactive UI library.",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -20,7 +20,8 @@
20
20
  },
21
21
  "files": [
22
22
  "dist",
23
- "src"
23
+ "src",
24
+ "skill"
24
25
  ],
25
26
  "scripts": {
26
27
  "build:icons": "node scripts/generate-icons.mjs",
@@ -0,0 +1,10 @@
1
+ ## Attributes · type
2
+
3
+ Shared building blocks for the Staffa component library.
4
+
5
+ Every component in Staffa is "just an Aberdeen draw function": a plain function
6
+ that takes a single, strongly typed options object and emits DOM through
7
+ Aberdeen's `A` function. This module defines the option-type hierarchy
8
+ that all components build on, plus a couple of tiny helpers.
9
+
10
+ **Type:** `string`
@@ -0,0 +1,37 @@
1
+ ## AutocompleteOptions · interface
2
+
3
+ Options for `autocomplete`.
4
+
5
+ ### autocompleteOptions.options · member
6
+
7
+ The candidate options. May be a static array or a function returning one —
8
+ the function is called inside a reactive scope, so it can read proxied state
9
+ to provide dynamic/async suggestions.
10
+
11
+ **Type:** `AutocompleteOptionInput[] | (() => AutocompleteOptionInput[])`
12
+
13
+ ### autocompleteOptions.bind · member
14
+
15
+ Two-way binding for the selection. In single mode this is the selected
16
+ `value` string (`""` when empty). In `AutocompleteOptions.multi` mode
17
+ it is an array of value strings.
18
+
19
+ **Type:** `Bindable<string | string[]>`
20
+
21
+ ### autocompleteOptions.multi · member
22
+
23
+ Allow selecting several values, shown as removable chips.
24
+
25
+ **Type:** `boolean`
26
+
27
+ ### autocompleteOptions.allowCustom · member
28
+
29
+ Allow committing free text that isn't in the options list. Defaults to `true`.
30
+
31
+ **Type:** `boolean`
32
+
33
+ ### autocompleteOptions.placeholder · member
34
+
35
+ Placeholder for the text input.
36
+
37
+ **Type:** `string`
@@ -0,0 +1,33 @@
1
+ ## BoxOptions · interface
2
+
3
+ Options for `box`.
4
+
5
+ ### boxOptions.header · member
6
+
7
+ Header content, drawn in a styled bar above the body.
8
+
9
+ **Type:** `Slot`
10
+
11
+ ### boxOptions.footer · member
12
+
13
+ Footer content, drawn in a styled bar below the body.
14
+
15
+ **Type:** `Slot`
16
+
17
+ ### boxOptions.contentAttrs · member
18
+
19
+ Aberdeen attr/style string applied to the body (content-holding) element.
20
+
21
+ **Type:** `string`
22
+
23
+ ### boxOptions.headerAttrs · member
24
+
25
+ Aberdeen attr/style string applied to the header bar.
26
+
27
+ **Type:** `string`
28
+
29
+ ### boxOptions.footerAttrs · member
30
+
31
+ Aberdeen attr/style string applied to the footer bar.
32
+
33
+ **Type:** `string`
@@ -0,0 +1,37 @@
1
+ ## ButtonChooserOptions · interface
2
+
3
+ Options for `buttonChooser`.
4
+
5
+ ### buttonChooserOptions.attrs · member
6
+
7
+ Aberdeen attr/style string applied to the button group.
8
+
9
+ **Type:** `string`
10
+
11
+ ### buttonChooserOptions.options · member
12
+
13
+ The options to display, as a plain object mapping id → display label.
14
+ Buttons appear in insertion order. A label may be a plain (rich-text)
15
+ string, or a draw-function for custom content such as an icon.
16
+
17
+ **Type:** `Record<string, Slot>`
18
+
19
+ ### buttonChooserOptions.bind · member
20
+
21
+ Two-way binding for the selected id, or `undefined` when nothing is selected.
22
+ Use an `A.proxy` or `A.ref`.
23
+
24
+ **Type:** `Bindable<string>`
25
+
26
+ ### buttonChooserOptions.allowDeselect · member
27
+
28
+ When `true`, clicking the already-selected button deselects it, setting
29
+ `bind.value` to `undefined`. Useful for "none / auto" states.
30
+
31
+ **Type:** `boolean`
32
+
33
+ ### buttonChooserOptions.name · member
34
+
35
+ Name attribute for the hidden `<input>`, enabling form submission.
36
+
37
+ **Type:** `string`
@@ -0,0 +1,23 @@
1
+ ## ButtonGroupOptions · interface
2
+
3
+ Options for `buttonGroup`.
4
+
5
+ ### buttonGroupOptions.buttons · member
6
+
7
+ Declarative list of buttons. Rendered in order. Alternatively (or
8
+ additionally) draw buttons yourself via `ContentOptions.content`.
9
+
10
+ **Type:** `ButtonOptions[]`
11
+
12
+ ### buttonGroupOptions.layout · member
13
+
14
+ `"attached"` (default) joins the buttons into a single segmented control
15
+ with shared borders; `"spaced"` lays them out with a normal gap.
16
+
17
+ **Type:** `"attached" | "spaced"`
18
+
19
+ ### buttonGroupOptions.vertical · member
20
+
21
+ Stack vertically instead of horizontally.
22
+
23
+ **Type:** `boolean`
@@ -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`