najm-kit 0.0.18 → 0.0.20

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 CHANGED
@@ -67,8 +67,63 @@ import { NajmThemeProvider } from 'najm-kit';
67
67
 
68
68
  // or mode + accent:
69
69
  <NajmThemeProvider mode="dark" accent="emerald">{children}</NajmThemeProvider>
70
+
71
+ // shadcn-style global radius scale:
72
+ <NajmThemeProvider radius="0.75rem">{children}</NajmThemeProvider>
73
+
74
+ // exact same radius for cards, tables, buttons, inputs, dialogs, etc.:
75
+ <NajmThemeProvider radius="0.75rem" radiusScale="uniform">
76
+ {children}
77
+ </NajmThemeProvider>
78
+ ```
79
+
80
+ `rounded-full` and `rounded-none` remain explicit, so avatars, pills, switches,
81
+ and square variants keep their intended shape.
82
+
83
+ ### JSON theme settings
84
+
85
+ Store one theme object in a JSON file, local storage, or your settings API:
86
+
87
+ ```json
88
+ {
89
+ "mode": "dark",
90
+ "accent": "violet",
91
+ "radius": "0.75rem",
92
+ "radiusScale": "uniform",
93
+ "appearance": { "borderWidth": "1px" },
94
+ "tokens": {
95
+ "primary": "oklch(0.62 0.2 290)",
96
+ "primary-foreground": "oklch(1 0 0)",
97
+ "sidebar": "oklch(0.18 0.02 290)",
98
+ "chart-1": "oklch(0.70 0.20 40)"
99
+ }
100
+ }
101
+ ```
102
+
103
+ Load and apply it from the same settings state used by your theme editor:
104
+
105
+ ```tsx
106
+ import rawTheme from './theme.json';
107
+ import { NajmThemeProvider, parseNajmThemeConfig } from 'najm-kit';
108
+
109
+ const initialTheme = parseNajmThemeConfig(rawTheme);
110
+
111
+ function App() {
112
+ const [theme, setTheme] = useState(initialTheme);
113
+
114
+ return (
115
+ <NajmThemeProvider config={theme}>
116
+ <SettingsPage value={theme} onChange={setTheme} />
117
+ {children}
118
+ </NajmThemeProvider>
119
+ );
120
+ }
70
121
  ```
71
122
 
123
+ Changing the state updates the complete theme immediately. Use
124
+ `stringifyNajmThemeConfig(theme)` when persisting it, and parse settings loaded
125
+ from an API or local storage with `parseNajmThemeConfig` before applying them.
126
+
72
127
  ## Components
73
128
 
74
129
  Import from `najm-kit`:
@@ -110,4 +165,4 @@ import { useSelection } from 'najm-kit';
110
165
  - Uses Radix UI primitives under the hood — accessible by default
111
166
  - All components are unstyled by default — apply `buttonVariants()`, `badgeVariants()`, etc. with Tailwind
112
167
  - Requires Tailwind CSS **v4** in the host application (see Styling above)
113
- - CodeMirror components are optional peer deps — import from `najm-kit/json` only if needed
168
+ - CodeMirror components are optional peer deps — import from `najm-kit/json` only if needed