An open source design system that's fully customizable and agent ready
TypeScript
Enhance documentation standards and update file headers across the project. Introduced Fractal Documentation structure in CLAUDE.md, added sync reminders in various config and source files, and expanded project structure details in README.md.
Liya Guobe00d3054109
diff --git a/CLAUDE.md b/CLAUDE.mdindex 26935f2217..00d1f822c8 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -9,6 +9,21 @@ For architectural context and decisions, see `.context/`:- `.context/explorations/` — Research and brainstorms- `.context/proposals/` — Feature proposals+## Documentation Standard++This project uses **Fractal Documentation** — a self-referential pattern where documentation exists at three levels:++1. **Project Root** (`README.md`) — Project-wide architecture and directory overview+2. **Directory READMEs** — Each directory contains a `README.md` with file manifests+3. **File Headers** — Each source file has a structured JSDoc header with `@input`, `@output`, `@position`++**Update Protocol**: When modifying code, update:+1. The file's header comment+2. The directory's README.md+3. Parent documentation if architecture changes++Look for `<!-- SYNC: ... -->` comments and `SYNC:` in file headers as reminders.+## Quick Reference- **Package manager**: pnpmdiff --git a/README.md b/README.mdindex abfca8396a..46f38671ef 100644--- a/README.md+++ b/README.md@@ -1,3 +1,5 @@+<!-- SYNC CONTRACT: Architecture changes require documentation updates. -->+# XDSA design system for building internal tools and products, enabling the creation of high-quality product experiences.@@ -33,6 +35,15 @@ A library of 300+ reusable UI building blocks with full TypeScript support.33+ battle-tested design solutions for common interactions and workflows: table pages, detail page layouts, form wizards, navigation patterns, data entry flows.+## Project Structure++| Directory | Purpose |+|-----------|---------|+| `apps/` | Application packages: documentation site, sandbox, and Storybook |+| `packages/` | Published packages: core components and utilities |+| `internal/` | Internal tooling: test utilities and build helpers |+| `e2e/` | End-to-end tests using Playwright |+## ContributingWe welcome contributions! Please see our contributing guide for details.diff --git a/apps/README.md b/apps/README.mdnew file mode 100644index 0000000000..a2833fda2a--- /dev/null+++ b/apps/README.md@@ -0,0 +1,12 @@+# /apps++Application packages for development, documentation, and visual testing.++<!-- SYNC: When files in this directory change, update this document. -->++| Directory | Role | Purpose |+|-----------|------|---------|+| `docs/` | Documentation | Documentation website for the design system |+| `sandbox/` | Development | Local development and testing environment |+| `storybook/` | Visual Testing | Storybook for component development and visual documentation |+diff --git a/apps/docs/README.md b/apps/docs/README.mdnew file mode 100644index 0000000000..dfac356d2c--- /dev/null+++ b/apps/docs/README.md@@ -0,0 +1,10 @@+# /apps/docs++Documentation website for the XDS design system.++<!-- SYNC: When files in this directory change, update this document. -->++| File | Role | Purpose |+|------|------|---------|+| `package.json` | Config | Package dependencies and scripts |+diff --git a/apps/sandbox/README.md b/apps/sandbox/README.mdnew file mode 100644index 0000000000..f9a53b0ccf--- /dev/null+++ b/apps/sandbox/README.md@@ -0,0 +1,10 @@+# /apps/sandbox++Local development and testing environment for XDS components.++<!-- SYNC: When files in this directory change, update this document. -->++| File | Role | Purpose |+|------|------|---------|+| `package.json` | Config | Package dependencies and scripts |+diff --git a/apps/storybook/README.md b/apps/storybook/README.mdnew file mode 100644index 0000000000..21c464a768--- /dev/null+++ b/apps/storybook/README.md@@ -0,0 +1,12 @@+# /apps/storybook++Storybook application for component development and visual documentation.++<!-- SYNC: When files in this directory change, update this document. -->++| File | Role | Purpose |+|------|------|---------|+| `package.json` | Config | Package dependencies and scripts |+| `tsconfig.json` | Config | TypeScript compiler configuration |+| `vite.config.ts` | Config | Vite bundler configuration with path aliases |+diff --git a/apps/storybook/vite.config.ts b/apps/storybook/vite.config.tsindex 54121fe1b2..1b713613ce 100644--- a/apps/storybook/vite.config.ts+++ b/apps/storybook/vite.config.ts@@ -1,3 +1,12 @@+/**+ * @file vite.config.ts+ * @input Uses vite, @vitejs/plugin-react, path+ * @output Vite configuration with React plugin and @xds/core alias+ * @position Build config; used by Storybook's Vite integration+ *+ * SYNC: When modified, update this header and /apps/storybook/README.md+ */+import { defineConfig } from 'vite';import react from '@vitejs/plugin-react';import { resolve } from 'path';diff --git a/e2e/README.md b/e2e/README.mdnew file mode 100644index 0000000000..9679b56549--- /dev/null+++ b/e2e/README.md@@ -0,0 +1,11 @@+# /e2e++End-to-end testing suite using Playwright.++<!-- SYNC: When files in this directory change, update this document. -->++| File | Role | Purpose |+|------|------|---------|+| `playwright.config.ts` | Config | Playwright test runner configuration |+| `package.json` | Config | Package dependencies and scripts |+diff --git a/e2e/playwright.config.ts b/e2e/playwright.config.tsindex 447a5b3c44..6659547fa5 100644--- a/e2e/playwright.config.ts+++ b/e2e/playwright.config.ts@@ -1,3 +1,12 @@+/**+ * @file playwright.config.ts+ * @input Uses @playwright/test+ * @output Playwright configuration for e2e tests against Storybook+ * @position Test config; defines browser matrix and web server setup+ *+ * SYNC: When modified, update this header and /e2e/README.md+ */+import { defineConfig, devices } from '@playwright/test';export default defineConfig({diff --git a/internal/README.md b/internal/README.mdnew file mode 100644index 0000000000..8cf69f33bd--- /dev/null+++ b/internal/README.md@@ -0,0 +1,10 @@+# /internal++Internal tooling packages not published to npm.++<!-- SYNC: When files in this directory change, update this document. -->++| Directory | Role | Purpose |+|-----------|------|---------|+| `test-utils/` | Testing | Shared testing utilities and setup for Vitest |+diff --git a/internal/test-utils/README.md b/internal/test-utils/README.mdnew file mode 100644index 0000000000..d6b67bceaa--- /dev/null+++ b/internal/test-utils/README.md@@ -0,0 +1,11 @@+# /internal/test-utils++Shared testing utilities and setup for Vitest across the monorepo.++<!-- SYNC: When files in this directory change, update this document. -->++| Directory/File | Role | Purpose |+|----------------|------|---------|+| `src/` | Source | Testing utilities source code |+| `package.json` | Config | Package configuration and dependencies |+diff --git a/internal/test-utils/src/README.md b/internal/test-utils/src/README.mdnew file mode 100644index 0000000000..db788b8938--- /dev/null+++ b/internal/test-utils/src/README.md@@ -0,0 +1,11 @@+# /internal/test-utils/src++Source code for shared testing utilities.++<!-- SYNC: When files in this directory change, update this document. -->++| File | Role | Purpose |+|------|------|---------|+| `index.ts` | Entry | Re-exports testing utilities from @testing-library/react |+| `setup.ts` | Setup | Vitest setup file; extends matchers with jest-dom |+diff --git a/internal/test-utils/src/index.ts b/internal/test-utils/src/index.tsindex 8d5e24b238..88fd56a5bf 100644--- a/internal/test-utils/src/index.ts+++ b/internal/test-utils/src/index.ts@@ -1,2 +1,11 @@+/**+ * @file index.ts+ * @input Uses @testing-library/react, @testing-library/user-event+ * @output Re-exports render, screen, fireEvent, userEvent, etc.+ * @position Entry point for test utilities; consumed by test files across monorepo+ *+ * SYNC: When modified, update this header and /internal/test-utils/src/README.md+ */+export * from '@testing-library/react';export { default as userEvent } from '@testing-library/user-event';diff --git a/internal/test-utils/src/setup.ts b/internal/test-utils/src/setup.tsindex bb02c60cd0..2ef02eadd7 100644--- a/internal/test-utils/src/setup.ts+++ b/internal/test-utils/src/setup.ts@@ -1 +1,10 @@+/**+ * @file setup.ts+ * @input Uses @testing-library/jest-dom/vitest+ * @output Extends Vitest expect with jest-dom matchers (toBeInTheDocument, etc.)+ * @position Test setup; loaded by vitest.config.ts before all tests+ *+ * SYNC: When modified, update this header and /internal/test-utils/src/README.md+ */+import '@testing-library/jest-dom/vitest';diff --git a/packages/README.md b/packages/README.mdnew file mode 100644index 0000000000..78005ef3c3--- /dev/null+++ b/packages/README.md@@ -0,0 +1,10 @@+# /packages++Published npm packages for the XDS design system.++<!-- SYNC: When files in this directory change, update this document. -->++| Directory | Role | Purpose |+|-----------|------|---------|+| `core/` | Primary | Core UI components library (`@xds/core`) |+diff --git a/packages/core/README.md b/packages/core/README.mdnew file mode 100644index 0000000000..3b3b37ca6e--- /dev/null+++ b/packages/core/README.md@@ -0,0 +1,13 @@+# /packages/core++Core UI components library for the XDS design system (`@xds/core`).++<!-- SYNC: When files in this directory change, update this document. -->++| Directory/File | Role | Purpose |+|----------------|------|---------|+| `src/` | Source | Component source code |+| `package.json` | Config | Package configuration and dependencies |+| `tsconfig.json` | Config | TypeScript compiler configuration |+| `tsup.config.ts` | Build | Bundle configuration using tsup |+diff --git a/packages/core/src/Button/Button.stories.tsx b/packages/core/src/Button/Button.stories.tsxindex 4b7b166100..1105908d7c 100644--- a/packages/core/src/Button/Button.stories.tsx+++ b/packages/core/src/Button/Button.stories.tsx@@ -1,3 +1,12 @@+/**+ * @file Button.stories.tsx+ * @input Uses @storybook/react, Button component+ * @output Storybook stories for Button variants and states+ * @position Documentation; visual testing and component showcase in Storybook+ *+ * SYNC: When modified, update this header and /packages/core/src/Button/README.md+ */+import type { Meta, StoryObj } from '@storybook/react';import { Button } from './Button';diff --git a/packages/core/src/Button/Button.test.tsx b/packages/core/src/Button/Button.test.tsxindex d422cfd4ee..989fdce5da 100644--- a/packages/core/src/Button/Button.test.tsx+++ b/packages/core/src/Button/Button.test.tsx@@ -1,3 +1,12 @@+/**+ * @file Button.test.tsx+ * @input Uses vitest, @testing-library/react, Button component+ * @output Unit tests for Button component behavior+ * @position Testing; validates Button.tsx implementation+ *+ * SYNC: When modified, update this header and /packages/core/src/Button/README.md+ */+import { describe, it, expect, vi } from 'vitest';import { render, screen } from '@testing-library/react';import userEvent from '@testing-library/user-event';diff --git a/packages/core/src/Button/Button.tsx b/packages/core/src/Button/Button.tsxindex 0239393faf..5299ae4512 100644--- a/packages/core/src/Button/Button.tsx+++ b/packages/core/src/Button/Button.tsx@@ -1,3 +1,12 @@+/**+ * @file Button.tsx+ * @input Uses React forwardRef, ButtonHTMLAttributes, ReactNode+ * @output Exports Button component, ButtonProps, ButtonVariant, ButtonSize types+ * @position Core implementation; consumed by index.ts, tested by Button.test.tsx+ *+ * SYNC: When modified, update this header and /packages/core/src/Button/README.md+ */+import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react';export type ButtonVariant = 'primary' | 'secondary' | 'ghost';diff --git a/packages/core/src/Button/README.md b/packages/core/src/Button/README.mdnew file mode 100644index 0000000000..fcb707493f--- /dev/null+++ b/packages/core/src/Button/README.md@@ -0,0 +1,13 @@+# /packages/core/src/Button++Button component with multiple variants, sizes, and loading state support.++<!-- SYNC: When files in this directory change, update this document. -->++| File | Role | Purpose |+|------|------|---------|+| `index.ts` | Entry | Exports Button component and types |+| `Button.tsx` | Core | Button component implementation |+| `Button.test.tsx` | Test | Unit tests for Button component |+| `Button.stories.tsx` | Docs | Storybook stories for visual documentation |+diff --git a/packages/core/src/Button/index.ts b/packages/core/src/Button/index.tsindex b48bca071a..1beee9a2fa 100644--- a/packages/core/src/Button/index.ts+++ b/packages/core/src/Button/index.ts@@ -1,2 +1,11 @@+/**+ * @file index.ts+ * @input Imports Button component and types from Button.tsx+ * @output Exports Button, ButtonProps, ButtonVariant, ButtonSize+ * @position Component entry point; re-exported by /packages/core/src/index.ts+ *+ * SYNC: When modified, update this header and /packages/core/src/Button/README.md+ */+export { Button } from './Button';export type { ButtonProps, ButtonVariant, ButtonSize } from './Button';diff --git a/packages/core/src/README.md b/packages/core/src/README.mdnew file mode 100644index 0000000000..ba80683e8b--- /dev/null+++ b/packages/core/src/README.md@@ -0,0 +1,11 @@+# /packages/core/src++Source code for core UI components.++<!-- SYNC: When files in this directory change, update this document. -->++| File/Directory | Role | Purpose |+|----------------|------|---------|+| `index.ts` | Entry | Package entry point; re-exports all components |+| `Button/` | Component | Button component with variants and loading states |+diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex 5aabc7460c..c874d39844 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -1,2 +1,11 @@+/**+ * @file index.ts+ * @input Imports from component directories (Button/)+ * @output Exports all public components and types for @xds/core+ * @position Package entry point; consumed by external applications+ *+ * SYNC: When modified, update this header and /packages/core/src/README.md+ */+// Componentsexport * from './Button';diff --git a/packages/core/tsup.config.ts b/packages/core/tsup.config.tsindex f8a44bb8d5..51f16b3fc4 100644--- a/packages/core/tsup.config.ts+++ b/packages/core/tsup.config.ts@@ -1,3 +1,12 @@+/**+ * @file tsup.config.ts+ * @input Uses tsup+ * @output Bundle configuration for CJS/ESM outputs with TypeScript declarations+ * @position Build config; defines entry points and output formats for @xds/core+ *+ * SYNC: When modified, update this header and /packages/core/README.md+ */+import { defineConfig } from 'tsup';export default defineConfig({diff --git a/vitest.config.ts b/vitest.config.tsindex 963312a46a..ae8435968d 100644--- a/vitest.config.ts+++ b/vitest.config.ts@@ -1,3 +1,12 @@+/**+ * @file vitest.config.ts+ * @input Uses vitest/config, @vitejs/plugin-react+ * @output Vitest configuration with jsdom, coverage, and test setup+ * @position Root test config; applies to all packages in monorepo+ *+ * SYNC: When modified, update this header and root README.md+ */+import { defineConfig } from 'vitest/config';import react from '@vitejs/plugin-react';