@puzzle-ui/theme 0.5.0 → 0.5.1
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 +59 -78
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -1,82 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @puzzle-ui/theme
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Design tokens, color themes, typography, fonts, and theme scoping for Puzzle.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
>
|
|
7
|
-
> This project is under active development. APIs, component props,
|
|
8
|
-
> package exports, styling, and internal implementation may change
|
|
9
|
-
> without notice. Components may be incomplete, and testing,
|
|
10
|
-
> accessibility, documentation, and framework compatibility are not yet
|
|
11
|
-
> guaranteed. Use it for experimentation and evaluation only---not for
|
|
12
|
-
> production applications.
|
|
13
|
-
|
|
14
|
-
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`.
|
|
15
|
-
|
|
16
|
-
**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.
|
|
17
|
-
|
|
18
|
-
## Prerequisites
|
|
19
|
-
|
|
20
|
-
- A package manager: npm, Bun, pnpm, or Yarn.
|
|
21
|
-
- An existing React application with a bundler that supports CSS imports, such as Vite.
|
|
22
|
-
- Familiarity with React and TypeScript. The UI and theme packages require React and React DOM 19 or later within the supported React 19 range.
|
|
5
|
+
**Documentation:** [https://puzzle-ui.com/docs/theme](https://puzzle-ui.com/docs/theme)
|
|
23
6
|
|
|
24
|
-
|
|
7
|
+
> [!WARNING]
|
|
8
|
+
> **Puzzle is not ready for production use.** APIs, tokens, and package
|
|
9
|
+
> exports may change without notice. Use it for experimentation and
|
|
10
|
+
> evaluation.
|
|
25
11
|
|
|
26
|
-
|
|
12
|
+
`@puzzle-ui/theme` is the source of truth for Puzzle's visual design. Its
|
|
13
|
+
`Theme` provider turns a typed token object into CSS custom properties
|
|
14
|
+
(`--puzzle-*`), loads configured fonts, resolves light, dark, and system color
|
|
15
|
+
schemes, and can scope a theme to the whole document or a single subtree.
|
|
16
|
+
All [`@puzzle-ui/ui`](https://puzzle-ui.com/docs/ui) components consume these
|
|
17
|
+
variables, so a single provider styles your application.
|
|
27
18
|
|
|
28
|
-
|
|
19
|
+
## Install
|
|
29
20
|
|
|
30
21
|
```bash
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
npm install @puzzle-ui/theme
|
|
23
|
+
# or
|
|
24
|
+
bun add @puzzle-ui/theme
|
|
25
|
+
# or
|
|
26
|
+
pnpm add @puzzle-ui/theme
|
|
27
|
+
# or
|
|
28
|
+
yarn add @puzzle-ui/theme
|
|
38
29
|
```
|
|
39
30
|
|
|
40
|
-
|
|
31
|
+
React and React DOM 19 are peer dependencies.
|
|
41
32
|
|
|
42
|
-
|
|
43
|
-
- Tanstack start
|
|
44
|
-
- Next.js
|
|
33
|
+
## Usage
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
It directly installs all dependencies and sets up the project for you.
|
|
35
|
+
Wrap your application once at the root:
|
|
48
36
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Install the UI library and theme package in your application's directory. Choose your package manager below:
|
|
52
|
-
|
|
53
|
-
npm:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm install @puzzle-ui/ui --save
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
bun:
|
|
37
|
+
```tsx
|
|
38
|
+
import { Theme } from "@puzzle-ui/theme";
|
|
60
39
|
|
|
61
|
-
|
|
62
|
-
|
|
40
|
+
export const App = () => (
|
|
41
|
+
<Theme>
|
|
42
|
+
<YourApp />
|
|
43
|
+
</Theme>
|
|
44
|
+
);
|
|
63
45
|
```
|
|
64
46
|
|
|
65
|
-
|
|
47
|
+
Customize the color scheme, color theme, fonts, and tokens:
|
|
66
48
|
|
|
67
|
-
```
|
|
68
|
-
|
|
49
|
+
```tsx
|
|
50
|
+
<Theme
|
|
51
|
+
theme="system"
|
|
52
|
+
colorTheme="cobalt-sky"
|
|
53
|
+
fonts={{
|
|
54
|
+
heading: { family: "Sora" },
|
|
55
|
+
body: { family: "Inter" },
|
|
56
|
+
}}
|
|
57
|
+
tokens={{
|
|
58
|
+
radius: { md: "0.5rem" },
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<YourApp />
|
|
62
|
+
</Theme>
|
|
69
63
|
```
|
|
70
64
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
yarn add @puzzle-ui/ui
|
|
75
|
-
```
|
|
65
|
+
## Features
|
|
76
66
|
|
|
77
|
-
|
|
67
|
+
| Area | Description | Docs |
|
|
68
|
+
| -------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
69
|
+
| Theme provider | Injects token CSS variables, loads fonts, and applies global styles at root or local scope. | [Theme Provider](https://puzzle-ui.com/docs/theme/theme-provider) |
|
|
70
|
+
| Design tokens | Typed token groups for spacing, radius, shadows, elevation, borders, layout, motion, and z-index. | [Design Tokens](https://puzzle-ui.com/docs/theme/tokens) |
|
|
71
|
+
| Colors | Semantic color roles, light/dark color schemes, and built-in color themes. | [Colors](https://puzzle-ui.com/docs/theme/colors) |
|
|
72
|
+
| Typography and fonts | Named typography roles, fluid font sizes, Google Fonts, and self-hosted fonts. | [Typography and Fonts](https://puzzle-ui.com/docs/theme/typography) |
|
|
73
|
+
| Breakpoints | Shared responsive breakpoints for JavaScript and CSS. | [Breakpoints](https://puzzle-ui.com/docs/theme/breakpoints) |
|
|
74
|
+
| Component overrides | Global link and image components for router and framework integration. | [Component Overrides](https://puzzle-ui.com/docs/theme/components) |
|
|
78
75
|
|
|
79
|
-
##
|
|
76
|
+
## Self-host fonts with the theme CLI
|
|
80
77
|
|
|
81
78
|
The `@puzzle-ui/theme` package includes the `puzzle-theme` executable.
|
|
82
79
|
It requires Node.js 20.19 or later.
|
|
@@ -131,23 +128,7 @@ The generated stylesheet and preload link use the same font URL, avoiding
|
|
|
131
128
|
duplicate downloads. Preloading only applies to local fonts and only one
|
|
132
129
|
font is preloaded per Theme instance.
|
|
133
130
|
|
|
134
|
-
##
|
|
131
|
+
## Related packages
|
|
135
132
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
```tsx
|
|
139
|
-
import { Theme } from "@puzzle-ui/theme";
|
|
140
|
-
import { Button } from "@puzzle-ui/ui";
|
|
141
|
-
|
|
142
|
-
export const App = () => (
|
|
143
|
-
<Theme>
|
|
144
|
-
<main>
|
|
145
|
-
<h1>Hello, Puzzle</h1>
|
|
146
|
-
<p>Build your interface with reusable components and shared tokens.</p>
|
|
147
|
-
<Button onClick={() => window.alert("Welcome to Puzzle!")}>
|
|
148
|
-
Get started
|
|
149
|
-
</Button>
|
|
150
|
-
</main>
|
|
151
|
-
</Theme>
|
|
152
|
-
);
|
|
153
|
-
```
|
|
133
|
+
- [`@puzzle-ui/ui`](https://puzzle-ui.com/docs/ui) — components styled by this theme.
|
|
134
|
+
- [`@puzzle-ui/core`](https://www.npmjs.com/package/@puzzle-ui/core) — shared utilities such as `cn` and responsive helpers.
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puzzle-ui/theme",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Theme components for Puzzle",
|
|
5
|
+
"homepage": "https://puzzle-ui.com",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/senorprogramador/puzzle.git"
|
|
9
|
+
},
|
|
5
10
|
"license": "MIT",
|
|
6
11
|
"type": "module",
|
|
7
12
|
"bin": {
|
|
@@ -64,7 +69,7 @@
|
|
|
64
69
|
"prepack": "tsdown"
|
|
65
70
|
},
|
|
66
71
|
"dependencies": {
|
|
67
|
-
"@puzzle-ui/core": "^0.5.
|
|
72
|
+
"@puzzle-ui/core": "^0.5.1"
|
|
68
73
|
},
|
|
69
74
|
"peerDependencies": {
|
|
70
75
|
"react": "^19.0.0",
|