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,209 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- // Event definitions
3
- const TRIGGER_EVENTS = []; // Element has no trigger events
4
- const CALLBACK_EVENTS = []; // Element has no callback events
5
- export class Element extends BaseComponent {
6
- constructor(id, options = {}) {
7
- super(id, {
8
- tagType: options.tagType ?? 'div',
9
- className: options.className ?? '',
10
- text: options.text ?? '',
11
- innerHTML: options.innerHTML ?? '',
12
- attributes: options.attributes ?? {},
13
- styles: options.styles ?? {},
14
- style: options.style ?? '',
15
- class: options.class ?? ''
16
- });
17
- this._element = null;
18
- }
19
- getTriggerEvents() {
20
- return TRIGGER_EVENTS;
21
- }
22
- getCallbackEvents() {
23
- return CALLBACK_EVENTS;
24
- }
25
- /* ═════════════════════════════════════════════════════════════════
26
- * FLUENT API
27
- * ═════════════════════════════════════════════════════════════════ */
28
- // ✅ Inherited from BaseComponent:
29
- // - style(), class()
30
- // - addClass(), removeClass(), toggleClass()
31
- // - visible(), show(), hide(), toggleVisibility()
32
- // - attr(), attrs(), removeAttr()
33
- // - disabled(), enable(), disable()
34
- // - loading()
35
- // - focus(), blur()
36
- // - remove()
37
- // - bind(), sync(), renderTo()
38
- tagType(value) {
39
- this.state.tagType = value;
40
- return this;
41
- }
42
- className(value) {
43
- this.state.className = value;
44
- return this;
45
- }
46
- text(value) {
47
- this.state.text = value;
48
- this.state.innerHTML = '';
49
- return this;
50
- }
51
- innerHTML(value) {
52
- this.state.innerHTML = value;
53
- this.state.text = '';
54
- return this;
55
- }
56
- write(content, asHTML = false, newLine = false) {
57
- if (!this._element) {
58
- console.warn(`Element.write: Element "${this._id}" not yet rendered`);
59
- return this;
60
- }
61
- const contentWithBreak = newLine ? (asHTML ? content + '<br>' : content + '\n') : content;
62
- if (asHTML) {
63
- this._element.insertAdjacentHTML('beforeend', contentWithBreak);
64
- }
65
- else {
66
- const textNode = document.createTextNode(contentWithBreak);
67
- this._element.appendChild(textNode);
68
- }
69
- return this;
70
- }
71
- prepend(content, asHTML = false, newLine = false) {
72
- if (!this._element) {
73
- console.warn(`Element.prepend: Element "${this._id}" not yet rendered`);
74
- return this;
75
- }
76
- const contentWithBreak = newLine ? (asHTML ? content + '<br>' : content + '\n') : content;
77
- if (asHTML) {
78
- this._element.insertAdjacentHTML('afterbegin', contentWithBreak);
79
- }
80
- else {
81
- const textNode = document.createTextNode(contentWithBreak);
82
- this._element.insertBefore(textNode, this._element.firstChild);
83
- }
84
- return this;
85
- }
86
- clear() {
87
- if (!this._element) {
88
- console.warn(`Element.clear: Element "${this._id}" not yet rendered`);
89
- return this;
90
- }
91
- this._element.innerHTML = '';
92
- return this;
93
- }
94
- /**
95
- * Append child component or HTML element
96
- */
97
- append(child) {
98
- if (!this._element) {
99
- console.warn(`Element.append: Element "${this._id}" not yet rendered`);
100
- return this;
101
- }
102
- if (child instanceof HTMLElement) {
103
- this._element.appendChild(child);
104
- }
105
- else if (child?._element) {
106
- // Another Jux component
107
- this._element.appendChild(child._element);
108
- }
109
- else if (typeof child === 'string') {
110
- const div = document.createElement('div');
111
- div.innerHTML = child;
112
- this._element.appendChild(div.firstChild || div);
113
- }
114
- return this;
115
- }
116
- render(targetId) {
117
- const container = this._setupContainer(targetId);
118
- const { tagType, className, text, innerHTML, attributes, styles, style, class: classValue } = this.state;
119
- // Build element
120
- const element = document.createElement(tagType);
121
- element.id = this._id;
122
- if (className)
123
- element.className = className;
124
- if (classValue)
125
- element.className = `${element.className} ${classValue}`.trim();
126
- if (text) {
127
- element.textContent = text;
128
- }
129
- else if (innerHTML) {
130
- element.innerHTML = innerHTML;
131
- }
132
- Object.entries(attributes).forEach(([key, value]) => {
133
- element.setAttribute(key, value);
134
- });
135
- const styleString = Object.entries(styles)
136
- .map(([key, value]) => `${key}: ${value}`)
137
- .join('; ');
138
- if (styleString || style) {
139
- element.setAttribute('style', `${styleString}; ${style}`.trim());
140
- }
141
- // Wire events using inherited method
142
- this._wireStandardEvents(element);
143
- // Wire sync bindings
144
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
145
- const transform = toComponent || ((v) => v);
146
- stateObj.subscribe((val) => {
147
- const transformed = transform(val);
148
- if (property === 'text') {
149
- element.textContent = String(transformed);
150
- this.state.text = String(transformed);
151
- }
152
- else if (property === 'innerHTML') {
153
- element.innerHTML = String(transformed);
154
- this.state.innerHTML = String(transformed);
155
- }
156
- else if (property === 'class') {
157
- element.className = String(transformed);
158
- this.state.class = String(transformed);
159
- }
160
- });
161
- });
162
- container.appendChild(element);
163
- this._element = element;
164
- return this;
165
- }
166
- update(prop, value) {
167
- // No reactive updates needed
168
- }
169
- }
170
- export function element(id, options = {}) {
171
- return new Element(id, options);
172
- }
173
- // Semantic HTML element factories with default classes
174
- export function header(id, options = {}) {
175
- const defaultClass = 'jux-header';
176
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
177
- return new Element(id, { ...options, tagType: 'header', class: mergedClass });
178
- }
179
- export function footer(id, options = {}) {
180
- const defaultClass = 'jux-footer';
181
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
182
- return new Element(id, { ...options, tagType: 'footer', class: mergedClass });
183
- }
184
- export function main(id, options = {}) {
185
- const defaultClass = 'jux-main';
186
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
187
- return new Element(id, { ...options, tagType: 'main', class: mergedClass });
188
- }
189
- export function aside(id, options = {}) {
190
- const defaultClass = 'jux-aside';
191
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
192
- return new Element(id, { ...options, tagType: 'aside', class: mergedClass });
193
- }
194
- export function section(id, options = {}) {
195
- const defaultClass = 'jux-section';
196
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
197
- return new Element(id, { ...options, tagType: 'section', class: mergedClass });
198
- }
199
- export function article(id, options = {}) {
200
- const defaultClass = 'jux-article';
201
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
202
- return new Element(id, { ...options, tagType: 'article', class: mergedClass });
203
- }
204
- export function div(id, options = {}) {
205
- return new Element(id, { ...options, tagType: 'div' });
206
- }
207
- export function span(id, options = {}) {
208
- return new Element(id, { ...options, tagType: 'span' });
209
- }
@@ -1,271 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
-
3
- // Event definitions
4
- const TRIGGER_EVENTS = [] as const; // Element has no trigger events
5
- const CALLBACK_EVENTS = [] as const; // Element has no callback events
6
-
7
- export interface ElementOptions {
8
- tagType?: string;
9
- className?: string;
10
- text?: string;
11
- innerHTML?: string;
12
- attributes?: Record<string, string>;
13
- styles?: Record<string, string>;
14
- style?: string;
15
- class?: string;
16
- }
17
-
18
- type ElementState = {
19
- tagType: string;
20
- className: string;
21
- text: string;
22
- innerHTML: string;
23
- attributes: Record<string, string>;
24
- styles: Record<string, string>;
25
- style: string;
26
- class: string;
27
- };
28
-
29
- export class Element extends BaseComponent<ElementState> {
30
- private _element: HTMLElement | null = null;
31
-
32
- constructor(id: string, options: ElementOptions = {}) {
33
- super(id, {
34
- tagType: options.tagType ?? 'div',
35
- className: options.className ?? '',
36
- text: options.text ?? '',
37
- innerHTML: options.innerHTML ?? '',
38
- attributes: options.attributes ?? {},
39
- styles: options.styles ?? {},
40
- style: options.style ?? '',
41
- class: options.class ?? ''
42
- });
43
- }
44
-
45
- protected getTriggerEvents(): readonly string[] {
46
- return TRIGGER_EVENTS;
47
- }
48
-
49
- protected getCallbackEvents(): readonly string[] {
50
- return CALLBACK_EVENTS;
51
- }
52
-
53
- /* ═════════════════════════════════════════════════════════════════
54
- * FLUENT API
55
- * ═════════════════════════════════════════════════════════════════ */
56
-
57
- // ✅ Inherited from BaseComponent:
58
- // - style(), class()
59
- // - addClass(), removeClass(), toggleClass()
60
- // - visible(), show(), hide(), toggleVisibility()
61
- // - attr(), attrs(), removeAttr()
62
- // - disabled(), enable(), disable()
63
- // - loading()
64
- // - focus(), blur()
65
- // - remove()
66
- // - bind(), sync(), renderTo()
67
-
68
- tagType(value: string): Element {
69
- this.state.tagType = value;
70
- return this;
71
- }
72
-
73
- className(value: string): Element {
74
- this.state.className = value;
75
- return this;
76
- }
77
-
78
- text(value: string): Element {
79
- this.state.text = value;
80
- this.state.innerHTML = '';
81
- return this;
82
- }
83
-
84
- innerHTML(value: string): Element {
85
- this.state.innerHTML = value;
86
- this.state.text = '';
87
- return this;
88
- }
89
-
90
- write(content: string, asHTML: boolean = false, newLine: boolean = false): Element {
91
- if (!this._element) {
92
- console.warn(`Element.write: Element "${this._id}" not yet rendered`);
93
- return this;
94
- }
95
-
96
- const contentWithBreak = newLine ? (asHTML ? content + '<br>' : content + '\n') : content;
97
-
98
- if (asHTML) {
99
- this._element.insertAdjacentHTML('beforeend', contentWithBreak);
100
- } else {
101
- const textNode = document.createTextNode(contentWithBreak);
102
- this._element.appendChild(textNode);
103
- }
104
-
105
- return this;
106
- }
107
-
108
- prepend(content: string, asHTML: boolean = false, newLine: boolean = false): Element {
109
- if (!this._element) {
110
- console.warn(`Element.prepend: Element "${this._id}" not yet rendered`);
111
- return this;
112
- }
113
-
114
- const contentWithBreak = newLine ? (asHTML ? content + '<br>' : content + '\n') : content;
115
-
116
- if (asHTML) {
117
- this._element.insertAdjacentHTML('afterbegin', contentWithBreak);
118
- } else {
119
- const textNode = document.createTextNode(contentWithBreak);
120
- this._element.insertBefore(textNode, this._element.firstChild);
121
- }
122
-
123
- return this;
124
- }
125
-
126
- clear(): Element {
127
- if (!this._element) {
128
- console.warn(`Element.clear: Element "${this._id}" not yet rendered`);
129
- return this;
130
- }
131
-
132
- this._element.innerHTML = '';
133
- return this;
134
- }
135
-
136
- /**
137
- * Append child component or HTML element
138
- */
139
- append(child: any): Element {
140
- if (!this._element) {
141
- console.warn(`Element.append: Element "${this._id}" not yet rendered`);
142
- return this;
143
- }
144
-
145
- if (child instanceof HTMLElement) {
146
- this._element.appendChild(child);
147
- } else if (child?._element) {
148
- // Another Jux component
149
- this._element.appendChild(child._element);
150
- } else if (typeof child === 'string') {
151
- const div = document.createElement('div');
152
- div.innerHTML = child;
153
- this._element.appendChild(div.firstChild || div);
154
- }
155
-
156
- return this;
157
- }
158
-
159
- render(targetId?: string | HTMLElement | BaseComponent<any>): this {
160
- const container = this._setupContainer(targetId);
161
-
162
- const { tagType, className, text, innerHTML, attributes, styles, style, class: classValue } = this.state;
163
-
164
- // Build element
165
- const element = document.createElement(tagType);
166
- element.id = this._id;
167
-
168
- if (className) element.className = className;
169
- if (classValue) element.className = `${element.className} ${classValue}`.trim();
170
-
171
- if (text) {
172
- element.textContent = text;
173
- } else if (innerHTML) {
174
- element.innerHTML = innerHTML;
175
- }
176
-
177
- Object.entries(attributes).forEach(([key, value]) => {
178
- element.setAttribute(key, value);
179
- });
180
-
181
- const styleString = Object.entries(styles)
182
- .map(([key, value]) => `${key}: ${value}`)
183
- .join('; ');
184
-
185
- if (styleString || style) {
186
- element.setAttribute('style', `${styleString}; ${style}`.trim());
187
- }
188
-
189
- // Wire events using inherited method
190
- this._wireStandardEvents(element);
191
-
192
- // Wire sync bindings
193
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
194
- const transform = toComponent || ((v: any) => v);
195
-
196
- stateObj.subscribe((val: any) => {
197
- const transformed = transform(val);
198
-
199
- if (property === 'text') {
200
- element.textContent = String(transformed);
201
- this.state.text = String(transformed);
202
- } else if (property === 'innerHTML') {
203
- element.innerHTML = String(transformed);
204
- this.state.innerHTML = String(transformed);
205
- } else if (property === 'class') {
206
- element.className = String(transformed);
207
- this.state.class = String(transformed);
208
- }
209
- });
210
- });
211
-
212
- container.appendChild(element);
213
- this._element = element;
214
-
215
- return this;
216
- }
217
-
218
- update(prop: string, value: any): void {
219
- // No reactive updates needed
220
- }
221
- }
222
-
223
- export function element(id: string, options: ElementOptions = {}): Element {
224
- return new Element(id, options);
225
- }
226
-
227
- // Semantic HTML element factories with default classes
228
- export function header(id: string, options: Omit<ElementOptions, 'tagType'> = {}): Element {
229
- const defaultClass = 'jux-header';
230
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
231
- return new Element(id, { ...options, tagType: 'header', class: mergedClass });
232
- }
233
-
234
- export function footer(id: string, options: Omit<ElementOptions, 'tagType'> = {}): Element {
235
- const defaultClass = 'jux-footer';
236
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
237
- return new Element(id, { ...options, tagType: 'footer', class: mergedClass });
238
- }
239
-
240
- export function main(id: string, options: Omit<ElementOptions, 'tagType'> = {}): Element {
241
- const defaultClass = 'jux-main';
242
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
243
- return new Element(id, { ...options, tagType: 'main', class: mergedClass });
244
- }
245
-
246
- export function aside(id: string, options: Omit<ElementOptions, 'tagType'> = {}): Element {
247
- const defaultClass = 'jux-aside';
248
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
249
- return new Element(id, { ...options, tagType: 'aside', class: mergedClass });
250
- }
251
-
252
- export function section(id: string, options: Omit<ElementOptions, 'tagType'> = {}): Element {
253
- const defaultClass = 'jux-section';
254
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
255
- return new Element(id, { ...options, tagType: 'section', class: mergedClass });
256
- }
257
-
258
- export function article(id: string, options: Omit<ElementOptions, 'tagType'> = {}): Element {
259
- const defaultClass = 'jux-article';
260
- const mergedClass = options.class ? `${defaultClass} ${options.class}` : defaultClass;
261
- return new Element(id, { ...options, tagType: 'article', class: mergedClass });
262
- }
263
-
264
- export function div(id: string, options: Omit<ElementOptions, 'tagType'> = {}): Element {
265
- return new Element(id, { ...options, tagType: 'div' });
266
- }
267
-
268
- export function span(id: string, options: Omit<ElementOptions, 'tagType'> = {}): Element {
269
- return new Element(id, { ...options, tagType: 'span' });
270
- }
271
-
@@ -1,9 +0,0 @@
1
- export declare class EventChain {
2
- #private;
3
- constructor(id: string);
4
- register(event: string, callback: Function): void;
5
- trigger(event: string, ...args: any[]): void;
6
- unregister(event: string, callback: Function): void;
7
- }
8
- export declare function eventChain(id: string): EventChain;
9
- //# sourceMappingURL=event-chain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"event-chain.d.ts","sourceRoot":"","sources":["event-chain.ts"],"names":[],"mappings":"AACA,qBAAa,UAAU;;gBAEP,EAAE,EAAE,MAAM;IAGtB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAOjD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAO5C,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAMtD;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAEjD"}
@@ -1,33 +0,0 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _EventChain_registeredEvents;
7
- export class EventChain {
8
- constructor(id) {
9
- _EventChain_registeredEvents.set(this, {});
10
- }
11
- register(event, callback) {
12
- if (!__classPrivateFieldGet(this, _EventChain_registeredEvents, "f")[event]) {
13
- __classPrivateFieldGet(this, _EventChain_registeredEvents, "f")[event] = [];
14
- }
15
- __classPrivateFieldGet(this, _EventChain_registeredEvents, "f")[event].push(callback);
16
- }
17
- trigger(event, ...args) {
18
- const callbacks = __classPrivateFieldGet(this, _EventChain_registeredEvents, "f")[event];
19
- if (callbacks) {
20
- callbacks.forEach(callback => callback(...args));
21
- }
22
- }
23
- unregister(event, callback) {
24
- const callbacks = __classPrivateFieldGet(this, _EventChain_registeredEvents, "f")[event];
25
- if (callbacks) {
26
- __classPrivateFieldGet(this, _EventChain_registeredEvents, "f")[event] = callbacks.filter(cb => cb !== callback);
27
- }
28
- }
29
- }
30
- _EventChain_registeredEvents = new WeakMap();
31
- export function eventChain(id) {
32
- return new EventChain(id);
33
- }
@@ -1,98 +0,0 @@
1
- import { BaseComponent, BaseState } from './base/BaseComponent.js';
2
- import { FileStorage } from '../storage/FileStorage.js';
3
- import { DataFrame } from '../storage/DataFrame.js';
4
- export interface FileUploadOptions {
5
- label?: string;
6
- accept?: string;
7
- multiple?: boolean;
8
- icon?: string;
9
- variant?: 'outline' | 'primary' | 'ghost' | 'secondary';
10
- showFileList?: boolean;
11
- maxFiles?: number;
12
- maxFileSize?: number;
13
- disabled?: boolean;
14
- required?: boolean;
15
- name?: string;
16
- onValidate?: (files: File[]) => boolean | string;
17
- storage?: FileStorage;
18
- metadata?: Record<string, any>;
19
- style?: string;
20
- class?: string;
21
- }
22
- type FileUploadState = BaseState & {
23
- label: string;
24
- accept: string;
25
- multiple: boolean;
26
- icon: string;
27
- variant: string;
28
- showFileList: boolean;
29
- maxFiles: number;
30
- maxFileSize: number;
31
- files: File[];
32
- };
33
- export declare class FileUpload extends BaseComponent<FileUploadState> {
34
- private _fileListElement;
35
- private _storage;
36
- private _metadata;
37
- /** IndexedDB caching */
38
- private _cacheEnabled;
39
- private _cacheDriver;
40
- private _cacheDbName;
41
- private _cacheStoreName;
42
- private _cacheKeyPrefix;
43
- private _storageKeys;
44
- private _lastStorageKey;
45
- private _cachedDataFrames;
46
- constructor(id: string, options?: FileUploadOptions);
47
- protected getTriggerEvents(): readonly string[];
48
- protected getCallbackEvents(): readonly string[];
49
- accept(value: string): this;
50
- multiple(value: boolean): this;
51
- icon(value: string): this;
52
- variant(value: 'outline' | 'primary' | 'ghost' | 'secondary'): this;
53
- storage(store: FileStorage, metadata?: Record<string, any>): this;
54
- /**
55
- * Enable IndexedDB caching of uploaded files.
56
- * After upload, the file is parsed and stored as a DataFrame.
57
- * The storage key is available via .storageKey and a 'stored' event fires.
58
- *
59
- * Usage:
60
- * jux.fileUpload('my-upload', { accept: '.csv' })
61
- * .cache() // enable with defaults
62
- * .cache({ prefix: 'raw/' }) // key prefix
63
- * .cache({ dbName: 'my-db' }) // custom DB
64
- *
65
- * upload.bind('stored', (key, df) => {
66
- * await data().fromStorage(key).into(myTable);
67
- * });
68
- */
69
- cache(options?: {
70
- enabled?: boolean;
71
- dbName?: string;
72
- storeName?: string;
73
- prefix?: string;
74
- }): this;
75
- /** The IndexedDB key for the most recently cached upload, or null. */
76
- get storageKey(): string | null;
77
- /** Map of filename → storage key for all cached files this session. */
78
- get storageKeys(): ReadonlyMap<string, string>;
79
- /** Get the storage key for a specific filename. */
80
- storageKeyFor(filename: string): string | null;
81
- /** The cached DataFrame for the most recent upload (after 'stored' fires). */
82
- get cachedDf(): DataFrame | null;
83
- clear(): this;
84
- clearFiles(): this;
85
- getValue(): File[];
86
- setValue(files: File[]): this;
87
- validate(): boolean;
88
- isValid(): boolean;
89
- protected _validateValue(files: File[]): boolean | string;
90
- private _updateFileList;
91
- private _formatFileSize;
92
- private _cacheFile;
93
- update(prop: string, value: any): void;
94
- render(targetId?: string | HTMLElement | BaseComponent<any>): this;
95
- }
96
- export declare function fileupload(id: string, options?: FileUploadOptions): FileUpload;
97
- export {};
98
- //# sourceMappingURL=fileupload.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fileupload.d.ts","sourceRoot":"","sources":["fileupload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGnE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMpD,MAAM,WAAW,iBAAiB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG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