@juau/zuri 0.0.0-stage → 0.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.
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAdd = ngAdd;
4
+ const schematics_1 = require("@angular-devkit/schematics");
5
+ const workspace_1 = require("@schematics/angular/utility/workspace");
6
+ const TOKENS_IMPORT = "@import '@juau/zuri/styles/tokens.css';";
7
+ const FONT_HREF = 'https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;600;700;800&display=swap';
8
+ const FONT_LINKS = [
9
+ '<link rel="preconnect" href="https://fonts.googleapis.com" />',
10
+ '<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />',
11
+ `<link href="${FONT_HREF}" rel="stylesheet" />`,
12
+ ];
13
+ const BODY_RULE = `
14
+ body {
15
+ margin: 0;
16
+ background: var(--zur-canvas);
17
+ color: var(--zur-body);
18
+ font: var(--zur-font-body);
19
+ }
20
+ `;
21
+ /**
22
+ * `ng add @juau/zuri`: importa os tokens no styles global, aplica o estilo base do
23
+ * body e coloca a fonte Nunito Sans no index.html. Pode rodar mais de uma vez sem
24
+ * duplicar nada.
25
+ */
26
+ function ngAdd(options) {
27
+ return async (tree, context) => {
28
+ const workspace = await (0, workspace_1.getWorkspace)(tree);
29
+ const projectName = options.project ??
30
+ Array.from(workspace.projects.keys()).find((name) => workspace.projects.get(name)?.extensions['projectType'] === 'application');
31
+ const project = projectName ? workspace.projects.get(projectName) : undefined;
32
+ if (!project) {
33
+ throw new schematics_1.SchematicsException('Nenhuma aplicação encontrada. Use --project <nome>.');
34
+ }
35
+ const buildOptions = (project.targets.get('build')?.options ?? {});
36
+ const root = project.sourceRoot ?? `${project.root ? project.root + '/' : ''}src`;
37
+ // 1) styles global: tokens + estilo base do body
38
+ const styles = buildOptions['styles'] ?? [];
39
+ const stylePath = styles
40
+ .map((s) => (typeof s === 'string' ? s : s.input))
41
+ .find((s) => /\.(css|scss|sass|less)$/.test(s) && tree.exists(s)) ?? `${root}/styles.css`;
42
+ const current = tree.exists(stylePath) ? tree.readText(stylePath) : '';
43
+ if (current.includes('@juau/zuri/styles/tokens.css')) {
44
+ context.logger.info(`Tokens do Zuri já estavam em ${stylePath}.`);
45
+ }
46
+ else {
47
+ const body = current.includes('--zur-canvas') ? '' : BODY_RULE;
48
+ const next = `${TOKENS_IMPORT}\n${current.trimStart() ? '\n' + current.trimStart() : ''}${body}`;
49
+ if (tree.exists(stylePath))
50
+ tree.overwrite(stylePath, next);
51
+ else
52
+ tree.create(stylePath, next);
53
+ context.logger.info(`Tokens do Zuri importados em ${stylePath}.`);
54
+ }
55
+ // 2) index.html: fonte Nunito Sans
56
+ const indexOption = buildOptions['index'];
57
+ const indexPath = typeof indexOption === 'string'
58
+ ? indexOption
59
+ : indexOption?.input ?? `${root}/index.html`;
60
+ if (!tree.exists(indexPath)) {
61
+ context.logger.warn(`Não achei ${indexPath}; adicione a fonte Nunito Sans à mão.`);
62
+ }
63
+ else {
64
+ const html = tree.readText(indexPath);
65
+ if (html.includes('Nunito+Sans')) {
66
+ context.logger.info(`A fonte Nunito Sans já estava em ${indexPath}.`);
67
+ }
68
+ else if (!html.includes('</head>')) {
69
+ context.logger.warn(`${indexPath} não tem </head>; adicione a fonte à mão.`);
70
+ }
71
+ else {
72
+ const links = FONT_LINKS.map((l) => ` ${l}`).join('\n');
73
+ tree.overwrite(indexPath, html.replace('</head>', `${links}\n </head>`));
74
+ context.logger.info(`Fonte Nunito Sans adicionada em ${indexPath}.`);
75
+ }
76
+ }
77
+ context.logger.info("Pronto. Importe os componentes de '@juau/zuri' onde for usar, ex.: imports: [ZurButton].");
78
+ };
79
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "ZuriNgAdd",
4
+ "title": "Zuri ng-add",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "Projeto que vai receber o Zuri. Padrão: a primeira aplicação do workspace.",
10
+ "$default": { "$source": "projectName" }
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,170 @@
1
+ /* ============================================================
2
+ Zuri Design System — Design Tokens
3
+ Tema claro em :root · tema escuro em [data-theme="dark"]
4
+ Alternância via ZurThemeService / <zur-theme-toggle> (sol/lua)
5
+ ============================================================ */
6
+
7
+ :root,
8
+ [data-theme='light'] {
9
+ /* ── Marca ─────────────────────────────────────────────── */
10
+ --zur-primary: #35d49b;
11
+ --zur-primary-hover: #2bc38c;
12
+ --zur-primary-active: #23ad7b;
13
+ --zur-primary-soft: #d7f7ea;
14
+ --zur-on-primary: #0c2b1e;
15
+ --zur-on-primary-soft: #0c4a33;
16
+
17
+ /* ── Superfícies ───────────────────────────────────────── */
18
+ --zur-canvas: #f6faf8;
19
+ --zur-surface-soft: #f3faf7;
20
+ --zur-surface-strong: #e7f4ee;
21
+ --zur-surface-raised: #ffffff;
22
+ --zur-hairline: #dde8e2;
23
+ --zur-hairline-soft: #ebf2ee;
24
+
25
+ /* ── Texto ─────────────────────────────────────────────── */
26
+ --zur-ink: #15271f;
27
+ --zur-body: #3d4f47;
28
+ --zur-muted: #5f6f67;
29
+ --zur-ink-inverse: #f3faf7;
30
+
31
+ /* ── Semânticas ────────────────────────────────────────── */
32
+ --zur-success: #1a9e63;
33
+ --zur-success-soft: #d9f3e6;
34
+ --zur-warning: #d97706;
35
+ --zur-warning-soft: #fdeed7;
36
+ --zur-error: #e5484d;
37
+ --zur-error-soft: #fde2e3;
38
+ --zur-info: #3b82f6;
39
+ --zur-info-soft: #dcebfe;
40
+ /* Texto sobre as cores semânticas (badge, alert, mensagens de erro): 4,5:1 sobre o
41
+ fundo soft e sobre o canvas. As cores-base acima ficam para ícones e bordas. */
42
+ --zur-success-text: #14794c;
43
+ --zur-warning-text: #a25904;
44
+ --zur-error-text: #c91d22;
45
+ --zur-info-text: #0b5ee7;
46
+
47
+ /* ── Tipografia (Nunito Sans — arredondada amigável) ───── */
48
+ --zur-font-family: 'Nunito Sans', -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
49
+
50
+ --zur-font-display-xl: 800 64px/1.08 var(--zur-font-family);
51
+ --zur-font-display-lg: 800 48px/1.12 var(--zur-font-family);
52
+ --zur-font-display-md: 700 36px/1.18 var(--zur-font-family);
53
+ --zur-font-headline: 700 28px/1.25 var(--zur-font-family);
54
+ --zur-font-title: 600 20px/1.3 var(--zur-font-family);
55
+ --zur-font-body-lg: 400 18px/1.6 var(--zur-font-family);
56
+ --zur-font-body: 400 16px/1.55 var(--zur-font-family);
57
+ --zur-font-body-sm: 400 14px/1.45 var(--zur-font-family);
58
+ --zur-font-caption: 500 13px/1.35 var(--zur-font-family);
59
+ --zur-font-badge: 700 12px/1.2 var(--zur-font-family);
60
+ --zur-font-button: 600 16px/1.25 var(--zur-font-family);
61
+
62
+ --zur-tracking-display-xl: -1.6px;
63
+ --zur-tracking-display-lg: -1px;
64
+ --zur-tracking-display-md: -0.5px;
65
+
66
+ /* ── Raios (suave: 8 controles · 14 cards · full pills) ── */
67
+ --zur-radius-xs: 4px;
68
+ --zur-radius-sm: 8px;
69
+ --zur-radius-md: 14px;
70
+ --zur-radius-lg: 20px;
71
+ --zur-radius-xl: 32px;
72
+ --zur-radius-full: 9999px;
73
+
74
+ /* ── Espaçamento (generoso editorial) ──────────────────── */
75
+ --zur-space-xxs: 4px;
76
+ --zur-space-xs: 8px;
77
+ --zur-space-sm: 12px;
78
+ --zur-space-md: 16px;
79
+ --zur-space-lg: 24px;
80
+ --zur-space-xl: 32px;
81
+ --zur-space-xxl: 48px;
82
+ --zur-space-3xl: 64px;
83
+ --zur-space-section: 96px;
84
+ --zur-space-section-lg: 128px;
85
+
86
+ /* ── Elevação (tier ÚNICO — Airbnb) ────────────────────── */
87
+ --zur-shadow-float:
88
+ 0 0 0 1px rgba(0, 0, 0, 0.02),
89
+ 0 2px 6px rgba(0, 0, 0, 0.04),
90
+ 0 4px 8px rgba(0, 0, 0, 0.10);
91
+ --zur-scrim: rgba(0, 0, 0, 0.5);
92
+
93
+ /* ── Controles ─────────────────────────────────────────── */
94
+ --zur-control-height-sm: 36px;
95
+ --zur-control-height-md: 48px;
96
+ --zur-control-height-lg: 56px;
97
+ --zur-focus-ring: 0 0 0 2px var(--zur-canvas), 0 0 0 4px var(--zur-primary);
98
+
99
+ color-scheme: light;
100
+ }
101
+
102
+ /* ============================================================
103
+ Tema escuro — redesenhado com a filosofia de imersão quase-preta
104
+ do Spotify (conteúdo em primeiro plano, UI quase invisível),
105
+ mantendo a identidade Zuri: leve tintura verde, escada de
106
+ elevação em degraus sutis e o verde-menta ainda vibrante.
107
+ Valores não copiados do Spotify — só a filosofia foi importada.
108
+ Tema claro permanece intocado.
109
+ ============================================================ */
110
+ [data-theme='dark'] {
111
+ /* marca — mantida vibrante e multiuso, sem alteração */
112
+ --zur-primary: #3ee6a8;
113
+ --zur-primary-hover: #58ecb6;
114
+ --zur-primary-active: #2bd398;
115
+ --zur-primary-soft: #143d2e;
116
+ --zur-on-primary: #07251a;
117
+ --zur-on-primary-soft: #3ee6a8;
118
+
119
+ /* fundo quase-preto com tintura verde sutil (antes: verde-negro saturado) */
120
+ --zur-canvas: #151a17;
121
+ /* escada de elevação em degraus próximos — Spotify-like, mas verde */
122
+ --zur-surface-soft: #1b211d;
123
+ --zur-surface-strong: #232a25;
124
+ --zur-surface-raised: #1b211d;
125
+ /* bordas mantidas como já eram — não alteradas nesta revisão */
126
+ --zur-hairline: #23382f;
127
+ --zur-hairline-soft: #1a2d25;
128
+
129
+ /* texto quase neutro — a menta deve brilhar só nos acentos */
130
+ --zur-ink: #f3f5f4;
131
+ --zur-body: #c3cac7;
132
+ --zur-muted: #8c968f;
133
+ --zur-ink-inverse: #15271f;
134
+
135
+ --zur-success: #34d08c;
136
+ --zur-success-soft: #11352a;
137
+ --zur-warning: #f59e0b;
138
+ --zur-warning-soft: #3a2c10;
139
+ --zur-error: #f26d71;
140
+ --zur-error-soft: #3d1d20;
141
+ --zur-info: #60a5fa;
142
+ --zur-info-soft: #16293f;
143
+ /* no escuro as cores-base já passam de 4,5:1 sobre os fundos */
144
+ --zur-success-text: #34d08c;
145
+ --zur-warning-text: #f59e0b;
146
+ --zur-error-text: #f26d71;
147
+ --zur-info-text: #60a5fa;
148
+
149
+ /* sombra única mais pesada — sombras leves somem sobre fundo quase-preto */
150
+ --zur-shadow-float:
151
+ 0 0 0 1px rgba(0, 0, 0, 0.35),
152
+ 0 4px 10px rgba(0, 0, 0, 0.45),
153
+ 0 12px 28px rgba(0, 0, 0, 0.55);
154
+ --zur-scrim: rgba(0, 0, 0, 0.65);
155
+
156
+ /* foco mais discreto no escuro — anel único fino, sem halo duplo */
157
+ --zur-focus-ring: 0 0 0 2px var(--zur-primary);
158
+
159
+ color-scheme: dark;
160
+ }
161
+
162
+ /* ── Base global opcional ─────────────────────────────────── */
163
+ .zur-root,
164
+ body.zur-root,
165
+ .zur-theme-scope {
166
+ background: var(--zur-canvas);
167
+ color: var(--zur-body);
168
+ font: var(--zur-font-body);
169
+ transition: background-color 200ms ease, color 200ms ease;
170
+ }