package styled-ppx
Type-safe styled components for ReScript and Melange
Install
Dune Dependency
Authors
Maintainers
Sources
styled-ppx-0.59.1.tbz
sha256=8e9aabb5b5f98be5ecf8ba733a0111bcffd5fa2cba85181a58ba791f6d01d454
sha512=fcd0cd606a2630268e8cf38e36dedfdbb1fb6171160808b486d79200c0170460cf32900741eaa7b881ceea644b31ee1dc2a555ad208ccb9ad845c3d86b83085c
doc/src/styled-ppx.native/Rule.ml.html
Source file Rule.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
type rule = | Declaration of string * string | Selector of string * rule array let explode s = let rec exp i l = if i < 0 then l else exp (i - 1) (s.[i] :: l) in exp (String.length s - 1) [] let camelCaseToKebabCase str = let insert_dash acc letter = match letter with | 'A' .. 'Z' as letter -> ("-" ^ String.make 1 (Char.lowercase_ascii letter)) :: acc | _ -> String.make 1 letter :: acc in String.concat "" (List.rev (List.fold_left insert_dash [] (explode str))) let declaration (property, value) = Declaration (camelCaseToKebabCase property, value) let selector selector rules = Selector (selector, rules) let media query rules = Selector ({|@media |} ^ query, rules) let important v = match v with | Declaration (name, value) -> Declaration (name, value ^ {js| !important|js}) | Selector (_, _) -> v
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>