mono-jsx 0.2.0 → 0.3.0

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.
@@ -0,0 +1,791 @@
1
+ /**
2
+ * Provides type definitions in JSX for htmx attributes.
3
+ * @link https://github.com/Desdaemon/typed-htmx
4
+ * @module
5
+ */
6
+
7
+ /**
8
+ * Either `"true"` or `"false"`.
9
+ */
10
+ type BoolStr = "true" | "false";
11
+ type AnyStr = string & {};
12
+ type HxSwap =
13
+ | "innerHTML"
14
+ | "outerHTML"
15
+ | "beforebegin"
16
+ | "afterbegin"
17
+ | "beforeend"
18
+ | "afterend"
19
+ | "delete"
20
+ | "none"
21
+ | "morph"
22
+ | "morphdom"
23
+ | "multi:";
24
+
25
+ /**
26
+ * Either `this` which refers to the element itself, or a modifier followed by a CSS selector, e.g. `closest form`.
27
+ */
28
+ type HxTarget = "this" | "closest " | "find " | "next" | "next " | "previous" | "previous ";
29
+
30
+ /**
31
+ * A CSS selector, followed by one of these sync strategies, e.g. `form:abort`.
32
+ */
33
+ type HxSync = ":drop" | ":abort" | ":replace" | ":queue" | ":queue first" | ":queue last" | ":queue all";
34
+
35
+ /**
36
+ * Any of the standard DOM events, or htmx-specific events.
37
+ */
38
+ type HxTriggers = keyof GlobalEventHandlersEventMap | HtmxUtils.HtmxEvents;
39
+
40
+ /** @ignore */
41
+ declare namespace HtmxUtils {
42
+ type HxOnMap =
43
+ & { [K in keyof GlobalEventHandlersEventMap as `hx-on-${K}`]?: string }
44
+ & { [K in HxOnHtmxEvents as `hx-on--${K}`]?: string };
45
+
46
+ type HxOnHtmxEvents =
47
+ | JsxHtmxEvents
48
+ | keyof { [K in keyof HxSubevents as `${K}-${HxSubevents[K]}`]: never };
49
+
50
+ type JsxHtmxEvents =
51
+ | "abort"
52
+ | "after-on-load"
53
+ | "after-process-node"
54
+ | "after-request"
55
+ | "after-settle"
56
+ | "after-swap"
57
+ | "before-cleanup-element"
58
+ | "before-on-load"
59
+ | "before-process-node"
60
+ | "before-request"
61
+ | "before-swap"
62
+ | "before-send"
63
+ | "config-request"
64
+ | "confirm"
65
+ | "history-cache-error"
66
+ | "history-cache-miss"
67
+ | "history-cache-miss-error"
68
+ | "history-cache-miss-load"
69
+ | "history-restore"
70
+ | "before-history-save"
71
+ | "load"
72
+ | "no-sse-source-error"
73
+ | "on-load-error"
74
+ | "oob-after-swap"
75
+ | "oob-before-swap"
76
+ | "oob-error-no-target"
77
+ | "prompt"
78
+ | "pushed-into-history"
79
+ | "response-error"
80
+ | "send-error"
81
+ | "sse-error"
82
+ | "sse-open"
83
+ | "swap-error"
84
+ | "target-error"
85
+ | "timeout";
86
+
87
+ type HxSubevents = {
88
+ validation: "validate" | "failed" | "halted";
89
+ xhr: "abort" | "loadend" | "loadstart" | "progress";
90
+ };
91
+
92
+ type KebabToCamel<T extends string> = T extends `${infer Head}-${infer Rest}` ? `${Head}${KebabToCamel<Capitalize<Rest>>}`
93
+ : T;
94
+
95
+ type HtmxEvents =
96
+ | `htmx:${KebabToCamel<JsxHtmxEvents>}`
97
+ | keyof { [K in keyof HxSubevents as `htmx:${K}:${HxSubevents[K]}`]: never };
98
+ }
99
+
100
+ /**
101
+ * An event followed by one of these modifiers, e.g. `click once`.
102
+ */
103
+ type HxTriggerModifier =
104
+ | " once"
105
+ | " changed"
106
+ | " delay:"
107
+ | " throttle:"
108
+ | " from:"
109
+ | " target:"
110
+ | " consume"
111
+ | " queue:first"
112
+ | " queue:last"
113
+ | " queue:all"
114
+ | " queue:none";
115
+
116
+ /**
117
+ * An extensible directory of htmx extensions.
118
+ *
119
+ * ### Declaring a new extension
120
+ *
121
+ * ```tsx twoslash
122
+ * // in foo.d.ts:
123
+ *
124
+ * declare global {
125
+ * namespace JSX {
126
+ * interface HtmxExtensions {
127
+ * myExtension: "my-extension";
128
+ * }
129
+ * interface HtmlTag {
130
+ * /** Describe your attribute *\/
131
+ * ["my-extension-attr"]?: "true" | "false";
132
+ * // Add any other attributes your extension uses here
133
+ * }
134
+ * }
135
+ * }
136
+ *
137
+ * <div hx-ext="my-extension">
138
+ * <span my-extension-attr="true">Hello</span>
139
+ * // ^?
140
+ * </div>
141
+ * ```
142
+ */
143
+ interface HtmxBuiltinExtensions {
144
+ /**
145
+ * Includes the commonly-used `X-Requested-With` header that identifies ajax requests in many backend frameworks.
146
+ *
147
+ * CDN: https://unpkg.com/htmx.org/dist/ext/ajax-header.js
148
+ * @see https://htmx.org/extensions/ajax-header/
149
+ */
150
+ ajaxHeaders: "ajax-headers";
151
+ /**
152
+ * Uses the Alpine.js morph plugin to swap content.
153
+ *
154
+ * CDN: https://unpkg.com/htmx.org/dist/ext/alpine-morph.js
155
+ * @see https://htmx.org/extensions/alpine-morph/
156
+ */
157
+ alpineMorph: "alpine-morph";
158
+ /**
159
+ * Ingest [server-sent events].
160
+ *
161
+ * CDN: https://unpkg.com/htmx.org/dist/ext/sse.js
162
+ * @see https://htmx.org/extensions/server-sent-events/
163
+ *
164
+ * [server-sent Events]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events
165
+ */
166
+ serverSentEvents: "sse";
167
+ /**
168
+ * WebSockets support.
169
+ *
170
+ * CDN: https://unpkg.com/htmx.org/dist/ext/ws.js
171
+ * @see https://htmx.org/extensions/web-sockets/
172
+ */
173
+ ws: "ws";
174
+ /**
175
+ * Class utilities.
176
+ *
177
+ * CDN: https://unpkg.com/htmx.org/dist/ext/class-tools.js
178
+ * @see https://htmx.org/extensions/class-tools/
179
+ */
180
+ classTools: "class-tools";
181
+ /**
182
+ * Transforms JSON/XML responses into HTML.
183
+ *
184
+ * CDN: https://unpkg.com/htmx.org/dist/ext/client-side-templates.js
185
+ * @see https://htmx.org/extensions/client-side-templates/
186
+ */
187
+ clientSideTemplates: "client-side-templates";
188
+ /**
189
+ * Tool for debugging htmx requests.
190
+ *
191
+ * CDN: https://unpkg.com/htmx.org/dist/ext/debug.js
192
+ * @see https://htmx.org/extensions/debug/
193
+ */
194
+ debug: "debug";
195
+ /**
196
+ * Disable elements during requests.
197
+ *
198
+ * CDN: https://unpkg.com/htmx.org/dist/ext/disable-element.js
199
+ * @see https://htmx.org/extensions/disable-element/
200
+ * @deprecated 1.9.6: Included into htmx core as `hx-disabled-elt`.
201
+ */
202
+ disableElement: "disable-element";
203
+ /**
204
+ * Includes the JSON of the event that triggered a request
205
+ * to the `Triggering-Event` header.
206
+ *
207
+ * CDN: https://unpkg.com/htmx.org/dist/ext/event-header.js
208
+ * @see https://htmx.org/extensions/event-header/
209
+ */
210
+ eventHeader: "event-header";
211
+ /**
212
+ * Support for adding tags to `<head>`.
213
+ *
214
+ * CDN: https://unpkg.com/htmx.org/dist/ext/head-support.js
215
+ * @see https://htmx.org/extensions/head-support/
216
+ */
217
+ headSupport: "head-support";
218
+ /**
219
+ * Include additional data in requests.
220
+ *
221
+ * CDN: https://unpkg.com/htmx.org/dist/ext/include-vals.js
222
+ */
223
+ includeVals: "include-vals";
224
+ /**
225
+ * Support for [Idiomorph](https://github.com/bigskysoftware/idiomorph), an alternative swapping mechanism for htmx.
226
+ *
227
+ * CDN: https://unpkg.com/idiomorph/dist/idiomorph-ext.min.js
228
+ * @see https://github.com/bigskysoftware/idiomorph#htmx
229
+ */
230
+ idiomorph: "morph";
231
+ /**
232
+ * Use JSON encoding in the body of requests, rather than the default `x-www-form-urlencoded`.
233
+ *
234
+ * CDN: https://unpkg.com/htmx.org/dist/ext/json-enc.js
235
+ * @see https://htmx.org/extensions/json-enc/
236
+ */
237
+ jsonEncode: "json-enc";
238
+ /**
239
+ * Support for inflight loading states.
240
+ *
241
+ * CDN: https://unpkg.com/htmx.org/dist/ext/loading-states.js
242
+ * @see https://htmx.org/extensions/loading-states/
243
+ */
244
+ loadingStates: "loading-states";
245
+ /**
246
+ * Support for [morphdom](https://github.com/patrick-steele-idem/morphdom),
247
+ * an alternative swapping mechanism for htmx.
248
+ *
249
+ * CDN: https://unpkg.com/htmx.org/dist/ext/morphdom-swap.js
250
+ * @see https://htmx.org/extensions/morphdom-swap/
251
+ */
252
+ morphdomSwap: "morphdom-swap";
253
+ /**
254
+ * Use `X-HTTP-Method-Override` for non-GET and -POST requests.
255
+ * Useful for bypassing firewalls or proxies.
256
+ *
257
+ * CDN: https://unpkg.com/htmx.org/dist/ext/method-override.js
258
+ * @see https://htmx.org/extensions/method-override/
259
+ */
260
+ methodOverride: "method-override";
261
+ /**
262
+ * Swap multiple elements marked with IDs, each optionally followed by a swap style.
263
+ *
264
+ * CDN: https://unpkg.com/htmx.org/dist/ext/multi-swap.js
265
+ * @see https://htmx.org/extensions/multi-swap/
266
+ */
267
+ multiSwap: "multi-swap";
268
+ /**
269
+ * Express dependencies between requests.
270
+ *
271
+ * CDN: https://unpkg.com/htmx.org/dist/ext/path-deps.js
272
+ * @see https://htmx.org/extensions/path-deps/
273
+ */
274
+ pathDeps: "path-deps";
275
+ /**
276
+ * Preload HTML fragments.
277
+ *
278
+ * CDN: https://unpkg.com/htmx.org/dist/ext/preload.js
279
+ * @see https://htmx.org/extensions/preload/
280
+ */
281
+ preload: "preload";
282
+ /**
283
+ * Remove this element after a set duration.
284
+ *
285
+ * CDN: https://unpkg.com/htmx.org/dist/ext/remove-me.js
286
+ * @see https://htmx.org/extensions/remove-me/
287
+ */
288
+ removeMe: "remove-me";
289
+ /**
290
+ * Specify different target elements for different HTTP response codes.
291
+ *
292
+ * CDN: https://unpkg.com/htmx.org/dist/ext/response-targets.js
293
+ * @see https://htmx.org/extensions/response-targets/
294
+ */
295
+ responseTargets: "response-targets";
296
+ /**
297
+ * Triggers an event `restored` when a back button event is detected while using `hx-boost`.
298
+ *
299
+ * CDN: https://unpkg.com/htmx.org/dist/ext/restored.js
300
+ * @see https://htmx.org/extensions/restored/
301
+ */
302
+ restored: "restored";
303
+ /**
304
+ * Use specific parameters as path variables.
305
+ *
306
+ * CDN: https://unpkg.com/htmx.org/dist/ext/path-params.js
307
+ * @see https://htmx.org/extensions/path-params/
308
+ */
309
+ pathParams: "path-params";
310
+ }
311
+
312
+ /**
313
+ * Definitions for htmx attributes up to 1.9.10.
314
+ *
315
+ * ###### Path variables
316
+ * `hx-get`, `hx-post` and other request attributes can include path variables by
317
+ * using the {@linkcode HtmxBuiltinExtensions.pathParams path-params} extension.
318
+ * Once used as a path variable, it will not be included in the request body.
319
+ * ```jsx twoslash
320
+ * <button hx-post="/api/user/{id}" hx-vals="{'id': 1,'foo':true}" hx-ext="path-params">...</button>
321
+ * // Only 'foo' will be included in the request body
322
+ * ```
323
+ */
324
+ interface HtmxAttributes extends HtmxUtils.HxOnMap {
325
+ /** @ignore For React compatibility only. */
326
+ // children?: {} | null;
327
+ /** @ignore For React compatibility only. */
328
+ // key?: {};
329
+ /**
330
+ * Issues a `GET` to the specified URL.
331
+ * @see https://htmx.org/attributes/hx-get/
332
+ * @category Core
333
+ */
334
+ ["hx-get"]?: string;
335
+ /**
336
+ * Issues a `POST` to the specified URL.
337
+ * @see https://htmx.org/attributes/hx-post/
338
+ * @category Core
339
+ */
340
+ ["hx-post"]?: string;
341
+ /**
342
+ * Issues a `PUT` to the specified URL.
343
+ * @see https://htmx.org/attributes/hx-put/
344
+ */
345
+ ["hx-put"]?: string;
346
+ /**
347
+ * Issues a `DELETE` to the specified URL.
348
+ * @see https://htmx.org/attributes/hx-delete/
349
+ */
350
+ ["hx-delete"]?: string;
351
+ /**
352
+ * Issues a `PATCH` to the specified URL.
353
+ * @see https://htmx.org/attributes/hx-patch/
354
+ */
355
+ ["hx-patch"]?: string;
356
+ /**
357
+ * Add or remove [progressive enhancement](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement)
358
+ * for links and forms.
359
+ *
360
+ * @see https://htmx.org/attributes/hx-boost/
361
+ * @category Core
362
+ */
363
+ ["hx-boost"]?: BoolStr;
364
+ /**
365
+ * Handle any event with a script inline.
366
+ * @see https://htmx.org/attributes/hx-on/
367
+ * @category Core
368
+ * @remarks Event listeners on htmx-specific events need to be specified with a spread attribute, and
369
+ * are otherwise not supported in vanilla JSX.
370
+ * Alternatively, use the `hx-on-` all-dash syntax. (since 1.9.10)
371
+ * ```jsx
372
+ * <div {...{'hx-on::before-request': '...'}} />
373
+ * ```
374
+ * @since 1.9.3
375
+ */
376
+ ["hx-on:"]?: string;
377
+ /**
378
+ * Alternative syntax for `hx-on:`.
379
+ *
380
+ * All colons in event handlers can be replaced with a dash, i.e.
381
+ * `hx-on:click` becomes `hx-on-click`, `hx-on::before-request` becomes `hx-on--before-request` and so on.
382
+ * @see https://htmx.org/attributes/hx-on/
383
+ * @category Core
384
+ * @since 1.9.10
385
+ */
386
+ ["hx-on-"]?: string;
387
+ /**
388
+ * Handle any event with a script inline. Each listener is specified on a separate line.
389
+ * @see https://htmx.org/attributes/hx-on/
390
+ * @remarks Superseded by `hx-on:$event`, unless IE11 support is required.
391
+ * @since 1.9.0
392
+ */
393
+ ["hx-on"]?: HxTriggers | AnyStr;
394
+ /**
395
+ * Pushes the URL into the browser location bar, creating a new history entry.
396
+ * @see https://htmx.org/attributes/hx-push-url/
397
+ * @category Core
398
+ */
399
+ ["hx-push-url"]?: BoolStr | AnyStr;
400
+ /**
401
+ * CSS selector for content to swap in from a response.
402
+ * @see https://htmx.org/attributes/hx-select/
403
+ * @category Core
404
+ */
405
+ ["hx-select"]?: string;
406
+ /**
407
+ * CSS selector for content to swap in from a response, out of band (somewhere other than the target).
408
+ * @see https://htmx.org/attributes/hx-select-oob/
409
+ * @category Core
410
+ */
411
+ ["hx-select-oob"]?: string;
412
+ /**
413
+ * Controls how content is swapped in (`outerHTML`, `beforeend`, `afterend`, …).
414
+ * @default htmx.config.defaultSwapStyle // 'innerHTML'
415
+ * @see https://htmx.org/attributes/hx-swap/
416
+ * @see [`InsertPosition`](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML#position) which is used in `Element.insertAdjacentHTML`.
417
+ * @category Core
418
+ * @remarks
419
+ * - `morph` is observed by the {@linkcode HtmxBuiltinExtensions.idiomorph idiomorph} extension.
420
+ * Also see {@linkcode HtmxBuiltinExtensions.alpineMorph alpine-morph}.
421
+ * - `morphdom` swaps are observed by the {@linkcode HtmxBuiltinExtensions.morphdomSwap morphdom-swap} extension.
422
+ * - `multi:` swaps are observed by the {@linkcode HtmxBuiltinExtensions.multiSwap multi-swap} extension.
423
+ * @since 1.9.6: `hx-swap` can be specified without any swap style.
424
+ */
425
+ ["hx-swap"]?: true | HxSwap | AnyStr;
426
+ /**
427
+ * Marks content in a response to be out of band (should swap in somewhere other than the target).
428
+ * @see https://htmx.org/attributes/hx-swap-oob/
429
+ */
430
+ ["hx-swap-oob"]?: "true" | HxSwap | AnyStr;
431
+ /**
432
+ * Specifies the target element to be swapped.
433
+ *
434
+ * Accepts a CSS selector, optionally preceded by a {@link HxTarget modifier}.
435
+ * @see https://htmx.org/attributes/hx-target/
436
+ * @category Core
437
+ */
438
+ ["hx-target"]?: HxTarget | AnyStr;
439
+ /**
440
+ * Specifies the target element to be swapped, when a specific error code is encountered.
441
+ *
442
+ * Error codes may also be specified as wildcards, e.g. `hx-target-5*` or `hx-target-5x`.
443
+ * @see https://htmx.org/extensions/response-targets/
444
+ * @category Extensions
445
+ */
446
+ ["hx-target-"]?: HxTarget | AnyStr;
447
+ /**
448
+ * Specifies a catch-all target element to be swapped when a 4xx or 5xx response is encountered.
449
+ * @see https://htmx.org/extensions/response-targets/
450
+ * @category Extensions
451
+ */
452
+ ["hx-target-error"]?: HxTarget | AnyStr;
453
+ /**
454
+ * Specifies the event that triggers the request.
455
+ *
456
+ * Accepts {@link HxTriggers names} of standard DOM events, or htmx-specific events.
457
+ * Optionally followed by a {@link HxTriggerModifier modifier}.
458
+ * @see https://htmx.org/attributes/hx-trigger/
459
+ * @category Core
460
+ * @remarks
461
+ * - `sse:` is observed by the {@linkcode HtmxBuiltinExtensions.serverSentEvents server-sent-events} extension.
462
+ * - `path-deps` is observed by the {@linkcode HtmxBuiltinExtensions.pathDeps path-deps} extension.
463
+ * - `restored` is observed by the {@linkcode HtmxBuiltinExtensions.restored restored} extension.
464
+ */
465
+ ["hx-trigger"]?: "every " | HxTriggerModifier | HxTriggers | "sse:" | "path-deps" | "restored" | AnyStr;
466
+ /**
467
+ * Adds values to the parameters to submit with the request (JSON-formatted).
468
+ *
469
+ * Objects may be passed only if supported by the JSX renderer.
470
+ * @see https://htmx.org/attributes/hx-params/
471
+ * @category Core
472
+ */
473
+ ["hx-vals"]?: AnyStr | "javascript:" | "js:" | Record<PropertyKey, unknown>;
474
+ /**
475
+ * Shows a `confirm()` dialog before issuing a request.
476
+ * @see https://htmx.org/attributes/hx-confirm/
477
+ */
478
+ ["hx-confirm"]?: string;
479
+ /**
480
+ * Disables htmx processing for the given node and any children nodes.
481
+ * Useful for escaping user-generated content.
482
+ * @see https://htmx.org/attributes/hx-disable/
483
+ */
484
+ ["hx-disable"]?: true;
485
+ /**
486
+ * Marks the element to be disabled during a request.
487
+ * Multiple elements are separated by commas.
488
+ * @see https://htmx.org/attributes/hx-disabled-elt/
489
+ * @since 1.9.6
490
+ */
491
+ ["hx-disabled-elt"]?: "this" | "closest " | AnyStr;
492
+ /**
493
+ * Control and disable automatic attribute inheritance for child nodes.
494
+ * @see https://htmx.org/attributes/hx-disinherit/
495
+ */
496
+ ["hx-disinherit"]?: "*" | AnyStr;
497
+ /**
498
+ * Changes the request encoding type.
499
+ * @see https://htmx.org/attributes/hx-encoding/
500
+ */
501
+ ["hx-encoding"]?: "multipart/form-data";
502
+ /**
503
+ * Extensions to apply to this element and its descendants.
504
+ * @see https://htmx.org/attributes/hx-ext/
505
+ * @see {@linkcode HtmxBuiltinExtensions} for extension details, and how to declare extensions in JSX.
506
+ */
507
+ ["hx-ext"]?: JSX.HtmxExtensions[keyof JSX.HtmxExtensions] | "ignore:" | AnyStr;
508
+ /**
509
+ * Adds to the headers that will be submitted with the request.
510
+ *
511
+ * Objects may be passed only if supported by the JSX renderer.
512
+ * @see https://htmx.org/attributes/hx-headers/
513
+ */
514
+ ["hx-headers"]?: AnyStr | "javascript:" | "js:" | Record<PropertyKey, unknown>;
515
+ /**
516
+ * Prevent sensitive data being saved to the history cache.
517
+ * @see https://htmx.org/attributes/hx-history/
518
+ */
519
+ ["hx-history"]?: "false";
520
+ /**
521
+ * Mark the element to snapshot and restore during history navigation.
522
+ * @see https://htmx.org/attributes/hx-history-elt/
523
+ */
524
+ ["hx-history-elt"]?: true;
525
+ /**
526
+ * Include additional data in requests.
527
+ * Accepts CSS selectors.
528
+ * @see https://htmx.org/attributes/hx-include/
529
+ */
530
+ ["hx-include"]?: "this" | "closest " | "find " | "next " | "previous " | AnyStr;
531
+ /**
532
+ * The element to put the `htmx-request` class on during the request.
533
+ * Accepts CSS selectors.
534
+ * @see https://htmx.org/attributes/hx-indicator/
535
+ */
536
+ ["hx-indicator"]?: "closest " | AnyStr;
537
+ /**
538
+ * Filters the parameters that will be submitted with a request.
539
+ * @see https://htmx.org/attributes/hx-params/
540
+ */
541
+ ["hx-params"]?: "*" | "none" | "not " | AnyStr;
542
+ /**
543
+ * Specifies elements to keep unchanged between requests.
544
+ * An ID on the element is also required, and is the only criterion for preservation.
545
+ * @see https://htmx.org/attributes/hx-preserve/
546
+ * @remarks This attribute is observed by the [`head-support`] extension,
547
+ * where it prevents an element from being removed from `<head>`.
548
+ *
549
+ * [`head-support`]: https://htmx.org/extensions/head-support/
550
+ */
551
+ ["hx-preserve"]?: "true";
552
+ /**
553
+ * Shows a `prompt()` before submitting a request.
554
+ * @see https://htmx.org/attributes/hx-prompt/
555
+ */
556
+ ["hx-prompt"]?: string;
557
+ /**
558
+ * Replace the URL in the browser location bar.
559
+ * @see https://htmx.org/attributes/hx-replace-url/
560
+ */
561
+ ["hx-replace-url"]?: BoolStr | AnyStr;
562
+ /**
563
+ * Configures various aspects of the request.
564
+ * @see https://htmx.org/attributes/hx-request/
565
+ */
566
+ ["hx-request"]?: '"timeout":' | '"credentials":' | '"noHeaders":' | "javascript:" | "js:" | AnyStr;
567
+ /**
568
+ * Control how requests made by different elements are synchronized.
569
+ *
570
+ * Accepts a CSS selector, optionally followed by a colon and a {@link HxSync sync strategy}.
571
+ * @see https://htmx.org/attributes/hx-sync/
572
+ */
573
+ ["hx-sync"]?: HxSync | "this" | "closest " | AnyStr;
574
+ /**
575
+ * Force elements to validate themselves before a request.
576
+ * @see https://htmx.org/attributes/hx-validate/
577
+ */
578
+ ["hx-validate"]?: "true";
579
+ /**
580
+ * Adds values dynamically to the parameters to submit with the request.
581
+ * @deprecated superseded by `hx-vals`
582
+ */
583
+ ["hx-vars"]?: AnyStr;
584
+ /**
585
+ * The URL of the SSE server.
586
+ * @see https://htmx.org/extensions/server-sent-events/
587
+ * @category Extensions
588
+ */
589
+ ["sse-connect"]?: string;
590
+ /**
591
+ * The name of the message to swap into the DOM.
592
+ * @see https://htmx.org/extensions/server-sent-events/
593
+ * @category Extensions
594
+ */
595
+ ["sse-swap"]?: string;
596
+ /**
597
+ * A URL to establish a WebSocket connection against.
598
+ * @see https://htmx.org/extensions/web-sockets/
599
+ * @category Extensions
600
+ */
601
+ ["ws-connect"]?: string;
602
+ /**
603
+ * Sends a message to the nearest websocket based on the trigger value for the element.
604
+ * @see https://htmx.org/extensions/web-sockets/
605
+ * @category Extensions
606
+ */
607
+ ["ws-send"]?: boolean;
608
+ /**
609
+ * Apply class transitions on this element.
610
+ * @see https://htmx.org/extensions/class-tools/
611
+ * @category Extensions
612
+ */
613
+ ["classes"]?: "add " | "remove " | "toggle " | AnyStr;
614
+ /**
615
+ * The element or elements to disable during requests.
616
+ * Accepts CSS selectors.
617
+ * @see https://htmx.org/extensions/disable-element1.9.6: /
618
+ * @deprecated 1.9.6: superseded by [`hx-disabled-elt`]
619
+ * @category Extensions
620
+ *
621
+ * [`hx-disabled-elt`]: https://htmx.org/attributes/hx-disabled-elt/
622
+ */
623
+ ["hx-disable-element"]?: "self" | AnyStr;
624
+ /**
625
+ * The strategy for merging new head content.
626
+ * @see https://htmx.org/extensions/head-support/
627
+ * @category Extensions
628
+ */
629
+ ["hx-head"]?: "merge" | "append" | "re-eval";
630
+ /**
631
+ * The ID of a Mustache `<template>` to render the response with.
632
+ * @see https://htmx.org/extensions/client-side-templates/#full-mustache-html-example
633
+ * @category Extensions
634
+ */
635
+ ["mustache-template"]?: string;
636
+ /**
637
+ * The ID of a Mustache `<template>` to render the response with.
638
+ * Selected when the response is an array.
639
+ * @see https://htmx.org/extensions/client-side-templates/#full-mustache-html-example
640
+ * @category Extensions
641
+ */
642
+ ["mustache-array-template"]?: string;
643
+ /**
644
+ * The ID of a Handlebars `<template>` to render the response with.
645
+ * @see https://htmx.org/extensions/client-side-templates/
646
+ * @category Extensions
647
+ */
648
+ ["handlebars-template"]?: string;
649
+ /**
650
+ * The ID of a Handlebars `<template>` to render the response with.
651
+ * Selected when the response is an array.
652
+ * @see https://htmx.org/extensions/client-side-templates/
653
+ * @category Extensions
654
+ */
655
+ ["handlebars-array-template"]?: string;
656
+ /**
657
+ * The ID of a Nunjucks `<template>` to render the response with.
658
+ * @see https://htmx.org/extensions/client-side-templates/
659
+ * @see https://mozilla.github.io/nunjucks/
660
+ * @category Extensions
661
+ */
662
+ ["nunjucks-template"]?: string;
663
+ /**
664
+ * The ID of a Nunjucks `<template>` to render the response with.
665
+ * Selected when the response is an array.
666
+ * @see https://htmx.org/extensions/client-side-templates/
667
+ * @category Extensions
668
+ */
669
+ ["nunjucks-array-template"]?: string;
670
+ /**
671
+ * The ID of a {@link XSLTProcessor XSLT} `<template>` to render the response with.
672
+ *
673
+ * @see https://htmx.org/extensions/client-side-templates/#full-xslt-html-example
674
+ * @see https://developer.mozilla.org/en-US/docs/Web/XSLT
675
+ * @category Extensions
676
+ */
677
+ ["xslt-template"]?: string;
678
+ /**
679
+ * Include additional data in requests.
680
+ * @see https://htmx.org/extensions/include-vals/
681
+ * @category Extensions
682
+ */
683
+ ["include-vals"]?: string;
684
+ /**
685
+ * Shows this element during a pending request.
686
+ * @see https://htmx.org/extensions/loading-states/
687
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display for all possible values
688
+ * @category Extensions
689
+ */
690
+ ["data-loading"]?: true | string;
691
+ /**
692
+ * Adds these classes to this element during a pending request,
693
+ * and removes them when the request is complete.
694
+ * @see https://htmx.org/extensions/loading-states/
695
+ * @category Extensions
696
+ */
697
+ ["data-loading-class"]?: string;
698
+ /**
699
+ * Disables this element for the duration of a pending request.
700
+ * @see https://htmx.org/extensions/loading-states/
701
+ * @category Extensions
702
+ */
703
+ ["data-loading-disable"]?: true;
704
+ /**
705
+ * Removes these classes from this element during a pending request,
706
+ * and adds them back when the request is complete.
707
+ * @see https://htmx.org/extensions/loading-states/
708
+ * @category Extensions
709
+ */
710
+ ["data-loading-class-remove"]?: string;
711
+ /**
712
+ * Adds `aria-busy="true"` to this element for the duration of a pending request.
713
+ * @see https://htmx.org/extensions/loading-states/
714
+ * @category Extensions
715
+ */
716
+ ["data-loading-aria-busy"]?: true;
717
+ /**
718
+ * Only applies loading states after this many milliseconds.
719
+ * @default 200
720
+ * @see https://htmx.org/extensions/loading-states/
721
+ * @category Extensions
722
+ */
723
+ ["data-loading-delay"]?: string;
724
+ /**
725
+ * Specify a different target to apply loading states.
726
+ * Accepts a CSS selector.
727
+ * @see https://htmx.org/extensions/loading-states/
728
+ * @category Extensions
729
+ */
730
+ ["data-loading-target"]?: string;
731
+ /**
732
+ * Only applies loading states for this request.
733
+ * @see https://htmx.org/extensions/loading-states/
734
+ * @category Extensions
735
+ */
736
+ ["data-loading-path"]?: string;
737
+ /**
738
+ * Define a scope for loading states, so only descendants are processed.
739
+ * @see https://htmx.org/extensions/loading-states/
740
+ * @category Extensions
741
+ */
742
+ ["data-loading-states"]?: true;
743
+ /**
744
+ * When any other mutating requests are made to this path (or its subpaths),
745
+ * a request for this element should also be triggered.
746
+ * @see https://htmx.org/extensions/path-deps/
747
+ * @category Extensions
748
+ */
749
+ ["path-deps"]?: string;
750
+ /**
751
+ * Opt into HTML fragment preloading.
752
+ *
753
+ * Only GET requests are preloaded. Note that this attribute is inherited.
754
+ *
755
+ * ###### Image preloading
756
+ * ```html
757
+ * <a href="/.." preload="mouseover" preload-images="true">...</a>
758
+ * ```
759
+ * @default 'mousedown'
760
+ * @see https://htmx.org/extensions/preload/
761
+ * @category Extensions
762
+ */
763
+ ["preload"]?: true | "mousedown" | "mouseover" | AnyStr;
764
+ /**
765
+ * Opt into image preloading.
766
+ * @see https://htmx.org/extensions/preload/
767
+ * @category Extensions
768
+ */
769
+ ["preload-images"]?: "true";
770
+ /**
771
+ * Specify the duration after which this element should be removed.
772
+ * @see https://htmx.org/extensions/remove-me/
773
+ * @category Extensions
774
+ */
775
+ ["remove-me"]?: string;
776
+ /**
777
+ * Attach [hyperscript](https://hyperscript.org/docs) behavior to this element.
778
+ * Available separately from htmx.
779
+ *
780
+ * CDN: https://unpkg.com/hyperscript.org
781
+ */
782
+ _?: AnyStr;
783
+ }
784
+
785
+ /** @ignore */
786
+ declare namespace JSX {
787
+ interface HtmxExtensions extends HtmxBuiltinExtensions {}
788
+
789
+ // typed-html
790
+ interface HtmlTag extends HtmxAttributes {}
791
+ }