@docyrus/rn-assistant 0.4.0 → 0.6.0

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 (53) hide show
  1. package/dist/commonjs/components/assistant-screen/assistant-screen.js +1 -1
  2. package/dist/commonjs/components/assistant-screen/assistant-screen.js.map +1 -1
  3. package/dist/commonjs/components/message-parts/message-parts.js +84 -20
  4. package/dist/commonjs/components/message-parts/message-parts.js.map +1 -1
  5. package/dist/commonjs/components/message-parts/tools/data-table-tool.js +417 -0
  6. package/dist/commonjs/components/message-parts/tools/data-table-tool.js.map +1 -0
  7. package/dist/commonjs/components/message-parts/tools/generate-chart-tool.js +240 -0
  8. package/dist/commonjs/components/message-parts/tools/generate-chart-tool.js.map +1 -0
  9. package/dist/commonjs/components/message-parts/tools/index.js +28 -0
  10. package/dist/commonjs/components/message-parts/tools/index.js.map +1 -1
  11. package/dist/commonjs/components/message-parts/tools/mermaid-diagram-tool.js +223 -0
  12. package/dist/commonjs/components/message-parts/tools/mermaid-diagram-tool.js.map +1 -0
  13. package/dist/commonjs/components/message-parts/tools/request-user-input-tool.js +366 -0
  14. package/dist/commonjs/components/message-parts/tools/request-user-input-tool.js.map +1 -0
  15. package/dist/module/components/assistant-screen/assistant-screen.js +1 -1
  16. package/dist/module/components/assistant-screen/assistant-screen.js.map +1 -1
  17. package/dist/module/components/message-parts/message-parts.js +85 -21
  18. package/dist/module/components/message-parts/message-parts.js.map +1 -1
  19. package/dist/module/components/message-parts/tools/data-table-tool.js +413 -0
  20. package/dist/module/components/message-parts/tools/data-table-tool.js.map +1 -0
  21. package/dist/module/components/message-parts/tools/generate-chart-tool.js +236 -0
  22. package/dist/module/components/message-parts/tools/generate-chart-tool.js.map +1 -0
  23. package/dist/module/components/message-parts/tools/index.js +4 -0
  24. package/dist/module/components/message-parts/tools/index.js.map +1 -1
  25. package/dist/module/components/message-parts/tools/mermaid-diagram-tool.js +219 -0
  26. package/dist/module/components/message-parts/tools/mermaid-diagram-tool.js.map +1 -0
  27. package/dist/module/components/message-parts/tools/request-user-input-tool.js +362 -0
  28. package/dist/module/components/message-parts/tools/request-user-input-tool.js.map +1 -0
  29. package/dist/typescript/commonjs/src/components/assistant-screen/assistant-screen.d.ts.map +1 -1
  30. package/dist/typescript/commonjs/src/components/message-parts/message-parts.d.ts.map +1 -1
  31. package/dist/typescript/commonjs/src/components/message-parts/tools/data-table-tool.d.ts +25 -0
  32. package/dist/typescript/commonjs/src/components/message-parts/tools/data-table-tool.d.ts.map +1 -0
  33. package/dist/typescript/commonjs/src/components/message-parts/tools/generate-chart-tool.d.ts +14 -0
  34. package/dist/typescript/commonjs/src/components/message-parts/tools/generate-chart-tool.d.ts.map +1 -0
  35. package/dist/typescript/commonjs/src/components/message-parts/tools/index.d.ts +4 -0
  36. package/dist/typescript/commonjs/src/components/message-parts/tools/index.d.ts.map +1 -1
  37. package/dist/typescript/commonjs/src/components/message-parts/tools/mermaid-diagram-tool.d.ts +13 -0
  38. package/dist/typescript/commonjs/src/components/message-parts/tools/mermaid-diagram-tool.d.ts.map +1 -0
  39. package/dist/typescript/commonjs/src/components/message-parts/tools/request-user-input-tool.d.ts +33 -0
  40. package/dist/typescript/commonjs/src/components/message-parts/tools/request-user-input-tool.d.ts.map +1 -0
  41. package/dist/typescript/module/src/components/assistant-screen/assistant-screen.d.ts.map +1 -1
  42. package/dist/typescript/module/src/components/message-parts/message-parts.d.ts.map +1 -1
  43. package/dist/typescript/module/src/components/message-parts/tools/data-table-tool.d.ts +25 -0
  44. package/dist/typescript/module/src/components/message-parts/tools/data-table-tool.d.ts.map +1 -0
  45. package/dist/typescript/module/src/components/message-parts/tools/generate-chart-tool.d.ts +14 -0
  46. package/dist/typescript/module/src/components/message-parts/tools/generate-chart-tool.d.ts.map +1 -0
  47. package/dist/typescript/module/src/components/message-parts/tools/index.d.ts +4 -0
  48. package/dist/typescript/module/src/components/message-parts/tools/index.d.ts.map +1 -1
  49. package/dist/typescript/module/src/components/message-parts/tools/mermaid-diagram-tool.d.ts +13 -0
  50. package/dist/typescript/module/src/components/message-parts/tools/mermaid-diagram-tool.d.ts.map +1 -0
  51. package/dist/typescript/module/src/components/message-parts/tools/request-user-input-tool.d.ts +33 -0
  52. package/dist/typescript/module/src/components/message-parts/tools/request-user-input-tool.d.ts.map +1 -0
  53. package/package.json +7 -2
