juxscript 1.1.240 → 1.1.244

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 (297) hide show
  1. package/index.js +7 -137
  2. package/lib/components/dataframe.ts +0 -569
  3. package/lib/components/include.ts +229 -229
  4. package/lib/components/tag.ts +68 -0
  5. package/lib/styles/shadcn.css +17 -5
  6. package/lib/utils/idgen.ts +6 -0
  7. package/package.json +5 -6
  8. package/index.d.ts +0 -239
  9. package/index.d.ts.map +0 -1
  10. package/lib/components/alert.d.ts +0 -36
  11. package/lib/components/alert.d.ts.map +0 -1
  12. package/lib/components/alert.js +0 -172
  13. package/lib/components/alert.ts +0 -219
  14. package/lib/components/app.d.ts +0 -89
  15. package/lib/components/app.d.ts.map +0 -1
  16. package/lib/components/app.js +0 -175
  17. package/lib/components/app.ts +0 -247
  18. package/lib/components/badge.d.ts +0 -26
  19. package/lib/components/badge.d.ts.map +0 -1
  20. package/lib/components/badge.js +0 -91
  21. package/lib/components/badge.ts +0 -118
  22. package/lib/components/base/Animations.d.ts +0 -36
  23. package/lib/components/base/Animations.d.ts.map +0 -1
  24. package/lib/components/base/Animations.js +0 -70
  25. package/lib/components/base/Animations.ts +0 -112
  26. package/lib/components/base/BaseComponent.d.ts +0 -294
  27. package/lib/components/base/BaseComponent.d.ts.map +0 -1
  28. package/lib/components/base/BaseComponent.js +0 -735
  29. package/lib/components/base/BaseComponent.ts +0 -884
  30. package/lib/components/base/FormInput.d.ts +0 -77
  31. package/lib/components/base/FormInput.d.ts.map +0 -1
  32. package/lib/components/base/FormInput.js +0 -171
  33. package/lib/components/base/FormInput.ts +0 -237
  34. package/lib/components/blueprint.d.ts +0 -40
  35. package/lib/components/blueprint.d.ts.map +0 -1
  36. package/lib/components/blueprint.js +0 -327
  37. package/lib/components/button.d.ts +0 -70
  38. package/lib/components/button.d.ts.map +0 -1
  39. package/lib/components/button.js +0 -177
  40. package/lib/components/button.ts +0 -237
  41. package/lib/components/card.d.ts +0 -35
  42. package/lib/components/card.d.ts.map +0 -1
  43. package/lib/components/card.js +0 -130
  44. package/lib/components/card.ts +0 -177
  45. package/lib/components/chart.d.ts +0 -49
  46. package/lib/components/chart.d.ts.map +0 -1
  47. package/lib/components/chart.js +0 -205
  48. package/lib/components/chart.ts +0 -254
  49. package/lib/components/checkbox.d.ts +0 -33
  50. package/lib/components/checkbox.d.ts.map +0 -1
  51. package/lib/components/checkbox.js +0 -202
  52. package/lib/components/checkbox.ts +0 -260
  53. package/lib/components/code.d.ts +0 -52
  54. package/lib/components/code.d.ts.map +0 -1
  55. package/lib/components/code.js +0 -201
  56. package/lib/components/code.ts +0 -260
  57. package/lib/components/container.d.ts +0 -60
  58. package/lib/components/container.d.ts.map +0 -1
  59. package/lib/components/container.js +0 -195
  60. package/lib/components/container.ts +0 -259
  61. package/lib/components/data.d.ts +0 -36
  62. package/lib/components/data.d.ts.map +0 -1
  63. package/lib/components/data.js +0 -110
  64. package/lib/components/data.ts +0 -135
  65. package/lib/components/dataframe/DataFrameSource.d.ts +0 -118
  66. package/lib/components/dataframe/DataFrameSource.d.ts.map +0 -1
  67. package/lib/components/dataframe/DataFrameSource.js +0 -421
  68. package/lib/components/dataframe/DataFrameSource.ts +0 -532
  69. package/lib/components/dataframe/ImportSettingsModal.d.ts +0 -60
  70. package/lib/components/dataframe/ImportSettingsModal.d.ts.map +0 -1
  71. package/lib/components/dataframe/ImportSettingsModal.js +0 -442
  72. package/lib/components/dataframe/ImportSettingsModal.ts +0 -531
  73. package/lib/components/dataframe.d.ts +0 -110
  74. package/lib/components/dataframe.d.ts.map +0 -1
  75. package/lib/components/dataframe.js +0 -470
  76. package/lib/components/datepicker.d.ts +0 -40
  77. package/lib/components/datepicker.d.ts.map +0 -1
  78. package/lib/components/datepicker.js +0 -193
  79. package/lib/components/datepicker.ts +0 -251
  80. package/lib/components/dialog.d.ts +0 -39
  81. package/lib/components/dialog.d.ts.map +0 -1
  82. package/lib/components/dialog.js +0 -131
  83. package/lib/components/dialog.ts +0 -178
  84. package/lib/components/divider.d.ts +0 -31
  85. package/lib/components/divider.d.ts.map +0 -1
  86. package/lib/components/divider.js +0 -72
  87. package/lib/components/divider.ts +0 -104
  88. package/lib/components/dropdown-menu.d.ts +0 -42
  89. package/lib/components/dropdown-menu.d.ts.map +0 -1
  90. package/lib/components/dropdown-menu.js +0 -177
  91. package/lib/components/dropdown-menu.ts +0 -214
  92. package/lib/components/dropdown.d.ts +0 -41
  93. package/lib/components/dropdown.d.ts.map +0 -1
  94. package/lib/components/dropdown.js +0 -136
  95. package/lib/components/dropdown.ts +0 -188
  96. package/lib/components/element.d.ts +0 -51
  97. package/lib/components/element.d.ts.map +0 -1
  98. package/lib/components/element.js +0 -209
  99. package/lib/components/element.ts +0 -271
  100. package/lib/components/event-chain.d.ts +0 -9
  101. package/lib/components/event-chain.d.ts.map +0 -1
  102. package/lib/components/event-chain.js +0 -33
  103. package/lib/components/fileupload.d.ts +0 -98
  104. package/lib/components/fileupload.d.ts.map +0 -1
  105. package/lib/components/fileupload.js +0 -351
  106. package/lib/components/fileupload.ts +0 -449
  107. package/lib/components/grid.d.ts +0 -88
  108. package/lib/components/grid.d.ts.map +0 -1
  109. package/lib/components/grid.js +0 -208
  110. package/lib/components/grid.ts +0 -295
  111. package/lib/components/heading.d.ts +0 -25
  112. package/lib/components/heading.d.ts.map +0 -1
  113. package/lib/components/heading.js +0 -83
  114. package/lib/components/heading.ts +0 -113
  115. package/lib/components/helpers.d.ts +0 -9
  116. package/lib/components/helpers.d.ts.map +0 -1
  117. package/lib/components/helpers.js +0 -30
  118. package/lib/components/helpers.ts +0 -41
  119. package/lib/components/hero.d.ts +0 -60
  120. package/lib/components/hero.d.ts.map +0 -1
  121. package/lib/components/hero.js +0 -239
  122. package/lib/components/hero.ts +0 -302
  123. package/lib/components/history/StateHistory.d.ts +0 -91
  124. package/lib/components/history/StateHistory.d.ts.map +0 -1
  125. package/lib/components/history/StateHistory.js +0 -154
  126. package/lib/components/history/StateHistory.ts +0 -200
  127. package/lib/components/icon.d.ts +0 -36
  128. package/lib/components/icon.d.ts.map +0 -1
  129. package/lib/components/icon.js +0 -135
  130. package/lib/components/icon.ts +0 -182
  131. package/lib/components/icons.d.ts +0 -25
  132. package/lib/components/icons.d.ts.map +0 -1
  133. package/lib/components/icons.js +0 -440
  134. package/lib/components/icons.ts +0 -464
  135. package/lib/components/image.d.ts +0 -42
  136. package/lib/components/image.d.ts.map +0 -1
  137. package/lib/components/image.js +0 -204
  138. package/lib/components/image.ts +0 -260
  139. package/lib/components/include.d.ts +0 -86
  140. package/lib/components/include.d.ts.map +0 -1
  141. package/lib/components/include.js +0 -238
  142. package/lib/components/input.d.ts +0 -85
  143. package/lib/components/input.d.ts.map +0 -1
  144. package/lib/components/input.js +0 -362
  145. package/lib/components/input.ts +0 -473
  146. package/lib/components/layer.d.ts +0 -72
  147. package/lib/components/layer.d.ts.map +0 -1
  148. package/lib/components/layer.js +0 -219
  149. package/lib/components/layer.ts +0 -304
  150. package/lib/components/link.d.ts +0 -41
  151. package/lib/components/link.d.ts.map +0 -1
  152. package/lib/components/link.js +0 -216
  153. package/lib/components/link.ts +0 -268
  154. package/lib/components/list.d.ts +0 -83
  155. package/lib/components/list.d.ts.map +0 -1
  156. package/lib/components/list.js +0 -314
  157. package/lib/components/list.ts +0 -423
  158. package/lib/components/loading.d.ts +0 -25
  159. package/lib/components/loading.d.ts.map +0 -1
  160. package/lib/components/loading.js +0 -76
  161. package/lib/components/loading.ts +0 -104
  162. package/lib/components/menu.d.ts +0 -38
  163. package/lib/components/menu.d.ts.map +0 -1
  164. package/lib/components/menu.js +0 -205
  165. package/lib/components/menu.ts +0 -279
  166. package/lib/components/modal.d.ts +0 -97
  167. package/lib/components/modal.d.ts.map +0 -1
  168. package/lib/components/modal.js +0 -463
  169. package/lib/components/modal.ts +0 -576
  170. package/lib/components/nav.d.ts +0 -46
  171. package/lib/components/nav.d.ts.map +0 -1
  172. package/lib/components/nav.js +0 -193
  173. package/lib/components/nav.ts +0 -261
  174. package/lib/components/paragraph.d.ts +0 -30
  175. package/lib/components/paragraph.d.ts.map +0 -1
  176. package/lib/components/paragraph.js +0 -93
  177. package/lib/components/paragraph.ts +0 -123
  178. package/lib/components/pen.d.ts +0 -125
  179. package/lib/components/pen.d.ts.map +0 -1
  180. package/lib/components/pen.js +0 -443
  181. package/lib/components/pen.ts +0 -567
  182. package/lib/components/progress.d.ts +0 -40
  183. package/lib/components/progress.d.ts.map +0 -1
  184. package/lib/components/progress.js +0 -116
  185. package/lib/components/progress.ts +0 -163
  186. package/lib/components/radio.d.ts +0 -43
  187. package/lib/components/radio.d.ts.map +0 -1
  188. package/lib/components/radio.js +0 -226
  189. package/lib/components/radio.ts +0 -303
  190. package/lib/components/registry.d.ts +0 -34
  191. package/lib/components/registry.d.ts.map +0 -1
  192. package/lib/components/registry.js +0 -163
  193. package/lib/components/registry.ts +0 -193
  194. package/lib/components/req.d.ts +0 -155
  195. package/lib/components/req.d.ts.map +0 -1
  196. package/lib/components/req.js +0 -253
  197. package/lib/components/req.ts +0 -303
  198. package/lib/components/script.d.ts +0 -14
  199. package/lib/components/script.d.ts.map +0 -1
  200. package/lib/components/script.js +0 -33
  201. package/lib/components/script.ts +0 -41
  202. package/lib/components/select.d.ts +0 -42
  203. package/lib/components/select.d.ts.map +0 -1
  204. package/lib/components/select.js +0 -209
  205. package/lib/components/select.ts +0 -281
  206. package/lib/components/sidebar.d.ts +0 -59
  207. package/lib/components/sidebar.d.ts.map +0 -1
  208. package/lib/components/sidebar.js +0 -298
  209. package/lib/components/sidebar.ts +0 -395
  210. package/lib/components/stack/BaseStack.d.ts +0 -65
  211. package/lib/components/stack/BaseStack.d.ts.map +0 -1
  212. package/lib/components/stack/BaseStack.js +0 -274
  213. package/lib/components/stack/BaseStack.ts +0 -328
  214. package/lib/components/stack/HStack.d.ts +0 -18
  215. package/lib/components/stack/HStack.d.ts.map +0 -1
  216. package/lib/components/stack/HStack.js +0 -22
  217. package/lib/components/stack/HStack.ts +0 -25
  218. package/lib/components/stack/VStack.d.ts +0 -19
  219. package/lib/components/stack/VStack.d.ts.map +0 -1
  220. package/lib/components/stack/VStack.js +0 -23
  221. package/lib/components/stack/VStack.ts +0 -26
  222. package/lib/components/stack/ZStack.d.ts +0 -18
  223. package/lib/components/stack/ZStack.d.ts.map +0 -1
  224. package/lib/components/stack/ZStack.js +0 -22
  225. package/lib/components/stack/ZStack.ts +0 -25
  226. package/lib/components/style.d.ts +0 -14
  227. package/lib/components/style.d.ts.map +0 -1
  228. package/lib/components/style.js +0 -33
  229. package/lib/components/style.ts +0 -41
  230. package/lib/components/switch.d.ts +0 -34
  231. package/lib/components/switch.d.ts.map +0 -1
  232. package/lib/components/switch.js +0 -209
  233. package/lib/components/switch.ts +0 -272
  234. package/lib/components/table.d.ts +0 -137
  235. package/lib/components/table.d.ts.map +0 -1
  236. package/lib/components/table.js +0 -1019
  237. package/lib/components/table.ts +0 -1225
  238. package/lib/components/tabs.d.ts +0 -53
  239. package/lib/components/tabs.d.ts.map +0 -1
  240. package/lib/components/tabs.js +0 -275
  241. package/lib/components/tabs.ts +0 -349
  242. package/lib/components/theme-toggle.d.ts +0 -45
  243. package/lib/components/theme-toggle.d.ts.map +0 -1
  244. package/lib/components/theme-toggle.js +0 -218
  245. package/lib/components/theme-toggle.ts +0 -297
  246. package/lib/components/tooltip.d.ts +0 -31
  247. package/lib/components/tooltip.d.ts.map +0 -1
  248. package/lib/components/tooltip.js +0 -112
  249. package/lib/components/tooltip.ts +0 -148
  250. package/lib/components/watcher.d.ts +0 -195
  251. package/lib/components/watcher.d.ts.map +0 -1
  252. package/lib/components/watcher.js +0 -241
  253. package/lib/components/watcher.ts +0 -261
  254. package/lib/components/write.d.ts +0 -107
  255. package/lib/components/write.d.ts.map +0 -1
  256. package/lib/components/write.js +0 -222
  257. package/lib/components/write.ts +0 -272
  258. package/lib/data/DataPipeline.d.ts +0 -113
  259. package/lib/data/DataPipeline.d.ts.map +0 -1
  260. package/lib/data/DataPipeline.js +0 -359
  261. package/lib/data/DataPipeline.ts +0 -452
  262. package/lib/facades/dataframe.jux +0 -0
  263. package/lib/globals.d.ts +0 -21
  264. package/lib/reactivity/state.d.ts +0 -36
  265. package/lib/reactivity/state.d.ts.map +0 -1
  266. package/lib/reactivity/state.js +0 -67
  267. package/lib/reactivity/state.ts +0 -78
  268. package/lib/storage/DataFrame.d.ts +0 -284
  269. package/lib/storage/DataFrame.d.ts.map +0 -1
  270. package/lib/storage/DataFrame.js +0 -1022
  271. package/lib/storage/DataFrame.ts +0 -1195
  272. package/lib/storage/DataFrameSource.d.ts +0 -158
  273. package/lib/storage/DataFrameSource.d.ts.map +0 -1
  274. package/lib/storage/DataFrameSource.js +0 -409
  275. package/lib/storage/DataFrameSource.ts +0 -556
  276. package/lib/storage/FileStorage.d.ts +0 -53
  277. package/lib/storage/FileStorage.d.ts.map +0 -1
  278. package/lib/storage/FileStorage.js +0 -80
  279. package/lib/storage/FileStorage.ts +0 -95
  280. package/lib/storage/IndexedDBDriver.d.ts +0 -75
  281. package/lib/storage/IndexedDBDriver.d.ts.map +0 -1
  282. package/lib/storage/IndexedDBDriver.js +0 -177
  283. package/lib/storage/IndexedDBDriver.ts +0 -226
  284. package/lib/storage/TabularDriver.d.ts +0 -118
  285. package/lib/storage/TabularDriver.d.ts.map +0 -1
  286. package/lib/storage/TabularDriver.js +0 -731
  287. package/lib/storage/TabularDriver.ts +0 -874
  288. package/lib/utils/codeparser.d.ts +0 -29
  289. package/lib/utils/codeparser.d.ts.map +0 -1
  290. package/lib/utils/codeparser.js +0 -409
  291. package/lib/utils/fetch.d.ts +0 -176
  292. package/lib/utils/fetch.d.ts.map +0 -1
  293. package/lib/utils/fetch.js +0 -427
  294. package/lib/utils/formatId.d.ts +0 -16
  295. package/lib/utils/formatId.d.ts.map +0 -1
  296. package/lib/utils/formatId.js +0 -27
  297. package/lib/utils/path-resolver.js +0 -23
