{"id":16905701,"url":"https://github.com/octref/vuetypes","last_synced_at":"2025-03-20T16:22:02.919Z","repository":{"id":85550518,"uuid":"147741771","full_name":"octref/vuetypes","owner":"octref","description":"Spec for Types in Vue to enhance Vue template editing experience","archived":false,"fork":false,"pushed_at":"2018-09-18T21:45:41.000Z","size":11,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-25T15:13:19.504Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/octref.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-06T22:44:34.000Z","updated_at":"2020-08-19T02:07:43.000Z","dependencies_parsed_at":"2023-03-03T15:15:24.404Z","dependency_job_id":null,"html_url":"https://github.com/octref/vuetypes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octref%2Fvuetypes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octref%2Fvuetypes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octref%2Fvuetypes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octref%2Fvuetypes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/octref","download_url":"https://codeload.github.com/octref/vuetypes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244647248,"owners_count":20487035,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T18:39:20.190Z","updated_at":"2025-03-20T16:22:02.900Z","avatar_url":"https://github.com/octref.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vue Types\n\nVersion: 0.0.1. Currently collecting feedback.\n\nThis is a proposal for https://github.com/vuejs/vue/issues/7186. It tries to standardize a \"Vue Type\" format that [Vetur](https://github.com/vuejs/vetur) could read from and enhance the **HTML** editing experience in Vue SFC. **This proposal is not about type-checking in Vue SFC.**\n\nFeedback welcome! You can join the [discussion](https://github.com/vuejs/vue/issues/7186) or open new issues here. Specifically, I would want to know:\n\n- What more features would you want from the editor, based on the Vue Types data?\n- Where do you think is the right place to author those data (Vue SFC as JSDocs, Vue SFC Custom Block, another file that you can import from Vue SFC, a centralized file for the whole library)?\n\n## Motivation\n\nTypeScript has a great ecosystem for typings, for example, run `npm i -D @types/node` and get auto completion \u0026 type check working in the editor. We want the same for using Vue libraries. For example, if I do `npm i -D @vuetypes/element-ui`, I should get all HTML tag and attribute auto completion \u0026 attribute value checking in the editor.\n\nFor that to happen, we need 3 things:\n- A way to write those \"vue types\" in Vue components (SFC and JS/TS), and a tool to extract those typings into a specified format.\n- A repo to store high-quality \"vue types\" and a NPM scope to download it from. Similar to `DefinitelyTyped/DefinitelyTyped` and `@types`, we could have `vuejs/VerilyTyped` and `@vuetypes`.\n- Editor integration (Vetur / VLS) that reads the specified format and provides the desired features, including:\n  - Auto completion\n  - Error checking\n  - Hover information\n  - Jump to website doc\n\nThe rest of the document describes the \"specified format\".\n\n## Vue Types Spec\n\n### Components\n\nComponents should provide:\n- A short description of the component.\n- Its allowed attributes.\n- Its required attributes.\n- (?) Whether the component can only be a child of another component. For example, `el-checkbox-group` and `el-checkbox`.\n\n### Attributes\n\nAttributes should provide:\n- A short description of the attribute.\n- Its allowed values. If the values are enums, it should also provide short descriptions for those enum values.\n\n### Sample JSON\n\n```json\n{\n  \"components\": [\n    {\n      \"name\": \"v-button\",\n      \"description\": \"A button\",\n      \"attributes\": [\n        {\n          \"name\": \"width\",\n          \"description\": \"The width of the button\",\n          \"type\": \"number\",\n          \"required\": true\n        },\n        {\n          \"name\": \"height\",\n          \"description\": \"The height of the button\",\n          \"type\": \"number\",\n          \"required\": true\n        },\n        {\n          \"name\": \"corner-style\",\n          \"description\": \"The style of the button's corner\",\n          \"type\": \"string\",\n          \"enum\": [\n            { \"value\": \"round\", \"description\": \"Round corners\" },\n            { \"value\": \"sharp\", \"description\": \"Sharp corners\" }\n          ],\n          \"required\": false,\n          \"default\": \"round\"\n        }\n      ]\n    }\n  ]\n}\n```\n\n### Expected Editor Behavior\n\n#### Auto completion\n\n- `\u003cv|` should auto complete `\u003cv-button|\u003e`.\n- `\u003cv-button w|\u003e` should auto complete `\u003cv-button width=\"\"\u003e`.\n- `\u003cv-button corner-style=\"|\"\u003e` should auto complete `round` and `sharp`.\n\n#### Diagnostics\n\n- `\u003cv-btn\u003e` should show error, as `v-btn` is not a defined component.\n- `\u003cv-button width=\"\"\u003e`, `\u003cv-button width=\"20px\"\u003e`, `\u003cv-button width=\"foo\"\u003e` should show error, as the provided values do not satisfy the `valueType` requirement.\n- `\u003cv-button width=\"50\"\u003e\u003c/-button\u003e` should show error, as required attribute `height` is not provided.\n- `\u003cv-button /\u003e` should show error, as required attributes `width` and `height` are not provided.\n- `\u003cv-button corner-style=\"square\"\u003e` should show error, as `square` is not one of the enum values for `corner-style`.\n\n#### Hover Information\n\n- \"A button\" should show when hovering on `\u003cv-button\u003e`.\n- \"The style of the button's corner\" should show when hover on `corner-style` in `\u003cv-button corner-style=\"round\"\u003e`.\n\n#### (?) Jump to Website\n\nIf the website has a URL for each component / attribute, we could provide a command that allows user to jump to the website for a more comprehensive doc. This can be part of the hover / completion information, or just a special command.\n\nI'm not sure if we want this. Although we could provide a `link` field in the spec for each component / attribute and easily achieve this in the editor.\n\n### Distribution of the VueTypes JSON\n\nAfter building a JSON following the spec, you have two options to distribute it:\n\n- Put it in the NPM module you are publishing, and add a key `vueTypes` that points to the path of the file. Benefit is the JSON always has the right version.\n- Publish it a `VerilyTyped`, which can automatically publish it to `vuetypes`. (I don't know if this is worth the hassle)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctref%2Fvuetypes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foctref%2Fvuetypes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foctref%2Fvuetypes/lists"}