@inchurch/matcha-theme 20.277.0 → 21.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.
@@ -0,0 +1,334 @@
1
+ // =============================================================================
2
+ // MATCHA — EMISSÃO DOS TOKENS DO TEMA (CSS custom properties)
3
+ // =============================================================================
4
+ // Lógica de emissão À MÃO (NÃO é gerado). Monta as --matcha-* de um tema.
5
+ // Os DADOS vêm de arquivos próprios, Figma-sourced:
6
+ // - cor: _color-tokens.scss ($matcha-color-tokens — synced via sync-tokens)
7
+ // - primitivas: _primitives.scss (gerado · --matcha-prim-*)
8
+ // - aliases: _semantic-aliases.scss (gerado · papel → primitiva)
9
+ // - não-cor: migrarão p/ _static-tokens.scss (gerado de global.json — A2)
10
+ // O mixin matcha-css-custom-properties($theme) (API PÚBLICA — nome preservado) emite
11
+ // cor (via matcha-emit-color-properties) + estáticos + mode-dependent + aliases.
12
+ // IMPORT ORDER: main.scss importa _color-tokens ANTES deste arquivo.
13
+ // =============================================================================
14
+ @use "sass:map";
15
+
16
+ // ═══════════════════════════════════════════════════════════════════════════
17
+ // 3. EMISSOR GENÉRICO — mapa flat (token → valor) vira --matcha-color-<token>.
18
+ // Usado pelo mixin canônico abaixo e por matcha-define-theme() (theme API).
19
+ // ═══════════════════════════════════════════════════════════════════════════
20
+ // $aliases (opcional): token → "--matcha-prim-*". Quando presente p/ um token, emite
21
+ // `var(--matcha-prim-*)` (Camada 2 referencia a primitiva) em vez do hex literal.
22
+ // A rota clássica (matcha-css-custom-properties) passa $matcha-prim-aliases-{light,dark};
23
+ // matcha-define-theme() não passa (mantém hex computado dos seeds — whitelabel intacto).
24
+ @mixin matcha-emit-color-properties($colors, $aliases: ()) {
25
+ @each $token, $value in $colors {
26
+ $alias: map.get($aliases, $token);
27
+ @if $alias {
28
+ --matcha-color-#{$token}: var(#{$alias});
29
+ } @else {
30
+ --matcha-color-#{$token}: #{$value};
31
+ }
32
+ }
33
+ }
34
+
35
+ // ═══════════════════════════════════════════════════════════════════════════
36
+ // 4. MIXIN CANÔNICO — assinatura preservada (retrocompat).
37
+ // ═══════════════════════════════════════════════════════════════════════════
38
+ @mixin matcha-css-custom-properties($is-dark: false) {
39
+ // API nova: recebe SÓ o modo (is-dark). As cores vêm das synced tokens do Figma
40
+ // ($matcha-colors-light/dark), não de um mapa $theme construído por light-theme().
41
+
42
+ // ── Cores semânticas (ver $matcha-color-tokens acima) ────────────────────
43
+ // Aliases sólidos → var(--matcha-prim-*); derivados/alphas/cross-semantic → hex literal.
44
+ @include matcha-emit-color-properties(
45
+ if($is-dark, $matcha-colors-dark, $matcha-colors-light),
46
+ if($is-dark, $matcha-prim-aliases-dark, $matcha-prim-aliases-light)
47
+ );
48
+
49
+ // ── Cores de PALETA como tokens (base mode-flipped) ───────────────────────
50
+ // Alimentam as utility classes .color-red/.background-grey/.{name} etc. via var(),
51
+ // substituindo o caminho compile-time getRed($theme)/Material. Value-preserving:
52
+ // mesmo valor que getRed/getRedAlpha/getRedContrast (shade 500 light / 100 dark).
53
+ // Mantém as classes funcionando (painel intacto) e theme-agnósticas no ponto de uso.
54
+ $-palette-shade: if($is-dark, 100, 500);
55
+ @each $-name, $-pal in (
56
+ "red": $red, "pink": $pink, "purple": $purple, "deep-purple": $deep-purple, "indigo": $indigo,
57
+ "blue": $blue, "light-blue": $light-blue, "cyan": $cyan, "teal": $teal, "green": $green,
58
+ "light-green": $light-green, "lime": $lime, "yellow": $yellow, "amber": $amber, "orange": $orange,
59
+ "deep-orange": $deep-orange, "brown": $brown, "grey": $grey, "blue-grey": $blue-grey
60
+ ) {
61
+ $-c: map.get($-pal, $-palette-shade);
62
+ $-cc: map.get(map.get($-pal, 'contrast'), $-palette-shade);
63
+ --matcha-color-#{$-name}: #{$-c};
64
+ --matcha-color-#{$-name}-alpha: #{rgba($-c, 0.1)};
65
+ --matcha-color-#{$-name}-contrast: #{$-cc};
66
+ --matcha-color-#{$-name}-contrast-alpha: #{rgba($-cc, 0.1)};
67
+ }
68
+
69
+ // ── Feedback namespace (matcha/color/feedback/* canon DSV3) ───────────────
70
+ // Aliases semânticos pros tokens base — namespace dedicado pra status/banners/
71
+ // table row variants. Naming match Figma DSV3 (flat: feedback/info, sem suffix).
72
+ --matcha-color-feedback-info: var(--matcha-color-info);
73
+ --matcha-color-feedback-success: var(--matcha-color-success);
74
+ --matcha-color-feedback-warn: var(--matcha-color-warn);
75
+ --matcha-color-feedback-danger: var(--matcha-color-danger);
76
+
77
+ // Variantes alpha pra row backgrounds, badges filled-alpha, etc.
78
+ --matcha-color-feedback-info-alpha: var(--matcha-color-info-alpha);
79
+ --matcha-color-feedback-success-alpha: var(--matcha-color-success-alpha);
80
+ --matcha-color-feedback-warn-alpha: var(--matcha-color-warn-alpha);
81
+ --matcha-color-feedback-danger-alpha: var(--matcha-color-danger-alpha);
82
+
83
+ // Surface hover (bg tinted pra hover em row de table)
84
+ --matcha-color-feedback-info-surface-hover: var(--matcha-color-info-surface-hover);
85
+ --matcha-color-feedback-success-surface-hover: var(--matcha-color-success-surface-hover);
86
+ --matcha-color-feedback-warn-surface-hover: var(--matcha-color-warn-surface-hover);
87
+ --matcha-color-feedback-danger-surface-hover: var(--matcha-color-danger-surface-hover);
88
+
89
+ // ── Spacing (14 tokens — matches matcha/space/* exato) ────────────────────
90
+ // ── Tokens não-cor (gerados do Figma) — ver _static-tokens.scss (A2) ──
91
+ @include matcha-static-tokens();
92
+
93
+
94
+ // ── Border radius (8 tokens — matches matcha/radius/* exato) ─────────────
95
+ // Alias legado pra usos em páginas de doc (refatorar depois pra usar radius-2xl)
96
+ --matcha-radius-card: var(--matcha-radius-2xl);
97
+
98
+ // ── Border width (4 tokens — matches matcha/border/* exato) ──────────────
99
+
100
+ // ── Font family (1 token) ────────────────────────────────────────────────
101
+
102
+ // ── Font size (13 tokens — matches matcha/font/size/* from Figma) ─────────
103
+
104
+ // ── Font weight (8 tokens — matches matcha/font/weight/* exato) ──────────
105
+ // Canônico Figma: extralight (200), light (300), normal (400), medium (500),
106
+ // semi-bold (600), bold (700), extrabold (800), black (900)
107
+ // Código mantém regular/semibold por retrocompat + aliases Figma-exatos
108
+ --matcha-weight-regular: 400;
109
+ --matcha-weight-semibold: 600;
110
+
111
+ // ── Typography — 15 canonical text styles (1:1 com matcha/text/* Figma) ──
112
+ // 13 styles publicados + `display` e `p-tiny` (recriados no Figma 2026-06-03).
113
+ --matcha-text-display-hero: 36px; // matcha/text/Stat Card (EB 36/40/-1.2)
114
+ --matcha-text-display: 32px; // matcha/text/display (Bold 32/40/-0.3)
115
+ --matcha-text-headline: 24px; // matcha/text/headline (Bold 24/32/-0.3)
116
+ --matcha-text-title-lg: 20px; // matcha/text/title-large (SemiBold 20/28)
117
+ --matcha-text-title-md: 18px; // matcha/text/title-medium (SemiBold 18/24)
118
+ --matcha-text-title-sm: 16px; // matcha/text/title-small (SemiBold 16/22)
119
+ --matcha-text-title-xs: 14px; // matcha/text/title-tiny (ExtraBold 14/20)
120
+ --matcha-text-body-lg: 16px; // matcha/text/p-large (Regular 16/24)
121
+ --matcha-text-body-md: 14px; // matcha/text/p-medium (Regular 14/20)
122
+ --matcha-text-body-sm: 12px; // matcha/text/p-small (Regular 12/16)
123
+ --matcha-text-p-tiny: 11px; // matcha/text/p-tiny (Regular 11/14/0.3)
124
+ --matcha-text-label-lg: 16px; // matcha/text/label-large (Medium 16/22)
125
+ --matcha-text-label-md: 14px; // matcha/text/label-medium (Medium 14/20)
126
+ --matcha-text-label-sm: 12px; // matcha/text/label-small (Medium 12/16)
127
+ --matcha-text-overline: 10px; // matcha/text/Uppercase (SemiBold 10/14/1)
128
+
129
+ // Shorthand aliases (usados massivamente em components/*.scss)
130
+ --matcha-text-xs: var(--matcha-text-p-tiny); // 11px — legendas, metadados
131
+ --matcha-text-sm: var(--matcha-text-body-sm); // 12px — texto auxiliar
132
+ --matcha-text-md: var(--matcha-text-body-md); // 14px — corpo padrão
133
+ --matcha-text-lg: var(--matcha-text-body-lg); // 16px — texto de destaque
134
+ --matcha-text-xl: var(--matcha-text-title-md); // 18px — títulos de grupo
135
+
136
+ // ── Line heights — canônico (matches Figma text styles) ──────────────────
137
+ --matcha-leading-display-hero: 40px; // Stat Card
138
+ --matcha-leading-display: 40px;
139
+ --matcha-leading-headline: 32px;
140
+ --matcha-leading-title-lg: 28px;
141
+ --matcha-leading-title-md: 24px;
142
+ --matcha-leading-title-sm: 22px;
143
+ --matcha-leading-title-xs: 20px; // title-tiny
144
+ --matcha-leading-body-lg: 24px;
145
+ --matcha-leading-body-md: 20px;
146
+ --matcha-leading-body-sm: 16px;
147
+ --matcha-leading-p-tiny: 14px;
148
+ --matcha-leading-label-lg: 22px;
149
+ --matcha-leading-label-md: 20px;
150
+ --matcha-leading-label-sm: 16px;
151
+ --matcha-leading-overline: 14px; // Uppercase
152
+
153
+ // ── Tracking (letter-spacing) — só styles com valor não-zero ─────────────
154
+ --matcha-tracking-display-hero: -1.2px; // Stat Card
155
+ --matcha-tracking-display: -0.3px;
156
+ --matcha-tracking-headline: -0.3px;
157
+ --matcha-tracking-overline: 1px; // Uppercase
158
+ --matcha-tracking-p-tiny: 0.3px;
159
+
160
+ // Shorthand aliases para line-heights (acompanham --matcha-text-*)
161
+ --matcha-leading-xs: var(--matcha-leading-p-tiny); // 14px
162
+ --matcha-leading-sm: var(--matcha-leading-body-sm); // 16px
163
+ --matcha-leading-md: var(--matcha-leading-body-md); // 20px
164
+ --matcha-leading-lg: var(--matcha-leading-body-lg); // 24px
165
+ --matcha-leading-xl: var(--matcha-leading-title-md); // 24px
166
+
167
+ // ── Line height primitives (4 tokens — matches matcha/line-height/*) ─────
168
+
169
+ // ── Letter spacing (primitives + semantic aliases) ───────────────────────
170
+ // Semantic aliases alinhados com Figma text styles
171
+ --matcha-letter-spacing-button: 0.2px; // matcha/text/button-*
172
+ --matcha-letter-spacing-caption: 0.3px; // matcha/text/caption + link-sm
173
+
174
+ // ── Elevation (4 shadow tokens) ──────────────────────────────────────────
175
+ --matcha-shadow-1: #{if($is-dark, $shadow-1-dark, $shadow-1-light)};
176
+ --matcha-shadow-2: #{if($is-dark, $shadow-2-dark, $shadow-2-light)};
177
+ --matcha-shadow-3: #{if($is-dark, $shadow-3-dark, $shadow-3-light)};
178
+ --matcha-shadow-4: #{if($is-dark, $shadow-4-dark, $shadow-4-light)};
179
+
180
+ // ── Vars estruturais de componente (mode-dependentes, ex-@if $is-dark) ───
181
+ // Bordas que só existiam no dark + shimmer do skeleton. No light viram no-op
182
+ // (0/transparent) pra não alterar layout. O $is-dark aqui é o seletor de modo
183
+ // legítimo da emissão (mesmo papel dos shadows acima) — não é o $is-dark
184
+ // espalhado nos componentes, que foi eliminado na migração runtime-theming.
185
+ --matcha-skeleton-shimmer: #{if($is-dark, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.5))};
186
+ --matcha-chart-card-border: #{if($is-dark, 1px solid rgba(#212121, 0.06), 0 solid transparent)};
187
+ --matcha-section-border: #{if($is-dark, 1px solid rgba(#212121, 0.06), 0 solid transparent)};
188
+ --matcha-calendar-border: #{if($is-dark, 1px solid var(--matcha-color-surface-border), 0 solid transparent)};
189
+ --matcha-drawer-border: #{if($is-dark, 1px solid var(--matcha-color-surface-border), 0 solid transparent)};
190
+ // .text-boxed (tarja de texto) — alpha sobre branco no dark / sobre preto no light.
191
+ --matcha-color-text-boxed-bg: #{if($is-dark, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.12))};
192
+ --matcha-color-text-boxed-fg: #{if($is-dark, rgba(255, 255, 255, 0.54), rgba(0, 0, 0, 0.54))};
193
+
194
+ // ── Animation (4 tokens — matches matcha/duration/* from Figma) ──────────
195
+
196
+ // ── Easing (4 tokens — matches matcha/easing/* from Figma) ───────────────
197
+
198
+ // ── Opacity (7 tokens — matches matcha/opacity/* from Figma) ─────────────
199
+ --matcha-opacity-overlay-soft: 0.40;
200
+ // Específico do matcha/option (Figma DSV3 14237:113) — diferente do disabled global (0.38)
201
+ --matcha-opacity-option-disabled: 0.5;
202
+
203
+ // ── State layers (matches matcha/state-layer/* from Figma) ────────────────
204
+ // Aliases legados (usados nos componentes atuais)
205
+ --matcha-state-hover: var(--matcha-state-layer-hover);
206
+ --matcha-state-active: var(--matcha-state-layer-pressed);
207
+ --matcha-state-focus-ring-width: 2px;
208
+ --matcha-state-focus-ring-offset: 2px;
209
+
210
+ // ── Scrim / Overlay (Figma matcha/overlay Type=Modal / Type=Drawer) ──────
211
+ --matcha-scrim-modal: rgba(0, 0, 0, 0.5);
212
+ --matcha-scrim-modal-blur: 6px;
213
+ --matcha-scrim-drawer: rgba(0, 0, 0, 0.3);
214
+ --matcha-scrim-drawer-blur: 4px;
215
+
216
+ // ── Icon sizes (4 tokens — matches matcha/icon/size/* exato) ─────────────
217
+
218
+ // ── Avatar sizes (1:1 com Figma matcha/avatar — Type=Photo, Size variants)
219
+ --matcha-avatar-xs: 24px;
220
+ --matcha-avatar-sm: 32px;
221
+ --matcha-avatar-md: 40px;
222
+ --matcha-avatar-lg: 56px;
223
+ --matcha-avatar-xl: 80px;
224
+ --matcha-avatar-2xl: 96px;
225
+ // Status indicator — 1:1 com Figma (Status ellipse em cada Size variant)
226
+ --matcha-avatar-status-xs: 6px;
227
+ --matcha-avatar-status-sm: 8px;
228
+ --matcha-avatar-status-md: 10px;
229
+ --matcha-avatar-status-lg: 12px;
230
+ --matcha-avatar-status-xl: 14px;
231
+ --matcha-avatar-status-2xl: 16px;
232
+
233
+ // ── Z-index (8 tokens — matches matcha/z-index/* from Figma) ─────────────
234
+ // Panel flutuante (matcha-panel) — acima de modal pra suportar select/menu
235
+ // dentro de modal. Renderizado via portal-to-body fora de stacking contexts.
236
+ --matcha-z-popover-floating: 10001;
237
+
238
+ // ── Grid (22 tokens — 1:1 com matcha/grid/* do Figma) ────────────────────
239
+ // Frames (breakpoints)
240
+ // Chrome
241
+ --matcha-grid-header-height-mobile: 48px;
242
+ // Gutters (espaço entre colunas)
243
+ // Column widths (largura INDIVIDUAL de coluna) — Figma verdadeiro
244
+ // Content widths (área útil total) — Figma verdadeiro
245
+
246
+ // Public-facing column widths (site institucional/landing — breakpoint-aware)
247
+
248
+ // Horizontal offsets (distância da borda do frame ao primeiro col da grid)
249
+
250
+ // ── Breakpoints (6 tokens — Tailwind-aligned, expostos como CSS vars) ────
251
+ // Pra container queries, JS-side responsive logic (`matchMedia`) e media
252
+ // queries inline (`@media (min-width: var(...))` em CSS moderno). Valores
253
+ // alinhados ao padrão Tailwind/Chakra — familiares e cobrem todos os tiers
254
+ // (mobile pequeno até desktop wide). 1:1 com Figma `matcha/bp/*`.
255
+ //
256
+ // NOTA: SCSS `@mixin breakpoint(...)` em `_breakpoints-tokens.scss` usa
257
+ // valores Angular Material legacy (600/1024/1440/1920) — DESALINHADO destes.
258
+ // Em refactors novos, prefira CSS custom prop `var(--matcha-bp-md)` em vez
259
+ // do mixin SCSS.
260
+
261
+ // ═════════════════════════════════════════════════════════════════════════
262
+ // 16. NAMING-PARITY ALIASES
263
+ // Aliases que espelham o nome exato das variables do Figma, garantindo que
264
+ // dev possa referenciar o token pelo nome que vê no Figma.
265
+ // ═════════════════════════════════════════════════════════════════════════
266
+
267
+ // Figma: matcha/color/surface/background → ↔ --matcha-color-surface-bg
268
+ --matcha-color-surface-background: var(--matcha-color-surface-bg);
269
+ --matcha-color-surface-background-alpha: var(--matcha-color-surface-bg-alpha);
270
+ --matcha-color-surface-background-inverse: var(--matcha-color-surface-bg-inverse);
271
+
272
+ // Figma: matcha/color/neutral/default → ↔ --matcha-color-neutral
273
+ --matcha-color-neutral-default: var(--matcha-color-neutral);
274
+
275
+ // Figma: matcha/color/interaction/focus-ring → ↔ --matcha-color-focus-ring
276
+ --matcha-color-interaction-focus-ring: var(--matcha-color-focus-ring);
277
+
278
+ // Figma: matcha/z-index/{base,dropdown,…} → ↔ --matcha-z-{base,dropdown,…}
279
+ --matcha-z-index-base: var(--matcha-z-base);
280
+ --matcha-z-index-dropdown: var(--matcha-z-dropdown);
281
+ --matcha-z-index-sticky: var(--matcha-z-sticky);
282
+ --matcha-z-index-popover: var(--matcha-z-popover);
283
+ --matcha-z-index-tooltip: var(--matcha-z-tooltip);
284
+ --matcha-z-index-modal-bg: var(--matcha-z-modal-bg);
285
+ --matcha-z-index-modal: var(--matcha-z-modal);
286
+ --matcha-z-index-overlay: var(--matcha-z-overlay);
287
+ --matcha-z-index-popover-floating: var(--matcha-z-popover-floating);
288
+
289
+ // Figma: matcha/font/weight/semi-bold → ↔ --matcha-weight-semibold
290
+ --matcha-font-weight-extralight: var(--matcha-weight-extralight);
291
+ --matcha-font-weight-light: var(--matcha-weight-light);
292
+ --matcha-font-weight-semi-bold: var(--matcha-weight-semibold);
293
+ --matcha-font-weight-regular: var(--matcha-weight-regular);
294
+ --matcha-font-weight-medium: var(--matcha-weight-medium);
295
+ --matcha-font-weight-bold: var(--matcha-weight-bold);
296
+ --matcha-font-weight-extrabold: var(--matcha-weight-extrabold);
297
+ --matcha-font-weight-black: var(--matcha-weight-black);
298
+
299
+ // ═════════════════════════════════════════════════════════════════════════
300
+ // 17. GRADIENTS
301
+ // Gradients tonais semânticos. Compostos por 2 stops (alpha → surface-card)
302
+ // pra dar fade lateral em banners. Mantém compat com Figma — lá cada stop
303
+ // é uma variable separada (gradients não são tipo nativo de variable).
304
+ // Centralizar aqui evita repetir o linear-gradient em cada componente.
305
+ // ═════════════════════════════════════════════════════════════════════════
306
+
307
+ // Figma DSV3 (matcha/banner 19080:308): tone="info" mapeia pra primary-alpha
308
+ // (#64b5f6 azul), não info-alpha (cyan/turquesa) — alinhamento visual com border + eyebrow.
309
+ --matcha-gradient-banner-info: linear-gradient(
310
+ 90deg,
311
+ var(--matcha-color-primary-alpha) 0%,
312
+ var(--matcha-color-surface-card) 100%
313
+ );
314
+ --matcha-gradient-banner-success: linear-gradient(
315
+ 90deg,
316
+ var(--matcha-color-success-alpha) 0%,
317
+ var(--matcha-color-surface-card) 100%
318
+ );
319
+ --matcha-gradient-banner-warning: linear-gradient(
320
+ 90deg,
321
+ var(--matcha-color-warn-alpha) 0%,
322
+ var(--matcha-color-surface-card) 100%
323
+ );
324
+ --matcha-gradient-banner-accent: linear-gradient(
325
+ 90deg,
326
+ var(--matcha-color-accent-alpha) 0%,
327
+ var(--matcha-color-surface-card) 100%
328
+ );
329
+ --matcha-gradient-banner-danger: linear-gradient(
330
+ 90deg,
331
+ var(--matcha-color-danger-alpha) 0%,
332
+ var(--matcha-color-surface-card) 100%
333
+ );
334
+ }