@puzzle-ui/theme 0.2.0 → 0.4.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 +72 -86
  2. package/package.json +4 -3
package/README.md CHANGED
@@ -1,113 +1,99 @@
1
- # @puzzle-ui/theme
1
+ ---
2
+ title: Getting Started
3
+ description: Install Puzzle in your React app, build your first interface, and customize the theme.
4
+ ---
2
5
 
3
- Puzzle's theme system: semantic design tokens, light/dark color schemes,
4
- typography, Google Fonts, and configurable link and image components.
6
+ > \[!WARNING\] **Puzzle is not ready for production use.**
7
+ >
8
+ > This project is under active development. APIs, component props,
9
+ > package exports, styling, and internal implementation may change
10
+ > without notice. Components may be incomplete, and testing,
11
+ > accessibility, documentation, and framework compatibility are not yet
12
+ > guaranteed. Use it for experimentation and evaluation only---not for
13
+ > production applications.
5
14
 
6
- > Puzzle is under active development. APIs and framework compatibility may
7
- > change; use it for experimentation and evaluation rather than production.
15
+ Puzzle is a TypeScript and React UI component library built around reusable components and shared design tokens. Its components are composable and router-independent, with styling supplied by `"@puzzle-ui/theme`. The framework is setup to be compatible with `Next.js`, `Tanstack Start` and `react-router`.
8
16
 
9
- ## Installation
17
+ **Puzzle is under active development and is not ready for production use.** APIs, props, exports, and styling may change without notice. Accessibility and framework compatibility are still being tested. Use the project for experimentation and evaluation.
10
18
 
11
- ```sh
12
- npm install @puzzle-ui/theme
13
- # or
14
- bun add @puzzle-ui/theme
15
- # or
16
- pnpm add @puzzle-ui/theme
17
- # or
18
- yarn add @puzzle-ui/theme
19
- ```
19
+ ## Prerequisites
20
20
 
21
- Requires React and React DOM 19 (`^19.0.0`) and a CSS-aware application
22
- bundler. Styles are imported by the package; no separate stylesheet or
23
- Tailwind setup is required.
21
+ - A package manager: npm, Bun, pnpm, or Yarn.
22
+ - An existing React application with a bundler that supports CSS imports, such as Vite.
23
+ - Familiarity with React and TypeScript. The UI and theme packages require React and React DOM 19 or later within the supported React 19 range.
24
24
 
25
- ## Usage
25
+ ## Set up a new project
26
26
 
27
- ```tsx
28
- import { Theme } from "@puzzle-ui/theme";
27
+ Simple run our @puzzle-ui/create project template to get started.
29
28
 
30
- export const App = () => (
31
- <Theme
32
- theme="system"
33
- tokens={{ radius: { md: "0.5rem" } }}
34
- >
35
- <main>Your application</main>
36
- </Theme>
37
- );
29
+ npm:
30
+
31
+ ```bash
32
+ npx @puzzle-ui/create
38
33
  ```
39
34
 
40
- Use one root theme for your application. By default it follows the system
41
- color scheme, emits `--puzzle-*` CSS custom properties, and applies global
42
- styles. Set `globalStyles={false}` to opt out of the global defaults.
43
-
44
- ## Configuration
45
-
46
- | Prop | Purpose |
47
- | --- | --- |
48
- | `theme` | `"light"`, `"dark"`, or `"system"`; defaults to `"system"`. |
49
- | `scope` | `"root"` for document-wide styling or `"local"` for a subtree. |
50
- | `tokens` | Deep-partial overrides of color, typography, spacing, radius, layout, motion, and other design tokens. |
51
- | `colorTheme` | Select a built-in palette, such as `"cobalt-sky"`. |
52
- | `fonts` | Configure Google Fonts for heading, body, and accent roles. |
53
- | `components` | Override link and image rendering. |
54
- | `nonce` | CSP nonce for injected style elements. |
55
-
56
- Local themes do not apply global styles. Fonts configured through `fonts`
57
- load external Google Fonts stylesheets; omit this prop to avoid those
58
- requests.
59
-
60
- ## Use tokens in your styles
61
-
62
- ```css
63
- .panel {
64
- color: var(--puzzle-color-text);
65
- background: var(--puzzle-color-surface);
66
- padding: var(--puzzle-space-4);
67
- border-radius: var(--puzzle-radius-md);
68
- }
35
+ bun:
36
+
37
+ ```bash
38
+ bunx @puzzle-ui/create
69
39
  ```
