2
0
mirror of https://github.com/tenrok/maska.git synced 2026-05-15 11:59:38 +03:00

Add basic typescript declarations

This commit is contained in:
Alexander Shabunevich
2020-11-29 19:31:41 +03:00
parent ea6f31babd
commit ffde6a5140
16 changed files with 74 additions and 10 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ With Vue 3.x you need to explicitly add Maska `plugin` or `directive` to your ap
``` javascript
const app = Vue.createApp({...})
// use as plugin
app.use(Maska.install);
app.use(Maska);
// or as directive
// app.directive('maska', Maska.maska);
app.mount('#app');
+1 -1
View File
@@ -1,5 +1,5 @@
/*!
* maska v1.3.1
* maska v1.3.2
* (c) 2019-2020 Alexander Shabunevich
* Released under the MIT License.
*/
+1 -1
View File
@@ -1,5 +1,5 @@
/*!
* maska v1.3.1
* maska v1.3.2
* (c) 2019-2020 Alexander Shabunevich
* Released under the MIT License.
*/
+1 -1
View File
@@ -1,5 +1,5 @@
/*!
* maska v1.3.1
* maska v1.3.2
* (c) 2019-2020 Alexander Shabunevich
* Released under the MIT License.
*/
+1 -1
View File
@@ -1,5 +1,5 @@
/*!
* maska v1.3.1
* maska v1.3.2
* (c) 2019-2020 Alexander Shabunevich
* Released under the MIT License.
*/
+1 -1
View File
@@ -1,5 +1,5 @@
/*!
* maska v1.3.1
* maska v1.3.2
* (c) 2019-2020 Alexander Shabunevich
* Released under the MIT License.
*/
+1 -1
View File
@@ -1,5 +1,5 @@
/*!
* maska v1.3.1
* maska v1.3.2
* (c) 2019-2020 Alexander Shabunevich
* Released under the MIT License.
*/
+1 -1
View File
@@ -148,7 +148,7 @@
</section>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/maska@1.3.0/dist/maska.js"></script>
<script src="https://cdn.jsdelivr.net/npm/maska@1.3.2/dist/maska.js"></script>
<script>
// vue
new Vue({
+4 -2
View File
@@ -1,6 +1,6 @@
{
"name": "maska",
"version": "1.3.1",
"version": "1.3.2",
"description": "Simple zero-dependency input mask for Vue.js and vanilla JS",
"keywords": [
"mask",
@@ -25,6 +25,7 @@
"module": "dist/maska.esm.js",
"unpkg": "dist/maska.umd.js",
"jsdelivr": "dist/maska.umd.js",
"types": "types/index.d.ts",
"devDependencies": {
"@babel/core": "^7.7.5",
"@babel/preset-env": "^7.7.5",
@@ -34,7 +35,8 @@
"rollup": "^2.0.2",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-terser": "^7.0.0",
"standard": "^14.3.1"
"standard": "^14.3.1",
"typescript": "^4.1.2"
},
"browserslist": "> 0.25%, ie 11",
"babel": {
+9
View File
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"allowJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "types"
},
"include": ["src/index.js"],
}
+2
View File
@@ -0,0 +1,2 @@
export default function directive(el: any, mask: any): Maska;
import Maska from "./maska";
+8
View File
@@ -0,0 +1,8 @@
export default install;
export function install(Vue: any): void;
export function create(el: any, options: any): Maska;
import mask from "./mask";
import directive from "./directive";
import tokens from "./tokens";
import Maska from "./maska";
export { mask, directive as maska, tokens };
+1
View File
@@ -0,0 +1 @@
export default function mask(value: any, mask: any, tokens: any, masked?: boolean): string;
+12
View File
@@ -0,0 +1,12 @@
export default class Maska {
constructor(el: any, opts?: {});
_opts: {
mask: any;
tokens: any;
};
_el: any;
init(): void;
destroy(): void;
updateValue(el: any, evt: any): void;
beforeInput(e: any): void;
}
+26
View File
@@ -0,0 +1,26 @@
declare var _default: {
'#': {
pattern: RegExp;
};
X: {
pattern: RegExp;
};
S: {
pattern: RegExp;
};
A: {
pattern: RegExp;
uppercase: boolean;
};
a: {
pattern: RegExp;
lowercase: boolean;
};
'!': {
escape: boolean;
};
'*': {
repeat: boolean;
};
};
export default _default;
+4
View File
@@ -0,0 +1,4 @@
export function event(name: any, inputType?: any): Event;
export function findInputElement(el: any): any;
export function fixInputSelection(el: any, position: any, digit: any): void;
export function isString(val: any): boolean;