rafters 0.0.76 → 0.0.77

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 +66 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -968,12 +968,61 @@ var RADIUS_UTILITIES = [
968
968
  "rounded-bl"
969
969
  ];
970
970
  var STATE_VARIANTS = ["hover", "focus-visible", "focus", "active", "dark"];
971
+ var CONTAINER_LAYOUT_UTILITIES = [
972
+ "grid-cols",
973
+ "gap",
974
+ "p",
975
+ "px",
976
+ "py",
977
+ "pt",
978
+ "pr",
979
+ "pb",
980
+ "pl",
981
+ "h",
982
+ "w",
983
+ "max-w",
984
+ "flex-row",
985
+ "flex-col",
986
+ "flex-col-reverse",
987
+ "flex-wrap",
988
+ "items-center",
989
+ "justify-end",
990
+ "justify-center",
991
+ "justify-between",
992
+ "text-left",
993
+ "text-center",
994
+ "text-right",
995
+ "space-x",
996
+ "space-y",
997
+ "mt",
998
+ "rounded",
999
+ "rounded-sm",
1000
+ "rounded-md",
1001
+ "rounded-lg"
1002
+ ];
1003
+ function extractThemeBlocks(css) {
1004
+ const blocks = [];
1005
+ const re = /@theme\s*(?:inline\s*)?\{/g;
1006
+ let match;
1007
+ while ((match = re.exec(css)) !== null) {
1008
+ let depth = 1;
1009
+ const start = match.index + match[0].length;
1010
+ for (let i = start; i < css.length; i++) {
1011
+ if (css[i] === "{") depth++;
1012
+ if (css[i] === "}") {
1013
+ depth--;
1014
+ if (depth === 0) {
1015
+ blocks.push(css.slice(start, i));
1016
+ break;
1017
+ }
1018
+ }
1019
+ }
1020
+ }
1021
+ return blocks;
1022
+ }
971
1023
  function deriveCandidates(themeCSS) {
972
1024
  const themeVarNames = [];
973
- const themeBlockRe = /@theme\s*(?:inline\s*)?\{([^}]*)\}/gs;
974
- let blockMatch;
975
- while ((blockMatch = themeBlockRe.exec(themeCSS)) !== null) {
976
- const block = blockMatch[1] ?? "";
1025
+ for (const block of extractThemeBlocks(themeCSS)) {
977
1026
  const varRe = /--([a-z][a-z0-9-]*)\s*:/g;
978
1027
  let varMatch;
979
1028
  while ((varMatch = varRe.exec(block)) !== null) {
@@ -1009,6 +1058,15 @@ function deriveCandidates(themeCSS) {
1009
1058
  candidates.add(`${variant}:${c4}`);
1010
1059
  }
1011
1060
  }
1061
+ const containerSizes = themeVarNames.filter((n2) => n2.startsWith("container-")).map((n2) => n2.slice(10));
1062
+ const layoutCandidates = base.filter(
1063
+ (c4) => CONTAINER_LAYOUT_UTILITIES.some((u) => c4 === u || c4.startsWith(`${u}-`))
1064
+ );
1065
+ for (const size of containerSizes) {
1066
+ for (const c4 of layoutCandidates) {
1067
+ candidates.add(`@${size}:${c4}`);
1068
+ }
1069
+ }
1012
1070
  return [...candidates];
1013
1071
  }
1014
1072
  async function registryToDocumentation(registry2, options = {}) {
@@ -27076,7 +27134,7 @@ function extractShadcnRoot(css) {
27076
27134
  var THEME_BLOCK = /@theme(?:\s+inline)?\s*\{([^}]*)\}/g;
27077
27135
  var COMMENT = /\/\*[\s\S]*?\*\//g;
27078
27136
  var DECLARATION = /--([A-Za-z_-][\w-]*)\s*:\s*([^;]+);/g;
27079
- function extractThemeBlocks(css) {
27137
+ function extractThemeBlocks2(css) {
27080
27138
  const out = [];
27081
27139
  for (const match of css.matchAll(THEME_BLOCK)) {
27082
27140
  const body = (match[1] ?? "").replace(COMMENT, "");
@@ -27093,7 +27151,7 @@ function extractThemeBlocks(css) {
27093
27151
  // ../design-tokens/src/importers/bases.ts
27094
27152
  var LENGTH = /^(-?\d+(?:\.\d+)?)\s*(rem|px|em)$/;
27095
27153
  function detectBase(css, names, parse7) {
27096
- const decls = [...extractShadcnRoot(css), ...extractThemeBlocks(css)];
27154
+ const decls = [...extractShadcnRoot(css), ...extractThemeBlocks2(css)];
27097
27155
  let last2 = null;
27098
27156
  for (const decl of decls) {
27099
27157
  if (names.includes(decl.name)) last2 = decl.value.trim();
@@ -27318,7 +27376,7 @@ function detectFonts(css) {
27318
27376
  accept(family, quoteIfNeeded(family));
27319
27377
  }
27320
27378
  const rootDecls = extractShadcnRoot(css);
27321
- const themeDecls = extractThemeBlocks(css);
27379
+ const themeDecls = extractThemeBlocks2(css);
27322
27380
  for (const decl of [...rootDecls, ...themeDecls]) {
27323
27381
  if (!decl.name.startsWith("font-")) continue;
27324
27382
  const first = firstFamilyFromStack(decl.value);
@@ -29986,7 +30044,7 @@ async function init(options) {
29986
30044
  }
29987
30045
  }
29988
30046
  {
29989
- const themeDecls = extractThemeBlocks(sourceCss);
30047
+ const themeDecls = extractThemeBlocks2(sourceCss);
29990
30048
  if (themeDecls.length > 0) {
29991
30049
  const POSITION_SUFFIX = new RegExp(`^(.+)-(${SCALE_POSITIONS.join("|")})$`);
29992
30050
  const familySeeds = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rafters",
3
- "version": "0.0.76",
3
+ "version": "0.0.77",
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",