package html_of_jsx

  1. Overview
  2. Docs

Source file extra_htmx.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
(** https://htmx.org/reference/ *)

open Html_attributes

let core_attributes =
  [
    Rich_attribute
      {
        name = "hx-boost";
        jsxName = "hx_boost";
        type_ = BooleanishString;
        description =
          "add or remove progressive enhancement for links and forms";
        url = "https://htmx.org/attributes/hx-boost";
      };
    Rich_attribute
      {
        name = "hx-get";
        jsxName = "hx_get";
        type_ = String;
        description = "issues a GET to the specified URL";
        url = "https://htmx.org/attributes/hx-get";
      };
    Rich_attribute
      {
        name = "hx-post";
        jsxName = "hx_post";
        type_ = String;
        description = "issues a POST to the specified URL";
        url = "https://htmx.org/attributes/hx-post";
      };
    (*
        Not sure how to support those

        Rich_attribute
         {
           name = "hx-on";
           jsxName = "hx_on";
           type_ =
             String;
            description =
                "handle any event with a script inline";
            url = "https://htmx.org/attributes/hx-on";
         }; *)
    (* Attribute
       {
         name = "hx-push-url";
         jsxName = "hx_push_url";
         type_ =
           String;
            description =
              "pushes the URL into the browser location bar, creating a new history entry";
            url = "https://htmx.org/attributes/hx-get";
       }; *)
    Rich_attribute
      {
        name = "hx-select";
        jsxName = "hx_select";
        type_ = String;
        description = "select content to swap in from a response";
        url = "https://htmx.org/attributes/hx-select";
      };
    Rich_attribute
      {
        name = "hx-select-oob";
        jsxName = "hx_select_oob";
        type_ = String;
        description =
          "select content to swap in from a response, out of band (somewhere \
           other than the target)";
        url = "https://htmx.org/attributes/hx-select-oob";
      };
    Rich_attribute
      {
        name = "hx-swap";
        jsxName = "hx_swap";
        type_ =
          Polyvariant
            [
              { type_ = "innerHTML"; jsxName = "innerHTML" };
              { type_ = "outerHTML"; jsxName = "outerHTML" };
              { type_ = "afterbegin"; jsxName = "afterbegin" };
              { type_ = "beforebegin"; jsxName = "beforebegin" };
              { type_ = "beforeend"; jsxName = "beforeend" };
              { type_ = "afterend"; jsxName = "afterend" };
              { type_ = "delete"; jsxName = "delete" };
              { type_ = "none"; jsxName = "none" };
            ];
        description =
          "marks content in a response to be out of band (should swap in \
           somewhere other than the target)";
        url = "https://htmx.org/attributes/hx-swap";
      };
    Rich_attribute
      {
        name = "hx-swap-oob";
        jsxName = "hx_swap_oob";
        type_ = String;
        description = "specifies the target element to be swapped";
        url = "https://htmx.org/attributes/hx-swap-oob";
      };
    Rich_attribute
      {
        name = "hx-target";
        jsxName = "hx_target";
        type_ = String;
        description = "specifies the event that triggers the request";
        url = "https://htmx.org/attributes/hx-target";
      };
    Rich_attribute
      {
        name = "hx-trigger";
        jsxName = "hx_trigger";
        type_ = String;
        description = "specifies the event that triggers the request";
        url = "https://htmx.org/attributes/hx-trigger";
      };
    Rich_attribute
      {
        name = "hx-vals";
        jsxName = "hx_vals";
        type_ = String;
        description =
          "adds values to the parameters to submit with the request \
           (JSON-formatted)";
        url = "https://htmx.org/attributes/hx-vals";
      };
  ]

let additional_attributes =
  [
    Rich_attribute
      {
        name = "hx-confirm";
        jsxName = "hx_confirm";
        type_ = String;
        description = "shows a confirm() dialog before issuing a request";
        url = "https://htmx.org/attributes/hx-confirm";
      };
    Rich_attribute
      {
        name = "hx-delete";
        jsxName = "hx_delete";
        type_ = String;
        description = "issues a DELETE to the specified URL";
        url = "https://htmx.org/attributes/hx-delete";
      };
    Rich_attribute
      {
        name = "hx-disable";
        jsxName = "hx_disable";
        type_ = Bool;
        description =
          "disables htmx processing for the given node and any children nodes";
        url = "https://htmx.org/attributes/hx-disable";
      };
    Rich_attribute
      {
        name = "hx-disabled-elt";
        jsxName = "hx_disabled_elt";
        type_ = String;
        description =
          "adds the `disabled` attribute to the specified elements while a \
           request is in flight";
        url = "https://htmx.org/attributes/hx-disabled-elt";
      };
    Rich_attribute
      {
        name = "hx-disinherit";
        jsxName = "hx_disinherit";
        type_ = String;
        description =
          "control and disable automatic attribute inheritance for child nodes";
        url = "https://htmx.org/attributes/hx-disinherit";
      };
    Rich_attribute
      {
        name = "hx-encoding";
        jsxName = "hx_encoding";
        type_ = String;
        description = "changes the request encoding type";
        url = "https://htmx.org/attributes/hx-encoding";
      };
    Rich_attribute
      {
        name = "hx-ext";
        jsxName = "hx_ext";
        type_ = String;
        description = "extensions to use for this element";
        url = "https://htmx.org/attributes/hx-ext";
      };
    Rich_attribute
      {
        name = "hx-headers";
        jsxName = "hx_headers";
        type_ = String;
        description =
          "adds to the headers that will be submitted with the request";
        url = "https://htmx.org/attributes/hx-headers";
      };
    Rich_attribute
      {
        name = "hx-history";
        jsxName = "hx_history";
        type_ = BooleanishString;
        description = "prevent sensitive data being saved to the history cache";
        url = "https://htmx.org/attributes/hx-history";
      };
    Rich_attribute
      {
        name = "hx-history-elt";
        jsxName = "hx_history_elt";
        type_ = Bool;
        description =
          "the element to snapshot and restore during history navigation";
        url = "https://htmx.org/attributes/hx-history-elt";
      };
    Rich_attribute
      {
        name = "hx-include";
        jsxName = "hx_include";
        type_ = String;
        description = "include additional data in requests";
        url = "https://htmx.org/attributes/hx-include";
      };
    Rich_attribute
      {
        name = "hx-indicator";
        jsxName = "hx_indicator";
        type_ = String;
        description =
          "the element to put the htmx-request class on during the request";
        url = "https://htmx.org/attributes/hx-indicator";
      };
    Rich_attribute
      {
        name = "hx-params";
        jsxName = "hx_params";
        type_ = String;
        description =
          "filters the parameters that will be submitted with a request";
        url = "https://htmx.org/attributes/hx-params";
      };
    Rich_attribute
      {
        name = "hx-patch";
        jsxName = "hx_patch";
        type_ = String;
        description = "issues a PATCH to the specified URL";
        url = "https://htmx.org/attributes/hx-patch";
      };
    Rich_attribute
      {
        name = "hx-preserve";
        jsxName = "hx_preserve";
        type_ = Bool;
        description = "specifies elements to keep unchanged between requests";
        url = "https://htmx.org/attributes/hx-preserve";
      };
    Rich_attribute
      {
        name = "hx-prompt";
        jsxName = "hx_prompt";
        type_ = String;
        description = "shows a prompt() before submitting a request";
        url = "https://htmx.org/attributes/hx-prompt";
      };
    Rich_attribute
      {
        name = "hx-put";
        jsxName = "hx_put";
        type_ = String;
        description = "issues a PUT to the specified URL";
        url = "https://htmx.org/attributes/hx-put";
      };
    Rich_attribute
      {
        name = "hx-replace-url";
        jsxName = "hx_replace_url";
        type_ = String;
        description = "replace the URL in the browser location bar";
        url = "https://htmx.org/attributes/hx-replace-url";
      };
    Rich_attribute
      {
        name = "hx-request";
        jsxName = "hx_request";
        type_ = String;
        description = "configures various aspects of the request";
        url = "https://htmx.org/attributes/hx-request";
      };
    Rich_attribute
      {
        name = "hx-sync";
        jsxName = "hx_sync";
        type_ = String;
        description =
          "control how requests made by different elements are synchronized";
        url = "https://htmx.org/attributes/hx-get";
      };
    Rich_attribute
      {
        name = "hx-validate";
        jsxName = "hx_validate";
        type_ = Bool;
        description = "force elements to validate themselves before a request";
        url = "https://htmx.org/attributes/hx-validate";
      };
  ]

(** SSE (Server-Sent Events) extension attributes
    https://htmx.org/extensions/sse/ *)
let sse_extension_attributes =
  [
    Rich_attribute
      {
        name = "sse-connect";
        jsxName = "sse_connect";
        type_ = String;
        description = "URL to connect to for SSE";
        url = "https://htmx.org/extensions/sse/";
      };
    Rich_attribute
      {
        name = "sse-swap";
        jsxName = "sse_swap";
        type_ = String;
        description = "event name to swap content on";
        url = "https://htmx.org/extensions/sse/";
      };
    Rich_attribute
      {
        name = "sse-close";
        jsxName = "sse_close";
        type_ = String;
        description = "event name to close the SSE connection on";
        url = "https://htmx.org/extensions/sse/";
      };
  ]

(** WebSocket extension attributes https://htmx.org/extensions/ws/ *)
let ws_extension_attributes =
  [
    Rich_attribute
      {
        name = "ws-connect";
        jsxName = "ws_connect";
        type_ = String;
        description = "URL to connect to for WebSocket";
        url = "https://htmx.org/extensions/ws/";
      };
    Rich_attribute
      {
        name = "ws-send";
        jsxName = "ws_send";
        type_ = Bool;
        description = "send a message to the WebSocket server";
        url = "https://htmx.org/extensions/ws/";
      };
  ]

(** Class-tools extension attributes https://htmx.org/extensions/class-tools/ *)
let class_tools_extension_attributes =
  [
    Rich_attribute
      {
        name = "classes";
        jsxName = "classes";
        type_ = String;
        description = "add, remove, or toggle classes on a schedule";
        url = "https://htmx.org/extensions/class-tools/";
      };
  ]

(** Preload extension attributes https://htmx.org/extensions/preload/ *)
let preload_extension_attributes =
  [
    Rich_attribute
      {
        name = "preload";
        jsxName = "preload";
        type_ = String;
        description =
          "preload linked resources on mousedown or touchstart (values: \
           mousedown, mouseover)";
        url = "https://htmx.org/extensions/preload/";
      };
  ]

(** Path-deps extension attributes https://htmx.org/extensions/path-deps/ *)
let path_deps_extension_attributes =
  [
    Rich_attribute
      {
        name = "path-deps";
        jsxName = "path_deps";
        type_ = String;
        description =
          "path this element depends on for refresh via path-deps extension";
        url = "https://htmx.org/extensions/path-deps/";
      };
  ]

(** Loading-states extension attributes
    https://htmx.org/extensions/loading-states/ *)
let loading_states_extension_attributes =
  [
    Rich_attribute
      {
        name = "data-loading";
        jsxName = "data_loading";
        type_ = Bool;
        description = "show element during request";
        url = "https://htmx.org/extensions/loading-states/";
      };
    Rich_attribute
      {
        name = "data-loading-class";
        jsxName = "data_loading_class";
        type_ = String;
        description = "add class to element during request";
        url = "https://htmx.org/extensions/loading-states/";
      };
    Rich_attribute
      {
        name = "data-loading-class-remove";
        jsxName = "data_loading_class_remove";
        type_ = String;
        description = "remove class from element during request";
        url = "https://htmx.org/extensions/loading-states/";
      };
    Rich_attribute
      {
        name = "data-loading-disable";
        jsxName = "data_loading_disable";
        type_ = Bool;
        description = "disable element during request";
        url = "https://htmx.org/extensions/loading-states/";
      };
    Rich_attribute
      {
        name = "data-loading-aria-busy";
        jsxName = "data_loading_aria_busy";
        type_ = Bool;
        description = "set aria-busy attribute during request";
        url = "https://htmx.org/extensions/loading-states/";
      };
    Rich_attribute
      {
        name = "data-loading-delay";
        jsxName = "data_loading_delay";
        type_ = String;
        description = "delay before showing loading state (e.g., '200ms')";
        url = "https://htmx.org/extensions/loading-states/";
      };
    Rich_attribute
      {
        name = "data-loading-target";
        jsxName = "data_loading_target";
        type_ = String;
        description = "CSS selector for element to apply loading state to";
        url = "https://htmx.org/extensions/loading-states/";
      };
    Rich_attribute
      {
        name = "data-loading-path";
        jsxName = "data_loading_path";
        type_ = String;
        description = "only trigger loading state for requests to this path";
        url = "https://htmx.org/extensions/loading-states/";
      };
    Rich_attribute
      {
        name = "data-loading-states";
        jsxName = "data_loading_states";
        type_ = Bool;
        description = "marker attribute to enable loading-states extension";
        url = "https://htmx.org/extensions/loading-states/";
      };
  ]

let attributes =
  core_attributes @ additional_attributes @ sse_extension_attributes
  @ ws_extension_attributes @ class_tools_extension_attributes
  @ preload_extension_attributes @ path_deps_extension_attributes
  @ loading_states_extension_attributes