@puzzle-ui/theme 0.3.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.
- package/README.md +72 -86
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,113 +1,99 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
##
|
|
25
|
+
## Set up a new project
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
import { Theme } from "@puzzle-ui/theme";
|
|
27
|
+
Simple run our @puzzle-ui/create project template to get started.
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
>
|
|
35
|
-
<main>Your application</main>
|
|
36
|
-
</Theme>
|
|
37
|
-
);
|
|
29
|
+
npm:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx @puzzle-ui/create
|
|
38
33
|
```
|
|
39
34
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
41
|
+
Puzzle can set up a new project for you with the following framework options:
|
|
72
42
|
|
|
73
|
-
|
|
43
|
+
- Basic React app
|
|
44
|
+
- Tanstack start
|
|
45
|
+
- Next.js
|
|
74
46
|
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
84
|
-
`image: null` to restore native elements in a subtree.
|
|
54
|
+
npm:
|
|
85
55
|
|
|
86
|
-
|
|
56
|
+
```bash
|
|
57
|
+
npm install @puzzle-ui/ui --save
|
|
58
|
+
```
|
|
87
59
|
|
|
88
|
-
|
|
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
|
-
|
|
93
|
-
|
|
62
|
+
```bash
|
|
63
|
+
bun add @puzzle-ui/create
|
|
64
|
+
```
|
|
94
65
|
|
|
95
|
-
|
|
96
|
-
for token references, fonts, colors, and component overrides.
|
|
66
|
+
pnpm:
|
|
97
67
|
|
|
98
|
-
|
|
68
|
+
```bash
|
|
69
|
+
pnpm add @puzzle-ui/ui
|
|
70
|
+
```
|
|
99
71
|
|
|
100
|
-
|
|
101
|
-
# From the repository root
|
|
102
|
-
npm run build --workspace=@puzzle-ui/theme
|
|
72
|
+
yarn:
|
|
103
73
|
|
|
104
|
-
|
|
105
|
-
|
|
74
|
+
```bash
|
|
75
|
+
yarn add @puzzle-ui/ui
|
|
106
76
|
```
|
|
107
77
|
|
|
108
|
-
|
|
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
|
-
##
|
|
80
|
+
## Your first interface
|
|
112
81
|
|
|
113
|
-
|
|
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.
|
|
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
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.
|
|
61
|
+
"@puzzle-ui/core": "^0.4.0"
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|
|
63
64
|
"react": "^19.0.0",
|