package cascade
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
CSS generation and manipulation library for OCaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
cascade-1.0.0.tbz
sha256=c11bbdc7ab0eee8c03cd162e3e7fd1cb20de62beb13342b3b150a89264ee0056
sha512=43fd97a55c3b1dc4db5c87aa1a5a047d902e902ab2064af3a7c5bf945ebc333f8cd90ecca8013c17be5b950498eace8e0094ee4319eba408285e2bec8d7cdf7b
doc/src/cascade/values_intf.ml.html
Source file values_intf.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 576 577 578 579 580 581 582 583 584type meta = .. type component_values = Component.t list (** Parsed CSS component values preserved for fallback and invalid-value round-tripping. *) type invalid_value = component_values (** Spec-invalid value fragments preserved until optimization decides whether to drop the containing declaration. *) type custom_value = component_values (** CSS custom-property token stream. *) type 'a fallback = | Empty (* Empty fallback: var(--name,) *) | Empty2 (* 2-char empty fallback: var(--name, ) — matches tailwindcss output, likely a bug in tailwindcss *) | None (* No fallback: var(--name) *) | Fallback of 'a (* Value fallback: var(--name, value) *) | Syntax_fallback of component_values (* Syntactic declaration-value fallback when it is not a typed value. *) | Var_fallback of string (* Nested var fallback: var(--name, var(--fallback)) *) type 'a var = { name : string; fallback : 'a fallback; default : 'a option; layer : string option; meta : meta option; runtime : bool; (** When [true], a context never folds this var to its [default]: the [var()] reference is kept so a runtime stylesheet or script can still override the custom property. The [default] then acts only as a browser-time fallback hint. *) } type 'a env = { name : string; indices : int list; fallback : 'a option } type calc_op = Add | Sub | Mul | Div (** CSS Values 4 §10.7.1 math constants - emitted at the source byte sequence (e.g. [pi], [e]) rather than their floating-point evaluation, so pretty pp preserves [calc(2 * pi)] instead of writing [calc(6.28318530718)]. *) type math_const = Pi | E | Infinity | Neg_infinity | Nan (** CSS Values 4 §10.7 numeric math function arguments. Self-recursive so nested calls round-trip ([pow(2, sqrt(100))]) and arithmetic with constants stays as a tree ([(e - exp(1))]). *) type math_arg = | Lit of float | Dim of float * string (** A dimension argument (e.g. [1vw], [1%]). [sign(<dimension>)] only cares about the numeric coefficient; the unit is preserved for pretty pp. *) | Const of math_const | Var_arg of math_arg var | Op of math_arg * calc_op * math_arg | Parens_arg of math_arg | Math_call of math_fn (** CSS Values 4 §10.7 numeric math functions. Each arm preserves its source arg shape so pretty pp re-emits [name(args)]; the optimizer evaluates to [Num] under minify. *) and math_fn = | Sin of angle_arg | Cos of angle_arg | Tan of angle_arg | Asin of math_arg | Acos of math_arg | Atan of math_arg | Atan2 of math_arg * math_arg | Sqrt of math_arg | Exp of math_arg | Log of math_arg * math_arg option | Pow of math_arg * math_arg | Hypot of math_arg list | Sign_n of math_arg | Abs_n of math_arg (** [sin] / [cos] / [tan] accept an [<angle>] or unitless [<number>] expression (treated as radians). Arithmetic over angles ([22deg + 23deg]) and parentheses round-trip via [Operation] / [Grouped]. *) and angle_arg = | Deg of float | Rad of float | Turn of float | Grad of float | Numeric_arg of math_arg | Operation of angle_arg * calc_op * angle_arg | Grouped of angle_arg type 'a calc = | Var of 'a var | Val of 'a | Num of float | Math_const of math_const | Sibling_index | Sibling_count | Expr of 'a calc * calc_op * 'a calc | Nested of 'a calc (* Explicitly nested calc(), rendered as calc(inner) *) | Parens of 'a calc (* Parenthesized expression, rendered as (inner) *) | Math_fn of math_fn (* CSS Values 4 §10.7 numeric math functions ([sin], [cos], [hypot], ...). Pretty pp emits [name(args)] preserving source shape; minify pp / optimizer evaluates to [Num]. *) type attr_syntax = Length | Length_percentage | Color | Number | Percentage type attr_type = | Type of attr_syntax | Unit of string | Raw_string | Number_type type 'a attr_fallback = No_fallback | Empty_fallback | Attr_fallback of 'a type 'a attr_call = { name : string; type_ : attr_type option; fallback : 'a attr_fallback; } type length = | Px of float | Cm of float | Mm of float | Q of float | In of float | Pt of float | Pc of float | Rem of float | Em of float | Ex of float | Cap of float | Ic of float | Ric of float | Rlh of float | Pct of float | Vw of float | Vh of float | Vmin of float | Vmax of float | Vi of float | Vb of float | Dvh of float | Dvw of float | Dvmin of float | Dvmax of float | Lvh of float | Lvw of float | Lvmin of float | Lvmax of float | Svh of float | Svw of float | Svmin of float | Svmax of float | Cqw of float | Cqh of float | Cqi of float | Cqb of float | Cqmin of float | Cqmax of float | Ch of float | Lh of float | Dimension of { value : float; unit : string; repr : string } | Size | Auto | None | Normal (** [normal] keyword used by [letter-spacing], [word-spacing], [line-height], etc. when their value falls back to the user-agent default. *) | Zero | Inherit | Initial | Unset | Revert | Revert_layer | Fit_content | Fit_content_arg of length (** [fit-content(<length-percentage>)] - CSS Sizing 3 §5.1. The argument is a [<length-percentage>]; we store it via the [length] type because [length] already has a [Pct of float] case for the percentage form (a separate [length_percentage] would force a mutually-recursive type). *) | Content | Contain | Max_content | Min_content | Webkit_max_content | Webkit_min_content | Webkit_fit_content | Moz_max_content | Moz_min_content | Moz_fit_content | From_font | Hairline | Thin | Medium | Thick | Stretch | Clamp of length * length * length | Min of length list | Max of length list | Minmax of length * length | Round of string * length * length | Mod of length * length | Rem_fn of length * length | Hypot of length list | Abs of length | Sign of length | Calc_size of length * length calc | Anchor_size of string | Anchor of string option * string * length option | Attr of length attr_call (** CSS Values 5 §10 [attr(<attr-name> <attr-type>?, <fallback>?)] for typed-value contexts. *) | Env of length env | Var of length var | Calc of length calc type color_space = | Srgb | Srgb_linear | Display_p3 | A98_rgb | Prophoto_rgb | Rec2020 | Lab | Oklab | Xyz | Xyz_d50 | Xyz_d65 | Lch | Oklch | Hsl | Hwb type color_name = | Red | Blue | Green | White | Black | Yellow | Cyan | Magenta | Gray | Grey | Orange | Purple | Pink | Silver | Maroon | Fuchsia | Lime | Olive | Teal | Aqua | Alice_blue | Antique_white | Aquamarine | Azure | Beige | Bisque | Blanched_almond | Blue_violet | Brown | Burlywood | Cadet_blue | Chartreuse | Chocolate | Coral | Cornflower_blue | Cornsilk | Crimson | Dark_blue | Dark_cyan | Dark_goldenrod | Dark_gray | Dark_green | Dark_grey | Dark_khaki | Dark_magenta | Dark_olive_green | Dark_orange | Dark_orchid | Dark_red | Dark_salmon | Dark_sea_green | Dark_slate_blue | Dark_slate_gray | Dark_slate_grey | Dark_turquoise | Dark_violet | Deep_pink | Deep_sky_blue | Dim_gray | Dim_grey | Dodger_blue | Firebrick | Floral_white | Forest_green | Gainsboro | Ghost_white | Gold | Goldenrod | Green_yellow | Honeydew | Hot_pink | Indian_red | Indigo | Ivory | Khaki | Lavender | Lavender_blush | Lawn_green | Lemon_chiffon | Light_blue | Light_coral | Light_cyan | Light_goldenrod_yellow | Light_gray | Light_green | Light_grey | Light_pink | Light_salmon | Light_sea_green | Light_sky_blue | Light_slate_gray | Light_slate_grey | Light_steel_blue | Light_yellow | Lime_green | Linen | Medium_aquamarine | Medium_blue | Medium_orchid | Medium_purple | Medium_sea_green | Medium_slate_blue | Medium_spring_green | Medium_turquoise | Medium_violet_red | Midnight_blue | Mint_cream | Misty_rose | Moccasin | Old_lace | Olive_drab | Orange_red | Orchid | Pale_goldenrod | Pale_green | Pale_turquoise | Pale_violet_red | Papaya_whip | Peach_puff | Peru | Plum | Powder_blue | Rebecca_purple | Rosy_brown | Royal_blue | Saddle_brown | Salmon | Sandy_brown | Sea_green | Sea_shell | Sienna | Sky_blue | Slate_blue | Slate_gray | Slate_grey | Snow | Spring_green | Steel_blue | Tan | Thistle | Tomato | Turquoise | Violet | Wheat | White_smoke | Yellow_green type channel = | Int of int | Num of float | Pct of float | Var of channel var | None (** CSS Color 4 sec. 4.2.3 [none] sentinel. Carries through to the serialised output as the [none] keyword and participates in [color-mix] / relative-color substitution by adopting the other operand's analogous channel instead of being treated as a zero. *) type rgb = | Channels of { r : channel; g : channel; b : channel } | Var of rgb var type angle = | Deg of float | Rad of float | Turn of float | Grad of float | Round of string * angle * angle | Mod of angle * angle | Rem of angle * angle | Calc of angle calc | Var of angle var | Invalid of invalid_value (** Spec-invalid [<angle>] input (e.g. [asin(<angle>)] - inverse trig takes [<number>], not [<angle>]) that upstream tools preserve verbatim. The pretty-printer emits the tokens unchanged; the [Optimize.drop_invalid] pass removes any declaration whose typed value reduces to this arm under [--minify]. *) type alpha = | None | Num of float | Pct of float | Var of alpha var | Calc of alpha calc type hue = Unitless of float | Angle of angle | Var of hue var | Hue_none type component = | Num of float | Pct of float | Angle of hue | Var of component var | Calc of component calc | Component_none type percentage = | Pct of float | Num of float | Var of percentage var | Calc of percentage calc type length_percentage = | Length of length | Pct of float | Env of length_percentage env | Var of length_percentage var | Calc of length_percentage calc | Invalid of invalid_value (** Spec-invalid input cascade detected (e.g. [width: asin(sin(45deg))] - the inner reduction yields an angle, but [<length-percentage>] doesn't accept angles). Pretty-printer emits the tokens verbatim; [Optimize.drop_invalid] removes the declaration under [--minify]. *) type number_percentage = | Num of float | Pct of float | Var of number_percentage var | Calc of number_percentage calc type hue_interpolation = | Shorter | Longer | Increasing | Decreasing | Specified (** CSS Color 5 §13 [specified hue] - keep authored hue values without interpolation rotation. *) | Default (** CSS system colors - case-insensitive keywords that map to OS/browser colors *) type system_color = | Accent_color | Accent_color_text | Active_text | Button_border | Button_face | Button_text | Canvas | Canvas_text | Field | Field_text | Gray_text | Highlight | Highlight_text | Link_text | Mark | Mark_text | Selected_item | Selected_item_text | Visited_text (* WebKit-specific system colors *) | Webkit_focus_ring_color type color = | Hex of { r : int; g : int; b : int; a : int } (** A hex colour decoded to its sRGB byte components ([a = 255] when opaque). Every spelling ([#fff] / [#ffffff] / [#FFFFFF]) decodes to one node, so the printer picking the shortest spelling round-trips. *) | Authored_hex of { value : string; r : int; g : int; b : int; a : int } (** A parsed hex colour preserving the source spelling without the leading [#]. Optimisation folds this to the canonical semantic colour. *) | Rgb of rgb | Rgba of { rgb : rgb; a : alpha } | Hsl of { h : hue; s : percentage; l : percentage; a : alpha } | Hwb of { h : hue; w : percentage; b : percentage; a : alpha } | Color of { space : color_space; components : component list; alpha : alpha } | Relative_rgb of string | Relative_color of string * string (** [<fn>(from <origin> <c1> <c2> <c3> [/ <alpha>]?)] for any color function other than [rgb()] (CSS Color 5 §2). The first string is the function name ([lab], [lch], [oklab], [oklch], [hsl], [hwb], [color]), the second is the parenthesised body verbatim. *) | Contrast_color of color | Light_dark of color * color | Attribute of string * color option | Lab of { l : percentage option; a : float option; b : float option; alpha : alpha; } | Oklch of { l : percentage option; c : float option; h : hue; alpha : alpha } | Oklab of { l : percentage option; a : float option; b : float option; alpha : alpha; } | Lch of { l : percentage option; c : float option; h : hue; alpha : alpha } | Named of color_name | System of system_color | Var of color var | Current | Transparent | Auto (** [auto] keyword (e.g., [accent-color: auto], [caret-color: auto]) *) | Inherit | Initial | Unset | Revert | Revert_layer | Mix of { in_space : color_space option; hue : hue_interpolation; color1 : color; percent1 : percentage option; color2 : color; percent2 : percentage option; } type duration = | Ms of float | S of float | Durations of duration list | Round of string * duration * duration | Mod of duration * duration | Rem of duration * duration | Inherit | Initial | Unset | Revert | Revert_layer | Var of duration var | Calc of duration calc type number = | Num of float | Var of number var | Calc of number calc | Round of string * number * number | Mod of number * number | Rem of number * number | Hypot of number * number | Pow of number * number | Sqrt of number | Abs of number | Sign of number | Sin of angle type transition_behavior = Normal | Allow_discrete
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>