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,260 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- import { parseCode, renderLineWithTokens, getSyntaxHighlightCSS } from '../utils/codeparser.js';
3
-
4
- // Event definitions
5
- const TRIGGER_EVENTS = [] as const;
6
- const CALLBACK_EVENTS = [] as const;
7
-
8
- export interface CodeOptions {
9
- content?: string;
10
- language?: string;
11
- showLineNumbers?: boolean;
12
- startLine?: number;
13
- highlightLines?: number[];
14
- style?: string;
15
- class?: string;
16
- }
17
-
18
- type CodeState = {
19
- content: string;
20
- language: string;
21
- showLineNumbers: boolean;
22
- startLine: number;
23
- highlightLines: number[];
24
- style: string;
25
- class: string;
26
- };
27
-
28
- export class Code extends BaseComponent<CodeState> {
29
- private _codeContainer: HTMLElement | null = null;
30
- private static _syntaxCSSInjected = false;
31
-
32
- constructor(id: string, options: CodeOptions = {}) {
33
- super(id, {
34
- content: options.content ?? '',
35
- language: options.language ?? 'javascript',
36
- showLineNumbers: options.showLineNumbers ?? true,
37
- startLine: options.startLine ?? 1,
38
- highlightLines: options.highlightLines ?? [],
39
- style: options.style ?? '',
40
- class: options.class ?? ''
41
- });
42
- }
43
-
44
- protected getTriggerEvents(): readonly string[] {
45
- return TRIGGER_EVENTS;
46
- }
47
-
48
- protected getCallbackEvents(): readonly string[] {
49
- return CALLBACK_EVENTS;
50
- }
51
-
52
- update(prop: string, value: any): void {
53
- super.update(prop, value);
54
-
55
- if (!this._codeContainer) return;
56
-
57
- switch (prop) {
58
- case 'content':
59
- this._rebuildLines();
60
- break;
61
- case 'showLineNumbers':
62
- this._codeContainer.classList.toggle('jux-code-no-numbers', !value);
63
- break;
64
- case 'highlightLines':
65
- this._updateHighlights();
66
- break;
67
- }
68
- }
69
-
70
- /* ═════════════════════════════════════════════════════════════════
71
- * FLUENT API
72
- * ═════════════════════════════════════════════════════════════════ */
73
-
74
- content(value: string): this {
75
- this.state.content = value;
76
- return this;
77
- }
78
-
79
- language(value: string): this {
80
- this.state.language = value;
81
- return this;
82
- }
83
-
84
- showLineNumbers(value: boolean): this {
85
- this.state.showLineNumbers = value;
86
- return this;
87
- }
88
-
89
- startLine(value: number): this {
90
- this.state.startLine = value;
91
- return this;
92
- }
93
-
94
- highlightLines(lines: number[]): this {
95
- this.state.highlightLines = lines;
96
- return this;
97
- }
98
-
99
- /* ═════════════════════════════════════════════════════════════════
100
- * PARSING & RENDERING
101
- * ═════════════════════════════════════════════════════════════════ */
102
-
103
- /**
104
- * Parse code content into individual lines with tokens
105
- */
106
- private _parseLines(): ReturnType<typeof parseCode> {
107
- return parseCode(this.state.content, this.state.language);
108
- }
109
-
110
- /**
111
- * Rebuild all line elements
112
- */
113
- private _rebuildLines(): void {
114
- if (!this._codeContainer) return;
115
-
116
- const codeEl = this._codeContainer.querySelector('.jux-code-lines');
117
- if (!codeEl) return;
118
-
119
- codeEl.innerHTML = '';
120
-
121
- const parsedLines = this._parseLines();
122
- const { startLine, highlightLines } = this.state;
123
-
124
- parsedLines.forEach((parsedLine, index) => {
125
- const lineNumber = startLine + index;
126
- const isHighlighted = highlightLines.includes(lineNumber);
127
- const lineEl = this._createLineElement(parsedLine, lineNumber, isHighlighted);
128
- codeEl.appendChild(lineEl);
129
- });
130
-
131
- }
132
-
133
- /**
134
- * Create a single line element with parsed tokens
135
- */
136
- private _createLineElement(parsedLine: ReturnType<typeof parseCode>[0], lineNumber: number, highlighted: boolean): HTMLElement {
137
- const lineEl = document.createElement('div');
138
- lineEl.className = 'jux-code-line';
139
- lineEl.setAttribute('data-line', String(lineNumber));
140
-
141
- if (highlighted) {
142
- lineEl.classList.add('jux-code-line-highlight');
143
- }
144
-
145
- // Line number
146
- if (this.state.showLineNumbers) {
147
- const lineNum = document.createElement('span');
148
- lineNum.className = 'jux-code-line-number';
149
- lineNum.textContent = String(lineNumber);
150
- lineEl.appendChild(lineNum);
151
- }
152
-
153
- // Line content with syntax highlighting
154
- const lineCode = document.createElement('span');
155
- lineCode.className = 'jux-code-line-content';
156
- lineCode.innerHTML = renderLineWithTokens(parsedLine);
157
- lineEl.appendChild(lineCode);
158
-
159
- return lineEl;
160
- }
161
-
162
- /**
163
- * Update highlighted lines without full rebuild
164
- */
165
- private _updateHighlights(): void {
166
- if (!this._codeContainer) return;
167
-
168
- const lines = this._codeContainer.querySelectorAll('.jux-code-line');
169
- lines.forEach((line) => {
170
- const lineNum = parseInt(line.getAttribute('data-line') || '0', 10);
171
- const isHighlighted = this.state.highlightLines.includes(lineNum);
172
- line.classList.toggle('jux-code-line-highlight', isHighlighted);
173
- });
174
- }
175
-
176
- /* ═════════════════════════════════════════════════════════════════
177
- * RENDER
178
- * ═════════════════════════════════════════════════════════════════ */
179
-
180
- render(targetId?: string | HTMLElement | BaseComponent<any>): this {
181
- const container = this._setupContainer(targetId);
182
-
183
- // ✅ Inject syntax CSS once globally
184
- if (!Code._syntaxCSSInjected) {
185
- const style = document.createElement('style');
186
- style.id = 'jux-code-syntax-css';
187
- style.textContent = getSyntaxHighlightCSS();
188
- document.head.appendChild(style);
189
- Code._syntaxCSSInjected = true;
190
- }
191
-
192
- const { language, showLineNumbers, style, class: className } = this.state;
193
-
194
- const wrapper = document.createElement('div');
195
- wrapper.className = 'jux-code';
196
- wrapper.id = this._id;
197
- if (!showLineNumbers) wrapper.classList.add('jux-code-no-numbers');
198
- if (className) wrapper.className += ` ${className}`;
199
- if (style) wrapper.setAttribute('style', style);
200
-
201
- // ✅ Remove <pre>, just use a div with code styling
202
- const codeEl = document.createElement('div');
203
- codeEl.className = 'jux-code-lines';
204
-
205
- // Build initial lines with parsed tokens
206
- const parsedLines = this._parseLines();
207
- const { startLine, highlightLines } = this.state;
208
-
209
- parsedLines.forEach((parsedLine, index) => {
210
- const lineNumber = startLine + index;
211
- const isHighlighted = highlightLines.includes(lineNumber);
212
- const lineEl = this._createLineElement(parsedLine, lineNumber, isHighlighted);
213
- codeEl.appendChild(lineEl);
214
- });
215
-
216
- wrapper.appendChild(codeEl);
217
-
218
- this._wireStandardEvents(wrapper);
219
-
220
- // Wire sync bindings
221
- this._syncBindings.forEach(({ property, stateObj, toState, toComponent }) => {
222
- if (property === 'content') {
223
- const transform = toComponent || ((v: any) => String(v));
224
-
225
- stateObj.subscribe((val: any) => {
226
- const transformed = transform(val);
227
- this.state.content = transformed;
228
- this._rebuildLines();
229
- });
230
- }
231
- else if (property === 'language') {
232
- const transform = toComponent || ((v: any) => String(v));
233
-
234
- stateObj.subscribe((val: any) => {
235
- const transformed = transform(val);
236
- this.state.language = transformed;
237
- this._rebuildLines();
238
- });
239
- }
240
- else if (property === 'highlightLines') {
241
- const transform = toComponent || ((v: any) => (Array.isArray(v) ? v : []));
242
-
243
- stateObj.subscribe((val: any) => {
244
- const transformed = transform(val);
245
- this.state.highlightLines = transformed;
246
- this._updateHighlights();
247
- });
248
- }
249
- });
250
-
251
- container.appendChild(wrapper);
252
- this._codeContainer = wrapper;
253
-
254
- return this;
255
- }
256
- }
257
-
258
- export function code(id: string, options: CodeOptions = {}): Code {
259
- return new Code(id, options);
260
- }
@@ -1,60 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- /**
3
- * Container options
4
- */
5
- export interface ContainerOptions {
6
- content?: string | BaseComponent<any> | Array<string | BaseComponent<any>>;
7
- class?: string;
8
- style?: string;
9
- direction?: 'row' | 'column';
10
- gap?: string | number;
11
- align?: 'start' | 'center' | 'end' | 'stretch';
12
- justify?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
13
- }
14
- /**
15
- * Container state
16
- */
17
- type ContainerState = {
18
- content: string | BaseComponent<any> | Array<string | BaseComponent<any>>;
19
- class: string;
20
- style: string;
21
- direction?: 'row' | 'column';
22
- gap?: string | number;
23
- align?: string;
24
- justify?: string;
25
- };
26
- /**
27
- * Container component - a simple div container for grouping elements
28
- */
29
- export declare class Container extends BaseComponent<ContainerState> {
30
- private _containerElement;
31
- constructor(id: string, options?: ContainerOptions);
32
- protected getTriggerEvents(): readonly string[];
33
- protected getCallbackEvents(): readonly string[];
34
- update(prop: string, value: any): void;
35
- private _updateContent;
36
- content(value: string | BaseComponent<any> | Array<string | BaseComponent<any>>): this;
37
- direction(value: 'row' | 'column'): this;
38
- gap(value: string | number): this;
39
- align(value: 'start' | 'center' | 'end' | 'stretch'): this;
40
- justify(value: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly'): this;
41
- /**
42
- * Add content to container (supports strings and BaseComponents)
43
- */
44
- addContent(content: string | BaseComponent<any> | Array<string | BaseComponent<any>>): this;
45
- /**
46
- * Clear all content from container
47
- */
48
- clearContent(): this;
49
- /**
50
- * Get the container element ID for rendering child components
51
- */
52
- contentId(): string;
53
- render(targetId?: string | HTMLElement | BaseComponent<any>): this;
54
- }
55
- /**
56
- * Factory helper
57
- */
58
- export declare function container(id: string, options?: ContainerOptions): Container;
59
- export {};
60
- //# sourceMappingURL=container.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,eAAe,GAAG,cAAc,GAAG,cAAc,CAAC;CAC1F;AAED;;GAEG;AACH,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,qBAAa,SAAU,SAAQ,aAAa,CAAC,cAAc,CAAC;IAC1D,OAAO,CAAC,iBAAiB,CAA4B;gBAEzC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB;IAYtD,SAAS,CAAC,gBAAgB,IAAI,SAAS,MAAM,EAAE;IAI/C,SAAS,CAAC,iBAAiB,IAAI,SAAS,MAAM,EAAE;IAIhD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IA6BtC,OAAO,CAAC,cAAc;IAgCtB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI;IAKtF,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,IAAI;IAKxC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKjC,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,IAAI;IAK1D,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,eAAe,GAAG,cAAc,GAAG,cAAc,GAAG,IAAI;IAKpG;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI;IAuB3F;;OAEG;IACH,YAAY,IAAI,IAAI;IAOpB;;OAEG;IACH,SAAS,IAAI,MAAM;IAQnB,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI;CA4DnE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAE/E"}
@@ -1,195 +0,0 @@
1
- import { BaseComponent } from './base/BaseComponent.js';
2
- // Event definitions - Container is a layout wrapper that can be clicked
3
- const TRIGGER_EVENTS = [];
4
- const CALLBACK_EVENTS = ['click'];
5
- /**
6
- * Container component - a simple div container for grouping elements
7
- */
8
- export class Container extends BaseComponent {
9
- constructor(id, options = {}) {
10
- super(id, {
11
- content: options.content ?? [],
12
- class: options.class ?? '',
13
- style: options.style ?? '',
14
- direction: options.direction,
15
- gap: options.gap,
16
- align: options.align,
17
- justify: options.justify
18
- });
19
- this._containerElement = null;
20
- }
21
- getTriggerEvents() {
22
- return TRIGGER_EVENTS;
23
- }
24
- getCallbackEvents() {
25
- return CALLBACK_EVENTS;
26
- }
27
- update(prop, value) {
28
- super.update(prop, value);
29
- if (!this._containerElement)
30
- return;
31
- switch (prop) {
32
- case 'content':
33
- this._updateContent(value);
34
- break;
35
- case 'direction':
36
- this._containerElement.style.flexDirection = value;
37
- break;
38
- case 'gap':
39
- const gapValue = typeof value === 'number' ? `${value}px` : value;
40
- this._containerElement.style.gap = gapValue;
41
- break;
42
- case 'align':
43
- this._containerElement.style.alignItems = value;
44
- break;
45
- case 'justify':
46
- this._containerElement.style.justifyContent = value;
47
- break;
48
- }
49
- }
50
- _updateContent(value) {
51
- if (!this._containerElement)
52
- return;
53
- this._containerElement.innerHTML = '';
54
- const items = Array.isArray(value) ? value : [value];
55
- items.forEach(item => {
56
- if (typeof item === 'string') {
57
- const tempDiv = document.createElement('div');
58
- tempDiv.innerHTML = item;
59
- while (tempDiv.firstChild) {
60
- this._containerElement.appendChild(tempDiv.firstChild);
61
- }
62
- }
63
- else if (item instanceof BaseComponent) {
64
- item.render(this._containerElement);
65
- }
66
- });
67
- }
68
- /* -------------------------
69
- * Fluent API
70
- * ------------------------- */
71
- // ✅ Inherited from BaseComponent:
72
- // - style(), class()
73
- // - bind(), sync(), renderTo()
74
- // - addClass(), removeClass(), toggleClass()
75
- // - visible(), show(), hide()
76
- // - attr(), attrs(), removeAttr()
77
- // - disabled(), enable(), disable()
78
- content(value) {
79
- this.state.content = value;
80
- return this;
81
- }
82
- direction(value) {
83
- this.state.direction = value;
84
- return this;
85
- }
86
- gap(value) {
87
- this.state.gap = value;
88
- return this;
89
- }
90
- align(value) {
91
- this.state.align = value;
92
- return this;
93
- }
94
- justify(value) {
95
- this.state.justify = value;
96
- return this;
97
- }
98
- /**
99
- * Add content to container (supports strings and BaseComponents)
100
- */
101
- addContent(content) {
102
- if (!this._containerElement) {
103
- console.warn('[Container] Container element not found');
104
- return this;
105
- }
106
- const items = Array.isArray(content) ? content : [content];
107
- items.forEach(item => {
108
- if (typeof item === 'string') {
109
- const tempDiv = document.createElement('div');
110
- tempDiv.innerHTML = item;
111
- while (tempDiv.firstChild) {
112
- this._containerElement.appendChild(tempDiv.firstChild);
113
- }
114
- }
115
- else if (item instanceof BaseComponent) {
116
- item.render(this._containerElement);
117
- }
118
- });
119
- return this;
120
- }
121
- /**
122
- * Clear all content from container
123
- */
124
- clearContent() {
125
- if (this._containerElement) {
126
- this._containerElement.innerHTML = '';
127
- }
128
- return this;
129
- }
130
- /**
131
- * Get the container element ID for rendering child components
132
- */
133
- contentId() {
134
- return `${this._id}-content`;
135
- }
136
- /* -------------------------
137
- * Render
138
- * ------------------------- */
139
- render(targetId) {
140
- const container = this._setupContainer(targetId);
141
- const { content, class: className, style, direction, gap, align, justify } = this.state;
142
- const div = document.createElement('div');
143
- div.id = this._id;
144
- this._containerElement = div;
145
- // Always include jux-container class, append custom classes
146
- div.className = className ? `jux-container ${className}` : 'jux-container';
147
- // Only apply flex styles if any flex properties are set
148
- const usesFlexbox = direction || gap !== undefined || align || justify;
149
- let computedStyle = style;
150
- if (usesFlexbox) {
151
- const flexStyles = ['display: flex', 'width: auto'];
152
- if (direction)
153
- flexStyles.push(`flex-direction: ${direction}`);
154
- if (gap !== undefined) {
155
- const gapValue = typeof gap === 'number' ? `${gap}px` : gap;
156
- flexStyles.push(`gap: ${gapValue}`);
157
- }
158
- // Only set align-items if explicitly specified
159
- if (align)
160
- flexStyles.push(`align-items: ${align}`);
161
- // Only set justify-content if explicitly specified
162
- if (justify)
163
- flexStyles.push(`justify-content: ${justify}`);
164
- computedStyle = `${flexStyles.join('; ')}; ${style}`.trim();
165
- }
166
- if (computedStyle) {
167
- div.setAttribute('style', computedStyle);
168
- }
169
- // Render initial content
170
- if (content) {
171
- const items = Array.isArray(content) ? content : [content];
172
- items.forEach(item => {
173
- if (typeof item === 'string') {
174
- const tempDiv = document.createElement('div');
175
- tempDiv.innerHTML = item;
176
- while (tempDiv.firstChild) {
177
- div.appendChild(tempDiv.firstChild);
178
- }
179
- }
180
- else if (item instanceof BaseComponent) {
181
- item.render(div);
182
- }
183
- });
184
- }
185
- this._wireStandardEvents(div);
186
- container.appendChild(div);
187
- return this;
188
- }
189
- }
190
- /**
191
- * Factory helper
192
- */
193
- export function container(id, options = {}) {
194
- return new Container(id, options);
195
- }