juxscript 1.1.3 → 1.1.5

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 (63) hide show
  1. package/machinery/build3.js +7 -91
  2. package/machinery/compiler3.js +3 -131
  3. package/package.json +19 -5
  4. package/lib/components/alert.ts +0 -200
  5. package/lib/components/app.ts +0 -247
  6. package/lib/components/badge.ts +0 -101
  7. package/lib/components/base/BaseComponent.ts +0 -421
  8. package/lib/components/base/FormInput.ts +0 -227
  9. package/lib/components/button.ts +0 -178
  10. package/lib/components/card.ts +0 -173
  11. package/lib/components/chart.ts +0 -231
  12. package/lib/components/checkbox.ts +0 -242
  13. package/lib/components/code.ts +0 -123
  14. package/lib/components/container.ts +0 -140
  15. package/lib/components/data.ts +0 -135
  16. package/lib/components/datepicker.ts +0 -234
  17. package/lib/components/dialog.ts +0 -172
  18. package/lib/components/divider.ts +0 -100
  19. package/lib/components/dropdown.ts +0 -186
  20. package/lib/components/element.ts +0 -267
  21. package/lib/components/fileupload.ts +0 -309
  22. package/lib/components/grid.ts +0 -291
  23. package/lib/components/guard.ts +0 -92
  24. package/lib/components/heading.ts +0 -96
  25. package/lib/components/helpers.ts +0 -41
  26. package/lib/components/hero.ts +0 -224
  27. package/lib/components/icon.ts +0 -178
  28. package/lib/components/icons.ts +0 -464
  29. package/lib/components/include.ts +0 -410
  30. package/lib/components/input.ts +0 -457
  31. package/lib/components/list.ts +0 -419
  32. package/lib/components/loading.ts +0 -100
  33. package/lib/components/menu.ts +0 -275
  34. package/lib/components/modal.ts +0 -284
  35. package/lib/components/nav.ts +0 -257
  36. package/lib/components/paragraph.ts +0 -97
  37. package/lib/components/progress.ts +0 -159
  38. package/lib/components/radio.ts +0 -278
  39. package/lib/components/req.ts +0 -303
  40. package/lib/components/script.ts +0 -41
  41. package/lib/components/select.ts +0 -252
  42. package/lib/components/sidebar.ts +0 -275
  43. package/lib/components/style.ts +0 -41
  44. package/lib/components/switch.ts +0 -246
  45. package/lib/components/table.ts +0 -1249
  46. package/lib/components/tabs.ts +0 -250
  47. package/lib/components/theme-toggle.ts +0 -293
  48. package/lib/components/tooltip.ts +0 -144
  49. package/lib/components/view.ts +0 -190
  50. package/lib/components/write.ts +0 -272
  51. package/lib/layouts/default.css +0 -260
  52. package/lib/layouts/figma.css +0 -334
  53. package/lib/reactivity/state.ts +0 -78
  54. package/lib/utils/fetch.ts +0 -553
  55. package/machinery/ast.js +0 -347
  56. package/machinery/build.js +0 -466
  57. package/machinery/bundleAssets.js +0 -0
  58. package/machinery/bundleJux.js +0 -0
  59. package/machinery/bundleVendors.js +0 -0
  60. package/machinery/doc-generator.js +0 -136
  61. package/machinery/imports.js +0 -155
  62. package/machinery/ts-shim.js +0 -46
  63. package/machinery/validators/file-validator.js +0 -123
