Skip to content

Commit 0f504b5

Browse files
author
AleBles
committed
Switched typescript compiler
1 parent 461ce62 commit 0f504b5

File tree

8 files changed

+44
-176
lines changed

8 files changed

+44
-176
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2-
.idea
2+
.idea
3+
.tscache

Gruntfile.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,23 @@ module.exports = function (grunt) {
2424
}
2525
},
2626
//Typescript settings per build
27-
typescript: {
27+
ts: {
2828
options: {
2929
module: 'amd',
3030
target: 'es5',
3131
sourceMap: true,
3232
declaration: true,
33-
references: [
34-
'node_modules/phaser/typescript/pixi.d.ts',
35-
'node_modules/phaser/typescript/phaser.d.ts'
36-
],
3733
noImplicitAny: true
3834
},
3935
dist: {
4036
src: ['ts/**/*.ts'],
37+
reference: 'ts/references.ts',
4138
dest: 'build/<%= pkg.name %>.js'
4239
}
4340
},
4441
watch: {
4542
files: ['ts/**/*.ts'],
46-
tasks: ['typescript'],
43+
tasks: ['ts'],
4744
options: {
4845
livereload: true
4946
}
@@ -86,20 +83,20 @@ module.exports = function (grunt) {
8683
grunt.loadNpmTasks('grunt-contrib-clean');
8784
grunt.loadNpmTasks('grunt-contrib-uglify');
8885
grunt.loadNpmTasks('grunt-banner');
89-
grunt.loadNpmTasks('grunt-typescript');
86+
grunt.loadNpmTasks('grunt-ts');
9087
grunt.loadNpmTasks('grunt-contrib-connect');
9188
grunt.loadNpmTasks('grunt-contrib-watch');
9289

9390
//dist Build
9491
grunt.registerTask('dist', [
9592
'clean:dist', //Clean the dist folder
96-
'typescript:dist',//Run typescript on the preprocessed files, for dist (client)
93+
'ts:dist',//Run typescript on the preprocessed files, for dist (client)
9794
'uglify:dist', //Minify everything
9895
'usebanner:dist' //Minify everything
9996
]);
10097

10198
grunt.registerTask('dev', [
102-
'typescript:dist',
99+
'ts:dist',
103100
'connect',
104101
'watch'
105102
]);

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ If set to true, pressing enter will end focus on the field (default is true).
105105
- **borderColor**: string (#000 by default) Color of the border
106106
- **borderRadius**: number (0 by default) Create rounded corners by setting a border radius
107107
- **placeHolder**: string ('' by default) Text that will be shown before the user input's anything
108-
- **placeHolderColor**: string (#000 by default) The color of the placeholder text
108+
- **placeHolderColor**: string (#bfbebd by default) The color of the placeholder text
109109
- **type**: InputType (text by default) Either text, password or numeric
110110
- **backgroundColor**: string (#fff by default) The background color of the input box
111111
- **cursorColor**: string (#000 by default) The color of the blinking cursor

build/phaser-input.d.ts

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,18 @@ declare module Fabrique {
1414
focusOut: Phaser.Signal;
1515
constructor(game: Phaser.Game, id: string, type?: InputType, value?: string);
1616
addKeyUpListener(callback: () => void): void;
17-
/**
18-
* Captures the keyboard event on keydown, used to prevent it going from input field to sprite
19-
**/
2017
blockKeyDownEvents(): void;
21-
/**
22-
* To prevent bubbling of keyboard event from input field to sprite
23-
**/
2418
private preventKeyPropagation(evt);
25-
/**
26-
* Remove listener that captures keydown keyboard events
27-
**/
2819
unblockKeyDownEvents(): void;
2920
removeEventListener(): void;
3021
destroy(): void;
3122
setMax(max: string, min?: string): void;
3223
value: string;
3324
focus(): void;
3425
blur(): void;
35-
hasSelection: boolean;
36-
caretStart: number;
37-
caretEnd: number;
26+
readonly hasSelection: boolean;
27+
readonly caretStart: number;
28+
readonly caretEnd: number;
3829
getCaretPosition(): number;
3930
setCaretPosition(pos: number): void;
4031
}
@@ -76,70 +67,22 @@ declare module Fabrique {
7667
private windowScale;
7768
blockInput: boolean;
7869
constructor(game: Phaser.Game, x: number, y: number, inputOptions?: InputOptions);
79-
/**
80-
* This is a generic input down handler for the game.
81-
* if the input object is clicked, we gain focus on it and create the dom element
82-
*
83-
* If there was focus on the element previously, but clicked outside of it, the element will loose focus
84-
* and no keyboard events will be registered anymore
85-
*
86-
* @param e Phaser.Pointer
87-
*/
8870
private checkDown(e);
89-
/**
90-
* Update function makes the cursor blink, it uses two private properties to make it toggle
91-
*
92-
* @returns {number}
93-
*/
9471
private blink;
9572
private cnt;
9673
update(): number;
97-
/**
98-
* Focus is lost on the input element, we disable the cursor and remove the hidden input element
99-
*/
10074
endFocus(): void;
101-
/**
102-
*
103-
*/
10475
startFocus(): void;
10576
private keyUpProcessor();
106-
/**
107-
* Update the text value in the box, and make sure the cursor is positioned correctly
108-
*/
10977
private updateText();
110-
/**
111-
* Updates the position of the caret in the phaser input field
112-
*/
11378
private updateCursor();
114-
/**
115-
* Fetches the carrot position from the dom element. This one changes when you use the keyboard to navigate the element
116-
*
117-
* @returns {number}
118-
*/
11979
private getCaretPosition();
120-
/**
121-
* Set the caret when a click was made in the input field
122-
*
123-
* @param e
124-
*/
12580
private setCaretOnclick(e);
126-
/**
127-
* This checks if a select has been made, and if so highlight it with blue
128-
*/
12981
private updateSelection();
13082
private zoomIn();
13183
private zoomOut();
132-
/**
133-
* Event fired when a key is pressed, it takes the value from the hidden input field and adds it as its own
134-
*/
13584
private keyListener(evt);
136-
/**
137-
* We overwrite the destroy method because we want to delete the (hidden) dom element when the inputField was removed
138-
*/
13985
destroy(destroyChildren?: boolean): void;
140-
/**
141-
* Resets the text to an empty value
142-
*/
14386
resetText(): void;
14487
setText(text?: string): void;
14588
}
@@ -185,10 +128,6 @@ declare module Fabrique {
185128
static onKeyboardOpen: Phaser.Signal;
186129
static onKeyboardClose: Phaser.Signal;
187130
constructor(game: Phaser.Game, parent: Phaser.PluginManager);
188-
/**
189-
* Extends the GameObjectFactory prototype with the support of adding InputField. this allows us to add InputField methods to the game just like any other object:
190-
* game.add.InputField();
191-
*/
192131
private addInputFieldFactory();
193132
}
194133
}

0 commit comments

Comments
 (0)