0 | ||| HTML element attributes.
  1 | |||
  2 | ||| The below methods require for their values data types which can be obtained
  3 | ||| using strings as they all implement a `fromString` function.
  4 | |||
  5 | ||| Those `fromString` functions are rather restrictive in terms of accepted
  6 | ||| values. The aim is to only accept values which aren't only compliant with
  7 | ||| standards but also with best practices.
  8 | |||
  9 | ||| If needed, you can bypass such requirements using their constructors.
 10 | ||| For example, you could use `MkId` if you need to use an identifier which
 11 | ||| would need escaping for CSS.
 12 | module Text.Html.Attributes
 13 |
 14 | import Data.Either
 15 | import Data.List1
 16 | import Data.String
 17 |
 18 | import Text.Html.Attributes.Types
 19 | import Text.Html.Attributes.Validation
 20 | import Text.Html.Types
 21 | import Text.Html.Values
 22 |
 23 | %default total
 24 |
 25 | --------------------------------------------------------------------------------
 26 | -- Global attributes
 27 | --------------------------------------------------------------------------------
 28 |
 29 | ||| An **accesskey* attribute.
 30 | public export
 31 | accesskey : Key -> Attribute
 32 | accesskey key = MkAttribute "accesskey" (Just $ escape $ show $ key.char)
 33 |
 34 | ||| An **action* attribute.
 35 | public export
 36 | action : Url -> Attribute
 37 | action = MkAttribute "action" . Just . escape . show
 38 |
 39 | ||| The **aria-<star>** attribute.
 40 | |||
 41 | ||| > [!NOTE]
 42 | ||| > This is a simplified implementation of the **aria-<star>** attribute.
 43 | ||| > Instead of accepting the relevant HTML elements, accepts an user supplied
 44 | ||| > name.
 45 | public export
 46 | aria_star : (name : NonWhitespace) -> (value : String) -> Attribute
 47 | -- TODO: provide a proper implementation of the aria attribute.
 48 | aria_star name =
 49 |   let escapedName := show $ escape $ show name in
 50 |   MkAttribute "aria-\{escapedName}" . Just . escape
 51 |
 52 | ||| An **autocorrect** attribute.
 53 | public export
 54 | autocorrect : AutocorrectValue -> Attribute
 55 | autocorrect = MkAttribute "autocorrect" . Just . escape . show
 56 |
 57 | ||| An **autofocus* attribute.
 58 | public export
 59 | autofocus : Attribute
 60 | autofocus = MkAttribute "autofocus" Nothing
 61 |
 62 | ||| A **class* attribute.
 63 | |||
 64 | ||| CSS selectors within the class attribute are separated by a space.
 65 | public export
 66 | class : Identifiers -> Attribute
 67 | class = MkAttribute "class" . Just . escape . show
 68 |
 69 | ||| A **contenteditable* attribute.
 70 | public export
 71 | contenteditable : ContenteditableValue -> Attribute
 72 | contenteditable = MkAttribute "contenteditable" . Just . escape . show
 73 |
 74 | ||| The **data-<star>** attribute.
 75 | public export
 76 | data_star : (name : NonWhitespace) -> (value : String) -> Attribute
 77 | data_star name =
 78 |   let escapedName := show $ escape $ show name in
 79 |   MkAttribute "data-\{escapedName}" . Just . escape
 80 |
 81 | ||| A **dir* attribute.
 82 | public export
 83 | dir : DirValue -> Attribute
 84 | dir = MkAttribute "dir" . Just . escape . show
 85 |
 86 | ||| A **draggable** attribute with a filename provided.
 87 | public export
 88 | draggable : Bool -> Attribute
 89 | draggable True  = MkAttribute "draggable" $ Just $ escape "true"
 90 | draggable False = MkAttribute "draggable" $ Just $ escape "false"
 91 |
 92 | ||| An **enterkeyhint** attribute.
 93 | public export
 94 | enterkeyhint : EnterkeyhintValue -> Attribute
 95 | enterkeyhint = MkAttribute "enterkeyhint" . Just . escape . show
 96 |
 97 | ||| An **exportparts** attribute.
 98 | public export
 99 | exportparts : ExportpartsValue -> Attribute