@@ -1,464 +0,0 @@
1
- /**
2
- * Icon utilities for components
3
- * All icons are rendered through Iconify with configurable collections (lucide, heroicons, streamline, etc.)
4
- */
5
-
6
- // Lucide emoji mappings
7
- const EMOJI_TO_LUCIDE: Record<string, string> = {
8
- "✔️": "check-circle",
9
- "✓": "check",
10
- "❌": "x-circle",
11
- "✗": "x",
12
- "🔥": "flame",
13
- "🚀": "rocket",
14
- "⚙️": "settings",
15
- "🏠": "home",
16
- "👤": "user",
17
- "💡": "lightbulb",
18
- "🌈": "rainbow",
19
- "🧪": "flask-conical",
20
- "✉️": "mail",
21
- "📞": "phone",
22
- "🔍": "search",
23
- "❤️": "heart",
24
- "⭐": "star",
25
- "⚠️": "alert-triangle",
26
- "ℹ️": "info",
27
- "❓": "help-circle",
28
- "👁️": "eye",
29
- "👁️‍🗨️": "eye-off",
30
- "☰": "menu",
31
- "🕐": "clock",
32
- "📅": "calendar",
33
- "⬇️": "chevron-down",
34
- "⬆️": "chevron-up",
35
- "⬅️": "chevron-left",
36
- "➡️": "chevron-right",
37
- "📈": "chart-column-increasing",
38
- "📉": "chart-column-decreasing",
39
- "⬇": "download",
40
- "📤": "upload",
41
- "📄": "file-text",
42
- "🗑️": "trash-2",
43
- "✏️": "edit",
44
- "📋": "clipboard",
45
- "🔗": "link",
46
- "↗️": "external-link",
47
- "☀️": "sun",
48
- "🌙": "moon",
49
- "📊": "bar-chart-3",
50
- "🖥️": "layout-dashboard",
51
- "📁": "folder",
52
- "💰": "coins",
53
- "📧": "mail",
54
- "✅": "square-check",
55
- "🗓️": "calendar-days",
56
- "💬": "message-circle",
57
- "🌐": "globe",
58
- "🔬": "microscope",
59
- "💊": "pill",
60
- "🔒": "lock",
61
- "⚖️": "scale",
62
- "🔌": "plug",
63
- "🔐": "lock-keyhole",
64
- "🏥": "cross",
65
- "👥": "users",
66
- "💚": "heart",
67
- "💸": "banknote",
68
- "🧾": "receipt",
69
- "➕": "plus",
70
- "➖": "minus",
71
- "💾": "save",
72
- "🩺": "stethoscope",
73
- "📦": "package",
74
- "👋": "log-out",
75
- "📎": "paperclip",
76
- };
77
-
78
- // Heroicons emoji mappings
79
- const EMOJI_TO_HEROICONS: Record<string, string> = {
80
- "✔️": "check-circle",
81
- "✓": "check",
82
- "❌": "x-circle",
83
- "✗": "x-mark",
84
- "🔥": "fire",
85
- "🚀": "rocket-launch",
86
- "⚙️": "cog-6-tooth",
87
- "🏠": "home",
88
- "👤": "user",
89
- "💡": "light-bulb",
90
- "🌈": "sparkles",
91
- "🧪": "beaker",
92
- "✉️": "envelope",
93
- "📞": "phone",
94
- "🔍": "magnifying-glass",
95
- "❤️": "heart",
96
- "⭐": "star",
97
- "⚠️": "exclamation-triangle",
98
- "ℹ️": "information-circle",
99
- "❓": "question-mark-circle",
100
- "👁️": "eye",
101
- "👁️‍🗨️": "eye-slash",
102
- "☰": "bars-3",
103
- "🕐": "clock",
104
- "📅": "calendar",
105
- "⬇️": "chevron-down",
106
- "⬆️": "chevron-up",
107
- "⬅️": "chevron-left",
108
- "➡️": "chevron-right",
109
- "📈": "chart-bar",
110
- "📉": "chart-bar",
111
- "⬇": "arrow-down-tray",
112
- "📤": "arrow-up-tray",
113
- "📄": "document-text",
114
- "🗑️": "trash",
115
- "✏️": "pencil",
116
- "📋": "clipboard",
117
- "🔗": "link",
118
- "↗️": "arrow-top-right-on-square",
119
- "☀️": "sun",
120
- "🌙": "moon",
121
- "📊": "chart-bar",
122
- "🖥️": "computer-desktop",
123
- "📁": "folder",
124
- "💰": "currency-dollar",
125
- "📧": "envelope",
126
- "✅": "check-badge",
127
- "🗓️": "calendar-days",
128
- "💬": "chat-bubble-left",
129
- "🌐": "globe-alt",
130
- "🔬": "beaker",
131
- "💊": "beaker",
132
- "🔒": "lock-closed",
133
- "⚖️": "scale",
134
- "🔌": "bolt",
135
- "🔐": "lock-closed",
136
- "🏥": "plus",
137
- "👥": "user-group",
138
- "💚": "heart",
139
- "💸": "banknote",
140
- "🧾": "document-text",
141
- "➕": "plus",
142
- "➖": "minus",
143
- "💾": "archive-box",
144
- "🩺": "heart",
145
- "📦": "archive-box",
146
- "👋": "arrow-right-on-rectangle",
147
- "📎": "paper-clip",
148
- };
149
-
150
- // Material Symbols emoji mappings
151
- const EMOJI_TO_MATERIAL_SYMBOLS: Record<string, string> = {
152
- "✔️": "check-circle",
153
- "✓": "check",
154
- "❌": "cancel",
155
- "✗": "close",
156
- "🔥": "local-fire-department",
157
- "🚀": "rocket-launch",
158
- "⚙️": "settings",
159
- "🏠": "home",
160
- "👤": "person",
161
- "💡": "lightbulb",
162
- "🌈": "looks",
163
- "🧪": "science",
164
- "✉️": "mail",
165
- "📞": "call",
166
- "🔍": "search",
167
- "❤️": "favorite",
168
- "⭐": "star",
169
- "⚠️": "warning",
170
- "ℹ️": "info",
171
- "❓": "help",
172
- "👁️": "visibility",
173
- "👁️‍🗨️": "visibility-off",
174
- "☰": "menu",
175
- "🕐": "schedule",
176
- "📅": "calendar-today",
177
- "⬇️": "arrow-downward",
178
- "⬆️": "arrow-upward",
179
- "⬅️": "arrow-back",
180
- "➡️": "arrow-forward",
181
- "📈": "trending-up",
182
- "📉": "trending-down",
183
- "⬇": "download",
184
- "📤": "upload",
185
- "📄": "description",
186
- "🗑️": "delete",
187
- "✏️": "edit",
188
- "📋": "content-paste",
189
- "🔗": "link",
190
- "↗️": "open-in-new",
191
- "☀️": "sunny",
192
- "🌙": "dark-mode",
193
- "📊": "bar-chart",
194
- "🖥️": "dashboard",
195
- "📁": "folder",
196
- "💰": "savings",
197
- "📧": "mail",
198
- "✅": "check-box",
199
- "🗓️": "calendar-month",
200
- "💬": "chat",
201
- "🌐": "public",
202
- "🔬": "biotech",
203
- "💊": "pill",
204
- "🔒": "lock",
205
- "⚖️": "balance",
206
- "🔌": "power",
207
- "🔐": "lock-open",
208
- "🏥": "medical-services",
209
- "👥": "group",
210
- "💚": "favorite",
211
- "💸": "payments",
212
- "🧾": "receipt",
213
- "➕": "add",
214
- "➖": "remove",
215
- "💾": "save",
216
- "🩺": "medical-information",
217
- "📦": "package",
218
- "👋": "logout",
219
- "📎": "attach-file",
220
- };
221
-
222
- // IconPark (icon-park)
223
- const EMOJI_TO_ICONPARK: Record<string, string> = {
224
- "✔️": "check-one",
225
- "✓": "check",
226
- "❌": "close-one",
227
- "✗": "close",
228
- "🔥": "fire",
229
- "🚀": "rocket-one",
230
- "⚙️": "setting-config",
231
- "🏠": "home",
232
- "👤": "user",
233
- "💡": "stack-light",
234
- "🌈": "color-filter",
235
- "🧪": "test-tube",
236
- "✉️": "mail",
237
- "📞": "phone-call",
238
- "🔍": "search",
239
- "❤️": "heart-ballon",
240
- "⭐": "star",
241
- "⚠️": "caution",
242
- "ℹ️": "info",
243
- "❓": "help",
244
- "👁️": "eyes",
245
- "👁️‍🗨️": "visibility-off",
246
- "☰": "application-menu",
247
- "🕐": "schedule",
248
- "📅": "calendar",
249
- "⬇️": "arrow-circle-down",
250
- "⬆️": "arrow-circle-up",
251
- "⬅️": "arrow-circle-left",
252
- "➡️": "arrow-circle-right",
253
- "📈": "trending-up",
254
- "📉": "trending-down",
255
- "⬇": "download-one",
256
- "📤": "upload-one",
257
- "📄": "doc-detail",
258
- "🗑️": "delete-five",
259
- "✏️": "edit-two",
260
- "📋": "clipboard",
261
- "🔗": "link-one",
262
- "↗️": "circle-right-up",
263
- "☀️": "sunrise",
264
- "🌙": "death-star",
265
- "📊": "chart-line-area",
266
- "🖥️": "carousel",
267
- "📁": "folder-open",
268
- "💰": "dollar",
269
- "📧": "mail",
270
- "✅": "check-correct",
271
- "🗓️": "calendar-dot",
272
- "💬": "message",
273
- "🌐": "world",
274
- "🔬": "microscope",
275
- "💊": "pills",
276
- "🔒": "lock",
277
- "⚖️": "balance-two",
278
- "🔌": "power",
279
- "🔐": "unlock",
280
- "🏥": "hospital",
281
- "👥": "every-user",
282
- "💚": "favorite",
283
- "💸": "payments",
284
- "🧾": "receipt",
285
- "➕": "add-one",
286
- "➖": "reduce-one",
287
- "💾": "save-one",
288
- "🩺": "stethoscope",
289
- "📦": "box",
290
- "👋": "logout",
291
- "📎": "link",
292
- };
293
-
294
- const ICONIFY_CDN_URL = "https://code.iconify.design/3/3.1.1/iconify.min.js";
295
- const DEFAULT_ICON_COLLECTION = 'lucide';
296
-
297
- /**
298
- * Render an icon from emoji, icon name, or image path
299
- * @param value - Emoji (🚀), icon name (rocket), or image path (/icon.png)
300
- * @param collection - Optional icon collection override (lucide, mdi, tabler, etc.)
301
- * @returns HTMLElement containing the icon
302
- *
303
- * Usage:
304
- * const icon = renderIcon('🚀'); // Default collection icon
305
- * const icon = renderIcon('📎', 'mdi'); // MDI collection
306
- * const icon = renderIcon('lucide:rocket'); // Explicit lucide collection
307
- * const icon = renderIcon('mdi:home'); // Explicit mdi collection
308
- * const icon = renderIcon('/icon.png'); // Image element
309
- */
310
- export function renderIcon(value: string, collection?: string): HTMLElement {
311
- // Check if it's an image path (contains / or . or starts with http)
312
- if (value.includes('/') || value.includes('.') || value.startsWith('http')) {
313
- return createImageIcon(value);
314
- }
315
-
316
- // Check for explicit collection prefix (e.g., lucide:rocket, mdi:home)
317
- if (value.includes(':')) {
318
- const [prefix, ...rest] = value.split(':');
319
- const iconName = rest.join(':');
320
-
321
- // Use the prefix as the collection
322
- const element = createIconifyIcon(`${prefix}:${iconName}`);
323
- ensureIconifyLoaded();
324
- return element;
325
- }
326
-
327
- const resolvedCollection = normalizeCollection(collection);
328
-
329
- // Check if it's an emoji that maps to an icon key
330
- const iconKey = getIconKeyForEmoji(value, resolvedCollection);
331
- if (iconKey) {
332
- const element = createIconifyIcon(`${resolvedCollection}:${iconKey}`);
333
- ensureIconifyLoaded();
334
- return element;
335
- }
336
-
337
- // Check if it's a direct icon name (lowercase with hyphens)
338
- if (/^[a-z][a-z0-9-]*$/.test(value)) {
339
- const element = createIconifyIcon(`${resolvedCollection}:${value}`);
340
- ensureIconifyLoaded();
341
- return element;
342
- }
343
-
344
- // Fallback: render as emoji
345
- return createEmojiFallback(value);
346
- }
347
-
348
- /**
349
- * Render raw emoji without conversion
350
- * @param emoji - The emoji character
351
- * @returns HTMLElement containing just the emoji
352
- */
353
- export function renderEmoji(emoji: string): HTMLElement {
354
- return createEmojiFallback(emoji);
355
- }
356
-
357
- /**
358
- * Render a library-backed icon by name
359
- */
360
- function renderLibraryIcon(iconName: string, collection: string): HTMLElement {
361
- const element = createIconifyIcon(`${collection}:${iconName}`);
362
- ensureIconifyLoaded();
363
- return element;
364
- }
365
-
366
- /**
367
- * Resolve global/default icon collection
368
- */
369
- function normalizeCollection(collection?: string): string {
370
- if (collection && typeof collection === 'string' && collection.trim()) {
371
- return collection.trim().toLowerCase();
372
- }
373
-
374
- const globalCollection = (globalThis as any).JUX_ICON_LIBRARY;
375
- if (typeof globalCollection === 'string' && globalCollection.trim()) {
376
- return globalCollection.trim().toLowerCase();
377
- }
378
-
379
- return DEFAULT_ICON_COLLECTION;
380
- }
381
-
382
- /**
383
- * Get the icon key for an emoji based on the collection
384
- */
385
- function getIconKeyForEmoji(emoji: string, collection: string): string | null {
386
- // Normalize collection name for the switch statement
387
- const baseCollection = collection.toLowerCase();
388
-
389
- // Look up in the appropriate mapping
390
- switch (baseCollection) {
391
- case 'lucide':
392
- return EMOJI_TO_LUCIDE[emoji] || null;
393
- case 'heroicons':
394
- return EMOJI_TO_HEROICONS[emoji] || null;
395
- case 'material':
396
- case 'material-symbols':
397
- return EMOJI_TO_MATERIAL_SYMBOLS[emoji] || null;
398
- case 'icon-park':
399
- return EMOJI_TO_ICONPARK[emoji] || null;
400
- default:
401
- // Default to lucide for unknown collections
402
- return EMOJI_TO_LUCIDE[emoji] || null;
403
- }
404
- }
405
-
406
- /**
407
- * Ensures Iconify is loaded and icons are rendered
408
- */
409
- function ensureIconifyLoaded(): void {
410
- if ((window as any).Iconify) {
411
- // Already loaded, render immediately
412
- (window as any).Iconify.scan();
413
- return;
414
- }
415
-
416
- if (!document.querySelector(`script[src="${ICONIFY_CDN_URL}"]`)) {
417
- const script = document.createElement('script');
418
- script.src = ICONIFY_CDN_URL;
419
- script.onload = () => {
420
- if ((window as any).Iconify) {
421
- (window as any).Iconify.scan();
422
- }
423
- };
424
- document.head.appendChild(script);
425
- }
426
- }
427
-
428
- /**
429
- * Create image icon element
430
- */
431
- function createImageIcon(src: string): HTMLImageElement {
432
- const img = document.createElement('img');
433
- img.src = src;
434
- img.style.width = '24px';
435
- img.style.height = '24px';
436
- img.style.display = 'inline-block';
437
- img.style.objectFit = 'contain';
438
- return img;
439
- }
440
-
441
- /**
442
- * Create Iconify icon element
443
- */
444
- function createIconifyIcon(icon: string): HTMLElement {
445
- const iconEl = document.createElement('span');
446
- iconEl.className = 'iconify';
447
- iconEl.setAttribute('data-icon', icon);
448
- iconEl.setAttribute('data-mode', 'svg');
449
- iconEl.setAttribute('data-inline', 'false');
450
- iconEl.style.width = '24px';
451
- iconEl.style.height = '24px';
452
- iconEl.style.display = 'inline-block';
453
- return iconEl;
454
- }
455
-
456
- /**
457
- * Render native emoji or text
458
- */
459
- function createEmojiFallback(emoji: string): HTMLSpanElement {
460
- const span = document.createElement('span');
461
- span.textContent = emoji;
462
- span.style.display = 'inline-block';
463
- return span;
464
- }