@idealyst/cli 1.0.4 → 1.0.6

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "CLI tool for generating Idealyst Framework projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,9 +1,4 @@
1
- /**
2
- * @format
3
- */
4
-
5
1
  import { AppRegistry } from 'react-native';
6
2
  import App from './src/App';
7
- import { name as appName } from './app.json';
8
3
 
9
- AppRegistry.registerComponent(appName, () => App);
4
+ AppRegistry.registerComponent('{{projectName}}', () => App);
@@ -9,24 +9,19 @@ UnistylesRegistry.addThemes({
9
9
  dark: darkTheme,
10
10
  });
11
11
 
12
- const App: React.FC = () => {
12
+ const App = () => {
13
13
  return (
14
14
  <Screen>
15
- <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20 }}>
16
- <Text variant="h1" style={{ marginBottom: 20, textAlign: 'center' }}>
17
- Welcome to {{projectName}}
18
- </Text>
19
- <Text variant="body1" style={{ marginBottom: 30, textAlign: 'center' }}>
20
- Built with Idealyst Framework
15
+ <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
16
+ <Text variant="h1">Welcome to {{projectName}}</Text>
17
+ <Text variant="body">
18
+ This is a React Native app built with the Idealyst Framework.
21
19
  </Text>
22
20
  <Button
23
21
  title="Get Started"
24
22
  onPress={() => console.log('Button pressed!')}
25
- style={{ marginBottom: 20 }}
23
+ style={{ marginTop: 20 }}
26
24
  />
27
- <Text variant="caption" style={{ textAlign: 'center', opacity: 0.7 }}>
28
- Edit src/App.tsx to start building your app
29
- </Text>
30
25
  </View>
31
26
  </Screen>
32
27
  );
@@ -1,25 +1,41 @@
1
1
  import React from 'react';
2
2
  import { View, Text } from 'react-native';
3
+ import { useTheme } from '@idealyst/theme';
3
4
 
