@react-native-rethemed/tailwind-css-tokens 0.0.0-stage → 0.1.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.
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,65 @@
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
+ 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).
4
+
5
+ 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).
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ npm install @react-native-rethemed/core @react-native-rethemed/tailwind-css-tokens
11
+ npm install --save-dev @react-native-rethemed/cli
12
+ ```
13
+
14
+ `react` and `react-native` are peer dependencies of `@react-native-rethemed/core`.
15
+
16
+ ## Usage
17
+
18
+ ```ts
19
+ // src/theme/theme.ts
20
+ import { extendTheme } from '@react-native-rethemed/core';
21
+ import { colors, tailwindCssTheme } from '@react-native-rethemed/tailwind-css-tokens';
22
+
23
+ // Tailwind has no semantic colors (it uses `dark:`), so define your own.
24
+ export const themeConfig = extendTheme(tailwindCssTheme, {
25
+ semanticTokens: {
26
+ colors: {
27
+ fg: { default: { light: colors['gray.900'], dark: colors['gray.50'] } },
28
+ },
29
+ },
30
+ });
31
+
32
+ // themed.view({ padding: 4, borderRadius: 'lg' }) // p-4 rounded-lg
33
+ // themed.text.sm({ color: 'fg.default' }) // text-sm
34
+ ```
35
+
36
+ Then generate the typed bindings (and the token reference for AI agents):
37
+
38
+ ```sh
39
+ npx @react-native-rethemed/cli codegen src/theme/theme.ts --docs docs/themed.md
40
+ ```
41
+
42
+ and use them in components:
43
+
44
+ ```tsx
45
+ import { useThemed } from './theme/themed.gen';
46
+
47
+ const { themed } = useThemed();
48
+ ```
49
+
50
+ See the [main README](https://github.com/manakuro/react-native-rethemed#readme) for the full setup (`ThemedProvider`, color mode, `extendTheme`).
51
+
52
+ ## Exports
53
+
54
+ | Export | Description |
55
+ | --- | --- |
56
+ | `tailwindCssTheme` | The full theme |
57
+ | `colors` | The oklch palette as hex (`'sky.500'`) |
58
+ | `text` | `text-*` presets with paired line heights |
59
+ | `spacing`, `radii`, `fontSizes`, `fontWeights`, `lineHeights`, `letterSpacings`, `shadows` | Individual token scales |
60
+
61
+ [`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`).
62
+
63
+ ## License
64
+
65
+ MIT. Token values are converted from [Tailwind CSS](https://github.com/tailwindlabs/tailwindcss) (MIT).
@@ -0,0 +1,26 @@
1
+ import { colors, fontSizes, fontWeights, letterSpacings, lineHeights, radii, shadows, spacing, text } from './tokens.gen';
2
+ /**
3
+ * Tailwind CSS's default theme (`tailwindcss/theme.css`), converted for
4
+ * React Native with Tailwind's names. Values are generated by
5
+ * `scripts/generate.ts`; see `src/tokens.gen.ts`.
6
+ *
7
+ * - Lengths: rem → points at 16px; em letter spacings → points at 16px.
8
+ * - `colors`: the oklch palette as hex, `'<hue>.<shade>'` (`'sky.500'`).
9
+ * Fixed in both schemes: Tailwind has no semantic colors (it uses `dark:`
10
+ * variants), so define `semanticTokens.colors` in the app.
11
+ * - `spacing`: `padding: 4` is `p-4` (16), for the steps Tailwind's docs
12
+ * list. `radii` / `lineHeights` add the `rounded-none` / `rounded-full` /
13
+ * `leading-none` utilities.
14
+ * - `text`: `themed.text.sm()` is `text-sm` — font size plus its paired line
15
+ * height. `fontSizes` (`fontSize: 'sm'`) sets the size alone.
16
+ * - `defaults.fontSize` is `base` (16), the size `lineHeights` ratios use when
17
+ * a style has no `fontSize` of its own.
18
+ * - `shadows`: first layer only. Not included (no RN equivalent): fonts,
19
+ * inset / drop / text shadows, blur, perspective, easing, animations,
20
+ * aspect ratios, breakpoints, containers.
21
+ *
22
+ * The palette, radii and shadows are the same values as
23
+ * `@react-native-rethemed/panda-css-tokens` (Panda's preset uses Tailwind's).
24
+ */
25
+ export declare const tailwindCssTheme: import("@react-native-rethemed/core/config").ThemeConfig;
26
+ export { colors, fontSizes, fontWeights, letterSpacings, lineHeights, radii, shadows, spacing, text, };
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.text = exports.spacing = exports.shadows = exports.radii = exports.lineHeights = exports.letterSpacings = exports.fontWeights = exports.fontSizes = exports.colors = exports.tailwindCssTheme = void 0;
4
+ const config_1 = require("@react-native-rethemed/core/config");
5
+ const tokens_gen_1 = require("./tokens.gen");
6
+ Object.defineProperty(exports, "colors", { enumerable: true, get: function () { return tokens_gen_1.colors; } });
7
+ Object.defineProperty(exports, "fontSizes", { enumerable: true, get: function () { return tokens_gen_1.fontSizes; } });
8
+ Object.defineProperty(exports, "fontWeights", { enumerable: true, get: function () { return tokens_gen_1.fontWeights; } });
9
+ Object.defineProperty(exports, "letterSpacings", { enumerable: true, get: function () { return tokens_gen_1.letterSpacings; } });
10
+ Object.defineProperty(exports, "lineHeights", { enumerable: true, get: function () { return tokens_gen_1.lineHeights; } });
11
+ Object.defineProperty(exports, "radii", { enumerable: true, get: function () { return tokens_gen_1.radii; } });
12
+ Object.defineProperty(exports, "shadows", { enumerable: true, get: function () { return tokens_gen_1.shadows; } });
13
+ Object.defineProperty(exports, "spacing", { enumerable: true, get: function () { return tokens_gen_1.spacing; } });
14
+ Object.defineProperty(exports, "text", { enumerable: true, get: function () { return tokens_gen_1.text; } });
15
+ /**
16
+ * Tailwind CSS's default theme (`tailwindcss/theme.css`), converted for
17
+ * React Native with Tailwind's names. Values are generated by
18
+ * `scripts/generate.ts`; see `src/tokens.gen.ts`.
19
+ *
20
+ * - Lengths: rem → points at 16px; em letter spacings → points at 16px.
21
+ * - `colors`: the oklch palette as hex, `'<hue>.<shade>'` (`'sky.500'`).
22
+ * Fixed in both schemes: Tailwind has no semantic colors (it uses `dark:`
23
+ * variants), so define `semanticTokens.colors` in the app.
24
+ * - `spacing`: `padding: 4` is `p-4` (16), for the steps Tailwind's docs
25
+ * list. `radii` / `lineHeights` add the `rounded-none` / `rounded-full` /
26
+ * `leading-none` utilities.
27
+ * - `text`: `themed.text.sm()` is `text-sm` — font size plus its paired line
28
+ * height. `fontSizes` (`fontSize: 'sm'`) sets the size alone.
29
+ * - `defaults.fontSize` is `base` (16), the size `lineHeights` ratios use when
30
+ * a style has no `fontSize` of its own.
31
+ * - `shadows`: first layer only. Not included (no RN equivalent): fonts,
32
+ * inset / drop / text shadows, blur, perspective, easing, animations,
33
+ * aspect ratios, breakpoints, containers.
34
+ *
35
+ * The palette, radii and shadows are the same values as
36
+ * `@react-native-rethemed/panda-css-tokens` (Panda's preset uses Tailwind's).
37
+ */
38
+ exports.tailwindCssTheme = (0, config_1.defineTheme)({
39
+ tokens: {
40
+ colors: tokens_gen_1.colors,
41
+ radii: tokens_gen_1.radii,
42
+ spacing: tokens_gen_1.spacing,
43
+ fontSizes: tokens_gen_1.fontSizes,
44
+ fontWeights: tokens_gen_1.fontWeights,
45
+ lineHeights: tokens_gen_1.lineHeights,
46
+ letterSpacings: tokens_gen_1.letterSpacings,
47
+ shadows: tokens_gen_1.shadows,
48
+ },
49
+ semanticTokens: {
50
+ text: tokens_gen_1.text,
51
+ },
52
+ defaults: {
53
+ fontSize: 'base',
54
+ },
55
+ });
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}