All Downloads are FREE. Search and download functionalities are using the official Maven repository.

domdefs.ff4s.HtmlAttrs.scala Maven / Gradle / Ivy

There is a newer version: 0.24.0
Show newest version
package ff4s

import ff4s.HtmlAttr
import ff4s.codecs._

// #NOTE: GENERATED CODE
//  - This file is generated at compile time from the data in Scala DOM Types
//  - See `project/DomDefsGenerator.scala` for code generation params
//  - Contribute to https://github.com/raquo/scala-dom-types to add missing tags / attrs / props / etc.

trait HtmlAttrs {


  /**
    * Create HTML attribute (Note: for SVG attrs, use L.svg.svgAttr)
    * 
    * @param name  - name of the attribute, e.g. "value"
    * @param codec - used to encode V into String, e.g. StringAsIsCodec
    * 
    * @tparam V    - value type for this attr in Scala
    */
  def htmlAttr[V](name: String, codec: Codec[V, String]): HtmlAttr[V] = new HtmlAttr(name, codec)


  @inline protected def boolAsOnOffHtmlAttr(name: String): HtmlAttr[Boolean] = htmlAttr(name, BooleanAsOnOffStringCodec)

  @inline protected def boolAsPresenceHtmlAttr(name: String): HtmlAttr[Boolean] = htmlAttr(name, BooleanAsAttrPresenceCodec)

  @inline protected def boolAsTrueFalseHtmlAttr(name: String): HtmlAttr[Boolean] = htmlAttr(name, BooleanAsTrueFalseStringCodec)

  @inline protected def boolAsYesNoHtmlAttr(name: String): HtmlAttr[Boolean] = htmlAttr(name, BooleanAsYesNoStringCodec)

  @inline protected def doubleHtmlAttr(name: String): HtmlAttr[Double] = htmlAttr(name, DoubleAsStringCodec)

  @inline protected def intHtmlAttr(name: String): HtmlAttr[Int] = htmlAttr(name, IntAsStringCodec)

  @inline protected def stringHtmlAttr(name: String): HtmlAttr[String] = htmlAttr(name, StringAsIsCodec)



  /**
    * Declares the character encoding of the page or script. Used on meta and
    * script elements.
    * 
    *  - [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#charset meta#charset @ MDN]]
    *  - [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#charset script#charset @ MDN]]
    */
  lazy val charset: HtmlAttr[String] = stringHtmlAttr("charset")


  /**
    * Indicates whether the element should be editable by the user.
    * If so, the browser modifies its widget to allow editing.
    * 
    * [[https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/contentEditable contentEditable @ MDN]]
    */
  lazy val contentEditable: HtmlAttr[Boolean] = boolAsTrueFalseHtmlAttr("contenteditable")


  /**
    * Specifies a context menu for an element by its element id.
    * The context menu appears when a user right-clicks on the element
    * 
    * [[https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contextmenu contextmenu @ MDN]]
    */
  lazy val contextMenuId: HtmlAttr[String] = stringHtmlAttr("contextmenu")


  /**
    * Specifies whether the dragged data is copied, moved, or linked, when dropped
    * Acceptable values: `copy` | `move` | `link`
    */
  lazy val dropZone: HtmlAttr[String] = stringHtmlAttr("dropzone")


  /**
    * The `formaction` attribute provides the URL that will process the input control 
    * when the form is submitted and overrides the default `action` attribute of the 
    * `form` element. This should be used only with `input` elements of `type` 
    * submit or image.
    * 
    * [[https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formaction input#formaction @ MDN]]
    */
  lazy val formAction: HtmlAttr[String] = stringHtmlAttr("formaction")


  /** The form attribute specifies an ID of the form an `` element belongs to. */
  lazy val formId: HtmlAttr[String] = stringHtmlAttr("form")


  /**
    * The `height` attribute specifies the pixel height of the following elements:
    * `, ,