openuispec 0.1.45 → 0.1.46

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.
Files changed (133) hide show
  1. package/README.md +2 -1
  2. package/cli/init.ts +5 -2
  3. package/examples/social-app/.mcp.json +10 -0
  4. package/examples/social-app/AGENTS.md +105 -0
  5. package/examples/social-app/CLAUDE.md +105 -0
  6. package/examples/social-app/README.md +19 -0
  7. package/examples/social-app/backend/.gitkeep +1 -0
  8. package/examples/social-app/generated/android/social-app/app/build.gradle.kts +92 -0
  9. package/examples/social-app/generated/android/social-app/app/src/main/AndroidManifest.xml +26 -0
  10. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/AppContainer.kt +20 -0
  11. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/MainActivity.kt +35 -0
  12. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/SocialAppApplication.kt +13 -0
  13. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/MockData.kt +98 -0
  14. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/preferences/AppPreferences.kt +19 -0
  15. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/preferences/DataStorePreferencesRepository.kt +68 -0
  16. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/data/preferences/PreferencesRepository.kt +15 -0
  17. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/model/Models.kt +34 -0
  18. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/MainShell.kt +390 -0
  19. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/components/Components.kt +234 -0
  20. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/components/ContractPrimitives.kt +641 -0
  21. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/navigation/RootComponent.kt +113 -0
  22. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/ChatDetailScreen.kt +212 -0
  23. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/CreatePostScreen.kt +113 -0
  24. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/DiscoverScreen.kt +137 -0
  25. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/EditProfileScreen.kt +180 -0
  26. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/HomeFeedScreen.kt +157 -0
  27. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/MessagesInboxScreen.kt +85 -0
  28. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/NotificationsScreen.kt +74 -0
  29. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/PostDetailScreen.kt +293 -0
  30. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/ProfileSelfScreen.kt +116 -0
  31. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/SearchResultsScreen.kt +161 -0
  32. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/SettingsScreen.kt +162 -0
  33. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/SettingsStore.kt +95 -0
  34. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/screens/UserProfileScreen.kt +123 -0
  35. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Color.kt +33 -0
  36. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Shape.kt +41 -0
  37. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Spacing.kt +20 -0
  38. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Theme.kt +82 -0
  39. package/examples/social-app/generated/android/social-app/app/src/main/java/com/social/app/ui/theme/Type.kt +60 -0
  40. package/examples/social-app/generated/android/social-app/app/src/main/res/drawable/ic_launcher_foreground.xml +9 -0
  41. package/examples/social-app/generated/android/social-app/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  42. package/examples/social-app/generated/android/social-app/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  43. package/examples/social-app/generated/android/social-app/app/src/main/res/values/strings.xml +91 -0
  44. package/examples/social-app/generated/android/social-app/app/src/main/res/values/themes.xml +10 -0
  45. package/examples/social-app/generated/android/social-app/app/src/main/res/values-ru/strings.xml +79 -0
  46. package/examples/social-app/generated/android/social-app/app/src/main/res/values-uz/strings.xml +79 -0
  47. package/examples/social-app/generated/android/social-app/app/src/main/xml/AndroidManifest.xml +23 -0
  48. package/examples/social-app/generated/android/social-app/build.gradle.kts +6 -0
  49. package/examples/social-app/generated/android/social-app/gradle/libs.versions.toml +48 -0
  50. package/examples/social-app/generated/android/social-app/gradle/wrapper/gradle-wrapper.properties +8 -0
  51. package/examples/social-app/generated/android/social-app/gradle.properties +11 -0
  52. package/examples/social-app/generated/android/social-app/gradlew +25 -0
  53. package/examples/social-app/generated/android/social-app/settings.gradle.kts +23 -0
  54. package/examples/social-app/generated/web/social-app/index.html +12 -0
  55. package/examples/social-app/generated/web/social-app/package-lock.json +2517 -0
  56. package/examples/social-app/generated/web/social-app/package.json +27 -0
  57. package/examples/social-app/generated/web/social-app/src/app/App.tsx +58 -0
  58. package/examples/social-app/generated/web/social-app/src/components/Shell.tsx +247 -0
  59. package/examples/social-app/generated/web/social-app/src/components/cards.tsx +317 -0
  60. package/examples/social-app/generated/web/social-app/src/components/ui.tsx +328 -0
  61. package/examples/social-app/generated/web/social-app/src/flows/CreatePostFlow.tsx +86 -0
  62. package/examples/social-app/generated/web/social-app/src/i18n.tsx +59 -0
  63. package/examples/social-app/generated/web/social-app/src/lib/icons.tsx +85 -0
  64. package/examples/social-app/generated/web/social-app/src/lib/tokens.ts +70 -0
  65. package/examples/social-app/generated/web/social-app/src/lib/utils.ts +97 -0
  66. package/examples/social-app/generated/web/social-app/src/locales/en.json +67 -0
  67. package/examples/social-app/generated/web/social-app/src/locales/ru.json +67 -0
  68. package/examples/social-app/generated/web/social-app/src/locales/uz.json +67 -0
  69. package/examples/social-app/generated/web/social-app/src/main.tsx +16 -0
  70. package/examples/social-app/generated/web/social-app/src/screens/ChatDetailScreen.tsx +90 -0
  71. package/examples/social-app/generated/web/social-app/src/screens/DiscoverScreen.tsx +86 -0
  72. package/examples/social-app/generated/web/social-app/src/screens/EditProfileScreen.tsx +57 -0
  73. package/examples/social-app/generated/web/social-app/src/screens/HomeFeedScreen.tsx +113 -0
  74. package/examples/social-app/generated/web/social-app/src/screens/MessagesInboxScreen.tsx +52 -0
  75. package/examples/social-app/generated/web/social-app/src/screens/NotificationsScreen.tsx +41 -0
  76. package/examples/social-app/generated/web/social-app/src/screens/PostDetailScreen.tsx +115 -0
  77. package/examples/social-app/generated/web/social-app/src/screens/ProfileSelfScreen.tsx +57 -0
  78. package/examples/social-app/generated/web/social-app/src/screens/ProfileUserScreen.tsx +76 -0
  79. package/examples/social-app/generated/web/social-app/src/screens/SearchResultsScreen.tsx +96 -0
  80. package/examples/social-app/generated/web/social-app/src/screens/SettingsScreen.tsx +77 -0
  81. package/examples/social-app/generated/web/social-app/src/state/store.ts +592 -0
  82. package/examples/social-app/generated/web/social-app/src/styles.css +124 -0
  83. package/examples/social-app/generated/web/social-app/src/vite-env.d.ts +1 -0
  84. package/examples/social-app/generated/web/social-app/tsconfig.json +22 -0
  85. package/examples/social-app/generated/web/social-app/tsconfig.node.json +13 -0
  86. package/examples/social-app/generated/web/social-app/tsconfig.node.tsbuildinfo +1 -0
  87. package/examples/social-app/generated/web/social-app/tsconfig.tsbuildinfo +1 -0
  88. package/examples/social-app/generated/web/social-app/vite.config.d.ts +2 -0
  89. package/examples/social-app/generated/web/social-app/vite.config.js +6 -0
  90. package/examples/social-app/generated/web/social-app/vite.config.ts +7 -0
  91. package/examples/social-app/openuispec/README.md +56 -0
  92. package/examples/social-app/openuispec/contracts/.gitkeep +0 -0
  93. package/examples/social-app/openuispec/contracts/action_trigger.yaml +73 -0
  94. package/examples/social-app/openuispec/contracts/collection.yaml +43 -0
  95. package/examples/social-app/openuispec/contracts/data_display.yaml +47 -0
  96. package/examples/social-app/openuispec/contracts/feedback.yaml +49 -0
  97. package/examples/social-app/openuispec/contracts/input_field.yaml +41 -0
  98. package/examples/social-app/openuispec/contracts/nav_container.yaml +34 -0
  99. package/examples/social-app/openuispec/contracts/surface.yaml +41 -0
  100. package/examples/social-app/openuispec/flows/.gitkeep +0 -0
  101. package/examples/social-app/openuispec/flows/create_post.yaml +66 -0
  102. package/examples/social-app/openuispec/locales/.gitkeep +0 -0
  103. package/examples/social-app/openuispec/locales/en.json +67 -0
  104. package/examples/social-app/openuispec/locales/ru.json +67 -0
  105. package/examples/social-app/openuispec/locales/uz.json +67 -0
  106. package/examples/social-app/openuispec/openuispec.yaml +214 -0
  107. package/examples/social-app/openuispec/platform/.gitkeep +0 -0
  108. package/examples/social-app/openuispec/platform/android.yaml +30 -0
  109. package/examples/social-app/openuispec/platform/ios.yaml +19 -0
  110. package/examples/social-app/openuispec/platform/web.yaml +23 -0
  111. package/examples/social-app/openuispec/screens/.gitkeep +0 -0
  112. package/examples/social-app/openuispec/screens/chat_detail.yaml +53 -0
  113. package/examples/social-app/openuispec/screens/discover.yaml +78 -0
  114. package/examples/social-app/openuispec/screens/edit_profile.yaml +78 -0
  115. package/examples/social-app/openuispec/screens/home_feed.yaml +123 -0
  116. package/examples/social-app/openuispec/screens/messages_inbox.yaml +43 -0
  117. package/examples/social-app/openuispec/screens/notifications.yaml +29 -0
  118. package/examples/social-app/openuispec/screens/post_detail.yaml +86 -0
  119. package/examples/social-app/openuispec/screens/profile_self.yaml +53 -0
  120. package/examples/social-app/openuispec/screens/profile_user.yaml +60 -0
  121. package/examples/social-app/openuispec/screens/search_results.yaml +62 -0
  122. package/examples/social-app/openuispec/screens/settings.yaml +94 -0
  123. package/examples/social-app/openuispec/tokens/.gitkeep +0 -0
  124. package/examples/social-app/openuispec/tokens/color.yaml +76 -0
  125. package/examples/social-app/openuispec/tokens/elevation.yaml +31 -0
  126. package/examples/social-app/openuispec/tokens/icons.yaml +147 -0
  127. package/examples/social-app/openuispec/tokens/layout.yaml +37 -0
  128. package/examples/social-app/openuispec/tokens/motion.yaml +28 -0
  129. package/examples/social-app/openuispec/tokens/spacing.yaml +19 -0
  130. package/examples/social-app/openuispec/tokens/themes.yaml +31 -0
  131. package/examples/social-app/openuispec/tokens/typography.yaml +50 -0
  132. package/examples/social-app/package.json +12 -0
  133. package/package.json +1 -1
