juxscript 1.1.239 → 1.1.243

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/tag.ts +68 -0
  4. package/lib/styles/shadcn.css +20 -7
  5. package/lib/utils/idgen.ts +6 -0
  6. package/package.json +5 -6
  7. package/index.d.ts +0 -239
  8. package/index.d.ts.map +0 -1
  9. package/lib/components/alert.d.ts +0 -36
  10. package/lib/components/alert.d.ts.map +0 -1
  11. package/lib/components/alert.js +0 -172
  12. package/lib/components/alert.ts +0 -219
  13. package/lib/components/app.d.ts +0 -89
  14. package/lib/components/app.d.ts.map +0 -1
  15. package/lib/components/app.js +0 -175
  16. package/lib/components/app.ts +0 -247
  17. package/lib/components/badge.d.ts +0 -26
  18. package/lib/components/badge.d.ts.map +0 -1
  19. package/lib/components/badge.js +0 -91
  20. package/lib/components/badge.ts +0 -118
  21. package/lib/components/base/Animations.d.ts +0 -36
  22. package/lib/components/base/Animations.d.ts.map +0 -1
  23. package/lib/components/base/Animations.js +0 -70
  24. package/lib/components/base/Animations.ts +0 -112
  25. package/lib/components/base/BaseComponent.d.ts +0 -294
  26. package/lib/components/base/BaseComponent.d.ts.map +0 -1
  27. package/lib/components/base/BaseComponent.js +0 -735
  28. package/lib/components/base/BaseComponent.ts +0 -884
  29. package/lib/components/base/FormInput.d.ts +0 -77
  30. package/lib/components/base/FormInput.d.ts.map +0 -1
  31. package/lib/components/base/FormInput.js +0 -171
  32. package/lib/components/base/FormInput.ts +0 -237
  33. package/lib/components/blueprint.d.ts +0 -40
  34. package/lib/components/blueprint.d.ts.map +0 -1
  35. package/lib/components/blueprint.js +0 -327
  36. package/lib/components/button.d.ts +0 -70
  37. package/lib/components/button.d.ts.map +0 -1
  38. package/lib/components/button.js +0 -177
  39. package/lib/components/button.ts +0 -237
  40. package/lib/components/card.d.ts +0 -35
  41. package/lib/components/card.d.ts.map +0 -1
  42. package/lib/components/card.js +0 -130
  43. package/lib/components/card.ts +0 -177
  44. package/lib/components/chart.d.ts +0 -49
  45. package/lib/components/chart.d.ts.map +0 -1
  46. package/lib/components/chart.js +0 -205
  47. package/lib/components/chart.ts +0 -254
  48. package/lib/components/checkbox.d.ts +0 -33
  49. package/lib/components/checkbox.d.ts.map +0 -1
  50. package/lib/components/checkbox.js +0 -202
  51. package/lib/components/checkbox.ts +0 -260
  52. package/lib/components/code.d.ts +0 -52
  53. package/lib/components/code.d.ts.map +0 -1
  54. package/lib/components/code.js +0 -201
  55. package/lib/components/code.ts +0 -260
  56. package/lib/components/container.d.ts +0 -60
  57. package/lib/components/container.d.ts.map +0 -1
  58. package/lib/components/container.js +0 -195
  59. package/lib/components/container.ts +0 -259
  60. package/lib/components/data.d.ts +0 -36
  61. package/lib/components/data.d.ts.map +0 -1
  62. package/lib/components/data.js +0 -110
  63. package/lib/components/data.ts +0 -135
  64. package/lib/components/dataframe/DataFrameSource.d.ts +0 -118
  65. package/lib/components/dataframe/DataFrameSource.d.ts.map +0 -1
  66. package/lib/components/dataframe/DataFrameSource.js +0 -421
  67. package/lib/components/dataframe/DataFrameSource.ts +0 -532
  68. package/lib/components/dataframe/ImportSettingsModal.d.ts +0 -60
  69. package/lib/components/dataframe/ImportSettingsModal.d.ts.map +0 -1
  70. package/lib/components/dataframe/ImportSettingsModal.js +0 -442
  71. package/lib/components/dataframe/ImportSettingsModal.ts +0 -531
  72. package/lib/components/dataframe.d.ts +0 -110
  73. package/lib/components/dataframe.d.ts.map +0 -1
  74. package/lib/components/dataframe.js +0 -470
  75. package/lib/components/datepicker.d.ts +0 -40
  76. package/lib/components/datepicker.d.ts.map +0 -1
  77. package/lib/components/datepicker.js +0 -193
  78. package/lib/components/datepicker.ts +0 -251
  79. package/lib/components/dialog.d.ts +0 -39
  80. package/lib/components/dialog.d.ts.map +0 -1
  81. package/lib/components/dialog.js +0 -131
  82. package/lib/components/dialog.ts +0 -178
  83. package/lib/components/divider.d.ts +0 -31
  84. package/lib/components/divider.d.ts.map +0 -1
  85. package/lib/components/divider.js +0 -72
  86. package/lib/components/divider.ts +0 -104
  87. package/lib/components/dropdown-menu.d.ts +0 -42
  88. package/lib/components/dropdown-menu.d.ts.map +0 -1
  89. package/lib/components/dropdown-menu.js +0 -177
  90. package/lib/components/dropdown-menu.ts +0 -214
  91. package/lib/components/dropdown.d.ts +0 -41
  92. package/lib/components/dropdown.d.ts.map +0 -1
  93. package/lib/components/dropdown.js +0 -136
  94. package/lib/components/dropdown.ts +0 -188
  95. package/lib/components/element.d.ts +0 -51
  96. package/lib/components/element.d.ts.map +0 -1
  97. package/lib/components/element.js +0 -209
  98. package/lib/components/element.ts +0 -271
  99. package/lib/components/event-chain.d.ts +0 -9
  100. package/lib/components/event-chain.d.ts.map +0 -1
  101. package/lib/components/event-chain.js +0 -33
  102. package/lib/components/fileupload.d.ts +0 -98
  103. package/lib/components/fileupload.d.ts.map +0 -1
  104. package/lib/components/fileupload.js +0 -351
  105. package/lib/components/fileupload.ts +0 -449
  106. package/lib/components/grid.d.ts +0 -88
  107. package/lib/components/grid.d.ts.map +0 -1
  108. package/lib/components/grid.js +0 -208
  109. package/lib/components/grid.ts +0 -295
  110. package/lib/components/heading.d.ts +0 -25
  111. package/lib/components/heading.d.ts.map +0 -1
  112. package/lib/components/heading.js +0 -83
  113. package/lib/components/heading.ts +0 -113
  114. package/lib/components/helpers.d.ts +0 -9
  115. package/lib/components/helpers.d.ts.map +0 -1
  116. package/lib/components/helpers.js +0 -30
  117. package/lib/components/helpers.ts +0 -41
  118. package/lib/components/hero.d.ts +0 -60
  119. package/lib/components/hero.d.ts.map +0 -1
  120. package/lib/components/hero.js +0 -239
  121. package/lib/components/hero.ts +0 -302
  122. package/lib/components/history/StateHistory.d.ts +0 -91
  123. package/lib/components/history/StateHistory.d.ts.map +0 -1
  124. package/lib/components/history/StateHistory.js +0 -154
  125. package/lib/components/history/StateHistory.ts +0 -200
  126. package/lib/components/icon.d.ts +0 -36
  127. package/lib/components/icon.d.ts.map +0 -1
  128. package/lib/components/icon.js +0 -135
  129. package/lib/components/icon.ts +0 -182
  130. package/lib/components/icons.d.ts +0 -25
  131. package/lib/components/icons.d.ts.map +0 -1
  132. package/lib/components/icons.js +0 -440
  133. package/lib/components/icons.ts +0 -464
  134. package/lib/components/image.d.ts +0 -42
  135. package/lib/components/image.d.ts.map +0 -1
  136. package/lib/components/image.js +0 -204
  137. package/lib/components/image.ts +0 -260
  138. package/lib/components/include.d.ts +0 -86
  139. package/lib/components/include.d.ts.map +0 -1
  140. package/lib/components/include.js +0 -238
  141. package/lib/components/include.ts +0 -281
  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,569 +0,0 @@