@@ -0,0 +1,417 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DataTableTool = DataTableTool;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _lucideReactNative = require("lucide-react-native");
10
+ var _index = require("../../../theme/index.js");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function parseData(raw) {
13
+ if (!raw) return {
14
+ rows: [],
15
+ error: null
16
+ };
17
+ try {
18
+ const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;
19
+ if (Array.isArray(parsed)) return {
20
+ rows: parsed,
21
+ error: null
22
+ };
23
+
24
+ // Handle object with nested data arrays
25
+ if (parsed && typeof parsed === 'object') {
26
+ const nested = parsed.data || parsed.rows || parsed.records || parsed.items;
27
+ if (Array.isArray(nested)) return {
28
+ rows: nested,
29
+ error: null
30
+ };
31
+ }
32
+ return {
33
+ rows: [],
34
+ error: null
35
+ };
36
+ } catch (e) {
37
+ return {
38
+ rows: [],
39
+ error: e.message || 'Failed to parse data'
40
+ };
41
+ }
42
+ }
43
+ function getCellValue(row, field) {
44
+ if (!field) return undefined;
45
+
46
+ // Direct match
47
+ if (field in row) return row[field];
48
+
49
+ // Try case-insensitive match
50
+ const lowerField = field.toLowerCase();
51
+ const matchKey = Object.keys(row).find(k => k.toLowerCase() === lowerField);
52
+ if (matchKey) return row[matchKey];
53
+ return undefined;
54
+ }
55
+ function DataTableTool({
56
+ state,
57
+ data,
58
+ columns,
59
+ title,
60
+ description,
61
+ errorText,
62
+ height,
63
+ additionalComments
64
+ }) {
65
+ const theme = (0, _index.useDocyrusRNAssistantTheme)();
66
+ const [expanded, setExpanded] = (0, _react.useState)(true);
67
+ const [modalOpen, setModalOpen] = (0, _react.useState)(false);
68
+ const {
69
+ rows,
70
+ error: parseError
71
+ } = (0, _react.useMemo)(() => parseData(data), [data]);
72
+ const resolvedColumns = (0, _react.useMemo)(() => {
73
+ if (columns && columns.length > 0) {
74
+ // Normalize: ensure every column has a field
75
+ return columns.map(col => ({
76
+ ...col,
77
+ field: col.field || col.key || col.name || col.title || ''
78
+ }));
79
+ }
80
+ if (rows.length === 0) return [];
81
+ return Object.keys(rows[0]).map(key => ({
82
+ field: key,
83
+ title: key
84
+ }));
85
+ }, [columns, rows]);
86
+
87
+ // Loading state
88
+ if (state === 'input-streaming' || state === 'input-available') {
89
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
90
+ style: {
91
+ flexDirection: 'row',
92
+ alignItems: 'center',
93
+ gap: 6,
94
+ paddingVertical: 5,
95
+ paddingHorizontal: 2
96
+ },
97
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.Table2, {
98
+ size: 12,
99
+ color: theme.colors.mutedForeground
100
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
101
+ style: {
102
+ fontSize: 12,
103
+ fontWeight: '300',
104
+ color: theme.colors.mutedForeground
105
+ },
106
+ children: title || 'Loading table\u2026'
107
+ })]
108
+ });
109
+ }
110
+
111
+ // Error state
112
+ if (state === 'output-error' || parseError) {
113
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
114
+ style: {
115
+ flexDirection: 'row',
116
+ alignItems: 'center',
117
+ gap: 6,
118
+ paddingVertical: 5,
119
+ paddingHorizontal: 2
120
+ },
121
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.XCircle, {
122
+ size: 12,
123
+ color: theme.colors.destructive
124
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
125
+ style: {
126
+ fontSize: 12,
127
+ color: theme.colors.destructive
128
+ },
129
+ children: parseError || errorText || 'Table error'
130
+ })]
131
+ });
132
+ }
133
+ if (rows.length === 0) {
134
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
135
+ style: {
136
+ flexDirection: 'row',
137
+ alignItems: 'center',
138
+ gap: 6,
139
+ paddingVertical: 5,
140
+ paddingHorizontal: 2
141
+ },
142
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.Table2, {
143
+ size: 12,
144
+ color: theme.colors.mutedForeground
145
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
146
+ style: {
147
+ fontSize: 12,
148
+ color: theme.colors.mutedForeground
149
+ },
150
+ children: "No data to display"
151
+ })]
152
+ });
153
+ }
154
+ const cellStyle = {
155
+ paddingHorizontal: 10,
156
+ paddingVertical: 8,
157
+ borderRightWidth: 1,
158
+ borderRightColor: theme.colors.border
159
+ };
160
+ const headerCellStyle = {
161
+ ...cellStyle,
162
+ backgroundColor: theme.isDark ? theme.colors.muted : '#f8fafc'
163
+ };
164
+ const tableHeight = height || 300;
165
+ const renderTable = fixedHeight => {
166
+ const h = fixedHeight || tableHeight;
167
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
168
+ style: {
169
+ height: h
170
+ },
171
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
172
+ horizontal: true,
173
+ showsHorizontalScrollIndicator: true,
174
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
175
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
176
+ style: {
177
+ flexDirection: 'row',
178
+ borderBottomWidth: 1,
179
+ borderBottomColor: theme.colors.border
180
+ },
181
+ children: resolvedColumns.map((col, ci) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
182
+ style: [headerCellStyle, col.width ? {
183
+ width: col.width
184
+ } : {
185
+ minWidth: 120
186
+ }],
187
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
188
+ style: {
189
+ fontSize: 11,
190
+ fontWeight: '600',
191
+ color: theme.colors.foreground
192
+ },
193
+ numberOfLines: 1,
194
+ children: col.title || col.field
195
+ })
196
+ }, `h-${ci}`))
197
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
198
+ nestedScrollEnabled: true,
199
+ children: rows.map((row, ri) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
200
+ style: {
201
+ flexDirection: 'row',
202
+ borderBottomWidth: 1,
203
+ borderBottomColor: theme.colors.border,
204
+ backgroundColor: ri % 2 === 0 ? 'transparent' : theme.isDark ? theme.colors.muted : '#f9fafb'
205
+ },
206
+ children: resolvedColumns.map((col, ci) => {
207
+ const val = getCellValue(row, col.field);
208
+ const display = val === null || val === undefined ? '-' : String(val);
209
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
210
+ style: [cellStyle, col.width ? {
211
+ width: col.width
212
+ } : {
213
+ minWidth: 120
214
+ }],
215
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
216
+ style: {
217
+ fontSize: 11,
218
+ color: theme.colors.foreground
219
+ },
220
+ numberOfLines: 2,
221
+ children: display
222
+ })
223
+ }, `c-${ri}-${ci}`);
224
+ })
225
+ }, `r-${ri}`))
226
+ })]
227
+ })
228
+ })
229
+ });
230
+ };
231
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
232
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
233
+ style: {
234
+ borderRadius: 10,
235
+ borderWidth: 1,
236
+ borderColor: theme.colors.border,
237
+ backgroundColor: theme.colors.card,
238
+ overflow: 'hidden',
239
+ marginVertical: 4
240
+ },
241
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
242
+ onPress: () => setExpanded(!expanded),
243
+ activeOpacity: 0.7,
244
+ style: {
245
+ flexDirection: 'row',
246
+ alignItems: 'center',
247
+ justifyContent: 'space-between',
248
+ backgroundColor: theme.isDark ? theme.colors.muted : '#f9fafb',
249
+ paddingHorizontal: 12,
250
+ paddingVertical: 10
251
+ },
252
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
253
+ style: {
254
+ flexDirection: 'row',
255
+ alignItems: 'center',
256
+ gap: 8,
257
+ flex: 1
258
+ },
259
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.Table2, {
260
+ size: 16,
261
+ color: theme.colors.mutedForeground
262
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
263
+ style: {
264
+ flex: 1
265
+ },
266
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
267
+ style: {
268
+ fontSize: 13,
269
+ fontWeight: '500',
270
+ color: theme.colors.foreground
271
+ },
272
+ numberOfLines: 1,
273
+ children: title || 'Data Table'
274
+ }), description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
275
+ style: {
276
+ fontSize: 11,
277
+ color: theme.colors.mutedForeground,
278
+ marginTop: 1
279
+ },
280
+ numberOfLines: 1,
281
+ children: description
282
+ }) : null]
283
+ })]
284
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.ChevronDown, {
285
+ size: 14,
286
+ color: theme.colors.mutedForeground,
287
+ style: {
288
+ transform: [{
289
+ rotate: expanded ? '180deg' : '0deg'
290
+ }]
291
+ }
292
+ })]
293
+ }), expanded ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
294
+ children: [renderTable(), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
295
+ style: {
296
+ flexDirection: 'row',
297
+ justifyContent: 'space-between',
298
+ alignItems: 'center',
299
+ paddingHorizontal: 12,
300
+ paddingVertical: 6
301
+ },
302
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
303
+ style: {
304
+ fontSize: 10,
305
+ color: theme.colors.mutedForeground
306
+ },
307
+ children: [rows.length, " ", rows.length === 1 ? 'row' : 'rows']
308
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
309
+ onPress: () => setModalOpen(true),
310
+ hitSlop: 8,
311
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
312
+ style: {
313
+ fontSize: 10,
314
+ color: theme.colors.primary
315
+ },
316
+ children: "Expand"
317
+ })
318
+ })]
319
+ }), additionalComments ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
320
+ style: {
321
+ marginHorizontal: 12,
322
+ marginBottom: 10,
323
+ padding: 10,
324
+ backgroundColor: '#eff6ff',
325
+ borderRadius: 8,
326
+ borderWidth: 1,
327
+ borderColor: '#bfdbfe'
328
+ },
329
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
330
+ style: {
331
+ fontSize: 11,
332
+ fontWeight: '500',
333
+ color: '#1e3a5f',
334
+ marginBottom: 2
335
+ },
336
+ children: "Note"
337
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
338
+ style: {
339
+ fontSize: 11,
340
+ color: '#1e40af'
341
+ },
342
+ children: additionalComments
343
+ })]
344
+ }) : null]
345
+ }) : null]
346
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
347
+ visible: modalOpen,
348
+ animationType: "slide",
349
+ presentationStyle: "fullScreen",
350
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.SafeAreaView, {
351
+ style: {
352
+ flex: 1,
353
+ backgroundColor: theme.colors.background
354
+ },
355
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
356
+ style: {
357
+ flexDirection: 'row',
358
+ alignItems: 'center',
359
+ justifyContent: 'space-between',
360
+ backgroundColor: theme.isDark ? theme.colors.muted : '#f9fafb',
361
+ paddingHorizontal: 16,
362
+ paddingVertical: 10
363
+ },
364
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
365
+ style: {
366
+ flexDirection: 'row',
367
+ alignItems: 'center',
368
+ gap: 10,
369
+ flex: 1
370
+ },
371
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.Table2, {
372
+ size: 18,
373
+ color: theme.colors.mutedForeground
374
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
375
+ style: {
376
+ fontSize: 15,
377
+ fontWeight: '500',
378
+ color: theme.colors.foreground,
379
+ flex: 1
380
+ },
381
+ numberOfLines: 1,
382
+ children: title || 'Data Table'
383
+ })]
384
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
385
+ onPress: () => setModalOpen(false),
386
+ hitSlop: 8,
387
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.X, {
388
+ size: 20,
389
+ color: theme.colors.mutedForeground
390
+ })
391
+ })]
392
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
393
+ style: {
394
+ flex: 1
395
+ },
396
+ children: renderTable(undefined)
397
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
398
+ style: {
399
+ paddingHorizontal: 16,
400
+ paddingVertical: 8,
401
+ borderTopWidth: 1,
402
+ borderTopColor: theme.colors.border
403
+ },
404
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
405
+ style: {
406
+ fontSize: 11,
407
+ color: theme.colors.mutedForeground
408
+ },
409
+ children: [rows.length, " ", rows.length === 1 ? 'row' : 'rows']
410
+ })
411
+ })]
412
+ })
413
+ })]
414
+ });
415
+ }
416
+ DataTableTool.displayName = 'DataTableTool';
417
+ //# sourceMappingURL=data-table-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_lucideReactNative","_index","_jsxRuntime","parseData","raw","rows","error","parsed","JSON","parse","Array","isArray","nested","data","records","items","e","message","getCellValue","row","field","undefined","lowerField","toLowerCase","matchKey","Object","keys","find","k","DataTableTool","state","columns","title","description","errorText","height","additionalComments","theme","useDocyrusRNAssistantTheme","expanded","setExpanded","useState","modalOpen","setModalOpen","parseError","useMemo","resolvedColumns","length","map","col","key","name","jsxs","View","style","flexDirection","alignItems","gap","paddingVertical","paddingHorizontal","children","jsx","Table2","size","color","colors","mutedForeground","Text","fontSize","fontWeight","XCircle","destructive","cellStyle","borderRightWidth","borderRightColor","border","headerCellStyle","backgroundColor","isDark","muted","tableHeight","renderTable","fixedHeight","h","ScrollView","horizontal","showsHorizontalScrollIndicator","borderBottomWidth","borderBottomColor","ci","width","minWidth","foreground","numberOfLines","nestedScrollEnabled","ri","val","display","String","Fragment","borderRadius","borderWidth","borderColor","card","overflow","marginVertical","TouchableOpacity","onPress","activeOpacity","justifyContent","flex","marginTop","ChevronDown","transform","rotate","hitSlop","primary","marginHorizontal","marginBottom","padding","Modal","visible","animationType","presentationStyle","SafeAreaView","background","X","borderTopWidth","borderTopColor","displayName"],"sourceRoot":"../../../../../src","sources":["components/message-parts/tools/data-table-tool.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAGA,IAAAE,kBAAA,GAAAF,OAAA;AAIA,IAAAG,MAAA,GAAAH,OAAA;AAA4D,IAAAI,WAAA,GAAAJ,OAAA;AAwB5D,SAASK,SAASA,CAACC,GAA0C,EAAyD;EACpH,IAAI,CAACA,GAAG,EAAE,OAAO;IAAEC,IAAI,EAAE,EAAE;IAAEC,KAAK,EAAE;EAAK,CAAC;EAE1C,IAAI;IACF,MAAMC,MAAM,GAAG,OAAOH,GAAG,KAAK,QAAQ,GAAGI,IAAI,CAACC,KAAK,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qE,cAAc,EAAE,CAAC;YAAEC,cAAc,EAAE3F,KAAK,CAAC4B,MAAM,CAACU;UAC7F,CAAE;UAAAf,QAAA,eACA,IAAA1D,WAAA,CAAAkD,IAAA,EAACrD,YAAA,CAAAoE,IAAI;YAACb,KAAK,EAAE;cAAEc,QAAQ,EAAE,EAAE;cAAEJ,KAAK,EAAE3B,KAAK,CAAC4B,MAAM,CAACC;YAAgB,CAAE;YAAAN,QAAA,GAChEvD,IAAI,CAAC0C,MAAM,EAAC,GAAC,EAAC1C,IAAI,CAAC0C,MAAM,KAAK,CAAC,GAAG,KAAK,GAAG,MAAM;UAAA,CAC7C;QAAC,CACH,CAAC;MAAA,CACK;IAAC,CACV,CAAC;EAAA,CACR,CAAC;AAEP;AAEAlB,aAAa,CAACoG,WAAW,GAAG,eAAe","ignoreList":[]}
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GenerateChartTool = GenerateChartTool;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeWebview = require("react-native-webview");
10
+ var _lucideReactNative = require("lucide-react-native");
11
+ var _index = require("../../../theme/index.js");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function buildChartHtml(spec, data, isDark) {
14
+ const bg = isDark ? '#1e1e2e' : '#ffffff';
15
+
16
+ // Merge data into spec if not already present
17
+ const fullSpec = {
18
+ ...spec
19
+ };
20
+ if (!fullSpec.data && data) {
21
+ fullSpec.data = data;
22
+ }
23
+
24
+ // Apply dark theme if needed
25
+ if (isDark && !fullSpec.background) {
26
+ fullSpec.background = bg;
27
+ }
28
+ return `<!DOCTYPE html>
29
+ <html>
30
+ <head>
31
+ <meta name="viewport" content="width=device-width,initial-scale=1">
32
+ <style>
33
+ html, body { margin:0; padding:0; background:${bg}; overflow:hidden; }
34
+ #chart { width:100%; height:100vh; }
35
+ </style>
36
+ </head>
37
+ <body>
38
+ <div id="chart"></div>
39
+ <script src="https://cdn.jsdelivr.net/npm/@visactor/vchart@1/build/index.min.js"></script>
40
+ <script>
41
+ try {
42
+ var spec = ${JSON.stringify(fullSpec)};
43
+ var chart = new VChart.default(spec, { dom: 'chart' });
44
+ chart.renderSync();
45
+ } catch(e) {
46
+ document.getElementById('chart').innerHTML = '<p style="color:red;padding:16px;">'+e.message+'</p>';
47
+ }
48
+ </script>
49
+ </body>
50
+ </html>`;
51
+ }
52
+ function GenerateChartTool({
53
+ state,
54
+ spec,
55
+ data,
56
+ errorText,
57
+ title
58
+ }) {
59
+ const theme = (0, _index.useDocyrusRNAssistantTheme)();
60
+ const [modalOpen, setModalOpen] = (0, _react.useState)(false);
61
+
62
+ // Loading / streaming state
63
+ if (state === 'input-streaming' || state === 'input-available') {
64
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
65
+ style: {
66
+ flexDirection: 'row',
67
+ alignItems: 'center',
68
+ gap: 6,
69
+ paddingVertical: 5,
70
+ paddingHorizontal: 2
71
+ },
72
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.BarChart3, {
73
+ size: 12,
74
+ color: theme.colors.mutedForeground
75
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
76
+ style: {
77
+ fontSize: 12,
78
+ fontWeight: '300',
79
+ color: theme.colors.mutedForeground
80
+ },
81
+ children: title || 'Generating chart\u2026'
82
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
83
+ size: "small",
84
+ color: theme.colors.mutedForeground
85
+ })]
86
+ });
87
+ }
88
+
89
+ // Error state
90
+ if (state === 'output-error') {
91
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
92
+ style: {
93
+ flexDirection: 'row',
94
+ alignItems: 'center',
95
+ gap: 6,
96
+ paddingVertical: 5,
97
+ paddingHorizontal: 2
98
+ },
99
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.XCircle, {
100
+ size: 12,
101
+ color: theme.colors.destructive
102
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
103
+ style: {
104
+ fontSize: 12,
105
+ color: theme.colors.destructive
106
+ },
107
+ children: ["Chart failed", errorText ? `: ${errorText}` : '']
108
+ })]
109
+ });
110
+ }
111
+ if (!spec || !spec.type) return null;
112
+ const html = (0, _react.useMemo)(() => buildChartHtml(spec, data, theme.isDark), [spec, data, theme.isDark]);
113
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
114
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
115
+ style: {
116
+ borderRadius: 10,
117
+ borderWidth: 1,
118
+ borderColor: theme.colors.border,
119
+ backgroundColor: theme.colors.card,
120
+ overflow: 'hidden',
121
+ marginVertical: 4
122
+ },
123
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
124
+ style: {
125
+ flexDirection: 'row',
126
+ alignItems: 'center',
127
+ justifyContent: 'space-between',
128
+ backgroundColor: theme.isDark ? theme.colors.muted : '#f1f5f9',
129
+ paddingHorizontal: 12,
130
+ paddingVertical: 8
131
+ },
132
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
133
+ style: {
134
+ flexDirection: 'row',
135
+ alignItems: 'center',
136
+ gap: 8,
137
+ flex: 1
138
+ },
139
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.BarChart3, {
140
+ size: 16,
141
+ color: theme.colors.mutedForeground
142
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
143
+ style: {
144
+ fontSize: 13,
145
+ fontWeight: '500',
146
+ color: theme.colors.foreground,
147
+ flex: 1
148
+ },
149
+ numberOfLines: 1,
150
+ children: title || 'Chart'
151
+ })]
152
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
153
+ onPress: () => setModalOpen(true),
154
+ hitSlop: 8,
155
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.Maximize2, {
156
+ size: 14,
157
+ color: theme.colors.mutedForeground
158
+ })
159
+ })]
160
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
161
+ style: {
162
+ height: 300,
163
+ width: '100%'
164
+ },
165
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeWebview.WebView, {
166
+ source: {
167
+ html
168
+ },
169
+ style: {
170
+ flex: 1,
171
+ backgroundColor: 'transparent'
172
+ },
173
+ scrollEnabled: false,
174
+ originWhitelist: ['*'],
175
+ javaScriptEnabled: true
176
+ })
177
+ })]
178
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
179
+ visible: modalOpen,
180
+ animationType: "slide",
181
+ presentationStyle: "fullScreen",
182
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.SafeAreaView, {
183
+ style: {
184
+ flex: 1,
185
+ backgroundColor: theme.isDark ? '#1e1e2e' : '#ffffff'
186
+ },
187
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
188
+ style: {
189
+ flexDirection: 'row',
190
+ alignItems: 'center',
191
+ justifyContent: 'space-between',
192
+ backgroundColor: theme.isDark ? theme.colors.muted : '#f1f5f9',
193
+ paddingHorizontal: 16,
194
+ paddingVertical: 10
195
+ },
196
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
197
+ style: {
198
+ flexDirection: 'row',
199
+ alignItems: 'center',
200
+ gap: 10,
201
+ flex: 1
202
+ },
203
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.BarChart3, {
204
+ size: 20,
205
+ color: theme.colors.mutedForeground
206
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
207
+ style: {
208
+ fontSize: 15,
209
+ fontWeight: '500',
210
+ color: theme.colors.foreground,
211
+ flex: 1
212
+ },
213
+ numberOfLines: 1,
214
+ children: title || 'Chart'
215
+ })]
216
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
217
+ onPress: () => setModalOpen(false),
218
+ hitSlop: 8,
219
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_lucideReactNative.X, {
220
+ size: 20,
221
+ color: theme.colors.mutedForeground
222
+ })
223
+ })]
224
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeWebview.WebView, {
225
+ source: {
226
+ html
227
+ },
228
+ style: {
229
+ flex: 1
230
+ },
231
+ scrollEnabled: false,
232
+ originWhitelist: ['*'],
233
+ javaScriptEnabled: true
234
+ })]
235
+ })
236
+ })]
237
+ });
238
+ }
239
+ GenerateChartTool.displayName = 'GenerateChartTool';
240
+ //# sourceMappingURL=generate-chart-tool.js.map