vibefast-cli 0.1.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.
Files changed (250) hide show
  1. package/FINAL-STATUS.md +144 -0
  2. package/HOW-IT-WORKS.md +559 -0
  3. package/PLAN.md +453 -0
  4. package/README.md +129 -0
  5. package/RECIPES-READY.md +172 -0
  6. package/STATUS.md +199 -0
  7. package/SUCCESS.md +259 -0
  8. package/TESTING-CHECKLIST.md +450 -0
  9. package/cloudflare-worker/.wrangler/state/v3/kv/64907821e2634080acce34618d2f3d4c/blobs/11f2769953c717e188062bc644da97c1fd1e4d6d0813a226ce7567dba759afab0000019a736fb8d4 +1 -0
  10. package/cloudflare-worker/.wrangler/state/v3/kv/miniflare-KVNamespaceObject/0b03767237c0408301af51ca35d4b09470cbc479c7e5f23cc9de774749d23c59.sqlite +0 -0
  11. package/cloudflare-worker/.wrangler/state/v3/kv/miniflare-KVNamespaceObject/0b03767237c0408301af51ca35d4b09470cbc479c7e5f23cc9de774749d23c59.sqlite-shm +0 -0
  12. package/cloudflare-worker/.wrangler/state/v3/kv/miniflare-KVNamespaceObject/0b03767237c0408301af51ca35d4b09470cbc479c7e5f23cc9de774749d23c59.sqlite-wal +0 -0
  13. package/cloudflare-worker/.wrangler/state/v3/r2/miniflare-R2BucketObject/d1cc388a1a0ef44dd5669fd1a165d168b61362136c8b5fa50aefd96c72688e54.sqlite +0 -0
  14. package/cloudflare-worker/.wrangler/state/v3/r2/miniflare-R2BucketObject/d1cc388a1a0ef44dd5669fd1a165d168b61362136c8b5fa50aefd96c72688e54.sqlite-shm +0 -0
  15. package/cloudflare-worker/.wrangler/state/v3/r2/miniflare-R2BucketObject/d1cc388a1a0ef44dd5669fd1a165d168b61362136c8b5fa50aefd96c72688e54.sqlite-wal +0 -0
  16. package/cloudflare-worker/.wrangler/state/v3/r2/vibefast-recipes/blobs/620e8cf7c35d9806da25dee237e1d7e8b2432bd98f755b60e2c7f08a48d2c7b90000019a73736484 +0 -0
  17. package/cloudflare-worker/MIGRATION.md +160 -0
  18. package/cloudflare-worker/QUICKSTART.md +200 -0
  19. package/cloudflare-worker/README.md +242 -0
  20. package/cloudflare-worker/generate-token.js +32 -0
  21. package/cloudflare-worker/mini-native@latest.zip +0 -0
  22. package/cloudflare-worker/setup.sh +143 -0
  23. package/cloudflare-worker/test-recipe/apps/native/src/app/mini/index.tsx +15 -0
  24. package/cloudflare-worker/test-recipe/recipe.json +16 -0
  25. package/cloudflare-worker/worker.js +308 -0
  26. package/cloudflare-worker/wrangler.toml +13 -0
  27. package/dist/commands/add.d.ts +3 -0
  28. package/dist/commands/add.d.ts.map +1 -0
  29. package/dist/commands/add.js +149 -0
  30. package/dist/commands/add.js.map +1 -0
  31. package/dist/commands/devices.d.ts +3 -0
  32. package/dist/commands/devices.d.ts.map +1 -0
  33. package/dist/commands/devices.js +35 -0
  34. package/dist/commands/devices.js.map +1 -0
  35. package/dist/commands/doctor.d.ts +3 -0
  36. package/dist/commands/doctor.d.ts.map +1 -0
  37. package/dist/commands/doctor.js +67 -0
  38. package/dist/commands/doctor.js.map +1 -0
  39. package/dist/commands/list.d.ts +3 -0
  40. package/dist/commands/list.d.ts.map +1 -0
  41. package/dist/commands/list.js +40 -0
  42. package/dist/commands/list.js.map +1 -0
  43. package/dist/commands/login.d.ts +3 -0
  44. package/dist/commands/login.d.ts.map +1 -0
  45. package/dist/commands/login.js +23 -0
  46. package/dist/commands/login.js.map +1 -0
  47. package/dist/commands/logout.d.ts +3 -0
  48. package/dist/commands/logout.d.ts.map +1 -0
  49. package/dist/commands/logout.js +16 -0
  50. package/dist/commands/logout.js.map +1 -0
  51. package/dist/commands/remove.d.ts +3 -0
  52. package/dist/commands/remove.d.ts.map +1 -0
  53. package/dist/commands/remove.js +67 -0
  54. package/dist/commands/remove.js.map +1 -0
  55. package/dist/core/__tests__/journal.test.d.ts +2 -0
  56. package/dist/core/__tests__/journal.test.d.ts.map +1 -0
  57. package/dist/core/__tests__/journal.test.js +101 -0
  58. package/dist/core/__tests__/journal.test.js.map +1 -0
  59. package/dist/core/__tests__/validate.test.d.ts +2 -0
  60. package/dist/core/__tests__/validate.test.d.ts.map +1 -0
  61. package/dist/core/__tests__/validate.test.js +53 -0
  62. package/dist/core/__tests__/validate.test.js.map +1 -0
  63. package/dist/core/archive.d.ts +2 -0
  64. package/dist/core/archive.d.ts.map +1 -0
  65. package/dist/core/archive.js +59 -0
  66. package/dist/core/archive.js.map +1 -0
  67. package/dist/core/auth.d.ts +15 -0
  68. package/dist/core/auth.d.ts.map +1 -0
  69. package/dist/core/auth.js +76 -0
  70. package/dist/core/auth.js.map +1 -0
  71. package/dist/core/codemod.d.ts +20 -0
  72. package/dist/core/codemod.d.ts.map +1 -0
  73. package/dist/core/codemod.js +150 -0
  74. package/dist/core/codemod.js.map +1 -0
  75. package/dist/core/fsx.d.ts +12 -0
  76. package/dist/core/fsx.d.ts.map +1 -0
  77. package/dist/core/fsx.js +70 -0
  78. package/dist/core/fsx.js.map +1 -0
  79. package/dist/core/http.d.ts +30 -0
  80. package/dist/core/http.d.ts.map +1 -0
  81. package/dist/core/http.js +95 -0
  82. package/dist/core/http.js.map +1 -0
  83. package/dist/core/journal.d.ts +18 -0
  84. package/dist/core/journal.d.ts.map +1 -0
  85. package/dist/core/journal.js +34 -0
  86. package/dist/core/journal.js.map +1 -0
  87. package/dist/core/log.d.ts +8 -0
  88. package/dist/core/log.d.ts.map +1 -0
  89. package/dist/core/log.js +9 -0
  90. package/dist/core/log.js.map +1 -0
  91. package/dist/core/pathGuard.d.ts +3 -0
  92. package/dist/core/pathGuard.d.ts.map +1 -0
  93. package/dist/core/pathGuard.js +18 -0
  94. package/dist/core/pathGuard.js.map +1 -0
  95. package/dist/core/paths.d.ts +11 -0
  96. package/dist/core/paths.d.ts.map +1 -0
  97. package/dist/core/paths.js +22 -0
  98. package/dist/core/paths.js.map +1 -0
  99. package/dist/core/validate.d.ts +8 -0
  100. package/dist/core/validate.d.ts.map +1 -0
  101. package/dist/core/validate.js +27 -0
  102. package/dist/core/validate.js.map +1 -0
  103. package/dist/index.d.ts +3 -0
  104. package/dist/index.d.ts.map +1 -0
  105. package/dist/index.js +23 -0
  106. package/dist/index.js.map +1 -0
  107. package/docs/decisions.md +55 -0
  108. package/package.json +39 -0
  109. package/recipes/audio-recorder/apps/native/src/app/audio-recorder/index.tsx +5 -0
  110. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/components/audio-player.tsx +301 -0
  111. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/components/audio-recorder.tsx +373 -0
  112. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/components/audio-waveform.tsx +270 -0
  113. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/components/index.ts +4 -0
  114. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/components/recording-list.tsx +89 -0
  115. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/audio-player-demo.tsx +66 -0
  116. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/audio-recorder-cloud.tsx +68 -0
  117. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/audio-recorder-interview.tsx +102 -0
  118. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/basic.tsx +27 -0
  119. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/index.ts +5 -0
  120. package/recipes/audio-recorder/apps/native/src/features/audio-recorder/demo/with-recording-list-demo.tsx +82 -0
  121. package/recipes/audio-recorder/recipe.json +22 -0
  122. package/recipes/audio-recorder@latest.zip +0 -0
  123. package/recipes/charts/apps/native/src/app/charts/index.tsx +3 -0
  124. package/recipes/charts/apps/native/src/features/charts/README.md +185 -0
  125. package/recipes/charts/apps/native/src/features/charts/app/preview.tsx +223 -0
  126. package/recipes/charts/apps/native/src/features/charts/components/area-chart.tsx +40 -0
  127. package/recipes/charts/apps/native/src/features/charts/components/bar-chart.tsx +143 -0
  128. package/recipes/charts/apps/native/src/features/charts/components/candlestick-chart.tsx +196 -0
  129. package/recipes/charts/apps/native/src/features/charts/components/chart-card.tsx +65 -0
  130. package/recipes/charts/apps/native/src/features/charts/components/column-chart.tsx +143 -0
  131. package/recipes/charts/apps/native/src/features/charts/components/doughnut-chart.tsx +246 -0
  132. package/recipes/charts/apps/native/src/features/charts/components/index.ts +10 -0
  133. package/recipes/charts/apps/native/src/features/charts/components/line-chart.tsx +308 -0
  134. package/recipes/charts/apps/native/src/features/charts/components/radar-chart.tsx +180 -0
  135. package/recipes/charts/apps/native/src/features/charts/components/radial-bar-chart.tsx +188 -0
  136. package/recipes/charts/apps/native/src/features/charts/components/stacked-area-chart.tsx +265 -0
  137. package/recipes/charts/apps/native/src/features/charts/components/stacked-bar-chart.tsx +322 -0
  138. package/recipes/charts/apps/native/src/features/charts/data/mock-data.ts +183 -0
  139. package/recipes/charts/apps/native/src/features/charts/types/index.ts +66 -0
  140. package/recipes/charts/recipe.json +22 -0
  141. package/recipes/charts@latest.zip +0 -0
  142. package/recipes/chatbot/apps/native/src/app/chatbot/index.tsx +1 -0
  143. package/recipes/chatbot/apps/native/src/features/chatbot/app/index.tsx +302 -0
  144. package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-header-buttons.tsx +59 -0
  145. package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-input-bar.tsx +469 -0
  146. package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-markdown.tsx +575 -0
  147. package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-message-bubble.tsx +246 -0
  148. package/recipes/chatbot/apps/native/src/features/chatbot/components/chat-settings-modal.tsx +161 -0
  149. package/recipes/chatbot/apps/native/src/features/chatbot/components/image-preview-list.tsx +115 -0
  150. package/recipes/chatbot/apps/native/src/features/chatbot/components/markdown/code-block.tsx +165 -0
  151. package/recipes/chatbot/apps/native/src/features/chatbot/components/markdown/index.ts +10 -0
  152. package/recipes/chatbot/apps/native/src/features/chatbot/components/markdown/table-renderer.tsx +129 -0
  153. package/recipes/chatbot/apps/native/src/features/chatbot/components/message-error-boundary.tsx +78 -0
  154. package/recipes/chatbot/apps/native/src/features/chatbot/components/message-list.tsx +173 -0
  155. package/recipes/chatbot/apps/native/src/features/chatbot/components/model-selector.tsx +283 -0
  156. package/recipes/chatbot/apps/native/src/features/chatbot/components/report-content-modal.tsx +188 -0
  157. package/recipes/chatbot/apps/native/src/features/chatbot/components/suggested-messages.tsx +67 -0
  158. package/recipes/chatbot/apps/native/src/features/chatbot/constants/models.ts +20 -0
  159. package/recipes/chatbot/apps/native/src/features/chatbot/constants/report-reasons.ts +9 -0
  160. package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-attachment-cache.ts +143 -0
  161. package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-chat-config.ts +664 -0
  162. package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-chat-handlers.ts +359 -0
  163. package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-chatbot-settings.ts +89 -0
  164. package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-conversation.ts +79 -0
  165. package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-image-picker.ts +122 -0
  166. package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-keyboard-coordinator.ts +161 -0
  167. package/recipes/chatbot/apps/native/src/features/chatbot/hooks/use-smart-scroll-manager.ts +207 -0
  168. package/recipes/chatbot/apps/native/src/features/chatbot/models/index.ts +86 -0
  169. package/recipes/chatbot/apps/native/src/features/chatbot/models/models.ts +162 -0
  170. package/recipes/chatbot/apps/native/src/features/chatbot/models/providers.ts +62 -0
  171. package/recipes/chatbot/apps/native/src/features/chatbot/models/types.ts +40 -0
  172. package/recipes/chatbot/apps/native/src/features/chatbot/services/file-uploader.ts +238 -0
  173. package/recipes/chatbot/apps/native/src/features/chatbot/services/message-handler-service.ts +180 -0
  174. package/recipes/chatbot/apps/native/src/features/chatbot/types/index.ts +60 -0
  175. package/recipes/chatbot/apps/native/src/features/chatbot/utils/chat-telemetry.ts +91 -0
  176. package/recipes/chatbot/recipe.json +22 -0
  177. package/recipes/chatbot@latest.zip +0 -0
  178. package/recipes/image-generator/apps/native/src/app/image-generator/gallery.tsx +3 -0
  179. package/recipes/image-generator/apps/native/src/app/image-generator/index.tsx +3 -0
  180. package/recipes/image-generator/apps/native/src/features/image-generator/app/_layout.tsx +25 -0
  181. package/recipes/image-generator/apps/native/src/features/image-generator/app/gallery.tsx +217 -0
  182. package/recipes/image-generator/apps/native/src/features/image-generator/app/index.tsx +237 -0
  183. package/recipes/image-generator/apps/native/src/features/image-generator/components/gallery-image.tsx +26 -0
  184. package/recipes/image-generator/apps/native/src/features/image-generator/components/image-detail-modal.tsx +215 -0
  185. package/recipes/image-generator/apps/native/src/features/image-generator/components/image-model-selector.tsx +210 -0
  186. package/recipes/image-generator/apps/native/src/features/image-generator/components/image-placeholder.tsx +26 -0
  187. package/recipes/image-generator/apps/native/src/features/image-generator/hooks/use-image-gallery.ts +71 -0
  188. package/recipes/image-generator/apps/native/src/features/image-generator/hooks/use-image-generator-settings.ts +152 -0
  189. package/recipes/image-generator/apps/native/src/features/image-generator/hooks/use-image-generator.ts +93 -0
  190. package/recipes/image-generator/apps/native/src/features/image-generator/models/models.ts +66 -0
  191. package/recipes/image-generator/apps/native/src/features/image-generator/services/image-gallery-service.ts +98 -0
  192. package/recipes/image-generator/apps/native/src/features/image-generator/services/image-save-service.ts +121 -0
  193. package/recipes/image-generator/recipe.json +22 -0
  194. package/recipes/image-generator@latest.zip +0 -0
  195. package/recipes/quiz/apps/native/src/app/quiz/index.tsx +47 -0
  196. package/recipes/quiz/apps/native/src/features/quiz/components/question.tsx +67 -0
  197. package/recipes/quiz/apps/native/src/features/quiz/config.ts +11 -0
  198. package/recipes/quiz/apps/native/src/features/quiz/index.tsx +133 -0
  199. package/recipes/quiz/recipe.json +22 -0
  200. package/recipes/quiz@latest.zip +0 -0
  201. package/recipes/tracker-app/apps/native/src/app/tracker-app/index.tsx +1 -0
  202. package/recipes/tracker-app/apps/native/src/features/tracker-app/app/index.tsx +108 -0
  203. package/recipes/tracker-app/apps/native/src/features/tracker-app/components/animated-number.tsx +102 -0
  204. package/recipes/tracker-app/apps/native/src/features/tracker-app/components/calorie-card.tsx +66 -0
  205. package/recipes/tracker-app/apps/native/src/features/tracker-app/components/circular-progress.tsx +97 -0
  206. package/recipes/tracker-app/apps/native/src/features/tracker-app/components/floating-add-button.tsx +27 -0
  207. package/recipes/tracker-app/apps/native/src/features/tracker-app/components/macro-card.tsx +80 -0
  208. package/recipes/tracker-app/apps/native/src/features/tracker-app/components/promo-banner.tsx +98 -0
  209. package/recipes/tracker-app/apps/native/src/features/tracker-app/components/recently-logged.tsx +64 -0
  210. package/recipes/tracker-app/apps/native/src/features/tracker-app/components/week-calendar.tsx +68 -0
  211. package/recipes/tracker-app/recipe.json +22 -0
  212. package/recipes/tracker-app@latest.zip +0 -0
  213. package/recipes/upload-all.sh +32 -0
  214. package/recipes/voice-bot/apps/native/src/app/voice-bot/index.tsx +27 -0
  215. package/recipes/voice-bot/apps/native/src/features/voice-bot/README.md +185 -0
  216. package/recipes/voice-bot/apps/native/src/features/voice-bot/components/conversation-status.tsx +76 -0
  217. package/recipes/voice-bot/apps/native/src/features/voice-bot/components/index.ts +4 -0
  218. package/recipes/voice-bot/apps/native/src/features/voice-bot/components/message-input.tsx +98 -0
  219. package/recipes/voice-bot/apps/native/src/features/voice-bot/components/voice-bot-screen.tsx +173 -0
  220. package/recipes/voice-bot/apps/native/src/features/voice-bot/components/voice-controls.tsx +73 -0
  221. package/recipes/voice-bot/apps/native/src/features/voice-bot/index.ts +3 -0
  222. package/recipes/voice-bot/apps/native/src/features/voice-bot/services/index.ts +1 -0
  223. package/recipes/voice-bot/apps/native/src/features/voice-bot/services/use-voice-bot.ts +161 -0
  224. package/recipes/voice-bot/apps/native/src/features/voice-bot/types.ts +29 -0
  225. package/recipes/voice-bot/recipe.json +22 -0
  226. package/recipes/voice-bot@latest.zip +0 -0
  227. package/scripts/create-recipes.mjs +189 -0
  228. package/src/commands/add.ts +183 -0
  229. package/src/commands/devices.ts +38 -0
  230. package/src/commands/doctor.ts +67 -0
  231. package/src/commands/list.ts +45 -0
  232. package/src/commands/login.ts +24 -0
  233. package/src/commands/logout.ts +15 -0
  234. package/src/commands/remove.ts +78 -0
  235. package/src/core/__tests__/journal.test.ts +119 -0
  236. package/src/core/__tests__/validate.test.ts +64 -0
  237. package/src/core/archive.ts +69 -0
  238. package/src/core/auth.ts +103 -0
  239. package/src/core/codemod.ts +211 -0
  240. package/src/core/fsx.ts +80 -0
  241. package/src/core/http.ts +136 -0
  242. package/src/core/journal.ts +64 -0
  243. package/src/core/log.ts +9 -0
  244. package/src/core/pathGuard.ts +22 -0
  245. package/src/core/paths.ts +33 -0
  246. package/src/core/validate.ts +44 -0
  247. package/src/index.ts +27 -0
  248. package/test-critical-cases.mjs +258 -0
  249. package/tsconfig.json +21 -0
  250. package/vitest.config.mts +12 -0
