swl-core 1.2.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/README.md ADDED
@@ -0,0 +1,182 @@
1
+ # SWLS Core v1.2.0
2
+ **Stellar Web Language Styling** — Linguagem de estilização em português que compila para CSS.
3
+
4
+ ```
5
+ npm install -g swl-core
6
+ swls build meusite.swls
7
+ ```
8
+
9
+ ---
10
+
11
+ ## Sintaxe
12
+
13
+ Arquivos `.swls` usam parênteses para delimitar blocos e espaço como separador de propriedade/valor. Sem chaves, sem ponto-e-vírgula.
14
+
15
+ ```swls
16
+ // Variáveis
17
+ @cor-primaria: #0066FF
18
+ @raio: 8px
19
+
20
+ // Seletor com aninhamento
21
+ (div.container:
22
+ largura 100%
23
+ max-w 1200px
24
+ margem auto
25
+
26
+ (button:
27
+ fundo @cor-primaria
28
+ cor branco
29
+ borda-raio @raio
30
+ cursor ponteiro
31
+
32
+ &:pairado
33
+ opacidade 0.85
34
+ )
35
+ )
36
+
37
+ // Componente reutilizável
38
+ @componente cartao
39
+ fundo branco
40
+ padding 24px
41
+ borda-raio @raio
42
+ sombra 0 4px 12px rgba(0,0,0,0.15)
43
+
44
+ // Animação
45
+ @animar pulsar
46
+ de:
47
+ opacidade 1
48
+ para:
49
+ opacidade 0.5
50
+
51
+ // Tema
52
+ @tema escuro
53
+ @fundo #121212
54
+ @texto #f4f4f7
55
+
56
+ // Media query
57
+ @media (max-width: 768px)
58
+ (div.container:
59
+ padding 16px
60
+ )
61
+ ```
62
+
63
+ ---
64
+
65
+ ## CLI
66
+
67
+ | Comando | Descrição |
68
+ |---|---|
69
+ | `swls build arquivo.swls` | Compila para CSS |
70
+ | `swls build arquivo.swls -o saida.css` | Compila com saída definida |
71
+ | `swls dev arquivo.swls` | Modo dev com HMR (porta 3000) |
72
+ | `swls doctor` | Diagnóstico do ambiente |
73
+ | `swls version` | Versão atual |
74
+
75
+ ---
76
+
77
+ ## Instalação
78
+
79
+ ```bash
80
+ # Via npm (global)
81
+ npm install -g swl-core
82
+
83
+ # Via repositório
84
+ git clone https://github.com/swls-lang/swl-core
85
+ cd swl-core
86
+ npm install
87
+ npm link
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Extensão VS Code
93
+
94
+ A extensão está em `vscode-extension/`. Para instalar localmente:
95
+
96
+ ```bash
97
+ cd vscode-extension
98
+ npm install -g @vscode/vsce
99
+ vsce package
100
+ code --install-extension swls-language-support-1.2.0.vsix
101
+ ```
102
+
103
+ A extensão inclui:
104
+ - Syntax highlighting completo
105
+ - Autocomplete de propriedades, valores e pseudo-estados
106
+ - Hover com equivalente CSS
107
+ - Snippets para blocos comuns
108
+ - Ícone de arquivo `.swls`
109
+ - Auto-indentação de blocos
110
+
111
+ ---
112
+
113
+ ## Dicionário de Propriedades
114
+
115
+ | SWLS | CSS |
116
+ |---|---|
117
+ | `fundo` / `bg` | `background-color` |
118
+ | `cor` | `color` |
119
+ | `largura` / `w` | `width` |
120
+ | `altura` / `h` | `height` |
121
+ | `margem` / `m` | `margin` |
122
+ | `padding` / `p` | `padding` |
123
+ | `tamanho` | `font-size` |
124
+ | `peso` | `font-weight` |
125
+ | `familia` | `font-family` |
126
+ | `exibicao` | `display` |
127
+ | `posicao` | `position` |
128
+ | `borda-raio` | `border-radius` |
129
+ | `sombra` | `box-shadow` |
130
+ | `opacidade` | `opacity` |
131
+ | `transicao` | `transition` |
132
+ | `transformacao` | `transform` |
133
+ | `cursor` | `cursor` |
134
+ | `colunas` | `grid-template-columns` |
135
+ | `justificacao` | `justify-content` |
136
+ | `alinhamento-item` | `align-items` |
137
+ | `direcao` | `flex-direction` |
138
+ | `indice-z` / `z` | `z-index` |
139
+
140
+ **Valores traduzidos:** `centro`, `inicio`, `fim`, `distribuido`, `esticado`, `linha`, `coluna`, `relativa`, `absoluta`, `fixa`, `pegajosa`, `ponteiro`, `suave`, `linear`, `nenhum`, `visivel`, `escondido`, `bloco`, `inline`, `flex`, `grid`...
141
+
142
+ **Cores:** `branco`, `preto`, `cinza`, `vermelho`, `azul`, `verde`, `amarelo`, `laranja`, `roxo`, `rosa`, `marrom`, `ouro`, `transparente`...
143
+
144
+ **Pseudo-estados:** `&:pairado` (hover), `&:ativo` (active), `&:focado` (focus), `&:desabilitado` (disabled), `&:primeiro-filho`, `&:ultimo-filho`, `&:modo-escuro`, `&:antes`, `&:depois`...
145
+
146
+ ---
147
+
148
+ ## API (Node.js)
149
+
150
+ ```js
151
+ const SWLSFramework = require("swl-core");
152
+
153
+ const fw = new SWLSFramework("./estilos.swls");
154
+ fw.build(); // produção
155
+ fw.dev(); // desenvolvimento com HMR
156
+
157
+ // Plugin API
158
+ fw.use({
159
+ beforeParse: (src) => src,
160
+ afterParse: (ast) => ast,
161
+ afterGenerate: (css) => css,
162
+ });
163
+ ```
164
+
165
+ ---
166
+
167
+ ## Publicação
168
+
169
+ - **npm:** `npm publish`
170
+ - **GitHub:** `https://github.com/swls-lang/swl-core`
171
+ - **VS Code Marketplace:** `vsce publish` (requer conta Publisher)
172
+
173
+ ---
174
+
175
+ ## Limitações v1.2
176
+
177
+ - Operações matemáticas inline (`@tamanho * 2`) não são calculadas
178
+ - Prefixos de vendor (`-webkit-`, `-moz-`) devem ser escritos manualmente
179
+ - Sem suporte a `calc()` nativo com variáveis SWLS
180
+
181
+ ## Licença
182
+ MIT
package/bin/swls.js ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const SWLSFramework = require("../lib/framework");
6
+
7
+ const [,, command, ...rest] = process.argv;
8
+
9
+ function resolveFile(arg) {
10
+ if (!arg) { console.error("❌ Arquivo não informado."); process.exit(1); }
11
+ const full = path.resolve(arg);
12
+ if (!fs.existsSync(full)) { console.error(`❌ Arquivo não encontrado: ${arg}`); process.exit(1); }
13
+ return full;
14
+ }
15
+
16
+ switch (command) {
17
+ case "build": {
18
+ const file = resolveFile(rest[0]);
19
+ const outIdx = rest.indexOf("-o");
20
+ const output = outIdx !== -1 ? rest[outIdx + 1] : null;
21
+ new SWLSFramework(file).build(output);
22
+ break;
23
+ }
24
+ case "dev": {
25
+ const file = resolveFile(rest[0]);
26
+ new SWLSFramework(file).dev();
27
+ break;
28
+ }
29
+ case "doctor": {
30
+ console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
31
+ console.log("🩺 SWLS Doctor — v1.2.0");
32
+ console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
33
+ [
34
+ ["Node.js", process.version],
35
+ ["Plataforma", process.platform],
36
+ ["Compilador", "OK"],
37
+ ["Dev Server", "OK"],
38
+ ].forEach(([k, v]) => console.log(` ✔ ${k.padEnd(20)} ${v}`));
39
+ console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
40
+ break;
41
+ }
42
+ case "version":
43
+ console.log("SWLS Core v1.2.0");
44
+ break;
45
+ default:
46
+ console.log(`
47
+ SWLS Core — Stellar Web Language Styling v1.2.0
48
+
49
+ Uso:
50
+ swls build <arquivo.swls> [-o saida.css] Compila para CSS
51
+ swls dev <arquivo.swls> Modo desenvolvimento com HMR
52
+ swls doctor Diagnóstico do ambiente
53
+ swls version Versão atual
54
+ `);
55
+ }
@@ -0,0 +1,138 @@
1
+ :root[data-tema="escuro"] {
2
+ }
3
+
4
+ .cartao {
5
+ background-color: #FFFFFF;
6
+ padding: 24px;
7
+ border-radius: 8px;
8
+ box-shadow: 0 4px 12px rgba(0,0,0,0.2);
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ .cartao-destaque {
13
+ border-top: 4px solid #0066FF;
14
+ }
15
+
16
+ * {
17
+ margin: 0;
18
+ padding: 0;
19
+ box-sizing: border-box;
20
+ }
21
+
22
+ body {
23
+ background-color: #13141c;
24
+ color: #f4f4f7;
25
+ font: Arial, sans-serif;
26
+ font-size: 16px;
27
+ line-height: 1.6;
28
+ }
29
+
30
+ div.container {
31
+ width: 100%;
32
+ max-width: 1200px;
33
+ margin: auto;
34
+ padding: 0 24px;
35
+ }
36
+
37
+ nav {
38
+ display: flex;
39
+ justify-content: space-between;
40
+ align-items: center;
41
+ padding: 16px 24px;
42
+ background-color: #1b1d2a;
43
+ border-bottom: 1px solid #2e3248;
44
+ }
45
+
46
+ a.nav-link {
47
+ color: #f4f4f7;
48
+ text-decoration: none;
49
+ font-size: 14px;
50
+ font-weight: 500;
51
+ transition: cor 0.2s ease;
52
+ }
53
+
54
+ a.nav-link:hover {
55
+ color: #0066FF;
56
+ }
57
+
58
+ section.hero {
59
+ display: flex;
60
+ flex-direction: column;
61
+ align-items: center;
62
+ justify-content: center;
63
+ padding: 80px 24px;
64
+ text-align: center;
65
+ }
66
+
67
+ h1 {
68
+ font-size: 48px;
69
+ font-weight: 700;
70
+ color: #f4f4f7;
71
+ margin-bottom: 16px;
72
+ }
73
+
74
+ p.subtitulo {
75
+ font-size: 20px;
76
+ color: #a2a6b8;
77
+ max-width: 600px;
78
+ margin-bottom: 32px;
79
+ }
80
+
81
+ button.btn-primario {
82
+ background-color: #0066FF;
83
+ color: #FFFFFF;
84
+ padding: 14px 32px;
85
+ border: none;
86
+ border-radius: 8px;
87
+ font-size: 16px;
88
+ font-weight: 600;
89
+ cursor: pointer;
90
+ transition: 0.2s ease;
91
+ box-shadow: 0 4px 14px rgba(0,102,255,0.4);
92
+ }
93
+
94
+ button.btn-primario:hover {
95
+ opacity: 0.85;
96
+ transform: scale(1.03);
97
+ }
98
+
99
+ button.btn-primario:active {
100
+ transform: scale(0.98);
101
+ }
102
+
103
+ button.btn-primario:disabled {
104
+ opacity: 0.5;
105
+ cursor: not-allowed;
106
+ }
107
+
108
+ @keyframes aparecer {
109
+ from {
110
+ opacity: 0;
111
+ transform: translateY(20px);
112
+ }
113
+ to {
114
+ opacity: 1;
115
+ transform: translateY(0);
116
+ }
117
+ }
118
+
119
+ div.animado {
120
+ animation: aparecer 0.4s ease-out;
121
+ }
122
+
123
+ @media (max-width: 768px) {
124
+ nav {
125
+ flex-direction: column;
126
+ gap: 16px;
127
+ }
128
+
129
+ }
130
+
131
+ section.hero {
132
+ padding: 40px 16px;
133
+ }
134
+
135
+ h1 {
136
+ font-size: 32px;
137
+ }
138
+
@@ -0,0 +1,142 @@
1
+ // SWLS Core v1.2 — Exemplo Completo da Linguagem
2
+
3
+ // ── Variáveis ─────────────────────────────────────────────────────────────────
4
+ @cor-primaria: #0066FF
5
+ @cor-fundo: #13141c
6
+ @cor-texto: #f4f4f7
7
+ @raio: 8px
8
+ @sombra-padrao: 0 4px 12px rgba(0,0,0,0.2)
9
+
10
+ // ── Tema Escuro ───────────────────────────────────────────────────────────────
11
+ @tema escuro
12
+ @fundo #121212
13
+ @texto #f4f4f7
14
+ @superficie #1e1e2e
15
+
16
+ // ── Componentes ───────────────────────────────────────────────────────────────
17
+ @componente cartao
18
+ fundo branco
19
+ padding 24px
20
+ borda-raio @raio
21
+ sombra @sombra-padrao
22
+ conteudo-caixa borda
23
+
24
+ @componente cartao-destaque herda cartao
25
+ borda-topo 4px solida @cor-primaria
26
+
27
+ // ── Regras de Seletor ─────────────────────────────────────────────────────────
28
+ (*:
29
+ margem 0
30
+ padding 0
31
+ conteudo-caixa borda
32
+ )
33
+
34
+ (body:
35
+ fundo @cor-fundo
36
+ cor @cor-texto
37
+ fonte Arial, sans-serif
38
+ tamanho 16px
39
+ altura-linha 1.6
40
+ )
41
+
42
+ (div.container:
43
+ largura 100%
44
+ max-w 1200px
45
+ margem auto
46
+ padding 0 24px
47
+ )
48
+
49
+ (nav:
50
+ exibicao flex
51
+ justificacao distribuido
52
+ alinhamento-item centro
53
+ padding 16px 24px
54
+ fundo #1b1d2a
55
+ borda-inferior 1px solida #2e3248
56
+
57
+ (a.nav-link:
58
+ cor @cor-texto
59
+ decoracao nenhuma
60
+ tamanho 14px
61
+ peso 500
62
+ transicao cor 0.2s suave
63
+
64
+ &:pairado
65
+ cor @cor-primaria
66
+ )
67
+ )
68
+
69
+ (section.hero:
70
+ exibicao flex
71
+ direcao coluna
72
+ alinhamento-item centro
73
+ justificacao centro
74
+ padding 80px 24px
75
+ alinhamento-texto centro
76
+
77
+ (h1:
78
+ tamanho 48px
79
+ peso 700
80
+ cor @cor-texto
81
+ margem-inferior 16px
82
+ )
83
+
84
+ (p.subtitulo:
85
+ tamanho 20px
86
+ cor #a2a6b8
87
+ max-w 600px
88
+ margem-inferior 32px
89
+ )
90
+
91
+ (button.btn-primario:
92
+ fundo @cor-primaria
93
+ cor branco
94
+ padding 14px 32px
95
+ borda nenhuma
96
+ borda-raio @raio
97
+ tamanho 16px
98
+ peso 600
99
+ cursor ponteiro
100
+ transicao 0.2s suave
101
+ sombra 0 4px 14px rgba(0,102,255,0.4)
102
+
103
+ &:pairado
104
+ opacidade 0.85
105
+ transformacao scale(1.03)
106
+
107
+ &:ativo
108
+ transformacao scale(0.98)
109
+
110
+ &:desabilitado
111
+ opacidade 0.5
112
+ cursor nao-permitido
113
+ )
114
+ )
115
+
116
+ // ── Animação ──────────────────────────────────────────────────────────────────
117
+ @animar aparecer
118
+ de:
119
+ opacidade 0
120
+ transformacao translateY(20px)
121
+ para:
122
+ opacidade 1
123
+ transformacao translateY(0)
124
+
125
+ (div.animado:
126
+ animar aparecer 0.4s suave-saida
127
+ )
128
+
129
+ // ── Responsividade ────────────────────────────────────────────────────────────
130
+ @media (max-width: 768px)
131
+ (nav:
132
+ direcao coluna
133
+ gap 16px
134
+ )
135
+
136
+ (section.hero:
137
+ padding 40px 16px
138
+
139
+ (h1:
140
+ tamanho 32px
141
+ )
142
+ )
package/icons/swls.svg ADDED
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
2
+ <defs>
3
+ <linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
4
+ <stop offset="0%" style="stop-color:#0044cc"/>
5
+ <stop offset="100%" style="stop-color:#0066FF"/>
6
+ </linearGradient>
7
+ </defs>
8
+ <rect width="64" height="64" rx="10" fill="url(#bg)"/>
9
+ <text x="32" y="42" font-family="monospace" font-weight="bold" font-size="22" fill="white" text-anchor="middle">SW</text>
10
+ <rect x="8" y="48" width="48" height="3" rx="1.5" fill="rgba(255,255,255,0.4)"/>
11
+ </svg>
package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require("./lib/framework");