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,29 +0,0 @@
1
- export interface ParsedLine {
2
- lineNumber: number;
3
- html: string;
4
- raw: string;
5
- }
6
- /**
7
- * Escape HTML entities
8
- */
9
- declare function escapeHtml(text: string): string;
10
- /**
11
- * Parse code into lines - CHARACTER-BY-CHARACTER TOKENIZATION
12
- */
13
- export declare function parseCode(code: string, language?: string): ParsedLine[];
14
- /**
15
- * Render a parsed line
16
- */
17
- export declare function renderLineWithTokens(parsedLine: ParsedLine): string;
18
- /**
19
- * Generate CSS for syntax highlighting
20
- */
21
- export declare function getSyntaxHighlightCSS(): string;
22
- declare const _default: {
23
- parse: typeof parseCode;
24
- renderLine: typeof renderLineWithTokens;
25
- getCSS: typeof getSyntaxHighlightCSS;
26
- escapeHtml: typeof escapeHtml;
27
- };
28
- export default _default;
29
- //# sourceMappingURL=codeparser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codeparser.d.ts","sourceRoot":"","sources":["codeparser.ts"],"names":[],"mappings":"AA2DA,MAAM,WAAW,UAAU;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOxC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAqB,GAAG,UAAU,EAAE,CAQrF;AAwOD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAkG9C;;;;;;;AAED,wBAKE"}
@@ -1,409 +0,0 @@
1
- /**
2
- * Simple keyword list
3
- */
4
- const KEYWORDS = new Set([
5
- 'async', 'await', 'break', 'case', 'catch', 'class', 'const', 'continue',
6
- 'debugger', 'default', 'delete', 'do', 'else', 'export', 'extends',
7
- 'finally', 'for', 'function', 'if', 'import', 'in', 'instanceof',
8
- 'let', 'new', 'return', 'super', 'switch', 'this', 'throw', 'try',
9
- 'typeof', 'var', 'void', 'while', 'with', 'yield', 'from', 'of',
10
- 'static', 'get', 'set', 'as', 'interface', 'type', 'enum', 'namespace',
11
- 'jux', 'state', 'registry', 'render', 'bind', 'sync', ';', '=', '==', '===',
12
- '!=', '!==', '+', '-', '*', '/', '%', '++', '--', '&&', '||', '!', '<', '>',
13
- '<=', '>=', '=>', '...', '.', ',', '(', ')', '{', '}', '[', ']', ':', '?'
14
- ]);
15
- /**
16
- * Categorized token sets for semantic highlighting
17
- */
18
- // Control flow keywords (loops, conditionals, etc.)
19
- const CONTROL_FLOW = new Set([
20
- 'if', 'else', 'switch', 'case', 'default',
21
- 'for', 'while', 'do', 'break', 'continue',
22
- 'return', 'throw', 'try', 'catch', 'finally'
23
- ]);
24
- // Declaration keywords
25
- const DECLARATIONS = new Set([
26
- 'const', 'let', 'var', 'function', 'class',
27
- 'import', 'export', 'from', 'as',
28
- 'interface', 'type', 'enum', 'namespace',
29
- 'static', 'get', 'set', 'extends'
30
- ]);
31
- // Operator keywords
32
- const OPERATORS = new Set([
33
- 'new', 'delete', 'typeof', 'instanceof',
34
- 'void', 'await', 'yield', 'in', 'of'
35
- ]);
36
- // Special keywords
37
- const SPECIAL = new Set([
38
- 'this', 'super', 'async', 'debugger', 'with'
39
- ]);
40
- // JUX-specific keywords
41
- const JUX_KEYWORDS = new Set([
42
- 'jux', 'state', 'registry', 'render', 'bind', 'sync'
43
- ]);
44
- // Combine all keywords for quick lookup
45
- const ALL_KEYWORDS = new Set([
46
- ...CONTROL_FLOW,
47
- ...DECLARATIONS,
48
- ...OPERATORS,
49
- ...SPECIAL,
50
- ...JUX_KEYWORDS
51
- ]);
52
- /**
53
- * Escape HTML entities
54
- */
55
- function escapeHtml(text) {
56
- return text
57
- .replace(/&/g, '&amp;')
58
- .replace(/</g, '&lt;')
59
- .replace(/>/g, '&gt;')
60
- .replace(/"/g, '&quot;')
61
- .replace(/'/g, '&#39;');
62
- }
63
- /**
64
- * Parse code into lines - CHARACTER-BY-CHARACTER TOKENIZATION
65
- */
66
- export function parseCode(code, language = 'javascript') {
67
- const lines = code.split('\n');
68
- return lines.map((line, index) => ({
69
- lineNumber: index + 1,
70
- html: tokenizeLine(line),
71
- raw: line
72
- }));
73
- }
74
- /**
75
- * Get the appropriate CSS class for a keyword
76
- */
77
- function getKeywordClass(word) {
78
- if (CONTROL_FLOW.has(word))
79
- return 'token-control';
80
- if (DECLARATIONS.has(word))
81
- return 'token-declaration';
82
- if (OPERATORS.has(word))
83
- return 'token-operator-keyword';
84
- if (SPECIAL.has(word))
85
- return 'token-special';
86
- if (JUX_KEYWORDS.has(word))
87
- return 'token-jux';
88
- return 'token-keyword'; // fallback
89
- }
90
- /**
91
- * Check if character is a structural punctuation (braces, brackets, parens)
92
- */
93
- function isStructural(char) {
94
- return '(){}[]'.includes(char);
95
- }
96
- /**
97
- * Check if character is a delimiter (semicolon, comma, colon)
98
- */
99
- function isDelimiter(char) {
100
- return ';,:'.includes(char);
101
- }
102
- /**
103
- * Check if character is an operator
104
- */
105
- function isOperator(char) {
106
- return '+-*/%=<>!&|^~?'.includes(char);
107
- }
108
- /**
109
- * Check if character starts a multi-char operator
110
- */
111
- function consumeOperator(line, i) {
112
- const char = line[i];
113
- const next = line[i + 1];
114
- const next2 = line[i + 2];
115
- // Three-char operators
116
- if (char === '=' && next === '=' && next2 === '=')
117
- return '===';
118
- if (char === '!' && next === '=' && next2 === '=')
119
- return '!==';
120
- if (char === '>' && next === '>' && next2 === '>')
121
- return '>>>';
122
- // Two-char operators
123
- if (char === '=' && next === '=')
124
- return '==';
125
- if (char === '!' && next === '=')
126
- return '!=';
127
- if (char === '<' && next === '=')
128
- return '<=';
129
- if (char === '>' && next === '=')
130
- return '>=';
131
- if (char === '&' && next === '&')
132
- return '&&';
133
- if (char === '|' && next === '|')
134
- return '||';
135
- if (char === '+' && next === '+')
136
- return '++';
137
- if (char === '-' && next === '-')
138
- return '--';
139
- if (char === '=' && next === '>')
140
- return '=>';
141
- if (char === '>' && next === '>')
142
- return '>>';
143
- if (char === '<' && next === '<')
144
- return '<<';
145
- if (char === '*' && next === '*')
146
- return '**';
147
- if (char === '.' && next === '.' && next2 === '.')
148
- return '...';
149
- // Single-char operator
150
- return char;
151
- }
152
- /**
153
- * Tokenize a single line character-by-character with semantic categories
154
- */
155
- function tokenizeLine(line) {
156
- if (!line.trim())
157
- return ' ';
158
- let result = '';
159
- let i = 0;
160
- const len = line.length;
161
- // Check for comment at start
162
- if (line.trim().startsWith('//')) {
163
- return `<span class="token-comment">${escapeHtml(line)}</span>`;
164
- }
165
- while (i < len) {
166
- const char = line[i];
167
- // Whitespace - preserve
168
- if (/\s/.test(char)) {
169
- result += char;
170
- i++;
171
- continue;
172
- }
173
- // Comment (// or /* */)
174
- if (char === '/' && i + 1 < len) {
175
- if (line[i + 1] === '/') {
176
- // Line comment - consume rest of line
177
- const comment = line.slice(i);
178
- result += `<span class="token-comment">${escapeHtml(comment)}</span>`;
179
- break;
180
- }
181
- else if (line[i + 1] === '*') {
182
- // Block comment start
183
- const commentEnd = line.indexOf('*/', i + 2);
184
- if (commentEnd !== -1) {
185
- const comment = line.slice(i, commentEnd + 2);
186
- result += `<span class="token-comment">${escapeHtml(comment)}</span>`;
187
- i = commentEnd + 2;
188
- continue;
189
- }
190
- }
191
- }
192
- // String literals (single, double, backtick)
193
- if (char === '"' || char === "'" || char === '`') {
194
- let j = i + 1;
195
- let escaped = false;
196
- // Find matching quote
197
- while (j < len) {
198
- if (escaped) {
199
- escaped = false;
200
- j++;
201
- continue;
202
- }
203
- if (line[j] === '\\') {
204
- escaped = true;
205
- j++;
206
- continue;
207
- }
208
- if (line[j] === char) {
209
- j++;
210
- break;
211
- }
212
- j++;
213
- }
214
- const str = line.slice(i, j);
215
- result += `<span class="token-string">${escapeHtml(str)}</span>`;
216
- i = j;
217
- continue;
218
- }
219
- // Word (identifier or keyword)
220
- if (/[a-zA-Z_$]/.test(char)) {
221
- const word = consumeWord(line, i);
222
- const escaped = escapeHtml(word);
223
- if (ALL_KEYWORDS.has(word)) {
224
- const tokenClass = getKeywordClass(word);
225
- result += `<span class="${tokenClass}">${escaped}</span>`;
226
- }
227
- else {
228
- result += escaped;
229
- }
230
- i += word.length;
231
- continue;
232
- }
233
- // Number
234
- if (/\d/.test(char)) {
235
- const num = consumeNumber(line, i);
236
- result += `<span class="token-number">${escapeHtml(num)}</span>`;
237
- i += num.length;
238
- continue;
239
- }
240
- // Operators (multi-char)
241
- if (isOperator(char)) {
242
- const op = consumeOperator(line, i);
243
- result += `<span class="token-operator">${escapeHtml(op)}</span>`;
244
- i += op.length;
245
- continue;
246
- }
247
- // Structural punctuation (braces, brackets, parens)
248
- if (isStructural(char)) {
249
- result += `<span class="token-structural">${escapeHtml(char)}</span>`;
250
- i++;
251
- continue;
252
- }
253
- // Delimiters (semicolon, comma, colon)
254
- if (isDelimiter(char)) {
255
- result += `<span class="token-delimiter">${escapeHtml(char)}</span>`;
256
- i++;
257
- continue;
258
- }
259
- // Everything else - just escape and append
260
- result += escapeHtml(char);
261
- i++;
262
- }
263
- return result || ' ';
264
- }
265
- /**
266
- * Consume a complete word (identifier)
267
- */
268
- function consumeWord(line, start) {
269
- let i = start;
270
- while (i < line.length && /[a-zA-Z0-9_$]/.test(line[i])) {
271
- i++;
272
- }
273
- return line.substring(start, i);
274
- }
275
- /**
276
- * Consume a complete number
277
- */
278
- function consumeNumber(line, start) {
279
- let i = start;
280
- let hasDot = false;
281
- while (i < line.length) {
282
- const char = line[i];
283
- if (/\d/.test(char)) {
284
- i++;
285
- }
286
- else if (char === '.' && !hasDot) {
287
- hasDot = true;
288
- i++;
289
- }
290
- else {
291
- break;
292
- }
293
- }
294
- return line.substring(start, i);
295
- }
296
- /**
297
- * Render a parsed line
298
- */
299
- export function renderLineWithTokens(parsedLine) {
300
- return parsedLine.html;
301
- }
302
- /**
303
- * Generate CSS for syntax highlighting
304
- */
305
- export function getSyntaxHighlightCSS() {
306
- return `
307
- /* Semantic Code Highlighting */
308
- .jux-code {
309
- font-family: 'Consolas', 'Monaco', monospace;
310
- font-size: 14px;
311
- line-height: 1.6;
312
- background: #1e1e1e;
313
- border-radius: 8px;
314
- overflow: hidden;
315
- margin: 1rem 0;
316
- padding: 1rem;
317
- overflow-x: auto;
318
- }
319
-
320
- .jux-code-lines {
321
- display: block;
322
- }
323
-
324
- .jux-code-line {
325
- display: flex;
326
- align-items: flex-start;
327
- min-height: 1.6em;
328
- }
329
-
330
- .jux-code-line:hover {
331
- background-color: rgba(255, 255, 255, 0.03);
332
- }
333
-
334
- .jux-code-line-highlight {
335
- background-color: rgba(255, 215, 0, 0.1);
336
- border-left: 3px solid #ffd700;
337
- padding-left: 0.5rem;
338
- }
339
-
340
- .jux-code-line-number {
341
- display: inline-block;
342
- min-width: 3rem;
343
- text-align: right;
344
- padding-right: 1rem;
345
- color: #858585;
346
- user-select: none;
347
- flex-shrink: 0;
348
- }
349
-
350
- .jux-code-line-content {
351
- flex: 1;
352
- color: #d4d4d4;
353
- white-space: pre;
354
- overflow-x: auto;
355
- }
356
-
357
- .jux-code-no-numbers .jux-code-line-number {
358
- display: none;
359
- }
360
-
361
- /* Token colors - Semantic categories */
362
- .token-control {
363
- color: #c678dd; /* Purple - control flow (if, for, return) */
364
- font-weight: 600;
365
- }
366
- .token-declaration {
367
- color: #61afef; /* Blue - declarations (const, let, function) */
368
- font-weight: 600;
369
- }
370
- .token-operator-keyword {
371
- color: #e06c75; /* Red - operator keywords (typeof, instanceof) */
372
- font-weight: 600;
373
- }
374
- .token-special {
375
- color: #e5c07b; /* Yellow - special keywords (this, super, async) */
376
- font-weight: 600;
377
- }
378
- .token-jux {
379
- color: #56b6c2; /* Cyan - JUX-specific (jux, state, render) */
380
- font-weight: 700;
381
- }
382
- .token-number {
383
- color: #d19a66; /* Orange - numbers */
384
- }
385
- .token-string {
386
- color: #98c379; /* Green - strings */
387
- }
388
- .token-comment {
389
- color: #5c6370; /* Gray - comments */
390
- font-style: italic;
391
- }
392
- .token-structural {
393
- color: #abb2bf; /* Light gray - braces, brackets, parens */
394
- font-weight: 600;
395
- }
396
- .token-delimiter {
397
- color: #777; /* Dark gray - semicolons, commas, colons */
398
- }
399
- .token-operator {
400
- color: #56b6c2; /* Cyan - operators (+, -, *, etc.) */
401
- }
402
- `;
403
- }
404
- export default {
405
- parse: parseCode,
406
- renderLine: renderLineWithTokens,
407
- getCSS: getSyntaxHighlightCSS,
408
- escapeHtml
409
- };
@@ -1,176 +0,0 @@
1
- /**
2
- * Jux Fetch Utility
3
- *
4
- * A lightweight fetch wrapper with sensible defaults, error handling, and method chaining.
5
- * Includes configuration helpers for juxconfig.js integration.
6
- *
7
- * Usage:
8
- * // Configure once (optional)
9
- * jux.fetch.config({
10
- * baseUrl: 'https://api.example.com',
11
- * credentials: 'include',
12
- * timeout: 10000,
13
- * log: 'errors',
14
- * onUnauthorized: () => window.location.href = '/login'
15
- * });
16
- *
17
- * // Simple GET
18
- * const { data, error } = await jux.fetch('/users').send();
19
- *
20
- * // Method chaining
21
- * const { data, error } = await jux.fetch('/users')
22
- * .method('POST')
23
- * .body({ name: 'John' })
24
- * .params({ limit: 10 })
25
- * .timeout(5000)
26
- * .log(true)
27
- * .send();
28
- *
29
- * // With juxconfig services
30
- * const { data } = await jux.fetch('/users')
31
- * .baseUrl(jux.fetch.getServiceUrl('database'))
32
- * .send();
33
- *
34
- * // Service client helper
35
- * const db = jux.fetch.serviceClient('database');
36
- * const { data } = await db.fetch('/users').send();
37
- */
38
- export type LogLevel = boolean | 'errors';
39
- export interface FetchConfig {
40
- baseUrl?: string;
41
- credentials?: RequestCredentials;
42
- headers?: Record<string, string>;
43
- timeout?: number;
44
- log?: LogLevel;
45
- onUnauthorized?: () => void;
46
- onError?: (error: FetchError) => void;
47
- }
48
- export interface FetchOptions extends Omit<RequestInit, 'body'> {
49
- params?: Record<string, any>;
50
- body?: any;
51
- timeout?: number;
52
- log?: LogLevel;
53
- onUnauthorized?: () => void;
54
- onError?: (error: FetchError) => void;
55
- parseResponse?: boolean;
56
- }
57
- export interface FetchError {
58
- message: string;
59
- status?: number;
60
- statusText?: string;
61
- data?: any;
62
- }
63
- export interface FetchResult<T = any> {
64
- data: T | null;
65
- error: FetchError | null;
66
- status: number;
67
- response: Response;
68
- }
69
- /**
70
- * Configure global fetch defaults
71
- */
72
- export declare function configureFetch(config: FetchConfig): void;
73
- /**
74
- * FetchBuilder class for method chaining
75
- */
76
- declare class FetchBuilder<T = any> {
77
- url: string;
78
- options: FetchOptions;
79
- constructor(url: string, options?: FetchOptions);
80
- method(value: string): this;
81
- body(value: any): this;
82
- params(value: Record<string, any>): this;
83
- headers(value: Record<string, string>): this;
84
- header(key: string, value: string): this;
85
- timeout(value: number): this;
86
- credentials(value: RequestCredentials): this;
87
- log(value: LogLevel): this;
88
- parseResponse(value: boolean): this;
89
- onUnauthorized(callback: () => void): this;
90
- onError(callback: (error: FetchError) => void): this;
91
- /**
92
- * Execute the fetch request
93
- */
94
- send(): Promise<FetchResult<T>>;
95
- /**
96
- * Alias for send()
97
- */
98
- fetch(): Promise<FetchResult<T>>;
99
- /**
100
- * Make the builder thenable (Promise-like) so it can be awaited directly
101
- * This allows: await jux.fetch('/users') without needing .send()
102
- */
103
- then<TResult1 = FetchResult<T>, TResult2 = never>(onfulfilled?: ((value: FetchResult<T>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
104
- /**
105
- * Make the builder catchable for Promise.catch()
106
- */
107
- catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<FetchResult<T> | TResult>;
108
- /**
109
- * Make the builder finally-able for Promise.finally()
110
- */
111
- finally(onfinally?: (() => void) | null): Promise<FetchResult<T>>;
112
- }
113
- /**
114
- * Create a fetch builder
115
- */
116
- export declare function juxFetch<T = any>(url: string, options?: FetchOptions): FetchBuilder<T>;
117
- /**
118
- * Convenience methods for common HTTP verbs
119
- */
120
- export declare const fetchHelpers: {
121
- get: <T = any>(url: string, options?: Omit<FetchOptions, "method">) => FetchBuilder<T>;
122
- post: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
123
- put: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
124
- patch: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
125
- delete: <T = any>(url: string, options?: Omit<FetchOptions, "method">) => FetchBuilder<T>;
126
- };
127
- /**
128
- * Fetch multiple URLs in parallel
129
- */
130
- export declare function fetchAll<T = any>(urls: string[], options?: FetchOptions): Promise<FetchResult<T>[]>;
131
- /**
132
- * Get a service URL from window.juxConfig
133
- */
134
- export declare function getServiceUrl(serviceName: string): string | null;
135
- /**
136
- * Create a fetch instance preconfigured for a specific service
137
- *
138
- * Usage:
139
- * const api = jux.fetch.serviceClient('database');
140
- * const { data } = await api.fetch('/users').send();
141
- */
142
- export declare function serviceClient(serviceName: string): {
143
- fetch: (url: string, options?: any) => FetchBuilder<any>;
144
- baseUrl: string | null;
145
- };
146
- /**
147
- * Setup fetch from juxconfig
148
- * Call this in your bootstrap function
149
- *
150
- * Usage:
151
- * export default {
152
- * bootstrap: [
153
- * async function initFetch() {
154
- * await jux.fetch.setupConfig();
155
- * }
156
- * ]
157
- * };
158
- */
159
- export declare function setupConfig(): Promise<{
160
- services: any;
161
- getServiceUrl: typeof getServiceUrl;
162
- } | undefined>;
163
- export declare const fetchAPI: typeof juxFetch & {
164
- all: typeof fetchAll;
165
- get: <T = any>(url: string, options?: Omit<FetchOptions, "method">) => FetchBuilder<T>;
166
- post: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
167
- put: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
168
- patch: <T = any>(url: string, body?: any, options?: Omit<FetchOptions, "method" | "body">) => FetchBuilder<T>;
169
- delete: <T = any>(url: string, options?: Omit<FetchOptions, "method">) => FetchBuilder<T>;
170
- config: typeof configureFetch;
171
- setupConfig: typeof setupConfig;
172
- getServiceUrl: typeof getServiceUrl;
173
- serviceClient: typeof serviceClient;
174
- };
175
- export {};
176
- //# sourceMappingURL=fetch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE1C,MAAM,WAAW,WAAW;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,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