@kbach/react-native 1.0.0-beta.51 → 1.0.0-beta.53
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/AGENTS.md +103 -5
- package/README.md +16 -0
- package/android/src/main/jniLibs/arm64-v8a/libkbach_core_engine.so +0 -0
- package/android/src/main/jniLibs/x86_64/libkbach_core_engine.so +0 -0
- package/dist/{chunk-KHQ2BWYH.mjs → chunk-3JQAZNJK.mjs} +1 -1
- package/dist/{chunk-IJAXJVB4.mjs → chunk-P75PP2QR.mjs} +17 -8
- package/dist/{chunk-CD5WFFIQ.mjs → chunk-TC6VSV44.mjs} +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +54 -0
- package/dist/index.web.d.ts +2 -1
- package/dist/index.web.js +53 -1
- package/dist/index.web.mjs +36 -2
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/jsx-dev-runtime.js +2 -0
- package/dist/jsx-dev-runtime.web.d.ts +2 -2
- package/dist/jsx-dev-runtime.web.js +1 -1
- package/dist/jsx-dev-runtime.web.mjs +3 -3
- package/dist/jsx-runtime.d.ts +3 -3
- package/dist/jsx-runtime.js +2 -0
- package/dist/jsx-runtime.web.d.ts +3 -3
- package/dist/jsx-runtime.web.js +1 -1
- package/dist/jsx-runtime.web.mjs +2 -2
- package/dist/{clsx-BLLSnqAa.d.ts → semanticElements-Bk3TB-vt.d.ts} +60 -3
- package/dist/theme.js +16 -7
- package/package.json +1 -1
package/dist/jsx-runtime.web.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ThemeConfig, ContainerConfig } from './theme';
|
|
2
2
|
import { ThemeMode } from './darkModeStore';
|
|
3
|
-
import * as
|
|
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):
|
|
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
|
-
|
|
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
|
|
379
|
-
|
|
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
|
-
|
|
383
|
-
|
|
384
|
-
|
|
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
|
|
396
|
+
return getThemeState().theme;
|
|
388
397
|
}
|
|
389
398
|
function getThemeJson() {
|
|
390
|
-
return
|
|
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.
|
|
3
|
+
"version": "1.0.0-beta.53",
|
|
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",
|