rafters 0.0.74 → 0.0.76

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.
Files changed (2) hide show
  1. package/dist/index.js +38 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1012,7 +1012,7 @@ function deriveCandidates(themeCSS) {
1012
1012
  return [...candidates];
1013
1013
  }
1014
1014
  async function registryToDocumentation(registry2, options = {}) {
1015
- const { minify = true } = options;
1015
+ const { minify = true, contentSources = [] } = options;
1016
1016
  const themeBody = registryToTailwind(registry2, { includeImport: false });
1017
1017
  const candidates = deriveCandidates(themeBody);
1018
1018
  const { mkdtempSync, writeFileSync: writeFileSync2, rmSync } = await import("fs");
@@ -1031,9 +1031,12 @@ async function registryToDocumentation(registry2, options = {}) {
1031
1031
  const tempDir = mkdtempSync(join15(pkgDir, ".tmp-doc-compile-"));
1032
1032
  const candidateFile = join15(tempDir, "candidates.txt");
1033
1033
  writeFileSync2(candidateFile, candidates.join("\n"));
1034
- const sourceDirective = `@source "${candidateFile}";`;
1034
+ const sourceDirectives = [
1035
+ `@source "${candidateFile}";`,
1036
+ ...contentSources.map((src) => `@source "${src}";`)
1037
+ ].join("\n");
1035
1038
  const input = `@import "tailwindcss" source(none);
1036
- ${sourceDirective}
1039
+ ${sourceDirectives}
1037
1040
  ${themeBody}`;
1038
1041
  const tempInput = join15(tempDir, "input.css");
1039
1042
  const tempOutput = join15(tempDir, "output.css");
@@ -1045,7 +1048,8 @@ ${themeBody}`;
1045
1048
  if (minify) args.push("--minify");
1046
1049
  execFileSync("node", args, { stdio: "pipe", timeout: 6e4, cwd: pkgDir });
1047
1050
  const { readFileSync: readFileSync3 } = await import("fs");
1048
- return readFileSync3(tempOutput, "utf-8");
1051
+ const raw = readFileSync3(tempOutput, "utf-8");
1052
+ return postProcessDocSheet(raw);
1049
1053
  } catch (error47) {
1050
1054
  const message = error47 instanceof Error ? error47.message : String(error47);
1051
1055
  throw new Error(`Failed to compile documentation CSS: ${message}`);
@@ -1053,6 +1057,35 @@ ${themeBody}`;
1053
1057
  rmSync(tempDir, { recursive: true, force: true });
1054
1058
  }
1055
1059
  }
1060
+ function postProcessDocSheet(css) {
1061
+ const parts = [];
1062
+ const themeLayerRe = /@layer theme\{(.*?)\}(?=@layer|$)/s;
1063
+ const themeMatch = themeLayerRe.exec(css);
1064
+ if (themeMatch) {
1065
+ let themeContent = themeMatch[1] ?? "";
1066
+ themeContent = themeContent.replace(/:root,:host/g, ":host");
1067
+ parts.push(`:host{container-type:inline-size}${themeContent}`);
1068
+ }
1069
+ const layerRe = /@layer (base|components|utilities)\{/g;
1070
+ let match;
1071
+ while ((match = layerRe.exec(css)) !== null) {
1072
+ const start = match.index;
1073
+ let depth = 0;
1074
+ let end = start;
1075
+ for (let i = start; i < css.length; i++) {
1076
+ if (css[i] === "{") depth++;
1077
+ if (css[i] === "}") {
1078
+ depth--;
1079
+ if (depth === 0) {
1080
+ end = i + 1;
1081
+ break;
1082
+ }
1083
+ }
1084
+ }
1085
+ parts.push(css.slice(start, end));
1086
+ }
1087
+ return parts.join("");
1088
+ }
1056
1089
 
1057
1090
  // ../design-tokens/src/exporters/typescript.ts
1058
1091
  function tokenValueToTS(token) {
@@ -28854,7 +28887,7 @@ function getInstalledNames(config2) {
28854
28887
  function getComponentTarget(config2) {
28855
28888
  return resolveComponentTarget(config2);
28856
28889
  }
28857
- var SHARED_EXTENSIONS = /* @__PURE__ */ new Set([".classes.ts", ".types.ts", ".constants.ts"]);
28890
+ var SHARED_EXTENSIONS = /* @__PURE__ */ new Set([".behavior.ts", ".classes.ts"]);
28858
28891
  function isSharedFile(path) {
28859
28892
  for (const ext of SHARED_EXTENSIONS) {
28860
28893
  if (path.endsWith(ext)) return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rafters",
3
- "version": "0.0.74",
3
+ "version": "0.0.76",
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",