├── .gitignore ├── .prettierrc ├── .vscode └── settings.json ├── README.md ├── lerna.json ├── package.json ├── packages ├── test │ ├── .babelrc │ ├── index.html │ ├── package.json │ ├── src │ │ ├── index.tsx │ │ ├── store-declaration.d.ts │ │ ├── store.ts │ │ └── storeModule.ts │ ├── tsconfig.json │ ├── webpack.config.js │ └── yarn.lock ├── vue-router │ ├── package.json │ ├── src │ │ └── index.js │ ├── typings │ │ ├── index.d.ts │ │ └── vue.d.ts │ └── yarn.lock ├── vue │ ├── package.json │ ├── src │ │ └── index.js │ ├── typings │ │ └── index.d.ts │ └── yarn.lock ├── vuetify │ ├── package.json │ ├── src │ │ └── index.js │ ├── typings │ │ └── index.d.ts │ └── yarn.lock └── vuex │ ├── package.json │ ├── src │ └── index.js │ ├── typings │ └── index.d.ts │ └── yarn.lock ├── tsconfig.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | 24 | # nyc test coverage 25 | .nyc_output 26 | 27 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 28 | .grunt 29 | 30 | # Bower dependency directory (https://bower.io/) 31 | bower_components 32 | 33 | # node-waf configuration 34 | .lock-wscript 35 | 36 | # Compiled binary addons (https://nodejs.org/api/addons.html) 37 | build/Release 38 | 39 | # Dependency directories 40 | node_modules/ 41 | jspm_packages/ 42 | 43 | # Optional npm cache directory 44 | .npm 45 | 46 | # Optional eslint cache 47 | .eslintcache 48 | 49 | # Optional REPL history 50 | .node_repl_history 51 | 52 | # Output of 'npm pack' 53 | *.tgz 54 | 55 | # Yarn Integrity file 56 | .yarn-integrity 57 | 58 | # dotenv environment variables file 59 | .env 60 | .env.test 61 | 62 | # parcel-bundler cache (https://parceljs.org/) 63 | .cache 64 | 65 | # next.js build output 66 | .next 67 | 68 | # nuxt.js build output 69 | .nuxt 70 | 71 | # vuepress build output 72 | .vuepress/dist 73 | 74 | # Serverless directories 75 | .serverless/ 76 | 77 | # FuseBox cache 78 | .fusebox/ 79 | 80 | # DynamoDB Local files 81 | .dynamodb/ 82 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "bracketSpacing": true, 4 | "printWidth": 120, 5 | "tabWidth": 2, 6 | "useTabs": false, 7 | "semi": false, 8 | "singleQuote": true, 9 | "trailingComma": "all" 10 | } 11 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "git.ignoreLimitWarning": true 3 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This Repository aims to add full TSX support to the existing [vuejs/jsx](https://github.com/vuejs/jsx) Babel preset. 2 | 3 | 4 | # Notes 5 | 6 | Keep in mind that this project is currently being developed. 7 | Expect bugs and unexpected behavior. 8 | 9 | DO NOT USE THIS IN PRODUCTION. 10 | 11 | Please feel free to open an Issue if you encounter problems, have a feature request or questions about the future of this project. 12 | 13 | Vue + TSX = ♥️ 14 | 15 | # Installation 16 | 17 | Install the package and babel preset with: 18 | 19 | ```bash 20 | npm install @vue-tsx/vue @vue/babel-preset-jsx 21 | ``` 22 | 23 | Then add the preset to `.babelrc`: 24 | 25 | ```json 26 | { 27 | "presets": ["@vue/babel-preset-jsx"] 28 | } 29 | ``` 30 | 31 | # Getting Started 32 | 33 | - [Mounting your app](#Mounting-your-app) 34 | - [Creating Class Component](#Creating-Class-Component) 35 | - [Define Component Props](#Define-Component-Props) 36 | - [Use Component in TSX](#Use-Component-in-TSX) 37 | - [Watch Method](#Watch-Method) 38 | - [Implement Router](#Implement-Router) 39 | - [Implement Vuex Store](#Implement-Vuex-Store) 40 | - [Use Vuex Store](#Use-Vuex-Store) 41 | 42 | external: 43 | - [syntax information](https://github.com/vuejs/jsx#syntax) 44 | - [difference to react JSX](https://github.com/vuejs/jsx/tree/dev/packages/babel-plugin-transform-vue-jsx#difference-from-react-jsx) 45 | - [component tip](https://github.com/vuejs/jsx/tree/dev/packages/babel-plugin-transform-vue-jsx#jsx-spread) 46 | - [JSX spread information](https://github.com/vuejs/jsx/tree/dev/packages/babel-plugin-transform-vue-jsx#jsx-spread) 47 | - [directives information](https://github.com/vuejs/jsx/tree/dev/packages/babel-plugin-transform-vue-jsx#vue-directives) 48 | 49 | --- 50 | ### Mounting your app 51 | 52 | ```jsx 53 | // import Vue Class 54 | import { Vue } from '@vue-tsx/vue'; 55 | 56 | new Vue({ 57 | // pass root element 58 | el: document.getElementById('app'), 59 | 60 | // implement render method 61 | render() { 62 | return

Hello World

63 | }, 64 | }) 65 | ``` 66 | 67 | --- 68 | ### Creating Class Component 69 | 70 | ```jsx 71 | // import Component Class 72 | import { Component } from '@vue-tsx/vue'; 73 | 74 | // extend Abstract Component 75 | export class Hello extends Component { 76 | 77 | // define data 78 | private text = 'Hello World' 79 | 80 | // implement render method 81 | render() { 82 | return

83 |

{this.text}

84 | 85 |
86 | } 87 | } 88 | ``` 89 | 90 | --- 91 | ### Define Component Props 92 | 93 | ```jsx 94 | import { Component } from '@vue-tsx/vue'; 95 | 96 | // define Props interface 97 | interface Props { 98 | myText: string 99 | } 100 | 101 | // add Props Interface to Component Type Generics 102 | export class Hello extends Component<{ props: Props }> { 103 | 104 | // access Props using $attrs 105 | private text = this.$attrs.myText 106 | 107 | render() { 108 | return

{this.text}

