@kbach/react 0.6.24 → 0.6.26

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/kbach-react.md CHANGED
@@ -13,7 +13,7 @@ Package: `@kbach/react`
13
13
  { "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "@kbach/react" } }
14
14
  ```
15
15
 
16
- ### vite.config.ts (plain Vite only — skip @vitejs/plugin-react if a meta-framework already provides its own Vite/React plugin, e.g. React Router's reactRouter(); see below)
16
+ ### vite.config.ts — Static CSS setup (recommended, plain Vite only — skip @vitejs/plugin-react if a meta-framework already provides its own Vite/React plugin, e.g. React Router's reactRouter(); see below)
17
17
  Requires `vite` and `@vitejs/plugin-react` as dev dependencies — not installed by `@kbach/react` itself: `npm install -D vite @vitejs/plugin-react`.
18
18
  ```ts
19
19
  import { defineConfig } from 'vite';
@@ -27,6 +27,19 @@ export default defineConfig({
27
27
  ],
28
28
  });
29
29
  ```
30
+ Then create the stylesheet the plugin writes into and import it once — this import is the step that actually disables runtime CSS injection; `kbach()` in the plugins array alone only generates the file:
31
+ ```css
32
+ /* src/kbach.css */
33
+ /* kbach:start */
34
+ /* kbach:end */
35
+ ```
36
+ ```ts
37
+ // main.tsx
38
+ import './kbach.css';
39
+ ```
40
+
41
+ ### Runtime setup (any bundler, no Vite plugin)
42
+ Skip `kbach()` and the `kbach.css` import above. Works with any bundler (Vite, webpack, Turbopack, Metro-for-web) with no build plugin — the only option for Next.js (see below), or for skipping the plugin for now on Vite.
30
43
 
31
44
  ### Babel (non-Vite)
32
45
  ```js
@@ -176,6 +189,7 @@ colors.white // '#ffffff'
176
189
  colors['white/20'] // 'rgba(255,255,255,0.2)'
177
190
  colors.alpha('#ff6b35', 60) // 'rgba(255,107,53,0.6)'