1
- import { BaseComponent, BaseState } from './base/BaseComponent.js';
2
- import { DataFrame } from '../storage/DataFrame.js';
3
- import { FileUpload } from './fileupload.js';
4
- import { Table } from './table.js';
5
- import { Tabs } from './tabs.js';
6
- import { Button } from './button.js';
7
- import { DataFrameSource, LoadResult, dataFrameSource } from './dataframe/DataFrameSource.js';
8
- import { ImportSettingsModal } from './dataframe/ImportSettingsModal.js';
9
-
10
- const TRIGGER_EVENTS = [] as const;
11
- const CALLBACK_EVENTS = ['load', 'error', 'transform'] as const;
12
-
13
- export interface DataFrameOptions {
14
- // Data source options
15
- maxFileSize?: number;
16
- maxSheetSize?: number;
17
- sheetChunkSize?: number;
18
- persistToIndexedDB?: boolean;
19
- dbName?: string;
20
- storeName?: string;
21
-
22
- // Table display options
23
- striped?: boolean;
24
- hoverable?: boolean;
25
- sortable?: boolean;
26
- filterable?: boolean;
27
- paginated?: boolean;
28
- rowsPerPage?: number;
29
-
30
- // Styling
31
- style?: string;
32
- class?: string;
33
- }
34
-
35
- type DataFrameState = BaseState & {
36
- loaded: boolean;
37
- sourceName: string;
38
- rowCount: number;
39
- colCount: number;
40
- };
41
-
42
- export class DataFrameComponent extends BaseComponent<DataFrameState> {
43
- private _source: DataFrameSource;
44
- private _table: Table | null = null;
45
- private _tabs: Tabs | null = null;
46
- private _uploadRef: FileUpload | null = null;
47
- private _importModal: ImportSettingsModal;
48
- private _tableOptions: {
49
- striped: boolean;
50
- hoverable: boolean;
51
- sortable: boolean;
52
- filterable: boolean;
53
- paginated: boolean;
54
- rowsPerPage: number;
55
- };
56
- private _inlineUpload: { label: string; accept: string; icon: string } | null = null;
57
- private _uploadButtonLabel: string = 'Upload File';
58
- private _uploadButtonIcon: string = 'upload';
59
- private _uploadButtonVariant: string = 'outline';
60
- private _uploadAccept: string = '.csv,.tsv,.txt,.xlsx,.xls';
61
- private _uploadDescription: string = '';
62
- private _showUploadIcon: boolean = true;
63
- private _pendingSource: (() => Promise<void>) | null = null;
64
-
65
- constructor(id: string, options: DataFrameOptions = {}) {
66
- super(id, {
67
- visible: true,
68
- disabled: false,
69
- loading: false,
70
- style: options.style ?? '',
71
- class: options.class ?? '',
72
- loaded: false,
73
- sourceName: '',
74
- rowCount: 0,
75
- colCount: 0
76
- });
77
-
78
- // Initialize data source
79
- this._source = dataFrameSource({
80
- maxFileSize: options.maxFileSize ?? 50,
81
- maxSheetSize: options.maxSheetSize ?? 100000,
82
- sheetChunkSize: options.sheetChunkSize ?? 10000,
83
- persistToIndexedDB: options.persistToIndexedDB ?? false,
84
- dbName: options.dbName ?? 'jux-dataframes',
85
- storeName: options.storeName ?? 'frames'
86
- });
87
-
88
- // Wire up source callbacks
89
- this._source.onLoad((result) => this._handleLoadResult(result));
90
- this._source.onError((message) => this._handleError(message));
91
- this._source.onProgress((loaded, total) => this._handleProgress(loaded, total));
92
-
93
- // Initialize import settings modal
94
- this._importModal = new ImportSettingsModal(id, this._source.driver, {
95
- maxSheetSize: options.maxSheetSize ?? 100000,
96
- sheetChunkSize: options.sheetChunkSize ?? 10000
97
- });
98
-
99
- this._tableOptions = {
100
- striped: options.striped ?? true,
101
- hoverable: options.hoverable ?? true,
102
- sortable: options.sortable ?? true,
103
- filterable: options.filterable ?? false,
104
- paginated: options.paginated ?? true,
105
- rowsPerPage: options.rowsPerPage ?? 25
106
- };
107
- }
108
-
109
- protected getTriggerEvents(): readonly string[] { return TRIGGER_EVENTS; }
110
- protected getCallbackEvents(): readonly string[] { return CALLBACK_EVENTS; }
111
-
112
- /* ═══════════════════════════════════════════════════
113
- * DATA SOURCE METHODS (Delegate to DataFrameSource)
114
- * ═══════════════════════════════════════════════════ */
115
-
116
- /**
117
- * Load from IndexedDB storage
118
- */
119
- fromStorage(key: string): this {
120
- const loadFn = async () => {
121
- this.state.loading = true;
122
- this._updateStatus('Loading...', 'loading');
123
- await this._source.fromStorage(key);
124
- };
125
- if (this._table) { loadFn(); } else { this._pendingSource = loadFn; }
126
- return this;
127
- }
128
-
129
- /**
130
- * Load from a FileUpload component
131
- */
132
- fromUpload(upload: FileUpload): this {
133
- this._uploadRef = upload;
134
- this._pendingSource = async () => {
135
- this._source.fromUpload(upload);
136
- };
137
- return this;
138
- }
139
-
140
- /**
141
- * Load from inline data
142
- */
143
- fromData(data: Record<string, any>[] | Record<string, any[]>): this {
144
- const loadFn = async () => {
145
- this.state.loading = true;
146
- this._updateStatus('Loading data...', 'loading');
147
- this._source.fromData(data);
148
- };
149
- if (this._table) { loadFn(); } else { this._pendingSource = loadFn; }
150
- return this;
151
- }
152
-
153
- /**
154
- * Load from a URL
155
- */
156
- fromUrl(url: string): this {
157
- const loadFn = async () => {
158
- this.state.loading = true;
159
- this._updateStatus('Fetching...', 'loading');
160
- await this._source.fromUrl(url);
161
- };
162
- if (this._table) { loadFn(); } else { this._pendingSource = loadFn; }
163
- return this;
164
- }
165
-
166
- /**
167
- * Enable inline file upload UI
168
- */
169
- withUpload(label: string = 'Upload File', accept: string = '.csv,.tsv,.txt,.xlsx,.xls', icon: string = 'upload'): this {
170
- this._inlineUpload = { label, accept, icon };
171
- this._uploadButtonLabel = label;
172
- this._uploadAccept = accept;
173
- this._uploadButtonIcon = icon;
174
- return this;
175
- }
176
-
177
- /* ═══════════════════════════════════════════════════
178
- * UPLOAD UI CONFIGURATION
179
- * ═══════════════════════════════════════════════════ */
180
-
181
- uploadLabel(label: string): this { this._uploadButtonLabel = label; return this; }
182
- uploadIcon(icon: string): this { this._uploadButtonIcon = icon; this._showUploadIcon = !!icon; return this; }
183
- uploadVariant(variant: string): this { this._uploadButtonVariant = variant; return this; }
184
- uploadAccept(accept: string): this { this._uploadAccept = accept; return this; }
185
- uploadDescription(description: string): this { this._uploadDescription = description; return this; }
186
- showUploadIcon(show: boolean): this { this._showUploadIcon = show; return this; }
187
-
188
- /* ═══════════════════════════════════════════════════
189
- * TABLE OPTIONS
190
- * ═══════════════════════════════════════════════════ */
191
-
192
- striped(v: boolean): this { this._tableOptions.striped = v; return this; }
193
- hoverable(v: boolean): this { this._tableOptions.hoverable = v; return this; }
194
- sortable(v: boolean): this { this._tableOptions.sortable = v; return this; }
195
- filterable(v: boolean): this { this._tableOptions.filterable = v; return this; }
196
- paginated(v: boolean): this { this._tableOptions.paginated = v; return this; }
197
- rowsPerPage(v: number): this { this._tableOptions.rowsPerPage = v; return this; }
198
-
199
- /* ═══════════════════════════════════════════════════
200
- * ACCESSORS (Delegate to DataFrameSource)
201
- * ═══════════════════════════════════════════════════ */
202
-
203
- get df(): DataFrame | null { return this._source.df; }
204
- get source(): DataFrameSource { return this._source; }
205
- get table(): Table | null { return this._table; }
206
- get shape(): [number, number] { return this._source.shape; }
207
- get columns(): string[] { return this._source.columns; }
208
-
209
- toRows(): Record<string, any>[] { return this._source.df?.toRows() ?? []; }
210
- toCSV(delimiter?: string): string { return this._source.df?.toCSV(delimiter) ?? ''; }
211
- describe(): Record<string, any> | null { return this._source.df?.describe() ?? null; }
212
-
213
- async save(key?: string): Promise<string | null> {
214
- return this._source.save(key);
215
- }
216
-
217
- /* ═══════════════════════════════════════════════════
218
- * TRANSFORM API (Operate on underlying DataFrame)
219
- * ═══════════════════════════════════════════════════ */
220
-
221
- apply(fn: (df: DataFrame) => DataFrame): this {
222
- const df = this._source.df;
223
- if (!df) return this;
224
-
225
- const result = fn(df);
226
- this._source.fromData(result.toRows(), this.state.sourceName + ' (transformed)');
227
- this._triggerCallback('transform', result, null, this);
228
- return this;
229
- }
230
-
231
- filter(predicate: (row: Record<string, any>, index: number) => boolean): this {
232
- return this.apply(df => df.filter(predicate));
233
- }
234
-
235
- select(...cols: string[]): this {
236
- return this.apply(df => df.select(...cols));
237
- }
238
-
239
- sort(col: string, descending?: boolean): this {
240
- return this.apply(df => df.sort(col, descending));
241
- }
242
-
243
- head(n: number = 5): this {
244
- return this.apply(df => df.head(n));
245
- }
246
-
247
- tail(n: number = 5): this {
248
- return this.apply(df => df.tail(n));
249
- }
250
-
251
- /* ═══════════════════════════════════════════════════
252
- * CLEAR / RESET
253
- * ═══════════════════════════════════════════════════ */
254
-
255
- async clear(): Promise<this> {
256
- await this._source.clearStorage();
257
- this._source.clear();
258
-
259
- this.state.loaded = false;
260
- this.state.sourceName = '';
261
- this.state.rowCount = 0;
262
- this.state.colCount = 0;
263
-
264
- if (this._table) {
265
- this._table.columns([]).rows([]);
266
- }
267
-
268
- this._hideDataView();
269
- this._uploadRef?.clear();
270
-
271
- return this;
272
- }
273
-
274
- /* ═══════════════════════════════════════════════════
275
- * INTERNAL HANDLERS
276
- * ═══════════════════════════════════════════════════ */
277
-
278
- private _handleLoadResult(result: LoadResult): void {
279
- if (result.error) {
280
- this._handleError(result.error);
281
- return;
282
- }
283
-
284
- this.state.loading = false;
285
- this.state.loaded = true;
286
- this.state.sourceName = result.sourceName;
287
- this.state.rowCount = result.df?.height ?? 0;
288
- this.state.colCount = result.df?.width ?? 0;
289
-
290
- if (result.isMultiSheet && result.sheets) {
291
- this._renderMultiSheet(result.sheets, result.sourceName);
292
- } else if (result.df) {
293
- this._renderSingleSheet(result.df);
294
- }
295
-
296
- this._updateStatus('', 'success');
297
- this._triggerCallback('load', result.df, null, this);
298
- }
299
-
300
- private _handleError(message: string): void {
301
- this.state.loading = false;
302
- this._updateStatus(message, 'error');
303
- this._triggerCallback('error', message, null, this);
304
- }
305
-
306
- private _handleProgress(loaded: number, total: number): void {
307
- const pct = total ? Math.round((loaded / total) * 100) : 0;
308
- this._updateStatus(`Loading... ${pct}%`, 'loading');
309
- }
310
-
311
- private _renderSingleSheet(df: DataFrame): void {
312
- if (this._table) {
313
- const columnDefs = df.columns.map(col => ({ key: col, label: col }));
314
- this._table.columns(columnDefs).rows(df.toRows());
315
- }
316
- this._showDataView();
317
- }
318
-
319
- private _renderMultiSheet(sheets: Record<string, DataFrame>, sourceName: string): void {
320
- const wrapper = document.getElementById(this._id);
321
- if (!wrapper) return;
322
-
323
- // Clear existing tabs
324
- const existingTabs = wrapper.querySelector('.jux-tabs');
325
- if (existingTabs) existingTabs.remove();
326
-
327
- const sheetNames = Object.keys(sheets);
328
- const sanitizeId = (name: string) => name.replace(/[^a-zA-Z0-9_-]/g, '_');
329
-
330
- const tabDefs = sheetNames.map(name => ({
331
- id: sanitizeId(name),
332
- label: name,
333
- content: ''
334
- }));
335
-
336
- this._tabs = new Tabs(`${this._id}-tabs`, {
337
- tabs: tabDefs,
338
- activeTab: sanitizeId(sheetNames[0])
339
- });
340
-
341
- const dataContainer = wrapper.querySelector('.jux-dataframe-data') as HTMLElement;
342
- if (dataContainer) {
343
- dataContainer.style.display = '';
344
- const tabsContainer = document.createElement('div');
345
- tabsContainer.className = 'jux-dataframe-tabs';
346
- dataContainer.appendChild(tabsContainer);
347
- this._tabs.render(tabsContainer);
348
- }
349
-
350
- sheetNames.forEach(sheetName => {
351
- const df = sheets[sheetName];
352
- const safeId = sanitizeId(sheetName);
353
-
354
- const table = new Table(`${this._id}-table-${safeId}`, this._tableOptions);
355
- const columnDefs = df.columns.map(col => ({ key: col, label: col }));
356
- table.columns(columnDefs).rows(df.toRows());
357
-
358
- const settingsBtn = new Button(`${this._id}-settings-${safeId}`, {
359
- label: '⚙️ Import Settings',
360
- variant: 'ghost',
361
- size: 'small'
362
- });
363
- settingsBtn.bind('click', () => this._showImportSettings());
364
-
365
- this._tabs!.addTabContent(safeId, [settingsBtn, table]);
366
- });
367
-
368
- this._showDataView();
369
- }
370
-
371
- /* ═══════════════════════════════════════════════════
372
- * UI HELPERS
373
- * ═══════════════════════════════════════════════════ */
374
-
375
- private _updateStatus(text: string, type: 'loading' | 'success' | 'error' | 'empty'): void {
376
- const el = document.getElementById(`${this._id}-status`);
377
- if (!el) return;
378
-
379
- if (type === 'loading' || type === 'error') {
380
- el.style.display = '';
381
- el.className = `jux-dataframe-status jux-dataframe-status-${type}`;
382
- el.textContent = text;
383
- } else {
384
- el.style.display = 'none';
385
- }
386
- }
387
-
388
- private _showDataView(): void {
389
- const wrapper = document.getElementById(this._id);
390
- if (!wrapper) return;
391
-
392
- const uploadArea = wrapper.querySelector('.jux-dataframe-upload-area') as HTMLElement;
393
- if (uploadArea) uploadArea.style.display = 'none';
394
-
395
- const dataContainer = wrapper.querySelector('.jux-dataframe-data') as HTMLElement;
396
- if (dataContainer) dataContainer.style.display = '';
397
-
398
- this._updateSettingsGear();
399
- }
400
-
401
- private _hideDataView(): void {
402
- const wrapper = document.getElementById(this._id);
403
- if (!wrapper) return;
404
-
405
- const uploadArea = wrapper.querySelector('.jux-dataframe-upload-area') as HTMLElement;
406
- if (uploadArea) uploadArea.style.display = '';
407
-
408
- const dataContainer = wrapper.querySelector('.jux-dataframe-data') as HTMLElement;
409
- if (dataContainer) dataContainer.style.display = 'none';
410
- }
411
-
412
- private _updateSettingsGear(): void {
413
- const gear = document.getElementById(`${this._id}-settings-gear`);
414
- if (!gear || !this._source.df) return;
415
-
416
- const isMalformed = this._source.detectMalformed();
417
-
418
- if (isMalformed) {
419
- gear.classList.add('jux-dataframe-gear-warning');
420
- gear.title = `${this.state.sourceName} — May need reformatting`;
421
- } else {
422
- gear.classList.remove('jux-dataframe-gear-warning');
423
- gear.title = `${this.state.sourceName} — ${this._source.height} rows × ${this._source.width} cols`;
424
- }
425
- }
426
-
427
- private _showSettingsModal(): void {
428
- this._importModal.showSettings(
429
- {
430
- fileName: this._source.rawFileData?.file?.name || this.state.sourceName,
431
- fileSize: this._source.rawFileData?.file?.size,
432
- rowCount: this._source.height,
433
- colCount: this._source.width,
434
- isMalformed: this._source.detectMalformed(),
435
- hasRawFileData: !!this._source.rawFileData
436
- },
437
- {
438
- onClear: async () => { await this.clear(); },
439
- onAdjustImport: () => { this._showImportSettings(); }
440
- }
441
- );
442
- }
443
-
444
- private _showImportSettings(): void {
445
- const rawData = this._source.rawFileData;
446
- if (!rawData) return;
447
-
448
- this._importModal.showImportSettings(rawData, {
449
- onReimport: async (result, sourceName) => {
450
- if (result instanceof DataFrame) {
451
- this._source.fromData(result.toRows(), sourceName);
452
- } else {
453
- // Multi-sheet - handled by source callbacks
454
- }
455
- },
456
- onError: (message) => this._handleError(message),
457
- onStatusUpdate: (text, type) => {
458
- this.state.loading = type === 'loading';
459
- this._updateStatus(text, type);
460
- }
461
- });
462
- }
463
-
464
- /* ═══════════════════════════════════════════════════
465
- * RENDER
466
- * ═══════════════════════════════════════════════════ */
467
-
468
- update(_prop: string, _value: any): void { }
469
-
470
- render(targetId?: string | HTMLElement | BaseComponent<any>): this {
471
- const container = this._setupContainer(targetId);
472
- const { style, class: className } = this.state;
473
-
474
- const wrapper = document.createElement('div');
475
- wrapper.className = 'jux-dataframe';
476
- wrapper.id = this._id;
477
- if (className) wrapper.className += ` ${className}`;
478
- if (style) wrapper.setAttribute('style', style);
479
-
480
- // Upload area
481
- if (this._inlineUpload) {
482
- const uploadArea = document.createElement('div');
483
- uploadArea.className = 'jux-dataframe-upload-area';
484
-
485
- const uploadOpts: any = {
486
- label: this._uploadButtonLabel,
487
- accept: this._uploadAccept,
488
- variant: this._uploadButtonVariant,
489
- };
490
- if (this._showUploadIcon) uploadOpts.icon = this._uploadButtonIcon;
491
-
492
- const upload = new FileUpload(`${this._id}-upload`, uploadOpts);
493
- this._uploadRef = upload;
494
-
495
- // Wire upload to source
496
- upload.bind('change', async (files: File[]) => {
497
- if (!files || files.length === 0) {
498
- await this.clear();
499
- return;
500
- }
501
- this.state.loading = true;
502
- this._updateStatus(`Parsing ${files[0].name}...`, 'loading');
503
- await this._source.fromFile(files[0]);
504
- });
505
-
506
- const uploadContainer = document.createElement('div');
507
- uploadContainer.className = 'jux-dataframe-upload';
508
- uploadArea.appendChild(uploadContainer);
509
-
510
- const statusBar = document.createElement('div');
511
- statusBar.className = 'jux-dataframe-status';
512
- statusBar.id = `${this._id}-status`;
513
- statusBar.style.display = 'none';
514
- uploadArea.appendChild(statusBar);
515
-
516
- if (this._uploadDescription) {
517
- const descEl = document.createElement('div');
518
- descEl.className = 'jux-dataframe-upload-description';
519
- descEl.textContent = this._uploadDescription;
520
- uploadArea.appendChild(descEl);
521
- }
522
-
523
- wrapper.appendChild(uploadArea);
524
- container.appendChild(wrapper);
525
- upload.render(uploadContainer);
526
- } else {
527
- container.appendChild(wrapper);
528
- }
529
-
530
- // Data container
531
- const dataContainer = document.createElement('div');
532
- dataContainer.className = 'jux-dataframe-data';
533
- dataContainer.style.display = 'none';
534
-
535
- const toolbar = document.createElement('div');
536
- toolbar.className = 'jux-dataframe-toolbar';
537
-
538
- const settingsGear = document.createElement('button');
539
- settingsGear.className = 'jux-dataframe-gear';
540
- settingsGear.id = `${this._id}-settings-gear`;
541
- settingsGear.type = 'button';
542
- settingsGear.innerHTML = '⚙️';
543
- settingsGear.title = 'Data Settings';
544
- settingsGear.addEventListener('click', () => this._showSettingsModal());
545
- toolbar.appendChild(settingsGear);
546
-
547
- dataContainer.appendChild(toolbar);
548
- wrapper.appendChild(dataContainer);
549
-
550
- // Table
551
- const tbl = new Table(`${this._id}-table`, this._tableOptions);
552
- tbl.render(dataContainer);
553
- this._table = tbl;
554
-
555
- if (this._pendingSource) {
556
- const fn = this._pendingSource;
557
- this._pendingSource = null;
558
- fn();
559
- }
560
-
561
- this._wireStandardEvents(wrapper);
562
-
563
- return this;
564
- }
565
- }
566
-
567
- export function dataframe(id: string, options: DataFrameOptions = {}): DataFrameComponent {
568
- return new DataFrameComponent(id, options);
569
- }
@@ -0,0 +1,68 @@
1
+ import generateId from '../utils/idgen';
2
+
3
+ interface TagProps {
4
+ id: string;
5
+ tagName: string;
6
+ content?: string;
7
+ options?: Record<string, string>;
8
+ }
9
+ class Tag extends HTMLElement {
10
+ content: string;
11
+ options: Record<string, string>;
12
+ constructor(data: Partial<TagProps>) {
13
+ super();
14
+ this.id = generateId();
15
+ this.content = data.content || '';
16
+ this.options = data.options || {};
17
+ }
18
+ modify() {
19
+ return this;
20
+ }
21
+
22
+ render() {
23
+ const el = document.createElement(this.tagName);
24
+ el.textContent = this.content;
25
+ for (const [key, value] of Object.entries(this.options)) {
26
+ el.setAttribute(key, value);
27
+ }
28
+ return el;
29
+ }
30
+ }
31
+
32
+ export function tag(data: Partial<TagProps>): Tag {
33
+ const t = new Tag(data);
34
+ return t;
35
+ }
36
+ export function div(data: Partial<TagProps>): Tag {
37
+ return tag({ ...data, tagName: 'div' });
38
+ }
39
+ export function span(data: Partial<TagProps>): Tag {
40
+ return tag({ ...data, tagName: 'span' });
41
+ }
42
+ export function p(data: Partial<TagProps>): Tag {
43
+ return tag({ ...data, tagName: 'p' });
44
+ }
45
+ export function code(data: Partial<TagProps>): Tag {
46
+ return tag({ ...data, tagName: 'code' });
47
+ }
48
+ export function pre(data: Partial<TagProps>): Tag {
49
+ return tag({ ...data, tagName: 'pre' });
50
+ }
51
+ export function h1(data: Partial<TagProps>): Tag {
52
+ return tag({ ...data, tagName: 'h1' });
53
+ }
54
+ export function h2(data: Partial<TagProps>): Tag {
55
+ return tag({ ...data, tagName: 'h2' });
56
+ }
57
+ export function h3(data: Partial<TagProps>): Tag {
58
+ return tag({ ...data, tagName: 'h3' });
59
+ }
60
+ export function h4(data: Partial<TagProps>): Tag {
61
+ return tag({ ...data, tagName: 'h4' });
62
+ }
63
+ export function h5(data: Partial<TagProps>): Tag {
64
+ return tag({ ...data, tagName: 'h5' });
65
+ }
66
+ export function h6(data: Partial<TagProps>): Tag {
67
+ return tag({ ...data, tagName: 'h6' });
68
+ }
@@ -734,13 +734,14 @@ code {
734
734
  .jux-hstack,
735
735
  .jux-zstack {
736
736
  display: flex;
737
+ width: 100%;
737
738
 
738
739
  /* ✅ Use CSS variables from foundation/theme */
739
740
  gap: var(--jux-gap, 1rem);
740
741
  padding: var(--jux-pad, 0);
741
742
 
742
- /* Default alignment */
743
- align-items: var(--jux-align, flex-start);
743
+ /* Default alignment — stretch so children fill cross-axis */
744
+ align-items: var(--jux-align, stretch);
744
745
  }
745
746
 
746
747
  /* ═════════════════════════════════════════════════════════════════
@@ -757,7 +758,21 @@ code {
757
758
 
758
759
  .jux-hstack {
759
760
  flex-direction: row;
760
- flex-wrap: wrap; /* Allow wrapping on mobile */
761
+ flex-wrap: nowrap; /* Don't wrap stay horizontal */
762
+ }
763
+
764
+ /* ✅ HStack children share space equally */
765
+ .jux-hstack > * {
766
+ flex: 1;
767
+ min-width: 0;
768
+ }
769
+
770
+ /* ✅ Opt out for intrinsic-size elements */
771
+ .jux-hstack > button,
772
+ .jux-hstack > .jux-button,
773
+ .jux-hstack > .jux-icon,
774
+ .jux-hstack > .jux-fileupload {
775
+ flex: none;
761
776
  }
762
777
 
763
778
  /* ═════════════════════════════════════════════════════════════════
@@ -804,13 +819,11 @@ code {
804
819
 
805
820
  @media (max-width: 768px) {
806
821
  .jux-hstack {
807
- flex-direction: column;
808
- /* Gap remains consistent via CSS variables */
822
+ flex-wrap: wrap; /* ✅ Only wrap on mobile */
809
823
  }
810
824
 
811
- /* Optional: Force HStack to stay horizontal on mobile */
812
825
  .jux-hstack.stay-horizontal {
813
- flex-direction: row;
826
+ flex-wrap: nowrap;
814
827
  }
815
828
  }
816
829
 
@@ -0,0 +1,6 @@
1
+
2
+
3
+ export default function generateId(prefix: string = 'jux', length: number = 9): string {
4
+ const randomPart = Math.random().toString(36).substr(2, length); // Generate a random string
5
+ return `${prefix}-${randomPart}`;
6
+ }