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,322 @@
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, {
5
+ G as SvgG,
6
+ Line as SvgLine,
7
+ Rect as SvgRect,
8
+ Text as SvgText,
9
+ } from 'react-native-svg';
10
+
11
+ import { useThemeConfig } from '@/lib/use-theme-config';
12
+
13
+ interface ChartConfig {
14
+ width?: number;
15
+ height?: number;
16
+ padding?: number;
17
+ showGrid?: boolean;
18
+ showLabels?: boolean;
19
+ animated?: boolean;
20
+ duration?: number;
21
+ }
22
+
23
+ export interface StackedBarDataPoint {
24
+ label: string;
25
+ values: number[];
26
+ }
27
+
28
+ type Props = {
29
+ data: StackedBarDataPoint[];
30
+ colors?: string[];
31
+ config?: ChartConfig;
32
+ style?: ViewStyle;
33
+ categories?: string[];
34
+ horizontal?: boolean;
35
+ };
36
+
37
+ export const StackedBarChart = ({
38
+ data,
39
+ colors = [],
40
+ config = {},
41
+ style,
42
+ categories = [],
43
+ horizontal = false,
44
+ }: Props) => {
45
+ const [containerWidth, setContainerWidth] = useState(300);
46
+ const {
47
+ height = 200,
48
+ padding = 20,
49
+ showLabels = true,
50
+ showGrid = true,
51
+ animated = true,
52
+ duration = 800,
53
+ } = config;
54
+ const chartWidth = containerWidth || config.width || 300;
55
+
56
+ const theme = useThemeConfig();
57
+ const primaryColor = theme.colors.primary as string;
58
+ const mutedColor = theme.colors.mutedForeground as string;
59
+
60
+ const [progress, setProgress] = useState(1);
61
+
62
+ const onLayout = (e: LayoutChangeEvent) => {
63
+ const { width } = e.nativeEvent.layout;
64
+ if (width > 0) setContainerWidth(width);
65
+ };
66
+
67
+ useEffect(() => {
68
+ if (!animated) {
69
+ setProgress(1);
70
+ return;
71
+ }
72
+ let raf: number;
73
+ const start = Date.now();
74
+ const easeInOutCubic = (t: number) =>
75
+ t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2;
76
+ const tick = () => {
77
+ const elapsed = Date.now() - start;
78
+ const t = Math.min(1, elapsed / (duration || 800));
79
+ setProgress(easeInOutCubic(t));
80
+ if (t < 1) raf = requestAnimationFrame(tick);
81
+ };
82
+ setProgress(0);
83
+ raf = requestAnimationFrame(tick);
84
+ return () => cancelAnimationFrame(raf);
85
+ }, [animated, duration, data]);
86
+
87
+ if (!data.length) return null;
88
+
89
+ const maxValue = Math.max(
90
+ ...data.map((d) => d.values.reduce((s, v) => s + v, 0)),
91
+ );
92
+ const seriesCount = data[0]?.values.length || 0;
93
+ const innerChartWidth = chartWidth - padding * 2;
94
+ const chartHeight = height - padding * 2;
95
+
96
+ const defaultColors = [
97
+ '#8884d8',
98
+ '#82ca9d',
99
+ '#ffc658',
100
+ '#ff7300',
101
+ '#00ff00',
102
+ '#0088fe',
103
+ primaryColor,
104
+ ];
105
+ const seriesColors =
106
+ colors.length >= seriesCount
107
+ ? colors
108
+ : [...colors, ...defaultColors].slice(0, seriesCount);
109
+
110
+ if (horizontal) {
111
+ const barHeight = (chartHeight / data.length) * 0.8;
112
+ const barSpacing = (chartHeight / data.length) * 0.2;
113
+ return (
114
+ <View style={[{ width: '100%', height }, style]} onLayout={onLayout}>
115
+ <Canvas style={{ width: chartWidth, height }}>
116
+ {data.map((item, itemIndex) => {
117
+ let cumulativeWidth = 0;
118
+ const y =
119
+ padding + itemIndex * (barHeight + barSpacing) + barSpacing / 2;
120
+ return (
121
+ <Group key={`bar-${itemIndex}`}>
122
+ {item.values.map((value, valueIndex) => {
123
+ const segmentWidth = (value / maxValue) * innerChartWidth;
124
+ const w = segmentWidth * progress;
125
+ const x = padding + cumulativeWidth;
126
+ cumulativeWidth += segmentWidth;
127
+ return (
128
+ <RoundedRect
129
+ key={`seg-${valueIndex}`}
130
+ x={x}
131
+ y={y}
132
+ width={w}
133
+ height={barHeight}
134
+ color={seriesColors[valueIndex]}
135
+ r={2}
136
+ />
137
+ );
138
+ })}
139
+ </Group>
140
+ );
141
+ })}
142
+ </Canvas>
143
+ {(showGrid || showLabels || categories.length > 0) && (
144
+ <Svg
145
+ width={chartWidth}
146
+ height={height}
147
+ style={{ position: 'absolute', left: 0, top: 0 }}
148
+ >
149
+ {showGrid && (
150
+ <SvgG>
151
+ {[0, 0.25, 0.5, 0.75, 1].map((ratio, index) => (
152
+ <SvgLine
153
+ key={`grid-${index}`}
154
+ x1={padding + ratio * innerChartWidth}
155
+ y1={padding}
156
+ x2={padding + ratio * innerChartWidth}
157
+ y2={height - padding}
158
+ stroke={mutedColor}
159
+ strokeWidth={0.5}
160
+ opacity={0.3}
161
+ />
162
+ ))}
163
+ </SvgG>
164
+ )}
165
+ {showLabels && (
166
+ <SvgG>
167
+ {data.map((item, itemIndex) => {
168
+ const y =
169
+ padding +
170
+ itemIndex * (barHeight + barSpacing) +
171
+ barSpacing / 2;
172
+ return (
173
+ <SvgText
174
+ key={`lbl-${itemIndex}`}
175
+ x={padding - 10}
176
+ y={y + barHeight / 2 + 4}
177
+ textAnchor="end"
178
+ fontSize={12}
179
+ fill={mutedColor}
180
+ >
181
+ {item.label}
182
+ </SvgText>
183
+ );
184
+ })}
185
+ </SvgG>
186
+ )}
187
+ {categories.length > 0 && (
188
+ <SvgG>
189
+ {categories.map((category, index) => (
190
+ <React.Fragment key={`legend-${index}`}>
191
+ <SvgRect
192
+ x={padding + index * 80}
193
+ y={height - padding + 10}
194
+ width={12}
195
+ height={8}
196
+ fill={seriesColors[index]}
197
+ rx={2}
198
+ />
199
+ <SvgText
200
+ x={padding + index * 80 + 18}
201
+ y={height - padding + 18}
202
+ fontSize={12}
203
+ fill={mutedColor}
204
+ >
205
+ {category}
206
+ </SvgText>
207
+ </React.Fragment>
208
+ ))}
209
+ </SvgG>
210
+ )}
211
+ </Svg>
212
+ )}
213
+ </View>
214
+ );
215
+ }
216
+
217
+ // Vertical stacked bars
218
+ const barWidth = (innerChartWidth / data.length) * 0.8;
219
+ const barSpacing = (innerChartWidth / data.length) * 0.2;
220
+
221
+ return (
222
+ <View style={[{ width: '100%', height }, style]} onLayout={onLayout}>
223
+ <Canvas style={{ width: chartWidth, height }}>
224
+ <Group>
225
+ {data.map((item, itemIndex) => {
226
+ const x =
227
+ padding + itemIndex * (barWidth + barSpacing) + barSpacing / 2;
228
+ let cumHeight = 0;
229
+ return item.values.map((value, valueIndex) => {
230
+ const segmentHeight = (value / maxValue) * chartHeight;
231
+ cumHeight += segmentHeight;
232
+ const baseY = height - padding - cumHeight;
233
+ const h = segmentHeight * progress;
234
+ const y = baseY + (1 - progress) * segmentHeight;
235
+ return (
236
+ <RoundedRect
237
+ key={`seg-${itemIndex}-${valueIndex}`}
238
+ x={x}
239
+ y={y}
240
+ width={barWidth}
241
+ height={h}
242
+ color={seriesColors[valueIndex]}
243
+ r={2}
244
+ />
245
+ );
246
+ });
247
+ })}
248
+ </Group>
249
+ </Canvas>
250
+ {(showGrid || showLabels || categories.length > 0) && (
251
+ <Svg
252
+ width={chartWidth}
253
+ height={height}
254
+ style={{ position: 'absolute', left: 0, top: 0 }}
255
+ >
256
+ {showGrid && (
257
+ <SvgG>
258
+ {[0, 0.25, 0.5, 0.75, 1].map((ratio, index) => (
259
+ <SvgLine
260
+ key={`grid-${index}`}
261
+ x1={padding}
262
+ y1={padding + ratio * chartHeight}
263
+ x2={chartWidth - padding}
264
+ y2={padding + ratio * chartHeight}
265
+ stroke={mutedColor}
266
+ strokeWidth={0.5}
267
+ opacity={0.3}
268
+ />
269
+ ))}
270
+ </SvgG>
271
+ )}
272
+ {showLabels && (
273
+ <SvgG>
274
+ {data.map((item, itemIndex) => {
275
+ const x =
276
+ padding +
277
+ itemIndex * (barWidth + barSpacing) +
278
+ barSpacing / 2;
279
+ return (
280
+ <SvgText
281
+ key={`lbl-${itemIndex}`}
282
+ x={x + barWidth / 2}
283
+ y={height - 5}
284
+ textAnchor="middle"
285
+ fontSize={12}
286
+ fill={mutedColor}
287
+ >
288
+ {item.label}
289
+ </SvgText>
290
+ );
291
+ })}
292
+ </SvgG>
293
+ )}
294
+ {categories.length > 0 && (
295
+ <SvgG>
296
+ {categories.map((category, index) => (
297
+ <React.Fragment key={`legend-${index}`}>
298
+ <SvgRect
299
+ x={padding + index * 80}
300
+ y={height - padding + 10}
301
+ width={12}
302
+ height={8}
303
+ fill={seriesColors[index]}
304
+ rx={2}
305
+ />
306
+ <SvgText
307
+ x={padding + index * 80 + 18}
308
+ y={height - padding + 18}
309
+ fontSize={12}
310
+ fill={mutedColor}
311
+ >
312
+ {category}
313
+ </SvgText>
314
+ </React.Fragment>
315
+ ))}
316
+ </SvgG>
317
+ )}
318
+ </Svg>
319
+ )}
320
+ </View>
321
+ );
322
+ };
@@ -0,0 +1,183 @@
1
+ export const salesData = [
2
+ { id: '1', label: 'Jan', value: 3500, color: '#3B82F6' },
3
+ { id: '2', label: 'Feb', value: 4200, color: '#10B981' },
4
+ { id: '3', label: 'Mar', value: 5300, color: '#F59E0B' },
5
+ { id: '4', label: 'Apr', value: 6800, color: '#EF4444' },
6
+ { id: '5', label: 'May', value: 8200, color: '#8B5CF6' },
7
+ { id: '6', label: 'Jun', value: 7300, color: '#06B6D4' },
8
+ { id: '7', label: 'Jul', value: 9100, color: '#84CC16' },
9
+ { id: '8', label: 'Aug', value: 8300, color: '#F97316' },
10
+ { id: '9', label: 'Sep', value: 10100, color: '#EC4899' },
11
+ { id: '10', label: 'Oct', value: 7500, color: '#6366F1' },
12
+ ];
13
+
14
+ export const marketShareData = [
15
+ { id: '1', label: 'Product A', value: 45, color: '#3B82F6' },
16
+ { id: '2', label: 'Product B', value: 30, color: '#10B981' },
17
+ { id: '3', label: 'Product C', value: 25, color: '#F59E0B' },
18
+ ];
19
+
20
+ export const expensesData = [
21
+ { id: '1', label: 'Rent', value: 2500, color: '#EF4444' },
22
+ { id: '2', label: 'Salaries', value: 4200, color: '#3B82F6' },
23
+ { id: '3', label: 'Marketing', value: 1800, color: '#10B981' },
24
+ { id: '4', label: 'Operations', value: 1500, color: '#F59E0B' },
25
+ { id: '5', label: 'Equipment', value: 900, color: '#8B5CF6' },
26
+ ];
27
+
28
+ export const userEngagementData = [
29
+ { id: '1', value: 4500, label: 'App Views' },
30
+ { id: '2', value: 3200, label: 'Interactions' },
31
+ { id: '3', value: 2100, label: 'Shares' },
32
+ { id: '4', value: 1800, label: 'Comments' },
33
+ ];
34
+
35
+ export const quarterlyRevenueData = [
36
+ { id: '1', label: 'Q1', value: 8500, color: '#3B82F6' },
37
+ { id: '2', label: 'Q2', value: 12000, color: '#10B981' },
38
+ { id: '3', label: 'Q3', value: 9800, color: '#F59E0B' },
39
+ { id: '4', label: 'Q4', value: 15000, color: '#EF4444' },
40
+ ];
41
+
42
+ export const monthlyActiveUsers = [
43
+ 1200, 1350, 1500, 1400, 1650, 1800, 1750, 1900, 2100, 2000, 2200, 2400,
44
+ ];
45
+
46
+ export const monthLabels = [
47
+ 'Jan',
48
+ 'Feb',
49
+ 'Mar',
50
+ 'Apr',
51
+ 'May',
52
+ 'Jun',
53
+ 'Jul',
54
+ 'Aug',
55
+ 'Sep',
56
+ 'Oct',
57
+ 'Nov',
58
+ 'Dec',
59
+ ];
60
+
61
+ export const weeklyVisitors = [1200, 1400, 1300, 1800, 1600, 2000, 2200];
62
+ export const weekLabels = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
63
+
64
+ export const dailyTemperature = [
65
+ 18, 19, 21, 23, 25, 27, 29, 28, 26, 24, 22, 20, 18, 17, 16, 18, 20, 22, 24,
66
+ 26, 25, 23, 21, 19,
67
+ ];
68
+
69
+ export const temperatureLabels = [
70
+ '00:00',
71
+ '01:00',
72
+ '02:00',
73
+ '03:00',
74
+ '04:00',
75
+ '05:00',
76
+ '06:00',
77
+ '07:00',
78
+ '08:00',
79
+ '09:00',
80
+ '10:00',
81
+ '11:00',
82
+ '12:00',
83
+ '13:00',
84
+ '14:00',
85
+ '15:00',
86
+ '16:00',
87
+ '17:00',
88
+ '18:00',
89
+ '19:00',
90
+ '20:00',
91
+ '21:00',
92
+ '22:00',
93
+ '23:00',
94
+ ];
95
+
96
+ export const stockPriceData = [
97
+ 156.78, 158.45, 160.32, 159.98, 162.5, 164.75, 167.23, 166.8, 170.42, 172.15,
98
+ 173.88, 177.62, 180.33, 178.45, 182.76,
99
+ ];
100
+
101
+ export const stockDates = [
102
+ 'Jan 1',
103
+ 'Jan 5',
104
+ 'Jan 10',
105
+ 'Jan 15',
106
+ 'Jan 20',
107
+ 'Jan 25',
108
+ 'Jan 30',
109
+ 'Feb 5',
110
+ 'Feb 10',
111
+ 'Feb 15',
112
+ 'Feb 20',
113
+ 'Feb 25',
114
+ 'Mar 1',
115
+ 'Mar 5',
116
+ 'Mar 10',
117
+ ];
118
+
119
+ export const chartColorPalettes = {
120
+ primary: ['#3B82F6', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6'],
121
+ vibrant: ['#EC4899', '#06B6D4', '#84CC16', '#F97316', '#6366F1'],
122
+ warm: ['#F59E0B', '#EF4444', '#F97316', '#EC4899', '#DC2626'],
123
+ cool: ['#3B82F6', '#06B6D4', '#10B981', '#8B5CF6', '#6366F1'],
124
+ monochrome: ['#6B7280', '#9CA3AF', '#D1D5DB', '#374151', '#111827'],
125
+ };
126
+
127
+ // New chart data for advanced components
128
+ export const lineChartData = [
129
+ { x: 'Jan', y: 65, label: 'Jan' },
130
+ { x: 'Feb', y: 78, label: 'Feb' },
131
+ { x: 'Mar', y: 90, label: 'Mar' },
132
+ { x: 'Apr', y: 81, label: 'Apr' },
133
+ { x: 'May', y: 95, label: 'May' },
134
+ { x: 'Jun', y: 88, label: 'Jun' },
135
+ ];
136
+
137
+ export const areaChartData = [
138
+ { x: 'Jan', y: 30, label: 'Jan' },
139
+ { x: 'Feb', y: 45, label: 'Feb' },
140
+ { x: 'Mar', y: 60, label: 'Mar' },
141
+ { x: 'Apr', y: 55, label: 'Apr' },
142
+ { x: 'May', y: 70, label: 'May' },
143
+ { x: 'Jun', y: 65, label: 'Jun' },
144
+ ];
145
+
146
+ export const radarChartData = [
147
+ { label: 'Speed', value: 80 },
148
+ { label: 'Reliability', value: 90 },
149
+ { label: 'Comfort', value: 70 },
150
+ { label: 'Safety', value: 95 },
151
+ { label: 'Efficiency', value: 85 },
152
+ ];
153
+
154
+ export const radialBarData = [
155
+ { label: 'Completed', value: 75, color: '#10B981' },
156
+ { label: 'In Progress', value: 45, color: '#F59E0B' },
157
+ { label: 'Pending', value: 30, color: '#EF4444' },
158
+ ];
159
+
160
+ export const candlestickData = [
161
+ { date: 'Jan 1', open: 100, high: 110, low: 95, close: 105 },
162
+ { date: 'Jan 2', open: 105, high: 115, low: 100, close: 108 },
163
+ { date: 'Jan 3', open: 108, high: 120, low: 105, close: 115 },
164
+ { date: 'Jan 4', open: 115, high: 118, low: 110, close: 112 },
165
+ { date: 'Jan 5', open: 112, high: 125, low: 108, close: 120 },
166
+ ];
167
+
168
+ export const stackedBarData = [
169
+ { label: 'Q1', values: [20, 30, 25] },
170
+ { label: 'Q2', values: [25, 35, 30] },
171
+ { label: 'Q3', values: [30, 25, 35] },
172
+ { label: 'Q4', values: [35, 40, 30] },
173
+ ];
174
+
175
+ export const stackedAreaData = [
176
+ { x: 1, y: [20, 30, 25], label: 'Jan' },
177
+ { x: 2, y: [25, 35, 30], label: 'Feb' },
178
+ { x: 3, y: [30, 25, 35], label: 'Mar' },
179
+ { x: 4, y: [35, 40, 30], label: 'Apr' },
180
+ { x: 5, y: [40, 35, 25], label: 'May' },
181
+ ];
182
+
183
+ export const stackedCategories = ['Series A', 'Series B', 'Series C'];
@@ -0,0 +1,66 @@
1
+ export type ChartData = {
2
+ value: number;
3
+ label: string;
4
+ color?: string;
5
+ tooltip?: string;
6
+ id: string;
7
+ };
8
+
9
+ export type BarChartProps = {
10
+ data: ChartData[];
11
+ height?: number;
12
+ width?: number;
13
+ barRadius?: number;
14
+ barWidth?: number;
15
+ gap?: number;
16
+ animated?: boolean;
17
+ showValues?: boolean;
18
+ showLabels?: boolean;
19
+ showGrid?: boolean;
20
+ colors?: string[];
21
+ valueFormatter?: (value: number) => string;
22
+ onBarPress?: (item: ChartData) => void;
23
+ horizontal?: boolean;
24
+ style?: any;
25
+ };
26
+
27
+ export type PieChartProps = {
28
+ data: ChartData[];
29
+ height?: number;
30
+ width?: number;
31
+ radius?: number;
32
+ innerRadius?: number;
33
+ animated?: boolean;
34
+ animationDuration?: number;
35
+ showValues?: boolean;
36
+ showLabels?: boolean;
37
+ showLegend?: boolean;
38
+ valueFormatter?: (value: number) => string;
39
+ colors?: string[];
40
+ rotation?: number;
41
+ onSectionPress?: (item: ChartData) => void;
42
+ style?: any;
43
+ };
44
+
45
+ export type LineChartProps = {
46
+ data: number[];
47
+ labels?: string[];
48
+ height?: number;
49
+ width?: number;
50
+ animated?: boolean;
51
+ animationDuration?: number;
52
+ strokeWidth?: number;
53
+ curved?: boolean;
54
+ showDots?: boolean;
55
+ showArea?: boolean;
56
+ showGrid?: boolean;
57
+ showAxisLabels?: boolean;
58
+ showValues?: boolean;
59
+ fillColor?: string;
60
+ strokeColor?: string;
61
+ dotColor?: string;
62
+ gridColor?: string;
63
+ axisColor?: string;
64
+ valueFormatter?: (value: number) => string;
65
+ style?: any;
66
+ };
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "charts",
3
+ "version": "1.0.0",
4
+ "description": "Beautiful data visualization with charts",
5
+ "copy": [
6
+ {
7
+ "from": "apps/native/src/app/charts",
8
+ "to": "apps/native/src/app/(root)/(protected)/charts"
9
+ },
10
+ {
11
+ "from": "apps/native/src/features/charts",
12
+ "to": "apps/native/src/features/charts"
13
+ }
14
+ ],
15
+ "nav": {
16
+ "href": "/(root)/(protected)/charts",
17
+ "label": "Charts",
18
+ "icon": "📊",
19
+ "color": "#6366F1"
20
+ },
21
+ "target": "native"
22
+ }
Binary file
@@ -0,0 +1 @@
1
+ export { default } from '@/features/chatbot/app';