juxscript 1.1.240 → 1.1.244

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/index.js +7 -137
  2. package/lib/components/dataframe.ts +0 -569
  3. package/lib/components/include.ts +229 -229
  4. package/lib/components/tag.ts +68 -0
  5. package/lib/styles/shadcn.css +17 -5
  6. package/lib/utils/idgen.ts +6 -0
  7. package/package.json +5 -6
  8. package/index.d.ts +0 -239
  9. package/index.d.ts.map +0 -1
  10. package/lib/components/alert.d.ts +0 -36
  11. package/lib/components/alert.d.ts.map +0 -1
  12. package/lib/components/alert.js +0 -172
  13. package/lib/components/alert.ts +0 -219
  14. package/lib/components/app.d.ts +0 -89
  15. package/lib/components/app.d.ts.map +0 -1
  16. package/lib/components/app.js +0 -175
  17. package/lib/components/app.ts +0 -247
  18. package/lib/components/badge.d.ts +0 -26
  19. package/lib/components/badge.d.ts.map +0 -1
  20. package/lib/components/badge.js +0 -91
  21. package/lib/components/badge.ts +0 -118
  22. package/lib/components/base/Animations.d.ts +0 -36
  23. package/lib/components/base/Animations.d.ts.map +0 -1
  24. package/lib/components/base/Animations.js +0 -70
  25. package/lib/components/base/Animations.ts +0 -112
  26. package/lib/components/base/BaseComponent.d.ts +0 -294
  27. package/lib/components/base/BaseComponent.d.ts.map +0 -1
  28. package/lib/components/base/BaseComponent.js +0 -735
  29. package/lib/components/base/BaseComponent.ts +0 -884
  30. package/lib/components/base/FormInput.d.ts +0 -77
  31. package/lib/components/base/FormInput.d.ts.map +0 -1
  32. package/lib/components/base/FormInput.js +0 -171
  33. package/lib/components/base/FormInput.ts +0 -237
  34. package/lib/components/blueprint.d.ts +0 -40
  35. package/lib/components/blueprint.d.ts.map +0 -1
  36. package/lib/components/blueprint.js +0 -327
  37. package/lib/components/button.d.ts +0 -70
  38. package/lib/components/button.d.ts.map +0 -1
  39. package/lib/components/button.js +0 -177
  40. package/lib/components/button.ts +0 -237
  41. package/lib/components/card.d.ts +0 -35
  42. package/lib/components/card.d.ts.map +0 -1
  43. package/lib/components/card.js +0 -130
  44. package/lib/components/card.ts +0 -177
  45. package/lib/components/chart.d.ts +0 -49
  46. package/lib/components/chart.d.ts.map +0 -1
  47. package/lib/components/chart.js +0 -205
  48. package/lib/components/chart.ts +0 -254
  49. package/lib/components/checkbox.d.ts +0 -33
  50. package/lib/components/checkbox.d.ts.map +0 -1
  51. package/lib/components/checkbox.js +0 -202
  52. package/lib/components/checkbox.ts +0 -260
  53. package/lib/components/code.d.ts +0 -52
  54. package/lib/components/code.d.ts.map +0 -1
  55. package/lib/components/code.js +0 -201
  56. package/lib/components/code.ts +0 -260
  57. package/lib/components/container.d.ts +0 -60
  58. package/lib/components/container.d.ts.map +0 -1
  59. package/lib/components/container.js +0 -195
  60. package/lib/components/container.ts +0 -259
  61. package/lib/components/data.d.ts +0 -36
  62. package/lib/components/data.d.ts.map +0 -1
  63. package/lib/components/data.js +0 -110
  64. package/lib/components/data.ts +0 -135
  65. package/lib/components/dataframe/DataFrameSource.d.ts +0 -118
  66. package/lib/components/dataframe/DataFrameSource.d.ts.map +0 -1
  67. package/lib/components/dataframe/DataFrameSource.js +0 -421
  68. package/lib/components/dataframe/DataFrameSource.ts +0 -532
  69. package/lib/components/dataframe/ImportSettingsModal.d.ts +0 -60
  70. package/lib/components/dataframe/ImportSettingsModal.d.ts.map +0 -1
  71. package/lib/components/dataframe/ImportSettingsModal.js +0 -442
  72. package/lib/components/dataframe/ImportSettingsModal.ts +0 -531
  73. package/lib/components/dataframe.d.ts +0 -110
  74. package/lib/components/dataframe.d.ts.map +0 -1
  75. package/lib/components/dataframe.js +0 -470
  76. package/lib/components/datepicker.d.ts +0 -40
  77. package/lib/components/datepicker.d.ts.map +0 -1
  78. package/lib/components/datepicker.js +0 -193
  79. package/lib/components/datepicker.ts +0 -251
  80. package/lib/components/dialog.d.ts +0 -39
  81. package/lib/components/dialog.d.ts.map +0 -1
  82. package/lib/components/dialog.js +0 -131
  83. package/lib/components/dialog.ts +0 -178
  84. package/lib/components/divider.d.ts +0 -31
  85. package/lib/components/divider.d.ts.map +0 -1
  86. package/lib/components/divider.js +0 -72
  87. package/lib/components/divider.ts +0 -104
  88. package/lib/components/dropdown-menu.d.ts +0 -42
  89. package/lib/components/dropdown-menu.d.ts.map +0 -1
  90. package/lib/components/dropdown-menu.js +0 -177
  91. package/lib/components/dropdown-menu.ts +0 -214
  92. package/lib/components/dropdown.d.ts +0 -41
  93. package/lib/components/dropdown.d.ts.map +0 -1
  94. package/lib/components/dropdown.js +0 -136
  95. package/lib/components/dropdown.ts +0 -188
  96. package/lib/components/element.d.ts +0 -51
  97. package/lib/components/element.d.ts.map +0 -1
  98. package/lib/components/element.js +0 -209
  99. package/lib/components/element.ts +0 -271
  100. package/lib/components/event-chain.d.ts +0 -9
  101. package/lib/components/event-chain.d.ts.map +0 -1
  102. package/lib/components/event-chain.js +0 -33
  103. package/lib/components/fileupload.d.ts +0 -98
  104. package/lib/components/fileupload.d.ts.map +0 -1
  105. package/lib/components/fileupload.js +0 -351
  106. package/lib/components/fileupload.ts +0 -449
  107. package/lib/components/grid.d.ts +0 -88
  108. package/lib/components/grid.d.ts.map +0 -1
  109. package/lib/components/grid.js +0 -208
  110. package/lib/components/grid.ts +0 -295
  111. package/lib/components/heading.d.ts +0 -25
  112. package/lib/components/heading.d.ts.map +0 -1
  113. package/lib/components/heading.js +0 -83
  114. package/lib/components/heading.ts +0 -113
  115. package/lib/components/helpers.d.ts +0 -9
  116. package/lib/components/helpers.d.ts.map +0 -1
  117. package/lib/components/helpers.js +0 -30
  118. package/lib/components/helpers.ts +0 -41
  119. package/lib/components/hero.d.ts +0 -60
  120. package/lib/components/hero.d.ts.map +0 -1
  121. package/lib/components/hero.js +0 -239
  122. package/lib/components/hero.ts +0 -302
  123. package/lib/components/history/StateHistory.d.ts +0 -91
  124. package/lib/components/history/StateHistory.d.ts.map +0 -1
  125. package/lib/components/history/StateHistory.js +0 -154
  126. package/lib/components/history/StateHistory.ts +0 -200
  127. package/lib/components/icon.d.ts +0 -36
  128. package/lib/components/icon.d.ts.map +0 -1
  129. package/lib/components/icon.js +0 -135
  130. package/lib/components/icon.ts +0 -182
  131. package/lib/components/icons.d.ts +0 -25
  132. package/lib/components/icons.d.ts.map +0 -1
  133. package/lib/components/icons.js +0 -440
  134. package/lib/components/icons.ts +0 -464
  135. package/lib/components/image.d.ts +0 -42
  136. package/lib/components/image.d.ts.map +0 -1
  137. package/lib/components/image.js +0 -204
  138. package/lib/components/image.ts +0 -260
  139. package/lib/components/include.d.ts +0 -86
  140. package/lib/components/include.d.ts.map +0 -1
  141. package/lib/components/include.js +0 -238
  142. package/lib/components/input.d.ts +0 -85
  143. package/lib/components/input.d.ts.map +0 -1
  144. package/lib/components/input.js +0 -362
  145. package/lib/components/input.ts +0 -473
  146. package/lib/components/layer.d.ts +0 -72
  147. package/lib/components/layer.d.ts.map +0 -1
  148. package/lib/components/layer.js +0 -219
  149. package/lib/components/layer.ts +0 -304
  150. package/lib/components/link.d.ts +0 -41
  151. package/lib/components/link.d.ts.map +0 -1
  152. package/lib/components/link.js +0 -216
  153. package/lib/components/link.ts +0 -268
  154. package/lib/components/list.d.ts +0 -83
  155. package/lib/components/list.d.ts.map +0 -1
  156. package/lib/components/list.js +0 -314
  157. package/lib/components/list.ts +0 -423
  158. package/lib/components/loading.d.ts +0 -25
  159. package/lib/components/loading.d.ts.map +0 -1
  160. package/lib/components/loading.js +0 -76
  161. package/lib/components/loading.ts +0 -104
  162. package/lib/components/menu.d.ts +0 -38
  163. package/lib/components/menu.d.ts.map +0 -1
  164. package/lib/components/menu.js +0 -205
  165. package/lib/components/menu.ts +0 -279
  166. package/lib/components/modal.d.ts +0 -97
  167. package/lib/components/modal.d.ts.map +0 -1
  168. package/lib/components/modal.js +0 -463
  169. package/lib/components/modal.ts +0 -576
  170. package/lib/components/nav.d.ts +0 -46
  171. package/lib/components/nav.d.ts.map +0 -1
  172. package/lib/components/nav.js +0 -193
  173. package/lib/components/nav.ts +0 -261
  174. package/lib/components/paragraph.d.ts +0 -30
  175. package/lib/components/paragraph.d.ts.map +0 -1
  176. package/lib/components/paragraph.js +0 -93
  177. package/lib/components/paragraph.ts +0 -123
  178. package/lib/components/pen.d.ts +0 -125
  179. package/lib/components/pen.d.ts.map +0 -1
  180. package/lib/components/pen.js +0 -443
  181. package/lib/components/pen.ts +0 -567
  182. package/lib/components/progress.d.ts +0 -40
  183. package/lib/components/progress.d.ts.map +0 -1
  184. package/lib/components/progress.js +0 -116
  185. package/lib/components/progress.ts +0 -163
  186. package/lib/components/radio.d.ts +0 -43
  187. package/lib/components/radio.d.ts.map +0 -1
  188. package/lib/components/radio.js +0 -226
  189. package/lib/components/radio.ts +0 -303
  190. package/lib/components/registry.d.ts +0 -34
  191. package/lib/components/registry.d.ts.map +0 -1
  192. package/lib/components/registry.js +0 -163
  193. package/lib/components/registry.ts +0 -193
  194. package/lib/components/req.d.ts +0 -155
  195. package/lib/components/req.d.ts.map +0 -1
  196. package/lib/components/req.js +0 -253
  197. package/lib/components/req.ts +0 -303
  198. package/lib/components/script.d.ts +0 -14
  199. package/lib/components/script.d.ts.map +0 -1
  200. package/lib/components/script.js +0 -33
  201. package/lib/components/script.ts +0 -41
  202. package/lib/components/select.d.ts +0 -42
  203. package/lib/components/select.d.ts.map +0 -1
  204. package/lib/components/select.js +0 -209
  205. package/lib/components/select.ts +0 -281
  206. package/lib/components/sidebar.d.ts +0 -59
  207. package/lib/components/sidebar.d.ts.map +0 -1
  208. package/lib/components/sidebar.js +0 -298
  209. package/lib/components/sidebar.ts +0 -395
  210. package/lib/components/stack/BaseStack.d.ts +0 -65
  211. package/lib/components/stack/BaseStack.d.ts.map +0 -1
  212. package/lib/components/stack/BaseStack.js +0 -274
  213. package/lib/components/stack/BaseStack.ts +0 -328
  214. package/lib/components/stack/HStack.d.ts +0 -18
  215. package/lib/components/stack/HStack.d.ts.map +0 -1
  216. package/lib/components/stack/HStack.js +0 -22
  217. package/lib/components/stack/HStack.ts +0 -25
  218. package/lib/components/stack/VStack.d.ts +0 -19
  219. package/lib/components/stack/VStack.d.ts.map +0 -1
  220. package/lib/components/stack/VStack.js +0 -23
  221. package/lib/components/stack/VStack.ts +0 -26
  222. package/lib/components/stack/ZStack.d.ts +0 -18
  223. package/lib/components/stack/ZStack.d.ts.map +0 -1
  224. package/lib/components/stack/ZStack.js +0 -22
  225. package/lib/components/stack/ZStack.ts +0 -25
  226. package/lib/components/style.d.ts +0 -14
  227. package/lib/components/style.d.ts.map +0 -1
  228. package/lib/components/style.js +0 -33
  229. package/lib/components/style.ts +0 -41
  230. package/lib/components/switch.d.ts +0 -34
  231. package/lib/components/switch.d.ts.map +0 -1
  232. package/lib/components/switch.js +0 -209
  233. package/lib/components/switch.ts +0 -272
  234. package/lib/components/table.d.ts +0 -137
  235. package/lib/components/table.d.ts.map +0 -1
  236. package/lib/components/table.js +0 -1019
  237. package/lib/components/table.ts +0 -1225
  238. package/lib/components/tabs.d.ts +0 -53
  239. package/lib/components/tabs.d.ts.map +0 -1
  240. package/lib/components/tabs.js +0 -275
  241. package/lib/components/tabs.ts +0 -349
  242. package/lib/components/theme-toggle.d.ts +0 -45
  243. package/lib/components/theme-toggle.d.ts.map +0 -1
  244. package/lib/components/theme-toggle.js +0 -218
  245. package/lib/components/theme-toggle.ts +0 -297
  246. package/lib/components/tooltip.d.ts +0 -31
  247. package/lib/components/tooltip.d.ts.map +0 -1
  248. package/lib/components/tooltip.js +0 -112
  249. package/lib/components/tooltip.ts +0 -148
  250. package/lib/components/watcher.d.ts +0 -195
  251. package/lib/components/watcher.d.ts.map +0 -1
  252. package/lib/components/watcher.js +0 -241
  253. package/lib/components/watcher.ts +0 -261
  254. package/lib/components/write.d.ts +0 -107
  255. package/lib/components/write.d.ts.map +0 -1
  256. package/lib/components/write.js +0 -222
  257. package/lib/components/write.ts +0 -272
  258. package/lib/data/DataPipeline.d.ts +0 -113
  259. package/lib/data/DataPipeline.d.ts.map +0 -1
  260. package/lib/data/DataPipeline.js +0 -359
  261. package/lib/data/DataPipeline.ts +0 -452
  262. package/lib/facades/dataframe.jux +0 -0
  263. package/lib/globals.d.ts +0 -21
  264. package/lib/reactivity/state.d.ts +0 -36
  265. package/lib/reactivity/state.d.ts.map +0 -1
  266. package/lib/reactivity/state.js +0 -67
  267. package/lib/reactivity/state.ts +0 -78
  268. package/lib/storage/DataFrame.d.ts +0 -284
  269. package/lib/storage/DataFrame.d.ts.map +0 -1
  270. package/lib/storage/DataFrame.js +0 -1022
  271. package/lib/storage/DataFrame.ts +0 -1195
  272. package/lib/storage/DataFrameSource.d.ts +0 -158
  273. package/lib/storage/DataFrameSource.d.ts.map +0 -1
  274. package/lib/storage/DataFrameSource.js +0 -409
  275. package/lib/storage/DataFrameSource.ts +0 -556
  276. package/lib/storage/FileStorage.d.ts +0 -53
  277. package/lib/storage/FileStorage.d.ts.map +0 -1
  278. package/lib/storage/FileStorage.js +0 -80
  279. package/lib/storage/FileStorage.ts +0 -95
  280. package/lib/storage/IndexedDBDriver.d.ts +0 -75
  281. package/lib/storage/IndexedDBDriver.d.ts.map +0 -1
  282. package/lib/storage/IndexedDBDriver.js +0 -177
  283. package/lib/storage/IndexedDBDriver.ts +0 -226
  284. package/lib/storage/TabularDriver.d.ts +0 -118
  285. package/lib/storage/TabularDriver.d.ts.map +0 -1
  286. package/lib/storage/TabularDriver.js +0 -731
  287. package/lib/storage/TabularDriver.ts +0 -874
  288. package/lib/utils/codeparser.d.ts +0 -29
  289. package/lib/utils/codeparser.d.ts.map +0 -1
  290. package/lib/utils/codeparser.js +0 -409
  291. package/lib/utils/fetch.d.ts +0 -176
  292. package/lib/utils/fetch.d.ts.map +0 -1
  293. package/lib/utils/fetch.js +0 -427
  294. package/lib/utils/formatId.d.ts +0 -16
  295. package/lib/utils/formatId.d.ts.map +0 -1
  296. package/lib/utils/formatId.js +0 -27
  297. package/lib/utils/path-resolver.js +0 -23
