synthesisui 0.16.493 → 0.16.495
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/commands/template.js +9 -3
- package/dist/install-marks.js +1 -1
- package/dist/their-tongue.js +27 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
1
|
+
import { mkdir, stat, writeFile } from "node:fs/promises";
|
|
2
2
|
import { dirname, join, relative } from "node:path";
|
|
3
3
|
import { readProjectConfig, resolveRegistry } from "../config.js";
|
|
4
4
|
import { installedSheetCss, RECIPE_HEADER, recipeRulesFor, } from "../recipe-css.js";
|
|
@@ -61,7 +61,13 @@ export async function template(slug, name, opts) {
|
|
|
61
61
|
// a loose landing.tsx at the app/ root read as a route without being one,
|
|
62
62
|
// and a second template turned the app dir into soup.
|
|
63
63
|
const [pageFile, ...siblings] = generated.files;
|
|
64
|
-
|
|
64
|
+
/**
|
|
65
|
+
* DENTRO DE `src/` QUANDO O APP MORA LÁ (14/10, três agentes do zero seguidos): o `create-next-app` com `src/` aponta o
|
|
66
|
+
* `@/` para `src/`, e os templates iam para `templates/` na raiz - o import que a frase abaixo sugere não resolvia, e o
|
|
67
|
+
* agente movia a pasta à mão. Com `src/app`, a pasta é `src/templates/<nome>`; sem, a raiz de sempre.
|
|
68
|
+
*/
|
|
69
|
+
const underSrc = await stat(join(root, "src", "app")).then((s) => s.isDirectory(), () => false);
|
|
70
|
+
const defaultDir = join(underSrc ? join("src", "templates") : "templates", asName ?? name);
|
|
65
71
|
const pageRel = opts.out ?? join(defaultDir, pageFile.filename);
|
|
66
72
|
const pageDir = dirname(join(root, pageRel));
|
|
67
73
|
/**
|
|
@@ -228,7 +234,7 @@ export async function template(slug, name, opts) {
|
|
|
228
234
|
console.log("");
|
|
229
235
|
console.log("Next steps:");
|
|
230
236
|
console.log(` • use it in a route, e.g. ${join(config.pagesDir, "page.tsx")}:`);
|
|
231
|
-
console.log(` import Page from "@/${defaultDir.replace(/\\/g, "/")}/${pageFile.filename.replace(/\.tsx$/, "")}";`);
|
|
237
|
+
console.log(` import Page from "@/${defaultDir.replace(/\\/g, "/").replace(/^src\//, "")}/${pageFile.filename.replace(/\.tsx$/, "")}";`);
|
|
232
238
|
console.log(` • nothing to install: this page and its stylesheet stand on their own`);
|
|
233
239
|
console.log(" • refine the file: wire real data, split into components, swap placeholders");
|
|
234
240
|
/**
|
package/dist/install-marks.js
CHANGED
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
* 0.16.492 -> 0.16.493 em 06/10, e o passo 1 dá **SIM** ("a galeria aprende", E02): o `init` declara as durações do
|
|
329
329
|
* sistema no @theme (`--duration-fast`), e o blueprint as escreve pelo nome. Um componente escrito antes traz `100ms`.
|
|
330
330
|
*/
|
|
331
|
-
export const MATERIALISER_SINCE = "0.16.
|
|
331
|
+
export const MATERIALISER_SINCE = "0.16.494";
|
|
332
332
|
/**
|
|
333
333
|
* A ÚLTIMA VERSÃO EM QUE O QUE O HOOK RODA MUDOU.
|
|
334
334
|
*
|
package/dist/their-tongue.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FAMILY_SEAM_PREFIX } from "./fonts.js";
|
|
1
2
|
/** `var(--ds-x)` e `var(--ds-x, fallback)` - o que a folha compilada escreve. */
|
|
2
3
|
const OUR_VAR = /var\(\s*(--ds-[a-zA-Z0-9_-]+)\s*(?:,([^()]*))?\)/g;
|
|
3
4
|
/**
|
|
@@ -24,6 +25,30 @@ export function sumSpoken(reports) {
|
|
|
24
25
|
left: [...left].sort(),
|
|
25
26
|
};
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* A FAMÍLIA PASSA PELA FONTE QUE O `add` CARREGOU - ele, 14/10, no teste com um agente do zero: o template saía com
|
|
30
|
+
* `font-family: "Instrument Serif"`, e o `next/font` do `fonts.ts` registra a fonte com um nome interno dele. Os dois não
|
|
31
|
+
* se encontravam: o agente apagou o `fonts.ts` e trocou o layout por um `<link>` do Google.
|
|
32
|
+
*
|
|
33
|
+
* A variável é DELE - o `fonts.ts` que o `add` escreveu declara `variable: "--font-ds-<papel>"`, e o layout a põe no
|
|
34
|
+
* `<body>`. Com ela ligada, a seção usa a fonte que o `next/font` baixou; sem ela, cai no nome, como antes. Dois papéis
|
|
35
|
+
* com a mesma família viram UMA const no `fonts.ts` (a do primeiro), então a cadeia passa por todos os papéis que dividem
|
|
36
|
+
* a família: a variável que existir vence.
|
|
37
|
+
*/
|
|
38
|
+
const FAMILY = FAMILY_SEAM_PREFIX;
|
|
39
|
+
const firstOf = (stack) => (stack.split(",")[0] ?? "").trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
40
|
+
function viaNextFont(name, value, tongue) {
|
|
41
|
+
if (!name.startsWith(FAMILY))
|
|
42
|
+
return null;
|
|
43
|
+
const family = firstOf(value);
|
|
44
|
+
if (!family)
|
|
45
|
+
return null;
|
|
46
|
+
const roles = [name.slice(FAMILY.length)];
|
|
47
|
+
for (const [other, v] of tongue.values)
|
|
48
|
+
if (other !== name && other.startsWith(FAMILY) && firstOf(v) === family)
|
|
49
|
+
roles.push(other.slice(FAMILY.length));
|
|
50
|
+
return roles.reduceRight((inner, role) => `var(--font-ds-${role}, ${inner})`, value);
|
|
51
|
+
}
|
|
27
52
|
export function inTheirTongue(css, tongue, destination = "stylesheet") {
|
|
28
53
|
let named = 0;
|
|
29
54
|
let inlined = 0;
|
|
@@ -46,7 +71,8 @@ export function inTheirTongue(css, tongue, destination = "stylesheet") {
|
|
|
46
71
|
inlined += 1;
|
|
47
72
|
if (tongue.frozen.has(name))
|
|
48
73
|
froze += 1;
|
|
49
|
-
|
|
74
|
+
const font = destination === "stylesheet" ? viaNextFont(name, value, tongue) : null;
|
|
75
|
+
return write(font ?? value);
|
|
50
76
|
}
|
|
51
77
|
/**
|
|
52
78
|
* O FALLBACK ESCRITO NA PRÓPRIA REFERÊNCIA É A ÚLTIMA RESPOSTA, e ela é do autor do texto.
|
package/package.json
CHANGED