rafters 0.0.81 → 0.0.82
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 +36 -42
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,13 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var
|
|
9
|
-
get: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
});
|
|
14
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
15
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
10
|
};
|
|
17
11
|
var __export = (target, all) => {
|
|
@@ -316,6 +310,7 @@ function toDTCG(tokens, options = {}) {
|
|
|
316
310
|
}
|
|
317
311
|
|
|
318
312
|
// ../design-tokens/src/exporters/tailwind.ts
|
|
313
|
+
import * as csstree from "css-tree";
|
|
319
314
|
var SHADOW_PART_SUFFIX = /-(offset-x|offset-y|blur|spread|color)$/;
|
|
320
315
|
var MOTION_NAMESPACE_PROPERTY = {
|
|
321
316
|
duration: "transition-duration",
|
|
@@ -1259,19 +1254,18 @@ ${themeBody}`;
|
|
|
1259
1254
|
}
|
|
1260
1255
|
}
|
|
1261
1256
|
function postProcessDocSheet(css) {
|
|
1262
|
-
const
|
|
1263
|
-
const ast = csstree3.parse(css);
|
|
1257
|
+
const ast = csstree.parse(css);
|
|
1264
1258
|
const parts = [];
|
|
1265
1259
|
let hasHostContainer = false;
|
|
1266
1260
|
const atruleNames = /* @__PURE__ */ new Set(["layer", "property", "keyframes"]);
|
|
1267
|
-
|
|
1261
|
+
csstree.walk(ast, {
|
|
1268
1262
|
visit: "Atrule",
|
|
1269
1263
|
enter(node) {
|
|
1270
1264
|
if (!atruleNames.has(node.name)) return;
|
|
1271
1265
|
if (node.name === "layer") {
|
|
1272
|
-
const prelude = node.prelude ?
|
|
1266
|
+
const prelude = node.prelude ? csstree.generate(node.prelude) : "";
|
|
1273
1267
|
if (prelude === "theme" && node.block) {
|
|
1274
|
-
let content =
|
|
1268
|
+
let content = csstree.generate(node.block);
|
|
1275
1269
|
content = content.replace(/^\{/, "").replace(/\}$/, "");
|
|
1276
1270
|
content = rewriteRootToHost(content);
|
|
1277
1271
|
if (!hasHostContainer) {
|
|
@@ -1281,22 +1275,22 @@ function postProcessDocSheet(css) {
|
|
|
1281
1275
|
parts.push(content);
|
|
1282
1276
|
}
|
|
1283
1277
|
} else if (/^(base|components|utilities)/.test(prelude) && node.block) {
|
|
1284
|
-
parts.push(
|
|
1278
|
+
parts.push(csstree.generate(node));
|
|
1285
1279
|
} else if (prelude.startsWith("properties") && node.block) {
|
|
1286
|
-
let block =
|
|
1280
|
+
let block = csstree.generate(node);
|
|
1287
1281
|
block = rewritePropertiesSelector(block);
|
|
1288
1282
|
parts.push(block);
|
|
1289
1283
|
}
|
|
1290
1284
|
} else {
|
|
1291
|
-
parts.push(
|
|
1285
|
+
parts.push(csstree.generate(node));
|
|
1292
1286
|
}
|
|
1293
1287
|
}
|
|
1294
1288
|
});
|
|
1295
|
-
|
|
1289
|
+
csstree.walk(ast, {
|
|
1296
1290
|
visit: "Rule",
|
|
1297
1291
|
enter(node, _item, list) {
|
|
1298
1292
|
if (list !== ast.children) return;
|
|
1299
|
-
let block =
|
|
1293
|
+
let block = csstree.generate(node);
|
|
1300
1294
|
block = rewriteRootToHost(block);
|
|
1301
1295
|
parts.push(block);
|
|
1302
1296
|
}
|
|
@@ -2105,7 +2099,7 @@ function coerceCoords(space, format, name, coords) {
|
|
|
2105
2099
|
});
|
|
2106
2100
|
return types;
|
|
2107
2101
|
}
|
|
2108
|
-
function
|
|
2102
|
+
function parse2(str, { meta } = {}) {
|
|
2109
2103
|
let env = { "str": String(str)?.trim() };
|
|
2110
2104
|
hooks.run("parse-start", env);
|
|
2111
2105
|
if (env.color) {
|
|
@@ -2205,7 +2199,7 @@ function getColor(color) {
|
|
|
2205
2199
|
throw new TypeError("Empty color reference");
|
|
2206
2200
|
}
|
|
2207
2201
|
if (isString(color)) {
|
|
2208
|
-
color =
|
|
2202
|
+
color = parse2(color);
|
|
2209
2203
|
}
|
|
2210
2204
|
let space = color.space || color.spaceId;
|
|
2211
2205
|
if (!(space instanceof ColorSpace)) {
|
|
@@ -5700,7 +5694,7 @@ Object.assign(Color, {
|
|
|
5700
5694
|
WHITES,
|
|
5701
5695
|
Space: ColorSpace,
|
|
5702
5696
|
spaces: ColorSpace.registry,
|
|
5703
|
-
parse,
|
|
5697
|
+
parse: parse2,
|
|
5704
5698
|
// Global defaults one may want to configure
|
|
5705
5699
|
defaults
|
|
5706
5700
|
});
|
|
@@ -5950,7 +5944,7 @@ __export(external_exports, {
|
|
|
5950
5944
|
object: () => object,
|
|
5951
5945
|
optional: () => optional,
|
|
5952
5946
|
overwrite: () => _overwrite,
|
|
5953
|
-
parse: () =>
|
|
5947
|
+
parse: () => parse4,
|
|
5954
5948
|
parseAsync: () => parseAsync2,
|
|
5955
5949
|
partialRecord: () => partialRecord,
|
|
5956
5950
|
pipe: () => pipe,
|
|
@@ -6254,7 +6248,7 @@ __export(core_exports2, {
|
|
|
6254
6248
|
isValidBase64URL: () => isValidBase64URL,
|
|
6255
6249
|
isValidJWT: () => isValidJWT,
|
|
6256
6250
|
locales: () => locales_exports,
|
|
6257
|
-
parse: () =>
|
|
6251
|
+
parse: () => parse3,
|
|
6258
6252
|
parseAsync: () => parseAsync,
|
|
6259
6253
|
prettifyError: () => prettifyError,
|
|
6260
6254
|
regexes: () => regexes_exports,
|
|
@@ -7122,7 +7116,7 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
7122
7116
|
}
|
|
7123
7117
|
return result.value;
|
|
7124
7118
|
};
|
|
7125
|
-
var
|
|
7119
|
+
var parse3 = /* @__PURE__ */ _parse($ZodRealError);
|
|
7126
7120
|
var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
7127
7121
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
7128
7122
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -9658,10 +9652,10 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
9658
9652
|
throw new Error("implement() must be called with a function");
|
|
9659
9653
|
}
|
|
9660
9654
|
return function(...args) {
|
|
9661
|
-
const parsedArgs = inst._def.input ?
|
|
9655
|
+
const parsedArgs = inst._def.input ? parse3(inst._def.input, args) : args;
|
|
9662
9656
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
9663
9657
|
if (inst._def.output) {
|
|
9664
|
-
return
|
|
9658
|
+
return parse3(inst._def.output, result);
|
|
9665
9659
|
}
|
|
9666
9660
|
return result;
|
|
9667
9661
|
};
|
|
@@ -17283,7 +17277,7 @@ var ZodRealError = $constructor("ZodError", initializer2, {
|
|
|
17283
17277
|
});
|
|
17284
17278
|
|
|
17285
17279
|
// ../../node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/parse.js
|
|
17286
|
-
var
|
|
17280
|
+
var parse4 = /* @__PURE__ */ _parse(ZodRealError);
|
|
17287
17281
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
17288
17282
|
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
17289
17283
|
var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
@@ -17316,7 +17310,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
17316
17310
|
reg.add(inst, meta);
|
|
17317
17311
|
return inst;
|
|
17318
17312
|
});
|
|
17319
|
-
inst.parse = (data, params) =>
|
|
17313
|
+
inst.parse = (data, params) => parse4(inst, data, params, { callee: inst.parse });
|
|
17320
17314
|
inst.safeParse = (data, params) => safeParse2(inst, data, params);
|
|
17321
17315
|
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
|
|
17322
17316
|
inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
|
|
@@ -27313,8 +27307,8 @@ function generateBaseSystem(config2 = {}) {
|
|
|
27313
27307
|
const byNamespace = /* @__PURE__ */ new Map();
|
|
27314
27308
|
const allTokens = [];
|
|
27315
27309
|
const generators = createGeneratorDefs(mergedConfig.colorPaletteBases);
|
|
27316
|
-
for (const { generate:
|
|
27317
|
-
const result =
|
|
27310
|
+
for (const { generate: generate4 } of generators) {
|
|
27311
|
+
const result = generate4(resolvedConfig);
|
|
27318
27312
|
byNamespace.set(result.namespace, result.tokens);
|
|
27319
27313
|
allTokens.push(...result.tokens);
|
|
27320
27314
|
}
|
|
@@ -27349,22 +27343,22 @@ function getAvailableAdapters() {
|
|
|
27349
27343
|
}
|
|
27350
27344
|
|
|
27351
27345
|
// ../design-tokens/src/importers/shadcn.ts
|
|
27352
|
-
import * as
|
|
27346
|
+
import * as csstree2 from "css-tree";
|
|
27353
27347
|
function extractShadcnRoot(css) {
|
|
27354
|
-
const ast =
|
|
27348
|
+
const ast = csstree2.parse(css);
|
|
27355
27349
|
const out = [];
|
|
27356
|
-
|
|
27350
|
+
csstree2.walk(ast, {
|
|
27357
27351
|
visit: "Rule",
|
|
27358
27352
|
enter(rule) {
|
|
27359
|
-
const selectors =
|
|
27353
|
+
const selectors = csstree2.generate(rule.prelude).split(",").map((s) => s.trim());
|
|
27360
27354
|
if (!selectors.includes(":root")) return;
|
|
27361
|
-
|
|
27355
|
+
csstree2.walk(rule.block, {
|
|
27362
27356
|
visit: "Declaration",
|
|
27363
27357
|
enter(decl) {
|
|
27364
27358
|
if (!decl.property.startsWith("--")) return;
|
|
27365
27359
|
out.push({
|
|
27366
27360
|
name: decl.property.slice(2),
|
|
27367
|
-
value:
|
|
27361
|
+
value: csstree2.generate(decl.value).trim()
|
|
27368
27362
|
});
|
|
27369
27363
|
}
|
|
27370
27364
|
});
|
|
@@ -27393,13 +27387,13 @@ function extractThemeBlocks2(css) {
|
|
|
27393
27387
|
|
|
27394
27388
|
// ../design-tokens/src/importers/bases.ts
|
|
27395
27389
|
var LENGTH = /^(-?\d+(?:\.\d+)?)\s*(rem|px|em)$/;
|
|
27396
|
-
function detectBase(css, names,
|
|
27390
|
+
function detectBase(css, names, parse8) {
|
|
27397
27391
|
const decls = [...extractShadcnRoot(css), ...extractThemeBlocks2(css)];
|
|
27398
27392
|
let last2 = null;
|
|
27399
27393
|
for (const decl of decls) {
|
|
27400
27394
|
if (names.includes(decl.name)) last2 = decl.value.trim();
|
|
27401
27395
|
}
|
|
27402
|
-
return last2 === null ? null :
|
|
27396
|
+
return last2 === null ? null : parse8(last2);
|
|
27403
27397
|
}
|
|
27404
27398
|
function parseLength(raw) {
|
|
27405
27399
|
const match = raw.match(LENGTH);
|
|
@@ -27527,7 +27521,7 @@ function colorsFromClassification(classification) {
|
|
|
27527
27521
|
}
|
|
27528
27522
|
|
|
27529
27523
|
// ../design-tokens/src/importers/fonts.ts
|
|
27530
|
-
import * as
|
|
27524
|
+
import * as csstree3 from "css-tree";
|
|
27531
27525
|
var GENERIC_KEYWORDS = /* @__PURE__ */ new Set([
|
|
27532
27526
|
"sans-serif",
|
|
27533
27527
|
"serif",
|
|
@@ -27622,19 +27616,19 @@ function extractFontFaceFamilies(css) {
|
|
|
27622
27616
|
const out = [];
|
|
27623
27617
|
let ast;
|
|
27624
27618
|
try {
|
|
27625
|
-
ast =
|
|
27619
|
+
ast = csstree3.parse(css);
|
|
27626
27620
|
} catch {
|
|
27627
27621
|
return out;
|
|
27628
27622
|
}
|
|
27629
|
-
|
|
27623
|
+
csstree3.walk(ast, {
|
|
27630
27624
|
visit: "Atrule",
|
|
27631
27625
|
enter(atrule) {
|
|
27632
27626
|
if (atrule.name !== "font-face" || atrule.block === null) return;
|
|
27633
|
-
|
|
27627
|
+
csstree3.walk(atrule.block, {
|
|
27634
27628
|
visit: "Declaration",
|
|
27635
27629
|
enter(decl) {
|
|
27636
27630
|
if (decl.property.toLowerCase() !== "font-family") return;
|
|
27637
|
-
const raw =
|
|
27631
|
+
const raw = csstree3.generate(decl.value).trim();
|
|
27638
27632
|
const name = stripQuotes(raw);
|
|
27639
27633
|
if (name !== "") out.push(name);
|
|
27640
27634
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rafters",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.82",
|
|
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",
|