blip-tokens 2.0.2 → 2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blip-tokens",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "build/icons.js",
@@ -13,15 +13,37 @@
13
13
  "./assets/manifest": "./build/assets/v1/manifest.json",
14
14
  "./build/json/*": "./build/json/*",
15
15
  "./build/scss/*": "./build/scss/*",
16
- "./build/css/*": "./build/css/*"
16
+ "./build/css/*": "./build/css/*",
17
+ "./tokens": {
18
+ "types": "./build/tokens.d.ts",
19
+ "import": "./build/tokens.js"
20
+ },
21
+ "./tokens/metadata": "./build/json/uai-metadata.json",
22
+ "./tokens/light": "./build/json/uai-light.tokens.json",
23
+ "./tokens/dark": "./build/json/uai-dark.tokens.json",
24
+ "./tokens/shadows": "./build/json/uai-shadows.json",
25
+ "./tokens/text-styles": "./build/json/uai-text-styles.json",
26
+ "./css": "./build/css/uai.css",
27
+ "./css/colors": "./build/css/uai-colors.css",
28
+ "./css/typography": "./build/css/uai-typography.css",
29
+ "./css/dimensions": "./build/css/uai-dimensions.css",
30
+ "./css/shadows": "./build/css/uai-shadows.css",
31
+ "./scss/colors-light": "./build/scss/uai-colors-light.scss",
32
+ "./scss/colors-dark": "./build/scss/uai-colors-dark.scss",
33
+ "./scss/typography": "./build/scss/uai-typography.scss",
34
+ "./scss/dimensions": "./build/scss/uai-dimensions.scss",
35
+ "./scss/shadows": "./build/scss/uai-shadows.scss"
17
36
  },
18
37
  "scripts": {
19
38
  "build": "node config.cjs",
20
39
  "clean": "rm -rf build",
21
40
  "prepublishOnly": "node config.cjs",
22
- "test": "node --test scripts/test/*.test.cjs",
23
- "test:ci": "mkdir -p TestResults/coverage && node --test --experimental-test-coverage --test-reporter=junit --test-reporter=lcov --test-reporter-destination=TestResults/junit.xml --test-reporter-destination=TestResults/coverage/lcov.info scripts/test/*.test.cjs",
24
- "lint": "node --check config.cjs && node --check scripts/generate_assets.cjs && node --check scripts/release_assets.cjs",
41
+ "test": "node --test --test-concurrency=1 scripts/test/*.test.cjs tests/*.test.js",
42
+ "test:ci": "mkdir -p TestResults/coverage && node --test --test-concurrency=1 --experimental-test-coverage --test-reporter=junit --test-reporter=lcov --test-reporter-destination=TestResults/junit.xml --test-reporter-destination=TestResults/coverage/lcov.info scripts/test/*.test.cjs tests/*.test.js",
43
+ "lint": "node --check config.cjs && node --check scripts/generate_assets.cjs && node --check scripts/release_assets.cjs && node --check scripts/build_tokens.js && node --check scripts/figma-tokens.js && node --check scripts/figma-styles.js && node --check scripts/sync_tokens.js && node --check scripts/sync_styles.js && node --check scripts/collect_tokens.js",
44
+ "tokens:sync": "node scripts/sync_tokens.js",
45
+ "tokens:styles:sync": "node scripts/sync_styles.js",
46
+ "tokens:collect": "node scripts/collect_tokens.js",
25
47
  "semantic-release": "semantic-release"
26
48
  },
27
49
  "publishConfig": {
@@ -35,7 +57,8 @@
35
57
  "jest": "^30.5.2",
36
58
  "jest-junit": "^17.0.0",
37
59
  "semantic-release": "^25.0.3",
38
- "style-dictionary": "^2.8.3"
60
+ "style-dictionary": "^2.8.3",
61
+ "style-dictionary-v5": "npm:style-dictionary@^5.6.1"
39
62
  },
