synthesisui 0.16.511 → 0.16.513
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/dist/cn-codegen.js +40 -3
- package/dist/install-marks.js +7 -1
- package/dist/new-project-theme.js +44 -2
- package/package.json +1 -1
package/dist/cn-codegen.js
CHANGED
|
@@ -150,7 +150,7 @@ function borderGroup(variants: string, rest: string, cls: string): string {
|
|
|
150
150
|
(tail.startsWith("[") && !isArbitraryColor(tail));
|
|
151
151
|
if (isWidth) return \`\${variants}border\${side}-width\`;
|
|
152
152
|
if (BORDER_STYLES.has(tail)) return \`\${variants}border-style\`;
|
|
153
|
-
if (COLORS.has(tail) || COLOR_KEYWORDS.has(tail) || isArbitraryColor(tail)) {
|
|
153
|
+
if (COLORS.has(tail) || COLOR_KEYWORDS.has(tail) || isPaletteStep(tail) || isArbitraryColor(tail)) {
|
|
154
154
|
return \`\${variants}border\${side}-color\`;
|
|
155
155
|
}
|
|
156
156
|
return \`\${variants}\${cls}\`;
|
|
@@ -166,9 +166,32 @@ function isArbitraryColor(v: string): boolean {
|
|
|
166
166
|
* Returning the class itself is the safe answer: an unknown class then collides
|
|
167
167
|
* only with an identical one, so nothing is ever dropped by mistake.
|
|
168
168
|
*/
|
|
169
|
+
/**
|
|
170
|
+
* THE LAST COLON OUTSIDE BRACKETS ends the variants. \`data-[disabled]:[opacity:0.5]\` has a colon INSIDE the
|
|
171
|
+
* arbitrary property, and \`lastIndexOf\` cut there.
|
|
172
|
+
*/
|
|
173
|
+
function variantCut(cls: string): number {
|
|
174
|
+
let depth = 0;
|
|
175
|
+
let cut = -1;
|
|
176
|
+
for (let i = 0; i < cls.length; i++) {
|
|
177
|
+
const ch = cls[i];
|
|
178
|
+
if (ch === "[") depth++;
|
|
179
|
+
else if (ch === "]") depth--;
|
|
180
|
+
else if (ch === ":" && depth === 0) cut = i;
|
|
181
|
+
}
|
|
182
|
+
return cut;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** A palette colour with a step - \`sand-900\`, \`moss-600\` - is a colour even when the system does not name it. */
|
|
186
|
+
function isPaletteStep(v: string): boolean {
|
|
187
|
+
return /^[a-z]+(-[a-z]+)*-[0-9]{2,3}$/.test(v);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const OUTLINE_STYLES = new Set(["none", "dashed", "dotted", "double", "hidden"]);
|
|
191
|
+
|
|
169
192
|
function groupOf(cls: string): string {
|
|
170
193
|
// A variant is part of the identity: \`hover:bg-x\` must not replace \`bg-y\`.
|
|
171
|
-
const cut = cls
|
|
194
|
+
const cut = variantCut(cls);
|
|
172
195
|
const variants = cut === -1 ? "" : cls.slice(0, cut + 1);
|
|
173
196
|
let base = cut === -1 ? cls : cls.slice(cut + 1);
|
|
174
197
|
|
|
@@ -179,6 +202,10 @@ function groupOf(cls: string): string {
|
|
|
179
202
|
|
|
180
203
|
if (DISPLAYS.has(base)) return \`\${variants}display\`;
|
|
181
204
|
|
|
205
|
+
// \`[transition:…]\` sets exactly the property it names - grouped by it, so the caller's replaces the base's.
|
|
206
|
+
const arbitrary = /^\\[([a-z-]+):/.exec(base);
|
|
207
|
+
if (arbitrary) return \`\${variants}\${arbitrary[1]}\`;
|
|
208
|
+
|
|
182
209
|
const dash = base.indexOf("-");
|
|
183
210
|
const head = dash === -1 ? base : base.slice(0, dash);
|
|
184
211
|
const rest = dash === -1 ? "" : base.slice(dash + 1);
|
|
@@ -197,7 +224,7 @@ function groupOf(cls: string): string {
|
|
|
197
224
|
// The two families a prefix cannot settle, answered by this system's names.
|
|
198
225
|
if (head === "text") {
|
|
199
226
|
if (TEXT_SIZES.has(rest)) return \`\${variants}font-size\`;
|
|
200
|
-
if (COLORS.has(rest) || rest.startsWith("[")) return \`\${variants}text-color\`;
|
|
227
|
+
if (COLORS.has(rest) || isPaletteStep(rest) || rest.startsWith("[")) return \`\${variants}text-color\`;
|
|
201
228
|
return \`\${variants}\${cls}\`;
|
|
202
229
|
}
|
|
203
230
|
if (head === "font") {
|
|
@@ -206,6 +233,16 @@ function groupOf(cls: string): string {
|
|
|
206
233
|
return \`\${variants}\${cls}\`;
|
|
207
234
|
}
|
|
208
235
|
if (head === "border") return borderGroup(variants, rest, cls);
|
|
236
|
+
// Every \`transition-*\` sets transition-property, and so does \`[transition:…]\`.
|
|
237
|
+
if (head === "transition") return \`\${variants}transition\`;
|
|
238
|
+
if (head === "outline") {
|
|
239
|
+
if (rest.startsWith("offset")) return \`\${variants}outline-offset\`;
|
|
240
|
+
if (rest === "" || OUTLINE_STYLES.has(rest)) return \`\${variants}outline-style\`;
|
|
241
|
+
if ([...rest].every((ch) => ch >= "0" && ch <= "9")) return \`\${variants}outline-width\`;
|
|
242
|
+
if (COLORS.has(rest) || COLOR_KEYWORDS.has(rest) || isPaletteStep(rest) || isArbitraryColor(rest))
|
|
243
|
+
return \`\${variants}outline-color\`;
|
|
244
|
+
return \`\${variants}\${cls}\`;
|
|
245
|
+
}
|
|
209
246
|
|
|
210
247
|
for (const p of PREFIXES) {
|
|
211
248
|
if (base === p || base.startsWith(\`\${p}-\`)) return \`\${variants}\${p}\`;
|
package/dist/install-marks.js
CHANGED
|
@@ -355,7 +355,13 @@
|
|
|
355
355
|
* bloco do `CLAUDE.md` ensina a leitura da primeira tela em vez do `/sui-import-ds`; com o `rules.json` e o impeccable no
|
|
356
356
|
* projeto, diz que o revisor dele é só da criação. Uma pasta escrita antes manda o agente importar e não fala do revisor.
|
|
357
357
|
*/
|
|
358
|
-
|
|
358
|
+
/**
|
|
359
|
+
* 0.16.508 -> 0.16.513 em 24/10, e o passo 1 dá **SIM** (a largura não vira espaço): o `init` declara
|
|
360
|
+
* `--max-width-<nome>: var(--container-<nome>)` para cada espaçamento do sistema com nome de tamanho de contêiner. Uma pasta
|
|
361
|
+
* escrita antes deixa `max-w-xl` virar `var(--spacing-xl)` - no Post Proof, 3rem e um título com uma palavra por linha.
|
|
362
|
+
* O conserto ficou numa branch local de 16/10 a 24/10 (jornada "o estado da arte do design"); 0.16.500 saiu sem ele.
|
|
363
|
+
*/
|
|
364
|
+
export const MATERIALISER_SINCE = "0.16.513";
|
|
359
365
|
/**
|
|
360
366
|
* A ÚLTIMA VERSÃO EM QUE O QUE O HOOK RODA MUDOU.
|
|
361
367
|
*
|
|
@@ -79,6 +79,37 @@ function theirNameFor(ours) {
|
|
|
79
79
|
return `--duration-${m[1]}`;
|
|
80
80
|
return null;
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* A LARGURA NÃO VIRA ESPAÇO (16/10, medido no experimento das camadas). No Tailwind v4, `max-w-<nome>` lê o
|
|
84
|
+
* `--spacing-<nome>` quando ele existe, antes do `--container-<nome>`: o Post Proof escreve `--spacing-xl: 3rem`, e o
|
|
85
|
+
* `max-w-xl` que o agente usava como largura de leitura (36rem) virava 3rem - títulos com uma palavra por linha.
|
|
86
|
+
* Declarar `--max-width-<nome>` faz o `max-w-*` voltar a ser largura; `px-xl`, `gap-xl` e o resto continuam no espaçamento
|
|
87
|
+
* do sistema (testado no Tailwind 4.3.3).
|
|
88
|
+
*/
|
|
89
|
+
const CONTAINER_SIZES = new Set([
|
|
90
|
+
"3xs",
|
|
91
|
+
"2xs",
|
|
92
|
+
"xs",
|
|
93
|
+
"sm",
|
|
94
|
+
"md",
|
|
95
|
+
"lg",
|
|
96
|
+
"xl",
|
|
97
|
+
"2xl",
|
|
98
|
+
"3xl",
|
|
99
|
+
"4xl",
|
|
100
|
+
"5xl",
|
|
101
|
+
"6xl",
|
|
102
|
+
"7xl",
|
|
103
|
+
]);
|
|
104
|
+
export function widthGuards(names) {
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const n of names) {
|
|
107
|
+
const m = /^--spacing-(.+)$/.exec(n);
|
|
108
|
+
if (m && CONTAINER_SIZES.has(m[1]))
|
|
109
|
+
out.push(` --max-width-${m[1]}: var(--container-${m[1]});`);
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
82
113
|
export async function writeNewProjectTheme(root, tokensCss, slug, version) {
|
|
83
114
|
const sheets = await sheetsOf(root);
|
|
84
115
|
const own = new Set();
|
|
@@ -116,6 +147,7 @@ export async function writeNewProjectTheme(root, tokensCss, slug, version) {
|
|
|
116
147
|
open(`${slug} v${version}: the system's values under the names Tailwind turns into utilities. They are yours now - change a value here and every component follows. Written by \`init\`, because this project had no tokens of its own.`),
|
|
117
148
|
"@theme {",
|
|
118
149
|
...lines,
|
|
150
|
+
...widthGuards(system.keys()),
|
|
119
151
|
"}",
|
|
120
152
|
...(next.length > 0 ? ["", ":root {", ...next, "}"] : []),
|
|
121
153
|
end(slug),
|
|
@@ -286,7 +318,11 @@ async function readTheirs(root, slug) {
|
|
|
286
318
|
* (`--container-*`), e o par vai para o `.lock`: a seção materializada escreve `var(--container-page)`, e a pessoa muda a
|
|
287
319
|
* largura num lugar só. O valor é o MESMO do catálogo - `page-width-twin.spec.ts` compara os dois.
|
|
288
320
|
*/
|
|
289
|
-
export const PAGE_WIDTH = {
|
|
321
|
+
export const PAGE_WIDTH = {
|
|
322
|
+
ours: "--ds-layout-page-width",
|
|
323
|
+
theirs: "--container-page",
|
|
324
|
+
value: "1440px",
|
|
325
|
+
};
|
|
290
326
|
function systemPairs(tokensCss, lookup = new Map()) {
|
|
291
327
|
const { names, values } = tongueOf([], tokensCss);
|
|
292
328
|
const out = [];
|
|
@@ -410,7 +446,13 @@ export async function writeBesideTheirs(root, tokensCss, slug, version, where) {
|
|
|
410
446
|
begin(slug),
|
|
411
447
|
open(`${slug} v${version}, beside your own tokens. The @theme adds only the names your project did not have; inside the data-theme selector below every value is the system's, including the names you already use, which keep their value everywhere else. Written by \`init\`, where you chose.`),
|
|
412
448
|
...(missing.length > 0
|
|
413
|
-
? [
|
|
449
|
+
? [
|
|
450
|
+
"@theme {",
|
|
451
|
+
...missing.map(([n, v]) => ` ${n}: ${v};`),
|
|
452
|
+
...widthGuards(missing.map(([n]) => n)),
|
|
453
|
+
"}",
|
|
454
|
+
"",
|
|
455
|
+
]
|
|
414
456
|
: []),
|
|
415
457
|
`[data-theme="${slug}"] {`,
|
|
416
458
|
...scoped,
|
package/package.json
CHANGED