package virtual_dom
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=7f1fa83287458114c5b0cab8aae00d69972d15e1d20a446ce13f246aacef3216
doc/virtual_dom.css_gen/Css_gen/index.html
Module Css_gen
Source
A set of functions to generate css declaration lists. This library can be used to programmatically produce strings suitable for the HTML style attribute, e.g. style="display:flex;background-color:red".
include Core.Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
This function only needs implementation if t
exposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the variant t
afterwards.
Create a single property, value pair (a declaration in CSS parlance). The value must be a valid CSS literal. We do run a simple CSS parser on the value to validate this and will throw an exception if that parser fails. Note that the parser is less forgiving than many browsers. That is browsers will silently accept or drop many illegal constructs. We prefer to raise on them, so that errors are detected earlier.
It is recommended to use one of the other constructors instead if they are available. If they are not, consider adding them to this library.
val position :
?top:Length.t ->
?bottom:Length.t ->
?left:Length.t ->
?right:Length.t ->
[ `Static | `Absolute | `Sticky | `Relative | `Fixed ] ->
t
Set the position attribute and optionally top, bottom,left,right Note that left and top have no effect when position is `Static.
Neither combine
nor concat
validate that each t
is unique. For combine x y
, y
will override x
if they are the same attribute. For concat l
, the greatest index of an attribute will prevail.
The inverse of to_string_css. Primarily useful if you want to reuse a css literal from the web (aka copy paste web design). Raises if the string fails validation. See create for comments on the validation we do.
val display :
[ `Inline
| `Block
| `Inline_block
| `List_item
| `Table
| `Inline_table
| `None
| `Inline_grid
| css_global_values ] ->
t
val font :
size:Length.t ->
family:string list ->
?style:font_style ->
?weight:font_weight ->
?variant:font_variant ->
unit ->
t
type background_image = [
| `Url of string
| `Linear_gradient of linear_gradient
| `Radial_gradient of radial_gradient
]
val white_space :
[ `Normal | `Nowrap | `Pre | `Pre_line | `Pre_wrap | css_global_values ] ->
t
val margin :
?top:Auto_or_length.t ->
?bottom:Auto_or_length.t ->
?left:Auto_or_length.t ->
?right:Auto_or_length.t ->
unit ->
t
type border_style = [
| `None
| `Hidden
| `Dotted
| `Dashed
| `Solid
| `Double
| `Groove
| `Ridge
| `Inset
| `Outset
| css_global_values
]
type text_decoration_line = [
| `None
| `Underline
| `Overline
| `Line_through
| css_global_values
]
type text_decoration_style = [
| `Solid
| `Double
| `Dotted
| `Dashed
| `Wavy
| css_global_values
]
val text_decoration :
?style:text_decoration_style ->
?color:[< Color.t ] ->
line:text_decoration_line list ->
unit ->
t
val flex_container :
?inline:bool ->
?direction:[ `Row | `Row_reverse | `Column | `Column_reverse ] ->
?wrap:[ `Nowrap | `Wrap | `Wrap_reverse ] ->
?align_items:item_alignment ->
?justify_content:justify_content ->
unit ->
t
val flex_item :
?order:int ->
?basis:Auto_or_length.t ->
?shrink:float ->
grow:float ->
unit ->
t
val animation :
name:string ->
duration:Core.Time_ns.Span.t ->
?delay:Core.Time_ns.Span.t ->
?direction:
[ `Normal
| `Reverse
| `Alternate
| `Alternate_reverse
| css_global_values ] ->
?fill_mode:[ `None | `Forwards | `Backwards | `Both | css_global_values ] ->
?iter_count:int ->
?timing_function:string ->
unit ->
t
Note: You must include the name
s @keyframes in the stylesheet