package sosie

  1. Overview
  2. Docs

Source file snapshot_types.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
(** Snapshot types for sosie's resolved layout+style trees.

    See {!Snapshot_types} (the .mli) for documentation. *)

type rect = { x : float; y : float; w : float; h : float }

type css_value =
  | Px of float
  | Num of float
  | Color of int
  | Str of string

type border = {
  width : css_value;
  style : css_value;
  color : css_value;
}

type visual_properties = {
  display : css_value;
  visibility : css_value;
  opacity : css_value;
  color : css_value;
  background_color : css_value;
  font_family : css_value;
  font_size : css_value;
  font_weight : css_value;
  line_height : css_value;
  text_align : css_value;
  text_decoration : css_value;
  border_top : border;
  border_right : border;
  border_bottom : border;
  border_left : border;
  border_radius : css_value;
  box_shadow : css_value;
  overflow_x : css_value;
  overflow_y : css_value;
  z_index : css_value;
  cursor : css_value;
  text_align_last : css_value;
  text_decoration_skip_ink : css_value;
  text_underline_offset : css_value;
  text_shadow : css_value;
  text_combine_upright : css_value;
  text_emphasis_style : css_value;
  text_emphasis_color : css_value;
  text_emphasis_position : css_value;
  webkit_text_stroke_width : css_value;
  webkit_text_stroke_color : css_value;
  font_palette : css_value;
  writing_mode : css_value;
  direction : css_value;
  appearance : css_value;
  accent_color : css_value;
  image_rendering : css_value;
  outline_width : css_value;
  outline_style : css_value;
  outline_color : css_value;
  outline_offset : css_value;
  fill : css_value;
  stroke : css_value;
  stroke_width : css_value;
}

type node = {
  tag : string;
  attributes : (string * string) list;
  bounds : rect;
  styles : visual_properties;
  text : string option;
  paint_order : int;
  children : node list;
}

type snapshot = {
  version : int;
  url : string;
  viewport : int * int;
  color_scheme : [ `Light | `Dark ];
  root : node;
}