mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge branch 'master' into angular-remove-any
This commit is contained in:
@@ -124,3 +124,18 @@ $localForage.iterate(function (value, key) {
|
||||
}
|
||||
}).then(function (data) {
|
||||
});
|
||||
|
||||
$localForage.bind($rootScope, 'key').then(function(data) {
|
||||
});
|
||||
|
||||
$localForage.bind($rootScope, {key: 'key'}).then(function(data) {
|
||||
});
|
||||
|
||||
$localForage.bind($rootScope, {key: 'key', defaultValue: 'defaultValue'}).then(function(data) {
|
||||
});
|
||||
|
||||
$localForage.bind($rootScope, {key: 'key', scopeKey: 'scopeKey'}).then(function(data) {
|
||||
});
|
||||
|
||||
$localForage.bind($rootScope, {key: 'key', name: 'name'}).then(function(data) {
|
||||
});
|
||||
|
||||
+5
-5
@@ -46,14 +46,14 @@ declare module angular.localForage {
|
||||
|
||||
iterate<T>(iteratorCallback:(value:string | number, key:string)=>T):angular.IPromise<T>;
|
||||
|
||||
bind($scope:ng.IScope, key:string):void;
|
||||
bind($scope:ng.IScope, key:string):angular.IPromise<any>;
|
||||
|
||||
bind($scope:ng.IScope, config:{
|
||||
key:string;
|
||||
defaultValue:any;
|
||||
scopeKey:string;
|
||||
name:string;
|
||||
}):void;
|
||||
defaultValue?:any;
|
||||
scopeKey?:string;
|
||||
name?:string;
|
||||
}):angular.IPromise<any>;
|
||||
|
||||
unbind($scope:ng.IScope, key:string, scopeKey?:string):void;
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -1224,8 +1224,8 @@ declare module angular {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IControllerService {
|
||||
// Although the documentation doesn't state this, locals are optional
|
||||
(controllerConstructor: Function, locals?: any): any;
|
||||
(controllerName: string, locals?: any): any;
|
||||
(controllerConstructor: Function, locals?: any, bindToController?: any): any;
|
||||
(controllerName: string, locals?: any, bindToController?: any): any;
|
||||
}
|
||||
|
||||
interface IControllerProvider extends IServiceProvider {
|
||||
|
||||
Vendored
+114
-100
@@ -7,8 +7,8 @@ declare function CodeMirror(host: HTMLElement, options?: CodeMirror.EditorConfig
|
||||
declare function CodeMirror(callback: (host: HTMLElement) => void , options?: CodeMirror.EditorConfiguration): CodeMirror.Editor;
|
||||
|
||||
declare module CodeMirror {
|
||||
export var Doc : CodeMirror.Doc;
|
||||
export var Pos: CodeMirror.Position;
|
||||
export var Doc : CodeMirror.DocConstructor;
|
||||
export var Pos: CodeMirror.PositionConstructor;
|
||||
export var Pass: any;
|
||||
|
||||
function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea;
|
||||
@@ -88,84 +88,84 @@ declare module CodeMirror {
|
||||
or the line the widget is on require the widget to be redrawn. */
|
||||
function on(line: LineWidget, eventName: 'redraw', handler: () => void ): void;
|
||||
function off(line: LineWidget, eventName: 'redraw', handler: () => void ): void;
|
||||
|
||||
/** Various CodeMirror-related objects emit events, which allow client code to react to various situations.
|
||||
Handlers for such events can be registered with the on and off methods on the objects that the event fires on.
|
||||
|
||||
/** Various CodeMirror-related objects emit events, which allow client code to react to various situations.
|
||||
Handlers for such events can be registered with the on and off methods on the objects that the event fires on.
|
||||
To fire your own events, use CodeMirror.signal(target, name, args...), where target is a non-DOM-node object. */
|
||||
function signal(target: any, name: string, ...args: any[]): void;
|
||||
|
||||
interface Editor {
|
||||
|
||||
|
||||
/** Tells you whether the editor currently has focus. */
|
||||
hasFocus(): boolean;
|
||||
|
||||
|
||||
/** Used to find the target position for horizontal cursor motion.start is a { line , ch } object,
|
||||
amount an integer(may be negative), and unit one of the string "char", "column", or "word".
|
||||
Will return a position that is produced by moving amount times the distance specified by unit.
|
||||
When visually is true , motion in right - to - left text will be visual rather than logical.
|
||||
When the motion was clipped by hitting the end or start of the document, the returned value will have a hitSide property set to true. */
|
||||
findPosH(start: CodeMirror.Position, amount: number, unit: string, visually: boolean): { line: number; ch: number; hitSide?: boolean; };
|
||||
|
||||
|
||||
/** Similar to findPosH , but used for vertical motion.unit may be "line" or "page".
|
||||
The other arguments and the returned value have the same interpretation as they have in findPosH. */
|
||||
findPosV(start: CodeMirror.Position, amount: number, unit: string): { line: number; ch: number; hitSide?: boolean; };
|
||||
|
||||
|
||||
|
||||
|
||||
/** Change the configuration of the editor. option should the name of an option, and value should be a valid value for that option. */
|
||||
setOption(option: string, value: any): void;
|
||||
|
||||
|
||||
/** Retrieves the current value of the given option for this editor instance. */
|
||||
getOption(option: string): any;
|
||||
|
||||
|
||||
/** Attach an additional keymap to the editor.
|
||||
This is mostly useful for add - ons that need to register some key handlers without trampling on the extraKeys option.
|
||||
Maps added in this way have a higher precedence than the extraKeys and keyMap options, and between them,
|
||||
the maps added earlier have a lower precedence than those added later, unless the bottom argument was passed,
|
||||
in which case they end up below other keymaps added with this method. */
|
||||
addKeyMap(map: any, bottom?: boolean): void;
|
||||
|
||||
|
||||
/** Disable a keymap added with addKeyMap.Either pass in the keymap object itself , or a string,
|
||||
which will be compared against the name property of the active keymaps. */
|
||||
removeKeyMap(map: any): void;
|
||||
|
||||
|
||||
/** Enable a highlighting overlay.This is a stateless mini - mode that can be used to add extra highlighting.
|
||||
For example, the search add - on uses it to highlight the term that's currently being searched.
|
||||
mode can be a mode spec or a mode object (an object with a token method). The options parameter is optional. If given, it should be an object.
|
||||
Currently, only the opaque option is recognized. This defaults to off, but can be given to allow the overlay styling, when not null,
|
||||
to override the styling of the base mode entirely, instead of the two being applied together. */
|
||||
addOverlay(mode: any, options?: any): void;
|
||||
|
||||
|
||||
/** Pass this the exact argument passed for the mode parameter to addOverlay to remove an overlay again. */
|
||||
removeOverlay(mode: any): void;
|
||||
|
||||
|
||||
|
||||
|
||||
/** Retrieve the currently active document from an editor. */
|
||||
getDoc(): CodeMirror.Doc;
|
||||
|
||||
|
||||
/** Attach a new document to the editor. Returns the old document, which is now no longer associated with an editor. */
|
||||
swapDoc(doc: CodeMirror.Doc): CodeMirror.Doc;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Sets the gutter marker for the given gutter (identified by its CSS class, see the gutters option) to the given value.
|
||||
Value can be either null, to clear the marker, or a DOM element, to set it. The DOM element will be shown in the specified gutter next to the specified line. */
|
||||
setGutterMarker(line: any, gutterID: string, value: HTMLElement): CodeMirror.LineHandle;
|
||||
|
||||
|
||||
/** Remove all gutter markers in the gutter with the given ID. */
|
||||
clearGutter(gutterID: string): void;
|
||||
|
||||
|
||||
/** Set a CSS class name for the given line.line can be a number or a line handle.
|
||||
where determines to which element this class should be applied, can can be one of "text" (the text element, which lies in front of the selection),
|
||||
"background"(a background element that will be behind the selection),
|
||||
or "wrap" (the wrapper node that wraps all of the line's elements, including gutter elements).
|
||||
class should be the name of the class to apply. */
|
||||
addLineClass(line: any, where: string, _class_: string): CodeMirror.LineHandle;
|
||||
|
||||
|
||||
/** Remove a CSS class from a line.line can be a line handle or number.
|
||||
where should be one of "text", "background", or "wrap"(see addLineClass).
|
||||
class can be left off to remove all classes for the specified node, or be a string to remove only a specific class. */
|
||||
removeLineClass(line: any, where: string, class_: string): CodeMirror.LineHandle;
|
||||
|
||||
|
||||
/** Returns the line number, text content, and marker status of the given line, which can be either a number or a line handle. */
|
||||
lineInfo(line: any): {
|
||||
line: any;
|
||||
@@ -179,12 +179,12 @@ declare module CodeMirror {
|
||||
/** Array of line widgets attached to this line. */
|
||||
widgets: any;
|
||||
};
|
||||
|
||||
|
||||
/** Puts node, which should be an absolutely positioned DOM node, into the editor, positioned right below the given { line , ch } position.
|
||||
When scrollIntoView is true, the editor will ensure that the entire node is visible (if possible).
|
||||
To remove the widget again, simply use DOM methods (move it somewhere else, or call removeChild on its parent). */
|
||||
addWidget(pos: CodeMirror.Position, node: HTMLElement, scrollIntoView: boolean): void;
|
||||
|
||||
|
||||
/** Adds a line widget, an element shown below a line, spanning the whole of the editor's width, and moving the lines below it downwards.
|
||||
line should be either an integer or a line handle, and node should be a DOM node, which will be displayed below the given line.
|
||||
options, when given, should be an object that configures the behavior of the widget.
|
||||
@@ -199,16 +199,16 @@ declare module CodeMirror {
|
||||
/** When true, will cause the widget to be rendered even if the line it is associated with is hidden. */
|
||||
showIfHidden: boolean;
|
||||
}): CodeMirror.LineWidget;
|
||||
|
||||
|
||||
|
||||
|
||||
/** Programatically set the size of the editor (overriding the applicable CSS rules).
|
||||
width and height height can be either numbers(interpreted as pixels) or CSS units ("100%", for example).
|
||||
You can pass null for either of them to indicate that that dimension should not be changed. */
|
||||
setSize(width: any, height: any): void;
|
||||
|
||||
|
||||
/** Scroll the editor to a given(pixel) position.Both arguments may be left as null or undefined to have no effect. */
|
||||
scrollTo(x: number, y: number): void;
|
||||
|
||||
|
||||
/** Get an { left , top , width , height , clientWidth , clientHeight } object that represents the current scroll position, the size of the scrollable area,
|
||||
and the size of the visible area(minus scrollbars). */
|
||||
getScrollInfo(): {
|
||||
@@ -219,53 +219,53 @@ declare module CodeMirror {
|
||||
clientWidth: any;
|
||||
clientHeight: any;
|
||||
}
|
||||
|
||||
|
||||
/** Scrolls the given element into view. pos is a { line , ch } position, referring to a given character, null, to refer to the cursor.
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
scrollIntoView(pos: CodeMirror.Position, margin?: number): void;
|
||||
|
||||
|
||||
/** Scrolls the given element into view. pos is a { left , top , right , bottom } object, in editor-local coordinates.
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
scrollIntoView(pos: { left: number; top: number; right: number; bottom: number; }, margin: number): void;
|
||||
|
||||
|
||||
/** Returns an { left , top , bottom } object containing the coordinates of the cursor position.
|
||||
If mode is "local" , they will be relative to the top-left corner of the editable document.
|
||||
If it is "page" or not given, they are relative to the top-left corner of the page.
|
||||
where is a boolean indicating whether you want the start(true) or the end(false) of the selection. */
|
||||
cursorCoords(where: boolean, mode: string): { left: number; top: number; bottom: number; };
|
||||
|
||||
|
||||
/** Returns an { left , top , bottom } object containing the coordinates of the cursor position.
|
||||
If mode is "local" , they will be relative to the top-left corner of the editable document.
|
||||
If it is "page" or not given, they are relative to the top-left corner of the page.
|
||||
where specifies the precise position at which you want to measure. */
|
||||
cursorCoords(where: CodeMirror.Position, mode: string): { left: number; top: number; bottom: number; };
|
||||
|
||||
|
||||
/** Returns the position and dimensions of an arbitrary character.pos should be a { line , ch } object.
|
||||
This differs from cursorCoords in that it'll give the size of the whole character,
|
||||
rather than just the position that the cursor would have when it would sit at that position. */
|
||||
charCoords(pos: CodeMirror.Position, mode: string): { left: number; right: number; top: number; bottom: number; };
|
||||
|
||||
|
||||
/** Given an { left , top } object , returns the { line , ch } position that corresponds to it.
|
||||
The optional mode parameter determines relative to what the coordinates are interpreted. It may be "window" , "page"(the default) , or "local". */
|
||||
coordsChar(object: { left: number; top: number; }, mode?: string): CodeMirror.Position;
|
||||
|
||||
|
||||
/** Returns the line height of the default font for the editor. */
|
||||
defaultTextHeight(): number;
|
||||
|
||||
|
||||
/** Returns the pixel width of an 'x' in the default font for the editor.
|
||||
(Note that for non - monospace fonts , this is mostly useless, and even for monospace fonts, non - ascii characters might have a different width). */
|
||||
defaultCharWidth(): number;
|
||||
|
||||
|
||||
/** Returns a { from , to } object indicating the start (inclusive) and end (exclusive) of the currently rendered part of the document.
|
||||
In big documents, when most content is scrolled out of view, CodeMirror will only render the visible part, and a margin around it.
|
||||
See also the viewportChange event. */
|
||||
getViewport(): { from: number; to: number };
|
||||
|
||||
|
||||
/** If your code does something to change the size of the editor element (window resizes are already listened for), or unhides it,
|
||||
you should probably follow up by calling this method to ensure CodeMirror is still looking as intended. */
|
||||
refresh(): void;
|
||||
|
||||
|
||||
|
||||
|
||||
/** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */
|
||||
getTokenAt(pos: CodeMirror.Position): {
|
||||
/** The character(on the given line) at which the token starts. */
|
||||
@@ -277,20 +277,20 @@ declare module CodeMirror {
|
||||
/** The token type the mode assigned to the token, such as "keyword" or "comment" (may also be null). */
|
||||
type: string;
|
||||
/** The mode's state at the end of this token. */
|
||||
state: any;
|
||||
state: any;
|
||||
};
|
||||
|
||||
|
||||
/** Returns the mode's parser state, if any, at the end of the given line number.
|
||||
If no line number is given, the state at the end of the document is returned.
|
||||
This can be useful for storing parsing errors in the state, or getting other kinds of contextual information for a line. */
|
||||
getStateAfter(line?: number): any;
|
||||
|
||||
|
||||
/** CodeMirror internally buffers changes and only updates its DOM structure after it has finished performing some operation.
|
||||
If you need to perform a lot of operations on a CodeMirror instance, you can call this method with a function argument.
|
||||
It will call the function, buffering up all changes, and only doing the expensive update after the function returns.
|
||||
This can be a lot faster. The return value from this method will be the return value of your function. */
|
||||
operation<T>(fn: ()=> T): T;
|
||||
|
||||
|
||||
/** Adjust the indentation of the given line.
|
||||
The second argument (which defaults to "smart") may be one of:
|
||||
"prev" Base indentation on the indentation of the previous line.
|
||||
@@ -298,100 +298,110 @@ declare module CodeMirror {
|
||||
"add" Increase the indentation of the line by one indent unit.
|
||||
"subtract" Reduce the indentation of the line. */
|
||||
indentLine(line: number, dir?: string): void;
|
||||
|
||||
|
||||
|
||||
|
||||
/** Give the editor focus. */
|
||||
focus(): void;
|
||||
|
||||
|
||||
/** Returns the hidden textarea used to read input. */
|
||||
getInputField(): HTMLTextAreaElement;
|
||||
|
||||
|
||||
/** Returns the DOM node that represents the editor, and controls its size. Remove this from your tree to delete an editor instance. */
|
||||
getWrapperElement(): HTMLElement;
|
||||
|
||||
|
||||
/** Returns the DOM node that is responsible for the scrolling of the editor. */
|
||||
getScrollerElement(): HTMLElement;
|
||||
|
||||
|
||||
/** Fetches the DOM node that contains the editor gutters. */
|
||||
getGutterElement(): HTMLElement;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** Events are registered with the on method (and removed with the off method).
|
||||
These are the events that fire on the instance object. The name of the event is followed by the arguments that will be passed to the handler.
|
||||
The instance argument always refers to the editor instance. */
|
||||
on(eventName: string, handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: string, handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
|
||||
/** Fires every time the content of the editor is changed. */
|
||||
on(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void;
|
||||
off(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void;
|
||||
|
||||
/** This event is fired before a change is applied, and its handler may choose to modify or cancel the change.
|
||||
|
||||
/** Like the "change" event, but batched per operation, passing an
|
||||
* array containing all the changes that happened in the operation.
|
||||
* This event is fired after the operation finished, and display
|
||||
* changes it makes will trigger a new operation. */
|
||||
on(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void;
|
||||
off(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void;
|
||||
|
||||
/** This event is fired before a change is applied, and its handler may choose to modify or cancel the change.
|
||||
The changeObj never has a next property, since this is fired for each individual change, and not batched per operation.
|
||||
Note: you may not do anything from a "beforeChange" handler that would cause changes to the document or its visualization.
|
||||
Doing so will, since this handler is called directly from the bowels of the CodeMirror implementation,
|
||||
probably cause the editor to become corrupted. */
|
||||
on(eventName: 'beforeChange', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => void ): void;
|
||||
off(eventName: 'beforeChange', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeCancellable) => void ): void;
|
||||
|
||||
|
||||
/** Will be fired when the cursor or selection moves, or any change is made to the editor content. */
|
||||
on(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: 'cursorActivity', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
|
||||
/** This event is fired before the selection is moved. Its handler may modify the resulting selection head and anchor.
|
||||
Handlers for this event have the same restriction as "beforeChange" handlers � they should not do anything to directly update the state of the editor. */
|
||||
on(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void ): void;
|
||||
off(eventName: 'beforeSelectionChange', handler: (instance: CodeMirror.Editor, selection: { head: CodeMirror.Position; anchor: CodeMirror.Position; }) => void ): void;
|
||||
|
||||
|
||||
/** Fires whenever the view port of the editor changes (due to scrolling, editing, or any other factor).
|
||||
The from and to arguments give the new start and end of the viewport. */
|
||||
on(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void ): void;
|
||||
off(eventName: 'viewportChange', handler: (instance: CodeMirror.Editor, from: number, to: number) => void ): void;
|
||||
|
||||
|
||||
/** Fires when the editor gutter (the line-number area) is clicked. Will pass the editor instance as first argument,
|
||||
the (zero-based) number of the line that was clicked as second argument, the CSS class of the gutter that was clicked as third argument,
|
||||
and the raw mousedown event object as fourth argument. */
|
||||
on(eventName: 'gutterClick', handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: Event) => void ): void;
|
||||
off(eventName: 'gutterClick', handler: (instance: CodeMirror.Editor, line: number, gutter: string, clickEvent: Event) => void ): void;
|
||||
|
||||
|
||||
/** Fires whenever the editor is focused. */
|
||||
on(eventName: 'focus', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: 'focus', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
|
||||
/** Fires whenever the editor is unfocused. */
|
||||
on(eventName: 'blur', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: 'blur', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
|
||||
/** Fires when the editor is scrolled. */
|
||||
on(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: 'scroll', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
|
||||
/** Will be fired whenever CodeMirror updates its DOM display. */
|
||||
on(eventName: 'update', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
off(eventName: 'update', handler: (instance: CodeMirror.Editor) => void ): void;
|
||||
|
||||
|
||||
/** Fired whenever a line is (re-)rendered to the DOM. Fired right after the DOM element is built, before it is added to the document.
|
||||
The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */
|
||||
on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void;
|
||||
off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void;
|
||||
}
|
||||
|
||||
|
||||
interface EditorFromTextArea extends Editor {
|
||||
|
||||
|
||||
/** Copy the content of the editor into the textarea. */
|
||||
save(): void;
|
||||
|
||||
|
||||
/** Remove the editor, and restore the original textarea (with the editor's current content). */
|
||||
toTextArea(): void;
|
||||
|
||||
|
||||
/** Returns the textarea that the instance was based on. */
|
||||
getTextArea(): HTMLTextAreaElement;
|
||||
}
|
||||
|
||||
interface Doc {
|
||||
new (text: string, mode?: any, firstLineNumber?: number): Doc;
|
||||
interface DocConstructor {
|
||||
new (text: string, mode?: any, firstLineNumber?: number, lineSep?: string): Doc;
|
||||
(text: string, mode?: any, firstLineNumber?: number, lineSep?: string): Doc;
|
||||
}
|
||||
|
||||
interface Doc {
|
||||
/** Get the current editor content. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n"). */
|
||||
getValue(seperator?: string): string;
|
||||
|
||||
@@ -551,7 +561,7 @@ declare module CodeMirror {
|
||||
|
||||
/** Returns an array of all the bookmarks and marked ranges present at the given position. */
|
||||
findMarksAt(pos: CodeMirror.Position): TextMarker[];
|
||||
|
||||
|
||||
/** Returns an array containing all marked ranges in the document. */
|
||||
getAllMarks(): CodeMirror.TextMarker[];
|
||||
|
||||
@@ -602,7 +612,7 @@ declare module CodeMirror {
|
||||
/** Array of strings representing the text that replaced the changed range (split by line). */
|
||||
text: string[];
|
||||
/** Text that used to be between from and to, which is overwritten by this change. */
|
||||
removed: string;
|
||||
removed: string[];
|
||||
/** String representing the origin of the change event and wether it can be merged with history */
|
||||
origin: string;
|
||||
}
|
||||
@@ -619,8 +629,12 @@ declare module CodeMirror {
|
||||
cancel(): void;
|
||||
}
|
||||
|
||||
interface Position {
|
||||
interface PositionConstructor {
|
||||
new (line: number, ch: number): Position;
|
||||
(line: number, ch: number): Position;
|
||||
}
|
||||
|
||||
interface Position {
|
||||
ch: number;
|
||||
line: number;
|
||||
}
|
||||
@@ -654,7 +668,7 @@ declare module CodeMirror {
|
||||
/** Configures whether the editor should re-indent the current line when a character is typed
|
||||
that might change its proper indentation (only works if the mode supports indentation). Default is true. */
|
||||
electricChars?: boolean;
|
||||
|
||||
|
||||
/** Determines whether horizontal cursor movement through right-to-left (Arabic, Hebrew) text
|
||||
is visual (pressing the left arrow moves the cursor left)
|
||||
or logical (pressing the left arrow moves to the next lower index in the string, which is visually right in right-to-left text).
|
||||
@@ -664,16 +678,16 @@ declare module CodeMirror {
|
||||
/** Configures the keymap to use. The default is "default", which is the only keymap defined in codemirror.js itself.
|
||||
Extra keymaps are found in the keymap directory. See the section on keymaps for more information. */
|
||||
keyMap?: string;
|
||||
|
||||
|
||||
/** Can be used to specify extra keybindings for the editor, alongside the ones defined by keyMap. Should be either null, or a valid keymap value. */
|
||||
extraKeys?: any;
|
||||
|
||||
|
||||
/** Whether CodeMirror should scroll or wrap for long lines. Defaults to false (scroll). */
|
||||
lineWrapping?: boolean;
|
||||
|
||||
|
||||
/** Whether to show line numbers to the left of the editor. */
|
||||
lineNumbers?: boolean;
|
||||
|
||||
|
||||
/** At which number to start counting lines. Default is 1. */
|
||||
firstLineNumber?: number;
|
||||
|
||||
@@ -686,23 +700,23 @@ declare module CodeMirror {
|
||||
May include the CodeMirror-linenumbers class, in order to explicitly set the position of the line number gutter
|
||||
(it will default to be to the right of all other gutters). These class names are the keys passed to setGutterMarker. */
|
||||
gutters?: string[];
|
||||
|
||||
|
||||
/** Determines whether the gutter scrolls along with the content horizontally (false)
|
||||
or whether it stays fixed during horizontal scrolling (true, the default). */
|
||||
fixedGutter?: boolean;
|
||||
|
||||
|
||||
/** boolean|string. This disables editing of the editor content by the user. If the special value "nocursor" is given (instead of simply true), focusing of the editor is also disallowed. */
|
||||
readOnly?: any;
|
||||
|
||||
|
||||
/**Whether the cursor should be drawn when a selection is active. Defaults to false. */
|
||||
showCursorWhenSelecting?: boolean;
|
||||
|
||||
|
||||
/** The maximum number of undo levels that the editor stores. Defaults to 40. */
|
||||
undoDepth?: number;
|
||||
|
||||
|
||||
/** The period of inactivity (in milliseconds) that will cause a new history event to be started when typing or deleting. Defaults to 500. */
|
||||
historyEventDelay?: number;
|
||||
|
||||
|
||||
/** The tab index to assign to the editor. If not given, no tab index will be assigned. */
|
||||
tabindex?: number;
|
||||
|
||||
@@ -775,21 +789,21 @@ declare module CodeMirror {
|
||||
interface TextMarkerOptions {
|
||||
/** Assigns a CSS class to the marked stretch of text. */
|
||||
className?: string;
|
||||
|
||||
|
||||
/** Determines whether text inserted on the left of the marker will end up inside or outside of it. */
|
||||
inclusiveLeft?: boolean;
|
||||
|
||||
|
||||
/** Like inclusiveLeft , but for the right side. */
|
||||
inclusiveRight?: boolean;
|
||||
|
||||
|
||||
/** Atomic ranges act as a single unit when cursor movement is concerned — i.e. it is impossible to place the cursor inside of them.
|
||||
In atomic ranges, inclusiveLeft and inclusiveRight have a different meaning — they will prevent the cursor from being placed
|
||||
respectively directly before and directly after the range. */
|
||||
atomic?: boolean;
|
||||
|
||||
|
||||
/** Collapsed ranges do not show up in the display.Setting a range to be collapsed will automatically make it atomic. */
|
||||
collapsed?: boolean;
|
||||
|
||||
|
||||
/** When enabled, will cause the mark to clear itself whenever the cursor enters its range.
|
||||
This is mostly useful for text - replacement widgets that need to 'snap open' when the user tries to edit them.
|
||||
The "clear" event fired on the range handle can be used to be notified when this happens. */
|
||||
@@ -797,7 +811,7 @@ declare module CodeMirror {
|
||||
|
||||
/** Determines whether the mark is automatically cleared when it becomes empty. Default is true. */
|
||||
clearWhenEmpty?: boolean;
|
||||
|
||||
|
||||
/** Use a given node to display this range.Implies both collapsed and atomic.
|
||||
The given DOM node must be an inline element(as opposed to a block element). */
|
||||
replacedWith?: HTMLElement;
|
||||
@@ -807,18 +821,18 @@ declare module CodeMirror {
|
||||
* false—the events will be left alone for the default browser handler,
|
||||
* or specific handlers on the widget, to capture. */
|
||||
handleMouseEvents?: boolean;
|
||||
|
||||
|
||||
/** A read - only span can, as long as it is not cleared, not be modified except by calling setValue to reset the whole document.
|
||||
Note: adding a read - only span currently clears the undo history of the editor,
|
||||
because existing undo events being partially nullified by read - only spans would corrupt the history (in the current implementation). */
|
||||
readOnly?: boolean;
|
||||
|
||||
|
||||
/** When set to true (default is false), adding this marker will create an event in the undo history that can be individually undone(clearing the marker). */
|
||||
addToHistory?: boolean;
|
||||
|
||||
|
||||
/** Can be used to specify an extra CSS class to be applied to the leftmost span that is part of the marker. */
|
||||
startStyle?: string;
|
||||
|
||||
|
||||
/** Equivalent to startStyle, but for the rightmost span. */
|
||||
endStyle?: string;
|
||||
|
||||
@@ -827,12 +841,12 @@ declare module CodeMirror {
|
||||
|
||||
/** When given, will give the nodes created for this span a HTML title attribute with the given value. */
|
||||
title?: string;
|
||||
|
||||
|
||||
/** When the target document is linked to other documents, you can set shared to true to make the marker appear in all documents.
|
||||
By default, a marker appears only in its target document. */
|
||||
shared?: boolean;
|
||||
}
|
||||
|
||||
|
||||
interface StringStream {
|
||||
lastColumnPos: number;
|
||||
lastColumnValue: number;
|
||||
|
||||
Vendored
+106
-73
@@ -1,95 +1,128 @@
|
||||
// Type definitions for Dropzone 3.7.1
|
||||
// Type definitions for Dropzone 4.0.1
|
||||
// Project: http://www.dropzonejs.com/
|
||||
// Definitions by: Natan Vivo <https://github.com/nvivo>
|
||||
// Definitions by: Natan Vivo <https://github.com/nvivo>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface DropzoneFile extends File {
|
||||
previewElement: HTMLElement;
|
||||
previewTemplate: HTMLElement;
|
||||
previewsContainer: HTMLElement;
|
||||
status: string;
|
||||
accepted: boolean;
|
||||
previewElement: HTMLElement;
|
||||
previewTemplate: HTMLElement;
|
||||
previewsContainer: HTMLElement;
|
||||
status: string;
|
||||
accepted: boolean;
|
||||
}
|
||||
|
||||
interface DropzoneOptions {
|
||||
url?: string;
|
||||
method?: string;
|
||||
withCredentials?: boolean;
|
||||
parallelUploads?: number;
|
||||
maxFilesize?: number;
|
||||
paramName?: string;
|
||||
uploadMultiple?: boolean;
|
||||
headers?: any;
|
||||
addRemoveLinks?: boolean;
|
||||
previewsContainer?: string;
|
||||
clickable?: any;
|
||||
createImageThumbnails?: boolean;
|
||||
maxThumbnailFilesize?: number;
|
||||
thumbnailWidth?: number;
|
||||
thumbnailHeight?: number;
|
||||
maxFiles?: number;
|
||||
resize?: (file?: any) => any;
|
||||
init?: () => void;
|
||||
acceptedFiles?: string;
|
||||
accept?: (file: DropzoneFile, doneCallback: (...args) => void) => void;
|
||||
autoProcessQueue?: boolean;
|
||||
previewTemplate?: string;
|
||||
forceFallback?: boolean;
|
||||
fallback?: () => void;
|
||||
url?: string;
|
||||
method?: string;
|
||||
withCredentials?: boolean;
|
||||
parallelUploads?: number;
|
||||
maxFilesize?: number;
|
||||
paramName?: string;
|
||||
uploadMultiple?: boolean;
|
||||
headers?: any;
|
||||
addRemoveLinks?: boolean;
|
||||
previewsContainer?: string;
|
||||
clickable?: any;
|
||||
createImageThumbnails?: boolean;
|
||||
maxThumbnailFilesize?: number;
|
||||
thumbnailWidth?: number;
|
||||
thumbnailHeight?: number;
|
||||
maxFiles?: number;
|
||||
resize?: ( file?: any ) => any;
|
||||
init?: () => void;
|
||||
acceptedFiles?: string;
|
||||
accept?: ( file: DropzoneFile, doneCallback: ( ...args ) => void ) => void;
|
||||
autoProcessQueue?: boolean;
|
||||
previewTemplate?: string;
|
||||
forceFallback?: boolean;
|
||||
fallback?: () => void;
|
||||
|
||||
// dictionary options
|
||||
dictDefaultMessage?: string;
|
||||
dictFallbackMessage?: string;
|
||||
dictFallbackText?: string;
|
||||
dictInvalidFileType?: string;
|
||||
dictFileTooBig?: string;
|
||||
dictResponseError?: string;
|
||||
dictCancelUpload?: string;
|
||||
dictCancelUploadConfirmation?: string;
|
||||
dictRemoveFile?: string;
|
||||
dictRemoveFileConfirmation?: string;
|
||||
dictMaxFilesExceeded?: string;
|
||||
// dictionary options
|
||||
dictDefaultMessage?: string;
|
||||
dictFallbackMessage?: string;
|
||||
dictFallbackText?: string;
|
||||
dictInvalidFileType?: string;
|
||||
dictFileTooBig?: string;
|
||||
dictResponseError?: string;
|
||||
dictCancelUpload?: string;
|
||||
dictCancelUploadConfirmation?: string;
|
||||
dictRemoveFile?: string;
|
||||
dictRemoveFileConfirmation?: string;
|
||||
dictMaxFilesExceeded?: string;
|
||||
}
|
||||
|
||||
declare class Dropzone {
|
||||
constructor(container: string, options?: DropzoneOptions);
|
||||
constructor(container: HTMLElement, options?: DropzoneOptions);
|
||||
static autoDiscover: boolean;
|
||||
static options: any;
|
||||
static confirm: (question: string, accepted: () => void, rejected?: () => void) => void;
|
||||
constructor( container: string, options?: DropzoneOptions );
|
||||
constructor( container: HTMLElement, options?: DropzoneOptions );
|
||||
|
||||
files: DropzoneFile[];
|
||||
static autoDiscover: boolean;
|
||||
static options: any;
|
||||
static confirm: ( question: string, accepted: () => void, rejected?: () => void ) => void;
|
||||
|
||||
on(eventName, callback: (...args) => any);
|
||||
off(eventName): void;
|
||||
files: DropzoneFile[];
|
||||
|
||||
removeFile(file: DropzoneFile): void;
|
||||
removeAllFiles(cancelIfNecessary?: boolean): void;
|
||||
processQueue(): void;
|
||||
getAcceptedFiles(): DropzoneFile[];
|
||||
getRejectedFiles(): DropzoneFile[];
|
||||
getQueuedFiles(): DropzoneFile[];
|
||||
getUploadingFiles(): DropzoneFile[];
|
||||
enable(): void;
|
||||
disable(): void;
|
||||
destroy(): Dropzone;
|
||||
|
||||
emit(eventName: string, file: DropzoneFile, str?: string);
|
||||
emit(eventName: "thumbnail", file: DropzoneFile, path: string);
|
||||
emit(eventName: "addedfile", file: DropzoneFile);
|
||||
emit(eventName: "removedfile", file: DropzoneFile);
|
||||
emit(eventName: "processing", file: DropzoneFile);
|
||||
emit(eventName: "canceled", file: DropzoneFile);
|
||||
emit(eventName: "complete", file: DropzoneFile);
|
||||
on( eventName, callback: ( ...args ) => any );
|
||||
|
||||
emit(eventName: string, e: Event);
|
||||
emit(eventName: "drop", e: Event);
|
||||
emit(eventName: "dragstart", e: Event);
|
||||
emit(eventName: "dragend", e: Event);
|
||||
emit(eventName: "dragenter", e: Event);
|
||||
emit(eventName: "dragover", e: Event);
|
||||
emit(eventName: "dragleave", e: Event);
|
||||
off( eventName ): void;
|
||||
|
||||
addFile( file: DropzoneFile ): void;
|
||||
|
||||
removeFile( file: DropzoneFile ): void;
|
||||
|
||||
removeAllFiles( cancelIfNecessary?: boolean ): void;
|
||||
|
||||
processQueue(): void;
|
||||
|
||||
cancelUpload( file: DropzoneFile ): void;
|
||||
|
||||
processFiles ( files: DropzoneFile[] ): void;
|
||||
processFile( file: DropzoneFile ): void;
|
||||
|
||||
uploadFile( file: DropzoneFile ): void;
|
||||
|
||||
getAcceptedFiles(): DropzoneFile[];
|
||||
|
||||
getRejectedFiles(): DropzoneFile[];
|
||||
|
||||
getQueuedFiles(): DropzoneFile[];
|
||||
|
||||
getUploadingFiles(): DropzoneFile[];
|
||||
|
||||
accept( file: DropzoneFile, done: ( error?: string ) => {} ):void;
|
||||
getActiveFiles(): DropzoneFile[];
|
||||
getFilesWithStatus( status: string ): DropzoneFile[];
|
||||
enqueueFile( file: DropzoneFile ): void;
|
||||
enqueueFiles( file: DropzoneFile[] ): void;
|
||||
createThumbnail( file: DropzoneFile, callback?: (...any) => {}): any;
|
||||
createThumbnailFromUrl( file: DropzoneFile, url: string, callback?: ( ...any ) => any ): any;
|
||||
|
||||
emit( eventName: string, file: DropzoneFile, str?: string );
|
||||
emit( eventName: "thumbnail", file: DropzoneFile, path: string );
|
||||
emit( eventName: "addedfile", file: DropzoneFile );
|
||||
emit( eventName: "removedfile", file: DropzoneFile );
|
||||
emit( eventName: "processing", file: DropzoneFile );
|
||||
emit( eventName: "canceled", file: DropzoneFile );
|
||||
emit( eventName: "complete", file: DropzoneFile );
|
||||
|
||||
emit( eventName: string, e: Event );
|
||||
emit( eventName: "drop", e: Event );
|
||||
emit( eventName: "dragstart", e: Event );
|
||||
emit( eventName: "dragend", e: Event );
|
||||
emit( eventName: "dragenter", e: Event );
|
||||
emit( eventName: "dragover", e: Event );
|
||||
emit( eventName: "dragleave", e: Event );
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
dropzone(options: DropzoneOptions): Dropzone;
|
||||
dropzone( options: DropzoneOptions ): Dropzone;
|
||||
}
|
||||
|
||||
declare module "dropzone" {
|
||||
export = Dropzone;
|
||||
}
|
||||
|
||||
@@ -253,11 +253,15 @@ result = <Array<number>>_.flatten([1, [2], [[3]]], true);
|
||||
result = <Array<number>>_.flatten<number>([1, [2], [3, [[4]]]], true);
|
||||
result = <Array<number|boolean>>_.flatten<number|boolean>([1, [2], [3, [[false]]]], true);
|
||||
|
||||
result = <Array<number>>_.flattenDeep<number>([[[[1]]]]);
|
||||
|
||||
result = <_.LoDashArrayWrapper<number>>_([[1, 2], [3, 4], 5, 6]).flatten();
|
||||
result = <_.LoDashArrayWrapper<number|Array<Array<number>>>>_([1, [2], [3, [[4]]]]).flatten();
|
||||
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, [2], [3, [[4]]]]).flatten(true);
|
||||
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, [2], [3, [[4]]]]).flattenDeep();
|
||||
|
||||
result = <number>_.indexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
result = <number>_.indexOf([1, 1, 2, 2, 3, 3], 2, true);
|
||||
@@ -759,12 +763,34 @@ _.forEach(saves, function (type) {
|
||||
asyncSave({ 'type': type, 'complete': done });
|
||||
});
|
||||
|
||||
// _.ary
|
||||
result = <number[]>['6', '8', '10'].map(_.ary<(s: string) => number>(parseInt, 1));
|
||||
result = <number[]>['6', '8', '10'].map(_(parseInt).ary<(s: string) => number>(1).value());
|
||||
|
||||
// _.backflow
|
||||
var testBackflowSquareFn = (n: number) => n * n;
|
||||
var testBackflowAddFn = (n: number, m: number) => n + m;
|
||||
result = <number>_.backflow<(n: number, m: number) => number>(testBackflowSquareFn, testBackflowAddFn)(1, 2);
|
||||
result = <number>_(testBackflowSquareFn).backflow<(n: number, m: number) => number>(testBackflowAddFn).value()(1, 2);
|
||||
|
||||
// _.before
|
||||
var testBeforeFn = ((n: number) => () => ++n)(0);
|
||||
var testBeforeResultFn = <() => number>_.before<() => number>(3, testBeforeFn);
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 1
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 2
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 2
|
||||
var testBeforeFn = ((n: number) => () => ++n)(0);
|
||||
var testBeforeResultFn = <() => number>_(3).before<() => number>(testBeforeFn);
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 1
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 2
|
||||
result = <number>testBeforeResultFn();
|
||||
// → 2
|
||||
|
||||
var funcBind = function(greeting: string, punctuation: string) { return greeting + ' ' + this.user + punctuation; };
|
||||
var funcBound1: (punctuation: string) => any = _.bind(funcBind, { 'name': 'moe' }, 'hi');
|
||||
funcBound1('!');
|
||||
@@ -951,6 +977,18 @@ var optionsPartialRight = {
|
||||
|
||||
defaultsDeep(optionsPartialRight, _.templateSettings);
|
||||
|
||||
//_.restParam
|
||||
var testRestParamFn = (a: string, b: string, c: number[]) => a + ' ' + b + ' ' + c.join(' ');
|
||||
interface testRestParamFunc {
|
||||
(a: string, b: string, c: number[]): string;
|
||||
}
|
||||
interface testRestParamResult {
|
||||
(a: string, b: string, ...c: number[]): string;
|
||||
}
|
||||
result = <string>(_.restParam<testRestParamResult, testRestParamFunc>(testRestParamFn, 2))('a', 'b', 1, 2, 3);
|
||||
result = <string>(_.restParam<testRestParamResult>(testRestParamFn, 2))('a', 'b', 1, 2, 3);
|
||||
result = <string>(_(testRestParamFn).restParam<testRestParamResult>(2).value())('a', 'b', 1, 2, 3);
|
||||
|
||||
var throttled = _.throttle(function () { }, 100);
|
||||
jQuery(window).on('scroll', throttled);
|
||||
|
||||
|
||||
Vendored
+86
-3
@@ -800,7 +800,9 @@ declare module _ {
|
||||
//_.flatten
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Flattens a nested array.
|
||||
* Flattens a nested array a single level.
|
||||
*
|
||||
* _.flatten(x) is equivalent to _.flatten(x, false);
|
||||
*
|
||||
* @param array The array to flatten.
|
||||
* @return `array` flattened.
|
||||
@@ -811,11 +813,24 @@ declare module _ {
|
||||
* Flattens a nested array. If isDeep is true the array is recursively flattened, otherwise it is only
|
||||
* flattened a single level.
|
||||
*
|
||||
* If you know whether or not this should be recursively at compile time, you typically want to use a
|
||||
* version without a boolean parameter (i.e. `_.flatten(x)` or `_.flattenDeep(x)`).
|
||||
*
|
||||
* @param array The array to flatten.
|
||||
* @param deep Specify a deep flatten.
|
||||
* @return `array` flattened.
|
||||
**/
|
||||
flatten<T>(array: RecursiveList<T>, isDeep: boolean): List<T> | RecursiveList<T>;
|
||||
|
||||
/**
|
||||
* Recursively flattens a nested array.
|
||||
*
|
||||
* _.flattenDeep(x) is equivalent to _.flatten(x, true);
|
||||
*
|
||||
* @param array The array to flatten
|
||||
* @return `array` recursively flattened
|
||||
*/
|
||||
flattenDeep<T>(array: RecursiveList<T>): List<T>
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
@@ -825,9 +840,14 @@ declare module _ {
|
||||
flatten<T>(): LoDashArrayWrapper<any>;
|
||||
|
||||
/**
|
||||
* @see _.flatten
|
||||
**/
|
||||
* @see _.flatten
|
||||
**/
|
||||
flatten<T>(isShallow: boolean): LoDashArrayWrapper<any>;
|
||||
|
||||
/**
|
||||
* @see _.flattenDeep
|
||||
*/
|
||||
flattenDeep<T>(): LoDashArrayWrapper<any>;
|
||||
}
|
||||
|
||||
//_.indexOf
|
||||
@@ -5149,6 +5169,25 @@ declare module _ {
|
||||
after(func: Function): LoDashObjectWrapper<Function>;
|
||||
}
|
||||
|
||||
//_.ary
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that accepts up to n arguments ignoring any additional arguments.
|
||||
* @param func The function to cap arguments for.
|
||||
* @param n The arity cap.
|
||||
* @param guard Enables use as a callback for functions like `_.map`.
|
||||
* @returns Returns the new function.
|
||||
*/
|
||||
ary<TResult extends Function>(func: Function, n?: number, guard?: Object): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.ary
|
||||
*/
|
||||
ary<TResult extends Function>(n?: number, guard?: Object): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.backflow
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -5164,6 +5203,26 @@ declare module _ {
|
||||
backflow<TResult extends Function>(...funcs: Function[]): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.before
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that invokes func, with the this binding and arguments of the created function, while
|
||||
* it is called less than n times. Subsequent calls to the created function return the result of the last func
|
||||
* invocation.
|
||||
* @param n The number of calls at which func is no longer invoked.
|
||||
* @param func The function to restrict.
|
||||
* @return Returns the new restricted function.
|
||||
*/
|
||||
before<TFunc extends Function>(n: number, func: TFunc): TFunc;
|
||||
}
|
||||
|
||||
interface LoDashWrapper<T> {
|
||||
/**
|
||||
* @sed _.before
|
||||
*/
|
||||
before<TFunc extends Function>(func: TFunc): TFunc;
|
||||
}
|
||||
|
||||
//_.bind
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -5595,6 +5654,30 @@ declare module _ {
|
||||
...args: any[]): Function;
|
||||
}
|
||||
|
||||
//_.restParam
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that invokes func with the this binding of the created function and arguments from start
|
||||
* and beyond provided as an array.
|
||||
* @param func The function to apply a rest parameter to.
|
||||
* @param start The start position of the rest parameter.
|
||||
* @return Returns the new function.
|
||||
*/
|
||||
restParam<TResult extends Function>(func: Function, start?: number): TResult;
|
||||
|
||||
/**
|
||||
* @see _.restParam
|
||||
*/
|
||||
restParam<TResult extends Function, TFunc extends Function>(func: TFunc, start?: number): TResult;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.restParam
|
||||
*/
|
||||
restParam<TResult extends Function>(start?: number): LoDashObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.throttle
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="path-case.d.ts" />
|
||||
|
||||
import pathCase = require('path-case');
|
||||
|
||||
console.log(pathCase('string')); // => "string"
|
||||
console.log(pathCase('camelCase')); // => "camel/case"
|
||||
console.log(pathCase('sentence case')); // => "sentence/case"
|
||||
|
||||
console.log(pathCase('MY STRING', 'tr')); // => "my.strıng"
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for path-case
|
||||
// Project: https://github.com/blakeembrey/path-case
|
||||
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "path-case" {
|
||||
function pathCase(string: string, locale?: string): string;
|
||||
export = pathCase;
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
///<reference path="react-dnd.d.ts" />
|
||||
"use strict";
|
||||
|
||||
// Test adapted from the ReactDnD chess game tutorial:
|
||||
// http://gaearon.github.io/react-dnd/docs-tutorial.html
|
||||
|
||||
import React = require("react");
|
||||
import ReactDnd = require("react-dnd");
|
||||
|
||||
var r = React.DOM;
|
||||
|
||||
import DragSource = ReactDnd.DragSource;
|
||||
import DropTarget = ReactDnd.DropTarget;
|
||||
import DragDropContext = ReactDnd.DragDropContext;
|
||||
import HTML5Backend = require('react-dnd/modules/backends/HTML5');
|
||||
|
||||
// Game Component
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
module Game {
|
||||
var knightPosition = [0, 0];
|
||||
var observer: any = null;
|
||||
|
||||
function emitChange() {
|
||||
observer(knightPosition);
|
||||
}
|
||||
|
||||
export function observe(o: any) {
|
||||
if (observer) {
|
||||
throw new Error("Multiple observers not implemented.");
|
||||
}
|
||||
|
||||
observer = o;
|
||||
emitChange();
|
||||
}
|
||||
|
||||
export function moveKnight(toX: number, toY: number) {
|
||||
knightPosition = [toX, toY];
|
||||
emitChange();
|
||||
}
|
||||
|
||||
export function canMoveKnight(toX: number, toY: number) {
|
||||
const x = knightPosition[0];
|
||||
const y = knightPosition[1];
|
||||
const dx = toX - x;
|
||||
const dy = toY - y;
|
||||
|
||||
return (Math.abs(dx) === 2 && Math.abs(dy) === 1) ||
|
||||
(Math.abs(dx) === 1 && Math.abs(dy) === 2);
|
||||
}
|
||||
}
|
||||
|
||||
var ItemTypes = {
|
||||
KNIGHT: "knight"
|
||||
};
|
||||
|
||||
// Knight Component
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
module Knight {
|
||||
interface KnightP extends React.Props<Knight> {
|
||||
connectDragSource: ReactDnd.ConnectDragSource;
|
||||
connectDragPreview: ReactDnd.ConnectDragPreview;
|
||||
isDragging: boolean;
|
||||
}
|
||||
|
||||
var knightSource: ReactDnd.DragSourceSpec<KnightP> = {
|
||||
beginDrag: (props) => {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
function knightCollect(connect: ReactDnd.DragSourceConnector, monitor: ReactDnd.DragSourceMonitor) {
|
||||
return {
|
||||
connectDragSource: connect.dragSource(),
|
||||
connectDragPreview: connect.dragPreview(),
|
||||
isDragging: monitor.isDragging()
|
||||
};
|
||||
}
|
||||
|
||||
export class Knight extends React.Component<KnightP, {}> {
|
||||
static create = React.createFactory(Knight);
|
||||
|
||||
componentDidMount() {
|
||||
var img = HTML5Backend.getEmptyImage();
|
||||
img.onload = () => this.props.connectDragPreview(img);
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.props.connectDragSource(
|
||||
r.div({
|
||||
style: {
|
||||
opacity: this.props.isDragging ? 0.5 : 1,
|
||||
fontSize: 25,
|
||||
fontWeight: 'bold',
|
||||
cursor: 'move'
|
||||
}
|
||||
}, "♘")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export var DndKnight = DragSource(ItemTypes.KNIGHT, knightSource, knightCollect)(Knight);
|
||||
export var create = React.createFactory(DndKnight);
|
||||
}
|
||||
|
||||
// Square Component
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
module Square {
|
||||
interface SquareP extends React.Props<Square> {
|
||||
black: boolean;
|
||||
}
|
||||
|
||||
export class Square extends React.Component<SquareP, {}> {
|
||||
render() {
|
||||
var fill = this.props.black ? 'black' : 'white';
|
||||
return r.div({
|
||||
style: {
|
||||
backgroundColor: fill
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export var create = React.createFactory(Square);
|
||||
}
|
||||
|
||||
// BoardSquare Component
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
module BoardSquare {
|
||||
interface BoardSquareP extends React.Props<BoardSquare> {
|
||||
x: number;
|
||||
y: number;
|
||||
connectDropTarget?: ReactDnd.ConnectDropTarget;
|
||||
isOver?: boolean;
|
||||
canDrop?: boolean;
|
||||
}
|
||||
|
||||
var boardSquareTarget: ReactDnd.DropTargetSpec<BoardSquareP> = {
|
||||
canDrop: (props) => Game.canMoveKnight(props.x, props.y),
|
||||
drop: (props) => Game.moveKnight(props.x, props.y)
|
||||
};
|
||||
|
||||
function boardSquareCollect(connect: ReactDnd.DropTargetConnector, monitor: ReactDnd.DropTargetMonitor) {
|
||||
return {
|
||||
connectDropTarget: connect.dropTarget(),
|
||||
isOver: monitor.isOver(),
|
||||
canDrop: monitor.canDrop()
|
||||
};
|
||||
}
|
||||
|
||||
export class BoardSquare extends React.Component<BoardSquareP, {}> {
|
||||
private _renderOverlay = (color: string) => {
|
||||
return r.div({
|
||||
style: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
zIndex: 1,
|
||||
opacity: 0.5,
|
||||
backgroundColor: color
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
var black = (this.props.x + this.props.y) % 2 === 1;
|
||||
var isOver = this.props.isOver;
|
||||
var canDrop = this.props.canDrop;
|
||||
|
||||
return this.props.connectDropTarget(
|
||||
r.div({
|
||||
style: {
|
||||
position: 'relative',
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
},
|
||||
children: [
|
||||
Square.create({
|
||||
black: black
|
||||
}),
|
||||
isOver && !canDrop ? this._renderOverlay('red') : null,
|
||||
!isOver && canDrop ? this._renderOverlay('yellow') : null,
|
||||
isOver && canDrop ? this._renderOverlay('green') : null
|
||||
]
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export var DndBoardSquare = DropTarget(ItemTypes.KNIGHT, boardSquareTarget, boardSquareCollect)(BoardSquare);
|
||||
export var create = React.createFactory(DndBoardSquare);
|
||||
}
|
||||
|
||||
// Board Component
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
module Board {
|
||||
interface BoardP extends React.Props<Board> {
|
||||
knightPosition: number[];
|
||||
}
|
||||
|
||||
export class Board extends React.Component<BoardP, {}> {
|
||||
private _renderPiece = (x: number, y: number) => {
|
||||
var knightX = this.props.knightPosition[0];
|
||||
var knightY = this.props.knightPosition[1];
|
||||
return x === knightX && y === knightY ?
|
||||
Knight.create() :
|
||||
null;
|
||||
};
|
||||
|
||||
private _renderSquare = (i: number) => {
|
||||
var x = i % 8;
|
||||
var y = Math.floor(i / 8);
|
||||
|
||||
return r.div({
|
||||
key: i,
|
||||
style: {
|
||||
width: '12.5%',
|
||||
height: '12.5%'
|
||||
}
|
||||
}, BoardSquare.create({
|
||||
x: x,
|
||||
y: y
|
||||
}, this._renderPiece(x, y)));
|
||||
};
|
||||
|
||||
render() {
|
||||
var squares: React.DOMElement<React.HTMLAttributes>[] = [];
|
||||
for (let i = 0; i < 64; i++) {
|
||||
squares.push(this._renderSquare(i));
|
||||
}
|
||||
|
||||
return r.div({
|
||||
style: {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap'
|
||||
},
|
||||
children: squares
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var DndBoard = DragDropContext(HTML5Backend)(Board);
|
||||
export var create = React.createFactory(DndBoard);
|
||||
}
|
||||
|
||||
|
||||
// Render the Board Component
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Board.create({
|
||||
knightPosition: [0, 0]
|
||||
});
|
||||
Vendored
+172
@@ -0,0 +1,172 @@
|
||||
// Type definitions for React DnD v1.1.4
|
||||
// Project: https://github.com/gaearon/react-dnd
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path='../react/react.d.ts' />
|
||||
|
||||
declare module __ReactDnd {
|
||||
import React = __React;
|
||||
|
||||
// Decorated React Components
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
class ContextComponent<P, S> extends React.Component<P, S> {
|
||||
getDecoratedComponentInstance(): React.Component<P, S>;
|
||||
// Note: getManager is not yet documented on the React DnD docs.
|
||||
getManager(): any;
|
||||
}
|
||||
|
||||
class DndComponent<P, S> extends React.Component<P, S> {
|
||||
getDecoratedComponentInstance(): React.Component<P, S>;
|
||||
getHandlerId(): Identifier;
|
||||
}
|
||||
|
||||
interface ContextComponentClass<P> extends React.ComponentClass<P> {
|
||||
new(props?: P, context?: any): ContextComponent<P, any>;
|
||||
DecoratedComponent: React.ComponentClass<P>;
|
||||
}
|
||||
|
||||
interface DndComponentClass<P> extends React.ComponentClass<P> {
|
||||
new(props?: P, context?: any): DndComponent<P, any>;
|
||||
DecoratedComponent: React.ComponentClass<P>;
|
||||
}
|
||||
|
||||
// Top-level API
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export function DragSource<P>(
|
||||
type: Identifier | ((props: P) => Identifier),
|
||||
spec: DragSourceSpec<P>,
|
||||
collect: (connect: DragSourceConnector, monitor: DragSourceMonitor) => Object,
|
||||
options?: DndOptions<P>
|
||||
): (componentClass: React.ComponentClass<P>) => DndComponentClass<P>;
|
||||
|
||||
export function DropTarget<P>(
|
||||
types: Identifier | Identifier[] | ((props: P) => Identifier | Identifier[]),
|
||||
spec: DropTargetSpec<P>,
|
||||
collect: (connect: DropTargetConnector, monitor: DropTargetMonitor) => Object,
|
||||
options?: DndOptions<P>
|
||||
): (componentClass: React.ComponentClass<P>) => DndComponentClass<P>;
|
||||
|
||||
export function DragDropContext<P>(
|
||||
backend: Backend
|
||||
): (componentClass: React.ComponentClass<P>) => ContextComponentClass<P>;
|
||||
|
||||
// TODO: Add exported function for DragLayer.
|
||||
// The React DnD docs say that this is an advanced feature that is only
|
||||
// necessary when performing custom rendering or when using a custom
|
||||
// backend.
|
||||
|
||||
// Shared
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// The React DnD docs say that this can also be the ES6 Symbol.
|
||||
type Identifier = string;
|
||||
|
||||
interface ClientOffset {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
interface DndOptions<P> {
|
||||
arePropsEqual?(props: P, otherProps: P): boolean;
|
||||
}
|
||||
|
||||
// DragSource
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface DragSourceSpec<P> {
|
||||
beginDrag(props: P, monitor?: DragSourceMonitor, component?: React.Component<P, any>): Object;
|
||||
endDrag?(props: P, monitor?: DragSourceMonitor, component?: React.Component<P, any>): void;
|
||||
canDrag?(props: P, monitor?: DragSourceMonitor): boolean;
|
||||
isDragging?(props: P, monitor?: DragSourceMonitor): boolean;
|
||||
}
|
||||
|
||||
class DragSourceMonitor {
|
||||
canDrag(): boolean;
|
||||
isDragging(): boolean;
|
||||
getItemType(): Identifier;
|
||||
getItem(): Object;
|
||||
getDropResult(): Object;
|
||||
didDrop(): boolean;
|
||||
getInitialClientOffset(): ClientOffset;
|
||||
getInitialSourceClientOffset(): ClientOffset;
|
||||
getClientOffset(): ClientOffset;
|
||||
getDifferenceFromInitialOffset(): ClientOffset;
|
||||
getSourceClientOffset(): ClientOffset;
|
||||
}
|
||||
|
||||
class DragSourceConnector {
|
||||
dragSource(): ConnectDragSource;
|
||||
dragPreview(): ConnectDragPreview;
|
||||
}
|
||||
|
||||
interface DragElementWrapper<O> {
|
||||
<P>(elementOrNode: React.ReactElement<P>, options?: O): React.ReactElement<P>;
|
||||
}
|
||||
|
||||
interface DragSourceOptions {
|
||||
dropEffect?: string;
|
||||
}
|
||||
|
||||
interface DragPreviewOptions {
|
||||
captureDraggingState?: boolean;
|
||||
anchorX?: number;
|
||||
anchorY?: number;
|
||||
}
|
||||
|
||||
type ConnectDragSource = DragElementWrapper<DragSourceOptions>;
|
||||
type ConnectDragPreview = DragElementWrapper<DragPreviewOptions>;
|
||||
|
||||
/// DropTarget
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface DropTargetSpec<P> {
|
||||
drop?(props: P, monitor?: DropTargetMonitor, component?: React.Component<P, any>): Object|void;
|
||||
hover?(props: P, monitor?: DropTargetMonitor, component?: React.Component<P, any>): void;
|
||||
canDrop?(props: P, monitor?: DropTargetMonitor): boolean;
|
||||
}
|
||||
|
||||
class DropTargetMonitor {
|
||||
canDrop(): boolean;
|
||||
isOver(options?: { shallow: boolean }): boolean;
|
||||
getItemType(): Identifier;
|
||||
getItem(): Object;
|
||||
getDropResult(): Object;
|
||||
didDrop(): boolean;
|
||||
getInitialClientOffset(): ClientOffset;
|
||||
getInitialSourceClientOffset(): ClientOffset;
|
||||
getClientOffset(): ClientOffset;
|
||||
getDifferenceFromInitialOffset(): ClientOffset;
|
||||
getSourceClientOffset(): ClientOffset;
|
||||
}
|
||||
|
||||
class DropTargetConnector {
|
||||
dropTarget(): ConnectDropTarget;
|
||||
}
|
||||
|
||||
type ConnectDropTarget = <P>(elementOrNode: React.ReactElement<P>) => React.ReactElement<P>;
|
||||
|
||||
/// Backend
|
||||
/// ---------------------------------------------------------------------
|
||||
|
||||
// TODO: Fill in the Backend interface.
|
||||
// The React DnD docs do not cover this, and this is only needed for
|
||||
// creating custom backends (i.e. not using the built-in HTML5Backend).
|
||||
interface Backend {}
|
||||
}
|
||||
|
||||
declare module "react-dnd" {
|
||||
export = __ReactDnd;
|
||||
}
|
||||
|
||||
declare module "react-dnd/modules/backends/HTML5" {
|
||||
enum _NativeTypes { FILE, URL, TEXT }
|
||||
class HTML5Backend implements __ReactDnd.Backend {
|
||||
static getEmptyImage(): any; // Image
|
||||
static NativeTypes: _NativeTypes;
|
||||
}
|
||||
|
||||
export = HTML5Backend;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/// <reference path="resemble.d.ts" />
|
||||
|
||||
resemble.outputSettings({
|
||||
errorColor: {
|
||||
red: 255,
|
||||
green: 0,
|
||||
blue: 255
|
||||
},
|
||||
errorType: 'movement',
|
||||
transparency: 0.3,
|
||||
largeImageThreshold: 1200
|
||||
});
|
||||
|
||||
resemble("images/image.png").onComplete(function(data) {
|
||||
var r: number = data.red;
|
||||
var g: number = data.green;
|
||||
var b: number = data.blue;
|
||||
var brightness: number = data.brightness;
|
||||
});
|
||||
|
||||
resemble("images/image.png").compareTo("images/image2.png").onComplete(function(data) {
|
||||
var diffImageDataUrl: string = data.getImageDataUrl();
|
||||
var difference: number = data.misMatchPercentage;
|
||||
});
|
||||
|
||||
resemble("images/image2.png").compareTo("images/image2.png")
|
||||
.ignoreAntialiasing()
|
||||
.ignoreColors()
|
||||
.repaint()
|
||||
.onComplete(function(data) {
|
||||
var diffImageDataUrl: string = data.getImageDataUrl();
|
||||
var difference: number = data.misMatchPercentage;
|
||||
});
|
||||
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// Type definitions for Resemble.js v1.3.0
|
||||
// Project: http://huddle.github.io/Resemble.js/
|
||||
// Definitions by: Tim Perry <https://github.com/pimterry>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Resemble {
|
||||
interface ResembleStatic {
|
||||
(image: string|ImageData): ResembleAnalysis;
|
||||
outputSettings(settings: OutputSettings): ResembleStatic;
|
||||
}
|
||||
|
||||
interface OutputSettings {
|
||||
errorColor: {
|
||||
red: number;
|
||||
green: number;
|
||||
blue: number;
|
||||
};
|
||||
errorType: string;
|
||||
transparency: number;
|
||||
largeImageThreshold: number;
|
||||
}
|
||||
|
||||
interface ResembleAnalysis {
|
||||
onComplete(callback: (result: ResembleAnalysisResult) => void): void;
|
||||
compareTo(fileData: string|ImageData): ResembleComparison;
|
||||
}
|
||||
|
||||
interface ResembleAnalysisResult {
|
||||
red: number;
|
||||
green: number;
|
||||
blue: number;
|
||||
brightness: number;
|
||||
}
|
||||
|
||||
interface ResembleComparison {
|
||||
onComplete(callback: (result: ResembleComparisonResult) => void): void;
|
||||
|
||||
ignoreNothing(): ResembleComparison;
|
||||
ignoreAntialiasing(): ResembleComparison;
|
||||
ignoreColors(): ResembleComparison;
|
||||
repaint(): ResembleComparison;
|
||||
|
||||
}
|
||||
|
||||
interface ResembleComparisonResult {
|
||||
isSameDimensions: boolean;
|
||||
dimensionDifference: {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
getImageDataUrl(): string;
|
||||
|
||||
misMatchPercentage: number;
|
||||
diffBounds: {
|
||||
top: number;
|
||||
left: number;
|
||||
bottom: number;
|
||||
right: number;
|
||||
};
|
||||
|
||||
analysisTime: number;
|
||||
}
|
||||
}
|
||||
|
||||
declare var resemble: Resemble.ResembleStatic;
|
||||
Vendored
+4
-4
@@ -115,13 +115,13 @@ declare module restangular {
|
||||
patch(queryParams?: any, headers?: any): IPromise<any>;
|
||||
clone(): IElement;
|
||||
plain(): any;
|
||||
plain<T>(): T;
|
||||
plain<T>(): T;
|
||||
withHttpConfig(httpConfig: IRequestConfig): IElement;
|
||||
save(queryParams?: any, headers?: any): IPromise<any>;
|
||||
getRestangularUrl(): string;
|
||||
}
|
||||
|
||||
interface ICollection extends IService {
|
||||
interface ICollection extends IService, Array<any> {
|
||||
getList(queryParams?: any, headers?: any): ICollectionPromise<any>;
|
||||
getList<T>(queryParams?: any, headers?: any): ICollectionPromise<T>;
|
||||
post(elementToPost: any, queryParams?: any, headers?: any): IPromise<any>;
|
||||
@@ -132,9 +132,9 @@ declare module restangular {
|
||||
patch(queryParams?: any, headers?: any): IPromise<any>;
|
||||
putElement(idx: any, params: any, headers: any): IPromise<any>;
|
||||
withHttpConfig(httpConfig: IRequestConfig): ICollection;
|
||||
clone(): ICollection;
|
||||
clone(): ICollection;
|
||||
plain(): any;
|
||||
plain<T>(): T[];
|
||||
plain<T>(): T[];
|
||||
getRestangularUrl(): string;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user