@kbach/react 0.6.29 → 0.6.31
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/dist/{chunk-S6AHQ5M6.mjs → chunk-MOWXWICC.mjs} +20 -12
- package/dist/{chunk-TKBIGAR2.mjs → chunk-OIJ6RP4F.mjs} +1369 -1297
- package/dist/core/index.d.ts +40 -3
- package/dist/core/index.js +1465 -1391
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -11
- package/dist/index.mjs +18 -12
- package/dist/jsx-dev-runtime.js +18 -11
- package/dist/jsx-dev-runtime.mjs +2 -2
- package/dist/jsx-runtime.js +18 -11
- package/dist/jsx-runtime.mjs +2 -2
- package/dist/vite-plugin.d.mts +11 -2
- package/dist/vite-plugin.d.ts +11 -2
- package/dist/vite-plugin.js +80 -10
- package/dist/vite-plugin.mjs +80 -10
- package/kbach-react.md +23 -0
- package/package.json +1 -1
package/kbach-react.md
CHANGED
|
@@ -712,6 +712,29 @@ module.exports = {
|
|
|
712
712
|
|
|
713
713
|
**Global default font (web):** Setting `fontFamily.sans` to anything other than `'System'` auto-injects `body { font-family: <font> }`.
|
|
714
714
|
|
|
715
|
+
### Mode-aware colors (dark mode without `dark:`)
|
|
716
|
+
|
|
717
|
+
A color value can be `{ light, dark }` instead of a plain string — define it once, and every class using that color automatically picks the right side, with no `dark:` variant needed at the call site:
|
|
718
|
+
|
|
719
|
+
```js
|
|
720
|
+
extend: {
|
|
721
|
+
theme: {
|
|
722
|
+
colors: {
|
|
723
|
+
surface: { light: '#ffffff', dark: '#111827' },
|
|
724
|
+
// each side can itself be an alias — resolved independently
|
|
725
|
+
accent: { light: 'blue-6', dark: 'blue-4' },
|
|
726
|
+
},
|
|
727
|
+
},
|
|
728
|
+
},
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
```jsx
|
|
732
|
+
<div className="bg-surface text-accent" />
|
|
733
|
+
// equivalent to writing bg-white dark:bg-gray-9 text-blue-6 dark:text-blue-4 by hand
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
Works everywhere a color does — `useColors()` (returns the active side directly), opacity composition (`bg-surface/50`), and per-shade within a scale (`brand: { 6: { light: '#3b82f6', dark: '#60a5fa' } }`). An explicit `dark:`/`light:` modifier stacked on an already mode-aware color is not supported (falls back to the light side) — the whole point is not needing `dark:` for these.
|
|
737
|
+
|
|
715
738
|
### Runtime update
|
|
716
739
|
```js
|
|
717
740
|
import { updateConfig, clearCache } from '@kbach/react';
|