@@ -1,158 +0,0 @@
1
- import { DataFrame } from './DataFrame.js';
2
- export interface SourceOptions {
3
- dbName?: string;
4
- storeName?: string;
5
- persistToIndexedDB?: boolean;
6
- inferTypes?: boolean;
7
- maxFileSize?: number;
8
- maxSheetSize?: number;
9
- headerRow?: number;
10
- delimiter?: string;
11
- }
12
- export interface APIOptions {
13
- method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
14
- headers?: Record<string, string>;
15
- body?: any;
16
- credentials?: 'omit' | 'same-origin' | 'include';
17
- dataPath?: string;
18
- }
19
- export interface StreamOptions {
20
- mimeType?: string;
21
- chunkSize?: number;
22
- cacheToIndexedDB?: boolean;
23
- }
24
- export interface MultiSheetResult {
25
- sheets: Map<string, DataFrame>;
26
- sheetNames: string[];
27
- activeSheet: string;
28
- }
29
- /**
30
- * DataFrameSource - Data acquisition layer for DataFrames
31
- *
32
- * Responsibilities:
33
- * - Load from files (CSV, TSV, Excel)
34
- * - Load from URLs (fetch, stream)
35
- * - Load from APIs (with auth, JSON traversal)
36
- * - Load from IndexedDB
37
- * - Load from inline data
38
- * - Multi-sheet support
39
- * - Progress callbacks
40
- *
41
- * This is a PURE data layer - no UI concerns
42
- */
43
- export declare class DataFrameSource {
44
- private _driver;
45
- private _options;
46
- private _sheets;
47
- private _activeSheet;
48
- private _sourceName;
49
- private _rawFile;
50
- private _rawText;
51
- constructor(options?: SourceOptions);
52
- /**
53
- * Load from a File object (CSV, TSV, Excel)
54
- */
55
- fromFile(file: File, onProgress?: (loaded: number, total: number | null) => void): Promise<DataFrame | MultiSheetResult>;
56
- /**
57
- * Fetch CSV/TSV from URL
58
- */
59
- fromUrl(url: string, onProgress?: (loaded: number, total: number | null) => void): Promise<DataFrame>;
60
- /**
61
- * Fetch data from API endpoint
62
- * Supports JSON response with path traversal
63
- */
64
- fromAPI(url: string, options?: APIOptions): Promise<DataFrame>;
65
- /**
66
- * Traverse JSON path like "data.results" or "response.items[0].records"
67
- */
68
- private _traversePath;
69
- /**
70
- * Stream binary data from URL, auto-detect format from MIME type
71
- */
72
- fromStream(url: string, options?: StreamOptions, onProgress?: (loaded: number, total: number | null) => void): Promise<DataFrame | MultiSheetResult>;
73
- private _cacheBlob;
74
- /**
75
- * Load from IndexedDB by key/name
76
- */
77
- fromStorage(key: string): Promise<DataFrame | null>;
78
- /**
79
- * List all stored DataFrames
80
- */
81
- listStored(): Promise<Array<{
82
- id: string;
83
- name: string;
84
- rowCount: number;
85
- timestamp: number;
86
- }>>;
87
- /**
88
- * Create from inline data
89
- */
90
- fromData(data: Record<string, any>[] | Record<string, any[]>, name?: string): DataFrame;
91
- /**
92
- * Create empty DataFrame with specified columns
93
- */
94
- empty(columns: string[]): DataFrame;
95
- /**
96
- * Re-parse with different options
97
- */
98
- reimport(options: {
99
- headerRow?: number;
100
- delimiter?: string;
101
- sheetName?: string;
102
- }): Promise<DataFrame | MultiSheetResult>;
103
- /**
104
- * Get raw preview rows for header selection UI
105
- */
106
- getPreviewRows(maxRows?: number): Promise<{
107
- row: number;
108
- values: any[];
109
- }[]>;
110
- /**
111
- * Get all sheet names
112
- */
113
- get sheetNames(): string[];
114
- /**
115
- * Get active sheet
116
- */
117
- get activeSheet(): string;
118
- /**
119
- * Set active sheet
120
- */
121
- setActiveSheet(name: string): DataFrame;
122
- /**
123
- * Get specific sheet by name
124
- */
125
- getSheet(name: string): DataFrame | undefined;
126
- /**
127
- * Get current DataFrame (active sheet)
128
- */
129
- get df(): DataFrame | null;
130
- /**
131
- * Get all sheets
132
- */
133
- get sheets(): Map<string, DataFrame>;
134
- /**
135
- * Save current DataFrame to IndexedDB
136
- */
137
- save(key?: string): Promise<string | null>;
138
- /**
139
- * Save all sheets
140
- */
141
- saveAll(prefix?: string): Promise<string[]>;
142
- /**
143
- * Delete from storage
144
- */
145
- deleteStored(key: string): Promise<void>;
146
- /**
147
- * Clear all data
148
- */
149
- clear(): void;
150
- get sourceName(): string;
151
- get hasRawData(): boolean;
152
- get isExcel(): boolean;
153
- }
154
- /**
155
- * Factory function
156
- */
157
- export declare function dataFrameSource(options?: SourceOptions): DataFrameSource;
158
- //# sourceMappingURL=DataFrameSource.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DataFrameSource.d.ts","sourceRoot":"","sources":["DataFrameSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,MAAM,WAAW,aAAa;IAE1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAG7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACvB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,QAAQ,C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S9C;;OAEG;IACH,KAAK,IAAI,IAAI;IAYb,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;CACJ;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,aAAkB,GAAG,eAAe,CAE5E"}
@@ -1,409 +0,0 @@
1
- import { DataFrame } from './DataFrame.js';
2
- import { TabularDriver } from './TabularDriver.js';
3
- /**
4
- * DataFrameSource - Data acquisition layer for DataFrames
5
- *
6
- * Responsibilities:
7
- * - Load from files (CSV, TSV, Excel)
8
- * - Load from URLs (fetch, stream)
9
- * - Load from APIs (with auth, JSON traversal)
10
- * - Load from IndexedDB
11
- * - Load from inline data
12
- * - Multi-sheet support
13
- * - Progress callbacks
14
- *
15
- * This is a PURE data layer - no UI concerns
16
- */
17
- export class DataFrameSource {
18
- constructor(options = {}) {
19
- this._sheets = new Map();
20
- this._activeSheet = '';
21
- this._sourceName = '';
22
- this._rawFile = null;
23
- this._rawText = null;
24
- this._options = {
25
- dbName: options.dbName ?? 'jux-dataframes',
26
- storeName: options.storeName ?? 'frames',
27
- persistToIndexedDB: options.persistToIndexedDB ?? false,
28
- inferTypes: options.inferTypes ?? true,
29
- maxFileSize: options.maxFileSize ?? 50,
30
- maxSheetSize: options.maxSheetSize ?? 100000,
31
- headerRow: options.headerRow ?? 0,
32
- delimiter: options.delimiter
33
- };
34
- this._driver = new TabularDriver(this._options.dbName, this._options.storeName);
35
- }
36
- /* ═══════════════════════════════════════════════════
37
- * FROM FILE
38
- * ═══════════════════════════════════════════════════ */
39
- /**
40
- * Load from a File object (CSV, TSV, Excel)
41
- */
42
- async fromFile(file, onProgress) {
43
- const fileSizeMB = file.size / (1024 * 1024);
44
- if (fileSizeMB > this._options.maxFileSize) {
45
- throw new Error(`File too large (${fileSizeMB.toFixed(1)}MB). Max: ${this._options.maxFileSize}MB`);
46
- }
47
- this._rawFile = file;
48
- this._sourceName = file.name;
49
- const isExcel = /\.(xlsx?|xls)$/i.test(file.name);
50
- if (isExcel) {
51
- const sheets = await this._driver.streamFileMultiSheet(file, {
52
- maxSheetSize: this._options.maxSheetSize,
53
- headerRow: this._options.headerRow,
54
- onProgress
55
- });
56
- this._sheets.clear();
57
- const sheetNames = Object.keys(sheets);
58
- sheetNames.forEach(name => {
59
- this._sheets.set(name, sheets[name]);
60
- });
61
- this._activeSheet = sheetNames[0] || '';
62
- if (this._options.persistToIndexedDB) {
63
- await this._driver.store(file.name, sheets[sheetNames[0]], { source: file.name });
64
- }
65
- if (sheetNames.length > 1) {
66
- return {
67
- sheets: this._sheets,
68
- sheetNames,
69
- activeSheet: this._activeSheet
70
- };
71
- }
72
- else {
73
- return this._sheets.get(this._activeSheet);
74
- }
75
- }
76
- else {
77
- const text = await file.text();
78
- this._rawText = text;
79
- const df = this._driver.parseCSV(text, {
80
- autoDetectDelimiter: !this._options.delimiter,
81
- delimiter: this._options.delimiter,
82
- headerRow: this._options.headerRow,
83
- hasHeader: true
84
- });
85
- this._sheets.set('Sheet1', df);
86
- this._activeSheet = 'Sheet1';
87
- if (this._options.persistToIndexedDB) {
88
- await this._driver.store(file.name, df, { source: file.name });
89
- }
90
- return df;
91
- }
92
- }
93
- /* ═══════════════════════════════════════════════════
94
- * FROM URL (Simple Fetch)
95
- * ═══════════════════════════════════════════════════ */
96
- /**
97
- * Fetch CSV/TSV from URL
98
- */
99
- async fromUrl(url, onProgress) {
100
- this._sourceName = url.split('/').pop() || url;
101
- const df = await this._driver.fetch(url, {
102
- autoDetectDelimiter: true,
103
- hasHeader: true,
104
- headerRow: this._options.headerRow,
105
- onProgress
106
- });
107
- this._sheets.set('Sheet1', df);
108
- this._activeSheet = 'Sheet1';
109
- if (this._options.persistToIndexedDB) {
110
- await this._driver.store(this._sourceName, df, { source: url });
111
- }
112
- return df;
113
- }
114
- /* ═══════════════════════════════════════════════════
115
- * FROM API (JSON with traversal)
116
- * ═══════════════════════════════════════════════════ */
117
- /**
118
- * Fetch data from API endpoint
119
- * Supports JSON response with path traversal
120
- */
121
- async fromAPI(url, options = {}) {
122
- const { method = 'GET', headers = {}, body, credentials = 'same-origin', dataPath } = options;
123
- const fetchOptions = {
124
- method,
125
- headers: {
126
- 'Accept': 'application/json',
127
- ...headers
128
- },
129
- credentials
130
- };
131
- if (body && method !== 'GET') {
132
- fetchOptions.body = typeof body === 'string' ? body : JSON.stringify(body);
133
- if (!headers['Content-Type']) {
134
- fetchOptions.headers['Content-Type'] = 'application/json';
135
- }
136
- }
137
- const response = await fetch(url, fetchOptions);
138
- if (!response.ok) {
139
- throw new Error(`API request failed: ${response.status} ${response.statusText}`);
140
- }
141
- let data = await response.json();
142
- // Traverse to data path if specified
143
- if (dataPath) {
144
- data = this._traversePath(data, dataPath);
145
- }
146
- // Convert to DataFrame
147
- if (!Array.isArray(data)) {
148
- throw new Error('API response must be an array of objects (or use dataPath to navigate to array)');
149
- }
150
- const df = new DataFrame(data, { inferTypes: this._options.inferTypes });
151
- this._sourceName = url;
152
- this._sheets.set('Sheet1', df);
153
- this._activeSheet = 'Sheet1';
154
- if (this._options.persistToIndexedDB) {
155
- await this._driver.store(this._sourceName, df, { source: url });
156
- }
157
- return df;
158
- }
159
- /**
160
- * Traverse JSON path like "data.results" or "response.items[0].records"
161
- */
162
- _traversePath(obj, path) {
163
- const parts = path.split(/\.|\[|\]/).filter(Boolean);
164
- let current = obj;
165
- for (const part of parts) {
166
- if (current === null || current === undefined) {
167
- throw new Error(`Cannot traverse path '${path}': null at '${part}'`);
168
- }
169
- const index = Number(part);
170
- if (!isNaN(index)) {
171
- current = current[index];
172
- }
173
- else {
174
- current = current[part];
175
- }
176
- }
177
- return current;
178
- }
179
- /* ═══════════════════════════════════════════════════
180
- * FROM STREAM (Binary data with MIME type)
181
- * ═══════════════════════════════════════════════════ */
182
- /**
183
- * Stream binary data from URL, auto-detect format from MIME type
184
- */
185
- async fromStream(url, options = {}, onProgress) {
186
- const { mimeType, cacheToIndexedDB = false } = options;
187
- const response = await fetch(url);
188
- if (!response.ok) {
189
- throw new Error(`Stream request failed: ${response.status}`);
190
- }
191
- const contentType = mimeType || response.headers.get('content-type') || '';
192
- const fileName = url.split('/').pop() || 'stream-data';
193
- // Get the blob
194
- const blob = await response.blob();
195
- const file = new File([blob], fileName, { type: contentType });
196
- // Cache to IndexedDB if requested
197
- if (cacheToIndexedDB) {
198
- // Store raw blob for potential re-parsing
199
- await this._cacheBlob(fileName, blob);
200
- }
201
- // Parse based on content type
202
- return this.fromFile(file, onProgress);
203
- }
204
- async _cacheBlob(name, blob) {
205
- // Simple blob caching in IndexedDB
206
- const db = await this._driver.open();
207
- return new Promise((resolve, reject) => {
208
- const tx = db.transaction('blobs', 'readwrite');
209
- const store = tx.objectStore('blobs');
210
- store.put({ name, blob, timestamp: Date.now() });
211
- tx.oncomplete = () => resolve();
212
- tx.onerror = () => reject(tx.error);
213
- });
214
- }
215
- /* ═══════════════════════════════════════════════════
216
- * FROM INDEXEDDB
217
- * ═══════════════════════════════════════════════════ */
218
- /**
219
- * Load from IndexedDB by key/name
220
- */
221
- async fromStorage(key) {
222
- const df = await this._driver.loadByName(key);
223
- if (df) {
224
- this._sourceName = key;
225
- this._sheets.set('Sheet1', df);
226
- this._activeSheet = 'Sheet1';
227
- }
228
- return df;
229
- }
230
- /**
231
- * List all stored DataFrames
232
- */
233
- async listStored() {
234
- return this._driver.list();
235
- }
236
- /* ═══════════════════════════════════════════════════
237
- * FROM INLINE DATA
238
- * ═══════════════════════════════════════════════════ */
239
- /**
240
- * Create from inline data
241
- */
242
- fromData(data, name = 'inline') {
243
- const df = new DataFrame(data, { inferTypes: this._options.inferTypes });
244
- this._sourceName = name;
245
- this._sheets.set('Sheet1', df);
246
- this._activeSheet = 'Sheet1';
247
- return df;
248
- }
249
- /**
250
- * Create empty DataFrame with specified columns
251
- */
252
- empty(columns) {
253
- const data = {};
254
- columns.forEach(c => { data[c] = []; });
255
- return this.fromData(data, 'empty');
256
- }
257
- /* ═══════════════════════════════════════════════════
258
- * RE-IMPORT / RE-PARSE
259
- * ═══════════════════════════════════════════════════ */
260
- /**
261
- * Re-parse with different options
262
- */
263
- async reimport(options) {
264
- if (this._rawFile) {
265
- // Update options
266
- if (options.headerRow !== undefined) {
267
- this._options.headerRow = options.headerRow;
268
- }
269
- if (options.delimiter !== undefined) {
270
- this._options.delimiter = options.delimiter;
271
- }
272
- return this.fromFile(this._rawFile);
273
- }
274
- else if (this._rawText) {
275
- const df = this._driver.parseCSV(this._rawText, {
276
- delimiter: options.delimiter || this._options.delimiter,
277
- headerRow: options.headerRow ?? this._options.headerRow,
278
- hasHeader: true
279
- });
280
- this._sheets.set(this._activeSheet, df);
281
- return df;
282
- }
283
- throw new Error('No raw data available for reimport');
284
- }
285
- /**
286
- * Get raw preview rows for header selection UI
287
- */
288
- async getPreviewRows(maxRows = 15) {
289
- if (this._rawFile && /\.(xlsx?|xls)$/i.test(this._rawFile.name)) {
290
- const rows = await this._driver.readRawExcelRows(this._rawFile, maxRows);
291
- return rows.map(r => ({ row: r.sheetRow, values: r.values }));
292
- }
293
- else if (this._rawText) {
294
- const lines = this._rawText.split('\n').slice(0, maxRows);
295
- const delimiter = this._driver._detectDelimiter(this._rawText);
296
- return lines.map((line, i) => ({
297
- row: i,
298
- values: this._driver._parseLine(line, delimiter)
299
- }));
300
- }
301
- return [];
302
- }
303
- /* ═══════════════════════════════════════════════════
304
- * MULTI-SHEET ACCESS
305
- * ═══════════════════════════════════════════════════ */
306
- /**
307
- * Get all sheet names
308
- */
309
- get sheetNames() {
310
- return Array.from(this._sheets.keys());
311
- }
312
- /**
313
- * Get active sheet
314
- */
315
- get activeSheet() {
316
- return this._activeSheet;
317
- }
318
- /**
319
- * Set active sheet
320
- */
321
- setActiveSheet(name) {
322
- if (!this._sheets.has(name)) {
323
- throw new Error(`Sheet '${name}' not found`);
324
- }
325
- this._activeSheet = name;
326
- return this._sheets.get(name);
327
- }
328
- /**
329
- * Get specific sheet by name
330
- */
331
- getSheet(name) {
332
- return this._sheets.get(name);
333
- }
334
- /**
335
- * Get current DataFrame (active sheet)
336
- */
337
- get df() {
338
- return this._sheets.get(this._activeSheet) || null;
339
- }
340
- /**
341
- * Get all sheets
342
- */
343
- get sheets() {
344
- return new Map(this._sheets);
345
- }
346
- /* ═══════════════════════════════════════════════════
347
- * PERSISTENCE
348
- * ═══════════════════════════════════════════════════ */
349
- /**
350
- * Save current DataFrame to IndexedDB
351
- */
352
- async save(key) {
353
- const df = this.df;
354
- if (!df)
355
- return null;
356
- const name = key || this._sourceName;
357
- return this._driver.store(name, df);
358
- }
359
- /**
360
- * Save all sheets
361
- */
362
- async saveAll(prefix) {
363
- const ids = [];
364
- for (const [sheetName, df] of this._sheets) {
365
- const key = prefix ? `${prefix}_${sheetName}` : `${this._sourceName}_${sheetName}`;
366
- const id = await this._driver.store(key, df);
367
- ids.push(id);
368
- }
369
- return ids;
370
- }
371
- /**
372
- * Delete from storage
373
- */
374
- async deleteStored(key) {
375
- const tables = await this._driver.list();
376
- const matching = tables.filter(t => t.name === key);
377
- for (const table of matching) {
378
- await this._driver.delete(table.id);
379
- }
380
- }
381
- /**
382
- * Clear all data
383
- */
384
- clear() {
385
- this._sheets.clear();
386
- this._activeSheet = '';
387
- this._sourceName = '';
388
- this._rawFile = null;
389
- this._rawText = null;
390
- }
391
- /* ═══════════════════════════════════════════════════
392
- * SOURCE INFO
393
- * ═══════════════════════════════════════════════════ */
394
- get sourceName() {
395
- return this._sourceName;
396
- }
397
- get hasRawData() {
398
- return this._rawFile !== null || this._rawText !== null;
399
- }
400
- get isExcel() {
401
- return this._rawFile !== null && /\.(xlsx?|xls)$/i.test(this._rawFile.name);
402
- }
403
- }
404
- /**
405
- * Factory function
406
- */
407
- export function dataFrameSource(options = {}) {
408
- return new DataFrameSource(options);
409
- }