synthesisui 0.16.481 → 0.16.482
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/colours.js +20 -1
- package/package.json +1 -1
package/dist/commands/colours.js
CHANGED
|
@@ -27,7 +27,11 @@ export async function colours(asked, opts) {
|
|
|
27
27
|
? await readFile(join(slugDir, `v${lock.version}`, "tokens.css"), "utf8").catch(() => "")
|
|
28
28
|
: "";
|
|
29
29
|
const roleHex = roleColours(tokens);
|
|
30
|
-
|
|
30
|
+
/** O que ele marcou na tela em "no seu código hoje" vale acima do palpite pela versão de antes (28/09). */
|
|
31
|
+
const docJson = typeof lock.version === "number"
|
|
32
|
+
? await readFile(join(slugDir, `v${lock.version}`, "design-system.json"), "utf8").catch(() => "{}")
|
|
33
|
+
: "{}";
|
|
34
|
+
const plan = await planColourNames(root, slug, roleHex, markedBefore(before, docJson));
|
|
31
35
|
console.log("");
|
|
32
36
|
console.log(section("Your six colours, back in your code"));
|
|
33
37
|
if (!plan.file) {
|
|
@@ -78,6 +82,21 @@ export function roleColours(tokensCss) {
|
|
|
78
82
|
}
|
|
79
83
|
return out;
|
|
80
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* A COR DE HOJE DE CADA PAPEL, com o que ELE marcou por cima - `foundations.color.replaces`, escrito pela tela de
|
|
87
|
+
* escolher cores (controle completo, 28/09). `""` é resposta dele: o papel é novo e não troca cor nenhuma.
|
|
88
|
+
*/
|
|
89
|
+
export function markedBefore(before, documentJson) {
|
|
90
|
+
let marked = {};
|
|
91
|
+
try {
|
|
92
|
+
marked =
|
|
93
|
+
JSON.parse(documentJson).foundations?.color?.replaces ?? {};
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
marked = {};
|
|
97
|
+
}
|
|
98
|
+
return { ...before, ...marked };
|
|
99
|
+
}
|
|
81
100
|
/** As seis cores da versão que está instalada agora - `{}` quando ainda não há nenhuma. */
|
|
82
101
|
async function installedRoles(slugDir) {
|
|
83
102
|
const lock = JSON.parse(await readFile(join(slugDir, ".lock"), "utf8").catch(() => "{}"));
|
package/package.json
CHANGED