Package Tansy UI as @openkhalix/tansy-ui in a monorepo (v0.4.0)
Restructure the repo into npm workspaces so the component kit publishes as its own package, like MUI and shadcn/ui: - packages/ui: @openkhalix/tansy-ui (published), with components, stories, tests, tokens and the library build - packages/brand: private logo and catalogue data shared by both apps - apps/site: the landing page - apps/docs: Storybook The package: - MIT licence (copyright OpenKhalix) - per-component ES modules and type declarations - "use client" on component modules so they import into Next.js Server Components; helpers stay server-safe - tokens.css for Tailwind v4 apps, and a prebuilt styles.css for apps without Tailwind - lucide-react 1.x, whose types compile against current React 19 types The apps resolve the package through a "source" export condition, so they hot-reload component edits, while outside users get dist/. scripts/test-package.mjs packs the package and installs the tarball into Vite + Tailwind (strict types), plain React and Next.js apps; each must build and render correctly. Gitea workflows run CI on push and publish to npm when a vX.Y.Z tag matching the package version is pushed.
This commit is contained in:
1 parent
23e67006d3
commit
9255b255a6
214 files changed
+1521
-389
No files matched your search
+7
-5
@@ -1,8 +1,8 @@
|
||||
# Component conventions
|
||||
|
||||
Every Tansy UI component follows these rules, so the kit reads as one API. The
|
||||
reference implementations are `src/components/Button.tsx`, `Input.tsx` and
|
||||
`Field.tsx`, with their stories and tests. When in doubt, copy them.
|
||||
reference implementations are `packages/ui/src/components/Button.tsx`,
|
||||
`Input.tsx` and `Field.tsx`, with their stories and tests. When in doubt, copy them.
|
||||
|
||||
## Foundation
|
||||
|
||||
@@ -16,7 +16,8 @@ reference implementations are `src/components/Button.tsx`, `Input.tsx` and
|
||||
- **Styling:** Tailwind v4 utilities only. Shared class strings live in
|
||||
`src/lib/styles.ts` (`focusRing`, `controlHeight`, `controlBox`, `popupSurface`,
|
||||
`popupMotion`, `listItem`, `labelText`, `descriptionText`, `errorText`).
|
||||
Use them instead of repeating utilities.
|
||||
Use them instead of repeating utilities. (Paths in this document are relative
|
||||
to `packages/ui`.)
|
||||
- **Class merging:** always `cn(...)` from `src/lib/cn.ts`, with the consumer's
|
||||
`className` last so it wins.
|
||||
- **Refs:** React 19 passes `ref` as a normal prop. Type props from
|
||||
@@ -125,12 +126,13 @@ Every component has `Name.test.tsx` (Vitest, Testing Library, user-event):
|
||||
- keyboard interaction for the component's pattern (Escape, arrows, Enter/Space),
|
||||
- `await expectNoA11yViolations(container)` from `src/test/a11y.ts`.
|
||||
|
||||
Run `npx vitest run src/components/Name.test.tsx`.
|
||||
Run `npx vitest run src/components/Name.test.tsx` inside `packages/ui`, or
|
||||
`npm test` from the root. Export every public component from `src/index.ts`.
|
||||
|
||||
## Checking in a real browser
|
||||
|
||||
```bash
|
||||
npm run build-storybook
|
||||
npm run build:docs
|
||||
node scripts/check-stories.mjs --filter forms-input --mode light
|
||||
node scripts/check-stories.mjs --filter forms-input --mode dark
|
||||
python3 scripts/contact-sheet.py /tmp/tansy-story-check/light --prefix forms-input
|
||||
|
||||
+18
-6
@@ -3,13 +3,13 @@
|
||||
Where Tansy UI stands against MUI and shadcn/ui, what's done, and what comes
|
||||
before v1.
|
||||
|
||||
Last reviewed: 2026-09-28, at v0.3.0.
|
||||
Last reviewed: 2026-09-29, at v0.4.0.
|
||||
|
||||
## Where things stand
|
||||
|
||||
| | Tansy UI (v0.3) | shadcn/ui | MUI (Material UI + Base UI) |
|
||||
|---|---|---|---|
|
||||
| Distribution | Library build (ES modules, types, tokens.css); not yet on npm | CLI and registries. CLI v4 installs a whole design system in one payload | npm packages |
|
||||
| Distribution | npm package `@openkhalix/tansy-ui` (ES modules, types, Tailwind or prebuilt CSS) | CLI and registries. CLI v4 installs a whole design system in one payload | npm packages |
|
||||
| Components | 38 | 50+, plus blocks and charts | Material UI's full set; Base UI v1 has 35 unstyled parts; MUI X adds Data Grid, Charts, Date Pickers, Tree View |
|
||||
| Accessibility base | Base UI primitives | Radix and Base UI primitives | Base UI primitives |
|
||||
| Theming | Seven runtime palettes, scoped to any element; semantic tokens | CSS variables | `createTheme`, CSS variables |
|
||||
@@ -63,13 +63,25 @@ and a docs page.
|
||||
|
||||
## Phase 2: Distribution
|
||||
|
||||
- [ ] Claim the npm scope and publish the library build.
|
||||
Done in v0.4.0:
|
||||
|
||||
- [x] Monorepo: `packages/ui` (published), `apps/site`, `apps/docs`
|
||||
- [x] Package `@openkhalix/tansy-ui`: ES modules per component, types,
|
||||
`"use client"` for Next.js, `tokens.css` for Tailwind apps and a
|
||||
prebuilt `styles.css` for apps without Tailwind
|
||||
- [x] MIT licence
|
||||
- [x] Install tests: the packed tarball must build and render in Vite +
|
||||
Tailwind, plain React and Next.js apps (`npm run test:package`)
|
||||
- [x] CI and tag-triggered publishing (Gitea Actions)
|
||||
|
||||
Still to do:
|
||||
|
||||
- [ ] Create the `openkhalix` npm organisation and publish the first release.
|
||||
- [ ] Serve the same components as a shadcn-compatible registry, so
|
||||
`npx shadcn add <url>` copies a Tansy component into a project: the
|
||||
same code as a dependency or as source you own.
|
||||
`npx shadcn add <url>` copies a Tansy component into a project.
|
||||
- [ ] Ship the palettes as a registry base item (tokens, fonts and CSS
|
||||
variables in one install).
|
||||
- [ ] Automate releases (Changesets) from `CHANGELOG.md`.
|
||||
- [ ] A public repository URL in `package.json` once the repo is public.
|
||||
|
||||
## Phase 3: Where Tansy can lead
|
||||
|
||||
|
||||
Reference in new issue
Block a user