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,303 +0,0 @@
1
- import { BaseComponent, BaseState } from './base/BaseComponent.js';
2
- import { formatIdAsLabel } from '../utils/formatId.js'; // āœ… Import
3
-
4
- // Event definitions
5
- const TRIGGER_EVENTS = [] as const;
6
- const CALLBACK_EVENTS = ['change'] as const;
7
-
8
- export interface RadioOption {
9
- label: string;
10
- value: string;
11
- disabled?: boolean;
12
- }
13
-
14
- export interface RadioOptions {
15
- options?: RadioOption[];
16
- value?: string;
17
- label?: string;
18
- required?: boolean;
19
- disabled?: boolean;
20
- name?: string;
21
- orientation?: 'vertical' | 'horizontal'; // āœ… Add orientation
22
- style?: string;
23
- class?: string;
24
- onValidate?: (value: string) => boolean | string;
25
- }
26
-
27
- interface RadioState extends BaseState {
28
- options: RadioOption[];
29
- value: string;
30
- orientation: 'vertical' | 'horizontal'; // āœ… Add to state
31
- }
32
-
33
- export class Radio extends BaseComponent<RadioState> {
34
- private _radioInputs: HTMLInputElement[] = [];
35
-
36
- constructor(id: string, options: RadioOptions = {}) {
37
- super(id, {
38
- visible: true,
39
- disabled: options.disabled ?? false,
40
- loading: false,
41
- class: options.class ?? '',
42
- style: options.style ?? '',
43
- attributes: {},
44
- label: options.label ?? formatIdAsLabel(id), // āœ… Auto-generate
45
- required: options.required ?? false,
46
- name: options.name ?? id,
47
- errorMessage: undefined,
48
- options: options.options ?? [],
49
- value: options.value ?? '',
50
- orientation: options.orientation ?? 'vertical'
51
- });
52
-
53
- if (options.onValidate) {
54
- this._onValidate = options.onValidate;
55
- }
56
- }
57
-
58
- protected getTriggerEvents(): readonly string[] {
59
- return TRIGGER_EVENTS;
60
- }
61
-
62
- protected getCallbackEvents(): readonly string[] {
63
- return CALLBACK_EVENTS;
64
- }
65
-
66
- /* ═════════════════════════════════════════════════════════════════
67
- * FLUENT API
68
- * ═════════════════════════════════════════════════════════════════ */
69
-
70
- //BaseComponent:
71
- // - label(), required(), name(), onValidate()
72
- // - validate(), isValid()
73
- // - style(), class()
74
- // - bind(), sync(), renderTo()
75
- // - disabled(), enable(), disable()
76
-
77
- options(value: RadioOption[]): this {
78
- this.state.options = value;
79
- return this;
80
- }
81
-
82
- value(value: string): this {
83
- return this.setValue(value);
84
- }
85
-
86
- addOption(option: RadioOption): this {
87
- this.state.options = [...this.state.options, option];
88
- return this;
89
- }
90
-
91
- orientation(value: 'vertical' | 'horizontal'): this {
92
- this.state.orientation = value;
93
- return this;
94
- }
95
-
96
- /* ═════════════════════════════════════════════════════════════════
97
- * FORM INPUT IMPLEMENTATION
98
- * ═════════════════════════════════════════════════════════════════ */
99
-
100
- getValue(): string {
101
- return this.state.value;
102
- }
103
-
104
- setValue(value: string): this {
105
- this.state.value = value;
106
-
107
- // Update all radio inputs
108
- this._radioInputs.forEach(input => {
109
- input.checked = input.value === value;
110
- });
111
-
112
- return this;
113
- }
114
-
115
- validate(): boolean {
116
- this._hasBeenValidated = true;
117
- const value = this.getValue();
118
- const result = this._validateValue(value);
119
-
120
- if (result === true) {
121
- this._clearError();
122
- return true;
123
- } else {
124
- this._showError(result as string);
125
- return false;
126
- }
127
- }
128
-
129
- isValid(): boolean {
130
- const value = this.getValue();
131
- return this._validateValue(value) === true;
132
- }
133
-
134
- protected _validateValue(value: string): boolean | string {
135
- const { required, options } = this.state;
136
-
137
- if (required && !value) {
138
- return 'Please select an option';
139
- }
140
-
141
- // Validate that value is one of the options
142
- if (value && !options.some(opt => opt.value === value)) {
143
- return 'Invalid option selected';
144
- }
145
-
146
- if (this._onValidate) {
147
- const result = this._onValidate(value);
148
- if (result !== true) {
149
- return result || 'Invalid value';
150
- }
151
- }
152
-
153
- return true;
154
- }
155
-
156
- protected _buildInputElement(): HTMLElement {
157
- // Radio uses a container, not a single input
158
- const container = document.createElement('div');
159
- container.className = 'jux-radio-options';
160
- return container;
161
- }
162
-
163
- /* ═════════════════════════════════════════════════════════════════
164
- * RENDER
165
- * ═════════════════════════════════════════════════════════════════ */
166
-
167
- render(targetId?: string | HTMLElement | BaseComponent<any>): this {
168
- const container = this._setupContainer(targetId);
169
-
170
- const { options, value, name, disabled, orientation, style, class: className } = this.state;
171
-
172
- // Build wrapper
173
- const wrapper = document.createElement('div');
174
- wrapper.className = 'jux-radio';
175
- wrapper.id = this._id;
176
- if (className) wrapper.className += ` ${className}`;
177
- if (style) wrapper.setAttribute('style', style);
178
-
179
- // Label
180
- if (this.state.label) {
181
- wrapper.appendChild(this._renderLabel());
182
- }
183
-
184
- // Radio options container
185
- const optionsContainer = document.createElement('div');
186
- optionsContainer.className = `jux-radio-options jux-radio-${orientation}`; // āœ… Add orientation class
187
- this._inputElement = optionsContainer;
188
-
189
- this._radioInputs = [];
190
-
191
- options.forEach((option, index) => {
192
- const radioWrapper = document.createElement('label');
193
- radioWrapper.className = 'jux-radio-option';
194
-
195
- const input = document.createElement('input');
196
- input.type = 'radio';
197
- input.className = 'jux-radio-input';
198
- input.id = `${this._id}-option-${index}`;
199
- input.name = name!; // āœ… Non-null assertion (name is always set in constructor)
200
- input.value = option.value;
201
- input.checked = option.value === value;
202
- input.disabled = disabled || option.disabled || false;
203
-
204
- this._radioInputs.push(input);
205
-
206
- const radioMark = document.createElement('span');
207
- radioMark.className = 'jux-radio-mark';
208
-
209
- const labelText = document.createElement('span');
210
- labelText.className = 'jux-radio-label-text';
211
- labelText.textContent = option.label;
212
-
213
- radioWrapper.appendChild(input);
214
- radioWrapper.appendChild(radioMark);
215
- radioWrapper.appendChild(labelText);
216
-
217
- optionsContainer.appendChild(radioWrapper);
218
- });
219
-
220
- wrapper.appendChild(optionsContainer);
221
-
222
- // Error element
223
- wrapper.appendChild(this._renderError());
224
-
225
- // Wire events
226
- this._wireStandardEvents(wrapper);
227
-
228
- // Wire radio-specific sync
229
- const valueSync = this._syncBindings.find(b => b.property === 'value');
230
-
231
- if (valueSync) {
232
- const { stateObj, toState, toComponent } = valueSync;
233
-
234
- const transformToState = toState || ((v: string) => v);
235
- const transformToComponent = toComponent || ((v: any) => String(v));
236
-
237
- let isUpdating = false;
238
-
239
- // State → Component
240
- stateObj.subscribe((val: any) => {
241
- if (isUpdating) return;
242
- const transformed = transformToComponent(val);
243
- this.setValue(transformed);
244
- });
245
-
246
- // Component → State
247
- this._radioInputs.forEach(input => {
248
- input.addEventListener('change', () => {
249
- if (isUpdating) return;
250
- isUpdating = true;
251
-
252
- const selectedValue = input.value;
253
- this.state.value = selectedValue;
254
- this._clearError();
255
-
256
- const transformed = transformToState(selectedValue);
257
- stateObj.set(transformed);
258
-
259
- // šŸŽÆ Fire the change callback event
260
- this._triggerCallback('change', selectedValue);
261
-
262
- setTimeout(() => { isUpdating = false; }, 0);
263
- });
264
- });
265
- } else {
266
- // Default behavior without sync
267
- this._radioInputs.forEach(input => {
268
- input.addEventListener('change', () => {
269
- this.state.value = input.value;
270
- this._clearError();
271
-
272
- // šŸŽÆ Fire the change callback event
273
- this._triggerCallback('change', input.value);
274
- });
275
- });
276
- }
277
-
278
- // Always add blur validation
279
- this._radioInputs.forEach(input => {
280
- input.addEventListener('blur', () => {
281
- if (this._hasBeenValidated) {
282
- this.validate();
283
- }
284
- });
285
- });
286
-
287
- // Sync label changes
288
- const labelSync = this._syncBindings.find(b => b.property === 'label');
289
- if (labelSync) {
290
- const transform = labelSync.toComponent || ((v: any) => String(v));
291
- labelSync.stateObj.subscribe((val: any) => {
292
- this.label(transform(val));
293
- });
294
- }
295
-
296
- container.appendChild(wrapper);
297
- return this;
298
- }
299
- }
300
-
301
- export function radio(id: string, options: RadioOptions = {}): Radio {
302
- return new Radio(id, options);
303
- }
@@ -1,34 +0,0 @@
1
- /**
2
- * Simplified JUX Component Registry
3
- * Lean console debugging interface
4
- */
5
- import { BaseComponent } from './base/BaseComponent.js';
6
- declare class ComponentRegistry {
7
- private components;
8
- register(component: BaseComponent<any>): void;
9
- unregister(id: string): void;
10
- /**
11
- * Get component by index or ID
12
- */
13
- get(indexOrId: number | string): BaseComponent<any> | undefined;
14
- /**
15
- * Print indexed list to console
16
- */
17
- list(): void;
18
- /**
19
- * Show component tree with state, history, events
20
- */
21
- tree(indexOrId?: number | string): void;
22
- private _printTree;
23
- /**
24
- * Get all components
25
- */
26
- all(): BaseComponent<any>[];
27
- /**
28
- * Clear registry
29
- */
30
- clear(): void;
31
- }
32
- export declare const registry: ComponentRegistry;
33
- export {};
34
- //# sourceMappingURL=registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,cAAM,iBAAiB;IACnB,OAAO,CAAC,UAAU,CAA4B;IAE9C,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;IAO7C,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAI5B;;OAEG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS;IAO/D;;OAEG;IACH,IAAI,IAAI,IAAI;IAaZ;;OAEG;IACH,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkBvC,OAAO,CAAC,UAAU;IAkClB;;OAEG;IACH,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE;IAI3B;;OAEG;IACH,KAAK,IAAI,IAAI;CAIhB;AAED,eAAO,MAAM,QAAQ,mBAA0B,CAAC"}
@@ -1,163 +0,0 @@
1
- /**
2
- * Simplified JUX Component Registry
3
- * Lean console debugging interface
4
- */
5
- import { stateHistory } from './history/StateHistory.js';
6
- class ComponentRegistry {
7
- constructor() {
8
- this.components = [];
9
- }
10
- register(component) {
11
- // Avoid duplicates
12
- if (!this.components.find(c => c._id === component._id)) {
13
- this.components.push(component);
14
- }
15
- }
16
- unregister(id) {
17
- this.components = this.components.filter(c => c._id !== id);
18
- }
19
- /**
20
- * Get component by index or ID
21
- */
22
- get(indexOrId) {
23
- if (typeof indexOrId === 'number') {
24
- return this.components[indexOrId];
25
- }
26
- return this.components.find(c => c._id === indexOrId);
27
- }
28
- /**
29
- * Print indexed list to console
30
- */
31
- list() {
32
- if (this.components.length === 0) {
33
- console.log('šŸ“­ No components registered');
34
- return;
35
- }
36
- console.log('\nšŸ“‹ Registered Components:\n');
37
- this.components.forEach((comp, idx) => {
38
- console.log(` [${idx}] ${comp._id} → ${comp.constructor.name}`);
39
- });
40
- console.log(`\nšŸ’” Access via: _jux.get(${0}) or _jux.get('${this.components[0]._id}')\n`);
41
- }
42
- /**
43
- * Show component tree with state, history, events
44
- */
45
- tree(indexOrId) {
46
- let comp;
47
- if (indexOrId === undefined) {
48
- // Show all components
49
- this.components.forEach((c, idx) => this._printTree(c, idx));
50
- return;
51
- }
52
- comp = this.get(indexOrId);
53
- if (!comp) {
54
- console.error(`āŒ Component not found: ${indexOrId}`);
55
- return;
56
- }
57
- this._printTree(comp, typeof indexOrId === 'number' ? indexOrId : undefined);
58
- }
59
- _printTree(comp, index) {
60
- const idx = index !== undefined ? `[${index}]` : '';
61
- const stateChanges = stateHistory.getComponentHistory(comp._id);
62
- const events = stateHistory.getComponentEvents(comp._id);
63
- const syncCount = comp._syncBindings?.length || 0;
64
- const bindCount = comp._bindings?.length || 0;
65
- console.group(`🌳 ${idx} ${comp._id} (${comp.constructor.name})`);
66
- console.log('šŸ“Š State:', comp.state);
67
- if (stateChanges.length > 0) {
68
- console.log(`šŸ“œ History: ${stateChanges.length} changes`);
69
- console.log(' Last 3:', stateChanges.slice(-3).map(s => `${s.property}: ${s.oldValue} → ${s.newValue}`));
70
- }
71
- if (syncCount > 0) {
72
- console.log(`šŸ”— Syncs: ${syncCount} active`);
73
- }
74
- if (bindCount > 0 || events.length > 0) {
75
- console.log(`⚔ Events: ${bindCount} binds, ${events.length} fired`);
76
- }
77
- console.log(`\nšŸ’” Commands:`);
78
- console.log(` _jux.get(${index ?? `'${comp._id}'`}).state.prop = value`);
79
- console.log(` _jux.get(${index ?? `'${comp._id}'`}).rollback()`);
80
- console.log(` _jux.get(${index ?? `'${comp._id}'`}).timeline()`);
81
- console.groupEnd();
82
- }
83
- /**
84
- * Get all components
85
- */
86
- all() {
87
- return this.components;
88
- }
89
- /**
90
- * Clear registry
91
- */
92
- clear() {
93
- this.components = [];
94
- stateHistory.clear();
95
- }
96
- }
97
- export const registry = new ComponentRegistry();
98
- // āœ… Expose lean console interface
99
- if (typeof window !== 'undefined') {
100
- window._jux = {
101
- /**
102
- * Get component by index or ID
103
- * @example
104
- * const h = _jux.get(0) // Get first component
105
- * const h = _jux.get('hero-1') // Get by ID
106
- * h.state.title = 'New Title' // Direct mutation
107
- * h.rollback() // Undo last change
108
- */
109
- get: (indexOrId) => registry.get(indexOrId),
110
- /**
111
- * List all components with indices
112
- * @example
113
- * _jux.list()
114
- * // [0] hero-1 → Hero
115
- * // [1] nav-main → Nav
116
- */
117
- list: () => registry.list(),
118
- /**
119
- * Show component tree (state, history, events, syncs)
120
- * @example
121
- * _jux.tree() // Show all
122
- * _jux.tree(0) // Show first component
123
- * _jux.tree('hero-1') // Show specific component
124
- */
125
- tree: (indexOrId) => registry.tree(indexOrId),
126
- /**
127
- * Get all components
128
- */
129
- all: () => registry.all(),
130
- /**
131
- * Clear all components and history
132
- */
133
- clear: () => registry.clear(),
134
- /**
135
- * Access global state history
136
- */
137
- history: {
138
- stats: () => stateHistory.getStats(),
139
- timeline: () => stateHistory.getTimeline(),
140
- clear: () => stateHistory.clear()
141
- }
142
- };
143
- console.log(`
144
- šŸŽØ JUX DevTools Ready!
145
-
146
- Quick Commands:
147
- _jux.list() List all components with indices
148
- _jux.tree() Show component tree (state, history, events)
149
- _jux.get(0) Get first component
150
- _jux.get('hero-1') Get component by ID
151
-
152
- Direct Manipulation:
153
- const h = _jux.get(0)
154
- h.state.title = 'New!' Mutate state directly
155
- h.rollback() Undo last change
156
- h.rollforward() Redo change
157
- h.timeline() View full history
158
-
159
- History:
160
- _jux.history.stats() Global statistics
161
- _jux.history.timeline() Complete timeline
162
- `);
163
- }
@@ -1,193 +0,0 @@
1
- /**
2
- * Simplified JUX Component Registry
3
- * Lean console debugging interface
4
- */
5
-
6
- import { BaseComponent } from './base/BaseComponent.js';
7
- import { stateHistory } from './history/StateHistory.js';
8
-
9
- class ComponentRegistry {
10
- private components: BaseComponent<any>[] = [];
11
-
12
- register(component: BaseComponent<any>): void {
13
- // Avoid duplicates
14
- if (!this.components.find(c => c._id === component._id)) {
15
- this.components.push(component);
16
- }
17
- }
18
-
19
- unregister(id: string): void {
20
- this.components = this.components.filter(c => c._id !== id);
21
- }
22
-
23
- /**
24
- * Get component by index or ID
25
- */
26
- get(indexOrId: number | string): BaseComponent<any> | undefined {
27
- if (typeof indexOrId === 'number') {
28
- return this.components[indexOrId];
29
- }
30
- return this.components.find(c => c._id === indexOrId);
31
- }
32
-
33
- /**
34
- * Print indexed list to console
35
- */
36
- list(): void {
37
- if (this.components.length === 0) {
38
- console.log('šŸ“­ No components registered');
39
- return;
40
- }
41
-
42
- console.log('\nšŸ“‹ Registered Components:\n');
43
- this.components.forEach((comp, idx) => {
44
- console.log(` [${idx}] ${comp._id} → ${comp.constructor.name}`);
45
- });
46
- console.log(`\nšŸ’” Access via: _jux.get(${0}) or _jux.get('${this.components[0]._id}')\n`);
47
- }
48
-
49
- /**
50
- * Show component tree with state, history, events
51
- */
52
- tree(indexOrId?: number | string): void {
53
- let comp: BaseComponent<any> | undefined;
54
-
55
- if (indexOrId === undefined) {
56
- // Show all components
57
- this.components.forEach((c, idx) => this._printTree(c, idx));
58
- return;
59
- }
60
-
61
- comp = this.get(indexOrId);
62
- if (!comp) {
63
- console.error(`āŒ Component not found: ${indexOrId}`);
64
- return;
65
- }
66
-
67
- this._printTree(comp, typeof indexOrId === 'number' ? indexOrId : undefined);
68
- }
69
-
70
- private _printTree(comp: BaseComponent<any>, index?: number): void {
71
- const idx = index !== undefined ? `[${index}]` : '';
72
- const stateChanges = stateHistory.getComponentHistory(comp._id);
73
- const events = stateHistory.getComponentEvents(comp._id);
74
- const syncCount = (comp as any)._syncBindings?.length || 0;
75
- const bindCount = (comp as any)._bindings?.length || 0;
76
-
77
- console.group(`🌳 ${idx} ${comp._id} (${comp.constructor.name})`);
78
-
79
- console.log('šŸ“Š State:', comp.state);
80
-
81
- if (stateChanges.length > 0) {
82
- console.log(`šŸ“œ History: ${stateChanges.length} changes`);
83
- console.log(' Last 3:', stateChanges.slice(-3).map(s =>
84
- `${s.property}: ${s.oldValue} → ${s.newValue}`
85
- ));
86
- }
87
-
88
- if (syncCount > 0) {
89
- console.log(`šŸ”— Syncs: ${syncCount} active`);
90
- }
91
-
92
- if (bindCount > 0 || events.length > 0) {
93
- console.log(`⚔ Events: ${bindCount} binds, ${events.length} fired`);
94
- }
95
-
96
- console.log(`\nšŸ’” Commands:`);
97
- console.log(` _jux.get(${index ?? `'${comp._id}'`}).state.prop = value`);
98
- console.log(` _jux.get(${index ?? `'${comp._id}'`}).rollback()`);
99
- console.log(` _jux.get(${index ?? `'${comp._id}'`}).timeline()`);
100
-
101
- console.groupEnd();
102
- }
103
-
104
- /**
105
- * Get all components
106
- */
107
- all(): BaseComponent<any>[] {
108
- return this.components;
109
- }
110
-
111
- /**
112
- * Clear registry
113
- */
114
- clear(): void {
115
- this.components = [];
116
- stateHistory.clear();
117
- }
118
- }
119
-
120
- export const registry = new ComponentRegistry();
121
-
122
- // āœ… Expose lean console interface
123
- if (typeof window !== 'undefined') {
124
- (window as any)._jux = {
125
- /**
126
- * Get component by index or ID
127
- * @example
128
- * const h = _jux.get(0) // Get first component
129
- * const h = _jux.get('hero-1') // Get by ID
130
- * h.state.title = 'New Title' // Direct mutation
131
- * h.rollback() // Undo last change
132
- */
133
- get: (indexOrId: number | string) => registry.get(indexOrId),
134
-
135
- /**
136
- * List all components with indices
137
- * @example
138
- * _jux.list()
139
- * // [0] hero-1 → Hero
140
- * // [1] nav-main → Nav
141
- */
142
- list: () => registry.list(),
143
-
144
- /**
145
- * Show component tree (state, history, events, syncs)
146
- * @example
147
- * _jux.tree() // Show all
148
- * _jux.tree(0) // Show first component
149
- * _jux.tree('hero-1') // Show specific component
150
- */
151
- tree: (indexOrId?: number | string) => registry.tree(indexOrId),
152
-
153
- /**
154
- * Get all components
155
- */
156
- all: () => registry.all(),
157
-
158
- /**
159
- * Clear all components and history
160
- */
161
- clear: () => registry.clear(),
162
-
163
- /**
164
- * Access global state history
165
- */
166
- history: {
167
- stats: () => stateHistory.getStats(),
168
- timeline: () => stateHistory.getTimeline(),
169
- clear: () => stateHistory.clear()
170
- }
171
- };
172
-
173
- console.log(`
174
- šŸŽØ JUX DevTools Ready!
175
-
176
- Quick Commands:
177
- _jux.list() List all components with indices
178
- _jux.tree() Show component tree (state, history, events)
179
- _jux.get(0) Get first component
180
- _jux.get('hero-1') Get component by ID
181
-
182
- Direct Manipulation:
183
- const h = _jux.get(0)
184
- h.state.title = 'New!' Mutate state directly
185
- h.rollback() Undo last change
186
- h.rollforward() Redo change
187
- h.timeline() View full history
188
-
189
- History:
190
- _jux.history.stats() Global statistics
191
- _jux.history.timeline() Complete timeline
192
- `);
193
- }