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,208 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- // Event definitions - Grid is layout-only, no interactive events
3
- const TRIGGER_EVENTS = [];
4
- const CALLBACK_EVENTS = [];
5
- export class Grid extends BaseComponent {
6
- constructor(id, options = {}) {
7
- // Normalize columns/rows to config arrays
8
- const columnsConfig = normalizeTrackConfig(options.columns || 1);
9
- const rowsConfig = normalizeTrackConfig(options.rows || 1);
10
- super(id, {
11
- rows: rowsConfig,
12
- columns: columnsConfig,
13
- boundary: {
14
- width: options.width ?? '', // ✅ CHANGE: Empty = inherit parent
15
- height: options.height ?? '' // ✅ CHANGE: Empty = inherit parent
16
- },
17
- gap: options.gap ?? '0',
18
- cells: new Map(),
19
- style: options.style ?? '',
20
- class: options.class ?? '',
21
- gridder: false
22
- });
23
- }
24
- getTriggerEvents() {
25
- return TRIGGER_EVENTS;
26
- }
27
- getCallbackEvents() {
28
- return CALLBACK_EVENTS;
29
- }
30
- /* ═════════════════════════════════════════════════════════════════
31
- * PROPS ACCESSOR - Inherited from BaseComponent
32
- * ═════════════════════════════════════════════════════════════════ */
33
- // ✅ Already available via BaseComponent.props getter
34
- // Access: grid.props.rows, grid.props.columns, grid.props.gap, etc.
35
- /* ═════════════════════════════════════════════════════════════════
36
- * FLUENT API - The Blueprint (Setters)
37
- * ═════════════════════════════════════════════════════════════════ */
38
- width(value) {
39
- this.state.boundary.width = value;
40
- return this;
41
- }
42
- height(value) {
43
- this.state.boundary.height = value;
44
- return this;
45
- }
46
- gap(value) {
47
- this.state.gap = value;
48
- return this;
49
- }
50
- /**
51
- * Define rows (SETTER)
52
- * @param config - Number (creates N equal rows) or Array of row configs
53
- */
54
- rows(config) {
55
- this.state.rows = normalizeTrackConfig(config);
56
- return this;
57
- }
58
- /**
59
- * Define columns (SETTER)
60
- * @param config - Number (creates N equal columns) or Array of column configs
61
- */
62
- columns(config) {
63
- this.state.columns = normalizeTrackConfig(config);
64
- return this;
65
- }
66
- /**
67
- * Get the cell ID for a specific coordinate
68
- */
69
- getCellId(row, col) {
70
- return `${this._id}-${row}-${col}`;
71
- }
72
- /**
73
- * Get the DOM element for a specific cell
74
- */
75
- getCell(row, col) {
76
- const cellId = this.getCellId(row, col);
77
- return this.state.cells.get(cellId);
78
- }
79
- /**
80
- * ✅ Enable blueprint/wireframe visualization
81
- * Shows grid structure, cell coordinates, and geometric borders
82
- */
83
- gridder(value = true) {
84
- this.state.gridder = value;
85
- return this;
86
- }
87
- /* ═════════════════════════════════════════════════════════════════
88
- * ORCHESTRATION - The Execution
89
- * ═════════════════════════════════════════════════════════════════ */
90
- /**
91
- * Pattern B: The Static Orchestration
92
- * Creates the grid and populates it with items in one operation
93
- */
94
- create(config) {
95
- // Apply configuration
96
- if (config.columns) {
97
- this.columns(config.columns);
98
- }
99
- if (config.rows) {
100
- this.rows(config.rows);
101
- }
102
- // Render the grid structure
103
- this.render();
104
- // Populate items
105
- if (config.items) {
106
- config.items.forEach(item => {
107
- const targetId = item.target.replace(/^#/, '');
108
- const cell = document.getElementById(targetId);
109
- if (!cell) {
110
- console.warn(`[Grid] Cell not found: ${item.target}`);
111
- return;
112
- }
113
- if (item.component) {
114
- // Render Jux component
115
- item.component.render(`#${targetId}`);
116
- }
117
- else if (item.html) {
118
- cell.innerHTML = item.html;
119
- }
120
- else if (item.text) {
121
- cell.textContent = item.text;
122
- }
123
- });
124
- }
125
- return this;
126
- }
127
- /* ═════════════════════════════════════════════════════════════════
128
- * RENDER
129
- * ═════════════════════════════════════════════════════════════════ */
130
- render(targetId) {
131
- const container = this._setupContainer(targetId);
132
- const { rows, columns, boundary, gap, style, class: className, gridder } = this.state;
133
- // Build grid container
134
- const grid = document.createElement('div');
135
- grid.className = 'jux-grid';
136
- grid.id = this._id;
137
- if (gridder)
138
- grid.classList.add('jux-grid-gridder');
139
- if (className)
140
- grid.className += ` ${className}`;
141
- // Apply grid styles
142
- const gridTemplateRows = rows.map(r => r.height || '1fr').join(' ');
143
- const gridTemplateColumns = columns.map(c => c.width || '1fr').join(' ');
144
- const gridStyle = `
145
- display: grid;
146
- grid-template-rows: ${gridTemplateRows};
147
- grid-template-columns: ${gridTemplateColumns};
148
- gap: ${gap};
149
- ${boundary.width ? `width: ${boundary.width};` : ''} /* ✅ CHANGE: Only apply if set */
150
- ${boundary.height ? `height: ${boundary.height};` : ''} /* ✅ CHANGE: Only apply if set */
151
- ${style}
152
- `;
153
- grid.setAttribute('style', gridStyle.trim());
154
- // Generate cells with coordinate-based IDs
155
- this.state.cells.clear();
156
- rows.forEach((row, rowIndex) => {
157
- columns.forEach((col, colIndex) => {
158
- const cell = document.createElement('div');
159
- const cellId = this.getCellId(rowIndex, colIndex);
160
- cell.id = cellId;
161
- cell.className = 'jux-grid-cell';
162
- cell.setAttribute('data-row', String(rowIndex));
163
- cell.setAttribute('data-col', String(colIndex));
164
- // ✅ CHANGE: Use title attribute instead of DOM element
165
- if (gridder) {
166
- cell.setAttribute('title', `Cell [${rowIndex},${colIndex}] — #${cellId}`);
167
- }
168
- // Apply row-specific styles
169
- if (row.style) {
170
- cell.setAttribute('style', (cell.getAttribute('style') || '') + row.style);
171
- }
172
- if (row.class) {
173
- cell.className += ` ${row.class}`;
174
- }
175
- // Apply column-specific styles
176
- if (col.style) {
177
- cell.setAttribute('style', (cell.getAttribute('style') || '') + col.style);
178
- }
179
- if (col.class) {
180
- cell.className += ` ${col.class}`;
181
- }
182
- this.state.cells.set(cellId, cell);
183
- grid.appendChild(cell);
184
- });
185
- });
186
- this._wireStandardEvents(grid);
187
- container.appendChild(grid);
188
- return this;
189
- }
190
- update(prop, value) {
191
- // No reactive updates needed
192
- }
193
- }
194
- /**
195
- * Normalize track configuration to array format
196
- */
197
- function normalizeTrackConfig(config) {
198
- if (typeof config === 'number') {
199
- return Array(config).fill({});
200
- }
201
- return config;
202
- }
203
- /**
204
- * Factory function
205
- */
206
- export function grid(id, options = {}) {
207
- return new Grid(id, options);
208
- }
@@ -1,295 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
-
3
- // Event definitions - Grid is layout-only, no interactive events
4
- const TRIGGER_EVENTS = [] as const;
5
- const CALLBACK_EVENTS = [] as const;
6
-
7
- export interface GridRowConfig {
8
- height?: string;
9
- style?: string;
10
- class?: string;
11
- }
12
-
13
- export interface GridColumnConfig {
14
- width?: string;
15
- style?: string;
16
- class?: string;
17
- }
18
-
19
- export interface GridItemConfig {
20
- target: string; // e.g., "#Dashboard-0-1"
21
- text?: string;
22
- html?: string;
23
- component?: any; // Jux component instance
24
- }
25
-
26
- export interface GridCreateConfig {
27
- columns?: GridColumnConfig[] | number;
28
- rows?: GridRowConfig[] | number;
29
- items?: GridItemConfig[];
30
- }
31
-
32
- export interface GridOptions {
33
- columns?: GridColumnConfig[] | number;
34
- rows?: GridRowConfig[] | number;
35
- width?: string;
36
- height?: string;
37
- gap?: string;
38
- style?: string;
39
- class?: string;
40
- }
41
-
42
- type GridState = {
43
- rows: GridRowConfig[];
44
- columns: GridColumnConfig[];
45
- boundary: {
46
- width: string;
47
- height: string;
48
- };
49
- gap: string;
50
- cells: Map<string, HTMLElement>;
51
- style: string;
52
- class: string;
53
- gridder: boolean; // ✅ ADD: Enable blueprint visualization
54
- };
55
-
56
- export class Grid extends BaseComponent<GridState> {
57
- constructor(id: string, options: GridOptions = {}) {
58
- // Normalize columns/rows to config arrays
59
- const columnsConfig = normalizeTrackConfig(options.columns || 1);
60
- const rowsConfig = normalizeTrackConfig(options.rows || 1);
61
-
62
- super(id, {
63
- rows: rowsConfig,
64
- columns: columnsConfig,
65
- boundary: {
66
- width: options.width ?? '', // ✅ CHANGE: Empty = inherit parent
67
- height: options.height ?? '' // ✅ CHANGE: Empty = inherit parent
68
- },
69
- gap: options.gap ?? '0',
70
- cells: new Map(),
71
- style: options.style ?? '',
72
- class: options.class ?? '',
73
- gridder: false
74
- });
75
- }
76
-
77
- protected getTriggerEvents(): readonly string[] {
78
- return TRIGGER_EVENTS;
79
- }
80
-
81
- protected getCallbackEvents(): readonly string[] {
82
- return CALLBACK_EVENTS;
83
- }
84
-
85
- /* ═════════════════════════════════════════════════════════════════
86
- * PROPS ACCESSOR - Inherited from BaseComponent
87
- * ═════════════════════════════════════════════════════════════════ */
88
-
89
- // ✅ Already available via BaseComponent.props getter
90
- // Access: grid.props.rows, grid.props.columns, grid.props.gap, etc.
91
-
92
- /* ═════════════════════════════════════════════════════════════════
93
- * FLUENT API - The Blueprint (Setters)
94
- * ═════════════════════════════════════════════════════════════════ */
95
-
96
- width(value: string): this {
97
- this.state.boundary.width = value;
98
- return this;
99
- }
100
-
101
- height(value: string): this {
102
- this.state.boundary.height = value;
103
- return this;
104
- }
105
-
106
- gap(value: string): this {
107
- this.state.gap = value;
108
- return this;
109
- }
110
-
111
- /**
112
- * Define rows (SETTER)
113
- * @param config - Number (creates N equal rows) or Array of row configs
114
- */
115
- rows(config: GridRowConfig[] | number): this {
116
- this.state.rows = normalizeTrackConfig(config);
117
- return this;
118
- }
119
-
120
- /**
121
- * Define columns (SETTER)
122
- * @param config - Number (creates N equal columns) or Array of column configs
123
- */
124
- columns(config: GridColumnConfig[] | number): this {
125
- this.state.columns = normalizeTrackConfig(config);
126
- return this;
127
- }
128
-
129
- /**
130
- * Get the cell ID for a specific coordinate
131
- */
132
- getCellId(row: number, col: number): string {
133
- return `${this._id}-${row}-${col}`;
134
- }
135
-
136
- /**
137
- * Get the DOM element for a specific cell
138
- */
139
- getCell(row: number, col: number): HTMLElement | undefined {
140
- const cellId = this.getCellId(row, col);
141
- return this.state.cells.get(cellId);
142
- }
143
-
144
- /**
145
- * ✅ Enable blueprint/wireframe visualization
146
- * Shows grid structure, cell coordinates, and geometric borders
147
- */
148
- gridder(value: boolean = true): this {
149
- this.state.gridder = value;
150
- return this;
151
- }
152
-
153
- /* ═════════════════════════════════════════════════════════════════
154
- * ORCHESTRATION - The Execution
155
- * ═════════════════════════════════════════════════════════════════ */
156
-
157
- /**
158
- * Pattern B: The Static Orchestration
159
- * Creates the grid and populates it with items in one operation
160
- */
161
- create(config: GridCreateConfig): this {
162
- // Apply configuration
163
- if (config.columns) {
164
- this.columns(config.columns);
165
- }
166
- if (config.rows) {
167
- this.rows(config.rows);
168
- }
169
-
170
- // Render the grid structure
171
- this.render();
172
-
173
- // Populate items
174
- if (config.items) {
175
- config.items.forEach(item => {
176
- const targetId = item.target.replace(/^#/, '');
177
- const cell = document.getElementById(targetId);
178
-
179
- if (!cell) {
180
- console.warn(`[Grid] Cell not found: ${item.target}`);
181
- return;
182
- }
183
-
184
- if (item.component) {
185
- // Render Jux component
186
- item.component.render(`#${targetId}`);
187
- } else if (item.html) {
188
- cell.innerHTML = item.html;
189
- } else if (item.text) {
190
- cell.textContent = item.text;
191
- }
192
- });
193
- }
194
-
195
- return this;
196
- }
197
-
198
- /* ═════════════════════════════════════════════════════════════════
199
- * RENDER
200
- * ═════════════════════════════════════════════════════════════════ */
201
-
202
- render(targetId?: string | HTMLElement | BaseComponent<any>): this {
203
- const container = this._setupContainer(targetId);
204
-
205
- const { rows, columns, boundary, gap, style, class: className, gridder } = this.state;
206
-
207
- // Build grid container
208
- const grid = document.createElement('div');
209
- grid.className = 'jux-grid';
210
- grid.id = this._id;
211
- if (gridder) grid.classList.add('jux-grid-gridder');
212
- if (className) grid.className += ` ${className}`;
213
-
214
- // Apply grid styles
215
- const gridTemplateRows = rows.map(r => r.height || '1fr').join(' ');
216
- const gridTemplateColumns = columns.map(c => c.width || '1fr').join(' ');
217
-
218
- const gridStyle = `
219
- display: grid;
220
- grid-template-rows: ${gridTemplateRows};
221
- grid-template-columns: ${gridTemplateColumns};
222
- gap: ${gap};
223
- ${boundary.width ? `width: ${boundary.width};` : ''} /* ✅ CHANGE: Only apply if set */
224
- ${boundary.height ? `height: ${boundary.height};` : ''} /* ✅ CHANGE: Only apply if set */
225
- ${style}
226
- `;
227
-
228
- grid.setAttribute('style', gridStyle.trim());
229
-
230
- // Generate cells with coordinate-based IDs
231
- this.state.cells.clear();
232
-
233
- rows.forEach((row, rowIndex) => {
234
- columns.forEach((col, colIndex) => {
235
- const cell = document.createElement('div');
236
- const cellId = this.getCellId(rowIndex, colIndex);
237
-
238
- cell.id = cellId;
239
- cell.className = 'jux-grid-cell';
240
- cell.setAttribute('data-row', String(rowIndex));
241
- cell.setAttribute('data-col', String(colIndex));
242
-
243
- // ✅ CHANGE: Use title attribute instead of DOM element
244
- if (gridder) {
245
- cell.setAttribute('title', `Cell [${rowIndex},${colIndex}] — #${cellId}`);
246
- }
247
-
248
- // Apply row-specific styles
249
- if (row.style) {
250
- cell.setAttribute('style', (cell.getAttribute('style') || '') + row.style);
251
- }
252
- if (row.class) {
253
- cell.className += ` ${row.class}`;
254
- }
255
-
256
- // Apply column-specific styles
257
- if (col.style) {
258
- cell.setAttribute('style', (cell.getAttribute('style') || '') + col.style);
259
- }
260
- if (col.class) {
261
- cell.className += ` ${col.class}`;
262
- }
263
-
264
- this.state.cells.set(cellId, cell);
265
- grid.appendChild(cell);
266
- });
267
- });
268
-
269
- this._wireStandardEvents(grid);
270
-
271
- container.appendChild(grid);
272
- return this;
273
- }
274
-
275
- update(prop: string, value: any): void {
276
- // No reactive updates needed
277
- }
278
- }
279
-
280
- /**
281
- * Normalize track configuration to array format
282
- */
283
- function normalizeTrackConfig(config: GridRowConfig[] | GridColumnConfig[] | number): any[] {
284
- if (typeof config === 'number') {
285
- return Array(config).fill({});
286
- }
287
- return config;
288
- }
289
-
290
- /**
291
- * Factory function
292
- */
293
- export function grid(id: string, options: GridOptions = {}): Grid {
294
- return new Grid(id, options);
295
- }
@@ -1,25 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- export interface HeadingOptions {
3
- level?: 1 | 2 | 3 | 4 | 5 | 6;
4
- content?: string;
5
- class?: string;
6
- style?: string;
7
- }
8
- type HeadingState = {
9
- level: 1 | 2 | 3 | 4 | 5 | 6;
10
- content: string;
11
- class: string;
12
- style: string;
13
- };
14
- export declare class Heading extends BaseComponent<HeadingState> {
15
- constructor(id: string, options?: HeadingOptions);
16
- protected getTriggerEvents(): readonly string[];
17
- protected getCallbackEvents(): readonly string[];
18
- update(prop: string, value: any): void;
19
- level(value: 1 | 2 | 3 | 4 | 5 | 6): this;
20
- content(value: string): this;
21
- render(targetId?: string | HTMLElement | BaseComponent<any>): this;
22
- }
23
- export declare function heading(id: string, options?: HeadingOptions): Heading;
24
- export {};
25
- //# sourceMappingURL=heading.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["heading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD,MAAM,WAAW,cAAc;IAC3B,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,YAAY,GAAG;IAChB,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,OAAQ,SAAQ,aAAa,CAAC,YAAY,CAAC;gBACxC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB;IASpD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAIhD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IA0BtC,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI;IAKzC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAS5B,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CA8BrE;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAEzE"}
@@ -1,83 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- // Event definitions
3
- const TRIGGER_EVENTS = [];
4
- const CALLBACK_EVENTS = []; // Headings are display-only, no events
5
- export class Heading extends BaseComponent {
6
- constructor(id, options = {}) {
7
- super(id, {
8
- level: options.level ?? 1,
9
- content: options.content ?? '',
10
- class: options.class ?? '',
11
- style: options.style ?? ''
12
- });
13
- }
14
- getTriggerEvents() {
15
- return TRIGGER_EVENTS;
16
- }
17
- getCallbackEvents() {
18
- return CALLBACK_EVENTS;
19
- }
20
- update(prop, value) {
21
- const el = document.getElementById(this._id);
22
- if (!el)
23
- return;
24
- switch (prop) {
25
- case 'content':
26
- el.textContent = value;
27
- break;
28
- case 'level':
29
- // Would need to recreate element - skip for now
30
- break;
31
- default:
32
- super.update(prop, value);
33
- break;
34
- }
35
- }
36
- /* ═════════════════════════════════════════════════════════════════
37
- * FLUENT API
38
- * ═════════════════════════════════════════════════════════════════ */
39
- // ✅ Inherited from BaseComponent:
40
- // - style(), class()
41
- // - bind(), sync(), renderTo()
42
- // - All other base methods
43
- level(value) {
44
- this.state.level = value;
45
- return this;
46
- }
47
- content(value) {
48
- this.state.content = value;
49
- return this;
50
- }
51
- /* ═════════════════════════════════════════════════════════════════
52
- * RENDER
53
- * ═════════════════════════════════════════════════════════════════ */
54
- render(targetId) {
55
- const container = this._setupContainer(targetId);
56
- const { content, level, style, class: className } = this.state;
57
- const heading = document.createElement(`h${level}`);
58
- heading.className = `jux-heading jux-heading-${level}`;
59
- heading.id = this._id;
60
- heading.textContent = content;
61
- if (className)
62
- heading.className += ` ${className}`;
63
- if (style)
64
- heading.setAttribute('style', style);
65
- this._wireStandardEvents(heading);
66
- // Wire sync bindings
67
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
68
- if (property === 'content') {
69
- const transform = toComponent || ((v) => String(v));
70
- stateObj.subscribe((val) => {
71
- const transformed = transform(val);
72
- heading.textContent = transformed;
73
- this.state.content = transformed;
74
- });
75
- }
76
- });
77
- container.appendChild(heading);
78
- return this;
79
- }
80
- }
81
- export function heading(id, options = {}) {
82
- return new Heading(id, options);
83
- }