@openwarelabs/ui 0.5.0 → 0.7.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.
Files changed (2) hide show
  1. package/README.md +54 -0
  2. package/package.json +12 -5
package/README.md CHANGED
@@ -69,6 +69,36 @@ import { Button, Field, Input, Toaster, toast } from "@openwarelabs/ui";
69
69
 
70
70
  Hooks for your own components: `useControllableState`, `useFloating` (top-layer positioning that flips), `usePresence` (keeps a layer mounted while it animates out), `useDismiss`, `useModalDialog`, `useMenuKeyboard`. Every prop is typed and described, so your editor explains it on hover.
71
71
 
72
+ ## Blocks as components
73
+
74
+ Blocks are becoming components in their own package, `@openwarelabs/blocks`, that take their content as props, so you don't copy their code. The heroes are first, `Hero01` to `Hero06`:
75
+
76
+ ```sh
77
+ npm install @openwarelabs/blocks
78
+ ```
79
+
80
+ ```tsx
81
+ import "@openwarelabs/blocks/styles.css"; // after @openwarelabs/ui/styles.css
82
+ import { Hero01 } from "@openwarelabs/blocks";
83
+
84
+ <Hero01 title="The workspace for shipping software" description="…" primaryAction={{ label: "Start for free", href: "/signup" }} />;
85
+ ```
86
+
87
+ Each block's page in the docs shows its props under the preview. The source is `blocks/src/<category>/<Name>/` (the component, its `.types.ts` and its `.css`); `npm run blocks:build` builds the package, and `npm run release` publishes it with the library at the same version.
88
+
89
+ ## Use with AI
90
+
91
+ The MCP server, `@openwarelabs/ui-mcp`, gives Claude Code, Codex, Cursor and other AI tools the setup, every component's examples and props, every block's code and the tokens, so they build with the real components:
92
+
93
+ ```sh
94
+ claude mcp add openware-ui -- npx -y @openwarelabs/ui-mcp # Claude Code
95
+ codex mcp add openware-ui -- npx -y @openwarelabs/ui-mcp # Codex
96
+ ```
97
+
98
+ Cursor and most other clients take `{ "mcpServers": { "openware-ui": { "command": "npx", "args": ["-y", "@openwarelabs/ui-mcp"] } } }`. [mcp/README.md](mcp/README.md) has every tool and client.
99
+
100
+ In the docs, every component and block has a **Copy for AI** button: a prompt with its whole reference (examples and props, or a block's two files) to paste into any AI tool. The built docs also have `llms.txt`, `llms-full.txt` and a Markdown copy of every page under `ai/`. `npm run mcp:build` rebuilds the server from the docs.
101
+
72
102
  ## Tokens
73
103
 
74
104
  Every colour, space, radius, shadow and weight is a CSS variable named `--ow-…` (`var(--ow-surface)`, `var(--ow-radius-container)`), and every text style is a class (`ow-type-section-title`, `ow-type-lead`). `tokens/tokens.json` is the single source; `npm run tokens` regenerates the CSS and `npm run contrast` checks every text and focus pair in both themes.
@@ -91,6 +121,30 @@ The docs' header has a colour picker that does this live, and the Theming page s
91
121
 
92
122
  **No bundler?** `dist/openware-ui.iife.js` sets `window.OpenwareUI`, reading React from `window.React`. A CDN serves it straight from npm: `https://cdn.jsdelivr.net/npm/@openwarelabs/ui/dist/openware-ui.iife.js`, with `dist/styles.css` beside it.
93
123
 
124
+ ## Contributing
125
+
126
+ `main` takes changes only through pull requests, squash-merged, so each one lands as a single commit named after the PR. The PR title follows [Conventional Commits](https://www.conventionalcommits.org) because `npm run release` reads it: `feat: add a date range picker`, `fix(Menu): close on Escape`, `feat!: rename Stack's gap sizes`. Put `BREAKING CHANGE: …` in the PR description for a breaking change.
127
+
128
+ Three checks have to pass to merge:
129
+
130
+ - **Checks**: types, contrast, blocks, the library, the MCP server and the docs.
131
+ - **PR title**: the title follows the convention (`npm run commits:check -- --title "feat: …"` locally).
132
+ - **Cleaner**: [openwarelabs/cleaner](https://github.com/openwarelabs/cleaner) on the `.ts` and `.tsx` files the PR changes. Types go in a `<name>.types.ts` beside the component, and imports from another folder use the aliases instead of `../`: `@/…` for `src/` (in the library and the docs), `@docs/…` for `docs/` (`?highlight` imports too) and `@build/…` in `mcp/`. Files that haven't been touched yet don't follow it; they catch up as they change.
133
+
134
+ `scripts/setup-github.sh` sets this up on GitHub (squash merges only, the PR title as the commit, the ruleset for `main`). Repository admins can bypass the ruleset, which `npm run release` uses to push its version commit and tag.
135
+
136
+ ## Releasing
137
+
138
+ ```sh
139
+ npm run release # works out the version, checks, tags and pushes
140
+ npm run release -- --dry-run # shows the version and the notes, changes nothing
141
+ npm run release -- minor # forces patch, minor, major or an exact version
142
+ ```
143
+
144
+ The version comes from the commit subjects since the last release, written as [Conventional Commits](https://www.conventionalcommits.org): `feat:` makes a minor release, `fix:` and `perf:` a patch, and `feat!:` or a `BREAKING CHANGE:` line a major one (a minor one before 1.0). `chore:`, `docs:`, `refactor:`, `test:`, `ci:`, `build:` and `style:` don't release on their own. The command checks that `main` is clean and up to date, runs every check and build, bumps both packages, writes `CHANGELOG.md`, commits, tags `vX.Y.Z` and pushes.
145
+
146
+ The tag starts `.github/workflows/release.yml`, which runs the checks again, publishes `@openwarelabs/ui` and `@openwarelabs/ui-mcp` to npm with trusted publishing (no token, with provenance), and makes the GitHub release from the changelog. Pull requests are squash-merged with their title as the commit, so the titles are what it reads.
147
+
94
148
  ## Rules worth keeping
95
149
 
96
150
  - One primary button per view. Everything else is secondary or ghost.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openwarelabs/ui",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Openware UI: React components and design tokens — midnight and brass, tactile buttons and Inter, in light and dark.",
5
5
  "license": "MIT",
6
6
  "author": "Alexander Silver",
@@ -43,13 +43,18 @@
43
43
  "scripts": {
44
44
  "dev": "node scripts/docs.mjs dev",
45
45
  "build": "node scripts/build-tokens.mjs && node scripts/build.mjs && tsc -p tsconfig.build.json && node scripts/build-types.mjs",
46
+ "blocks:build": "node scripts/build-blocks.mjs",
46
47
  "docs:build": "node scripts/docs.mjs build",
47
48
  "tokens": "node scripts/build-tokens.mjs",
48
- "typecheck": "tsc --noEmit && tsc -p docs/tsconfig.json",
49
+ "typecheck": "tsc --noEmit && tsc -p docs/tsconfig.json && tsc -p blocks/tsconfig.json",
49
50
  "contrast": "node scripts/check-contrast.mjs",
50
51
  "blocks:check": "node scripts/check-blocks.mjs",
51
52
  "prepare": "npm run build",
52
- "prepublishOnly": "npm run typecheck"
53
+ "prepublishOnly": "npm run typecheck",
54
+ "mcp:build": "node scripts/build-mcp.mjs && tsc -p mcp/tsconfig.json",
55
+ "mcp:inspect": "npx -y @modelcontextprotocol/inspector node mcp/dist/server.mjs",
56
+ "release": "node scripts/release.mjs",
57
+ "commits:check": "node scripts/check-commits.mjs"
53
58
  },
54
59
  "peerDependencies": {
55
60
  "react": ">=18",
@@ -62,6 +67,7 @@
62
67
  "sonner": "^2.0.8"
63
68
  },
64
69
  "devDependencies": {
70
+ "@modelcontextprotocol/sdk": "^1.32.1",
65
71
  "@types/react": "^18.3.12",
66
72
  "@types/react-dom": "^18.3.1",
67
73
  "culori": "^4.0.1",
@@ -70,11 +76,12 @@
70
76
  "react": "^18.3.1",
71
77
  "react-dom": "^18.3.1",
72
78
  "shiki": "^4.4.3",
73
- "typescript": "^5.6.3"
79
+ "typescript": "^5.6.3",
80
+ "zod": "^4.6.7"
74
81
  },
75
82
  "repository": {
76
83
  "type": "git",
77
- "url": "https://github.com/openwarelabs/ui"
84
+ "url": "git+https://github.com/openwarelabs/ui.git"
78
85
  },
79
86
  "keywords": [
80
87
  "react",