Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

cssProperties type/typeHint #114

Closed
daKmoR opened this issue Oct 29, 2019 · 4 comments
Closed

cssProperties type/typeHint #114

daKmoR opened this issue Oct 29, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@daKmoR
Copy link

daKmoR commented Oct 29, 2019

hey,

it would be really nice to have types/typeHints for css properties (you will need to hand write them). These types can then be used to either link to documentation or use them to display color pickers 馃挭

Types I would see so far:

  • Color (e.g. #fff, orange, rgb(255,0,0), ...)
  • Length (e.g. 10px, 10rem, ...)
  • String e.g. default

Stahman proposal:

/**
 * This is a container looking like a card with a back and front side you can switch
 *
 * @cssprop --demo-wc-card-header-font-size <Length> - Header font size
 * @cssprop --demo-wc-card-front-color <Color> - Font color for front
 */
export class DemoWcCard extends LitElement {}

output in customElements.json:

// tags.cssProperties[
{
  "name": "--demo-wc-card-font-front",
  "description": "Font color for front",
  "type": "Color"
}
@runem
Copy link
Owner

runem commented Nov 2, 2019

Great idea! :-)

I have two consideration:

  1. Why not use the built in JSDoc type syntax like this?
/**
 * This is a container looking like a card with a back and front side you can switch
 *
 * @cssprop {Length} --demo-wc-card-header-font-size - Header font size
 * @cssprop {Color} --demo-wc-card-front-color - Font color for front
 */
export class DemoWcCard extends LitElement {}
  1. Would the types be aligned with Houdini's CSS Properties and Values API Editor鈥檚 Draft? In that case we should think about supporting those types and advanced syntax like <color># | <url> | magic and <length>+. Valid types include: <integer>, <number>, <percentage>, <length>, <angle>, <time>, <frequency>, <resolution>, <url> and <string>.

@runem runem added the enhancement New feature or request label Nov 2, 2019
@daKmoR
Copy link
Author

daKmoR commented Nov 2, 2019

fully agree on both parts 馃憤

@runem
Copy link
Owner

runem commented Nov 20, 2019

PR #122 adresses this issue and has been merged. It's implemented as a "type hint", - a custom, optional string to help document css properties 馃帀

@daKmoR
Copy link
Author

daKmoR commented Nov 20, 2019

awesome 馃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants