@react-native-rethemed/tailwind-css-tokens 0.0.0-stage → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 manato
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,67 @@
1
- # Temporary Holding Version
1
+ # @react-native-rethemed/tailwind-css-tokens
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm](https://img.shields.io/npm/v/@react-native-rethemed/tailwind-css-tokens.svg)](https://www.npmjs.com/package/@react-native-rethemed/tailwind-css-tokens)
4
+
5
+ Tailwind CSS's default theme (colors, spacing, text sizes, shadows) for React Native, ready for [react-native-rethemed](https://github.com/manakuro/react-native-rethemed).
6
+
7
+ Tailwind CSS's default `theme.css` with Tailwind's names: `padding: 4` is `p-4`, `themed.text.sm()` is `text-sm` (font size plus its paired line height).
8
+
9
+ ## Installation
10
+
11
+ ```sh
12
+ npm install @react-native-rethemed/core @react-native-rethemed/tailwind-css-tokens
13
+ npm install --save-dev @react-native-rethemed/cli
14
+ ```
15
+
16
+ `react` and `react-native` are peer dependencies of `@react-native-rethemed/core`.
17
+
18
+ ## Usage
19
+
20
+ ```ts
21
+ // src/theme/theme.ts
22
+ import { extendTheme } from '@react-native-rethemed/core';
23
+ import { colors, tailwindCssTheme } from '@react-native-rethemed/tailwind-css-tokens';
24
+
25
+ // Tailwind has no semantic colors (it uses `dark:`), so define your own.
26
+ export const themeConfig = extendTheme(tailwindCssTheme, {
27
+ semanticTokens: {
28
+ colors: {
29
+ fg: { default: { light: colors['gray.900'], dark: colors['gray.50'] } },
30
+ },
31
+ },
32
+ });
33
+
34
+ // themed.view({ padding: 4, borderRadius: 'lg' }) // p-4 rounded-lg
35
+ // themed.text.sm({ color: 'fg.default' }) // text-sm
36
+ ```
37
+
38
+ Then generate the typed bindings (and the token reference for AI agents):
39
+
40
+ ```sh
41
+ npx @react-native-rethemed/cli codegen src/theme/theme.ts --docs docs/themed.md
42
+ ```
43
+
44
+ and use them in components:
45
+
46
+ ```tsx
47
+ import { useThemed } from './theme/themed.gen';
48
+
49
+ const { themed } = useThemed();
50
+ ```
51
+
52
+ See the [main README](https://github.com/manakuro/react-native-rethemed#readme) for the full setup (`ThemedProvider`, color mode, `extendTheme`).
53
+
54
+ ## Exports
55
+
56
+ | Export | Description |
57
+ | --- | --- |
58
+ | `tailwindCssTheme` | The full theme |
59
+ | `colors` | The oklch palette as hex (`'sky.500'`) |
60
+ | `text` | `text-*` presets with paired line heights |
61
+ | `spacing`, `radii`, `fontSizes`, `fontWeights`, `lineHeights`, `letterSpacings`, `shadows` | Individual token scales |
62
+
63
+ [`example/`](https://github.com/manakuro/react-native-rethemed/tree/main/packages/react-native-rethemed/tailwind-css/example) shows what the CLI generates for `tailwindCssTheme` (`themed.gen.ts`, `themed.md`).
64
+
65
+ ## License
66
+
67
+ MIT. Token values are converted from [Tailwind CSS](https://github.com/tailwindlabs/tailwindcss) (MIT).
package/dist/index.cjs ADDED
@@ -0,0 +1,51 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_tokens_gen = require("./tokens.gen.cjs");
3
+ //#region src/index.ts
4
+ /**
5
+ * Tailwind CSS's default theme (`tailwindcss/theme.css`), converted for
6
+ * React Native with Tailwind's names. Values are generated by
7
+ * `scripts/generate.ts`; see `src/tokens.gen.ts`.
8
+ *
9
+ * - Lengths: rem → points at 16px; em letter spacings → points at 16px.
10
+ * - `colors`: the oklch palette as hex, `'<hue>.<shade>'` (`'sky.500'`).
11
+ * Fixed in both schemes: Tailwind has no semantic colors (it uses `dark:`
12
+ * variants), so define `semanticTokens.colors` in the app.
13
+ * - `spacing`: `padding: 4` is `p-4` (16), for the steps Tailwind's docs
14
+ * list. `radii` / `lineHeights` add the `rounded-none` / `rounded-full` /
15
+ * `leading-none` utilities.
16
+ * - `text`: `themed.text.sm()` is `text-sm` — font size plus its paired line
17
+ * height. `fontSizes` (`fontSize: 'sm'`) sets the size alone.
18
+ * - `defaults.fontSize` is `base` (16), the size `lineHeights` ratios use when
19
+ * a style has no `fontSize` of its own.
20
+ * - `shadows`: first layer only. Not included (no RN equivalent): fonts,
21
+ * inset / drop / text shadows, blur, perspective, easing, animations,
22
+ * aspect ratios, breakpoints, containers.
23
+ *
24
+ * The palette, radii and shadows are the same values as
25
+ * `@react-native-rethemed/panda-css-tokens` (Panda's preset uses Tailwind's).
26
+ */
27
+ const tailwindCssTheme = (0, require("@react-native-rethemed/core/config").defineTheme)({
28
+ tokens: {
29
+ colors: require_tokens_gen.colors,
30
+ radii: require_tokens_gen.radii,
31
+ spacing: require_tokens_gen.spacing,
32
+ fontSizes: require_tokens_gen.fontSizes,
33
+ fontWeights: require_tokens_gen.fontWeights,
34
+ lineHeights: require_tokens_gen.lineHeights,
35
+ letterSpacings: require_tokens_gen.letterSpacings,
36
+ shadows: require_tokens_gen.shadows
37
+ },
38
+ semanticTokens: { text: require_tokens_gen.text },
39
+ defaults: { fontSize: "base" }
40
+ });
41
+ //#endregion
42
+ exports.colors = require_tokens_gen.colors;
43
+ exports.fontSizes = require_tokens_gen.fontSizes;
44
+ exports.fontWeights = require_tokens_gen.fontWeights;
45
+ exports.letterSpacings = require_tokens_gen.letterSpacings;
46
+ exports.lineHeights = require_tokens_gen.lineHeights;
47
+ exports.radii = require_tokens_gen.radii;
48
+ exports.shadows = require_tokens_gen.shadows;
49
+ exports.spacing = require_tokens_gen.spacing;
50
+ exports.tailwindCssTheme = tailwindCssTheme;
51
+ exports.text = require_tokens_gen.text;
@@ -0,0 +1,28 @@
1
+ import { colors, fontSizes, fontWeights, letterSpacings, lineHeights, radii, shadows, spacing, text } from "./tokens.gen.cjs";
2
+ //#region src/index.d.ts
3
+ /**
4
+ * Tailwind CSS's default theme (`tailwindcss/theme.css`), converted for
5
+ * React Native with Tailwind's names. Values are generated by
6
+ * `scripts/generate.ts`; see `src/tokens.gen.ts`.
7
+ *
8
+ * - Lengths: rem → points at 16px; em letter spacings → points at 16px.
9
+ * - `colors`: the oklch palette as hex, `'<hue>.<shade>'` (`'sky.500'`).
10
+ * Fixed in both schemes: Tailwind has no semantic colors (it uses `dark:`
11
+ * variants), so define `semanticTokens.colors` in the app.
12
+ * - `spacing`: `padding: 4` is `p-4` (16), for the steps Tailwind's docs
13
+ * list. `radii` / `lineHeights` add the `rounded-none` / `rounded-full` /
14
+ * `leading-none` utilities.
15
+ * - `text`: `themed.text.sm()` is `text-sm` — font size plus its paired line
16
+ * height. `fontSizes` (`fontSize: 'sm'`) sets the size alone.
17
+ * - `defaults.fontSize` is `base` (16), the size `lineHeights` ratios use when
18
+ * a style has no `fontSize` of its own.
19
+ * - `shadows`: first layer only. Not included (no RN equivalent): fonts,
20
+ * inset / drop / text shadows, blur, perspective, easing, animations,
21
+ * aspect ratios, breakpoints, containers.
22
+ *
23
+ * The palette, radii and shadows are the same values as
24
+ * `@react-native-rethemed/panda-css-tokens` (Panda's preset uses Tailwind's).
25
+ */
26
+ export declare const tailwindCssTheme: import("@react-native-rethemed/core/config").ThemeConfig;
27
+ //#endregion
28
+ export { colors, fontSizes, fontWeights, letterSpacings, lineHeights, radii, shadows, spacing, text };
@@ -0,0 +1,28 @@
1
+ import { colors, fontSizes, fontWeights, letterSpacings, lineHeights, radii, shadows, spacing, text } from "./tokens.gen.mjs";
2
+ //#region src/index.d.ts
3
+ /**
4
+ * Tailwind CSS's default theme (`tailwindcss/theme.css`), converted for
5
+ * React Native with Tailwind's names. Values are generated by
6
+ * `scripts/generate.ts`; see `src/tokens.gen.ts`.
7
+ *
8
+ * - Lengths: rem → points at 16px; em letter spacings → points at 16px.
9
+ * - `colors`: the oklch palette as hex, `'<hue>.<shade>'` (`'sky.500'`).
10
+ * Fixed in both schemes: Tailwind has no semantic colors (it uses `dark:`
11
+ * variants), so define `semanticTokens.colors` in the app.
12
+ * - `spacing`: `padding: 4` is `p-4` (16), for the steps Tailwind's docs
13
+ * list. `radii` / `lineHeights` add the `rounded-none` / `rounded-full` /
14
+ * `leading-none` utilities.
15
+ * - `text`: `themed.text.sm()` is `text-sm` — font size plus its paired line
16
+ * height. `fontSizes` (`fontSize: 'sm'`) sets the size alone.
17
+ * - `defaults.fontSize` is `base` (16), the size `lineHeights` ratios use when
18
+ * a style has no `fontSize` of its own.
19
+ * - `shadows`: first layer only. Not included (no RN equivalent): fonts,
20
+ * inset / drop / text shadows, blur, perspective, easing, animations,
21
+ * aspect ratios, breakpoints, containers.
22
+ *
23
+ * The palette, radii and shadows are the same values as
24
+ * `@react-native-rethemed/panda-css-tokens` (Panda's preset uses Tailwind's).
25
+ */
26
+ export declare const tailwindCssTheme: import("@react-native-rethemed/core/config").ThemeConfig;
27
+ //#endregion
28
+ export { colors, fontSizes, fontWeights, letterSpacings, lineHeights, radii, shadows, spacing, text };
package/dist/index.mjs ADDED
@@ -0,0 +1,42 @@
1
+ import { colors, fontSizes, fontWeights, letterSpacings, lineHeights, radii, shadows, spacing, text } from "./tokens.gen.mjs";
2
+ import { defineTheme } from "@react-native-rethemed/core/config";
3
+ //#region src/index.ts
4
+ /**
5
+ * Tailwind CSS's default theme (`tailwindcss/theme.css`), converted for
6
+ * React Native with Tailwind's names. Values are generated by
7
+ * `scripts/generate.ts`; see `src/tokens.gen.ts`.
8
+ *
9
+ * - Lengths: rem → points at 16px; em letter spacings → points at 16px.
10
+ * - `colors`: the oklch palette as hex, `'<hue>.<shade>'` (`'sky.500'`).
11
+ * Fixed in both schemes: Tailwind has no semantic colors (it uses `dark:`
12
+ * variants), so define `semanticTokens.colors` in the app.
13
+ * - `spacing`: `padding: 4` is `p-4` (16), for the steps Tailwind's docs
14
+ * list. `radii` / `lineHeights` add the `rounded-none` / `rounded-full` /
15
+ * `leading-none` utilities.
16
+ * - `text`: `themed.text.sm()` is `text-sm` — font size plus its paired line
17
+ * height. `fontSizes` (`fontSize: 'sm'`) sets the size alone.
18
+ * - `defaults.fontSize` is `base` (16), the size `lineHeights` ratios use when
19
+ * a style has no `fontSize` of its own.
20
+ * - `shadows`: first layer only. Not included (no RN equivalent): fonts,
21
+ * inset / drop / text shadows, blur, perspective, easing, animations,
22
+ * aspect ratios, breakpoints, containers.
23
+ *
24
+ * The palette, radii and shadows are the same values as
25
+ * `@react-native-rethemed/panda-css-tokens` (Panda's preset uses Tailwind's).
26
+ */
27
+ const tailwindCssTheme = defineTheme({
28
+ tokens: {
29
+ colors,
30
+ radii,
31
+ spacing,
32
+ fontSizes,
33
+ fontWeights,
34
+ lineHeights,
35
+ letterSpacings,
36
+ shadows
37
+ },
38
+ semanticTokens: { text },
39
+ defaults: { fontSize: "base" }
40
+ });
41
+ //#endregion
42
+ export { colors, fontSizes, fontWeights, letterSpacings, lineHeights, radii, shadows, spacing, tailwindCssTheme, text };