@umituz/react-native-design-system 1.0.0 → 1.0.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/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Universal design system for React Native apps - Domain-Driven Design architecture with Material Design 3 components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"version:patch": "npm version patch -m 'chore: release v%s'",
|
|
9
|
+
"version:minor": "npm version minor -m 'chore: release v%s'",
|
|
10
|
+
"version:major": "npm version major -m 'chore: release v%s'"
|
|
11
|
+
},
|
|
7
12
|
"keywords": [
|
|
8
13
|
"react-native",
|
|
9
14
|
"design-system",
|
|
@@ -13,19 +18,20 @@
|
|
|
13
18
|
"ddd",
|
|
14
19
|
"domain-driven-design"
|
|
15
20
|
],
|
|
16
|
-
"author": "
|
|
21
|
+
"author": "Ümit UZ <umit@umituz.com>",
|
|
17
22
|
"license": "MIT",
|
|
18
23
|
"repository": {
|
|
19
24
|
"type": "git",
|
|
20
25
|
"url": "https://github.com/umituz/react-native-design-system"
|
|
21
26
|
},
|
|
22
27
|
"peerDependencies": {
|
|
23
|
-
"react": "18.
|
|
24
|
-
"react-native": "0.
|
|
28
|
+
"react": ">=18.2.0",
|
|
29
|
+
"react-native": ">=0.74.0",
|
|
25
30
|
"react-native-paper": "^5.12.5",
|
|
26
31
|
"react-native-reanimated": "~3.10.1",
|
|
27
32
|
"@react-native-community/datetimepicker": "8.0.1",
|
|
28
|
-
"@expo/vector-icons": "^14.0.0"
|
|
33
|
+
"@expo/vector-icons": "^14.0.0",
|
|
34
|
+
"lucide-react-native": "^0.468.0"
|
|
29
35
|
},
|
|
30
36
|
"peerDependenciesMeta": {
|
|
31
37
|
"@react-native-community/datetimepicker": {
|
|
@@ -1,43 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* useAppDesignTokens Hook -
|
|
2
|
+
* useAppDesignTokens Hook - Design Tokens Access
|
|
3
3
|
*
|
|
4
|
-
* ✅
|
|
5
|
-
* ✅
|
|
4
|
+
* ✅ NPM PACKAGE VERSION - Standalone, no theme dependencies
|
|
5
|
+
* ✅ Returns static light theme tokens
|
|
6
6
|
* ✅ Type-safe design tokens
|
|
7
|
-
* ✅
|
|
8
|
-
* ✅ Graceful fallback to light theme
|
|
9
|
-
* ✅ NO CIRCULAR DEPENDENCY - Relative imports break barrel export cycle
|
|
7
|
+
* ✅ Zero external dependencies
|
|
10
8
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* - Relative import for TokenFactory (not barrel through AppDesignTokens)
|
|
14
|
-
* - NOT exported from AppDesignTokens.ts (only from design-system/index.ts)
|
|
15
|
-
*
|
|
16
|
-
* This architecture prevents cycle:
|
|
17
|
-
* - useAppDesignTokens → useTheme (relative, not through barrel)
|
|
18
|
-
* - theme → design-system (through barrel, but useAppDesignTokens not in token barrel)
|
|
19
|
-
* - No cycle detected!
|
|
20
|
-
*
|
|
21
|
-
* @module useAppDesignTokens
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
import { useMemo } from 'react';
|
|
25
|
-
import { useTheme } from '../../../theme/infrastructure/stores/themeStore';
|
|
26
|
-
import { createDesignTokens, STATIC_DESIGN_TOKENS, type ThemeMode } from '../tokens/core/TokenFactory';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 🎯 DYNAMIC DESIGN TOKENS HOOK
|
|
30
|
-
*
|
|
31
|
-
* USE THIS HOOK in all components for theme-aware design tokens!
|
|
32
|
-
*
|
|
33
|
-
* ✅ Colors are DYNAMIC (update when theme changes)
|
|
34
|
-
* ✅ Typography, spacing, etc. are STATIC (performance optimization)
|
|
35
|
-
* ✅ Automatic re-render on theme change
|
|
36
|
-
* ✅ Zero duplication (uses TokenFactory)
|
|
9
|
+
* NOTE: This is the npm package version which returns light theme only.
|
|
10
|
+
* For dynamic theme switching, apps should use @domains/theme ThemeProvider.
|
|
37
11
|
*
|
|
38
12
|
* @example
|
|
39
13
|
* ```typescript
|
|
40
|
-
* import { useAppDesignTokens } from '@
|
|
14
|
+
* import { useAppDesignTokens } from '@umituz/react-native-design-system';
|
|
41
15
|
*
|
|
42
16
|
* const MyComponent = () => {
|
|
43
17
|
* const tokens = useAppDesignTokens();
|
|
@@ -53,26 +27,11 @@ import { createDesignTokens, STATIC_DESIGN_TOKENS, type ThemeMode } from '../tok
|
|
|
53
27
|
* };
|
|
54
28
|
* ```
|
|
55
29
|
*/
|
|
56
|
-
export const useAppDesignTokens = () => {
|
|
57
|
-
// ✅ Hooks must be called unconditionally at the top level
|
|
58
|
-
const { theme, themeMode: mode } = useTheme();
|
|
59
30
|
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
// Validate theme mode
|
|
63
|
-
const themeMode: ThemeMode = mode === 'dark' ? 'dark' : 'light';
|
|
31
|
+
import { STATIC_DESIGN_TOKENS } from '../tokens/core/TokenFactory';
|
|
64
32
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// ✅ Create tokens using TokenFactory (ZERO duplication!)
|
|
72
|
-
return createDesignTokens(themeMode);
|
|
73
|
-
} catch (error) {
|
|
74
|
-
console.warn('useAppDesignTokens: Error accessing theme, using fallback:', error);
|
|
75
|
-
return STATIC_DESIGN_TOKENS; // Fallback to light theme
|
|
76
|
-
}
|
|
77
|
-
}, [theme?.colors, mode]); // Re-compute when colors or mode changes
|
|
33
|
+
export const useAppDesignTokens = () => {
|
|
34
|
+
// NPM package version: Always return light theme
|
|
35
|
+
// Apps using factory generator will override this with theme-aware version
|
|
36
|
+
return STATIC_DESIGN_TOKENS;
|
|
78
37
|
};
|