@@ -0,0 +1,592 @@
1
+ import { create } from "zustand";
2
+ import type { LocaleCode, ThemePreference } from "../lib/tokens";
3
+
4
+ export type User = {
5
+ id: string;
6
+ handle: string;
7
+ displayName: string;
8
+ avatarUrl?: string;
9
+ bio?: string;
10
+ website?: string;
11
+ followers: number;
12
+ following: number;
13
+ isFollowed?: boolean;
14
+ };
15
+
16
+ export type Post = {
17
+ id: string;
18
+ authorId: string;
19
+ body: string;
20
+ mediaUrl?: string;
21
+ mediaType?: "image" | "video";
22
+ likeCount: number;
23
+ commentCount: number;
24
+ publishedAt: string;
25
+ liked?: boolean;
26
+ saved?: boolean;
27
+ tags: string[];
28
+ audience: string;
29
+ };
30
+
31
+ export type Comment = {
32
+ id: string;
33
+ postId: string;
34
+ authorId: string;
35
+ body: string;
36
+ createdAt: string;
37
+ };
38
+
39
+ export type Story = {
40
+ id: string;
41
+ authorId: string;
42
+ previewUrl?: string;
43
+ active: boolean;
44
+ };
45
+
46
+ export type Trend = {
47
+ id: string;
48
+ label: string;
49
+ postCount: number;
50
+ };
51
+
52
+ export type Tag = {
53
+ id: string;
54
+ name: string;
55
+ };
56
+
57
+ export type Conversation = {
58
+ id: string;
59
+ participantIds: string[];
60
+ };
61
+
62
+ export type Message = {
63
+ id: string;
64
+ conversationId: string;
65
+ senderId: string;
66
+ body: string;
67
+ createdAt: string;
68
+ };
69
+
70
+ export type NotificationItem = {
71
+ id: string;
72
+ type: string;
73
+ actorId?: string;
74
+ postId?: string;
75
+ message: string;
76
+ createdAt: string;
77
+ read: boolean;
78
+ };
79
+
80
+ export type Preferences = {
81
+ theme: ThemePreference;
82
+ pushNotifications: boolean;
83
+ messagePreviews: boolean;
84
+ autoTranslate: boolean;
85
+ };
86
+
87
+ type DialogAction = {
88
+ label: string;
89
+ variant?: "secondary" | "destructive" | "primary";
90
+ onPress: () => void;
91
+ };
92
+
93
+ type DialogState = {
94
+ title: string;
95
+ message: string;
96
+ actions: DialogAction[];
97
+ } | null;
98
+
99
+ type ToastState = {
100
+ message: string;
101
+ } | null;
102
+
103
+ type AppState = {
104
+ locale: LocaleCode;
105
+ currentUserId: string;
106
+ users: User[];
107
+ posts: Post[];
108
+ comments: Comment[];
109
+ stories: Story[];
110
+ trends: Trend[];
111
+ tags: Tag[];
112
+ conversations: Conversation[];
113
+ messages: Message[];
114
+ notifications: NotificationItem[];
115
+ preferences: Preferences;
116
+ toast: ToastState;
117
+ dialog: DialogState;
118
+ setLocale: (locale: LocaleCode) => void;
119
+ setThemePreference: (theme: ThemePreference) => void;
120
+ showToast: (message: string) => void;
121
+ clearToast: () => void;
122
+ openDialog: (dialog: Exclude<DialogState, null>) => void;
123
+ closeDialog: () => void;
124
+ toggleLike: (postId: string) => void;
125
+ toggleSave: (postId: string) => void;
126
+ createPost: (input: { body: string; media: string; audience: string }) => string;
127
+ addComment: (postId: string, body: string) => void;
128
+ updateProfile: (input: { displayName: string; handle: string; bio: string; website: string }) => void;
129
+ followUser: (userId: string) => void;
130
+ sendMessage: (conversationId: string, body: string) => void;
131
+ markNotificationRead: (notificationId: string) => void;
132
+ updatePreference: <K extends keyof Preferences>(key: K, value: Preferences[K]) => void;
133
+ logout: () => void;
134
+ };
135
+
136
+ function minutesAgo(value: number) {
137
+ return new Date(Date.now() - value * 60 * 1000).toISOString();
138
+ }
139
+
140
+ function hoursAgo(value: number) {
141
+ return new Date(Date.now() - value * 60 * 60 * 1000).toISOString();
142
+ }
143
+
144
+ function daysAgo(value: number) {
145
+ return new Date(Date.now() - value * 24 * 60 * 60 * 1000).toISOString();
146
+ }
147
+
148
+ function makeId(prefix: string) {
149
+ return `${prefix}-${Math.random().toString(36).slice(2, 8)}`;
150
+ }
151
+
152
+ const seedUsers: User[] = [
153
+ {
154
+ id: "user-me",
155
+ handle: "rustam",
156
+ displayName: "Rustam Abdurahmonov",
157
+ avatarUrl: "https://images.unsplash.com/photo-1500648767791-00dcc994a43e?auto=format&fit=crop&w=320&q=80",
158
+ bio: "Designing interface systems that feel editorial, human, and alive.",
159
+ website: "https://example.com",
160
+ followers: 1240,
161
+ following: 184,
162
+ },
163
+ {
164
+ id: "user-lina",
165
+ handle: "linaframes",
166
+ displayName: "Lina Morales",
167
+ avatarUrl: "https://images.unsplash.com/photo-1494790108377-be9c29b29330?auto=format&fit=crop&w=320&q=80",
168
+ bio: "Photographer collecting small city rituals and late-night color palettes.",
169
+ website: "https://lina.example.com",
170
+ followers: 18920,
171
+ following: 502,
172
+ isFollowed: true,
173
+ },
174
+ {
175
+ id: "user-yuki",
176
+ handle: "yuki.codes",
177
+ displayName: "Yuki Tan",
178
+ avatarUrl: "https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?auto=format&fit=crop&w=320&q=80",
179
+ bio: "Front-end engineer obsessed with motion systems, type, and tiny details.",
180
+ website: "https://yuki.example.com",
181
+ followers: 9540,
182
+ following: 121,
183
+ },
184
+ {
185
+ id: "user-samira",
186
+ handle: "samirastudio",
187
+ displayName: "Samira Noor",
188
+ avatarUrl: "https://images.unsplash.com/photo-1438761681033-6461ffad8d80?auto=format&fit=crop&w=320&q=80",
189
+ bio: "Creative director building warm digital products for cultural brands.",
190
+ website: "https://samira.example.com",
191
+ followers: 30210,
192
+ following: 86,
193
+ isFollowed: true,
194
+ },
195
+ ];
196
+
197
+ const seedPosts: Post[] = [
198
+ {
199
+ id: "post-1",
200
+ authorId: "user-lina",
201
+ body: "Spent the morning photographing a cafe before it opened. The cups were already warm, the chairs still slightly crooked. Those in-between moments always feel the most honest.",
202
+ mediaUrl: "https://images.unsplash.com/photo-1495474472287-4d71bcdd2085?auto=format&fit=crop&w=1200&q=80",
203
+ mediaType: "image",
204
+ likeCount: 243,
205
+ commentCount: 12,
206
+ publishedAt: hoursAgo(4),
207
+ liked: true,
208
+ saved: false,
209
+ tags: ["coffee", "photojournal"],
210
+ audience: "public",
211
+ },
212
+ {
213
+ id: "post-2",
214
+ authorId: "user-yuki",
215
+ body: "A small interaction detail I keep coming back to: buttons that feel directional. Diagonal corners create a subtle sense of movement before anything even animates.",
216
+ mediaUrl: "https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1200&q=80",
217
+ mediaType: "image",
218
+ likeCount: 189,
219
+ commentCount: 29,
220
+ publishedAt: hoursAgo(9),
221
+ liked: false,
222
+ saved: true,
223
+ tags: ["ui", "motion"],
224
+ audience: "public",
225
+ },
226
+ {
227
+ id: "post-3",
228
+ authorId: "user-me",
229
+ body: "Prototype of a warm-tone social feed. I wanted the interface to feel like printed paper meeting live conversation.",
230
+ mediaUrl: "https://images.unsplash.com/photo-1516321497487-e288fb19713f?auto=format&fit=crop&w=1200&q=80",
231
+ mediaType: "image",
232
+ likeCount: 76,
233
+ commentCount: 7,
234
+ publishedAt: daysAgo(1),
235
+ liked: false,
236
+ saved: false,
237
+ tags: ["prototype", "social"],
238
+ audience: "followers",
239
+ },
240
+ {
241
+ id: "post-4",
242
+ authorId: "user-samira",
243
+ body: "The brand workshop rule today: if the interface can be described as 'clean' and nothing else, it's probably unfinished.",
244
+ mediaUrl: "https://images.unsplash.com/photo-1524758631624-e2822e304c36?auto=format&fit=crop&w=1200&q=80",
245
+ mediaType: "image",
246
+ likeCount: 512,
247
+ commentCount: 61,
248
+ publishedAt: daysAgo(2),
249
+ liked: false,
250
+ saved: true,
251
+ tags: ["branding", "critique"],
252
+ audience: "public",
253
+ },
254
+ {
255
+ id: "post-5",
256
+ authorId: "user-lina",
257
+ body: "Testing a grid of street signs for an upcoming print set. The typography in the wild is still the best teacher.",
258
+ mediaUrl: "https://images.unsplash.com/photo-1487014679447-9f8336841d58?auto=format&fit=crop&w=1200&q=80",
259
+ mediaType: "image",
260
+ likeCount: 134,
261
+ commentCount: 18,
262
+ publishedAt: daysAgo(3),
263
+ liked: true,
264
+ saved: true,
265
+ tags: ["typography", "street"],
266
+ audience: "public",
267
+ },
268
+ ];
269
+
270
+ const seedComments: Comment[] = [
271
+ { id: "comment-1", postId: "post-1", authorId: "user-yuki", body: "That crooked-chair detail is perfect.", createdAt: hoursAgo(3) },
272
+ { id: "comment-2", postId: "post-1", authorId: "user-me", body: "You always make spaces feel cinematic.", createdAt: hoursAgo(2) },
273
+ { id: "comment-3", postId: "post-2", authorId: "user-samira", body: "Exactly. Shape language carries tone before copy does.", createdAt: hoursAgo(5) },
274
+ ];
275
+
276
+ const seedStories: Story[] = [
277
+ { id: "post-1", authorId: "user-lina", previewUrl: seedPosts[0].mediaUrl, active: true },
278
+ { id: "post-2", authorId: "user-yuki", previewUrl: seedPosts[1].mediaUrl, active: true },
279
+ { id: "post-4", authorId: "user-samira", previewUrl: seedPosts[3].mediaUrl, active: true },
280
+ { id: "post-3", authorId: "user-me", previewUrl: seedPosts[2].mediaUrl, active: true },
281
+ ];
282
+
283
+ const seedTrends: Trend[] = [
284
+ { id: "trend-1", label: "Editorial UI", postCount: 8420 },
285
+ { id: "trend-2", label: "Warm Brutalism", postCount: 4135 },
286
+ { id: "trend-3", label: "Motion Details", postCount: 2940 },
287
+ { id: "trend-4", label: "Design Systems", postCount: 8677 },
288
+ ];
289
+
290
+ const seedTags: Tag[] = [
291
+ { id: "tag-1", name: "socialui" },
292
+ { id: "tag-2", name: "motionlanguage" },
293
+ { id: "tag-3", name: "warmminimalism" },
294
+ { id: "tag-4", name: "designcrit" },
295
+ { id: "tag-5", name: "feedpatterns" },
296
+ ];
297
+
298
+ const seedConversations: Conversation[] = [
299
+ { id: "conversation-1", participantIds: ["user-me", "user-lina"] },
300
+ { id: "conversation-2", participantIds: ["user-me", "user-yuki"] },
301
+ { id: "conversation-3", participantIds: ["user-me", "user-samira"] },
302
+ ];
303
+
304
+ const seedMessages: Message[] = [
305
+ { id: "message-1", conversationId: "conversation-1", senderId: "user-lina", body: "Can you send the type ramp screenshot?", createdAt: hoursAgo(6) },
306
+ { id: "message-2", conversationId: "conversation-1", senderId: "user-me", body: "Uploading it now. The mobile spacing changed a bit too.", createdAt: hoursAgo(5) },
307
+ { id: "message-3", conversationId: "conversation-2", senderId: "user-yuki", body: "The diagonal buttons are a strong move. Keep them.", createdAt: hoursAgo(12) },
308
+ { id: "message-4", conversationId: "conversation-3", senderId: "user-samira", body: "Let's review the brand deck tomorrow afternoon.", createdAt: daysAgo(1) },
309
+ ];
310
+
311
+ const seedNotifications: NotificationItem[] = [
312
+ { id: "notification-1", type: "like", actorId: "user-lina", postId: "post-3", message: "liked your post", createdAt: minutesAgo(34), read: false },
313
+ { id: "notification-2", type: "comment", actorId: "user-yuki", postId: "post-3", message: "commented on your post", createdAt: hoursAgo(7), read: false },
314
+ { id: "notification-3", type: "follow", actorId: "user-samira", message: "started following you", createdAt: daysAgo(1), read: true },
315
+ ];
316
+
317
+ const seedPreferences: Preferences = {
318
+ theme: "system",
319
+ pushNotifications: true,
320
+ messagePreviews: true,
321
+ autoTranslate: false,
322
+ };
323
+
324
+ export const useAppStore = create<AppState>((set, get) => ({
325
+ locale: "en",
326
+ currentUserId: "user-me",
327
+ users: seedUsers,
328
+ posts: seedPosts,
329
+ comments: seedComments,
330
+ stories: seedStories,
331
+ trends: seedTrends,
332
+ tags: seedTags,
333
+ conversations: seedConversations,
334
+ messages: seedMessages,
335
+ notifications: seedNotifications,
336
+ preferences: seedPreferences,
337
+ toast: null,
338
+ dialog: null,
339
+ setLocale: (locale) => set({ locale }),
340
+ setThemePreference: (theme) => set((state) => ({ preferences: { ...state.preferences, theme } })),
341
+ showToast: (message) => set({ toast: { message } }),
342
+ clearToast: () => set({ toast: null }),
343
+ openDialog: (dialog) => set({ dialog }),
344
+ closeDialog: () => set({ dialog: null }),
345
+ toggleLike: (postId) =>
346
+ set((state) => ({
347
+ posts: state.posts.map((post) =>
348
+ post.id === postId
349
+ ? {
350
+ ...post,
351
+ liked: !post.liked,
352
+ likeCount: post.likeCount + (post.liked ? -1 : 1),
353
+ }
354
+ : post,
355
+ ),
356
+ })),
357
+ toggleSave: (postId) =>
358
+ set((state) => ({
359
+ posts: state.posts.map((post) => (post.id === postId ? { ...post, saved: !post.saved } : post)),
360
+ })),
361
+ createPost: ({ body, media, audience }) => {
362
+ const id = makeId("post");
363
+ set((state) => ({
364
+ posts: [
365
+ {
366
+ id,
367
+ authorId: state.currentUserId,
368
+ body,
369
+ mediaUrl: media || undefined,
370
+ mediaType: media ? "image" : undefined,
371
+ likeCount: 0,
372
+ commentCount: 0,
373
+ publishedAt: new Date().toISOString(),
374
+ liked: false,
375
+ saved: false,
376
+ tags: body
377
+ .split(/\s+/)
378
+ .filter((chunk) => chunk.startsWith("#"))
379
+ .map((chunk) => chunk.replace("#", "").toLowerCase()),
380
+ audience,
381
+ },
382
+ ...state.posts,
383
+ ],
384
+ }));
385
+ return id;
386
+ },
387
+ addComment: (postId, body) =>
388
+ set((state) => ({
389
+ comments: [
390
+ ...state.comments,
391
+ { id: makeId("comment"), postId, authorId: state.currentUserId, body, createdAt: new Date().toISOString() },
392
+ ],
393
+ posts: state.posts.map((post) => (post.id === postId ? { ...post, commentCount: post.commentCount + 1 } : post)),
394
+ })),
395
+ updateProfile: ({ displayName, handle, bio, website }) =>
396
+ set((state) => ({
397
+ users: state.users.map((user) =>
398
+ user.id === state.currentUserId ? { ...user, displayName, handle, bio, website } : user,
399
+ ),
400
+ })),
401
+ followUser: (userId) =>
402
+ set((state) => ({
403
+ users: state.users.map((user) =>
404
+ user.id === userId
405
+ ? {
406
+ ...user,
407
+ isFollowed: !user.isFollowed,
408
+ followers: user.followers + (user.isFollowed ? -1 : 1),
409
+ }
410
+ : user,
411
+ ),
412
+ })),
413
+ sendMessage: (conversationId, body) =>
414
+ set((state) => ({
415
+ messages: [
416
+ ...state.messages,
417
+ { id: makeId("message"), conversationId, senderId: state.currentUserId, body, createdAt: new Date().toISOString() },
418
+ ],
419
+ })),
420
+ markNotificationRead: (notificationId) =>
421
+ set((state) => ({
422
+ notifications: state.notifications.map((item) => (item.id === notificationId ? { ...item, read: true } : item)),
423
+ })),
424
+ updatePreference: (key, value) =>
425
+ set((state) => ({
426
+ preferences: { ...state.preferences, [key]: value },
427
+ })),
428
+ logout: () => {
429
+ get().showToast("Local session cleared.");
430
+ },
431
+ }));
432
+
433
+ export function selectCurrentUser(state: AppState) {
434
+ return state.users.find((user) => user.id === state.currentUserId) ?? state.users[0];
435
+ }
436
+
437
+ export function selectUserById(state: AppState, userId: string) {
438
+ return state.users.find((user) => user.id === userId);
439
+ }
440
+
441
+ export function selectFeed(state: AppState, filter: "all" | "following" | "popular", search: string) {
442
+ const lowered = search.trim().toLowerCase();
443
+ return state.posts
444
+ .filter((post) => {
445
+ if (filter === "following") {
446
+ const author = selectUserById(state, post.authorId);
447
+ return author?.isFollowed || post.authorId === state.currentUserId;
448
+ }
449
+ if (filter === "popular") {
450
+ return post.likeCount >= 150;
451
+ }
452
+ return true;
453
+ })
454
+ .filter((post) => {
455
+ if (!lowered) {
456
+ return true;
457
+ }
458
+ const author = selectUserById(state, post.authorId);
459
+ return (
460
+ post.body.toLowerCase().includes(lowered) ||
461
+ author?.displayName.toLowerCase().includes(lowered) ||
462
+ post.tags.some((tag) => tag.includes(lowered))
463
+ );
464
+ });
465
+ }
466
+
467
+ export function selectStories(state: AppState) {
468
+ return state.stories
469
+ .filter((story) => story.active)
470
+ .map((story) => ({
471
+ ...story,
472
+ author: selectUserById(state, story.authorId),
473
+ }))
474
+ .filter((story) => story.author);
475
+ }
476
+
477
+ export function selectPostById(state: AppState, postId: string) {
478
+ return state.posts.find((post) => post.id === postId);
479
+ }
480
+
481
+ export function selectCommentsByPost(state: AppState, postId: string) {
482
+ return state.comments.filter((comment) => comment.postId === postId);
483
+ }
484
+
485
+ export function selectProfilePosts(state: AppState, userId: string) {
486
+ return state.posts.filter((post) => post.authorId === userId);
487
+ }
488
+
489
+ export function selectConversationById(state: AppState, conversationId: string) {
490
+ return state.conversations.find((conversation) => conversation.id === conversationId);
491
+ }
492
+
493
+ export function selectMessagesByConversation(state: AppState, conversationId: string) {
494
+ return state.messages.filter((message) => message.conversationId === conversationId);
495
+ }
496
+
497
+ export function selectConversations(state: AppState, search: string) {
498
+ const lowered = search.trim().toLowerCase();
499
+ return state.conversations
500
+ .map((conversation) => {
501
+ const participant = state.users.find(
502
+ (user) => conversation.participantIds.includes(user.id) && user.id !== state.currentUserId,
503
+ );
504
+ const messages = selectMessagesByConversation(state, conversation.id);
505
+ const lastMessage = messages[messages.length - 1];
506
+ const unreadCount =
507
+ lastMessage && lastMessage.senderId !== state.currentUserId ? Math.min(2, messages.length) : 0;
508
+ return { conversation, participant, lastMessage, unreadCount };
509
+ })
510
+ .filter((item) => item.participant)
511
+ .filter((item) => {
512
+ if (!lowered) {
513
+ return true;
514
+ }
515
+ return (
516
+ item.participant?.displayName.toLowerCase().includes(lowered) ||
517
+ item.lastMessage?.body.toLowerCase().includes(lowered)
518
+ );
519
+ });
520
+ }
521
+
522
+ export function selectNotifications(state: AppState) {
523
+ return state.notifications.map((notification) => ({
524
+ ...notification,
525
+ actor: notification.actorId ? selectUserById(state, notification.actorId) : undefined,
526
+ }));
527
+ }
528
+
529
+ export function selectUnreadNotifications(state: AppState) {
530
+ return state.notifications.filter((item) => !item.read).length;
531
+ }
532
+
533
+ export function selectDiscoverCreators(state: AppState) {
534
+ return state.users.filter((user) => user.id !== state.currentUserId);
535
+ }
536
+
537
+ export function selectSearchResults(state: AppState, query: string, tab: "posts" | "people" | "tags") {
538
+ const lowered = query.trim().toLowerCase();
539
+ if (!lowered) {
540
+ return [];
541
+ }
542
+
543
+ if (tab === "people") {
544
+ return state.users
545
+ .filter(
546
+ (user) =>
547
+ user.displayName.toLowerCase().includes(lowered) || user.handle.toLowerCase().includes(lowered),
548
+ )
549
+ .map((user) => ({
550
+ id: user.id,
551
+ title: user.displayName,
552
+ subtitle: `@${user.handle}`,
553
+ body: user.bio ?? "",
554
+ avatarUrl: user.avatarUrl,
555
+ kind: "people" as const,
556
+ }));
557
+ }
558
+
559
+ if (tab === "tags") {
560
+ return state.tags
561
+ .filter((tag) => tag.name.toLowerCase().includes(lowered))
562
+ .map((tag) => {
563
+ const relatedPost = state.posts.find((post) => post.tags.includes(tag.name)) ?? state.posts[0];
564
+ return {
565
+ id: relatedPost.id,
566
+ title: `#${tag.name}`,
567
+ subtitle: "Tag",
568
+ body: `Browse posts connected to #${tag.name}.`,
569
+ avatarUrl: undefined,
570
+ kind: "tags" as const,
571
+ };
572
+ });
573
+ }
574
+
575
+ return state.posts
576
+ .filter(
577
+ (post) =>
578
+ post.body.toLowerCase().includes(lowered) ||
579
+ post.tags.some((tag) => tag.toLowerCase().includes(lowered)),
580
+ )
581
+ .map((post) => {
582
+ const author = selectUserById(state, post.authorId);
583
+ return {
584
+ id: post.id,
585
+ title: author?.displayName ?? "Unknown",
586
+ subtitle: author ? `@${author.handle}` : "",
587
+ body: post.body,
588
+ avatarUrl: author?.avatarUrl,
589
+ kind: "posts" as const,
590
+ };
591
+ });
592
+ }
@@ -0,0 +1,124 @@
1
+ @import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap");
2
+ @import "tailwindcss";
3
+
4
+ :root {
5
+ --font-sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
6
+ --color-brand-primary: #1c1b1a;
7
+ --color-brand-primary-on: #ffffff;
8
+ --color-brand-accent: #5b52a3;
9
+ --color-brand-accent-on: #ffffff;
10
+ --color-surface-primary: #faf8f5;
11
+ --color-surface-secondary: #f3f0eb;
12
+ --color-surface-tertiary: #ebe7e0;
13
+ --color-text-primary: #1c1b1a;
14
+ --color-text-secondary: #6b6966;
15
+ --color-text-tertiary: #9e9a95;
16
+ --color-border-default: #e0dcd6;
17
+ --color-border-strong: #c5c0b8;
18
+ --color-semantic-danger: #d43b3b;
19
+ color-scheme: light;
20
+ }
21
+
22
+ :root[data-theme="dark"] {
23
+ --color-surface-primary: #1c1b1a;
24
+ --color-surface-secondary: #262422;
25
+ --color-surface-tertiary: #34312d;
26
+ --color-text-primary: #faf8f5;
27
+ --color-text-secondary: #c1bab0;
28
+ --color-text-tertiary: #8c847b;
29
+ --color-border-default: rgba(224, 220, 214, 0.12);
30
+ --color-border-strong: rgba(224, 220, 214, 0.24);
31
+ color-scheme: dark;
32
+ }
33
+
34
+ @theme inline {
35
+ --font-family-sans: var(--font-sans);
36
+ }
37
+
38
+ html,
39
+ body,
40
+ #root {
41
+ min-height: 100%;
42
+ }
43
+
44
+ body {
45
+ margin: 0;
46
+ font-family: var(--font-sans);
47
+ background:
48
+ radial-gradient(circle at top left, rgba(91, 82, 163, 0.08), transparent 28%),
49
+ linear-gradient(180deg, rgba(250, 248, 245, 0.8), rgba(250, 248, 245, 1));
50
+ color: var(--color-text-primary);
51
+ }
52
+
53
+ a {
54
+ color: inherit;
55
+ text-decoration: none;
56
+ }
57
+
58
+ button,
59
+ input,
60
+ select,
61
+ textarea {
62
+ font: inherit;
63
+ }
64
+
65
+ .rounded-cap-primary {
66
+ border-radius: 2px 24px 2px 24px;
67
+ }
68
+
69
+ .rounded-cap-alternate {
70
+ border-radius: 24px 2px 24px 2px;
71
+ }
72
+
73
+ .rounded-card {
74
+ border-radius: 3px 20px 3px 20px;
75
+ }
76
+
77
+ .rounded-surface {
78
+ border-radius: 3px 24px 3px 24px;
79
+ }
80
+
81
+ .interactive-press {
82
+ transition:
83
+ transform 200ms ease-out,
84
+ background-color 200ms ease-out,
85
+ border-color 200ms ease-out,
86
+ color 200ms ease-out;
87
+ }
88
+
89
+ .interactive-press:active {
90
+ transform: scale(0.98);
91
+ }
92
+
93
+ .skeleton {
94
+ position: relative;
95
+ overflow: hidden;
96
+ }
97
+
98
+ .skeleton::after {
99
+ position: absolute;
100
+ inset: 0;
101
+ transform: translateX(-100%);
102
+ background: linear-gradient(
103
+ 90deg,
104
+ transparent,
105
+ rgba(255, 255, 255, 0.45),
106
+ transparent
107
+ );
108
+ animation: skeleton-shimmer 1.4s ease-out infinite;
109
+ content: "";
110
+ }
111
+
112
+ .no-scrollbar {
113
+ scrollbar-width: none;
114
+ }
115
+
116
+ .no-scrollbar::-webkit-scrollbar {
117
+ display: none;
118
+ }
119
+
120
+ @keyframes skeleton-shimmer {
121
+ 100% {
122
+ transform: translateX(100%);
123
+ }
124
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />