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,576 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- import { renderIcon } from './icons.js';
3
-
4
- // Event definitions
5
- const TRIGGER_EVENTS = [] as const;
6
- const CALLBACK_EVENTS = ['open', 'close'] as const;
7
-
8
- export type EmojiIconType = {
9
- // Can be an emoji character or an icon name from a collection
10
- icon: string;
11
- collection?: 'lucide' | 'heroicons' | 'material-symbols' | 'material' | 'icon-park' | string;
12
- }
13
- export interface ModalOptions {
14
- title?: string;
15
- content?: string | BaseComponent<any> | Array<string | BaseComponent<any>>;
16
- icon?: EmojiIconType | undefined;
17
- close?: boolean;
18
- backdropClose?: boolean;
19
- position?: 'bottom' | 'center' | 'top' | 'fullscreen' | 'popover' | 'popover-top' | 'popover-bottom' | 'popover-left' | 'popover-right';
20
- size?: 'small' | 'medium' | 'large';
21
- actions?: Array<{ label: string; variant?: string; click?: () => void } | Array<BaseComponent<any>>>;
22
- style?: string;
23
- class?: string;
24
- }
25
-
26
- type ModalState = {
27
- title: string;
28
- content: string | BaseComponent<any> | Array<string | BaseComponent<any>>;
29
- icon: EmojiIconType | undefined;
30
- close: boolean;
31
- backdropClose: boolean;
32
- position?: 'bottom' | 'center' | 'top' | 'fullscreen' | 'popover' | 'popover-top' | 'popover-bottom' | 'popover-left' | 'popover-right';
33
- size: string;
34
- open: boolean;
35
- actions: Array<{ label: string; variant?: string; click?: () => void } | Array<BaseComponent<any>>>;
36
- style: string;
37
- class: string;
38
- };
39
-
40
- export class Modal extends BaseComponent<ModalState> {
41
- private _overlay: HTMLElement | null = null;
42
-
43
- constructor(id: string, options: ModalOptions = {}) {
44
- super(id, {
45
- title: options.title ?? '',
46
- content: options.content ?? '',
47
- icon: options.icon ?? undefined,
48
- close: options.close ?? true,
49
- backdropClose: options.backdropClose ?? true,
50
- position: options.position,
51
- size: options.size ?? 'medium',
52
- open: false,
53
- actions: options.actions ?? [],
54
- style: options.style ?? '',
55
- class: options.class ?? ''
56
- });
57
- }
58
-
59
- protected getTriggerEvents(): readonly string[] {
60
- return TRIGGER_EVENTS;
61
- }
62
-
63
- protected getCallbackEvents(): readonly string[] {
64
- return CALLBACK_EVENTS;
65
- }
66
-
67
- /* ═════════════════════════════════════════════════════════════════
68
- * REACTIVE UPDATE (Precision DOM edits)
69
- * ═════════════════════════════════════════════════════════════════ */
70
-
71
- update(prop: string, value: any): void {
72
- super.update(prop, value);
73
-
74
- if (!this._overlay) return;
75
-
76
- const modal = this._overlay.querySelector('.jux-modal');
77
- if (!modal) return;
78
-
79
- switch (prop) {
80
- case 'open':
81
- this._overlay.style.display = value ? 'flex' : 'none';
82
- if (value) {
83
- this._triggerCallback('open');
84
- } else {
85
- this._triggerCallback('close');
86
- }
87
- break;
88
-
89
- case 'title':
90
- this._updateTitle(value);
91
- break;
92
-
93
- case 'content':
94
- this._updateContent(value);
95
- break;
96
-
97
- case 'icon':
98
- this._updateIcon(value);
99
- break;
100
-
101
- case 'size':
102
- modal.className = modal.className.replace(/jux-modal-(small|medium|large)/, `jux-modal-${value}`);
103
- break;
104
-
105
- case 'position':
106
- // Remove existing position classes
107
- this._overlay.className = this._overlay.className
108
- .split(' ')
109
- .filter(c => !c.startsWith('jux-modal-position-'))
110
- .join(' ');
111
-
112
- // Add new position class
113
- if (value) {
114
- this._overlay.classList.add(`jux-modal-position-${value}`);
115
- }
116
- break;
117
-
118
- case 'actions':
119
- this._rebuildActions();
120
- break;
121
- }
122
- }
123
-
124
- private _updateTitle(value: string): void {
125
- let headerEl = this._overlay!.querySelector('.jux-modal-header');
126
-
127
- if (!headerEl && value) {
128
- // Create header if it doesn't exist
129
- headerEl = document.createElement('div');
130
- headerEl.className = 'jux-modal-header';
131
-
132
- const modal = this._overlay!.querySelector('.jux-modal');
133
- const body = modal!.querySelector('.jux-modal-body');
134
- modal!.insertBefore(headerEl, body);
135
- }
136
-
137
- if (headerEl) {
138
- // Preserve icon if exists
139
- const iconEl = headerEl.querySelector('.jux-modal-header-icon');
140
- headerEl.innerHTML = '';
141
-
142
- if (iconEl) {
143
- headerEl.appendChild(iconEl);
144
- }
145
-
146
- const titleEl = document.createElement('span');
147
- titleEl.className = 'jux-modal-header-title';
148
- titleEl.textContent = value;
149
- headerEl.appendChild(titleEl);
150
- }
151
- }
152
-
153
- private _updateIcon(value?: EmojiIconType): void {
154
- const headerEl = this._overlay!.querySelector('.jux-modal-header');
155
- if (!headerEl) return;
156
-
157
- let iconEl = headerEl.querySelector('.jux-modal-header-icon');
158
-
159
- if (value) {
160
- if (!iconEl) {
161
- iconEl = document.createElement('span');
162
- iconEl.className = 'jux-modal-header-icon';
163
- headerEl.insertBefore(iconEl, headerEl.firstChild);
164
- }
165
- iconEl.innerHTML = '';
166
- iconEl.appendChild(renderIcon(value.icon, value.collection));
167
- } else if (iconEl) {
168
- iconEl.remove();
169
- }
170
- }
171
-
172
- private _updateContent(value: string | BaseComponent<any> | Array<string | BaseComponent<any>>): void {
173
- const contentEl = this._overlay!.querySelector('.jux-modal-content') as HTMLElement;
174
- if (!contentEl) return;
175
-
176
- contentEl.innerHTML = '';
177
-
178
- const items = Array.isArray(value) ? value : [value];
179
-
180
- items.forEach(item => {
181
- if (typeof item === 'string') {
182
- const tempDiv = document.createElement('div');
183
- tempDiv.innerHTML = item;
184
- while (tempDiv.firstChild) {
185
- contentEl.appendChild(tempDiv.firstChild);
186
- }
187
- } else if (item instanceof BaseComponent) {
188
- item.render(contentEl);
189
- }
190
- });
191
- }
192
-
193
- private _rebuildActions(): void {
194
- const modal = this._overlay!.querySelector('.jux-modal');
195
- if (!modal) return;
196
-
197
- let footerEl = modal.querySelector('.jux-modal-footer') as HTMLElement | null;
198
-
199
- if (this.state.actions.length === 0) {
200
- if (footerEl) footerEl.remove();
201
- return;
202
- }
203
-
204
- if (!footerEl) {
205
- footerEl = document.createElement('div');
206
- footerEl.className = 'jux-modal-footer';
207
- modal.appendChild(footerEl);
208
- }
209
-
210
- footerEl.innerHTML = '';
211
-
212
- this.state.actions.forEach(action => {
213
- // Check if it's an array of BaseComponents
214
- if (Array.isArray(action)) {
215
- action.forEach(component => {
216
- if (component instanceof BaseComponent) {
217
- component.render(footerEl!);
218
- }
219
- });
220
- }
221
- // Otherwise it's an action object with label property
222
- else if ('label' in action) {
223
- const btn = document.createElement('button');
224
- btn.className = `jux-modal-action jux-modal-action-${action.variant || 'default'}`;
225
- btn.textContent = action.label;
226
- btn.type = 'button';
227
-
228
- btn.addEventListener('click', () => {
229
- if (action.click) action.click();
230
- });
231
-
232
- footerEl!.appendChild(btn);
233
- }
234
- });
235
- }
236
-
237
- /* ═════════════════════════════════════════════════════════════════
238
- * FLUENT API (Just set state, update() handles DOM)
239
- * ═════════════════════════════════════════════════════════════════ */
240
-
241
- title(value: string): this {
242
- this.state.title = value;
243
- return this;
244
- }
245
-
246
- content(value: string | BaseComponent<any> | Array<string | BaseComponent<any>>): this {
247
- this.state.content = value;
248
- return this;
249
- }
250
-
251
- icon(value: EmojiIconType): this {
252
- this.state.icon = value;
253
- return this;
254
- }
255
-
256
- close(value: boolean): this {
257
- this.state.close = value;
258
- return this;
259
- }
260
-
261
- backdropClose(value: boolean): this {
262
- this.state.backdropClose = value;
263
- return this;
264
- }
265
-
266
- size(value: 'small' | 'medium' | 'large'): this {
267
- this.state.size = value;
268
- return this;
269
- }
270
-
271
- position(value: 'bottom' | 'center' | 'top' | 'fullscreen' | 'popover' | 'popover-top' | 'popover-bottom' | 'popover-left' | 'popover-right'): this {
272
- this.state.position = value;
273
- return this;
274
- }
275
-
276
- actions(value: Array<{ label: string; variant?: string; click?: () => void }>): this {
277
- this.state.actions = value;
278
- return this;
279
- }
280
-
281
- addAction(action: { label: string; variant?: string; click?: () => void }): this {
282
- this.state.actions = [...this.state.actions, action];
283
- return this;
284
- }
285
-
286
- open(): this {
287
- this.state.open = true;
288
- this._triggerCallback('open', true, null, this);
289
- return this;
290
- }
291
-
292
- closeModal(): this {
293
- this.state.open = false;
294
- this._triggerCallback('close', false, null, this);
295
- return this;
296
- }
297
-
298
- toggle(): this {
299
- this.state.open = !this.state.open;
300
- return this;
301
- }
302
-
303
- /**
304
- * Check if modal is currently open
305
- */
306
- isOpen(): boolean {
307
- return this.state.open;
308
- }
309
-
310
- /**
311
- * Check if modal is currently closed
312
- */
313
- isClosed(): boolean {
314
- return !this.state.open;
315
- }
316
-
317
- /* ═════════════════════════════════════════════════════════════════
318
- * DYNAMIC CONTENT ADDITION (Like tabs.addTabContent)
319
- * ═════════════════════════════════════════════════════════════════ */
320
-
321
- /**
322
- * Add content to modal (supports strings and BaseComponents)
323
- */
324
- addContent(content: string | BaseComponent<any> | Array<string | BaseComponent<any>>): this {
325
- const contentEl = this._overlay?.querySelector('.jux-modal-content') as HTMLElement;
326
- if (!contentEl) {
327
- console.warn('[Modal] Content element not found');
328
- return this;
329
- }
330
-
331
- const items = Array.isArray(content) ? content : [content];
332
-
333
- items.forEach(item => {
334
- if (typeof item === 'string') {
335
- const tempDiv = document.createElement('div');
336
- tempDiv.innerHTML = item;
337
- while (tempDiv.firstChild) {
338
- contentEl.appendChild(tempDiv.firstChild);
339
- }
340
- } else if (item instanceof BaseComponent) {
341
- item.render(contentEl);
342
- }
343
- });
344
-
345
- return this;
346
- }
347
-
348
- /**
349
- * Clear all content from modal
350
- */
351
- clearContent(): this {
352
- const contentEl = this._overlay?.querySelector('.jux-modal-content');
353
- if (contentEl) {
354
- contentEl.innerHTML = '';
355
- }
356
- return this;
357
- }
358
-
359
- /**
360
- * Get the modal content element ID for rendering child components
361
- */
362
- contentId(): string {
363
- return `${this._id}-content`;
364
- }
365
-
366
- /**
367
- * Get the modal content element (only available after render)
368
- */
369
- getContentElement(): HTMLElement | null {
370
- return document.getElementById(this.contentId());
371
- }
372
-
373
- /* ═════════════════════════════════════════════════════════════════
374
- * RENDER
375
- * ═════════════════════════════════════════════════════════════════ */
376
-
377
- render(targetId?: string | HTMLElement | BaseComponent<any>): this {
378
- const container = this._setupContainer(targetId);
379
-
380
- const { open, title, content, icon, size, position, close, backdropClose, actions, style, class: className } = this.state;
381
- const hasOpenSync = this._syncBindings.some(b => b.property === 'open');
382
-
383
- const overlay = document.createElement('div');
384
- overlay.className = 'jux-modal-overlay';
385
- overlay.id = this._id;
386
- overlay.style.display = open ? 'flex' : 'none';
387
-
388
- // Add position class
389
- if (position) {
390
- overlay.classList.add(`jux-modal-position-${position}`);
391
- }
392
-
393
- if (className) overlay.className += ` ${className}`;
394
- if (style) overlay.setAttribute('style', style);
395
- this._overlay = overlay;
396
-
397
- const modal = document.createElement('div');
398
- modal.className = `jux-modal jux-modal-${size}`;
399
-
400
- if (close) {
401
- const closeButton = document.createElement('button');
402
- closeButton.className = 'jux-modal-close';
403
- closeButton.innerHTML = '×';
404
- closeButton.type = 'button';
405
- modal.appendChild(closeButton);
406
- }
407
-
408
- if (title || icon) {
409
- const header = document.createElement('div');
410
- header.className = 'jux-modal-header';
411
-
412
- if (icon) {
413
- const iconEl = document.createElement('span');
414
- iconEl.className = 'jux-modal-header-icon';
415
- iconEl.appendChild(renderIcon(icon.icon, icon.collection));
416
- header.appendChild(iconEl);
417
- }
418
-
419
- if (title) {
420
- const titleEl = document.createElement('span');
421
- titleEl.className = 'jux-modal-header-title';
422
- titleEl.textContent = title;
423
- header.appendChild(titleEl);
424
- }
425
-
426
- modal.appendChild(header);
427
- }
428
-
429
- const contentElement = document.createElement('div');
430
- contentElement.className = 'jux-modal-content';
431
- contentElement.id = this.contentId();
432
- modal.appendChild(contentElement);
433
-
434
- // Render initial content
435
- if (content) {
436
- const items = Array.isArray(content) ? content : [content];
437
- items.forEach(item => {
438
- if (typeof item === 'string') {
439
- const tempDiv = document.createElement('div');
440
- tempDiv.innerHTML = item;
441
- while (tempDiv.firstChild) {
442
- contentElement.appendChild(tempDiv.firstChild);
443
- }
444
- } else if (item instanceof BaseComponent) {
445
- item.render(contentElement);
446
- }
447
- });
448
- }
449
-
450
- if (actions.length > 0) {
451
- const footer = document.createElement('div');
452
- footer.className = 'jux-modal-footer';
453
-
454
- actions.forEach(action => {
455
- // Check if it's an array of BaseComponents
456
- if (Array.isArray(action)) {
457
- action.forEach(component => {
458
- if (component instanceof BaseComponent) {
459
- component.render(footer);
460
- }
461
- });
462
- }
463
- // Otherwise it's an action object with label property
464
- else if ('label' in action) {
465
- const btn = document.createElement('button');
466
- btn.className = `jux-modal-action jux-modal-action-${action.variant || 'default'}`;
467
- btn.textContent = action.label;
468
- btn.type = 'button';
469
-
470
- btn.addEventListener('click', () => {
471
- if (action.click) action.click();
472
- });
473
-
474
- footer.appendChild(btn);
475
- }
476
- });
477
-
478
- modal.appendChild(footer);
479
- }
480
-
481
- overlay.appendChild(modal);
482
-
483
- // Default dismiss behavior (only if NOT using sync)
484
- if (!hasOpenSync) {
485
- if (close) {
486
- const closeButton = modal.querySelector('.jux-modal-close');
487
- closeButton?.addEventListener('click', () => {
488
- this.state.open = false;
489
- });
490
- }
491
-
492
- if (backdropClose) {
493
- overlay.addEventListener('click', (e) => {
494
- if (e.target === overlay) {
495
- this.state.open = false;
496
- }
497
- });
498
- }
499
- }
500
-
501
- this._wireStandardEvents(overlay);
502
-
503
- // Wire sync bindings
504
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
505
- if (property === 'open') {
506
- const transformToState = toState || ((v: any) => Boolean(v));
507
- const transformToComponent = toComponent || ((v: any) => Boolean(v));
508
-
509
- let isUpdating = false;
510
-
511
- stateObj.subscribe((val: any) => {
512
- if (isUpdating) return;
513
- const transformed = transformToComponent(val);
514
- this.state.open = transformed;
515
- });
516
-
517
- if (close) {
518
- const closeButton = modal.querySelector('.jux-modal-close');
519
- closeButton?.addEventListener('click', () => {
520
- if (isUpdating) return;
521
- isUpdating = true;
522
-
523
- this.state.open = false;
524
- stateObj.set(transformToState(false));
525
-
526
- setTimeout(() => { isUpdating = false; }, 0);
527
- });
528
- }
529
-
530
- if (backdropClose) {
531
- overlay.addEventListener('click', (e) => {
532
- if (e.target === overlay) {
533
- if (isUpdating) return;
534
- isUpdating = true;
535
-
536
- this.state.open = false;
537
- stateObj.set(transformToState(false));
538
-
539
- setTimeout(() => { isUpdating = false; }, 0);
540
- }
541
- });
542
- }
543
- }
544
- else if (property === 'content') {
545
- const transform = toComponent || ((v: any) => String(v));
546
-
547
- stateObj.subscribe((val: any) => {
548
- const transformed = transform(val);
549
- this.state.content = transformed;
550
- });
551
- }
552
- else if (property === 'title') {
553
- const transform = toComponent || ((v: any) => String(v));
554
-
555
- stateObj.subscribe((val: any) => {
556
- const transformed = transform(val);
557
- this.state.title = transformed;
558
- });
559
- }
560
- });
561
-
562
- container.appendChild(overlay);
563
-
564
- requestAnimationFrame(() => {
565
- if ((window as any).Iconify) {
566
- (window as any).Iconify.scan();
567
- }
568
- });
569
-
570
- return this;
571
- }
572
- }
573
-
574
- export function modal(id: string, options: ModalOptions = {}): Modal {
575
- return new Modal(id, options);
576
- }
@@ -1,46 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- export interface NavItem {
3
- label: string;
4
- href: string;
5
- active?: boolean;
6
- itemClass?: string;
7
- }
8
- export interface NavBrand {
9
- text?: string;
10
- href?: string;
11
- icon?: string;
12
- }
13
- export interface NavOptions {
14
- items?: NavItem[];
15
- brand?: NavBrand;
16
- variant?: 'default' | 'pills' | 'tabs';
17
- sticky?: boolean;
18
- style?: string;
19
- class?: string;
20
- }
21
- type NavState = {
22
- items: NavItem[];
23
- brand?: NavBrand;
24
- variant: string;
25
- sticky: boolean;
26
- style: string;
27
- class: string;
28
- };
29
- export declare class Nav extends BaseComponent<NavState> {
30
- private _nav;
31
- constructor(id: string, options?: NavOptions);
32
- protected getTriggerEvents(): readonly string[];
33
- protected getCallbackEvents(): readonly string[];
34
- private _setActiveStates;
35
- items(value: NavItem[]): this;
36
- addItem(item: NavItem): this;
37
- itemClass(className: string): this;
38
- brand(value: NavBrand): this;
39
- variant(value: string): this;
40
- sticky(value: boolean): this;
41
- update(prop: string, value: any): void;
42
- render(targetId?: string | HTMLElement | BaseComponent<any>): this;
43
- }
44
- export declare function nav(id: string, options?: NavOptions): Nav;
45
- export {};
46
- //# sourceMappingURL=nav.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQxD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,GAAI,SAAQ,aAAa,CAAC,QAAQ,CAAC;IAC9C,OAAO,CAAC,IAAI,CAA4B;gBAE5B,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe;IAahD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAIhD,OAAO,CAAC,gBAAgB;IAaxB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI;IAM7B,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAM5B,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAQlC,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAK5B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAK5B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAQtC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CAyInE;AAED,wBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,GAAG,CAE7D"}