@@ -0,0 +1,223 @@
1
+ import type React from 'react';
2
+ import { FlatList } from 'react-native';
3
+
4
+ import {
5
+ AreaChart,
6
+ BarChart,
7
+ CandlestickChart,
8
+ ColumnChart,
9
+ DoughnutChart,
10
+ LineChart,
11
+ RadarChart,
12
+ RadialBarChart,
13
+ StackedAreaChart,
14
+ StackedBarChart,
15
+ } from '@/features/charts/components';
16
+ import {
17
+ areaChartData,
18
+ candlestickData,
19
+ lineChartData,
20
+ radarChartData,
21
+ radialBarData,
22
+ salesData,
23
+ stackedAreaData,
24
+ stackedBarData,
25
+ stackedCategories,
26
+ } from '@/features/charts/data/mock-data';
27
+
28
+ import ChartCard from '../components/chart-card';
29
+
30
+ const ChartPreviewScreen: React.FC = () => {
31
+ const largeDataset = [
32
+ { label: 'E-commerce', value: 285, color: '#FF6B6B' },
33
+ { label: 'Social Media', value: 245, color: '#4ECDC4' },
34
+ { label: 'Search Engine', value: 198, color: '#45B7D1' },
35
+ { label: 'Email Marketing', value: 156, color: '#96CEB4' },
36
+ { label: 'Direct Traffic', value: 134, color: '#FFEAA7' },
37
+ { label: 'Referral', value: 89, color: '#DDA0DD' },
38
+ { label: 'Display Ads', value: 67, color: '#98D8C8' },
39
+ { label: 'Video Ads', value: 45, color: '#F7DC6F' },
40
+ { label: 'Affiliate', value: 23, color: '#BB8FCE' },
41
+ { label: 'Other', value: 18, color: '#AED6F1' },
42
+ ];
43
+
44
+ const chartItems = [
45
+ {
46
+ id: 'line',
47
+ component: (
48
+ <ChartCard title="Line Chart" subtitle="Smooth curves with gradient">
49
+ <LineChart
50
+ data={lineChartData}
51
+ config={{
52
+ height: 200,
53
+ animated: true,
54
+ gradient: false,
55
+ showGrid: true,
56
+ interactive: true,
57
+ }}
58
+ />
59
+ </ChartCard>
60
+ ),
61
+ },
62
+ {
63
+ id: 'bar',
64
+ component: (
65
+ <ChartCard title="Bar Chart" subtitle="Animated bars with values">
66
+ <BarChart
67
+ data={salesData.slice(0, 6)}
68
+ config={{
69
+ height: 200,
70
+ animated: true,
71
+ showLabels: true,
72
+ }}
73
+ />
74
+ </ChartCard>
75
+ ),
76
+ },
77
+ {
78
+ id: 'area',
79
+ component: (
80
+ <ChartCard
81
+ title="Area Chart"
82
+ subtitle="Growth trend with gradient fill"
83
+ >
84
+ <AreaChart
85
+ data={areaChartData}
86
+ config={{ height: 200, animated: true, gradient: true }}
87
+ />
88
+ </ChartCard>
89
+ ),
90
+ },
91
+ {
92
+ id: 'radar',
93
+ component: (
94
+ <ChartCard
95
+ title="Radar Chart"
96
+ subtitle="Multi-dimensional performance analysis"
97
+ >
98
+ <RadarChart
99
+ data={radarChartData}
100
+ config={{ height: 250, animated: true }}
101
+ />
102
+ </ChartCard>
103
+ ),
104
+ },
105
+ {
106
+ id: 'radial',
107
+ component: (
108
+ <ChartCard
109
+ title="Radial Bar Chart"
110
+ subtitle="Circular progress visualization"
111
+ >
112
+ <RadialBarChart
113
+ data={radialBarData}
114
+ config={{ animated: true, gradient: true }}
115
+ />
116
+ </ChartCard>
117
+ ),
118
+ },
119
+ {
120
+ id: 'doughnut',
121
+ component: (
122
+ <ChartCard title="Doughnut Chart" subtitle="">
123
+ <DoughnutChart
124
+ data={largeDataset}
125
+ config={{
126
+ height: 280,
127
+ showLabels: false,
128
+ animated: true,
129
+ duration: 1200,
130
+ innerRadius: 0.62,
131
+ }}
132
+ />
133
+ </ChartCard>
134
+ ),
135
+ },
136
+ {
137
+ id: 'column',
138
+ component: (
139
+ <ChartCard title="Column Chart" subtitle="Horizontal bar visualization">
140
+ <ColumnChart
141
+ data={salesData.slice(0, 5)}
142
+ config={{
143
+ height: 200,
144
+ animated: true,
145
+ showLabels: true,
146
+ }}
147
+ />
148
+ </ChartCard>
149
+ ),
150
+ },
151
+ {
152
+ id: 'candlestick',
153
+ component: (
154
+ <ChartCard
155
+ title="Candlestick Chart"
156
+ subtitle="Financial OHLC data visualization"
157
+ >
158
+ <CandlestickChart
159
+ data={candlestickData}
160
+ config={{
161
+ height: 200,
162
+ animated: true,
163
+ showGrid: true,
164
+ showLabels: true,
165
+ }}
166
+ />
167
+ </ChartCard>
168
+ ),
169
+ },
170
+ {
171
+ id: 'stacked-bar',
172
+ component: (
173
+ <ChartCard
174
+ title="Stacked Bar Chart"
175
+ subtitle="Multi-series data comparison"
176
+ >
177
+ <StackedBarChart
178
+ data={stackedBarData}
179
+ categories={stackedCategories}
180
+ colors={['#3B82F6', '#10B981', '#F59E0B']}
181
+ config={{
182
+ height: 200,
183
+ animated: true,
184
+ showLabels: true,
185
+ }}
186
+ />
187
+ </ChartCard>
188
+ ),
189
+ },
190
+ {
191
+ id: 'stacked-area',
192
+ component: (
193
+ <ChartCard
194
+ title="Stacked Area Chart"
195
+ subtitle="Cumulative multi-series visualization"
196
+ >
197
+ <StackedAreaChart
198
+ data={stackedAreaData}
199
+ categories={stackedCategories}
200
+ colors={['#3B82F6', '#10B981', '#F59E0B']}
201
+ config={{
202
+ height: 200,
203
+ animated: true,
204
+ showGrid: true,
205
+ }}
206
+ />
207
+ </ChartCard>
208
+ ),
209
+ },
210
+ ];
211
+
212
+ return (
213
+ <FlatList
214
+ data={chartItems}
215
+ keyExtractor={(item) => item.id}
216
+ contentInsetAdjustmentBehavior="automatic"
217
+ contentContainerStyle={{ padding: 16 }}
218
+ renderItem={({ item }) => item.component}
219
+ />
220
+ );
221
+ };
222
+
223
+ export default ChartPreviewScreen;
@@ -0,0 +1,40 @@
1
+ import type { ViewStyle } from 'react-native';
2
+
3
+ import { LineChart } from './line-chart';
4
+
5
+ interface ChartConfig {
6
+ width?: number;
7
+ height?: number;
8
+ padding?: number;
9
+ showGrid?: boolean;
10
+ showLabels?: boolean;
11
+ animated?: boolean;
12
+ duration?: number;
13
+ gradient?: boolean;
14
+ interactive?: boolean;
15
+ showYLabels?: boolean;
16
+ yLabelCount?: number;
17
+ yAxisWidth?: number;
18
+ }
19
+
20
+ interface ChartDataPoint {
21
+ x: string | number;
22
+ y: number;
23
+ label?: string;
24
+ }
25
+
26
+ type Props = {
27
+ data: ChartDataPoint[];
28
+ config?: ChartConfig;
29
+ style?: ViewStyle;
30
+ };
31
+
32
+ export const AreaChart = ({ data, config = {}, style }: Props) => {
33
+ return (
34
+ <LineChart
35
+ data={data}
36
+ config={{ ...config, gradient: true }}
37
+ style={style}
38
+ />
39
+ );
40
+ };
@@ -0,0 +1,143 @@
1
+ import { Canvas, Group, RoundedRect } from '@shopify/react-native-skia';
2
+ import React, { useEffect, useState } from 'react';
3
+ import { type LayoutChangeEvent, View, type ViewStyle } from 'react-native';
4
+ import Svg, { Text as SvgText } from 'react-native-svg';
5
+
6
+ import { useThemeConfig } from '@/lib/use-theme-config';
7
+
8
+ interface ChartConfig {
9
+ width?: number;
10
+ height?: number;
11
+ padding?: number;
12
+ showLabels?: boolean; // not rendered in Skia v1 (no font binding yet)
13
+ animated?: boolean;
14
+ duration?: number;
15
+ }
16
+
17
+ interface ChartDataPoint {
18
+ label: string;
19
+ value: number;
20
+ color?: string;
21
+ }
22
+
23
+ type Props = {
24
+ data: ChartDataPoint[];
25
+ config?: ChartConfig;
26
+ style?: ViewStyle;
27
+ };
28
+
29
+ export const BarChart = ({ data, config = {}, style }: Props) => {
30
+ const [containerWidth, setContainerWidth] = useState(300);
31
+ const {
32
+ height = 200,
33
+ padding = 20,
34
+ animated = true,
35
+ duration = 800,
36
+ showLabels = true,
37
+ } = config;
38
+
39
+ const chartWidth = containerWidth || config.width || 300;
40
+
41
+ const theme = useThemeConfig();
42
+ const primaryColor = theme.colors.primary as string;
43
+ const mutedColor = theme.colors.mutedForeground as string;
44
+
45
+ const [progress, setProgress] = useState(1);
46
+
47
+ const onLayout = (e: LayoutChangeEvent) => {
48
+ const { width } = e.nativeEvent.layout;
49
+ if (width > 0) setContainerWidth(width);
50
+ };
51
+
52
+ useEffect(() => {
53
+ if (!animated) {
54
+ setProgress(1);
55
+ return;
56
+ }
57
+ let raf: number;
58
+ const start = Date.now();
59
+ const easeInOutCubic = (t: number) =>
60
+ t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2;
61
+ const tick = () => {
62
+ const elapsed = Date.now() - start;
63
+ const t = Math.min(1, elapsed / (duration || 800));
64
+ setProgress(easeInOutCubic(t));
65
+ if (t < 1) raf = requestAnimationFrame(tick);
66
+ };
67
+ setProgress(0);
68
+ raf = requestAnimationFrame(tick);
69
+ return () => cancelAnimationFrame(raf);
70
+ }, [animated, duration, data]);
71
+
72
+ if (!data.length) return null;
73
+
74
+ const maxValue = Math.max(...data.map((d) => d.value));
75
+ const innerChartWidth = chartWidth - padding * 2;
76
+ const chartHeight = height - padding * 2;
77
+ const barWidth = (innerChartWidth / data.length) * 0.8;
78
+ const barSpacing = (innerChartWidth / data.length) * 0.2;
79
+
80
+ return (
81
+ <View style={[{ width: '100%', height }, style]} onLayout={onLayout}>
82
+ <Canvas style={{ width: chartWidth, height }}>
83
+ <Group>
84
+ {data.map((item, index) => {
85
+ const h = (item.value / maxValue) * chartHeight;
86
+ const x =
87
+ padding + index * (barWidth + barSpacing) + barSpacing / 2;
88
+ const y = height - padding - h * progress;
89
+ return (
90
+ <RoundedRect
91
+ key={`bar-${index}`}
92
+ x={x}
93
+ y={y}
94
+ width={barWidth}
95
+ height={h * progress}
96
+ color={(item.color || primaryColor) as string}
97
+ r={4}
98
+ />
99
+ );
100
+ })}
101
+ </Group>
102
+ </Canvas>
103
+ {/* Labels overlay for parity */}
104
+ {showLabels && (
105
+ <Svg
106
+ width={chartWidth}
107
+ height={height}
108
+ style={{ position: 'absolute', left: 0, top: 0 }}
109
+ >
110
+ {data.map((item, index) => {
111
+ const h = (item.value / maxValue) * chartHeight;
112
+ const x =
113
+ padding + index * (barWidth + barSpacing) + barSpacing / 2;
114
+ const y = height - padding - h;
115
+ return (
116
+ <React.Fragment key={`labels-${index}`}>
117
+ <SvgText
118
+ x={x + barWidth / 2}
119
+ y={height - 5}
120
+ textAnchor="middle"
121
+ fontSize={12}
122
+ fill={mutedColor}
123
+ >
124
+ {item.label}
125
+ </SvgText>
126
+ <SvgText
127
+ x={x + barWidth / 2}
128
+ y={y - 5}
129
+ textAnchor="middle"
130
+ fontSize={11}
131
+ fill={mutedColor}
132
+ fontWeight="600"
133
+ >
134
+ {item.value}
135
+ </SvgText>
136
+ </React.Fragment>
137
+ );
138
+ })}
139
+ </Svg>
140
+ )}
141
+ </View>
142
+ );
143
+ };
@@ -0,0 +1,196 @@
1
+ import {
2
+ Canvas,
3
+ Group,
4
+ Path as SkPath,
5
+ Rect as SkRect,
6
+ Skia,
7
+ } from '@shopify/react-native-skia';
8
+ import React, { useEffect, useState } from 'react';
9
+ import { type LayoutChangeEvent, View, type ViewStyle } from 'react-native';
10
+ import Svg, { Text as SvgText } from 'react-native-svg';
11
+
12
+ import { useThemeConfig } from '@/lib/use-theme-config';
13
+
14
+ interface ChartConfig {
15
+ width?: number;
16
+ height?: number;
17
+ padding?: number;
18
+ showGrid?: boolean;
19
+ showLabels?: boolean;
20
+ animated?: boolean;
21
+ duration?: number;
22
+ }
23
+
24
+ interface CandlestickDataPoint {
25
+ date: string;
26
+ open: number;
27
+ high: number;
28
+ low: number;
29
+ close: number;
30
+ }
31
+
32
+ type Props = {
33
+ data: CandlestickDataPoint[];
34
+ config?: ChartConfig;
35
+ style?: ViewStyle;
36
+ };
37
+
38
+ export const CandlestickChart = ({ data, config = {}, style }: Props) => {
39
+ const [containerWidth, setContainerWidth] = useState(300);
40
+
41
+ const {
42
+ height = 200,
43
+ padding = 20,
44
+ showGrid = true,
45
+ showLabels = true,
46
+ animated = true,
47
+ duration = 800,
48
+ } = config;
49
+
50
+ const chartWidth = containerWidth || config.width || 300;
51
+
52
+ const theme = useThemeConfig();
53
+ const bullishColor = '#10B981';
54
+ const bearishColor = '#EF4444';
55
+ const mutedColor = theme.colors.mutedForeground as string;
56
+
57
+ const [progress, setProgress] = useState(1);
58
+
59
+ const onLayout = (e: LayoutChangeEvent) => {
60
+ const { width } = e.nativeEvent.layout;
61
+ if (width > 0) setContainerWidth(width);
62
+ };
63
+
64
+ useEffect(() => {
65
+ if (!animated) {
66
+ setProgress(1);
67
+ return;
68
+ }
69
+ let raf: number;
70
+ const start = Date.now();
71
+ const easeInOutCubic = (t: number) =>
72
+ t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2;
73
+ const tick = () => {
74
+ const elapsed = Date.now() - start;
75
+ const t = Math.min(1, elapsed / (duration || 800));
76
+ setProgress(easeInOutCubic(t));
77
+ if (t < 1) raf = requestAnimationFrame(tick);
78
+ };
79
+ setProgress(0);
80
+ raf = requestAnimationFrame(tick);
81
+ return () => cancelAnimationFrame(raf);
82
+ }, [animated, duration, data]);
83
+
84
+ if (!data.length) return null;
85
+
86
+ const allValues = data.flatMap((d) => [d.open, d.high, d.low, d.close]);
87
+ const maxValue = Math.max(...allValues);
88
+ const minValue = Math.min(...allValues);
89
+ const valueRange = maxValue - minValue || 1;
90
+
91
+ const innerChartWidth = chartWidth - padding * 2;
92
+ const chartHeight = height - padding * 2;
93
+ const candleWidth = (innerChartWidth / data.length) * 0.6;
94
+ const candleSpacing = (innerChartWidth / data.length) * 0.4;
95
+
96
+ return (
97
+ <View style={[{ width: '100%', height }, style]} onLayout={onLayout}>
98
+ <Canvas style={{ width: chartWidth, height }}>
99
+ {/* Grid lines */}
100
+ {showGrid && (
101
+ <Group>
102
+ {(() => {
103
+ const p = Skia.Path.Make();
104
+ [0, 0.25, 0.5, 0.75, 1].forEach((ratio) => {
105
+ const y = padding + ratio * chartHeight;
106
+ p.moveTo(padding, y);
107
+ p.lineTo(chartWidth - padding, y);
108
+ });
109
+ return (
110
+ <SkPath
111
+ path={p}
112
+ color={mutedColor}
113
+ style="stroke"
114
+ strokeWidth={0.5}
115
+ opacity={0.3}
116
+ />
117
+ );
118
+ })()}
119
+ </Group>
120
+ )}
121
+
122
+ {/* Candles */}
123
+ {data.map((item, index) => {
124
+ const isBullish = item.close >= item.open;
125
+ const color = isBullish ? bullishColor : bearishColor;
126
+ const x =
127
+ padding + index * (candleWidth + candleSpacing) + candleSpacing / 2;
128
+ const highY =
129
+ padding + ((maxValue - item.high) / valueRange) * chartHeight;
130
+ const lowY =
131
+ padding + ((maxValue - item.low) / valueRange) * chartHeight;
132
+ const openY =
133
+ padding + ((maxValue - item.open) / valueRange) * chartHeight;
134
+ const closeY =
135
+ padding + ((maxValue - item.close) / valueRange) * chartHeight;
136
+ const bodyTop = Math.min(openY, closeY);
137
+ const bodyHeight = Math.abs(closeY - openY) || 1;
138
+
139
+ const wick = Skia.Path.Make();
140
+ wick.moveTo(x + candleWidth / 2, highY);
141
+ wick.lineTo(x + candleWidth / 2, lowY);
142
+
143
+ const y = bodyTop + (1 - progress) * bodyHeight;
144
+ const h = bodyHeight * progress;
145
+
146
+ return (
147
+ <Group key={`candle-${index}`}>
148
+ <SkPath
149
+ path={wick}
150
+ color={color}
151
+ style="stroke"
152
+ strokeWidth={1}
153
+ opacity={progress}
154
+ />
155
+ <SkRect
156
+ x={x}
157
+ y={y}
158
+ width={candleWidth}
159
+ height={h}
160
+ color={color}
161
+ />
162
+ </Group>
163
+ );
164
+ })}
165
+ </Canvas>
166
+ {showLabels && (
167
+ <Svg
168
+ width={chartWidth}
169
+ height={height}
170
+ style={{ position: 'absolute', left: 0, top: 0 }}
171
+ >
172
+ {data.map((item, index) => {
173
+ const x =
174
+ padding +
175
+ index * (candleWidth + candleSpacing) +
176
+ candleSpacing / 2;
177
+ if (index % Math.max(1, Math.floor(data.length / 5)) !== 0)
178
+ return null;
179
+ return (
180
+ <SvgText
181
+ key={`lbl-${index}`}
182
+ x={x}
183
+ y={height - 5}
184
+ textAnchor="middle"
185
+ fontSize={10}
186
+ fill={mutedColor}
187
+ >
188
+ {item.date}
189
+ </SvgText>
190
+ );
191
+ })}
192
+ </Svg>
193
+ )}
194
+ </View>
195
+ );
196
+ };
@@ -0,0 +1,65 @@
1
+ import type React from 'react';
2
+ import { Dimensions, View } from 'react-native';
3
+
4
+ import { Text } from '@/components/ui';
5
+ import { useThemeConfig } from '@/lib/use-theme-config';
6
+
7
+ const { width: screenWidth } = Dimensions.get('window');
8
+
9
+ interface ChartCardProps {
10
+ title: string;
11
+ subtitle?: string;
12
+ width?: number;
13
+ height?: number;
14
+ children: React.ReactNode;
15
+ }
16
+
17
+ const ChartCard: React.FC<ChartCardProps> = ({
18
+ title,
19
+ subtitle,
20
+ width = screenWidth - 32,
21
+ height: _height,
22
+ children,
23
+ }) => {
24
+ const theme = useThemeConfig();
25
+
26
+ return (
27
+ <View
28
+ className="mb-4 overflow-hidden rounded-xl"
29
+ style={{
30
+ width,
31
+ backgroundColor: theme.colors.card,
32
+ borderColor: theme.colors.outline,
33
+ borderWidth: 1,
34
+ shadowColor: '#000',
35
+ shadowOffset: { width: 0, height: 2 },
36
+ shadowOpacity: 0.1,
37
+ shadowRadius: 4,
38
+ elevation: 2,
39
+ }}
40
+ >
41
+ <View
42
+ className="border-b p-4"
43
+ style={{ borderBottomColor: theme.colors.outline }}
44
+ >
45
+ <Text
46
+ className="text-base font-semibold"
47
+ style={{ color: theme.colors.foreground }}
48
+ >
49
+ {title}
50
+ </Text>
51
+ {subtitle && (
52
+ <Text
53
+ className="mt-1 text-xs"
54
+ style={{ color: theme.colors.mutedForeground }}
55
+ >
56
+ {subtitle}
57
+ </Text>
58
+ )}
59
+ </View>
60
+ <View className="items-center justify-center p-2">{children}</View>
61
+ </View>
62
+ );
63
+ };
64
+
65
+ export default ChartCard;