70
40
 
71
- ## Router integration
41
+ Puzzle can set up a new project for you with the following framework options:
72
42
 
73
- For routers whose links use `to`, configure the destination prop:
43
+ - Basic React app
44
+ - Tanstack start
45
+ - Next.js
74
46
 
75
- ```tsx
76
- import { Link } from "@tanstack/react-router";
47
+ Furthermore you can choose to install tailwindcss or not.
48
+ It directly installs all dependencies and sets up the project for you.
77
49
 
78
- <Theme components={{ link: { component: Link, hrefProp: "to" } }}>
79
- <AppContent />
80
- </Theme>;
81
- ```
50
+ ## Set up in an existing project:
51
+
52
+ Install the UI library and theme package in your application's directory. Choose your package manager below:
82
53
 
83
- Components using `href` can be passed directly. Use `link: null` or
84
- `image: null` to restore native elements in a subtree.
54
+ npm:
85
55
 
86
- ## Exports
56
+ ```bash
57
+ npm install @puzzle-ui/ui --save
58
+ ```
87
59
 
88
- The root exports `Theme`, `GoogleFont`, `createGoogleFontUrl`, `BREAKPOINTS`,
89
- and their configuration types. Context helpers are available through
90
- `@puzzle-ui/theme/components-context` and `@puzzle-ui/theme/scope-context`.
60
+ bun:
91
61
 
92
- ESM and CommonJS builds with matching TypeScript declarations are included.
93
- CSS imports require a bundler rather than a bare Node.js runtime.
62
+ ```bash
63
+ bun add @puzzle-ui/create
64
+ ```
94
65
 
95
- See the repository's [theme documentation](../../apps/site/content/docs/theme)
96
- for token references, fonts, colors, and component overrides.
66
+ pnpm:
97
67
 
98
- ## Development
68
+ ```bash
69
+ pnpm add @puzzle-ui/ui
70
+ ```
99
71
 
100
- ```sh
101
- # From the repository root
102
- npm run build --workspace=@puzzle-ui/theme
72
+ yarn:
103
73
 
104
- # From this package directory
105
- bun run vitest
74
+ ```bash
75
+ yarn add @puzzle-ui/ui
106
76
  ```
107
77
 
108
- `prepack` rebuilds the package before packing or publishing. See the root
109
- [publishing guide](../../README.md#publishing-packages).
78
+ These commands install published packages; they do not clone the repository or build its workspaces. Puzzle does not require Bun in your application. React and React DOM are peer dependencies and should already be installed in your app.
110
79
 
111
- ## License
80
+ ## Your first interface
112
81
 
113
- MIT. See [LICENSE](../../LICENSE); the published license is at `dist/LICENSE`.
82
+ Import components from `"@puzzle-ui/ui` and wrap your application in `Theme` from `"@puzzle-ui/theme`:
83
+
84
+ ```tsx
85
+ import { Theme } from "@puzzle-ui/theme";
86
+ import { Button } from "@puzzle-ui/ui";
87
+
88
+ export const App = () => (
89
+ <Theme>
90
+ <main>
91
+ <h1>Hello, Puzzle</h1>
92
+ <p>Build your interface with reusable components and shared tokens.</p>
93
+ <Button onClick={() => window.alert("Welcome to Puzzle!")}>
94
+ Get started
95
+ </Button>
96
+ </main>
97
+ </Theme>
98
+ );
99
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puzzle-ui/theme",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Theme components for Puzzle",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -51,13 +51,14 @@
51
51
  ],
52
52
  "scripts": {
53
53
  "build": "tsdown",
54
+ "typecheck": "tsc --noEmit -p .",
54
55
  "vitest": "bunx vitest run",
55
- "vitest:watch": "bunx vitest",
56
+ "vitest:watch": "bunx vitest run --watch --passWithNoTests",
56
57
  "clean": "rm -rf dist",
57
58
  "prepack": "tsdown"
58
59
  },
59
60
  "dependencies": {
60
- "@puzzle-ui/core": "^0.2.0"
61
+ "@puzzle-ui/core": "^0.4.0"
61
62
  },
62
63
  "peerDependencies": {
63
64
  "react": "^19.0.0",