@juninmd/sonido 1.0.0 → 1.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.
- package/LICENSE +21 -21
- package/README.md +165 -165
- package/dist/components/BlackHole/BlackHole.d.ts +19 -0
- package/dist/components/BlackHole/index.d.ts +1 -0
- package/dist/components/ScanProgress/ScanProgress.d.ts +29 -0
- package/dist/components/ScanProgress/index.d.ts +1 -0
- package/dist/components/Sunburst/Sunburst.d.ts +18 -0
- package/dist/components/Sunburst/index.d.ts +1 -0
- package/dist/components/Tray/Tray.d.ts +32 -0
- package/dist/components/Tray/index.d.ts +1 -0
- package/dist/components/Treemap/Treemap.d.ts +23 -0
- package/dist/components/Treemap/index.d.ts +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1650 -1063
- package/dist/index.js.map +1 -1
- package/dist/sonido.css +1 -1
- package/dist/tokens.css +397 -397
- package/dist/tokens.js.map +1 -1
- package/dist/utils/ease.d.ts +4 -0
- package/dist/utils/flyTo.d.ts +15 -0
- package/dist/utils/format.d.ts +12 -0
- package/dist/utils/squarify.d.ts +9 -0
- package/dist/utils/tree.d.ts +28 -0
- package/dist/utils/useMotionPref.d.ts +18 -0
- package/dist/utils/useSize.d.ts +6 -0
- package/package.json +102 -102
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 juninmd
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 juninmd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,165 +1,165 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<img src=".github/assets/hero.png" alt="Componentes do Sonido: céu animado do clima, alertas com cena, duelo de placar e balão de pensamento" width="100%" />
|
|
4
|
-
|
|
5
|
-
# Sonido
|
|
6
|
-
|
|
7
|
-
**O design system dos apps do juninmd, em React.**
|
|
8
|
-
Escuro por padrão, vidro sobre um fundo atmosférico, cor com função e movimento que responde ao toque.
|
|
9
|
-
|
|
10
|
-
[](https://www.npmjs.com/package/@juninmd/sonido)
|
|
11
|
-
[](https://github.com/juninmd/sonido/actions/workflows/ci.yml)
|
|
12
|
-
[](https://juninmd.github.io/sonido/)
|
|
13
|
-
[](https://github.com/semantic-release/semantic-release)
|
|
14
|
-
[](LICENSE)
|
|
15
|
-
|
|
16
|
-
[**Documentação ao vivo**](https://juninmd.github.io/sonido/) · [Começar](#começar) · [Componentes](#componentes) · [Temas](#temas) · [Contribuir](#contribuir)
|
|
17
|
-
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Por que Sonido
|
|
23
|
-
|
|
24
|
-
| | |
|
|
25
|
-
| --------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
26
|
-
| 🧩 **
|
|
27
|
-
| 🎨 **8 temas** | Troque com um atributo: `data-theme="hueco-mundo"`. Tokens `--sn-*` em CSS e em JS. |
|
|
28
|
-
| ✨ **Movimento com motivo** | Mola tátil, confete, cenas em canvas. Tudo desliga com `prefers-reduced-motion`. |
|
|
29
|
-
| ♿ **Acessível** | Contraste AA nos 8 temas, auditado com axe. Alvos de 44px e foco visível. |
|
|
30
|
-
| 🧪 **Teste ao vivo** | Cada página da documentação tem um editor: mude o código, veja o resultado, copie com os imports. |
|
|
31
|
-
| 📦 **Leve** | Sem dependências além do React. ESM, tree-shakeable, CSS em um arquivo. |
|
|
32
|
-
|
|
33
|
-
## Começar
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm install @juninmd/sonido
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
```tsx
|
|
40
|
-
import { Button, Card, CardTitle, ProgressBar, burst } from "@juninmd/sonido";
|
|
41
|
-
import "@juninmd/sonido/styles.css";
|
|
42
|
-
|
|
43
|
-
export function Licao() {
|
|
44
|
-
return (
|
|
45
|
-
<Card>
|
|
46
|
-
<CardTitle>Lição 12</CardTitle>
|
|
47
|
-
<ProgressBar value={0.6} label="Meta do dia" />
|
|
48
|
-
<Button press onClick={(e) => burst(e.currentTarget)}>
|
|
49
|
-
Concluir lição
|
|
50
|
-
</Button>
|
|
51
|
-
</Card>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Coloque `class="sn-body"` no `<body>` para herdar fonte, cor e fundo do tema.
|
|
57
|
-
|
|
58
|
-
> 💡 Não sabe qual componente usar? Abra a [documentação](https://juninmd.github.io/sonido/), edite o exemplo e clique em **Copiar código**.
|
|
59
|
-
|
|
60
|
-
## Componentes
|
|
61
|
-
|
|
62
|
-
| Grupo | Componentes |
|
|
63
|
-
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
-
| **Ações** | Button, ConfirmButton |
|
|
65
|
-
| **Formulários** | Checkbox, FilterChips, RadioGroup, Rating, SearchField, Select, Slider, Switch, TextField, ToggleCard |
|
|
66
|
-
| **Exibição** | Avatar, Badge, Kbd, Tooltip |
|
|
67
|
-
| **Feedback** | Alert, EmptyState, LiveBadge, SaveIndicator, Skeleton, Spinner, Stamp, Toast |
|
|
68
|
-
| **Superfícies** | Accordion, AmbientBackdrop, Artwork, Bento, Card, Carousel, Dialog, Hero, PageHeader |
|
|
69
|
-
| **Navegação** | Breadcrumb, CommandPalette, Dock, Menu, NavRail, Pagination, Stepper, Tabs |
|
|
70
|
-
| **Dados** | BarChart, CountUp, DataTable, Duel, Heatmap, MeterCard, Odometer, ProgressBar, ProgressRing, RadialClock, Sparkline, Stat, StatTile, Timeline |
|
|
71
|
-
| **Widgets** | AgendaRail, AlertCard, RouteMap, WeatherIcon, WeatherSky |
|
|
72
|
-
| **Assistente** | EmojiBurst, PresenceOrb, RadialMenu, SpeechBubble, ThinkingBubble |
|
|
73
|
-
| **Movimento e temas** | Motion, ThemeSwitcher |
|
|
74
|
-
|
|
75
|
-
Utilitários: `burst` (confete), `accentStyle(hue)` (cor por seção), `useReducedMotion`, `useCanvasLoop`, `hueFrom`, `initials`, `cx`.
|
|
76
|
-
|
|
77
|
-
## Ilhas vivas
|
|
78
|
-
|
|
79
|
-
Pílulas escuras para atividades em andamento: chamada, timer, música, gravação, rota, cotação, clima e bateria. Ficam escuras em qualquer tema e usam a cor de destaque dele.
|
|
80
|
-
|
|
81
|
-
<img src=".github/assets/islands.png" alt="Galeria de ilhas vivas: cotação, chamada, timer, navegação, player, gravação, clima por hora, progresso e bateria" width="100%" />
|
|
82
|
-
|
|
83
|
-
```tsx
|
|
84
|
-
<IslandCall name="Ana Lima" subtitle="celular" onAccept={atender} onDecline={recusar} />
|
|
85
|
-
<IslandTimer duration={25 * 60} label="Foco" onDone={tocar} />
|
|
86
|
-
<IslandChip icon={<Bike />} value="2,0 km" tone="gold" label="Pedalada: 2 km" />
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Temas
|
|
90
|
-
|
|
91
|
-
<img src=".github/assets/themes.png" alt="O mesmo card em seis temas: Sonido escuro, Sonido claro, Hueco Mundo, Canto, Drácula e Aurora" width="100%" />
|
|
92
|
-
|
|
93
|
-
| Tema | Ativar |
|
|
94
|
-
| ---------------------- | ------------------------------------------------- |
|
|
95
|
-
| Sonido escuro (padrão) | nada, é o `:root` |
|
|
96
|
-
| Sonido claro | `data-theme="light"` |
|
|
97
|
-
| Hueco Mundo | `data-theme="hueco-mundo"` |
|
|
98
|
-
| Canto · Canto claro | `data-theme="canto"` · `data-theme="canto-claro"` |
|
|
99
|
-
| Drácula | `data-theme="dracula"` |
|
|
100
|
-
| Glass | `data-theme="glass"` |
|
|
101
|
-
| Aurora | `data-theme="aurora"` |
|
|
102
|
-
|
|
103
|
-
```ts
|
|
104
|
-
document.documentElement.dataset.theme = "aurora";
|
|
105
|
-
// ou <ThemeSwitcher value={tema} onChange={setTema} /> com a lavada circular
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Tokens em JS: `import { color, space, duration } from "@juninmd/sonido/tokens"`. Só as variáveis: `@juninmd/sonido/tokens.css`.
|
|
109
|
-
|
|
110
|
-
## De onde veio cada peça
|
|
111
|
-
|
|
112
|
-
Sonido junta o melhor dos apps do juninmd:
|
|
113
|
-
|
|
114
|
-
| Origem | O que trouxe |
|
|
115
|
-
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
116
|
-
| games-gallery | Dock com ampliação, Hero, Card com tilt, AmbientBackdrop, ProgressRing, CountUp, Toast |
|
|
117
|
-
| nerd-watch | Tokens base, CommandPalette, Carousel, NavRail, BarChart, Artwork, confete |
|
|
118
|
-
| canto-widget | Tema Hueco Mundo e os 5 skins do canto, WeatherSky, AlertCard com 19 cenas, RouteMap, AgendaRail, Tabs, DataTable |
|
|
119
|
-
| pobre-lingo | Botão tátil, curva de mola, Rating e ProgressBar gamificados |
|
|
120
|
-
| mika | PresenceOrb, ThinkingBubble, SpeechBubble, RadialMenu, EmojiBurst, PageHeader, StatTile, ToggleCard, SaveIndicator, Bento |
|
|
121
|
-
| ai-session-monitor | ThemeSwitcher, MeterCard |
|
|
122
|
-
| franca-segura · eleicoes-radar · treta-aovivo | Heatmap, RadialClock, Odometer, Stamp, LiveBadge, Duel |
|
|
123
|
-
| faxina | Release com semantic-release e commitlint |
|
|
124
|
-
|
|
125
|
-
## Desenvolvimento
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
npm install
|
|
129
|
-
npm run dev # Storybook em http://localhost:6006
|
|
130
|
-
npm run check # lint + tipos + auditoria do design system + testes
|
|
131
|
-
npm run build # pacote em dist/
|
|
132
|
-
npm run build:docs # site estático em storybook-static/
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Os testes montam **todos os exemplos da documentação**, então o código que você copia da doc sempre funciona.
|
|
136
|
-
|
|
137
|
-
### Skills de auditoria
|
|
138
|
-
|
|
139
|
-
Em `.claude/skills/` há três skills para o Claude Code:
|
|
140
|
-
|
|
141
|
-
- **sonido-audit**: roda `npm run audit:ds`, lint, tipos e testes e corrige o que falhar.
|
|
142
|
-
- **sonido-a11y**: axe-core nos
|
|
143
|
-
- **sonido-component**: passo a passo para criar ou portar um componente.
|
|
144
|
-
|
|
145
|
-
## Releases
|
|
146
|
-
|
|
147
|
-
Versões saem sozinhas a cada merge na `main`, pelo [semantic-release](https://github.com/semantic-release/semantic-release), a partir das mensagens de commit:
|
|
148
|
-
|
|
149
|
-
| Commit | Versão |
|
|
150
|
-
| ----------------------------- | ------------- |
|
|
151
|
-
| `fix(button): foco no Safari` | patch `1.0.1` |
|
|
152
|
-
| `feat(toast): ação desfazer` | minor `1.1.0` |
|
|
153
|
-
| `feat!: remove a prop tone` | major `2.0.0` |
|
|
154
|
-
|
|
155
|
-
O commitlint valida as mensagens no `commit-msg` (husky) e no CI.
|
|
156
|
-
|
|
157
|
-
## Contribuir
|
|
158
|
-
|
|
159
|
-
1. Crie uma branch, faça commits semânticos e abra um PR.
|
|
160
|
-
2. O CI roda lint, tipos, auditoria, testes, build do pacote e da documentação.
|
|
161
|
-
3. No merge, a `main` publica no npm e atualiza a documentação.
|
|
162
|
-
|
|
163
|
-
## Licença
|
|
164
|
-
|
|
165
|
-
[MIT](LICENSE) © juninmd
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src=".github/assets/hero.png" alt="Componentes do Sonido: céu animado do clima, alertas com cena, duelo de placar e balão de pensamento" width="100%" />
|
|
4
|
+
|
|
5
|
+
# Sonido
|
|
6
|
+
|
|
7
|
+
**O design system dos apps do juninmd, em React.**
|
|
8
|
+
Escuro por padrão, vidro sobre um fundo atmosférico, cor com função e movimento que responde ao toque.
|
|
9
|
+
|
|
10
|
+
[](https://www.npmjs.com/package/@juninmd/sonido)
|
|
11
|
+
[](https://github.com/juninmd/sonido/actions/workflows/ci.yml)
|
|
12
|
+
[](https://juninmd.github.io/sonido/)
|
|
13
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
|
|
16
|
+
[**Documentação ao vivo**](https://juninmd.github.io/sonido/) · [Começar](#começar) · [Componentes](#componentes) · [Temas](#temas) · [Contribuir](#contribuir)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Por que Sonido
|
|
23
|
+
|
|
24
|
+
| | |
|
|
25
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| 🧩 **83 componentes** | De botão a céu animado do clima, todos com tipos, teclado e ARIA. |
|
|
27
|
+
| 🎨 **8 temas** | Troque com um atributo: `data-theme="hueco-mundo"`. Tokens `--sn-*` em CSS e em JS. |
|
|
28
|
+
| ✨ **Movimento com motivo** | Mola tátil, confete, cenas em canvas. Tudo desliga com `prefers-reduced-motion`. |
|
|
29
|
+
| ♿ **Acessível** | Contraste AA nos 8 temas, auditado com axe. Alvos de 44px e foco visível. |
|
|
30
|
+
| 🧪 **Teste ao vivo** | Cada página da documentação tem um editor: mude o código, veja o resultado, copie com os imports. |
|
|
31
|
+
| 📦 **Leve** | Sem dependências além do React. ESM, tree-shakeable, CSS em um arquivo. |
|
|
32
|
+
|
|
33
|
+
## Começar
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install @juninmd/sonido
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { Button, Card, CardTitle, ProgressBar, burst } from "@juninmd/sonido";
|
|
41
|
+
import "@juninmd/sonido/styles.css";
|
|
42
|
+
|
|
43
|
+
export function Licao() {
|
|
44
|
+
return (
|
|
45
|
+
<Card>
|
|
46
|
+
<CardTitle>Lição 12</CardTitle>
|
|
47
|
+
<ProgressBar value={0.6} label="Meta do dia" />
|
|
48
|
+
<Button press onClick={(e) => burst(e.currentTarget)}>
|
|
49
|
+
Concluir lição
|
|
50
|
+
</Button>
|
|
51
|
+
</Card>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Coloque `class="sn-body"` no `<body>` para herdar fonte, cor e fundo do tema.
|
|
57
|
+
|
|
58
|
+
> 💡 Não sabe qual componente usar? Abra a [documentação](https://juninmd.github.io/sonido/), edite o exemplo e clique em **Copiar código**.
|
|
59
|
+
|
|
60
|
+
## Componentes
|
|
61
|
+
|
|
62
|
+
| Grupo | Componentes |
|
|
63
|
+
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| **Ações** | Button, ConfirmButton |
|
|
65
|
+
| **Formulários** | Checkbox, FilterChips, RadioGroup, Rating, SearchField, Select, Slider, Switch, TextField, ToggleCard |
|
|
66
|
+
| **Exibição** | Avatar, Badge, Kbd, Tooltip |
|
|
67
|
+
| **Feedback** | Alert, EmptyState, LiveBadge, SaveIndicator, Skeleton, Spinner, Stamp, Toast |
|
|
68
|
+
| **Superfícies** | Accordion, AmbientBackdrop, Artwork, Bento, Card, Carousel, Dialog, Hero, PageHeader |
|
|
69
|
+
| **Navegação** | Breadcrumb, CommandPalette, Dock, Menu, NavRail, Pagination, Stepper, Tabs |
|
|
70
|
+
| **Dados** | BarChart, CountUp, DataTable, Duel, Heatmap, MeterCard, Odometer, ProgressBar, ProgressRing, RadialClock, Sparkline, Stat, StatTile, Timeline |
|
|
71
|
+
| **Widgets** | AgendaRail, AlertCard, RouteMap, WeatherIcon, WeatherSky |
|
|
72
|
+
| **Assistente** | EmojiBurst, PresenceOrb, RadialMenu, SpeechBubble, ThinkingBubble |
|
|
73
|
+
| **Movimento e temas** | Motion, ThemeSwitcher |
|
|
74
|
+
|
|
75
|
+
Utilitários: `burst` (confete), `accentStyle(hue)` (cor por seção), `useReducedMotion`, `useCanvasLoop`, `hueFrom`, `initials`, `cx`.
|
|
76
|
+
|
|
77
|
+
## Ilhas vivas
|
|
78
|
+
|
|
79
|
+
Pílulas escuras para atividades em andamento: chamada, timer, música, gravação, rota, cotação, clima e bateria. Ficam escuras em qualquer tema e usam a cor de destaque dele.
|
|
80
|
+
|
|
81
|
+
<img src=".github/assets/islands.png" alt="Galeria de ilhas vivas: cotação, chamada, timer, navegação, player, gravação, clima por hora, progresso e bateria" width="100%" />
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<IslandCall name="Ana Lima" subtitle="celular" onAccept={atender} onDecline={recusar} />
|
|
85
|
+
<IslandTimer duration={25 * 60} label="Foco" onDone={tocar} />
|
|
86
|
+
<IslandChip icon={<Bike />} value="2,0 km" tone="gold" label="Pedalada: 2 km" />
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Temas
|
|
90
|
+
|
|
91
|
+
<img src=".github/assets/themes.png" alt="O mesmo card em seis temas: Sonido escuro, Sonido claro, Hueco Mundo, Canto, Drácula e Aurora" width="100%" />
|
|
92
|
+
|
|
93
|
+
| Tema | Ativar |
|
|
94
|
+
| ---------------------- | ------------------------------------------------- |
|
|
95
|
+
| Sonido escuro (padrão) | nada, é o `:root` |
|
|
96
|
+
| Sonido claro | `data-theme="light"` |
|
|
97
|
+
| Hueco Mundo | `data-theme="hueco-mundo"` |
|
|
98
|
+
| Canto · Canto claro | `data-theme="canto"` · `data-theme="canto-claro"` |
|
|
99
|
+
| Drácula | `data-theme="dracula"` |
|
|
100
|
+
| Glass | `data-theme="glass"` |
|
|
101
|
+
| Aurora | `data-theme="aurora"` |
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
document.documentElement.dataset.theme = "aurora";
|
|
105
|
+
// ou <ThemeSwitcher value={tema} onChange={setTema} /> com a lavada circular
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Tokens em JS: `import { color, space, duration } from "@juninmd/sonido/tokens"`. Só as variáveis: `@juninmd/sonido/tokens.css`.
|
|
109
|
+
|
|
110
|
+
## De onde veio cada peça
|
|
111
|
+
|
|
112
|
+
Sonido junta o melhor dos apps do juninmd:
|
|
113
|
+
|
|
114
|
+
| Origem | O que trouxe |
|
|
115
|
+
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| games-gallery | Dock com ampliação, Hero, Card com tilt, AmbientBackdrop, ProgressRing, CountUp, Toast |
|
|
117
|
+
| nerd-watch | Tokens base, CommandPalette, Carousel, NavRail, BarChart, Artwork, confete |
|
|
118
|
+
| canto-widget | Tema Hueco Mundo e os 5 skins do canto, WeatherSky, AlertCard com 19 cenas, RouteMap, AgendaRail, Tabs, DataTable |
|
|
119
|
+
| pobre-lingo | Botão tátil, curva de mola, Rating e ProgressBar gamificados |
|
|
120
|
+
| mika | PresenceOrb, ThinkingBubble, SpeechBubble, RadialMenu, EmojiBurst, PageHeader, StatTile, ToggleCard, SaveIndicator, Bento |
|
|
121
|
+
| ai-session-monitor | ThemeSwitcher, MeterCard |
|
|
122
|
+
| franca-segura · eleicoes-radar · treta-aovivo | Heatmap, RadialClock, Odometer, Stamp, LiveBadge, Duel |
|
|
123
|
+
| faxina | Release com semantic-release e commitlint |
|
|
124
|
+
|
|
125
|
+
## Desenvolvimento
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npm install
|
|
129
|
+
npm run dev # Storybook em http://localhost:6006
|
|
130
|
+
npm run check # lint + tipos + auditoria do design system + testes
|
|
131
|
+
npm run build # pacote em dist/
|
|
132
|
+
npm run build:docs # site estático em storybook-static/
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Os testes montam **todos os exemplos da documentação**, então o código que você copia da doc sempre funciona.
|
|
136
|
+
|
|
137
|
+
### Skills de auditoria
|
|
138
|
+
|
|
139
|
+
Em `.claude/skills/` há três skills para o Claude Code:
|
|
140
|
+
|
|
141
|
+
- **sonido-audit**: roda `npm run audit:ds`, lint, tipos e testes e corrige o que falhar.
|
|
142
|
+
- **sonido-a11y**: axe-core nos exemplos em todos os temas.
|
|
143
|
+
- **sonido-component**: passo a passo para criar ou portar um componente.
|
|
144
|
+
|
|
145
|
+
## Releases
|
|
146
|
+
|
|
147
|
+
Versões saem sozinhas a cada merge na `main`, pelo [semantic-release](https://github.com/semantic-release/semantic-release), a partir das mensagens de commit:
|
|
148
|
+
|
|
149
|
+
| Commit | Versão |
|
|
150
|
+
| ----------------------------- | ------------- |
|
|
151
|
+
| `fix(button): foco no Safari` | patch `1.0.1` |
|
|
152
|
+
| `feat(toast): ação desfazer` | minor `1.1.0` |
|
|
153
|
+
| `feat!: remove a prop tone` | major `2.0.0` |
|
|
154
|
+
|
|
155
|
+
O commitlint valida as mensagens no `commit-msg` (husky) e no CI.
|
|
156
|
+
|
|
157
|
+
## Contribuir
|
|
158
|
+
|
|
159
|
+
1. Crie uma branch, faça commits semânticos e abra um PR.
|
|
160
|
+
2. O CI roda lint, tipos, auditoria, testes, build do pacote e da documentação.
|
|
161
|
+
3. No merge, a `main` publica no npm e atualiza a documentação.
|
|
162
|
+
|
|
163
|
+
## Licença
|
|
164
|
+
|
|
165
|
+
[MIT](LICENSE) © juninmd
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "./BlackHole.css";
|
|
2
|
+
export interface BlackHoleProps {
|
|
3
|
+
/** Quanto saiu. null enquanto a remoção roda: o buraco gira rápido. */
|
|
4
|
+
freed: number | null;
|
|
5
|
+
/** Rótulo acima do número. */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Formata o total (padrão: bytes). */
|
|
8
|
+
formatValue?: (value: number) => string;
|
|
9
|
+
/** Altura em px. */
|
|
10
|
+
height?: number;
|
|
11
|
+
/** Duração da contagem final em ms. */
|
|
12
|
+
duration?: number;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Buraco negro em canvas (faxina): partículas caem em espiral enquanto algo é apagado e o total
|
|
17
|
+
* conta até o valor final. Sem animação mostra um quadro parado e o número direto.
|
|
18
|
+
*/
|
|
19
|
+
export declare function BlackHole({ freed, label, formatValue, height, duration, className, }: BlackHoleProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BlackHole";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import "./ScanProgress.css";
|
|
2
|
+
export type ScanState = "running" | "stopping" | "done" | "cancelled";
|
|
3
|
+
export interface ScanProgressProps {
|
|
4
|
+
/** Itens vistos até agora. */
|
|
5
|
+
count: number;
|
|
6
|
+
/** Segundos desde o início. */
|
|
7
|
+
elapsed: number;
|
|
8
|
+
/** Itens por segundo; sem ele usa count / elapsed. */
|
|
9
|
+
rate?: number;
|
|
10
|
+
/** Item atual (caminho, URL...). */
|
|
11
|
+
current?: string;
|
|
12
|
+
state?: ScanState;
|
|
13
|
+
/** Mostra o botão de cancelar enquanto roda. */
|
|
14
|
+
onCancel?: () => void;
|
|
15
|
+
/** Mostra o botão de recomeçar quando termina ou é cancelado. */
|
|
16
|
+
onRestart?: () => void;
|
|
17
|
+
/** Nomes das três medidas. */
|
|
18
|
+
labels?: {
|
|
19
|
+
count?: string;
|
|
20
|
+
rate?: string;
|
|
21
|
+
elapsed?: string;
|
|
22
|
+
};
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Números ao vivo de uma tarefa longa (faxina): quantos itens, ritmo e tempo, com o item atual.
|
|
27
|
+
* "stopping" cobre o intervalo entre o clique em cancelar e a parada real.
|
|
28
|
+
*/
|
|
29
|
+
export declare function ScanProgress({ count, elapsed, rate, current, state, onCancel, onRestart, labels, className, }: ScanProgressProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ScanProgress";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type TreeNode } from "../../utils/tree";
|
|
2
|
+
import "./Sunburst.css";
|
|
3
|
+
export interface SunburstProps {
|
|
4
|
+
data: TreeNode;
|
|
5
|
+
/** Nome acessível do gráfico. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Diâmetro máximo em px. */
|
|
8
|
+
size?: number;
|
|
9
|
+
/** Quantos anéis desenhar abaixo do nó aberto. */
|
|
10
|
+
depth?: number;
|
|
11
|
+
/** Formata o valor do centro e das dicas (padrão: bytes). */
|
|
12
|
+
formatValue?: (value: number) => string;
|
|
13
|
+
/** Chamado ao entrar num anel. */
|
|
14
|
+
onOpen?: (node: TreeNode) => void;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Anéis hierárquicos (faxina): clique num anel para entrar e no centro para voltar. */
|
|
18
|
+
export declare function Sunburst({ data, label, size, depth, formatValue, onOpen, className, }: SunburstProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Sunburst";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import "./Tray.css";
|
|
3
|
+
export interface TrayItem {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: number;
|
|
7
|
+
/** Cor CSS da marca do item. */
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface TrayProps {
|
|
11
|
+
items: TrayItem[];
|
|
12
|
+
/** Título acima do total. */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Formata valores e total (padrão: bytes). */
|
|
15
|
+
formatValue?: (value: number) => string;
|
|
16
|
+
/** Tira um item da bandeja. */
|
|
17
|
+
onRemove?: (id: string) => void;
|
|
18
|
+
/** Ação única para tudo o que está na bandeja. */
|
|
19
|
+
onConfirm?: () => void;
|
|
20
|
+
/** Texto do botão; recebe a quantidade. */
|
|
21
|
+
confirmLabel?: (count: number) => string;
|
|
22
|
+
/** Texto quando a bandeja está vazia. */
|
|
23
|
+
empty?: ReactNode;
|
|
24
|
+
/** Tom do botão de confirmar. */
|
|
25
|
+
tone?: "danger" | "accent";
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Bandeja (faxina "Órbita"): junta itens marcados em qualquer lugar da tela, mostra o total e
|
|
30
|
+
* confirma tudo com um botão só. É alvo do `flyTo()` e pulsa quando chega item novo.
|
|
31
|
+
*/
|
|
32
|
+
export declare function Tray({ items, title, formatValue, onRemove, onConfirm, confirmLabel, empty, tone, className, }: TrayProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Tray";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type TreeNode } from "../../utils/tree";
|
|
2
|
+
import "./Treemap.css";
|
|
3
|
+
export interface TreemapProps {
|
|
4
|
+
data: TreeNode;
|
|
5
|
+
/** Nome acessível do mapa. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Altura em px. */
|
|
8
|
+
height?: number;
|
|
9
|
+
/** Formata o valor de cada bloco (padrão: bytes). */
|
|
10
|
+
formatValue?: (value: number) => string;
|
|
11
|
+
/** Chamado ao abrir uma pasta (navegação). */
|
|
12
|
+
onOpen?: (node: TreeNode) => void;
|
|
13
|
+
/** Chamado ao clicar numa folha (sem filhos). */
|
|
14
|
+
onSelect?: (node: TreeNode) => void;
|
|
15
|
+
/** Mostra o caminho com links para voltar. */
|
|
16
|
+
breadcrumb?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Mapa de blocos proporcional ao tamanho (faxina). Clique abre a pasta; setas movem o foco
|
|
21
|
+
* para o vizinho na direção, Enter abre e Backspace volta. Passar o mouse acende o caminho.
|
|
22
|
+
*/
|
|
23
|
+
export declare function Treemap({ data, label, height, formatValue, onOpen, onSelect, breadcrumb, className, }: TreemapProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Treemap";
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./components/Badge";
|
|
|
12
12
|
export * from "./components/BarChart";
|
|
13
13
|
export * from "./components/BatteryMeter";
|
|
14
14
|
export * from "./components/Bento";
|
|
15
|
+
export * from "./components/BlackHole";
|
|
15
16
|
export * from "./components/Breadcrumb";
|
|
16
17
|
export * from "./components/Button";
|
|
17
18
|
export * from "./components/Card";
|
|
@@ -49,6 +50,7 @@ export * from "./components/RadioGroup";
|
|
|
49
50
|
export * from "./components/Rating";
|
|
50
51
|
export * from "./components/RouteMap";
|
|
51
52
|
export * from "./components/SaveIndicator";
|
|
53
|
+
export * from "./components/ScanProgress";
|
|
52
54
|
export * from "./components/SearchField";
|
|
53
55
|
export * from "./components/Select";
|
|
54
56
|
export * from "./components/Skeleton";
|
|
@@ -60,6 +62,7 @@ export * from "./components/Stamp";
|
|
|
60
62
|
export * from "./components/Stat";
|
|
61
63
|
export * from "./components/StatTile";
|
|
62
64
|
export * from "./components/Stepper";
|
|
65
|
+
export * from "./components/Sunburst";
|
|
63
66
|
export * from "./components/Switch";
|
|
64
67
|
export * from "./components/Tabs";
|
|
65
68
|
export * from "./components/TextField";
|
|
@@ -69,11 +72,20 @@ export * from "./components/Timeline";
|
|
|
69
72
|
export * from "./components/Toast";
|
|
70
73
|
export * from "./components/ToggleCard";
|
|
71
74
|
export * from "./components/Tooltip";
|
|
75
|
+
export * from "./components/Tray";
|
|
76
|
+
export * from "./components/Treemap";
|
|
72
77
|
export * from "./components/WeatherIcon";
|
|
73
78
|
export * from "./components/WeatherSky";
|
|
74
79
|
export { accentStyle } from "./utils/accent";
|
|
75
80
|
export { burst } from "./utils/confetti";
|
|
76
81
|
export { cx } from "./utils/cx";
|
|
82
|
+
export { countValue, easeOutCubic } from "./utils/ease";
|
|
83
|
+
export { type FlyToOptions, flyTo } from "./utils/flyTo";
|
|
84
|
+
export { baseName, formatAge, formatBytes, formatCount, formatElapsed, splitBytes } from "./utils/format";
|
|
77
85
|
export { hueFrom, initials } from "./utils/hue";
|
|
86
|
+
export { squarify, type TileRect } from "./utils/squarify";
|
|
87
|
+
export { isRelated, type SizedNode, sizeTree, type TreeNode } from "./utils/tree";
|
|
78
88
|
export { useCanvasLoop } from "./utils/useCanvasLoop";
|
|
89
|
+
export { getMotionPref, MOTION_PREF_LABELS, type MotionPref, setMotionPref, shouldAnimate, useMotionPref, } from "./utils/useMotionPref";
|
|
79
90
|
export { useReducedMotion } from "./utils/useReducedMotion";
|
|
91
|
+
export { type Size, useSize } from "./utils/useSize";
|