@mhjuma/traverse 0.1.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 (90) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +46 -0
  3. package/src/bootstrap.spec.tsx +290 -0
  4. package/src/bootstrap.tsx +195 -0
  5. package/src/colors.ts +23 -0
  6. package/src/components/ChartPanel/ChartPanel.logic.spec.ts +358 -0
  7. package/src/components/ChartPanel/ChartPanel.logic.ts +318 -0
  8. package/src/components/ChartPanel/ChartPanel.spec.tsx +331 -0
  9. package/src/components/ChartPanel/ChartPanel.styles.ts +14 -0
  10. package/src/components/ChartPanel/ChartPanel.tsx +151 -0
  11. package/src/components/ConnectionDialog/ConnectionDialog.spec.tsx +767 -0
  12. package/src/components/ConnectionDialog/ConnectionDialog.tsx +652 -0
  13. package/src/components/ConnectionDialog/ConnectionRow.spec.tsx +104 -0
  14. package/src/components/ConnectionDialog/ConnectionRow.tsx +177 -0
  15. package/src/components/EditorToolbar/EditorToolbar.spec.tsx +599 -0
  16. package/src/components/EditorToolbar/EditorToolbar.tsx +259 -0
  17. package/src/components/Explorer/Explorer.spec.tsx +615 -0
  18. package/src/components/Explorer/Explorer.tsx +49 -0
  19. package/src/components/ExplorerWorkspace/ExplorerWorkspace.logic.spec.ts +715 -0
  20. package/src/components/ExplorerWorkspace/ExplorerWorkspace.logic.ts +324 -0
  21. package/src/components/ExplorerWorkspace/ExplorerWorkspace.spec.tsx +450 -0
  22. package/src/components/ExplorerWorkspace/ExplorerWorkspace.styles.ts +478 -0
  23. package/src/components/ExplorerWorkspace/ExplorerWorkspace.tsx +648 -0
  24. package/src/components/ExplorerWorkspace/kqlLanguage.spec.ts +321 -0
  25. package/src/components/ExplorerWorkspace/kqlLanguage.ts +155 -0
  26. package/src/components/ResultsPanel/ElapsedTimer.spec.tsx +51 -0
  27. package/src/components/ResultsPanel/ElapsedTimer.tsx +15 -0
  28. package/src/components/ResultsPanel/HistoryItem.spec.tsx +123 -0
  29. package/src/components/ResultsPanel/HistoryItem.tsx +56 -0
  30. package/src/components/ResultsPanel/ResultSetTab.tsx +18 -0
  31. package/src/components/ResultsPanel/ResultsPanel.spec.tsx +1194 -0
  32. package/src/components/ResultsPanel/ResultsPanel.tsx +321 -0
  33. package/src/components/ResultsPanel/TabButton.tsx +11 -0
  34. package/src/components/ResultsTable/ColumnHeader.tsx +42 -0
  35. package/src/components/ResultsTable/ColumnPickerItem.tsx +16 -0
  36. package/src/components/ResultsTable/FilterCell.tsx +24 -0
  37. package/src/components/ResultsTable/ResultsTable.logic.spec.ts +655 -0
  38. package/src/components/ResultsTable/ResultsTable.logic.ts +264 -0
  39. package/src/components/ResultsTable/ResultsTable.spec.tsx +930 -0
  40. package/src/components/ResultsTable/ResultsTable.styles.ts +108 -0
  41. package/src/components/ResultsTable/ResultsTable.tsx +501 -0
  42. package/src/components/ResultsTable/VirtualCell.spec.tsx +55 -0
  43. package/src/components/ResultsTable/VirtualCell.tsx +32 -0
  44. package/src/components/ResultsTable/VirtualRow.tsx +55 -0
  45. package/src/components/SchemaSidebar/FolderRow.tsx +35 -0
  46. package/src/components/SchemaSidebar/SchemaColumnItem.tsx +41 -0
  47. package/src/components/SchemaSidebar/SchemaContextMenu.spec.tsx +148 -0
  48. package/src/components/SchemaSidebar/SchemaContextMenu.tsx +49 -0
  49. package/src/components/SchemaSidebar/SchemaSidebar.logic.spec.ts +230 -0
  50. package/src/components/SchemaSidebar/SchemaSidebar.logic.ts +74 -0
  51. package/src/components/SchemaSidebar/SchemaSidebar.spec.tsx +1111 -0
  52. package/src/components/SchemaSidebar/SchemaSidebar.tsx +244 -0
  53. package/src/components/SchemaSidebar/SchemaTableItem.tsx +77 -0
  54. package/src/components/TabBar/TabBar.logic.spec.ts +127 -0
  55. package/src/components/TabBar/TabBar.logic.ts +35 -0
  56. package/src/components/TabBar/TabBar.spec.tsx +929 -0
  57. package/src/components/TabBar/TabBar.tsx +284 -0
  58. package/src/components/TabBar/TabItem.tsx +166 -0
  59. package/src/components/VegaChart/VegaChart.spec.tsx +126 -0
  60. package/src/components/VegaChart/VegaChart.tsx +224 -0
  61. package/src/config.spec.ts +44 -0
  62. package/src/config.ts +47 -0
  63. package/src/context/ExplorerColorContext.ts +14 -0
  64. package/src/context/ExplorerStateContext.ts +49 -0
  65. package/src/context/KustoClientContext.ts +12 -0
  66. package/src/context/context.spec.tsx +183 -0
  67. package/src/index.ts +14 -0
  68. package/src/services/cache.spec.ts +31 -0
  69. package/src/services/cache.ts +16 -0
  70. package/src/services/concurrency.spec.ts +139 -0
  71. package/src/services/concurrency.ts +46 -0
  72. package/src/services/kusto.spec.ts +919 -0
  73. package/src/services/kusto.ts +472 -0
  74. package/src/services/queryHistory.spec.ts +287 -0
  75. package/src/services/queryHistory.ts +146 -0
  76. package/src/services/schema.spec.ts +618 -0
  77. package/src/services/schema.ts +294 -0
  78. package/src/services/state-service.spec.ts +670 -0
  79. package/src/services/state-service.ts +602 -0
  80. package/src/services/useKustoQuery.spec.ts +234 -0
  81. package/src/services/useKustoQuery.ts +124 -0
  82. package/src/state/actions.ts +50 -0
  83. package/src/state/index.ts +3 -0
  84. package/src/state/reducer.spec.ts +644 -0
  85. package/src/state/reducer.ts +207 -0
  86. package/src/state/types.ts +54 -0
  87. package/tsconfig.json +7 -0
  88. package/tsconfig.lint.json +4 -0
  89. package/tsconfig.spec.json +7 -0
  90. package/vitest.config.ts +34 -0
