@mongrov/theme 0.1.0 → 0.3.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.
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge @mongrov/theme tokens to @react-navigation/native Theme shape.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import { useNavigationTheme } from '@mongrov/theme/navigation';
|
|
7
|
+
* import { ThemeProvider } from '@react-navigation/native';
|
|
8
|
+
*
|
|
9
|
+
* const navTheme = useNavigationTheme();
|
|
10
|
+
* <ThemeProvider value={navTheme}>…</ThemeProvider>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Requires `@react-navigation/native` as a peer dependency.
|
|
14
|
+
* The Theme type is inlined to avoid a hard dependency on the package at build time.
|
|
15
|
+
*/
|
|
16
|
+
interface NavigationFonts {
|
|
17
|
+
fontFamily: string;
|
|
18
|
+
fontWeight: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
19
|
+
}
|
|
20
|
+
interface NavigationTheme {
|
|
21
|
+
dark: boolean;
|
|
22
|
+
colors: {
|
|
23
|
+
primary: string;
|
|
24
|
+
background: string;
|
|
25
|
+
card: string;
|
|
26
|
+
text: string;
|
|
27
|
+
border: string;
|
|
28
|
+
notification: string;
|
|
29
|
+
};
|
|
30
|
+
fonts: {
|
|
31
|
+
regular: NavigationFonts;
|
|
32
|
+
medium: NavigationFonts;
|
|
33
|
+
bold: NavigationFonts;
|
|
34
|
+
heavy: NavigationFonts;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export declare function useNavigationTheme(): NavigationTheme;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=navigation-theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-theme.d.ts","sourceRoot":"","sources":["../src/navigation-theme.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EACN,QAAQ,GACR,MAAM,GACN,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAA;CACV;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,EAAE,MAAM,CAAA;QAClB,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,KAAK,EAAE;QACL,OAAO,EAAE,eAAe,CAAA;QACxB,MAAM,EAAE,eAAe,CAAA;QACvB,IAAI,EAAE,eAAe,CAAA;QACrB,KAAK,EAAE,eAAe,CAAA;KACvB,CAAA;CACF;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAgCpD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useTheme } from './theme-provider';
|
|
2
|
+
export function useNavigationTheme() {
|
|
3
|
+
const { tokens, isDark } = useTheme();
|
|
4
|
+
return {
|
|
5
|
+
dark: isDark,
|
|
6
|
+
colors: {
|
|
7
|
+
primary: tokens.colors.primary,
|
|
8
|
+
background: tokens.colors.background,
|
|
9
|
+
card: tokens.colors.card,
|
|
10
|
+
text: tokens.colors.foreground,
|
|
11
|
+
border: tokens.colors.border,
|
|
12
|
+
notification: tokens.colors.destructive,
|
|
13
|
+
},
|
|
14
|
+
fonts: {
|
|
15
|
+
regular: {
|
|
16
|
+
fontFamily: tokens.typography.fontFamily.regular,
|
|
17
|
+
fontWeight: '400',
|
|
18
|
+
},
|
|
19
|
+
medium: {
|
|
20
|
+
fontFamily: tokens.typography.fontFamily.medium,
|
|
21
|
+
fontWeight: '500',
|
|
22
|
+
},
|
|
23
|
+
bold: {
|
|
24
|
+
fontFamily: tokens.typography.fontFamily.bold,
|
|
25
|
+
fontWeight: '700',
|
|
26
|
+
},
|
|
27
|
+
heavy: {
|
|
28
|
+
fontFamily: tokens.typography.fontFamily.bold,
|
|
29
|
+
fontWeight: '900',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=navigation-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-theme.js","sourceRoot":"","sources":["../src/navigation-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAoD3C,MAAM,UAAU,kBAAkB;IAChC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAErC,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE;YACN,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO;YAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;YACpC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;YACxB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;YAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;YAC5B,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW;SACxC;QACD,KAAK,EAAE;YACL,OAAO,EAAE;gBACP,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO;gBAChD,UAAU,EAAE,KAAK;aAClB;YACD,MAAM,EAAE;gBACN,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM;gBAC/C,UAAU,EAAE,KAAK;aAClB;YACD,IAAI,EAAE;gBACJ,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI;gBAC7C,UAAU,EAAE,KAAK;aAClB;YACD,KAAK,EAAE;gBACL,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI;gBAC7C,UAAU,EAAE,KAAK;aAClB;SACF;KACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongrov/theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Theme contract and color scheme management for React Native / Expo apps",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,11 +26,25 @@
|
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
27
|
"import": "./dist/index.js",
|
|
28
28
|
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./navigation": {
|
|
31
|
+
"types": "./dist/navigation-theme.d.ts",
|
|
32
|
+
"import": "./dist/navigation-theme.js",
|
|
33
|
+
"default": "./dist/navigation-theme.js"
|
|
29
34
|
}
|
|
30
35
|
},
|
|
31
36
|
"files": [
|
|
32
37
|
"dist"
|
|
33
38
|
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -p tsconfig.build.json",
|
|
41
|
+
"clean": "rm -rf dist",
|
|
42
|
+
"prebuild": "pnpm run clean",
|
|
43
|
+
"test": "jest --coverage",
|
|
44
|
+
"test:watch": "jest --watch",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"prepublishOnly": "pnpm run build"
|
|
47
|
+
},
|
|
34
48
|
"peerDependencies": {
|
|
35
49
|
"react": ">=18",
|
|
36
50
|
"react-native": ">=0.74",
|
|
@@ -54,13 +68,5 @@
|
|
|
54
68
|
"ts-jest": "^29.1.2",
|
|
55
69
|
"typescript": "^5.9.3",
|
|
56
70
|
"zustand": "^5.0.10"
|
|
57
|
-
},
|
|
58
|
-
"scripts": {
|
|
59
|
-
"build": "tsc -p tsconfig.build.json",
|
|
60
|
-
"clean": "rm -rf dist",
|
|
61
|
-
"prebuild": "pnpm run clean",
|
|
62
|
-
"test": "jest --coverage",
|
|
63
|
-
"test:watch": "jest --watch",
|
|
64
|
-
"typecheck": "tsc --noEmit"
|
|
65
71
|
}
|
|
66
|
-
}
|
|
72
|
+
}
|