package css
Install
Dune Dependency
Authors
Maintainers
Sources
md5=bc4bdcf47b37c7bd50bf9f31c391dcd2
sha512=8fa12c193638ba8c2d307f48e477cdac839ca25f865f7f350bc7675086c3c4a70bc1e5936d35d64aab9d8da2c9806005be70c59ac3d7f3c407a3861f6e0a7cf8
doc/css/Css/T/index.html
Module Css.T
Source
Types and base definitions.
Utils
mk_pp f
creates a formatter -> x -> unit
function from the given x -> string
function.
string_of_list sep to_string l
is String.concat sep (List.map to_string l)
.
mk_of_string to_string l
returns a function mapping strings to values, according to the reverse function to_string
. Optional argument case_sensitive
(default is true
) indicates where case is taken into account when mapping from string to values. The returned function returns None
if the given string could not be mapped to a value, else Some value
.
Positions and locations
val pos_of_string_at :
?fname:string ->
?from:(int * Lexing.position) ->
string ->
int ->
Lexing.position
pos_of_string_at str at
returns the pos
corresponding to offset at
in the given string. Optional arguments:
fname
specifies a filename to use in the returned position.from
, as a pair(offset, p)
, specifies to start atoffset
, usingp
as initialpos
structure. Thefname
in returned position still is the optionafname
argument.
Parsing contexts
type ctx = {
get_pos : pos Angstrom.t;
last_pos : pos Angstrom.t;
string_of_loc : loc -> string;
}
A context is used in parsers to retrieve location information. get_pos
returns the current position. last_pos
returns the most advanced position seen. string_of_loc
returns the string corresponding to the given location.
ctx get_pos
builds a new context with the given get_pos
functions.
string_ctx str
creates a context from the given string str
. Computing of pos
structure is cached. fname
can be specified to set this field in positions.
Error handling
type parse_error =
| Unterminated_string
| Unterminated_comment
| Unterminated_char_escape
| Invalid_iri of string * Iri.error
| Other of string
Parsing errors.
Global keywords
A 'a p_value
is either a global keyword, a variable (`Var (name, optional string value)
) or a value (`V 'a
). We do not know at variable definition time in which property this variable will be used. The parser associated to a property will parse the optional default variable value when the variable is expanded.
Parsed strings, with a quoted
flag indicating whether string is quoted.
CSS Value types
type rel_length_unit = [
| `em
(*Font size of the element.
*)| `ex
(*x-height of the element's font.
*)| `cap
(*Cap height (the nominal height of capital letters) of the element's font.
*)| `ch
(*Average character advance of a narrow glyph in the element's font, as represented by the "0" (ZERO, U+0030) glyph.
*)| `ic
(*Average character advance of a full width glyph in the element's font, as represented by the "水" (CJK water ideograph, U+6C34) glyph.
*)| `rem
(*Font size of the root element.
*)| `lh
(*Line height of the element.
*)| `rlh
(*Line height of the root element.
*)| `vw
(*1% of viewport's width.
*)| `vh
(*1% of viewport's height.
*)| `vi
(*1% of viewport's size in the root element's inline axis.
*)| `vb
(*1% of viewport's size in the root element's block axis.
*)| `vmin
(*1% of viewport's smaller dimension.
*)| `vmax
(*1% of viewport's larger dimension.
*)| `cqw
(*1% of a query container's width
*)| `cqh
(*1% of a query container's height
*)| `cqi
(*1% of a query container's inline size
*)| `cqb
(*1% of a query container's block size
*)| `cqmin
(*The smaller value of cqi or cqb
*)| `cqmax
(*The larger value of cqi or cqb
*)
]
val rel_length_units :
[> `cap
| `ch
| `cqb
| `cqh
| `cqi
| `cqmax
| `cqmin
| `cqw
| `em
| `ex
| `ic
| `lh
| `rem
| `rlh
| `vb
| `vh
| `vi
| `vmax
| `vmin
| `vw ]
list
type abs_length_unit = [
| `cm
(*Centimeters 1cm = 96px/2.54
*)| `mm
(*Millimeters 1mm = 1/10th of 1cm
*)| `q
| `In
(*Inches 1in = 2.54cm = 96px
*)| `pc
(*Picas 1pc = 1/6th of 1in
*)| `pt
(*Points 1pt = 1/72th of 1in
*)| `px
(*Pixels 1px = 1/96th of 1in
*)
]
type angle_unit = [
| `deg
(*Degrees There are 360 degrees in a full circle.
*)| `grad
(*Gradians There are 400 gradians in a full circle.
*)| `rad
(*Radians There are 2__pi__ radians in a full circle.
*)| `turn
(*Turns There is 1 turn in a full circle.
*)
]
type system_color = [
| `AccentColorText
| `ActiveText
| `ButtonBorder
| `ButtonFace
| `ButtonText
| `Canvas
| `CanvasText
| `Field
| `FieldText
| `GrayText
| `Highlight
| `HighlightText
| `LinkText
| `Mark
| `MarkText
| `SelectedItem
| `SelectedItemText
| `VisitedText
]
val system_colors :
[> `AccentColorText
| `ActiveText
| `ButtonBorder
| `ButtonFace
| `ButtonText
| `Canvas
| `CanvasText
| `Field
| `FieldText
| `GrayText
| `Highlight
| `HighlightText
| `LinkText
| `Mark
| `MarkText
| `SelectedItem
| `SelectedItemText
| `VisitedText ]
list
type color = [
| `Rgba of float * float * float * float
| `Named_color of string
| `System_color of system_color
| color_kw
]
type axis_position =
| Single_kw of trblc
| XY of x_position_kw axis_pos * y_position_kw axis_pos
val content_position_lr_kws :
[> `Center | `End | `Flex_end | `Flex_start | `Left | `Right | `Start ] list
val self_position_kws :
[> `Center
| `End
| `Flex_end
| `Flex_start
| `Self_end
| `Self_start
| `Start ]
list
val self_position_lr_kws :
[> `Center
| `End
| `Flex_end
| `Flex_start
| `Left
| `Right
| `Self_end
| `Self_start
| `Start ]
list
val content_distribution_kws :
[> `Space_around | `Space_between | `Space_evenly | `Stretch ] list
type align_content = [
| align_content_kw
| baseline_position
| content_distribution
| content_position
| `Safe_pos of content_position
| `Unsafe_pos of content_position
]
type align_items = [
| baseline_position
| self_position
| `Safe_self_pos of self_position
| `Unsafe_self_pos of self_position
| align_items_kw
]
type display_internal = [
| `Table_row_group
| `Table_header_group
| `Table_row
| `Table_cell
| `Table_column_group
| `Table_column
| `Table_caption
| `Ruby_base
| `Ruby_base_container
| `Ruby_text
| `Ruby_text_container
]
val display_legacy_kws :
[> `Inline_block | `Inline_flex | `Inline_grid | `Inline_table ] list
type font_family_generic_kw = [
| `Cursive
| `Emoji
| `Fantasy
| `Fangsong
| `Math
| `Monospace
| `Sans_serif
| `Serif
| `System_ui
| `Ui_monospace
| `Ui_rounded
| `Ui_sans_serif
| `Ui_serif
]
type font_size_kw = [
| `Large
| `Larger
| `Math
| `Medium
| `Small
| `Smaller
| `Xxx_large
| `Xx_large
| `Xx_small
| `X_large
| `X_small
]
type font_stretch_kw = [
| `Normal
| `Ultra_condensed
| `Extra_condensed
| `Semi_condensed
| `Condensed
| `Ultra_expanded
| `Extra_expanded
| `Semi_expanded
| `Expanded
]
type font_variant_alt = [
| `Historical_forms
| `Stylistic of string
| `Styleset of string list
| `Character_variant of string list
| `Swash of string
| `Ornaments of string
| `Annotation of string
]
val string_of_font_variant_alt :
[< `Annotation of string
| `Character_variant of string list
| `Historical_forms
| `Ornaments of string
| `Styleset of string list
| `Stylistic of string
| `Swash of string ] ->
string
type font_variant_east_asian_kw = [
| `Jis78
| `Jis83
| `Jis90
| `Jis04
| `Ruby
| `Proportional_width
| `Simplified
| `Traditional
| `Full_width
]
type font_variant_ligatures_kw = [
| `Common_ligatures
| `No_common_ligatures
| `Contextual
| `No_contextual
| `Discretionary_ligatures
| `No_discretionary_ligatures
| `Historical_ligatures
| `No_historical_ligatures
]
val font_variant_ligatures_kws :
[> `Common_ligatures
| `Contextual
| `Discretionary_ligatures
| `Historical_ligatures
| `No_common_ligatures
| `No_contextual
| `No_discretionary_ligatures
| `No_historical_ligatures ]
list
type font_variant_numeric_kw = [
| `Ordinal
| `Slashed_zero
| `Lining_nums
| `Oldstyle_nums
| `Proportional_nums
| `Tabular_nums
| `Diagonal_frations
| `Stacked_fractions
]
val font_variant_numeric_kws :
[> `Diagonal_frations
| `Lining_nums
| `Oldstyle_nums
| `Ordinal
| `Proportional_nums
| `Slashed_zero
| `Stacked_fractions
| `Tabular_nums ]
list
type system_font = {
family : font_family_ list;
size : font_size;
stretch : font_stretch;
style : font_style;
variant_alternates : font_variant_alternates;
variant_caps : font_variant_caps;
variant_east_asian : font_variant_east_asian;
variant_emoji : font_variant_emoji;
variant_ligatures : font_variant_ligatures;
variant_numeric : font_variant_numeric;
variant_position : font_variant_position;
weight : font_weight;
line_height : line_height;
}
val system_font :
?stretch:font_stretch ->
?style:font_style ->
?variant_alternates:font_variant_alternates ->
?variant_caps:font_variant_caps ->
?variant_east_asian:font_variant_east_asian ->
?variant_emoji:font_variant_emoji ->
?variant_ligatures:font_variant_ligatures ->
?variant_numeric:font_variant_numeric ->
?variant_position:font_variant_position ->
?weight:font_weight ->
?line_height:line_height ->
font_size ->
font_family_ list ->
system_font
type justify_content = [
| justify_content_kw
| content_distribution
| content_position_lr
| `Safe_pos_lr of content_position_lr
| `Unsafe_pos_lr of content_position_lr
]
type justify_items = [
| baseline_position
| self_position_lr
| `Safe_self_pos_lr of self_position_lr
| `Unsafe_self_pos_lr of self_position_lr
| `Legacy_lcr of [ `Left | `Center | `Right ]
| justify_items_kw
]
type justify_self = [
| baseline_position
| self_position_lr
| `Safe_self_pos_lr of self_position_lr
| `Unsafe_self_pos_lr of self_position_lr
| `Legacy_lcr of [ `Left | `Center | `Right ]
| justify_self_kw
]
type list_style_type = [
| list_style_type_kw
| `Ident_ of string
| `String_ of string
| `Symbols_ of string
]