package css

  1. Overview
  2. Docs

Module Css.PSource

Properties

Properties

Sourcetype 'a value = {
  1. v : 'a T.p_value;
  2. loc : T.loc;
  3. important : bool;
}

Parsed property values, with location and important flag.

Sourcetype 'a prop

A property definition.

Sourceval initial : 'a prop -> 'a

Initial (i.e. default) value of property.

Sourceval name : 'a prop -> string

Name of property.

Sourceval parser : 'a prop -> T.ctx -> start:T.pos -> 'a value Angstrom.t

Parser to parser values for the given property.

Sourceval inherited : 'a prop -> bool

Whether property is inherited or not.

Sourceval to_string : 'a prop -> 'a -> string

to_string p v applies the property's function passed at its creation to map a value of the type of the property to a string.

Sourceval value_to_string : 'a prop -> 'a T.p_value -> string

value_to_string p v returns a string representation of the given value for the given property, using T.string_of_p_value with to_string p.

Sourceval pp : 'a prop -> Format.formatter -> 'a -> unit

Returns the property pretty-printer.

Sourceval pp_value : 'a prop -> Format.formatter -> 'a T.p_value -> unit

Returns T.pp_p_value with the pretty-printer for the given property.

Creating properties

Sourceval mk_prop : string -> ?register_prop:bool -> ?inherited:bool -> 'a -> ('a -> string) -> ?pp:(Format.formatter -> 'a -> unit) -> (T.ctx -> 'a Angstrom.t) -> 'a prop

mk_prop name v to_string parser creates a new property name with initial value v, the to_string function to map a value to a string and an Angstrom parser. This parser takes a context T.ctx and returns a value of the same type as v or fails to indicate that no value of this type could be parsed. Optional arguments:

  • register_prop (default is true) indicates whether to register the property so that its parser is used when encoutering a declaration with this property in CSS.
  • inherited (default is false) specifies whether the value for this property is inherited from parent or not. This is used in computations.
  • pp can be used to specify a pretty-printing function for values of this property. If none is provided, a default one is created using to_string.

Property maps

Sourcemodule Key : sig ... end
Sourceval compare_prop : 'a prop -> 'b prop -> int
Sourcemodule M : sig ... end
Sourceval empty : 'a M.t
Sourceval fold : ('a -> 'b -> 'b) -> 'a M.t -> 'b -> 'b
Sourceval iter : ('a -> unit) -> 'a M.t -> unit
Sourceval filter : ('a -> bool) -> 'a M.t -> 'a M.t
Sourceval to_list : 'a M.t -> 'a list
Sourceval merge : 'a M.t -> 'a M.t -> 'a M.t

Mapping properties to parsed values

Sourcetype binding =
  1. | B : 'a prop * 'a value -> binding
Sourceval opt : t -> 'a prop -> 'a value option
Sourceval get : t -> 'a prop -> 'a T.p_value
Sourceval add_v : t -> 'a prop -> 'a value -> t
Sourceval add : t -> 'a prop -> 'a T.p_value -> T.loc -> bool -> t
Sourceval add_vl : t -> 'a prop -> ('a * T.loc) -> t
Sourceval add_with_important : t -> 'a prop -> 'a T.p_value -> T.loc -> T.ctx -> t Angstrom.t
Sourceval set_important : t -> 'a prop -> bool -> t
Sourceval v_initial : 'a prop -> 'a value
Sourceval filter_inherited : t -> t
Sourceval is_var : 'a prop -> bool
Sourcemodule type Prop_space = sig ... end
Sourceval mk_prop_space : string -> (module Prop_space)

Predefined CSS properties (in Css space)

Sourceval accent_color : T.accent_color prop
Sourceval align_content : T.align_content prop
Sourceval align_items : T.align_items prop
Sourceval align_self : T.align_self prop
Sourceval aspect_ratio : T.aspect_ratio prop
Sourceval background_attachment : T.background_attachment prop
Sourceval background_clip : T.background_clip prop
Sourceval background_color : T.background_color prop
Sourceval background_image : T.background_image prop
Sourceval background_origin : T.background_origin prop
Sourceval background_position_x : T.background_position_x prop
Sourceval background_position_y : T.background_position_y prop
Sourceval background_repeat : T.background_repeat prop
Sourceval background_size : T.background_size prop
Sourceval block_size : T.size prop
Sourceval border_collapse : T.border_collapse prop
Sourceval border_spacing : T.border_spacing prop
Sourceval border_top_color : T.color prop
Sourceval border_top_style : T.line_style prop
Sourceval border_top_width : T.border_width prop
Sourceval border_right_color : T.color prop
Sourceval border_right_style : T.line_style prop
Sourceval border_right_width : T.border_width prop
Sourceval border_bottom_color : T.color prop
Sourceval border_bottom_style : T.line_style prop
Sourceval border_bottom_width : T.border_width prop
Sourceval border_left_color : T.color prop
Sourceval border_left_style : T.line_style prop
Sourceval border_left_width : T.border_width prop
Sourceval color : T.color prop
Sourceval display : T.display prop
Sourceval flex_basis : T.flex_basis prop
Sourceval flex_direction : T.flex_direction prop
Sourceval flex_grow : T.number prop
Sourceval flex_shrink : T.number prop
Sourceval flex_wrap : T.flex_wrap prop
Sourceval font_family : T.font_family prop
Sourceval font_kerning : T.font_kerning prop
Sourceval font_size : T.font_size prop
Sourceval font_stretch : T.font_stretch prop
Sourceval font_style : T.font_style prop
Sourceval font_variant_alternates : T.font_variant_alternates prop
Sourceval font_variant_caps : T.font_variant_caps prop
Sourceval font_variant_east_asian : T.font_variant_east_asian prop
Sourceval font_variant_emoji : T.font_variant_emoji prop
Sourceval font_variant_ligatures : T.font_variant_ligatures prop
Sourceval font_variant_numeric : T.font_variant_numeric prop
Sourceval font_variant_position : T.font_variant_position prop
Sourceval font_weight : T.font_weight prop
Sourceval height : T.height prop
Sourceval inline_size : T.size prop
Sourceval justify_content : T.justify_content prop
Sourceval justify_items : T.justify_items prop
Sourceval justify_self : T.justify_self prop
Sourceval line_height : T.line_height prop
Sourceval list_style_image : T.list_style_image prop
Sourceval list_style_position : T.list_style_position prop
Sourceval list_style_type : T.list_style_type prop
Sourceval margin_top : T.margin prop
Sourceval margin_right : T.margin prop
Sourceval margin_bottom : T.margin prop
Sourceval margin_left : T.margin prop
Sourceval max_height : T.max_size prop
Sourceval max_width : T.max_size prop
Sourceval min_height : T.size prop
Sourceval min_width : T.size prop
Sourceval opacity : T.opacity prop
Sourceval padding_top : T.padding prop
Sourceval padding_right : T.padding prop
Sourceval padding_bottom : T.padding prop
Sourceval padding_left : T.padding prop
Sourceval position : T.position prop
Sourceval text_align : T.text_align prop
Sourceval text_align_last : T.text_align_last prop
Sourceval vertical_align : T.vertical_align prop
Sourceval visibility : T.visibility prop
Sourceval white_space : T.white_space prop
Sourceval word_spacing : T.word_spacing prop
Sourceval width : T.width prop
OCaml

Innovation. Community. Security.