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,464 @@
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
+ }
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Include - Include external resources (CSS, JS, images, fonts, etc.)
3
+ * Auto-detects resource type from URL and provides simple, fluent API
4
+ */
5
+ type IncludeLocation = 'head' | 'body-start' | 'body-end';
6
+ interface IncludeOptions {
7
+ as?: string;
8
+ crossOrigin?: 'anonymous' | 'use-credentials';
9
+ integrity?: string;
10
+ async?: boolean;
11
+ defer?: boolean;
12
+ location?: IncludeLocation;
13
+ }
14
+ export declare class Include {
15
+ private url;
16
+ private type;
17
+ private options;
18
+ private element;
19
+ private explicitType;
20
+ constructor(urlOrFile: string);
21
+ private detectType;
22
+ /**
23
+ * Force treat as CSS stylesheet
24
+ * Use when URL doesn't have .css extension
25
+ */
26
+ withCss(): this;
27
+ /**
28
+ * Force treat as JavaScript
29
+ * Use when URL doesn't have .js extension (CDN scripts, etc.)
30
+ *
31
+ * @example
32
+ * jux.include('https://cdn.tailwindcss.com').withJs().render();
33
+ * jux.include('https://unpkg.com/alpine').withJs({ defer: true }).render();
34
+ */
35
+ withJs(options?: {
36
+ async?: boolean;
37
+ defer?: boolean;
38
+ }): this;
39
+ /**
40
+ * Force treat as ES module
41
+ * Use for module scripts
42
+ */
43
+ withModule(): this;
44
+ withImage(): this;
45
+ withFont(): this;
46
+ withPreload(as?: string): this;
47
+ withPrefetch(): this;
48
+ withJson(): this;
49
+ /**
50
+ * Shorthand for .withJs()
51
+ * @example jux.include(url).asScript()
52
+ */
53
+ asScript(options?: {
54
+ async?: boolean;
55
+ defer?: boolean;
56
+ }): this;
57
+ /**
58
+ * Shorthand for .withCss()
59
+ * @example jux.include(url).asStylesheet()
60
+ */
61
+ asStylesheet(): this;
62
+ /**
63
+ * Fetch and parse JSON file
64
+ * Returns a Promise that resolves to the parsed JSON data
65
+ *
66
+ * Usage:
67
+ * const config = await jux.include('config.json').asJson();
68
+ * const data = await jux.include('/api/data').asJson();
69
+ */
70
+ asJson<T = any>(): Promise<T>;
71
+ /**
72
+ * Fetch JSON and execute callback with data
73
+ *
74
+ * Usage:
75
+ * jux.include('config.json').onJson(data => {
76
+ * console.log('Config:', data);
77
+ * });
78
+ */
79
+ onJson<T = any>(callback: (data: T) => void): this;
80
+ with(options: IncludeOptions): this;
81
+ inHead(): this;
82
+ inBody(): this;
83
+ async(): this;
84
+ defer(): this;
85
+ crossOrigin(value?: 'anonymous' | 'use-credentials'): this;
86
+ integrity(hash: string): this;
87
+ render(): this;
88
+ private createStylesheet;
89
+ private createScript;
90
+ private createLink;
91
+ private getContainer;
92
+ private handleError;
93
+ remove(): this;
94
+ }
95
+ /**
96
+ * Factory function - auto-detects type and renders immediately
97
+ *
98
+ * Usage:
99
+ * // Auto-detect (works for most cases)
100
+ * jux.include('styles.css');
101
+ * jux.include('script.js').async();
102
+ *
103
+ * // Explicit type (for extensionless URLs)
104
+ * jux.include('https://cdn.tailwindcss.com').withJs();
105
+ * jux.include('https://cdn.tailwindcss.com').asScript();
106
+ * jux.include('https://unpkg.com/htmx.org').withJs({ defer: true });
107
+ *
108
+ * // CDN with parameters
109
+ * jux.include('https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4').withJs();
110
+ *
111
+ * // Module
112
+ * jux.include('app.mjs').withModule();
113
+ *
114
+ * // For JSON:
115
+ * const data = await jux.include('config.json').asJson();
116
+ * jux.include('data.json').onJson(data => console.log(data));
117
+ */
118
+ export declare function include(urlOrFile: string): Include;
119
+ export {};
120
+ //# sourceMappingURL=include.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"include.d.ts","sourceRoot":"","sources":["include.ts"],"names":[],"mappings":"AACA;;;GAGG;AAGH,KAAK,eAAe,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,CAAC;AAE1D,UAAU,cAAc;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,qBAAa,OAAO;IAClB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,YAAY,CAAkB;gBAE1B,SAAS,EAAE,MAAM;IAS7B,OAAO,CAAC,UAAU;IA2BlB;;;OAGG;IACH,OAAO,IAAI,IAAI;IAMf;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAQ5D;;;OAGG;IACH,UAAU,IAAI,IAAI;IAMlB,SAAS,IAAI,IAAI;IAMjB,QAAQ,IAAI,IAAI;IAMhB,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAO9B,YAAY,IAAI,IAAI;IAMpB,QAAQ,IAAI,IAAI;IAUhB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAI9D;;;OAGG;IACH,YAAY,IAAI,IAAI;IAQpB;;;;;;;OAOG;IACG,MAAM,CAAC,CAAC,GAAG,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC;IAgBnC;;;;;;;OAOG;IACH,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,IAAI;IAWlD,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAKnC,MAAM,IAAI,IAAI;IAKd,MAAM,IAAI,IAAI;IAKd,KAAK,IAAI,IAAI;IAKb,KAAK,IAAI,IAAI;IAKb,WAAW,CAAC,KAAK,GAAE,WAAW,GAAG,iBAA+B,GAAG,IAAI;IAKvE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAS7B,MAAM,IAAI,IAAI;IAyDd,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,UAAU;IAoClB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,WAAW;IAMnB,MAAM,IAAI,IAAI;CAOf;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CASlD"}