@getcoherent/core 0.6.33 → 0.6.35

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.d.ts CHANGED
@@ -3467,6 +3467,8 @@ declare class PageGenerator {
3467
3467
  * Generate props string for component
3468
3468
  */
3469
3469
  private generatePropsString;
3470
+ private isSidebarNav;
3471
+ private getBodyClasses;
3470
3472
  /**
3471
3473
  * Get container class based on layout type
3472
3474
  */
@@ -4361,6 +4363,8 @@ declare function buildCssVariables(config: DesignSystemConfig): string;
4361
4363
  */
4362
4364
  declare function atomicWriteFile(filePath: string, content: string): Promise<void>;
4363
4365
 
4366
+ declare function colorToHex(value: string): string | null;
4367
+
4364
4368
  /**
4365
4369
  * Story 2.11 Part C: Consistency audit for shared components.
4366
4370
  * - Verify usedIn vs actual imports
@@ -4391,4 +4395,4 @@ interface AuditResult {
4391
4395
  */
4392
4396
  declare function runAudit(projectRoot: string): Promise<AuditResult>;
4393
4397
 
4394
- export { type AuditEntryResult, type AuditResult, type BlogContent, CLI_VERSION, type ChangelogContent, type ColorToken, ColorTokenSchema, type ComponentAPI, type ComponentCriteria, type ComponentDefinition, ComponentDefinitionSchema, type ComponentDependency, ComponentGenerator, ComponentManager, type ComponentMeta, type ComponentProvider, type ComponentSize, ComponentSizeSchema, type ComponentSpec, type ComponentVariant, ComponentVariantSchema, type ContactContent, type CreateSharedComponentInput, type DashboardContent, type DesignSystemConfig, DesignSystemConfigSchema, DesignSystemGenerator, DesignSystemManager, type DesignTokens, DesignTokensSchema, type DiscoveryResult, EXAMPLE_MULTIPAGE_CONFIG, EXAMPLE_SPA_CONFIG, FIGMA_BASE_IDS, FRAMEWORK_VERSIONS, type FaqContent, type Features, FeaturesSchema, type FigmaBaseId, FigmaClient, type FigmaClientOptions, type FigmaColorStyle, type FigmaComponentData, type FigmaComponentMap, type FigmaComponentMeta, type FigmaDocumentNode, type FigmaEffectStyle, type FigmaFileResponse, type FigmaIntermediateData, type FigmaLayout, type FigmaNode, type FigmaNormalizationResult, type FigmaNormalizedEntry, type FigmaPageData, type FigmaProperty, type FigmaRgba, type FigmaStyleMeta, type FigmaTextStyle, type FigmaTokenExtractionResult, type FigmaVariant, type GalleryContent, type GenerateSharedComponentInput, type GenerateSharedComponentResult, type GeneratedPage, type LandingContent, type LayoutBlockDefinition, LayoutBlockDefinitionSchema, type ListingContent, type LoginContent, MANIFEST_FILENAME, type ModificationRequest, type ModificationResult, type Navigation, type NavigationItem, NavigationItemSchema, NavigationSchema, type OnboardingContent, type PageAnalysis, PageAnalysisSchema, type PageContent, type PageDefinition, PageDefinitionSchema, PageGenerator, type PageLayout, PageLayoutSchema, PageManager, type PageSection, PageSectionSchema, type PricingContent, type ProfileContent, ProjectScaffolder, type RadiusToken, RadiusTokenSchema, type RegisterContent, type SettingsContent, type SharedComponentEntry, SharedComponentEntrySchema, type SharedComponentType, SharedComponentTypeSchema, type SharedComponentsManifest, SharedComponentsManifestSchema, type SpacingToken, SpacingTokenSchema, TailwindConfigGenerator, type TemplateOptions, type TypographyToken, TypographyTokenSchema, allocateNextCid, atomicWriteFile, buildCssVariables, componentExists, createEntry, extractConfigObject, extractTokensFromFigma, figmaComponentNameToBaseId, figmaRgbaToHex, findSharedComponent, findSharedComponentByIdOrName, formatCid, generatePageFromFrame, generatePagesFromFigma, generateSharedComponent, generateSharedComponentTsx, getComponent, getManifestPath, getPage, getPageFilePath, getSupportedPageTypes, getTemplateForPageType, integrateSharedLayoutIntoRootLayout, loadManifest, mergeExtractedColorsWithDefaults, normalizeFigmaComponents, pageRouteExists, parseCid, parseFigmaFileResponse, removeEntry, resolveUniqueName, runAudit, saveManifest, setSharedMapping, toSharedFileName, updateEntry, updateUsedIn, validateConfig, validatePartialConfig };
4398
+ export { type AuditEntryResult, type AuditResult, type BlogContent, CLI_VERSION, type ChangelogContent, type ColorToken, ColorTokenSchema, type ComponentAPI, type ComponentCriteria, type ComponentDefinition, ComponentDefinitionSchema, type ComponentDependency, ComponentGenerator, ComponentManager, type ComponentMeta, type ComponentProvider, type ComponentSize, ComponentSizeSchema, type ComponentSpec, type ComponentVariant, ComponentVariantSchema, type ContactContent, type CreateSharedComponentInput, type DashboardContent, type DesignSystemConfig, DesignSystemConfigSchema, DesignSystemGenerator, DesignSystemManager, type DesignTokens, DesignTokensSchema, type DiscoveryResult, EXAMPLE_MULTIPAGE_CONFIG, EXAMPLE_SPA_CONFIG, FIGMA_BASE_IDS, FRAMEWORK_VERSIONS, type FaqContent, type Features, FeaturesSchema, type FigmaBaseId, FigmaClient, type FigmaClientOptions, type FigmaColorStyle, type FigmaComponentData, type FigmaComponentMap, type FigmaComponentMeta, type FigmaDocumentNode, type FigmaEffectStyle, type FigmaFileResponse, type FigmaIntermediateData, type FigmaLayout, type FigmaNode, type FigmaNormalizationResult, type FigmaNormalizedEntry, type FigmaPageData, type FigmaProperty, type FigmaRgba, type FigmaStyleMeta, type FigmaTextStyle, type FigmaTokenExtractionResult, type FigmaVariant, type GalleryContent, type GenerateSharedComponentInput, type GenerateSharedComponentResult, type GeneratedPage, type LandingContent, type LayoutBlockDefinition, LayoutBlockDefinitionSchema, type ListingContent, type LoginContent, MANIFEST_FILENAME, type ModificationRequest, type ModificationResult, type Navigation, type NavigationItem, NavigationItemSchema, NavigationSchema, type OnboardingContent, type PageAnalysis, PageAnalysisSchema, type PageContent, type PageDefinition, PageDefinitionSchema, PageGenerator, type PageLayout, PageLayoutSchema, PageManager, type PageSection, PageSectionSchema, type PricingContent, type ProfileContent, ProjectScaffolder, type RadiusToken, RadiusTokenSchema, type RegisterContent, type SettingsContent, type SharedComponentEntry, SharedComponentEntrySchema, type SharedComponentType, SharedComponentTypeSchema, type SharedComponentsManifest, SharedComponentsManifestSchema, type SpacingToken, SpacingTokenSchema, TailwindConfigGenerator, type TemplateOptions, type TypographyToken, TypographyTokenSchema, allocateNextCid, atomicWriteFile, buildCssVariables, colorToHex, componentExists, createEntry, extractConfigObject, extractTokensFromFigma, figmaComponentNameToBaseId, figmaRgbaToHex, findSharedComponent, findSharedComponentByIdOrName, formatCid, generatePageFromFrame, generatePagesFromFigma, generateSharedComponent, generateSharedComponentTsx, getComponent, getManifestPath, getPage, getPageFilePath, getSupportedPageTypes, getTemplateForPageType, integrateSharedLayoutIntoRootLayout, loadManifest, mergeExtractedColorsWithDefaults, normalizeFigmaComponents, pageRouteExists, parseCid, parseFigmaFileResponse, removeEntry, resolveUniqueName, runAudit, saveManifest, setSharedMapping, toSharedFileName, updateEntry, updateUsedIn, validateConfig, validatePartialConfig };
package/dist/index.js CHANGED
@@ -2,17 +2,17 @@
2
2
  import { z } from "zod";
3
3
  var ColorTokenSchema = z.object({
4
4
  primary: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color"),
5
- secondary: z.string().regex(/^#[0-9A-F]{6}$/i),
6
- accent: z.string().regex(/^#[0-9A-F]{6}$/i).optional(),
7
- success: z.string().regex(/^#[0-9A-F]{6}$/i),
8
- warning: z.string().regex(/^#[0-9A-F]{6}$/i),
9
- error: z.string().regex(/^#[0-9A-F]{6}$/i),
10
- info: z.string().regex(/^#[0-9A-F]{6}$/i),
5
+ secondary: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color"),
6
+ accent: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color").optional(),
7
+ success: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color"),
8
+ warning: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color"),
9
+ error: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color"),
10
+ info: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color"),
11
11
  // Neutral palette (generated from base or explicit)
12
- background: z.string().regex(/^#[0-9A-F]{6}$/i),
13
- foreground: z.string().regex(/^#[0-9A-F]{6}$/i),
14
- muted: z.string().regex(/^#[0-9A-F]{6}$/i),
15
- border: z.string().regex(/^#[0-9A-F]{6}$/i)
12
+ background: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color"),
13
+ foreground: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color"),
14
+ muted: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color"),
15
+ border: z.string().regex(/^#[0-9A-F]{6}$/i, "Must be valid hex color")
16
16
  });
17
17
  var SpacingTokenSchema = z.object({
18
18
  xs: z.string().default("0.25rem"),
@@ -502,6 +502,7 @@ function parseCid(id) {
502
502
  }
503
503
 
504
504
  // src/managers/DesignSystemManager.ts
505
+ import { ZodError } from "zod";
505
506
  import { readFile } from "fs/promises";
506
507
 
507
508
  // src/utils/atomicWrite.ts
@@ -520,6 +521,27 @@ async function atomicWriteFile(filePath, content) {
520
521
  }
521
522
 
522
523
  // src/managers/DesignSystemManager.ts
524
+ var VALID_COLOR_FIELDS = [
525
+ "primary",
526
+ "secondary",
527
+ "accent",
528
+ "success",
529
+ "warning",
530
+ "error",
531
+ "info",
532
+ "background",
533
+ "foreground",
534
+ "muted",
535
+ "border"
536
+ ];
537
+ var VALID_SPACING_FIELDS = ["xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
538
+ var VALID_RADIUS_FIELDS = ["none", "sm", "md", "lg", "xl", "full"];
539
+ var VALID_TOKEN_PATHS = /* @__PURE__ */ new Set([
540
+ ...VALID_COLOR_FIELDS.map((f) => `colors.light.${f}`),
541
+ ...VALID_COLOR_FIELDS.map((f) => `colors.dark.${f}`),
542
+ ...VALID_SPACING_FIELDS.map((f) => `spacing.${f}`),
543
+ ...VALID_RADIUS_FIELDS.map((f) => `radius.${f}`)
544
+ ]);
523
545
  var DesignSystemManager = class {
524
546
  config = null;
525
547
  configPath;
@@ -592,6 +614,14 @@ export const config = ${JSON.stringify(this.config, null, 2)} as const
592
614
  if (!this.config) {
593
615
  throw new Error("Config not loaded. Call load() first.");
594
616
  }
617
+ if (!VALID_TOKEN_PATHS.has(path)) {
618
+ return {
619
+ success: false,
620
+ modified: [],
621
+ config: this.config,
622
+ message: `Invalid token path "${path}". Valid color paths: colors.light.{primary,secondary,...}, colors.dark.{...}. Valid spacing: spacing.{xs,sm,md,lg,xl,2xl,3xl}. Valid radius: radius.{none,sm,md,lg,xl,full}.`
623
+ };
624
+ }
595
625
  try {
596
626
  const pathParts = path.split(".");
597
627
  let current = this.config.tokens;
@@ -634,12 +664,21 @@ export const config = ${JSON.stringify(this.config, null, 2)} as const
634
664
  warnings: affectedComponents.length > 0 ? [`This change affects ${affectedComponents.length} components and ${affectedPages.length} pages`] : void 0
635
665
  };
636
666
  } catch (error) {
667
+ if (error instanceof ZodError) {
668
+ const issues = error.issues.map((i) => `"${i.path.join(".")}" \u2014 ${i.message}`).join("; ");
669
+ return {
670
+ success: false,
671
+ modified: [],
672
+ config: this.config,
673
+ message: `Failed to update token "${path}": ${issues}`
674
+ };
675
+ }
637
676
  if (error instanceof Error) {
638
677
  return {
639
678
  success: false,
640
679
  modified: [],
641
680
  config: this.config,
642
- message: `Failed to update token: ${error.message}`
681
+ message: `Failed to update token "${path}": ${error.message}`
643
682
  };
644
683
  }
645
684
  throw error;
@@ -5887,6 +5926,17 @@ ${sections}
5887
5926
  });
5888
5927
  return " " + propsArray.join(" ");
5889
5928
  }
5929
+ isSidebarNav() {
5930
+ const navType = this.config.navigation?.type || "header";
5931
+ return navType === "sidebar" || navType === "both";
5932
+ }
5933
+ getBodyClasses() {
5934
+ const base = "bg-background text-foreground antialiased";
5935
+ if (this.isSidebarNav()) {
5936
+ return `min-h-svh ${base}`;
5937
+ }
5938
+ return `min-h-screen flex flex-col ${base}`;
5939
+ }
5890
5940
  /**
5891
5941
  * Get container class based on layout type
5892
5942
  */
@@ -5959,9 +6009,9 @@ export default function RootLayout({
5959
6009
  <head>
5960
6010
  <style dangerouslySetInnerHTML={{ __html: ${JSON.stringify(cssVars)} }} />
5961
6011
  </head>
5962
- <body className="min-h-screen flex flex-col bg-background text-foreground antialiased">
6012
+ <body className="${this.getBodyClasses()}">
5963
6013
  ${navEnabled ? ` ${navRendered}
5964
- ` : ""} <div className="flex-1 flex flex-col">{children}</div>
6014
+ ` : ""} <div className="flex-1${this.isSidebarNav() ? "" : " flex flex-col"}">{children}</div>
5965
6015
  </body>
5966
6016
  </html>
5967
6017
  )
@@ -6370,7 +6420,7 @@ ${companyColumn}
6370
6420
  }
6371
6421
  }
6372
6422
  const menuItem = (item) => ` <SidebarMenuItem>
6373
- <SidebarMenuButton asChild isActive={pathname === "${item.route}"}>
6423
+ <SidebarMenuButton asChild isActive={pathname?.startsWith("${item.route}")}>
6374
6424
  <Link href="${item.route}">${item.label}</Link>
6375
6425
  </SidebarMenuButton>
6376
6426
  </SidebarMenuItem>`;
@@ -6878,6 +6928,10 @@ async function integrateSharedLayoutIntoRootLayout(projectRoot) {
6878
6928
  const manifest = await loadManifest(projectRoot);
6879
6929
  const layoutComponents = manifest.shared.filter((e) => e.type === "layout");
6880
6930
  if (layoutComponents.length === 0) return false;
6931
+ const hasSidebar = manifest.shared.some(
6932
+ (e) => e.name === "AppSidebar" || e.name === "app-sidebar" || e.name === "Sidebar"
6933
+ );
6934
+ if (hasSidebar) return false;
6881
6935
  const layoutPath = join3(projectRoot, LAYOUT_PATH);
6882
6936
  let content;
6883
6937
  try {
@@ -7345,7 +7399,10 @@ export function cn(...inputs: ClassValue[]) {
7345
7399
  usedIn: ["app/(app)/layout.tsx"]
7346
7400
  });
7347
7401
  }
7348
- await integrateSharedLayoutIntoRootLayout(this.projectRoot);
7402
+ const isSidebar = navType === "sidebar" || navType === "both";
7403
+ if (!isSidebar) {
7404
+ await integrateSharedLayoutIntoRootLayout(this.projectRoot);
7405
+ }
7349
7406
  }
7350
7407
  }
7351
7408
  async generateDefaultPages() {
@@ -9738,6 +9795,487 @@ function generatePagesFromFigma(pages, componentMap, options) {
9738
9795
  }));
9739
9796
  }
9740
9797
 
9798
+ // src/utils/color-utils.ts
9799
+ var CSS_NAMED_COLORS = {
9800
+ aliceblue: "#F0F8FF",
9801
+ antiquewhite: "#FAEBD7",
9802
+ aqua: "#00FFFF",
9803
+ aquamarine: "#7FFFD4",
9804
+ azure: "#F0FFFF",
9805
+ beige: "#F5F5DC",
9806
+ bisque: "#FFE4C4",
9807
+ black: "#000000",
9808
+ blanchedalmond: "#FFEBCD",
9809
+ blue: "#0000FF",
9810
+ blueviolet: "#8A2BE2",
9811
+ brown: "#A52A2A",
9812
+ burlywood: "#DEB887",
9813
+ cadetblue: "#5F9EA0",
9814
+ chartreuse: "#7FFF00",
9815
+ chocolate: "#D2691E",
9816
+ coral: "#FF7F50",
9817
+ cornflowerblue: "#6495ED",
9818
+ cornsilk: "#FFF8DC",
9819
+ crimson: "#DC143C",
9820
+ cyan: "#00FFFF",
9821
+ darkblue: "#00008B",
9822
+ darkcyan: "#008B8B",
9823
+ darkgoldenrod: "#B8860B",
9824
+ darkgray: "#A9A9A9",
9825
+ darkgreen: "#006400",
9826
+ darkgrey: "#A9A9A9",
9827
+ darkkhaki: "#BDB76B",
9828
+ darkmagenta: "#8B008B",
9829
+ darkolivegreen: "#556B2F",
9830
+ darkorange: "#FF8C00",
9831
+ darkorchid: "#9932CC",
9832
+ darkred: "#8B0000",
9833
+ darksalmon: "#E9967A",
9834
+ darkseagreen: "#8FBC8F",
9835
+ darkslateblue: "#483D8B",
9836
+ darkslategray: "#2F4F4F",
9837
+ darkslategrey: "#2F4F4F",
9838
+ darkturquoise: "#00CED1",
9839
+ darkviolet: "#9400D3",
9840
+ deeppink: "#FF1493",
9841
+ deepskyblue: "#00BFFF",
9842
+ dimgray: "#696969",
9843
+ dimgrey: "#696969",
9844
+ dodgerblue: "#1E90FF",
9845
+ firebrick: "#B22222",
9846
+ floralwhite: "#FFFAF0",
9847
+ forestgreen: "#228B22",
9848
+ fuchsia: "#FF00FF",
9849
+ gainsboro: "#DCDCDC",
9850
+ ghostwhite: "#F8F8FF",
9851
+ gold: "#FFD700",
9852
+ goldenrod: "#DAA520",
9853
+ gray: "#808080",
9854
+ green: "#008000",
9855
+ greenyellow: "#ADFF2F",
9856
+ grey: "#808080",
9857
+ honeydew: "#F0FFF0",
9858
+ hotpink: "#FF69B4",
9859
+ indianred: "#CD5C5C",
9860
+ indigo: "#4B0082",
9861
+ ivory: "#FFFFF0",
9862
+ khaki: "#F0E68C",
9863
+ lavender: "#E6E6FA",
9864
+ lavenderblush: "#FFF0F5",
9865
+ lawngreen: "#7CFC00",
9866
+ lemonchiffon: "#FFFACD",
9867
+ lightblue: "#ADD8E6",
9868
+ lightcoral: "#F08080",
9869
+ lightcyan: "#E0FFFF",
9870
+ lightgoldenrodyellow: "#FAFAD2",
9871
+ lightgray: "#D3D3D3",
9872
+ lightgreen: "#90EE90",
9873
+ lightgrey: "#D3D3D3",
9874
+ lightpink: "#FFB6C1",
9875
+ lightsalmon: "#FFA07A",
9876
+ lightseagreen: "#20B2AA",
9877
+ lightskyblue: "#87CEFA",
9878
+ lightslategray: "#778899",
9879
+ lightslategrey: "#778899",
9880
+ lightsteelblue: "#B0C4DE",
9881
+ lightyellow: "#FFFFE0",
9882
+ lime: "#00FF00",
9883
+ limegreen: "#32CD32",
9884
+ linen: "#FAF0E6",
9885
+ magenta: "#FF00FF",
9886
+ maroon: "#800000",
9887
+ mediumaquamarine: "#66CDAA",
9888
+ mediumblue: "#0000CD",
9889
+ mediumorchid: "#BA55D3",
9890
+ mediumpurple: "#9370DB",
9891
+ mediumseagreen: "#3CB371",
9892
+ mediumslateblue: "#7B68EE",
9893
+ mediumspringgreen: "#00FA9A",
9894
+ mediumturquoise: "#48D1CC",
9895
+ mediumvioletred: "#C71585",
9896
+ midnightblue: "#191970",
9897
+ mintcream: "#F5FFFA",
9898
+ mistyrose: "#FFE4E1",
9899
+ moccasin: "#FFE4B5",
9900
+ navajowhite: "#FFDEAD",
9901
+ navy: "#000080",
9902
+ oldlace: "#FDF5E6",
9903
+ olive: "#808000",
9904
+ olivedrab: "#6B8E23",
9905
+ orange: "#FFA500",
9906
+ orangered: "#FF4500",
9907
+ orchid: "#DA70D6",
9908
+ palegoldenrod: "#EEE8AA",
9909
+ palegreen: "#98FB98",
9910
+ paleturquoise: "#AFEEEE",
9911
+ palevioletred: "#DB7093",
9912
+ papayawhip: "#FFEFD5",
9913
+ peachpuff: "#FFDAB9",
9914
+ peru: "#CD853F",
9915
+ pink: "#FFC0CB",
9916
+ plum: "#DDA0DD",
9917
+ powderblue: "#B0E0E6",
9918
+ purple: "#800080",
9919
+ rebeccapurple: "#663399",
9920
+ red: "#FF0000",
9921
+ rosybrown: "#BC8F8F",
9922
+ royalblue: "#4169E1",
9923
+ saddlebrown: "#8B4513",
9924
+ salmon: "#FA8072",
9925
+ sandybrown: "#F4A460",
9926
+ seagreen: "#2E8B57",
9927
+ seashell: "#FFF5EE",
9928
+ sienna: "#A0522D",
9929
+ silver: "#C0C0C0",
9930
+ skyblue: "#87CEEB",
9931
+ slateblue: "#6A5ACD",
9932
+ slategray: "#708090",
9933
+ slategrey: "#708090",
9934
+ snow: "#FFFAFA",
9935
+ springgreen: "#00FF7F",
9936
+ steelblue: "#4682B4",
9937
+ tan: "#D2B48C",
9938
+ teal: "#008080",
9939
+ thistle: "#D8BFD8",
9940
+ tomato: "#FF6347",
9941
+ turquoise: "#40E0D0",
9942
+ violet: "#EE82EE",
9943
+ wheat: "#F5DEB3",
9944
+ white: "#FFFFFF",
9945
+ whitesmoke: "#F5F5F5",
9946
+ yellow: "#FFFF00",
9947
+ yellowgreen: "#9ACD32"
9948
+ };
9949
+ var TAILWIND_COLORS = {
9950
+ "slate-50": "#F8FAFC",
9951
+ "slate-100": "#F1F5F9",
9952
+ "slate-200": "#E2E8F0",
9953
+ "slate-300": "#CBD5E1",
9954
+ "slate-400": "#94A3B8",
9955
+ "slate-500": "#64748B",
9956
+ "slate-600": "#475569",
9957
+ "slate-700": "#334155",
9958
+ "slate-800": "#1E293B",
9959
+ "slate-900": "#0F172A",
9960
+ "slate-950": "#020617",
9961
+ "gray-50": "#F9FAFB",
9962
+ "gray-100": "#F3F4F6",
9963
+ "gray-200": "#E5E7EB",
9964
+ "gray-300": "#D1D5DB",
9965
+ "gray-400": "#9CA3AF",
9966
+ "gray-500": "#6B7280",
9967
+ "gray-600": "#4B5563",
9968
+ "gray-700": "#374151",
9969
+ "gray-800": "#1F2937",
9970
+ "gray-900": "#111827",
9971
+ "gray-950": "#030712",
9972
+ "zinc-50": "#FAFAFA",
9973
+ "zinc-100": "#F4F4F5",
9974
+ "zinc-200": "#E4E4E7",
9975
+ "zinc-300": "#D4D4D8",
9976
+ "zinc-400": "#A1A1AA",
9977
+ "zinc-500": "#71717A",
9978
+ "zinc-600": "#52525B",
9979
+ "zinc-700": "#3F3F46",
9980
+ "zinc-800": "#27272A",
9981
+ "zinc-900": "#18181B",
9982
+ "zinc-950": "#09090B",
9983
+ "neutral-50": "#FAFAFA",
9984
+ "neutral-100": "#F5F5F5",
9985
+ "neutral-200": "#E5E5E5",
9986
+ "neutral-300": "#D4D4D4",
9987
+ "neutral-400": "#A3A3A3",
9988
+ "neutral-500": "#737373",
9989
+ "neutral-600": "#525252",
9990
+ "neutral-700": "#404040",
9991
+ "neutral-800": "#262626",
9992
+ "neutral-900": "#171717",
9993
+ "neutral-950": "#0A0A0A",
9994
+ "stone-50": "#FAFAF9",
9995
+ "stone-100": "#F5F5F4",
9996
+ "stone-200": "#E7E5E4",
9997
+ "stone-300": "#D6D3D1",
9998
+ "stone-400": "#A8A29E",
9999
+ "stone-500": "#78716C",
10000
+ "stone-600": "#57534E",
10001
+ "stone-700": "#44403C",
10002
+ "stone-800": "#292524",
10003
+ "stone-900": "#1C1917",
10004
+ "stone-950": "#0C0A09",
10005
+ "red-50": "#FEF2F2",
10006
+ "red-100": "#FEE2E2",
10007
+ "red-200": "#FECACA",
10008
+ "red-300": "#FCA5A5",
10009
+ "red-400": "#F87171",
10010
+ "red-500": "#EF4444",
10011
+ "red-600": "#DC2626",
10012
+ "red-700": "#B91C1C",
10013
+ "red-800": "#991B1B",
10014
+ "red-900": "#7F1D1D",
10015
+ "red-950": "#450A0A",
10016
+ "orange-50": "#FFF7ED",
10017
+ "orange-100": "#FFEDD5",
10018
+ "orange-200": "#FED7AA",
10019
+ "orange-300": "#FDBA74",
10020
+ "orange-400": "#FB923C",
10021
+ "orange-500": "#F97316",
10022
+ "orange-600": "#EA580C",
10023
+ "orange-700": "#C2410C",
10024
+ "orange-800": "#9A3412",
10025
+ "orange-900": "#7C2D12",
10026
+ "orange-950": "#431407",
10027
+ "amber-50": "#FFFBEB",
10028
+ "amber-100": "#FEF3C7",
10029
+ "amber-200": "#FDE68A",
10030
+ "amber-300": "#FCD34D",
10031
+ "amber-400": "#FBBF24",
10032
+ "amber-500": "#F59E0B",
10033
+ "amber-600": "#D97706",
10034
+ "amber-700": "#B45309",
10035
+ "amber-800": "#92400E",
10036
+ "amber-900": "#78350F",
10037
+ "amber-950": "#451A03",
10038
+ "yellow-50": "#FEFCE8",
10039
+ "yellow-100": "#FEF9C3",
10040
+ "yellow-200": "#FEF08A",
10041
+ "yellow-300": "#FDE047",
10042
+ "yellow-400": "#FACC15",
10043
+ "yellow-500": "#EAB308",
10044
+ "yellow-600": "#CA8A04",
10045
+ "yellow-700": "#A16207",
10046
+ "yellow-800": "#854D0E",
10047
+ "yellow-900": "#713F12",
10048
+ "yellow-950": "#422006",
10049
+ "lime-50": "#F7FEE7",
10050
+ "lime-100": "#ECFCCB",
10051
+ "lime-200": "#D9F99D",
10052
+ "lime-300": "#BEF264",
10053
+ "lime-400": "#A3E635",
10054
+ "lime-500": "#84CC16",
10055
+ "lime-600": "#65A30D",
10056
+ "lime-700": "#4D7C0F",
10057
+ "lime-800": "#3F6212",
10058
+ "lime-900": "#365314",
10059
+ "lime-950": "#1A2E05",
10060
+ "green-50": "#F0FDF4",
10061
+ "green-100": "#DCFCE7",
10062
+ "green-200": "#BBF7D0",
10063
+ "green-300": "#86EFAC",
10064
+ "green-400": "#4ADE80",
10065
+ "green-500": "#22C55E",
10066
+ "green-600": "#16A34A",
10067
+ "green-700": "#15803D",
10068
+ "green-800": "#166534",
10069
+ "green-900": "#14532D",
10070
+ "green-950": "#052E16",
10071
+ "emerald-50": "#ECFDF5",
10072
+ "emerald-100": "#D1FAE5",
10073
+ "emerald-200": "#A7F3D0",
10074
+ "emerald-300": "#6EE7B7",
10075
+ "emerald-400": "#34D399",
10076
+ "emerald-500": "#10B981",
10077
+ "emerald-600": "#059669",
10078
+ "emerald-700": "#047857",
10079
+ "emerald-800": "#065F46",
10080
+ "emerald-900": "#064E3B",
10081
+ "emerald-950": "#022C22",
10082
+ "teal-50": "#F0FDFA",
10083
+ "teal-100": "#CCFBF1",
10084
+ "teal-200": "#99F6E4",
10085
+ "teal-300": "#5EEAD4",
10086
+ "teal-400": "#2DD4BF",
10087
+ "teal-500": "#14B8A6",
10088
+ "teal-600": "#0D9488",
10089
+ "teal-700": "#0F766E",
10090
+ "teal-800": "#115E59",
10091
+ "teal-900": "#134E4A",
10092
+ "teal-950": "#042F2E",
10093
+ "cyan-50": "#ECFEFF",
10094
+ "cyan-100": "#CFFAFE",
10095
+ "cyan-200": "#A5F3FC",
10096
+ "cyan-300": "#67E8F9",
10097
+ "cyan-400": "#22D3EE",
10098
+ "cyan-500": "#06B6D4",
10099
+ "cyan-600": "#0891B2",
10100
+ "cyan-700": "#0E7490",
10101
+ "cyan-800": "#155E75",
10102
+ "cyan-900": "#164E63",
10103
+ "cyan-950": "#083344",
10104
+ "sky-50": "#F0F9FF",
10105
+ "sky-100": "#E0F2FE",
10106
+ "sky-200": "#BAE6FD",
10107
+ "sky-300": "#7DD3FC",
10108
+ "sky-400": "#38BDF8",
10109
+ "sky-500": "#0EA5E9",
10110
+ "sky-600": "#0284C7",
10111
+ "sky-700": "#0369A1",
10112
+ "sky-800": "#075985",
10113
+ "sky-900": "#0C4A6E",
10114
+ "sky-950": "#082F49",
10115
+ "blue-50": "#EFF6FF",
10116
+ "blue-100": "#DBEAFE",
10117
+ "blue-200": "#BFDBFE",
10118
+ "blue-300": "#93C5FD",
10119
+ "blue-400": "#60A5FA",
10120
+ "blue-500": "#3B82F6",
10121
+ "blue-600": "#2563EB",
10122
+ "blue-700": "#1D4ED8",
10123
+ "blue-800": "#1E40AF",
10124
+ "blue-900": "#1E3A8A",
10125
+ "blue-950": "#172554",
10126
+ "indigo-50": "#EEF2FF",
10127
+ "indigo-100": "#E0E7FF",
10128
+ "indigo-200": "#C7D2FE",
10129
+ "indigo-300": "#A5B4FC",
10130
+ "indigo-400": "#818CF8",
10131
+ "indigo-500": "#6366F1",
10132
+ "indigo-600": "#4F46E5",
10133
+ "indigo-700": "#4338CA",
10134
+ "indigo-800": "#3730A3",
10135
+ "indigo-900": "#312E81",
10136
+ "indigo-950": "#1E1B4B",
10137
+ "violet-50": "#F5F3FF",
10138
+ "violet-100": "#EDE9FE",
10139
+ "violet-200": "#DDD6FE",
10140
+ "violet-300": "#C4B5FD",
10141
+ "violet-400": "#A78BFA",
10142
+ "violet-500": "#8B5CF6",
10143
+ "violet-600": "#7C3AED",
10144
+ "violet-700": "#6D28D9",
10145
+ "violet-800": "#5B21B6",
10146
+ "violet-900": "#4C1D95",
10147
+ "violet-950": "#2E1065",
10148
+ "purple-50": "#FAF5FF",
10149
+ "purple-100": "#F3E8FF",
10150
+ "purple-200": "#E9D5FF",
10151
+ "purple-300": "#D8B4FE",
10152
+ "purple-400": "#C084FC",
10153
+ "purple-500": "#A855F7",
10154
+ "purple-600": "#9333EA",
10155
+ "purple-700": "#7E22CE",
10156
+ "purple-800": "#6B21A8",
10157
+ "purple-900": "#581C87",
10158
+ "purple-950": "#3B0764",
10159
+ "fuchsia-50": "#FDF4FF",
10160
+ "fuchsia-100": "#FAE8FF",
10161
+ "fuchsia-200": "#F5D0FE",
10162
+ "fuchsia-300": "#F0ABFC",
10163
+ "fuchsia-400": "#E879F9",
10164
+ "fuchsia-500": "#D946EF",
10165
+ "fuchsia-600": "#C026D3",
10166
+ "fuchsia-700": "#A21CAF",
10167
+ "fuchsia-800": "#86198F",
10168
+ "fuchsia-900": "#701A75",
10169
+ "fuchsia-950": "#4A044E",
10170
+ "pink-50": "#FDF2F8",
10171
+ "pink-100": "#FCE7F3",
10172
+ "pink-200": "#FBCFE8",
10173
+ "pink-300": "#F9A8D4",
10174
+ "pink-400": "#F472B6",
10175
+ "pink-500": "#EC4899",
10176
+ "pink-600": "#DB2777",
10177
+ "pink-700": "#BE185D",
10178
+ "pink-800": "#9D174D",
10179
+ "pink-900": "#831843",
10180
+ "pink-950": "#500724",
10181
+ "rose-50": "#FFF1F2",
10182
+ "rose-100": "#FFE4E6",
10183
+ "rose-200": "#FECDD3",
10184
+ "rose-300": "#FDA4AF",
10185
+ "rose-400": "#FB7185",
10186
+ "rose-500": "#F43F5E",
10187
+ "rose-600": "#E11D48",
10188
+ "rose-700": "#BE123C",
10189
+ "rose-800": "#9F1239",
10190
+ "rose-900": "#881337",
10191
+ "rose-950": "#4C0519"
10192
+ };
10193
+ function hslToRgb(h, s, l) {
10194
+ h = (h % 360 + 360) % 360;
10195
+ s = Math.max(0, Math.min(1, s));
10196
+ l = Math.max(0, Math.min(1, l));
10197
+ const c = (1 - Math.abs(2 * l - 1)) * s;
10198
+ const x = c * (1 - Math.abs(h / 60 % 2 - 1));
10199
+ const m = l - c / 2;
10200
+ let r1, g1, b1;
10201
+ if (h < 60) {
10202
+ ;
10203
+ [r1, g1, b1] = [c, x, 0];
10204
+ } else if (h < 120) {
10205
+ ;
10206
+ [r1, g1, b1] = [x, c, 0];
10207
+ } else if (h < 180) {
10208
+ ;
10209
+ [r1, g1, b1] = [0, c, x];
10210
+ } else if (h < 240) {
10211
+ ;
10212
+ [r1, g1, b1] = [0, x, c];
10213
+ } else if (h < 300) {
10214
+ ;
10215
+ [r1, g1, b1] = [x, 0, c];
10216
+ } else {
10217
+ ;
10218
+ [r1, g1, b1] = [c, 0, x];
10219
+ }
10220
+ return [
10221
+ Math.round((r1 + m) * 255),
10222
+ Math.round((g1 + m) * 255),
10223
+ Math.round((b1 + m) * 255)
10224
+ ];
10225
+ }
10226
+ function componentToHex(c) {
10227
+ const clamped = Math.max(0, Math.min(255, Math.round(c)));
10228
+ return clamped.toString(16).padStart(2, "0").toUpperCase();
10229
+ }
10230
+ function rgbToHex(r, g, b) {
10231
+ return `#${componentToHex(r)}${componentToHex(g)}${componentToHex(b)}`;
10232
+ }
10233
+ function colorToHex(value) {
10234
+ const trimmed = value.trim();
10235
+ if (!trimmed) return null;
10236
+ if (/^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(trimmed)) {
10237
+ return `#${trimmed.slice(1, 7).toUpperCase()}`;
10238
+ }
10239
+ if (/^#[0-9A-Fa-f]{3}$/.test(trimmed)) {
10240
+ const r = trimmed[1];
10241
+ const g = trimmed[2];
10242
+ const b = trimmed[3];
10243
+ return `#${r}${r}${g}${g}${b}${b}`.toUpperCase();
10244
+ }
10245
+ if (/^[0-9A-Fa-f]{6}$/.test(trimmed)) {
10246
+ return `#${trimmed.toUpperCase()}`;
10247
+ }
10248
+ const lower = trimmed.toLowerCase();
10249
+ const rgbMatch = lower.match(
10250
+ /^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*[\d.]+\s*)?\)$/
10251
+ );
10252
+ if (rgbMatch) {
10253
+ return rgbToHex(
10254
+ parseInt(rgbMatch[1], 10),
10255
+ parseInt(rgbMatch[2], 10),
10256
+ parseInt(rgbMatch[3], 10)
10257
+ );
10258
+ }
10259
+ const hslMatch = lower.match(
10260
+ /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%\s*(?:,\s*[\d.]+\s*)?\)$/
10261
+ );
10262
+ if (hslMatch) {
10263
+ const [r, g, b] = hslToRgb(
10264
+ parseFloat(hslMatch[1]),
10265
+ parseFloat(hslMatch[2]) / 100,
10266
+ parseFloat(hslMatch[3]) / 100
10267
+ );
10268
+ return rgbToHex(r, g, b);
10269
+ }
10270
+ if (CSS_NAMED_COLORS[lower]) {
10271
+ return CSS_NAMED_COLORS[lower];
10272
+ }
10273
+ if (TAILWIND_COLORS[lower]) {
10274
+ return TAILWIND_COLORS[lower];
10275
+ }
10276
+ return null;
10277
+ }
10278
+
9741
10279
  // src/audit/ComponentAuditor.ts
9742
10280
  import { readFile as readFile4, readdir } from "fs/promises";
9743
10281
  import { join as join5 } from "path";
@@ -9950,6 +10488,7 @@ export {
9950
10488
  allocateNextCid,
9951
10489
  atomicWriteFile,
9952
10490
  buildCssVariables,
10491
+ colorToHex,
9953
10492
  componentExists,
9954
10493
  createEntry,
9955
10494
  extractConfigObject,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.6.33",
6
+ "version": "0.6.35",
7
7
  "description": "Core design system engine for Coherent",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",