package css
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ceee290f230eb786d59de6ffcf692695
sha512=9ee5de92d764a5bb5b7dac1bc48d5892ccd8425d4226842148aae3322bf7335a738cc695fb36a29e3f90a487750a922f7301f44b6e60bb8954e4ad508ae60116
doc/css/Css/C/index.html
Module Css.C
Source
Computing values.
Mapping properties to values
A Computed.t
maps a 'a
property to a value of type 'a
, if any.
opt t p
returns the computed value of p
in t
if present or else returns the initial value of p
.
filter_inherited t
returns bindings of t
where the property is inherited.
comp_global ~parent p v
returns value of p
according to global value v
, i.e. it returns the initial value of p
, of the value of p
in parent
.
get_p ~parent t p
returns value of p
in t
. If p
is not mapped in t
and p
is not inherited, returns initial value of p
. If p
is inherited, returns its value in parent
. If p
is not mapped in parent
, returns initial value of p
.
Computing functions
val accent_color :
root:'a ->
parent:t ->
'b ->
[< `Auto
| `Current_color
| `Named_color of string
| `Rgba of float * float * float * float
| `System_color of T.system_color
| `Transparent ] ->
T.accent_color
Computes font_size in px when possible from absolute size or size relative to parent.
val font_family :
root:'a ->
parent:'b ->
'c ->
[< T.font_family_ ] list ->
[> T.font_family_ ] list
Associating computation functions to properties
val comp :
(root:'a -> parent:t -> t -> 'b -> 'b) ->
'b P.prop ->
(module P.Prop_space) ->
root:'a ->
parent:t ->
t ->
'b P.value ->
Computed.binding P.M.t
comp f p ~root ~parent t v
computes value of property p
from its parsed value v
, in the context of root
and parent
maps. f
is applied on:
- the result of recursive expansion if
v
is a variable, - the result of
comp_global
ifv
is a global keyword, - else
v
.
The resulting computed value is then added to t
for property p
.
map ~root ~parent t v
returns v
, without any computation. This is the default computation for several properties.
register_prop_fun p f
registers f
as computation function for values of property p
. This can be used to override or specify the computation function of a property.
Computing from declarations
val compute_decl :
(module P.Prop_space) ->
root:t ->
parent:t ->
t ->
P.binding ->
Computed.binding P.M.t