40
63
  "repository": {
41
64
  "type": "git",
@@ -1,166 +0,0 @@
1
- # AD-003: Gerar tipos para importação de assets em outros projetos
2
-
3
- ## Status
4
-
5
- 🔄 **EM REVISÃO** - Proposto em 27/11/2025
6
-
7
- ## Objetivo
8
- Padronizar o consumo de assets exportados por `blip-tokens` usando nomes de ícones extraídos diretamente do sistema de arquivos, garantindo segurança de tipos e sincronização automática dos nomes com os arquivos SVG disponíveis.
9
-
10
- ## Contexto
11
- O pacote `blip-tokens` passa a expor arrays e tipos compatíveis com TypeScript para representar os ícones disponíveis nas pastas `assets/icons/outline` e `assets/icons/solid`. Isso evita divergências entre componentes que referenciam ícones e o conjunto real de arquivos SVG.
12
-
13
- ### Opções de importação
14
- #### Arrays em tempo de execução
15
- ```typescript
16
- import { OutlineIcons, SolidIcons, AllIcons } from 'blip-tokens/icons';
17
-
18
- // Uso na aplicação
19
- console.log(OutlineIcons); // ["add", "edit", "delete", ...]
20
- console.log(SolidIcons); // ["add", "attention", ...]
21
- console.log(AllIcons); // ["add", "attention", "delete", ...]
22
- ```
23
-
24
- #### Tipos TypeScript
25
- ```typescript
26
- import type { OutlineIcon, SolidIcon, IconName } from 'blip-tokens/icons';
27
-
28
- // Nomes de ícones com segurança de tipos
29
- function renderIcon(name: OutlineIcon) {
30
- // O TypeScript sugere e valida os nomes automaticamente
31
- return `<icon name="${name}" />`;
32
- }
33
-
34
- renderIcon("add"); // ✅ Válido
35
- renderIcon("invalid"); // ❌ Erro do TypeScript
36
- ```
37
-
38
- #### Funções auxiliares
39
- ```typescript
40
- import { isOutlineIcon, isSolidIcon, isValidIcon } from 'blip-tokens/icons';
41
-
42
- // Validação em tempo de execução
43
- if (isOutlineIcon("add")) {
44
- console.log("Este ícone existe no conjunto outline");
45
- }
46
-
47
- if (isSolidIcon("attention")) {
48
- console.log("Este ícone existe no conjunto solid");
49
- }
50
-
51
- if (isValidIcon("sparkle-ai")) {
52
- console.log("Este ícone existe em qualquer conjunto");
53
- }
54
- ```
55
-
56
- ### Contagem de ícones
57
- - **Outline Icons**: 303
58
- - **Solid Icons**: 366
59
- - **Unique Icons**: 587
60
-
61
- ### Observações
62
- - Os nomes de ícones são extraídos dos nomes dos arquivos (sem a extensão `.svg`).
63
- - Ícones em subpastas (como `solid/flags/`) usam apenas o nome do arquivo.
64
- - Os nomes são ordenados alfabeticamente.
65
- - Os nomes são normalizados para minúsculas; espaços viram hífen. Todos os demais caracteres presentes no nome do arquivo (incluindo acentos, números e pontuação) são preservados nos nomes exportados, sem remoção ou substituição adicional.
66
-
67
- ## Benefícios
68
- - Segurança de tipos: o TypeScript bloqueia nomes inválidos em tempo de compilação.
69
- - Autocompletar: IDEs sugerem automaticamente os nomes válidos.
70
- - Sempre sincronizado: os nomes vêm diretamente do sistema de arquivos, sem JSON intermediário.
71
- - Sem duplicações: o sistema garante nomes únicos graças ao escaneamento da pasta.
72
- - Validação em runtime: funções auxiliares checam dinamicamente se um nome existe.
73
- - Bundle otimizado: `AllIcons` é pré-computado durante o build para evitar duplicação (~45% menor).
74
-
75
- ## Exemplos
76
- ### Componente React
77
- ```tsx
78
- import type { OutlineIcon, SolidIcon } from 'blip-tokens/icons';
79
-
80
- interface IconProps {
81
- name: OutlineIcon | SolidIcon;
82
- variant: 'outline' | 'solid';
83
- }
84
-
85
- export function Icon({ name, variant }: IconProps) {
86
- const iconData = getIconData(name, variant);
87
- return <img src={iconData} alt={name} />;
88
- }
89
-
90
- // Uso com autocomplete
91
- <Icon name="add" variant="outline" />
92
- <Icon name="attention" variant="solid" />
93
- ```
94
-
95
- ### Seletor dinâmico de ícones
96
- ```tsx
97
- import { OutlineIcons, SolidIcons } from 'blip-tokens/icons';
98
- import type { IconName } from 'blip-tokens/icons';
99
- import { useState } from 'react';
100
-
101
- export function IconPicker() {
102
- const [selected, setSelected] = useState<IconName | null>(null);
103
-
104
- return (
105
- <div>
106
- <h3>Outline Icons ({OutlineIcons.length})</h3>
107
- <div className="icon-grid">
108
- {OutlineIcons.map(name => (
109
- <button key={name} onClick={() => setSelected(name)}>
110
- {name}
111
- </button>
112
- ))}
113
- </div>
114
-
115
- <h3>Solid Icons ({SolidIcons.length})</h3>
116
- <div className="icon-grid">
117
- {SolidIcons.map(name => (
118
- <button key={name} onClick={() => setSelected(name)}>
119
- {name}
120
- </button>
121
- ))}
122
- </div>
123
-
124
- {selected && <p>Selecionado: {selected}</p>}
125
- </div>
126
- );
127
- }
128
- ```
129
-
130
- ### Validação de formulário
131
- ```typescript
132
- import { isValidIcon } from 'blip-tokens/icons';
133
-
134
- function validateIconInput(userInput: string) {
135
- if (!isValidIcon(userInput)) {
136
- throw new Error(`"${userInput}" não é um nome de ícone válido`);
137
- }
138
- return userInput;
139
- }
140
- ```
141
-
142
- ### Busca e filtragem
143
- ```typescript
144
- import { AllIcons } from 'blip-tokens/icons';
145
-
146
- function searchIcons(query: string) {
147
- return AllIcons.filter(name =>
148
- name.toLowerCase().includes(query.toLowerCase())
149
- );
150
- }
151
-
152
- // Busca por todos os ícones de seta
153
- const arrowIcons = searchIcons('arrow');
154
- // ["arrow-ball-down", "arrow-ball-left", "arrow-down", ...]
155
- ```
156
-
157
- ## Changelog
158
-
159
- | Data | Versão | Mudança | Autor |
160
- |------|--------|---------|-------|
161
- | 2025-11-27 | 1.0 | Decisão inicial e implementação | Dev Team |
162
-
163
- ---
164
-
165
- **Última Atualização**: 27 de Novembro de 2025
166
- **Próxima Revisão**: 27 de Maio de 2026 (6 meses)