|
|
|
|
|
|
|
|
stop("All elements in `css` list must be named", call. = FALSE) |
|
|
stop("All elements in `css` list must be named", call. = FALSE) |
|
|
} |
|
|
} |
|
|
if (purrr::vec_depth(css) != 3) { |
|
|
if (purrr::vec_depth(css) != 3) { |
|
|
stop( |
|
|
|
|
|
|
|
|
stop(str_wrap( |
|
|
"`css` list must be a named list within a named list, e.g.:\n", |
|
|
"`css` list must be a named list within a named list, e.g.:\n", |
|
|
' list(".class-id" = list("css-property" = "value"))' |
|
|
' list(".class-id" = list("css-property" = "value"))' |
|
|
) |
|
|
|
|
|
|
|
|
)) |
|
|
} |
|
|
} |
|
|
if (any(names(css) == "")) { |
|
|
if (any(names(css) == "")) { |
|
|
not_named <- which(names(css) == "") |
|
|
not_named <- which(names(css) == "") |
|
|
if (length(not_named) > 1) { |
|
|
if (length(not_named) > 1) { |
|
|
stop( |
|
|
|
|
|
|
|
|
stop(str_wrap( |
|
|
call. = FALSE, |
|
|
call. = FALSE, |
|
|
"All elements in `css` list must be named. Items ", |
|
|
"All elements in `css` list must be named. Items ", |
|
|
paste(not_named, collapse = ", "), |
|
|
paste(not_named, collapse = ", "), |
|
|
" are unnamed." |
|
|
" are unnamed." |
|
|
) |
|
|
|
|
|
|
|
|
)) |
|
|
} else { |
|
|
} else { |
|
|
stop( |
|
|
|
|
|
|
|
|
stop(str_wrap( |
|
|
call. = FALSE, |
|
|
call. = FALSE, |
|
|
"All elements in `css` list must be named. Item ", |
|
|
"All elements in `css` list must be named. Item ", |
|
|
not_named, |
|
|
not_named, |
|
|
" is not named." |
|
|
" is not named." |
|
|
) |
|
|
|
|
|
|
|
|
)) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
child_unnamed <- purrr::map_lgl(purrr::map(css, ~ { |
|
|
child_unnamed <- purrr::map_lgl(purrr::map(css, ~ { |
|
|
|
|
|
|
|
|
if (length(has_unnamed) > 1) "have" else "has", |
|
|
if (length(has_unnamed) > 1) "have" else "has", |
|
|
"unnamed property or properties." |
|
|
"unnamed property or properties." |
|
|
) |
|
|
) |
|
|
stop(msg, call. = FALSE) |
|
|
|
|
|
|
|
|
stop(str_wrap(msg), call. = FALSE) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
x <- purrr::imap_chr(css, function(rules, selector) { |
|
|
x <- purrr::imap_chr(css, function(rules, selector) { |