@rainersoft/design-tokens 1.0.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 +149 -0
- package/README.md +544 -0
- package/dist/index.cjs +944 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4623 -0
- package/dist/index.d.ts +4623 -0
- package/dist/index.js +898 -0
- package/dist/index.js.map +1 -0
- package/formats/css-vars.css +237 -0
- package/formats/tailwind.config.ts +247 -0
- package/formats/tokens.json +46 -0
- package/package.json +118 -0
- package/themes/dark.ts +89 -0
- package/themes/index.ts +99 -0
- package/themes/light.ts +88 -0
- package/tokens/accessibility.ts +280 -0
- package/tokens/colors/dark.json +173 -0
- package/tokens/colors/light.json +149 -0
- package/tokens/index.ts +263 -0
- package/tokens/radius.json +16 -0
- package/tokens/shadows.json +33 -0
- package/tokens/spacing.json +42 -0
- package/tokens/typography.json +264 -0
- package/tokens/utilities.ts +177 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Rainer Teixeira
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
================================================================================
|
|
7
|
+
SOFTWARE LICENSE AGREEMENT
|
|
8
|
+
================================================================================
|
|
9
|
+
|
|
10
|
+
This license governs the use of the rainer-design-tokens software package
|
|
11
|
+
and associated documentation files (collectively, the "Software").
|
|
12
|
+
|
|
13
|
+
================================================================================
|
|
14
|
+
DEFINITIONS
|
|
15
|
+
================================================================================
|
|
16
|
+
|
|
17
|
+
"Software" means the rainer-design-tokens package, including but not limited
|
|
18
|
+
to:
|
|
19
|
+
- Source code files
|
|
20
|
+
- Compiled and distributed files
|
|
21
|
+
- Documentation files
|
|
22
|
+
- Configuration files
|
|
23
|
+
- Example files
|
|
24
|
+
- Any other files included in the distribution
|
|
25
|
+
|
|
26
|
+
"Author" or "Copyright Holder" means Rainer Teixeira and any contributors
|
|
27
|
+
who have granted rights to the Software.
|
|
28
|
+
|
|
29
|
+
"User" or "You" means any person or entity that obtains a copy of the Software.
|
|
30
|
+
|
|
31
|
+
================================================================================
|
|
32
|
+
GRANT OF LICENSE
|
|
33
|
+
================================================================================
|
|
34
|
+
|
|
35
|
+
Permission is hereby granted, free of charge, to any person or entity
|
|
36
|
+
obtaining a copy of this Software and associated documentation files (the
|
|
37
|
+
"Software"), to deal in the Software without restriction, including without
|
|
38
|
+
limitation the rights to:
|
|
39
|
+
|
|
40
|
+
1. USE - Use the Software for any purpose, whether commercial or non-commercial
|
|
41
|
+
2. COPY - Reproduce the Software in any medium or format
|
|
42
|
+
3. MODIFY - Create derivative works based upon the Software
|
|
43
|
+
4. MERGE - Combine the Software with other software
|
|
44
|
+
5. PUBLISH - Publish the Software or derivative works
|
|
45
|
+
6. DISTRIBUTE - Distribute copies of the Software or derivative works
|
|
46
|
+
7. SUBLICENSE - Grant sublicenses of the Software or derivative works
|
|
47
|
+
8. SELL - Sell copies of the Software or derivative works
|
|
48
|
+
|
|
49
|
+
This license applies to the Software and each such recipient or user. The
|
|
50
|
+
Software may be used, copied, modified, merged, published, distributed,
|
|
51
|
+
sublicensed, and/or sold, provided that the following conditions are met:
|
|
52
|
+
|
|
53
|
+
================================================================================
|
|
54
|
+
CONDITIONS
|
|
55
|
+
================================================================================
|
|
56
|
+
|
|
57
|
+
The above copyright notice and this permission notice (including the next
|
|
58
|
+
paragraph) shall be included in all copies or substantial portions of the
|
|
59
|
+
Software.
|
|
60
|
+
|
|
61
|
+
================================================================================
|
|
62
|
+
NO WARRANTY
|
|
63
|
+
================================================================================
|
|
64
|
+
|
|
65
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
66
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
67
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
68
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
|
|
69
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
|
|
70
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
71
|
+
SOFTWARE.
|
|
72
|
+
|
|
73
|
+
================================================================================
|
|
74
|
+
LIMITATION OF LIABILITY
|
|
75
|
+
================================================================================
|
|
76
|
+
|
|
77
|
+
IN NO EVENT SHALL THE AUTHORS, COPYRIGHT HOLDERS, OR CONTRIBUTORS BE LIABLE
|
|
78
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
79
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
80
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
81
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
82
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
83
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
84
|
+
|
|
85
|
+
================================================================================
|
|
86
|
+
PATENT GRANT
|
|
87
|
+
================================================================================
|
|
88
|
+
|
|
89
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
90
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
91
|
+
irrevocable (except as stated in this section) patent license to make, have
|
|
92
|
+
made, use, offer to sell, sell, import, and otherwise transfer the Software,
|
|
93
|
+
where such license applies only to those patent claims licensable by such
|
|
94
|
+
Contributor that are necessarily infringed by their Contribution(s) alone or
|
|
95
|
+
by combination of their Contribution(s) with the Software to which such
|
|
96
|
+
Contribution(s) was submitted.
|
|
97
|
+
|
|
98
|
+
================================================================================
|
|
99
|
+
TRADEMARKS
|
|
100
|
+
================================================================================
|
|
101
|
+
|
|
102
|
+
This License does not grant permission to use the trade names, trademarks,
|
|
103
|
+
service marks, or product names of the Copyright Holder, except as required
|
|
104
|
+
for reasonable and customary use in describing the origin of the Software and
|
|
105
|
+
reproducing the content of the NOTICE file.
|
|
106
|
+
|
|
107
|
+
================================================================================
|
|
108
|
+
TERMINATION
|
|
109
|
+
================================================================================
|
|
110
|
+
|
|
111
|
+
This License and the rights granted hereunder will terminate automatically if
|
|
112
|
+
You fail to comply with terms herein and fail to cure such breach within 30
|
|
113
|
+
days of becoming aware of the breach. All sublicenses to the Software which
|
|
114
|
+
are properly granted shall survive any termination of this License. Provisions
|
|
115
|
+
which, by their nature, must remain in effect beyond the termination of this
|
|
116
|
+
License shall survive.
|
|
117
|
+
|
|
118
|
+
================================================================================
|
|
119
|
+
GOVERNING LAW
|
|
120
|
+
================================================================================
|
|
121
|
+
|
|
122
|
+
This License shall be governed by the laws of the jurisdiction in which the
|
|
123
|
+
Copyright Holder resides, without regard to its conflict of law provisions.
|
|
124
|
+
Any disputes arising under this License shall be subject to the exclusive
|
|
125
|
+
jurisdiction of the courts of that jurisdiction.
|
|
126
|
+
|
|
127
|
+
================================================================================
|
|
128
|
+
CONTACT INFORMATION
|
|
129
|
+
================================================================================
|
|
130
|
+
|
|
131
|
+
For questions, support, or licensing inquiries regarding this Software,
|
|
132
|
+
please contact:
|
|
133
|
+
|
|
134
|
+
Rainer Teixeira
|
|
135
|
+
Email: suporte@rainersoft.com.br
|
|
136
|
+
Repository: https://github.com/RainerTeixeira/rainer-design-tokens
|
|
137
|
+
Issues: https://github.com/RainerTeixeira/rainer-design-tokens/issues
|
|
138
|
+
|
|
139
|
+
================================================================================
|
|
140
|
+
ACKNOWLEDGMENTS
|
|
141
|
+
================================================================================
|
|
142
|
+
|
|
143
|
+
This Software may include third-party components that are subject to their
|
|
144
|
+
own license terms. Please refer to the package.json file and documentation
|
|
145
|
+
for information about third-party licenses.
|
|
146
|
+
|
|
147
|
+
================================================================================
|
|
148
|
+
END OF LICENSE
|
|
149
|
+
================================================================================
|
package/README.md
ADDED
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
# @rainersoft/design-tokens
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
**Enterprise-grade design tokens for modern design systems**
|
|
11
|
+
|
|
12
|
+
[Getting Started](#-installation) • [Documentation](#-documentation) • [Storybook](#-storybook---visualização-dos-tokens) • [Roadmap](./docs/roadmap.md)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 📖 Overview
|
|
19
|
+
|
|
20
|
+
`@rainersoft/design-tokens` é uma biblioteca profissional de design tokens que define a linguagem visual do RainerSoft Design System. Agnóstica de tecnologia, escalável e pronta para produção.
|
|
21
|
+
|
|
22
|
+
### ✨ Features
|
|
23
|
+
|
|
24
|
+
- 🎨 **Temas Light & Dark** - Paletas profissionais para qualquer contexto
|
|
25
|
+
- 🚀 **Zero Dependencies** - Pura performance, sem bloat
|
|
26
|
+
- 📦 **Múltiplos Formatos** - Tailwind, CSS Vars, JSON universal
|
|
27
|
+
- 🎯 **Type-Safe** - 100% TypeScript com tipos completos
|
|
28
|
+
- 🌐 **Platform Agnostic** - Use em web, mobile, desktop, jogos
|
|
29
|
+
- ♿ **Acessível** - WCAG AA compliant por padrão
|
|
30
|
+
- 📏 **8pt Grid** - Sistema de espaçamento consistente
|
|
31
|
+
- 🎭 **Cyberpunk Theme** - Dark mode com efeitos neon
|
|
32
|
+
- 📚 **Storybook** - Documentação visual interativa de todos os tokens
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 🚀 Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pnpm add @rainersoft/design-tokens
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install @rainersoft/design-tokens
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
yarn add @rainersoft/design-tokens
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 🔄 Migração do Pacote Antigo
|
|
53
|
+
|
|
54
|
+
Se você estava usando `rainer-design-tokens` ou `@rainer/design-tokens`, migre para o novo escopo da organização:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Remover pacote antigo
|
|
58
|
+
pnpm remove rainer-design-tokens
|
|
59
|
+
# ou
|
|
60
|
+
pnpm remove @rainer/design-tokens
|
|
61
|
+
|
|
62
|
+
# Instalar novo pacote
|
|
63
|
+
pnpm add @rainersoft/design-tokens
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Atualizar importações:**
|
|
67
|
+
```typescript
|
|
68
|
+
// Antes
|
|
69
|
+
import { tokens } from 'rainer-design-tokens';
|
|
70
|
+
// ou
|
|
71
|
+
import { tokens } from '@rainer/design-tokens';
|
|
72
|
+
|
|
73
|
+
// Depois
|
|
74
|
+
import { tokens } from '@rainersoft/design-tokens';
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
> **Nota**: O pacote antigo continuará disponível por um período de transição, mas recomendamos migrar para `@rainersoft/design-tokens` para receber atualizações futuras.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 🎯 Quick Start
|
|
82
|
+
|
|
83
|
+
### TypeScript/JavaScript
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { tokens, lightTheme, darkTheme } from '@rainersoft/design-tokens';
|
|
87
|
+
|
|
88
|
+
// Use tokens diretamente
|
|
89
|
+
const primaryColor = tokens.colors.light.primary.base; // #0891b2
|
|
90
|
+
const spacing = tokens.spacing['4']; // 1rem
|
|
91
|
+
const fontSize = tokens.typography.headings.h1.fontSize; // 2.25rem
|
|
92
|
+
|
|
93
|
+
// Ou use temas
|
|
94
|
+
const theme = lightTheme;
|
|
95
|
+
console.log(theme.colors.background.primary); // #ffffff
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Tailwind CSS
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
// tailwind.config.ts
|
|
102
|
+
import { tailwindConfig } from '@rainersoft/design-tokens/formats/tailwind.config';
|
|
103
|
+
|
|
104
|
+
export default {
|
|
105
|
+
...tailwindConfig,
|
|
106
|
+
content: ['./src/**/*.{js,ts,jsx,tsx}'],
|
|
107
|
+
};
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
// Use as classes
|
|
112
|
+
<div className="bg-brand text-text-primary p-4 rounded-lg shadow-md">
|
|
113
|
+
Hello World
|
|
114
|
+
</div>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### CSS Variables
|
|
118
|
+
|
|
119
|
+
```css
|
|
120
|
+
/* Import CSS vars */
|
|
121
|
+
@import '@rainersoft/design-tokens/formats/css-vars.css';
|
|
122
|
+
|
|
123
|
+
/* Use variables */
|
|
124
|
+
.button {
|
|
125
|
+
background: var(--color-brand-primary);
|
|
126
|
+
padding: var(--spacing-4);
|
|
127
|
+
border-radius: var(--radius-md);
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 📚 Storybook - Visualização dos Tokens
|
|
132
|
+
|
|
133
|
+
O Storybook da lib é focado **apenas em design tokens**, não em componentes UI.
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pnpm run storybook
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Acesse `http://localhost:6006` para explorar:
|
|
140
|
+
- 🎨 **ColorPalette** - Paletas completas (Light & Dark themes)
|
|
141
|
+
- 🎭 **ThemePreview** - Preview dos temas mostrando tokens trabalhando juntos
|
|
142
|
+
- 📝 **Typography** - Sistema de tipografia completo
|
|
143
|
+
- 📏 **Spacing** - Escala de espaçamento (8pt grid)
|
|
144
|
+
- 🔲 **Radius** - Raios de borda
|
|
145
|
+
- 🌑 **Shadows** - Sombras e efeitos glow
|
|
146
|
+
|
|
147
|
+
> **Nota**: Componentes UI (Button, Card, etc.) devem estar no Storybook do frontend, não aqui. Veja [Estrutura do Storybook](./docs/ESTRUTURA_STORYBOOK.md) para mais detalhes.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 📁 Structure
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
@rainersoft/design-tokens/
|
|
155
|
+
│
|
|
156
|
+
├── 📄 index.ts # Ponto de entrada principal da biblioteca
|
|
157
|
+
├── 📄 package.json # Configuração do pacote npm
|
|
158
|
+
├── 📄 pnpm-lock.yaml # Lock file do pnpm
|
|
159
|
+
├── 📄 tsconfig.json # Configuração TypeScript
|
|
160
|
+
├── 📄 tsup.config.ts # Configuração do bundler tsup
|
|
161
|
+
├── 📄 LICENSE # Licença MIT
|
|
162
|
+
├── 📄 README.md # Este arquivo
|
|
163
|
+
│
|
|
164
|
+
├── 🔧 Configurações
|
|
165
|
+
│ ├── .npmrc # Configuração pnpm (isolamento workspace)
|
|
166
|
+
│ ├── .gitignore # Arquivos ignorados pelo Git
|
|
167
|
+
│ ├── .npmignore # Arquivos ignorados na publicação npm
|
|
168
|
+
│ ├── .prettierrc.json # Configuração Prettier
|
|
169
|
+
│ ├── .eslintrc.json # Configuração ESLint
|
|
170
|
+
│ ├── .cspell.json # Configuração CSpell (verificação ortográfica)
|
|
171
|
+
│ └── .env # Variáveis de ambiente (local, não commitado)
|
|
172
|
+
│
|
|
173
|
+
├── 🎯 tokens/ # FONTE ÚNICA DE VERDADE (JSON + TypeScript)
|
|
174
|
+
│ ├── index.ts # Exportações principais dos tokens
|
|
175
|
+
│ ├── accessibility.ts # Utilitários de acessibilidade (WCAG)
|
|
176
|
+
│ ├── utilities.ts # Utilitários e helpers
|
|
177
|
+
│ ├── colors/
|
|
178
|
+
│ │ ├── light.json # Paleta do tema claro
|
|
179
|
+
│ │ └── dark.json # Paleta do tema escuro (cyberpunk)
|
|
180
|
+
│ ├── typography.json # Sistema de tipografia completo
|
|
181
|
+
│ ├── spacing.json # Escala de espaçamento (8pt grid)
|
|
182
|
+
│ ├── radius.json # Escala de raio de borda
|
|
183
|
+
│ └── shadows.json # Sombras e efeitos glow
|
|
184
|
+
│
|
|
185
|
+
├── 🎨 themes/ # Temas compostos
|
|
186
|
+
│ ├── index.ts # Exportações dos temas
|
|
187
|
+
│ ├── light.ts # Tema claro profissional
|
|
188
|
+
│ └── dark.ts # Tema escuro cyberpunk
|
|
189
|
+
│
|
|
190
|
+
├── 📤 formats/ # FORMATOS GERADOS AUTOMATICAMENTE
|
|
191
|
+
│ ├── tailwind.config.ts # Configuração Tailwind (gerado)
|
|
192
|
+
│ ├── css-vars.css # CSS custom properties (gerado)
|
|
193
|
+
│ └── tokens.json # Export JSON universal (gerado)
|
|
194
|
+
│
|
|
195
|
+
├── 🔧 scripts/ # Scripts de build e utilitários
|
|
196
|
+
│ ├── build-formats.ts # Orquestrador principal de build
|
|
197
|
+
│ ├── build-css.ts # Gera CSS variables
|
|
198
|
+
│ ├── build-tailwind.ts # Gera Tailwind config
|
|
199
|
+
│ ├── build-tokens-json.ts # Gera tokens.json
|
|
200
|
+
│ ├── prepare-publish.js # Prepara publicação npm
|
|
201
|
+
│ ├── setup-github.sh # Setup GitHub Actions
|
|
202
|
+
│ ├── fix-storybook.ps1 # Script PowerShell para Storybook
|
|
203
|
+
│ └── update-dates.ts # Atualiza datas na documentação
|
|
204
|
+
│
|
|
205
|
+
├── 📚 stories/ # Stories do Storybook (apenas tokens)
|
|
206
|
+
│ ├── assets/ # Assets das stories
|
|
207
|
+
│ ├── Accessibility.stories.tsx # Documentação de acessibilidade
|
|
208
|
+
│ ├── ColorPalette.stories.tsx # Paleta completa de cores
|
|
209
|
+
│ ├── ColorStates.stories.tsx # Estados de cores
|
|
210
|
+
│ ├── ThemePreview.stories.tsx # Preview dos temas
|
|
211
|
+
│ ├── Typography.stories.tsx # Sistema de tipografia
|
|
212
|
+
│ ├── TypographyHierarchy.stories.tsx # Hierarquia tipográfica
|
|
213
|
+
│ ├── Spacing.stories.tsx # Escala de espaçamento
|
|
214
|
+
│ ├── Radius.stories.tsx # Raios de borda
|
|
215
|
+
│ ├── Shadows.stories.tsx # Sombras e efeitos
|
|
216
|
+
│ └── *.mdx # Documentação MDX das stories
|
|
217
|
+
│
|
|
218
|
+
├── ⚙️ .storybook/ # Configuração do Storybook
|
|
219
|
+
│ ├── main.ts # Configuração principal
|
|
220
|
+
│ └── preview.tsx # Preview e temas do Storybook
|
|
221
|
+
│
|
|
222
|
+
├── 📦 dist/ # Saída compilada (TypeScript)
|
|
223
|
+
│ ├── index.js # CommonJS bundle
|
|
224
|
+
│ ├── index.mjs # ESM bundle
|
|
225
|
+
│ ├── index.d.ts # TypeScript definitions
|
|
226
|
+
│ ├── index.d.mts # ESM TypeScript definitions
|
|
227
|
+
│ └── *.map # Source maps
|
|
228
|
+
│
|
|
229
|
+
└── 📖 docs/ # Documentação completa
|
|
230
|
+
├── INDICE.md # Índice geral da documentação
|
|
231
|
+
├── ESTRUTURA.md # Estrutura detalhada da biblioteca
|
|
232
|
+
├── ESTRUTURA_STORYBOOK.md # Estrutura do Storybook
|
|
233
|
+
├── SISTEMA_BUILD.md # Sistema de build automatizado
|
|
234
|
+
├── guidelines.md # Guidelines de uso
|
|
235
|
+
├── GUIA_TOKENS_EXPANDIDOS.md # Guia dos tokens expandidos
|
|
236
|
+
├── GUIA_MIGRACAO.md # Guia de migração
|
|
237
|
+
├── PUBLICACAO.md # Guia de publicação
|
|
238
|
+
├── CONFIGURACAO_PNPM.md # Configuração pnpm
|
|
239
|
+
├── CONTRIBUINDO.md # Guia de contribuição
|
|
240
|
+
├── STORYBOOK.md # Documentação do Storybook
|
|
241
|
+
├── RESUMO_ESTRUTURA.md # Resumo da estrutura
|
|
242
|
+
├── HISTORICO_MUDANCAS.md # Histórico de mudanças
|
|
243
|
+
└── roadmap.md # Roadmap do projeto
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### 🎯 Princípio: JSON como Fonte Única de Verdade
|
|
247
|
+
|
|
248
|
+
- ✅ **Edite apenas**: `tokens/*.json` (arquivos JSON na pasta `tokens/`)
|
|
249
|
+
- ✅ **Edite também**: `tokens/*.ts` (utilitários e helpers em TypeScript)
|
|
250
|
+
- ✅ **Formats são gerados**: Execute `pnpm run build:formats`
|
|
251
|
+
- ❌ **NÃO edite manualmente**: `formats/*` (serão sobrescritos pelo build)
|
|
252
|
+
- ⚙️ **Configurações**: Arquivos `.npmrc`, `.eslintrc.json`, `.prettierrc.json`, etc. na raiz
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 🎨 Color System
|
|
257
|
+
|
|
258
|
+
### Light Theme
|
|
259
|
+
```typescript
|
|
260
|
+
{
|
|
261
|
+
primary: { base: '#0891b2', hover: '#06b6d4', active: '#0891b2' },
|
|
262
|
+
secondary: { base: '#9333ea', hover: '#a855f7', active: '#9333ea' },
|
|
263
|
+
accent: { base: '#db2777', hover: '#e11d48', active: '#db2777' },
|
|
264
|
+
status: { success: '#22c55e', error: '#ef4444', warning: '#f59e0b', info: '#3b82f6' }
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Dark Theme (Cyberpunk)
|
|
269
|
+
```typescript
|
|
270
|
+
{
|
|
271
|
+
primary: { base: '#00e6ff', hover: '#33eeff', active: '#00e6ff' },
|
|
272
|
+
secondary: { base: '#7d00ff', hover: '#9333ea', active: '#7d00ff' },
|
|
273
|
+
accent: { base: '#ff006e', hover: '#ff3385', active: '#ff006e' },
|
|
274
|
+
effects: { glowCyan: '0 0 20px rgba(0, 230, 255, 0.5)' }
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## 📏 Typography
|
|
281
|
+
|
|
282
|
+
Sistema hierárquico completo com headings, subtítulos, body, captions, buttons e labels:
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
{
|
|
286
|
+
headings: {
|
|
287
|
+
h1: { fontSize: '2.25rem', fontWeight: '700', lineHeight: '1.2' },
|
|
288
|
+
h2: { fontSize: '1.875rem', fontWeight: '600', lineHeight: '1.3' },
|
|
289
|
+
// ... h3, h4, h5, h6
|
|
290
|
+
},
|
|
291
|
+
body: {
|
|
292
|
+
large: { fontSize: '1.125rem', lineHeight: '1.75' },
|
|
293
|
+
medium: { fontSize: '1rem', lineHeight: '1.5' },
|
|
294
|
+
small: { fontSize: '0.875rem', lineHeight: '1.5' }
|
|
295
|
+
},
|
|
296
|
+
// ... subtitle, caption, button, label, code
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## 🌓 Theme Switching
|
|
303
|
+
|
|
304
|
+
```tsx
|
|
305
|
+
// React example
|
|
306
|
+
function ThemeToggle() {
|
|
307
|
+
const [theme, setTheme] = useState('light');
|
|
308
|
+
|
|
309
|
+
const toggleTheme = () => {
|
|
310
|
+
const newTheme = theme === 'light' ? 'dark' : 'light';
|
|
311
|
+
setTheme(newTheme);
|
|
312
|
+
document.documentElement.classList.toggle('dark');
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
return <button onClick={toggleTheme}>Toggle Theme</button>;
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## 📚 Documentation
|
|
322
|
+
|
|
323
|
+
📖 **[Documentação Completa](./docs/INDICE.md)** - Índice geral de toda a documentação
|
|
324
|
+
|
|
325
|
+
### Guias Principais
|
|
326
|
+
|
|
327
|
+
- [**Guidelines**](./docs/guidelines.md) - Como usar os tokens
|
|
328
|
+
- [**ESTRUTURA.md**](./docs/ESTRUTURA.md) - Estrutura detalhada da biblioteca
|
|
329
|
+
- [**SISTEMA_BUILD.md**](./docs/SISTEMA_BUILD.md) - Sistema de build automatizado
|
|
330
|
+
- [**Roadmap**](./docs/roadmap.md) - Futuras features e versões
|
|
331
|
+
- [**GUIA_TOKENS_EXPANDIDOS**](./docs/GUIA_TOKENS_EXPANDIDOS.md) - Guia dos tokens expandidos (cores e tipografia)
|
|
332
|
+
- [**GUIA_MIGRACAO**](./docs/GUIA_MIGRACAO.md) - Guia de migração para v3.0.0
|
|
333
|
+
- [**PUBLICACAO**](./docs/PUBLICACAO.md) - Guia de publicação no GitHub/npm
|
|
334
|
+
|
|
335
|
+
### Storybook
|
|
336
|
+
|
|
337
|
+
- [**STORYBOOK.md**](./docs/STORYBOOK.md) - Documentação visual dos tokens
|
|
338
|
+
- [**ESTRUTURA_STORYBOOK.md**](./docs/ESTRUTURA_STORYBOOK.md) - Separação entre tokens e componentes
|
|
339
|
+
|
|
340
|
+
### Referência Rápida
|
|
341
|
+
|
|
342
|
+
- [**RESUMO_ESTRUTURA.md**](./docs/RESUMO_ESTRUTURA.md) - Resumo da estrutura
|
|
343
|
+
- [**HISTORICO_MUDANCAS.md**](./docs/HISTORICO_MUDANCAS.md) - Histórico de mudanças
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## 🎯 Use Cases
|
|
348
|
+
|
|
349
|
+
### ✅ Perfect For
|
|
350
|
+
|
|
351
|
+
- 🌐 Websites e aplicações web
|
|
352
|
+
- 📱 Aplicativos mobile (React Native, Flutter)
|
|
353
|
+
- 🖥️ Aplicações desktop (Electron, Tauri)
|
|
354
|
+
- 🎮 Interfaces de jogos (Unity, Unreal, Godot)
|
|
355
|
+
- 🎨 Design systems corporativos
|
|
356
|
+
- 🚀 MVPs e protótipos rápidos
|
|
357
|
+
|
|
358
|
+
### ❌ Not Included
|
|
359
|
+
|
|
360
|
+
Esta biblioteca contém **apenas tokens**, não componentes UI.
|
|
361
|
+
|
|
362
|
+
Para componentes, use:
|
|
363
|
+
- [shadcn/ui](https://ui.shadcn.com/) com estes tokens
|
|
364
|
+
- [Radix UI](https://www.radix-ui.com/) + custom styling
|
|
365
|
+
- Sua própria biblioteca de componentes
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## 🔧 Integration Examples
|
|
370
|
+
|
|
371
|
+
### Next.js + Tailwind
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
// tailwind.config.ts
|
|
375
|
+
import { tailwindConfig } from '@rainersoft/design-tokens/formats/tailwind.config';
|
|
376
|
+
|
|
377
|
+
export default tailwindConfig;
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
```tsx
|
|
381
|
+
// app/layout.tsx
|
|
382
|
+
export default function RootLayout({ children }: { children: React.Node }) {
|
|
383
|
+
return (
|
|
384
|
+
<html lang="pt-BR" className="dark">
|
|
385
|
+
<body>{children}</body>
|
|
386
|
+
</html>
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Vite + CSS
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
// main.ts
|
|
395
|
+
import '@rainersoft/design-tokens/formats/css-vars.css';
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### shadcn/ui
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
// Use tokens as base for shadcn/ui theming
|
|
402
|
+
import { tokens } from '@rainer/design-tokens';
|
|
403
|
+
|
|
404
|
+
export const shadcnTheme = {
|
|
405
|
+
primary: tokens.colors.light.primary.base,
|
|
406
|
+
secondary: tokens.colors.light.secondary.base,
|
|
407
|
+
accent: tokens.colors.light.accent.base,
|
|
408
|
+
// ... map other tokens
|
|
409
|
+
};
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## 📦 Exports
|
|
415
|
+
|
|
416
|
+
```typescript
|
|
417
|
+
// Main tokens
|
|
418
|
+
import { tokens } from '@rainer/design-tokens';
|
|
419
|
+
|
|
420
|
+
// Individual token categories
|
|
421
|
+
import {
|
|
422
|
+
lightThemeColors,
|
|
423
|
+
darkThemeColors,
|
|
424
|
+
typographyTokens,
|
|
425
|
+
spacingTokens,
|
|
426
|
+
radiusTokens,
|
|
427
|
+
shadowTokens
|
|
428
|
+
} from '@rainersoft/design-tokens/tokens';
|
|
429
|
+
|
|
430
|
+
// Themes
|
|
431
|
+
import { lightTheme, darkTheme } from '@rainersoft/design-tokens/themes';
|
|
432
|
+
|
|
433
|
+
// Formats
|
|
434
|
+
import { tailwindConfig } from '@rainersoft/design-tokens/formats/tailwind.config';
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## 🧪 Development
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
# Install dependencies
|
|
443
|
+
pnpm install
|
|
444
|
+
|
|
445
|
+
# Build tokens (gera formats + compila TypeScript)
|
|
446
|
+
pnpm run build
|
|
447
|
+
|
|
448
|
+
# Gerar apenas formatos (CSS, Tailwind, JSON)
|
|
449
|
+
pnpm run build:formats
|
|
450
|
+
|
|
451
|
+
# Gerar formatos individuais
|
|
452
|
+
pnpm run build:css # Gera formats/css-vars.css
|
|
453
|
+
pnpm run build:tailwind # Gera formats/tailwind.config.ts
|
|
454
|
+
pnpm run build:tokens-json # Gera formats/tokens.json
|
|
455
|
+
|
|
456
|
+
# Storybook (visualização dos tokens)
|
|
457
|
+
pnpm run storybook # Inicia Storybook em http://localhost:6006
|
|
458
|
+
pnpm run build-storybook # Gera build estático do Storybook
|
|
459
|
+
|
|
460
|
+
# Run tests
|
|
461
|
+
pnpm test
|
|
462
|
+
|
|
463
|
+
# Type check
|
|
464
|
+
pnpm run type-check
|
|
465
|
+
|
|
466
|
+
# Lint
|
|
467
|
+
pnpm run lint
|
|
468
|
+
|
|
469
|
+
# Clean
|
|
470
|
+
pnpm run clean # Remove dist/
|
|
471
|
+
pnpm run clean:all # Remove node_modules, lock, dist, etc.
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### 🔄 Workflow de Desenvolvimento
|
|
475
|
+
|
|
476
|
+
1. **Edite os tokens** em `tokens/*.json` (fonte única de verdade)
|
|
477
|
+
2. **Edite utilitários** em `tokens/*.ts` se necessário (accessibility, utilities)
|
|
478
|
+
3. **Execute o build**: `pnpm run build:formats` (gera formatos)
|
|
479
|
+
4. **Os formatos são gerados automaticamente** em `formats/`
|
|
480
|
+
5. **Compile o TypeScript**: `pnpm run build` (já inclui build:formats + tsup)
|
|
481
|
+
6. **Visualize no Storybook**: `pnpm run storybook` para ver todos os tokens de forma interativa
|
|
482
|
+
7. **Execute testes**: `pnpm test` antes de commitar
|
|
483
|
+
8. **⚠️ IMPORTANTE**: Sempre commit `dist/` após build (veja [PUBLICACAO.md](./docs/PUBLICACAO.md#-por-que-dist-está-commitado))
|
|
484
|
+
|
|
485
|
+
### 📚 Storybook - Visualização dos Tokens
|
|
486
|
+
|
|
487
|
+
O Storybook da lib documenta **apenas design tokens**, não componentes UI.
|
|
488
|
+
|
|
489
|
+
**Stories disponíveis:**
|
|
490
|
+
- 🎨 **ColorPalette** - Paletas completas de cores (Light & Dark)
|
|
491
|
+
- 🎭 **ThemePreview** - Preview dos temas mostrando tokens em ação
|
|
492
|
+
- 📝 **Typography** - Sistema completo de tipografia
|
|
493
|
+
- 📏 **Spacing** - Escala de espaçamento (8pt grid)
|
|
494
|
+
- 🔲 **Radius** - Raios de borda
|
|
495
|
+
- 🌑 **Shadows** - Sombras e efeitos glow
|
|
496
|
+
|
|
497
|
+
**Separação de responsabilidades:**
|
|
498
|
+
- ✅ **Este Storybook**: Apenas tokens (cores, tipografia, espaçamento, etc.)
|
|
499
|
+
- ✅ **Storybook do Frontend**: Componentes UI (Button, Card, Input, etc.)
|
|
500
|
+
|
|
501
|
+
Para mais detalhes sobre a estrutura, consulte [**Estrutura do Storybook**](./docs/ESTRUTURA_STORYBOOK.md).
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## 🤝 Contributing
|
|
506
|
+
|
|
507
|
+
Contributions are welcome! Please read our [Contributing Guide](./docs/CONTRIBUINDO.md) first.
|
|
508
|
+
|
|
509
|
+
---
|
|
510
|
+
|
|
511
|
+
## 📄 License
|
|
512
|
+
|
|
513
|
+
MIT © [Rainer Teixeira](https://github.com/RainerTeixeira)
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## 🔗 Links
|
|
518
|
+
|
|
519
|
+
- **GitHub**: [RainerTeixeira/rainer-design-tokens](https://github.com/RainerTeixeira/rainer-design-tokens)
|
|
520
|
+
- **NPM**: [@rainersoft/design-tokens](https://www.npmjs.com/package/@rainersoft/design-tokens)
|
|
521
|
+
- **Website**: [rainersoft.com.br](https://rainersoft.com.br)
|
|
522
|
+
- **Email**: suporte@rainersoft.com.br
|
|
523
|
+
|
|
524
|
+
## 🛠️ Tech Stack
|
|
525
|
+
|
|
526
|
+
- **Language**: TypeScript 5.3+ (strict mode)
|
|
527
|
+
- **Package Manager**: pnpm 9+
|
|
528
|
+
- **Build Tool**: tsup (TypeScript bundler)
|
|
529
|
+
- **Linter**: ESLint + TypeScript ESLint
|
|
530
|
+
- **Formatter**: Prettier
|
|
531
|
+
- **Testing**: Jest
|
|
532
|
+
- **Documentation**: Storybook 10
|
|
533
|
+
- **Publish**: GitHub Actions (GitHub Packages + npm)
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
<div align="center">
|
|
538
|
+
|
|
539
|
+
**Made with ❤️ by Rainer Teixeira**
|
|
540
|
+
|
|
541
|
+

|
|
542
|
+

|
|
543
|
+
|
|
544
|
+
</div>
|