4
- interface SharedComponentProps {
5
+ export interface SharedComponentProps {
5
6
  title: string;
6
7
  description?: string;
7
8
  }
8
9
 
9
- export const SharedComponent: React.FC<SharedComponentProps> = ({
10
- title,
11
- description
12
- }) => {
10
+ const SharedComponent: React.FC<SharedComponentProps> = ({ title, description }) => {
11
+ const { theme } = useTheme();
12
+
13
13
  return (
14
- <View style={{ padding: 16, alignItems: 'center' }}>
15
- <Text style={{ fontSize: 18, fontWeight: 'bold', marginBottom: 8 }}>
14
+ <View style={{
15
+ padding: 16,
16
+ backgroundColor: theme.colors.surface,
17
+ borderRadius: 8,
18
+ marginBottom: 16
19
+ }}>
20
+ <Text style={{
21
+ fontSize: 18,
22
+ fontWeight: 'bold',
23
+ color: theme.colors.text,
24
+ marginBottom: 8
25
+ }}>
16
26
  {title}
17
27
  </Text>
18
28
  {description && (
19
- <Text style={{ fontSize: 14, color: '#666', textAlign: 'center' }}>
29
+ <Text style={{
30
+ fontSize: 14,
31
+ color: theme.colors.textSecondary,
32
+ lineHeight: 20
33
+ }}>
20
34
  {description}
21
35
  </Text>
22
36
  )}
23
37
  </View>
24
38
  );
25
- };
39
+ };
40
+
41
+ export default SharedComponent;
@@ -1 +1,3 @@
1
- export * from './SharedComponent';
1
+ // Export all components
2
+ export { default as SharedComponent } from './SharedComponent';
3
+ export type { SharedComponentProps } from './SharedComponent';
@@ -1,6 +1,10 @@
1
- // Export shared components, utilities, and types
1
+ // Export all components
2
2
  export * from './components';
3
+
4
+ // Export all utilities
3
5
  export * from './utils';
6
+
7
+ // Export all types
4
8
  export * from './types';
5
9
 
6
10
  // Re-export theme utilities
@@ -1,7 +1,17 @@
1
- // Basic types for the shared library
2
1
  export interface ComponentProps {
3
- children?: any;
4
2
  style?: any;
3
+ children?: React.ReactNode;
5
4
  }
6
5
 
7
- export type Theme = 'light' | 'dark';
6
+ export interface User {
7
+ id: string;
8
+ name: string;
9
+ email: string;
10
+ avatar?: string;
11
+ }
12
+
13
+ export interface ApiResponse<T> {
14
+ data: T;
15
+ message: string;
16
+ success: boolean;
17
+ }
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Format a string to title case
2
+ * Converts a string to title case
3
+ * @param str The string to convert
4
+ * @returns The string in title case
3
5
  */
4
6
  export const toTitleCase = (str: string): string => {
5
7
  return str.replace(/\w\S*/g, (txt) =>
@@ -8,25 +10,25 @@ export const toTitleCase = (str: string): string => {
8
10
  };
9
11
 
10
12
  /**
11
- * Check if a value is empty (null, undefined, empty string, empty array)
13
+ * Formats a number as currency
14
+ * @param amount The amount to format
15
+ * @param currency The currency code (default: 'USD')
16
+ * @returns The formatted currency string
12
17
  */
13
- export const isEmpty = (value: any): boolean => {
14
- if (value === null || value === undefined) return true;
15
- if (typeof value === 'string' && value.trim() === '') return true;
16
- if (Array.isArray(value) && value.length === 0) return true;
17
- return false;
18
+ export const formatCurrency = (amount: number, currency = 'USD'): string => {
19
+ return new Intl.NumberFormat('en-US', {
20
+ style: 'currency',
21
+ currency,
22
+ }).format(amount);
18
23
  };
19
24
 
20
25
  /**
21
- * Debounce function calls
26
+ * Truncates a string to a specified length
27
+ * @param str The string to truncate
28
+ * @param maxLength The maximum length
29
+ * @returns The truncated string
22
30
  */
23
- export const debounce = <T extends (...args: any[]) => any>(
24
- func: T,
25
- delay: number
26
- ): ((...args: Parameters<T>) => void) => {
27
- let timeoutId: NodeJS.Timeout;
28
- return (...args: Parameters<T>) => {
29
- clearTimeout(timeoutId);
30
- timeoutId = setTimeout(() => func(...args), delay);
31
- };
31
+ export const truncateText = (str: string, maxLength: number): string => {
32
+ if (str.length <= maxLength) return str;
33
+ return str.substring(0, maxLength) + '...';
32
34
  };
@@ -1 +1,2 @@
1
+ // Export all utilities
1
2
  export * from './helpers';
@@ -87,5 +87,4 @@ const styles = createStyleSheet({
87
87
 
88
88
  - [Idealyst Framework Documentation](https://github.com/your-username/idealyst-framework)
89
89
  - [React Documentation](https://react.dev/)
90
- - [Vite Documentation](https://vitejs.dev/)
91
- - [React Native Web Documentation](https://necolas.github.io/react-native-web/)
90
+ - [Vite Documentation](https://vitejs.dev/)
@@ -9,29 +9,18 @@ UnistylesRegistry.addThemes({
9
9
  dark: darkTheme,
10
10
  });
11
11
 
12
- const App: React.FC = () => {
12
+ const App = () => {
13
13
  return (
14
- <View style={{
15
- flex: 1,
16
- justifyContent: 'center',
17
- alignItems: 'center',
18
- padding: 20,
19
- minHeight: '100vh'
20
- }}>
21
- <Text variant="h1" style={{ marginBottom: 20, textAlign: 'center' }}>
22
- Welcome to {{projectName}}
23
- </Text>
24
- <Text variant="body1" style={{ marginBottom: 30, textAlign: 'center' }}>
25
- Built with Idealyst Framework
14
+ <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', minHeight: '100vh' }}>
15
+ <Text variant="h1">Welcome to {{projectName}}</Text>
16
+ <Text variant="body" style={{ marginTop: 20, textAlign: 'center' }}>
17
+ This is a React web application built with the Idealyst Framework.
26
18
  </Text>
27
19
  <Button
28
20
  title="Get Started"
29
21
  onPress={() => console.log('Button pressed!')}
30
- style={{ marginBottom: 20 }}
22
+ style={{ marginTop: 20 }}
31
23
  />
32
- <Text variant="caption" style={{ textAlign: 'center', opacity: 0.7 }}>
33
- Edit src/App.tsx to start building your app
34
- </Text>
35
24
  </View>
36
25
  );
37
26
  };
@@ -1,11 +1,10 @@
1
- import React from 'react';
1
+ import { StrictMode } from 'react';
2
2
  import { createRoot } from 'react-dom/client';
3
3
  import App from './App';
4
4
 
5
- const container = document.getElementById('root');
6
- if (!container) {
7
- throw new Error('Root element not found');
8
- }
9
-
10
- const root = createRoot(container);
11
- root.render(<App />);
5
+ const root = createRoot(document.getElementById('root')!);
6
+ root.render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>
10
+ );