material-theme-builder 2.1.2 → 3.0.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 +22 -4
- package/dist/cli.js +783 -444
- package/dist/index.d.ts +77 -104
- package/dist/index.js +761 -570
- package/dist/react.d.ts +195 -0
- package/dist/react.js +4604 -0
- package/dist/tailwind.css +0 -2
- package/package.json +26 -4
- package/src/tailwind.css +0 -2
package/README.md
CHANGED
|
@@ -45,8 +45,20 @@ const theme = builder("#6750A4", {
|
|
|
45
45
|
theme.toFigmaTokens();
|
|
46
46
|
theme.toJson();
|
|
47
47
|
theme.toCss();
|
|
48
|
+
theme.toTailwind();
|
|
49
|
+
theme.toFlutter();
|
|
50
|
+
theme.toShadcn();
|
|
48
51
|
```
|
|
49
52
|
|
|
53
|
+
> [!NOTE]
|
|
54
|
+
>
|
|
55
|
+
> The root entry costs a client bundle nothing. It holds `builder` alone — the
|
|
56
|
+
> React bindings live at [`material-theme-builder/react`](#react) and are the
|
|
57
|
+
> only thing carrying `"use client"`. So you can call `builder` from a
|
|
58
|
+
> [React Server Component](https://react.dev/reference/rsc/server-components)
|
|
59
|
+
> and emit `toCss()` into the document yourself, rather than let `<Mcu>` do it
|
|
60
|
+
> on the client, without shipping React components the page never renders.
|
|
61
|
+
|
|
50
62
|
## CLI
|
|
51
63
|
|
|
52
64
|
```sh
|
|
@@ -59,10 +71,12 @@ See `npx material-theme-builder --help` for all available options.
|
|
|
59
71
|
|
|
60
72
|
## React
|
|
61
73
|
|
|
74
|
+
The React bindings live on their own entry point, `material-theme-builder/react`.
|
|
75
|
+
|
|
62
76
|
CSS variables are injected into the page:
|
|
63
77
|
|
|
64
78
|
```tsx
|
|
65
|
-
import { Mcu } from "material-theme-builder";
|
|
79
|
+
import { Mcu } from "material-theme-builder/react";
|
|
66
80
|
|
|
67
81
|
<Mcu
|
|
68
82
|
source="#0e1216"
|
|
@@ -101,7 +115,7 @@ import { Mcu } from "material-theme-builder";
|
|
|
101
115
|
A hook is also provided:
|
|
102
116
|
|
|
103
117
|
```tsx
|
|
104
|
-
import { useMcu } from "material-theme-builder";
|
|
118
|
+
import { useMcu } from "material-theme-builder/react";
|
|
105
119
|
|
|
106
120
|
const { initials, setMcuConfig, getMcuColor } = useMcu();
|
|
107
121
|
|
|
@@ -117,8 +131,6 @@ return (
|
|
|
117
131
|
Compatible through [theme variables](https://tailwindcss.com/docs/theme):
|
|
118
132
|
|
|
119
133
|
```css
|
|
120
|
-
@import "tailwindcss";
|
|
121
|
-
|
|
122
134
|
@theme inline {
|
|
123
135
|
--color-background: var(--md-sys-color-background);
|
|
124
136
|
--color-on-background: var(--md-sys-color-on-background);
|
|
@@ -450,6 +462,12 @@ Pre-requisites:
|
|
|
450
462
|
$ pnpm i
|
|
451
463
|
```
|
|
452
464
|
|
|
465
|
+
## Figma plugin
|
|
466
|
+
|
|
467
|
+
1. `pnpm run build-figma`
|
|
468
|
+
2. In Figma: Plugins → Development → Import plugin from manifest…
|
|
469
|
+
3. Select `figma-plugin/manifest.json`
|
|
470
|
+
|
|
453
471
|
## Validation
|
|
454
472
|
|
|
455
473
|
```sh
|