178
191
  ```
192
+ Typed against the built-in theme by default — `colors.blu` (typo) is a compile error. Custom `kbach.config.js` colors aren't visible to TypeScript (runtime-loaded plain `.js`), so widen manually: `useColors<DefaultColorName | 'brand'>()`. `useSpacing()` is the same pattern for the spacing scale (`spacing[4]` → `16`, `spacing.full` → `'100%'`).
179
193
 
180
194
  ---
181
195
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.6.24",
3
+ "version": "0.6.26",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",
@@ -9,19 +9,19 @@
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "source": "./src/index.ts",
12
- "import": "./dist/index.js",
12
+ "import": "./dist/index.mjs",
13
13
  "require": "./dist/index.js"
14
14
  },
15
15
  "./jsx-runtime": {
16
16
  "types": "./dist/jsx-runtime.d.ts",
17
17
  "source": "./src/jsx-runtime.tsx",
18
- "import": "./dist/jsx-runtime.js",
18
+ "import": "./dist/jsx-runtime.mjs",
19
19
  "require": "./dist/jsx-runtime.js"
20
20
  },
21
21
  "./jsx-dev-runtime": {
22
22
  "types": "./dist/jsx-dev-runtime.d.ts",
23
23
  "source": "./src/jsx-dev-runtime.tsx",
24
- "import": "./dist/jsx-dev-runtime.js",
24
+ "import": "./dist/jsx-dev-runtime.mjs",
25
25
  "require": "./dist/jsx-dev-runtime.js"
26
26
  },
27
27
  "./types": {
@@ -32,14 +32,10 @@
32
32
  "source": "./src/vite-plugin.ts",
33
33
  "import": "./dist/vite-plugin.mjs",
34
34
  "require": "./dist/vite-plugin.js"
35
- },
36
- "./vite/client": {
37
- "types": "./dist/vite-plugin-client.d.ts"
38
35
  }
39
36
  },
40
37
  "scripts": {
41
38
  "build": "tsup",
42
- "postbuild": "node -e \"const f=require('fs');f.copyFileSync('src/vite-plugin-client.d.ts','dist/vite-plugin-client.d.ts');f.copyFileSync('src/vite-plugin-client.d.ts','dist/vite-plugin-client.d.mts')\"",
43
39
  "dev": "tsup --watch",
44
40
  "test": "vitest run --passWithNoTests",
45
41
  "lint": "tsc --noEmit",
package/dist/index.d.mts DELETED
@@ -1,455 +0,0 @@
1
- import * as React from 'react';
2
- import React__default, { ReactNode, ComponentType, ForwardRefExoticComponent } from 'react';
3
- export { r as registerWebElement } from './web-substitute-CfpYFnE7.mjs';
4
-
5
- /**
6
- * Unified modifier registry — single source of truth for ALL modifier behavior.
7
- *
8
- * Adding a new modifier requires editing ONLY this file:
9
- * 1. Add an entry to BUILTIN_MODIFIERS with its CSS and JS behavior.
10
- * 2. Done — parser, resolver, CSS generator, and JSX runtime all derive
11
- * their behavior from this data automatically.
12
- *
13
- * Plugin authors can register custom modifiers via registerModifier().
14
- */
15
- interface ModifierDef {
16
- /** CSS pseudo-class or pseudo-element appended to the selector (e.g. ':hover', '::before') */
17
- pseudo?: string;
18
- /** Ancestor selector prefix INCLUDING trailing space (e.g. '.group:hover ', '.peer:focus ~ ') */
19
- ancestorSelector?: string;
20
- /** Directionality attribute selector prefix INCLUDING trailing space (e.g. '[dir="rtl"] ') */
21
- dirSelector?: string;
22
- /** @media query body WITHOUT the '@media ' prefix (e.g. 'print', '(orientation: landscape)') */
23
- mediaQuery?: string;
24
- /** Dark/light mode scheme — triggers the configured darkMode strategy in CSS output */
25
- darkScheme?: 'dark' | 'light';
26
- /** True for responsive modifiers — wraps in @media (min-width: theme.screens[name]) */
27
- isResponsive?: boolean;
28
- /**
29
- * Forces !important on all declarations in the generated CSS rule.
30
- * Applied automatically for structural / ancestor / media modifiers that must
31
- * win over base inline styles.
32
- */
33
- forcesImportant?: boolean;
34
- /**
35
- * How the JSX runtime routes this modifier:
36
- * 'interactive' — managed by InteractiveWrapper (hover, focus, pressed, …)
37
- * 'mode' — managed by DarkWrapper (dark, light, not-dark, …)
38
- * 'responsive' — managed by DarkWrapper (sm, md, lg, xl, 2xl)
39
- * 'css-only' — CSS injection only; matchModifier always returns false
40
- */
41
- jsBehavior: 'interactive' | 'mode' | 'responsive' | 'css-only';
42
- /**
43
- * Evaluates whether this modifier's condition is met at runtime.
44
- * Omit for 'css-only' modifiers — they never apply as inline styles.
45
- */
46
- jsMatch?: (isDark: boolean, state: Record<string, boolean | undefined>, breakpoints: Set<string>) => boolean;
47
- }
48
-
49
- type ThemeMode = 'light' | 'dark' | 'system';
50
- interface StyleValue {
51
- [key: string]: string | number | undefined | null | StyleValue | StyleValue[];
52
- }
53
- interface ParsedClass {
54
- /** The original class string, e.g. "dark:hover:bg-[#fff]" */
55
- original: string;
56
- /** Up to 3 modifier prefixes, e.g. ['dark', 'hover'] */
57
- modifiers: string[];
58
- /** Whether a leading `-` was present for negative values */
59
- negative: boolean;
60
- /** Whether a leading `!` was present — applies !important to all CSS declarations */
61
- important: boolean;
62
- /** The utility name, e.g. 'bg', 'p', 'text' */
63
- utility: string;
64
- /** The resolved value, e.g. 'white', '#fff', '4' */
65
- value: string;
66
- /** Whether the value was specified with bracket notation [value] */
67
- isArbitrary: boolean;
68
- }
69
- interface ResolvedStyle {
70
- /** Base styles applied unconditionally */
71
- base?: StyleValue;
72
- /** Styles keyed by modifier or modifier combo, e.g. 'dark', 'hover', 'dark:hover' */
73
- [modifierKey: string]: StyleValue | undefined;
74
- }
75
- type ColorShades = Record<string, string>;
76
- type ThemeColors = Record<string, string | ColorShades>;
77
- type ThemeSpacing = Record<string, number | string>;
78
- interface ThemeConfig {
79
- colors: ThemeColors;
80
- spacing: ThemeSpacing;
81
- fontSize: Record<string, number | string>;
82
- fontFamily: Record<string, string | string[]>;
83
- fontWeight: Record<string, string | number>;
84
- borderRadius: Record<string, number | string>;
85
- borderWidth: Record<string, number>;
86
- opacity: Record<string, number>;
87
- lineHeight: Record<string, number | string>;
88
- letterSpacing: Record<string, number | string>;
89
- zIndex: Record<string, number | string>;
90
- flex: Record<string, number | string>;
91
- shadow: Record<string, StyleValue>;
92
- screens: Record<string, string | number>;
93
- /**
94
- * Custom @keyframes, web only. Each key is a keyframe name, its value maps
95
- * percentage/from/to selectors to a plain CSS declaration object (camelCase
96
- * properties, same shape as an inline style object):
97
- * keyframes: { wiggle: { '0%, 100%': { transform: 'rotate(-3deg)' }, '50%': { transform: 'rotate(3deg)' } } }
98
- * Referenced from `animation` below, or directly via animate-[wiggle_1s_ease-in-out].
99
- */
100
- keyframes: Record<string, Record<string, StyleValue>>;
101
- /**
102
- * Named animation shorthands built on `keyframes` above, referenced via
103
- * animate-{name} (e.g. animate-wiggle):
104
- * animation: { wiggle: 'wiggle 1s ease-in-out infinite' }
105
- * The first word must match a `keyframes` key so its @keyframes rule can be
106
- * injected alongside the animation — a name with no matching keyframes entry
107
- * still sets the `animation` CSS property, it just won't animate anything.
108
- */
109
- animation: Record<string, string>;
110
- [key: string]: unknown;
111
- }
112
- /**
113
- * 'class' — toggles .dark class on <html>
114
- * 'media' — uses prefers-color-scheme media query
115
- * 'attribute' — uses data-theme="dark" attribute on <html>
116
- */
117
- type DarkMode = 'attribute' | 'class' | 'media';
118
- interface PluginAPI {
119
- addUtility(name: string, styles: StyleValue): void;
120
- /**
121
- * Register a custom variant.
122
- *
123
- * Pass a CSS selector string for simple cases — it is automatically
124
- * converted into a ModifierDef that generates correct CSS rules:
125
- * addVariant('hocus', ':hover, :focus') // pseudo
126
- * addVariant('supports-grid', '@media (display: grid)') // media
127
- * addVariant('dark-green', '.dark-green') // ancestor selector
128
- *
129
- * Pass a full ModifierDef object for advanced control (e.g. JS-trackable
130
- * interactive variants with custom jsMatch logic).
131
- */
132
- addVariant(name: string, selectorOrDef: string | ModifierDef): void;
133
- theme(path: string, defaultValue?: unknown): unknown;
134
- e(className: string): string;
135
- }
136
- interface FrameworkConfig {
137
- darkMode?: DarkMode;
138
- theme?: Partial<ThemeConfig>;
139
- /** Additive theme extension — accepts either `extend.theme.X` or `extend.X` directly. */
140
- extend?: {
141
- theme?: Partial<ThemeConfig>;
142
- } & Partial<ThemeConfig>;
143
- plugins?: Array<(api: PluginAPI) => void>;
144
- content?: string[];
145
- }
146
- interface ResolvedConfig {
147
- darkMode: DarkMode;
148
- theme: ThemeConfig;
149
- plugins: Array<(api: PluginAPI) => void>;
150
- }
151
-
152
- declare const defaultColors: ThemeColors;
153
- declare const defaultTheme: ThemeConfig;
154
-
155
- declare function setResolveTarget(target: 'web' | 'native' | null): void;
156
-
157
- declare function parseClass(className: string): ParsedClass | null;
158
- /**
159
- * Split a class string into tokens. Whitespace at bracket depth > 0 is STRIPPED
160
- * (not just skipped) so that arbitrary values like rgb(41, 172, 15) become valid
161
- * CSS class name tokens: bg-[rgb(41,172,15)].
162
- */
163
- declare function splitClassTokens(classString: string): string[];
164
- /**
165
- * Normalize a full class string so it is safe to use as an HTML className value.
166
- * Strips spaces inside brackets: "bg-[rgb(41, 172, 15)] p-4" → "bg-[rgb(41,172,15)] p-4"
167
- */
168
- declare function normalizeClassString(classString: string): string;
169
- /** Parse a space-separated class string into individual ParsedClass objects. */
170
- declare function parseClasses(classString: string): ParsedClass[];
171
-
172
- declare function disableRuntimeCSS(): void;
173
- /**
174
- * Resolve a class string to a ResolvedStyle object.
175
- *
176
- * Results are cached per (theme, classString, darkMode) — repeated calls with
177
- * the same arguments are O(1). Different theme objects each get their own
178
- * cache so concurrent ThemeProviders with different configs are always correct.
179
- */
180
- declare function resolve(classString: string, theme: ThemeConfig, darkMode?: 'attribute' | 'class' | 'media'): ResolvedStyle;
181
- /**
182
- * Flatten a ResolvedStyle into a single StyleValue for the current runtime state.
183
- * Used by useStyles() and styled().
184
- *
185
- * The sort step is memoized per resolved object reference (#6) — when resolve()
186
- * returns a cached object, getSortedEntries() is O(1) on all subsequent calls.
187
- */
188
- declare function flatten(resolved: ResolvedStyle, isDark: boolean, state?: {
189
- hover?: boolean;
190
- focus?: boolean;
191
- pressed?: boolean;
192
- active?: boolean;
193
- disabled?: boolean;
194
- checked?: boolean;
195
- visited?: boolean;
196
- placeholder?: boolean;
197
- }, breakpoints?: Set<string>): StyleValue;
198
- /**
199
- * Clear CSS injection state so stale rules are re-injected when the theme changes.
200
- *
201
- * The per-theme style cache (WeakMap) does not need to be cleared manually:
202
- * updateConfig() creates a new theme object, making the old cache entry
203
- * automatically unreachable for GC.
204
- */
205
- declare function clearCache(): void;
206
-
207
- /**
208
- * Load, merge, and cache the resolved config.
209
- * Call resetConfig() to force a reload (e.g. in tests or after live update).
210
- */
211
- declare function getConfig(): ResolvedConfig;
212
- declare function buildConfig(userConfig: FrameworkConfig): ResolvedConfig;
213
- declare function updateConfig(userConfig: FrameworkConfig): void;
214
- /**
215
- * Like updateConfig, but only calls it when the config object reference has
216
- * actually changed. Used by the Babel-injected IIFE so that:
217
- * - multiple files with kbach classes don't re-run the update on every load
218
- * - Fast Refresh DOES re-run when kbach.config.js changes (new module → new object)
219
- */
220
- declare function initConfig(userConfig: FrameworkConfig): void;
221
-
222
- interface ThemeContextValue {
223
- /** The user-selected mode ('light' | 'dark' | 'system') */
224
- mode: ThemeMode;
225
- /** The effective resolved mode (never 'system') */
226
- resolvedMode: 'light' | 'dark';
227
- /** Convenience boolean */
228
- isDark: boolean;
229
- /** Change the theme mode programmatically */
230
- setMode: (mode: ThemeMode) => void;
231
- /** Toggle between light and dark (ignores system) */
232
- toggle: () => void;
233
- /** The fully resolved framework config (theme values, darkMode strategy, etc.) */
234
- config: ResolvedConfig;
235
- }
236
- declare const ThemeContext: React.Context<ThemeContextValue | null>;
237
- declare function useTheme(): ThemeContextValue;
238
- declare function useIsDark(): boolean;
239
-
240
- interface ColorScale {
241
- /** `colors.blue[6]` → raw hex string */
242
- readonly [shade: number]: string;
243
- /** `colors.blue['6/50']` → shade 6 at 50% opacity */
244
- readonly [key: string]: string;
245
- }
246
- interface ColorsAPI {
247
- /**
248
- * Pass any CSS color through, optionally applying an opacity (0–100).
249
- * - `colors.alpha('#3b82f6', 50)` → `'rgba(59,130,246,0.5)'`
250
- * - `colors.alpha('rgb(0,0,0)', 10)` → `'rgba(0,0,0,0.1)'`
251
- * - `colors.alpha('rgba(0,0,0,0.5)')` → `'rgba(0,0,0,0.5)'` (passthrough)
252
- */
253
- readonly alpha: (color: string, opacity?: number) => string;
254
- [color: string]: any;
255
- }
256
- declare function wrapColors(rawColors: ThemeColors): ColorsAPI;
257
- declare function useColors(): ColorsAPI;
258
-
259
- interface ThemeProviderProps {
260
- children: ReactNode;
261
- /** Initial mode. Falls back to persisted value, then 'system'. */
262
- defaultMode?: ThemeMode;
263
- /**
264
- * System color scheme for native `defaultMode="system"`.
265
- *
266
- * Pass the value of `useColorScheme()` from `react-native`. When importing
267
- * `ThemeProvider` from `@kbach/native` this is handled automatically.
268
- *
269
- * @example
270
- * ```tsx
271
- * import { useColorScheme } from 'react-native';
272
- * const colorScheme = useColorScheme();
273
- * <ThemeProvider defaultMode="system" colorScheme={colorScheme}>…</ThemeProvider>
274
- * ```
275
- */
276
- colorScheme?: 'light' | 'dark' | null;
277
- /**
278
- * Current window/screen width in pixels for responsive breakpoints.
279
- * On web this is read from `window.innerWidth` automatically.
280
- * When importing `ThemeProvider` from `@kbach/native` this is provided
281
- * automatically from `useWindowDimensions()`.
282
- */
283
- windowWidth?: number;
284
- /** Override the config (useful for per-tree config). Defaults to global getConfig(). */
285
- config?: FrameworkConfig;
286
- /** Disable persistence to localStorage */
287
- disablePersistence?: boolean;
288
- }
289
- declare function ThemeProvider({ children, defaultMode, colorScheme, windowWidth: windowWidthProp, config: configOverride, disablePersistence, }: ThemeProviderProps): React__default.JSX.Element;
290
-
291
- /**
292
- * Renders Kbach's base browser-default reset (borderless button/input,
293
- * visible checkbox/radio, no arrow-less <select>, etc.) as a plain <style>
294
- * tag so it's part of the page's initial HTML.
295
- *
296
- * Runtime-only setups (no Vite plugin / static kbach.css) otherwise only get
297
- * this reset once ThemeProvider's client-side effect runs — fine for a plain
298
- * CSR app, but under SSR the server has no JS to run it, so the first paint
299
- * ships with raw browser defaults (e.g. the native button border) until
300
- * hydration catches up. Render this once, as high in <head> as your
301
- * framework allows, to close that gap.
302
- *
303
- * Not needed if you're on the static-CSS setup — kbach.css already includes
304
- * the same reset, and the runtime injector detects this tag and skips adding
305
- * it a second time either way.
306
- */
307
- declare function KbachReset(): React.JSX.Element | null;
308
-
309
- interface StyledProps {
310
- /** Additional utility classes applied on top of the base classes */
311
- kb?: string;
312
- /** Merged with resolved kb styles; applied last */
313
- style?: StyleValue | StyleValue[];
314
- }
315
- type OmittedKeys = 'style';
316
- /**
317
- * Create a styled component from any React / React Native component.
318
- *
319
- * ```tsx
320
- * const Card = styled(View, 'bg-white dark:bg-gray-800 rounded-xl p-4 shadow-md');
321
- * const Button = styled(TouchableOpacity, 'bg-blue-500 pressed:bg-blue-700 dark:bg-blue-600 rounded-lg p-3');
322
- *
323
- * // Use it:
324
- * <Card kb="mt-4">...</Card>
325
- * <Button onPress={handlePress} kb="w-full" />
326
- * ```
327
- */
328
- declare function styled<T extends ComponentType<any>>(Component: T, baseClasses?: string): ForwardRefExoticComponent<Omit<React__default.ComponentPropsWithRef<T>, OmittedKeys> & StyledProps>;
329
-
330
- interface InteractionState {
331
- hover?: boolean;
332
- focus?: boolean;
333
- /** Maps to 'pressed' and 'active' modifiers */
334
- pressed?: boolean;
335
- active?: boolean;
336
- disabled?: boolean;
337
- checked?: boolean;
338
- visited?: boolean;
339
- placeholder?: boolean;
340
- }
341
- /**
342
- * Resolve a utility class string to a style object for the current theme + state.
343
- *
344
- * ```tsx
345
- * // Basic usage
346
- * const styles = useStyles('bg-white dark:bg-gray-900 p-4');
347
- *
348
- * // With interaction state
349
- * const [pressed, setPressed] = useState(false);
350
- * const styles = useStyles('bg-blue-500 pressed:bg-blue-700', { pressed });
351
- *
352
- * // Multiple class strings (merged left-to-right)
353
- * const styles = useStyles(['bg-white p-4', 'dark:bg-gray-900 rounded-xl']);
354
- * ```
355
- */
356
- declare function useStyles(classString: string | string[], state?: InteractionState): StyleValue;
357
- /**
358
- * Returns the full ResolvedStyle bucket map (base, dark, hover, …).
359
- * Useful when you need to apply styles selectively or pass them to Animated.
360
- */
361
- declare function useResolvedStyle(classString: string | string[]): ResolvedStyle;
362
-
363
- /**
364
- * Subscribe to the global dark-mode store with React's concurrent-safe
365
- * useSyncExternalStore so that any component using className/kb re-renders
366
- * immediately when the theme changes — without needing ThemeContext.
367
- */
368
- declare function useGlobalDarkMode(): boolean;
369
-
370
- /**
371
- * Returns the name of the currently active breakpoint — the largest breakpoint
372
- * whose min-width the window satisfies, or `'xs'` when below all breakpoints.
373
- *
374
- * ```ts
375
- * const bp = useBreakpoint(); // 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
376
- * ```
377
- */
378
- declare function useBreakpoint(): string;
379
- /**
380
- * Returns a record of boolean flags for each breakpoint — `true` when the
381
- * window width satisfies that breakpoint's min-width threshold.
382
- *
383
- * ```ts
384
- * const { sm, md, lg } = useResponsive();
385
- * const padding = lg ? 32 : sm ? 16 : 8;
386
- * ```
387
- */
388
- declare function useResponsive(): Record<string, boolean>;
389
-
390
- interface InteractiveWrapperProps {
391
- /** The real component to render (View, TouchableOpacity, div, a third-party button…) */
392
- Component: React__default.ComponentType<any> | string;
393
- /** Pre-resolved style buckets from resolve() */
394
- resolvedStyle: ResolvedStyle;
395
- /** On web: original class string so CSS pseudo-rules still fire */
396
- className?: string;
397
- /** Extra style prop passed by the user */
398
- style?: StyleValue | StyleValue[];
399
- children?: React__default.ReactNode;
400
- onPressIn?: (...args: any[]) => void;
401
- onPressOut?: (...args: any[]) => void;
402
- onPointerDown?: (...args: any[]) => void;
403
- onPointerUp?: (...args: any[]) => void;
404
- onPointerLeave?: (...args: any[]) => void;
405
- onPointerCancel?: (...args: any[]) => void;
406
- onMouseEnter?: (...args: any[]) => void;
407
- onMouseLeave?: (...args: any[]) => void;
408
- onFocus?: (...args: any[]) => void;
409
- onBlur?: (...args: any[]) => void;
410
- }
411
- /**
412
- * Thin wrapper rendered automatically by the JSX runtime whenever a className/kb
413
- * string contains interactive modifiers (hover:, pressed:, focus:, active:, …).
414
- *
415
- * Manages interaction state locally and flattens the correct style bucket on
416
- * every render. The wrapped component sees a plain `style` prop — it never
417
- * knows it was wrapped.
418
- *
419
- * Refs are forwarded so the host component's imperative API still works.
420
- */
421
- declare const InteractiveWrapper: React__default.ForwardRefExoticComponent<InteractiveWrapperProps & React__default.RefAttributes<unknown>>;
422
-
423
- /**
424
- * Resolve a utility class string outside of a React component.
425
- *
426
- * On **native** — returns a StyleValue (style object) for the given mode.
427
- * On **web** — injects CSS and returns the original class string (use as className).
428
- *
429
- * ```ts
430
- * // Inside a component use useStyles() instead.
431
- * // kb() is useful for StyleSheet.create() calls and static values.
432
- *
433
- * const styles = StyleSheet.create({
434
- * container: kb('flex-1 bg-white p-4') as any,
435
- * });
436
- *
437
- * // Web: use as className
438
- * <div className={kb('bg-white dark:bg-gray-900 p-4') as string} />
439
- * ```
440
- *
441
- * @param classString Space-separated utility classes
442
- * @param isDark Whether dark mode is active (default: false)
443
- */
444
- declare function kb(classString: string, isDark?: boolean): StyleValue | string;
445
- /**
446
- * Conditionally join class names. Falsy values are ignored.
447
- *
448
- * ```ts
449
- * cx('bg-white p-4', isActive && 'border-2 border-blue-500', undefined)
450
- * // → 'bg-white p-4 border-2 border-blue-500'
451
- * ```
452
- */
453
- declare function cx(...classes: Array<string | false | null | undefined>): string;
454
-
455
- export { type ColorScale, type ColorsAPI, type FrameworkConfig, type InteractionState, InteractiveWrapper, type InteractiveWrapperProps, KbachReset, type ParsedClass, type PluginAPI, type ResolvedConfig, type ResolvedStyle, type StyleValue, type StyledProps, type ThemeConfig, ThemeContext, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, buildConfig, clearCache, cx, defaultColors, defaultTheme, disableRuntimeCSS, flatten, getConfig, initConfig, kb, normalizeClassString, parseClass, parseClasses, resolve, setResolveTarget, splitClassTokens, styled, updateConfig, useBreakpoint, useColors, useGlobalDarkMode, useIsDark, useResolvedStyle, useResponsive, useStyles, useTheme, wrapColors };
@@ -1,21 +0,0 @@
1
- import { ReactElement } from 'react';
2
- export { Fragment } from 'react';
3
-
4
- /**
5
- * @kbach/react/jsx-dev-runtime
6
- *
7
- * Development variant of the custom JSX runtime.
8
- * Babel uses jsxDEV (instead of jsx/jsxs) in dev builds.
9
- *
10
- * We intercept `className`/`kb` props exactly like the production runtime, but
11
- * forward `_source` to React's own jsxDEV so React DevTools can display the
12
- * correct file + line number for every element.
13
- */
14
-
15
- declare function jsxDEV(type: unknown, props: Record<string, unknown> | null, key?: string, isStaticChildren?: boolean, source?: {
16
- fileName: string;
17
- lineNumber: number;
18
- columnNumber: number;
19
- }, self?: unknown): ReactElement;
20
-
21
- export { jsxDEV };
@@ -1,17 +0,0 @@
1
- import { ReactElement } from 'react';
2
- export { Fragment, JSX } from 'react';
3
- export { r as registerWebElement } from './web-substitute-CfpYFnE7.mjs';
4
-
5
- /**
6
- * @kbach/react/jsx-runtime
7
- *
8
- * Drop-in replacement for react/jsx-runtime.
9
- * Intercepts `className` and `kb` props on EVERY JSX element — React Native
10
- * built-ins, HTML elements on web, and any third-party library component.
11
- */
12
-
13
- declare function _invalidateDefaultFontCache(): void;
14
- declare function jsx(type: unknown, props: Record<string, unknown> | null, key?: string): ReactElement;
15
- declare function jsxs(type: unknown, props: Record<string, unknown> | null, key?: string): ReactElement;
16
-
17
- export { _invalidateDefaultFontCache, jsx, jsxs };
@@ -1,8 +0,0 @@
1
- // TypeScript declarations for the Kbach Vite plugin virtual module.
2
- // Add this to your tsconfig "types" array or via a triple-slash reference:
3
- // /// <reference types="@kbach/react/vite/client" />
4
-
5
- declare module 'virtual:kbach/styles.css' {
6
- const css: string;
7
- export default css;
8
- }
@@ -1,8 +0,0 @@
1
- // TypeScript declarations for the Kbach Vite plugin virtual module.
2
- // Add this to your tsconfig "types" array or via a triple-slash reference:
3
- // /// <reference types="@kbach/react/vite/client" />
4
-
5
- declare module 'virtual:kbach/styles.css' {
6
- const css: string;
7
- export default css;
8
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * React Native → HTML element substitution for web rendering.
3
- *
4
- * When isWeb is true, known React Native component types (View, Text, Pressable, …)
5
- * are replaced with plain HTML element strings ('div', 'span', …) so the DOM shows
6
- * clean Kbach class names instead of React Native Web's generated css-view-* classes.
7
- *
8
- * Used by: jsx-runtime (bare JSX), styled(), DarkWrapper, InteractiveWrapper.
9
- */
10
- /**
11
- * Register a custom React Native component → HTML tag substitution.
12
- * Call once at app startup before first render.
13
- *
14
- * ```ts
15
- * import { Animated } from 'react-native';
16
- * import { registerWebElement } from '@kbach/react';
17
- * registerWebElement(Animated.View, 'div');
18
- * ```
19
- */
20
- declare function registerWebElement(rnComponent: unknown, htmlTag: string): void;
21
-
22
- export { registerWebElement as r };