Skip to content

Commit

Permalink
feat: add vetur auto-completion for <SanityImage> and `<SanityConte…
Browse files Browse the repository at this point in the history
…nt>`
  • Loading branch information
danielroe committed Sep 27, 2020
1 parent 8157b64 commit 01ddb19
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"types": "dist/index.d.ts",
"files": [
"dist",
"vetur",
"templates"
],
"scripts": {
Expand Down Expand Up @@ -70,5 +71,9 @@
},
"publishConfig": {
"access": "public"
},
"vetur": {
"tags": "vetur/tags.json",
"attributes": "vetur/attributes.json"
}
}
112 changes: 112 additions & 0 deletions vetur/attributes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"sanity-content/blocks": {
"type": "array"
},
"sanity-content/serializers": {
"type": "object"
},
"sanity-content/render-container-on-single-child": {
"type": "boolean"
},
"sanity-image/asset-id": {
"type": "string"
},
"sanity-image/project-id": {
"type": "string"
},
"sanity-image/dataset": {
"type": "string"
},
"sanity-image/auto": {
"type": "string",
"description": "Set auto=format to automatically return an image in webp formatting if the browser supports it."
},
"sanity-image/bg": {
"type": "string",
"description": "Fill in any transparent areas in the image with a color. The string must be resolve to a valid hexadecimal color (RGB, ARGB, RRGGBB, or AARRGGBB). E.g. bg=ff00 for red background with no transparency."
},
"sanity-image/blur": {
"type": "number|string",
"description": "Blur 0-100."
},
"sanity-image/crop": {
"type": "string",
"description": "Use with fit=crop to specify how cropping is performed."
},
"sanity-image/dl": {
"type": "string",
"description": "Configures the headers so that opening this link causes the browser to download the image rather than showing it. The browser will suggest to use the file name you provided."
},
"sanity-image/dpr": {
"type": "number|string",
"description": "Specifies device pixel ratio scaling factor. From 1 to 3."
},
"sanity-image/fit": {
"type": "string",
"description": "Affects how the image is handled when you specify target dimensions"
},
"sanity-image/flip": {
"type": "string",
"description": "Flipping. Flip image horizontally, vertically or both. Possible values: h, v, hv"
},
"sanity-image/fm": {
"type": "string",
"description": "Convert image to jpg, pjpg, png, or webp."
},
"sanity-image/fp-x": {
"type": "number|string",
"description": "Focal Point X. Specify a center point to focus on when cropping the image. Values from 0.0 to 1.0 in fractions of the image dimensions. (See crop)"
},
"sanity-image/fp-y": {
"type": "number|string",
"description": "Focal Point Y. Specify a center point to focus on when cropping the image. Values from 0.0 to 1.0 in fractions of the image dimensions. (See crop)"
},
"sanity-image/h": {
"type": "number|string",
"description": "Height of the image in pixels. Scales the image to be that tall."
},
"sanity-image/invert": {
"type": "boolean",
"description": "Invert the image."
},
"sanity-image/max-h": {
"type": "number|string",
"description": "Maximum height. Specifies size limits giving the backend some freedom in picking a size according to the source image aspect ratio."
},
"sanity-image/max-w": {
"type": "number|string",
"description": "Maximum width. Specifies size limits giving the backend some freedom in picking a size according to the source image aspect ratio."
},
"sanity-image/min-h": {
"type": "number|string",
"description": "Minimum height. Specifies size limits giving the backend some freedom in picking a size according to the source image aspect ratio."
},
"sanity-image/min-w": {
"type": "number|string",
"description": "Minimum width. Specifies size limits giving the backend some freedom in picking a size according to the source image aspect ratio."
},
"sanity-image/or": {
"type": "number|string",
"description": "Orientation. Possible values: 0, 90, 180 or 270.Rotate the image in 90 degree increments."
},
"sanity-image/q": {
"type": "number|string",
"description": "Quality 0-100. Specify the compression quality (where applicable)."
},
"sanity-image/rect": {
"type": "string",
"description": "Crop the image according to the provided coordinates (in pixel units of the source image)."
},
"sanity-image/sat": {
"type": "number|string",
"description": "Saturation. Currently the asset pipeline only supports sat=-100, which renders the image with grayscale colors. Support for more levels of saturation is planned for later."
},
"sanity-image/sharpen": {
"type": "number|string",
"description": "Sharpen 0-100."
},
"sanity-image/w": {
"type": "number|string",
"description": "Width of the image in pixels. Scales the image to be that wide."
}
}
37 changes: 37 additions & 0 deletions vetur/tags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"sanity-content": {
"attributes": ["blocks", "serializers", "render-container-on-single-child"],
"description": "A global component that can turn portable text into HTML. It is a lightweight functional component without an instance."
},
"sanity-image": {
"attributes": [
"asset-id",
"project-id",
"dataset",
"auto",
"bg",
"blur",
"crop",
"dl",
"dpr",
"fit",
"flip",
"fm",
"fp-x",
"fp-y",
"h",
"invert",
"max-h",
"max-w",
"min-h",
"min-w",
"or",
"q",
"rect",
"sat",
"sharpen",
"w"
],
"description": "A global component to assist with auto-generating your image URLs. It is a lightweight functional component that simply turns the props into a valid image URL."
}
}

0 comments on commit 01ddb19

Please sign in to comment.