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,216 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- import { renderIcon } from './icons.js';
3
- import { formatIdAsLabel } from '../utils/formatId.js';
4
- // Event definitions
5
- const TRIGGER_EVENTS = [];
6
- const CALLBACK_EVENTS = ['click'];
7
- export class Link extends BaseComponent {
8
- constructor(id, options = {}) {
9
- super(id, {
10
- visible: true,
11
- disabled: options.disabled ?? false,
12
- loading: false,
13
- class: options.class ?? '',
14
- style: options.style ?? '',
15
- attributes: {},
16
- href: options.href ?? `/${id}`,
17
- text: options.text ?? formatIdAsLabel(id),
18
- icon: options.icon ?? '',
19
- iconPosition: options.iconPosition ?? 'left',
20
- target: options.target ?? '_self',
21
- external: options.external ?? false,
22
- active: options.active ?? false
23
- });
24
- }
25
- getTriggerEvents() {
26
- return TRIGGER_EVENTS;
27
- }
28
- getCallbackEvents() {
29
- return CALLBACK_EVENTS;
30
- }
31
- /* ═════════════════════════════════════════════════════════════════
32
- * FLUENT API
33
- * ═════════════════════════════════════════════════════════════════ */
34
- href(value) {
35
- this.state.href = value;
36
- if (this.container) {
37
- const link = this.container.querySelector(`#${this._id}`);
38
- if (link)
39
- link.href = value;
40
- }
41
- return this;
42
- }
43
- text(value) {
44
- this.state.text = value;
45
- if (this.container) {
46
- const link = this.container.querySelector(`#${this._id}`);
47
- if (link) {
48
- const textNode = link.querySelector('.jux-link-text');
49
- if (textNode)
50
- textNode.textContent = value;
51
- }
52
- }
53
- return this;
54
- }
55
- icon(value) {
56
- this.state.icon = value;
57
- return this;
58
- }
59
- iconPosition(value) {
60
- this.state.iconPosition = value;
61
- return this;
62
- }
63
- target(value) {
64
- this.state.target = value;
65
- if (this.container) {
66
- const link = this.container.querySelector(`#${this._id}`);
67
- if (link)
68
- link.target = value;
69
- }
70
- return this;
71
- }
72
- external(value = true) {
73
- this.state.external = value;
74
- if (value) {
75
- this.state.target = '_blank';
76
- }
77
- return this;
78
- }
79
- active(value = true) {
80
- this.state.active = value;
81
- if (this.container) {
82
- const link = this.container.querySelector(`#${this._id}`);
83
- if (link)
84
- link.classList.toggle('jux-link-active', value);
85
- }
86
- return this;
87
- }
88
- /* ═════════════════════════════════════════════════════════════════
89
- * RENDER
90
- * ═════════════════════════════════════════════════════════════════ */
91
- render(targetId) {
92
- const container = this._setupContainer(targetId);
93
- const { href, text, icon, iconPosition, target, external, active, disabled, style, class: className } = this.state;
94
- const link = document.createElement('a');
95
- link.id = this._id;
96
- link.className = 'jux-link';
97
- if (active)
98
- link.classList.add('jux-link-active');
99
- if (disabled)
100
- link.classList.add('jux-link-disabled');
101
- if (className)
102
- link.className += ` ${className}`;
103
- if (style)
104
- link.setAttribute('style', style);
105
- link.href = href;
106
- link.target = target;
107
- // Add rel for external links
108
- if (external || target === '_blank') {
109
- link.rel = 'noopener noreferrer';
110
- }
111
- // Mark as external link for router to ignore
112
- if (external) {
113
- link.dataset.router = 'false';
114
- }
115
- // Icon (left position)
116
- if (icon && iconPosition === 'left') {
117
- const iconEl = document.createElement('span');
118
- iconEl.className = 'jux-link-icon jux-link-icon-left';
119
- iconEl.appendChild(renderIcon(icon));
120
- link.appendChild(iconEl);
121
- }
122
- // Text
123
- const textEl = document.createElement('span');
124
- textEl.className = 'jux-link-text';
125
- textEl.textContent = text;
126
- link.appendChild(textEl);
127
- // Icon (right position)
128
- if (icon && iconPosition === 'right') {
129
- const iconEl = document.createElement('span');
130
- iconEl.className = 'jux-link-icon jux-link-icon-right';
131
- iconEl.appendChild(renderIcon(icon));
132
- link.appendChild(iconEl);
133
- }
134
- // Wire events
135
- this._wireStandardEvents(link);
136
- // Fire click callback
137
- link.addEventListener('click', (e) => {
138
- if (disabled) {
139
- e.preventDefault();
140
- return;
141
- }
142
- this._triggerCallback('click', href);
143
- });
144
- // Sync href changes
145
- const hrefSync = this._syncBindings.find(b => b.property === 'href');
146
- if (hrefSync) {
147
- const transform = hrefSync.toComponent || ((v) => String(v));
148
- hrefSync.stateObj.subscribe((val) => {
149
- this.href(transform(val));
150
- });
151
- }
152
- // Sync text changes
153
- const textSync = this._syncBindings.find(b => b.property === 'text');
154
- if (textSync) {
155
- const transform = textSync.toComponent || ((v) => String(v));
156
- textSync.stateObj.subscribe((val) => {
157
- this.text(transform(val));
158
- });
159
- }
160
- container.appendChild(link);
161
- requestAnimationFrame(() => {
162
- if (window.lucide) {
163
- window.lucide.createIcons();
164
- }
165
- });
166
- return this;
167
- }
168
- update(prop, value) {
169
- if (!this.container)
170
- return;
171
- const link = this.container.querySelector(`#${this._id}`);
172
- if (!link)
173
- return;
174
- switch (prop) {
175
- case 'href':
176
- link.href = value;
177
- break;
178
- case 'text':
179
- const textNode = link.querySelector('.jux-link-text');
180
- if (textNode)
181
- textNode.textContent = value;
182
- break;
183
- case 'active':
184
- link.classList.toggle('jux-link-active', value);
185
- break;
186
- case 'disabled':
187
- link.classList.toggle('jux-link-disabled', value);
188
- break;
189
- case 'target':
190
- link.target = value;
191
- break;
192
- default:
193
- super.update(prop, value);
194
- break;
195
- }
196
- }
197
- }
198
- export function link(id, options = {}) {
199
- return new Link(id, options);
200
- }
201
- // Convenience helpers
202
- export function navLink(id, text) {
203
- return new Link(id, {
204
- href: `/${id}`,
205
- text: text || formatIdAsLabel(id)
206
- });
207
- }
208
- export function externalLink(id, href, text) {
209
- return new Link(id, {
210
- href,
211
- text: text || formatIdAsLabel(id),
212
- external: true,
213
- icon: 'external-link',
214
- iconPosition: 'right'
215
- });
216
- }
@@ -1,268 +0,0 @@
1
- import { BaseComponent, BaseState } from './base/BaseComponent.js';
2
- import { renderIcon } from './icons.js';
3
- import { formatIdAsLabel } from '../utils/formatId.js';
4
-
5
- // Event definitions
6
- const TRIGGER_EVENTS = [] as const;
7
- const CALLBACK_EVENTS = ['click'] as const;
8
-
9
- export interface LinkOptions {
10
- href?: string;
11
- text?: string;
12
- icon?: string;
13
- iconPosition?: 'left' | 'right';
14
- target?: '_self' | '_blank' | '_parent' | '_top';
15
- external?: boolean;
16
- active?: boolean;
17
- disabled?: boolean;
18
- style?: string;
19
- class?: string;
20
- }
21
-
22
- interface LinkState extends BaseState {
23
- href: string;
24
- text: string;
25
- icon: string;
26
- iconPosition: 'left' | 'right';
27
- target: string;
28
- external: boolean;
29
- active: boolean;
30
- }
31
-
32
- export class Link extends BaseComponent<LinkState> {
33
- constructor(id: string, options: LinkOptions = {}) {
34
- super(id, {
35
- visible: true,
36
- disabled: options.disabled ?? false,
37
- loading: false,
38
- class: options.class ?? '',
39
- style: options.style ?? '',
40
- attributes: {},
41
- href: options.href ?? `/${id}`,
42
- text: options.text ?? formatIdAsLabel(id),
43
- icon: options.icon ?? '',
44
- iconPosition: options.iconPosition ?? 'left',
45
- target: options.target ?? '_self',
46
- external: options.external ?? false,
47
- active: options.active ?? false
48
- });
49
- }
50
-
51
- protected getTriggerEvents(): readonly string[] {
52
- return TRIGGER_EVENTS;
53
- }
54
-
55
- protected getCallbackEvents(): readonly string[] {
56
- return CALLBACK_EVENTS;
57
- }
58
-
59
- /* ═════════════════════════════════════════════════════════════════
60
- * FLUENT API
61
- * ═════════════════════════════════════════════════════════════════ */
62
-
63
- href(value: string): this {
64
- this.state.href = value;
65
- if (this.container) {
66
- const link = this.container.querySelector(`#${this._id}`) as HTMLAnchorElement;
67
- if (link) link.href = value;
68
- }
69
- return this;
70
- }
71
-
72
- text(value: string): this {
73
- this.state.text = value;
74
- if (this.container) {
75
- const link = this.container.querySelector(`#${this._id}`) as HTMLAnchorElement;
76
- if (link) {
77
- const textNode = link.querySelector('.jux-link-text');
78
- if (textNode) textNode.textContent = value;
79
- }
80
- }
81
- return this;
82
- }
83
-
84
- icon(value: string): this {
85
- this.state.icon = value;
86
- return this;
87
- }
88
-
89
- iconPosition(value: 'left' | 'right'): this {
90
- this.state.iconPosition = value;
91
- return this;
92
- }
93
-
94
- target(value: '_self' | '_blank' | '_parent' | '_top'): this {
95
- this.state.target = value;
96
- if (this.container) {
97
- const link = this.container.querySelector(`#${this._id}`) as HTMLAnchorElement;
98
- if (link) link.target = value;
99
- }
100
- return this;
101
- }
102
-
103
- external(value: boolean = true): this {
104
- this.state.external = value;
105
- if (value) {
106
- this.state.target = '_blank';
107
- }
108
- return this;
109
- }
110
-
111
- active(value: boolean = true): this {
112
- this.state.active = value;
113
- if (this.container) {
114
- const link = this.container.querySelector(`#${this._id}`) as HTMLAnchorElement;
115
- if (link) link.classList.toggle('jux-link-active', value);
116
- }
117
- return this;
118
- }
119
-
120
- /* ═════════════════════════════════════════════════════════════════
121
- * RENDER
122
- * ═════════════════════════════════════════════════════════════════ */
123
-
124
- render(targetId?: string | HTMLElement | BaseComponent<any>): this {
125
- const container = this._setupContainer(targetId);
126
-
127
- const { href, text, icon, iconPosition, target, external, active, disabled, style, class: className } = this.state;
128
-
129
- const link = document.createElement('a');
130
- link.id = this._id;
131
- link.className = 'jux-link';
132
- if (active) link.classList.add('jux-link-active');
133
- if (disabled) link.classList.add('jux-link-disabled');
134
- if (className) link.className += ` ${className}`;
135
- if (style) link.setAttribute('style', style);
136
-
137
- link.href = href;
138
- link.target = target;
139
-
140
- // Add rel for external links
141
- if (external || target === '_blank') {
142
- link.rel = 'noopener noreferrer';
143
- }
144
-
145
- // Mark as external link for router to ignore
146
- if (external) {
147
- link.dataset.router = 'false';
148
- }
149
-
150
- // Icon (left position)
151
- if (icon && iconPosition === 'left') {
152
- const iconEl = document.createElement('span');
153
- iconEl.className = 'jux-link-icon jux-link-icon-left';
154
- iconEl.appendChild(renderIcon(icon));
155
- link.appendChild(iconEl);
156
- }
157
-
158
- // Text
159
- const textEl = document.createElement('span');
160
- textEl.className = 'jux-link-text';
161
- textEl.textContent = text;
162
- link.appendChild(textEl);
163
-
164
- // Icon (right position)
165
- if (icon && iconPosition === 'right') {
166
- const iconEl = document.createElement('span');
167
- iconEl.className = 'jux-link-icon jux-link-icon-right';
168
- iconEl.appendChild(renderIcon(icon));
169
- link.appendChild(iconEl);
170
- }
171
-
172
- // Wire events
173
- this._wireStandardEvents(link);
174
-
175
- // Fire click callback
176
- link.addEventListener('click', (e) => {
177
- if (disabled) {
178
- e.preventDefault();
179
- return;
180
- }
181
- this._triggerCallback('click', href);
182
- });
183
-
184
- // Sync href changes
185
- const hrefSync = this._syncBindings.find(b => b.property === 'href');
186
- if (hrefSync) {
187
- const transform = hrefSync.toComponent || ((v: any) => String(v));
188
- hrefSync.stateObj.subscribe((val: any) => {
189
- this.href(transform(val));
190
- });
191
- }
192
-
193
- // Sync text changes
194
- const textSync = this._syncBindings.find(b => b.property === 'text');
195
- if (textSync) {
196
- const transform = textSync.toComponent || ((v: any) => String(v));
197
- textSync.stateObj.subscribe((val: any) => {
198
- this.text(transform(val));
199
- });
200
- }
201
-
202
- container.appendChild(link);
203
-
204
- requestAnimationFrame(() => {
205
- if ((window as any).lucide) {
206
- (window as any).lucide.createIcons();
207
- }
208
- });
209
-
210
- return this;
211
- }
212
-
213
- update(prop: string, value: any): void {
214
- if (!this.container) return;
215
-
216
- const link = this.container.querySelector(`#${this._id}`) as HTMLAnchorElement;
217
- if (!link) return;
218
-
219
- switch (prop) {
220
- case 'href':
221
- link.href = value;
222
- break;
223
-
224
- case 'text':
225
- const textNode = link.querySelector('.jux-link-text');
226
- if (textNode) textNode.textContent = value;
227
- break;
228
-
229
- case 'active':
230
- link.classList.toggle('jux-link-active', value);
231
- break;
232
-
233
- case 'disabled':
234
- link.classList.toggle('jux-link-disabled', value);
235
- break;
236
-
237
- case 'target':
238
- link.target = value;
239
- break;
240
-
241
- default:
242
- super.update(prop, value);
243
- break;
244
- }
245
- }
246
- }
247
-
248
- export function link(id: string, options: LinkOptions = {}): Link {
249
- return new Link(id, options);
250
- }
251
-
252
- // Convenience helpers
253
- export function navLink(id: string, text?: string): Link {
254
- return new Link(id, {
255
- href: `/${id}`,
256
- text: text || formatIdAsLabel(id)
257
- });
258
- }
259
-
260
- export function externalLink(id: string, href: string, text?: string): Link {
261
- return new Link(id, {
262
- href,
263
- text: text || formatIdAsLabel(id),
264
- external: true,
265
- icon: 'external-link',
266
- iconPosition: 'right'
267
- });
268
- }
@@ -1,83 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- export interface ListItem {
3
- id?: string;
4
- icon?: string;
5
- title?: string;
6
- body?: string;
7
- type?: 'success' | 'warning' | 'error' | 'info' | 'default' | string;
8
- metadata?: string;
9
- itemClass?: string;
10
- disabled?: boolean;
11
- selected?: boolean;
12
- data?: any;
13
- }
14
- export interface ListOptions {
15
- items?: (ListItem | string)[];
16
- header?: string;
17
- gap?: string;
18
- direction?: 'vertical' | 'horizontal';
19
- selectable?: boolean;
20
- multiSelect?: boolean;
21
- selectedIndex?: number | null;
22
- selectedIndices?: number[];
23
- onItemClick?: (item: ListItem, index: number, e: Event) => void;
24
- onItemDoubleClick?: (item: ListItem, index: number, e: Event) => void;
25
- onSelectionChange?: (selectedItems: ListItem[], selectedIndices: number[]) => void;
26
- ordered?: boolean;
27
- striped?: boolean;
28
- hoverable?: boolean;
29
- bordered?: boolean;
30
- style?: string;
31
- class?: string;
32
- }
33
- type ListState = {
34
- items: ListItem[];
35
- header: string;
36
- gap: string;
37
- direction: string;
38
- selectable: boolean;
39
- multiSelect: boolean;
40
- selectedIndex: number | null;
41
- selectedIndices: number[];
42
- ordered: boolean;
43
- striped: boolean;
44
- hoverable: boolean;
45
- bordered: boolean;
46
- style: string;
47
- class: string;
48
- };
49
- export declare class List extends BaseComponent<ListState> {
50
- private _onItemClick;
51
- private _onItemDoubleClick;
52
- private _onSelectionChange;
53
- private _listElement;
54
- constructor(id: string, options?: ListOptions);
55
- protected getTriggerEvents(): readonly string[];
56
- protected getCallbackEvents(): readonly string[];
57
- items(value: (ListItem | string)[]): this;
58
- addItem(value: ListItem | string): this;
59
- removeItem(index: number): this;
60
- updateItem(index: number, updates: Partial<ListItem>): this;
61
- clearItems(): this;
62
- itemClass(className: string): this;
63
- ordered(value: boolean): this;
64
- selectable(value: boolean): this;
65
- multiSelect(value: boolean): this;
66
- striped(value: boolean): this;
67
- hoverable(value: boolean): this;
68
- bordered(value: boolean): this;
69
- selectItem(index: number): this;
70
- deselectItem(index: number): this;
71
- clearSelection(): this;
72
- getSelectedItems(): ListItem[];
73
- getSelectedIndices(): number[];
74
- private _updateList;
75
- private _updateSelection;
76
- private _triggerSelectionChange;
77
- private _renderItems;
78
- render(targetId?: string | HTMLElement | BaseComponent<any>): this;
79
- update(prop: string, value: any): void;
80
- }
81
- export declare function list(id: string, options?: ListOptions): List;
82
- export {};
83
- //# sourceMappingURL=list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAOxD,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,CAAC,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,WAAW,CAAC,EA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