|
| 1 | +# Code Organization & Architecture |
| 2 | + |
| 3 | +## Workspace Structure |
| 4 | + |
| 5 | +This is a monorepo using pnpm workspaces: |
| 6 | + |
| 7 | +``` |
| 8 | +packages/ |
| 9 | +├── machines/ # State machines for components (accordion, dialog, etc.) |
| 10 | +├── frameworks/ # Framework adapters (react, vue, solid, svelte, preact) |
| 11 | +├── utilities/ # Shared utilities (dom-query, popper, focus-trap, etc.) |
| 12 | +├── core/ # Core machine functionality |
| 13 | +├── anatomy/ # Component anatomy definitions |
| 14 | +├── anatomy-icons/ # Icon components for anatomy |
| 15 | +├── store/ # State management utilities |
| 16 | +├── types/ # Shared TypeScript types |
| 17 | +└── docs/ # Documentation generation |
| 18 | +``` |
| 19 | + |
| 20 | +## Machine Structure |
| 21 | + |
| 22 | +Each machine package follows this structure: |
| 23 | + |
| 24 | +``` |
| 25 | +packages/machines/{component}/ |
| 26 | +├── src/ |
| 27 | +│ ├── {component}.machine.ts # State machine definition |
| 28 | +│ ├── {component}.connect.ts # Framework connection API |
| 29 | +│ ├── {component}.types.ts # TypeScript types |
| 30 | +│ ├── {component}.anatomy.ts # Component anatomy |
| 31 | +│ ├── {component}.dom.ts # DOM utilities |
| 32 | +│ └── index.ts # Main exports |
| 33 | +├── package.json |
| 34 | +├── README.md |
| 35 | +└── tsconfig.json |
| 36 | +``` |
| 37 | + |
| 38 | +## Framework Adapters |
| 39 | + |
| 40 | +Each framework adapter provides: |
| 41 | + |
| 42 | +- Machine consumption utilities |
| 43 | +- Props normalization |
| 44 | +- Framework-specific optimizations |
| 45 | +- TypeScript integration |
| 46 | + |
| 47 | +## Utility Packages |
| 48 | + |
| 49 | +Utilities are organized by functionality: |
| 50 | + |
| 51 | +- `dom-query`: DOM manipulation and querying |
| 52 | +- `popper`: Positioning and floating elements |
| 53 | +- `focus-trap`: Focus management |
| 54 | +- `interact-outside`: Click outside detection |
| 55 | +- `dismissable`: Dismissal patterns |
0 commit comments