@react-native-rethemed/material-ui-tokens 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @react-native-rethemed/material-ui-tokens
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@react-native-rethemed/material-ui-tokens.svg)](https://www.npmjs.com/package/@react-native-rethemed/material-ui-tokens)
4
+
3
5
  Material UI's default theme (palette, colors, typography) for React Native, ready for [react-native-rethemed](https://github.com/manakuro/react-native-rethemed).
4
6
 
5
7
  Material UI's default theme (`createTheme()`, Material Design 2): palette in light and dark mode with Material UI's names (`'primary.main'`, `'text.secondary'`), `@mui/material/colors`, the 13 typography variants as text presets (`button` / `overline` keep `textTransform: 'uppercase'`), spacing, shape and elevations 0–24.
package/dist/index.cjs ADDED
@@ -0,0 +1,49 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_tokens_gen = require("./tokens.gen.cjs");
3
+ //#region src/index.ts
4
+ /**
5
+ * Material UI's default theme (`createTheme()` from `@mui/material`, which
6
+ * follows Material Design 2), converted for React Native. Values are
7
+ * generated by `scripts/generate.ts`; see `src/tokens.gen.ts`.
8
+ *
9
+ * - `semanticColors`: the default `palette` in light and dark mode, as
10
+ * `'<group>.<key>'` with Material UI's own names: `'primary.main'`,
11
+ * `'primary.contrastText'`, `'text.secondary'`, `'background.paper'`,
12
+ * `'action.hover'`, `'divider.default'`.
13
+ * - `colors`: `@mui/material/colors` as `'<hue>.<shade>'` (`'red.500'`,
14
+ * `'deepPurple.A200'`), plus `black` and `white`. Fixed in both schemes.
15
+ * - `typography`: the 13 variants (`h1`…`overline`) as text presets,
16
+ * `themed.text.h1()`. rem/em → points at `htmlFontSize` (16); line heights
17
+ * absolute; `button` / `overline` keep `textTransform: 'uppercase'`.
18
+ * - `spacing`: `theme.spacing(n)`, so `padding: 2` is 16. `radii`: multiples
19
+ * of `shape.borderRadius`, so `borderRadius: 2` is 8 — both like `sx`.
20
+ * - `shadows`: elevations 0–24, first layer only; `elevation` matches the
21
+ * Material elevation on Android exactly.
22
+ * - Not included (no RN equivalent): `fontFamily` (Roboto, Android's default
23
+ * anyway), breakpoints, transitions, mixins, component overrides, the
24
+ * `action.*Opacity` numbers and dark mode's `text.icon`.
25
+ */
26
+ const materialUiTheme = (0, require("@react-native-rethemed/core/config").defineTheme)({
27
+ tokens: {
28
+ colors: require_tokens_gen.colors,
29
+ radii: require_tokens_gen.radii,
30
+ spacing: require_tokens_gen.spacing,
31
+ fontWeights: require_tokens_gen.fontWeights,
32
+ zIndices: require_tokens_gen.zIndices,
33
+ shadows: require_tokens_gen.shadows
34
+ },
35
+ semanticTokens: {
36
+ colors: require_tokens_gen.semanticColors,
37
+ text: require_tokens_gen.typography
38
+ }
39
+ });
40
+ //#endregion
41
+ exports.colors = require_tokens_gen.colors;
42
+ exports.fontWeights = require_tokens_gen.fontWeights;
43
+ exports.materialUiTheme = materialUiTheme;
44
+ exports.radii = require_tokens_gen.radii;
45
+ exports.semanticColors = require_tokens_gen.semanticColors;
46
+ exports.shadows = require_tokens_gen.shadows;
47
+ exports.spacing = require_tokens_gen.spacing;
48
+ exports.typography = require_tokens_gen.typography;
49
+ exports.zIndices = require_tokens_gen.zIndices;
@@ -1,4 +1,5 @@
1
- import { colors, fontWeights, radii, semanticColors, shadows, spacing, typography, zIndices } from './tokens.gen';
1
+ import { colors, fontWeights, radii, semanticColors, shadows, spacing, typography, zIndices } from "./tokens.gen.cjs";
2
+ //#region src/index.d.ts
2
3
  /**
3
4
  * Material UI's default theme (`createTheme()` from `@mui/material`, which
4
5
  * follows Material Design 2), converted for React Native. Values are
@@ -22,4 +23,5 @@ import { colors, fontWeights, radii, semanticColors, shadows, spacing, typograph
22
23
  * `action.*Opacity` numbers and dark mode's `text.icon`.
23
24
  */
24
25
  export declare const materialUiTheme: import("@react-native-rethemed/core/config").ThemeConfig;
25
- export { colors, fontWeights, radii, semanticColors, shadows, spacing, typography, zIndices, };
26
+ //#endregion
27
+ export { colors, fontWeights, radii, semanticColors, shadows, spacing, typography, zIndices };
@@ -1,4 +1,5 @@
1
- import { colors, fontWeights, radii, semanticColors, shadows, spacing, typography, zIndices } from './tokens.gen.js';
1
+ import { colors, fontWeights, radii, semanticColors, shadows, spacing, typography, zIndices } from "./tokens.gen.mjs";
2
+ //#region src/index.d.ts
2
3
  /**
3
4
  * Material UI's default theme (`createTheme()` from `@mui/material`, which
4
5
  * follows Material Design 2), converted for React Native. Values are
@@ -22,4 +23,5 @@ import { colors, fontWeights, radii, semanticColors, shadows, spacing, typograph
22
23
  * `action.*Opacity` numbers and dark mode's `text.icon`.
23
24
  */
24
25
  export declare const materialUiTheme: import("@react-native-rethemed/core/config").ThemeConfig;
25
- export { colors, fontWeights, radii, semanticColors, shadows, spacing, typography, zIndices, };
26
+ //#endregion
27
+ export { colors, fontWeights, radii, semanticColors, shadows, spacing, typography, zIndices };
package/dist/index.mjs ADDED
@@ -0,0 +1,41 @@
1
+ import { colors, fontWeights, radii, semanticColors, shadows, spacing, typography, zIndices } from "./tokens.gen.mjs";
2
+ import { defineTheme } from "@react-native-rethemed/core/config";
3
+ //#region src/index.ts
4
+ /**
5
+ * Material UI's default theme (`createTheme()` from `@mui/material`, which
6
+ * follows Material Design 2), converted for React Native. Values are
7
+ * generated by `scripts/generate.ts`; see `src/tokens.gen.ts`.
8
+ *
9
+ * - `semanticColors`: the default `palette` in light and dark mode, as
10
+ * `'<group>.<key>'` with Material UI's own names: `'primary.main'`,
11
+ * `'primary.contrastText'`, `'text.secondary'`, `'background.paper'`,
12
+ * `'action.hover'`, `'divider.default'`.
13
+ * - `colors`: `@mui/material/colors` as `'<hue>.<shade>'` (`'red.500'`,
14
+ * `'deepPurple.A200'`), plus `black` and `white`. Fixed in both schemes.
15
+ * - `typography`: the 13 variants (`h1`…`overline`) as text presets,
16
+ * `themed.text.h1()`. rem/em → points at `htmlFontSize` (16); line heights
17
+ * absolute; `button` / `overline` keep `textTransform: 'uppercase'`.
18
+ * - `spacing`: `theme.spacing(n)`, so `padding: 2` is 16. `radii`: multiples
19
+ * of `shape.borderRadius`, so `borderRadius: 2` is 8 — both like `sx`.
20
+ * - `shadows`: elevations 0–24, first layer only; `elevation` matches the
21
+ * Material elevation on Android exactly.
22
+ * - Not included (no RN equivalent): `fontFamily` (Roboto, Android's default
23
+ * anyway), breakpoints, transitions, mixins, component overrides, the
24
+ * `action.*Opacity` numbers and dark mode's `text.icon`.
25
+ */
26
+ const materialUiTheme = defineTheme({
27
+ tokens: {
28
+ colors,
29
+ radii,
30
+ spacing,
31
+ fontWeights,
32
+ zIndices,
33
+ shadows
34
+ },
35
+ semanticTokens: {
36
+ colors: semanticColors,
37
+ text: typography
38
+ }
39
+ });
40
+ //#endregion
41
+ export { colors, fontWeights, materialUiTheme, radii, semanticColors, shadows, spacing, typography, zIndices };