|
| 1 | +# @kreozalabs/styles |
| 2 | + |
| 3 | +Core design system for the Kreoza platform. This package provides synchronized design tokens for TypeScript, CSS, and Tailwind CSS (v3 and v4). |
| 4 | + |
| 5 | +## 🚀 Usage |
| 6 | + |
| 7 | +### 1. Tailwind CSS v4 (Recommended) |
| 8 | +Tailwind v4 is CSS-first. Simply import the styles in your main CSS file: |
| 9 | +```css |
| 10 | +@import "tailwindcss"; |
| 11 | +@import "@kreozalabs/styles"; |
| 12 | +``` |
| 13 | +This automatically registers all theme variables (e.g., `bg-primary`, `rounded-kreoza`, `text-h1`). |
| 14 | + |
| 15 | +### 2. TypeScript / JavaScript |
| 16 | +Programmatic access to all raw hex values and design constants: |
| 17 | +```typescript |
| 18 | +import { tokens } from '@kreozalabs/styles'; |
| 19 | + |
| 20 | +const primaryColor = tokens.colors.light.primary; |
| 21 | +``` |
| 22 | + |
| 23 | +### 3. Tailwind CSS v3 |
| 24 | +Add the preset to your `tailwind.config.js`: |
| 25 | +```javascript |
| 26 | +module.exports = { |
| 27 | + presets: [require('@kreozalabs/styles/tailwind-preset')], |
| 28 | + content: ["./src/**/*.{ts,tsx}"], |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## 🛠 Maintenance (Single Source of Truth) |
| 35 | + |
| 36 | +This package uses `tokens.ts` as the **Single Source of Truth**. Do not edit `tokens.css` or `base.css` variables manually. |
| 37 | + |
| 38 | +### How to update existing values |
| 39 | +1. Open `tokens.ts`. |
| 40 | +2. Update the values (colors, fonts, etc.). |
| 41 | +3. Run `pnpm build`. This will regenerate `tokens.css` and the `dist/` files. |
| 42 | + |
| 43 | +### How to add NEW token categories |
| 44 | +If you add a new category to `tokens.ts` (e.g., `spacing` or `shadows`): |
| 45 | +1. Update `tokens.ts` with the new data. |
| 46 | +2. Update `scripts/sync-tokens.ts` to include the logic for mapping these new tokens to CSS variables and the Tailwind `@theme` block. |
| 47 | +3. Run `pnpm build`. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## 📜 Development Scripts |
| 52 | + |
| 53 | +- `pnpm build`: Cleans, synchronizes tokens, and transpiles. |
| 54 | +- `pnpm clean`: Removes all generated files (`dist/`, `tokens.css`). |
| 55 | +- `pnpm build:tokens`: Only runs the synchronization script. |
| 56 | +- `pnpm pack`: Creates a `.tgz` for local testing. |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## 🎨 Design Summary |
| 61 | + |
| 62 | +- **Primary Font**: `PT Sans` (legible, professional sans-serif). |
| 63 | +- **Modular Scale**: Uses a **1.414 ratio** (Augmented Fourth) to ensure harmonious typography sizing across all headings. |
| 64 | +- **Color System**: Tokens are centralized in `tokens.ts` to ensure consistent saturation and contrast across Light and Dark themes. |
| 65 | +- **License**: BSD-3-Clause |
0 commit comments