juxscript 1.1.4 → 1.1.6

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