rafters 0.0.67 → 0.0.69
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/index.js +13 -137
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22863,136 +22863,6 @@ function registryToTailwind(registry2, options) {
|
|
|
22863
22863
|
const tokens = [...registry2.list()];
|
|
22864
22864
|
return tokensToTailwind(tokens, options, []);
|
|
22865
22865
|
}
|
|
22866
|
-
function generateVarsRootBlock(groups) {
|
|
22867
|
-
const lines = [];
|
|
22868
|
-
lines.push(":root {");
|
|
22869
|
-
if (groups.color.length > 0) {
|
|
22870
|
-
for (const token of groups.color) {
|
|
22871
|
-
const value = tokenValueToCSS(token);
|
|
22872
|
-
if (value === null) continue;
|
|
22873
|
-
lines.push(` --rafters-color-${token.name}: ${value};`);
|
|
22874
|
-
}
|
|
22875
|
-
lines.push("");
|
|
22876
|
-
}
|
|
22877
|
-
if (groups.spacing.length > 0) {
|
|
22878
|
-
for (const token of groups.spacing) {
|
|
22879
|
-
const value = tokenValueToCSS(token);
|
|
22880
|
-
if (value === null) continue;
|
|
22881
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22882
|
-
}
|
|
22883
|
-
lines.push("");
|
|
22884
|
-
}
|
|
22885
|
-
if (groups.typography.length > 0) {
|
|
22886
|
-
for (const token of groups.typography) {
|
|
22887
|
-
const value = tokenValueToCSS(token);
|
|
22888
|
-
if (value === null) continue;
|
|
22889
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22890
|
-
if (token.lineHeight) {
|
|
22891
|
-
lines.push(` --rafters-${token.name}--line-height: ${token.lineHeight};`);
|
|
22892
|
-
}
|
|
22893
|
-
}
|
|
22894
|
-
lines.push("");
|
|
22895
|
-
}
|
|
22896
|
-
if (groups.radius.length > 0) {
|
|
22897
|
-
for (const token of groups.radius) {
|
|
22898
|
-
const value = tokenValueToCSS(token);
|
|
22899
|
-
if (value === null) continue;
|
|
22900
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22901
|
-
}
|
|
22902
|
-
lines.push("");
|
|
22903
|
-
}
|
|
22904
|
-
if (groups.shadow.length > 0) {
|
|
22905
|
-
for (const token of groups.shadow) {
|
|
22906
|
-
const value = tokenValueToCSS(token);
|
|
22907
|
-
if (value === null) continue;
|
|
22908
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22909
|
-
}
|
|
22910
|
-
lines.push("");
|
|
22911
|
-
}
|
|
22912
|
-
if (groups.depth.length > 0) {
|
|
22913
|
-
for (const token of groups.depth) {
|
|
22914
|
-
const value = tokenValueToCSS(token);
|
|
22915
|
-
if (value === null) continue;
|
|
22916
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22917
|
-
}
|
|
22918
|
-
lines.push("");
|
|
22919
|
-
}
|
|
22920
|
-
if (groups.motion.length > 0) {
|
|
22921
|
-
for (const token of groups.motion) {
|
|
22922
|
-
if (token.name.startsWith("motion-duration-") && token.name !== "motion-duration-base")
|
|
22923
|
-
continue;
|
|
22924
|
-
if (token.name.startsWith("motion-easing-")) continue;
|
|
22925
|
-
const value = tokenValueToCSS(token);
|
|
22926
|
-
if (value === null) continue;
|
|
22927
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22928
|
-
}
|
|
22929
|
-
lines.push("");
|
|
22930
|
-
}
|
|
22931
|
-
if (groups.motion.length > 0) {
|
|
22932
|
-
for (const token of groups.motion) {
|
|
22933
|
-
if (token.name.startsWith("motion-duration-") && token.name !== "motion-duration-base") {
|
|
22934
|
-
const value = tokenValueToCSS(token);
|
|
22935
|
-
if (value === null) continue;
|
|
22936
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22937
|
-
}
|
|
22938
|
-
if (token.name.startsWith("motion-easing-")) {
|
|
22939
|
-
const value = tokenValueToCSS(token);
|
|
22940
|
-
if (value === null) continue;
|
|
22941
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22942
|
-
}
|
|
22943
|
-
}
|
|
22944
|
-
lines.push("");
|
|
22945
|
-
}
|
|
22946
|
-
if (groups.breakpoint.length > 0) {
|
|
22947
|
-
for (const token of groups.breakpoint) {
|
|
22948
|
-
const value = tokenValueToCSS(token);
|
|
22949
|
-
if (value === null) continue;
|
|
22950
|
-
if (isMediaQueryToken(token)) continue;
|
|
22951
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22952
|
-
}
|
|
22953
|
-
lines.push("");
|
|
22954
|
-
}
|
|
22955
|
-
if (groups.focus.length > 0) {
|
|
22956
|
-
for (const token of groups.focus) {
|
|
22957
|
-
const value = tokenValueToCSS(token);
|
|
22958
|
-
if (value === null) continue;
|
|
22959
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22960
|
-
}
|
|
22961
|
-
lines.push("");
|
|
22962
|
-
}
|
|
22963
|
-
if (groups.other.length > 0) {
|
|
22964
|
-
for (const token of groups.other) {
|
|
22965
|
-
const value = tokenValueToCSS(token);
|
|
22966
|
-
if (value === null) continue;
|
|
22967
|
-
lines.push(` --rafters-${token.name}: ${value};`);
|
|
22968
|
-
}
|
|
22969
|
-
lines.push("");
|
|
22970
|
-
}
|
|
22971
|
-
const animationTokens = groups.motion.filter((t) => t.name.startsWith("motion-animation-"));
|
|
22972
|
-
if (animationTokens.length > 0) {
|
|
22973
|
-
for (const token of animationTokens) {
|
|
22974
|
-
const animName = token.animationName || token.name.replace("motion-animation-", "");
|
|
22975
|
-
lines.push(` --rafters-animate-${animName}: ${token.value};`);
|
|
22976
|
-
}
|
|
22977
|
-
lines.push("");
|
|
22978
|
-
}
|
|
22979
|
-
lines.push("}");
|
|
22980
|
-
return lines.join("\n");
|
|
22981
|
-
}
|
|
22982
|
-
function registryToVars(registry2) {
|
|
22983
|
-
const tokens = [...registry2.list()];
|
|
22984
|
-
if (tokens.length === 0) {
|
|
22985
|
-
throw new Error("Registry is empty");
|
|
22986
|
-
}
|
|
22987
|
-
const groups = groupTokens(tokens);
|
|
22988
|
-
const sections = [];
|
|
22989
|
-
const varsBlock = generateVarsRootBlock(groups);
|
|
22990
|
-
sections.push(varsBlock);
|
|
22991
|
-
sections.push("");
|
|
22992
|
-
const rootBlock = generateRootBlock(groups.semantic);
|
|
22993
|
-
sections.push(rootBlock);
|
|
22994
|
-
return sections.join("\n");
|
|
22995
|
-
}
|
|
22996
22866
|
async function registryToCompiled(registry2, options = {}) {
|
|
22997
22867
|
const { minify = true, includeImport = true } = options;
|
|
22998
22868
|
const themeCss = registryToTailwind(registry2, { includeImport });
|
|
@@ -30514,7 +30384,7 @@ var ColorBuildOptionsSchema = external_exports.object({
|
|
|
30514
30384
|
states: external_exports.record(external_exports.string(), external_exports.string()).optional()
|
|
30515
30385
|
});
|
|
30516
30386
|
var projectPath = process.env.RAFTERS_PROJECT_PATH || process.cwd();
|
|
30517
|
-
var outputPath = join12(projectPath, ".rafters", "output", "rafters.
|
|
30387
|
+
var outputPath = join12(projectPath, ".rafters", "output", "rafters.css");
|
|
30518
30388
|
var SetTokenMessageSchema = external_exports.object({
|
|
30519
30389
|
name: external_exports.string().min(1),
|
|
30520
30390
|
value: external_exports.union([external_exports.string(), ColorValueSchema, ColorReferenceSchema]),
|
|
@@ -30902,7 +30772,7 @@ function studioApiPlugin() {
|
|
|
30902
30772
|
if (initialized) {
|
|
30903
30773
|
saveRegistryToDir(tokensDir, registry2);
|
|
30904
30774
|
}
|
|
30905
|
-
await writeFile3(outputPath,
|
|
30775
|
+
await writeFile3(outputPath, registryToTailwind(registry2));
|
|
30906
30776
|
server.ws.send({ type: "custom", event: "rafters:css-updated" });
|
|
30907
30777
|
} catch (error47) {
|
|
30908
30778
|
console.log(`[rafters] CSS regeneration failed: ${error47}`);
|
|
@@ -30971,7 +30841,7 @@ function studioApiPlugin() {
|
|
|
30971
30841
|
client.send("rafters:token-updated", { ok: false, error: String(error47) });
|
|
30972
30842
|
}
|
|
30973
30843
|
});
|
|
30974
|
-
server.middlewares.use((req, res, next) => {
|
|
30844
|
+
server.middlewares.use(async (req, res, next) => {
|
|
30975
30845
|
let pathname;
|
|
30976
30846
|
try {
|
|
30977
30847
|
pathname = new URL(req.url ?? "", "http://localhost").pathname;
|
|
@@ -31047,13 +30917,16 @@ function studioApiPlugin() {
|
|
|
31047
30917
|
return;
|
|
31048
30918
|
}
|
|
31049
30919
|
if (req.method === "POST") {
|
|
31050
|
-
|
|
30920
|
+
try {
|
|
30921
|
+
await handlePostToken(req, res, name, registry2);
|
|
30922
|
+
if (res.statusCode < 400) await persistAndNotify();
|
|
30923
|
+
} catch (error47) {
|
|
31051
30924
|
console.log(`[rafters] Unhandled error in POST /api/tokens/${name}: ${error47}`);
|
|
31052
30925
|
if (!res.headersSent) {
|
|
31053
30926
|
res.statusCode = 500;
|
|
31054
30927
|
res.end(JSON.stringify({ ok: false, error: "Internal server error" }));
|
|
31055
30928
|
}
|
|
31056
|
-
}
|
|
30929
|
+
}
|
|
31057
30930
|
return;
|
|
31058
30931
|
}
|
|
31059
30932
|
const token = registry2.get(name);
|
|
@@ -31092,13 +30965,16 @@ function studioApiPlugin() {
|
|
|
31092
30965
|
return;
|
|
31093
30966
|
}
|
|
31094
30967
|
if (req.method === "POST") {
|
|
31095
|
-
|
|
30968
|
+
try {
|
|
30969
|
+
await handlePostTokens(req, res, registry2);
|
|
30970
|
+
if (res.statusCode < 400) await persistAndNotify();
|
|
30971
|
+
} catch (error47) {
|
|
31096
30972
|
console.log(`[rafters] Unhandled error in POST /api/tokens: ${error47}`);
|
|
31097
30973
|
if (!res.headersSent) {
|
|
31098
30974
|
res.statusCode = 500;
|
|
31099
30975
|
res.end(JSON.stringify({ ok: false, error: "Internal server error" }));
|
|
31100
30976
|
}
|
|
31101
|
-
}
|
|
30977
|
+
}
|
|
31102
30978
|
return;
|
|
31103
30979
|
}
|
|
31104
30980
|
handleGetTokens(req.url ?? "", res, registry2, initialized);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rafters",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.69",
|
|
4
4
|
"description": "Design Intelligence CLI. Scaffold tokens, import existing shadcn/Tailwind v4 sources, add components, and serve an MCP server so AI agents read decisions instead of guessing.",
|
|
5
5
|
"homepage": "https://rafters.studio",
|
|
6
6
|
"license": "MIT",
|