@kbach/react-native 1.0.0-beta.52 → 1.0.0-beta.54

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.
@@ -2,8 +2,8 @@ import {
2
2
  Fragment,
3
3
  jsx,
4
4
  jsxs
5
- } from "./chunk-HVGMZKV7.mjs";
6
- import "./chunk-Z5Q3FGXR.mjs";
5
+ } from "./chunk-NXRSUBSY.mjs";
6
+ import "./chunk-MLBH2JYH.mjs";
7
7
  export {
8
8
  Fragment,
9
9
  jsx,
@@ -1,7 +1,8 @@
1
1
  import { ThemeConfig, ContainerConfig } from './theme';
2
2
  import { ThemeMode } from './darkModeStore';
3
- import * as react from 'react';
3
+ import * as React from 'react';
4
4
  import { ReactNode } from 'react';
5
+ import { PressableProps, TextProps } from 'react-native';
5
6
 
6
7
  /**
7
8
  * A `kbach.config.js`-style theme customization — same shape as
@@ -165,7 +166,7 @@ interface ThemeProviderProps {
165
166
  * state — mounting more than one is very likely a mistake, so this warns
166
167
  * once in dev.
167
168
  */
168
- declare function ThemeProvider({ children, defaultMode, persist }: ThemeProviderProps): react.JSX.Element;
169
+ declare function ThemeProvider({ children, defaultMode, persist }: ThemeProviderProps): React.JSX.Element;
169
170
 
170
171
  interface ColorScale {
171
172
  /** `colors.blue[6]` -> raw value */
@@ -274,4 +275,60 @@ type ClassArray = ClassValue[];
274
275
  */
275
276
  declare function clsx(...inputs: ClassValue[]): string;
276
277
 
277
- export { type ClassArray as C, type KbachConfig as K, ThemeProvider as T, type ClassDictionary as a, type ClassValue as b, type ColorScale as c, type ColorsAPI as d, type ThemeProviderProps as e, type ThemeState as f, type ThemeStorageAdapter as g, applyKbachConfig as h, clsx as i, useDynamicToken as j, useTheme as k, resolveKbachConfig as r, useColors as u };
278
+ /**
279
+ * On Expo Web, `react-native-web` renders a bare `<View>`/`<Text>` as a
280
+ * plain `<div>`/`<span>` by default — confirmed directly in its own
281
+ * source (`exports/View/index.js`, `exports/Text/index.js`). That's
282
+ * NOTHING to do with Kbach: this package's jsx-runtime never reads or
283
+ * substitutes the JSX element type at all (`processElement` in
284
+ * `jsxRuntimeCore(.web).ts` only ever destructures `className`/`style`,
285
+ * passing `type` straight through unchanged) — whatever tag shows up is
286
+ * exactly whatever component the app wrote.
287
+ *
288
+ * `react-native-web` already has a real fix for this that nothing here
289
+ * needs to add: an `accessibilityRole`/`role` prop on ANY host component
290
+ * makes it render the matching real HTML element instead
291
+ * (`propsToAccessibilityComponent`, react-native-web's own
292
+ * AccessibilityUtil) — `button` -> `<button>`, `header` (+ `aria-level`,
293
+ * web-only) -> `<h1>`-`<h6>`, `paragraph` -> `<p>`, and so on. These
294
+ * components are JUST that prop, pre-set on the right underlying
295
+ * component — nothing Kbach-specific, and writing
296
+ * `<Pressable accessibilityRole="button">` directly instead of `<Button>`
297
+ * behaves identically. `className` keeps working on every one of these
298
+ * exactly like it does on a bare `Pressable`/`Text`.
299
+ *
300
+ * Deliberately NOT a `Div` or an `Input`: a plain `<View>` already IS the
301
+ * right generic container (there's no more-semantic alternative to ask
302
+ * for), and `<TextInput>` already renders a real `<input>` (or
303
+ * `<textarea>` when `multiline`) by default — react-native-web's own
304
+ * TextInput component picks that unconditionally, with no role needed at
305
+ * all. Only the cases that actually need a role to stop defaulting to
306
+ * `<div>`/`<span>` are here.
307
+ */
308
+ type ButtonProps = PressableProps;
309
+ /**
310
+ * A real `<button>` on Expo Web, a real accessible button on native —
311
+ * `<Pressable accessibilityRole="button">`, nothing else changed. Not the
312
+ * same thing as React Native's OWN built-in `Button` (a fixed-chrome,
313
+ * barely-styleable native control) — this is a styleable `Pressable`,
314
+ * matching how every other interactive element in a Kbach app is built.
315
+ */
316
+ declare const Button: React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<any>>;
317
+ type ParagraphProps = TextProps;
318
+ /** A real `<p>` on Expo Web — `<Text role="paragraph">`, nothing else changed. */
319
+ declare const Paragraph: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<any>>;
320
+ type HeadingProps = TextProps;
321
+ /** A real `<h1>` on Expo Web — `<Text accessibilityRole="header">` + the web-only level hint, nothing else changed. */
322
+ declare const H1: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<any>>;
323
+ /** A real `<h2>` on Expo Web — see `H1`'s own doc comment. */
324
+ declare const H2: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<any>>;
325
+ /** A real `<h3>` on Expo Web — see `H1`'s own doc comment. */
326
+ declare const H3: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<any>>;
327
+ /** A real `<h4>` on Expo Web — see `H1`'s own doc comment. */
328
+ declare const H4: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<any>>;
329
+ /** A real `<h5>` on Expo Web — see `H1`'s own doc comment. */
330
+ declare const H5: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<any>>;
331
+ /** A real `<h6>` on Expo Web — see `H1`'s own doc comment. */
332
+ declare const H6: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<any>>;
333
+
334
+ export { Button as B, type ClassArray as C, H1 as H, type KbachConfig as K, Paragraph as P, ThemeProvider as T, type ButtonProps as a, type ClassDictionary as b, type ClassValue as c, type ColorScale as d, type ColorsAPI as e, H2 as f, H3 as g, H4 as h, H5 as i, H6 as j, type HeadingProps as k, type ParagraphProps as l, type ThemeProviderProps as m, type ThemeState as n, type ThemeStorageAdapter as o, applyKbachConfig as p, clsx as q, resolveKbachConfig as r, useDynamicToken as s, useTheme as t, useColors as u };
package/dist/theme.js CHANGED
@@ -375,19 +375,28 @@ var defaultTheme = {
375
375
  // Empty by default, matching real Tailwind's own defaults.
376
376
  container: {}
377
377
  };
378
- var activeTheme = defaultTheme;
379
- var activeThemeJson = JSON.stringify(defaultTheme);
378
+ var GLOBAL_STATE_KEY = "__kbachReactNativeThemeState__";
379
+ function getThemeState() {
380
+ const g = globalThis;
381
+ let state = g[GLOBAL_STATE_KEY];
382
+ if (!state) {
383
+ state = { theme: defaultTheme, json: JSON.stringify(defaultTheme) };
384
+ g[GLOBAL_STATE_KEY] = state;
385
+ }
386
+ return state;
387
+ }
380
388
  function setTheme(theme) {
381
389
  const json = JSON.stringify(theme);
382
- if (json === activeThemeJson) return;
383
- activeTheme = theme;
384
- activeThemeJson = json;
390
+ const state = getThemeState();
391
+ if (json === state.json) return;
392
+ state.theme = theme;
393
+ state.json = json;
385
394
  }
386
395
  function getTheme() {
387
- return activeTheme;
396
+ return getThemeState().theme;
388
397
  }
389
398
  function getThemeJson() {
390
- return activeThemeJson;
399
+ return getThemeState().json;
391
400
  }
392
401
  // Annotate the CommonJS export names for ESM import in node:
393
402
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react-native",
3
- "version": "1.0.0-beta.52",
3
+ "version": "1.0.0-beta.54",
4
4
  "description": "Kbach's utility-class styling engine for React Native — the same class names as @kbach/react, resolved to a StyleSheet-ready style object via a Kotlin/JNI TurboModule (native), the same WASM engine @kbach/react uses (Expo Web / react-native-web), or a pure-JS fallback engine (Expo Go). Ships its own native Android module — one npm install, no separate native package. Beta. Native is Android-only (no iOS bridge yet); works with the React Native CLI, an Expo dev client, AND Expo Go (a reduced-coverage pure-JS fallback, since Expo Go can't load any custom native module).",
5
5
  "keywords": [
6
6
  "css",
@@ -34,7 +34,8 @@
34
34
  "android/src",
35
35
  "specs",
36
36
  "react-native.config.js",
37
- "AGENTS.md"
37
+ "AGENTS.md",
38
+ "THIRD_PARTY_NOTICES.md"
38
39
  ],
39
40
  "source": "./src/index.ts",
40
41
  "main": "./dist/index.js",