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,410 @@
1
+
2
+ /**
3
+ * Include - Include external resources (CSS, JS, images, fonts, etc.)
4
+ * Auto-detects resource type from URL and provides simple, fluent API
5
+ */
6
+
7
+ type IncludeType = 'stylesheet' | 'script' | 'image' | 'font' | 'preload' | 'prefetch' | 'module' | 'json';
8
+ type IncludeLocation = 'head' | 'body-start' | 'body-end';
9
+
10
+ interface IncludeOptions {
11
+ as?: string;
12
+ crossOrigin?: 'anonymous' | 'use-credentials';
13
+ integrity?: string;
14
+ async?: boolean;
15
+ defer?: boolean;
16
+ location?: IncludeLocation;
17
+ }
18
+
19
+ export class Include {
20
+ private url: string;
21
+ private type: IncludeType;
22
+ private options: IncludeOptions = {};
23
+ private element: HTMLElement | null = null;
24
+ private explicitType: boolean = false; // NEW: Track if type was explicitly set
25
+
26
+ constructor(urlOrFile: string) {
27
+ this.url = urlOrFile;
28
+ this.type = this.detectType(urlOrFile);
29
+ }
30
+
31
+ /* -------------------------
32
+ * Type Detection
33
+ * ------------------------- */
34
+
35
+ private detectType(url: string): IncludeType {
36
+ // Check for common script patterns in URLs (CDN, etc.)
37
+ if (url.includes('tailwindcss') ||
38
+ url.includes('jsdelivr.net/npm') ||
39
+ url.includes('unpkg.com') ||
40
+ url.includes('cdn.') ||
41
+ url.match(/\.(js|mjs)($|\?)/)) {
42
+ return 'script';
43
+ }
44
+
45
+ if (url.endsWith('.css')) return 'stylesheet';
46
+ if (url.endsWith('.json')) return 'json';
47
+ if (url.match(/\.(png|jpg|jpeg|gif|svg|webp)$/i)) return 'image';
48
+ if (url.match(/\.(woff|woff2|ttf|otf|eot)$/i)) return 'font';
49
+
50
+ // Default to script for extensionless URLs from CDN domains
51
+ if (!url.includes('.') || url.match(/^https?:\/\/cdn/)) {
52
+ return 'script';
53
+ }
54
+
55
+ return 'preload';
56
+ }
57
+
58
+ /* -------------------------
59
+ * Fluent Type Setters
60
+ * ------------------------- */
61
+
62
+ /**
63
+ * Force treat as CSS stylesheet
64
+ * Use when URL doesn't have .css extension
65
+ */
66
+ withCss(): this {
67
+ this.type = 'stylesheet';
68
+ this.explicitType = true; // Mark as explicit
69
+ return this;
70
+ }
71
+
72
+ /**
73
+ * Force treat as JavaScript
74
+ * Use when URL doesn't have .js extension (CDN scripts, etc.)
75
+ *
76
+ * @example
77
+ * jux.include('https://cdn.tailwindcss.com').withJs().render();
78
+ * jux.include('https://unpkg.com/alpine').withJs({ defer: true }).render();
79
+ */
80
+ withJs(options?: { async?: boolean; defer?: boolean }): this {
81
+ this.type = 'script';
82
+ this.explicitType = true; // Mark as explicit
83
+ if (options?.async) this.options.async = true;
84
+ if (options?.defer) this.options.defer = true;
85
+ return this;
86
+ }
87
+
88
+ /**
89
+ * Force treat as ES module
90
+ * Use for module scripts
91
+ */
92
+ withModule(): this {
93
+ this.type = 'module';
94
+ this.explicitType = true; // Mark as explicit
95
+ return this;
96
+ }
97
+
98
+ withImage(): this {
99
+ this.type = 'image';
100
+ this.explicitType = true;
101
+ return this;
102
+ }
103
+
104
+ withFont(): this {
105
+ this.type = 'font';
106
+ this.explicitType = true;
107
+ return this;
108
+ }
109
+
110
+ withPreload(as?: string): this {
111
+ this.type = 'preload';
112
+ this.explicitType = true;
113
+ if (as) this.options.as = as;
114
+ return this;
115
+ }
116
+
117
+ withPrefetch(): this {
118
+ this.type = 'prefetch';
119
+ this.explicitType = true;
120
+ return this;
121
+ }
122
+
123
+ withJson(): this {
124
+ this.type = 'json';
125
+ this.explicitType = true;
126
+ return this;
127
+ }
128
+
129
+ /* -------------------------
130
+ * Convenience aliases for common patterns
131
+ * ------------------------- */
132
+
133
+ /**
134
+ * Shorthand for .withJs()
135
+ * @example jux.include(url).asScript()
136
+ */
137
+ asScript(options?: { async?: boolean; defer?: boolean }): this {
138
+ return this.withJs(options);
139
+ }
140
+
141
+ /**
142
+ * Shorthand for .withCss()
143
+ * @example jux.include(url).asStylesheet()
144
+ */
145
+ asStylesheet(): this {
146
+ return this.withCss();
147
+ }
148
+
149
+ /* -------------------------
150
+ * JSON Fetching
151
+ * ------------------------- */
152
+
153
+ /**
154
+ * Fetch and parse JSON file
155
+ * Returns a Promise that resolves to the parsed JSON data
156
+ *
157
+ * Usage:
158
+ * const config = await jux.include('config.json').asJson();
159
+ * const data = await jux.include('/api/data').asJson();
160
+ */
161
+ async asJson<T = any>(): Promise<T> {
162
+ try {
163
+ const response = await fetch(this.url);
164
+
165
+ if (!response.ok) {
166
+ throw new Error(`HTTP error! status: ${response.status}`);
167
+ }
168
+
169
+ const data = await response.json();
170
+ console.log(`✓ JSON loaded: ${this.url}`);
171
+ return data;
172
+ } catch (error: any) {
173
+ throw error;
174
+ }
175
+ }
176
+
177
+ /**
178
+ * Fetch JSON and execute callback with data
179
+ *
180
+ * Usage:
181
+ * jux.include('config.json').onJson(data => {
182
+ * console.log('Config:', data);
183
+ * });
184
+ */
185
+ onJson<T = any>(callback: (data: T) => void): this {
186
+ this.asJson<T>().then(callback).catch(error => {
187
+ console.error('Failed to load JSON:', error);
188
+ });
189
+ return this;
190
+ }
191
+
192
+ /* -------------------------
193
+ * Options
194
+ * ------------------------- */
195
+
196
+ with(options: IncludeOptions): this {
197
+ this.options = { ...this.options, ...options };
198
+ return this;
199
+ }
200
+
201
+ inHead(): this {
202
+ this.options.location = 'head';
203
+ return this;
204
+ }
205
+
206
+ inBody(): this {
207
+ this.options.location = 'body-end';
208
+ return this;
209
+ }
210
+
211
+ async(): this {
212
+ this.options.async = true;
213
+ return this;
214
+ }
215
+
216
+ defer(): this {
217
+ this.options.defer = true;
218
+ return this;
219
+ }
220
+
221
+ crossOrigin(value: 'anonymous' | 'use-credentials' = 'anonymous'): this {
222
+ this.options.crossOrigin = value;
223
+ return this;
224
+ }
225
+
226
+ integrity(hash: string): this {
227
+ this.options.integrity = hash;
228
+ return this;
229
+ }
230
+
231
+ /* -------------------------
232
+ * Render
233
+ * ------------------------- */
234
+
235
+ render(): this {
236
+ if (typeof document === 'undefined') return this;
237
+
238
+ // Don't render JSON type (it's fetched via asJson() instead)
239
+ if (this.type === 'json') {
240
+ console.warn('Include: JSON files should be loaded with .asJson() instead of .render()');
241
+ return this;
242
+ }
243
+
244
+ try {
245
+ this.remove();
246
+
247
+ let element: HTMLElement;
248
+
249
+ switch (this.type) {
250
+ case 'stylesheet':
251
+ element = this.createStylesheet();
252
+ break;
253
+ case 'script':
254
+ case 'module':
255
+ element = this.createScript();
256
+ break;
257
+ case 'image':
258
+ case 'font':
259
+ case 'preload':
260
+ case 'prefetch':
261
+ element = this.createLink();
262
+ break;
263
+ default:
264
+ throw new Error(`Unknown include type: ${this.type}`);
265
+ }
266
+
267
+ const container = this.getContainer();
268
+ const location = this.options.location || 'head';
269
+
270
+ if (location === 'body-end') {
271
+ container.appendChild(element);
272
+ } else {
273
+ container.insertBefore(element, container.firstChild);
274
+ }
275
+
276
+ this.element = element;
277
+
278
+ // Log with type indicator
279
+ const typeIndicator = this.explicitType ? '(explicit)' : '(auto-detected)';
280
+ console.log(`✓ Include loaded as ${this.type} ${typeIndicator}: ${this.url}`);
281
+ } catch (error: any) {
282
+ throw error;
283
+ }
284
+
285
+ return this;
286
+ }
287
+
288
+ /* -------------------------
289
+ * Element Creation
290
+ * ------------------------- */
291
+
292
+ private createStylesheet(): HTMLLinkElement {
293
+ const link = document.createElement('link');
294
+ link.rel = 'stylesheet';
295
+ link.href = this.url;
296
+
297
+ if (this.options.crossOrigin) link.crossOrigin = this.options.crossOrigin;
298
+ if (this.options.integrity) link.integrity = this.options.integrity;
299
+
300
+ link.onload = () => console.log(`✓ Stylesheet loaded: ${this.url}`);
301
+ link.onerror = () => this.handleError('stylesheet');
302
+
303
+ return link;
304
+ }
305
+
306
+ private createScript(): HTMLScriptElement {
307
+ const script = document.createElement('script');
308
+ script.src = this.url;
309
+
310
+ if (this.type === 'module') script.type = 'module';
311
+ if (this.options.async) script.async = true;
312
+ if (this.options.defer) script.defer = true;
313
+ if (this.options.crossOrigin) script.crossOrigin = this.options.crossOrigin;
314
+ if (this.options.integrity) script.integrity = this.options.integrity;
315
+
316
+ script.onload = () => console.log(`✓ Script loaded: ${this.url}`);
317
+ script.onerror = () => this.handleError('script');
318
+
319
+ return script;
320
+ }
321
+
322
+ private createLink(): HTMLLinkElement {
323
+ const link = document.createElement('link');
324
+
325
+ // Set rel based on type
326
+ if (this.type === 'prefetch') {
327
+ link.rel = 'prefetch';
328
+ } else {
329
+ link.rel = 'preload';
330
+ }
331
+
332
+ link.href = this.url;
333
+
334
+ // Set 'as' attribute
335
+ if (this.type === 'image') {
336
+ link.as = 'image';
337
+ } else if (this.type === 'font') {
338
+ link.as = 'font';
339
+ link.crossOrigin = this.options.crossOrigin || 'anonymous';
340
+ } else if (this.options.as) {
341
+ link.as = this.options.as;
342
+ }
343
+
344
+ if (this.options.crossOrigin && this.type !== 'font') {
345
+ link.crossOrigin = this.options.crossOrigin;
346
+ }
347
+ if (this.options.integrity) {
348
+ link.integrity = this.options.integrity;
349
+ }
350
+
351
+ return link;
352
+ }
353
+
354
+ /* -------------------------
355
+ * Helpers
356
+ * ------------------------- */
357
+
358
+ private getContainer(): HTMLElement {
359
+ const location = this.options.location || 'head';
360
+ return location === 'head' ? document.head : document.body;
361
+ }
362
+
363
+ private handleError(type: string): void {
364
+ const error = new Error(`Failed to load ${type}: ${this.url}`);
365
+ throw error;
366
+ }
367
+
368
+
369
+ remove(): this {
370
+ if (this.element?.parentNode) {
371
+ this.element.parentNode.removeChild(this.element);
372
+ this.element = null;
373
+ }
374
+ return this;
375
+ }
376
+ }
377
+
378
+ /**
379
+ * Factory function - auto-detects type and renders immediately
380
+ *
381
+ * Usage:
382
+ * // Auto-detect (works for most cases)
383
+ * jux.include('styles.css');
384
+ * jux.include('script.js').async();
385
+ *
386
+ * // Explicit type (for extensionless URLs)
387
+ * jux.include('https://cdn.tailwindcss.com').withJs();
388
+ * jux.include('https://cdn.tailwindcss.com').asScript();
389
+ * jux.include('https://unpkg.com/htmx.org').withJs({ defer: true });
390
+ *
391
+ * // CDN with parameters
392
+ * jux.include('https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4').withJs();
393
+ *
394
+ * // Module
395
+ * jux.include('app.mjs').withModule();
396
+ *
397
+ * // For JSON:
398
+ * const data = await jux.include('config.json').asJson();
399
+ * jux.include('data.json').onJson(data => console.log(data));
400
+ */
401
+ export function include(urlOrFile: string): Include {
402
+ const imp = new Include(urlOrFile);
403
+
404
+ // Don't auto-render JSON files
405
+ if (imp['type'] !== 'json') {
406
+ imp.render();
407
+ }
408
+
409
+ return imp;
410
+ }
@@ -0,0 +1,83 @@
1
+ import { FormInput, FormInputState } from './base/FormInput.js';
2
+ export interface InputOptions {
3
+ type?: string;
4
+ value?: string;
5
+ placeholder?: string;
6
+ label?: string;
7
+ icon?: string;
8
+ required?: boolean;
9
+ disabled?: boolean;
10
+ name?: string;
11
+ rows?: number;
12
+ min?: number;
13
+ max?: number;
14
+ step?: number;
15
+ minLength?: number;
16
+ maxLength?: number;
17
+ pattern?: string;
18
+ onValidate?: (value: string) => boolean | string;
19
+ style?: string;
20
+ class?: string;
21
+ }
22
+ interface InputState extends FormInputState {
23
+ type: string;
24
+ value: string;
25
+ placeholder: string;
26
+ icon: string;
27
+ rows: number;
28
+ min?: number;
29
+ max?: number;
30
+ step?: number;
31
+ minLength?: number;
32
+ maxLength?: number;
33
+ pattern?: string;
34
+ }
35
+ export declare class Input extends FormInput<InputState> {
36
+ constructor(id: string, options?: InputOptions);
37
+ protected getTriggerEvents(): readonly string[];
38
+ protected getCallbackEvents(): readonly string[];
39
+ type(value: string): this;
40
+ value(value: string | number): this;
41
+ placeholder(value: string): this;
42
+ icon(value: string): this;
43
+ rows(value: number): this;
44
+ min(value: number): this;
45
+ max(value: number): this;
46
+ step(value: number): this;
47
+ minLength(value: number): this;
48
+ maxLength(value: number): this;
49
+ pattern(value: string): this;
50
+ getValue(): string;
51
+ setValue(value: string): this;
52
+ getNumericValue(): number | null;
53
+ protected _validateValue(value: string): boolean | string;
54
+ protected _buildInputElement(): HTMLElement;
55
+ render(targetId?: string): this;
56
+ }
57
+ export declare function input(id: string, options?: InputOptions): Input;
58
+ export declare function text(id: string, options?: Omit<InputOptions, 'type'>): Input;
59
+ export declare function textRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
60
+ export declare function number(id: string, options?: Omit<InputOptions, 'type'>): Input;
61
+ export declare function numberRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
62
+ export declare function email(id: string, options?: Omit<InputOptions, 'type'>): Input;
63
+ export declare function emailRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
64
+ export declare function password(id: string, options?: Omit<InputOptions, 'type'>): Input;
65
+ export declare function passwordRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
66
+ export declare function tel(id: string, options?: Omit<InputOptions, 'type'>): Input;
67
+ export declare function telRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
68
+ export declare function phone(id: string, options?: Omit<InputOptions, 'type'>): Input;
69
+ export declare function phoneRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
70
+ export declare function url(id: string, options?: Omit<InputOptions, 'type'>): Input;
71
+ export declare function urlRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
72
+ export declare function textarea(id: string, options?: Omit<InputOptions, 'type'>): Input;
73
+ export declare function textareaRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
74
+ export declare function range(id: string, options?: Omit<InputOptions, 'type'>): Input;
75
+ export declare function rangeRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
76
+ export declare function date(id: string, options?: Omit<InputOptions, 'type'>): Input;
77
+ export declare function dateRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
78
+ export declare function time(id: string, options?: Omit<InputOptions, 'type'>): Input;
79
+ export declare function timeRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
80
+ export declare function color(id: string, options?: Omit<InputOptions, 'type'>): Input;
81
+ export declare function colorRequired(id: string, options?: Omit<InputOptions, 'type'>): Input;
82
+ export {};
83
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAOhE,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CA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