package virtual_dom_toplayer
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
OCaml bindings for the floating positioning library for 'toplevel' virtual dom components
Install
dune-project
Dependency
Authors
Maintainers
Sources
virtual_dom_toplayer-v0.17.0.tar.gz
sha256=b525b0ba3607f142d417fe6edf1a08dbed86ae4e817680fb9bc191959b7a3aea
doc/src/virtual_dom_toplayer.floating_positioning/bindings.ml.html
Source file bindings.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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575[@@@js.dummy "!! This code has been generated by gen_js_api !!"] [@@@ocaml.warning "-7-32-39"] open! Core open! Js_of_ocaml open! Gen_js_api open Custom_converters module Alignment = struct type t = | Start | End [@@deriving sexp, sexp_grammar, equal, compare, enumerate] let rec t_of_js : Ojs.t -> t = fun (x2 : Ojs.t) -> let x3 = x2 in match Ojs.string_of_js x3 with | "start" -> Start | "end" -> End | _ -> assert false and t_to_js : t -> Ojs.t = fun (x1 : t) -> match x1 with | Start -> Ojs.string_to_js "start" | End -> Ojs.string_to_js "end" ;; end module Placement = struct type t = | Top | Top_start | Top_end | Bottom | Bottom_start | Bottom_end | Right | Right_start | Right_end | Left | Left_start | Left_end [@@deriving sexp, sexp_grammar, equal, compare, enumerate] let rec t_of_js : Ojs.t -> t = fun (x5 : Ojs.t) -> let x6 = x5 in match Ojs.string_of_js x6 with | "top" -> Top | "top-start" -> Top_start | "top-end" -> Top_end | "bottom" -> Bottom | "bottom-start" -> Bottom_start | "bottom-end" -> Bottom_end | "right" -> Right | "right-start" -> Right_start | "right-end" -> Right_end | "left" -> Left | "left-start" -> Left_start | "left-end" -> Left_end | _ -> assert false and t_to_js : t -> Ojs.t = fun (x4 : t) -> match x4 with | Top -> Ojs.string_to_js "top" | Top_start -> Ojs.string_to_js "top-start" | Top_end -> Ojs.string_to_js "top-end" | Bottom -> Ojs.string_to_js "bottom" | Bottom_start -> Ojs.string_to_js "bottom-start" | Bottom_end -> Ojs.string_to_js "bottom-end" | Right -> Ojs.string_to_js "right" | Right_start -> Ojs.string_to_js "right-start" | Right_end -> Ojs.string_to_js "right-end" | Left -> Ojs.string_to_js "left" | Left_start -> Ojs.string_to_js "left-start" | Left_end -> Ojs.string_to_js "left-end" ;; end module Strategy = struct type t = | Absolute | Fixed [@@deriving sexp, sexp_grammar, equal, compare, enumerate] let rec t_of_js : Ojs.t -> t = fun (x8 : Ojs.t) -> let x9 = x8 in match Ojs.string_of_js x9 with | "absolute" -> Absolute | "fixed" -> Fixed | _ -> assert false and t_to_js : t -> Ojs.t = fun (x7 : t) -> match x7 with | Absolute -> Ojs.string_to_js "absolute" | Fixed -> Ojs.string_to_js "fixed" ;; end module Offset = struct type t = { main_axis : float ; cross_axis : float } [@@deriving sexp, sexp_grammar, equal, compare] let rec t_of_js : Ojs.t -> t = fun (x11 : Ojs.t) -> { main_axis = Ojs.float_of_js (Ojs.get_prop_ascii x11 "mainAxis") ; cross_axis = Ojs.float_of_js (Ojs.get_prop_ascii x11 "crossAxis") } and t_to_js : t -> Ojs.t = fun (x10 : t) -> Ojs.obj [| "mainAxis", Ojs.float_to_js x10.main_axis ; "crossAxis", Ojs.float_to_js x10.cross_axis |] ;; end module Middleware = struct type t = Ojs.t let rec t_of_js : Ojs.t -> t = fun (x13 : Ojs.t) -> x13 and t_to_js : t -> Ojs.t = fun (x12 : Ojs.t) -> x12 module Offset = struct let create : Offset.t -> t = fun (x14 : Offset.t) -> t_of_js (Ojs.call (Ojs.get_prop_ascii Ojs.global "FloatingUIDOM") "offset" [| Offset.t_to_js x14 |]) ;; end module Size = struct module Options = struct module Apply_options = struct type t = { available_width : float ; available_height : float } let rec t_of_js : Ojs.t -> t = fun (x16 : Ojs.t) -> { available_width = Ojs.float_of_js (Ojs.get_prop_ascii x16 "availableWidth") ; available_height = Ojs.float_of_js (Ojs.get_prop_ascii x16 "availableHeight") } and t_to_js : t -> Ojs.t = fun (x15 : t) -> Ojs.obj [| "availableWidth", Ojs.float_to_js x15.available_width ; "availableHeight", Ojs.float_to_js x15.available_height |] ;; end type t = { apply : Apply_options.t -> unit } let rec t_of_js : Ojs.t -> t = fun (x19 : Ojs.t) -> { apply = (fun (x20 : Apply_options.t) -> ignore (Ojs.apply (Ojs.get_prop_ascii x19 "apply") [| Apply_options.t_to_js x20 |])) } and t_to_js : t -> Ojs.t = fun (x17 : t) -> Ojs.obj [| ( "apply" , Ojs.fun_to_js 1 (fun (x18 : Ojs.t) -> x17.apply (Apply_options.t_of_js x18)) ) |] ;; end let create : Options.t -> t = fun (x21 : Options.t) -> t_of_js (Ojs.call (Ojs.get_prop_ascii Ojs.global "FloatingUIDOM") "size" [| Options.t_to_js x21 |]) ;; end module Flip = struct module Options = struct type t = { padding : float option } let rec t_of_js : Ojs.t -> t = fun (x24 : Ojs.t) -> { padding = Ojs.option_of_js Ojs.float_of_js (Ojs.get_prop_ascii x24 "padding") } and t_to_js : t -> Ojs.t = fun (x22 : t) -> Ojs.obj [| "padding", Ojs.option_to_js Ojs.float_to_js x22.padding |] ;; end let create : Options.t -> t = fun (x26 : Options.t) -> t_of_js (Ojs.call (Ojs.get_prop_ascii Ojs.global "FloatingUIDOM") "flip" [| Options.t_to_js x26 |]) ;; end module Shift = struct module Limiter = struct module Options = struct type t = { main_axis : bool ; cross_axis : bool } let rec t_of_js : Ojs.t -> t = fun (x28 : Ojs.t) -> { main_axis = Ojs.bool_of_js (Ojs.get_prop_ascii x28 "mainAxis") ; cross_axis = Ojs.bool_of_js (Ojs.get_prop_ascii x28 "crossAxis") } and t_to_js : t -> Ojs.t = fun (x27 : t) -> Ojs.obj [| "mainAxis", Ojs.bool_to_js x27.main_axis ; "crossAxis", Ojs.bool_to_js x27.cross_axis |] ;; end type t = Ojs.t let rec t_of_js : Ojs.t -> t = fun (x30 : Ojs.t) -> x30 and t_to_js : t -> Ojs.t = fun (x29 : Ojs.t) -> x29 let create : Options.t -> t = fun (x31 : Options.t) -> t_of_js (Ojs.call (Ojs.get_prop_ascii Ojs.global "FloatingUIDOM") "limitShift" [| Options.t_to_js x31 |]) ;; end module Options = struct type t = { padding : float option ; limiter : Limiter.t } let rec t_of_js : Ojs.t -> t = fun (x34 : Ojs.t) -> { padding = Ojs.option_of_js Ojs.float_of_js (Ojs.get_prop_ascii x34 "padding") ; limiter = Limiter.t_of_js (Ojs.get_prop_ascii x34 "limiter") } and t_to_js : t -> Ojs.t = fun (x32 : t) -> Ojs.obj [| "padding", Ojs.option_to_js Ojs.float_to_js x32.padding ; "limiter", Limiter.t_to_js x32.limiter |] ;; end let create : Options.t -> t = fun (x36 : Options.t) -> t_of_js (Ojs.call (Ojs.get_prop_ascii Ojs.global "FloatingUIDOM") "shift" [| Options.t_to_js x36 |]) ;; end module Auto_placement = struct module Options = struct type t = { alignment : Alignment.t option ; padding : float option } let rec t_of_js : Ojs.t -> t = fun (x40 : Ojs.t) -> { alignment = Ojs.option_of_js Alignment.t_of_js (Ojs.get_prop_ascii x40 "alignment") ; padding = Ojs.option_of_js Ojs.float_of_js (Ojs.get_prop_ascii x40 "padding") } and t_to_js : t -> Ojs.t = fun (x37 : t) -> Ojs.obj [| "alignment", Ojs.option_to_js Alignment.t_to_js x37.alignment ; "padding", Ojs.option_to_js Ojs.float_to_js x37.padding |] ;; end let create : Options.t -> t = fun (x43 : Options.t) -> t_of_js (Ojs.call (Ojs.get_prop_ascii Ojs.global "FloatingUIDOM") "autoPlacement" [| Options.t_to_js x43 |]) ;; end module Arrow = struct module Options = struct type t = { element : Dom_html.element Js.t ; padding : float option } let rec t_of_js : Ojs.t -> t = fun (x47 : Ojs.t) -> { element = Js.t_of_js Dom_html.element_of_js (Ojs.get_prop_ascii x47 "element") ; padding = Ojs.option_of_js Ojs.float_of_js (Ojs.get_prop_ascii x47 "padding") } and t_to_js : t -> Ojs.t = fun (x44 : t) -> Ojs.obj [| "element", Js.t_to_js Dom_html.element_to_js x44.element ; "padding", Ojs.option_to_js Ojs.float_to_js x44.padding |] ;; end let create : Options.t -> t = fun (x50 : Options.t) -> t_of_js (Ojs.call (Ojs.get_prop_ascii Ojs.global "FloatingUIDOM") "arrow" [| Options.t_to_js x50 |]) ;; end end module Reference_element = struct module Client_rect_object = struct type t = { width : float ; height : float ; x : float ; y : float ; top : float ; left : float ; right : float ; bottom : float } let rec t_of_js : Ojs.t -> t = fun (x52 : Ojs.t) -> { width = Ojs.float_of_js (Ojs.get_prop_ascii x52 "width") ; height = Ojs.float_of_js (Ojs.get_prop_ascii x52 "height") ; x = Ojs.float_of_js (Ojs.get_prop_ascii x52 "x") ; y = Ojs.float_of_js (Ojs.get_prop_ascii x52 "y") ; top = Ojs.float_of_js (Ojs.get_prop_ascii x52 "top") ; left = Ojs.float_of_js (Ojs.get_prop_ascii x52 "left") ; right = Ojs.float_of_js (Ojs.get_prop_ascii x52 "right") ; bottom = Ojs.float_of_js (Ojs.get_prop_ascii x52 "bottom") } and t_to_js : t -> Ojs.t = fun (x51 : t) -> Ojs.obj [| "width", Ojs.float_to_js x51.width ; "height", Ojs.float_to_js x51.height ; "x", Ojs.float_to_js x51.x ; "y", Ojs.float_to_js x51.y ; "top", Ojs.float_to_js x51.top ; "left", Ojs.float_to_js x51.left ; "right", Ojs.float_to_js x51.right ; "bottom", Ojs.float_to_js x51.bottom |] ;; end module Virtual_element = struct type t = { get_bounding_client_rect : unit -> Client_rect_object.t } let rec t_of_js : Ojs.t -> t = fun (x54 : Ojs.t) -> { get_bounding_client_rect = (fun () -> Client_rect_object.t_of_js (Ojs.apply (Ojs.get_prop_ascii x54 "getBoundingClientRect") [||])) } and t_to_js : t -> Ojs.t = fun (x53 : t) -> Ojs.obj [| ( "getBoundingClientRect" , Ojs.fun_to_js 1 (fun _ -> Client_rect_object.t_to_js (x53.get_bounding_client_rect ())) ) |] ;; end type t = [ `Virtual of Virtual_element.t | `Dom of Dom_html.element Js.t ] let rec t_to_js : t -> Ojs.t = fun (x55 : [ `Virtual of Virtual_element.t | `Dom of Dom_html.element Js.t ]) -> match x55 with | `Virtual x56 -> Virtual_element.t_to_js x56 | `Dom x57 -> Js.t_to_js Dom_html.element_to_js x57 ;; end module Compute_position = struct module Options = struct type t = { placement : Placement.t option ; strategy : Strategy.t ; middleware : Middleware.t list } let rec t_of_js : Ojs.t -> t = fun (x65 : Ojs.t) -> { placement = Ojs.option_of_js Placement.t_of_js (Ojs.get_prop_ascii x65 "placement") ; strategy = Strategy.t_of_js (Ojs.get_prop_ascii x65 "strategy") ; middleware = Ojs.list_of_js Middleware.t_of_js (Ojs.get_prop_ascii x65 "middleware") } and t_to_js : t -> Ojs.t = fun (x62 : t) -> Ojs.obj [| "placement", Ojs.option_to_js Placement.t_to_js x62.placement ; "strategy", Strategy.t_to_js x62.strategy ; "middleware", Ojs.list_to_js Middleware.t_to_js x62.middleware |] ;; end module Then_args = struct type arrow = { x : float option ; y : float option } let rec arrow_of_js : Ojs.t -> arrow = fun (x71 : Ojs.t) -> { x = Ojs.option_of_js Ojs.float_of_js (Ojs.get_prop_ascii x71 "x") ; y = Ojs.option_of_js Ojs.float_of_js (Ojs.get_prop_ascii x71 "y") } and arrow_to_js : arrow -> Ojs.t = fun (x68 : arrow) -> Ojs.obj [| "x", Ojs.option_to_js Ojs.float_to_js x68.x ; "y", Ojs.option_to_js Ojs.float_to_js x68.y |] ;; type middleware_data = { arrow : arrow option } let rec middleware_data_of_js : Ojs.t -> middleware_data = fun (x76 : Ojs.t) -> { arrow = Ojs.option_of_js arrow_of_js (Ojs.get_prop_ascii x76 "arrow") } and middleware_data_to_js : middleware_data -> Ojs.t = fun (x74 : middleware_data) -> Ojs.obj [| "arrow", Ojs.option_to_js arrow_to_js x74.arrow |] ;; type t = { x : float ; y : float ; placement : Placement.t ; strategy : Strategy.t ; middleware_data : middleware_data option } let rec t_of_js : Ojs.t -> t = fun (x80 : Ojs.t) -> { x = Ojs.float_of_js (Ojs.get_prop_ascii x80 "x") ; y = Ojs.float_of_js (Ojs.get_prop_ascii x80 "y") ; placement = Placement.t_of_js (Ojs.get_prop_ascii x80 "placement") ; strategy = Strategy.t_of_js (Ojs.get_prop_ascii x80 "strategy") ; middleware_data = Ojs.option_of_js middleware_data_of_js (Ojs.get_prop_ascii x80 "middlewareData") } and t_to_js : t -> Ojs.t = fun (x78 : t) -> Ojs.obj [| "x", Ojs.float_to_js x78.x ; "y", Ojs.float_to_js x78.y ; "placement", Placement.t_to_js x78.placement ; "strategy", Strategy.t_to_js x78.strategy ; "middlewareData", Ojs.option_to_js middleware_data_to_js x78.middleware_data |] ;; end type t = Ojs.t let rec t_of_js : Ojs.t -> t = fun (x83 : Ojs.t) -> x83 and t_to_js : t -> Ojs.t = fun (x82 : Ojs.t) -> x82 let then_ : t -> (Then_args.t -> unit) -> unit = fun (x86 : t) (x84 : Then_args.t -> unit) -> ignore (Ojs.call (t_to_js x86) "then" [| Ojs.fun_to_js 1 (fun (x85 : Ojs.t) -> x84 (Then_args.t_of_js x85)) |]) ;; let create : anchor:Reference_element.t -> floating:Dom_html.element Js.t -> Options.t -> t = fun ~anchor:(x87 : Reference_element.t) ~floating:(x88 : Dom_html.element Js.t) (x90 : Options.t) -> t_of_js (Ojs.call (Ojs.get_prop_ascii Ojs.global "FloatingUIDOM") "computePosition" [| Reference_element.t_to_js x87 ; Js.t_to_js Dom_html.element_to_js x88 ; Options.t_to_js x90 |]) ;; end module Auto_update_handle = struct type t = Ojs.t let rec t_of_js : Ojs.t -> t = fun (x92 : Ojs.t) -> x92 and t_to_js : t -> Ojs.t = fun (x91 : Ojs.t) -> x91 let create : anchor:Reference_element.t -> floating:Dom_html.element Js.t -> update:(unit -> unit) -> t = fun ~anchor:(x93 : Reference_element.t) ~floating:(x94 : Dom_html.element Js.t) ~update:(x96 : unit -> unit) -> t_of_js (Ojs.call (Ojs.get_prop_ascii Ojs.global "FloatingUIDOM") "autoUpdate" [| Reference_element.t_to_js x93 ; Js.t_to_js Dom_html.element_to_js x94 ; Ojs.fun_to_js 1 (fun _ -> x96 ()) |]) ;; let cleanup : t -> unit = fun (x97 : t) -> ignore (Ojs.apply (t_to_js x97) [||]) end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>