package bonsai
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
A library for building dynamic webapps, using Js_of_ocaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
v0.17.0.tar.gz
sha256=c78c4476ee6b856846e2d0941e5965009d5e1b853e564b2b1bee61202f0b1ebb
doc/src/bonsai.web_ui_view/for_prt.ml.html
Source file for_prt.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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161open! Core open! Import type t = { header_cell : Vdom.Attr.t ; header_row : Vdom.Attr.t ; header : Vdom.Attr.t ; cell : Vdom.Attr.t ; cell_focused : Vdom.Attr.t ; row : Vdom.Attr.t ; row_focused : Vdom.Attr.t ; body : Vdom.Attr.t ; table : Vdom.Attr.t } module Default_table_styling = [%css stylesheet {| .table { background-color: var(--bg); color: var(--fg); border-collapse: collapse; } .header { background-color: var(--header-bg); color: var(--header-fg); } .header_row { } .header_cell { border: 1px solid var(--header-header-border); text-align: center; font-weight: bold; font-size: 0.9em; padding: 0.3em 0.5em; } .header_row:last-child .header_cell { border-bottom:1px solid var(--header-body-border); } .body { } .body_cell { padding: 0.3em 0.5em; font-size: 0.8em; } /* Backgrounds */ .body_row:nth-child(even) { background: var(--row-even-bg); color: var(--row-even-fg); } .body_row:nth-child(odd) { background: var(--row-odd-bg); color: var(--row-odd-fg); } .body_row.body_row_focused { background: var(--row-focused-bg); color: var(--row-focused-fg); } .body_cell.body_cell_focused { background: var(--cell-focused-bg); color: var(--cell-focused-fg); } /* Borders. Probably due to a browser bug, if we use full borders AND contain:paint (subset of strict) in PRT, we'll get weird, glitchy double borders. Instead, cells/rows (except for the last cell/row) only paint their top/left borders. */ .body_row { border-width: 1px 0 0 0; } .body_row:last-child { border-width: 1px 0 1px 0; } .body_cell { border-width: 0 0 0 1px; } .body_cell:last-child { border-width: 0 1px 0 1px; } .body_row, .body_cell { border-style: solid; border-color: var(--body-body-border); } .body_row.body_row_focused, .body_row_focused > .body_cell { border-color: var(--row-focused-border); } /* `.body_row:has(+ .body_row_focused)`, or other uses of the css `+` selector applied to rows, result in a massively slow "Recalculate Styles" step. For some reason, this does not have the same performance problem. This is likely a chrome bug. */ .body_row_focused ~ .body_row { border-color: var(--row-focused-border); } .body_row_focused ~ .body_row ~ .body_row { border-color: var(--body-body-border); } .body_row_focused ~ .body_row:last-child { border-bottom-color: var(--body-body-border); } |}] let table_attr (constants : Constants.t) = let vars = Default_table_styling.Variables.set ~bg:(Css_gen.Color.to_string_css constants.primary.background) ~fg:(Css_gen.Color.to_string_css constants.primary.foreground) ~header_bg:(Css_gen.Color.to_string_css constants.table.header_row.background) ~header_fg:(Css_gen.Color.to_string_css constants.table.header_row.foreground) ~row_even_bg:(Css_gen.Color.to_string_css constants.table.body_row_even.background) ~row_even_fg:(Css_gen.Color.to_string_css constants.table.body_row_even.foreground) ~row_odd_bg:(Css_gen.Color.to_string_css constants.table.body_row_odd.background) ~row_odd_fg:(Css_gen.Color.to_string_css constants.table.body_row_odd.foreground) ~cell_focused_bg: (Css_gen.Color.to_string_css constants.table.body_cell_focused.background) ~cell_focused_fg: (Css_gen.Color.to_string_css constants.table.body_cell_focused.foreground) ~row_focused_bg: (Css_gen.Color.to_string_css constants.table.body_row_focused.background) ~row_focused_fg: (Css_gen.Color.to_string_css constants.table.body_row_focused.foreground) ~row_focused_border: (Css_gen.Color.to_string_css constants.table.body_row_focused_border) ~header_header_border: (Css_gen.Color.to_string_css constants.table.header_header_border) ~body_body_border:(Css_gen.Color.to_string_css constants.table.body_body_border) ~header_body_border:(Css_gen.Color.to_string_css constants.table.header_body_border) () in Vdom.Attr.many [ vars; Default_table_styling.table ] ;; let default constants = { header_cell = Default_table_styling.header_cell ; header_row = Default_table_styling.header_row ; header = Default_table_styling.header ; cell = Default_table_styling.body_cell ; cell_focused = Default_table_styling.body_cell_focused ; row = Default_table_styling.body_row ; row_focused = Default_table_styling.body_row_focused ; body = Default_table_styling.body ; table = table_attr constants } ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>