synthesisui 0.16.475 → 0.16.476
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/component-codegen.js +40 -1
- package/dist/install-marks.js +7 -1
- package/dist/project-facts.js +9 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { emittableAttrs } from "./attr-shape.js";
|
|
2
|
+
import { FAMILY_SEAM_PREFIX } from "./fonts.js";
|
|
2
3
|
import { inTheirTongue, sumSpoken, } from "./their-tongue.js";
|
|
3
4
|
import { PHRASING_FORMS, } from "./types.js";
|
|
4
5
|
/**
|
|
@@ -550,6 +551,12 @@ const STATIC = {
|
|
|
550
551
|
/** Fixed rem → Tailwind numeric scale step (0.25rem base), or null if not a
|
|
551
552
|
* clean multiple. So `0.5rem` → `2` (h-2/w-2) instead of an arbitrary value. */
|
|
552
553
|
function remToTwScale(value) {
|
|
554
|
+
/** E em px, no degrau de 4px do Tailwind - bateria, 28/09 (b11): o avatar saía `[width:40px]` em vez de `w-10`. */
|
|
555
|
+
const px = value.trim().match(/^(\d*\.?\d+)px$/);
|
|
556
|
+
if (px) {
|
|
557
|
+
const n = Number.parseFloat(px[1]) / 4;
|
|
558
|
+
return Number.isInteger(n) && n > 0 && n <= 96 ? String(n) : null;
|
|
559
|
+
}
|
|
553
560
|
const m = value.trim().match(/^(\d*\.?\d+)rem$/);
|
|
554
561
|
if (!m)
|
|
555
562
|
return null;
|
|
@@ -596,14 +603,21 @@ const minted = (themeVars, cssVar) => themeVars === null || themeVars.has(cssVar
|
|
|
596
603
|
export class ThemeVocab extends Set {
|
|
597
604
|
theirValues;
|
|
598
605
|
dsValues;
|
|
606
|
+
varies;
|
|
599
607
|
constructor(
|
|
600
608
|
/** O valor LITERAL de cada variável dele, com as indireções dele já seguidas. */
|
|
601
609
|
theirValues,
|
|
602
610
|
/** O valor LITERAL de cada variável nossa (`--ds-*`), com as indireções seguidas. */
|
|
603
|
-
dsValues
|
|
611
|
+
dsValues,
|
|
612
|
+
/**
|
|
613
|
+
* AS NOSSAS QUE MUDAM DE VALOR ENTRE OS TEMAS - `dsValues` guarda um tema só. Um literal nunca vira uma destas: o
|
|
614
|
+
* valor cru pinta igual nos dois temas, e o papel não (b11, 28/09). Ver `literalAsRef`.
|
|
615
|
+
*/
|
|
616
|
+
varies = new Set()) {
|
|
604
617
|
super(theirValues.keys());
|
|
605
618
|
this.theirValues = theirValues;
|
|
606
619
|
this.dsValues = dsValues;
|
|
620
|
+
this.varies = varies;
|
|
607
621
|
}
|
|
608
622
|
/**
|
|
609
623
|
* O nome DELE para uma referência nossa no namespace `ns` (`color`), ou `null`.
|
|
@@ -690,12 +704,37 @@ const namedInside = (prop, value, themeVars) => {
|
|
|
690
704
|
return ok ? `var(--ease-${key})` : ref;
|
|
691
705
|
});
|
|
692
706
|
};
|
|
707
|
+
/**
|
|
708
|
+
* O VALOR CRU DA RECEITA QUE O SISTEMA JÁ NOMEIA - bateria, 28/09 (b11). A receita da galeria traz `color: #ffffff` e
|
|
709
|
+
* `fontFamily: "Inter, sans-serif"` como literais, e o gerador escrevia `[color:#ffffff]` - que a nossa própria checagem
|
|
710
|
+
* reprova. Quando exatamente UM papel semântico do sistema (ou uma família) segura aquele valor, o literal vira a
|
|
711
|
+
* referência, e o caminho de sempre acha o nome dele. Dois papéis com o mesmo valor: nada é adivinhado.
|
|
712
|
+
*/
|
|
713
|
+
function literalAsRef(prop, value, themeVars) {
|
|
714
|
+
if (!(themeVars instanceof ThemeVocab) || /[{(]/.test(value))
|
|
715
|
+
return null;
|
|
716
|
+
const ns = prop === "fontFamily"
|
|
717
|
+
? FAMILY_SEAM_PREFIX
|
|
718
|
+
: prop === "color" || prop === "backgroundColor" || prop === "borderColor"
|
|
719
|
+
? "--ds-color-semantic-"
|
|
720
|
+
: null;
|
|
721
|
+
if (!ns)
|
|
722
|
+
return null;
|
|
723
|
+
const hits = [...themeVars.dsValues]
|
|
724
|
+
.filter(([n, v]) => n.startsWith(ns) && !themeVars.varies.has(n) && sameValue(v, value))
|
|
725
|
+
.map(([n]) => n.slice(ns.length));
|
|
726
|
+
if (hits.length !== 1)
|
|
727
|
+
return null;
|
|
728
|
+
return ns === FAMILY_SEAM_PREFIX ? `{typography.families.${hits[0]}}` : `{color.semantic.${hits[0]}}`;
|
|
729
|
+
}
|
|
693
730
|
/** One declaration → Tailwind classes (pretty when mappable, arbitrary-property
|
|
694
731
|
* otherwise - never dropped). */
|
|
695
732
|
function declToTailwind(prop, value, themeVars) {
|
|
696
733
|
const stat = STATIC[prop]?.[value];
|
|
697
734
|
if (stat)
|
|
698
735
|
return [stat];
|
|
736
|
+
/** O valor cru que UM papel do sistema segura vira a referência dele - ver `literalAsRef`. */
|
|
737
|
+
value = literalAsRef(prop, value, themeVars) ?? value;
|
|
699
738
|
switch (prop) {
|
|
700
739
|
case "backgroundColor": {
|
|
701
740
|
if (value === "transparent")
|
package/dist/install-marks.js
CHANGED
|
@@ -304,7 +304,13 @@
|
|
|
304
304
|
* 0.16.472 -> 0.16.473 em 28/09, e o passo 1 dá **SIM** (a bateria): as famílias de sistema (Georgia, Arial, Verdana)
|
|
305
305
|
* deixam de virar `<link>` do Google Fonts, e a webfont ao lado delas ganha o `fonts.ts` que antes não saía.
|
|
306
306
|
*/
|
|
307
|
-
|
|
307
|
+
/**
|
|
308
|
+
* 0.16.473 -> 0.16.476 em 28/09, e o passo 1 dá **SIM** (a bateria, b11): o componente que o gerador escreve com Tailwind
|
|
309
|
+
* passa a usar o nome quando a receita traz um valor cru que um papel do sistema segura (`text-foreground` em vez de
|
|
310
|
+
* `[color:#ffffff]`, `font-body` em vez de `[font-family:Inter,_sans-serif]`), e a largura em px no degrau vira `w-10`.
|
|
311
|
+
* Um componente escrito antes reprova na própria checagem.
|
|
312
|
+
*/
|
|
313
|
+
export const MATERIALISER_SINCE = "0.16.476";
|
|
308
314
|
/**
|
|
309
315
|
* A ÚLTIMA VERSÃO EM QUE O QUE O HOOK RODA MUDOU.
|
|
310
316
|
*
|
package/dist/project-facts.js
CHANGED
|
@@ -392,7 +392,15 @@ export async function themeVocabOf(root, slug, names) {
|
|
|
392
392
|
dsValues.set(n, value);
|
|
393
393
|
}
|
|
394
394
|
/** Um nome sem valor conhecido continua no conjunto: `nameFor` o trata como antes. */
|
|
395
|
-
|
|
395
|
+
/** As nossas que o `tokens.css` declara com mais de um valor - uma por tema. Ver `varies` em `ThemeVocab`. */
|
|
396
|
+
const faces = new Map();
|
|
397
|
+
for (const m of installed.matchAll(/(--ds-[a-zA-Z0-9_-]+)\s*:\s*([^;{}]+);/g)) {
|
|
398
|
+
const seen = faces.get(m[1]) ?? new Set();
|
|
399
|
+
seen.add(m[2].trim());
|
|
400
|
+
faces.set(m[1], seen);
|
|
401
|
+
}
|
|
402
|
+
const varies = new Set([...faces].filter(([, v]) => v.size > 1).map(([n]) => n));
|
|
403
|
+
const vocab = new ThemeVocab(theirs, dsValues, varies);
|
|
396
404
|
for (const n of names)
|
|
397
405
|
vocab.add(n);
|
|
398
406
|
return vocab;
|
package/package.json
CHANGED