package virtual_dom
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=812711b4d5ce634a413580cd7096482de8d71abec9ae37bb01f7c0dcec2968ec
doc/virtual_dom.css_gen/Css_gen/index.html
Module Css_genSource
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".
val sexp_of_css_global_values :
('a -> Sexplib0.Sexp.t) ->
'a css_global_values ->
Sexplib0.Sexp.tval css_global_values_of_sexp :
(Sexplib0.Sexp.t -> 'a) ->
Sexplib0.Sexp.t ->
'a css_global_valuesval __css_global_values_of_sexp__ :
(Sexplib0.Sexp.t -> 'a) ->
Sexplib0.Sexp.t ->
'a css_global_valuesval compare_css_global_values :
('a -> 'a -> int) ->
'a css_global_values ->
'a css_global_values ->
intval css_global_values_sexp_grammar :
'a Sexplib0.Sexp_grammar.t ->
'a css_global_values Sexplib0.Sexp_grammar.tinclude 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 ] ->
tSet 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.
type display = [ | `Inline| `Block| `Inline_block| `List_item| `Table| `Inline_table| `None| `Inline_grid| display css_global_values
]type font_weight = [ | `Normal| `Bold| `Bolder| `Lighter| `Number of int| font_weight css_global_values
]val font :
size:Length.t ->
family:string list ->
?style:font_style ->
?weight:font_weight ->
?variant:font_variant ->
unit ->
ttype background_image = [ | `Url of string| `Linear_gradient of linear_gradient| `Radial_gradient of radial_gradient
]type vertical_align = [ | `Top| `Bottom| `Middle| `Super| `Sub| vertical_align css_global_values
]type white_space = [ | `Normal| `Nowrap| `Pre| `Pre_line| `Pre_wrap| white_space css_global_values
]val margin :
?top:Auto_or_length.t ->
?bottom:Auto_or_length.t ->
?left:Auto_or_length.t ->
?right:Auto_or_length.t ->
unit ->
ttype border_style = [ | `None| `Hidden| `Dotted| `Dashed| `Solid| `Double| `Groove| `Ridge| `Inset| `Outset| border_style css_global_values
]type text_decoration_line = [ | `None| `Underline| `Overline| `Line_through| text_decoration_line css_global_values
]type text_decoration_style = [ | `Solid| `Double| `Dotted| `Dashed| `Wavy| text_decoration_style css_global_values
]val text_decoration :
?style:text_decoration_style ->
?color:[< Color.t ] ->
line:text_decoration_line list ->
unit ->
tval flex_container :
?inline:bool ->
?direction:[ `Row | `Row_reverse | `Column | `Column_reverse | `Default ] ->
?wrap:[ `Nowrap | `Wrap | `Wrap_reverse | `Default ] ->
?align_items:item_alignment ->
?align_content:content_alignment ->
?justify_content:justify_content ->
?row_gap:Length.t ->
?column_gap:Length.t ->
unit ->
tval flex_item :
?order:int ->
?basis:Auto_or_length.t ->
?shrink:float ->
grow:float ->
unit ->
ttype direction = [ | `Normal| `Reverse| `Alternate| `Alternate_reverse| direction css_global_values
]val animation :
name:string ->
duration:Core.Time_ns.Span.t ->
?delay:Core.Time_ns.Span.t ->
?direction:direction ->
?fill_mode:fill_mode ->
?iter_count:int ->
?timing_function:string ->
unit ->
tNote: You must include the names @keyframes in the stylesheet