@f-ewald/components 1.27.3 → 1.29.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.
- package/README.md +2 -0
- package/custom-elements.json +460 -9
- package/dist/fullscreen-button.d.ts +43 -0
- package/dist/fullscreen-button.d.ts.map +1 -0
- package/dist/fullscreen-button.js +172 -0
- package/dist/fullscreen-button.js.map +1 -0
- package/dist/icons.d.ts +1 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +1 -1
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/percent-bar-chart.d.ts.map +1 -1
- package/dist/percent-bar-chart.js +9 -2
- package/dist/percent-bar-chart.js.map +1 -1
- package/dist/radio-cards.d.ts +5 -1
- package/dist/radio-cards.d.ts.map +1 -1
- package/dist/radio-cards.js +19 -2
- package/dist/radio-cards.js.map +1 -1
- package/dist/scroll-dots.d.ts +54 -0
- package/dist/scroll-dots.d.ts.map +1 -0
- package/dist/scroll-dots.js +178 -0
- package/dist/scroll-dots.js.map +1 -0
- package/dist/scroll-to-bottom.d.ts +6 -0
- package/dist/scroll-to-bottom.d.ts.map +1 -1
- package/dist/scroll-to-bottom.js +31 -7
- package/dist/scroll-to-bottom.js.map +1 -1
- package/dist/scroll-to-top.d.ts +6 -0
- package/dist/scroll-to-top.d.ts.map +1 -1
- package/dist/scroll-to-top.js +31 -7
- package/dist/scroll-to-top.js.map +1 -1
- package/dist/timeline-container.d.ts +21 -5
- package/dist/timeline-container.d.ts.map +1 -1
- package/dist/timeline-container.js +35 -7
- package/dist/timeline-container.js.map +1 -1
- package/dist/timeline-entry.d.ts +32 -0
- package/dist/timeline-entry.d.ts.map +1 -1
- package/dist/timeline-entry.js +130 -3
- package/dist/timeline-entry.js.map +1 -1
- package/dist/tokens.css +4 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +11 -0
- package/dist/tokens.js.map +1 -1
- package/dist/ui-button.d.ts +24 -0
- package/dist/ui-button.d.ts.map +1 -1
- package/dist/ui-button.js +122 -1
- package/dist/ui-button.js.map +1 -1
- package/dist/weight-bar-chart.js +2 -2
- package/dist/weight-bar-chart.js.map +1 -1
- package/docs/design-language.md +19 -0
- package/docs/fullscreen-button.md +70 -0
- package/docs/icons.md +1 -1
- package/docs/radio-cards.md +6 -1
- package/docs/scroll-dots.md +65 -0
- package/docs/scroll-to-bottom.md +15 -0
- package/docs/scroll-to-top.md +15 -0
- package/docs/timeline-container.md +30 -6
- package/docs/timeline-entry.md +18 -0
- package/docs/ui-button.md +28 -0
- package/docs/weight-bar-chart.md +1 -0
- package/llms.txt +159 -16
- package/package.json +1 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# `<fullscreen-button>`
|
|
2
|
+
|
|
3
|
+
Toggles fullscreen presentation of the page, or of a given `target` element.
|
|
4
|
+
|
|
5
|
+
The icon and accessible name track the *actual* fullscreen state rather than
|
|
6
|
+
this button's own clicks, because fullscreen can be left without touching it
|
|
7
|
+
— Escape, or the browser's own chrome — which would otherwise leave the
|
|
8
|
+
button showing the wrong affordance.
|
|
9
|
+
|
|
10
|
+
The control is styled as a square icon-sized `ui-button` `secondary` variant
|
|
11
|
+
(2rem, `--ui-radius-sm` corners, the `--ui-button-secondary-*` background and
|
|
12
|
+
border tokens, so a gradient theme carries over) layered over an opaque
|
|
13
|
+
`--ui-surface` base and an elevation shadow, since it normally floats above
|
|
14
|
+
the content it expands.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import "@f-ewald/components/fullscreen-button.js";
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<fullscreen-button></fullscreen-button>
|
|
26
|
+
<script type="module">
|
|
27
|
+
const button = document.querySelector('fullscreen-button');
|
|
28
|
+
button.target = document.querySelector('#deck'); // omit for the whole page
|
|
29
|
+
button.addEventListener('fullscreen-change', (e) => console.log(e.detail.active));
|
|
30
|
+
</script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Attributes / properties
|
|
34
|
+
|
|
35
|
+
| Property | Attribute | Type | Default | Description |
|
|
36
|
+
| --- | --- | --- | --- | --- |
|
|
37
|
+
| `target` | _(JS property only)_ | `HTMLElement | null` | `null` | Element to present fullscreen; `null` (default) presents the whole page. |
|
|
38
|
+
| `enterLabel` | `enter-label` | `string` | `"Enter full screen"` | Accessible name while not fullscreen. |
|
|
39
|
+
| `exitLabel` | `exit-label` | `string` | `"Exit full screen"` | Accessible name while fullscreen. |
|
|
40
|
+
|
|
41
|
+
## Events
|
|
42
|
+
|
|
43
|
+
| Event | Description |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| `fullscreen-change` | The fullscreen state changed, from this button or otherwise (`detail: { active }`). |
|
|
46
|
+
|
|
47
|
+
## Slots
|
|
48
|
+
|
|
49
|
+
_None._
|
|
50
|
+
|
|
51
|
+
## CSS custom properties
|
|
52
|
+
|
|
53
|
+
| Custom property |
|
|
54
|
+
| --- |
|
|
55
|
+
| `--ui-border` |
|
|
56
|
+
| `--ui-button-highlight` |
|
|
57
|
+
| `--ui-button-secondary-` |
|
|
58
|
+
| `--ui-button-secondary-background` |
|
|
59
|
+
| `--ui-button-secondary-background-active` |
|
|
60
|
+
| `--ui-button-secondary-background-hover` |
|
|
61
|
+
| `--ui-button-secondary-border` |
|
|
62
|
+
| `--ui-button-secondary-border-hover` |
|
|
63
|
+
| `--ui-focus-ring` |
|
|
64
|
+
| `--ui-line-height-glyph` |
|
|
65
|
+
| `--ui-radius-sm` |
|
|
66
|
+
| `--ui-shadow` |
|
|
67
|
+
| `--ui-surface` |
|
|
68
|
+
| `--ui-surface-muted` |
|
|
69
|
+
| `--ui-text` |
|
|
70
|
+
| `--ui-text-muted` |
|
package/docs/icons.md
CHANGED
|
@@ -63,7 +63,7 @@ const icon = iconPencil(16); // 16px, defaults shown below if omitted
|
|
|
63
63
|
| `iconQueueList` | 16px | Queues, backlogs, or ordered work-item lists. |
|
|
64
64
|
| `iconShieldCheck` | 16px | Verified, secure, or trusted states. |
|
|
65
65
|
| `iconShieldExclamation` | 16px | Security warnings, or at-risk/compromised states. |
|
|
66
|
-
| `iconSparkles` | 16px |
|
|
66
|
+
| `iconSparkles` | 16px | An AI-powered action (pairs with ui-button's `ai` ring), a gradient-theme toggle, or a decorative/enhanced visual style. |
|
|
67
67
|
| `iconSpeakerWave` | 18px | An unmuted volume control, e.g. audio-player/video-player's mute toggle. |
|
|
68
68
|
| `iconSpeakerXMark` | 18px | A muted volume state; pair with iconSpeakerWave for the unmuted state. |
|
|
69
69
|
| `iconSquares2x2` | 18px | A grid or kanban-view toggle, or to represent card/tile layouts. |
|
package/docs/radio-cards.md
CHANGED
|
@@ -10,7 +10,11 @@ The selected card's border/radio dot read `--ui-button-accent` (a solid
|
|
|
10
10
|
stand-in, since `border-color`/`accent-color` can't render a gradient),
|
|
11
11
|
and its background reads the shared `--ui-button-secondary-surface-muted`
|
|
12
12
|
plus `--ui-button-highlight`, so a gradient theme tints it consistently
|
|
13
|
-
with `button-group`/`pagination-nav`'s equivalents.
|
|
13
|
+
with `button-group`/`pagination-nav`'s equivalents. That shared value is
|
|
14
|
+
tuned for small controls, so a card — with far more area — blends it 45%
|
|
15
|
+
toward `--ui-surface` rather than taking a second token: the tint stays
|
|
16
|
+
the same hue and gradient, just lighter on light themes (and
|
|
17
|
+
correspondingly deeper on dark ones) than on a button.
|
|
14
18
|
|
|
15
19
|
## Install
|
|
16
20
|
|
|
@@ -66,6 +70,7 @@ _None._
|
|
|
66
70
|
| `--ui-font-weight-semibold` |
|
|
67
71
|
| `--ui-primary` |
|
|
68
72
|
| `--ui-radius-sm` |
|
|
73
|
+
| `--ui-surface` |
|
|
69
74
|
| `--ui-surface-muted` |
|
|
70
75
|
| `--ui-text` |
|
|
71
76
|
| `--ui-text-muted` |
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# `<scroll-dots>`
|
|
2
|
+
|
|
3
|
+
Vertical section navigator for a long scrolled page or a slide deck: one dot
|
|
4
|
+
per section, the active one drawn as an elongated rounded bar rather than a
|
|
5
|
+
dot, which is the only cue needed to read position at a glance.
|
|
6
|
+
|
|
7
|
+
Controlled, like `pagination-nav`: it owns no scroll behavior and never
|
|
8
|
+
reads the scroll position. The consumer sets `active` and moves the page in
|
|
9
|
+
response to `dot-select` — what counts as the active section differs too much
|
|
10
|
+
between a snapped deck and an ordinary long page to bake in.
|
|
11
|
+
|
|
12
|
+
Positioning is also the consumer's, since a rail is normally fixed into a
|
|
13
|
+
reserved gutter that only the page knows the width of.
|
|
14
|
+
|
|
15
|
+
The dots use the same lighter-on-top gradient as `map-circle`/`map-pin`,
|
|
16
|
+
derived from a single base `color` — a rail beside a map reads as the same
|
|
17
|
+
family of marks as the pins on it.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import "@f-ewald/components/scroll-dots.js";
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<scroll-dots label="Journey stops"></scroll-dots>
|
|
29
|
+
<script type="module">
|
|
30
|
+
const rail = document.querySelector('scroll-dots');
|
|
31
|
+
rail.items = ['Intro', 'Freiburg', 'Berkeley', { label: 'Credits', muted: true }];
|
|
32
|
+
rail.active = 0;
|
|
33
|
+
rail.addEventListener('dot-select', (e) => {
|
|
34
|
+
rail.active = e.detail.index;
|
|
35
|
+
sections[e.detail.index].scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Attributes / properties
|
|
41
|
+
|
|
42
|
+
| Property | Attribute | Type | Default | Description |
|
|
43
|
+
| --- | --- | --- | --- | --- |
|
|
44
|
+
| `items` | _(JS property only)_ | `ScrollDotsItem[]` | `[]` | Dots to render, in document order. A bare string is shorthand for `{ label }`. |
|
|
45
|
+
| `active` | `active` | `number` | `0` | 0-based index of the active dot. Out-of-range values simply match no dot. |
|
|
46
|
+
| `color` | `color` | `string` | `""` | Base color the dot gradient is derived from. Empty uses `--ui-primary`. |
|
|
47
|
+
| `label` | `label` | `string` | `""` | Accessible name for the rail, e.g. "Journey stops". |
|
|
48
|
+
|
|
49
|
+
## Events
|
|
50
|
+
|
|
51
|
+
| Event | Description |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| `dot-select` | The user picked a dot (`detail: { index }`). |
|
|
54
|
+
|
|
55
|
+
## Slots
|
|
56
|
+
|
|
57
|
+
_None._
|
|
58
|
+
|
|
59
|
+
## CSS custom properties
|
|
60
|
+
|
|
61
|
+
| Custom property |
|
|
62
|
+
| --- |
|
|
63
|
+
| `--ui-focus-ring` |
|
|
64
|
+
| `--ui-primary` |
|
|
65
|
+
| `--ui-text-muted` |
|
package/docs/scroll-to-bottom.md
CHANGED
|
@@ -13,6 +13,12 @@ auto; position: relative`, so the button stays pinned to that container's
|
|
|
13
13
|
own visible corner as its content scrolls, rather than floating over the
|
|
14
14
|
whole page.
|
|
15
15
|
|
|
16
|
+
The control is styled as a standard secondary button (ui-button's
|
|
17
|
+
`secondary` variant: 2rem tall, `--ui-radius-sm` corners, the
|
|
18
|
+
`--ui-button-secondary-*` background/border tokens, so a gradient theme
|
|
19
|
+
carries over) rather than a pill, layered over an opaque `--ui-surface`
|
|
20
|
+
base and an elevation shadow, since it floats above scrolled content.
|
|
21
|
+
|
|
16
22
|
## Install
|
|
17
23
|
|
|
18
24
|
```js
|
|
@@ -57,12 +63,21 @@ _None._
|
|
|
57
63
|
| Custom property |
|
|
58
64
|
| --- |
|
|
59
65
|
| `--ui-border` |
|
|
66
|
+
| `--ui-button-highlight` |
|
|
67
|
+
| `--ui-button-secondary-` |
|
|
68
|
+
| `--ui-button-secondary-background` |
|
|
69
|
+
| `--ui-button-secondary-background-active` |
|
|
70
|
+
| `--ui-button-secondary-background-hover` |
|
|
71
|
+
| `--ui-button-secondary-border` |
|
|
72
|
+
| `--ui-button-secondary-border-hover` |
|
|
60
73
|
| `--ui-focus-ring` |
|
|
61
74
|
| `--ui-font` |
|
|
62
75
|
| `--ui-font-size-sm` |
|
|
63
76
|
| `--ui-font-weight-medium` |
|
|
64
77
|
| `--ui-line-height-tight` |
|
|
78
|
+
| `--ui-radius-sm` |
|
|
65
79
|
| `--ui-shadow` |
|
|
66
80
|
| `--ui-surface` |
|
|
67
81
|
| `--ui-surface-muted` |
|
|
68
82
|
| `--ui-text` |
|
|
83
|
+
| `--ui-text-muted` |
|
package/docs/scroll-to-top.md
CHANGED
|
@@ -13,6 +13,12 @@ auto; position: relative`, so the button stays pinned to that container's
|
|
|
13
13
|
own visible corner as its content scrolls, rather than floating over the
|
|
14
14
|
whole page.
|
|
15
15
|
|
|
16
|
+
The control is styled as a standard secondary button (ui-button's
|
|
17
|
+
`secondary` variant: 2rem tall, `--ui-radius-sm` corners, the
|
|
18
|
+
`--ui-button-secondary-*` background/border tokens, so a gradient theme
|
|
19
|
+
carries over) rather than a pill, layered over an opaque `--ui-surface`
|
|
20
|
+
base and an elevation shadow, since it floats above scrolled content.
|
|
21
|
+
|
|
16
22
|
## Install
|
|
17
23
|
|
|
18
24
|
```js
|
|
@@ -48,12 +54,21 @@ _None._
|
|
|
48
54
|
| Custom property |
|
|
49
55
|
| --- |
|
|
50
56
|
| `--ui-border` |
|
|
57
|
+
| `--ui-button-highlight` |
|
|
58
|
+
| `--ui-button-secondary-` |
|
|
59
|
+
| `--ui-button-secondary-background` |
|
|
60
|
+
| `--ui-button-secondary-background-active` |
|
|
61
|
+
| `--ui-button-secondary-background-hover` |
|
|
62
|
+
| `--ui-button-secondary-border` |
|
|
63
|
+
| `--ui-button-secondary-border-hover` |
|
|
51
64
|
| `--ui-focus-ring` |
|
|
52
65
|
| `--ui-font` |
|
|
53
66
|
| `--ui-font-size-sm` |
|
|
54
67
|
| `--ui-font-weight-medium` |
|
|
55
68
|
| `--ui-line-height-tight` |
|
|
69
|
+
| `--ui-radius-sm` |
|
|
56
70
|
| `--ui-shadow` |
|
|
57
71
|
| `--ui-surface` |
|
|
58
72
|
| `--ui-surface-muted` |
|
|
59
73
|
| `--ui-text` |
|
|
74
|
+
| `--ui-text-muted` |
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
# `<timeline-container>`
|
|
2
2
|
|
|
3
|
-
Vertical timeline: a
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Vertical timeline: a connecting line runs down the entries and each slotted
|
|
4
|
+
`timeline-entry` places a dot on it. This is a thin layout and semantics
|
|
5
|
+
wrapper — the entries draw the line segments and dots themselves, so the
|
|
6
|
+
container adds no gap between them (a gap would break the line). Exposed to
|
|
7
|
+
assistive technology as a list of events.
|
|
8
|
+
|
|
9
|
+
`layout` chooses where the line runs. `left` (the default) puts it down the
|
|
10
|
+
left edge with each entry's label inline beside its headline. `alternating`
|
|
11
|
+
centers it and gives each entry three columns — label, line, body — with the
|
|
12
|
+
two sides swapping on every second entry, for a presentation timeline rather
|
|
13
|
+
than an event log.
|
|
14
|
+
|
|
15
|
+
The layout is pushed onto each entry rather than read from here, because a
|
|
16
|
+
shadow-DOM child cannot style itself against an ancestor portably —
|
|
17
|
+
`:host-context()` is Chromium-only.
|
|
8
18
|
|
|
9
19
|
## Install
|
|
10
20
|
|
|
@@ -29,11 +39,25 @@ import "@f-ewald/components/timeline-container.js";
|
|
|
29
39
|
<chat-message role="user" author="Freddy">Ship it.</chat-message>
|
|
30
40
|
</timeline-entry>
|
|
31
41
|
</timeline-container>
|
|
42
|
+
|
|
43
|
+
<!-- A presentation timeline: centered line, label and body swapping sides. -->
|
|
44
|
+
<timeline-container layout="alternating">
|
|
45
|
+
<timeline-entry label="1987">
|
|
46
|
+
<span slot="headline">Where it started</span>
|
|
47
|
+
A first stop, with the label on the left.
|
|
48
|
+
</timeline-entry>
|
|
49
|
+
<timeline-entry label="2004">
|
|
50
|
+
<span slot="headline">The question</span>
|
|
51
|
+
The second entry mirrors the first.
|
|
52
|
+
</timeline-entry>
|
|
53
|
+
</timeline-container>
|
|
32
54
|
```
|
|
33
55
|
|
|
34
56
|
## Attributes / properties
|
|
35
57
|
|
|
36
|
-
|
|
58
|
+
| Property | Attribute | Type | Default | Description |
|
|
59
|
+
| --- | --- | --- | --- | --- |
|
|
60
|
+
| `layout` | `layout` | `TimelineLayout` | `"left"` | Arrangement of the entries: a left-edge line, or a centered alternating one. |
|
|
37
61
|
|
|
38
62
|
## Events
|
|
39
63
|
|
package/docs/timeline-entry.md
CHANGED
|
@@ -11,6 +11,19 @@ exactly at the first and last dots. Only meaningful inside a
|
|
|
11
11
|
timestamp prop (e.g. `chat-message`'s `timestamp`) should leave it unset —
|
|
12
12
|
setting both renders the same time twice.
|
|
13
13
|
|
|
14
|
+
`label` is a free-text alternative for a timeline whose axis is not a wall
|
|
15
|
+
clock — a year, an era, a phase. It wins over `datetime` when both are set.
|
|
16
|
+
Slot `label` instead when it needs its own styling, since a property is
|
|
17
|
+
rendered inside this component's shadow DOM and cannot be reached from
|
|
18
|
+
outside.
|
|
19
|
+
|
|
20
|
+
`alternating` is set by `timeline-container` and should not be set by hand:
|
|
21
|
+
it switches the entry to three columns — label, line, body — with the sides
|
|
22
|
+
swapping on every second entry. The entry fills whatever height it is given,
|
|
23
|
+
so the line spans it rather than only its content — do not override the
|
|
24
|
+
host's `display` from outside, since a light-DOM rule beats the `:host`
|
|
25
|
+
declaration this relies on.
|
|
26
|
+
|
|
14
27
|
The dot's `color` types the entry using the shared status-pill palette —
|
|
15
28
|
`primary` by default, plus `neutral`, `info`, `success`, `warning`, and
|
|
16
29
|
`danger`.
|
|
@@ -42,6 +55,8 @@ import "@f-ewald/components/timeline-entry.js";
|
|
|
42
55
|
| Property | Attribute | Type | Default | Description |
|
|
43
56
|
| --- | --- | --- | --- | --- |
|
|
44
57
|
| `datetime` | `datetime` | `string | null` | `null` | ISO 8601 or SQLite datetime string, rendered as a relative time. |
|
|
58
|
+
| `label` | `label` | `string | null` | `null` | Free-text label shown in place of the relative time; wins over `datetime`. |
|
|
59
|
+
| `alternating` | `alternating` | `boolean` | `false` | Three-column alternating presentation. Set by `timeline-container` from its own `layout`; setting it directly is not supported. |
|
|
45
60
|
| `color` | `color` | `StatusPillColor` | `"primary"` | Visual type of the entry's dot, from the shared status-pill palette: `primary` (default), `neutral`, `info`, `success`, `warning`, or `danger`. |
|
|
46
61
|
| `compact` | `compact` | `boolean` | `false` | Dense, one-line presentation for system-status entries: tighter vertical spacing and smaller, muted content. |
|
|
47
62
|
| `running` | `running` | `boolean` | `false` | Shows an animated ring spinner in place of the dot, indicating the entry represents in-progress work. Overrides `color` while set — the spinner always uses the muted/gray palette. |
|
|
@@ -62,7 +77,9 @@ _None._
|
|
|
62
77
|
| `--ui-danger` |
|
|
63
78
|
| `--ui-font` |
|
|
64
79
|
| `--ui-font-size` |
|
|
80
|
+
| `--ui-font-size-lg` |
|
|
65
81
|
| `--ui-font-size-sm` |
|
|
82
|
+
| `--ui-font-weight-medium` |
|
|
66
83
|
| `--ui-font-weight-semibold` |
|
|
67
84
|
| `--ui-info` |
|
|
68
85
|
| `--ui-line-height-normal` |
|
|
@@ -72,4 +89,5 @@ _None._
|
|
|
72
89
|
| `--ui-surface` |
|
|
73
90
|
| `--ui-text` |
|
|
74
91
|
| `--ui-text-muted` |
|
|
92
|
+
| `--ui-tracking-wide` |
|
|
75
93
|
| `--ui-warning` |
|
package/docs/ui-button.md
CHANGED
|
@@ -31,6 +31,28 @@ background/border read the equivalent `--ui-button-secondary-*` tokens
|
|
|
31
31
|
transparent/bordered look, so it can be themed into a matching (e.g.
|
|
32
32
|
white-to-gray) gradient too.
|
|
33
33
|
|
|
34
|
+
`ai` is an orthogonal modifier rather than a fourth variant: it leaves the
|
|
35
|
+
variant's fill (flat or gradient-themed) untouched and only adds an
|
|
36
|
+
animated multi-hue ring *outside* the button box — a crisp masked edge
|
|
37
|
+
plus a blurred bloom behind it that fades out to transparent, so the ring
|
|
38
|
+
melts into the page instead of ending on a hard line. Both layers are
|
|
39
|
+
masked into a donut, so nothing is ever painted over the background or
|
|
40
|
+
label. The ring's four stops are the `--ui-ai-1`…`--ui-ai-4` tokens. It
|
|
41
|
+
sweeps slowly at rest, faster on hover and while `busy`, holds still while
|
|
42
|
+
disabled or under `prefers-reduced-motion`, and drops the bloom for a
|
|
43
|
+
solid `CanvasText` ring in forced-colors mode. The bloom reaches about
|
|
44
|
+
`0.5rem` past the control, so give an AI button that much clearance from
|
|
45
|
+
its neighbors and avoid `overflow: hidden` ancestors that would clip it.
|
|
46
|
+
|
|
47
|
+
Do not combine `ai` with `pill` under the gradient theme
|
|
48
|
+
(`data-theme="gradient"`). That theme defines a button through a darker
|
|
49
|
+
`--ui-button-border` edge plus a glossy top highlight; a pill's
|
|
50
|
+
fully-rounded silhouette runs flush against the ring around its entire
|
|
51
|
+
outline, so that border and gloss read as the inner edge of the rainbow
|
|
52
|
+
rather than as the button's own shape, and the vertical gradient fill
|
|
53
|
+
stops reading as a gradient at all. Use `ai` with the default
|
|
54
|
+
`--ui-radius-sm` corners there, and keep `ai` + `pill` for the flat theme.
|
|
55
|
+
|
|
34
56
|
## Install
|
|
35
57
|
|
|
36
58
|
```js
|
|
@@ -46,6 +68,7 @@ import "@f-ewald/components/ui-button.js";
|
|
|
46
68
|
</ui-button>
|
|
47
69
|
<ui-button variant="danger">Delete</ui-button>
|
|
48
70
|
<ui-button variant="secondary" href="/properties?edit=42">Edit</ui-button>
|
|
71
|
+
<ui-button variant="primary" ai>Ask AI</ui-button>
|
|
49
72
|
```
|
|
50
73
|
|
|
51
74
|
## Attributes / properties
|
|
@@ -55,6 +78,7 @@ import "@f-ewald/components/ui-button.js";
|
|
|
55
78
|
| `variant` | `variant` | `ButtonVariant` | `"primary"` | Visual weight. |
|
|
56
79
|
| `size` | `size` | `"sm" | "md"` | `"md"` | Size — `sm` reduces height/padding/font-size one step below the default. |
|
|
57
80
|
| `pill` | `pill` | `boolean` | `false` | Renders fully rounded (pill-shaped) corners instead of the default `--ui-radius-sm`. |
|
|
81
|
+
| `ai` | `ai` | `boolean` | `false` | Draws the animated multi-hue "AI" ring (crisp edge plus a bloom fading out to transparent) around the button, on top of whatever variant/theme it already uses. |
|
|
58
82
|
| `href` | `href` | `string | null` | `null` | Renders an `<a href="...">` instead of a `<button>` when set. |
|
|
59
83
|
| `type` | `type` | `"button" | "submit" | "reset"` | `"button"` | Native button `type`. Ignored when `href` is set. |
|
|
60
84
|
| `disabled` | `disabled` | `boolean` | `false` | Disables the control and dims it. |
|
|
@@ -75,6 +99,10 @@ _None._
|
|
|
75
99
|
|
|
76
100
|
| Custom property |
|
|
77
101
|
| --- |
|
|
102
|
+
| `--ui-ai-1` |
|
|
103
|
+
| `--ui-ai-2` |
|
|
104
|
+
| `--ui-ai-3` |
|
|
105
|
+
| `--ui-ai-4` |
|
|
78
106
|
| `--ui-border` |
|
|
79
107
|
| `--ui-button-background` |
|
|
80
108
|
| `--ui-button-background-active` |
|