@momo-kits/mcp-expo 2.0.0-beta.2 → 2.0.0-beta.4
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 +1 -1
- package/remote-server.mjs +15 -0
- package/template/App.tsx +51 -151
package/package.json
CHANGED
package/remote-server.mjs
CHANGED
|
@@ -97,8 +97,23 @@ async function ensureDeps() {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
async function killPort(port) {
|
|
101
|
+
try {
|
|
102
|
+
const { execSync } = await import('child_process');
|
|
103
|
+
const pids = execSync(`lsof -ti:${port} 2>/dev/null`, { encoding: 'utf8' }).trim();
|
|
104
|
+
if (pids) {
|
|
105
|
+
for (const pid of pids.split('\n')) {
|
|
106
|
+
try { process.kill(parseInt(pid), 'SIGTERM'); } catch {}
|
|
107
|
+
}
|
|
108
|
+
log(`Killed existing processes on port ${port}: ${pids.replace(/\n/g, ', ')}`);
|
|
109
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
110
|
+
}
|
|
111
|
+
} catch {}
|
|
112
|
+
}
|
|
113
|
+
|
|
100
114
|
async function startExpoMetro() {
|
|
101
115
|
await ensureDeps();
|
|
116
|
+
await killPort(8081);
|
|
102
117
|
|
|
103
118
|
return new Promise((resolve, reject) => {
|
|
104
119
|
let settled = false;
|
package/template/App.tsx
CHANGED
|
@@ -1,161 +1,61 @@
|
|
|
1
1
|
|
|
2
|
-
import React
|
|
3
|
-
import { View, Text,
|
|
4
|
-
|
|
5
|
-
const Colors = {
|
|
6
|
-
primary: '#D82D8B',
|
|
7
|
-
danger: '#E53935',
|
|
8
|
-
white: '#FFFFFF',
|
|
9
|
-
black: '#1A1A1A',
|
|
10
|
-
textSecondary: '#6D6D6D',
|
|
11
|
-
textDisable: '#BDBDBD',
|
|
12
|
-
bgSurface: '#FFFFFF',
|
|
13
|
-
bgTonal: '#FCE4F0',
|
|
14
|
-
bgDisable: '#F0F0F0',
|
|
15
|
-
borderDefault: '#E0E0E0',
|
|
16
|
-
sectionBg: '#F5F5F5',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const SizeConfig: Record<string, any> = {
|
|
20
|
-
large: { height: 48, px: 16, minWidth: 128, radius: 8, fontSize: 16 },
|
|
21
|
-
medium: { height: 36, px: 12, minWidth: 80, radius: 8, fontSize: 14 },
|
|
22
|
-
small: { height: 28, px: 8, minWidth: 60, radius: 8, fontSize: 12 },
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
function getTypeStyle(type: string) {
|
|
26
|
-
switch (type) {
|
|
27
|
-
case 'primary': return { bg: Colors.primary, text: Colors.white, border: '' };
|
|
28
|
-
case 'tonal': return { bg: Colors.bgTonal, text: Colors.primary, border: '' };
|
|
29
|
-
case 'secondary': return { bg: Colors.bgSurface, text: Colors.black, border: Colors.borderDefault };
|
|
30
|
-
case 'outline': return { bg: Colors.bgSurface, text: Colors.primary, border: Colors.primary };
|
|
31
|
-
case 'text': return { bg: 'transparent', text: Colors.primary, border: '' };
|
|
32
|
-
case 'danger': return { bg: Colors.danger, text: Colors.white, border: '' };
|
|
33
|
-
case 'disabled': return { bg: Colors.bgDisable, text: Colors.textDisable, border: '' };
|
|
34
|
-
default: return { bg: Colors.primary, text: Colors.white, border: '' };
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function KitButton(props: { title: string; type?: string; size?: string; full?: boolean; loading?: boolean; onPress?: () => void }) {
|
|
39
|
-
const { title = 'Button', type = 'primary', size = 'large', full = true, loading = false, onPress } = props;
|
|
40
|
-
const s = SizeConfig[size] || SizeConfig.large;
|
|
41
|
-
const t = getTypeStyle(type);
|
|
42
|
-
const isDisabled = type === 'disabled' || loading;
|
|
43
|
-
|
|
44
|
-
const containerStyle: any = {
|
|
45
|
-
height: s.height,
|
|
46
|
-
paddingHorizontal: s.px,
|
|
47
|
-
minWidth: s.minWidth,
|
|
48
|
-
borderRadius: s.radius,
|
|
49
|
-
backgroundColor: t.bg,
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
justifyContent: 'center',
|
|
52
|
-
flexDirection: 'row',
|
|
53
|
-
opacity: loading ? 0.75 : 1,
|
|
54
|
-
alignSelf: full ? 'stretch' : 'flex-start',
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
if (t.border) {
|
|
58
|
-
containerStyle.borderWidth = 1;
|
|
59
|
-
containerStyle.borderColor = t.border;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<TouchableOpacity activeOpacity={0.7} disabled={isDisabled} onPress={onPress} style={containerStyle}>
|
|
64
|
-
{loading && <ActivityIndicator size="small" color={t.text} style={{ marginRight: 8 }} />}
|
|
65
|
-
<Text style={{ color: t.text, fontSize: s.fontSize, fontWeight: '700' }}>{title}</Text>
|
|
66
|
-
</TouchableOpacity>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function App() {
|
|
71
|
-
const [loadingId, setLoadingId] = useState('');
|
|
72
|
-
|
|
73
|
-
const simulateLoading = (id: string) => {
|
|
74
|
-
setLoadingId(id);
|
|
75
|
-
setTimeout(() => setLoadingId(''), 2000);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const types = ['primary', 'tonal', 'secondary', 'outline', 'text', 'danger', 'disabled'];
|
|
79
|
-
const sizes = ['large', 'medium', 'small'];
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View, Text, StyleSheet, ScrollView, StatusBar } from 'react-native';
|
|
80
4
|
|
|
5
|
+
export default function App() {
|
|
81
6
|
return (
|
|
82
|
-
<
|
|
83
|
-
<
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
loading={loadingId === type}
|
|
120
|
-
onPress={() => simulateLoading(type)}
|
|
121
|
-
/>
|
|
122
|
-
</View>
|
|
123
|
-
))}
|
|
124
|
-
</View>
|
|
125
|
-
|
|
126
|
-
<Text style={styles.sectionTitle}>SIZE x TYPE</Text>
|
|
127
|
-
<View style={styles.section}>
|
|
128
|
-
{sizes.map((size) => (
|
|
129
|
-
<View key={size}>
|
|
130
|
-
<Text style={{ fontSize: 12, fontWeight: '600', color: Colors.textSecondary, marginBottom: 6 }}>{size}</Text>
|
|
131
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8, marginBottom: 12 }}>
|
|
132
|
-
{['primary', 'tonal', 'outline', 'danger'].map((type) => (
|
|
133
|
-
<KitButton key={size + type} title={type.slice(0, 3).toUpperCase()} type={type} size={size} full={false} onPress={() => {}} />
|
|
134
|
-
))}
|
|
135
|
-
</View>
|
|
136
|
-
</View>
|
|
137
|
-
))}
|
|
138
|
-
</View>
|
|
139
|
-
|
|
140
|
-
<View style={{ height: 48 }} />
|
|
141
|
-
</ScrollView>
|
|
7
|
+
<View style={styles.container}>
|
|
8
|
+
<StatusBar barStyle="dark-content" />
|
|
9
|
+
<ScrollView contentContainerStyle={styles.content}>
|
|
10
|
+
<Text style={styles.title}>Text Component</Text>
|
|
11
|
+
<Text style={styles.subtitle}>@momo-kits/foundation</Text>
|
|
12
|
+
|
|
13
|
+
<Text style={styles.sectionHeader}>Typography Scale</Text>
|
|
14
|
+
|
|
15
|
+
<Text style={{ fontSize: 28, fontWeight: '700', lineHeight: 36, color: '#1A1A1A', marginBottom: 12 }}>headline_default_bold</Text>
|
|
16
|
+
<Text style={{ fontSize: 24, fontWeight: '700', lineHeight: 32, color: '#1A1A1A', marginBottom: 12 }}>header_m_bold</Text>
|
|
17
|
+
<Text style={{ fontSize: 20, fontWeight: '700', lineHeight: 28, color: '#1A1A1A', marginBottom: 12 }}>header_default_bold</Text>
|
|
18
|
+
<Text style={{ fontSize: 18, fontWeight: '600', lineHeight: 24, color: '#1A1A1A', marginBottom: 12 }}>header_s_semibold</Text>
|
|
19
|
+
<Text style={{ fontSize: 16, fontWeight: '600', lineHeight: 22, color: '#1A1A1A', marginBottom: 12 }}>header_xs_semibold</Text>
|
|
20
|
+
<Text style={{ fontSize: 16, fontWeight: '400', lineHeight: 24, color: '#1A1A1A', marginBottom: 12 }}>body_default_regular</Text>
|
|
21
|
+
<Text style={{ fontSize: 16, fontWeight: '400', lineHeight: 24, color: '#1A1A1A', marginBottom: 12, textDecorationLine: 'line-through' }}>body_default_strikethrough</Text>
|
|
22
|
+
<Text style={{ fontSize: 14, fontWeight: '400', lineHeight: 20, color: '#1A1A1A', marginBottom: 12 }}>description_default_regular</Text>
|
|
23
|
+
<Text style={{ fontSize: 12, fontWeight: '400', lineHeight: 16, color: '#1A1A1A', marginBottom: 12 }}>description_xs_regular</Text>
|
|
24
|
+
<Text style={{ fontSize: 16, fontWeight: '500', lineHeight: 22, color: '#1A1A1A', marginBottom: 12 }}>label_default_medium</Text>
|
|
25
|
+
<Text style={{ fontSize: 14, fontWeight: '500', lineHeight: 20, color: '#1A1A1A', marginBottom: 12 }}>label_s_medium</Text>
|
|
26
|
+
<Text style={{ fontSize: 12, fontWeight: '500', lineHeight: 16, color: '#1A1A1A', marginBottom: 12 }}>label_xs_medium</Text>
|
|
27
|
+
<Text style={{ fontSize: 16, fontWeight: '700', lineHeight: 22, color: '#1A1A1A', marginBottom: 12 }}>action_default_bold</Text>
|
|
28
|
+
<Text style={{ fontSize: 14, fontWeight: '700', lineHeight: 20, color: '#1A1A1A', marginBottom: 12 }}>action_s_bold</Text>
|
|
29
|
+
<Text style={{ fontSize: 12, fontWeight: '700', lineHeight: 16, color: '#1A1A1A', marginBottom: 12 }}>action_xs_bold</Text>
|
|
30
|
+
<Text style={{ fontSize: 10, fontWeight: '700', lineHeight: 14, color: '#1A1A1A', marginBottom: 12 }}>action_xxs_bold</Text>
|
|
31
|
+
|
|
32
|
+
<Text style={styles.sectionHeader}>Colors</Text>
|
|
33
|
+
|
|
34
|
+
<Text style={{ fontSize: 16, fontWeight: '600', color: '#1A1A1A', marginBottom: 8 }}>default</Text>
|
|
35
|
+
<Text style={{ fontSize: 16, fontWeight: '600', color: '#7A7A7A', marginBottom: 8 }}>secondary</Text>
|
|
36
|
+
<Text style={{ fontSize: 16, fontWeight: '600', color: '#B8B8B8', marginBottom: 8 }}>disable</Text>
|
|
37
|
+
<Text style={{ fontSize: 16, fontWeight: '600', color: '#D82D8B', marginBottom: 8 }}>primary</Text>
|
|
38
|
+
<Text style={{ fontSize: 16, fontWeight: '600', color: '#00C853', marginBottom: 8 }}>success</Text>
|
|
39
|
+
<Text style={{ fontSize: 16, fontWeight: '600', color: '#FF9100', marginBottom: 8 }}>warning</Text>
|
|
40
|
+
<Text style={{ fontSize: 16, fontWeight: '600', color: '#FF1744', marginBottom: 8 }}>error</Text>
|
|
41
|
+
<Text style={{ fontSize: 16, fontWeight: '600', color: '#2979FF', marginBottom: 8 }}>info</Text>
|
|
42
|
+
</ScrollView>
|
|
43
|
+
</View>
|
|
142
44
|
);
|
|
143
45
|
}
|
|
144
46
|
|
|
145
|
-
export default App;
|
|
146
|
-
|
|
147
47
|
const styles = StyleSheet.create({
|
|
148
|
-
|
|
48
|
+
container: { flex: 1, backgroundColor: '#FAFAFA' },
|
|
49
|
+
content: { padding: 20, paddingTop: 60, paddingBottom: 40 },
|
|
50
|
+
title: { fontSize: 28, fontWeight: '700', color: '#1A1A1A' },
|
|
51
|
+
subtitle: { fontSize: 13, color: '#999', marginTop: 4, marginBottom: 24 },
|
|
52
|
+
sectionHeader: {
|
|
149
53
|
fontSize: 13,
|
|
150
|
-
fontWeight: '
|
|
151
|
-
color: '#
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
section: {
|
|
157
|
-
backgroundColor: '#F5F5F5',
|
|
158
|
-
borderRadius: 12,
|
|
159
|
-
padding: 16,
|
|
54
|
+
fontWeight: '700',
|
|
55
|
+
color: '#D82D8B',
|
|
56
|
+
textTransform: 'uppercase',
|
|
57
|
+
letterSpacing: 1,
|
|
58
|
+
marginTop: 20,
|
|
59
|
+
marginBottom: 16,
|
|
160
60
|
},
|
|
161
61
|
});
|