@@ -1,77 +0,0 @@
1
- import { BaseComponent } from './BaseComponent.js';
2
- /**
3
- * Base state interface for all form inputs
4
- */
5
- export interface FormInputState extends Record<string, any> {
6
- label: string;
7
- required: boolean;
8
- disabled: boolean;
9
- name: string;
10
- style: string;
11
- class: string;
12
- errorMessage?: string;
13
- }
14
- /**
15
- * Abstract base class for all form input components
16
- * Extends BaseComponent with form-specific functionality
17
- */
18
- export declare abstract class FormInput<TState extends FormInputState> extends BaseComponent<TState> {
19
- protected _inputElement: HTMLElement | null;
20
- protected _labelElement: HTMLLabelElement | null;
21
- protected _errorElement: HTMLElement | null;
22
- protected _onValidate?: (value: any) => boolean | string;
23
- protected _hasBeenValidated: boolean;
24
- /**
25
- * Get the current value of the input
26
- */
27
- abstract getValue(): any;
28
- /**
29
- * Set the value of the input
30
- */
31
- abstract setValue(value: any): this;
32
- /**
33
- * Build the actual input element (input, select, textarea, etc.)
34
- */
35
- protected abstract _buildInputElement(): HTMLElement;
36
- /**
37
- * Validate the current value
38
- */
39
- protected abstract _validateValue(value: any): boolean | string;
40
- label(value: string): this;
41
- required(value: boolean): this;
42
- name(value: string): this;
43
- onValidate(handler: (value: any) => boolean | string): this;
44
- /**
45
- * Validate the current value and show/hide errors
46
- */
47
- validate(): boolean;
48
- /**
49
- * Check if current value is valid without showing errors
50
- */
51
- isValid(): boolean;
52
- /**
53
- * Show error message
54
- */
55
- protected _showError(message: string): void;
56
- /**
57
- * Clear error message
58
- */
59
- protected _clearError(): void;
60
- /**
61
- * Build label element with auto-generated text from ID if not provided
62
- */
63
- protected _renderLabel(): HTMLLabelElement;
64
- /**
65
- * Build error element
66
- */
67
- protected _renderError(): HTMLElement;
68
- /**
69
- * Default update implementation for form inputs
70
- */
71
- update(prop: string, value: any): void;
72
- /**
73
- * Wire up two-way sync for value property
74
- */
75
- protected _wireFormSync(inputElement: HTMLElement, eventName?: string): void;
76
- }
77
- //# sourceMappingURL=FormInput.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormInput.d.ts","sourceRoot":"","sources":["FormInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,8BAAsB,SAAS,CAAC,MAAM,SAAS,cAAc,CAAE,SAAQ,aAAa,CAAC,MAAM,CAAC;IACxF,SAAS,CAAC,aAAa,EAAE,WAAW,GAAG,IAAI,CAAQ;IACnD,SAAS,CAAC,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAQ;IACxD,SAAS,CAAC,aAAa,EAAE,WAAW,GAAG,IAAI,CAAQ;IACnD,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,GAAG,MAAM,CAAC;IACzD,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAAS;IAM7C;;OAEG;IACH,QAAQ,CAAC,QAAQ,IAAI,GAAG;IAExB;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAEnC;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,kBAAkB,IAAI,WAAW;IAEpD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,GAAG,MAAM;IAM/D,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQ1B,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAK9B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKzB,UAAU,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,GAAG,MAAM,GAAG,IAAI;IAS3D;;OAEG;IACH,QAAQ,IAAI,OAAO;IAcnB;;OAEG;IACH,OAAO,IAAI,OAAO;IAKlB;;OAEG;IACH,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAa3C;;OAEG;IACH,SAAS,CAAC,WAAW,IAAI,IAAI;IAiB7B;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,gBAAgB;IAqB1C;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,WAAW;IAUrC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAItC;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,YAAY,EAAE,WAAW,EAAE,SAAS,GAAE,MAAgB,GAAG,IAAI;CA8CxF"}
@@ -1,171 +0,0 @@
1
- import { BaseComponent } from './BaseComponent.js';
2
- import { formatIdAsLabel } from '../../utils/formatId.js'; // ✅ Import utility
3
- /**
4
- * Abstract base class for all form input components
5
- * Extends BaseComponent with form-specific functionality
6
- */
7
- export class FormInput extends BaseComponent {
8
- constructor() {
9
- super(...arguments);
10
- this._inputElement = null;
11
- this._labelElement = null;
12
- this._errorElement = null;
13
- this._hasBeenValidated = false; // NEW: Track if user has submitted/validated
14
- }
15
- /* ═════════════════════════════════════════════════════════════════
16
- * COMMON FORM INPUT API
17
- * ═════════════════════════════════════════════════════════════════ */
18
- label(value) {
19
- this.state.label = value;
20
- if (this._labelElement) {
21
- this._labelElement.textContent = value;
22
- }
23
- return this;
24
- }
25
- required(value) {
26
- this.state.required = value;
27
- return this;
28
- }
29
- name(value) {
30
- this.state.name = value;
31
- return this;
32
- }
33
- onValidate(handler) {
34
- this._onValidate = handler;
35
- return this;
36
- }
37
- /* ═════════════════════════════════════════════════════════════════
38
- * VALIDATION
39
- * ═════════════════════════════════════════════════════════════════ */
40
- /**
41
- * Validate the current value and show/hide errors
42
- */
43
- validate() {
44
- this._hasBeenValidated = true; // Mark as validated
45
- const value = this.getValue();
46
- const result = this._validateValue(value);
47
- if (result === true) {
48
- this._clearError();
49
- return true;
50
- }
51
- else {
52
- this._showError(result);
53
- return false;
54
- }
55
- }
56
- /**
57
- * Check if current value is valid without showing errors
58
- */
59
- isValid() {
60
- const value = this.getValue();
61
- return this._validateValue(value) === true;
62
- }
63
- /**
64
- * Show error message
65
- */
66
- _showError(message) {
67
- if (this._errorElement) {
68
- this._errorElement.textContent = message;
69
- this._errorElement.style.display = 'block';
70
- }
71
- if (this._inputElement) {
72
- this._inputElement.classList.add('jux-input-invalid');
73
- }
74
- this.state.errorMessage = message;
75
- }
76
- /**
77
- * Clear error message
78
- */
79
- _clearError() {
80
- if (this._errorElement) {
81
- this._errorElement.textContent = '';
82
- this._errorElement.style.display = 'none';
83
- }
84
- if (this._inputElement) {
85
- this._inputElement.classList.remove('jux-input-invalid');
86
- }
87
- this.state.errorMessage = undefined;
88
- }
89
- /* ═════════════════════════════════════════════════════════════════
90
- * COMMON RENDER HELPERS
91
- * ═════════════════════════════════════════════════════════════════ */
92
- /**
93
- * Build label element with auto-generated text from ID if not provided
94
- */
95
- _renderLabel() {
96
- const { label, required } = this.state;
97
- const labelEl = document.createElement('label');
98
- labelEl.className = 'jux-input-label';
99
- labelEl.htmlFor = `${this._id}-input`;
100
- // ✅ Use provided label or auto-generate from ID
101
- labelEl.textContent = label || formatIdAsLabel(this._id);
102
- if (required) {
103
- const requiredSpan = document.createElement('span');
104
- requiredSpan.className = 'jux-input-required';
105
- requiredSpan.textContent = ' *';
106
- labelEl.appendChild(requiredSpan);
107
- }
108
- this._labelElement = labelEl;
109
- return labelEl;
110
- }
111
- /**
112
- * Build error element
113
- */
114
- _renderError() {
115
- const errorEl = document.createElement('div');
116
- errorEl.className = 'jux-input-error';
117
- errorEl.id = `${this._id}-error`;
118
- errorEl.style.display = 'none';
119
- this._errorElement = errorEl;
120
- return errorEl;
121
- }
122
- /**
123
- * Default update implementation for form inputs
124
- */
125
- update(prop, value) {
126
- // No reactive updates needed - form inputs handle their own state
127
- }
128
- /**
129
- * Wire up two-way sync for value property
130
- */
131
- _wireFormSync(inputElement, eventName = 'input') {
132
- const valueSync = this._syncBindings.find(b => b.property === 'value');
133
- if (valueSync) {
134
- const { stateObj, toState, toComponent } = valueSync;
135
- // Default transforms
136
- const transformToState = toState || ((v) => v);
137
- const transformToComponent = toComponent || ((v) => v);
138
- let isUpdating = false;
139
- // State → Component
140
- stateObj.subscribe((val) => {
141
- if (isUpdating)
142
- return;
143
- const transformed = transformToComponent(val);
144
- this.setValue(transformed);
145
- });
146
- // Component → State
147
- inputElement.addEventListener(eventName, () => {
148
- if (isUpdating)
149
- return;
150
- isUpdating = true;
151
- const value = this.getValue();
152
- const transformed = transformToState(value);
153
- this._clearError();
154
- stateObj.set(transformed);
155
- setTimeout(() => { isUpdating = false; }, 0);
156
- });
157
- }
158
- else {
159
- // Default behavior without sync
160
- inputElement.addEventListener(eventName, () => {
161
- this._clearError();
162
- });
163
- }
164
- // Only validate on blur IF the field has been validated before (e.g., after submit)
165
- inputElement.addEventListener('blur', () => {
166
- if (this._hasBeenValidated) {
167
- this.validate();
168
- }
169
- });
170
- }
171
- }
@@ -1,237 +0,0 @@
1
- import { BaseComponent } from './BaseComponent.js';
2
- import { formatIdAsLabel } from '../../utils/formatId.js'; // ✅ Import utility
3
-
4
- /**
5
- * Base state interface for all form inputs
6
- */
7
- export interface FormInputState extends Record<string, any> {
8
- label: string;
9
- required: boolean;
10
- disabled: boolean;
11
- name: string;
12
- style: string;
13
- class: string;
14
- errorMessage?: string;
15
- }
16
-
17
- /**
18
- * Abstract base class for all form input components
19
- * Extends BaseComponent with form-specific functionality
20
- */
21
- export abstract class FormInput<TState extends FormInputState> extends BaseComponent<TState> {
22
- protected _inputElement: HTMLElement | null = null;
23
- protected _labelElement: HTMLLabelElement | null = null;
24
- protected _errorElement: HTMLElement | null = null;
25
- protected _onValidate?: (value: any) => boolean | string;
26
- protected _hasBeenValidated: boolean = false; // NEW: Track if user has submitted/validated
27
-
28
- /* ═════════════════════════════════════════════════════════════════
29
- * ABSTRACT METHODS (Child must implement)
30
- * ═════════════════════════════════════════════════════════════════ */
31
-
32
- /**
33
- * Get the current value of the input
34
- */
35
- abstract getValue(): any;
36
-
37
- /**
38
- * Set the value of the input
39
- */
40
- abstract setValue(value: any): this;
41
-
42
- /**
43
- * Build the actual input element (input, select, textarea, etc.)
44
- */
45
- protected abstract _buildInputElement(): HTMLElement;
46
-
47
- /**
48
- * Validate the current value
49
- */
50
- protected abstract _validateValue(value: any): boolean | string;
51
-
52
- /* ═════════════════════════════════════════════════════════════════
53
- * COMMON FORM INPUT API
54
- * ═════════════════════════════════════════════════════════════════ */
55
-
56
- label(value: string): this {
57
- this.state.label = value;
58
- if (this._labelElement) {
59
- this._labelElement.textContent = value;
60
- }
61
- return this;
62
- }
63
-
64
- required(value: boolean): this {
65
- this.state.required = value;
66
- return this;
67
- }
68
-
69
- name(value: string): this {
70
- this.state.name = value;
71
- return this;
72
- }
73
-
74
- onValidate(handler: (value: any) => boolean | string): this {
75
- this._onValidate = handler;
76
- return this;
77
- }
78
-
79
- /* ═════════════════════════════════════════════════════════════════
80
- * VALIDATION
81
- * ═════════════════════════════════════════════════════════════════ */
82
-
83
- /**
84
- * Validate the current value and show/hide errors
85
- */
86
- validate(): boolean {
87
- this._hasBeenValidated = true; // Mark as validated
88
- const value = this.getValue();
89
- const result = this._validateValue(value);
90
-
91
- if (result === true) {
92
- this._clearError();
93
- return true;
94
- } else {
95
- this._showError(result as string);
96
- return false;
97
- }
98
- }
99
-
100
- /**
101
- * Check if current value is valid without showing errors
102
- */
103
- isValid(): boolean {
104
- const value = this.getValue();
105
- return this._validateValue(value) === true;
106
- }
107
-
108
- /**
109
- * Show error message
110
- */
111
- protected _showError(message: string): void {
112
- if (this._errorElement) {
113
- this._errorElement.textContent = message;
114
- this._errorElement.style.display = 'block';
115
- }
116
-
117
- if (this._inputElement) {
118
- this._inputElement.classList.add('jux-input-invalid');
119
- }
120
-
121
- this.state.errorMessage = message;
122
- }
123
-
124
- /**
125
- * Clear error message
126
- */
127
- protected _clearError(): void {
128
- if (this._errorElement) {
129
- this._errorElement.textContent = '';
130
- this._errorElement.style.display = 'none';
131
- }
132
-
133
- if (this._inputElement) {
134
- this._inputElement.classList.remove('jux-input-invalid');
135
- }
136
-
137
- this.state.errorMessage = undefined;
138
- }
139
-
140
- /* ═════════════════════════════════════════════════════════════════
141
- * COMMON RENDER HELPERS
142
- * ═════════════════════════════════════════════════════════════════ */
143
-
144
- /**
145
- * Build label element with auto-generated text from ID if not provided
146
- */
147
- protected _renderLabel(): HTMLLabelElement {
148
- const { label, required } = this.state;
149
-
150
- const labelEl = document.createElement('label');
151
- labelEl.className = 'jux-input-label';
152
- labelEl.htmlFor = `${this._id}-input`;
153
-
154
- // ✅ Use provided label or auto-generate from ID
155
- labelEl.textContent = label || formatIdAsLabel(this._id);
156
-
157
- if (required) {
158
- const requiredSpan = document.createElement('span');
159
- requiredSpan.className = 'jux-input-required';
160
- requiredSpan.textContent = ' *';
161
- labelEl.appendChild(requiredSpan);
162
- }
163
-
164
- this._labelElement = labelEl;
165
- return labelEl;
166
- }
167
-
168
- /**
169
- * Build error element
170
- */
171
- protected _renderError(): HTMLElement {
172
- const errorEl = document.createElement('div');
173
- errorEl.className = 'jux-input-error';
174
- errorEl.id = `${this._id}-error`;
175
- errorEl.style.display = 'none';
176
-
177
- this._errorElement = errorEl;
178
- return errorEl;
179
- }
180
-
181
- /**
182
- * Default update implementation for form inputs
183
- */
184
- update(prop: string, value: any): void {
185
- // No reactive updates needed - form inputs handle their own state
186
- }
187
-
188
- /**
189
- * Wire up two-way sync for value property
190
- */
191
- protected _wireFormSync(inputElement: HTMLElement, eventName: string = 'input'): void {
192
- const valueSync = this._syncBindings.find(b => b.property === 'value');
193
-
194
- if (valueSync) {
195
- const { stateObj, toState, toComponent } = valueSync;
196
-
197
- // Default transforms
198
- const transformToState = toState || ((v: any) => v);
199
- const transformToComponent = toComponent || ((v: any) => v);
200
-
201
- let isUpdating = false;
202
-
203
- // State → Component
204
- stateObj.subscribe((val: any) => {
205
- if (isUpdating) return;
206
- const transformed = transformToComponent(val);
207
- this.setValue(transformed);
208
- });
209
-
210
- // Component → State
211
- inputElement.addEventListener(eventName, () => {
212
- if (isUpdating) return;
213
- isUpdating = true;
214
-
215
- const value = this.getValue();
216
- const transformed = transformToState(value);
217
- this._clearError();
218
-
219
- stateObj.set(transformed);
220
-
221
- setTimeout(() => { isUpdating = false; }, 0);
222
- });
223
- } else {
224
- // Default behavior without sync
225
- inputElement.addEventListener(eventName, () => {
226
- this._clearError();
227
- });
228
- }
229
-
230
- // Only validate on blur IF the field has been validated before (e.g., after submit)
231
- inputElement.addEventListener('blur', () => {
232
- if (this._hasBeenValidated) {
233
- this.validate();
234
- }
235
- });
236
- }
237
- }
@@ -1,40 +0,0 @@
1
- import { BaseComponent, BaseState } from './base/BaseComponent.js';
2
- export interface BlueprintOptions {
3
- structureData?: any;
4
- classData?: any;
5
- filter?: string;
6
- showMethods?: boolean;
7
- expandAll?: boolean;
8
- theme?: 'light' | 'dark' | 'auto';
9
- style?: string;
10
- class?: string;
11
- }
12
- interface BlueprintState extends BaseState {
13
- structureData: any;
14
- classData: any;
15
- filter: string;
16
- showMethods: boolean;
17
- expandAll: boolean;
18
- theme: string;
19
- expandedComponents: Set<string>;
20
- }
21
- export declare class Blueprint extends BaseComponent<BlueprintState> {
22
- constructor(id: string, options?: BlueprintOptions);
23
- protected getTriggerEvents(): readonly string[];
24
- protected getCallbackEvents(): readonly string[];
25
- structureData(data: any): this;
26
- classData(data: any): this;
27
- filter(value: string): this;
28
- showMethods(value: boolean): this;
29
- expandAll(value: boolean): this;
30
- theme(value: 'light' | 'dark' | 'auto'): this;
31
- toggleComponent(componentFile: string): this;
32
- private _renderHierarchy;
33
- private _renderComponentCard;
34
- update(prop: string, value: any): void;
35
- private _rebuildContent;
36
- render(targetId?: string | HTMLElement | BaseComponent<any>): this;
37
- }
38
- export declare function blueprint(id: string, options?: BlueprintOptions): Blueprint;
39
- export {};
40
- //# sourceMappingURL=blueprint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["blueprint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMnE,MAAM,WAAW,gBAAgB;IAC7B,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,cAAe,SAAQ,SAAS;IACtC,aAAa,EAAE,GAAG,CAAC;IACnB,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnC;AASD,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAc,CAAC;gBAC5C,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IActD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAQhD,aAAa,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAK9B,SAAS,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAK1B,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK3B,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKjC,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAK/B,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI;IAK7C,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAc5C,OAAO,CAAC,gBAAgB;IA2DxB,OAAO,CAAC,oBAAoB;IA6F5B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAwBtC,OAAO,CAAC,eAAe;IAyCvB,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CA8FrE;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAE/E"}