109 | } 110 | } 111 | ``` 112 | 113 | --- 114 | ### Use Component in TSX 115 | 116 | ```jsx 117 | import { Vue } from '@vue-tsx/vue'; 118 | 119 | //import your Component 120 | import { Hello } from './components/Hello' 121 | 122 | new Vue({ 123 | el: document.getElementById('app'), 124 | 125 | render() { 126 | // insert Component 127 | return 128 | }, 129 | }) 130 | ``` 131 | 132 | --- 133 | ### Watch Method 134 | 135 | ```jsx 136 | // import Watch Decorator 137 | import { Component, Watch } from '@vue-tsx/vue'; 138 | 139 | export class Hello extends Component { 140 | 141 | // implement Watch using Decorator 142 | @Watch('text', { deep: true }) 143 | myMethod(val: string, oldVal: string) { 144 | console.log('data Changed', val, oldVal) 145 | } 146 | 147 | private text = 'Hello World' 148 | 149 | render() { 150 | return
...
151 | } 152 | } 153 | ``` 154 | 155 | --- 156 | ### Implement Router 157 | 158 | ```jsx 159 | // import vue-tsx router 160 | import { Router } from '@vue-tsx/vue-router' 161 | import { Vue } from '@vue-tsx/vue'; 162 | 163 | // define your routes 164 | const router = new Router({ ... }) 165 | 166 | // use Router 167 | Vue.use(Router) 168 | 169 | new Vue({ 170 | el: document.getElementById('app'), 171 | // add router to Vue options 172 | router, 173 | 174 | render() { 175 | return
176 | Home 177 | about 178 | 179 | 180 |
181 | }, 182 | }) 183 | ``` 184 | 185 | --- 186 | ### Implement Vuex Store 187 | 188 | ```jsx 189 | // Import ModuleOptions Type and Vuex Class 190 | import { ModuleOptions, Vuex } from '@vue-tsx/vuex' 191 | import { Vue } from '@vue-tsx/vue'; 192 | 193 | // define your types 194 | interface State { ... } 195 | interface Getters { ... } 196 | interface Mutations { ... } 197 | interface Actions { ... } 198 | 199 | // define your data and methods 200 | const rootModule: ModuleOptions = { 201 | state: { ... }, 202 | getters: { ... }, 203 | mutations: { ... }, 204 | actions: { ... }, 205 | } 206 | 207 | // define store 208 | const store = new Vuex({ rootModule }) 209 | 210 | // use Vuex 211 | Vue.use(Vuex) 212 | 213 | new Vue({ 214 | el: document.getElementById('app'), 215 | // add store to Vue options 216 | store, 217 | 218 | render() { 219 | return
...
220 | }, 221 | }) 222 | ``` 223 | 224 | --- 225 | ### Use Vuex Store 226 | 227 | ```jsx 228 | // import respective Vuex store access methods 229 | import { getter, mutation, action } from '@vue-tsx/vuex' 230 | import { Component } from '@vue-tsx/vue'; 231 | 232 | export class Hello extends Component { 233 | 234 | // use getter 235 | get filter () { 236 | return getter(this, 'filter') 237 | } 238 | 239 | // use mutation 240 | set filter(search: string) { 241 | mutation(this, 'setFilter', search) 242 | } 243 | 244 | // use action 245 | triggerSearch (search = this.filter) { 246 | action(this, 'search', search) 247 | } 248 | 249 | render() { 250 | return
...
251 | } 252 | } 253 | ``` 254 | 255 | # Compatibility 256 | 257 | This Repo is only compatible with: 258 | 259 | - **Babel 7+**. For Babel 6 support, use [vuejs/babel-plugin-transform-vue-jsx](https://github.com/vuejs/babel-plugin-transform-vue-jsx) 260 | - **Vue 2+**. JSX is not supported for older versions. -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "packages/*" 4 | ], 5 | "version": "0.1.1-alpha.0", 6 | "npmClient": "yarn" 7 | } 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "root", 3 | "private": true, 4 | "scripts": { 5 | "postinstall": "lerna bootstrap" 6 | }, 7 | "devDependencies": { 8 | "lerna": "^3.13.4" 9 | }, 10 | "dependencies": { 11 | "vue-property-decorator": "^8.1.0" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/test/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@vue/babel-preset-jsx"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | -------------------------------------------------------------------------------- /packages/test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test", 3 | "version": "0.1.1-alpha.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server" 9 | }, 10 | "dependencies": { 11 | "@babel/core": "^7.4.4", 12 | "@vue-tsx/vue": "^0.1.1-alpha.0", 13 | "@vue-tsx/vue-router": "^0.1.1-alpha.0", 14 | "@vue-tsx/vuex": "^0.1.1-alpha.0", 15 | "@vue/babel-preset-jsx": "^1.0.0-beta.3", 16 | "babel-loader": "^8.0.5", 17 | "ts-loader": "^5.4.5", 18 | "tslib": "^1.9.3", 19 | "typescript": "^3.4.5", 20 | "vue": "^2.6.10", 21 | "webpack": "^4.30.0", 22 | "webpack-cli": "^3.3.2", 23 | "webpack-dev-server": "^3.3.1" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/test/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { Component, VueTSX, Vue, Watch } from '@vue-tsx/vue' 2 | import { Router, RouterLink, RouterView } from '@vue-tsx/vue-router' 3 | import { namespacedGetter, namespacedMutate, namespacedAction } from '@vue-tsx/vuex' 4 | import { store } from './store' 5 | 6 | type Props = 7 | | { 8 | a: number 9 | b: string 10 | } 11 | | { c: [number, string] } 12 | 13 | interface Events { 14 | event1: string 15 | event2: number 16 | } 17 | 18 | class MyComponent extends Component<{ 19 | props: Props 20 | events: Events 21 | }> { 22 | text = 'test' 23 | counter = 1 24 | 25 | render(h: VueTSX.CreateElement) { 26 | return ( 27 |
28 | { 32 | this.text = $event.currentTarget.value 33 | this.$emit('event1', this.text) 34 | this.$emit('event2', ++this.counter) 35 | }, 36 | }} 37 | /> 38 | {this.text} 39 |
{JSON.stringify(this.$attrs)}
40 | Hello 41 |
42 | ) 43 | } 44 | } 45 | 46 | class SSComponent extends Component<{ 47 | scopedSlots: { 48 | default?: [string, number?] 49 | } 50 | }> { 51 | render(h: VueTSX.CreateElement) { 52 | if (this.$scopedSlots.default) { 53 | return this.$scopedSlots.default('a', 1) 54 | } 55 | return
No slot :(
56 | } 57 | } 58 | 59 | class View1 extends Component { 60 | data = '123' 61 | 62 | beforeCreate() { 63 | console.log('beforeCreate', this) 64 | } 65 | 66 | @Watch('data', { deep: true }) 67 | myMethod(val: string, oldVal: string) { 68 | console.log('data Changed', val, oldVal) 69 | } 70 | 71 | get fromVuex() { 72 | return namespacedGetter(this, 'myModule', 'total') 73 | } 74 | set str(val: string) { 75 | namespacedMutate(this, 'myModule', 'setStr', val) 76 | } 77 | get str() { 78 | return namespacedGetter(this, 'myModule', 's') 79 | } 80 | get num() { 81 | return namespacedGetter(this, 'myModule', 'num') 82 | } 83 | 84 | render(h: VueTSX.CreateElement) { 85 | return ( 86 |
87 | {this.data}__ 88 | {this.fromVuex}__ 89 | {this.str}__ 90 | {this.num}__ 91 | 92 | 93 |
94 | 97 | 100 |
101 | 102 | 103 |
104 | Comp1: 105 | { 110 | console.log(data) 111 | }, 112 | }} 113 | /> 114 | Comp2: 115 | 121 |
122 | 123 |
124 |
This is a scoped slot {JSON.stringify({ arg1, arg2 })}
, 127 | }} 128 | /> 129 |
130 | ) 131 | } 132 | } 133 | class View2 extends Component { 134 | render(h: VueTSX.CreateElement) { 135 | return ( 136 |
137 | Second page :P 138 | 139 |
140 | ) 141 | } 142 | } 143 | 144 | const router = new Router({ 145 | mode: 'history', 146 | routes: [ 147 | { 148 | path: '/', 149 | component: View1, 150 | }, 151 | { 152 | path: '/second', 153 | component: View2, 154 | }, 155 | ], 156 | }) 157 | 158 | Vue.use(Router) 159 | ;(window as any).store = store 160 | 161 | new Vue({ 162 | el: document.getElementById('app'), 163 | router, 164 | store, 165 | render(h) { 166 | return ( 167 |
168 |
    169 |
  • 170 | Home 171 |
  • 172 |
  • 173 | Second 174 |
  • 175 |
176 |
177 | 178 |
179 | ) 180 | }, 181 | }) 182 | -------------------------------------------------------------------------------- /packages/test/src/store-declaration.d.ts: -------------------------------------------------------------------------------- 1 | import { VueTSX } from '@vue-tsx/vue' 2 | import { Options } from '@vue-tsx/vuex' 3 | import { store, options } from './store' 4 | 5 | declare module '@vue-tsx/vue' { 6 | namespace VueTSX { 7 | interface Options { 8 | store: typeof store 9 | } 10 | } 11 | } 12 | 13 | declare module '@vue-tsx/vuex' { 14 | interface Options { 15 | options: typeof options 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/test/src/store.ts: -------------------------------------------------------------------------------- 1 | import { Vue } from '@vue-tsx/vue' 2 | import { ModuleOptions, Vuex } from '@vue-tsx/vuex' 3 | import { module } from './storeModule' 4 | 5 | export interface RootState { 6 | str: string 7 | num: number | null 8 | } 9 | 10 | export interface RootGetters { 11 | s: string 12 | num: number 13 | total: string 14 | } 15 | 16 | interface RootMutations { 17 | setStr: string 18 | setNum: number 19 | } 20 | 21 | interface RootActions { 22 | setStrA: string 23 | setNumA?: number 24 | } 25 | 26 | const rootModule: ModuleOptions = { 27 | state: { 28 | str: '', 29 | num: null, 30 | }, 31 | getters: { 32 | s(state) { 33 | return state.str 34 | }, 35 | num(state) { 36 | return state.num || 0 37 | }, 38 | total(state) { 39 | return this.s(state) + ':' + this.num(state) 40 | }, 41 | }, 42 | mutations: { 43 | setStr(state, payload) { 44 | state.str = payload 45 | }, 46 | setNum(state, payload) { 47 | state.num = payload 48 | }, 49 | }, 50 | actions: { 51 | async setNumA(ctx, payload) { 52 | ctx.commit('setNum', payload || 0) 53 | }, 54 | async setStrA(ctx, payload) { 55 | ctx.commit('setStr', payload) 56 | if (ctx.getters.s === payload) { 57 | console.log('set successful') 58 | } 59 | await this.setNumA(ctx, 1) 60 | }, 61 | }, 62 | } 63 | 64 | Vue.use(Vuex) 65 | 66 | export const options = { 67 | rootModule, 68 | modules: { 69 | myModule: module, 70 | }, 71 | } 72 | 73 | export const store = new Vuex(options) 74 | -------------------------------------------------------------------------------- /packages/test/src/storeModule.ts: -------------------------------------------------------------------------------- 1 | import { ModuleOptions } from '@vue-tsx/vuex' 2 | 3 | interface State { 4 | str: string 5 | num: number | null 6 | } 7 | 8 | interface Getters { 9 | s: string 10 | num: number 11 | total: string 12 | } 13 | 14 | interface Mutations { 15 | setStr: string 16 | setNum: number 17 | } 18 | 19 | interface Actions { 20 | setStrA: string 21 | setNumA?: number 22 | } 23 | 24 | export const module: ModuleOptions = { 25 | state: { 26 | str: '', 27 | num: null, 28 | }, 29 | getters: { 30 | s(state) { 31 | return state.str 32 | }, 33 | num(state) { 34 | return state.num || 0 35 | }, 36 | total(state) { 37 | return this.s(state) + ':' + this.num(state) 38 | }, 39 | }, 40 | mutations: { 41 | setStr(state, payload) { 42 | state.str = payload 43 | }, 44 | setNum(state, payload) { 45 | state.num = payload 46 | }, 47 | }, 48 | actions: { 49 | async setNumA(ctx, payload) { 50 | ctx.commit('setNum', payload || 0) 51 | }, 52 | async setStrA(ctx, payload) { 53 | ctx.commit('setStr', payload) 54 | if (ctx.getters.s === payload) { 55 | console.log('set successful') 56 | } 57 | await this.setNumA(ctx, 1) 58 | }, 59 | }, 60 | } 61 | -------------------------------------------------------------------------------- /packages/test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "jsx": "preserve", 5 | "importHelpers": true, 6 | "moduleResolution": "node", 7 | "target": "esnext", 8 | "experimentalDecorators": true, 9 | "esModuleInterop": true, 10 | "allowSyntheticDefaultImports": true, 11 | "sourceMap": true, 12 | "baseUrl": "." 13 | }, 14 | "exclude": ["node_modules"] 15 | } 16 | -------------------------------------------------------------------------------- /packages/test/webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | entry: { 3 | app: './src/index.tsx' 4 | }, 5 | module: { 6 | rules: [ 7 | { 8 | test: /\.tsx?$/, 9 | loaders: ['babel-loader', 'ts-loader'], 10 | exclude: /node_modules/, 11 | }, 12 | ], 13 | }, 14 | resolve: { 15 | symlinks: false, 16 | extensions: ['.ts', '.tsx', '.js', '.jsx'] 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /packages/vue-router/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vue-tsx/vue-router", 3 | "version": "0.1.1-alpha.0", 4 | "module": "src/index.js", 5 | "license": "MIT", 6 | "typings": "typings/index.d.ts", 7 | "dependencies": { 8 | "@vue-tsx/vue": "^0.1.1-alpha.0", 9 | "csstype": "^2.6.4", 10 | "tslib": "^1.9.3", 11 | "typescript": "^3.4.5", 12 | "vue": "^2.6.10", 13 | "vue-router": "^3.0.6" 14 | }, 15 | "gitHead": "4e2a14a18bcfcc0ea2406e89f581729d57b64cd2" 16 | } 17 | -------------------------------------------------------------------------------- /packages/vue-router/src/index.js: -------------------------------------------------------------------------------- 1 | import { transformComponent } from '@vue-tsx/vue' 2 | import VueRouter from 'vue-router' 3 | 4 | const processRoute = route => ({ 5 | ...route, 6 | component: route.component ? transformComponent(route.component) : undefined, 7 | components: route.components 8 | ? Object.keys(route.components).reduce( 9 | (obj, key) => ({ ...obj, [key]: transformComponent(route.components[key]) }), 10 | {}, 11 | ) 12 | : undefined, 13 | children: route.children ? route.children.map(processRoute) : undefined, 14 | }) 15 | 16 | export class Router { 17 | constructor(options) { 18 | this.$_TSX_infer = new VueRouter({ 19 | ...options, 20 | routes: options.routes.map(processRoute) || [], 21 | }) 22 | 23 | console.log({ 24 | ...options, 25 | routes: options.routes.map(processRoute) || [], 26 | }) 27 | } 28 | 29 | static get $_TSX_plugin () { 30 | return VueRouter 31 | } 32 | } 33 | export const RouterLink = 'RouterLink' 34 | export const RouterView = 'RouterView' 35 | -------------------------------------------------------------------------------- /packages/vue-router/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import { Component, VueTSX } from '@vue-tsx/vue' 2 | import './vue' 3 | 4 | type RComponent = typeof VueTSX.BaseComponent | Promise; 5 | type Dictionary = { [key: string]: T }; 6 | type ErrorHandler = (err: Error) => void; 7 | 8 | export type RouterMode = "hash" | "history" | "abstract"; 9 | export type RawLocation = string | Location; 10 | export type RedirectOption = RawLocation | ((to: Route) => RawLocation); 11 | export type NavigationGuard = ( 12 | to: Route, 13 | from: Route, 14 | next: (to?: RawLocation | false | ((vm: Object) => any) | void) => void 15 | ) => any 16 | 17 | export declare class Router { 18 | constructor (options?: RouterOptions); 19 | 20 | app: Object; 21 | mode: RouterMode; 22 | currentRoute: Route; 23 | 24 | beforeEach (guard: NavigationGuard): Function; 25 | beforeResolve (guard: NavigationGuard): Function; 26 | afterEach (hook: (to: Route, from: Route) => any): Function; 27 | push (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void; 28 | replace (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void; 29 | go (n: number): void; 30 | back (): void; 31 | forward (): void; 32 | getMatchedComponents (to?: RawLocation | Route): RComponent[]; 33 | onReady (cb: Function, errorCb?: ErrorHandler): void; 34 | onError (cb: ErrorHandler): void; 35 | addRoutes (routes: RouteConfig[]): void; 36 | resolve (to: RawLocation, current?: Route, append?: boolean): { 37 | location: Location; 38 | route: Route; 39 | href: string; 40 | // backwards compat 41 | normalizedTo: Location; 42 | resolved: Route; 43 | }; 44 | } 45 | 46 | type Position = { x: number, y: number }; 47 | type PositionResult = Position | { selector: string, offset?: Position } | void; 48 | 49 | export interface RouterOptions { 50 | routes?: RouteConfig[]; 51 | mode?: RouterMode; 52 | fallback?: boolean; 53 | base?: string; 54 | linkActiveClass?: string; 55 | linkExactActiveClass?: string; 56 | parseQuery?: (query: string) => Object; 57 | stringifyQuery?: (query: Object) => string; 58 | scrollBehavior?: ( 59 | to: Route, 60 | from: Route, 61 | savedPosition: Position | void 62 | ) => PositionResult | Promise; 63 | } 64 | 65 | type RoutePropsFunction = (route: Route) => Object; 66 | 67 | export interface PathToRegexpOptions { 68 | sensitive?: boolean; 69 | strict?: boolean; 70 | end?: boolean; 71 | } 72 | 73 | export interface RouteConfig { 74 | path: string; 75 | name?: string; 76 | component?: RComponent; 77 | components?: Dictionary; 78 | redirect?: RedirectOption; 79 | alias?: string | string[]; 80 | children?: RouteConfig[]; 81 | meta?: any; 82 | beforeEnter?: NavigationGuard; 83 | props?: boolean | Object | RoutePropsFunction; 84 | caseSensitive?: boolean; 85 | pathToRegexpOptions?: PathToRegexpOptions; 86 | } 87 | 88 | export interface RouteRecord { 89 | path: string; 90 | regex: RegExp; 91 | components: Dictionary; 92 | instances: Dictionary; 93 | name?: string; 94 | parent?: RouteRecord; 95 | redirect?: RedirectOption; 96 | matchAs?: string; 97 | meta: any; 98 | beforeEnter?: ( 99 | route: Route, 100 | redirect: (location: RawLocation) => void, 101 | next: () => void 102 | ) => any; 103 | props: boolean | Object | RoutePropsFunction | Dictionary; 104 | } 105 | 106 | export interface Location { 107 | name?: string; 108 | path?: string; 109 | hash?: string; 110 | query?: Dictionary; 111 | params?: Dictionary; 112 | append?: boolean; 113 | replace?: boolean; 114 | } 115 | 116 | export interface Route { 117 | path: string; 118 | name?: string; 119 | hash: string; 120 | query: Dictionary; 121 | params: Dictionary; 122 | fullPath: string; 123 | matched: RouteRecord[]; 124 | redirectedFrom?: string; 125 | meta?: any; 126 | } 127 | 128 | /** 129 | * `` is the component for enabling user navigation in a router-enabled app. The target location is specified with the `to` prop. It renders as an `` tag with correct `href` by default, but can be configured with the `tag` prop. In addition, the link automatically gets an active CSS class when the target route is active. 130 | * `` is preferred over hard-coded `` for the following reasons: 131 | * - It works the same way in both HTML5 history mode and hash mode, so if you ever decide to switch mode, or when the router falls back to hash mode in IE9, nothing needs to be changed. 132 | * - In HTML5 history mode, `RouterLink` will intercept the click event so that the browser doesn't try to reload the page. 133 | * - When you are using the `base` option in HTML5 history mode, you don't need to include it in `to` prop's URLs. 134 | */ 135 | export class RouterLink extends Component<{ 136 | props: { 137 | /** 138 | * Denotes the target route of the link. When clicked, the value of the `to` prop will be passed to `router.push()` internally, so the value can be either a string or a location descriptor object. 139 | */ 140 | to: string | Location 141 | /** 142 | * Setting `replace` prop will call `router.replace()` instead of `router.push()` when clicked, so the navigation will not leave a history record. 143 | */ 144 | replace?: boolean 145 | /** 146 | * Setting `append` prop always appends the relative path to the current path. For example, assuming we are navigating from `/a` to a relative link `b`, without `append` we will end up at `/b`, but with `append` we will end up at `/a/b`. 147 | */ 148 | append?: boolean 149 | /** 150 | * Sometimes we want `` to render as another tag, e.g `
  • `. Then we can use `tag` prop to specify which tag to render to, and it will still listen to click events for navigation. 151 | */ 152 | tag?: string 153 | /** 154 | * Configure the active CSS class applied when the link is active. Note the default value can also be configured globally via the `linkActiveClass` router constructor option. 155 | */ 156 | 'active-class'?: string 157 | /** 158 | * The default active class matching behavior is **inclusive match**. For example, `` will get this class applied as long as the current path starts with `/a/` or is `/a`. 159 | * One consequence of this is that `` will be active for every route! To force the link into "exact match mode", use the `exact` prop: 160 | */ 161 | exact?: boolean 162 | /** 163 | * Specify the event(s) that can trigger the link navigation. 164 | */ 165 | event?: string | string[] 166 | /** 167 | * Configure the active CSS class applied when the link is active with exact match. Note the default value can also be configured globally via the `linkExactActiveClass` router constructor option. 168 | */ 169 | 'exact-active-class'?: string 170 | } 171 | }> { 172 | render(h: VueTSX.CreateElement): VueTSX.VNode 173 | } 174 | 175 | /** 176 | * The `` component is a functional component that renders the matched component for the given path. Components rendered in `` can also contain its own ``, which will render components for nested paths. 177 | * Any non-name props will be passed along to the rendered component, however most of the time the per-route data is contained in the route's params. 178 | */ 179 | export class RouterView extends Component<{ 180 | props: { 181 | /** 182 | * When a `` has a name, it will render the component with the corresponding name in the matched route record's `components` option. See [Named Views](../guide/essentials/named-views.md) for an example. 183 | */ 184 | name?: string 185 | } 186 | }> { 187 | render(h: VueTSX.CreateElement): VueTSX.VNode 188 | } 189 | -------------------------------------------------------------------------------- /packages/vue-router/typings/vue.d.ts: -------------------------------------------------------------------------------- 1 | import { VueTSX } from '@vue-tsx/vue' 2 | import { Router, NavigationGuard, Route } from './index' 3 | 4 | declare module '@vue-tsx/vue' { 5 | namespace VueTSX { 6 | interface Options { 7 | router?: Router 8 | beforeRouteEnter?: NavigationGuard; 9 | beforeRouteLeave?: NavigationGuard; 10 | beforeRouteUpdate?: NavigationGuard; 11 | } 12 | 13 | interface ComponentInstance { 14 | $router: Router; 15 | $route: Route; 16 | } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /packages/vue-router/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | csstype@^2.6.4: 6 | version "2.6.4" 7 | resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.4.tgz#d585a6062096e324e7187f80e04f92bd0f00e37f" 8 | integrity sha512-lAJUJP3M6HxFXbqtGRc0iZrdyeN+WzOWeY0q/VnFzI+kqVrYIzC7bWlKqCW7oCIdzoPkvfp82EVvrTlQ8zsWQg== 9 | 10 | tslib@^1.9.3: 11 | version "1.9.3" 12 | resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" 13 | integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== 14 | 15 | typescript@^3.4.5: 16 | version "3.4.5" 17 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" 18 | integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== 19 | 20 | vue-router@^3.0.6: 21 | version "3.0.6" 22 | resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.0.6.tgz#2e4f0f9cbb0b96d0205ab2690cfe588935136ac3" 23 | integrity sha512-Ox0ciFLswtSGRTHYhGvx2L44sVbTPNS+uD2kRISuo8B39Y79rOo0Kw0hzupTmiVtftQYCZl87mwldhh2L9Aquw== 24 | 25 | vue@^2.6.10: 26 | version "2.6.10" 27 | resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637" 28 | integrity sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ== 29 | -------------------------------------------------------------------------------- /packages/vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vue-tsx/vue", 3 | "version": "0.1.1-alpha.0", 4 | "module": "src/index.js", 5 | "license": "MIT", 6 | "typings": "typings/index.d.ts", 7 | "dependencies": { 8 | "csstype": "^2.6.4", 9 | "tslib": "^1.9.3", 10 | "typescript": "^3.4.5", 11 | "vue": "^2.6.10" 12 | }, 13 | "gitHead": "4e2a14a18bcfcc0ea2406e89f581729d57b64cd2" 14 | } 15 | -------------------------------------------------------------------------------- /packages/vue/src/index.js: -------------------------------------------------------------------------------- 1 | import RealVue from 'vue' 2 | 3 | const lifecycleHooks = [ 4 | 'beforeCreate', 5 | 'created', 6 | 'beforeMount', 7 | 'mounted', 8 | 'beforeUpdate', 9 | 'updated', 10 | 'beforeDestroy', 11 | 'destroyed', 12 | ] 13 | 14 | class Component { 15 | static get $_TSX_component() { 16 | if (!this.$_TSX_componentOptions) { 17 | this.$_buildComponent() 18 | } 19 | return this.$_TSX_componentOptions 20 | } 21 | 22 | static $_buildComponent() { 23 | console.log('building component') 24 | const options = { 25 | methods: {}, 26 | computed: {}, 27 | } 28 | 29 | const descriptor = Object.getOwnPropertyDescriptors(this.prototype) 30 | 31 | for (let key in descriptor) { 32 | if (key === 'render') { 33 | console.log('building render') 34 | options.render = transformRenderFn(this.prototype.render) 35 | } else if (key !== 'constructor') { 36 | if (descriptor[key].value) { 37 | options.methods[key] = descriptor[key].value 38 | 39 | if (lifecycleHooks.includes(key)) { 40 | options[key] = descriptor[key].value 41 | } 42 | } else { 43 | options.computed[key] = { 44 | get: descriptor[key].get, 45 | set: descriptor[key].set, 46 | } 47 | } 48 | } 49 | } 50 | 51 | options.name = this.prototype.constructor.name 52 | options.data = () => { 53 | const a = new this() 54 | a.__proto__ = null 55 | return a 56 | } 57 | 58 | const dummy = new this() 59 | 60 | if (dummy.$_watch) { 61 | options.watch = dummy.$_watch 62 | } 63 | 64 | this.$_TSX_componentOptions = options 65 | } 66 | } 67 | export const transformComponent = tag => { 68 | return tag !== null && tag.$_TSX_component 69 | ? tag.$_TSX_component 70 | : tag 71 | } 72 | const transformCreateElement = createElement => 73 | function(tag, ...args) { 74 | return createElement.call(this, transformComponent(tag), ...args) 75 | } 76 | const transformRenderFn = fn => 77 | function(h, ...args) { 78 | return fn.call(this, transformCreateElement(h), ...args) 79 | } 80 | class Vue extends RealVue { 81 | constructor(options) { 82 | const opts = { 83 | ...Object.keys(options).reduce( 84 | (obj, key) => ({ 85 | ...obj, 86 | [key]: !options[key] ? options[key] : options[key].$_TSX_infer ? options[key].$_TSX_infer : options[key], 87 | }), 88 | {}, 89 | ), 90 | render: transformRenderFn(options.render), 91 | } 92 | super(opts) 93 | } 94 | static use(plugin, ...args) { 95 | RealVue.use(plugin.$_TSX_plugin, ...args) 96 | } 97 | } 98 | 99 | function Watch(path, options) { 100 | return function(target, key) { 101 | if (!target.__proto__.$_watch) { 102 | Object.defineProperty(target.__proto__, '$_watch', { 103 | configurable: false, 104 | enumerable: false, 105 | writable: false, 106 | value: {}, 107 | }) 108 | } 109 | if (!target.__proto__.$_watch[path]) { 110 | target.__proto__.$_watch[path] = { 111 | ...(options || {}), 112 | handler: key, 113 | } 114 | } 115 | } 116 | } 117 | 118 | export { Component, Vue, Watch } 119 | -------------------------------------------------------------------------------- /packages/vue/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import { WatchOptions } from 'vue' 2 | import * as CSS from 'csstype' 3 | 4 | export namespace VueTSX { 5 | /** 6 | * Components: 7 | */ 8 | 9 | type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never 10 | type Emit = UnionToIntersection< 11 | { 12 | [P in keyof Events]: undefined extends Events[P] 13 | ? (eventName: P, payload?: Events[P]) => void 14 | : (eventName: P, payload: Events[P]) => void 15 | }[keyof Events] 16 | > 17 | type Listeners = { 18 | on?: ({ [P in keyof Events]?: (payload: Events[P]) => void }) 19 | } 20 | type ScopedSlot> = (...args: T extends any[] ? T : []) => VNode 21 | type ScopedSlots = { [T in keyof SS]: SS[T] extends void ? void | ScopedSlot : ScopedSlot } 22 | type ScopedSlotsProp = {} extends ScopedSlots 23 | ? { scopedSlots?: ScopedSlots } 24 | : { scopedSlots: ScopedSlots } 25 | 26 | interface DefaultOptions { 27 | props?: Record 28 | events?: Record 29 | scopedSlots?: Record 30 | } 31 | 32 | interface Component extends ComponentInstance { 33 | /** 34 | * Attributes 35 | */ 36 | $attrs: Options['props'] extends {} ? Options['props'] : {} 37 | /** 38 | * Emit an event 39 | */ 40 | $emit: Emit 41 | /** 42 | * Scoped slots 43 | */ 44 | $scopedSlots: ScopedSlots 45 | /** 46 | * Typescript trick, won't work in code 47 | */ 48 | $_props: (Options['props'] extends {} ? Options['props'] : {}) & 49 | (Listeners<(Options['events'] extends {} ? Options['events'] : {}) & { [key: string]: any }>) & 50 | (ScopedSlotsProp) 51 | 52 | render(h: CreateElement): VNode 53 | } 54 | 55 | interface VNode { 56 | _VNode: true 57 | } 58 | 59 | interface ComponentCreator { 60 | new (): Component 61 | } 62 | 63 | class BaseComponent { 64 | render(h: CreateElement): VNode 65 | } 66 | 67 | interface Instance {} 68 | 69 | interface ComponentInstance {} 70 | 71 | interface Options { 72 | el: HTMLElement | string | null 73 | render(h: VueTSX.CreateElement): VueTSX.VNode 74 | } 75 | 76 | interface Vue { 77 | new (options: Options): Instance 78 | use(plugin: any, options?: any): void 79 | } 80 | 81 | type CreateElement = (tag: string | typeof BaseComponent) => VNode 82 | 83 | type Watch = (path: string, options?: WatchOptions) => MethodDecorator 84 | 85 | /** 86 | * HTML Elements 87 | */ 88 | 89 | interface Event { 90 | /** 91 | * Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. 92 | */ 93 | readonly bubbles: boolean 94 | cancelBubble: boolean 95 | readonly cancelable: boolean 96 | /** 97 | * Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. 98 | */ 99 | readonly composed: boolean 100 | /** 101 | * Returns the object whose event listener's callback is currently being 102 | * invoked. 103 | */ 104 | readonly currentTarget: T 105 | readonly defaultPrevented: boolean 106 | readonly eventPhase: number 107 | /** 108 | * Returns true if event was dispatched by the user agent, and 109 | * false otherwise. 110 | */ 111 | readonly isTrusted: boolean 112 | returnValue: boolean 113 | /** @deprecated */ 114 | readonly srcElement: Element | null 115 | /** 116 | * Returns the object to which event is dispatched (its target). 117 | */ 118 | readonly target: EventTarget | null 119 | /** 120 | * Returns the event's timestamp as the number of milliseconds measured relative to 121 | * the time origin. 122 | */ 123 | readonly timeStamp: number 124 | /** 125 | * Returns the type of event, e.g. 126 | * "click", "hashchange", or 127 | * "submit". 128 | */ 129 | readonly type: string 130 | composedPath(): EventTarget[] 131 | initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void 132 | preventDefault(): void 133 | /** 134 | * Invoking this method prevents event from reaching 135 | * any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any 136 | * other objects. 137 | */ 138 | stopImmediatePropagation(): void 139 | /** 140 | * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. 141 | */ 142 | stopPropagation(): void 143 | readonly AT_TARGET: number 144 | readonly BUBBLING_PHASE: number 145 | readonly CAPTURING_PHASE: number 146 | readonly NONE: number 147 | } 148 | 149 | interface UIEvent extends Event { 150 | readonly detail: number 151 | readonly view: Window 152 | initUIEvent( 153 | typeArg: string, 154 | canBubbleArg: boolean, 155 | cancelableArg: boolean, 156 | viewArg: Window, 157 | detailArg: number, 158 | ): void 159 | } 160 | 161 | interface AnimationEvent extends Event { 162 | readonly animationName: string 163 | readonly elapsedTime: number 164 | readonly pseudoElement: string 165 | } 166 | 167 | interface FocusEvent extends UIEvent { 168 | readonly relatedTarget: EventTarget 169 | initFocusEvent( 170 | typeArg: string, 171 | canBubbleArg: boolean, 172 | cancelableArg: boolean, 173 | viewArg: Window, 174 | detailArg: number, 175 | relatedTargetArg: EventTarget, 176 | ): void 177 | } 178 | 179 | interface MouseEvent extends UIEvent { 180 | readonly altKey: boolean 181 | readonly button: number 182 | readonly buttons: number 183 | readonly clientX: number 184 | readonly clientY: number 185 | readonly ctrlKey: boolean 186 | /** @deprecated */ 187 | readonly fromElement: Element 188 | readonly layerX: number 189 | readonly layerY: number 190 | readonly metaKey: boolean 191 | readonly movementX: number 192 | readonly movementY: number 193 | readonly offsetX: number 194 | readonly offsetY: number 195 | readonly pageX: number 196 | readonly pageY: number 197 | readonly relatedTarget: EventTarget 198 | readonly screenX: number 199 | readonly screenY: number 200 | readonly shiftKey: boolean 201 | /** @deprecated */ 202 | readonly toElement: Element 203 | /** @deprecated */ 204 | readonly which: number 205 | readonly x: number 206 | readonly y: number 207 | getModifierState(keyArg: string): boolean 208 | initMouseEvent( 209 | typeArg: string, 210 | canBubbleArg: boolean, 211 | cancelableArg: boolean, 212 | viewArg: Window, 213 | detailArg: number, 214 | screenXArg: number, 215 | screenYArg: number, 216 | clientXArg: number, 217 | clientYArg: number, 218 | ctrlKeyArg: boolean, 219 | altKeyArg: boolean, 220 | shiftKeyArg: boolean, 221 | metaKeyArg: boolean, 222 | buttonArg: number, 223 | relatedTargetArg: EventTarget, 224 | ): void 225 | } 226 | 227 | interface DragEvent extends MouseEvent { 228 | /** 229 | * Returns the DataTransfer object for the event. 230 | */ 231 | readonly dataTransfer: DataTransfer | null 232 | } 233 | 234 | interface ErrorEvent extends Event { 235 | readonly colno: number 236 | readonly error: any 237 | readonly filename: string 238 | readonly lineno: number 239 | readonly message: string 240 | } 241 | 242 | interface PointerEvent extends MouseEvent { 243 | readonly height: number 244 | readonly isPrimary: boolean 245 | readonly pointerId: number 246 | readonly pointerType: string 247 | readonly pressure: number 248 | readonly tangentialPressure: number 249 | readonly tiltX: number 250 | readonly tiltY: number 251 | readonly twist: number 252 | readonly width: number 253 | } 254 | 255 | interface KeyboardEvent extends UIEvent { 256 | readonly altKey: boolean 257 | /** @deprecated */ 258 | char: string 259 | /** @deprecated */ 260 | readonly charCode: number 261 | readonly code: string 262 | readonly ctrlKey: boolean 263 | readonly key: string 264 | /** @deprecated */ 265 | readonly keyCode: number 266 | readonly location: number 267 | readonly metaKey: boolean 268 | readonly repeat: boolean 269 | readonly shiftKey: boolean 270 | /** @deprecated */ 271 | readonly which: number 272 | getModifierState(keyArg: string): boolean 273 | /** @deprecated */ 274 | initKeyboardEvent( 275 | typeArg: string, 276 | canBubbleArg: boolean, 277 | cancelableArg: boolean, 278 | viewArg: Window, 279 | keyArg: string, 280 | locationArg: number, 281 | modifiersListArg: string, 282 | repeat: boolean, 283 | locale: string, 284 | ): void 285 | readonly DOM_KEY_LOCATION_JOYSTICK: number 286 | readonly DOM_KEY_LOCATION_LEFT: number 287 | readonly DOM_KEY_LOCATION_MOBILE: number 288 | readonly DOM_KEY_LOCATION_NUMPAD: number 289 | readonly DOM_KEY_LOCATION_RIGHT: number 290 | readonly DOM_KEY_LOCATION_STANDARD: number 291 | } 292 | 293 | interface ProgressEvent extends Event { 294 | readonly lengthComputable: boolean 295 | readonly loaded: number 296 | readonly total: number 297 | } 298 | 299 | interface SecurityPolicyViolationEvent extends Event { 300 | readonly blockedURI: string 301 | readonly columnNumber: number 302 | readonly documentURI: string 303 | readonly effectiveDirective: string 304 | readonly lineNumber: number 305 | readonly originalPolicy: string 306 | readonly referrer: string 307 | readonly sourceFile: string 308 | readonly statusCode: number 309 | readonly violatedDirective: string 310 | } 311 | 312 | interface TouchEvent extends UIEvent { 313 | readonly altKey: boolean 314 | readonly changedTouches: TouchList 315 | readonly ctrlKey: boolean 316 | readonly metaKey: boolean 317 | readonly shiftKey: boolean 318 | readonly targetTouches: TouchList 319 | readonly touches: TouchList 320 | } 321 | 322 | interface TransitionEvent extends Event { 323 | readonly elapsedTime: number 324 | readonly propertyName: string 325 | readonly pseudoElement: string 326 | } 327 | 328 | interface WheelEvent extends MouseEvent { 329 | readonly deltaMode: number 330 | readonly deltaX: number 331 | readonly deltaY: number 332 | readonly deltaZ: number 333 | getCurrentPoint(element: Element): void 334 | initWheelEvent( 335 | typeArg: string, 336 | canBubbleArg: boolean, 337 | cancelableArg: boolean, 338 | viewArg: Window, 339 | detailArg: number, 340 | screenXArg: number, 341 | screenYArg: number, 342 | clientXArg: number, 343 | clientYArg: number, 344 | buttonArg: number, 345 | relatedTargetArg: EventTarget, 346 | modifiersListArg: string, 347 | deltaXArg: number, 348 | deltaYArg: number, 349 | deltaZArg: number, 350 | deltaMode: number, 351 | ): void 352 | readonly DOM_DELTA_LINE: number 353 | readonly DOM_DELTA_PAGE: number 354 | readonly DOM_DELTA_PIXEL: number 355 | } 356 | 357 | interface ClipboardEvent extends Event { 358 | readonly clipboardData: DataTransfer 359 | } 360 | 361 | interface ElementEventMap { 362 | fullscreenchange: Event 363 | fullscreenerror: Event 364 | } 365 | 366 | interface GlobalEventHandlersEventMap { 367 | abort: UIEvent 368 | animationcancel: AnimationEvent 369 | animationend: AnimationEvent 370 | animationiteration: AnimationEvent 371 | animationstart: AnimationEvent 372 | auxclick: Event 373 | blur: FocusEvent 374 | cancel: Event 375 | canplay: Event 376 | canplaythrough: Event 377 | change: Event 378 | click: MouseEvent 379 | close: Event 380 | contextmenu: MouseEvent 381 | cuechange: Event 382 | dblclick: MouseEvent 383 | drag: DragEvent 384 | dragend: DragEvent 385 | dragenter: DragEvent 386 | dragexit: Event 387 | dragleave: DragEvent 388 | dragover: DragEvent 389 | dragstart: DragEvent 390 | drop: DragEvent 391 | durationchange: Event 392 | emptied: Event 393 | ended: Event 394 | error: ErrorEvent 395 | focus: FocusEvent 396 | gotpointercapture: PointerEvent 397 | input: Event 398 | invalid: Event 399 | keydown: KeyboardEvent 400 | keypress: KeyboardEvent 401 | keyup: KeyboardEvent 402 | load: Event 403 | loadeddata: Event 404 | loadedmetadata: Event 405 | loadend: ProgressEvent 406 | loadstart: Event 407 | lostpointercapture: PointerEvent 408 | mousedown: MouseEvent 409 | mouseenter: MouseEvent 410 | mouseleave: MouseEvent 411 | mousemove: MouseEvent 412 | mouseout: MouseEvent 413 | mouseover: MouseEvent 414 | mouseup: MouseEvent 415 | pause: Event 416 | play: Event 417 | playing: Event 418 | pointercancel: PointerEvent 419 | pointerdown: PointerEvent 420 | pointerenter: PointerEvent 421 | pointerleave: PointerEvent 422 | pointermove: PointerEvent 423 | pointerout: PointerEvent 424 | pointerover: PointerEvent 425 | pointerup: PointerEvent 426 | progress: ProgressEvent 427 | ratechange: Event 428 | reset: Event 429 | resize: UIEvent 430 | scroll: UIEvent 431 | securitypolicyviolation: SecurityPolicyViolationEvent 432 | seeked: Event 433 | seeking: Event 434 | select: UIEvent 435 | stalled: Event 436 | submit: Event 437 | suspend: Event 438 | timeupdate: Event 439 | toggle: Event 440 | touchcancel: TouchEvent 441 | touchend: TouchEvent 442 | touchmove: TouchEvent 443 | touchstart: TouchEvent 444 | transitioncancel: TransitionEvent 445 | transitionend: TransitionEvent 446 | transitionrun: TransitionEvent 447 | transitionstart: TransitionEvent 448 | volumechange: Event 449 | waiting: Event 450 | wheel: WheelEvent 451 | } 452 | interface DocumentAndElementEventHandlersEventMap { 453 | copy: ClipboardEvent 454 | cut: ClipboardEvent 455 | paste: ClipboardEvent 456 | } 457 | 458 | interface HTMLElementEventMap 459 | extends ElementEventMap, 460 | GlobalEventHandlersEventMap, 461 | DocumentAndElementEventHandlersEventMap {} 462 | 463 | interface HTMLAttributes { 464 | // Standard HTML Attributes 465 | accessKey?: string 466 | class?: string | string[] | { [key: string]: boolean } 467 | contentEditable?: boolean 468 | contextMenu?: string 469 | dir?: string 470 | draggable?: boolean 471 | hidden?: boolean 472 | id?: string 473 | lang?: string 474 | placeholder?: string 475 | slot?: string 476 | spellCheck?: boolean 477 | style?: CSS.PropertiesHyphen | string 478 | tabIndex?: number 479 | title?: string 480 | 481 | // Unknown 482 | inputMode?: string 483 | is?: string 484 | radioGroup?: string // , 485 | 486 | // WAI-ARIA 487 | role?: string 488 | 489 | // RDFa Attributes 490 | about?: string 491 | datatype?: string 492 | inlist?: any 493 | prefix?: string 494 | property?: string 495 | resource?: string 496 | typeof?: string 497 | vocab?: string 498 | 499 | // Non-standard Attributes 500 | autoCapitalize?: string 501 | autoCorrect?: string 502 | autoSave?: string 503 | color?: string 504 | itemProp?: string 505 | itemScope?: boolean 506 | itemType?: string 507 | itemID?: string 508 | itemRef?: string 509 | results?: number 510 | security?: string 511 | unselectable?: 'on' | 'off' 512 | 513 | // Directives 514 | vModel?: any 515 | } 516 | 517 | // All the WAI-ARIA 1.1 attributes from https://www.w3.org/TR/wai-aria-1.1/ 518 | interface HTMLAttributes { 519 | /** Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application. */ 520 | 'aria-activedescendant'?: string 521 | /** Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute. */ 522 | 'aria-atomic'?: boolean | 'false' | 'true' 523 | /** 524 | * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be 525 | * presented if they are made. 526 | */ 527 | 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' 528 | /** Indicates an element is being modified and that assistive technologies MAY want to wait until the modifications are complete before exposing them to the user. */ 529 | 'aria-busy'?: boolean | 'false' | 'true' 530 | /** 531 | * Indicates the current "checked" state of checkboxes, radio buttons, and other widgets. 532 | * @see aria-pressed @see aria-selected. 533 | */ 534 | 'aria-checked'?: boolean | 'false' | 'mixed' | 'true' 535 | /** 536 | * Defines the total number of columns in a table, grid, or treegrid. 537 | * @see aria-colindex. 538 | */ 539 | 'aria-colcount'?: number 540 | /** 541 | * Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid. 542 | * @see aria-colcount @see aria-colspan. 543 | */ 544 | 'aria-colindex'?: number 545 | /** 546 | * Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid. 547 | * @see aria-colindex @see aria-rowspan. 548 | */ 549 | 'aria-colspan'?: number 550 | /** 551 | * Identifies the element (or elements) whose contents or presence are controlled by the current element. 552 | * @see aria-owns. 553 | */ 554 | 'aria-controls'?: string 555 | /** Indicates the element that represents the current item within a container or set of related elements. */ 556 | 'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time' 557 | /** 558 | * Identifies the element (or elements) that describes the object. 559 | * @see aria-labelledby 560 | */ 561 | 'aria-describedby'?: string 562 | /** 563 | * Identifies the element that provides a detailed, extended description for the object. 564 | * @see aria-describedby. 565 | */ 566 | 'aria-details'?: string 567 | /** 568 | * Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable. 569 | * @see aria-hidden @see aria-readonly. 570 | */ 571 | 'aria-disabled'?: boolean | 'false' | 'true' 572 | /** 573 | * Indicates what functions can be performed when a dragged object is released on the drop target. 574 | * @deprecated in ARIA 1.1 575 | */ 576 | 'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup' 577 | /** 578 | * Identifies the element that provides an error message for the object. 579 | * @see aria-invalid @see aria-describedby. 580 | */ 581 | 'aria-errormessage'?: string 582 | /** Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed. */ 583 | 'aria-expanded'?: boolean | 'false' | 'true' 584 | /** 585 | * Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, 586 | * allows assistive technology to override the general default of reading in document source order. 587 | */ 588 | 'aria-flowto'?: string 589 | /** 590 | * Indicates an element's "grabbed" state in a drag-and-drop operation. 591 | * @deprecated in ARIA 1.1 592 | */ 593 | 'aria-grabbed'?: boolean | 'false' | 'true' 594 | /** Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element. */ 595 | 'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' 596 | /** 597 | * Indicates whether the element is exposed to an accessibility API. 598 | * @see aria-disabled. 599 | */ 600 | 'aria-hidden'?: boolean | 'false' | 'true' 601 | /** 602 | * Indicates the entered value does not conform to the format expected by the application. 603 | * @see aria-errormessage. 604 | */ 605 | 'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling' 606 | /** Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element. */ 607 | 'aria-keyshortcuts'?: string 608 | /** 609 | * Defines a string value that labels the current element. 610 | * @see aria-labelledby. 611 | */ 612 | 'aria-label'?: string 613 | /** 614 | * Identifies the element (or elements) that labels the current element. 615 | * @see aria-describedby. 616 | */ 617 | 'aria-labelledby'?: string 618 | /** Defines the hierarchical level of an element within a structure. */ 619 | 'aria-level'?: number 620 | /** Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region. */ 621 | 'aria-live'?: 'off' | 'assertive' | 'polite' 622 | /** Indicates whether an element is modal when displayed. */ 623 | 'aria-modal'?: boolean | 'false' | 'true' 624 | /** Indicates whether a text box accepts multiple lines of input or only a single line. */ 625 | 'aria-multiline'?: boolean | 'false' | 'true' 626 | /** Indicates that the user may select more than one item from the current selectable descendants. */ 627 | 'aria-multiselectable'?: boolean | 'false' | 'true' 628 | /** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */ 629 | 'aria-orientation'?: 'horizontal' | 'vertical' 630 | /** 631 | * Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship 632 | * between DOM elements where the DOM hierarchy cannot be used to represent the relationship. 633 | * @see aria-controls. 634 | */ 635 | 'aria-owns'?: string 636 | /** 637 | * Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. 638 | * A hint could be a sample value or a brief description of the expected format. 639 | */ 640 | 'aria-placeholder'?: string 641 | /** 642 | * Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. 643 | * @see aria-setsize. 644 | */ 645 | 'aria-posinset'?: number 646 | /** 647 | * Indicates the current "pressed" state of toggle buttons. 648 | * @see aria-checked @see aria-selected. 649 | */ 650 | 'aria-pressed'?: boolean | 'false' | 'mixed' | 'true' 651 | /** 652 | * Indicates that the element is not editable, but is otherwise operable. 653 | * @see aria-disabled. 654 | */ 655 | 'aria-readonly'?: boolean | 'false' | 'true' 656 | /** 657 | * Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified. 658 | * @see aria-atomic. 659 | */ 660 | 'aria-relevant'?: 'additions' | 'additions text' | 'all' | 'removals' | 'text' 661 | /** Indicates that user input is required on the element before a form may be submitted. */ 662 | 'aria-required'?: boolean | 'false' | 'true' 663 | /** Defines a human-readable, author-localized description for the role of an element. */ 664 | 'aria-roledescription'?: string 665 | /** 666 | * Defines the total number of rows in a table, grid, or treegrid. 667 | * @see aria-rowindex. 668 | */ 669 | 'aria-rowcount'?: number 670 | /** 671 | * Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid. 672 | * @see aria-rowcount @see aria-rowspan. 673 | */ 674 | 'aria-rowindex'?: number 675 | /** 676 | * Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid. 677 | * @see aria-rowindex @see aria-colspan. 678 | */ 679 | 'aria-rowspan'?: number 680 | /** 681 | * Indicates the current "selected" state of various widgets. 682 | * @see aria-checked @see aria-pressed. 683 | */ 684 | 'aria-selected'?: boolean | 'false' | 'true' 685 | /** 686 | * Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM. 687 | * @see aria-posinset. 688 | */ 689 | 'aria-setsize'?: number 690 | /** Indicates if items in a table or grid are sorted in ascending or descending order. */ 691 | 'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' 692 | /** Defines the maximum allowed value for a range widget. */ 693 | 'aria-valuemax'?: number 694 | /** Defines the minimum allowed value for a range widget. */ 695 | 'aria-valuemin'?: number 696 | /** 697 | * Defines the current value for a range widget. 698 | * @see aria-valuetext. 699 | */ 700 | 'aria-valuenow'?: number 701 | /** Defines the human readable text alternative of aria-valuenow for a range widget. */ 702 | 'aria-valuetext'?: string 703 | } 704 | 705 | interface AnchorHTMLAttributes extends HTMLAttributes { 706 | download?: any 707 | href?: string 708 | hrefLang?: string 709 | media?: string 710 | rel?: string 711 | target?: string 712 | type?: string 713 | referrerPolicy?: string 714 | } 715 | 716 | // tslint:disable-next-line:no-empty-interface 717 | interface AudioHTMLAttributes extends MediaHTMLAttributes {} 718 | 719 | interface AreaHTMLAttributes extends HTMLAttributes { 720 | alt?: string 721 | coords?: string 722 | download?: any 723 | href?: string 724 | hrefLang?: string 725 | media?: string 726 | rel?: string 727 | shape?: string 728 | target?: string 729 | } 730 | 731 | interface BaseHTMLAttributes extends HTMLAttributes { 732 | href?: string 733 | target?: string 734 | } 735 | 736 | interface BlockquoteHTMLAttributes extends HTMLAttributes { 737 | cite?: string 738 | } 739 | 740 | interface ButtonHTMLAttributes extends HTMLAttributes { 741 | autoFocus?: boolean 742 | disabled?: boolean 743 | form?: string 744 | formAction?: string 745 | formEncType?: string 746 | formMethod?: string 747 | formNoValidate?: boolean 748 | formTarget?: string 749 | name?: string 750 | type?: 'submit' | 'reset' | 'button' 751 | value?: string | string[] | number 752 | } 753 | 754 | interface CanvasHTMLAttributes extends HTMLAttributes { 755 | height?: number | string 756 | width?: number | string 757 | } 758 | 759 | interface ColHTMLAttributes extends HTMLAttributes { 760 | span?: number 761 | width?: number | string 762 | } 763 | 764 | interface ColgroupHTMLAttributes extends HTMLAttributes { 765 | span?: number 766 | } 767 | 768 | interface DetailsHTMLAttributes extends HTMLAttributes { 769 | open?: boolean 770 | } 771 | 772 | interface DelHTMLAttributes extends HTMLAttributes { 773 | cite?: string 774 | dateTime?: string 775 | } 776 | 777 | interface DialogHTMLAttributes extends HTMLAttributes { 778 | open?: boolean 779 | } 780 | 781 | interface EmbedHTMLAttributes extends HTMLAttributes { 782 | height?: number | string 783 | src?: string 784 | type?: string 785 | width?: number | string 786 | } 787 | 788 | interface FieldsetHTMLAttributes extends HTMLAttributes { 789 | disabled?: boolean 790 | form?: string 791 | name?: string 792 | } 793 | 794 | interface FormHTMLAttributes extends HTMLAttributes { 795 | acceptCharset?: string 796 | action?: string 797 | autoComplete?: string 798 | encType?: string 799 | method?: string 800 | name?: string 801 | noValidate?: boolean 802 | target?: string 803 | } 804 | 805 | interface HtmlHTMLAttributes extends HTMLAttributes { 806 | manifest?: string 807 | } 808 | 809 | interface IframeHTMLAttributes extends HTMLAttributes { 810 | allow?: string 811 | allowFullScreen?: boolean 812 | allowTransparency?: boolean 813 | frameBorder?: number | string 814 | height?: number | string 815 | marginHeight?: number 816 | marginWidth?: number 817 | name?: string 818 | sandbox?: string 819 | scrolling?: string 820 | seamless?: boolean 821 | src?: string 822 | srcDoc?: string 823 | width?: number | string 824 | } 825 | 826 | interface ImgHTMLAttributes extends HTMLAttributes { 827 | alt?: string 828 | crossOrigin?: 'anonymous' | 'use-credentials' | '' 829 | decoding?: 'async' | 'auto' | 'sync' 830 | height?: number | string 831 | sizes?: string 832 | src?: string 833 | srcSet?: string 834 | useMap?: string 835 | width?: number | string 836 | } 837 | 838 | interface InsHTMLAttributes extends HTMLAttributes { 839 | cite?: string 840 | dateTime?: string 841 | } 842 | 843 | interface InputHTMLAttributes extends HTMLAttributes { 844 | accept?: string 845 | alt?: string 846 | autoComplete?: string 847 | autoFocus?: boolean 848 | capture?: boolean | string // https://www.w3.org/TR/html-media-capture/#the-capture-attribute 849 | checked?: boolean 850 | crossOrigin?: string 851 | disabled?: boolean 852 | form?: string 853 | formAction?: string 854 | formEncType?: string 855 | formMethod?: string 856 | formNoValidate?: boolean 857 | formTarget?: string 858 | height?: number | string 859 | list?: string 860 | max?: number | string 861 | maxLength?: number 862 | min?: number | string 863 | minLength?: number 864 | multiple?: boolean 865 | name?: string 866 | pattern?: string 867 | placeholder?: string 868 | readOnly?: boolean 869 | required?: boolean 870 | size?: number 871 | src?: string 872 | step?: number | string 873 | type?: string 874 | value?: string | string[] | number 875 | width?: number | string 876 | } 877 | 878 | interface KeygenHTMLAttributes extends HTMLAttributes { 879 | autoFocus?: boolean 880 | challenge?: string 881 | disabled?: boolean 882 | form?: string 883 | keyType?: string 884 | keyParams?: string 885 | name?: string 886 | } 887 | 888 | interface LabelHTMLAttributes extends HTMLAttributes { 889 | form?: string 890 | htmlFor?: string 891 | } 892 | 893 | interface LiHTMLAttributes extends HTMLAttributes { 894 | value?: string | string[] | number 895 | } 896 | 897 | interface LinkHTMLAttributes extends HTMLAttributes { 898 | as?: string 899 | crossOrigin?: string 900 | href?: string 901 | hrefLang?: string 902 | integrity?: string 903 | media?: string 904 | rel?: string 905 | sizes?: string 906 | type?: string 907 | } 908 | 909 | interface MapHTMLAttributes extends HTMLAttributes { 910 | name?: string 911 | } 912 | 913 | interface MenuHTMLAttributes extends HTMLAttributes { 914 | type?: string 915 | } 916 | 917 | interface MediaHTMLAttributes extends HTMLAttributes { 918 | autoPlay?: boolean 919 | controls?: boolean 920 | controlsList?: string 921 | crossOrigin?: string 922 | loop?: boolean 923 | mediaGroup?: string 924 | muted?: boolean 925 | playsinline?: boolean 926 | preload?: string 927 | src?: string 928 | } 929 | 930 | interface MetaHTMLAttributes extends HTMLAttributes { 931 | charSet?: string 932 | content?: string 933 | httpEquiv?: string 934 | name?: string 935 | } 936 | 937 | interface MeterHTMLAttributes extends HTMLAttributes { 938 | form?: string 939 | high?: number 940 | low?: number 941 | max?: number | string 942 | min?: number | string 943 | optimum?: number 944 | value?: string | string[] | number 945 | } 946 | 947 | interface QuoteHTMLAttributes extends HTMLAttributes { 948 | cite?: string 949 | } 950 | 951 | interface ObjectHTMLAttributes extends HTMLAttributes { 952 | classID?: string 953 | data?: string 954 | form?: string 955 | height?: number | string 956 | name?: string 957 | type?: string 958 | useMap?: string 959 | width?: number | string 960 | wmode?: string 961 | } 962 | 963 | interface OlHTMLAttributes extends HTMLAttributes { 964 | reversed?: boolean 965 | start?: number 966 | type?: '1' | 'a' | 'A' | 'i' | 'I' 967 | } 968 | 969 | interface OptgroupHTMLAttributes extends HTMLAttributes { 970 | disabled?: boolean 971 | label?: string 972 | } 973 | 974 | interface OptionHTMLAttributes extends HTMLAttributes { 975 | disabled?: boolean 976 | label?: string 977 | selected?: boolean 978 | value?: string | string[] | number 979 | } 980 | 981 | interface OutputHTMLAttributes extends HTMLAttributes { 982 | form?: string 983 | htmlFor?: string 984 | name?: string 985 | } 986 | 987 | interface ParamHTMLAttributes extends HTMLAttributes { 988 | name?: string 989 | value?: string | string[] | number 990 | } 991 | 992 | interface ProgressHTMLAttributes extends HTMLAttributes { 993 | max?: number | string 994 | value?: string | string[] | number 995 | } 996 | 997 | interface ScriptHTMLAttributes extends HTMLAttributes { 998 | async?: boolean 999 | charSet?: string 1000 | crossOrigin?: string 1001 | defer?: boolean 1002 | integrity?: string 1003 | noModule?: boolean 1004 | nonce?: string 1005 | src?: string 1006 | type?: string 1007 | } 1008 | 1009 | interface SelectHTMLAttributes extends HTMLAttributes { 1010 | autoComplete?: string 1011 | autoFocus?: boolean 1012 | disabled?: boolean 1013 | form?: string 1014 | multiple?: boolean 1015 | name?: string 1016 | required?: boolean 1017 | size?: number 1018 | value?: string | string[] | number 1019 | } 1020 | 1021 | interface SourceHTMLAttributes extends HTMLAttributes { 1022 | media?: string 1023 | sizes?: string 1024 | src?: string 1025 | srcSet?: string 1026 | type?: string 1027 | } 1028 | 1029 | interface StyleHTMLAttributes extends HTMLAttributes { 1030 | media?: string 1031 | nonce?: string 1032 | scoped?: boolean 1033 | type?: string 1034 | } 1035 | 1036 | interface TableHTMLAttributes extends HTMLAttributes { 1037 | cellPadding?: number | string 1038 | cellSpacing?: number | string 1039 | summary?: string 1040 | } 1041 | 1042 | interface TextareaHTMLAttributes extends HTMLAttributes { 1043 | autoComplete?: string 1044 | autoFocus?: boolean 1045 | cols?: number 1046 | dirName?: string 1047 | disabled?: boolean 1048 | form?: string 1049 | maxLength?: number 1050 | minLength?: number 1051 | name?: string 1052 | placeholder?: string 1053 | readOnly?: boolean 1054 | required?: boolean 1055 | rows?: number 1056 | value?: string | string[] | number 1057 | wrap?: string 1058 | } 1059 | 1060 | interface TdHTMLAttributes extends HTMLAttributes { 1061 | align?: 'left' | 'center' | 'right' | 'justify' | 'char' 1062 | colSpan?: number 1063 | headers?: string 1064 | rowSpan?: number 1065 | scope?: string 1066 | } 1067 | 1068 | interface ThHTMLAttributes extends HTMLAttributes { 1069 | align?: 'left' | 'center' | 'right' | 'justify' | 'char' 1070 | colSpan?: number 1071 | headers?: string 1072 | rowSpan?: number 1073 | scope?: string 1074 | } 1075 | 1076 | interface TimeHTMLAttributes extends HTMLAttributes { 1077 | dateTime?: string 1078 | } 1079 | 1080 | interface TrackHTMLAttributes extends HTMLAttributes { 1081 | default?: boolean 1082 | kind?: string 1083 | label?: string 1084 | src?: string 1085 | srcLang?: string 1086 | } 1087 | 1088 | interface VideoHTMLAttributes extends MediaHTMLAttributes { 1089 | height?: number | string 1090 | playsInline?: boolean 1091 | poster?: string 1092 | width?: number | string 1093 | } 1094 | 1095 | interface SVGAttributes { 1096 | // Attributes which also defined in HTMLAttributes 1097 | // See comment in SVGDOMPropertyConfig.js 1098 | className?: string 1099 | color?: string 1100 | height?: number | string 1101 | id?: string 1102 | lang?: string 1103 | max?: number | string 1104 | media?: string 1105 | method?: string 1106 | min?: number | string 1107 | name?: string 1108 | style?: CSS.PropertiesHyphen | string 1109 | target?: string 1110 | type?: string 1111 | width?: number | string 1112 | 1113 | // Other HTML properties supported by SVG elements in browsers 1114 | role?: string 1115 | tabIndex?: number 1116 | 1117 | // SVG Specific attributes 1118 | accentHeight?: number | string 1119 | accumulate?: 'none' | 'sum' 1120 | additive?: 'replace' | 'sum' 1121 | alignmentBaseline?: 1122 | | 'auto' 1123 | | 'baseline' 1124 | | 'before-edge' 1125 | | 'text-before-edge' 1126 | | 'middle' 1127 | | 'central' 1128 | | 'after-edge' 1129 | | 'text-after-edge' 1130 | | 'ideographic' 1131 | | 'alphabetic' 1132 | | 'hanging' 1133 | | 'mathematical' 1134 | | 'inherit' 1135 | allowReorder?: 'no' | 'yes' 1136 | alphabetic?: number | string 1137 | amplitude?: number | string 1138 | arabicForm?: 'initial' | 'medial' | 'terminal' | 'isolated' 1139 | ascent?: number | string 1140 | attributeName?: string 1141 | attributeType?: string 1142 | autoReverse?: number | string 1143 | azimuth?: number | string 1144 | baseFrequency?: number | string 1145 | baselineShift?: number | string 1146 | baseProfile?: number | string 1147 | bbox?: number | string 1148 | begin?: number | string 1149 | bias?: number | string 1150 | by?: number | string 1151 | calcMode?: number | string 1152 | capHeight?: number | string 1153 | clip?: number | string 1154 | clipPath?: string 1155 | clipPathUnits?: number | string 1156 | clipRule?: number | string 1157 | colorInterpolation?: number | string 1158 | colorInterpolationFilters?: 'auto' | 'sRGB' | 'linearRGB' | 'inherit' 1159 | colorProfile?: number | string 1160 | colorRendering?: number | string 1161 | contentScriptType?: number | string 1162 | contentStyleType?: number | string 1163 | cursor?: number | string 1164 | cx?: number | string 1165 | cy?: number | string 1166 | d?: string 1167 | decelerate?: number | string 1168 | descent?: number | string 1169 | diffuseConstant?: number | string 1170 | direction?: number | string 1171 | display?: number | string 1172 | divisor?: number | string 1173 | dominantBaseline?: number | string 1174 | dur?: number | string 1175 | dx?: number | string 1176 | dy?: number | string 1177 | edgeMode?: number | string 1178 | elevation?: number | string 1179 | enableBackground?: number | string 1180 | end?: number | string 1181 | exponent?: number | string 1182 | externalResourcesRequired?: number | string 1183 | fill?: string 1184 | fillOpacity?: number | string 1185 | fillRule?: 'nonzero' | 'evenodd' | 'inherit' 1186 | filter?: string 1187 | filterRes?: number | string 1188 | filterUnits?: number | string 1189 | floodColor?: number | string 1190 | floodOpacity?: number | string 1191 | focusable?: number | string 1192 | fontFamily?: string 1193 | fontSize?: number | string 1194 | fontSizeAdjust?: number | string 1195 | fontStretch?: number | string 1196 | fontStyle?: number | string 1197 | fontVariant?: number | string 1198 | fontWeight?: number | string 1199 | format?: number | string 1200 | from?: number | string 1201 | fx?: number | string 1202 | fy?: number | string 1203 | g1?: number | string 1204 | g2?: number | string 1205 | glyphName?: number | string 1206 | glyphOrientationHorizontal?: number | string 1207 | glyphOrientationVertical?: number | string 1208 | glyphRef?: number | string 1209 | gradientTransform?: string 1210 | gradientUnits?: string 1211 | hanging?: number | string 1212 | horizAdvX?: number | string 1213 | horizOriginX?: number | string 1214 | href?: string 1215 | ideographic?: number | string 1216 | imageRendering?: number | string 1217 | in2?: number | string 1218 | in?: string 1219 | intercept?: number | string 1220 | k1?: number | string 1221 | k2?: number | string 1222 | k3?: number | string 1223 | k4?: number | string 1224 | k?: number | string 1225 | kernelMatrix?: number | string 1226 | kernelUnitLength?: number | string 1227 | kerning?: number | string 1228 | keyPoints?: number | string 1229 | keySplines?: number | string 1230 | keyTimes?: number | string 1231 | lengthAdjust?: number | string 1232 | letterSpacing?: number | string 1233 | lightingColor?: number | string 1234 | limitingConeAngle?: number | string 1235 | local?: number | string 1236 | markerEnd?: string 1237 | markerHeight?: number | string 1238 | markerMid?: string 1239 | markerStart?: string 1240 | markerUnits?: number | string 1241 | markerWidth?: number | string 1242 | mask?: string 1243 | maskContentUnits?: number | string 1244 | maskUnits?: number | string 1245 | mathematical?: number | string 1246 | mode?: number | string 1247 | numOctaves?: number | string 1248 | offset?: number | string 1249 | opacity?: number | string 1250 | operator?: number | string 1251 | order?: number | string 1252 | orient?: number | string 1253 | orientation?: number | string 1254 | origin?: number | string 1255 | overflow?: number | string 1256 | overlinePosition?: number | string 1257 | overlineThickness?: number | string 1258 | paintOrder?: number | string 1259 | panose1?: number | string 1260 | pathLength?: number | string 1261 | patternContentUnits?: string 1262 | patternTransform?: number | string 1263 | patternUnits?: string 1264 | pointerEvents?: number | string 1265 | points?: string 1266 | pointsAtX?: number | string 1267 | pointsAtY?: number | string 1268 | pointsAtZ?: number | string 1269 | preserveAlpha?: number | string 1270 | preserveAspectRatio?: string 1271 | primitiveUnits?: number | string 1272 | r?: number | string 1273 | radius?: number | string 1274 | refX?: number | string 1275 | refY?: number | string 1276 | renderingIntent?: number | string 1277 | repeatCount?: number | string 1278 | repeatDur?: number | string 1279 | requiredExtensions?: number | string 1280 | requiredFeatures?: number | string 1281 | restart?: number | string 1282 | result?: string 1283 | rotate?: number | string 1284 | rx?: number | string 1285 | ry?: number | string 1286 | scale?: number | string 1287 | seed?: number | string 1288 | shapeRendering?: number | string 1289 | slope?: number | string 1290 | spacing?: number | string 1291 | specularConstant?: number | string 1292 | specularExponent?: number | string 1293 | speed?: number | string 1294 | spreadMethod?: string 1295 | startOffset?: number | string 1296 | stdDeviation?: number | string 1297 | stemh?: number | string 1298 | stemv?: number | string 1299 | stitchTiles?: number | string 1300 | stopColor?: string 1301 | stopOpacity?: number | string 1302 | strikethroughPosition?: number | string 1303 | strikethroughThickness?: number | string 1304 | string?: number | string 1305 | stroke?: string 1306 | strokeDasharray?: string | number 1307 | strokeDashoffset?: string | number 1308 | strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit' 1309 | strokeLinejoin?: 'miter' | 'round' | 'bevel' | 'inherit' 1310 | strokeMiterlimit?: number | string 1311 | strokeOpacity?: number | string 1312 | strokeWidth?: number | string 1313 | surfaceScale?: number | string 1314 | systemLanguage?: number | string 1315 | tableValues?: number | string 1316 | targetX?: number | string 1317 | targetY?: number | string 1318 | textAnchor?: string 1319 | textDecoration?: number | string 1320 | textLength?: number | string 1321 | textRendering?: number | string 1322 | to?: number | string 1323 | transform?: string 1324 | u1?: number | string 1325 | u2?: number | string 1326 | underlinePosition?: number | string 1327 | underlineThickness?: number | string 1328 | unicode?: number | string 1329 | unicodeBidi?: number | string 1330 | unicodeRange?: number | string 1331 | unitsPerEm?: number | string 1332 | vAlphabetic?: number | string 1333 | values?: string 1334 | vectorEffect?: number | string 1335 | version?: string 1336 | vertAdvY?: number | string 1337 | vertOriginX?: number | string 1338 | vertOriginY?: number | string 1339 | vHanging?: number | string 1340 | vIdeographic?: number | string 1341 | viewBox?: string 1342 | viewTarget?: number | string 1343 | visibility?: number | string 1344 | vMathematical?: number | string 1345 | widths?: number | string 1346 | wordSpacing?: number | string 1347 | writingMode?: number | string 1348 | x1?: number | string 1349 | x2?: number | string 1350 | x?: number | string 1351 | xChannelSelector?: string 1352 | xHeight?: number | string 1353 | xlinkActuate?: string 1354 | xlinkArcrole?: string 1355 | xlinkHref?: string 1356 | xlinkRole?: string 1357 | xlinkShow?: string 1358 | xlinkTitle?: string 1359 | xlinkType?: string 1360 | xmlBase?: string 1361 | xmlLang?: string 1362 | xmlns?: string 1363 | xmlnsXlink?: string 1364 | xmlSpace?: string 1365 | y1?: number | string 1366 | y2?: number | string 1367 | y?: number | string 1368 | yChannelSelector?: string 1369 | z?: number | string 1370 | zoomAndPan?: string 1371 | } 1372 | 1373 | type ElementBuilder = T & Listeners> 1374 | type SVGElementBuilder = T & Listeners> 1375 | 1376 | interface HTMLElements { 1377 | a: ElementBuilder, HTMLAnchorElement> 1378 | abbr: ElementBuilder, HTMLElement> 1379 | address: ElementBuilder, HTMLElement> 1380 | area: ElementBuilder, HTMLAreaElement> 1381 | article: ElementBuilder, HTMLElement> 1382 | aside: ElementBuilder, HTMLElement> 1383 | audio: ElementBuilder, HTMLAudioElement> 1384 | b: ElementBuilder, HTMLElement> 1385 | base: ElementBuilder, HTMLBaseElement> 1386 | bdi: ElementBuilder, HTMLElement> 1387 | bdo: ElementBuilder, HTMLElement> 1388 | big: ElementBuilder, HTMLElement> 1389 | blockquote: ElementBuilder, HTMLElement> 1390 | body: ElementBuilder, HTMLBodyElement> 1391 | br: ElementBuilder, HTMLBRElement> 1392 | button: ElementBuilder, HTMLButtonElement> 1393 | canvas: ElementBuilder, HTMLCanvasElement> 1394 | caption: ElementBuilder, HTMLElement> 1395 | cite: ElementBuilder, HTMLElement> 1396 | code: ElementBuilder, HTMLElement> 1397 | col: ElementBuilder, HTMLTableColElement> 1398 | colgroup: ElementBuilder, HTMLTableColElement> 1399 | data: ElementBuilder, HTMLElement> 1400 | datalist: ElementBuilder, HTMLDataListElement> 1401 | dd: ElementBuilder, HTMLElement> 1402 | del: ElementBuilder, HTMLElement> 1403 | details: ElementBuilder, HTMLElement> 1404 | dfn: ElementBuilder, HTMLElement> 1405 | dialog: ElementBuilder, HTMLDialogElement> 1406 | div: ElementBuilder, HTMLDivElement> 1407 | dl: ElementBuilder, HTMLDListElement> 1408 | dt: ElementBuilder, HTMLElement> 1409 | em: ElementBuilder, HTMLElement> 1410 | embed: ElementBuilder, HTMLEmbedElement> 1411 | fieldset: ElementBuilder, HTMLFieldSetElement> 1412 | figcaption: ElementBuilder, HTMLElement> 1413 | figure: ElementBuilder, HTMLElement> 1414 | footer: ElementBuilder, HTMLElement> 1415 | form: ElementBuilder, HTMLFormElement> 1416 | h1: ElementBuilder, HTMLHeadingElement> 1417 | h2: ElementBuilder, HTMLHeadingElement> 1418 | h3: ElementBuilder, HTMLHeadingElement> 1419 | h4: ElementBuilder, HTMLHeadingElement> 1420 | h5: ElementBuilder, HTMLHeadingElement> 1421 | h6: ElementBuilder, HTMLHeadingElement> 1422 | head: ElementBuilder, HTMLHeadElement> 1423 | header: ElementBuilder, HTMLElement> 1424 | hgroup: ElementBuilder, HTMLElement> 1425 | hr: ElementBuilder, HTMLHRElement> 1426 | html: ElementBuilder, HTMLHtmlElement> 1427 | i: ElementBuilder, HTMLElement> 1428 | iframe: ElementBuilder, HTMLIFrameElement> 1429 | img: ElementBuilder, HTMLImageElement> 1430 | input: ElementBuilder, HTMLInputElement> 1431 | ins: ElementBuilder, HTMLModElement> 1432 | kbd: ElementBuilder, HTMLElement> 1433 | keygen: ElementBuilder, HTMLElement> 1434 | label: ElementBuilder, HTMLLabelElement> 1435 | legend: ElementBuilder, HTMLLegendElement> 1436 | li: ElementBuilder, HTMLLIElement> 1437 | link: ElementBuilder, HTMLLinkElement> 1438 | main: ElementBuilder, HTMLElement> 1439 | map: ElementBuilder, HTMLMapElement> 1440 | mark: ElementBuilder, HTMLElement> 1441 | menu: ElementBuilder, HTMLElement> 1442 | menuitem: ElementBuilder, HTMLElement> 1443 | meta: ElementBuilder, HTMLMetaElement> 1444 | meter: ElementBuilder, HTMLElement> 1445 | nav: ElementBuilder, HTMLElement> 1446 | noscript: ElementBuilder, HTMLElement> 1447 | object: ElementBuilder, HTMLObjectElement> 1448 | ol: ElementBuilder, HTMLOListElement> 1449 | optgroup: ElementBuilder, HTMLOptGroupElement> 1450 | option: ElementBuilder, HTMLOptionElement> 1451 | output: ElementBuilder, HTMLElement> 1452 | p: ElementBuilder, HTMLParagraphElement> 1453 | param: ElementBuilder, HTMLParamElement> 1454 | picture: ElementBuilder, HTMLElement> 1455 | pre: ElementBuilder, HTMLPreElement> 1456 | progress: ElementBuilder, HTMLProgressElement> 1457 | q: ElementBuilder, HTMLQuoteElement> 1458 | rp: ElementBuilder, HTMLElement> 1459 | rt: ElementBuilder, HTMLElement> 1460 | ruby: ElementBuilder, HTMLElement> 1461 | s: ElementBuilder, HTMLElement> 1462 | samp: ElementBuilder, HTMLElement> 1463 | script: ElementBuilder, HTMLScriptElement> 1464 | section: ElementBuilder, HTMLElement> 1465 | select: ElementBuilder, HTMLSelectElement> 1466 | small: ElementBuilder, HTMLElement> 1467 | source: ElementBuilder, HTMLSourceElement> 1468 | span: ElementBuilder, HTMLSpanElement> 1469 | strong: ElementBuilder, HTMLElement> 1470 | style: ElementBuilder, HTMLStyleElement> 1471 | sub: ElementBuilder, HTMLElement> 1472 | summary: ElementBuilder, HTMLElement> 1473 | sup: ElementBuilder, HTMLElement> 1474 | table: ElementBuilder, HTMLTableElement> 1475 | tbody: ElementBuilder, HTMLTableSectionElement> 1476 | td: ElementBuilder, HTMLTableDataCellElement> 1477 | textarea: ElementBuilder, HTMLTextAreaElement> 1478 | tfoot: ElementBuilder, HTMLTableSectionElement> 1479 | th: ElementBuilder, HTMLTableHeaderCellElement> 1480 | thead: ElementBuilder, HTMLTableSectionElement> 1481 | time: ElementBuilder, HTMLElement> 1482 | title: ElementBuilder, HTMLTitleElement> 1483 | tr: ElementBuilder, HTMLTableRowElement> 1484 | track: ElementBuilder, HTMLTrackElement> 1485 | u: ElementBuilder, HTMLElement> 1486 | ul: ElementBuilder, HTMLUListElement> 1487 | var: ElementBuilder, HTMLElement> 1488 | video: ElementBuilder, HTMLVideoElement> 1489 | wbr: ElementBuilder, HTMLElement> 1490 | } 1491 | interface SVGElements { 1492 | animate: SVGElementBuilder, SVGElement> 1493 | circle: SVGElementBuilder, SVGElement> 1494 | clipPath: SVGElementBuilder, SVGElement> 1495 | defs: SVGElementBuilder, SVGElement> 1496 | desc: SVGElementBuilder, SVGElement> 1497 | ellipse: SVGElementBuilder, SVGElement> 1498 | feBlend: SVGElementBuilder, SVGElement> 1499 | feColorMatrix: SVGElementBuilder, SVGElement> 1500 | feComponentTransfer: SVGElementBuilder, SVGElement> 1501 | feComposite: SVGElementBuilder, SVGElement> 1502 | feConvolveMatrix: SVGElementBuilder, SVGElement> 1503 | feDiffuseLighting: SVGElementBuilder, SVGElement> 1504 | feDisplacementMap: SVGElementBuilder, SVGElement> 1505 | feDistantLight: SVGElementBuilder, SVGElement> 1506 | feDropShadow: SVGElementBuilder, SVGElement> 1507 | feFlood: SVGElementBuilder, SVGElement> 1508 | feFuncA: SVGElementBuilder, SVGElement> 1509 | feFuncB: SVGElementBuilder, SVGElement> 1510 | feFuncG: SVGElementBuilder, SVGElement> 1511 | feFuncR: SVGElementBuilder, SVGElement> 1512 | feGaussianBlur: SVGElementBuilder, SVGElement> 1513 | feImage: SVGElementBuilder, SVGElement> 1514 | feMerge: SVGElementBuilder, SVGElement> 1515 | feMergeNode: SVGElementBuilder, SVGElement> 1516 | feMorphology: SVGElementBuilder, SVGElement> 1517 | feOffset: SVGElementBuilder, SVGElement> 1518 | fePointLight: SVGElementBuilder, SVGElement> 1519 | feSpecularLighting: SVGElementBuilder, SVGElement> 1520 | feSpotLight: SVGElementBuilder, SVGElement> 1521 | feTile: SVGElementBuilder, SVGElement> 1522 | feTurbulence: SVGElementBuilder, SVGElement> 1523 | filter: SVGElementBuilder, SVGElement> 1524 | foreignObject: SVGElementBuilder, SVGElement> 1525 | g: SVGElementBuilder, SVGElement> 1526 | image: SVGElementBuilder, SVGElement> 1527 | line: SVGElementBuilder, SVGElement> 1528 | linearGradient: SVGElementBuilder, SVGElement> 1529 | marker: SVGElementBuilder, SVGElement> 1530 | mask: SVGElementBuilder, SVGElement> 1531 | metadata: SVGElementBuilder, SVGElement> 1532 | path: SVGElementBuilder, SVGElement> 1533 | pattern: SVGElementBuilder, SVGElement> 1534 | polygon: SVGElementBuilder, SVGElement> 1535 | polyline: SVGElementBuilder, SVGElement> 1536 | radialGradient: SVGElementBuilder, SVGElement> 1537 | rect: SVGElementBuilder, SVGElement> 1538 | stop: SVGElementBuilder, SVGElement> 1539 | svg: SVGElementBuilder, SVGElement> 1540 | switch: SVGElementBuilder, SVGElement> 1541 | symbol: SVGElementBuilder, SVGElement> 1542 | text: SVGElementBuilder, SVGElement> 1543 | textPath: SVGElementBuilder, SVGElement> 1544 | tspan: SVGElementBuilder, SVGElement> 1545 | use: SVGElementBuilder, SVGElement> 1546 | view: SVGElementBuilder, SVGElement> 1547 | } 1548 | type Elements = HTMLElements & SVGElements 1549 | } 1550 | 1551 | declare global { 1552 | namespace JSX { 1553 | interface Element extends VueTSX.VNode {} 1554 | interface ElementClass extends VueTSX.BaseComponent {} 1555 | interface ElementAttributesProperty { 1556 | $_props: {} 1557 | } 1558 | interface IntrinsicAttributes extends VueTSX.HTMLAttributes {} 1559 | interface IntrinsicElements extends VueTSX.Elements {} 1560 | } 1561 | } 1562 | 1563 | export const Component: VueTSX.ComponentCreator 1564 | export const Vue: VueTSX.Vue 1565 | export const Watch: VueTSX.Watch 1566 | -------------------------------------------------------------------------------- /packages/vue/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | csstype@^2.6.4: 6 | version "2.6.4" 7 | resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.4.tgz#d585a6062096e324e7187f80e04f92bd0f00e37f" 8 | integrity sha512-lAJUJP3M6HxFXbqtGRc0iZrdyeN+WzOWeY0q/VnFzI+kqVrYIzC7bWlKqCW7oCIdzoPkvfp82EVvrTlQ8zsWQg== 9 | 10 | tslib@^1.9.3: 11 | version "1.9.3" 12 | resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" 13 | integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== 14 | 15 | typescript@^3.4.5: 16 | version "3.4.5" 17 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" 18 | integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== 19 | 20 | vue@^2.6.10: 21 | version "2.6.10" 22 | resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637" 23 | integrity sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ== 24 | -------------------------------------------------------------------------------- /packages/vuetify/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vue-tsx/vuetify", 3 | "version": "0.1.1-alpha.0", 4 | "module": "src/index.js", 5 | "license": "MIT", 6 | "typings": "typings/index.d.ts", 7 | "dependencies": { 8 | "@vue-tsx/vue": "^0.1.1-alpha.0", 9 | "csstype": "^2.6.4", 10 | "tslib": "^1.9.3", 11 | "typescript": "^3.4.5", 12 | "vuetify": "^1.5.14" 13 | }, 14 | "gitHead": "4e2a14a18bcfcc0ea2406e89f581729d57b64cd2", 15 | "devDependencies": { 16 | "@vue-tsx/vue-router": "^0.1.1-alpha.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/vuetify/src/index.js: -------------------------------------------------------------------------------- 1 | import RealVuetify from 'vuetify/lib' 2 | 3 | export class Vuetify { 4 | static get $_TSX_plugin() { 5 | return RealVuetify 6 | } 7 | } 8 | 9 | export * from 'vuetify/lib/components' 10 | -------------------------------------------------------------------------------- /packages/vuetify/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import { Component, VueTSX } from '@vue-tsx/vue' 2 | import { RawLocation } from '@vue-tsx/vue-router' 3 | 4 | export namespace Vuetify { 5 | type Message = string | string[] 6 | type Size = number | string 7 | type RuleValidations = (RuleValidator | string)[] 8 | type RuleValidator = (value: Value) => string | false 9 | type PerPage = (number | { text: string; value: number })[] 10 | type CSSOrElement = string | HTMLElement 11 | type PropertyParser = string | (string | number)[] | ((item: Item, fallback?: Result) => Result) 12 | 13 | type PositionableKeys = 'absolute' | 'bottom' | 'fixed' | 'left' | 'right' | 'top' 14 | 15 | type Base = { 16 | props: any 17 | events: any 18 | scopedSlots: any 19 | } 20 | type Empty = { 21 | props: {} 22 | events: {} 23 | scopedSlots: {} 24 | } 25 | type Mix< 26 | M1 extends Base = Empty, 27 | M2 extends Base = Empty, 28 | M3 extends Base = Empty, 29 | M4 extends Base = Empty, 30 | M5 extends Base = Empty, 31 | M6 extends Base = Empty 32 | > = { 33 | props: M1['props'] & M2['props'] & M3['props'] & M4['props'] & M5['props'] & M6['props'] 34 | events: M1['events'] & M2['events'] & M3['events'] & M4['events'] & M5['events'] & M6['events'] 35 | scopedSlots: M1['scopedSlots'] & 36 | M2['scopedSlots'] & 37 | M3['scopedSlots'] & 38 | M4['scopedSlots'] & 39 | M5['scopedSlots'] & 40 | M6['scopedSlots'] 41 | } 42 | 43 | namespace Mixins { 44 | type Applicationable = Mix< 45 | Positionable<'absolute' | 'fixed'>, 46 | { 47 | props: { 48 | /** 49 | * Designates the component as part of the application layout. 50 | * Used for dynamically adjusting content sizing 51 | * 52 | * Default: `false` 53 | */ 54 | app?: boolean 55 | } 56 | events: {} 57 | scopedSlots: {} 58 | } 59 | > 60 | type BaseItemGroup = Mix< 61 | Proxyable, 62 | Themeable, 63 | { 64 | props: { 65 | /** 66 | * The class used when item is active 67 | * 68 | * Default: `'v-item--active'` 69 | */ 70 | activeClass?: string 71 | /** 72 | * Specifies that a value must be present or the first available will be selected 73 | * 74 | * Default: `false` 75 | */ 76 | mandatory?: boolean 77 | /** 78 | * Default: `null` 79 | */ 80 | max?: Size 81 | /** 82 | * Allow multiple selections. **value** prop accepts array 83 | * 84 | * Default: `false` 85 | */ 86 | multiple?: boolean 87 | } 88 | events: {} 89 | scopedSlots: {} 90 | } 91 | > 92 | type Bootable = Mix< 93 | Toggleable, 94 | { 95 | props: { 96 | /** 97 | * Conditionally renders content on mounted. Will only render content if activated 98 | * 99 | * Default: `false` 100 | */ 101 | lazy?: boolean 102 | } 103 | events: {} 104 | scopedSlots: {} 105 | } 106 | > 107 | type ButtonGroup = Mix< 108 | BaseItemGroup, 109 | { 110 | props: { 111 | /** 112 | * The class used when button is active 113 | * 114 | * Default: `'v-btn--active'` 115 | */ 116 | activeClass?: string 117 | } 118 | events: {} 119 | scopedSlots: {} 120 | } 121 | > 122 | type Colorable = { 123 | props: { 124 | /** 125 | * Applies specified color to the control - it can be the name of material color 126 | * (for example `success` or `purple`) or css color (`#033` or `rgba(255, 0, 0, 0.5)`) 127 | * 128 | * Default: `undefined` 129 | */ 130 | color?: string 131 | } 132 | events: {} 133 | scopedSlots: {} 134 | } 135 | type Comparable = { 136 | props: { 137 | /** 138 | * Comparator function 139 | * 140 | * Default: `deepEqual` 141 | */ 142 | valueComparator?: (a: T, b: T) => boolean 143 | } 144 | events: {} 145 | scopedSlots: {} 146 | } 147 | type DataIterable = Mix< 148 | Filterable, 149 | Loadable, 150 | Themeable, 151 | { 152 | props: { 153 | /** 154 | * Designates the table as containing rows that are expandable 155 | * 156 | * Default: `false` 157 | */ 158 | expand?: boolean 159 | /** 160 | * Hide the table actions 161 | * 162 | * Default: `false` 163 | */ 164 | hideActions?: boolean 165 | /** 166 | * Disable default sorting on initial render 167 | * 168 | * Default: `false` 169 | */ 170 | disableInitialSort?: boolean 171 | /** 172 | * Forces at least one column to always be sorted instead of toggling between 173 | * **sorted ascending** / **sorted descending** / **unsorted** states 174 | * 175 | * Default: `false` 176 | */ 177 | mustSort?: boolean 178 | /** 179 | * Display text when there are no filtered results 180 | * 181 | * Default: `'$vuetify.dataIterator.noResultsText'` 182 | */ 183 | noResultsText?: string 184 | /** 185 | * The displayed icon for forcing pagination to the next page 186 | * 187 | * Default: `'$vuetify.icons.next'` 188 | */ 189 | nextIcon?: string 190 | /** 191 | * The displayed icon for forcing pagination to the previous page 192 | * 193 | * Default: `'$vuetify.icons.prev'` 194 | */ 195 | prevIcon?: string 196 | /** 197 | * The default values for the rows-per-page dropdown 198 | * 199 | * Default: `[5, 10, 25, { text: '$vuetify.dataIterator.rowsPerPageAll', value : -1}]` 200 | */ 201 | rowsPerPageItems?: PerPage 202 | /** 203 | * The default rows per page text 204 | * 205 | * Default: `'$vuetify.dataIterator.rowsPerPageText'` 206 | */ 207 | rowsPerPageText?: string 208 | /** 209 | * Adds header row select all checkbox. Can either be a String which specifies which color 210 | * is applied to the button, or a Boolean (which uses the default color) 211 | * 212 | * Default: `false` 213 | */ 214 | selectAll?: boolean | string 215 | /** 216 | * The search model for filtering results 217 | * 218 | * Default: `undefined` 219 | */ 220 | search?: Search 221 | /** 222 | * The function used for filtering items 223 | * 224 | * Default: 225 | * ```js 226 | * (val, search) => { 227 | * return val != null && 228 | * typeof val !== 'boolean' && 229 | * val.toString().toLowerCase().indexOf(search) !== -1 230 | * } 231 | */ 232 | filter?: (val: Item, search: Search) => boolean 233 | /** 234 | * Custom search filter 235 | * 236 | * Default: 237 | * ```js 238 | * (items, search, filter) => { 239 | * search = search.toString().toLowerCase() 240 | * if (search.trim() === '') return items 241 | * 242 | * return items.filter(i => ( 243 | * Object.keys(i).some(j => filter(i[j], search)) 244 | * )) 245 | * } 246 | * ``` 247 | */ 248 | customFilter?: (items: Item[], search: Search, filter: (val: Item, search: Search) => boolean) => Item[] 249 | /** 250 | * Custom sort filter 251 | * 252 | * Default: 253 | * ```js 254 | * (items, index, isDescending) => { 255 | * if (index === null) return items 256 | * 257 | * return items.sort((a, b) => { 258 | * let sortA = getObjectValueByPath(a, index) 259 | * let sortB = getObjectValueByPath(b, index) 260 | * 261 | * if (isDescending) { 262 | * [sortA, sortB] = [sortB, sortA] 263 | * } 264 | * 265 | * // Check if both are numbers 266 | * if (!isNaN(sortA) && !isNaN(sortB)) { 267 | * return sortA - sortB 268 | * } 269 | * 270 | * // Check if both cannot be evaluated 271 | * if (sortA === null && sortB === null) { 272 | * return 0 273 | * } 274 | * 275 | * [sortA, sortB] = [sortA, sortB] 276 | * .map(s => ( 277 | * (s || '').toString().toLocaleLowerCase() 278 | * )) 279 | * 280 | * if (sortA > sortB) return 1 281 | * if (sortA < sortB) return -1 282 | * 283 | * return 0 284 | * }) 285 | * } 286 | * ``` 287 | */ 288 | customSort?: (items: Item[], index: string, isDescending: boolean) => Item[] 289 | /** 290 | * Selected row items 291 | * 292 | * Default: `[]` 293 | */ 294 | value?: Item[] 295 | /** 296 | * The array of table rows 297 | * 298 | * Default: `[]` 299 | */ 300 | items?: Item[] 301 | /** 302 | * Manually sets total number of row items, which disables built-in sort and pagination. 303 | * Used together with pagination prop to enable server-side sort and pagination 304 | * 305 | * Default: `undefined` 306 | */ 307 | totalItems?: number 308 | /** 309 | * The field in the item object that designates a unique key 310 | * 311 | * Default: `'id'` 312 | */ 313 | itemKey?: string 314 | /** 315 | * Used to control pagination and sorting from outside the data table. 316 | * Can also be used to set default sorted column 317 | * 318 | * Default: 319 | * ```js 320 | * { 321 | * descending: false, 322 | * page: 1, 323 | * rowsPerPage: 5, // -1 for all 324 | * sortBy: null, 325 | * totalItems: 0 326 | * } 327 | * ``` 328 | */ 329 | pagination?: { 330 | descending?: boolean 331 | page?: number 332 | rowsPerPage?: number 333 | sortBy?: string 334 | totalItems?: number 335 | } 336 | } 337 | events: { 338 | /** 339 | * The updated bound model 340 | */ 341 | input: Item[] 342 | /** 343 | * The `pagination.sync` update event 344 | */ 345 | 'update:pagination': { 346 | descending: boolean 347 | page: number 348 | rowsPerPage: number 349 | sortBy: string 350 | totalItems: number 351 | } 352 | } 353 | scopedSlots: { 354 | /** 355 | * Slot to put custom elements after the actions in the footer. 356 | */ 357 | 'actions-append'?: [] 358 | /** 359 | * Slot to put custom elements before the actions in the footer. 360 | */ 361 | 'actions-prepend'?: [] 362 | /** 363 | * Slot to specify an extra footer. 364 | */ 365 | footer?: [] 366 | /** 367 | * Displayed when there are no items (takes precedence over `no-results`) 368 | */ 369 | noData?: [] 370 | /** 371 | * Displayed when there are no filtered items 372 | */ 373 | noResults?: [] 374 | /** 375 | * Slot to specify how items are rendered 376 | */ 377 | items?: [ 378 | { 379 | item: Item 380 | index: number 381 | selected: boolean 382 | expanded: boolean 383 | } 384 | ] 385 | /** 386 | * Slot to customize the page text region of the pagination controls. 387 | */ 388 | pageText?: [ 389 | { 390 | pageStart: number 391 | pageStop: number 392 | itemsLength: number 393 | } 394 | ] 395 | } 396 | } 397 | > 398 | type Delayable = { 399 | props: { 400 | /** 401 | * Milliseconds to wait before opening component 402 | * 403 | * Default: `0` 404 | */ 405 | openDelay?: number 406 | /** 407 | * Milliseconds to wait before closing component 408 | * 409 | * Default: `0` 410 | */ 411 | closeDelay?: number 412 | } 413 | events: {} 414 | scopedSlots: {} 415 | } 416 | type Dependent = { 417 | props: {} 418 | events: {} 419 | scopedSlots: {} 420 | } 421 | type Detachable = Mix< 422 | Bootable, 423 | { 424 | props: { 425 | /** 426 | * Specifies which DOM element that this component should detach to. 427 | * Use either a CSS selector string or an object reference to the element. 428 | * 429 | * Default: `undefined` 430 | */ 431 | attach?: CSSOrElement 432 | /** 433 | * Applies a custom class to the detached element. 434 | * This is useful because the content is moved to the end of the app and is not targettable by 435 | * classes passed directly on the component. 436 | * 437 | * Default: `''` 438 | */ 439 | contentClass?: string 440 | } 441 | events: {} 442 | scopedSlots: {} 443 | } 444 | > 445 | type Elevatable = { 446 | props: { 447 | /** 448 | * Designates an elevation between 0 and 24 449 | * 450 | * Default: `undefined` 451 | */ 452 | elevation?: number | string 453 | } 454 | events: {} 455 | scopedSlots: {} 456 | } 457 | type Filterable = { 458 | props: { 459 | /** 460 | * Display text when there is no data 461 | * 462 | * Default: `'$vuetify.noDataText'` 463 | */ 464 | noDataText?: string 465 | } 466 | events: {} 467 | scopedSlots: { 468 | /** 469 | * Displayed when there are no filtered items 470 | */ 471 | noData?: [] 472 | } 473 | } 474 | type Groupable = { 475 | props: { 476 | /** 477 | * The class used when item is active 478 | * 479 | * Default: `undefined` 480 | */ 481 | activeClass?: string 482 | /** 483 | * Disables the item from changing value from the toggle method 484 | * 485 | * Default: `false` 486 | */ 487 | disabled?: boolean 488 | } 489 | events: {} 490 | scopedSlots: {} 491 | } 492 | type Loadable = { 493 | props: { 494 | /** 495 | * Displays linear progress bar. Can either be a String which specifies which color is applied to the 496 | * progress bar (any materia color or theme color - **primary**, **secondary**, **success**, **info**, 497 | * **warning**, **error**) or a Boolean which uses the component **color** (set by color prop - if it's 498 | * supported by the component) or the primary color 499 | * 500 | * Default: `false` 501 | */ 502 | loading?: boolean | string 503 | } 504 | events: {} 505 | scopedSlots: {} 506 | } 507 | type Maskable = { 508 | props: { 509 | /** 510 | * Disables the automatic character display when typing 511 | * 512 | * Default: `false` 513 | */ 514 | dontFillMaskBlanks?: boolean 515 | /** 516 | * Apply a custom character mask to the input. 517 | * See mask table below for more information. 518 | * https://vuetifyjs.com/en/components/text-fields 519 | * 520 | * Default: `undefined` 521 | */ 522 | mask?: string 523 | /** 524 | * Returns the unmodified masked string 525 | * 526 | * Default: `undefined` 527 | */ 528 | returnMaskedValue?: boolean 529 | /** 530 | * Returns the unmodified masked string 531 | * 532 | * Default: `undefined` 533 | */ 534 | value?: Value 535 | } 536 | events: {} 537 | scopedSlots: {} 538 | } 539 | type Measurable = { 540 | props: { 541 | /** 542 | * Sets the component height 543 | * 544 | * Default: `undefined` 545 | */ 546 | height?: Size 547 | /** 548 | * Sets the maximum height for the content 549 | * 550 | * Default: `undefined` 551 | */ 552 | maxHeight?: Size 553 | /** 554 | * Sets the maximum width for the content 555 | * 556 | * Default: `undefined` 557 | */ 558 | maxWidth?: Size 559 | /** 560 | * Sets the minimum height for the content 561 | * 562 | * Default: `undefined` 563 | */ 564 | minHeight?: Size 565 | /** 566 | * Sets the minimum width for the content 567 | * 568 | * Default: `undefined` 569 | */ 570 | minWidth?: Size 571 | /** 572 | * Sets the component width 573 | * 574 | * Default: `undefined` 575 | */ 576 | width?: Size 577 | } 578 | events: {} 579 | scopedSlots: {} 580 | } 581 | type Menuable = Mix< 582 | Positionable, 583 | Stackable, 584 | Themeable, 585 | { 586 | props: { 587 | /** 588 | * Designate a custom activator when the activator slot is not used. 589 | * String can be any valid querySelector and Object can be any valid Node 590 | * 591 | * Default: `null` 592 | */ 593 | activator?: CSSOrElement 594 | /** 595 | * Removes overflow re-positioning for the content 596 | * 597 | * Default: `false` 598 | */ 599 | allowOverflow?: boolean 600 | /** 601 | * Sets a new activator target for the detached element. 602 | * Use when placing detachable items in `VInput` slots 603 | * 604 | * Default: `false` 605 | */ 606 | inputActivator?: boolean 607 | /** 608 | * Sets the maximum width for the content 609 | * 610 | * Default: `'auto'` 611 | */ 612 | maxWidth?: Size 613 | /** 614 | * Sets the minimum width for the content 615 | * 616 | * Default: `undefined` 617 | */ 618 | minWidth: Size 619 | /** 620 | * Nudge the content to the bottom 621 | * 622 | * Default: `0` 623 | */ 624 | nudgeBottom?: Size 625 | /** 626 | * Nudge the content to the left 627 | * 628 | * Default: `0` 629 | */ 630 | nudgeLeft?: Size 631 | /** 632 | * Nudge the content to the right 633 | * 634 | * Default: `0` 635 | */ 636 | nudgeRight?: Size 637 | /** 638 | * Nudge the content to the top 639 | * 640 | * Default: `0` 641 | */ 642 | nudgeTop?: Size 643 | /** 644 | * Nudge the content width 645 | * 646 | * Default: `0` 647 | */ 648 | nudgeWidth?: Size 649 | /** 650 | * Causes the component to flip to the opposite side when repositioned due to overflow 651 | * 652 | * Default: `false` 653 | */ 654 | offsetOverflow?: boolean 655 | /** 656 | * Used to position the content when not using an activator slot 657 | * 658 | * Default: `null` 659 | */ 660 | positionX?: number 661 | /** 662 | * Used to position the content when not using an activator slot 663 | * 664 | * Default: `null` 665 | */ 666 | positionY?: number 667 | /** 668 | * The z-index used for the component 669 | * 670 | * Default: `null` 671 | */ 672 | zIndex?: number 673 | } 674 | events: {} 675 | scopedSlots: {} 676 | } 677 | > 678 | type Overlayable = Mix< 679 | Toggleable, 680 | Stackable, 681 | { 682 | props: { 683 | /** 684 | * Hides the display of the overlay 685 | * 686 | * Default: `false` 687 | */ 688 | hideOverlay?: boolean 689 | } 690 | events: {} 691 | scopedSlots: {} 692 | } 693 | > 694 | type PickerButton = Mix< 695 | Colorable, 696 | { 697 | props: {} 698 | events: {} 699 | scopedSlots: {} 700 | } 701 | > 702 | type Picker = Mix< 703 | Colorable, 704 | Themeable, 705 | { 706 | props: { 707 | /** 708 | * Forces 100% width 709 | * 710 | * Default: `false` 711 | */ 712 | fullWidth?: boolean 713 | /** 714 | * Defines the header color. If not specified it will use the color defined by `color` prop or 715 | * the default picker color 716 | * 717 | * Default: `undefined` 718 | */ 719 | headerColor?: string 720 | /** 721 | * Orients picker horizontal 722 | * 723 | * Default: `false` 724 | */ 725 | landscape?: boolean 726 | /** 727 | * Hide the picker title 728 | * 729 | * Default: `false` 730 | */ 731 | noTitle?: boolean 732 | /** 733 | * The width of the content 734 | * 735 | * Default: `290` 736 | */ 737 | width?: Size 738 | } 739 | events: {} 740 | scopedSlots: {} 741 | } 742 | > 743 | type Positionable = { 744 | props: { [key in T]?: boolean } 745 | events: {} 746 | scopedSlots: {} 747 | } 748 | type Proxyable = { 749 | props: { 750 | value?: T 751 | } 752 | events: { 753 | change: T 754 | } 755 | scopedSlots: {} 756 | } 757 | type Registrable = { 758 | props: {} 759 | events: {} 760 | scopedSlots: {} 761 | } 762 | type Returnable = { 763 | props: { 764 | returnValue?: Value 765 | } 766 | events: { 767 | 'update:returnValue': Value 768 | } 769 | scopedSlots: {} 770 | } 771 | type Rippleable = { 772 | props: { 773 | /** 774 | * Applies the `vRipple` directive 775 | * 776 | * Default: `false` 777 | */ 778 | ripple?: boolean 779 | } 780 | events: {} 781 | scopedSlots: {} 782 | } 783 | type Routable = Mix< 784 | Rippleable, 785 | { 786 | props: { 787 | /** 788 | * Class bound when component is active. **warning** Depending upon the component, 789 | * this could cause side effects. If you need to add a custom class on top of a default, 790 | * just do `activeClass=\"default-class your-class\"` 791 | * 792 | * Default `undefined` 793 | */ 794 | activeClass?: string 795 | /** 796 | * Vue Router `` prop 797 | * 798 | * Default `false` 799 | */ 800 | append?: boolean 801 | /** 802 | * Route item is disabled 803 | * 804 | * Default `false` 805 | */ 806 | disabled?: boolean 807 | /** 808 | * Exactly match the link. Without this, '/' will match every route 809 | * 810 | * Default `false` 811 | */ 812 | exact?: boolean 813 | /** 814 | * Vue Router `` prop 815 | * 816 | * Default `undefined` 817 | */ 818 | exactActiveClass?: string 819 | /** 820 | * Will designate the component tag to `` 821 | * 822 | * Default `undefined` 823 | */ 824 | href?: string 825 | /** 826 | * Will designate the component tag to `` 827 | * 828 | * Default `undefined` 829 | */ 830 | to?: RawLocation 831 | /** 832 | * Specifies the link is a nuxt-link 833 | * 834 | * Default `false` 835 | */ 836 | nuxt?: boolean 837 | /** 838 | * Vue Router `` prop 839 | * 840 | * Default `false` 841 | */ 842 | replace?: boolean 843 | /** 844 | * Specify a custom tag to use on the component 845 | * 846 | * Default `undefined` 847 | */ 848 | tag?: string 849 | /** 850 | * Specify the target attribute 851 | * 852 | * Default `undefined` 853 | */ 854 | target?: string 855 | } 856 | events: {} 857 | scopedSlots: {} 858 | } 859 | > 860 | type Selectable = Mix< 861 | ComponentsDecriptors.VInput, 862 | Rippleable, 863 | Comparable, 864 | Colorable, 865 | { 866 | props: { 867 | /** 868 | * Sets the DOM id on the component 869 | * 870 | * Default: `undefined` 871 | */ 872 | id?: string 873 | inputValue?: Value 874 | falseValue?: FalseValue 875 | trueValue?: TrueValue 876 | multiple?: boolean 877 | label?: string 878 | } 879 | events: {} 880 | scopedSlots: {} 881 | } 882 | > 883 | type Sizeable = { 884 | props: { 885 | /** 886 | * Makes the icon large **(36px)** 887 | * 888 | * Default: `false` 889 | */ 890 | large?: boolean 891 | /** 892 | * Makes the icon medium **(28px)** 893 | * 894 | * Default: `false` 895 | */ 896 | medium?: boolean 897 | /** 898 | * Makes the icon small **(16px)** 899 | * 900 | * Default: `false` 901 | */ 902 | small?: boolean 903 | /** 904 | * Makes the icon extra large **(40px)** 905 | * 906 | * Default: `false` 907 | */ 908 | xLarge?: boolean 909 | /** 910 | * Specifies a custom font size for the icon 911 | * 912 | * Default: `undefined` 913 | */ 914 | size?: Size 915 | } 916 | events: {} 917 | scopedSlots: {} 918 | } 919 | type Stackable = { 920 | props: {} 921 | events: {} 922 | scopedSlots: {} 923 | } 924 | type Themeable = { 925 | props: { 926 | /** 927 | * Applies the dark theme variant 928 | * 929 | * Default: `undefined` 930 | */ 931 | dark?: boolean 932 | /** 933 | * Applies the light theme variant 934 | * 935 | * Default: `undefined` 936 | */ 937 | light?: boolean 938 | } 939 | events: {} 940 | scopedSlots: {} 941 | } 942 | type Toggleable = { 943 | props: { 944 | /** 945 | * Controls visibility 946 | * 947 | * Default: `undefined` 948 | */ 949 | value?: boolean 950 | } 951 | events: { 952 | input: boolean 953 | } 954 | scopedSlots: {} 955 | } 956 | type Transitionable = { 957 | props: { 958 | /** 959 | * Sets the transition mode (does not apply to transition-group) vue docs 960 | * 961 | * Default: `undefined` 962 | */ 963 | mode?: string 964 | /** 965 | * Sets the transition origin 966 | * 967 | * Default: `undefined` 968 | */ 969 | origin?: string 970 | /** 971 | * Sets the component transition. Can be one of the built in transitions or your own. 972 | * 973 | * Default: `undefined` 974 | */ 975 | transition?: string 976 | } 977 | events: {} 978 | scopedSlots: {} 979 | } 980 | type Validatable = { 981 | props: { 982 | /** 983 | * Disable the input 984 | * 985 | * Default: `false` 986 | */ 987 | disabled?: boolean 988 | /** 989 | * Puts the input in a manual error state 990 | * 991 | * Default: `false` 992 | */ 993 | error?: boolean 994 | /** 995 | * The total number of errors that should display at once 996 | * 997 | * Default: `1` 998 | */ 999 | errorCount?: number 1000 | /** 1001 | * Puts the input in an error state and passes through custom error messsages. 1002 | * Will be combined with any validations that occur from the **rules** prop. 1003 | * This field will not trigger validation 1004 | * 1005 | * Default: `[]` 1006 | */ 1007 | errorMessages?: Message 1008 | /** 1009 | * Displays a list of messages or message if using a string 1010 | * 1011 | * Default: `[]` 1012 | */ 1013 | messages?: Message 1014 | /** 1015 | * Puts input in readonly state 1016 | * 1017 | * Default: `false` 1018 | */ 1019 | readonly?: boolean 1020 | /** 1021 | * Accepts an array of functions that return either False or a String with an error message 1022 | * 1023 | * Default: `[]` 1024 | */ 1025 | rules?: RuleValidations 1026 | /** 1027 | * Puts the input in a manual success state 1028 | * 1029 | * Default: `false` 1030 | */ 1031 | success?: boolean 1032 | /** 1033 | * Puts the input in a success state and passes through custom success messsages. 1034 | * 1035 | * Default: `[]` 1036 | */ 1037 | successMessages?: Message 1038 | /** 1039 | * Delays validation until blur event 1040 | * 1041 | * Default: `false` 1042 | */ 1043 | validateOnBlur?: boolean 1044 | /** 1045 | * Value 1046 | */ 1047 | value?: Value 1048 | } 1049 | events: { 1050 | /** 1051 | * The `error.sync` event 1052 | */ 1053 | 'update:error': boolean 1054 | } 1055 | scopedSlots: {} 1056 | } 1057 | } 1058 | namespace ComponentsDecriptors { 1059 | type VAAA = Mix< 1060 | Mixins.Colorable, 1061 | { 1062 | props: {} 1063 | events: {} 1064 | scopedSlots: {} 1065 | } 1066 | > 1067 | type VAlert = Mix< 1068 | Mixins.Colorable, 1069 | Mixins.Toggleable, 1070 | Mixins.Transitionable, 1071 | { 1072 | props: { 1073 | dismissible?: boolean 1074 | icon?: string 1075 | outline?: boolean 1076 | type?: 'info' | 'error' | 'success' | 'warning' 1077 | } 1078 | events: { 1079 | input: boolean 1080 | } 1081 | scopedSlots: {} 1082 | } 1083 | > 1084 | type VApp = Mix< 1085 | Mixins.Themeable, 1086 | { 1087 | props: { 1088 | id?: string 1089 | } 1090 | events: {} 1091 | scopedSlots: {} 1092 | } 1093 | > 1094 | type VAutocomplete = Mix< 1095 | VSelect, 1096 | { 1097 | props: {} 1098 | events: {} 1099 | scopedSlots: {} 1100 | } 1101 | > 1102 | type VInput = Mix< 1103 | Mixins.Colorable, 1104 | Mixins.Themeable, 1105 | Mixins.Validatable, 1106 | Mixins.Loadable, 1107 | { 1108 | props: { 1109 | /** 1110 | * Appends an icon to the component, uses the same syntax as `VIcon` 1111 | * 1112 | * Default: `undefined` 1113 | */ 1114 | appendIcon?: string 1115 | /** 1116 | * Changes the background-color of the input 1117 | * 1118 | * Default: `''` 1119 | */ 1120 | backgroundColor?: string 1121 | /** 1122 | * Hides hint, validation errors 1123 | * 1124 | * Default: `false` 1125 | */ 1126 | hideDetails?: boolean 1127 | /** 1128 | * Hint text 1129 | * 1130 | * Default: `undefined` 1131 | */ 1132 | hint?: string 1133 | /** 1134 | * Sets input label 1135 | * 1136 | * Default: `undefined` 1137 | */ 1138 | label?: string 1139 | /** 1140 | * Forces hint to always be visible 1141 | * 1142 | * Default: `false` 1143 | */ 1144 | persistentHint?: boolean 1145 | /** 1146 | * Sets the input's placeholder text 1147 | * 1148 | * Default: `undefined` 1149 | */ 1150 | placeholder?: string 1151 | /** 1152 | * Prepends an icon to the component, uses the same syntax as `VIcon` 1153 | * 1154 | * Default: `undefined` 1155 | */ 1156 | prependIcon?: string 1157 | /** 1158 | * Designates the input as required; Adds an asertisk to the end of the label; 1159 | * Does not perform any validation. 1160 | * 1161 | * Default: `false` 1162 | */ 1163 | required?: boolean 1164 | /** 1165 | * Tabindex of input 1166 | * 1167 | * Default: `undefined` 1168 | */ 1169 | tabindex?: number 1170 | /** 1171 | * Array of key codes that will toggle the input (if it supports toggling) 1172 | * 1173 | * Default: `[]` 1174 | */ 1175 | toggleKeys?: number[] 1176 | /** 1177 | * Input value 1178 | * 1179 | * Default: `undefined` 1180 | */ 1181 | value?: string 1182 | } 1183 | events: { 1184 | /** 1185 | * Emitted when the input is blurred 1186 | */ 1187 | blur: VueTSX.FocusEvent 1188 | /** 1189 | * Emitted when the input is changed by user interaction 1190 | */ 1191 | change: string 1192 | /** 1193 | * Emitted when appended icon is clicked 1194 | */ 1195 | 'click:append': VueTSX.MouseEvent 1196 | /** 1197 | * Emitted when prepended icon is clicked 1198 | */ 1199 | 'click:prepend': VueTSX.MouseEvent 1200 | } 1201 | scopedSlots: { 1202 | /** 1203 | * Adds an item after input content 1204 | */ 1205 | append?: [] 1206 | /** 1207 | * Adds an item before input content 1208 | */ 1209 | prepend?: [] 1210 | } 1211 | } 1212 | > 1213 | type VSelect = Mix< 1214 | VTextField, 1215 | Mixins.Comparable, 1216 | Mixins.Filterable, 1217 | Mixins.Detachable, 1218 | { 1219 | props: { 1220 | cacheItems?: boolean 1221 | chips?: boolean 1222 | deletableChips?: boolean 1223 | dense?: boolean 1224 | hideSelected?: boolean 1225 | items?: Item[] 1226 | itemAvatar?: PropertyParser 1227 | itemDisabled?: PropertyParser 1228 | itemText?: PropertyParser 1229 | itemValue?: PropertyParser 1230 | menuProps?: string | any[] | Object 1231 | multiple?: boolean 1232 | openOnClear?: boolean 1233 | searchInput?: string 1234 | smallChips?: boolean 1235 | returnObject?: boolean 1236 | } 1237 | events: { 1238 | blur: undefined 1239 | focus: undefined 1240 | change: Item | string 1241 | } 1242 | scopedSlots: { 1243 | item?: [ 1244 | { 1245 | parent: any 1246 | item: Item 1247 | tile: any 1248 | } 1249 | ] 1250 | selection?: [ 1251 | { 1252 | parent: any 1253 | item: Item 1254 | index: number 1255 | selected: boolean 1256 | disabled: boolean 1257 | } 1258 | ] 1259 | } 1260 | } 1261 | > 1262 | type VSelectList = Mix< 1263 | Mixins.Colorable, 1264 | Mixins.Themeable, 1265 | { 1266 | props: { 1267 | action?: boolean 1268 | dense?: boolean 1269 | hideSelected?: boolean 1270 | items?: Item[] 1271 | itemAvatar?: PropertyParser 1272 | itemDisabled?: PropertyParser 1273 | itemText?: PropertyParser 1274 | itemValue?: PropertyParser 1275 | noDataText?: string 1276 | noFilter?: boolean 1277 | searchInput?: string 1278 | selectedItems?: Item[] 1279 | } 1280 | events: { 1281 | select: Item 1282 | } 1283 | scopedSlots: { 1284 | item?: [ 1285 | { 1286 | parent: any 1287 | item: Item 1288 | tile: any 1289 | } 1290 | ] 1291 | } 1292 | } 1293 | > 1294 | type VTextField = Mix< 1295 | VInput, 1296 | Mixins.Maskable, 1297 | Mixins.Loadable, 1298 | { 1299 | props: { 1300 | appendOuterIcon?: string 1301 | autofocus?: boolean 1302 | box?: boolean 1303 | browserAutocomplete?: string 1304 | clearable?: boolean 1305 | clearIcon?: string 1306 | color?: string 1307 | counter?: boolean | number | string 1308 | flat?: boolean 1309 | fullWidth?: boolean 1310 | label?: string 1311 | outline?: boolean 1312 | placeholder?: string 1313 | prefix?: string 1314 | prependInnerIcon?: string 1315 | reverse?: boolean 1316 | singleLine?: boolean 1317 | solo?: boolean 1318 | soloInverted?: boolean 1319 | suffix?: string 1320 | type?: string 1321 | } 1322 | events: { 1323 | change: string 1324 | 'click:append': VueTSX.MouseEvent 1325 | 'click:append-outer': VueTSX.MouseEvent 1326 | 'click:clear': VueTSX.MouseEvent 1327 | 'click:prepend': VueTSX.MouseEvent 1328 | 'click:prepend-inner': VueTSX.MouseEvent 1329 | 'update:error': any 1330 | } 1331 | scopedSlots: { 1332 | append: [] 1333 | 'append-outer': [] 1334 | prepend: [] 1335 | 'prepend-inner': [] 1336 | } 1337 | } 1338 | > 1339 | } 1340 | namespace Components { 1341 | class VInput extends Component {} 1342 | } 1343 | } 1344 | 1345 | export const VInput: typeof Vuetify.Components.VInput 1346 | -------------------------------------------------------------------------------- /packages/vuetify/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | csstype@^2.6.4: 6 | version "2.6.4" 7 | resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.4.tgz#d585a6062096e324e7187f80e04f92bd0f00e37f" 8 | integrity sha512-lAJUJP3M6HxFXbqtGRc0iZrdyeN+WzOWeY0q/VnFzI+kqVrYIzC7bWlKqCW7oCIdzoPkvfp82EVvrTlQ8zsWQg== 9 | 10 | tslib@^1.9.3: 11 | version "1.9.3" 12 | resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" 13 | integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== 14 | 15 | typescript@^3.4.5: 16 | version "3.4.5" 17 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" 18 | integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== 19 | 20 | vuetify@^1.5.14: 21 | version "1.5.14" 22 | resolved "https://registry.yarnpkg.com/vuetify/-/vuetify-1.5.14.tgz#ff67d0b8a398be5297da159b6cd1b31f4d2898b8" 23 | integrity sha512-7iM+TfghR/wu/Gl+k37lKr0N8Ddr6SxzqHtoK1dIyHgCH6SJRkpaXPw2MC5/FsAg9aUDJbYNWrzSeu5eHw+Q/w== 24 | -------------------------------------------------------------------------------- /packages/vuex/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vue-tsx/vuex", 3 | "version": "0.1.1-alpha.0", 4 | "module": "src/index.js", 5 | "license": "MIT", 6 | "typings": "typings/index.d.ts", 7 | "dependencies": { 8 | "@vue-tsx/vue": "^0.1.1-alpha.0", 9 | "csstype": "^2.6.4", 10 | "tslib": "^1.9.3", 11 | "typescript": "^3.4.5", 12 | "vue": "^2.6.10", 13 | "vuex": "^3.1.0" 14 | }, 15 | "gitHead": "4e2a14a18bcfcc0ea2406e89f581729d57b64cd2" 16 | } 17 | -------------------------------------------------------------------------------- /packages/vuex/src/index.js: -------------------------------------------------------------------------------- 1 | import RealVuex from 'vuex' 2 | 3 | const transformModule = module => ({ 4 | namespaced: true, 5 | state: module.state, 6 | mutations: module.mutations || {}, 7 | getters: Object.keys(module.getters || {}).reduce( 8 | (obj, getter) => ({ 9 | ...obj, 10 | [getter]: (state, getters) => 11 | module.getters[getter].call( 12 | Object.keys(module.getters).reduce( 13 | (obj, getter) => ({ 14 | ...obj, 15 | [getter]: () => getters[getter], 16 | }), 17 | {}, 18 | ), 19 | state, 20 | ), 21 | }), 22 | {}, 23 | ), 24 | actions: Object.keys(module.actions || {}).reduce( 25 | (obj, action) => ({ 26 | ...obj, 27 | [action]: (ctx, payload) => 28 | module.actions[action].call( 29 | Object.keys(module.actions).reduce( 30 | (obj, action) => ({ 31 | ...obj, 32 | [action]: (ctx, payload) => ctx.dispatch(action, payload), 33 | }), 34 | {}, 35 | ), 36 | ctx, 37 | payload, 38 | ), 39 | }), 40 | {}, 41 | ), 42 | }) 43 | 44 | export class Vuex { 45 | constructor(options) { 46 | const modules = options.modules || {} 47 | this.$_TSX_infer = new RealVuex.Store({ 48 | ...transformModule(options.rootModule), 49 | modules: Object.keys(modules).reduce( 50 | (obj, module) => ({ 51 | ...obj, 52 | [module]: transformModule(modules[module]), 53 | }), 54 | {}, 55 | ), 56 | }) 57 | } 58 | 59 | static get $_TSX_plugin() { 60 | return RealVuex 61 | } 62 | } 63 | 64 | export const getter = (vm, getter) => vm.$store.getters[getter] 65 | export const mutate = (vm, mutation, payload) => vm.$store.commit(mutation, payload) 66 | export const action = (vm, action, payload) => vm.$store.dispatch(action, payload) 67 | export const namespacedGetter = (vm, namespace, getter) => vm.$store.getters[`${namespace}/${getter}`] 68 | export const namespacedMutate = (vm, namespace, mutation, payload) => 69 | vm.$store.commit(`${namespace}/${mutation}`, payload) 70 | export const namespacedAction = (vm, namespace, action, payload) => 71 | vm.$store.dispatch(`${namespace}/${action}`, payload) 72 | -------------------------------------------------------------------------------- /packages/vuex/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import { VueTSX } from '@vue-tsx/vue' 2 | 3 | export type GettersOption, Getters extends Record> = { 4 | [Key in keyof Getters]: (state: State) => Getters[Key] 5 | } 6 | 7 | export type MutationsOption, Mutations extends Record> = { 8 | [Key in keyof Mutations]: void extends Mutations[Key] 9 | ? (state: State, payload?: Mutations[Key]) => void 10 | : (state: State, payload: Mutations[Key]) => void 11 | } 12 | 13 | export type ActionContext< 14 | State extends Record, 15 | Getters extends Record, 16 | Mutations extends Record, 17 | RootState extends Record, 18 | RootGetters extends Record 19 | > = { 20 | rootState: RootState 21 | rootGetters: RootGetters 22 | state: State 23 | getters: Getters 24 | commit: VueTSX.UnionToIntersection< 25 | { 26 | [Key in keyof Mutations]: void extends Mutations[Key] 27 | ? (muation: Key, payload?: Mutations[Key]) => void 28 | : (muation: Key, payload: Mutations[Key]) => void 29 | }[keyof Mutations] 30 | > 31 | } 32 | 33 | export type ActionsOption< 34 | State extends Record, 35 | Getters extends Record, 36 | Mutations extends Record, 37 | Actions extends Record, 38 | RootState extends Record, 39 | RootGetters extends Record 40 | > = { 41 | [Key in keyof Actions]-?: void extends Actions[Key] 42 | ? ( 43 | context: ActionContext, 44 | payload?: Actions[Key], 45 | ) => void | Promise 46 | : ( 47 | context: ActionContext, 48 | payload: Actions[Key], 49 | ) => void | Promise 50 | } 51 | 52 | export interface ModuleOptions< 53 | State extends Record, 54 | Getters extends Record = {}, 55 | Mutations extends Record = {}, 56 | Actions extends Record = {}, 57 | RootsState extends Record = {}, 58 | RootGetters extends Record = {} 59 | > { 60 | state: State 61 | getters?: GettersOption 62 | mutations?: MutationsOption 63 | actions?: ActionsOption 64 | } 65 | 66 | export interface VuexOptions { 67 | rootModule: ModuleOptions 68 | modules?: { 69 | [key: string]: ModuleOptions 70 | } 71 | } 72 | 73 | export interface Options {} 74 | 75 | export interface OptionsSchema { 76 | options: VuexOptions 77 | } 78 | 79 | export class Vuex { 80 | constructor(options: VuexOptions) 81 | } 82 | 83 | export type GetGetters = T extends ModuleOptions ? G : never 84 | export type GetMutations = T extends ModuleOptions ? M : never 85 | export type GetActions = T extends ModuleOptions ? A : never 86 | 87 | export const getter: Options extends OptionsSchema 88 | ? VueTSX.UnionToIntersection< 89 | { 90 | [Key in keyof GetGetters]: ( 91 | vm: VueTSX.Instance, 92 | getter: Key, 93 | ) => GetGetters[Key] 94 | }[keyof GetGetters] 95 | > 96 | : never 97 | export const mutate: Options extends OptionsSchema 98 | ? VueTSX.UnionToIntersection< 99 | { 100 | [Key in keyof GetMutations]: void extends GetMutations< 101 | Options['options']['rootModule'] 102 | >[Key] 103 | ? (vm: VueTSX.Instance, mutations: Key, payload?: GetMutations[Key]) => void 104 | : (vm: VueTSX.Instance, mutations: Key, payload: GetMutations[Key]) => void 105 | }[keyof GetMutations] 106 | > 107 | : never 108 | export const action: Options extends OptionsSchema 109 | ? VueTSX.UnionToIntersection< 110 | { 111 | [Key in keyof GetActions]: void extends GetActions< 112 | Options['options']['rootModule'] 113 | >[Key] 114 | ? ( 115 | vm: VueTSX.Instance, 116 | mutations: Key, 117 | payload?: GetActions[Key], 118 | ) => void | Promise 119 | : ( 120 | vm: VueTSX.Instance, 121 | mutations: Key, 122 | payload: GetActions[Key], 123 | ) => void | Promise 124 | }[keyof GetActions] 125 | > 126 | : never 127 | 128 | export const namespacedGetter: Options extends OptionsSchema 129 | ? VueTSX.UnionToIntersection< 130 | { 131 | [Module in keyof Options['options']['modules']]: { 132 | [Key in keyof GetGetters]: ( 133 | vm: VueTSX.Instance, 134 | namespace: Module, 135 | getter: Key, 136 | ) => GetGetters[Key] 137 | }[keyof GetGetters] 138 | }[keyof Options['options']['modules']] 139 | > 140 | : never 141 | export const namespacedMutate: Options extends OptionsSchema 142 | ? VueTSX.UnionToIntersection< 143 | { 144 | [Module in keyof Options['options']['modules']]: { 145 | [Key in keyof GetMutations]: void extends GetMutations< 146 | Options['options']['modules'][Module] 147 | >[Key] 148 | ? ( 149 | vm: VueTSX.Instance, 150 | namespace: Module, 151 | mutations: Key, 152 | payload?: GetMutations[Key], 153 | ) => void 154 | : ( 155 | vm: VueTSX.Instance, 156 | namespace: Module, 157 | mutations: Key, 158 | payload: GetMutations[Key], 159 | ) => void 160 | }[keyof GetMutations] 161 | }[keyof Options['options']['modules']] 162 | > 163 | : never 164 | export const namespacedAction: Options extends OptionsSchema 165 | ? VueTSX.UnionToIntersection< 166 | { 167 | [Module in keyof Options['options']['modules']]: { 168 | [Key in keyof GetActions]: void extends GetActions< 169 | Options['options']['modules'][Module] 170 | >[Key] 171 | ? ( 172 | vm: VueTSX.Instance, 173 | namespace: Module, 174 | mutations: Key, 175 | payload?: GetActions[Key], 176 | ) => void | Promise 177 | : ( 178 | vm: VueTSX.Instance, 179 | namespace: Module, 180 | mutations: Key, 181 | payload: GetActions[Key], 182 | ) => void | Promise 183 | }[keyof GetActions] 184 | }[keyof Options['options']['modules']] 185 | > 186 | : never 187 | -------------------------------------------------------------------------------- /packages/vuex/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | csstype@^2.6.4: 6 | version "2.6.4" 7 | resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.4.tgz#d585a6062096e324e7187f80e04f92bd0f00e37f" 8 | integrity sha512-lAJUJP3M6HxFXbqtGRc0iZrdyeN+WzOWeY0q/VnFzI+kqVrYIzC7bWlKqCW7oCIdzoPkvfp82EVvrTlQ8zsWQg== 9 | 10 | tslib@^1.9.3: 11 | version "1.9.3" 12 | resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" 13 | integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== 14 | 15 | typescript@^3.4.5: 16 | version "3.4.5" 17 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" 18 | integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== 19 | 20 | vue@^2.6.10: 21 | version "2.6.10" 22 | resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637" 23 | integrity sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ== 24 | 25 | vuex@^3.1.0: 26 | version "3.1.0" 27 | resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.1.0.tgz#634b81515cf0cfe976bd1ffe9601755e51f843b9" 28 | integrity sha512-mdHeHT/7u4BncpUZMlxNaIdcN/HIt1GsGG5LKByArvYG/v6DvHcOxvDCts+7SRdCoIRGllK8IMZvQtQXLppDYg== 29 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "jsx": "preserve", 5 | "importHelpers": true, 6 | "moduleResolution": "node", 7 | "experimentalDecorators": true, 8 | "esModuleInterop": true, 9 | "allowSyntheticDefaultImports": true, 10 | "sourceMap": true, 11 | "baseUrl": "." 12 | }, 13 | "exclude": ["node_modules"] 14 | } 15 | --------------------------------------------------------------------------------