-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
types declaration file for typescript user #131
Open
cdelhomme
wants to merge
1
commit into
ovidiuch:master
Choose a base branch
from
cdelhomme:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
/// types declaration file for typescript users (https://www.typescriptlang.org) | ||
/// dragdealer.js https://skidding.github.io/dragdealer/ | ||
|
||
interface DragDealearOption { | ||
/** | ||
* defaultValue=false | ||
* Init Dragdealer in a disabled state. The handle will have a .disabled class. | ||
* | ||
* @type {boolean} | ||
* @memberOf DragDealearOption | ||
* */ | ||
disabled?: boolean, | ||
/** | ||
* defaultValue==true | ||
* Enable horizontal dragging. | ||
* | ||
* @type {boolean} | ||
* @memberOf DragDealearOption | ||
*/ | ||
horizontal?: boolean, | ||
/** | ||
* defaultValue=false | ||
* Enable vertical dragging. | ||
* | ||
* @type {boolean} | ||
* @memberOf DragDealearOption | ||
*/ | ||
vertical?: boolean, | ||
/** | ||
* defaultValue=0 | ||
* Initial horizontal (left) position. Accepts a float number value between 0 and 1. | ||
* | ||
* @type {number} | ||
* @memberOf DragDealearOption | ||
*/ | ||
x?: number; | ||
/** | ||
* =0 Initial vertical (top) position. Accepts a float number value between 0 and 1. | ||
* | ||
* @type {number} | ||
* @memberOf DragDealearOption | ||
*/ | ||
y?: number; | ||
/** | ||
* =0 Limit the positioning of the handle within the bounds of the wrapper, by defining a virtual grid made out of a number of equally-spaced steps. This restricts placing the handle anywhere in-between these steps. E.g. setting 3 steps to a regular slider will only allow you to move it to the left, to the right or exactly in the middle. | ||
* | ||
* @type {number} | ||
* @memberOf DragDealearOption | ||
*/ | ||
steps?: number; | ||
/** | ||
* =false When a number of steps is set, snap the position of the handle to its closest step instantly, even when dragging. | ||
* | ||
* @type {boolean} | ||
* @memberOf DragDealearOption | ||
*/ | ||
snap?: boolean; | ||
/** | ||
* =true Slide handle after releasing it, depending on the movement speed before the mouse/touch release. | ||
* | ||
* @type {boolean} | ||
* @memberOf DragDealearOption | ||
*/ | ||
slide?: boolean; | ||
/** | ||
* =false Loosen-up wrapper boundaries when dragging. This allows the handle to be *slightly* dragged outside the bounds of the wrapper, but slides it back to the margins of the wrapper upon release. | ||
* | ||
* @type {boolean} | ||
* @memberOf DragDealearOption | ||
*/ | ||
loose?: boolean; | ||
/** | ||
* =0 Top padding between the wrapper and the handle. | ||
* | ||
* @type {number} | ||
* @memberOf DragDealearOption | ||
*/ | ||
top?: number; | ||
/** | ||
* =0 Bottom padding between the wrapper and the handle. | ||
* | ||
* @type {boolean} | ||
* @memberOf DragDealearOption | ||
*/ | ||
bottom?: boolean; | ||
/** | ||
* =0 Left padding between the wrapper and the handle. | ||
* | ||
* @type {number} | ||
* @memberOf DragDealearOption | ||
*/ | ||
left?: number; | ||
/** | ||
* =0 Right padding between the wrapper and the handle. | ||
* | ||
* @type {number} | ||
* @memberOf DragDealearOption | ||
*/ | ||
right?: number; | ||
/** | ||
* Called when releasing handle, with the projected x, y position of the handle. Projected value means the value the slider will have after finishing a sliding animation, caused by either a step restriction or drag motion (see steps and slide options.) | ||
* | ||
* | ||
* @memberOf DragDealearOption | ||
*/ | ||
callback?: (x: number, y: number) => void; | ||
/** | ||
* Same as callback(x,y) but only called after a drag motion, not after setting the step manually. | ||
* | ||
* | ||
* @memberOf DragDealearOption | ||
*/ | ||
dragStopCallback?: (x: number, y: number) => void; | ||
/** | ||
* Same as dragStopCallback(x,y) but called at the beginning of a drag motion and with the sliders initial x, y values. | ||
* | ||
* | ||
* @memberOf DragDealearOption | ||
*/ | ||
dragStartCallback?: (x: number, y: number) => void; | ||
/** | ||
* Called every animation loop, as long as the handle is being dragged or in the process of a sliding animation. The x, y positional values received by this callback reflect the exact position of the handle DOM element, which includes exceeding values (even negative values) when the loose option is set true. | ||
* | ||
* | ||
* @memberOf DragDealearOption | ||
*/ | ||
animationCallback?: (x: number, y: number) => void; | ||
/** | ||
* =handle Custom class of handle element. | ||
* | ||
* @type {string} | ||
* @memberOf DragDealearOption | ||
*/ | ||
handleClass?: string; | ||
/** | ||
* =true Use css3 transform in modern browsers instead of absolute positioning. | ||
* | ||
* @type {boolean} | ||
* @memberOf DragDealearOption | ||
*/ | ||
css3?: boolean; | ||
/** | ||
* Provide custom requestAnimationFrame function (used in tests). | ||
* | ||
* | ||
* @memberOf DragDealearOption | ||
*/ | ||
customRequestAnimationFrame?: () => void; | ||
/** | ||
* Provide custom cancelAnimationFrame function (used in tests). | ||
* | ||
* | ||
* @memberOf DragDealearOption | ||
*/ | ||
customCancelAnimationFrame?: () => void; | ||
} | ||
interface DragdealerConstructor { | ||
new(wrapper: string, options?: DragDealearOption): Dragdealer; | ||
} | ||
interface Dragdealer { | ||
|
||
/** | ||
* Disable dragging of a Dragdealer instance. Just as with the disabled option, the handle will receive a .disabled class | ||
* | ||
* | ||
* @memberOf Dragdealer | ||
*/ | ||
disable(): void; | ||
/** | ||
* Enable dragging of a Dragdealer instance. The .disabled class of the handle will be removed. | ||
* | ||
* | ||
* @memberOf Dragdealer | ||
*/ | ||
enable(): void; | ||
/** | ||
* Recalculate the wrapper bounds of a Dragdealer instance, used when the wrapper is responsive and its parent container changed its size, or after changing the size of the wrapper directly. | ||
* | ||
* | ||
* @memberOf Dragdealer | ||
*/ | ||
reflow(): void; | ||
/** | ||
* Get the value of a Dragdealer instance programatically.The value is returned as an[x, y]tuple and is the equivalent of the projected value returned by the regular callback, not animationCallback. | ||
* | ||
* | ||
* @memberOf Dragdealer | ||
*/ | ||
getValue(): number[]; | ||
/** | ||
* Same as getValue, but the value returned is in step increments(see steps option) | ||
* | ||
* | ||
* @memberOf Dragdealer | ||
*/ | ||
getStep(): number[]; | ||
/** | ||
* Set the value of a Dragdealer instance programatically.The 3rd parameter allows to snap the handle directly to the desired value, without any sliding transition. | ||
* | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {boolean} [snap] | ||
* | ||
* @memberOf Dragdealer | ||
*/ | ||
setValue(x: number, y?: number, snap?: boolean): void; | ||
/** | ||
* Same as setValue, but the value is received in step increments(see steps option) | ||
* | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {boolean} [snap] | ||
* | ||
* @memberOf Dragdealer | ||
*/ | ||
setStep(x: number, y: number, snap?: boolean): void; | ||
} | ||
|
||
declare var Dragdealer: DragdealerConstructor; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cdelhomme Wouldn't
DragdealerOptions
(plural) be a better name?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it should be
Dragdealer
instead ofDragDealer
.