onsystem 0.7.0 → 0.9.0

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.
@@ -1,4 +1,4 @@
1
- import { h as DesignSystemModel, i as ResolvedConfig } from "./config-1XSTYI44.js";
1
+ import { h as DesignSystemModel, i as ResolvedConfig } from "./config-B98w8bcg.js";
2
2
  import { MessagePort } from "node:worker_threads";
3
3
  //#region src/eslint/worker.d.ts
4
4
  export interface LoadRequest {
@@ -1,5 +1,5 @@
1
- import { Ct as relativePath, K as DEFAULT_TEST_EXCLUDE, St as matchesGlob, i as componentFiles, q as DEFAULT_TEST_FOLDERS, r as buildModel } from "./design-system-C4bhqLLw.js";
2
- import { r as loadTarget } from "./workspace-Z0tZf_Dv.js";
1
+ import { At as relativePath, i as componentFiles, r as buildModel, rt as excludedBy } from "./design-system-Bykei5W0.js";
2
+ import { r as loadTarget } from "./workspace-Dp1q8qZ8.js";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import { parentPort } from "node:worker_threads";
@@ -14,8 +14,6 @@ const warned = /* @__PURE__ */ new Set();
14
14
  /** How long a loaded design system is trusted before its files are looked at again. */
15
15
  const FRESH_MS = 2e3;
16
16
  const targets = /* @__PURE__ */ new Map();
17
- /** The default test and story patterns: the recommended config ignores those files itself. */
18
- const TEST_PATTERNS = /* @__PURE__ */ new Set([DEFAULT_TEST_EXCLUDE, DEFAULT_TEST_FOLDERS]);
19
17
  const projects = /* @__PURE__ */ new Map();
20
18
  function realPath(file) {
21
19
  try {
@@ -65,7 +63,7 @@ async function load(request) {
65
63
  projects.set(config.root, project);
66
64
  }
67
65
  const relative = relativePath(config.root, request.file);
68
- const excluded = config.exclude.find((pattern) => !TEST_PATTERNS.has(pattern) && matchesGlob(relative, pattern));
66
+ const excluded = excludedBy(config, relative, { includeTests: true });
69
67
  if (excluded) return { skip: `excluded by "${excluded}"` };
70
68
  if (!config.includeDesignSystem && project.own.has(realPath(request.file))) return { skip: "one of the design system’s own component files" };
71
69
  const { version } = project;
package/dist/eslint.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Ct as relativePath, G as DEFAULT_SEVERITY, K as DEFAULT_TEST_EXCLUDE, _ as NAME, k as RULES, q as DEFAULT_TEST_FOLDERS, t as DesignSystem, v as VERSION } from "./design-system-C4bhqLLw.js";
1
+ import { At as relativePath, N as RULES, Q as DEFAULT_TEST_FOLDERS, X as DEFAULT_SEVERITY, Z as DEFAULT_TEST_EXCLUDE, t as DesignSystem, v as NAME, y as VERSION } from "./design-system-Bykei5W0.js";
2
2
  import path from "node:path";
3
3
  import { MessageChannel, Worker, receiveMessageOnPort } from "node:worker_threads";
4
4
  //#region src/eslint/bridge.ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as TOKEN_CATEGORIES, D as VariantInfo, E as TokenCategory, O as ImportMapping, S as SourceLocation, T as Token, _ as DocSection, a as ResolvedRule, b as PropInfo, c as configJsonSchema, d as CheckResult, f as ComponentDocs, g as Diagnostic, h as DesignSystemModel, i as ResolvedConfig, l as defineConfig, m as CompoundVariantInfo, n as LoadConfigOptions, o as RuleId, p as ComponentInfo, r as RULE_IDS, s as RuleOptions, t as Config, u as loadConfig, v as ExampleInfo, w as TextEdit, x as Severity, y as InheritedProps } from "./config-1XSTYI44.js";
1
+ import { C as TOKEN_CATEGORIES, D as VariantInfo, E as TokenCategory, O as ImportMapping, S as SourceLocation, T as Token, _ as DocSection, a as ResolvedRule, b as PropInfo, c as configJsonSchema, d as CheckResult, f as ComponentDocs, g as Diagnostic, h as DesignSystemModel, i as ResolvedConfig, l as defineConfig, m as CompoundVariantInfo, n as LoadConfigOptions, o as RuleId, p as ComponentInfo, r as RULE_IDS, s as RuleOptions, t as Config, u as loadConfig, v as ExampleInfo, w as TextEdit, x as Severity, y as InheritedProps } from "./config-B98w8bcg.js";
2
2
  import ts from "typescript";
3
3
  import { Oklch } from "culori";
4
4
  import { McpServer, Transport } from "@modelcontextprotocol/server";
@@ -518,7 +518,17 @@ interface SearchHit {
518
518
  component: ComponentInfo;
519
519
  score: number;
520
520
  matched: string[];
521
+ /** No hit clearly matches the query: this one has only a word or two in common with it. */
522
+ weak?: true;
521
523
  }
524
+ /**
525
+ * Components for `query`, best first. A hit matches clearly when a word of the query is in
526
+ * its name (`button` for Button) or when it has more than half of the query's words, each
527
+ * itself or through a synonym (`modal` through `dialog`). The hits that do not are left out
528
+ * when any does, and otherwise come back marked `weak`: "a dropdown menu to pick a country",
529
+ * in a design system with no select, finds only a card's action slot that mentions a menu,
530
+ * which is not an answer to give as the best match.
531
+ */
522
532
  export declare function searchComponents(index: Bm25Index<ComponentInfo>, query: string, limit?: number): SearchHit[];
523
533
  //#endregion
524
534
  //#region src/util/log.d.ts
@@ -541,11 +551,24 @@ export declare class DesignSystem {
541
551
  private readonly searchIndex;
542
552
  /**
543
553
  * The components the tools offer: all of them, except a library's (MUI's) where the project
544
- * has its own of that name, a wrapper the team means to be used. The rules still check code
545
- * that imports the library's directly against the library's.
554
+ * has its own of that name, a wrapper the team means to be used, and the helpers in a
555
+ * registry folder's `lib/` (signoff-ui's `Img` and icons). The rules still check code that
556
+ * imports either directly against them.
546
557
  */
547
558
  private readonly offered;
559
+ /** The design systems the rules rank, with the registry folders a config lists. */
560
+ private readonly sources;
548
561
  constructor(model: DesignSystemModel, config: ResolvedConfig);
562
+ /**
563
+ * The shadcn registry a component was copied from (`@signoff-ui`), when its folder is one
564
+ * components.json names: a read-only design system, whose code is the registry's.
565
+ */
566
+ registryOf(component: ComponentInfo): {
567
+ registry: string;
568
+ folder: string;
569
+ } | undefined;
570
+ /** A component in a registry folder's `lib/`: an internal of its items, not one of them. */
571
+ private registryHelper;
549
572
  get root(): string;
550
573
  get components(): ComponentInfo[];
551
574
  get tokens(): Token[];
@@ -788,7 +811,7 @@ declare class Catalog {
788
811
  }
789
812
  //#endregion
790
813
  //#region src/server/index.d.ts
791
- export declare const INSTRUCTIONS = "This server describes the project's design system: its React components (props, variants, parts), design tokens and usage docs, and lints UI code against it.\nWhen writing or changing UI in this project:\n1. Find components with search_components (by intent) or list_components.\n2. Read get_component before using a component: use only the props and variant values it lists.\n3. Style with tokens from get_tokens, never with hex/rgb colors, arbitrary px values or Tailwind's default palette.\n4. Run check_ui on every snippet or file you write and fix all errors before you finish.\nIn a monorepo served from its root, pass `path` (the file you are editing) to list_components, get_component, search_components and get_tokens, and `path` or `filename` to check_ui, so each answer comes from that file's own project.";
814
+ export declare const INSTRUCTIONS = "This server describes the project's design system: its React components (props, variants, parts), design tokens and usage docs, and lints UI code against it.\nWhen writing or changing UI in this project:\n1. Find components with search_components (by intent) or list_components.\n2. Read get_component before using a component: use only the props and variant values it lists.\n3. Style with tokens from get_tokens, never with hex/rgb colors, arbitrary px values or Tailwind's default palette. chart-* and sidebar-* tokens are for charts and the sidebar only: for a status color the theme has no token for (success, warning, info), add a token or keep the Tailwind color as check_ui says, and never use a chart-* or sidebar-* token for it.\n4. Run check_ui on every snippet or file you write and fix all errors before you finish.\nIn a monorepo served from its root, pass `path` (the file you are editing) to list_components, get_component, search_components and get_tokens, and `path` or `filename` to check_ui, so each answer comes from that file's own project.";
792
815
  interface CreateServerOptions {
793
816
  /**
794
817
  * Resolves the design system to serve. Called per request, so it can be swapped on reload.
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as loadConfig, A as TokenIndex, B as parseDoc, I as parseDtcgTokens, L as parseDesignMd, M as mergeTokens, N as toDesignMd, P as toDtcg, R as parseCssTokens, V as extractComponents, X as configJsonSchema, Y as RULE_IDS, Z as defineConfig, a as fingerprint, d as searchComponents, f as applyFixes, g as formatDiagnostics, j as loadTokens, k as RULES, n as DesignSystemHost, o as loadDesignSystem, p as checkSource, r as buildModel, rt as findVariantDefinitions, t as DesignSystem, v as VERSION, z as attachDocs } from "./design-system-C4bhqLLw.js";
2
- import { n as INSTRUCTIONS, r as createServer, t as serveStdio } from "./stdio-BojAQ6JP.js";
1
+ import { F as loadTokens, G as parseDoc, H as parseDesignMd, I as mergeTokens, K as extractComponents, L as toDesignMd, N as RULES, P as TokenIndex, R as toDtcg, U as parseCssTokens, V as parseDtcgTokens, W as attachDocs, _ as formatDiagnostics, a as fingerprint, at as loadConfig, et as RULE_IDS, f as searchComponents, lt as findVariantDefinitions, m as checkSource, n as DesignSystemHost, nt as defineConfig, o as loadDesignSystem, p as applyFixes, r as buildModel, t as DesignSystem, tt as configJsonSchema, y as VERSION } from "./design-system-Bykei5W0.js";
2
+ import { n as INSTRUCTIONS, r as createServer, t as serveStdio } from "./stdio-B7u6dqLd.js";
3
3
  export { DesignSystem, DesignSystemHost, INSTRUCTIONS, RULES, RULE_IDS, TokenIndex, VERSION, applyFixes, attachDocs, buildModel, checkSource, configJsonSchema, createServer, defineConfig, extractComponents, findVariantDefinitions, fingerprint, formatDiagnostics, loadConfig, loadDesignSystem, loadTokens, mergeTokens, parseCssTokens, parseDesignMd, parseDoc, parseDtcgTokens, searchComponents, serveStdio, toDesignMd, toDtcg };