100 | exportparts = MkAttribute "exportparts" . Just . escape . show
101 |
102 | ||| An **id** attribute.
103 | |||
104 | ||| An identifier must be a valid CSS selectors which doesn't need escaping as
105 | ||| per [MDN's recommendations][1]
106 | |||
107 | ||| An identifier must be composed only of alphanumerical characters, '-' or
108 | ||| '_'.
109 | |||
110 | ||| On top of the above, an identifer must not:
111 | |||
112 | ||| - start with a digit or with a '-';
113 | |||
114 | ||| (The above is a small simplification, as the actual rule is that an
115 | ||| identifier cannot start with a '-' followed by a digit.)
116 | |||
117 | ||| [1]: https://developer.mozilla.org/docs/Web/HTML/Reference/Global_attributes/id
118 | public export
119 | id : Identifier -> Attribute
120 | id = MkAttribute "id" . Just . escape . show
121 |
122 | ||| An **inert** attribute.
123 | public export
124 | inert : Attribute
125 | inert = MkAttribute "inert" Nothing
126 |
127 | ||| An **inputmode** attribute.
128 | public export
129 | inputmode : InputmodeValue -> Attribute
130 | inputmode = MkAttribute "inputmode" . Just . escape . show
131 |
132 | ||| An **itemid** attribute.
133 | public export
134 | itemid : ItemidValue -> Attribute
135 | itemid = MkAttribute "itemid" . Just . escape . show
136 |
137 | ||| An **itemprop** attribute.
138 | public export
139 | itemprop : String -> Attribute
140 | itemprop = MkAttribute "itemprop" . Just . escape
141 |
142 | ||| An **itemref** attribute.
143 | public export
144 | itemref : Identifiers -> Attribute
145 | itemref = MkAttribute "itemref" . Just . escape . show
146 |
147 | ||| An **itemscope** attribute.
148 | public export
149 | itemscope : Attribute
150 | itemscope = MkAttribute "itemscope" Nothing
151 |
152 | ||| An **itemtype** attribute.
153 | public export
154 | itemtype : Urls -> Attribute
155 | itemtype = MkAttribute "itemtype" . Just . escape . show
156 |
157 | ||| A **hidden** attribute.
158 | public export
159 | hidden : HiddenValue -> Attribute
160 | hidden = MkAttribute "hidden" . Just . escape . show
161 |
162 | namespace HiddenEmpty
163 |
164 |   ||| A **hidden** attribute without any provided value.
165 |   public export
166 |   hidden : Attribute
167 |   hidden = MkAttribute "hidden" Nothing
168 |
169 | ||| A **lang** attribute.
170 | public export
171 | lang : LanguageTag -> Attribute
172 | lang = MkAttribute "lang" . Just . escape . show
173 |
174 | ||| A **nonce** attribute.
175 | public export
176 | nonce : String -> Attribute
177 | nonce = MkAttribute "nonce" . Just . escape
178 |
179 | ||| A **part** attribute.
180 | public export
181 | part : Identifier -> Attribute
182 | part = MkAttribute "part" . Just . escape . show
183 |
184 | ||| A **popover** attribute.
185 | public export
186 | popover : PopoverValue -> Attribute
187 | popover = MkAttribute "popover" . Just . escape . show
188 |
189 | ||| A **role** attribute.
190 | public export
191 | role : RoleValue -> Attribute
192 | role = MkAttribute "role" . Just . escape . show
193 |
194 | ||| A **slot** attribute.
195 | public export
196 | slot : NonWhitespace -> Attribute
197 | slot = MkAttribute "slot" . Just . escape . show
198 |
199 | ||| A **spellcheck** attribute.
200 | public export
201 | spellcheck : Bool -> Attribute
202 | spellcheck True  = MkAttribute "spellcheck" $ Just $ escape "true"
203 | spellcheck False = MkAttribute "spellcheck" $ Just $ escape "false"
204 |
205 | ||| A **style** attribute.
206 | public export
207 | style : CssValue -> Attribute
208 | style = MkAttribute "style" . Just . escape . show
209 |
210 | ||| A **tabindex** attribute.
211 | public export
212 | tabindex : TabindexValue -> Attribute
213 | tabindex = MkAttribute "tabindex" . Just . escape . show
214 |
215 | ||| A **title** attribute.
216 | public export
217 | title : String -> Attribute
218 | title = MkAttribute "title" . Just . escape
219 |
220 | ||| A **translate** attribute.
221 | public export
222 | translate : Bool -> Attribute
223 | translate True  = MkAttribute "translate" $ Just $ escape "true"
224 | translate False = MkAttribute "translate" $ Just $ escape "false"
225 |
226 | --------------------------------------------------------------------------------
227 | -- Other attributes
228 | --------------------------------------------------------------------------------
229 |
230 | ||| An **accept** attribute.
231 | public export
232 | accept : FileTypes -> Attribute
233 | accept fileTypes =
234 |   MkAttribute "accept" (Just $ escape $ joinBy "," $ toList fileTypes.values)
235 |
236 | ||| An **accept-charset** attribute.
237 | public export
238 | accept_charset : Charset -> Attribute
239 | accept_charset = MkAttribute "accept-charset" . Just . escape . show
240 |
241 | ||| A **alt** attribute.
242 | public export
243 | alt : String -> Attribute
244 | alt = MkAttribute "alt" . Just . escape
245 |
246 | ||| An **as** attribute.
247 | public export
248 | as : AsValue -> Attribute
249 | as = MkAttribute "as" . Just . escape . show
250 |
251 | ||| An **async** attribute.
252 | public export
253 | async : Attribute
254 | async = MkAttribute "async" Nothing
255 |
256 | ||| An **autocomplete** attribute.
257 | public export
258 | autocomplete : AutocompleteValue -> Attribute
259 | autocomplete = MkAttribute "autocomplete" . Just . escape . show
260 |
261 | ||| An **autoplay** attribute.
262 | public export
263 | autoplay : Attribute
264 | autoplay = MkAttribute "autoplay" Nothing
265 |
266 | ||| A **charset** attribute.
267 | |||
268 | ||| The only accepted value is `"utf-8"`, because UTF-8 is the only valid
269 | ||| encoding for HTML5 documents, see [MDN documentation][1].
270 | |||
271 | ||| [1]: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meta#charset
272 | public export
273 | charset : Charset -> Attribute
274 | charset = MkAttribute "charset" . Just . escape . show
275 |
276 | ||| A **check** attribute.
277 | public export
278 | check : Attribute
279 | check = MkAttribute "check" Nothing
280 |
281 | ||| A **cite** attribute.
282 | public export
283 | cite : Uri -> Attribute
284 | cite = MkAttribute "cite" . Just . escape . show
285 |
286 | ||| A **cols** attribute.
287 | public export
288 | cols : Nat -> Attribute
289 | cols = MkAttribute "cols" . Just . escape . show
290 |
291 | ||| A **colspan** attribute.
292 | public export
293 | colspan : Int -> Attribute
294 | colspan = MkAttribute "colspan" . Just . escape . show
295 |
296 | ||| The **content** attribute.
297 | |||
298 | ||| Constraints:
299 | |||
300 | ||| - the **content** attribute cannot be an empty or white spaces only `String`.
301 | |||
302 | ||| Notes:
303 | |||
304 | ||| - At the moment, the trim function trims only white spaces. Tabs and other
305 | |||   white space characters are not trimmed.
306 | public export
307 | content : (content : NonWhitespace) -> Attribute
308 | content = MkAttribute "content" . Just . escape . show
309 |
310 | ||| A **controls** attribute.
311 | public export
312 | controls : Attribute
313 | controls = MkAttribute "controls" Nothing
314 |
315 | namespace CoordsCircle
316 |
317 |   ||| A **coords** attribute for a circle.
318 |   public export
319 |   coords : (x : Double) -> (y : Double) -> (r : Double) -> Attribute
320 |   coords x y r = MkAttribute "coords" $ Just $ escape $ show $ Circle x y r
321 |
322 | namespace CoordsPoly
323 |
324 |   ||| A **coords** attribute for a polygon.
325 |   public export
326 |   coords : (x1 : Double)
327 |         -> (y1 : Double)
328 |         -> (x2 : Double)
329 |         -> (y2 : Double)
330 |         -> List (Double, Double)
331 |         -> Attribute
332 |   coords x1 y1 x2 y2 xs =
333 |     MkAttribute "coords" $ Just $ escape $ show $ Poly x1 y1 x2 y2 xs
334 |
335 | namespace CoordsRectangle
336 |
337 |   ||| A **coords** attribute for a rectangle.
338 |   public export
339 |   coords : (x1 : Double)
340 |         -> (y1 : Double)
341 |         -> (x2 : Double)
342 |         -> (y2 : Double)
343 |         -> Attribute
344 |   coords x1 y1 x2 y2 =
345 |     MkAttribute "coords" $ Just $ escape $ show $ Rect x1 y1 x2 y2
346 |
347 | ||| The **crossorigin** attribute.
348 | public export
349 | crossorigin : CrossoriginValue -> Attribute
350 | crossorigin = MkAttribute "crossorigin" . Just . escape . show
351 |
352 | ||| The **data** attribute.
353 | |||
354 | ||| > [!NOTE]
355 | ||| > As `data` is a reserved keyword, use `data_` instead.
356 | public export
357 | data_ : Url -> Attribute
358 | data_ = MkAttribute "data" . Just . escape . show
359 |
360 | ||| The **datetime** attribute.
361 | public export
362 | datetime : Datetime -> Attribute
363 | datetime = MkAttribute "datetime" . Just . escape . show
364 |
365 | ||| The **decoding** attribute.
366 | public export
367 | decoding : DecodingValue -> Attribute
368 | decoding = MkAttribute "decoding" . Just . escape . show
369 |
370 | ||| The **default** attribute.
371 | |||
372 | ||| > [!NOTE]
373 | ||| > As `default` is a reserved keyword, use `default_` instead.
374 | public export
375 | default_ : Attribute
376 | default_ = MkAttribute "default" Nothing
377 |
378 | ||| The **defer** attribute.
379 | public export
380 | defer : Attribute
381 | defer = MkAttribute "defer" Nothing
382 |
383 | ||| A **dirname* attribute.
384 | public export
385 | dirname : DirnameValue -> Attribute
386 | dirname = MkAttribute "dirname" . Just . escape . show
387 |
388 | ||| The **disabled** attribute.
389 | public export
390 | disabled : Attribute
391 | disabled = MkAttribute "disabled" Nothing
392 |
393 | namespace Download
394 |
395 |   ||| A **download** attribute without a filename.
396 |   public export
397 |   download : Attribute
398 |   download = MkAttribute "download" Nothing
399 |
400 | namespace DownloadFilename
401 |
402 |   ||| A **download** attribute with a filename provided.
403 |   public export
404 |   download : Filename -> Attribute
405 |   download = MkAttribute "download" . Just . escape . show
406 |
407 | ||| The **enctype** attribute.
408 | public export
409 | enctype : EnctypeValue -> Attribute
410 | enctype = MkAttribute "enctype" . Just . escape . show
411 |
412 | ||| An **elementtiming** attribute.
413 | public export
414 | elementtiming : NonWhitespace -> Attribute
415 | elementtiming = MkAttribute "elementtiming" . Just . escape . show
416 |
417 | ||| A **fetchpriority** attribute.
418 | public export
419 | fetchpriority : FetchpriorityValue -> Attribute
420 | fetchpriority = MkAttribute "fetchpriority" . Just . escape . show
421 |
422 | ||| A **for** attribute.
423 | public export
424 | for : Identifiers -> Attribute
425 | for = MkAttribute "for" . Just . escape . show
426 |
427 | ||| A **form** attribute.
428 | public export
429 | form : Identifier -> Attribute
430 | form = MkAttribute "form" . Just . escape . show
431 |
432 | ||| A **formaction** attribute.
433 | public export
434 | formaction : Url -> Attribute
435 | formaction = MkAttribute "formaction" . Just . escape . show
436 |
437 | ||| A **formenctype** attribute.
438 | public export
439 | formenctype : EnctypeValue -> Attribute
440 | formenctype = MkAttribute "formenctype" . Just . escape . show
441 |
442 | ||| A **formmethod** attribute.
443 | public export
444 | formmethod : FormmethodValue -> Attribute
445 | formmethod = MkAttribute "formmethod" . Just . escape . show
446 |
447 | ||| A **formnovalidate** attribute.
448 | public export
449 | formnovalidate : Attribute
450 | formnovalidate = MkAttribute "formnovalidate" Nothing
451 |
452 | ||| A **formtarget** attribute.
453 | public export
454 | formtarget : FormtargetValue -> Attribute
455 | formtarget = MkAttribute "formtarget" . Just . escape . show
456 |
457 | ||| A **headers** attribute.
458 | public export
459 | headers : Identifier -> Attribute
460 | headers = MkAttribute "headers" . Just . escape . show
461 |
462 | ||| A **height** attribute.
463 | public export
464 | height : Nat -> Attribute
465 | height = MkAttribute "height" . Just . escape . show
466 |
467 | ||| A **high** attribute.
468 | public export
469 | high : Integer -> Attribute
470 | high = MkAttribute "high" . Just . escape . show
471 |
472 | ||| A **href** attribute.
473 | |||
474 | ||| Accepted values:
475 | |||
476 | ||| - URL
477 | ||| - Document fragment
478 | public export
479 | href : Href -> Attribute
480 | href = MkAttribute "href" . Just . escape . show
481 |
482 | ||| A **hreflang** attribute.
483 | public export
484 | hreflang : LanguageTag -> Attribute
485 | hreflang = MkAttribute "hreflang" . Just . escape . show
486 |
487 | ||| A **http-equiv** attribute.
488 | public export
489 | http_equiv : HttpEquivValue -> Attribute
490 | http_equiv = MkAttribute "http-equiv" . Just . escape . show
491 |
492 | ||| An **integrity** attribute.
493 | public export
494 | integrity : IntegrityValue -> Attribute
495 | integrity = MkAttribute "integrity" . Just . escape . show
496 |
497 | ||| An **ismap** attribute.
498 | public export
499 | ismap : Attribute
500 | ismap = MkAttribute "ismap" Nothing
501 |
502 | ||| A **kind** attribute.
503 | public export
504 | kind : KindValue -> Attribute
505 | kind = MkAttribute "kind" . Just . escape . show
506 |
507 | ||| A **label** attribute.
508 | public export
509 | label : (name : NonWhitespace) -> Attribute
510 | label = MkAttribute "label" . Just . escape . show
511 |
512 | ||| A **loading** attribute.
513 | public export
514 | loading : LoadingValue -> Attribute
515 | loading = MkAttribute "loading" . Just . escape . show
516 |
517 | ||| A **list** attribute.
518 | public export
519 | list : Identifier -> Attribute
520 | list = MkAttribute "list" . Just . escape . show
521 |
522 | ||| An **loop** attribute.
523 | public export
524 | loop : Attribute
525 | loop = MkAttribute "loop" Nothing
526 |
527 | ||| An **low** attribute.
528 | public export
529 | low : Integer -> Attribute
530 | low = MkAttribute "low" . Just . escape . show
531 |
532 | namespace MaxDate
533 |
534 |   ||| A **max** attribute for an **input** element with **date** type.
535 |   public export
536 |   max : Date -> Attribute
537 |   max = MkAttribute "max" . Just . escape . show
538 |
539 | namespace MaxYearMonth
540 |
541 |   ||| A **max** attribute for an **input** element with **year-month** type.
542 |   public export
543 |   max : YearMonth -> Attribute
544 |   max = MkAttribute "max" . Just . escape . show
545 |
546 | namespace MaxYearWeek
547 |
548 |   ||| A **max** attribute for an **input** element with **year-week** type.
549 |   public export
550 |   max : YearWeek -> Attribute
551 |   max = MkAttribute "max" . Just . escape . show
552 |
553 | namespace Time
554 |
555 |   ||| A **max** attribute for an **input** element with **time** type.
556 |   public export
557 |   max : Time -> Attribute
558 |   max = MkAttribute "max" . Just . escape . show
559 |
560 | namespace MaxDatetime
561 |
562 |   ||| A **max** attribute for an **input** element with **datetime-local** type.
563 |   public export
564 |   max : Datetime -> Attribute
565 |   max = MkAttribute "max" . Just . escape . show
566 |
567 | namespace MaxNumber
568 |
569 |   ||| A **max** attribute for a **number** or **range** element.
570 |   public export
571 |   max : Integer -> Attribute
572 |   max = MkAttribute "max" . Just . escape . show
573 |
574 | ||| A **maxlength** attribute.
575 | public export
576 | maxlength : Nat -> Attribute
577 | maxlength = MkAttribute "maxlength" . Just . escape . show
578 |
579 | ||| An **media** attribute.
580 | public export
581 | media : MediaQuery -> Attribute
582 | media = MkAttribute "media" . Just . escape . show
583 |
584 | ||| An **method** attribute.
585 | public export
586 | method : MethodValue -> Attribute
587 | method = MkAttribute "method" . Just . escape . show
588 |
589 | namespace MinDate
590 |
591 |   ||| A **min** attribute for an **input** element with **date** type.
592 |   public export
593 |   min : Date -> Attribute
594 |   min = MkAttribute "min" . Just . escape . show
595 |
596 | namespace MinYearMonth
597 |
598 |   ||| A **min** attribute for an **input** element with **year-month** type.
599 |   public export
600 |   min : YearMonth -> Attribute
601 |   min = MkAttribute "min" . Just . escape . show
602 |
603 | namespace MinYearWeek
604 |
605 |   ||| A **min** attribute for an **input** element with **year-week** type.
606 |   public export
607 |   min : YearWeek -> Attribute
608 |   min = MkAttribute "min" . Just . escape . show
609 |
610 | namespace Time
611 |
612 |   ||| A **min** attribute for an **input** element with **time** type.
613 |   public export
614 |   min : Time -> Attribute
615 |   min = MkAttribute "min" . Just . escape . show
616 |
617 | namespace MinDatetime
618 |
619 |   ||| A **min** attribute for an **input** element with **datetime-local** type.
620 |   public export
621 |   min : Datetime -> Attribute
622 |   min = MkAttribute "min" . Just . escape . show
623 |
624 | namespace MinNumber
625 |
626 |   ||| A **min** attribute for a **number** or **range** element.
627 |   public export
628 |   min : Integer -> Attribute
629 |   min = MkAttribute "min" . Just . escape . show
630 |
631 | ||| A **minlength** attribute.
632 | public export
633 | minlength : Nat -> Attribute
634 | minlength = MkAttribute "minlength" . Just . escape . show
635 |
636 | ||| A **multiple** attribute.
637 | public export
638 | multiple : Attribute
639 | multiple = MkAttribute "multiple" Nothing
640 |
641 | ||| A **muted** attribute.
642 | public export
643 | muted : Attribute
644 | muted = MkAttribute "muted" Nothing
645 |
646 | ||| A **novalidate** attribute.
647 | public export
648 | novalidate : Attribute
649 | novalidate = MkAttribute "novalidate" Nothing
650 |
651 | ||| An **open** attribute.
652 | |||
653 | ||| > [!NOTE]
654 | ||| > As `open` is a reserved keyword, use `open_` instead.
655 | public export
656 | open_ : Attribute
657 | open_ = MkAttribute "open" Nothing
658 |
659 | ||| The **name** attribute.
660 | |||
661 | ||| Constraints:
662 | |||
663 | ||| - the **name** attribute cannot be an empty or white spaces only `String`.
664 | |||
665 | ||| Notes:
666 | |||
667 | ||| - At the moment, the trim function trims only white spaces. Tabs and other
668 | |||   white space characters are not trimmed.
669 | public export
670 | name : (name : NonWhitespace) -> Attribute
671 | name = MkAttribute "name" . Just . escape . show
672 |
673 | ||| An **optimum** attribute.
674 | public export
675 | optimum : Integer -> Attribute
676 | optimum = MkAttribute "optimum" . Just . escape . show
677 |
678 | ||| A **pattern** attribute.
679 | public export
680 | pattern : RegExp -> Attribute
681 | pattern = MkAttribute "pattern" . Just . escape . show
682 |
683 | ||| A **ping** attribute.
684 | public export
685 | ping : Urls -> Attribute
686 | ping = MkAttribute "ping" . Just . escape . show
687 |
688 | ||| A **placeholder** attribute.
689 | public export
690 | placeholder : String -> Attribute
691 | placeholder = MkAttribute "placeholder" . Just . escape
692 |
693 | ||| A **playsinline** attribute.
694 | public export
695 | playsinline : Attribute
696 | playsinline = MkAttribute "playsinline" Nothing
697 |
698 | ||| A **poster** attribute.
699 | public export
700 | poster : Url -> Attribute
701 | poster = MkAttribute "poster" . Just . escape . show
702 |
703 | ||| A **preload** attribute.
704 | public export
705 | preload : PreloadValue -> Attribute
706 | preload = MkAttribute "preload" . Just . escape . show
707 |
708 | ||| A **readonly** attribute.
709 | public export
710 | readonly : Attribute
711 | readonly = MkAttribute "readonly" Nothing
712 |
713 | ||| A **referrerpolicy** attribute.
714 | public export
715 | referrerpolicy : ReferrerpolicyValue -> Attribute
716 | referrerpolicy = MkAttribute "referrerpolicy" . Just . escape . show
717 |
718 | ||| The **rel** attribute.
719 | |||
720 | ||| The currently accepted values are `"icon"` and `"stylesheet"`.
721 | public export
722 | rel : RelValue -> Attribute
723 | rel = MkAttribute "rel" . Just . escape . show
724 |
725 | ||| The **required** attribute.
726 | public export
727 | required : Attribute
728 | required = MkAttribute "required" Nothing
729 |
730 | ||| The **reversed** attribute.
731 | public export
732 | reversed : Attribute
733 | reversed = MkAttribute "reversed" Nothing
734 |
735 | ||| The **rows** attribute.
736 | public export
737 | rows : Positive -> Attribute
738 | rows = MkAttribute "rows" . Just . escape . show
739 |
740 | ||| The **rowspan** attribute.
741 | public export
742 | rowspan : Nat -> Attribute
743 | rowspan = MkAttribute "rowspan" . Just . escape . show
744 |
745 | ||| The **sandbox** attribute.
746 | public export
747 | sandbox : SandboxValue -> Attribute
748 | sandbox = MkAttribute "sandbox" . Just . escape . show
749 |
750 | ||| The **scope** attribute.
751 | public export
752 | scope : ScopeValue -> Attribute
753 | scope = MkAttribute "scope" . Just . escape . show
754 |
755 | ||| The **selected** attribute.
756 | public export
757 | selected : Attribute
758 | selected = MkAttribute "selected" Nothing
759 |
760 | ||| The **shape** attribute.
761 | public export
762 | shape : ShapeValue -> Attribute
763 | shape = MkAttribute "shape" . Just . escape . show
764 |
765 | ||| The **size** attribute.
766 | public export
767 | size : Positive -> Attribute
768 | size = MkAttribute "size" . Just . escape . show
769 |
770 | ||| The **sizes** attribute.
771 | public export
772 | sizes : SizesValue -> Attribute
773 | sizes = MkAttribute "sizes" . Just . escape . show
774 |
775 | ||| The **span** attribute.
776 | public export
777 | span : Positive -> Attribute
778 | span = MkAttribute "span" . Just . escape . show
779 |
780 | ||| A **src** attribute.
781 | |||
782 | ||| Accepts an URL as value.
783 | public export
784 | src : Url -> Attribute
785 | src = MkAttribute "src" . Just . escape . show
786 |
787 | ||| The **srcdoc** attribute.
788 | public export
789 | srcdoc : SrcdocValue -> Attribute
790 | srcdoc = MkAttribute "srcdoc" . Just . escape . show
791 |
792 | ||| A **srclang** attribute.
793 | public export
794 | srclang : LanguageTag -> Attribute
795 | srclang = MkAttribute "srclang" . Just . escape . show
796 |
797 | ||| A **srcset** attribute.
798 | |||
799 | ||| Accepts one or more `SrcSet` string values.
800 | public export
801 | srcset : List1 SrcsetValue -> Attribute
802 | srcset = MkAttribute "srcset" . Just . escape . toString
803 |
804 | ||| A **start** attribute.
805 | public export
806 | start : Positive -> Attribute
807 | start = MkAttribute "start" . Just . escape . show
808 |
809 | ||| A **step** attribute.
810 | public export
811 | step : PositiveFloat -> Attribute
812 | step = MkAttribute "step" . Just . escape . show
813 |
814 | ||| A **target** attribute.
815 | |||
816 | ||| Accepted values:
817 | |||
818 | ||| - _self
819 | ||| - _parent
820 | ||| - _top
821 | ||| - _blank
822 | ||| - <XML-Name>
823 | public export
824 | target : TargetValue -> Attribute
825 | target = MkAttribute "target" . Just . escape . show
826 |
827 | ||| A **type** attribute.
828 | public export
829 | type : TypeValue -> Attribute
830 | type = MkAttribute "type" . Just . escape . show
831 |
832 | namespace MimeType
833 |
834 |   ||| A (MIME) **type** attribute.
835 |   public export
836 |   type : MimeTypeValue -> Attribute
837 |   type = MkAttribute "type" . Just . escape . show
838 |
839 | namespace NumberingType
840 |
841 |   ||| A (numbering) **type** attribute.
842 |   public export
843 |   type : NumberingTypeValue -> Attribute
844 |   type = MkAttribute "type" . Just . escape . show
845 |
846 | namespace ScriptType
847 |
848 |   ||| A (script) **type** attribute.
849 |   public export
850 |   type : ScriptTypeValue -> Attribute
851 |   type = MkAttribute "type" . Just . escape . show
852 |
853 | ||| A **usemap** attribute.
854 | public export
855 | usemap : PartialUrl -> Attribute
856 | usemap = MkAttribute "usemap" . Just . escape . show
857 |
858 | ||| A **value** attribute.
859 | public export
860 | value : String -> Attribute
861 | value = MkAttribute "value" . Just . escape
862 |
863 | namespace NumberValue
864 |
865 |   ||| A **value** attribute an element expecting a number.
866 |   |||
867 |   ||| The element expecting a number for the **value** attribute are:
868 |   |||
869 |   ||| - **li** (only for numbered lists)
870 |   ||| - **meter**
871 |   ||| - **progress**
872 |   public export
873 |   value : Integer -> Attribute
874 |   value = MkAttribute "value" . Just . escape . show
875 |
876 | ||| A **width** attribute.
877 | public export
878 | width : Nat -> Attribute
879 | width = MkAttribute "width" . Just . escape . show
880 |
881 | ||| A **wrap** attribute.
882 | public export
883 | wrap : WrapValue -> Attribute
884 | wrap = MkAttribute "wrap" . Just . escape . show
885 |