@kbach/native 0.2.8 → 0.3.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.
Files changed (2) hide show
  1. package/README.md +51 -10
  2. package/package.json +23 -6
package/README.md CHANGED
@@ -149,17 +149,17 @@ function Badge() {
149
149
  }
150
150
  ```
151
151
 
152
- ### tw(classes)
152
+ ### kb(classes)
153
153
 
154
154
  Resolve classes outside a component, for use in StyleSheet.create() or static contexts.
155
155
 
156
156
  ```js
157
157
  import { StyleSheet } from 'react-native';
158
- import { tw } from '@kbach/native';
158
+ import { kb } from '@kbach/native';
159
159
 
160
160
  const styles = StyleSheet.create({
161
- container: tw('flex-1 bg-white p-4') as object,
162
- title: tw('text-2xl font-bold text-gray-10') as object,
161
+ container: kb('flex-1 bg-white p-4') as object,
162
+ title: kb('text-2xl font-bold text-gray-10') as object,
163
163
  });
164
164
  ```
165
165
 
@@ -182,16 +182,57 @@ import { cx } from '@kbach/native';
182
182
  ```js
183
183
  import { useTheme } from '@kbach/native';
184
184
 
185
- const { mode, resolvedMode, isDark, setMode, toggle } = useTheme();
185
+ const { mode, resolvedMode, isDark, setMode, toggle, config } = useTheme();
186
186
  ```
187
187
 
188
188
  | Value | Type | Description |
189
189
  |---|---|---|
190
- | mode | `'light' \| 'dark' \| 'system'` | User-selected mode |
191
- | resolvedMode | `'light' \| 'dark'` | Resolved after system lookup |
192
- | isDark | boolean | Shorthand for `resolvedMode === 'dark'` |
193
- | setMode | function | Set mode explicitly |
194
- | toggle | function | Toggle between light and dark |
190
+ | `mode` | `'light' \| 'dark' \| 'system'` | User-selected mode |
191
+ | `resolvedMode` | `'light' \| 'dark'` | Resolved after system lookup |
192
+ | `isDark` | `boolean` | Shorthand for `resolvedMode === 'dark'` |
193
+ | `setMode` | `fn` | Set mode explicitly |
194
+ | `toggle` | `fn` | Toggle between light and dark |
195
+ | `config` | `ResolvedConfig` | Full resolved config (theme, darkMode, plugins) |
196
+
197
+ ### useIsDark()
198
+
199
+ Shorthand hook when you only need the dark-mode boolean.
200
+
201
+ ```js
202
+ import { useIsDark } from '@kbach/native';
203
+
204
+ const isDark = useIsDark();
205
+ ```
206
+
207
+ ### useColors()
208
+
209
+ Returns the active theme's color palette as a smart proxy. Supports shade access, the `/opacity` modifier, flat colors with opacity, and arbitrary CSS color manipulation.
210
+
211
+ ```js
212
+ import { useColors } from '@kbach/native';
213
+
214
+ const colors = useColors();
215
+
216
+ // Shade access
217
+ colors.blue[6] // '#6c87b6'
218
+ colors.red[11] // '#3e0606'
219
+
220
+ // Shade + opacity (0–100)
221
+ colors.blue['6/50'] // 'rgba(108,135,182,0.5)'
222
+ colors.slate['3/10'] // 'rgba(221,227,242,0.1)'
223
+
224
+ // Flat colors
225
+ colors.white // '#ffffff'
226
+ colors.transparent // 'transparent'
227
+
228
+ // Flat color + opacity
229
+ colors['white/20'] // 'rgba(255,255,255,0.2)'
230
+ colors['black/80'] // 'rgba(0,0,0,0.8)'
231
+
232
+ // Arbitrary CSS color with opacity
233
+ colors.alpha('#ff6b35', 60) // 'rgba(255,107,53,0.6)'
234
+ colors.alpha('rgb(100,200,100)', 30) // 'rgba(100,200,100,0.3)'
235
+ ```
195
236
 
196
237
  ### ThemeToggle
197
238
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/native",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "Single-package Kbach install for React Native and Expo — includes core, components, Babel plugin, and Metro config",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "lint": "tsc --noEmit"
36
36
  },
37
37
  "dependencies": {
38
- "@kbach/react": "0.2.8"
38
+ "@kbach/react": "0.3.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/react": "^19.2.0",
@@ -47,12 +47,29 @@
47
47
  "react-native": ">=0.70.0"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
- "@babel/core": { "optional": true },
51
- "react-native": { "optional": true }
50
+ "@babel/core": {
51
+ "optional": true
52
+ },
53
+ "react-native": {
54
+ "optional": true
55
+ }
52
56
  },
53
57
  "publishConfig": {
54
58
  "access": "public"
55
59
  },
56
- "files": ["dist", "src/babel-plugin", "src/babel"],
57
- "keywords": ["react-native", "expo", "tailwind", "css-in-js", "styling", "framework", "frontend", "mobile"]
60
+ "files": [
61
+ "dist",
62
+ "src/babel-plugin",
63
+ "src/babel"
64
+ ],
65
+ "keywords": [
66
+ "react-native",
67
+ "expo",
68
+ "tailwind",
69
+ "css-in-js",
70
+ "styling",
71
+ "framework",
72
+ "frontend",
73
+ "mobile"
74
+ ]
58
75
  }