@@ -0,0 +1,478 @@
1
+ import { makeStyles, tokens } from '@fluentui/react-components';
2
+
3
+ export const useExplorerStyles = makeStyles({
4
+ page: {
5
+ display: 'flex',
6
+ flexDirection: 'column',
7
+ height: 'calc(100vh - 57px)',
8
+ margin: '-24px',
9
+ overflow: 'hidden',
10
+ },
11
+ pageWebView: {
12
+ display: 'flex',
13
+ flexDirection: 'column',
14
+ height: 'calc(100vh - 1px)',
15
+ margin: '-24px',
16
+ overflow: 'hidden',
17
+ },
18
+ queryTabBar: {
19
+ display: 'flex',
20
+ alignItems: 'center',
21
+ backgroundColor: tokens.colorNeutralBackground1,
22
+ borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,
23
+ minHeight: '36px',
24
+ paddingTop: '4px',
25
+ },
26
+ queryTabList: {
27
+ display: 'flex',
28
+ alignItems: 'flex-end',
29
+ minWidth: 0,
30
+ overflowX: 'auto' as const,
31
+ overflowY: 'hidden' as const,
32
+ gap: '2px',
33
+ paddingLeft: '4px',
34
+ scrollbarWidth: 'none' as const,
35
+ '&::-webkit-scrollbar': {
36
+ display: 'none',
37
+ },
38
+ },
39
+ queryTab: {
40
+ display: 'flex',
41
+ alignItems: 'center',
42
+ gap: '6px',
43
+ padding: '6px 12px',
44
+ fontSize: '12px',
45
+ cursor: 'pointer',
46
+ color: tokens.colorNeutralForeground3,
47
+ borderRadius: '6px 6px 0 0',
48
+ whiteSpace: 'nowrap' as const,
49
+ userSelect: 'none' as const,
50
+ transition: 'background-color 120ms ease, color 120ms ease',
51
+ WebkitUserDrag: 'element',
52
+ '&:hover': {
53
+ backgroundColor: tokens.colorNeutralBackground2,
54
+ color: tokens.colorNeutralForeground1,
55
+ },
56
+ '& > .tab-close': {
57
+ opacity: 0,
58
+ transition: 'opacity 120ms ease',
59
+ },
60
+ '&:hover > .tab-close': {
61
+ opacity: 1,
62
+ },
63
+ },
64
+ queryTabActive: {
65
+ display: 'flex',
66
+ alignItems: 'center',
67
+ gap: '6px',
68
+ padding: '6px 12px',
69
+ fontSize: '12px',
70
+ cursor: 'pointer',
71
+ color: tokens.colorNeutralForeground1,
72
+ backgroundColor: tokens.colorNeutralBackground2,
73
+ borderRadius: '6px 6px 0 0',
74
+ borderBottom: `2px solid ${tokens.colorBrandForeground1}`,
75
+ whiteSpace: 'nowrap' as const,
76
+ userSelect: 'none' as const,
77
+ transition: 'background-color 120ms ease, color 120ms ease',
78
+ WebkitUserDrag: 'element',
79
+ },
80
+ queryTabClose: {
81
+ display: 'flex',
82
+ alignItems: 'center',
83
+ justifyContent: 'center',
84
+ width: '16px',
85
+ height: '16px',
86
+ padding: '0',
87
+ cursor: 'pointer',
88
+ color: tokens.colorNeutralForeground3,
89
+ borderRadius: '3px',
90
+ transition: 'color 120ms ease, background-color 120ms ease',
91
+ '&:hover': {
92
+ color: tokens.colorNeutralForeground1,
93
+ backgroundColor: tokens.colorNeutralBackground3,
94
+ },
95
+ },
96
+ contextMenu: {
97
+ position: 'absolute' as const,
98
+ zIndex: 100,
99
+ backgroundColor: tokens.colorNeutralBackground1,
100
+ border: `1px solid ${tokens.colorNeutralStroke1}`,
101
+ borderRadius: '4px',
102
+ boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
103
+ padding: '4px 0',
104
+ minWidth: '120px',
105
+ },
106
+ contextMenuItem: {
107
+ padding: '6px 12px',
108
+ fontSize: '12px',
109
+ cursor: 'pointer',
110
+ color: tokens.colorNeutralForeground1,
111
+ '&:hover': {
112
+ backgroundColor: tokens.colorNeutralBackground2,
113
+ },
114
+ },
115
+ contextMenuDanger: {
116
+ padding: '6px 12px',
117
+ fontSize: '12px',
118
+ cursor: 'pointer',
119
+ color: tokens.colorPaletteRedForeground1,
120
+ '&:hover': {
121
+ backgroundColor: tokens.colorPaletteRedBackground1,
122
+ },
123
+ },
124
+ editorDropTarget: {
125
+ position: 'absolute' as const,
126
+ backgroundColor: 'rgba(0, 120, 212, 0.1)',
127
+ border: `2px dashed ${tokens.colorBrandStroke1}`,
128
+ display: 'flex',
129
+ alignItems: 'center',
130
+ justifyContent: 'center',
131
+ zIndex: 10,
132
+ pointerEvents: 'none' as const,
133
+ fontSize: '12px',
134
+ color: tokens.colorBrandForeground1,
135
+ fontWeight: '600',
136
+ },
137
+ queryTabActions: {
138
+ display: 'flex',
139
+ alignItems: 'center',
140
+ gap: '2px',
141
+ padding: '0 4px',
142
+ marginLeft: 'auto',
143
+ },
144
+ tabDropIndicator: {
145
+ width: '2px',
146
+ alignSelf: 'stretch',
147
+ backgroundColor: tokens.colorBrandForeground1,
148
+ borderRadius: '1px',
149
+ flexShrink: 0,
150
+ },
151
+ activeFilter: {
152
+ color: tokens.colorBrandForeground1,
153
+ },
154
+ splitBadge: {
155
+ display: 'inline-flex',
156
+ alignItems: 'center',
157
+ justifyContent: 'center',
158
+ fontSize: '9px',
159
+ fontWeight: '600',
160
+ lineHeight: 1,
161
+ padding: '1px 4px',
162
+ borderRadius: '3px',
163
+ marginLeft: '4px',
164
+ flexShrink: 0,
165
+ },
166
+ toolbar: {
167
+ display: 'flex',
168
+ alignItems: 'center',
169
+ justifyContent: 'space-between',
170
+ padding: '4px 12px',
171
+ backgroundColor: tokens.colorNeutralBackground2,
172
+ borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,
173
+ minHeight: '36px',
174
+ },
175
+ toolbarLeft: {
176
+ display: 'flex',
177
+ alignItems: 'center',
178
+ gap: '8px',
179
+ },
180
+ toolbarRight: {
181
+ display: 'flex',
182
+ alignItems: 'center',
183
+ gap: '8px',
184
+ },
185
+ splitContainer: {
186
+ display: 'flex',
187
+ flexDirection: 'column',
188
+ flex: 1,
189
+ minHeight: 0,
190
+ overflow: 'hidden',
191
+ },
192
+ editorArea: {
193
+ display: 'flex',
194
+ flexDirection: 'row',
195
+ minHeight: 0,
196
+ overflow: 'hidden',
197
+ },
198
+ schemaList: {
199
+ width: '100%',
200
+ height: '100%',
201
+ borderRight: `1px solid ${tokens.colorNeutralStroke2}`,
202
+ backgroundColor: tokens.colorNeutralBackground2,
203
+ overflow: 'hidden',
204
+ padding: '0',
205
+ fontSize: '12px',
206
+ display: 'flex',
207
+ flexDirection: 'column',
208
+ },
209
+ schemaSearch: {
210
+ padding: '4px 6px',
211
+ borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,
212
+ flexShrink: 0,
213
+ },
214
+ schemaSearchInput: {
215
+ width: '100%',
216
+ fontSize: '11px',
217
+ },
218
+ schemaResizeHandle: {
219
+ width: '4px',
220
+ cursor: 'col-resize',
221
+ backgroundColor: 'transparent',
222
+ flexShrink: 0,
223
+ '&:hover': {
224
+ backgroundColor: tokens.colorBrandBackground,
225
+ },
226
+ },
227
+ schemaTree: {
228
+ flex: 1,
229
+ overflow: 'auto',
230
+ padding: '2px 0',
231
+ },
232
+ folderRow: {
233
+ display: 'flex',
234
+ alignItems: 'center',
235
+ gap: '4px',
236
+ padding: '4px 8px',
237
+ cursor: 'pointer',
238
+ color: tokens.colorNeutralForeground3,
239
+ fontWeight: '600',
240
+ fontSize: '11px',
241
+ userSelect: 'none' as const,
242
+ whiteSpace: 'nowrap' as const,
243
+ overflow: 'hidden',
244
+ '&:hover': {
245
+ backgroundColor: tokens.colorNeutralBackground3,
246
+ },
247
+ },
248
+ schemaItem: {
249
+ display: 'flex',
250
+ alignItems: 'center',
251
+ gap: '4px',
252
+ padding: '3px 8px 3px 20px',
253
+ cursor: 'pointer',
254
+ color: tokens.colorNeutralForeground2,
255
+ whiteSpace: 'nowrap' as const,
256
+ overflow: 'hidden',
257
+ textOverflow: 'ellipsis',
258
+ fontSize: '11px',
259
+ '&:hover': {
260
+ backgroundColor: tokens.colorNeutralBackground3,
261
+ color: tokens.colorNeutralForeground1,
262
+ },
263
+ },
264
+ schemaColumn: {
265
+ display: 'flex',
266
+ alignItems: 'center',
267
+ gap: '4px',
268
+ padding: '2px 8px 2px 40px',
269
+ cursor: 'pointer',
270
+ color: tokens.colorNeutralForeground3,
271
+ whiteSpace: 'nowrap' as const,
272
+ overflow: 'hidden',
273
+ textOverflow: 'ellipsis',
274
+ fontSize: '10px',
275
+ '&:hover': {
276
+ backgroundColor: tokens.colorNeutralBackground3,
277
+ color: tokens.colorNeutralForeground2,
278
+ },
279
+ },
280
+ schemaColType: {
281
+ color: tokens.colorNeutralForeground4,
282
+ fontSize: '9px',
283
+ marginLeft: 'auto',
284
+ flexShrink: 0,
285
+ },
286
+ editorContainer: {
287
+ flex: 1,
288
+ minWidth: 0,
289
+ minHeight: 0,
290
+ position: 'relative' as const,
291
+ },
292
+ editorSplitHandle: {
293
+ backgroundColor: tokens.colorNeutralStroke1,
294
+ flexShrink: 0,
295
+ '&:hover': {
296
+ backgroundColor: tokens.colorBrandBackground,
297
+ },
298
+ },
299
+ editorSplitArea: {
300
+ display: 'flex',
301
+ flex: 1,
302
+ minWidth: 0,
303
+ minHeight: 0,
304
+ overflow: 'hidden',
305
+ },
306
+ editorPaneFocused: {
307
+ flex: 1,
308
+ minWidth: 0,
309
+ minHeight: 0,
310
+ outline: `1px solid ${tokens.colorBrandStroke1}`,
311
+ outlineOffset: '-1px',
312
+ },
313
+ editorPaneUnfocused: {
314
+ flex: 1,
315
+ minWidth: 0,
316
+ minHeight: 0,
317
+ },
318
+ dragHandle: {
319
+ height: '4px',
320
+ cursor: 'row-resize',
321
+ backgroundColor: tokens.colorNeutralStroke1,
322
+ flexShrink: 0,
323
+ '&:hover': {
324
+ height: '6px',
325
+ backgroundColor: tokens.colorBrandBackground,
326
+ },
327
+ },
328
+ resultsPanel: {
329
+ minHeight: '80px',
330
+ display: 'flex',
331
+ flexDirection: 'column',
332
+ overflow: 'hidden',
333
+ },
334
+ resultsHeader: {
335
+ display: 'flex',
336
+ alignItems: 'center',
337
+ justifyContent: 'space-between',
338
+ padding: '4px 12px',
339
+ backgroundColor: tokens.colorNeutralBackground2,
340
+ borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,
341
+ minHeight: '32px',
342
+ },
343
+ resultsStats: {
344
+ display: 'flex',
345
+ gap: '12px',
346
+ alignItems: 'center',
347
+ },
348
+ stat: {
349
+ color: tokens.colorNeutralForeground3,
350
+ fontSize: '11px',
351
+ },
352
+ errorBox: {
353
+ margin: '8px',
354
+ padding: '8px 12px',
355
+ borderRadius: '4px',
356
+ backgroundColor: tokens.colorPaletteRedBackground1,
357
+ color: tokens.colorPaletteRedForeground1,
358
+ fontFamily: 'Consolas, Monaco, monospace',
359
+ fontSize: '12px',
360
+ whiteSpace: 'pre-wrap' as const,
361
+ },
362
+ emptyState: {
363
+ display: 'flex',
364
+ flexDirection: 'column',
365
+ alignItems: 'center',
366
+ justifyContent: 'center',
367
+ gap: '8px',
368
+ flex: 1,
369
+ color: tokens.colorNeutralForeground3,
370
+ },
371
+ tabStrip: {
372
+ display: 'flex',
373
+ alignItems: 'center',
374
+ gap: '0',
375
+ },
376
+ tab: {
377
+ padding: '4px 12px',
378
+ fontSize: '11px',
379
+ fontWeight: '600',
380
+ cursor: 'pointer',
381
+ color: tokens.colorNeutralForeground3,
382
+ userSelect: 'none' as const,
383
+ backgroundColor: 'transparent',
384
+ borderTop: 'none',
385
+ borderLeft: 'none',
386
+ borderRight: 'none',
387
+ borderBottom: '2px solid transparent',
388
+ outline: 'none',
389
+ '&:hover': {
390
+ color: tokens.colorNeutralForeground1,
391
+ },
392
+ },
393
+ tabActive: {
394
+ padding: '4px 12px',
395
+ fontSize: '11px',
396
+ fontWeight: '600',
397
+ cursor: 'pointer',
398
+ color: tokens.colorBrandForeground1,
399
+ userSelect: 'none' as const,
400
+ backgroundColor: 'transparent',
401
+ borderTop: 'none',
402
+ borderLeft: 'none',
403
+ borderRight: 'none',
404
+ borderBottom: `2px solid ${tokens.colorBrandForeground1}`,
405
+ outline: 'none',
406
+ },
407
+ historyList: {
408
+ flex: 1,
409
+ overflow: 'auto',
410
+ padding: '0',
411
+ },
412
+ historyItem: {
413
+ display: 'flex',
414
+ flexDirection: 'column',
415
+ gap: '2px',
416
+ padding: '8px 12px',
417
+ cursor: 'pointer',
418
+ backgroundColor: 'transparent',
419
+ borderTop: 'none',
420
+ borderLeft: 'none',
421
+ borderRight: 'none',
422
+ borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,
423
+ outline: 'none',
424
+ textAlign: 'left' as const,
425
+ width: '100%',
426
+ '&:hover': {
427
+ backgroundColor: tokens.colorNeutralBackground2,
428
+ },
429
+ },
430
+ historyQuery: {
431
+ fontFamily: 'Consolas, Monaco, monospace',
432
+ fontSize: '11px',
433
+ color: tokens.colorNeutralForeground1,
434
+ whiteSpace: 'nowrap' as const,
435
+ overflow: 'hidden',
436
+ textOverflow: 'ellipsis',
437
+ },
438
+ historyMeta: {
439
+ display: 'flex',
440
+ gap: '12px',
441
+ fontSize: '10px',
442
+ color: tokens.colorNeutralForeground3,
443
+ },
444
+ historyError: {
445
+ color: tokens.colorPaletteRedForeground1,
446
+ },
447
+ historyRecallable: {
448
+ color: tokens.colorBrandForeground1,
449
+ fontSize: '10px',
450
+ },
451
+ statsGrid: {
452
+ display: 'grid',
453
+ gridTemplateColumns: '1fr 1fr',
454
+ gap: '0',
455
+ flex: 1,
456
+ overflow: 'auto',
457
+ alignContent: 'start',
458
+ },
459
+ statsCard: {
460
+ display: 'flex',
461
+ flexDirection: 'column',
462
+ gap: '2px',
463
+ padding: '10px 16px',
464
+ borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,
465
+ borderRight: `1px solid ${tokens.colorNeutralStroke2}`,
466
+ },
467
+ statsLabel: {
468
+ fontSize: '10px',
469
+ color: tokens.colorNeutralForeground3,
470
+ textTransform: 'uppercase' as const,
471
+ letterSpacing: '0.5px',
472
+ },
473
+ statsValue: {
474
+ fontSize: '14px',
475
+ fontFamily: 'Consolas, Monaco, monospace',
476
+ color: tokens.colorNeutralForeground1,
477
+ },
478
+ });